akhauriyash/Code-Regression huggingface dataset:
"use strict";
    
const main = arg => {
    arg = arg.trim().split("\n");
    const N = parseInt(arg[0].split(" ")[0]);
    
    const map = Array(1e5).fill(0);
    
    for(let i=1; i<=N; i++) {
        if(Math.pow(i, 2) > N) break;
        
        for(let j=1; j<=i; j++) {
            //if(Math.pow(i, 2) + Math.pow(i, 2) > N) break;
            
            for(let k=j; k<=i; k++) {
                const temp = Math.pow(i, 2) + Math.pow(j, 2) + Math.pow(k, 2) + (i * j) + (i * k) + (j * k);
                
                // console.log("i:" + i);
                // console.log("j:" + j);
                // console.log("k:" + k);
                
                if(i === j && j === k) {
                    map[temp]++;
                    // console.log(temp + "を+1");
                } else if(i !== j && j !== k && i !== k) {
                    map[temp] += 6;
                    // console.log(temp + "を+6");
                } else {
                    map[temp] += 3;
                    // console.log(temp + "を+3");
                }
                // console.log("----");
            }            
        }
    }
    
    let answer = [];
    
    for(let i=1; i<=N; i++) {
        answer.push(map[i]);
    }
    
    console.log(answer.join("\n"));
    //console.log(map);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 34060
import java.util.*;

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

		int XA = sc.nextInt();
		int YB = sc.nextInt();
		int YC = sc.nextInt();
		int YD = sc.nextInt();
		int P = sc.nextInt();
		
		XA*=P;
		
		if(P > YC) {
			YB+=YD * (P - YC);
		}
		
		if(YB > XA) {
			System.out.println(XA);
		} else {
			System.out.println(YB);
		}
	}
}

Measured memory_bytes: 26252
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0; i<n; i++)
using namespace std;
int main()
{
string L[]={"SUN","MON","TUE","WED","THU","FRI","SAT"};
string s;
cin>>s;
rep(i,7)
  {
if(s==L[i])
    {
    cout<<7-i<<endl;
    }
  }
return 0;
}

Measured memory_bytes: 3608
#include <iostream>
#include <string>
#include <cstdlib>
#include <cstdio>
#include <queue>
#include <stack>
#include <list>
#include <utility>
#include <vector>
#include <set>
#include <algorithm>
#include <cmath>
#include <climits>
#include <map>
#include <unordered_map>
#include <string.h>
#include<iomanip>
#include <iterator>
#include <locale>

#define all(a) a.begin(),a.end()
#define VV(T) vector<vector< T > >
#define rep(i,N) for(int i = 0; i <N; i++)
#define repsg(i,s,g) for(int i = s; i <g; i++)
#define name(x) #x


using namespace std;

const int INF = INT_MAX;
const long long INFL = 1LL<<40;
const double PI = atan(1)*4;
const long long MOD = pow(10,9)+7;
int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};

typedef long long ll,LL;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;
typedef pair<int,int> pii;
typedef pair<LL, LL> pLL;


// vector入力
template<typename T>
istream& operator >> (istream& is, vector<T>& vec){
    for(T& x: vec) is >> x;
    return is;
}
// vector出力
template<typename T>
ostream& operator << (ostream& os, vector<T>& vec){
    for(int i=0; i<vec.size(); i++){
        os << vec[i] << ( i+1 == vec.size() ? "" : " " );
    }
    return os;
}

int cnt[128];
int main() {
    int h,w;cin>>h>>w;
    vector<string> a(h);
    rep(i,h){
        cin>>a[i];
    }
    
    rep(i,h){
        rep(j,w){
            cnt[a[i][j]]++;
        }
    }
    
    int g1,g2,g4;
    g1 = h%2 * w%2;
    g2 = h%2 * (w/2) + w%2 * h/2;
    g4 = h/2 * w/2;
    
    for(auto a = 'a'; a<='z';a++){
        
        int g = cnt[a]/4;
        g  =min(g,g4);
        g4-=g;
        cnt[a]-=g*4;
        g = cnt[a]/2;
        g = min(g,g2);
        g2 -=g;
        cnt[a]-=g*2;
        g = cnt[a];
        g=min(g,g1);
        g1-=g;
        cnt[a] -=g;
        
        if(cnt[a]!=0){
            cout<<"No"<<endl;
            return 0;
        }
        
        
        
        
    }
    cout<<"Yes"<<endl;
    
    
    return 0;
}





Measured memory_bytes: 256
n,k=map(int,input().split())
lst1=list(map(lambda x: x+1,range(n)))
lst2=[]
for i in range(k):
    d = int(input())
    r = list(map(int,input().split()))
    lst2 = lst2 + r
lst2 = list(set(lst2))
for i in lst2:
    lst1.remove(i)
print(len(lst1))

Measured memory_bytes: 9096
/**
*    created: 12.06.2020 17:42:06
**/
#include <bits/stdc++.h>
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
using namespace std;

signed main() {

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

    string s;
    cin >> s;
    int n = s.size();
    vector<int> c, m;
    rep(i,n-1) {
        if (s[i] == 'R' && s[i+1] == 'L') c.push_back(i);
        if (s[i] == 'L' && s[i+1] == 'R') m.push_back(i);
    }
    m.push_back(n-1);
    vector<int> ans(n); //答え格納
    int l = c.size();
    rep(i,l) {
        int cnt;
        if (i == 0) cnt = m[i] + 1;
        else cnt = m[i] - m[i-1];

        if (cnt % 2 == 0) {
            ans[c[i]] = cnt / 2;
            ans[c[i]+1] = cnt / 2;
        }
        else {
            if (m[i] % 2 == c[i] % 2) {
                ans[c[i]] = cnt / 2 + 1;
                ans[c[i]+1] = cnt / 2;
            }
            else {
                ans[c[i]] = cnt / 2;
                ans[c[i]+1] = cnt / 2 + 1;
            }                            
        }
    }
    rep(i,ans.size()) {
        if (i == 0) cout << ans[i];
        else cout << " " << ans[i];
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 2372
def read_input():
    h, w, a, b = map(int, input().split())
    return h, w, a, b


# xの階乗 mod 10**9 + 7 について、1~nまでの結果を辞書にして返す
def factorial_table(n):
    result = {0:1}

    curr = 1
    acc = 1
    modmax = (10**9) + 7
    while curr <= n:
        acc *= curr
        acc %= modmax
        result[curr] = acc
        curr += 1

    return result


# xの逆元 mod 10**9 + 7を求める
def reverse_mod(x):
    return power_n(x, 10**9 + 5)


# xのn乗 mod 10**9 + 7を求める
def power_n(x, n):
    r = 1
    curr_a = x
    modmax = (10 ** 9) + 7
    while n:
        if 1 & n:
            r *= curr_a
            r %= modmax

        n = n >> 1
        curr_a *= curr_a
        curr_a %= modmax

    return r


def comb(x, y, factorial_dic):
    return factorial_dic[x] * reverse_mod(factorial_dic[y]) * reverse_mod(factorial_dic[x - y])


def path(s, e, factorial_dic, modmax):
    x = e[0] - s[0]
    y = e[1] - s[1]

    return comb(x + y, x, factorial_dic) % modmax


def submit():
    h, w, a, b = read_input()
    f_dic = factorial_table(h + w - 2)
    count = 0
    modmax = 10**9 + 7
    for i in range(h - a):
        count += path((0, 0), (i, b - 1), f_dic, modmax) * path((i, b), (h - 1, w - 1), f_dic, modmax)
        count %= modmax

    print(count)

if __name__ == '__main__':
    submit()


Measured memory_bytes: 64368
#include <iostream>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdlib>
#include <string>
#include <cstring>
#include <cmath>
#include <climits>
#include <ctime>
#define endl '\n'
#define ll long long
#define mod 1000000007
#define NCONS 1000000000
//#define NCONS 100001
//#define NCONS 1001
//#define NCONS 101
#define MCONS 2001
#define LIMIT 1000000000
#define TRUE 1
#define FALSE 0
#define toRadian(degree) ((degree) * (M_PI / 180.))
#define toDegree(radian) ((radian) * (180. / M_PI))
using namespace std;
struct Point{int x; int y;};

int main(void)
{
    cin.tie(NULL); ios_base::sync_with_stdio(false);
    int a, b, c; cin >> a >> b >> c;
    if(a + b >= c)
        cout << "Yes";
    else
        cout << "No";
    
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main (){
  int N,l[1000],r[1000],i,x=0;
  cin>>N;
  for(i=0;i<N;i++){
    cin>>l[i]>>r[i];
    x+=r[i]-l[i]+1;
  }
  cout<<x<<endl;
  return 0;
}


Measured memory_bytes: 256
#define ll long long
#define pub push_back
#define pob pop_back
#define puf push_front
#define pof pop_front
#define mp make_pair
#define fo(i , n) for(ll i = 0 ; i < n ; i++)
#include<iomanip>
#include<cmath>
#include<cstdio>
#include<utility>
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<queue>
#include<set>
#include<stack>
ll z = 1000000007 ;
ll inf = 100000000000000000 ;
ll gcd(ll a , ll b){ if(b > a) return gcd(b , a) ; if(b == 0) return a ; return gcd(b , a%b) ;}
ll power(ll a ,ll b){if(b == 0) return 1 ; ll c = power(a , b/2) ; if(b%2 == 0) return ((c*c)%z) ; else return ((((c*c)%z)*a)%z) ;}
ll inverse(ll a ,ll n){return power(a , n-2) ;}
ll max(ll a , ll b){if(a > b) return a ; return b ;}
//ios_base::sync_with_stdio(0);
//cin.tie(0); cout.tie(0);
using namespace std ;


void solve()
{
	ll n , a , b ;
	cin >> n >> a >> b ;
	ll ans = ((n/(a+b))*a) + min(a , (n%(a+b))) ;
	cout << ans << endl ;
}

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	
	ll t ;
	//cin >> t ;
	t = 1 ;
	while(t--)
	{
		solve() ;
	}
	return 0;
}

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

int main() {
	char a, b, c;
	cin >> a >> b;
	if (a == 'H') c = b;
	else {
		if (b == 'H') c = 'D';
		else c = 'H';
	}
	printf("%c", c);
}

Measured memory_bytes: 256
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <deque>
#include <fstream>
#include <functional>
#include <iostream>
#include <istream>
#include <iterator>
#include <sstream>
#include <list>
#include <map>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iomanip>
#define BR "\n"
#define REP(i,n) for(int (i)=0;(i)<(n);++(i))
#define ALL(cont) begin(cont),end(cont)
#define AS_MOD(a,b) ((((a) % (b) ) + (b)) % (b))
#define FEACH(it,cont) for(auto (it) = begin(cont); it!=end(cont);++it)
#define FEACHR(it,cont) for(auto (it) = rbegin(cont); it!=rend(cont);++it)
#define pb push_back
#define pob pop_back
#define fi first
#define se second
#define getll() ([](){ll s;scanf("%lld", &s);return s;})()
#define getld() ([](){ld s;scanf("%Lf", &s);return s;})()
#define prl(P) printf("%lld", P)
#define prd(P) printf("%.10Lf", P)
#define pr(P) printf(P)
#define assign_if_greater(V, T) V=max(V,T)
using namespace std;
typedef long long ll;
typedef long double ld;

//

//
// inputs
int N;
string S;
//

int main(){
//startmain
//
cout << fixed << setprecision(0);
//
cin >> N >> S;
//
([&](){
    ll MOD=1ll*1000*1000*1000+7;
    vector<ll> counts;
    counts.resize(26,0);
    REP(i,N)
        counts[S[i]-'a']++;
    ll ans=1;
    REP(i,26) {
        ans*=(counts[i]+1);
        ans=AS_MOD(ans,MOD);
    }
    cout << ans-1ll<<endl;
})();
//

return 0;}
//endmain
//


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;
inline int getInt() { int x; scanf("%d",&x); return x;}
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
const int MX = 200005;

ll f(ll x, ll y, ll k) {
  x = abs(x);
  y = abs(y);
  k *= 2;
  if ((x+y)%2) return LINF;
  return dup(x+y,k)*2;
}

ll g(ll x, ll y, ll k) {
  x = abs(x);
  y = abs(y);
  if (x > k) return f(x-k,y,k)+1;
  return f(0, y-(k-x), k)+1;
}

int main() {
  int k;
  scanf("%d",&k);
  int x,y;
  scanf("%d%d",&x,&y);
  ll ans = f(x,y,k);
  mins(ans, g(x,y,k));
  if (ans == LINF) dame;
  cout<<ans<<endl;
  vp as;
  as.eb(x,y);
  int sx = x<0?-1:1;
  int sy = y<0?-1:1;
  x = abs(x);
  y = abs(y);
  auto add = [&](int nx, int ny) {
    as.eb(nx*sx,ny*sy);
    x = nx; y = ny;
    if (x < 0) sx *= -1, x = -x;
    if (y < 0) sy *= -1, y = -y;
  };
  while (ans--) {
    if (ans == 1) {
      bool sw = false;
      if (x > y) sw = true, swap(x,y);
      int cx = (x-y)/2, cy = (x+y)/2;
      x = cy-k; y = cy;
      if (sw) swap(x,y);
      add(x,y);
    } else {
      if (x > k) add(x-k,y);
      else add(0,y-(k-x));
    }
  }
  as.pop_back();
  reverse(rng(as));
  for (auto p : as) cout<<p.fi<<" "<<p.se<<endl;
  return 0;
}






















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

using namespace std;

template<class T> void chmax(T &a, T b) {
    if (a < b) a = b;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int n,q; cin>>n>>q;
    string S;cin>>S;

    vector<int> cumsum={0};
    for (size_t i = 1; i < S.size(); i++)
    {
        if(S[i-1]=='A' && S[i]=='C') {
            cumsum.push_back(1+cumsum.back());
        } else {
            cumsum.push_back(cumsum.back());
        }
    }

    for (size_t i = 0; i < q; i++)
    {
        int x,y;cin>>x>>y;
        cout<<cumsum[--y]-cumsum[--x] << "\n";
    }
    


    return 0;

}

Measured memory_bytes: 1480
// std::set を用いた解
#include <iostream>
#include <set>
using namespace std;

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

    set<int> values; // insert するときに重複を取り除いてくれます
    for (int i = 0; i < N; ++i) {
        values.insert(d[i]); // 挿入します
    }

    // set のサイズを出力します
    cout << values.size() << endl;
    return 0;
}


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

#define ll long long
#define ld long double
#define debug(x) \
	//    (cout << #x << ": " << (x) << endl)
#define eb emplace_back
#define fi first
#define se second

using namespace std;

int main() {
#ifdef LOCAL
	freopen("input.txt", "r", stdin);
#endif
	int a, b;
	cin >> a >> b;
	cout << a * b << "\n";
}


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

int main() {
    int k;
    cin >> k;
    string s;
    cin >> s;
    if (k >= (int)s.length()) {
        cout << s;
    } else {
        for (int i = 0; i < k; i++) {
            cout << s[i];
        }
        cout << "...";
    }
    return 0;
}


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

int main(){
    int bit=0,i=0;
    int num;
    int n[4];
    cin >>num;
    int bs,cs,ds;
    string ans="+++";

    while (i<4){
        n[i++]=num%10;
        num /= 10;
    }
    

    for (bit = 0; bit < 2<<3; bit++){
        bs=n[2];cs=n[1];ds=n[0];

        if(bit%2==0){
            ds *= -1;
            ans[0]='-';
            }else{
            ans[0]='+';
        }

        if((bit>>1)%2==0){
            cs *= -1;
            ans[1]='-';
            }else{
            ans[1]='+';
        }

        if((bit>>2)%2==0){
            bs *= -1;
            ans[2]='-';
            }else{
            ans[2]='+';
        }
        if(n[3]+bs+cs+ds==7)break;
    }
    


    //cout <<fixed<<setprecision(16)<< << endl;
    cout <<n[3]<<ans[2]<<n[2]<<ans[1]<<n[1]<<ans[0]<<n[0]<<"=7"<<endl;

    //if(flag==1)cout << "Yes" <<endl;
    //else cout << "No" <<endl;
    
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int (i)=0;(i)<(n);i++)
#define INF 1001001001
#define LLINF 1001001001001001001
#define MOD 1000000007
#define FOUT(n, dist) cout<<fixed<<setprecision(n)<<(dist);
#define BR cout<<endl;
#define LEN(s) s.length();
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
#define ALL(v) v.begin(), v.end()
typedef long long ll;
const ll mod=1000000007;

int main(){
    ll n, count = 1, ans = 0;
    cin >> n;

    ll a[n];
    rep(i,n)cin >> a[i];

    sort(a, a + n);

    rep(i, n){
        if(a[i] == a[i + 1]){
            count++;
        }
        else{
            if(count % 2 == 1){
                ans++;
            }
            count = 1;
        }
    }

    cout << ans << endl;

    return 0;
}



Measured memory_bytes: 4368
#include <iostream>
#include <vector>
#include <cstring>
#include <string>
#include <algorithm>
#include <iomanip>
using namespace std;

using Weight = int;
using Capacity = int;
struct Edge {
	int src, dst; Weight weight; Capacity cap;
	Edge(int s, int d, Weight w, Capacity c) : src(s), dst(d), weight(w), cap(c) {}
};
using Edges = vector<Edge>;
using Graph = vector<Edges>;

struct Dinic {
	int n, s, t;
	vector<int> level, prog, que;
	vector<vector<Capacity>> cap, flow;
	vector<vector<int>> g;
	Capacity inf;
	Dinic(const Graph &graph)
		: n(graph.size()),
		cap(n, vector<Capacity>(n)), flow(n, vector<Capacity>(n)),
		g(n, vector<int>()), inf(numeric_limits<Capacity>::max() / 8) {
		for(int i = 0; i < n; i++) {
			for(auto &e : graph[i]) {
				int u = e.src, v = e.dst;
				Capacity c = e.cap;
				cap[u][v] += c; cap[v][u] += c; flow[v][u] += c;
				g[u].push_back(v); g[v].push_back(u);
			}
		}
	}
	inline Capacity residue(int u, int v) { return cap[u][v] - flow[u][v]; }
	Capacity solve(int s_, int t_) {
		this->t = t_, this->s = s_;
		que.resize(n + 1);
		Capacity res = 0;
		while(levelize()) { prog.assign(n, 0); res += augment(s, inf); }
		return res;
	}
	bool levelize() {
		int l = 0, r = 0;
		level.assign(n, -1); level[s] = 0; que[r++] = s;
		while(l != r) {
			int v = que[l++]; if(v == t) break;
			for(const int &d : g[v]) if(level[d] == -1 && residue(v, d) != 0) {
				level[d] = level[v] + 1; que[r++] = d;
			}
		}
		return level[t] != -1;
	}
	Capacity augment(int v, Capacity lim) {
		Capacity res = 0;
		if(v == t) return lim;
		for(int &i = prog[v]; i < (int)g[v].size(); i++) {
			const int &d = g[v][i];
			if(residue(v, d) == 0 || level[v] >= level[d]) continue;
			const Capacity aug = augment(d, min(lim, residue(v, d)));
			flow[v][d] += aug; flow[d][v] -= aug;
			res += aug; lim -= aug;
			if(lim == 0) break;
		}
		return res;
	}
};


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

	int V, E;
	cin >> V >> E;

	Graph G(V);
	for(int i = 0; i < E; i++) {
		int u, v, c;
		cin >> u >> v >> c;
		G[u].push_back(Edge(u, v, 0, c));
	}
	Dinic dinic(G);
	cout << dinic.solve(0, V - 1) << endl;
}

Measured memory_bytes: 3332
import java.util.Scanner;
import java.util.*;
public class Main {
    static int INF = Integer.MAX_VALUE;
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int ma = sc.nextInt();
        int mb = sc.nextInt();
        int[] a = new int[n];
        int[] b = new int[n];
        int[] c = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
            b[i] = sc.nextInt();
            c[i] = sc.nextInt();
        }

        int[][][] dp = new int[n + 1][1000][1000];
        for (int i = 0; i <= n; i++) {
            for (int j = 0; j < 1000; j++) {
                for (int k = 0; k < 1000; k++) {
                    dp[i][j][k] = INF;
                }
            }
        }

        dp[0][0][0] = 0;
        for (int i = 0; i < n; i++) {
            for (int j = 0; j <= 40 * 10; j++) {
                for (int k = 0; k <= 40 * 10; k++) {
                    if (dp[i][j][k] == INF) {
                        continue;
                    }
                    dp[i + 1][j][k] = Math.min(dp[i + 1][j][k], dp[i][j][k]);
                    dp[i + 1][j + a[i]][k + b[i]] =
                        Math.min(dp[i + 1][j + a[i]][k + b[i]], dp[i][j][k] + c[i]);
                }
            }
        }
        // System.out.println(Arrays.deepToString(dp));

        int ans = INF;
        for (int j = 1; j <= 40 * 10; j++) {
            for (int k = 1; k <= 40 * 10; k++) {
                if (mb * j == ma * k) {
                    ans = Math.min(ans, dp[n][j][k]);
                }
            }
        }
        if (ans == INF) {
            ans = -1;
        }
        System.out.println(ans);
    }
}


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

int main(){
  int N,ans,a,ansmin;
  cin>>N;
  ans=0;
  ansmin=0;
  vector<int>g(8);
  for(int i=0;i<N;i++){
    cin>>a;
    if(a<400){
      g[0]++;
    }
    else if(a<800){
      g[1]++;
    }
        else if(a<1200){
      g[3]++;
    }
        else if(a<1600){
      g[4]++;
    }
        else if(a<2000){
      g[5]++;
    }
        else if(a<2400){
      g[6]++;
    }
        else if(a<2800){
      g[7]++;
    }
        else if(a<3200){
      g[2]++;
    }
    else{
      ans++;
    }
  }
  for(int i=0;i<8;i++){
    if(g[i]!=0){
      ansmin++;
    }
  }
  if(ansmin==0&&ans>0){
    cout<<1<<" "<<ans<<endl;
  }
  else{
 cout<<ansmin<<" "<<ansmin+ans<<endl;
}
}

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

typedef struct _stack{
    int data;
    struct _stack *next;
}STACK;
typedef struct _pool{
    int area;
    int x;
    struct _pool *next;
}POOL;
void output(POOL *p){
    if(p==NULL)return;
    
    output(p->next);
    printf(" %d",p->area);
    return;
}

int main(void){
    char in;
    int x=1;
    STACK *stack,*tmp;
    stack=NULL;
    POOL *pool,*p;
    pool=NULL;
    while(scanf("%c",&in)==1){
        switch(in){
            case '\\':
                tmp=(STACK*)malloc(sizeof(STACK));
                tmp->data=x;
                if(stack==NULL){
                    tmp->next=NULL;
                }else{
                    tmp->next=stack;
                }
                stack=tmp;
                break;
            case '_':
                break;
            case '/':
                if(stack==NULL)break;
                
                if(pool==NULL){
                    pool=(POOL*)malloc(sizeof(POOL));
                    pool->area=x-stack->data;
                    pool->x=stack->data;
                    pool->next=NULL;
                }else{
                    if(stack->data<pool->x){
                        p=pool->next;
                        while(p!=NULL&&p->x>stack->data){
                            p->area+=pool->area;
                            p=pool;
                            pool=pool->next;
                            free(p);
                            p=pool->next;
                        }
                        pool->area+=x-stack->data;
                        pool->x=stack->data;
                    }else{
                        p=(POOL*)malloc(sizeof(POOL));
                        p->area=x-stack->data;
                        p->x=stack->data;
                        p->next=pool;
                        pool=p;
                    }
                }
                tmp=stack;
                stack=stack->next;
                free(tmp);

                break;
        }
        x++;
    }
    
    int sum=0,count=0;
    p=pool;
    while(p!=NULL){
        sum+=p->area;
        count++;
        p=p->next;
    }
    printf("%d\n%d",sum,count);
    output(pool);
    printf("\n");

    return 0;
}



Measured memory_bytes: 2316
N=int(input())
def f(a,b,c):
    X=sorted([a,b,c])
    if a==b==c:
        return 0
    elif X[0]==X[1] or X[1]==X[2]:
        return 1
    else:
        return 2
print(sum(f(a,b,c) for a,b,c in zip(input(),input(),input())))

Measured memory_bytes: 3060
void main(){
	string[] str = readln().chomp().split();
	if( str[0] > str[1] )writeln(">");
	else if( str[0] < str[1] )writeln("<");
	else writeln("=");
}

import std.stdio, std.conv, std.algorithm, std.numeric, std.string, std.math;

// 1要素のみの入力
T _scan(T= int)(){
	return to!(T)( readln().chomp() );
}

// 1行に同一型の複数入力
T[] _scanln(T = int)(){
	T[] ln;
	foreach(string elm; readln().chomp().split()){
		ln ~= elm.to!T();
	}
	return ln;
}


Measured memory_bytes: 2684
import sys
INFTY=sys.maxsize

def main(n,m,p):
    #global m
    #global p

    for i in range(1,n+1):
        m[i][i]=0

    for l in range(1,n):
        for i in range(1,n-l+1):
            j=i+l
            m[i][j]=INFTY
            for k in range(i,j):
                m[i][j] = min(m[i][j], m[i][k] + m[k+1][j]+p[i-1]*p[k]*p[j])    
    print(m[1][n])


n=int(input())
p=[]
k,l=list(map(int,input().split()))
i=1
p.append(k)
p.append(l)
while(i<n):
    l,m=list(map(int,input().split()))
    p.append(m)
    i+=1

m=[]
for i in range(n+1):
    mm=[0]*(n+1)
    m.append(mm)

main(n,m,p)


Measured memory_bytes: 5676
#include <iostream>
#include <string.h>

using namespace std;

bool rusak[100010];
int nilai[100010], bigmod = 1000000007;

int fungsi(int x) {
	if (rusak[x])
		return 0;
	if (x == 0)
		return 1;
	if (x < 0)
		return 0;
	if (nilai[x] != -1)
		return nilai[x];
	nilai[x] = (fungsi(x - 1) + fungsi(x - 2)) % bigmod;
	return nilai[x];
}

int main() {
	int n, m, a;
	cin >> n >> m;
	memset(rusak, false, sizeof rusak);
	while (m--) {
		cin >> a;
		rusak[a] = true;
	}
	memset(nilai, -1, sizeof nilai);
	a = fungsi(n);
	cout << a << endl;
	return 0;
}

Measured memory_bytes: 3840
#![allow(non_snake_case, unused)]
use std::cmp::*;
use std::collections::*;

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        n: usize,
        L: [u64; n],
    }
    let mut cnt = 0;
    for i in 0..n {
        for j in i..n {
            for k in j..n {
                if (L[i] == L[j]) | (L[j] == L[k]) | (L[k] == L[i]) {
                    continue;
                }
                if (L[i] + L[j] > L[k]) & (L[j] + L[k] > L[i]) & (L[k] + L[i] > L[j]) {
                    cnt += 1;
                }
            }
        }
    }
    println!("{}", cnt);
}


Measured memory_bytes: 2116
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}
use std::cmp::{max,min};
fn main(){
    input!{
        w:i64,
        h:i64,
        n:i64,
        xyan:[[i64;3];n],
    }
    let mut sizes = vec![0,w,0,h];
    for j in 0..n as usize{
        let x = xyan[j as usize][0];
        let y = xyan[j as usize][1];
        let a = xyan[j as usize][2];
        if a == 1 {
            sizes[0] = max(sizes[0],x);
        } else if a ==2 {
            sizes[1] = min(sizes[1],x);
        } else if a == 3 {
            sizes[2] = max(sizes[2],y);
        } else if a ==4 {
            sizes[3] = min(sizes[3],y);
        }
    }
    let width = sizes[1] - sizes[0];
    let width = if width < 0  { 0 } else { width};
    let heigt = sizes[3] - sizes[2];
    let heigt = if heigt < 0 { 0 } else {heigt};
    println!("{}",  width * heigt);
}

Measured memory_bytes: 4352
#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
int main(void){
	long long a,b,ans=0;
	cin>>a>>b;
	if(a==1||b==1){
		printf("1\n");
		return 0;
	}
	if(a%2==0)
	ans=a*b/2;
	else if(b%2==0)
	ans=a/2*b+b/2;
	else
	ans=a/2*b+b/2+(long long)1;
	printf("%lld",ans);
	return 0;
}

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

int gcd(int a,int b){
    if(a<b){
        int now=a;
        a=b;
        b=a;
    }

    int r=a%b;
    while(r!=0){
        a=b;
        b=r;
        r=a%b;
    }

    return b;
}



/* 値を入れ替える関数 */
void swap (int *x, int *y) {
  int temp;    // 値を一時保存する変数

  temp = *x;
  *x = *y;
  *y = temp;
}

/***
* pivotを決め、
* 全データをpivotを境目に振り分け、
* pivotの添え字を返す
***/
int partition (int array[], int left, int right) {
  int i, j, pivot;
  i = left;
  j = right + 1;
  pivot = left;   // 先頭要素をpivotとする

  do {
    do { i++; } while (array[i] < array[pivot]);
    do { j--; } while (array[pivot] < array[j]);
    // pivotより小さいものを左へ、大きいものを右へ
    if (i < j) { swap(&array[i], &array[j]); }
  } while (i < j);

  swap(&array[pivot], &array[j]);   //pivotを更新

  return j;
}

/* クイックソート */
void quick_sort (int array[], int left, int right) {
  int pivot;

  if (left < right) {
    pivot = partition(array, left, right);
    quick_sort(array, left, pivot-1);   // pivotを境に再帰的にクイックソート
    quick_sort(array, pivot+1, right);
  }
}

const int i=0;

int main(void){
    int n;
    scanf("%d",&n);
    int ans=0;
    int i;
    for(i=0;i<n;i++){
        int a;
        scanf("%d",&a);
        ans+=a;
    }

    printf("%d\n",ans-n);
}

Measured memory_bytes: 1728
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <deque>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <cstring>
#include <iomanip>
#include <utility>
 
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,n) for(int i=1;i<=(n);i++)
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
using namespace std;
int main(){
  
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin>>s;
    int sum=0,n=s.size();
    rep(i,n/2){
      if(s[i]!=s[n-i-1]) sum++;
    }
    cout<<sum<<'\n';
    return 0;
}


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

using namespace std; 


int main(){
	
	int n;
	
	vector<int> container(100007);
	
	cin >> n;
	
	int ans = 1e9+7;
	
	for(int i=0;i<n;i++){
		cin >> container[i];
		ans = min(ans,container[i]);
	}
	
	int rem = 0;
	
	
	while(1){
		
		rem = ans;
		
		for(int i=0;i<n;i++){
			if(rem!=container[i] && container[i]!=0){
				container[i] = container[i] % rem;
				if(container[i]!=0){
					ans = min(ans,container[i]); 
				}
			}
		}
		
		if(ans==rem) break;
	}
	
	cout << ans << endl;

    return 0;
}


Measured memory_bytes: 640
n = int(input())
als = list(map(int,input().split()))
ans = 'No'
sett = n//3
als.sort()
if als[0] == 0:
    if als[n-1] == 0:
        ans = 'Yes'
    #else:
        #cc = [0]*(n//2) + [als[n-1]]*(n//2)
        #if cc == als:
            #ans = 'Yes'
if n%3 == 0:
    co = [als[0]]*sett + [(als[0]^als[n-1])]*sett + [als[n-1]]*sett
    if co == als:
        ans = 'Yes'
print(ans)

Measured memory_bytes: 14212
h,w=map(int,input().split())
dp=[[0for i in range(w)] for i in range(h)]
for i in range(h):
  s=input()
  for j in range(w):
    if s[j]==".":
      if i==j==0:dp[i][j]=1
      elif j==0:dp[i][j]=dp[i-1][j]
      elif i==0:dp[i][j]=dp[i][j-1]
      else:dp[i][j]=(dp[i-1][j]+dp[i][j-1])%(10**9+7)
print(dp[-1][-1])

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

int N;
int X[1000] = {0};
int M;
int A;


int main(){
	cin >> N;
	for(int i = 1; i <= N;i++){
		cin >> X[i];
	}
	X[N+1] = 2020;
	cin >> M;
	for(int i = 0; i < M; i++){
		cin >> A;
		if(X[A] < 2019 && X[A+1] > X[A] + 1){
			X[A]++;
		}
	}
	for(int i = 1; i <= N; i++){
		cout << X[i] << endl;
	}

	return 0;
}



Measured memory_bytes: 3116
#include <iostream>
#include <fstream>
#include <cmath>  
#include <cstdlib>
#include <ctime>
#include <algorithm>
#include <numeric>
#include <functional>
#include <string> 
#include <vector>
#include <bitset>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>

using namespace std;
using ll = long long;

#define REP(i,n) for(long long i = 0; i < (n); i++)
#define FOR(i, m, n) for(long long i = (m);i < (n); ++i)
#define ALL(obj) (obj).begin(),(obj).end()

template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;

const ll MOD = (ll)1e9 + 7;
const ll HINF = (ll)1e18;
const ll LINF = (ll)1e9;
const long double PI = 3.1415926535897932384626433;

template <class T> void corner(bool flg, T hoge) { if (flg) { cout << hoge << endl; exit(0); } }
template <class T, class U>ostream &operator<<(ostream &o, const map<T, U>&obj) { o << "{"; for (auto &x : obj) o << " {" << x.first << " : " << x.second << "}" << ","; o << " }"; return o; }
template <class T>ostream &operator<<(ostream &o, const set<T>&obj) { o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o; }
template <class T>ostream &operator<<(ostream &o, const vector<T>&obj) { o << "{"; for (int i = 0; i < (int)obj.size(); ++i)o << (i > 0 ? ", " : "") << obj[i]; o << "}"; return o; }
template <class T, class U>ostream &operator<<(ostream &o, const pair<T, U>&obj) { o << "{" << obj.first << ", " << obj.second << "}"; return o; }
template <template <class tmp>  class T, class U> ostream &operator<<(ostream &o, const T<U> &obj) { o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr)o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o; }
void print(void) { cout << endl; }
template <class Head> void print(Head&& head) { cout << head; print(); }
template <class Head, class... Tail> void print(Head&& head, Tail&&... tail) { cout << head << " "; print(forward<Tail>(tail)...); }
void YN(bool flg) { cout << ((flg) ? "YES" : "NO") << endl; }
void Yn(bool flg) { cout << ((flg) ? "Yes" : "No") << endl; }
void yn(bool flg) { cout << ((flg) ? "yes" : "no") << endl; }

int main() {
	int H, W; cin >> H >> W;
	V<string> a(H);
	REP(i, H) cin >> a[i];

	V<V<ll>> grid(H, V<ll>(W, -1));
	grid[0][0] = 0;
	queue<P<int, int>> q;
	q.push({0,0});
	while(q.size()){
		int y = q.front().first;
		int x = q.front().second;
		q.pop();
		if (y + 1 <H && grid[y + 1][x] == -1 && a[y + 1][x] != '#') {
			grid[y + 1][x] = grid[y][x] + 1;
			q.push({ y + 1,x });
		}
		if (x + 1 <W && grid[y][x + 1] == -1 && a[y][x + 1] != '#') {
			grid[y][x + 1] = grid[y][x] + 1;
			q.push({ y,x + 1 });
		}
	}
	V<P<ll, P<int, int>>> ord;
	REP(i, H) REP(j, W) ord.push_back({ grid[i][j],{i,j} });
	sort(ALL(ord));
	REP(i, H) REP(j, W) grid[i][j] = 0;
	grid[0][0] = 1;

	REP(i,ord.size()){
		int y = ord[i].second.first;
		int x = ord[i].second.second;
		if(a[y][x]!='#'){
			if (y + 1 < H) (grid[y + 1][x] += grid[y][x]) %= MOD;
			if (x + 1 < W) (grid[y][x + 1] += grid[y][x]) %= MOD;
		}
	}
	cout << grid[H - 1][W - 1] << endl;



	
	return 0;
}

Measured memory_bytes: 27368
# include <bits/stdc++.h>
using namespace std ;
int main () {
  int A, B ;
  cin >> A >> B ;
  if ( A > B ) {
    cout << A + (A -1) << endl;
  }
  else if (B > A ) {
    cout << B + (B -1) << endl;
  }
  else {
    cout << A + B << endl;
  }
}


Measured memory_bytes: 256
N=int(input())
Num = []
Alp = []
for i in range(N):
    n, a = input().split()
    Num.append(float(n))
    Alp.append(a)
#print(Num)

ans=jp=bt = 0
for i in range(N):
  if Alp[i]=='JPY':
    jp += Num[i]
  if Alp[i]=='BTC':
    bt += Num[i]*380000.0
ans = jp + bt
print(ans)

Measured memory_bytes: 3064
a,b,c,d,n,*A=`dd`.split.map &:to_i;e=f=1;a>c&&(a,c,e=c,a,-1);b>d&&(b,d,f=d,b,-1);V=[];A.each_slice(2){|x,y|(a..c)===x&&(b..d)===y&&V<<[x*e,y*f]};D=[];n=-1;V.sort.map{|x,y|D[D.bsearch_index{|e|e>y}||n+=1]=y};n+=1;p 1e2*(c-a+d-b)-20*n+5*(n+(n>[c-a,d-b].min ? 1:0))*Math::PI

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

// macros
#define overload_rep(va_0, va_1, va_2, name, ...) name
#define rep_0(i, n) for(int i = 0; i < (n); ++i)
#define rep_1(i, x, y) for(int i = (x); i <= (y); ++i)
#define rep(...) overload_rep(__VA_ARGS__, rep_1, rep_0)(__VA_ARGS__)
#define all(a) a.begin(), a.end()
#ifndef STOP_DEBUG
#define debug(...)\
    do { cerr << boolalpha << "[" << #__VA_ARGS__ << "]:";\
    debug_cerr(__VA_ARGS__); cerr << noboolalpha; } while (0)
#else
#define debug(...)
#endif

// functions
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; }
void debug_cerr(){ cerr << '\n'; }
template<class Head, class... Tail>
void debug_cerr(Head head, Tail... tail){
    cerr << ' ' << head;
    debug_cerr(tail...);
}

// cin/cout setup
struct IoSetup{
    IoSetup(){
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(20);
    }
} iosetup;

// libraries

// declarations
typedef long long lint;

lint lintpow(const lint& x, const lint& p){
    lint res = 1, now = x, pow = p;
    for(; pow; pow >>= 1){
        if(pow & 1)res *= now;
        now *= now;
    }
    return res;
}

bool inquire(const lint& x){
    cout << "? " << x << endl;
    char c;
    cin >> c;
    return c == 'Y';
}

void answer(const int& x){
    cout << "! " << x << endl;
    exit(0);
}

// solve
int main(){

    int dig = 10;
    int ask = 999999999;
    while(dig > 1){
        if(!inquire(ask))break;
        ask /= 10, dig--;
    }

    if(dig == 1){
        lint use = lintpow(10, 9) - 10;
        int last = 9;
        while(last > 1){
            if(!inquire(((use + 1) * lintpow(10, 9 - last) - 1) * 10 + 9))break;
            use = use / 100 * 10, last--;
        }
        if(last > 1){
            if(inquire(use * 10 + 9))answer(use * 10 + 90);
            for(int i = 8; i >= 0; --i){
                if(!inquire((use + i) * 10 + 9))answer(use + i + 1);
            }
        } else {
            for(int i = 8; i >= 1; --i){
                if(!inquire(i * 10 + 9))answer(i + 1);
            }
            if(inquire(100))answer(1);
            else answer(90);
        }
    } else {
        if(dig == 10)answer(ask + 1);
        lint use = lintpow(10, dig + 1) - 1;
        int ans = 0;
        rep(i, dig){
            if(i > 0)if(inquire(use - lintpow(10, dig - i) * 9)){
                ans = ans * 10;
                use -= lintpow(10, dig - i) * 9;
                continue;
            }
            int l = 0, r = 9;
            while(r - l > 1){
                int md = (l + r) / 2;
                (inquire(use + lintpow(10, dig - i) * (md - 9)) ? r : l) = md;
            }
            ans = ans * 10 + r;
            use -= lintpow(10, dig - i) * (9 - r);
        }
        answer(ans);
    }

}


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

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

  rep(i, s.size()) {
    int x;
    x = s[i] - 'A';
    s[i] = 'A' + (x + n) % 26;
  }

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

Measured memory_bytes: 256
void main() {
	auto N = ri;
	auto p = readAs!(int[]);
	ulong cnt;
	foreach(i; 0..N-1) {
		if(p[i] == i+1) {
			cnt++;
			swap(p[i], p[i+1]);
		}
	}
	if(p[$-1] == N) cnt++;
	cnt.writeln;
}

// ===================================

import std.stdio;
import std.string;
import std.functional;
import std.algorithm;
import std.range;
import std.traits;
import std.math;
import std.container;
import std.bigint;
import std.numeric;
import std.conv;
import std.typecons;
import std.uni;
import std.ascii;
import std.bitmanip;
import core.bitop;

T readAs(T)() if (isBasicType!T) {
	return readln.chomp.to!T;
}
T readAs(T)() if (isArray!T) {
	return readln.split.to!T;
}

T[][] readMatrix(T)(uint height, uint width) if (!isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		res[i] = readAs!(T[]);
	}
	return res;
}

T[][] readMatrix(T)(uint height, uint width) if (isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		auto s = rs;
		foreach(j; 0..width) res[i][j] = s[j].to!T;
	}
	return res;
}

int ri() {
	return readAs!int;
}

double rd() {
	return readAs!double;
}

string rs() {
	return readln.chomp;
}

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

int main() {
  int64_t h,w;
  cin >> h >> w;
  if(h==1||w==1)cout << 1 << endl;
  else if(h*w%2==0)cout << h*w/2 << endl;
  else cout << h*w/2+1 <<endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <cmath>
#include <map>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep2(i,a,n) for(int i=a;i<n;i++)
#define been(ix) (ix).begin(),(ix).end()
using namespace std;
typedef long long ll; 
typedef vector<int> vi;
typedef vector<long long> vl;
const ll INFL = 1e18;
const int INF = 1001001001; 
typedef pair<int,int> P;
#define foreach(ix,i) for(auto& (ix) : (i))
typedef long double ld;
const ll max_co = 3234600000;
vl ans;
int mod =1000000007;
int main(){
    int n;
    cin>>n;
    vi a(n+1),res(n+1,-1),ans;
    int m=0;
    rep(i,n){
        cin>>a[i+1];
    }
    for(int i = n;i>=1;i--){
        int d =0;
        for(int j=2;j<=n/i;j++){
            if(res[i*j]==1)d++;
        }
        if(d%2!=a[i]){
            res[i]=1;
            m++;
            ans.push_back(i);
        }
    }
    cout<<m<<endl;
    for(int x:ans){
        cout<<x<<' ';
    }
    cout<<endl;
    
}


Measured memory_bytes: 3064
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <iostream>
#include <string>
#include <cstring>
#include <map>
#include <vector>
#include <stack>
#include <set>
#include <queue>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef double DB;

const int MaxN = 1e5;
int n, fa[MaxN + 5], tot;
struct NODE {
	LL x, y;
	int pos;
}a[MaxN + 5];
struct EDGE {
	int u, v;
	LL w;
}edge[3 * MaxN + 5];

bool cmp1(NODE a, NODE b) {return a.x < b.x;}
bool cmp2(NODE a, NODE b) {return a.y < b.y;}
bool cmp3(EDGE a, EDGE b) {return a.w < b.w;}

int Find(int x) {
	if(fa[x] == x) return x;
	return fa[x] = Find(fa[x]);
}

void Kruskal() {
	for(int i = 1; i <= n; i++) fa[i] = i;
	sort(edge + 1, edge + tot + 1, cmp3);
	LL ans = 0;
	for(int i = 1; i <= tot; i++) {
		int u = edge[i].u, v = edge[i].v;
		if(Find(u) != Find(v)) {
			ans += edge[i].w;
			fa[Find(u)] = Find(v);
		}
	}
	printf("%lld\n", ans);
}

int main()
{
	scanf("%d", &n);
	for(int i = 1; i <= n; i++) fa[i] = i;
	for(int i = 1; i <= n; i++) {
		scanf("%lld%lld", &a[i].x, &a[i].y);
		a[i].pos = i;
	}
	tot = 0;
	sort(a + 1, a + n + 1, cmp1);
	for(int i = 1; i < n; i++) {
		edge[++tot].u = a[i].pos;
		edge[tot].v = a[i + 1].pos;
		edge[tot].w = abs(a[i].x - a[i + 1].x);
	}
	sort(a + 1, a + n + 1, cmp2);
	for(int i = 1; i < n; i++) {
		edge[++tot].u = a[i].pos;
		edge[tot].v = a[i + 1].pos;
		edge[tot].w = abs(a[i].y - a[i + 1].y);
	}
	Kruskal();
}

Measured memory_bytes: 7680
#include <bits/stdc++.h>
using namespace std;
int ordinary(int x){
    return (x+9)/10*10;
}
int last(int x){
    return x;
}
int main() {
  int a,b,c,d,e;
  cin >> a>>b>>c>>d>>e;
  vector<int>vec={a,b,c,d,e};
  int min1=9999;
  int sum=0;
  for(int i=0;i<5;i++)
      sum+=ordinary(vec[i]);
  for(int i=0;i<5;i++){
    if(min1>=sum-ordinary(vec[i])+last(vec[i]))
      min1=sum-ordinary(vec[i])+last(vec[i]);
  }
  cout<<min1<<endl;

}


Measured memory_bytes: 256
#include <iostream>
#include <stack>
#include <cstdio>
#include <cstdlib>
int main()
{
	std::stack<double> s;
	double a,b;
	char c[80],d;
	while (std::cin>>c)
	{
		if (c[0]=='+')
		{
			b=s.top(), s.pop();
			a=s.top(), s.pop();
			s.push(a+b);
		}
		else if (c[0]=='-'&&c[1]==0)
		{
			b=s.top(), s.pop();
			a=s.top(), s.pop();
			s.push(a-b);
		}
		else if (c[0]=='*')
		{
			b=s.top(),s.pop();
			a=s.top(),s.pop();
			s.push(a*b);
		}
		else if (c[0]=='/')
		{
			b=s.top(), s.pop();
			a=s.top(), s.pop();
			s.push(a/b);
		}
		else	s.push(atof(c));
		if ((d=getchar()) == '\n')	printf("%.6f\n", s.top());
		if (d==-1)	break;
	}
}

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

int main() {
  int N, A, B;
  cin >> N >> A >> B;

  if (N * A > B) {
    cout << B << endl;
  }
  else if (N * A < B) {
    cout << N * A << endl;
  }
  else if (N * A == B) {
    cout << N * A << endl;
  }
}

Measured memory_bytes: 256
n=int(input())
a=list(map(int,input().split()))
ans=[0]*n
ans[0]=sum(a[::2])-sum(a[1::2])
for i in range(1,n):
  ans[i]=2*a[i-1]-ans[i-1]
ans=list(map(str,ans))
print(" ".join(ans))


Measured memory_bytes: 18456
N,K = list(map(int,input().split()))
H=[]

for n in range(N):
    H.append(int(input()))
    
H.sort()

ans=10**10
for h in range(K-1,N):
    h_min=H[h-K+1]
    h_max=H[h]
    if ans > h_max-h_min:
        ans=h_max-h_min
print(ans)

Measured memory_bytes: 13284
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc=new Scanner(System.in);
    int a=sc.nextInt();
    int b=sc.nextInt();
    
    if(a<b){
	  int t=a;
      a=b;
      b=t;
    }
    for(int i=0;i<a;i++){
      System.out.print(b);
    }
  }
}

Measured memory_bytes: 22608