akhauriyash/Code-Regression huggingface dataset:
import java.util.*;
import java.io.*;
class Main
{
    public static void main(String args[])throws IOException
    {
        Reader in = new Reader();
        long n = in.nextLong();
        long x = in.nextLong();
        long t = in.nextLong();
        System.out.println((n + x - 1L) / x * t);
    }
}
class Reader
{
    final private int BUFFER_SIZE = 1 << 16;
    private DataInputStream din;
    private byte[] buffer;
    private int bufferPointer, bytesRead;

    public Reader()
    {
        din = new DataInputStream(System.in);
        buffer = new byte[BUFFER_SIZE];
        bufferPointer = bytesRead = 0;
    }

    public Reader(String file_name) throws IOException
    {
        din = new DataInputStream(new FileInputStream(file_name));
        buffer = new byte[BUFFER_SIZE];
        bufferPointer = bytesRead = 0;
    }

    public String readLine() throws IOException
    {
        byte[] buf = new byte[64]; // line length
        int cnt = 0, c;
        while ((c = read()) != -1)
        {
            if (c == '\n')
                break;
            buf[cnt++] = (byte) c;
        }
        return new String(buf, 0, cnt);
    }

    public int nextInt() throws IOException
    {
        int ret = 0;
        byte c = read();
        while (c <= ' ')
            c = read();
        boolean neg = (c == '-');
        if (neg)
            c = read();
        do
        {
            ret = ret * 10 + c - '0';
        }  while ((c = read()) >= '0' && c <= '9');

        if (neg)
            return -ret;
        return ret;
    }

    public long nextLong() throws IOException
    {
        long ret = 0;
        byte c = read();
        while (c <= ' ')
            c = read();
        boolean neg = (c == '-');
        if (neg)
            c = read();
        do {
            ret = ret * 10 + c - '0';
        }
        while ((c = read()) >= '0' && c <= '9');
        if (neg)
            return -ret;
        return ret;
    }

    public double nextDouble() throws IOException
    {
        double ret = 0, div = 1;
        byte c = read();
        while (c <= ' ')
            c = read();
        boolean neg = (c == '-');
        if (neg)
            c = read();

        do {
            ret = ret * 10 + c - '0';
        }
        while ((c = read()) >= '0' && c <= '9');

        if (c == '.')
        {
            while ((c = read()) >= '0' && c <= '9')
            {
                ret += (c - '0') / (div *= 10);
            }
        }

        if (neg)
            return -ret;
        return ret;
    }

    private void fillBuffer() throws IOException
    {
        bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
        if (bytesRead == -1)
            buffer[0] = -1;
    }

    private byte read() throws IOException
    {
        if (bufferPointer == bytesRead)
            fillBuffer();
        return buffer[bufferPointer++];
    }

    public void close() throws IOException
    {
        if (din == null)
            return;
        din.close();
    }
}


Measured memory_bytes: 32472
#include <iostream>
#include <math.h>
#include <algorithm>
#include <vector>
#include <string>
using namespace std;
typedef long long ll;
#define rep(i,s,n)for(ll i=s;i<n;i++)
#define repe(i,s,n)for(ll i=s;i<=n;i++)
#define rep_r(i,s,n)for(ll i=n-1;i>=s;i--)
#define repe_r(i,s,n)for(ll i=s;i<=n;i++)
static const ll MOD = 1e9 + 7;
static const ll MAX_L = (ll)1 << 21;

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

	ll ans = 0;
	if (b >= c) {
		ans = b + c;
	}
	else {
		if (a == c - b) {
			ans = a + b * 2;
		}
		else if (a < c - b) {
			ans = a + b * 2 + 1;
		}
		else if (a > c - b) {
			ans = b + c;
		}
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
x,y,a,b,c=gets.split.map(&:to_i)

parray=gets.split.map(&:to_i).sort.reverse
qarray=gets.split.map(&:to_i).sort.reverse
rarray=gets.split.map(&:to_i).sort.reverse

parray=parray[0..x-1]
qarray=qarray[0..y-1]

pqarray=[]

index1=0
index2=0
loop{
    if index1==x && index2==y
        break
    end
    
    if index1==x
        pqarray.push(qarray[index2])
        index2+=1
        next
    end
    
    if index2==y
        pqarray.push(parray[index1])
        index1+=1
        next
    end
    
    if parray[index1] > qarray[index2]
        pqarray.push(parray[index1])
        index1+=1
    else
        pqarray.push(qarray[index2])
        index2+=1
    end
}

index3=x+y-1
index4=0

loop{
    if  !rarray[index4] || !pqarray[index3]
        break
    end
    
    if rarray[index4] > pqarray[index3]
        pqarray[index3]=rarray[index4]
        index3-=1
        index4+=1
    else
       break 
    end
    
}

puts pqarray.inject(:+)

Measured memory_bytes: 26584
import java.util.*;

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

        int[] c = new int[n-1];
        int[] s = new int[n-1];
        int[] f = new int[n-1];
        for(int i = 0;i < n-1;i++) {
            String[] vals = sc.nextLine().split(" ");
            c[i] = Integer.parseInt(vals[0]);
            s[i] = Integer.parseInt(vals[1]);
            f[i] = Integer.parseInt(vals[2]);
        }

        for(int j = 0;j < n-1;j++){
            int t = 0;
            for(int k = j;k < n-1;k++){
                if(t <= s[k]){
                    t = s[k];
                }else{
                    t += (t-s[k]) % f[k] == 0 ? 0 : f[k] - (t-s[k]) % f[k];
                }
                t += c[k];
            }
            System.out.println(t);
        }
        System.out.println(0);
        sc.close();
    }

    static int getInt(String val) {
        return Integer.parseInt(val);
    }
}

Measured memory_bytes: 25940
#include<stdio.h>
#include <iostream>
using namespace std;
int main(){
    int n;
    scanf("%d",&n);
    for(int a=1;a<=9;a++)for(int b=1;b<=9;b++){
        if(a*b==n){
        puts("Yes");
        return 0;
    }
        
    }
    cout << "No";
    }

Measured memory_bytes: 256
import java.util.*;

class Main{
	public static void main(String args[]){
      Scanner in=new Scanner(System.in);
      String S=in.next();
      String T=in.next();
      
      int count=0;
      for(int i=0;i<3;i++){
		if(S.charAt(i)==T.charAt(i)){
			count++;
        }
      }
      System.out.println(count);
      in.close();
    }
}

Measured memory_bytes: 22612
#include<iostream>
using namespace std;
int main(){
	int x,y;
	cin>>x>>y;
   
   	for(int j=x,i=0;j>=0,i<=x;j--,i++){
   		if(j*2+i*4==y){
   			cout<<"Yes\n";
   			return 0;
   		}
   	}
   
   cout<<"No\n";
}

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

#define maxn 100002
#define FOR(i, l, r) for (int i=l; i<=r; ++i)
#define FORD(i, r, l) for (int i=r; i>=l; --i)
#define REP(i, r) for (int i=0; i<(int)r; ++i)
#define REPD(i, r) for (int i=(int)r-1; i>=0; --i)
#define fi first
#define se second
#define mk make_pair
#define nil NULL
#define y0 y902
#define y1 y232
#define x0 x92
#define x1 x899
#define next asdfa
#define sz size
#define Debug(X) {cerr << #X << " = " << X << '\n';}
#define PR(A, n) {cerr << #A << " = "; FOR(i, 1, n) cerr << A[i] << ' '; cerr << '\n';}
#define PR0(A, n) {cerr << #A << " = "; REP(i, n) cerr << A[i] << ' '; cerr << '\n';}
typedef long long ll;
typedef double db;
typedef pair<db, db> dd;
typedef pair<int, int> ii;
typedef vector<int> vi;
const int inf = 1e9;
template<class T> int getbit(T x, int pos) {return (x>>(pos-1)) & 1;}
template<class T> void turn_on(T &x, int pos) {x = x | ((T)1<<(pos-1));}
template<class T> void turn_off(T &x, int pos) {x = x & ~((T)1<<(pos-1));}
template<class T> T sqr(T a) {return a*a;}

int n, a[maxn];
bool visited[maxn];

int main() {
    //freopen("button.inp", "r", stdin);
    //freopen("", "w", stdout);
    //ios::sync_with_stdio(0); cin.tie(0);
    scanf("%d", &n);
    FOR(i, 1, n) scanf("%d", &a[i]);
    int cur = 1, cnt = 0;
    while (true) {
        if (cur==2) {
            printf("%d", cnt);
            return 0;
        }
        if (visited[cur]) {
            printf("-1");
            return 0;
        }
        visited[cur] = true;
        cur = a[cur];
        ++cnt;
    }
}


Measured memory_bytes: 768
data = []
while True:
  m,f,r = map(int, input().split())
  if m == -1 and f == -1 and r == -1:
    break
  else:
    if m == -1 or f == -1:
      data.append("F")
    elif m + f >= 80:
      data.append("A")
    elif m + f >= 65:
      data.append("B")
    elif m + f >= 50 or r >= 50:
      data.append("C")
    elif m + f >= 30:
      data.append("D")
    else:
      data.append("F")

for i in data:
  print(i)


Measured memory_bytes: 5600
// ARC082
// C - Together

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;

const int MAX_N = 100000;
const int MAX_A = 100000;

int N;
int a[MAX_N];

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

    int ans = 0;
    for (int i = 0; i < MAX_A; i++) {
        int cnt = upper_bound(a, a + N, i + 1) - lower_bound(a, a + N, i - 1);
        ans = max(ans, cnt);
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <set>
#include <map>
#include <algorithm>

#define int long long
#define MOD7 1000000007
#define MOD9 1000000009

#define rep(i, n) for (int i = 0; i < (n); i++)
#define REP(i, a, n) for (int i = (a); i <= (n); i++)
#define all(a) (a).begin(), (a).end()

using namespace std;

int dx[4] = { 1, 0, -1, 0 };
int dy[4] = { 0, -1, 0, 1 };

int nextInt() {int a; cin >> a; return a;}
char nextChar() {char a; cin >> a; return a;}
double nextDouble() {double a; cin >> a; return a;}
string nextString() {string a; cin >> a; return a;}

template<class T> void inputVector(vector<T>& v, int n) {
    v.resize(n);
    for (int i = 0; i < v.size(); i++) cin >> v[i];
}

signed main() {
    int N, K;
    cin >> N >> K;

    int ret = K;
    rep(i, N - 1) {
	ret *= K - 1;
    }
    cout << ret << endl;

    return 0;
}


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

#define FOR(i,a,b) for (auto i=(a);i<(b);i++)
#define RFOR(i,a,b) for (auto i=(b)-1;i>=(a);i--)
#define REP(i,n) for (auto i=0;i<(n);i++)
#define RREP(i,n) for (auto i=(n)-1;i>=0;i--)
#define EACH(i,v) for(auto &i : v)
#define inf INT_MAX/3
#define INF INT_MAX/3
#define eps 1e-15
#define EPS 1e-15
#define TEN9 1000000000
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define SET(a,c) memset(a,c,sizeof a)
#define CLR(a) memset(a,0,sizeof a)
#define pii pair<int,int>
#define pcc pair<char,char>
#define pic pair<int,char>
#define pci pair<char,int>
#define mii map<int,int>
#define msd map<string,double>
#define msi map<string,int>
#define ti3 tuple<int,int,int>
#define VS vector<string>
#define VI vector<int>
#define debug(x) cout<<#x<<": "<<x<<endl
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define MIN(a,b) (a>b?b:a)
#define MAX(a,b) (a>b?a:b)
#define pi 2*acos(0.0)
#define INFILE() freopen("in0.txt","r",stdin)
#define OUTFILE()freopen("out0.txt","w",stdout)
#define in scanf
#define out printf
#define LL long long
#define ll long long
#define ULL unsigned long long
#define ull unsigned long long
#define FST first
#define SEC second
#define SORT(v) sort(ALL(v));
#define VVI(v,n1,n2) vector<vector<int> > v(n1, vector<int>(n2, 0));
#define int(x) int x; scanf("%d",&x);
#define lint(x) long long x; scanf("%lld",&x);
#define vint(v,n) vector<int> v(n); REP(i,n) scanf("%d", &v[i]);
#define vvint(v,n1,n2) vector<vector<int> > v(n1, vector<int>(n2, 0)) ; REP(i,n1) REP(j,n1) scanf("%d", &v[i][j]);
#define vlint(v,n) vector<ll int> v(n); REP(i,n) scanf("%lld", &v[i]);
#define vvlint(v,n1,n2) vector<vector<ll int> > v(n1, vector<ll int>(n2, 0)); REP(i,n1) REP(j,n1) scanf("%lld", &v[i][j]);
#define double(x) double x; scanf("%lf",&x);
#define vdouble(v,n) vector<double> v(n); REP(i,n) scanf("%lf", &v[i]);
#define vvdoube(v,n1,n2) vector<vector<double> > v(n1, vector<double>(n2, 0)); REP(i,n1) REP(j,n1) scanf("%lf", &v[i][j]);
#define char(x) char x; scanf("%c",&x);
#define vchar(v,n) vector<char> v(n); REP(i,n) scanf("%c", &v[i]);
#define vvchar(v,n1,n2) vector<vector<char> > v(n1, vector<char>(n2, 0)); REP(i,n1) REP(j,n1) scanf("%c", &v[i][j]);
#define string(x) string x; cin >> x;
#define vstring(v,n) vector<string> v(n); REP(i,n) cin >> v(i);

#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]));


ll int  dp[100][100][3000] ={0};

int main(){

    int(N)
    int(A)
    vint(v, N)
    dp[0][0][0] = 1;
    FOR(j, 0, N+1){
        FOR(k, 0, N+1){
            REP(l, A*N+1){
                if (j>0) {
                    dp[j][k][l] +=dp[j-1][k][l];
                    if (k>0&&l>=v[j-1]) {  //選択した時
                        dp[j][k][l] += dp[j-1][k-1][l-v[j-1]];
                    }
                }
            }
        }
    }
    ll int ans = 0;
    FOR(k, 1, N+1){
        ans += dp[N][k][k*A];
    }
    std::cout << ans << std::endl;
    return 0;
}


Measured memory_bytes: 60032
import bisect

N = int(input())
A = list(map(int, input().split()))
Q = int(input())
B = [0] * Q
C = [0] * Q
for i in range(Q):
    B[i], C[i] = map(int, input().split())

DP = [0]*(10**5+1)

for i in range(len(A)):
    DP[A[i]] += 1

Sum = sum(A)

for i in range(Q):
    Sum += (C[i]-B[i])*DP[B[i]]
    DP[C[i]] += DP[B[i]]
    DP[B[i]] = 0
    print(Sum)

Measured memory_bytes: 86356
#include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
#define MOD 1000000007
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3f
#define EPS (1e-10)
using namespace std;
typedef long long ll;
typedef pair<int,int>P;

int n;
int a[300000];

class UnionFind {
public:
	vector<int>par, sz;
public:
	UnionFind() {}
	UnionFind(int n) {
		par = sz = vector<int>(n);
		for (int i = 0; i < n; i++) {
			par[i] = i;
			sz[i] = 1;
		}
	}
	int find(int x) {
		if (par[x] == x)return x;
		return par[x] = find(par[x]);
	}
	void unite(int x, int y) {
		x = find(x); y = find(y);
		if (x == y)return;
		par[x]=y;
	}
	bool same(int x, int y) {
		return find(x) == find(y);
	}
	int size(int x) {
		return sz[find(x)];
	}
};
bool C(int t){
	unordered_map<int,int>mp,id,id_rev;
	set<int>se;
	UnionFind uf(n*3);
	int cnt=0;
	for(int i=1;i<n;i++){
		if(a[i]>a[i-1])continue;
		int d=a[i];
		if(!id.count(d)){
			id[d]=cnt;cnt++;
			id_rev[id[d]]=d;
		}
		while(mp[d]==t){
			if(d==1){
				return false;
			}
			if(!id.count(d)){
				id[d]=cnt;cnt++;
				id_rev[id[d]]=d;
			}
			if(!id.count(d-1)){
				id[d-1]=cnt;cnt++;
				id_rev[id[d-1]]=d-1;
			}
			uf.unite(id[d],id[d-1]);
			int p=id[d];
			d=id_rev[uf.find(p)];
		}
		mp[d]++;
		se.insert(d);
		auto it=se.lower_bound(d+1);
		while(it!=se.end()){
			mp[*it]=0;
			uf.par[id[*it]]=id[*it];
			it=se.erase(it);
		}
	}
	return true;
}
int main(){
	scanf("%d",&n);
	bool flag=false;
	rep(i,n){
		scanf("%d",&a[i]);
		if(i&&a[i-1]>=a[i])flag=true;
	}
	if(!flag){
		puts("1");return 0;
	}
	int ok=n*2,ng=0;
	while(ok-ng>1){
		int t=(ok+ng)/2;
		if(C(t))ok=t;
		else ng=t;
	}
	cout<<ok+1<<endl;
}

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

using namespace std;

#define PB push_back
#define f first
#define s second
#define what_is(x) cerr << #x << " is " << x << endl;

typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    int x;
    cin >> x;
    cout << 8-(x-400)/200;
    return 0;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define REP(i, m, n) for(int (i) = (m); (i) < (n); ++i)
#define rep(i, n) REP(i, 0, n)
#define all(x) (x).begin(), (x).end()
using namespace std;
using Graph = vector<vector<int>>;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
typedef long long ll;
typedef pair<ll, ll> P;
const int INF = 1e9+7;
const ll LINF = 1LL<<60;

const int MOD = 1e9 + 7;

int main()
{
    cin.tie(0);
    ios_base::sync_with_stdio(0);
    int n;
    cin >> n;
    vector<ll> a(n);
    rep(i, n) cin >> a[i];

    ll res = 0;
    for (int d = 0; d < 60; d++) {
        ll n0 = 0, n1 = 0;
        for (int i = 0; i < n; i++) {
            if ((a[i] >> d) & 1) n1++;
            else n0++;
        }
        ll tmp = (1ll << d) % MOD;
        ll t = n0 * n1 % MOD;
        tmp = tmp * t % MOD;
        res = (res + tmp) % MOD;
    }

    cout << res << endl;

    return 0;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi=vector<int>;
using vvi=vector<vi>;
using pii=pair<int,int>;
#define rep(i,n) for(int i=0;i<n;i++)
#define range(i,a,n) for(int i=a;i<n;i++)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define INF 1e9
#define EPS 1e-9
#define MOD (1e9+7)
void put(string d){}template<class H,class...T>void put(string d,H&h,T&...t){cout<<h;if(sizeof...(t))cout<<d;put(d,t...);}
template<class T>void puti(T&a,string d=" "){bool f=1;for(auto&_:a)cout<<(exchange(f,0)?"":d)<<_;cout<<endl;}
template<class T>void putii(T&a,string d=" "){for(auto&_:a)puti(_,d);}

int main(){
    int n; cin>>n;
    vi a(n+1),b(n+1,0),x(n+1,0); range(i,1,n+1)cin>>a[i];
    rep(i,n)b[i+1]=b[i]+a[i+1];
    rep(i,n)x[i+1]=x[i]^a[i+1];
    ll ans=0;
    rep(i,n){
        int l=i+1,r=n+1;
        while(abs(r-l)>1){
            int m=(r+l)/2;
            if(b[m]-b[i]==(x[m]^x[i])){
                l=m;
            }else{
                r=m;
            }
        }
        ans+=l-i;
    }
    cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 2560
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))

int c(const void*a,const void*b){return strcmp((char*)a,(char*)b);}

ll n;
char s[110][110];
int main(){
	scanf("%lld%*lld",&n);
	rep(i,0,n)scanf("%s",s[i]);
	qsort(s,n,110,c);
	rep(i,0,n)printf("%s",s[i]);
}

Measured memory_bytes: 128
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <algorithm>
#include <climits>
#include <cstring>
#include <cmath>
#include <stack>
#include <iomanip>
#include <tuple>
#include <functional>
#include <cfloat>
#include <map>
#include <stdio.h>
#include <string.h>
using ll = long long;

//LLONG_MAX
#define int long long
#define CONTAINS(v,n) (find((v).begin(), (v).end(), (n)) != (v).end())
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
#define ARY_SORT(a, size) sort((a), (a)+(size))
#define MAX(a,b) (((a) > (b)) ? (a) : (b))
#define MIN(a,b) (((a) < (b)) ? (a) : (b))
#define REMOVE(v,a) (v.erase(remove((v).begin(), (v).end(), (a)), (v).end()))
#define REVERSE(v) (reverse((v).begin(), (v).end()))
#define LOWER_BOUND(v,a) (lower_bound((v).begin(), (v).end(), (a)))
#define UPPER_BOUND(v,a) (upper_bound((v).begin(), (v).end(), (a)))
#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define CONTAINS_MAP(m, a) (m).find((a)) != m.end()
using namespace std;

signed main()
{
	char ch[5];
	cin >> ch;
	int cnt[50] = {};
	for (int i = 0; i < 4; i++)
	{
		cnt[ch[i] - 'A']++;
	}

	for (int i = 0; i < 30; i++)
	{
		if (cnt[i] != 0 && cnt[i] != 2)
		{
			cout << "No" << endl;
			return 0;
		}
	}

	cout << "Yes" << endl;
}











Measured memory_bytes: 256
//
//  main.cpp
//  AC
//
//  Created by makinofuya on 2019/07/08.
//  Copyright © 2019 makinofuya. All rights reserved.
//
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <stack>
#include <math.h>

typedef long long ll;
using namespace std;
#define mod 1000000007
#define rep(i,n) for(ll i=0;i<n;i++)
#define out(s) cout << s << endl


int main(){
    int n;cin >> n;
    int d,x;cin >> d >> x;
    vector<int>a(n);
    int sum=0;
    int z=1,k=1;
    rep(i,n)cin >> a[i];
    for(int i=0;i<n;i++){
        k=0;z=1;
        while(z<=d){
            z=k*a[i]+1;
            k++;
        }
        sum+=(k-1);
    }
    cout << sum+x << endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
using namespace std;
int main() {
  vector<char> n(4); for(int i = 0; i != 4; i++) cin >> n[i];
  if(n[0] == n[1] && n[1] == n[2]) cout << "Yes" << endl;
  else if(n[1] == n[2] && n[2] == n[3]) cout << "Yes" << endl;
  else cout << "No" << endl;

  return 0;
}


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

const int MOD=1000000007;
int INF=100100100;
int main(){
  string s;cin>>s;
  int n=s.length();
  int ans=0;
  for(int i=0;i<n;i++){
    if(s[i]=='?')s[i]='D';
  }
  cout<<s<<endl;
  return 0;
}

Measured memory_bytes: 3724
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int INF = 0x3f3f3f3f;
const int N = 1e5 + 10;
const int MAX = 1e5 + 10;
const double exps = 1e-8;
#define endl '\n'

inline int max(int a, int b) { return a > b ? a : b; }
inline int min(int a, int b) { return a > b ? b : a; }
inline int gcd(int a, int b) {
    if (b == 0)
        return a;
    else
        return gcd(b, a % b);
}
int main() {
    // ios::sync_with_stdio(false);
    int k;
    scanf("%d", &k);
    ll sum = 0;
    for (register int a = 1; a <= k; ++a) {
        for (register int b = 1; b <= k; ++b) {
            for (register int c = 1; c <= k; ++c) {
                sum += 1ll * gcd(a, gcd(b, c));
            }
        }
    }
    cout << sum;
}

Measured memory_bytes: 3764
#![allow(unused_imports)]
#![allow(clippy::many_single_char_names)]
#![allow(clippy::suspicious_arithmetic_impl)]

// using Rust(1.42.0)
// My Library Repo is at "https://github.com/Loptall/prcn_lib"
// check available crates on AtCoder at "https://atcoder.jp/contests/language-test-202001"

/*
    AtCoder Language Update 2020204 お疲れ様でした! 有難いです
*/

// Dep crates are...
use std::cmp::{max, min, Ordering};
use std::collections::{BTreeMap, BTreeSet, HashMap, HashSet, VecDeque};
use std::mem::swap;
use std::ops::*;
use std::{i128, i16, i32, i64, i8, isize, u128, u16, u32, u64, u8, usize};

use itertools::*;
use itertools_num::*;
use lazy_static::lazy_static;
use maplit::{btreemap, btreeset, hashmap, hashset};
use num_bigint::{BigInt, BigUint};
use num_integer::{binomial, gcd, lcm, Integer};
use permutohedron::Heap;
use proconio::{fastout, input, is_stdin_empty, marker::*};
use rand::random;

// code...
fn main() {
    input! {
        x: i64
    }

    'a: for a in -1000i64..=1000i64 {
        for b in -1000i64..=1000i64 {
            if a.pow(5) - b.pow(5) == x {
                println!("{} {}", a, b);
                break 'a;
            }
        }
    }
}


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

using namespace std;

int main(){
  	char a;
    cin >> a;
  	if(a == 'A')cout << "T" << endl;
  	if(a == 'T')cout << "A" << endl;
	if(a == 'G')cout << "C" << endl;
 	if(a == 'C')cout << "G" << endl;
  	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
     int a;
  cin >> a;
  int b=a/1000;
  int c=(a-b*1000)/100;
  int d=(a-b*1000-c*100)/10;  
  int e=(a-b*1000-c*100-d*10)/1;
  if(b==c && c==d){
    cout << "Yes" << endl;
}
  else if(c==d &&d==e){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#pragma region Macros
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i, n) for(int i=(n); i>=0; --i)
#define FOR(i, n, m) for(int i=(m), i##_len=(n); i<i##_len; ++i)
#define EACH(i, v) for(const auto& i : v)
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
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; }
template<class Value>using vec = vector< Value >;
using ll = long long;
using P = pair< long long, long long >;
#define fi first
#define se second
#define el endl
#pragma endregion
void Main();

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

void Main(){
    string S;
    cin >> S;
    ll ans = 0;
    ll cnt = 0;
    REP(i, S.length()){
        if(S[i]=='W'){
            ans += i;
            cnt++;
        }
    }
    ans -= cnt*(cnt-1)/2;
    cout << ans << el;
}



Measured memory_bytes: 3732
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define MOD 1000000007
#define rep(i,n) for(i=0;i<n;i++)
#define loop(i,a,n) for(i=a;i<n;i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

typedef vector<int> vi;
typedef pair<int,int> pii;

int main(void) {
  int i,j;
  int n;
  cin>>n;
  ll ans=2;
  rep(i,n)ans=2*(ans+1);
  cout<<ans<<endl;
}


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



namespace CSharpSample01
{
    
    class Item
    {
        public decimal v;
        public decimal w;
        public decimal vw;
        public Item(decimal val, decimal wei)
        {
            v = val;
            w = wei;
            vw = val / wei;
        }
    }

    class Program
    {
        
        static void Main(string[] args)
        {
            int[] input = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
            int N = input[0];
            decimal W = input[1];

            Item[] item = new Item[N];

            for(int i = 0; i < N; i++)
            {
                input = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
                decimal v = input[0];
                decimal w = input[1];
                item[i] = new Item(v, w);
            }

            item = item.OrderByDescending(x => x.vw).ToArray();

            decimal maxval = 0;
            for(int i = 0; i < N; i++)
            {
                if(W - item[i].w >= 0)
                {
                    maxval += item[i].v;
                    W -= item[i].w;
                }
                else
                {
                    maxval += (decimal)item[i].v * W / item[i].w;
                    W = 0;
                }
                if (W == 0) break;
            }

            Console.WriteLine($"{maxval}");
        }
    }

}


Measured memory_bytes: 34736
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String s=scan.nextLine();
		if(s.equals("ABC")) 
		{
			s=s.replace("ABC", "ARC");
		}
		else
		{
			s=s.replace("ARC", "ABC");
		}
		System.out.println(s);
	}

}


Measured memory_bytes: 26844
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
        StringBuilder sb = new StringBuilder();
        String a = "dream";
        String b = "dreamer";
        String c = "erase";
        String d = "eraser";       
		int e = 0;
        String ans = "NO";
        while(e+4<s.length()){if(s.substring(e,e+5).equals(a))
        {if(e+6<s.length() && s.substring(e,e+7).equals(b)){if(e+9<s.length() && s.substring(e+5,e+10).equals(c)){sb.append(a);e+=5;}else{sb.append(b);e+=7;}}                                                                
             else{sb.append(a);e+=5;}
        }else{if(s.substring(e,e+5).equals(c)){if(e+5<s.length() && s.substring(e,e+6).equals(d)){sb.append(d);e+=6;}else{sb.append(c);e+=5;}}
             else{break;}
             }                                                      
                           }
         String t = sb.toString();
        if(s.equals(t)){ans = "YES";}
		System.out.println(ans);
	}
}

Measured memory_bytes: 27688
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;

using ll = long long;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using vc = vector<char>;
using vvc = vector<vector<char>>;
using vi = vector<int>;
using vs = vector<string>;

#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define repp(i, a, n) for(ll i = a; i < (ll)(n); i++)
#define repd(i, n) for(ll i = n - 1; i >= 0; i--)
#define all(x) x.begin(), x.end()

const ll M = 1e9 + 7;



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

	ll a, b, c, d;
	cin >> a >> b >> c >> d;

	if((b < 0 && 0 < c) || (d < 0 && 0 < a)) {
		cout << max(b * c, a * d) << endl;
	} else {
		cout << max(a * c, b * d) << endl;
	}
}

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

using namespace std;

using ll = long long;
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define FORE(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repe(i, n) for (int i = 0; i <= (n); ++i)
#define ALL(v) (v).begin(), (v).end()
#define SP cout << fixed << setprecision(10)
typedef pair<int, int> P;
const int INF = (int)1e9;
const int MOD = (int)1e9 + 7;
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }

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

    int t[5];
    rep(i, 5) cin >> t[i];

    int maxindex;
    int maxtime = INF;
    rep(i, 5) {
        int over = t[i] % 10;
        if (over != 0 and over < maxtime) {
            maxtime = over;
            maxindex = i;
        }
    }

    int time = 0;
    rep(i, 5) {
        if (i != maxindex) {
            if (t[i] % 10 == 0) {
                time += t[i];
            } else {
                time += (t[i] / 10 + 1) * 10;
            }
        } else {
            time += t[i];
        }
    }

    cout << time << endl;

    return 0;
}


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

int main()
{
  int N, M;
  cin >> N >> M;
  vector<int> X(M);
  for (int i = 0; i < M; i++)
  {
    cin >> X.at(i);
  }
  int ans;
  if (M - N <= 0)
    ans = 0;
  else
  {
    sort(X.begin(), X.end());
    vector<int> diffs;
    for (int i = 1; i < X.size(); i++)
      diffs.push_back(X.at(i) - X.at(i - 1));
    sort(diffs.begin(), diffs.end(), greater<int>());
    ans = X.at(M - 1) - X.at(0);
    for (int i = 0; i < N - 1; i++)
    {
      ans -= diffs.at(i);
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1276
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String str_n = scan.next();
		int n = Integer.parseInt(str_n);
		int n_length = str_n.length();
		int i = 0;
		int fx = 0;
		String message = "No";
		for(i = 0; i < n_length; i++) {
			int m = Integer.parseInt(str_n.charAt(i) + "");
			fx = fx + m;
		}
		if(n % fx == 0) {
			message = "Yes";
		}
		System.out.println(message);
	}
}

Measured memory_bytes: 21844
#include <iostream>
using namespace std;
int main(){
  for(int n;cin>>n&&n;){
    int w,h,w0,h0,xy[200][200]={},r=0;
  cin>>w>>h;
  for(int i=0,a,b;i<n&&cin>>a>>b;i++) xy[b-1][a-1]=1;
  cin>>w0>>h0;
  for(int i=0;i<h-h0+1;i++) for(int j=0;j<w-w0+1;j++){
      int r0=0;
      for(int k=0;k<h0;k++) for(int l=0;l<w0;l++) r0+=xy[i+k][j+l];
      r=max(r,r0);
    }
  cout<<r<<endl;
  }
  return 0;
}

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

int main()
{
    ll n;
    cin>>n;
    string s;
    cin>>s;
    if(n%2==1)
    {
        cout<<"No"<<endl;
        return 0;
    }
    string t1="",t2="";
    for(ll i=0;i<n;i++)
    {
        if(i<n/2)
        t1+= s[i];
        else 
        t2+= s[i];
    }
    if(t1==t2) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

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

#include <iostream>
#include <algorithm>

#include <bitset>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <stack>
#include <queue>
#include <deque>
#include <string>
#include <utility>
#include <array>
#include <complex>
#include <valarray>

#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <chrono>
#include <random>
#include <numeric>


using namespace std;
//#define int long long

typedef long long ll;
typedef unsigned long long ull;
//typedef unsigned __int128 HASH;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef pair<ull, ull> pullull;
typedef pair<ll,int> plli;
typedef pair<double, int> pdbi;
typedef pair<int,pii> pipii;
typedef pair<ll,pll> plpll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<pii> vpii;
typedef vector<vector<int>> mat;

#define rep(i,n) for (int i=0;i<(n);i++)
#define rep2(i,a,b) for (int i=(a);i<(b);i++)
#define rrep(i,n) for (int i=(n);i>0;i--)
#define rrep2(i,a,b) for (int i=(a);i>b;i--)
#define pb push_back
#define fi first
#define se second
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()

const ll hmod1 = 999999937;
const ll hmod2 = 1000000000 + 9;
const int INF = 1<<30;
const ll mod = 1000000000 + 7;
const int dx4[4] = {1, 0, -1, 0};
const int dy4[4] = {0, 1, 0, -1};
const int dx8[8] = {1, 1, 1, 0, 0, -1, -1, -1};
const int dy8[8] = {0, 1, -1, 1, -1, 0, 1, -1};
const double pi = 3.141592653589793;

#define addm(X, Y) (X) = ((X) + ((Y) % mod) + mod) % mod
#define inside(y, x, h, w) (0 <= (y) && (y) < (h) && 0 <= (x) && (x) < (w)) ? true : false

int pc[1005][1261], st[10005][1005];

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    while (true) {
        int N, M;
        cin >> N >> M;
        if (N == 0) break;
        rep(i, 1005)rep(j, 1261) pc[i][j] = -1;
        
        int r;
        cin >> r;
        rep(i, r) {
            int t, n, m, s;
            cin >> t >> n >> m >> s;
            if (s == 1) {
                st[m][n] = t;
            }
            else {
                rep2(j, st[m][n], t) {
                    pc[n][j] = m;
                }
            }
        }
        int q;
        cin >> q;
        rep(i, q) {
            int ts, te, m;
            cin >> ts >> te >> m;
            int ans = 0;
            rep2(now, ts, te) {
                rep2(j, 1, N + 1) {
                    if (pc[j][now] == m) {
                        ans++;
                        break;
                    }
                }
            }
            cout << ans << endl;
        }
    }

}

Measured memory_bytes: 13716
N = int(input())
A = [0] * N
X = [[] for n in range(N)]
Y = [[] for n in range(N)]

for i in range(N):
    a = int(input())
    A[i] = a
    for j in range(a):
        x, y = map(int, input().split())
        X[i].append(x)
        Y[i].append(y)

def solve(N, A, X, Y, B):
    for n in range(N):
        if B[n] == 0:
            continue
        for a in range(A[n]):
            if B[X[n][a] - 1] != Y[n][a]:
                return False
    return True

max_pop = 0
B = [0] * N

for i in range(2**N):
    pop = 0
    found = True
    for j in range(N):
        b = (i >> j) & 1
        B[j] = b
        pop += b
    if max_pop < pop and solve(N, A, X, Y, B):
        max_pop = pop

print(max_pop)


Measured memory_bytes: 45788
w = list(input())
atoz = [0 for i in range(26)]

for char in w:
    atoz[ord(char) - ord('a')] += 1

odd_flag = 0
for count in atoz:
    if count % 2 == 1:
        odd_flag = 1
        break

if odd_flag:
    print('No')
else:
    print('Yes')

Measured memory_bytes: 3060
from heapq import heappush, heappop

n, q = list(map(int, input().split(' ')))
pqueues = [[] for i in range(n)]

for i in range(q):
    op = list(map(int, input().split(' ')))
    if op[0] == 0:
        heappush(pqueues[op[1]], -op[2])
    elif op[0] == 1:
        if len(pqueues[op[1]]) != 0:
            print(-1*pqueues[op[1]][0])
    elif op[0] == 2:
        if len(pqueues[op[1]]) != 0:
            heappop(pqueues[op[1]])



Measured memory_bytes: 13180
#include <stdio.h>

int main(void) {
	int n, maxLen;
	scanf("%d %d", &n, &maxLen);
	int sum = 0;
	for(int i = 1; i < n; i++) {
		int len;
		scanf("%d", &len);
		if(len > maxLen) sum += maxLen, maxLen = len;
		else sum += len;
	}
	if(maxLen < sum) printf("Yes\n");
	else printf("No\n");
	// your code goes here
	return 0;
}


Measured memory_bytes: 128
#include "bits/stdc++.h"
#define PRECISION(x) cout << fixed << setprecision(x)
#define FAST_IO ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define ALLR(X) (X).rbegin(), (X).rend()
#define angle(a) (atan2((a).imag(), (a).real()))
#define vec(a, b) ((b) - (a))
#define length(a) (hypot((a).imag(), (a).real()))
#define dot(a, b) ((conj(a) * (b)).real())
#define cross(a, b) ((conj(a) * (b)).imag())
#define lengthSqr(p) dot(p, p)
#define rotateO(p, ang) ((p) * exp(point(0, ang)))
#define rotateA(p, ang, about) (rotateO(vec(about, p), ang) + about)
#define reflectO(v, m) (conj((v) / (m)) * (m))
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define F first
#define S second
#define X() real()
#define Y() imag()
using namespace std;
 
template<class T> void max_self(T & a, const T & b) { if(a < b) a = b; }
template<class T> void min_self(T & a, const T & b) { if(a > b) a = b; }
typedef long long LL;
typedef complex<double> point;
const int INF = 1e9 + 7;
const double PI = acos(-1.0);
const double EPS = (1e-9);


int main(){
	FAST_IO
	int N, M, count = 0; cin >> N >> M;
	
	vector<vector<int>> distance(N + 1, vector<int>(N + 1, INF));
	vector<int> one(M + 1), two(M + 1), weight(M + 1);
	
	for(int node = 1; node <= N; ++node) distance[node][node] = 0;
	
	for(int rep = 1; rep <= M; ++rep){
		int from, to, w; 
		cin >> from >> to >> w;
		distance[from][to] = distance[to][from] = w;
		one[rep] = from; two[rep] = to; weight[rep] = w;
	}
	
	for(int via = 1; via <= N; ++via){
		for(int from = 1; from <= N; ++from){
			for(int to = 1; to <= N; ++to){
				if(distance[from][via] == INF || distance[via][to] == INF) continue;
				if(distance[from][to] > distance[from][via] + distance[via][to]){
					distance[from][to] = distance[from][via] + distance[via][to];
				}
			}
		}
	}
	
	auto check = [&](int via, int edge){
		int from = one[edge], to = two[edge], w = weight[edge];
		if(abs(distance[via][from] - distance[via][to]) == w) return true;
		return false;
	};
	
	for(int edge = 1; edge <= M; ++edge){
		bool contained = false;
		for(int j = 1; j <= N; ++j){
			if(check(j, edge)){
				contained = true;
				break;
			}
		}
		if(!contained) count++;
	}
	
	cout << count << "\n";
}


Measured memory_bytes: 384
while True:
	a, b, c = input().split()
	a = int(a)
	c = int(c)
	if b == "?":
		break
	if b == "+":
		print(a + c)
	if b == "-":
		print(a - c)
	if b == "*":
		print(a * c)
	if b == "/":
		print(a // c)


Measured memory_bytes: 5596
#include<math.h>
#include <iostream>
using namespace std;
int main(void){

	int A, B; // ボタンww
	int X; //x枚のコインもらえる
	int coin; // コイン

	cin >> A;
	cin >> B;

	if (A == B) {
		cout << A + B << endl;
	}
	else if (A == B + 1) {
		cout << 2 * B + 1 << endl;
	}
	else if (B == A + 1){
		cout << 2 * A + 1 << endl;
	}
	else if (A > B + 1) {
		cout << 2 * A - 1 << endl;
	}
	else if (B > A + 1) {
		cout << 2 * B - 1 << endl;
	}
	

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end())
#define VRSORT(v) sort(v.rbegin(), v.rend())//vectorの降順ソート
#define ll long long
#define pb(a) push_back(a)
#define INF 1000000000
#define MOD 1000000007
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

typedef vector<unsigned int>vec;
typedef vector<vec> mat;
typedef tuple<ll, ll, ll> T;

int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;cin>>n;
    cout<<48-n<<endl;
}

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

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define rep2(i, a, b) for (ll i = (a); i < (b); i++)
typedef uint64_t ull;
typedef int64_t ll;
typedef std::pair<ll, ll> PLL;

using namespace std;

ll N, M;
vector<vector<ll>> edge;

vector<ll> f(ll root) {
  vector<ll> before(N, -1);
  queue<ll> q;
  q.push(root);
  while(q.size() > 0) {
    ll cur = q.front();
    q.pop();
    for (ll nxt : edge[cur]) {
      if (before[nxt] != -1) // すでに到達済み
        continue;
      before[nxt] = cur;
      q.push(nxt);
    }
  }

  if (before[root] == -1) {
    return vector<ll>(2*N);
  }

  vector<ll> res;
  res.push_back(root);
  ll b = before[root];
  while(b != root) {
    res.push_back(b);
    b = before[b];
  }
  return res;
}

signed main() {
  cin >> N >> M;
  edge.resize(N);
  rep(i,M){
    ll a, b;
    cin >> a >> b;
    a--; b--;
    edge[a].push_back(b);
  }

  //cout << "- ";
  //auto a = f(0);
  //for (auto x : a) {
  //  cout << x << " ";
  //}
  //cout << endl;
  //return 0;

  vector<ll> ans(2*N);
  rep(i,N) {
    auto a = f(i);
    //cout << "i=" << i << ": ";
    //rep(j,a.size()) {
    //  cout << a[j] << " ";
    //}
    //cout << endl;
    if (a.size() < ans.size()) {
      ans = a;
    }
  }
  if (ans.size() == 2*N) {
    cout << -1 << endl;
  } else {
    cout << ans.size() << endl;
    rep(i, ans.size()) {
      cout << ans[i]+1 << endl;
    }
  }
  return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < int(n); i++)
#define FOR(i, a, b) for (int i = a; i < int(b); i++)
#define FOREACH(i, v) for (__typeof((v).begin()) i = (v).begin(); i != (v).end(); i++)
#define SIZE(v) ((int)(v).size())
#define pb push_back
#define mp make_pair
#define st first
#define nd second
#define ll long long
#define llint long long
#define pii pair<int, int>
#define UNVISITED -1


template<typename T>
string to_string(const vector<T>& vc, int w) {
	if(vc.empty()) return "";
	if(w + 1 == vc.size()) return to_string(vc[w]);
	return to_string(vc[w]) + "," + to_string(vc, w + 1);
}
 
template<typename T>
string to_string(const vector<T>& vc) {
	return "{" + to_string(vc, 0) + "}";
}
 
void debug_out() { cerr << endl; }
 
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
 
#ifdef DEBUG
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif
 
class DebugStream {}LOG;
template <typename T>DebugStream &operator<<(DebugStream &s, const T&) { return s; }
#ifdef DEBUG
#define LOG clog
#endif

const int MAX = 500500;
ll x[MAX], y[MAX];

int main() {
    int N; scanf("%d", &N);
    REP(i, N) scanf("%lld %lld", x + i, y + i);
    ll xa[4], ya[4];
    REP(i, 4) xa[i] = x[0], ya[i] = y[0];

    REP(i, N) {
        if(xa[0] + ya[0] < x[i] + y[i]) {
            xa[0] = x[i];
            ya[0] = y[i];
        }
        if(xa[1] + ya[1] > x[i] + y[i]) {
            xa[1] = x[i];
            ya[1] = y[i];
        }
        if(xa[2] - ya[2] < x[i] - y[i]) {
            xa[2] = x[i];
            ya[2] = y[i];
        }
        if(xa[3] - ya[3] > x[i] - y[i]) {
            xa[3] = x[i];
            ya[3] = y[i];
        }
    }
    ll ans = 0;
    REP(i, N) {
        REP(j, 4) {
            ans = max(ans, abs(x[i] - xa[j]) + abs(y[i] - ya[j]));
        }
    }
    printf("%lld\n", ans);
}

Measured memory_bytes: 6940
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
	int L; cin >> L;
	int r = 0;
	int tmp = L / 2;
	while (tmp) {
		r++;
		tmp /= 2;
	}
	
	int N = r + 1;
	vector<int> left;
	vector<int> right;
	vector<int> len;
	rep(i, N - 1) {
		left.push_back(i + 1);
		right.push_back(i + 2);
		len.push_back((int)(pow(2, i) + 0.5));
		left.push_back(i + 1);
		right.push_back(i + 2);
		len.push_back(0);
	}
	RREP(t, N - 1, 1) {
		if (L - (int)(pow(2, t - 1) + 0.5) >= (int)(pow(2, r) + 0.5)) {
			left.push_back(t);
			right.push_back(N);
			len.push_back(L - (int)(pow(2, t - 1) + 0.5));
			L -= (int)(pow(2, t - 1) + 0.5);
		}
	}
	cout << N << " " << len.size() << endl;
	rep(i, len.size()) {
		cout << left[i] << " " << right[i] << " " << len[i] << endl;
	}
	

    return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define max0(a,b,c) max(max(a,b),c)
#define min0(a,b,c) min(min(a,b),c)
#define ft first
#define sc second
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define mod 1000000007
using namespace std;
using Graph = vector<vector<int>>;
typedef long long lint;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ldouble;
typedef vector<int> vec;
typedef vector<ll> lvec;
typedef vector<ull> ulvec;
typedef vector<double> dvec;
typedef vector<pair<int,int>> pvec;
typedef vector<pair<ll,ll>> plvec;
typedef vector<tuple<ll,ll,ll>> tvec;
typedef vector<string> svec;

const int INF=(1LL<<31)-1,MAX_N=1000000;
int n;
int d[MAX_N*2];

void init(int _n){
    n=1;
    while(n<_n) n*=2;
    for(int i=0;i<2*n-1;i++) d[i]=INF;
}

void update(int a,int b,int k,int l,int r,int x){
    if(r<=a||b<=l) return;
    if(a<=l&&r<=b){
        d[k]=x;
    }else{
        if(d[k]!=INF){
            d[2*k+1]=d[k];
            d[2*k+2]=d[k];
            d[k]=INF;
        }
        int m=(l+r)/2;
        if(m>=b) update(a,b,2*k+1,l,m,x);
        else if(m<=a) update(a,b,2*k+2,m,r,x);
        else{
            update(a,b,2*k+1,l,(l+r)/2,x);
            update(a,b,2*k+2,(l+r)/2,r,x);
        }
    }
}

int find(int i,int k,int l,int r){
    if(d[k]!=INF) return d[k];
    if(r-l==1) return d[k];
    int m=(l+r)/2;
    if(i<m) return find(i,2*k+1,l,m);
    return find(i,2*k+2,m,r);
}

int main(){
    int N,q;
    cin>>N>>q;
    init(N);
    rep(i,q){
        int a;
        cin>>a;
        if(a==0){
            int s,t,x;
            cin>>s>>t>>x;
            update(s,t+1,0,0,n,x);
        }else{
            int x;
            cin>>x;
            cout<<find(x,0,0,n)<<endl;
        }
    }
}


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

#define pb push_back
#define mp make_pair
#define fl(i,a,b) for(int i = a; i < b; i++)
#define fli(i,a,b,k) for(int i = a; i < b; i += k)

using namespace std;

typedef long long int lli;
typedef unsigned long long int ulli;
typedef pair<int,int> pi;
typedef vector<int> vi;
typedef vector<pair<int,int>> vpi;

bool p(int &a) {
    int t = a,r=0;
    while(t>0) {
        r = r*10 + t%10;
        t = t/10;
    }

    return (a==r);
}
int main() {
    int a,b,c = 0;
    cin >> a >> b;
    
    fl(i,a,b+1) {
        if(p(i)) c++;
    }

    cout << c;
    return 0;
}

Measured memory_bytes: 256
op = None
while(True):
    a, op, b = [x for x in input().split()];
    ans=0
    a=int(a)
    b=int(b)
    if(op=='+'):
        ans=a+b
    elif(op=='-'):
        ans=a-b
    elif(op=='*'):
        ans=a*b
    elif(op=='/'):
        ans=a//b
    else :break
    print(ans)
    


Measured memory_bytes: 5604
#include<iostream>
#include<algorithm>

using namespace std;

const int INF=0x3f3f3f3f;

int main()
{
	int n;
	cin>>n;
	int maxv=-INF;
	int minv;
	for(int i=0;i<n;i++){
		int r;
		cin>>r;
		if(i==0)minv=r;
		if(i>0){
			maxv=max(maxv,r-minv);//核心
			minv=min(minv,r);
		}
	}
	cout<<maxv<<endl;
	return 0;
}



Measured memory_bytes: 3104