akhauriyash/Code-Regression huggingface dataset:
#define _USE_MATH_DEFINES
#include "bits/stdc++.h"
using namespace std;
#define FOR(i,j,k) for(int (i)=(j);(i)<(int)(k);++(i))
#define rep(i,j) FOR(i,0,j)
#define each(x,y) for(auto &(x):(y))
#define mp make_pair
#define MT make_tuple
#define all(x) (x).begin(),(x).end()
#define debug(x) cout<<#x<<": "<<(x)<<endl
#define smax(x,y) (x)=max((x),(y))
#define smin(x,y) (x)=min((x),(y))
#define MEM(x,y) memset((x),(y),sizeof (x))
#define sz(x) (int)(x).size()
#define RT return
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vll = vector<ll>;

template<class T, T INF>
vector<T> BellmanFord(
    const vector<int> &from, const vector<int> &to, const vector<T> &cost,
    int V, int start) {
    int num = (int)to.size();
    vll dp(V, INF);
    dp[start] = 0;
    for (int i = 0; i < 2 * V; ++i) {
        for (int j = 0; j < num; ++j) {
            ll value = dp[from[j]] + cost[j];
            if (dp[from[j]] != INF && value < dp[to[j]]) {
                dp[to[j]] = i < V ? value : -INF;
            }
        }
    }
    return dp;
}

void solve() {
    const ll INF = LLONG_MAX / 3;
    int N, M, P;
    cin >> N >> M >> P;

    vi from(M), to(M), coin(M);
    vll cost(M);
    rep(i, M) {
        cin >> from[i] >> to[i] >> coin[i];
        cost[i] = P - coin[i];
        --from[i];
        --to[i];
    }

    auto res = BellmanFord<ll, INF>(from, to, cost, N, 0);
    if (res.back() == -INF) {
        cout << -1 << endl;
    } else {
        cout << max(0ll, -res.back()) << endl;
    }

}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout << fixed << setprecision(15);
	solve();
	return 0;
}

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

int n,arr[100000];
int main(){
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>arr[i]; 
	} 
	sort(arr,arr+n); 
	int sum=arr[n/2]-arr[n/2-1];
	cout<<sum;
	return 0; 
} 

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

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	long long MOD = 1e9 + 7;
	long long n, m;
	cin >> n >> m;
	if(abs(n-m) > 1) return cout << 0 << endl, 0;
	long long ans = (n == m ? 2 : 1);
	for(int i = 1; i <= n; ++i){
		ans *= i;
		ans %= MOD;
	}
	for(int i = 1; i <= m; ++i){
		ans *= i;
		ans %= MOD;
	}
	cout << ans << endl;

}


Measured memory_bytes: 256
import java.util.*;
import java.lang.*;
import java.math.*;
import java.io.*;

public class Main{

	Scanner sc=new Scanner(System.in);;

	int INF=1<<28;
	double EPS=1e-9;

	void run(){
		for(;;){
			int y1=sc.nextInt();
			int m1=sc.nextInt();
			int d1=sc.nextInt();
			int y2=sc.nextInt();
			int m2=sc.nextInt();
			int d2=sc.nextInt();
			if(y1<0||m1<0||d1<0||y2<0||m2<0||d2<0){
				break;
			}
			int a=day(y1, m1, d1);
			int b=day(y2, m2, d2);
			println((b-a)+"");
		}
	}

	int day(int y, int m, int d){
		int res=0;
		int[] days={31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
		for(int i=0; i<m-1; i++){
			res+=days[i];
		}
		res+=y*365+d-1;
		if((m==2&&d<=28)||m==1){
			y--;
		}
		if(y>=0){
			res+=y/4+1;
			res-=y/100+1;
			res+=y/400+1;
		}
		return res;
	}

	void debug(Object... os){
		System.err.println(Arrays.deepToString(os));
	}

	void print(String s){
		System.out.print(s);
	}

	void println(String s){
		System.out.println(s);
	}

	public static void main(String[] args){
		new Main().run();
	}
}

Measured memory_bytes: 12000
// #include <bits/stdc++.h>
#include <algorithm>
#include <cmath>
#include <deque>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

using namespace std;
typedef long long ll;

#define all(x) begin(x), end(x)
#define rep(i,n) for(int i=0; i<n; i++)

int main() {
    int l, r, d;
    cin >> l >> r >> d;

    int ans = 0;

    for (int i=l; i<=r; i++) {
        if (i%d == 0) ans++;
    }

    cout << ans << endl;

    return 0;
}

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

using namespace std;

int main(int argc, const char * argv[]) {
    vector<int> buttons(2, 0);
    cin >> buttons[0] >> buttons[1];
    
    int score = 0;
    for(int i = 0; i < 2; i++) {
        if(buttons[0] > buttons[1]) {
            // push 0
            score += buttons[0];
            buttons[0]--;
        } else {
            // push 1
            score += buttons[1];
            buttons[1]--;
        }
    }
    cout << score << endl;
    
    return 0;
}


Measured memory_bytes: 256
import           Control.Monad
import           Control.Monad.ST
import qualified Data.Array                  as A
import qualified Data.Array.Unboxed          as AU
import qualified Data.ByteString.Char8       as BS
import           Data.Char
import           Data.List
import           Data.Maybe
import           Data.Ord
import           Data.Time
import qualified Data.Vector                 as V
import qualified Data.Vector.Mutable         as VM
import qualified Data.Vector.Unboxed         as VU
import qualified Data.Vector.Unboxed.Mutable as VUM

readIntegers :: IO [Integer]
readIntegers = map (fst . fromJust . BS.readInteger) . BS.words <$> BS.getLine

readIntegerLists :: Int -> IO [[Integer]]
readIntegerLists n =
  replicateM n (map (fst . fromJust . BS.readInteger) . BS.words <$> BS.getLine)

readInts :: IO [Int]
readInts = map (fst . fromJust . BS.readInt) . BS.words <$> BS.getLine

readIntLists :: Int -> IO [[Int]]
readIntLists n =
  replicateM n (map (fst . fromJust . BS.readInt) . BS.words <$> BS.getLine)

readStrings :: IO [String]
readStrings = map BS.unpack . BS.words <$> BS.getLine

readStringLists :: Int -> IO [[String]]
readStringLists n = replicateM n (map BS.unpack . BS.words <$> BS.getLine)

toPair :: [a] -> (a, a)
toPair [x, y] = (x, y)

main :: IO ()
main = do
  path <- replicateM 6 $ read <$> getLine
  putStrLn $ solve path
  return ()

solve :: [Int] -> String
solve path
  | last path < last sorted - head sorted = ":("
  | otherwise = "Yay!"
  where
    sorted = sort $ init path
-- solve n w vw = f 0 w
--   where
--     items = VU.fromList vw
--     f i cap
--       | i == n = 0
--       | snd (items VU.! i) > cap = f (i + 1) cap
--       | otherwise =
--         max
--           (memo A.! (i + 1, cap))
--           (memo A.! (i + 1, cap - snd (items VU.! i)) + fst (items VU.! i))
--     memo =
--       A.array
--         ((0, 0), (n, w))
--         [((n', w'), f n' w') | n' <- [0 .. n], w' <- [0 .. w]]


Measured memory_bytes: 508
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int A = scan.nextInt();
		int B = scan.nextInt();
		scan.close();
		if(A * B % 2 == 0) {
			System.out.println("No");
		}else {
			System.out.println("Yes");
		}
	}
}

Measured memory_bytes: 24020
import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int a = Integer.parseInt(in.next()), b = Integer.parseInt(in.next()), c = Integer.parseInt(in.next());
		System.out.println(Math.min(a, Math.min(b, c)) + " " + Math.max(a, Math.max(b, c)));
	}

}



Measured memory_bytes: 26304
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
 
int main() {
 
    int n, m;
    cin >> n >> m;
 
    vector<vector<int>> s(m);
    vector<int> k(m);
    for(int i = 0; i < m; ++i){
        cin >> k[i];
        vector<int> sk(k[i]);
        for(int j = 0; j < k[i]; ++j) cin >> sk[j];
 
        s[i] = sk;
    }

    vector<int> p(m);
    for(int i = 0; i < m; ++i) cin >> p[i];
 
    int res = 0;
    for(int i = 0; i < (1<<n); ++i){
        vector<int> on(n, 0);
        for(int j = 0; j < n; ++j){
            if(i & (1<<j)) on[j] = 1;
        }
 
        bool all_on = true;
        for(int j = 0; j < m; ++j){
            int on_num = 0;
            for(int l = 0; l < k[j]; ++l){
                if(on[s[j][l] - 1]) ++on_num;
            }
 
            if(on_num%2 != p[j]) {
                all_on = false;
                break;
            }
        }
        
        if(all_on) ++res;
    }
 
    cout << res << endl;
 
    return 0;
}

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

ll N, C;
ll D[35][35];
ll grid[510][510];
ll cost[3][35];

int main(int argc, char **argv)
{
	ll N, C; cin >> N >> C;
	for (ll i = 0; i < C; ++i) for (ll j = 0; j < C; ++j) cin >> D[i][j];
	for (ll i = 0; i < N; ++i) for (ll j = 0; j < N; ++j) cin >> grid[i][j], --grid[i][j];

	memset(cost, 0, sizeof(cost));
	for (ll x = 0; x < N; ++x)
	{
		for (ll y = 0; y < N; ++y)
		{
			for (ll c = 0; c < C; ++c)
				cost[(x+y)%3][c] += D[grid[x][y]][c];
		}
	}

	ll res{1ll<<60};
	for (ll c1 = 0; c1 < C; ++c1) // 0
	{
		for (ll c2 = 0; c2 < C; ++c2) // 1
		{
			if (c1 == c2) continue;
			for (ll c3 = 0; c3 < C; ++c3) // 2
			{
				if (c1 == c3 || c2 == c3) continue;
				ll tmp{0};
				tmp += cost[0][c1];
				tmp += cost[1][c2];
				tmp += cost[2][c3];
				res = min(res, tmp);
			}
		}
	}
	std::cout << res << std::endl;
}


Measured memory_bytes: 2304
# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

N,Q=map(int,input().split())
a=tuple(map(int1,input().split()))
lr=[0]*Q
c0=10**12
c1=10**6
for i in range(Q):
    l,r=map(int1,input().split())
    lr[i]=r*c0+l*c1+i
lr.sort(reverse=1)
class BIT:
    def __init__(self,n):
        self.num=n
        self.dat=[0]*(self.num+1)
        self.depth=n.bit_length()
    
    def add(self,i,x):
        i+=1
        while i<=self.num:
            self.dat[i]+=x
            i+=i&-i
    
    def sum(self,i):
        i+=1
        s=0
        while i>0:
            s+=self.dat[i]
            i-=i&-i
        return s
    
    def lower_bound(self,x):
        sum_=0
        pos=0
        for i in range(self.depth,-1,-1):
            k=pos+(1<<i)
            if k<=self.num and sum_+self.dat[k]<x:
                sum_+=self.dat[k]
                pos+=1<<i
        return pos, sum_

b=BIT(N)
lastap=[-1]*N
ans=[-1]*Q
lrj=lr.pop()
r=lrj//c0
lrj%=c0
l=lrj//c1
j=lrj%c1
for i,x in enumerate(a):
    if lastap[x]!=-1:
        b.add(lastap[x],-1)
    b.add(i,1)
    lastap[x]=i
    while r==i:
        ans[j]=b.sum(r)-b.sum(l-1)
        if lr:            
            lrj=lr.pop()
            r=lrj//c0
            lrj%=c0
            l=lrj//c1
            j=lrj%c1
        else:
            l,r,j=-1,-1,-1
print(*ans,sep='\n')

Measured memory_bytes: 168800
#include <iostream>

using namespace std;

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

  if(a >= k){
    a = a-k;
  }
  else{
    k = k - a;
    a = 0;
    b = b - k;
  }

  if(b < 0){
    b = 0;
  }

  cout << a << " " << b << endl;

  return 0;
}

Measured memory_bytes: 256
#include<algorithm>
#include<iostream>
#include<math.h>
#include<queue>
#include<stdio.h>
#include<stdlib.h>
#include<stack>
#include<string>
#include<vector>

#define ll long long
#define ull unsigned long long

using namespace std;
int main(void) {

	ll A = 0, B = 0;
	ll H = 0;
	ll C = 0;
	ll i = 1,j = 0;
	scanf("%lld%lld", &A, &B);
	H = B - A;


	for (j = 1;i != H; j += (++i)) {
	}

	printf("%lld\n", j - B);

	return 0;
}

Measured memory_bytes: 256
A, B, C, D = list(map(int, input().split()))
if A <= C:
    x = [A, B]
    y = [C, D]
else:
    y = [A, B]
    x = [C, D]
if x[1] <= y[1]:
    d = x[1] - y[0]
else:
    d = y[1] - y[0]
if d < 0:
    d = 0
print(d)

Measured memory_bytes: 38384
/* ------------------------------ TEMPLATE BEGIN ------------------------------ */

#include <bits/stdc++.h>
using namespace std;

/* ----------------- ORDERED SET (POLICY BASED DS) ----------------- */
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template <typename T>
using ordered_set = tree
    <T, null_type, less<T>, rb_tree_tag, 
    tree_order_statistics_node_update>;

/* -------------- BETTER RANDOM (RAND() IS DANGEROUS) -------------- */
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
#define rnd(x, y) uniform_int_distribution<ll>(x, y)(rng)

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

/* ----------------------- DEBUGGING UTILITY ----------------------- */
#define cerr cout
void _print() {cerr << "]\n";}
template <typename T, typename... V> void _print(T t, V... v) {
    cerr << t; if(sizeof...(v)) cerr << ", "; _print(v...);
}
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)

#define boost ios_base::sync_with_stdio(false);cin.tie(nullptr);
#define rep(i, x, n) for (ll i = (ll)(x); i < (ll)(n); i++)
#define rrep(i, x, n) for (ll i = (ll)(x); i >= (ll)(n); i--)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define ff first
#define ss second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define bs binary_search
#define minSelf(a, b) a = min(a, b)
#define maxSelf(a, b) a = max(a, b)
#define mem(arr, x) memset(arr, x, sizeof(arr))
using ll = long long int;
using ld = long double;
template <typename T, typename V> using P = pair<T, V>;
template <typename T> using V = vector<T>;
const ll MOD = 998244353LL;
const ll INF = 0x3f3f3f3f; // ~1e9 (1061109567)
const ld PI = 3.1415926535897932384626;
const ld EPS = 1e-9;
#define endl '\n' // REMOVE FOR INTERACTIVE TASKS
const ll MAX = 2e5+5;

/* ------------------------------- TEMPLATE END ------------------------------- */

ll power(ll a, ll b) {
    ll ans = 1;
    while(b) {
        if(b&1) (ans *= a) %= MOD;
        (a *= a) %= MOD, b >>= 1;
    }
    return ans;
}

ll fac[MAX];

ll C(ll n, ll r) {
    ll ans = (fac[n]*power(fac[r], MOD-2)) % MOD;
    return (ans*power(fac[n-r], MOD-2)) % MOD;
}

int main() {
    boost
    fac[0] = 1;
    rep(i, 1, MAX) fac[i] = (i*fac[i-1]) % MOD;
    ll n, m, k;
    cin >> n >> m >> k;
    ll ans = 0;
    rep(i, 0, k+1) {
        ll tmp = (m*power(m-1, n-i-1)) % MOD;
        (ans += (tmp*C(n-1, i)) % MOD) %= MOD;
    }
    cout << ans << endl;
}

Measured memory_bytes: 5220
from functools import reduce
import math

def main():
    # 文字列の2進数を数値にする
    # '101' → '5'
    # 文字列の頭に'0b'をつけてint()にわたす
    # binary = int('0b'+'101',0)

    # 2進数で立っているbitを数える
    # 101(0x5) → 2
    # cnt_bit = bin(5).count('1')
    
    # N! を求める
    # f = math.factorial(N)

    # N の逆元
    # N_inv = pow(N,MOD-2,MOD)

    # nCr
    # Nの階乗 * rの階乗の逆元 * n-rの階乗の逆元
    
    # 切り捨て
    # 4 // 3
    # 切り上げ
    #-(-4 // 3)
    
    # 初期値用:十分大きい数(100億)
    INF = float("inf")

    # 大きな素数
    MOD = 10**9+7
    
    # 1文字のみを読み込み
    # 入力:2
    # a = input().rstrip()
    # 変数:a='2'
    
    # スペース区切りで標準入力を配列として読み込み
    # 入力:2 4 5 7
    # a, b, c, d = (int(_) for _ in input().split())  
    # 変数:a=2 b=4 c=5 d =7
    
    # 1文字ずつ標準入力を配列として読み込み
    # 入力:2 4 5 7
    # a = list(int(_) for _ in input().split())
    # 変数:a = [2, 4, 5, 7]    

    # 1文字ずつ標準入力を配列として読み込み
    # 入力:2457
    # a = list(int(_) for _ in input())
    # 変数:a = [2, 4, 5, 7]    
    a, b = (int(_) for _ in input().split())
    print(math.ceil((a+b)/2))
    
if __name__ == '__main__':
    main()


Measured memory_bytes: 3572
#include "bits/stdc++.h"
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define ll long long
#define vv vector
#define pp pair
#define ff first
#define ss second
#define all(v) v.begin(), v.end()
#define fastio                    \
	ios_base::sync_with_stdio(0); \
	cin.tie(0);
typedef pair<ll, ll> pll;
typedef vv<ll> vll;
typedef vv<pll> vpll;
#define ordered_set tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update>
//adds two more functions to set
//(1)*(set.find_by_order(k))[kth element in the sorted set]
//(2)set.order_of_key(k)[count of elements strictly less than k]
#define LG(args...)                               \
	{                                             \
		string _s = #args;                        \
		replace(_s.begin(), _s.end(), ',', ' ');  \
		stringstream _ss(_s);                     \
		err(istream_iterator<string>(_ss), args); \
		cerr << endl;                             \
	}
void err(istream_iterator<string> it) {}
template <typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << "(" << *it << ":" << a << ") ";
	err(++it, args...);
}
//:::::::::::::::::::::::::::::::::::::::::::::
const ll INF = 9e18;
const ll MOD = 1e9 + 7;
// #define dbg

int main(){
	fastio;
	ll n,k;
	cin>>n>>k;
	vll a(n);
	for(ll i=0; i<n; i++){
		cin>>a[i];
	}
	vll dp(n, INF);
	dp[0]=0;
	for(ll i=1; i<n; i++){
		for(ll j=max(0ll, i-k); j<i; j++){
			dp[i] = min(dp[i], dp[j] + abs(a[j] - a[i]));
		}
	}
	cout<<dp[n-1];
}

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

int main(){
  string s;
  char info[126][2];
  info['A']['0'] = 'X'; info['A']['1'] = 'Y'; info['X']['1'] = 'Z';
  info['Y']['0'] = 'X'; info['Z']['0'] = 'W'; info['Z']['1'] = 'B';
  info['W']['0'] = 'B'; info['W']['1'] = 'Y'; info['B']['0'] = 'Y';
  info['B']['1'] = 'X';
  while(true){
    cin >> s; if(s == "#") break;
    char now = 'A';
    for(int i=0;i<s.size();i++) now = info[now][s[i]];
    cout << (now == 'B'? "Yes" : "No") << endl;
  }
} 

Measured memory_bytes: 1180
import sys

n=int(input())
mydict={}
before="!"
for i in range(n):
    tmp=input()
    if(before=="!"):
        before=tmp[0]
    if(tmp in mydict or before!=tmp[0]):
        print("No")
        sys.exit()
    mydict[tmp]=i
    before=tmp[-1]

print("Yes")

Measured memory_bytes: 3064
N, W = map(int, input().split())
value, weight = [0], [0]
for _ in range(N):
  w, v = map(int, input().split())
  weight.append(w)
  value.append(v)
dp = [[-1]*(W+1) for _ in range(N+1)]
dp[0][0] = 0

for i in range(1, N+1):
  for j in range(W+1):
    dp[i][j] = max(dp[i][j], dp[i-1][j])
    if -1 < j-weight[i]:
      dp[i][j] = max(dp[i][j], dp[i-1][j-weight[i]]+ value[i])
print(max(dp[N]))

Measured memory_bytes: 152664
#include <iostream>
#include <vector>
#include <map>

using namespace std;

#define repd(i,a,b) for (int i=(a);i<(b);++i)
#define rep(i,n) repd(i,0,n)
typedef long long ll;


int main(){
  int n, l;
  cin >> n >> l;
  vector<string> v;
  rep(i, n){
    string s; cin >> s;
    v.push_back(s);
  }
  sort(v.begin(), v.end());
  rep(i, n){
    cout << v[i];
  }
  cout << endl;
  return 0;
}


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

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

#define int                     long long int
#define ld                      long double
#define pb                      push_back
#define MOD                     998244353
#define inf                     3e18
#define vi                      vector<int>
#define vld                     vector<ld>
#define pii                     pair<int,int>
#define mii                     map<int,int>
#define fi                      first
#define se                      second
#define fastIO                  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define db(...)                 __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) { cerr << " "<< name << " : " << arg1 <<'\n'; }
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
    const char* comma = strchr(names + 1, ',');
    cerr.write(names, comma - names) << " : " << arg1 << " | "; __f(comma + 1, args...);
}

typedef tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> pbds; 
		//order_of_key (k) : Number of items strictly smaller than k .
		//find_by_order(k) : K-th element in a set (counting from zero) (returns an iterator)           


void inp_out()
{
	#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	freopen("debug.txt", "w", stderr);
	#endif
}

class fenwick			//0 - based indexing
{
	public:
	vi a;
	int n;

	void init(int sz)
	{
		n = sz;
		a = vi(n+1);
	}

	void update_bit(int idx,int val)
	{
		for(int i = idx + 1; i <= n; i += i & -i)
		{
			a[i] += val;
			a[i] %= MOD; 
		}
	}

	int get_sum(int idx)
	{
		int res = 0;
		for(int i = idx + 1; i > 0; i -= i & -i)
		{
			res += a[i];
			res %= MOD; 
		}
		return res;
	}

	int get_sum(int l, int r)
	{	
		int ans = 0; 
		if(r > 0)
			ans += get_sum(r); 
		if(l > 0)
			ans -= get_sum(l - 1); 
		ans %= MOD; 
		ans += MOD; 
		ans %= MOD; 
		return ans; 
	}
};

int32_t main()
{
	fastIO
	inp_out();
	int n, k; 
	cin >> n >> k;

	vector < pii > a(k); 
	for(int i = 0; i < k; ++ i)
		cin >> a[i].fi >> a[i].se; 

	fenwick bit;
	bit.init(n + 1);   
	bit.update_bit(1, 1); 
	for(int i = 1; i <= n; ++ i)
	{
		int val = 0; 
		for(int j = 0; j < k; ++ j)
		{
			val += bit.get_sum(i - a[j].se, i - a[j].fi); 
		}
		bit.update_bit(i, val); 
	}

	int ans = bit.get_sum(n, n); 
	cout << ans; 

	return 0;
}

Measured memory_bytes: 4696
#define _USE_MATH_DEFINES
#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include <cstring>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <numeric>
#include <functional>
#include <cctype>
#include <list>
#include <limits>
#include <cassert>
#include <random>
#include <time.h>
//#include <boost/multiprecision/cpp_int.hpp>



using namespace std;
using Int = long long;
//using namespace boost::multiprecision;

const double EPS = 1e-10;
long long const MOD = 1000000007;

long long mod_pow(long long x, long long n) {
    long long res = 1;
    for (int i = 0;i < 60; i++) {
        if (n >> i & 1) res = res * x % MOD;
        x = x * x % MOD;
    }
    return res;
}

template<typename T>
T gcd(T a, T b) {
    return b != 0 ? gcd(b, a % b) : a;
}

template<typename T>
T lcm(T a, T b) {
    return a * b / gcd(a, b);
}

void fastInput() {
    cin.tie(0);
    ios::sync_with_stdio(false);
}

int main(void) {
    Int M, D; cin >> M >> D;
    Int ans = 0;
    for (int i = 1; i <= M; i++) {
        for (int j = 10; j <= D; j++) {
            int tmp = j;
            int d1 = tmp%10;
            tmp /= 10;
            int d2 = tmp%10;
            if (d1 < 2 || d2 < 2) continue;
            if (i == d1 * d2) ans++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 888
#include <stdio.h>
#include <stdbool.h>
#define rep(i,n)for(int i=0;i<(int)(n);i++)
int main(){
	char c[30009]={'0'}; int n, ans=0; bool f1,f2,f3;
	scanf("%d%s",&n,c);
	rep(i, 10) {
		rep(j, 10) {
			rep(k, 10) {
				f1=false;f2=false;f3=false;
				int x=0;
				while(!f1&&x<n){
					f1=(c[x]-48==i);
					x++;
				}
				while(!f2&&x<n){
					f2=(c[x]-48==j);
					x++;
				}
				while(!f3&&x<n){
					f3=(c[x]-48==k);
					x++;
				}
				if(f1&&f2&&f3)ans++;
			}
		}
	}
	printf("%d", ans);
}

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

using namespace std;

#define make_unique(a) (a.erase(unique(a.begin(),a.end()),a.end()))
#define allof(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define pb push_back
#define exists(s, e) (s.find(e)!=s.end())
#define INF 0x3f3f3f3f
#define endl '\n'
#define mp make_pair
#define readln(x) (getline(cin, x))
#define watch(x) cout << (#x) << " is " << (x) << endl;
#define debug(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
#define time__(d) for(long blockTime = 0; (blockTime == 0 ? (blockTime=clock()) != 0 : false); debug("%s time : %.4fs\n", d, (double)(clock() - blockTime) / CLOCKS_PER_SEC))

typedef pair<int, int> pii;
typedef long long ll;

ll gcd(ll a, ll b) {return b == 0 ? a : gcd(b, a % b);}
ll fpow(ll  b, ll exp, ll mod){if(exp == 0) return 1;ll t = fpow(b,exp/2,mod);if(exp&1) return t*t%mod*b%mod;return t*t%mod;}
ll divmod(ll i, ll j, ll mod){i%=mod;j%=mod;return i*fpow(j,mod-2,mod)%mod;}

void solve() {
    int a, b;
    cin >> a >> b;
    cout << 1.0*a/b << '\n';
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    solve();
    return 0;
}



Measured memory_bytes: 256
var s,st:string;
n,m,i,k,j:longint;
begin
    read(s);
    for i:=1 to length(S)do
    if s[i]='C'then begin
        for j:=i+1 to length(s) do
        if s[j]='F' then begin write('Yes');exit;end;
    end;
    write('No');
end.

Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <string>
#include <math.h>
#include <cstdint>
#include <sstream>
#include <map>
#include<vector>

using namespace std;
typedef long long ll;

ll ans,mx,sum,mn=1e8,cnt;


int main(){
	ll a;
	cin>>a;
	float b;
	cin>>b;
	ll x=b*100;
	cout<<(a*x)/100;
}


Measured memory_bytes: 3692
//#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
using namespace std;
#define pb push_back//also for STRING

#define MAX_N 100000

struct edge{
	int to,cost;
};

int d[MAX_N];
vector<edge> g[MAX_N];
bool f[MAX_N];

bool dfs(int v){
	f[v]=true;
	for(int j=0;j<g[v].size();++j){
		int w=g[v][j].to;
		if(f[w]){
			if(d[w]!=d[v]+g[v][j].cost) return false;
			continue;
		}
		d[w]=d[v]+g[v][j].cost;
		if(!dfs(w)) return false;
	}
	return true;
}

int main(){
	int n,m;
	scanf("%d %d",&n,&m);
	while(m-- > 0){
		int l,r,d;
		scanf("%d %d %d",&l,&r,&d);
		g[--l].pb((edge){--r,d});
		g[r].pb((edge){l,-d});
	}
	fill(f,f+n,false);
	for(int v=0;v<n;++v){
		if(!dfs(v)){
			printf("No\n");
			return 0;
		}
	}
	printf("Yes\n");
	return 0;
}

Measured memory_bytes: 12032
//                _                                      
//  ___ _ __ ___ (_) __ ___      ___   _ _ __ ___  _ __  
// / __| '_ ` _ \| |/ _` \ \ /\ / / | | | '_ ` _ \| '_ \ 
// \__ \ | | | | | | (_| |\ V  V /| |_| | | | | | | |_) |
// |___/_| |_| |_|_|\__, | \_/\_/  \__,_|_| |_| |_| .__/ 
//                  |___/                         |_|  
//code by smigwump
//https://codeforces.com/blog/entry/62393 hashing hack protection
//https://codeforces.com/blog/entry/61587 rand() alternatives
//https://codeforces.com/blog/entry/61675 randomized hack protection
#include <bits/stdc++.h>
typedef long long ll;
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define ins insert
#define REP(i,a,b) for(ll i = a; i <= b; i++)
#define PER(i,a,b) for(ll i = a; i >= b; i--)

using namespace std;

int main() {
	// #ifndef ONLINE_JUDGE
	//     freopen("input.txt", "r", stdin);
	//     freopen("output.txt", "w", stdout);
	// #endif

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n,x,t;
    cin>>n>>x>>t;
    cout<<((n+x-1)/x)*t;
	return 0;
}

Measured memory_bytes: 3632
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long int ll;

ll X1[200005], X2[200005];
ll dp1[200005], dp2[200005];
ll Ans, L, N, A;

ll Max(ll a, ll b, ll c)
{
	return max(max(a, b), c);
}

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

	X1[N + 1] = L;
	X2[N + 1] = L;

	for ( int i = 1; i <= N; i++ )
	{
		cin >> A;
		X1[i] = A;
		X2[N + 1 - i] = L - A;
	}

	dp1[0] = X1[N + 1] - X1[N];
	dp2[0] = X2[N + 1] - X2[N];

	Ans = Max(Ans, L - dp1[0], L - dp2[0]);

	for ( int i = 1; i < N; i++ )
	{
		dp1[i] = dp1[i - 1] + X1[N - ((i - 1) / 2)] + X1[N - (i / 2)] - 2 * X1[N - i];
		dp2[i] = dp2[i - 1] + X2[N - ((i - 1) / 2)] + X2[N - (i / 2)] - 2 * X2[N - i];
		Ans = Max(Ans, (i + 1)*L - dp1[i], (i + 1)*L - dp2[i]);
	}

	cout << Ans;
}

Measured memory_bytes: 6528
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define pb emplace_back
typedef long long ll;
typedef pair<int,int> pint;

string s[3];
int main(){
    rep(i,3) cin>>s[i];
    rep(i,3) cout<<s[i][i];
    cout<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
ll a[200001],f[200001]={},ans[200001];
int main() {
	memset(ans,-1,sizeof(ans));
	ll n,i=0;
	cin>>n;
	while(i<n)
	{
		cin>>a[i];
		f[a[i]]++;
		i++;
	}
	i=1;
	ll tot=0;
	while(i<=n)
	{
		tot+=(f[i]*(f[i]-1))/2;
		i++;
	}
	i=0;
	while(i<n)
	{
		if(ans[a[i]]!=-1)
		{
			cout<<ans[a[i]]<<"\n";
		}
		else
		{
			ans[a[i]]=tot-((f[a[i]]*(f[a[i]]-1))/2)+((f[a[i]]-1)*(f[a[i]]-2))/2;
			cout<<ans[a[i]]<<"\n";
		}
		i++;
	}
}

Measured memory_bytes: 6912
A, B, C, D = map(int, input().split())
def count(A, B, div):
    if B % div >= A % div and A % div > 0:
        return (B - A) // div
    else:
        return (B - A) // div + 1

def gcd(a, b):
    if b > a: a, b = b, a
    remain = a % b
    while b > 0:
        remain = a % b
        a = b
        b = remain
    return a

rev = count(A, B, C) + count(A, B, D) - count(A, B, C*D//gcd(C, D))
print(B - A + 1 - rev)

Measured memory_bytes: 3064
using System;
class Program {
    static void Main (string[] args) {
        string input = Console.ReadLine ();
        if ((input.Substring(2,1) == input.Substring(3,1)) && (input.Substring(4,1) == input.Substring(5,1))) {
            Console.WriteLine ("Yes");
        } else {
            Console.WriteLine ("No");
        }

    }
}


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

int main() {
	int r;
	cin >> r;
	string ans;
	if (r < 1200)
		ans = "ABC";
	else if (r < 2800)
		ans = "ARC";
	else
		ans = "AGC";
	cout << ans << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

int cnt = 0;

void insertSort(int *A,int n,int g);

int main(){
  int n;
  int m = 0;
  int i,j;
  int *A;
  int G[20];

  scanf("%d", &n);
  A = malloc(sizeof(int) * n);
  for(i=0; i<n; i++) scanf("%d", &A[i]);

  G[0] = 0;
  
  while(1){
    if(n < 3*G[m]+1) break;
    G[m+1] = 3*G[m] + 1;
    m++;
 }

 for(i=m; i>0; i--)
   insertSort(A,n,G[i]);

  printf("%d\n", m);
  
  for(i=m; i>=1; i--)
    printf("%d ", G[i]);

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

  for(i=0; i<n; i++)
    printf("%d\n", A[i]);

  return 0;
}

void insertSort(int *A,int n,int g){
  int i,j;
  int key;
  for(i=g; i<n; i++){
    j = i;
    key = A[i];
    while(0 <= j-g){
      if(A[j-g] <= key) break;
      A[j] = A[j-g];
      j = j-g;
      cnt++;
    }
   A[j] = key;
 }
}



Measured memory_bytes: 5644
#include <iostream>

using namespace std;

int main() {
	int n;
	cin >> n;
	int pre = 0;
	int c = 0;
	int ans = 0;
	for(int i = 0; i < n; i++) {
		int a;
		cin >> a;
		if(pre!=a) {
			c = 0;
		}else {
			c++;
			if(c%2==1) ans++;
		}
		pre = a;
	}
	cout << ans << endl;
}


Measured memory_bytes: 888
#include <iostream>

int main()
{
    int N, i, p, ans, m;
    std::cin >> N;
    ans = 0;
    m = 0;

    for (i = 0; i < N; i++){
        std::cin >> p;
        ans += p;

        if (p > m){
            m = p;
        }
    }

    ans -= int(m/2);

    std::cout << ans << std::endl;

    return 0;
}

Measured memory_bytes: 504
import numpy as np
import sys
 
stdin = sys.stdin
 
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces
 
n = ni()
if n==1:
    print('Hello World')
else:
    a = ni()
    b = ni()
    print(a+b)

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

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

const int INF = 1001001001001001001LL;

signed main() {
    int D, G;
    cin >> D >> G;
    vector<int> P(D), C(D);
    for (int i = 0; i < D; i++) {
        cin >> P[i] >> C[i];
    }
    int ans = INF;
    for (int S = 0; S < (1 << D); S++) {
        int tmp = 0;
        int score = 0;
        for (int i = 0; i < D; i++) {
            if (S >> i & 1) {
                score += 100 * (i + 1) * P[i] + C[i];
                tmp += P[i];
            }
        }
        for (int i = D - 1; i >= 0; i--) {
            if (S >> i & 1) continue;
            int r = P[i];
            while (r && score < G) {
                tmp += 1;
                score += 100 * (i + 1);
                r--;
            }
        }
        chmin(ans, tmp);
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define INF 1000000000000000009
//#define INF 9223372036854775807
typedef long long ll;
#define REP(i,n) for(int i=0;i<(n);++i)
#define OREP(i,n) for(int i=1;i<=(n);++i)
#define ZREP(i,n) for(int i=1;i<(n);++i)
#define RREP(i,n) for(int i=(n)-1;i>=0;--i)
#define rollcall cout<<"I'm Sucu."<<endl;
#define YES(s) s?cout << "YES" << endl:cout << "NO" << endl
#define Yes(s) s?cout << "Yes" << endl:cout << "No" << endl
#define Taka(s) s?cout << "Takahashi" << endl:cout << "Aoki" << endl
#define out(s,t,u) s?cout << t << endl:cout << u << endl
#define int ll
#define Endl endl
//#define P pair<int,int>

signed main(){
    int N,M,Ans=0;
    int a[114514]={};
    int A[114514]={};
    cin >> N >> M;
    REP(i,N){
        cin >> a[i];
        if(i==0){
            A[i]=a[i]%M;
        }else{
            A[i]=(A[i-1]+a[i])%M;
        }
    }
    //REP(i,N){cout << A[i] << " ";}cout << Endl;
    sort(A,A+N);
    //REP(i,N){cout << A[i] << " ";}cout << Endl;
    
    REP(i,N){
        if(A[i]==0){
            Ans++;
        }
    }
    
    int s=1;
    ZREP(i,N){
        if(A[i]==A[i-1]){
            s++;
        }else{
            Ans+=s*(s-1)/2;
            s=1;
        }
    }
    Ans+=s*(s-1)/2;
    
    cout << Ans << endl;
	return 0;
}

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

using namespace std;

const int nmax = 1e7 + 10;
bool prime[nmax];

int main(){
	int n;
	cin >> n;
	vector<long long>divisors(n + 1, 0);
	for (int i = 1; i <= n; ++i)
		for (int j = i; j <= n; j += i)
			++divisors[j]; 
	unsigned long long suma = 0;
	for(int i = 1; i <= n; i++){
		suma = suma + (long long)(i * divisors[i]);
	}
	cout << suma << endl;
}



Measured memory_bytes: 81408
#include <bits/stdc++.h>
using namespace std;
#define r(i,n) for(int i=0;i<n;i++)
int dp[101][5][5][5],b[101],x,y,ans,n,m;
main(){
	cin>>n>>m;
	r(i,m){
		cin>>x>>y;
		b[x-1]=y;
	}
	dp[0][0][0][0]=1;
	r(i,n){
		if(b[i]){
			r(j,3)r(k,3)r(l,3)if(dp[i][j][k][l])
				if(b[i]==1)dp[i+1][j+1][0][0]+=dp[i][j][k][l];
				else if(b[i]==2)dp[i+1][0][k+1][0]+=dp[i][j][k][l];
				else dp[i+1][0][0][l+1]+=dp[i][j][k][l];
		}
		else{
			r(j,3)r(k,3)r(l,3)if(dp[i][j][k][l])
				dp[i+1][j+1][0][0]+=dp[i][j][k][l],
				dp[i+1][0][k+1][0]+=dp[i][j][k][l],
				dp[i+1][0][0][l+1]+=dp[i][j][k][l];
		}
		r(j,3)r(k,3)r(l,3)dp[i+1][j][k][l]%=10000;
	}
	r(j,3)r(k,3)r(l,3)ans+=dp[n][j][k][l];
	cout<<ans%10000<<endl;
}

Measured memory_bytes: 3092
// AOJ 1182 Railway Connection
// 2018.2.22 bal4u
 
#include <stdio.h>
#include <string.h>

#define QMAX 10000
typedef struct { int t; int s; } QUE;
QUE que[QMAX]; int qsize;

#define PARENT(i) ((i)>>1)
#define LEFT(i)   ((i)<<1)
#define RIGHT(i)  (((i)<<1)+1)

void min_heapify(int i)
{
	int l, r, min;
	QUE qt;

	l = LEFT(i), r = RIGHT(i);
	if (l < qsize && que[l].t < que[i].t) min = l; else min = i;
	if (r < qsize && que[r].t < que[min].t) min = r;
	if (min != i) {
		qt = que[i], que[i] = que[min], que[min] = qt;
		min_heapify(min);
	}
}

void deq()
{
	que[0] = que[--qsize];
	min_heapify(0);
}

void enq(int s, int t)
{
	int i, min;
	QUE qt;

	i = qsize++;
	que[i].s = s, que[i].t = t;
	while (i > 0 && que[min = PARENT(i)].t > que[i].t) {
		qt = que[i], que[i] = que[min], que[min] = qt;
		i = min;
	}
}

#define INF 0x10101010

int d[22][102][102];
int p[22], q[22][52], r[22][52];
int hi[250], to[102][250], w[102][250];
int dist[102];

//#define getchar_unlocked()  getchar()
int in()
{
	int n = 0;
	int c = getchar_unlocked();
	while (c <= ' ') c = getchar_unlocked();
	do n = 10*n + (c & 0xf), c = getchar_unlocked();
	while (c >= '0');
	return n;
}

int dijkstra(int s, int g)
{
	int i, e, d;

	memset(dist, INF, sizeof(dist));
	qsize = 0;
	enq(s, 0), dist[s] = 0;
	while (qsize) {
		s = que[0].s, deq();
		for (i = 0; i < hi[s]; i++) {
			e = to[s][i], d = dist[s] + w[s][i];
			if (d < dist[e]) dist[e] = d, enq(e, d);
		}
	}
	if (dist[g] >= INF) return -1;
	return dist[g];
}

int fare(int c, int dist)
{
	int i, pre, ans;

	ans = 0, pre = 0;
	for(i = 0; q[c][i] <= dist; i++) {
		ans += r[c][i] * (q[c][i] - pre);
		pre = q[c][i];
	}
	return ans + r[c][i] * (dist - pre);
}
	
int main()
{
	int N, M, C, S, G, i, j, k;
	int x, y, c, t;

	while (N = in()) {
		M = in(), C = in(), S = in()-1, G = in()-1;

		memset(d, INF, sizeof(d));
		for (c = 0; c < C; c++) for (i = 0; i < N; i++) d[c][i][i] = 0;

		for (i = 0; i < M; i++) {
			x = in()-1, y = in()-1, t = in(), c = in()-1;
			if (t < d[c][x][y]) d[c][x][y] = d[c][y][x] = t;
		}

		for (c = 0; c < C; c++) {
			for (k = 0; k < N; k++) for (i = 0; i < N; i++) for (j = 0; j < N; j++) {
				t = d[c][i][k] + d[c][k][j];
				if (t < d[c][i][j]) d[c][i][j] = t;
			}
		}

		for (c = 0; c < C; c++) p[c] = in();
		for (c = 0; c < C; c++) {
			for (i = 1; i < p[c]; i++) q[c][i] = in();
			q[c][p[c]] = INF;
			for (i = 1; i <= p[c]; i++) r[c][i] = in();
		}

		memset(hi, 0, sizeof(hi));
		for (int i = 0; i < N; i++) for (int j = 0; j < N; j++) {
			t = INF;
			for (c = 0; c < C; c++) if (d[c][i][j] < INF) {
				if (t > (k=fare(c, d[c][i][j]))) t = k;
			}

			if (t < INF) {
				k = hi[i]++, to[i][k] = j, w[i][k] = t;
				k = hi[j]++, to[j][k] = i, w[j][k] = t;
			}
		}
		printf("%d\n", dijkstra(S, G));
	}
	return 0;
}



Measured memory_bytes: 2804
#include <stdio.h>
#include <assert.h>
#include <fstream>
#include <iostream>
#include <algorithm>
#include <array>
#include <vector>
#include <queue>
#include <set>
#include <cmath>
//#include <unordered_map>
//#include <unordered_set>
//#include <boost/container/static_vector.hpp>
//#include <boost/unordered_set.hpp>
//#include <boost/unordered_map.hpp>
//#include <unistd.h>

//#include <cv.h>
//#include <highgui.h>
#include <stdlib.h>
#include <string>

const int MAX_N = 200;
int N;
std::string S[MAX_N];
int P[MAX_N];

int main(int argc, char **argv) {
    std::cin >> N;

    for (int i = 1; i <= N; i++) {
        std::cin >> S[i] >> P[i];
    }

    std::vector<int> vec;

    for (int i = 1; i <= N; i++) {
        vec.push_back(i);
    }

    std::sort(vec.begin(), vec.end(),
        [](const int a, const int b) { 
            if (S[a] != S[b]) { return S[a] < S[b]; }
            return P[a] > P[b];
        }
    );

    for (int i = 0; i < vec.size(); i++) {
        std::cout << vec[i] << std::endl;
    }

    return 0;
}


Measured memory_bytes: 256
import numpy as np
n = int(input())
li_a = list(map(int, input().split()))
A = [0]*(10**5)
s = sum(li_a)

li_a = list(map(lambda x: x-1, li_a))
for a in li_a:
    A[a] += 1
q = int(input())
for i in range(q):
    b, c = map(int, input().split())
    if A[b-1]>0:
        A[c-1] += A[b-1]
        s -= b * A[b-1]
        s += c * A[b-1]
        A[b-1] = 0
        print(s)
    else:
        print(s)

Measured memory_bytes: 38628
num_list = raw_input().split()
num_list = map(int, num_list)

def gcd(x, y): 
    if x < y:
        x, y = y, x
    while (y>0):
        r = x % y 
        x = y 
        y = r 

    return x

x = num_list[0]
y = num_list[1]

print gcd(x, y)

Measured memory_bytes: 6448
#include <bits/stdc++.h>
#define FIO ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);

using namespace std;

int main() {
    /**
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
    **/
	FIO
	int n; cin >> n;
	vector<string> words;
	for (int i = 0; i < n; i++) {
		string str; cin >> str;
		words.push_back(str);
	}
	vector<string> w = words;
	if (true) {
		sort(words.begin(), words.end());
		for (int i = 0; i < n-1; i++) {
			if (words[i] == words[i+1]) {
				cout << "No" << "\n";
				exit(0);
			}
		}
	}
	string lw = w[0];
    bool ans = true;
	for (int i = 1; i < w.size(); i++) {
		string s = w[i];
		if ((lw != s) && (s[0] == lw[lw.size()-1]))
			lw = s;
		else {
			ans = false;
			break;
		}
	}
	(ans) ? cout << "Yes" << "\n" : cout << "No" << "\n";
	return 0;
}

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

class Test
{
    static void Main()
    {
        int q = int.Parse(Console.ReadLine());
        List<int> A = new List<int>();

        for (int i = 0; i < q; i++)
        {
            int[] arr = Console.ReadLine().Split().Select(int.Parse).ToArray();
            switch (arr[0])
            {
                case 0:
                    A.Add(arr[1]);
                    break;
                case 1:
                    Console.WriteLine(A[arr[1]]);
                    break;
                case 2:
                    A.RemoveAt(A.Count - 1);
                    break;
            }
        }
    }
}



Measured memory_bytes: 23584
N = int(input())
ai = []
for i in range(N):
    ai.append(int(input()))

first = -1
second = -1
for i in ai:
    if first < i:
        second = first
        first = i
    elif second < i:
        second = i

for x in ai:
    if x == first:
        print(second)
    else:
        print(first)


Measured memory_bytes: 12512
#include<bits/stdc++.h>
using namespace std;
using lint = long long int;
using pint = pair<int, int>;
using plint = pair<lint, lint>;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((lint)(x).size())
#define POW2(n) (1LL << (n))
#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
const lint mod=1e9+7;

int main()
{
  string n;
  cin >> n;
  auto res = find(n.begin(), n.end(), '7');

  if(res == n.end()) cout<< "No\n";
  else cout << "Yes\n";
  return 0;
}


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


int main() {
  int n;
  cin >> n;
  int to=0;
  vector<int>a(n);
  rep(i,n){
    cin>>a.at(i);
    to+=a.at(i);
  }
  int h=to/n;
  if(abs(to-to/n*n)>abs(to-(to/n+1)*n)){
    h=to/n+1;
  }
  int ans=0;
  rep(i,n){
    ans+=(h-a.at(i))*(h-a.at(i));
  }
  cout<<ans<<endl;
 
}



Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
#include <random>
#include <chrono>
//#include <ext/pb_ds/tree_policy.hpp>
//#include <ext/pb_ds/assoc_container.hpp>

#define _ << " " <<
#define all(v) v.begin(), v.end()
#define sp(n) fixed << setprecision(n)
#define ff first
#define ss second

using namespace std;
//using namespace __gnu_pbds;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

const ll mod = 1791791791;
const double eps = DBL_EPSILON;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
#ifdef LOCAL_DEBUG
    //freopen("input.txt", "r", stdin);
#endif
    string a, b;
    cin >> a >> b;
    b.pop_back();
    puts(a == b ? "Yes" : "No");
    return 0;
}

Measured memory_bytes: 3616
"""
B - Shiritori
しりとりを判定
条件は、
まだ発言なし
頭とお尻一致
"""

N = int(input())

says = []
for part in range(N):
    says.append(input())

says_unique = []
for say in says:
    # 単語重複
    if say in says_unique:
        print("No")
        break
    
    
    if len(says_unique) == 0:
        says_unique.append(say)
    else:
        if say[0] == says_unique[-1][-1]:
            says_unique.append(say)
        else:
            print("No")
            break
else:
    print("Yes")

Measured memory_bytes: 3064
/*Hatsune Miku 4ever!*/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define _for(i,a,b) for(int i = (a);i < b;i ++)
#define _rep(i,a,b) for(int i = (a);i > b;i --)
#define INF 0x3f3f3f3f
#define mod 1000000007
#define lowbit(x) ((x)&(-x))
#define pb push_back
#define MIKU 39
#define Design ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define debug() printf("Miku Check OK!\n")
#define maxn 200039

int n, m;
struct Djs
{
	int par[maxn];
	int high[maxn];
	int num[maxn];
	void renew()
	{
		_for(i,1,maxn)
		{
			par[i] = i;
			high[i] = 0;
			num[i] = 1;
		}
	}
	int find(int x)
	{
		//路径压缩 
		return par[x] == x ? x : par[x] = find(par[x]);
	}
	void unite(int x,int y)
	{
		x = find(x);
		y = find(y);
		if(x==y) return ;
		//按秩合并 
		if(high[x]<high[y])
		{
			par[x] = y;
			num[y] += num[x];
		}
		else
		{
			par[y] = x;
			if(high[x]==high[y])
				high[x] ++;
			num[x] += num[y];
		}
	}
	bool same(int x,int y)
	{
		return find(x) == find(y);
	}
}djs;

int main()
{
	scanf("%d%d",&n,&m);
	djs.renew();
	_for(i,1,m+1)
	{
		int x, y;
		scanf("%d%d",&x,&y);
		djs.unite(x,y);
	}
	int ans = 0;
	_for(i,1,n+1)
		ans = max(ans,djs.num[i]);
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 6176
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int , int> i_i;
typedef vector<ll> vel;
typedef vector<int> vei;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> ve_vel;
typedef vector<vector<int>> ve_vei;
typedef vector<vector<char>> ve_vec;
typedef vector<vector<bool>> ve_veb;
typedef vector<vector<string>> ve_ves;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define fs first
#define sc second
#define pub push_back
#define puf push_front
#define pob pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

#define MAX_N 100000
ll dp[MAX_N+1];

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

    int N,K; cin >> N >> K;
    vei h(N); rep(i,N) cin >> h[i];

    memset(dp, INF, sizeof(dp));

    rep(i,N) {
        if(i == 0) dp[0] = 0;
        else if(i >=  K) {
            ll temp = INF;
            rep(j,K) temp = min(temp, dp[i - j - 1] + abs(h[i] - h[i - j - 1]) );
            dp[i] = temp;
        }
        else {
            ll temp = INF;
            rep(j,i) temp = min(temp, dp[j] + abs(h[i] - h[j]));
            dp[i] = temp;
        }
    }
    cout << dp[N-1] << endl;
    return 0;
}



Measured memory_bytes: 1408
#define _USE_MATH_DEFINES
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <ctime>
#include <cassert>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>
#include <list>


#ifdef _DEBUG
#define typeof(X) std::identity<decltype(X)>::type //C++0x (for vs2010)
#else
#define typeof(X) __typeof__(X) // for gcc
#endif

using namespace std;
static const double EPS = 1e-6;
typedef long long ll;
const int MODULO = 1000000007;
const int INF = 100000000; //1e8

typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
typedef complex<double> Cd;


int main(){
	int c1,c2,c3;
	while(cin>>c1>>c2>>c3){
		vector<int> n(10);
		for (int i = 0; i < 10; i++)
			n[i] = i+1;
		n.erase(find(n.begin(),n.end(),c1));
		n.erase(find(n.begin(),n.end(),c2));
		n.erase(find(n.begin(),n.end(),c3));
		int cnt = 0;
		for (int i = 0; i < 7; i++){
			if(c1+c2+n[i] <= 20) cnt++;
		}
		cout << (cnt >= 4 ? "YES" : "NO") << endl;
	}
	return 0;
}

Measured memory_bytes: 0