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


map<string,int> train;
int n;

//第二引数"から"分ける
vector<string> split(string splitstring,int stringnum){
  int i;
  vector<string>stringanswer;
  string answerstring1 = "";
  string answerstring2 = "";
  for(i=stringnum-1;i<splitstring.size();i++)answerstring2+=splitstring[i];
  splitstring.erase(splitstring.begin()+stringnum-1,splitstring.end());
  answerstring1 = splitstring;
  stringanswer.push_back(answerstring1);
  stringanswer.push_back(answerstring2);
  return stringanswer;
}

int main(){
  int i,a,j,k,cnt=0;
  string s;
  cin >> n;
  for(a=0;a<n;a++){
    cin >> s;
    train.clear();
    cnt=0;
    for(i=2;i<=s.size();i++){
      vector<string> v;
      string now;
      v = split(s,i);
      v.push_back(v[0]);
      v.push_back(v[1]);
      //cout <<"v1 " << v[0] << endl;;
      //cout << "v2 " << v[1] << endl;
      reverse(v[2].begin(),v[2].end());
      reverse(v[3].begin(),v[3].end());
      for(j=0;j<=2;j+=2)for(k=1;k<=3;k+=2){
	  now = v[j]+v[k];
	  if(train.find(now)==train.end()){
	    //cout << now << endl;
	    cnt++;
	    train[now]=1;
	  }
	  now = v[k]+v[j];
	  if(train.find(now)==train.end()){
	    cnt++;
	    //cout << now << endl;
	    train[now]=1;
	  }
	}
    }
    cout << cnt << endl;
  }
  return 0;
}



Measured memory_bytes: 3284
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		char c[] = s.toCharArray();
if((c[1]==c[2])&&(c[0]==c[1]||c[2]==c[3])){System.out.println("Yes");}else{System.out.println("No");}}}

Measured memory_bytes: 21844
//Author: Fuadul Hasan(fuadul202@gmail.com)
#include<bits/stdc++.h>
using namespace std;

#define ll long long
const int N   = 2e5 + 5;

int main(){
	
	
	char ch;
	cin>>ch;
	if(ch>='A'&&ch<='Z'){
		cout<<'A'<<endl;
	}else{
		cout<<'a'<<endl;
	}

	

	return 0;
}

Measured memory_bytes: 3588
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9;
const ll mod = 1e9 + 7;

int main(){
	string s;
	cin >> s;
	deque<char> deq;
	for (char c : s) deq.push_back(c);
	bool flip = true;
	int q, cut = 0;
	cin >> q;
	rep(qi,q) {
		int ty;
		cin >> ty;
		if (ty == 1) {
			flip = !flip;
			cut++;
		} else {
			int f; char c;
			cin >> f >> c;
			if (flip) {
				if (f == 1) {
					deq.push_front(c);
				} else {
					deq.push_back(c);
				}
			} else {
				if (f == 1) {
					deq.push_back(c);
				} else {
					deq.push_front(c);
				}
			}
		}
	}
	string ans;
	if (cut == 0) {
		for (char c : deq) ans += c;
	} else if (cut % 2 != 0) {
		reverse(deq.begin(), deq.end());
		for (char c : deq) ans += c;
	} else {
		for (char c : deq) ans += c;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1412
#include<iostream>
#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#include<cmath>



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

using namespace std;
vector<string> s;
int n;
int l;
int main(){
  cin >> n >> l;
  REP(i,n){
    string k;
    cin >> k;
    s.push_back(k);
  }
  sort(s.begin(),s.end());
  REP(i,n){
    cout << s[i];
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int k;long long x=0;
	scanf("%d",&k);
	while(k--)
	{
		int y=0,Y,z[20],zn=0;long long i,X,t=1;
		for(i=++x;i;i/=10)y+=z[++zn]=i%10;
		for(X=x,Y=y,i=1;i<=zn;++i)
		{
			X+=(9-z[i])*t;Y+=9-z[i];t*=10;
			if(x*Y>X*y)x=X,y=Y;
		}
		printf("%lld\n",x);
	}
}

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

bool prime[100010];
int ans[100010];
void countPrime();

int main(){
  int n;
  countPrime();
  while(cin >> n , n){
    cout << ans[n] << endl;
  }
}

void countPrime(){
  memset(prime,true,100001);
  memset(ans,0,100001);
  for(int i=2;i*i<=50000;i++){
    if(prime[i]){
      for(int j=i*i;j<=50000;j=j+i){
	prime[j]=false;
      }
    }
  }
  for(int i=2;i<50000/2+1;i++){
    for(int j=i;j<50000+1;j++){
      if(prime[i] && prime[j]){
	ans[i+j]++;
      }
    }
  }
}

Measured memory_bytes: 1564
#include<bits/stdc++.h>
#define ll long long
using namespace std;
//int v[100010],x[100010];
ll n,c;
ll l[100010],r[100010];
struct node{
	ll v,x;
}a[100010];
//bool cmp(node x,node y){return x.x<y.x;}
int main(){
	scanf("%lld%lld",&n,&c);
	for(int i=1;i<=n;i++) scanf("%lld%lld",&a[i].x,&a[i].v);
//	sort(a+1,a+n+1,cmp);
	for(int i=1;i<=n;i++)l[i]=l[i-1]-a[i].x+a[i-1].x+a[i].v;
//	for(int i=1;i<=n;i++)printf("%d ",l[i]);
//	puts("");
	for(int i=2;i<=n;i++)l[i]=max(l[i],l[i-1]);
	a[n+1].x=c;
	ll ans=0;
	for(int i=n;i>=1;i--) r[i]=r[i+1]+a[i].v+a[i].x-a[i+1].x;
//	for(int i=1;i<=n;i++) printf("%d ",r[i]);
//	puts("");
	for(int i=n-1;i>=1;i--) r[i]=max(r[i],r[i+1]);
	for(int i=1;i<=n;i++) ans=max(ans,l[i]);
	for(int i=1;i<=n;i++) ans=max(ans,r[i]);
	for(int i=1;i<=n;i++){
		ll k=c-a[i].x;
		ans=max(ans,r[i]+l[i-1]-k);
	}
	for(int i=1;i<=n;i++){
		ll k=a[i].x;
		ans=max(ans,r[i+1]+l[i]-k);
	}
	printf("%lld",ans);
	return 0;
}

Measured memory_bytes: 3328
import java.util.Scanner;

public class Main {

	
	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
		int[] a = new int[n+1];
		int[] b = new int[n];
		
		for(int i=0 ; i<n+1 ; i++) {
			 a[i] = sc.nextInt();
		}
		for(int i=0 ; i<n ; i++) {
			b[i] = sc.nextInt();
		}
		
		
		long z = 0;
		for (int j=0; j<n; j++) {
			int x = Math.min(a[j], b[j]);
			z += x;
			a[j] -=x;
			b[j] -=x;
			
			int y = Math.min(a[j+1], b[j]);
			z += y;
			a[j+1] -=y;
			b[j] -=y;
			
		}
		
		System.out.println(z);

	}

}


Measured memory_bytes: 64228
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Math;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            A();
        }

        static void A()
        {
            var NK = ReadSplitInt();
            Println(ReadSplitInt().Count(x => x >= NK[1]));
        }

        static List<long> ReadLines(long n)
        {
            var l = new List<long>();
            for (long i = 0; i < n; i++)
            {
                l.Add(ReadLong());
            }
            return l;
        }

        static void YESOrNO(bool e) => Println(e ? "YES" : "NO");

        static void YesOrNo(bool e) => Println(e ? "Yes" : "No");

        static IEnumerable<int> Range(int start, int stop)
        {
            if (start < 0 || stop < 0 || start > stop || (start <= 0 && stop <= 0))
                return new List<int>();

            return Enumerable.Range(start, stop - start);
        }

        static bool IsDigit(string str)
        {
            var i = 0;
            return int.TryParse(str, out i);
        }

        static int SumDigits(long num)
        {
            return num.ToString().Select(x => x.ToString()).Sum(int.Parse);
        }

        static int[] ToIntArray(string str)
        {
            return str.Select(x => x.ToString()).Select(int.Parse).ToArray();
        }

        static long Gcd(long a, long b) => b == 0 ? a : Gcd(b, a % b);
        static long Lcm(long a, long b) => a / Gcd(a, b) * b;

        static bool IsPrime(int x)
        {
            if (x <= 1 || (x != 2 && x % 2 == 0)) return false;
            if (x == 2) return true;

            for (int i = 3; i < x; i += 2)
                if (x % i == 0) return false;

            return true;
        }

        static string Read() => Console.ReadLine();
        static int ReadInt() => int.Parse(Read());
        static long ReadLong() => long.Parse(Read());

        static List<string> ReadSplit() => Read().Split().ToList();
        static List<int> ReadSplitInt() => Read().Split().Select(int.Parse).ToList();
        static List<long> ReadSplitLong() => Read().Split().Select(long.Parse).ToList();

        static void Print(object value) => Console.Write(value.ToString());
        static void Println(object value) => Console.WriteLine(value.ToString());
        static string Join<T>(IEnumerable<T> list) => string.Join("", list);
    }

    public static class MyExtensions
    {
        public static string Slice(this string str, int start = 0, int stop = 0)
        {
            if (start > str.Length || stop > str.Length || start < 0 || stop < 0)
                return "";

            if (stop == 0) stop = str.Length;
            return str.Substring(start, stop - start);
        }
    }
}



Measured memory_bytes: 16864
import java.util.Scanner;

public class Main {

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

    int n = sc.nextInt();
    String s = sc.next();

    int ans = 1;
    char[] c = s.toCharArray();
    for (int i = 1; i < n; i++) {
      if (c[i] != c[i-1]) ans++;
    }

    System.out.println(ans);
  }
}

Measured memory_bytes: 26452
// AGC023_A
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <iterator>  // std::back_inserter()
#include <tuple>  // std::tuple std::get
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <stack>
#include <queue>
#include <algorithm>  // std::copy()
#include <functional>  // std::greater<T>()
#include <utility>  // std::swap()
#include <numeric>  // accumulate(ALL(vec), 0)  0 は初期値
#include <bitset>  // static_cast<std::bitset<8>>
#include <sstream>  // std::stringstream
#include <cmath>
#include <climits>  // INT_MIN
#include <cctype>  // std::isdigit()
#include <iomanip>  // std::setprecision()
using namespace std;

#define ALL(obj) (obj).begin(), (obj).end()
#define REP(i, n) for (ll i=0; i < n; i++)  // 0 ~ n-1
#define REPN(i, n) for (ll i=1; i <= n; i++)  // 1 ~ n
#define MIN(vec) min_element(ALL((vec)))  // イテレータのため、値を取り出すときは * を先頭につける
#define MAX(vec) max_element(ALL((vec)))
#define IDX(vec, element_iter) distance((vec).begin(), element_iter)
#define SUM(vec) accumulate(ALL((vec)), 0LL)  // 0 は初期値
#define COPY(vec1, vec2) copy(ALL(vec1), back_inserter(vec2))  // vec1をvec2にコピーする vec2は空にしておく必要あり
#define zero_pad(num) setfill('0') << std::right << setw(num)
#define space_pad(num) setfill(' ') << std::right << setw(num)

typedef long long ll;

const ll MOD7 = 1000000007;  // 1 000 000 007
const ll MOD9 = 1000000009;  // 1 000 000 009

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    // input
    ll N, K;
    cin >> N >> K;
    vector<ll> vec(N);
    REP(i, N) cin >> vec[i];
    
    // calculation
    sort(vec.begin(), vec.end(), greater<>());  // int big -> small
    ll res = vec[0] - vec[K-1];
    for (ll j = 0; j < N-K+1; ++j) {
        res = min(res, vec[j] - vec[j+K-1]);
    }
    cout << res << "\n";
    return 0;
}


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

dp = [0] * (K + 1)
ans = 0
for k in range(K, 0, -1):
    num = K // k
    dp[k] = pow(num, N, MOD)
    for n in range(2, num+1):
        if n*k <= K:
            dp[k] -= dp[n*k]
            dp[k] %= MOD

    ans += dp[k] * k % MOD
    ans %= MOD

print(ans)

Measured memory_bytes: 11168
PROGRAM ATCODER

implicit none
character(len=10) :: s
integer :: i,j
integer :: long(10)

read(*,*) s

long = 0
do i = 1, 10
  do j = i,10
    if ( s(j:j) == 'A' .or. s(j:j) == 'T' .or. s(j:j) == 'G' .or. s(j:j) == 'C' ) then
      long(i) = long(i) + 1
    else
      exit
    end if    
  end do
end do

write(*,'(i0)') maxval(long)

contains
!!!!!! サブルーチンは↓
!!!!!!

END PROGRAM ATCODER

Measured memory_bytes: 768
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int N = in.nextInt();
		char[] S = in.next().toCharArray();
		int[] E = new int[N + 1];
		int[] W = new int[N + 1];
		for (int i = 1; i <= N; i++) {
			E[i] += E[i - 1] + (S[i - 1] == 'E' ? 1 : 0);
			W[i] += W[i - 1] + (S[i - 1] == 'W' ? 1 : 0);
		}
		int ans = Integer.MAX_VALUE;
		for (int i = 0; i < N; i++) {
			int count = 0;
			count += W[i + 1] - (S[i] == 'W' ? 1 : 0);
			count += E[E.length - 1] - E[i + 1];
			ans = Math.min(ans, count);
		}
		System.out.println(ans);
		in.close();
	}
}

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

int main() {
    int N, Q; cin >> N >> Q;
    string s; cin >> s;
    vector<int> l(Q), r(Q);
    rep(i,Q) {
        int x, y; cin >> x >> y;
        x--; y--;
        l.at(i) = x; r.at(i) = y;
    }

    vector<int> cnt(N,0);
    for(int i=0; i<N-1; i++){
        if(s.at(i)=='A' && s.at(i+1)=='C'){
            cnt.at(i+1) = cnt.at(i) + 1;
        }
        else{
            cnt.at(i+1) = cnt.at(i);
        }
    }

    for(int i=0; i<Q; i++){
        cout << cnt.at(r.at(i)) - cnt.at(l.at(i)) << endl;
    }
}


Measured memory_bytes: 2176
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin >> N;
  vector<string> color(N);
  bool a = true;
  for(int i = 0;i < N;i++){
    cin >> color.at(i);
    if(color.at(i) == "Y"){
      a = false;
      break;
    }
  }
  if(a == true){
    cout << "Three" << endl;
  }
  else{
    cout << "Four" << endl;
  }
}

Measured memory_bytes: 256
//#include <bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <vector>
#include <map>
#include <queue>

using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<n;++i)
#define mod (ll)(1e9+7)
#define FIX(a) ((a)%mod+mod)%mod
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define fi first
#define se second
#define pb push_back
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    int m = 0;
    int now = 0;
    REP(i,n){
        int a,b;
        cin >> a >> b;
        if(a>m){
            m=a;
            now=b;
        }
    }
    cout << m+now << endl;

    return 0;
}

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

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

Measured memory_bytes: 256
n = int(input())
s = input()

S = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"

s_split = list(s)

# print(s_split)

new_str_list = []
for i in range(len(s)):
    no = S.find(s[i])
    number = (no+n)%26
    new_str = S[number]
    # print(no)
    # print(new_str)
    new_str_list.append(new_str)

# print(new_str_list)
print("".join(new_str_list))

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


int N, ans;
vector<int> p10;


int case_n(int x) {
    if (x < 3) return 0;
    int n = pow(3, x) - pow(2, x) * 3 + 3;
    return n;
}


void solve(int n, int x, bool b3, bool b5, bool b7) {
    if (n == 0) {
        if (x <= N & b3 && b5 && b7) ans++;
        return;
    }
    solve(n-1, x + 3 * p10[n-1], true, b5, b7);
    solve(n-1, x + 5 * p10[n-1], b3, true, b7);
    solve(n-1, x + 7 * p10[n-1], b3, b5, true);
}


int main() {
    cin >> N;
    string S = to_string(N);
    int n = S.size();
    p10 = vector<int>(n);
    p10[0] = 1;
    for (int i = 1; i < n; i++) p10[i] = p10[i-1] * 10;
    ans = 0;
    for (int i = 3; i < n; i++) ans += case_n(i);
    solve(n, 0, false, false, false);
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <string>
 
using namespace std;
typedef long long ll;

struct test
{
	string s;
	int c;
};

	string S[200000];
	test t[200000];

int main()
{
	int N;
	
	scanf("%d", &N);
	for(int i = 0; i < N; i++){
		char s[11];
		scanf("%s", s);
		S[i] = s;
	}
	
	sort(S, S+N);
	
	for(int i = 0; i < N; i++){
		t[i].s = "";
		t[i].c = 0;
	}
	
	int max = 0;
	int count = 1;
	int j = 0;
	t[j].s = S[0];
	for(int i = 0; i < N; i++){
		if(t[j].s == S[i]){
			t[j].c ++;
		}else{
			j++;
			t[j].s = S[i];
			t[j].c ++;
			count++;
		}
		
		if(t[j].c > max){
			max = t[j].c;
		}
	}
	
	for(int i = 0; i < count; i++){
		if(t[i].c == max){
			printf("%s\n", t[i].s.c_str());
		}
	}
	
	return 0;
}

Measured memory_bytes: 16000
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=s;i<n;i++)
#define all(a) a.begin(),a.end()
typedef long long ll;
const ll inf = 1e9;
multimap<string, ll> mp;
int main(){
    int n, m;
    cin >> n;
    set<ll> a;
    rep(i,n){
        ll an; cin >> an;
        a.insert(an);
    }
    cin >> m;
    set<ll> b;
    rep(i,m){
        ll bn; cin >> bn;
        b.insert(bn);
    }

    vector<ll> c;
    set_difference(all(a), all(b), back_inserter(c));
    rep(i,c.size())cout << c[i] << endl;
    return 0;
}


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

int main()
{
    int a,b;
    cin >> a >> b;

    if(a%3==0 || b%3==0 || (a+b)%3==0) cout << "Possible" << endl;
    else cout << "Impossible" << endl;
    return 0;
}

Measured memory_bytes: 3636
#include <cstdio>
#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

long long gcd(long long a, long long b){ // Ååöñ
    while(b != 0){
        long long tmp = a % b;
        a = b;
        b = tmp;
    }
    return a;
}

int main()
{
    for(;;){
        int a, b;
        if(!(cin >> a >> b))
            return 0;

        cout << gcd(a, b) << endl;
    }
}

Measured memory_bytes: 0
#include <iostream>

using namespace std;

int pers(int k) {
	int ret = 0;
	while (k!=0) {
		k /= 10;
		ret++;
	}
	return ret;
}

int main() {
	int k, l;
	while (cin >> k >> l) {
		cout << pers(k+l) << endl;
	}
	return 0;
}

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

using ll = long long;
using ld = long double;

int main()
{
    string s;
    int h,w;
    cin >> h>>w;
    
    for(int i = 0; i < w+2; i++)
    {
        cout << "#";
    }
    cout << endl;

    
    for(int i = 0; i < h; i++)
    {
        cout << "#";
        cin>> s;
        cout << s;
        cout << "#";
        cout << endl;
    }
    

    for(int i = 0; i < w+2; i++)
    {
        cout << "#";
    }
    cout << endl;

    return 0;
}

Measured memory_bytes: 256
var
  ans, i, ma, a, k, t: integer;
begin
  read(k);
  readln(t);
  for i := 1 to t do
  begin
    read(a);
    if ma < a then ma := a;
  end;
  
  ans := (ma - (k - ma) - 1);
  if 0 < ans then writeln(ans) else writeln(0);
end.

Measured memory_bytes: 128
#define _USE_MATH_DEFINES
#include<stdio.h>
#include<string>
#include<iostream>
#include<cctype>
#include<cstdio>
#include<vector>
#include<queue>
#include<stack>
#include<algorithm>
#include<math.h>
#include<set>
#include<map>
#include<iomanip>
#include<functional>
using namespace std;

#define ll long long
#define MOD 1000000007

int main(){
	cin.tie(0); ios::sync_with_stdio(false);
	ll n; cin >> n;
	ll sum1 = 0, sum2 = 0;
	ll c1 = 0, c2 = 0;
	ll a; cin >> a;
	if (a > 0) {
		sum1 += a;

		sum2 += -1;
		c2 += (abs(a) + 1);
	}
	else if(a < 0){
		sum1 += 1;
		c1 += (abs(a) + 1);

		sum2 += a;
	}
	else {
		sum1 += 1;
		sum2 += -1;

		c1++; c2++;
	}

	for (int i = 1; i < n; i++) {
		ll x; cin >> x;
		if (sum1 > 0) {
			if (sum1 + x >= 0) {
				c1 += (abs(sum1 + x) + 1);
				sum1 = -1;
			}
			else {
				sum1 += x;
			}
		}
		else if(sum1 < 0){
			if (sum1 + x <= 0) {
				c1 += (abs(sum1 + x) + 1);
				sum1 = 1;
			}
			else {
				sum1 += x;
			}
		}

		if (sum2 > 0) {
			if (sum2 + x >= 0) {
				c2 += (abs(sum2 + x) + 1);
				sum2 = -1;
			}
			else {
				sum2 += x;
			}
		}
		else if (sum2 < 0) {
			if (sum2 + x <= 0) {
				c2 += (abs(sum2 + x) + 1);
				sum2 = 1;
			}
			else {
				sum2 += x;
			}
		}
	}
	cout << min(c1, c2) << endl;
}

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

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<string> vs;
typedef pair<int, int> P;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()

void YN(bool flg){if(flg) cout << "YES" << endl; else cout << "NO" << endl;}
void Yn(bool flg){if(flg) cout << "Yes" << endl; else cout << "No" << endl;}
void yn(bool flg){if(flg) cout << "yes" << endl; else cout << "no" << endl;}

int main()
{
    char a;
    cin >> a;
    cout << (islower(a) ? "a" : "A") << endl; 

    return 0;
}


Measured memory_bytes: 3596
import java.util.*;
 
class Main{
    static Integer maxC[] = {0,0,0};
    static Integer minIndex[] = {4000, 4000, 4000};
    static Integer maxIndex[] = {0,0,0};
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        Integer n = sc.nextInt();
        String[] s = sc.next().split("");
        Integer[] r = new Integer[n];
        Integer[] g = new Integer[n];
        Integer[] b = new Integer[n];
    
        for(int i=0;i<n;i++){
            r[i]=0;
            g[i]=0;
            b[i]=0;
            if(s[i].equals("R")){
                r[i]=maxC[0]+1;
                maxC[0]++;
                minIndex[0] = Math.min(minIndex[0], i);
                maxIndex[0] = Math.max(maxIndex[0], i);
            }
            if(s[i].equals("G")){
                g[i]=maxC[1]+1;
                maxC[1]++;
                minIndex[1] = Math.min(minIndex[0], i);
                maxIndex[1] = Math.max(maxIndex[0], i);
            }
            if(s[i].equals("B")){
                b[i]=maxC[2]+1;
                maxC[2]++;
                minIndex[2] = Math.min(minIndex[0], i);
                maxIndex[2] = Math.max(maxIndex[0], i);
            }
        }
 
        Long sum = 0L;
        sum += counter(r, g, b, 0, 1, 2);
        sum += counter(r, b, g, 0, 2, 1);
        sum += counter(g, r, b, 1, 0, 2);
        sum += counter(g, b, r, 1, 2, 0);
        sum += counter(b, g, r, 2, 1, 0);
        sum += counter(b, r, g, 2, 0, 1);
        System.out.println(sum);
    }
 
    private static Long counter(Integer[] a, Integer[] b, Integer[] c, Integer c1, Integer c2, Integer c3) {
        Long sum = 0L;
        int n = a.length;
        for(int i=0;i<n-2;i++){
            if(a[i]==0)continue;
            if(maxIndex[c1]<i)break;
            for(int j=i+1;j<n-1;j++){
                if(b[j]==0)continue;
                if(maxIndex[c2]<j)break;
                for(int k=j+1;k<n;k++){
                    if(maxIndex[c3]<k)break;
                    if(c[k]!=0){
                        sum += maxC[c3]-c[k]+1;
                        break;
                    }
                }
                if(j+(j-i)<n && c[j+(j-i)]!=0) sum--;
            }
        }
        return sum;
    }
}

Measured memory_bytes: 45904
N,Q = list(map(int,input().split()))
S = input()
L = []
R = []
for i in range(Q):
  l,r=list(map(int,input().split()))
  L.append(l)
  R.append(r)

dp = [0]*N
for j in range(N-1):
  if S[j]=='A' and S[j+1]=='C':
    dp[j+1] = dp[j]+1
  else:
    dp[j+1] = dp[j]

for k in range(Q):
  print(dp[R[k]-1]-dp[L[k]-1])

Measured memory_bytes: 19512
#include <iostream>

int main(){
    int H;
    int W;
    int h;
    int w;
    
    std::cin >> H >> W >> h >> w;
     
    if(H==h || W==w){
        std::cout<< 0 <<std::endl;
    }else if(H>h || W>w){
        std::cout<< (H-h)*(W-w) <<std::endl;
    }else{
        std::cout<< 1 <<std::endl;
    }
    return 0;
}

Measured memory_bytes: 256
import java.util.*;
import java.io.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner scan = new Scanner(System.in);
        String a = scan.next();
        String b = scan.next();
        PrintWriter out = new PrintWriter(System.out);
        
        Integer ll = a.length();
        Integer ans = 0;
        
        for (int i=0;i<ll;i++) {
            if (!a.substring(i,i+1).equals(b.substring(i,i+1))) {
                ans++;
            }
        }
        
        out.println(ans);
        out.close();
    }
}


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

ll N, A, B, C, D;
string S;

bool cont(int X, int Y) {
  for (int i = X; i <= Y - 1; i++) {
    if (S[i] == '#' && S[i + 1] == '#') {
      return false;
    }
  }
  return true;
}

void solve() {
  A--;
  B--;
  C--;
  D--;
  if (!cont(A, C) || !cont(B, D)) {
    cout << "No\n";

    return;
  }
  if (C < D) {
    cout << "Yes\n";
    return;
  } else {
    int marginL = B - 1;
    int marginR = D;
    bool can_excange = false;

    for (int i = marginL; i <= marginR - 1; i++) {
      if (S[i] == '.' && S[i + 1] == '.' && S[i + 2] == '.') {
        can_excange = true;
        break;
      }
    }

    if (can_excange) {
      cout << "Yes\n";
      return;
    } else {
      cout << "No\n";
      return;
    }
  }
}

int main() {
  cin >> N >> A >> B >> C >> D;
  cin >> S;
  solve();
  return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
using namespace std;
#define rep(i,x) for(ll i = 0; i < (ll)(x); i++)
#define pb push_back
#define eb emplace_back
#define debug(x) cerr << #x << ": " << (x) << "\n";
#define all(x) (x).begin(), (x).end()
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<vector<ll>>> vvvl;
const ll INF = numeric_limits<ll>::max()/4;
const ll MOD = 1e9+7;
const int n_max = 1e5+10;

int main(){
    ll n; cin >> n;
    vector<ll> vec(26,0);
    rep(i,n){
        string s;cin >> s;
        vec[s[0] - 'A']++;
    }
    string m = "MARCH";
    ll ans = 0;
    for(int i = 0;i < 3;i++){
        for(int j = i+1; j < 4;j++){
            for(int k = j+1; k < 5;k++){
                ans += vec[m[i] - 'A'] * vec[m[j] - 'A'] * vec[m[k] - 'A'];
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
import Control.Monad
import Data.Array
import qualified Data.ByteString.Char8 as BS
import Data.List
import Data.Maybe

readInt = fst . fromJust . BS.readInt

readIntList = map readInt . BS.words

getInt = readInt <$> BS.getLine

getIntList = readIntList <$> BS.getLine

disp :: Int -> Int -> Int -> Int
disp a b k
  | k <= a = b
  | otherwise = a

main = do
  n <- getInt
  xs <- getIntList
  let h = n `div` 2
  let xs' = sort xs
  let xs'' = listArray (1, n) xs'
  let a = xs'' ! h
  let b = xs'' ! (h + 1)
  mapM_ (print . (disp a b)) xs


Measured memory_bytes: 51228
S = str(input())

mae = "R"
cn = 0
R = [0]*len(S)
for i in range(len(S)):
    if S[i] == mae:
        cn += 1
    else:
        num = int(cn/2)
        if (cn % 2) == 0:
            R[i] = num
            R[i-1] = R[i-1] + num
            cn = 0
        else:
            R[i] = num
            R[i-1] = R[i-1] + num + 1
            cn = 0
mae = "L"
L = [0]*len(S)
for i in reversed(range(len(S))):
    if S[i] == mae:
        cn += 1
    else:
        num = int(cn/2)
        if (cn % 2) == 0:
            L[i] = L[i] + num
            L[i+1] = L[i+1] + num
            cn = 0
        else:
            L[i] = L[i] + num
            L[i+1] = L[i+1] + num + 1
            cn = 0

RESULT = [0]*len(S)
for i in range(len(S)):
    RESULT[i] = R[i] + L[i]
print(" ".join(map(str, RESULT)))

Measured memory_bytes: 12044
import java.util.*;

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

	if(500*K>=X){
      System.out.println("Yes");
    }else{
      System.out.println("No");
    }
}
}

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

a, b, c = map(int, input().split())

result = []
i = 1
while True:
    tmp = (a * i) % b
    if tmp not in result:
        result.append(tmp)
        i += 1
    else:
        break
if c in result:
    print('YES')
else:
    print('NO')

Measured memory_bytes: 2940
#include "bits/stdc++.h"
#include <boost/multiprecision/cpp_int.hpp>

using namespace std;
using boost::multiprecision::cpp_int;

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

int main() {
	int n;
	cin >> n;
	cpp_int nowa = 1, nowt = 1;
	for (int i = 0; i < n; i++) {
		long long ai, ti;
		cin >> ai >> ti;
		cpp_int firsta = nowa / ai;
		cpp_int firstt = nowt / ti;
		if (nowa % ai != 0) {
			firsta++;
		}
		if (nowt % ti != 0) {
			firstt++;
		}
		nowa = max(firsta,firstt) * ai;
		nowt = max(firsta, firstt) * ti;
	}
	cout << (nowa + nowt) << endl;
	
}

Measured memory_bytes: 256
import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline

n = int(readline())
a = list(map(int, readline().split()))

t = 1

for i in range(n):
    if a[i] == 0:
        print("0")
        exit()

for i in range(n):
    t = t * a[i]
    if t > 10**18:
        print("-1")
        exit()

print(t)


Measured memory_bytes: 19956
s=list(input())
t=list(input())

slist=[]
tlist=[]
#sとtそれぞれ、a～zがそれぞれ何個ずつあるか記録した配列。

for i in range(26):
  c=chr(i+ord("a"))
  temp1=s.count(c)
  temp2=t.count(c)
  slist.append(temp1)
  tlist.append(temp2)


sbetsu=[]
tbetsu=[]

for i in s:
  sbetsu.append(slist[ord(i)-97])
for i in t:
  tbetsu.append(tlist[ord(i)-97])



if sbetsu==tbetsu:
  print("Yes")
else:
  print("No")

Measured memory_bytes: 9776
import math

def first_try(num):
    list=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67]
    i=0
    tmp=int(math.sqrt(num))
    while True:
        if num in list:
            return True
        #その数を超えたら終了
        if list[i]>tmp or i==len(list)-1:
            return True
        
        if (num%list[i]==0):
            return False
        i+=1

while True:
    try:
        num=int(input())
    except:
        break

    #小さいの
    s=0
    while True:
        s+=1
        if first_try(num-s)==True:
            print(num-s,end=" ")
            break
    #大きいの
    l=0
    while True:
        l+=1
        if first_try(num+l)==True:
            print(num+l)
            break



Measured memory_bytes: 5664
#include <bits/stdc++.h>
#define pb          emplace_back
#define ll          long long
#define fi          first
#define se          second
#define mp          make_pair

using namespace std;

typedef pair<int, int> pii;
const int N = 102;
const int logN = 17;

pii p[N], cur;
int n;
ll res = 0;

int32_t main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    #define Task        "test"
    if(fopen(Task".inp", "r")) {
        freopen(Task".inp", "r", stdin);
        freopen(Task".out", "w", stdout);
    }
    cin >> n;
    for(int i = 1; i <= n; ++i) cin >> p[i].fi >> p[i].se;
    sort(p + 1, p + n + 1, [](const pii& x, const pii& y) {
            return atan2(x.fi, x.se) < atan2(y.fi, y.se);
         });
    for(int i = 1; i <= n; ++i) {
        cur = p[i]; res = max(res, 1ll * cur.fi * cur.fi + 1ll * cur.se * cur.se);
        for(int j = (i < n? i + 1: 1); j != i; j = (j < n? j + 1: 1)) {
            cur.fi += p[j].fi; cur.se += p[j].se;
            res = max(res, 1ll * cur.fi * cur.fi + 1ll * cur.se * cur.se);
        }
    }
    cout << fixed << setprecision(11);
    cout << sqrt((long double)res);
}


Measured memory_bytes: 1020
S = input()
N = len(S)
alr = set()

tmp = ""
prev = ""
i = 0
ans = 0
while i < N:
    tmp += S[i]
    if tmp != prev:
        prev = tmp
        ans += 1
        alr.add(tmp)
        tmp = ""
    i += 1

print(ans)



Measured memory_bytes: 9292
#include<stdio.h>
int main(void)
{
	int a, b, i, j, k;
	for (i = 0; ; i++) {
		scanf("%d %d", &a, &b);
		if (a == 0 && b == 0)
			return 0;
		for (j = 0; j < a; j++) {
			for (k = 0; k < b; k++) {
				if (j == 0 || k == 0 || k == b - 1 || j == a - 1)
					printf("#");
				else
					printf(".");
			}
			printf("\n");
		}
		printf("\n");
	}
	
	return(0);
}


Measured memory_bytes: 2044
#include<bits/stdc++.h>
using namespace std;
int main()
{
	string n,m;
	cin>>n;
	m=n;
	for(int i=0;i<n.length();++i){
		switch(m[n.length()-i-1]){
			case 'b':m[n.length()-i-1]='d';break;
			case 'd':m[n.length()-i-1]='b';break;
			case 'p':m[n.length()-i-1]='q';break;
			case 'q':m[n.length()-i-1]='p';break;
		}
		if(m[n.length()-i-1]!=n[i]){
			cout<<"No";return 0;
		}
	}
	cout<<"Yes";
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld ;
#define pb push_back
#define fi first
#define se second
const int N = 1e5+6;
const ll mod = 1e9+7;
void solve(){
    int n,m;
    cin>>n>>m;
    if(n==m)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}
int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
//    preprocess();
    int t =1;
//    cin>>t;
    while(t--)solve();
    return 0;
}




Measured memory_bytes: 256
#!/usr/bin/env python3

def main():
    N = int(input())
    A = list(map(int, input().split()))

    A.sort(reverse = True)
    e = []
    i = 0
    while i < N - 1:
        if A[i] == A[i + 1]:
            e.append(A[i])
            if len(e) == 2:
                print(e[0] * e[1])
                return
            i += 2
        else:
            i += 1


    print(0)


if __name__ == '__main__':
    main()



Measured memory_bytes: 14244
#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 k;
    cin >> k;
    vi a(k);
    rep(i, k) cin >> a[i];
    ll ansi = 2, ansx = 2;
    repr(i, k) {
        ansi = (ansi + a[i] - 1) / a[i] * a[i];
        ansx = ((ansx + a[i] - 1) / a[i] * a[i] + (a[i] - 1));
        if (i-1>=0) ansx = ansx / a[i-1] * a[i-1];
    }
    ll ansi2 = ansi, ansx2 = ansx;
    rep(i, k) {
        ansi2 -= ansi2 % a[i];
        ansx2 -= ansx2 % a[i];
    }
    if (ansi2!=2 && ansx2!=2) cout << -1 << endl;
    else {
        if (ansi2!=2) ansi = ansx;
        else if (ansx2!=2) ansx = ansi;
        printf("%lld %lld\n", ansi, ansx);
    }
    return 0;
}


Measured memory_bytes: 3752
#include <cstdio>
#include <iostream>
#include <string>
using namespace std;
int main()
{
    int n; cin >> n;
    string S; cin >> S;
    int ans = 0;
    for (int i = 0; i < n; ++i) {
        string s; cin >> s;
        int len = s.length();
        for (int j = 1; j < len; ++j) {
            for (int k = 0; k < len; ++k) {
                int cnt = 0;
                int idx = 0;
                int now;
                for (now = k; now < len; now += j) {
                    if (s[now] == S[idx]) {
                        idx++;
                        cnt++;
                    } else {
                        idx = cnt = 0;
                        break;
                    }
                    if (cnt == S.length()) {
                        ans++;
                        goto next;
                    }
                }
            }
        }
next:;
    }
    printf("%d\n", ans);
}

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

sumA = sum(A)
min_vote = sumA/(4*M)
exceed = 0
fl = False

for a in A:
    if a >= min_vote:
	    exceed += 1
    if exceed >= M:
	    fl = True
	    break

if fl:
    print("Yes")
else:
    print("No")

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

int main() {
double second;
double minute;
double hour;
cin >> second;
hour = second / 3600;
int hours = hour;
minute = ((second / 3600) - hours) * 60;
int minutes = minute;
second = ((((second / 3600) - hours) * 60) - minutes) * 60;
cout<< hours<< ":" << minutes << ":" << second << endl;
return 0;
}





Measured memory_bytes: 3272
#include <iostream>
#include <string>
#include <vector>

std::string odd = "RUD";
std::string even = "LUD";

bool isInOdd(char w){
  for(int i=0; i<3; i++){
    if(odd[i] == w)
      return true;
  }
  return false;
}

bool isInEven(char w){
  for(int i=0; i<3; i++){
    if(even[i] == w)
      return true;
  }
  return false;
}

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

  bool good_step = true;
  for(int i=0; i<S.size(); i++){
    if((i+1)%2 == 1){
      if(isInOdd(S[i])){
        continue;
      }else{
        good_step = false;
        break;
      }
    }else{
      if(isInEven(S[i])){
        continue;
      }else{
        good_step = false;
        break;
      }
    }
  }
  if(good_step)
    std::cout << "Yes" << std::endl;
   else
    std::cout << "No" << std::endl;
  return 0;
}

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

using namespace std;

int cnt, n;

void dfs(int depth, int pm, string t) {
	if(depth == 1) {
		dfs(depth + 1, pm + 1, "a");
		return ;
	}
	if(depth == n + 1) {
	    cout << t << endl;
		return ; 
	}
	for(register char i = 'a'; i < 'a' + pm; i++) {
		dfs(depth + 1, pm, t + i);
	}
	dfs(depth + 1, pm + 1, t + (char)('a' + pm));
}

int main() {
	cin >> n;
	dfs(1, 0, "");
	return 0;
}


Measured memory_bytes: 1536
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
using vll = vector<vl>;
using Pll = pair<ll, ll>;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(v) v.begin(), v.end()
#define sz(x) ((int) x.size())
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define F first
#define S second
const int MOD = 1e9+7;
const ll INF = 2e15;
template<class T> void print(const T& t){ cout << t << endl; }
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 gcd(int a,int b){return b?gcd(b,a%b):a;}

int main(){
  string s;
  cin >> s;
  vector<bool> dir(4, false);
  rep(i,sz(s)){
    if(s[i]=='E')dir[0] = true;
    else if(s[i]=='W')dir[1] = true;
    else if(s[i]=='S')dir[2] = true;
    else dir[3] = true;
  }
  if((dir[0]&&dir[1])&&(!dir[2]&&!dir[3])){
    print("Yes");
  }
  else if((!dir[0]&&!dir[1])&&(dir[2]&&dir[3])){
    print("Yes");
  }
  else if(dir[0]&&dir[1]&&dir[2]&&dir[3]){
    print("Yes");
  }
  else{
    print("No");
  }
}

Measured memory_bytes: 3604
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using db = double;
using ld = long double;
template<typename T> using V = vector<T>;
template<typename T> using VV = vector<vector<T>>;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define eb emplace_back
#define all(v) (v).begin(),(v).end()
#define siz(v) (ll)(v).size()
#define rep(i,a,n) for(ll i=a;i<(ll)(n);++i)
#define repr(i,a,n) for(ll i=n-1;(ll)a<=i;--i)
#define lb lower_bound
#define ub upper_bound
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
const ll mod = 1000000007;
const ll INF = 1000000099;
const ll LINF = (ll)(1e18 +99);
vector<ll> dx={-1,1,0,0},dy={0,0,-1,1};
template<typename T,typename U> void chmin(T& t, const U& u){if(t>u)t=u;}
template<typename T,typename U> void chmax(T& t, const U& u){if(t<u)t=u;}
template<typename T>T gcd(T a,T b){return b?gcd(b,a%b):a;}
template<typename T>T mpow(T a, T n) {
  T res = 1;
  for(;n;n>>=1) {
	if (n & 1) res = res * a;
	a = a * a;
  }
  return res;
}



signed main(){
  cin.tie(0);ios::sync_with_stdio(false);
  cout<<fixed<<setprecision(20);
  int x;cin>>x;
  rep(i,1,10000){
	  if(x-100*i>=0 && x-100*i<=5*i){
		  cout<<1<<endl;
		  return 0;
	  }
  }
  cout<<0<<endl;
}
//( ・ __ ・ ) KEEP BEING ORGANIZED
//CHECK overflow,vector_size,what to output?

Measured memory_bytes: 256
#include <fstream>
#include <iostream>
#include <iomanip>
#include <vector>
#include <cmath>
#include <string>
#include <algorithm>
#include <functional>
using namespace std;

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

int main() {
#ifdef CIN_FILE
	ifstream cin("sample.in");
	ofstream cout("sample.out");
#endif
	int res = 0;
	long long  n;
	cin >> n;
	while (n){
		n >>= 1;
		res++;
	}
	cout << res << endl;
	return 0;
}

Measured memory_bytes: 3096
#include<bits/stdc++.h>
using namespace std;
const int N=400005;
int ne[N],tot,fi[N],zz[N],Max[N],fa[N],ans[N],x,y,n,m;
void jb(int x,int y){
	ne[++tot]=fi[x];
	fi[x]=tot;
	zz[tot]=y;
}
void dfs(int x,int mx,int u,int se){
	mx=max(mx,x),se=max(x,se);
	Max[x]=mx;
	if (mx==x||se<=Max[fa[mx]])ans[mx]++;
	else ans[u]++;
	for (int i=fi[x];i;i=ne[i])
		if (zz[i]!=fa[x]){
			if (zz[i]==fa[x])continue;
			fa[zz[i]]=x;
			dfs(zz[i],mx,mx==x?zz[i]:u,mx==x?0:se);
		}
}
void dfs2(int x){
	ans[x]+=ans[fa[x]];
	for (int i=fi[x];i;i=ne[i])
		if (zz[i]!=fa[x])dfs2(zz[i]);
}
int main(){
	scanf("%d",&n);
	for (int i=1;i<n;i++){
		scanf("%d%d",&x,&y);
		jb(x,y);jb(y,x);
	}
	dfs(1,0,0,0);
	dfs2(1);
	for (int i=2;i<=n;i++)printf("%d ",ans[i]-1);
	puts("");
}


Measured memory_bytes: 22656
#include <iostream>
#include <vector>
#include <cstring>
#include <string>
#include <algorithm>
#include <iomanip>
using namespace std;

bool red[100001];
int num[100001];

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

	int N, M;
	cin >> N >> M;
	red[1] = true;
	for(int i = 1; i <= N; i++) {
		num[i] = 1;
	}

	for(int i = 0; i < M; i++) {
		int x, y;
		cin >> x >> y;
		if(red[x]) {
			if(num[x] == 1) {
				red[x] = false;
			}
			num[x]--;
			num[y]++;
			red[y] = true;
		}
		else {
			num[x]--;
			num[y]++;
		}
	}

	int ans = 0;
	for(int i = 1; i <= N; i++) {
		ans += red[i];
	}
	cout << ans << endl;
}

Measured memory_bytes: 768
#include<cstdio>
#include<iostream>
#include<string>
using namespace std;
string s;
long long int n,M=0,A=0,R=0,C=0,H=0;
long long int ans=0;
int main()
{
	ios::sync_with_stdio(false);
	cin>>n;
	for(int i=1;i<=n;++i)
	{
		cin>>s;
		if(s[0]=='M') ++M;
		if(s[0]=='A') ++A;
		if(s[0]=='R') ++R;
		if(s[0]=='C') ++C;
		if(s[0]=='H') ++H;
	}
	ans+=(M*A*R+M*A*C+M*A*H);
	ans+=(M*R*C+M*R*H+M*C*H);
	ans+=(A*R*C+A*R*H+A*C*H);
	ans+=(R*C*H);
	printf("%lld",ans);
	return 0;
}

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

#define PI 3.1415926535897932
#define MOD 1000000007
#define INF 1e9

#define REP(i, n) for(int i = 0; i < (n); i++)
#define REP1(i, n) for(int i = 1; i <= (n); i++)
#define FOR(i, start, end) for(int i = (start); i < (end); i++)
#define ALL(v) (v).begin(), (v).end()

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef vector<bool> vb;

int a, b, c;

void solve()
{
    cin >> a >> b >> c;
    if(b - a == c - b) cout << "YES" << endl;
    else cout << "NO" << endl;
}

int main()
{
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    solve();

    return 0;
}

Measured memory_bytes: 256
// #define _GLIBCXX_DEBUG // for STL debug (optional)
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;
using ll = long long int;
using int64 = long long int;
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const int INF = 1LL << 29;
const ll LONGINF = 1LL << 60;
const ll MOD = 1000000007LL;
 
int main() {
    int N; scanf("%d", &N);
    vector< vector<int> > G(N);

    vector<int> ans(N);
    for(int i=1; i<N; i++) {
        int v; scanf("%d", &v); v--;
        G[i].emplace_back(v);
        G[v].emplace_back(i);
        ans[v]++;
    }

    auto dfs = [&](auto &&self, int cur, int par) -> void {
        ans[cur] = 1;
        for(auto to : G[cur]) {
            if(to == par) continue;
            self(self, to, par);
        }
    };

    for(int i=0; i<N; i++) cout << ans[i] << endl;
    return 0;
}


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

#define IOS ios_base::sync_with_stdio(false); cin.tie(NULL);
#define ll long long
#define vi vector< int > 
#define pii pair< int, int >
#define mii map< int , int > 
#define F(start,stop) for(int i=start; i<stop; i++)
#define FRev(start,stop) for(int i=start; i>=stop; i--)
#define debugVector(v) for(int i = 0; it < v.size(); i++) cout << v[i] << " "; cout << endl;
#define debugArray(arr, n) for(int i=0; i<n; i++) cout << arr[i] << " "; cout << endl;
#define MOD1 1000000007
#define MOD2 998244353

int main()
{

	#ifndef ONLINE_JUDGE
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	#endif

	IOS

	string s,t;
	cin >> s >> t;

	int cnt = 0;

	for(int i=0; i<s.length(); i++){
		if(s[i] != t[i])
			cnt++;
	}

	cout << cnt << endl;
}

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

int main() {
  vector<vector<int>> c(3, vector<int>(3));
  rep(i, 3){
    rep(j, 3) cin >> c[i][j];
  }
  int n;
  cin >> n;
  vector<int> b(n);
  rep(i, n) cin >> b[i];
  bool a = 0;
  vector<vector<bool>> d(3, vector<bool>(3, 0));
  rep(i, 3){
    rep(j, 3){
      rep(k, n){
        if(b[k] == c[i][j]){
          d[i][j] = 1;
          break;
        }
      }
    }
  }
  rep(i, 3){
    bool e = 1, f = 1;
    rep(j, 3){
      if(!d[i][j]){
        e = 0;
        break;
      }
    }
    rep(j, 3){
      if(!d[j][i]){
        f = 0;
        break;
      }
    }
    if(e || f){
      a = 1;
      break;
    }
  }
  if((d[0][0] && d[1][1] && d[2][2]) || (d[0][2] && d[1][1] && d[2][0])) a = 1;
  if(a) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 256