akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <iomanip>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <math.h>
#include <sstream>
#include <numeric>
#include <string>
#include <cassert>
#include <bitset>

using namespace std;
typedef long long ll;


// a^n mod を計算する
long long modpow(long long a, long long n, long long mod) {
  long long res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}

// a^{-1} mod を計算する
long long modinv(long long a, long long mod) {
  return modpow(a, mod - 2, mod);
}


map<int, int> GetPrimes(int a) {
  map<int, int> primes;
  for (int p = 2; p * p <= a; ++p) {
    while (a % p == 0) {
      primes[p]++;
      a /= p;
    }
  }
  if (a != 1) {
    primes[a]++;
  }
  return primes;
}

int main() {
  //                123456789
  const int kMod = 1000000007;

  int N;
  cin >> N;
  
  vector<int> A(N);
  for (int i = 0; i < N; ++i) {
    cin >> A[i];
  }

  map<int, int> lcm_primes;
  for (int i = 0; i < N; ++i) {
    map<int, int> primes = GetPrimes(A[i]);
    for (auto x : primes) {
      int p = x.first;
      int cnt = x.second;
      if (lcm_primes[p] < cnt) {
	lcm_primes[p] = cnt;
      }
    }
  }

  ll lcm = 1;
  for (auto x : lcm_primes) {
    int p = x.first;
    int cnt = x.second;
    for (int i = 0; i < cnt; ++i) {
      lcm = lcm * p % kMod;
    }
  }

  ll sum_B = 0;
  for (int i = 0; i < N; ++i) {
    ll B = lcm * modinv(A[i], kMod) % kMod;
    sum_B = (sum_B + B) % kMod;
  }

  cout << sum_B << endl;
  
  return 0;
}


Measured memory_bytes: 768
#include <iostream>
#include <cstdlib>
#include <string>
#include <vector>
#include <stack>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <math.h>
#include <stdio.h>
#include <ctype.h>
#include <ios> 
#include <iomanip>
using namespace std;

#define N_MAX   (100000)
#define LL_MAX_NUM (1LL<<60)
#define INF 1e7

typedef long long ll;
typedef long long int lli;

int main() {
	int N;; cin >> N;
    vector<int> p, pc;
    for(int i = 0; i < N; i++) 
    {
        int pi; cin >> pi;
        p.push_back(pi);
        pc.push_back(pi);
    }
    sort(pc.begin(), pc.end());
    int diff = 0;
    for (int j = 0; j < N; j++)
    {
        if (p.at(j) != pc.at(j)) { diff++; }
    }
    cout << (diff==0||diff==2?"YES":"NO") << endl;
	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))
using ll = long long;
using P = pair< int, int >;

int c[101][101];

int main() {
    int H, W, N;
    cin >> H >> W >> N;
    vector<int> a(N);
    rep(i, N) cin >> a[i];

    bool f=1;
    int idx=0, cnt=0;
    rep(y, H) {
        if (f) {
            rep(x, W) {
                if (cnt < a[idx]) {
                    c[y][x] = idx+1;
                    cnt++;
                }
                if (cnt >= a[idx]) {
                    idx++;
                    cnt = 0;
                }
            }
            f = !f;
        }
        else {
            for (int x=W-1; x>=0; --x) {
                if (cnt < a[idx]) {
                    c[y][x] = idx+1;
                    cnt++;
                }
                if (cnt >= a[idx]) {
                    idx++;
                    cnt = 0;
                }
            }
            f = !f;
        }
    }

    rep(y, H) {
        rep(x, W) {
            cout << c[y][x] << " ";
        }
        cout << endl;
    }
}


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

using namespace std;

int main () {
     cout<<setprecision(12);
    double N,K,n,Point;
    cin >> N >> K;
    
    double cnt;

    for(double i = 1.0;i<=N;i+=1.0){
        n=1.0/N;
        Point=i;
        while(Point<K){
            Point*=2;
            n/=2;
        }
        cnt+=n;
    }
    cout<<cnt<<endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int s = sc.nextInt();
		int[] array = new int[2];
		for (int i = 0; i < 4; i++) {
			int num = s % 10 * (int) Math.pow(10, i);
			array[1 - i / 2] += num;
			s /= 10;
		}
		array[0] /= 100;
		if (array[0] <= 0 || array[0] > 12) {
			if (array[1] <= 0 || array[1] > 12) {
				System.out.println("NA");
			} else {
				System.out.println("YYMM");
			}
		} else {
			if (array[1] <= 0 || array[1] > 12) {
				System.out.println("MMYY");
			} else {
				System.out.println("AMBIGUOUS");
			}
		}
	}
}


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

int d,ans[365],c[26],s[365][26],last[26],nowscore,csum;
const int INF=1e9;

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

void FIN(int a){
  if(a){
    ofstream fout("output.txt");
    REP(i,d)fout<<ans[i]+1<<"\n";
    fout.close();
    return;
  }
  REP(i,d)cout<<ans[i]+1<<"\n";
  return;
}

int score(){
  int res=0,minus=csum;
  memset(last,-1,sizeof(last));
  REP(day,d){
    res+=s[day][ans[day]];
    minus-=c[ans[day]]*(day-last[ans[day]]);
    last[ans[day]]=day;
    res-=minus;
    minus+=csum;
  }
  return res;
}
void swap(){
  int day=rand()%(d-16),diff=(rand()&15)+1;
  swap(ans[day],ans[day+diff]);
  int R=score();
  if(R<nowscore)swap(ans[day],ans[day+diff]);
  else nowscore=R;
}
void onechange(){
  int day=rand()%d;
  REP(i,26){
    int tmp=ans[day];
    ans[day]=i;
    int R=score();
    if(R<nowscore)ans[day]=tmp;
    else nowscore=R;
  }
}

int main(){
  memset(last,-1,sizeof(last));
  cin>>d;
  REP(i,26)cin>>c[i];
  REP(i,26)csum+=c[i];
  REP(i,d)REP(j,26)cin>>s[i][j];
  REP(day,d){
    int idx,mx=-INF;
    REP(i,26){
      int A=c[i]*(day-last[i])+s[day][i];
      if(mx<A)mx=A,idx=i;
    }
    ans[day]=idx,last[idx]=day;
  }
  nowscore=score();
  REP(_,1000){
    REP(__,150)onechange();
    REP(__,150)swap();
  }
  FIN(0);
}


Measured memory_bytes: 3644
#include <stdio.h>

int main()
{
 
  int a,b,c;
  int k;
  int count = 0;
  scanf("%d%d%d%d",&a,&b,&c,&k);
  
  if(a>=b){
  	while(a>=b){
        b*=2;	
        count++;
      }
    }
    if(b>=c){
      while(b>=c){
        c*=2;	
        count++;
      }
    }
  if(count<=k)
    printf("Yes\n");
  else
    printf("No\n");
  return 0;
}

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

n,k,s = list(map(int,input().split()))
a = []
count = 0
st = ""

for i in range(k):
    a.append(s)

for i in range(n-k):
    if s < 2:
        a.append(s+1)
    else:
        a.append(s-1)
    
for i in range(n):
    if st == "":
        st = str(a[count])
    else:
        st += " " + str(a[count])
    count += 1

print(st)


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

int main(){

	int a, n, m,  L_sum;
	int ans = 0, i = 1;
	long long R_ans;
	cin >> a >> n >> m;

	R_ans = powl(i + a, n);

	while(R_ans <= m) {
		int  num = R_ans;
		L_sum = 0;

		//  各桁数の合計値を求める
		while(num > 0){
			L_sum += num % 10;
			num /=10;
		}

		//  左辺と右辺の式を比較
		if(R_ans == powl(L_sum+a,n)) ans++; 
		i++;
		R_ans = powl(i + a, n);
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 3332
// 30/07/19 // 9:04 PM //

#include <iostream>

using namespace std;

#define MAXN 110
#define MAXV 100010
#define INF 2000000000

int n, w;
int value[MAXN], weight[MAXN];
long long memo[MAXN][MAXV+5];

void knapsack(){

    for(int j=0; j<=MAXV; j++)
        memo[0][j] = INF;
    memo[0][0] = 0;

    for(int i=1; i<=n; i++)
        for(int j=0; j<=MAXV; j++){
            memo[i][j] = memo[i-1][j];

            if(j-value[i]>=0)
                memo[i][j] = min(memo[i][j], weight[i] + memo[i-1][j-value[i]]);
        }


}

int main(){

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    cin >> n >> w;
    for(int i=1; i<=n; i++)
        cin >> weight[i] >> value[i];


    knapsack();

    int resp = -1;

    for(int j=0; j<=MAXV; j++)
        if(memo[n][j]>0 && memo[n][j]<=w)
            resp = max(resp, j);

    cout << resp << "\n";


    return 0;
}


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

int N;
int A[110];

int main() {
    cin >> N;
    for (int i = 0; i < N; i++) cin >> A[i];

    int ans = 0;
    int cnt = 0;
    int tmp = A[0];
    for (int i = 1; i < N; i++) {
        if (tmp == A[i]) {
            cnt++;
        }
        else {
            ans += (cnt+1)/2;
            cnt = 0;
        }
        tmp = A[i];
    }
    ans += (cnt+1)/2;


    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <vector>
#include <string>
#include <queue>
#include <map>
#include <algorithm>
#include <cmath>
#include <iostream>
#include <sstream>
#include <set>
using namespace std;

const int mmod = 1000000007;

int main()
{
  int n;
  cin >> n;
  vector<int> num(n);
  for (int i=0; i<n; i++)
    cin >> num[i];

  int mmin = 1;
  int prv_max = -999;
  vector<int> rank(n+1);
  for (int i=0; i<n; i++) {
    int diff = 2*i + 1 - num[i];
    int min_rank = max(mmin, max(prv_max, 1 + diff / 2));
    prv_max = max(prv_max, (diff + 3) / 2);
    rank[min_rank] ++;
    mmin = min_rank;
  }

  int res = 1;
  int remain = 0;
  for (int i=1; i<=n; i++) {
    remain += rank[i];
    res = (res * 1LL * remain) % mmod;
    remain --;
  }
  cout << res << endl;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
typedef vector<int> VI;
typedef long long ll;
typedef pair<int,int>PII;
const double eps=1e-6;
const double pi=acos(-1.0);
const int mod=1e4+7;
const int inf=0x3f3f3f3f;
//ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}

int main(){
//    freopen("in.in","r",stdin);
//    freopen("out.out",";w",stdout);
    int n;
    while(cin>>n){
        int a,cnt=0;
        for(int i=0;i<n;i++){
            cin>>a;
            if(a&1) cnt++;
        }
        if(cnt&1) puts("NO");
        else puts("YES");
    }
    return 0;
}


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

//#define int long long
#define DBG 1
#define dump(o) if(DBG){cerr<<#o<<" "<<o<<endl;}
#define dumpc(o) if(DBG){cerr<<#o; for(auto &e:(o))cerr<<" "<<e;cerr<<endl;}
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define each(it,c) for(auto it=(c).begin();it!=(c).end();it++)
#define all(c) c.begin(),c.end()
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9 + 7);

void change(string &s, char x, char c) {
	rep(i, 0, s.size()) {
		if (s[i] == x)s[i] = c;
	}
}
int eval(string &s, int &k) {
	if (s[k] == 'T')return 1;
	else if (s[k] == 'F')return 0;
	else if (s[k] == '-') {
		k++;
		int res = eval(s, k);
		return (1 - res);
	}
	else if (s[k] == '(') {
		k++;
		int a = eval(s, k);
		k++;
		char op = s[k];
		k++;
		int b = eval(s, k);
		k++;
		int r;
		if (op == '+')r = a | b;
		else if (op == '*')r = a&b;
		else if (op == '>')r = (a == 1 && b == 0) ? 0 : 1;
		return r;
	}
}
signed main() {
	string s;
	while (cin >> s, s != "#") {
		string str;
		for (int i = 0; i < s.size(); i++) {
			if (i == s.size() - 1)str.push_back(s[i]);
			else if (s[i] == '-'&&s[i + 1] == '>') {
				str.push_back('>');
				i++;
			}
			else str.push_back(s[i]);
		}

		string ex1, ex2; bool f(false);
		for (int i = 0; i < str.size(); i++) {
			if (str[i] == '=')f = true;
			else if (f)ex2.push_back(str[i]);
			else ex1.push_back(str[i]);
		}

		int c[256]; memset(c, 0, sizeof(c));
		rep(i, 0, str.size())c[str[i]] = 1;
		vector<char>vc;
		for (char x = 'a'; x <= 'k'; x++)if (c[x])vc.push_back(x);
		int N = vc.size();

		bool ans = true;
		for (int bits = 0; bits < (1 << N); bits++) {
			string ex1_(ex1), ex2_(ex2);
			rep(i, 0, N) {
				if (bits&(1 << i)) {
					change(ex1_, vc[i], 'T');
					change(ex2_, vc[i], 'T');
				}
				else {
					change(ex1_, vc[i], 'F');
					change(ex2_, vc[i], 'F');
				}
			}
			int t(0);
			int a = eval(ex1_, t);
			t = 0;
			int b = eval(ex2_, t);
			if (a != b) {
				ans = false;
				break;
			}
		}
		if (ans)cout << "YES" << endl;
		else cout << "NO" << endl;
	}
	return 0;
}

Measured memory_bytes: 3208
using System;
using System.Linq;
namespace AGC011A
{
    class Passenger
    {
        public int m;
        public int M;
        public Passenger(int t, int k) { m = t; M = t + k; }
        public bool Judge(int t) { return m <= t && t <= M; }
    }
    class Program
    {
        static void Main()
        {
            string[] s = Console.ReadLine().Split(' ');
            int n, c, k;
            n = int.Parse(s[0]);
            c = int.Parse(s[1]);
            k = int.Parse(s[2]);
            int[] t = new int[n];
            for (int i = 0; i < n; i++)
                t[i] = int.Parse(Console.ReadLine());
            Array.Sort(t);
            Passenger[] ps = new Passenger[n];
            for (int i = 0; i < n; i++)
                ps[i] = new Passenger(t[i], k);
            int f = 0;
            int ans = 1;
            bool fl = false;
            for (; ; )
            {
                if (f == n)
                {
                    Console.WriteLine(ans - 1);
                    Environment.Exit(0);
                }
                for (int i = 0; i < c; i++)
                {
                    try
                    {
                        if (!ps[f + i].Judge(ps[f].M))
                        {
                            f += i;
                            fl = true;
                            break;
                        }
                    }
                    catch (IndexOutOfRangeException) { Console.WriteLine(ans); Environment.Exit(0); }
                }
                if (fl)
                {
                    fl = false;
                    ans++;
                    continue;
                }
                f += c;
                ans++;
            }
        }
    }
}

Measured memory_bytes: 20432
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <functional>
#include <set>
#include <sstream>
#include <map>
#include <queue>
#include <stack>

using namespace std;

int main()
{
    long n,m;
    while(cin>>n>>m,n){
        vector<vector<long long> > data(m,vector<long long>(3));
        for(long i=0;i<m;i++) cin>>data[i][0]>>data[i][1]>>data[i][2];
        
        sort(data.begin(),data.end());
        
        set<long long> inf;
        inf.insert(1);
        
        for(int i=0;i<m;i++){
            if(inf.find(data[i][1]) != inf.end() ){
                inf.insert(data[i][2]);
            }
        }
        cout<<inf.size()<<endl;
    }
    
    return 0;
}

Measured memory_bytes: 3188
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define INF 1e9;
using namespace std;
using ll = long long;
int main() {
    int n , m;
    cin >> n >> m;
    vector<int> a(n), b(n), c(m), d(m);
    for(int i = 0; i < n; i++){
        cin >> a[i] >> b[i];
    }   
    for(int i = 0; i < m; i++) {
        cin >> c[i] >> d[i];
    }
 
    for(int i = 0; i < n; i++){
        int MIN = 1001001001;
        int ans = -1;
        for(int j = 0; j < m; j++){
            if(abs(a[i] - c[j]) + abs(b[i] - d[j]) < MIN){
                MIN = abs(a[i] - c[j]) + abs(b[i] - d[j]);
                ans = j;
            }
        }
        cout << ans + 1 << endl;
    }
    return 0;
}

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

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    
    int c[3][3] = {{0}};
    int a[3] = {0}, b[3] = {0};

    for(int i = 0; i < 3; ++i){

        for(int j = 0; j < 3; ++j){
            cin >> c[i][j];

            if(i == 0) b[j] = c[i][j];
            if(i == 1 and j == 0) a[i] = c[i][j] - b[j];
            if(i == 2 and j == 0) a[i] = c[i][j] - b[j];

        }
    }

    bool flg = true;

    for(int i = 0; i < 3; ++i){

        for(int j = 0; j < 3; ++j){

            if(c[i][j] == a[i] + b[j]) flg = flg and true;
            else flg = false;
        }
    }

    // for(int i = 0; i < 3; ++i) cout << a[i];
    // cout << endl;
    // for(int i = 0; i < 3; ++i) cout << b[i];
    // cout << endl;


    if(flg) cout << "Yes" << endl;
    else cout << "No" << endl;


}

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

int main(){
  string s;
  cin >> s;
  ll n=s.size();
  ll coA=0;
  ll ans=0;
  for(ll i=0;i<n;++i){
    if(s[i]=='A'){
      coA++;
    }else if(s[i]=='B' && s[i+1]=='C'){
      ans+=coA;
    }else if(i>0 && s[i-1]=='B' && s[i]=='C'){
      continue;
    }else{
      coA=0;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <iomanip>
#include <queue>
#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
using namespace std;
typedef long long ll;

int N,K;
string S; 

int main(){
    cin>>N>>K>>S;

    S[K-1]=S[K-1]+32;

    cout<<S<<endl;
}

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

int main() {
  int N;
  cin >> N;
  int N2=N,i=0;
  for(; N>0; N/=10)
    i+=N%10;
  if(N2%i==0)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}

Measured memory_bytes: 256
import std.algorithm, std.conv, std.range, std.stdio, std.string;

const mod = 10 ^^ 9 + 7;
alias mint = FactorRing!(mod, true);

void main()
{
  auto n = readln.chomp.to!long;
  auto m = n.bsr+1;
  auto dp = new mint[][](m+1, 3);
  dp[0][0] = 1;

  foreach (i; 0..m) {
    if (n.bitTest(m-i-1)) {
      dp[i+1][0] = dp[i][0];
      dp[i+1][1] = dp[i][0] + dp[i][1];
      dp[i+1][2] = dp[i][1] * 2 + dp[i][2] * 3;
    } else {
      dp[i+1][0] = dp[i][0] + dp[i][1];
      dp[i+1][1] = dp[i][1];
      dp[i+1][2] = dp[i][1] + dp[i][2] * 3;
    }
  }

  writeln(dp[$-1].sum);
}

pragma(inline) {
  pure bool bitTest(T)(T n, size_t i) { return (n & (T(1) << i)) != 0; }
  pure T bitSet(T)(T n, size_t i) { return n | (T(1) << i); }
  pure T bitReset(T)(T n, size_t i) { return n & ~(T(1) << i); }
  pure T bitComp(T)(T n, size_t i) { return n ^ (T(1) << i); }

  import core.bitop;
  pure int bsf(T)(T n) { return core.bitop.bsf(ulong(n)); }
  pure int bsr(T)(T n) { return core.bitop.bsr(ulong(n)); }
  pure int popcnt(T)(T n) { return core.bitop.popcnt(ulong(n)); }
}

struct FactorRing(int m, bool pos = false)
{
  version(BigEndian) {
    union { long vl; struct { int vi2; int vi; } }
  } else {
    union { long vl; int vi; }
  }

  @property int toInt() { return vi; }
  alias toInt this;

  this(int v) { vi = v; }
  this(int v, bool runMod) { vi = runMod ? mod(v) : v; }
  this(long v) { vi = mod(v); }

  ref FactorRing!(m, pos) opAssign(int v) { vi = v; return this; }

  pure auto mod(int v) const
  {
    static if (pos) return v % m;
    else return (v % m + m) % m;
  }

  pure auto mod(long v) const
  {
    static if (pos) return cast(int)(v % m);
    else return cast(int)((v % m + m) % m);
  }

  static if (m < int.max / 2) {
    pure auto opBinary(string op: "+")(int rhs) const { return FactorRing!(m, pos)(mod(vi + rhs)); }
    pure auto opBinary(string op: "-")(int rhs) const { return FactorRing!(m, pos)(mod(vi - rhs)); }
  } else {
    pure auto opBinary(string op: "+")(int rhs) const { return FactorRing!(m, pos)(mod(vl + rhs)); }
    pure auto opBinary(string op: "-")(int rhs) const { return FactorRing!(m, pos)(mod(vl - rhs)); }
  }
  pure auto opBinary(string op: "*")(int rhs) const { return FactorRing!(m, pos)(mod(vl * rhs)); }

  pure auto opBinary(string op)(FactorRing!(m, pos) rhs) const
    if (op == "+" || op == "-" || op == "*") { return opBinary!op(rhs.vi); }

  static if (m < int.max / 2) {
    auto opOpAssign(string op: "+")(int rhs) { vi = mod(vi + rhs); }
    auto opOpAssign(string op: "-")(int rhs) { vi = mod(vi - rhs); }
  } else {
    auto opOpAssign(string op: "+")(int rhs) { vi = mod(vl + rhs); }
    auto opOpAssign(string op: "-")(int rhs) { vi = mod(vl - rhs); }
  }
  auto opOpAssign(string op: "*")(int rhs) { vi = mod(vl * rhs); }

  auto opOpAssign(string op)(FactorRing!(m, pos) rhs)
    if (op == "+" || op == "-" || op == "*") { return opOpAssign!op(rhs.vi); }
}


Measured memory_bytes: 256
#include<iostream>
#include<cmath>
using namespace std;
int main(){
    long long a[100001],n,x,ans=0;
    cin>>n>>x;
    for(long long i=1;i<=n;i++){
    	cin>>a[i];
	}
	if(a[1]>x){
		ans+=a[1]-x;
		a[1]=x;
	}
	for(long long i=1;i<=n;i++){
		if(a[i]+a[i-1]>x){
			ans+=a[i]+a[i-1]-x;
			a[i]=x-a[i-1];
		}
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 1024
#include <stdio.h>
#define NIL -1
 
struct Node{
  int parent;
  int left;
  int right;
};
struct Node T[25];
 
void Preorder(int);
void Inorder(int);
void Postorder(int);
 
int main()
{
  int n, i, j, id, left, right, root;
 
 
  scanf("%d",&n);
  for( i=0 ; i<n ; i++ ){
    T[i].parent = NIL;
  }
 
  for( i=0 ; i<n ; i++ ){
    scanf("%d %d %d",&id,&left,&right);
    T[id].left = left;
    T[id].right = right;
    if(left!=NIL)
      T[left].parent = id;
    if(right!=NIL)
      T[right].parent = id;
  }
 
  for( i=0 ; i<n ; i++ ){
    if(T[i].parent==NIL) 
      root = i;
  }
 
   
 
  printf("Preorder\n");
  Preorder(root);
  printf("\n");
 
  printf("Inorder\n");
  Inorder(root);
  printf("\n");
 
  printf("Postorder\n");
  Postorder(root);
  printf("\n");
 
  return 0;
}
 
void Preorder(int u)
{
  if(u==NIL) return;
  printf(" %d",u);
  Preorder(T[u].left);
  Preorder(T[u].right);
}
 
void Inorder(int u)
{
  if(u==NIL) return;
  Inorder(T[u].left);
  printf(" %d",u);
  Inorder(T[u].right);
}
 
void Postorder(int u)
{
  if(u==NIL) return;
  Postorder(T[u].left);
  Postorder(T[u].right);
  printf(" %d",u);
}

Measured memory_bytes: 616
#include<stdio.h>
int main(void)
{

  int x, y, a, n, m;

  while(scanf("%d %d", &x, &y)!=EOF){
    n=x;
    m=y;

  if(x<y){
    a=x;
    x=y;
    y=a;
  }
  while(1){

    x=x%y;
    a=x;
    x=y;
    y=a;

    if(y==0)break;

  }

  n=n/x*m;
  printf("%d %d\n", x, n);

  }

  return 0;
}

Measured memory_bytes: 596
package main

import "fmt"

func main() {
    var N, X int
    fmt.Scan(&N, &X)

	sum := 0
	minBudget := X
	for i := 0; i < N; i++ {
		var budget int
		fmt.Scan(&budget)
		sum += budget
		if budget < minBudget {
			minBudget = budget
		}
	}

	fmt.Println(N + (X - sum) / minBudget)
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = s; i < (int)(n); i++)
#define rep3(i, s, n) for (int i = s; i > (int)(n); i--)
#define all(obj) obj.begin(), obj.end()
#define db(x) cerr << #x << ":" << x << " "
#define dbl(x) cerr << #x << ":" << x << "\n"
#define dbv(vec) cerr << #vec << ":"; for (auto e : vec) cerr << e << " "; cout << "\n"
#define dbvv(vv) cerr << #vv << ":\n"; for (auto vec : vv) { for (auto e : vec) cerr << e << " "; cerr << endl; }
#define YN(f) cout << (f ? "YES" : "NO") << endl
#define Yn(f) cout << (f ? "Yes" : "No") << endl
#define yn(f) cout << (f ? "yes" : "no") << endl
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;


int main() {
	ll K; cin >> K;
	vector<long long> A(K); rep(i, K) cin >> A.at(i);
	vector<long long> min_n(K + 1), max_n(K + 1);
	min_n[K] = max_n[K] = 2;
	dbv(min_n);dbv(max_n);
	bool f = true;
	for (int i = K; i > 0; i--) {
		min_n[i - 1] = (min_n[i] + (A[i - 1] - 1)) / A[i - 1] * A[i - 1];
		max_n[i - 1] = (max_n[i]) / A[i - 1] * A[i - 1] + (A[i - 1] - 1);
		db(i); db(min_n[i-1]); dbl(max_n[i-1]);
		if (min_n[i - 1] > max_n[i - 1]) f = false;
	}
	if (f) {
		cout << min_n[0] << " " << max_n[0] << endl;
	} else {
		cout << -1 << endl;
	}
}

Measured memory_bytes: 2560
#include<bits/stdc++.h>
using namespace std;
#define M 1e9 + 7
#define C 998244353
#define pi 3.14159265359
#define loop(i,a,b) for(ll i = ll(a); i < ll(b); ++i)
#define rloop(i,a,b) for(ll i = ll(a); i >= ll(b); --i)
#define sloop(i,a) for (std::set<ll>::iterator i = a.begin(); i != a.end(); ++i)
#define pb push_back
typedef long long int ll;
typedef unsigned long long int ull;

vector<ll>edges[1005];
bool visited[1005];
vector<ll> nodes;
ll ans=0;
void dfs(ll m){
    ans++;
    visited[m] = true;
    for (std::vector<ll>::iterator i = edges[m].begin(); i != edges[m].end(); ++i)
    {
        if(!visited[*i]){
            dfs(*i);
        }
    }

}
void solve(){
    double n,a,b,h,m;
    cin >> a>>b>>h>>m;
    double angle;
    angle = abs((h+m/60)*30 - 6*m);
    if(angle>180){
        angle = 360-angle;
    }
    // cout << angle << "\n";
    angle *=(pi/180);
    double c = sqrt(a*a+b*b - 2*a*b*cos(angle));
    // cout << angle << "\n";
    printf("%.9f\n",c );

}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll t = 1;
    // cin >> t;
    loop(f,0,t){    
        solve();
    }   
}

Measured memory_bytes: 4220
#include<cstdio>
#include<cctype>
#include<iostream>
#include<cstring>
using namespace std;
int main(){
    int a,h;
    string s,t;
    while(1){
        cin>>s>>a;
        if(s[0]=='-') break;
        for(int i=0;i<a;i++){
            cin>>h;
            t=s.substr(0,h);
            s=s.erase(0,h);
            s=s+t;
            t.clear();
        }
        cout<<s<<endl;
    }
}


Measured memory_bytes: 3192
n = gets.chomp.to_i
list = gets.chomp.split(' ').map(&:to_i)

def bubble_sort(list)
  flag = 1
  cnt = 0
  while flag == 1
    flag = 0
    (1..(list.length - 1)).reverse_each do |j|
      if list[j-1] > list[j]
        cnt += 1
        v1 = list[j].dup
        v2 = list[j-1].dup
        list[j] = v2
        list[j-1] = v1
        flag = 1
      end
    end
  end

  return list, cnt
end

list, cnt = bubble_sort(list)
puts list.join(' ')
puts cnt



Measured memory_bytes: 6940
#include <iostream>
#include <fstream>
#include <sstream>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>

#include <vector>
#include <cstring>
#include <queue>
#include <map>
#include <set>

#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>

using namespace std;

typedef vector<int> vi; 
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef long long ll;
#define sz(a) int((a).size()) 
#define pb push_back 
#define all(c) (c).begin(),(c).end() 
#define rep(i, n) for(int i = 0; i < n; ++i) 
#define foreach(it, c) for(__typeof((c).begin()) it = (c).begin(); it != (c).end(); ++it) 

#define TRACE(x...) x
#define watch(x) TRACE(cout << #x" = " << x << endl)
#define watcharr(i, x) TRACE(cout << #x" = "); rep(i, sz(x)) cout << x[i] << " "; cout << endl

int main() {
	
	ifstream infile("input.in");
	if(infile.good()) cin.rdbuf(infile.rdbuf());
	
    string S;
    cin >> S;

    if(S == "ABC") cout << "ARC" << endl;
    else cout << "ABC" << endl;

	if(infile.good()) infile.close();
	return 0;
	
}



Measured memory_bytes: 3580
#include <stdio.h>
#include <stdlib.h>

struct cell{
	struct cell *next[30];
	int e;
};

int main(void){
	int n,i,s,c,changed,j;
	
	struct cell head;
	struct cell *p;
	
	for(i=0;i<30;i++)
	 head.next[i]=NULL;
	head.e=0;
	
	s=0;
	
	scanf("%d",&n);
	getchar();
	for(i=0;i<n;i++){
	 p=&head;
		changed=0;
	 while((c = getchar()) != '\n'){
	 	if(p->next[c-'a']==NULL){
	 		changed=1;
	 		p->next[c-'a']=(struct cell *)malloc(sizeof(struct cell));
	 		p=p->next[c-'a'];
	 		for(j=0;j<30;j++)
	 		p->next[j]=NULL;
	 		p->e=0;
	 		//printf("m");
	 	}
	 	else{
	 	 p=p->next[c-'a'];
	 		//printf("else");
	 	}
	 }
		if(p->e == 0){p->e=1; changed=1;}
	 s+=changed;
	}
	
	printf("%d\n",s);
	
	return 0;
}

Measured memory_bytes: 344320
#include <iostream>
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <cmath>
#define rep(i,cc,n) for(int i=cc;i<=n;++i)
#define drep(i,cc,n) for(int i=cc;i>=n;--i)
typedef long long ll;
using namespace std;
int main(){
    int n;
    cin>>n;
    ll l[n],r[n];
    rep(i,0,n-1){
        cin>>l[i]>>r[i];
    }
    ll ans=0;
    rep(i,0,n-1){
        ans += (r[i] - l[i] + 1);
    }
    cout<<ans<<endl;
    return 0;
}

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

#define MAX_H 500000

void maxHeapify (int *,int);
void buildMaxHeap (int *);
int left (int i){ return i * 2; }
int right (int i){ return i * 2 + 1; }
int h;

int main (void)
{
  int *a,i;

  if (h <= MAX_H)
    scanf ("%d",&h);

  a = malloc(sizeof(int) * h);

  for (i = 1 ; i < h+1 ; i++)
    scanf ("%d",&a[i]);

  buildMaxHeap(a);

  for (i = 1 ; i < h+1 ; i++){
    printf (" %d",a[i]);
  }
  printf ("\n");

  return 0;
}

void maxHeapify (int *a,int i)
{
  int l,r,largest,x;

  l = left(i);
  r = right(i);

  //左の子、自分、右の子で値が最大のnodeを選ぶ
  if (l <= h && a[l] > a[i])
    largest = l;
  else
    largest = i;
  if (r <= h && a[r] > a[largest])
    largest = r;

  if (largest != i){
    //exchange
    x = a[i];
    a[i] = a[largest];
    a[largest] = x;

    maxHeapify(a,largest);
  }

  return;
}

void buildMaxHeap (int *a)
{
  int i;

  for (i = h / 2 ; i >= 1 ; i--)
    maxHeapify(a,i);

  return;
}

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

namespace Algorithm
{
    class Program
    {
        static void Main(string[] args)
        {
            var HW = Console.ReadLine().Split().Select(int.Parse).ToArray();
            var map = new char[HW[0]][];
            var x = new int[] { 1, 0, -1, 0, 1, -1, -1, 1 };
            var y = new int[] { 0, 1, 0, -1, 1, 1, -1, -1 };

            for (var i = 0; i < HW[0]; i++)
            {
                map[i] = Console.ReadLine().ToCharArray();
            }

            for (var i = 0; i < HW[0]; i++)
            {
                for (var j = 0; j < HW[1]; j++)
                {
                    if (map[i][j] == '#') continue;
                    var count = 0;

                    for (var d = 0; d < 8; d++)
                    {
                        var ni = i + y[d];
                        var nj = j + x[d];

                        if (ni < 0 || HW[0] <= ni) continue;
                        if (nj < 0 || HW[1] <= nj) continue;
                        if (map[ni][nj] == '#') count++;
                    }

                    map[i][j] = (char)(count + '0');
                }
            }

            for (var i = 0; i < HW[0]; i++)
            {
                Console.WriteLine(new string(map[i]));
            }
        }
    }
}


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

int main(){
	int *a, *b;
	int n, m;
	cin >> n >> m;
	a = new int[n * m];
	b = new int[m];
	for(int i = 0; i < n; ++i) {
		for(int j = 0; j < m; ++j) {
			cin >> a[m * i + j];
		}
	}
	for(int j = 0; j < m; ++j) {
		cin >> b[j];
	}

	for(int i = 0; i < n; ++i) {
		int ci = 0;
		for(int j = 0; j < m; ++j) {
			ci += a[m * i + j] * b[j];
		}
		cout << ci << endl;
	}
	
	delete[] a;
	delete[] b;
	return 0;
}

Measured memory_bytes: 3120
#include <bits/stdc++.h>
using namespace std;using ll=long long;using uint=unsigned int;using pii=pair<int,int>;using pll=pair<ll,ll>;using ull = unsigned long long;using ld=long double;template<typename T>void _(const char*s,T h){cerr<<s<<" = "<<h<<"\n";}template<typename T,typename...Ts>void _(const char*s,T h,Ts...t){int b=0;while(((b+=*s=='(')-=*s==')')!=0||*s!=',')cerr<<*s++;cerr<<" = "<<h<<",";_(s+1,t...);}// break continue pop_back 998244353
#define int ll
#define pii pll
#define f first
#define s second
#define pb emplace_back
#define forn(i,n) for(int i=0;i<(n);++i)
#define sz(a)((int)(a).size())
#define sqr(x) ((x)*(x))
struct init{init(){cin.tie(0);iostream::sync_with_stdio(0);cout<<fixed<<setprecision(10);cerr<<fixed<<setprecision(5);}~init(){
#ifdef LOCAL
#define dbg(...) _(#__VA_ARGS__,__VA_ARGS__)
cerr<<"Time elapsed: "<<(double)clock()/CLOCKS_PER_SEC<<"s.\n";
#else
#define dbg(...) 
#endif
}}init;template<typename T,typename U>void upx(T&x,U y){if(x<y)x=y;}template<typename T,typename U>void upn(T&x,U y){if(x>y)x=y;}mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());const int D=4,dx[]={+1,0,-1,0},dy[]={0,+1,0,-1};

int32_t main(){

    int h1,m1,h2,m2,k;
    cin>>h1>>m1>>h2>>m2>>k;
    int a=h1*60+m1;    
    int b=h2*60+m2;    
    cout<<(b-a-k)<<'\n';

    return 0;
}


Measured memory_bytes: 3592
#include "bits/stdc++.h"
#define int long long
#define range(i, a, b) for(auto i = a; i < b; i++)
#define rep(i, a) range(i, 0, a)
#define all(a) (a).begin(),(a).end()
using namespace std;
const int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
const int MOD = 1000000007;
const long double EPS = 1e-8;
using vi = vector <int>;
using vvi = vector <vi>;

signed main() {
	int h, w, n;
	cin >> h >> w >> n;
	map <pair <int, int>, int> mp;
	set <pair <int, int>> st;
	rep (i, n) {
		int x, y;
		cin >> x >> y;
		mp[make_pair(x, y)] = 1;
		range (j, -1, 2) {
			range (k, -1, 2) {
				if(x + j <= 0 || h < x + j || y + k <= 0 || w < y + k) continue;
				bool flag = true;
				range (l, -1, 2) {
					range (m, -1, 2) {
						if(x + j + l <= 0 || h < x + j + l || y + k + m <= 0 || w < y + k + m) {
							flag = false;
						}
					}
				}
				if (flag) {
					st.insert({x + j, y + k});
				}
			}
		}
	}
	int cnt[10] = {};
	int amari = 0;
	for (auto itr = st.begin(); itr != st.end(); itr++) {
		int sum = 0;
		pair <int, int> now = *itr;
		for (int i = -1; i < 2; i++) {
			for (int j = -1; j < 2; j++) {
				pair <int, int> koko = now;
				koko.first += i;
				koko.second += j;
				sum += mp[koko];
			}
		}
		cnt[sum]++;
		amari++;
	}
	cout << (h - 2) * (w - 2) - amari << endl;
	range (i, 1, 10) {
		cout << cnt[i] << endl;
	}


}


Measured memory_bytes: 212736
#include <bits/stdc++.h>
#define FOR(i,k,n)  for(int i = (k);i < (n);++i)
#define REP(i,n)    FOR(i,0,n)
#define ALL(x)      begin(x),end(x)

using namespace std;
using vecint = vector<int>;
using ll = int64_t;

int main()
{
  int n;
  cin>>n;
  bool zero=false;
  bool pos=false;
  bool neg=false;
  int sum=0;
  int mn=10000;
  int mni=0;
  vecint vp,vz,vn,v;
  REP(i,n) {
    int a;
    cin>>a;
    v.push_back(a);
    if(a<0) {
      neg=true;
      vn.push_back(a);
    } else if (a>0) {
      pos=true;
      vp.push_back(a);
    } else {
      zero=true;
      vz.push_back(a);
    }
    sum+=abs(a);
    if (abs(a) < mn) {
      mn=abs(a);
      mni=i;
    }
  }
  if ((zero+pos+neg)>1) {
    cout << sum << endl;
    if(!pos) {
      vp.insert(end(vp),ALL(vz));
    } else if (!neg) {
      vn.insert(end(vn),ALL(vz));
    } else {
      vp.insert(end(vp),ALL(vz));
    }
    while(vn.size()>1) {
      int an = vn.back();
      vn.pop_back();
      int ap = vp.back();
      vp.pop_back();
      cout<<ap<<' '<<an<<endl;
      vp.push_back(ap-an);
    }
    int old=vn[0];
    REP(i,vp.size()-1){
      cout<<old<<' '<<vp[i]<<endl;
      old=old-vp[i];
    }
    cout<<vp.back()<<' '<<old<<endl;
  } else if (n > 2) {
    cout << (sum-2*mn) << endl;
    vecint ind;
    REP(i,n) {
      if(i==mni) continue;
      ind.push_back(i);
    }
    cout<<v[mni]<<' '<<v[ind[0]]<<endl;
    int old=v[mni]-v[ind[0]];
    FOR(i,1,n-2) {
      cout<<old<<' '<<v[ind[i]]<<endl;
      old = old-v[ind[i]];
    }
    if (pos) {
      cout<<v[ind.back()]<<' '<<old<<endl;
    } else {
      cout<<old<<' '<<v[ind.back()]<<endl;
    }
  } else {
    cout << (sum-2*mn) << endl;
    int ind = 1-mni;
    if (pos) {
      cout<<v[ind]<<' '<<v[mni]<<endl;
    } else {
      cout<<v[mni]<<' '<<v[ind]<<endl;
    }
  }
  return 0;
}


Measured memory_bytes: 3060
#include<iostream>
#include<string>
#include<vector>

using namespace std;

int main() {
	int A, B;
	int cnt=1;

	cin >> A >> B;
	int totalplg = A;
	//B=1の時
	if (B == 1) {
		cnt = 0;
		cout << cnt << endl;
	}

	else {
		while (totalplg < B) {
			totalplg += (A - 1);
			cnt++;
		}
		cout << cnt << endl;
	}
	

	
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int num[101];
int main()
{
    int n,temp,i,j;
    scanf("%d",&n);
    for(int i=0; i<n; i++)
        scanf("%d",&num[i]);
    for( i=0; i<n; i++)
    {
        temp=num[i];
        for( j=i-1; j>=0&&num[j]>=temp; j--)
            num[j+1]=num[j];
        num[j+1]=temp;
        for(j=0; j<n; j++)
            if(j==0) printf("%d",num[j]);
           else  printf(" %d",num[j]);
        printf("\n");
    }
    return 0;
}




Measured memory_bytes: 3212
using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using System.Runtime.CompilerServices;
using static MyUtil;

class MyUtil
{
    public static int[] ReadIntArray()
    {
	return ReadLine().Split().Select(x => int.Parse(x)).ToArray();
    }
    public static bool ChMax<T>(ref T a, T b) where T : IComparable
    {
	if (a.CompareTo(b) < 0)
	{
	    a = b;
	    return true;
	}
	return false;
    }
}

class Program
{
    public static void Main()
    {
	var tmp = ReadIntArray();
	int n = tmp[0], t = tmp[1];

	var d = new Tuple<long, long>[n];
	for (int i = 0; i < n; i++)
	{
	    tmp = ReadIntArray();
	    long a = tmp[0], b = tmp[1];
	    d[i] = Tuple.Create(a, b);
	}

	Array.Sort(d);

	long[,] dp = new long[n+1, 3000+3000];
	long ans = 0;
	
	for (int i = 1; i <= n; i++)
	{
	    var tpl = d[i-1];
	    long a = tpl.Item1, b = tpl.Item2;
	    for (int tm = t-1; 0 <= tm ; tm--)
	    {
		ChMax(ref dp[i, tm], dp[i-1, tm]);
		ans = Math.Max(ans, dp[i, tm] + b);
		ChMax(ref dp[i, tm+a], dp[i-1,tm]+b);
	    }
	}

	WriteLine(ans);
    }
}

Measured memory_bytes: 157500
//#define _GLIBCXX_DEBUG
#include <iostream>
#include <bits/stdc++.h>
    
    
using namespace std;
#define ll long long
#define ld long double
#define  P pair<ll,ll>
#define FOR(i,n,m) for(ll i=n; i<(ll)m;i++)
#define FORr(i,m,n) for(ll i=n; i>=(ll)m; i--)
#define FORm(i,m) for(auto i=m.begin();i!=m.end();i++)
#define sortAl(v) sort(v.begin(),v.end())
#define sortAlr(v) sort(v.begin(),v.end()); reverse(v.begin(),v.end())
#define cout(n) cout<<fixed<<setprecision(n)
#define dout(n) cout<<# n<<" = "<<n<<endl;
    
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin>>s;
    if(s == "AAA" || s == "BBB")cout<<"No"<<endl;
    else cout<<"Yes"<<endl;
}

Measured memory_bytes: 764
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        C solver = new C();
        solver.solve(1, in, out);
        out.close();
    }

    static class C {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            // 入力
            int L = Integer.parseInt(in.next());
            double o = 0.000000;
            double w = 0.000000;
            double h = 0.000000;

            o = (double) L / 3.000000;
            w = (double) L / 3.000000;
            h = L - o - w;
            double ans = o * w * h;

            // 出力
            out.printf("%.12f%n", ans);

        }

    }
}



Measured memory_bytes: 22100
def good_sequence(N: int, A: list) -> int:
    freq = {}
    for a in A:
        freq.setdefault(a, 0)
        freq[a] += 1

    return sum(f if f < n else f - n for n, f in freq.items())


if __name__ == "__main__":
    N = int(input())
    A = list(map(int, input().split()))
    ans = good_sequence(N, A)
    print(ans)


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

int main(){
	char chp[80];
	int i;
	
	while(fgets(chp, 80, stdin) != NULL){
	    while(strstr(chp, "the")  == NULL
	       && strstr(chp, "this") == NULL
	       && strstr(chp, "that") == NULL)
	        for(i = 0; i < 80; i++)
	            if(chp[i] > 96 && chp[i] < 123)
	                if(++chp[i] > 122) chp[i] -= 26;
	    
	    printf("%s", chp);
	}
	
	return 0;
}

Measured memory_bytes: 524
S = []
for i in range(1,100):
	for j in range(i+1,151):
		S.append([i,j])
S = sorted(S, key = lambda x:x[0]**2 + x[1]**2)
while 1:
	h,w = map(int,raw_input().split())
	if h == 0: break
	hi,wi = S[S.index([h,w])+1]
	print hi,wi

Measured memory_bytes: 5784
#include <set>
#include <map>
#include <cstdio>
#include <cctype>
#include <vector>
#include <algorithm>
//#define mp std::make_pair
#define pr std::pair<int,int>
#define pc putchar
#define gc() getchar()
typedef long long LL;
const int N=2e5+5;

int A[N],vis[N];
std::map<LL,int> mp;

inline int read()
{
	int now=0,f=1;register char c=gc();
	for(;!isdigit(c);c=='-'&&(f=-1),c=gc());
	for(;isdigit(c);now=now*10+c-'0',c=gc());
	return now*f;
}

int main()
{
	int n=read(),ans=0;
	for(int i=1; i<=n; ++i) ++mp[A[i]=read()];
	std::sort(A+1,A+1+n);
	for(int i=n; i; --i)
		if(mp[A[i]])
			for(int j=31; ~j; --j)
			{
				LL pw=1ll<<j;
				if(pw==A[i]+A[i] && mp[A[i]]>=2) {mp[A[i]]-=2, ++ans; break;}
				else if(pw!=A[i]+A[i] && pw>A[i] && mp[pw-A[i]]) {--mp[pw-A[i]], --mp[A[i]], ++ans; break;}
			}
	printf("%d\n",ans);

	return 0;
}

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

// def
#define debug(x) cout << #x << ": " << x << endl
#define out(x) cout << x << endl
#define repeat(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define revrepeat(i, a, b) for (int i = (int)(b)-1; i >= (int)(a); i--)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define revrep(i, n) for (int i = (int)(n)-1; i >= 0; i--)
#define foreach(e, v) for (auto &e : v)
#define all(x) (x).begin(), (x).end()
#define CYES cout << "Yes" << endl
#define CNO cout << "No" << endl
#define SPC(x) cout << fixed << setprecision(x)
#define ZERO(a) memset(a, 0, sizeof(a))
#define MINUS(a) memset(a, 0xff, sizeof(a))

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vector<int>> vii;
typedef vector<ll> vl;
typedef vector<vector<ll>> vll;
typedef pair<int, int> P;
constexpr int MOD = 1e9 + 7;
constexpr int INF = __INT_MAX__;               // 2^31 - 1
constexpr long long INFLL = __LONG_LONG_MAX__; // 2^61 - 1
constexpr int MAX_N = 1e5 + 5;
constexpr double PI = acos(-1);

struct mint {
    // Preparation: MOD is already defined.
    ll value;

    mint(ll value = 0) : value((value % MOD + MOD) % MOD) {}

    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t >> 1);
        a *= a;
        if (t & 1) a *= *this;
        return a;
    }

    mint pow(mint m) const {
        return pow(m.value);
    }

    mint inv() const {
        ll a = value, b = MOD, u = 1, v = 0;
        while (b) {
            ll t = a / b;
            a -= t * b;
            swap(a, b);
            u -= t * v;
            swap(u, v);
        }
        u %= MOD;
        return u;
    }

    mint &operator+=(const mint a) {
        if ((value += a.value) >= MOD) value -= MOD;
        return *this;
    }
    mint &operator-=(const mint a) {
        if ((value += MOD - a.value) >= MOD) value -= MOD;
        return *this;
    }
    mint &operator*=(const mint a) {
        (value *= a.value) %= MOD;
        return *this;
    }
    mint &operator/=(const mint a) {
        return (*this) *= a.inv();
    }

    mint operator+(const mint a) const {
        mint res(*this);
        return res += a;
    }
    mint operator-(const mint a) const {
        mint res(*this);
        return res -= a;
    }
    mint operator*(const mint a) const {
        mint res(*this);
        return res *= a;
    }
    mint operator/(const mint a) const {
        mint res(*this);
        return res /= a;
    }
};

int main() {
    int n;
    string s;
    cin >> n >> s;
    vi a(n);
    bool one_rock = false;
    int ans;
    rep(i, n) {
        a[i] = s[i] - '0';
        a[i]--;
        if (a[i] == 1)
            one_rock = true;
    }

    if (!one_rock) {
        rep(i, n) {
            a[i] /= 2;
        }
    }

    int mod_sum = 0;
    rep(i, n) {
        if (a[i] == 1)
            mod_sum += (((n - 1) & i) == i);
    }
    if (mod_sum % 2 == 0) {
        ans = 0;
    } else {
        if (!one_rock) {
            ans = 2;
        } else {
            ans = 1;
        }
    }

    out(ans);
}


Measured memory_bytes: 5252
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
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;
}
using ll = long long;
const ll MOD = 1e9 + 7;
const long long INF = 1LL << 60;

int main()
{
    ll a, b, k;
    cin >> a >> b >> k;

    if(a>=k){
        cout << a - k << " " << b << endl;
    }else if(a+b>=k){
        cout << 0 << " " << b+a-k << endl;
    }else{
        cout << 0 << " " << 0 << endl;
    }
}

Measured memory_bytes: 256
#include <algorithm>
#include <fstream>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <vector>

#include <cmath>
#include <climits>
#include <queue>

using namespace std;


int main() {
    int n;
    int m;
    cin >> n; cin >> m;
    vector<pair<int, int> >inputs(m);
    vector<int> vec[n + 1];
    map<int, int> mp[n + 1];

    for(int i =0; i < m; ++i){
        int p; cin >> p;
        int y; cin >> y;
        inputs[i] = {p, y};
        vec[p].push_back(y);
    }

    for(int i = 1; i < n+1; ++i){
        sort(vec[i].begin(), vec[i].end());
        for(int j = 0; j < vec[i].size(); ++j){
            mp[i][vec[i][j]] = j;
        }
    }

    for(int i =0; i < m; ++i){
        int p = inputs[i].first;
        int y = inputs[i].second;
        int index = mp[p][y];
        printf("%06d%06d\n", p ,index + 1);
    }
    return 0;
}

Measured memory_bytes: 17152
#include <bits/stdc++.h> //C++の標準ライブラリを一行で一括でインクルードする
#include <math.h> //数学関数と数学定数を利用する
#define rep(i,n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
template<class T> void chmax(T &a,T b) { if (a<b) a=b;}
template<class T> void chmin(T &a,T b) { if (a>b) a=b;}

int main(){
  string s;
  cin >> s;
  
  string ans;
  
  rep(i,s.size()){
    if(s[i]=='0'){
      ans += '0';
    }else if(s[i] == '1'){
      ans += '1';
    }else{
      if(ans.size() > 0){
        ans.pop_back();
      }
    }
  }
  cout << ans;
  return 0;
}

Measured memory_bytes: 256
n=int(input())
s=input()
t=input()
if(s[0]==t[0]):
    ans=3
    l=1
    i=1
else:
    ans=6
    l=2
    i=2
while i<n:
    if(s[i]==t[i]):
        if(l==2):
            i+=1
            l=1
        else:
            ans*=2
            i+=1
    else:
        if(l==1):
            ans*=2
            i+=2
            l=2
        else:
            ans*=3
            i+=2
print(ans%1000000007)

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

const ll mod = 998244353;

int dis[100000 + 10];

ll ksm(ll a, ll b)
{
	ll ans = 1;
	while( b )
	{
		if(b & 1) ans = ans * a % mod;
		b >>= 1;
		a = a * a % mod;
	}
	return ans;
}

int main()
{
	ll n;
	cin>>n;
	ll x;
	ll maxn=0;
	dis[0]=1;
	cin>>x;
	ll flag=0;
	if(x != 0)
	{
		flag = 1;
	}
//	printf("YES");
	for(ll i=1; i<n; i++)
	{
		cin>>x;
		if(x == 0) flag = 1;
		maxn=max(maxn, x);
		dis[x]++;
	}
//	printf("NO");	
//	cout<<maxn<<endl;
	if(flag)
	{
		printf("0");
	}
	else
	{
		ll ans=1;
		for(ll i=1; i <= maxn; i++)
		{
			if(dis[i] == 0)
			{
				printf("0");
				return 0;
			}
			ans=ans*ksm(dis[i-1], dis[i])%mod;
		}
		cout<<ans;
	}	
//	printf("YEs");
	return 0;
}

Measured memory_bytes: 640