akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#include<algorithm>
#include<cmath>
#include<map>
#include<stdio.h>
#include<vector>
using namespace std;
#define int long long
#define rep(s,i,n) for(int i=s;i<n;i++)
#define c(n) cout<<n<<endl;
#define ic(n) int n;cin>>n;
#define sc(s) string s;cin>>s;
#define mod 1000000007
#define inf 1000000000000000007
#define f first
#define s second
#define mini(c,a,b) *min_element(c+a,c+b)
#define maxi(c,a,b) *max_element(c+a,c+b)
#define P pair<int,int>
//printf("%.12Lf\n",);
int keta(int x){
	rep(0,i,30){
		if(x<10){
			return i+1;
		}
		x=x/10;
	}
}
int gcd(int x,int y){
	int aa=x,bb=y;
	rep(0,i,1000){
		aa=aa%bb;
		if(aa==0){
			return bb;
		}	
		bb=bb%aa;
		if(bb==0){
			return aa;
		}
	}
}	
int lcm(int x,int y){
	int aa=x,bb=y;
	rep(0,i,1000){
		aa=aa%bb;
		if(aa==0){
			return x/bb*y;
		}	
		bb=bb%aa;
		if(bb==0){
			return x/aa*y;
		}
	}
}
bool p(int x){
	if(x==1)return false;
	rep(2,i,sqrt(x)+1){
		if(x%i==0&&x!=i){
			return false;
		}
	}	
	return true;
}
int max(int a,int b){
	if(a>=b)return a;
	else return b;
}
int min(int a,int b){
	if(a>=b)return b;
	else return a;
}	
int n2[41];		
int nis[41]; 
int nia[41];
int mody[41];
int nn;
int com(int n,int y){
	int ni=1;
	for(int i=0;i<41;i++){
		n2[i]=ni;
		ni*=2;
	}
	int bunsi=1,bunbo=1;
	rep(0,i,y)bunsi=(bunsi*(n-i))%mod;
	rep(0,i,y)bunbo=(bunbo*(i+1))%mod;
	mody[0]=bunbo;
	rep(1,i,41){
		bunbo=(bunbo*bunbo)%mod;
		mody[i]=bunbo;
	}
	rep(0,i,41)nis[i]=0;
	nn=mod-2;
	for(int i=40;i>=0;i-=1){
		if(nn>n2[i]){
			nis[i]++;
			nn-=n2[i];
		}
	}
	nis[0]++;
	rep(0,i,41){
		if(nis[i]==1){
			bunsi=(bunsi*mody[i])%mod;
		}
	}
	return bunsi;
}
int yakuwa(int n){
	int sum=0;
	rep(1,i,sqrt(n+1)){
		if(n%i==0)sum+=i+n/i;
		if(i*i==n)sum-=i;
	}
	return sum;
}	
bool hei(int n){
	rep(0,i,100){
		if(i*i==n){
			return true;
		}
	}
	return false;
}
int pow(int b,int a){	
	int aa=1;
	rep(0,i,a)aa*=b;	
	return aa;
}
int sankaku(int a){
	return a*(a+1)/2;
} 
int a[114514];
signed main(){
	ic(n) ic(m)
	priority_queue<int> q;
	rep(0,i,n){
		cin>>a[i];
		q.push(a[i]);
	}
	rep(0,i,m){
		int b=q.top(); q.pop();
		q.push(b/2);
	}
	int ans=0;
	rep(0,i,n){
		ans+=q.top(); 
		q.pop();
	}	
	c(ans)
}	

Measured memory_bytes: 1912
import java.util.*;

public class Main{
	static Scanner s=new Scanner(System.in);

	public static void main(String[] $){
		String v=s.next();
		boolean f=v.startsWith("A");
		f&=v.substring(2,v.length()-1).chars().filter(o->o=='C').count()==1;
		f&=v.chars().filter(o->'A'<=o&&o<='Z').count()==2;
		
		System.out.println(f?"AC":"WA");
	}
}

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

typedef long long int ll;

int main()
{
    ll n;
    cin >> n;
    vector<ll> a(n + 2), b(n);
    a[0] = 0; a[n + 1] = 0;
    for(ll i = 1;i < n + 1;i++){
        cin >> a[i];
    }
    ll ans = 0;
    for(ll i = 0;i < n + 1;i++){
        ans += abs(a[i] - a[i + 1]);
    }
    for(ll i = 1;i < n + 1;i++){
        if(a[i] < a[i + 1] && a[i - 1] > a[i]){
            b[i - 1] = 2 * min(abs(a[i] - a[i + 1]), abs(a[i - 1] - a[i])); 
        }
        else if(a[i] > a[i + 1] && a[i - 1] < a[i]){
            b[i - 1] = 2 * min(abs(a[i] - a[i + 1]), abs(a[i - 1] - a[i]));
        }
    }

    for(ll i = 0;i < n;i++){
        cout << ans - b[i] << "\n";
    }

    return 0;
}

Measured memory_bytes: 2816
#!/usr/bin/env python3

import sys

input = sys.stdin.buffer.readline

x = int(input())


def find(x):
    for a in range(-300, 300):
        for b in range(-300, 300):
            if a ** 5 - b ** 5 == x:
                return [a, b]


a, b = find(x)
print(a, b)


Measured memory_bytes: 64444
#include<bits/stdc++.h>
#define REG register
using namespace std;

int n,k,c;

char d[200005];

int l[200005],r[200005];

inline void Work(){
    scanf("%d %d %d",&n,&k,&c);
    scanf("%s",d+1);
    int lst=0;
    for(REG int i=1;i<=n;++i)
        if(((!lst)||i-lst-1>=c)&&d[i]=='o') l[i]=l[i-1]+1,lst=i;
        else l[i]=l[i-1];
    lst=n+1;
    for(REG int i=n;i;--i)
        if((lst==n+1||lst-i-1>=c)&&d[i]=='o') r[i]=r[i+1]+1,lst=i;
        else r[i]=r[i+1];
    for(REG int i=1;i<=n;++i)
        if(l[i-1]+r[i+1]==k-1) printf("%d ",i);
}

int main(){Work();}

Measured memory_bytes: 3200
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
int main() {
   /* #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output1.txt", "w", stdout);
    #endif*/
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    int a,b,k;
    cin>>a>>b>>k;
    vector<int> v;
    for(int i=1;i<=min(a,b);i++){
        if(a%i==0 && b%i==0) v.push_back(i);
    }  
   // reverse()
    cout<<v[v.size()-k];
}

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

int n,q;
bool tag[4*maxn];
ll S[4*maxn],lazy[4*maxn];

void upd(int id,int l,int r,int ql,int qr,int v) {
    if (ql==l && qr==r) {
        tag[id]=1;
        lazy[id]+=v;
        return;
    }
    if (tag[id]) {
        S[id]+=lazy[id];
        if (l!=r) {
            tag[id<<1]=1;
            tag[id<<1|1]=1;
            lazy[id<<1]+=lazy[id];
            lazy[id<<1|1]+=lazy[id];
        }
        tag[id]=0;
        lazy[id]=0;
    }
    int m=l+r>>1;
    if (qr<=m) upd(id<<1,l,m,ql,qr,v);
    else if (ql>m) upd(id<<1|1,m+1,r,ql,qr,v);
    else upd(id<<1,l,m,ql,m,v),
         upd(id<<1|1,m+1,r,m+1,qr,v);
    ll lm=S[id<<1]; if (tag[id<<1]) lm+=lazy[id<<1];
    ll rm=S[id<<1|1]; if (tag[id<<1|1]) rm+=lazy[id<<1|1];
    S[id]=min(lm,rm);
}

ll query(int id,int l,int r,int ql,int qr) {
    if (tag[id]) {
        S[id]+=lazy[id];
        if (l!=r) {
            tag[id<<1]=1;
            tag[id<<1|1]=1;
            lazy[id<<1]+=lazy[id];
            lazy[id<<1|1]+=lazy[id];
        }
        tag[id]=0;
        lazy[id]=0;
    }
    if (ql==l && qr==r) return S[id];
    int m=l+r>>1;
    if (qr<=m) return query(id<<1,l,m,ql,qr);
    else if (ql>m) return query(id<<1|1,m+1,r,ql,qr);
    else return min(query(id<<1,l,m,ql,m),query(id<<1|1,m+1,r,m+1,qr));
}

int main() {
    cin>>n>>q;
    for (int i=0;i<q;i++) {
        int f,s,t,x; cin>>f>>s>>t;
        if (f) cout<<query(1,0,n-1,s,t)<<'\n';
        else {
            cin>>x;
            upd(1,0,n-1,s,t,x);
        }
    }
}


Measured memory_bytes: 7448
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <cmath>
#include <iomanip>
#include <bitset>
#include <string>
#include <stdlib.h>
using namespace std;
//cout <<  << endl;
typedef long long int ll;
typedef long double ld;

#define MAX_N 1000
#define MAX_M 100

//境界値に注意！！！

int main() {
    string s;
    cin >> s;
    ll ans=0;
    string a="";
    for (ll i=0;i<s.size();++i){
        string b;
        b=s[s.size()-1-i];
        if (b==a && s.size()-i-1>0){
            ++i;
            b+=s[s.size()-1-i];
        }else if (b==a){
            break;
        }
        a=b;
        ans+=1;
    }
    cout << ans << endl;
    return 0;
}


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

int main() {
    int n, k;
    cin >> n >> k;
    int cnt = 0;
    rep(i, n) {
        int a;
        cin >> a;
        if (a >= k)
            cnt++;
    }
    cout << cnt << endl;
}

Measured memory_bytes: 256
n = int(input())
m = list(map(int, input().split()))

for i in range(n)[::-1]:
    if i == 0:
        break
    if m[i] >= m[i-1]:
        continue
    elif m[i] == m[i-1] - 1:
        m[i-1] -= 1
    else:
        print("No")
        exit(0)
print("Yes")


Measured memory_bytes: 14396
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<sstream>
using namespace std;
typedef  long long int lint;
typedef pair<int, int> IP;
typedef pair<lint, lint> LLP;
typedef pair<char, char>CP;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define sort(v) sort((v).begin(), (v).end())
#define reverse(v) reverse((v).begin(), (v).end())
#define upper(v,hoge) upper_bound(v.begin(),v.end(),hoge)
#define lower(v,hoge) lower_bound(v.begin(),v.end(),hoge)
#define llower(v,hoge) *lower_bound(v.begin(), v.end(), hoge)
#define lupper(v,hoge) *upper_bound(v.begin(), v.end(), hoge)
const lint MOD = pow(10, 9) + 7;

int main() {
	int N;
	cin >> N;
	vector<int>A(N);
	rep(i, N) {
		cin >> A[i];
	}
	int cnt = 0;
	rep(i, N) {
		rep(j, N-1) {
			if (A[j] > A[j + 1]) {
				swap(A[j], A[j + 1]);
				cnt++;
			}
		}
	}
	rep(i, N) {
		cout << A[i];
		if (i != N - 1)cout << ' ';
	}
	cout << endl << cnt << endl;
}


Measured memory_bytes: 3112
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using u64 = unsigned long long;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

void solve(int x){
    vector<int> M(12), N(12);
    int S = 0;
    for (int i = 0; i < 12; ++i) {
        cin >> M[i] >> N[i];
    }
    for (int i = 0; i < 12; ++i) {
        S += M[i]-N[i];
        if(S >= x){
            cout << i+1 << "\n";
            return;
        }
    }
    puts("NA");
}

int main() {
    int x;
    while(cin >> x, x){
        solve(x);
    }
    return 0;
}


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

int main(){
    int h, w;
    cin >> h >> w;
    vector <string> a(h);
    for(int i = 0; i < h; i++){
        cin >> a[i];
    }
    
    vector <bool> row(h, false);
    vector <bool> col(w, false);
    for(int i = 0; i< h; i++){
        for(int j = 0; j < w; j++){
            if(a[i][j] == '#'){
                row[i] = true;
                col[j] = true;
            } 
        }
    }
    
    for(int i = 0; i< h; i++){
        if(row[i]){
            for(int j = 0; j < w; j++){
                if(col[j]){
                    cout << a[i][j];
                }
            }
            cout << endl;
        }
    }
}

Measured memory_bytes: 256
#include <iostream>
 
using namespace std;
 
int main(){
    int N,ac=0,wa=0,tle=0,re=0;
    char S[3];
    cin>>N;
    for(int i=0;i<N;i++){
        cin>>S;
        if(S[0]=='A')ac++;
        else if(S[0]=='W')wa++;
        else if(S[0]=='T')tle++;
        else if(S[0]=='R')re++;
    }
    printf("AC x %d\n",ac);
    printf("WA x %d\n",wa);
    printf("TLE x %d\n",tle);
    printf("RE x %d\n",re);
}

Measured memory_bytes: 3736
N,A,B = list(map(int,input().split()))

sum_digid = 0
sum = 0
n = 0

for i in range(1,N+1):
    n=i
    sum_digid=0
    while n>0:
        sum_digid += n%10
        n //= 10

    if sum_digid >= A and sum_digid <= B:
        sum += i

print(sum)



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

int main(void)
{
    string s;
    int n, k;
    char c;

    cin >> n >> s >> k;
    c = s[k-1];
    for (int i = 0; i < n; i++) {
        if (s[i] != c) s[i] = '*';
    }
    cout << s << endl;
    return 0;
}


Measured memory_bytes: 256
n = int(input())
ai = list(map(int, input().split()))

#print(ai)
dai={}
dbi={}
for i in range(1, n+1):
    dai.setdefault(i, ai[i-1])
    dbi.setdefault(i, 0)

#print(dai)
#print(dbi)

anssum=0
ans=[]
for i in range(1, n+1)[::-1]:
    #print(i)
    tmp=0
    for j in range(2, n+1):
        check=i*j
        if check <= n:
            tmp = tmp + dbi[check]
        else:
            break
    tmp = tmp%2
    #print(str(tmp) + ", " + str(dai[i]))
    if tmp != dai[i]:
        dbi[i]=1
        anssum=anssum+1
        ans.append(i)

#print(dbi)
print(anssum)
if anssum != 0:
    print(" ".join(map(str, reversed(ans))))


Measured memory_bytes: 51008
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> P;
const ll mod = 1000000007;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
#define _GLIBCXX_DEBUG 

int main(){
    int N;
    cin>>N;
    ll ans=1;
    rep1(i,N){
        ans*=i;
        ans%=mod;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3680
//#pragma GCC optimize("Ofast,unroll-loops,no-stack-protector")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#include <bits/stdc++.h>
using namespace std;

#define debug(s) cout<< #s <<" = "<< s <<endl
#define all(v) (v).begin(), (v).end()
#define KeepUnique(v) (v).erase( unique(all(v)), v.end() )
#define MEMSET(a,val) memset(a, val, sizeof a)
#define PB push_back
#define endl '\n'

inline int myrand(int l, int r) {
	int ret = rand(); ret <<= 15; ret ^= rand();
	if(ret < 0) ret = -ret; ret %= (r-l+1); ret += l;
	return ret;
}
template <typename F, typename S>
ostream& operator << (ostream& os, const pair< F, S>& p) {
    return os<<"(" <<p.first<<", "<<p.second<<")"; }

typedef pair<int, int> ii;
template<typename T> using min_pq =
	priority_queue<T, vector<T>, greater<T> >;

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

const int maxn = 200010;

int n;
int where[maxn];
int dp[maxn];

int get(int i) {
	if(i == 1) return 1;
	int &ret = dp[i];
	if(ret != -1) return ret;
	ret = 0;
	if(where[i-1] < where[i]) ret = get(i-1) + 1;
	else ret = 1;
	return ret;
}

int32_t main () {
	//freopen("in", "r", stdin);
	//freopen("output.out", "w", stdout);
	cin>>n;
	for(int i=1; i<=n; i++) {
		int x; cin>>x;
		where[x] = i;
	}
	MEMSET(dp, -1);
	int mx = 0;
	for(int i=1; i<=n; i++) {
		mx = max(mx, get(i));
	}
	cout<<n - mx<<endl;
}

Measured memory_bytes: 1920
n,m=map(int,input().split())
x=[[]for _ in range(n+1)]
y=[None]*(n+1)
a="Yes"
for num in range(m):
	i,j,k=map(int,input().split())
	x[i].append((j,k))
	x[j].append((i,-k))
for i in range(1,n+1):
	if y[i]==None:
		y[i]=0;q=[i]
		while q:
			p=q.pop()
			for j,k in x[p]:
				if y[j]==None:q+=[j];y[j]=y[p]+k
for i in range(1,n+1):
	for j,k in x[i]:
		if y[i]+k!=y[j]:a="No"
print(a)

Measured memory_bytes: 65884
#include <iostream>
#include <bitset>
#include <iomanip>
#include <string>
#include <vector>
#include <cmath>
#include <queue>
#include <algorithm>

using namespace std;

int main()
{
	long long n,k,ans=-1;
	cin >> n;

	vector<long long> x(n);

	for (long long i = 0; i < x.size(); i++)
		cin >> x[i];

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

	for (long long i = 1; i <= x[n-1]; i++)
	{
		long long total = 0;
		for (long long j = 0; j < x.size(); j++)
		{
			total += (x[j] - i)*(x[j] - i);
		}
		if (ans == -1 || total < ans)
			ans = total;
	}

	cout << ans << endl;

	
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
	
	int A, B, C;

	cin>>A>>B>>C;

	int div, tot=0;

	div = B/A;
	if(div < C)
		tot = div;
	else 
		tot = C;

	cout<<tot<<'\n';
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define f first
#define s second
using namespace std;
using ll = long long;
using ii = pair<int, int>;
constexpr ll MOD = 1e9+7;

template<typename T> class fenwick_tree {
private: vector<T> FT;
public:
	fenwick_tree(int N) { FT.assign(N + 2, 0); }
	void update(int x, T val) { ++x;if(x)for(; x < FT.size(); x += x & -x) (FT[x] += val + MOD) %= MOD; }
	T query(int x) { T ret = 0; ++x;if(x)for(; x > 0; x -= x & -x) (ret += FT[x] + MOD) %= MOD; return ret; }
	T query(int x, int y) { return query(y) - query(x - 1); }
};

ll S[100001];

int main() {
	ios_base::sync_with_stdio(0), cin.tie(0);

	ll N, A, B; cin >> N >> A >> B;
	for (int i = 0; i < N; ++i) cin >> S[i];
	
	fenwick_tree<ll> X(N), Y(N);
	vector<ii> ux, uy;
	X.update(0, 1), ux.emplace_back(0, 1);
	Y.update(0, 1), uy.emplace_back(0, 1);
	for (int i = 1, j = -1, k = -1; i < N; ++i) {
		while (j < N && S[i] - S[j + 1] >= B) ++j;
		int y = X.query(0, j + 1);

		while (k < N && S[i] - S[k + 1] >= A) ++k;
		int x = Y.query(0, k + 1);
		
		if (S[i] - S[i - 1] < A) {
			for (auto x : ux) X.update(x.f, -x.s);
			ux.clear();
		}
		if (S[i] - S[i - 1] < B) {
			for (auto y : uy) Y.update(y.f, -y.s);
			uy.clear();
		}

		if (y) Y.update(i, y), uy.emplace_back(i, y);
		if (x) X.update(i, x), ux.emplace_back(i, x);
	}

	cout << (X.query(0, N) + Y.query(0, N)) % MOD;
}


Measured memory_bytes: 7488
#include <bits/stdc++.h>
#define bug1(x) cout<<#x<<" = "<<x<<endl
#define bug2(x,y) cout<<#x<<" = "<<x<<" "<<#y<<" = "<<y<<endl
#define bug3(x,y,z) cout<<#x<<" = "<<x<<" "<<#y<<" = "<<y<<" "<<#z<<" = "<<z<<endl
#define bug4(x,y,z,m) cout<<#x<<" = "<<x<<" "<<#y<<" = "<<y<<" "<<#z<<" = "<<z<<" "<<#m<<" = "<<m<<endl

using namespace std;

class Debugger {
public:
	template<typename T>
	void printVector(vector<T> const &vec, bool printSize=true){
		if(printSize){
			cout << vec.size() << endl;
		}
		for(auto &elem : vec){
			cout << elem << " ";
		}
		cout << endl;
	}

	template<typename T>
	void printMatrix(vector<vector<T>> const &matrix){
		cout << matrix.size()<< " ";
		if(!matrix.empty()){
			cout << matrix[0].size();
		}
		cout << endl; 
		for(auto &vec : matrix){
			printVector(vec, false);
		}
		cout << endl;
	}
};

const int MAXN = 10000001;
#define ll long long 

class TaskD {
private:
	Debugger debugger;

public:
	void solveOne(int it){
		int n, k;
		cin >> n >> k;
		vector<int> next(n);
		for(int i = 0; i < n; i++) {
			cin >> next[i];
			next[i]--;
		}
		vector<int> price(n);
		for(int i = 0; i < n; i++) {
			cin >> price[i];
		}
		ll ans = -(1e18);
		vector<bool> vis(n, false);
		for(int i = 0; i < n; i++) {
			if(vis[i]) {
				continue;
			}
			vector<int> all;
			int u = i;
			while(!vis[u]) {
				all.push_back(u);
				vis[u] = true;
				u = next[u];
			}
			int sz = all.size();
			vector<ll> sum(sz, 0);
			for(int j = 0; j < sz; j++) {
				sum[j] = price[all[j]];
				if(j > 0) {
					sum[j] += sum[j-1];
				}
			}
			for(int op1 = 0; op1 < sz; op1++) {
				for(int op2 = 0; op2 < sz; op2++) {
					ll score = 0;
					ll jumps = 0;
					if(op1 <= op2) {
						score += sum[op2] - (op1>0?sum[op1-1]:0);
						jumps = op2-op1+1;
					} else {
						score += sum[op2] + (sum.back() - (op1>0?sum[op1-1]:0));
						jumps = op2+1 + sz-op1;
					}
					if(jumps > k) {
						continue;
					}
					ll have = k - jumps;
					ll cycles = have / sz;
					if(sum.back() > 0) {
						score += cycles * sum.back();
					}
					ans = max(ans, score);
				}
			}
		}
		cout << ans << endl;


	}

	void solve(){
		int tc = 1;
		for(int it = 1; it <= tc; it++){
			solveOne(it);
		}
	}
};


int main(){
	ios_base::sync_with_stdio(false);
	TaskD solver;
	solver.solve();
	return 0;
}


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

void show(int m[20][20],int x,int y){
  for(int i=0;i<20;i++){
    for(int j=0;j<20;j++){
      if(i==x&&j==y){
        cout << "X";
        continue;
      }
      cout << m[i][j];
    }
    cout << endl;
  }
  cout << endl;
}
int main(){
  while(1){
    int N=0;
    cin >> N;
    if(N==0)break;
    int m[21][21]={0};
    for(int i=0;i<N;i++){
      int x,y;
      cin >> x >> y;
      m[x][y]=1;
    }
    int M;
    cin >> M;
    map<char,pair<int,int> > mp;
    mp['N'].first=0;
    mp['N'].second=1;
    mp['E'].first=1;
    mp['E'].second=0;
    mp['S'].first=0;
    mp['S'].second=-1;
    mp['W'].first=-1;
    mp['W'].second=0;
    int count=0;
    int nx=10,ny=10;
    if(m[nx][ny]==1){
      count++;
      m[nx][ny]=0;
    }
    for(int i=0;i<M;i++){
      char Q;
      int D;
      cin >> Q >> D;
      for(int j=0;j<D;j++){
        nx+=mp[Q].first;
        ny+=mp[Q].second;
        if(m[nx][ny]==1){
          count++;
          m[nx][ny]=0;
        }
      }
    }
    if(count==N){
      cout << "Yes" << endl;
    }else{
      cout << "No" << endl;
    }
  }
}



Measured memory_bytes: 3084
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
const ll INF = 1LL << 60;
const double PI = 3.141592653589793238;
const double EPS = 1e-10;
int main() {
	int A, B, K;
	cin >> A >> B >> K;
	int cnt = 0;
	for (int i = 100; i >= 1; i--) {
		if (A%i == 0 && B%i == 0) {
			cnt++;
			if (cnt == K) {
				cout << i << endl;
				return 0;
			}
		}
	}
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int N = 200000;
const int MOD = 1e9 + 7;
int n;
int ai[N], vis[N], cir[N], cnt[N], V[N];
vector <int> bi[N];
int ans = 1;
int f[N], fac[N], inv[N];
int powi(int a, int b)
{
    int c = 1;
    for (; b; b >>= 1, a = 1ll * a * a % MOD)
        if (b & 1) c = 1ll * c * a % MOD; return c;
}
int C(int a, int b)
{
    return 1ll * fac[a] * inv[b] % MOD * inv[a - b] % MOD;
}
int main()
{
    scanf("%d", &n);
    for (int i = 1; i <= n; ++ i)
        scanf("%d", &ai[i]), bi[ai[i]].push_back(i);
    for (int i = 1; i <= n; ++ i)
        if (!vis[i])
        {
            int p = i;
            for (; !vis[p]; p = ai[p]) vis[p] = i;
            if (vis[p] == i)
            for (; !cir[p]; p = ai[p]) cir[p] = 1;
        }
    for (int i = 1; i <= n; ++ i)
        if (bi[i].size() - cir[i] > 1)
            return puts("0"), 0;
    for (int i = 1; i <= n; ++ i)
        if (bi[i].size() > 1 && !cir[bi[i][1]])
            swap(bi[i][0], bi[i][1]);
    for (int i = 1; i <= n; ++ i) vis[i] = 0;
    for (int i = 1; i <= n; ++ i)
        if (cir[i] && !vis[i])
        {
            int l = 0, G = 0;
            for (int j = i; !vis[j]; j = ai[j])
            {
                l ++;
                vis[j] = 1;
                cnt[l] = 0;
                if (!cir[bi[j][0]])
                    for (int k = j; bi[k].size(); k = bi[k][0])
                        cnt[l] ++, G = 1;
            }
            if (!G)
            {
                V[l] ++;
                continue;
            }
            for (int j = 1; j <= l; ++ j) cnt[j + l] = cnt[j];
            int x = 1;
            while (!cnt[x]) x ++;
            for (int j = x + 1, k = x; j <= x + l; ++ j)
                if (cnt[j])
                {
                    if (cnt[j] > j - k) return puts("0"), 0;
                    else if (cnt[j] < j - k) ans = 2ll * ans % MOD;
                    k = j;
                }
        }
    f[0] = 1;
    for (int i = 1; i <= n; ++ i) f[i] = 1ll * f[i - 1] * (2 * i - 1) % MOD;
    fac[0] = 1;
    for (int i = 1; i <= n; ++ i) fac[i] = 1ll * fac[i - 1] * i % MOD;
    inv[n] = powi(fac[n], MOD - 2);
    for (int i = n - 1; ~i; -- i) inv[i] = 1ll * inv[i + 1] * (i + 1) % MOD;
    for (int i = 1; i <= n; ++ i)
    {
        int res = 0;
        for (int j = 0, k = 1; j <= V[i] / 2; ++ j, k = 1ll * k * i % MOD)
            res = (res + 1ll * C(V[i], j * 2) * f[j] % MOD * k % MOD * (i > 1 && (i & 1)? powi(2, V[i] - j * 2): 1)) % MOD;
        ans = 1ll * ans * res % MOD;
    }
    printf("%d\n", ans);
}


Measured memory_bytes: 13056
class Node:
    
    def __init__(self, i):
        self.end = i + 1
        self.days = {i}


N, M = list(map(int, input().split()))
BA = []
for i in range(N):
    a, b = list(map(int, input().split()))
    BA.append((b, a))

ans = 0
schedule = {}


def concat(node1, node2, x):
    if len(node1.days) < len(node2.days):
        node1, node2 = node2, node1
    else:
        node1.end = node2.end
    node1.days |= node2.days
    for i in node2.days:
        schedule[i] = node1
    schedule[x] = node1
    node1.days.add(x)

BA.sort(reverse=True)
for b, a in BA:
    x = a
    if a in schedule:
        x = schedule[a].end
    if x > M:
        continue
    ans += b
    if x - 1 in schedule:
        w1 = schedule[x - 1]
        if x + 1 in schedule:
            w2 = schedule[x + 1]
            concat(w1, w2, x)
        else:
            schedule[x] = w1
            w1.end += 1
            w1.days.add(x)
    elif x + 1 in schedule:
        w2 = schedule[x + 1]
        schedule[x] = w2
        w2.days.add(x)
    else:
        schedule[x] = Node(x)
print(ans)

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

using namespace std;

#define debug(n) cerr << #n << ':' << n << endl;
#define dline    cerr << __LINE__ << endl;

using ll = long long;
template<class T, class U> using P = pair<T,U>;
template<class T> using Heap = priority_queue<T>;
template<class T> using heaP = priority_queue<T,vector<T>,greater<T>>;
template<class T,class U> using umap = unordered_map<T,U>;
template<class T> using uset = unordered_set<T>;

template<class T>
bool ChangeMax(T&a,const T&b){
  if(a >= b) return false;
  a = b;    return true;
}

template<class T>
bool ChangeMin(T&a,const T&b){
  if(a <= b) return false;
  a = b;    return true;  
}

template<class T, size_t N, class U>
void Fill(T (&a)[N], const U&v){
    fill((U*)a,(U*)(a+N),v);
}

template<class T>
istream& operator >> (istream&is, vector<T>&v){
  for(auto&e:v)is >> e;
  return is;
}

int main(){
  int a,b,m; cin >> a >> b >> m;
  vector<int> r(a),d(b); cin >> r >> d;
  int ans = 0;
  int rmin = 1001001001;
  for(int i = 0; i < a; ++i)rmin = min(rmin,r[i]);
  ans += rmin;
  rmin = 100100101;
  for(int i = 0; i < b; ++i)rmin = min(rmin,d[i]);
  ans += rmin;
  for(int i = 0; i < m; ++i){
    int x,y; cin >> x >> y;x--;y--;
    int c; cin >> c;
    ChangeMin(ans,r[x]+d[y]-c);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1024
using System;

namespace ITP1_1_D
{
    class Program
    {
        public static void Main()
        {
            int val = int.Parse(Console.ReadLine());

            int val1 = val/3600;
            int val2 = (val - val1 * 3600)/60;
            int val3 = (val - val1 * 3600 - val2 * 60);

            Console.WriteLine(String.Format("{0}:{1}:{2}",val1, val2, val3));
        }
    }
}


Measured memory_bytes: 17980
#include<vector>
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;

#define BEGIN ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define END return EXIT_SUCCESS
#define up(I,A,B) for(auto I=(A);I<=(B);++I)
#define pb push_back
template<class T>inline bool chmax(T& a,T b){if(a<b){a=b;return true;}return false;}
template<class T>inline void                             in(T &p){cin>>p;}
template<class T1,class T2>inline void                   in(T1 &p1,T2 &p2){cin>>p1>>p2;}
template<class T1,class T2,class T3>inline void          in(T1 &p1,T2 &p2,T3 &p3){cin>>p1>>p2>>p3;}
template<class T1,class T2,class T3,class T4>inline void in(T1 &p1,T2 &p2,T3 &p3,T4 &p4){cin>>p1>>p2>>p3>>p4;}
template<class T>inline void                             ins(T &p){for_each(all(p),in<decltype(p[0])>);}
template<class T>inline void                             out(T p){cout<<p<<endl;}
template<class T1,class T2>inline void                   out(T1 p1,T2 p2){cout<<p1<<" "<<p2<<endl;}
template<class T1,class T2,class T3>inline void          out(T1 p1,T2 p2,T3 p3){cout<<p1<<" "<<p2<<" "<<p3<<endl;}
template<class T1,class T2,class T3,class T4>inline void out(T1 p1,T2 p2,T3 p3,T4 p4){cout<<p1<<" "<<p2<<" "<<p3<<" "<<p4<<endl;}
template<class T>inline void                             outs(T p){for_each(all(p),out<decltype(p[0])>);}
long N,K,len=1,i,M,ans=1,L,A,k;
string S;
vector<long>v,s;
inline void solve(void){
  in(N,K,S);
  up(i,1,N-1){
    if(S[i]==S[i-1])len++;
    else{
      v.pb(len);
      len=1;
    }
  }
  v.pb(len);
  M=v.size();
  s.resize(M+1);
  for(i=0;i<M;i++)s[i+1]=s[i]+v[i];
  A=S[0]=='1'?0:1;
  for(k=0;k<=K;k++){
    L=2*k+1;
    for(i=A;i+L<=M;i+=2)chmax(ans,s[i+L]-s[i]);
  }
  for(i=A;i+L<=M;i+=2)chmax(ans,s[i+L]-s[i]);
  if(S[0]=='0')chmax(ans,s[min(K*2,M)]-s[0]);
  if(S[N-1]=='0')chmax(ans,s[M]-s[max(M-K*2,0L)]);
  out(ans);
}

int main(int argc,char**argv){
  BEGIN;
  solve();
  END;
}


Measured memory_bytes: 2116
#include<iostream>
#include<vector>
#include <cctype>

int main()
{
	int N;
	std::cin >> N;

	int change_idx;
	std::cin >> change_idx;

	std::vector<char> Cs;



	for (int i = 0; i < N; ++i) {
		char c;
		std::cin >> c;
		if (i == change_idx - 1) {
			c = std::tolower(c);
		}
		Cs.push_back(c);
	}

	for (auto c : Cs) {
		std::cout << c;
	}

	return 0;
}

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

using namespace std;

#define range(i, m, n) for(int i = m; i < n; i++)
#define husk(i, m, n) for(int i = m; i > n; i--)

int tt;

int main() {
  cin >> tt;
  while(tt--) {
    long long a, b, c, d;
    cin >> a >> b >> c >> d;
    if(min(a, d) < b) {
      cout << "No" << endl;
      continue;
    }
    a %= b;
    if(a > c) {
      cout << "No" << endl;
      continue;
    }
    long long t = __gcd(d, b);
    a %= t;
    if((b - a - 1) / t > (c - a) / t) {
      cout << "No" << endl;
    } else {
      cout << "Yes" << endl;
    }
  }
  return 0;
}


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

#define lli long long int
#define REP(i,s,n) for(int i=s;i<n;i++)
#define NUM 2520
#define INF (1LL<<50)
#define DEBUG 0
#define mp(a,b) make_pair(a,b)
#define SORT(V) sort(V.begin(),V.end())
#define PI (3.141592653589794)
#define TO_STRING(VariableName) # VariableName
#define LOG(x) if(DEBUG)cout<<TO_STRING(x)<<"="<<x<<" "<<endl;
#define LOG2(x,y) if(DEBUG)cout<<TO_STRING(x)<<"="<<x<<" "<<TO_STRING(y)<<"="<<y<<endl;
#define LOG3(x,y,z) if(DEBUG)cout<<TO_STRING(x)<<"="<<x<<" "<<TO_STRING(y)<<"="<<y<<" "<<TO_STRING(z)<<"="<<z<<endl;
#define LOG4(w,x,y,z) if(DEBUG)cout<<TO_STRING(w)<<"="<<w<<" "<<TO_STRING(x)<<"="<<x<<" "<<TO_STRING(y)<<"="<<y<<" "<<TO_STRING(z)<<"="<<z<<endl;

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; }



void func(long long N, std::vector<std::string> S){

    set<string> s;
    REP(i,0,N){
        s.insert(S[i]);
    }
    cout<<s.size()<<endl;

}

int main(){
    // cout << fixed << setprecision(5);

    long long N;
    scanf("%lld",&N);
    std::vector<std::string> S(N);
    for(int i = 0 ; i < N ; i++){
        std::cin >> S[i];
    }
    func(N, std::move(S));
    return 0;
}


Measured memory_bytes: 25232
;; D - Maze Master

(defun main ()
  (let* ((h (read)) ; 高さ
         (w (read)) ; 幅
         (maze (make-array h :initial-contents
                 (loop repeat h collect (read-line)))))
    (princ (solve h w maze))
    (fresh-line)))

(defun solve (h w maze)
  "移動回数の最大値を返す"
  (loop for y below h maximize
    (loop for x below w maximize
      (longest-distance maze x y))))

(defmacro peek (maze x y)
  `(aref (aref ,maze ,y) ,x))

(defun longest-distance (maze x y)
  "位置(x,y)から最も遠い点までの距離を返す. (x,y)が道でなければ -1"
  (let* ((h (array-dimension maze 0))
         (w (array-dimension (aref maze 0) 0))
         (dist (make-array (list w h) :initial-element -1)))
    (labels
      ((valid-pos (x y)
         (and (<= 0 x) (< x w) (<= 0 y) (< y h) (eql (peek maze x y) #\.)))
       (bfs (queue)
         (when queue
           (destructuring-bind (x y d) (pop queue)
             (when (and (valid-pos x y) (minusp (aref dist x y)))
               (setf (aref dist x y) d)
               (setf queue
                 (append queue
                   (mapcar
                     #'(lambda (v)
                         (list (+ x (first v)) (+ y (second v)) (1+ d)))
                     '((-1 0) (0 -1) (1 0) (0 1))))))
             (bfs queue)))))
      (bfs (list (list x y 0))))
    (loop for y below h maximize
      (loop for x below w maximize (aref dist x y)))))

(main)


Measured memory_bytes: 59876
#include <bits/stdc++.h>
#include <fstream>
using namespace std;
typedef long long lint;
#define rep(i,n) for(lint (i)=0;(i)<(n);(i)++)
#define repp(i,m,n) for(lint (i)=(m);(i)<(n);(i)++)
#define repm(i,n) for(lint (i)=(n-1);(i)>=0;(i)--)
#define INF (1ll<<60)
#define all(x) (x).begin(),(x).end()
const lint MOD =998244353;
const lint MAX = 1000000;
using Graph =vector<vector<lint>>;
typedef pair<lint,lint> P;
typedef map<lint,lint> M;
 
lint fac[MAX], finv[MAX], inv[MAX];
 
void COMinit() 
{
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (lint i = 2; i < MAX; i++)
    {
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
 
long long COM(lint n, lint k)
{
    if (n < k)
        return 0;
    if (n < 0 || k < 0)
        return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
 
lint primary(lint num)
{
    if (num < 2) return 0;
    else if (num == 2) return 1;
    else if (num % 2 == 0) return 0;
 
    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            return 0;
        }
    }
 
    return 1;
}
   long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
    lint lcm(lint a,lint b){
        return a/__gcd(a,b)*b;
    }
     lint gcd(lint a,lint b){
        return __gcd(a,b);
    } 
    


  int main(){
     lint n,q;
     string s;
     cin>>s;
     cout<<s[0]<<s[1]<<s[2];
     
  }
 
  
      
      
    
 
  
          
  

Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
typedef signed long long ll;
typedef vector<int> vi;
 
#define REP(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
#define ALL(a) (a).begin(), (a).end()
#define out(a) cout << (a) << endl

int main(){
	int i,j,k,n,m,l,f,x,y,z; string s;
	cin >> s >> k;
	n = s.size();
	vector<string> vs;

	rep(i, n){
		for(j = 1; j<k+1 ;j++){
			vs.push_back(s.substr(i, j));
		}
	}

	sort(ALL(vs));

	vs.erase(unique(ALL(vs)),vs.end());

	k--;
	out(vs[k]);
}

Measured memory_bytes: 1660
N, A, B = map(int, input().split())
if A > B:
  print(0)
  exit()
if N == 1 and A != B:
  print(0)
  exit()
s1 = A * (N - 1) + B
s2 = B * (N - 1) + A
print(s2 - s1 + 1)

Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
#define sf(n) scanf("%d", &n)
#define pd(n) printf("%.12lf", n)
#define pf(n) printf("%d", n)
#define p() printf("\n")
#define ps() printf(" ")
#define ll long long
#define ull unsigned long long
#define MAX 1e9
#define mod 1000 * 1000 * 1000 + 7
#define ex 1e18
#define dbl 2e09
#define qu(q) queue<int> q
#define pqu(q) priority_queue<int> q
#define len(s) s.length()
#define sz(x) int(x.size())
#define pb(x) push_back(x)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define F first
#define S second
#define clr(x) x.clear()
#define LOG(x) std::cout << x << std::endl;

const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
const double PI = acos(-1);

int main()
{
    int p, q, r;
    cin >> p >> q >> r;
    cout << min((p + q), min((r + q),(p + r))) << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner scan = new Scanner(System.in);
        int a = scan.nextInt();
        int b = scan.nextInt();
        
        if (a * b % 2 == 0) {
            System.out.println("Even");
        } else {
            System.out.println("Odd");
        }
        
        scan.close();
    }
}


Measured memory_bytes: 21844
#include<bits/stdc++.h> 
#define REP(i, b) for(int i = 0; i < (b); i++)
#define REPS(i, b) for(int i = 1; i <= (b); i++)
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define ALL(v) (v).begin(), (v).end()
using namespace std;
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vb = vector<bool>;
const int INF = 1e9;
const int MOD = 1e9+7;

signed main()
{
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    ll N, M; cin >> N >> M; 
    ll ans = 1;
    for(ll i = 1; i * i <= M; i++)
    {
        if(M % i != 0) continue;
        if(i * N <= M) ans = max(ans, i);
        if((M/i) * N <= M) ans = max(ans, (M/i));
    }
    cout << ans << endl;

}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); ++i)
#define fi first
#define se second
#define INF 1000000009
#define LLINF 1000000000000000009LL
using ll = long long;

int main(){
  int r,g,b,n;
  cin>>r>>g>>b>>n;
  int ans=0;
  rep(i,n+1){
    rep(j,n+1){
      int m=n-r*i-g*j;
      if(m>=0&&m%b==0)ans++;
    }
  }
  cout<<ans<<endl;
  return(0);
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <map>
#include <vector>
#include <set>
#include <bitset>
#include <unordered_map>
#include <queue>

using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)



int main(){
    int a,b;
    cin >> a >> b;
    a--;
    int ans = 0;
    int now = 1;
    while( now < b) {
        now += a;
        ans++;
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1e16;
const ll mod = 1000000007;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
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;
}
int ctoi(char c) {
  if (c >= '0' && c <= '9') {
    return c - '0';
  }
  return 0;
}
ll factorial(ll n) {
  if (n == 1) {
    return 1;
  }
  ll ans = factorial(n-1);
  return ans*n;
}
ll gcd(ll a, ll b) {
  if (b == 0) return a;
  return gcd(b, a%b);
}
ll lcm(ll a, ll b) {
  return (a/gcd(a, b))*b;
}
bool prime(ll n) {
  if (n == 1) {
    return false;
  } else {
    for (ll i = 2; i <= (ll)pow(n, 0.5); i++) {
      if (n%i == 0) return false;
    }
  }
  return true;
}
ll RepeatSquaring(ll n, ll p, ll m) {
  if (p == 0) return 1;
  if (p%2 == 0) {
    ll t = RepeatSquaring(n, p/2, m);
    return (t*t)%m;
  }
  return (n*RepeatSquaring(n, p-1, m))%m;
}

int main() {
  string s;
  ll n;
  cin >> s >> n;
  ll tmp = 0;
  vector <char> v;
  vector <char> u;
  rep(i, n) {
    ll t, f;
    char c;
    cin >> t;
    if (t == 1) {
      tmp++;
    } else {
      cin >> f >> c;
      if (f == 1) {
        if (tmp%2==0) {
          v.push_back(c);
        } else {
          u.push_back(c);
        }
      } else {
        if (tmp%2==0) {
          u.push_back(c);
        } else {
          v.push_back(c);
        }
      }
    }
  }
  if (tmp%2==0) {
    rep(i, v.size()) {
      cout << v.at(v.size()-1-i);
    }
    cout << s;
    rep(i, u.size()) {
      cout << u.at(i);
    }
  } else {
    rep(i, u.size()) {
      cout << u.at(u.size()-1-i);
    }
    reverse(s.begin(), s.end());
    cout << s;
    rep(i, v.size()) {
      cout << v.at(i);
    }
  }
  cout << endl;
}

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

int main(){

int N,X,T;
  cin >> N >> X >> T;
int t;
  if(N%X==0){
   t=(N/X)*T;
  }
  else{
  t=(N/X)*T+T;
  }
  cout << t << endl;

}


Measured memory_bytes: 3632
#include <iostream>
#include <vector>
#include <algorithm>
#include <string.h>
#include <iomanip>
#include <map>
using namespace std;
int main()
{
    vector<int> a(3);
    cin >> a.at(0) >> a.at(1) >> a.at(2);
    sort(a.begin(), a.end());
    cout << a.at(2) * 10 + a.at(1) + a.at(0);

    return 0;
}

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

int main(void)
{
	char w[101];
	int count[128] = {0};
	
	scanf("%s", w);
	
	for (int i = 0; i < strlen(w); i++) {
		count[w[i]]++;
	}
	
	for (int i = 'a'; i <= 'z'; i++) {
		if (count[i] % 2 == 1) {
			printf("No\n");
			return 0;
		}
	}
	
	printf("Yes\n");
	return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
#define REP(i, m, n) for(ll i = (ll)m; i < (ll)n; i++)
#define PER(i, m, n) for(ll i = (ll)m; i > (ll)n; i--)
#define INF 1e9
#define ALL(v) v.begin(), v.end()
#define _GLIBCXX_DEBUG

template <uint MD> struct ModInt {
    using M = ModInt;
    const static M G;
    uint v;
    ModInt(ll _v = 0) { set_v(uint(_v % MD + MD)); }
    M& set_v(uint _v) {
        v = (_v < MD) ? _v : _v - MD;
        return *this;
    }
    explicit operator bool() const { return v != 0; }
    M operator-() const { return M() - *this; }
    M operator+(const M& r) const { return M().set_v(v + r.v); }
    M operator-(const M& r) const { return M().set_v(v + MD - r.v); }
    M operator*(const M& r) const { return M().set_v(uint(ull(v) * r.v % MD)); }
    M operator/(const M& r) const { return *this * r.inv(); }
    M& operator+=(const M& r) { return *this = *this + r; }
    M& operator-=(const M& r) { return *this = *this - r; }
    M& operator*=(const M& r) { return *this = *this * r; }
    M& operator/=(const M& r) { return *this = *this / r; }
    bool operator==(const M& r) const { return v == r.v; }
    M pow(ll n) const {
        M x = *this, r = 1;
        while (n) {
            if (n & 1) r *= x;
            x *= x;
            n >>= 1;
        }
        return r;
    }
    M inv() const { return pow(MD - 2); }
    friend ostream& operator<<(ostream& os, const M& r) { return os << r.v; }
};
using Mint = ModInt<1000000007>;

const double PI = 3.14159265358979323846;

bool compare_by_b(pair<int, int> a, pair<int, int> b) {
    if(a.second != b.second){
        return a.second < b.second;
    }else{
        return a.first < b.first;
    }
}

bool is_prime(long long N) {
    if (N == 1) return false;
    for (long long i = 2; i * i <= N; ++i) {
        if (N % i == 0) return false;
    }
    return true;
}

int main(){
    ll n, yen;
    cin >> n >> yen;
    ll x, y, z;
    ll solve = false;

    REP(i, 0, 2001){
        REP(j, 0, 2001){
            z = n-i-j;
            if(z < 0) continue;
            if(10000*i + 5000*j + 1000*z == yen){
                x = i;
                y = j;
                solve = true;
                break;
            }
        }
        if(solve) break;
    }

    if(solve) cout << x << " " << y << " " << z << endl;
    else cout << -1 << " " << -1 << " " << -1 << endl;
}


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

using namespace std;

/* g++ -g -fsanitize=address -lasan -std=c++11 -Dfoo_ */

/* freopen("input.txt", "rt", stdin); */
/* freopen("output.txt", "wt", stdout); */

#define ALL(c)          (c).begin(), (c).end()
#define ALLR(c)         (c).rbegin(), (c).rend()
#define FOR(i,a,b)      for (int i=(a); i < (b); ++i)
#define FORR(i,a,b)     for (int i=(a); i > (b); --i)
#define FOR_ALL(i,c)    for (__typeof((c).begin()) i=(c).begin();   \
                             i != (c).end(); ++i)
#define FOR_ALLR(i,c)   for (__typeof((c).rbegin()) i=(c).rbegin(); \
                             i != (c).rend(); ++i)
#define SZ(array)       (sizeof(array)/sizeof(array[0]))
#define lc(x)           (x<<1)     /* 2*x */
#define rc(x)           (x<<1 | 1) /* 2*x+1 */
#define lowbit(x)       (x & (-x)) /* 0b10100 -> 0b100 */

typedef long long       LL;
typedef map<int,int>    MII;
typedef pair<int,int>   PII;
typedef set<int>        SI;
typedef vector<bool>    VB;
typedef vector<double>  VD;
typedef vector<int>     VI;
typedef vector<string>  VS;

/* check if a key is in container C */
template <class C>
inline bool in_(const typename C::key_type& k, const C& A)
{ return A.find(k) != A.end(); }
inline bool in_(const string& s, const string& S)
{ return S.find(s) != string::npos; }

const int inf = 1e9;
const int mod = 1e9+7;
const int maxn = 1e5+5;

int solve(vector<PII> A)
{
    /*
     * 
     */
    // sort(ALL(A));
    map<PII,int> cnt; const int n = A.size();
    FOR(i,0,n) FOR(j,0,n) if (i != j) {
        const int a = A[i].first  - A[j].first;
        const int b = A[i].second - A[j].second;
        if (a || b)
            cnt[PII(a,b)]++;
    }
    int ans = n;
    FOR_ALL(x,cnt)
        ans = min(ans, n - x->second);
    return ans;
}

int main()
{
#ifdef foo_
    freopen("foo", "rt", stdin);
#endif
    ios::sync_with_stdio(false);
    int n;
    while (cin >> n) {
        vector<PII> A(n),B(n);
        FOR(i,0,n) {
            int x,y; cin >> x >> y;
            A[i] = PII(x,y);
            B[i] = PII(y,x);
        }
        const int a = solve(A);
        const int b = solve(B);
        cout << min(a,b) << endl;
    }
    return 0;
}


Measured memory_bytes: 384
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.InputMismatchException;
import java.util.StringTokenizer;

class Main {
	
	static class RootedTrees {
		public void rootedtrees (InputReader ir) {
			
			int n = ir.nextInt();
			Node[] node = new Node[n];
			
			for (int i = 0; i < n; i++) {
				int id = ir.nextInt();
				int k = ir.nextInt();
				node[id] = new Node (k);
				
				if ( k != 0) {
					for (int j = 0; j < k; j++) {
						node[id].type[j] = ir.nextInt();
					}
				}
			}
			
			Parent(node);
			Depth(node);
			Depth(node);
			
			StringBuilder sb = new StringBuilder();
			
			for (int i = 0; i < n; i++) {
				
				int k = node[i].type.length;
				
				sb.append("node ").append(Integer.toString(i))
				.append(": parent = ").append(node[i].parent)
				.append(", depth = ").append(node[i].depth);
				
				if (node[i].parent == -1) {
					sb.append(", root, [");
				} else if (k == 0){
					sb.append(", leaf, [");
				} else {
					sb.append(", internal node, [");
				}
				
				if (k != 0) {
					for (int j = 0; j < k; j++) {
						sb.append(node[i].type[j]);
						if (j != k - 1) {
							sb.append(", ");
						}
					}
				}
				sb.append("]\n");
				
			}
			
			System.out.print(sb);
			
			
		}
		
		static void Parent (Node[] node) {
			
			int n = node.length;
			
			for (int i = 0; i < n; i++) {
				int lentype = node[i].type.length;
				for (int j = 0; j < lentype; j++) {
					node[node[i].type[j]].parent = i;
				}
			}
			
		}
		
		static void Depth (Node[] node) {
			int n = node.length;
			
			for (int i = 0; i < n; i++) {
				int lentype = node[i].type.length;
				for (int j = 0; j < lentype; j++) {
					node[node[i].type[j]].depth = node[i].depth + 1;
				}
			}
		}
		
		
		
	}
	
	static class Node {
		int parent;
		int depth;
		int[] type;
		public Node(int n) {
			parent = -1;
			depth = 0;
			type = new int[n];
		}
		
	}
	
	static class InputReader {
		BufferedReader br;
		StringTokenizer st;
		
		public String nextString() {
			
			 while (!st.hasMoreTokens()) {
	                try {
	                    st = new StringTokenizer(br.readLine(), " ");
	                } catch (IOException e) {
	                    throw new InputMismatchException();
	                }
	            }
			return st.nextToken();
		}
		
		public int nextInt() {
			return Integer.parseInt(nextString());
		}
					
		public InputReader (InputStream inputStream) {
			br = new BufferedReader (new InputStreamReader (inputStream));
			st = new StringTokenizer ("");
		}
		
	}
	
	public static void main (String[] args) {
		InputStream inputStream = System.in;
		InputReader in = new InputReader (inputStream);
		RootedTrees obj = new RootedTrees();
		obj.rootedtrees(in);
	}
	
}


Measured memory_bytes: 93152
#include<bits/stdc++.h>
using namespace std;
#define int long long
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);cout.tie(0);
  int no_of_input;
  string input;
  vector<pair<int,int> > vect1;
  vector<pair<int,int> > vect2;
  int curr = 0;
  int neg = 0;
  cin >> no_of_input;
  for(int i=0;i<no_of_input;i++){
    cin >> input;
    int currmini = INT_MAX,currsum = 0;
    for(int j=0;j<input.length();j++){
      if(input.at(j)=='('){
        currsum++;
      }
      else{
        currsum--;
      }
      currmini = min(currmini,currsum);
    }
    if(currmini>=0){
      curr += currsum;
    }
    else if(currmini==currsum){
      neg += currsum;
    }
    else{
      vect2.push_back({(currsum),currmini});
    }
  }
  sort(vect2.begin(),vect2.end());
  reverse(vect2.begin(),vect2.end());
  for(int i=0;i<vect2.size();i++){
    if(abs(vect2[i].second)>curr){
      cout << "No";
      return 0;
    }
    curr += vect2[i].first;
  }
  curr += neg;
  if(curr==0){
    cout << "Yes";
  }
  else{
    cout << "No";
  }
  
}

Measured memory_bytes: 7412