akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
int main(void){
        int a[3];
        int i,m;
        for(i=0;i<3;i++) scanf("%d",&a[i]);
        m=a[0];
        for(i=1;i<3;i++) if(m<a[i]) m=a[i];
        printf("%d\n",10*m-m+a[0]+a[1]+a[2]);
        return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define int long long 
using namespace std;

signed main() {
  int N;
  cin >> N;
  
  map<string, int> M;
  for( int i = 0; i < N; i++ ){
    string S;
    cin >> S;
    if( M.count(S) ){
      M.at(S)++;
    }else{
      M[S] = 1;
    }
  }
  
  int cnt = 0;
  for( auto p : M ){
    if( p.second > cnt ) cnt = p.second;
  }
  
  for( auto p : M ){
    if( p.second == cnt ) cout << p.first << endl;
  }

}

Measured memory_bytes: 25216
#include <iostream>
#include <vector>
#include <cstdio>
#include <algorithm>
#include <set>
#include <map>
#include <cassert>
#include <numeric>
#include <string>
#include <cstring>
#include <cmath>
using namespace std;

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

typedef long long int int64;

const int N = (int) 5e5 + 100;
char str[N];
const int ALP = 26;
int a[N];
int pos2get[N][ALP + 1];
const int LOG = 20;
int pos[N][LOG];


int main(int,  char **)
{
#ifdef LOCAL
	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);
#endif

	scanf("%s", str);
	int n = strlen(str);
	for (int i = 0; i < n; i++)
		a[i] = str[i] - 'a';

	for (int i = 0; i <= ALP; i++)
	{
		pos2get[n][i] = n + 1;
		pos2get[n + 1][i] = n + 1;
	}
	for (int i = n - 1; i >= 0; i--)
	{
		pos2get[i][a[i] ] = i + 1;
		for (int j = a[i] + 1; j <= ALP; j++)
			pos2get[i][j] = pos2get[pos2get[i][j - 1] ][j - 1];
		for (int j = 0; j < a[i]; j++)
			pos2get[i][j] = pos2get[pos2get[i][ALP] ][j];
	}
/*
	for (int i = 0; i <= n; i++)
	{
		eprintf("%d) ", i);
		for (int j = 0; j <= ALP; j++)
			eprintf("%c:%d ", 'a' + j, pos2get[i][j] );
		eprintf("\n");
	}
*/
	for (int i = n + 1; i >= 0; i--)
	{
		pos[i][0] = pos2get[i][ALP];
		for (int j = 1; j < LOG; j++)
			pos[i][j] = pos[pos[i][j - 1] ][j - 1];
	}

	int q;
	scanf("%d", &q);
	for (int it = 0; it < q; it++)
	{
		int l, r;
		scanf("%d%d", &l, &r);
		l--;
		r--;
		
		for (int i = LOG - 1; i >= 0; i--)
			if (pos[l][i] <= r + 1)
			{
				l = pos[l][i];
			}
//		eprintf("l = %d, r = %d\n", l, r);
		printf( (l == r + 1) ? "Yes\n" : "No\n");
	}

	return 0;
}



Measured memory_bytes: 94848
#include <bits/stdc++.h>
#define REP(i, s, n) for (int i = s; i < n; i++)
#define ALL(a) a.begin(), a.end()
#define MOD 1000000007
using namespace std;
typedef long long ll;

int main() {
    int N; ll K; cin >> N >> K;
    vector<int> A(N);
    REP(i, 0, N) {
        int a; cin >> a;
        A[i] = a;
    }


    int loop_start, loop_length;
    vector<int> seen(N + 1, -1), order(N);
    order[0] = 1; seen[1] = 0;
    REP(i, 1, N + 1) {
        int next = A[order[i - 1] - 1];
        // cout << "next : " << next << " seen : " << seen[next] << endl;
        if (seen[next] > -1) {
            loop_start = seen[next];
            loop_length = i - seen[next];
            break;
        }
        seen[next] = i;
        order[i] = next;
    }

    // cout << "s : " << loop_start << " : " << loop_length << endl;

    if (K < loop_start) {
        cout << order[K] << endl;;
    } else {
        // cout << (K - loop_start) % loop_length << endl;
        cout << order[loop_start + (K - loop_start) % loop_length] << endl;
    }

    return 0;
}

Measured memory_bytes: 5636
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<queue>
#include<stack>
#include<cmath>	
#include<list>

#define PI 3.14159265359
using namespace std;

void koch(vector<vector<pair<double, double>>> &vertex_point, int N, int depth) {

	if (depth > N)return;
	vertex_point[depth].push_back(make_pair(0, 0));
	for (int i = 0; i < vertex_point[depth - 1].size() - 1; ++i) {
		double p1x = vertex_point[depth - 1][i].first;
		double p1y = vertex_point[depth - 1][i].second;
		double p5x = vertex_point[depth - 1][i + 1].first;
		double p5y = vertex_point[depth - 1][i + 1].second;

		double p2x = p1x + (p5x - p1x) / 3.0;
		double p2y = p1y + (p5y - p1y) / 3.0;
		double p4x = p1x + 2.0 * (p5x - p1x) / 3.0;
		double p4y = p1y + 2.0 * (p5y - p1y) / 3.0;

		double length = sqrt(pow(p4x - p2x, 2) + pow(p4y - p2y, 2));
		double theta = atan2(p4y - p2y, p4x - p2x) + PI / 3.0;

		double p3x = p2x + length * cos(theta), p3y = p2y + length * sin(theta);


		vertex_point[depth][vertex_point[depth].size() - 1] = make_pair(p1x, p1y);
		vertex_point[depth].push_back(make_pair(p2x, p2y));
		vertex_point[depth].push_back(make_pair(p3x, p3y));
		vertex_point[depth].push_back(make_pair(p4x, p4y));
		vertex_point[depth].push_back(make_pair(p5x, p5y));
	}
	////
	koch(vertex_point, N, depth+1);
	return;
}

int main() {
	int N;
	cin >> N;
	vector<vector<pair<double, double>>> vertex_point(7);

	vertex_point[0].push_back(make_pair(0, 0));
	vertex_point[0].push_back(make_pair(100, 0));

	koch(vertex_point, N, 1);

	for (int j = 0; j < vertex_point[N].size(); ++j) {
		printf("%lf %lf\n", vertex_point[N][j].first, vertex_point[N][j].second);
	}
	return 0;
}


Measured memory_bytes: 3700
#include <stdio.h>

int main(void)
{
	float t1, t2;
	
	while (scanf("%f %f", &t1, &t2) == 2){
		if (t1 < 35.50 && t2 < 71.00){
			printf("AAA\n");
		}
		else if (t1 < 37.50 && t2 < 77.00){
			printf("AA\n");
		}
		else if (t1 < 40.00 && t2 < 83.00){
			printf("A\n");
		}
		else if (t1 < 43.00 && t2 < 89.00){
			printf("B\n");
		}
		else if (t1 < 50.00 && t2 < 105.00){
			printf("C\n");
		}
		else if (t1 < 55.00 && t2 < 116.00){
			printf("D\n");
		}
		else if (t1 < 70.00 && t2 < 148.00){
			printf("E\n");
		}
		else {
			printf("NA\n");
		}
	}
	
	return (0);
}

Measured memory_bytes: 604
#include <bits/stdc++.h>
using namespace std;
 
int main()
{
	int n;
	cin >> n;
	int x;
	int zahyo[110] = {};
	for (int i = 0; i < n; ++i)
	{
		cin >> x;
		++zahyo[x];
	}
	int minl = 1000000007;
	for (int i = 1; i <= 100; ++i)
	{
		int now = 0;
		for (int j = 1; j <= 100; ++j)
		{
			now += pow((j - i),2) * zahyo[j];
		}
		minl = min(minl, now);
	}
	cout << minl << endl;
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#define SIZE 1000

int LCS(char*, char*, int, int);
int main(void){
    int n;
    char aString[SIZE],bString[SIZE];
  
    scanf("%d",&n);
  
    for(int i=0;i<n;i++){
        scanf("%s",aString);
        scanf("%s",bString);
        printf("%d\n",LCS(aString,bString,strlen(aString),strlen(bString)));
    }
  
    return 0;
}
  
int LCS(char *aString,char *bString,int aLength,int bLength){
    int hash[bLength+1][aLength+1];
  
    for(int i=1;i<=bLength;i++){
      hash[i][0]=0;
    }
    for(int i=0;i<=aLength;i++){
      hash[0][i]=0;
    }
  
    for(int j=1;j<=bLength;j++){
        for(int i=1;i<=aLength;i++){
            if(bString[j-1]==aString[i-1]) hash[j][i]=hash[j-1][i-1]+1;
            else if(hash[j-1][i]>=hash[j][i-1]) hash[j][i]=hash[j-1][i];
            else hash[j][i]=hash[j][i-1];
        }
    }
  
    return hash[bLength][aLength];
      
}


Measured memory_bytes: 5688
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int[][] a = new int[n][3];
        for(int i = 0; i < n; i++){
            for(int j = 0; j < 3; j++){
                a[i][j] = scanner.nextInt();
            }
        }
        System.out.println(new Main().f(a, n));
    }

    public int f(int[][] happy, int n) {
        int a = happy[0][0], b = happy[0][1], c = happy[0][2];
        for(int i = 1; i < n; i++){
            int ta = Math.max(b, c) + happy[i][0];
            int tb = Math.max(a, c) + happy[i][1];
            int tc = Math.max(a, b) + happy[i][2];
            a = ta;
            b = tb;
            c = tc;
        }
        return Math.max(a, Math.max(b, c));
    }
}


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

int main() {
    int a, b;
    cin >> a >> b;
    if (a % 2 == 1 && b % 2 == 1) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String s = scanner.next();
        String t = scanner.next();
        int ans = 0;
        for(int i=0;i<s.length();i++){
            if(s.charAt(i) != t.charAt(i)){
                ans++;
            }
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 41164
// https://www.youtube.com/watch?v=jQjnQJ9NPOY&list=PLn8m49B2OVF4kVTE0TK1PT-R0R9QhTVyS&index=1
#include<bits/stdc++.h>
using namespace std;
#define inf 1e18
#define int long long
#define ll long long
#define nl cout<<"\n";
#define all(v) v.begin(),v.end()
#define input(v) for(auto &i:v) cin>>i;
#define forn(i, n) for (int i = 0; i < int(n); ++i)
#define fore(i, l, r) for (int i = int(l); i < int(r); ++i)
#define forr(i , l , r) for(int i = int(l) ; i >= int(r); i--)
#define vi vector<int>
#define vii vector<vector<int>>
#define ff first
#define ss second
#define pb push_back
#define eb emplace_back
#define IOS ios_base::sync_with_stdio(0),cin.tie(0);
void print(ll a)                  {              cout<<a<<'\t'<<'\n';}
void print(ll a,ll b)                {          cout<<a<<'\t'<<b<<'\t'<<'\n';}
void print(ll a,ll b,ll  c)             {      cout<<a<<'\t'<<b<<'\t'<<c<<'\n';}
void print(ll a,ll  b,ll  c,ll  d)         {   cout<<a<<'\t'<<b<<'\t'<<c<<'\t'<<d<<'\n';}
void print(ll a,ll  b,ll  c,ll  d,ll  e)      { cout<<a<<'\t'<<b<<'\t'<<c<<'\t'<<d<<'\t'<<e<<'\n';}
void print(vector<int> &a)  {for(auto i:a)  cout<<i<<" ";   nl;}
void print(string s)   {cout<<s, nl;}
void print(string s , ll a) { cout<<s<<"\t"<<a; nl;};
void print(string s , ll a , string ss , ll b) { cout<<s<<'\t'<<a<<'\t'<<ss<<'\t'<<b; nl;};


void sub(vector<int> &wt , vector<int> val , int idx , int tsum)
{

}


int32_t main()
{
    int n,weight,ans = 0;
    cin>>n>>weight;

    vi wt(n);
    vi val(n);

    for(int i=0 ; i<n ; i++)
        cin>>wt[i]>>val[i];

    int maxVal = accumulate(all(val) , 0);
    vector<vector<int>> dp(n+1, vector<int> (maxVal+1 , INT_MAX));

    dp[0][0] = 0;
    dp[0][val[0]] = wt[0];

//    dp[index][weight] = maxweight;
// now we need to swap these
//    dp[index][val] = minWeight

    for(int i=1 ; i<n ; i++)
    {
        dp[i][0] = 0;
        for(int j=1 ; j<= maxVal ; j++)
        {
            // selected
            if(j >= val[i])
                dp[i][j] = min(
                               dp[i][j],
                               dp[i-1][j-val[i]] + wt[i]
                               );

            // not selected;
            dp[i][j] = min(dp[i-1][j] , dp[i][j]);
        }
    }
    for(int val = maxVal ; val>=0 ; val--)
        if(dp[n-1][val] <= weight)
    {
        ans = val;
        break;

    }

//    for(auto i : dp)
//    {
//        for(auto j : i)
//            cout<<j<<" ";
//        cout<<endl;
//    }
    cout<<ans;
}










// Connected Sum

/*

nodes edges
f   t   w

8 14
0 1 4
0 7 8
1 7 11
7 6 1
7 8 7
8 6 6
8 2 2
1 2 8
2 3 7
2 5 4
6 5 2
3 5 14
3 4 9
5 10 4

4   4
1	2	3
1	3	2
2	1	3
1	4	5

ans = 3;

*/






















Measured memory_bytes: 83248
program abc72
 implicit none
 integer(8)::a(32)=(/1,1,1,2,1,2,1,5,2,2,1,5,1,2,1,14,1,5,1,5,2,2,1,15,2,2,5,4,1,4,1,51/)
 integer(8)::K
 read(*,*)K
 print'(i0)',a(K)
end program abc72

Measured memory_bytes: 2932
import heapq
N,M = [int(x) for x in input().split()]
A = [-int(x) for x in input().split()]
heapq.heapify(A)
for i in range(M):
    x = heapq.heappop(A)
    x = -x//2
    heapq.heappush(A,-x)
print(-sum(A))

Measured memory_bytes: 14180
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <chrono>
#define _USE_MATH_DEFINES
#include <cmath>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iostream>
#include <iomanip>
#include <iterator>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;

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

const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-8;
const int MOD = 1000000007; // 998244353;
const int dy[] = {1, 0, -1, 0}, dx[] = {0, -1, 0, 1};

struct IOSetup {
  IOSetup() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    cerr << fixed << setprecision(10);
  }
} iosetup;
/*-------------------------------------------------*/
int main() {
  string s; cin >> s;
  for (int i = 0; i < s.length(); i += 2) cout << s[i];
  cout << '\n';
  return 0;
}


Measured memory_bytes: 592
s = input()
ans = 1

for i in range(len(s)):
  if i % 2 == 0:
    if s[i] == 'L':
      ans -= 1
  else:
    if s[i] == 'R':
      ans -= 1
     
if ans < 1:
  print("No")
else: print("Yes")


Measured memory_bytes: 2940
import java.util.*;
public class Main 
{
	public static void main(String[] args) 
	{
		Scanner stdIn = new Scanner(System.in);
		while(stdIn.hasNext())
		{
			int n = stdIn.nextInt();
			if(n == 0)
			{
				break;
			}
			int[] count = new int[10];
			while(n-- != 0)
			{
				int num = stdIn.nextInt();
				++count[num];
			}
			for(int i = 0; i < count.length; ++i)
			{
				if(count[i] == 0)
				{
					System.out.println("-");
					continue;
				}
				for(int j = 0; j < count[i]; ++j)
				{
					System.out.print("*");
				}
				System.out.println("");
			}
		}
	}
}

Measured memory_bytes: 12000
#include <bits/stdc++.h>
#define ALL(v) v.begin(), v.end()
#define MAX 510000
#define rrep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define rep(i, n) for(ll i = 1; i <= (ll)(n); i++)
#define dcout cout<<fixed<<setprecision(15);
#define mp make_pair
#define pb push_back

using namespace std;
typedef long long int  ll;
typedef pair<ll, ll> P;

constexpr int MOD = 1e9 + 7;
constexpr ll inf = 1LL << 60;

template< typename S, typename T >
inline void chmax(S &a, const T &b) { if(a < b) a = b; }
 
template< typename S, typename T >
inline void chmin(S &a, const T &b) { if(a > b) a = b; }
 

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

//a^n mod p//
ll modpow(ll a, ll n, ll p) {
  if (n == 1) return a % p;
  if (n % 2 == 1) return (a * modpow(a, n - 1, p)) % p;
  ll t = modpow(a, n / 2, p);
  return (t * t) % p;
}

//inversemod//
ll modinv(ll a, ll m) {
	if(m==0)return (ll)1;
	ll b = m, u = 1, v = 0;
	while (b) {
		ll t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}

//Cmonp//
ll fac[MAX], finv[MAX], inv[MAX];
// 
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

// 
ll COM(ll n, ll k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

//LARGE n
ll com(ll n,ll m){
    if(n<m || n<=0 ||m<0){
		return 0;
	}
	if( m==0 || n==m){
		return 1;
	}
	ll k=1;
	for(ll i=1;i<=m;i++){
       k*=(n-i+1); 
	   k%=MOD;
	   k*=modinv(i,MOD);
	   k%=MOD;
	}
	return k;
}

//radP
ll rad(ll u, ll p){
ll cnt=0;
	while(u%p==0){
		u/=p;
		cnt++;
	}
	return cnt;
}


////////////////////////////////////////////////////////////////////

int main() {
int h1,m1,h2,m2;
cin>>h1>>m1>>h2>>m2;
int k;
cin>>k;

int min=0;
if(m2>=m1)min=60*(h2-h1)+m2-m1;
if(m2<m1)min=60*(h2-h1-1)+(60-(m1-m2));
min-=k;
cout<<min<<endl;


}




Measured memory_bytes: 3640
//ねこのあな(stackとvectorを使わない)
#include<bits/stdc++.h>
using namespace std;

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

  int stk[101]; //穴の中を再現 初期値はすべて0
  for(int i=0; i<100; i++) stk[i] = 0;
  //stk(穴の座標) = 猫番号
  int top = 0; //穴の先頭にいる猫の座標
  
  int flag[101]; //その猫が穴の中なら1 初期値はすべて0
  for(int i=0; i<100; i++) flag[i] = 0;
  //flag(猫番号) = 1か0
  
  for(int i=0; i<L; i++) {
    int c;
    cin >> c;

    if(c > 0) {
      ////////////////
      //猫が入るとき//
      ////////////////
      if(flag[c] == 1) {
        //その猫はすでに穴の中のとき
        cout << i + 1 << endl;
        return 0;//プログラム終了
      }

      //猫を穴に入れる
      top++;
      stk[top] = c;
      flag[c] = 1;
    } else {
      ////////////////
      //猫が出るとき//
      ////////////////
      c = c * -1;//番号を正に
      if (flag[c] != 1 or stk[top] != c) {
        //その猫は穴の中にいない or その猫は穴の先頭にいない とき
        cout << i + 1 << endl;
        return 0;//プログラム終了
      }

      //猫を穴から出す
      stk[top] = 0;
      top--;
      flag[c] = 0;
    }
  }
  cout << "OK" << endl;
}



Measured memory_bytes: 3116
import sys
readline = sys.stdin.readline

def main():
    num = list(readline())
    op = ['+', '-']
    for op1 in op:
        for op2 in op:
            for op3 in op:
                f = num[0] + op1 + num[1] + op2 + num[2] + op3 + num[3]
                if eval(f) == 7:
                    print(f + '=7')
                    return


if __name__ == '__main__':
    main()

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

int n, d[100][2];

int main() {
	cin >> n;
	for (int i = 0; i < n; ++i)
		cin >> d[i][0] >> d[i][1];
	for (int i = 0; i < n - 2; ++i) {
		bool flag = 1;
		for (int j = 0; j < 3; ++j)
			if (d[i + j][0] != d[i + j][1])
				flag = 0;
		if (flag) {
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;
}


Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
#define ld long double
#define ll long long
#define loop(i,x,y) for(ll i=x;i<y;i++)
#define pb push_back
#define S second
#define F first

void solve(){

	int l;
	cin >> l;

	int t = 0, j = 1, cpos = 0;

	while(cpos < l){
		cpos += j;
		t++;
		j++;
	}
	cout << t << endl;	
}
	
 
 
int main(){
	    
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
 
	solve();
	 
	return 0;
 
}




Measured memory_bytes: 256
#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;

long long MAX = 1e18;

int main() {
    int n, i;
    cin >> n;
    int64_t x = 1;
    vector<int64_t> a(n);
    for(i = 0; i < n; i++){
        cin >> a.at(i);
        if(a.at(i) == 0){
            cout << 0 << endl;
            return 0;
        }
    }
    for(i = 0; i < n; i++){
        if(MAX / x < a.at(i)){
            break;
        }
        x *= a.at(i);
    }
    if(i == n){
        cout << x << endl;
    }else{
        cout << -1 << endl;
    }

return 0;
}


Measured memory_bytes: 3956
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int N, count = 0, check;
  cin >> N;
  vector<int> vec(N);
  
  for (int i = 0; i < N; i++) {
    cin >> vec.at(i);
  }
  
  for (int j = 0; j < N; j++) {
    count++;
    if (j == 0) {
      check = vec.at(0);
      if (check == 2) {
        cout << count << endl;
        break;
      }
      if (check == 1) {
        cout << "-1" << endl;
        break;
      }
    }
    else if (j != N - 1) {
      check = vec.at(check - 1);
      if (check == 2) {
        cout << count << endl;
        break;
      }
    }
    else {
      check = vec.at(check - 1);
      if (check == 2) {
        cout << count << endl;
        break;
      }
      else {
        cout << "-1" << endl;
        break;
      }
    }
  }
}

Measured memory_bytes: 640
import java.util.*;

public class Main {
    public static void main(String[] args) {	
	Main main = new Main();
    	main.solveA();
    }
    
    private void solveA() {
    	Scanner sc = new Scanner(System.in);
    	int A = sc.nextInt();
    	int B = sc.nextInt();
	int X = sc.nextInt();	
    	System.out.println(A > X ? "NO" : (A+B >= X ? "YES" : "NO"));
    }

    private void solveB() {
	Scanner sc = new Scanner(System.in);
	System.out.println();
    }
    private void solveC() {
	Scanner sc = new Scanner(System.in);
	System.out.println();
    }
    private void solveD() {
	Scanner sc = new Scanner(System.in);
	System.out.println();
    }
}

Measured memory_bytes: 21972
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp2
{
    class Program
    {
        static void Main(string[] args)
        {

            var input = Console.ReadLine().Split(' ');
            int N = int.Parse(input[0]);
            int M = int.Parse(input[1]);

            var favorites = new int[M + 1];
            // n人　いてる 
            for (var i = 0; i < N; i++)
            {
                input = Console.ReadLine().Split(' ');
                var k = int.Parse(input[0]);
                for (var j = 0; j < k; j++)
                {
                    favorites[int.Parse(input[j + 1])]++;
                }

            }

            int sum = 0;

            for(var i = 0; i < favorites.Length;i++)
            {
                var favorite = favorites[i];
                if (favorite == N) sum++;
            }

            Console.WriteLine(sum);
        }
    }
}


Measured memory_bytes: 11092
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
using namespace std;

int n;
int t[1002];

int main(){

  while(cin >> n){
    if(n == 0) break;

    bool noneFlg = false;

    for(int i = 0; i < n; i++){
      string s;
      cin >> s;

      if(s == "x"){
        t[i] = INT_MAX;
      }
      else{
        t[i] = atoi(s.c_str());
      }

      if(i == 0) continue;

      if(t[i] == INT_MAX && t[i - 1] == INT_MAX ||
         t[i] != INT_MAX && t[i - 1] != INT_MAX &&
          (i % 2 == 0 && t[i - 1] <= t[i] || i % 2 == 1 && t[i - 1] >= t[i])){
        noneFlg = true;
      }
    }

    if(noneFlg){
      cout << "none" << endl;
      continue;
    }

    //       0123456789
    int lo = -1000000010;
    int hi = 1000000010;

    for(int i = 0; i < n; i++){
      if(t[i] != INT_MAX) continue;

      if(i > 0){
        if(i % 2 == 0) hi = min(hi, t[i - 1] - 1);
        else           lo = max(lo, t[i - 1] + 1);
      }
      if(i < n - 1){
        if(i % 2 == 0) hi = min(hi, t[i + 1] - 1);
        else           lo = max(lo, t[i + 1] + 1);
      }
    }

    if(lo == hi){
      cout << lo << endl;
    }
    else if(lo < hi){
      cout << "ambiguous" << endl;
    }
    else{
      cout << "none" << endl;
    }

  }
}

Measured memory_bytes: 1224
package main

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

var sc = bufio.NewScanner(os.Stdin)

func stringLineScan() string {
	sc.Scan()
	return sc.Text()
}

var ans int

func main() {
	sc.Split(bufio.ScanWords)
	n, _ := strconv.Atoi(stringLineScan())
	fmt.Println(n/2 + n%2)
}


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

int main()
{
    int n,k;
    cin>>n>>k;
    int h[n+1];
    for(int i=1;i<=n;i++)
        cin>>h[i];
    int dp[n+1]={0};
    dp[1]=0;
    for(int i=2;i<=n;i++)
    {
        dp[i]=INT_MAX;
        for(int j=i-1;j>=i-k;j--)
        {
            if(j>=1)
            dp[i]=min(dp[i],dp[j]+abs(h[i]-h[j]));
        }
        
    }
   
    
    cout<<dp[n]<<endl;
}

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

int main() {
  string s,t;
  cin >> s >> t;
  
  int num = s.size();
  bool jud = false;
  for (int i=0; i<num; i++){
    string temp = s.at(num-1) + s.substr(0,num-1);
    if (temp == t) jud = true;
    s = temp;
  }
  
  string ans; 
  if (jud) ans = "Yes";
  else ans = "No";
  
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
int line[3][8],line2[18];
double line1[10000];
int c(const void *v1,const void *v2){
    int vv1=*(int  *)v1;
    int vv2=*(int  *)v2;
    if(line1[vv1]>line1[vv2])
        return 1;
    else if(line1[vv1]<line1[vv2])
        return -1;
        return 0;
}
int main(void){
    int i,o,t;
    for(i=0;i<3;i++){
        for(o=0;o<8;o++){
            scanf("%d",&line[i][o]);
            scanf("%lf",&line1[line[i][o]]);
        }
        qsort(line[i],8,sizeof(int),c);
    }
    for(i=0;i<3;i++)
        printf("%d %.2f\n%d %.2f\n",line[i][0],line1[line[i][0]],line[i][1],line1[line[i][1]]);
    for(t=0,i=0;i<3;i++)
        for(o=2;o<8;o++)
            line2[t++]=line[i][o];
    qsort(line2,18,4,c);
    printf("%d %.2f\n%d %.2f\n",line2[0],line1[line2[0]],line2[1],line1[line2[1]]);
    return 0;
}

Measured memory_bytes: 708
#include "bits/stdc++.h"

using namespace std;


string solve(int n){
    
    stringstream ss;
    ss<<(int)(n/60);
    ss<<':';
    if(n%60<10)ss<<'0';
    
    ss<<n%60;
    
    
    return ss.str();
}

int main(){
    int n,m;
    
    vector<int> a;
    
    cin>>n;
    for(int i=0;i<n;i++){
        int x,y;
        cin>>x>>y;
        a.push_back(x*60+y);
    }
    
    cin>>m;
    for(int i=0;i<m;i++){
        int x,y;
        cin>>x>>y;
        a.push_back(x*60+y);
    }
    
    
    sort(a.begin(),a.end());
    
    int len=a.size();
    
    
    
    
    for(int i=0;i<len;i++){
        if(i==0 || a[i-1]!=a[i]){
            if(i!=0)cout<<" ";
            cout<<solve(a[i]);
        }
    }
    cout<<endl;
    
    
    
    return 0;
}

Measured memory_bytes: 1244
function main(input) {
  input=input.trim()
  const N = parseInt(input.split(" ")[0], 10);
  const T = parseInt(input.split("\n")[1].split(" ")[0], 10);
  const A = parseInt(input.split("\n")[1].split(" ")[1], 10);
  const arr = input.split('\n')[2].split(' ').map((n) => parseInt(n, 10));

  const tempArr=[]
  for(var i=0; i<N; i++){
    var sa=Math.abs((T-arr[i]*0.006)-A)
    tempArr.push(sa)
  }
  var min=Math.min.apply(null, tempArr)
  console.log(tempArr.indexOf(min)+1);

}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 7500
#include<iostream>
using namespace std;
#define lli long long 
#include<bits/stdc++.h>
int main(){
  lli n;
  cin>>n;
  lli k;
  cin>>k;
  vector<lli>v(n);
  for(lli i=0;i<n;i++)
    cin>>v[i];
  sort(v.rbegin(),v.rend());
  if(k>=n)
    cout<<"0";
  else{
    lli sum=0;
    for(lli i=k;i<n;i++)
      sum+=v[i];
    cout<<sum;
  }
  return 0;
}

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

typedef vector<int> vi;
typedef pair<int, int> pi;

const ll INF = 1LL << 60;
const ll MOD = 1e9 + 7;

#define pb push_back
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REP2(i, b, e) for (int i = (b); i <= (int)(e); i++)
#define DEBUG(x) cout << #x << ": " << (x) << endl
#define DEBUGA(a) cout << #a << ": "; for (const auto& v: (a)) cout << v << endl

signed main() {
    int N;
    cin >> N;

    vi A(N+1), B(N);
    REP(i, N+1) cin >> A[i];
    REP(i, N) cin >> B[i];

    int m;
    ll ans = 0;
    REP(i, N) {
        m = min(A[i], B[i]);
        ans += m;
        A[i] -= m;
        B[i] -= m;

        m = min(A[i+1], B[i]);
        ans += m;
        A[i+1] -= m;
        B[i] -= m;
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
typedef long long int ll;
using namespace std;
int main(){
	ios_base::sync_with_stdio(false);  
	cin.tie(NULL);
	int x,y,a,b,c;
	cin>>x>>y>>a>>b>>c;
	ll red[a]; ll green[b]; ll arr[c];
	for(int i=0;i<a;i++){
		ll a;cin>>a;
		red[i] = a;
	}
	for(int i=0;i<b;i++){
		ll a;cin>>a;
		green[i] = a;
	}
	for(int i=0;i<c;i++){
		ll a;cin>>a;
		arr[i] = a;
	}
	sort(red,red+a,greater<int>());
	sort(green,green+b,greater<int>()); sort(arr,arr+c,greater<int>());
	ll sum=0;
	vector<ll> check;
	for(int i=0;i<x;i++){
		sum += red[i];
		check.push_back(red[i]);
	}
	for(int i=0;i<y;i++){
		sum += green[i];
		check.push_back(green[i]);
	}
	sort(check.begin(),check.end());
	int i=0; 
	while(i<c && check[i]<arr[i]){
		sum += arr[i] - check[i];
		i++;
	}
	cout<<sum<<endl;
}


Measured memory_bytes: 4724
N = int(input())
if N == 1:
  print(0)
  exit(0)
A = list(map(int, input().split()))
A.sort()
b = (A[-1] + A[-2]).bit_length()
#print(b)
vis = set()
res = 0
for t in range(b, -1, -1):
  s = 2 ** t
  r = N - 1
  #print(t)
  for l in range(N):
    if l in vis: continue
    if l >= r: break
    while l < r:
      #print(l, r, "s", s)
      if r in vis:
        r -= 1
        continue
      if A[l] + A[r] < s:
        break
      elif A[l] + A[r] > s:
        r -= 1
        if r in vis:
          r -= 1
      else:
        res += 1
        vis.add(l)
        vis.add(r)
        break
print(res)

Measured memory_bytes: 99920
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define debug(x) cerr<<#x<<": "<<x<<endl
#define trav(a,x) for(auto &a:x)
#define all(x) x.begin(),x.end()
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n;
    cin >> n;
    vector<bool> black(2*n);
    vi a(2*n);
    vi posw(n), posb(n);
    rep(i,0,2*n) {
        char type;
        cin >> type >> a[i];
        --a[i];
        black[i]=type=='B';
        if(black[i]) posb[a[i]]=i;
        else posw[a[i]]=i;
    }
    vector<vi> invw(2*n), invb(2*n);
    rep(p,0,2*n) {
        int iw=0, ib=0;
        invw[p].resize(n+1);
        invb[p].resize(n+1);
        rep(i,0,n+1) {
            invw[p][i]=iw;
            invb[p][i]=ib;
            if(i<n) {
                if(posw[i]>p) ++iw;
                if(posb[i]>p) ++ib;
            }
        }
    }
    const ll INFTY=LLONG_MAX;
    vector<ll> dp(n+1,INFTY);
    dp[0]=0;
    for(int i=0;i<2*n;++i) {
        vector<ll> next(n+1,INFTY);
        rep(j,0,n+1) if(dp[j]<INFTY) {
            int w=j, b=i-j;
            if(w<n) next[w+1]=min(next[w+1],dp[j]+invw[posw[w]][w]+invb[posw[w]][b]);
            if(b<n) next[w]=min(next[w],dp[j]+invw[posb[b]][w]+invb[posb[b]][b]);
        }
        dp=next;
    }
    ll best=dp[n];
    cout<<best<<"\n";
    
}


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

long long n , x , t , res;

int main()
{ 
        cin >> n >> x >> t;
       while ( n >= x)
{
       res+=t; 
       n-=x;
        
         
}
      
       if (n)
 res+=t;
     cout << res;
	return 0;
}

Measured memory_bytes: 3556
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int n = Integer.parseInt(sc.next());
		
		int[] h = new int[n];
		
		for(int i = 0; i < n; i++) {
			h[i] = Integer.parseInt(sc.next());
		}
		
		int res = 1;
		
		for(int i = 1; i < n; i++) {
			for(int j = 0; j < i; j++) {
				if(h[i] < h[j]){
					break;
				}
				
				if(j == i-1) {
					res++;
				}
			}
		}
		
		System.out.println(res);
	}
}


Measured memory_bytes: 23124
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
int main() {
	int n;
	scanf("%d",&n);
	if (n&1) printf("%d\n",(n>>1)*(n-(n>>1)));
	else printf("%d\n",(n>>1)*(n>>1));
	return 0;
}

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

int main() {
    string s, t;
    cin >> s >> t;
    string s1, s2;
    bool T = false;
    int count = 0;
    while (true) {
        s1 = s[s.length()-1];
        for (int i = 0; i < s.length()-1; i++) {
            s1 += s[i];
        }
        if (s1 == t) {
            T = true;
            break;    
        }
        else if (count == s.length()) break;
        else {
            s = s1;
            count++;
        }
    }
    if (T) cout << "Yes\n";
    else cout << "No\n";
    
}

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

int main(){
	int n,a[4][14];
	char s[2];
	int h;

	for(int i=0;i<4;i++){
		for(int j=1;j<14;j++){
			a[i][j]=0;
		}
	}

	scanf("%d",&n);

	for(int i=0;i<n;i++){
		scanf("%s %d",s,&h);
		switch(s[0]){
		case 'S':
			a[0][h]=1;
			break;
		case 'H':
			a[1][h]=1;
			break;
		case 'C':
			a[2][h]=1;
			break;
		case 'D':
			a[3][h]=1;
			break;
		}
	}
	char S[4]={'S','H','C','D'};
	for(int i=0;i<4;i++){
		for(int j=1;j<14;j++){
			if(a[i][j]==0){
				printf("%c %d\n",S[i],j);
			}
		}
	}

	return 0;
}


Measured memory_bytes: 2048
#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <functional>
#include <bitset>

using namespace std;
using lint = long long int;
long long int INF = 5001001001001001LL;
int inf = 1000000007;
long long int MOD = 1000000007LL;
double PI = 3.1415926535897932;

template<typename T1,typename T2>inline void chmin(T1 &a,const T2 &b){if(a>b) a=b;}
template<typename T1,typename T2>inline void chmax(T1 &a,const T2 &b){if(a<b) a=b;}


#define rep(i,n) for(ll i=0;i<(n);++i)
#define all(a) (a).begin(),(a).end()
using namespace std;
using Graph = vector<vector<int>>;
typedef pair<int,int> P;
typedef long long ll;

#define int long long

signed main(){

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

    vector<vector<lint>> g(n, vector<lint> (n,INF));

    rep(i,m){
        int x, y, t; cin >> x >> y >> t;
        x--; y--;

        g[x][y] = t;
        g[y][x] = t;
    }

    //(距離, { {今いる頂点, 速さ} , 状態})

    // using Q = pair<ll, pair<pair<ll, ll>, ll> >;
    using Q = tuple<ll, ll, ll, ll>;
    priority_queue<Q ,vector<Q>,greater<Q>> que;

    ll dp[505][51][2];
    rep(i,505)rep(j,51)rep(k,2) dp[i][j][k] = INF;

    lint v0; cin >> v0;
    int a, b, c; cin >> a >> b >> c;
    // que.push (Q(0, {{0,v0}, 0}));
    que.push(Q(0LL, 0LL, v0, 0LL));

    dp[0][v0][0] = 0;
    //Dijkstra
    while(!que.empty()){
        //まずはヒープの先頭の要素をとる
        auto e = que.top(); que.pop();

        //それぞれのパラメータを取得
        // ll dist = e.first;
        // ll v = e.second.first.first;
        // ll velo = e.second.first.second;
        // ll state = e.second.second;
        
        //auto [dist, v, velo, state] = e; // c++17
        ll dist, v, velo, state;
        tie(dist, v, velo, state) = e;


        if (v == n - 1 and state == 0) {
          if (dp[v][velo][1] > dist) {
            dp[v][velo][1] = dist;
            que.push(Q(dist, v, velo, 1));
          }
        }

        // cout << "dist = " << dist << " , node = " << v + 1 << " , velo = " << velo << " state = " << state << endl;

        //次に行く頂点の距離が最小じゃなかったら論の外
        if(dist > dp[v][velo][state]) continue;


        for(int j = 0; j < n; j++){

            if(g[v][j] == INF) continue;

            ll nvelo = (a * velo + b) % c;
            ll cost = g[v][j] * velo;

            if(dist + cost < dp[j][nvelo][state]){
              dp[j][nvelo][state] = dist + cost;
              que.push(Q(dist + cost, j, nvelo , state));

            }
        }
    }

    ll ans = INF;

    rep(i,51){
        ans = min(ans,dp[0][i][1]);
    }

    cout << ans << endl;
}



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

#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define RFOR(i,a,b) for(int i=(int)(b)-1;i>=(int)(a);i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define LL long long
#define INF INT_MAX/3

const double EPS = 1e-14;
const double PI  = acos(-1.0);


int main(){
  int n;

  scanf("%d", &n);

  vector<int> v(3*n);
  REP (i, 3 * n) {
    scanf("%d", &v[i]);
  }

  sort(v.begin(), v.end(), greater<int>());

  LL sum = 0;
  for (int i = 1; i < 2 * n; i += 2) {
    sum += v[i];
  }

  printf("%lld\n", sum);
}


Measured memory_bytes: 1408
n = int(input())
max_c = (n+4-1)//4
max_d = (n+7-1)//7
fl = 0
for i in range(max_c + 1):
    for j in range(max_d + 1):
        if n == 4*i + 7*j:
            fl = 1
            break
    if fl == 1:
        break
print('Yes') if fl == 1 else print('No')


Measured memory_bytes: 2940
#include <stdio.h>

int main(void){
        int a, b, ans;
        char op;

        while(1){
                scanf("%d %s %d", &a, &op, &b);
                if(op=='?') break; else{
                        switch(op){
                                case '+':
                                        ans = a+b;  break;
                                case '-':
                                        ans = a-b;  break;
                                case '*':
                                        ans = a*b;  break;
                                case '/':
                                        ans = a/b;  break;
                        }
                }
                printf("%d\n", ans);
        }
        return 0;
}

Measured memory_bytes: 600
/*
    Those who cannot remember the past are condemned to repeat it.
                                            - Dynamic Programming
    
    I never lose, I either win or I learn.
                - Competitive Programming

*/

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.StringTokenizer;

class Graph {
    int n;
    ArrayList<Integer>[] adj;
    int[] max_here;

    Graph(int v) {
        n = v;
        adj = new ArrayList[n+1];
        max_here = new int[n+1];
        for(int i=0 ; i<=n ; i++) {
            max_here[i] = -1;
            adj[i] = new ArrayList<>();
        }
    }

    void addEdge(int u, int v) {
        adj[u].add(v);
    }

    int computeMaxLen() {
        int max_len = 0;
        for(int i=1 ; i<=n ; i++) {
            max_len = Math.max(max_len, dfs(i));
        }
        return max_len;
    }

    int dfs(int start) {
        if(max_here[start] != -1) {
            return max_here[start];
        }
        else {
            int len_for_this_node = 0;
            for(int x: adj[start]) {
                int sub_len = dfs(x);
                if(len_for_this_node < sub_len+1) {
                    len_for_this_node = sub_len+1;
                }
            }
            max_here[start] = len_for_this_node;
            return max_here[start];
        }
    }
}

public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st;
        PrintWriter pw = new PrintWriter(System.out);

        st = new StringTokenizer(br.readLine());
        int n = Integer.parseInt(st.nextToken());
        int m = Integer.parseInt(st.nextToken());

        Graph g = new Graph(n);

        for(int i=0 ; i<m ; i++) {
            st = new StringTokenizer(br.readLine());
            int u = Integer.parseInt(st.nextToken());
            int v = Integer.parseInt(st.nextToken());
            g.addEdge(u, v);
        }

        int ans = g.computeMaxLen();
        pw.print(ans);
        
        
        
        
        
        
        
        pw.flush();
        pw.close();
    }
}


Measured memory_bytes: 55708
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int K; cin >> K;
  if(K%2==0){
    cout << K*K/4 << endl;
  }
  if(K%2==1){
    cout << (K+1)*(K-1)/4 << endl;
  }
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		//????????£????????????????????°?????????????????£?¨?
		Scanner sc = new Scanner(System.in);

		//a??????
		int intA = sc.nextInt();
		//b??????
		int intB = sc.nextInt();

		//a?????????
		//????????????
		double dbF; //?????°?????£?¨?
		//f???????????????????????°???????????§???????¨????
		dbF = (double) intA /  (double) intB;
		 //?¨??????????db????????°??????string???????????????
		 String f2 = String.format("%.5f", dbF);
		//?¨??????????????????????a/b = d
		System.out.println(intA / intB + " " + intA % intB + " " + f2);
	}
}

Measured memory_bytes: 26320
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

#define F first
#define S second
#define pb push_back
#define eb emplace_back
#define PI 3.14159265359
#define sz(c) (int)c.size()
#define len(c) (int)c.length()
#define hcf(a, b) __gcd(a, b)
#define all(c) c.begin(), c.end()
#define vint vector<int>
#define vll vector<ll>
#define vpint vector<pair<int, int>>
#define vpll vector<pair<ll, ll>>
#define fr(it, a, b) \
    for (int it = (a); it < (b); it++)
#define tr(con, it) \
    for (auto it = con.begin(); it != con.end(); it++)
#define present(con, ele) (con.find(ele) != con.end())
#define cpresent(con, ele) (find(all(con), ele) != con.end())
#define maximum(a, b, c) (a > b ? (a > c ? a : c) : (b > c ? b : c))
#define minimum(a, b, c) (a < b ? (a < c ? a : c) : (b < c ? b : c))
typedef long long ll;
typedef long double lf;
typedef pair<int, int> pi;
typedef unsigned long long lu;
const ll mod = 1e9 + 7;
int32_t main()
{
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int x, n, ans = 0;
    cin >> x >> n;
    set<int> s;
    fr(i, 0, n)
    {
        int u;
        cin >> u;
        s.insert(u);
    }
    for (int i = 0; i <= 101; i++)
    {
        if (!present(s, i) && abs(x - i) < abs(x - ans))
        {
            ans = i;
        }
    }
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 3624
#include<cstdio>

int main(){
    int a,b;

    scanf("%d %d",&a,&b);
    if(a>b)
        printf("a > b\n");
    else if(a==b)
        printf("a == b\n");
    else 
        printf("a < b\n");                                 
   return 0;

}



Measured memory_bytes: 2604
import java.io.*;
import java.util.*;

public class Main {

    public static void main(final String[] args) throws Exception {
        final Scanner sc = new Scanner(System.in);
        long A;
        A = sc.nextLong();
        long B;
        B = sc.nextLong();

        final Solver solver = new Solver();
        solver.solve(A, B);
    }
}

class Solver {
    public void solve(long A, long B) {
        int ans = (int) (A - 2 * B);
        System.out.println(ans >= 0 ? ans : 0);
    }
}



Measured memory_bytes: 24020
//
//  main.cpp
//  Model Bubble Sort
//
//  Created by 早川正午 on 2018/05/31.
//  Copyright © 2018年 早川正午. All rights reserved.
//

#include <iostream>
using namespace std;

int bubbleSort(int A[], int N){
    int sw = 0;
    bool flag = 1;
    for(int i=0;flag;i++){
        flag = 0;
        for(int j=N-1;j>=i+1;j--){
            if(A[j]<A[j-1]){
                swap(A[j],A[j-1]);
                flag = 1;
                sw++;
            }
        }
    }
    return sw;
}
int main(int argc, const char * argv[]) {
    int A[100],N,sw;
    cin>>N;
    for(int i=0;i<N;i++)cin>>A[i];
    
    sw = bubbleSort(A,N);
    
    for(int i = 0;i<N;i++){
        if(i) cout<<' ';
        cout<<A[i];
    }
    cout<<endl;
    cout<<sw<<endl;
    
    return 0;
}


Measured memory_bytes: 3120
# 整数 a と、英小文字からなる文字列s が入力されます。
# a が3200 以上ならs と出力し、a が3200 未満なら red と出力するプログラムを書いてください。


a = int(input())
s = input()

if a >= 3200:
    print(s)
else:
    print("red")

Measured memory_bytes: 9096
#include <stdio.h>
#include <algorithm>
#include <iostream>
#include <vector>
#include <assert.h>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <math.h>
#include <string>
#include <string.h>
#include <queue>
#include <complex>
#include <iomanip>
#include <stack>
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
ll mod=998244353;
double eps=1e-7;
ll exp(ll x,ll y){if(y<0) return 0; ll ret=1;for(;y;y>>=1,x=(x*x)%mod){if(y&1)ret=(ret*x)%mod;}return ret;}
ull pexp(ull x,ull y){if(y<0) return 0; ull ret=1; for(;y;y>>=1,x=(x*x)){if(y&1)ret=(ret*x);}return ret;}
ll gcd(ll x,ll y){if(!x||!y) return x+y; return x%y==0?y:gcd(y,x%y);}
ll lcm(ll x,ll y){return x*(y/gcd(x,y));}
ll bsum(ll u,ll b){ll ret=0;if(u<b)return u;while(u){ret+=u%b;u/=b;}return ret;}
ll prival(ll u,ll p){ll cn=0;while(u%p==0){cn++;u=u/p;}return cn;}
ll minv(ll a,ll b){return 1<a?b-minv(b%a,a)*b/a:1;}
ll extm(ll a,ll b){ll ret=0;while(a!=0){if(a%2==1){ret+=b;ret%=mod;}a>>=1;b=(2LL*b)%mod;}return ret;}   
ll eaphi(ll x){ll t=x,ret=x,i;for(i=2;i*i<=x;i++){if(t%i==0){ret-=ret/i;while(t%i==0) t/=i;}}if(t!=1) ret-=ret/t;return ret;}
ll eadivc(ll x){ll ret=0;ll i;for(i=1;i*i<=x;i++){if(x%i==0 && i*i!=x) ret+=2;if(x%i==0 && i*i==x) ret+=1;}return ret;}
ll eadivs(ll x){ll ret=0;ll i;for(i=1;i*i<=x;i++){if(x%i==0 && i*i!=x) ret+=i+x/i;if(x%i==0 && i*i==x) ret+=i;}return ret;}
ll ndig(ll x, ll b){ll ret=0;while(x){x/=b; ret++;}return ret;}
ll rev(ll n, ll b){ll ret=0;while(n){ret=b*ret+n%b; n/=b;}return ret;}
ll sq(ll x){ll t=(ll)sqrt(x); for(ll i=t-2 ; i<=t+2 ; i++) if(i*i==x) return abs(i); return -1;}
ll extexp(ll x,ll y){if(y<0) return 0; ll ret=1;for(;y;y>>=1,x=extm(x,x)){if(y&1)ret=extm(ret,x);}return ret;}
bool isprime(ll x){if(x<=1) return false; for(ll i=2;i*i<=x;i++){if(x%i==0){return false;}}return true;}
int n, m;

int main(void)
{
	cin>>n>>m; int i; string s;
	for(i=1 ; i<=n ; i++)
	{
		cin>>s;
		cout<<s<<"\n"<<s<<"\n";
	}
	return 0;
}
// 제출하기 전에 생각햇나요?
// it may be easier/harder than you think
// ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);

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

public class Main {
	static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {
		while (true) {
			int N = sc.nextInt();
			if (N == 0) break;
			int M = sc.nextInt();
			int S = sc.nextInt() - 1;
			int G1 = sc.nextInt() - 1;
			int G2 = sc.nextInt() - 1;
			int[][] dist = new int[N][N];
			for (int i = 0; i < N; ++i) {
				Arrays.fill(dist[i], 1 << 25);
				dist[i][i] = 0;
			}
			for (int i = 0; i < M; ++i) {
				int A = sc.nextInt() - 1;
				int B = sc.nextInt() - 1;
				int C = sc.nextInt();
				dist[A][B] = C;
			}
			for (int i = 0; i < N; ++i) {
				for (int j = 0; j < N; ++j) {
					for (int k = 0; k < N; ++k) {
						dist[j][k] = Math.min(dist[j][k], dist[j][i] + dist[i][k]);
					}
				}
			}
			int ans = 1 << 30;
			for (int i = 0; i < N; ++i) {
				ans = Math.min(ans, dist[S][i] + dist[i][G1] + dist[i][G2]);
			}
			System.out.println(ans);
		}
	}

}

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


int compare_int(const void *a, const void *b)
{
    return *(int*)a - *(int*)b;
//    return *(long long*)a - *(long long*)b;
}
//  qsort(A, b, sizeof(int), compare_int);

long long  factorial(long long n) {
    if (n > 0) {
        return n * factorial(n - 1);
    } else {
        return 1;
    }
}

int min(int a, int b) {
    if (a > b)
        return b;
    else
        return a;
}

int distance(int a, int b) {
  return abs(a-b)*abs(a-b);
}



//int ()
/*
int triangle(int a, int b, int c){
  if(a<b+c){
    if(b<c+a){
      if(c<a+b){
        printf("1\n");
        return 1;
      }
    }
  }
  printf("1\n");
  return 0;
}
*/

int main()
{
  int  a ,b, c, d, e, X, Y ,r;
//  long long  a, b, c, d, e, X, Y;
  //  double  c;
//  int  A[200003]={};
  int  A[100003]={};
  int  B[100003]={};
  int  C[100003][100001]={};

  int  flg=0;

//  char s[101][101]={};
  char s[100001]={};
  char t[100001]={};
//  int N, M;
//  int A[1000000001]={};
//  long long  C[101]={};
  int i,j,k;
  long long p,q;
//  int flag=0;
//  int tmp=0;
//  char tmp[101]={};
//  long long min=10000000000;
//  long long min=100000001;
  int min =100000001;
  int len=0;
  int l=0;
//  int r=1000001;
  int cnt=0;
  int num=0;
  int num1=0;
  int num2=0;
  int ans_ac=0;
  int ans_wa=0;
  int max=0;
  int sum=0;
  int addr=0;
  int ptn=0;
  int  tmp=0;
//  bool on_off[100]={};
  
//  char alp[26]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};

  //  a=0;
  scanf("%d%d", &a, &b);

  for(i=1;i*b<a;i++){
//      printf("%d\n", i);
  }
  printf("%d\n", i);
  
return 0;
}


Measured memory_bytes: 128