akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;


const int mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};


int main() {
  int n;
  cin >> n;
  vi a(n);
  rep(i,n){
    cin  >> a[i];
  }
  
  sort(a.begin(),a.end());
  if(n%2==1){
    a.insert(a.begin(),0);
    for(int i = 0;i<n;i++){
      if(a[i] != 2*(i/2)){
        cout<<0<<endl;
        return 0;
      }
    }
  }
  else{
    for(int i = 0;i<n;i++){
      if(a[i] != 2*(i/2)+1){
        cout<<0<<endl;
        return 0;
      }
    }
  }

  int m = n/2;
  mint ans = 2;
  ans = ans.pow(m);
  cout<<ans.x<<endl;
  return 0;
}

Measured memory_bytes: 896
#include<bits/stdc++.h>
using namespace std;
int f[200009];
int main(){
  int n;
  scanf("%d",&n);
  for(int i=1,x;i<=n;i++)
    scanf("%d",&x),f[x]=f[x-1]+1;
  int mx=0;
  for(int i=1;i<=n;i++)
    mx=max(mx,f[i]);
  printf("%d",n-mx);
  return 0;
}


Measured memory_bytes: 1024
// Aizu Vol-2 0218: Dividing Students
// 2017.8.7

#include <stdio.h>

int main()
{
	int n, pm, pe, pj;
	int i, k;

	while (1) {
		scanf("%d", &n);
		if (n == 0) break;
		for (i = 0; i < n; i++) {
			scanf("%d%d%d", &pm, &pe, &pj);
			if (pm == 100 || pe == 100 || pj == 100) puts("A");
			else if (pm + pe >= 90 * 2) puts("A");
			else if ((k = pm + pe + pj) >= 80 * 3) puts("A");
			else if (k >= 70 * 3) puts("B");
			else if (k >= 50 * 3 && (pm >= 80 || pe >= 80)) puts("B");
			else puts("C");
		}
	}
	return 0;
}

Measured memory_bytes: 584
#include<cstdio>
#include<cstring>
#define B 9973
int base64(char ch)
{
	if('A' <= ch && ch <= 'Z')
	return ch - 'A';
	if('a' <= ch && ch <= 'z')
	return ch - 'a' + 26;
	if('0' <= ch && ch <= '9')
	return ch - '0' + 52;
	return ch == '+' ? 62 : 63;
}
int w, h, p, image_bit[1024][1024], pattern_bit[128][128], backup[128][128];
char image[1000][200], pattern[100][20];
typedef unsigned long long ull;
ull row_hash[1024][1024], hashes[8];
template<size_t raw_rows, size_t raw_cols, size_t bit_rows, size_t bit_cols>
inline void base64_to_bit(char (&raw)[raw_rows][raw_cols], int (&bit)[bit_rows][bit_cols], int h)
{
	memset(bit, 0, sizeof(bit));
	for(int i = 0; i < h; i++)
	for(int j = 0; raw[i][j]; j++)
	{
		const int x = base64(raw[i][j]);
		for(int k = 0; k < 6; k++)
		if(x & (1 << k))
		bit[i][j * 6 + 5 - k] = 1;
	}
}
int main()
{
	while(~scanf("%d%d%d", &w, &h, &p), w)
	{
		for(int i = 0; i < h; i++)
		scanf(" %s", image[i]);
		for(int i = 0; i < p; i++)
		scanf(" %s", pattern[i]);
		base64_to_bit(image, image_bit, h);
		base64_to_bit(pattern, pattern_bit, p);
		for(int d = 0; d < 8; d++)
		{
			memcpy(backup, pattern_bit, sizeof(pattern_bit));
			for(int i = 0; i < p; i++)
			for(int j = 0; j < p; j++)
			pattern_bit[p - 1 - j][i] = backup[i][j];
			if(d == 4)
			{
				memcpy(backup, pattern_bit, sizeof(pattern_bit));
				for(int i = 0; i < p; i++)
				for(int j = 0; j < p; j++)
				pattern_bit[i][p - 1 - j] = backup[i][j];
			}
			hashes[d] = 0;
			for(int i = 0; i < p; i++)
			for(int j = 0; j < p; j++)
			hashes[d] = hashes[d] * B + pattern_bit[i][j];
		}
		ull t1 = 1ULL;
		for(int i = 0; i < p; i++)
		t1 *= B;
		for(int i = 0; i < h; i++)
		{
			ull e = 0;
			for(int j = 0; j < w; j++)
			{
				e = e * B + image_bit[i][j];
				if(j >= p)
				e -= t1 * image_bit[i][j - p];
				row_hash[i][j] = e;
			}
		}
		ull t2 = 1ULL;
		for(int i = 0; i < p; i++)
		t2 *= t1;
		int ans = 0;
		for(int i = p - 1; i < w; i++)
		{
			ull e = 0;
			for(int j = 0; j < h; j++)
			{
				e = e * t1 + row_hash[j][i];
				if(j >= p)
				e -= t2 * row_hash[j - p][i];
				if(j >= p - 1)
				for(int d = 0; d < 8; d++)
				if(hashes[d] == e)
				{
					ans++;
					break;
				}
			}
		}
		printf("%d\n", ans);
	}
}


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

int main(){
    int a, b;
    cin >> a >> b;

    if(a == 1){
      if(b == 2){
        cout << 3;
      }else if(b == 3){
        cout << 2;
      }
      }else if(a == 2){
        if(b == 1){
          cout << 3;
        }else if(b == 3){
          cout << 1;
        }
    }else if(a == 3){
      if(b == 2){
        cout << 1;
      }else if(b == 1){
        cout << 2;
      }
    }
} 

Measured memory_bytes: 256
N, Q=map(int, input().split())
S=input()
rui=[0]*(N+1)
pre=S[0]
prerui=0
for i in range(1,N):
  if pre=="A" and S[i]=="C":
    prerui+=1
  rui[i+1]+=prerui
  pre=S[i]
  
for i in range(Q):
  l,r=map(int, input().split())
  print(rui[r]-rui[l])
  
#print(rui)

Measured memory_bytes: 51032
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
using namespace std;
int main()
 {  ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
	
            int n;
            cin>>n;
            ll a[n],c=0,min=9999999999;
            for(int i=0;i<n;i++){
                cin>>a[i];
                if(i!=0)
                    if(min<a[i]) c++;
                
                if(min>a[i]) min = a[i];    
            }
            cout<<n-c<<"\n";
        
	return 0;
}

Measured memory_bytes: 1792
n, k = map(int, input().split())
A = list(map(int, input().split()))
order = [-1] * (n+1)
v = [0] * (n+1)
v[0] = 1
order[v[0]] = 0
# iは順番
for i in range(1, n+1):
    v[i] = A[v[i-1] - 1]
    if order[v[i]] != -1:
        old_i = order[v[i]]
        c = i - old_i
        break
    order[v[i]] = i
if k < old_i:
    print(v[k])
else:
    print(v[(k - old_i)%c + old_i])

Measured memory_bytes: 32152
#include<stdio.h>
int main(){
  int i,j;
  char a[1];
  while(1){
    scanf("%d %c %d",&i,&a[0],&j);
    if(a[0]=='+'){
      printf("%d\n",i+j);
    }
    else if(a[0]=='-'){
      printf("%d\n",i-j);
    }
    else if(a[0]=='*'){
      printf("%d\n",i*j);
    }
    else if(a[0]=='/'){
      printf("%d\n",i/j);
  }
    else if(a[0]=='?'){
      break;
    }
  }
  return (0);
}

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

#include <iostream>
#include <string>

using namespace std;

class B {
public:
    void solve(std::istream& in, std::ostream& out) {
        string O, E;
        in >> O >> E;

        string ret = "";
        for (int i = 0; i < O.length(); ++i) {
            ret += O[i];
            if (i < E.length()) {
                ret += E[i];
            }
        }

        out << ret;
    }
};


int main() {
	B solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


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

Measured memory_bytes: 596
# python template for atcoder1
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline


def solve(w, h):
    mat = [[0]*(w+2) for _ in range(h+2)]
    for j in range(h):
        l = list(map(int, input().split()))
        for i in range(w):
            mat[j+1][i+1] = l[i]
    visited = [[False]*(w+2) for _ in range(h+2)]

    ans = 0
    for i in range(h+2):
        for j in range(w+2):
            if visited[i][j]:
                continue
            else:
                if mat[i][j] == 1:
                    visited[i][j] = True
                    ans += 1
                    Q = [[i, j]]
                    ran = [1, 0, -1]
                    while Q:
                        x, y = Q.pop(-1)
                        for dx in ran:
                            for dy in ran:
                                if mat[x+dx][y+dy] == 1 and not visited[x+dx][y+dy]:
                                    visited[x+dx][y+dy] = True
                                    Q.append([x+dx, y+dy])
    return ans


a = []
while True:
    w, h = map(int, input().split())
    if w == 0 and h == 0:
        break
    else:
        a.append(solve(w, h))
print("\n".join(map(str, a)))



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

const int INF = 100000000;

//状態を表すクラスpairの場合、typedefしておくと便利
typedef pair<int, int> P;

//入力
const int MAX_H = 1000;
const int MAX_W = 1000;
char field[MAX_H+1][MAX_W+1]; //迷路の文字列配列
int H, W;
queue<P> que;

int d[MAX_H][MAX_W]; //各マスが塗られるまでの最短手数

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

int bfs (){
    //queueが空になるまでループ
    while (que.size()){
        //queueの先頭を取り出す
        P p = que.front();
        que.pop();

        //移動できる4方向をループ
        for (int i = 0; i < 4; i++){
            //移動したあとの点を(nx, ny)とする
            int nx = p.first + dx[i], ny = p.second + dy[i];

            //移動した後の点が、移動可能な点かの判定と既に訪れたことがあるかを判定する
            if (0 <= nx && nx < H && 0 <= ny && ny < W && field[nx][ny] != '#'){
                //移動できるならqueueに入れて、その点をpからの距離+1で確定する
                field[nx][ny] = '#';
                que.push(P(nx,ny));
                d[nx][ny] = d[p.first][p.second]+1;
            }
    }
    }
    int ans = 0;
    for (int i = 0; i < H; i++){
        for (int j = 0; j < W; j++){
            if ( ans < d[i][j])
            ans = d[i][j];
        }
    }
    return ans;
}

void solve(){
    int ans = bfs();
    cout << ans << endl;
}

int main(){
    cin >> H >> W;
    //最短手数グリッド上の全ての点をINFで初期化
    for (int i = 0; i < H; i++){
        for (int j = 0; j < W; j++){
            d[i][j] = INF;
        }
    }
    for (int i = 0; i < H; i++){
        for (int j = 0; j < W; j++){
            cin >> field[i][j];
            if (field[i][j] == '#'){
                que.push(P(i,j));
                d[i][j] = 0;
            }
        }
    }
    solve();
}

Measured memory_bytes: 13328
n=int(input())
a=list(map(int,input().split()))
d=[]
for i in range(0,n):
  if i==0:
    d.append(abs(a[i]))
    d.append(abs(a[i]-a[i+1]))
  elif i==n-1:
    d.append(abs(a[i]))
  else:
    d.append(abs(a[i]-a[i+1]))
dsum=sum(d)
for i in range(n):
  if i==0:
    print(dsum-d[i]-d[i+1]+abs(a[i+1]))
  elif i==n-1:
    print(dsum-d[i]-d[i+1]+abs(a[i-1]))
  else:
    print(dsum-d[i]-d[i+1]+abs(a[i-1]-a[i+1]))
    

Measured memory_bytes: 14040
#include <bits/stdc++.h>
using namespace std;
int main(){
  int x1,x2,x3,x4,y1,y2,y3,y4;
  cin>>x1>>y1>>x2>>y2;
  int s=x2-x1;
  int t=y2-y1;
  x3=x2-t;
  y3=y2+s;
  x4=x1-t;
  y4=y1+s;
  cout<<x3<<' '<<y3<<' '<<x4<<' '<<y4<<endl;
}


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

#define DUMP(x) cerr << #x << "=" << x << endl
#define DUMP2(x, y) cerr<<"("<<#x<<", "<<#y<<") = ("<<x<<", "<<y<<")"<< endl
#define BINARY(x) static_cast<bitset<16> >(x)

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

#define in_range(x, y, w, h) (0<=(int)(x) && (int)(x)<(int)(w) && 0<=(int)(y) && (int)(y)<(int)(h))
#define ALL(a) (a).begin(),(a).end()

typedef long long ll;
const int INF = 1e9;
typedef pair<int, int> PII;
int dx[4]={0, -1, 1, 0}, dy[4]={-1, 0, 0, 1};

int main()
{
    ios::sync_with_stdio(false);

    string A, B, C;
    cin >> A >> B >> C;
    cout << A.front() << B.front() << C.front() << endl;
}



Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#define rep(i, n) for(int i = 0; i < (int)(n); ++i)
#define REP(i, n) for(int i = 1; i < (int)(n); ++i)
using namespace std;

int main() {
    string S;
    cin >> S;
    
    set<char> C;
    rep(i, S.size()) {
        if (C.count(S[i])) {
            cout << "no" << endl;
            return 0;
        }
        C.insert(S[i]);
    }
    cout << "yes" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
typedef long long ll;
typedef long double ld;
#define pb push_back
#define mp make_pair

using namespace std;

int main()
{
   FAST/**/
   
   ll n;
   cin>>n;
   
   map<pair<ll,ll>,ll> ma;
   for(ll i=1;i<n;i++)
   {
       if(i == n-i)
            continue;
       ll a = i;
       ll b = n-i;
       
       ma[mp(a,b)] = 1;
   }
   
   cout<<ma.size()/2;
   
   return 0;
}

Measured memory_bytes: 62720
K, S = map(int,input().split())
cnt=0
for y in range(K+1):
  for z in range(y,K+1):
    if y == z and 0 <= S-y-z <=K:
      cnt+=1      
    elif 0 <= S-y-z <=K:
      cnt += 2
      
print(cnt)

Measured memory_bytes: 2940
import sys,heapq
from collections import deque,defaultdict
printn = lambda x: sys.stdout.write(x)
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
DBG = True  and False
def ddprint(x):
  if DBG:
    print(x)

n = inn()
if n==1:
    print(1)
    exit()
    
a = []
for i in range(n):
    x,y = inm()
    a.append((x,y))

h = defaultdict(int)
for i in range(n-1):
    z = a[i]
    for j in range(i+1,n):
        u = a[j]
        p = z[0]-u[0]
        q = z[1]-u[1]
        if p<0:
            p = -p
            q = -q
        elif p==0 and q<0:
            q = -q
        h[(p,q)] += 1

ddprint(h)
mx = max(h.values())
print(n-mx)


Measured memory_bytes: 40560
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <string>
#include <cstring>
#include <cstdint>
#include <vector>
#include <algorithm>
#include <cmath>
#include<iomanip>
#include <unordered_map>
#include <map>
using namespace std;
static const long long MOD = 1000000007LL;
typedef long long ll;
unordered_map <string,int> ump;
map <int,int> mp;
 
int main()
{
	int a,b;
    cin>>a>>b;
    int tt=1;
    int cnt=0;
    while(++cnt)
    {
    	tt+=a-1;
    	if(tt>=b)
    		break;
    }
    if(b<=1)
    	cnt=0;
 	cout<<cnt<<endl;
 	

	return 0;
} 

Measured memory_bytes: 256
//Use valgrind once if the submission doesn't go through. It can detect uninitialized variables and see where they could be an issue.
#include <bits/stdc++.h>
using namespace std;

int main(){

	ios_base::sync_with_stdio(false);
    	cin.tie(NULL);
	
	int n,x,t;
	cin>>n>>x>>t;
	if(n%x==0){
		cout<<(n/x)*t<<endl;
	}
	else{
		cout<<static_cast<int>(ceil((n/(x*1.0))))*t<<endl;
	}
}


Measured memory_bytes: 3668
#include <bits/stdc++.h>
using namespace std;
 
 
typedef long long ll;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef long double ld;
 
typedef set<int>::iterator sit;
typedef map<int,int>::iterator mit;
typedef vector<int>::iterator vit;
 
const int INF = 1e9 + 7;
const int MOD = 1e9 + 7;
const int MAXN = 1e6 + 3;
 
#define _  %  MOD
#define __ %= MOD
 
#define      each(it,s)        for(auto it = s.begin(); it != s.end(); ++it)
#define      sortA(v)          sort(v.begin(), v.end())
#define      sortD(v)          sort(v.begin(), v.end(), greater<auto>())
#define      fill(a)           memset(a, 0, sizeof (a))
 
#define      swap(a,b)        {a=a+b;b=a-b;a=a-b;}
#define      rep(i, n)         for(ll i = 0; i < (n); ++i)
#define      repA(i, a, n)     for(ll i = a; i <= (n); ++i)
#define      repD(i, a, n)     for(ll i = a; i >= (n); --i)
#define watch(x) cout << (#x) << " is " << (x) <<endl
 
#define fi first
#define se second
#define mp make_pair
#define pb push_back
 
#define fbo find_by_order
#define ook order_of_key
 
ll gcd(ll a,ll b){if(b==0) return a; else return gcd(b,a%b);}
ll power(ll x,ll y){ll res=1; while(y>0){if(y&1) res=res*x;y=y>>1;x=x*x;}return res;} // modular exponent
 
int main()
{
    ios_base::sync_with_stdio(false); // don't use printf and scanf
    cin.tie(NULL); // cout<<fixed<<setprecision
   	int n;
   	cin>>n;
	int d1[n+1],d2[n+1];
	for(int i=1;i<=n;i++)
	{
		cin>>d1[i]>>d2[i];
	}	
	int flag=0;
	for(int i=1;i<=n-2;i++)
	{
		if(d1[i]==d2[i] && d1[i+1]==d2[i+1] && d1[i+2]==d2[i+2]) flag=1;
	}
	if(flag) cout<<"Yes\n";
	else cout<<"No\n";
	return 0;
}
// JUST ASK YOURSELF DID YOU GIVE YOUR BEST ? ISSE ZYADA
// KUCH KAR BHI NAHI SAKTE !! ENJOY AND GIVE YOUR BEST!!



Measured memory_bytes: 3688
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD = 1e9+7;
int main() {
    vector<ll>a={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    ll k;
    cin >> k;
    k--;
    ll ans=a[k];
    cout << ans << endl;
}

Measured memory_bytes: 3588
#include<iostream>
#include<string>
#include<queue>
#include<vector>

using namespace std;

struct item{
    string name;
    int value;
};

int main()
{
    int n,interrupt;

    item a[100001];

    queue<item> q;
    vector<item> v;

    int timer=0;

    cin>>n>>interrupt;

    for(int i=0;i<n;i++)
    {
        cin>>a[i].name>>a[i].value;
        q.push(a[i]);
    }

    while(!q.empty())
    {
        item temp=q.front();
        q.pop();

        if(temp.value>interrupt)
        {
            temp.value-=interrupt;
            q.push(temp);
            timer+=interrupt;
        }else
        {
            timer+=temp.value;
            temp.value=timer;
            v.push_back(temp);
        }
    }

    for(int i=0;i<v.size();i++)
    {
        cout<<v[i].name<<" "<<v[i].value<<endl;
    }


    return 0;
}



Measured memory_bytes: 8616
#include<iostream>
#include<tuple>
#include<queue>

using namespace std;

signed main(){

   while(1){
      int T, P, R;
      cin>> T>> P>> R;
      if(!(T||P||R)) break;

      int hoge[T][P];
      fill((int*)hoge, (int*)hoge+T*P, 0);
      for(int i=0; i<R; i++){
         int team, prob, time;
         string s;
         cin>> team>> prob>> time>> s;
         team--; prob--;
         if(s=="CORRECT"){
            hoge[team][prob]=1200*max(0-hoge[team][prob], 0)+time;
         }else{
            hoge[team][prob]--;
         }
      }
      priority_queue<tuple<int, int, int>> Q;
      for(int i=0; i<T; i++){
         int ac=0, pena=0;
         for(int j=0; j<P; j++){
            ac+=(hoge[i][j]>0);
            pena+=max(hoge[i][j], 0);
         }
         Q.push(make_tuple(ac, -pena, -i));
      }



      for(int i=0; i<T; i++){
         int ac, pena, team;
         tie(ac, pena, team)=Q.top(); Q.pop();
         cout<< -team+1<< " "<< ac<< " "<< -pena<< endl;
      }

   }

   return 0;
}

Measured memory_bytes: 3224
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <algorithm>
#include <set>
#include <map>
#define vv(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define vvi std::vector<std::vector<int> >
#define vvl std::vector<std::vector<ll> >
#define MODs 1000000007;
typedef long long int ll;
using namespace std;

int main(int argc, char const *argv[]) {
  string S;
  std::cin >> S;
  std::vector<pair<char, int>> ans;
  char now = 'A';
  for(int i=0;i<S.size();i++){
    if(now!=S[i]) {
      ans.push_back(make_pair(S[i], 1));
      now = S[i];
    }else ans[ans.size()-1].second++;
  }
  int count = 0;
  for(int i=0;i<ans.size()-1;i++){
    if(ans[i].second>=2&&ans[i+1].second>=2 && ans[i].second%3==2){
      ans[i].second--, ans[i+1].second--;
      count++;
    }
  }
  for(int i=0;i<ans.size();i++){
    if(ans[i].second>=1){
      if(ans[i].second%3==0) count += 2*(ans[i].second/3);
      else if(ans[i].second%3==1) count += 2*(ans[i].second/3) + 1;
      else count += 2*(ans[i].second/3) + 1;
    }
  }
  std::cout << count << '\n';
  return 0;
}


Measured memory_bytes: 2804
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
 #define endl '\n'
ll b[100009];
int main()
//b[100009];
{
ll n,k,i,sum=0,x,q,B,A;
cin>>n;
for(i=0;i<n;i++){
    cin>>x;
    b[x]++;
    sum+=x;
}
cin>>q;
while(q--){
        cin>>A>>B;
    sum+=(B-A)*b[A];
    cout<<sum<<endl;
b[B]=b[A]+b[B];b[A]=0;
}
}


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

using namespace std;

const string FIR = "First";
const string SEC = "Second";

int main() {
  string s;
  cin >> s;
  int n = s.size();
  if( s[0] == s[n-1] ) {
    n -= 2;
    puts((n&1)?SEC.c_str():FIR.c_str());
  } else {
    puts((!(n&1))?SEC.c_str():FIR.c_str());
  }
  return 0;
}


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

int main(){
	int a,b,ha=0,hb=0;
  	cin>>a>>b;
	int c=b-a;
  	for(int i=1;i<c;++i)ha+=i;
  	for(int i=1;i<=c;++i)hb+=i;
  	cout<<ha-a<<endl;
  	return 0;
}

Measured memory_bytes: 256
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric;

void main()
{
    auto nl = readln.split.to!(int[]);
    auto N = nl[0];
    long L = nl[1];
    auto as = readln.split.to!(long[]);

    foreach (i, a; as) {
        if (i == 0) continue;
        if (as[i-1] + a >= L) {
            writeln("Possible");
            foreach (j; 1..i) writeln(j);
            foreach_reverse (j; i+1..N) writeln(j);
            writeln(i);
            return;
        }
    }
    writeln("Impossible");
}

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

int main() {
    int n;cin>>n;
    int ans=0;
    for(int i=1;i<=n-1;++i){
        for(int j=1;j*j<i;++j){
            if(i%j==0)ans+=2;
        }
        int m=sqrt(i);
        if(m*m==i)++ans;
    }
    cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3672
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        
        int A = sc.nextInt();
        int B = sc.nextInt();
        int C = sc.nextInt();
        boolean check = false;

        for(int i=1; A*i<=A*B; i++){
            if ((A*i) % B == C ){
                check = true;
                break;
            }   
        }
        
        if(check == true){
            System.out.println("YES");
        }
        
        else{
            System.out.println("NO");
        }
    }
}


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

int md = 1e9 + 7;

void solve() {
    ll n;
    cin >> n;
    vector<ll> v(n);
    for (ll& item : v) cin >> item;

    // LOGIC
    vector<ll> sum(n);
    sum[n - 1] = v[n - 1];
    for (int i = n - 2; i >= 0; --i) {
        sum[i] = sum[i + 1] + v[i];
        sum[i] %= md;
    }

    ll ans = 0;
    for (int i = 1; i < n; ++i) {
        ans += v[i - 1] * sum[i];
        ans %= md;
    }
    cout << ans << "\n";
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    int t = 1;
    while(t--) {
        solve();
    }
}


Measured memory_bytes: 6336
#include<stdio.h>
int main(void){
	int a,b;
	char op;
	while(1){
		scanf("%d %c %d",&a,&op,&b);
		if(op == '+'){
			printf("%d\n",a + b);
		}
		if(op == '-'){
			printf("%d\n",a - b);
		}
		if(op == '*'){
			printf("%d\n",a * b);
		}
		if(op == '/'){
			printf("%d\n",a / b);
		}
		if(op == '?'){
			break;
		}
	}
	return 0;
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
using namespace std;
#define rep0(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define ll long long
#define coYes cout << "Yes" << endl
#define coYES cout << "YES" << endl
#define coyes cout << "yes" << endl
#define coNo cout << "No" << endl
#define coNO cout << "NO" << endl
#define cono cout << "no" << endl
#define BIT_FLAG_0 (1<<0) // 0000 0000 0000 0001
int gcd(int a, int b){ //最大公約数
    if(a%b == 0){
        return b;
    }else{
    return gcd(b, a%b);
    }
}

int main(){
    int n,m,x,temp,a;
    cin >> n >> m >> x;
    rep0(i,m){
        cin >> a;
        if(x<a){
            temp=i;
            break;
        }
    }
    int q=0,w=0;
    rep0(i,temp)
        q++;
    rep0(i,m-temp)
        w++;
    cout << min(q,w) << endl;
    return 0;
}

Measured memory_bytes: 3644
i = input()
s = i[-1]
t = int(s)

if t == 2 or t == 4 or t == 5 or t == 7 or t == 9 :
    print("hon")
elif t == 0 or t == 1 or t == 6 or t == 8  :
    print("pon")
else :
    print("bon")
    

Measured memory_bytes: 9168
#include<iostream>
#include<algorithm>
#include<functional>
#include<cmath>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<deque>
using namespace std;
#define ll long long
const int mod = 1000000007;
const int MOD = 998244353;
const ll INF = 1000000000000000000;


int main()
{
	int  N;
	cin >> N;
	cout << (N - 1) / 2 << endl;
}

Measured memory_bytes: 3576
#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; i++)
#define repr(i, n) for(int i=n-1; i>=0; i--)
#define repr1(i, n) for(int i=n; i>=1; i--)
#define all(v) v.begin(),v.end()
using ll = long long;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const int INF = 1e9;
const ll LLINF = 1e18;
const ll MOD = 1e9+7;
const double EPS = 1e-10;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main() {
    int n, k; cin >> n >> k;
    cout << (k == 1 ? 0 : n - k) << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define r(i,n) for(int i=0;i<n;i++)
#define int long long
main(){
  vector<pair<int,int> >v;
  int n,m;
  cin>>n>>m;
  while(n--){
    int a,b;
    cin>>a>>b;
    v.push_back(make_pair(a,b));
  }
  sort(v.begin(),v.end());
  int sum=0;
  for(int i=0;i<v.size();i++){
    if(sum+v[i].second>=m){
      cout<<v[i].fi<<endl;
      break;
    }
    sum+=v[i].second;
  }
}

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

int main(void) {
	int n;
	int i;
	int flag;
	char temp[8];

	while(1) {
		scanf("%d", &n);
		if(n == -1)
			break;

		if(n == 0) {
			puts("0");
			continue;
		}

		i = 0;
		while(n) {
			temp[i] = n % 4 + '0';
			n /= 4;
			i++;
		}

		for(; i > 0; i--) {
			putchar(temp[i - 1]);
		}

		putchar('\n');
	}

	return 0;
}

Measured memory_bytes: 588
#include <iostream>
#include <fstream>
#include <vector>
#include <cstring>
#include <algorithm> // sort
#include <unistd.h>
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
#define pii pair<int,int>
#define vl vector<ll>
#define vvl vector< vector<ll> >
#define REP(i, n) for (long long i = 0; i < (n); i++) 
#define all(c) c.begin(),c.end()
#define fio() cin.tie(0); ios::sync_with_stdio(false);

static const ll INF = 1000000000000000000LL;
static const ll MOD = 1000000007;

int main()
{
    int N,R;
    cin >> N >> R;
    int res;
    if(N >= 10)
    {
        res = R;
    }
    else
    {
        res = R + 100 * (10 - N);
    }

    cout << res << endl;

    return 0;
}

Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;

namespace Algorithm
{
    class Program
    {
        static void Main(string[] args)
        {
            var line = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int N = line[0], K = line[1];
            var array = Console.ReadLine().Split().Select(int.Parse).ToArray();

            var ans = 0;

            while (true)
            {
                if (N <= 0)
                {
                    Console.WriteLine(ans);
                    return;
                }
                if (ans == 0)
                {
                    ans++;
                    N -= K;
                }
                else
                {
                    ans++;
                    N -= (K - 1);
                }
            }
        }
    }
}

Measured memory_bytes: 20064
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  int min = 2*pow(10, 5);
  int ans = 0;
  for(int i=0; i<N; i++){
    int P;
    cin >> P;
    if(min >= P){
      ans += 1;
      min = P;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math
import sys

mod = 10**9+7
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000

s = str(input())
s = s.split(",")
print(" ".join(s))


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

int main () {
  ll x; cin >> x;
  ll a = x / 11, b = x % 11;
  if (b > 6) cout << a * 2 + 2 << endl;
  else if (b == 0) cout << (a - 1) * 2 + 2 << endl;
  else cout << a * 2 + 1 << endl;
}                                                

Measured memory_bytes: 3632
s = input()
q = int(input())

for qi in range(q):
    command= input().split()

    a = int(command[1])
    b = int(command[2])
    if command[0] == 'print':
        print(s[a:b + 1])
    elif command[0]  == 'reverse':
        s = s[:a] + s[a:b+1][::-1] + s[b+1:]

    else:
        p = command[3]
        s =s[:a]+p+s[b+1:]

Measured memory_bytes: 7676
n, a, b = map(int, input().split())
mod = 10 ** 9 + 7

#n種類の花を使って、花束を作る組み合わせは2^n-1通り
#pow(x,y,mod) : (x**y) % mod
ans = pow(2, n, mod)-1

#nCa
nCa = 1
#分子:n*(n-1)*...*(n-a+1)
for i in range(n-a+1, n+1):
    nCa *= i
    nCa %= mod
#分母:1/a! = 1/(1*2*...*a) = 1^(p-2)*2^(p-2)*,,,*a^(p-2)
for i in range(1, a+1):
    nCa *= pow(i, mod-2, mod)
    nCa %= mod
    
#nCb
nCb = 1
for i in range(n-b+1, n+1):
    nCb *= i
    nCb %= mod
for i in range(1, b+1):
    nCb *= pow(i, mod-2, mod)
    nCb %= mod

#2^n-1通りからnCaとnCbを引く
ans -= (nCa + nCb)
ans %= mod
print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<n; i++)
#define PI 3.14159265359
#define INF 1000100100//000000000
#define MOD 1000000007
#define all(x) (x).begin(),(x).end()
typedef long long ll;
#define P pair<int, int>
#define PP pair<P,P>
#define T tuple<int,int,int> //tuple<ll,ll,ll>
#define pr(x) cout << x << endl;
using namespace std;

int main(){
  int h,w,n; cin >> h >> w >> n;
  int sr,sc; cin >> sr >> sc;
  string s,t; cin >> s >> t;
  int l,r;
  l=1;
  r=h;
  for(int i=n-1; i>=0; i--){
    if(l>r){
      cout << "NO" << endl;
      return 0;
    }
    if(t[i]=='D') l=max(l-1,1);
    if(t[i]=='U') r=min(r+1,h);
    if(s[i]=='D') r--;
    if(s[i]=='U') l++;
  }
  if(l>sr || sr>r){
    cout << "NO" << endl;
    return 0;
  }

  l=1;
  r=w;
  for(int i=n-1; i>=0; i--){
    if(l>r){
      cout << "NO" << endl;
      return 0;
    }
    if(t[i]=='R') l=max(l-1,1);
    if(t[i]=='L') r=min(r+1,w);
    if(s[i]=='R') r--;
    if(s[i]=='L') l++;
  }
  if(l>sc || sc>r){
    cout << "NO" << endl;
    return 0;
  }
  cout << "YES" << endl;
return 0;
}


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

#define FASTIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define INF 1e+9;

int main()
{
  	FASTIO
  
    int n, k;
    cin >> n >> k;
    int h[n];
    for(int i=0; i<n; i++)
        cin >> h[i];
    if(n <= k+1)
        cout << abs(h[n-1] - h[0]) << "\n";
    else
    {
        int dp[n];
        for(int i=0; i<=k; i++)
        {
            dp[i] = abs(h[i] - h[0]);
        }
        for(int i=k+1; i<n; i++)
        {
            dp[i] = INF;
            for(int j=i-1; j >= i-k; j--)
                dp[i] = min(dp[i], abs(h[i] - h[j]) + dp[j]);
        }
        cout << dp[n-1] << "\n";
    }
    return 0;
}

Measured memory_bytes: 1024
import collections
import math
def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

N = int(input())
A = list(map(int, input().split()))
ans = 0
Union = [0]
for i in range(N):
    Union.append(Union[-1]+A[i])

num = collections.Counter(Union).values()
for i in num:
    if i >= 2:
        ans += combinations_count(i, 2)
print(ans)

Measured memory_bytes: 41692
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vb = vector<bool>;
using vc = vector<char>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using pii = pair<int, int>;
#define fix10 cout << fixed << setprecision(10);
#define rep(i,n) for(int i=0; i<(int)(n);i++)
#define MOD 1000000007

int main(){
  int n;
  cin >> n;
  vi d(n);
  rep(i,n) cin >> d.at(i);
  long ans = 0;
  for(int i=0;i<n-1;i++){
    for(int j=i+1;j<n;j++){
      ans += d.at(i)*d.at(j);
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
import sys
for line in sys.stdin.readlines():
  n = int(line.rstrip())
  count = 0
  for i in range(1001):
    if 0 <= n - i <= 1000:
      count += (n-i+1)*(i+1)
    elif 1001 <= n-i <= 2000 :
      count += (2000-(n-i)+1)*(i+1)
  for i in range(1001,2001):
    if 0 <= n - i <= 1000:
      count += (n-i+1)*(2000-i+1)
    elif 1001 <= n-i <= 2000:
      count += (2000-(n-i)+1)*(2000-i+1)
  print(count)

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

int main() {
    char c;
    cin >> c;
    if('A' <= c && c <= 'Z'){
        puts("A");
    } else {
        puts("a");
    }
}

Measured memory_bytes: 3632
/*Read the problem carefully before starting to work on it*/
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
//using namespace boost::multiprecision;
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
//using namespace __gnu_pbds;

typedef long long ll;

#define pb push_back
#define eb emplace_back
#define mp(x,y) make_pair(x,y)
#define mod 1000000007

double PI = 3.1415926535897932384626;

//template<typename T> T power(T x,T y,ll m=mod){T ans=1;while(y>0){if(y&1LL) ans=(ans*x)%m;y>>=1LL;x=(x*x)%m;}return ans%m;}

//typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> ost;

//mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
//#define rnd(x, y) uniform_int_distribution<ll>(x, y)(rng)

//struct custom_hash {
//    static uint64_t splitmix64(uint64_t x) {
//        // http://xorshift.di.unimi.it/splitmix64.c
//        x += 0x9e3779b97f4a7c15;
//        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
//        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
//        return x ^ (x >> 31);
//    }
//    size_t operator()(uint64_t x) const {
//        static const uint64_t FIXED_RANDOM =
//            chrono::steady_clock::now().time_since_epoch().count();
//        return splitmix64(x + FIXED_RANDOM);
//    }
//};

#define fi first
#define se second

bool cmp1(pair<ll, ll> &a, pair<ll, ll> &b)
{
	return (a.fi + a.se) < (b.fi + b.se);
}

bool cmp2(pair<ll, ll> &a, pair<ll, ll> &b)
{
	return (a.fi - a.se) < (b.fi - b.se);
}

int main()
{
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll n;
	cin >> n;
	vector< pair<ll, ll> >data(n);
	for (ll i = 0; i < n; i++)
	{
		cin >> data[i].fi >> data[i].se;
	}
	sort(data.begin(), data.end(), cmp1);
	ll one = abs(data[0].fi - data[n - 1].fi) + abs(data[0].se - data[n - 1].se);
	sort(data.begin(), data.end(), cmp2);
	ll two = abs(data[0].fi - data[n - 1].fi) + abs(data[0].se - data[n - 1].se);
	cout << max(one, two) << endl;
	return 0;
}


//252908XL

/*
comments:-

*/


Measured memory_bytes: 6360
#pragma GCC optimize("O3")
#pragma G++ optimize("O3")
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define mst(a, b) memset((a), (b), sizeof(a))
#define mp(a, b) make_pair(a, b)
#define pi acos(-1)
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pdd pair<double, double>
#define vi vector<int>
#define vl vector<ll>
#define pb push_back
#define lson l, mid, rt << 1
#define rson mid + 1, r, rt << 1 | 1
const ll INF = 0x3f3f3f3f3f3f3f;
const double eps = 1e-8;
const int maxn = 4e3 + 7;
const int maxm = 1e5 + 7;
const int mod = 192600817;
#define IO ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
int main()
{
    IO;
    ll x;
    cin>>x;
    ll num=100;
    int ans=0;
    while (num<x)
    {
        num+=num/100;
        ans++;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3612
# Mar 11, 12:14-
def inpl(): return list(map(int,input().split()))

H,W = inpl()
S = ''
for i in range(H):
    S += input()

N = H*W
parent = [-1]*N
white = [0]*N
black = [0]*N

def group(n):
    if parent[n] < 0:
        return n
    else:
        g = group(parent[n])
        parent[n] = g
        return g

def merge(m,n):
    gm = group(m)
    gn = group(n)
    if gm != gn:
        parent[gn] = gm
        white[gm] += white[gn]
        black[gm] += black[gn]
    return gm

def groupsize(n):
    g = group(n)
    return white[g]*black[g]

def place(n):
    return divmod(n,W)

def index(h,w):
    return h*W + w

for n in range(N):
    if S[n] == '.':
        white[n] = 1
    else:
        black[n] = 1

    h, w = place(n)
    if h > 0 and S[n] != S[n-W]:
        merge(n-W,n)
    if w > 0 and S[n] != S[n-1]:
        merge(n-1,n)    

groupset = set()
for n in range(N):
    groupset.add(group(n))

sizes = [ groupsize(p) for p in groupset ]
ans = sum(sizes)

print(ans)

Measured memory_bytes: 16104
#include<iostream>
#include<cstdio>
#include<string>
#include<vector>
#include<queue>
#include<cmath>
#include<algorithm>
#include<iomanip>
#include<functional>
#include<set>
#include<map>
#include<climits>
#include<numeric>
#include<utility>
#define ul unsigned long long int
#define ll long long int
#define MAX 1000000+1
using namespace std;
#define F first
#define S second
#define pi 2*acos(0.0)
#define PB push_back
#define CL clear()



int main()
{

    string s;
    cin >> s;
    sort(s.begin(), s.end());
    for(int i = 1; i < s.length(); i++)
        if(s[i]==s[i-1])
        {
            cout <<"no";
            return 0;
        }
    cout <<"yes";
    return 0;

}




Measured memory_bytes: 256
for _ in[0]*int(input()):
 X,z=input(),[]
 for y in input():
  s=i=0
  for k in z:
   t=X.find(y,s)+1
   if t<1:break
   if t<k:z[i]=t
   s=k;i+=1
  else:
   t=X.find(y,s)+1
   if t:z+=[t]
 print(len(z))


Measured memory_bytes: 5612
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define stoi stoll
using pii=pair<int,int>;
#define all(c) begin(c),end(c)
#define rall(c) rbegin(c),rend(c)
#define fore(x,c) for(auto &&x:c)
#define rep(i,a,n) for(int i=a,i##len=(int)(n);i<i##len;++i)
#define rrep(i,n) for(int i=(int)(n);i>=0;--i)
#define sz(c) ((int)c.size())
#define contains(c,x) (c.find(x)!=end(c))
#define inseg(l,x,r) ((l)<=(x)&&(x)<(r))
#define dump(...)
#define pb push_back
#define _ 0
const signed INF_=1001001001; const long long INF=1001001001001001001LL;
const int DX[9]={0,1,0,-1,1,1,-1,-1,0},DY[9]={-1,0,1,0,-1,1,1,-1,0};
template<class T> ostream& operator<<(ostream &os,const vector<T> &v) {
    for (auto i = begin(v); i != end(v); i++) os<<*i<<(i==end(v)-1?"":" ");return os;}
template<class T> istream& operator>>(istream &is,vector<T> &v) {
    for (auto i = begin(v); i != end(v); i++) is>>*i;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, class U> bool chmax(T &a,const U &b){return a<b?a=b,1:0;}
template<class T, class U> bool chmin(T &a,const U &b){return a>b?a=b,1:0;}
template <class T> void psum(T& c) {partial_sum(begin(c), end(c), begin(c));}
template<class T> using heap=priority_queue<T,vector<T>,greater<T>>;
struct before_main_function {
    before_main_function() {
        cin.tie(0); ios::sync_with_stdio(0);
        cout << setprecision(15) << fixed;
        // #define endl "\n"
    }
} before_main_function;
//------------------8<------------------------------------8<--------------------

signed main() {
    vector<int> a(5);
    cin >> a;
    int ans = INF;
    sort(all(a));
    do {
        int tmp = 0;
        rep(i, 0, 5) {
            tmp += a[i];
            if (i != 4) {
                tmp = (tmp + 9) / 10 * 10;
            }
        }
        chmin(ans, tmp);
    } while (next_permutation(all(a)));
    cout << ans << endl;
    return (0^_^0);
}



Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>

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

using namespace std;
int main(){
	char c;
	cin >> c;
	if (c == 'a' || c == 'i' || c == 'u' || c == 'e' || c == 'o')
		cout << "vowel" << endl;
	else
		cout << "consonant" << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int n;
  cin >> n;
  
  int c[10000000];
  memset(c,0,sizeof(c));
  ++c[n];
  
  int res = 1;
  while(true){
    ++res;
    if(n % 2 == 0){
      n /= 2;
    }else{
      n *= 3;
      ++n;
    }
    
    if(c[n] == 0){
      ++c[n];
    }else{
      break;
    }
  }
  
  cout << res <<endl;
}

Measured memory_bytes: 42708
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
const int INF=1e9,MOD=1e9+7,ohara=1e6+10;
const ll LINF=1e18;
using namespace std;
    
#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(int i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout<<(x)<<endl
#define doublecout(a) cout<<fixed<<setprecision(15)<<a<<endl;
#define Cerr(x) cerr<<(x)<<endl
#define fi first
#define se second
#define P pair<ll,ll> 
#define m_p make_pair
#define V vector<ll> 
#define U_MAP unordered_map<ll,ll>
#define pq priority_queue<ll>
#define rpq priority_queue<ll,vector<ll>,greater<ll>>
#define p_b push_back
    
ll n,cnt,ans,a,b,c,d,tmp,tmpp,m,h,w,x,y,sum,pos,k;
ld doua;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
//int dy[]={-1,0,1,-1,1,-1,0,1};
//int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"),s;
bool fl;
    
//-------------------------↓↓↓↓↓↓------------------------
    
//------ 自分を天才だと信じる ------

template< typename T >
struct edge {
  int src, to;
  T cost;
 
  edge(int to, T cost) : src(-1), to(to), cost(cost) {}
 
  edge(int src, int to, T cost) : src(src), to(to), cost(cost) {}
 
  edge &operator=(const int &x) {
    to = x;
    return *this;
  }
 
  operator int() const { return to; }
};

template< typename T >
using Edges = vector< edge< T > >;
template< typename T >
using WeightedGraph = vector< Edges< T > >;

template< typename T >
pair< T, int > dfs(const WeightedGraph< T > &g, int idx, int par) {
  pair< T, int > ret(0, idx);
  for(auto &e : g[idx]) {
    if(e.to == par) continue;
    auto cost = dfs(g, e.to, idx);
    cost.first += e.cost;
    ret = max(ret, cost);
  }
  return ret;
}
 
template< typename T >
T tree_diameter(const WeightedGraph< T > &g) {
  auto p = dfs(g, 0, -1);
  auto q = dfs(g, p.second, -1);
  return (q.first);
}
    
int main(void){
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    
    cin>>n;
    WeightedGraph<ll> g(n);
    rep(i,n-1){
        cin>>a>>b;
        a--;b--;
        g[a].emplace_back(b,1LL);
        g[b].emplace_back(a,1LL);
    }
    ans=tree_diameter(g);
    if(ans%3==1)Cout("Second");
    else Cout("First");
    return 0;
}

Measured memory_bytes: 29952
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define P pair<int,int>
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1000000000
//#define MOD 1000000007
#define MOD 998244353
#define all(v) v.begin(),v.end()
#define pb push_back
int dx[]={0,1,0,-1},dy[]={1,0,-1,0};
int kaijo[200010];
struct edge{int to,cost;};
int gcd(int a,int b){
	if(b==0)return a;
	return gcd(b,a%b);
}
int lcm(int a,int b){
	return a/gcd(a,b)*b;
}
bool prime(int a){
	if(a==1)return false;
	for(int i=2;i*i<=a;i++){
		if(a%i==0)return false;
	}
	return true;
}
bool kosa(double ax,double ay,double bx,double by,double cx,double cy,double dx,double dy){//線分の交差判定
	double ta=(cx-dx)*(ay-cy)+(cy-dy)*(cx-ax);
	double tb=(cx-dx)*(by-cy)+(cy-dy)*(cx-bx);
	double tc=(ax-bx)*(cy-ay)+(ay-by)*(ax-cx);
	double td=(ax-bx)*(dy-ay)+(ay-by)*(ax-dx);
	return tc*td<0&&ta*tb<0;
}
void init_fact(int n){
	kaijo[0]=1;
	for(int i=1;i<=n;i++){
		kaijo[i]=kaijo[i-1]*i;
		kaijo[i]%=MOD;
	}
}
int modpow(int a,int b){
	if(b==0)return 1;
	if(b%2)return modpow(a,b-1)*a%MOD;
	int memo=modpow(a,b/2);
	return memo*memo%MOD;
}
int comb(int a,int b){
	if(b>a)return 0;
	if(a==b)return 1;
	return kaijo[a]*modpow(kaijo[a-b],MOD-2)%MOD*modpow(kaijo[b],MOD-2)%MOD;
}
int g(int x){
	x=modpow(x,MOD-2);
	return x;
}
int n;
string s;
signed main(){
	cin>>n>>s;
	if(n>=3200)cout<<s<<endl;
	else cout<<"red"<<endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,N) for(int i=0;i<(N);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int inf = 1e9;
const int mod = 1e9+7;
typedef long long ll;
typedef pair<ll,int> P;
typedef set<int> S;
int main(){
    cout << fixed << setprecision(10);
    int n;
    cin >> n;
    vector<ll> a(n),m(n,0);
    rep(i,n) cin >> a[i];
    rep(i,n) {
        if(i%2==0) m[0] +=a[i];
        else m[0]-=a[i];
    }
    rep(i,n-1){
        m[i+1] = 2*a[i] - m[i];
    }
    rep(i,n) cout << m[i] << endl;
    return 0;
}

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

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

    vector<int> a(n);
    int sum = 0;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        sum += a[i];
    }

    int ans = 0;
    for (int i = 0; i < n; i++) {
        if (abs(n * a[i] - sum) < abs(n * a[ans] - sum)) {
            ans = i;
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>

#include <stack>

using namespace std;

int main(){
	stack<int> st;
	int n, a;

	while(cin >> n){
		if(n!=0){
			st.push( n );
		}else{
			a = st.top();
			cout << a << endl;
			st.pop();
		}
	}
}

Measured memory_bytes: 1200
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#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++)
#define all(v) v.begin(), v.end()
#define sz(v) v.size()
#define INF 10000000099
// aよりもbが大きいならばaをbで更新する
// (更新されたならばtrueを返す)
template <typename T>
bool chmax(T &a, const T& b) {
  if (a < b) {
    a = b;  // aをbで更新
    return true;
  }
  return false;
}
// aよりもbが小さいならばaをbで更新する
// (更新されたならばtrueを返す)
template <typename T>
bool chmin(T &a, const T& b) {
  if (a > b) {
    a = b;  // aをbで更新
    return true;
  }
  return false;
}

int main(){
  ll N, M;
  cin >> N >> M;
  vector<ll> A(N);
  ll sum = 0;
  rep(i, N){
    cin >> A.at(i);
    sum += A.at(i);
  }
  ll pop = 0;
  rep(i, N){
    if(4 * M * A.at(i) >= sum){
      pop++;
    }
  }
  if(pop >= M){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
l, r = list(map(int, input().strip().split()))

if r - l >= 2019:
    print(0)
else:
    min_prod = 1e9
    for i in range(l, r):
        for j in range(i + 1, r + 1):
            min_prod = min(min_prod, (i * j) % 2019)
    print(min_prod)


Measured memory_bytes: 2940