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

#define roop(i, n) for(int i=0;i<n;i++)
#define DIV 1000000007

using namespace std;
using ll = long long int;
using ull = unsigned long long;

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

ll combination(ll n, ll r) {
	if (n < 0 || r < 0 || r > n) return -1;

	if (n - r < r) r = n - r;
	if (r == 0) return 1;
	if (r == 1) return n;

	vector<ll> num(r);
	vector<ll> den(r);

	for (ll i = 0; i < r; i++) {
		num[i] = n - r + i + 1;
		den[i] = i + 1;
	}

	for (ll p = 2; p <= r; p++) {
		ll pivot = den[p - 1];
		if (pivot > 1) {
			ll offset = (n - r) % p;
			for (ll k = p - 1; k < r; k += p) {
				num[k - offset] /= pivot;
				den[k] /= pivot;
			}
		}
	}
	ll result = 1;
	for (ll k = 0; k < r; k++) {
		if (num[k] > 1) result *= num[k];
	}
	return result;
}

int main() {
	int n, k;
	cin >> n >> k;
	vector<int> d(k);
	vector<vector<int>> a(k, vector<int>(n));
	vector<int> ans(n);
	for (int i = 0; i < n; i++) {
		ans[i] = 0;
	}
	for (int i = 0; i < k; i++) {
		cin >> d[i];
		for (int j = 0; j < d[i]; j++) {
			cin >> a[i][j];
			ans[a[i][j] - 1]++;
		}
	}

	int c = 0;
	for (int i = 0; i < ans.size(); i++) {
		if (ans[i] == 0) {
			c++;
		}
	}
	cout << c << endl;
	return 0;
}

Measured memory_bytes: 3640
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <iomanip>
#include <queue>
#include <deque>
#include <map>
#include <unordered_map>
#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
#define repr(e,x) for(auto& e:x)
using namespace std;
typedef long long ll;

ll A,B,C,K;

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

    ll ans=0;

    ans+=min(A,K);
    K-=A;
    K=max(K,(ll)0);

    K-=B;
    K=max(K,(ll)0);

    ans+=-1*min(C,K);
    K-=C;
    K=max(K,(ll)0);

    cout<<ans<<endl;
}

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

long long mod = 1000000007;

int main(){
  string L;
  cin >> L;
  int n = L.length();
  vector<long long> dp1(n+1);
  vector<long long> dp2(n+1);

  dp1[1] = 1;dp2[1] = 2;
  for(int i = 2;i <= n;i++){
    if(L[i-1] ==  '1'){
      dp1[i] = (dp1[i-1]*3 + dp2[i-1]) % mod;
      dp2[i] = dp2[i-1]*2%mod;
    }else{
      dp1[i] = dp1[i-1]*3%mod;
      dp2[i] = dp2[i-1];
    }
  }

  cout << (dp1[n] + dp2[n])%mod << endl;
}

Measured memory_bytes: 2048
#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
long long a[100002],n,m,p=1e9+7;
long long ksm(int a,int b,int p)
{
	long long ans=1;
	while(b)
	{
		if(b&1)
		{
			ans=ans*a%p;
		}
		a=a*a%p;
		b>>=1;
	}
	return ans;
}
long long c(long long n,long long m)
{
	if(m>n)
	{
		return 0;
	}
	return (((a[n]*ksm(a[m],p-2,p))%p*ksm(a[n-m],p-2,p))%p);
}
long long lucas(long long n,long long m)
{
	if(m==0)
	{
		return 1;
	}
	return (c(n%p,m%p)*lucas(n/p,m/p))%p;
}
int main()
{
	cin>>n>>m;
	if(abs(n-m)>1)
	{
		cout<<"0"<<endl;
		return 0;
	}
	a[0]=1;
	for(int i=1;i<=max(n,m);i++)
	{
		a[i]=(a[i-1]*i)%p;
	}
	if(n==m)
	{
		cout<<(2*a[n]*a[m])%p<<endl;
	}
	if(abs(n-m)==1)
	{
		cout<<(a[n]*a[m])%p<<endl;
	}
}

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

int N;
vector<int> arr;

int gcd(int a, int b) {
    return b? gcd(b, a % b) : a;
}

void solve(int first) {
    int cnt = 0, v;
    for(int i = 0; i < N; i++) {
        if(arr[i] & 1) {
            cnt++;
            v = arr[i];
            arr[i]--;
        }
    }
    if(cnt == 1 && v != 1) {
        int g = arr[0];
        for(int i = 1; i < N; i++) {
            g = gcd(g, arr[i]);
        }
        int p = 0;
        for(int i = 0; i < N; i++) {
            arr[i] /= g;
            p ^= ((arr[i] - 1) & 1);
        }
        if(p) {
            if(first) printf("First");
            else printf("Second");
        }
        else solve(first ^ 1);
    }
    else {
        if(first) printf("First");
        else printf("Second");
    }
}

int main() {
    scanf("%d", &N);
    arr.resize(N);
    int p = 0;
    for(int i = 0; i < N; i++) {
        scanf("%d", &arr[i]);
        p ^= ((arr[i] - 1) & 1);
    }
    if(p) printf("First");
    else solve(0);
}


Measured memory_bytes: 768
#include<iostream>
#include<cstdio>
using namespace std;
int n,cnt,a[200010],b[200010];
int main()
{
	cin>>n;
	for(register int i=1;i<=n;++i)
		scanf("%d",&a[i]);
	for(register int i=n;i>=1;--i)
	{
		int sum=0;
		for(register int j=i*2;j<=n;j+=i)
			sum+=b[j];
		if(sum%2!=a[i])
			b[i]=1,++cnt;
	}
	cout<<cnt<<endl;
	for(register int i=1;i<=n;++i)
		if(b[i])
			printf("%d ",i);
	return 0;
}

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

#define forn(i,n) for(int i=0;i<(int)(n);i++)
#define si(c) ((int)(c).size())
#define forsn(i,s,n) for(int i = (int)(s); i<((int)n); i++)
#define dforsn(i,s,n) for(int i = (int)(n)-1; i>=((int)s); i--)
#define all(c) (c).begin(), (c).end()
#define D(a) cerr << #a << "=" << a << endl;
#define pb push_back
#define eb emplace_back
#define mp make_pair

#ifdef LOCAL
#define i64 "%lld"
#else
#define i64 "%I64d"
#endif

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

const int N = 110;

int a[2*N], n;

int main() {
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    cin >> n;
    forn(i,2*n) cin >> a[i];
    sort(a, a+2*n);
    int ans = 0;
    for (int i = 0; i < 2*n; i += 2)  ans += a[i];
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <set>
using namespace std;
typedef long long ll;
typedef pair<ll,int> P;

int N;
ll x,y;
int inf = 1e9+7;
int main(){
	cin >> N;
	vector<P> X(N),Y(N),S(N),L(N);
	for(int i=0;i<N;i++){
		cin >> x >> y;
		if(x>y) swap(x,y);
		X[i] = {x,i};
		Y[i] = {y,i};
		S[i] = {x,i};
		L[i] = {y,i};
	}
	sort(S.begin(),S.end());
	sort(L.begin(),L.end());
	ll ans = (S[N-1].first-S[0].first)*(L[N-1].first-L[0].first);
	set<P> T;
	T.insert({L[0].first,inf});
	for(int i=1;i<=N-1;i++) T.insert({L[i].first,L[i].second});
	ll mind = inf;
	while(1){
		ll d = T.rbegin()->first - T.begin()->first;
		mind =  min(mind,d);
		auto a = *T.rbegin();
		T.erase(*T.rbegin());
		if(a.second>=inf) break;
		T.insert({X[a.second].first,inf});
	}
	ans = min(ans,(L[N-1].first-S[0].first)*mind);
	cout << ans << endl;
}

Measured memory_bytes: 25216
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

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

func main() {
	sc.Split(bufio.ScanWords)

	n, d := nextInt(), nextInt()
	x := make([][]int, n)
	for i := 0; i < n; i++ {
		x[i] = make([]int, d)
		for j := 0; j < d; j++ {
			x[i][j] = nextInt()

		}

	}
	// fmt.Println(x)

	count := 0
	for i := 0; i < n-1; i++ {
		for j := i + 1; j < n; j++ {
			rec := 0
			for k := 0; k < d; k++ {
				rec += (x[i][k] - x[j][k]) * (x[i][k] - x[j][k])
			}
			sqrt := int(math.Sqrt(float64(rec)))
			if sqrt*sqrt == rec {
				// fmt.Println(sqrt)

				// fmt.Println(rec)
				count++
			}
		}
	}
	fmt.Println(count)

}


Measured memory_bytes: 640
#include <iostream>
#include <vector>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;

int main(){
  string S;
  cin >> S;

  int opn = 3;
  int a[opn+1];
  for (int i = 0; i < opn+1; i++){
    a[i] = stoi(S.substr(i,1));
  }

  char op[3];
  for(int bit = 0; bit < (1<<opn); bit++){
    int sum = a[0];
    for(int i = 0; i < opn; i++){
      if(bit&(1<<i)){
        sum += a[i+1];
        op[i] = '+';
      } else {
        sum -= a[i+1];
        op[i] = '-';
      }
    }
    if(sum == 7){
      break;
    }
  }

  cout << a[0];
  for(int i = 0; i < opn; i++){
    cout << op[i] << a[i+1];
  }
  cout << "=7" << endl;

  return 0;
}



Measured memory_bytes: 256
#include<stdio.h>

int main(){

int a[30],i,z;

for(i=1;i<=30;i++){
a[i]=1;
}

for(i=1;i<=28;i++){
scanf("%d",&z);
a[z]=0;
}

for(i=1;i<=30;i++){
if( a[i]==1 ){
 printf("%d\n",i);  }
}

return 0;

}

Measured memory_bytes: 596
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define rep(i,b) FOR(i,0,b)
#define INF 1e9
#define dump(x) cerr<<#x<<"="<<x<<endl
#define all(a) (a).begin(),(a).end()
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<vii> viii;
typedef pair<int,int> P;
template <class T> void chmin(T & a, T const & b) { if (b < a) a = b; }
template <class T> void chmax(T & a, T const & b) { if (b > a) a = b; }
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
using ll = long long;
const ll mod = LLONG_MAX;

#define int long long
int N,M;
signed main(){
  cin>>N>>M;
  if(N==1&&M==1){
    cout<<1<<endl;
  }
  else if(N==1||M==1){
    chmax(N,M);
    cout<<(N-2)<<endl;
  }else{
    cout<<(N-2)*(M-2)<<endl;
  }

}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<vector>
#include<map>
using namespace std;
typedef long long ll;
using namespace std;
int main()
{
    ll a;
    string s;
    cin>>a>>s;
    ll ss=(s[0]-'0')*100+(s[2]-'0')*10+(s[3]-'0');
    ll ans=ss*a/100;
    cout<<ans;
    return 0;
}

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

int main()
{
	int n;
	cin >> n;
	int a[n - 1];
	for (int i = 0; i < n - 1; i++)
		cin >> a[i];
	unordered_map<int, int> numSub;
	for (int i = 0; i < n - 1; i++)
		numSub[a[i]]++;
	for (int i = 1; i <= n; i++)
		cout << numSub[i] << "\n";
}

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

class Solve {
private:
	using i3 = std::array<int, 3>;

	using vi = std::vector<int>;
	using vvi = std::vector<vi>;

	using vi3 = std::vector<i3>;
	using vvi3 = std::vector<vi3>;

public:
	bool is_last_query{};
	Solve()
	{
		int N, M, L;
		scanf("%d%d%d", &N, &M, &L);
		if (N == 0)
		{
			is_last_query = true;
			return;
		}

		vvi3 graph(N);
		// {to, cost, dist}
		for (int i{}; i < M; i++)
		{
			int A, B, D, E;
			scanf("%d%d%d%d", &A, &B, &D, &E);
			A--; B--;
			graph[A].push_back({B, D, E});
			graph[B].push_back({A, D, E});
		}
		vvi dist(N, vi(L + 1, 1 << 30));
		dist[0][L] = 0;
		std::priority_queue<i3, std::vector<i3>, std::greater<i3>> dij;
		// {dist, position, rest}
		dij.push({0, 0, L});
		while (!dij.empty())
		{
			// {dist, position, rest}
			auto now{dij.top()};
			dij.pop();
			if (now[0] > dist[now[1]][now[2]]) continue;
			if (now[1] == N - 1)
			{
				printf("%d\n", now[0]);
				break;
			}
			// {to, cost, dist}
			for (auto& next: graph[now[1]])
			{
				if (now[0] + next[2] < dist[next[0]][now[2]])
				{
					dist[next[0]][now[2]] = now[0] + next[2];
					dij.push({now[0] + next[2], next[0], now[2]});
				}
				if (next[1] <= now[2] && now[0] < dist[next[0]][now[2] - next[1]])
				{
					dist[next[0]][now[2] - next[1]] = now[0];
					dij.push({now[0], next[0], now[2] - next[1]});
				}
			}
		}
	}
};

int main()
{
	while (!Solve().is_last_query);

	return 0;
}


Measured memory_bytes: 3412
#include  <iostream>
#include  <stdio.h>
#include <algorithm>
#include <vector>
using namespace std;


#include <math.h>
int standerd = int(pow(10.0,9.0)) + 7;

string ans_Yes = "Yes"; 
string ans_No = "No"; 
string ans_yes = "yes"; 
string ans_no = "no"; 

int main(){

    int N;
    cin >> N;
    vector<int> flower;
    int value;
    for( int ni = 0 ; ni < N ; ni++ ){
        cin >> value;
        flower.push_back(value);
    }

    int left=0;
    int right=0;
    int min_val;
    int count = 0;
    while( left < N){
        right = left;
        while(right+1<N && flower[right+1]>0){
            right++;
        }
        min_val = flower[left];

        for( int index = left + 1 ; index <= right ; index++ ){
            if(min_val > flower[index]) min_val = flower[index];
        }
        count = count + min_val;

        //cout << "count " << count << endl;
        //cout << "l:" << left << "  r:" << right << endl;
        for( int index = left ; index <= right ; index++ ){
            flower[index] = flower[index] - min_val;
        }
        /*
        for( int index = 0 ; index < N ; index++ ){
            cout << flower[index] << " ";
        }
        cout << endl;
        */
        while(left<N && flower[left]==0){
            left++;
        }
        

    }
    cout << count;


}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){
    long long int X,K,D,i=0,kari;

    scanf("%lld",&X);
    scanf("%lld",&K);
    scanf("%lld",&D);

    if(X>0){
        kari=X/D+1;
        if(kari>K){
            X=X-K*D;
            i=K;
        }else{
            X=X-kari*D;
            i=kari;
        }
        
        
        
    }else if(X<0){
        kari=X*(-1)/D+1;
        if(kari>K){
            X=X+K*D;
            i=K;
        }else{
            X=X+kari*D;
            i=kari;
        }
        

        
    }

    if(i<K){
        if((K-i)%2==0){

        }else{
            if(X>=0){
                X=X-D;
            }else{
                X=X+D;
            }
        }
    }

    if(X<0){
        X=X*(-1);
    }

    printf("%lld\n",X);

    return 0;

}

Measured memory_bytes: 2088
#include<stdio.h>
#include<iostream>
#include<string.h>
#include<algorithm>
#include<queue>
#include<stack>
#include<math.h>
#include<map>
typedef long long int ll;
using namespace std;
#define maxn 0x3f3f3f3f
#define INF 0x3f3f3f3f3f3f3f3f
const int mm=2e5+100;
ll d[mm];
int main()
{
   ll n,m,i,j,t,a,b,c,p,k,kk; 
	cin>>n;
	for(i=0;i<n;i++) scanf("%lld",&d[i]);
	ll s=d[0];
	ll sum=0;
	for(i=0;i<n;i++)
	{
		s=max(s,d[i]);
		if(d[i]<s)
		sum+=(s-d[i]);
	}
	cout<<sum<<endl;
} 

Measured memory_bytes: 4728
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
	int d,r,g,h;
	double f,a,b;
	cin>>a>>b;
	g=a;
	h=b;
	d=a/b;
	r=g%h;
	f=a/b;
	
	cout<<d<<" "<<r<<" ";
	cout<<fixed<<setprecision(5)<<f<<endl;
	return 0;
}

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

left = [0] * N
right = [0] * N

left[0] = A[0]
for i in range(1, N):
        left[i] += left[i-1] + A[i]

right[-1] = A[-1]
for i in reversed(range(0, N-1)):
        right[i] += right[i+1] + A[i]



ans = 2020202050
for i in range(N-1):
        ans = min(ans, abs(left[i] - right[i+1]))
print(ans)


Measured memory_bytes: 91344
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <cmath>
#include <climits>
#include <iomanip>
using namespace std;
typedef long long ll;
int main(){
  ll n = 0;
  cin >> n;
  ll mod = pow(10,9) + 7;
  ll ans = 0;
  ans = 1;
  for(int i = 1;i <= n;i++){
    ans = (ans * i) % mod;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#gcdは3.4.3だとfractionsにある
from fractions import gcd
import math

from math import factorial as f

from math import ceil,floor,sqrt


import bisect
import re
import heapq


from copy import deepcopy
import itertools

from sys import exit

ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))



def main():
    a,b,c = mi()
    flag = False
    if a == b:
        flag = True
    if b == c:
        if flag == True:
            print('No')
            exit()
        else:
            flag = True
    if a == c:
        if flag == True:
            print('No')
            exit()
        else:
            flag = True
    if flag:
        print("Yes")
    else:
        print("No")


main()


Measured memory_bytes: 5628
#include <bits/stdc++.h>
#define MOD 1000000007
#define INF 1001001001
#define LINF 1001001001001001001
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define bit(n) (1LL<<(n))
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> LLP;

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

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

  int ans = 0;

  for (int i = 0; i < N; i++) for (int j = i + 1; j < N; j++) for (int k = j + 1; k < N; k++) {
    if (L[i] == L[j] || L[j] == L[k]) continue;
    if (L[i] + L[j] > L[k]) ans++;
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 3624
#include <iostream>
#include <cstdlib>
#include <time.h>
#include <algorithm>
#include <map>
#include <queue>
#include <stack>
#include <vector>
#include <array>
#include <string>
#include <iomanip>
#include <cstring>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define mp make_pair
#define eb emplace_back
#define F first
#define S second
using namespace std;
using namespace __gnu_pbds;

typedef long long int ll;
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ost;

const ll maxN = 1e7;
const ll INF = 1e17;
const ll MOD = 1e9 + 7;

ll xs[] = {-1, 1, 0, 0, -1, 1, 1, -1};
ll ys[] = {0, 0, -1, 1, -1, 1, -1, 1};

ll segtree[maxN << 2];
ll lazy[maxN << 2];
ll A[maxN];

inline ll left(ll x){
	return x << 1;
}

inline ll right(ll x){
	return (x<<1) + 1;
}

void build(ll node, ll start, ll end){
	if(start == end)
		segtree[node] = A[start];
	else{
		ll mid = (start + end)/2;
		build(left(node), start, mid);
		build(right(node), mid+1, end);
		segtree[node] = segtree[left(node)] + segtree[right(node)];
	}
}

void update(ll node, ll start, ll end, ll l, ll r, ll val){
	if(lazy[node] != 0){
		segtree[node] += (end-start+1)*lazy[node];
		if(start != end){
			lazy[left(node)] += lazy[node];
			lazy[right(node)] += lazy[node];
		}
		lazy[node] = 0;
	}
	if(start > end or l > start or r < end)
		return ;
	else if(start >= l and r >= end){
		segtree[node] += val;
		if(start != end){
			lazy[left(node)] += val;
			lazy[right(node)] += val;
		}
	}
	else{
		ll mid=(start + end)/2;
		update(left(node), start, mid, l, r, val);
		update(right(node), mid+1, end, l, r, val);
		segtree[node] = segtree[left(node)] + segtree[right(node)];
	}
}

ll sums(ll node, ll start, ll end, ll l, ll r){
	if(lazy[node] != 0){
		segtree[node] += (end-start+1)*lazy[node];
		if(start != end){
			lazy[left(node)] += lazy[node];
			lazy[right(node)] += lazy[node];
		}
		lazy[node] = 0;
	}
	if(l > end or r < start or start > end)
		return 0;
	if(l <= start and r >= end)
		return segtree[node];
	ll mid = (start+end)/2;
	return sums(left(node), start, mid, l , r) + sums(right(node), mid + 1, end, l , r);
}

int main(){
	cin.sync_with_stdio(false);
	cin.tie(0);
	ll a, b, t;
	cin >> a >> b >> t;
	cout << (t/a)*b;
	return 0;
}

Measured memory_bytes: 3604
import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		int N = sc.nextInt();
		int T = sc.nextInt();
		
		int c[] = new int[N];
		int t[] = new int[N];
		
		for (int i = 0; i < N; i++) {
			c[i] = sc.nextInt();
			t[i] = sc.nextInt();
		}
		
		int ans = 2000;
		boolean ansExists = false;
		
		for (int i = 0; i < N; i++) {
			
			if (t[i] <= T) {
				ans = c[i];
				ansExists = true;
				break;
			}
		}
		
		if (ansExists == false) {
			System.out.println("TLE");
			return;
		}
		
       for (int i = 0; i < N; i++) {
			
			if (t[i] <= T && c[i] < ans) {
				ans = c[i];
			}
		}
       
       System.out.println(ans);
	}
}

Measured memory_bytes: 21716
def main(k, s):
    if k == n:
        return sum(d * (s[b] - s[a] == c) for a, b, c, d in abcd)
    return max(main(k + 1, s + [ai]) for ai in range(s[-1], m + 1))

if __name__ == '__main__':
    n, m, q = map(int, input().split())
    abcd = [[int(i) for i in input().split()] for _ in range(q)]
    print(main(0, [1]))


Measured memory_bytes: 9196
def next_A(A):
    rev_A = list(reversed(A))
    max_num = M
    if rev_A[0] < M:
        rev_A[0] = rev_A[0] + 1
        return list(reversed(rev_A))
    
    for i in range(N):
        if rev_A[i] < max_num:
            rev_A[i] = rev_A[i] + 1
            for j in reversed(range(i)):
                rev_A[j] = rev_A[j+1]
            return list(reversed(rev_A))
        max_num = rev_A[i]
    return [-1]



def make_A():
    A = []
    for i in range(N):
        A.append(1)
    return A

def solve(A):
    ans = 0
    for i in range(Q):
        if(A[b[i]] - A[a[i]] == c[i]):
            ans = ans + d[i]
    return ans




#A = []
#len(A) == N
#A[b[i]] - A[a[i]] == c[i]

N,M,Q = (-1,-1,-1)
a = []
b = []
c = []
d = []


N,M,Q = map(int,input().split())
for i in range(Q):
    A,B,C,D = map(int,input().split())
    a.append(A-1)
    b.append(B-1)
    c.append(C)
    d.append(D)
    
A = make_A()
ans = 0
while(-1 not in A):
    #print(A)
    ans = max(solve(A),ans)
    A = next_A(A)
print(ans)


Measured memory_bytes: 9244
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <cmath>
#include <ctime>
#include <cassert>
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <deque>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <iterator>
#include <functional>
#include <utility>
#include <algorithm>
#include <numeric>
#include <typeinfo>

using namespace std;

#define dump(n) cout<<"# "<<#n<<"="<<(n)<<endl
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,n) repi(i,0,n)
#define iter(c) __typeof((c).begin())
#define foreach(i,c) for(iter(c) i=(c).begin();i!=(c).end();++i)
#define allof(c) (c).begin(),(c).end()
#define mp make_pair

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<string> vs;
typedef pair<int,int> pii;

int main()
{
	for(int w,h;cin>>w>>h,w|h;){
		int n; cin>>n;
		vvi flg(h,vi(w));
		vvi dp(h,vi(w));
		rep(i,n){
			int x,y; cin>>x>>y;
			flg[y-1][x-1]=1;
		}
		dp[0][0]=1;
		repi(i,1,h) dp[i][0]=flg[i][0]?0:dp[i-1][0];
		repi(j,1,w) dp[0][j]=flg[0][j]?0:dp[0][j-1];
		repi(i,1,h) repi(j,1,w)
			dp[i][j]=flg[i][j]?0:dp[i-1][j]+dp[i][j-1];
		cout<<dp[h-1][w-1]<<endl;
	}
	
	return 0;
}

Measured memory_bytes: 0
#include <stdio.h>

int main(void){
  int S;
  scanf("%d",&S);
  int A[4] = {S/1000,(S/100)%10,(S/10)%10,S%10};
  int ans;

  for(int i = 0;i < 8;i++){
    int j = i;
    int counter = 1;
    ans = A[0];
    while(counter < 4){
      if(j%2 == 1){
        ans += A[counter];
      }else{
        ans -= A[counter];
      }
      j /= 2;
      counter++;
    }
    counter = 1;
    if(ans == 7){
      printf("%d",A[0]);
      while(counter < 4){
        if(i%2 == 1){
          printf("+");
        }else{
          printf("-");
        }
        printf("%d",A[counter]);
        i /= 2;
        counter++;
      }
      printf("=7\n");
      break;  
    }
  }


  return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stdio.h>
#include <queue>
#include <stack>
#include <climits>
#include <map>
#include <set>

using namespace std;

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

const ll mod = 1000000007;
const int inf = 1e9;
const long long INF = 1LL << 60;

int main()
{
    int n;
    cin >> n;
    ll x[n],y[n];
    for(int i = 0; i < n; i++){
        cin >> x[i] >> y[i];
    }
    if(n == 1){
        cout << 1 << endl;
    }else{
        int ans = n+1;
        for(int i = 0; i < n; i++){
            for(int j = 0; j < n; j++){
                if(i == j) continue;
                ll p = x[j] - x[i];
                ll q = y[j] - y[i];

                int tmp = 0;
                for(int k = 0; k < n; k++){
                    for(int l = 0; l < n; l++){
                        if(k == l) continue;
                        if((p == x[l] - x[k]) && (q == y[l] - y[k])) tmp++;
                    }
                }
                ans = min(ans,n-tmp);
            }
        }
        cout << ans << endl;
    }
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
  int a,b,c;
  cin >> a >> b >> c;
  int t = 0;
  int ans = 0;
  
  while(1){
	if(t == 60){
	  ans = -1;
	  break;
	}	
	if(t > 60){
	  t = t - 60;
	  ans += 60;
	}
	
	if(t <= c && c <= (t + a)){
	  ans += c;
	  break;
	}else{
	  t += a+b;
	}
  }
  cout << ans << endl;
  
  return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
 
using namespace std;
 
int main(){
  string s;
  cin >> s;
  int sum = 0;
  for(int i = 0; i < s.size(); i++){
    sum += s[i] - '0';
  }
  if(sum % 9 == 0){
    cout << "Yes";
  }
   else{
     cout << "No";
   }
 }

Measured memory_bytes: 3704
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <queue>
#include <cstring>
#include <vector>
#include <map>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <bitset>
#include <set>
#include <stack>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)
#define all(i,n) (i),(i+n)

int dx4[4]={1,0,-1,0};
int dy4[4]={0,-1,0,1};
int dx8[8]={1,0,-1,1,-1,1,0,-1};
int dy8[8]={1,1,1,0,0,-1,-1,-1};
int dx9[9]={0,1,0,-1,1,-1,1,0,-1};
int dy9[9]={0,1,1,1,0,0,-1,-1,-1};

typedef pair<int, int> P;
typedef pair<string, int> SP;
typedef long long ll;
typedef pair<ll, ll> PLL;

const int INF = 1e9;
const ll LLINF = 1e18;
const int MAX_V = 1e6+1;
const ll mod = 1000000007;
// << fixed << setprecision
// --------------------------------------
int n;
ll k;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  cin >> n >> k;
  vector<ll> a(n);
  vector<ll> b(n);

  REP(i, n) cin >> a[i];
  REP(i, n) cin >> b[i];

  sort(a.begin(), a.end());
  sort(b.begin(), b.end(), greater<ll>());

  ll ma = 0;
  REP(i, n) {
    ma = max(ma, a[i] * b[i]);
  }

  ll l = -1, r = ma;

  while(r - 1 > l) {
    ll mid = (l + r) / 2;
    
    ll sum = 0;
    REP(i, n) {
      if(mid / b[i] < a[i]) {
        sum += a[i] - mid / b[i];
      }
    }

    if(sum <= k) r = mid;
    else l = mid;
  }
  cout << r << endl;
}


Measured memory_bytes: 6364
#include <bits/stdc++.h>
#define X first
#define Y second
#define rep(i,a,n) for (long long i = a; i < n; i++)
#define ms(a, b) memset(a, b, sizeof(a))
#define mp(a, b) make_pair(a, b)
using namespace std;
typedef long long LL;
typedef pair<int,int> pii;
typedef pair<LL,LL> pll;
const int MAXN = 2e5 + 10;
const int INF = 0x3fffffff;

struct Reader {
    static const int MX = 1e6;
    bool fail;
    char buf[MX], *p1, *p2;

    inline char nc() {
        if (p1 == p2) {
            p2 = (p1 = buf) + fread(buf, 1, MX, stdin);
            if (p1 == p2) return 0;
        }
        return *p1++;
    }

    template<class T> inline void read(T &x) {
        fail = true;
        char c = nc();
        bool b = 0;
        for (; c && !isdigit(c); c = nc()) if (c == '-') b = 1;
        if (c) fail = false;
        for (x = 0; isdigit(c); x = x * 10 + c - '0', c = nc());
        if (b) x = -x;
    }

    template<class T> inline Reader & operator >> (T &x) {
        if (!fail) read(x);
        return *this;
    }

    operator void*() {
        return fail ? 0 : (Reader*)this;
    }
} rd;

int n;
set<int> s;

void solve() {
    rd >> n;
    int a;
    while (n--) {
        rd >> a;
        if (s.find(a) != s.end()) s.erase(a);
        else s.insert(a);
    }
    cout << s.size() << endl;
}

int main() {
#ifdef LOCAL
    freopen("case.in", "r", stdin);
#endif

    int T, cas = 0;
//    rd >> T;
//    while (T--) {
//        printf("Case #%d: ", ++cas);
        solve();
//    }
    return 0;
}


Measured memory_bytes: 5888
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <string>
#include <cmath>
#include <vector>
#include <queue>
#include <climits>
typedef long long ll;
using namespace std;

int main(void){
  ll n,i,sum=0;
  static ll a[200000];

  cin>>n;

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

  ll t=0;
  ll min=sum-a[0];
  for(i=0;i<n;i++){
    t+=a[i];

    if(abs(sum-t*2)<min){
      min=abs(sum-t*2);
    }
  }

  cout<<min<<endl;

  return 0;
}


Measured memory_bytes: 1792
N = int(input())
S = input()

R_count = S.count('R')
G_count = S.count('G')
B_count = S.count('B')

ans = R_count * G_count * B_count

for i in range(N-2):
    for d in range(1,N):
        if i+2*d >= N:
            break
        else:
            j = i+d
            k = j+d
            
            if S[i] != S[j] and S[j] != S[k] and S[k] != S[i]:
                ans -= 1

print(ans)    




Measured memory_bytes: 9208
#![allow(non_snake_case)]
#![allow(unused_variables)]
#![allow(dead_code)]

fn main() {
    let N: usize = {
        let mut line: String = String::new();
        std::io::stdin().read_line(&mut line).unwrap();
        line.trim().parse().unwrap()
    };
    let a: Vec<i64> = {
        let mut line: String = String::new();
        std::io::stdin().read_line(&mut line).unwrap();
        line.split_whitespace()
            .map(|x| x.parse().unwrap())
            .collect()
    };

    let mut c = std::collections::HashMap::new();
    for &x in &a { *(c.entry(x).or_insert(0)) += 1; }
    let ans = c.iter().map(|(&k, &v)| if v >= k { v - k } else { v }).sum::<i64>();

    println!("{}", ans);
}

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

#define rep(i,n) for(int i=0;i<(n);i++)

using namespace std;
using lint=long long;

const lint MOD=1e9+7;

int main(){
	string s; cin>>s;
	int n=s.length();

	// dp[0][i] = number of A's in s[0..i)
	// dp[1][i] = number of AB's in s[0..i)
	// dp[2][i] = number of ABC's in s[0..i)
	lint dp[3][100001]={};
	int q=0;
	lint pw=1;
	rep(i,n){
		if(s[i]=='A' || s[i]=='?'){
			rep(k,3) dp[k][i+1]+=dp[k][i];
			dp[0][i+1]+=pw;
		}
		if(s[i]=='B' || s[i]=='?'){
			rep(k,3) dp[k][i+1]+=dp[k][i];
			dp[1][i+1]+=dp[0][i];
		}
		if(s[i]=='C' || s[i]=='?'){
			rep(k,3) dp[k][i+1]+=dp[k][i];
			dp[2][i+1]+=dp[1][i];
		}
		if(s[i]=='?'){
			q++;
			pw=pw*3%MOD;
		}
		rep(k,3) dp[k][i+1]%=MOD;
	}
	cout<<dp[2][n]<<endl;

	return 0;
}


Measured memory_bytes: 2816
#include <iostream>
#include <string>
using namespace std;
typedef long long ll;

int main() {
	int N, ac = 0, wa = 0, tle = 0, re = 0;
	cin >> N;
    for (int i = 0; i < N; ++i){
        string t;
        cin >> t;
        if (t == "AC") ac++;
        if (t == "WA") wa++;
        if (t == "TLE") tle++;
        if (t == "RE") re++;

    }
    cout << "AC x "  << ac  << endl; 
    cout << "WA x "  << wa  << endl; 
    cout << "TLE x " << tle << endl; 
    cout << "RE x "  << re  << endl; 
	return 0;
}

Measured memory_bytes: 3576
#include<bits/stdc++.h>
using namespace std;
#define sz(x) (int)x.size()
#define pb push_back
#define mp make_pair
#define ll long long 
#define mod 998244353
void fast(){
  ios_base::sync_with_stdio(false);cin.tie(NULL);
}

int main() {
   fast();
  long long n;
  cin>>n;
  long long l=n;
  int ans=0;
  while(l){
    l=l/10;
    ans++;
  }
  for(long long i=2;i<=sqrt(n);i++){
    if(n%i==0){
      long long c=i;
      long long d=n/i;
      int f=0;
      int g=0;
      while(c){
        c=c/10;
        f++;
      }
      while(d){
        d=d/10;
        g++;
      }
      ans=min(ans,max(f,g));
    }
  }
  cout<<ans<<"\n";



}


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

using namespace std;

#define all(x) (x).begin(), (x).end()

typedef long long ll;

const int N = 100, INF = 1e9;
int a[N][N];

void solve() {
  int n, m; cin >> n >> m;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++)
      a[i][j] = INF;
    a[i][i] = 0;
  }
  vector<pair<pair<int, int> , int> > edges;
  for (int i = 0; i < m; i++) {
    int v, u, c; cin >> v >> u >> c; v--, u--;
    edges.push_back({{v, u}, c});
    a[v][u] = a[u][v] = c;
  }
  for (int k = 0; k < n; k++) {
    for (int i = 0; i < n; i++)
      for (int j = 0; j < n; j++)
        a[i][j] = min(a[i][j], a[i][k] + a[k][j]);
  }
  int badedges = 0;
  for (auto e : edges) {
    int v = e.first.first, u = e.first.second, c = e.second;
    int flag = 0;
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < n; j++) {
        if (a[i][v] + c + a[u][j] == a[i][j])
          flag = 1;
      }
    }
    if (!flag) badedges++;
  }
  cout << badedges;
}

// CHECK LIMITS (n <= 10^5)
// CHECK CORNER CASES (n == 1)

int main() {
  ios::sync_with_stdio(NULL), cin.tie(0), cout.tie(0);
  cout.setf(ios::fixed), cout.precision(20);
  //cout << 1.0 * clock() / CLOCKS_PER_SEC << endl;
  solve();
}


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


int main() {
  int n;
  cin >> n;
  vector<int> d(n);
  rep(i, n) {
    cin >> d.at(i);
  }
  int ans = 0;
  rep(i, n) rep(j, n) {
    if (i == j) break;
    else {
      ans += d.at(i) * d.at(j);
    }
  }
  cout << ans << endl;
}

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

int main(){
	
	int N;
	double D;
	int count = 0;
	
	cin >> N >> D;
	
	vector<double> xc(N);
	vector<double> yc(N);
	
	for (int i = 0; i < N; i++) {
		cin >> xc.at(i) >> yc.at(i);
		
		//cout << pow(pow(xc.at(i), 2.0) + pow(yc.at(i), 2.0), 0.5) << endl;
	
	        if(pow(pow(xc.at(i), 2.0) + pow(yc.at(i), 2.0), 0.5) <= D){
			count ++;
			//cout << count << endl;
		}
		
	}
	
	cout << count << endl;
			
	

}

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

int main(){
  string M;
  int N;
  cin>>N>>M;
  //65~90 
  for(char ans : M){
    if(ans+N>90){
      ans=64+(ans+N-90)-N;
    }
   printf("%c",ans+N);
     
  }
 cout<<endl;
}



Measured memory_bytes: 256
n=int(input())
la = list(map(int, input().split()))

sla=sorted(la,reverse=True)

a_li=[]
b_li=[]
for i in range(n):
    if(i%2==0):
        a_li.append(sla[i])
    else:
        b_li.append(sla[i])

print(sum(a_li)-sum(b_li))

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

int dfs(int start,vector<vector<int>> &graph,vector<int>&visited){
	visited[start]=1;
	int ans=0;
	for(int i=0;i<graph[start].size();i++){
		if(visited[graph[start][i]]==0){
			ans+=dfs(graph[start][i],graph,visited);
		}
	}
	return 1+ans;
}


int main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
  
    int t;
  	t=1;

    while(t--){
    	int n,m;
    	cin>>n>>m;

    	vector<vector<int>> graph(n);

    	int s,d;
    	for(int i=0;i<m;i++){
    		cin>>s>>d;
    		graph[s-1].push_back(d-1);
    		graph[d-1].push_back(s-1);
    	}

    	vector<int> visited(n);

    	int ans=0;
    	for(int i=0;i<n;i++){
    		if(visited[i]==0){
    			ans=max(ans,dfs(i,graph,visited));
    		}
    	}
    	cout<<ans;

    }
    return 0;
}



Measured memory_bytes: 24288
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int a = sc.nextInt();
        int b = sc.nextInt();
        int result = -1;
        for(int i = 1; i <= 1250; i++) {
            if((int)(i * 0.08) == a && (int)(i * 0.1) == b) {
                result = i;
                break;
            }
        }
        System.out.println(result);
    }
}

Measured memory_bytes: 23892
include Math
def f(a, b)
  cos = (b[0] - a[0]) / ((b[0] - a[0]) ** 2 + (b[1] - a[1]) ** 2) ** 0.5
  sin = (b[1] - a[1]) / ((b[0] - a[0]) ** 2 + (b[1] - a[1]) ** 2) ** 0.5
  len = ((a[0] - b[0]) ** 2 + (a[1] - b[1]) ** 2) ** 0.5 / 3 ** 0.5
  #p [cos, acos(cos) * 180 / PI, (cos * cos(30.0 / 180 * PI) - sin * sin(30.0 / 180 * PI)), acos((cos * cos(30.0 / 180 * PI) - sin * sin (30.0 / 180 * PI))) * 180 / PI]
  #p [sin, asin(sin) * 180 / PI, (sin * cos(30.0 / 180 * PI) + cos * sin(30.0 / 180 * PI)), asin((sin * cos(30.0 / 180 * PI) + cos * sin(30.0 / 180 * PI))) * 180 / PI]
  #p len
  return [(2 * a[0] + b[0]) / 3, (2 * a[1] + b[1]) / 3], [a[0] + len * (cos * cos(30.0 / 180 * PI) - sin * sin(30.0 / 180 * PI)), a[1] + len * (sin * cos(30.0 / 180 * PI) + cos * sin(30.0 / 180 * PI))],  [(a[0] + 2 * b[0]) / 3, (a[1] + 2 * b[1]) / 3]
end
def test
  n = gets.to_i
  arr = Array.new(4 ** n + 1)
  #arr[0], arr[-1] = [BigDecimal.new("0.0"), BigDecimal.new("0.0")], [BigDecimal("100.0"), BigDecimal("0.0")]
  arr[0], arr[-1] = [0.0, 0.0], [100.0, 0.0]
  n.times do |i|
    for j in 1..4 ** i
      coord = f(arr[(j - 1) * 4 ** (n - i)], arr[j * 4 ** (n - i)])
      for k in 1..3
        if ((j - 1) * 4 ** (n - i) + k * 4 ** (n - i - 1)) % 4 == 2 and ((j - 1) * 4 ** (n - i) + k * 4 ** (n - i - 1)) > 20 and ((j - 1) * 4 ** (n - i) + k * 4 ** (n - i - 1)) < 40
          #p ["k", (j - 1) * 4 ** (n - i) + k * 4 ** (n - i - 1), (j - 1) * 4 ** (n - i), j * 4 ** (n - i), arr[(j - 1) * 4 ** (n - i)], arr[j * 4 ** (n - i)]]
        end
        arr[(j - 1) * 4 ** (n - i) + k * 4 ** (n - i - 1)] = coord[k - 1]
      end
    end
  end
  arr.each{|item|
    puts item.join(" ")
  }
end
test

Measured memory_bytes: 6240
#include <bits/stdc++.h>
using namespace std;
class Vacation{
public:
    int a,b,c;
};
int maxPoints(int n, Vacation taro[]){
    int dp[n+1][3];
    for(int i=0;i<=n;i++){
        for(int j=0;j<3;j++){
            if(i==0){
                dp[i][j]=0;
            }
            else if(j==0){
                dp[i][j]=max(dp[i-1][1],dp[i-1][2])+taro[i-1].a;
            }
            else if(j==1){
                dp[i][j]=max(dp[i-1][2],dp[i-1][0])+taro[i-1].b;
            }
            else if(j==2){
                dp[i][j]=max(dp[i-1][1],dp[i-1][0])+taro[i-1].c;
            }
        }
    }
    return max(dp[n][2],max(dp[n][1],dp[n][0]));
}
int main() {
    int n;
    cin>>n;
    Vacation taro[n];
    for(int i=0;i<n;i++){
        cin>>taro[i].a;
        cin>>taro[i].b;
        cin>>taro[i].c;
    }
    cout<<maxPoints(n,taro);
    
    
}


Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<int, pii> pip;
const ll INF = 1e9+100;
const ll MOD = 1e9;
const double EPS = 1e-10;
const bool debug = 0;
//------------------------------//

ll N;

int main() {
	cin >> N;
	
	for (ll a = 1; a <= 3500; a++) {
		for (ll b = a; b <= 3500; b++) {
			ll c = -N * a * b;
			ll div = N * b + N * a - 4 * a * b;
			if (div == 0 || c % div != 0) continue;
			c /= div;
			if (c <= 0) continue;
			
			printf("%lld %lld %lld\n", a, b, c);
			return 0;
		}
	}
	
	return 0;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import numpy as np
n = int(input())
a1 = 2
a2 = 1
flag = 1
for i in range(0, n):
    if flag == 1:
        a1 = a1 + a2
        flag = 0
    else:
        a2 = a1 + a2
        flag = 1

if flag == 1:
    print(a1)
else:
    print(a2)

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

typedef long long unsigned int llu;
typedef long long int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int main() {
  string S;
  cin >> S;
  
  if (S.at(S.size()-1) != 's'){
    S = S+'s';
  }else{
    S = S+"es";
  }
  cout << S << endl;
}


Measured memory_bytes: 3636
a, b, m = map(int,raw_input().split())
al = map(int,raw_input().split())
bl = map(int,raw_input().split())
low = min(al)+min(bl)
x = [0] * m
y = [0] * m
c = [0] * m

for i in range(m):
    x[i],y[i],c[i] = map(int, raw_input().split())
    x[i] -= 1
    y[i] -= 1
 
for i in range(m):
    low = min(low,al[x[i]]+bl[y[i]]-c[i])

print low

Measured memory_bytes: 21668
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <complex>
#include <cstring>
#include <cstdlib>
#include <string>
#include <cmath>
#include <cassert>
#include <queue>
#include <set>
#include <map>
#include <valarray>
#include <bitset>
#include <stack>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
const int INF = 1<<29;

typedef double Weight;
struct Edge {
  int src, dst;
  Weight weight;
  Edge(int src, int dst, Weight weight) :
    src(src), dst(dst), weight(weight) { }
};

bool operator < (const Edge &e, const Edge &f) {
  return e.weight != f.weight ? e.weight > f.weight : // !!INVERSE!!
    e.src != f.src ? e.src < f.src : e.dst < f.dst;
}

typedef vector<Edge> Edges;
typedef vector<Edges> Graph;

// // ¹öª¢çÈ¢ê
vector<Weight> dijkstra2(const Graph &g, int s) {
  vector<Weight> dist(g.size(), INF);
  dist[s] = 0;
  priority_queue<Edge> Q; // "e < f" <=> "e.weight > f.weight"
  for (Q.push(Edge(-2, s, 0)); !Q.empty(); ) {
    Edge e = Q.top(); Q.pop();
    if (dist[e.dst] < e.weight) continue;
    FOR(f,g[e.dst]) {
      if (dist[f->dst] > e.weight+f->weight) {
        dist[f->dst] = e.weight+f->weight;
        Q.push(Edge(f->src, f->dst, e.weight+f->weight));
      }
    }
  }
  return dist;
}

int main() {
  int n;
  while(cin>>n,n) {
    int a[n+1];
    a[0] = 0;
    REP(i, n)
      cin >> a[i+1];
    double b,r,v,e,f;
    cin>>b>>r>>v>>e>>f;
    double timetable[10001];
    timetable[0] = 0;
    REP(x, 10001) {
      double t;
      if (x >= r) t = 1.0/(v-e*(x-r));
      else t = 1.0/(v-f*(r-x));
      timetable[x+1] = timetable[x] + t;
    }
    
    Graph g(n+1);
    REP(i, n) {
      for (int j=i+1; j<n+1; ++j) {
        double t = 0;
        if (i) t += b;
        t += timetable[a[j]-a[i]];
        g[i].push_back(Edge(i,j,t));
      }
    }
    printf("%.12f\n", dijkstra2(g, 0)[n]);
  }
}

Measured memory_bytes: 0
import java.io.*;
import java.util.*;
public class Main{
public static void main (String[]args) {

    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    try {
    int k = Integer.parseInt(br.readLine());
    String res = br.readLine();
String newRes  = "";
    if(res.length()>k) {
    newRes = res.substring(0, k) + "...";
    }
    else{
        newRes = res;
    }
System.out.println(newRes);

       
    }catch (Exception e) {
       }
       }
   }

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

int main(){
    int a,b,c,d;
    cin >> a >> b >> c >> d;
    if(abs(a-c) > d){
        if(abs(a-b) > d || abs(b-c) > d){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
}

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

int main()
{
    long long n,k,x,res;
    cin>>n>>k;
    x=n/k;
    res=(x*x*x);
    if(k%2==0)
    {
        if(n%k>=k/2)
            x++;
        res+=(x*x*x);
    }
    cout<<res<<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;

int sum[100], need[100];
int main() {
	int n, k;
	while (cin >> n >> k, n) {
		rep(i, k)scanf("%d", &sum[i]);
		memset(need, 0, sizeof(need));
		rep(i, n)rep(j, k) {
			int a; cin >> a;
			need[j] += a;
		}
		bool flag = true;
		rep(i, k) {
			if (need[i] > sum[i]) {
				puts("No");
				flag = false;
				break;
			}
		}
		if (flag)puts("Yes");
	}
}

Measured memory_bytes: 3120
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0;i<n;i++)
typedef long long ll;
 
int main() {
  string s;cin>>s;
  if (s[0]==s[1]||s[1]==s[2]||s[2]==s[3]) cout<<"Bad";
  else cout<<"Good";
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int N = 2e5 + 5, mod = 1e9 + 7;

ll a[N];

int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int n;
    cin >> n;
    ll ans = 0;
    for(int i = 0; i < n; i++){
        cin >> a[i];
        ans ^= a[i];
    }
    for(int i = 0; i < n; i++){
        a[i] ^= ans;
        cout << a[i] << ' ';
    }

    return 0;
}



Measured memory_bytes: 5112
#include <bits/stdc++.h>
  
#define IO ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL)
#define f first
#define s second
#define pb push_back
#define all(a) a.begin(), a.end()
using namespace std;
  
typedef long long ll;
typedef long double ld;
typedef unsigned int ui;
typedef unsigned long long ull;

template<typename T1, typename T2> inline void chkmax(T1 & x, T2 y) {if (x < y) x = y;}
template<typename T1, typename T2> inline void chkmin(T1 & x, T2 y) {if (x > y) x = y;}


int main() {
    IO;
    // freopen("input.txt", "r", stdin);
    int n, y;
    cin >> n >> y;
    y /= 1000;
    for (int c10 = 0; c10 <= n; ++c10) {
        for (int c5 = 0; c5 + c10 <= n; ++c5) {
            int c1 = n - c10 - c5;
            if (c10 * 10 + c5 * 5 + c1 == y) {
                cout << c10 << ' ' << c5 << ' ' << c1 << endl;
                return 0;
            }
        }
    }
    cout << "-1 -1 -1";
    return 0;
}

// 1 5 10

Measured memory_bytes: 256
import bisect
import itertools
N, M, K = [int(_) for _ in input().split()]
A = list(itertools.accumulate([0] + [int(_) for _ in input().split()]))
B = list(itertools.accumulate([0] + [int(_) for _ in input().split()]))
ans = 0
for i, a in enumerate(A):
    if a > K:
        break
    ans = max(ans, i + bisect.bisect(B, K - a) - 1)
print(ans)


Measured memory_bytes: 42676
#include<bits/stdc++.h>
#define M 1000000007
using namespace std;
int A[2005][2005];
int main(){
	int a,b,i,j,c;
	long long w;
	cin>>a>>b,c=a-b;
	for(i=0;i<=a;i++){
		A[i][0]=1;
		for(j=1;j<=i;j++)A[i][j]=(A[i-1][j-1]+A[i-1][j])%M;
	}
	for(i=1;i<=b;i++){
		if(i>c+1){
			cout<<0<<endl;
			continue;
		}
		w=1;
		w=(w*A[c+1][i])%M;
		w=(w*A[b-1][i-1])%M;
		cout<<w<<endl;
	}
}

Measured memory_bytes: 15104
x = int(input())
# x = 100*a + 101*b + 102c + 103d + 104e + 105f
# x = 100*(a+b+c+d+e+f) + b + 2c + 3d  +4e + 5f
# 100以上はaで操作できる
# 下二桁が（上二桁以上）個の1~5の組み合わせで作れるか
limit = x // 100
n = x % 100
if limit == 0:
  print(0)
  exit()
f = n // 5
n = n - f * 5

e = n // 4
n = n - e * 4

d = n // 3
n = n - d * 3

c = n // 2
n = n - c * 2

b = n
print(int(b + c + d + e + f <= limit))

Measured memory_bytes: 3064
#include <cstdio>

int N,l,r,ans;

int main(){
	
	scanf("%d",&N);
	
	for(int i=0;i<N;i++){
		scanf("%d%d",&l,&r);
		int a = r+1 - l;
		ans += a;
	}
	
	printf("%d",ans);
	
}


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

using namespace std;

int main() {
	int N, M;
	cin >> N >> M;
	vector<vector<int>> G(N, vector<int>(N));
	for(int i = 0; i < M; i++) {
		int a, b;
		cin >> a >> b;
		a--, b--;
		G[a][b] = G[b][a] = 1;
	}

	vector<int> P(N);
	for(int i = 0; i < N; i++) P[i] = i;

	int ans = 0;
	do {
		int now = P[0];
		if (now != 0) continue;
		int flag = 1;
		for(int i = 0; i < N - 1; i++) {
			if (!G[now][P[i + 1]]) {
				flag = 0;
				break;
			}
			now = P[i + 1];
		}
		ans += flag;
	} while(next_permutation(P.begin(), P.end()));
	cout << ans << endl;
}


Measured memory_bytes: 256