akhauriyash/Code-Regression huggingface dataset:
import sys
input = sys.stdin.readline

def prison(n,m,id1,id2):
    if min(id2) >= max(id1):
        print(min(id2)+1-max(id1))
    else:
        print(0)


def main():
    n,m = [int(i) for i in input().split()] 
    l = []
    r = []
    for _ in range(m):
        l1, r1 = [int(i) for i in input().split()] 
        l.append(l1)
        r.append(r1)
    prison(n,m,l,r)
    
# main関数呼び出し
if __name__ == "__main__":
    main() 

Measured memory_bytes: 11012
#include <fstream>

using namespace std;

int main() {
    //freopen("tema.in", "r", stdin);
    //freopen("tema.out", "w", stdout);
    int n, m;
    scanf("%d%d", &n, &m);
    int t = 1900 * m + 100 * (n - m);
    for (int i = 1; i <= m; i++)
        t *= 2;
    printf("%d\n", t);
    return 0;
}


Measured memory_bytes: 128
#include        "algorithm"
#include        "iostream"
#include        "numeric"
#include        "iomanip"
#include        "cstring"
#include        "math.h"
#include        "bitset"
#include        "string"
#include        "vector"
#include        "ctime"
#include        "queue"
#include        "stack"
#include        "map"
#include        "set"

#include        "ext/pb_ds/assoc_container.hpp" // Common file
#include        "ext/pb_ds/tree_policy.hpp" // Including tree_order_statistics_node_update
#include        "ext/pb_ds/detail/standard_policies.hpp"

using namespace std;
using namespace __gnu_pbds;


#define          f first
#define          lgn 25
#define          endl '\n'
#define          sc second
#define          N (int)2e5+5
#define          pb push_back
#define          mod 1000000007
#define          ld long double
#define          vi vector<int>
#define          eb emplace_back
#define          vpii vector<pii>
#define          mii map<int,int>
#define          int long long 
#define          pii pair<int,int>
#define          pq priority_queue
#define          BLOCK (int)sqrt(N)
#define          test(x) while(x--)
#define          all(x) begin(x),end(x)
#define          allr(x) rbegin(x),rend(x)
#define          fo(i,a,n) for(int i=a;i<n;i++)
#define          rfo(i,n,a) for(int i=n;i>=a;i--)
#define          FAST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define          time() cerr << "Time : " << (double)clock() / (double)CLOCKS_PER_SEC << "s\n"
#define          PI acos(-1.0)
#define 		 bug(...)       __f (#__VA_ARGS__, __VA_ARGS__)

typedef tree< int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update > 
OS ;

template <typename Arg1>
void __f (const char* name, Arg1&& arg1) { cout << name << " : " << arg1 << endl; }
template <typename Arg1, typename... Args>
void __f (const char* names, Arg1&& arg1, Args&&... args)
{
     const char* comma = strchr (names + 1, ',');
     cout.write (names, comma - names) << " : " << arg1 << " | "; __f (comma + 1, args...);
}

inline void INP()
{
	#ifndef ONLINE_JUDGE
	    freopen("input.txt","r",stdin);   
	    freopen("output.txt","w",stdout);
	#endif 
}

const int inf = 0x3f3f3f3f;
const int INF = 0x3f3f3f3f3f3f3f3f;

int n,A,B,M;
string s;
vi adj[N];
int x[N], y[N] , c[N],b[N],a[N];

void go()
{
	cin >> A >> B >> M;
	int mna = inf , mnb = inf;

	fo(i,1,A+1) cin >> a[i] , mna = min( a[i] , mna);
	fo(i,1,B+1) cin >> b[i] , mnb = min( b[i] , mnb);

	int ans = mna + mnb;

	fo(i,0,M)
	{
		cin >> x[i] >> y[i] >> c[i];

		ans = min( ans , a[x[i]] + b[y[i]] - c[i] );
	}
	cout << ans << endl;
}

int32_t main()
{
	//INP(); 
	FAST;     
	int t=1; 
	// cin>>t;
	test(t) go();
}



Measured memory_bytes: 12032
#include <stdio.h>
 
int main(){
  int n, t;
  scanf("%d", &n);
  int a[2000000]={0};
  for(int i=0; i<n-1; i++){
    scanf("%d", &t);
    a[t-1]++;
  }
  for(int i=0; i<n; i++) printf("%d\n", a[i]);
}

Measured memory_bytes: 9520
#include<stdio.h>

int main(void){
int n,q;
scanf("%d",&n);   scanf("%d",&q);

char qname[n][11];
int qtime[n];
int next[n];
int start=0,end=n-1;
int tcount=0;

int i;
scanf("%s",qname[0]);   scanf("%d",&qtime[0]);
for(i=1;i<n;i++){
scanf("%s",qname[i]);   scanf("%d",&qtime[i]);
next[i-1]=i;

//printf("%s\n",qname[i]);
}
next[n-1]=-1;

while(start!=-1){
if(qtime[start]>q){
qtime[start]-=q;
next[end]=start;
end=start;
start=next[start];
next[end]=-1;
tcount+=q;
}else{
tcount+=qtime[start];
printf("%s %d\n",qname[start],tcount);
start=next[start];
}
}
return 0;
}


Measured memory_bytes: 2644
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n-1; i >= 0; i--)
#define all(x) x.begin(), x.end()
using ll = long long;
using pii = pair<int, int>;
const int mod = 1e9+7;

int main() {
    int n, m;
    cin >> n >> m;
    int a[n], b[n], c[m], d[m];
    rep(i, n) {
        cin >> a[i] >> b[i];
    }
    rep(i, m) {
        cin >> c[i] >> d[i];
    }
    rep(i, n) {
        int min_d = 1e9;
        int p;
        rep(j, m) {
            if (abs(a[i] - c[j]) + abs(b[i] - d[j]) < min_d) {
                min_d = abs(a[i] - c[j]) + abs(b[i] - d[j]);
                p = j+1;
            }
        }
        cout << p << endl;
    }
}

Measured memory_bytes: 3588
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;

int n, k;

int main()
{
	while(scanf("%d %d", &n, &k) != EOF)
	{
		int tu = (1 << n) - 1;
		int num = 1;
		int ans = (1 << 30);
		for(int i = 0; i <= tu; i++) {
			num = 1;
			for(int j = 0; j < n; j++) {
				if(i & (1 << j)) {
					num = num * 2;
				}
				else {
					num += k;
				}
			}
			ans = min(ans, num);
		}
		printf("%d\n", ans);
	}
	return 0;
}

Measured memory_bytes: 128
"use strict";
function Main(input) {
    let cin = new Inputer(input);
    let A = cin.getInt(), B = cin.getInt(), C = cin.getInt(), X = cin.getInt(), Y = cin.getInt();
    let p1 = A * X + B * Y, p2;
    if (X > Y) {
        p2 = Y * 2 * C + (X - Y) * A;
    } else if (X < Y) {
        p2 = X * 2 * C + (Y - X) * B;
    } else {
        p2 = (X + Y) * C;
    }
    let p3 = Math.max(X, Y) * 2 * C;
    console.log(Math.min(...[p1, p2, p3]));
}
class Inputer{constructor(t){if(typeof t=='undefined')throw new Error('引数（stdin）を省略できません！');this.cnt=0,this.items=t.split(/\n|\s/)}getInt(){return this.items[this.cnt++]-0}getIntArray(t){if(typeof t=='undefined')throw new Error('引数（1以上）を省略できません！');let r=new Array(t);for(let e=0;e<t;e++)r[e]=this.getInt();return r}getStr(){return this.items[this.cnt++]}getStrArray(t){if(typeof t=='undefined')throw new Error('引数（1以上）を省略できません！');let r=new Array(t);for(let e=0;e<t;e++)r[e]=this.getStr();return r}}
if (typeof window == "undefined") Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 22468
/*
　　　∫ ∫ ∫
　　　ノヽ
　　（＿　 ）
　（＿　　　 ）
（＿＿＿＿＿＿ ）
　ヽ(´･ω･)ﾉ　
　　 |　 /
　　 UU
*/
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
using P = pair<ll, ll>;
typedef vector<int> vi;
const int MOD = (int)1e9 + 7;
const ll INF = 1LL << 62;
const int inf = 1<<30;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
#define REP(i, n) for (int i = 0; i < (n); i++)
#define FOR(i,s,n) for (int i = s; i < (n); i++)
#define ALL(obj) (obj).begin(), (obj).end() //コンテナじゃないと使えない!!
#define debug(x) cerr << #x << ": " << x << "\n";
#define mp make_pair
template <typename T>
ostream& operator<<(ostream& os, vector<T> &V){
    int N = V.size();
    REP(i,N){
        os << V[i];
        if (i!=N-1) os << " ";
    }
    os << "\n";
    return os;
}
template <typename T>
ostream& operator<<(ostream& os, pair<T,T> const&P){
    os << P.first;
    os << " ";
    os << P.second;
    return os;
}
template <typename T>
ostream& operator<<(ostream& os, set<T> &S){
    auto it=S.begin();
    while(it!=S.end()){
        os << *it;
        os << " ";
        it++;
    }
    os << "\n";
    return os;
}
template <typename T>
ostream& operator<<(ostream& os, deque<T> &q){
    for(auto it=q.begin();it<q.end();it++){
        os<<*it;
        os<<" ";
    }
     os<<endl;
    return os;
}
vector<pair<int,int>> dxdy = {mp(0,1),mp(1,0),mp(-1,0),mp(0,-1)};
//fixed<<setprecision(10)<<ans<<endl;



int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    vi C(N),S(N),F(N);
    REP(i,N-1) cin >> C[i] >> S[i] >> F[i];
    REP(s,N){
        int now = 0;
        REP(i,N-s-1){
            chmax(now,S[i+s]);
            if (now%F[i+s])
                now += F[i+s]-(now%F[i+s]);
            now += C[i+s];
        }
        cout << now << endl;
    }
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <functional>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include <cassert>

#define SIZE 100005
 
using namespace std;
typedef long long int ll;
typedef pair <int,int> P;
 
using namespace std;


int main()
{	
	ll H, W, A, B;
	scanf("%lld %lld %lld %lld", &H, &W, &A, &B);
	ll p, q;
	for(ll i=0;i<H;i++){
		
		
		for(ll j=0;j<W;j++){
			if(j<A){q=1;}
			else{q=0;}
			if(i<B){p=1;}
			else{p=0;}
			printf("%lld",(p+q)%2);
		}	
		printf("\n");
	}
	
}


Measured memory_bytes: 1152
#include <bits/stdc++.h>
using namespace std;
int main(){
    long long k, a, b;
    scanf("%lld %lld %lld", &k, &a, &b);
    long long bis = 1;
    for (int i = 0; i < k; i++) {
        if(b - a > 2){
            if(bis >= a && k - i >= 2){
                bis += (b - a);
                i++;
            }else bis++;
        }else{
            bis++;
        }
    }
    printf("%lld\n", bis);
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	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: 580
#include<bits/stdc++.h>
using namespace std;
int main() {
  int a,b,c;
  map<int, int> m;
  cin >> a >> b >> c;
  ++m[a];
  ++m[b];
  ++m[c];
  if(m[5]==2 && m[7]==1) puts("YES");
  else puts("NO");
} 

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#ifdef _DEBUG
#define dlog(str) cout << "====" << str << endl;
#else
#define dlog(str)
#endif
#define INF 999999999
#define MOD 1000000007
#define REP(i, n) for(int i = 0, i##_l = (n); i < i##_l; i++)
#define FOR(i, s, e) for(int i = s, i##_l = (e); i < i##_l; i++)
#define LLI long long int
#define _min(a,b) ((a<b)?a:b)
#define _max(a,b) ((a<b)?b:a)
#define chmax(a, b) a = _max(a, b)
#define chmin(a, b) a = _min(a, b)
#define bit(a, shift) ((a>>shift)&1))
#define pm(a) ((a)?1:-1)
#define SORT(v) sort(v.begin(),v.end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
// int 2.14E±9    lli 9.2E±18    double 1.7E±380


int main() {
    cout << fixed << setprecision(10);
    int v[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 };
    int k;
    cin >> k;
    cout << v[k-1];
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#define ll long long
using namespace std;
int main()
{
    ll n, d;
    cin >> n >> d;
    ll x, y;
    int cnt = 0;
    for (int i = 0; i < n; i++) {
        cin >> x >> y;
        double sqrt_result = sqrt((x * x) + (y * y));
        if (sqrt_result <= (double)d) {
            cnt++;
        }
    }
    cout << cnt << endl;

    return 0;
}


Measured memory_bytes: 3676
#include<iostream>
#include<string>
#define ll unsigned long long 
using namespace std;

int main(){
  ll n,T,ans=0;
  string s;
  
  cin>>n>>T;
  
  cin>>s;
  
  int num[15];
  int k=0;
  for(int i=0;i<(int)s.size();i++){
    if('0'<=s[i]&&s[i]<='9')num[k++]=s[i]-'0';
  }
  
  for(int j=0;j<k;j++){
    if(num[j]==0)ans+=1;
    else{
      ll N=1;
      for(int l=0;l<num[j];l++){
	N*=n;
	if(N>1000000000){
	  cout<<"TLE"<<endl;
	  return 0;
	}
      }
      ans+=N;
      // cout<<num[j]<<endl;
    }
  }

  // cout<<num[9]<<endl;
  if(ans>1000000000){
    cout<<"TLE"<<endl;
    return 0;
  }  

  if(ans*T>1000000000){
    cout<<"TLE"<<endl;
    return 0;
  }
  
  ans*=T;

  cout<<ans<<endl;

  return 0;
}

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

void solve_a() {
	cout.precision(16);
	ll r;
	cin >> r;
	cout << 2 * r * M_PI << endl;
}

int main() {
	ll n, m;
	cin >> n >> m;
	vector<ll>a(m);
	for (ll i = 0; i < m; ++i)cin >> a[i];
	ll preans = n - accumulate(a.begin(), a.end(), 0ll);
	if (preans < 0)cout << -1 << endl;
	else cout << preans << endl;
}

Measured memory_bytes: 3672
#include <iostream>
#include <fstream>
#include <vector>
#include <queue>
#include <string>
#include <limits>
#include <algorithm>
#include <map>
#include <sstream>
#include <numeric>

using ll = long long;
using ull = unsigned long long;
using uint = unsigned int;

using namespace std;

int main()
{
  ull N, M;
  cin >> N >> M;

  vector<ll> xs(N), ys(N), zs(N), vs(N);
  for (auto i = 0; i < N; i++) {
    cin >> xs[i] >> ys[i] >> zs[i];
  }

  ll res = 0;
  for (auto b = 0; b < 8; b++) {
    for (auto i = 0; i < N; i++) {
      ll v = 0;
      v += xs[i] * (b % 2 == 0 ? 1 : -1);
      v += ys[i] * ((b >> 1) % 2 == 0 ? 1 : -1);
      v += zs[i] * ((b >> 2) % 2 == 0 ? 1 : -1);

      vs[i] = v;
    }
    sort(vs.begin(), vs.end());
    ll sum = accumulate(vs.end() - M, vs.end(), 0LL);
    res = max(res, sum);
  }

  cout << res << endl;

  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include <functional>
using namespace std;
vector<long long> colors(8,0);
long long monster = 0;

void SetColors(long long scoreInput) {
	if (scoreInput <= 399) {
		colors[0]++;
	}
	else if (scoreInput <= 799) {
		colors[1]++;
	}
	else if (scoreInput <= 1199) {
		colors[2]++;
	}
	else if (scoreInput <= 1599) {
		colors[3]++;
	}
	else if (scoreInput <= 1999) {
		colors[4]++;
	}
	else if (scoreInput <= 2399) {
		colors[5]++;
	}
	else if (scoreInput <= 2799) {
		colors[6]++;
	}
	else if (scoreInput <= 3199) {
		colors[7]++;
	}
	else {
		monster++;
	}
}

int main() {
	long long N;

	cin >> N;
	for (int i = 0; i < N; i++)
	{
		long long scoreInput;
		cin >> scoreInput;
		SetColors(scoreInput);
	}
	
	sort(colors.begin(), colors.end(),std::greater<long long>());
	
	long long colorVal = 0;
	for (int i = 0; i < 8; i++)
	{
		if (colors[i] >= 1) {
			colorVal++;
		}
	}
	long long minColorVal;

	if (colorVal == 0)
	{
		minColorVal = 1;
	}
	else {
		minColorVal = colorVal;
	}

	long long maxColorVal = colorVal;
	while (monster > 0) {
		maxColorVal++;
		monster--;
	}

	cout << minColorVal << " " << maxColorVal << endl;


	return 0;
}


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

int main() {
    int a, b;
    cin >> a >> b;
    rep(i, 1010) {
        if( floor(i * 0.08) == a && floor(i * 0.1) == b ) {
            cout << i << endl;
            return 0;
        }
    }
    cout << -1 << endl;
    return 0;
}



Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.io.BufferedReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Hamza Hasbi
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        D_Alice_Brown solver = new D_Alice_Brown();
        solver.solve(1, in, out);
        out.close();
    }

    static class D_Alice_Brown {
        public void solve(int testNumber, InputReader in, OutputWriter out) {
            long a = in.nextLong();
            long b = in.nextLong();

            out.printLine(Math.abs(a - b) <= 1 ? "Brown" : "Alice");
        }

    }

    static class InputReader {
        BufferedReader reader;
        StringTokenizer st;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream));
            st = null;
        }

        public String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    String line = reader.readLine();
                    if (line == null) {
                        return null;
                    }
                    st = new StringTokenizer(line);
                } catch (Exception e) {
                    throw new RuntimeException();
                }
            }
            return st.nextToken();
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

    }

    static class OutputWriter {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void printLine(String s) {
            writer.println(s);
        }

        public void close() {
            writer.close();
        }

    }
}



Measured memory_bytes: 21460
#include<stdio.h>

int main(){
    int a[3];
    for (int i=0;i<3;i++){
        scanf("%d", &a[i]);
    }
    int highest;
    highest=a[0];
    for (int i=0;i<2;i++){
        if (highest<a[i+1]){
        highest=a[i+1];
        }
    }
    int lowest;
    lowest=a[0];
    for (int i=0;i<2;i++){
        if (lowest>a[i+1]){
        lowest=a[i+1];
        }
    }
    printf("%d\n", highest-lowest);
    return 0;
}


Measured memory_bytes: 128
N, K = map(int, input().split())
A = list(map(int, input().split()))

count_dict = {}
for i in range(len(A)):
	if A[i] in count_dict.keys():
		count_dict[A[i]] += 1
	else:
		count_dict[A[i]] = 1

if len(count_dict.keys()) <= K:
	print(0)
else:
	need = len(count_dict.keys()) - K
	temp = sorted(count_dict.values())
	res = 0
	for i in range(need):
		res += temp[i]
	print(res)

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

int main() {
  int k;
  cin >> k;
  int amari = 7 % k;
  rep(i, k) {
    if (amari == 0) {
      cout << i + 1 << endl;
      return 0;
    }
    amari = (amari * 10 + 7) % k;
  }
  cout << -1 << endl;
  return 0;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define all(a) (a).begin(), (a).end()
#define REP(i, n) for(int (i)=0; (i)<(n); (i)++)
#define RREP(i, n) for(int (i)=(n)-1, (i)>=0; (i)--)
#define ios() cin.tie(0), ios::sync_with_stdio(false)
typedef long long ll;
typedef unsigned long long ull;
ll const MOD = 1e9+7;
ll const INF = 1e18;
using namespace std;

int main(){
    int N;
    ll W;
    cin >> N >> W;
    vector<vector<ll>> vec(4);
    ll wmin;
    REP(i, N){
        ll w, v;
        cin >> w >> v;
        if(i == 0){
            vec[0].push_back(v);
            wmin = w;
        }else{
            vec[w - wmin].push_back(v);
        }
    }
    
    REP(i, 4){
        sort(all(vec[i]), [](auto a, auto b){return a > b;});
    }

    ll ans = 0;
    vector<vector<ll>> sum(4);
    for(int i=0; i<4; i++){
        sum[i].push_back(0LL);
        for(int j=0; j<vec[i].size(); j++){
            sum[i].push_back(vec[i][j] + sum[i].back());
        }
    }

    REP(i, sum[0].size()){
        REP(j, sum[1].size()){
            REP(k, sum[2].size()){
                ll w, v;
                v = sum[0][i] + sum[1][j] + sum[2][k];
                w = wmin*i + (wmin+1)*j + (wmin+2)*k;

                if(W - w >= 0){
                    v += sum[3][min((ll)(sum[3].size()-1), (W - w)/(wmin+3))];
                    ans = max(ans, v);
                }
            }
        }
    }

    cout << ans << endl;

    return 0;
}

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

int main()
{
    int n, l;
    cin >> n >> l;
    string s[n];
    int i, j;
    for (i=0; i<n; i++) cin >> s[i];
    for (i=n-2; i>0; i--)
    {
        for (j=0; j<=i; j++)
        {
            if (s[j] > s[j+1]) swap(s[j], s[j+1]);
        }
    }
    for (i=1; i<n; i++) s[0] += s[i];

    cout << s[0] <<endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<utility>
#include<tuple>
#include<set>
#include<list>
#include<vector>
#include<map>
#include<algorithm>
#include<queue>

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FUNCTION__ << endl;
#define int long long

const long long MAXN = 1e6;
const long long MOD = 1e9+7;
const long long INF = __LONG_LONG_MAX__ / 2;

using namespace std;

int hoge[MAXN];

signed main(){
    int N;
    cin >> N;
    int i = 1;
    while(true){
      if (i <= N){
        i *= 2;
      } else {
        break;
      }
    }
    cout << i / 2<< endl;
    return 0;
}


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

int main() {
	int n, mnX = INT_MAX, mxX = INT_MIN;
	cin >> n;
	vector<int> x(n);
	for (int i = 0; i < n; i++) {
		cin >> x[i];
		mnX = min(mnX, x[i]);
		mxX = max(mxX, x[i]);
	}
	auto calc = [&](int p) {
		int res = 0;
		for (int i = 0; i < n; i++) {
			res += (p - x[i]) * (p - x[i]);
		}
		return res;
	};
	int st = mnX, en = mxX;
	while (st < en) {
		int mid = st + (en - st) / 2;
		if (calc(mid) > calc(mid + 1))
			st = mid + 1;
		else
			en = mid;
	}
	cout << calc(st) << endl;
	return 0;
}


Measured memory_bytes: 256
//#include <fsociety>
#include <cmath>
#include <deque>
#include <algorithm>
#include <iterator>
#include <list>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <unordered_set>
#include <stack>
#include <string>
#include <vector>
#include <iostream>
//end of libraries ;
#define INF 9999999999
#define N 4000
#define F first
#define S second
#define pb push_back
#define ll long long
#define fcin ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
using namespace std;
string s;
int a, b ;
int main(){
fcin;
	cin>>s;
	for(int i = 0 ; i < s.length() ; i++){
		if(s[i]=='A') a++;
		if(s[i]=='B') b++;
	}
	if(a!=0 && b!=0) cout<<"Yes\n";
	else cout<<"No\n";
}

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

int main(){
  int n, a, b;  scanf("%d%d%d", &n, &a, &b);
  char s[100002];  scanf("%s", s);

  int count = 0;
  int bcount = 0;
  for(int i=0; i<strlen(s); i++){
    if(s[i] != 'c' && count < a+b){
      if(s[i] == 'b'){
	if(++bcount <= b){
	  count++;
	  printf("Yes\n");
	}else{
	  printf("No\n");
	}
      }else{
	count++;
	printf("Yes\n");
      }
    }else{
      printf("No\n");
    }
  }
  return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <cstdio>
#include <vector>
#include <list>
#include <algorithm>
#include <cmath>
#include <stack>
#include <map>
#include <numeric>
#include <sstream>
#include <queue>
#include <iomanip>
using namespace std;

#define REP(i,n) for(int (i)=0; (i)<(n); (i)++)
#define FOR(i,a,b) for(int (i)=(a); (i)<(b); (i)++)
#define PUSH(n,v) for(int i=0; i<(n); i++) {int j; cin >> j; v.push_back(j);}
#define ALL(v) v.begin(), v.end()
#define print(s) cout << (s) << endl
#define printV(v) for(int zxc=0;zxc<v.size()-1;zxc++){cout << v[zxc] << " ";} cout << v.back() << endl;

vector<int> freq(vector<int> v) {
    vector<int> w(v);
    vector<int> a(v.size(),0);
    sort(ALL(w));
    REP(i,v.size()) {
        a[i] += upper_bound(ALL(w), v[i]) - lower_bound(ALL(w), v[i]);
    }
    return a;
}

bool same(vector<int> a, vector<int> b) {
    REP(i,a.size()) if (a[i] != b[i]) return false;
    return true;
}

void solve108(int n) {
    vector<int> v;
    PUSH(n,v);
    int cnt = 0;
    vector<int> a;
    while (true) {
        a = freq(v);
        if (same(v,a)) break;
        v = a;
        cnt++;
    }
    cout << cnt << endl;
    printV(a);
}

int main() {
    int n;
    while (cin >> n, n) {
        solve108(n);
    }
    return 0;
}

Measured memory_bytes: 1212
from sys import stdin

def main():
    N = int(input())
    SP = [tuple(input().split()) for _ in [0] * N]

    sp = [(i, s, int(p)) for i, (s, p) in enumerate(SP, start=1)]
    sp.sort(key=lambda x: x[2], reverse=1)
    sp.sort(key=lambda x: x[1])
    for i, s, p in sp:
        print(i)

input = lambda: stdin.readline()
main()


Measured memory_bytes: 3064
use std::io::{self, BufRead};
use std::mem::swap;

const M: usize = 2019;

fn main() {
  let stdin = io::stdin();
  let mut lines = stdin.lock().lines();
  let nums: Vec<usize> = lines.next().unwrap().unwrap().chars().map(|c| c as usize - 48).collect();
  let mut zeroes = 0;
  let mut counts = vec![0; M];
  for i in 0..nums.len() {
    let mut temp = vec![0; M];
    for j in 0..M {
      let k = ((j * 10 % M) + nums[i]) % M;
      temp[k] = counts[j];
    }
    temp[nums[i]] += 1;
    swap(&mut counts, &mut temp);
    zeroes += counts[0];
  }
  println!("{}", zeroes);
}

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

typedef long long ll;

int main()
{
    int N, K;
    string S;
    cin >> N >> S >> K;
    for (int i = 0; i < S.size(); ++i)
    {
        if (S[i] != S[K - 1])
        {
            S[i] = '*';
        }
    }
    cout << S << endl;
}


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

int main(void){
    long long a, b, x;
    cin >> a >> b >> x;
    
    long long ans;
    if(a != 0){
        ans = b / x - (a - 1) / x;
    }else{
        ans = b / x + 1;
    }
    
    cout << ans << endl;
    
    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 T = sc.nextInt();
		for(int z=0;z<T;z++){
			int n = sc.nextInt();
			String s = sc.next();
			boolean[][] map = new boolean[2][2*n+2];
			for(int i=1;i<=2*n;i++){
				if(s.charAt(i-1)=='Y') map[0][i] = true;
				if(s.charAt(i+2*n-1)=='Y') map[1][i] = true;
			}

			int[][] dp = new int[3][n+2];
			for(int i=0;i<3;i++) Arrays.fill(dp[i], Integer.MAX_VALUE);
			dp[0][0] = 0;
			
			boolean t, b;
			int add = 0;
			for(int k=0;k<=n;k++){
				for(int i=0;i<3;i++){
					for(int j=0;j<3;j++){
						if(k==0 && i==0 || k==n && j==0 || 0<k && k<n){
							t = map[0][2*k]|map[0][2*k+1];
							b = map[1][2*k]|map[1][2*k+1];
							if(i-j==2 || i-j==-2) add = 3;
							else if(i+j==1){
								if(b) add = 3;
								else add = 2;
							}
							else if(i+j==3){
								if(t) add = 3;
								else add = 2;
							}
							else{
								if(i==0 && b || i==2 && t) add = 4;
								else if(i==1 && t&b) add = 3;
								else if(t|b) add = 2;
								else add = 1;
							}
							
							dp[j][k+1] = Math.min(dp[j][k+1], dp[i][k]+add);
						}
					}
				}
			}
			System.out.println(dp[0][n+1]-1);
		}
	}

}

Measured memory_bytes: 26080
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> pl;
typedef vector<pl> vp;
#define fore(i,a,b) for(ll i=(a);i<=(b);++i)
#define rep(i,n) fore(i,0,(n)-1)
#define rfore(i,a,b) for(ll i=(b);i>=(a);--i)
#define rrep(i,n) rfore(i,0,(n)-1)
#define all(x) (x).begin(),(x).end()
const ll INF=1001001001;
const ll LINF=1001001001001001001;
const ll D4[]={0,1,0,-1,0};
const ll D8[]={0,1,1,0,-1,-1,1,-1,0};
template<class T>
bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>
bool chmin(T &a,const T &b){if(b<a){a=b;return 1;}return 0;}
template<class T>
ll sum(const T& a){return accumulate(all(a),0LL);}

void solve(){
    ll a,b,c;cin>>a>>b>>c;
    if(a<b&&b<c)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

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



Measured memory_bytes: 3160
#include <bits/stdc++.h>
#define REP(i, m, n) for(int (i) = (m); (i) < (n); ++i)
#define rep(i, n) REP(i, 0, n)
#define all(x) (x).begin(), (x).end()
using namespace std;
using Graph = vector<vector<int>>;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
typedef long long ll;
typedef pair<ll, ll> P;
const int INF = 1e9+7;
const ll LINF = 1LL<<60;

const ll mod = 1e9+7;

int main()
{
    cin.tie(0);
    ios_base::sync_with_stdio(0);
    ll n, k;
    cin >> n >> k;

    ll res = 0;
    for (ll i = k; i <= n + 1; ++i) {
        ll a = ((n + (n - (i - 1))) / 2 * i);
        ll b = ((i - 1 + 0) / 2 * i);
        res = (res + a - b + 1) % mod;
    }
    cout << res << endl;

    return 0;
}

Measured memory_bytes: 3652
#include<stdio.h>
#include <math.h> 
int main() 
{
	int X;
	scanf("%d",&X);
	if(X>=400&&X<=599)
		printf("8");
	if(X>=600&&X<=799)
		printf("7");
	if(X>=800&&X<=999)
		printf("6");
	if(X>=1000&&X<=1199)
		printf("5");
	if(X>=1200&&X<=1399)
		printf("4");
	if(X>=1400&&X<=1599)
		printf("3");
	if(X>=1600&&X<=1799)
		printf("2");
	if(X>=1800&&X<=1999)
		printf("1");
	return 0;
	
}

Measured memory_bytes: 1624
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define rep1(i,n) for(int i=1; i<=(n); ++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define sz(v) (int)v.size()
#define pb push_back

using namespace std;
int gcd(int m,int n){
    if(m < n) swap(m,n);
    if(!n) return m;
    return gcd(n,m%n);
}

int N,temp;
vector<int> A;
vector<int> L(100005),R(100005);

int main(){
    cin >> N;
    rep(i,N) cin >> temp, A.pb(temp);
    L[0] = 0, R[0] = 0;
    rep(i,N){
        L[i+1] = gcd(L[i],A[i]);
        R[i+1] = gcd(R[i],A[N-1-i]);
    }
    int ans = 0;
    rep(i,N) ans = max(ans,gcd(L[i],R[N-1-i]));
    cout << ans << endl;
}

Measured memory_bytes: 1660
#include <iostream>

using namespace std;

int main(int argc, char const *argv[])
{
	int a, b;
	cin >> a >> b;
	if (a < b) cout << 'a' << ' ' << '<' << ' ' << 'b' << endl;
	else if (a > b) cout << 'a' << " > " << 'b' << endl;
	else cout << 'a' << " == " << 'b' << endl;
	return 0;
}


Measured memory_bytes: 3104
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < n; ++i)
#pragma region Debug
template <typename T>
void view(const std::vector<T> &v)
{
    for (const auto &e : v)
    {
        std::cout << e << " ";
    }
    std::cout << std::endl;
}
template <typename T>
void view(const std::vector<std::vector<T>> &vv)
{
    for (const auto &v : vv)
    {
        view(v);
    }
}
#pragma endregion

ll gcd(ll A, ll B)
{
    if (A < B)
    {
        return gcd(B, A);
    }
    if (B == 0)
    {
        return A;
    }
    return gcd(B, A % B);
}

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

int f(int b)
{
    int res = 0;
    while (b % 2 == 0)
    {
        b /= 2;
        res++;
    }
    return res;
}

int main()
{
    int n, m;
    cin >> n >> m;
    vector<int> a(n);
    rep(i, n)
    {
        cin >> a[i];
        if (a[i] % 2 == 1)
        {
            cout << 0 << endl;
            return 0;
        }
        a[i] /= 2;
    }

    int k = f(a[0]);
    rep(i, n)
    {
        if (k != f(a[i]))
        {
            cout << 0 << endl;
            return 0;
        }
        a[i] = a[i] >> k;
    }
    m = m >> k;
    ll t = 1;
    for (auto &x : a)
    {
        t = lcm(t, x);
        if (t > m)
        {
            cout << 0 << endl;
            return 0;
        }
    }
    int ans = m / t;
    ans = (ans + 1) / 2;

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 768
n,q = map(int,input().split())
graph = [[] for i in range(n)]
for i in range(n-1):
  a,b = map(int,input().split())
  a -= 1
  b -= 1
  graph[a].append(b)
  graph[b].append(a)

weight = [0 for i in range(n)]
for i in range(q):
  p,x = map(int,input().split())
  weight[p-1] += x

st = [0]
visit = [False for i in range(n)]
while not len(st) == 0:
  now = st.pop()
  visit[now] = True
  for e in graph[now]:
    if visit[e]:
      continue
    weight[e] += weight[now]
    st.append(e)
    
print(' '.join(map(str,weight)))

Measured memory_bytes: 71196
# -*- coding: utf-8 -*-

N,M = map(int ,input().split())

H = input().split()
H = [int(s) for s in H]

tower = [0]*N
A=[0]*M
B=[0]*M

for i in range(0,M):
    A[i],B[i] = map(int,input().split())
    if H[A[i]-1] > H[B[i]-1]:
        ev = B[i]-1
    elif H[A[i]-1] == H[B[i]-1]:
        tower[A[i]-1]+=1
        tower[B[i]-1]+=1
        continue
    else:
        ev = A[i]-1
    tower[ev] += 1


print(tower.count(0))

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

using namespace std;
using ll = long long;
#define int ll
using VI = vector<int>;
using VVI = vector<VI>;
using PII = pair<int, int>;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define PB push_back

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const int MOD = 1000000007;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template <typename T> bool IN(T a, T b, T x) { return a<=x&&x<b; }
template<typename T> T ceil(T a, T b) { return a/b + !!(a%b); }
template<class S,class T>
ostream &operator <<(ostream& out,const pair<S,T>& a){
  out<<'('<<a.first<<','<<a.second<<')';
  return out;
}
template<class T>
ostream &operator <<(ostream& out,const vector<T>& a){
  out<<'[';
  REP(i, a.size()) {out<<a[i];if(i!=a.size()-1)out<<',';}
  out<<']';
  return out;
}

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

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

  int n, m;
  cin >> n >> m;
  VI x(n), y(n), z(n);
  REP(i, n) cin >> x[i] >> y[i] >> z[i];

  int ans = 0;
  REP(i, 1<<3) {
    VI v;
    REP(j, n) {
      int tmp = 0;
      if(i&1) {
        tmp += x[j];
      } else {
        tmp -= x[j];
      }
      if(i&2) tmp += y[j];
      else tmp -= y[j];
      if(i&4) tmp += z[j];
      else tmp -= z[j];
      v.PB(tmp);
    }
    sort(ALL(v));
    reverse(ALL(v));
    // cout << v << endl;
    int ret = 0;
    REP(j, m) {
      ret += v[j];
    }
    chmax(ans, ret);
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
I=lambda:map(int,input().split())
n,k=I()
l=[[a-1,i]for i,a in enumerate(I(),1)]
for a,_ in l:
  if a<0:
    print(-1)
    exit()
l.sort(reverse=1)
r=[i for _,i in l]
b=r[-1]
for i in range(k):
  for t in l:
    if t[1]==b:continue
    if not t[0]:
      print(-1)
      exit()
    t[0]-=1
    r.append(t[1])
  l.sort(reverse=1)
  b=r[-1]
print(len(r))
print(*r)

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

#define NEW(p,n){p=malloc((n)*sizeof(p[0]));if(p==NULL){printf("not enough memory\n");exit(1);};}
//pの型の変数n個の要素分のメモリを確保し、そのアドレスをpに代入するマクロ

#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))

int main(void){
    int A, B;
    scanf("%d%d",&A,&B);


    int ans=-1;
    if(A<10 && B<10) ans=A*B;
    printf("%d\n",ans);

    return 0;
}

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

using namespace std;

using ll = long long;
using ld = long double;
using P = pair<int, int>;
constexpr ld EPS = 1e-12;
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr int MOD = 1e9 + 7;

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

    string s;cin>>s;
    int n=s.length();
    int res = INF;
    for(int i=0;i<n-2;i++){
        string t=s.substr(i,3);
        res = min(res, abs(stoi(t)-753));
    }
    cout<<res<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
/* typedef */
typedef long long ll;
typedef pair<int, int> pii;
/* constant */
const int INF = 1 << 30;
const ll LINF = 1LL << 50;
const int NIL = -1;
const int MAX = 10000;
const int mod = 1000000007;
const double pi = 3.141592653589;
/* global variables */
/* function */
/* main */
int main(){
    ll N, M;
    cin >> N >> M;
    vector<ll> a(N);
    vector<ll> sum(N+1);
    for (int i = 0; i < N; i++) {
        cin >> a[i];
        sum[i+1] = (sum[i] + a[i]) % M;
    }
    // Bi = A0 + ... + Ai とする
    // (A_l + ... + A_r) = Br - B{l-1} mod M == 0;
    // <=> Br = B{l-1} (mod M)
    // 数えるべきは、Bi = Bj mod M となる 0 ≤ i < j ≤ N の組の個数です
    map<ll, ll> mp;
    for (int i = 0; i < N+1; i++) mp[sum[i]]++;
    ll ans = 0;
    for (auto m : mp) ans += m.second * (m.second - 1) / 2;
    cout << ans << '\n';
}


Measured memory_bytes: 5760
program Project1;

{$APPTYPE CONSOLE}

uses
  SysUtils,Classes;
var
  a,h,w,i,j,count,x,y,sw,m,n,b,c,soeji,sum,max,k,min:Integer;
  //l:array[0..6] of Integer = (1,2,4,8,16,32,64);
  s,s123,s1,s2,s3:string;
  tf:Boolean;
  nyu:TStringList;
begin
  try
    { TODO -oUser -cConsole Main : ここにコードを記述してください }
    Read(n);
    Readln(m);

    Writeln((n-1)*(m-1));
    Readln;
  except
    on E: Exception do
      Writeln(E.ClassName, ': ', E.Message);
  end;
end.

Measured memory_bytes: 256
import java.util.Scanner;
public class Main{
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int N=sc.nextInt();
		int A=sc.nextInt();
		int B=sc.nextInt();
		int C=sc.nextInt();
		int D=sc.nextInt();
		String S=sc.next();
		Boolean can=true;Boolean nuku=false;
		char a1='#',a2='#',a3='.';
		int max=Math.max(C, D);
		int min=Math.min(C, D);

		for(int i=A-1;i<max;i++) {
			a1=a2;
			a2=a3;
			a3=S.charAt(i);
			if(a2=='#'&&a3=='#') {
				System.out.println("No");
				return;
			}
			if(a1=='.'&&a2=='.'&&a3=='.'&&i>=B&&i<=min) {
				nuku=true;
			}
		}
		if(C<D) {
			System.out.println("Yes");
			return;
		}
		if(nuku) {
			System.out.println("Yes");
		}else {
			System.out.print("No");
		}
	}

}


Measured memory_bytes: 28472
#include <iostream>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>
using namespace std;

typedef pair<int,int> P;
const int INF = 1e+8;
int dx[6] = {0,1,-1,1,-1,0};
int dy[6] = {1,1,0,0,-1,-1};


// s[y][x] := ツ鳴「ツ探ツ催オツづ個づ?つォINF, ツ探ツ催オツ催渉づ敖づ個づ?つォツタツーツδ督青板つェツ禿シツづゥ
int s[200][200];
// b[P(x,y)] := ツ津環づェツづ按つ「ツづ?つォtrue
int b[200][200];

int bfs(int sx , int sy , int t ){
	s[sy][sx] = 0;
	queue<P> q;
	q.push( P(sx,sy) );
	
	while( !q.empty() ){
		int x = q.front().first;
		int y = q.front().second;
		int cnt = s[y][x];
		q.pop();
		
		for(int i=0 ; i < 6 ; i++ ){
			int mx = x + dx[i];
			int my = y + dy[i];
			// if( mx < 0 || my < 0 || mx > 60 || my > 60 ) continue;
			if( b[my][mx] ) continue;
			 
			if( cnt + 1 <= t && s[my][mx] == INF ){
				s[my][mx] = cnt + 1;
				q.push( P(mx,my) );
			}
		}
	}

	int result = 0;
	for(int y=0 ; y < 200 ; y++ ){
		for(int x = 0 ; x < 200 ; x++ ){
			if( s[y][x] != INF ){
				result++;
			} 
		}
	}
	if( result == 0 ) result = 1;
	return result;
}

int main(){
	int t, n;
	while( cin >> t >> n , t || n ){
		
		for(int y = 0 ; y < 200 ; y++ ){
			for(int x = 0 ; x < 200 ; x++ ){
				s[y][x] = INF;
				b[y][x] = 0;
			}
		}
		for(int i=0 ; i < n ; i++ ){
			int x, y;
			cin >> x >> y;
			x += 100;
			y += 100;
			b[y][x] = 1;
		}
		int sx, sy;
		cin >> sx >> sy;
		int ans = bfs( sx+100 , sy+100 , t );
		cout << ans << endl;
	}
}

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

int main()
{
	int ar[3];
	for(auto &ref : ar)
	{
		cin >> ref;
	}
	int num5=0,num7=0;
	for(auto &ref : ar)
	{
		switch(ref)
		{
			case 5:
				num5++;
				break;
			case 7:
				num7++;
				break;
			default:
				break;
		}
	}
	num5==2&&num7==1?cout << "YES" : cout << "NO";

}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
int main()
{
    int a = -1;
    int b = -1;
    int c = -1;
    int i;
    int head=1;
    char sa[101];
    char sb[101];
    char sc[101];

    for(i=0;i<101;i++)sa[i] = '\0';
    for(i=0;i<101;i++)sb[i] = '\0';
    for(i=0;i<101;i++)sc[i] = '\0';

    // 整数の入力
    if(scanf("%s", sa)==-1) exit(1);
    if(scanf("%s", sb)==-1) exit(1);
    if(scanf("%s", sc)==-1) exit(1);

for(;;){
    switch (head){
        case 1:
            a++;
            if(sa[a]=='\0') { 
                printf("A\n");
                return 0;
            }
            if(sa[a]=='a') head = 1;
            if(sa[a]=='b') head = 2;
            if(sa[a]=='c') head = 3;

        break;
        case 2:
            b++;
            if(sb[b]=='\0'){
                printf("B\n");
                return 0;
            }
            if(sb[b]=='a') head = 1;
            if(sb[b]=='b') head = 2;
            if(sb[b]=='c') head = 3;

        break;
        case 3:
            c++;
            if(sc[c]=='\0'){
                printf("C\n");
                return 0;
            }
            if(sc[c]=='a') head = 1;
            if(sc[c]=='b') head = 2;
            if(sc[c]=='c') head = 3;

        break;




    }


}


    // 出力

    return 0;
}

Measured memory_bytes: 128
import java.io.FileNotFoundException;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws FileNotFoundException {

		//    	File file = new File("src/in.txt");
		//    	Scanner sc = new Scanner(file);

		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();
		int cnt = 0;
		for(int i=0;i<N;i++) {
			int p = sc.nextInt();
			if(i+1!=p) {
				cnt++;
			}
		}
		if(cnt<=2) {
			System.out.println("YES");
		} else {
			System.out.println("NO");
		}
	}
}


Measured memory_bytes: 21844
#include<stdio.h>
#include<math.h>
int main(){
int n,i,min,max;
long sum;
scanf("%d",&n);
int data[n];
for(i=0;i<n;i++){
scanf("%d",&data[i]);
}
min=data[0];
max=data[0];
sum=data[0];
for(i=1;i<n;i++){
min=fmin(data[i],min);
max=fmax(data[i],max);
sum=data[i]+sum;
}
printf("%d %d %ld\n",min,max,sum);
return 0;
}

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

int main()
{
    int n ;
    cin >> n ;
    map <int,int> M ;
    vector <int> V ;
    for(int i = 0 ; i < n ; i++)
    {
        int x ;
        cin >> x ;
        V.push_back(x) ;
    }

    for(auto &i : V)
    {
        M[i-1]++;
        M[i+1]++;
        M[i]++;
    }
    int ans = 0 ;
    for(auto &i : M)
    {
        ans = max(ans,i.second) ;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 5112
#include<iostream>
#include<string>
using namespace std;
int main()
{
  int n,i,res=0;
  bool chk=false;
  string s,t,u;
  cin >> s;
  n=s.size();
  for(i=0;i<n-1;){
    t=s.substr(i,1);
    if(!chk||t!=u){
      res++;
      chk=true;
      u=t;
      i++;
    }else{
      res++;
      chk=false;
      i+=2;
    }
  }
  if(i==n-1){
    if(!chk){res++;}
    else{
      t=s.substr(n-1,1);
      if(t!=u) res++;
    }
  }
  cout << res << endl;
  return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define Phuong ios_base::sync_with_stdio(0); cin.tie(0);
#define mpp make_pair
#define pb push_back

typedef long long ll;
typedef long double ld;
using namespace std;
typedef pair<int,int> pii;

/// problem's variable




///--------------------


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


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
using uint = unsigned int;

int main() {
	uint N, K;
	cin >> N >> K;
	
	if(N == 1) {
		cout << 0;
		return 0;
	}
	
	string S;
	cin >> S;
	
	string ht = (S.at(0) == 'L') ? "LR" : "RL";
	char tt = S.at(0);
	int pos_s = 0;
	int pos_e = 0;
	
	for (uint i=0; i<K; i++) {
		pos_s = S.find(ht, pos_e);
		
		if (pos_s == -1 ) {
			break;
		}
		
		pos_e = S.find(tt, pos_s + 1);
		
		if (pos_e == -1) {
			pos_e = N;
		}
		
		string ns = string(pos_e - pos_s - 1, tt);
		
		S.replace(pos_s + 1, ns.length(), ns);
	}
	
	uint p = 0;
	
	for (uint i=0; i<N-1; i++) {
		if (S.substr(i, 2) == "RR") {
			p++;
		}
	}
	
	for (uint i=1; i<N; i++) {
		if (S.substr(i-1, 2) == "LL") {
			p++;
		}
	}
	
	cout << p;
	
	return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n; cin >> n;
	vector<int> a(n);
	for(int i = 0; i < n; i++) cin >> a[i];
	long long cost = 1ll<<60;
	for(int i = -200; i <= 200; i++){
		long long now = 0;
		for(int j = 0; j < n; j++){
			now += (a[j] - i) * (a[j] - i);
		}
		cost = min(cost, now);
	}
	cout << cost << endl;
	return 0;
}


Measured memory_bytes: 256
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author alireza_kaviani
 */

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;

template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
typedef pair<ld, ld> pld;
typedef pair<string, string> pss;

#define all(x)                      (x).begin(),(x).end()
#define Sort(x)                     sort(all((x)))
#define X                           first
#define Y                           second
#define Mp                          make_pair
#define sep                         ' '
#define endl                        '\n'
#define debug(x)                    cerr << #x << " = " << x << endl
#define SZ(x)                       ll(x.size())
#define fast_io                     ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define file_io                     freopen("in.txt" , "r+" , stdin) ; freopen("out.txt" , "w+" , stdout);
#define set_random                  mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

inline ll input() {
    ll n;
    cin >> n;
    return n;
}

ll poww(ll a, ll b, ll md) {
    return (!b ? 1 : (b & 1 ? a * poww(a * a % md, b / 2, md) % md : poww(a * a % md, b / 2, md) % md));
}

set_random;

const ll MAXN = 1e6 + 10;
const ll INF = 8e18;
const ll MOD = 1e9 + 7;
const ll MOD1 = 998244353;
const ll MOD2 = 1e9 + 7;
const ll MOD3 = 1e9 + 9;

ll A , B , T;

int main() {
    fast_io;

    cin >> A >> B >> T;
    cout << T / A * B << endl;

    return 0;
}
/*
todo :
    1- set constants
    2- check TimeLimit and MemoryLimit
    3- check special test cases
    4- don't forget BS can help you that is good idea(use for loop for floats)
    5- don't forget printf and scanf can help you in your code speed
*/


Measured memory_bytes: 256
while True:
  n, x = list(map(int, input().split()))
  if n==x==0:
    break
  ans = 0
  for i in range(1, n+1):
    for j in range(i+1, n+1):
      for k in range(j+1, n+1):
        if i+j+k==x:
          ans += 1
  print(ans)


Measured memory_bytes: 5596
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <complex>
#include <string>
#include <algorithm>
#include <numeric>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <bitset>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#ifndef LOCAL
#define debug(x) ;
#else
#define debug(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl;

template <typename T1, typename T2>
ostream &operator<<(ostream &out, const pair<T1, T2> &p) {
  out << "{" << p.first << ", " << p.second << "}";
  return out;
}

template <typename T>
ostream &operator<<(ostream &out, const vector<T> &v) {
  out << '{';
  for (const T &item : v) out << item << ", ";
  out << "\b\b}";
  return out;
}
#endif

#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 200010


int main(){
  int N, M;

  cin >> N >> M;

  queue<int> que[10];

  for (int i=0; i<M; i++) {
    int q, v;
    cin >> q >> v;

    if (q == 0) {
      cout << que[v-1].front() << endl;
      que[v-1].pop();
    } else {
      int minsize = INF;
      for (int j=0; j<N; j++)
        minsize = min(minsize, (int)que[j].size());

      for (int j=0; j<N; j++)
        if (minsize == que[j].size()) {
          que[j].push(v);
          break;
        }
    }
  }

  return 0;
}



Measured memory_bytes: 3184