akhauriyash/Code-Regression huggingface dataset:
/*
    ____        __
   / __ \____  / /_  ____ _____ ___
  / /_/ / __ \/ __ \/ __ `/ __ `__ \
 / _, _/ /_/ / / / / /_/ / / / / / /
/_/ |_|\____/_/ /_/\__,_/_/ /_/ /_/
*/
#include<bits/stdc++.h>

typedef long long ll ;

#define X   first
#define Y   second
#define mp  make_pair
#define pii pair<int , int>
#define vec vector
#define vpii vector<pair<int , int>>
#define i_n   int i = 0 ; i< n ; i++
#define cn  int n ; cin>>n
#define file_io freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
#define migmig ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define cina int a[n] ; for(int i = 0 ; i < n ; i++) cin>>a[i]
#define pb push_back
#define SZ(x) ll(x.size())

using namespace std;
const int maxn = 1000*100+5 ;

int main()
{
	migmig ;
string s ;
 cin>>s ; 
 int ans1 = 0 , ans2 = 0 ; 
 for(int i = 0 ; i < s.size() ; i ++)
 {
 	if(i%2 == 0 && s[i] == '0') ans1 ++ ;
	if(i % 2 == 1 && s[i] == '1') ans1++ ; 
	if(i % 2  == 0 && s[i] == '1') ans2 ++  ; 
	if( i  % 2 == 1 && s[i] == '0') ans2++ ;  
 }
 cout<<min(ans1 , ans2) ; 
}
//////
////////
///////////



Measured memory_bytes: 512
n, q = map(int, input().split())
s = input()
ans_list = [0]*n
for i in range(n-1):
    if s[i] == "A" and s[i+1] == "C":
        ans_list[i+1] = ans_list[i] + 1
    else:
        ans_list[i+1] = ans_list[i]
for _ in range(q):
    a, b = map(int, input().split())
    print(ans_list[b-1]-ans_list[a-1])

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

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep3(i,m,n) for(int (i)=m;(i)<=(n);(i)++)
#define rep3rev(i,m,n) for(int (i)=m;(i)>=(n);(i)--)
#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define eb emplace_back

using ll = long long;
using vll = vector<ll>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using pii = pair<int, int>;

const int INF = 1001001001;

void Main() {
	int h, w, K;
	cin >> h >> w >> K;
	vector<string> s(h);
	rep(i, h) cin >> s[i];

  	// 行方向について bit 全探索 2^(h-1) とおり
	int ans = INF;
	rep(bit, 1<<(h-1)){
		int anstemp = 0;
		rep(i, h-1){
			if(bit & (1<<i)){
				anstemp++;
			}
		}
		vi temp(10, 0);
		rep(j, w){
			// j = 0 列目からスタート
			int k = 0;
			int sum = 0;
			int flag = 0;
			rep(i, h){
				sum += s[i][j]-'0';
				if(bit & (1<<i) || i == h-1){ // bit の i 番目が 1 
					temp[k] += sum;
					if(temp[k] > K){
					    if(temp[k] == sum) flag = 2;    // impossible
						else flag = 1;  // overadded
						break;
					}
					k++;
					sum = 0;
				}
			}
			if(flag == 2){
			    anstemp = INF;
			    break;
			}
			else if(flag == 1){
				j--;
				anstemp++;
				temp = vi(10, 0);
			}
		}
		ans = min(ans, anstemp);
	}	
	cout << ans << endl; 
    return;
}

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

Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
    public static boolean isEquilateralTriangle(int a, int b, int c){
	boolean isEqTri = true;

	if(a != b || b != c)
	    isEqTri = false;

	return isEqTri;
    }
	
    public static void main(String[] args){
	Scanner stdin = new Scanner(System.in);

	int side_A = stdin.nextInt();
	int side_B = stdin.nextInt();
	int side_C = stdin.nextInt();

	if(isEquilateralTriangle(side_A, side_B, side_C)){
	    System.out.println("Yes");
	}else{
	    System.out.println("No");
	}
    }
}	


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

typedef struct{
  int time;
  char name[11];
}Element;

int main(void){
  int n,q,head = 0,tail,outcount = 0;
  long count = 0;
  Element queue[100001];
  cin >> n >> q;
  tail = n - 1;
  for(int i = 0; i < n; i++)cin >> queue[i].name >> queue[i].time;

  while(outcount != n){
    if(queue[head].time <= q){
      count += queue[head].time;
      cout << queue[head].name << ' ' << count << endl;
      outcount++;
    }
    else{
      count += q;
      queue[head].time -= q;
      if(tail != n - 1)queue[tail + 1] = queue[head];
      else queue[0] = queue[head];
      tail++;
    }
    head++;
    if(head == n)head -= n;
    if(tail == n)tail -= n;
  }
  return 0;
}


Measured memory_bytes: 3784
n = int(input())
s = list(input())
 
for i in range(len(s)):
    s[i] = ord(s[i])+n
    if s[i] > 90:
        s[i] = chr(s[i]-26)
    else:
        s[i] = chr(s[i])
 
print("".join(s))

Measured memory_bytes: 3060
n, m, k = [int(i) for i in input().split()]
grid = [0]

# O(nm)

for i in range(n + 1):
    for j in range(m + 1):
        black = (i * m) + (n - 2 * i) * j
        if black == k:
            print("Yes")
            quit()
print("No")


Measured memory_bytes: 64568
#include <bits/stdc++.h>
#define ll long long

using namespace std;

const int maxn = 200100;
const ll base = 998244353;

int n;
ll f[maxn][4][4];

int main() {
     //freopen("in.txt","r",stdin);
      ios_base::sync_with_stdio(0); cin.tie(0);
      string t;
      cin>>t;
      n = t.size();
      if (n==1) {
          cout<<1<<endl;
          return 0;
      }
      if (n==3) {
          int tt=0;
          for (int i=0;i<n;i++) tt |= 1<<(t[i]-'a');
//cout<<"fuck "<<tt<<endl;
          if (tt==7) {
              cout<<3<<endl;
              return 0;
          }
      }
      bool ok=true;
      for (int i=0;i<n-1;i++) ok &= (t[i]==t[i+1]);
      if (ok) {
          cout<<1<<endl;
          return 0;
      }
      for (int i=0;i<3;i++) f[1][i][i] = 1ll;
      for (int i=1;i<n;i++)
        for (int s=0;s<3;s++)
          for (int x=0;x<3;x++)
            for (int y=0;y<3;y++){
                if (x==y) continue;
                int s1 = (s+y)%3;
                f[i+1][y][s1] = (f[i+1][y][s1] + f[i][x][s])%base;
            }
      ll res=1;
      for (int i=1;i<n;i++) res= (res*3)%base;
      int s=0;
      for (int i=0;i<n;i++) s = (s + (t[i]-'a'))%3;
      for (int i=0;i<3;i++) {
          res = (res - f[n][i][s] + base) % base;
      }
      ok=true;
      for (int i=0;i<n-1;i++) ok &= (t[i]!=t[i+1]);
      if (ok) res = (res+1)%base;
      cout<<res<<endl;
}



Measured memory_bytes: 25620
s = int(input())

l = [s]
i = 0
while(True):

    if s%2 == 0:
        if s//2 in l:
            res = i
            break
        l.append(s // 2)
        
        s = s // 2
        
    else:
        if 3*s+1 in l:
            res = i
            break
        l.append(3*s+1)
        s = 3*s + 1
    i += 1   
print(res+2)

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

using namespace std;

const int roll[10][10] = {
	{3, 2, 6, 1, 5, 4}, //w
	{4, 2, 1, 6, 5, 3}, //E
	{2, 6, 3, 4, 1, 5}, //N
	{5, 1, 3, 4, 6, 2}  //S 	
			 	};
int main()
{
	int dice[10], newdice[10], key[200];
	string cmd;
	key['W'] = 0, key['E'] = 1, key['N'] = 2, key['S'] = 3;
	
	for(int i = 0; i < 6; i++)
	{
		cin >> dice[i];
	} 
	cin >> cmd;
	
	for(int i = 0; i < cmd.size(); i++)
	{
		for(int j = 0; j < 6; j++)
		{
			newdice[j] = dice[roll[key[cmd[i]]][j]-1];
		}
		for(int j = 0; j < 6; j++)
		{
			dice[j] = newdice[j];
		}
	}
	cout << dice[0] << endl;
	return 0;
} 


Measured memory_bytes: 3208
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rep2(i,n) for (int i = 1; i < (n); ++i)
using namespace std;
typedef long long ll;
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int R;
    cin >> R;
    if(R<1200) cout << "ABC" << endl;
    else if(R<2800) cout << "ARC" << endl;
    else cout << "AGC" << endl;
    return 0;
}


Measured memory_bytes: 256
// C - Average Length
// https://atcoder.jp/contests/abc145/tasks/abc145_c
#include <bits/stdc++.h>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string> 
#include <vector>
#include <numeric>
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef pair<ll, int> PLI;
typedef pair<int, int> PII;
const ll mxsize = 3e5 + 5;
const ll linf = 1e9;
const long double inf = 10000000000.0;
#define fastIO                                                                 \
  ios_base::sync_with_stdio(false);                                            \
  cin.tie(NULL);                                                               \
  cout.tie(NULL);
const ll mod = 1e9 + 7;

/******************************************** CODE STARTS FROM HERE *************************************************/ 


double dis(pair < int , int >& x1 , pair < int , int >& x2)
{
  return sqrt((x1.first - x2.first) * (x1.first - x2.first) + 
  ((x1.second - x2.second) * ((x1.second - x2.second))));
}

int main()
{
  int N;
  cin >> N;
  vector < pair < int , int > > points;
  for(int i = 0 ; i < N ; i++)
  {
    int x , y;
    cin >> x >> y;
    points.push_back({x , y});
  }
  string check;
  for(char c = 0 ; c < N ; c++)
  {
    check += to_string(c);
  }
  double ans = 0.0;
  for(int i = 1 ; i < N ; i++)
  {
    ans += dis(points[check[i] - '0'] , points[check[i - 1] - '0']);
  }
  int cnt = 1;
  while(next_permutation(check.begin() , check.end()))
  {
    for(int i = 1 ; i < N ; i++)
    {
      ans += dis(points[check[i] - '0'] , points[check[i - 1] - '0']);
    }
    cnt++;
  }
  cout << setprecision(10) << (ans / (1.0 * cnt)) << endl; 
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
const int inf=0x3f3f3f3f;
int read()
{
	int r=0,f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9')r=(r<<1)+(r<<3)+ch-'0',ch=getchar();
	return r*f;
}
bool np[10000100];
int pri[5000500],tot;
void Euler()
{
	np[1]=1;int ma=1e7;
	for(int i=2;i<=ma;++i)
	{
		if(!np[i])pri[++tot]=i;
		for(int j=1;j<=tot&&i*pri[j]<=ma;++j)
		{
			np[i*pri[j]]=1;
			if(i%pri[j]==0)break;
		}
	}
}
int n;
bool po[10000100];
int pos[550];
struct data{
	int to,nxt,c;
}mp[200200];
int head[550],cnt=1;
int s,t;
int cur[550];
void link(int x,int y,int c)
{
	mp[++cnt].to=y;
	mp[cnt].nxt=head[x];
	mp[cnt].c=c;
	head[x]=cnt;
}
void add(int x,int y,int c){link(x,y,c);link(y,x,0);}
int dis[550];
queue<int>q;
bool bfs()
{
	for(int i=1;i<=t;++i)dis[i]=0;
	dis[s]=1;q.push(s);
	int u;
	while(!q.empty())
	{
		u=q.front();q.pop();
		for(int i=head[u];i;i=mp[i].nxt)
			if(!dis[mp[i].to]&&mp[i].c)
				dis[mp[i].to]=dis[u]+1,q.push(mp[i].to);
	}
	return dis[t];
}
int dfs(int x,int f)
{
	if(x==t)return f;
	int fl,rf=0;
	for(int& i=cur[x];i;i=mp[i].nxt)
		if(dis[mp[i].to]==dis[x]+1&&mp[i].c)
		{
			fl=dfs(mp[i].to,min(f,mp[i].c));
			if(fl)
			{
				f-=fl;rf+=fl;
				mp[i].c-=fl;
				mp[i^1].c+=fl;
				if(!f)break;
			}
		}
	return rf;
}
int Dinic()
{
	int maxflow=0,flow;
	while(bfs())
	{
		for(int i=1;i<=t;++i)cur[i]=head[i];
		while(flow=dfs(s,inf))maxflow+=flow;
	}
	return maxflow;
}
int main()
{
	Euler();
	scanf("%d",&n);
	for(int i=1;i<=n;++i)po[read()]=1;
	n=0;
	for(int i=1;i<=1e7+1;++i)
		if(po[i]!=po[i-1]) pos[++n]=i;
	s=n+1,t=n+2;
	int odd=0,even=0;
	for(int i=1;i<=n;++i)
		if(pos[i]&1)
		{
			add(s,i,1);
			odd++;
			for(int j=1;j<=n;++j)
				if((!(pos[j]&1))&&(!np[abs(pos[i]-pos[j])]))
					add(i,j,1);
		}
	for(int i=1;i<=n;++i)
		if(!(pos[i]&1))add(i,t,1),even++;
	int ans=Dinic();
	even-=ans;odd-=ans;
	if((even&1)||(odd&1))ans+=3;
	even-=even&1;odd-=odd&1;
	ans+=even+odd;
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 25472
#include <iostream>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <new>

using namespace std;

typedef long long ll;

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

const ll inf = 1e18+7;
const ll mod = 1e9+7;

int main(){
	string S,T;
	ll ans = 0;
	cin >> S >> T;
	for(ll i=0;i<3;i++){
		if(S[i]==T[i]){
			ans++;
		}
	}
	cout << ans << endl;
	return 0;

}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
  int i,j,n,l,b,c,k;
  int x[100][100];
  scanf("%d",&n);
  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      x[i][j]=0;
    }
  }
  for(i=0;i<n;i++){
    scanf("%d",&c);
    scanf("%d",&l);
    for(j=0;j<l;j++){
      scanf("%d",&b);
      x[c-1][b-1]=1;
    }
  }
  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      printf("%d",x[i][j]);
      if(j!=n-1)printf(" ");
    }
    printf("\n");
  }

  return 0;
}



Measured memory_bytes: 2052
#include <bits/stdc++.h>
using namespace std;
void printString(long long int n) 
{ 
    string s; 
    while (n > 0) { 
        int rem = n % 26; 
        if (rem == 0) { 
            s.push_back('z'); 
            n = (n / 26) - 1; 
        }
        else
        {
            s.push_back((rem-1)+'a'); 
            n = n / 26; 
        }
    }
    reverse(s.begin(), s.end()); 
    cout << s << endl; 
    return; 
} 
int main() {
	long long int n;
	cin>>n;
	printString(n);
    return 0;
}


Measured memory_bytes: 3640
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
#define repp(i, m, n) for(int i = m; i < n; i++)
#define reps(i, n) for(int i = 1; i <= n; i++)
const int    INF = 100000000;
const double EPS = 1e-10;
const int    MOD = 1000000007;
using namespace std;
typedef long long ll;
typedef pair<int, int> pai;
typedef pair<ll,ll> pal;
int main()
{
	int n;
	cin >> n;
	string s;
	int b[30];
	rep(i, 30) b[i]=60;
	rep(i, n)
	{
		cin >> s;
		int a[30]={};
		int k=s.size();
		rep(j, k) a[((int)s[j]-(int)'a')]++;
		rep(j, 30) b[j]=min(b[j], a[j]);
	}
	rep(l, 30) rep(m, b[l]) cout << (char)(l+(int)'a');
	cout << endl;
	return 0;
}


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

#define PI 3.14159265359
#define rep(i,a,n) for(int i=a;i<(int)n;++i)
#define SZ(x) ((int)(x).size())	//size() unsigned -> int
#define descSort(a) sort(a.begin(),a.end(),std::greater<int>())
using namespace std;
typedef long long ll;
const ll INF = 1e9 + 7;

int main(void){
    int n;
    cin>>n;
    vector<ll> a(n);
    rep(i,0,n)cin>>a[i];
    sort(a.begin(),a.end());

    ll ans=0;
    rep(i,0,n-1){
        int k=n-(i+1)/2;
        ans+=a[k-1];
    }
    cout<<ans<<endl;
    return 0;
}



Measured memory_bytes: 4860
#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = SR()
    return l
mod = 1000000007

#A
def A():
    n = I()
    if n < 1000:
        print("ABC")
    else:
        print("ABD")
    return

#B
def B():
    a,b = LI()
    n = b-a
    c = (n*(n+1))//2
    print(c-b)
    return

#C
def C():
    n = I()
    ans = float("inf")
    for i in range(n+1):
        m = 0
        k = i
        while k > 0:
            m += k%6
            k //= 6
        k = n-i
        while k > 0:
            m += k%9
            k //= 9
        ans = min(ans,m)
    print(ans)
#D
def D():
    n,C = LI()
    f = LIR(C)
    c = LIR(n)
    d = [defaultdict(int) for i in range(3)]
    for i in range(n):
        for j in range(n):
            d[(i+j+2)%3][c[i][j]-1] += 1
    ans = float("inf")
    for i in range(C):
        for j in range(C):
            if i != j:
                for k in range(C):
                    if k != i and k != j:
                        m = 0
                        for a in d[0].keys():
                            m += d[0][a]*f[a][i]
                        for a in d[1].keys():
                            m += d[1][a]*f[a][j]
                        for a in d[2].keys():
                            m += d[2][a]*f[a][k]
                        ans = min(ans,m)
    print(ans)


#E
def E():
    return

#F
def F():
    return

#G
def G():
    return

#H
def H():
    return

#Solve
if __name__ == "__main__":
    B()


Measured memory_bytes: 38640
while True:
    tmp=""
    a,b=map(int,input().split())
    if a==0 and b ==0:
        break

    for i in range(0,a):
        tmp=""
        count=0
        if i%2==0:
            for j in range(0,b):
                if count%2==0:
                    tmp+="#"
                if count%2==1:
                    tmp+="."
                count+=1
        if i%2!=0:
            for j in range(0,b):
                
                if count%2==0:
                    tmp+="."
                if count%2==1:
                    tmp+="#"
                count+=1

        print(tmp)
    
    print("")



Measured memory_bytes: 5612
import sys
sys.setrecursionlimit(10 ** 9)
N = int(input())
S = [list(map(int, input())) for i in range(N)]
G = [[float('inf')] * N for i in range(N)]

for i in range(N):
    for j in range(N):
        if S[i][j]:
            G[i][j] = 1


colors = [None] * N
stack = [(0, 1)]
while stack:
    n, color = stack.pop()
    colors[n] = color
    for i, cost in enumerate(G[n]):
        if cost == float('inf'):
            continue

        if colors[i] == colors[n]:
            print(-1)
            exit()
        else:
            if colors[i] is None:
                stack.append((i, color ^ 1))

for i in range(N):
    G[i][i] = float('inf')

for k in range(N):
    for i in range(N):
        for j in range(N):
            G[i][j] = min(G[i][j], G[i][k] + G[k][j])

for i in range(N):
    G[i][i] = 0

ans = max([max(g) for g in G])
print(ans + 1)


Measured memory_bytes: 70108
n, a, b = input().split()
n = int(n)
b_ball = int(a)
r_ball = int(b)

if b_ball == 0:
  print(0)
else:
  cycle = int(n / (b_ball + r_ball))
  amari = int(n % (b_ball + r_ball))
  if amari > b_ball:
    amari = b_ball
  
  sum_ball = cycle * b_ball + amari
  print(sum_ball)

Measured memory_bytes: 3064
#include<stdio.h>
#define N 100
#define WHITE 0
#define GRAY 1
#define BLACK 2
int n,M[N][N];
int color[N],d[N],f[N],tt;
void dfs_visit(int u){
  int v;
  color[u]=GRAY;
  d[u]=++tt;
  for(v=0;v<n;v++){
    if(M[u][v]==0) continue;
    if(color[v]==WHITE){
      dfs_visit(v);
    }
  }
  color[u]=BLACK;
  f[u]=++tt;
}
void dfs(){
  int u;
  for(u=0;u<n;u++) color[u]=WHITE;
  tt=0;
  for(u=0;u<n;u++){
    if(color[u]==WHITE) dfs_visit(u);
  }
  for(u=0;u<n;u++){
    printf("%d %d %d\n",u+1,d[u],f[u]);
  }
}
int main(){
  int u,v,k,i,j;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    for(j=0;j<n;j++) M[i][j]=0;
  }
  for(i=0;i<n;i++){
    scanf("%d%d",&u,&k);
    u--;
    for(j=0;j<k;j++){
      scanf("%d",&v);
    v--;
    M[u][v]=1;
    }
  }
  dfs();
  return 0;
}

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

using namespace std;

using ll = long long;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a, b, c;
    cin >> a >> b >> c;
    cout << (a + b >= c ? "Yes" : "No") << endl;
    return 0;
}

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

#define debug(x) cerr<<#x<<'='<<x<<'\n'
int n, m;
int a[233], tot=0;
int main(void) {
//	cout<<"Yes";
	cin>>n>>m;
	while (tot<n*m) {
		char c=getchar();
		if (c!='\n' && c!='\r') {
			a[c]++;
			tot++;
		}
	}
	int sum_j=0;
	for (int i='a'; i<='z'; i++) {
		if (a[i]%2==1) {
			sum_j++;
			if (sum_j>1) {
				cout<<"No";
				return 0;
			}
		}
	}
	if (sum_j==1 && (n%2==0 || m%2==0)) {
	//	debug(sum_j);
	//	debug(n%2);
	//	debug(m%2);
		cout<<"No";
		return 0;
	}
	int cnt=0;
	for (int i='a'; i<='z'; i++) {
		if ((a[i]>>1)&1) {
			cnt++;
		}
	}
//	debug(cnt);
	if (n%2==0 && m%2==0) {
		if (cnt==0) {
			cout<<"Yes";
		} else {
			cout<<"No";
		}
		return 0;
	}
	if (n%2==0 && m%2!=0) {
		swap(n, m);
	}
	if (n%2!=0 && m%2==0) {
		if (cnt<=m/2) {
			cout<<"Yes";
		} else {
			cout<<"No";
		}
		return 0;
	}
	if (n%2!=0 && m%2!=0) {
		if (cnt<=n/2+m/2) {
			cout<<"Yes";
		} else {
			cout<<"No";
		}
		return 0;
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define until(x) while(!(x))
#define unless(x) if(!(x))
#define all(x) (x).begin(),(x).end()
#define F first
#define S second
#define pc __builtin_popcount


int32_t main(){
	string s;
	cin>>s;
	for(int i = 0;i<s.length();i++){
		cout<<"x";
	}
}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#define MAX_N 100000

int N, A[MAX_N+2];
long max_price, price;

int main () {
  int i;
  scanf("%d", &N);
  for(i = 1; i <= N; i++) {
    scanf("%d", &A[i]);
  }
  A[0] = 0; A[N+1] = 0;
  max_price = 0;
  for(i = 1; i <= N+1; i++) {
    max_price += abs(A[i-1] - A[i]);
  }
  for(i = 1; i <= N; i++) {
    price = max_price - (abs(A[i-1] - A[i]) + abs(A[i] - A[i+1])) + abs(A[i-1] - A [i+1]);
    printf("%ld\n", price);
  }
  return 0;
}

Measured memory_bytes: 1536
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define mod 1000000007
using namespace std;
 
int main()
{
    ll n;
  string s;
  cin>>n>>s;
  ll ans=0;
  for(ll i=0;i<n-2;i++)
  {
   	if(s[i]=='A'&&s[i+1]=='B'&&s[i+2]=='C')
   	++ans;
  }
  cout<<ans;
    return 0;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline
from collections import defaultdict
from bisect import bisect_right
n = int(input())
a = [list(input().split()) for i in range(n)]
for i in range(n):
    if a[i][2] == "R":
        a[i][2] = 1
    elif a[i][2] == "L":
        a[i][2] = 2
    elif a[i][2] == "U" :
        a[i][2] = 3
    else:
        a[i][2] = 4
    a[i][0] = int(a[i][0])
    a[i][1] = int(a[i][1])
a.sort(key=lambda x: x[2])
R1 = defaultdict(list)
R2 = defaultdict(list)
L1 = defaultdict(list)
L2 = defaultdict(list)
U = defaultdict(list)
R = defaultdict(list)

R1u = defaultdict(bool)
R2u = defaultdict(bool)
L1u = defaultdict(bool)
L2u = defaultdict(bool)
Uu = defaultdict(bool)
Ru = defaultdict(bool)


M = 10000000
for x, y, u in a:
    if u == 1:
        R1[y - x].append(x)
        R2[x + y].append(x)
        R[y].append(x)
    elif u == 2:
        L1[x + y].append(x)
        L2[y - x].append(x)
        if not Ru[y]:
            R[y].sort()
            Ru[y] = True
        k = bisect_right(R[y], x)
        if k > 0:
            M = min((x - R[y][k-1]) * 5, M)

    elif u == 3:
        if not L2u[y - x]:
            L2[y - x].sort()
            L2u[y - x] = True
        k = bisect_right(L2[y - x], x)
        if k < len(L2[y - x]):
            M = min(M, (L2[y - x][k] - x) * 10)
        
        if not R2[x + y]:
            R2[x + y].sort()
            R2u[x + y] = True
        k = bisect_right(R2[x + y], x)
        if k > 0:
            M = min(M, (x - R2[x + y][k-1]) * 10)
        
        U[x].append(y)
    else:
        if not L1u[x + y]:
            L1[x + y].sort()
            L1u[x + y] = True
        k = bisect_right(L1[x + y], x)
        if k < len(L1[x + y]):
            M = min(M, (L1[x + y][k] - x) * 10)

        if not R1u[y - x]:
            R1[y - x].sort()
            R1u[y - x] = True
        k = bisect_right(R1[y - x], x)
        if k > 0:
            M = min(M, (x - R1[y - x][k-1]) * 10)

        if not Uu[x]:
            U[y].sort()
            Uu[y] = True
        k = bisect_right(U[x], y)
        if k > 0 :
            M = min((y - U[x][k-1]) * 5, M)
print(M if M < 10000000 else "SAFE")

Measured memory_bytes: 235956
#include<stdio.h>
int main(){
    int n, k;
    int a = 1;
    scanf ("%d %d", &n, &k);
    for(int i = 1; i <= n; i++){
        if(a + k < 2 * a) a += k;
        else a *= 2;
    }
   printf ("%d\n", a);
   return 0;
}

Measured memory_bytes: 1732
#include<stdio.h>

int main(void){
    char s;
    int i,ans = 0;
    for(i=0;i<4;i++){
        scanf("%c",&s);
        switch(s){
            case '+':
            ans++;
            break;
            case '-':
            ans--;
            break;

        }
    }

    printf("%d",ans);
    return 0;

}

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

int main(){
    int A,H;

    cin >> H >> A;

    int B;

    int i = 1;

    int v = 0;
    
    while(H>B){
        B = (A*i);

        i++ ;
        v++;
    }

    cout << v << endl;

    return 0;
}

Measured memory_bytes: 256
def main():
    n = int(input())
    result = 0
    for i in range(1, n + 1):
        if i % 3 == 0 and i % 5 == 0:
            continue
        elif i % 3 == 0:
            continue
        elif i % 5 == 0:
            continue
        else:
            result += i
    print(result)


if __name__ == "__main__":
    main()


Measured memory_bytes: 9160
#!/usr/bin/python3

import sys
# input = sys.stdin.readline
sys.setrecursionlimit(100000)
MOD = 10 ** 9 + 7

#N = int(input())
#A = [int(x) for x in input().split()]
#V = [[0] * 100 for _ in range(100)]

N = int(input())

gu = N // 2
print((N-gu)/N)

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

int main(){
    int A,B,C;
    cin >> A >> B >> C;
    bool X=false;
    for (int i=0; i<B; ++i){
        int D=(i+1)*A;
        if (D%B==C) X=true;
    } 
    if (X) cout << "YES" << endl;
    else cout << "NO" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _CRT_SECURE_NO_WARNINGS
#define ll long long
#define BUF 50
#define INF 1<<30
using namespace std;
ll MOD = 1e9 + 7;
ll A, B, C, D, G, H, N, M, L, K, P, Q, R, W, X, Y, Z;
string S;
ll ans = 0;
int main() {
	int y;
	cin >> y >> S;
	cout << y + 1 << S;
}

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();
		double [] xArray = new double [n];
		String [] uArray = new String [n];
		double sum = 0;
		for(int i = 0; i < n; i++) {
			xArray[i] = sc.nextDouble();
			uArray[i] = sc.next();
			if(uArray[i].equals("JPY")) sum = sum + xArray[i];
			else if(uArray[i].equals("BTC")) sum = sum + xArray[i]*380000.0;
		}
		System.out.printf("%f\n", sum);
		sc.close();
	}

}


Measured memory_bytes: 26580
/*
 * ID: 2260
 * Problem: Symmetry 
 */

#include <stdio.h>
#include <string.h>

int main(void)
{
    char r[128];
    r['i'] = 'i';
    r['w'] = 'w';
    r['('] = ')';
    r[')'] = '(';

    char s[10+1];
    scanf("%s", s);

    int length = strlen(s);
    int v = 0;
    for (int i = 0; i * 2 <= length - 1; i++) {
        if(s[i] != r[(int)s[length - i - 1]])
            v++;
    }

    printf("%d\n", v);

    return 0;
}



Measured memory_bytes: 2104
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <string.h>
#include <vector>
#define MAXN 110
#define INF 0x3f3f3f3f

using namespace std;

int main()
{
    int n, a[2][MAXN], up[MAXN], down[MAXN], sum[MAXN], ans = -1;
    cin>>n;
    for(int i = 0; i < 2; i++)
        for(int j = 0; j < n; j++)
        {
            cin>>a[i][j];
            if(i == 0)
            {
                if(j == 0)
                    up[j] = a[i][j];
                else
                    up[j] = up[j - 1] + a[i][j];
            }
        }
    down[n - 1] = a[1][n - 1];
    for(int j = n - 2; j >= 0; j--)
        down[j] = down[j + 1] + a[1][j];
    for(int i = 0; i < n; i++)
    {
        sum[i] = up[i] + down[i];
        ans = max(ans, sum[i]);
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
i,k;main(x){for(;;i++){scanf("%d",&x);if(!x)return 0;k+=1<<(5*x+i);if(i==4){if((k&992&&k&31744&&k&1015808)||(k&992)==992||(k&31744)==31744||(k&1015808)==1015808)for(x=5;x--;)puts("3");else if(!(k&992))for(x=0;x<5;x++)puts(k&1<<(10+x)?"1":"2");else if(!(k&31744))for(x=0;x<5;x++)puts(k&1<<(15+x)?"1":"2");else for(x=0;x<5;x++)puts(k&1<<(5+x)?"1":"2");k=0,i=-1;}}}

Measured memory_bytes: 0
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int k = Integer.parseInt(sc.next());
        String s = sc.next();
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < n; i++) {
            if (i == k - 1) {
                sb.appendCodePoint(s.charAt(i) + 32);
            } else {
                sb.append(s.charAt(i));
            }
        }

        System.out.println(sb.toString());
    }
}


Measured memory_bytes: 21844
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;

const int MAX = 1000000;
const int MOD = 1000000007;

ll fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void cominit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
ll comb(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main(){
    int x, y;
    cin >> x >> y;

    int cou_x = 0;
    int cou_y = 0;
    int flag = 0;
    ll ans = 0;
    cominit();
    if(x >= y){
        cou_x = x / 2;
        cou_y = 0;
        if(x % 2 != 0){
            cou_y++;
        }

        while(1){
            if(cou_x + cou_y * 2 == y){
                break;
            }else if(cou_x + cou_y * 2 > y){
                flag = -1;
                break;
            }else{
                cou_x--;
                cou_y += 2;
            }
        }

        if(flag == 0){
            if(cou_x <= cou_y){
                ans = comb(cou_x + cou_y, cou_x);
            }else{
                ans = comb(cou_x + cou_y, cou_y);
            }
        }
    }else{
        cou_y = y / 2;
        cou_x = 0;
        if(y % 2 != 0){
            cou_x++;
        }

        while(1){
            if(cou_x * 2 + cou_y == x){
                break;
            }else if(cou_x * 2 + cou_y > x){
                flag = -1;
                break;
            }else{
                cou_y--;
                cou_x += 2;
            }
        }

        if(flag == 0){
            if(cou_x <= cou_y){
                ans = comb(cou_x + cou_y, cou_x);
            }else{
                ans = comb(cou_x + cou_y, cou_y);
            }
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 23680
#include<bits/stdc++.h>
using namespace std;
const double pi=atan(1.0)*4;
typedef long long ll;
const ll mod=1e9+7;
int main(){
	int n,k;
	scanf("%d%d",&n,&k);
	ll ans=0;
	for(int i=k;i<=n+1;i++){
		ans=(ans+(ll)i*(2*n-i+1)/2-(ll)i*(i-1)/2+1)%mod;
	}
	printf("%lld\n",ans);
	return 0;
}


Measured memory_bytes: 3832
import java.util.Scanner;

public class Main {

	public static void main(final String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt(), x = sc.nextInt(), t = sc.nextInt();
		int r = ((n - 1 ) / x + 1) * t;
		System.out.println(r);

	}
}


Measured memory_bytes: 35672
// abc054d: Mixing Experiment
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vvi = vector<vi>;

#define rep(i,n) for(int i=0;i<(n);i++)
#define upto(i,s,e,d) for(int i=(s);i<(e);i+=(d))
#define oute(x) cout<<(x)<<endl

#define INF 100*40+1

int main(){
  int N,Ma,Mb; cin>>N>>Ma>>Mb;
  vi A(N+1),B(N+1),C(N+1); // 1 origin
  int amax=1, bmax=1;
  upto(n,1,N+1,1){
    cin>>A[n]>>B[n]>>C[n];
    amax = max(amax, A[n]);
    bmax = max(bmax, B[n]);
  }

  int Na = N*amax, Nb = N*bmax;
  vector<vvi> dp(2, vvi(Na+1, vi(Nb+1, INF)));
  dp[0][0][0] = 0;

  int p,q;
  upto(n,1,N+1,1){
    p = (n-1)%2; q = n%2;
    rep(a,Na+1) rep(b,Nb+1){
      if(dp[p][a][b]==INF) continue;
      // 買わない(a,b), 買う(a+A[n],b+B[n])
      int aa = a+A[n], bb = b+B[n];
      dp[q][a][b] = min(dp[q][a][b], dp[p][a][b]);
      dp[q][aa][bb] = min(dp[q][aa][bb], dp[p][a][b] + C[n]);
    }
  }

  int ans = INF;
  upto(a,1,Na+1,1)
    upto(b,1,Nb+1,1)
      if(a*Mb==b*Ma) ans = min(ans, dp[q][a][b]);

  if(ans==INF) ans = -1;
  oute(ans);

}

Measured memory_bytes: 2176
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod=1e9+7;
const int N=2e5+20;
vector<ll> v;
ll n,k,dp[2500];
ll powmod(ll x,ll n)
{
	ll s=1;
	while(n)
	{
		if(n&1)
			s=(s*x)%mod;
		n>>=1;
		x=(x*x)%mod;
	}
	return s;
}
void init()
{
	v.clear();
	for(ll i=1;i*i<=n;i++)
	{
		if(n%i==0)
		{
			v.push_back(i);
			if(i*i!=n)
				v.push_back(n/i);
		}
	}
	sort(v.begin(),v.end());
}
int main()
{
	while(cin>>n>>k)
	{
		init();
		ll ans=0;
		for(int x=0;x<v.size();x++)
		{
			dp[x]=powmod(k,(v[x]+1)/2);
			for(int y=0;y<x;y++)
			{
				if(v[x]%v[y]==0)
					dp[x]=(dp[x]-dp[y]+mod)%mod;	
			}	
			if(v[x]%2)
				ans=(ans+(dp[x]*v[x])%mod)%mod;
			else
				ans=(ans+(dp[x]*v[x]/2)%mod)%mod;
		}
		cout<<ans<<endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>

int main(void) {
	char O[51], E[51];
	
	scanf("%s %s", E, O);

	int totalLength = strlen(O) + strlen(E);
	char password[totalLength];
	// set password to empty string
	password[0] = '\0';
	
	for (int i = 0; i < (int) strlen(E); i++) {
		strncat(password, &E[i], 1);
		if (i < (int) strlen(O)) {
			strncat(password, &O[i], 1);
		} 
	}
	
	printf("%s", password);
	
	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
typedef long long unsigned int ll;

// definition {{{ 1

// scaning {{{ 2
#define Scd(x) scanf("%d", &x)
#define Scd2(x,y) scanf("%d%d", &x, &y)
#define Scd3(x,y,z) scanf("%d%d%d", &x, &y, &z)

#define Scll(x) scanf("%llu", &x)
#define Scll2(x,y) scanf("%llu%llu", &x, &y)
#define Scll3(x,y,z) scanf("%llu%llu%llu", &x, &y, &z)

#define Scc(c) scanf("%c", &c);
#define Scs(s) scanf("%s", s);
#define Scstr(s) scanf("%s", &s);
// }}} 2

// constants {{{ 2
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
// }}} 2

// systems {{{ 2
#define Rep(x,y) for(int x = 0; x < y; x++)
#define Repe(x,y,z) for(int x = z; x < y; x++)
// }}} 2

// output {{{ 2
#define YesNo(a) (a)?printf("Yes\n"):printf("No\n");
// }}} 2

// }}} 1

int main() {

    int a,c;
    char b;

    scanf("%d %c %d", &a, &b, &c);
    if( b == '-' ){
        printf ("%d\n", a-c);
    }else{
        printf ("%d\n", a+c);
    }

    return 0;
}



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


int main(){
  int N;
  ll T;
  cin >> N >> T;
  vector<ll> A(N);
  rep(i, N){
    cin >> A[i];
  }
  
  ll time = 0;
  rep(i, N-1){
    ll diff = A[i+1] - A[i];
    if (diff < T) time += diff;
    else time += T;
  }
  time += T;
  
  cout << time << endl;
    
}


Measured memory_bytes: 1792
import java.util.*;
public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    long a = sc.nextLong();
    long b = sc.nextLong();
    long x = sc.nextLong();
    long ans = b/x;
    if(a!=0){
      ans-=(a-1)/x;
    }else{
      ans++;
    }
    System.out.println(ans);
  }
}

Measured memory_bytes: 35652
/*input
183
*/

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 

#define rep(i,j,n) for(i=j;i<n;i++)
#define repi(i,j,n) for(i=j;i>n;i--)
#define inf 100001
#define M 1000000007
#define ll long long
#define ld long double
#define vll vector<long long>
#define vi vector<int>
#define pll pair<long long,long long>
#define pii pair<int,int>
#define vpii vector<pair<int,int> >
#define vpll vector<pair<long long,long long> >
#define pb push_back
#define pf pop_front
#define F first
#define S second
#define endl '\n'

using namespace std;
using namespace __gnu_pbds; 

template<typename T>
using ordered_set=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;


ll power(ll a,ll m,ll mod){
	ll ans=1;
	while(m){
		if(m%2){
			ans*=a;
			ans%=(mod);
		}
		a=(a*a)%(mod);
		m>>=1;
	}
	return ans;
}


void init(ll* a,ll n,ll val){
	for(ll i=0;i<n;i++)
		a[i]=val;
}



int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);	
	ll t=1,i,j;
	ll n;
	cin>>n;
	n=n%10;
	if(n==3){
		cout<<"bon\n";
	}else if(n==1||n==0||n==6||n==8){
		cout<<"pon\n";
	}else {
		cout<<"hon\n";
	}
	return 0;
}




Measured memory_bytes: 3612
import java.util.*;

public class Main{
    
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        
        int n = Integer.parseInt(sc.next());
        long m = Long.parseLong(sc.next());
        
        long[] a = new long[n];
        for(int i=0; i<n; i++){
            a[i] = Long.parseLong(sc.next());
        }
        
        int h2 = 0;
        {
            long tmp = a[0];
            while(tmp%2==0){
                tmp /= 2;
                h2++;
            }
        }
        
        long fact = 1;
        for(int i=0; i<n; i++){
            int cnt2 = 0;
            {
                long tmp = a[i];
                while(tmp%2==0){
                    tmp /= 2;
                    cnt2++;
                }
            }
            if(cnt2 != h2 || fact>(1L<<34)){
                System.out.println(0);
                return ;
            }
            fact = lcm(fact, a[i]/2);
        }
        
        System.out.println((m+fact)/fact/2);
    }
    
    public static long lcm(long m, long n) {
        return m / gcd(m, n) * n;
    }
    
    public static long gcd(long m, long n) {
        if(m < n) return gcd(n, m);
        if(n == 0) return m;
        return gcd(n, m % n);
    }
}


Measured memory_bytes: 48776
#include <stdio.h>
#include <math.h>
 
#define DEG2RAD(X) ((X)/180.0*3.1415926535898) 
int main(void){
    double curX,curY;
    int curDir;
    double dx,dy;
    int dAngle,dDist;
    
    curX = curY = 0;
    curDir = 0; // north
    scanf("%d,%d",&dDist, &dAngle);
    while (dDist!=0 || dAngle!=0){
        curX += dDist * sin(DEG2RAD(curDir));
        curY += dDist * cos(DEG2RAD(curDir));
        curDir += dAngle;
        scanf("%d,%d",&dDist, &dAngle);
    } 
    printf("%d\n%d\n", (int)curX, (int)curY);
    return 0;
}

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

string getCode1( char c ){
	string ret;
	switch( c ){
		case ' ':	ret = "101"; break;
		case '\'':	ret = "000000"; break;
		case ',':	ret = "000011"; break;
		case '-':	ret = "10010001"; break;
		case '.':	ret = "010001"; break;
		case '?':	ret = "000001"; break;
		case 'A':	ret = "100101"; break;
		case 'B':	ret = "10011010"; break;
		case 'C':	ret = "0101"; break;
		case 'D':	ret = "0001"; break;
		case 'E':	ret = "110"; break;
		case 'F':	ret = "01001"; break;
		case 'G':	ret = "10011011"; break;
		case 'H':	ret = "010000"; break;
		case 'I':	ret = "0111"; break;
		case 'J':	ret = "10011000"; break;
		case 'K':	ret = "0110"; break;
		case 'L':	ret = "00100"; break;
		case 'M':	ret = "10011001"; break;
		case 'N':	ret = "10011110"; break;
		case 'O':	ret = "00101"; break;
		case 'P':	ret = "111"; break;
		case 'Q':	ret = "10011111"; break;
		case 'R':	ret = "1000"; break;
		case 'S':	ret = "00110"; break;
		case 'T':	ret = "00111"; break;
		case 'U':	ret = "10011100"; break;
		case 'V':	ret = "10011101"; break;
		case 'W':	ret = "000010"; break;
		case 'X':	ret = "10010010"; break;
		case 'Y':	ret = "10010011"; break;
		case 'Z':	ret = "10010000"; break;
	}
	return ret;
}

char getCode2( string& s ){
	char c = 0;
	for ( int i = 0; i < 5; ++i ){
		c += ( ( s[ 4 - i ] - '0' ) << i );
	}
	if ( c < 26 ){
		c += 'A';
	}else{
		switch( c ){
			case 26: c = ' '; break;
			case 27: c = '.'; break;
			case 28: c = ','; break;
			case 29: c = '-'; break;
			case 30: c = '\''; break;
			case 31: c = '?'; break;
		}
	}
	return c;
}

void firstEnc( string& is ){
	string os;
	string::iterator it = is.begin();
	while ( it != is.end() ){
		os += getCode1( *it );
		it = is.erase( it );
	}
	is = os;
}

void secondEnc( string& is ){
	string os;
	if ( is.size() % 5 ){
		is.append( 5 - is.size() % 5 , '0' );
	}
	while ( is.size() ){
		string set( is, 0, 5 );
		os += getCode2( set );
		is.erase( 0, 5 );
	}
	is = os;
}

int main(){
	string s;

	while ( getline( cin, s ) ){
		firstEnc( s );
		secondEnc( s );
		cout << s << endl;
	}
	return 0;
}

Measured memory_bytes: 0
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<cstring>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define rep(i, n) for(int i=0;i<n;++i)
#define rrep(i, n) for(int i=n;i>=0;--i)
const int inf=1e9+7;
const ll mod=1e9+7;
const ll mod1=998244353;
const ll big=1e18;
const double PI=2*asin(1);

int DP1[3005][3005], DP2[3005][3005];

int main() {
  int N, T;
  cin>>N>>T;
  int A[N], B[N];
  for(int i=0;i<N;++i) cin>>A[i]>>B[i];
  for(int i=0;i<=T;++i) {
    if(A[0]<=i) DP1[0][i] = B[0];
  }
  for(int i=1;i<N;++i) {
    for(int j=0;j<=T;++j) {
      if(A[i]<=j) DP1[i][j] = max(DP1[i-1][j], DP1[i-1][j-A[i]]+B[i]);
      else DP1[i][j] = DP1[i-1][j];
    }
  }
  for(int i=0;i<=T;++i) {
    if(A[N-1]<=i) DP2[N-1][i] = B[N-1];
  }
  for(int i=N-2;i>=0;--i) {
    for(int j=0;j<=T;++j) {
      if(A[i]<=j) DP2[i][j] = max(DP2[i+1][j], DP2[i+1][j-A[i]]+B[i]);
      else DP2[i][j] = DP2[i+1][j];
    }
  }
  int ans = 0;
  ans = DP2[1][T-1]+B[0];
  for(int i=1;i<N-1;++i) {
    for(int j=0;j<T;++j) {
      ans = max(ans, DP1[i-1][j]+DP2[i+1][T-1-j]+B[i]);
    }
  }
  ans = max(ans, DP1[N-2][T-1]+B[N-1]);
  cout<<ans<<endl;
}


Measured memory_bytes: 74000
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		int i = 0;
		Scanner sc = new Scanner(System.in);

		do {


	        int x = sc.nextInt();

	        if (x == 0) {
	        	break;
	        }else {
	        	System.out.println( "Case "+ (i + 1) +": "+ x);
	        }

	        i++;

		}while(true);
		sc.close();
	}
}


Measured memory_bytes: 42372
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <unordered_set>
#include <unordered_map>
#include <numeric>
#include <ctime>
#include <bitset>
#include <complex>
#include <chrono>
#include <random>
#include <functional>

using namespace std;

signed main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);

	int n;
	cin >> n;
	vector<int> p(n);
	for (auto &t : p) {
		cin >> t;
	}
	int ok = is_sorted(p.begin(), p.end());
	for (int i = 0; i < n; i++) {
		for (int j = i + 1; j < n; j++) {
			swap(p[i], p[j]);
			ok |= is_sorted(p.begin(), p.end());
			swap(p[i], p[j]);
		}
	}
	if (ok) cout << "YES\n";
	else cout << "NO\n";
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
				using namespace std;
				#define cool ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
				#define pb push_back
				#define fe first
				#define se second
				#define endl "\n"
				#define int long long int 
				#define pii pair<int, int>

				#define PI 3.14159265358979323846
				const int N = 1e5 + 10;
				int n,m;
				int p[N],siz[N],a[N],b[N],tot;
				vector<int> ans;
				void init() {
					   for(int i=1;i<=n;i++) {
						      p[i]=i;
						      siz[i]=1;
					   }
					}
				int findi(int x) {
					   while(x!=p[x]){
						      p[x]=p[p[x]];
						      x=p[x];
						   }
						   return x;
					}
					
					
				void uni(int  x,int  y) {
					  int  yo1=findi(x);
					  int yo2=findi(y);					
					   if(yo1==yo2)
					     return ;
					     
					     if(siz[yo1]>siz[yo2])
					        swap(yo1,yo2);
					        
					        tot-=siz[yo1]*siz[yo2];
					        siz[yo2]+=siz[yo1];
					        p[yo1]=p[yo2];
					        siz[yo1]=0;
				   		       
				       				
					}		
				
               
				void solve() {
				      cin>>n>>m;
				      init();
				      for(int i=1;i<=m;i++) {
						  cin>>a[i]>>b[i];
						     
						  }
						  
				 tot=((n)*(n-1)/(2));
					
					for(int i=m;i>=1;i--) {
						
							  ans.pb(tot);
					
						  
							      uni(a[i],b[i]);
							    //  cout<<i<<" "<<tot<<" "<<endl;				      
						 
						}
			
						reverse(ans.begin(),ans.end());
						
						for(int i=0;i<ans.size();i++) 
						    cout<<ans[i]<<endl;	
					 					
				}			
					   

				int32_t  main() {
				  cool;
				  int t = 1;
				  while (t--)
					solve();

				  return 0;
				}


Measured memory_bytes: 5364
#include <stdio.h>
#define MAX 500000
#define INFTY 2000000000

int L[MAX/2+2],R[MAX/2+2];
int count=0;

void merge(int A[],int n,int left, int mid, int right){
  int i,j,k;
  int n1,n2;
  n1=mid-left;
  n2=right-mid;
  for (i = 0; i < n1; i++) L[i]=A[left+i];
  for (i = 0; i < n2; i++) R[i]=A[mid+i];
  L[n1]=INFTY;
  R[n2]=INFTY;
  i=0;
  j=0;
  for(k=left;k<right;k++){
    count++;
    if(L[i]<=R[j]) A[k]=L[i++];
    else A[k]=R[j++];
  }
}

void mergesort(int A[],int n,int left,int right){
  int mid;
  if(left+1<right){
  mid=(left+right)/2;
  mergesort(A,n,left,mid);
  mergesort(A,n,mid,right);
  merge(A,n,left,mid,right);
  }
}

int main(){
  int A[MAX],n,i;
  scanf("%d\n",&n);
  for(i=0;i<n;i++){
      scanf("%d",&A[i]);
  }
  mergesort(A,n,0,n);
  for(i=0;i<n;i++){
    if(i==n-1)  printf("%d\n",A[i]);
    else printf("%d ",A[i]);
  }
  printf("%d\n",count);
  return 0;
}



Measured memory_bytes: 5636
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main()
{
	ll n, ans=0; cin >> n;
	for (ll i=1; i<=n; i++)
		if (i % 3 != 0 && i % 5 != 0)
			ans += i;
	cout<<ans<<"\n";	
	return 0;
}


Measured memory_bytes: 3620
a,b,c,d,e,f=map(int,input().split())
print(*max(
  [[s/(s+w),s+w,s]
    for t in range(0,f+1,a*100)
    for w in range(t,f+1,b*100)
    if w>0
    for m in [min(f-w,w*e//100)+1]
    for u in range(0,m,c)
    for s in range(u,m,d)
  ])[1:])

Measured memory_bytes: 123652
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main() {
	ll n, k;
    cin >> n >> k;
    int p[n];
    for (int i = 0; i < n; ++i) {
        cin >> p[i]; p[i]--;
    }
    ll c[n];
    for (int i = 0; i < n; ++i) {
        cin >> c[i];
    }

    ll ans = -1e18;
    for (int st = 0; st < n; ++st) {
        ll rep = 0, cur = st;
        ll score = 0;
        while(true) {
            rep++;
            cur = p[cur];
            score += c[cur];
            if(cur == st) break;
        }
        if(k >= rep)
            ans = max(ans, k / rep * score);

        ll stp = 0;
        ll running = 0;
        while(true) {
            cur = p[cur];
            running += c[cur];
            stp++;
            if(k >= stp) {
                ans = max({ans, running, running + (k-stp)/rep * score});
            }
            if(cur == st) break;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 3692
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <vector>
#define rep(i,n) for(int i=0;i<n;i++)
#define ll long long int
#define MAX 1000000007
using namespace std;

int main(void){
  int n,m;
  cin >> n >> m;

  cout << n*(n-1)/2+m*(m-1)/2 << endl;
  return 0;
}


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

int gcd(int a,int b)
{
    if(a%b==0)
        return b;

    return gcd(b,a%b);
}


int main()
{

    int k;
    cin>>k;
    int sum=0;

    for(int i=1;i<=k;i++)
        for(int j=1;j<=k;j++)
        for(int l=1;l<=k;l++)
        sum+=gcd(gcd(j,l),i);

    cout<<sum<<endl;

    exit(0);

}


Measured memory_bytes: 3560