akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <cmath>
#include <vector>
#include <algorithm>
#include <functional>
#include <cstdio>
#include <iomanip>

using namespace std;
// for loop
#define F(i, L, R) for(int i = L; i < R; i++)
#define FE(i, L, R) for(int i = L; i <= R; i++)
// for (reversed)
#define FR(i, L, R) for(int i = L; i > R; i--)
#define FRE(i, L, R) for(int i = L; i >= R; i--)

// data types
#define ul unsigned long
#define ll long long
#define ull unsigned long long
#define ui unsigned int
#define us unsigned shoft

// vectors
typedef vector<int> vi;
typedef vector<long> vl;
typedef vector<vi> vvi;
typedef pair<int, int> ii;
#define ALL(c) (c).begin(),(c).end()
#define last(vec) vec.size()-1
#define lastEle(vec) vec[last(vec)]

// debug
#define DBG(vari) cerr<<#vari<<" = "<<(vari)<<endl;
#define printA(a, L, R) FE(i, L, R) cout << a[i] << (i==R?'\n':' ')
#define printAF(a, L) printA(a, 0, L-1)
#define printV(a) printA(a, 0, a.size()-1)

// utils
#define char2int(c) (c-'0')
#define bit(x, i) (x&(1<<i))
#define space ' '
#define PI 3.14159265358979323

int main() {
    int n;
    cin >> n;
    vvi data(4, vi(14));
    F(i, 0, n){
        char op;
        int num;
        cin >> op >> num;
        switch(op){
            case 'S':
                data[0][num] = 1;
                break;
            case 'H':
                data[1][num] = 1;
                break;
            case 'C':
                data[2][num] = 1;
                break;
            case 'D':
                data[3][num] = 1;
                break;
            default:
                cerr << "undefined card" << endl;
                break;
        }
    }
    F(i, 0, 4){
        char ope;
        switch(i){
            case 0:
                ope = 'S';
                break;
            case 1:
                ope = 'H';
                break;
            case 2:
                ope = 'C';
                break;
            case 3:
                ope = 'D';
                break;
            default:
                break;
        }
        FE(k, 1, 13){
            if(data[i][k] == 0){
                // missing
                cout << ope << space << k << endl;
            }
        }
    }

}



Measured memory_bytes: 3148
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

N, A, B, C, D, E = [INT() for _ in range(6)]
trans = [A, B, C, D, E]
num_city = [N, 0, 0, 0, 0, 0]
time = 0
for i in range(5):
	# print(num_city)
	if not i==4:
		if trans[i] == 1:
			tmp = 1
		else:
			tmp = num_city[i]%trans[i]
		num_city[i+1] = N-tmp
		if N-tmp <= trans[i+1]*((time+(ceil(num_city[i]/trans[i])))-(i+1)):
			num_city[i+1] = 0
		else:
			num_city[i+1] -= trans[i+1]*((time+(ceil(num_city[i]/trans[i])))-(i+1))
		num_city[i+1] += tmp
		time += ceil(num_city[i]/trans[i])
		num_city[i] = 0
	else:
		time += ceil(num_city[4]/E)
print(time)

Measured memory_bytes: 3948
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <array>
#include <queue>
#include <stack>
#include <algorithm>
#include <tuple>
#include <numeric>
#include <type_traits>

int main()
{
	int N;
	std::vector<int> H;

	std::cin >> N;
	H.resize(N);
	for (auto& h : H)
		std::cin >> h;

	int ret = 1;
	int hmax = H[0];
	for (int i = 1; i < N; ++i) {
		if (H[i] >= hmax) {
			++ret;
			hmax = H[i];
		}
	}

	std::cout << ret << "\n";
}


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

using namespace std;
using namespace __gnu_pbds;

#define PB push_back
#define EB emplace_back
#define MP make_pair
#define F first
#define S second
#define FBO find_by_order
#define OOK order_of_key
#define MSET(m,v) memset((m),(v),sizeof(m))
#define UB(c,v) (upper_bound((c).begin(),(c).end(),(v)))
#define LB(c,v) (lower_bound((c).begin(),(c).end(),(v)))
#define INREP int TC;cin>>TC;while(TC--)
#define CPPIO ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define PI 3.1415926535897932384626433832795028841971693993751
#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cerr << name << " : " << arg1 << endl;
}
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...);
}
#else
#define trace(...)
#endif

typedef long long ll;
typedef long double ld;
typedef vector <int> vi;
typedef vector <ll> vll;
typedef pair <int,int> pii;
typedef pair <ll,ll> pll;
typedef vector <pii> vpii;
typedef vector <pll> vpll;
typedef tree <int, null_type, less <int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;

// SOLUTION

int main () {
	CPPIO;
    int n, m;
    cin >> n;
    string s;
    map <string, int> cnt;
    while (n--) {
        cin >> s;
        cnt[s]++;
    }
    cin >> m;
    while (m--) {
        cin >> s;
        cnt[s]--;
    }
    int ans = 0;
    for (auto i : cnt) {
        // trace (i.F, i.S);
        ans = max (ans, i.S);
    }
    cout << ans;
	return 0;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES

#include <iostream>
#include <iomanip>
#include <stdio.h>

#include <sstream>
#include <algorithm>
#include <iterator>
#include <cmath>
#include <complex>

#include <string>
#include <cstring>
#include <vector>
#include <bitset>

#include <queue>
#include <set>
#include <map>
#include <stack>
#include <list>

#include <ctime>
////
//#include <random>//
/////////

typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;

////定数
const int INF = (int)1e9 + 10;
const LL MOD = (LL)1e9 + 7;
const LL LINF = (LL)4e18 + 20;
const LD PI = acos(-1.0);
const double EPS = 1e-9; 
/////////
using namespace::std;
template<typename T>
void chmax(T& a, T b) {
	a = max(a, b);
}

template<typename T>
void chmin(T& a, T b) {
	a = min(a, b);
}

template<typename T>
void IN(vector<T> &A,int N=-1) {
	if (N == -1) {
		N = A.size();
	}
	for (int i = 0; i < N; ++i) {
		cin >> A[i];
	}
}

template<typename T>
void SO(vector<T> &A,bool F=false) {
	sort(A.begin(), A.end());
	if (F) {
		reverse(A.begin(), A.end());
	}
}
//////////////

void solve() {
	int K, X;
	cin >> K >> X;
	int A = 500 * K;
	string ans="No";
	if (A >= X) {
		ans = "Yes";
	}
	cout << ans << endl;
}

signed main(void) {
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	std::cout << std::fixed;//小数を10進数表示
	cout << setprecision(16);//小数点以下の桁数を指定//coutとcerrで別	

	solve();
}


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

int main(){
	ios::sync_with_stdio(false);
	int n;
	int i,j,flag;
	while(cin>>n){
		flag=false;
		for(i=0;i<=n/4&&!flag;i++){
			for(j=0;j<=n/7&&!flag;j++){
				if(4*i+7*j==n){
					flag=true;
					break;
				}
			}
		}
		if(flag)
			puts("Yes");
		else
			puts("No");
	}
	return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Collections;
using System.Collections.Specialized;
using System.Linq;
using System.Text;
using System.IO;
using System.Reflection;
using static System.Math;
using System.Numerics;
static class Program{
	const int mod=(int)1e9+7;
	static void Main(){
		Sc sc=new Sc();
		var n=sc.I;
		var a=new int[n];
		var b=new int[n];
		long p=int.MaxValue,m=0,c=0;
		long ans=0;
		for(int i = 0;i<n;i++) {
			var e=sc.Ia;
			m+=e[0];
			a[i]=e[0];
			b[i]=e[1];
			if(e[0]>e[1]){
				c++;
				p=Min(p,e[1]);
			}
		}
		if(c==1){
			for(int i = 0;i<n;i++) {
				if(a[i]<=b[i]){ans+=a[i];}
				else{ans+=a[i]-b[i];}
			}
		}
		else if(c!=0){ans=m-p;}
		Console.WriteLine("{0}",ans);
	}
}

public class Sc{
	public int I{get{return int.Parse(Console.ReadLine());}}
	public long L{get{return long.Parse(Console.ReadLine());}}
	public double D{get{return double.Parse(Console.ReadLine());}}
	public string S{get{return Console.ReadLine();}}
	public int[] Ia{get{return Array.ConvertAll(Console.ReadLine().Split(),int.Parse);}}
	public long[] La{get{return Array.ConvertAll(Console.ReadLine().Split(),long.Parse);}}
	public double[] Da{get{return Array.ConvertAll(Console.ReadLine().Split(),double.Parse);}}
	public string[] Sa{get{return Console.ReadLine().Split();}}
	public object[] Oa{get{return Console.ReadLine().Split();}}
	public int[] Ia2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),int.Parse);}}
	public int[] Ia3(int a){return Array.ConvertAll((a.ToString()+" "+Console.ReadLine()).Split(),int.Parse);}
	public int[] Ia3(bool a,int b,bool c,int d){return Array.ConvertAll(((a?b.ToString()+" ":"")+Console.ReadLine()+(c?" "+d.ToString():"")).Split(),int.Parse);}
	public long[] La2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),long.Parse);}}
	public long[] La3(int a){return Array.ConvertAll((a.ToString()+" "+Console.ReadLine()).Split(),long.Parse);}
	public long[] La3(bool a,int b,bool c,int d){return Array.ConvertAll(((a?b.ToString()+" ":"")+Console.ReadLine()+(c?" "+d.ToString():"")).Split(),long.Parse);}
	public T[] Arr<T>(int n,Func<T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f();}return a;}
	public T[] Arr<T>(int n,Func<int,T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i);}return a;}
	public T[] Arr<T>(int n,Func<string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(Console.ReadLine().Split());}return a;}
	public T[] Arr<T>(int n,Func<int,string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i,Console.ReadLine().Split());}return a;}
}

Measured memory_bytes: 17320
#include<iostream>
#include<cmath>
#include<cstdio>
#include<vector>
#include<queue>
#include<string>
#include<algorithm>
#include<set>
#include<map>
using namespace std;
using ll = long long;

int main(){
  ll n,m,x;
  cin >> n >> m >> x;
  ll c[13],a[13][13];
  for(ll i=0;i<n;i++){
    cin >> c[i];
    for(ll j=0;j<m;j++){
      cin >> a[i][j];
    }
  }
  ll ans = 1e12;
  ll kane;
  ll r[13];
  for (ll bit = 0; bit < (1<<n); ++bit) {
      kane = 0;
      for(ll l=0;l<m;l++)  r[l]=0;
      for (ll i = 0; i < n; ++i) {
          if (bit & (1<<i)) { 
              kane += c[i];
              for(ll j=0;j<m;j++){
                r[j]+=a[i][j];
              }
          }
      }
      bool flag = true;
      for(ll j=0;j<m;j++){
        if(r[j]<x) flag = false;
      }
      if(flag) ans = min(ans, kane);
  }
  if(ans > 1e10){
    cout << -1 << endl;
  }
  else
    cout << ans << endl;
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
const int inf = (1 << 30) - 1;

int main()
{
  int A, B, K;
  cin >> A >> B >> K;

  for (int i = min(A, B); i > 0; i--) {
    if (A % i == 0 && B % i == 0) {
      K--;
      if (K == 0) {
        cout << i << endl;
        return 0;
      }
    }
  }
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
	public static void main(String args[]) {
		Scanner sc=new Scanner(System.in);
	int h1=sc.nextInt();
	int m1=sc.nextInt();
	int h2=sc.nextInt();
	int m2=sc.nextInt();
	int k=sc.nextInt();
	int min=60*(h2-h1)+(m2-m1);
	if(min<=k) {
		System.out.println(0);
	}
	else {
		System.out.println(min-k);
	}
	}
}


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

vector<int> getFull(int n);
vector<int> getSequence(int n, int end);

int bits(int x) {
    int ans = 0;
    while(x > 0) {
        ans += (x % 2);
        x /= 2;
    }
    return ans;
}

bool good(int x, int y) {
    int z = (x xor y);
    return (z & (z - 1)) == 0;
}

bool goodSequence(vector<int> a) {
    int n = a.size();
    for(int i = 1; i < n; i += 1) {
        if(not good(a[i], a[i - 1]))
            return false;
    }
    return true;
}

vector<int> getGrayCode(int n) {
    cerr << "GETGRAY " << n << "\n";
    if(n == 1)
        return {0, 1};
    vector<int> ret = getGrayCode(n - 1);
    for(int i = int(ret.size()) - 1; i >= 0; i -= 1) {
        ret.push_back((1 << (n - 1)) + ret[i]);
    }
    return ret;
}

vector<int> getFull(int n) {
    cerr << "GETFULL " << n << "\n";
    if(n == 1)
        return {0, 1};
    vector<int> ret = getGrayCode(n - 1);
    int last = (1 << (n - 1)) - 1;
    int last_ret = ret.back();

    vector<int> second = getSequence(n - 1, last ^ last_ret);

    for(auto& val : second) {
        val ^= last_ret;
        val += (1 << (n - 1));
        ret.push_back(val);
    }
    return ret;
}

vector<int> getSequence(int n, int end) {
    cerr << "GETSEQUENCE " << n << " " << end << "\n";
    if(n == 1) {
        if(end == 0) 
            return {1, 0};
        else
            return {0, 1};
    }

    if(end == ((1 << n) - 1)) {
        return getFull(n);
    }
    
    vector<int> pos(n, 0);

    for(int i = 0; i < n; i += 1)
        if((1 << i) & end) {
            pos[i] = 1;
        }

    int k = bits(end);

    vector<int> alfa = getGrayCode(n - k);
    vector<int> beta = getFull(k);
        
    for(auto elem : alfa)
        cerr << elem << " ";
    cerr << "\n";
    for(auto elem : beta)
        cerr << elem << " ";
    cerr << "\n";

    vector<int> ret((1 << n), 0);
    
    for(int i = 0; i < (1 << n); i += 1) {
        int temp_beta = beta[i / (1 << (n - k))];
        int par = (i / (1 << (n - k))) % 2;
        int temp_alfa = alfa[i % alfa.size()];
        if(par)
            temp_alfa = alfa[alfa.size() - 1 - i % alfa.size()];

        for(int j = 0; j < n; j += 1) {
            if(pos[j] == 0) {
                ret[i] += (1 << j) * (temp_alfa % 2);
                temp_alfa /= 2;
            } else {
                ret[i] += (1 << j) * (temp_beta % 2);
                temp_beta /= 2;
            }
        }
    }

    return ret;
}

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

    if(bits(a) % 2 == bits(b) % 2) {
        cout << "NO\n";
        return 0;
    }

    int c = a xor b;    
    cout << "YES\n";

    vector<int> seq = getSequence(n, c);
    assert(goodSequence(seq));

    for(auto &val : seq) {
        val ^= a;
        cout << val << " ";
    }
}   

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

int main(void) {
	string s;
	cin >> s;
	bool f = false;
	bool t = false;
	int k;

	for (int i = 0; i < s.size(); i++)
	{
		if (s[i] == 'C') {
			t = true;
			k = i;
		}
	}
	if (!t)
	{
		cout << "No" << endl;
		return 0;
	}

	for (int t = k; t < s.size(); t++)
	{
		if (s[t] == 'F') {
			f = true;
		}
	}


	if (f&&t)
	{
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	


	return 0;
}

Measured memory_bytes: 256
import numpy as np
H, W, A, B = map(int, input().split())

mat = [np.array(([0] * A) + ([1] * (W - A))) for _ in range(H)]

for i in range(min(H, B)):
    mat[i] = 1 - mat[i]

mat = [r.astype(str).tolist() for r in mat]
print("\n".join("".join(r) for r in mat))

Measured memory_bytes: 29204
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <functional>
#include <utility>
#include <tuple>
#include <cctype>
#include <bitset>
#include <complex>
#include <cmath>
#include <array>
#include <numeric>
using namespace std;
#define INF 0x3f3f3f3f
#define INFLL 0x3f3f3f3f3f3f3f3fLL
//#define mod 998244353
#define MOD 1000000007
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pint;
typedef pair<ll,ll> pll;
typedef tuple<int,int,int> tint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<ull> vull;
typedef vector<pint> vpint;
int dx[8]={0,0,-1,1,1,1,-1,-1};
int dy[8]={-1,1,0,0,1,-1,1,-1};
const int SIZE=200050;
//templete
int main(){
	int N,H,W;
	cin>>N>>H>>W;
	cout<<(N-H+1)*(N-W+1)<<endl;
	return 0;
}

Measured memory_bytes: 256
# -*- coding:utf-8 -*-
A, B, C = map(int, input().split())
if A == B and B == C:
    if A%2 != 0:
        print(0)
    else:
        print(-1)
else:
    ans = 0
    while A%2 == 0 and B%2 == 0 and C%2 ==0:
        a = (B+C)/2
        b = (A+C)/2
        c = (A+B)/2
        A = a
        B = b
        C = c
        ans += 1
    print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FOR(i, a, b) for(ll i = (a); i < (b); ++i)
#define REP(i, n) for(ll i = 0; i < (n); ++i)
#define ARRAY_LENGTH(array) sizeof(array)/sizeof(*array)
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

const ll MOD = 1000000007;
long long POW(long long x, long long n) {
    long long ret = 1;
    while (n > 0) {
        if (n & 1) ret = ret * x % MOD;  // n の最下位bitが 1 ならば x^(2^i) をかける
        x = x * x % MOD;
        n >>= 1;  // n を1bit 左にずらす
    }
    return ret;
}

int main() {
    ll N;
    cin >> N;

    if(N < 2) {
        cout << 0 << endl;
    } else {
        ll ans = POW(10, N) - POW(9, N) - POW(9, N) + POW(8, N);
        ans %= MOD;
        ans = (ans + MOD) % MOD;
        cout << ans << endl;
    }

    return 0;
}

Measured memory_bytes: 3564
/*
 ▓█████▄  ▄████▄  ▓██   ██▓ ██▓███   ██░ ██ ▓█████  ██▀███
▒██▀ ██▌▒██▀ ▀█   ▒██  ██▒▓██░  ██▒▓██░ ██▒▓█   ▀ ▓██ ▒ ██▒
 ░██   █▌▒▓█    ▄   ▒██ ██░▓██░ ██▓▒▒██▀▀██░▒███   ▓██ ░▄█ ▒
 ░▓█▄   ▌▒▓▓▄ ▄██▒  ░ ▐██▓░▒██▄█▓▒ ▒░▓█ ░██ ▒▓█  ▄ ▒██▀▀█▄
 ░▒████▓ ▒ ▓███▀ ░  ░ ██▒▓░▒██▒ ░  ░░▓█▒░██▓░▒████▒░██▓ ▒██▒
  ▒▒▓  ▒ ░ ░▒ ▒  ░   ██▒▒▒ ▒▓▒░ ░  ░ ▒ ░░▒░▒░░ ▒░ ░░ ▒▓ ░▒▓░
  ░ ▒  ▒   ░  ▒    ▓██ ░▒░ ░▒ ░      ▒ ░▒░ ░ ░ ░  ░  ░▒ ░ ▒░
  ░ ░  ░ ░         ▒ ▒ ░░  ░░        ░  ░░ ░   ░     ░░   ░
    ░    ░ ░       ░ ░               ░  ░  ░   ░  ░   ░
  ░      ░         ░ ░
*/
//focus less on how much problem you should solve within a fixed time and focus more on getting the problem solved and
//learning something from it
#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 fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define rep(i,a,b) for(ll i=a; i<b; i++)
#define per(i,a,b) for(ll i=a; i>=b; i--)
#define ll long long int
#define ld long double
#define vi vector<ll>
#define vii vector <pair<ll,ll> >
#define sedes set <ll, greater <ll> >
#define seasc set <ll>
#define pb push_back
#define mkp make_pair
#define ff first
#define ss second
#define MOD 1000000007
#define prec(n) fixed<<setprecision(n)
#define maxpq priority_queue<int>
#define minpq priority_queue<int, vector<int>, greater<int> >
#define umap unordered_map<ll, ll>
#define map map<ll, ll>
#define autoit(x,it) for(auto it = x.begin(); it != x.end(); it++)
#define mems(a, i) memset(a, i, sizeof(a))
#define endl '\n'
#define all(v) v.begin(),v.end()
#define gcd(a,b) __gcd((a),(b))
#define lcm(a,b) ((a)*(b))/gcd((a),(b))
#define printx(x) printf("%lld\n",x);
#define printxy(x,y) cout << x << y <<endl;
#define printxyz(x,y,z) cout << x << y << z <<endl;
#define deba(a) cout << #a << a << endl;
#define debab(a,b) cout << #a << a << #b << b << endl;
int main()
{
	fast;
#ifndef ONLINE_JUDGE
	freopen("/home/kushagra/Desktop/Kushagra/input.txt", "r", stdin);
	freopen("/home/kushagra/Desktop/Kushagra/output.txt", "w", stdout);
#endif
	ll n;
	cin >> n;
	ll a[n], b[n];
	vi v;
	rep(i, 0, n)
	cin >> a[i];
	rep(i, 0, n)
	cin >> b[i];
	rep(i, 0, n)
	{
		v.pb(a[i] - b[i]);
	}
	sort(all(v));
	reverse(all(v));
	ll ans = 0;
	rep(i, 0, n)
	{
		if (v[i] <= 0)
			break;
		ans += v[i];
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 3636
# B
S = list(str(input()))

count=0
for i, s in enumerate(S):
    if i%2==0:
        if s!="U" and s!="D" and s!="R":
             count=1
             break

    else:
        if s!="U" and s!="D" and s!="L":
             count=1
             break

if count==1:
    print("No")
else:
    print("Yes")

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

int main() {
    int n, ans = 0;
    string s;
    cin >> n >> s;
    for (int i = 0; i < 1000; ++i) {
        int ieei[3] = {i / 100, i / 10 % 10, i % 10};
        int idx = 0;
        for (int j = 0; j < s.size(); ++j) {
            if (s[j] - '0' == ieei[idx])
                idx++;
            if (idx == 3) {
                ans++;
                break;
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3616
#pragma GCC optimize("O3")
#define _CRT_SECURE_NO_WARNINGS
#define _CRT_DISABLE_PERFCRIT_LOCKS
#define POPCNTI(a) __builtin_popcount(a)
#define fs  first  
#define sc  second
#define ARR array
 
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
 
 
#include <bits/stdc++.h>
using namespace  __gnu_pbds; 
using namespace std;
 
 
// #ifndef _LOCAL_DEFINE
// inline int getchar_unlocked(){return _getchar_nolock();}
// inline void putchar_unlocked(char c) {_putchar_nolock(c);}
// #endif
 
typedef long long ll;  
inline void WRITE_CHAR(char c)  {putchar_unlocked(c);} 
template<typename T> 
inline bool READn (T &result) {
  int minus = 1;
  char ch;
  result=0;
  ch = (char) getchar_unlocked();
  while (!isdigit(ch) && ch!=EOF) minus = (ch == '-'? -1 : minus),ch= (char) getchar_unlocked();
 
  if(ch==EOF) return false;
  while (isdigit(ch))  result = result*10 + (int) (ch - '0'),ch = (char) getchar_unlocked();
  
  result *= minus;
  return ch != '\n';
}
template<typename T>
inline void WRITEn(T x) {
  if (x < 0) {putchar_unlocked('-'); x = -x; }
  char writeBuffer[20], *writePtr = writeBuffer;
  do {
    *writePtr++ = (char)('0' + x % 10);
    x /= 10;
  }
  while (x);
  do  { putchar_unlocked(*--writePtr); }
  while (writePtr > writeBuffer);
}
inline bool Read_CHAR(char &c)
{
  char READ_CHARACTER = (char)getchar_unlocked();
  while ((READ_CHARACTER == '\n' || READ_CHARACTER == '\t' || READ_CHARACTER == ' ')) READ_CHARACTER = (char)getchar_unlocked();
  if(READ_CHARACTER == EOF) return false;
  c = READ_CHARACTER;
  return true;
} 
inline bool READ_CHAR_ARRAY(char *x) {
  char READ_CHARACTER = (char)getchar_unlocked();
  while ((READ_CHARACTER == '\n' || READ_CHARACTER == '\t' || READ_CHARACTER == ' ')) READ_CHARACTER = (char)getchar_unlocked();
  if(READ_CHARACTER == EOF) return false;
  char *ptr = &x[0];
  while ((READ_CHARACTER != '\n' && READ_CHARACTER != '\t' && READ_CHARACTER != ' ' && READ_CHARACTER != EOF)) *ptr++ = READ_CHARACTER, READ_CHARACTER = (char)getchar_unlocked();
 
  *ptr = '\0';
  return true;
}
inline void WRITE_CHAR_ARRAY(const char *x) {
  while(*x != '\0')
    putchar_unlocked(*x++);
}
const ll OOl = 1e18 ;
const int N = 1e6+1,OO = 1e9,OOm = 0x3f3f3f3f, MOD = 1e9 + 7;
int arr[N],k;
void calc()
{
  
  int n = 1000;
  while(n<=10000)
  {
    arr[k++]=n;
    n+=1000;
  }
}
int main()
{
  calc();
  int n;
  READn(n);
  int cst = *lower_bound(arr,arr+k,n);
  WRITEn(cst-n);
  return 0;
}
 
 

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

int main()
{
    int a,b;
    
    while(1)
    {
        cin >> a >> b;
        
        if(a == 0 && b == 0) break;
        
        if(a < b)
        {
            cout << a << ' ' << b << endl;
        }
        else
        {
            cout << b << ' ' << a << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 3108
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)

class LCA:
    def __init__(self, edge, root):
        self.l = len(edge)
        self.stack = []
        self.stack.append((root, 0))
        self.vs = []
        self.depth = [0]*self.l
        self.firstVisited = [-1]*self.l
        while self.stack:
            v, d = self.stack[-1]
            if self.firstVisited[v] == -1:
                self.firstVisited[v] = len(self.vs)
            self.vs.append(v)
            self.depth[v] = d
            if edge[v]:
                self.stack.append((edge[v].pop(), d+1))
            else:
                self.stack.pop()
        
        self.n = len(self.vs)
        self.INF = (self.l, self.l)
        self.N0 = 1 << (self.n-1).bit_length()
        self.seg = [self.INF]*(self.N0 << 1)
        for i, v in enumerate(self.vs, self.N0):
            self.seg[i] = (self.depth[v], v)
        for i in range(self.N0-1, 0, -1):
            self.seg[i] = min(self.seg[2*i], self.seg[2*i+1])
    
    def _query(self, l, r):
        res = self.INF
        l += self.N0
        r += self.N0
        while l < r:
            if r & 1:
                res = min(res, self.seg[r-1])
            if l & 1:
                res = min(res, self.seg[l])
                l += 1
            l >>= 1
            r >>= 1
     
        return res

    def query(self, u, v):
        fu, fv = self.firstVisited[u], self.firstVisited[v]
        if fu > fv:
            fu, fv = fv, fu
        return self._query(fu, fv+1)[1]

n, q = map(int, input().split())
T = [[] for _ in range(n)]
for _ in range(n-1):
  a, b, c, d = map(int, input().split())
  a -= 1
  b -= 1
  T[a].append((b, c, d))
  T[b].append((a, c, d))
G = [[] for _ in range(n)]
edge = [[] for _ in range(n)]
stack = [(0, -1)]
while stack:
  v, par = stack.pop()
  for nv, c, d in T[v]:
    if nv == par:
      continue
    G[v].append((nv, c, d))
    edge[v].append(nv)
    stack.append((nv, v))

seg = LCA(edge, 0)
A = [0]*q
C = [[] for _ in range(n)]
num = [0]*n
cum = [0]*n
for i in range(q):
  x, y, u, v = map(int, input().split())
  u -= 1
  v -= 1
  a = seg.query(u, v)
  C[u].append((i, x, y, 1))
  C[v].append((i, x, y, 1))
  C[a].append((i, x, y, -2))
dist = 0
stack = [0]
def dfs(v):
  global dist
  for i, x, y, b in C[v]:
    A[i] += (dist + num[x]*y - cum[x]) * b
  for nv, c, d in G[v]:
    dist += d
    num[c] += 1
    cum[c] += d
    dfs(nv)
    dist -= d
    num[c] -= 1
    cum[c] -= d
dfs(0)
print(*A, sep="\n")

Measured memory_bytes: 215600
import bisect,collections,copy,heapq,itertools,math,numpy,string
import sys
sys.setrecursionlimit(10**7)

def S(): return sys.stdin.readline().rstrip()
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())
input = lambda: sys.stdin.readline().strip()

def main():
    N,M = LI()
    even_num = N*(N-1)/2    #NC2
    odd_num = M*(M-1)/2     #MC2
    print(int(even_num + odd_num))

main()


Measured memory_bytes: 12224
#include<bits/stdc++.h>
using namespace std;
namespace io{
    const int l=1<<20;
    char buf[l],*s,*t,c;
    inline void gc(){
        if(s==t){
            t=(s=buf)+fread(buf,1,l,stdin);
            c=s==t?EOF:*s++;
        }else c=*s++;
    }
    template<class IT>inline void gi(IT &x){
        x=0;gc();while(c<'0'||c>'9')gc();
        while('0'<=c&&c<='9'){x=(x<<1)+(x<<3)+(c^48);gc();}
    }
    char buf0[20];int a;
    template<class IT>inline void pi(IT x){
        if(x<0){putchar('-');x=-x;}
        do buf0[++a]=x%10+48;while(x/=10);
        while(a)putchar(buf0[a--]);
        putchar('\n');
    }
};
using io::gi;
using io::pi;
typedef unsigned int ui;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<int,ll > pil;
typedef pair<ll ,int> pli;
typedef pair<ll ,ll > pll;
typedef vector<int> vi;
typedef vector<ll > vl;
#define pque priority_queue
#define rep(i,l,r) for(i=(l);i<=(r);++i)
#define per(i,l,r) for(i=(l);i>=(r);--i)
#define REP(i,l,r) for(i=(l);i< (r);++i)
#define PER(i,l,r) for(i=(l);i> (r);--i)
#define mp make_pair
#define pb push_back
#define pf push_front
#define pob pop_back
#define pof pop_front
#define fi first
#define se second
template<class IT>inline void cmax(IT &a,IT b){if(a<b)a=b;}
template<class IT>inline void cmin(IT &a,IT b){if(b<a)a=b;}
const ll p=998244353ll,pp=p*p;
const int N=405,nn=400;
ll dp[N][N],fac[N],ifa[N];
inline ll expo(ll a,int b=998244351){
	ll c=1ll;
	while(b){
		if(b&1)c=c*a%p;
		b>>=1; a=a*a%p;
	}
	return c;
}
int main(){
    //freopen("a.in","r",stdin);
    //freopen("a.out","w",stdout);
    int n,a,b,x,X,A,SX=0,SA=0;ll pw,pt,ans=0ll;
	fac[0]=1ll;
	rep(x,1,nn)fac[x  ]=fac[x-1]*x%p;
	ifa[nn]=expo(fac[nn]);
	per(x,nn,1)ifa[x-1]=ifa[x  ]*x%p;
	dp[0][0]=998244352ll;
    scanf("%d",&n);
    while(n--){
		scanf("%d%d",&a,&b);
		per(A,SA,0)per(X,SX,0){
			pw=1ll;
			REP(x,0,b){
				dp[A+a][X+x]=(dp[A+a][X+x]+pp-dp[A][X]*(pw*ifa[x]%p))%p;
				pw=pw*a%p;
			}
		}
		SA+=a  ;
		SX+=b-1;
		//rep(A,0,SA){rep(X,0,SX)printf("%lld ",dp[A][X]);puts("");}
	}
	rep(A,1,SA){
		pw=pt=expo(A)%p;
		rep(X,0,SX){
			//if(dp[A][X])printf("dp[%d][%d]=%lld\n",A,X,dp[A][X]);
			ans=(ans+dp[A][X]*(fac[X]*pw%p))%p;
			pw=pw*pt%p;
		}
	}
	printf("%lld",ans*SA%p);
    return 0;
}

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

int main()
{
    ios::sync_with_stdio(false);
    long long a,b,c,d; cin >> a >> b >> c >> d;
    long long res = max(a*c, b*d);
    res = max(res, b*c);
    res = max(res, a*d);
    if ((a <= 0 && b >= 0) || (c <=0 && d >= 0))
        res = max(res, (long long)0);
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 3648
// そこより右側で最も近い神社と寺、左側で最も近い神社と寺の4通り
// ちがった 8 通り
// 無限に時間かかる 変数ガチャすぎる あたまこんがらがる
// serchintして最初にxを上回るところを発見し、それの-1したものが最初に下回るもの、っていう当たり前のところで躓くなど
package main
import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"sort"
)

var sc = bufio.NewScanner(os.Stdin)
var out = bufio.NewWriter(os.Stdout)

func main(){
	buf := make([]byte, 1024*1024)
	sc.Buffer(buf, bufio.MaxScanTokenSize)
	sc.Split(bufio.ScanWords)
	defer out.Flush()
	A, B, Q := nextInt(), nextInt(), nextInt()
	S, T := nextInts(A), nextInts(B)
	for i:=0; i<Q; i++{
		x := nextInt()
		leftS := min(A-1, sort.SearchInts(S, x))
		leftT := min(B-1, sort.SearchInts(T, x))
		rightS := max(0, leftS-1) // これ.....
		rightT := max(0, leftT-1) // 
		ans := int(1e18)
		ans = min(ans, abs(x - S[leftS]) + abs(S[leftS] - T[leftT]))
		ans = min(ans, abs(x - S[leftS]) + abs(S[leftS] - T[rightT]))
		ans = min(ans, abs(x - S[rightS]) + abs(S[rightS] - T[leftT]))
		ans = min(ans, abs(x - S[rightS]) + abs(S[rightS] - T[rightT]))
		ans = min(ans, abs(x - T[leftT]) + abs(T[leftT] - S[leftS]))
		ans = min(ans, abs(x - T[leftT]) + abs(T[leftT] - S[rightS]))
		ans = min(ans, abs(x - T[rightT]) + abs(T[rightT] - S[leftS]))
		ans = min(ans, abs(x - T[rightT]) + abs(T[rightT] - S[rightS]))
		fmt.Println(ans)
	}
}

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	a, _ := strconv.Atoi(next())
	return a
}

func nextInts(n int) []int{
	ret := make([]int, n)
	for i := 0; i < n; i++ {
		ret[i] = nextInt()
	}
	return ret
}

func abs(x int)int{
	if x < 0{
		x *= -1
	}
	return x
}

func min(a, b int) int {
	if a<b{
		return a
	}
	return b
}

func max(a, b int) int {
	if a<b{
		return b
	}
	return a
}

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


int main()
{
  int n, s;
  int i, j, tmp;
  int sum, count;
  int ans;

  while(cin>>n){
    cin>>s;
    if(n+s==0) break;

    ans=0;
    for(i=0; i<1024; i++){
      tmp=i; sum=0; count=0;
      for(j=0; j<10; j++){
        if(tmp%2==1){
          sum+=j;
          count++;
        }
        tmp/=2;
      }
      if(count==n && sum==s) ans++;
    }
    printf("%d\n", ans);
  }

  return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
#define all(a) (a).begin(),(a).end()
#define FOR(i,n) for(int i=0;i<(n);i++)
#define cinv(v,n) FOR(i,n){cin>>(v)[i];}
#define nvec(type,v,n) vector<type> v(n);cinv(v,n);
#define pb push_back
#define mp make_pair

int main() {
  int n,x;
  cin>>n>>x;
  nvec(int,l,n);
  int y=0,count=1;
  FOR(i,n){
    y+=l[i];
    if(y<=x)count++;  
  }
  cout<<count;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define pb push_back
#define all(v) v.begin(),v.end()
#define sort_1(v) sort(v.begin(),v.end())
#define sort_2(v) sort(v.begin(),v.end(),greater<ll>())
#define reverse(v) reverse(v.begin(),v.end())
typedef long long ll;
typedef long double la;
using namespace std;

int main(){
    int x;
    cin >> x;
    int ans = x%7;

    switch(ans){
        case 0:
            cout << "thu" << endl;
            break;
        case 1:
            cout << "fri" << endl;
            break;
        case 2:
            cout << "sat" << endl;
            break;
        case 3:
            cout << "sun" << endl;
            break;
        case 4:
            cout << "mon" << endl;
            break;
        case 5:
            cout << "tue" << endl;
            break;
        case 6:
            cout << "wed" << endl;
            break;
        default:
            break;
    }
}


Measured memory_bytes: 3132
H, N = map(int, input().split())
X = [list(map(int, input().split())) for _ in range(N)]

INF = 10 ** 9 + 7
dp = [[INF] * (H + 1) for _ in range(N + 1)]
dp[0][0] = 0

for i in range(N):
    for j in range(H + 1):
        dp[i + 1][j] = min(dp[i][j], dp[i + 1][j])

        dp[i + 1][min(j + X[i][0], H)] = min(dp[i + 1][min(j + X[i][0], H)],
                                             dp[i + 1][j] + X[i][1])

print(dp[-1][-1])


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

int main(){
  ll a,b,c;
  cin >>a>>b>>c;
  vector<ll> vec1(a);
  vector<ll> vec2(b);
  ll t=0;
  for(ll i=0;i<a;i++){
    cin >>vec1[i];
  }
  for(ll j=0;j<b;j++){
    cin >> vec2[j];
    t+=vec2[j];
  }
  ll j=b;
  ll ans=0;
  for(ll i=0;i<=a+1;i++){
    while(j>0 && t>c){
      j--;
      t-=vec2[j];
    }
    if(t >c){
      break;
    }
    ans=max(ans,i+j);
    if(i==a){
      break;
    }
    t+=vec1[i];
  }
  cout << ans <<endl;
}

  

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

int main(){
    int h, w;
    cin >> h >> w;
    string j_id = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
    string s;
    for (int i = 0; i < h; i++){
        for (int j = 0; j < w; j++){
            cin >> s;
            if (s == "snuke") cout << j_id[j] << (i + 1) << endl;
        }
    }
}

Measured memory_bytes: 256
#include<stdio.h>
#define ll long long
int main(){
    ll n, ans = 0;
    scanf("%lld",&n);
    for(ll i = 10; i <= n; i *= 5)
        ans += n / i;
    if(n % 2 == 1) ans = 0;
    printf("%lld\n",ans);
    return 0;
}

Measured memory_bytes: 128
#include <algorithm>
#include <iostream>
#define N 394
using namespace std;

int main(){
  int n,s[N],l[N],p[N],m,w,a[N],f=0,dp[N];
  cin>>n;
  for(int i=0;i<n;i++) cin>>s[i]>>l[i]>>p[i];
  for(int i=0;i<N;i++) dp[i]=-1;
  dp[0]=0;
  for(int i=0;i<n;i++)
    for(int j=0;j<N;j++)
      for(int k=s[i];k<=l[i];k++)
	if(j-k>=0&&dp[j-k]!=-1) dp[j]=max(dp[j],dp[j-k]+p[i]);
  cin>>m;
  for(int i=0;i<m;i++){
    cin>>w;
    dp[w]==-1?f=1:a[i]=dp[w];
  }
  if(f) cout<<-1<<endl;
  else{
    for(int i=0;i<m;i++) cout<<a[i]<<endl;
  }
  return 0;  
}

Measured memory_bytes: 1168
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;

int main() {
    int a, b, k;
    vector<int> v;

    cin >> a >> b >> k;
    for (int i=1; i<=100; i++) {
        bool can_dev = a % i == 0 && b % i == 0;
        if (can_dev) {
            v.push_back(i);
        }
    }
    sort(v.begin(), v.end(), greater<int>());
    cout << v[k-1] << endl;

    return 0;
}


Measured memory_bytes: 256
ret = []
while True:
   n, x = map(int, raw_input().split())
   num_arr = [i for i in range(1, n+1)]
   if (n, x) == (0, 0):
       break

   cnt = 0
   for i in range(n, 0, -1):
       for j in range(i -1, 0, -1):
           if 0 < x - i - j < j:
               cnt += 1
          
   ret += [cnt]
for i in ret:
    print i

Measured memory_bytes: 6444
#include <bits/stdc++.h>
using namespace std;
using lint     = long long;
const lint inf = 1LL << 60;
const lint mod = 1000000007;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    lint n, k;
    cin >> n >> k;
    vector<lint> a(n), b(n);
    for (int i = 0; i < n; ++i) {
        cin >> a[i] >> b[i];
    }
    lint ret = 0;
    for (int i = 0; i < n; ++i) {
        if ((a[i] & k) == a[i])
            ret += b[i];
    }
    for (int i = 31; i >= 1; --i) {
        if (1 & k >> i) {
            lint l    = k;
            lint temp = 0;
            l ^= (1LL << i);
            for (int j = i - 1; j >= 0; --j) {
                l |= 1LL << j;
            }
            for (int j = 0; j < n; ++j) {
                if ((a[j] & l) == a[j])
                    temp += b[j];
            }
            ret = max(ret, temp);
        }
    }
    cout << ret << "\n";
    return 0;
}

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

using namespace std;

static const int INF = 1e9;
int d[11];
struct edge
{
	int from;
	int to;
	int cost;
};

void BellmanFord()
{
	int n;
	while (cin >> n, n)
	{
		vector<edge> E;
		for (int i = 0; i < n; ++i)
		{
			int from, to, cost;
			cin >> from >> to >> cost;
			edge e1, e2;
			e1.from = e2.to = from;
			e1.to = e2.from = to;
			e1.cost = e2.cost = cost;
			E.push_back(e1);
			E.push_back(e2);
		}
		int minPos = 0;
		int minSumCost = INF;
		for (int i = 0; i < 10; ++i)
		{			
			for (int j = 0; j < 10; ++j)
			{
				d[j] = INF;
			}
			d[i] = 0;
			bool update = true;
			while (update)
			{
				update = false;
				for (int j = 0; j < E.size(); ++j)
				{
					edge e = E[j];
					if (d[e.from] != INF && d[e.to] > d[e.from] + e.cost)
					{
						d[e.to] = d[e.from] + e.cost;
						update = true;
					}
				}
			}
			int sum = 0;
			for (int j = 0; j < 10; ++j)
			{
				if (d[j] != INF)
				{
					sum += d[j];
				}
			}
			if (sum == 0)
			{
				continue;
			}
			if (minSumCost > sum)
			{
				minSumCost = sum;
				minPos = i;
			}
		}
		cout << minPos << " " << minSumCost << endl;
	}
}

int dist[11][11];
void WarshallFloyd()
{
	int n;
	while (cin >> n, n)
	{
		for (int i = 0; i < 10; ++i)
		{
			for (int j = 0; j < 10; ++j)
			{
				dist[i][j] = INF;
			}
			dist[i][i] = 0;
		}
		for (int i = 0; i < n; ++i)
		{
			int from, to, cost;
			cin >> from >> to >> cost;
			dist[from][to] = cost;
			dist[to][from] = cost;
		}
		for (int k = 0; k < 10; ++k)
		{
			for (int i = 0; i < 10; ++i)
			{
				for (int j = 0; j < 10; ++j)
				{
					dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);
				}
			}
		}
		int minSumCost = INF;
		int minPos = 0;
		for (int i = 0; i < 10; ++i)
		{
			int sum = 0;
			for (int j = 0; j < 10; ++j)
			{
				if (dist[i][j] != INF)
				{
					sum += dist[i][j];
				}
			}
			if (sum == 0)
			{
				continue;
			}
			if (minSumCost > sum)
			{
				minSumCost = sum;
				minPos = i;
			}
		}
		cout << minPos << " " << minSumCost << endl;
	}
}

int main()
{
	//BellmanFord();
	WarshallFloyd();
	return(0);
}

Measured memory_bytes: 1164
import sys
if sys.argv[-1] == 'ONLINE_JUDGE':
    import os, zlib, base64
    open('solve.pyx', 'wb').write(zlib.decompress(base64.b85decode("c${5PL2kn!5WHLRAEt*Sc1xnT$EfZ{QXc?Aiev-A^w7S(i%nyvdjV!=XLlAI+=#&ld75G{_6BK2??S|=#!1Dp(1{?w<EOJH&jTL@HQY%)aC=jklvR4;?)gb_s~ORZjk+vkuQcd-eLbh>;LBp^Q+bAC!>}aqjLG~crz;}Y^;(EQ@m_@lgV(U`W`;{yfWm0_EAQ}z^94c0uVBHK)Qq=(wdqwaiA+n#riW!1890MrFbt7Fmc{I(I_&yge_+@XXFrmPb^(T}@+K-OoQG<gI?wg5kYx8Fx996n97i-67Aq_^Fd5`{Y9X@l*7Q3aqT3`=MAG4pQ0gciq0}v|&@A`T&U#x^bc@>E@Z#6j>-vxWYSJk30!ifgSr*IRrv-diT7V=sza4$2?E")))
    os.system('cythonize -i -3 -b solve.pyx')
import solve

Measured memory_bytes: 9744
import java.io.*;
import java.util.*;
//import java.util.Map.Entry;
//import java.util.stream.*;
//import java.math.*;

public class Main {

    public static void main(String[] args) throws IOException {

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
        Scanner sc = new Scanner(System.in);
        long MOD = (long) (Math.pow(10, 9) + 7);
        String s = sc.next();
        int array[] = new int[26];
        for (int i = 0; i < s.length(); i++) {
            array[s.charAt(i) - 97]++;
        }
        for (int i = 0; i < 26; i++) {
            if (array[i] == 0) {
                System.out.println((char) (i + 97));
                return;
            }
        }
        System.out.println("None");
        bw.flush();
    }
//==============================================//
//==============================================//
//==============================================//
//==============================================//
//==============================================//
//==============================================//
//==============================================//
//==============================================//

    static class Pair implements Comparable<Pair> {

        int a, b;

        public Pair(int x, int y) {
            a = x;
            b = y;
        }

        @Override
        public int compareTo(Pair p) {
            return a - p.a;
        }
    }

    static void forl_0(int n, int[] array, Scanner sc) {
        for (int i = 0; i < n; i++) {
            array[i] = sc.nextInt();
        }
    }

    static void forl_1(int n, int[] array, Scanner sc) {
        for (int i = 1; i <= n; i++) {
            array[i] = sc.nextInt();
        }
    }

    static void two_d(int n, int m, int[][] array, Scanner sc) {
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < m; j++) {
                array[i][j] = sc.nextInt();
            }
        }
    }

    static boolean isPrime(long n) {
        if (n < 2) {
            return false;
        } else if (n == 2 || n == 3) {
            return true;
        } else if (n % 2 == 0 || n % 3 == 0) {
            return false;
        }
        long sqrtN = (long) Math.sqrt(n) + 1;
        for (long i = 6L; i <= sqrtN; i += 6) {
            if (n % (i - 1) == 0 || n % (i + 1) == 0) {
                return false;
            }
        }
        return true;
    }

    public static long gcd(long a, long b) {
        return (b == 0) ? a : gcd(b, a % b);
    }

    public static long lcm(long a, long b) {
        return a / gcd(a, b) * b;
    }
}


Measured memory_bytes: 39208
#include<bits/stdc++.h>
using namespace std;
int dp[3010][3010];
string s , t;
string temp="";
string solve(int m , int n)
{
	if(m==0 || n==0) return "";
	
	if(s[m-1]==t[n-1])
	{
		return solve(m-1 , n-1) + s[m-1];
	}
	else
	{
		if(dp[m-1][n]>dp[m][n-1])
		 return solve(m-1 , n);
		else
		 return solve(m , n-1);
	}
}
int main()
{
	cin>>s>>t;
	for(int i=1;i<=s.size();i++)
	{
		for(int j=1;j<=t.size();j++)
		{
			if(s[i-1]==t[j-1])
				dp[i][j]=1+dp[i-1][j-1];
			else
				dp[i][j]=max(dp[i-1][j] , dp[i][j-1]);
		}
	}
	cout<<solve(s.size() , t.size());
}

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

/*第二引数で第一引数を割ったときの切り上げの計算*/
long long int maxtime(long long int x, long long int y) {
	return(x + y - 1) / y;

}
/*最大公約数*/
long long int lcm(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;

	if (number2 > number1) {
		m = number2;
		n = number1;
	}
	long long int s = -1;
	while (s != 0) {
		s = m % n;
		m = n;
		n = s;
	}
	return m;
}
/*最大公倍数*/
long long int gcd(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;
	return m / lcm(m, n) * n;
}
int main() {
	int a, b, c;
	cin >> a >> b >> c;
	if (a + b >= c) {
		cout << "Yes";
	}
	else {
		cout << "No";
	}
}

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

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

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

int main(){
    string s, t;
    cin >> s >> t;
    vector<vector<int>> dp(s.size()+1, vector<int>(t.size()+1));
    for(int i=0; i<s.size(); i++){
        for(int j=0; j<t.size(); j++){
            if(s[i] == t[j]){
                dp[i+1][j+1]=dp[i][j]+1;
            }
            else{
                chmax(dp[i+1][j+1], dp[i+1][j]);
                chmax(dp[i+1][j+1], dp[i][j+1]);
            }
        }
    }
    string ans;
    int i=s.size(), j=t.size();
    while(i>0 && j>0){
        if(s[i-1] == t[j-1]){
            ans=s[i-1]+ans;
            i--, j--;
        }
        else if(dp[i-1][j] > dp[i][j-1]) i--;
        else j--;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 35584
while 1:
    n=int(input())
    if n==0:break
    nlist=[]
    nans=-100001
    for i in range(n):
        nlist.append(int(input()))
    nkeep=0
    for i in nlist:
        if nkeep<0:
            nkeep=i
        else:
            nkeep+=i
        if nans<nkeep:nans=nkeep
    if max(nlist)<0:nans=max(nlist)
    print(nans)


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

int main() {
	int T, X;
	cin >> T >> X;
	float ans;
	ans = float(T)/float(X) ;
	cout << ans << endl;
	return 0;
}


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

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

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

  int64_t ans = 0;
  for (int i = 0; i < n - 1; i++)
  {
    for (int j = i + 1; j < n; j++)
    {
      ans += d[i] * d[j];
    }
  }

  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {

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

Measured memory_bytes: 256
WHITE = 0
GRAY = 1
BLACK = 2
INFTY = 10**13
def dijkstra(s):
    color = [WHITE for i in range(N)]
    d = [INFTY for i in range(N)]
    p = [-1 for i in range(N)]
    d[s] = 0

    while True:
        mincost = INFTY
        for i in range(N):
            if color[i] != BLACK and d[i] < mincost:
                mincost = d[i]
                u = i
        if mincost == INFTY:
            break
        
        color[u] = BLACK

        for v in range(N):
            if color[v] != BLACK and M[u][v] != -1:
                if d[u] + M[u][v] < d[v]:
                    d[v] = d[u] + M[u][v]
                    p[v] = u
                    color[v] = GRAY
    return d

N = int(input())
M = [[-1 for j in range(N)] for i in range(N)]
for i in range(N):
    ukvc = list(map(int, input().split()))
    u, k, vc = ukvc[0], ukvc[1], ukvc[2:]
    for v, c in zip(vc[0::2], vc[1::2]):
        M[u][v] = c

d = dijkstra(0)

for i in range(N):
    print(i, d[i])



Measured memory_bytes: 5728
N, Q = map(int, input().split())
S = input()

cumsum = [0] * (N + 1)
for i in range(1, N):
    if S[i - 1] == 'A' and S[i] == 'C':
        cumsum[i + 1] = cumsum[i] + 1
    else:
        cumsum[i + 1] = cumsum[i]
for i in range(Q):
    l, r = map(int, input().split())
    print(cumsum[r] - cumsum[l])


Measured memory_bytes: 56152
def main():
    n = int(input())
    a = list(map(int, input().split()))
    ans = [1000]*n
    for i in range(n):
        kabu = ans[i]//a[i]
        amari = ans[i] % a[i]
        for j in range(i+1, n):
            if ans[j] < kabu*a[j] + amari:
                ans[j] = kabu*a[j] + amari
            if ans[j] < ans[i]:
                ans[j] = ans[i]
    print(ans[-1])

if __name__ == "__main__":
    main()

Measured memory_bytes: 9204