akhauriyash/Code-Regression huggingface dataset:
using System;
using static System.Console;

namespace abc167
{
    class Program
    {
        static int[] ReadNumList()
        {
            var line = Console.ReadLine().Split(' ');
            if (line.Length == 1 && string.IsNullOrEmpty(line[0]))
            {
                return new int[0];
            }
            var numList = new int[line.Length];
            for (var i = 0; i < line.Length; ++i)
            {
                numList[i] = int.Parse(line[i]);
            }
            return numList;
        }
        static void Main()
        {
            var nmx = ReadLine().Split(' ');
            var n = int.Parse(nmx[0]);
            var m = int.Parse(nmx[1]);
            var x = int.Parse(nmx[2]);
            var cTable = new int[n][];
            for (var i = 0; i < n; ++i)
            {
                cTable[i] = ReadNumList();
            }

            var min = int.MaxValue;
            var end = (int)Math.Pow(2, n);
            for (var bit = 0; bit < end; ++bit)
            {
                min = Math.Min(min, GetPrice(n, bit, cTable, x));
            }
            WriteLine(min == int.MaxValue ? -1 : min);
        }
        static int GetPrice(int n, int bit, int[][] cTable, int x)
        {
            var skills = new int[cTable[0].Length - 1];
            var total = 0;
            for (var i = 0; i < n; ++i)
            {
                if (((bit >> i) & 1) == 1)
                {
                    for (var a = 0; a < cTable[0].Length - 1; ++a)
                    {
                        skills[a] += cTable[i][a + 1];
                    }
                    total += cTable[i][0];
                }
            }
            for (var a = 0; a < skills.Length; ++a)
            {
                if (skills[a] < x)
                {
                    return int.MaxValue;
                }
            }
            return total;
        }
    }
}


Measured memory_bytes: 28040
#[allow(unused_imports)]
use proconio::{
    fastout, input,
    marker::{Bytes, Chars, Isize1, Usize1},
};

#[allow(unused_macros)]
macro_rules! echo {
    ($($e:expr),+) => ( { $(println!("{}", $e))+ } );
}

#[derive(Clone, Copy, Debug)]
pub struct Mint {
    value: u32,
}

impl std::ops::Add for Mint {
    type Output = Mint;
    fn add(self, rhs: Mint) -> Self::Output {
        let mut d = self.value + rhs.value;
        if d >= Self::MODULUS {
            d -= Self::MODULUS;
        }
        Mint::new(d)
    }
}

impl std::ops::AddAssign for Mint {
    fn add_assign(&mut self, rhs: Mint) {
        *self = *self + rhs;
    }
}

impl std::ops::Sub for Mint {
    type Output = Mint;
    fn sub(self, rhs: Mint) -> Self::Output {
        let mut d = self.value + Self::MODULUS - rhs.value;
        if d >= Self::MODULUS {
            d -= Self::MODULUS;
        }
        Mint::new(d)
    }
}

impl std::ops::SubAssign for Mint {
    fn sub_assign(&mut self, rhs: Mint) {
        *self = *self - rhs;
    }
}

impl std::ops::Mul for Mint {
    type Output = Mint;
    fn mul(self, rhs: Mint) -> Self::Output {
        let d = self.value as u64 * rhs.value as u64 % Self::MODULUS as u64;

        Mint::new(d as u32)
    }
}

impl std::ops::MulAssign for Mint {
    fn mul_assign(&mut self, rhs: Mint) {
        *self = *self * rhs;
    }
}

impl std::ops::Neg for Mint {
    type Output = Mint;

    fn neg(self) -> Self::Output {
        let d = match self.value {
            0 => 0,
            _ => Self::MODULUS - self.value,
        };

        Mint::new(d)
    }
}

impl std::fmt::Display for Mint {
    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
        write!(f, "{}", self.value)
    }
}

impl From<usize> for Mint {
    fn from(val: usize) -> Self {
        let d = (val % Self::MODULUS as usize) as u32;

        Mint::new(d)
    }
}

impl PartialEq<Self> for Mint {
    fn eq(&self, other: &Self) -> bool {
        self.value == other.value
    }
}

impl PartialEq<u32> for Mint {
    fn eq(&self, other: &u32) -> bool {
        self.value == *other
    }
}

#[allow(dead_code)]
impl Mint {
    // to change modulus, rewrite this value
    // (modulus should be a prime number)
    pub const MODULUS: u32 = 1_000_000_007;

    pub fn new(n: u32) -> Self {
        Self {
            value: n % Self::MODULUS,
        }
    }

    pub fn pow(self, mut n: u32) -> Mint {
        let mut t = Mint::new(1);
        let mut s = self;
        while n > 0 {
            if n & 1 == 1 {
                t *= s;
            }
            s *= s;
            n >>= 1;
        }
        t
    }

    pub fn inv(self) -> Mint {
        assert!(self.value > 0);
        self.pow(Self::MODULUS - 2)
    }

    pub fn value(&self) -> u32 {
        self.value
    }
}

fn calc(i: Mint, n: Mint) -> Mint {
    n * i - i * i + i + Mint::new(1)
}

fn main() {
    input! {
        n: usize,
        k: usize,
    }

    let n_mod = Mint::new(n as u32);
    let mut sum = Mint::new(0);

    for i in k..=n+1 {
        sum += calc(Mint::new(i as u32), n_mod);
    }

    echo!(sum);
}


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

int main(){
    const double pi = 3.1415926535;
    double r; cin >> r;
    // printf("%.20lf\n", 2*pi*r);
    cout << 2*pi*r << endl;

    return 0;
}

Measured memory_bytes: 3788
#include<cstdio>
#include<algorithm>
#include<queue>
using namespace std;const int N=2*1e5+10;
int w[N];int d[N];int cnt[20];int res;int n;int st;bool book[N];int sxr[N]; 
int main()
{
    scanf("%d",&n);
    for(int i=1,u,v,va;i<n;i++){scanf("%d%d%d",&u,&v,&va);w[u]^=va;w[v]^=va;}
    for(int i=0;i<n;i++){cnt[w[i]]++;}//贪心 
    for(int i=1;i<=15;i++)res+=cnt[i]/2,st|=(cnt[i]&1)<<(i-1);  
    for(int i=1;i<(1<<15);i++)d[i]=d[i>>1]+(i&1);
    for(int i=1;i<(1<<15);i++)d[i]-=1;//预处理每个dp值的下界 
    for(int i=1;i<(1<<15);i++)
        for(int j=0;j<15;j++)if((i>>j)&1)sxr[i]^=(j+1);//预处理集合的异或和 
    for(int i=1;i<(1<<15);i++)//枚举子集进行转移 
    {
        if(sxr[i]!=0)continue;
        for(int k=(i-1)&i;k;k=(k-1)&i)
            if(sxr[k]==0)d[i]=min(d[i],d[k]+d[i^k]);
    }printf("%d",res+d[st]);return 0;
}

Measured memory_bytes: 768
# -*- coding: utf-8 -*-
import sys
import math
from bisect import bisect_left
from bisect import bisect_right
import collections
import copy
import heapq
from collections import defaultdict
from heapq import heappop, heappush
import itertools
input = sys.stdin.readline

##### リストの 二分木検索 #####
# bisect_left(lists, 3)
# bisect_right(lists, 3)

##### プライオリティキュー #####
# heapq.heapify(a) #リストaのheap化
# heapq.heappush(a,x) #heap化されたリストaに要素xを追加
# heapq.heappop(a) #heap化されたリストaから最小値を削除＆その最小値を出力

# heapq.heappush(a, -x) #最大値を取り出す時は、pushする時にマイナスにして入れよう
# heapq.heappop(a) * (-1) #取り出す時は、-1を掛けて取り出すこと

##### タプルリストのソート #####
# sorted(ans) #(a, b) -> 1st : aの昇順, 2nd : bの昇順
# sorted(SP, key=lambda x:(x[0],-x[1])) #(a, b) -> 1st : aの昇順, 2nd : bの降順
# sorted(SP, key=lambda x:(-x[0],x[1])) #(a, b) -> 1st : aの降順, 2nd : bの昇順
# sorted(SP, key=lambda x:(-x[0],-x[1])) #(a, b) -> 1st : aの降順, 2nd : bの降順

# sorted(SP, key=lambda x:(x[1])) #(a, b) -> 1st : bの昇順
# sorted(SP, key=lambda x:(-x[1])) #(a, b) -> 1st : bの降順

def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))

def main():
	I = input()
	I = I[:-1]
	II = I.split()
	ans = II[1] + II[0]

	print(ans)



if __name__ == "__main__":
	main()


Measured memory_bytes: 38384
import sys


def main():
    ab = sys.stdin.readline().strip()
    a, b = [int(s) for s in ab.split(' ')]

    need = b - 1
    inc = a - 1

    if need % inc:
        plus_one = 1
    else:
        plus_one = 0

    ans = need // inc + plus_one
    print(ans)


main()


Measured memory_bytes: 38384
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define endl '\n'
#define minimum(a,b) if(a>b) a=b;
typedef vector<vector<ll>> matrix;
const ll INF = 1e18;
const int MAX = 2e5+4;
const int MOD = 1e9+7;
//vector<vector<ll>> dp(MAX,vector<ll>(3));
vector<ll> dp(MAX,INF);
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	int n,w;
	cin >> n >> w;
	vector<int> a(n+1);
	ll ans=0;
	dp[0]=0;
	for(int i=1;i<=n;i++)
	{
		int a,b;
		cin >> a >> b;
		for(int j=100000;j>=b;j--)
		{
			dp[j]=min(dp[j],dp[j-b]+1LL*a);
		}
	}
	for(int i=0;i<=100000;i++)
	{
		if(dp[i]<=w) ans=max(ans,1LL*i);
//		cout << dp[i] << endl;
}
	cout << ans;
	return 0;
}

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

int main(){
	vector<int> abc(3);
	cin >> abc.at(0)
        >> abc.at(1)
        >> abc.at(2);
	int ans = 0;
	while (1) {
        if (abc.at(0) == abc.at(1) && abc.at(1) == abc.at(2)) {
            break;
        }
		sort(abc.begin(), abc.end());
        if (abc.at(1) == abc.at(2)) {
            abc.at(0) += 2;
        } else {
            abc.at(0)++;
            abc.at(1)++;
        }
		ans++;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
//============================================================================
// Name        : template.cpp
// Author      : 
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include <algorithm>
#include <set>
#include <map>
#include <set>
#include <vector>
#include <string.h> // for memset in CF judge.
using namespace std;
#define _CRT_SECURE_NO_DEPRECATE // suppress some compilation warning messages (for VC++ users)
// Shortcuts for "common" data types in contests
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef set<int> si;
typedef map<string, int> msi;
// To simplify repetitions/loops, Note: define your loop style and stick with it!
#define x first
#define y second
#define pb push_back
#define mp make_pair
#define REP(i, a, b) \
for (int i = int(a); i <= int(b); i++) // a to b, and variable i is local!
#define forn(i,n) \
for (int i =0; i<(n); i++)
#define TRvi(c, it) \
for (vi::iterator it = (c).begin(); it != (c).end(); it++)
#define TRvii(c, it) \
for (vii::iterator it = (c).begin(); it != (c).end(); it++)
#define TRmsi(c, it) \
for (msi::iterator it = (c).begin(); it != (c).end(); it++)
#define INF 2000000000 // 2 billion
// If you need to recall how to use memset:
#define MEMSET_INF 127 // about 2B
#define MEMSET_HALF_INF 63 // about 1B
//memset(dist, MEMSET_INF, sizeof dist); // useful to initialize shortest path distances
//memset(dp_memo, -1, sizeof dp_memo); // useful to initialize DP memoization table
//memset(arr, 0, sizeof arr); // useful to clear array of integers

int main() {
	int N, M;
	cin >> N >> M;
	vector<ii> p; vector<ii> q;
	forn(i,N) {
		int x, y = 0;
		cin >> x >> y;
		ii pr = make_pair(x,y);
		p.pb(pr);

	}
	forn(i,M) {
		int x, y = 0;
		cin >> x >> y;
		ii pq = make_pair(x,y);
		q.pb(pq);
	}



	int dn[M];  int currmin = 10e5; int sol[N]; int lest = -1;

	for(int i = 0; i < N; i++) {
		 lest = 1;
		 int xa = p[i].first; int ya = p[i].second;
		 currmin = abs(xa -q[0].first) + abs(ya - q[0].second);

		for(int j = 0; j <M; j++) {
			// cout << "This is j" << j << endl;
			// if(dn[j] == 1) continue;
			// cout << "Did not coninue" << endl;
			int xb = q[j].first; int yb = q[j].second;
			int man = (abs(xa-xb) + abs(ya-yb));
			// cout << "This is man " << man << endl;
			if( man < currmin) {
				currmin = man;
				lest = j+1;
			} 
		}
		// cout << "lest for i is " << lest << " " << i << endl;
		sol[i] = lest;
	}

	 forn(i, N) {
	 	cout << sol[i] << endl;
	 }
return 0;
}


Measured memory_bytes: 256
import java.util.*;
import static java.lang.Integer.*;
import static java.lang.Long.*;
//import static java.lang.Math.*;
import static java.lang.System.*;

public class Main {
	public static void main(String[] args) {
		int i,j;
		Scanner sc = new Scanner(in);
		int n = parseInt(sc.next());
		int k = parseInt(sc.next());
		HashMap<Integer, Integer> a = new HashMap<>();
		int aa=0;
		for(i=0;i<n;i++) {
			aa = parseInt(sc.next());
			if(a.get(aa) == null) {
				a.put(aa, 1);
			} else {
				a.put(aa, a.get(aa)+1);
			}
		}
		sc.close();
		ArrayList<Integer> list = new ArrayList<>(a.values());
		Collections.sort(list, Comparator.reverseOrder());
		int cnt=0;
		for(i=0;i<k&&i<list.size();i++) {
			cnt+=list.get(i);
		}
		out.println(n-cnt);
	}
}

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

const ll MAX = 1e18;

int main() {
    cout << fixed << setprecision(10);
    
    int N; cin >> N;
    vector<ll> A(N);
    rep(i, N) cin >> A[i];
    
    rep(i, N) {
        if (A[i] == 0) {
            cout << 0 << endl;
            return 0;
        }
    }

    // cout << MAX << endl;

    ll ans = 1;
    int ng = 0;
    rep(i, N) {
        // cout << ans << " " << A[i] << endl;
        if (ng || __int128(ans)*A[i] > MAX) {
            //cout << "ng" << endl;
            ng = 1;
            break;
        }
        ans *= A[i];
    }
    if (ng) {
        cout << -1 << endl;
    } else {
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 3948
#include<iostream>
#include<string>
#include<string.h>
#include<algorithm>
#include<stdio.h>
#include<cmath>
#include<vector>
#include<utility>
#include<stack>
#include<queue>
#include<list>
#include<bitset>

#define FOR(i, a, b) for(int i=(a);i<=(b);i++)
#define RFOR(i, a, b) for(int i=(a);i>=(b);i--)
#define MOD 1000000007
#define INF 1000000000

using namespace std;

int main(void) {
	string s, t;
	string x, y;
	bool flag = false;
	int dp[51] = {};

	cin >> s >> t;

	FOR(i, 0, s.size() - 1) {
		FOR(p, 0, t.size() - 1) {
			if (s[i + p] != t[p] && s[i+p] != '?') {
				break;
			}
			if (p == t.size() - 1) {
				dp[i] = 1;
			}
		}
	}
	FOR(i, 0, 50) {
		if (dp[i] == 1) {
			if (flag == false) {
				flag = true;
				x = s;
				FOR(p, i, i + t.size() - 1) {
					x[p] = t[p - i];
				}
				FOR(p, 0, x.size() - 1) {
					if (x[p] == '?') {
						x[p] = 'a';
					}
				}
			}
			else {
				y = s;
				FOR(p, i, i + t.size() - 1) {
					y[p] = t[p - i];
				}
				FOR(p, 0, x.size() - 1) {
					if (y[p] == '?') {
						y[p] = 'a';
					}
				}
				if (y <= x) {
					x = y;
				}
			}
			
		}
	}
	if (x.size() == 0) {
		cout << "UNRESTORABLE" << endl;
	}
	else {
		cout << x << endl;
	}
	
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include<cmath>
using namespace std;
int x,y;
int main()
{
	cin >> x >> y;

	float mx = y / 2.0;
	float mn = y / 4.0;
	if (y % 2 != 0 || x > mx || x < mn)
		cout << "No";
	else cout << "Yes";
	
}

Measured memory_bytes: 3596
#include<bits/stdc++.h>
#define LL long long
#define pb push_back
#define mp make_pair
#define pii pair<int,int>
using namespace std;
inline int read(){
	int v=0,f=1;
	char c=getchar();
	while (c<'0' || c>'9'){
		if (c=='-') f=-1;
		c=getchar();
	}
	while (c>='0' && c<='9'){
		v=v*10+c-'0';
		c=getchar();
	}
	return v*f;
}
const int Maxn=1005;
char s[Maxn][Maxn];
string t[5]={"aa.cd",".bbcd","g.fee","g.f.j","hhiij"};
string tt[7]={"aa.b.cc",".ddbee.","fghh...","fg....i","n...l.i","n...l.j","..mmkkj"};
int main(){
	int n;
	scanf("%d",&n);
	if (n%3==0){
		for (int i=0;i<n;i++) for (int j=0;j<n;j++) s[i][j]='.';
		for (int i=0;i<n/3;i++){
			int r=i*3;
			s[r][r]=s[r+1][r]=s[r+2][r+1]=s[r+2][r+2]='a';
		}
		for (int i=0;i<n;i++){
			for (int j=0;j<n;j++){
				putchar(s[i][j]);
			}
			puts("");
		}
		return 0;
	}
	if (n==5){
		for (int i=0;i<5;i++){
			cout<<t[i]<<endl;
		}
		cout<<endl;
		return 0;
	}
	if (n==7){
		for (int i=0;i<7;i++){
			cout<<tt[i]<<endl;
		}
		cout<<endl;
		return 0;
	}
	for (int i=0;i<n;i++) for (int j=0;j<n;j++) s[i][j]='.';
	if (n==11){
		for (int i=0;i<5;i++){
			for (int j=0;j<5;j++) s[i][j]=t[i][j];
		}
		for (int i=0;i<1;i++){
			int r=5+i*6;
			s[r][r]=s[r+1][r]=s[r+1][r+2]=s[r+2][r+2]='a';
			s[r][r+1]=s[r][r+2]=s[r+2][r]=s[r+2][r+1]='b';
			r+=3;
			s[r][r]=s[r+1][r]=s[r+1][r+2]=s[r+2][r+2]='a';
			s[r][r+1]=s[r][r+2]=s[r+2][r]=s[r+2][r+1]='b';
			r-=3;
			s[r+3][r]=s[r+1+3][r]=s[r+2+3][r+1]=s[r+2+3][r+2]='c';
			s[r][r+3]=s[r+1][r+3]=s[r+2][r+1+3]=s[r+2][r+2+3]='c';
		}
		for (int i=0;i<n;i++){
			for (int j=0;j<n;j++){
				putchar(s[i][j]);
			}
			puts("");
		}
		return 0;
	}
	if (n==2){
		printf("-1\n");
		return 0;
	}
	int a,b,c;
	for (int t=0;t<=1000;t++){
		for (int s=0;s<=1000;s++){
			if ((n-6*t-4*s)>=0 && (n-6*t-4*s)%9==0){
				a=t,b=s,c=(n-6*t-4*s)/9;
			}
		}
	}
	for (int i=0;i<a;i++){
		int r=i*6;
		s[r][r]=s[r+1][r]=s[r+1][r+2]=s[r+2][r+2]='a';
		s[r][r+1]=s[r][r+2]=s[r+2][r]=s[r+2][r+1]='b';
		r+=3;
		s[r][r]=s[r+1][r]=s[r+1][r+2]=s[r+2][r+2]='a';
		s[r][r+1]=s[r][r+2]=s[r+2][r]=s[r+2][r+1]='b';
		r-=3;
		s[r+3][r]=s[r+1+3][r]=s[r+2+3][r+1]=s[r+2+3][r+2]='c';
		s[r][r+3]=s[r+1][r+3]=s[r+2][r+1+3]=s[r+2][r+2+3]='c';
	}
	for (int i=0;i<b;i++){
		int r=a*6+i*4;
		s[r][r]=s[r][r+1]='a';
		s[r+1][r]=s[r+1][r+1]='b';
		s[r][r+2]=s[r+1][r+2]='c';
		s[r][r+3]=s[r+1][r+3]='d';
		s[r+2][r]=s[r+3][r]='e';
		s[r+2][r+1]=s[r+3][r+1]='f';
		s[r+2][r+2]=s[r+2][r+3]='g';
		s[r+3][r+2]=s[r+3][r+3]='h';
	}
	for (int i=0;i<c;i++){
		int r=a*6+b*4+i*9;
		for (int x=0;x<3;x++){
			for (int y=0;y<3;y++){
				int A=r+x*3,B=r+y*3;
				s[A][B]=s[A+1][B]=s[A+2][B+1]=s[A+2][B+2]='a';
			}
		}
	}
	for (int i=0;i<n;i++){
		for (int j=0;j<n;j++){
			putchar(s[i][j]);
		}
		puts("");
	}
}

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

using namespace std;
using   ll=long long;

#define fast        	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)

#define endl        	"\n"
#define pb          	push_back
#define mp          	make_pair
#define F           	first
#define S           	second
#define int             long long int
#define pll				pair<int , int>

#define ALL(v)      	v.begin(),v.end()
#define ALLR(v)     	v.rbegin(),v.rend()
#define pii         	3.14159265358979323
#define inf     		LLONG_MAX
#define ones(x)     	__builtin_popcount(x)
#define fill(a,b)   	memset(a,b,sizeof(a))
#define mod 			1000000007
#define hell            998244353 

ll mod_pow(ll a,ll b,ll m) 
{
    ll res = 1;
    while(b)	
    {
        if(b&1) 	
        {
        	res=(res*a) % m;
        }
        a=(a*a) % m;
        b>>=1;
    }
    return res;
}

ll mod_inverse(ll a) 
{
	return mod_pow(a , mod-2 , mod);
}

int fun(pair<string ,int> & u ,pair<string , int> & v) {
	if(u.F == v.F) {
		return u.S > v.S;
	}
	else {
		return u.F < v.F;
	}
}
 
void solve()
{
	int n;
	
	cin >> n;
	
	vector<pair<string , int>> a(n);
	
	map<int , int> id;
	
	for(int i = 0; i < n; ++i) {
		cin >> a[i].F >> a[i].S;
		id[a[i].S] = i+1;
	}
	
	sort(ALL(a) , fun);
	
	for(int i = 0; i < n; ++i) {
		cout << id[a[i].S] << endl;
	}
}

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


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

#define REP(i, n, N) for(ll i=(n); i<(N); i++)
#define RREP(i, n, N) for(ll i=(N-1); i>=(n); i--)
#define LREP(lst,itr) for(auto itr = lst.begin(); itr != lst.end(); ++itr)
#define CK(n, a, b) ((a)<=(n)&&(n)<(b))
#define ALL(v) (v).begin(),(v).end()
#define MCP(a, b) memcpy(b,a,sizeof(b))
#define P(s) cout<<(s)<<endl
#define P2(a, b) cout<<(a)<<" "<<(b)<<endl
#define P3(a, b, c) cout<<(a)<<" "<<(b)<<" "<<(c)<<endl
#define V2(T) vector<vector<T>>
typedef long long ll;
using namespace std;
const ll MOD = 1e9 + 7;
const ll INF = 1e18;

int main(){
    string s;
    cin >> s;
    REP(i,0,s.size()-1){
        if(s[i]==s[i+1]){
            P2(i+1,i+2);
            return 0;
        }
    }
    REP(i,0,s.size()-2){
        set<char> st;
        REP(j,0,3){
            st.insert(s[i+j]);
        }
        if(st.size()<=2){
            P2(i+1,i+3);
            return 0;
        }
        st.clear();
    }

    P2(-1,-1);
    return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <list>
#include <queue>
#include <sstream>
#include <cmath>
#include <functional>
using namespace std;

#define rep(i,n) for(int i=0;i<n;i++)
#define reps(s,i,n) for(int i=s;i<n;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define skip(i,n,p) for(int i=0;i<n;i+=p)
#define all(a)  (a).begin(),(a).end()
#define int64 long long
#define debug cerr << __FILE__ << ":" << __LINE__ << endl;
#define INF 2147483647

struct Init {
    Init() {
        cin.tie(0);
        ios::sync_with_stdio(false);
        cout.precision(20);
        cout << fixed;
    }
} init;

template <typename _Ty>
ostream& operator << (ostream& ostr, const vector<_Ty>& v) {
    for(int i = 0; i < (int) v.size(); i++) {
        ostr << v[i] << (i + 1 != v.size() ? " " : "");
    }
    return ostr;
}

template <typename _K, typename _V>
ostream& operator << (ostream& ostr, const map<_K, _V>& v) {
    ostr << "{";
    for (auto iter = v.begin(); iter != v.end(); ++iter) {
        ostr << (*iter).first << ": " << (*iter).second << ", ";
    }
    ostr << "}";
    return ostr;
}

template <typename _K>
ostream& operator << (ostream& ostr, const set<_K>& v) {
    for (auto iter = v.begin(); iter != v.end(); ++iter) {
        ostr << *iter << (iter != v.end() ? " " : "");
    }
    return ostr;
}

template <typename _K, typename _V>
ostream& operator << (ostream& ostr, const pair<_K, _V>& v) {
    ostr << v.first << " " << v.second;
    return ostr;
}

int main() {
    int n; cin >> n;
    vector<int> L(n); rep(i, n) cin >> L[i];

    int64 ans = INF;
    rep(j, 1000) {
        int64 a = 0;
        rep(i, n) {
            if (L[i] > j) {
                int t = L[i] - j;
                a += t * t;
            } else {
                int t = j - L[i];
                a += t * t;
            }
        }

        ans = min(ans, a);
    }

    cout << ans << endl;
}


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

using namespace std;

#define OUT(x)                cout << #x << " = " << x << endl; 
#define rep(i, n)             for (int (i) = 0; (i) < (int)(n); (i)++)
#define rer(i, l, r)          for (int (i) = (int)(l); (i) <= (int)(r); (i)++)
#define reu(i, l, r)          for (int (i) = (int)(l); (i) < (int)(r); (i)++)
#define each(i, v)            for (auto i : v)
#define all(x)                (x).begin(), (x).end()
#define rall(x)               (x).rbegin(), (x).rend()
#define pb(x)                 push_back(x)
#define bp(x)                 __builtin_popcount(x)
#define mp(x, y)              make_pair((x), (y))
#define fi                    first
#define se                    second
#define setp(x)               setprecision(x)
#define mset(m, v)            memset(m, v, sizeof(m))

static const int INF        = 0x3f3f3f3f;
static const long long INFL = 0x3f3f3f3f3f3f3f3fLL;
static const int MOD        = 1000000007;
static const double PI      = 3.14159265358979;

#define int                   long long

typedef vector<double>        vd;
typedef vector<string>        vs;
typedef vector<bool>          vb;
typedef vector<int>           vi;
typedef pair<int, int>        pii;
typedef vector<pii>           vpii;

template<typename T> void pv(T a, T b) { for (T i = a; i != b; i ++) cout << *i << " "; cout << endl; }
template<typename T, typename U> inline void amin(T &x, U y) { if (y < x) x = y; }
template<typename T, typename U> inline void amax(T &x, U y) { if (x < y) x = y; }
inline int in() { int _x; cin >> _x; return _x; }
      
signed main() { 
        int a, b, c;
        cin >> a  >> b >> c;
        puts(a <= c && c <= b ? "Yes" : "No");
        return 0;
}               



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

using namespace std;

int main()
{
      ll n , k;
      cin >> n >> k;

      vector < ll > v;

      for (int i=0 ; i<n;i++){
            ll a;
            cin >> a;

            v.push_back(a);
      }

      sort(v.begin(),v.end());

      ll ans = 0;

      for (int i=0 ; i<min(k,n) ; i++)ans+=v[i];

      cout << ans << endl;

      return 0;
}


Measured memory_bytes: 3640
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<vector>
#include<deque>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<algorithm>
#include<functional>
#include<utility>
#include<bitset>
#include<cmath>
#include<cstdlib>
#include<ctime>
#include<cstdio>
#include<bits/stdc++.h>
using namespace std;
int dp[404040],n;
vector<int>v;
int main()
{
	cin>>n;
	for(int i=0;i<404040;i++)
	{
		dp[i]=1e9;
	}
	dp[0]=0;
	dp[1]=1;
	v.push_back(1);
	for(int i=6;i<=100000;i*=6)
	{
		v.push_back(i);
	}
	for(int i=9;i<=100000;i*=9)
	{
		v.push_back(i);
	}
	sort(v.begin(),v.end());
	for(int i=0;i<=101000;i++)
	{
		for(int j=0;j<v.size();j++)
		{
			dp[i+v[j]]=min(dp[i+v[j]],dp[i]+1);
		}
	}
	cout<<dp[n]<<endl;
	return 0;
}

Measured memory_bytes: 1792
#include <iostream>
using namespace std;
int main()
{
    int a,b,x,y,z;
    cin >> a>>b;
    x = a+ b;
    y = a -b;
    z = a*b;
    if(x<y)
    {
        x = y;
    }
    if(x<z)
    {
        x = z;
    }
    cout << x << endl;
    return 0;
}


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

int main(){
  int N;
  cin >> N;
  if (N % 2 != 0){
    cout << N / 2 + 1 << endl;
  }
  else
  {
    cout << N / 2 << endl;
  }
  
}

Measured memory_bytes: 3632
#include<iostream>
using namespace std;
#define ll long long int
int main()
{
	ll n,r,sum=0;
  	cin>>n>>r;
   	if(n<10)
    {
      sum=sum+r+(100*(10-n));
    }
  	else
    {
      sum+=r;
    }
	cout<<sum;
}

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

int main(){
  int N, X, Y;
  cin >> N >> X >> Y;
  X--; Y--;
  //ここまで入力
  
  int i, j, k;
  int dist[N][N] = {{0}};
  //隣り合う頂点の距離は1
  rep(i, N-1){
    dist[i][i+1] = 1;
    dist[i+1][i] = 1;
  }

  //近道なしで直接訪問したとき
  for(i=0; i<N; i++){
    for(j=i+1; j<N; j++){
      dist[j][i] = j-i;
      dist[i][j] = j-i;
    }
  }

  //問題より，XとYの距離は1
  dist[X][Y] = 1;
  dist[Y][X] = 1;
  
  // shortcut
  int shor;

  //ショートカットを使うときの最短経路を計算する
  for(i=0; i<N; i++){
    for(j=i+1; j<N; j++){
      shor = dist[i][X] + 1 + dist[j][Y];
      dist[j][i] = min(dist[j][i], shor);
      dist[i][j] = min(dist[i][j], shor);
    }
  }
  
  //距離がiの2頂点をカウントする
  int counter[N] = {0};
  for(i=1; i<N; i++)
    for(j=0; j<i; j++)
      counter[dist[i][j]-1 ]++;
  
  rep(i, N-1)
    cout << counter[i] << endl;
  
  return 0;
}


Measured memory_bytes: 15872
#ifndef LOCAL
#pragma GCC optimize("O3")
#endif
#include "bits/stdc++.h"
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << '\n'; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);
typedef long long ll;
const ll MOD = 1e9 + 7 ;
const ll N = 4e5 + 10 ;
const ll INF = 1e18 + 10 ;
int main(){
    fastio
    int k , n ; 
    cin >> k >> n ; 
    if ( k * 500 >= n ){
        cout << "Yes" << endl;
    }
    else cout << "No" << endl;
    return 0; 
}

Measured memory_bytes: 256
#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);

    double delta;
    cin >> delta;
    delta *= pi / 180;

    int res = 0;
    double x = 0;
    double y = 0;
    double al = 0;
    while (abs(x) > eps || abs(y) > eps || res == 0) {
        ++res;
        x += cos(al);
        y += sin(al);
        al += delta;
    }

    cout << res << "\n";


    return 0;
}


Measured memory_bytes: 4108
#include <algorithm>
#include <iostream>
#include <vector>

using namespace std;

typedef long long ll;

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

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

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

    int count = 0;
    bool ok = true;
    for (int i = 0; i < n; i++) {
        char c;
        int x;
        cin >> c >> x;

        if (c == '(') {
            count += x;
        } else {
            count -= x;
            if (count < 0) {
                ok = false;
                break;
            }
        }
    }

    if (count > 0) {
        ok = false;
    }

    if (ok) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }

    return 0;
}



Measured memory_bytes: 3108
bingo=[list(map(int,input().split())) for _ in range(3)]
N=int(input())
D=[[0]*3 for _ in range(3)]

for _ in range(N):
    b=int(input())
    for i in range(3):
        for j in range(3):
            if b==bingo[i][j]:
                D[i][j]=1
ans=set()
for d in D:
    ans.add(sum(d))
for d in zip(*D):
    ans.add(sum(d))
ans.add(D[0][0]+D[1][1]+D[2][2])
ans.add(D[0][2]+D[1][1]+D[2][0])
print('Yes' if 3 in ans else 'No')

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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<int, int> Pi;
typedef vector<ll> Vec;
typedef vector<int> Vi;
typedef vector<string> Vs;
typedef vector<vector<ll>> VV;

#define REP(i, a, b) for(ll i=(a); i<(b); i++)
#define rep(i, n) REP(i, 0, n)
const int INF=1e9;
const int MOD=1000000007;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl;
#define ALL(v) v.begin(), v.end()
#define dbg(x_) cerr << #x_ << ":" << x_ << endl;
#define pb(x) push_back(x)
#define mp(a, b) make_pair(a,b)
#define Each(a,b) for(auto &a :b)
#define REPM(i, mp) for (auto i = mp.begin(); i != mp.end(); ++i)
#define dbgmap(mp) for (auto i = mp.begin(); i != mp.end(); ++i) { cout << i->first <<":"<<i->second << endl;}
#define sum(v) accumulate(ALL(v),0)
#define fi first
#define se second

template<typename T1, typename T2>
ostream &operator<<(ostream &s, const pair<T1, T2> &p) { return s<<"("<<p.first<<", "<<p.second<<")"; }

// vector
template<typename T>
ostream &operator<<(ostream &s, const vector<T> &v) {
    int len=v.size();
    for(int i=0; i<len; ++i) {
        s<<v[i];
        if(i<len-1) s<<"	";
    }
    return s;
}

// 2 dimentional vector
template<typename T>
ostream &operator<<(ostream &s, const vector<vector<T> > &vv) {
    int len=vv.size();
    for(int i=0; i<len; ++i) {
        s<<vv[i]<<endl;
    }
    return s;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n,l;
    cin>>n>>l;
    Vec v(n+1);
    rep(i,n){
        v[i+1] = l+i;
    }
    sort(ALL(v),[](ll a,ll b)->bool {
        return abs(a)<abs(b);
    });

    //dbg(v);
    ll ans=0;
    REP(i,2,n+1){
        ans += v[i];
    }
    cout<<ans<<endl;
    return  0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string.h>
#include<string>
#include<cstdio>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<cmath>
#include<utility>
#define ll long long int
#define ld long double
#define INF 1000000000
#define EPS 0.0000000001
#define rep(i,n) for(i=0;i<n;i++)
using namespace std;
typedef pair<int, int> P;

int main()
{
  int n,a,b;
  int i,j;
  int sum=0;
  int t;
  cin>>n>>a>>b;
  rep(i,n){
    cin>>t;
    if(t<a || t>=b)sum++;
  }

  cout<<sum<<endl;

}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 6)


n = int(input())
g = [[] for _ in range(n)]
for i in range(n-1):
    a, b = map(int, input().split())
    a, b = a - 1, b - 1
    g[a].append((b, i))
    g[b].append((a, i))
ans = [0] * (n-1)


def dfs(u, c=-1, p=-1):
    k = 1
    for v, i in g[u]:
        if v == p: continue
        if k == c: k += 1
        ans[i] = k
        k += 1
        dfs(v, ans[i], u)


dfs(0)
print(max(ans))
print(*ans, sep='\n')


Measured memory_bytes: 85624
program main
implicit none
integer :: n, i, res, r
integer , allocatable :: w(:)

read(*,*) n
allocate( w(n) )
read(*,*) w(1:n)

res = sum(w)
do i = 1, n-1
r = min( res, abs( sum(w(1:i))-sum(w(i+1:n)) ) )
res = r
end do
write(*,'(i0)') res

end program main


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <iostream>
#include <queue>
#include <vector>
#include <math.h>
#include <algorithm>
#include <iomanip>
#include <string>
#include <stack>
#include <cctype>
#include <cstdlib>
using namespace std;

#define INF (1 << 20)
#define EPS (1e-10)
#define EQ(a,b) (fabs((a)-(b)) < EPS)

int main(){
	int n;
	while (cin >> n && n != 0) {
		int ret = -INF;
		int a[5000];
		int memo[5000];
		for (int i = 0; i < n; ++i) cin >> a[i], memo[i] = -INF;
		for (int i = 0; i < n; ++i) {
			memo[i] = max(memo[i], a[i]);
			for (int j = i+1; j < n; ++j) {
				memo[j] = max(memo[j], memo[j-1] + a[j]);
			}
		}
		for (int i = 0; i < n; ++i) ret = max(ret, memo[i]);
		cout << ret << endl;
	}
	return 0;
}

Measured memory_bytes: 1192
read n
read aa
read bb
read cc
a=($aa)
b=($bb)
c=($cc)
s=0
for i in `seq $n`;do
 s=$[s+b[i-1]]
 if [ $i -gt 1 -a $[a[i-2]+1] -eq ${a[i-1]} ];then
  s=$[s+c[a[i-2]-1]]
 fi
done
echo $s

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

const int N = 1e5;
vector<int> ecasdqina[N];
int v[N], d[N], c[N];
int ans[N], h[N];
using P = pair<int, int>;

// 実質BFS10回に抑えられる,と思う
// 僕らは感覚で競プロをやっている
int main() {
  ios::sync_with_stdio(false), cin.tie(0);
  int n, m, q; cin >> n >> m;
  for(int i = 0; i < m; i++) {
    int a, b; cin >> a >> b;
    a--;b--;
    ecasdqina[a].emplace_back(b);
    ecasdqina[b].emplace_back(a);
  }

  cin >> q;
  for(int i = 0; i < q; i++) {
    int ii = q - 1 - i;
    cin >> v[ii] >> d[ii] >> c[ii];
    v[ii]--;
  }

  memset(h, -1, sizeof h);

  for(int i = 0; i < q; i++) {
    if(h[v[i]] >= d[i]) continue;
    // BFS
    queue<P> qu;
    set<int> gone;
    qu.emplace(v[i], 0);
    gone.emplace(v[i]);
    if(!ans[v[i]]) ans[v[i]] = c[i];
    h[v[i]] = d[i];
    while(qu.size()) {
      int x = qu.front().first, td = qu.front().second;
      qu.pop();
      if(td == d[i]) break;
      for(int j : ecasdqina[x]) if(!gone.count(j)) {
        gone.emplace(j);
        int nd = td + 1;
        int f = 0;
        if(ans[j]) { // colored
          if(h[j] < d[i] - nd) {
            f = 1;
            h[j] = d[i] - nd;
          }
        } else {
          f = 1;
          ans[j] = c[i];
          h[j] = d[i] - nd;
        }
        if(f && nd != d[i]) {
          qu.emplace(j, nd);
        }
      }
    }
  }

  for(int i = 0; i < n; i++) cout << ans[i] << endl;
}


Measured memory_bytes: 13944
#include <iostream>
#include <algorithm>

using namespace std;

long long f(long long x, long long A, long long B)
{
	return (A * x) / B - A * (x / B);
}

int main()
{
	long long A, B, N;
	cin >> A >> B >> N;

	if (N < B) {
		cout << f(N, A, B) << endl;
	}
	else {
		cout << f(B - 1, A, B) << endl;
	}
}


Measured memory_bytes: 3592
#!python3

from functools import lru_cache

iim = lambda: map(int, input().rstrip().split())

def cmb(a, b):
    if a == b or b == 0: return 1
    c = a - b
    if b > c:
        return cmb(a, c)

    ans = 1
    for i in range(a, a - b, -1):
        ans *= i
    from math import factorial
    return ans // factorial(b)

def resolve():
    N, K = iim()
    mod = 10**9 + 7

    print(cmb(N+K-1, N) % mod)

if __name__ == "__main__":
    resolve()



Measured memory_bytes: 6328
#include<bits/stdc++.h>
using namespace std;
#define M 1e9 + 5
#define C 998244353
#define pi 3.14159265359
#define loop(i,a,b) for(ll i = ll(a); i < ll(b); ++i)
#define rloop(i,a,b) for(ll i = ll(a); i >= ll(b); --i)
#define sloop(i,a) for (std::set<ll>::iterator i = a.begin(); i != a.end(); ++i)
#define pb push_back
#define all(v) v.begin(), v.end()
typedef long long int ll;
typedef unsigned long long int ull;

int solve(){
    ll m=0,n,ans=0,j,i;
    cin >> n;
    vector<ll> a(n),pref;
    loop(i,0,n){
        cin >> a[i];
    }
    loop(i,0,n){
        loop(j,i+1,n){
            loop(k,j+1,n){
                if(a[i]!=a[j] and a[i]!=a[k] and a[j]!=a[k]){
                    if(a[i]+a[j]>a[k] and a[i]+a[k]>a[j] and a[j]+a[k]>a[i]){
                        ans++;
                    }
                }
            }
        }
    }
    cout << ans << "\n";
    return 0;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll t = 1;
    // cin >> t;
    loop(f,0,t){    
        solve();
    }   
}

Measured memory_bytes: 3652
#include <iostream>
#include <map>
#include <algorithm>
#include <vector>

using namespace std;

vector<long long> p;
vector<long long> y;

bool comp(int i, int j) {
  return y[i] < y[j];
}

int main(int argc, char* argv[]) {
  int N, M;
  cin >> N >> M;

  p.resize(M);
  y.resize(M);
  vector<long long> indices(M);
  for (int i = 0; i < M; ++i) {
    cin >> p[i] >> y[i];
    indices[i] = i;
  }

  sort(indices.begin(), indices.end(), comp);

  vector<long long> ret(M);
  map<long long, long long> m;
  for (int i = 0; i < M; ++i) {
    long long x;
    int index = indices[i];
    if (m.find(p[index]) == m.end()) {
      m[p[index]] = 1;
      x = 1;
    } else {
      ++m[p[index]];
      x = m[p[index]];
    }
    ret[index] = x;
  }

  for (int i = 0; i < M; ++i) {
    string head = to_string(p[i]);
    while (head.size() < 6) {
      head = '0' + head;
    }
    string tail = to_string(ret[i]);
    while (tail.size() < 6) {
      tail = '0' + tail;
    }
    cout << head << tail << endl;
  }

  return 0;
}

Measured memory_bytes: 10880
from itertools import product
n = int(input())
num = ["","3","5","7"]
A = set() 
for i in product(num,repeat=9):
	x = "".join(i)
	if x == "":
		continue
	elif len(set(x)) < 3:
		continue
	elif int(x) not in A and int(x) <= n:
		A.add(int(x))
print(len(A))

Measured memory_bytes: 6240
n = int(input())
d = {}
for i in range(n):
    key = input()
    if key in d:
        d[key] += 1
    else:
        d[key] = 1
l = list(d.items())
l = sorted(l, key=lambda x: x[1], reverse=True)

tmp = l[0][1]
tmp2 = l[0][1]
i = 0
ans = []
while tmp == tmp2 and i < len(l):
    ans.append(l[i][0])
    i += 1
    if i < len(l):
        tmp2 = l[i][1]
    else:
        break

ans.sort()
for i in range(len(ans)):
    print(ans[i])

Measured memory_bytes: 46680
#include<stdio.h>
#include<iostream>
using namespace std;

int main(void){



int n;

cin >> n;

long a[n][n];
long a2[n][n];


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

for (int i = 0; i<n; i++){
  for (int j = 0; j < n; j++){
    for (int k = 0;k<n;k++){
      if (i == k || j == k)continue;
      if (a[i][j] > a[i][k] + a[k][j]){
        cout << -1 <<"\n";
        return 0;
      }
      if  (a[i][j] == a[i][k] + a[k][j]){
        a2[i][j] = 0;
      }
    }
  }
}
long sumr = 0;
for (int i = 0; i <n; i++){
  for (int j = 0; j < n; j++){
    sumr += a2[i][j];
  }
}

sumr /= 2;

cout << sumr << "\n";


return 0;
}


Measured memory_bytes: 1664
#ifdef LOCAL
#define _GLIBCXX_DEBUG
#endif
#include<bits/stdc++.h>
using namespace std;
#define rep(i,s,t) for(ll i = (ll)(s); i < (ll)(t); i++)
#define rrep(i,s,t) for(ll i = (ll)(s-1);(ll)(t) <= i; i--)
#define all(x) (x).begin(), (x).end()
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> Pll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
constexpr ll INF = numeric_limits<ll>::max()/4;
constexpr ll n_max = 2e5+10;
#define int ll

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

void debug_out() {cerr << endl;}
template<typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
    cerr << " " << to_string(H);
    debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

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

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    string s;cin >> s;
    ll t = s[0] - 'a';
    if(t >= 0 && t <= 26)cout << "a" << endl;
    else cout << "A" << endl;
}

Measured memory_bytes: 3648
#include<bits/stdc++.h>
#define ll long long
#define pll pair<ll,ll>
#define pii pair<int,int>
#define rep(i,a,b) for(int i=a;i<=b;++i)
#define per(i,a,b) for(int i=a;i>=b;--i)
#define mem0(x) memset(x,0,sizeof(x))
#define meminf(x) memset(x,0x3f,sizeof(x))
#define VI vector<int>
#define VL vector<ll>
using namespace  std;

int main(){
    ios::sync_with_stdio(0);
    ll a,b,c,d;cin>>a>>b>>c>>d;
    if(d>b){
        swap(d,b);swap(c,a);
    }
    if(d<=0){
        if(a<=0){
            cout<<a*c<<endl;
        }else{
            cout<<a*d<<endl;
        }
    }else if(c<=0){
        if(a<=0){
            cout<<max(b*d,a*c)<<endl;
        }else{
            cout<<b*d<<endl;
        }
    }else{
        cout<<b*d<<endl;
        
    }
    
}


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

#define PI acos(-1)
#define pb push_back
#define int long long int
#define mp make_pair
#define pi pair<int, int>
#define pii pair<pi, int>
#define fir first
#define sec second
#define MAXN 200001
#define MAXL 20
#define mod 1000000007

signed main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  int ans = (n - 400) / 200;
  cout << 8 - ans << endl;
  return 0;
}

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

int main(){
    // 制約見て！！！デカかったらlong longにすること！
    int n;
    cin >>n;
    vector<int> a(n);
    rep(i,n)cin >> a[i];
    ::sort(a.rbegin(),a.rend());
    int alice=0,bob=0;
    rep(i,n){
        if(i%2==0){
            alice += a[i];
        }else{
            bob += a[i];
        }
    }
    cout << alice - bob <<endl;

}

Measured memory_bytes: 3628
def counting_sort(A, B, k):
    n = len(A)
    C = [0] * (k + 1)

    for i in range(n):
        C[A[i]] += 1

    for i in range(k):
        C[i + 1] += C[i]
    
    for i in range(n-1, -1, -1):
        B[C[A[i]] - 1] = A[i]
        C[A[i]] -= 1

n = int(input())
A = list(map(int, input().split()))

B = [0] * n

counting_sort(A, B, 10000)
print(" ".join(map(str, B)))


Measured memory_bytes: 240320
#b
n = int(input())
s = [input() for i in range(n)]
ans = [0]*4
for i in s:
    if i == "AC":
        ans[0] += 1
    elif i == "WA":
        ans[1] += 1
    elif i == "TLE":
        ans[2] += 1
    elif i == "RE":
        ans[3] += 1
print("AC x "+str(ans[0]))
print("WA x "+str(ans[1]))
print("TLE x "+str(ans[2]))
print("RE x "+str(ans[3]))

Measured memory_bytes: 16244
# coding: utf-8
# Your code here!

N, T_li, M, = int(input()), list(map(int, input().split())), int(input())
P_li = [[int (i) for i in input().split()] for j in range(M)]
dummy = 0

for i in range(M):
    dummy = T_li[P_li[i][0] - 1]
    T_li[P_li[i][0] - 1] = P_li[i][1]
    print(sum(T_li))
    T_li[P_li[i][0] - 1] = dummy

Measured memory_bytes: 3064
from sys import stdin
import sys
import math
from functools import reduce
import functools
import itertools
from collections import deque,Counter
from operator import mul
import copy
# ! /usr/bin/env python
# -*- coding: utf-8 -*-
import heapq
sys.setrecursionlimit(10**6)

N = int(input())
a = [0] + list(map(int, input().split()))

dp = [[0]*(N+5) for i in range(N+5)]

for k in range(1,N+1):
    for l in range(1,N+2-k):
        r = l + k
        if (N-k) % 2 == 0:
            dp[l][r] = max(dp[l+1][r] + a[l], dp[l][r-1] + a[r-1])
        else:
            dp[l][r] = min(dp[l + 1][r] - a[l], dp[l][r - 1] - a[r - 1])

print(dp[1][N+1])

Measured memory_bytes: 145956
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc=new Scanner(System.in);
    int h=sc.nextInt();
    String w=sc.nextLine();
    String str[]=new String[h];
    String newStr[]=new String[2*h];
    for(int i=0;i<h;i++){
      str[i]=sc.nextLine();
      newStr[2*i]=str[i];
      newStr[2*i+1]=str[i];
    }
    sc.close();
    for(int i=0;i<2*h;i++){
      System.out.println(newStr[i]);
    }
  }
}

Measured memory_bytes: 23252
#include <bits/stdc++.h>
using namespace std;
template <class T> inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T> inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return 1;
    }
    return 0;
}
typedef long long int ll;

#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define endl "\n"
const double EPS = 1e-7;
const int INF = 1 << 30;
const ll LLINF = 1LL << 60;
const double PI = acos(-1);
const int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

//-------------------------------------

struct edge {
    int from, to;
    ll cost;
};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, m;
    ll p;
    cin >> n >> m >> p;
    vector<edge> g(m);
    for(int i = 0; i < m; i++) {
        int a, b;
        ll c;
        cin >> a >> b >> c;
        g[i] = edge{a - 1, b - 1, -(c - p)};
    }
    vector<ll> d(n, LLINF);

    auto bellmanFord = [&](int s, int goal) {
        d[s] = 0;
        bool res = true;
        for(int i = 0; i < n * 2; i++) {
            for(auto e : g) {
                if(d[e.from] != LLINF && d[e.to] > d[e.from] + e.cost) {
                    if(i >= n - 1 && e.to == goal) {
                        res = false;
                    } else if(i >= n - 1) {
                        d[e.to] = -LLINF;
                    } else {
                        d[e.to] = d[e.from] + e.cost;
                    }
                }
            }
        }
        return res;
    };

    bool check = bellmanFord(0, n - 1);

    if(!check) {
        cout << -1 << endl;
    } else {
        cout << max(0LL, -d[n - 1]) << endl;
    }
}

Measured memory_bytes: 384