akhauriyash/Code-Regression huggingface dataset:
from heapq import heappop,heappush
N,K=map(int,input().split())
table=[]
for i in range(N):
    t,d=map(int,input().split())
    t=t-1
    table.append((d,t))
table=sorted(table,reverse=True)
L=[0]*N
H=set()
W=[]
ans=-1
num=0
for i in range(K):
    d,t=table[i]
    L[t]+=1
    H.add(t)
    num+=d
    if L[t]>=2:
        heappush(W,(d,t))
ans=len(H)**2+num
for i in range(K,N):
    d,t=table[i]
    L[t]+=1
    if L[t]>=2:
        continue
    if len(W)==0:
        continue
    d1,t1=heappop(W)
    H.add(t)
    num=num-d1+d
    ans=max(ans,len(H)**2+num)
print(ans)

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

int main() {
	int N;
	cin >> N;
	vector<int> v(N);
	for (int i = 0; i < N; i++) {
		cin >> v[i];
	}
	sort(v.begin(), v.end(), greater<int>());
	int d = 0, sgn = 1;
	for (int i = 0; i < N; i++) {
		d += sgn * v[i];
		sgn = -sgn;
	}
	cout << d << endl;

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define pb push_back
#define ff first
#define ss second
#define mp map<int,int>
#define pp make_pair
#define endl "\n"
#define vi vector<int>
#define vbl vector<bool>
#define ll long long 
#define clock high_resolution_clock::now()

// auto duration = duration_cast<microseconds>(stop - start);  cout<<duration.count();

const int INF = 1e9+5;
const int mod = 1e9 + 7;

using namespace std;
using namespace std::chrono;

int main(){
     string s;
     cin>>s;
     int len = s.length();
     if(s[0]==s[len-1]){
          if(len%2!=0)cout<<"Second"<<endl;
          else cout<<"First"<<endl;
     }
     else{
          if(len%2!=0)cout<<"First"<<endl;
          else cout<<"Second"<<endl;
     }

	return 0;
}
	
	

Measured memory_bytes: 3752
import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush
from math import *
from collections import defaultdict as dd, deque, Counter as C
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect
from time import perf_counter
from fractions import Fraction
# sys.setrecursionlimit(int(pow(10, 2)))
# sys.stdin = open("input.txt", "r")
# sys.stdout = open("output.txt", "w")
mod = int(pow(10, 9) + 7)
mod2 = 998244353
def data(): return sys.stdin.readline().strip()
def out(*var, end="\n"): sys.stdout.write(' '.join(map(str, var))+end)
def l(): return list(sp())
def sl(): return list(ssp())
def sp(): return map(int, data().split())
def ssp(): return map(str, data().split())
def l1d(n, val=0): return [val for i in range(n)]
def l2d(n, m, val=0): return [l1d(n, val) for j in range(m)]





# @lru_cache(None)



n,k=l()
A=l()
y=min(A)
x=A.index(y)
ans=(n-2)//(k-1)+1
print(ans)






Measured memory_bytes: 15924
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <set>
#define rep(i, n) for(int i = 0; i < n; i++)
#define REP(i, m, n) for(int i = m; i < n; i++)
typedef long long ll;
using namespace std;

int main() {
    int n,num=1; cin >> n;
    set<int> v;
    v.insert(n);
    bool a = true;
    while(a){
        int s=v.size();
        if(n%2==0){
            n = n/2;
            if(v.count(n)==1){
                cout << num+1 << endl;
                a = false;
            }else{
                v.insert(n);
                }
        }else{
            n = 3*n+1;
            if(v.count(n)==1){
                cout << num+1 << endl;
                a = false;
            }else{
                v.insert(n);
            }
        }
        num += 1;
    }
}  

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define INF 1000000005
#define MOD 1000000007
#define EPS 1e-10
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define each(a, b) for(auto (a): (b))
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define pb push_back
#define show(x) cout <<#x<<" = "<<(x)<<endl
#define spair(p) cout <<#p<<": "<<p.fi<<" "<<p.se<<endl
#define svec(v) cout<<#v<<":";rep(i,v.size())cout<<" "<<v[i];cout<<endl
#define sset(s) cout<<#s<<":";each(i,s)cout <<" "<<i;cout<<endl

using namespace std;

typedef pair<int,int>P;

const int MAX_N = 100005;

int par[MAX_N];
int nrank[MAX_N];
int weight[MAX_N];

void initial(int n){		//?????????
	for(int i=0;i<n;i++){
		par[i] = i;
		nrank[i] = 0;
        weight[i] = 0;
	}
}

P find(int x){		//??¨??????????±???????
	if(par[x] == x){
		return P(x,0);
	}else{
		P p = find(par[x]);
		par[x] = p.fi;
		weight[x] = p.se + weight[x];
		return P(par[x],weight[x]);
	}
}

void unite(int x,int y,int w){
	int bx = x;
	int by = y;
	x = (find(x)).fi;
	y = (find(y)).fi;
	if(x == y) return;
	if(nrank[x] < nrank[y]){
		par[x] = y;
		weight[x] = -weight[bx] - w + weight[by];
	}else{
		par[y] = x;
        weight[y] = weight[bx] + w - weight[by];
		if(nrank[x] == nrank[y])
			nrank[x]++;
	}
}

bool same(int x,int y){
	return (find(x)).fi == (find(y)).fi;
}

int main()
{
    while(1){
        int n,m;
        cin >> n >> m;
        if(n == 0){
            break;
        }
        initial(n+1);
        rep(i,m){
            int a,b,w;
            char hoge,c;
            scanf("%c%c",&hoge,&c);
            if(c == '!'){
                scanf("%d%d%d",&a,&b,&w);
                unite(a,b,w);
            }else{
                scanf("%d%d",&a,&b);
                if(same(a,b)){
                    cout << weight[b]-weight[a] << "\n";
                }else{
                    cout << "UNKNOWN\n";
                }
            }
        }
    }
    return 0;
}

Measured memory_bytes: 4316
H, W = map(int, input().split())
a = [list(input()) for _ in range(H)]

b = [list(x) for x in zip(*a)]

n = []
for i in range(W):
  if b[i] == ["."] * H: 
    n.append(i)

for A in a:
  if A == ["."] * W: continue
  if len(n) == 0: 
    print("".join(A))
    continue
  ans = ""
  for i in range(W):
    if i in n: continue
    ans += A[i]
  print("".join(ans))

Measured memory_bytes: 3188
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define VV vector
#define pb push_back
#define bitc  __builtin_popcountl
#define m_p make_pair
long long power(long long x, long long y)
{
    if (y == 0)
        return 1;
    else if (y%2 == 0)
        return power(x, y/2)*power(x, y/2);
    else
        return x*power(x, y/2)*power(x, y/2);
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n,g;
    cin>>n>>g;
    ll a[n][2];
    for(int i=0;i<n;++i)
        cin>>a[i][0]>>a[i][1];
    ll ans=10000000000;
    for(int i=0;i<power(2,n);++i)
    {
        ll c=0,sc=0,r=i,b[n];
        for(int j=0;j<n;++j)
        {
            if(r%2)
            {
                sc+=a[j][0]*(j+1)*100+a[j][1];
                c+=a[j][0];
            }
            b[j]=r%2;
            r/=2;
        }
        if(sc<g)
        {
            for(int j=n-1;j>=0;--j)
            {
                if(b[j]==0)
                {
                    int z=0;
                    if(sc>=g)
                        break;
                    for(;z<a[j][0];++z)
                    {
                        ++c;
                        sc+=100*(j+1);
                        if(sc>=g)
                            break;
                    }
                }
            }
        }
        if(ans>c)
            ans=c;
    }
    cout<<ans;
} 

Measured memory_bytes: 256
def examD(mod):
    class combination():
        def __init__(self, n, mod):
            self.n = n
            self.fac = [1] * (n + 1)
            self.inv = [1] * (n + 1)
            for j in range(1, n + 1):
                self.fac[j] = self.fac[j - 1] * j % mod

            self.inv[n] = pow(self.fac[n], mod - 2, mod)
            for j in range(n - 1, -1, -1):
                self.inv[j] = self.inv[j + 1] * (j + 1) % mod

        def comb(self, n, r, mod):
            if r > n or n < 0 or r < 0:
                return 0
            return self.fac[n] * self.inv[n - r] * self.inv[r] % mod

    H, W, A, B =LI()
    N = H + W
    C = combination(N,mod)
    ans = C.comb(W+H-B-2, H-1,mod)
    pre = 1
    for i in range(1, H-A):
        ans += (C.comb(B+i,i,mod)-pre)*C.comb(W+H-B-2-i, H-1-i,mod)%mod
        ans %= mod
        pre = C.comb(B+i, i,mod)
    print(ans)

import sys
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')

examD(mod)

Measured memory_bytes: 44524
package main

import (
	"fmt"
	"strings"
)

func getRuneAt(s string, i int) rune {
	rs := []rune(s)
	return rs[i]
}

func main() {
	var N, K int
	var S, s string
	fmt.Scan(&N, &K)
	fmt.Scan(&S)

	res := ""
	s = string(getRuneAt(S, K-1)) //for idx
	sd := strings.ToLower(s)

	/*
		s = string(getRuneAt(S, K-1)) //for idx
		sd := strings.ToLower(s)
		_ = strings.Join(res, string([]rune{c}))
	*/

	for idx, c := range S {
		if idx+1 == K {
			res += sd
		} else {
			res += string([]rune{c})
		}
	}

	fmt.Println(res)
}


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

#define NREP() for(ll i = 0; i < n; i++)
#define REP(i, n) for(ll i = 0; i < n; i++)
#define ALL(x) (x).begin(),(x).end()
#define MSG(x) cout << x << endl;
#define YN(x) x ? cout << "YES" << endl : cout << "NO" << endl;
#define Yn(x) x ? cout << "Yes" << endl : cout << "No" << endl;
#define yn(x) x ? cout << "yes" << endl : cout << "no" << endl;

using namespace std;
using ll = long long;
const static ll MOD = 1e9 + 7;

int main() {
    ll w, h, n;
    cin >> w >> h >> n;

    bool p_d[w + 10][h + 10];

    REP(i, w + 10) {
        REP(j, h + 10) {
            p_d[i][j] = false;
        }
    }

    NREP() {
        ll x, y, a;
        cin >> x >> y >> a;

        switch (a) {
            case 1:
                REP(i, x) {
                    REP(j, h) {
                        p_d[i][j] = true;
                    }
                }
                break;
            case 2:
                for (int i = x; i < w; ++i) {
                    REP(j, h) {
                        p_d[i][j] = true;
                    }
                }
                break;

            case 3:
                REP(i, w) {
                    REP(j, y) {
                        p_d[i][j] = true;
                    }
                }
                break;

            case 4:
                REP(i, w) {
                    for (int j = y; j < h; ++j) {
                        p_d[i][j] = true;
                    }
                }
                break;
        }

    }


    ll ans = 0;
    REP(i, w) {
        REP(j, h) {
            if(!p_d[i][j]) ans++;
        }
    }

    MSG(ans)

    return 0;
}


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

int main(){

int k,s,z,counter=0;
cin>>k>>s;

for(int x=0;x<=k;x++){
	for(int y=0;y<=k;y++){
		z=s-(x+y);
		if(z>=0&&z<=k&&(x+y+z)==s)
		counter++;
	}
}
cout<<counter;

return 0;
} 

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace template
{
    class Program
    {
        static void Main(string[] args)
        {
            string imp = Console.ReadLine();//読み込んだ文字列を空白で区切る
            string first = Convert.ToString(imp[0]);//区切ったやつの1番目を代入
            string second = Convert.ToString(imp[1]);
            string third = Convert.ToString(imp[2]);

            int counta = 0;
            int countb = 0;
            int countc = 0;


            if (((first == "a")||(second == "a"))||(third == "a")) {
                counta++;
            }

            if (((first == "b") || (second == "b")) || (third == "b"))
            {
                countb++;
            }

            if (((first == "c") || (second == "c")) || (third == "c"))
            {
                countc++;
            }

            if (((counta == 1) && (countb == 1)) && (countc == 1))
            {
                Console.WriteLine("Yes");
            }



            else {
                Console.WriteLine("No");
            }
            
            
        }
    }
}

Measured memory_bytes: 11220
char buf[5];
char out[2<<17];
sz;outsz;
N;
char fs[]="1 2 1 3 1 2 1 4 1 2 1 3 1 2 1 5 1 2 1 3 1 2 1 4 1 2 1 3 1 2 1 6 1 2 1 3 1 2 1 4 1 2 1 3 1 2 1 5 1 2 1 3 1 2 1 4 1 2 1 3 1 2 1 7 1 2 1 3 1 2 1 4 1 2 1 3 1 2 1 5 1 2 1 3 1 2 1 4 1 2 1 3 1 2 1 6 1 2 1 3 1 2 1 4 1 2 1 3 1 2 1 5 1 2 1 3 1 2 1 4 1 2 1 3 1 2 1 8 1 2 1 3 1 2 1 4 1 2 1 3 1 2 1 5 1 2 1 3 1 2 1 4 1 2 1 3 1 2 1 6 1 2 1 3 1 2 1 4 1 2 1 3 1 2 1 5 1 2 1 3 1 2 1 4 1 2 1 3 1 2 1 7 1 2 1 3 1 2 1 4 1 2 1 3 1 2 1 5 1 2 1 3 1 2 1 4 1 2 1 3 1 2 1 6 1 2 1 3 1 2 1 4 1 2 1 3 1 2 1 5 1 2 1 3 1 2 1 4 1 2 1 3 1 2 1 9 1 2 1 3 1 2 1 4 1 2 1 3 1 2 1 5 1 2 1 3 1 2 1 4 1 2 1 3 1 2 1 6 1 2 1 3 1 2 1 4 1 2 1 3 1 2 1 5 1 2 1 3 1 2 1 4 1 2 1 3 1 2 1 7 1 2 1 3 1 2 1 4 1 2 1 3 1 2 1 5 1 2 1 3 1 2 1 4 1 2 1 3 1 2 1 6 1 2 1 3 1 2 1 4 1 2 1 3 1 2 1 5 1 2 1 3 1 2 1 4 1 2 1 3 1 2 1 8 1 2 1 3 1 2 1 4 1 2 1 3 1 2 1 5 1 2 1 3 1 2 1 4 1 2 1 3 1 2 1 6 1 2 1 3 1 2 1 4 1 2 1 3 1 2 1 5 1 2 1 3 1 2 1 4 1 2 1 3 1 2 1 7 1 2 1 3 1 2 1 4 1 2 1 3 1 2 1 5 1 2 1 3 1 2 1 4 1 2 1 3 1 2 1 6 1 2 1 3 1 2 1 4 1 2 1 3 1 2 1 5 1 2 1 ";
main(){
	read(0,buf,5);
	for(;;)
	{
		char k=buf[sz++];
		if(k<'0')break;
		N=N*10+k-'0';
	}
	for(;--N;)
	{
		memcpy(out+outsz,fs,2*N);
		outsz+=2*N;
	}
	write(1,out,outsz);
}


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


int main()
{
  int n;
  cin >> n;
  std::vector<int> a(n+1);
  std::vector<int> b(n);
  for(int i=0; i<=n; i++) cin >> a[i];
  for(int i=0; i<n; i++) cin >> b[i];
  ll beat=0;
  for(int i=0; i<n; i++)
  {
    int tmp = min(a[i],b[i]);
    a[i] -= tmp;
    b[i] -= tmp;
    beat += tmp;
    tmp = min(a[i+1],b[i]);
    a[i+1] -= tmp;
    beat += tmp;
  }
  cout << beat << endl;
  return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <string>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int mod = 1000000007;

int main() {
    ios::sync_with_stdio(false);
    int a, b, x;
    cin >> a >> b >> x;
    if (x >= a && x <= a + b) cout << "YES";
    else cout << "NO";
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i++)
#define repe(i,n) for (int i = 0; i <= (n); ++i)
#define repe1(i,n) for (int i = 0; i <= (n); ++i)
#define all(x) (x).begin(),(x).end()
#define pb(x) push_back(x)
using namespace std;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
typedef long long ll;
const int INF = 1e9;
const ll mod = 1000000007;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a * b / gcd(a, b);}

ll pow_kai(ll a, ll n) {
    ll x = 1;
    while(n > 0) {
        if(n&1) {
            x = x*a;
        }
        a = a*a;
        n >>= 1;
    }
    return x;
}

int main() {
    int a,b;
    cin >> a >> b;
    int cnt = 0;
    for(int i=a; i<=b; i++) {
        string num = to_string(i);
        reverse(all(num));
        int numm = stoi(num);
        if (i==numm) cnt++;
    }
    cout << cnt << "\n";

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  char b;
  cin >> b;
  if (b == 'A') {
    cout << "T" << endl;
  } else if (b == 'C') {
    cout << "G" << endl;
  } else if (b == 'G') {
    cout << "C" << endl;
  } else {
    cout << "A" << endl;
  }
  return 0;
}


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

int main(int argc, char *argv[])
{
  char x,y;
  map<char,int> Map;
  Map['A'] = 1;
  while(scanf("%c,%c",&x,&y) !=EOF){
    swap(Map[x],Map[y]);
  }
  for(char i ='A';i<='C';i++){
    if(Map[i] ==1)
      cout <<i<<endl;
    }
  return 0;
}

Measured memory_bytes: 1188
n = int(input())
a=[]


for i in range(n):
    s,p=map(int,input().split())
    a+=[[s, p] ]
    

import operator as op
a.sort(key = op.itemgetter(1))


time=0
yyes=True
for i  in range(n):
    time+=a[i][0]
    if(time>a[i][1]):
        yyes=False
        break
    
if yyes:
    print("Yes")
else:
        print("No")


Measured memory_bytes: 38160
#include<bits/stdc++.h>
using namespace std;
int main() {
	int N;
	cin >> N;
	int a[N+10];
	for (int i = 1; i <= N; i++) {
		cin >> a[i];
	}
	int cnt = 0;
	int x = 1;
	while (x != 2) {
		x = a[x];
		cnt++;
		if (cnt > 1000000) {
			cnt = -1;
			break;
		}
	}
	cout << cnt << endl;
}



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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
const ull mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

template<class S, class T> ostream& operator << (ostream& os, const pair<S, T> v){
  os << "(" << v.first << ", " << v.second << ")"; return os;
}
template<class T> ostream& operator << (ostream& os, const vector<T> v){
  for(int i = 0; i < v.size(); i++){if(i > 0){os << " ";} os << v[i];} return os;
}
template<class T> ostream& operator << (ostream& os, const vector<vector<T>> v){
  for(int i = 0; i < v.size(); i++){if(i > 0){os << endl;} os << v[i];} return os;
}

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

    ll H, W;
    cin >> H >> W;
    bool lamp[H][W];
    REP(i, H){
    	string S;
    	cin >> S;
    	REP(j ,W){
    		if(S[j] == '#') lamp[i][j] = 1;
    		else lamp[i][j] = 0;
    	}
    }

    ll yoko[H][W];
    ll tate[H][W];
    REP(i, H){
    	ll tmp = 0;
    	REP(j, W){
    		if(lamp[i][j]){
    			yoko[i][j] = 0;
     			tmp = 0;
    		}else{
    			tmp++;
    			yoko[i][j] = tmp;
    		}
    	}
    }
    REP(i, H){
    	REP(j, W-1){
    		ll ind = W-1-j;
    		if(!lamp[i][ind] && !lamp[i][ind-1]){
    			yoko[i][ind-1] = yoko[i][ind];
    		}
    	}
    }

    //
    REP(j, W){
    	ll tmp = 0;
    	REP(i, H){
    		if(lamp[i][j]){
    			tate[i][j] = 0;
     			tmp = 0;
    		}else{
    			tmp++;
    			tate[i][j] = tmp;
    		}
    	}
    }
    REP(j, W){
    	REP(i, H-1){
    		ll ind = H-1-i;
    		if(!lamp[ind][j] && !lamp[ind-1][j]){
    			tate[ind-1][j] = tate[ind][j];
    		}
    	}
    }

    ll res = 0;
    REP(i, H){
    	REP(j, W){
    		res = max(res, yoko[i][j] + tate[i][j] - 1);
    	}
    }
    cout << res << endl;

    /*
    REP(i, H){
    	REP(j, W){
    		cout << yoko[i][j] << " ";
    	}
    	cout << endl;
    }
    cout << endl;
    REP(i, H){
    	REP(j, W){
    		cout << tate[i][j] << " ";
    	}
    	cout << endl;
    }
    */
    return 0;
}

Measured memory_bytes: 66688
//what the fuck was this question
#include <bits/stdc++.h> 
using namespace std;
typedef unsigned long long int ll;
#define f(i,a,b) for(ll i = a; i < b; i++)

int main() {
    
       long double a,b;
        cin>>a>>b;
        a*=b;;
        ll c=(ll)a;
        cout<<c<<endl;
	return 0;
 
}

Measured memory_bytes: 3732
package main

import (
	"bufio"
	"os"
	"strconv"
	"fmt"
)

var sc = bufio.NewScanner(os.Stdin)

func init() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024*1024), bufio.MaxScanTokenSize)
}

//func nextString() string {
//	sc.Scan()
//	return sc.Text()
//}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func nextUint64() uint64 {
	sc.Scan()
	i, e := strconv.ParseUint(sc.Text(), 10, 64)
	if e != nil {
		panic(e)
	}
	return i
}

func main() {
	n := nextInt()
	l := make([]uint64, n, n)

	for i := 0; i < n; i++ {
		l[i] = nextUint64()
	}

	count := 0

	for i := 0; i < n; i++ {
		for j := i + 1; j < n; j++ {
			for k := j + 1; k < n; k++ {
				if l[i] + l[j] > l[k] &&
					l[j] + l[k] > l[i] &&
					l[k] + l[i] > l[j] &&
					l[i] != l[j] &&
					l[j] != l[k] &&
					l[k] != l[i] {
					count++
				}
			}
		}
	}

	fmt.Println(count)
}


Measured memory_bytes: 1812
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  string s;
  int w;
  cin >> s >> w;
  for (int i = 0; i < (int)s.size(); i += w) {
    cout << s[i];
  }
  cout << endl;

  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
using namespace std;
typedef pair<int, int> P;
typedef long long ll;
const int MOD = 1000000007;

int main(){
  int a;
  cin >> a;
  cout << 3*a*a;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int n, k;
int arr[100005];	
int dis[100005];
int main(){
	cin >> n >> k;
	for(int i = 0; i < n; i++)cin >> arr[i];
	for(int i = 0; i < 100005; i++)dis[i] = 1000000005;
	priority_queue<pair<int,int> > pq;
	dis[0] = 0;
	pq.push(make_pair(0,0));
	while(!pq.empty()){
		int d = -pq.top().first;
		int x = pq.top().second;
		pq.pop();
		for(int i = 1; i <= k; i++){
			if(x + i >= n) break;
			if(d + abs(arr[x] - arr[x+i]) < dis[x+i]){
				dis[x+i] = d + abs(arr[x] - arr[x+i]);
				pq.push(make_pair(-dis[x+i], x+i));
			}
		}
		
	}
	cout << dis[n-1];
}

Measured memory_bytes: 2168
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int X = sc.nextInt();
		List<Integer> L = new ArrayList<Integer>();
		int zahyo = 0;
		int answer = 0;

		for (int i = 1; i <= N; i++) {
			L.add(sc.nextInt());
		}

		for (int takasa : L) {
			zahyo += takasa;
			if (X < zahyo) break;
			answer++;
		}

		System.out.println(answer + 1);
	}
}


Measured memory_bytes: 21716
// https://beta.atcoder.jp/contests/abc089

#include <iostream>
#include <algorithm>
using namespace std;

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

    string s;
    cin >> s;
    sort(s.begin(), s.end());
    if (s[0] == 'a' && s[1] == 'b' && s[2] == 'c')
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }

    return 0;
}


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

int main(){
	int w, h, x, y, r;
	cin >> w;
	cin >> h;
	cin >> x;
	cin >> y;
	cin >> r;
	if (r <= x && x <= w - r && r <= y && y <= h - r){
		cout << "Yes" << endl;
	}
	else{
		cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 3100
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) FOR(i,0,n)
#define repr(i,n) for(int i=(n)-1;0<=i;--i)
#define each(e,v) for(auto&& e:(v))
#define all(v) begin(v),end(v)
#define dump(x) cerr<<#x<<": "<<(x)<<endl
#define INF 100000000
#define IINF 9999999999999;
using vint = std::vector<int>;
using ll = long long;
using vll = std::vector<ll>;
template <class T> void chmin(T& a, const T& b) { a = std::min(a, b); }
template <class T> void chmax(T& a, const T& b) { a = std::max(a, b); }
#define output(x) cout << x << endl;

int main() {
    int N, M;
    cin >> N >> M;
    map<int, int> m;

    vector<long long int> A(N);

    for (int i = 0; i < A.size(); ++i) {
        cin >> A[i];
    }
    vector<long long int> sum(N + 1);
    sum[0] = 0;
    for (int i = 0; i <  N; ++i) {
        sum[i + 1] = (sum[i] + A[i]) % M;
    }

    long long int ans = 0;

    for (int i = 0; i < sum.size(); ++i) {
        ans += m[sum[i]];
        ++m[sum[i]];
    }

    cout << ans << endl;
}

Measured memory_bytes: 4736
n, k, q = map(int, input().split())
ans_times = [0 for _ in range(n)]
for i in range(q):
    ans_times[int(input())-1] += 1

for i in ans_times:
    if k - (q - i) > 0:
        print("Yes")
    else:
        print("No")

Measured memory_bytes: 4672
#include<iostream>
#include<bits/stdc++.h>
#define LL long long int
using namespace std;
int main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	string s;
	cin>>s;
	if(s[s.length()-1]=='s')
	{
		cout<<s<<"es";
	}
	else
	{
		cout<<s<<"s";
	}
}


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

#define ll long long

using namespace std;
const int N = 2e5 + 5;
ll s[N], x[N];
ll get(int i, int j, ll a[], bool f) {
	if (!i)
		return a[j];
	if (f)
		return a[j] - a[i - 1];
	return a[j] ^ a[i - 1];
}
int main() {

	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> s[i];
		x[i] = s[i];
		if (i)
			s[i] += s[i - 1], x[i] ^= x[i - 1];
	}
	ll ans = 0;
	for (int i = 0; i < n; i++) {
		int st = i, e = n - 1, ind = i;
		while (st <= e) {
			int mid = (st + e) >> 1;
			if (get(i, mid, s, 1) == get(i, mid, x, 0))
				st = mid + 1, ind = mid;
			else
				e = mid - 1;
		}
		ans += ind + 1 - i;
	}
	cout << ans << endl;

	return 0;
}



Measured memory_bytes: 3328
#A問題
D = int(input())
cs = list(map(int, input().split()))
ss = [input().split() for l in range(D)]

l=[]
for d in range(D):
    s=ss[d]
    max_value = max(s)
    max_index = s.index(max_value)
    l.append(max_index+1)
    
for i in range(D):
     print(l[i])

Measured memory_bytes: 9548
#include <bits/stdc++.h>
#define int long long

using namespace std;

int const maxn = 1e6 + 1;
int dp[3002][3002];
string a,b,ans = "";

int32_t main()
{
    cin >> a >> b;
    memset(dp,0,sizeof(dp));

    int n = a.size() , m = b.size();

    for(int i = 1 ; i <= n ; i++)
    {
        for(int j = 1 ; j <= m ; j++)
        {
            if(a[i-1] == b[j-1])
            dp[i][j] = dp[i-1][j-1] + 1;
            else
            dp[i][j] = max(dp[i-1][j] , dp[i][j-1]);
        }
    }

    int i = a.size() , j = b.size();

    while(i > 0 && j > 0)
    {
        if(a[i - 1] == b[j - 1])
        {
            ans += a[i-1];
            i--,j--;
        }
        else
        {
            if(dp[i-1][j] > dp[i][j-1])
            {
                i--;
            }
            else
            j--;
        }
    }

    reverse(ans.begin(),ans.end());
    cout << ans;
    return 0;
}


Measured memory_bytes: 70656
//om namah shivaay
//faith over fear
//no one wants to die,yet death is the destination we all share 

#include<bits/stdc++.h>
using namespace std;
 
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define ll long long 
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i,n) for(i=0;i<n;i++)
#define forn(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define for1(i, n) for (ll i = 1; i <= (ll)(n); ++i)
#define ford(i, n) for (ll i = (ll)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (ll i = (ll)(a); i <= (ll)(b); ++i)
#define fora(it,x) for(auto it:x)
#define PI 3.14159265
#define sync ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define endl "\n"
 
typedef pair<ll, ll> pii;
typedef vector<ll> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long i64;
typedef vector<i64> vi64;
typedef vector<vi64> vvi64;
typedef pair<i64, i64> pi64;
typedef long double ld;
 
template<class T> bool uin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool uax(T &a, T b) { return a < b ? (a = b, true) : false; }

ll p[13];
int main(){
    p[0]=1;
    for1(i,12) p[i]=p[i-1]*26;
    ll n;
    cin>>n;
    ll len=1,l=p[1];
    for1(i,12){
        if(n<=l) break;
        l+=p[++len];
    }
    l-=p[len];
    n-=l;
    n--;
    for(ll i=len;i>=1;i--){
        cout<<(char)((n/p[i-1])+'a');
        n%=p[i-1];
    }   
}

Measured memory_bytes: 3608
#include<bits/stdc++.h>
using namespace std;
#define fi(a) scanf("%d",&a);
#define fli(a) scanf("%ld",&a);
#define pi(a) printf("%d\n",a);
#define ppi(i,a) printf("Case %d: %d\n",i,a);


int main()
{

    long long t,n,i,cnt=0,kk;
    long long x[2002];
    t = 1;
    set<long long>st;
    set<long long>::iterator it;
    while(t--)
    {
        long long ans = 0;
        cin >> n;
        for(int j=0; j<n; j++)
        {
            cin >> x[j];
        }

        sort(x,x+n);

        if(n<3)
        {
            cout << 0 << endl;
            return 0;
        }

        for(int k = 0; k<n-2; k++)
        {
            for(int l = k+1; l<n-1; l++)
            {
                for(int z=l+1; z<n; z++)
                {
                    if(x[k]!=x[l] && x[k]!=x[z] && x[l]!=x[z])
                    {
                        if(x[k]+x[l]>x[z])
                            ans++;

                       // cout << k+1 << " " << l+1 << " " << l+2 << endl;
                    }
                }
            }

        }
        cout << ans << endl;
    }

}


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

using namespace std;

using int64 = long long;

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

  string s;
  cin >> s;
  vector<int> ps;
  for (int i = 0; i < s.size(); i++) {
    if (s[i] == 'B') {
      ps.push_back(i);
    }
  }

  int64 ans = 0;
  for (int i = 0; i < ps.size(); i++) {
    ans += s.size() - 1 - i - ps[i];
  }
  cout << ans << endl;
}


Measured memory_bytes: 1552
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < int(n); ++i)
#define rep1(i, n) for (int i = 1; i < int(n); ++i)
#define repx(i, x, n) for (int i = int(x); i < int(n); ++i)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; --i)
#define ALL(n) begin(n), end(n)
#define IN(a, x, b) ((a) <= (x) && (x) < (b))
#define OUT(a, x, b) ((x) < (a) || (x) < (b))
typedef long long ll;
typedef long double ld;
const ll INF = 1e18;
const ll MOD = 1000000007;

int main()
{
    int a, b, c;
    cin >> a >> b >> c;
    rep(i, b)
    {
        if ((a * i) % b == c)
        {
            cout << "YES" << endl;
            return 0;
        }
    }
    cout << "NO" << endl;
    return 0;
}


Measured memory_bytes: 3632
#include<bits/stdc++.h>
#define inf 1000000000
using namespace std;
struct node
{
    int num;
    int val;
    int st;
} a[1009];
int n,m,ans=inf,dp[1009][5000];
int f(int x,int y)
{
    return x&1<<y;
}
int main()
{
    scanf("%d%d",&n,&m);
    for(int i=0; i<=m; i++)
        for(int j=0; j<1<<n; j++)
            dp[i][j]=j==0?0:inf;
    for(int i=1; i<=m; i++)
    {
        int tmp=0;
        scanf("%d%d",&a[i].val,&a[i].num);
        for(int j=1; j<=a[i].num; j++)
        {
            int x;
            scanf("%d",&x);
            tmp+=1<<(x-1);
        }
        a[i].st=tmp;
    }
    for(int i=1; i<=m; i++)
    {
        for(int j=0; j<1<<n; j++)
        {
            int tmp=0;
            dp[i][j]=min(dp[i][j],dp[i-1][j]);
            for(int k=0; k<12; k++)
                tmp+=(f(a[i].st,k)|f(j,k))?1<<k:0;
            dp[i][tmp]=min(dp[i][tmp],dp[i-1][j]+a[i].val);
            //printf("%d %d\n",dp[i][tmp],tmp);
        }
    }
    for(int i=1; i<=m; i++)
        ans=min(ans,dp[i][(1<<n)-1]);
    if(ans==inf)
        printf("-1");
    else
        printf("%d",ans);
    return 0;
}


Measured memory_bytes: 19840
#include<stdio.h>

int main(){
  int h,w,a,b,i,j;
  scanf("%d%d%d%d",&h,&w,&a,&b);
  for(i=0;i<h;i++){
    if(i<b){
      for(j=0;j<w;j++){
        if(j<a){
          printf("0");
        }
        else{
          printf("1");
        }
      }
      printf("\n");
    }
    else{
      for(j=0;j<w;j++){
        if(j<a){
          printf("1");
        }
        else{
          printf("0");
        }
      }
      printf("\n");
    }
  }
  return 0;
}


Measured memory_bytes: 1152
#include <bits/stdc++.h>
using namespace std;
int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	//printf("nigga");
	int G;
	cin>>G;
	if(G%10 == G/100)
		cout<<"Yes";


	else
		cout<<"No";
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int n;
    cin>>n;
    int ans=1;
    for(int i=2;i*i<=n;i++){
        int p=i;
        while(p*i<=n){
            p*=i;
        }
        ans=max(ans,p);
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main(){ 
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    if(a+b>c+d)cout<<"Left";
    else if(a+b<c+d)cout<<"Right";
    else cout<<"Balanced";
 
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
const ll mo=1000000007;
ll ans=0;
ll dp[0][0];

int main()
{
ll n,k;
cin >> n>>k;
string s;
cin >> s;
vector<ll> v;

ll b=1;
if(s[0]=='0')v.push_back(0);
rep(i,n-1){
    if(s[i]==s[i+1]){
        b++;
    }
    else{
        if(s[i]=='0')b=b*-1;
        v.push_back(b);
        b=1;
    }
}
if(s[n-1]=='0')b=b*-1;
v.push_back(b);
if(s[n-1]=='0')v.push_back(0);
ll len=v.size();

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

ll temp=0;
ll g=0,h=2*k;
rep(i,len){
    if(i>2*k)break;
    temp+=abs(v[i]);
}
ans=temp;
//cout <<ans << endl;

rep(i,(len-2*k-1)/2){
    temp=-v[g]+v[g+1]-v[h+1]+v[h+2]+temp;
    g+=2;h+=2;
    if(ans<temp)ans=temp;
    //cout <<temp << endl;
}




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





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

using namespace std ;

#define sz(v) (int)v.size()
#define ll long long
#define all(v)  v.begin() , v.end()
#define rall(v)  v.rbegin() , v.rend()
#define pf push_front
#define pb push_back
#define fast FastInputOutput() ;
#define Clear( container , value ) memset( container , value , sizeof container )
#define PI acos( -1.0 )
#define forn( t , v , be , n ) for( t v = be ; v < n ; v++ )
#define fore( x , j ) for( auto x : j )
#define se second
#define fr first
//#define c_b fflush(stdin);

const ll Long_max = numeric_limits < ll > :: max() ;
const int Int_max = numeric_limits < int > :: max() ;

void File_input( string pathIn ) {
    freopen( pathIn.c_str(), "r", stdin ) ;
}

void File_output( string pathOut ) {
    freopen( pathOut.c_str(), "w", stdout ) ;
}

int msg() {
    srand( time( 0 ) ) ;
    vector < string > st = {
        "Wish everyone high ratings!",
        "Good luck!",
        "Have fun!",
        "Please, read all the problems!",
        "Go Go fight!"
    } ;
    cerr << st[ rand() % sz( st ) ] ;
    return 0 ;
}

void FastInputOutput() {
    ios_base :: sync_with_stdio( 0 ) ;
    cin.tie( 0 ) ;
    cout.tie( 0 ) ;
}

int a , b , c , d ;

int main() {
  cin >> a >> b >> c >> d ;
  cout << max( a * b , c * d ) ;
  return 0 ;
}


Measured memory_bytes: 256
//Zory-2019
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
// typedef __int128 ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define FR first
#define SE second
#define MP make_pair
#define PB push_back
#define vc vector
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define bin(x) (1ll<<(x))
#define fo(i,l,r) for(int i=(l),I=(r);i<=I;i++)
#define fd(i,r,l) for(int i=(r),I=(l);i>=I;i--)
#define Debug printf("Passing [%s] in LINE %d\n",__FUNCTION__,__LINE__)
#define debug(x) cerr<<#x<<'='<<x<<endl
#define mem(x,val) memset(x,val,sizeof x)
namespace mine
{
    ll qread()
    {
        ll ans=0,f=1;char c=getchar();
        while(c<'0' or c>'9') {if(c=='-')f=-1;c=getchar();}
        while('0'<=c and c<='9') ans=ans*10+c-'0',c=getchar();
        return ans*f;
    }
    void write(ll num){if(num<0) putchar('-'),num=-num;if(num>=10) write(num/10);putchar('0'+num%10);}
    void write1(ll num){write(num);putchar(' ');}
    void write2(ll num){write(num);putchar('\n');}
    template<typename T>inline bool chmax(T&a,const T&b){return a<b?a=b,1:0;}
    template<typename T>inline bool chmin(T&a,const T&b){return a>b?a=b,1:0;}
    ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}
    bool IN(ll x,ll l,ll r){return l<=x and x<=r;}

    const int INF=0x3f3f3f3f;
    const int MOD=1e9+7;
    int mm(const int x){return x>=MOD?x-MOD:x;}
    template<typename T> void add(T &x,const int &y){x=(x+y>=MOD?x+y-MOD:x+y);}
    ll qpower(ll x,ll e,int mod=MOD){ll ans=1;while(e){if(e&1)ans=ans*x%mod;x=x*x%mod;e>>=1;}return ans;}
    ll invm(ll x){return qpower(x,MOD-2);}
    const int N=1e6+10;

    void main()
	{
        ll n=qread(),A=qread(),ans=n;
        fo(k,0,40)
        {
            ll x=pow(n,1.0/(k+1)),y=x+1;
            fo(i,0,k+1)
            {
                ll now=1;
                fo(t,1,i) {now=now*x;if(now>=n)break;}
                fo(t,1,k+1-i) {now=now*y;if(now>=n)break;}
                if(now>=n) chmin(ans, A*k+i*x+(k+1-i)*y );
            }
        }
        write(ans);
	}
};//(ans+MOD)%MOD
signed main()
{
    srand(time(0));
    mine::main();
}


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

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repc(i, n) for (int i = 0; i <= int(n); i++)
#define rrepc(i, n) for (int i = int(n); i >= 0; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define repic(i, a, b) for (int i = int(a); i <= int(b); i++)
#define each(x, y) for (auto &x : y)
#define all(a) (a).begin(), (a).end()
#define bit(b) (1ll << (b))
#define uniq(v) (v).erase(unique(all(v)), (v).end())
#define rsort(v) sort(all(v)); reverse(all(v))

using namespace std;

using i32 = int;
using i64 = long long;
using f80 = long double;
using vi32 = vector<i32>;
using vi64 = vector<i64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

inline void yes() { cout << "Yes" << '\n'; exit(0); }
inline void no() { cout << "No" << '\n'; exit(0); }
inline i64 gcd(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); if (a % b == 0) return b; return gcd(b, a % b); }
inline i64 lcm(i64 a, i64 b) { return a / gcd(a, b) * b; }
void solve(); int main() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); solve(); return 0; }
template<typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template<typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template<typename T> inline void amax(T &x, T y) { if (x < y) x = y; }
template<typename T> inline void amin(T &x, T y) { if (x > y) x = y; }
template<typename T> inline T power(T x, i64 n) { T r = 1; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template<typename T> istream& operator>>(istream &is, vector<T> &v) { for (auto &x : v) is >> x; return is; }
template<typename T> ostream& operator<<(ostream &os, const vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }

void solve() {
  int n;
  cin >> n;
  cout << (n - 2) * 180 << '\n';
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define mo 1000003
using namespace std;
template <typename T> void read(T &x){
	x=0;char ch=getchar();int fh=1;
	while (ch<'0'||ch>'9'){if (ch=='-')fh=-1;ch=getchar();}
	while (ch>='0'&&ch<='9')x=x*10+ch-'0',ch=getchar();
	x*=fh;
}
ll su[mo+10],q,x,d,n;
ll po(ll x,ll y){ll z=1;while (y){if (y%2)z=x*z%mo;x=x*x%mo;y/=2;}return z;}
ll que(ll l,ll r){
	if (l/mo!=r/mo)return 0;
	l=l%mo;r=r%mo;
	if (l==0)return 0;
	return su[r]*po(su[l-1],mo-2)%mo;
}
int main(){
	su[1]=1;
	for (int i=2;i<=mo;i++)su[i]=su[i-1]*i%mo;
	read(q);
	while (q--){
		read(x);read(d);read(n);
		if (d==0)cout<<po(x,n)<<endl;
		else{
			x=x*po(d,mo-2)%mo;
			cout<<po(d,n)*que(x,x+n-1)%mo<<endl;
		}
	}
	return 0;
}

Measured memory_bytes: 8704
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>   
#include<limits.h>
#include<float.h>
#include<list>
#include <array>
#include <complex>
using namespace std;
#define i64  long long
#define int  long long
 
#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
#define MEM_SIZE 10000
#define DEBUG_OUT true
#define ALL(x) (x).begin(),(x).end()

// int DP[MEM_SIZE][MEM_SIZE] = {0};
// int GMEM[MEM_SIZE][MEM_SIZE] = {0};
template<typename T> void DEBUG(T e){if(DEBUG_OUT == false)return;std::cout << e << std::endl;}
template<typename T> void DEBUG(const std::vector<T>& v){if(DEBUG_OUT == false)return;for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){if(DEBUG_OUT == false)return;for(const auto& v : vv){ DEBUG(v); } }
template<class T> void DEBUG(string str, T e){if(DEBUG_OUT == false)return;std::cout <<str<<" ";DEBUG(e);};
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
template< typename T1, typename T2 > inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 > inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }


//CODE
void solve(void)
{
  int N,i;
  cin>>N>>i;
  cout<<N -i +1<<endl;
  
  return;
}


int32_t main(int32_t argc, const char *argv[])
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  std::cout << std::fixed;
  std::cout << std::setprecision(9);
  solve();
  

 
  return 0;
}


Measured memory_bytes: 256
#if defined(LOCAL)
#include "C:\includes.hpp"
#include "C:\debug.hpp"
#define deb(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#include <bits/stdc++.h>
#define deb(x...)
#endif
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)

using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long lint;
typedef vector<lint> vlint;
typedef vector<vlint> vvlint;
typedef pair<lint, lint> plint;
typedef double ld;

template<class T> bool uin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool uax(T &a, T b) { return a < b ? (a = b, true) : false; }

int main() {
    ios::sync_with_stdio(false);
  	cin.tie(0);
	string s;
	cin >> s;
	if(s[0] == 'S' && s[1] == 'U')cout << 7 << '\n';
	else if(s[0] == 'S' && s[1] == 'A')cout << 1 << '\n';
	else if(s[0] == 'M')cout << 6 << '\n';
	else if(s[0] == 'T' && s[1] == 'U')cout << 5 << '\n';
	else if(s[0] == 'W')cout << 4 << '\n';
	else if(s[0] == 'F')cout << 2 << '\n';
	else cout << 3 << '\n';
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
 
int32_t main()
{
  int n;
  cin>>n;
  vector<int>arr(n);
  int sum=0;
  
  for(int i=0;i<n;i++)
  {
  cin>>arr[i];
    sum+=arr[i];
  }
  
  int maxi=*max_element(arr.begin(),arr.end());
  sum=sum-maxi;
  if(maxi>=sum)
    cout<<"No"<<endl;
  else
    cout<<"Yes"<<endl;
}

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

class MaximumProfit{
private:
    std::vector<int> dataSet;
public:
    MaximumProfit(std::vector<int> vec);
    int getProfit();
    int getMaximum(int x,int y);
    int getMinimum(int x,int y);
};

MaximumProfit::MaximumProfit(std::vector<int> vec){
    this->dataSet = vec;
}

/*
int MaximumProfit::getProfit(){
    int maxv = dataSet[1] - dataSet[0];
    for(int j = 1;j < dataSet.size();j++){
        for(int i = 0;i <= j - 1;i++){
            if(maxv < (dataSet[j] - dataSet[i])){
                maxv = dataSet[j] - dataSet[i];
            }
        }
    }
    return maxv;
}
*/

int MaximumProfit::getProfit(){
    int maxv = dataSet[1] - dataSet[0];
    int minv = dataSet[0];
    for(int j = 1;j <= dataSet.size() - 1;j++){
        maxv = getMaximum(maxv, dataSet[j] - minv);
        minv = getMinimum(minv, dataSet[j]);
    }
    return maxv;
}

int MaximumProfit::getMaximum(int x,int y){
    if(x > y){
        return x;
    }
    return y;
}

int MaximumProfit::getMinimum(int x,int y){
    if(x < y){
        return x;
    }
    return y;
}

int main(){
    
    int line;

    std::cin >> line;
    
    std::vector<int> vec;

    for(int i = 0;i < line;i++){
        int input;
        std::cin >> input;
        vec.push_back(input);
    }

    MaximumProfit mp = MaximumProfit(vec);

    std::cout << mp.getProfit() << std::endl;

    return 0;
}

Measured memory_bytes: 5228
/****Author: Barish Namazov****/
#include <bits/stdc++.h>

using namespace std;

/***TEMPLATE***/
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()

#define F first
#define S second
#define pb push_back

#define endl '\n'

const int max4 = 10004;
const int maxx = 100005;
const int max6 = 1000006;
const int lg5 = 17;

const int INF = 2 * 1000000007;
const long long INFLL = 4LL * 1000000000 * 1000000000;

/***************/

int powmod (int a, int b, int mod) {
    int res = 1; a %= mod;
    for (; b; b >>= 1) {
        if (b & 1) {
            res = 1LL * res * a % mod;
        }
        a = 1LL * a * a % mod;
    }
    return res;
}
#define ll long long
ll gcd (ll a, ll b) {
    while (b > 0) {
        ll t = a % b;
        a = b, b = t;
    }
    return a;
}

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

int is_prime (int n) {
    if (n <= 1 || n > 3 && (n % 2 == 0 || n % 3 == 0))
        return 0;
    for (int i = 5, t = 2; i * i <= n; i += t, t = 6 - t)
        if (n % i == 0)
            return 0;
    return 1;
}

/******Don't forget to use long long when needed!!******/

int main() {
    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);
    ios_base :: sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    int n, k;
    cin >> n >> k;
    int x, g = 0, mx = 0;
    for (int i = 1; i <= n; i++) {
        cin >> x; g = gcd(g, x);
        mx = max(mx, x);
    }
    if (!(k <= mx && k % g == 0)) {
        cout << "IM";
    }
    cout << "POSSIBLE" << endl;
    return 0;
}


Measured memory_bytes: 256
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
use std::io::{Write, BufWriter};
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, [ $t:tt ]) => {{
        let len = read_value!($next, usize);
        (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    }};

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn solve() {
    let out = std::io::stdout();
    let mut out = BufWriter::new(out.lock());
    macro_rules! puts {
        ($($format:tt)*) => (write!(out,$($format)*).unwrap());
    }
    input! {
        n: usize, m: usize,
        a: [i64; n],
        bc: [(usize, i64); m],
    }
    let mut a = a;
    let mut bc = bc;
    a.sort();
    bc.sort_by_key(|&(_, k)| k);
    bc.reverse();
    let mut pre = 0;
    for &(b, c) in &bc {
        for i in pre..min(pre + b, n) {
            a[i] = max(a[i], c);
        }
        pre += b;
    }
    let sum: i64 = a.iter().sum();
    puts!("{}\n", sum);
}

fn main() {
    // In order to avoid potential stack overflow, spawn a new thread.
    let stack_size = 104_857_600; // 100 MB
    let thd = std::thread::Builder::new().stack_size(stack_size);
    thd.spawn(|| solve()).unwrap().join().unwrap();
}


Measured memory_bytes: 12540