akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define N 3005
#define re register
using namespace std;
int n,la[N<<1],lb[N<<1],loca[N<<1],locb[N<<1];
char a[N<<1];
bool dp[N][N];
string ans = "";

string get(bool dp[])//对这个存在性的数组求对应的串 
{
	string ret = "";
	for(re int i=0;i<n * 2;++i)
	{
		if(a[i] == 'a' && dp[la[i]]) ret += "a";
		if(a[i] == 'b' && dp[lb[i]]) ret += "b";
	}
	return ret;
}
int main()
{
	scanf("%d%s",&n,a);
	for(int i=0,ca=0,cb=0;i<n*2;++i)
	{
		if(a[i] == 'a') la[i] = ++ca,loca[ca] = i;
		else lb[i] = ++cb,locb[cb] = i;
	}
	dp[n][n] = 1;
	for(int i=n - 1;i>=1;--i)
	{
		int mx = i;
		dp[i][i] = 1;
		if(loca[i] < locb[i])
		{	
			for(int j=loca[i] + 1;j<locb[i];++j) if(a[j] == 'a') mx = max(mx,la[j]);
			for(int j=mx + 1;j<=n;++j) dp[i][j] = dp[mx + 1][j];
		}
		else
		{
			int R = loca[i];
			for(int j=locb[i] + 1;j<R;++j) 
			if(a[j] == 'b')
			{
				R = max(R,loca[lb[j]]);
				mx = lb[j]; dp[i][lb[j]] = 1;
			}
			for(int j=mx + 1;j<=n;++j) dp[i][j] = dp[mx + 1][j];
		}
		if(get(dp[i]) < get(dp[i + 1])) memcpy(dp[i],dp[i + 1],sizeof(dp[i]));
	}
	cout<<get(dp[1])<<endl;
	return 0;
}

Measured memory_bytes: 9088
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>


int main() {
	int n, m, q;
	std::cin >> n >> m >> q;
	std::vector<std::vector<int>> section(n + 1, std::vector<int>(n + 1, 0));
	for (auto i = 0; i < m; ++i) {
		int l, r;
		std::cin >> l >> r;
		section[0][r]++;
		if (l < n) section[l + 1][r]--;
	}
	for (auto i = 0; i <= n; ++i) for (auto j = 1; j <= n; ++j) section[i][j] += section[i][j - 1];
	for (auto i = 1; i <= n; ++i) for (auto j = 0; j <= n; ++j) section[i][j] += section[i - 1][j];
	for (auto i = 0; i < q; ++i) {
		int p, q;
		std::cin >> p >> q;
		std::cout << section[p][q] << std::endl;
	}
}

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

int main()
{
    char s[4];
    cin>>s;
    int c=1;
    int m=1;
    if(s[0]==s[1] && s[1]==s[2] && s[0]=='R') cout<<3<<endl;
    else if(s[0]==s[1] && s[0]=='R') cout<<2<<endl;
    //else if(s[0]==s[2] && s[0]=='R') cout<<2<<endl;
    else if(s[1]==s[2] && s[1]=='R') cout<<2<<endl;
    else if(s[0]==s[1] && s[1]==s[2] && s[0]=='S') cout<<0<<endl;
    else cout<<1<<endl;
}


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

#define int long long int
#define ll long long
#define quickie ios_base::sync_with_stdio(false); cin.tie(NULL);
#define rep(i, a, b) for(int i=a; i<b; i++)
#define rep1(i, a, b) for(int i=a; i<=b; i++)
#define repp(i, a, b) for(int i=b-1; i>=a; i--)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
#define db double
#define mi map<int, int>
#define vi vector<int>
#define qi queue<int>
#define MI(x) power(x, mod-2)
#define test int t; cin >> t;
#define all(a) a.begin(),a.end()
#define mod 1000000007
#define pi 3.141592653589
#define fact(n) rep(i, 1, n+1)ft.pb((ft[i-1]*i)%mod) ;

// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
// template<typename T>
// using ordered_set = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;
// template<typename T>
// using ordered_multiset = tree<T,null_type,less_equal<T>,rb_tree_tag,tree_order_statistics_node_update>;
//(*****FOR USING ORDERED SET CHANGE INT*******)

const int maxN = 100001 ;
int n ;
int a[maxN], b[maxN], c[maxN], va[maxN], vb[maxN], vc[maxN] ;

signed main() {
    quickie
    cin >> n ;
    rep(i, 1, n+1) cin >> a[i] >> b[i] >> c[i] ;
    va[n] = a[n] ;
    vb[n] = b[n] ;
    vc[n] = c[n] ;
    for(int i=n-1; i>=1; i--) {
        va[i] = a[i]+max(vb[i+1], vc[i+1]) ;
        vb[i] = b[i]+max(va[i+1], vc[i+1]) ;
        vc[i] = c[i]+max(va[i+1], vb[i+1]) ;
    }
    cout << max(va[1], max(vb[1], vc[1])) << "\n" ;
}

int power(int x, int y) {
    int res = 1; x %= mod;
    while (y > 0) {
        if (y & 1)
            res = (res*x) % mod;
        y = y>>1;
        x = (x*x) % mod;
    }
    return res%mod;
}

int gcd(int a,int b){
    if(a==0) return b;
    return gcd(b%a,a);
}

Measured memory_bytes: 8312
#include <bits/stdc++.h>
#include <set>
#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 100000000
#define MOD 100000007

#define writeln(n) cout<<n<<endl

using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;
//vector<tuple<long long, long long, long long>>vec;

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

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

llong pownew(llong m, llong n) {
    if (n == 0) { return 1; }
    if (n % 2 == 0) { return pow(m*m, n/2); }
    return pow(m, n-1) * m;
}

bool isprime(int p) {
    if (p == 1) return false;
    for (int i = 2; i < p; i++) {
        if (p%i == 0) return false;
    }
    return true;
}

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

const int inf=100000000;

long long modpow(long long a, long long n, long long mod) //a^n
{
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

int gcd(int a, int b) {
    return b != 0 ? gcd(b, a % b) : a;
}
//setprecision(10);



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

    llong k,a,b; cin>>k>>a>>b;
    llong ans=0;
    if(k+1<=a) ans=k;
    else if(b<=a+2)
    {
        ans=k+1;
    }
    else
        {
            ans=a+(k-a+1)/2*max(b-a,(llong)2)+(k-a+1)%2;
        }
    cout<<ans<<endl;
    return  0;
}


Measured memory_bytes: 256
N=int(input())
A=[int(s) for s in input().split()]
dp=[0]*N
dp[0]=1000
for i in range(1,N):
    dp[i]=max(dp[i-1],(dp[i-1]//A[i-1])*A[i]+dp[i-1]%A[i-1])
print(dp[N-1])

Measured memory_bytes: 9196
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <fstream>
#include <iostream>
#include <map>
#include <queue>
#include <string>
#include <stack>
#include <vector>
#include <set>
#include <tuple>
#include <utility>
#include <functional>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
const int INF = 1000000000;
const int MOD = 1000000007;

int dp[100005][2];
//dp[i][0]は一致,dp[i][1]は未満.
int main(){
	string s;
	cin >> s;
	dp[0][0] = 1;

	//aとbのi桁目は(1,1)であってはいけない.
	//a+b=1,a+b=0の場合で場合分けをする.(つまり等しい、小さいは和を見て言っている)
	//桁dpで持ちたいのは,a+bがi桁まで等しい状態かどうかとそれを達成する場合の数がいくつか.
	int n = s.size();
	for(int i = 0;i < n;i++){
		{//a+b=0にするとき.
			if(s[i] == '0'){
				dp[i+1][0] = dp[i][0];//(a,b)=(0,0)しか取り得ない.
				dp[i+1][1] = dp[i][1];
			}
			else{
				dp[i+1][1] = (dp[i][0] + dp[i][1]) % MOD;
			}
		}
		{//a+b=1にするとき (1,0),(0,1)の2通り
			if(s[i] == '0'){//取れないから,手前の場合の数と変わらない.
				dp[i+1][1] += dp[i][1] * 2 % MOD;
				dp[i+1][1] %= MOD;
			}
			else{
				dp[i+1][0] += dp[i][0] * 2 % MOD;
				dp[i+1][1] += dp[i][1] * 2 % MOD;
				dp[i+1][0] %= MOD;
				dp[i+1][1] %= MOD;
			}
		}
	}

	int ans = (dp[n][0] + dp[n][1]) % MOD;
	cout << ans << endl;
}


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

int main(){
	int n,a;
	int min =  10000000;
	int max = -10000000;
	long long  sum = 0;
	cin >> n;
	for (int i=0;i<n;i++){
		cin >> a;
		if (a <= min) min = a;
		if (a >= max) max = a;
		sum += a;
	}

	cout << min << " " << max << " " << sum << endl;
	return 0;
}


Measured memory_bytes: 3116
#include <bits/stdc++.h>
using namespace std;
int n,k;
int  mn;
//int a[100005],dp[100005];
int solve(int s, int dp[], int a[])
{  //cout<<s<<endl;
       if(s<mn) return -1;
  
    else if(dp[s]) return dp[s];
    
    for(int i=0;i<n;++i)
        {   if(a[i]<=s)
            {
            int temp=solve(s-a[i],dp,a);
            if(temp==-1)
                {dp[s]=1;return dp[s];}
            else if(temp==1)
                {dp[s]=-1;}
            }
 
        }
        return dp[s];
}
 
int main()
{   int t;
    //cin>>t;
    //while(t--)
    {
    cin>>n>>k;
    int dp[k+4]={0};
    int a[n+1];
    cin>>a[0];mn=a[0]; 
    for(int i=1;i<n;++i)
        {cin>>a[i];mn=min(a[i],mn);}
    //cout<<mn<<" \n";cout<<s<<" "<<p<<" "<<dp[s][p]<<"\n"; cout<<s<<" "<<p<<"\n ";
    solve(k,dp,a);
    //for(int i=0;i<=k;++i)
    //cout<<dp[i]<<" ";
    if(dp[k]==1) cout<<"First\n";
    else if(dp[k]==-1) cout<<"Second\n";
    }
        
}

Measured memory_bytes: 6912
#include<cstdio>
#include<cmath>
#include<string>
#include<iostream>
#include<algorithm>
#include<utility>
#include<vector>
#include<map>
#include<set>
#include<limits>
#include<bitset>
#include<array>
#include<numeric>
#include<iomanip>
#include<functional>
#include<deque>

using namespace std;
typedef long long int ll;

#define C cout<<
#define E <<endl

ll n,m,a,b,c,x,y,z,aa[200010],ab[200010],ac[1010][1010];
bool r,ra,rb,rc;
string s,sa,sb,sc;
char ca,cb,cc,cd[1010][1010];
vector<ll> va,vb,vc;


int main(){
    cin>>s;
    n=s.size();
    a=0;
    for(int i=0;i<n;i++){
        va.push_back(s[i]-'0');
        a+=((s[i]-'0')==1 ? 1:-1);
    }
    //for(auto it:va)C it E;
    C n-abs(a) E;
    
    
}

Measured memory_bytes: 1528
road = int(input())
while road > 0:
    answer = [[float("inf") if n != m else 0 for n in range(10)] for m in range(10)]
    city = 0
    for _ in range(road):
        c1, c2, w = (int(n) for n in input().split(" "))
        answer[c1][c2] = w
        answer[c2][c1] = w
        city = max(city, c1, c2)
    city += 1
    for i in range(city):
        for j in range(city):
            for k in range(city):
                answer[j][k] = min(answer[j][k], answer[j][i] + answer[i][k])
    sum_ans = [-1 , float("inf")]
    for i in range(city):
        if sum(answer[i][:city]) < sum_ans[1]:
            sum_ans = [i, sum(answer[i][:city])]
    print(*sum_ans)
    road = int(input())

Measured memory_bytes: 7684
package main

import (
	"fmt"
	"sort"
)

type byChar []byte

func (b byChar) Len() int           { return len(b) }
func (b byChar) Swap(i, j int)      { b[i], b[j] = b[j], b[i] }
func (b byChar) Less(i, j int) bool { return b[i] < b[j] }

func main() {
	var N int
	fmt.Scan(&N)

	m := make(map[string]int, N)
	for i := 0; i < N; i++ {
		var s []byte
		fmt.Scan(&s)
		sort.Sort(byChar(s))
		m[string(s)]++
	}

	ans := 0
	for _, v := range m {
		if v > 1 {
			ans += v * (v - 1) / 2
		}
	}
	fmt.Println(ans)
}


Measured memory_bytes: 10112
#include <bits/stdc++.h>
using namespace std;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ll long long
#define ld long double
#define all(a) (a).begin(),(a).end()
#define mk make_pair
ll mod=1000000007;
ll MOD=998244353;
int inf=1000001000;
ll INF=2e18+17;

int main() {
    int n,ans=0,o=0;
    cin >> n;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    while(true){
        if (o==1) break;
        if (ans>n) break;
        ans++;
        o=a[o]-1;
    }
    if (ans<=n) cout << ans << endl;
    else cout << -1 << endl; 
}

Measured memory_bytes: 640
#include <iostream>
#include <cstring>
#include <cmath> 
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
using namespace std;   
int main()  
{
    string s;
    cin>>s;
    for(int i=0;i<s.size()-8;i++)cout<<s[i]; 
    cout<<endl;

   // system("pause");
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long long mod =  998244353;
long long inv[3000009];
long long f[3000009];
long long F[3000009];
long long C(long long m, long long n){
    if(n > m || n < 0)return 0;
    return (f[m]*F[n]%mod)*F[m-n]%mod;
}
main(){
    long long n,a,b;
    long long ans = 0;
    long long k;
    cin>>n>>a>>b>>k;
    inv[0] = 1;
    inv[1] = 1;
    for(long long i=  2; i <= n; i++)
        inv[i] = (inv[mod % i])*(mod - mod/i)% mod;
    f[0] = 1;
    F[0] = 1;
    for(long long i = 1; i <= n; i++){
        f[i] = f[i-1]*(i)%mod;
        F[i] = F[i-1]*(inv[i])%mod;
    }
    for(long long i = 0;i <= n; i++){
        if((k - i*a)%b) continue;
        long long x= i;
        long long y = (k-i*a)/b;
        ans = (ans + C(n,x)*C(n,y))%mod;
    }
    cout<<ans<<endl;
}


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

int main()
{
    int n,T;
    cin >> n >> T;
    int c, t,ans = 0;
    rep(i,n){
        cin >> c >> t;
        if (((ans == 0) && (t<=T)) || ((t<=T) && (c < ans))) ans = c;
    }
    if (ans == 0) cout << "TLE" << endl;
        else cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<bits/stdc++.h>
#include<vector>
#include<algorithm>
#include<string>
using namespace std;


int main(){

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


	string str;
	cin >> str;

	if(str[2]==str[3] && str[4]==str[5]){
		cout << "Yes";
	}
	else
		cout << "No";



	return 0;
}




Measured memory_bytes: 256
import sys
input = sys.stdin.readline

N=int(input())
E=[[] for i in range(N+1)]

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

mod=10**9+7

FACT=[1]
for i in range(1,2*10**5+1):
    FACT.append(FACT[-1]*i%mod)

FACT_INV=[pow(FACT[-1],mod-2,mod)]
for i in range(2*10**5,0,-1):
    FACT_INV.append(FACT_INV[-1]*i%mod)

FACT_INV.reverse()

def Combi(a,b):
    if 0<=b<=a:
        return FACT[a]*FACT_INV[b]*FACT_INV[a-b]%mod
    else:
        return 0

TOP_SORT=[]
Q=[1]
P=[-1]*(N+1)
P[1]=0
P[0]=0

while Q:
    x=Q.pop()
    TOP_SORT.append(x)

    for to in E[x]:
        if P[to]==-1:
            P[to]=x
            Q.append(to)

Children=[1]*(N+1)
ANS_UP=[1]*(N+1)

for x in TOP_SORT[::-1]:
    sumchild=0
    for to in E[x]:
        if to==P[x]:
            continue
        sumchild+=Children[to]
        ANS_UP[x]=ANS_UP[x]*Combi(sumchild,Children[to])%mod
                    
    Children[P[x]]+=Children[x]
    ANS_UP[P[x]]=ANS_UP[P[x]]*ANS_UP[x]%mod

ANS_DOWN=[1]*(N+1)

for x in TOP_SORT:
    if x==1:
        continue
    ANS_DOWN[x]=ANS_DOWN[P[x]]*ANS_UP[P[x]]*Combi(N-Children[x]-1,N-Children[P[x]])*pow(ANS_UP[x],mod-2,mod)*pow(Combi(Children[P[x]]-1,Children[x]),mod-2,mod)%mod

for i in range(1,N+1):
    if i==1:
        print(ANS_UP[1])
    else:
        ANS=ANS_DOWN[i]%mod

        sumchild=0
        for to in E[i]:
            if to==P[i]:
                sumchild+=N-Children[i]
                ANS=ANS*Combi(sumchild,N-Children[i])%mod
            else:                  
                sumchild+=Children[to]
                ANS=ANS*ANS_UP[to]*Combi(sumchild,Children[to])%mod

        print(ANS)

Measured memory_bytes: 166056
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rrep(i, n) for (int i = (n - 1); i >= 0; i--)
#define ALL(v) v.begin(), v.end()
using namespace std;
using P = pair<int, int>;
typedef long long ll;

int main() {
  ll k, a, b;
  cin >> k >> a >> b;
  if(b-a <= 2 || k < a-1){
    cout << k + 1 << endl;
    return 0;
  }
  k -= a - 1;
  ll ans = a;
  if(k % 2 == 1)ans++, k--;
  ans += (b - a) * (k / 2);
  cout << ans << endl;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> P;
const int INF = 100000000;
int main(){
    int H, W;
    cin >> H >> W;
    vector<vector<char>> s(H, vector<char>(W));
    vector<vector<int>> d(H, vector<int>(W, INF));
    int count = 0;
    for (int i = 0; i < H; i++){
        for(int j = 0; j < W; j++){
            cin >> s.at(i).at(j);
            if (s.at(i).at(j) == '.') count++;
        }
    }
    queue<P> que;
    que.push(P(0, 0));
    d.at(0).at(0) = 0;
    vector<int> dy = {1, 0, -1, 0};
    vector<int> dx = {0, 1, 0, -1};
    bool can = false;
     while (que.size()){
         P p = que.front();
         que.pop();
         //cout << p.second << " " << p.first << " " << d.at(p.first).at(p.second) <<endl;
         if (p.first == H - 1 && p.second== W - 1) {
             //cout << p.first << " " << p.second << " " << d.at(gy - 1).at(gx - 1) <<endl;
             can = true;
             break;
         }
         
         for (int i = 0; i < 4; i ++){
             int ny = p.first + dy.at(i);
             int nx = p.second + dx.at(i);
             if (ny >= 0 && ny < H && nx >= 0 && nx < W && d.at(ny).at(nx) == INF && s.at(ny).at(nx) == '.'){
                 que.push(P(ny, nx));
                 d.at(ny).at(nx) = d.at(p.first).at(p.second) + 1;
             }
         }
         
     }
    
    if(can) cout << count - d.at(H-1).at(W-1) - 1 << endl;
    else  cout << -1 << endl;
}

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

class DSU {
	private:
		int *data;
		int *size;
	public:
		DSU(int n) {
			data = new int[n];
			size = new int[n];
			for(int i = 0; i < n; i++) {
				data[i] = i;
				size[i] = 1;
			}
		}

		~DSU() {delete[] data; delete[] size;}

		int find(int i) {
			int parent = data[i];
			if (parent == i)
				return i;
			data[i] = -1;
			int back_to = i;
			for(i = parent; i != (parent = data[i]); i = parent) {
				data[i] = back_to;
				back_to = i;
			}
			int root = i;
			do {
				i = back_to;
				back_to = data[i];
				data[i] = root;
			} while(back_to != -1);
			return root;
		}

		void merge(int i, int j) {
			int ri = find(i), rj = find(j);
			if (ri == rj)
				return;
			if (size[ri] < size[rj]) {
				int t = ri;
				ri = rj;
				rj = t;
			}
			data[rj] = ri;
			size[ri] = size[ri] + size[rj];
		}

		int get_size(int i) {
			return size[find(i)];
		}
};
using namespace std;

int main() {
	int n, m, k;
	int excluded[100000] = {};
	cin >> n >> m >> k;
	DSU forest{n};
	for(int i = 0; i < m; i++) {
		int a, b;
		cin >> a >> b;
		a--; b--;
		forest.merge(a, b);
		excluded[a]++;
		excluded[b]++;
	}
	for(int i = 0; i < k; i++) {
		int c, d;
		cin >> c >> d;
		c--; d--;
		if (forest.find(c) == forest.find(d)) {
			excluded[c]++;
			excluded[d]++;
		}
	}
	for(int i = 0; i < n; i++) {
		if (i) cout << " ";
		cout << forest.get_size(i) - 1 - excluded[i];
	}
	cout << endl;
}


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

using namespace std;

#define int int long long

const int maxn = 1e5 + 10;

int N, M, V, P;
int A[maxn];

bool Check(int X)
{
	if(X < P)
		return true;
	int All = 0, Win = X - P + 1;
	for(int i = X - 1; i >= 0 && Win; i --)
	{
		int Vote = A[i] - A[X];
		if(Vote > M)
			return false;
		Win --;
		All += Vote;
	}
	if(All <= (N - V) * M)
		return true;
	return false;
}

signed main()
{
	scanf("%I64d%I64d%I64d%I64d", &N, &M, &V, &P);
	for(int i = 0; i < N; i ++)
		scanf("%I64d", A + i);
	sort(A, A + N);
	reverse(A, A + N);
	int Lbound = 0LL, Ubound = N - 1LL;
	while(Lbound < Ubound)
	{
		int Mid = (Lbound + Ubound + 1LL) >> 1LL;
		if(Check(Mid))
			Lbound = Mid;
		else
			Ubound = Mid - 1LL;
	}
	printf("%I64d\n", Lbound + 1);
	return 0;
}

Measured memory_bytes: 1024
#pragma GCC optimize("O3")
#include<bits/stdc++.h> 
using namespace std;
using ll=long long;
using ull=unsigned long long int;
using P=pair<ll,ll>;
template<class T> using V=vector<T>; 
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
const ll inf=(1e18);
const ll mod=1000000007;
ll gcd(ll a,ll b) {return b ? gcd(b,a%b):a;}
ll lcm(ll c,ll d){return c/gcd(c,d)*d;}
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
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 (a>b) { a=b; return 1; } return 0; }
ll dp[11][205];
int main(){
while(1){
  ll n,k,s;
  cin>>n>>k>>s;
  if(n==0)return 0;
  for(int i=0;i<11;i++)for(int j=0;j<205;j++)dp[i][j]=0;
  dp[0][0]=1;
  for(int i=1;i<=n;i++){
    for(int j=k-1;j>=0;j--){
      for(int r=0;r<=s;r++){
        if(dp[j][r]){
          if(i+r<=s)dp[j+1][i+r]+=dp[j][r];
        }
      }
    }
  }
  cout<<dp[k][s]<<"\n";
}
}


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

typedef long long ll;
typedef unsigned long long ull;

int main() {
  ll m, d;
  cin >> m >> d;

  ll ans = 0;
  for (ll i = 1; i <= m; ++i) {
    for (ll j = 1; j <= d; ++j) {
      ll d1 = j%10;
      ll d10 = (j - d1) / 10;

      if (d1 < 2 || d10 < 2) continue;
      if (i == (d1*d10)) {
        ans++;
      }
    }
  }

  cout << ans << endl;

  return 0;
}

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

typedef long long ll;
ll x;


ll memo[7];

int main()
{
	cin >> x;
	ll cou = x / 11LL;
	x -= cou * 11LL;
	cou *= 2;
	if(0 < x && x <= 6)
	{
		cou++;
	}
	else if(6 < x)
	{
		cou+=2;

	}
	cout << cou << endl;
	return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
#define   ll  long long int
#define   sz  1000100

using namespace std;

ll num[sz];

int main()
{


    ll n,i,j,a,b;

    cin>>n;

    for(i=1;i<=n;i++)
    {
        cin>>num[i];
    }

    sort(num+1,num+n+1);

    cout<<num[n]-num[1]<<endl;


    return 0;
}



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

#define _USES_MATH_DEFINES

#define x first
#define y second

int cmp(pair<int, int> a, pair<int, int> b) {
    auto f = [](long double Rad) -> long double { 
        if( Rad < 0 ) Rad += (2*M_PI);
        return Rad;
    };
    return f(atan2l(a.y, a.x)) < f(atan2l(b.y, b.x));
}

int more_than_rad(pair<int, int> a, pair<int, int> b) {
    long double ang = atan2l( a.y - b.y, a.x - b.x );
    if(ang < 0) ang += (2*M_PI);
    //
    return (ang > M_PI);
}

long double eulDist(long long x, long long y) {
    return sqrtl( x*x + y*y );
}

int main() {
    // pair<int, int> a = {0, 0}, b = {5, 5};
    // cout << fixed << setprecision(5) << atan2l( a.y - b.y, a.x - b.x ) << endl;
    // return 0;
    //
    int n; cin >> n;
    vector< pair<int, int> > P (n, {0, 0});
    for(int i = 0; i < n; i++) {
        cin >> P[i].x >> P[i].y;
    }
    //
    sort(P.begin(), P.end(), cmp);
    // vector< pair<int, int> > sumV = {{0, 0}};
    // for(auto &p : P) {
    //     pair<int, int> pp = *(sumV.rbegin());
    //     sumV.push_back( {pp.x + p.x, pp.y + p.y} );
    // }
    //

    // for(int i = 0; i < n; i++) {
    //     cerr << "Point " << i << " : " << P[i].x << " " << P[i].y << endl;
    // }
    // return 0;

    int L = 0, R = 0;
    long double maxR = 0.0;
    while(L < n) {
        int subx = P[L].x, suby = P[L].y;
        maxR = max(maxR, eulDist(subx, suby));
        // cerr << "@ L = " << L << endl;
        //
        R = (L + 1) % n;
        while( L != R  ) {
            // cerr << "@@ R = " << R << endl;
            // cerr << "@@ maxR = " << maxR << endl;
            subx += P[R].x;
            suby += P[R].y;
            maxR = max(maxR, eulDist(subx, suby));
            R = (R + 1) % n;
            if(L == R) break;
        }
        //
        L++;
    }
    //
    cout << fixed << setprecision(50) << maxR;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
	static vector<int> g[200005];
	int N,M;
	scanf("%d %d",&N,&M);
	int a,b;
	for(int i = 0; i < M; i++){
		scanf("%d %d",&a,&b);
		g[a].push_back(b);
	}
	for(int i = 0; i <g[1].size();i++){
		int num = g[1][i];
		for(int j = 0; j <g[num].size();j++){
			if(N==g[num][j]){printf("POSSIBLE");return 0;}
		}
	}
	printf("IMPOSSIBLE");
	return 0;	
}

Measured memory_bytes: 8576
def ri(): return int(input())
def rli(): return list(map(int, input().split()))
def rls(): return list(map(str, input().split()))
def pl(a): print(" ".join(list(map(str, a))))
def ma():return map(int,input().split())

a,b=ma()
if a>2*b:
  print(a-2*b)
else: 
  print(0)

Measured memory_bytes: 3064
#include<iostream>
#include<vector>


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

using namespace std;

int main(){
    int n, k;
    cin >> n >> k;
    vector<int> d(n);
    rep(i, k){
        int m;
        cin >> m;
        rep(j,m){
            int a;
            cin >> a;
            d[a-1] = 1;
        }
    }

 
    int ans=0;
    rep(i,n) if(d[i]==0)++ans;
    cout << ans << endl;
    return 0;
}

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

int main(){
	int N, M, i, sumT = 0;
	scanf("%d", &N);
	vector<int> T(N);
	for(i = 0; i < N; i++){
		scanf("%d", &T[i]);
		sumT += T[i];
	}
	scanf("%d", &M);
	for(i = 0; i < M; i++){
		int P, X;
		scanf("%d%d", &P, &X);
		printf("%d\n", sumT - T[P - 1] + X);
	}
	return 0;
}

Measured memory_bytes: 256
// #define _CRT_SECURE_NO_WARNINGS
// #define _USE_MATH_DEFINES	// M_PI=3.1415...
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <locale>
#include <cctype>
#include <sstream>
#include <iomanip>	// 20桁出力 cout << setprecision(20) << double;
#include <queue>
#include <bitset>	// bitset<8> bs1(131uL); // 10000011 bs1[0]は1 01stringからビット集合生成可
#include <numeric>
#include <random>
#include <climits>  // A/Bを計算するときA==LLONG_MIN && B==-1のみ(1ull<<63)で代用
using namespace std;

typedef long long LL;
typedef pair<LL, LL> P;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<LL> VL;
typedef vector<VL> VVL;				// VVL v(100,VL(100,0));
typedef vector<pair<LL, LL> > VP;
typedef vector<string> VS;
typedef map<int, int> MAPII;
typedef multimap<int, char, greater<int> > MuMAPIC;
typedef multimap<int, string, greater<int> > MuMIS;
typedef pair<LL, pair<P, P> > PP;

#define INF 999999999999999997		// 少し加算したらオーバーフローする
#define MP make_pair
#define FAST_IO  cin.tie(0); ios::sync_with_stdio(false);
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define FORL(i,a,b) for(LL i=(a);i<(b);i++)
#define FOR_REV(i,a,b) for(int i=(a);i>=(b);i--)
#define foreach_it(type,it,c) for(type::iterator it=c.begin(),c_end=c.end();it!=c_end;++it)
#define FOR_ITR(d) for(auto itr=d.begin(),d_end=d.end();itr!=d_end;++itr)	// C++11
#define O(s) cout<<s<<endl;

#define DUMP_VVI(b) if(dbgF){FOR(i,0,b.size()){FOR(j,0,b[i].size())printf("%d ",b[i][j]);puts("");}}
#define D_OUT(str,value) if(dbgF){cout<<str<<" : "<<value<<endl;}

template<class T>T IN() { T d; cin >> d; return d; }

LL gcd(LL a, LL b) { return (b > 0) ? gcd(b, a%b) : a; } // 最大公約数（Greatest Common Divisor）
LL lcm(LL a, LL b) { return a / gcd(a, b) * b; } // 最小公倍数（Least Common Multiple）
bool uruu(LL Y) { return (((Y % 4 == 0 && Y % 100 != 0) || Y % 400 == 0) ? true : false); } // うるう年判定
string Replace(string S, string from, string to) { auto p = S.find(from); while (p != string::npos) { S.replace(p, from.size(), to); p = S.find(from, p + to.size()); }return S; }

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

// -------------------------------------------------------------------------------

int vector_finder(std::vector<LL> vec, LL number) {
	auto itr = std::find(vec.begin(), vec.end(), number);
	size_t index = std::distance(vec.begin(), itr);
	if (index != vec.size()) { // 発見できたとき
		return 1;
	}
	else { // 発見できなかったとき
		return 0;
	}
}

int main() {
	FAST_IO;
	bool dbgF = true; // for D_OUT(str, value)  ... cout<< str <<" : "<< value <<endl;

	LL N;
	VL X;
	cin >> N;
	FOR(i, 0, N)
		X.push_back(IN<LL>());

	VL y = X;
	sort(X.begin(), X.end());

	FOR(i, 0, N) {
		if (y[i] >X[N / 2-1]) {
			O(X[N / 2 - 1]);
		}
		else {
			O(X[N / 2]);
		}
	}


	return 0;
}

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

int main(void)
{
	char s[101],scopy[101],p[101];

	scanf("%s",&s);
	scanf("%s",&p);


	strcpy(scopy,s);
	strcat(s,scopy);

	if(strstr(s,p) != 0){
		printf("Yes\n");
		}
	else{
		printf("No\n");
	}
	return 0;
}

Measured memory_bytes: 540
#define lp(i,n) for(int i=0;i<n;i++)
#define pau system("pause")
#include<bits/stdc++.h>

using namespace std;
int main() {
    int n;
    bool f=true;
    cin>>n;
    vector<int> a(n);
    lp(i,n)
        cin>>a[i];
    lp(i,n){
        if(a[i]%2==0){
            if(a[i]%3!=0&&a[i]%5!=0)
                f=false;
        }
    }
    if(f)
        cout<<"APPROVED"<<endl;
    else
        cout<<"DENIED"<<endl;
    
}


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

const ll mod = 1e9 + 7;

int main() {
  int N, M;
  cin >> N >> M;

  vector<bool> as(N + 1, true);
  rep(i, M) {
    int a;
    cin >> a;
    as[a] = false;
  }

  vector<int> dp(N + 1);
  dp[N] = 1;
  dp[N - 1] = as[N - 1] ? 1 : 0;
  for (int i = N - 2; i >= 0; --i) {
    if (as[i])
      dp[i] = dp[i + 1] + dp[i + 2];
    dp[i] %= mod;
  }
  cout << dp[0] << endl;
}

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

using namespace std;
using ll = long long;

ll n;

int main(){
	cin >> n;

	for(ll i = -200; i <= 200; ++i){
		for(ll j = -200; j <= 200; ++j){
			if(i*i*i*i*i - j*j*j*j*j == n){
				printf("%lld %lld\n", i, j);
				return 0;
			}
		}
	}
}

Measured memory_bytes: 3740
#include<stdio.h>
#include<stdlib.h>
#define TABLESIZE 101
int main(){
	int i,a,max=0;
	int *table;
	table=(int *)calloc(TABLESIZE,sizeof(int));
	while(scanf("%d",&a)!=EOF){
		table[a]++;
		if(max<table[a]) max=table[a];
	}
	for(i=0;i<TABLESIZE;i++){
		if(table[i]==max) printf("%d\n",i);
	}
	return 0;
}

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

#define MOD 1000000007
#define PI 3.1415926535897932384626433832795
#define repi(i,a,b) for(int i=a; i<=b; i++) 
#define repd(i,a,b) for(int i=a; i>=b; i--)

const int INF = ~(1<<31);
typedef long long int ll;

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	ll A, B, C;
	cin>>A>>B>>C;
	(B+C-A) > 0 ? cout<<(B+C-A)<<"\n" : cout<<0<<"\n";
	return 0;
}

Measured memory_bytes: 256
if __name__ == '__main__':
    n,blue,red = [int(a.strip()) for a in input().strip().split(' ')]
    length = blue + red
    a= n / length
    sho = int(a)
    amari = n % length

    if amari >= blue:
        chibi = blue
    else:
        chibi = amari
        
    print(sho*blue+chibi)

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

typedef long long ll;
typedef unsigned long long ull;

bool is_prime(ll p) {
  if (p < 2) return false;
  if (p == 2) return true;
  if (p % 2 == 0) return false;
  for (ll i = 3; i <= sqrt(p); i+=2) {
    if (p % i == 0) {
      return false;
    }
  }
  return true;
}

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

  ll x = min(a, b);
  ll ans = 1;

  for (ll i = 1; i*i <= x; ++i) {
    if (x%i == 0) {
      if (is_prime(i)) {
        if (a % i == 0 && b % i == 0) ++ans;
      }

      if (i*i != x) {
        ll j = x / i;
        if (is_prime(j)) {
          if (a % j == 0 && b % j == 0) ++ans;
        }
      }
    }
  }

  cout << ans << endl;

  return 0;
}

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

int main() {
int N;
cin >> N;
  
  if(N % 10 ==2|| N % 10==4|| N %10 ==5|| N%10==7|| N%10==9){
    cout<<"hon"<< endl;
  }else if (N%10==0|| N%10==1|| N%10==6|| N%10==8){
    cout<<"pon"<<endl;
  }else{
    cout<<"bon"<<endl;
  }
}

Measured memory_bytes: 3640
#include<bits/stdc++.h>
#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
#include<iomanip>
#include<queue>
#include<cmath>
#include<stack>
#include <map>
#define ll long long int
#define skip cin>>ws;
#define vll vector<ll> 
#define vb vector<bool>
#define vpll vector<pair<ll,ll>>
#define vvll vector<vector<ll>>
#define pll pair<ll,ll>
#define vs vector<string>
#define vvpll vector<vector<pair<ll, ll>>>
#define pb push_back
#define pob pop_back()
#define MOD (ll)(1e9 + 7)
#define test ll t; cin>>t; while(t--)

using namespace std;

void enter(vll &ar)
{
    ll n = ar.size();

    for(ll i=0;i<n;i++)
    {
        cin>>ar[i];
    }
}

void show(vll &a)
{
    ll n = a.size();

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

void SieveOfErat1sthenes(int n, vll &pri) 
{ 
    vb prime(n+1, true); 
   
    for (int p=2; p*p<=n; p++) 
    { 
        
        if (prime[p] == true) 
        { 
            pri.pb(p);
            
            for (int i=p*p; i<=n; i += p) 
                prime[i] = false; 
        } 
    } 
}

ll mo(ll a)
{
    return a%MOD;
}

bool compare(pll a, pll b)
{
    return a.first>b.first;
}


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

    ll n;
    cin>>n;

    vll ansa(n), ansb(n), ansc(n);
    ll a, b ,c;
    cin>>a>>b>>c;

    ansa[0] = a, ansb[0] = b, ansc[0] = c;

    for(ll i=1;i<n;i++)
    {
        cin>>a>>b>>c;

        ansa[i] = max(ansb[i-1], ansc[i-1]) + a;
        ansb[i] = max(ansa[i-1], ansc[i-1]) + b;
        ansc[i] = max(ansa[i-1], ansb[i-1]) + c;
    }

    ll ans = max(ansa[n-1], max(ansb[n-1], ansc[n-1]));
    cout<<ans<<"\n";

    return 0;
}


Measured memory_bytes: 5544
#include<iostream>
#include<string>
#include<iomanip>
#include<cmath>
#include<vector>
#include<algorithm>

using namespace std;

#define int long long
#define endl "\n"

const long long INF = (long long)1e18;
const long long MOD = (long long)1e9 + 7; 

string yn(bool f){return f?"Yes":"No";}
string YN(bool f){return f?"YES":"NO";}



signed main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);
	
	int N, T;
	int ans = 1;
	
	cin>>N;
	
	for(int i = 0; i < N; i++){
		cin>>T;
		ans = ans/__gcd(ans,T)*T;
	}
	
	cout<<ans<<endl;
	
	return 0;
}

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

using namespace std;

int e[101][101];

int cal(int lx, int rx, int ly, int ry) {
    int ret = 0;
    int soto_min = 100;

    for (int i = lx; i <= rx; i++) {
        for (int j = ly; j <= ry; j++) {
            if (i == lx || i == rx || j == ly || j == ry) {
                soto_min = min(soto_min, e[j][i]);
            }
        }
    }

    for (int i = lx; i <= rx; i++) {
        for (int j = ly; j <= ry; j++) {
            if (i == lx || i == rx || j == ly || j == ry) {
                continue;
            }

            if (e[j][i] >= soto_min) { return 0; }

            ret += (soto_min - e[j][i]);
        }
    }
    return ret;
}

int main() {
    int d, w;

    while (cin >> d >> w) {
        if ( d == 0 && w == 0 ) { break; }

        for (int i = 0; i < d; i++) {
            for (int j = 0; j < w; j++) {
                cin >> e[i][j];
            }
        }
        int ans = 0;
        for (int lx = 0; lx < w-2; lx++) {
            for (int rx = lx+2; rx < w; rx++) {
                for (int ly = 0; ly < d-2; ly++) {
                    for (int ry = 0; ry < d; ry++) {
                        ans = max(ans, cal(lx, rx, ly, ry));
                    }
                }
            }
        }
        cout << ans << endl;
    }

    return 0;
}


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

int main(void){

  long n,p;
  scanf("%ld %ld", &n, &p);
  if (n == 1) {
    printf("%ld\n", p);
    return 0;
  }
  long max = 1;
  long divisor;
  for (int i = 2; pow(i,n) <= p; i++) {
    divisor = pow(i,n);
    if (p%divisor == 0) {
      max = i;
    }
  }
  printf("%ld\n", max);

  return 0;
}

Measured memory_bytes: 256
s = input()
s0 = [s[0]]
index = 1
while index<len(s):
    if s[index]!=s0[-1]:
        s0.append(s[index])
        index+=1
    else:
        if index==len(s)-1:
            break
        else:
            s0.append(s[index:index+2])
            index+=2
print(len(s0))

Measured memory_bytes: 53728
# coding: utf-8
# Your code here!
s = input().split()
n = int(s[0])#price
m = int(s[1])#num of kind

coins = input().split()


min_count = [99999 for i in range(n)]

for j in range(m):
    coins[j] = int(coins[j])
    
for i in range(n):
    buf = 99999
    if i+1 in coins:
        min_count[i] = 1
        continue
    for j in coins:
        if i<j: continue
        buf = min(buf,min_count[i-j]+1)
    min_count[i] = buf
    
print(min_count[n-1])


Measured memory_bytes: 7384
import java.util.*;

public class Main{
//public class abc166_a{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		
		int x = scan.nextInt();
		int n = scan.nextInt();
		int[] p = new int[110];
		for(int i=0; i<n; i++){
			p[scan.nextInt()] = 1;
		}
		
		int px = x;
		int mx = x;
		if(p[x] == 0)System.out.println(x);
		while(p[x] != 0){
			px += 1;
			mx -= 1;
			if(mx > 0){
				if(p[mx] == 0){
					System.out.println(mx);
					break;
				} 
			}else{
				System.out.println(mx);
				break;
			}
			if(p[px] == 0){
				System.out.println(px);
				break;
			} 
		}

	}

}

Measured memory_bytes: 27228
from collections import Counter
def p(n):
    a=[]
    i=2
    while i*i<=n:
        while n%i==0:
            a.append(i)
            n//=i
        i+=1
    if n>1:
        a.append(n)
    return a
N,P=map(int,input().split())
pl=Counter(p(P))
ans=1
for k,v in pl.items():
    ans*=k**(v//N)
print(ans)

Measured memory_bytes: 9384
#include<iostream>
#include<string>
#include<vector>
#include<numeric>
#include<math.h>
#include<algorithm>
using namespace std;

int main() {

	string S;

	cin >> S;

	string ans;
	for (int i = 0; i < S.size(); i++) {
		ans += "x";
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
using namespace std;
#define MAX 2000

int n,m,h,k;
int t[MAX][MAX];
int change[MAX];
int u[MAX];
vector<int> G[MAX],A,B;

void compute(){
  for(int i=0;i<n;i++)t[h][i]=i;
  for(int i=h-1;i>=0;i--){
    for(int j=0;j<n;j++)t[i][j]=t[i+1][j];
    for(int j=0;j<(int)G[i].size();j++){
      int w=G[i][j];
      A.push_back(t[i][w]);
      B.push_back(t[i][w+1]);
      swap(t[i][w],t[i][w+1]);
    }
  }
}

void solve(){  
  compute();
  int mini=0;
  for(int i=0;i<k;i++)mini+=u[t[0][i]];
  for(int i=0;i<(int)A.size();i++){
    swap(u[A[i]],u[B[i]]);
    int sum=0;
    for(int j=0;j<k;j++) sum+=u[t[0][j]];
    mini=min(mini,sum);
    swap(u[A[i]],u[B[i]]);
  }
  cout<<mini<<endl;
}

void init(){
  A.clear();
  B.clear();
  for(int i=0;i<MAX;i++)G[i].clear();
}

int main(){
  while(1){
    cin>>n>>m>>h>>k;
    if(n==0&&m==0&&h==0&&k==0)break;
    h--;
    init();
    for(int i=0;i<n;i++)cin>>u[i];
    for(int i=0;i<m;i++){
      int a,b;
      cin>>a>>b;
      a--,b--;
      G[b].push_back(a);
    }
    solve();
  }
  return 0;
}

Measured memory_bytes: 10808
#include<iostream>
using namespace std;
int main()
{
    int N;
    cin >> N;

    string s,t;
    
    cin >>s;
    cin >>t;
    
    string u;

    for(int i=0;i<N;i++){
        u= u + s[i] + t[i];
    }
    cout << u << endl;

    return 0;

}

Measured memory_bytes: 256
/**
 * @copyright (c) 2020 Daisuke Hashimoto
 */

#include <bits/stdc++.h>
using namespace std;
using Pair = pair<int64_t, int64_t>;
constexpr int64_t kInf = INT64_MAX / 2L;
constexpr int64_t kMod1 = 1000000007LL;
constexpr int64_t kMod2 = 998244353LL;
constexpr int64_t kMod3 = 3571L;

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

  constexpr int64_t kN = 26;
  int64_t D;
  cin >> D;
  vector<int64_t> C(kN + 1, 0);
  for (int64_t c = 1; c <= kN; ++c) {
    cin >> C[c];
  }
  vector<vector<int64_t>> S(D + 1, vector<int64_t>(kN + 1));
  for (int64_t d = 1; d <= D; ++d) {
    for (int64_t c = 1; c <= kN; ++c) {
      cin >> S[d][c];
    }
  }
  vector<vector<int64_t>> last(D + 1, vector<int64_t>(kN + 1, 0));
  vector<int64_t> contests(D + 1);
  for (int64_t d = 1; d <= D; ++d) {
    cin >> contests[d];
  }

  auto Score = [&](const int64_t day) -> int64_t {
    int64_t score = 0;
    for (int64_t d = 1; d <= day; ++d) {
      last[d] = last[d - 1];
      last[d][contests[d]] = d;
      score += S[d][contests[d]];
      for (int64_t c = 1; c <= kN; ++c) {
        score -= C[c] * (d - last[d][c]);
      }
    }
    return score;
  };

  auto OutputResults = [&]() {
    for (int64_t d = 1; d <= D; ++d) {
      cout << contests[d] << endl;
    }
  };

  for (int64_t d = 1; d <= D; ++d) {
    int64_t best_score = INT64_MIN;
    int64_t best_conte = -1;
    for (int64_t c = 1; c <= kN; ++c) {
      contests[d] = c;
      int64_t temp_score = Score(d);
      if (temp_score > best_score) {
        best_score = temp_score;
        best_conte = c;
      }
    }
    contests[d] = best_conte;
  }

  int64_t day_index = 123;
  int64_t contest_index = 2034;
  int64_t ignore_index = 34234;
  int64_t prev_score = Score(D);
  constexpr int64_t kIgnoreBunbo = 5;
  constexpr int64_t kIgnoreBunshi = 0;
  constexpr int64_t kMaxConsecutiveWorse = 3;

  vector<int64_t> best_contests;
  int64_t best_score = INT64_MIN;
  int64_t consecutive_worse = 0;
  vector<int64_t> better_contests;
  for (int64_t i = 0; i < 50000; ++i) {
    const int64_t day_candidate = (day_index % D) + 1;
    const int64_t original_contest = contests[day_candidate];
    const int64_t contest_candidate = (contest_index % kN) + 1;
    contests[day_candidate] = contest_candidate;
    const int64_t temp_score = Score(D);
    if (temp_score > prev_score) {
      // KEEP
      consecutive_worse = 0;
      better_contests = contests;
      if (temp_score > best_score) {
        best_score = temp_score;
        best_contests = contests;
      }
    } else if (ignore_index <= kIgnoreBunshi && temp_score > prev_score * 0.97 &&
               consecutive_worse <= kMaxConsecutiveWorse) {
      // KEEP
      ++consecutive_worse;
    } else {
      contests[day_candidate] = original_contest;
    }
    if (temp_score < best_score * 0.9) {
      contests = better_contests;
    }
    if (temp_score < best_score * 0.5) {
      contests = best_contests;
    }
    day_index = day_candidate + kMod1;
    contest_index = contest_candidate + kMod2;
    ignore_index += kMod3;
    ignore_index %= kIgnoreBunbo;
  }

  contests = best_contests;
  OutputResults();
  return 0;
}


Measured memory_bytes: 3844
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <cstring>
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <cmath>
#include <numeric>
#include <float.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef unsigned long long ll;

int main(){
int N,M; cin >> N >> M;
vector<vector<int>> A(30,vector<int> (30));

rep(i,N) {
	int K;cin >> K;
	rep(j,K){
		cin >> A[i][j];
	}
}
vector<int> S(M,0);
rep(i,N){
	rep(j,A[i].size()){
		rep(k,M){
			if(A[i][j] == k+1){
				S[k]++;
			}
		}
	}
}
int cnt = 0;
rep(i,M){
	if(S[i] == N){
		cnt++;
	}
}
cout << cnt << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstring>
#include <vector>

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

using namespace std;

int main()
{
	int n,m;
	string f[101];
	while(true)
	{
		cin >> n >> m;
		if(n == 0 && m == 0) break;

		rep(i,n)
		{
			cin >> f[i];
		}

		int i = 0, j = 0;
		int memo[101][101];
		memset(memo,0,sizeof(memo));
		while(f[i][j] != '.' && memo[i][j] == 0)
		{
			memo[i][j]++;

			if(f[i][j] == '>')
			{
				j++;
			}
			else if(f[i][j] == '<')
			{
				j--;
			}
			else if(f[i][j] == 'v')
			{
				i++;
			}
			else if(f[i][j] == '^')
			{
				i--;
			}
		}

		if(memo[i][j] == 0)
		{
			cout << j << " "  << i << endl;
		}
		else
		{
			cout << "LOOP" << endl;
		}


	}
	return 0;
}

Measured memory_bytes: 1280
#include <iostream>
#include <map>
#include <vector>
#include <stack>
#include <queue>
#include <algorithm>

using namespace std;

int main() {
	int h, n;
	int sum = 0;
	cin >> h >> n;
	for (int i = 0; i < n; ++i) {
		int a;
		cin >> a;
		sum += a;
	}
	if (h <= sum)
		cout << "Yes";
	else
		cout << "No";
	return 0;
}


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

def gcd(x, y):
    while y != 0:
        x, y = y, x%y
    return x

l = (n * m) // gcd(n, m)

if S[::l//m] == T[::l//n]:
    print(l)
else:
    print(-1)

Measured memory_bytes: 3316
#include <iostream>

using namespace std;

long long factorial(long i){
    long long threshold = 1000000007;
    if(i == 1)
        return 1;
    else{
        long long tmp = i*factorial(i-1);
        while (tmp >= threshold){
            tmp -= threshold;
        }
        return tmp;
    }
}

int main(){
    long long n; cin >> n;
    long long ans = 1;
    cout << factorial(n) << endl;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
template<class T> inline bool chmin(T&a, T b){if(a > b){a = b; return true;}else{return false;}}
template<class T> inline bool chmax(T&a, T b){if(a < b){a = b; return true;}else{return false;}}
#define ll long long
#define double long double
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
#define mod (ll)(1e9+7)
#define inf (ll)(3e18+7)
#define pi (double) acos(-1.0)
#define P pair<int,int>
#define PiP pair<int,pair<int,int>>
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
using namespace std;

const int MAX = 710000;
long long fac[MAX], finv[MAX], inv[MAX];

void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int 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(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
}

int main() {
    ll n, k, ans = 0;
    cin >> n >> k;
    COMinit();
    for(int i = 0; i <= min(n-1, k); i++){
        ll now = COM(n, i) * COM(n-1, i) % mod;
        ans = (ans + now) % mod;
    }
    cout << ans << endl;
}

Measured memory_bytes: 16896
n = int(input())
s = list(input())

c0 = 0
c1 = 0
z0 = 0
z1 = 0
for i in range(n):
    if s[i] == "(":
        c0 += 1
    else:
        if c0 > 0:
            c0 -= 1
        else:
            c1 += 1
z0 = c1
s = s[::-1]
c0 = 0
c1 = 0
for i in range(n):
    if s[i] == ")":
        c0 += 1
    else:
        if c0 > 0:
            c0 -= 1
        else:
            c1 += 1
z1 = c1
s = s[::-1]
ans = ["("]*z0 + s + [")"]*z1
print("".join(ans))

Measured memory_bytes: 9156
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define all(a) (a).begin(), (a).end()


int main() {
    string s;
    cin >> s;
    if(s[1]=='9' or s[0] == '9') cout << "Yes" << endl;
    else cout << "No" << endl;
}


Measured memory_bytes: 256
fn read_stdin() -> String {
    use std::io::Read;
    let mut input = String::new();
    std::io::stdin().read_to_string(&mut input).unwrap();
    input
}

fn scan<'a, I: Iterator<Item = &'a str>, T: std::str::FromStr>(tokens: &mut I) -> T {
    tokens.next().unwrap().parse().ok().unwrap()
}

fn main() {
    let input = read_stdin();
    let tokens = &mut input.split_whitespace();
    let s: String = scan(tokens);
    if s == "Sunny" {
        println!("Cloudy");
    } else if s == "Cloudy" {
        println!("Rainy");
    } else {
        println!("Sunny");
    }
}


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

int main() {
  int N;
  int R;
  cin >> N;
  for (int i = 0; i < N; i++) {
    int l, r;
    cin >> l >> r;
    R += (r - l + 1);
  }
  cout << R << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <string>
#include <cstring>
#include <map>

#define ll long long
#define REP(i,n) for(int i = 0; i < n; i++)
#define PI 3.141592653589

using namespace std;

int gcd(int a, int b){return (a % b)? gcd(b, a % b) : b;}
int lcm(int a, int b){return a * b / gcd(a, b);}

void solve_146B(){
    char s[10010];
    int n;
    cin >> n >> s;

    int length = strlen(s);

    for(int i = 0; i < length; i++){
        int x = s[i] - 'A'; // Aから数えて何番目か
        x = (x + n) % 26;

        cout << (char)('A' + x);
    }

}

int main(void){
    solve_146B();
    
    return 0;
}

Measured memory_bytes: 256