akhauriyash/Code-Regression huggingface dataset:
import std.algorithm;
import std.array;
import std.conv;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

T read(T)() { return readln.chomp.to!T; }
T[] reads(T)() { return readln.split.to!(T[]); }
alias readint = read!int;
alias readints = reads!int;

void main() {
    int n = readint;
    if (n == 1) {
        writeln("Hello World");
    }
    else {
        int a = readint;
        int b = readint;
        writeln(a + b);
    }
}


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

#define DEBUG(x) cout<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cout<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl


typedef long long ll;
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
template<class S, class T> pair<S, T> operator+(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first + t.first, s.second + t.second); }
template<class S, class T> pair<S, T> operator-(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first - t.first, s.second - t.second); }
template<class S, class T> ostream& operator<<(ostream& os, pair<S, T> p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
#define X first
#define Y second
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define rrep1(i,n) for(int i=n;i>0;i--)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define in(x, a, b) (a <= x && x < b)
#define all(v) v.begin(),v.end()
#define UNIQUE(v) v.erase(unique(all(v)), v.end())
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 (a>b) { a = b; return 1; } return 0; }
const ll inf = 1000000001;
const ll INF = 1e18;
const ll MOD = 1000000007;
const double pi = 3.14159265358979323846;
#define Sp(p) cout<<setprecision(15)<< fixed<<p<<endl;
int dx[4] = { 1,0, -1,0 }, dy[4] = { 0,1,0,-1 };
int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };
#define fio() cin.tie(0); ios::sync_with_stdio(false);
//#define mp make_pair

int main() {
	int n, m, x, y;
	cin >> n >> m >> x >> y;
	vi a(n), b(m);
	rep(i, n) {
		cin >> a[i];
	}
	rep(j, m) {
		cin >> b[j];
	}
	sort(all(a));
	sort(all(b));
	int mi = a.back() + 1, ma = b[0];
	if (mi > ma) {
		cout << "War" << endl;
		return 0;
	}
	REP(i, mi, ma + 1) {
		if (x < i && i <= y) {
			cout << "No War" << endl;
			return 0;
		}
	}
	cout << "War" << endl;
	return 0;
}

Measured memory_bytes: 256
N = input()
S = input()
all = "0123456789"
result = 0
for i in all:
    Si = S.find(i)
    if Si != -1:
        for j in all:
            Sj = S[Si+1:].find(j)
            if Sj != -1:
                for k in all:
                    Sk = S[Si+Sj+2:].find(k)
                    if Sk != -1:
                        result += 1

print(result)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;

#define INF 1000000000
#define loop(i,a,b) for(int i=a;i<b;i++)
int main()
{
    //freopen("contest.txt","r",stdin);
    //freopen("contest.txt","w",stdout);
    ios::sync_with_stdio(0);
    cin.tie(0);
    int a,b;
    cin>>a>>b;
    cout<<a*b<<endl;



    return 0;
}


Measured memory_bytes: 3620
import Prelude hiding (flip)
import Control.Monad.State
import Data.List.Split
type Cups = (Bool,Bool,Bool)

main = do
    points <- fmap (map (splitOn ",").lines) getContents
    let actions = map makeAction points
        position = evalState (foldl1 (>>) actions) (True,False,False)

    putStrLn $ ballPosition position

getBall "A" (a,b,c) = a
getBall "B" (a,b,c) = b
getBall "C" (a,b,c) = c
setBall "A" i (a,b,c) = (i,b,c)
setBall "B" i (a,b,c) = (a,i,c)
setBall "C" i (a,b,c) = (a,b,i)

ballPosition :: Cups -> String
ballPosition (a,b,c)
    | a = "A"
    | b = "B"
    | c = "C"

makeAction [x,y] = flip x y
flip :: String -> String -> State Cups Cups
flip p1 p2 = do
    cups <- get
    let b1 = getBall p1 cups
        b2 = getBall p2 cups
        new = (setBall p1 b2).(setBall p2 b1) $ cups
    put new 
    return new

Measured memory_bytes: 3480
while True :
    n = int(input())
    P = []
    
    if n == 0 :
        break
    else :
        for i in range(n) :
            P.append(int(input()))
        
        Ps = sorted(P)
        del Ps[0]
        del Ps[n - 2]
        s = sum(Ps)
        
        print(s // (n - 2))


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

int main (void){
	long long int n,k,i,v=0;
	cin >> n >>k;
	v+=((n-n%k)/k)*((n-n%k)/k)*((n-n%k)/k);
	if(k%2==0){
		
		k/=2;
		v+=((((n-n%k)/k)+((n-n%k)/k)%2)/2)*((((n-n%k)/k)+((n-n%k)/k)%2)/2)*((((n-n%k)/k)+((n-n%k)/k)%2)/2);
	}
	cout << v << endl;
	return 0;
}

Measured memory_bytes: 256
program prob1
    implicit none
    integer::i
    character(len=10)::S
    read(*,*) S

    if(S == "hi" .or. S == "hihi" .or. S == "hihihi" .or. S == "hihihihi" .or. S == "hihihihihi")then
        write(*,*) "Yes"
    else
        write(*,*) "No"
    end if

    stop
end program prob1

Measured memory_bytes: 256
k = int(input())

# a,bの最大公約数
def gcd(a, b):
   while b:
       a, b = b, a % b
   return a

ansl = [[gcd(i, j) for i in range(201)] for j in range(201)]

ans = 0
for i in range(1,k+1):
    for j in range(1, k + 1):
        p = ansl[i][j]
        for k in range(1, k + 1):
            ans += ansl[p][k]

print(ans)


Measured memory_bytes: 9504
#include "bits/stdc++.h"
using namespace std;
typedef long long LL;
int d(int n) {
	int sum = 0;
	while (n) {
		sum += n % 10;
		n /= 10;
	}
	return sum;
}
int main() {
	int N;
	cin >> N;
	int ans = 1 << 30;
	for (int i = 1; i < N; i++) {
		ans = min(ans, d(i) + d(N - i));
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
a, b, c = (int(i) for i in input().split())

r1 = abs(b-a) + abs(c-b)
r2 = abs(c-a) + abs(b-c)

r3 = abs(a-b) + abs(c-a)
r4 = abs(c-b) + abs(a-c)

r5 = abs(a-c) + abs(b-a)
r6 = abs(b-c) + abs(a-b)

print(min([r1, r2, r3, r4, r5, r6]))


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


/*int B[10010],C[10010];
    int n;
void countsort(int A[],int B[],int k){
    rep(i,0,k+1)C[i]=0;
    rep(j,0,n)C[A[j]]++;
    rep(i,1,k+1)C[i]=C[i]+C[i-1];
    for(int j=n-1;j>=0;j++){
        B[C[A[j]]]=A[j];
        C[A[j]];
    }
}*/



int main(){
    int n;
    int A[2000010],B[2000010],C[10010];
    cin>>n;
    int k=10000;
    rep(i,0,n)cin>>A[i];
    rep(i,0,k+1)C[i]=0;
    rep(j,0,n)C[A[j]]++;
    rep(i,1,k+1)C[i]=C[i]+C[i-1];
    for(int j=n-1;j>=0;j--){
        C[A[j]]--;
                B[C[A[j]]]=A[j];

    }    rep(i,0,n){
        if(i)cout<<" ";
        cout<<B[i];
    }
    cout<<endl;
}





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

Measured memory_bytes: 2512
num_input = int(input())
input_arr = [int(x) for x in input().split()]
# print(input_arr)
count = 0
for i_ in range(len(input_arr)-2):
    arr_list = [input_arr[i] for i in range(i_,i_+3)]
    sorted_arr = sorted(arr_list)
    if sorted_arr[1] == arr_list[1]:
      count = count + 1
    
print(count)

Measured memory_bytes: 3060
#include <stdio.h>
#define N 100

void selectionsort(int[],int);

int main(){
  int a[N],n,i;

  scanf("%d",&n);

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

  return 0;
}

void selectionsort(int a[],int n){
  int key=0;
  int i,j,minj,status;

  for(i=0;i<n-1;i++){
    minj=i;
    for(j=i;j<n;j++){
      if(a[j]<a[minj]){
	minj=j;
      }
    }
    status=a[i];
    a[i]=a[minj];
    a[minj]=status;
    if(i!=minj) key++;
  }

  for(i=0;i<n;i++){
    if(i>0) printf(" ");
    printf("%d",a[i]);
  }
  printf("\n%d\n",key);
}



Measured memory_bytes: 2052
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <unordered_map>
using namespace std;

#define REP(i, s) for (int i = 0; i < s; ++i)
#define ALL(v) (v.begin(), v.end())
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T> ostream& operator << (ostream &s, set<T> P)
{ EACH(it, P) { s << "<" << *it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }

int c[4] = {1, 4, 7, 9};
int v[4];
int main() {
    for (int i = 0; i < 4; ++i) cin >> v[i];
    sort(v, v+4);
    bool ok = true;
    for (int i = 0; i < 4; ++i) if (v[i] != c[i]) ok = false;
    if (ok) puts("YES");
    else puts("NO");
}















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

using namespace std;

#define mem(a,b) memset(a,b,sizeof(a))
#define FOR(i,j,k) for(int i=j;i<=k;i++)
#define REV(i,j,k) for(int i=j;i>=k;i--)
#define FORR(i,j,k,l) for(int i=j;i<=k;i+=l)
#define inf         freopen("in.txt", "r", stdin)
#define outf        freopen("out.txt", "w", stdout)
#define pf          printf
#define sf(n)       scanf("%d", &n)
#define sff(a,b)    scanf("%d %d", &a, &b)
#define sfff(a,b,c)    scanf("%d %d %d", &a, &b, &c)
#define clean(mat,n)   FOR(i,0,n) mat[i].clear()
#define minn          (long long)-1000000000000000000
#define maxx          (long long) 1000000000000000000
#define mod          1000000007
#define M_PI           3.14159265358979323846  /* pi */
#define LL           long long
#define NL '\n'
#define cnd tree[idx]
#define lnd (idx<<1)
#define rnd ((idx<<1)+1)
#define PB push_back
#define F first
#define S second
#define MAX 100010
#define MP make_pair
#define valid(nx,ny)  ((nx >= 0) && (nx < row) && (ny >= 0) && (ny < col))
typedef pair<int,int> PR;

const int IT_MAX = 2e5;
int bit[IT_MAX + 10];


void update(int p, int v) ///change value of position p to v
{
	for (; p <= IT_MAX; p += p & (-p)) bit[p] += v;
}
int query(int p)
{
	int rv = 0;
	for (; p; p -= p & (-p)) rv += bit[p];
	return rv;
}


int n, ara[MAX], shut[MAX];

bool chk(int Val)
{
    LL ret = 0;

    mem(bit, 0);
    FOR(i,1,n)
    {
        shut[i] = shut[i - 1];
        if(ara[i] >= Val) shut[i]++;
        else shut[i]--;
    }

    FOR(i,0,n)
    {
       ret += query(shut[i] + n);
       if(i == n) break;
       update(shut[i] + n, 1);
    }

    if(ret * 2 >= (LL)n*(n+1)/2) return 1;
    return 0;
}

int main()
{
    ios::sync_with_stdio(false);
    ///inf;
    //outf;

    cin >> n;
    FOR(i,1,n) cin >> ara[i];

    int st = 1, en = 1e9, mid, prin = 0;

    while(st <= en)
    {
        mid = (st + en)>>1;

        if(chk(mid)) prin  = max(prin, mid),
            st = mid + 1;
        else en = mid - 1;
    }

    cout << prin << endl;


    return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define ADD(a, b) a = (a + ll(b)) % mod
#define MUL(a, b) a = (a * ll(b)) % mod
#define MAX(a, b) a = max(a, b)
#define MIN(a, b) a = min(a, b)
#define rep(i, a, b) for(int i = int(a); i < int(b); i++)
#define rer(i, a, b) for(int i = int(a) - 1; i >= int(b); i--)
#define all(a) (a).begin(), (a).end()
#define sz(v) (int)(v).size()
#define pb push_back
#define sec second
#define fst first
#define debug(fmt, ...) Debug(__LINE__, ":", fmt, ##__VA_ARGS__)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<int, pi> ppi;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> mat;
typedef complex<double> comp;
void Debug() {cout << '\n'; }
template<class FIRST, class... REST>void Debug(FIRST arg, REST... rest){
	cout<<arg<<" ";Debug(rest...);}
template<class T>ostream& operator<<(ostream& out,const vector<T>& v) {
	out<<"[";if(!v.empty()){rep(i,0,sz(v)-1)out<<v[i]<<", ";out<<v.back();}out<<"]";return out;}
template<class S, class T>ostream& operator<<(ostream& out,const pair<S, T>& v){
	out<<"("<<v.first<<", "<<v.second<<")";return out;}
const int MAX_N = 200010;
const int MAX_V = 100010;
const double eps = 1e-6;
const ll mod = 1000000007;
const int inf = 1 << 29;
const ll linf = 1LL << 60;
const double PI = 3.14159265358979323846;
///////////////////////////////////////////////////////////////////////////////////////////////////

int N;
ll A[MAX_N];

void solve() {
	cin >> N;
	ll S = 0;
	rep(i, 0, N) {
		cin >> A[i];
		S += A[i];
	}
	ll D = 1ll * N * (N + 1) / 2;
	if(S % D != 0) {
		cout << "NO\n"; return;
	}
	S /= D;
	rep(i, 0, N) {
		ll d = A[(i + 1) % N] - A[i];
		d -= S;
		if(d > 0 || abs(d) % N != 0) {
			cout << "NO\n"; return;
		}
	}
	cout << "YES\n";
}

int main() {
#ifndef LOCAL
	ios::sync_with_stdio(false);
    cin.tie(0);
#endif
    cout << fixed;
	cout.precision(20);
	srand((unsigned int)time(NULL));
#ifdef LOCAL
	//freopen("in.txt", "wt", stdout); //for tester
    freopen("in.txt", "rt", stdin);
#endif	
	solve();
#ifdef LOCAL
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
	return 0;
}



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

int main(){
    vector<int> a(3);
    cin >> a[0] >> a[1] >> a[2];
    sort(a.begin(),a.end());
    if (a[0] == 5 && a[1] == 5 && a[2] == 7){
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }
}

Measured memory_bytes: 256
def main():
    s = input()

    dic = {}
    for i in range(len(s)):
        if s[i] in dic:
            dic[s[i]].append(i)
        else:
            dic[s[i]] = [i]

    ans = 101
    for k in dic:
        dic[k].append(-1)
        dic[k].append(len(s))
        dic[k].sort()

        mx = -1
        for j in range(len(dic[k])-1):
            mx = max(mx, dic[k][j+1]-dic[k][j]-1)

        ans = min(ans, mx)

    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
#include<stdio.h>

int max(int x,int y){return x>y?x:y;}
int min(int x,int y){return x<y?x:y;}

int main(void){

  int t,n,h[101],i,up=0,down=0;

  scanf("%d",&t);

  while(t--){
    scanf("%d",&n);
    for(i=0;i<n;i++)scanf("%d",&h[i]);
    for(i=up=down=0;i<n-1;i++){
      up=max(up,h[i+1]-h[i]);
      down=min(down,h[i+1]-h[i]);
    }
    printf("%d %d\n",up,-down);
  }
  return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <vector>
#include <cstring>
#include <climits>
#include <algorithm>
#include <map>
using namespace std;

int main() {
    int A, B;
    while (cin >> A >> B) {
        cout << A + B << endl;
    }
    return 0;
}

Measured memory_bytes: 1160
# coding:utf-8

import sys
import math
import time
#import numpy as np
import collections
from collections import deque
import queue
import copy

# 最大公約数
def gcd(m,n):
  x = max(m,n)
  y = min(m,n)
  if x%y == 0:
    return y
  else:
    while x%y != 0:
      z = x%y
      x = y
      y = z
    else:
      return z

# 幅優先探索(BFS)でスタート座標(x, y)からの最大距離返す
def bfs(SS, x, y, H, W):#入力(座標系(迷路), x, y, xの端, yの端)
  x_next = [0, 0, -1, 1]
  y_next = [1, -1, 0, 0]
  tempx = x
  tempy = y
  mlength = 0
  q = deque()
  xytuple = (x, y, 0)
  q.append(xytuple)


  while q:
    xytuple = q.popleft()
    SS[xytuple[0]][xytuple[1]] = "x" #探索した場所は探索できないようにする
    for i in range(4): #このforで上下左右を調べてる
      tempx = xytuple[0] + x_next[i]
      tempy = xytuple[1] + y_next[i]
      #print(tempx, tempy, xytuple[2])
      #print(S)
      if(0 <= tempx and tempx < H and 0 <= tempy and tempy < W and SS[tempx][tempy] == "."):
        temptuple = (tempx, tempy, xytuple[2]+1)
        SS[temptuple[0]][temptuple[1]] = "x" #探索した場所は探索できないようにする
        mlength = max(mlength, xytuple[2] +1)
        q.append(temptuple)
      #print(q)
  return mlength

#素因数分解
def prime_factorize(n):
  a = []
  while n % 2 == 0:
    a.append(2)
    n //= 2
  f = 3
  while f * f <= n:
    if n % f == 0:
      a.append(f)
      n //= f
    else:
      f += 2
  if n != 1:
    a.append(n)
  return a



#X = str(input()).split()
#a = [int(x) for x in input().split()]


ST = str(input()).split()
AB = str(input()).split()
A = int(AB[0])
B = int(AB[1])
U = str(input())

if(ST[0] == U):
  print(str(A-1)+ " " + str(B))
else:
  print(str(A) + " " + str(B-1))




Measured memory_bytes: 38776
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define endl '\n'
#define pii pair<ll, ll>
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
#define traceloop(x,a) {for(ll i=0;i<x;i++) cerr<<a[i]<<" "; cerr<<endl;}
ll ab(ll x) {return x>0LL?x:-x;}

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    ll a,b;
    cin>>a>>b;
    cout<<max(a+b,max(a-b,a*b));
    return 0;
}
    

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <map>
#include <numeric>
#include <set>
#define FOR(i, a, n) for (int i = (a); i < (n); i++)
#define REP(i, n) for(int i = 0; i < (n); i++)
using namespace std;



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

	vector<int> ant;
	int tmp;

	REP(i, 5) {
		cin >> tmp;
		ant.push_back(tmp);
	}

	cin >> tmp;

	if (ant[4] - ant[0] > tmp) {
		cout << ":(" << endl;
	}
	else
	{
		cout << "Yay!" << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <fstream>
#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <bitset>
#include <array>
#include <vector>
#include <queue>
#include <set>
#include <cmath> // 変数名にy1が使えなくなるかも…。
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <limits>
#include <functional>
#include <string>

typedef __int128_t int128_t;
std::istream &operator>>(std::istream& input, int128_t& value) { // int128_tの入力。入力が64bitに収まる前提。
    long long tmp; input >> tmp; value = tmp;
    return input;
}
std::ostream &operator<<(std::ostream& output, const int128_t value) { // int128_tの出力。出力が64bitに収まる前提。
    output << (long long)value;
    return output;
}

#define rep(i, begin, end) for(int64_t i = (begin); i <= (end); i++)
#define rev(i, begin, end) for(int64_t i = (begin); (end) <= i; i--)

const int MAX_N = 1e5 + 10;
const int MAX_C = 32;
int N, C;
int s[MAX_N], t[MAX_N], c[MAX_N];

int d[MAX_N] = {};
int num[MAX_C][MAX_N] = {};

int main(int argc, char **argv){
    std::cin >> N >> C;
    
    rep (i, 1, N) {
        std::cin >> s[i] >> t[i] >> c[i];
        rep (j, s[i], t[i]) {
            num[c[i]][j] = 1;
        }
    }

    int ret = 0;
    rep (i, 1, 1e5) {
        rep (j, 1, C) {
            num[0][i] += num[j][i];
        }
        ret = std::max(ret, num[0][i]);
    }

    std::cout << ret << std::endl;
    
    return 0;
}



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

int main(){
	int n;
	cin >> n;
  if (n%1000==0) {
    cout << 0 << endl;
  } else  {
	cout << 1000 - n%1000 << endl;
  }
}


Measured memory_bytes: 3636
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstring>
#include <cstdio>
#define LL long long
#define pb push_back
#define mp make_pair
#define INF 0x3f3f3f3f
#define Inf 1000000000000000000LL
#define F first
#define S second
using namespace std;
typedef pair<int,int>pii;
int w,l;
char ch;
int main(){
	while(cin>>ch){
		if(ch=='x')l++;
	}
	w=15-l;
	cout<<(w>=8?"YES":"NO")<<endl;
	return 0;
}


Measured memory_bytes: 256
//vector<vector<int>> data(3, vector<int>(4));//int型の2次元配列(3×4要素の)の宣言
//int64_t a;
//10のi乗pow(10, i);
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
  int N,M,C;
  cin >> N >>M>>C;
  vector<int>B(M);
  int count=0;
  rep(i,M)cin >> B.at(i);
  vector<vector<int>> A(N, vector<int>(M));//int型の2次元配列(3×4要素の)の宣言  
  rep(i,N){
    rep(j,M){
      cin >> A.at(i).at(j);
    }
  }
/*
  rep(i,M){
    cout<<	B.at(i);
  }
    cout<<endl;
  rep(i,N){
    rep(j,M){
	cout<<	A.at(i).at(j);
    }
    cout<<endl;
  }
*/  
  
  
  rep(i,N){ 
      int sum=0;
    rep(j,M){
      sum+= B.at(j)*A.at(i).at(j);
    }
    if(sum+C > 0)count++;
  }
  cout << count<< endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<cmath>
using namespace std;
int main() {
	double r;
	cin >> r;

	const double pi = acos(-1);

	cout << fixed << setprecision(15) << r * r * pi << " " << 2 * r * pi << endl;
	return 0;
}



Measured memory_bytes: 3272
#include <bits/stdc++.h>
using namespace std;
#define REP(i, t) for(int i = 0; i < t; i++)
#define INF (1 << 30)

int main()
{
    int N, M;       //N問の問題, M本のドリンク
    int T[110], P[110], X[110];
    cin >> N;
    REP(i, N) cin >> T[i];
    cin >> M;
    REP(i, M) cin >> P[i] >> X[i];

    int ans[110] = {0}; //i番目のドリンクをのむときにかかる時間の合計
    REP(i, M)           //i本目のドリンクを飲むとき
    {
        REP(j, N)       //j番目の問題を解くとき
        {
            if (P[i] - 1 == j) ans[i] += X[i];
            else ans[i] += T[j];
        }
    }

    REP(i, M) cout << ans[i] << endl;

    return 0;
}


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

int main(){
  int x1,x2,x3,x4,x5;
  cin >> x1 >> x2 >> x3 >> x4 >> x5;
  if(x1==0){
    cout << 1 << endl;
    return 0;
  }
  else if(x2==0){
    cout << 2 << endl;
    return 0;
  }
  else if(x3==0){
    cout << 3 << endl;
    return 0;
  }
  else if(x4==0){
    cout << 4 << endl;
    return 0;
  }
  else if(x5==0){
    cout << 5 << endl;
    return 0;
  }
}

Measured memory_bytes: 3592
/* Author - Ankur Kumar Singh 
	IDE :- Offine Linux
	
 ---------------------------------*/
#include <bits/stdc++.h>
using namespace std;
/* variable type :- */
	# define ll long long int
	# define ld long double
	# define I int
/* map */
	# define abc  pair<long long int,long long int>
	map < pair < abc,abc > , long long int > pqr;
	map <  pair < long long int,long long int > ,long long int > xyz;	
/* vector */
	# define pb push_back
	# define pp pop_back
	# define ff first
	# define ss second
	# define mp make_pair
	# define ac accumulate
/* pairs */
	vector<pair<ll,ll>>a;
	vector<pair<pair<int,int>,pair<int,int> > > b;
	vector<pair<ll,pair<ll,ll>>>c;
 
bool compare( const pair<long long int,long long int>&x , const pair<long long int,long long int>&y )
{
	return x.ff>y.ff;
}
bool sortbysec(const pair<int,int> &a,const pair<int,int> &b)
{
        return (a.ss < b.ss);
}
int main()
{
	ll k;
	cin>>k;
	if(k%2==0)
	{
		cout<<k/2*k/2;return 0;
	}
	cout<<(k/2)*(k/2+1);
}

Measured memory_bytes: 256
def main():
    N = int(input())
    W = [input() for _ in range(N)]
    if len(W) != len(set(W)):
        print("No")
        exit()
    for i in range(1, N):
        if W[i-1][-1] != W[i][0]:
            print("No")
            exit()
    print("Yes")

if __name__ == '__main__':
    main()

Measured memory_bytes: 38256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<n+1;i++)
#define sort(A) sort(A.begin(),A.end())
#define reverse(A) reverse(A.begin(),A.end())
typedef long long ll;

int main(){
  int n,k;
  cin >> n >> k;
  string s;
  cin >> s;
  vector<int> r(0);//runlength
  
  int seek = 0;
  while(seek < n){
    int start = seek;
    int freq = 0;
    while(s[seek] == s[start]){
      seek ++;
      freq ++;
    }
    r.push_back(freq);
  }
  
  int m = r.size();//length of r;
  vector<int> c(m);//cumlative sum
  
  rep(i,m) c[i] = c[i-1] + r[i];

  //corner
  if(m == 1){
    cout << n << endl;
    return 0;
  }
  
  
  int ans = 0;
  seek = 0;
  if(s[0] == '1') seek++;
  
  while(seek < m){
    int rightend = min(seek + 2*k - 1, m-1);
    int leftend = max(seek - 2, -1);
    ans = max(ans,c[rightend] - c[leftend]);
    seek += 2;
  }
  cout << ans << endl;
}

Measured memory_bytes: 1272
#include <bits/stdc++.h>
using namespace std;
 
int N,M,R;
vector<int> a(20010),b(20010),c(20010);
int d[210][210];
 
int main(){
  cin >> N >> M >> R;
  vector<int> r(R);
  for(int i=0;i<R;i++){cin >> r[i];}
  for(int i=1;i<=M;i++){cin >> a[i] >> b[i] >> c[i];}
  for(int i=1;i<=N;i++){
    for(int j=1;j<=N;j++){d[i][j]=100000000;}
  }
  for(int i=1;i<=N;i++){d[i][i]=0;}
  for(int i=1;i<=M;i++){d[a[i]][b[i]]=c[i]; d[b[i]][a[i]]=c[i];}
  for(int k=1;k<=N;k++){
    for(int i=1;i<=N;i++){
      for(int j=1;j<=N;j++){d[i][j]=min(d[i][j],d[i][k]+d[k][j]);}
    }
  }
  int ans=100000000; int e=0;
  sort(r.begin(),r.end());
  do{
    int sum=0;
    for(int i=0;i<R-1;i++){sum+=d[r[i]][r[i+1]];}
    ans=min(ans,sum);
  }while(next_permutation(r.begin(),r.end()));
  cout << ans << endl;
}

Measured memory_bytes: 640
import java.util.Scanner;
public class Main {
	public static void main(String[] args)throws Exception{
		Scanner stdIn=new Scanner(System.in);
		int N=stdIn.nextInt();
		int P[]=new int[N];
		int min=N*2,ans=0;
		for(int i=0;i<N;i++){
			P[i]=stdIn.nextInt();
			if(P[i]<=min){
				min=P[i];ans++;
			}
		}
		System.out.println(ans);
	}
}


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

typedef long long ll;
const int maxn=1e5+10;
int n,cnt,ch[maxn][2];
ll l,sg;
char s[maxn];

ll lowbit(ll a){
	return a&(-a);
}
void insert(){
	int rt=1;
	for(int i=0;s[i];++i){
		if(!ch[rt][s[i]-'0'])
			ch[rt][s[i]-'0']=++cnt;
		rt=ch[rt][s[i]-'0'];
	}
}
void dfs(int rt,int dep){
	if(ch[rt][0])
		dfs(ch[rt][0],dep+1);
	else
		sg^=lowbit(l-dep);
	if(ch[rt][1])
		dfs(ch[rt][1],dep+1);
	else
		sg^=lowbit(l-dep);
}

int main(){
	cin>>n>>l;
	cnt=1;
	for(int i=1;i<=n;++i){
		cin>>s;
		insert();
	}
	dfs(1,0);
	puts(sg?"Alice":"Bob");
	return 0;
}

Measured memory_bytes: 3456
#include<bits/stdc++.h>
using namespace std;
using ll  = long long;
using vl  = vector<ll>;
using vi  = vector<int>;
#define _GLIBCXX_DEBUG
#define IO_STREAM cin.tie(0);ios::sync_with_stdio(false)
#define all(x) x.begin(),x.end()
#define rep(i,sta,end) for(int i=sta;i<end;++i)
#define lcm(a,b) (a)/__gcd((a),(b))*(b)
#define pb push_back
const ll INF = 1000000000000000;
const ll MOD = 1000000007;
const double PI = acos(-1);
//||
#define DBG(a,b,c,d) //cout<<a<<" "<<b<<" "<<c<<" "<<d<<" "<<endl
//DBG("","","","");

#define TOP_NUM 5
#define NOTOP_NUM 21

int main(){
	IO_STREAM;
	int D;	cin>>D;
	vi c(26);
	vector<pair<int,int>>cs(26);
	rep(i,0,26){
		cin>>c[i];
		cs[i].first=c[i];
		cs[i].second=i;
	}
	int s[D][26];
	rep(i,0,D){
		rep(j,0,26){
			cin>>s[i][j];
		}
	}

	sort(all(cs));
	reverse(all(cs));
	vi top(D,1);
	rep(i,0,TOP_NUM){
		top[i]=cs[i].second+1;
	}
	vi notop(D,1);
	rep(i,0,NOTOP_NUM){
		notop[i]=cs[i+TOP_NUM].second+1;
	}

	int cnt=1;
	int nt_idx=0;
	while(1){
		rep(i,0,TOP_NUM){
			cout<<top[i]<<endl;
			cnt++;
			if(cnt>D) return 0;
		}
		rep(i,0,10){
			cout<<notop[nt_idx]<<endl;
			nt_idx++;
			if(nt_idx>=NOTOP_NUM) nt_idx=0;
			cnt++;
			if(cnt>D) return 0;
		}
	}
	return 0;
}


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

using ll = long long;
using ld  = long double;
using pll = pair<ll, ll>;
using pld = pair<ld, ld>;
const int INF=1e9+7;
const ll LINF=9223372036854775807;
const ll MOD=1e9+7;
const ld PI=acos(-1);
const ld EPS = 1e-10; //微調整用（EPSより小さいと0と判定など）

int ii() { int x; if (scanf("%d", &x)==1) return x; else return 0; }
long long il() { long long x; if (scanf("%lld", &x)==1) return x; else return 0; }
string is() { string x; cin >> x; return x; }
char ic() { char x; cin >> x; return x; }
void oi(int x) { printf("%d ", x); }
void ol(long long x) { printf("%lld ", x); }
void od_nosp(double x) { printf("%.15f", x); } // 古い問題用
void od(double x) { printf("%.15f ", x); }
// long doubleで受け取り、fをLfなどに変えて出力すると、変な数値が出る
// それをなんとかするには独自の出力を作らなければならなそう
void os(const string &s) { printf("%s ", s.c_str()); }
void oc(const char &c) { printf("%c ", c); }
#define o_map(v){cerr << #v << endl; for(const auto& xxx: v){cout << xxx.first << " " << xxx.second << "\n";}} //動作未確認
void br() { putchar('\n'); }

// #define gcd __gcd //llは受け取らない C++17~のgcdと違うので注意
// int lcm(int a, int b){return a / gcd(a, b) * b;}
#define begin_end(a) a.begin(),a.end() //sort(begin_end(vec));
#define REP(i,m,n) for(ll i=(ll)(m) ; i < (ll)(n) ; i++ )
#define DREP(i,m,n) for(ll i=(ll)(m) ; i > (ll)(n) ; i-- )
#define rep(i,n) REP(i,0,n)
#define m_p(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define p_b push_back
#define SZ(x) ((ll)(x).size()) //size()がunsignedなのでエラー避けに
#define endk '\n'


// coutによるpairの出力（空白区切り）
template<typename T1, typename T2> ostream& operator<<(ostream& s, const pair<T1, T2>& p) {return s << "(" << p.first << " " << p.second << ")";}
// coutによるvectorの出力（空白区切り）
template<typename T> ostream& operator<<(ostream& s, const vector<T>& v) {
  int len = v.size();
  for (int i = 0; i < len; ++i) {
    s << v[i]; if (i < len - 1) s << " "; //"\t"に変えるとTabで見やすく区切る
  }
  return s;
}
// coutによる多次元vectorの出力（空白区切り）
template<typename T> ostream& operator<<(ostream& s, const vector< vector<T> >& vv) {
  int len = vv.size();
  for (int i = 0; i < len; ++i) {
    s << vv[i] << endl;
  }
  return s;
}

//最大値、最小値の更新。更新したor等しければtrueを返す
template<typename T>
bool chmax(T& a, T b){return (a = max(a, b)) == b;}
template<typename T>
bool chmin(T& a, T b){return (a = min(a, b)) == b;}

//4近傍（上下左右） rep(i, 2) にすると右・下だけに進む
vector<int> dx_4 = {1, 0, -1, 0};
vector<int> dy_4 = {0, 1, 0, -1};

// -------- template end - //


// - library ------------- //

vector<vector<ll> > adj_list;

vector<ll> dp;

// s を始点とする 最大パス
ll f(ll s){
  if (dp[s] != -1) return dp[s];
  else{
    ll res = 0;
    for (ll t : adj_list[s]) chmax(res, f(t) + 1);
    dp[s] = res;
    return res;
  }
}


// --------- library end - //


int main(){

  ll N, M;
  cin >> N >> M;

  dp = vector<ll> (N, -1);
  adj_list = vector<vector<ll> >(N, vector<ll>() );
  rep(i, M){
    ll a = il() - 1;
    ll b = il() - 1;
    adj_list[a].p_b(b);
  }

  ll ans = 0;
  rep(i, N){
    chmax(ans, f(i));
  }

  cout << ans << endk;

}

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

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

    vector<ll> a(n+1);
    ll sum = 0;
    rep(i, n+1) { cin >> a[i]; sum += a[i]; }

    ll ans = 1;
    ll now = 1;
    rep(i, n+1) {
        sum -= a[i];
        now = min((now-a[i])*2, sum);
        ans += now;
        //printf("ans=%d, sum=%d, now=%d\n", ans, sum, now);
        if (now < 0) {
            ans = -1; break;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 4012
N = int(input())

w = str(input())
w_end = w[-1]

tmp = []
tmp.append(w)

for i in range(N - 1):
    w = str(input())
    if w[0] == w_end and w not in tmp:
        pass
    else:
        print("No")
        exit()
    w_end = w[-1]
    tmp.append(w)

print("Yes")


Measured memory_bytes: 3060
# include "iostream"
# include "cstdio"

const int maxm=5e2+10;

using namespace std;

int map[maxm][maxm],H,W;

struct step{
	int x1,y1;
	int x2,y2;
}Step[maxm*maxm];
 
int main(){
	int now; 
	register int i,j,tot=0;
	scanf("%d%d",&H,&W);
	for(i=1;i<=H;i++){
		for(j=1;j<=W;j++){
			scanf("%d",&now);
			map[i][j]+=now; 
			if(j<W && map[i][j]%2==1){
				map[i][j]--; 
				map[i][j+1]++;
				Step[++tot]=(step){i,j,i,j+1};
			}
			if(j==W && i<H && map[i][j]%2==1){
				map[i][j]--; 
				map[i+1][j]++;
				Step[++tot]=(step){i,j,i+1,j};
			}
		}
	}
	printf("%d\n",tot);
	for(i=1;i<=tot;i++){
		printf("%d %d %d %d\n",Step[i].x1,Step[i].y1,Step[i].x2,Step[i].y2); 
	}
	return 0; 
}

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

pos=-1
seen=[False]*N
last=[-1]*N
hist=[]
i=0
cnt=0

while seen[i]==False:
    seen[i]=True
    last[i]=cnt
    cnt+=1
    hist.append(i)
    next_i=A[i]-1
    i=next_i
    if seen[i]==True:
        pos=i

LOOP=hist[last[pos]:]
preLOOP=last[pos]
if K<=preLOOP:
    print(hist[K]+1)
else:
    K-=preLOOP
    ans=K%len(LOOP)
    print(LOOP[ans]+1)

Measured memory_bytes: 34272
c = []
for _ in range(3):
    c.append(list(map(int,input().split())))

for i in range(3):
    d = []
    for j in range(3):
        d.append(c[i][j]-c[i-1][j])
    if len(set(d)) > 1:
        print('No')
        break
else:
    print('Yes')

Measured memory_bytes: 3188
pub struct ProconReader<R: std::io::Read> {
    reader: R,
}

impl<R: std::io::Read> ProconReader<R> {
    pub fn new(reader: R) -> Self {
        Self { reader }
    }
    pub fn get<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .reader
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&byte| byte == b' ' || byte == b'\n' || byte == b'\r')
            .take_while(|&byte| byte != b' ' && byte != b'\n' && byte != b'\r')
            .collect::<Vec<_>>();
        std::str::from_utf8(&buf)
            .unwrap()
            .parse()
            .ok()
            .expect("Parse Error.")
    }
}

fn main() {
    let stdin = std::io::stdin();
    let mut rd = ProconReader::new(stdin.lock());

    let h: usize = rd.get();
    let w: usize = rd.get();
    let sy: usize = rd.get();
    let sx: usize = rd.get();
    let gy: usize = rd.get();
    let gx: usize = rd.get();
    let sy = sy - 1;
    let sx = sx - 1;
    let gy = gy - 1;
    let gx = gx - 1;
    let a: Vec<Vec<char>> = (0..h)
        .map(|_| {
            let s: String = rd.get();
            s.chars().collect()
        })
        .collect();
    let inf = std::i32::MAX / 2;
    let mut d = vec![vec![inf; w]; h];
    let mut q = std::collections::VecDeque::new();
    d[sy][sx] = 0;
    q.push_back((sy, sx));
    let dist = |(x1, y1): (usize, usize), (x2, y2): (usize, usize)| {
        (x1 as i32 - x2 as i32).abs() + (y1 as i32 - y2 as i32).abs()
    };
    while let Some((y, x)) = q.pop_front() {
        for ny in (y as i32 - 2)..=(y as i32 + 2) {
            for nx in (x as i32 - 2)..=(x as i32 + 2) {
                if ny < 0 || ny >= h as i32 || nx < 0 || nx >= w as i32 {
                    continue;
                }
                let ny = ny as usize;
                let nx = nx as usize;
                if x == nx && y == ny {
                    continue;
                }
                if a[ny][nx] == '.' {
                    if dist((ny, nx), (y, x)) == 1 {
                        if d[ny][nx] > d[y][x] {
                            d[ny][nx] = d[y][x];
                            q.push_front((ny, nx));
                        }
                    } else {
                        if d[ny][nx] > d[y][x] + 1 {
                            d[ny][nx] = d[y][x] + 1;
                            q.push_back((ny, nx));
                        }
                    }
                }
            }
        }
    }
    let mut ans = d[gy][gx];
    if ans == inf {
        ans = -1;
    }
    println!("{}", ans);
}

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

using namespace std;

int main()
{
    int a=0,b=0;
   for(int i=0;i<3;i++)
   {
       int x;
       cin>>x;
       if(x==5)
       {
           a++;
       }
       if(x==7)
       {
           b++;
       }
   }
   
   if(a==2 && b==1)
   {
       cout<<"YES"<<endl;
   }
   else
   {
       cout<<"NO"<<endl;
   }
   
   return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long x = sc.nextLong();
        long y = sc.nextLong();
        long count = 0;
        long now = x;
        while (true) {
            if (now <= y) {
                count++;
            } else {
                break;
            }
            now = now * 2;
        }
        System.out.println(count);

    }
}

Measured memory_bytes: 23252
import java.util.Scanner

fun main (args: Array<String>) {
    val sc = Scanner(System.`in`)

    val N = sc.nextInt()
    val K = sc.nextInt()

    var ans = 1
    for(i in 0 until N) {
        ans += Math.min(K, ans)
    }

    println(ans)
}


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

#define DEBUG(x) cout << "DEBUG>" << #x << ":" << x << endl;
#define REP(i,n) for(long long i=0;i<(n);i++)
#define FOR(i,a,b) for(long long i=(a);i<=(b);i++)

int main() {
  long long A, B;
  cin >> A >> B;
  long long ans = 0;
  vector<long long> aa, bb;
  A--;
  REP(i, 40) {
    long long p = pow(2, i + 1);
    int a = (A / p) * (p / 2) + max((long long)0, A % p - (p / 2) + 1);
    aa.push_back(a);
  }
  REP(i, 40) {
    long long p = pow(2, i + 1);
    int a = (B / p) * (p / 2) + max((long long)0, B % p - (p / 2) + 1);
    bb.push_back(a);
  }
  REP(i, 40) {
    if((bb[i] - aa[i]) % 2 == 0) {
    } else {
      ans += pow(2, i);
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <functional>
#include <vector> 
#define FOR(x,n) for(int i=(x);i<(n);i++)
using namespace std;
vector<int> arr(200000);
int main(void){
    // Your code here!
    int enem,abil;
    cin >> enem;
    cin >> abil;
    // arr = new vector<long>(enem)
    // vector<int> arr(200000);
    FOR(0,enem){
        cin >> arr[i];
    }
    sort(arr.begin(),arr.end(),greater<int>());
    FOR(0,abil){
        arr[i]=0;
    }
    long sum=0;
    FOR(0,enem){
        sum+=arr[i];
    }
    cout << sum;
    return 0;
}

Measured memory_bytes: 1152
h, w, d = map(int, input().split())
a = []
for i in range(h):
    a.append(list(map(int, input().split())))
dic=dict()
for i in range(h):
    for j in range(w):
        dic[a[i][j]] = (i, j)
co_order = [None] + [value for key, value in sorted(dic.items(), key=lambda x: x[0])]
cost = {i: [0] for i in range(1, d + 1)}

for i in range(1, d + 1):
    sx, sy= co_order[i]
    for ex, ey in co_order[i+d::d]:
        cost[i].append(cost[i][-1] + abs(sx - ex) + abs(sy - ey))
        sx, sy = ex, ey
q = int(input())
for i in range(q):
    l, r = map(int, input().split())
    index = (r-1)%d+1
    print(cost[index][(r-1)//d] - cost[index][(l-1)//d])

Measured memory_bytes: 83804
#ABC145D
def main():
    import sys, math
    X, Y = map(int, sys.stdin.readline().split())
    '''
    i +2*j ==X
    2*i +j ==Y
    '''
    if (2*Y-X)%3==0:
        i = (2*Y-X)//3
        j = Y-2*i
    else:
        i,j=0,0
    #print(i, j)
    mod = 10**9+7
    def calc(n):
        ans = 1
        for i in range(n, 1, -1):
            ans *= i
            ans %= mod
        return ans
    
    ans = calc(i+j)
    #print(calc(-1))
    #print(ans)
    
    #calc2(calc(i), mod-2)
    gg1 = pow(calc(i), mod-2, mod)
    gg2 = pow(calc(j), mod-2, mod)
    
    if i<0 or j<0:
        print(0)
    elif i==0 and j==0:
        print(0)
    else:
        print(ans*gg1*gg2%mod)

if __name__=='__main__':
    main()

Measured memory_bytes: 3064
import sys
import math
def I():return int(sys.stdin.readline().replace("\n",""))
def I2():return map(int,sys.stdin.readline().replace("\n","").split())
def S():return str(sys.stdin.readline().replace("\n",""))
def L():return list(sys.stdin.readline().replace("\n",""))
def intl():return [int(k) for k in sys.stdin.readline().replace("\n","").split()]
def Lx(k):return list(map(lambda x:int(x)*-k,sys.stdin.readline().replace("\n","").split()))

if __name__ == "__main__":
    s = S()
    print("ABC" if s == "ARC" else "ARC")

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

int main(void){
  char salt[10];
  char A = 'A', C = 'C', G = 'G', T = 'T';
  salt[0] = getchar();
  if(salt[0] == 'A'){
    printf("T");
  } else if(salt[0] == 'C'){
    printf("G");
  } else if(salt[0] == 'G'){
    printf("C");
  } else {
    printf("A");
  }
  return 0;
}


Measured memory_bytes: 128
from itertools import combinations
n, m = map(int, input().split())
r = []
i = 0
j = -1
c = 0
for _ in range(n):
    i += 2
    r.append(i)
for _ in range(m):
    j += 2
    r.append(j)
r.sort()
for k in list(combinations(r, 2)):
    if sum(k) % 2 == 0:
        c += 1

print(c)

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

template <typename A, typename B>
string to_string(pair<A, B> p);
 
template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p);
 
template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p);
 
string to_string(const string& s) {
  return '"' + s + '"';
}
 
string to_string(const char* s) {
  return to_string((string) s);
}
 
string to_string(bool b) {
  return (b ? "true" : "false");
}
 
string to_string(vector<bool> v) {
  bool first = true;
  string res = "{";
  for (int i = 0; i < static_cast<int>(v.size()); i++) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(v[i]);
  }
  res += "}";
  return res;
}
 
template <size_t N>
string to_string(bitset<N> v) {
  string res = "";
  for (size_t i = 0; i < N; i++) {
    res += static_cast<char>('0' + v[i]);
  }
  return res;
}
 
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
 
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
 
template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ")";
}
 
template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + ")";
}

#define ar array<ll, 2>
#define ll long long
#define in insert
#define pb push_back
#define vt vector
#define P_Q(x) priority_queue<x>
#define p_q(x) priority_queue<x, vector<x>, greater<x>>
#define For(i, n) for(ll i = 0; i < n; i++)
#define Rev(i, n) for(ll i = n-1; i >= 0; i--)
#define FOR(i, n) for(ll i = 1; i <= n; i++) 
#define REV(i, n) for(ll i = n; i >= 1; i--)
#define Rep(i,a,b) for(ll i = a; i <= b; i++)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int) (x).size()

#define CERR cout
// #define CERR cerr
 
void debug_out() { CERR << endl; }
 
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  CERR << " " << to_string(H);
  debug_out(T...);
}
 
#ifndef ONLINE_JUDGE
#define dbg(...) CERR << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define dbg(...) 42
#endif
 
const ll mod = 1e9L + 7;
const ll INF = 1e18L + 5;
const ll mxN = 2e5 + 1;
ll n;
vt<ll> a;

// remember to read no of test_cases
void solve()
{
    string s;
    cin >> s;
    n = sz(s);
    if(s[n-1] == 's')
        s += "es";
    else
        s += "s";
    cout << s;
}
 
int main()
{
#ifndef ONLINE_JUDGE
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
#endif
    ios::sync_with_stdio(0);  cin.tie(0);
    ll t = 1;
    // cin >> t;
    FOR(tt, t) solve();
    return 0;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
#include<iostream>
#include<fstream>
#define ll long long
using namespace std;

int main(){
    ll N;  cin >> N;
    ll G[2], S[2], B[2];
    for(int i=0; i<2; i++){
        cin >> G[i] >> S[i] >> B[i];
    }
    if(G[0] >= G[1] && S[0] >= S[1] && B[0] >= B[1]){
        swap(G[0],G[1]);
        swap(S[0],S[1]);
        swap(B[0],B[1]);
    }

    ll ans = 0;
    if(G[0] <= G[1] && S[0] <= S[1] && B[0] <= B[1]){
        for(ll g=0; g*G[0]<=N; g++) for(ll s=0; g*G[0]+s*S[0]<=N; s++){
            ll b = (N-g*G[0]-s*S[0])/B[0];
            ans = max(ans, N + (G[1]-G[0])*g + (S[1]-S[0])*s + (B[1]-B[0])*b);
        }
    }else{
        if(G[0] >= G[1] && S[0] < S[1]){ swap(G[0], S[0]);  swap(G[1], S[1]); }
        if(G[0] >= G[1] && B[0] < B[1]){ swap(G[0], B[0]);  swap(G[1], B[1]); }
        if(S[0] >= S[1] && B[0] < B[1]){ swap(B[0], S[0]);  swap(B[1], S[1]); }

        if(S[0] > S[1]){
            ll g = N/G[0];
            N = N + (G[1]-G[0])*g;
            for(ll s=0; s*S[1]<=N; s++) {
                ll b = (N - s*S[1])/B[1];
                ans = max(ans, N + (S[0]-S[1])*s + (B[0]-B[1])*b);
            }
        }else{
            for(ll g=0; g*G[0]<=N; g++){
                ll s = (N - g*G[0])/S[0];
                ll M = N + (G[1]-G[0])*g + (S[1]-S[0])*s;
                ll b = M/B[1];
                ans = max(ans, M + (B[0]-B[1])*b);
            }
        }
    }
    cout << ans << endl;
}



Measured memory_bytes: 256
//  Created by conan1024hao in 2019.
//  Copyright © 2019 conan1024hao. All rights reserved.
//  専用ライブラリです、自由にコピーして構いません。
//  感谢看我的代码！Wechat:conan1024hao Twitter/QQ:810396815
#pragma GCC optimize ("O3")
#include <iostream>
#include <iomanip>
#include <istream>
#include <ostream>
#include <sstream>
#include <iterator>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <utility>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <ctime>
#include <cctype>
#include <cstdlib>
#define IINF 10e8
#define INF 10e16
#define MOD 1000000007
#define mod 1000000007
#define rep(i, a, n) for (ll i = a; i < (ll)(n); i++)
#define Endl endl
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define mmax(x,y)(x>y?x:y)
#define mmin(x,y)(x<y?x:y)
#define chmax(x,y) x=mmax(x,y)
#define chmin(x,y) x=mmin(x,y)
#define all(x) (x).begin(),(x).end()
#define siz(x) (ll)(x).size()
#define PI acos(-1.0)
using namespace std;
//using Int=int_fast64_t;
typedef long long int ll;
typedef pair<ll,ll>Pll;
typedef pair<int,int>Pin;
long long GCD(long long a, long long b) { return b ? GCD(b, a%b) : a; }
long long LCM(long long a, long long b)  {return a/GCD(a,b)*b;}
int dx[8]={-1,0,1,0,1,1,-1,-1};
int dy[8]={0,-1,0,1,1,-1,1,-1};
char dir[4]={'u','l','d','r'};
ll cmp1(pair<ll,string>a,pair<ll,string> b){
        if(a.fi!=b.fi)
        return a.fi<b.fi;
        else
        return a.se<b.se;
}

//---------------------------------------------------------------------------
long long modpow(long long a, long long n) {//a^n(MOD)を求める
    long long res = 1;
    while (n > 0) {
         if (n & 1) res = res * a % MOD;
         a= a * a % MOD;//次の準備
         n >>= 1;
      }
 return res;
}
//---------------------------------------------------------------------------
int main(){//問題をちゃんと見ろ!!!!!!!!!!!!!!!!!      llか??????????        memset()!!!!!!!!!!!!       ペナを減らせ!!!!!!!!!!!!!
    cin.tie(0);
    ios::sync_with_stdio(false);
    //-------------------------------
    int a,b,c;cin>>a>>b>>c;
    if(a==b&&b==c)cout<<1<<endl;
    else if(a==b||a==c||b==c)cout<<2<<endl;
    else cout<<3<<endl;
    //-------------------------------
    return 0;
}
//---------------------------------------------------------------------------









Measured memory_bytes: 256