akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <iomanip>
#include <vector>
#include <cstring>
#include <queue>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
using namespace std;
using ll = long long;
using ld = long double;
using ull = unsigned long long;
using uld = unsigned long long;
using P = pair<int,int>;
const ll mod = 1e9+7;
const int dx[4] = {0,1,0,-1};
const int dy[4] = {1,0,-1,0};
template<class T> inline bool chmax(T &a,T& b){if(a < b){a = b; return true;} else return false;}
template<class T> inline bool chmin(T &a,T& b){if(a > b){a = b; return true;} else return false;}
int main(){
    int x,y;
    cin >> x >> y;
    bool ans = true;
    if(y%2 == 1){
        ans = false;
    }
    if(2*x > y || 4*x < y){
        ans = false;
    }
    cout << (ans ? "Yes" : "No") << endl;
}

Measured memory_bytes: 3596
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(); 
    if (a < b) { 
      System.out.println("a < b"); 
    } 
    else if(a==b){
      System.out.println("a == b");
    }
    else{
      System.out.println("a > b");
    }
  }
}
     

Measured memory_bytes: 26072
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
int a[200010], b[200010];
int n, bs;
int mn[800010], tag[800010];
void build(int p, int l, int r) {
	if(l == r) {
		mn[p] = b[l]; tag[p] = 0;
		return ;
	}
	int mid = (l + r)>>1;
	build(p<<1, l, mid); build(p<<1|1, mid + 1, r);
	mn[p] = min(mn[p<<1], mn[p<<1|1]);
}
inline void pd(int p) {
	tag[p<<1]+= tag[p]; mn[p<<1]+= tag[p];
	tag[p<<1|1]+= tag[p]; mn[p<<1|1]+= tag[p];
	tag[p] = 0;
}
void add(int p, int l, int r, int x, int y) {
	if(x > y) return ;
	if(x <= l && r <= y) {
		++tag[p];
		++mn[p];
		return ;
	}
	int mid = (l + r)>>1;
	pd(p); 
	if(x <= mid) add(p<<1, l, mid, x, y);
	if(mid + 1 <= y) add(p<<1|1, mid + 1, r, x, y);
	mn[p] = min(mn[p<<1], mn[p<<1|1]);
}
int query(int p, int l, int r, int x, int y) {
	if(x <= l && r <= y) return mn[p];
	int mid = (l + r)>>1;
	int s1 = 0x7fffffff, s2 = 0x7fffffff;
	pd(p);
	if(x <= mid) s1 = query(p<<1, l, mid, x, y);
	if(mid + 1 <= y) s2 = query(p<<1|1, mid + 1, r, x, y);
	return min(s1, s2);
}
int main() {
	scanf("%d", &n);
	for(int i = 1; i <= n; ++i) scanf("%d", &a[i]);
	memcpy(b, a, sizeof(b)); sort(b+1, b+n+1); bs = unique(b+1, b+n+1) - b - 1;
	build(1, 1, bs);
	long long ans = 0;
	for(int i = 1; i <= n; ++i) {
		int p = lower_bound(b+1, b+bs+1, a[i]) - b;
		ans+= query(1, 1, bs, p, bs) - a[i];
		add(1, 1, bs, 1, p - 1);
	}
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 7808
#include <bits/stdc++.h>
#define int long long
#define R(i,a,n) for(int i=a;i<n;i++)
#define r(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef pair<int,int>P;
#define fi first
#define se second
int dx[]={0,1,0,-1};
int dy[]={-1,0,1,0};
int ddx[]={0,1,1,1,0,-1,-1,-1};
int ddy[]={-1,-1,0,1,1,1,0,-1};

int a,b,c,k;

signed main(){
  cin>>a>>b>>c>>k;
  if( k%2 )cout<<b-a<<endl;
  else cout<<a-b<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define FAST ios_base::sync_with_stdio(0); cin.tie(); cout.tie();
 
#define MAXX 10005
 
#define PI   3.14159265358979323846264338327950
 
#define F first
#define S second
 
#define ll 	 long long int
 
#define mod  1000000007



int main()
{
	FAST;
	ll n;
	cin >> n; ll a =0;
	for(ll i = 0; i < n; i++){
		ll x;
		cin >> x;
		while(x % 2 == 0){
			a ++;
			x /= 2;
		}
	}
	cout << a;
	return 0;
}

Measured memory_bytes: 3656
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <numeric>

int main(void) {
	// in
	int n, x;
	std::cin >> n >> x;
	std::vector<int> l(n);
	for(int i = 0; i < n; ++i) std::cin >> l[i];
	
	int d = 0;
	int n_bound = 1;
	for(int i = 0; i < n; ++i) {
		d += l[i];
		if(d <= x) n_bound += 1;
		else break;
	}

	std::cout << n_bound << std::endl;

	return 0;
}


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

B = [0]*(N+1)
B[0] = 1
for i in range(1,N+1):
    B[i] = (B[i-1]-A[i-1])*2
    
C = [0]*(N+1)
C[N] = A[N]

for i in range(N-1,-1,-1):
    C[i] = C[i+1]+A[i]
    
check = 0
D = [0]*(N+1)

for i in range(N+1):
    if A[i]>B[i]:
        check += 1
    D[i] = min(B[i],C[i])
    
if N==0:
    if A[0]!=1:
        check += 1

if check == 0:
    print(sum(D))
else:
    print("-1")

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

int main() {
    using namespace std;
    string s, t;
    cin >> s >> t;
    unsigned long N = s.size(), M = t.size();
    {
        unsigned long n = (N + M - 1) / N;
        string ss(s.begin(), s.end());
        while(n){
            if(n & 1)s += ss;
            ss += ss;
            n >>= 1;
        }
    }

    vector<unsigned long> MP_find_result;
    auto MP_find = [&MP_find_result](auto s, auto t){
        string Q = t + "_" + s;
        unsigned long N = s.size(), M = t.size(), L = Q.size();
        vector<unsigned long> MP(L + 1);
        for(unsigned long i = 1, j = 0; i <= L; ++i){
            while(j > 0 && Q[i - 1] != Q[j - 1])j = MP[j - 1];
            MP[i] = ++j;
            if(MP[i] > M && i >= MP[i] + M && i < MP[i] + N + M)MP_find_result.push_back(i - MP[i] - M);
        }
    };

    MP_find(s, t);

    vector<unsigned long> idx(N);
    for(const auto& i : MP_find_result)if(i < N)idx[i] = ~0UL;

    auto f = [rec = [&idx, &M, &N](auto f, unsigned long i, unsigned long t, unsigned long k) -> unsigned long{
        if(!idx[i])return 0;
        if(i == t && k)idx[i] = 2 * N;
        else if(!~idx[i])idx[i] = f(f, (i + M) % N, t, 1) + 1;
        return idx[i];
    }](unsigned long n){rec(rec, n, n, 0);};
    for(unsigned long i = 0; i < N; ++i)f(i);

    unsigned long ans = *max_element(idx.begin(), idx.end());
    if(ans > N)puts("-1");
    else cout << ans << endl;
    return 0;
}

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

string a[50];
string b[50];
int n, m;

bool include_pic_b(int i, int j)
{
    for (int y = 0; y < m; y++) {
        if (a[y + i].substr(j, m) != b[y]) {
            return false;
        }
    }

    return true;
}

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

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

    for (int i = 0; i < m; i++) {
        cin >> b[i];
    }

    for (int i = 0; i <= n - m; i++) {
        for (int j = 0; j <= n - m; j++) {
            if (include_pic_b(i, j)) {
                cout << "Yes" << endl;
                return 0;
            }
        }
    }

    cout << "No" << endl;

    return 0;
}


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


int n;
vector<int> v;


void input() {
    cin >> n;
    v = vector<int>(n);
    rep(i, n) cin >> v[i];
}


int main() {
    input();
    vector<pair<int, int>> w1, w2;
    w1 = w2 = vector<pair<int, int>>(1e5+1);
    rep(i, 1e5+1) w1[i] = w2[i] = make_pair(0, i);
    for (int i = 0; i < n; i += 2) {
        w1[v[i]].first++;
        w2[v[i+1]].first++;
    }
    sort(w1.rbegin(), w1.rend());
    sort(w2.rbegin(), w2.rend());
    int ans;
    if (w1[0].second == w2[0].second) {
        if (w1[0].first - w1[1].first > w2[0].first - w2[1].first) swap(w1, w2);
        ans = n - w1[1].first - w2[0].first;
    }
    else {
        ans = n - w1[0].first - w2[0].first;
    }
    cout << ans << endl;
}


Measured memory_bytes: 2176
#include <iostream>
#include <stdio.h>
#include <vector>
#include <utility>
#include <string>
#include <algorithm>
#include <cmath>
#include <queue>
 
typedef long long ll;

#define rep(i,n) for(ll i = 0; i < n; i++)
 
using namespace std;
 
const ll INF = ll(1e18)+1;
const double PI=3.14159265358979323846;

int main(){
  int n, xy[10][2];
  cin >> n;
  vector<int> mati;
  rep(i,n){
    mati.push_back(i);
    cin >> xy[i][0] >> xy[i][1];
  }
  int cnt=0;
  double ans, total = 0.;
  do{
    rep(i,n-1){
      total += sqrt( pow(xy[mati[i]][0]-xy[mati[i+1]][0],2)\
		     + pow(xy[mati[i]][1]-xy[mati[i+1]][1],2) );
    }
    cnt++;
  }while(next_permutation(mati.begin(), mati.end()));
  ans = total / cnt;
  printf("%10.8f\n", ans);
}


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

typedef long long ll;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<vector<vector<ll>>> vvvll;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<vector<vector<bool>>> vvvb;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef vector<vpll> vvpll;
typedef vector<double> vd;
typedef vector<vd> vdd;

#define FOR(i,x,y) for(ll i=(ll)x; i<(ll)y; ++i)
#define REP(i,y) FOR(i, 0, y)
#define RFOR(i,x,y) for(ll i=(ll)x; i>=(ll)y; --i)
#define RREP(i,x) RFOR(i, x, 0)
#define ALL(a) a.begin(), a.end()
#define pb push_back
#define debug_print(x...) cerr << "line " << __LINE__ << " : "; debug_print_in(x);

template <typename First>
void debug_print_in(First first){
  cerr << first << endl;
  return;
}

template <typename First, typename... Rest>
void debug_print_in(First first, Rest... rest){
  cerr << first << " ";
  debug_print_in(rest...);
  return;
}

void IN(void){
  return;
}

template <typename First, typename... Rest>
void IN(First& first, Rest&... rest){
  cin >> first;
  IN(rest...);
  return;
}

template <typename First>
void OUT(First first){
  cout << first << endl;
  return;
}

template <typename First, typename... Rest>
void OUT(First first, Rest... rest){
  cout << first << " ";
  OUT(rest...);
  return;
}

template<class t, class u> void chmax(t&a,u b){if(a<b)a=b;};
template<class t, class u> void chmin(t&a,u b){if(a>b)a=b;};
int popcount(int t){return __builtin_popcount(t);} //GCC
int popcount(ll t){return __builtin_popcountll(t);} //GCC

template <typename T>
void vec_print(vector<T> VEC){
  REP(i, VEC.size()){
    cerr << VEC[i] << " ";
  }
  cerr << endl;
};

template <typename T>
void mat_print(vector<vector<T> > MAT){
  REP(i,MAT.size()){
    REP(j,MAT[i].size()){
      cerr << MAT[i][j] << " ";
    }
    cerr << endl;
  }
};

constexpr int INF = (1<<30);
constexpr ll INFLL = 1LL<<62;
constexpr long double EPS = 1e-12;
constexpr ll MOD = (ll)((1E+9)+7);

int main(){
  cin.tie(0); // cut the cin and cout (default, std::flush is performed after std::cin)
  ios::sync_with_stdio(false); // cut the iostream and stdio (DON'T endl; BUT "\n";)

  ll N, M, K;
  IN(N,M,K);
  vll A(N), B(M);
  vll A_sum(N+1, 0);
  vll B_sum(M+1, 0);

  REP(i,N){
    IN(A[i]);
    A_sum[i+1] = A_sum[i] + A[i];
  }
  REP(i,M){
    IN(B[i]);
    B_sum[i+1] = B_sum[i] + B[i];
  }

  ll B_end = M;
  ll ans = 0;
  REP(A_end, N+1){
    if(B_end==0){
      if(A_sum[A_end]+B_sum[B_end]<=K){
        chmax(ans, A_end+B_end);
      }
    }else{
      while(A_sum[A_end]+B_sum[B_end]>K){
        B_end--;
        if(B_end<0) break;
      }
      if(B_end<0) break;
      if(A_sum[A_end]+B_sum[B_end]<=K){
        chmax(ans, A_end+B_end);
      }
    }
  }

  OUT(ans);

  return 0;
}

Measured memory_bytes: 9532
#include <iostream>
#include <vector>
#include <algorithm> // sort
#include <numeric> // accumulate

using namespace std;

int main() {
  int N;
  int x;
  vector <int> v;

  cin >> N >> x;
  for (int i = 0; i < N; i++) {
    int num;
    cin >> num;
    v.push_back(num);
  }

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

  int rest = x;
  int count = 0;

  for (auto it = v.begin(); it != v.end(); it++){
    if (rest < *it) break;
    rest -= *it;
    count++;
  }
  // お菓子があまってて全員にくばっちゃってたら一人押し付けて犠牲になってもらう
  // 全員にくばってなければ、残りの人に押し付ければよいので特にインクリメントしない
  if (rest > 0 && count == N) {
    count = N - 1;
  }
  cout << count << endl;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS 
#include <stdio.h>
#include <math.h>
#include <algorithm>

using namespace std;

#define FOR(i,init,n) for(int i = init; i < n ;i++)
#define REP(i,n)  FOR(i,0,n)


int main()
{
	//FILE* fin = freopen("input.txt", "r", stdin);
	//FILE* fout = freopen("output.txt", "w", stdout);
	while (1){
		int w, h,x,y,r;
		int cleft, cright, ctop, cbottom;
		scanf("%d %d %d %d %d", &w, &h,&x,&y,&r);
		if (x < -100 || x >100){
			break;
		}
		else if (y < -100 || y >100){
			break;
		}
		else if (w <= 0 || w > 100){
			break;
		}
		else if (h <= 0 || h > 100){
			break;
		}
		else if (r <= 0 || r > 100){
			break;
		}

		cleft = x - r;
		cright = x + r;
		ctop = y + r;
		cbottom = y - r;
		if (cleft < 0 || cright > w || ctop > h || cbottom < 0 ){
			printf("No\n");
			break;
		}
		else{
			printf("Yes\n");
			break;
		}
	}
	return 0;
}

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

long long n,k,cnt[5000][5000],mod=1e9+7;

int main()
{
	cin>>n>>k;
	for(int i=0;i<=2005;i++)
	{
		cnt[i][0]=1;
		for(int j=1;j<=i;j++)
			cnt[i][j]=(cnt[i-1][j-1]+cnt[i-1][j])%mod;
	}
	for(int i=1;i<=k;i++)
		cout<<(cnt[k-1][i-1]*cnt[n-k+1][i])%mod<<endl;
	return 0;
}



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

int dp[1001][1001];
int m = 1e9+7;
int f(int x, int y, vector<string> &mat, int h, int w){
    
    //cout<<x<<" "<<y<<endl;
    
    if(x>h or y>w) return 0;
    if(mat[x][y]=='#') return 0;
    if(x==h and y==w) return 1;
    
    int& ans = dp[x][y];
    if(ans!=-1) return ans;
    ans = ((f(x+1,y,mat,h,w))%m + (f(x,y+1, mat, h, w))%m)%m;
    return ans;
}

int main(){
    memset(dp,-1,sizeof(dp));
    int h,w;
    cin>>h>>w;
    
    vector<string> mat;
    for(int i=0;i<h;i++){
        string temp;
        cin>>temp;
        mat.push_back(temp);
    }
    
    //cout<<mat[0];
    cout<<f(0,0,mat,h-1,w-1);
    return 0;
}

Measured memory_bytes: 5376
import sys
from heapq import*
r=sys.stdin.readline
def g(E,n,s,g):
 F=[1e7]*-~n;F[s]=0
 H=[(0,s)]
 while H:
  c,u=heappop(H)
  if u==g:return c
  for f,v in E[u]:
   t=c+f
   if t<F[v]:F[v]=t;heappush(H,(t,v))
 return-1
def s():
 for e in iter(input,'0 0'):
  n,k=map(int,e.split())
  E=[[]for _ in[0]*-~n]
  for _ in[0]*k:
   f=[*map(int,r().split())]
   if f[0]:
    c,d,e=f[1:]
    E[c]+=[(e,d)];E[d]+=[(e,c)]
   else:print(g(E,n,*f[1:]))
if'__main__'==__name__:s()


Measured memory_bytes: 6312
#include <stdio.h>

char adv(char c,int n){
  while(n--){
    if(c=='z')
      c='a';
    else
      c++;
  }
  return c;
}


void swap_c(char *a,char *b){
  char t=*a;
  *a=*b;
  *b=t;
}

int main(void){
  int n,a[2][100],i,b,c;
  char m[101];
  while(1){
    scanf("%d",&n);
    if(!n)
      break;
    scanf("%s",m);
    for(i=0;i<n;i++)
      scanf("%d %d",&a[0][i],&a[1][i]);
    for(i=n-1;i>=0;i--){
      b=a[0][i];
      c=a[1][i];
      swap_c(&m[b-1],&m[c-1]);
      m[b-1]=adv(m[b-1],c-b);
      m[c-1]=adv(m[c-1],c-b);
    }
    printf("%s\n",m);
  }
  return 0;
}

Measured memory_bytes: 588
#include<iostream>
using namespace std;
int main(){
	ios::sync_with_stdio(false);
	int n,a;
	cin>>n>>a;
	while(n>=500)n-=500;
	while(a!=0&&n!=0)n--,a--;
	if(n==0)cout<<"Yes";
	else cout<<"No";
}

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

int main(){
    int n,t,c,k;
    int ans=1001;
    cin>>n>>t;

    for(int i=0;i<n;i++){
        cin>>c>>k;
        if(k<=t){
            if(ans>c)ans=c;
        }
    }
    if(ans==1001)cout<<"TLE"<<endl;
    else    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
     int N;
     scanf("%d",&N);
     char S[100],T[100];
     scanf("%s %s",&S,&T);

    int i,a;
    for(i=0;i<N;i++){
        printf("%c%c",S[i],T[i]);
    }
    return 0;

}


Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <algorithm>
#include <map>
#include <math.h>
#include <iomanip>
#include <vector>
#include <queue>
#include <functional>
#include <random>
#include <time.h>
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
int main() {
	ll n, t[100010] = {}, x[100010] = {}, y[100010] = {};
	cin >> n;
	for (int i = 1; i <= n; i++) cin >> t[i] >> x[i] >> y[i];
	for (int i = 1; i <= n; i++) {
		ll X, Y, T;
		X = abs(x[i - 1] - x[i]);
		Y = abs(y[i - 1] - y[i]);
		T = t[i] - t[i - 1];
		if (X + Y > T) {
			cout << "No" << endl;
			return 0;
		}
		T -= X;
		if (T < Y) {
			cout << "No" << endl;
			return 0;
		}
		else {
			if (Y % 2 != T % 2) {
				cout << "No" << endl;
				return 0;
			}
		}
	}
	cout << "Yes" << endl;
	return 0;
}


Measured memory_bytes: 2560
/*input
1 3
*/
#include <bits/stdc++.h>

using namespace std;

int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  printf("%lld\n", (n == 1 || m == 1) ? 1 : ((long long)n * m + 1) / 2);
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
using namespace std;
#include<vector>
struct SCC{
	int n;
	vector<int>comp,order;
	vector<bool>used;
	vector<vector<int> >G,RG;
	SCC(int _n=0):n(_n),comp(_n,-1),used(_n,false),G(_n),RG(_n){}
	void add_edge(int from,int to)
	{
		G[from].push_back(to);
		RG[to].push_back(from);
	}
	void copy(vector<vector<int> >&H)
	{
		for(int i=0;i<H.size();i++)
		{
			for(int j=0;j<H[i].size();j++)
			{
				G[i].push_back(H[i][j]);
				RG[H[i][j]].push_back(i);
			}
		}
	}
	int operator[](int u){return comp[u];}
	void dfs(int u)
	{
		used[u]=true;
		for(int i=0;i<G[u].size();i++)if(!used[G[u][i]])dfs(G[u][i]);
		order.push_back(u);
	}
	void rdfs(int u,int cnt)
	{
		comp[u]=cnt;
		for(int i=0;i<RG[u].size();i++)if(comp[RG[u][i]]==-1)rdfs(RG[u][i],cnt);
	}
	int build()
	{
		for(int i=0;i<n;i++)if(!used[i])dfs(i);
		int cnt=0;
		for(int i=n-1;i>=0;i--)if(comp[order[i]]==-1)rdfs(order[i],cnt++);
		return cnt;
	}
	int build(vector<vector<int> >&H)
	{
		int ret=build();
		H.assign(ret,vector<int>());
		for(int i=0;i<n;i++)
		{
			for(int j=0;j<G[i].size();j++)
			{
				if(comp[i]!=comp[G[i][j]])
					H[comp[i]].push_back(comp[G[i][j]]);
			}
		}
		return ret;
	}
};
main()
{
	int n;
	while(cin>>n,n)
	{
		vector<double>p(n),P(n,1);
		SCC scc(n);
		vector<vector<int> >G(n);
		for(int i=0;i<n;i++)
		{
			cin>>p[i];
			int k;cin>>k;
			for(;k--;)
			{
				int a;cin>>a;
				G[i].push_back(a-1);
			}
		}
		scc.copy(G);
		int N=scc.build(G);
		for(int i=0;i<n;i++)P[scc[i]]*=p[i];
		vector<int>H(N,0);
		for(int i=0;i<N;i++)
		{
			for(int j=0;j<G[i].size();j++)
			{
				H[G[i][j]]++;
			}
		}
		double ans=1;
		for(int i=0;i<N;i++)if(H[i]==0)ans*=1-P[i];
		cout<<fixed<<setprecision(9)<<ans<<endl;
	}
}



Measured memory_bytes: 3400
#include <bits/stdc++.h> 
using namespace std;
typedef long long ll;
//typedef pair<int,int> P;
//priority_queue<int> pque;
//priority_queue<int, vector<int>, greater<int>> pque;
ll INFL = 1000000000000000010;//10^18 = 2^60
int INF = 2000000000;//10^9
ll MOD  = 1000000007;

int main(void){
    double N,T,A;
    cin >> N >> T >> A;
    vector<double> H(N);
    for(int i = 0; i < N; i++){
        cin >> H.at(i);
    }
    double min = INF;
    int ans = -1;
    for(int i = 0; i < N; i++){
        H.at(i) = T - H.at(i) * 0.006;
        H.at(i) -= A;
        H.at(i) = abs(H.at(i));
        if(min > H.at(i)){
            min = H.at(i);
            ans = i;
        }
    }
    cout << ans + 1 << endl;
}


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

using namespace std;
using ll = long long;

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

const int mod = 1e9 + 7;

ll modpow(ll k, ll n) {
  ll res = 1;
  while (n > 0) {
    if (n & 1) res = res * k % mod;
    k = k * k % mod;
    n /= 2;
  }
  return res;
}

int main() {
  int n;
  cin >> n;
  int a[n];
  rep(i, n) cin >> a[i];

  ll sum = 0, r = 0;
  rep(i, n) sum = (sum + a[i]) % mod;
  rep(i, n) r = (r + (ll)a[i] * a[i] % mod) % mod;

  ll ans = sum * sum % mod;
  ans = (ans - r + mod) % mod;
  ans = ans * modpow(2, mod - 2) % mod;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 4372
#include <iostream>
#include <algorithm>
#include <cmath>

using namespace std;

#define UNDEF 2000000000

int n,m,k[151],x[151][10],d[151][10],dp[151][10][76];

int getdp(int col,int row,int rem)
{
	if(col < 151 && row < 10 && rem < 76 && col >= 0 && row >= 0 && rem >= 0)
		return dp[col][row][rem];
	else
		return UNDEF;
}

int main(void)
{
	while(true)
	{
		cin >> n >> m;
		if(n == 0 && m == 0)
			exit(0);
		for(int i = 0;i < 151;i++)
		{
			for(int j = 0;j < 10;j++)
			{
				x[i][j] = UNDEF;
				d[i][j] = UNDEF;
				for(int l = 0;l < 76;l++)
				{
					dp[i][j][l] = UNDEF;
				}
			}
			k[i] = UNDEF;
		}
		for(int i = 0;i < n;i++)
		{
			cin >> k[i];
			for(int j = 0;j < k[i];j++)
			{
				cin >> x[i][j] >> d[i][j];
			}
		}
		for(int i = 0;i < k[0];i++)
		{
			dp[0][i][m] = 0;
		}
		if(m > 0 && n > 1)
		{
			for(int i = 0;i < k[1];i++)
			{
				dp[1][i][m-1] = 0;
			}
		}
		for(int col = 1;col < n;col++)
		{
			for(int row = 0;row < k[col];row++)
			{
				for(int rem = 0;rem <= m;rem++)
				{
					for(int t = 0;t < k[col-1];t++)
					{
						if(getdp(col-1,t,rem) != UNDEF)
							dp[col][row][rem] = min(dp[col][row][rem],getdp(col-1,t,rem)+((d[col][row]+d[col-1][t])*abs(x[col][row]-x[col-1][t])));
					}
					for(int t = 0;t < k[col-2];t++)
					{
						if(getdp(col-2,t,rem+1) != UNDEF)
							dp[col][row][rem] = min(dp[col][row][rem],getdp(col-2,t,rem+1)+((d[col][row]+d[col-2][t])*abs(x[col][row]-x[col-2][t])));
					}
				}
			}
		}
		int result = UNDEF;
		for(int row = 0;row < k[n-1];row++)
		{
			for(int rem = 0;rem <= m;rem++)
			{
				result = min(result,dp[n-1][row][rem]);
			}
		}
		for(int row = 0;row < k[n-2];row++)
		{
			for(int rem = 1;rem <= m;rem++)
			{
				result = min(result,dp[n-2][row][rem]);
			}
		}
		
		cout << result << endl;
	}
}

Measured memory_bytes: 3484
#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <assert.h>

using namespace std;

typedef long long ll;

#define sz size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(c) (c).begin(), (c).end()
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define per(i,a,b) for(ll i=b-1LL;i>=(a);--i)
#define clr(a, b) memset((a), (b) ,sizeof(a))
#define ctos(c) string(1,c)
#define print(x) cout<<#x<<" = "<<x<<endl;

#define MOD 1000000007

ll d[200010];

int main(){
  ll n,k;
  cin>>n>>k;
  vector<ll> v;
  rep(i,0,n){
    ll a;
    cin>>a;
    a--;
    v.pb(a);
  }
  if(k<500000){
    ll a = 0;
    rep(i,0,k){
      a = v[a];
    }
    cout << a+1 << endl;
  }
  else{
    clr(d,0);
    ll a = 0;
    rep(i,0,k){
      d[a] = 1;
      a = v[a];
      if(d[a]==1)break;
    }
    if(a==v[a]){
      cout << a+1 << endl;
      return 0;
    }
    ll b = 0;
    ll w = 0;
    rep(i,0,k){
      if(b==a)break;
      w++;
      b = v[b];
    }
    k -= w;
    clr(d,0);
    ll c = a;
    ll e = 0;
    rep(i,0,k){
      d[c] = 1;
      c = v[c];
      e++;
      if(d[c]==1)break;
    }    
    k %= e;
    ll f = a;
    rep(i,0,k){
      f = v[f];
    }
    cout << f+1 << endl;
  }
  return 0;
}

Measured memory_bytes: 6408
# -*- coding: utf-8 -*-
A, B = map(int, input().split())

min_X_A = int(A // 0.08 + (1 if A % 0.08 > 0 else 0))
max_X_A = int((A + 1) // 0.08)
min_X_B = int(B // 0.1 + (1 if B % 0.1 > 0 else 0))
max_X_B = int((B + 1) // 0.1)

if max_X_A < min_X_B or max_X_B < min_X_A:
    print(-1)
else:
    print(max(min_X_A, min_X_B))

Measured memory_bytes: 3064
using System;
using System.Linq;

namespace abc061
{
    class Program
    {
        static void Main(string[] args)
        {
            var input = Console.ReadLine().Split(' ').Select(x=>int.Parse(x)).ToArray();
            var result = (input[0] <= input[2] && input[2] <= input[1]) ? "Yes" : "No";
            Console.WriteLine(result);
        }
    }
}


Measured memory_bytes: 13268
#include <stdio.h>
#include <string.h>

int map[1000][1000];

int mini(int a,int b,int c){
	int tmp = (a > b) ? b : a;
	return (tmp > c) ? c : tmp;
}

int main(){
	int i,j,n,min,max;
	char str[1024];

	while(1){
		scanf("%d",&n);
		if(n == 0){
			break;
		}
		memset(map,0,sizeof(map));
		for(i = 0;i < n;i++){
			scanf("%s",str);
			for(j = 0;j < n;j++){
				if(str[j] == '.'){
					map[i][j] = -1;
				}else{
					map[i][j] = 0;
				}
			}
		}

		max = 0;

		for(i = 0;i < n;i++){
			if(map[0][i] == -1){
				map[0][i] = 1;
				max = 1;
			}
			if(map[i][0] == -1){
				map[i][0] = 1;
				max = 1;
			}
		}

		for(i = 1;i < n;i++){
			for(j = 1;j < n;j++){
				if(map[i][j] == -1){
					min = mini(map[i-1][j-1],map[i][j-1],map[i-1][j]);
					map[i][j] = min+1;
					if(max < (min+1)){
						max = (min+1);
					}
				}
			}
		}

		printf("%d\n",max);
	}

	return 0;
}

Measured memory_bytes: 4516
#include<bits/stdc++.h>
#define ll long long int
#define M 1000000007
#define mod 998244353
#define mp(x,y) make_pair(x,y)
#define pb(x) push_back(x)
#define pi pair<ll,ll>
using namespace std;
const ll N=500010;

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);

    ll ar[]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    ll k;cin>>k;
    cout<<ar[k-1];

	return(0);
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 3e5 + 10;

int n, m;
string a[22];
typedef pair<int, int> pa;

int valid(int x, int y) {
    return x >= 1 && x <= n && y >= 1 && y <= m && a[x][y] == '.';
}

int bfs(int x, int y) {
    int d[22][22];
    int inf = 9999;
    for(int i = 0; i <= n; i++) {
        for(int j = 0; j <= m; j++) {
            d[i][j] = inf;
        }
    }
    d[x][y] = 0;
    queue<pa> q;
    q.push(pa(x,y));
    int dir[4][2] = {0, 1, 1, 0, 0, -1, -1, 0};
    while(!q.empty()) {
        pa now = q.front();
        // printf("(%d, %d)\n", now.first, now.second);
        q.pop();
        for(int i = 0; i < 4; i++) {
            int nxt_x = now.first + dir[i][0];
            int nxt_y = now.second + dir[i][1];
            if(valid(nxt_x, nxt_y) && d[nxt_x][nxt_y] == inf) {
                pa nxt = pa(nxt_x, nxt_y);
                d[nxt_x][nxt_y] = d[now.first][now.second] + 1;
                q.push(nxt);
            }
        }
    }
    int ans = 0;
    for(int i = 0; i <= n; i++) {
        for(int j = 0; j <= m; j++) {
            if(d[i][j] != inf) {
                ans = max(ans, d[i][j]);
            }
        }
    }
    // printf("start(%d,%d) => %d\n", x, y, ans);
    return ans;
}

int main() {
    cin >> n >> m;
    for(int i = 1; i <= n; i++) {
        cin >> a[i];
        a[i] = " " + a[i];
    }
    int ans = 0;
    for(int i = 1; i <= n; i++) {
        for(int j = 1; j <= m; j++) {
            if(a[i][j] == '#') continue;
            ans = max(ans, bfs(i, j));
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
typedef long double ld;
const ll INF = 1e+14;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back

void Yes(){
	cout<<"Yes"<<endl;
	exit(0);
}
 
void No(){
	cout<<"No"<<endl;
	exit(0);
}
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
    string s, t; cin >> s >> t;
    int n = (int)s.size(), m = (int)t.size();
    int dp[3010][3010];
    rep1(i, n) {
        rep1(j, m) {
            if(s[i - 1] == t[j - 1]) dp[i][j] = dp[i - 1][j - 1] + 1;
            else dp[i][j] = max(dp[i][j - 1], dp[i - 1][j]);
        }
    }
    string ans = "";
    while(n > 0 && m > 0) {
        if(dp[n][m] == dp[n - 1][m]) n --;
        else if(dp[n][m] == dp[n][m - 1]) m --;
        else {
            ans = s[n - 1] + ans;
            n --; m --;
        }
    }
    cout << ans << endl;
	return 0;
}

Measured memory_bytes: 35584
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()
typedef long long LL;
typedef pair<double,int> P;
const LL mod=1000000007;
const LL LINF=1LL<<60;
const int INF=1<<30;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};


int main(){
    int n;cin >> n;
    vector<LL> a(n);
    LL sum = 0;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        sum += a[i];
    }
    LL t = 0;
    LL ans = LINF;
    for (int i = 0; i < n; i++) {
        t += a[i];
        ans = min(ans, abs(t - sum / 2) + abs(sum - t - sum / 2));
        ans = min(ans, abs(t - (sum+1) / 2) + abs(sum - t - (sum+1) / 2));
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1792
import fractions
  
N = int(input())
A = list(map(int, input().split()))

ans = 0
MOD = 10**9 + 7

LCM = A[0]
for i in range(1, N):
    LCM *= A[i]//fractions.gcd(LCM, A[i])
    
for a in A:
  ans += LCM//a
  
print(ans%MOD)

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

int main() {


    string s,t;
    cin>>s>>t;
    int count=0;

    for(int i=0;i<3;i++)
    {
    	if(s[i]==t[i])
    	{
    		count++;
    	}
    }
    cout<<count;

    return 0;
}

Measured memory_bytes: 256
/*
  AOJ #0347
  title:
  @kankichi573
 */
#include <stdio.h>
#include <stdlib.h>
#include <float.h>
double max(double x,double y)
{
  if(x>y)
    return(x);
  else
    return(y);
}
int n,ar[1000];


int comp( const void * a , const void * b ) {

  if( *( int * )a < *( int * )b ) {
    return -1;
  }
  else
  if( *( int * )a == *( int * )b ) {
    return 0;
  }
  return 1;
}

int main()
{
  int i,m2;
  double ret;

  scanf("%d",&n);
  for(i=0;i<n;i++)
    scanf("%d",&ar[i]);
  qsort(ar,n,sizeof(int),comp);
  ret=0.0;
  m2=ar[n-2]+ar[n-1];
  
  for(i=0;i<n-3;i++)
    ret=max(ret,(double)m2/(ar[i+1]-ar[i]));
  ret=max(ret,(ar[n-1]+ar[n-4])/(ar[n-2]-ar[n-3]));
  ret=max(ret,(ar[n-3]+ar[n-4])/(ar[n-1]-ar[n-2]));
  printf("%lf\n",ret);
  return(0);
}

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

#define rep(i, n) for (int i = 0; i < n; ++i)
#define ALL(a) (a).begin(), (a).end()
#define rALL(a) (a).rbegin(), (a).rend()
#define SZ(x) ((int)(x).size())
using ll = long long;
using ull = unsigned long long;
using P = pair<int, int>;
using llP = pair<ll, ll>;
using DoP = pair<double, double>;
const int di[] = {0, 1, 0, -1, 1, 1, -1, -1};
const int dj[] = {1, 0, -1, 0, 1, -1, 1, -1};
const int INF = 1 << 30;
const ll INF64 = 1ll << 55;
const int mod = 1000000007;
//const int mod = 998244353;

template <class T>inline bool chmin(T &a, const T b)
{
  if (a > b)
  {
    a = b;
    return true;
  }
  return false;
}
template <class T>inline bool chmax(T &a, const T b)
{
  if (a < b)
  {
    a = b;
    return true;
  }
  return false;
}
template <class T>inline void line_out(const vector<T> vec) {
  int n = SZ(vec);
  rep(i, n) {
    cout << vec[i];
    if(i < n-1) cout << " ";
  }
  cout << endl;
  return;
}

struct mint
{
  ll x; // typedef long long ll;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  mint operator-() const { return mint(-x); }
  mint &operator+=(const mint a)
  {
    if ((x += a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator-=(const mint a)
  {
    if ((x += mod - a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator*=(const mint a)
  {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const
  {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const
  {
    mint res(*this);
    return res -= a;
  }
  mint &operator++()
  {
    if ((x += 1) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator--()
  {
    if ((x += mod - 1) >= mod)
      x -= mod;
    return *this;
  }
  mint operator*(const mint a) const
  {
    mint res(*this);
    return res *= a;
  }
  mint pow(ll t) const
  {
    if (!t)
      return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1)
      a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const
  {
    return pow(mod - 2);
  }
  mint &operator/=(const mint a)
  {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const
  {
    mint res(*this);
    return res /= a;
  }
};

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

  bool ok = false;
  int last = -1;
  rep(i, n-1) if(a[i]+a[i+1] >= l) last = i+1;

  if(last == -1) {
    cout << "Impossible" << endl;
    return 0;
  }

  cout << "Possible" << endl;
  for(int i = 1; i < last; ++i) cout << i << endl;
  for(int i = n-1; i > last; --i) cout << i << endl;
  cout << last << endl;
}

Measured memory_bytes: 1664
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cmath>
using namespace std;
const int N=200010;
int a[N];
__int128 g[N];
inline int gi() {
    int x=0,o=1;
    char ch=getchar();
    while(ch<'0'||ch>'9') ch=='-'?o=-1:0,ch=getchar();
    while(ch>='0'&&ch<='9') x=x*10+ch-'0',ch=getchar();
    return o*x;
}
int main() {
    int n,x;
    cin>>n>>x;
    for(int i=1;i<=n;i++) a[i]=gi(),g[i]=g[i-1]+a[i];
    __int128 ans=1LL<<60;
    for(int i=1;i<=n;i++) {
	__int128 s=(g[n]-g[n-i])*5;
	int t=5,j=n-i;
	while(j-i>0) s+=(g[j]-g[j-i])*t,t+=2,j-=i;
	ans=min(ans,s+g[j]*t+1LL*i*x);
    }
    cout<<(long long)ans+1LL*n*x;
    return 0;
}

Measured memory_bytes: 4096
main = do
  li <- getLine
  let [a,b,c] = map read $ words li
  let ans = compute a b c
  print ans

{-
増やすことしかできないので、a+x = b+y = c+z = K まで増やして完成するとする。
どちらの操作も、合計で2増やすので、操作回数は (x+y+z)/2 である。これの最小値が欲しい。
a >= b >= c と仮定して、a=Kとできたとすると、
x=0, y=a-b, z=a-c, x+y+z = 2a-b-c これが偶数ならそれでできる。
奇数のときは、a+1=Kでできたとすると、
x=1, y=a-b+1, z=a-c+1, x+y+z = 2a-b-c+3 2a-b-cが奇数ならこれは偶数
2a-b-c = 3a - (a+b+c)
-}

compute :: Int -> Int -> Int -> Int
compute a b c
  | even e = div e 2
  | True   = div (e+3) 2
  where
    d = maximum [a,b,c]
    e = 3 * d - a - b - c

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

constexpr int inf = 1e9;
constexpr ll linf = 1e18;

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

    int k, q; cin >> k >> q;
    vector<ll> d(k);
    for (int i = 0; i < k; i++) cin >> d[i];

    while (q--) {
        ll n, x, m; cin >> n >> x >> m;

        vector<ll> s(k + 1, 0);
        for (int i = 0; i < k; i++) s[i + 1] = s[i] + (d[i] % m ? d[i] % m : m);

        ll sum = x % m;
        sum += s[k] * ((n - 2) / k);
        sum += s[(n - 2) % k + 1];

        ll ans = n - sum / m - 1;
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 384
#include<iostream>
#include<algorithm>
using namespace std;
int main(){

  int n;

  cin >>n;
  
  int val[n];

  for(int i = 0 ; i < n ; i++)cin >> val[i];

  int minv = val[0],maxv = -1e9;

  for(int i = 1 ; i < n ; i++){
    maxv = max(maxv,val[i]-minv);
    minv = min(minv,val[i]);
  }
  
  cout <<maxv<<endl;
  
}

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

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

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repto(i, n) for(int i = 0; i <= (n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end())
#define _1 first
#define _2 second
#define pb push_back
#define INF 1145141919
#define MOD 1000000007
#define DEBUG(x) cout << #x << ": " << x << endl;
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }

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

  int W, H, N;
  cin >> W >> H >> N;
  int w = 0;
  int h = 0;
  rep (i, N) {
    int x, y, a;
    cin >> x >> y >> a;
    if (a == 1) {
      if (w < x)
        w = x;
    }
    else if (a == 2) {
      if (W > x)
        W = x;
    }
    else if (a == 3) {
      if (h < y)
        h = y;
    }
    else {
      if (H > y)
        H = y;
    }
  }
  if (w > W || h > H)
    cout << '0' << endl;
  else
    cout << (W-w)*(H-h) << endl;
}


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

signed main(){
	int n,ans=1e17;
	cin>>n;
	int a[n],s[n];
	r(i,n)cin>>a[i];
	int l=-1e10-1,r=1e10+1;
	while(l<r){
		int m=(l+r)/2;
		int s0=0,s1=0,s2=0;
		r(i,n)s0+=abs((i+1+m)-a[i]);
		r(i,n)s1+=abs((i+1+m-1)-a[i]);
		r(i,n)s2+=abs((i+1+m+1)-a[i]);
		if(s1<s0&&s0<s2)r=m;
		else l=m+1;
		if(s1>=s0&&s0<=s2)break;
	}
	for(int i=-10;i<10;i++){
		int sum=0;
		r(j,n)sum+=abs((j+1+l+i)-a[j]);
		ans=min(sum,ans);
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 1792
A, B = map(int, input().split(" "))

C = 1009
Min = 1010

while(C > 0):
    a = int(C*0.08)
    b = int(C*0.10)
    t_bool = (a==A and b==B)
    c_bool = (C<Min)
    if t_bool and c_bool :
        Min = C
    C-=1
if Min==1010:
    print(-1)
else:
    print(Min)

Measured memory_bytes: 3064
import std.stdio, std.string, std.conv;
import std.range, std.algorithm, std.array;


void main() {
    int a, b, k;
    scan(a, b, k);

    foreach (i ; a .. b + 1) {
        if (i < a + k || i > b - k) {
            writeln(i);
        }
    }
}




void scan(T...)(ref T args) {
    import std.stdio : readln;
    import std.algorithm : splitter;
    import std.conv : to;
    import std.range.primitives;

    auto line = readln().splitter();
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}



void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
    using namespace std;
     
    int main() {
      char c;
      cin >> c;
      if (c=='a'||c=='e'||c=='i'||c=='o'||c=='u'){
        cout << "vowel" << endl;
      }
      else{
        cout << "consonant" << endl;
      }
    }

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

int main(){
    vector< vector<int> > l(100, vector<int>(0));
    string s;
    int r = 0, i = 0;
    while( cin >> s ){
        string::iterator it = s.begin();
        while( true ){
            if( isdigit( *it ) ){
                int a = 0;
                while( it != s.end() && *it != ',' ){
                    a *= 10;
                    a += *it - '0';
                    it++;
                }
                l[i].push_back( a );
            }
            if( it == s.end() ) break;
            it++;
        }
        if( !i || l[i].size() > l[i-1].size() ) r++;
        i++;
    }
    int m;
    for(m = 1; m <= i/2; m++){
        for(int n = 0; n < m; n++){
            if( !n ) l[m][0] += l[m-1][0];
            else if( m-n == 1 ) l[m][n] += l[m-1][n-1];
            else l[m][n] += max(l[m-1][n-1], l[m-1][n]);
        }
    }
    for(; m < i; m++){
        for(int n = 0; n < i-m; n++){
            l[m][n] += max(l[m-1][n], l[m-1][n+1]);
        }
    }
    cout << l[i-1][0] << endl;
    return 0;
}

Measured memory_bytes: 1220
#include <iostream>
#include <vector>
#include <queue>
#include <cstring>
using namespace std;

struct S {
    int y, x;
    int t;
    S(int y, int x, int t) : y(y), x(x), t(t) {}
};

const int dy[] = {0, 2, 0, -2};
const int dx[] = {2, 0, -2, 0};

int w, h;
int main() {
    while (cin >> w >> h) {
        if (w == 0 && h == 0) break;
        vector<string> field;
        cin.ignore(1024, '\n'); // 1024は適当に選んだ数値. でかけりゃなんでもいい
        for (int i = 0; i < h*2-1; i++) {
            string s;
            getline(cin, s);
            if (i % 2 == 0) s.push_back(' ');
            field.push_back(s);
        }

        bool v[2*h-1][2*w-1];
        memset(v, 0, sizeof(v));
        queue<S> q;
        q.push(S(0, 0, 1));
        bool found = false;
        while (!q.empty()) {
            S p = q.front(); q.pop();
            if (p.y == 2*h-2 && p.x == 2*w-2) {
                cout << p.t << endl;
                found = true;
                break;
            }
            for (int j = 0; j < 4; j++) {
                int ny = p.y + dy[j];
                int nx = p.x + dx[j];
                if (0 <= ny && ny < 2*h-1 && 0 <= nx && nx < 2*w-1
                            && !v[ny][nx] 
                            && field[(ny + p.y) / 2][(nx + p.x) / 2] == '0') {
                    //cout << (ny+p.y)/2 << ',' << (nx+p.x)/2 << ':' << field[(ny + p.y) / 2][(nx + p.x) / 2] << endl;
                    v[ny][nx] = true;
                    q.push(S(ny, nx, p.t+1));
                }
            }
        }
        if (!found) cout << 0 << endl;
    }
    return 0;
}

Measured memory_bytes: 1248
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <queue>
#include <vector>

using namespace std;
#define y1     y114514
#define pb     push_back
#define mkp    make_pair
#define fi     first
#define se     second
#define all(a) a.begin(), a.end()

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

const int M = 1000000007;

const int MAXN = 505;

int  N;
int  ans[MAXN][MAXN];
bool done[MAXN][MAXN];

const int dx[] = {-1, 1, 0, 0};
const int dy[] = {0, 0, 1, -1};

void update(int x, int y) {
    queue<pair<int, int>> q;
    q.push(mkp(x, y));
    while (!q.empty()) {
        x = q.front().first, y = q.front().second;
        q.pop();
        for (int d = 0; d < 4; ++d) {
            int tx = x + dx[d], ty = y + dy[d];
						if(tx >= 1 && tx <= N && ty >= 1 && ty <= N) {
            if (ans[tx][ty] > ans[x][y] + !done[x][y]) {
                ans[tx][ty] = ans[x][y] + !done[x][y];
                q.push(mkp(tx, ty));
            }
						}
        }
    }
}

int main() {
    scanf("%d", &N);
    for (int i = 1; i <= N; ++i)
        for (int j = 1; j <= N; ++j)
            ans[i][j] = min(min(i - 1, N - i), min(j - 1, N - j));

    int sum = 0;
    for (int i = 1; i <= N * N; ++i) {
        int t, x, y;
        scanf("%d", &t);
        x = (t + N - 1) / N;
        y = t - (x - 1) * N;
        //printf("%d %d\n", x, y);
        done[x][y] = 1;
        sum += ans[x][y];
        update(x, y);
    }
    printf("%d\n", sum);
    return 0;
}


Measured memory_bytes: 4476
use proconio::input;

fn main() {
  input! {
    s: String,
    t: String
  }
  let s: Vec<char> = s.chars().collect();
  let t: Vec<char> = t.chars().collect();
  
  let mut result = 1000;
  let diff = s.len() - t.len();
  
  for i in 0..=diff {
    let mut count = 0;
    for ii in 0..t.len() {
      if s[i+ii] != t[ii] {
        count += 1;
      }
    }
    result = std::cmp::min(result, count);
  }
  
  println!("{}", result);
}

Measured memory_bytes: 2192
N = int(input())
P = list(map(int,input().split()))

ls = [""] * N
cnt = 0

for i in range(N):
  if P[i] == i + 1:
    ls[i] = "#"
  else:
    ls[i] = "."
    
if ls[-1] == "#":
  if ls[-2] == "#":
    ls[-1], ls[-2] = ".", "."
  else:
    ls[-1] = "."
  cnt += 1

for j in range(N-1):
  if ls[j] == "#":
    if ls[j+1] == "#":
      ls[j+1] = "."
    cnt += 1
    
print(cnt)

Measured memory_bytes: 20436
#include<stdio.h>
long gcd(long a,long b){
  if (a%b==0)
      return(b);
  else
    return(gcd(b,a%b));
}
int main(){
  long n,X,x,tmp,i;
  scanf("%ld%ld",&n,&X);
  for(i=0;i<n;i++){
    scanf("%d",&x);
    if(i==0)
      tmp=abs(x-X);
    else
      tmp=gcd(tmp,abs(x-X));
  }
  printf("%ld\n",tmp);
  return 0;
}

Measured memory_bytes: 128
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int p = sc.nextInt();
		String[]a=new String[p+1];
		String[] r = {"AC", "WA", "TLE", "RE"};
		int[] x= {0,0,0,0};
		for(int i=0;i<p+1;++i) {
			a[i]= sc.nextLine();


		}
		for(int i=1;i<p+1;i++) {
			for(int j=0;j<4;j++) {
				if(a[i].equals(r[j])) {
					x[j]++;
				}
			}
		}
			for(int i =0;i<4;i++) {
				System.out.println(r[i]+" x "+x[i]);
			}


		}

	}





Measured memory_bytes: 65152
package main

import "fmt"

func main() {
	var n int
	var s string
	fmt.Scan(&n, &s)

	w := make([]int, n)
	for i := 1; i < n; i++ {
		if s[i-1] == 'W' {
			w[i] = w[i-1] + 1
		} else {
			w[i] = w[i-1]
		}
	}
	e := make([]int, n)
	for i := n - 2; i >= 0; i-- {
		if s[i+1] == 'E' {
			e[i] = e[i+1] + 1
		} else {
			e[i] = e[i+1]
		}
	}

	var min int = 3 * 10e5
	for i := 0; i < n; i++ {
		if min > w[i]+e[i] {
			min = w[i] + e[i]
		}
	}
	fmt.Println(min)
}

Measured memory_bytes: 7296
import java.util.Scanner;


class Main{
    public static void main(String[] args){
	Scanner scn = new Scanner(System.in);
	char[][] table = new char[62*61][2];


	while(true){
	    int n = scn.nextInt();

	    if(n==0) break;

	    for(int i=0; i<n; i++){
		table[i][0] = scn.next().charAt(0);
		table[i][1] = scn.next().charAt(0);
	    }

	    int m = scn.nextInt();

	    loop: for(int i=0; i<m; i++){
		char ch = scn.next().charAt(0);
		for(int j=0; j<n; j++)
		    if(ch == table[j][0]){
			System.out.print(table[j][1]);
			continue loop;
		    }
		System.out.print(ch);
	    }
	    System.out.println();
	}
    }
}

Measured memory_bytes: 12000
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define rep(i, n) for(int i=0;i<n;++i)
#define rrep(i, n) for(int i=n;i>=0;--i)
const int inf=1e9+7;
const ll mod=1e9+7;
const ll big=1e18;
const double PI=2*asin(1);

ll min(ll a, ll b) {
  if(a>b) return b;
  else return a;
}

int main() {
  ll S;
  cin>>S;
  ll x1=1e9, x2, y1, y2;
  y2 = min(1e9, S/x1 + 1);
  x2 = x1*y2 - S;
  y1 = 1;
  cout<<0<<" "<<0<<" "<<x1<<" "<<y1<<" "<<x2<<" "<<y2<<endl;
}


Measured memory_bytes: 3632
#include <stdio.h>
#include <iostream>
#include <vector>
#include <string>
#include <math.h>
#include <algorithm>
using namespace std;
#define INF 0x7FFFFFFF
const double EPS = 1e-10;

// -------
// -#-#---
// -##-#--
// --#----
// #------


inline bool eq(double a, double b) { return fabs(b - a) < EPS;}

struct p_t{
  double x;
  double y;
};
double cross(p_t p,p_t q);
p_t line(p_t p,p_t q);

bool asc(p_t left,p_t right) {
    return left.x == right.x ? left.y < right.y : left.x < right.x;
}


int main(){
  int n;
  p_t z;
  cin>>n;
  vector<p_t> a(n,z);
  vector<p_t> ab;
  vector<p_t> ac(n,z);
  vector<p_t> ad;
  vector<p_t> ae;
  for(int i=0;i<n;i++){
    cin>>a[i].x>>a[i].y;
  }
  sort(a.begin(),a.end(),asc);
  ac=a;
  reverse(ac.begin(),ac.end());
  ab.push_back(a[0]);
  ab.push_back(a[1]);
  for(int i=2;i<(int)a.size();i++){
    while(ab.size()>1&&cross(line(ab[ab.size()-1],ab[ab.size()-2]),line(ab[ab.size()-1],a[i]))>0){
      ab.pop_back();
    }
    ab.push_back(a[i]);
  }
  ad.push_back(ac[0]);
  ad.push_back(ac[1]);
  for(int i=2;i<(int)ac.size();i++){
    while(ad.size()>1&&cross(line(ad[ad.size()-1],ad[ad.size()-2]),line(ad[ad.size()-1],ac[i]))>0){
      ad.pop_back();
    }
    ad.push_back(ac[i]);
  }
  ab.pop_back();
  ab.insert(ab.end(),ad.begin(),ad.end());
  ab.pop_back();
  int w=0;
  for(int i=1;i<(int)ab.size();i++){
    if(ab[w].y==ab[i].y ? ab[w].x>ab[i].x : ab[w].y>ab[i].y){
      w=i;
    }
  }
  for(int i=0;i<(int)ab.size();i++){
    if((i+w)>=(int)ab.size()){
      w-=ab.size();
    }
    ae.push_back(ab[w+i]);
  }
  cout<<(int)ab.size()<<endl;
  for(int i=0;i<(int)ab.size();i++){
    cout<<ae[i].x<< " "<<ae[i].y<<endl;
  }
}

p_t line(p_t p,p_t q){
  p_t z;
  z.x=q.x-p.x;
  z.y=q.y-p.y;
  return z;
}


double cross(p_t p,p_t q){
  return p.x*q.y-p.y*q.x;
}



Measured memory_bytes: 10388