akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;

using ll = long long;

const long long MOD = 1e9 + 7;
const int INF = 1e9 + 7;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, K;
    cin >> N >> K;
    vector<bool> goodnum(10, true);
    for (int i = 0; i < K; ++i) {
        int d;
        cin >> d;
        goodnum[d] = false;
    }
    int ans = 0;
    for (int i = N; i <= 10 * N; ++i) {
        bool ok = true;
        int x = i;
        while (x > 0) {
            if (!goodnum[x % 10]) ok = false;
            x /= 10;
        }
        if (ok) {
            ans = i;
            break;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(){
    int s, rh, rm, rs;
    scanf("%d", &s);
    rh = s / 3600;
    rm = (s - rh*3600) / 60;
    rs = s - (rh*3600 + rm*60);
    printf("%d:%d:%d\n", rh, rm, rs);
    return 0;
}

Measured memory_bytes: 2724
A,B = map(int,input().split())
ans = 0
for i in range(A,B+1):
	cnt = 0
	for j in range(5):
		if str(i)[j] == str(i)[4-j]:
			cnt = cnt + 1
	if cnt == 5:
	    ans = ans + 1
print(ans)

Measured memory_bytes: 3060
#include <iostream>

using namespace std;

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

int64_t lcm (int64_t a, int64_t b) {
    int64_t g = gcd(a, b);
    return a / g * b;
}

int main () {

    int A, B;
    cin >> A >> B;

    cout << lcm(A, B) << endl;

    return 0;
}

Measured memory_bytes: 256
N, K, Q = map(int, input().split())
N_list = [0 for _ in range(N)] 

for i in range(Q):
    A = int(input())
    N_list[A-1] += 1
    
for point in N_list:
    final_point = point + (K-Q)
    if final_point > 0:
        print('Yes')
    else:
        print('No')

Measured memory_bytes: 4680
/******************************************************************************

                            Online Java Compiler.
                Code, Compile, Run and Debug java program online.
Write your code in this editor and press "Run" button to execute it.

*******************************************************************************/

import java.io.*;
import java.util.*;
public class Main
{
    
    
    
    public static int func(ArrayList <Integer>ls[], int j,int dp[])
    {
        int temp=0;
        int ans=0;
        
        if(ls[j]==null)
        {
            return 0;
        }
         
        if( dp[j]!=0)
        {
            return dp[j];
        }
       
        
        else {
            for(int k =0;k<ls[j].size();k++)
            {
            
            
            temp= 1+ func(ls,ls[j].get(k),dp);
            
           // dp[ls[j].get(k)]=temp;
            ans=Math.max(temp,ans);
            
            }
        }
       // vis[j]=1;
        return dp[j]=ans;
        
        
    }
    
    
	public static void main(String[] args) throws Exception {
	//	System.out.println("Hello World");
		
		int N,M;
		BufferedReader br =new BufferedReader(new InputStreamReader(System.in));
	String s=br.readLine();
	String ss[]=s.split(" ");
	N=Integer.parseInt(ss[0]);
	M=Integer.parseInt(ss[1]);
	int x=0,y=0;
	int ans=0;

	int dp[]=new int [N+1];
	//Arrays.fill(dp,0);
	//int dp[][]=new int[N+1][N+1];
	ArrayList<Integer>ls[]=new ArrayList[N+1];
	for(int i=0;i<M;i++)
	{
	    s=br.readLine();
	    ss=s.split(" ");
	 x=Integer.parseInt(ss[0]);
	y=Integer.parseInt(ss[1]);
	 if(ls[x]==null)
	 {
	     ls[x]=new ArrayList();
	 }
	    ls[x].add(y);
	    
	}
	for(int i=1;i<=N;i++)
	{
	 if(dp[i]!=0)
	 {
	     ans=Math.max(ans,dp[i]);
	     continue;
	 }
	 if(ls[i]!=null)
	 {
	     //vis[i]=1;
	     for(int j=0;j<ls[i].size();j++)
	     {
	      int temp =1+func(ls,ls[i].get(j),dp);
	      dp[i]=Math.max(dp[i],temp);
	      
	     }
	      ans=Math.max(ans,dp[i]);
	 }
	   
	}
	System.out.println(ans);
   
	}
}


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

int main()
{
  string str;
  string tmp = "CODEFESTIVAL2016";

  cin >> str;
  int ct  = 0;
  for (int i = 0; i < str.size(); i++){
    if (str[i] != tmp[i]) ct++;
  }

  cout << ct << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
#include<map>
#include<algorithm>
#include<set>
#include<iomanip>
#define rep(i,n) for(int i = 0;i < n;i++)
#define req(i,n) for(int i = 1; i<=n;i++)
#define rrep(i,n) for(int i = n-1;i >=0;i--)
#define ALL(a) a.begin(),a.end()
#define PI  acos(-1)
using namespace std;
template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T& val) {
    std::fill((T*)array, (T*)(array + N), val);
}
typedef long long int ll;
typedef long double ld;
const int MOD = 1e9 + 7;
int dx[4] = { 0,0,1,-1 }, dy[4] = { 1,-1,0,0 }, sum = 0, h, w;
int main() {
    int n, x, y, z,a,b=0,c; cin >> n; vector<int> t(n, 0);
    cin >> x; rep(i, x) {
        cin >> a; t[a - 1]++;
    }cin >> y; rep(i, y) {
        cin >> a; t[a - 1] += 2;
    }cin >> z; rep(i, z) {
        cin >> a; t[a - 1] += 4;
    }rep(i, n) {
        if ((t[i] % 2 == 0 || (t[i] & 2)) && (t[i] & 4)) b++;
    }cout << b << endl;
}


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


#define fi first
#define se second
#define all(x) (x).begin() , (x).end()
#define rall(x) (x).rbegin() , (x).rend()
#define pb push_back
#define len(x) (int)(x).size()
typedef long long ll;
typedef long double ld;
using namespace std;
const int N = 3e5 + 10 , mod = (int)1e9 + 7;
int fact[N] , inv[N];
int binpow(int a , int b){
    if(b == 0)return 1;
    int ans = binpow(a , b >> 1);
    ans = (1ll * ans * ans) % mod;
    if(b & 1)ans = (1ll * ans * a) % mod;
    return ans;
}
int prec(){
    fact[0] = 1;
    for(int i = 1; i < N; ++i)
        fact[i] = (1ll * fact[i - 1] * i) % mod;
    inv[N - 1] = binpow(fact[N-1] , mod-2);
    for(int i = N - 2; i >= 0; --i)
        inv[i] = (1ll * inv[i + 1] * (i + 1)) % mod;
}
int C(int n , int k){
    int ans = (1ll * (1ll * fact[n] * inv[k]) % mod * inv[n-k])%mod;
    return ans;
}

signed main(){
    prec();
    int n , m , a , b;cin >> n >> m >> a >> b;
    int ans = 0;
//    cerr << inv[1] << ' ' << inv[0] << '\n';
    assert((1ll * inv[0] * fact[0]) % mod == 1);
//    cerr << fact[1] << ' ' << inv[1] << ' ' << inv[0] << '\n';
    for(int j = b; j < m; ++j){
//        cerr << C(n-a-1+j,j) << '\n';
        ans += (1ll * C(n - a - 1 + j , j) * C(a - 1 + m - 1 - j , a - 1))% mod;
        if(ans >= mod)ans-=mod;
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 2560
#include<bits/stdc++.h>
#define rep(i,N) for(int i=0;i<(N);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int inf = 1e9;
typedef long long ll;
typedef pair<ll,int> P;
typedef set<int> S;
ll n;
int main(){
    string s,t;
    while(1){
        bool ok=true;
        s.clear();
        t.clear();
        getline(cin,s); //改行文字まで読み込む
        /*char star;
        cin>>star;
        if(star=='.') break;
        s[0]=star;
        */
        /*while(s[s.size()-1]!='.'){
            cin>>t;
            //cout<<"t:"<<t<<endl;
            s+=t;
        }*/
        if(s=="."){
           // cout<<"break"<<endl;
            //cout<<s<<" "<<t<<endl;
            return 0;
        }
        stack<char> sc;
        //cout<<s<<endl;
        for(int i = 0;i < s.size(); i++){
            if(s[i]=='(' || s[i]=='[') sc.push(s[i]);
            else if(s[i]==')' || s[i]==']'){
                if(sc.empty()) {
                    //cout<<"here1"<<endl;
                    ok = false;
                    break;
                }
                else if(s[i]==')' && sc.top()!='('){

                    //cout<<"here2"<<endl;
                    //cout<<"s:"<<s[i]<<sc.top()<<endl;
                    ok = false;
                    break;
                }
                else if(s[i]==']' && sc.top()!='['){
                    //cout<<"here3"<<endl;
                    ok = false;
                    break;
                }
                sc.pop();
            }
        }
        //cout<<"output"<<endl;
        //cout<<"s:"<<s<<endl;
        if(ok && sc.empty()) cout<<"yes"<<endl;
        else cout<<"no"<<endl;
    }
    return 0;
}


Measured memory_bytes: 3144
#include <bits/stdc++.h>
#ifdef ONLINE_JUDGE
#define LLD "%I64d"
#else
#define LLD "%lld"
#endif
#define fu(a,b,c) for(int a=b;a<=(int)c;++a)
#define fd(a,b,c) for(int a=b;a>=(int)c;--a)
#define cu(a,b,c) for(int a=b;a<(int)c;++a)
#define cd(a,b,c) for(int a=(b)-1;a>=(int)c;--a)
#define gcd(a,b) __gcd(a,b) 
#define pii pair<int,int>
#define pll pair<long long,long long>
#define all(a) a.begin(),a.end()
#define F first
#define S second
#define pb push_back
#define pf push_front
#define MOD 1000000007
#define MAXN 52
#define MAXH 20
#define MAXM 52
#define INF 100000000
#define ll long long
#define ull unsigned long long
#define RNG rng mt19937(time(NULL))
#define udist(a,b) uniform_int_distribution<uint32_t> distribution(a,b)
#define max3(a,b,c) max(a, max(b, c))
#define min3(a,b,c) min(a, min(b, c))
#define gmax(a,b) a = max(a, b)
#define gmin(a,b) a = min(a, b)
#define whatis(x) cerr << #x << " is " << x << endl;
#define fast_io() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define PI 3.1415926535897932384626433
using namespace std;

int main(){
	fast_io();
	ll n,a,b;
	cin >> n >> a >> b;
	vector<int> v(n);
	cu(i,0,n)cin >> v[i];	
	ll ans = 0;
	cu(i,0,n-1){
		ans += min((v[i+1] - v[i]) * a, b);
	}
	cout << ans << '\n';
}



Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
template <class T>
inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}

typedef long long ll;
ll MOD = 1000000007;

 // a^p
 // 2^3 = 2 * 2^2
 // 2^2 = 2 * (2^1)
 // 2^1 = 2
 ll modpow(ll a, ll p, ll mod) {
   if (p == 0) return 1;

   if (p % 2 == 0) {
     ll half = modpow(a, p/2, mod) % mod;
     return half * half % mod;
   } else {
     return a * modpow(a, p - 1, mod) % mod;
   }
 }

 // nCa を求める
 ll modCombination(ll n, ll a, ll mod) {
   if (n - a < a) {
     return modCombination(n, n - a, mod);
   }

   ll denominator = 1; // 分母
   ll numerator = 1; // 分子

   for (ll i = 0; i < a; i++) {
     denominator *= a - i;
     numerator *= n - i;
     denominator %= mod;
     numerator %= mod;
   }

   return numerator * modpow(denominator, mod - 2, mod) % mod;
 }

int main() {

  ll X, Y;
  cin >> X >> Y;

  if ((X + Y) % 3 != 0) {
    cout << 0 << endl;
    return 0;
  }

  ll ans = 0;
  // X = a + 2b;
  // Y = 2a + b;
  // (i + 1, j + 2) という動き方を全探索
  for (ll a = 0; a < X + 1; a++) {
    if ((Y - 2 * a) != ((X - a)/2)) continue;

    ll b = Y - 2 * a;
    ans += modCombination(a + b, a, MOD);
  }

  cout << ans % MOD << endl;
  return 0;
}


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

public class Hello
{
    private const int MOD_N = 1000000000 + 7;

    public static void Main()
    {
        var r = int.Parse(Console.ReadLine());

        Console.WriteLine(3 * r * r);
    }

    private static int GCD(int a, int b) => a > b ? GCD_impl(a, b) : GCD_impl(b, a);
    private static int GCD_impl(int a, int b) => b == 0 ? a : GCD_impl(b, a % b);
    private static long LCM(int a, int b) => (long)a * b / GCD(a, b);

    private static int Comb(int m, int n)
    {
        var t = m - n;
        if (n > t)
            n = t;

        long numerator = 1;
        for (int i = 0; i < n; ++i)
        {
            numerator *= m - i;
            numerator %= MOD_N;
        }
        long denominator = 1;
        for (; n != 0; --n)
        {
            denominator *= n;
            denominator %= MOD_N;
        }

        var inv_denominator = ModInv((int)denominator, MOD_N);
        var ret = (int)(numerator * inv_denominator % MOD_N);

        return ret >= 0 ? ret : ret + MOD_N;
    }

    private static int ModInv(int a, int m)
    {
        int b = m, x = 1, y = 0;
        while (b != 0)
        {
            var t = a / b;
            a -= t * b;
            Swap(ref a, ref b);
            x -= t * y;
            Swap(ref x, ref y);
        }
        x %= m;
        return x >= 0 ? x : x + m;
    }

    private static void Swap<T>(ref T a, ref T b)
    {
        var t = a;
        a = b;
        b = t;
    }
}


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

int main() {
    int N;
    cin>>N;
    vector<ll> a(N),b(N);
    ll suma = 0, sumb = 0;
    rep(i,N){
        cin>>a[i];
        suma += a[i];
    }
    rep(i,N){
        cin>>b[i];
        sumb += b[i];
    }
    if(a!=b&&suma>=sumb){
        cout<<"No"<<endl;
        return 0;
    }
    ll cnta = 0;
    ll cntb = 0;
    rep(i,N){
        if(a[i]==b[i])continue;
        else if(a[i]<b[i]){
            if(b[i]-a[i]%2 == 0){
                cnta += (b[i]-a[i])/2;
            }
            else{
                cnta += (b[i]-a[i])/2 + 1;
                cntb += 1;
            }
        }
        else{
            cntb += a[i]-b[i];
        }
    }
    if(cnta-cntb<0){
        cout<<"No"<<endl;
    }
    else{
        cout<<"Yes"<<endl;
    }
}

Measured memory_bytes: 384
#ifndef BZ
#pragma GCC optimize "-O3"
#endif
#include <bits/stdc++.h>

#define FASTIO
#define ALL(v) (v).begin(), (v).end()
#define rep(i, l, r) for (int i = (l); i < (r); ++i)

#ifdef FASTIO
#define scanf abacaba
#define printf abacaba
#endif

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

using namespace std;


/*
ll pw(ll a, ll b) {
	ll ans = 1; while (b) {
		while (!(b & 1)) b >>= 1, a = (a * a) % MOD;
		ans = (ans * a) % MOD, --b;
	} return ans;
}
*/

const int MAXN = 220000;

int n, k;

vector<int> go[MAXN];

vector<pair<ll, int>> vv;
ll ans[MAXN];
ll dp[MAXN];

int main() {
#ifdef FASTIO
	ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
#endif
	cin >> n >> k;
	for (int i = 0; i < n; ++i) {
		int c;
		ll v;
		cin >> c >> v;
		v *= 2;
		go[c].push_back(v);
	}
	for (int i = 0; i < MAXN; ++i) {
		if (go[i].empty())
			continue;
		sort(ALL(go[i]));
		ll sum = go[i].back();
		go[i].pop_back();
		sum += go[i].back();
		go[i].pop_back();
		sum /= 2;
		vv.emplace_back(sum, i);
	}
	sort(ALL(vv));
	reverse(ALL(vv));
	multiset<int> ss;
	for (int i = 0; i <= n; ++i)
		ans[i] = -2;
	int cur = 0;
	ll now = 0;
	dp[vv.size() - 1] = -1;
	for (int i = (int)vv.size() - 2; i >= 0; --i) {
		int k = vv[i + 1].second;
		dp[i] = dp[i + 1];
		if (!go[k].empty())
			dp[i] = max(dp[i], go[k].back() + vv[i + 1].first * 2);
	}
	multiset<ll> tak;
	if (dp[0] != -1)
		ans[3] = max(ans[cur], dp[0]);
	for (int i = 0; i < vv.size(); ++i) {
		cur += 2;
		now += 2 * vv[i].first;
		for (ll j: go[vv[i].second])
			ss.insert(j);
		if (!tak.empty()) {
			ll x = *tak.begin();
			ans[cur - 1] = max(ans[cur - 1], now - x);
			if (dp[i] != -1)
				ans[cur - 1 + 3] = max(ans[cur - 1 + 3], now - x + dp[i]);
		}
		while (true) {
			ans[cur] = max(ans[cur], now);
			if (dp[i] != -1)
				ans[cur + 3] = max(ans[cur + 3], now + dp[i]);
			if (!ss.empty()) {
				ll x = *ss.rbegin();
				ans[cur + 1] = max(ans[cur + 1], now + x);
				if (dp[i] != -1)
					ans[cur + 4] = max(ans[cur + 4], now + x + dp[i]);
			}
			if (!ss.empty() && (i + 1 == vv.size() || *ss.rbegin() > vv[i + 1].first)) {
				ll x = *ss.rbegin();
				ss.erase(ss.find(x));
				tak.insert(x);
				now += x;
				cur += 1;
			}
			else {
				break;
			}
		}
	}
	for (int i = 1; i <= n; ++i)
		cout << ans[i] / 2 << "\n";
	return 0;
}




Measured memory_bytes: 20608
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define llu unsigned long long int
#define all(v) v.begin(),v.end()
#define sd size()
#define pi pair<ll,ll>
#define lb(a,b) lower_bound(all(a),b) - a.begin()
#define ub(a,b) upper_bound(all(a),b) - a.begin()
#define sp( a, b)   cout<<setprecision(b)<<a<<" ";
#define mod 1000000007
#define d2 vector<vector<ll>>
#define d1 vector<ll>
#define d1pi vector<pi>
#define d1b vector<bool>
#define p(x) cout<<x;
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL);
const ll N = 2e5+100;
d1 g[N];
vector<bool> vis(N,0);
void un_add_edge(ll a,ll b)
{
        g[a].pb(b);
        g[b].pb(a);
}
void add_edge(ll a,ll b)
{
        g[a].pb(b);
      
}
ll lcm(ll a,ll b)
{
        return (a*b)/__gcd(a,b);
}
int main()
{
        fast;
        ll n;
        cin>>n;
        d1 v(n,0),dp(n,1e18);    
        for(ll i=0;i<n;i++)
        {
                cin>>v[i];
        }
        dp[0]=0;
        for(ll i=0;i<n;i++)
        {   
                ll k =0;
                if(i-1>=0)
                {
                        dp[i]=dp[i-1]+abs(v[i]-v[i-1]);
                    
                }
                if(i-2>=0)
                {
                        if(dp[i]>dp[i-2]+abs(v[i]-v[i-2]))
                        {
                                dp[i]=dp[i-2]+abs(v[i]-v[i-2]);
                                
                        }
                }
                
                    
        }
      
        cout<<dp[n-1]<<" ";
        
}



Measured memory_bytes: 6528
#include <bits/stdc++.h>
typedef long long int ll;
typedef long double ld;
using namespace std;
const long long int INF = 1e18;
const long long int mod = 1e9+7;

typedef pair<ll, ll> pairs;
typedef vector<pairs> p;

struct Edge{
    ll to, weight;
    Edge(ll t, ll w) : to(t), weight(w){}
};
using graph = vector<vector<ll>>;
using Graph = vector<vector<Edge>>;


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

ll lcm(ll a, ll b){
    return a / gcd(a, b) * b;
}

ll keta(ll N){
    int tmp{};
    while( N > 0 ){
        tmp += ( N % 10 );
        N /= 10;
    }
    N = tmp;
    return N;
}

// 回文
bool kai(string S){
    bool flag = true;
    for(ll i=0;i<S.size()/2;++i){
        if(S[i] != S[S.size()-i-1]){
            flag = false;
            break;
        }
    }
    return flag;
}
// ---------------------------------------------

int main(){
    ll n, m;
    cin>>n>>m;
    vector<bool> t(n+1, true);
    for(ll i=0;i<m;++i){
        ll a;
        cin>>a;
        t[a] = false;
    }
    vector<ll> dp(n+1);
    dp[0] = 1;
    for(ll i=0;i<n;++i){
        for(ll j=i+1;j<=min(n, i+2);++j){
            if(t[j] == true){
                dp[j] += dp[i];
                dp[j] %= mod;
            }
        }
    }
    ll ans = dp[n];
    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 1024
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    String s = sc.next();
    int ans = 0;
    for (int i = 0; i < n; i++) {
      int count = 0;
      for (char c = 'a'; c <= 'z'; c++) {
        boolean left = false, right = false;
        for (int j = 0; j < i; j++) {
          if (s.charAt(j) == c)
            left = true;
        }
        for (int j = i; j < n; j++) {
          if (s.charAt(j) == c)
            right = true;
        }
        if (left && right)
          count++;
      }
      if(count > ans)
        ans = count;
    }
    System.out.println(ans);
  }

}


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


int main()
{
	int a, b, c, n = 0;
	cin >> a >> b >> c;

	for (int i = a;i <= b;i++) {
		if (c%i == 0) {
			n++;
		}
	}

	cout << n << endl;

    return 0;
}



Measured memory_bytes: 3084
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <list>
#include <set>
#include <numeric>

#include <map>
#include <math.h>
#include <iomanip>
#include <stack>
#include <queue>
#include <bitset>

#define INF 100100100

typedef long long int llint;

using namespace std;

typedef pair<int, int>Pii;

int main() {
	int a, b, c;
	cin >> a >> b >> c;
	int pack[3] = { a,b,c };
	for (int i = 0; i < 3; i++) {
		for (int j = 0; j < 3; j++) {
			if (j == i)continue;
			for (int k = 0; k < 3; k++) {
				if (k == i || k == j)continue;
				if (pack[i] + pack[j] == pack[k]) {
					puts("Yes");
					return 0;
				}
			}
		}
	}
	puts("No");
	return 0;
}

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

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

  return gcd(b,a%b);
}

int main(){
  while(true){
    int a,b;

    cin>>a>>b;

    if(cin.eof())
    break;

    int g=gcd(a,b);
    cout<<g<<' '<<a/g*b<<endl;
  }

  return 0;
}



Measured memory_bytes: 3012
#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define pi acos(-1)
#define mod 1000000007
#define all(x) x.begin(), x.end()
using namespace std;

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

    int tc = 1;
    //cin >> tc;
    while(tc--){
        int n;
        cin >> n;
        int ans = 0;
        for(int i = 1; i <= n; i++){
            int x;
            cin >> x;
            if(i&1 && x&1){
                ans++;
            }
        }
        cout << ans << endl;
    }
}



Measured memory_bytes: 3632
parseInt(x::String) = parse(Int, x)
parseInt(x::SubString{String}) = parse(Int, x)
parseInt(x::Char) = parse(Int, x)
parseInt(x::Float64) = trunc(Int, x)
parseFloat(x::String) = parse(Float64, x)
parseFloat(x::Int) = trunc(Float64, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)

function main()
    r=parseInt(readline())
    ans="AGC"
    if r<1200
        ans="ABC"
    elseif r<2800
        ans="ARC"
    end
    println(ans)
end
main()

Measured memory_bytes: 108028
#include <bits/stdc++.h>
using namespace std;
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define mp(a,b) make_pair((a),(b))
#define pb(a) push_back((a))
#define all(x) (x).begin(),(x).end()
#define uniq(x) sort(all(x)),(x).erase(unique(all(x)),end(x))
#define fi first
#define se second
#define dbg(...) _dbg(#__VA_ARGS__",", __VA_ARGS__)
void _dbg(string){cout<<endl;}
template<class H,class... T> void _dbg(string s,H h,T... t){int l=s.find(',');cout<<s.substr(0,l)<<" = "<<h<<", ";_dbg(s.substr(l+1),t...);}
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

#define INF 1120000000
#define long long long // for codeforces

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

  if(a[a.size()-1]==b[0] && b[b.size()-1]==c[0]) cout << "YES" << endl;
  else cout << "NO" << endl;

  return 0;
}


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

int main(){

	string code;

	while( getline(cin, code) ){

		for( int j=0;j<=26;j++ ){
			for( int i=0;i<code.size();i++ ){
				if( code[i] >= 'a' && code[i] <= 'z' ){
					code[i] += 1;
					if(code[i]=='z'+1)code[i]='a';
				}
			}
			if(code.find("the ") != -1 || code.find("this") != -1 || code.find("that") != -1)
				break;		
		}
		cout << code << endl;
	}
	return 0;

}

Measured memory_bytes: 1176
#include <bits/stdc++.h>
#define DAU  ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define PLEC return 0;
using namespace std;
using VI  = vector<int>;
VI t, res, cnt, g;
inline int Find(int x) {
    if (x == t[x])
        return x;
    return t[x] = Find(t[x]);
}
int n, m, k, x, y, rx, ry;
int main() {
    DAU
    cin >> n >> m >> k;
    t = res = cnt = g = VI(n + 1);
    for (int i = 1; i <= n; ++i)
        t[i] = i, cnt[i] = g[i] = 1;
    for (int i = 1; i <= m; ++i) {
        cin >> x >> y;
        rx = Find(x), ry = Find(y);
        if (rx != ry)
            t[ry] = rx, cnt[rx] += cnt[ry], cnt[ry] = 0;
        ++g[x], ++g[y];
    }
    for (int i = 1; i <= n; ++i)
        res[i] = cnt[Find(i)] - g[i];
    for (int i = 1; i <= k; ++i) {
        cin >> x >> y;
        if (Find(x) == Find(y))
            --res[x], --res[y];
    }
    for (int i = 1; i <= n; ++i)
        cout << res[i] << ' ';
    PLEC
}

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

using namespace std;


 int main(){

 int r,c;
 cin>>r>>c;

 int area = 1*c;
 int area1 = 1*r;

 int excu = area+area1-1;

 cout<<r*c-excu<<endl;

 return 0;
 }



Measured memory_bytes: 256
use std::io::{stdin, Read, StdinLock};
use std::str::FromStr;

#[allow(dead_code)]
struct Scanner<'a> {
    cin: StdinLock<'a>,
}
#[allow(dead_code)]
impl<'a> Scanner<'a> {
    fn new(cin: StdinLock<'a>) -> Scanner<'a> {
        Scanner { cin: cin }
    }

    fn read<T: FromStr>(&mut self) -> Option<T> {
        let token = self.cin.by_ref().bytes().map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>();
        token.parse::<T>().ok()
    }

    fn input<T: FromStr>(&mut self) -> T {
        self.read().unwrap()
    }
}
#[allow(dead_code)]
type Graph = Vec<Vec<(usize, i64)>>;
fn main() {
    let cin = stdin();
    let cin = cin.lock();
    let mut sc = Scanner::new(cin);

    let (n, m): (i64, i64) = (sc.input(), sc.input());


    let mut graph: Graph = vec![vec![]; n as usize];
    for _ in 0..m {
        let (mut l, mut r, d): (i64, i64, i64) = (sc.input() , sc.input(), sc.input());
        l -= 1; r -=1;
        graph[l as usize].push((r as usize, d));
        graph[r as usize].push((l as usize, -d));
    }
    println!("{}", if dfs(&graph) { "Yes"} else { "No" });
}

fn dfs(graph: &Graph) -> bool {
    let mut dist :Vec<Option<i64>> = vec![None; graph.len()];
    let mut stack = vec![];

    for i in 0..graph.len() {
        if dist[i] != None { continue; }

        dist[i] = Some(0);
        stack.push((i as usize, 0 as usize));
        while let Some((cur, index)) = stack.pop() {
            if index == graph[cur].len() { continue; }

            stack.push((cur, index + 1));
            let (next, d) = graph[cur][index];

            if dist[next] != None {
                if dist[cur].unwrap() as i64 + d
                    != dist[next].unwrap() as i64 { return false; }
            } else {
                dist[next] = Some(dist[cur].unwrap() as i64 + d as i64);
                stack.push((next, 0));
            }
        }
    }
    true
}


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

int main()
{
  int N, D;
  int res=0;
  cin >> N >> D;

  res = N / (D*2+1);
  if (N % (D*2+1)>0) res++;
  
  cout << res << endl;
}

Measured memory_bytes: 256
def main():
    N, M = map(int, input().split())
    x = list(map(int, input().split()))
    
    if N >= M:
      print(0)
    else:
      x.sort()
      l_list = [x[i+1] - x[i] for i in range(M - 1)]
      l_list.sort(reverse=True)
      print(sum(l_list[N - 1:]))


if __name__ == '__main__':
    main()

Measured memory_bytes: 13960
#include<stdio.h>
#include<math.h>
int main()
{
	int a,b,c=1,d,e;
	scanf("%d%d",&a,&b);
	e=b;
	while (b!=0)
	{
		c*=10;b=b/10;
	}
	a=a*c+e;
	d=sqrt(a);
	if (d*d==a)
	printf("Yes\n");
	else
	printf("No\n");
	return 0;
}

Measured memory_bytes: 128
n = int(input())
p = list(map(int, input().split()))

count = 0

for i in range(1, n-1):
    if (p[i-1] < p[i] < p[i+1]) or (p[i-1] > p[i] > p[i+1]):
        count += 1
        
print(count)


Measured memory_bytes: 2940
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef pair<int, int> PI;
int main() {
  int N, T;
  cin >> N >> T;
  vector<PI> A(N + 1);
  rrep(i, N) {
    cin >> A.at(i).first;
    cin >> A.at(i).second;
  }
  sort(A.begin(), A.end());
  VVI dp(N + 1, VI(T)); // dp.at(i) //the number of selected goods=i;
  rrep(i, N) {
    rep(j, min(A.at(i).first, T)) { dp.at(i).at(j) = dp.at(i - 1).at(j); }
    for (int j = A.at(i).first; j < T; j++) {
      dp.at(i).at(j) = max(dp.at(i - 1).at(j),
                           dp.at(i - 1).at(j - A.at(i).first) + A.at(i).second);
    }
  }
  int maxsat = 0;
  rrep(i, N - 1) {
    maxsat = max(maxsat, dp.at(i).at(T - 1) + A.at(i + 1).second);
  }
  cout << maxsat << endl;
  return 0;
}


Measured memory_bytes: 35584
from math import cos , sin, sqrt, radians
import sys

A , B , H , M = list( map( int, input().split() ) )

th1 = H * 30 + 0.5 * M
th2 = M * 6

theta = min( abs( th1 - th2 ) , 360 - abs( th1 - th2 ))
if theta == 180.0:
    print(A+B)
    sys.exit()
theta = radians(theta)
ans = sqrt( (B * sin(theta))**2 + ( B*cos(theta) - A )**2 )
print(ans)

Measured memory_bytes: 62684
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <algorithm>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <functional>
#include <iomanip>
#define vll vector<ll>
#define vvvl vector<vvl>
#define vvl vector<vector<ll>>
#define VV(a, b, c, d) vector<vector<d>>(a, vector<d>(b, c))
#define VVV(a, b, c, d) vector<vvl>(a, vvl(b, vll (c, d)));
#define re(c, b) for(ll c=0;c<b;c++)
#define all(obj) (obj).begin(), (obj).end()
typedef long long int ll;
typedef long double ld;
using namespace std;

vvl G = VV(5001, 0, 0, ll);
// 頂点iを見ている時点でペアが決まっていない点がj個ある場合の数
#define P 1000000007

ll pp(ll a, ll b){
  return (a * b)%P;
}

ll root = -1;
vvl dp = VV(5001, 0, 0, ll);
vll pat(100000, 0);

ll dfs(ll now, ll from){
  if(G[now].size()==1){
    dp[now] = vll{0, 1, 0, 0};
    return 1;//ノード数
  }
  ll s = 1, idx = 0;
  vvl tmp_dp;
  tmp_dp.push_back(vll{0, 1, 0, 0});
  for(auto to:G[now]){
    if(to==from) continue;
    ll num = dfs(to, now);
    tmp_dp.push_back(vll((s+num+1)*2+1,0));

    ll th = s+num+1;
    for(int l=0;l<=s;l++){
      for(int r=0;r<=num;r++){
        //rを追加する時に切る場合
        tmp_dp[idx+1][l+th] =
        (tmp_dp[idx+1][l+th] +
        pp(pp(tmp_dp[idx][l], dp[to][r]), pat[r])+
        pp(pp(tmp_dp[idx][l+s+1], dp[to][r+num+1]), pat[r]))%P;

        tmp_dp[idx+1][l] =
        (tmp_dp[idx+1][l] +
        pp(pp(tmp_dp[idx][l+s+1], dp[to][r]), pat[r])+
        pp(pp(tmp_dp[idx][l], dp[to][r+num+1]), pat[r]))%P;

        //切らない場合
        tmp_dp[idx+1][l+r] =
        (tmp_dp[idx+1][l+r] +
        pp(tmp_dp[idx][l], dp[to][r]) +
        pp(tmp_dp[idx][l+s+1], dp[to][r+num+1]) )%P;

        tmp_dp[idx+1][l+r+th] =
        (tmp_dp[idx+1][l+r+th] +
        pp(tmp_dp[idx][l], dp[to][r+num+1]) +
        pp(tmp_dp[idx][l+s+1], dp[to][r]) )%P;
      }
    }
    idx++;
    s += num;
  }
  dp[now] = tmp_dp[idx];
  return s;
}


int main(int argc, char const *argv[]) {
  ll n;std::cin >> n;
  for(int i=0;i<n-1;i++){
    ll a, b;scanf("%lld %lld", &a, &b);
    G[a].push_back(b);
    G[b].push_back(a);
  }
  if(n==2){
    std::cout << 1 << '\n';
    return 0;
  }
  for(int i=1;i<=n;i++){
    if(G[i].size()>1){
      root = i;
      break;
    }
  }
  pat[2] = 1;
  for(ll i=3;i<10000;i++) pat[i] = (pat[i-2]*(i-1))%P;//k個での組
  dfs(root, -1);
  ll ans = 0;
  //std::cout << dp[root].size() << '\n';

  for(int i=0;i<=n;i++){
    dp[root][i] = pp(dp[root][i], pat[i])%P;
    dp[root][i+n+1] = pp(dp[root][i+n+1], pat[i])%P;
  }
  for(int i=0;i<=n;i++){
    ans = (ans + dp[root][i])%P;
    ans = (ans - dp[root][i+n+1] + P)%P;
  }
  std::cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 200108
#include <iostream>
#include <string.h> 
#include <stdio.h>
#include <queue>
#include <utility>//pair
#include <cmath>//abs()
using namespace std;
#define MAX 200000
#define rep(i, n) for(int i = 0;i < n;i++)
#define in(n) scanf("%d",&n);
#define out(n) printf("%d\n",n);
#define in2(n,k) scanf("%d%d",&n,&k);

int main(){
    int n,m,dis;
    typedef pair<int,int>p;
    p a[50],b[50];
    in2(n,m);
    rep(i,n)in2(a[i].first,a[i].second);
    rep(i,m)in2(b[i].first,b[i].second);
    rep(i,n){
        int c=0;
        int min=abs(a[i].first-b[0].first)+abs(a[i].second-b[0].second);
        rep(j,m){
            dis = abs(a[i].first-b[j].first)+abs(a[i].second-b[j].second);
            if(dis<min)min=dis,c=j;
        }
        out(c+1);
    }
    return 0;
}

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

using namespace std;

int PRIME = 1000000007;

map<string, int> table{
    {"SUN", 7},
    {"MON", 6},
    {"TUE", 5},
    {"WED", 4},
    {"THU", 3},
    {"FRI", 2},
    {"SAT", 1}
};

char next(char s, int N){
    int cur = s - 'A';
    int next = (cur + N) % 26;

    return 'A' + next;
}

int main(int argc, char* argv[]){
    string s;
    int N;

    cin >> N;
    cin >> s;

    for(int i = 0; i < s.size(); ++i){
        cout << next(s[i], N);
    }

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll a[60];
int main()
{
    ll n,i,l;
    cin>>n;
    string s;
    s=to_string(n);
    l=s.size();
    if(s.size()==1)
       cout<<n<<endl;
    else if(s.size()==2)
       cout<<9<<endl;
    else if(s.size()==3)
       cout<<9+(n-100)+1<<endl;
    else if(s.size()==4)
       cout<<9+900<<endl;
    else if(s.size()==5)
       cout<<9+900+(n-10000)+1<<endl;
    else if(s.size()==6)
       cout<<9+900+90000<<endl;
}



Measured memory_bytes: 256
import java.util.Scanner


object Main {

  def main(args: Array[String]): Unit = {
    val sc = new Scanner(System.in)
    val n = sc.nextInt()
    val v = for (_ <- 0 until n) yield sc.nextInt()
    val c = for (_ <- 0 until n) yield sc.nextInt()
    val result = (v,c).zipped.map(_-_).filter(_>0).sum

    println(result)
  }
}

Measured memory_bytes: 27296
import Control.Applicative

main = do
  [a, b, c, d, e] <- fmap read . lines <$> getContents
  print $ calc a b c d e

calc :: Int -> Int -> Int -> Int -> Int -> Int
calc a b c d e
  | a <= 0 && b <= 0 = (b - a) * c
  | a >= 0 && b >= 0 = (b - a) * e
  | otherwise = (-a) * c + d + b * e


Measured memory_bytes: 3604
#include<cstdio>
#include<vector>

using namespace std;

int main()
{
	int n;
	int cnt = 0;
	int h, w;
	int input1, input2;
	int i;

	scanf("%d %d %d", &n, &h, &w);

	for (i = 0; i < n; i++)
	{
		scanf("%d %d", &input1, &input2);

		if (input1 >= h&&input2 >= w)
		{
			cnt++;
		}
	}

	printf("%d\n", cnt);

	return 0;
}

Measured memory_bytes: 128
#include <algorithm>
#include <climits>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <vector>

int main() {
  int x[4], y[4];
  for (int i = 0; i < 2; i++) std::cin >> x[i] >> y[i];

  int px = x[1] - x[0];
  int py = y[1] - y[0];
  for (int i = 2; i < 4; i++) {
    int dx = -py;
    int dy = px;
    x[i] = x[i-1] + dx;
    y[i] = y[i-1] + dy;
    px = dx;
    py = dy;
  }
  std::cout << x[2] << " "
            << y[2] << " "
            << x[3] << " "
            << y[3] << std::endl;
}


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

int main(){
    string s;
    cin >> s;
    int size = s.size();
    rep(i,size){
        cout << 'x';
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(int i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

int main() {
  ll n;
  cin >> n;
  vl s(n + 1, 0), x(n + 1, 0);
  rep(i, n) {
    ll a;
    cin >> a;
    s[i + 1] = s[i] + a;
    x[i + 1] = x[i] ^ a;
  }
  ll ans = 0;
  rep(l, n) {
    ll ok = l, ng = n;
    while(ok + 1 < ng) {
      ll r = (ok + ng) / 2;
      if((s[r + 1] - s[l]) == (x[r + 1] ^ x[l]))
        ok = r;
      else
        ng = r;
    }
    ans += ok - l + 1;
  }
  cout << ans << endl;
}

Measured memory_bytes: 3328
#include<stdio.h>

int selectionSort(int*, int);
void swap(int*, int*);
void printStr(int*, int);

int main(void) {
    int n, a[100];
    int swapTime;

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

    swapTime = selectionSort(a, n);

    printStr(a, n);
    printf("%d\n", swapTime);

    return 0;
}

int selectionSort(int *a, int n) {
    int swapTime = 0;
    for(int i = 0; i < n-1; i++) {
        int minj = i;
        for(int j = i; j < n; j++) {
            if(a[j] < a[minj]) {
                minj = j;
            }
        }
        if(a[i] != a[minj]) {
            swap(&a[i], &a[minj]);
            swapTime++;
        }
    }
    return swapTime;
}

void swap(int *a, int *b) {
    int tmp;
    tmp = *a;
    *a = *b;
    *b = tmp;
}

void printStr(int *a, int n) {
    int i;
    for(i = 0; i < n-1; i++) {
        printf("%d ", a[i]);
    }
    printf("%d\n", a[i]);
}



Measured memory_bytes: 2100
def dfs(word, i):
    if len(word) == n:
        print(word)
    else:
        if i == 0:
            dfs('a', 1)
        else:
            for j in range(len(set(word)) + 1):
                dfs(word + chr(97 + j), j + 1)


if __name__ == "__main__":
    n = int(input())

    dfs('', 0)


Measured memory_bytes: 4340
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
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; }
 
/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
    sizeは(int)とキャストしよう
    ごちゃごちゃ場合分けを考える前に全探索は考えましたか？
*/

int main(){
    int N; cin >> N;
    vector<int> a(N+1), b(N+1, 0);
    for(int i=1; i<=N; ++i) cin >> a[i];

    int ans = 0;
    for(int i=N/2+1; i<=N; ++i){
        if(a[i] == 1) { b[i] = 1; ++ans; }
    }


    for(int i=N/2; i>=1; --i){
        int cnt = 0;
        for(int j=2*i; j<=N; j+=i) cnt += b[j];
        if(a[i] == 1 && cnt%2 == 1) b[i] = 0;
        else if(a[i] == 1 && cnt%2 == 0) { b[i] = 1; ++ans; }
        else if(a[i] == 0 && cnt%2 == 1) { b[i] = 1; ++ans; }
        else if(a[i] == 0 && cnt%2 == 0) b[i] = 0;
    }

    bool flg = true;
    if(ans == 0){
        cout << 0 << endl;
    }
    else{
        cout << ans << endl;
        for(int i=1; i<=N; ++i){
            if(b[i] == 1){
                if(flg == false) cout << " ";
                cout << i;
                flg = false;
            }
        }
        cout << endl;
    }

}

Measured memory_bytes: 2432
n=int(input())
data=[0]*5
for i in range(n):
    s=input()
    if(s[0]=="M"):
        data[0]+=1
    elif(s[0]=="A"):
        data[1]+=1
    elif(s[0]=="R"):
        data[2]+=1
    elif(s[0]=="C"):
        data[3]+=1
    elif(s[0]=="H"):
        data[4]+=1

ans=0
for i in range(3):
    for j in range(i+1,4):
        for k in range(j+1,5):
            ans+=data[i]*data[j]*data[k]

print(ans)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string n;
	cin>>n;
    for(int i=2;i<n.size();i++)
    {
        if(n[i]==n[i-1]&&n[i]==n[i-2])
        {
            cout<<"Yes"<<endl;
            return 0;
        }
    }
    cout<<"No"<<endl;
    return 0;
}

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

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

  int ans = 0;
  for(int i = s.size()-1; i > 0; i--){
    ans += 9; 
    if(s[i] != '9'){
      s[i-1]--;
    }
  }

  ans += s[0] - '0';
  cout << ans << endl;
  
  return 0;
}


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

using namespace std;

int main()
{
	string s;
	string p;
	int i, j;
	int x, y = 0;
	string ans = "No";
	cin >> s;
	cin >> p;

	while (1)
	{
		for (i = y; i < s.length(); i++)
		{
			if (s[i] == p[0]) break;
		}
		if (i == s.length())
		{
			break;
		}
		else
		{
			x = i;
			for (j = 0; j < p.length(); j++)
			{
				if (x >= s.length())
				{
					x = 0;
				}
				if (s[x] == p[j])
				{
					ans = "Yes";
				}
				else
				{
					ans = "No";
					break;
				}
				x++;
			}
			if (ans == "Yes") break;
		}
		y++;
	}
	
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3184
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <string>
#include <iomanip>
#include <map>
#include <set>
#include <cmath>
#include <cstdio>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define FOR(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define All(v) (v).begin(),(v).end()
typedef long long ll;

ll gcd(ll x,ll y){
    if(y==0)return x;
    return gcd(y,x%y); 
}

int main(){
    int N,K;cin >> N >>K;
    vector<int> A(N);
    rep(i,N)cin >> A[i];
    int _gcd = A[0];
    int ma = 0;
    rep(i,N){
        _gcd=gcd(_gcd,A[i]);
        ma=max(ma,A[i]);
    }
    if(K<=ma&&K%_gcd==0)cout << "POSSIBLE" << endl;
    else cout << "IMPOSSIBLE" << endl;
    return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
#define N 200050
#define M 200
#define int long long
#define pb push_back
#define x first
#define y second
#define all(v) v.begin(),v.end()
#define coffee prince
#define sz(a) (int)a.size()
#define ll long long
#define SIZE N

using namespace std;
int n;
int j = 26;
signed main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	cin>>n;
	string ans ="";
//	n--;
	while(n){
	    n--;
	    int o = n%j;
	    ans += 'a'+o;
	    n/=j;
	}
	reverse(all(ans));
	cout<<ans;
}


Measured memory_bytes: 3636
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(100000)


def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(M, K):
    if M == 0:
        if K == 0:
            print(0, 0)
        else:
            print(-1)
    elif M == 1:
        if K == 0:
            print(0, 0, 1, 1)
        else:
            print(-1)
    else:
        if K < 2**M:

            for i in range(2**M):
                if i == K:
                    continue
                print(i, '', end='')
            print(K, '', end='')

            for i in range(2**M-1, -1, -1):
                if i == K:
                    continue
                print(i, '', end='')
            print(K, '', end='')

        else:
            print(-1)


def main():
    M, K = read_int_n()
    (slv(M, K))


if __name__ == '__main__':
    main()


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

int main(){
	string s;
	int n,k;
	cin>>s>>k;
	set<string>ss;
	n = s.length();
	for(int i=0; s[i]; i++){
		for(int j=i; s[j]; j++){
			int len = j-i+1;
			if(len>k) break; 
			ss.insert(s.substr(i,len));
		}
	}
	set<string>::iterator it;
	int counter = 0;
	for(it = ss.begin(); it!=ss.end(); it++){
		counter++;
		if(counter==k){
			cout<<*it;
			return 0;
		}
	}
}

Measured memory_bytes: 4772
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <queue>
#include <set>
using ll = long long;
using graph = std::vector<std::vector<ll>>;
using wGraph = std::vector<std::vector<std::pair<ll,ll>>>;
#define rep(i,n) for (int i=0; i < int(n); i++)

using namespace std;

int main() {
    ll X,Y,A,B,C;
    cin >> X >> Y >> A >> B >> C;
    vector<ll> a(A);
    vector<ll> b(B);
    vector<ll> c(C);
    vector<ll> sumA(A+1);
    vector<ll> sumB(B+1);
    vector<ll> sumC(C+1);
    for (int i = 0; i < A; ++i) {
        cin >> a[i];
    }
    for (int i = 0; i < B; ++i) {
        cin >> b[i];
    }
    for (int i = 0; i < C; ++i) {
        cin >> c[i];
    }
    sort(a.begin(),a.end(),greater<ll>());
    sort(b.begin(),b.end(),greater<ll>());
    sort(c.begin(),c.end(),greater<ll>());
    for (int i = 0; i < C; ++i) {
        //cout << c[i] << endl;
    }
    for (int i = 1; i < A+1; ++i) {
        sumA[i] = sumA[i - 1] + a[i-1];
    }
    for (int i = 1; i < B+1; ++i) {
        sumB[i] = sumB[i - 1] + b[i-1];
    }
    for (int i = 1; i < C+1; ++i) {
        sumC[i] = sumC[i - 1] + c[i-1];
    }
    vector<ll> sumAB(X + Y + 1);
    ll currentA = 0;
    ll currentB = 0;
    for (int i = 1; i <= X + Y; ++i) {
        if(currentA < X && currentB < Y){
            bool choiceA = a[currentA] > b[currentB];
            if(choiceA){
                sumAB[i] = sumAB[i - 1] + a[currentA];
                currentA++;
            }else{
                sumAB[i] = sumAB[i - 1] + b[currentB];
                currentB++;
            }

        }else{
            if(currentA >= X){
                sumAB[i] = sumAB[i - 1] + b[currentB];
                currentB++;
            }else{
                sumAB[i] = sumAB[i-1] + a[currentA];
                currentA++;
            }
        }
    }
    for (int i = 0; i < X + Y + 1; ++i) {
        //cout << sumAB[i] << "," << sumC[X + Y - i] << endl;
    }
    ll M = 0;
    for (int i = 0; i < X + Y + 1; ++i) {
        if(X + Y - i < C + 1){
            M = max(M,sumAB[i] + sumC[X + Y - i]);
        }
    }
    cout << M << endl;
}


Measured memory_bytes: 6400
#include <iostream>
#include <string>
#include <cmath>

using namespace std;


int main()
{
    ios::sync_with_stdio(0);
  string s;
    cin>>s;
    int n=s.length(),c=0;
    for(int i=0;i<n/2;i++)
    {
        if(s[i]!=s[n-i-1])
           c++;
    }
    cout<<c;
}


Measured memory_bytes: 256
# include <bits/stdc++.h>
# define REP(i,a,b) for (int i = (int)(a); i < (int)(b); i++)
# define rep(i,n) REP(i,0,n)
# define rrep(i,n) for (int i = (int)(n - 1); i >= 0; i--)
# define sort(v) sort(v.begin(),v.end())
# define rsort(v) reverse(v.begin(),v.end())
# define all(v) v.begin() ,v.end()
using namespace std;
typedef long long ll;
const int MOD = 1e9 + 7;
const long long INF = 1LL << 60;

int N;

int main()
{
  cin >> N;
  vector<int> bricks(N);
  rep(i,N){
    int a;
    cin >> a;
    bricks.at(i) = a;
  }
  int check = 1;
  rep(i,N){
    if(bricks.at(i) == check){
      check++;
    }
  }

  if(check == 1){
    cout << -1 << endl;
    return 0;
  }
  cout << N + 1 -check << endl;
}

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

int main(){
	
	int n,m;
	cin >> n >> m;
	
	vector<vector<int>> to(n);
	
	rep(i,m){
		int u,v;
		cin >> u >> v;
		--u; --v;
		to[u].push_back(v);
	}
	int s,t;
	cin >> s >> t;
	--s; --t;
	
	queue<P> que;
	vector<vector<int>> dist(n,vector<int>(3,INF));
	dist[s][0] = 0;
	que.push({s,0});
	
	while(!que.empty()){
		P p = que.front();
		que.pop();
		for(auto next: to[p.first]){
			int np = (p.second+1)%3;
			if(dist[next][np] == INF){
				dist[next][np] = dist[p.first][p.second]+1;
				que.push({next,np});
			}
		}
	}
	
	int res = dist[t][0] / 3;
	
	if(dist[t][0]==INF) cout << -1 << endl;
	else cout << res << endl;
	
	return 0;
}


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

int main() {
  int N, n;
  int m = 1000000000;
  cin >> N;
    for(int i = 0; i < N; i++){
    int A;
    cin >> A;
    int e = 2;
      for(n = 0; (A % e) == 0; n++){
      e *= 2;
        if(n == m)
        break;
      }
    m = n;
    }
  cout << m;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <map>

int main() {
    std::map<std::string, int> mp;
    int Q;
    std::cin >> Q;
    for (int q = 0; q < Q; ++q) {
        int t;
        std::cin >> t;
        if (t == 0) {
            std::string k;
            int x;
            std::cin >> k >> x;
            mp[k] = x;
        } else if (t == 1) {
            std::string k;
            std::cin >> k;
            std::cout << (mp.count(k) ? mp[k] : 0) << std::endl;
        } else {
            std::string k;
            std::cin >> k;
            mp.erase(k);
        }
    }
}


Measured memory_bytes: 27696