akhauriyash/Code-Regression huggingface dataset:
import java.util.*;
import static java.lang.Math.*;
import static java.util.Arrays.*;

public class Main {

	int INF = 1 << 28;
	int h, w, s;
	int map[][];
	int all;
	Pair mem[][][][];
	
	void run() {
		Scanner sc = new Scanner(System.in);
		for(;;) {
			h = sc.nextInt();
			w = sc.nextInt();
			s = sc.nextInt();
			if((h|w|s) == 0) break;
			map = new int[h+1][w+1];
			for(int i=1;i<=h;i++) for(int j=1;j<=w;j++) {
				map[i][j] = sc.nextInt() + map[i-1][j] + map[i][j-1] - map[i-1][j-1];
			}
			mem = new Pair[w][h][w+1][h+1];
			for(Pair[][][] a: mem) for(Pair[][] b: a) for(Pair[] c: b) fill(c, new Pair(-1, 0));
			all = demand(0,0,w,h);
//			for(int[] a: map) debug(a);
//			debug(all);
			Pair p = solve(0,0,w,h);
			System.out.println(p.s + " " + (s-p.f));
		}
	}
	
	Pair solve(int x1, int y1, int x2, int y2) {
		if(mem[x1][y1][x2][y2].f != -1) return mem[x1][y1][x2][y2];
		int ss = all - demand( x1, y1, x2, y2 );
		Pair p;
		if( ss > s ) {
			p = new Pair(-2, 0);
		}
		else p = new Pair(ss, 1);
//		debug(x1, y1, x2, y2, p.f, p.s, demand(x1, y1, x2, y2));
		for(int i=x1+1;i<x2;i++) {
			Pair p1 = solve(x1, y1, i, y2);
			Pair p2 = solve(i, y1, x2, y2);
			if( p1.f == -2 || p2.f == -2 ) continue;
			if( p.s < p1.s + p2.s ){
				p.f = max(p1.f, p2.f);
				p.s = p1.s + p2.s;
			}
			else if (p.s == p1.s + p2.s && max(p1.f, p2.f) < p.f)
				p.f = max(p1.f, p2.f);
		}
		
		for(int i=y1+1;i<y2;i++) {
			Pair p1 = solve(x1, y1, x2, i);
			Pair p2 = solve(x1, i, x2, y2);
			if( p1.f == -2 || p2.f == -2 ) continue;
			if( p.s < p1.s + p2.s ){
				p.f = max(p1.f, p2.f);
				p.s = p1.s + p2.s;
			} 
			else if (p.s == p1.s + p2.s && max(p1.f, p2.f) < p.f)
				p.f = max(p1.f, p2.f);
		}
		
//		debug("  ", x1, y1, x2, y2, p.f, p.s);
		return mem[x1][y1][x2][y2] = p;
	}
	
	int demand(int x1, int y1, int x2, int y2) {
		return map[y2][x2] - map[y2][x1] - map[y1][x2] + map[y1][x1];
	}
	
	class Pair {
		int f, s;
		Pair(int f, int s) {
			this.f = f;
			this.s = s;
		}
	}

	public static void main(String[] args) {
		new Main().run();
	}

	void debug(Object... os) {
		System.err.println(Arrays.deepToString(os));
	}
}

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


signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(20);
    
    int n;
    cin>>n;
    ll a[n];
    map<ll,ll> mp;
    for(int i=0;i<n;i++){
        cin>>a[i];
        mp[a[i]]++;
    }
    sort(a,a+n,greater<ll>());
    int ans =0;
    for(int i=0;i<n;i++){
        ll p=2;
        if(mp[a[i]]==0) continue;
        while(p<2e9+3){
            if(p-a[i]>=1){
                if(p-a[i]==a[i]){
                    ans += mp[a[i]]/2;
                    break;
                }
                ans += min(mp[a[i]],mp[p-a[i]]);
                mp[p-a[i]] -= min(mp[a[i]],mp[p-a[i]]);
                break;
            }
            p*=2;
        }
        mp[a[i]] = 0;
    }
    cout << ans << endl;
}

Measured memory_bytes: 26752
#pragma GCC optimize("O3")
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using P = pair<ll,ll>;
using um = unordered_map<ll,ll>;
#define fl cout<<flush;
#define endl '\n'
template <typename T> inline void prt(T v){cout<<v<<'\n';}
template <typename T> inline bool chmax(T &a, const T &b){if (a<b){a=b;return 1;}return 0;}
template <typename T> inline bool chmin(T &a, const T &b){if (a>b){a=b;return 1;}return 0;}
const ll INF=1LL<<60;
const ll MOD=1e9+7;
const ll MOD2=998244353;
const ld pi=3.14159265358979323846;
const ld eps=1e-10;

#define debug(v) cout<<#v<<": ",prt(v);
template <typename A,typename B>
inline void prt(pair<A,B> p){cout<<"("<<p.first<<", "<<p.second<<")\n";}
template <typename A,typename B,typename C>
inline void prt(tuple<A,B,C> p){cout<<"("<<get<0>(p)<<", "<<get<1>(p)<<", "<<get<2>(p)<<")\n";}
inline void prt(bool p){if(p)cout<<"True"<<'\n';else cout<<"False"<<'\n';}
template <typename T> 
inline void prt(vector<T> v){cout<<'{';for(ll i=0;i<v.size();i++){cout<<v[i];if(i<v.size()-1)cout<<", ";}cout<<'}'<<'\n';}
template <typename T> 
inline void prt(deque<T> v){cout<<'{';for(ll i=0;i<v.size();i++){cout<<v[i];if(i<v.size()-1)cout<<", ";}cout<<'}'<<'\n';}
template <typename A,typename B>
inline void prt(map<A,B> v){cout<<'{';ll c=0;for(auto &p: v){cout<<p.first<<":"<<p.second;c++;if(c!=v.size())cout<<", ";}cout<<'}'<<'\n';}
template <typename A,typename B>
inline void prt(unordered_map<A,B> v){cout<<'{';ll c=0;for(auto &p: v){cout<<p.first<<":"<<p.second;c++;if(c!=v.size())cout<<", ";}cout<<'}'<<'\n';}
template <typename T> 
inline void prt(set<T> v){cout<<'{';for(auto i=v.begin();i!=v.end();i++){cout<<*i;if(i!=--v.end())cout<<", ";}cout<<'}'<<'\n';}
template <typename T> 
inline void prt(multiset<T> v){cout<<'{';for(auto i=v.begin();i!=v.end();i++){cout<<*i;if(i!=--v.end())cout<<", ";}cout<<'}'<<'\n';}

signed main(void){
    cin.tie(0);cout.tie(0);ios::sync_with_stdio(false);
    ll N;
    cin >> N;
    ll M;
    cin >> M;
    string S;
    cin >> S;
    vector<ll> ans(0);
    reverse(S.begin(), S.end());
    ll now=0;
    while(now!=N){
        for(ll i=min(N,now+M);i>=now+1;--i){
            if(S[i]=='0'){
                ans.emplace_back(i-now);
                now=i;continue;
            }
            if(i==now+1){
                prt("-1");return 0;
            }
        }
    }
    reverse(ans.begin(), ans.end());
    for(auto p: ans)cout<<p<<" ";
    cout<<endl;fl

    return 0;
}



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

int main(){
  int A, B ,C;
  cin >> A >> B >> C;
  int K;
  cin >> K;


  int64_t res=0;

  if (K<=A){
    res=K;
  }
  else if(K>A && K<=(A+B)){
    res=A;
  }
  else if(K>(A+B) && K<=(A+B+C)){
    res=A-K+(A+B);
  }
  else{
    res=A-C;
  }

  cout << res << endl;

  return 0;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define sp ' '
#define nyan "(=^・ω・^=)"
#define mkp make_pair
#define intmax 2147483647
#define llmax 9223372036854775807
#define lP pair<ll,ll>
#define iP pair<int,int>
typedef long long ll;
using namespace std;
const int mod = 1000000007, mod998 = 998244353;

string O, E;

int main() {
	cin >> O >> E;
	for (int i = 0; i != O.size(); ++i) {
		cout << O[i];
		if (i != E.size())
			cout << E[i];
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;
using static System.Math;
using System.Numerics;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
            Solve();
            //Out.Flush();
            Read();
        }

        static void Solve()
        {
            var N = Sarray();
            var Ai = Sarray();
            var cnt = 0L;
            while (Ai.All(a =>  a % 2 == 0))
            {
                ++cnt;
                Ai =Ai.Select(a => a / 2).ToArray();
            }
            WriteLine(cnt);
        }

        static long Mod = (long)1e9 + 7;
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }
        static public (T1 a, T2 b) Slice<T1, T2>()
        {
            var t = ReadLine().Split();
            return (
            (T1)Convert.ChangeType(t[0], typeof(T1)),
            (T2)Convert.ChangeType(t[1], typeof(T2)));
        }
        static public (T a, T b) Slice2<T>()
        {
            var t = ReadLine().Split();
            return (
            (T)Convert.ChangeType(t[0], typeof(T)),
            (T)Convert.ChangeType(t[1], typeof(T)));
        }
        static public (T a, T b, T c) Slice3<T>()
        {
            var t = ReadLine().Split();
            return (
            (T)Convert.ChangeType(t[0], typeof(T)),
            (T)Convert.ChangeType(t[1], typeof(T)),
            (T)Convert.ChangeType(t[2], typeof(T)));
        }
    }
}

Measured memory_bytes: 28516
n = int(input())
le = [[0] * 10 for i in range(10)]
ri = [[0] * 10 for i in range(10)]
for i in range(1,n+1):
    le[int(str(i)[-1])][int(str(i)[0])] += 1
    ri[int(str(i)[0])][int(str(i)[-1])] += 1
ans = 0
for i in range(10):
    for j in range(10):
        ans += le[j][i] * ri[j][i]
print(ans)

Measured memory_bytes: 3064
import java.util.Scanner;

public class Main {
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int N = sc.nextInt();
		int Q = sc.nextInt();
		
		String S = sc.next();
		
		int[] map = new int[N];
		for (int i = 1; i < S.length(); i++) {
			if (S.charAt(i-1) == 'A' && S.charAt(i) == 'C') 
				map[i]++;
		}
		
		for (int i = 1; i < map.length; i++) {
			map[i] += map[i-1];
		}
		
		for (int i = 0; i < Q; i++) {
			int l = sc.nextInt();
			int r = sc.nextInt();
			int ans = map[r-1] - map[l-1];
			System.out.println(ans);
		}
	}
}


Measured memory_bytes: 77072
while (True):
    m, f, r = map(int, input().split())
    if (m == f == r == -1):
        break

    if (m == -1 or f == -1):
        print("F")

    elif m + f >= 80:
        print("A")

    elif m + f >= 65:
        print("B")

    elif m + f >= 50 or m+f+r >= 80:
        print("C")

    elif m+f >= 30:
        print("D")
    else:
        print("F")



Measured memory_bytes: 5592
#include<stdio.h>
#include<math.h>
int main()
{
	int n;
	int p=0;
	scanf("%d",&n);
	while(n!=0)
	{
		if(n%10==7)
		p=1;
		n=n/10;
	}
	if(p==1)
	printf("Yes");
	else
	printf("No");
	return 0;
}


Measured memory_bytes: 1708
#pragma GCC target ("avx2")
#pragma GCC optimize ("unroll-loops")
#pragma GCC optimize ("O3")
#include "bits/stdc++.h"
#include <unordered_set>
#include <unordered_map>
#include <random>
using namespace std;
typedef long long ll;
const ll MOD = 1'000'000'007LL; /*998'244'353LL;*/
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for(int (i)=0; (i)<(n); (i)++)
const int dx[4]={ 1,0,-1,0 };
const int dy[4]={ 0,1,0,-1 };

int N;
ll cnt[100001] ={};
ll sum = 0;
int Q;

signed main(){
    cin >> N;
    rep(i, N){
        ll A;
        cin >> A;
        cnt[A]++;
        sum += A;
    }
    
    cin >> Q;
    rep(i, Q){
        ll B, C;
        cin >> B >> C;
        cnt[C] += cnt[B];
        sum += (C-B)*cnt[B];
        cnt[B] = 0;
        cout << sum << endl;
    }
}

Measured memory_bytes: 4336
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define For(i,a,b) for(int i=a;i<=b;i++)
#define F first
#define S second
#define all(x) x.begin(),x.end()
#define sz(x) ((int)x.size())
#define MOD (ll)(1e9+7)
#define INF 1e17
#define int ll
#define EPS (1e-6)
using namespace std;
using ll=long long;
using pii=pair<int,int>;

int gcd(int a,int b) { return b==0?a:gcd(b,a%b); }
int lcm(int a,int b) { return a/gcd(a,b)*b; }

int fpow(int b,int p)
{
	if(p==0) return 1;
	int h=fpow(b,p/2);
	if(p%2) return h*b%MOD*h%MOD;
	return h*h%MOD;
}

int32_t main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	string s; cin>>s;
	if(s=="Sunny") cout<<"Cloudy\n";
	else if(s=="Cloudy") cout<<"Rainy\n";
	else cout<<"Sunny\n";
	return 0;
}





























Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define ll long long int
int main()
{
    ll n;
    cin>>n;
    string s;
    cin>>s;
    ll r = 0, w = 0;
    for(int i=0;i<n;i++){
        if(s[i]=='R')
            r++;
    }
    for(int i=0;i<r;i++){
        if(s[i]=='W')
            w++;
    }
    cout<<w<<endl;
    return 0;
}


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

#define forn(i, n) for (int i = 0; i < int(n); i++)
#define nfor(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define fore(i, l, r) for (int i = int(l); i < int(r); i++)
#define correct(x, y, n, m) (0 <= (x) && (x) < (n) && 0 <= (y) && (y) < (m))
#define all(a) (a).begin(), (a).end()
#define sz(a) int((a).size())
#define pb(a) push_back(a)
#define mp(x, y) make_pair((x), (y))
#define x first
#define y second

using namespace std;

typedef long long li;
typedef long double ld;
typedef pair<int, int> pti;

template<typename X> inline X abs(const X& a) { return a < 0? -a: a; }
template<typename X> inline X sqr(const X& a) { return a * a; }

template<typename A, typename B> inline ostream& operator<< (ostream& out, const pair<A, B>& p) { return out << "(" << p.x << ", " << p.y << ")"; }
template<typename T> inline ostream& operator<< (ostream& out, const vector<T>& a) { out << "["; forn(i, sz(a)) { if (i) out << ','; out << ' ' << a[i]; } return out << " ]"; }
template<typename T> inline ostream& operator<< (ostream& out, const set<T>& a) { return out << vector<T>(all(a)); }
template<typename X, typename Y> inline ostream& operator<< (ostream& out, const map<X, Y>& a) { return out << vector<pair<X, Y>>(all(a)); }
template<typename T> inline ostream& operator<< (ostream& out, const pair<T*, int>& a) { return out << vector<T>(a.x, a.x + a.y); }

inline ld gett() { return ld(clock()) / CLOCKS_PER_SEC; }

const int INF = int(1e9);
const li INF64 = li(1e18);
const ld EPS = 1e-9, PI = 3.1415926535897932384626433832795;

#ifdef SU1
//#define GEN
#ifndef GEN
#define LOG
#endif
#endif

int n;

bool read() {
  return !!(cin >> n);
}

void solve() {
  cout << n / 3 << endl;
}

int main() {
#ifdef SU1
  assert(freopen("input.txt", "rt", stdin));
  //assert(freopen("output.txt", "wt", stdout));
#endif

  cout << setprecision(10) << fixed;
  cerr << setprecision(5) << fixed;

  while (read()) {
    ld stime = gett();
    solve();
#ifdef SU1
    cerr << "Time: " << gett() - stime << endl;
#endif
    //break;
  }

  return 0;
}


Measured memory_bytes: 256
/*------------------GZ:-)------------------*/
//#pragma GCC optimize "trapv"
#include<bits/stdc++.h>
using namespace std;
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
//find_by_order(k)  returns iterator to kth element starting from 0;
//order_of_key(k) returns count of elements strictly smaller than k;
//erase,insert same as normal set

//#define      ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
#define        fast ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define        f first
#define        s second
#define        pb push_back
#define        eb emplace_back
#define        mp  make_pair
#define        forn(i,n) for(int i=0;i<n;++i)
#define        show(b) for(auto const&x: b) cout<<x<<" "
#define        sshow(b) for(auto x:b) cout<<x<<" "
#define        fix(b,val)   memset(b,val,sizeof(b))
#define        pill(b,n,v)  fill(b,b+n,v)
#define        itn          int
#define        w(t)     int t;cin>>t;while(t--)
#define        mx(a,b,c) max(a,max(b,c))
#define        mn(a,b,c) min(a,min(b,c))
#define        intmax    INT_MAX
#define        intmin    INT_MIN
#define        nl        "\n";
#define        prt(val)  cout<<val<<"\n";
#define        all(v)    v.begin(),v.end()
#define        trace1(x)                cerr<<#x<<": "<<x<<endl
#define        trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define        trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define        trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define        trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define        trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl

typedef       long long int ll;
typedef       long double LD;
typedef       unsigned long long int LL;
typedef       pair<int,int> pii;
typedef       pair<long long int,int> pli;
typedef       pair<int,long long int> pil;
typedef       pair<long long int,long long int> pll;
const int N=1e5+5;
const int mod=1e9+7;
//mt19937 rnd(time(NULL));

/*-----Functions------*/
template<typename T>
void show2d(const vector<vector<T>>& adj)
{
    for(auto x:adj)
    {
        for(auto y:x)
        { 
           cout<<y<<" ";
        }
    cout<<"\n";
    }
}

ll modexp(ll a,ll b,ll mod)
{
    ll x=1;
    while(b)
    {
        if(b&1)
        x = ((x%mod) * (a%mod))%mod;
        a = ((a%mod) * (a%mod))%mod;
        b = b / 2;
    }
    return x;
}

void rf()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
}

int32_t main()
{
    fast;
    //rf();
    int a,b;
    cin>>a>>b;
    cout<<(a*b)<<nl;
}

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

int n;
vector<int> arr;
int cnt;

void InsertionSort(vector<int> arr,int n,int g){
	for(int i = g ;i < n; ++i){
		int v = arr[i];
		int j = i - g;
		while(j >= 0 && arr[j] > v){
			arr[j + g] = arr[j];
			j = j - g;
			cnt++;
		}
		arr[j + g] = v;
	}
}

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n;
  arr.resize(n);
  rep(i,n) cin >> arr[i];
  cnt = 0;
  vector<int> G_make = arr;
  vector<int> G;
  int w = 1,d = 1;;
  
  while(w < n){
  	G.push_back(w);
  	d *= 3;
  	w += d;
  }
  int m;
  if(n == 1){
  	G.push_back(1);
  	m = 1;
  }
  reverse(all(G));
  m = G.size();
  rep(i,m){
  	int g = G[i];
  	for(int i = g ;i < n; ++i){
		int v = arr[i];
		int j = i - g;
		while(j >= 0 && arr[j] > v){
			arr[j + g] = arr[j];
			j = j - g;
			cnt++;
		}
		arr[j + g] = v;
	}
  }
  
  cout << m << endl;
  rep(i,m){
  	if(i != m - 1) cout << G[i] << ' ';
  	else cout << G[i] << endl;
  }
  cout << cnt << endl;
  rep(i,n){
  	cout << arr[i] << endl;
  }
  
  return 0;
}


Measured memory_bytes: 10772
#include <bits/stdc++.h>
#define PB push_back
#define MP make_pair
#define REP(i,n) for (int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define ALL(a) (a).begin(),(a).end()
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
const int INF=1e9;
const int MOD=100000;
string rec1(string in){
	string res="";
	map<char,string> s;
	s['A']="00000";
	s['B']="00001";
	s['C']="00010";
	s['D']="00011";
	s['E']="00100";
	s['F']="00101";
	s['G']="00110";
	s['H']="00111";
	s['I']="01000";
	s['J']="01001";
	s['K']="01010";
	s['L']="01011";
	s['M']="01100";
	s['N']="01101";
	s['O']="01110";
	s['P']="01111";
	s['Q']="10000";
	s['R']="10001";
	s['S']="10010";
	s['T']="10011";
	s['U']="10100";
	s['V']="10101";
	s['W']="10110";
	s['X']="10111";
	s['Y']="11000";
	s['Z']="11001";
	s[' ']="11010";
	s['.']="11011";
	s[',']="11100";
	s['-']="11101";
	s['\'']="11110";
	s['?']="11111";
	REP(i,in.size())res+=s[in[i]];
	return res;
}
string rec2(string in){
	string res="",t="";
	map<string,char>s;
	s["101"]=' ';
	s["000000"]='\'';
	s["000011"]=',';
	s["10010001"]='-';
	s["010001"]='.';
	s["000001"]='?';
	s["100101"]='A';
	s["10011010"]='B';
	s["0101"]='C';
	s["0001"]='D';
	s["110"]='E';
	s["01001"]='F';
	s["10011011"]='G';
	s["010000"]='H';
	s["0111"]='I';
	s["10011000"]='J';
	s["0110"]='K';
	s["00100"]='L';
	s["10011001"]='M';
	s["10011110"]='N';
	s["00101"]='O';
	s["111"]='P';
	s["10011111"]='Q';
	s["1000"]='R';
	s["00110"]='S';
	s["00111"]='T';
	s["10011100"]='U';
	s["10011101"]='V';
	s["000010"]='W';
	s["10010010"]='X';
	s["10010011"]='Y';
	s["10010000"]='Z';
	REP(i,in.size()){
		t+=in[i];
		if(s.find(t)!=s.end()){
			res+=s[t];
			t="";
		}
	}
	return res;
}
int main(){
	string in;
	while(getline(cin,in)){
		in=rec1(in);
		cout<<rec2(in)<<endl;
	}
}

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

int main(int argc, char const *argv[])
{
	int N,M;
	int td=0;

	cin>>N>>M;

	int d[M];

	for(int i=0;i<M;i++){
		cin>>d[i];
	}
	for(int i=0;i<M;i++){
		td += d[i];
	}

	if(td < N){
		cout<<N-td<<endl;
	}
	else if(td == N) {
		cout<<0<<endl;
	}
	else{
		cout<<-1<<endl;
	}



	return 0;
}

Measured memory_bytes: 3676
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <deque>
#define N 101000
template<typename T> inline void read(T &x) {
	x = 0; char c = getchar(); bool flag = false;
	while (!isdigit(c)) {if (c == '-') flag = true; c = getchar(); }
	while (isdigit(c)) {x = (x << 1) + (x << 3) + (c ^ 48); c = getchar(); }
	if (flag)	x = -x;
}
using namespace std;
int n;
int dis[N];
deque<int> q, qq;
inline void bfs() {
	//dis[1] = 1;
	q.push_back(1);
	qq.push_back(1);
	while (q.size()) {
		int p = q.front();
		q.pop_front();
		int v = qq.front();
		qq.pop_front();
		if (dis[p])	continue;
		dis[p] = v;
		if (!p)	return ;
		q.push_back((p + 1) % n);
		qq.push_back(dis[p] + 1);
		q.push_front(p * 10 % n);
		qq.push_front(dis[p]);
		//printf("p = %d, dis = %d\n", p, dis[p]);
		//printf("p = %d\n", p);
		/*
		if (!p)	return ;
		if (!dis[(p + 1) % n])	dis[(p + 1) % n] = dis[p] + 1, q.push_back((p + 1) % n);
		//else	printf("p + 1 mod n = %d, dis = %d\n", (p + 1) % n, dis[(p + 1) % n]);
		if (!dis[p * 10 % n])	dis[p * 10 % n] = dis[p], q.push_front(p * 10 % n);
		//else	printf("p * 10 mod n = %d, dis = %d\n", p * 10 % n, dis[p * 10 % n]);
		*/
	}
}

int main() {
	read(n);
	bfs();
	printf("%d\n", dis[0]);
	return 0;
}
/*
6 3
41 5
79992 36
7 2(1001)
*/

Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair <int,int> P;

int main() {
  int n;
  cin>>n;
  double v[55];
  for (int i=0; i<n; i++) {
    cin>>v[i];
  }
  sort(v,v+n);
  double ans=0,d=1;
  for (int i=n-1; i>0; i--) {
    d*=2;
    ans+=v[i]/d;
  }
  ans+=v[0]/d;
  printf("%.15lf\n",ans);
  return 0;
}



Measured memory_bytes: 256
from sys import stdin

n = int(stdin.readline().rstrip())
data = stdin.readline().rstrip().split()

data = sorted(data, key=int, reverse=True)

alice_total=0
bob_total=0


for i in range(0, n):
    if i % 2 == 0:
        alice_total = alice_total + int(data[i])
    else:
        bob_total = bob_total + int(data[i])

print(alice_total - bob_total)


Measured memory_bytes: 3060
#include <iostream>
#include<string>
#include<stack>
#include <vector>
#include <math.h>
#include <array>
#include <algorithm>
using namespace std;
int main(){
long long a,b,c,n,count=0,x;
cin>>a>>b>>c;
if(c>=a && c<=b)
	cout<<"Yes"<<endl;
else
	cout<<"No"<<endl;
return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vll>;
using vc = vector<char>;
using vvc = vector<vc>;
using pll = pair<ll, ll>;
using vpll = vector<pll>;
const ll INF = 1LL << 60;
const ll MOD = 1e9 + 7;
#define rep(i, n) for (ll i = 0; i < (n); i++)
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
#ifndef ONLINE_JUDGE
    #define debug(x) cerr << #x << ": " << x << endl;
#else
    #define debug(x)
#endif

int main() {
    cin.tie(0);ios::sync_with_stdio(false);cout << fixed << setprecision(20);

    ll N;
    cin >> N;

    ll x = (N + 999) / 1000;
    cout << x * 1000 - N << endl;
}


Measured memory_bytes: 3612
#include <iostream>
#include <cstdio>
using namespace std;
int a, b, k;
int main() {
    cin >> k;
    cin >> a >> b;
    for (int i = a; i <= b; i++) {
        if (i % k == 0) {
            cout << "OK";
            return 0;
        }
    }
    cout << "NG";
    return 0;
}

Measured memory_bytes: 3640
N, Q = map(int, input().split())
S = input()
A = [0] * (N + 1)
for i in range(1, N):
  if S[i - 1] == "A" and S[i] == "C":
    A[i + 1] = A[i] + 1
  else:
    A[i + 1] = A[i]
for i in range(Q):
  l, r = map(int, input().split())
  print(A[r] - A[l])

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

using namespace std;

int A,B,C;

int main(){
	scanf("%d%d%d",&A,&B,&C);
	
	if (A == B){
		printf("%d\n",C);
	}else if(A == C){
		printf("%d\n",B);
	}else{
		printf("%d\n",A);
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using LL = long long;
#define FOR(i, x, y) for (decay<decltype(y)>::type i = (x), _##i = (y); i < _##i; ++i)
#define FORD(i, x, y) for (decay<decltype(x)>::type i = (x), _##i = (y); i > _##i; --i)
#ifdef zerol
#define dbg(x...) do { cout << "\033[32;1m" << #x << " -> "; err(x); } while (0)
void err() { cout << "\033[39;0m" << endl; }
template<template<typename...> class T, typename t, typename... A>
void err(T<t> a, A... x) { for (auto v: a) cout << v << ' '; err(x...); }
template<typename T, typename... A>
void err(T a, A... x) { cout << a << ' '; err(x...); }
#else
#define dbg(...)
#endif
// -----------------------------------------------------------------------------

const int N = 1E5 + 100;
const int M = 12;
vector<int> G[N];
pair<int, int> dp[N][M];

int main() {
    int n, m, q; cin >> n >> m;
    FOR (_, 0, m) {
        int x, y; cin >> x >> y;
        G[x].push_back(y);
        G[y].push_back(x);
    }
    cin >> q;
    FOR (ti, 1, q + 1) {
        int v, d, c; cin >> v >> d >> c;
        dp[v][d] = {ti, c};
    }
    FORD (d, 10, -1) {
        FOR (u, 1, n + 1) {
            for (int v: G[u]) {
                if (dp[v][d + 1].second)
                    dp[u][d] = max(dp[u][d], dp[v][d + 1]);
            }
        }
    }
    FOR (i, 1, n + 1) {
        pair<int, int> ans = {0, 0};
        FOR (d, 0, 11)
            ans = max(ans, dp[i][d]);
        cout << ans.second << endl;
    }
}

Measured memory_bytes: 15864
#include "bits/stdc++.h"

#define rep(a,b) for(int a = 0;a < b;a++)
#define REP(i, x, n) for(int i = x; i < n; i++)
#define P(a) cout << a << endl
#define pb(a) push_back(a)
#define mp(a,b) make_pair(a,b)
#define ssort(v) sort(v.begin(),v.end())
#define rev(v) reverse(v.begin(),v.end())
#define vP(v) for(int i = 0;i < v.size();i++){cout << v[i];if(i != v.size()-1)cout << endl;}
#define vcin(v,n) rep(i,n){int a;cin >> a;v.pb(a);}

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
int dx[] = { 1, -1 , 0 , 0 };
int dy[] = { 0,  0,  1, -1 };
ll MOD = 1000000007;

void solve() {
	string s;
	cin >> s;
	int posA = -1, posZ = -1;
	rep(i, s.length()) {
		if (s[i] == 'A' and posA == -1) {
			posA = i + 1;
		}
		if (s[i] == 'Z') {
			posZ = max(posZ, i + 1);
		}
	}
	P(abs(posZ - posA) + 1);
}

int main() {
	solve();
	return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
int n;
signed main(){
    cin>>n;
    vector <pair<int ,int>> pr(n);
    for(int i=0;i<n;i++){int t;cin>>t;pr[i].first=t;pr[i].second=i+1;}
    sort(pr.begin(), pr.end());
    for(int i=0;i<n;i++){cout<<pr[i].second<<' ';}
}

Measured memory_bytes: 1536
#conding utf-8
x,y,z,K=map(int,input().split())
a=list(map(int,input().split())) 
b=list(map(int,input().split())) 
c=list(map(int,input().split())) 

a.sort()
b.sort()
c.sort()
a.reverse()
b.reverse()
c.reverse()

ans=[]

for i in range(len(a)):
  for j in range(len(b)):
    if (i+1)*(j+1)>K:
      break
    for k in range(len(c)):
      if (i+1)*(j+1)*(k+1)>K:
        break
      ans.append(a[i]+b[j]+c[k])
    
ans.sort()
ans.reverse()

for i in range(K):
  print(ans[i])

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

int main() {
    string s,t;
    cin >> s;
    cin >> t;
    int len = (int)s.length();
    if(s == t){
        cout << "Yes" << endl;
        return 0;
    }
    for(int i = 0; i < len; i++){
        s.insert(s.begin(), s[len - 1]);
        s.pop_back();
        if(s == t){
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  long long n,a,b,x,y;
  cin >> n >> a >> b;
  long long asum=0;
  
  x = n/(a+b);
  y = n%(a+b);
  if(y>a){
    asum = a*x + a;
  }
  else {
    asum = a*x + y;
  }
  
  cout << asum << endl;
}

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

int N;
int A[210];

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

	int min = 100;
	int counter;

	for(i=0;i<N;i++){
		counter = 0;
		while(A[i]%2==0){
			counter++;
			A[i] /= 2;
		}
		if(counter < min)
			min = counter;
	}

	cout << min << endl;
	
	return 0;
}


Measured memory_bytes: 256
I = int(input())
from collections import Counter
from itertools import accumulate
As = map(int, input().split())
xs = sorted([x for x in Counter(As).values()]) + [10**18]
Xs = accumulate(xs)

N = len(xs) - 1
rs = [0]*I
mny = N+1
for l, (x, X) in enumerate(zip(xs[1:], Xs)):
    l += 2
    y = X//(x+1) + (N-l+1) + 1
    for i in range(y, mny):
        rs[i-1] = X//(i-(N-l+1))
    mny = min(y, mny)
for r in rs:
    print(r)


Measured memory_bytes: 118456
n = int(input())
dic_a = {str(k):v for k,v in zip(range(10),'abcdefghij')}

def main(s):
    if len(s) < n:
        for ss in range(int(max(s))+2):
            main(s+str(ss))
    else:
        print(''.join([dic_a[x] for x in s]))
            
main('0')

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

int main(){
    int N,M,a[10000],i, s=0;
    cin>>N>>M;
    for(i=0; i<M; i++){
        cin>>a[i];
        s+=a[i];
    }
    if((N-s)<0){
        cout<<-1<<endl;
    }else{
        cout << N-s << endl;}
    return 0;
}

Measured memory_bytes: 3696
#include <iostream>
#include <algorithm>
#include <string>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <vector>
#include <queue>

using namespace std;

int main() {
	int N; cin >> N;
	int* a = new int[N];
	int* b = new int[N];
	int* c = new int[N];

	for (int i = 0; i < N; i++) {
		cin >> a[i];
		a[i]--;
	}
	for (int i = 0; i < N; i++) {
		cin >> b[i];
	}
	for (int i = 0; i < N - 1; i++) {
		cin >> c[i];
	}
	
	int s = 0;
	for (int i = 0; i < N; i++) {
		s += b[i];
	}
	for (int i = 0; i < N - 1; i++) {
		if (a[i + 1] == a[i] + 1) {
			s += c[a[i]];
		}
	}

	cout << s << endl;
	return 0;
}


Measured memory_bytes: 256
import math
import sys
import numpy as np
sys.setrecursionlimit(10 ** 7)

def int_input():
    return map(int, input().split())

n = int(input())

G = [[] for _ in range(n + 5)]
for i in range(n - 1):
    u, v, w = int_input()
    u -= 1
    v -= 1
    G[u].append([v, w])
    G[v].append([u, w])

ans = [-1] * (n + 5)

def dfs(k, dist):
    ans[k] = dist % 2
    for i in G[k]:
        if ans[i[0]] == -1:
            dfs(i[0], dist + i[1])
    
dfs(0, 0)

for i in range(n):
    print(ans[i])




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

int main() {
    int Hi,Hy,Ki,Ky,i,y,i10,y20;
    cin>>Hi>>Hy>>Ki>>Ky>>i>>y>>i10>>y20;
    int Hi10=Hi/10*i10;
    int Hy20=Hy/20*y20;
    int Ki10=Ki/10*i10;
    int Ky20=Ky/20*y20;
    
    int hiroshi=Hi*i+Hy*y+Hi10+Hy20;
    int kenjiro=Ki*i+Ky*y+Ki10+Ky20;
    
    if(hiroshi>kenjiro)cout<<"hiroshi"<<endl;
    else if(hiroshi<kenjiro)cout<<"kenjiro"<<endl;
    else{cout<<"even"<<endl;}
}


Measured memory_bytes: 3136
fun main(args: Array<String>) {
    abc151e()
}

fun abc151e() {
    val (n, k) = readLine()!!.split(' ').map { it.toInt() }
    val aList = readLine()!!.split(' ').map { it.toLong() }.sorted().toLongArray()

    var answer = Mint(0)

    for (i in 0 until n) {
        answer -= aList[i] * nCk(n - i - 1, k - 1) % MOD
        answer += aList[i] * nCk(i, k - 1) % MOD
    }


    println(answer)
}

private const val MOD = (1e9 + 7).toLong()

private const val MAX = 1000000
private val fac = LongArray(MAX)
private val fInv = LongArray(MAX)
private val inv = LongArray(MAX)
private var isNCkInit = false

private fun nCk(n: Int, k: Int): Long {
    if (!isNCkInit) {
        isNCkInit = true
        fac[0] = 1
        fac[1] = 1
        fInv[0] = 1
        fInv[1] = 1
        inv[1] = 1
        for (i in 2 until MAX) {
            fac[i] = fac[i - 1] * i % MOD
            inv[i] = MOD - inv[(MOD % i).toInt()] * (MOD / i) % MOD
            fInv[i] = fInv[i - 1] * inv[i] % MOD
        }
    }
    if (n < k) return 0
    if (n < 0 || k < 0) return 0
    return fac[n] * (fInv[k] * fInv[n - k] % MOD) % MOD
}

private class Mint(value: Long) {
    private val value = if (value < 0) (value % MOD) + MOD else value % MOD
    operator fun unaryPlus() = this
    operator fun unaryMinus() = Mint(MOD - this.value)
    operator fun inc() = this.plus(1)
    operator fun dec() = this.minus(1)
    operator fun plus(other: Long) = Mint(this.value + other)
    operator fun plus(other: Mint) = this.plus(other.value)
    operator fun minus(other: Long) = Mint(this.value - other)
    operator fun minus(other: Mint) = this.plus(-other)
    operator fun times(other: Long) = Mint(this.value * other)
    operator fun times(other: Mint) = this.times(other.value)
    operator fun div(other: Long) = Mint(modPow(other, MOD - 2, MOD))
    operator fun div(other: Mint) = this.div(other.value)
    override fun toString(): String {
        return this.value.toString()
    }

    override fun equals(other: Any?): Boolean {
        if (this === other) return true
        if (javaClass != other?.javaClass) return false

        other as Mint

        if (value != other.value) return false

        return true
    }

    override fun hashCode(): Int {
        return value.hashCode()
    }

    @Suppress("SameParameterValue")
    companion object Mod {
        private fun modPow(n: Long, p: Long, m: Long): Long {
            var x = n
            var y = p
            var result = 1L
            x %= m
            while (y > 0) {
                if (y % 2 == 1L)
                    result = (result * x) % m
                y = y shr 1
                x = (x * x) % m
            }
            return result
        }
    }
}



Measured memory_bytes: 96976
n = int(input())
a = list(map(int, input().split()))

mod = 10 ** 9 + 7

res = 0
two_factor = 1
for i in range(60):
    cnt_1 = 0
    cnt_0 = 0
    for v in a:
        if (v >> i) & 1:
            cnt_1 += 1
        else:
            cnt_0 += 1
    res = (res + cnt_1 * cnt_0 % mod * two_factor % mod) % mod
    two_factor = two_factor * 2 % mod

print(res)

Measured memory_bytes: 122936
N, X, Y = map(int, input().split())

dp = [[0]*N for _ in range(N)]
for i in range(N):
    for j in range(i+1, N):
        dp[i][j] = j-i
        dp[j][i] = j-i
dp[X-1][Y-1] = 1
dp[Y-1][X-1] = 1
for i in range(N):
    for j in range(N):
        if dp[i][j] > dp[i][X-1] + dp[X-1][j]:
            dp[i][j] = dp[i][X-1] + dp[X-1][j]
            dp[j][i] = dp[i][X-1] + dp[X-1][j]
        if dp[i][j] > dp[i][Y-1] + dp[Y-1][j]:
            dp[i][j] = dp[i][Y-1] + dp[Y-1][j]
            dp[j][i] = dp[i][Y-1] + dp[Y-1][j]

n_map = {}
for i in range(N):
    for j in range(i+1,N):
        if dp[i][j] not in n_map:
            n_map[dp[i][j]] = 1
        else:
            n_map[dp[i][j]] += 1
for i in range(1, N):
    if i not in n_map:
        print(0)
    else:
        print(n_map[i])

Measured memory_bytes: 80348
open System.Collections.Generic

type Scanner() = class
    let mutable hold = [||]
    let mutable index = 0
    member public this.Next() =
        if hold.Length > index
        then 
            index <- index + 1
            hold.[index - 1]
        else
            let mutable st = stdin.ReadLine()
            while st = "" do st <- stdin.ReadLine()
            hold <- st.Split(' ')
            if hold.Length = 0
            then
                this.Next()
            else
                index <- 1
                hold.[index - 1]
            
    member public this.NextI32() =
        this.Next() |> int

    member public this.ArrayI32(n: int) =
        [|for _ in 0 .. n - 1 -> this.NextI32()|]

    member public this.NextI64() =
        this.Next() |> int64
    
    member public this.ArrayI64(n: int) =
        [|for _ in 0 .. n - 1 -> this.NextI64()|]

    member public this.NextF32() =
        this.Next() |> float32
    
    member public this.ArrayF32(n: int) =
        [|for _ in 0 .. n - 1 -> this.NextF32()|]

    member public this.NextF64() =
        this.Next() |> double
    
    member public this.ArrayF64(n: int) =
        [|for _ in 0 .. n - 1 -> this.NextF64()|]

    member public __.Tuple2Array n (f : int -> 'a list) =
        [|for _ in 0 .. n - 1 -> f 2 |> fun x -> x.[0], x.[1]|]
    
    member public __.Tuple3Array n (f : int -> 'a list) =
        [|for _ in 0 .. n - 1 -> f 3 |> fun x -> x.[0], x.[1], x.[2]|]

    member public __.CountDic n (f : unit -> 'a) =
        let seqs = seq {for _ in 0 .. n - 1 -> f()}
        let dic = new Dictionary<'a, int64>();
        for i in seqs do
            if dic.ContainsKey(i)
            then dic.[i] <- dic.[i] + 1L
            else dic.Add(i, 1L)
        dic

end

[<EntryPoint>]
let main _ =
    let scanner = Scanner()

    let rec func c mxcount count list =
        match list with
        | [] -> max mxcount count
        | x::xs when x = c -> func c (max mxcount count) 0 xs
        | _::xs -> func c mxcount (count+1) xs

    let arr = scanner.Next() |> Seq.map int |> Seq.toList
    let f = (fun x -> func x 0 0 arr)

    [|for c in 'a'..'z' -> int c|]
    |> Array.map f
    |> Array.min
    |> printfn "%i"

    0


Measured memory_bytes: 14940
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
)

const (
	initialBufSize = 10000
	maxBufSize     = 1000000
)

var (
	sc *bufio.Scanner = func() *bufio.Scanner {
		sc := bufio.NewScanner(os.Stdin)
		buf := make([]byte, initialBufSize)
		sc.Buffer(buf, maxBufSize)
		sc.Split(bufio.ScanWords)
		return sc
	}()
	mod int = 1e9 + 7
)

func main() {
	N := getInt()
	M := getInt()
	
	if N == M {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}

func getInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func getString() string {
	sc.Scan()
	return sc.Text()
}

func abs(a int) int {
	return int(math.Abs(float64(a)))
}

func pow(p, q int) int {
	return int(math.Pow(float64(p), float64(q)))
}

func min(nums ...int) int {
	if len(nums) == 0 {
		panic("funciton min() requires at least one argument.")
	}
	res := nums[0]
	for i := 0; i < len(nums); i++ {
		res = int(math.Min(float64(res), float64(nums[i])))
	}
	return res
}

func max(nums ...int) int {
	if len(nums) == 0 {
		panic("funciton max() requires at least one argument.")
	}
	res := nums[0]
	for i := 0; i < len(nums); i++ {
		res = int(math.Max(float64(res), float64(nums[i])))
	}
	return res
}

func strSearch(a []string, b string) bool {
	for i := 0; i < len(a); i++ {
		if a[i] == b {
			return true
		}
	}
	return false
}

func printIntArray(array []int) {
	strArray := fmt.Sprint(array)
	fmt.Println(strArray[1 : len(strArray) - 1])
}

func calcMod(x int) int {
	return x % mod
}


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

using namespace std;

#define REP(i, n) for(int i = 0; i < (n); i++)
#define SORT(v, n) sort(v, v+n);
#define SSORT(v, n) sort(v, v+n, greater<int>())

int main(){
	string b;
	cin >> b;
	if(b == "A") cout << "T" << endl;
	else if(b == "T") cout << "A" << endl;
	else if(b == "G") cout << "C" << endl;
	else if(b == "C") cout << "G" << endl;
	
}

Measured memory_bytes: 256
N, M = map(int,input().split())
s = []
c = []
for i in range(M):
  s_i, c_i = map(int,input().split())
  s.append(s_i)
  c.append(c_i)
  
n = [10] * N

for i in range(M):
  if n[s[i]-1] == 10:
    n[s[i]-1] = c[i]
  elif n[s[i]-1] == c[i]:
    pass
  else:
    print(-1)
    break
else:
  if N > 1 and n[0] == 0:
    print(-1)
  else:
    answer = 0
    for i in range(N):
      if i == 0:
        if n[0] == 10 and N >= 2:
          answer += 1
        elif n[0] == 10 and N == 1:
          pass
        else:
          answer += n[0]
      else:
        answer *= 10
        if n[i] == 10:
          pass
        else:
          answer += n[i]
    else:
      print(answer)

Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <math.h>
#include <iomanip>
#include <bitset>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <utility>
#include <set>
#include <queue>
using namespace std;
typedef long long int ll;
typedef long double ld;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
typedef pair<ll,ll> pairs;
vector<pairs> p;
bool pairCompare(const pair<double,ll>& firstElof, const pair<double,ll>& secondElof){
    return firstElof.first < secondElof.first;
}
bool pairCompareSecond(const pair<double,ll>& firstElof, const pair<double,ll>& secondElof){
    return firstElof.second < secondElof.second;
}
#define MAX_N 100100
#define MOD 1000000007
bool x[MAX_N];
ll num[MAX_N];
ll fibl[MAX_N]={0};
// 四方向への移動ベクトル
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

ll fib(ll a){
    if (fibl[a]!=0)return fibl[a];
    if (a==0){
        return 0;
    }else if (a==1){
        return 1;
    }
    return fibl[a]=fib(a-1)+fib(a-2);
}
 
ll eratosthenes(ll n) {
    int p = 0;
    for (ll i=0; i<=n; ++i) x[i] = true;
    x[0] = x[1] = false;
    for(int i=2; i<=n; ++i) {
        if(x[i]) {
            p++;
            for(int j=2*i; j<=n; j+=i) x[j] = false;
        }
        
        num[i] = p;
    }
    return p;
}
 
ll gcd(ll a,ll b){
    if (a%b==0)return(b);
    else return(gcd(b,a%b));
}
 
ll keta(ll N){
    int tmp{};
    while( N > 0 ){
        tmp += ( N % 10 );
        N /= 10;
    }
    N = tmp;
    return N;
}

void  base_num(ll data,ll base){
    if(data==0) return;
    ll next=abs(data)%abs(base);
    if(data<0) next=(abs(base)-next)%abs(base);
    base_num((data-next)/base,base);
    cout << next;
}


int main(){
    ll x;
    cin >> x;
    ll a=100;
    for (ll i=1;;i++){
        a+=a/100;
        if (a>=x){
            cout << i << endl;
            return 0;
        }
    }
    return 0;
}


Measured memory_bytes: 3224
#include <bits/stdc++.h>
typedef long long ll;
const int INF = 1e9;
using namespace std;

pair<int,string> a,b,c;

char drop(char person){
    char res;
    if(person == 'a'){
        if(a.first == a.second.size()){
            return person;
        }
        res = drop(a.second[a.first++]);
    }
    else if(person == 'b'){
        if(b.first == b.second.size()){
            return person;
        }
        res = drop(b.second[b.first++]);
    }
    else{
        if(c.first == c.second.size()){
            return person;
        }
        res = drop(c.second[c.first++]);
    }
    return res;
}

void solve(){
    a.first = 0;
    b.first = 0;
    c.first = 0;
    char res = drop('a');
    printf("%c\n",res-32);
}

int main() {
    cin>>a.second;
    cin>>b.second;
    cin>>c.second;
    solve();
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    long long N,A,B;
    cin>>N>>A>>B;
    long long count,tmp;
    count=tmp=0;
    count=N/(A+B);
    if(N%(A+B)<=A){
        tmp=N%(A+B);
    }
    else{
        tmp=A;
    }
    long long ans=0;
    ans=A*count+tmp;
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
#pragma region _head

#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include<map>
#include<set>
#include<iomanip>
#include<queue>
#include<stack>
#include<numeric>
#include<utility>
#include<regex>

void Init() {
	std::cin.tie(0); std::ios::sync_with_stdio(false);
	struct Init_caller { Init_caller() { Init(); } }caller;
}

#pragma region _define

#define int LL
#define f(i,a,b) for(LL i=a;i<b;i++)
#define f_vI(v,n) f(i,0,n)cin>>v[i]
#define f_v2I(v1,v2,n) f(i,0,n)cin>>v1[i]>>v2[i]
#define f_v3I(v1,v2,v3,n) f(i,0,n)cin>>v1[i]>>v2[i]>>v3[i]
#define f_vO(v,n) f(i,0,n)cout<<v[i]<<endl
#define ei else if
#define all(a) a.begin(),a.end()
#define size(s) ((LL)s.size())
#define F first
#define S second
#define check() cout<<"! ! !"
#define endl "\n"
#define _y() cout<<"Yes"<<endl
#define _Y() cout<<"YES"<<endl
#define _n() cout<<"No"<<endl
#define _N() cout<<"NO"<<endl
#define int_INF 1<<29
#define ll_INF 1LL<<60
#define MOD 1000000007

#pragma endregion

#pragma region _using

using namespace std;

using LL = long long;
using st = string;
using vi = vector<LL>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vd = vector<double>;
using vvd = vector<vd>;
using vvvd = vector<vvd>;
using vc = vector<char>;
using vvc = vector<vc>;
using vs = vector<st>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvvb = vector<vvb>;
using qi = queue<LL>;
using qc = queue<char>;
using qs = queue<st>;
using si = stack<LL>;
using sc = stack<char>;
using ss = stack<st>;
using pi = pair<LL, LL>;
using ppi = pair<pi, LL>;
using mll = map<LL, LL>;
using mcl = map<char, LL>;
using vpi = vector<pi>;
using vppi = vector<ppi>;

#pragma endregion

struct edge {
	int from, to, cost;
};

void y_n(bool p) {
	p ? _y() : _n();
}

void Y_N(bool p) {
	p ? _Y() : _N();
}

LL gcd(LL a, LL b) {
	LL r;
	while ((r = a % b) != 0) {
		a = b;
		b = r;
	}
	return b;
}
LL lcm(LL a, LL b) {
	return (a / gcd(a, b) * b);
}

//素数判定
bool is_prime(int n) {
	for (int i = 2; i*i <= n; i++) {
		if (n % i == 0) {
			return false;
		}
	}
	return true;
}

//階乗計算
LL factorial(LL n) {
	LL a = 1, ret = 1;
	while (a < n) {
		a++;
		ret *= a;
		ret %= MOD;
	}
	return ret;
}


#pragma endregion 


/*****************************************************************************/
signed main(void) {
	int n;
	cin >> n;
	vi h(n);
	f_vI(h, n);
	int ans = 0;
	int memo = h[0];
	f(i, 0, n) {
		if (memo <= h[i]) {
			ans++;
			memo = h[i];
		}
	}
	cout << ans;
	return 0;
}

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

map< int64_t, int > prime_factor(int64_t n) {
  map< int64_t, int > ret;
  for(int64_t i = 2; i * i <= n; i++) {
    while(n % i == 0) {
      ret[i]++;
      n /= i;
    }
  }
  if(n != 1) ret[n] = 1;
  return ret;
}

void solve(long long N){
    auto a = prime_factor(N);
    ll ans = 0;
    for(auto b : a){
        int cnt = b.second;
        for(int i = 1;i <= cnt;i++){
            cnt -= i;
            ans++;
        }
    }
    cout<<ans<<endl;
}

int main(){
    long long N;
    scanf("%lld",&N);
    solve(N);
    return 0;
}


Measured memory_bytes: 3696
#include<stdio.h>
#include<math.h>
int Check(int*);
int main(){
	int Count,KAZU,Ball[10];
	int Bzone[10],Czone[10];
	int *Result;
	for(Count=0;Count<10;Count++){
		Bzone[Count]=20*(Count+1);
		Czone[Count]=20*(Count+1);
	}

	scanf("%d",&KAZU);
	Result= (int*)malloc(KAZU);
	for(Count=0;Count<KAZU;Count++){
		int Count2,Count3;
		int YorN=0;
		scanf("%d %d %d %d %d %d %d %d %d %d",&Ball[0],&Ball[1],&Ball[2],&Ball[3],&Ball[4],&Ball[5],&Ball[6],&Ball[7],&Ball[8],&Ball[9]);

		for(Count2=0;Count2<1024;Count2++){
			int B=0,C=0;
			int V;
			for(V=0;V<10;V++){
				Bzone[V]=20*(V+1);
				Czone[V]=20*(V+1);
			}
			for(Count3=0;Count3<10;Count3++){
				if(0!=(((int)pow(2.0,Count3))&Count2)){//真ならCにいれる
					Czone[C]=Ball[Count3];
					C++;
				}
				else {
					Bzone[B]=Ball[Count3];
					B++;
				}
			}
			//振り分け完了
			if(Check(Bzone)==1&&Check(Czone)==1){
				YorN=1;
				break;
			}
		}
		*(Result+Count)=YorN;
	}
	for(Count=0;Count<KAZU;Count++){
		if(*(Result+Count)==1){
			printf("YES\n");
		}
		else printf("NO\n");
	}

	for(Count=0;Count<10;Count++){
		Bzone[Count]=20*(Count+1);
		Czone[Count]=20*(Count+1);
	}

	return 0;
}


int Check(int *BALL){
	int Count,Check=1;
	for(Count=0;Count<9;Count++){
		if(BALL[Count]>=BALL[Count+1]){
			Check=0;
		}
	}
	return Check;
}

Measured memory_bytes: 0
#include <iostream>
#include<bits/stdc++.h>
#define ll long long
#define   ull unsigned long long 
const int MAX=3e5;
const int mod=1e9+7;
using namespace std;
int cnt[MAX];
int dp[200][200];
int main(){
	int n;
	cin>>n;
	int c[n+1] , v[n+1];
	int res[n+1];
	int tot=0;
	for(int i=1;i<=n;i++){
		int x, y;
		cin>>c[i];
	}
	for(int i=1;i<=n;i++)
		cin>>v[i];
	for(int i=1;i<=n;i++)
	{
		if(c[i]-v[i]>0)
			tot=tot+c[i]-v[i];
	}
	cout<<tot;
}

Measured memory_bytes: 256
a,b,k = gets.chomp.split(" ").map(&:to_i)
cnt = 0
ans = 0
[a,b].max.downto(1) do |i|
  if a%i == 0 && b%i == 0
    cnt += 1
    if cnt == k
      ans = i
    end
  end
end
puts ans


Measured memory_bytes: 14316