akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
const int maxn=1e6+5;
typedef long long ll;
struct edge
{
    ll to,a,b;
};
struct Data
{
    ll v,s,t;
    bool operator<(const Data&a)const
    {
        return t>a.t;
    }
};
const ll MAXN=50,MAXS=50*50,INF=1e18;
ll dp[MAXN+1][MAXS+1];
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll n,m,s;
    cin>>n>>m>>s;
    vector<edge> E[MAXN+1];
    for(int i=1;i<=m;i++)
    {
        int u,v,a,b;
        cin>>u>>v>>a>>b;
        E[u].push_back((edge){v,a,b});
        E[v].push_back((edge){u,a,b});
    }
    vector<int> c(n+1),d(n+1);
    for(int i=1;i<=n;i++)
    {
        cin>>c[i]>>d[i];
    }
    s=min(s,MAXS);
    for(int i=1;i<=n;i++)
    for(int j=0;j<=MAXS;j++)
        dp[i][j]=INF;
    dp[1][s]=0;
    priority_queue<Data> Q;
    Q.push((Data){1,s,0});
    while(!Q.empty())
    {
        Data dt=Q.top();
        Q.pop();
        if(dt.t>dp[dt.v][dt.s])
            continue;
        ll curt=dp[dt.v][dt.s];
        ll ns=min(dt.s+c[dt.v],MAXS);
        ll nt=curt+d[dt.v];
        if(dp[dt.v][ns]>nt)
        {
            dp[dt.v][ns]=nt;
            Q.push((Data){dt.v,ns,nt});
        }
        for(auto e:E[dt.v])
        {
            ns=dt.s-e.a;
            nt=curt+e.b;
            if(ns>=0 and dp[e.to][ns]>nt){
                dp[e.to][ns]=nt;
                Q.push((Data){e.to,ns,nt});
            }
        }
    }
    for(int i=2;i<=n;i++)
    {
        ll ans=INF;
        for(int j=0;j<=MAXS;j++)
        {
            ans=min(ans,dp[i][j]);
        }
        cout<<ans<<endl;
    }
}

Measured memory_bytes: 7192
import java.util.*;

public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        if(a<1200){
            System.out.println("ABC");
        }else if(a<2800){
            System.out.println("ARC");
        }else{
            System.out.println("AGC");
        }
        
    }
}

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

int solve(vector< vector<int> > &G, int n, int m){
  if(!m) return 0;
  int ret = 0;
  for(int i = 0; i < n; ++i){
    vector<int> V;
    int m_ = sqrt(2*m);
    for(int j = 0; j < n; ++j){
      if(G[i][j] > 0) V.push_back(j);
    }
    if(V.size() < m_){
      int n_ = V.size();
      for(int j = 0; j < (1<<n_); ++j){
        vector<int> V_(1,i);
        for(int k = 0; k < n_; ++k){
          if((j>>k) & 1){
            V_.push_back(V[k]);
          }
        }
        if(V_.size() < 2) continue;
        int t = 0;
        for(int k = 0; k < V_.size(); ++k){
          int s = 1e9;
          for(int l = 0; l < V_.size(); ++l){
            if(k != l) s = min(s, G[V_[k]][V_[l]]);
          }
          t += s;
        }
        ret = max(ret, t);
      }
      for(int j = 0; j < n; ++j){
        if(G[i][j] > 0){
          G[j][i] = 0;
          G[i][j] = 0;
          --m;
        }
      }
    }
  }
  /*
  for(int i = 0; i < n; ++i){
    for(int j = 0; j < n; ++j) cout << G[i][j] << " ";cout << endl;
  }
  */
  vector<int> V;
  for(int i = 0; i < n; ++i){
    for(int j = 0; j < n; ++j){
      if(G[i][j] > 0){
        V.push_back(i);
        break;
      }
    }
  }
  if(V.size() >= 2){
    int n_ = V.size();
    for(int j = 0; j < (1<<n_); ++j){
      vector<int> V_;
      for(int k = 0; k < n_; ++k){
        if((j>>k) & 1){
          V_.push_back(V[k]);
        }
      }
      if(V_.size() < 2) continue;
      int t = 0;
      for(int k = 0; k < V_.size(); ++k){
        int s = 1e9;
        for(int l = 0; l < V_.size(); ++l){
          if(k != l) s = min(s, G[V_[k]][V_[l]]);
        }
        t += s;
      }
      ret = max(ret, t);
    }
  }
  return ret;
}

int main(){
  int n, m;
  cin >> n >> m;
  vector< vector<int> > G(n, vector<int>(n,0));
  int a, b, c;
  for(int i = 0; i < m; ++i){
    cin >> a >> b >> c;
    --a;
    --b;
    G[a][b] = c;
    G[b][a] = c;
  }
  cout << solve(G, n, m) << endl;
  return 0;
}



Measured memory_bytes: 3200
#include <cstdio>
#include <algorithm>
#define N_MAX 150
#define S_MAX 150
#define lld "%lld"
typedef long long lnt;
const lnt LNF = 0x3F3F3F3F3F3F3FLL;
int n, o, i, k, a, b, r[N_MAX], s[N_MAX + 1];
lnt f[2][S_MAX + 2];
int main()
{
	scanf("%d %d %d", &n, &a, &b);
	for (i = 0; i < n; ++i)
		scanf("%d %d", &r[i], &s[i]);
	for (i = n - 1; i >= 0; --i)
		s[i] += s[i + 1];
	f[o][0] = -LNF;
	for (i = n - 1; i >= 0; --i)
	{
		for (k = s[i + 1] + 1; k <= s[i] + 1; ++k)
			f[o][k] = LNF;
		o ^= 1;
		for (k = 0; k <= s[i]; ++k)
			f[o][k] = std::min(1 - f[o ^ 1][s[i] - k + 1] - r[i], std::max(1LL, f[o ^ 1][k] + r[i] + 1));
	}
	for (k = s[0]; f[o][k] > a - b; --k);
	printf("%d %d\n", k, s[0] - k);
	return 0;
}

Measured memory_bytes: 2756
#include<stdio.h>
int main(){
	int k,o=0,m=0;
	while(1){
	m=0;
	o=0;
	scanf("%d",&k);
	if(k==0){
		break;
	}
	k=1000-k;
	if(k>500){
		k=k-500;
		m++;
	}
	o=o+k/100;
	k=k%100;
	o=o+k/50;
	k=k%50;
	o=o+k/10;
	k=k%10;
	o=o+k/5;
	k=k%5;
	o=o+k/1;
	m=m+o;
	printf("%d\n",m);
	}	
	return 0;
}

Measured memory_bytes: 600
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pi 3.141592653589793238
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define MOD 1000000007
ll ceil1(ll a,ll b)
{
	if(a%b==0)
		return a/b;
	else
		return a/b+1;
}

void solve()
{
	ll n,a,b;
	cin>>n;
	a=1,b=1;
	for(ll i=0;i<n;i++)
	{
		ll x,y;
		cin>>x>>y;
		ll temp=max(ceil1(a,x),ceil1(b,y));
		a=temp*x;
		b=temp*y;
	}
	cout<<a+b;
	
	return;
}

int main()
{
	fast;
	ll q=1;
	// cin>>q;
	while(q--)
		solve();
	return 0;
}



Measured memory_bytes: 3624
#include <iostream>

using namespace std;

int main(int argc, char* argv[]){
  int a,b;
  const int ini = -1;
  while (cin >> a >> b && a != 0 && b != 0){  
    int field[18][18] = {0};
    
    for (int i=1; i<=b; ++i){
      for (int j=1; j<=a; ++j){
	if (i == 1 && j == 1){
	  field[i][j] = 1;
	}
	else{
	  field[i][j] = ini;
	}
      }
    }
    int n;
    cin >> n;
    for (int i=0; i<n; ++i){
      int x,y;
      cin >> x >> y;
      field[y][x] = 0;
    }

    for (int i=1; i<=b; ++i){
      for (int j=1; j<=a; ++j){
	if ( (field[i][j] != 0) && !(i == 1 && j == 1)){
	  field[i][j] = field[i-1][j] + field[i][j-1];
	}
      }
    }
    /*
    for (int i=b; 1<=i; --i){
      for (int j=1; j<=a; ++j){
	cout << field[i][j] << " ";
      }
      cout << endl;
    }
   */
    cout << field[b][a] << endl;
    
  }
  return 0;
}

Measured memory_bytes: 1160
nCase = 0
while True:
    W = int(input())
    if W == 0: break
    nCase += 1
    N = int(input())
    # [(value, weight), ... ]
    items = [tuple(map(int, input().split(','))) for _ in range(N)]
    bestValueFor = [0] * (W + 1) # item -> best value, idx -> capacity 
    for item in items:
        for capa in reversed(range(W-item[1]+1)):
            # if taken wins not taken
            if bestValueFor[capa] + item[0] > bestValueFor[capa + item[1]]:
                bestValueFor[capa + item[1]] = bestValueFor[capa] + item[0]
    bestValue = max(bestValueFor)
    bestWeight = bestValueFor.index(bestValue)
    print('Case ',str(nCase),':',sep='')
    print(bestValue)
    print(bestWeight)



Measured memory_bytes: 5624
List = list(map(int,input().split()))
L = List[0]
R = List[1]
count_list = []
if R - L >= 2019:
    print(0)
else:
    for i in range(L,R):
        for j in range(i+1,R+1):
            count_list.append((i * j) % 2019)

    sort_list = sorted(count_list)
    print(sort_list[0])

Measured memory_bytes: 98544
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <cstring>
#include <climits>
#include <ctime>

using namespace std;

const int len = 10000010;
int n,a[len],s[len],v[len];

int main() {
	//freopen("test.in","r",stdin);
	//freopen("test.out","w",stdout);
	bool flag = false;
	int sum = 0;
	int k = 1;
	memset(s,0,sizeof(s));
	memset(v,0,sizeof(v));
	cin >> n;
	for (int i=1;i<=n;i++) {
	    cin >> a[i];
	}
	for (int i=1;i<=n;i++) {
	    if (s[a[i]] == 0) sum++,v[k] = a[i],k++;
	    s[a[i]]++;
	}
	if (sum > 2) ;
	 else {
	 	if (sum == 1) {
	 		int f = n/2;
	 		if ((v[1]>=1) && (v[1]<=f) || (v[1]+1 == n)) {
	 			flag = true;
	 		}
	 	}
	 	else {
	 		if ((max(v[1],v[2])-min(v[1],v[2])) == 1) {
	 		int mx = -INT_MAX;
	 		int mn = min(v[1],v[2]);
	 		int p = 0;
	 		//cout << p << endl;
	 		for (int i=1;i<=n;i++) {
	 			mx = max(mx,a[i]);
	 			p = (a[i] == mn) ? ++p : p;
	 		}
	 		//cout << mx << endl;
	 		//cout << p << endl;
	 		if ((mx>p) && (n-p)>=(2*(mx-p))) flag = true;
	 		 //else if (mx<=p) flag = true;
	 		}
	 	}
	 }
	 //cout << sum << endl;
	 if (flag) cout << "Yes" << endl;
	  else cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 80128
#### import ####
import sys
import math
from collections import defaultdict

#### 設定 ####
sys.setrecursionlimit(10**7)
def input():
  return sys.stdin.readline()[:-1]

#### 定数 ####
mod = 10**9 + 7

#### 読み込み ####
def I(): return int(input())
def II(): return map(int, input().split())
def III(): return list(map(int, input().split()))
def Line(N):
  read_all = [tuple(map(int, input().split())) for _ in range(N)]
  return map(list,zip(*read_all))

#################

def BF(E,s,n):
  inf=float("inf")
  d=[inf for _ in range(n)]
  d[s]=0
  for i in range(n+1):
    for e in E:
      if e[0]!=inf and d[e[1]-1]>d[e[0]-1]+e[2]:
        d[e[1]-1] = d[e[0]-1] + e[2]
    if i==n-1:t=d[-1]
    if i==n and t!=d[-1]:
      return 'loop'
  return d

N,M = II()
E = []
for i in range(M):
  a,b,c = II()
  E.append([a,b,-c])

d = BF(E,0,N)

if d=='loop':
  print('inf')
else:
  print(-d[N-1])

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

using namespace std;

void Main() {
    int N, L;
    cin >> N >> L;
    vector<string> S(N, "");
    for (int i = 0; i < N; ++i) {
        cin >> S[i];
    }

    sort(S.begin(), S.end());
    for (int i = 0; i < N; ++i) {
        cout << S[i];
    }
    cout << endl;
}

int main() {
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 3628
import Data.List
import Data.Ord
import Data.Char
import Data.Ratio
import Data.Maybe

main = do
  n <- readLn :: IO Int
  print $ head [x|x<-[n,n-1..1], isSquare x==True]

isSquare :: Int -> Bool
isSquare n = m * m == n
  where m = intSqrt(n)
intSqrt :: Int -> Int
intSqrt n = floor (sqrt (fromIntegral n))

Measured memory_bytes: 3872
#include<iostream>
#include<string>
#include <cmath>
#include <algorithm>
#define MOD 1e9+7
using namespace std;
typedef long long ll;

int main(){

int a,b,c,d;

cin >> a >> b >> c >> d;

if(a*b > c*d) cout << a*b << endl;
else cout << c*d << endl;

return 0;
}

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

int main(){
  int h,w;
  cin >> h >> w;
  int n;
  cin >> n;
  int a[n];
  rep(i,n)cin >> a[i];
  rep(i,n)a[i+1]+=a[i];
  //rep(i,n)cout << a[i] << endl;
  int col[h][w];
  rep(i,h){
    rep(j,w){
      rep(k,n){
        if((i*w+j+1)<=a[0])col[i][j]=1;
        if((i*w+j+1)>a[k]&&(i*w+j+1)<=a[k+1])col[i][j]=k+2;
      }
    }
  }
  rep(i,h){
    if(i%2==0){
      rep(j,w){
        cout << col[i][j] << ' ';
      }
    }else{
      rep(j,w){
        cout << col[i][w-j-1] << ' ';
      }
    }
    cout << endl;
  }
  return 0;
}


Measured memory_bytes: 384
use std::io::Read;
use std::cmp::max;

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();

    let answer = solve(&buf);

    println!("{}", answer);
}

fn solve(input: &str) -> String {
    let mut iterator = input.split_whitespace();

    let n: usize = iterator.next().unwrap().parse().unwrap();
    let k: usize = iterator.next().unwrap().parse().unwrap();

    let mut p_min = 0;
    let mut p_max = 0;
    let mut w: Vec<usize> = Vec::with_capacity(n);
    for _i in 0..n {
        let wi: usize = iterator.next().unwrap().parse().unwrap();
        w.push(wi);
        p_min = max(p_min, wi);
        p_max += wi;
    }

    let mut l = p_min;
    let mut r = p_max + 1;
    while l != r {
        let mid = (l + r) / 2;
        if can_put(mid, k, &w) {
            r = mid;
        } else {
            l = mid + 1;
        }
    }

    return l.to_string();
}

fn can_put(p: usize, k: usize, w: &Vec<usize>) -> bool {
    let mut t = 1;
    let mut current = 0;
    for &wi in w.iter() {
        if current + wi > p {
            t += 1;
            current = wi;
        } else {
            current += wi;
        }
    }
    t <= k
}



Measured memory_bytes: 5032
#include<bits/stdc++.h>
namespace ZDY{
    #pragma GCC optimize(3)
    #pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math")
    #pragma GCC target("sse,sse2,avx,avx2,popcnt,tune=native")
    #define il __inline__ __attribute__ ((always_inline))
    #define rg register
    #define ll long long
    #define db double
    #define sht short
    #define MB template <class T>
    #define Fur(i,x,y) for(rg int i=x;i<=y;i++)
    #define Fdr(i,x,y) for(rg int i=x;i>=y;i--)
    #define clr(x,y) memset(x,y,sizeof(x))
    #define cpy(x,y) memcpy(x,y,sizeof(x))
    #define fin(s) freopen(s".in","r",stdin)
    #define fout(s) freopen(s".out","w",stdout)
    #define l2(n) (int(log2(n)))
    #define inf 2000000000
    #define fl(i,x) for(rg int i=head[x],to;to=e[i].to,i;i=e[i].nxt)
    #define fcin ios::sync_with_stdio(false)
    MB T ABS(T x){return x>0?x:-x;}
    MB T MAX(T x,T y){return x>=y?x:y;}
    MB T MIN(T x,T y){return x<=y?x:y;}
    MB T GCD(T x,T y){return y?GCD(y,x%y):x;}
    void SWAP(int &x,int &y){x^=y;y^=x;x^=y;}
}using namespace ZDY;using namespace std;
namespace IO{const char* ln="\n";const int str=1<<20;struct IN{char buf[str],*s,*t;bool _;IN():s(buf),t(buf),_(0){}il char gc(){return s==t&&((t=(s=buf)+fread(buf,1,str,stdin))==s)?EOF:(*s++);}IN&operator>>(char&ch){if(_)return *this;char c;while((c=gc())!=EOF&&isspace(c));if(c==EOF)_=1;else ch=c;return *this;}IN& operator>>(char* ch){if(_)return *this;char c;while((c=gc())!=EOF&&isspace(c));if(c==EOF)return _=1,*this;*ch=c;ch++;while((c=gc())!=EOF&&!isspace(c))*ch=c,ch++;if(c==EOF)_=1;return *this;}template<typename T>IN&operator>>(T&x){if(_)return *this;char c=gc();bool ff=0;while(c!=EOF&&(c<'0'||c>'9'))ff^=(c=='-'),c=gc();if(c==EOF){_=1;return *this;}x=0;while(c!=EOF&&'0'<=c&&c<='9')x=(x<<3)+(x<<1)+c-48,c=gc();if(c==EOF)_=1;if(ff)x=-x;return *this;}}in;struct OUT{char buf[str],*s,*t;OUT():s(buf),t(buf+str){}~OUT(){fwrite(buf,1,s-buf,stdout);}void pt(char c){(s==t)?(fwrite(s=buf,1,str,stdout),*s++=c):(*s++=c);}OUT&operator<<(const char*s){while(*s)pt(*s++);return *this;}OUT&operator<<(char*s){while(*s)pt(*s++);return *this;}template<typename T>OUT&operator<<(T x){if(!x)return pt('0'),*this;if(x<0)pt('-'),x=-x;char a[30],t=0;while(x)a[t++]=x%10,x/=10;while(t--)pt(a[t]+'0');return *this;}}out;}using namespace IO;
#define N 1001
int n,m,c,b[N],t=0;
int main(){
    in>>n>>m>>c;
    Fur(i,1,m)in>>b[i];
    Fur(i,1,n){
        int x,s=c;
        Fur(j,1,m)in>>x,s+=x*b[j];
        if(s>0)t++;
    }
    out<<t<<ln;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;
const ll mod=1000000007, INF=(1LL<<45);
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;


int main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    ll n, x, a, b, sum = 0;
    cin >> n;
    for(int i=0;i<n;i++){
        if(i == 0) cin >> a; 
        else if(i == 1) cin >> b;
        else {
        	cin >> x;
        	sum ^= x;
        }
    }
    ll num = a + b - sum;
    if(num < 0LL || (num & 1)){
    	cout << -1 << endl;
    	return 0;
    }
    num /= 2LL;
    vector<ll> c(45, -1LL);
    for(int i=0;i<45;i++) if((sum >> i & 1) == 0){
    	if(num >> i & 1) c[i] = 1;
    	else c[i] = 0;
    }
    ll ans = 0;
    for(int i=0;i<45;i++) if(c[i] == 1LL) ans += 1LL << i;
    for(int i=44;i>=0;i--) if(c[i] == -1LL){
        if(ans + (1LL << i) <= a) ans += 1LL << i;
    }
    num = b + a - ans;

    if(ans == 0LL || ans > a || (num ^ ans) != sum) cout << -1 << endl;
    else cout << a - ans << endl;
    return 0;
}


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

#define rep(i, n) for(int i = 0; i < n; i++)

typedef long long ll;
using namespace std;
int mod = 1000000007;

int main(void){
    ll N; cin >> N;
    if(N % 2 == 1 || N <= 9) cout << 0 << endl;
    else{
        int mod10 = N % 10;
        N -= mod10;
        vector<ll> five_fac;
        five_fac.push_back(5);
        while(true){
            if(five_fac.back()*5 > N) break;
            five_fac.push_back(five_fac.back()*5);
        }
        //rep(i, five_fac.size()) cout << five_fac[i] << " "; cout << endl;

        ll ans = 0;
        rep(i, five_fac.size()){
            ll add = (N / five_fac[i]) / 2;
            ans += add;
        }
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
	int H, W;

	while (1){
		cin >> H >> W;

		if (H >= 2){
			for (int i = 0; i < W; i++){
				cout << "#";
			}
			cout << endl;
		}
		

		for (int i = 0; i < H - 2; i++){
			cout << "#";

			for (int i = 0; i < W - 2; i++){
				cout << ".";
			}

			cout << "#";
			cout << endl;
		}

		for (int i = 0; i < W; i++){
			cout << "#";
		}
		
		

		if (H == 0 && W == 0){
			break;
		}
		cout << endl;
		cout << endl;
	}

	return 0;
}

Measured memory_bytes: 3088
////////////////////////// Author
////////////////////////// Nasim Hossain Rabbi
////////////////////////// JU-CSE28
////////////////////////// CF - imnasim3.1415
////////////////////////// UVA - imnasim3.1415
////////////////////////// Mail - imnasim3.1415@gmail.com
#include<bits/stdc++.h>
using namespace std;
#define sz size()
#define mk make_pair
#define clr clear()
#define B begin()
#define E end()
#define EM empty()
#define mem(a,b) memset(a,b,sizeof(a))
#define rep(i,n) for(i=0;i<n;i++)
#define Rep(i,n) for(i=1;i<=n;i++)
#define all(cont) cont.begin(),cont.end()
#define pb push_back
string en="\n";
string t="hello";
#define sqr(a) ((a) * (a))
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL)
#define pi 3.1415926535897932384626433832795
#define vi vector<int>
#define vl vector<long long>
#define vs vector<string>
#define vp(vi,x) cin>>x; vi.pb(x);
#define LB(a,x) (lower_bound(all(a),x)-a.B)
#define UB(a,x) (upper_bound(all(a),x)-a.B)
typedef long long LL;
typedef unsigned long long ULL;
bool isVowel(char ch){ ch=toupper(ch); if(ch=='A'||ch=='U'||ch=='I'||ch=='O'||ch=='E') return true; return false;}
int toInt(string s){int sm;stringstream ss(s);ss>>sm;return sm;}
template<typename T>inline T gcd(T a,T b){if(a<0)return gcd(-a,b);if(b<0)return gcd(a,-b);return (b==0)?a:gcd(b,a%b);}
template<typename T>inline T lcm(T a,T b) {if(a<0)return lcm(-a,b);if(b<0)return lcm(a,-b);return a*(b/gcd(a,b));}
int main()
{
//    fast;
    LL i,j,k,n,m,l,s=0,x,y,tc=1,c=0;
    while(cin>>n)
    {
        vi a;
        rep(i,n)
        {
            vp(a,x);
        }
        s=c=0;
        for(i=0;i<n-1;i++)
        {
            if(a[i+1]>a[i])
            {
                if(c>s) s=c;
                c=0;
            }
            else c++;
        }
        if(c>s) s=c;
        cout<<s<<en;
    }
}


Measured memory_bytes: 892
#include <iostream>
#include <random>
#include <chrono>
#include <algorithm>
#define rep(i, x) for(ll i = 0; i < x; i++)
#define CONCAT_(x,y) x##y
#define CONCAT(x,y) CONCAT_(x,y)
#define _v1 CONCAT(qyw1, __LINE__) // unique name in same line (otherwise use __COUNTER__)
#define _v2 CONCAT(qyw2, __LINE__)
#define forbits(i, m) for (int _v1 = m, i = __builtin_ctz(_v1); _v1 != 0; _v1 ^= _v1 & -_v1, i = __builtin_ctz(_v1))
#define forsubm(s, m) for (int s = m; s >= 0; s = !s ? -1 : m & (s - 1))
int __nextXZW(int v){int t=v|(v-1);int w=(t+1)|(((~t&-~t)-1)>>(__builtin_ctz(v)+1));return w;}
#define ksets(i, n, k) for (int i = (1u << k) - 1, max = i << (n - k); i <= max; i = __nextXZW(i))
using namespace std;
typedef long long ll;
const ll MOD = (ll)1e9+7;
const ll N = 5e5+5, inf = 1e9+5000;
ll add(ll x, ll y) { x += y; if (x >= MOD) return x - MOD; return x; }
ll sub(ll x, ll y) { x -= y; if (x < 0) return x + MOD; return x; }
ll mult(ll x, ll y) { return (x * y) % MOD; }
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

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

  string s; cin >> s;
  if (s.back() == 's') {
    cout << s + "es" << endl;
  } else {
    cout << s + "s" << endl;
  }

  return 0;
}

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

int main(){
	int n;
  	cin>>n;
    string s;
  	cin>>s;
  	int mymax=0;
  	int ans=0;
  	
  	for (int i=0;i<n;i++){
  		if(s.at(i)=='I'){
        	ans++;	
        }
      	if(s.at(i)=='D'){
        	ans--;
        }
      	mymax=max(mymax,ans);
    }
  	cout<<mymax<<endl;
  	
}    

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

int main() {
  string s;
  cin >> s;
  
  int a_position = s.size();
  int z_position = 0;
  for (int i = 0; i < s.size(); i++) {
    if (s.at(i)=='A') {
      a_position = min(a_position, i);
    }
    if (s.at(i)=='Z') {
      z_position = max(z_position, i);
    }
  }
  
  cout << z_position-a_position+1 << endl;
}

Measured memory_bytes: 640
N, M= int(input()), int(input())
A= list(map(int, input().split()))
score= dict(zip([i+1 for i in range(N)], [0 for _ in range(N)]))
for i in range(M):
    B= list(map(int, input().split()))
    t= 0
    for j in range(N):
        if A[i]==B[j]: score[j+1]+= 1
        else: t+= 1
    score[A[i]]+= t
print("\n".join(map(str, score.values())))

Measured memory_bytes: 7768
N = int(input())
D = [int(c) for c in input().split()]
C = [0]*(N)
Q = int(input())
for _ in range(0,Q):
    t,x,d = map(int,input().split())
    if t == 1:
        C[x-1] = C[x-1] + d
        if C[x-1] > D[x-1]:
            print(x)
            exit()

    if t == 2:
        C[x-1] = C[x-1] - d
        if C[x-1] < 0:
            print(x)
            exit()

print(0)


Measured memory_bytes: 5636
#include "bits/stdc++.h"
#define _USE_MATH_DEFINES
#include <math.h>
 
using namespace std;
 
using LL = long long;
using VLL = std::vector<LL>;
using VVLL = std::vector<VLL>;
using VVVLL = std::vector<VVLL>;
using LD = long double;
using VLD = std::vector<LD>;
using VVLD = std::vector<VLD>;
using VVVLD = std::vector<VVLD>;
 
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; }

#define REP(i,n) for(LL (i)=0;(i)<(n);(i)++)
#define ALL(v) v.begin(), v.end()
#define PRINTLN(v) {LL i=0; for(auto (a): v ){   cerr <<i << " : "<<  a << endl; i++;}}
#define PRINTSP(v) for(auto (a): v ) {cerr << a << " ";} cerr << endl
#define cmax(a,b) {if(a<b){a=b;}}
#define cmin(a,b) {if(a>b){a=b;}}
//#define cmax(a,b) a = (a>b ? a:b)
//#define cmin(a,b) a = (a<b ? a:b) 


void func() {
  LL N;
  cin >> N;
  string S;
  cin >> S;
  for(auto c : S){
    c += (char)N;
    if( c>'Z'){
      c = 'A' + (c-'Z' -1);
    }
    cout <<c;
  }

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

Measured memory_bytes: 256
#include <algorithm>  
#include <iostream>  
#include <sstream>  
#include <string>  
#include <vector>  
#include <queue>  
#include <set>  
#include <map>  
#include <cstdio>  
#include <cstdlib>  
#include <cctype>  
#include <cmath>  
#include <cstring>
#include <list>  
#include <cassert>
#include <climits>
#include <bitset>
#include <chrono>
#include <random>
using namespace std;

#define PB push_back  
#define MP make_pair  
#define SZ(v) ((int)(v).size())  
#define FOR(i,a,b) for(int i=(a);i<(b);++i)  
#define REP(i,n) FOR(i,0,n)  
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)  
#define REPE(i,n) FORE(i,0,n)  
#define FORSZ(i,a,v) FOR(i,a,SZ(v))  
#define REPSZ(i,v) REP(i,SZ(v))  
std::mt19937 rnd((int)std::chrono::steady_clock::now().time_since_epoch().count());
typedef long long ll;
ll gcd(ll a, ll b) { return b == 0 ? a : gcd(b, a % b); }

const int MAXH = 18;
const int MOD = 1000000007;
void inc(int& a, int b) { if ((a += b) >= MOD) a -= MOD; }

int h;
int p[1 << (MAXH - 1)];

int lst[1 << MAXH], nlst;
int mark[1 << MAXH];
int sum[1 << MAXH][2][2];

void go(int at, int dep,int prod,int cmark,int atside) {
	prod = (ll)prod * at % MOD;
	if (dep + 1 < h) {
		go(2 * at + 0, dep + 1, prod, cmark, atside);
		go(2 * at + 1, dep + 1, prod, cmark, atside);
	} else {
		//printf("\tat=%d\n", at);
		at -= (1 << (h - 1));
		at = p[at];
		at += (1 << (h - 1));
		while (at != 1) {
			prod = (ll)prod * at % MOD;
			int to = at / 2, toside = at % 2;
			//printf("\t\tat=%d to=%d toside=%d prod=%d\n", at, to, toside, prod);
			if (mark[to] != cmark) mark[to] = cmark, sum[to][0][0] = sum[to][0][1] = sum[to][1][0] = sum[to][1][1] = 0, lst[nlst++] = to;
			inc(sum[to][atside][toside], prod);
			at = to;
		}
	}
}

int rec(int at,int dep) {
	if (dep + 1 >= h) return 0;
	int ret = 0;
	nlst = 0;
	go(2 * at + 0, dep + 1, 1, at, 0);
	go(2 * at + 1, dep + 1, 1, at, 1);
	REP(i, nlst) {
		int to = lst[i];
		REP(toside, 2) {
			int cur = (ll)sum[to][0][toside] * sum[to][1][1-toside] % MOD * at % MOD * to % MOD;
			//printf("at=%d to=%d toside=%d sum=%d/%d\n", at, to, toside, sum[to][0][toside], sum[to][1][1 - toside]);
			inc(ret, cur);
		}
	}
	inc(ret, rec(2 * at + 0, dep + 1));
	inc(ret, rec(2 * at + 1, dep + 1));
	return ret;
}

int solve() {
	REP(i, 1 << h) mark[i] = -1;
	return rec(1, 0);
}


void run() {
	scanf("%d", &h);
	REP(i, 1 << (h - 1)) scanf("%d", &p[i]), --p[i];
	printf("%d\n", solve());
}

void stress() {
	REP(rep, 1) {
		h = MAXH;
		REP(i, 1 << (h - 1)) p[i] = i;
		REP(i, 1 << (h - 1)) { int idx = rnd() % (i + 1); swap(p[i], p[idx]); }
		solve();
	}
}

int main() {
	run();
	//stress();
	return 0;
}


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

int main(){
	int c[] = {1,5,10,50,100,500};
	int ans = 0;
	for(int i = 0 ; i < 6 ; i++){
		int x; cin >> x;
		ans += x * c[i];
	}
	cout << (ans>=1000) << endl;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef long double ld;
 
#define REP(i,a,n) for(int (i)=(a); (i)<(int)(n); (i)++)
#define rep(i,n) REP(i,0,n)
#define vec vector 


int main(){
  int N;
  cin >> N;
  vector<int> X(N), Y(N);
  
  
  rep(i, N){
    cin >> X.at(i);
    Y.at(i) = X.at(i);
  }

  
  sort(Y.begin(), Y.end());
  int start_point = Y.at(0);
  int end_point = Y.at(N-1);
  
  int Sum_of_X = 0;
  int position = start_point;
  
  rep(i, N){
    Sum_of_X += (X.at(i));
  }

  
  while(-2*Sum_of_X + N*(2*position + 1) < 0){
    position++;
  }
  
  ll answer = 0;
  rep(i, N){
    answer += (X.at(i) - position)*(X.at(i) - position);
  }
  
  cout << answer;

}

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

slime = []
cnt = 0
color = 0
for i in range(n):
    if i == 0:
        cnt = 1
        color = a[i]
        continue
    if a[i] == color:
        cnt += 1
    else:
        slime.append(cnt)
        cnt = 1
        color = a[i]
else:
    slime.append(cnt)

ans = 0
for i in slime:
    ans += i // 2
print(ans)


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

int main()
{
	string S, T, U;
	int A, B;
	cin >> S >> T >> A >> B >> U;

	if (S == U) A--;
	if (T == U) B--;

	cout << A << " " << B << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> mp;
#define inf 1e9
#define EPS (1e-8)
#define equals(a,b) (fabs(a-b) < EPS)
struct point{
    double x,y;
    point(){}
    point(double x,double y):x(x),y(y){}
    point operator + (point p ) { return point(x+p.x,y+p.y);}
    point operator - (point p ) { return point(x-p.x,y-p.y);}
    point operator * (double k) { return point(x*k,y*k); }
    point operator / (double k) { return point(x/k,y/k); }
 //   bool operator < (point p) { return x!=p.x ? x<p.x:y<p.y ;}
    bool operator == (point p)  { return equals(x,p.x) && equals(y,p.y) ; }
    double norm() { return x*x + y*y; }
    double abs() { return sqrt(norm() );}
    void input() { cin>>x>>y; }
};
double cross(point a,point b){ return a.x*b.y - a.y * b.x ; }
double dot(point a,point b) { return a.x* b.x + a.y*b.y ; }
typedef vector<point> polygon;
struct line{
    point s,t;
    line(){}
    line(point s,point t):s(s),t(t){}
    void input(){ s.input(),t.input() ;};
};
double abs(point a){
    return a.abs();
}
double norm(point a){
    return a.norm();
}
point project(line l,point p){
    point base = l.t-l.s;
    double r = dot(p-l.s,base)/norm(base);
    return l.s + base*r;
}

double distance(line l,point p){
    return abs( cross(l.t-l.s,p-l.s) / abs(l.t-l.s) ) ;
}
int ccw(point p0,point p1,point p2){
    point a = p1-p0;
    point b = p2-p0;
    if(cross(a,b) > EPS) return 1;
    if(cross(a,b) < -EPS ) return -1;
    if( dot(a,b)< -EPS ) return 2;
    if( a.norm() < b.norm() ) return -2;
    return 0;
}
point crosspoint(line l1,line l2){
    double a = cross(l1.t-l1.s,l2.t-l2.s);
    double b = cross(l1.t-l1.s,l1.t-l2.s);
    if( abs(a) < EPS && abs(b) < EPS )return l2.s;
    return l2.s + (l2.t-l2.s) * (b/a ) ;
}

double area(polygon p){
    double sum = 0;
    for(int i=0;i<p.size();i++){
	sum += cross(p[i],p[(i+1)%p.size()] );
    }
    return sum/2.0;
}

polygon convex_cut(polygon &p,line l){
    polygon q;
    int n = p.size();
    for(int i=0;i<n;i++){
	point a = p[i] , b = p[(i+1)%n];
	if(ccw(l.s,l.t,a) != -1 )q.push_back(a);
	if(ccw(l.s,l.t,a) * ccw(l.s,l.t,b) < 0 )q.push_back( crosspoint(line(a,b),l) );
    }
    return q;
}

//typedef pair<double,point> mmp;
double calcu(polygon &p,line l,double SS){
    double h = 0;
    int n = p.size();
    point pl = p[0];
    for(int i=0;i<n;i++){
//	h = max(h,mmp(distance(l , p[i] ),p[i] ) ) 
	double dis = distance(l,p[i]);
	if(dis > h){
	    h = dis;
	    pl = p[i];
	}
    }
    
    point pu = project(l,pl);
    point vec = l.t-l.s;
    double S = area(p);
    while( (pl-pu ).abs() > EPS){
	point m = (pl+pu)*0.5;
	point mv = m + vec;
	line l1 = line(m,mv);
	polygon res = convex_cut(p,l1);
	double S1 = area(res);
	if( S-S1 > SS){
	    pl = m;
	}else{
	    pu = m;
	}
    }
    return distance(l, (pl+pu)*0.5 );
}


int main(){

    while(1){
	int n,d,v;
	cin>>n>>d>>v;
	if(n==0)break;
	double res = 0;
	polygon p(n);
	for(int i=0;i<n;i++) p[i].input();
	for(int i=0;i<n;i++) res = max(res,calcu(p,line(p[i],p[(i+1)%n]),(double)v/d ) );
	printf("%0.10lf\n",res);
    }
	return 0;
}



Measured memory_bytes: 3208
#include <iostream>
#include <algorithm>
#include <string.h>
#include <stdlib.h>
#include <math.h>

using namespace std;

int main() {
	int H, W, h, w;
	cin >> H >> W >> h >> w;
	cout << (W - w)*(H - h) << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <list>
#include <vector>
#include <complex>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <bitset>
#include <ctime>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cassert>
#include <cstddef>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <sstream>
#include <fstream>
#include <chrono>

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 RREP(i, a) for(int (i) = (a) - 1; (i) >= 0; (i)--)
#define FORR(i, a, b) for(int (i) = (a) - 1; (i) >= (b); (i)--)
#define DEBUG(C) cerr << #C << " = " << C << endl;
using LL = long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VL = vector<LL>;
using VVL = vector<VL>;
using VD = vector<double>;
using VVD = vector<VD>;
using PII = pair<int, int>;
using PDD = pair<double, double>;
using PLL = pair<LL, LL>;
using VPII = vector<PII>;
template<typename T> using VT = vector<T>;
#define ALL(a) begin((a)), end((a))
#define RALL(a) rbegin((a)), rend((a))
#define SORT(a) sort(ALL((a)))
#define RSORT(a) sort(RALL((a)))
#define REVERSE(a) reverse(ALL((a)))
#define MP make_pair
#define FORE(a, b) for (auto &&a : (b))
#define FIND(s, e) ((s).find(e) != (s).end())
#define EB emplace_back
template<typename T> inline bool chmax(T &a, T b){if (a < b){a = b;return true;}return false;}
template<typename T> inline bool chmin(T &a, T b){if (a > b){a = b;return true;}return false;}

const int INF = 1e9;
const int MOD = INF + 7;
const LL LLINF = 1e18;

int main(void) {
    int N;cin >> N;
    cout << (N * 800) - (N / 15) * 200 << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
  
using namespace std;
  
#define MAX 1000001
  
int ru[MAX],cu[MAX];
int rv[MAX],cv[MAX];
int a[MAX],b[MAX],c,d;
int e[MAX],f[MAX],g,h;
  
int main(){
    int N,u,v,m,in;
    cin >> N >> u >> v >> m;
    for(int i = 0 ; i < MAX ; i++){
	ru[i] = cu[i] = rv[i] = cv[i] = -1;
	a[i] = b[i] = N;
	e[i] = f[i] = N;
    }
    c = d = g = h = N;
    for(int i = 0 ; i < N ; i++){
	for(int j = 0 ; j < N ; j++){
	    cin >> in;
	    ru[in] = i;
	    cu[in] = j;
	}
    }
    for(int i = 0 ; i < N ; i++){
	for(int j = 0 ; j < N ; j++){
	    cin >> in;
	    rv[in] = i;
	    cv[in] = j;
	}
    }
   
    bool usagi = false,neko = false;
    int x;
    while(m--){
	cin >> x;
	if(N == 1){
	    if(ru[x] != -1){
		u--;
	    }
	    if(rv[x] != -1){
		v--;
	    }
	    if(u == 0) usagi = true;
	    if(v == 0) neko = true;
	    if(usagi || neko) break;
	    continue;
	}
	if(ru[x] != -1){
	    a[ru[x]]--;
	    b[cu[x]]--;
	    if(ru[x] == cu[x]){
		if( N/2 == ru[x] && (N & 1) ){
		    c--;
		    d--;
		}else{
		    c--;
		}
		if(c == 0){ c = -1; u--; }
		if(d == 0){ d = -1; u--; }
	    } else if(ru[x]+cu[x] == N-1){
		d--;
		if(d == 0){ d = -1; u--; }
	    }
	    if(a[ru[x]] == 0){ ru[x] = -1; u--; }
	    if(b[cu[x]] == 0){ cu[x] = -1; u--; }
	}
  
	if(rv[x] != -1){
	    e[rv[x]]--;
	    f[cv[x]]--;
	    if(rv[x] == cv[x]){
		if(N/2 == rv[x] && (N&1) ){
		    g--;
		    h--;
		}else{
		    g--;
		}
		if(g == 0){ g = -1; v--; }
		if(h == 0){ h = -1; v--; }
	    } else if(rv[x]+cv[x] == N-1){
		h--;
		if(h == 0){ h = -1; v--; }
	    }
	    if(e[rv[x]] == 0){ rv[x] = -1; v--; }
	    if(f[cv[x]] == 0){ cv[x] = -1; v--; }
	}
	if(u <= 0) usagi = true; 
	if(v <= 0) neko = true; 
	if(usagi || neko){
	    break;
	}
    }
    while( cin >> x ){}
    if((usagi && neko) || (!usagi && !neko)){
	cout << "DRAW" << endl;
    }else if(usagi){
	cout << "USAGI" << endl;
    }else{
	cout << "NEKO" << endl;
    }
    return 0;
}

Measured memory_bytes: 34340
#include <cstdio>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>

using namespace std;

typedef pair<int, int> P;

int main(){
	
	int R, C, N;
	
	cin >> R >> C >> N;
	
	vector<P> v1, v2, v3, v4;
	
	int check[200000];
	
	for(int i = 0; i < 200000; i++){
		check[i] = 0;
	}
	
	for(int i = 0; i < N; i++){
		int p1, p2, p3, p4;
		cin >> p1 >> p2 >> p3 >> p4;
		P p;
		p.second = i;
		if(p1 == 0){
			p.first = C - p2;
			v4.push_back(p);
		}else if(p2 == 0){
			p.first = p1;
			v1.push_back(p);
		}else if(p1 == R){
			p.first = p2;
			v2.push_back(p);
		}else if(p2 == C){
			p.first = R - p1;
			v3.push_back(p);
		}
		if(p3 == 0){
			p.first = C - p4;
			v4.push_back(p);
		}else if(p4 == 0){
			p.first = p3;
			v1.push_back(p);
		}else if(p3 == R){
			p.first = p4;
			v2.push_back(p);
		}else if(p4 == C){
			p.first = R - p3;
			v3.push_back(p);
		}
	}
	
	sort(v1.begin(), v1.end());
	sort(v2.begin(), v2.end());
	sort(v3.begin(), v3.end());
	sort(v4.begin(), v4.end());
	
	int pre = -1;
	
	for(int i = 0; i < v1.size(); i++){
		check[v1[i].second]++;
	}
	for(int i = 0; i < v2.size(); i++){
		check[v2[i].second]++;
	}
	for(int i = 0; i < v3.size(); i++){
		check[v3[i].second]++;
	}
	for(int i = 0; i < v4.size(); i++){
		check[v4[i].second]++;
	}
	
	vector<int> v;
	
	v.push_back(1000000);
	
	for(int i = 0; i < v1.size(); i++){
		if(check[v1[i].second] != 2){
			continue;
		}
		if(v[v.size() - 1] == v1[i].second){
			v.pop_back();
		}else{
			v.push_back(v1[i].second);
		}
	}
	for(int i = 0; i < v2.size(); i++){
		if(check[v2[i].second] != 2){
			continue;
		}
		if(v[v.size() - 1] == v2[i].second){
			v.pop_back();
		}else{
			v.push_back(v2[i].second);
		}
	}
	for(int i = 0; i < v3.size(); i++){
		if(check[v3[i].second] != 2){
			continue;
		}
		if(v[v.size() - 1] == v3[i].second){
			v.pop_back();
		}else{
			v.push_back(v3[i].second);
		}
	}
	for(int i = 0; i < v4.size(); i++){
		if(check[v4[i].second] != 2){
			continue;
		}
		if(v[v.size() - 1] == v4[i].second){
			v.pop_back();
		}else{
			v.push_back(v4[i].second);
		}
	}
	
	if(v.size() == 1){
		cout << "YES" << endl;
	}else{
		cout << "NO" << endl;
	}
	
	return 0;
}

Measured memory_bytes: 3544
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned ll
#define PI acos(-1)
#define vi vector<int>
#define pi pair<int, int>
#define pl pair<ll, ll>
template<typename T> using v2 = vector<vector<T>>;
template<typename T> using v3 = vector<vector<vector<T>>>;
template<class T> istream &operator>>(istream&is,vector<T>&v){for(auto &elemnt:v)is>>elemnt;return is;}
template<class T,class U> istream &operator>>(istream&is,pair<T,U>&p){is>>p.first>>p.second;return is;}
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; }
const int MOD = 1e9 + 7;
const int INF = 1e9 + 200;
const ll INFLL = 2e18 + 200;

int main() {
    string S;
    cin >> S;
    if (S.substr(S.length() - 1, 1) == "s") S += "es";
    else S += "s";
    cout << S << endl;
}

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

int main() {
  long n,m; 
  cin >> n>>m;
  string s,t;
  cin>>s>>t;
  long g=__gcd(n,m);
  bool ch=true;
  rep(i,g){
    if(s.at(i*n/g)!=t.at(i*m/g)){
      ch=false;
    }
  }
  
  if(ch){
    long ans=n*m/g;
    cout<<ans<<endl;
  }
  else{
    cout<<-1<<endl;
  }
  
}

Measured memory_bytes: 512
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
template<class S,class T> ostream &operator << (ostream& out,const pair<S,T>& o){
    out << "(" << o.first << "," << o.second << ")"; return out;
}

/*
<url:https://agc003.contest.atcoder.jp/tasks/agc003_c>
問題文============================================================
 高橋君は、誕生日に長さ N の数列をもらいました。i(1≦i≦N) 番目の要素は整数 Ai です。
 どの 2 つの要素も、互いに異なります。 高橋君はこの数列を単調増加になるように並べ替えたいです。
 高橋君は超能力者なので、以下の 2 つの操作が任意のタイミングでできます。
 
 操作1: 数列の連続する 2 つの要素を選び、その 2 つの順番を反転する。
 操作2: 数列の連続する 3 つの要素を選び、その 3 つの順番を反転する。

 高橋君は操作2は好きですが、操作1は嫌いです。
 この 2 種類の操作を使って数列を単調増加になるように並び替えるときの、操作1の最小回数を求めてください。

=================================================================

解説=============================================================

================================================================
*/
ll solve(){
    ll res = 0;
    ll N; cin >> N;
    vector<ll> A(N); for(auto&in:A) cin >> in;
    vector<ll> B = A;
    sort(B.begin(),B.end());
    for(int i = 0; i < N;i++){
        A[i] = lower_bound(B.begin(),B.end(),A[i]) - B.begin();
    }
  //  for(auto v:A) cout << v << " "; cout << endl;
    for(int i = 0; i < N;i+=2){
        if(A[i]%2 == 0) continue;
        res++;
    }
    return res;
}
int main(void) {
	cin.tie(0); ios::sync_with_stdio(false);
    cout << solve() << endl;
	return 0;
}


Measured memory_bytes: 1792
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <deque>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <numeric>
#include <utility>
#include <iostream>
#include <algorithm>
#include <functional>
#include <unordered_map>
#include <unordered_set>

using namespace std;

#define ll long long
#define ull unsigned long long
#define INF (1 << 30)
#define LLINF (1LL << 62)
#define MOD7 1000000007
#define MOD9 1000000009
#define eps 1e-9
#define P pair<int, int>
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pul pair<ull, ull>
#define all(a) (a).begin(), (a).end()
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);--i)
#define REP(i,n) for (int i=0;i<(n);++i)
#define RREP(i,n) for (int i=(n)-1;i>=0;--i)

void YES() { cout << "YES\n"; }
void NO() { cout << "NO\n"; }
void Yes() { cout << "Yes\n"; }
void No() { cout << "No\n"; }
void yes() { cout << "yes" << endl; }
void no() { cout << "no" << endl; }

template<class T>
class DirectedGraph {
public:
	class Edge {
	public:
		int to;
		T cost;

		Edge(int t, T c) : to(t), cost(c) {}
	};

	vector<vector<Edge>> G;
	vector<int> visit;
	vector<pii> stamp{ 0 };
	int V;

	DirectedGraph(int n = 0) {
		resize(n);
	}

	void resize(int n) {
		V = n;
		G.resize(n);
		visit.resize(n);
		stamp.resize(n);
	}

	void addEdge(int from, int to, T cost = 0) {
		int v = max(from, to);
		if (v >= V)
			resize(v + 1);
		G[from].push_back(Edge(to, cost));
	}

	int t = 1;
	void dfs(int s) {
		if (stamp[s].first == 0)
			stamp[s].first = t++;
		else
			return;

		for (int i = 0; i < G[s].size(); ++i) {
			dfs(G[s][i].to);
		}
		stamp[s].second = t++;
	}

	int bfs() {

	}
};

int main() {
	DirectedGraph<int> g;
	int n, id, k, to;
	cin >> n;
	for (int i = 0; i < n; ++i) {
		cin >> id >> k;
		while (k--) {
			cin >> to;
			g.addEdge(id, to);
		}
	}

	for (int i = 1; i <= n; ++i) {
		g.dfs(i);
	}
	for (int i = 1; i <= n; ++i) {
		cout << i << " " << g.stamp[i].first << " " << g.stamp[i].second << endl;
	}

	return 0;
}

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

int main() {
	int n;
	long long a[100010],b[100010],c[100010],tmp[100010],jwb=0;
	cin >>  n;
	for (int i=0;i<n;++i) {
		cin >> a[i];
	}
	for (int i=0;i<n;++i) {
		cin >> b[i];
	}
	for (int i=0;i<n;++i) {
		cin >> c[i];
	}
	sort(a, a+n); sort(b, b+n); sort(c, c+n);
	int j=0;
	for (int i=0;i<n;++i) {
		while (j<n && c[j]<=b[i]) ++j;
		tmp[i] = n-j;
	}
	tmp[n] = 0;
	for (int i=n-1;i>=0;--i) {
		tmp[i] += tmp[i+1];
	}
	j = 0;
	for (int i=0;i<n;++i) {
		while (j<n && b[j]<=a[i]) ++j;
		jwb += tmp[j];
	}
	cout << jwb << endl;
	return 0;
}

Measured memory_bytes: 3456
import sys
input = sys.stdin.readline

#n = int(input())
#l = list(map(int, input().split()))

'''
a=[]
b=[]
for i in range():
    A, B = map(int, input().split())
    a.append(A)
    b.append(B)'''
#import bisect
x,n=map(int, input().split())
p=list(map(int, input().split()))
p.sort()
#n=bisect.bisect_left(x)
if x not in p:
    print(x)
    sys.exit()

for i in range(1,1000-x):
    if x-i not in p:
        print(x-i)
        sys.exit()

    if x+i not in p:
        print(x+i)
        sys.exit()

Measured memory_bytes: 9192
// -*- coding:utf-8-unix -*-

use proconio::input;
use rand::Rng;

pub fn get_time() -> f64 {
    static mut STIME: f64 = -1.0;
    let t = std::time::SystemTime::now()
        .duration_since(std::time::UNIX_EPOCH)
        .unwrap();
    let ms = t.as_secs() as f64 + t.subsec_nanos() as f64 * 1e-9;
    unsafe {
        if STIME < 0.0 {
            STIME = ms;
        }
        ms - STIME
    }
}

pub struct State {
    D: usize,
    sat: isize,
    out: Vec<usize>,
    last: Vec<usize>,
    c: Vec<isize>,
    s: Vec<Vec<isize>>,
}

impl State {
    fn calclate_score(&mut self) -> isize {
        self.sat = 0;
        self.last = vec![0; 26];
        for d in 0..self.D {
            assert!(0 <= self.out[d] && self.out[d] <= 25);
            let j = self.out[d as usize] as usize;
            self.last[j] = d + 1;
            for i in 0..26 as usize {
                self.sat -= (d + 1 - self.last[i]) as isize * self.c[i];
            }
            self.sat += self.s[d][j];
        }
        self.sat
    }
    fn initialize_output(&mut self) {
        for i in 0..self.D {
            let mut max = 0;
            for j in 0..26 {
                max = if self.s[i][max] < self.s[i][j] {
                    j
                } else {
                    max
                };
            }
            self.out[i] = max;
        }
    }
}

fn main() {
    input! {
        D: usize,
        c: [isize; 26],
        s: [[isize; 26]; D],
    }
    let mut plan = State {
        D: 365,
        sat: 0,
        out: vec![0; D],
        last: vec![0; 26],
        c: c,
        s: s,
    };
    plan.initialize_output();
    let mut rng = rand::thread_rng();
    let mut max_score = plan.calclate_score();
    let mut loop_cnt = 0;
    while get_time() < 1.9 {
        // eprintln!("{}", max_score);
        let d: usize = rng.gen_range(0, D);
        let q: usize = rng.gen_range(0, 26);
        let old = plan.out[d];
        plan.out[d] = q;
        let score = plan.calclate_score();
        if max_score < score {
            max_score = score;
        } else {
            plan.out[d] = old;
        }
        loop_cnt += 1;
    }
    for x in plan.out {
        println!("{}", x + 1);
    }
    eprintln!("score:{}, loop:{}", max_score, loop_cnt);
}


Measured memory_bytes: 2736
var n,i,j,k:longint;
s,c:ansistring;
begin
  readln(s);
  if pos('+',s)=0 then k:=-1 else k:=1;
  if k=1 then c:=copy(s,1,pos('+',s)-2) else c:=copy(s,1,pos('-',s)-2);
  val(c,i);
  if k=1 then c:=copy(s,pos('+',s)+2,length(s)-pos('+',s)-1) else c:=copy(s,pos('-',s)+2,length(s)-pos('-',s)-1);
  val(c,j);
  if k=1 then writeln(i+j) else writeln(i-j); 
end.


Measured memory_bytes: 128
#include "bits/stdc++.h"
#define MOD 1000000007
#define INF 11234567890
#define in std::cin
#define out std::cout
#define rep(i,N) for(LL i=0;i<N;++i)
typedef long long int LL;

int r, g, b;

int main()
{
	in >> r >> g >> b;

	auto tmp = r * 100 + g * 10 + b;
	if (tmp % 4 == 0)
	{
		out << "YES" << std::endl;
	}
	else
	{
		out << "NO" << std::endl;
	}
	return 0;
}

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

int main(){
  string s;cin >> s;
  if(s[0] == s[1] && s[1] == s[2])cout << "Yes" << endl;
  else if(s[1] == s[2] && s[2] == s[3])cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
//macros
using namespace std;
typedef long long ll;
typedef pair<int, int > P;
#define pb push_back
#define rep(i, a, b) for(int i=(a); i<(b); i++)
const long long int mod = 1e9 + 7;

int s[26];
int t[26];
int main()
{
    string S,T;
    cin >> S >> T;
    rep(i,0,S.size()){
        s[S[i]-'a']++;
        t[T[i]-'a']++;
    }
    sort(s, s+26);
    sort(t, t+26);
    rep(i,0,26){
        if(s[i] != t[i]){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
}

Measured memory_bytes: 776
#include <iostream>

#include <cstring>

#include <string>
#include <vector>
#include <algorithm>

using namespace std;

#define SZ(a) int((a).size())
#define REP(i,n) for(int i=0,_n=(n);i<_n;++i)
#define FOR(i,a,b) for(int i=(a),_b=(b);i<=_b;++i)

typedef long long llong;
typedef vector<int> VI;
typedef vector<VI> VVI;

int rgcd(int a, int b) {
   return b == 0 ? a : rgcd(b, a % b);
}

#define MAXN 100004
int N, K;
int A[MAXN];

bool solve() {
   int mx = *max_element(A, A+N);
   if (K > mx) return false;

// int mn = *min_element(A, A+N);

   int g = A[0];
   FOR(i, 1, N-1)
      g = rgcd(g, A[i]);

   return (K % g) == 0;
}

int main(int argc, char* argv[]) {
   ios_base::sync_with_stdio(false); 
   cin.tie(NULL);

   cin >> N >> K;
   REP(i, N)
      cin >> A[i];

   bool res = solve();
   cout << (res ? "POSSIBLE" : "IMPOSSIBLE") << endl;

   return 0;
}


Measured memory_bytes: 640