akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <stack>
#include <queue>
#include <algorithm>
#include <cmath>
#include <string>
#include <map>
#include <set>
#include <list>

#define ll long long
#define fornum(A,B,C) for(A=B;A<C;A++)

using namespace std;

int i,j,k,l,m,n;
/////////////////////////////////////////////////////

int N;
map<int,int> vm[2];
int ref;
int maxx[2][2];
int num[2][2];

int main(){
    scanf("%d",&N);
    fornum(i,0,N){
        int nn;
        scanf("%d",&nn);
        vm[i%2][nn]++;
    }

    ref=N;
    
    fornum(i,0,2){
        for(auto p:vm[i] ){
            if(maxx[i][1]<p.second){
                maxx[i][1]=p.second;
            }
            if(maxx[i][0]<p.second){
                maxx[i][1]=maxx[i][0];
                num[i][1]=num[i][0];
                maxx[i][0]=p.second;
                num[i][0]=p.first;
            }
        }
    }
    if(num[0][0]!=num[1][0]){
        ref=N-maxx[0][0]-maxx[1][0];
    }else{
        int a=maxx[0][0]+maxx[1][1];
        int b=maxx[1][0]+maxx[0][1];
        ref=N-(a>b?a:b);
    }
    printf("%d",ref);
    return 0;
}

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

#define MIN(X,Y) ((X)<(Y)?(X):(Y))

int digSum(int n){
  int ans=0;
  while (n){
    ans += n%10;
    n /= 10;
  }
  return ans;
}

int main(void){
  int n,ans;
  cin >> n;
  ans = 100000;
  for (int i=1; i<=n/2; i++){
    int t;
    t = digSum(i) + digSum(n-i);
    //cout << i << " " << t << endl;
    ans = MIN(ans,t);
  }
  cout << ans << endl;
  return 0;
}

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

using namespace std;

typedef long long int LL;

int main(){
    int a, b;
    scanf("%d %d", &a, &b);
    int ans = max(0, a - (b * 2));
    printf("%d\n", ans);
	//return 0;
}

//__int128_t with a value range of − 2 127 . . . 2 127 − 1
// n'th fibonacci (pow((1 + sqrt(5)), n) - pow((1 - sqrt(5)), n)) / (pow(2,n) * sqrt(5));
// the number of digits of an integer x in base b is b log b ( x ) + 1 c


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <functional>
#include <cmath>
#include <complex>
#include <cctype>
#include <cassert>
#include <sstream>
#include <ctime>

using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()

template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<int, pii> P;

const ll INF = 1ll<<29;
const ll MOD = 1000000007;
const double EPS  = 1e-10;

int main() {
	int a, b, c;
	cin >> a >> b >> c;
	if (c >= a && c <= b) puts("Yes");
	else puts("No");
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#define flush fflush(stdout)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> Pl;
const int mod = (int)1e9 + 7, INF = (int)1e9;
const int di[4] = { 1,0,-1,0 }, dj[4] = { 0,1,0,-1 };


#define N 200007
ll fac[N], inv[N], finv[N];

void cominit(int n) {
    int i;
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (i = 2; i < n + 2; 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;
    }
    return;
}

ll com(int n, int r) {
    if (n < r) return 0;
    if (n < 0 || r < 0) return 0;
    if (r == 0 || r == n) return 1;
    return (fac[n] * finv[r]) % mod * finv[n - r] % mod;
}

int main(void) {
    int n, m, km, p, fn;
    ll ans;

    scanf("%d%d", &n, &m);

    cominit(N);

    km = m;
    ans = 1;
    for (p = 2; p * p <= m; p++) {
        if (km % p == 0) {
            fn = 0;
            while (km % p == 0) {
                km /= p;
                fn++;
            }
            ans = ans * com(fn + n - 1, n - 1) % mod;
        }
    }

    if (km > 1) {
        ans = ans * n % mod;
    }

    printf("%lld\n", ans);

	return 0;
}

Measured memory_bytes: 4992
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
#define int long long
#define ull unsigned long long
#define ld long double
#define rep(a) rep1(i,a)
#define rep1(i,a) rep2(i,0,a)
#define rep2(i,b,a) for(int i=(b); i<((int)(a)); i++)
#define rep3(i,b,a) for(int i=(b); i>=((int)(a)); i--)
#define all(a) a.begin(),a.end()
#define pii pair<int,int>
#define pb push_back
#define mp make_pair
#define sz(a) ((int)a.size())
#define pow2(x) (1ll<<(x))
#define ceiling(a,b) (((a)+(b)-1)/(b))
#define print0(a) cout << (a) << ' '
#define print1(a) cout << (a) << '\n'
#define print2(a,b) cout << (a) << ' ',print1(b)
#define print3(a,b,c) cout << (a) << ' ',print2(b,c)
#define print4(a,b,c,d) cout << (a) << ' ',print3(b,c,d)
#ifdef i_am_noob
#define debug(a) print2(#a,a)
#else
#define debug(a) 
#endif
#define ordered_set tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>
 
using namespace std;
using namespace __gnu_pbds;
 
const int Mod=1000000007,Mod2=998244353;
const int MOD=Mod2;
 
inline int add(int a, int b){return (a+b>=MOD?a+b-MOD:a+b);}
inline int sub(int a, int b){return (a+MOD-b>=MOD?a-b:a+MOD-b);}
int Pow(int a, int b){
	if(!b) return 1;
	int tmp=Pow(a*a%MOD,b>>1);
	return (b&1?tmp*a%MOD:tmp);
}
inline int inverse(int n){return Pow(n,MOD-2);}
 
const int maxn=100005;
//i_am_noob
int n,m,l[maxn],r[maxn],lmax=-4e18,rmin=4e18;

signed main(){
	ios_base::sync_with_stdio(0),cin.tie(0);
	cin >> n >> m;
	rep(m) cin >> l[i] >> r[i];
	rep(m) lmax=max(lmax,l[i]),rmin=min(rmin,r[i]);
	print1(max(rmin-lmax+1,0ll)); 
	return 0;
}


Measured memory_bytes: 1792
from collections import deque
S = deque(list(input()))
Q = int(input())
t = 0
for i in range(Q):
    query = input().split()
    if int(query[0]) == 1:
        t += 1
    else:
        query[1] = int(query[1])
        if t % 2 == 1:
            if query[1] == 1:
                query[1] = 2
            else:
                query[1] = 1
        if query[1] == 1:
            S.appendleft(query[2])
        else:
            S.append(query[2])
if t % 2 == 1:
    S.reverse()
print("".join(S))


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

namespace C
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] input_1 = (Console.ReadLine()).Split(" ");
            int N = int.Parse(input_1[0]);
            int M = int.Parse(input_1[1]);
            long K = long.Parse(input_1[2]);

            string[] input_2 = (Console.ReadLine()).Split(" ");
            List<int> A_i = new List<int>();
            foreach (string element in input_2)
            {
                A_i.Add(int.Parse(element));
            }

            string[] input_3 = (Console.ReadLine()).Split(" ");
            List<int> B_i = new List<int>();
            foreach (string element in input_3)
            {
                B_i.Add(int.Parse(element));
            }

            long current = 0;
            int n = 0;
            while (true)
            {
                if (current > K)
                {
                    current -= A_i[n - 1];
                    n--;
                    break;
                }
                n++;
                if (n > N)
                {
                    n--;
                    break;
                }
                current += A_i[n - 1];
            }

            int ans = n;
            int m = 0;
            while (true)
            {
                while (true)
                {
                    if (current > K)
                    {
                        current -= B_i[m - 1];
                        m--;
                        break;
                    }
                    m++;
                    if (m > M)
                    {
                        m--;
                        break;
                    }
                    current += B_i[m - 1];
                }

                if (ans < n + m)
                {
                    ans = n + m;
                }

                if (n == 0)
                {
                    break;
                }

                current -= A_i[n - 1];
                n--;

            }

            Console.WriteLine(ans);
        }
    }
}


Measured memory_bytes: 69956
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
int main(){
	int n;
	cin>>n;
	int f = 0;
	for(int i = 1; i < 10; i++){
		if(n%i == 0 && (n/i)>0 && (n/i) < 10){
			f = 1;
			break;
		}
	}
	if(f)
		cout<<"Yes\n";
	else
		cout<<"No\n";
	return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
    static boolean isPrime(int x) {
        if (x == 2) return true;

        if (x < 2 || x % 2 == 0) {
            return false;
        }

        int i = 3;
        double root = Math.sqrt(x);
        while (i <= root) {
            if (x % i == 0) return false;
            i += 2;
        }

        return true;
    }

    public static void main(String[] args) {
        try (BufferedReader in = new BufferedReader(new InputStreamReader(System.in))) {
            int n = Integer.parseInt(in.readLine());
            int ret = 0;
            for (int i = 0; i < n; i++) {
                int x = Integer.parseInt(in.readLine());
                if (isPrime(x)) ret++;
            }

            System.out.println(ret);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}



Measured memory_bytes: 30348
# C

import sys

n = int(input())

a = list(map(int, input().split()))

a[0] = a[0]-1

for i in range(1, n) :
    if a[i] > a[i-1] :
        a[i] = a[i] - 1
    if a[i] < a[i-1] :
        print('No')
        sys.exit(0)

print('Yes')

Measured memory_bytes: 14396
from sys import stdin
import math


n = int(stdin.readline().rstrip())

m = {}

for i in range(n):
    a, b = [int(x) for x in stdin.readline().rstrip().split()]
    if b in m:
      m[b] += a
    else:
      m[b] = a

mm = sorted(m.items(), key=lambda x:x[0])
#print(mm)
ans = "Yes"
sum = 0
for k,v in mm:
  #print(k,v)
  sum += v
  if sum > k:
      ans = "No"
      break

print(ans)


Measured memory_bytes: 84188
a=list(map(int,input().split()))
a=sorted(a)
cnt=0
if a[0]==a[1] and a[1]==a[2]:
	print(0)
elif a[0]==a[1]:
	while True:
		a[0]+=1
		a[1]+=1
		cnt+=1
		if a[0]==a[2]:
			print(cnt)
			break
elif a[1]==a[2]:
	while True:
		a[0]+=2
		cnt+=1
		if a[0]==a[2]:
			print(cnt)
			break
		elif a[0]>a[2]:
			print(cnt+1)
			break
else:
	while True:
		a[0]+=1
		a[1]+=1
		cnt+=1
		if a[2]==a[1]:
			break
	while True:
		a[0]+=2
		cnt+=1
		if a[0]==a[2]:
			print(cnt)
			break
		elif a[0]>a[2]:
			print(cnt+1)
			break

Measured memory_bytes: 9248
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Text;
using System.Text.RegularExpressions;
using System.Linq;
using System.IO;

class Program
{
    static void Main()
    {
        new Magatro().Solve();
    }
}

class Magatro
{
    private int H, W;
    private char[][] A;
    private void Scan()
    {
        var line = Console.ReadLine().Split(' ');
        H = int.Parse(line[0]);
        W = int.Parse(line[1]);
        A = new char[H][];
        for (int i = 0; i < H; i++)
        {
            A[i] = Console.ReadLine().ToArray();
        }
    }

    private void WriteA()
    {
        var sb = new StringBuilder();
        for (int i = 0; i < H; i++)
        {
            for (int j = 0; j < W; j++)
            {
                bool a = j == 0;
                bool b = (i % 2 == 0) && (j != W - 1);
                bool c = A[i][j] == '#';
                if (a || b || c)
                {
                    sb.Append('#');
                }
                else
                {
                    sb.Append('.');
                }
            }
            sb.AppendLine();
        }
        Console.Write(sb.ToString());
    }

    private void WriteB()
    {
        var sb = new StringBuilder();
        for (int i = 0; i < H; i++)
        {
            for (int j = 0; j < W; j++)
            {
                bool a = j == W - 1;
                bool b = (i % 2 == 1) && (j != 0);
                bool c = A[i][j] == '#';
                if (a || b || c)
                {
                    sb.Append('#');
                }
                else
                {
                    sb.Append('.');
                }
            }
            sb.AppendLine();
        }
        Console.Write(sb.ToString());
    }

    public void Solve()
    {
        Scan();
        WriteA();
        Console.WriteLine();
        WriteB();
    }
}


Measured memory_bytes: 17632
import sys
import math
from  collections import defaultdict

# sys.stdin = open('input.txt', 'r')
# sys.stdout = open('output.txt', 'w')

def solve(test):
	n, k = map(int, input().split())
	a = list(map(int, input().split()))
	fast = 1
	slow = 1
	fast = a[a[fast - 1] - 1]
	slow = a[slow - 1]
	while fast != slow:
		fast = a[a[fast - 1] - 1]
		slow = a[slow - 1]

	fast = 1
	count = 0
	while fast != slow:
		fast = a[fast - 1]
		slow = a[slow - 1]
		count += 1

	res = 1
	if k < count:
		while k:
			res = a[res - 1]
			k -= 1
		print(res)
		return
	k -= count

	cycle = 1
	fast = a[fast - 1]
	while fast != slow:
		fast = a[fast - 1]
		cycle += 1

	k %= cycle

	while k:
		fast = a[fast - 1]
		k -= 1

	print(fast)







if __name__ == "__main__":
	test_cases = 1
	for t in range(1, test_cases + 1):
		solve(t)


Measured memory_bytes: 33924
n, m = list(map(int, input().split()))
ks = [list(map(int, input().split())) for i in range(m) ] 
p = list(map(int, input().split()))

#print(ks[0][1:])
ans = 0
for i in range(2**n):
  count = [0]*m
  flg = True
  for j in range(n):  
        if ((i >> j) & 1):  
          for k in range(m):
            if j+1 in ks[k][1:]:
              count[k] += 1
  
  #print("i:" + str(i))
  #print(count)
  for l in range(m):
    if count[l] % 2 != p[l]:
      flg = False
      break
  if flg:
    ans += 1
    
print(ans)

Measured memory_bytes: 41964
#include <bits/stdc++.h>
using namespace std;
const int MM=100013;
const int inf=2000000013;
int dpA[MM],dpB[MM],dpC[MM];
int main()
{
    ios_base::sync_with_stdio(0);
    int n,a,b,c;
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        cin>>a>>b>>c;
        dpA[i]=max(dpB[i-1],dpC[i-1])+a;
        dpB[i]=max(dpA[i-1],dpC[i-1])+b;
        dpC[i]=max(dpA[i-1],dpB[i-1])+c;
    }
    cout<<max(dpA[n],max(dpB[n],dpC[n]))<<endl;
    return 0;
}


Measured memory_bytes: 1408
# coding=utf-8

import sys
stdin = sys.stdin
def na(): return map(int, stdin.readline().split())
def ns(): return stdin.readline().strip()

def main():
    a,op,b = stdin.readline().strip().split()
    if op == '+':
        print(int(a)+int(b))
    else:
        print(int(a)-int(b))
    pass


if __name__ == '__main__':
    main()

Measured memory_bytes: 3188
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int n;
    std::cin >> n;
    int a[101];
    for(int i = 0; i < 101; i++){
        a[i] = 0;
    }
    int x = 0;
    for(int i = 1; i <= n; i++){
        std::cin >> x;
        a[i] = x;
    }
    int pre = a[0];
    int now = a[1];
    int next = a[2];
    int count = 0;
    for(int i = 1; i <= n; i++){
        if(pre == now){
            a[i] = pre + next;
            count++;
        }
        if(i != 100){
            pre = a[i];
            now = a[i+1];
            next = a[i+2];
        }
    }
    std::cout << count << std::endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<fstream>
#include<sstream>
#include<cstdio>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<deque>
#include<map>
#include<set>
#include<algorithm>
#include<cmath>
#include<string>
#include<cstring>
#include<cstdlib>
using namespace std;

#define ull unsigned long long
#define ll long long
#define PI 3.141592654

bool order(char a,char b){
	return a > b;
}	

int main(){
	int t;
	cin>>t;
	cin.ignore();
	while(t--){
		string line;
		getline(cin,line);
		sort(line.begin(),line.end());
		int a,b;
		sscanf(line.c_str(),"%d",&a);
		sort(line.begin(),line.end(),order);
		sscanf(line.c_str(),"%d",&b);
		cout<<b-a<<endl;
	}	
	return 0;
}

Measured memory_bytes: 1280
prog=<<EOS

(n,*a),(m,*b)=$<.map{|e|e.split.map &:to_i}.transpose

g=[]
a.zip(b){|u,v|
    g[u]||=[]; g[u] << v
    g[v]||=[]; g[v] << u
}

def dfs s, g, visited, path
    visited[s]=true
    path << s
    u=g[s].select{|x|!visited[x]}[0]
    u && dfs(u, g, visited, path)
end

visited=[]
path=[]
dfs a[0], g, visited, path
path.reverse!.pop
res=path

path=[]
dfs a[0], g, visited, path
res+=path

puts res.size, res*' '
EOS

open('prog.rb', 'w') { |f| f.puts prog }
puts `RUBY_THREAD_VM_STACK_SIZE=200000000 ruby prog.rb`

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

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


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
using namespace std;

#ifdef LOCAL
    #define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
    #define eprintf(...) 42
#endif

#define SINV(t) greater<t>()
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REP2(i,n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
#define ALL(x) (x).begin(),(x).end()

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

typedef long long ll;
#define vv(t) vector<t>

template<typename T>
void SV(vector<T> v){
    REP(i,v.size()){
        #ifdef LOCAL
            cout << i << " : " << v[i] << endl;
        #endif
    }
}

int bitCount(int bits) {
    bits = (bits & 0x55555555) + (bits >> 1 & 0x55555555);
    bits = (bits & 0x33333333) + (bits >> 2 & 0x33333333);
    bits = (bits & 0x0f0f0f0f) + (bits >> 4 & 0x0f0f0f0f);
    bits = (bits & 0x00ff00ff) + (bits >> 8 & 0x00ff00ff);
    return (bits & 0x0000ffff) + (bits >> 16);
}

int main(){
    string S;
    cin >> S;
    ll cnt=0;
    ll max_cnt = 0;
    for(char* c=&S[0]; *c != 0; c++){
        switch (*c)
        {
            case 'A':
            case 'C':
            case 'G':
            case 'T':
                eprintf("%c", (*c));
                cnt++;
                break;
            default:
                max_cnt = max(cnt, max_cnt);
                cnt = 0;
                break;
        }
    }
    max_cnt = max(cnt, max_cnt);
    cout << max_cnt << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <map>
#include <set>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <vector>
#include <algorithm>
#include <functional>
#include <cstring>
#include <string>
#include <sstream>
#include <bitset>
using namespace std;
#define INF	100000000
#define MOD 1000000007
#define pb push_back
#define mp make_pair
#define fi first
#define sec second
#define lb lower_bound
#define ub upper_bound
#define SS stringstream
#define rep(i,n) for(int i = 0; i < n; i++)
#define SORT(x) sort((x).begin(), (x).end())
#define clr(a,b) memset((a),(b),sizeof(a))
typedef long long int ll;
typedef pair<int, int> P;
typedef vector<int> Vi;
typedef vector<ll> Vll;
typedef vector<P> Vp;
typedef priority_queue<P, vector<P>, greater<P> > PQ;

int dp[1<<16];

int ipow(int a){
	int ret = 1;
	rep(i,a) ret *= 2;
	return ret;
}

int main(){
	int n;
	while(scanf("%d", &n),n){
		int num[100][16];
		int l[100];
		rep(i,100) rep(j,16) num[i][j] = 0;
		rep(i,(1<<16)) dp[i] = 0;
		rep(i,n){
			int m;
			scanf("%d%d", &m, &l[i]);
			rep(j,m){
				int s, e;
				scanf("%d%d", &s, &e);
				s -= 6; e -= 6;
				for(int j = s; j < e; j++) num[i][j] = 1;
			}
		}
		for(int i = 0; i < (1<<16); i++){
			bitset<16> bs(i);
			for(int j = 0; j < n; j++){
				bool ok = true;
				for(int k = 0; k < 16; k++){
					if(bs[k] == 1 && num[j][k] == 1){
						ok = false;
						break;
					}
				}
				if(!ok) continue;
				int tmp = 0;
				for(int k = 0; k < 16; k++){
					if(bs[k] == 1 || num[j][k] == 1){
						tmp += ipow(k);
					}
				}
				dp[tmp] = max(dp[tmp],dp[i]+l[j]);
			}
		}
		int ans = 0;
		for(int i = 0; i < (1<<16); i++) ans = max(dp[i],ans);
		cout << ans << endl;
	}
}

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

using namespace std;

template< typename T = long long >
T pow_mod(T x, T n, T mod)
{
  T ret = 1;
  while(n > 0) {
    if(n & 1) ret = 1LL * ret * x % mod;
    x = 1LL * x * x % mod;
    n >>= 1;
  }
  return ret;
}

int lcm(int x, int y)
{
  return (x / __gcd(x, y) * y);
}

map< int, int > primefactor(int x)
{
  map< int, int > ret;
  for(int i = 2; i * i <= x; i++) {
    while(x % i == 0) {
      ret[i]++;
      x /= i;
    }
  }
  if(x != 1) ret[x]++;
  return (ret);
}

int lambda(int x)
{
  auto pp = primefactor(x);
  vector< int > vs;
  for(auto &p : pp) {
    if(p.first == 2) {
      if(p.second <= 2) vs.push_back(p.second);
      else vs.push_back(1 << (p.second - 2));
    } else {
      int cur = 1;
      for(int i = 1; i < p.second; i++) cur *= p.first;
      cur *= p.first - 1;
      vs.push_back(cur);
    }
  }
  int ret = vs[0];
  for(int i : vs) ret = lcm(ret, i);
  return (ret);
}

vector< int > beet(int x)
{
  vector< int > vs;
  for(int i = 1; i * i <= x; i++) {
    if(x % i == 0) {
      if(i * i != x) vs.push_back(x / i);
      vs.push_back(i);
    }
  }
  sort(begin(vs), end(vs));
  return (vs);
}

int solve(int N)
{
  if(N == 2) return (1);
  auto latte = lambda(N);
  for(auto &s : beet(lambda(latte))) {
    if(pow_mod(N, s, latte) == 1) return (s);
  }
  return (-1);
}


int main()
{
  int N;
  cin >> N;
  cout << solve(N) << endl;
}

Measured memory_bytes: 3164
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ll long long
#define lson l,mid,p<<1
#define rson mid+1,r,p<<1|1
#define pii pair<int,int>
using namespace std;
const int inf=1e9+10;
const int mod=1e9+7;
const int maxn=1e5+10;
int A,B,M;
int a[maxn],b[maxn],mn[maxn];
vector<int>g[maxn];
int main(){
	//ios::sync_with_stdio(false);
	//freopen("d//in1","r",stdin);
	cin>>A>>B>>M;
	for(int i=1;i<=A;i++) scanf("%d",&a[i]);
	int ret=inf;
	for(int i=1;i<=B;i++){
		scanf("%d",&b[i]);
		ret=min(ret,b[i]);
	}
	for(int i=1;i<=A;i++) mn[i]=ret+a[i];
	int ans=inf;
	for(int i=1,x,y,c;i<=M;i++){
		cin>>x>>y>>c;
		mn[x]=min(mn[x],a[x]+b[y]-c);
	}
	for(int i=1;i<=A;i++) ans=min(ans,mn[i]);
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3712
#!/usr/bin/env python3
mod = 10**9 + 7
n, m = map(int, input().split())
a = [int(input()) for _ in range(m)]
ok = [True] * (n + 1)
for x in a:
    ok[x] = False
dp = [0] * (n + 1)
dp[0] = 1
for i in range(n + 1):
    if i > 0 and ok[i - 1]:
        dp[i] = (dp[i] + dp[i - 1])
    if i > 1 and ok[i - 2]:
        dp[i] = (dp[i] + dp[i - 2])
print(dp[n] % mod)


Measured memory_bytes: 463476
// 1_8_A
#include <iostream>
using namespace std;

string swap_case(string str){
  for(int i = 0; i < (int)str.size(); i++){
    if('a' <= str[i] && str[i] <= 'z'){
      str[i] = str[i] - ('a' - 'A');
    } else if('A' <= str[i] && str[i] <= 'Z'){
      str[i] = str[i] + ('a' - 'A');
    }
  }
  return str;
}

int main(){
  string str;
  getline(cin, str);
  cout << swap_case(str) << endl;
  return 0;
}

Measured memory_bytes: 3208
#include<iostream>
#include<algorithm>
#include<vector>
#include<numeric>
#include<string>
#include<cmath>
#include<set>
#include<queue>
#include<deque>
#include<bitset>
#include<iomanip>
#include<cctype>
#include<map>

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

using namespace std;
const int inf = 1001001000;
const long long int Inf = 1001001001001001000;

void print(vector<vector<int>> a){
	for (int i=0;i<a.size();i++){
		for (int j=0;j<a[i].size();j++){
			cout << a[i][j] << " ";
		}
		cout << endl;
	}
}

void print(vector<vector<long long int>> a){
	for (int i=0;i<a.size();i++){
		for (int j=0;j<a[i].size();j++){
			cout << a[i][j] << " ";
		}
		cout << endl;
	}
}

void print(vector<int> a){
    int n = a.size();
    for (int j=0;j<n;j++) {
        if (j != n-1) cout << a[j] << " ";
        else cout << a[j] << endl;
    }
}



int main(){
	int n, q;
	cin >> n >> q;
	queue<pair<string, int>> task;
	rep(i,n){
		string s;
		int a;
		cin >> s >> a;
		task.push(pair<string, int>(s, a));
	}
	int t = 0;
	while (!task.empty())
	{
		pair<string, int> now = task.front();
		task.pop();
		if (now.second <= q)
		{
			t += now.second;
			cout << now.first << " " << t << endl;
		}
		else {
			t += q;
			now.second -= q;
			task.push(now);
		}
	}

	return 0;
}




Measured memory_bytes: 6340
#include<stdio.h>

int main() {
    int x,y;
    int z = 0;
    scanf("%d",&x);
    for (int i = 1; i < 10; i++) {
        for (int j = 1; j < 10; j++) {
            y = i*j;
            if (y==x) {
                printf("Yes");
                z = 1;
                break;
            }
        }
        if (z==1) {
            break;
        }
        
    }
    if (z == 0) {
        printf("No");
    }
}

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

int main() {
  int n,count=0;  cin>>n;
  vector<int>  v(n);
  rep(i,n)cin>>v.at(i);
  
  rep(i,n-2){
    if(v.at(i)<v.at(i+1)&&v.at(i+1)<v.at(i+2)){
      count++;}
    if(v.at(i)>v.at(i+1)&&v.at(i+1)>v.at(i+2)){
      count++;}
  }
  cout<<count;
}



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

l = list(map(int,input()))
ll = []
p = l[0]
co = 1
ppp = 0
su = 0
lll = []
for i in range(n-1):
    if p == l[i+1]:
        co += 1
    else:
        if p == 0:
            ppp += 1
        ll.append([p,co])
        p = l[i+1]
        co = 1
if p == 0:
    ppp += 1
ll.append([p,co])
co = 0
if ll[0][0] == 0:
    ll.insert(0,[1,0])
if ll[-1][0] == 0:
    ll.append([1,0])
if len(ll) == 1:
    print(n)
    exit(0)
if ppp <= k:
    print(n)
    exit(0)
co = 0
for i in range(2*k+1):
    co += ll[i][1]
lll.append(co)
for i in range(ppp-k):
    co += ll[i*2+1+2*k][1] + ll[i*2+2+2*k][1] - (ll[i*2][1] + ll[i*2+1][1])
    lll.append(co)
print(max(lll))



Measured memory_bytes: 56796
// created_by  Rishi_Mohan

#include<bits/stdc++.h>

#define    ll           long long
#define    db1(x)       cout<<#x<<"="<<x<<'\n'
#define    db2(x,y)     cout<<#x<<"="<<x<<","<<#y<<"="<<y<<'\n'
#define    db3(x,y,z)   cout<<#x<<"="<<x<<","<<#y<<"="<<y<<","<<#z<<"="<<z<<'\n'

using namespace std;

void solve()
{
    int k; cin >>  k;
    int a,b;
    cin >> a >> b;
    bool ok = 0;
    while(a<=b)
    {
        if(a%k==0) {ok=1;break;}
        a++;
    }
    if(ok) cout << "OK" ;
    else cout << "NG";
}

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


Measured memory_bytes: 3640
#include <iostream>
#define REP(i, a, n) for(int i = (a); i < (n); i++)
using namespace std;

int main(void) {
  long long N, M, T;
  long long A[10000];
  cin >> N >> M >> T;
  REP(i, 0, N) cin >> A[i];

  long long last = 0, ans = 0;
  REP(i, 0, N) {
    ans += max(A[i] - M - last, 0LL);
    last = A[i] + M;
  }
  ans += max(T - last, 0LL);

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 3088
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
#include <string>
#include <set>
#define INF 1000000000
using namespace std;
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define LOOP(i,N) for(int i=0;i<N;i++)
#define LOOP1(i,N) for(int i=1;i<=N;i++)
typedef pair<int,int> P;
typedef pair<int,pair<int,int> > PP;

#define MAN 200000

int main(){
  int n,t;
  int d[MAN];
  cin>>n>>t;
  int sum=0,now=0;
  LOOP(i,n){
    cin>>d[i];
    sum += t - max(0,now-d[i]);
    now=d[i]+t;
  }
  cout << sum;
}


Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <utility>
#include <queue>

using namespace std;

class node {
public:
	int parent,children[2],sib,val;
	node() {
		parent = -1;
		children[0] = -1;
		children[1] = -1;
		sib = -1;
		val = -1;
	}
	int deg() {
		int c = 0;
		for(int i=0;i<2;i++)if(children[i]!=-1)c++;
		return c;
	}
	string typ() {
		if(parent == -1)return "root";
		else if(deg() == 0)return "leaf";
		else return "internal node";
	}
	int get1() {
		if(children[0] == -1) return children[1];
		return children[0];
	}
};

int n = 0,c = 0;
node d[600000];

void pre(int i) {
	cout << " " << d[i].val;
	if(d[i].children[0] != -1) pre(d[i].children[0]);
	if(d[i].children[1] != -1) pre(d[i].children[1]);
}

void ino(int i) {
	if(d[i].children[0] != -1)ino(d[i].children[0]);
	cout << " " << d[i].val;
	if(d[i].children[1] != -1)ino(d[i].children[1]);
}

void pos(int i) {
	if(d[i].children[0] != -1)pos(d[i].children[0]);
	if(d[i].children[1] != -1)pos(d[i].children[1]);
	cout << " " << d[i].val;
}

void ins(int v) {
	d[c].val = v;
	if(c == 0){c++;return;}
	int h = 0;
	while(1) {
		int g;
		if(d[h].val < v) {
			g = d[h].children[1];
			if(g == -1) {
				d[c].parent = h;
				d[h].children[1] = c;
				break;
			} else {
				h = g;
			}
		} else {
			g = d[h].children[0];
			if(g == -1) {
				d[c].parent = h;
				d[h].children[0] = c;
				break;
			} else {
				h = g;
			}
		}
	}
	c++;
}

void find(int v) {
	int h = 0;
	while(1) {
		int g;
		if(h == -1) {
			cout << "no" << endl;
			return;
		}
		if(d[h].val < v) {
			h = d[h].children[1];
		} else if (d[h].val > v){
			h = d[h].children[0];
		} else {
			cout << "yes" << endl;
			return;
		}
	}
}

void del(int v) {
	int h = 0;
	while(1) {
		int g;
		if(h == -1) {
			return;
		}
		if(d[h].val < v) {
			h = d[h].children[1];
		} else if (d[h].val > v){
			h = d[h].children[0];
		} else {
			int p = d[h].parent;
			if(d[h].deg() == 0) {
				if(d[p].val < v){
					d[p].children[1] = -1;
				}
				else {
					d[p].children[0] = -1;
				}
			}
			if(d[h].deg() == 1) {
				if(d[p].val < v){
					d[p].children[1] = d[h].get1();
					d[d[h].get1()].parent = p;
				}
				else {
					d[p].children[0] = d[h].get1();
					d[d[h].get1()].parent = p;
				}
			}
			if(d[h].deg() == 2) {
				int z = d[h].children[1];
				while(1){
					if(d[z].children[0] != -1) z = d[z].children[0];
					else break;
				}
				int vv = d[z].val;
				int pp = d[z].parent;
				if(d[z].deg() == 0) {
					if(d[pp].val < vv){
						d[pp].children[1] = -1;
					}
					else {
						d[pp].children[0] = -1;
					}
				}
				if(d[h].deg() == 1) {
					if(d[pp].val < vv){
						d[pp].children[1] = d[z].get1();
						d[d[z].get1()].parent = pp;
					}
					else {
						d[pp].children[0] = d[z].get1();
						d[d[z].get1()].parent = pp;
					}
				}
				d[h].val = d[z].val;
			}

			return;
		}
	}
}

int main(void) {
	cin >> n;
	string s;
	int t;
	for(int i = 0;i < n;i++) {
		cin >> s;
		if(s == "insert") {cin >> t;ins(t);}
		else if(s == "find"){cin >> t;find(t);}
		else if(s == "delete"){cin >> t;del(t);}
		else {ino(0);cout << endl;pre(0);cout << endl;}
	}
}



Measured memory_bytes: 14920
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;

int main() {
    int n;
    cin >> n;
    int cnt = 0;
    rep(i, n) {
        int a;
        cin >> a;
        if(a%2 == 1) {
            cnt++;
        }
    }

    if(cnt%2 == 0) {
        cout << "YES";
    }
    else {
        cout << "NO";
    }

    cout << endl;
    return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

using namespace std;
int main()
{
    // 文字列の入力
    int A, B;
	cin >> A >> B;
	
	printf("%d\n", A * B);
	
    return 0;
}

Measured memory_bytes: 3744
//四則演算 #pragma GCC target("avx")
//並列計算 #pragma GCC optimize("O3")
//条件分岐を減らす #pragma GCC optimize("unroll-loops")
//浮動小数点演算 #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using VI = vector<int>;
using VL = vector<ll>;
using VS = vector<string>;
template<class T> using PQ = priority_queue<T, vector<T>, greater<T>>;
#define FOR(i,a,n) for(int i=(a);i<(n);++i)
#define eFOR(i,a,n) for(int i=(a);i<=(n);++i)
#define rFOR(i,a,n) for(int i=(n)-1;i>=(a);--i)
#define erFOR(i,a,n) for(int i=(n);i>=(a);--i)
#define each(i, a) for(auto &i : a)
#define SORT(i) sort(i.begin(),i.end())
#define rSORT(i) sort(i.rbegin(),i.rend())
#define fSORT(i,a) sort(i.begin(),i.end(),a)
#define all(i) i.begin(),i.end()
#define out(y,x) ((y)<0||h<=(y)||(x)<0||w<=(x))
#define line cout << "-----------------------------\n" 
#define ENDL(i,n) ((i) == (n) - 1 ? "\n" : " ")
#define stop system("pause")
constexpr ll INF = 1000000000;
constexpr ll LLINF = 1LL << 60;
constexpr ll mod = 1000000007;
constexpr ll MOD = 998244353;
constexpr ld eps = 1e-10;
constexpr ld pi = 3.1415926535897932;
template<class T>inline bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; }return false; }
template<class T>inline bool chmin(T& a, const T& b) { if (a > b) { a = b; return true; }return false; }
inline void init() { cin.tie(nullptr); cout.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); }
template<class T>inline istream& operator>>(istream& is, vector<T>& v) { for (auto& a : v)is >> a; return is; }
template<class T>inline istream& operator>>(istream& is, deque<T>& v) { for (auto& a : v)is >> a; return is; }
template<class T, class U>inline istream& operator>>(istream& is, pair<T, U>& p) { is >> p.first >> p.second; return is; }
template<class T>inline vector<T> vec(size_t a) { return vector<T>(a); }
template<class T>inline vector<T> defvec(T def, size_t a) { return vector<T>(a, def); }
template<class T, class... Ts>inline auto vec(size_t a, Ts... ts) { return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...)); }
template<class T, class... Ts>inline auto defvec(T def, size_t a, Ts... ts) { return vector<decltype(defvec<T>(def, ts...))>(a, defvec<T>(def, ts...)); }
inline void print() { cout << "\n"; }
template<class T, class... Ts>inline void print(const T& a, const Ts&... ts) { cout << a << " "; print(ts...); }
template<class T>inline void print(const vector<T>& v) { for (int i = 0; i < v.size(); ++i)cout << v[i] << (i == v.size() - 1 ? "\n" : " "); }
template<class T>inline void print(const vector<vector<T>>& v) { for (auto& a : v)print(a); }
inline string reversed(const string& s) { string t = s; reverse(all(t)); return t; }

int main() {
    init();

    string s; cin >> s;
    int a = s.back() - '0';
    if (a == 3)print("bon");
    else if (a == 0 || a == 1 || a == 6 || a == 8)print("pon");
    else print("hon");

    return 0;
}

Measured memory_bytes: 3600
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
#define repr(i,n) for(int i=(n-1);i>=0;i--)
#define pb push_back
#define mp make_pair
#define all(x) x.begin(),x.end()
using namespace std;
typedef long long ll;

int main() {
  int n,a,b;
  cin >> n >> a >> b;
  cout << min(n*a, b) << endl;



}



Measured memory_bytes: 256
#include <iostream>
#include <iomanip> //! for setprecision(10)
#include <math.h>
#include <algorithm>
#include <functional> 
#include <string>
#include <vector>

#include <cstring>
#include <set>
#include <map>
#include <queue>
#include <utility>
#include <limits.h>

using namespace std;

typedef long long LL;

#define rep(i,n) for (int i = 0; i < (n); ++i)
#define dump(c) { for (auto it = c.begin(); it != c.end(); ++it) if (it == c.begin()) cout << *it; else cout << ' ' << *it; cout << endl; } 
#define dumpMap(m) { for (auto it: m) cout << it.first << "=>" << it.second << ' '; }

const int MOD = 1000000007;

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

    LL ans = 0;
    int len = s.length();
    int i = 0;
    LL g = 0;
    LL l = 0;

    //! find ">>>>" on top, if any    
    while (i < len && s[i] == '>') {
        ++g;
        ++i;
    }
    ans += (g * (g+1)) / 2;

    //! find "<<<<<>>>>>" in the middle, or "<<<<" on tail, if any
    while (i < len) {
        g = 0;
        l = 0;
        while (i < len && s[i] == '<') {
            ++l;
            ++i;
        }
        while (i < len && s[i] == '>') {
            ++g;
            ++i;
        }
        if (g < l) {
            g = max(0LL, g-1);
        } else {
            l = max(0LL, l-1);
        }
        ans += (g * (g+1)) / 2;
        ans += (l * (l+1)) / 2;
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 900
#include<bits/stdc++.h>
using namespace std;
inline int rd(char c[]){
  int i, sz=0;
  for(;;){
    i = getchar_unlocked();
    if(i!=' '&&i!='\n'&&i!='\r'&&i!='\t'&&i!=EOF){
      break;
    }
  }
  c[sz++] = i;
  for(;;){
    i = getchar_unlocked();
    if(i==' '||i=='\n'||i=='\r'||i=='\t'||i==EOF){
      break;
    }
    c[sz++] = i;
  }
  c[sz]='\0';
  return sz;
}
inline void wt_L(char a){
  putchar_unlocked(a);
}
inline void wt_L(const char c[]){
  int i=0;
  for(i=0;c[i]!='\0';i++){
    putchar_unlocked(c[i]);
  }
}
char B[3];
char res[3];
char buf[5] = "ACTG";
int main(){
  int i;
  rd(B);
  for(i=0;i<4;i++){
    if(B[0]==buf[i]){
      res[0] = buf[(i+2)%4];
    }
  }
  wt_L(res);
  wt_L('\n');
  return 0;
}
// cLay varsion 20190721-1

// --- original code ---
// char B[3], res[3];
// char buf[5] = "ACTG";
// {
//   rd(B);
//   rep(i,4) if(B[0]==buf[i]) res[0] = buf[(i+2)%4];
//   wt(res);
// }


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

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

	int N;
	int i,j;
	int max=0;
	int counter=0;
	int tmp;
	double ave;
	vector<int> given;

	cin >> N;

	for(i=0;i<N;i++){
		cin >> tmp;
		given.push_back(tmp);
	}

	for(i=0;i<N-1;i++){
		if(given[i]>=given[i+1]){
			counter++;
		}else{
			if(counter>max){
				max=counter;
			}
			counter=0;
		}
	}
	
	if(counter>max){
		max=counter;
	}

	cout << max << endl;

	return 0;
}



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


Measured memory_bytes: 2044
W, H, N = map(int, input().split())
x0, y0 = 0, 0

for _ in range(N):
    xi, yi, a = map(int, input().split())
    if a == 1:
        x0 = max(xi, x0)
    elif a == 2:
        W = min(xi, W)
    elif a == 3:
        y0 = max(yi, y0)
    elif a == 4:
        H = min(yi, H)

ans = (W-x0)*(H-y0)
print(ans if x0 < W and y0 < H else 0)


Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,k,x,sum=0;
  scanf("%d %d",&n,&k);
  for(int i=0;i<n;++i){
    scanf("%d",&x);
    sum+=k-x<x?(k-x)*2:x*2;
  }
  printf("%d\n",sum);
  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main {

    public static void main(String[] args) {
        Scanner hi = new Scanner(System.in);
        String S = hi.nextLine();

        char g = S.charAt(0);
        if (S.charAt(0) == S.charAt(1)) {

            char r = S.charAt(2);
            if (S.charAt(2) == S.charAt(3))
            {
                if (S.charAt(0) == S.charAt(3))
                    System.out.println("No");
                if (S.charAt(0) != S.charAt(3))
                    System.out.println("Yes");
            }
                 else{
                    System.out.println("No");
            }
        } else if (S.charAt(0) == S.charAt(2)) {
            char r = S.charAt(2);
            if (S.charAt(1) == S.charAt(3))
            {
                if (S.charAt(0) == S.charAt(1))
                    System.out.println("No");
                if (S.charAt(0) != S.charAt(1))
                    System.out.println("Yes");
            }
            else{
                System.out.println("No");
            }


        }else if (S.charAt(0) == S.charAt(3))
        {
            char r = S.charAt(2);
            if (S.charAt(1) == S.charAt(2))
            {
                if (S.charAt(0) == S.charAt(1))
                    System.out.println("No");
                if (S.charAt(0) != S.charAt(1))
                    System.out.println("Yes");
            }
            else{
                System.out.println("No");
            }


        }

        else System.out.println("No");
    }


}


Measured memory_bytes: 21844
import std.stdio;
import std.string;
import std.conv;
import std.algorithm;
import std.array;
void main()
{
	auto input = readln.chomp.split(' ').map!(to!long).array();
	input.sort();
	bool result = input[2] == input[0] + input[1];
	writeln(result?"Yes":"No");
}

Measured memory_bytes: 256
#include <algorithm>
#include <array>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <vector>
using namespace std;
#define int long long

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

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

    t.pop_back();
    cout << (s == t ? "Yes" : "No") << endl;
}


Measured memory_bytes: 3616
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#define rep(i,n) for(int i=0;i<(n);i++)
#define psortsecond(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.second<b.second;});
#define psortfirst(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.first<b.first;});
#define All(x) (x).begin(),(x).end()
using namespace std;
using pii  = pair<int,int>;
long long gcd(long long a, long long b){return (b == 0 ? a : gcd(b, a%b));}
long long lcm(long long a, long long b){return a*b/gcd(a,b);}
typedef long long ll;
#define MOD 1000000007
#define EPS 10e-8

int U[2003][2003];

int main() {
  char c[3];
  cin >> c ;
  rep(i,3){
      if(c[i]=='1')c[i]='9';
      else c[i]='1';
  }
  cout << c << endl;
}

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

int main(){
    int mat[3][3];
    int n;

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

    for(int h = 0; h <n; ++h){
        int bixin;
        scanf("%d", &bixin);
        for(int i=0; i< 3; ++i){
            for(int j=0; j<3; ++j){
                if(bixin== mat[i][j])
                    mat[i][j]=-1;

            }
        }
    }
/*
    for(int i = 0; i < 3; ++i){
        for (int j = 0; j < 3; ++j)
            printf("%d ", mat[i][j]);
        printf("\n\n");
    }

*/
    int vdd = 0;

    //linha
    for(int i=0; i<3; ++i){
    int linha = 0;
        for(int j=0; j<3; ++j){
            if (mat[i][j]==-1)
                linha += 1;
        }
        if (linha == 3){
            vdd = 1;
        //   printf("###\n");
        }
    }
    // COLUNA
    for(int j=0; j <3; ++j){
        int coluna =0;
        for(int i =0; i<3; ++i){
            if(mat[i][j]==-1)
                coluna+=1;
        }
        if(coluna == 3){
            vdd=1;
            //printf("###\n");
        }
    }
    /*
    for(int i= 0; i<3; ++i){
        int diagonalp= 0, diagonals =0;
        for(int j=0; j<3; ++j){
            if(i==j)
                diagonalp+=1;
            else if(mat[0][0]==-1 && mat[1][1]==-1 && mat[2][0]== -1)
                diagonals+=1;
        }
        if(diagonalp==3 || diagonals == 1)
            vdd =1;
        printf("------%d\n", diagonalp);
    }
    */

    if (mat[0][0]==-1 && mat[1][1]==-1 && mat[2][2]== -1){
        vdd = 1;
        //printf("--###\n");
    }
    if (mat[0][2] == -1 && mat[1][1] == -1 && mat[2][0] == -1){
        vdd = 1;
        //printf("---------###\n");
    }


    if(vdd==1)
        printf("Yes\n");
    else
        printf("No\n");
    return 0;
}


Measured memory_bytes: 128
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;

namespace B
{
    public class Program
    {
        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            Solve();
            Console.Out.Flush();
        }

        public static void Solve()
        {
            var n = int.Parse(Console.ReadLine());
            var reviews = new Tuple<string, int>[n];
            for (var i = 0; i < n; i++)
            {
                var sp = Console.ReadLine().Trim().Split(' ');
                reviews[i] = new Tuple<string, int>(sp[0], int.Parse(sp[1]));
            }
            var indexed = reviews.Select((x, i) => new { Value = x, Index = i + 1 })
            .OrderBy(x => x.Value.Item1)
            .ThenByDescending(x => x.Value.Item2)
            .ToArray();

            for (var i = 0; i < indexed.Length; i++)
            {
                Console.WriteLine(indexed[i].Index);
            }
        }
    }
}


Measured memory_bytes: 13792
using System;
using System.Collections.Generic;

namespace ALDS1_3
{
    class Process
    {
        public readonly string name;
        public readonly int time;

        public Process(string name, int time)
        {
            this.name = name;
            this.time = time;
        }
    }

    class Program
    {
        static void Main()
        {
            var queue = new Queue<Process>();
            var q = int.Parse(Console.ReadLine().Split()[1]);
            var c = 0;
            string s;

            while ((s = Console.ReadLine()) != null)
            {
                var _t = s.Split();
                var k = _t[0];
                var v = int.Parse(_t[1]);
                c += v < q ? v : q;
                v -= q;
                if (v <= 0)
                    Console.WriteLine("{0} {1}", k, c);
                else
                    queue.Enqueue(new Process(k, v));
            }

            while (queue.Count > 0)
            {
                var _q = queue.Dequeue();
                var k = _q.name;
                var v = _q.time;
                c += v < q ? v : q;
                v -= q;
                if (v <= 0)
                    Console.WriteLine("{0} {1}", k, c);
                else
                    queue.Enqueue(new Process(k, v));
            }
        }
    }
}

Measured memory_bytes: 12388