akhauriyash/Code-Regression huggingface dataset:
import sys
import collections
import heapq


def solve():
    input = sys.stdin.readline
    mod = 10 ** 9 + 7
    x, y, z, k = list(map(int, input().rstrip('\n').split()))
    a = list(map(int, input().rstrip('\n').split()))
    b = list(map(int, input().rstrip('\n').split()))
    c = list(map(int, input().rstrip('\n').split()))
    a.sort(reverse=True)
    b.sort(reverse=True)
    c.sort(reverse=True)
    ql = [[-(a[0] + b[0] + c[0]), 0, 0, 0]]
    heapq.heapify(ql)
    fq = collections.defaultdict(int)
    fq[0, 0, 0]
    for i in range(k):
        s, ap, bp, cp = heapq.heappop(ql)
        for app, bpp, cpp in ([[ap+1, bp, cp], [ap, bp+1, cp], [ap, bp, cp+1]]):
            if app < x and bpp < y and cpp < z:
                if (app, bpp, cpp) not in fq:
                    heapq.heappush(ql, [-(a[app] + b[bpp] + c[cpp]), app, bpp, cpp])
                    fq[app, bpp, cpp]
        print(-s)


if __name__ == '__main__':
    solve()


Measured memory_bytes: 53208
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

#define vi vector<int>
#define vl vector<long long>
#define vvi vector< vector<int> >
#define vvl vector< vector<ll> >
#define vp vector<P>
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REPD(i, n) for (int i = (int)(n-1); i >= 0; i--)
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define FORD(i, a, b) for (int i = (int)(a); i >= (int)(b); i--)
#define INF 1e18
#define INFTY 1e9
const int mod = 998244353;
#define SIZE_OF_ARRAY(array) (sizeof(array)/sizeof(array[0]))

template<class T> bool chmax(T &a, const T & b) {
    if (a<b) {
        a = b;
        return true;
    }
    return false;
}

template<class T> bool chmin(T &a, const T & b) {
    if (a>b) {
        a = b;
        return true;
    }
    return false;
}

//cout << fixed << setprecision(10) << y << endl;
struct edge {int to, cost;};
vector< vector<edge> > es;
const int MAX_N = 10010;

int main() {
    int n;
    cin >> n;
    ll res = 0;
    FOR(i, 1, n) {
        res += n-i;
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(){
    int n,f=0;
    scanf("%d",&n);
    for(int i=1;i<=9;i++){
        for(int j=1;j<=9;j++){
            if(i*j==n){
                f=1;
                break;
            }
        }
        if(f==1)
            break;
    }
    if(f==1)
        printf("Yes");
    else
        printf("No");
    return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int main(){
	int a,b;
	cin>>a>>b;
	if(a+b==3) cout<<3<<"\n";
	if(a+b==4) cout<<2<<"\n";
	if(a+b==5) cout<<1<<"\n";
	return 0;
}

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

#define rep(i, n) REP(i, 0, n)
#define REP(i, k, n) for(int i = (int)k; i < (int)n; i++)
#define rrep(i, n) RREP(i, 0, n)
#define RREP(i, k, n) for(int i = (int)n-1; i > (int)k-1; i--)
#define mmax(start, end) *max_element(start, end)
#define mmin(start, end) *min_element(start, end)
#define ALL(x) (x).begin(), (x).end()

typedef long long ll;

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

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

    int W, H, N;
    cin >> W >> H >> N;
    // vector<vector<bool> > t = vector<vector<bool>(W+1,true) >(H+1,true);
    bool t[101][101];
    memset(t,true,sizeof(t));

    rep(i,N) {
        int x, y, a;
        cin >> x >> y >> a;
        switch(a) {
        case 1:
            rep(i,x) rep(j,H) t[i][j]=false;
            break;
        case 2:
            REP(i,x,W) rep(j,H) t[i][j]=false;
            break;
        case 3:
            rep(i,W) rep(j,y) t[i][j]=false;
            break;
        case 4:
            rep(i,W) REP(j,y,H) t[i][j]=false;
            break;
        }
    }

    // rrep(j,H) {
    //     rep(i,W) {
    //         cout << t[i][j] << " ";
    //     }
    //     cout << endl;
    // }

    int ans = 0;
    rep(i,W) rep(j,H) if(t[i][j]) ans++;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void){
    
    /*
    int a, b;
    cin >> a >> b ;
    //*/

    //*
    vector<int> vec(3);
    cin >> vec.at(0) >> vec.at(1) >> vec.at(2) ;
    
    sort(vec.begin(), vec.end());
    //*/
    
    /*
    if( a < 6 ){
        cout << 0 << endl;
    } else if (a < 13){
        cout << b / 2 << endl;
    } else {
        cout << b << endl;
    }
    //*/
    
    cout << vec.at(0) + vec.at(1) << endl;

    return 0; 
}


Measured memory_bytes: 3604
while True:
    conv_map = {}
    s = ""
    n=input()
    if n==0:
        break

    for x in xrange(n):
        lst = raw_input().split()
        conv_map[lst[0]] = lst[1]

    m=input()
    tmp=""
    for x in xrange(m):
        tmp=raw_input()[0]
        s += conv_map.get(tmp, tmp)

    print s

Measured memory_bytes: 6420
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		// 数値
		int n1 = sc.nextInt();

		if (n1 % 2 == 0) {
			System.out.println(n1 / 2);
		} else {
			System.out.println(1 + n1 / 2);
		}
	}
}


Measured memory_bytes: 21716
from collections import Counter
import sys
sdin = sys.stdin.readline

n,t = map(int, sdin().split())
a = list(map(int, sdin().split()))

# iまででの最高と最低
diff_list = [] # iを含むiまでの最低
max_list = [] # iを含まないiからの最高

mini = max(a)
maxi = a[-1]
max_list = [a[-1]]
for i in range(n-1,0,-1):
    if a[i] > maxi:
        max_list.append(a[i])
        maxi = a[i]
    else:
        max_list.append(maxi)
        
max_list = max_list[::-1]

# iまでの最低と最高を更新
for i in range(n-1):
#    if a[i] < mini:
#        mini = a[i]
#    
#    if a[i] == maxi:
#        maxi = max(a[i+1:])
        
    diff_list.append(max_list[i]-a[i])
    
cnt = Counter(diff_list)

# 最大値の個数
print(cnt[max(cnt.keys())])
    

Measured memory_bytes: 22936
#include <cstdio>
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <string>
#include <set>
#include <map>
#include <ctime>
#include <cstring>
#include <cassert>
#include <bitset>
#include <sstream>
#include <queue>

#define pb push_back
#define mp make_pair
#define fs first
#define sc second
#define sz(a) ((int) (a).size())
#define eprintf(...) fprintf(stderr, __VA_ARGS__)

using namespace std;

typedef long long int64;
typedef long double ldb;

const long double eps = 1e-9;
const int inf = (1 << 30) - 1;
const long long inf64 = ((long long)1 << 62) - 1;
const long double pi = acos(-1);

template <class T> T sqr (T x) {return x * x;}
template <class T> T abs (T x) {return x < 0 ? -x : x;}

int main () {
    ios_base::sync_with_stdio(0);
//	freopen("input.txt", "rt", stdin);
//	freopen("output.txt", "wt", stdout);

    int n, d;
    cin >> n >> d;

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

    int m;
    cin >> m;

    vector<int> q(m);
    for (int i = 0; i < m; ++i) {
    	cin >> q[i];
    	--q[i];
    }

    vector<long long> min_fail(n + 1);
    min_fail[n] = 1;
    for (int i = n - 1; i >= 0; --i) {
    	if (a[i] >= 2 * min_fail[i + 1]) {
    		min_fail[i] = min_fail[i + 1];
    	} else {
    		min_fail[i] = min_fail[i + 1] + a[i];
    	}
    }

    vector<int> cur(n + 1);
    cur[0] = d;
    for (int i = 0; i < n; ++i) {
    	cur[i + 1] = min(abs(cur[i] - a[i]), cur[i]);
    }

    vector<bool> res(n);
    for (int i = 0; i < n; ++i) {
    	res[i] = cur[i] >= min_fail[i + 1];
    }

    for (int i = 0; i < m; ++i) {
    	cout << (res[q[i]] ? "YES" : "NO") << "\n";
    }

	return 0;
}


Measured memory_bytes: 11776
import java.util.AbstractMap;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Scanner;

class Main {

  static final int MOD = 1000000007;

  public static void main(String[] args) throws Exception{
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    for (int a = 1; a <= 3500; a++) {
      for (int b = 1; b <= 3500; b++) {
        double num = (double) n * a * b / (4* a * b - n * b - n * a);
        // if(num<0)break;
        // System.out.println(a + " " + b + " " + num);
        if (num > 0 && Math.abs(num - Math.round(num)) < 0.00001) {
          System.out.println(a + " " + b + " " + Math.round(num));
          return;
        }
      }
    }
    throw new Exception();
  }
}

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

int main() {
    string S;
    cin >> S;
    string T = "CODEFESTIVAL2016";
    int ans = 0;
    for(int i = 0; i < S.size(); i++) {
        if(T[i] != S[i]) {
            ans++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int const nax = 3e5 + 10;
using ll = long long;
ll a[nax];
ll b[nax];

int main () {
    int n, m;
    ll k;
    int ans = 0;

    scanf("%d %d %lld", &n, &m, &k);

    for (int i = 1 ; i <= n ; ++ i) {
        scanf("%lld", a + i);
        a[i] += a[i - 1];
        if (a[i] <= k) {
            ans = i;
        }
    }

    ll cur_sum = 0;

    for (int i = 1 ; i <= m ; ++ i) {
        scanf("%lld", b + i);
        cur_sum += b[i];

        ll res = k - cur_sum;

        if (res < 0) continue;

        int l = 1, r = n, ans1 = 0;

        while (l <= r) {
            int mid = l + r >> 1;
            if (a[mid] <= res) {
                ans1 = mid;
                l = mid + 1;
            } else r = mid - 1;
        }


        ans = max(ans, i + ans1);
    }

    printf("%d\n", ans);


}
/*
    Good Luck
        -Lucina
*/


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

using namespace std;
typedef long long ll;
#define int ll

template<typename T1,typename T2> inline void chmin(T1 &a, T2 b){ if(a > b) a = b; }
template<typename T1,typename T2> inline void chmax(T1 &a, T2 b){ if(a < b) a = b; }

#define REP(i,n) for(int i=0;i<n;++i)
#define SORT(name) sort(name.begin(), name.end())
#define ZERO(p) memset(p, 0, sizeof(p))
#define MINUS(p) memset(p, -1, sizeof(p))
#if 1
#  define DBG(fmt, ...) printf(fmt, ##__VA_ARGS__)
#else
#  define DBG(fmt, ...)
#endif

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const double DINF = std::numeric_limits<double>::infinity();
const int MOD = 1000000007;
const int MAX_N = 100010;

int N;
vector< tuple<int, int, int> > ABI;
vector< tuple<int, int, int> > BAI;

int solve() {
    int ret = 0;
    if(N % 2 == 0) {
        int lb1 = get<0>(ABI[N / 2 - 1]);
        int rb1 = get<0>(BAI[N / 2 - 1]);
        int lb2 = get<0>(ABI[N / 2]);
        int rb2 = get<0>(BAI[N / 2]);

        int lb = lb2 - lb1;
        if(lb % 2 != 0) {
            ret++;
        }
        lb /= 2;
        lb = lb2 - lb;

        int rb = rb2 - rb1;
        if(rb % 2 != 0) {
            ret++;
        }
        rb /= 2;
        rb = rb1 + rb;
        ret += ((rb - lb) * 2 + 1);
    }
    else {
        int lb = get<0>(ABI[N / 2]);
        int rb = get<0>(BAI[N / 2]);
        ret = (rb - lb) + 1;
    }
    return ret;
}

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

    cin >> N;
    REP(i, N) {
        int a, b;
        cin >> a >> b;
        ABI.push_back(make_tuple(a, b, i));
        BAI.push_back(make_tuple(b, a, i));
    }
    SORT(ABI);
    SORT(BAI);

    int ans = solve();
    printf("%lld\n", ans);

    return 0;
}


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

using namespace std;

int n;
int a[200010];
long long s[200010];
long long ans;
const int mod = 1e9 + 7;
int main()
{
	cin >> n;
	for(int i = 1; i <= n; i++)
	{
		cin >> a[i];
		s[i] = s[i-1] + a[i];
	}
	for(int i = 1; i <= n-1; i++)
	{
		ans = (ans + (s[n] - s[i]) % mod * a[i] % mod) % mod;
	}
	cout << ans << endl;
}

Measured memory_bytes: 5880
// #define _GLIBCXX_DEBUG
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
using ll = long long; using ull = unsigned long long;
using pii = pair<int, int>; using vi = vector<int>; using vvi = vector<vi>; using puu = pair<uint, uint>; using vu = vector<uint>; using vvu = vector<vu>;
using pll = pair<ll, ll>; using vl = vector<ll>; using vvl = vector<vl>; // using pulul = pair<ull, ull>; using vul = vector<ull>; using vvul = vectro<vul>;
using vb = vector<bool>; using vvb = vector<vb>;
#define rep0(TMS) for (int CNT = 0; CNT < (int)(TMS); CNT++)
#define rep(CNT, GOAL) for (int CNT = 0; CNT < (int)(GOAL); CNT++)
#define rep2(CNT, START, GOAL) for (int CNT = (int)(START); CNT < (int)(GOAL); CNT++)
#define rep3(CNT, START, GOAL) for (int CNT = (int)(START); CNT > (int)(GOAL); CNT--)
#define all(CONT) begin(CONT), end(CONT)
template <typename T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template <typename T> bool chmin(T &a, const T &b) { if (a > b) { a = b; return true; } return false; }
void prec(const int &DIG) { cout << fixed << setprecision(DIG); cerr << fixed << setprecision(DIG); }
template <typename T> void CERR(const T &ELEM) { cerr << ELEM; }
#define dbl(OBJ) cerr << #OBJ << ": "; CERR(OBJ); cerr << "\n"
template <typename T, typename ...Ts> void CERR(const T &FIRST, const Ts &...REST) { CERR(FIRST); cerr << ", "; CERR(REST...); }
#define dbs(...) cerr << "(" << #__VA_ARGS__ << "): ("; CERR(__VA_ARGS__); cerr << ")\n"
#define itrep(ITR, CONT) for (auto ITR = begin(CONT); ITR != end(CONT); ITR++)
template <typename T> void CERR(const vector<T> &VEC) { cerr << "{ "; itrep(ITR, VEC) { CERR(*ITR); cerr << ", "; } cerr << "}"; }
#define YN(FLG) cout << (FLG ? "YES" : "NO") << "\n"
#define Yn(FLG) cout << (FLG ? "Yes" : "No") << "\n"
#define yn(FLG) cout << (FLG ? "yes" : "no") << "\n"

#include <atcoder/all>

using namespace atcoder;

// const ll INF = LONG_LONG_MAX;
const int INF = INT_MAX;
// const ll MOD = 1000000007; // 998244353;

int N, M;
vector<string> S;
int MAX;

int p(int i, int j) {
	return i * M + j;
}

int main() {
	cin >> N >> M;
	MAX = N + M;
	S = vector<string>(N); rep(i, N) cin >> S[i];
	// (i,j)をi*M+jと表す(i:0~N-1,j:0~M-1) p(i,j)
	// s:(N*M) t:(N*M+1)
	mcf_graph<int, int> g(N * M + 2);
	rep(i, N) rep(j, M) {
		if(S[i][j] == 'o') {
			g.add_edge(N * M, p(i, j), 1, 0); // (1,0) sから
		}
	}
	rep(i, N) rep(j, M) {
		if (S[i][j] == '#') continue;
		if (i < N - 1 and S[i + 1][j] != '#') g.add_edge(p(i, j), p(i + 1, j), N * M, 0); // (NM,0) 隣のマスへ
		if (j < M - 1 and S[i][j + 1] != '#') g.add_edge(p(i, j), p(i, j + 1), N * M, 0);
	}
	rep(i, N) rep(j, M) {
		if (S[i][j] == '#') continue;
		g.add_edge(p(i, j), N * M + 1, 1, MAX - (i + j)); // tへ
	}
	pii cf = g.flow(N * M, N * M + 1);
	// dbs(cf.first, cf.second);
	// for (mcf_graph<int, int>::edge e : g.edges()) {
	// 	dbs(e.from, e.to, e.cap, e.flow, e.cost);
	// }
	int ans = MAX * cf.first - cf.second;
	rep(i, N) rep(j, M) if (S[i][j] == 'o') ans -= i + j;

	cout << ans << endl;
}

Measured memory_bytes: 4164
#include <bits/stdc++.h>
using namespace std;
int main(){
	int w,h,x,y;
	cin>>w>>h>>x>>y;

	int A=0;
	int B=(w%2==0 && w/2==x);
	int C=(h%2==0 && h/2==y);

	if(B&&C)A=1;

	printf("%.10f %d\n",(double)h*w/2,A);

	return 0;

}

Measured memory_bytes: 256
# coding: utf-8
A,B,M=map(int,input().split())
Al=list(map(int,input().split()))
Bl=list(map(int,input().split()))
C=[]
for i in range(M):
    C.append(list(map(int,input().split())))

ans=min(Al)+min(Bl)

for i in range(M):
    ans=min(ans,Al[C[i][0]-1]+Bl[C[i][1]-1]-C[i][2])

print(ans)


Measured memory_bytes: 38552
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        String[] A = new String[N+1];
        for (int i = 1 ; i <= N ; i++){
            A[i] = sc.next();
        }
        sc.close();

        int AC = 0;
        int WA = 0;
        int TLE = 0;
        int RE = 0;

        for(int i = 1 ; i<= N ; i++){
            if(A[i].equals("AC")){
                AC++;
            }
            else if(A[i].equals("WA")){
                WA++;
            }
            else if(A[i].equals("TLE")){
                TLE++;
            }
            else if(A[i].equals("RE")){
                RE++;
            }
        }
        System.out.println("AC x " + AC);
        System.out.println("WA x " + WA);
        System.out.println("TLE x " + TLE);
        System.out.println("RE x " + RE);

    }
}

Measured memory_bytes: 55064
#!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.buffer.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    n,k = LI()
    d = [0]*n
    for _ in range(k):
        __ = input()
        a = LI()
        for i in a:
            d[i-1] = 1
    print(n-sum(d))
    return

#Solve
if __name__ == "__main__":
    solve()


Measured memory_bytes: 67980
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<=n;i++)
using namespace std;
int main(){
    int N;cin>>N;
    REP(i,N/4){
        REP(y,N/7){
            int sum = (i*4)+(y*7);
            if(sum==N){
                printf("Yes");
                return 0;
            }
        }
    }
    printf("No");
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<map>
#include<iomanip>
#include<vector>
#define rep(i,a,b) for(int i=a;i<b;i++)
using namespace std;
using ll = long long;
const int M = 100000;


int main() {
	int n,a,x[50];
	ll ans, dp[55][55][2555];

	cin >> n >> a;
	rep(i,0,n) cin >> x[i];

	//dp[i][j][k]はx[0]~x[i]までの中からj個選んだ時、k=Σx;
	dp[0][0][0]=1;
	rep(i,0,n){
		rep(j,0,i+1) {
			rep(k,0, 2501) {
				if (dp[i][j][k]) {
					//not select;
					dp[i + 1][j][k] += dp[i][j][k];
					//select;
					dp[i + 1][j + 1][k + x[i]] += dp[i][j][k];
				}
			}
		}
	}
	ans=0;
	for(int i=1;i<n+1;i++)
		ans += dp[n][i][a*i];

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

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


  #define en "\n"
  #define sqrt(n) sqrt((long double) n)
  #define all(c) (c).begin() , (c).end()
  #define MOD 1000000007
  #define mem(a) memset(a,0,sizeof(a))
  #define flash() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
  #define file_input(name) name!=""?freopen(name".in","r",stdin),freopen(name".out","w",stdout):0
  #define SORT(x) sort(all(x))
  #define REVERSE(x) reverse(all(x))


  using namespace std;

  typedef unsigned long long ull;
  typedef long long ll;
  typedef pair<int, int> pii;
  typedef pair<ll, ll> pll;
  typedef vector<int> vi;
  typedef set<int> seti;
  typedef pair<double, double> pdd;
  typedef long double ld;



  const double EPS=0.000000001;
  const double INFD32=1000000000;
  const ll INF64=1000000000000000000;
  const int INF32=1000000000;

  #define maxN 30000000
  bool sortbysecond(const pair<int,int> &a,const pair<int,int> &b){
    return (a.second>=b.second && a.first>=b.first);
  }

  signed main(void){
      int64_t w,h,x,y;
      cin>>w>>h>>x>>y;
      double xx;
      double yy;
      xx=w/2.0;
      yy=h/2.0;
      double area;
      area=(w*h)/2.0;
      cout<<area<<" ";
      if(xx==x && yy==y){
        cout<<"1";
      }
      else cout<<"0";
      return 0;
    }


Measured memory_bytes: 256
#include <stdio.h>

int main() {

  int i,j,N,temp,A[100],count=0;
  scanf("%d",&N);
  for(i = 0; i < N; i++) {
    scanf("%d",&A[i]);
  }

  for(i = 0; i < N; i++) {
    for(j = N-1; j >= i+1; j--) {
      if(A[j] < A[j-1]){
	temp = A[j];
	A[j] = A[j-1];
	A[j-1] = temp;
	count++;
      }
    }
  }
  
    

  
  for(i = 0; i < N; i++) {
    if(i) printf(" ");
    printf("%d",A[i]);
   
  }
  printf("\n%d\n",count);

  return 0;
}



Measured memory_bytes: 2124
#include<iostream>
#include<set>
#include<string>
using namespace std;
int main(){
  int N;cin>>N;
  string S;
  set<string> p;
  for(int i=0;i<N;i++){
    cin>>S;
    p.insert(S);
  }
  cout<<p.size()<<endl;
  return 0;
}

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

const int mnx = 3e5 + 9;
const int mod = 1e9 + 7;

ll a, b;

int main(){

cin>>a>>b;

if(a == 0){
    if(b > 0){
        cout<<b<<'\n';
        return 0;
    } else {
        cout<<abs(b) + 1<<'\n';
        return 0;
    }
}

if(b == 0){
    if(a > 0){
        cout<<a + 1<<'\n';
        return 0;
    } else {
        cout<<abs(a)<<'\n';
        return 0;
    }
}

if(a > 0 && b > 0){
    if(a > b){
        cout<<abs(abs(a) - abs(b)) + 2<<'\n';
        return 0;
    } else {
        cout<<abs(abs(a) - abs(b))<<'\n';
        return 0;
    }
} else if(a < 0 && b < 0){
    if(a > b){
        cout<<abs(abs(a) - abs(b)) + 2<<'\n';
        return 0;
    } else {
        cout<<abs(abs(a) - abs(b))<<'\n';
        return 0;
    }
} else {
    cout<<abs(abs(a) - abs(b)) + 1<<'\n';
}

return 0;

}















Measured memory_bytes: 256
#include<stdio.h>

int main(){
    char s[20],t[20];
    scanf("%s",s);
    for(int i=0;i<20;i++){
        if(i==5||i==13){
            t[i]=' ';
        }else{
            t[i]=s[i];
        }
    }
    printf("%s\n",t);
    return 0;
}

Measured memory_bytes: 1660
#include<stdio.h>
#define MAX 250
int parent(int i){
  return i/2;
}
int left(int i){
  return 2*i;
}
int right(int i){
  return 2*i+1;
}

int main(){
  int i,H,A[MAX+1];

  scanf("%d",&H);
  for(i=1;i<=H;i++)scanf("%d",&A[i]);

  for(i=1;i<=H;i++){
    printf("node %d: key = %d, ",i,A[i]);
    if(parent(i)>=1)printf("parent key = %d, ",A[parent(i)]);
    if(left(i)<=H)printf("left key = %d, ",A[left(i)]);
    if(right(i)<=H)printf("right key = %d, ",A[right(i)]);
    printf("\n");
  }
  return 0;
}



Measured memory_bytes: 2104
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;

const int N = 1e5 + 10;

vector<int> g[N];

int n;

int dfs(int u, int fa) {
    int res = 0;
    for(int v: g[u]) {
        if(v != fa) {
            res ^= dfs(v, u) + 1;
        }
    }
    return res;
}

int main() {
    scanf("%d", &n);
    for(int i = 1, u, v ; i < n ; ++ i) {
        scanf("%d%d", &u, &v);
        g[u].push_back(v);
        g[v].push_back(u);
    }
    puts(dfs(1, 0) ? "Alice" : "Bob");
}


Measured memory_bytes: 10368
#include <iostream>
#include <string>
#include <vector>
#define rep(i, n) for(i = 0; i < n; i++)
using namespace std;

int mod = 998244353;
string s;
vector<int> sr;
vector<int> sb;
int dp[4001][4001];

int main() {
	int i, j;
	
	cin >> s;
	int n = s.length();
	
	rep(i, n) {
		if (s[i] == '0') {
			sr.push_back(i);
			sr.push_back(i);
		}
		if (s[i] == '1') {
			sr.push_back(i);
			sb.push_back(i);
		}
		if (s[i] == '2') {
			sb.push_back(i);
			sb.push_back(i);
		}
	}
	
	dp[0][0] = 1;
	rep(i, sr.size() + 1) {
		rep(j, sb.size() + 1) {
			if (dp[i][j] == 0) continue;
			if (i < sr.size() && sr[i] <= i + j) {
				dp[i + 1][j] += dp[i][j];
				dp[i + 1][j] %= mod;
			}
			if (j < sb.size() && sb[j] <= i + j) {
				dp[i][j + 1] += dp[i][j];
				dp[i][j + 1] %= mod;
			}
		}
	}
	
	cout << dp[sr.size()][sb.size()] << endl;
	return 0;
}

Measured memory_bytes: 60416
n = int(input())

num = 0

t_b = [[0 for i in range(10)] for j in range(10)]
for i in range(1,n+1):
    si = str(i)
    t_b[int(si[0])][int(si[-1])] += 1

for i in range(10):
    for j in range(10):
        num += t_b[i][j]*t_b[j][i]

print(num)


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

int main(){
  int n;
  cin >> n;
  string s[2];
  rep(i, 2){
    cin >> s[i];
  }
  ll ans = 1;
  int pos = 0;
  while(pos < n){
    if(s[0][pos] == s[1][pos]){
      if(!pos) ans = (ans*3) % mod;
      else if(s[0][pos-1] == s[1][pos-1]) ans = (ans*2) % mod;
      pos++;
    } else {
      if(!pos) ans = (ans*6) % mod;
      else if(s[0][pos-1] != s[1][pos-1]) ans = (ans*3) % mod;
      else ans = (ans*2) % mod;
      pos += 2;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using i32 = int_fast32_t;
using i64 = int_fast64_t;

#define INF (i32)1e9
#define INF_LL (i64)1e18
#define MOD (i64)(1e9+7)
#define REP(i, n) for(i64 i = 0; i < n; i++)
#define RANGE(i, a, b) for(i64 i = a; i < b; i++)

i64 mod_pow(i64 x, i64 n) {
  if (n == 0) return 1;
  if (n == 1) return x;
  i64 half = mod_pow(x, n / 2);
  return (half * half % MOD) * mod_pow(x, n % 2) % MOD;
}

int main() {
  i64 n, m;
  cin >> n >> m;

  vector<i64> fact(m+1);
  vector<i64> inv_fact(m+1);
  fact[0] = 1;
  inv_fact[0] = 1;
  RANGE(i, 1, m+1) {
    fact[i] = i * fact[i-1] % MOD;
    inv_fact[i] = mod_pow(fact[i], MOD-2) % MOD;
  }

  i64 ans = 0;
  REP(k, n+1) {
    i64 nCk = (fact[n] * inv_fact[k] % MOD) * inv_fact[n-k] % MOD;
    i64 mPk = fact[m] * inv_fact[m-k] % MOD;
    i64 mkPnk = fact[m-k] * inv_fact[m-n] % MOD;
    if (k % 2 == 0) {
      ans = (ans + (nCk * mPk % MOD) * (mkPnk * mkPnk % MOD) % MOD) % MOD;
    } else {
      ans = (ans + MOD - (nCk * mPk % MOD) * (mkPnk * mkPnk % MOD) % MOD) % MOD;
    }
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 11064
// I'm a f*cking looser
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define fasino ios_base::sync_with_stdio(false); cin.tie(0);  cout.tie(0);
#define asc(A) sort(A.begin(),A.end())
#define dsc(A) sort(A.begin(),A.end(),greater<ll>())
#define input(A,N) for(ll i=0;i<N;i++) cin>>A[i];
signed main()
{
    fasino
    ll n,k;
    cin>>n>>k;
    vector<ll> A(n);
    for(auto &i:A) cin>>i;
    asc(A);
    ll sum = 0;
    for(int i=0;i<k;i++) sum+=A[i];
    cout<<sum;
    return 0;
}

Measured memory_bytes: 3648
#include <iostream>

using namespace std;
typedef unsigned long long ull;

int main(){
	int N;
	cin >> N;
	ull *dp = new ull[(N-1) * 21];
	for(int i=0; i<(N-1) * 21; i++) dp[i] = 0;
	int number;
	cin >> number;
	dp[number] = 1;

	for(int n=1; n<N-1; n++){
		cin >> number;

		if(number == 0){
			for(int i=0; i<=20; i++){
				const int index = i + n * 21;
				dp[index] = dp[index - 21] * 2;
			}
		}
		else{
			for(int i=0; i<=20; i++){
				const int index = i + n * 21;
				if(i - number >= 0) dp[index] += dp[index - number - 21];
				if(i + number <= 20) dp[index] += dp[index + number - 21];
			}
		}
	}

	cin >> number;
	cout << dp[number + (N-2) * 21] << endl;

	delete[] dp;
	return 0;
}

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

int main()
{
    string s, t;
    cin >> s >> t;
    int cnt = 0;
    for (long long i = 0; i < s.size(); i++) {
        if (s[i] != t[i]) cnt++;
    }
    cout << cnt << endl;
}

Measured memory_bytes: 3904
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<functional>
#include<math.h>
 
#define rep(i,n) for(ll i=0;i<(n);i++)
typedef long long ll;
using namespace std;

int main(void){
  int N;
  cin >> N;
  if(N==1){
    cout << 0 << endl;
  }
  else{
    cout << 1 << endl;
  }
}

Measured memory_bytes: 3564
#include "iostream"
#include "fstream"
#include "algorithm"
#include "iomanip"
#include "stack"
#include "queue"
#include "string"
#include "vector"
#include "map"
#include "set"
#include "unordered_set"
#include "unordered_map"
#include "iterator"
#include <ctime>
#include "bitset"
#include "cmath"
#include "list"
#include "complex"
#include <cassert>
#include "deque"
#include "numeric"

using namespace std;

//#define f(i,n) for(int i=0; i<n;i++) 
//#define rf(i, n) for(int i=n-1;i>=0;i--)
//#define forn(i, j, n) for(int i=j; i<n; i++)
//#define ff(i, j, n) f(i, n)f(j, n)
#define pb push_back
#define mp make_pair
#define maxi(a,b) a = max(a, b);
#define mini(a,b) a = min(a, b);
#define endl '\n'
#define all(a) a.begin(), a.end()
#define sqr(x) ((x) * (x))
#define SZ(a) ((int)(a.size()))
#define watch(x) cout << (#x) << " = " << x << endl;
//typedef long long ll;
typedef long double ld;
#define int long long
#define double ld
typedef map<int, int> mii;
typedef pair<int, int> pii;
typedef pair<string, int> psi;
typedef pair<int, string> pis;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<pii> vpii;
typedef vector<char> vc;

template<class T>
void show(const vector<T> &a)
{
	for (T x : a)
		cout << x << " ";
	cout << endl;
}

const int sze = 3e5 + 50, oo = 1e18 + 500, mod = 1000000007;
const double eps = 5e-10, PI = 2 * acos(0.0);
vi vertices[sze];
vc visit(sze, false);
vi arr(sze, 0);
int n, m, k;
int cnt = 0;
int x, y;


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

	cin >> n;
	vd a(n);
	double avr = 0;
	for (int i = 0; i < n; i++)
	{
		cin >> a[i];
		avr += a[i];
	}

	avr /= n;

	vector<pair<double, int>> ind;
	for (int i = 0; i < n; i++)
	{
		ind.pb(mp(fabs(a[i] - avr), i));
	}
	sort(all(ind));

	cout << ind[0].second;
	return 0;
}


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

int main()
{
  int n, m;
  cin >> n >> m;
  vector<int> p(m);
  vector<int> y(m);
  int i;
  for(i = 0; i < m; i++)cin >> p.at(i) >> y.at(i);  
  vector<pair<int, int> > pear(m);
  vector<pair<int, pair<int, int>> > bigp(m);
  for(i = 0; i < m; i++)pear.at(i) = make_pair(y.at(i), i);
  sort(pear.begin(), pear.end());
  vector<int> count(n+1, 1);
  for(i = 0; i < m; i++)
  {
      pear.at(i).first = count.at(p.at(pear.at(i).second));
      count.at(p.at(pear.at(i).second))++;
  }
  for(i = 0; i < m; i++)swap(pear.at(i).first, pear.at(i).second);
  sort(pear.begin(), pear.end());
  for(i = 0; i < m; i++)
  {
    printf("%06d%06d\n", p.at(pear.at(i).first) , pear.at(i).second);
  }
}

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

int x_pos[8010][16010] = {};
int y_pos[8010][16010] = {};
int x_dir[8010] = {};
int y_dir[8010] = {};

int main()
{
    string s;
    int x, y;
    cin >> s;
    scanf("%d %d", &x, &y);
    int direction = 0;
    int x_res;
    int y_res;
    int x_idx = 0;
    int y_idx = 0;
    int val = 0;
    int count = 0;
    int x_sum = 0;
    int y_sum = 0;
    int first_count = 0;

    for(int i=0; i<s.size(); i++){
        if(s[i] == 'F'){
            first_count ++;
        }
        else{
            break;
        }
    }

    for(int i=first_count; i<=s.size(); i++){
        if(s[i] == 'F'){
            if(val == 0){
                direction = direction ^ (count % 2);
                count = 0;
            }
            val++;
        }
        else{
            if(val != 0){
                if(direction == 0){
                    x_dir[x_idx] = val;
                    x_sum -= val;
                    x_idx++;
                }
                else{
                    y_dir[y_idx] = val;
                    y_sum -= val;
                    y_idx++;
                }
                val = 0;
            }
            count++;
        }
    }

    x_res = x - x_sum - first_count;
    y_res = y - y_sum;

    if(x_res < 0 || y_res < 0){
        printf("No\n");
    }
    else{
        x_pos[0][0] = 1;
        y_pos[0][0] = 1;

        for(int i=0; i<x_idx; ++i){
            for(int j=0; j<=x_res; ++j){
                x_pos[i+1][j] |= x_pos[i][j];
                if(j>=x_dir[i]*2){
                    x_pos[i+1][j] |= x_pos[i][j - x_dir[i]*2];
                }
            }
        }

        for(int i=0; i<y_idx; ++i){
            for(int j=0; j<=y_res; ++j){
                y_pos[i+1][j] |= y_pos[i][j];
                if(j>=y_dir[i]*2){
                    y_pos[i+1][j] |= y_pos[i][j - y_dir[i]*2];
                }
            }
        }

        if(x_pos[x_idx][x_res] == 1 && y_pos[y_idx][y_res] == 1){
            printf("Yes\n");
        }
        else{
            printf("No\n");
        }
    }

    return 0;
}


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

    using namespace std;

    const int Nmax = 1e6;
    int n, k, V, i, a[Nmax], lg[Nmax], dp1[Nmax], go1[22][Nmax], dp2[Nmax], go2[22][Nmax], nr[Nmax];

    void compute()
    {
        int l, i, j, ind;
        for(l=0; l<k; ++l)
        {
            go1[l][n+1] = n;
            go2[l][0] = 1;

            for(i=1; i<=n; ++i)
            {
                for(j = i; j+1<=n && a[j+1] - a[j] <= lg[l]; ++j);
                for(ind = i; ind <= j; ++ind)
                    go1[l][ind] = j;

                i = j;
            }

            for(i=n; i; --i)
            {
                for(j = i; j-1>=1 && a[j] - a[j-1] <= lg[l]; --j);
                for(ind = i; ind >= j; --ind)
                    go2[l][ind] = j;

                i = j;
            }
        }
    }

    void dinamique()
    {
        int i, j;
        dp1[0] = 0, dp2[0] = n+1;
        for(i=1; i<(1<<k); ++i)
        {
            dp1[i] = 1;
            dp2[i] = n;

            for(j=0; j<k; ++j)
                if(i&(1<<j))
                {
                    dp1[i] = max(dp1[i], go1[j][ dp1[i^(1<<j)] + 1 ]);
                    dp2[i] = min(dp2[i], go2[j][ dp2[i^(1<<j)] - 1 ]);
                }
        }
    }

    void solve()
    {
        int i, j, ind, mask = (1<<k) - 1;
        bool ok;

        for(i=0; i<=n+1; ++i) nr[i] = -1;

        for(i=0; i<=mask; ++i)
            nr[dp2[i]] = max(nr[dp2[i]], dp1[mask^i]);

        for(i=1; i<=n+1; ++i)
            nr[i] = max(nr[i], nr[i-1]);

        for(i=1; i<=n; ++i)
        {
            for(j = i; j+1<=n && a[j+1] - a[j] <= V; ++j);
            ok = (nr[j+1] >= i-1);

            for(ind = i; ind <= j; ++ind)
                printf("%s\n", ok ? "Possible" : "Impossible");

            i = j;
        }
    }

    int main()
    {
        scanf("%d%d", &n, &V);
        for(i=1; i<=n; ++i) scanf("%d", &a[i]);

        lg[0] = V/2;
        for(i=1; lg[i-1]; ++i) lg[i] = lg[i-1] / 2;
        k = i;

        compute();
        dinamique();
        solve();

        return 0;
    }


Measured memory_bytes: 117888
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>
#include <fstream>

using namespace std;

#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,N) for(long long i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define fi first
#define se second

#define PI acos(-1.0)
#define INF 10e15+9
#define MOD 1000000007
#define EPS 1e-10
#define MAX_N 100100
#define MAX_M 100100

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<double, double> PD;
typedef pair<string, ll> PS;
typedef vector<ll> V;
typedef pair<P, char> PC;

int n, m;
int x, y;
int cnt[100100];
int pos = 1;
bool f[100100];

int main(){
	fill(cnt, cnt + 100100, 1);
	fill(f, f + 100100, 0);
	f[1] = 1;
	cin >> n >> m;
	REP(i, m){
		cin >> x >> y;
		if (f[x]){
			f[y] = 1;
		}
		cnt[x]--;
		cnt[y]++;
		if (cnt[x] == 0){
			f[x] = 0;
		}
	}
	int ans = 0;
	REP(i, n + 1){
		if (f[i])ans++;
	}
	cout << ans << endl;
}

Measured memory_bytes: 768
#include<iostream>
#include<string>
using namespace std;
int main(int argc, char const *argv[]) {
  string a,b,c;
  cin>>a>>b>>c;
  if(a[a.size()-1]==b[0]&&b[b.size()-1]==c[0]){
    std::cout << "YES" << '\n';
  }else{
    std::cout << "NO" << '\n';
  }
  return 0;
}


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

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

  ll l, r;
  cin >> l >> r;
  int ans = 1e15;
  rep(i, l, min(l + 2020, r)) {
    rep(j, l + 1, min(l + 2020, r + 1)) {
      int x = i % 2019;
      int y = j % 2019;
      ans = min(ans, (x * y) % 2019);
    }
  }

  cout << ans << endl;
}


Measured memory_bytes: 3652
#include<cstdio>
#include<queue>
#include<map>
using namespace std;
typedef long long ll;

ll n, a[300000], sum1, sum2, ans, d[300000], d2[300000];
priority_queue<ll, vector<ll>, greater<ll>> pq1;
priority_queue<ll> pq2;

int main() {
  scanf("%lld", &n);
  for (ll i = 0; i < 3*n; i++) scanf("%lld", &a[i]);
  for (ll i = 0; i < n; i++) sum1 += a[i], pq1.push(a[i]);
  d[n-1] = sum1;
  for (ll i = n; i < 2*n; i++) sum1 += a[i], pq1.push(a[i]), sum1 -= pq1.top(), pq1.pop(), d[i] = sum1;
  for (ll i = 2*n; i < 3*n; i++) sum2 += a[i], pq2.push(a[i]);
  d2[2*n] = sum2;
  for (ll i = 2*n-1; i >= n; i--) sum2 += a[i], pq2.push(a[i]), sum2 -= pq2.top(), pq2.pop(), d2[i] = sum2;
  ans = -100000000000000000LL;
  for (ll i = n; i <= 2*n; i++) ans = max(ans, d[i-1] - d2[i]);
  printf("%lld\n", ans);
}


Measured memory_bytes: 7668
#include<iomanip>
#include<limits>
#include<thread>
#include<utility>
#include<iostream>
#include<string>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#include<cmath>
#include<numeric>
#include<cassert>
#include<random>
#include<chrono>
#include<unordered_set>
#include<unordered_map>
#include<fstream>
#include<list>
#include<functional>
#include<bitset>
#include<complex>
#include<tuple>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pi;
typedef pair<double,double> pd;
typedef pair<double,ll> pdl;
#define F first
#define S second
const ll E=1e18+7;
const ll MOD=1000000007;


int main(){
    ll n,a,b;
    cin>>n>>a>>b;
    vector<pll> A(n);
    for(int i=0;i<n;i++){cin>>A[i].F; A[i].S=i;}
    sort(A.begin(),A.end());
    vector<ll> dp(n+1,0);
    vector<ll> next(n+1,0);
    for(auto &I:A){
        ll mi=E;
        for(int i=0;i<=n;i++){
            mi=min(mi,dp[i]);
            if(i<=I.S){next[i]=mi+b;}
            else if(i==I.S+1){next[i]=mi;}
            else{next[i]=mi+a;}
        }
        dp=next;
    }
    ll ans=E;
    for(auto &I:dp){ans=min(ans,I);}
    cout<<ans<<endl;
    
    
    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
struct point{int x;int y;};
int i,j,count1=0,count2=0;

int main(void){
    int n,ans=0,minv=101;
    cin>>n;
    vector<int> vec(n);
    for(i=0;i<n;i++){
        cin>>vec[i];
        ans+=vec[i];
        if(vec[i]%10==0)count1++;
        else{
            minv=min(minv,vec[i]);
        }
    }
    if(count1==n){
        cout<<0<<endl;
        return 0;
    }
    if(ans%10!=0){
        cout<<ans<<endl;
    }else{
        cout<<ans-minv<<endl;
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <utility>
typedef long long ll;
ll MOD = 1e9+7;

using namespace std;

ll a[100000];
ll b[100000];
ll m[100000];

int main()
{
	int n;
	ll ans=0;
	
	cin>>n;
	for(int i=0;i<n;i++)
		cin>>a[i]>>b[i];
	for(int i=0;i<n;i++)
	{
		m[i]=b[i]-(a[i]%b[i]);
	}

	for(int i=n-1;i>-1;i--)
	{
		m[i]=(m[i]-ans)%b[i];
		if(m[i]<0)
			m[i]+=b[i];
		ans+=m[i];
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 2560
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <random>
#include <chrono>
#include <queue>
#include <ctime>
#include <cassert>
using namespace std;
typedef long long ll;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
#define fs first
#define sc second
#define INF 1000000000
#define MOD 1000000007
#define EPS 0.00000001


int main(){
    string S; cin >> S;
    vector<int> A(26);
    for(int i=0; i<(int)S.size(); i++){
        A[S[i]-'a']++;
    }
    
    for(int i=0; i<26; i++){
        if(A[i]>=2){
            cout << "no" << endl;
            return 0;
        }
    }
    cout << "yes" << endl;
    return 0;
}





Measured memory_bytes: 256
#include <vector>
#include <iostream>
using namespace std;
const int mod = 1000000007;
int main() {
	int N;
	cin >> N;
	vector<int> inv(N + 1); inv[1] = 1;
	for (int i = 2; i <= N; ++i) inv[i] = (long long)(inv[mod % i]) * (mod - mod / i) % mod;
	int fact = 1;
	for (int i = 1; i <= N; ++i) fact = (long long)(fact)* i % mod;
	vector<int> harmony(N + 1);
	for (int i = 1; i <= N; ++i) {
		harmony[i] = (harmony[i - 1] + (long long)(fact) * inv[i]) % mod;
	}
	int ans = 0;
	for (int i = 0; i < N; ++i) {
		int a;
		cin >> a;
		int multiplier = ((harmony[i + 1] + harmony[N - i]) % mod - fact + mod) % mod;
		ans = (ans + (long long)(a)* multiplier) % mod;
	}
	cout << ans << endl;
	return 0;
}

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

using namespace std;

typedef long long int ll;
typedef long double ld;
typedef unsigned long long int ull;
typedef pair<ll,ll> pll;
typedef pair<int, int> pii;

#define N 100010
#define M 200010
#define endl "\n"
#define mod 1000000007 

int main(){
	
	ios_base::sync_with_stdio(0);
	cin.tie(0);cout.tie(NULL);
	
	int n;
	
	cin >> n;
	
	int d = ceil((double) n / 1000.0);
	
	cout << d * 1000 - n << endl;
	
	return 0;
}

Measured memory_bytes: 3644
n = int(input())
numbers = list(map(int,input().split()))

Alice_point = 0
Bob_point = 0
Alice_flag = 1
Bob_flag = 0
for _ in range(n):
    if Alice_flag:
        Alice_point+=max(numbers)
        numbers.remove(max(numbers))
        Alice_flag=0
        Bob_flag=1
    elif Bob_flag:
        Bob_point+=max(numbers)
        numbers.remove(max(numbers))
        Alice_flag=1
        Bob_flag=0

print(Alice_point-Bob_point)

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

int main(void){
    int h, w;
    cin >> h >> w;

    vector<string> s(h);
    for(int i = 0; i < h; i++){
        string t;
        cin >> s.at(i);
    }

    vector<vector<string>> check(h, vector<string>(w));

    for(int i = 0; i< h; i++){
        for(int j  = 0; j < w; j++){
            int cnt = 0;
            if(s.at(i).at(j) == '#'){
                check.at(i).at(j) = '#';
            }
          else{
             if(0 <= i + 1 && i+1 <= h-1 && 0 <= j && j <= w-1 ){
              if( s.at(i+1).at(j) == '#'){
                 cnt++;
              }
            }
            if(0 <= i + 1 && i+1 <= h-1 && 0 <= j+1 && j+1 <= w-1){
              if(s.at(i+1).at(j+1) == '#'){
                cnt++;
              }
            }
            if(0 <= i && i <= h-1 && 0 <= j+1 && j+1 <= w-1){
              if(s.at(i).at(j+1) == '#'){
                cnt++;
              }
            }
            if(0 <= i -1 && i-1 <= h-1 && 0 <= j+1 && j+1 <= w-1){
              if(s.at(i-1).at(j+1) == '#'){
                   cnt++;
              }
            }
            if(0 <= i -1 && i-1 <= h-1 && 0 <= j && j <= w-1){
              if(s.at(i-1).at(j) == '#'){
                 cnt++;
              }
            }
            if(0 <= i -1 && i-1 <= h-1 && 0 <= j-1 && j-1 <= w-1){
              if(s.at(i-1).at(j-1) == '#'){
                  cnt++;
              }
            }
            if(0 <= i && i <= h-1 && 0 <= j-1 && j-1<= w-1){
              if(s.at(i).at(j-1) == '#'){
                cnt++;
              }
            }
            if(0 <= i + 1 && i+1 <= h-1 && 0 <= j-1 && j-1 <= w-1){
              if(s.at(i+1).at(j-1) == '#'){
                cnt++;
              }
            }
            check.at(i).at(j) = '0' + cnt;
          }

           
        }
    }
    
   for(int i = 0; i<h; i++){
        for(int j = 0; j < w; j++){
            cout << check.at(i).at(j);
        }
        cout << "" << endl;
    }
    return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(n) begin(n), end(n)
using ll = long long;
using namespace std;

int main(){
	int n, start;
	cin >> n >> start;
	vector<int> x(n);
	rep(snip_i, n) cin >> x.at(snip_i);
	x.push_back(start);
	sort(x.begin(), x.end());
	vector<int> diff(n);
	rep(i, x.size()-1){
		diff.at(i) = x.at(i+1) - x.at(i);
	}
	int ans;
	rep(i, n){
		if(i == 0) ans = diff.at(i);
		else ans = __gcd(ans, diff.at(i));
	}
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 1024
///スマホコーディング
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<int(n);++i)
typedef long long ll;
const int inf=1e9;
int main(){
  int n;cin>>n;
  string s=to_string(n);
  int a=0;
  rep(i,s.size())a+=s[i]-'0';
  if(n%a==0)puts("Yes");
  else puts("No");
  return 0;
}

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

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

    long long n, t;
    cin >> n >> t;
    
    long long bt, ans = t;
    REP(i, n){
        long long a;
        cin >> a;
        if(i){
            if(bt + t <= a) ans += t;
            else ans += a - bt;
        }
        bt = a; 
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<string.h>
#include<math.h>
#include<utility>
#include<map>
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vi;
typedef vector<string> vs;
typedef pair<ll,ll> P;
typedef vector<P> vp;
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define REPR(i,n) for(int i=n-1;i>=0;i--)
#define FORR(i,n,m) for(int i=n-1;i>=m;i--)
#define all(in) in.begin(),in.end()
#define ALL(in,K) in,in+K
#define INF 100000000
#define MOD 100000007
#define SIZE 100005
#define PI 	3.14159265358979323846

ll sum(ll x,ll y,ll* num){
    if(x==num[1] && y==num[2]){return num[0];}
    if(x==num[2] && y==num[4]){return num[0];}
    if(x==num[4] && y==num[3]){return num[0];}
    if(x==num[3] && y==num[1]){return num[0];}
    if(x==num[5] && y==num[2]){return num[1];}
    if(x==num[2] && y==num[0]){return num[1];}
    if(x==num[0] && y==num[3]){return num[1];}
    if(x==num[3] && y==num[5]){return num[1];}
    if(x==num[1] && y==num[5]){return num[2];}
    if(x==num[5] && y==num[4]){return num[2];}
    if(x==num[4] && y==num[0]){return num[2];}
    if(x==num[0] && y==num[1]){return num[2];}
    if(x==num[1] && y==num[0]){return num[3];}
    if(x==num[0] && y==num[4]){return num[3];}
    if(x==num[4] && y==num[5]){return num[3];}
    if(x==num[5] && y==num[1]){return num[3];}
    if(x==num[2] && y==num[5]){return num[4];}
    if(x==num[5] && y==num[3]){return num[4];}
    if(x==num[3] && y==num[0]){return num[4];}
    if(x==num[0] && y==num[2]){return num[4];}
    if(x==num[4] && y==num[2]){return num[5];}
    if(x==num[2] && y==num[1]){return num[5];}
    if(x==num[1] && y==num[3]){return num[5];}
    if(x==num[3] && y==num[4]){return num[5];}
    return 0;
}

int main(){
    ll num[6];
    REP(i,6){
        cin >> num[i];
    }

    ll n;
    cin >> n;

    REP(i,n){
        ll x,y;
        cin >> x >> y;
        cout << sum(x,y,num) << endl;
    }
    return 0;
}


Measured memory_bytes: 3000