akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

#define dump(...) do{print_vars(cout<<"# "<<#__VA_ARGS__<<'=',__VA_ARGS__);cout<<endl;}while(0)
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define peri(i,a,b) for(int i=int(b);i-->int(a);)
#define rep(i,n) repi(i,0,n)
#define per(i,n) peri(i,0,n)
#define all(c) begin(c),end(c)
#define mp make_pair
#define mt make_tuple

using uint=unsigned;
using ll=long long;
using ull=unsigned long long;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using vd=vector<double>;
using vvd=vector<vd>;
using vs=vector<string>;

template<typename T,typename U>bool chmin(T& a,const U& b){return a>b?(a=b,1):0;}
template<typename T,typename U>bool chmax(T& a,const U& b){return a<b?(a=b,1):0;}

void print_vars(ostream&){}
template<typename Car,typename... Cdr>
void print_vars(ostream& os,const Car& car,const Cdr&... cdr){
	print_vars(os<<car<<(sizeof...(cdr)?",":""),cdr...);
}

template<typename T1,typename T2>
ostream& operator<<(ostream& os,const pair<T1,T2>& p){
	return os<<'('<<p.first<<','<<p.second<<')';
}

template<int I,typename Tuple>
void print_tuple(ostream&,const Tuple&){}
template<int I,typename Car,typename... Cdr,typename Tuple>
void print_tuple(ostream& os,const Tuple& t){
	os<<get<I>(t)<<(sizeof...(Cdr)?",":"");
	print_tuple<I+1,Cdr...>(os,t);
}
template<typename... Args>
ostream& operator<<(ostream& os,const tuple<Args...>& t){
	print_tuple<0,Args...>(os<<'(',t);
	return os<<')';
}

template<typename Ch,typename Tr,typename C>
basic_ostream<Ch,Tr>& operator<<(basic_ostream<Ch,Tr>& os,const C& c){
	os<<'[';
	for(auto i=begin(c);i!=end(c);++i)
		os<<(i==begin(c)?"":" ")<<*i;
	return os<<']';
}

constexpr int INF=1e9;
constexpr int MOD=1e9+7;
constexpr double EPS=1e-9;

int main()
{
	#ifndef _GLIBCXX_DEBUG
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	constexpr char endl='\n';
	#endif

	for(int n,k;cin>>n>>k&&n|k;){
		vi a(n);
		rep(i,n) cin>>a[i];

		vl ss;
		rep(i,n){
			ll s=0;
			repi(j,i,n)
				ss.push_back(s+=a[j]);
		}

		int m=ss.size();
		vi use(m,1);
		ll res=0;
		per(i,63){
			int cnt=0;
			rep(j,m)
				if(use[j]&&ss[j]>>i&1)
					cnt++;
			if(cnt<k)
				continue;
			res|=1ll<<i;
			rep(j,m)
				if(use[j]&&!(ss[j]>>i&1))
					use[j]=0;
		}
		cout<<res<<endl;
	}
}


Measured memory_bytes: 6384
public class Hello{
    public static void Main(){
        string[] str = System.Console.ReadLine().Split(' ');
        //var[] a = int.Parse(str.Split(' '));
        int[] a = new int[3];
        for(int i=0; i<3; i++){
            a[i] = int.Parse(str[i]);
            //System.Console.WriteLine(str[i]);
        }
        
        for(int i=0; i<a[2]; i++){
            if(i%2==0){
                if(a[0]%2==0){
                    a[0] /=2;
                    a[1] += a[0];
                }else{
                    a[0]--;
                    a[0] /=2;
                    a[1] += a[0];
                }
                //System.Console.WriteLine(i+":"+a[0]+" "+a[1]);
            }else{
                if(a[1]%2==0){
                    a[1] /=2;
                    a[0] += a[1];
                }else{
                    a[1]--;
                    a[1] /=2;
                    a[0] += a[1];
                }
                //System.Console.WriteLine(i+":"+a[0]+" "+a[1]);
            }
        }
        System.Console.WriteLine(a[0]+" "+a[1]);
    }
}


Measured memory_bytes: 17700
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define ll              long long
#define pb              push_back
#define ppb             pop_back
#define endl            '\n'
#define mii             map<ll,ll>
#define pii             pair<ll,ll>
#define vi              vector<ll>
#define vs              vector<string>
#define all(a)          (a).begin(),(a).end()
#define F               first
#define S               second
#define sz(x)           ((ll)x.size())
#define hell            (1000000007)
#define inf             ((ll)5e18 + 5)
#define PI              ((double)3.14159265358979323844)
#define DECIMAL(n)      cout << fixed << setprecision(n);
#define rep(i,a,b)      for (ll i=a;i<b;i++)
#define repr(i,a,b)     for (ll i=a-1;i>=b;i--)
#define bitcount(a)     (ll)__builtin_popcount(a)
#define lbnd            lower_bound
#define ubnd            upper_bound
#define mp              make_pair
#define ios             ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define ordered_set     tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>
#define trace(...)      __f(#__VA_ARGS__, __VA_ARGS__)

template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    std::cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');std::cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}

using namespace std;
using namespace __gnu_pbds;

/*----------------------Graph Moves----------------*/
//const int fx[]={+1,-1,+0,+0};
//const int fy[]={+0,+0,+1,-1};
//const int fx[]={+0,+0,+1,-1,-1,+1,-1,+1};   // Kings Move
//const int fy[]={-1,+1,+0,+0,+1,+1,-1,-1};  // Kings Move
//const int fx[]={-2, -2, -1, -1,  1,  1,  2,  2};  // Knights Move
//const int fy[]={-1,  1, -2,  2, -2,  2, -1,  1}; // Knights Move
/*------------------------------------------------*/

//primes for hashing 937,991,1013,1409,1741

void solve() {
    string s, t;
    cin>>s>>t;
    ll ans=inf;
    rep(i, 0, sz(s)-sz(t)+1) {
        ll temp=0;
        rep(j, 0, sz(t)) {
            if (s[i+j]!=t[j]) temp++;
        }
        ans=min(ans, temp);
    }
    cout<<ans<<endl;
}

signed main() {
    ios
    ll test=1;
    //cin>>test;
    while (test--) solve();
    return 0;
}

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

int n;
vector<int> so;
int data[110] = {};
int memo[110][110];
int dp(int i, int no){
    if(no == 75) return 1;
    if(i == so.size()) return 0;
    if(memo[i][no] != -1) return memo[i][no];

    int ans = 0;
    for(int j = 0;j <= data[i];j++){
        if(no * (j+1) <= 75){
            ans += dp(i+1, no*(j+1));
        }
    }

    return memo[i][no] = ans;
}

int main(){
    cin >> n;

    int era[120] = {};
    for(int i = 2;i <= n;i++){
        if(era[i] == 0){
            so.push_back(i);
            for(int j = i*2;j <= n;j+=i){
                era[j] = 1;
            }
        }
    }

    for(int i = 2;i <= n;i++){
        int num = i;
        int x = 0;
        while(num > 1){
            if(num % so[x] == 0){
                data[x]++;
                num /= so[x];
            }else{
                x++;
            }
        }
    }

    memset(memo, -1, sizeof(memo));

    cout << dp(0, 1) << endl;

    return 0;
}

Measured memory_bytes: 256
def partition(A, p, r):
    piv = A[r]
    i = p - 1
    for j in range(p, r):
        if A[j] <= piv:
            i += 1
            temp = A[j]
            A[j] = A[i]
            A[i] = temp
    temp = A[i+1]
    A[i+1] = A[r]
    A[r] = temp
    return i + 1

n = int(input())
A = list(map(int,input().split()))
pos = partition(A, 0, n - 1)
val = A[pos]
A.pop(pos)
A.insert(pos, [val])
print(*A)


Measured memory_bytes: 16384
#include<iostream>
#include<vector>
#include<math.h>
#define C(a) cout << a << endl;

using namespace std;
typedef long long int lli;
int main() {
	
	lli N, M,Count=0;
	cin >> N >> M;
	if (N * 2 < M) {
		M=(M -= N*2)/4;
		C(M+N);
	}
	else C(M/2);
	return 0;
}

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

int main(){
    int t, n;
    int p[4] = {6000, 4000, 3000, 2000};
    for(int i = 0; i < 4; i++){
        cin >> t >> n;
        cout << p[t-1]*n << endl;
    }
    return 0;
}



Measured memory_bytes: 3116
let fs = require('fs');

const yourAnswerFunctionComesHere = data => {
  var splitedData = (data.trim()).split(" ").map(Number);
  var sortedData = splitedData.sort((x, y) => y - x);  
  console.log(sortedData.join(" "));
}

const readFile = path => {
  fs.readFile(path, 'utf8', (err, data) => {
    yourAnswerFunctionComesHere(data);
  });
}

const readFileWithoutArg = () => {
  const data = require('fs').readFileSync('/dev/stdin', 'utf8');
  yourAnswerFunctionComesHere(data);
}

let sampleInputPath = "";

if(process.argv.length > 2) {
  sampleInputPath = process.argv[2];
  readFile(sampleInputPath);
} else {
  readFileWithoutArg();
}



Measured memory_bytes: 15140
#include <iostream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <algorithm>
using namespace std;

const int MOD = 1e9+7;
long long int sisu(int x, int y)
{
  long long int ans=1;
  for(int i=0; i < y; i++)
    ans = (ans * x) % MOD;
  return ans;
}
int main()
{
  int N;
  cin >> N;
  vector<int> A(N);
  map<int,int> mp;
  for(int i=0; i < N; i++){
    cin >> A[i];
    if(mp[A[i]] == 0)
      mp[A[i]] = 1;
    else
      mp[A[i]] += 1;
  }
  long long int buf;
  if(N % 2 == 0){
     int ok=0;
     for(int i=1; i < N; i += 2){
       if(mp[i] != 2)
	 ok = 1;
     }
     if(ok == 1)
       cout << 0 << endl;
     else{
       buf = sisu(2,N/2);
       cout << buf << endl;
     }
  }else if (N >= 3){
    int ok = 0;
    for(int i=0; i < N; i += 2){
      if(i != 0 && mp[i] != 2)
	ok = 1;
      else if(i == 0 && mp[i] != 1)
	ok = 1;
    }
    if(ok == 1)
      cout << 0 << endl;
    else{
      buf = sisu(2, (N-1)/2);
      cout << buf << endl;
    }
  }else if(N == 1){
    if(mp[0] == 1)
      cout << 1 << endl;
    else
      cout << 0 << endl;
  }

  return 0;
}


Measured memory_bytes: 4480
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;



int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    char prev_c = s[0];
    int ans = 0;
    FOR(i, 1, s.length() - 1){
        if(prev_c != s[i]) ans++;
        prev_c = s[i];
    }
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define ll long long int
#define pb(x) push_back(x)
#define TEST int inox,t;cin>>t; for(inox=1;inox<=t;inox++)
#define rep(i,n) for(i=0;i<n;i++)
#define repr(i,n) for(i=n-1;i>=0;i--)
#define FAST    ios::sync_with_stdio(false); cin.tie(0);
using namespace std;
#define modd 998244353 
 
int main(){

int n,m; cin>>n>>m;
int i; int a[n];
rep(i,n)cin>>a[i];
int c=0,s=0;
rep(i,n)s+=a[i];
rep(i,n){
    if(a[i]*4*m>=s)c++;
}
if(c>=m)cout<<"Yes";
else cout<<"No";
}

Measured memory_bytes: 256
N = int(input())

A = []
for i in range(N):
    A.append(int(input()))

A.sort()


tmpcount = 1
count = 0
A.append(-1)

for i in range(1,N+1):
    if A[i] == A[i-1]:
        tmpcount += 1
    else:
        if tmpcount % 2 == 1:
            count += 1
        tmpcount = 1

print(count)

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

ans_con = -1
max_con = E/(100+E)*100

a = 0
while F >= 100*A*a:
    b = 0
    while F-100*A*a >= 100*B*b:
        water = 100*(A*a+B*b)
        c = 0
        while F-water >= C*c:
            d = 0
            while F-water-C*c >= D*d:
                sugar = C*c+D*d
                mass = water + sugar
                if 0 < mass <= F:
                    con = sugar/mass*100
                    if ans_con < con <= max_con:
                        ans_con = con
                        ans_mass = mass
                        ans_sugar = sugar
                d += 1
            c += 1
        b += 1
    a += 1

print(int(ans_mass), int(ans_sugar))

Measured memory_bytes: 3064
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AtCoder
{
    class Program
    {
        private static bool Solve(int N, int[] A)
        {
            int cnt1 = 0, cnt2 = 0, cnt4 = 0;
            foreach (int a in A)
            {
                if      (a % 4 == 0) { ++cnt4; }
                else if (a % 2 == 0) { ++cnt2; }
                else                 { ++cnt1; }
            }
            if (cnt2 > 0)
            {
                return cnt4 >= (cnt1 + cnt4 + 1) / 2;
            }
            else
            {
                return cnt4 >= (cnt1 + cnt4) / 2;
            }
        }
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            int[] a = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
            Console.WriteLine(Solve(N, a) ? "Yes" : "No");
        }
    }
}


Measured memory_bytes: 20448
#include <cstdio>

int main()
{
    int n,k,sum,tem;
    while(scanf("%d",&n)==1)
    {
        scanf("%d",&k);
        sum = 0;
        for(int i = 0; i < n; i++)
        {
            scanf("%d", &tem);
            sum += k > 2*tem ? tem : k - tem;
        }
        printf("%d\n",2*sum);
    }
    return 0;
}


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

bool cmp(pair<int,int> a, pair<int,int> b){
    return a.second>b.second;
}

int main(){
    int n;
    cin >> n;
    vector<pair<int,int>> r(n),b(n);
    rep(i,n){
        cin >> r[i].first >> r[i].second;
    }
    sort(r.begin(),r.end());
    rep(i,n){
        cin >> b[i].first >> b[i].second;
    }
    sort(b.begin(),b.end());

    int ans=0;
    map<pair<int,int>,int> used;
    for(int i=0;i<n;i++){
        vector<pair<int,int>> cand;
        for(int j=0;j<n;j++){
            if(b[i].first>r[j].first&&b[i].second>r[j].second){
                if(used.find(r[j])==used.end()){
                    cand.push_back(r[j]);
                }
            }
        }
        sort(cand.begin(),cand.end(),cmp);
        //for(auto x:cand) cout << x.first << "  " << x.second << " ";
        //cout << endl;
        for(auto x:cand){
            if(used.find(x)==used.end()){
                ans++;
                used[x]++;
                break;
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3616
#include <stdio.h>
int main(void){
    int n,a[100000];
    scanf("%d",&n);
    int i;
    int cnt=0;
    int cnt2=0;
    int cnt4=0;
    for(i=0;i<n;i++){
        scanf("%d",&a[i]);
    }
    for(i=0;i<n;i++){
        if(a[i] % 4 == 0){
            cnt2++;
            cnt4++;
        }else if(a[i] % 2 == 0){
            cnt2++;
        }else{
            cnt++;
        }
    }
    if(cnt == 0){
        printf("Yes");
        return 0;
    }
    if(n % 2 == 1 && cnt == cnt4+1){
        printf("Yes");
        return 0;
    }
    if(cnt <= cnt4){
        printf("Yes");
        return 0;
    }
    printf("No");
    return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep1(i, n) for(int i = 1; i <= (int)(n); i++)
#define show(x) for(auto i: x){cout << i << " ";}
#define showm(m) for(auto i: m){cout << m.x << " ";}
typedef long long ll;
typedef pair<int, int> P;
ll gcd(int x, int y){ return y?gcd(y, x%y):x;}
ll lcm(ll x, ll y){ return (x*y)/gcd(x,y);}


int main()
{
    int n;
    cin >> n;
    vector<P> a;
    rep(i, n){ int tmp; cin >> tmp; a.emplace_back(tmp, i+1);}

    sort(a.begin(), a.end());
    rep(i, n){
        cout << a[i].second<< " ";
    }
}



Measured memory_bytes: 1780
#INPUT
#N K

#1≤N≤10^5
#1≤K≤10^5
#入力はすべて整数

#すぬけ君は 1 〜 N の整数が等確率で出る N 面サイコロと表と裏が等確率で出るコインを持っています。
##すぬけ君は、このサイコロとコインを使って今から次のようなゲームをします。
#まず、サイコロを 1 回振り、出た目を現在の得点とする。
#得点が 1 以上 K−1 以下である限り、すぬけ君はコインを振り続ける。
#表が出たら得点は 2 倍になり、裏が出たら得点は 0 になる。
#得点が 0 になった、もしくは K 以上になった時点でゲームが終了する。
#このとき、得点が K 以上である場合すぬけ君の勝ち、
# 0 である場合すぬけ君の負けである。
# N と K が与えられるので、このゲームですぬけ君が勝つ確率を求めてください。

#OUTPUT
#すぬけ君が勝つ確率を出力せよ。
#絶対誤差または相対誤差が 10^−9以下のとき正解とみなされる。

def calcNeedCount(n, k):
    i = 0;
    val = n;
    while (val<=k-1) :
        val = val * 2
        i = i+1
    return i
        

N, K = map(int, input().split())

res = 0.0

for n in range(1, N+1):
    needCount = calcNeedCount(n, K)
    per = (1.0/float(N)) * pow(0.5, needCount)
    res = res + per

print(res)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
const int INF = 1001001001;

int main() {
int N;
string S;
cin >> N >> S;
int a = N;
for (int i = 0;i < N-1;i++) {
    if (S.at(i) == S.at(i+1)) {
        a--;
    }
}
cout << a << endl;

return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#include<cmath>
#define N 100005
#define A 1000005
#define MOD 1000000007 // //100000000 998244353 //
#define inf 1000000000000000000
#define ll long long
//#define M_PI 3.141592653589793238463

using namespace std;

#define pii pair<ll, ll>
#define piii pair<ll, pii>
#define ft first
#define sd second
#define pb push_back
#define rep(i, n) for(ll i = 0; i < n; i++)
#define repr(i, n) for(ll i = n-1; i >= 0; i--)
#define itr(it, x) for(auto it = x.begin(); it != x.end(); it++)
#define mem(a, b) memset(a, (ll)b, sizeof(a))
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()
#define edge(v, x, y) v[x].pb(y); v[y].pb(x);
#define popcount __builtin_popcount
#define ANS(s) {cout << s << "\n"; return;}

//~~~~~~fancy print~~~~~~~//
#define printpii(a) cout << a.ft << " " << a.sd << endl;
#define printpiii(a) cout << a.ft << " " << a.sd.ft << " " << a.sd.sd << endl;
#define print(a, n) rep(i, n) cout << a[i] << " "; cout << endl;
#define printv(v) for(auto x: v)cout << x << " "; cout << endl;
#define printm(a, n, m) rep(i, n) { rep(j, m) cout << a[i][j] << "\t"; cout << endl;}

ll lx[4] = {0, 0, 1, -1};
ll ly[4] = {1, -1, 0, 0};
ll dx[8] = {0, 0, 1, -1, 1, -1, 1, -1};
ll dy[8] = {1, -1, 0, 0, 1, 1, -1, -1};
void fast(){ios_base::sync_with_stdio(false);cin.tie(0);cout << setprecision(12) << fixed;}

void solve(){
    ll n, a, b;
    cin >> n >> a >> b;
    if(b < a || (n == 1 && a!= b)) ANS(0);
    ll ans = (n-1)*b + a;
    ans -= ( (n-1)*a + b );
    cout << ans+1;
}

int main(){
    /*#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif*/
    fast();
    ll t = 1; //cin >> t;
    while(t--){
        solve();
    }
    return 0;
}



Measured memory_bytes: 256
//inlclude before define 
#define _USE_MATH_DEFINES

//include
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<type_traits>
#include<numeric>
#include<assert.h>
#include<deque>
#include<iomanip>
#include<set>
#include<tuple>
#include<map>

using namespace std;

//typedef
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<char> VC;
typedef pair<int, int> P1;
typedef long long int ll;

//define
#define INF 1e9
#define NUM 1000000007
#define all(x) begin(x),end(x)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define REP(i,a,b) for(int i=int(a);i<int(b);i++)
#define chmin(a,b) a=min((a),(b))
#define chmax(a,b) a=max((a),(b))

//function

/*ll gcd(ll a, ll b) {
	if (b == 0) return a;
	else return gcd(b, a%b);
}*/

/*ll lcm(ll a,ll b) {
	ll g = gcd(a, b);
	return a * (b / g);
}*/

/*int dig(int a) {
	int sum = 0;
	while (a) {
		sum += a % 10;
		a /= 10;
	}
	return sum;
}*/


int main () {
	int n, a, b;
	cin >> n >> a >> b;
	VI p (n);

	rep (i, n) cin >> p[i];
	sort (all (p));

	int cnt1 = 0, cnt2 = 0, cnt3 = 0;
	rep (i, n) {
		if (p[i] <= a) {
			cnt1++;
		} else if (a < p[i] && p[i] <= b) {
			cnt2++;
		} else {
			cnt3++;
		}
	}

	cout << min ({ cnt1,cnt2,cnt3 }) << endl;
	
}



Measured memory_bytes: 256
#define ll long long
#include "bits/stdc++.h"
using namespace std;
vector<pair<ll ,ll >>vc;
const int N = 2e5 + 2;
ll arr[N];
int main() {
ll n;
cin>>n;
ll x,y;
cin>>x>>y;
for(int i=x;i<=y;i++)
{
    if(i%n==0)
    {
        cout<<"OK";
        return 0;
    }
}
cout<<"NG";

}

Measured memory_bytes: 3600
#include<stdio.h>
int main(void)
{
	int N,R,A,B;
	scanf("%d %d",&N,&R);
	A=100*(10-N);
	if(N<10){
		B=A+R;
		printf("%d\n",B);
	}
	if(N>=10){
		printf("%d\n",R);
	}
	return 0;
}


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

typedef long long ll;
#define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i)
#define ALL(v) (v).begin(),(v).end()
#define CLR(t,v) memset(t,(v),sizeof(t))
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>&a){return os<<"("<<a.first<<","<<a.second<< ")";}
template<class T>void pv(T a,T b){for(T i=a;i!=b;++i)cout<<(*i)<<" ";cout<<endl;}
template<class T>void chmin(T&a,const T&b){if(a>b)a=b;}
template<class T>void chmax(T&a,const T&b){if(a<b)a=b;}

int nextInt() { int x; scanf("%d", &x); return x;}
ll nextLong() { ll x; scanf("%lld", &x); return x;}


using P = pair<ll, ll>;

const int MAX_N = 112345;
P p[MAX_N];

int main2() {
  int N = nextInt();
  REP(i, N) {
    ll X = nextInt();
    ll L = nextInt();
    p[i] = {X - L, X + L};
  }
  sort(p, p+N, [](const P&a, const P&b){
    if (a.second != b.second) return a.second < b.second;
    return a.first < b.first;
  });
  int ans = 0;
  const ll INF = 1LL << 61;
  ll prev = -INF;
  REP(i, N) {
    if (prev <= p[i].first) {
      ans++;
      prev = p[i].second;
    }
  }
  cout << ans << endl;
  return 0;
}

int main() {

#ifdef LOCAL
  for (;!cin.eof();cin>>ws)
#endif
    main2();
  return 0;
}


Measured memory_bytes: 1792
n, m, Q = [int(i) for i in input().split()]
grid = [[0] * n for i in range(n)]
grid_acc = [[0] * n for i in range(n)]
for i in range(m):
    l, r = [int(i) for i in input().split()]
    grid[l-1][r-1] += 1

grid_acc[0][0] = grid[0][0]
for i in range(1, n):
    grid_acc[i][0] = grid_acc[i-1][0] + grid[i][0]
    grid_acc[0][i] = grid_acc[0][i-1] + grid[0][i]

for i in range(1, n):
    for j in range(1, n):
        grid_acc[i][j] = grid_acc[i-1][j] + grid_acc[i][j-1] - grid_acc[i-1][j-1] + grid[i][j]

for i in range(Q):
    p, q = [int(i) for i in input().split()]
    if p == 1:
        print(grid_acc[q-1][q-1])
    else:
        print(grid_acc[q-1][q-1] - grid_acc[p-2][q-1] - grid_acc[q-1][p-2] + grid_acc[p-2][p-2])
    

Measured memory_bytes: 20568
n=int(input())
a=[int(input())-1 for _ in range(n)]
id=[-1]*n
x=0
for c in range(1,n+1):
    if id[x]!=-1:
        print(-1)
        exit()
    id[x]=c
    x=a[x]
    if x==1:
        print(c)
        exit()

Measured memory_bytes: 16832
#include <iostream>
#include <string>

using namespace std;

int main()
{
    while(1 == 1){
        int a,b;
    string op;
    int result;
        cin >> a >> op >> b;
    if(op == "?") break;
    if(op == "+"){
        result = a + b;
        cout << result << endl;
    }
    if(op == "-"){
        result = a - b;
        cout << result << endl;
    }
    if(op == "*"){
        result = a * b;
        cout << result << endl;
    }
    if(op == "/"){
        result = a / b;
        cout << result << endl;
    }
    }
        
}

Measured memory_bytes: 1208
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#include <fstream>
#include <string>
#include <math.h>
#include <cstdlib>
#include <cstdint>
#include <istream>
#include <sstream>
#include <cctype>
#include <functional>
#include <iomanip>
#define rep(i,N) for(ll i=0;i<N;i++)
#define disp(a) cout << a << endl;
#define PI 3.1415926535897932384626433
//cout << fixed << setprecision(20) << ** << endl;
typedef long long ll;
using namespace std;

double deg2rad(double degree)
{
    return degree * PI / 180.0000000000;
}
int main()
{
	string s,ANS="Yes";
	cin>>s;
	if(s.size()%2!=0){
		cout<<"No"<<endl;
	}
	else{
		for(int i=0;i<s.size();i=i+2){
			if(s[i]=='h'&&s[i+1]=='i'){
				continue;
			}
			else{
				ANS="No";
			}
		}
		cout<<ANS<<endl;
	}

}

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

int pn(int);

int main() {

  int a,i,number,count=0;

  scanf("%d",&a);

  for(i=0;i<a;i++) {
    scanf("%d",&number);
    count+=pn(number);
  }

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

  return 0;

}


int pn(int a) {

  int i=3;

  if(a<2) return 0;
  else if(a==2) return 1;
  else if(a%2==0) return 0;

  while(i<=sqrt(a)) {
    if(a%i==0) return 0;
    i+=2;
  }

  return 1;

}


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

using namespace std;

int main(void)
{
    constexpr int N = 26;
    int D;
    cin >> D;

    int c[N];
    for(auto& c_ : c)
    {
        cin >> c_;
    }

    int s[D][N];
    for(auto& s_ : s)
    {
        for (auto &s__ : s_)
        {
            cin >> s__;
        }
    }

    int t[D];
    for(auto& t_ : t)
    {
        cin >> t_;
    }

    {
        int score = 0;
        int last[N]{};
        for(int i = 0; i < D; ++i)
        {
            int select = t[i] - 1;
            score += s[i][select];
            last[select] = i + 1;
            for(int j = 0; j < N; ++j)
            {
                score -= c[j] * (i + 1 - last[j]);
            }
            cout << score << endl;
        }
    }

    return 0;
}

Measured memory_bytes: 3636
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<iostream>
#include<queue>
#include<vector>
#include <bitset>
#include <cmath>
#include <limits>
#include <iostream>
#include<set>
using namespace std;
#define INF 11000000000
#define MAX 100000
#define MOD 1000000007
typedef long long ll;
typedef pair<int,int> P;
typedef pair<pair<int,int>,int> p;
typedef pair< pair<int,int>, int> p; 
#define bit(n,k) ((n>>k)&1) /*nのk bit目*/
#define rad_to_deg(rad) (((rad)/2/M_PI)*360)

int main(){
    string S;
    cin>>S;
    int ans=(int)S.size();
    for(int i=0;i<(int)S.size()-1;i++){
        if(S[i]!=S[i+1]) ans=min(ans,max(i+1,(int)S.size()-(i+1)));
    }
    cout<<ans<<endl;
}



Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
int main(){
  string s;
  cin>>s;
  for(int i=0;i<s.size();i++){
    if(s.at(i)=='C'){
      for(int j=i+1;j<s.size();j++){
        if(s.at(j)=='F'){
          cout<<"Yes";
          return 0;
        }
      }
      break;
    }
  }
  cout<<"No";
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <vector>

using namespace std;

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

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

    sort(l.begin(), l.end());

    int res = 0;
    for (int i = 0; i < n; i++) {
        for (int j = i + 1; j < n; j++) {
            vector<int>::iterator low = lower_bound(l.begin() + j + 1, l.end(), max(l[i] - l[j], l[j] - l[i])),
                    high = lower_bound(l.begin() + j + 1, l.end(), l[i] + l[j]);
            if (low != l.end()) {
                res += high - low;
            }
        }
    }

    cout << res << endl;
}


Measured memory_bytes: 256
import sys

primes = [1] * 500000
primes[0] = 0

for i in range(3, 1000, 2):
    if primes[i // 2]:
        primes[(i * i) // 2::i] = [0] * len(primes[(i * i) // 2::i])

for i in sys.stdin:
    n = int(i)
    if n < 4:
        print(n - 1)
    else:
        print(sum(primes[:(n + 1) // 2]) + 1)




Measured memory_bytes: 15008
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	string s;
	cin >> s;
	if((int)s.size() == 1) {
		cout << s << endl;
	}
	else {
		ll ans = 0;
		int limit = 1<<((int)s.size()-1);
		for(int state=0;state<limit;state++) {
			int tem = state;
			ll now = 0;
			for(int idx=0;idx<(int)s.size();idx++) {
				now = now * 10 + s[idx] - '0';
				if(tem&1) {
					ans += now;
					now = 0;					
				}
				tem >>= 1;
			}
			ans += now;
		}
		cout << ans << endl;
	}
	return 0;
}


Measured memory_bytes: 256
<?php
$n_k = explode(" ", (trim(fgets(STDIN))));
$h = explode(" ", (trim(fgets(STDIN))));

$count = 0;
for ($i = 0; $i < $n_k[0]; $i++) {
     if($h[$i] >= $n_k[1]){
         $count++;
     }
}

echo $count;

Measured memory_bytes: 12792
def main():
    s = input().split()
    stack = []
    for c in s:
        if c == '+':
            a = stack.pop()
            b = stack.pop()
            stack.append(a + b)
        elif c == '-':
            a = stack.pop()
            b = stack.pop()
            stack.append(b - a)
        elif c == '*':
            a = stack.pop()
            b = stack.pop()
            stack.append(a * b)
        else:
            stack.append(int(c))
    print(stack[-1])

if __name__ == '__main__':
    main()


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

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.setf(ios::fixed);
    cout.precision(3);
    int n;
    cin>>n;
    for(int i=0; i<n; i++){
        double x1, y1, x2, y2, x3, y3;
        cin>>x1>>y1>>x2>>y2>>x3>>y3;
        double m=(y1*(x2-x3)+y2*(x3-x1)+y3*(x1-x2))*2;
        double cx=(x1*x1+y1*y1)*(y2-y3) +(x2*x2+y2*y2)*(y3-y1) +(x3*x3+y3*y3)*(y1-y2);
        double cy=(x1*x1+y1*y1)*(x2-x3) +(x2*x2+y2*y2)*(x3-x1) +(x3*x3+y3*y3)*(x1-x2);
        double x=-cx/m;
        double y=cy/m;
        double r=sqrt((x1-x)*(x1-x)+(y1-y)*(y1-y));
        cout<<x<<' '<<y<<' '<<r<<'\n';
    }
    return 0;
}

Measured memory_bytes: 3228
#define _CRT_SECURE_NO_WARNINGS

#include <algorithm>
#include <iostream>
#include <math.h>
#include <cmath>
#include <iterator>
#include <unordered_map>
#include <unordered_set>
#include <functional>
#include <string.h>
#include <cstring>
#include <queue>
#include <iomanip>
#include <istream>
#include <map>
#include <list>
#include <stack>
#include <numeric>
#include <ostream>
#include <set>
#include <cassert>
#include <sstream>
#include <string>
#include <utility>
#include <stdio.h>
#include <bitset>
#include <vector>
#include <random>

using namespace std;

#define dout if (debug) cout
#define PB push_back
#define MP make_pair
#define ALL(x) (x).begin(),(x).end()
#define SZ(x) (int((x.size())))

typedef long double ld;
typedef long long ll;
typedef vector<int> VI;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
typedef vector<ll> VL;
typedef vector<PLL> VPL;
typedef vector<PII> VPI;

#define REP(i,a,n) for (int i=a;i<n;i++)
#define PER(i,a,n) for (int i=n-1;i>=a;i--)
#define db(x)		 cerr << #x << " = " << x << endl
#define db2(x, y)	{cerr << #x << " = " << x << "\t";	db(y);		}
#define db3(x, y, z){cerr << #x << " = " << x << "\t";	db2(y,z);	}

template <typename t1, typename t2> inline bool upmax(t1 &a, t2 b) { if (a<(t1)b) { a = (t1)b; return true; } else return false; }
template <typename t1, typename t2> inline bool upmin(t1 &a, t2 b) { if (a>(t1)b) { a = (t1)b; return true; } else return false; }
template <typename T>inline bool pal(T &x){ int n = SZ(x); REP(i, 0, n / 2) { if (x[i] != x[n - i - 1]) return 0; } return 1; }
template <typename T>inline T gcd(T a, T b) { return b ? gcd(b, a%b) : a; }
template <typename T>inline T lcm(T a, T b) { return a*(b / gcd(a, b)); }
template <typename T>inline T sqr(T a) { return a*a; }

int month[] = { 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
int dx[] = { 1, 0, -1, 0, 1, 1, -1, -1 };
int dy[] = { 0, 1, 0, -1, 1, -1, 1, -1 };

inline ll mp(ll a, ll b) { return (a << 31) + b; }

class PQ_compare{
public:
	bool operator()(const int a, const int b) const {
		return 1;
	}
};

const int INF = 1000000404;
const ll  MOD = 1000000007ll;
const ld  PI = acos(-1.0);
const ld  EPS = 1e-9;

int SQ = 404;

#define debug 1
#define N 111111
int a[N];
int b[N];

void solve()
{
	int n;
	cin >> n;
	ll s1 = 0;
	ll s2 = 0;
	REP(i, 0, n) {
		cin >> a[i];
		s1 += a[i];
	}
	REP(i, 0, n) {
		cin >> b[i];
		s2 += b[i];
	}
	if (s2 < s1) {
		cout << "No";
		return;
	}
	ll x = s2 - s1;
	ll y = x;
	db(x);
	REP(i, 0, n) {
		int f = (max(0, b[i] - a[i])+1) / 2;
		x -= f;
		a[i] += f + f;
		f = a[i] - b[i];
		y -= f;
		b[i] += f;
	}
//	REP(i, 0, n) cout << a[i] << ' '; cout << endl;
//	REP(i, 0, n) cout << b[i] << ' '; cout << endl;
//	db2(x, y);

	if (x>-1&& y>-1&&x*2==y) cout << "Yes"; else cout << "No";
	//cout << "Yes";

}

int main()
{


	//freopen("codeforces.in", "r", stdin);
	//freopen("codeforces.out", "w", stdout);
	ios_base::sync_with_stdio(false);	cin.tie(0);	cout.tie(0);
	int t = 1;

	//cin >> t;

	while (t--) solve();
	getchar();
	getchar();
	return 0;
}

Measured memory_bytes: 384
week = ['SUN','MON','TUE','WED','THU','FRI','SAT']

s=input()

if s =='SUN':
    print(7) 
elif s =='MON':
    print(6)
elif s =='TUE':
    print(5)
elif s =='WED':
    print(4)
elif s =='THU':
    print(3)
elif s =='FRI':
    print(2)
elif s =='SAT':
    print(1)

Measured memory_bytes: 3060
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;

public class Main {
    public static void main(String[] args) {
        InputReader in = new InputReader(System.in);
        PrintWriter out = new PrintWriter(System.out);

        int n = in.nextInt();
        int[] a = new int[n+2];
        for (int i = 0; i < n ; i++) {
            a[i+1] = in.nextInt();
        }

        long sum = 0;
        for (int i = 1 ; i <= n+1 ; i++) {
            sum += Math.abs(a[i] - a[i-1]);
        }

        for (int i = 1 ; i <= n; i++) {
            long rm = Math.abs(a[i-1] - a[i]) + Math.abs(a[i+1] - a[i]);
            long ad = Math.abs(a[i-1] - a[i+1]);
            out.println(sum - rm + ad);
        }
        out.flush();
    }

    public static void debug(Object... o) {
        System.err.println(Arrays.deepToString(o));
    }

    public static class InputReader {
        private static final int BUFFER_LENGTH = 1 << 12;
        private InputStream stream;
        private byte[] buf = new byte[BUFFER_LENGTH];
        private int curChar;
        private int numChars;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        private int next() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public char nextChar() {
            return (char) skipWhileSpace();
        }

        public String nextToken() {
            int c = skipWhileSpace();
            StringBuilder res = new StringBuilder();
            do {
                res.append((char) c);
                c = next();
            } while (!isSpaceChar(c));
            return res.toString();
        }

        public int nextInt() {
            return (int) nextLong();
        }

        public long nextLong() {
            int c = skipWhileSpace();
            long sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = next();
            }
            long res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = next();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public double nextDouble() {
            return Double.valueOf(nextToken());
        }

        int skipWhileSpace() {
            int c = next();
            while (isSpaceChar(c)) {
                c = next();
            }
            return c;
        }

        boolean isSpaceChar(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }
    }
}

Measured memory_bytes: 31552
using System;

namespace algo
{
    class Program
    {
        static void Main(string[] args)
        {
            var s = Console.ReadLine();
            int N = Int32.Parse(s);
            long sum = 0;
            for(int i = 1; i < N+1; ++i){
                if(i % 3 == 0 || i % 5 == 0) continue;
                sum += i;
            }
            Console.WriteLine(sum);
        }
    }
}


Measured memory_bytes: 27480
n = int(input())
s = input().strip()
t = input().strip()
is_match = False
for i in range(len(s)):
  if s[i:] == t[:n-i]:
    is_match = True
    break
if is_match:
  print(len(s[:i] + t))
else:
  print(len(s + t))


Measured memory_bytes: 2940
package main

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

var sc = bufio.NewScanner(os.Stdin)

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

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

func reverse(s string) string {
	runes := []rune(s)
	for i, j := 0, len(runes)-1; i < j; i, j = i+1, j-1 {
		runes[i], runes[j] = runes[j], runes[i]
	}
	return string(runes)
}

func main() {
	sc.Split(bufio.ScanWords)
	buf := make([]byte, 10000)
	sc.Buffer(buf, 1000000)

	n, q := nextInt(), nextInt()
	a := nextLine()

	s := strings.Split(a, "")
	ac := []string{"A", "C"}

	b := make([]int, n+1)
	for i := 1; i <= n-1; i++ {
		if ac[0] == s[i-1] && ac[1] == s[i] {
			b[i] = b[i-1] + 1
		} else {
			b[i] = b[i-1]
		}
	}
	
	for i := 0; i < q; i++ {
		sum := 0
		x, y := nextInt(), nextInt()
		sum = b[y-1] - b[x-1]

		fmt.Println(sum)
	}
}


Measured memory_bytes: 5504
main(){int i,j,s,p[5];scanf("%d %d %d %d %d",&p[0],&p[1],&p[2],&p[3],&p[4]);for(i=0;i<4;i++){for(j=i+1;j<5;j++)if(p[i]<p[j]){s=p[i];p[i]=p[j];p[j]=s;}printf("%d ",p[i]);}printf("%d\n",p[4]);return 0;}

Measured memory_bytes: 0
#include <iostream>
#include <cmath>
#include <cstdio>

using namespace std;

int main(void){
    int n,i;
    double a[100],b[100],c[100];
    cin>>n;
    for(i=0;i<n;i++){
        cin>>a[i];
    }
    for(i=0;i<n;i++){
        cin>>b[i];
    }
    for(i=0;i<n;i++){
        c[i]=abs(a[i]-b[i]);
    }
    
    double d=0;
    for(i=0;i<n;i++){
        d+=c[i];
    }
    printf("%.6lf\n",d);
    d=0;
    for(i=0;i<n;i++){
        d+=pow(c[i],2);
    }
    printf("%.6lf\n",sqrt(d));
    d=0;
    for(i=0;i<n;i++){
        d+=pow(c[i],3);
    }
    printf("%.6lf\n",pow(d,1.0/3));
    d=0;
    for(i=0;i<n;i++){
        if(d<c[i]) d=c[i];
    }
    printf("%.6lf\n",d);
    

    return 0;
}


Measured memory_bytes: 3404
#include <bits/stdc++.h>
using namespace std;
using vi  = vector<int>;
using ii  = pair<int,int>;
using vii = vector<ii>;
using ll  = long long;

#define F first
#define S second
#define PB push_back
#define EB emplace_back
#define ALL(x) (x).begin(), (x).end()
#define SIZE(x) int((x).size())
#define REP(i, a, b) for (auto (i) = (a); (i) <= (b); (i)++)
#define PER(i, a, b) for (auto (i) = (a); (i) >= (b); (i)--)
#define ITR(i, x) for (auto (i) = (x).begin(); (i) != (x).end(); (i)++)

string to_string(string s) { return '\"' + s + '\"'; }
string to_string(const char* s) { return to_string((string) s); }
string to_string(bool b) { return (b ? "true" : "false"); }
template <typename A, typename B> string to_string(pair<A,B> p)
{ return "(" + to_string(p.F) + ", " + to_string(p.S) + ")"; }
template <typename T> string to_string(T v) {
	int f = 0; string res = "{";
	for (const auto &x: v)
		res += (f++ ? ", " : "") + to_string(x);
	return res + "}";
}
void debug_out() { cerr << "]\n"; }
template <typename T, typename... V>
void debug_out(T a, V... v)
{ cerr << to_string(a); if (sizeof...(v)) cerr << ", "; debug_out(v...); }

#ifdef LOCAL // add -DLOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "] = [", debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif // debug(var1, var2, ...);

priority_queue<int> pqL, pqR;
vector<tuple<int,int,int>> vL, vR;

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

	int t; cin >> t;
	while (t--)
	{
		vL.clear(); vR.clear();
		while (!pqL.empty()) pqL.pop();
		while (!pqR.empty()) pqR.pop();
		int n; cin >> n;

		ll ans = 0;
		REP(i, 0, n-1)
		{
			int k, l, r;
			cin >> k >> l >> r;
			if (l == r)
				ans += l;
			if (l > r)
				vL.EB(k, r-l, r);
			if (l < r)
				vR.EB(n-k, l-r, l);
		}
		sort(ALL(vL));
		sort(ALL(vR));

		for (auto x: vL)
		{
			int k, diff, add;
			tie(k, diff, add) = x;
			diff = -diff;
			ans += diff+add;
			pqL.push(-diff);
			if (k < SIZE(pqL))
			{
				ans += pqL.top();
				pqL.pop();
			}
		}
		for (auto x: vR)
		{
			int k, diff, add;
			tie(k, diff, add) = x;
			diff = -diff;
			ans += diff+add;
			pqR.push(-diff);
			if (k < SIZE(pqR))
			{
				ans += pqR.top();
				pqR.pop();
			}
		}
		cout << ans << '\n';
	}
	return 0;
}

Measured memory_bytes: 6900
#include<queue>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
const int N=300;
inline int read(){
	int x=0; char ch=getchar();
	while(!isdigit(ch)) ch=getchar();
	for(;isdigit(ch);ch=getchar()) x=(x<<3)+(x<<1)+(ch^48);
	return x;
}

int n;
char s[N];
int mp[N],ch[N],sig=62;
struct node{
	char s[N]; int len; node(){memset(this,0,sizeof(node));}
	node(char *c,int y){memcpy(s,c,sizeof(s));len=y;}
	inline bool friend operator < (node a,node b){return a.len>b.len;}
};
inline bool check(node &x){
	printf("? %s\n",x.s);
	fflush(stdout);
	return read()==n-x.len;
}
inline void ins(char *s,int pos,char x,int len){
	for(int i=len;i>pos;--i) s[i]=s[i-1]; s[pos]=x;
}
inline node merge(node &x,node &y){
	node ans; ans=x;
	for(int i=0,j=0;i<y.len;++i){
		++ans.len;
		node rec=ans;
		for(int pos=j;pos<ans.len;++pos){
			ins(ans.s,pos,y.s[i],ans.len);
			if(!check(ans)) ans=rec;
			else{j=pos+1;break;}
		}
	}
	return ans;
}

priority_queue<node>Q;
int main(){
	for(int i=0;i<10;++i) ch[i]='0'+i;
	for(int i=10;i<36;++i) ch[i]='a'+i-10;
	for(int i=36;i<62;++i) ch[i]='A'+i-36;
	for(int i=0;i<62;++i) mp[ch[i]]=i;
	n=233;
	for(int i=0;i<62;++i){
		printf("? %c\n",ch[i]);
		fflush(stdout);
		n=min(n,read());
	}
	++n;
	for(int i=0;i<62;++i){
		printf("? ");
		for(int j=0;j<n;++j) printf("%c",ch[i]); puts(""); fflush(stdout);
		int w=n-read(); if(!w) continue; memset(s,0,sizeof(s));
		for(int j=0;j<w;++j) s[j]=ch[i]; Q.push(node(s,w));
	}
	while(Q.size()>1){
		node x=Q.top(); Q.pop();
		node y=Q.top(); Q.pop();
		Q.push(merge(x,y));
	}
	printf("! %s\n",Q.top().s);
	return 0;
}

Measured memory_bytes: 3808
#include<bits/stdc++.h>
      using namespace std;
      #define ll long long
      #define pb push_back
      #define pll  pair <long long,long long>
      #define mp make_pair
      #define ss second
      #define ff first
      #define maa 1000000007
      #define endl '\n'
      #define ld long double
      #define all(x) x.begin(),x.end()
      ll  power(ll  i,ll  j)
      {
        if(j==0)
        return 1 ;
        ll t=power(i,j/2)%maa ;
        if(j%2==0)
        return (t%maa*t%maa)%maa ;
        else
        return ((t%maa*t%maa)%maa*(i%maa)%maa)%maa ;
      }
      bool is(ll  i)
      {
        if(i==1)
            return 0 ;
        ll  f=0 ;
        for(ll  j=2;j<=sqrt(i);j++)
        {
            if(i%j==0)
            {
                f=1 ;
                break ;
            }
        }
        return !f ;
      }
      ll n ;
      vector<ll>v[100001] ;
      ll dp[100001][2] ;
      ll fun(ll i,ll c,ll p)
      {
          if(dp[i][c]!=-1)
          return dp[i][c] ;
          else
          {
              ll ans=1 ;
              if(c==0)
              {
                  for(ll j:v[i])
                  {
                      if(j==p)
                      continue ;
                      
                      ans*=(fun(j,1,i)+fun(j,0,i))%maa ;
                      ans%=maa ;
                  }
              }
              else
              {
                   for(ll j:v[i])
                  {
                      if(j==p)
                      continue ;
                      
                      ans*=(fun(j,0,i))%maa ;
                      ans%=maa ;
                  }
              }
              return dp[i][c]=ans%maa ;
          }
      }
      int main()
      {

        /// 50-4
        /// freopen("input.txt","r",stdin);
        /// freopen("output.txt","w",stdout);
        cin>>n ;
        for(ll i=0;i<n-1;i++)
        {
            ll x,y ;
            cin>>x>>y ;
            v[x].pb(y) ;
            v[y].pb(x) ;
        }
        for(ll i=0;i<=n;i++)
        {
            dp[i][0]=-1  ;
            dp[i][1]=-1 ;
            
        }
        ll ans=(fun(1,1,-1)+fun(1,0,-1))%maa ;
        cout<<ans<<endl ;
       
        
        

      }








Measured memory_bytes: 14208
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#define cs ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define rep(i,b)  for(int i=0;i<(int)(b);i++)
#define Rep(i,n) for(int i=1;i<(int)(n);i++)
#define repp(i,a,b)  for(int i=a;i<=(int)(b);i++)
#define Repp(i,a,b)  for(int i=a;i>=(int)(b);i--)
using namespace std;

int main(){
    cs;
    int n,k,c,t=0,it=0;string s;
    cin>>n>>k>>c>>s;
    vector<int> v(k);
    while(t<k){
        if(s[it]=='o') {v[t]=it;t++;it+=c+1;}
        else it++;
    }
    t=k-1;it=n-1;
    while(t>=0){
        if(s[it]=='o') {if(v[t]!=it) v[t]=-1;t--;it-=c+1;}
        else it--;
    }

    rep(i,k) if(v[i]!=-1) cout<<v[i]+1<<'\n';

}

Measured memory_bytes: 2580
#include<bits/stdc++.h>
using namespace std;
#define mod 1000000009
#define ll long long
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define set0(a) memset ((a), 0 , sizeof(a))
#define set1(a) memset((a),-1,sizeof (a))
#define pi pair<int, int>
#define ps pair<string, string>
#define pl pair<long, long>
#define pll pair<long long, long long>
#define vll vector<long long>
#define vl vector<long>
#define vi vector<int>
#define vs vector<string>
#define vps vector< ps >
#define vpi vector< pi >
#define vpl vector< pl >
#define vpll vector< pll >
#define flash  ios_base::sync_with_stdio(false); cin.tie(NULL);
#define tc(t,T) for(long long t=0;t<T;t++)
#define rep(i,s,n,d) for(long long i=s;i<n;i=i+d)

bool sortbysec(const pll &a,
              const pll &b)
{
    return (a.second < b.second);
}
/*bool cxp pair<ll, pll> &a,
              const pair<ll, pll> &b)
{
    return (a.ff < b.ff);
}*/

void func(void)
{
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
}
ll gcd(ll a,ll b){
    if(b==0)return a;
    else return gcd(b,a%b);
}
void printStack(stack<string> s){
    if(s.empty())return;

    string x=s.top();
    s.pop();
    printStack(s);
    cout<<x;
    s.push(x);

}


ll binaryexp(ll n,ll p){

    if(p==0) return 1;
    if(p%2==0) return binaryexp((n%mod)*(n%mod),p/2);
    else return ((n%mod)*binaryexp(((n%mod)*(n%mod))%mod,(p-1)/2)%mod);

}

#define meax 10000001
vll spf(meax,0);
void siv(){
    spf[1]=1;

   for(ll i=2;i<meax;i++)spf[i]=i;

   for(ll i=4;i<meax;i+=2){
        spf[i]=2;
    }
    for(ll i=3;i*i<meax;i++){
        if(spf[i]==i){
            for(ll j=i*i;j<meax;j+=i){
                if(spf[j]==j){
                    spf[j]=i;
                }
            }
        }
    }
}
ll dp[2][10001]={};
 ll a[2][10001];
    ll dcx(ll i,ll j,ll n){


     if(i>=2 || j>=n)return 0;
     if(dp[i][j]!=0)return dp[i][j];
     if(i==n-1 && j==1){
            dp[i][j]=a[i][j];
            return a[i][j];
     }
     ll d1=dcx(i+1,j,n);
     ll d2=dcx(i,j+1,n);
     dp[i][j]=a[i][j]+max(d1,d2);
     return dp[i][j];
    }
int main(){
        ll n;
        cin>>n;

        rep(i,0,n,1){
            cin>>a[0][i];
        }
         rep(i,0,n,1){
            cin>>a[1][i];
        }
        cout<<dcx(0,0,n)<<endl;

}


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

using namespace std;
typedef long long ll;

#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, a, b) for (int i = (a); i < (b); ++i)
#define all(a) (a).begin(), (a).end()
#define all2(a, b) (a).begin(), (a).begin() + (b)
#define debug(vari) cerr << #vari << " = " << (vari) << endl;

char *demangle(const char *demangle)
{
    int status;
    return abi::__cxa_demangle(demangle, 0, 0, &status);
}

int main()
{
    int N;
    string S, T;
    cin >> N >> S;

    string ans = "";
    rep(i, S.size())
    {
        S[i] = (S[i] - 'A' + N) % 26 + 'A';
    }
    cout << S << endl;
    return 0;
}


Measured memory_bytes: 256