akhauriyash/Code-Regression huggingface dataset:
#include <functional>
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;

const ll INF = 10000000000000;

template<typename Monoid>
struct SegmentTree {
    using F = function<Monoid(Monoid, Monoid)>;

    int sz;
    vector<Monoid> seg;

    const F f;
    const Monoid M1;

    SegmentTree(int n, const F f, const Monoid &M1) : f(f), M1(M1) {
        sz = 1;
        while(sz < n) sz <<= 1;
        seg.assign(2 * sz, M1);
    }

    void set(int k, const Monoid &x) {
        seg[k + sz] = x;
    }

    void build() {
        for(int k = sz - 1; k > 0; k--) {
            seg[k] = f(seg[2 * k + 0], seg[2 * k + 1]);
        }
    }

    void update(int k, const Monoid &x) {
        k += sz;
        seg[k] = x;
        while(k >>= 1) {
            seg[k] = f(seg[2 * k + 0], seg[2 * k + 1]);
        }
    }

    Monoid query(int a, int b) {
        Monoid L = M1, R = M1;
        for(a += sz, b += sz; a < b; a >>= 1, b >>= 1) {
            if(a & 1) L = f(L, seg[a++]);
            if(b & 1) R = f(seg[--b], R);
        }
        return f(L, R);
    }

    Monoid operator[](const int &k) const {
        return seg[k + sz];
    }
};

int main()
{
    int n;
    cin >> n;
    ll e, t;
    cin >> e >> t;
    e *= 2;
    t *= 2;
    ll x[100005];
    x[0] = 0;
    for(int i = 1; i <= n; i++){
        cin >> x[i];
        x[i] *= 2;
    }
    x[n + 1] = e;
    SegmentTree<P> seg(n + 2, [](P a, P b){return min(a, b);}, P(INF, INF));
    ll dp[100005];
    for(int i = 0; i <= n; i++) dp[i] = INF;
    for(int i = 0; i <= n; i++){
        if(i == 0) dp[0] = 0;
        int l = upper_bound(x, x + n + 2, x[i] - t / 2) - x;
        if(l - 1 > 0){
            int j = seg.query(0, l - 1).second;
            dp[i] = min(dp[i], dp[j] + (x[i] - x[j]) * 3 - (x[j + 1] - x[j]) * 2);
        }
        seg.update(i, P(dp[i] + (e - x[i]) * 3 - (x[i + 1] - x[i]) * 2, i));
        int r = upper_bound(x, x + n + 1, x[i + 1] + t / 2) - x - 1;
        dp[r] = min(dp[r], dp[i] + t + (x[r] - x[i]));
    }
    cout << (dp[n] + (e - x[n])) / 2 << endl;
}


Measured memory_bytes: 6016
#include<bits/stdc++.h>
    using namespace std;
    int main()
    {
      long long n,i,s=0;
      cin>>n;
      long long a[n+1],b[n];
      for(i=0;i<=n;i++)
      {
      cin>>a[i];
      }
      for(i=0;i<n;i++)
      {
      	cin>>b[i];
      }
      for(i=0;i<n;i++)
      {
      	if(a[i]+a[i+1]>=b[i])
      	{
      		s+=b[i];
      		if(b[i]>=a[i])
      		{
      			a[i+1]-=b[i]-a[i];
      		}
      	}
      	else
      	{
      	s+=a[i]+a[i+1];
      	a[i+1]=0;
      	}
      }
      cout<<s<<endl;
    }
      
     
    

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

int main(){
  long long N, M;
  cin >> N >> M;
  vector<long long> H(N);
  for(int i=0; i<N; i++)cin >> H[i];
  map<long long, vector<long long>>way;
  for(int i=0; i<N; i++){
    way.emplace(i+1,0);
  }
  for(int i=0; i<M; i++){
    long long A, B;
    cin >> A >> B;
    if(way.count(A)){
      way.at(A).push_back(B);
    }
    else{way.emplace(A, B);}
    if(way.count(B)){
      way.at(B).push_back(A);
    }
    else{
      way.emplace(B, A);
    }
  }
  long long ans = 0;
  for(auto e: way){
    int key = e.first;
    long long heiht = H[key-1];
    bool good = true;
    e.second.erase(std::unique(e.second.begin(), e.second.end()), e.second.end());
    for(int i=0; i<e.second.size(); i++){
      if(H[e.second[i]-1] >= heiht)good = false;
    }
    if(good){
      ans+=1;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 15404
#include<stdio.h>
int main(void)
{
    int e,y;
	scanf("%d %d",&e,&y);
	if(e==0){
	    if(y<1912){
		    printf("M%d\n",y-1867);
		}
		else if(y<1926){
		    printf("T%d\n",y-1911);
		}
		else if(y<1989){
		    printf("S%d\n",y-1925);
		}
		else if(y<2017){
		    printf("H%d\n",y-1988);
		}
	}
	else if(e==1){
	    printf("%d\n",1867+y);
	}
	else if(e==2){
	    printf("%d\n",1911+y);
	}
	else if(e==3){
	    printf("%d\n",1925+y);
	}
	else if(e==4){
	    printf("%d\n",1988+y);
	}
	return 0;
}

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


int main(){
    int A,B;
    cin >> A >> B;
    vector<int>vec(1500,5000);
    for(int i=1; i<=1300; i++){
        if(A<=i*0.08 && i*0.08<A+1 && B<=i*0.1 && i*0.1<B+1){
            vec[i]=i;
        }
    }
    sort(vec.begin(), vec.end());
    if(vec[0]==5000){
        cout << -1 << endl;
    }
    else{
        cout << vec[0] << endl;
    }

}

Measured memory_bytes: 256
/*
*Bismillahir Rahmanir Rahmin
* @Author: {{Syed Yasir Shahriar
{
/*//*\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\*/
 
//أعوذ بالله من الشيطان الرجيم
//بسم الله الرحمن الرحيم
 
/*//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\*/
 
/*};/* @Date:   {{create_time}}typedef int MyCustomType;
* @Last Modified by:   mrinm
* @Last Modified time: 2020-07-04 17:05:55
*/
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define ff first
#define ss second
#define pll pair<ll,ll>
#define v vector<ll>
#define st stack<ll>
#define pq  priority_queue <int>
#define q queue<ll>
#define mod 1000000005
using namespace std;
 
/* int solve(int arr[],int n){

 	   int res=0;
 	   for (int i =0; i<= n - 1; i++) { 
        int val = 0; 
        for (int j =i; j<= n - 1; j++) { 
            val = val + arr[j]; 
            if (val % 2 != 0) 
                res++; 
        } 
    } 
 	   return (res);
 }*/
 
int main(){
 /*    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif*/
     //ios::sync_with_stdio(0);
	  int n;
	  cin>>n;
	  if(n>999){
	  	 cout<<"ABD"<<endl;
	  	 return 0;
	  }

	  cout<<"ABC"<<endl;
	 
     return 0;
}

Measured memory_bytes: 3620
#include<bits/stdc++.h>
#define pf printf
#define sc(x) scanf("%d",&x);
#define scs(x) scanf("%s",x);
#define scl(x) scanf("%lld",&x);
#define rep(i,s,e) for(int i=s; i<=e; ++i)
#define dep(i,s,e) for(int i=s; i>=e; --i)
typedef long long ll;
using namespace std;
const ll mod=998244353;
int a[200005];
int main()
{
	int k,n,maxx=0;
	sc(k);sc(n);
	rep(i,1,n)sc(a[i]);
	rep(i,1,n-1)maxx=max(maxx,a[i+1]-a[i]);
	maxx=max(maxx,a[1]+k-a[n]);
	pf("%d\n",k-maxx);
}


Measured memory_bytes: 1024
# 参考にしたもの
# 1.解説 累積XORのケツが0な場合はこっちのやり方に則った
# 2.シナモンロールさんのブログ(https://cinnamo-coder.hatenablog.com/entry/2019/05/12/172458)


def main():
    import sys
    input = sys.stdin.readline

    mod = 10**9+7
    N = int(input())
    A = [int(i) for i in input().split()]

    # 累積XOR
    cum_xor = [0]
    for a in A:
        cum_xor.append(cum_xor[-1] ^ a)

    if cum_xor[-1] != 0:
        dp = [[0]*2 for i in range(N+1)]
        # dp[i][0]:i番目まで見て、選んだやつらの最後が0の数
        # dp[i][1]:i番目まで見て、選んだやつらの最後がXの数
        # 累積XORの最後がX(!=0)なら 0X0X0X0Xになるように選ぶ( X XOR X = 0 だしね♡)
        X = cum_xor[-1]
        dp[0][0] = 1
        for i in range(1, N + 1):  # 最後の要素はどうせXなので回さなくても良い
            dp[i][0] = dp[i - 1][0] % mod
            dp[i][1] = dp[i - 1][1] % mod
            if cum_xor[i] == 0:
                dp[i][0] += dp[i - 1][1]
            elif cum_xor[i] == X:
                dp[i][1] += dp[i-1][0]
        # N-1番目までで、最後が0になってる選び方をして、それに最後の奴を加えるだけなのでdp[N-1][0]
        print(dp[N-1][0] % mod)
    else:
        # dp[X][j]:美しさをXとしたとき、最後に選んだのが(0 / X)
        dp = [[1, 0] for i in range((1 << 20) + 1)]

        # cnt______[X]:美しさがXの選び方で、今まで出てきた0の数
        cnt_zero_prev_cumXOR_i = [0] * ((1 << 20)+1)
        cnt_zero_now = 0

        for i in range(1, N + 1):
            if cum_xor[i] == 0:
                cnt_zero_now += 1
            else:
                # まず更新してなかった0の部分をまとめて更新
                dp[cum_xor[i]][0] += dp[cum_xor[i]][1] * \
                    (cnt_zero_now - cnt_zero_prev_cumXOR_i[cum_xor[i]])
                dp[cum_xor[i]][0] %= mod
                # そしたらいまの数(cum_xor[i])を取った場合の数を加えて更新
                dp[cum_xor[i]][1] += dp[cum_xor[i]][0]
                dp[cum_xor[i]][1] %= mod
                # 0の数の更新
                cnt_zero_prev_cumXOR_i[cum_xor[i]] = cnt_zero_now
        ans = 0
        for c in set(cum_xor):
            ans += dp[c][1]
            ans %= mod
        ans += 2 ** (cnt_zero_now - 1)
        print(ans % mod)


if __name__ == '__main__':
    main()


Measured memory_bytes: 163332
#include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;

int main (void) {
	int arr[100001];
	int size, 
		rem, coun, res;

	cin >> size;
	for (int it = 0; it < size; ++it) cin >> arr[it];

	sort(arr, arr + size);

	rem = arr[0];
	coun = 1;
	res = 0;
	for (int it = 1; it < size; ++it) {
		if (arr[it] != rem) {
			if (coun - rem >= 0) res += coun - rem;
			else res += coun;
			rem = arr[it];
			coun = 1;
		} else ++coun;
	}
	if (coun - rem >= 0) res += coun - arr[size - 1];
	else res += coun;

	cout << res << endl;

	return 0;
}


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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep2(i,a,b) for(int i=a;i<b;i++)
#define each(it,v) for(auto it : v)
#define mod 1000000007
#define All(v) (v).begin(),(v).end()
#define ll long long
#define vi vector<int>
#define vll vector<ll>
#define vpii vector<pair<int,int>>
#define vv vector<vector<int>>
template<class T> T gcd(T a,T b) {return b?gcd(b,a%b):a;}
template<class T> T lcm(T a,T b) {return a/gcd(a,b)*b; }
template<class T> bool isPrime(T num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false;

    double sqrtNum = sqrt(num);
    for (T i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            return false;
        }
    }
    return true;
}

using namespace std;

int h,n,a,b;

main()
{
        cin>>h>>n;
        vpii v;
        int t=0;
        rep(i,n)
        {
                cin>>a>>b;
                v.push_back(make_pair(a,b));
                t=max(t,a);
        }

        int dp[h+t];
        each(&it,dp)it=1e9;
        dp[0]=0;

        rep(i,h+t)
        {
                rep(j,n)
                {
                        if(i+v[j].first<=h+t)dp[i+v[j].first]=min(dp[i+v[j].first],dp[i]+v[j].second);
                }
        }

        //each(it,dp)cout<<it<<endl;

        int ans=INT_MAX;
        rep2(i,h,h+t)ans=min(ans,dp[i]);
        cout<<ans<<endl;

}


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

int main(){
    int N;
    cin >> N;
    string s;
    cin >> s;
    int a=0,b=0;
    for(int i=0;i<s.length();i++){
        if(s[i]=='('){
            a++;
        }
        else{
            if(a>0) a--;
            else b++;
        }
    }
    if(b>0){
        for(int i=0;i<abs(b);i++){
            cout << "(";
        }
    }
    cout << s;
    if(a>0){
        for(int i=0;i<abs(a);i++){
            cout << ")";
        }
    }
    cout << "\n";
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstdio>
#include <algorithm>
using namespace std;
int main(){
    string s;
    cin >> s;
    if (s.length()<=2){
        cout << s;
    }else {
        reverse(s.begin(), s.end());
        cout << s << endl;
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
//関数
const long INF=1000000000000000;

int main(void){
    long N;
    cin>>N;
    vector<long> A(N);
    for(int i=0;i<N;i++) cin>>A.at(i);
    
    vector<long> dx(N,0);
    
    for(int i=0;i<N;i++){
        if(i%2==0) dx.at(0)+=A.at(i);
        else dx.at(0)-=A.at(i);
    }
    
    for(int i=0;i<N-1;i++){
        dx.at(i+1)=(A.at(i)-dx.at(i)/2)*2;
    }
    
    for(int i=0;i<N-1;i++) cout<<dx.at(i)<<" ";
    cout<<dx.at(N-1)<<endl;
}


Measured memory_bytes: 2944
#include <bits/stdc++.h>  // g++ -std=c++14 -o a a.cpp

using namespace std;

typedef pair<int, int> P;
typedef long long ll;

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repto(i, n) for(int i = 0; i <= (n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end())
#define _1 first
#define _2 second
#define pb push_back
#define INF 1145141919
#define MOD 1000000007
#define DEBUG(x) cout << #x << ": " << x << endl;

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

__attribute__((constructor)) void initial() {
    cin.tie(0);
    ios::sync_with_stdio(false);
}

int main() {
    vector<int> p;
    int N;
    cin >> N;
    rep(i, N) {
        int pi;
        cin >> pi;
        p.pb(pi);
    }
    int result = 0;
    for (int i = 1; i < (N - 1); i++) {
        int ord = 0;
        // cout << "------------" << endl;
        // DEBUG(i);
        // DEBUG(p[i-1]);
        // DEBUG(p[i]);
        // DEBUG(p[i+1]);
        if (p[i-1] > p[i]) ord++;
        if (p[i+1] > p[i]) ord++;
        if (ord == 1) result++;
        // DEBUG(result);
    }
    cout << result << endl;
}

Measured memory_bytes: 256
n,q=map(int,input().split())
s=input()
v=[list(map(int,input().split())) for i in range(q)]
r=[0]*n
count=0
a=0
for i in range(n-1):
    r[i]=a
    if s[i]=='A':
        if s[i+1]=='C':
            a+=1
        else:
            pass
r[n-1]=a
for i in range(q):
    print(r[v[i][1]-1]-r[v[i][0]-1])

Measured memory_bytes: 30688
#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=(a),i##_end=(b);i<=i##_end;++i)
#define For(i,a,b) for(int i=(a),i##_end=(b);i<i##_end;++i)
#define per(i,a,b) for(int i=(b),i##_st=(a);i>=i##_st;--i)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define dbg(x) cerr<<#x" = "<<x<<endl
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define Es(x,i) for(Edge *i=G[x];i;i=i->nxt)
typedef long long ll;
typedef pair<int,int> pii;
const int inf=~0u>>1,MOD=1e9+7;
inline int rd() {
    int x,c,f=1;while(!isdigit(c=getchar()))f=c!='-';x=c-'0';
    while(isdigit(c=getchar()))x=x*10+c-'0';return f?x:-x;
}
const int N=1e5+11;
struct Edge{int v;Edge*nxt;}pl[N<<1],*cur=pl,*G[N];
inline void ins(int u,int v){*cur=(Edge){v,G[u]},G[u]=cur++;}
int n,a[N],b[N];
int vis[N],sc;

int dfs(int x){
	vis[x]=++sc;
	Es(x,i)if(!vis[i->v]){
		dfs(i->v);
	}
	int&u=a[x],&v=b[x];
	Es(x,i)if(vis[i->v]>vis[x]&&a[i->v]!=inf){
		int p=a[i->v],q=b[i->v]+1;
		if(u==inf){
			u=p,v=q;
		}else{
			int l=max(u-v,p-q),r=min(p+q,u+v);
			if(((u+v&1)^(p+q&1))||l>r){
				puts("No");
				exit(0);
			}
			else{
				u=l+r>>1,v=r-l>>1;
			}
		}
	}
}
int A[N];
void Pr(int x,int f=0){
	int&u=a[x],&v=b[x];
	if(u==inf){A[x]=A[f]+1;goto e;}
	else if(f){
		int p=A[f],q=1;
		int l=max(u-v,p-q),r=min(p+q,u+v);
		u=l+r>>1,v=r-l>>1;
	}
	A[x]=u+v;e:
	Es(x,i)if(i->v!=f)Pr(i->v,x);
}
int main(){
#ifdef flukehn
	freopen("test.txt","r",stdin);
#endif
	n=rd();
	For(i,1,n){
		int u=rd(),v=rd();
		ins(u,v),ins(v,u);
	}
	rep(i,1,n)a[i]=inf;
	int K=rd();
	rep(i,1,K){
		int v=rd(),p=rd();
		a[v]=p;
	}
	dfs(1);
	Pr(1);
	puts("Yes");
	rep(i,1,n)printf("%d\n",A[i]); 
}

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

int int_len(int n) {
  int s=0;
  while(n!=0) s++, n/=10;
  return s;
}

int int_sum(int n) {
  int m=0,s=0,a=n;
  while(a!=0) s++, a/=10;
  for(int i=s-1;i>=0;i--) m+=n/((int)pow(10,i))-(n/((int)pow(10,i+1)))*10;
  return m;
}






int ggcd(int a,int b)
{
 
  int r, tmp;
 
  
 
  /* 自然数 a > b を確認・入替 */
  if(a<b){
    tmp = a;
    a = b;
    b = tmp;
  }
 
  /* ユークリッドの互除法 */
  r = a % b;
  while(r!=0){
    a = b;
    b = r;
    r = a % b;
  }
 
 
 
  return b;
}







int fac(int n){
  int m=1;
  while(n>=1) m*=n,n--;
  return m;
}

int vec_sum(vector<int> v){
  int n=0;
  for(int i=0;i<v.size();i++) n+=v[i];
  return n;
}
///////////////////////////
int main() {
  ll n,a,b;
  cin>>n>>a>>b;
  if(n==1 && a==b){
    cout<<1<<endl;
    return 0;
  }else if(n==1 && a!=b){
    cout<<0<<endl;
    return 0;
  }
  if(a<=b){
    cout<<(n-1)*b+a-(n-1)*a-b+1<<endl;
  }else{
    cout<<0<<endl;
  }
}
///////////////////////////





Measured memory_bytes: 256
n,k = map(int,input().split())
l = list(map(int,input().split()))
l = sorted(l)
dif = []
for i in range(k):
    if(i==k-1):
        dif.append(abs(l[i]-(n+l[0])))
    else:
        dif.append(abs(l[i]-l[i+1]))
        
print(sum(dif) - max(dif))



Measured memory_bytes: 25840
import java.util.Scanner;

public class Main {
	public static void insertionSort(int[] array, int n) {
		int v, j;
		for (int i = 0; i < n; i++) {
			v = array[i];
			j = i - 1;
			while (j >= 0 && array[j] > v) {
				array[j + 1] = array[j];
				j--;
			}
			array[j + 1] = v;
			for (int k = 0; k < n; k++) {
				System.out.print(array[k]);
				if (k < n - 1) {
					System.out.print(" ");
				}
			}
			System.out.println();
		}
	}
	
	void run() {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] array = new int[n];
		for (int i = 0; i < n; i++) {
			array[i] = sc.nextInt();
		}
		insertionSort(array, n);
	}

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


Measured memory_bytes: 34740
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <vector>
using namespace std;

bool used[20];
vector<int> order;
vector<vector<int> > es;

int dfs(int v) {
	used[v] = true;
	for(int i = 0; i < (int)es[v].size(); ++i)
		if(!used[es[v][i]])
			dfs(es[v][i]);

	order.push_back(v);
}

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

	int n, m;
	cin >> n >> m;

	es.resize(n + 1);
	for(int i = 0; i < m; ++i) {
		int x, y;
		cin >> x >> y;
		es[x].push_back(y);
	}

	memset(used, false, sizeof(used));
	for(int i = 1; i <= n; ++i)
		if(!used[i])
			dfs(i);

	for(int i = n - 1; i >= 0; --i)
		cout << order[i] << endl;

	return EXIT_SUCCESS;
}

Measured memory_bytes: 1228
#include<bits/stdc++.h>
#define rep(i,a,n) for (int i = a;i < n;i++)
using namespace std;

int main() {
    int N;cin >> N;
    vector<int> A(N);
    rep(i, 0, N) {
        cin >> A[i];
    }
    sort(A.rbegin(), A.rend());
    long long x = 0, y = 0;
    rep(i, 1, N) {
        if (A[i - 1] == A[i]) {
            if (x == 0) {
                x = A[i];
                ++i;
            } else {
                y = A[i];
                break;
            }
        }
    }
    cout << x * y << endl;
}

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;i >= 0;i--)  
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;

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

int main(){

  int n;
  cin>>n;
  int k = 0;
  int x = n;

  while(x>0){
    k += x%10;
    x /= 10;
  }

  if(n%k==0){
    cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  }

  return 0;
}

Measured memory_bytes: 256
fn main() {
    let mut input = String::new();
    std::io::stdin().read_line(&mut input).expect("Input error");
    let mut change = input.trim().parse::<u64>().expect("Parse error");
    let mut total_coin = 0;
    if change >= 25 {
        total_coin += change / 25;
        change = change % 25;
    }
    if change >= 10 {
        total_coin += change / 10;
        change = change % 10;
    }
    if change >= 5 {
        total_coin += change / 5;
        change = change % 5;
    }
    total_coin += change;
    println!("{}", total_coin);
}



Measured memory_bytes: 5036
#include <iostream>
#include <cstdio>
#include <vector>
#define _USE_MATH_DEFINES
#include <math.h>
#include <cstring>
#include <numeric>
#include <algorithm>
#include <stdlib.h>
#include <functional>
#include <string>
#include <iomanip>
#include <array>
#include <map>
#include <queue>
#include <limits.h>
#include <set>
#include <stack>
#include <random>
#include <complex>
#include <unordered_map>
#include <nmmintrin.h>
#include <chrono>
#define rep(i,s,n) for(int i = (s); (n) > i; i++)
#define REP(i,n) rep(i,0,n)
#define RANGE(x,a,b) ((a) <= (x) && (x) <= (b))
#define DUPLE(a,b,c,d) (RANGE(a,c,d) || RANGE(b,c,d) || RANGE(c,a,b) || RANGE(d,a,b))
#define INCLU(a,b,c,d) (RANGE(a,c,d) && (b,c,d))
#define PW(x) ((x)*(x))
#define ALL(x) (x).begin(), (x).end()
#define MODU 1000000007
#define bitcheck(a,b)   ((a >> b) & 1)
#define bitset(a,b)      ( a |= (1 << b))
#define bitunset(a,b)    (a &= ~(1 << b))
#define MP(a,b) make_pair((a),(b))
#define Manh(a,b) (abs((a).first-(b).first) + abs((a).second - ((b).second))
#define pritnf printf
#define scnaf scanf
#define itn int
#ifdef _MSC_VER
#define __builtin_popcount _mm_popcnt_u32
#define __builtin_popcountll _mm_popcnt_u64
#endif
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a%b);
}
template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T &val) {
	std::fill((T*)array, (T*)(array + N), val);
}

struct Edge {
	int from, to, weight;
};
typedef vector<vector<Edge>> Graph;


int main(void) {
	int a, b, c, d, e, f;
	cin >> a >> b >> c >> d >> e >> f;
	pii Max = {};
	REP(i, 31) {
		REP(j, 31) {
			int water = (i*a + j*b) * 100;
			if (water > f) continue;
			REP(k, 3001) {
				int sugar = k * c;
				if (sugar > (water / 100 * e) || sugar + water > f) continue;

				int dc = min(((water/100 * e) - sugar) / d, (f-sugar-water) / d);

				sugar += dc * d;
				if (dc < 0 || sugar > (water / 100 * e) || sugar + water > f) continue;

				if(Max.second * (water + sugar)<= sugar * Max.first)
					Max = {water + sugar,sugar};

			}

		}
	}
	cout << Max.first << " "<<Max.second;

	return 0;
}

Measured memory_bytes: 888
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <unordered_map>
void _cin(){} template <class Head, class... Tail> void _cin(Head&& head, Tail&&... tail){ std::cin >> head; _cin(std::forward<Tail>(tail)...); }
void _cout(){ std::cout << "\n"; } template <class Head, class... Tail> void _cout(Head&& head, Tail&&... tail){ std::cout << head; _cout(std::forward<Tail>(tail)...); }
#define For(i, n) for(int i = 0; i < (n); i ++)
#define Range(c) c.begin(), c.end()
#define RevRange(c) c.rbegin(), c.rend()
#define Contains(c, x) (find(Range(c), x) != c.end())
#define Sort(a) sort(Range(a))
#define DeSort(a) sort(RevRange(a))
#define Vec2(T, n, m, xs) vector<vector<T>> xs(n, vector<T>(m))
#define Sum(a) accumulate(Range(a), 0)
#define Cusum(T, n, xs, sxs) vector<T> sxs(n+1); For(i, n) sxs[i+1] = sxs[i] + xs[i]
#define Cin(T, ...) T __VA_ARGS__; _cin(__VA_ARGS__)
#define Cins(T, n, xs) vector<T> xs(n); For(i, n) cin >> xs[i]
#define Cins2(T, n, xs, ys) vector<T> xs(n), ys(n); For(i, n) cin >> xs[i] >> ys[i]
#define Cins3(T, n, xs, ys, zs) vector<T> xs(n), ys(n), zs(n); For(i, n) cin >> xs[i] >> ys[i] >> zs[i]
#define Cinss(T, n, m, xs) Vec2(T, n, m, xs); For(i, n) For(j, m) cin >> xs[i][j]
#define Cinm(T, n, map) unordered_map<T, int> map; For(i, n){ Cin(T, x); map[x] ++; }
#define Cout(...) _cout(__VA_ARGS__);
#define Couts(xs) for(const auto &e : xs) cout << e << " "; cout << "\n"
#define Couty(cond) Cout((cond) ? "Yes" : "No")
#define CoutY(cond) Cout((cond) ? "YES" : "NO")

using namespace std;
using ll = long long;

int main(void){
    Cin(int, n);
    Cins(int, n, x);
    for(int ans = 1, t = 1; ans < n+10; ans ++){
        t = x[t-1];
        if(t == 2){ Cout(ans); return 0; }
    }
    Cout(-1);
}


Measured memory_bytes: 640
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <set>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cstring>
#include <iterator>
#include <bitset>
#include <unordered_set>
#include <unordered_map>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <utility>
#include <memory>
#include <functional>
#include <deque>
#include <cctype>
#include <ctime>
#include <numeric>
#include <list>
#include <iomanip>

#if __cplusplus >= 201103L
#include <array>
#include <tuple>
#include <initializer_list>
#include <forward_list>

#define cauto const auto&
#else

#endif

using namespace std;


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

typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll;
typedef vector<vector<long long> > vvll;

#define VV(T) vector<vector< T > >

template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
    v.assign(a, vector<T>(b, t));
}

template <class F, class T>
void convert(const F &f, T &t){
    stringstream ss;
    ss << f;
    ss >> t;
}

#define GET_MACRO(_1, _2, _3, NAME, ...) NAME
#define _rep(i,n) _rep2((i),0,(n))
#define _rep2(i,a,b) for(int i=(a);i<(b);++i)
#define rep(...) GET_MACRO(__VA_ARGS__, _rep2, _rep)(__VA_ARGS__)
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define fi first
#define se second
#define mkp make_pair
#define DEBUG
#ifdef DEBUG
#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#else
#define dump(x) 
#define debug(x) 
#endif

#define MOD 1000000007LL
#define EPS 1e-8
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL
#define maxs(x,y) x=max(x,y)
#define mins(x,y) x=min(x,y)

void mainmain(){
	int n;
	cin>>n;
	vll v(n);
	ll sum = 0;
	rep(i,n){
		cin>>v[i];
		sum += v[i];
	}
	ll ans = INFL;
	ll tmp = 0;
	rep(i,n-1){
		tmp += v[i];
		mins(ans, abs(tmp-sum+tmp));
	}
	cout<<ans<<endl;
}


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

Measured memory_bytes: 1792
#include <bits/stdc++.h>
//#define int long long
using namespace std;
const int MOD=1e9+7;
vector<int> adj[200000];
vector<int> vis(200000,0);
int co =0;
void dfs(int node){
    vis[node]=1;
    co++;
    for(int cld:adj[node]){
        if(!vis[cld])dfs(cld);
    }
}
int32_t main() {
    int n,m;
    cin>>n>>m;
    map<pair<int,int>,int> f;
    for(int i=0;i<m;i++){
        int u,v;
        cin>>u>>v,u--,v--;
        if(f[{u,v}])continue;
        adj[u].push_back(v);
        adj[v].push_back(u);
        f[{u,v}]=f[{v,u}]=1;
    }
    int c=0, count=-1;
    for(int i=0;i<n;i++){
        if(!vis[i]){dfs(i);
        c++;count=max(co,count); co=0;}
    }
    cout<<count<<"\n";
    return 0;
}

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

int main() {
    int N, K;
    cin >> N >> K;
    vector<int> p(N);
    for (int i = 0; i < N; i++) {
        cin >> p.at(i);
    }
    sort(p.begin(), p.end());
    int sum = 0;
    for (int i = 0; i < K; i++) {
        sum += p.at(i);
    }
    cout << sum << endl;
}

Measured memory_bytes: 3552
#include <iostream>
#include <vector>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>

#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;



int main() {
    long long int A,B,N;
    scanf("%lld %lld %lld", &A,&B,&N);
    if(N >= B-1){
        printf("%lld",A*(B-1)/B);
    }
    else{
        printf("%lld",A*N/B);
    }

}
int C(){
    int N,M,Q;
    scanf("%d %d %d", &N,&M,&Q);
    int Qa[N];
    int Qb[N];
    int Qc[N];
    int Qd[N];
    for(int i = 0; i < N; ++i) {
        scanf("%d %d %d %d",&Qa[i],&Qb[i],&Qc[i],&Qd[i]);
    }

}

Measured memory_bytes: 3816
#include <iostream>
using namespace std;
int main(){
	int a,b,c; 
	cin >> a >> b>> c;
	if ( a == b && b != c || a==c && b!=a || b==c && a!=b){
		cout << "Yes";
	}else{
		cout << "No";
	}
	return 0;	
}

Measured memory_bytes: 256
#include<cstdio>
#include<cmath>
#include<cstring>
#include<iostream>
#include<algorithm>

using namespace std;
const int MAX = 1e9;
const int MaxN = 1e5 + 5;

int n;
int h[MaxN], dp[MaxN];

int main()
{
	while (~scanf ("%d", &n)){
		for (int i = 1; i <= n; i++) dp[i] = MAX;
		for (int i = 1; i <= n; i++) scanf ("%d", &h[i]);
		dp[1] = 0;
		dp[2] = fabs (h[2] - h[1]);
		for (int i = 3; i <= n; i++){
			int h1 = fabs (h[i] - h[i - 1]);
			int h2 = fabs (h[i] - h[i - 2]);
			dp[i] = min (dp[i - 1] + h1, dp[i - 2] + h2);
		}
		printf ("%d\n", dp[n]);
	}
	return 0;
}

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

#define ll long long
#define vi vector<int>
#define vl vector<ll>
#define pii pair<int,int>
#define pll pair<ll,ll>
// pll pp; -> (pp.first,pp.second)
// vector<vl> pp(n,vl(2)); sort(pp.begin(),pp.end(),[](vl a,vl b){return a[0]<b[0];});

#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define RREP(i,n) for(ll (i)=(n)-1;(i)>=0;(i)--)
#define DEBUG(x) cout << #x << ": " << x << endl
#define CHMAX(a,b) a=max((a),(b))
#define CHMIN(a,b) a=min((a),(b))
/*}}}*/
int main() {
  ll n;
  cin >> n;
  ll d;
  cin >> d;
  REP(i,4){
    ll in;
    cin >> in;
    d = min(d,in);
  }
  ll ans = 4;
  ans += n/d;
  if(n%d>0) ans ++;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
/**
 *    author:  otera    
**/
#include<iostream>
#include<string> 
#include<cstdio>
#include<cstring>
#include<vector>
#include<cmath>
#include<algorithm> 
#include<functional>
#include<iomanip>
#include<queue>
#include<deque>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;

#define int long long
typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef long double ld;
const int inf=1e9+7;
const ll INF=1LL<<60 ;
const ll mod=1e9+7 ;
#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++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<int, int> P;
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
#define debug(x)  cerr << #x << " = " << (x) << endl;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

void solve() {
	int n; cin >> n;
	if(n == 3) {
		cout << "2 5 63\n";
	} else if(n == 4) {
		cout << "2 5 20 63\n";
	} else if(n == 5) {
		cout << "2 5 20 63 90\n";
	} else if(n == 6) {
		cout << "2 5 20 63 90 180\n";
	} else if(n == 7) {
		cout << "2 5 20 63 90 180 270\n";
	} else {
		rep(i, n / 8) {
			cout << 12 * i + 2 << " " << 12 * i + 3 << " " << 12 * i + 4 << " " << 12 * i + 6 << " " << 12 * i + 8 << " " << 12 * i + 9 << " " << 12 * i + 10 << " " << 12 * i + 12 << " ";
		}
		int m = n / 8;
		if(n % 8 == 0) {
			//
		} else if(n % 8 == 1) cout << 12 * m + 6 << endl;
		else if(n % 8 == 2) cout << 12 * m + 2 << " " << 12 * m + 4 << endl;
		else if(n % 8 == 3) cout << 12 * m + 2 << " " << 12 * m + 4 << " " << 12 * m + 6 << endl;
		else if(n % 8 == 4) cout << 12 * m + 2 << " " << 12 * m + 4 << " " << 12 * m + 6 << " " << 12 * m + 12 << endl;
		else if(n % 8 == 5) cout << 12 * m + 2 << " " << 12 * m + 4 << " " << 12 * m + 6 << " " << 12 * m + 8 << " " << 12 * m + 10 << endl;
		else if(n % 8 == 6) cout << 12 * m + 2 << " " << 12 * m + 4 << " " << 12 * m + 6 << " " << 12 * m + 8 << " " << 12 * m + 10 << " " << 12 * m + 12 << endl;
		else if(n % 8 == 7) cout << 12 * m + 2 << " " << 12 * m + 3 << " " << 12 * m + 4 << " " << 12 * m + 8 << " " << 12 * m + 9 << " " << 12 * m + 10 << " " << 12 * m + 12 << endl;
	}
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(10);
	//int t; cin >> t; rep(i, t)solve();
	solve();
    return 0;
}

Measured memory_bytes: 3632
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>
#include<cmath>
using namespace std;
void File(){
	freopen("ARC94D.in","r",stdin);
	freopen("ARC94D.out","w",stdout);
}
#define REP(i,a,b) for(register int i=a;i<=b;++i)
#define DREP(i,a,b) for(register int i=a;i>=b;--i)
#define MREP(i,x) for(register int i=beg[x];i;i=E[i].last)
#define ll long long
int n;
int main(){
	//File();
	scanf("%d",&n);
	REP(i,1,n){
		ll a,b;
		scanf("%lld%lld",&a,&b);
		ll dd=sqrt(a*b),ans=dd*2-1;
		if(dd*dd==a*b){
			if(a==b)ans-=1;
			else ans-=2;
		}
		else if(dd*(dd+1)>=a*b)ans-=1;
		cout<<ans<<endl;
	}	
	return 0;
}


Measured memory_bytes: 256
from heapq import heappush, heappop
N,*A = map(int, open(0).read().split())
F = []
fs = 0
S = []
ss = 0
P = []
state = [0]*(3*N)
for i in range(N):
  heappush(F,A[i])
  fs += A[i]
for i in range(N,3*N):
  heappush(S,(-A[i],i))
  ss += A[i]
  state[i] = 1
for i in range(N):
  m,j = heappop(S)
  state[j] = 2
  ss += m
  heappush(P,(-m,j))
ans = fs-ss
for i in range(N,2*N):
  n = heappop(F)
  fs = fs-n+A[i]
  heappush(F,A[i])
  if state[i]==1:
    while state[P[0][1]]==0:
      heappop(P)
    p,j = heappop(P)
    ss += -A[i]+p
    state[j] = 1
  state[i] = 0
  ans = max(ans,fs-ss)
print(ans)

Measured memory_bytes: 48372
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
int n, m;
string s, t;
map<LL, int> x;
int main() {
  while (cin >> n >> m) {
    x.clear();
    cin >> s >> t;
    LL l = 1LL * n / __gcd(n, m) * m;
    for (int i = 0; i < n; i++) {
      x[i * l / n] = int(s[i]);
    }
    bool ans = true;
    for (int i = 0; i < m; i++) {
      if (x.count(i * l / m) && x[i * l / m] != t[i]) {
        ans = false;
        break;
      }
    }
    if (ans) {
      cout << l << endl;
    } else {
      puts("-1");
    }
  }
  return 0;
}

Measured memory_bytes: 6144
#include<iostream>
using namespace std;
int main() {
	int clock[] = { 3600,60,1 };
	for (int i = 0; i < 3; ++i) {
		int time=0;
		int dommy;
		for (int i = 0; i < 3; ++i) {
			cin >> dommy;
			time -= dommy * clock[i];
		}
		for (int i = 0; i < 3; ++i) {
			cin >> dommy;
			time += dommy*clock[i];
		}
		cout << time / clock[0] << ' ';
		time %= clock[0];
		cout << time / clock[1] << ' ';
		time %= clock[1];
		cout << time << endl;
	}
	return 0;
}

Measured memory_bytes: 3008
n=int(input())
a=list(map(int,input().split()))
ans=[0]*3
for i in a:
  if i%4==0:ans[2]+=1
  elif i%2==0:ans[1]+=1
  else:ans[0]+=1
print(['No','Yes'][ans[0]+(ans[1]>0)<=ans[2]+1])

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

from fractions import gcd

def list_lcm(a):
    x = a[0]
    for i in range(1, len(a)):
        x = (x * a[i]) // gcd(x, a[i])
    return x

print(list_lcm(A))

Measured memory_bytes: 5048
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin >> N;
  vector<int> vec(N);
  for(int i=0; i<N; i++){
    cin >> vec.at(i);
  }
  vector<int> color(3,-1);
  int64_t ans = 1;
  for(int i=0; i<N; i++){
    bool flag = true;
    int cnt = 0;
    for(int j=0; j<3; j++){
      if(color.at(j) == vec.at(i) - 1){
        cnt++;
        if(flag){
          color.at(j)++;
          flag = false;
        }
      }
    }
    ans *= cnt;
    ans %= 1000000007;
  }
  cout << ans << endl;
}

Measured memory_bytes: 640
import java.util.Scanner;

public class Main {
    void run() {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int m = scan.nextInt();
        System.out.println((n - 1) * (m - 1));
    }
    public static void main(String[] args) {
        new Main().run();
    }
}

Measured memory_bytes: 21716
#include<stdio.h>

int main(){
    char S[4];
    scanf("%s",S);
    if((int)S[0] == (int)S[1] && (int)S[0] == (int)S[2]){
        printf("No\n");
    }
    else
    {
        printf("Yes\n");
    }
    
}

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

int main(){
    int n, ary[100], sum = 0;
    cin >> n;
    rep(i, n){
        cin >> ary[i];
        sum += ary[i];
    }
    if(sum % 10){
        cout << sum << endl;
        return 0;
    }
    sort(ary, ary + n);
    bool flag = true;
    rep(i, n){
        if(ary[i] % 10){
            cout << sum - ary[i] << endl;
            flag = false;
            break;
        }
    }
    if(flag) cout << 0 << endl;
    return 0;
}

Measured memory_bytes: 256
from collections import deque

N = int(input())
edge = [[] for i in range(N)]
for i in range(N-1):
    a,b = map(int,input().split())
    a-=1
    b-=1
    edge[a].append(b)
    edge[b].append(a)

distF = [-1]*N
distS = [-1]*N
def bfs(s,dist):
    q = deque([])
    q.append([s,0])
    while len(q) != 0:
        v = q.popleft()
        dist[v[0]] = v[1]
        for nv in edge[v[0]]:
            if dist[nv] != -1:
                continue

            dist[nv] = dist[v[0]] + 1
            q.append([nv,dist[nv]])

bfs(0,distF)
bfs(N-1,distS)
# print(distF)
# print(distS)
Fennec = 0
Snuke = 0
for i in range(N):
    if distF[i] <= distS[i]:
        Fennec += 1
    else:
        Snuke += 1
# print(Fennec)
# print(Snuke)
if Fennec > Snuke:
    print('Fennec')
else:
    print('Snuke')


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

int main() {
  int a,b,c;
  cin>>a>>b>>c;
  cout<<a+b+c-max(a,max(b,c))<<endl;
  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
	String str[][] = {
		{},
		{".", ",", "!", "?", " "},
		{"a", "b", "c"},
		{"d", "e", "f"},
		{"g", "h", "i"},
		{"j", "k", "l"},
		{"m", "n", "o"},
		{"p", "q", "r", "s"},
		{"t", "u", "v"},
		{"w", "x", "y", "z"}
	};
	public Main(){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		
		for(int i = 0; i < n; i++){
			String st = sc.next();
			int m = st.length();
			for(int j = 0; j <= m-1;){
				String s = st.substring(j, j+1);
				int t = Integer.parseInt(s);
				int c = 0;
				int l = str[t].length;
				j++;
				for(; j <= m-1 && s.equals(st.substring(j, j+1)); j++, c++);
				if(l != 0){
					System.out.print(str[t][c%l]);
				}
			}
			System.out.println();
		}
	}
	
	public static void main(String[] args){
		new Main();
	}
}

Measured memory_bytes: 13000
#pragma GCC optimize("Ofast") 
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define mp make_pair
#define all(a) a.begin(),a.end()
#define lb lower_bound
#define ub upper_bound
#define owo ios_base::sync_with_stdio(0);cin.tie(0);
#define MOD (ll)(1e9+7)
#define INF (ll)(1e18)
#define debug(...) fprintf(stderr, __VA_ARGS__),fflush(stderr)
#define time__(d) for(long blockTime = 0; (blockTime == 0 ? (blockTime=clock()) != 0 : false);\
debug("%s time : %.4fs\n", d, (double)(clock() - blockTime) / CLOCKS_PER_SEC))
typedef long long int ll;
typedef long double ld;
typedef pair<ll,ll> PII;
typedef pair<int,int> pii;
typedef vector<vector<int>> vii;
typedef vector<vector<ll>> VII;
int main()
{
	int n;
	cin>>n;
	ll ans = 0;
	for(int i=1;i<=n;i++){
		int a;
		cin>>a;
		if(a&1 && i&1)ans++;
	}
	cout<<ans;
	
}

Measured memory_bytes: 3588
n=int(input())
S=[input() for _ in range(n)]
abc='abcdefghijklmnopqrstuvwxyz'
A=[]
for i in range(len(abc)):
    min=float('inf')
    for j in range(n):
        if min>S[j].count(abc[i]):
            min=S[j].count(abc[i])
    A.append(min)
for i in range(len(A)):
    if A[i]:
        for j in range(A[i]):
            print(abc[i], end='')
if all(x==0 for x in A):
    print('')


Measured memory_bytes: 3064
#include <stdio.h>
int main(){
    int a,b,c;
    scanf("%d %d %d",&a,&b,&c);
    if(a==b && b!=c){
        printf("Yes");
    }else if(c==b && b!=a){
        printf("Yes");
    }else if(c==a && b!=a){
        printf("Yes");
    }else{
        printf("No");
    }
    
    return 0;
}


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

int main(){
  int n, k; cin >> n >> k;
  int h[n], a[n];
  for(int i = 0; i < n; i++){
    a[i] = 1e9 + 7;
    cin >> h[i];
  }
  for(int i = 0; i < n; i++){
    if(i == 0){
      a[i] = 0;
    }else{
      for(int j = 1; j <= k; j++){
        if(i < j) break;
        a[i] = min(a[i], a[i-j] + abs(h[i] - h[i-j]));
      }
    }
  }
  cout << a[n-1] << endl;
  return 0;
}


Measured memory_bytes: 1024
/**
 *      purpose : 
 *      author  : kyomukyomupurin
 *      created : 
**/

// input/output
#include <fstream>
#include <iostream>
#include <sstream>
// container class
#include <array>
#include <deque>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>
// math, algorithm
#include <algorithm>
#include <cmath>
#include <complex>
#include <numeric>
// etc
#include <bitset>
#include <cassert>
#include <cctype>
#include <cstring>
#include <chrono>
#include <iomanip>
#include <random>
#include <utility>
// using-directive
using namespace std;
// alias template
using int64 = long long;
using vi = vector<int>;
using vl = vector<int64>;
using pii = pair<int, int>;
using pii = pair<int, int>;
using pll = pair<int64, int64>;
// text macro replacement
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define print(x) cout << (x) << '\n'
#define debug(x) cerr << #x << ": " << (x) << '\n'
#define dbg(v) for (size_t _ = 0; _ < v.size(); ++_){cerr << #v << "[" << _ << "] : " << v[_] << '\n';}
// variadic template
template<typename T> inline void chmin(T &a, T b) {if (a > b) a = b; return;}
template<typename T> inline void chmax(T &a, T b) {if (a < b) a = b; return;}
// constant
const int INF = (1<<30) - 1;
const int64 INF64 = (1LL<<62) - 1;
const int MOD = 1000000007;

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

  int n; cin >> n;
  vi a(n);
  rep(i, n) cin >> a[i];
    for (int k = 0; k < n; ++k) {
      cout << a[k];
      if (k != n - 1) cout << " ";
      else cout << '\n';
    }
  for (int i = 1; i < n; ++i) {
    int v = a[i];
    int j = i - 1;
    while (j >= 0 && a[j] > v) {
      a[j + 1] = a[j];
      --j;
    }
    a[j + 1] = v;
    for (int k = 0; k < n; ++k) {
      cout << a[k];
      if (k != n - 1) cout << " ";
      else cout << '\n';
    }
  }

  return 0;
}


Measured memory_bytes: 3168
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <queue>

#define int long long

using namespace std;

class Solver {
};

signed main() {
	int edge = 1005;
	vector<vector<bool>> prime_grid(edge, vector<bool>(edge));
	vector<tuple<int, int>> poses(1);
	vector<vector<int>> nums(edge, vector<int>(edge, 1));
	poses.emplace_back(make_tuple(edge / 2, edge / 2));
	vector<bool> is_prime(edge * edge + 10, true);
	for (int i = 2; i < is_prime.size(); i++) {
		if (!is_prime[i]) continue;

		for (int j = 2; i * j < is_prime.size(); j++) {
			is_prime[i * j] = false;
		}
	}

	int y = edge / 2;
	int x = edge / 2 + 1;
	int now = 2;
	int len = 2;
	for (int i = edge / 2+1; i < edge; i++) {
		for (int j = 0; j < len; j++) {
			prime_grid[y][x] = is_prime[now];
			poses.emplace_back(make_tuple(y, x));
			nums[y][x] = now;
			y--;
			now++;
		}
		y++;
		x--;
		for (int j = 0; j < len; j++) {
			prime_grid[y][x] = is_prime[now];
			poses.emplace_back(make_tuple(y, x));
			nums[y][x] = now;
			x--;
			now++;
		}
		x++;
		y++;
		for (int j = 0; j < len; j++) {
			prime_grid[y][x] = is_prime[now];
			poses.emplace_back(make_tuple(y, x));
			nums[y][x] = now;
			y++;
			now++;
		}
		y--;
		x++;
		for (int j = 0; j < len; j++) {
			prime_grid[y][x] = is_prime[now];
			poses.emplace_back(make_tuple(y, x));
			nums[y][x] = now;
			x++;
			now++;
		}
		len+=2;
	}
	/*for (int i = 0; i < edge; i++) {
		for (int j = 0; j < edge; j++) {
			if (prime_grid[i][j])cout << 1;
			else cout << 0;
		}
		cout << endl;
	}*/

	while (true) {
		int m, n;
		cin >> m >> n;
		if (m == 0)break;

		vector<vector<int>> dp(edge, vector<int>(edge, 0));
		set<tuple<int, int>> tmp;
		tmp.emplace(poses[n]);

		int num = 0;
		int cnt = 0;
		while (tmp.size() > 0) {
			vector<vector<int>> next(edge, vector<int>(edge, 0));
			set<tuple<int, int>> pos_tmp;
			for (auto pos : tmp) {
				int y = get<0>(pos);
				int x = get<1>(pos);
				next[y][x] = max(max(dp[y - 1][x], dp[y - 1][x - 1]),
					dp[y - 1][x + 1]);
				if (prime_grid[y][x]) {
					next[y][x]++;
					if (cnt < next[y][x] 
						|| (cnt == next[y][x] && nums[y][x] > num)) {
						cnt = next[y][x];
						num = nums[y][x];
					}
				}

				if (nums[y + 1][x] <= m) {
					pos_tmp.emplace(make_tuple(y + 1, x));
				}
				if (nums[y + 1][x + 1] <= m) {
					pos_tmp.emplace(make_tuple(y + 1, x + 1));
				}
				if (nums[y + 1][x - 1] <= m) {
					pos_tmp.emplace(make_tuple(y + 1, x - 1));
				}
			}
			dp = next;
			tmp = pos_tmp;
		}

		cout << cnt << " " << num << endl;
	}	
}


Measured memory_bytes: 42968
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
using ld=long double;
using pll=pair<ll,ll>;
 
const ll MOD=1000000007;
 
ll abs1(ll a){
  if(a>=0)return a;
  else return -a;
}
 
ll pow1(ll a,ll b,ll p=LLONG_MAX){
  ll ret=1;
  while(b!=0){
    if((b&1)==1){
      ret*=a;
    }
    a*=a;
    if(a>=p)a%=p;
    b=b>>1;
  }
  return ret;
}
 
int digit(ll a,ll b){
  int i=0;
  while(a!=0){
    a/=b;
    i++;
  }
  return i;
}
 
ll gcd1(ll a,ll b){
  if(a==0 && b==0)return 0;
  ll n;
  while(a%b!=0){
    n=a%b;
    a=b;
    b=n;
  }
  return b;
}
 
ll solveLinear(ll n,ll m,ll c){
  if(n==0 && m==0)return 0;
  ll a[100],b[100];
  a[0]=n;b[0]=m;
  int i=1;
  while(b[i-1]!=0){
    a[i]=b[i-1];
    b[i]=a[i-1]%b[i-1];
    i++;
  }
  n=i;
  if(c%a[n-1]!=0){
    return 0;
  }
  ll x=c/a[n-1],y=0;
  for(i=1;i<n;i++){
    ll cnt=x;
    x=y;
    y=cnt-(a[n-i-1]/b[n-i-1])*y;
  }
  return x;
}
 
ll modRev(ll a,ll p=MOD){
  a%=p;
  ll n=solveLinear(a,p,1);
  n%=p;
  if(n<0)return n+p;
  return n;
}
 
ll binom1(ll n,ll k,ll p=MOD){
  if(n<0 || k<0 || n<k)return 0;
  int i;
  ll ret=1,fact=1;
  for(i=0;i<k;i++){
    ret=ret*(n-i);
    fact*=i+1;
    if(ret>=p)ret%=p;
    if(fact>=p)fact%=p;
  }
  return (ret*modRev(fact))%p;
}

int main(){
  ll i,j,k,l,cnt=0;
  ld r1,r2;
  cin>>r1>>r2;
  printf("%.10llf\n",1/(1/r1+1/r2));
}

Measured memory_bytes: 256