akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
using namespace std;

int main(){
  char b;
  cin >> b;
  if(b == 'A') b = 'T';
  else if(b == 'T') b = 'A';
  else if(b == 'G') b = 'C';
  else b = 'G';
  cout << b << endl;
  return 0;
}

Measured memory_bytes: 256
fun main(args:Array<String>) {
    val ans = getAns(readLine()!!.toLong())
    println(ans)
}



fun getAns(start:Long):Long {
    val list = mutableListOf(start)
    val dic = mutableMapOf<Long, Boolean>()
    dic[start] = true

    for(i in (0..10000000)) {
        var num = list[i] / 2L;
        if(list[i] % 2  != 0L) {
            num = list[i] * 3L + 1
        }
        list.add(num)
        if(dic.containsKey(num)) {
            return i + 2L
        }
        dic[num] = true
    }
    return 0;
}


Measured memory_bytes: 31924
//
// ABC072C
//
//


#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <limits>
#include <map>

using namespace std;




int main() {
	long long N;
	cin >> N;
	long long A[N];
	for(long long i=0; i<N; i++)  cin >> A[i];


	map<int,int> Freq;

	for(int i=0; i<N; i++) {
		for(int j=-1; j<=1; j++) {
			Freq[A[i] + j]++;			// 初期化しなくても頻度カウントできる
		}
	}

  int ans=0,nmax=0;
	for(auto itr = Freq.begin(); itr != Freq.end(); ++itr) {
		if (nmax < itr->second) {
			nmax = itr->second;
			ans = nmax;
		}
	}

  cout << ans << endl;

	return 0;
}


Measured memory_bytes: 5504
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int R = sc.nextInt(), G = sc.nextInt(), B = sc.nextInt();
		int N = sc.nextInt();
		int res = 0;
		for(int r = 0; r <= 3000; r++) {
			for(int g = 0; g <= 3000; g++) {
				if(N >= (R*r + G*g) && (N - R*r - G*g) % B == 0) res++;
			}
		}
		System.out.println(res);
	}
}


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

int main() {
  int n,k,q;
   cin >> n >> k >> q;

   std::vector<int> vec(n,k);
   rep(i,q) {
     int x;
     cin >> x;
     x--;
     vec.at(x)++;
   }
   rep(i,n) {
     if (vec.at(i)-q <= 0) cout << "No" << endl;
     else cout << "Yes" << endl;
   }
}


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

int main()
{
  int n;
  cin>>n;
  if(n==1){
    cout<<"Hello World"<<endl;
  }else{
    int a,b;
    cin>>a>>b;
    cout<<a+b<<endl;
  }


  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int yuku(int,int,int);

int main(void){
    int i,j,p,k,dob=0,tri=0, sum=0,l;
    scanf("%d",&k);

    for(i=1;i<=k;i++){
        for(j=1;j<=k;j++){
            for(p=1;p<=k;p++){
                l = yuku(i,j,p);
                if(i==j==p){
                    tri += l;
                }else if(i==j || i==p || j==p){
                    dob += l;
                }else{
                    sum += l;
                }
            }
        }
    }

    //dob /= 2;

    printf("%d",sum+dob+tri);

    return 0;
}

int yuku(int a, int b, int c){
    int buff, r;

    if(a<b){
        buff = a;
        a = b;
        b = buff;
    }

  /* ユークリッドの互除法 */
    r = a % b;

    while(r!=0){
        a = b;
        b = r;
        r = a % b;
    }

    if(c<b){
        buff = c;
        c = b;
        b = buff;
    }

  /* ユークリッドの互除法 */
    r = c % b;
    
    while(r!=0){
        c = b;
        b = r;
        r = c % b;
    }

    return b;

}

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

#define rep(i, m, n) for(int(i) = (int)(m); i < (int)(n); ++i)
#define rep2(i, m, n) for(int(i) = (int)(n)-1; i >= (int)(m); --i)
#define REP(i, n) rep(i, 0, n)
#define REP2(i, n) rep2(i, 0, n)
#define all(hoge) (hoge).begin(), (hoge).end()
#define en '\n'
using ll = long long;
using ull = unsigned long long;
template <class T>
using vec = vector<T>;
template <class T>
using vvec = vector<vec<T>>;
typedef pair<ll, ll> P;
constexpr long long INF = 1LL << 60;
constexpr int INF_INT = 1 << 25;
constexpr long long MOD = (ll)1e9 + 7;
//constexpr long long MOD = 998244353LL;
using ld = long double;
static const ld pi = 3.141592653589793L;
typedef vector<ll> Array;
typedef vector<Array> Matrix;

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;
}

struct Edge {
    ll to, rev;
    long double cap;
    Edge(ll _to, long double _cap, ll _rev) {
        to = _to;
        cap = _cap;
        rev = _rev;
    }
};
using Edges = vector<Edge>;
using Graph = vector<Edges>;

void add_edge(Graph &G, ll from, ll to, long double cap, bool revFlag,
              long double revCap) {
    G[from].push_back(Edge(to, cap, (ll)G[to].size()));
    if(revFlag)
        G[to].push_back(Edge(from, revCap, (ll)G[from].size() - 1));
}

ll C[51][51]; // C[n][k] -> nCk
void comb_table(int N) {
    for(int i = 0; i <= N; ++i) {
        for(int j = 0; j <= i; ++j) {
            if(j == 0 or j == i) {
                C[i][j] = 1LL;
            } else {
                C[i][j] = (C[i - 1][j - 1] + C[i - 1][j]);
            }
        }
    }
}

void solve() {
    ll n, a, b;
    cin >> n >> a >> b;
    Array v(n);
    map<ll, ll> mp;
    REP(i, n) {
        cin >> v[i];
        mp[v[i]]++;
    }
    sort(all(v), greater<ll>());

    ll pre = 0;
    ll con = 0;
    ll sum = 0;

    REP(i, a) {
        if(pre == v[i])
            con++;
        else {
            pre = v[i];
            con = 1;
        }
        sum += v[i];
    }

    cout << fixed << setprecision(10) << (long double)sum / (long double)a << en;

    comb_table(50);
    ll ans = 0;
    ans += C[mp[pre]][con];

    if(con == a) {
        rep(i, a, b) {
            if(pre != v[i])
                break;
            con++;
            ans += C[mp[pre]][con];
        }
    }
    cout << ans << en;
}

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

    solve();
    // ll t;cin>>t;REP(i,t) solve();

    return 0;
}


Measured memory_bytes: 3868
while True:
    first_string=input()
    if first_string=="-":
        break
    lst=list(first_string)
    m=int(input())
    for i in range(m):
        h=int(input())
        for l in range(1,h+1):
            letter=lst.pop(0)
            lst.insert(len(lst),letter)
    answer_string=''
    for m in lst:
        answer_string+=m
    print(answer_string)


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

using namespace std;
string a;
int main()
{
	cin>>a;
	int len=a.size();
	if(len%2==1) 
	{
		cout<<"No";
		cout<<endl;
		return 0;
	}
	int r=0;
	for(int i=0,j=len-1;i<j;i++,j--)
	{
		if((a[i]=='p' && a[j]=='q') || (a[i]=='q' && a[j]=='p') ||(a[i]=='d' && a[j]=='b') || (a[i]=='b' && a[j]=='d')) ;
		else 
		{
			r=1;
			break;
		}
	}
	if(r==0) cout<<"Yes";
	else cout<<"No";
	cout<<endl;
	
	return 0;
}

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

using namespace std;

#define ll long long

const ll mod  = 1e9 + 7;
const ll INF = 1e14;


void solve(){

    int n, m; cin >> n >> m;
    vector<int> graph[n+1];
    while(m--){
        int u, v; cin >> u >> v;
        graph[u].push_back(v);
        graph[v].push_back(u);
    }
    vector<int> par (n+1, -1);

    queue<int> que;
    for(int it : graph[1]){
        que.push(it);
        par[it] = 1;
    }
    while(!que.empty()){
        int node = que.front();
        que.pop();
        for(int it : graph[node]){
            if(par[it] != -1) continue;
            que.push(it);
            par[it] = node;
        }
    }
    for(int i = 2; i <= n; ++i){
        if(par[i] == -1){
            cout << "No";
            return;
        }
    }
    cout << "Yes\n";
    for(int i = 2; i <= n; ++i) cout << par[i] << "\n";

}


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

    cout << setprecision(10);
    //int test; cin >> test;
    //for(int t = 1; t <= test; ++t){
        solve();    
    //}

	return 0;
}

Measured memory_bytes: 10096
#include"bits/stdc++.h"
#define int long long
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(a);i<(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define itr(i,x) for(auto i=(x).begin();i!=(x).end();++i)
#define All(x) (x).begin(),(x).end()
#define gridif(a,x,b) if((a)<=(x)&&(x)<(b))

using namespace std;
typedef pair<int,int> P;
const int mod=1000000007;

int digitsum(int n,int b){
	if(b<2) return -1;
	if(n<b) return n;
	return digitsum(n/b,b)+n%b;
}
int mpow(int a,int x);
int m_inv(int n);
vector<int> split(int n,int a);
string xal_number(int n,int x);
int gcd(int x,int y){return y?gcd(y,x%y):x;}
int lcm(int x,int y){return x*y/gcd(x,y);}
class Factorial{
private:
	vector<int> fac;
public:
	Factorial(int N){
		fac.push_back(1);
		rep(i,N) fac.push_back(fac[i]*(i+1)%mod);
	}
	int fact(int a){return fac[a];}
	int ifac(int a){return m_inv(fac[a]);}
	int cmb(int n,int r);
};
struct UnionFind {
    vector<int> par; // 親ノード
    UnionFind(int n = 1) { init(n);}
    void init(int n = 1) {
        par.resize(n);
        rep(i,n) par[i] = -1;
    }
    int root(int x) {
        if (par[x] <0) return x;
        else return par[x] = root(par[x]);      
    }
    int size(int x){ return -par[root(x)];}
    bool issame(int x, int y) {return root(x)==root(y);}
    bool connect(int x, int y);
};

signed main(){
	int X;
	cin>>X;
	int n=0;
	while(++n){
		if(X<=n*(n+1)/2) break;
	}
	cout<<n<<endl;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>; 
using pll = pair<long long, long long>;
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007LL;
constexpr long long INF = 1001001001LL;
constexpr long long LINF = 1001001001001001001;
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define rept(i, j, n) for(int i=(j); i<(n); i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }


int main(){
    string s; cin >> s;
    string t = "YAKI";
    bool f = true;
    rep(i, 4){
        if(s[i] != t[i])f = false;
    }
    if(f) cout << "Yes" << ln;
    else cout << "No" << ln;
}




Measured memory_bytes: 3584
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a[4],i,n,j;
    cin>>n;
    for(i=0;i<4;i++)
    {
        a[i] = n%10;
        n=n/10;

    }

    for(i=0;i<3;i++)
    {
        if(a[i] == a[i+1])
        {
            printf("Bad\n");
            return 0;
        }
    }

    printf("Good\n");
    return 0;
}


Measured memory_bytes: 256
import copy
from itertools import combinations
h, w, k = map(int, input().split())
c =[input() for i in range(h)]
ans = 0
y = []
for i in range(h):
    y.append(i)
x = []
for i in range(w):
    x.append(i)
for i in range(h+1):
    ty = list(combinations(y, i))
    for j in range(w+1):
        tx = list(combinations(x, j))
        for l in ty:
            for m in tx:
                cnt = 0
                for p in l:
                    for q in m:
                        if c[p][q] == '#':
                            cnt += 1
                if cnt == k:
                    ans += 1
print(ans)

Measured memory_bytes: 9360
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int h[100050];
int good[100050];
int main(){
    int n,m,a,b,ans=0;
    scanf("%d%d",&n,&m);
    memset(good,1,sizeof good);
    for(int i=1;i<=n;i++) scanf("%d",&h[i]);
    for(int i=0;i<m;i++){
        scanf("%d %d",&a,&b);
        if(h[a]<h[b]) good[a]=0;
        else if(h[a]>h[b]) good[b]=0;
        else good[a]=0,good[b]=0;
    }
    for(int i=1;i<=n;i++){
        if(good[i]) ans++;
    }
    printf("%d",ans);
}


Measured memory_bytes: 4624
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  long long int a[n];
  for(int i=0;i<n;i++){
    cin>>a[i];
  }
  long long int d=0;
  for(int i=1;i<n;i++){
    if(a[i]<a[i-1]){
        d=d+a[i-1]-a[i];
        a[i]=a[i-1];
    }
  }
  cout<<d;
}


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

//Nは桁数が大きい場合があるので文字列として受け取る
string N;
vector<int> n; //Nの各桁の数字を格納するベクター
int dp[100][2][(1 << 3)];

int main()
{
    cin >> N;

    //ベクターnを構成
    for (auto a : N)
    {
        n.push_back(a - '0');
    }
    int l = N.size(); //nの長さ

    dp[0][0][0] = 1;
    for (int i = 1; i < l; i++)
    {
        dp[i][1][0] = 1;
    }
    
    
    for (int i = 0; i < l; i++)
    {
        for (int d = 0; d < 10; d++)
        {
            for (int j = 0; j < 2; j++)
            {
                for (int k = 0; k < (1 << 3); k++)
                {
                    if (d > n[i] && j == 0)
                    {
                        continue;
                    }
                    if (d != 3 && d != 5 && d != 7)
                    {
                        continue;
                    }
                    int nj = (n[i] > d) ? 1 : j;
                    int nk = k;
                    if (d == 3)
                        nk |= (1 << 2);
                    if (d == 5)
                        nk |= (1 << 1);
                    if (d == 7)
                        nk |= (1 << 0);

                    dp[i + 1][nj][nk] += dp[i][j][k];
                }
            }
        }
    }
    cout << dp[l][0][0b111] + dp[l][1][0b111] << endl;

    return 0;
}

Measured memory_bytes: 3644
#include <cstdio>
#include <utility>
#include <algorithm>

int n;
int A[18];
int B[18];
int C[18];
int D[18];

/*
dp[S][k] = OR dp[S-i][A[i]]
*/

int dp[1<<18][51];

int main(){
  scanf("%d", &n);
  for(int i = 0; i < n; i++) scanf("%d", A+i);
  for(int i = 0; i < n; i++) scanf("%d", B+i);

  for(int i = 1; i < (1 << n); i++){
    for(int k = 1; k <= 50; k++) dp[i][k] = 1000000000;
    for(int j = i; j; j &= j-1){
      int v = __builtin_ctz(j);
      bool t = __builtin_parity(i & ~((1<<(v+1))-1));
      int l = __builtin_popcount(~i & ((1<<v)-1));
      if(t^(l&1)) for(int k=1;k<=B[v];k++) dp[i][B[v]] = std::min(dp[i][B[v]], dp[i ^ (1 << v)][k] + l);
      else  for(int k=1;k<=A[v];k++) dp[i][A[v]] = std::min(dp[i][A[v]], dp[i ^ (1 << v)][k] + l);
    }
//for(int k = 1; k <= 50; k++) printf("%d ", dp[i][k]);
//puts("");

  }
  int ans = 1000000000;
  for(int k = 1; k <= 50; k++) ans = std::min(ans, dp[(1<<n)-1][k]);

  if(ans == 1000000000) puts("-1");
  else printf("%d\n", ans);


  return 0;
}


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

using namespace std;

const int mod = 1e9 + 7;

int main()
{
    int n, m;
    cin >> n >> m;
    set<int> st;
    for (int i = 0; i < m; i++){
        int x;
        cin >> x;
        st.insert(x);
    }
    vector<long long> dp(n + 1);
    dp[0] = 1;
    if (st.find(1) == st.end())
        dp[1] = 1;
    for (int i = 2; i <= n; i++){
        if (st.find(i) == st.end()){
            dp[i] = dp[i - 1] + dp[i - 2];
            dp[i] %= mod;
        }
    }
    cout << dp[n];
    return 0;
}


Measured memory_bytes: 5760
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <queue>
#include <stack>
#include <tuple>
#include <cmath>
#include <iomanip>
#include <map>
#include <stdio.h>
#include <cstring> //memset(dp,0,sizeof(dp))
#include <functional> //operator[]
#define ll long long
#define rep(i,n) for(int i=0;i<(n);i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define fi first
#define se second
#define pb push_back
#define ALL(a) (a).begin(),(a).end()
using namespace std;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;

signed main(){
    ll n; cin >> n;
    vector<ll> v(n,0);
    ll a[n];
    rep(i,n){
        cin >> a[i];
        a[i]--;
        v[a[i]]++;
    }
    ll ans=0;
    rep(i,n){
        ans+=(v[i]*(v[i]-1))/2;
    }
    rep(i,n){
        cout << ans-(v[a[i]]-1) << endl;
    }
}


Measured memory_bytes: 5760
<?php /*atcoder.php*/

$at = new Atcoder();
$at->main();
unset($at);

class Atcoder{
	private function lineIn(){
		$buf = fgets(STDIN);
		return $this->killNewLine($buf);
	}
          private function killNewLine($buf = null){
                  $buf = str_replace("\r\n", "", $buf);
                  $buf = str_replace("\n", "", $buf);
                  $buf = str_replace("\r", "", $buf);
                  return $buf;
          }


	public function main(){
		$dn = $this->lineIn();
		$dh = $this->lineIn();
		$bn = $this->lineIn();
		$bh = $this->lineIn();
		
		$ans = 0;

		if($dn < $dh){
			$ans += $dn;
		}else{
			$ans += $dh;
		}
		if($bn < $bh){
			$ans += $bn;
		}else{
			$ans += $bh;
		}

		echo $ans;

	}
}
?>


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

double eps = 1e-5;
int main(){
  int N, M;
  cin >> N >> M;
  double T = 100.0 * (N - M) + 1900.0 * M;
  double ans = 0;
  double p = 1.0;
  for(int i = 0; i < M; i++){
    p *= 0.5;
  }
  double f = 1.0;
  for(int i = 0; i < 100000; i++){
    ans += (i+1) * f * p * T;
    f *= (1.0-p);
  }
  cout << (long long)(ans + eps) << endl;
  return 0;
}


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

#define ll long long
#define INF 1<<31-1
#define LNF 9223372036854775807
#define PI 3.14159265358979
#define MIN(x,y) ((x)<(y)?(x):(y))
#define MAX(x,y) ((x)<(y)?(y):(x))
#define FOR(i,a,n) for(i=a;i<n;i++)
#define MOD 1000000007
//#define MOD 998244353
#define NUM 200010
 
void swap(int* a,int* b){int tmp=*a;*a=*b;*b=tmp;}
int abs(int a){if(a<0)return -a;return a;}
int dup(int a,int d){if(a%d==0)return a/d;else return a/d+1;}
int mod(int a,int m){if(a<0)return a%m+m;else return a%m;}

void swapl(ll* a,ll* b){ll tmp=*a;*a=*b;*b=tmp;}
ll absl(ll a){if(a<0)return -a;return a;}
ll dupl(ll a,ll d){if(a%d==0)return a/d;else return a/d+1;}
ll modl(ll a,ll m){if(a<0)return a%m+m;else return a%m;}

ll GCD(ll a,ll b){ll c=1,tmp=MAX(a,b);b=MIN(a,b);a=tmp;while(c!=0){c=a%b;a=b;b=c;}return a;}
ll LCM(ll a,ll b){return a*b/GCD(a,b);}

ll factorial(ll n, ll m) {return n < m ? 1 : n*factorial(n-1, m);}

int upll(const void*a, const void*b){return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;}
int downll(const void*a, const void*b){return*(ll*)a<*(ll*)b?1:*(ll*)a>*(ll*)b?-1:0;}
void sortup(ll*a,int n){qsort(a,n,sizeof(ll),upll);}
void sortdown(ll*a,int n){qsort(a,n,sizeof(ll),downll);}

// ll dp[]

int main(){
  ll n, b;
  ll a[200000];

  if (scanf("%lld", &n) != 1) return 1;

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

  for (int i = 0; i < n-1; i++)
  {
      if(scanf("%lld", &b) != 1) return 1; 
      a[b]++;
  }
  
  for (int i = 1; i <= n; i++)
  {
      printf("%lld ", a[i]);
  }
  

  return 0;
}

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

#define INFINITY 2000000000
#define MAX 500000

int L[MAX/2+2], R[MAX/2+2];
int cnt;

void merge(int A[], int left, int mid, int right) {
    int n1 = mid - left;
    int n2 = right - mid;

    L[n1] = R[n2] = INFINITY;

    for (int i = 0; i < n1; i++) {
        L[i] = A[left + i];
    }

    for (int i = 0; i < n2; i++) {
        R[i] = A[mid + i];
    }

    int i = 0;
    int j = 0;

    for (int k = left; k < right; k++) {
        cnt++;
        if (L[i] <= R[j]) {
            A[k] = L[i];
            i++;
        } else {
            A[k] = R[j];
            j++;
        }
    }
}

void mergeSort(int A[], int left, int right) {
    if (left + 1 < right) {
        int mid = (left + right) / 2;
        mergeSort(A, left, mid);
        mergeSort(A, mid, right);
        merge(A, left, mid, right);
    }
}

int main() {
    int A[MAX], n, l;
    cnt = 0;

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

    mergeSort(A, 0, n);

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

    cout << cnt << endl;

    return 0;
}



Measured memory_bytes: 6972
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b;
    cin>>a>>b;
    if(a==1 && b!=1)
    {
        cout<<"Alice"<<endl;
    }
    else if(a!=1 && b==1)
    {
        cout<<"Bob"<<endl;
    }
    else if(a>b)
    {
        cout<<"Alice"<<endl;

    }
    else if(b>a)
    {
        cout<<"Bob"<<endl;

    }
    else
    {
        cout<<"Draw"<<endl;
    }

  //main();
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define ppb         pop_back
#define    endl        '\n'
#define mii         map<ll int,ll int>
#define msi         map<string,ll int>
#define mis         map<ll int, string>
#define rep(i,a,b)    for(ll int i=a;i<b;i++)
#define repp(i,a,b)    for(ll int i=b-1;i>=a;i--)
#define tr(container,it) for(__typeof__(container.begin()) it = container.begin(); it != container.end(); it++)
#define pii         pair<ll int,ll int>
#define vi          vector<ll int>
#define mpi         map<pair<ll int,ll int>,ll int>
#define vii         vector<pair<ll,pair<ll,ll> > >
#define vs          vector<string>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll)x.size()
#define hell        998244353
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define what_is(x)  cerr << #x << " is " << x << endl;
using namespace std;
#define N  10000
#define time        cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";



void solve(){
	ll n;
	cin>>n;
	vi a(n);
	rep(i,0,n) cin>>a[i];
	mii m;
	ll an=0;
	rep(i,0,n){
		// ll z=(i+1)
		an+=m[i+1-a[i]];
		m[a[i]+i+1]++;
	}
	cout<<an;

}
int main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll TESTS=1,an=1,f;
    // cin>>TESTS;
    while(TESTS--){
        // cout<<"Case #"<<an<<": ";
        an++;
        solve();

    }
    return 0;
}

Measured memory_bytes: 27364
import java.util.*;
public class Main{
	static int w,h;
	static char map[][]=new char[25][25];
	static int dx[] = {0,1,0,-1};
	static int dy[] = {1,0,-1,0};
	static int[][] kioku =new int[25][25];
	static void dfs(int x,int y){
		if(x<0||x>=w||y<0||y>=h)return;
		if(kioku[y][x]!=0||map[y][x]=='#')return;
		kioku[y][x]=1;
		for(int i=0;i<4;i++){
			dfs(x+dx[i],y+dy[i]);
		}
		
	}

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		while(true){
			w=in.nextInt();
			h=in.nextInt();
			if(w+h==0)break;
			int sx=0,sy=0;
			for(int i=0;i<h;i++){
				String test = in.next();
				for(int s=0;s<w;s++){
					kioku[i][s]=0;
					map[i][s]=test.charAt(s);
					if(test.charAt(s)=='@'){
						sx=s;sy=i;
					}
				}
			}
			dfs(sx,sy);
			int result = 0;
			for(int i=0;i<h;i++){
				for(int s=0;s<w;s++){
					result += kioku[i][s];
				}
			}
			System.out.println(result);
		}
	}
}

Measured memory_bytes: 26620
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;

int main(){
    LL k, n;
    cin >> k >> n;
    if(k % 2 == 0){
        cout << k/2;
        for(LL j = 0; j < n-1; j++){
            cout << " " << k;
        }
        cout << endl;
        return 0;
    }
    LL m = (k+1)/2;
    vector<LL> d(n, m);
    LL dec = n/2;
    while(dec > 0){
        dec--;
        if(d[d.size()-1] == 1){
            d.pop_back();
            continue;
        }
        d[d.size()-1]--;
        while(d.size() < n){
            d.push_back(k);
        }
        continue;
    }
    for(int i = 0; i < d.size(); i++){
        cout << d[i] << " ";
    }
    cout << endl;
}


Measured memory_bytes: 4608
#include <bits/stdc++.h>
#define ll long long
#define MODV 1000000007
#define INFLL LLONG_MAX // 9223372036854775807
#define EPS 1e-9
#define rep(i, n) for(ll i=0, i##_len=(ll)(n); i<i##_len; i++)
#define repf(i, n) for(ll i=1, i##_len=(ll)(n+1); i<i##_len; i++)
#define all(v) v.begin(), v.end()
#define endl "\n"
#define vi vector<ll>
#define vvi vector<vector<ll>>
#define Yes() cout << "Yes" << endl
#define YES() cout << "YES" << endl
#define No() cout << "No" << endl
#define NO() cout << "NO" << endl
#define Init() std::ios::sync_with_stdio(false); std::cin.tie(0); std::cout<<fixed<<setprecision(15);
template<class T>bool chmax(T &a, const T &b){ if(a<b){ a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b){ if(b<a){ a=b; return 1; } return 0; }
using namespace std;

int main(){
    Init();
    string s; cin >> s;
    // 26種類の文字を使っていないなら、未使用文字の中で最も小さい文字を末尾に加えれば良い
    if(s.size() < 26){
        map<char, ll> cnt;
        for(char c='a'; c<='z'; c++) cnt[c] = 0;
        rep(i, s.size()) cnt[s[i]]++;
        char add = '!';
        for(auto &p: cnt) if(p.second == 0){ add = p.first; break; }
        cout << s << add << endl;
    }
    // 全ての文字を使っている場合
    else{
        // これ以上小さくすることが可能かどうか判定
        string t = "zyxwvutsrqponmlkjihgfedcba";
        if(s == t) cout << -1 << endl;
        else{
            set<char> ch;
            // 末尾から見ていき、s[i-1]<s[i]となる箇所s[i-1]を
            // 使える文字の中でs[i-1]より大きい最小の文字で上書き
            for(ll i=25; i>0; i--){
                ch.insert(s[i]);
                if(s[i-1]<s[i]){
                    char c = *ch.upper_bound(s[i-1]);
                    cout << s.substr(0, i-1) << c << endl;
                    break;
                }
            }
        }
    }
}

Measured memory_bytes: 3612
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <functional>
#include <bitset>
#include <numeric>
#include <complex>
#include <iomanip>
#include <cassert>
#include <random>


int main() {
    std::vector<long long> a(7);
    for (int i = 0; i < 7; i++) std::cin >> a[i];
    long long ans = 0;
    for (int i : {0, 3, 4}) {
        ans += a[i] - (a[i] & 1);
    }
    ans += a[1];
    if (a[0] > 0 && a[3] > 0 && a[4] > 0) {
        for (int i : {0, 3, 4}) {
            a[i]--;
            a[i] -= a[i] & 1;
        }
        ans = std::max(ans, a[0] + a[1] + a[3] + a[4] + 3);
    }
    std::cout << ans << std::endl;
    return 0;
}

Measured memory_bytes: 256
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}
fn main() {
    input!(n:usize, nums:[i32;n]);
    let mean: i32 = (nums.iter().sum::<i32>() as f64/ nums.len() as f64).round() as i32;
    println!("{}", nums.iter().fold(0, |acc,x| acc + (x-mean).pow(2)));
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  long n, i, ans = 0, sum = 0;
  cin >> n;
  
  vector<long> x(n);
  for(i = 0; i < n; i++){
    cin >> x.at(i);
    sum += x.at(i);
  }
  
  
  long center = (sum / x.size());
  
  /*if((sum % x.size() != 0) && ((sum % x.size())*2 < x.size()))
    center = (sum / x.size()) + 1;
  
  else
    center = (sum / x.size());
  */

  center--;
  vector<long> a(3);
  for(long j = 0; j < 3; j++){
    ans = 0;
    for(i = 0; i < n; i++){
      ans += pow(x.at(i) - center, 2);
    }
    a.at(j) = ans;
    center++;
  }
  long minElement = *std::min_element(a.begin(), a.end());
  
  cout << minElement << endl;
  
}




Measured memory_bytes: 764
n = int(input())
a = list(map(int, input().split()))
q = int(input())
l = [0]*100010
ans = sum(a)

for i in a:
    l[i] += 1

for i in range(q):
    b, c = map(int, input().split())
    ans += (c - b)*l[b]
    l[c] += l[b]
    l[b] = 0
    print(ans)

Measured memory_bytes: 21032
#pragma warning disable
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System;
class E { static void Main() { new J(); } }
class J
{
	//int F => int.Parse(Console.ReadLine());
	int[] G() { return Console.ReadLine().Split().Select(_ => int.Parse(_)).ToArray(); }
	public J()
	{
		//Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });
		var I = G();
		Console.WriteLine(GCD(I[0], I[1]));
		//Console.Out.Flush();
	}
	int GCD(int n, int m)
	{
		var a = Math.Abs(n);
		var b = Math.Abs(m);
		if (a < b) { var c = a; a = b; b = c; }
		while (b > 0)
		{
			var c = a % b;
			a = b;
			b = c;
		}
		return a;
	}
}

Measured memory_bytes: 9448
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        while (true) {
            int m = scan.nextInt(), f = scan.nextInt(), r = scan.nextInt();
            if (m == -1 && f == -1 && r == -1) break;

            if (m == -1 || f == -1) {
                System.out.println("F");
            } else if ((m + f) >= 80) {
                System.out.println("A");
            } else if ((m + f) >= 65 && (m + f) < 80) {
                System.out.println("B");
            } else if (((m + f) >= 50 && (m + f) < 65) || ((m + f) >= 30 && (m + f) < 50 && (50 <= r))) {
                System.out.println("C");
            } else if ((m + f) >= 30 && (m + f) < 50 && !(50 <= r)) {
                System.out.println("D");
            } else {
                System.out.println("F");
            }
        }


    }
}

Measured memory_bytes: 26088
#include <iostream>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <vector>
#include <queue>
#include <cmath>
#include <bitset>
#include <complex>
#include <functional>
#include <numeric>
#include <iomanip>

// output
#define SPBR(w, n) std::cout<<(w + 1 == n ? '\n' : ' ');
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
// utility
#define ALL(i) (i).begin(), (i).end()
#define FOR(i, a, n) for(int i=(a);i<(n);++i)
#define RFOR(i, a, n) for(int i=(n)-1;i>=(a);--i)
#define REP(i, n) for(int i=0;i<int(n);++i)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define IN(a, x, b) (a<=x && x<b)
#define OUT(a, x, b) (x<a || b<=x)
template<class T> inline T chmax(T & a, const T b) { return a = (a < b) ? b : a; }
template<class T> inline T chmin(T& a, const T b) { return a = (a > b) ? b : a; }

// type/const
#define int ll
using ll = long long;
using ull = unsigned long long;
using ld = long double;
const int MOD = 1000000007;
/* const int MOD = 998244353; */
const int INF = 1e18;
const double PI = acos(-1);

using namespace std;
struct INIT { INIT(){
  cin.tie(0); ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
}}INIT;


int f(int N, int a[], int b[]){
  vector<int> dp(N+1, -INF);
  dp[0] = 0;

  REP(i, N+1) REP(j, 3){
    if(i != 0) chmax(dp[i], dp[i-1]);
    if(i+a[j] <= N) chmax(dp[i+a[j]], dp[i]+b[j]-a[j]);
  }

  return dp[N]+N;
}

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

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

  int ret = f(N, a, b);

  cout << f(ret, b, a) << "\n";

  return 0;
}

Measured memory_bytes: 195584
# -*- coding: utf-8 -*-

hills_list = []
while len(hills_list) != 10:
    hills = raw_input()
    if (10000 >= int(hills)) and (int(hills) >= 0):
        hills_list.append(int(hills))
hills_list.sort()
print hills_list[-1]
print hills_list[-2]
print hills_list[-3]

Measured memory_bytes: 6444
#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll a[100005];
ll b[100005];
int main()
{
    ll n, i, temp1=0, temp2=0, ans=0;
    cin>>n;
    for(i=0;i<n;i++)
    {
        cin>>a[i];
    }
    b[1]=abs(a[1]-a[0]);
    for(i=2;i<n;i++)
    {
        temp1=abs(a[i]-a[i-1]);
        temp2=abs(a[i]-a[i-2]);
        b[i]=min((b[i-1]+temp1),(b[i-2]+temp2));
    }
    cout<<b[i-1]<<endl;
}


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

using namespace std;

int main () {
	
	ios :: sync_with_stdio (0); cin.tie(NULL);
	
	int n;
	string s; 

	cin >> n >> s;

	int ans = 1;
	
	for (int i = 1; i < n; ++i) {
		if (s[i] == s[i - 1])
			continue;
		++ans;
	}	

	cout << ans << '\n';





	return 0;

}

Measured memory_bytes: 512
#include "bits/stdc++.h"
#include "ext/pb_ds/tree_policy.hpp"
#include "ext/pb_ds/assoc_container.hpp"
using namespace std;
////////////// Prewritten code follows. Look down for solution. ////////////////
#define x first
#define y second
#define LEN(x) ((int)(x).size())
#define ALL(x) x.begin(), x.end()
using ll = long long;
using llu = long long unsigned;
using ld = long double;
using pii = pair<int, int>;
using vi = vector<int>;
using vpii = vector<pii>;

const ld EPS = 1e-9;
inline int cmp(ld x, ld y = 0, ld tol = EPS) {
	return (x <= y + tol) ? (x + tol < y) ? -1 : 0 : 1;
}

const int MOD = 1;
inline int mod(ll x, int m = MOD) {
	return (int)(((x%m) + m)%m);
}

template<typename T, typename M = __gnu_pbds::null_type>
using ordered_set = __gnu_pbds::tree<T, M, less<T>, __gnu_pbds::rb_tree_tag, __gnu_pbds::tree_order_statistics_node_update>;

////////////////////////// Solution starts below. //////////////////////////////

ll pow5(ll x) {
	ll ret = 1;
	for(int i = 0; i < 5; i++) ret *= x;
	return ret;
}


int main () {
	// ios_base::sync_with_stdio(false);
    // cin.tie(NULL);
    // cout.precision(10);
	ll x;
	cin >> x;
	set<ll> st;
	for(int i = 0; i < 1000; i++)
		for(int j = 0; j <= i; j++) {
			if(pow5(i)-pow5(j) == x) {
				cout << i << ' ' << j << '\n';
				exit(0);
			} else if (pow5(i)+pow5(j) == x) {
				cout << i << ' ' << -j << '\n';
				exit(0);
			}
			// if(pow5(i)-pow5(j) < 2e9)
			// // 	printf("i = %3d, j = %3d, %lld\n", i, j, pow5(i)-pow5(j));
			// // st.insert(pow5(i)-pow5(j));
			// // // printf("-------------------------------\n");
			// // if(pow5(i)+pow5(j) < 2e9)
			// // 	printf("|i = %d, j = %d, %lld\n", i, j, pow5(i)+pow5(j));

		}

	// for(ll v : st)
	// 	printf("%lld\n", v);

	return 0;
}


Measured memory_bytes: 3572
A, B, C, D = map(int, input().split())

flag = False
t = True
while True:
    if t:
        C -= B
        t = False
        if C <= 0:
            flag = True
            break
    else:
        A -= D
        t = True
        if A <= 0:
            break
print('Yes' if flag else 'No')


Measured memory_bytes: 9156
from math import cos
from math import radians

a, b, h, m = map(int, input().split())

dg_tmp = abs(30*h - 11*m/2)
dg = min(dg_tmp, 360-dg_tmp)
r_dg = radians(dg)

c = a**2 + b**2 - 2*a*b*cos(r_dg)

print(c**(1/2))

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

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

    const int MAX_ELEMENTS = 2;
    vector <int> frequency(MAX_ELEMENTS, 0);
    for(int i = 0; i < S.size(); i++)
        frequency[S[i] - '0']++;

    int minimum_frequency = min(frequency[0], frequency[1]);
    int answer = 2*minimum_frequency;

    cout << answer;
    return 0;
}


Measured memory_bytes: 512
#include <cstdio>
#include <algorithm>
#include <vector>
#define repi(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,a) repi(i,0,a)
#define all(a) (a).begin(), (a).end()

constexpr int MAX_N = 1010;

using ll = long long;

ll N, M;
ll P[MAX_N];

int main()
{
  while( scanf( "%lld%lld", &N, &M ), N|M )
  {
    rep( i, N )
      scanf( "%lld", P+i+1 );

    ++N;

    std::vector<ll> S;

    rep( i, N ) rep( j, N )
      S.emplace_back( P[i]+P[j] );

    std::sort( all(S) );
    S.erase( std::unique( all(S) ), S.end() );

    ll ans = 0;

    int q;
    rep( i, S.size() )
    {
      if( S[i] > M )
        break;

      q = i;
    }

    //rep( p, S.size() )
      //printf( "%lld%c", S[p], p==S.size()-1?'\n':' ' );

    rep( p, S.size() ) if( p <= q )
    {
      ll res = S[p]+S[q];

      while( res > M && p <= q )
        --q, res = S[p]+S[q];  
        
      if( p > q )
        break;

      if( res <= M )
        ans = std::max( ans, res );

      //printf( "(%lld,%lld)\n", S[p], S[q] );
    }

    printf( "%lld\n", ans );
  }
  
  return 0;
}


Measured memory_bytes: 18512
#include <bits/stdc++.h>
#define DEBUG(x) cout << #x << " is " << (x) << endl;
using namespace std;

int main() {
	string n;
	cin >> n;
	reverse(n.begin(), n.end());
	int size = n.size();
	int a[size];
	for(int i = 0;i < size;i++) a[i] = n[i] - '0';
	int flow = 0, ans = 0;
	for(int i = 0;i < size;i++) {
		if(flow == 1) {
			if(a[i] == 9) {
                a[i] = 0;
                continue;
			}else{
				a[i]++;
				flow = 0;
			}
		}
		if((a[i] > 5)
			|| (i < size - 1 && a[i] == 5 && a[i + 1] >= 5)) {
			ans += 10 - a[i];
         	 a[i] = 0;
			flow = 1;
		}
	}
  ans += flow;
	for(int i = 0;i < size;i++){
		ans += a[i];
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 5252
#include <cstdio>
#include <iostream>
#include <vector>
#include <map>
#include <cmath>
#include <algorithm>

using namespace std;

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

    vector<vector<pair<int, int> > > axy;
    for(int i = 0; i < n; i++){
        vector<pair<int, int> > xy;
        int a;
        cin >>a;
        for(int j = 0; j < a; j++){
            int x,y;
            cin >>x >>y;
            xy.push_back(make_pair(x, y));
        }
        axy.push_back(xy);
    }

    int maxTrue = 0;
    int fin = (int)pow(2, n);


    for(int l = 0; l < fin; l++){
        bool isOK = true;
        int trueCt = 0;
        for(int i = 0; i < n && isOK; i++){
            if((1<<i) & l){
                trueCt++;
                for(int j = 0; j < axy[i].size() && isOK; j++){
                    if((1<<(axy[i][j].first-1) & l) > 0 !=  axy[i][j].second>0){
                        isOK = false;
                    }
                }
            }
        }
        if(isOK){
            maxTrue = max(maxTrue,trueCt);
        }
    }

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

    return 0;
}

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

#define fast ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define ll long long
#define ldb long double 
#define db double
#define str string

#define fr first
#define se second
#define lb lower_bound 
#define ub upper_bound 
#define pb push_back
#define mp make_pair

#define pi pair<int,int>
#define pll pair<ll,ll>
#define pdb pair<db,db>
#define pldb pair<ldb,ldb>

#define vi vector<int>
#define vll vector<ll>
#define vdb vector<db>
#define vldb vector<ldb>
#define vpi vector< pi >
#define vpll vector< pll >

#define mi map<int,int>
#define mll map<ll,ll>
#define mdb map<db,db>
#define mldb map<ldb,ldb>


#define forr(a,b) for (int i = (a); i < (b); ++i)
#define rrof(a,b) for (int i = (b)-1; i >= (a); --i)

#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)

const int MOD = 1e9+7;
const int MX = 2e5+5;
const ll INF = 1e18; 
const ldb PI = 4*atan((ldb)1);

ll power(ll a,ll n)
{
 ll res=1;
 while(n)
{
 if(n%2)
  res*=a;
  a*=a;
  n/=2;
}
return res;
}

ll abst(ll a)
{
 return ((a<0)?(-1*a):(a));
}

int main()
{
    char ch;
    cin>>ch;
    ch++;
    cout<<ch<<"\n";
    return 0;
}

Measured memory_bytes: 256
function main(input) {
  input=input.trim();
  const S = input.split(" ")[0];

  var arr=[]
  for(var i=0; i<S.length-2; i++){
    var sa=parseInt(S.slice(i,i+3) , 10)
    arr.push(Math.abs(753-sa))
  }
  console.log(Math.min.apply(null, arr));
  

}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 7372
#include<bits/stdc++.h>
using namespace std;
#define watch(x) cout<<(#x)<<" is "<<(x)<<endl;
#define mod 1000000007
#define pb push_back

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

	int n = 1000001;
	int a[n];
	for(auto &it:a) it=1;
	a[0]=0;
	a[1]=0;

	for(int i=2;i<=sqrt(n);i++)
	{
		if(a[i] == 1)
		{
			for(int j=i*i;j<n;j+=i)
			{
				if(j%i == 0 ) a[j]=0;
			}
		}
		
	}

	set<int> s;
	for(int i=2;i<n;i++)
	{
		if(a[i]) s.insert(i); 
	}

	
	int x;
	cin>>x;
	cout<<*s.lower_bound(x)<<endl;
} 

Measured memory_bytes: 7808
A, V = map(int, input().split())
B, W = map(int, input().split())
T = int(input())


if V == W:
    print("NO")
    exit()

if A < B:
    X = (A - B)/(W - V)
    if 0 < X <= T:
        print("YES")
        exit()
else:
    X = (A - B)/(V - W)
    if 0 < X <= T:
        print("YES")
        exit()

print("NO")

Measured memory_bytes: 9208
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>

using namespace std;

#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,N) for(long long i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define fi first
#define se second

#define PI acos(-1.0)
#define INF 1000000007

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<double, double> PD;
typedef pair<string, ll> PS;
typedef vector<ll> V;

int n, sum = 0;

int main(){
	while (cin >> n&&n){
		sum = 0;
		n = 1000 - n;
		sum += n / 500;
		n %= 500;
		sum += n / 100;
		n %= 100;
		sum += n / 50;
		n %= 50;
		sum += n / 10;
		n %= 10;
		sum += n / 5;
		n %= 5;
		sum += n;
		cout << sum << endl;
	}
}

Measured memory_bytes: 1160
#import bisect,collections,copy,heapq,itertools,math,numpy,string
#from operator import itemgetter
import sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())
K,N = LI()
A = LI()
path_len = [0] * N
maxpath_ind = 0
maxpath_num = 0

# i -> i+1 への距離をiに保存
for i in range(N):
  if i+1==N:
    tmp = K-A[i]+A[0]
  else:
    tmp = A[i+1] - A[i]
  path_len[i] = tmp
  if tmp > maxpath_num:
    maxpath_num = tmp
    maxpath_ind = i

sum = 0
for i in range(N):
  if i != maxpath_ind:
    sum+=path_len[i]

print(sum)

Measured memory_bytes: 26444
import sys, itertools

[a, b, c, d] = sys.stdin.readline().rstrip()

ops = ['+', '-']

for exp in ['%s%s%s%s%s%s%s' % (a, op1, b, op2, c, op3, d) for op1, op2, op3 in list(itertools.product(ops, ops, ops))]:
    if eval(exp) == 7:
        print '%s=7' % exp
        break


Measured memory_bytes: 2692
N = int(input())
station = [[int(i) for i in input().split()] for j in range(N-1)]

for i in range(N):
    time = 0
    for j in range(i, N-1):
        c, s, f = station[j]
        if time < s:
            time = s
        elif time % f == 0:
            pass
        else:
            time += f - (time % f)
        time += c
    print(time)


Measured memory_bytes: 3188
#include<bits/stdc++.h>
using namespace std;
#define int long long
int32_t main(){
    int n;
    cin>>n;
    int a[n+1];
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    sort(a,a+n);
    int c=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(a[i]+a[j]>a[k]&&a[i]!=a[j]&&a[i]!=a[k]&&a[j]!=a[k])
            {
             c++;
            }
            }
            }

          }
    cout<<c<<endl;
}



Measured memory_bytes: 3592
#include <bits/stdc++.h>
#define endl '\n'
#define ll long long
#define double long double
using namespace std;

const ll inf = 10000000000000000;
ll t;

int main() {
    //freopen("input.txt", "r", stdin);
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cin >> t;
    if (t >= 30)
        cout << "Yes";
    else
        cout << "No";
    return 0;
}


Measured memory_bytes: 3544
#include <bits/stdc++.h>
#define ll long long
#define rep(i, n) for(ll i=0; i<n; i++)
#define repr(i, s, e) for(ll i=s; i>=e; i--)
#define reps(i, s, e) for(ll i=s; i<=e; i++)
#define inf 1e18
#define all(v) v.begin(),v.end()
#define vsort(v) sort(v.begin(), v.end())
#define vsortr(v) sort(v.begin(), v.end(), greater<ll>())
#define sz(x) x.size()
#define ceil(a, b) (a+b-1)/b
#define ok cout << "ok" << endl;
#define sp << " " <<
using namespace std;
template<typename T> inline bool chmax(T &a, T b){ if(a<b){ a=b; return true; } return false; }
template<typename T> inline bool chmin(T &a, T b){ if(b<a){ a=b; return true; } return false; }
template<typename T> T gcd(T a, T b){ if(b==0) return a; return gcd(b, a%b); }
template<typename T> T lcm(T a, T b){ return a*(b/gcd(a, b)); }
template<typename T> T keta(T num){ T k=0; while(num>0){ num/=10; k++; } return k; }
template<typename T> void vdebug(vector<T> v){ cout << "vdebug" << endl; for(auto vv : v){ cout << vv << " "; } cout << endl; }
template<typename T> void adebug(T arr[], ll n){ cout << "adebug" << endl; reps(i, 0, n){ cout << arr[i] << " "; } cout << endl; }
template<typename T1, typename T2> void mdebug(map<T1, T2> mp){ cout << "mdebug" << endl; for(auto const& m : mp){ cout << m.first sp m.second << endl; }}
void ans(bool b){ if(b) cout << "Yes" << endl; else cout << "No" << endl; }
void ans2(bool b){ if(b) cout << "YES" << endl; else cout << "NO" << endl; }
int dx[] = {1, -1, 0, 0, 1, -1, 1, -1};
int dy[] = {0, 0, 1, -1, 1, -1, -1, 1};


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

    int n;
    string s;
    cin >> n >> s;

    string res = s;
    int slen = s.length();
    int rcnt=0, lcnt=0;
    reps(i, 0, slen-1){
        if(s[i] == '(') lcnt++;
        else rcnt++;
        if(rcnt > lcnt){
            res = '(' + res;
            lcnt++;
        }
    }

    //cout << res << endl;

    rcnt=0; lcnt=0;
    repr(i, slen-1, 0){
        if(s[i] == '(') lcnt++;
        else rcnt++;
        if(rcnt < lcnt){
            res = res + ')';
            rcnt++;
        }
    }

    cout << res << endl;

    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <list>
#include <ctime>
#include <sstream>
#include <queue>
#include <stack>
#include <bitset>
#include <numeric>
#include <cassert>
using namespace std;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef long long ll;
#define FOR(x, b, e) for(int x=(b); x<=(e); ++x)
#define FORD(x, b, e) for(int x=((int)(b))-1; x>=(e); --x)
#define REP(x, n) for(int x=0; x<(n); ++x)
#define ALL(c) c.begin(),c.end()
#define sz(x) ((int)((x).size()))
#define pb push_back
#define st first
#define nd second
#define mp(x,y) make_pair(x,y)
typedef short int sint;

#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it) {
	*this << ((it != d.b) ? ", " : "") << *it;
  }
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

const int Q = 50;
int n ,m,qq;
vi q[Q];
vi a;
int res = 0;

int check() {
	int r = 0;
	REP(i, qq) {
		if (a[q[i][1]] - a[q[i][0]] == q[i][2]) {
			r += q[i][3];
		}
	}
	return r;
}

void generuj(int poz, int ost) {
	if (poz == n) {
		res = max(res, check());
		return;
	}
	FOR(i, ost, m) {
		a[poz] = i;
		generuj(poz + 1, i);
	}
}

int main() {
	ios_base::sync_with_stdio(false);
	cin >> n >> m >> qq;
	REP(i, qq) {
		q[i].resize(4);
		REP(j, 4) {
			cin >> q[i][j];
		}
		--q[i][0];
		--q[i][1];
	}
	a.assign(n, 0);
	generuj(0, 1);
	printf("%d\n", res);
}

Measured memory_bytes: 3776