akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<vector>
#include<queue>
#include<map>
#define rep(index,num) for(int index=0;index<num;index++)
#define rep1(index,num) for(int index=1;index<=num;index++)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-15
#define mp(a1,a2) make_pair(a1,a2)
typedef long long ll;
using namespace std;
typedef pair<ll,ll> pll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
typedef vector<pll> vpll;
ll INFl=1e+18+1;
int INF=1e+9+1;
int main(){
	int N,T;
	int c[101],t[101];
	scan(N);scan(T);
	int mincos=INF;
	int flag=0;
	rep(i,N){
		scan(c[i]);scan(t[i]);
		if(t[i]<=T){
			flag=1;
			mincos=min(mincos,c[i]);
		}
	}
	if(flag) prin(mincos);
	else prin("TLE");
	return 0;
}


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

int main() {
    int N;
    cin >> N;
    vector<vector<char>> S(N, vector<char>(10));
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < 10; j++) cin >> S[i][j];
    }
    for (int i = 0; i < N; i++) sort(S[i].begin(), S[i].end());
    sort(S.begin(), S.end());

    vector<string> T(N);
    for (int i = 0; i < N; i++) {
        string tmp = "";
        for (int j = 0; j < 10; j++) tmp += S[i][j];
        T[i] = tmp;
    }

    long long ans = 0;
    long long cnt = 1;
    string tmp = T[0];
    for (int i = 1; i < N; i++) {
        if (T[i] != tmp) {
            ans += cnt * (cnt - 1) / 2;
            //cout << cnt << endl;
            cnt = 1;
            tmp = T[i];
        }
        else cnt++;
        if (i == N - 1) ans += cnt * (cnt - 1) / 2;
    }
    cout << ans << endl;
}

Measured memory_bytes: 12800
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cassert>
#include <algorithm>
#include <iostream>
#include <vector>
#include <string>
using namespace std;

#define LET(name, value) __typeof(value) name = value
#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 FOREQ(i, a, b) for (int i = (a); i <= (int)(b); ++i)
#define ALL(c) (c).begin(), (c).end()
#define FOREACH(i, c) for (LET(i, (c).begin()); i != (c).end(); ++i)

const int INF = 0x0f0f0f0f;

char names[20][30];
int len[20];
int overlap[20][20];
int dp[1<<14][14];

int main() {
  int n;
  while (scanf("%d", &n), n) {
    memset(overlap, 0, sizeof(overlap));
    memset(dp, INF, sizeof(dp));

    REP(i, n) { scanf("%s", names[i]); }

    int k = 0;
    REP(i, n) {
      bool ok = true;
      REP(j, n) {
        if (i == j) { continue; }
        if (strstr(names[j], names[i]) != NULL) {
          ok = false;
          break;
        }
      }
      if (ok) {
        strcpy(names[k], names[i]);
        ++k;
      }
    }

    REP(i, k) { len[i] = strlen(names[i]); }

    REP(i, k) REP(j, k) {
      FOREQ(t, 1, min(len[i], len[j])) {
        if (memcmp(names[i] + len[i] - t, names[j], t) == 0) {
          overlap[i][j] = t;
        }
      }
    }

    REP(now, k) { dp[0][now] = len[now]; }
    FOR(rest, 1, (1<<k)-1) REP(now, k) {
      if (rest & (1 << now)) { continue; }
      REP(next, k) {
        if (~rest & (1 << next)) { continue; }
        dp[rest][now] = min(dp[rest][now],
            dp[rest ^ (1 << next)][next] + len[now] - overlap[now][next]);
      }
    }

    int ans = INF;
    REP(now, k) { ans = min(ans, dp[((1<<k)-1)^(1<<now)][now]); }
    printf("%d\n", ans);
  }
}

Measured memory_bytes: 0
import java.io.*;
import java.util.StringTokenizer;

public class Main {
    public static void main(String[] args) throws IOException {
        FastScanner in = new FastScanner();
        int N = in.nextInt();
        int M = in.nextInt();
        int X = in.nextInt();
        int a[] = new int [M];
        for (int i =0;i <M;i++)
        {
            a[i] = in.nextInt();
        }

        int count1= 0;
        int count2=0;

        int i =0;

        while (a[i]<X && i < M)
        {
            count1++;
            i++;
        }

        while (i<M)
        {
            count2++;
            i++;

        }

        System.out.println(Math.min(count1,count2));
    }

    public static class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        public FastScanner(String s) {
            try {
                br = new BufferedReader(new FileReader(s));
            } catch (FileNotFoundException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        }

        public FastScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String nextToken() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        String nextLine() {
            st = null;
            try {
                return br.readLine();
            } catch (IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
            return null;
        }

        int nextInt() {
            return Integer.parseInt(nextToken());
        }

        long nextLong() {
            return Long.parseLong(nextToken());
        }

        double nextDouble() {
            return Double.parseDouble(nextToken());
        }
    }
}


Measured memory_bytes: 21204
//#include <bits/stdc++.h>
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
//#include "boost/multiprecision/cpp_int.hpp"
//typedef boost::multiprecision::cpp_int ll;
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2

ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
typedef pair<dd,dd> d_d;
ll inf=(ll)1E16;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define fi first
#define se second
#define endl "\n"
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
//template<class T>void max(T a,T b){if(a<b)return b;else return a;}
//template<class T>void min(T a,T b){if(a>b)return b;else return a;}
//template<class T>bool Max(T&a, T b){if(a < b){a = b;return 1;}return 0;}
//template<class T>bool Min(T&a, T b){if(a > b){a = b;return 1;}return 0;}

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

void yes(){
    cout<<"Yes"<<endl;
}
void no(){
    cout<<"No"<<endl;
}

int main(){fastio
    ll 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};
    ll k;cin>>k;
    cout<<a[k-1]<<endl;
    
    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++)
typedef long long ll;



void Insertion_Sort(vector<int> &A,int N){
  int i,j,temp;
  //整列されていない配列の先頭から始める
  for(int i = 1 ; i < N ; i++){
    rep(k,N){
      cout << A.at(k);
      if(k < N-1) cout << " " ;
    }
    cout << endl;
    j = i;
    while( (j > 0) && (A.at(j-1) > A.at(j)) ){
      //隣り合う要素を比較して、後ろから前に適切な位置まで繰り返し交換する
      temp = A.at(j-1);
      A.at(j-1) = A.at(j);
      A.at(j) = temp;
      j--;
      
    }
    
  }
}


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

  vector<int> A(n);
  rep(i,n){
    cin >> A.at(i);
  }

  Insertion_Sort(A,n);

  rep(i,n){
    cout << A.at(i);
    if(i < n-1) cout << " " ;
  }
  cout << endl;
}


Measured memory_bytes: 3088
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll dp[101][100100],w[101],u[101];
int n,tw;
ll ds(int id, int wt) {
	if(wt > tw) {return 0;}
	if(id == n) {return 0;}
	if(dp[id][wt] != -1) {return dp[id][wt];}
	if(wt+w[id] > tw) {return dp[id][wt] = ds(id+1,wt);}
	return dp[id][wt] = max(ds(id+1,wt),u[id]+ds(id+1,wt+w[id]));
}
int main() {
	scanf("%d %d ",&n,&tw);
	memset(dp,-1,sizeof(dp));
	for(int i=0;i<n;i++) {
		ll a,b;
		scanf("%lld %lld ",&a,&b);
		w[i] = a;u[i] = b;
	}
	printf("%lld\n",ds(0,0));
}


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


using namespace std;



int N;

vector<int> B;



int main()
{

	int ans = 0;
	cin >> N;
	

	B = vector<int>(N);


	for (int i = 1; i <= N-1; i++) {
		cin >> B.at(i);
	}


	int lest = -1;
	ans = B.at(1)+B.at(N-1);
	for (int i = 1; i <= N-2; i++) {
		ans += min(B.at(i), B.at(i + 1));
	}


	cout << ans << endl;


	return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll read(){
	ll a=0,b=getchar(),c=1;
	while(!isdigit(b))c=b=='-'?-1:1,b=getchar();
	while(isdigit(b))a=a*10+b-'0',b=getchar();
	return a*c;
}
int n,a[55],b[55];
bool gg(ll x,int y,int z){
    if(z>y)return false;
    vector<int> dp(y+1,0);
    dp[y]=1;
    for(int i=49;i>=0;i--){
        if(!(x&(1LL<<i)))continue;
        for(int j=0;j<=y;j++){
            if(!dp[j])continue;
            dp[j%(i+1)]=1;
        }
    }
    return dp[z];
}
bool jj(ll x){
    for(int i=0;i<n;i++)
		if(!gg(x,a[i],b[i]))
			return false;
    return true;
}
int main(){
	n=read();
	for(int i=0;i<n;i++)
		a[i]=read();
	for(int i=0;i<n;i++)
		b[i]=read();
    ll ans=(1LL<<50)-1;
    if(!jj(ans))
    	return puts("-1"),0;
    for(int i=49;i>=0;i--){
        ans^=(1LL<<i);
        if(!jj(ans))ans|=(1LL<<i);
    }
    cout << 2*ans;
	return 0;
}

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

int main() {
    int a[3],r = 3;
    for(int i = 0;i < 3;i++) cin >> a[i];
    for(int i = 0;i < 3 && r > 1;i++) r -= a[i] == a[(i+1)%3] ? 1 : 0;
    cout <<  r << endl;
}

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

using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(15); 
    int n;
    cin >> n;
    if (n % 2 == 0) cout << n << endl; 
    else cout << 2 * n << endl; 
    return 0; 
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i,n) for(ll i = n;i >= 0;--i)
#define FOR(i,m,n) for(ll i = m, i##_len=(n);i <i##_len; ++i)
#define all(x) (x).begin(),(x).end()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
const int INF = 1e9;
const ll LLINF = 1e16;
 
ll modinv(ll a, ll m) {
    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;
}


int main(void)
{
    ll k;
    cin >> k;

    ll ans = 0;

    FOR(i,1,k+1){
        FOR(j,1,k+1){
            ll tmp = gcd(i, j);
            FOR(m, 1, k + 1)
            {
                ans += gcd(tmp, m);
            }
        }
    }

    cout << ans << endl;

    return 0;
}

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

#define rep(i,a,b) for(int i=a;i<b;i++)
#define INF INT_MAX/2
typedef long long int ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;

int main()
{
	while (1)
	{
		int T; cin >> T;
		if (T == 0) return 0;

		int t[30];
		rep(i, 0, T) cin >> t[i];

		int N; cin >> N;

		map<int, int> DM;
		rep(i, 0, N)
		{
			int D, M;
			cin >> D >> M;
			if(DM.find(D) == DM.end())
				DM[D] = M;
			else
				DM[D] = min(DM[D], M);
		}

		vvi dp(105, vi(T, INF));
		dp[1][0] = 0;

		rep(d, 1, 101) rep(j, 0, T)
		{
			if (dp[d][j] == INF) continue;

			dp[d + 1][1] = min(dp[d + 1][1], dp[d][j] + 1);
			
			if (DM.find(d) == DM.end())
			{
				dp[d + 1][(j + 1) % T] = min(dp[d + 1][(j + 1) % T], dp[d][j]);
			}
			else
			{
				if (t[j] <= DM[d])
				{
					dp[d + 1][(j + 1) % T] = min(dp[d + 1][(j + 1) % T], dp[d][j]);
				}
			}
		}

		ll ans = INF;
		rep(j, 0, T) ans = min(ans, dp[101][j]);
		cout << ans << endl;
	}
}

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


void solve(long long N, std::string S){
    long long ans = 0;
    for(int i = 0; i < N-1; ++i){
        if(S[i] != S[i+1]) ans++;
    }
    cout << ans + 1 << endl;
}

int main(){
    long long N;
    scanf("%lld",&N);
    std::string S;
    std::cin >> S;
    solve(N, S);
    return 0;
}


Measured memory_bytes: 3852
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int,int>;
#define enld '\n'
#define rep(i,n) for(int i=0; i<(n); i++)
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("Ofast")
constexpr ll INF = 1e18;
constexpr int inf = 1e9;
constexpr ll mod = 1000000007;
constexpr ll mod2 = 998244353;
const double PI = 3.1415926535897932384626433832795028841971;
const int dx[6] = {1, 0, -1, 0,1,1};
const int dy[6] = {0, 1, 0, -1,1,-1};
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
// ---------------------------------------------------------------------------

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int A,B,C,D,E;
    cin >> A >> B >> C >> D >> E;
    int sum = 0;
    if(A < 0){
        sum += (-A)*C + D;
        A = 0;
    }
    cout << sum + (B-A)*E << endl;
    return 0;
}


Measured memory_bytes: 3136
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define fastio ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define gcd(a,b) __gcd((a),(b))
#define lcm(a,b) ((a)*(b))/gcd((a),(b))
const int maxn = 1e5 + 5;
const int inf = 1000000000;
const int MOD = 1e9+7;
const double PI = 3.14159265358979323846264338; // double PI = 4*atan(1);



int main() {
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	fastio
	//ifstream cin (".in");
	//ofstream cout (".out");
    int n;
    cin >> n;
    std::vector<int> a(n);
    for(int i=0; i<n; i++){
    	cin >> a[i];
    }
    sort(a.begin(),a.end());
    cout << a[n/2]-a[n/2-1] << "\n";
}





Measured memory_bytes: 3652
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

public class AtCoderA
{
    static void Main()
    {
        var sc = new Scanner();

        Queue<char>[] cards = new Queue<char>[3];

        for (int i = 0; i < 3; i++)
        {
            Queue<char> card = new Queue<char>();
            string s = sc.Next();
            foreach (var c in s)
            {
                card.Enqueue(c);
            }
            cards[i] = card;
        }

        int turn = 0;
        while (true)
        {
            var que = cards[turn];
            if (que.Count == 0)
            {
                break;
            }
            var c = que.Dequeue();
            if (c == 'a')
            {
                turn = 0;
            }
            if (c == 'b')
            {
                turn = 1;
            }
            if (c == 'c')
            {
                turn = 2;
            }
        }

        string answer = turn == 0 ? "A" : (turn == 1 ? "B" : "C");

        Console.WriteLine(answer);
    }

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

        public Scanner()
        {
            _line = new string[0];
            _index = 0;
        }

        public string Next()
        {
            while (_index >= _line.Length)
            {
                _line = Console.ReadLine().Split(Separator);
                _index = 0;
            }

            return _line[_index++];
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            _line = Console.ReadLine().Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}

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

// 1 つの証言を表す構造体
using pint = pair<int, int>;  // 「人」と「0 or 1」

// 入力
int N;
vector<vector<pint>> v;

// 整数 bit に対応する「決め打ち」が整合しているかを判定
bool judge(int bit) {
  // i 人目の証言を検証する
  for (int i = 0; i < N; ++i) {
    // i 人目が「不親切」だったら、証言はすべて無意味
    if (!(bit & (1 << i))) continue;

    // それぞれ確認
    for (pint xy : v[i]) {
      int x = xy.first;   // x が
      int y = xy.second;  // y = 1: 正直、y = 0: 不親切

      // y = 1 なのに「不親切」だったらダメ
      if (y == 1 && !(bit & (1 << x))) return false;

      // y = 0 なのに「正直者」だったらダメ
      if (y == 0 && (bit & (1 << x))) return false;
    }
  }
  return true;
}

int main() {
  cin >> N;
  v.resize(N);
  for (int i = 0; i < N; ++i) {
    int A;
    cin >> A;
    v[i].resize(A);
    for (int j = 0; j < A; ++j) {
      cin >> v[i][j].first >> v[i][j].second;
      --v[i][j].first;  // 0-indexed に
    }
  }

  int res = 0;
  for (int bit = 0; bit < (1 << N); ++bit) {
    // 矛盾 check
    if (judge(bit)) {
      // bit に含まれる人数を数える
      int count = 0;
      for (int i = 0; i < N; ++i) {
        if (bit & (1 << i)) ++count;
      }
      res = max(res, count);
    }
  }

  cout << res << endl;
}

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

int main() {
	int a,b,c,d,x,y;
	cin >> a >> b >> c >>d;
	if(a<c){
		x=a;
		y=c;
	}
	else{
		x=c;
		y=a;
	}
	if(y-x<=d)cout << "Yes" << endl;
	else if(y-b<=d&&b-x<=d)cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define ll long long
using namespace std;
const int MOD=1000000007;
const int nmax=3123;

int n;
double p[nmax],ch[nmax],res;

int main()
{
    scanf("%d",&n);
    for(int i=1; i<=n; ++i)
    {
        cin>>p[i];
//        scanf("%f",&p[i]);
    }
    ch[0]=1;
    for(int i=1; i<=n; ++i)
    {
        for(int j=n;j>=0;--j){
            ch[j+1]+=ch[j]*p[i];
            ch[j]*=1-p[i];
        }
    }
    for(int j=n/2+1;j<=n;++j){
        res+=ch[j];
    }
    cout<< setprecision(9) <<res;
//    printf("%lf",res);
    return 0;
}


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

int main() {
	int n, sum = 0, max = 0;
	cin >> n;
	vector<int> l(n);
	rep(i, n) {
		cin >> l[i];
		if(max < l[i]) max = l[i];
		sum += l[i];
	}
	if (max < sum - max) cout << "Yes";
	else cout << "No";
	return 0;
}


Measured memory_bytes: 3556
import java.util.*;
import java.lang.*;

public class Main {
    public static void main(String[] args) {
        Scanner dataScanner = new Scanner(System.in);
        String[] data = dataScanner.nextLine().split(" ");
        int numCards = Integer.parseInt(data[0]);
        int goal = Integer.parseInt(data[1]);
        boolean foundPair = false;
        Integer[] pair = new Integer[3];
        int otoshidama = 0;
        outerloop:
        for (Integer i = 0; i < Math.max(numCards,0)+1; i++) {
            for (Integer j = 0; j < Math.max(numCards-i, 0)+1; j++) {
                int k = numCards - i - j;
                otoshidama = 10000 * i + 5000 * j + 1000 * k;
                if (otoshidama == goal) {
                    foundPair = true;
                    pair[0] = i;
                    pair[1] = j;
                    pair[2] = k;
                    break outerloop;
                }
            }
        }
        if (foundPair) {
            StringJoiner toPrint = new StringJoiner(" ");
            for (Integer number : pair) {
                toPrint.add(number.toString());
            }
            System.out.println(toPrint.toString());
        } else {
            System.out.println("-1 -1 -1");
        }
    }
}


Measured memory_bytes: 39764
#include <bits/stdc++.h> //C++の標準ライブラリを一行で一括でインクルードする
#include <math.h> //数学関数と数学定数を利用する
#define rep(i,n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
template<class T> void chmax(T &a,T b) { if (a<b) a=b;}
template<class T> void chmin(T &a,T b) { if (a>b) a=b;}

string s;
bool ans;

void rec(int pos){
  if(pos >= s.size()){
    ans = true;
    return;
  }
  
  if(s.substr(pos,5) == "dream"){
    rec(pos+5);
  }
  if(s.substr(pos,7) == "dreamer"){
    rec(pos+7);
  }
  if(s.substr(pos,5) == "erase"){
    rec(pos+5);
  }
  if(s.substr(pos,6) == "eraser"){
    rec(pos+6);
  }
  
  return;

}

int main(){
  cin >> s;
  ans = false;
  rec(0);
  
  if(ans){
    cout << "YES";
  }else{
    cout << "NO";
  }
  return 0;
}

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

int main(void)
{
	char c;
	std::cin>>c;
	if(c == 'A')
	std::cout<<"T\n";
	else if(c == 'G')
	std::cout<<"C\n";
	else if(c == 'T')
	std::cout<<"A\n";
	else std::cout<<"G\n";
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
#define ar array
#define pb push_back

const int mxn=1e5+2;
ll dp[mxn];

int main()
{
	// #ifndef ONLINE_JUDGE
	// 	freopen("input.txt","r",stdin);
	// 	freopen("outputc.txt","w",stdout);
	// #endif
	
	//int t;
	//cin>>t;
	//while(t--)
	{
		int n,w;
		cin>>n>>w;
		ll a[n][2];
		for(int i=0;i<n;i++)
		{
			cin>>a[i][0]>>a[i][1];
		}
		memset(dp,0x3f,sizeof(dp));
		dp[0]=0;
		for(int i=0;i<n;i++)
		{
			for(int j=100000;j>=0;j--)
			{
				if(j-a[i][1]>=0)
				{
					dp[j]=min(dp[j],dp[j-a[i][1]]+a[i][0]);
				}
			}
		}
		int ans=0;
		for(int i=100000;i>=0;i--)
		{
			if(dp[i]<=w)
			{
				ans=max(ans,i);
			}
		}
		cout<<ans<<'\n';
		
	}
		
}


Measured memory_bytes: 4372
export class Main {
  static main(input: string): string {
    const tmp: string[] = input.split("\n");
    const [n]: number[] = tmp.shift().split(" ").map(int => parseInt(int));
    const d: number[] = tmp.shift().split(" ").map(int => parseInt(int));
    let result = 0;
    for (let i = 0; i < n; i++) {
      for (let j = i + 1; j < n; j++) {
        result += d[i] * d[j];
      }
    }
    return `${result}`;
  }
}
console.log(Main.main(require("fs").readFileSync("/dev/stdin", "utf8")));


Measured memory_bytes: 7372
N, M = map(int, input().split())
f = [False]*N
ac = 0
wa = [0]*N
for _ in range(M):
    p, s = list(input().split())
    p = int(p)
    if s == 'AC' and not f[p-1]:
        f[p-1] = True
        ac += 1
    elif not f[p-1]:
        wa[p-1] += 1
w = 0
for i in range(N):
    if f[i]:
        w += wa[i]
print(ac, w)


Measured memory_bytes: 50536
#include <stdio.h>
char S[11];
int main()
{
    int N,i;
    scanf("%d",&N);
    int m=0,a=0,r=0,c=0,h=0;
    for(i=0;i<N;i++)
    {
        scanf("%s",S);
        if(S[0]=='M') m++;
        else if(S[0]=='A') a++;
        else if(S[0]=='R') r++;
        else if(S[0]=='C') c++;
        else if(S[0]=='H') h++;
    }
    long long ans=(long long)m*a*r+(long long)m*a*c+(long long)m*a*h
                  +(long long)m*r*c+(long long)m*r*h+(long long)m*c*h
                  +(long long)a*r*c+(long long)a*r*h+(long long)a*c*h+(long long)r*c*h;
    printf("%lld\n",ans);
    return 0;
} 

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) for(int i = 0; i < (b); i++)
#define all(a) (a).begin(), (a).end()
#define show(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
const int INF = 2000000000;
using namespace std;

int main(){
    long long n,x;
    cin >> n >> x;

    if(n == 2 && x == 2){
        cout << "Yes" << endl;
        cout << 1 << endl << 2 << endl << 3 << endl;
        return 0;
    }else if(n == 2){
        cout << "No" << endl;
        return 0;
    }

    if(x == 2 * n - 1 || x == 1){
        cout << "No" << endl;
        return 0;
    }

    long long a[200005] = {0};
    long long p = (2 * n - 1) / 2;
    if(x == 2){
        a[p - 1] = 4;
        a[p] = 2;
        a[p + 1] = 1;
        a[p + 2] = 3;

        int i = 5;
        rep(j,2 * n - 1){
            if(a[j] == 0){
                a[j] = i;
                i++;
            }
        }
    }else{
        a[p - 1] = x - 1;
        a[p] = x;
        a[p + 1] = x + 1;
        a[p + 2] = x - 2;

        int i = 1;
        rep(j,2 * n - 1){
            while(i >= x - 2 && i <= x + 1) i++;
            if(a[j] == 0){
                a[j] = i;
                i++;
            }
        }
    }

    long long sum = 0;
    rep(i,2 * n - 1){
        sum += a[i];
    }
    assert(sum == ((2 * n - 1) * (2 * n - 1)  + (2 * n - 1) ) / 2);
    cout << "Yes" << endl;
    rep(i,2 * n - 1){
        cout << a[i] << endl;
    }


}


Measured memory_bytes: 3072
data class Ken(val x: Int, val y: Int, val c: Int) {
    constructor(xyc: List<Int>): this(xyc[0] - 1, xyc[1] - 1, xyc[2])
}
fun main(args: Array<String>) {
    val (A, B, M) = listOfInt()
    val a = listOfInt()
    val b = listOfInt()
    val kens = Array<Ken>(M) { Ken(listOfInt()) }
    val costs = IntArray(M)
    repeat(M) { m ->
        costs[m] = Math.max(0, a[kens[m].x] + b[kens[m].y] - kens[m].c)
    }
    val ans = Math.min(costs.min()!!, a.min()!! + b.min()!!)
    println(ans)
}
fun next() = readLine()!!
fun listOfString() = next().split(" ")
fun listOfLong() = listOfString().map(String::toLong)
fun nextInt(delta: Int = 0) = Integer.parseInt(next()) + delta
fun listOfInt(delta: Int = 0) = listOfString().map { Integer.parseInt(it) + delta }


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

using namespace std;
#define int long long
int MOD = 1000000007;


signed main(){
    int N;
    string S,T;
    cin >> N >> S >> T;
    
    int s=0,t=0;
    string ans;
    for(int i=0;i<2*N;i++){
        if(i%2==0){
            ans += S[s];
            s++;
        }else{
            ans += T[t];
            t++;
        }
    }
    
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main(){

  int A, B, C, D, L;
  int date_langue, date_math, date_play;
  int tmp;
  
  while(1){
    cin >> L >> A >> B >> C >> D;
    
    date_langue = A/C;

    tmp = A%C;
    if(tmp > 0)
      date_langue ++;

    date_math = B/D;
    tmp = B%D;
    if(tmp > 0)
      date_math ++;
 
    if(date_langue > date_math){
      date_play = L - date_langue;
    }else date_play = L - date_math;
    
    cout << date_play << endl;
    break;
  }
}



Measured memory_bytes: 3068
#include <bits/stdc++.h>
#define r(i,n) for(int i = 0; i<n; i++)
using namespace std;
int main() {
  int a, b,c;
  cin >> a >> b >> c;
  if(b>=c)cout << "delicious" << endl;
  else if((b+a)>=c) cout << "safe" << endl;
  else cout << "dangerous" << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#pragma GCC target ("avx2")
#pragma GCC optimization ("Ofast")
#pragma GCC optimization ("unroll-loops")
#pragma comment(linker, "/stack:200000000")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
#define int long long 
typedef pair<int,int>pi;
typedef vector<int>vi;

const int MAXN=200005;
const int MOD=1000000007;

#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define DEC(i,a,b) for(int i=(a);i>=(b);i--)
#define pb push_back
#define mp make_pair
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(),(v).end()
#define db(x) cerr<<#x<<" = "<<x<<"\n"
#define LOW(v,x) (lower_bound(all(v),(x))-(v).begin())
#define UP(v,x) (upper_bound(all(v),(x))-(v).begin())

int N;
char C[MAXN];
int W[MAXN], R[MAXN];
main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cin>>N;
	FOR(i,1,N) cin>>C[i];
	FOR(i,1,N) {
		if (C[i] == 'R'){
			R[i] = R[i-1] + 1;
			W[i] = W[i-1];
		}
		else{
			R[i] = R[i-1];
			W[i] = W[i-1] + 1;
		}
	}
	int ans = 1e18;
	FOR(i,1,N+1){
		//i-1 and before is R
		//i and after is W
		int wbefore = W[i-1];
		int rafter = R[N] - R[i-1];
		int tmp = wbefore + rafter - min(wbefore, rafter);
		ans = min(ans, tmp);
	}
	cout<<ans;
}



Measured memory_bytes: 6956
#include<bits/stdc++.h>
using namespace std;
int len,score;
char s[100005];
int main()
{
	cin>>s;
	len=strlen(s);
	for(register int i=0;i<len;i++)
	{
		if(i%2==0)
		{
			if(s[i]=='p')
				score--;
		}
		else
			if(s[i]=='g')
				score++;
	}
	printf("%d\n",score);
	return 0;
}

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

int main(){
  string n;
  cin >>n;
  int m1=n[0]-'0';
  int m2=n[1]-'0';
  int m3=n[2]-'0';
  if((m2<m1)||(m2==m1)&&(m3<=m1))
     cout<<m1<<m1<<m1<<endl;
  if(((m2==m1)&&(m3>m1))||(m2>m1))
    cout<<m1+1<<m1+1<<m1+1<<endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int S[100001], n;

int binarySearch(int key) {
    int left = 0;
    int right = n;

    while (left < right) {
        int mid = (left + right) / 2;
        if (key == S[mid])
            return 1;
        else if (key > S[mid])
            left = mid + 1;
        else
            right = mid;
    }
    return 0;
}

int main()
{
    int q, i;
    int T, ans = 0;

    scanf("%d", &n);

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

    scanf("%d", &q);

    for (i = 0; i < q; i++) {
        scanf("%d", &T);
        if (binarySearch(T))
            ans++;
    }

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

    return 0;
}

Measured memory_bytes: 2088
//
//   “Daḷhaṃ sikkhatha santiyā.” - Utthana Sutta (Sutta Nipata) 
//    Saket Saumya 
//    APR 26 2020
//

#include<bits/stdc++.h>
#include<string.h>
using namespace std;


#define ll long long 
#define all(x) x.begin(),x.end()
#define RESET   "\033[0m"
#define RED     "\033[31m"      /* Red */
#define what_is(x) cerr << RED << #x << " is " << x  << RESET << endl;
 

const long long MOD = 1e9+7 ;
const int N=(2e5)+5;
const long long INF=1LL << 57;
 
// Data Structures
vector <ll> vec(N),v1, v2, v3;
vector < pair <ll, pair < ll , ll >  > > vp, vp1, vp2;
set < ll > se;
unordered_set <ll > use;
multiset < ll > ms;
map <  ll, ll > mp, done, mp1;
unordered_map < ll, ll > ump;


ll t, n, m, p, q, x, y, a, b, c, mini= LLONG_MAX, maxi= LLONG_MIN,res, ans;


queue <pair <ll, ll > > bfsq;
ll vis[N];
vector < ll >  adj[N], adj1[N];
ll visited[1005][1005] ;
char mat[1005][1005];
ll dp[1005][1005];


//<-------------------------------------------CODE STARTS HERE --------------------------------------------------------------->//

string s;
signed  main(){
        
            ios_base::sync_with_stdio(false);
            cin.tie(nullptr);cout.tie(nullptr);
           
                    
            set <string> ss;
            cin >> n;
            while (n-- ){
                    cin >> s;
                    ss.insert(s);
            }
            cout << ss.size() << endl;

















            
             
            

            
            
            
            



            
            























                
                
                
 
                
 
 
 
        
        
 
 
 
}       
       
 
 
       
       
       
       
       
       
       
 
 
 
 
 
        
        
 
 
           
 
       
       
 
            
       
       
       
       
       
       
        
 
 
 
 
 
 
       
 
 
 
 
 
        
 
 
       
 
 
       
       
       
       
       
       
       
 
 
 
 
 
        
        
 
 
           
 
       
       
 
            
       
       
       
       
       
       
        
 
 
 
 
 
 
       
 
 
 
 
 
        
 
 

       
       
       
       
       
 
 
 
 
 
        
        
 
 
           
 
       
       
 
            
       
       
       
       
       
       
        
 
 
 
 
 
 
       
 
 
 
 
 
        
 
 
       
 
 
       
       
       
       
       
       
       
 
 
 
 
 
        
        
 
 
           
 
       
       
 
            
       
       
       
       
       
       
        
 
 
 
 
 
 
       
 
 
 
 
 
        
 
 




Measured memory_bytes: 29864
#include<iostream>
#include<vector>
#include<set>
#include<algorithm>
#include<string>
#include<cstdio>
#include<cstdlib>
#include<iomanip>
#include<fstream>
using namespace std;
typedef long long ll;
#define fast_io ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

int main()
{
    fast_io;
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
    
    int n, res;
    cin >> n;
    int cop = n;

    if (n % 1000 != 0)
    {
        n /= 1000;
        res = ((n * 1000) + 1000) - cop;
    }
    else
        res = n % 1000;
    
    cout << res << endl;

    return 0;
}

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

int main() {
  int N = 1;
  while (N) {
    if (N*N*N*N*N - (N-1)*(N-1)*(N-1)*(N-1)*(N-1) > 1000000000) {
      break;
    }
    N++;
  }
  int X;
  cin >> X;
  int i = -N, j = -N;
  while (i < N) {
    j = -N;
    while (j < N) {
      if (i*i*i*i*i - j*j*j*j*j == X) {
        goto OUT;
      }
      j++;
    }
    i++;
  }
  OUT:
  cout << i << ' ' << j << endl;
}

Measured memory_bytes: 3636
n = gets.chomp.to_i
i = 1
loop do
  x = i
  if x % 3 == 0
    print " #{i}"
    i += 1
    if i <= n
      next
    else
      break
    end
  end

  loop do
    if x % 10 == 3
      print " #{i}"
      if i <= n
        break
      else
        puts
        return
      end
    end
    x /= 10
    break if x == 0
  end

  i += 1
  if i > n
    break
  end
end
puts



Measured memory_bytes: 8896
//11
#include<iostream>

using namespace std;

int main(){
  for(int m,n;cin>>n>>m,m|n;){
    int c[1000];
    for(int i=0;i<n;i++){
      cin>>c[i];
    }
    int d[1000];
    for(int i=0;i<m;i++){
      cin>>d[i];
    }
    int p=0;
    int t;
    for(t=0;;){
      p+=d[t];
      t++;
      if(p>=n-1)break;
      p+=c[p];
      if(p>=n-1)break;
    }
    cout<<t<<endl;
  }
  return 0;
}

Measured memory_bytes: 0
import java.util.*;

public class Main{
  public static void main(String[]args){
    Scanner sc = new Scanner(System.in);
    String S = sc.next();
    
    System.out.print(S.charAt(0));
    System.out.print(S.length()-2);
    System.out.print(S.charAt(S.length()-1));
    System.out.println("");
  }
}

Measured memory_bytes: 23764
import java.util.*;
import java.math.*;
import java.io.*;
 
class Main {
	static final int INF = 2 << 29;
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while(true) {
			int n = sc.nextInt();
			int m = sc.nextInt();
			if(n == 0 && m == 0) break;
			int[] K = new int[n+2];
			int[][] map1 = new int[n+2][];
			int[][] map2 = new int[n+2][];
			int[][][] dp = new int[n+2][][];
			int KMax = 0;
			for(int i = 0; i < n; i++) {
				K[i+1] = sc.nextInt();
				KMax = Math.max(K[i+1], KMax);
				map1[i+1] = new int[K[i+1]];
				map2[i+1] = new int[K[i+1]];
				for(int j = 0; j < K[i+1]; j++) {
					map2[i+1][j] = sc.nextInt();
					map1[i+1][j] = sc.nextInt();
				}
			}
			map1[0] = new int[KMax];
			map2[0] = new int[KMax];
			map1[n+1] = new int[KMax];
			map2[n+1] = new int[KMax];
			for(int i = 0; i < KMax; i++) {
				map2[0][i] = 0;
				map2[n+1][i] = 0;
				map1[0][i] = i+1;
				map1[n+1][i] = i+1;
			}
			K[0] = KMax;
			K[n+1] = KMax;
			for(int i = 0; i < n+2; i++) {
				dp[i] = new int[K[i]][m+1];
			}
			
			for(int i = 0; i < n+2; i++) {
				for(int j = 0;j < dp[i].length; j++) {
					Arrays.fill(dp[i][j], INF);
				}
			}
			for(int i = 0; i < dp[0].length; i++) {
				dp[0][i][m] = 0;
			}
			
			for(int i = 0; i < n+1; i++) {
				for(int j = 0; j < dp[i].length; j++) {
					for(int k = m; k >= 0; k--) {
						for(int l = 0; l < dp[i+1].length; l++) {
							if(i == 0 || i == n) {
								dp[i+1][l][k]   = Math.min(0 + dp[i][j][k],dp[i+1][l][k]);
							}
							else {
								dp[i+1][l][k]   = Math.min(dp[i+1][l][k], (map1[i][j] + map1[i+1][l])*Math.abs(map2[i][j] - map2[i+1][l]) + dp[i][j][k]);
							}
						}
						if(i != n && k != 0)
						for(int l = 0; l < dp[i+2].length; l++) {
							if(i == 0 || i == n-1) {
								dp[i+2][l][k-1]  = Math.min(0 + dp[i][j][k],dp[i+2][l][k-1]);
							}
							else {
								dp[i+2][l][k-1]  = Math.min(dp[i+2][l][k-1], (map1[i][j] + map1[i+2][l])*Math.abs(map2[i][j] - map2[i+2][l]) + dp[i][j][k]);
							}
						}
					}
				}
			}
			int max = dp[n+1][0][0];
			for(int i = 0; i < KMax; i++) {
				for(int j = m; j >= 0; j--) {
					max = Math.min(max, dp[n+1][i][j]);
				}
			}
			System.out.println(max);
			
			
			
			
			
			
			
			
			
			
			
			
		}

	}
}
             
        

Measured memory_bytes: 57492
//RohitKaushal
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define print(x) cerr << (#x) << "is "<< x << "\n"
typedef long long ll;
const int MOD = 1e9+7;


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

   // char *a[]={"Sunny","cloudy","Rainy"};
   string str;

   cin>> str;

   if(str== "Sunny"){
   	cout<<"Cloudy";
   }

   if(str== "Cloudy"){
   	cout<<"Rainy";
   }

   if(str== "Rainy"){
   	cout<<"Sunny";
   }
   return 0;
} 


Measured memory_bytes: 256
class dice init =
  let rot_n (x1,x2,x3,x4,x5,x6):int*int*int*int*int*int = (x2,x6,x3,x4,x1,x5) and
      rot_e (x1,x2,x3,x4,x5,x6):int*int*int*int*int*int = (x4,x2,x1,x6,x5,x3) in
  let rot_s l = rot_n l |> rot_n |> rot_n and
      rot_w l = rot_e l |> rot_e |> rot_e in
  let all_init =
    let rec rotate d list = function
        0 -> list
      | i -> rotate (rot_e d) (d::list) (i-1) in
    let rotate2 n l = rotate n l 4 in
    rotate2 init []
    |> rotate2 (rot_e init |> rot_s)
    |> rotate2 (rot_w init |> rot_s)
    |> rotate2 (rot_n init)
    |> rotate2 (rot_s init)
    |> rotate2 (rot_n init |> rot_n) in
object (self: 'self)
  val mutable faces:int*int*int*int*int*int = init
  val all:'a list = all_init

  method get_face = faces
  method get_all = all
  method equals (other:'self) = self#contains other#get_face
  method contains fc =
    let rec find l = match l with
        [] -> false
      | (x1,x2,x3,x4,x5,x6)::tl -> if (x1,x2,x3,x4,x5,x6) = fc then true
                                   else find tl
    in find all
end;;

let split_int s = Str.split (Str.regexp_string " ") s |> List.map int_of_string;;
let () =
  let f n = (n 0,n 1,n 2,n 3,n 4,n 5) in
  let nth s = split_int s |> List.nth in
  let d1 = new dice (read_line () |> nth |> f) and
      d2 = new dice (read_line () |> nth |> f) in
  if d1#equals(d2) then print_endline "Yes"
  else print_endline "No"
;;

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

void role(int dice[7], char order){
    int temp;
    if(order == 'E'){
        temp = dice[1];
        dice[1] = dice[4];
        dice[4] = dice[6];
        dice[6] = dice[3];
        dice[3] = temp;
    }else if(order == 'N'){
        temp = dice[1];
        dice[1] = dice[2];
        dice[2] = dice[6];
        dice[6] = dice[5];
        dice[5] = temp;
    }else if(order == 'W'){
        temp = dice[3];
        dice[3] = dice[6];
        dice[6] = dice[4];
        dice[4] = dice[1];
        dice[1] = temp;
    }else{
        temp = dice[5];
        dice[5] = dice[6];
        dice[6] = dice[2];
        dice[2] = dice[1];
        dice[1] = temp;
    }
}

int main(){
    int dice[7], otherDice[7], n;
    rep(i,6) cin >> dice[i + 1];
    rep(i,6) cin >> otherDice[i + 1];

    bool c = false;
    rep(k,4){
        role(dice, 'E');
        rep(i,4){
            role(dice, 'N');
            rep(j,4){
                role(dice, 'E');
                if(dice[1] == otherDice[1] &&
                   dice[2] == otherDice[2] &&
                   dice[3] == otherDice[3] &&
                   dice[4] == otherDice[4] &&
                   dice[5] == otherDice[5] &&
                   dice[6] == otherDice[6]
                  ){
                    c = true;
                    break;
                }
            }
            if(c) break;
        }
        if(c) break;
    }
    if(c) cout << "Yes" << endl;
    else cout << "No" << endl;
}

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

int main() {
	char a[7];
	for(int i=0;i<6;i++)
	cin>>a[i];
	if(a[2]==a[3]&&a[4]==a[5])
	cout<<"Yes";
	else
	cout<<"No";
	return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int m = sc.nextInt();
    int x = sc.nextInt();
    int y = sc.nextInt();
    int x_max = -99999;
    int y_min = 99999;
    for (int i = 0; i < n; i++) {
      int tmp_x = sc.nextInt();
      if (x_max < tmp_x) {
        x_max = tmp_x;
      }
    }
    for (int i = 0; i < m; i++) {
      int tmp_y = sc.nextInt();
      if (y_min > tmp_y) {
        y_min = tmp_y;
      }
    }
    for (int z = -100; z <= 100; z++) {
      if (x < z && z <= y && x_max < z && z <= y_min) {
        System.out.println("No War");
        return;
      }
    }
    System.out.println("War");
  }
}

Measured memory_bytes: 25172
#include<stdio.h>
main(){
int W,H,x,y,r=0;
scanf("%d %d %d %d %d",&W,&H,&x,&y,&r);
if(x-r>=0&&x+r<=W&&y-r>=0&&y+r<=H)
printf("Yes\n");
else 
printf("No\n");
return 0;
}

Measured memory_bytes: 1816
#include <bits/stdc++.h>
#define PI 3.14159265359
using namespace std;

void insertionSort(vector<int> v, int N);

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

	vector<int> v(N);
	for (int i = 0; i < N; i++) {
		cin >> v.at(i);

		cout << v.at(i);
		if (i == N - 1) {
			cout << endl;
		}
		else {
			cout << ' ';
		}
	}

	insertionSort(v, N);
}

void insertionSort(vector<int> v, int N) {
	for (int i = 1; i < N; i++) {
		int n = v.at(i);
		int j = i - 1;

		while (j >= 0 && v.at(j) > n) {
			v.at(j + 1) = v.at(j);
			j--;
		}
		v.at(j + 1) = n;

		for (int k = 0; k < N; k++) {
			cout << v.at(k);
			if (k == N - 1) {
				cout << endl;
			}
			else {
				cout << ' ';
			}
		}
	}
}


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


int main()
{
	int a, b, c, x, x1, x2, x3;
	
	scanf("%d%d%d", &a, &b, &c);
	x1=abs(a-b);
	x2=abs(b-c);
	x3=abs(c-a);
	
	x=x1+x2+x3;
	
	if(x1<x2) x1=x2;
	if(x1<x3) x1=x3;
	
	x-=x1;
	
	printf("%d\n", x);
	
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define PI 3.14159265358979323846
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr long long INFL = numeric_limits<long long>::max() / 2;
constexpr int MOD = 1000000007;
using Graph = vector<vector<int>>;



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

    int N;
    cin>>N;
    cout << N/3 << endl;



}


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

int main(){
  vector<int> N(3);
  cin >> N[0] >> N[1] >> N[2];
  sort(N.begin(),N.end());
  
  int A=N[2]-N[0],B=N[2]-N[1];
  if(A%2==B%2){
    cout << (A+B)/2 << endl;
  }
  else{
    cout << B+1+(A+1-B)/2 << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstdlib>
#include <ctime>
using namespace std;
#define REP(i, j) for(int i = 0; i < j; ++i)
#define FOR(i, j, k) for(int i = j; i < k; ++i)
#define P pair<int, C>
#define d first
#define c second

class C{
  public:
    int time, cnt, now;
    C(){ now = 0; }
    bool operator < (const C &c) const { return time < c.time; }
};

int main() {
  int n;
  while(cin >>n && n){
    vector<P> v(n);
    REP(i, n){
      cin >>v[i].c.time >>v[i].c.cnt;
      v[i].d = v[i].c.time;
    }
    sort(v.begin(), v.end());

    int ans = 0;

    //debug
    //int cnt = 0;

    while(v.size() != 0){
    //while(!isEnd(v) && cnt < 670){

      //debug
      //cnt += 1;

      if(v[0].c.cnt == 0) continue;

      ans += v[0].d;
      FOR(i, 1, v.size()) if(v[i].c.cnt != 0) v[i].d -= v[0].d;
      int next = (v[0].c.now + 1) % 2;
      v[0].d = v[0].c.time;
      FOR(i, 1, v.size()){
        if(v[i].c.cnt == 0 || v[i].c.now != next) continue;

        //debug
        //cout <<"@ " <<v[0].d <<", " <<v[i].d <<", "<<(v[0].d < v[i].d) <<endl;

        //if(v[0].d < v[i].d) v[0].d = max(v[0].d, v[i].d);
        v[0].d = max(v[0].d, v[i].d);
      }
      v[0].c.now = next;
      if(next == 0){
        v[0].c.cnt -= 1;

        //debug
        //cout <<"end? " <<v[0].c.cnt <<endl;

        if(v[0].c.cnt == 0) v.erase(v.begin());
      }


      sort(v.begin(), v.end());

      //debug
      //REP(i, v.size()){
      //  cout <<i <<", d = " <<v[i].d <<", c.now = " <<v[i].c.now <<", c.cnt = " <<v[i].c.cnt <<endl;
      //}
      //cout <<"------" <<endl;


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

Measured memory_bytes: 1200
//https://atcoder.jp/contests/dp/tasks/dp_e
#include<bits/stdc++.h>
#define loop(i,a,b) for(i=(a);i<(b);i++)
#define pb push_back
#define eb emplace_back
#define all(v) (v).begin(),(v).end()
#define fr first
#define sc second
#define mk make_pair
#define endl '\n'
#define MOD 1000000007
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<ll,ll> pl;
typedef pair<int,int> pi;
const int mx=1e5+10;
ll n,w,ans=0;
ll arr[102][2];
ll dp[102][mx];
void go(ll idx)
{
	if(idx==n+1)
		return;
	for(ll i=0;i<mx;i++)
	{
		dp[idx][i]=dp[idx-1][i];
		if(i>=arr[idx][1])
		{
			dp[idx][i]=min(dp[idx][i],dp[idx-1][i-arr[idx][1]]+arr[idx][0]);
		}
		if(dp[idx][i]<=w)
		{
			//cout<<dp[idx][i]<<' ';
			//cout<<i<<' '<<idx<<endl;
			ans=max(ans,i);
		}

	}
	go(idx+1);
}
void solve()
{
	cin>>n>>w;
	for(ll i=0;i<100;i++)
		for(ll j=0;j<mx;j++)
			dp[i][j]=1e18;
		dp[0][0]=0;
	for(ll i=1;i<=n;i++)
	{
		cin>>arr[i][0]>>arr[i][1];   // w and val
	}
	go(1);
	cout<<ans<<endl;

}
int main()
{
	int t;
	t=1;
	while(t--)
		solve();
}

Measured memory_bytes: 79104
def main():
    N = int(input())
    S = input()
    ok, ng = 0, N + 1
    while abs(ok - ng) > 1:
        x = (ok + ng) // 2
        check = set()
        for i in range(N - x + 1):
            check.add(S[i: i + x])
            if S[i + x: i + 2 * x] in check:
                ok = x
                break
        else:
            ng = x

    print(ok)


if __name__ == '__main__':
    main()


Measured memory_bytes: 9432
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define INF 1e9
#define PI 3.14159265359
#define MOD 1000000007
#define ALL(v) v.begin(),v.end()
#define ALLR(v) v.rbegin(),v.rend()
typedef long long ll;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
//isPrime
//modpow modinv
//getDigit
template<class T> inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template<class T> inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
int main() {
  cout << fixed << setprecision(10);
  int h,n;
  cin >> h >> n;
  vector<int> a(n),b(n);
  rep(i,n) cin >> a.at(i) >> b[i];
  vector<vector<int>> dp(n+1,vector<int>(h+1,INF));
  rep(i,n+1){
    dp[i][0]=0;
  }
  for(int i=0; i<n; i++){
    for(int j=0; j<=h; j++){
      chmin(dp[i+1][j],dp[i][j]);
      chmin(dp[i+1][j],dp[i+1][max(j-a[i],0)]+b[i]);
    }
  }
  cout << dp[n][h] << endl;
}


Measured memory_bytes: 39424