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

using namespace std;

int main()
{
	int a, b,  c;
	cin >> a >> b >> c;
	int m = max(a, b);
	int h = min(a, b);
	if (h < c && c < m)
	{
		cout << "Yes" << endl;
	}
	else
	{
		cout << "No" << endl;
	}

	

}

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

def BubbleSort(C, n):
    for i in range(n-1):
        for w in range(i+1, n):
            j = n-w+i
            if (C[j][1] < C[j-1][1]):
                a = C[j]
                C[j] = C[j-1]
                C[j-1] = a
def SelectionSort(C, n):
    for i in range(n):
        mini = i
        for j in range(i+1,n):
            if (C[j][1] < C[mini][1]):
                mini = j
        if(mini != i):
            a = C[i]
            C[i] = C[mini]
            C[mini] = a
## l[1]이 str 이라는것에 주의 int(l[1])을 해줘야함 --> 이거 때문에 20분 디버깅 소비
def stable(A,B):
    count = [0 for i in range(9)]
    for l in A:
        count[int(l[1]) - 1] += 1
    ilist = [] ##安定なiのリスト
    for i in range(1,10):
        if (count[i-1] > 1):
            awlist = []
            for l in A:
                if(int(l[1]) == i):
                    awlist.append(l[0])
            bwlist = []
            for l in B:
                if(int(l[1]) == i):
                    bwlist.append(l[0])
            if (awlist == bwlist):
                ilist.append(i)
            
        else:
            ilist.append(i)
    if (len(ilist) == 9):
        print('Stable',end = '')
    else:
        print('Not stable', end = '')
                  

Blist = list(clist)
BubbleSort(Blist, n)
for i in range(n):
    if (i == n-1):
        print('{}{}'.format(Blist[i][0],Blist[i][1]), end = '')
    else : 
        print('{}{}'.format(Blist[i][0],Blist[i][1]), end = ' ')
print()
stable(clist, Blist)
print()

Slist = list(clist)
SelectionSort(Slist, n)
for i in range(n):
    if(i == n-1):
        print('{}{}'.format(Slist[i][0],Slist[i][1]), end = '')
    else:
        print('{}{}'.format(Slist[i][0],Slist[i][1]), end = ' ')
print()
stable(clist, Slist)
print()



Measured memory_bytes: 5624
n,k = map(int, input().split())
h = sorted([int(input()) for _ in range(n)])

ans = 0
t = float("inf")
for i in range(n-k+1):
  if abs(h[i+k-1] - h[i]) < t:
    t = abs(h[i+k-1] - h[i])
    ans = i

print(h[ans+k-1] - h[ans])

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

using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, x) for(int i=1;i<=(int)(x);i++)
#define all(x) (x).begin(),(x).end()

int main() {
    int n;
    cin >> n;

    vector<int> v(n, 0);
    map<int, int> m;

    rep(i, n)cin >> v.at(i);

    rep(i, n) {
        m.insert(make_pair(v.at(i),i));
    }

    reps(i, n){
        cout << (m.at(i)+1);
        if(i!=n){
            cout << ' ';
        }
    }


}


Measured memory_bytes: 5888
#include<bits/stdc++.h>
#define reg register
typedef long long ll;
using namespace std;
int n,a[300005],h,t;
int main(){
	scanf("%d",&n);reg int pos=1;
	for(reg int i=1,x;i<=n;i++){
		scanf("%d",&x);
		if((x-pos)&1)if(x^i)return 0*puts("No");else;
		else if(h==t||x>a[t-1])a[t++]=x;
		else if(x==pos)pos+=2;
		else return 0*puts("No");
		while(h<t&&a[h]==pos)pos+=2,h++;
		pos=min(pos,i+1);
	}
	puts("Yes");
	return 0;
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
vector <int> v;
vector <char> vc;
vector <string> vs;
map <string,int> sm;
map <int,int> mp;
map <char,int>cm;
//int string_to_int(string s){stringstream x(s);double a=0; x>>a; return a;}
//long long int gcd(long long int a, long long int b){if(a%b==0)return b;return gcd(b, a%b);}
//long long int lcm(long long int a, long long int b){return (a*b)/gcd(a, b);}
//int string_sum(string s){int b = 0;auto k =s.size();for(int j=0; j<k; j++){b +=(s[j]-48);}return b;}
//long long int factorial(long long int n){if (n == 0)return 1;return n * factorial(n - 1);}

//int cnt =0;
//
//void SieveOfEratosthenes(int n)
//{
//   // v.push_back(1);
//
//    bool prime[n+1];
//    memset(prime, true, sizeof(prime));
//
//    for (int p=2; p*p<=n; p++)
//    {
//
//        if (prime[p] == true)
//        {
//
//            for (int i=p*p; i<=n; i += p)
//                prime[i] = false;
//        }
//    }
//
//
//    for (int p=2; p<=n; p++)
//       if (prime[p])
//          v.push_back(p);
//}
//
   

//int mod(string num, int a)
//{
//    // Initialize result
//    int res = 0;
//
//    // One by one process all digits of 'num'
//    for (int i = 0; i < num.length(); i++)
//         res = (res*10 + (int)num[i] - '0') %a;
//
//    return res;
//}


    int main()
    {
        int a,n,b,c;
        bool flag = false;
        string s,p;
        
       
        while(cin>>a>>b)
        {
            
            if(a==0&&b==0)break;
            
           if(a>=b)
               cout << b << " " << a << endl;
            else
                cout << a << " " << b << endl;
            
        }
       
       
    }




Measured memory_bytes: 3012
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner stdIn = new Scanner(System.in);
		int A = stdIn.nextInt();
		int B = stdIn.nextInt();
		int C = stdIn.nextInt();
		int ans = 0;
		ans = A - B;
		if(ans <= C){
			System.out.println(C - ans);
		}
		else{
			System.out.println(0);
		}
		stdIn.close();
	}
}


Measured memory_bytes: 35784
/* code by AbhiTaker
         ____
        /    \
       /  __  \              _______      __       _   _    _____    _____
      /  /  \  \            |__   __|    /  \     | | / /  |  ___|  |  _  \
     /  /____\  \     ___      | |      / /\ \    | |/ /   | |__    | |_)  )
    /  /______\  \   |___|     | |     / /__\ \   |   /    |  __|   |    _/
   /  /        \  \            | |    / /----\ \  | |\ \   | |___   | |\ \
  /__/          \__\           |_|   /_/      \_\ |_| \_\  |_____|  |_| \_\
*/
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define M 1000000007
#define N 1000016
#define ff first.first
#define fs first.second
#define sf second.first
#define ss second.second
#define f first
#define s second
#define inf 9000000000000000000
vector<ll> v[N];
ll vis[N],ans;

void dfs(ll x) {

    for(auto node: v[x]) {
        if(!vis[node])
            dfs(node);
        vis[x] = max(vis[x], vis[node]);
    }
    vis[x] += 1;
    ans = max(ans, vis[x]);

}
int main()
{
   ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    ll n,m;
    cin>>n>>m;
    for(ll i=1; i<=m; i++) {
        ll a,b;
        cin>>a>>b;
        v[a].push_back(b);
    }

    for(ll i=1; i<=n; i++) {
        if(!vis[i])
            dfs(i);
    }

    cout<<ans-1<<"\n";

    return 0;
}


Measured memory_bytes: 31360
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
ll N,K,C;
cin>>N>>K>>C;
string s;
cin>>s;
ll a[N]={};
ll b[N]={};
ll counter=0;
for(ll i=0;i<N;i++){
if(s.at(i)=='o'){
counter++;
a[i]+=counter;
if(K==counter){
break;}
i=i+C;
}}
counter=0;
for(ll i=0;i<N;i++){
if(s.at(N-1-i)=='o'){
counter++;
b[N-1-i]=K+1-counter;
if(K==counter){
break;}
i=i+C;
}}
for(ll i=0;i<N;i++){
if(a[i]==b[i]&&a[i]!=0){
cout<<i+1<<endl;}}}


Measured memory_bytes: 6880
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <climits>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <queue>
#include <random>
#include <complex>
#include <regex>

using namespace std;

#define SHOW_VECTOR(v) {std::cerr << #v << "\t:";for(const auto& xxx : v){std::cerr << xxx << " ";}std::cerr << "\n";}
#define SHOW_MAP(v){std::cerr << #v << endl; for(const auto& xxx: v){std::cerr << xxx.first << " " << xxx.second << "\n";}}

void fact(long long N, map<long long, long long> &M) {
    for (long long i = 2; i * i <= N; i++) {
        if (N % i == 0) {
            long long c = 0;
            while (N % i == 0) c++, N /= i;
            M[i] += c;
        }
    }
    if (N != 1) M[N]++;
}

int main() {

    long long N;
    cin >> N;

    map<long long, long long> M;
    for (long long i = 1; i <= N; i++) fact(i, M);

    vector<pair<long long, long long>> vec;
    for (auto x : M) vec.push_back(make_pair(x.first, x.second));
  //  SHOW_MAP(vec);

    long long ans = 0;

    for (int i = 0; i < vec.size(); i++) {
        if (vec[i].second >= 4) {
            for (int j = i + 1; j < vec.size(); j++) {
                if (vec[j].second >= 4 && i != j) {
                    for (int k = 0; k < vec.size(); k++) {
                        if (vec[k].second >= 2 && i != j && j != k && i != k) {
                            ans++;
                        }
                    }
                }
            }
        }
    }

    //24, 2
    {
        for (int i = 0; i < vec.size(); i++) {
            if (vec[i].second >= 24) {
                for (int j = 0; j < vec.size(); j++) {
                    if (vec[j].second >= 2 && i != j) ans++;
                }
            }
        }
    }

    //14, 4
    {
        for (int i = 0; i < vec.size(); i++) {
            if (vec[i].second >= 14) {
                for (int j = 0; j < vec.size(); j++) {
                    if (vec[j].second >= 4 && i != j) ans++;
                }
            }
        }
    }

    //74
    {
        for (int i = 0; i < vec.size(); i++) {
            if (vec[i].second >= 74) ans++;
        }
    }


    cout << ans << endl;

    return 0;
}





























































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

using namespace std;

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

    int a;
    string s;
    cin >> a >> s;
    if (a >= 3200) cout << s << "\n";
    else cout << "red\n";
    
    return 0;
}

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

int main(){
  int h, w;
  while(1){
    cin >> h >> w;
    if(h+w==0) break;
    else{
      rep(i, h){
        rep(j, w){
          if((i==0||i==h-1)||(j==0||j==w-1)){
            cout << "#";
          }
          else cout << ".";
        }
        cout << endl;
      }
    }
    cout << endl;
  }

}



Measured memory_bytes: 3004
r, c = map(int, input().split())
list1 = [[0]*(c+1) for i in range(r+1)]
for i in range(r):
    list2 = list(map(int,input().split()))
    for j in range(c):
        list1[i][j] = list2[j]
        list1[i][c] += list2[j]
for j in range(c+1):
    for i in range(r):
        list1[r][j] += list1[i][j]
for i in range(r+1):
    for j in range(c+1):
        
        if j==c:
            print(list1[i][j], end='')
        else:
            print(list1[i][j], end=' ')
    print()


Measured memory_bytes: 6200
#include<iostream>
using namespace std;
typedef long long ll;

int main()
{
    ll n;
    cin>>n;
    ll ans=0;
    if(n%2==1) cout<<0<<endl;
    else{
    n/=2;
    while(n>=5){
        n/=5;
        ans+=n;
    }
    cout<<ans;
    }
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdlib>
#include<cstring>
#include<stack>
#include<queue>
#include<algorithm>
#include<vector>
#include<math.h>
#include<bitset>
#include<iomanip>
#include<numeric>
using namespace std;

typedef stack<int> IntStack;
typedef queue<int> IntQueue;

const double pi = 3.141592653589793;


//最大公約数
template<class T> T gcd(T a, T b)
{
	while (true)
	{
		T r;
		if (a%b == 0) return b;
		else
		{
			r = a % b;
			a = b;
			b = r;
		}
	}
}
//最小公倍数
template<class T> T lcm(T a, T b)
{
	return a / gcd(a, b)*b;
}
//文字0~9をint型0~9に変換
int char_to_int(char c)
{
	if (c == '0') return 0;
	if (c == '1') return 1;
	if (c == '2') return 2;
	if (c == '3') return 3;
	if (c == '4') return 4;
	if (c == '5') return 5;
	if (c == '6') return 6;
	if (c == '7') return 7;
	if (c == '8') return 8;
	if (c == '9') return 9;
	else return -1;
}
//a^b mod MODを計算
long long int ModPower(long long int a, long long int b, long long int MOD)
{
	if (b == 0) return 1;
	else if (b % 2 == 0)
	{
		long long int d = ModPower(a, b / 2, MOD);
		return (d*d) % MOD;
	}
	else
	{
		return (a*ModPower(a, b - 1, MOD)) % MOD;
	}
}
//nCr mod MODを計算
long long int ModCombi(long long int n, long long int r, long long int MOD)
{
	if (n == 0 || r == 0) return 1;

	long long int Kn = 1, Kr = 1, Knr = 1;

	long long int temp = 1;
	for (long long int i = 1; i <= n; i++)
	{
		temp *= i;
		temp %= MOD;
		if (i == n) Kn = temp;
		if (i == r) Kr = temp;
		if (i == n - r) Knr = temp;
	}

	long long int x = ModPower(Kr, MOD - 2, MOD);
	long long int y = ModPower(Knr, MOD - 2, MOD);

	long long int ans;
	ans = Kn * x;
	ans %= MOD;
	ans *= y;
	ans %= MOD;

	return ans;
}


/*ここまでテンプレ*//*ここまでテンプレ*//*ここまでテンプレ*//*ここまでテンプレ*/

int D, G;
int p[10], c[10];
int all[10], afts[11], aftp[11];

//最小問題数を返す
int serch(int i, int g)
{
	if (g <= 0) return 0;
	if (i == D) return 2000;
	if (afts[i] < g) return 2000;

	int m = 2000;
	//100*(i+1)を全部解く
	m = min(m, p[i] + serch(i + 1, g - 100 * (i + 1)*p[i] - c[i]));

	//100*(i+1)を全部解かない
	m = min(m, serch(i + 1, g));

	//100*(i+1)を中途半端に解く
	for (int j = 0; j < p[i]; j++)
	{
		if (afts[i + 1] + 100 * (i + 1)*j >= g)
		{
			m = min(m, j + aftp[i + 1]);
			break;
		}
	}

	return m;
}

int main()
{
	cin >> D >> G;
	for (int i = 0; i < D; i++)
	{
		cin >> p[i] >> c[i];
		all[i] = 100 * (i + 1)*p[i] + c[i];
	}
	afts[D - 1] = all[D - 1];
	aftp[D - 1] = p[D - 1];
	for (int i = D - 2; i >= 0; i--)
	{
		afts[i] = afts[i + 1] + all[i];
		aftp[i] = aftp[i + 1] + p[i];
	}

	cout << serch(0, G) << endl;

	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
int main(void) {
    int n=0;
    int i;
    char s[101];
    scanf("%s", s);
    int len=strlen(s);
    for (i=0; i<len/2; i++) {
        if (s[i] != s[len-i-1]) {
            n++;
        }
    }
    printf("%d", n);
    return 0; 
}

Measured memory_bytes: 128
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		StringBuilder sb = new StringBuilder();

		while (true) {
			String line1 = sc.nextLine();
			if (line1.equals("-")) {
				break;
			}
			sb = new StringBuilder(line1);

			String line2 = sc.nextLine();
			int m = Integer.parseInt(line2);
			for (int i = 0; i < m; i++) {
				String line3 = sc.nextLine();
				int h = Integer.parseInt(line3);
				sb.append(sb.substring(0, h));
				sb.delete(0, h);
			}
			System.out.println(sb);
		}

	}

}

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

int main(void)
{
	int n,i,j,count;
	int suzi[999999];

	while(scanf("%d",&n) != EOF){
		count = 0;
		for(i = 0;i <= n;i ++){
			suzi[i] = 1;/*素数なら１，そうでないなら０とする*/
		}
		for(i = 2;i <= sqrt(n); i++){
	  		for(j = 2;i * j <= n;j ++){
				suzi[i * j] = 0;/*iの倍数を０にする*/
			}
		}
		for(i = 2;i <= n;i ++){
			if(suzi[i] == 1){
				count ++;
			}
		}
		printf("%d\n",count);
	}
	return 0;
}

Measured memory_bytes: 4500
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Globalization;
using System.Linq;


namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            ulong yokin = 100;
            ulong mokuhyo = ulong.Parse(Console.ReadLine());
            int year = 0;
            while(yokin < mokuhyo)
            {
                year++;
                yokin = (ulong)(yokin * 1.01);
            }
            Console.WriteLine(year);
        }
            
    }
}


Measured memory_bytes: 27608
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>

int main()
{
   static long i,j,k;
   long n;
   long cnt = 0;
   long left,right,mid;
   long ans = 0;
   int a,b,c,d;
   static int e[10000];

   scanf("%d %d %d",&a,&b,&c);
   for(i = 1; i <= sqrt( (double)c ); i++) {
      if(c % i == 0)
         e[j++] = i;
   }
   for(i = 0;i < j; i++) {
      if (e[i] > b)
         break;
      if (a <= e[i])
         cnt++;
   }
   d = 0;
   if (e[j-1]*e[j-1] == c)
      d = 1;
   for (i = j-1-d; i > -1; i--) {
      if (c/e[i] > b)
         break;
      if (a <= c/e[i])
         cnt++;
   }
   printf("%ld\n",cnt);
   return 0;
}

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

int main() {
  int N, K;
  string S;
  cin >> N >> K >> S;

  int m = 1;
  for (int i=0; i<N-1; ++i) {
    if (S[i] != S[i+1]) ++m;
  }

  cout << min(N-1, N - m + 2*K) << "\n";
}


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

int main() {
  int A, B;
  int count=0;
  cin >> A >> B;
  
  for (int i = A; i <= B; i++) {
    if (i%10 == i/10000 && i/10%10 == i/1000%10) count++;
  }
  
  cout << count << endl;
}


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



int main() {
    int n;
    string s;
    cin >> n >> s;
    
    int ans = n;
    rep(i,n-1) {
        if(s[i] == s[i+1])
            ans--;
    }
    
    cout << ans << endl;
    
    
    return 0;
}


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

int main(){
    int N,W;
    int weight[101];
    int value[101];
    cin>>N>>W;
    for(int i=1;i<=N;i++){
        cin>>weight[i]>>value[i];
    }
    long long dp[101][100001];
    for(int w=0;w<=W;w++){
        dp[0][w]=0;
    }
    for(int i=1;i<=N;i++){
        for(int w=0;w<=W;w++){
            if(w>=weight[i]){
                dp[i][w]=max(dp[i-1][w-weight[i]]+value[i],dp[i-1][w]);
            }else{
                dp[i][w]=dp[i-1][w];
            }
        }
    }
    cout<<dp[N][W]<<endl;
    return 0;
}

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

using namespace std;

#define rep(i, n) for(int i = 0; i < (int)n; ++i)
#define FOR(i, a, b) for(int i = a; i < (int)b; ++i)
#define rrep(i, n) for(int i = ((int)n - 1); i >= 0; --i)

typedef long long ll;
typedef long double ld;

const ll Inf = 1e18;
const double EPS = 1e-9;
const int MOD = 1e9 + 7;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(0);
    ll n;
    int k;
    cin >> n >> k;
    int res = 0;
    while (n / k) {
        res++;
        n /= k;
    }
    cout << res + 1 << endl;
    
    return 0;
}



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

ll N, K, t, d, sum, ans;
vector<ll> F, S;
vector<pair<ll, ll>> v;
map<ll, ll> mp;

main() {
    cin >> N >> K;
    for (int i = 0; i < N; i++) {
        cin >> t >> d;
        v.push_back(make_pair(t, d));
    }
    sort(v.rbegin(), v.rend());
    for (int i = 0; i < v.size(); i++) {
        pair<ll, ll> p = v[i];
        if (mp[p.first] == 0) F.push_back(p.second);
        else S.push_back(p.second);
        mp[p.first]++;
    }
    ll M = S.size(), L = F.size();
    sort(F.rbegin(), F.rend());
    sort(S.rbegin(), S.rend());
    for (int i = 0; i < min(K, L); i++) sum += F[i];
    if (K > L) {
        int check = 0;
        for (ll i = 0; i < K - L; i++, check = i) sum += S[i];
        ans = sum + L * L;
        for (ll j = L - 1; j > 0 && check < M; check++, j--) {
            sum = sum - F[j] + S[check];
            ans = max(ans, sum + j * j);
        }
    }
    else {
        ans = sum + K * K;
        for (ll i = 0; i < K && i < M; i++) {
            sum = sum - F[K - 1 - i] + S[i];
            ans = max(ans, sum + (K - i - 1) * (K - i - 1));
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 8816
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func main() {
	fsc := NewFastScanner()
	_ = fsc.NextInt()
	A := fsc.NextIntArray()
	result := 0
	for true {
		for i, v := range A {
			if v%2 != 0 {
				fmt.Println(result)
				return
			}
			A[i] /= 2
		}
		result++
	}

}

//template
type FastScanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func NewFastScanner() *FastScanner {
	rdr := bufio.NewReaderSize(os.Stdin, 1024)
	return &FastScanner{r: rdr}
}
func (s *FastScanner) Next() string {
	s.pre()
	start := s.p
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			break
		}
	}
	result := string(s.buf[start:s.p])
	s.p++
	return result
}
func (s *FastScanner) NextLine() string {
	s.pre()
	start := s.p
	s.p = len(s.buf)
	return string(s.buf[start:])
}
func (s *FastScanner) NextInt() int {
	v, _ := strconv.Atoi(s.Next())
	return v
}
func (s *FastScanner) NextInt64() int64 {
	v, _ := strconv.ParseInt(s.Next(), 10, 64)
	return v
}

func (s *FastScanner) NextIntArray() []int {
	s.pre()
	start := s.p
	result := []int{}
	for ; s.p < len(s.buf)+1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 0)
			result = append(result, int(v))
			start = s.p + 1
		}
	}

	return result
}

func (s *FastScanner) NextInt64Array() []int64 {
	s.pre()
	start := s.p
	result := []int64{}
	for ; s.p < len(s.buf)+1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 64)
			result = append(result, v)
			start = s.p + 1
		}
	}
	return result
}

func (s *FastScanner) pre() {
	if s.p >= len(s.buf) {
		s.readLine()
		s.p = 0
	}
}
func (s *FastScanner) readLine() {
	s.buf = make([]byte, 0)
	for {
		l, p, e := s.r.ReadLine()
		if e != nil {
			panic(e)
		}
		s.buf = append(s.buf, l...)
		if !p {
			break
		}
	}
}

//Max,Min
func IntMax(a, b int) int {
	if a < b {
		return b
	}
	return a
}

func Int64Max(a, b int64) int64 {
	if a < b {
		return b
	}
	return a
}
func Float64Max(a, b float64) float64 {
	if a < b {
		return b
	}
	return a
}

func IntMin(a, b int) int {
	if a > b {
		return b
	}
	return a
}

func Int64Min(a, b int64) int64 {
	if a > b {
		return b
	}
	return a
}
func Float64Min(a, b float64) float64 {
	if a > b {
		return b
	}
	return a
}

//Gcd
func IntGcd(a, b int) int {
	if a < b {
		b, a = a, b
	}
	if b == 0 {
		return a
	}
	return IntGcd(b, a%b)
}
func Int64Gcd(a, b int64) int64 {
	if a < b {
		b, a = a, b
	}
	if b == 0 {
		return a
	}
	return Int64Gcd(b, a%b)
}

func IntAbs(a int) int {
	if a < 0 {
		a *= -1
	}
	return a
}

func Int64Abs(a int64) int64 {
	if a < 0 {
		a *= -1
	}
	return a
}


Measured memory_bytes: 640
#include <stdio.h>
#include <string.h>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

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

int n, m, c;
int p[16][16], f[16][16];
int a[16], vis[16][16];

void draw(int x, int y, int c, int to) {
    if (vis[x][y]) return ;
    vis[x][y] = 1;
    if (f[x][y] != c) return ;
    f[x][y] = to;
    rep (d, 4) draw(x+dx[d], y+dy[d], c, to);
}

int kount(int x, int y, int c) {
    if (vis[x][y]) return 0;
    vis[x][y] = 1;
    if (f[x][y] != c) return 0;
    int ans = 1;
    rep (d, 4) ans += kount(x+dx[d], y+dy[d], c);
    return ans;
}

int main() {
    for (;;) {
        scanf("%d%d%d", &n, &m, &c);
        if (n == 0 && m == 0 && c == 0) return 0;
        memset(p, -1, sizeof(p));
        rep (i, n) rep (j, m) scanf("%d", p[i+1]+j+1);
        n += 2, m += 2;
        int ans = 0;
        rep (b, 6*6*6*6) {
            int t = b;
            rep (i, 4) { a[i] = t%6+1; t /= 6; }
            a[4] = c;
            rep (i, n) rep (j, m) f[i][j] = p[i][j];
            rep (i, 5) {
                memset(vis, 0, sizeof(vis));
                draw(1, 1, f[1][1], a[i]);
            }
            memset(vis, 0, sizeof(vis));
            ans = max(ans, kount(1, 1, f[1][1]));
        }
        printf("%d\n", ans);
    }
}

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

int main(){
  multiset<int> st;
  for(int i=0;i<6;i++){
    int a;
    cin >>a;
    st.insert(a);
  }
  for(int i=1;i<5;i++){
    if(st.count(i) == 3){
      cout<<"NO"<<endl;
      return 0;
    }
  }
  cout <<"YES"<<endl;
}

Measured memory_bytes: 256
def examC():
    ans = 0
    print(ans)
    return

def examD():
    ans = 0
    print(ans)
    return

def examE():
    class combination():
        # 素数のmod取るときのみ　速い
        def __init__(self, n, mod):
            self.n = n
            self.mod = mod
            self.fac = [1] * (n + 1)
            self.inv = [1] * (n + 1)
            for j in range(1, n + 1):
                self.fac[j] = self.fac[j - 1] * j % mod

            self.inv[n] = pow(self.fac[n], mod - 2, mod)
            for j in range(n - 1, -1, -1):
                self.inv[j] = self.inv[j + 1] * (j + 1) % mod

        def comb(self, n, r):
            if r > n or n < 0 or r < 0:
                return 0
            return self.fac[n] * self.inv[n - r] * self.inv[r] % self.mod
        def combinv(self,n,r):
            if r > n or n < 0 or r < 0:
                return 0
            return self.inv[n] * self.fac[n - r] * self.fac[r] % self.mod
    N, A, B, C, D = LI()
    Comb = combination(N+1,mod)
    dp = [[0]*(N+1)for _ in range(B+1)]
    for i in range(A):
        dp[i][0] = 1
    for i in range(A,B+1):
        for j in range(N+1):
            loop = (N-j) // i + 1
            cnt_comb = 1
            dp[i][j] += dp[i-1][j]
            for k in range(C):
                cnt_comb *= Comb.comb(N-j-k*i,i)
                cnt_comb %= mod
            for k in range(C,min(loop,D+1)):
                dp[i][k*i+j] += dp[i-1][j]*cnt_comb * Comb.inv[k]
                dp[i][k*i+j] %= mod
                cnt_comb *= Comb.comb(N-j-k*i,i)
                cnt_comb %= mod
                #print(Comb.comb(N-j-k*i,i),Comb.inv[k+1])
    #print(dp)
    ans = dp[-1][-1]%mod
    print(ans)
    return

def examF():
    ans = 0
    print(ans)
    return


from decimal import Decimal as dec
import sys,bisect,itertools,heapq,math,random
from copy import deepcopy
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
def I(): return int(input())
def LI(): return list(map(int,sys.stdin.readline().split()))
def DI(): return dec(input())
def LDI(): return list(map(dec,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet,_ep
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
_ep = dec("0.000000000001")
alphabet = [chr(ord('a') + i) for i in range(26)]
alphabet_convert = {chr(ord('a') + i): i for i in range(26)}

sys.setrecursionlimit(10**7)

if __name__ == '__main__':
    examE()

"""
10 1 1 1 10
"""

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

int main(){
  int N, K, a, b, c;
  cin >> N >> K;
  a = 1;
  b = 0;
  c = 0;
  for(int i = 0; i < N; i++){
    b = a*2;
    c = a + K;
    if(b >= c){
      a = c;
    }
    else{
      a = b;
    }
  }
  cout << a << endl;
}
     

Measured memory_bytes: 256
#![allow(unused_imports)]
#![allow(non_snake_case)]

use std::cell::RefCell;
use std::cmp::{max, min, Ordering};
use std::collections::*;
use std::fmt::{Debug, Formatter, Write as FmtWrite};
use std::io::{stderr, stdin, BufRead, Write};
use std::mem::{replace, swap};
use std::ops::*;
use std::rc::Rc;

// -----------------------------------------------
// Framework <https://github.com/vain0x/procon>
// -----------------------------------------------

#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), stderr());
            writeln!(err, "\x1B[33m{}\x1B[0m = {:?}", e, $e).unwrap()
        })*
    };
}

#[allow(unused_macros)]
macro_rules! read {
    ([$t:ty] ; $n:expr) =>
        ((0..$n).map(|_| read!([$t])).collect::<Vec<_>>());
    ($($t:ty),+ ; $n:expr) =>
        ((0..$n).map(|_| read!($($t),+)).collect::<Vec<_>>());
    ([$t:ty]) =>
        (rl().split_whitespace().map(|w| w.parse().unwrap()).collect::<Vec<$t>>());
    ($($t:ty),*) => {{
        let buf = rl();
        let mut w = buf.split_whitespace();
        ($(w.next().unwrap().parse::<$t>().unwrap()),*)
    }};
}

#[allow(dead_code)]
fn rl() -> String {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();
    buf.trim_right().to_owned()
}

// -----------------------------------------------
// Solution
// -----------------------------------------------

fn main() {
    let (X, Y) = read!(i32, i32);
    println!("{}", X + Y / 2)
}


Measured memory_bytes: 4352
#include <iostream>
#include <cstdio>
#include <cstring>

using namespace std;

#define DIM 55

char A[DIM][DIM], B[DIM][DIM];

int main() {
    int N, M;

    cin >> N >> M;

    for(int i = 1; i <= N; ++i) {
        for(int j = 1; j <= N; ++j) {
            cin >> A[i][j];
        }
    }

    for(int i = 1; i <= M; ++i) {
        for(int j = 1; j <= M; ++j) {
            cin >> B[i][j];
        }
    }

    for(int i = 1; i <= N - M + 1; ++i) {
        for(int j = 1; j <= N - M + 1; ++j) {
            int gasit = 1;
            for(int a = 1; gasit && a <= M; ++a) {
                for(int b = 1; gasit && b <= M; ++b) {
                    if(A[i + a - 1][j + b - 1] != B[a][b]) {
                        gasit = 0;
                    }
                }
            }

            if(gasit) {
                cout << "Yes\n";
                return 0;
            }
        }
    }

    cout << "No\n";

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cassert>
#include <climits>
#include <bitset>
#include <stack>
#include <queue>
#include <iomanip>
#include <limits>
#include <string>
#include <cmath>
#include <set>
#include <map>
#include <math.h>
#include <algorithm>
#include <vector>
#include <string.h>
#include <time.h>

using namespace std;

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

long long int INF = 1e18;
long long int mod = 1000000007;
double Pi = 3.1415926535897932384626;

vector<ll> G[500005];
vector<P> tree[500010];
priority_queue <ll> pql;
priority_queue <P> pqp;
//big priority queue
priority_queue <ll,vector<ll>,greater<ll> > pqls;
priority_queue <P,vector<P>,greater<P> > pqps;
//small priority queue
//top pop

int dx[8]={1,0,-1,0,1,1,-1,-1};
int dy[8]={0,1,0,-1,1,-1,-1,1};
char dir[] = "DRUL";
//↓,→,↑,←

#define p(x) cout<<x<<endl;
#define el cout<<endl;
#define pe(x) cout<<x<<" ";
#define ps(x) cout<<fixed<<setprecision(15)<<x<<endl;
#define pu(x) cout<<x;
#define re(i,n) for(i=0;i<n;i++);
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define hoge cout << hoge << endl;
#define deba(x) cout<< #x << " = " << x <<endl

ll rui(ll abc,ll bed){
    //abcのbed乗を計算する
    if(bed==0){return 1;}
    else{
        ll ced = rui(abc,bed/2);
        ced *= ced;
        ced %= mod;
        if(bed%2==1){ced*=abc; ced%=mod;}
        return ced;
    }
}
ll gcd(ll number1,ll number2){
	if(number1 > number2){
		swap(number1,number2);
	}
	if(number1 == 0 || number1 == number2){
		return number2;
	}else{
		return gcd(number2 % number1,number1);
	}
}

ll i,j,k,ii,jj,r,l;
ll n,m,num,sum,ans;
ll a,b,c,d,e,f,g,h,w;
ll x[1000005],y[1000005],z[1000005];
bool flag,dame;
char s[500005];
ll dp[4000][4000];

int main(){	
	cin >> n;
	ll p = 2;
	for(i=2;i<=n;i++){
		num = i;
		p = 2;
		while(1){
			while(num % p == 0){
				x[p]++;
				num /= p;
			}
			p++;
			if(num == 1)break;
		}
	}
	num = 0;
	for(i=1;i<=100;i++){
		//pe(x[i]);
		if(x[i] >= 74)ans += 1;
		for(j=1;j<=100;j++){
			if(i == j)continue;
			if(x[i] >= 14 && x[j] >= 4)ans += 1;
			if(x[i] >= 24 && x[j] >= 2)ans += 1;
			for(k=1;k<=100;k++){
				if(i == k || j == k)continue;
				if(k > j)continue;
				if(x[i] >= 2 && x[j] >= 4 && x[k] >= 4)ans += 1;
				//if(x[i] >= 4 && x[j] >= 2 && x[k] >= 4)num += 1;
				//if(x[i] >= 4 && x[j] >= 4 && x[k] >= 2)num += 1;
			}
		}
	}
	//el;
	//p(num);
	ans += num / 2;
	p(ans);
	return 0;
}



Measured memory_bytes: 27264
#include <iostream>
#include <stdio.h>
#include <ctype.h>
int main()
{
    char ch,h;
  //  int h;
        while(true){
        scanf("%c", &ch);
        if (islower(ch)){
            h=toupper(ch);
        }else{
            h=tolower(ch);}
        std::cout << h;
        if ( ch == '\n' ) break;
    }
    return 0;
}

Measured memory_bytes: 3140
#include <iostream>
#include <cmath>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <map>
using namespace std;
typedef pair<int, int> P;
typedef long long ll;
const int MOD = 1000000007;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)

int main(){
  string s,t;
  cin >> s >> t;
  ll shead = 0;
  ll times = 0;
  rep(i, t.size()){
    int pos = s.find(t[i]);
    if(pos == -1){
      cout << -1;
      return 0;
    }
    int ppos = s.substr(shead).find(t[i]);
    if(ppos == -1){
      times++;
      shead = pos+1;
    }else{
      shead += ppos+1;
    }
  }
  cout << (times*s.size() + shead);
}


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

int main(void) {
	int a, b, c;
	char buf[128], *ch;

	fgets(buf, sizeof(buf), stdin);
	ch = strtok(buf, " ");
	a = atoi(ch);
	ch = strtok(NULL, " ");
	b = atoi(ch);
	ch = strtok(NULL, " ");
	c = atoi(ch);

	if(a == 5 && b == 5 && c == 7) {
		printf("YES\n");
	} else if (a == 5 && b == 7 && c == 5) {
		printf("YES\n");
	} else if (a == 7 && b == 5 && c == 5) {
		printf("YES\n");
	} else {
		printf("NO\n");
	}

	return 0;
}


Measured memory_bytes: 2016
/*
    ____        __
   / __ \____  / /_  ____ _____ ___
  / /_/ / __ \/ __ \/ __ `/ __ `__ \
 / _, _/ /_/ / / / / /_/ / / / / / /
/_/ |_|\____/_/ /_/\__,_/_/ /_/ /_/
*/
#include<bits/stdc++.h>

typedef long long ll ;

#define X   first
#define Y   second
#define mp  make_pair
#define pii pair<int , int>
#define vec vector
#define vpii vector<pair<int , int>>
#define i_n   int i = 0 ; i< n ; i++
#define cn  int n ; cin>>n
#define file_io freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
#define migmig ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define cina int a[n] ; for(int i = 0 ; i < n ; i++) cin>>a[i]
#define pb push_back
#define SZ(x) ll(x.size())

using namespace std;
const int maxn = 1000*100+5 ;

int main()
{
	migmig ;
	ll r , d , x ; 
	cin>>r>>d>>x ; 
	for(int i = 0 ; i < 10 ; i ++)
	{
		x = r * x - d ; 
		cout<<x ; 
		cout<<endl ; 
	}
}
//////
////////
///////////



Measured memory_bytes: 256
use std::io;

#[allow(unused_macros)]
macro_rules! input {
    ( $($x:expr ),*) => {
        {
            let temp_str = input_line_str();
            let mut split_result_iter = temp_str.split_whitespace();
                $(
                let buf_split_result = split_result_iter.next();
                let buf_split_result = buf_split_result.unwrap();
                    ($x) = buf_split_result.parse().unwrap();
                )*
        }
    };
}

#[allow(dead_code)]
fn input_line_str() -> String {
    let mut s = String::new();
    io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

#[allow(dead_code)]
fn p<T>(t: T)
where
    T: std::fmt::Display,
{
    println!("{}", t);
}

const SPLIT_DELIMITER: char = ' ';

#[allow(dead_code)]
fn input_vector<T>() -> Vec<T>
where
    T: std::str::FromStr,
{
    let mut v: Vec<T> = Vec::new();

    let s = input_line_str();
    let split_result = s.split(SPLIT_DELIMITER);
    for z in split_result {
        let buf = match z.parse() {
            Ok(r) => r,
            Err(_) => panic!("Parse Error"),
        };
        v.push(buf);
    }
    v
}

fn main() {
    let n: usize;
    let mut count_zero: isize = 0;
    let mut count_one: isize = 0;
    let mut count_two: isize = 0;
    input!(n);
    let mut v: Vec<usize> = input_vector();

    for z in &mut v {
        if *z % 4 == 0 {
            count_two += 1;
        } else if *z % 2 == 0 {
            count_one += 1;
        } else {
            count_zero += 1;
        }
    }
    if count_zero - count_two > 1 {
        println!("No");
    } else if count_zero > count_two {
        if count_one == 0 {
            println!("Yes");
        } else {
            println!("No");
        }
    } else {
        println!("Yes");
    }
}

Measured memory_bytes: 8444
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
int n;
long long a,b,C,D;
int main(){
	cin>>n>>a>>b>>C>>D;
	b-=a;n--;
	bool ok=false;
	for(int i=0;i<=n;i++){
		long long k=i*D-(n-i)*C;
		long long r=i*D-(n-i)*D;
		if(r<=b&&b<=k)ok=true;
		if(r<=-b&&-b<=k)ok=true;
		//cout<<r<<" "<<k<<endl;
	}
	if(ok)cout<<"YES"<<endl;
	else cout<<"NO"<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll =long long ;
ll gcd(ll p,ll q){
  if(p%q==0)return q;
  return gcd(q,p%q);
}
int main() {
  string a;
  cin>>a;
  ll b=a.size();
  ll c=0;
  for(ll i=0;i<b/2;i++){
    if(a.at(i)!=a.at(b-1-i)){
      c+=1;
    }
  }
  cout<<c<<endl;
  return 0;
}


Measured memory_bytes: 3636
n=int(input())
l=list(map(int,input().split()))

l.sort()
l.append(10**9)
cnt=0
i=0
#print(l)

while i<n-2:
    j=i+1
    while j<n-1:
        LL=j+1
        RR=n-1
        #print("#",l[i],l[j],l[LL],l[RR])
        while LL<=RR:
            k=(LL+RR)//2
            if k==n:
                break
            #print(l)
            #print(i,j,LL,RR,k)
            #print(l[i]+l[j],l[k],l[k+1])
            if l[i]+l[j]>l[k] and l[i]+l[j]<=l[k+1]:
                cnt+=k-j
                break
            elif LL==RR:
                break
            elif l[i]+l[j]<=l[k]:
                RR=k
            elif l[i]+l[j]>l[k]:
                LL=k+1
            elif l[i]+l[j]<l[k] and k==j+1:
                break
        j+=1
    i+=1

print(cnt)


Measured memory_bytes: 44500
import java.util.Arrays;
import java.util.Scanner;

public class Main {

    private static boolean isSosu( int x ) {
        boolean result = true;
        for ( int i = 2; i < x; i++) {
            if (x % i == 0) {
                result = false;
            }
        }
        return result;
    }

    public static void main(String[] args) {

        Scanner in = new Scanner(System.in);
        String[] params = in.nextLine().split(" " );
        int x = Integer.parseInt( params[0] );

        while( true ){
            if( isSosu(x) ){
                System.out.println( x );
                break;
            }
            x++;
        }

    }

}


Measured memory_bytes: 23892
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;
typedef long long ll;

int main(int argc, char *argv[])
{
  ll n;
  cin >> n;
  int x, y;

  vector<pair<int, int>> xys(n);
  double distance = 0.0;

  for (int i = 0; i < n; ++i) {
    cin >> x >> y;
    xys.at(i) = make_pair(x, y);
  }

  int arr[n];
  for (int i = 0; i < n; ++i) arr[i] = i;

  do {
    for (int i = 0; i < n - 1; ++i) {
      double xd = sqrt(pow(xys[arr[i]].first - xys[arr[i + 1]].first, 2) + pow(xys[arr[i]].second - xys[arr[i+ 1]].second, 2));
      distance += xd;
    }
  } while(next_permutation(arr, arr + n));

  int fact = 1;
  for (int i = 1; i <= n; ++i) {
    fact *= i;
  }

  printf("%.10f\n", distance / double(fact));
}


Measured memory_bytes: 888
#pragma GCC optimize("Ofast")
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define PI 3.141592
#define MOD7 1000000007
#define LL_INF 9000000000000000000
#define LL_MINF -9000000000000000000
#define INT_INF 2000000000
#define INT_MINF -2000000000
#define all(a) (a).begin(), (a).end()
#define fi first
#define se second
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};


int main(){
    int N;
    cin >> N;
    vector<int> A1(N), A2(N);
    for(int i = 0; i < N; i++) cin >> A1[i];
    for(int i = 0; i < N; i++) cin >> A2[i];
    vector<int> sumA1(N), sumA2(N);
    sumA1[0] = A1[0];
    sumA2[0] = A2[0];
    for(int i = 1; i < N; i++){
        sumA1[i] = sumA1[i - 1] + A1[i];
        sumA2[i] = sumA2[i - 1] + A2[i];
    }
    ll max_n = 0;
    for(int turn = 0; turn < N; turn++){
        ll sum = 0;
        sum += sumA1[turn];
        if(turn == 0) sum += sumA2.back();
        else sum+= sumA2.back() - sumA2[turn - 1];
        max_n = max(max_n, sum);
    }
    cout << max_n << endl;
}

Measured memory_bytes: 3616
using System;
class p
{
  static void Main()
  {
    int R = int.Parse(Console.ReadLine());
    if (R < 1200) {
      Console.WriteLine("ABC");
    } else if (R < 2800) {
      Console.WriteLine("ARC");
    } else {
      Console.WriteLine("AGC");
    }
  }
}

Measured memory_bytes: 11092
#include <bits/stdc++.h>
using namespace std;
#define fastIO ios::sync_with_stdio(0), cin.tie(0)
#define endl '\n'
#define ft first
#define sd second
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<char,char> pcc;
typedef pair<long long,int> pll;

const int MAX = 100005;
vector<int> uniones[MAX];
int anterior[MAX];
int n,m,ctr=1;

void bfs(int u) {
    queue<int> q;
    q.push(u);
    anterior[u]=0;
    while(q.size()){
        u=q.front();
        q.pop();
        for(auto v:uniones[u]){
            if(anterior[v]==-1){
                anterior[v]=u;
                q.push(v);
                ctr++;
            }
        }
    }
}

int main(){
    #ifndef LOCAL
        fastIO;
    #endif
    int a,b;
    memset(anterior,-1,sizeof(anterior));
    cin >> n >> m;
    for(int i=0;i<m;i++){
        cin >> a >> b;
        uniones[a].push_back(b);
        uniones[b].push_back(a);
    }
    bfs(1);
    if(ctr==n){
        cout << "Yes" << endl;
        for(int i=2;i<=n;i++){
            cout << anterior[i] << endl;
        }
    }
    else cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 10536
#include <iostream>
#include <vector>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <sstream>
#include <algorithm>
using namespace std;

int dp[2505][2505];

int todig(string a)
{
	stringstream ss(a);
	int res;
	ss >> res;

	return res;
}

int main()
{
	int W,H;
	while(cin >> W >> H, W||H){
		int gx,gy,n=0;

		vector<vector<pair<int, int> > > pos(W*H);
		for(int i=0; i<H; i++)
		for(int j=0; j<W; j++) {
			string s;
			cin >> s;
			if(s == "S") pos[0].push_back(make_pair(j, i));
			if(s == "G") { gx = j; gy = i; };
			if(isdigit(s[0])) {
				int d = todig(s);
				n = max(n, d);
				pos[d].push_back(make_pair(j, i));
			}
		}

		pos[n + 1].push_back(make_pair(gx, gy));
		++n;

		for(int i=1; i<=n; i++) {
			for(int k=0; k<pos[i].size(); k++)
				dp[k][i] = (1<<28);

			for(int j=0; j<pos[i-1].size(); j++)
			for(int k=0; k<pos[i].size(); k++) {
				dp[k][i] = min(dp[k][i], dp[j][i-1] + abs(pos[i-1][j].first - pos[i][k].first) + abs(pos[i-1][j].second - pos[i][k].second));
			}
		}

		cout << dp[0][n] << endl;
	}
}

Measured memory_bytes: 5164
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
typedef long long ll;
typedef unsigned long long ull;


int main(){
  int X;
  cin >> X;
  if(X == 3 || X == 5 || X == 7) cout << "YES" << endl;
  else cout << "NO" << endl;
  
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;


void ABC167A()
{
	string S, T;
	cin >> S;
	cin >> T;
	int n = S.size();
	int m = T.size();
	if (m != n + 1)
	{
		cout << "No" << endl;
		return;
	}
	for (int i = 0; i < n; ++i)
	{
		if (S[i] != T[i])
		{
			cout << "No" << endl;
			return;
		}
	}
	cout << "Yes" << endl;

}
int main()
{
	ABC167A();
	return 0;
}

Measured memory_bytes: 3632
#include<stdio.h>
int main()
{
    long long a[15],i,j,t;
    for(i=1;i<=10;i++)
    {
        scanf("%lld",&a[i]);
    }
    for(i=1;i<=10;i++)
    {
        for(j=1;j<10;j++)
        {
            if(a[j]<a[j+1])
            {
                t=a[j];
                a[j]=a[j+1];
                a[j+1]=t;
            }
        }
    }
    for(i=1;i<=3;i++)
    {
        printf("%lld\n",a[i]);
    }
    return 0;
}

Measured memory_bytes: 600
# -*- coding: utf-8 -*-
from sys import stdin
# import numpy as np
# import sys
# sys.setrecursionlimit(10**4)

def _li(): return list(map(int, stdin.readline().split()))
def _li_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def _lf(): return list(map(float, stdin.readline().split()))
def _ls(): return stdin.readline().split()
def _i(): return int(stdin.readline())
def _f(): return float(stdin.readline())
def _s(): return stdin.readline()[:-1]


N = _i()

groups = []
if N % 2 == 0:
    for i in range(1, N//2+1):
        groups.append([i, N-i+1])
else:
    for i in range(1, N//2+1):
        groups.append([i, N-i])
    groups.append([N])

ans = []
for i in range(len(groups)):
    for j in range(i+1, len(groups)):
        if i == j:
            continue
        else:
            for g1 in groups[i]:
                for g2 in groups[j]:
                    ans.append([g1, g2])

print(len(ans))
for a in ans:
    print(a[0], a[1])


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

int main(){
    int a[3];
    int fi, se;
    fi = 0;
    se = 0;

    for(int i = 0; i < 3; i++){
        cin >> a[i];

        if(a[i] == 5){
            fi++;
        }else if(a[i] == 7){
            se++;
        }
    }

    if(fi == 2 && se == 1){
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }
}

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


int main(){
    char o[] = {'0','1','2','3','5','7','8','9'};
    char res[255];
    long long n = 10;

    while(scanf("%lld", &n) != EOF){
        if(n == 0) break;
        sprintf(res, "%llo", n);

        for(int i = 0; i < 255; i++){
            if(res[i] == '\0') break;
            res[i] = o[res[i] - '0'];
        }

        printf("%s\n", res);
    }

    return 0;
}

Measured memory_bytes: 2712