akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;

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

    string s;
    cin >> s;
    int n = s.size() + 1;
    int arr[n] = {};
    long long sum = 0;

    for (int i = 0; i < n - 1; i++) {
        int cur = 0;

        while (s[i] == '<')
            arr[i++] = cur++;
        arr[i] = cur;
    }

    for (int i = n - 1; i >= 0; i--)
        if (s[i] == '>')
            arr[i] = max(arr[i], arr[i + 1] + 1);

    for (int x : arr)
        sum += x;

    cout << sum << '\n';

    return 0;
}

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

int main()
{
    int K;
    string S;
    cin >> K >> S;
    if(S.size()<=K)
    {
        cout << S << endl;
    }else
    {
        for (int i = 0; i < K; i++)
        {
            cout << S.at(i);
        }
        cout << "..." << endl;
    }
}


Measured memory_bytes: 3628
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T> V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> > Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T> mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }

/*
 <url:>
 問題文============================================================
 =================================================================
 解説=============================================================
 ================================================================
 */

void A(){
    ll N,K; cin >> N >> K;
    vector<ll> A(N); for(auto& in:A) cin >> in;
    vector<ll> x(200001);
    set<ll> s;
    for(int i = 0; i < N;i++){
        x[A[i]]++;
        s.insert(A[i]);
    }
    sort(x.begin(),x.end());
    ll ans = 0;
    for(int i = 0; i <= 200000;i++){
        if(s.size() <= K) break;
        if(x[i] == 0) continue;
        ans += x[i];
        s.erase(*s.begin());
    }
    cout << ans << endl;
}

void B(){
    ll N; cin >> N;
    vector<ll> a(N); for(auto& in:a) cin >> in;
    map<ll,ll> mp;
    for(int i = 0; i < N;i++) mp[a[i]]++;
    ll ans = 0;
    for(auto p:mp){
        if(p.first < p.second) ans += (p.second-p.first);
        if(p.second < p.first) ans += p.second;
    }
    cout << ans << endl;
}

void C(){
    ll X,Y; cin >> X >> Y;
    ll ans = 0;
    while(X <= Y){
        ans++;
        X*=2;
    }
    cout << ans << endl;
}
int main(void) {
    cin.tie(0); ios_base::sync_with_stdio(false);
    //A();
    //B();
    C();
    return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python3
import sys
try:
    from typing import List
except ImportError:
    pass


def solve(N: int, A: "List[int]"):
    r = 0
    r += abs(A[0])
    for i in range(N - 1):
        r += abs(A[i] - A[i + 1])
    r += abs(A[-1])
    for i in range(N):
        pp = (0 if i == 0 else A[i - 1])
        np = (0 if i == N - 1 else A[i + 1])
        print(r - abs(A[i] - pp) - abs(A[i] - np) + abs(pp - np))


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, A)


if __name__ == '__main__':
    main()


Measured memory_bytes: 14884
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); ++i)
ll mod = 1000000007;
ll pow(ll b, ll e) {
  if(e == 0) return 1LL;
  if(e % 2 == 1) return pow(b, e - 1) * b % mod;
  ll m = pow(b, e >> 1);
  return m * m % mod;
}
ll inv(ll a) { return pow(a, mod - 2); }
int main(void) {
  int n, k;
  cin >> n >> k;
  vector<ll> fact(n + 1);
  fact[0] = 1LL;
  for(ll r = 1; r <= n; r++) {
    fact[r] = fact[r - 1] * r % mod;
  }
  vector<ll> ans(k + 1);
  vector<ll> sum_ans(k + 1);
  ans[0] = 0;
  sum_ans[0] = 0;
  for(ll i = 1; i <= k; i++) {
    ll a = n - k + 1;
    if(a < i) continue;
    ans[i] = fact[a] * inv(fact[i]) % mod;
    ans[i] = ans[i] * inv(fact[a - i]) % mod;

    ans[i] = ans[i] * fact[k - 1] % mod;
    ans[i] = ans[i] * inv(fact[i - 1]) % mod;
    ans[i] = ans[i] * inv(fact[k - i]) % mod;
  }
  for(int i = 1; i <= k; i++) printf("%lld\n", ans[i]);
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
typedef vector<int> vec1;
typedef vector<string> vec2;
typedef vector<double> vec3;

int main() {

  int n, t;
  cin >> n >> t;
  vec1 c(n);
  vec1 b(n);
  for(int i = 0; i < n; i++) {
    cin >> c.at(i) >> b.at(i);
  }
  int ans = 100000;
  for(int i = 0; i < n; i++) {
    if(c.at(i) < ans && b.at(i) <= t) {
      ans = c.at(i);
    }
  }
  if(ans != 100000) {
    cout << ans << endl;
    return 0;
  } else {
    cout << "TLE" << endl;
    return 0;
  }
}

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

#include <fstream>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

typedef long long ll;
typedef long double ld;
using namespace std;
#define endl "\n"
#define FIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
using namespace __gnu_pbds;
const int N=100+5, mxN=(1<<22);
int mod=1e9+7;
int n;
ll ans=-1e18;
int arr[N][11],cost[N][12];
void brutefor(int i, int mask)
{
    if(i==10)
    {
        if(mask==0)
            return;
  ll localans=0;
    for(int x=0;x<n;x++)
    {

        int co=0;
        for(int j=0;j<10;j++)
        {
            if(arr[x][j]==1&&((mask>>j)&1)==1)
            {
                co++;
            }

        }
        localans+=cost[x][co];

    }
    ans=max(ans,localans);



    }
    else
    {
        brutefor(i+1,mask);
        mask=(mask|(1<<i));
        brutefor(i+1,mask);



    }


}

int main()
{
    FIO
    cin>>n;
    for(int i=0;i<n;i++)
    {
        for(int j=0;j<10;j++)
        {
            cin>>arr[i][j];
        }

    }

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

    }
     brutefor(0,0);
     cout<<ans;


    return 0;

}





Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define rep(X,N) for(ll X = 0; X < (N); X++)
#define PI (acos(-1.0))
#define pback push_back
#define mpair make_pair
#define divceil(A, B) ((A + (B - 1)) / B)
#define MODN 1000000007
#define All(V) (V).begin(),(V).end()
#define CERR if(false) cerr

using namespace std;

int main(){

    int a1,a2,a3;
    cin >> a1 >> a2 >> a3;

    if(a1 + a2 + a3 > 21){
        cout << "bust" << endl;
    }else{
        cout << "win" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
import bisect
import sys
input = sys.stdin.readline
N = int(input())
list = list(map(int, input().split()))
list.sort()

score = 0

for i in range (N-2):
    for j in range (i+1, N-1):
        index = bisect.bisect_left(list, list[i] + list[j]) - j - 1
        score += index

print (score)


Measured memory_bytes: 44840
def is_prime?(num)
    $primes = []
    return true if num == 2
    return false if num % 2 == 0
    $primes.each do |n|
        return false if num % n == 0
    end
    $primes << num
    return true
end

n = gets.chomp.to_i
nn = n
sub_n = 2
prime_factors = []
while n > 1
	if n % sub_n == 0
      n /= sub_n
	  prime_factors << sub_n
	  next
	else
      break if sub_n * sub_n > n
      if sub_n == 2
        sub_n += 1
      else
        sub_n += 2
        while !is_prime?(sub_n)
          sub_n += 2
        end
      end
	end
end																								 
str = "#{nn}:"
prime_factors.each do |k|
	str += " #{k}"
end
if n > 1
  str << " #{n}"
end
puts str

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

int n;
vector<int> a(100001);
int main()
{
	cin >> n;

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

	int ans = 0, cnt = 0;
	for (int i = 0; i < 100000; ++i){
		if (a[i] == 0) continue;

		if (a[i] & 1) ans++;
		else cnt++;
	}
	
	ans += cnt / 2 * 2;
	cout << ans << endl;
}


Measured memory_bytes: 640
if __name__ == '__main__':
    n, d = (int(x) for x in input().split())
    count = 0
    for _ in range(n):
        x, y = (int(x) for x in input().split())
        dist = (x * x + y * y) ** 0.5
        if dist <= d:
            count += 1
    print(count)


Measured memory_bytes: 9632
import java.util.Arrays;
import java.util.Scanner;

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

    int[] array = new int[N];
    int[] array2 = new int[N];
    int max = 0;
    int tmp;

    for (int i = 0; i < N; i++) {
      tmp = scan.nextInt();
      array[i] = tmp;
      array2[i] = tmp;
      if (max < tmp) {
        max = tmp;
      }
    }
    Arrays.sort(array2);

    for (int i = 0; i < N; i++) {
      if (array[i] < max) {
        System.out.println(max);
        continue;
      }
      System.out.println(array2[N - 2]);
    }
  }
}


Measured memory_bytes: 97812
import java.util.ArrayList;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String strIn = "";
		ArrayList<Integer> list = new ArrayList<Integer>();
		int intSum = 0;
		while(true){
			strIn = scan.nextLine();
			if("0".equals(strIn)){
				break;
			}else{
				intSum = 0;
				for(int i = 0; i < strIn.length(); i++){
					intSum += Character.getNumericValue(strIn.charAt(i));
				}
				list.add(intSum);
			}
		}
		for(int i = 0; i < list.size(); i++){
			System.out.println(list.get(i));
		}
		scan.close();
	}
}

Measured memory_bytes: 17476
n,m=map(int, input().split())
aka = [0]*(n+1)
siroaka = [1]*(n+1)
aka[1] = 1
for i in range(m):
    x,y=map(int, input().split())
    siroaka[x]-=1
    siroaka[y]+=1
    if(aka[x]):
        aka[y]=1
    if(siroaka[x]==0):
        aka[x]=0

print(sum(aka))


Measured memory_bytes: 10284
import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;
import java.util.Comparator;
import java.util.HashMap;
import java.util.Map;
import java.util.NoSuchElementException;

class Main {
	public static void main(String[] args) throws Exception {
		new Main().run();
	}
	
	void run() {
		Scanner sc=new Scanner();
		int N=sc.nextInt();
		int[] A=new int[N];
		boolean ok=true;
		for(int i=0;i<N;++i) {
			A[i]=sc.nextInt();
			ok&=A[i]%2==1||(A[i]%3==0||A[i]%5==0);
		}
		System.out.println(ok?"APPROVED":"DENIED");
	}
	
	static void tr(Object... objects) {
		System.out.println(Arrays.deepToString(objects));
	}

}

class Scanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
    private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
    public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    public long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true){
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return minus ? -n : n;
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
        return (int) nl;
    }
    public double nextDouble() { return Double.parseDouble(next());}
}

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

int main() {
    int N, M, sum = 0;
    cin >> N >> M;
    rep(i, M) {
        int tmp;
        cin >> tmp;
        sum += tmp;
    }

    if (N - sum < 0) {
        cout << -1 << endl;
    } else {
        cout << N - sum << endl;
    }
    return 0;
}

Measured memory_bytes: 3624
#include <iostream>
#include <utility>
#include <map>
#include <vector>
#include <algorithm>
#include <queue>
#include <math.h>
#include <stack>
#include <set>
#include <deque>
#include <cmath>
#include <cassert>

using namespace std;
typedef long long ll;
ll mod = 1e9+7;
#define rep(i,n) for(int i = 0; i < (n); ++i)

int main() {
    int n, m;
    cin >> n >> m;
    vector<pair<ll, int>> d(n);
    rep(i, n) {
        int cost, drink;
        cin >> cost >> drink;
        d[i] = make_pair(cost, drink);
    }
    sort(d.begin(), d.end());
    //for (auto p: d) {
    //    cout << p.first << " " << p.second << endl;
    //}
    ll ans = 0;
    ll now_num = 0;
    //cout << "test" << endl;
    rep(i, n) {
        if (now_num + d[i].second >= m) {
            ans += d[i].first * (m - now_num);
            break;
        }
        else {
            ans += d[i].first * d[i].second;
            now_num += d[i].second;
        }
        //cout << ans << " " << now_num << endl;
    }
    cout << ans << endl;
    return 0;
}


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

int main(void) {

	string N;
	cin >> N;
	if ((N[0]==N[1] && N[0]==N[2])
	 || (N[1]==N[2] && N[1]==N[3])) {
		cout << "Yes" << endl;
	} else {
		cout << "No" << endl;
	}
	return 0;
}


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

struct edge{ int to,cap,rev; };

int V,E;
vector<edge> G[100];
bool used[100];

void add_edge(int from,int to,int cap){
  G[from].push_back((edge){to,cap,G[to].size()});
  G[to].push_back((edge){from,0,G[from].size()-1});
}

int dfs(int v,int t,int f){
  if(v==t)return f;
  used[v]=true;
  for(int i=0;i<G[v].size();i++){
    edge &e=G[v][i];
    if(!used[e.to] && e.cap>0){
      int d=dfs(e.to,t,min(f,e.cap));
      if(d>0){
	e.cap-=d;
	G[e.to][e.rev].cap+=d;
	return d;
      }
    }
  }
  return 0;
}

int max_flow(int s,int t){
  int flow=0;
  for(;;){
    fill(used,used+100,0);
    int f=dfs(s,t,inf);
    if(f==0)return flow;
    flow+=f;
  }
}

int main()
{
  int a,b,c;
  cin>>V>>E;
  for(int i=0;i<E;i++){
    cin>>a>>b>>c;
    add_edge(a,b,c);
  }
  cout<<max_flow(0,V-1)<<endl;
  return 0;
}

Measured memory_bytes: 1264
#include<iostream>
#include<deque>
using namespace std;
int n;
long c,h[2<<17];
long dp[2<<17];
long f(int i,int H)
{
	return dp[i]+h[i]*h[i]-2*H*h[i];
}
bool check(int x,int y,int z)
{
	long a1=-h[x],b1=dp[x]+h[x]*h[x],a2=-h[y],b2=dp[y]+h[y]*h[y],a3=-h[z],b3=dp[z]+h[z]*h[z];
	return (a1-a2)*(b2-b3)>=(b1-b2)*(a2-a3);
}
main()
{
	cin>>n>>c;
	for(int i=0;i<n;i++)cin>>h[i];
	deque<int>P;
	for(int i=1;i<n;i++)
	{
		while(P.size()>1&&check(P[P.size()-2],P[P.size()-1],i-1))P.pop_back();
		P.push_back(i-1);
		while(P.size()>1&&f(P[0],h[i])>=f(P[1],h[i]))P.pop_front();
		dp[i]=h[i]*h[i]+c+f(P[0],h[i]);
	}
	cout<<dp[n-1]<<endl;
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

Measured memory_bytes: 4352
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
#define int long long
#define ull unsigned long long
#define ld long double
#define rep(a) rep1(i,a)
#define rep1(i,a) rep2(i,0,a)
#define rep2(i,b,a) for(int i=(b); i<((int)(a)); i++)
#define rep3(i,b,a) for(int i=(b); i>=((int)(a)); i--)
#define all(a) a.begin(),a.end()
#define pii pair<int,int>
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define sz(a) ((int)a.size())
#define pow2(x) (1ll<<(x))
#define ceiling(a,b) (((a)+(b)-1)/(b))
#define print0(a) cout << (a) << ' '
#define print1(a) cout << (a) << '\n'
#define print2(a,b) cout << (a) << ' ',print1(b)
#define print3(a,b,c) cout << (a) << ' ',print2(b,c)
#define print4(a,b,c,d) cout << (a) << ' ',print3(b,c,d)
#ifdef i_am_noob
#define debug(a) print2(#a,a)
#else
#define debug(a) 
#endif
#define ordered_set tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>
 
using namespace std;
using namespace __gnu_pbds;
 
const int Mod=1000000007,Mod2=998244353;
const int MOD=Mod2;
 
inline int add(int a, int b){return (a+b>=MOD?a+b-MOD:a+b);}
inline int sub(int a, int b){return (a+MOD-b>=MOD?a-b:a+MOD-b);}
int Pow(int a, int b){
	if(!b) return 1;
	int tmp=Pow(a*a%MOD,b>>1);
	return (b&1?tmp*a%MOD:tmp);
}
inline int inverse(int n){return Pow(n,MOD-2);}
 
const int maxn=10000005;
//i_am_noob
int n,ans=0,fact[maxn],invfact[maxn];

signed main(){
	ios_base::sync_with_stdio(0),cin.tie(0);
	fact[0]=1;
	rep(maxn-1) fact[i+1]=fact[i]*(i+1)%MOD;
	rep(maxn) invfact[i]=inverse(fact[i]);
	cin >> n;
	ans=Pow(3,n);
	rep2(i,n/2+1,n+1) ans=sub(ans,fact[n]*invfact[i]%MOD*invfact[n-i]%MOD*Pow(2,n-i)%MOD*2%MOD);
	print1(ans);
	return 0;
}


Measured memory_bytes: 156544
#include <bits/stdc++.h> //g++-9で実行（gcc version 9.3.0），g++だとデフォルトのclang

using namespace std;

//#define int long long                         //intでオーバフローした時の切り替え用
#define OUT(x) std::cout << x << std::endl
#define DEBUG(x) cerr << #x << ": " << x << endl //エラー出力として変数名と変数の中身表示
#define DEBUG_VEC(v)                   \
    cerr << #v << ":";                 \
    for (int i = 0; i < v.size(); i++) \
        cerr << " " << v[i];           \
    cerr << endl;
#define DEBUG_MAT(v)                          \
    cerr << #v << endl;                       \
    for (int i = 0; i < v.size(); i++)        \
    {                                         \
        for (int j = 0; j < v[i].size(); j++) \
        {                                     \
            cerr << v[i][j] << " ";           \
        }                                     \
        cerr << endl;                         \
    }
#define Sp(p) cout << setprecision(25) << fixed << p << endl; //小数点以下を25桁で表示
#define all(obj) (obj).begin(), (obj).end()
#define pb push_back

//usingエイリアス（別名という意味，型定義のこと）
using ll = long long;
//template <class T> using Vec = std::vector<T>;//エイリアステンプレート

const ll MOD = (ll)1e9 + 7;
//const ll MOD = 998244353;あ
const ll INF = (ll)1e18 + 1;
const double EPS = 1e-9;
const long double pi = 3.1415926535897932384626433832795028841971L;

//マクロでintをlong longと定義したときはsinged
int main()
{
    cin.tie(0);                  //cinとcoutの同期を切る（高速化)
    ios::sync_with_stdio(false); //iostreamとstdioの同期を切る（高速化)

    ll n,tmp,count=0;
    cin >> n ;
    for(ll i=1;i<=n;i++) {
        cin >> tmp;
        if(i%2==1){
            if(tmp%2==1) count++;
        }
    }
    OUT(count);

    return 0;
}

Measured memory_bytes: 3560
n,m= map(int,input().split())
l1,r1 = map(int,input().split())
lis = [l1,r1]

for i in range(m-1):
  l,r = map(int,input().split())
  if lis[0]<=l<lis[1] and lis[0]<r<=lis[1]:
    lis = [l,r]
  elif (lis[1]<l and lis[1]<r) or (l<lis[0] and r<lis[0]):
    print(0)
    exit()
  elif lis[0]<l<=lis[1] and lis[1]<r:
    lis[0] = l
  elif l<lis[0] and lis[0]<=r<lis[1]:
    lis[1] = r
    
print(lis[1]-lis[0]+1)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
int main(){
  int a;
  cin >> a;
  vector<long> b(a);
  for(int i=0;i<a;i++){
    cin >> b[i];
  }
  sort(b.begin(), b.end());
  bool flag = false;
  for(int j=0;j<a-1;j++){
    if(b[j]==b[j+1]){
      flag = true;
      break;
    }
  }
  if(flag){
    cout << "NO" << endl;
  }else{
    cout << "YES" << endl;
  }
}
    

Measured memory_bytes: 1792
import java.util.Scanner;


public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		long x = sc.nextLong();
		long ans = 0;
		long cash = 100;
		while(cash < x) {
			cash *= 1.01;
			ans++;
		}
		
		System.out.println(ans);
		sc.close();
	}

}

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

int ri() {
	int n;
	scanf("%d", &n);
	return n;
}

int main() {
	int n = ri();
	int64_t l = ri(), t = ri();
	int64_t t_bak = t;
	int64_t x[n], w[n];
	for (int i = 0; i < n; i++) x[i] = ri(), w[i] = !(ri() - 1); // 1 => +
	t *= 2;
	
	int64_t col = 0;
	for (int i = 1; i < n; i++) {
		if (w[i] != w[0]) {
			int dist = w[0] ? (x[i] - x[0] + l) % l : (x[0] - x[i] + l) % l;
			if (dist < t) {
				col++;
				col += (t - dist - 1) / l;
			}
		}
	}
	int label = w[0] ? col % n : (-col % n + n) % n;
	std::set<std::pair<int, bool> > st;
	std::pair<int, bool> zero;
	if (!w[0]) zero = {((x[0] - t_bak) % l + l) % l, true};
	else zero = {(x[0] + t_bak) % l, false};
	for (int i = 0; i < n; i++) {
		if (!w[i]) st.insert({((x[i] - t_bak) % l + l) % l, true});
		else st.insert({(x[i] + t_bak) % l, false});
	}
	assert(st.size() == n);
	auto itr = st.lower_bound(zero);
	assert(itr != st.end() && *itr == zero);
	int res[n];
	for (auto i = itr; i != st.end(); i++) res[label++ % n] = i->first;
	for (auto i = st.begin(); i != itr; i++) res[label++ % n] = i->first;
	for (int i = 0; i < n; i++) std::cout << res[i] << " ";
	return 0;
}


Measured memory_bytes: 7808
#include<bits/stdc++.h>
#define C 0.5772156649
#define pi acos(-1.0)
#define ll long long
#define mod 1000000007
#define ls l,m,rt<<1
#define rs m+1,r,rt<<1|1
#pragma comment(linker, "/STACK:1024000000,1024000000")

using namespace std;

const double g=10.0,eps=1e-7;
const int N=100000+10,maxn=20000+10,inf=0x3f3f3f;

int ans[N];
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        int a;
        cin>>a;
        ans[a]++;
    }
    int a=0;
    for(int i=1;i<=1e5;i++)
    {
        a=max(a,ans[i]+ans[i-1]+ans[i+1]);
    }
    cout<<a<<endl;
    return 0;
}
/********************

********************/


Measured memory_bytes: 640
MOD = 10**9 + 7

n = int(input())

A = list(map(int, input().split()))
A = [format(a, 'b').zfill(60) for a in A]

ans = 0
for i in range(60):
    lst = [a[i] for a in A]
    num_1 = lst.count('1')
    num_0 = lst.count('0')

    ans = (ans + (2**(59 - i) * (num_0 * num_1)) % MOD) % MOD

print(ans)

Measured memory_bytes: 54752
#include <stdio.h>
int min(int a,int b){
    return a<b?a:b;
}
int main()
{   int p,q,r;
    scanf("%d%d%d",&p,&q,&r);
    
    printf("%d",min(p+q,min(q+r,p+r)));

    return 0;
}


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

using namespace std;

const int NS = (int)1e5 + 4;
int N;
int arr[NS];
set < int > st;
set < int >::iterator p, q, pp, qq;
priority_queue < pair < int, int > > pq;

int main(){
    scanf("%d", &N);
    for(int i = 1; i <= N; ++i){
        scanf("%d", arr + i);
        pq.push(make_pair(arr[i], i));
    }
    st.insert(0);
    st.insert(N + 1);
    long long ans = 0;
    while(!pq.empty()){
        int pos = pq.top().second, val = pq.top().first; pq.pop();
        p = st.lower_bound(pos);
        q = p; --q;
        if(*p != N + 1){
            pp = p; ++pp;
            ans += (long long)(*pp - *p) * (pos - *q) * val;
        }
        if(*q != 0){
            qq = q; --qq;
            ans += (long long)(*q - *qq) * (*p - pos) * val;
        }
//        printf("%d\n", ans);
        st.insert(pos);
    }
    printf("%lld\n", ans);
    return 0;
}


Measured memory_bytes: 6132
#include<stdio.h>
int main()
{
	int a,b,c;
	scanf("%d%d%d",&a,&b,&c);
	if(a==7&&b==5&&c==5||b==7&&a==5&&c==5||c==7&&a==5&&b==5)
	printf("YES\n");
	else
	printf("NO\n");
	return 0;
}//

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

int a[52][52];
int w, h;
int yy[8] = {-1, 0, 0, 1, -1, -1, 1, 1};
int xx[8] = {0, 1, -1, 0, -1, 1, -1, 1};
int solve(int y, int x){
	if(a[y][x] == 0)return 0;
	a[y][x] = 0;
	int ans = 0;
	for(int i = 0;i < 8;i++){
		ans += solve(y+yy[i], x+xx[i]);
	}
	return 1;
}

int main(){
	int y, x;
	while(cin >> w >> h, w){
		int ans = 0;
		fill((int*)a, (int*)(a+52), 0);
		for(int i = 1;i <= h;i++)
		for(int j = 1;j <= w;j++)cin >> a[i][j];
		for(int i = 1;i <= h;i++){
			for(int j = 1;j <= w;j++){
				if(a[i][j])ans += solve(i, j);
			}
		}
		cout << ans << endl;
	}
	return 0;
}

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

#define CIN2(a,b) long long a,b;cin >> a >> b; 
#define rep(i,n) for(int i=0,i##_len=(n); i<i##_len; ++i)

int main(){
    int n;cin >> n;
    double x;
    string u;
    double ans = 0;
    for(int i=0;i<n;++i){
        cin >> x >> u;
        if(u=="JPY"){
            ans+=x;
        }else{
            ans+=x*380000.0;
        }
    }
    cout << fixed << ans << "\n";
}


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

int main(){
  int n,w;
  cin >> n>> w;
  int v[n];
  int w1[n];
  for(int i=0;i<n;i++){
    cin >> v[i] >> w1[i];
  }
  int l[n][w+1];
  for(int j=0;j<=w;j++){
    for(int i=0;i<n;i++){
      if(j==0){
	l[i][j]=0;
      }else if(i==0){
	if(w1[i]<=j){
	  l[i][j]=v[i];
	}else{
	  l[i][j]=0;
	}
      }else if(w1[i]>j){
	l[i][j] = l[i-1][j];
      }else{
	l[i][j]=max(v[i]+l[i-1][j-w1[i]],l[i-1][j]);
      }
    }
  }
  cout << l[n-1][w]<<endl;
}

Measured memory_bytes: 6988
#include <cstdio>
#include <cmath>
#include <cstring>
#include <iostream>

#include <string>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <stack>
#include <deque>

#include <algorithm>

using namespace std;

int main(int argc, char *argv[]) {
	int l, r;
	cin >> l >> r;
	if (r - l >= 2019) {
		cout << 0 << endl;
		return 0;
	}
	l %= 2019;
	r %= 2019;

	if (r <= l) {
		cout << 0 << endl;
		return 0;
	}

	int res = 0x3f3f3f3f;
	for (int i = l; i < r; i++)
		for (int j = i + 1; j <= r; j++)
			res = min(res, i * j % 2019);
	cout << res << endl;
}














Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
using namespace std;

int constexpr N = 100009;
int n;
vector<vector<pair<int, int>>> g(N);
vector<int> col(N);

void dfs(int u, int p, int color) {
    col[u] = color;
    for(auto v : g[u]) if(v.fi != p) {
        if(v.se)
            dfs(v.fi, u, 1 - color);
        else
            dfs(v.fi, u, color);
    }
}

int main() {
    ios::sync_with_stdio(0); cin.tie(0);
    cin >> n;
    for(int i = 0; i < n - 1; ++i) {
        int u, v, w;
        cin >> u >> v >> w;
        g[u].push_back({v, w % 2});
        g[v].push_back({u, w % 2});
    }

    dfs(1, -1, 0);
    for(int i = 1; i <= n; ++i)
        cout << col[i] << '\n';
}

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

int main(){
	int n;
  	int ac=0, wa=0, tle=0, re=0;
  	string temp;
  	cin >> n;
  	for (int i=0;i<n;i++){
      cin >> temp;
      if(temp == "AC")
          ac++;
      else if(temp == "WA") 
          wa++;
      else if (temp == "TLE")
          tle++;
      else if (temp == "RE")
          re++;
    }
    cout << "AC x " << ac << endl;
    cout << "WA x " << wa << endl;
    cout << "TLE x " << tle << endl;
    cout << "RE x " << re << endl;
    return 0;
}


Measured memory_bytes: 3628
#include <stdio.h>
#include <stdlib.h>

#include <iostream>
#include <iomanip>
#include <sstream>
#include <fstream>
#include <stdint.h>
#include <string.h>

#define _USE_MATH_DEFINES
#include <math.h>

#include <vector>
#include <list>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <stack>
#include <deque>
#include <string>

#include <algorithm>
#include <functional>
#include <bitset>
#include <functional>
#include <chrono>
#include <random>

#define sqr(x) (x) * (x)

typedef unsigned int u32;
typedef int i32;
typedef unsigned long long int u64;
typedef long long int i64;
typedef uint16_t u16;
typedef int16_t i16;
typedef uint8_t u8;
typedef int8_t i8;

using namespace std;
using namespace std::chrono;

const i64 mod = 1'000'000'000ll + 7;
//const i64 smod = 998244353ll;
//const i64 inf = 1'000'000'000'000'000'000ll + 7;
const i64 inf = 1'000'000'007;

const long double eps = 1e-8;

const i64 MAXN = 200'000 + 5;


int main(int argc, char* argv[]) {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cout.precision(15); cout.setf(ios::fixed); cerr.precision(15); cerr.setf(ios::fixed);

    i64 n;
    cin >> n;

    vector<i64> a(n + 1);

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

    i64 R = 0;
    for (i64 i = 1; i <= n; i++) {
        if (i % 2 && a[i] % 2) {
            R += 1;
        }
    }

    cout << R << endl;


    return 0;
}


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

using ll = long long;
using ull = unsigned long long;

const double PI = acos(-1);
const int inf = 2e9;
const ll INF = 2e18;
const ll MOD = 1e9+7;

#define sz(s) (s).size()
#define pb push_back
#define fi first
#define se second
#define REP(i,n) for (int i = 0; i<n; i++)
#define ALL(a) begin(a), end(a)

int main (void) {
    ll N;
    cin >> N;
    if (N <= 2) {
        cout << 0 << endl;
        return 0;
    }
    ll ans = 0;
    for (ll i = 1; i*i <= N; i++) {
        ll d = N / i - 1;
        //cout << i << " " << d << endl;
        if (N/d == N%d) {
            ans += d;
            //cout << d << endl;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long[] a = new long[n+1];
        long[] b = new long[n];
        for(int i=0;i<n+1;i++){
            a[i] = sc.nextLong();
        }
        for(int i=0;i<n;i++){
            b[i] = sc.nextLong();
        }
        long num = 0;
        for(int i=0;i<n;i++){
            if(a[i]>b[i]){
                a[i] -= b[i];
                num += b[i];
                b[i] = 0;
            }
            else{
                num += a[i];
                b[i] -= a[i];
                a[i] = 0;
            }
            if(b[i]>0){
                if(a[i+1]>b[i]){
                    a[i+1] -= b[i];
                    num += b[i];
                    b[i] = 0;
                }
                else{
                    num += a[i+1];
                    b[i] -= a[i+1];
                    a[i+1] = 0;
                }
            }
        }
        System.out.println(num);
    }
}

Measured memory_bytes: 84944
import java.util.*

fun main(args: Array<String>) {
    val pw = java.io.PrintWriter(System.out)
    Problem.solve(Scanner(System.`in`), pw)
    pw.flush()
}

object Problem {
    fun solve(sc: Scanner, pw: java.io.PrintWriter) {
        val N = sc.next().toInt()
        val C = sc.next().toCharArray()
        var l = 0
        var ans = 0
        var r = N - 1
        while (l < r) {
            while (l < r && C[l] == 'R') l++
            while (r > l && C[r] == 'W') r--
            if (l == r) break
            //dprint("$l $r")
            l++
            r--
            ans++
        }
        pw.println(ans)
    }
}


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

double x(int a) {
	if (a % 2 == 0) return a / 2;
	return a / 2 + 1;
	}

int main() {
	int a;
	double b;
	cin >> a;
	b = x(a);
	double x;
	x = a;
	x += 0.0000000000000000;
	b += 0.0000000000000000;
	cout << b / x << endl;
	}


Measured memory_bytes: 256
# coding: utf-8
# Your code here!
n = int(input())
a = list(map(int,input().split()))
def operate(ls,x):
    sm = 0
    ans = 0
    ans += abs(ls[0]-x)
    k = x
    for i in range(1,len(ls)):
        sm += k
        if sm > 0:
            if abs(ls[i]) <= sm or sm < ls[i]:
                ans += abs(ls[i]+sm+1)
                k = -sm-1
            else:
                k = ls[i]
        if sm < 0:
            if abs(ls[i]) <= abs(sm) or sm > ls[i]:
                ans += abs(-sm+1-ls[i])
                k = -sm+1
            else:
                k = ls[i]
    return ans

anstot = []
if a[0] > 0:
    inv = -1
if a[0] < 0:
    inv = 1
if a[0] != 0:
    anstot.append(operate(a,a[0]))
    anstot.append(operate(a,inv))
if a[0] == 0:
    a[0] = 1
    anstot.append(1+operate(a,1))
    a[0] = -1
    anstot.append(1+operate(a,-1))    
print(min(anstot))

Measured memory_bytes: 14468
#include<bits/stdc++.h>
#define int long long
using namespace std;
const int MOD=1000000007;
int n,k;
int a[2010];
int ans;
signed main(){
	cin>>n>>k;
	for(int i=1;i<=n;i++)cin>>a[i];
	for(int i=1;i<=n;i++){
		int cnt=0;
		for(int j=i+1;j<=n;j++)if(a[i]>a[j])cnt++;
		ans=(ans+k*(k+1)/2%MOD*cnt%MOD)%MOD;
		cnt=0;
		for(int j=1;j<i;j++)if(a[i]>a[j])cnt++;
		ans=(ans+k*(k-1)/2%MOD*cnt%MOD)%MOD;
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
N = int(input())
A_list = [int(e) for e in input().split()]

before_max = A_list[0]
ans = 0

for i in range(N):
    #print(i,before_max)
    if A_list[i] < before_max:
        ans += before_max - A_list[i]
    elif A_list[i] > before_max:
        before_max = A_list[i]
        
print(ans)

Measured memory_bytes: 32016
#include<stdio.h>
int main(){
   long long  a,b,k;
   scanf("%lld%lld%lld",&a,&b,&k);
   if(a>=k){
      a-=k;
   }else if(a+b>=k){
      k-=a;
      a=0;
      b-=k;
   }else{
      a=0;
      b=0;
   }
   printf("%lld %lld",a,b);
   return 0;
}


Measured memory_bytes: 1700
#include <cstdio>
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int N,A[2010];
bitset<4000000> bs(1);
int main(){
	int sum = 0;
	cin >> N;
	for(int i=0;i<N;i++){
		cin >> A[i];
		sum += A[i];
	}
	sum = (sum+1)/2;
	for(int i=0;i<N;i++){
		bs |= bs<<A[i];
	}
	for(int i=sum;;i++){
		if(bs[i]){
			cout << i << endl;
			return 0;
		}
	}
	return 0;
}

Measured memory_bytes: 1664
x = int(input())

pow5 = [i ** 5 for i in range(-1000, 1000)]

for a in range(-1000, 1000):
  for b in range(-1000, 1000):
    if pow5[a + 1000] - pow5[b + 1000] == x:
      print(f"{a} {b}")
      exit(0)


Measured memory_bytes: 66076
using System;

    class Program
    {
        static void Main(string[] args)
        {
            string[] x = Console.ReadLine().Split(' ');

            int a = int.Parse(x[0]);
            int b = int.Parse(x[1]);

            if (a < b)
            {
                Console.WriteLine("a < b");
            }else if (a > b)
            {
                Console.WriteLine("a > b");
            }else
            {
                Console.WriteLine("a == b");
            }
        }
    }




Measured memory_bytes: 8956
from math import factorial

N, M = map(int, input().split())

mod = 10 ** 9 + 7

if N == M:
    ans = factorial(N) * factorial(M) * 2
elif abs(N - M) == 1:
    ans = factorial(N) * factorial(M)
else:
    ans = 0
print(ans % mod)


Measured memory_bytes: 5184
MOD=10**9+7
N,K=map(int,input().split())

answer=0
for i in range(K,N+2):
  l=i*(i-1)//2
  r=i*N-i*(i-1)//2
  answer+=(r-l+1)%MOD
  answer%=MOD
print(answer)

Measured memory_bytes: 9188
#include<cstdio>
#include<algorithm>
using namespace std;
inline char tc(void){
	static char fl[10000],*A=fl,*B=fl;
	return A==B&&(B=(A=fl)+fread(fl,1,10000,stdin),A==B)?EOF:*A++;
}
inline int read(void){
	int a=0;static char c;
	while((c=tc())<'0'||c>'9');
	while(c>='0'&&c<='9')a=a*10+c-'0',c=tc();
	return a;
}
int n,a[100005],pre,nxt,ans;
int main(void){
	register int i;
	n=read();
	for(i=1;i<=n;++i)
		++a[read()];
	pre=0,nxt=a[1];
	for(i=0;i<=1e5;pre=a[i],++i,nxt=a[i+1])
		if(a[i]+pre+nxt>ans)ans=a[i]+pre+nxt;
	printf("%d",ans);
	return 0;
}

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

using namespace std;

int solve(vector<int> &vh, vector<int> &memo, int cur = 0) {
  int n = vh.size();
  if (cur == n - 1) {
    return 0;
  }

  if (memo[cur] < 0) {
    int ans = solve(vh, memo, cur + 1) + abs(vh[cur] - vh[cur + 1]);
    if (cur < n - 2) {
      ans = min(ans, solve(vh, memo, cur + 2) + abs(vh[cur] - vh[cur + 2]));
    }

    memo[cur] = ans;
  }

  return memo[cur];
}

int main(int argc, const char *argv[]) {
  int n;
  cin >> n;

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

  vector<int> memo(n, -1);
  cout << solve(vh, memo) << '\n';
  return 0;
}

Measured memory_bytes: 8832
#include <bits/stdc++.h>
// #include <atcoder/all> // NOTE: AtCoderライブラリ
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
// using namespace atcoder; // NOTE: AtCoderライブラリ
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<long long> vl;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef pair<int, int> pii;
// #define INF __INT32_MAX__
#define INF 1e9
#define LINF __LONG_LONG_MAX__

int main() {
    string S; cin >> S;
    int N = S.size();

    reverse(S.begin(), S.end());

    const int MOD = 2019;

    map<ll, ll> G;
    G[0] = 1;

    int x = 0;
    int dig = 1;
    rep(i, N) {
        x += (S.at(i) - '0') * dig;
        x %= MOD;
        G[x]++;

        dig *= 10;
        dig %= MOD;
    }

    int cnt = 0;
    for (auto g : G) {
        int x = g.first;
        int y = g.second;

        if (y < 2) continue;
        cnt += (y * (y - 1) / 2);
    }

    cout << cnt << endl;
}


Measured memory_bytes: 3780
#include <bits/stdc++.h>
#include<iomanip>
#define ll long long
#define pb push_back
#define mp make_pair
#define MOD 1000000007
using namespace std;

ll p(ll x,ll n) {
	ll res=1;
	while(n) {
		if(n&1) res=(res*x)%MOD;
		x=(x*x)%MOD;
		n/=2;
	}
	return res;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
   	ll n,i,j;
   	cin >> n;
   	ll a[n],sum=0,setBit, unsetBit;
   	for(i=0;i<n;i++) cin >> a[i];
   	for(i=0;i<60;i++) {
   		setBit=0;
   		for(j=0;j<n;j++) {
   			if((a[j]>>i)&1) setBit++;
   		}
   		unsetBit = n-setBit;
   		sum=(sum+(((setBit*unsetBit)%MOD)*p(2,i))%MOD)%MOD;
   	}
   	cout << sum << "\n";
    return 0;
}//////dfdsf



Measured memory_bytes: 2560
#include<iostream>
#include<vector>
#include<array>
#include<algorithm> 

struct Q{int64_t t,a,b;};
std::vector<Q> qlist;
int main(){
    int n,q;
    std::string s;
    std::cin>>n;
    std::cin>>s;
    std::cin>>q;
    for(int i=0;i<q;++i){
        Q q;
        std::cin>>q.t;
        if(q.t==1){
            char c;
            std::cin>>q.a>>c;
            q.a-=1;
            q.b=c;
        }
        else {
            std::cin>>q.a>>q.b;
            q.a-=1;
            q.b-=1;
        }
        qlist.push_back(q);
    }
     std::array<std::vector<std::size_t>,26> memo;
    for(std::size_t i=0;i<s.size();++i){
        memo[s[i]-'a'].push_back(i);
    }

    for(auto &q:qlist){
        //std::cout<<">>"<<q.t<<q.a<<q.b<<std::endl;
        if(q.t==1){
            if(s[q.a]!=q.b){
                auto &old=memo[s[q.a]-'a'];
                auto it =std::lower_bound(old.begin(),old.end(),q.a);
                old.erase(std::lower_bound(old.begin(),old.end(),q.a));
                auto &ne=memo[q.b-'a'];
                auto neit = std::upper_bound(ne.begin(),ne.end(),q.a);
                ne.insert(neit,q.a);
                s[q.a]=q.b;
            }
        }else{
            std::cout<<
                std::count_if(memo.begin(),memo.end(),
                    [&](std::vector<std::size_t> const&cs)->bool{
                        auto it = std::lower_bound(cs.begin(),cs.end(),q.a);
                        if(cs.size()==0 || it==cs.end())return false;
                        return  q.a <= *it && *it <= q.b;
                    })
                <<std::endl;
        }
    }
}

Measured memory_bytes: 7672
#include<bits/stdc++.h>
#include<numeric>
#define int long long
#define ld long double
#define all(x) x.begin(),x.end()
const int maxn=1000000;
#define what_is(x) cerr << #x << " is " << x << endl;
const int MOD = 1e9 + 7;
using namespace std;
string abc="abcdefghijklmnopqrstuvwxyz";
int powmod(int a, int b, int MOD = MOD){
    if(!a and !b)    return 1ll;
    if(!a)    return a;
    int res = 1ll;
    b %= (MOD - 1ll), a %= MOD;
    while(b){
        if(b%2 == 1)    res = (res * a) % MOD;
        a = (a * a) % MOD;
        b /= 2;
    }
    return res;
}
int popcount(uint32_t n)
{
    n = n - ((n >> 1) & 0x55555555);
    n = (n & 0x33333333) + ((n >> 2) & 0x33333333);
    return ((n + (n >> 4) & 0xF0F0F0F) * 0x1010101) >> 24;
}
bool check(int n) {return (((double)sqrt(n)-floor((double)sqrt(n)))==0);}
vector<bool> sieve(maxn + 1, true);
void fillprime() {
    sieve[0] = sieve[1] = false;
    for (int i = 2; i <= maxn; ++i) {
        if (sieve[i] && (int) i * i <= maxn) {
            for (int j = i * i; j <= maxn; j += i) {
                sieve[j] = false;
            }
        }
    }
}
void solve() {
   int arr[5];
    int pos;
   for(int i=0;i<5;++i) {
       cin>>arr[i];
       if(arr[i]==0)
       {
           pos=i;
       }
   }
   cout<<pos+1;
}
int32_t main() {
    ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
    //cout<<"Hello World"<<"\n";
    //int t;cin>>t;while(t--)
    solve();
}

Measured memory_bytes: 3756
#include <bits/stdc++.h>
#define ll long long int
#define yorn(f) cout << ((f) ? "Yes" : "No") << endl
#define YORN(f) cout << ((f) ? "YES" : "NO") << endl
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
int main()
{
    string a, b, c;
    cin >> a >> b >> c;
    YORN(a[a.size() - 1] == b[0] && b[b.size() - 1] == c[0]);
    return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
using ll = long long;
using P = pair<int, int>;
ll GCD(ll a, ll b) { return b?GCD(b, a%b):a; }
ll LCM(ll a, ll b) { return a/GCD(a, b)*b; }

ll n, k;

int main() {
    cin >> n >> k;
    vector<ll> A(n, 0);
    for(int i = 0; i < n; ++i) cin >> A.at(i);

    vector<ll> vec1(45, 0);
    for(int i = 0; i < n; ++i) {
        int j = 0;
        while((1LL<<j) <= A.at(i)) {
            if(A.at(i)&(1LL<<j)) {
                vec1.at(j)++;
            }
            j++;
        }
    }
    vector<ll> vec0(45, 0);
    for(int i = 0; i < 45; ++i) vec0.at(i) = n-vec1.at(i);

    int limit = 0;
    vector<int> bitk(45, 0);
    while((1LL<<limit) <= k) {
        if(k&(1LL<<limit)) {
            bitk.at(limit)++;
        }
        limit++;
    }

    ll ans = 0;
    for(int i = 0; i <= limit; ++i) {
        ll sum = 0;
        ll now = 1;
        vector<int> bitck = bitk;
        if(bitk.at(i) == 1) {
            // i-1まで好きに選べる
            // ここでbitk.at(i)を0にするから実現できる
            bitck.at(i) = 0;
            for(int j = 0; j < 45; ++j) {
                if(j < i) {
                    if(vec0.at(j) >= vec1.at(j)) sum += vec0.at(j)*now;
                    else sum += vec1.at(j)*now;
                }else {
                    if(bitck.at(j) == 1) sum += vec0.at(j)*now;
                    else sum += vec1.at(j)*now;
                }
                now *= 2;
            }
        }else {
            for(int j = 0; j < 45; ++j) {
                if(bitck.at(j) == 1) sum += vec0.at(j)*now;
                else sum += vec1.at(j)*now;
                now *= 2;
            }
        }
        chmax(ans, sum);
    }
    cout << ans << endl;
}

Measured memory_bytes: 1024
#include <vector>
#include <iostream>
#include <cmath>
#include <map>
#include <algorithm>
#include <fstream>
#include <unistd.h>
#include <string>
#include <numeric>
#include <queue>
#include <deque>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<string> vs;
typedef vector<vector<string>> vvs;
typedef vector<char> vc;
typedef vector<vector<char>> vvc;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
typedef vector<P> vp;
typedef vector<PL> vpl;
typedef vector<vector<P>> vvp;
const int INF = 1001001001;
const ll LINF = 1e18;
const string endstr = "\n";
#define FOR(i, a, b) for(ll i = (a); i < b; i++)
#define REP(i, n) for(ll i = 0; i < n; i++)
#define FORMAP(it, map) for(auto it = m.begin(); it != m.end(); it++)

template <typename T>
T gcd(T a, T b) {
    return (a == 0) ? b : gcd(b%a, a);
}
template <typename T>
T lcm(T a, T b) {
    return a / gcd(a, b) * b;
}

bool p_comp_fs(const P p1, const P p2){ return p1.first < p2.first;};
bool p_comp_fg(const P p1, const P p2){ return p1.first > p2.first;};
bool p_comp_ss(const P p1, const P p2){ return p1.second < p2.second;};
bool p_comp_sg(const P p1, const P p2){ return p1.second > p2.second;};
template <typename T>
vector<T> uniquen(vector<T> vec){
    vec.erase(unique(vec.begin(), vec.end()), vec.end());
    return vec;
}


int main(){
    ll n; cin >> n;
    map<char, ll> m;
    REP(i, n){
        string s; cin >> s; map<char, ll> t_m;
        for (int i = 0; i < s.size(); i++) {
            t_m[s[i]]++;
        }
        if(i == 0) m = t_m;
        else{
            FORMAP(it, m){
                auto key = it->first;
                m[key] = min(t_m[key], m[key]);
            }
        }
    }
    string ret = "";
    FORMAP(it, m){
        auto key = it->first;
        REP(i, it->second){
            ret += key;
        }
    }
    cout << ret << endstr;
    return 0;
}


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

const long long mod = 1e9 + 7;

using ll = long long;
using pii  = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

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

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

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

ull gcd(ull a, ull b) { return b ? gcd(b, a % b) : a; }
ull lcm(ull a, ull b) { return a / gcd(a, b) * b; }

int main(){
    int h, w, d;
    cin >> h >> w >> d;
    vector<vi> a(h, vi(w));
    rep(i, h) rep(j, w) {
        cin >> a[i][j];
        a[i][j]--;
    }
    vector<vpii> b(d, vpii(h*w/d+1));
    rep(i, h) rep(j, w) b[(a[i][j])%d][(a[i][j])/d] = { i, j };
    vector<vll> sum(d, vll(h*w/d+1));
    rep(i, d) rep1(j, sz(b[i])-1) {
        if (d*j+i>=h*w) continue;
        int cost = abs(b[i][j].first-b[i][j-1].first) + abs(b[i][j].second-b[i][j-1].second);
        sum[i][j] = sum[i][j-1] + cost;
    }
    int q;
    cin >> q;
    rep(i, q) {
        int l, r;
        cin >> l >> r;
        --l; --r;
        ll ans = sum[l%d][r/d] - sum[l%d][l/d];
        cout << ans << endl;
    }
    return 0;
}


Measured memory_bytes: 13384