akhauriyash/Code-Regression huggingface dataset:
N = int(input())
X = list(map(int, input().split()))
 
ans = 10**9
m = min(X)
M = max(X)
for i in range(m, M+1):
  cost = 0
  for j in range(N):
    cost += (X[j]-i)**2
  ans = min(ans, cost)
  
print(ans)

Measured memory_bytes: 9192
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

int main(void){
  char buf[16] = { 0 };
  int H, W, K;
  int  grid[6][6] = { { 0 } };
  
  fgets(buf, sizeof(buf), stdin);
  sscanf(buf, "%d %d %d", &H, &W, &K);
  
  for(int i = 0; i < H; i++){
    memset(buf, 0, sizeof(buf));
    fgets(buf, sizeof(buf), stdin);
    for(int j = 0; j < W; j++){
      if(buf[j] == '.') grid[i][j] = 0;
      else if(buf[j] ==  '#') grid[i][j] = 1;
      //printf("%d ", grid[i][j]);
    }
    //printf("\n");
  }
  int count = 0;
  for(int bit_i = 0; bit_i < (int)pow(2,H); bit_i++){
    for(int bit_j = 0; bit_j < (int)pow(2,W); bit_j++){
      int sum = 0;
      for(int i = 0; i < H; i++){
        if(((int)pow(2,i) & bit_i) == 0) continue;
        for(int j = 0; j < W; j++){
          if(((int)pow(2,j) & bit_j) == 0) continue;
          sum += grid[i][j];
        }
      }
      if(sum == K) count++;
    }
  }
  
  printf("%d\n", count);
  
  return 0;
}

Measured memory_bytes: 2608
N,A,B,C,D=(int(x) for x in input().split())

x=N//A
if N%A>0:
    x=x+1

y=N//C
if N%C>0:
    y=y+1
    
if x*B<=y*D:
    print(x*B)
else:
    print(y*D)


Measured memory_bytes: 5604
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back
#define endl '\n'
 
int t=1;
 
void print2d(vector<vector<int>> &v){
    for(int i=0;i<v.size();i++){
        for(int x:v[i]){
            cout << x <<' ';
        }
        cout <<endl;
    }
}
 
void print(vector<int> &a){
    for(int x : a){
        cout << x <<' ';
    }
    cout << endl;
    return;
}

void solve(){
    int x;
    int ans=-1;
    for(int i=0;i<5;i++){
        cin >> x;
        if(x==0)ans=i+1;
    }
    cout << ans <<endl;
}
 
int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
 
    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif
 
    // cin >> t;
    for(int i=1;i<=t;i++){
        solve();
    }
    // solve();
 
    return 0;
}


Measured memory_bytes: 3568
from itertools import permutations

def score(S):
    S0 = [' '] + S + [' ']
    score = 0
    s = [0]*len(S0)
    for i in range(1, len(S)+1):
        c = S0[i]
        if c == 'L':
            s[i] += 1 if S0[i-1] == 'L' else 0
        else:
            s[i] += 1 if S0[i+1] == 'R' else 0
    return sum(s)

def main2():
    N, K = map(int, input().split())
    S = list(input().strip())
    m = score(S)
    
    print(min(m + 2 * K, N-1))

def main():
    N, K = map(int, input().split())
    S = list(input().strip())
    print(S, score(S), "initial")
    m = score(S)
    for ps in permutations([(i, j) for i in range(N) for j in range(i, N)], K):
        S_ = list(S)
        for p in ps:
            apply(S_, p)
        s = score(S_) 
        if m < s:
            mp = ps
            m = s
    S_ = list(S)
    for p in mp:
        apply(S_, p)
        print(S_, score(S_), p)
    print(m, mp)

def apply(S, lr):
    l, r = lr
    for i in range(r-l+1):
        if l+i > r-i:
            break
        S[l+i], S[r-i] = S[r-i], S[l+i]
        S[l+i] = 'R' if S[l+i] == 'L' else 'L'
        if l+i != r-i:
            S[r-i] = 'R' if S[r-i] == 'L' else 'L'

if 1==0:
    S = list("LLLLL")
    apply(S, (0, 4))
    print(S)

main2()


Measured memory_bytes: 5672
#include <iostream>

using namespace std;

int main (void) {

    int r, g, b;

    cin >> r >> g >> b;

    if ((g * 10 + b) % 4 == 0) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }

    return 0;
}

Measured memory_bytes: 3612
#include <bits/stdc++.h>
using namespace std;

int main()
{
    unsigned long long n1, n2,n3,n4,i=2, max;
    cin >> n1 >> n2;
    
    // maximum value between n1 and n2 is stored in max
    max = (n1 > n2) ? n1 : n2;

    do
    {
        if (max % n1 == 0 && max % n2 == 0)
        {
            break;
        }
        else
            max=n1*i;
            i++;
    } while (max<(n1*n2));
    cout<<max;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;

typedef long l;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<int, string> pis;
typedef pair<long, long> pll;

#define EACH(t, c) for (auto&& t : c)
#define ALL(c) begin(c), end(c)
#define FOR(i, s, e) for (int i = (s); i < (int)(e); ++i)
#define REP(i, n) FOR(i, 0, n)
#define endl '\n'
#define mod 1e9 + 7
#define INF 999999999
#define F first
#define S second
#define pb push_back
#define mp make_pair

const int dx[] = {1, 0, -1, 0, 1, 1, -1, -1}, dy[] = {0, 1, 0, -1, 1, -1, 1, -1};

template<typename T>
void print(const std::vector<T>& v, char sep=' ') {
  for (int i = 0; i < (int)v.size(); i++) {
    if (i != 0) cout << sep;
    cout << v[i];
  }
  cout << endl;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  int n, m;
  cin >> n >> m;
  cout << (n - 1) * (m - 1) << endl;

}



Measured memory_bytes: 256
#include <cstdio>
#include <iostream>

using namespace std;

int main(void) {
    int w[10], v1, v2;
    while (scanf("%d,", w) != EOF) {
        for (int i = 1; i < 10; i++) scanf("%d,", w + i);
        scanf("%d,%d", &v1, &v2);
        int sum = 0;
        for (int i = 0; i < 10; i++) sum += w[i];
        double x = (double)(sum * v1) / (v1 + v2);
        for (int i = 0; i < 10; i++) {
            x -= w[i];
            if (x <= 0.01) {
                cout << i + 1 << endl;
                break;
            }
        }
    }
    return 0;
}

Measured memory_bytes: 1208
n,k=map(int, input().split())
a=list(map(int, input().split()))
from itertools import accumulate
for _ in range(k):
    new=[0]*n
    for i in range(n):
        j=a[i]
        l=max(0,i-j)
        r=min(n-1,i+j)
        new[l]+=1
        if r+1<n:
            new[r+1]-=1
    new=list(accumulate(new))
    a=new
    if all([i==n for i in a]):
        break
print(*a)


Measured memory_bytes: 183528
fun main(args: Array<String>) {
    val s = readInputLine()

    val charList = s.toCharArray()
 
    var beforeCh = '-'

    for (c in charList) {
        if (c == beforeCh) {
            println("Bad")
            return
        }
        beforeCh = c
    }
    println("Good")
}
 
fun readInputLine(): String {
    return readLine()!!
}


Measured memory_bytes: 33688
#include <bits/stdc++.h>
#include <vector>

using namespace std;

int main(int argc, const char *argv[]) {
  int n;
  cin >> n;

  vector<int> va(n);
  map<int, int> cnt1, cnt2;
  for (int i = 0; i < n; ++i) {
    cin >> va[i];
    if (i % 2 == 0) {
      cnt1[va[i]]++;
    } else {
      cnt2[va[i]]++;
    }
  }

  int max1 = 0, max2 = 0, max3 = 0, max4 = 0;
  for (auto &p : cnt1) {
    if (cnt1[max1] < p.second) {
      int old = max1;
      max1 = p.first;
      max2 = old;
    } else if (cnt1[max2] < p.second) {
      max2 = p.first;
    }
  }

  for (auto &p : cnt2) {
    if (cnt2[max3] < p.second) {
      int old = max3;
      max3 = p.first;
      max4 = old;
    } else if (cnt2[max4] < p.second) {
      max4 = p.first;
    }
  }

  if (max1 != max3) {
    int ans = n - cnt1[max1] - cnt2[max3];
    cout << ans << '\n';
  } else {
    int ans = n - max(cnt1[max1] + cnt2[max4], cnt1[max2] + cnt2[max3]);
    cout << ans << '\n';
  }
}

Measured memory_bytes: 5376
'use strict'

function main(s) {

  s = s.split('\n')[0].split(' ').map(n => Number(n));

  const a = s[0];
  const b = s[1];
  const c = s[2];

  const ans = ((b - a) === (c - b)) ? 'YES' : 'NO'

  console.log(ans);
}

main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 7372
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll gcd(ll a, ll b) {
	return b ? gcd(b, a % b) : a;
}
int main() {
	ll a, b;
	cin >> a >> b;
	ll d = gcd(a, b);
	int ans = 1;
	for (ll i = 2; i * i <= d; i++) {
		if (d % i == 0) {
			ans++; 
			while (d % i == 0) d /= i;
		}
	}
	if (d > 1) ans++;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <regex>
#include "bits/stdc++.h"
#define FOR(i, s, e) for (int i = int(s); i < int(e); ++i)
#define REP(i, e) FOR(i, 0, e)
#define INF (INT_MAX / 2)
#define LINF (LLONG_MAX / 2)
#define EPS (1.0e-8)
const int MGN = 10;
const int ARY_SZ_MAX = (int)1e7;
using namespace std;
using ll = long long; using ull = unsigned long long;
using vi = vector<int>; using vvi = vector<vi>;
using vc = vector<char>; using vvc = vector<vc>;
using vb = vector<bool>; using vvb = vector<vb>;
using vl = vector<ll>; using vvl = vector<vl>;
using vd = vector<double>; using vs = vector<string>;
using pii = pair<int, int>; using pll = pair<ll, ll>; using psl = pair<string, ll>;


int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);


  char C; cin>>C;

  char ans = C+1;
  cout << ans << endl;


  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
	int n,m,x;
	cin>>n>>m>>x;
	int a[m];
	int b[1000]={0};
	for(int i=1;i<=m;i++){
		cin>>a[i];
		b[a[i]]++;
	}
	int sumN=0;
	int sumO=0;
	for(int i=x;i<=n;i++){
		if(b[i]==1){
			sumN++;
		}
	}
	for(int i=x;i>=0;i--){
		if(b[i]==1){
			sumO++;
		}
	}
	cout<<min(sumN,sumO)<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;

#define FAST ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

#define MAXX 100005

#define PI 3.14159265358979323846264338327950

#define ll signed long long int

ll a[MAXX];
multiset<ll> ms;
multiset<ll>::iterator it;
signed main()
{
    FAST;
    ll n, mx = 0;
    cin >> n;
    ll ans = 1;
    for(ll i = 0;i < n; i++){
    	cin >> a[i];
    	if(a[i] >= mx){
    		mx = a[i]; ans ++;
		}
	}
	cout << ans-1;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int ans = 1;
		int ansCount = 0;
		for(int i = 1; i <= N; i++) {
			if(i%2 != 0) {
				continue;
			}
			int tmp = i;
			int count = 0;
			while(true) {
				if(tmp%2 == 0) {
					count++;
					tmp = tmp/2;
				} else {
					break;
				}
			}
			if(count > ansCount) {
				ans = i;
				ansCount = count;
			}
		}
		System.out.println(ans);
	}
}

Measured memory_bytes: 25300
import java.io.*;
import java.math.*;
import java.util.*;

public class Main {
    private static boolean debug = false;
    private static boolean elapsed = false;

    private static PrintWriter _out = new PrintWriter(System.out);
    private static PrintWriter _err = new PrintWriter(System.err);

    private void solve(Scanner sc) {
        int N = sc.nextInt();

        int x = 800 * N;
        int y = 200 * (N / 15);

        _out.println((x - y));
    }
    private static BigInteger C(long n, long r) {
        BigInteger res = BigInteger.ONE;
        for (long i = n; i > n - r; --i) {
            res = res.multiply(BigInteger.valueOf(i));
        }
        for (long i = r; i > 1; --i) {
            res = res.divide(BigInteger.valueOf(i));
        }
        return res;
    }
    private static BigInteger P(long n, long r) {
        BigInteger res = BigInteger.ONE;
        for (long i = n; i > n - r; --i) {
            res = res.multiply(BigInteger.valueOf(i));
        }
        return res;
    }
    /*
     * 10^10 > Integer.MAX_VALUE = 2147483647 > 10^9
     * 10^19 > Long.MAX_VALUE = 9223372036854775807L > 10^18
     */
    public static void main(String[] args) {
        long S = System.currentTimeMillis();

        Scanner sc = new Scanner(System.in);
        new Main().solve(sc);
        _out.flush();

        long G = System.currentTimeMillis();
        if (elapsed) {
            _err.println((G - S) + "ms");
        }
        _err.flush();
    }
}

Measured memory_bytes: 21716
#include <cstdio>
#include <cmath>
#include <cstring>
 
using namespace std;
 

int W, H;
 
char map[16][16];
char g[16][16];
bool v[16][16];
 
int maxIce[128];
int ice[128];
 
int dx[] = {1, 0, -1, 0};
int dy[] = {0, 1, 0, -1};

int ans; 
int px, py;
int sx, sy, gx, gy;
 
bool getMin(int ty, int tx, int turn)
{
     
    if (turn + abs(ty - gy) + abs(tx - gx) >= ans){
        return (false);
    }
     
    if (ty == gy && tx == gx){
        ans = turn;
        return (true);
    }
     
    for (int i = 0; i < 4; i++){
        int mx = tx + dx[i], my = ty + dy[i];
        if (0 <= mx && mx < W && 0 <= my && my < H && px != mx && py != my && v[my][mx]){
            return (false);
        }
    }
     
    for (int i = 0; i < 4; i++){
        int mx = tx + dx[i], my = ty + dy[i];
        px = tx, py = ty;
        if (0 <= mx && mx < W && 0 <= my && my < H && map[my][mx] != '#' && !v[my][mx]){
            if (g[my][mx] == -1){
                v[my][mx] = true;
                if (getMin(my, mx, turn + 1)) return (true);
                v[my][mx] = false;
            }
            else if (maxIce[g[my][mx]] >= ice[g[my][mx]] + 1){
                ice[g[my][mx]]++;
                v[my][mx] = true;
                if (getMin(my, mx, turn + 1)) return (true);
                v[my][mx] = false;
                ice[g[my][mx]]--;
            }
        }
    }
    
    return (false);
}
 
void label(int ty, int tx, int p)
{
    g[ty][tx] = p;
    maxIce[p]++;
     
    for (int i = 0; i < 4; i++){
        int mx = tx + dx[i], my = ty + dy[i];
         
        if (0 <= mx && mx < W && 0 <= my && my < H &&
                    map[my][mx] == 'X' && g[my][mx] == -1){
            label(my, mx, p);
        }
    }
}
 
int main()
{
    int idx;
     
    while (1){
        scanf("%d %d", &W, &H);
         
        if (W + H == 0){
            break;
        }
         
        for (int i = 0; i < H; i++){
            scanf("%s", map[i]);
            for (int j = 0; j < W; j++){
                if (map[i][j] == 'S'){
                    map[i][j] = '.';
                    sx = j, sy = i;
                }
                if (map[i][j] == 'G'){
                    map[i][j] = '.';
                    gx = j, gy = i;
                }
            }
        }
         
        memset(g, -1, sizeof(g));
        memset(maxIce, 0, sizeof(maxIce));
         
        idx = 0;
        for (int i = 0; i < H; i++){
            for (int j = 0; j < W; j++){
                if (map[i][j] == 'X' && g[i][j] == -1){
                    label(i, j, idx);
                    maxIce[idx++] /= 2;
                }
            }
        }
         
        memset(ice, 0, sizeof(ice));
        memset(v, 0, sizeof(v));
        px = py = -1;
        v[sy][sx] = true;
        
        ans = 0;
        while (!getMin(sy, sx, 0)){
        	memset(ice, 0, sizeof(ice));
	        memset(v, 0, sizeof(v));
	        px = py = -1;
	        v[sy][sx] = true;
        	ans++;
        }
        
        printf("%d\n", ans);
    }
     
    return (0);
}

Measured memory_bytes: 1032
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main()
{
    long long t1, t2, a1, a2, b1, b2;
    cin >> t1 >> t2;
    cin >> a1 >> a2;
    cin >> b1 >> b2;

    long long p = (a1 - b1) * t1, q = (a2 - b2) * t2;

    if (p > 0)
    {
        p *= -1;
        q *= -1;
    }

    if (p + q < 0)
    {
        cout << 0 << endl;
        return 0;
    }

    if (p + q == 0)
    {
        cout << "infinity" << endl;
        return 0;
    }

    if (p + q > 0)
    {
        long long s = (-p) / (p + q), t = (-p) % (p + q);
        if (t != 0)
        {
            cout << s * 2 + 1 << endl;
        }
        else
        {
            cout << s * 2 << endl;
        }
        return 0;
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <numeric>

using namespace std;

using ll = long long;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)

#define input(...) __VA_ARGS__; in(__VA_ARGS__)

template<class T>
void print(vector<T> a) {
  cout << "[ ";
  REP(i, a.size()) cout << a[i] << " ";
  cout << "]" << endl;
}

void print() {
  std::cout << std::endl;
}

template <class Head, class... Tail>
void print(Head&& head, Tail&&... tail) {
  std::cout << head << " ";
  print(std::forward<Tail>(tail)...);
}

void in() { }

template <class Head, class... Tail>
void in(Head&& head, Tail&&... tail) {
  cin >> head;
  in(std::forward<Tail>(tail)...);
}

int main() {
  ll input(n);
  vector<ll> a(n), b(n), c(n);
  REP(i, n) cin >> a[i];
  REP(i, n) cin >> b[i];
  REP(i, n) cin >> c[i];
  sort(a.begin(), a.end());
  sort(b.begin(), b.end());
  sort(c.begin(), c.end());

  vector<ll> cumsum(n);
  FOR(i, 0, n - 1) {
    auto c_it_end = upper_bound(c.begin(), c.end(), b[i]);
    cumsum[i] = n - distance(c.begin(), c_it_end);
  }
  partial_sum(cumsum.rbegin(), cumsum.rend(), cumsum.rbegin());
  cumsum.push_back(0);
  
  ll ans = 0;
  FOR(i, 0, n - 1) {
    auto b_it_end = upper_bound(b.begin(), b.end(), a[i]);
    ans += cumsum[distance(b.begin(), b_it_end)];
  }
  cout << ans << endl;
}


Measured memory_bytes: 4096
#include<iostream>
#include<queue>
#include<algorithm>
using namespace std;
const int N=1005;
bool place[N][N];
bool used[N][N];
queue<int> q1;
int main(){
	int h,w,n;
	int i,j,k;
	int a,b,c;
	int p,q;
	char ca[N];
	cin>>h>>w>>n;
	for(i=0;i<h;i++){
		cin>>ca;
		for(j=0;j<w;j++){
			if(ca[j]!='#')place[i][j]=true;
			if(ca[j]=='S')p=i,q=j;
		}
	}
	q1.push(p*N+q);
	a=N;
	for(i=0;i<=n;i++){
		p=q1.size();
		for(j=0;j<p;j++){
			b=q1.front(),q1.pop();
			c=b%N,b/=N;
			if(used[b][c])continue;
			used[b][c]=true;
			if(!place[b][c])continue;
			a=min({a,b,c,h-b-1,w-c-1});
			if(b!=0)q1.push((b-1)*N+c);
			if(b!=h-1)q1.push((b+1)*N+c);
			if(c!=0)q1.push(b*N+c-1);
			if(c!=w-1)q1.push(b*N+c+1);
		}
	}
	if(a==0)a=1;
	else a=(a-1)/n+2;
	cout<<a<<endl;
	return 0;
}
	


Measured memory_bytes: 1792
#include <stdio.h>
#define MAX 2000

int solve(int,int);
int n,A[MAX];

int main() {
  int i,q,Mi[MAX],flag;
  scanf("%d",&n);
  for(i=0;i<n;i++) {
    scanf("%d",&A[i]);
  }
  scanf("%d",&q);
   for(i=0;i<q;i++) {
    scanf("%d",&Mi[i]);
  }
   for(i=0;i<q;i++) {
   flag = solve(0,Mi[i]);
   if(flag == 1) printf("yes\n");
   else printf("no\n");
   }

   return 0;
}

int solve(int i, int m){
  int res;
  if(m == 0) return 1;
  else if(i >= n) return 0;
  res = solve(i + 1,m) || solve(i + 1,m - A[i]);
  return res;
}

Measured memory_bytes: 588
using System;
using System.Collections.Generic;
using System.Linq;

public class AtCoderB
{
    static void Main()
    {
        int n;
        int d;
        {
            var line = Console.ReadLine();
            var words = line.Split(' ');
            n = int.Parse(words[0]);
            d = int.Parse(words[1]);
        }

        Console.WriteLine(n % (2 * d + 1) == 0 ? n / (2 * d + 1) : n / (2 * d + 1) + 1);
    }
}

Measured memory_bytes: 11092
#include<bits/stdc++.h>
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define watch(x); cout<<#x<<"="<<x<<endl;
#define watch2(x,y); cout<<#x<<"="<<x<<" "<<#y<<"="<<y<<endl;
#define endl "\n"
#define int long long
using namespace std;    


int32_t main(){

    fast
    int n;
    cin>>n;
    vector<int>arr(n+1);
    map<int,int>mp;
    int ans=0;
    for(int i=1;i<=n;i++){
        cin>>arr[i];
        ans+=mp[i-arr[i]];
        mp[i+arr[i]]++;
    }
    cout<<ans;


    return 0;
}



Measured memory_bytes: 27420
#include <iostream>
#include <vector>
#include <stdio.h>
#include <algorithm>
int main(int const argc, char const** argv){
  int n;
  std::cin >> n;
  std::vector<int> vec;;
  for(int i = 0; i<n; ++i){
    int j;
    std::cin >> j;
    vec.push_back(j);
  }

  
  for(int i = 0; i<n - 1; ++i){
    std::cout << vec[i] << " ";
  }
  std::cout << vec[n - 1] << "\n";

  for(int i = 1; i<n; ++i){
    int v = vec[i];
    int j = i - 1;
    while(j >= 0 &&  vec[j]>v){
      vec[j + 1] = vec[j];
      j--;
      vec[j + 1] = v;
    }
    for(int i = 0; i<n - 1; ++i){
      std::cout << vec[i] << " ";

    }
    std::cout << vec[n - 1] << "\n";
  

  }

}

Measured memory_bytes: 3088
#include <stdio.h>

int main(){
  int count = 0;
  int ans = 0;
  while (1) {
    char c = getchar();
    if(c == 'p'){
      ans--;
    }else if(c != 'g'){
      break;
    }
    if(count % 2 == 1){
      ans++;
    }
    count++;
  }
  printf("%d\n", ans);
  return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;

int main()
{
    string S;
    cin >> S;

    int K = S.size();
    for (int i = 1; i < S.size(); i++)
    {
        if (S[i - 1] != S[i])
        {
            K = min(K, max(i, (int)S.size() - i));
        }
    }
    cout << K << endl;
}


Measured memory_bytes: 512
s = input()


atgc = ["A", "T", "G", "C"]
cnt = 0
for i in range(len(s)):
    tmp = 0
    for j in range(i, len(s)):
        if s[j] in atgc:
            tmp += 1
        else:
            break
    cnt = max(cnt, tmp)

print(cnt)


Measured memory_bytes: 2940
// eddy1021
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
typedef double D;
typedef long double LD;
typedef long long LL;
typedef pair<int,int> PII;
typedef pair<LL,LL> PLL;
typedef tuple<int,int,int> tiii;
typedef tuple<LL,LL,LL> tlll;
#define mod9 1000000009LL
#define mod7 1000000007LL
#define INF  1023456789LL
#define INF16 10000000000000000LL
#define eps 1e-9
#define SZ(x) (int)(x).size()
#define ALL(x) (x).begin(), (x).end()
#ifndef ONLINE_JUDGE
#define debug(...) printf(__VA_ARGS__)
#else 
#define debug(...)
#endif
inline LL getint(){
  LL _x=0,_tmp=1; char _tc=getchar();    
  while( (_tc<'0'||_tc>'9')&&_tc!='-' ) _tc=getchar();
  if( _tc == '-' ) _tc=getchar() , _tmp = -1;
  while(_tc>='0'&&_tc<='9') _x*=10,_x+=(_tc-'0'),_tc=getchar();
  return _x*_tmp;
}
inline LL add( LL _x , LL _y , LL _mod = mod7 ){
  _x += _y;
  return _x >= _mod ? _x - _mod : _x;
}
inline LL sub( LL _x , LL _y , LL _mod = mod7 ){
  _x -= _y;
  return _x < 0 ? _x + _mod : _x;
}
inline LL mul( LL _x , LL _y , LL _mod = mod7 ){
  _x *= _y;
  return _x >= _mod ? _x % _mod : _x;
}
LL mypow( LL _a , LL _x , LL _mod ){
  if( _x == 0 ) return 1LL;
  LL _ret = mypow( mul( _a , _a , _mod ) , _x >> 1 , _mod );
  if( _x & 1 ) _ret = mul( _ret , _a , _mod );
  return _ret;
}
LL mymul( LL _a , LL _x , LL _mod ){
  if( _x == 0 ) return 0LL;
  LL _ret = mymul( add( _a , _a , _mod ) , _x >> 1 , _mod );
  if( _x & 1 ) _ret = add( _ret , _a , _mod );
  return _ret;
}
inline bool equal( D _x ,  D _y ){
  return _x > _y - eps && _x < _y + eps;
}
#define Bye exit(0)
int __ = 1 , _cs;
/*********default*********/
void build(){

}
LL a[ 7 ];
void init(){
  for( int i = 0 ; i < 7 ; i ++ )
    a[ i ] = getint();
}
LL cal( bool tk ){
  LL tans = 0;
  if( tk && a[ 0 ] && a[ 3 ] && a[ 4 ] ){
    a[ 0 ] --;
    a[ 3 ] --;
    a[ 4 ] --;
    tans += 3;
  }
  tans += a[ 1 ];
  tans += a[ 0 ] / 2 * 2;
  tans += a[ 3 ] / 2 * 2;
  tans += a[ 4 ] / 2 * 2;
  return tans;
}
void solve(){
  LL ans = cal( 0 );
  ans = max( ans , cal( 1 ) );
  cout << ans << endl;
}
int main(){
  build();
  //__ = getint();
  while( __ -- ){
    init();
    solve();
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
string to_string(string s) { return '"' + s + '"'; }
string to_string(const char* s) { return to_string(string(s)); }
string to_string(bool b) { return to_string(int(b)); }
string to_string(char b) { return "'" + string(1, b) + "'"; }
template <typename A, typename B>
string to_string(pair<A, B> p) { return "(" + to_string(p.first) + ", " + to_string(p.second) + ")"; }
template <typename A>
string to_string(A v) {
	string res = "{";
	for (const auto& x : v) res += (res == "{" ? "" : ", ") + to_string(x);
	return res + "}";
}
void debug() { cerr << endl; }
template <typename Head, typename... Tail>
void debug(Head H, Tail... T) {
	cerr << " " << to_string(H);
	debug(T...);
}
#define db(...) cerr << "[" << #__VA_ARGS__ << "]:", debug(__VA_ARGS__)
#else
#define db(...) 42
#endif
typedef long long ll;
typedef long double ld;
char S[1005];
int main() {
	scanf("%s", S);
	int n = strlen(S);
	string s = S;
	if (S[n - 1] == 's') s += "es";
	else s += "s";
	printf("%s\n", s.c_str());
}


Measured memory_bytes: 3656
import java.util.*;
class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int A = sc.nextInt();
    int B = sc.nextInt();
    int C = sc.nextInt();
    if(A+B>= C){
      System.out.println(B+C);
    }else{
      System.out.println(B+A+B+1);
    }
  }
}
      


Measured memory_bytes: 21844
#include "bits/stdc++.h"
using namespace std;

typedef long long ll;

int main() {
	int N; cin >> N;
	string S,T; cin >> S;
	T = S;
	
	while (1) {
		bool flag=false;
		for (int i = 0; i < T.length()-1; i++) {
			if (T[i] == '(' && T[i + 1] == ')') {
				flag=true;
				T.erase(i,2);
				break;
			}
		}
		if(T.empty()) break;
		if(!flag) break;
	}
	string s1="",s2="";
	for (int i = 0; i < T.length(); i++) {
		if(T[i] == ')') s1.push_back('(');
		if(T[i] == '(') s2.push_back(')');
	}
	S.insert(0,s1);
	S.insert(S.length(),s2);

	cout << S << endl;
}


Measured memory_bytes: 256
//------------------------------------//
#include <bits/stdc++.h>
#define cube(x) (x*x*x)
#define sqr(x) (x*x)
#define pi acos(-1)
//-------------------------------------//
typedef unsigned long long ull;
typedef long long int lld;
typedef long double ld;
using namespace std;
//------------------------------------//
int f, i, j, k;

int main()
{
    int c=0;
    ull n;
    cin >>n;
    ull p=100;
    while(1)
    {
        p = p+(p*(1.00/100.00));
        if(p<n)
        {
            c++;
        }
        else
        {
            break;
        }

    }
    cout <<c+1 <<endl;
    return 0;
}


Measured memory_bytes: 3556
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < (int)(n); ++i)
#define REPR(i, n) for (int i = (int)(n - 1); i >= 0; --i)
#define FOR(i, x, n) for (int i = x; i < (int)(n); ++i)
#define ALL(n) begin(n), end(n)
#define ll long long
#define INF 1e9
int main() {
    int a;
    cin >> a;
    cout << a * a * a + a * a + a << endl;
    return 0;
}

Measured memory_bytes: 3624
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include <cstdlib>
#include <ctime>
using namespace std;
typedef long long LL;

int flag,i,n,m,k,j,sum;
int main()
{
	cin>>n>>m>>k;
	flag=0;
	for(i=0;i<=n;i++)
	{
		for(j=0;j<=m;j++)
		{
			sum=i*m+(n-i)*j-i*j;
			if(sum==k)
			{
				flag=1;
				break;
			}
		}
	}
	if(flag==1)
	{
		cout<<"Yes"<<endl;
	}
	else
	{
		cout<<"No"<<endl;
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a) for (int i = (int)0; i < (int)a; ++i)
#define rrep(i, a) for (int i = (int)a - 1; i >= 0; --i)
#define REP(i, a, b) for (int i = (int)a; i < (int)b; ++i)
#define RREP(i, a, b) for (int i = (int)a - 1; i >= b; --i)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
using ll = long long;
constexpr ll mod = 1e9 + 7;
constexpr ll INF = 1LL << 60;

template <class T>
inline bool chmin(T &a, T b)
{
	if (a > b)
	{
		a = b;
		return true;
	}
	return false;
}
template <class T>
inline bool chmax(T &a, T b)
{
	if (a < b)
	{
		a = b;
		return true;
	}
	return false;
}

ll gcd(ll n, ll m)
{
	ll tmp;
	while (m != 0)
	{
		tmp = n % m;
		n = m;
		m = tmp;
	}
	return n;
}

ll lcm(ll n, ll m)
{
	return abs(n) / gcd(n, m) * abs(m); //gl=xy
}

using namespace std;

void solve()
{
	ll n;
	cin>>n;
	ll ans=0;
	for(ll i=1;i<=n;++i){
		for(ll j=i;j<=n;j+=i)ans+=j;
	}
	cout<<ans;
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout << fixed << setprecision(15);
	solve();
	return 0;
}


Measured memory_bytes: 3656
A, B, C, D, E, F = map(int, input().split())
import math

candicate=[]
for weia in range(0,F+1,100*A):
    for weib in range(0,F+1,100*B):
        water=weia + weib
        if 0 <water <= F:
            salm=water//100*E
            for salc in range(0,salm+1,C):
                for sald in range(0,salm+1,D):
                    salt=salc+sald
                    if salt <= salm and water+salt <= F:
                        #print(weia, weib, salc, sald)
                        candicate.append((water, salt))
#print(candicate)
max_pair=max(candicate, key=lambda x:x[1]/sum(x))
#print(max_pair)
print(sum(max_pair), max_pair[1])

Measured memory_bytes: 99860
# -*- coding: utf-8 -*-

import numpy as np

N = int(input())

A = np.array(list(map(int, input().split())))

if 0 in A:
    print(0)
    exit(0)

mul = A[0]

for i in A[1:]:
    if 1000000000000000000 / i < mul:
        print(-1)
        exit(0)
    mul *= i

if mul > 1000000000000000000:
    print(-1)
    exit(0)

print(mul)

Measured memory_bytes: 40044
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<vector>
#include<utility>
#include<cmath>
#include<string>
#include<cstring>
#include<map>
#include<queue>
#include<set>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define prin(arg) std::cout<<arg<<"\n"
#define prin2(arg1,arg2) std::cout<<arg1<<" "<<arg2<<"\n"
#define fill(arg,n) std::memset(arg,n,sizeof(arg))
#define mp std::make_pair
#define pb push_back
using std::cin;
typedef long long ll;
typedef std::pair<int,int> pi;
typedef std::vector<int> vi;
typedef std::set<int> si;
typedef std::string str;
const int INF=1e+9;
const ll INFLL=1e+17;
const ll MOD=1e+9+7;
int N;
ll A,B;
ll X[100010];
int main(){
  cin>>N>>A>>B;
  rep(i,N) cin>>X[i];
  ll d[100010];
  d[0]=0;
  rep1(i,N-1){
    d[i]=d[i-1]+std::min(A*(X[i]-X[i-1]),B);
  }
  prin(d[N-1]);
  return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>

#define rep(i, n) for (ll i=0;i<(n); i++)

using namespace std;
//using ll=long long;
typedef long long ll;


int main(){
  int n, tmp;
  cin >> n;

  //    cout << "a";
  vector<ll> a(n);
  vector<ll> s(n);
  //cout << "a";

  
  rep(i,n) {
    cin >> a.at(i);
  }
  sort(a.begin(), a.end());
  
  s.at(0) = a.at(0);
  
  for(ll i=1;i<n;i++){
    s.at(i) = s.at(i-1) + a.at(i);
  }

  //  rep(i, n)     cout << a.at(i) << " " << s.at(i) << endl;

  
  int ans = 1;
  for (ll i=n-1;i>0; i--) {
    if (a.at(i) <= 2*s.at(i-1) ){
      ans ++;
    }
    else break;
    
  }
  
  std::cout << ans << std::endl;
}


Measured memory_bytes: 1920
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repi(i, s, n) for (int i = (s); i < (n); i++)
#ifdef LOCAL
#define INPUT_FILE                              \
  ifstream in("atcoder-problems/arc079_a.txt"); \
  cin.rdbuf(in.rdbuf());
#define print_vec(v)                        \
  rep(l, v.size()) { cout << v[l] << " "; } \
  cout << endl;
#else
#define INPUT_FILE
#define print_vec(v)
#endif
#define CIN_OPTIMIZE \
  cin.tie(0);        \
  ios::sync_with_stdio(false);
typedef pair<int, int> P;
typedef long long ll;
typedef pair<ll, ll> pl;
const int INF = 100100100;
const ll LINF = 1e18 + 100;
const int MOD = 1e9 + 7;

int main() {
  INPUT_FILE CIN_OPTIMIZE;

  int N, M;
  cin >> N >> M;

  vector<vector<int>> g(N, vector<int>(0));
  rep(i, M) {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    g[a].push_back(b);
    g[b].push_back(a);
  }

  bool ok = false;
  for (auto to : g[0]) {
    if (to == N - 1) {
      cout << "POSSIBLE" << endl;
      return 0;
    }
    for (auto to2 : g[to]) {
      if (to2 == N - 1) {
        cout << "POSSIBLE" << endl;
        return 0;
      }
    }
  }

  cout << "IMPOSSIBLE" << endl;
}

Measured memory_bytes: 14800
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;

#define mt make_tuple
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sqr(x) ((ll)(x) * (x))

const ll mod = 1e9 + 7;

int main()
{
    //freopen("input.txt", "r", stdin);
    int n;
    cin >> n;
    vector <bitset<60>> v(n);
    for(int i = 0; i < n; i++)
    {
        ll broj;
        cin >> broj;
        v[i] = broj;
    }

//    cout << '\n';
//
//    for(int i = 0; i < n; i++)
//    {
//        cout << v[i] << '\n';
//    }

    ll konacniRezultat = 0LL;

    for(int i = 0; i < 60; i++)
    {
        ll brojacNula=0, brojacKeceva=0;
        for(int j = 0; j < n; j++)
        {
            if(v[j][i]==0)
            {
                brojacNula++;
            }

            else
            {
                brojacKeceva++;
            }
        }
        konacniRezultat+=((((brojacNula%mod)*(brojacKeceva%mod))%mod) * ((1LL<<i)%mod))%mod;
    }

    cout << konacniRezultat%mod << '\n';

    return 0;
}


Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;

int main() {
  int N, a, b, c, d;
  cin >> N;
  a = N/1000;
  b = N%1000/100;
  c = N%100/10;
  d = N%10;
  if((a == b && b ==c) || (b == c && c == d)){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
  
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;

int main() {
  int N, Y;
  cin >> N >> Y;
  for (int i = 0; i<=N; i++) {
    for (int j = 0; j<=N-i; j++) {
      if (10000*i + 5000*j + 1000*(N-i-j) == Y) {
        cout << i << " " << j << " " << N-i-j << endl;
        return 0;
      }
    }
  }
  cout << -1 << " " << -1 << " " << -1 << endl;
  return 0;
}


Measured memory_bytes: 888
#include<stdio.h>
int n,A[20000000];
void maxHeapify(int);
int main(){
  int i;
  scanf("%d",&n);
  for(i=1;i<=n;i++){
    scanf("%d",&A[i]);
  }
  for(i=n/2;i>=1;i--){
    maxHeapify(i);
  }
  for(i=1;i<n;i++){
    printf(" %d",A[i]);
  }
  printf(" %d\n",A[i]);
}

void maxHeapify(int i){
  int l,r,largest,temp;
  l=i*2;
  r=i*2+1;
  if(l<=n && A[l]>A[i]){
    largest=l;
  }
  else{
    largest=i;
  }
  if(r<=n && A[r]>A[largest]){
    largest=r;
  }
  if(largest!=i){
    temp=A[i];
    A[i]=A[largest];
    A[largest]=temp;
    maxHeapify(largest);
  }
}



Measured memory_bytes: 3628
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder.Abc
{
    class QuestionE
    {
        public static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

            // 整数の入力
            var n = int.Parse(Console.ReadLine());

            var result = DFS("", n);

            Console.WriteLine(result);

            Console.Out.Flush();
        }

        public static int DFS(string s, long max)
        {
            if(s.Length >= 9) {
                var ss = long.Parse(s);
                s = ss.ToString();
                if(ss <= max && s.Contains('0') == false && s.Contains('3') && s.Contains('5') && s.Contains('7')) {
                    return 1;
                } else {
                    return 0;
                }
            }

            var num = 0;
            num += DFS(s + "0", max);
            num += DFS(s + "3", max);
            num += DFS(s + "5", max);
            num += DFS(s + "7", max);
            return num;
        }
    }
}


Measured memory_bytes: 17336
#include <iostream>
#include <stack>
#include <string>
#include <sstream>
#include <cstdio>
using namespace std;

string strOp = "*+-/";

double calc (double a, double b, string op) {
    if (op == "+") return a + b;
    else if (op == "-") return a - b;
    else if (op == "*") return a * b;
    else return a / b;
}

int main ()
{
    string str;
    while (getline (cin, str)) {
        stringstream ss;
        stack<double> V;
        ss << str;
        while (ss >> str) {
            if (strOp.find(str, 0) != string::npos) {
                double a, b;
                a = V.top(); V.pop();
                b = V.top(); V.pop();
                V.push(calc(b, a, str));
            } else {
                stringstream num;
                num << str;
                double n;
                num >> n;
                V.push(n);
            }
        }
        double ans = V.top();
        printf("%.6f\n", ans);
    }

    return 0;
}

Measured memory_bytes: 1300
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <ctime>
#include <cassert>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>
#include <list>


using namespace std;

#ifdef _MSC_VER
#define __typeof__ decltype
template <class T> int __builtin_popcount(T n) { return n ? 1 + __builtin_popcount(n & (n - 1)) : 0; }
#endif

#define foreach(it, c) for (__typeof__((c).begin()) it=(c).begin(); it != (c).end(); ++it)
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define CLEAR(arr, val) memset(arr, val, sizeof(arr))

#define rep(i, n) for (int i = 0; i < n; ++i)

template <class T> void max_swap(T& a, const T& b) { a = max(a, b); }
template <class T> void min_swap(T& a, const T& b) { a = min(a, b); }

typedef long long ll;
typedef pair<int, int> pint;

const double EPS = 1e-8;
const double PI = acos(-1.0);
const int dx[] = { 0, 1, 0, -1 };
const int dy[] = { 1, 0, -1, 0 };


int main()
{
	int n, m[5][5];
	cin >> n;
	while (n--)
	{
		for (int i = 0; i < 5; ++i)
			for (int j = 0; j < 5; ++j)
				cin >> m[i][j];

		int res = 0;
		for (int y = 0; y < 5; ++y)
		{
			for (int x = 0; x < 5; ++x)
			{
				for (int p = y; p < 5; ++p)
				{
					for (int q = x; q < 5; ++q)
					{
						bool ok = true;
						for (int i = y; i <= p; ++i)
							for (int j = x; j <= q; ++j)
								ok &= m[i][j];
						if (ok)
							max_swap(res, (p - y + 1) * (q - x + 1));
					}
				}
			}
		}
		cout << res << endl;
	}
}

Measured memory_bytes: 0
#![allow(unused_imports)]

use text_io::*;
use proconio::*;
use std::collections::*;
use std::process::exit;
use std::cmp::*;
use itertools::Itertools;
use num::*;


fn main() {
    input! {
    a:usize,
    b:usize,
    c:[usize;a],
  }
    let mut d=0;
    for i in 0..a-1 {
        d+=min(b,c[i+1]-c[i])
    }
    println!("{}",d+b)
}

Measured memory_bytes: 5444
/*|In The Name Of Allah|*/
//This Month Will Be Expert ISA
#include <bits/stdc++.h>

using namespace std;

const int N = 1e4+7;

const int mod = 1e9+7;

int n;
int t;
int mem[N][N];
pair < int , int > dish[N];

int go(int idx , int T){
    if(idx == n+1)
        return 0;
    if(~mem[idx][T])
        return mem[idx][T];
    int best = go(idx + 1 , T);
    if(T <= t)
        best = max(best , go(idx + 1 , T + dish[idx].first) + dish[idx].second);
    return mem[idx][T] = best;
}

int main(){
    scanf("%d%d" , &n , &t);
    t--;
    for(int i = 1; i <= n; i++){
        scanf("%d%d" , &dish[i].first , &dish[i].second);
    }
    sort(dish + 1 , dish + n + 1);
    memset(mem , -1 , sizeof mem);
    printf("%d\n" , go(1 , 0));
}

Measured memory_bytes: 391680
#include <bits/stdc++.h>
using namespace std;
int main()
{
	string s;
	cin>>s;
	int len=s.size(),ans=len;
	for(int i=0;i<len-1;i++)
	{
		if(s[i]!=s[i+1])
			ans=min(ans,max(i+1,len-i-1));
	}
	cout<<ans<<"\n";
	return 0;
}


Measured memory_bytes: 512
S = gets.chomp

L = S.length
#sum = []
#count = 2 ** (l-1)
#
#(1...l).each do |i|
#  (0...i) do |start|
#    S[]
#  end
#end
#sum << S[x,l]
#
## + の挿入位置のパターンを2進数で表す
positions = (0...(2**(L-1))).map{|i| i.to_s(2)}
sum = []

positions.each do |p|
  p = sprintf("%0#{L-1}d", p.to_i)
  start = 0
  length = 1
  p.chars.each_with_index do |f, index|
    if f == '1'
      sum << S[start, length].to_i
      start += length
      length = 1
    else
      length += 1
    end
  end
  sum << S[start, length].to_i
end

puts sum.reduce(:+)



Measured memory_bytes: 1788
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) {
        InputStreamReader ist = new InputStreamReader(System.in);
        BufferedReader br = new BufferedReader(ist);

        String str = null;

        try{
            str = br.readLine();
            br.close();
        }catch(IOException e){
            e.printStackTrace();
        }

        String number[] = str.split(" ",0);

        int num[] = new int[2];
        int sum = 0;

        for(int i = 0;i < 2;i++){
            num[i] = Integer.parseInt(number[i]);
        }

        if(num[0] < num[1]){
          System.out.println("a < b");
        }else if(num[0] > num[1]){
          System.out.println("a > b");
        }else{
          System.out.println("a == b");
        }

    }
}



Measured memory_bytes: 24236
#include<iostream>
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep2(i,n) for(int i=2;i<=(n);i++)
using namespace std;
const int mod=1000000007;
int main()
{
int N;
cin >> N;
long ans=1;
int array[N];
rep(i,N)
{
	array[i]=i+1;
}

if(N!=1)
{
rep2(i,N)
{
	int num=0;
   rep(j,N)
	{
	   while(array[j]%i==0)
	   {
		   array[j]=array[j]/i ;
		   num++;
	   }
	}
    ans=ans*(num+1)%mod;
}
}
 cout << ans <<endl;
 return 0;
 
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(c)  c.begin(),c.end()
#define traverse(c,it,K) for(auto it = c.begin(); it != (c.begin()+K); it++)
ll minimum(ll a, ll b, ll c)
{
    return ((a<b)? ((a<c) ? a : c):((b<c) ? b : c));
}
bool comparator(ll a, ll b)
{
    return a > b;
}
int main()
{
    //freopen("in.txt","r",stdin);
    int x,y,z,K;
    cin >> x >> y >> z >> K;
    vector< vector< ll > > delicacies(3);
    for(int i=0;i<x;i++){
        ll j;
        cin >> j;
        delicacies[0].push_back(j);
    }
    delicacies[0].push_back(0);
    for(int i=0;i<y;i++){
        ll j;
        cin >> j;
        delicacies[1].push_back(j);
    }
    delicacies[1].push_back(0);
    for(int i=0;i<z;i++){
        ll j;
        cin >> j;
        delicacies[2].push_back(j);
    }
    delicacies[2].push_back(0);
    for(int i=0;i<3;i++){
        sort(all(delicacies[i]),comparator);
    }
    int i = 1,j=1,k=1;
    vector< ll > sum;
    for(int i=1;i<=K && i<=x;i++){
        for(int j=1;j<=K/i && j<=y;j++){
            for(int k=1;k<=K/(j*i) && k<=z;k++){
                ll ans = delicacies[0][i-1]+delicacies[1][j-1]+delicacies[2][k-1];
                //cout << ans << endl;
                sum.push_back(ans);
            }
        }
    }
    sort(all(sum),comparator);
    for(int i=0;i<K;i++){
        cout << sum[i] << endl;
    }
}

Measured memory_bytes: 1412
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int mymin(int x,int y) {return x<y?x:y;}
int mymax(int x,int y) {return x>y?x:y;}

char a[110][11],b[110][11];

int cnt=0;
char s[210][11],s1[11];
int ct[210];
bool same(int x)
{
	int lx=strlen(s[x]+1),ly=strlen(s1+1);
	if(lx!=ly) return 0;
	for(int i=1;i<=lx;i++)
		if(s[x][i]!=s1[i])
			return 0;
	return 1;
}
void trya(int x)
{
	memcpy(s1,a[x],sizeof(s1));
	for(int i=1;i<=cnt;i++)
	{
		if(same(i))
		{
			ct[i]++;
			return;
		}
	}
	cnt++;ct[cnt]=1;
	memcpy(s[cnt],s1,sizeof(s1));
}
void tryb(int x)
{
	memcpy(s1,b[x],sizeof(s1));
	for(int i=1;i<=cnt;i++)
	{
		if(same(i))
		{
			ct[i]--;
			return;
		}
	}
}
int main()
{
	int n,m;
	scanf("%d",&n);for(int i=1;i<=n;i++) scanf("%s",a[i]+1),trya(i);
	scanf("%d",&m);for(int i=1;i<=m;i++) scanf("%s",b[i]+1),tryb(i);
	
	int ans=0;
	for(int i=1;i<=cnt;i++) ans=mymax(ans,ct[i]);
	printf("%d",ans);
}

Measured memory_bytes: 128
#include <bits/stdc++.h>

#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define size_t unsigned long long
#define ll long long
#define rep(i,a) for(int i=0;i<(a);i++)
#define repr(i,a) for(int i=(int)(a)-1;i>=0;i--)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define FORR(i,a,b) for(int i=(int)(b)-1;i>=a;i--)
#define ALL(a) a.begin(), a.end()
using namespace std;
int si() { int x; scanf("%d", &x); return x; }
long long sl() { long long x; scanf("%lld", &x); return x; }
string ss() { string x; cin >> x; return x; }
void pi(int x) { printf("%d ", x); }
void pl(long long x) { printf("%lld ", x); }
void pd(double x) { printf("%.15f ", x); }
void ps(const string &s) { printf("%s ", s.c_str()); }
void br() { putchar('\n'); }

const ll MOD = 1e9 + 7;
const ll INF = 1e9 + 5;

struct mint {
    int n;
    mint(int n_ = 0) : n(n_) {}
};

mint operator+(mint a, mint b) { a.n += b.n; if (a.n >= MOD) a.n -= MOD; return a; }
mint operator-(mint a, mint b) { a.n -= b.n; if (a.n < 0) a.n += MOD; return a; }
mint operator*(mint a, mint b) { return (long long)a.n * b.n % MOD; }
mint &operator+=(mint &a, mint b) { return a = a + b; }
mint &operator-=(mint &a, mint b) { return a = a - b; }
mint &operator*=(mint &a, mint b) { return a = a * b; }

typedef pair<int, int> P;

const ll N = 1e5+5;
int n,m,num;
int flag[N],p[N];

int solve() {
  rep(i,n) {
    if(i == p[i]) {
      if(i == 0 || (i+1 != m && i+1 == p[i+1])) {
        num++;
        swap(p[i],p[i+1]);
      } else {
        num++;
        swap(p[i], p[i-1]);
      }
    } 
  }
  return num;
}

int main () {
  ios::sync_with_stdio(false);cin.tie(nullptr);
  cin >> n;
  rep(i,n) {
    cin >> p[i];
    p[i]--;
  }
  cout << solve() << endl;
}


Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <queue>
#include <stack>
#include <tuple>
#include <cmath>
#include <iomanip>
#include <map>
#include <cstring> //memset(dp,0,sizeof(dp))
#include <functional>
#include <cctype>
#include <locale>
#define ll long long
#define rep(i,n) for(int i=0;i<(n);i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define fi first
#define se second
#define pb push_back
#define ALL(a) (a).begin(),(a).end()
using namespace std;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
typedef pair<int,int> P;
typedef pair<long long,long long> Pll;
#define fout(num) cout << fixed << setprecision(20) << (num) << endl
//s[i]=tolower(s[i]); islower(s[i]); cout << tolower(s[i])はバグ
//vector<vector<ll>> dp(n,vector<ll>(n))
//exist x map o setconst ll MOD = 1e9+7;return fac[n]*(finv[k]*finv[n-k] % MOD) % MOD;

const ll INF = 1e18;
signed main(){
    ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    int n; cin >> n;
    vector<ll>ans(n+1,INF);
    vector<pair<P,ll>> v(n);
    rep(i,n) cin >> v[i].fi.fi >> v[i].fi.se >> v[i].se;
    int loop=pow(3,n);
    ll lenx[n][1<<n],leny[n][1<<n];
    rep(i,n){
        rep(j,1<<n){
            lenx[i][j]=abs(v[i].fi.fi);
            leny[i][j]=abs(v[i].fi.se);
        }
    }
    rep(i,1<<n){
        int tmp=i;
        rep(j,n){
            if(tmp%2==1){
                rep(k,n){
                    //put j
                    chmin(lenx[k][i],abs(v[k].fi.fi-v[j].fi.fi));
                    chmin(leny[k][i],abs(v[k].fi.se-v[j].fi.se));
                }
            }
            tmp/=2;
        }
    }
    rep(mask,loop){
        int tmp=mask;
        int cnt=0;
        ll x=0,y=0;
        rep(i,n){
            if(tmp%3==0){//ver
                x+=(1<<i);
                cnt++;
            }else if(tmp%3==1){//hor
                y+=(1<<i);
                cnt++;
            }
            tmp/=3;
        }
        if(cnt>n)continue;
        ll res=0;
        rep(i,n) res+=min(lenx[i][x],leny[i][y])*v[i].se;
        chmin(ans[cnt],res);
    }
    rep(i,n){
        chmin(ans[i+1],ans[i]);
    }
    rep(i,n+1){
        cout<<ans[i]<<endl;
    }
}



Measured memory_bytes: 11640
import java.util.*; 
import java.io.*;

class Main {

  public static String StringPeriods(String str) {
    boolean flag = false;
    String ans = "";
    for(int i=0;i<str.length();i++){
      String temp = str;
      String substr = str.substring(0,i);
      temp = temp.replaceAll(substr, "");
      if(temp.equals("")) {
    	  flag = true;
    	  ans = substr;
    	  break;
      }
    }
    if(flag) {
    	str = ans;
    }else {
    	str = "-1";
    }
    // code goes here  
    return str;
  }

  public static void main (String[] args) {  
    // keep this function call here     
    Scanner sc = new Scanner(System.in);
    String S= sc.next();
    S=S.replaceAll("hi", "");
    if(S.equals("")) {
    	System.out.println("Yes");
    }else {
    	System.out.println("No");
    }
   
  }

}


Measured memory_bytes: 23764