akhauriyash/Code-Regression huggingface dataset:
<?php

$nkq = explode(" ", trim(fgets(STDIN)));

$n = array_fill(1, $nkq[0], $nkq[1]);

for ($i = 0; $i < $nkq[2]; $i++) {
     $n[trim(fgets(STDIN))] += 1;
}

$arr = array_map("minus", $n);

for ($i = 1; $i <= count($arr); $i++) {
     echo ($arr[$i] > 0) ? "Yes"."\n" : "No"."\n";
}

function minus($cur) {
    global $nkq;
    return $cur - $nkq[2];
}

Measured memory_bytes: 13176
#include <bits/stdc++.h>
#include<atcoder/all>
#define ll long long
using namespace std;

ll a, n, l, i;

void f(ll x, ll y) {
  if ((i = __gcd(x,y) > 1 ? 0 : atcoder::inv_mod(x,y)) > 0)
    a = min({a, i * x - 1, (y-i) * x});
}

int main() {
  cin >> n; a = n + (n & 1 ^ 1);
  for (ll d = 1; d * d <= n; d++)
    if (n % d == 0)
      f(2 * d, n / d), f(2 * n / d, d);
  cout << a << "\n";
}

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

using namespace std;

int main(){
  long long n,k,a[1009], cumsum[1009], cnt[42];
  map<long long, long long> mp;
  cin >> n >> k;
  for(int i=0;i<n;i++){
    cin >> a[i];
  }
  cumsum[0] = 0;
  for(int i=1;i<=n;i++){
    cumsum[i] = cumsum[i-1] + a[i-1];
  }
  for(int i=0;i<=n;i++){
    for(int j=i+1;j<=n;j++){
      mp[cumsum[j] - cumsum[i]]++;
    }
  }
  for(auto p: mp){
    for(int j=0;j<=40;j++){
      if((p.first>>j)&1)cnt[j]+=p.second;
    }
  }
  long long ans=0;
  long long keta=40;
  while(cnt[keta]<k)keta--;
  ans += 1LL<<keta;
  keta--;
  while(keta>=0){
    long long c=0;
    for(auto p: mp){
      if(((ans&p.first)==ans)&&(((p.first>>keta)&1)==1))c+=p.second;
    }
    if(c>=k){
      ans+=1LL<<keta;
    }
    keta--;
  }
  cout << ans << endl;
}


Measured memory_bytes: 34920
import std.stdio;
import std.conv;
import std.string;
import std.typecons;
import std.algorithm;
import std.array;
import std.range;
import std.math;
import std.regex : regex;
import std.container;
import std.bigint;
import std.numeric;


void main()
{
  auto x = readln.chomp.to!int;

  while (x > 0) {
    auto m = x % 100;
    if (m > 5) {
      m = 5;
    }
    x -= 100 + m;
  }

  writeln(x == 0 ? 1 : 0);
}


Measured memory_bytes: 256
from itertools import accumulate

def main():
    ans = 0
    n, m = map(int,input().split())
    cost = [int(input()) for _ in range(n - 1)]
    q = [int(input()) for _ in range(m)]
    cumsum = list(accumulate(cost))
    cumsum.insert(0,0)
    index = 0
    for i in range(m):
        ans += abs(cumsum[index] - cumsum[index + q[i]])
        index += q[i]
    print(ans%10**5)

if __name__ == '__main__':
    main()


Measured memory_bytes: 14380
#include <bits/stdc++.h> 
using namespace std;
typedef long long ll;
ll INFL = 1000000000000000010;//10^18
int INF = 1 << 30;
ll dp[100010][110];//重さi種類j


int main(void){
    ll N,W;
    cin >> N >> W;
    vector<ll> w(N);
    vector<ll> v(N);
    for(int i = 0; i < N; i++){
        cin >> w.at(i) >> v.at(i);
    }
    
    
    
    
    for(ll i = 1; i <= W; i++){
        for(int j = 1; j <= N; j++){
            dp[i][j] = dp[i][j-1];
            if(i-w.at(j-1) >= 0){
                //cout << dp[i-w.at(j)][j-1] + v.at(j) << "#" << dp[i][j] << endl;
                dp[i][j] = max(dp[i-w.at(j-1)][j-1] + v.at(j-1), dp[i][j]);
            }
        }
    }
    
    ll ans = 0;
    for(ll i = 0; i <= W; i++){
        ans = max(ans, dp[i][N]);
    }
    cout << ans << endl;
}


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

#define pb push_back
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,n,s) for(int i=(s);i<(n);i++)
#define rrep(i,n) for(int i=(n-1);i>=0;i--)
#define rreps(i,n,s) for(int i=s;i>=n;i--)
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; }

using ll = long long;
using namespace std;
constexpr long long MAX = 5100000;
constexpr long long INF = 1LL << 60;
constexpr int MOD = 1000000007;

int main(){
cin.tie(0);
ios::sync_with_stdio(false);
string o,e;
cin>>o>>e;
int n=min(o.size(),e.size());
string res="";
rep(i,n){
    res+=o[i];
    res+=e[i];
}
if(o.size()>e.size()){
    res+=o[n];
}
cout<<res<<endl;
return 0;
}

Measured memory_bytes: 256
/*

                              Jai Shree Krishna !!
                                 Radhe Radhe !!
                                 
             उद्यमेन हि सिद्ध्यन्ति कार्याणि न मनोरथैः। नहि सुप्तस्य सिंहस्य मुखे प्रविशन्ति मृगाः।।
             
*/
   
   
#include <bits/stdc++.h>
using namespace std;
 
#define int long long
typedef long long ll;
#define loop(i,n)  for(int i=0;i<n;i++)
#define read(a) int a; cin >>a;
#define readarr(a,n) int a[n] ; for(int i=0;i<n;i++) cin >> a[i];
#define readmat(a,n,m) int a[n][m]; for(int i=0;i<n;i++) for(int j=0;j<m;j++) cin >> a[i][j];
#define pb push_back
#define ff first
#define ss second
#define vi vector<int>
#define pi pair<int,int>
#define vvi vector<vector<int>>
#define sti set<int>
#define vpi vector<pair<int,int>>
#define print(a,n) for(int i=0;i<n;i++) cout<<a[i]<<" "; cout<<endl;
#define printmat(a,n,m) for(int i=0;i<n;i++) {for(int j=0;j<m;j++) cout<<a[i][j]<<" "; cout<<endl;}
#define fast ios_base::sync_with_stdio(false);  cin.tie(NULL);
#define endl "\n"
#define mp make_pair
#define ins insert
#define rep(i,s,e)   for(int i=s;i<=e;i++)
#define repd(i,s,e)  for(int i=e;i>=s;i--)
#define vb vector<bool>
#define read2(n,m) int n,m; cin >> n >> m;
#define range(v) v.begin(),v.end()
#define sortd(v) sort(v.begin(),v.end(),greater<int>())
#define sorti(v) sort(v.begin(),v.end())

const ll inf = 1e18;
const ll mod = 1e9 + 7;
 
signed main()
{
 
    fast;
    int a,b;
    cin >> a >> b;
    int x = a*b;
    cout<<x<<endl;
    return 0;
}

/* Pooja Yadav */

Measured memory_bytes: 3608
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
const int INF = 2147483647;//int max
const int MOD = 1000000007;
using namespace std;
using ll = long long;
using P = pair<int,int>;


int main() {
    ll a,b;
    cin >> a >> b;
    if((a+b)%2 == 0)cout << (a+b)/2 << endl;
    else cout << "IMPOSSIBLE\n";
    return 0;
}

/*
やっほい！
　　　　　　　やほほい！
　　　　+　　 　*
　　　 ∧∧　　. ∧∞∧　*
*　ヽ(=´ω｀)人(´ω｀*)ﾉ
　.～（ O x.） （ 　 O)～　+
。*　 　∪　　　　∪
*/

Measured memory_bytes: 256
#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()
{
  int n, m;
  cin >> n >> m;
  std::vector<int> s(m);
  std::vector<int> c(m);
  REP(i,m) cin >> s[i] >> c[i];

  std::vector<int> num(n,-1);
  REP(i,m){
    if(num[s[i]-1] == -1){
      num[s[i]-1] = c[i];
    }else if(num[s[i]-1] != c[i]){
      cout << -1 << "\n";
      return 0;
    }
  }

  REP(i,n){
    if(n != 1 && num[0] == 0){
      cout << -1 << "\n";
      return 0;
    }
    if(i != 0 && num[i] == -1){
      num[i] = 0;
    }else if(i == 0 && num[i] == -1 && n != 1){
      num[i] = 1;
    }else if(i == 0 && num[i] == -1 && n == 1){
      num[i] = 0;
    }
  }

  REP(i,n) cout << num[i];
  cout << "\n";
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0; i<(int)(n); i++)
#define all(vec) vec.begin(),vec.end()
#define MOD 1000000007
#define int long long

signed main(){
    string s;
    int n;cin>>n>>s;
    if(n%2!=0){cout<<"No"<<endl;return 0;}
    if(s.substr(0,n/2)==s.substr(n/2))cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
const int INF = 0x3f3f3f3f;
const int N = 100005;
#define ll long long
int cmp(int a,int b){
	return a>b;
}	
int gcd(int x, int y)
{
    while(y^=x^=y^=x%=y);
    return x;
}
int main(){
	double n;
	cin >> n;
	double c = 2*n*3.1415926;
	cout << c;
	return 0;
}



Measured memory_bytes: 3784
#include <iostream>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>

typedef long long unsigned int ll;
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

using namespace std;

int main()
{
	int ans;
	int n=2;
	vector<int>vec(n);
	for (int i = 0; i < n; i++) {
		cin >> vec.at(i);
	}
	if (vec[0] > 9 || vec[1] > 9) {
		ans = -1;
	}
	else {
		ans = vec[0] * vec[1];
	}
	cout << ans << endl;
}



Measured memory_bytes: 256
import math
import numpy as np
while 1:
  A, B, H, M = map(int, input().split())
  if type(A) == int and type(B) == int and type(H) == int and type(M) == int:
    if 0 <= H and H <= 11:
      if 0 <= M and M <= 59:
        break
H_rotation = (360 / 12) * H + (360 / 12 / 60) * M
M_rotation = (360 / 60) * M
angle = abs(H_rotation - M_rotation)

ans = np.sqrt(A**2 + B**2 - 2 * A * B * math.cos(math.radians(angle)))
print(ans)
  

Measured memory_bytes: 27132
#include <iostream>
#include <set>
#include <cassert>
#include <string>
#include <vector>
#include <algorithm>
#include <cstdlib>
#include <map>

using namespace std;

int main() {
	int n;
	cin >> n;
	cout << n * n * n << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define all(a) a.begin(), a.end()
#define db(a) cout << fixed << #a << " = " << a << endl;

using namespace std;

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


const int MOD = 1e9 + 7;

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	int N;
	cin >> N;
	ll pow10 = 1;
	ll pow9 = 1;
	ll pow8 = 1;
	for (int i = 0; i < N; i++) {
		pow10 *= 10;
		pow10 %= MOD;
		
		pow9 *= 9;
		pow9 %= MOD;
		
		pow8 *= 8;
		pow8 %= MOD;
	}
	cout << ((pow10 - 2ll * pow9 + pow8) % MOD + MOD) % MOD << endl;
}


Measured memory_bytes: 3648
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v,n) reverse(v,v+n);
#define VREVERSE(v) reverse(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define INF 999999999
#define m0(x) memset(x,0,sizeof(x))
#define fill(x,y) memset(x,y,sizeof(x))
#define p(x) cout<<x<<endl;
#define pe(x) cout<<x<<" ";
//#define int long long


using namespace std;


int dy[4] = { 0,0,1,-1 };
int dx[4] = { 1,-1,0,0 };
int dxx[8] = { 0,0,1,1,1,-1,-1,-1 };
int dyy[8] = { 1,-1,0,1,-1,0,1,-1 };




ll gcd(ll x, ll y) {
	ll m = max(x, y), n = min(x, y);
	if (m%n == 0)return n;
	else return gcd(m%n, n);
}
ll lcm(ll x, ll y) {
	return x / gcd(x, y)*y;
}

ll myPow(ll x, ll n, ll m) {
	if (n == 0)
		return 1;
	if (n % 2 == 0)
		return myPow(x * x % m, n / 2, m);
	else
		return x * myPow(x, n - 1, m) % m;
}

ll pow2(ll a, ll n) {//aのn乗を計算します。
	ll x = 1;
	while (n > 0) {//全てのbitが捨てられるまで。
		if (n & 1) {//1番右のbitが1のとき。
			x = x * a;
		}
		a = a * a;
		n >>= 1;//bit全体を右に1つシフトして一番右を捨てる。
	}
	return x;
}

long long nCr(int n, int r) {
	if (r > n / 2) r = n - r; // because C(n, r) == C(n, n - r)
	long long ans = 1;
	int i;

	for (i = 1; i <= r; i++) {
		ans *= n - r + i;
		ans /= i;
	}

	return ans;
}


const int MOD = 1000000007;

bool arr[1050000];
int sosuu[100010];
void Eratosthenes() {
	ll N = 1050000;
	int c = 0;
	for (int i = 0; i < N; i++) {
		arr[i] = 1;
	}
	for (int i = 2; i < sqrt(N); i++) {
		if (arr[i]) {
			for (int j = 0; i * (j + 2) < N; j++) {
				arr[i *(j + 2)] = 0;
			}
		}
	}

	for (int i = 2; i < N; i++) {
		if (arr[i]) {
			sosuu[c] = i;
			//cout << sosuu[c] << " ";
			c++;
		}
	}
	//cout << endl;
	//cout << c << endl;
}


vector<int> graph[100010];
int color[100010];
bool visited[100010][10];
int v[100010], d[100010], c[100010];

void func(int d, int v, int c) {
	if (d == 0) {
		if(!visited[v][0])color[v] = c;
		visited[v][0] = true;
	}
	else {
		if (!visited[v][d - 1]) {
			func(d - 1, v, c);
			for(int i=0;i<=d-1;i++)visited[v][i] = true;
		}
		for (auto x : graph[v]) {
			if (!visited[x][d - 1]) {
				func(d - 1, x, c);
				for (int i = 0; i <= d - 1; i++)visited[x][i] = true;
			}
		}
	}
}
ll rui[100010];
int A[100010];
int main() {
	int N; cin >> N;
	REP(i, N) {
		cin >> A[i];
	}
	SORT(A, N);
	rui[0] = 0;
	REP(i, N) {
		rui[i + 1] = rui[i] + A[i];
	}
	int ans = 1;
	REPR(i, N - 1) {
		if (rui[i] * 2 >= A[i])ans++;
		else break;
	}
	cout << ans << endl;
}

Measured memory_bytes: 5504
#include<stdio.h>
#include<math.h>
#include<stdlib.h>
int main()
{
	int n;
	scanf("%d",&n);
	int a[10000];
	if(n==0){
		printf("0\n");
		exit (0);
	}
	int i=0;
	while(n!=0){
		int p=n%-2;
		a[i]=fabs(p);
	//	printf("%d\n",p);
		i++;
		if(n%-2==0){	
			n=n/-2;	
		}
		else{
			if(n>0) n/=-2;
			else n=n/-2+1;
		}
	//	printf("%d\n",n);
	}
	//printf("%d",i);	
	for(int j=i-1;j>=0;j--)
		printf("%d",a[j]);
}

Measured memory_bytes: 128
import java.util.Scanner;
import java.util.stream.IntStream;

public class Main {
    public static void main(String[] args) {
        Scanner stdin = new Scanner(System.in);
        int a = stdin.nextInt(); // 500
        int b = stdin.nextInt(); // 100
        int c = stdin.nextInt(); // 50
        int x = stdin.nextInt();
        
        int ans = 0;
        for (int i = 0; i <= a; i++) {
            for (int j = 0; j <= b; j++) {
                for (int k = 0; k <= c; k++) {
                    if (i * 500 + j * 100 + k * 50 == x) ans++;
                }
            }
        }
        
        System.out.println(ans);
    }
}


Measured memory_bytes: 23636
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <queue>
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstring>
#include <cctype>
#include <cassert>
#include <limits>
#include <functional>
#include <iomanip>
#include <complex>
#include <bitset>
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define rer(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i))
#define reu(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);++(i))
#if defined(_MSC_VER) || __cplusplus > 199711L
#define aut(r,v) auto r = (v)
#else
#define aut(r,v) __typeof(v) r = (v)
#endif
#define each(it,o) for(aut(it, (o).begin()); it != (o).end(); ++ it)
#define all(o) (o).begin(), (o).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset(m,v,sizeof(m))
#define INF 0x3f3f3f3f3f3f3f3fLL
#define SIZE 8080

using namespace std;
typedef vector<int> vi; typedef pair<int, int> pii; typedef vector<pair<int, int> > vpii; typedef long long ll;
typedef pair<int,ll> pill; typedef pair<ll,int> plli; 
typedef pair<double, int> pdi;
template<typename T, typename U> inline void amin(T &x, U y) { if(y < x) x = y; }
template<typename T, typename U> inline void amax(T &x, U y) { if(x < y) x = y; }
typedef complex<double> P;
long long int MOD = 1000000007;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
int N;
vi a;
int main(){
	cin>>N;
	int x;
	int hoge=0,ma=0;
	for(int i=0;i<N;i++){
		cin>>x;
		a.pb(x);
		if(ma<abs(x)){
			hoge=i,ma=abs(x);
		}
	}
	if(a[hoge]>0){
		cout<<2*N-2<<endl;
		cout<<hoge+1<<" 2"<<endl;
		cout<<hoge+1<<" 2"<<endl;
		for(int i=3;i<=N;i++){
			cout<<i-1<<" "<<i<<endl;
			cout<<i-1<<" "<<i<<endl;
		}
	}else if(a[hoge]<0){
		cout<<2*N-2<<endl;
		cout<<hoge+1<<" "<<N-1<<endl;
		cout<<hoge+1<<" "<<N-1<<endl;
		for(int i=N-2;i>=1;i--){
			cout<<i+1<<" "<<i<<endl;
			cout<<i+1<<" "<<i<<endl;
		}
	}else{
		cout<<"0"<<endl;
	}
}

Measured memory_bytes: 256
N = gets.chomp.to_i

hash = {}

N.times do
  s = gets.chomp
  if hash[s].nil?
    hash[s] = 1
  else
    hash[s] += 1
  end
end

max = hash.max { |a, b| a[1] <=> b[1] }[1]
puts hash.select { |k, v| v == max}.keys.sort



Measured memory_bytes: 46952
import java.util.*;

public class Main{
	
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
  	int h=sc.nextInt(),w=sc.nextInt();
    char[][] c=new char[h][w];
    for(int i=0;i<h+2;i++){
      if(i==0||i==h+1){
        for(int j=0;j<w+2;j++){
          System.out.print("#");
        }
      }else{
        c[i-1]=sc.next().toCharArray();
        for(int j=0;j<w+2;j++){
          if(j==0||j==w+1){
            System.out.print("#");
          }else{
            System.out.print(c[i-1][j-1]);
          }
        }
      }
      System.out.print("\n");
    }
  }
}


Measured memory_bytes: 23204
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author Pine1999
 */

#include <bits/stdc++.h>

using namespace std;

class ECoprime {
public:
    void solve(std::istream& in, std::ostream& out) {
        int n;
        in >> n;
        vector<int> a(n);
        for (int i = 0; i < n; ++i) {
            in >> a[i];
        }
        int MAX = (int) (1e6 + 50);
        vector<int> min_prime(MAX);
        for (int i = 2; i <= MAX; ++i) {
            if (min_prime[i]) continue;
            for (int j = i; j < MAX; j += i) {
                if (min_prime[j]) continue;
                min_prime[j] = i;
            }
        }
        bool suc = true;
        set<int> st;
        for (int i = 0; i < n; ++i) {
            int b = a[i];
            while (b > 1) {
                int p = min_prime[b];
                if (st.count(p)) {
                    suc = false;
                    break;
                }
                st.insert(p);
                while (b % p == 0) {
                    b /= p;
                }
            }
            if (!suc) {
                break;
            }
        }
        if (suc) {
            out << "pairwise coprime" << '\n';
            return;
        }
        int g = a[0];
        for (int i = 1; i < n; ++i) {
            g = gcd(g, a[i]);
        }
        out << (g == 1 ? "setwise coprime" : "not coprime") << '\n';
    }
};

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ECoprime solver;
    std::istream& in(std::cin);
    std::ostream& out(std::cout);
    solver.solve(in, out);
    return 0;
}

Measured memory_bytes: 11116
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const double pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
REP(i,v.size()){if(i)os<<" ";os<<v[i];}return os;}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
REP(i,v.size()){if(i)os<<endl;os<<v[i];}return os;}

int main()
{
	int N;
	int V[60], C[60];

	cin >> N;
	for (int i = 0; i < N; ++i) {cin >> V[i];}
	for (int i = 0; i < N; ++i) {cin >> C[i];}
	
	/////////compute/////////////

	int diff[60];
	for (int i = 0; i < N; ++i)
	{
		diff[i] = V[i] - C[i];
	}

	int ans = 0;

	for (int i = 0; i < N; ++i)
	{
		if (diff[i] > 0)
		{
			ans += diff[i];
		}
	}

	cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <queue>
#include <vector>
#include <utility>
#define maxn 100005
#define maxpoints 200005
#define maxlen 200005
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const int DOWN = 0;
const int LEFT = 1;
const int UP = 2;
int n,rig[maxn],x1[maxn],x2[maxn],y1_[maxn],y2[maxn];
int compress(int* t1,int* t2){
	vector <int> xs;
	xs.clear();
	for(int i=1;i<=n;i++){
		xs.push_back(t1[i]);
		xs.push_back(t2[i]);
	}
	sort(xs.begin(),xs.end());
	xs.erase(unique(xs.begin(),xs.end()),xs.end());
	for(int i=1;i<=n;i++){
		t1[i] = lower_bound(xs.begin(),xs.end(),t1[i]) - xs.begin() + 1;
		t2[i] = lower_bound(xs.begin(),xs.end(),t2[i]) - xs.begin() + 1;
	}
	return xs.size();
}
struct Point{
	int x,y,type,id;//id: belong to which segment.
	Point(int x = 0,int y = 0,int type = 0,int id = 0): x(x),y(y),type(type),id(id) {}
	bool operator < (const Point &p)const
	{
		if(y == p.y){
			if(type == p.type) return x < p.x;
			return type < p.type;
		}
		return y < p.y;
	}
}ps[maxpoints]; int m;
int bit[maxlen],len;
void add(int pos,int x){
	for(int i=pos;i<=len;i += i & -i) bit[i] += x;
}
int query(int pos){
	int res = 0;
	for(int i=pos;i>0;i -= i & -i) res += bit[i];
	return res;
}
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++) scanf("%d%d%d%d",&x1[i],&y1_[i],&x2[i],&y2[i]);
	len = compress(x1,x2);
	for(int i=1;i<=n;i++){
		if(x1[i] == x2[i]){
			if(y1_[i] > y2[i]) swap(y1_[i],y2[i]);
			ps[++m] = Point(x1[i],y1_[i],DOWN,i);
			ps[++m] = Point(x2[i],y2[i],UP,i);
		}else{
			if(x1[i] > x2[i]) swap(x1[i],x2[i]);
			ps[++m] = Point(x1[i],y1_[i],LEFT,i);
			rig[i] = x2[i];
		}
	}
	sort(ps + 1,ps + m + 1);
	memset(bit,0,sizeof(bit));
	int ans = 0;
	for(int i=1;i<=m;i++){
		Point p = ps[i];
		if(p.type == DOWN) add(p.x,1);
		else if(p.type == UP) add(p.x,-1);
		else ans += query(rig[p.id]) - query(p.x - 1);
	}
	printf("%d\n",ans);
	return 0;
}



Measured memory_bytes: 9076
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod=1e9+7;
const int maxn=105;
int a[maxn];
int main()
{
    int n;
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
    {
        scanf("%d",&a[i]);
    }
    int ans=1e9;
    for(int i=-100;i<=100;i++)
    {
        int tmp=0;
        for(int j=1;j<=n;j++)
        {
            tmp+=(a[j]-i)*(a[j]-i);
        }
        ans=min(ans,tmp);
    }
    printf("%d\n",ans);
}



Measured memory_bytes: 256
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,fractions
from decimal import Decimal
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

n,m = inpl()
wv = []
for i in range(m):
    a,b = inpl()
    cnt = 0
    c = inpl()
    for i in c:
        cnt += 1<<(i-1)
    wv.append((a,cnt))
dp = [INF for _ in range(1<<n)]
dp[0] = 0

for i in range(m):
    v,w = wv[i]
    for j in range(1<<n):
        dp[j|w] = min(dp[j|w], dp[j] + v)
print(dp[-1] if dp[-1] != INF else -1)

Measured memory_bytes: 70228
N = int(input())
A = list(map(int, input().split()))

def selectionSort(A, N):
    cnt = 0
    
    for i in range(N):
        A_ = A[i:]
        j = A_.index(min(A_)) + i
        if A[j] < A[i]:
            temp = A[i]
            A[i] = A[j]
            A[j] = temp
            cnt += 1
                
    print(*A)
    print(cnt)
    
selectionSort(A, N)


Measured memory_bytes: 5604
#include <iostream>
#include <algorithm>
#include <string>
#include <set>
#include <vector>
using namespace std;

int main(){
    
   int n,cnt = 1;
   cin >> n;
   string s[n + 10];
   set<string>a;

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

   for(int i = 0; i < n; i++){
   	if(s[i][s[i].size() - 1] == s[i + 1][0]){
   		cnt++;
   	}
   }


   if(a.size() == n && cnt == n){
   	cout <<"Yes";
   }
   else{
   	cout << "No";
   }
	return 0;

}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>

#define INF (1 << 30)

using namespace std;

int DP[200][200]; // DP[i][j] : i????????????????????????j???????±±????????¨????????¨??????????°????

int main(){
	
	int n;
	
	int a[200], b[200];
	
	for(int i = 0; i < 200; i++){
		for(int j = 0; j < 200; j++){
			DP[i][j] = INF;
		}
	}
	
	cin >> n;
	
	for(int i = 0; i < n; i++){
		cin >> a[i] >> b[i];
		DP[i][1] = 0;
	}
	
	for(int loop = 2; loop <= n; loop++){
		for(int i = 0; i < n - loop + 1; i++){
			for(int j = 1; j < loop; j++){
				DP[i][loop] = min(DP[i][loop], DP[i][j] + DP[i + j][loop - j] + a[i] * b[i + j - 1] * a[i + j] * b[i + loop - 1]);
			}
			//cout << DP[i][loop] << " ";
		}
		//cout << endl;
	}
	
	cout << DP[0][n] << endl;
	
	return 0;
}

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

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n, k;
  cin >> n >> k;
  if (n % k) {
    cout << 1 << endl;
  } else {
    cout << 0 << endl;
  }
  return 0;
}

Measured memory_bytes: 256
import numpy as np
N=int(input())
info = np.array([input().split() for _ in range(0, N)], dtype='int')
info = info[np.argsort(info[:,2])][::-1]
start_x = info[0,:][0]
start_y = info[0,:][1]
start_h = info[0,:][2]

for Cx in range(101):
    for Cy in range(101):
        H = start_h+abs(start_x-Cx)+abs(start_y-Cy)
        if all(max(0,H-abs(x-Cx)-abs(y-Cy))==h for x,y,h in info):
            print(Cx,Cy,H)
            break
        else:
            continue
        break


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

using namespace std;

int N;
long long int M;

int x[100005], y[100005];

vector<int> Adj[100005];

long long int D[100005];

long long int  dfs(int idx, int par) {

	long long int tmp = 1;
	for (auto y : Adj[idx]) {
		if (y == par) { continue; }
		tmp *= (dfs(y, idx)+1);
		tmp %= M;
	}

	D[idx] = tmp;
	return tmp;
}

vector<long long int > A[100005], B[100005];

void CALC_A_B(int idx, int par) {

	long long int val = 1;
	A[idx].push_back(val);

	int child_num = 0;
	for (auto y : Adj[idx]) {
		if (y == par) { continue; }
		val *= (D[y] + 1);
		val %= M;
		A[idx].push_back(val);
		child_num++;
	}

	B[idx].resize(child_num+2);
	int pos = child_num + 1;
	val = 1;
	B[idx][pos] = val; pos--;

	for (int y = Adj[idx].size() - 1; y >= 0; y--) {
		if (Adj[idx][y] == par) { continue; }
		int m= Adj[idx][y];
		val *= (D[m]+1);
		val %= M;
		B[idx][pos] = val; pos--;
	}

	for (auto y : Adj[idx]) {
		if (y == par) { continue; }
		CALC_A_B(y, idx);
	}
}

long long int ans[100005];

void dfs2(int idx, long long int D_par, int par) {

	ans[idx] = ((((D_par + 1)*A[idx][0]) % M)*B[idx][1]) % M;

	int num = 1;
	for (int m = 0; m < (int)Adj[idx].size(); m++) {
		if (Adj[idx][m] == par) { continue; }
		long long int  D_h = ((((D_par + 1)*A[idx][num-1]) % M) * B[idx][num + 1] )% M;
		num++;
		//cout << "D_h= " << D_h << endl;
		dfs2(Adj[idx][m], D_h, idx);
	}

}

int main(void) {

	cin >> N >> M;
	for (int i = 1; i <= N-1; i++) {
		cin >> x[i] >> y[i];
		Adj[x[i]].push_back(y[i]);
		Adj[y[i]].push_back(x[i]);
	}

	dfs(1, -1);

	for (int i = 1; i <= N; i++) {
		//cout << "D[" << i << "]= " << D[i] << endl;
	}

	CALC_A_B(1, -1);

	/*for (int idx = 1; idx <= N; idx++) {
		cout << "idx= " << idx << ":" << endl;
		for (int y = 0; y < (int)A[idx].size(); y++) {
			cout << " " << A[idx][y];
		}cout << endl;
		for (int y = 0; y < (int)B[idx].size(); y++) {
			cout << " " << B[idx][y];
		}cout << endl;
	}*/

	dfs2(1, 0, -1);

	for (int i = 1; i <= N; i++) {
		cout /*<< "ans[" << i<<"]= "*/ << ans[i] << endl;
	}

	return 0;
}

Measured memory_bytes: 28032
#include<iostream>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
int main()
{
    int n;
    cin>>n;
    int a=n%2;
    if(a==0)cout<<n/2<<endl;
    else cout<<(n/2)+a<<endl;

    return 0;
}

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

int main(){
  string r,s,t;
  cin >>r >>s >>t;
  cout << r[0] << s[0] << t[0] << endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cmath>
#include<map>
#include<iomanip>
#include<queue>
#include<stack>
#include<time.h>
#define rep(i,n)for(ll i=0;i<n;i++)
#define ll long long
#define ggr getchar();getchar();return 0;
#define prique priority_queue
#define inf 1000000007
#define double long double
using namespace std;
typedef pair<ll, ll>P;
bool prime(int n) {
	int cnt = 0;
	for (int i = 1; i <= sqrt(n); i++) {
		if (n % i == 0)cnt++;
	}
	if (cnt != 1)return false;
	else return n != 1;
}
ll gcd(ll x, ll y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
ll lcm(ll x, ll y) {
	return x * y / gcd(x, y);
}
ll mod_pow(ll x, ll n, ll mod) {
	ll bit = 1;
	while (n) {
		if (n & 1)bit = bit * x % mod;
		x = x * x % mod;
		n /= 2;
	}
	return bit;
}
ll C(ll a, ll b) {
	ll x = 1, y = 1;
	rep(i, b) {
		x = x * (a - i) % inf;
		y = y * (b - i) % inf;
	}
	rep(i, inf) {
		if (x == y * i % inf) {
			return i;
		}
	}
}
signed main() {
	ll r;
	cin >> r;
	cout << r * r << endl;
	ggr
}

Measured memory_bytes: 256
//~In The Name Of Allah~//
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <iomanip>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <string.h>
#include <sstream>
#include <fstream>
#include <functional>
#include <stack>
#include <utility> 
#include <set>
#include <list>
#include <queue>
#include <bitset>
#include <time.h>
#include <unordered_set>
#include <unordered_map>

using namespace std;

#define read freopen("in.txt", "r", stdin)
#define write freopen("out.txt", "w", stdout)
#define all(_) _.begin(), _.end()
#define rall(_) _.rbegin(), _.rend()
#define rep(i, j) for (int i = 0; i < j; i++)
#define Rep(i, j, k) for (int i = j; i < k; i++)
#define siz(_) (int)_.size()
#define ll long long
#define endl '\n'

const double PI = 2.0 * acos(0.0);
const int MOD = 1e9 + 7;
const int oo = MOD;

typedef pair<int, int> pii;

ll gcd(ll x, ll y) { return !y ? x : gcd(y, x%y); }

int main() {
	string str;
	cin >> str;
	int ans = siz(str), cnt = 0;
	rep(i, siz(str)) {
		if (str[i] == 'S')
			cnt++;
		else if (cnt)
			--cnt, ans -= 2;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 640
#include<iostream>
#include<sstream>
#include<fstream>
#include<cstdio>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<deque>
#include<map>
#include<set>
#include<algorithm>
#include<string>
#include<cmath>
#include<cstdlib>
using namespace std;

int main(){
	map<int,int> table;
	int n,maxi = 0;
	while(scanf("%d",&n)==1){
		table[n]++;
		maxi = max(maxi,table[n]);
	}
	for(map<int,int>::iterator it = table.begin();it!=table.end();++it){
		if(it->second == maxi){
			cout<<it->first<<endl;
		}
	}	
	return 0;
}

Measured memory_bytes: 1212
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <functional>

using namespace std;
 
#define mod 1000000007
#define FOR(x,to) for(int x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define long long long
inline int rei(){int x;cin>>x;return x;}
inline long rel(){long x;cin>>x;return x;}
inline string res(){string x;cin>>x;return x;}
//------------------------------------------------------- 
pair<long,long> Work[200000];
void Calc(){
	int N = rei();
	for(int i=0;i<N;i++){
		long a = rel();
		long b = rel();
		Work[i] = {b,a};
	}
	sort(Work,Work+N);
	int sum = 0;
	bool OK = true;
	for(int i=0;i<N;i++){
		sum += Work[i].second;
		if(sum > Work[i].first){
			OK = false;
		}
	}
	if(OK){
		cout << "Yes" << endl;
	}
	else{
		cout << "No" << endl;
	}
}
int main(int argc,char** argv){
	ios::sync_with_stdio(false), cin.tie(0);
	cout.tie(0); Calc(); return 0;
}

Measured memory_bytes: 3328
import sys
input = sys.stdin.readline

def main():
    n, k = map(int, input().split())
    a = [0]
    ta = list(map(int, input().split()))
    a += ta
    kaiten = [0] * (n + 1)
    count = 0
    koko = 1
    kaitenkikan = 0
    while k > 0:
        koko = a[koko]
        count += 1
        k -= 1
        if kaiten[koko] > 0:
            kaitenkikan = abs(count - kaiten[koko])
            break
        else:
            kaiten[koko] = count
    if k == 0:
        print(koko)
        sys.exit()
    k_remain = k % kaitenkikan
    if k_remain < 0:
        k_remain += kaitenkikan

    while k_remain > 0:
        koko = a[koko]
        k_remain -= 1

    print(koko)

if __name__ == '__main__':
    main()



Measured memory_bytes: 31596
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<deque>
#include<cmath>
#include<map>
#include<cstring>
#include<iomanip> //cout << fixed << setprecision(15) << x << endl;

using namespace std;
typedef long long ll;
const int INF = 1e9 + 6;
const ll MOD = 1e9 + 7;
const ll LLINF = 1LL<<60;
#define P pair<int, int>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()

const int MAX_N = 401;
ll dp[MAX_N][MAX_N];
ll sum[MAX_N][MAX_N]; //sum[i, j) : i <= x < jの和, sum[0][1] = a[0], sum[1][2] = a[1], sum[i][i + 1] = a[i]

int main() {
    int N; cin >> N;
    ll a[N]; rep(i, N) cin >> a[i];
    for(int len = 1; len <= N; ++len) {
        for(int i = 0; i + len <= N; ++i) {
            sum[i][i + len] = a[i] + sum[i + 1][i + len];
        }
    }
    rep(i, N + 1) {
        rep(j, N + 1) {
            if(i != j && i + 1 != j)
                dp[i][j] = LLINF;
        }
    }
    for(int w = 2; w <= N; ++w) {//幅
        for(int i = 0; i + w <= N; ++i) {//左端
            for(int j = i + 1; j < i + w; ++j) {//右と左を分ける点
                dp[i][i + w] = min(dp[i][i + w], dp[i][j] + dp[j][i + w] + sum[i][i + w]);
            }
        }
    }
    cout << dp[0][N] << endl;
}


Measured memory_bytes: 2816
import java.io.*;
import java.io.IOException;
import java.util.*;

@SuppressWarnings({"rawtypes", "unchecked"})
class Main {
    final static int INF = 1 << 28;
    final static long LNF = 1L << 60;
    final static double EPS = 1e-9;
    final static double GOLDEN_RATIO = (1.0 + Math.sqrt(5)) / 2.0;

    static final long MOD = 1_000_000_007;

    public static void main(String[] args) throws Exception {
        final MyScanner sc = new MyScanner();
        String S;
        S = sc.next();
        String T;
        T = sc.next();
        long A;
        A = sc.nextLong();
        long B;
        B = sc.nextLong();
        String U;
        U = sc.next();
        solve(S, T, A, B, U);
    }

    static void solve(String S, String T, long A, long B, String U){
        if(U.equals(S))  A --;
        if(U.equals(T)) B--;
        System.out.println(A+" "+B);
    }


    static class MyScanner {
 
        BufferedReader br;
        StringTokenizer st;
 
        MyScanner(FileReader fileReader) {
            br = new BufferedReader(fileReader);
        }
 
        MyScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }
 
        String nn() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }
 
        String next() {
            return nn();
        }

        String nextLine() {
            String ans = "";
            try {
                ans = br.readLine();
            } catch (IOException ex) {
                ex.printStackTrace();
            }
            return ans;
        }
 
        char nextChar() {
            return nn().charAt(0);
        }
 
        int nextInt() {
            return Integer.parseInt(nn());
        }
 
        long nextLong() {
            return Long.parseLong(nn());
        }
 
        double nextDouble() {
            return Double.parseDouble(nn());
        }
 
        Integer[] niArr0(int n) {
            Integer[] ar = new Integer[n];
            for (int i = 0; i < n; i++) {
                ar[i] = nextInt();
            }
            return ar;
        }
 
        Integer[] niArr1(int n) {
            Integer[] ar = new Integer[n + 1];
            for (int i = 1; i <= n; i++) {
                ar[i] = nextInt();
            }
            return ar;
        }
 
        Long[] nlArr0(int n) {
            Long[] ar = new Long[n];
            for (int i = 0; i < n; i++) {
                ar[i] = nextLong();
            }
            return ar;
        }
 
        Long[] nlArr1(int n) {
            Long[] ar = new Long[n + 1];
            for (int i = 1; i <= n; i++) {
                ar[i] = nextLong();
            }
            return ar;
        }
    }

}


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

int main() {
    int M[N][N]; // 0 オリジンの隣接行列
    int n, u, k, v;

    cin >> n;

    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) M[i][j] = 0;
    }

    for (int i = 0; i < n; i++) {
        cin >> u >> k;
        u--; // 0 オリジンへ変換
        for (int j = 0; j < k; j++) {
            cin >> v;
            v--; // 0 オリジンへ変換
            M[u][v] = 1; // u と v の間に辺を張る
        }
    }

    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            if (j) cout << " ";
            cout << M[i][j];
        }
        cout << endl;
    }

    return 0;

}


Measured memory_bytes: 3128
#include "bits/stdc++.h"
using namespace std;
#define MOD 1000000007
#define INF 1<<50LL
#define fst first
#define snd second
#define pb push_back
#define int long long
#define ALL(obj) (obj).begin(), (obj).end()
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i = (b-1);i>=a;i--)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ITR(itr,mp) for(int itr = (mp).begin(); itr != (mp).end(); ++itr)
#define RITR(itr,mp) for(int itr = (mp).rbegin(); itr != (mp).rend(); ++itr)
#define debug(x)  cout << #x << " = " << (x) << endl;
typedef long long ll;
typedef pair<ll,ll> P;

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

  int n,m;
  cin >> n >> m;
  
  string s[n];
  REP(i,n) cin >> s[i];
  
  int cnt = 0;
  REP(i,n){
    REP(j,m){
      if(s[i][j] == '#') cnt++;
    }
  }
  
  if(cnt == n+m-1) cout << "Possible" << endl;
  else			   cout << "Impossible" << endl;

  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <utility>

using namespace std;
typedef pair<int, int> P;

void solve(vector<P> v) {
	int minID, maxNum;
	minID = v[0].first;
	maxNum = v[0].second;
	for (int i = 1; i < v.size(); i++) 
		if (v[i].second > maxNum || (v[i].second == maxNum && v[i].first < minID)) {
			minID = v[i].first;
			maxNum = v[i].second;
		}

	cout << minID << " " << maxNum << endl;
}


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

	int n, a, v;
	cin >> n;
	vector<P> fish;
	for (int i = 0; i < n; i++) {
		cin >> a >> v;
		fish.push_back(P(a, v));
	}
	solve(fish);
}

Measured memory_bytes: 1200
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
#define		CH		ch=(getchar())

inline		int		IN(){
	int x=0,f=1;char ch;
	for (CH;ch>'9'||ch<'0';CH) if (ch=='-') f=-1;
	for (;ch>='0'&&ch<='9';CH) (x*=10)+=ch-'0';
	return x*f;
}

int i,j,k,l,n,m,L;
char s[10005];

int main(){
	scanf("%s",&s);
	L=strlen(s);
	for (i=0;i<L;i++) if (s[i]!=s[L-i-1]){
		puts("No");
		return 0;
	}
	puts("Yes");
}


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

int main(){
    int h, w;
    cin >> h >> w;
    char s[h][w];
    for(int i = 0; i < h; i++){
        for(int j = 0; j < w; j++){
            cin >> s[i][j];
        }
    }
    int counter=0;
    for(int i = 0; i < h; i++){
        for(int j = 0; j < w; j++){
            if(s[i][j]=='#'){
                if(s[i-1][j]=='.' && s[i+1][j]=='.' && s[i][j+1]=='.' && s[i][j-1]=='.'){
                    counter++;
                }
            }
        }
    }
    if(counter==0){
        cout << "Yes" << "\n";
    }else{
        cout << "No" << "\n";
    }
    return 0;
}

Measured memory_bytes: 256
foods = [0] * 5
sumfoods = 0
for i in range(5):
  foods[i] = int(input())
maxDiv = 0
for i, var in enumerate(foods):
  temp = 10 - (var % 10)
  if temp == 10:
    temp = 0
  foods[i] += temp
  sumfoods += foods[i]
  if maxDiv < temp:
    maxDiv = temp
print(sumfoods - maxDiv)


Measured memory_bytes: 9096
#include <bits/stdc++.h>
#define FOR(v, a, b) for(int v = (a); v < (b); ++v)
#define FORE(v, a, b) for(int v = (a); v <= (b); ++v)
#define REP(v, n) FOR(v, 0, n)
#define REPE(v, n) FORE(v, 0, n)
#define REV(v, a, b) for(int v = (a); v >= (b); --v)
#define ALL(x) (x).begin(), (x).end()
#define ITR(it, c) for(auto it = (c).begin(); it != (c).end(); ++it)
#define RITR(it, c) for(auto it = (c).rbegin(); it != (c).rend(); ++it)
#define EXIST(c,x) ((c).find(x) != (c).end())
#define LLI long long int
#define fst first
#define snd second
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif
#ifndef M_E
#define M_E 2.71828182845904523536
#endif

#ifdef DEBUG
#include <misc/C++/Debug.cpp>
#else
#define dump(x)
#endif

#define pln(x) cout << (x) << endl
#define gcd __gcd

using namespace std;
template <class T> constexpr T lcm(T m, T n){return m/gcd(m,n)*n;}

template <typename T> using V = vector<T>;
template <typename T, typename U> using P = pair<T,U>;
template <typename I> void join(ostream &ost, I s, I t, string d=" "){for(auto i=s; i!=t; ++i){if(i!=s)ost<<d; ost<<*i;}ost<<endl;}
template <typename T> istream& operator>>(istream &is, vector<T> &v){for(auto &a : v) is >> a; return is;}
template <typename T, typename U> istream& operator>>(istream &is, pair<T,U> &p){is >> p.first >> p.second; return is;}

template <typename T, typename U> T& chmin(T &a, const U &b){return a = (a<=b?a:b);}
template <typename T, typename U> T& chmax(T &a, const U &b){return a = (a>=b?a:b);}
template <typename T, size_t N, typename U> void fill_array(T (&a)[N], const U &v){fill((U*)a, (U*)(a+N), v);}

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

  int N;
  string S;
  while(cin >> N >> S){
    map<pair<string,string>,int> count;

    REP(i,1<<N){
      string r,b;
      REP(j,N){
	if(i & (1<<j)) r += S[j];
	else b += S[j];
      }
      ++count[{r,b}];
    }

    LLI ans = 0;
    REP(i,1<<N){
      string r,b;
      REP(j,N){
	if(i & (1<<j)) r += S[j+N];
	else b += S[j+N];
      }
      reverse(ALL(r));
      reverse(ALL(b));
      ans += count[{r,b}];
    }
    cout << ans << endl;
  }
  
  return 0;
}


Measured memory_bytes: 87040
// B.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。
//

#include <iostream>

using namespace std;
int main()
{
	int n, t;

	cin >> n >> t;
	int x, y;
	int min = 10000;
	for (int i = 0; i < n; i++) {
		cin >> x >> y;

		if (y <= t) {
			if (min > x) {
				min = x;
			}
		}
	}

	if (min == 10000) {
		cout << "TLE" << endl;
	}
	else {
		cout << min << endl;
	}
}

// プログラムの実行: Ctrl + F5 または [デバッグ] > [デバッグなしで開始] メニュー
// プログラムのデバッグ: F5 または [デバッグ] > [デバッグの開始] メニュー

// 作業を開始するためのヒント: 
//    1. ソリューション エクスプローラー ウィンドウを使用してファイルを追加/管理します 
//   2. チーム エクスプローラー ウィンドウを使用してソース管理に接続します
//   3. 出力ウィンドウを使用して、ビルド出力とその他のメッセージを表示します
//   4. エラー一覧ウィンドウを使用してエラーを表示します
//   5. [プロジェクト] > [新しい項目の追加] と移動して新しいコード ファイルを作成するか、[プロジェクト] > [既存の項目の追加] と移動して既存のコード ファイルをプロジェクトに追加します
//   6. 後ほどこのプロジェクトを再び開く場合、[ファイル] > [開く] > [プロジェクト] と移動して .sln ファイルを選択します


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

  #define vi vector<int>
  #define all(v) v.begin(),v.end()
  #define ll long long int
  #define  IOS    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
  #define D1(x) {cerr<<" [" <<#x<<": "<<x<<"]";cout << endl;}
  #define D2(x) {cerr<<" [" <<#x<<": ";for(auto it:x)cerr<<it<< " ";cerr<<"] ";cout << endl;}

  const ll MOD=1e9+7;

  void solve(){
     ll n,k;
     cin >> n >> k;
     vector<pair<int,int>> v(n);
     for(int i=0;i<n;i++){
       cin >> v[i].first >> v[i].second;
     }
     sort(all(v));
     int i = 0;
     while(1){
        if(k-v[i].second<=0){cout <<v[i].first;return;}
        else{
          k-=v[i].second;
          i++;
        }
     }


  }


  int main(){
    IOS
       solve();
       cerr <<endl <<"[ Time : " << (float)clock() / CLOCKS_PER_SEC << " secs ]" << endl;
  }
// integer overflow
// remember to clear visited array
// take input as vector<string> while using grid
// don't assign after modifying


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

typedef pair<int,int> P;

P t[101][101];
int loop[101][101];

int solve(int x,int y,int now){
	while(loop[y][x] == 0){
		loop[y][x] = now;
		int nx = t[y][x].first;
		int ny = t[y][x].second;
		x = nx;
		y = ny;
	}

	if(loop[y][x] == now) return 1;
	return 0;
}

int main(void){
	int n;

	while(cin>>n && n){
		for(int i=0;i<n;i++){
			for(int j=0;j<n;j++){
				cin>>t[i][j].first>>t[i][j].second;
			}
		}

		memset(loop,0,sizeof(loop));
		int now = 1;
		int ans = 0;

		for(int i=0;i<n;i++){
			for(int j=0;j<n;j++){
				if(loop[i][j] == 0){
					ans += solve(j,i,now);
					now++;
				}
			}
		}

		cout<<ans<<endl;
	}

	return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <climits>
#include <cstdlib>
using namespace std;

int main() {
  string s;

  while (cin >> s) {
    int ans = INT_MAX;
    for (int i = 0; i < s.size() - 2; i++) {
      string sub = s.substr(i, 3);
      int x = atoi(sub.c_str());
      ans = min(ans, abs(x - 753));
    }
    cout << ans << endl;
  }
}


Measured memory_bytes: 256
def solve(n, m, s):
    if s.find("1"*m) >= 0:
        return -1
    s = s[::-1]
    i = 0
    path = []
    while i < n:
        for j in range(min(m, n-i), 0, -1):
            ni = i+j
            if s[ni] == "0":
                i = ni
                path.append(j)
                break
    return " ".join(map(str, path[::-1])) 

n, m = map(int, input().split())
s = input()
print(solve(n, m, s))

Measured memory_bytes: 11228
#include <bits/stdc++.h>
 
#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)
 
#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=(int)(a)-1;i>=(int)(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)
 
#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define bit(n) (1LL<<(n))
 
// #define DEBUG
 
#ifdef DEBUG
    #define dump(...) fprintf(stderr, __VA_ARGS__)
#else
    #define dump(...)
#endif
 
template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}
 
using namespace std;
using ll=long long;
using vi=vector<int>;
using vll=vector<ll>;
 
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int inf = INT_MAX;
const ll INF = LLONG_MAX;
const ll MOD = 1000000007LL;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
 
ll extgcd(ll a,ll b,ll& x,ll& y){x=1,y=0;ll g=a;if(b!=0) g=extgcd(b,a%b,y,x),y-=a/b*x;return g;}
ll ADD(const ll &a, const ll &b, const ll mod=MOD) { return (a+b)%mod;}
ll SUB(const ll &a, const ll &b, const ll mod=MOD) { return (a-b+mod)%mod;}
ll MUL(const ll &a, const ll &b, const ll mod=MOD) { return (1LL*a*b)%mod;}
ll DIV(const ll &a, const ll &b, const ll mod=MOD) {ll x,y; extgcd(b,mod,x,y);return MUL(a,(x+mod)%mod,mod);}
 
int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);

    int A, B; cin >> A >> B;

    cout << max(0, A - 2 * B) << endl;

    return 0;
}


Measured memory_bytes: 256