akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;

namespace ABC121D
{
    public partial class Program
    {
        void Solve(StreamScanner ss, StreamWriter sw)
        {
            //---------------------------------
            var A = ss.Next(long.Parse);
            var B = ss.Next(long.Parse);

            var one = new [] {0L, 1L, 1L, 0L};
            var ans = one[(A + 3) % 4] ^ one[B % 4];

            for (var i = 2; i < 50; i++)
            {
                var b = 1L << i;
                var s = (A + b - 1) % b;
                var r = B % b;

                var sb = s < b >> 1 ? 0 : (s + 1) % 2;
                var rb = r < b >> 1 ? 0 : (r + 1) % 2;
                ans += (sb ^ rb) * b >> 1;
            }

            sw.WriteLine(ans);
            //---------------------------------
        }
    }

    public class StreamScanner
    {
        static readonly char[] Separator = { ' ' };
        readonly StreamReader streamReader;

        string[] line = new string[0];
        int index = 0;

        public StreamScanner(Stream stream)
        {
            this.streamReader = new StreamReader(stream);
        }

        public string Next()
        {
            return Next(s => s);
        }

        public string[] Next(int x)
        {
            return Next(s => s, x);
        }

        public string[][] Next(int x, int y)
        {
            return Next(s => s, x, y);
        }

        public T Next<T>(Func<string, T> parser)
        {
            if (index < line.Length) return parser(line[index++]);
            index = 0;
            line = streamReader.ReadLine()?.Split(Separator, StringSplitOptions.RemoveEmptyEntries);
            return Next(parser);
        }

        public T[] Next<T>(Func<string, T> parser, int x)
        {
            var ret = new T[x];
            for (var i = 0; i < x; ++i) ret[i] = Next(parser);
            return ret;
        }

        public T[][] Next<T>(Func<string, T> parser, int x, int y)
        {
            var ret = new T[y][];
            for (var i = 0; i < y; ++i) ret[i] = Next(parser, x);
            return ret;
        }
    }

    public partial class Program
    {
        static void Main()
        {
            Excute(Console.OpenStandardInput(), Console.OpenStandardOutput());
        }

        public static void Excute(Stream input, Stream output)
        {
            var ss = new StreamScanner(input);
            var sw = new StreamWriter(output);
            new Program().Solve(ss, sw);
            sw.Flush();
        }
    }
}

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

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

	int n, k, a[200000];
	cin >> n >> k;
	map<int, int> mp;
	int p[200010];
	for(int i = 0; i < 200010; i++){
		p[i] = 1145141919;
	}
	for(int i = 0; i < n; i++){
		cin >> a[i];
		mp[a[i]]++;
	}

	int cnt = 0;
	for(auto itr=mp.begin(); itr!=mp.end(); itr++){
		cnt++;
		p[itr->first] = itr->second;
	}
	// cout << cnt << endl;
	if(cnt <= k){
		cout << 0 << endl;
		return 0;
	}

	sort(p, p+200010);

	int ans = 0;
	for(int i = 0; i < cnt-k; i++){
		ans += p[i];
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 11136
#include <iostream>
#include <algorithm>
using namespace std;
 
int N, M;
int r, q;
class Record{
public:
  int t;
  int s;
  int n;
  int m;
  bool operator<(const Record &a) const {
    if(t != a.t) return t < a.t;
    if(s != a.s) return s < a.s;
    if(m != a.m) return m < a.m;
    return n < a.n;
  }
};
 
Record data[1000];
 
 
int solve(int &ts, int &te, int &m) {
  int i = 0;
  int state[1001];
  int ans = 0;
  Record tr[1000];
  int pr = 0;
  fill(state, state+1000, -1);
  int num = 0;
  for(i = 0; i < r; ++i) {
    if(data[i].m != m) continue;
    if(data[i].s) {
      ++num;
      if(num == 1) {
        tr[pr].s = 1;
        tr[pr].t = data[i].t;
        ++pr;
      }
    } else {
      --num;
      if(num == 0) {
        tr[pr].s = 0;
        tr[pr].t = data[i].t;
        ++pr;
      }
    }
  }
 
  for(i = 0; i < pr; ++i) {
    if(tr[i].s) {
      state[tr[i].n] = tr[i].t;
    } else {
      int tmp = state[tr[i].n];
      state[tr[i].n] = -1;
 
      if(tr[i].t < ts) continue;
      if(tmp > te) continue;
 
      if(tmp < ts && tr[i].t > te) ans += te - ts;
      else if(tmp < ts)              ans += tr[i].t - ts;
      else if(tr[i].t > te)        ans += te - tmp;
      else                           ans += tr[i].t - tmp;
    }
  }
  return ans;
}
 
main() {
  while((cin >> N >> M) && (N || M)) {
    cin >> r;
    for(int i = 0; i < r; ++i) {
      cin >> data[i].t >> data[i].n >> data[i].m >> data[i].s;
    }
    sort(data, data+r);
    cin >> q;
    for(int i = 0; i < q; ++i) {
      int ts, te, m;
      cin >> ts >> te >> m;
      cout << solve(ts, te, m) << endl;
    }
  }
}

Measured memory_bytes: 1200
n=int(input())


if n==1:
    print(1)
    exit()
    
if n==2:
    print(2)
    exit()
    
for i in range(n):
    if i+i**2>=2*n:
        check=i

        break

total=(1+check)*check//2
out=total-n

for i in range(1,check+1):
    if i!=out:
        print(i)


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

long long a[200007];
int main(){

   int n;

   cin >> n;
   for(int i = 0;i < n;i++){
        cin >> a[i];
   }
   long long x = a[0],y = a[n-1];
   int i = 1,j = n-2;
   while(i<=j){
        if(x<y) x+=a[i++];
        else y+=a[j--];
   }
   cout << abs(x-y);
}


Measured memory_bytes: 1792
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <math.h>
#include <string>
#include <numeric>
#include <queue>
#include <cstdio>
#include <cstring>
#define ll long long
#define rep(i,n) for(ll i=0;i<n;++i)
#define rep1(i,n) for(ll i=1;i<n;++i)
#define mrep(i,n) for(ll i=n;i>=0;--i)
#define all(a) (a).begin(),(a).end()
#define vl vector<ll>
#define vvl vector<vector<ll> >
#define vb vector<bool>
#define vvb vector<vector<bool> >
#define pl pair<ll,ll>
#define inf 1001001001001001000
//#define mod 1000000007
#define mod 998244353
#define pi 3.1415926535
using namespace std;
struct __INIT {
	__INIT() {
		cin.tie(0);
		ios::sync_with_stdio(false);
		cout << fixed << setprecision(15);
	}
}__init;


int main(void) {
	ll a;
	char u, n, c ,h;
	cin >> a >> u >> n >> c >>h;
	ll b = (u-'0') * 100 + (c - '0') * 10 + (h - '0');

	cout << (a*b)/100 << endl;
	return 0;
}


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


int main(){
  int N;
  cin >> N;
  vector<int>H(N);
  for(int i=0;i<N;i++){
    cin >> H[i];
  }
  int ans = 0;
  int H2 = 0;
  for(int i=0;i<N;i++){
    if(H[i]>=H2){
      ans++;
      H2=H[i];
    }
  }
  cout << ans << endl;
}
      


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <cstring>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <bitset>
#include <stack>
#include <cmath>
#define ll long long
#define LINF 0x3f3f3f3f3f3f3f3f
#define INF 0x3f3f3f3f
#define PI 3.14159265
using namespace std;
const int MAX = 1e5 + 10;
const ll MOD = 1e9 + 7;
int N, M, K, Q;
int P[MAX], cnt[MAX];
vector<ll> F[MAX];
int _find(int x) { return P[x] == x ? x : P[x] = _find(P[x]); }
void _union(int x, int y) { P[_find(y)] = _find(x); }
ll A[MAX];

int main()
{
	int i, j, k, u, v;
	scanf("%d%d", &N, &M);
	for (i = 0; i < N; ++i) P[i] = i;
	for (i = 0; i < N; ++i) scanf("%lld", &A[i]);
	for (i = 1; i <= M; ++i) {
		scanf("%d%d", &u, &v);
		_union(u, v);
	}
	for (i = 0; i < N; ++i) {
		cnt[_find(i)]++;
		F[_find(i)].push_back(A[i]);
	}
	vector<pair<int, int>> sz;
	for (i = 0; i < N; ++i) {
		if (cnt[i] == 0) continue;
		sz.push_back({ cnt[i], i });
		sort(F[i].begin(), F[i].end());
	}
	sort(sz.begin(), sz.end());
	reverse(sz.begin(), sz.end());
	priority_queue<ll> pq;
	for (i = 0; i < F[sz[0].second].size(); ++i) {
		pq.push(-F[sz[0].second][i]);
	}
	ll sum = 0;
	for (i = 1; i < sz.size(); ++i) {
		if (pq.empty()) {
			printf("Impossible");
			return 0;
		}
		ll a = -pq.top();
		pq.pop();
		sum += a + F[sz[i].second][0];
		for (j = 1; j < F[sz[i].second].size(); ++j) {
			pq.push(-F[sz[i].second][j]);
		}
	}
	printf("%lld", sum);
}

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

int main(){
    int t;
    int h;
    int m;
    int s;
    cin >> t;
    h = t/3600;
    m = (t%3600)/60;
    s = (t%3600)%60;
    cout << h <<":" << m <<":"<< s <<endl;
    return 0;
}


Measured memory_bytes: 3120
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		long k = sc.nextLong();
		sc.close();

		System.out.println(50);
		StringBuilder sb = new StringBuilder();
		long x = k / 50;
		long y = k % 50;
		for (int i = 0; i < 50; i++) {
			long v = i + x;
			if (i >= 50 - y) {
				v++;
			}
			sb.append(v).append(' ');
		}
		sb.deleteCharAt(sb.length() - 1);
		System.out.println(sb.toString());
	}
}


Measured memory_bytes: 25300
#include <bits/stdc++.h>
#define ALL(a)  (a).begin(),(a).end()
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<long long, long long> Pll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<long long> vll;
typedef vector<vector<long long>> vvll;
template <typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template <typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
const int INT_INF = 1 << 30;
#define MOD 1000000007LL
#define endl "\n"

ll ncr(ll n, ll r){
  if(n < r) return 0;
  if(r > n-r) r = n-r;

  ll a = 1, b = 1;
  for(int i = 0; i < r; i++){
    a *= (n - i);
  }
  for(int i = 0; i < r; i++){
    b *= (i + 1);
  }
  return a/b;
}

int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  ll N, P;
  cin >> N >> P;
  ll even = 0, odd = 0;
  for(int i = 0; i < N; i++){
    ll A;
    cin >> A;
    if(A % 2 == 0) even++;
    else odd++;
  }
  if(odd != 0) cout << (1LL << (N-1)) << endl;
  else cout << (P == 1? 0: (1LL << N)) << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define SORT(c) sort((c).begin(),(c).end());
#define pb push_back
#define MP make_pair
#define pii pair<int,int>
#define pcc pair<char,char>
#define pic pair<int,char>
#define pci pair<char,int>
#define VS vector<string>
#define VI vector<int>
#define VL vector < ll >
#define pi 3.141592653589793
#define ll long long
#define ull unsigned long long
#define w(x) int x;cin>>x;while(x--)
#define fast ios_base::sync_with_stdio(0)
#define sz size()
#define cu cout<<
#define en endl
#define sp " "
#include<cstdio>
#include<cstring>
void bug()
{
    cout << "here\n";
}
typedef unsigned long long UL;
template<typename T>inline T  S(T a)
{
    return a*a;
}
template<class T>inline string tostring(T a)
{
    ostringstream os("");
    os << a;
    return os.str();
}
template<typename T>inline ll tolong(T a)
{
    ll res;
    istringstream os(a);
    os>>res;
    return res;
}
template<typename T>inline T gcd(T a, T b)
{
    if (b == 0)return a;
    else return gcd(b, a % b);
}
template<typename T>inline T bigmod(T a, T b, T m)
{
    if (b == 0)return 1;
    else if (b % 2 == 0)return S(bigmod(a, b / 2, m)) % m;
    else return (a % m*bigmod(a, b - 1, m)) % m;
}
const int inf = (int)1e9 + 5;
const ll linf = (ll)1e16 + 5;
const ll modd = (ll)1e9 + 7;
const int mod = 10000007;
/*#define N 100000009
bool prime[N];
vector<ll> prm;
void seive ()
{
    memset(prime, true, sizeof(prime));

    for( ll i=2; i*i<=N; i++)
    {

        if (prime[i] == true)
        {
            for (ll j=i*i; j<=N; j += i)
                prime[j] = false;
        }
    }
    for (ll i=2; i<=N; i++)
    {
        if(prime[i]) prm.pb(i);
    }
}*/
void pr (int f)
{
    if(f==1)
        cout<<"YES\n";
    else
        cout<<"NO\n";
}
bool isprime(ll n)
{
    if(n<2) return 0;
    if(n==2) return 1;
    else
    {
        for(int i=2; i*i<=n; i++)
            if(n%i==0) return 0;
    }
    return 1;

}
ll countSum(ll x)
{
    ll res = 0;
    while (x != 0)
    {
        res += (x % 10);
        x /= 10;
    }
    return res;
}
ll power(ll a,ll b)
{
    if(b==0) return 1;
    if(b==1) return a;
    else
    {
        ll  res = power(a,b/2);
        if(b%2)
            return res * a*res;
        else
            return res*res;
    }
}
ll p [20005];
int main()
{
    fast;
    int n;
    cin >> n;
    int f=0,c = 0;
    for (int i=0;i<n;i++)
    {
        int a,b;
        cin >> a >>b;
        if(a==b)
        {
            c++;
        }
        else{
            c = 0;
        }
        if(c==3)
        {
            f = 1;
        }
    }
    if(f)
        cout <<"Yes\n";
        else
            cout <<"No\n";

}




Measured memory_bytes: 3648
#include<iostream>
#include<cstring>
#include<algorithm>
#include<queue>
#include<list>
#include<vector>
#include<cmath>

#define rep(i,a,b) for(int i=a;i<b;i++)

using namespace std;


int main(){
    string s, t;
    cin >> s >> t;

    bool flg = true;
    for(int i=0;i<s.length();i++){
        flg = true;
        for(int j=0;j<s.length();j++){
            if(s[(j+i)%s.length()]!=t[j])flg = false;
        }
        if(flg){
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
}


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <typeinfo>
#include <numeric>
#include <functional>
#include <unordered_map>
#include <bitset>
#include <stack>


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

const ll INF = 1e16;
const ll MOD = 1e9 + 7;

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








int main() {
    ll n;
    string a, b, c;
    cin >> n >> a >> b >> c;
    ll ans = 0;
    REP(i, n){
        if(a[i] == b[i] && b[i] == c[i] && c[i] == a[i]){
            continue;
        }
        else if(a[i] == b[i] || b[i] == c[i] || c[i] == a[i]){
            ans++;
        }
        else{
            ans += 2;
        }
    }
    cout << ans << endl;
}

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

using namespace std;
// #define int long long
mt19937 rnd(time(0));
typedef long long ll;
typedef long double ld;

// #define _GLIBCXX_DEBUG
#define f first
#define s second
#define pb push_back
#define pii pair<int, int> 
#define vi vector<int>
void solve(){
    int a, b, c;
    cin >> a >> b >> c;
    if (a + b + c >= 22) 
        cout << "bust" << endl;
    else
        cout << "win" << endl;
}

signed main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    
    int t = 1;
    while(t--){
        solve();
    }
    
    return 0;
}


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

bool digit_is_odd(int x)
{
    int digit = 0;
    while (x > 0)
    {
        x /= 10;
        digit++;
    }
    return (digit % 2) == 1;
}

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

    int ans = 0;
    for (int i = 1; i <= N; i++)
    {
        if (digit_is_odd(i))
        {
            ans++;
        }
    }
    cout << ans << endl;
}


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

#define rep(i,a,n)     for(int i=a;i<n;i++)
#define rep3(n)        for(int i=0;i<n;i++)
#define ll             long long
#define int            long long
#define pb             push_back
#define all(v)         v.begin(),v.end()
#define endl           "\n"
#define eb             emplace_back
#define x              first
#define y              second
#define gcd(a,b)       __gcd(a,b)
#define mem1(a)        memset(a,-1,sizeof(a))
#define mem0(a)        memset(a,0,sizeof(a))
#define pres(a,x)      a.find(x)!=a.end()
#define sz(a)          (int)a.size()
#define pii            pair<int,int>
#define hell           1000000007
#define elasped_time   1.0 * clock() / CLOCKS_PER_SEC
using namespace std;

template<typename T1,typename T2>istream& operator>>(istream& in,pair<T1,T2> &a){in>>a.fr>>a.sc;return in;}
template<typename T1,typename T2>ostream& operator<<(ostream& out,pair<T1,T2> a){out<<a.fr<<" "<<a.sc;return out;}
template<typename T,typename T1>T maxs(T &a,T1 b){if(b>a)a=b;return a;}
template<typename T,typename T1>T mins(T &a,T1 b){if(b<a)a=b;return a;}
template<int mod=hell>
struct mint{
  int m;
  mint():m(0){}
  mint(int m):m((m%mod+mod)%mod){}
  // mint(int m):m(m){}
  mint& fim() { m = (m%mod+mod)%mod; return *this;}
  mint operator-() const { return mint(0) - *this;}
  mint& operator+=(const mint& a){ if((m+=a.m)>=mod) m-=mod; return *this;}
  mint& operator-=(const mint& a){ if((m+=mod-a.m)>=mod) m-=mod; return *this;}
  mint& operator*=(const mint& a){ (m*=a.m)%=mod; return *this;}
  mint operator+(const mint& a)const{ return mint(*this) += a;}
  mint operator-(const mint& a)const{ return mint(*this) -= a;}
  mint operator*(const mint& a)const{ return mint(*this) *= a;}
  bool operator<(const mint& a)const{ return m < a.m;}
  bool operator==(const mint& a)const{ return m == a.m;}
  friend istream& operator>>(istream&i,mint&a){i>>a.m;return i;}
friend ostream& operator<<(ostream&o,const mint&a){o<<a.m;return o;}
};
mint<hell> dp[3001][3001];
mint<hell> pre[3001];
int solve(){
 int n;cin>>n;
 string s;cin>>s;
 bool a[n+1];
 for(int i=0;i<s.length();i++){
 	if(s[i]=='<')a[i+2]=1;
 	else a[i+2]=0;
 }
 dp[1][1]=1;
 for(int i=2;i<=n;i++){
 	pre[0]=0;
    for(int j=1;j<i;j++)pre[j]=pre[j-1]+dp[i-1][j];
 		for(int k=1;k<=i;k++){
 			if(a[i]){
 				dp[i][k]+=pre[k-1];
 			}
 			else{
 				dp[i][k]+=pre[i-1]-pre[k-1];
 			}
 		}
 }
 mint<hell> d;
 for(int i=1;i<=n;i++)d+=dp[n][i];
 	cout<<d<<endl;
 return 0;
}
signed main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    #ifdef sieve
    sieve();
    #endif
    #ifdef ncr
    init();
    #endif
    int t=1;//cin>>t;
    while(t--){
        solve();
    }
    return 0;
}
 

Measured memory_bytes: 70784
#include <stdio.h>
int main(){
  int x;
  int y;
  int z;
  scanf("%d", &x);
  scanf("%d", &y);
  scanf("%d", &z);

  int tmp;
  tmp = x;
  x = y;
  y = tmp;
  tmp = x;
  x = z;
  z = tmp;
  printf("%d %d %d", x, y, z);
}

Measured memory_bytes: 1732
import sys
input = sys.stdin.readline
enum = enumerate
inf = 1001001001

import collections
import random

def linput(ty=int, cvt=list):
	return cvt(map(ty,input().split()))

def gcd(a: int, b: int):
	while b: a, b = b, a%b
	return a

def lcm(a: int, b: int):
	return a * b // gcd(a, b)

def dist(x1,y1,x2,y2):
	return abs(x1-x2)+abs(y1-y2)

def ran():
	vRan = [random.randint(1,5) for i in range(8)]
	return vRan

def bye(res):
	sT = "No Yes".split()
	print(sT[res])
	#exit(0)

def main():
	N, = linput()
	vL = linput()
	
	res = 0
	if N<3: print(res); return

	for i,a in enum(vL[0:]):
		for j,b in enum(vL[i+1:]):
			if a==b: continue
			for k,c in enum(vL[i+j+1:]):
				if a==c or b==c: continue
				p,q,r = sorted([a,b,c])
				if not(p+q<=r):
					res += 1

	print(res)
	

if __name__ == "__main__":
	main()


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

int main(){
  int x1,y1,x2,y2,dx,dy;cin>>x1>>y1>>x2>>y2;
  dx=x2-x1;dy=y2-y1;
  int x3=x2-dy,y3=y2+dx,x4=x1-dy,y4=y1+dx;
  cout<<x3<<' '<<y3<<' '<<x4<<' '<<y4<<endl;
  return 0;
}


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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout<<setprecision(std::numeric_limits<float>::max_digits10);
  cout<<fixed;
  int n,m,c;
  cin>>n>>m>>c;
  vector<int> b(m);
  vector<vector<int>> a(n);
  rep(i,m)cin>>b[i];
  rep(i,n) {
    rep(j,m) {
      int A;
      cin>>A;
      a[i].push_back(A);
    }
  }
  int ans=0;
  rep(i,n) {
    int t=c;
    rep(j,m) {
      t+=a[i][j]*b[j];
    }
    if(t>0)ans++;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main(){
	while(1){
		int n; cin >> n;
		if(!n) return 0;
		vector<int>z;
		for(int i=0;i<n;i++){
			string a; cin >> a; z.push_back(a.size());
		}
		for(int i=0;i<n;i++){
			int cur = 0; int cnt = 0;
			for(int j=i;j<z.size();j++){
				cur += z[j];
				if(cur < 5) continue;
				if(cur > 7) goto fail;
				if(cur == 5 && (cnt==0||cnt==2)){
					cnt++; cur = 0;
				}
				else if(cur == 7 && (cnt==1||cnt==3||cnt==4)){
					cnt++; cur = 0;
				}
				if(cnt == 5){
					printf("%d\n",i+1); goto nxt;
				}
			}
		  fail:;
		}
	  nxt:;
	}
}

Measured memory_bytes: 3212
package main

import (
	"fmt"
	"io"
	"os"
)

func answer(reader io.Reader, writer io.Writer) {
	var h, w int
	_, _ = fmt.Fscan(reader, &h)
	_, _ = fmt.Fscan(reader, &w)
	a := make([][]int, h)
	var b = map[int]map[int]bool{}
	for i := 0; i < h; i++ {
		var s string
		_, _ = fmt.Fscan(reader, &s)
		a[i] = make([]int, w)
		b[i] = map[int]bool{}
		for j := 0; j < w; j++ {
			if string(s[j]) == "#" {
				a[i][j] = 1
				b[i][j] = true
			} else {
				a[i][j] = 0
			}
		}
	}
	c := 1
	for true {
		f := false
		//fmt.Printf("%v\n", a)
		//fmt.Printf("%v\n", b)
		for i := range b {
			for j := range b[i] {
				if a[i][j] == c+1 {
					continue
				}
				delete(b[i], j)
				if i > 0 && a[i-1][j] == 0 {
					a[i-1][j] = c + 1
					b[i-1][j] = true
					f = true
				}
				if j > 0 && a[i][j-1] == 0 {
					a[i][j-1] = c + 1
					b[i][j-1] = true
					f = true
				}
				if i < h-1 && a[i+1][j] == 0 {
					a[i+1][j] = c + 1
					b[i+1][j] = true
					f = true
				}
				if j < w-1 && a[i][j+1] == 0 {
					a[i][j+1] = c + 1
					b[i][j+1] = true
					f = true
				}
			}
		}
		if f == false {
			break
		}
		c++
	}
	_, _ = fmt.Fprintf(writer, "%d", c-1)
}

/*
func isNext(a [][]int, i int, j int, h int, w int, c int) bool {
	if i > 0 && a[i-1][j] > 0 && a[i-1][j] <= c {
		return true
	}
	if j > 0 && a[i][j-1] > 0 && a[i][j-1] <= c {
		return true
	}
	if i < h-1 && a[i+1][j] > 0 && a[i+1][j] <= c {
		return true
	}
	if j < w-1 && a[i][j+1] > 0 && a[i][j+1] <= c {
		return true
	}
	return false
}

func answer(reader io.Reader, writer io.Writer) {
	var h, w int
	_, _ = fmt.Fscan(reader, &h)
	_, _ = fmt.Fscan(reader, &w)
	a := make([][]int, h)
	for i := 0; i < h; i++ {
		var s string
		_, _ = fmt.Fscan(reader, &s)
		a[i] = make([]int, w)
		for j := 0; j < w; j++ {
			if string(s[j]) == "#" {
				a[i][j] = 1
			} else {
				a[i][j] = 0
			}
		}
	}
	c := 1
	for true {
		//fmt.Printf("%v\n", a)
		f := false
		for i := 0; i < h; i++ {
			for j := 0; j < w; j++ {
				if a[i][j] == 0 && isNext(a, i, j, h, w, c) == true {
					a[i][j] = c + 1
					f = true
				}
			}
		}
		if f == false {
			break
		}
		c++
	}
	_, _ = fmt.Fprintf(writer, "%d", c-1)
}
*/
func main() {
	answer(os.Stdin, os.Stdout)
}


Measured memory_bytes: 44800
#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string>
#include<algorithm>
#include<vector> 
#include<limits>
#include<numeric>
#include<type_traits>
#include<math.h>
using namespace std;
typedef long long ll;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i = (int)(a); i < (int)(b); i++)
#define in(x) cin >> x
#define out(str) cout << str << endl

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int a,b,ans[5];

int main(){
    rep(i,3){
        cin>>a>>b;
        ans[a]++;
        ans[b]++;
    }
    repi(i,1,5){
        if(ans[i]==1||ans[i]==2){
            continue;
        }
        else{
            out("NO");
            return 0;
        }
    }
    out("YES");
}


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

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		int C = sc.nextInt();
		int K = sc.nextInt();
		
		int[] x = {A, B, C};
		Arrays.sort(x);
		
		for(int i = 1; i <= K; i++) {
			x[2] *= 2;
		}
		
		System.out.println(x[0] + x[1] + x[2]);
		
	}
}


Measured memory_bytes: 23252
import numpy as np

X = int(input())

def get_primes(n):
    numbers = set(range(n, 1, -1))
    primes = []
    while numbers:
        p = numbers.pop()
        primes.append(p)
        numbers.difference_update(set(range(p*2, n+1, p)))
    return primes

primes = sorted(get_primes(110000))

print(primes[list(np.array(primes) >= X).index(True)])

Measured memory_bytes: 26080
n = int(input())
a = list(map(int, input().split()))
ans = 1
temp = a[0]
st = 0
if n == 1:
    print(ans)
else:
    for i in a[1:]:
        if st == 1:
            if i < temp:
                st = 0
                ans += 1
        elif st == -1:
            if i > temp:
                st = 0
                ans += 1
        else:
            if temp > i:
                st = -1
            elif temp < i:
                st = 1
        temp = i
    print(ans)

Measured memory_bytes: 14252
#include <bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
#define int long long
using namespace std;
typedef pair<int,int>P;
#define fi first
#define se second

int A,B,q;

signed main(){
    cin>>A>>B>>q;
    vector<int>a(A),b(B);
    r(i,A)cin>>a[i];
    r(i,B)cin>>b[i];
    sort(a.begin(),a.end());
    sort(b.begin(),b.end());
    r(p,q){
        int x;
        cin>>x;
        int ar=lower_bound(a.begin(),a.end(),x)-a.begin();
        int al=lower_bound(a.begin(),a.end(),x)-a.begin();al--;
        int br=lower_bound(b.begin(),b.end(),x)-b.begin();
        int bl=lower_bound(b.begin(),b.end(),x)-b.begin();bl--;

        if(ar!=A)ar=a[ar];
        if(al!=-1)al=a[al];
        if(br!=B)br=b[br];
        if(bl!=-1)bl=b[bl];

        vector<int>v;
        if(ar!=A&&br!=B)v.push_back(max(ar-x,br-x));
        if(al!=-1&&bl!=-1)v.push_back(max(x-al,x-bl));
        if(ar!=A&&bl!=-1)v.push_back((ar-x)*2+(x-bl));
        if(al!=-1&&br!=B)v.push_back((br-x)*2+(x-al));
        if(al!=-1&&br!=B)v.push_back((x-al)*2+(br-x));
        if(ar!=A&&bl!=-1)v.push_back((x-bl)*2+(ar-x));

        sort(v.begin(),v.end());
        cout<<v[0]<<endl;
    }
}

Measured memory_bytes: 2944
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <map>

using namespace std;

typedef unsigned long long int ULL;
typedef long long LL;
typedef long double LD;

int main()
{
	LL n;
	cin >> n;
	vector<LL> h(n);

	for (auto &e : h) {
		cin >> e;
	}

	vector <LL> bb(n);
	LL c = 0;
	for (int i = 0; i < n-1; ++i) {
		if (h[i] >= h[i+1]) {
			c++;
		}
		else {
			c = 0;
		}
		bb[i] = c;
	}
	bb[n-1] = 0;
	LL mx = 0;
	for (int i = 0; i < n; ++i) {
		mx = max(mx, bb[i]);
	}
	cout << mx << endl;
}

Measured memory_bytes: 1792
# 深さ優先探索してパスを返す
def DFS(L, s, t):
  S = [[s, 0]]
  P = [0] * T
  D = [0] * len(L)
  while S != []:
    k = S.pop()
    P[k[1]] = k[0]
    if L[k[0]][T - 1] > 0:
      P[k[1] + 1] = T - 1
      return P
    for i in range(len(L)):
      if D[i] == 0 and L[k[0]][i] > 0:
        S.append([i, k[1] + 1])
        D[i] = 1
  return False  

N = int(input())
ab = [list(map(int, input().split())) for i in range(N)]
cd = [list(map(int, input().split())) for i in range(N)]

T = 2 * N + 2
L = [[0] * T for i in range(T)]

# 0 -> s
# 1 ~ N -> red
# N + 1 ~ 2N -> blue
# 2N + 1 -> t

ab.sort()
cd.sort()
cnt = 0

# 書記設定
for i in range(0, N):
  L[0][i + 1] = 1
  L[N + 1 + i][T - 1] = 1
  for j in range(cnt, N):
    if ab[i][0] > cd[j][0]:
      cnt += 1
      continue
    if ab[i][1] < cd[j][1]:
      L[i + 1][N + 1 + j] = 1

while True:
  # s -> t のパスを一つ取得
  # パスがなければ終了
  P = DFS(L, 0, T - 1)
  if P == False:
    break
  # 流せる最大値を取得
  mi = 10 ** 20
  Last = T
  for i in range(1, Last):
    t = L[P[i - 1]][P[i]]
    if t < mi:
      mi = t
    if P[i] == T - 1:
      Last = i + 1
      break
  # リストを更新
  for i in range(1, Last):
    L[P[i - 1]][P[i]] -= 1
    L[P[i]][P[i - 1]] += 1

print(sum(L[-1]))

Measured memory_bytes: 3572
#include <iostream>

using namespace std;

long nCr(int n, int r) {
    long ans = 1;
    for (int i = n; i > n - r; --i) {
        ans = ans*i;
    }
    for (int i = 1 ; i < r + 1; ++i) {
        ans = ans / i;
    }
    return ans;
}

int main(void){
  int N, M;
  cin >> N >> M;

  int count = 0;

  count += nCr(N, 2);
  count += nCr(M, 2);

  cout << count << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
/*	#include <boost/math/common_factor.hpp>  boost::math::lcm(10,20) ---> use it to find lcm. fill_n(&an[0][0],n*m,0); typedef long long ll;*/
using namespace std;
#define IO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define int long long 
#define PI pair<int , int >
#define mpr make_pair
#define ff first
#define ss second
#define endl "\n"
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define FO(i,a,b) for(int i = (int)a;i < (int)b;++i)
#define FE(i,a,b) for(int i = (int)a;i <= (int)b;++i)
const int MOD = 1e9+7;
const int MAXN = 1e5+3;
int dx[] = {1,-1,0,0};
int dy[] = {0,0,-1,1};
#define print(x) cerr << #x << " is " << x << endl;
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << endl;
	err(++it, args...);
}
bool cmp(PI p1,PI p2){
	if(p1.ff < p2.ff)return true;	// You should not be writing p1.ss <= p2.ss !!!
	else if(p1.ff == p2.ff){ if(p1.ss < p2.ss)return true; return false; }
	return false;
}

void solve(){
	int s = 100;
	int x;
	cin >> x;
	
	int year = 0;
	while(s < x){
		year++;
		int tt = s/100;
		s += tt;
	}
	cout << year << endl;
}
/* When you have to multiply many things , do it in different (multiple) lines, not in a single line .*/
int32_t main(){
	IO;
	#ifndef ONLINE_JUDGE
	//freopen("input.txt", "r", stdin);
	#endif // ONLINE_JUDGE
	// std::cout << std::setprecision(15); std::cout << std::fixed;
	int nT = 1;
	//cin >> nT;
	FE(i,1,nT)
		solve();
	return 0;
}


Measured memory_bytes: 3640
#include<stdio.h>
#define MAX 100005
#define NIL -1
 
typedef struct{
  int parent, left, right;
}Node;
 
Node Tree[MAX];
int n, Depth[MAX];
 
int getDepth(int);
void print(int);
 
int child[MAX];
 
int main(void){
  int i, j;
  int degree, vertex;
 
  scanf("%d", &n);
 
  for ( i = 0; i < n; i++ ) {
    Tree[i].parent = NIL;
    Tree[i].left = NIL;
    Tree[i].right = NIL;
  }
 
  for ( i = 0; i < n; i++ ){
    scanf("%d %d", &vertex, &degree);
    for ( j = 0; j < degree; j++ ){
      scanf("%d", &child[j]);
 
      Tree[child[j]].parent = vertex;
       
      //right????±???????????????¨?????????
      if(j == 0)
    Tree[vertex].left = child[0];
       
      else
    Tree[child[j - 1]].right = child[j];
    }
  }
   
  for ( i = 0; i < n; i++ )
    Depth[i] = getDepth(i);
   
  for ( i = 0; i < n; i++ )
    print(i);
   
  return 0;
}
 
int getDepth(int u){
  int d = 0;
 
  while(Tree[u].parent >= 0){
    u = Tree[u].parent;
    d++;
  }
 
  return d;
}
 
void print(int u){
 
  int i, cnt = 0;
 
  printf("node %d: parent = %d, depth = %d, ",u,Tree[u].parent,Depth[u]);
 
  if(Tree[u].parent == NIL)
    printf("root, [");
 
  else if(Tree[u].left == NIL)
    printf("leaf, [");
 
  else
    printf("internal node, [");
 
  u = Tree[u].left;
  while(u != NIL){
    if(cnt == 0)
      printf("%d",u); 
 
    else
      printf(", %d",u);
   
    u = Tree[u].right;
    cnt++;
 
     
  
 }
 
 
    printf("]\n");
 
}

Measured memory_bytes: 2564
using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
class Program
{
    static void Main()
    {
        //入力
        //int[] input = Console.ReadLine().Split().Select(i => int.Parse(i)).ToArray();
        //string input= Console.ReadLine();
        int[] input = new int[3];
        for (int a = 0; a < 3; a++)
        {
            input[a] = int.Parse(Console.ReadLine());
        }
        //int input =int.Parse(input[0]+""+input[3+1]+""+input[3*2+2]);
        Console.WriteLine((input[0]-input[1])%input[2]);


        /*
        //処理速度計測
        var sw = new System.Diagnostics.Stopwatch();
        sw.Start();
        //解法
 
        //処理速度表示
        sw.Stop();
        TimeSpan ts = sw.Elapsed;
        Console.WriteLine((int)(Math.Floor((ts).TotalMilliseconds))+"ms");
        */
        Console.ReadLine();

    }
}

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

public class Main {
    static BufferedReader in;

    public static void solve() throws IOException {
        String s= in.readLine().trim();
        String t = in.readLine().trim();

        int slen = s.length();
        int tlen = t.length();

        int[][] dp = new int[tlen+1][slen+1];

        for(int i = 0;i<slen;i++){
            dp[0][i] = 0;
        }
        for(int i =0;i<tlen;i++){
            dp[i][0] = 0;
        }

        for(int i = 1;i<= tlen;i++){
            for(int j = 1;j<=slen ;j++){
                dp[i][j] = Math.max(dp[i-1][j],dp[i][j-1]);
                if(t.charAt(i-1) == s.charAt(j-1)){
                    dp[i][j] = dp[i-1][j-1]+1;
                }
            }
        }




//        for(int[] arr : dp){
//            System.out.println(Arrays.toString(arr));
//        }
        StringBuilder ans = new StringBuilder();
        int i = tlen,j= slen;
        while(dp[i][j]!=0){
            if(t.charAt(i-1) == s.charAt(j-1)) {
                ans.insert(0, t.charAt(i - 1));
                i--;
                j--;
            }
            else if(dp[i-1][j] > dp[i][j-1]){
                i--;
            }
            else{
                j--;
            }
        }

        System.out.println(ans.toString());




    }




    public static void main(String[] args) throws IOException {
        in = new BufferedReader(new InputStreamReader(System.in));
        solve();
    }

    static int nextInt() throws IOException {
        return Integer.parseInt(in.readLine().trim());
    }

    static long nextLong() throws IOException {
        return Long.parseLong(in.readLine().trim());
    }

    static Integer[] nextArray(int n) throws IOException {
        StringTokenizer st = new StringTokenizer(in.readLine());
        Integer[] tmp = new Integer[n];
        for (int i = 0; i < tmp.length; i++) {
            tmp[i] = Integer.parseInt(st.nextToken());
        }

        return tmp;
    }

}



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

using namespace std;
using ll = unsigned long long;
constexpr int mod = 1e9+7;
constexpr int md = mod;
int main(){
    ll r,d,x;
    cin>>r>>d>>x;
    for(int i=0;i<10;++i){
        x = r* x - d;
        cout << x << endl; 
    }
    return 0;
}



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

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

     if(S.size() > K){
         cout << S.substr(0, K) + "..." << endl;
     }else{
        cout << S << endl;
     }
}



Measured memory_bytes: 3636
#include<iostream>
#include<assert.h>
#include<vector>

using namespace std;

int main(void) {
    int n,m;
    cin >> n >> m;
    vector<bool> vis(n+1, false);
    bool ans = false;
    for (int i=0; i<m; i++) {
        int a,b;
        cin >> a >> b;
        assert(1<=a && a<b && b <= n);
        if (!ans) {
            if (a==1) {
                if (vis[b]) {
                    ans = true;
                }
                vis[b] = true;
            } else if (b==n) {
                if (vis[a]) {
                    ans = true;
                }
                vis[a] = true;
            }
        }
    }
    if (!ans) cout << "IM";
    cout << "POSSIBLE" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include<cstring>
int main()
{
	char str[100];
	std::cin >> str;
	int s=0,b=strlen(str);

	for (int i = 0; i < b/2; i++) 
		if (str[i] != str[b-i-1])s++;
	
	
	std::cout <<  s << std::endl;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
using ll = long long;
using vec = vector<char>;
using vec2 = vector<vector<ll>>;
ll inf = pow(2,62);

int main(){
    string n;
    cin >> n;
    if(n.at(0) == '7' || n.at(1) == '7' || n.at(2) == '7'){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}

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

#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rep2(i,s,n) for(int i = (s); i < (n); ++i)
#define ll long long
#define ld long double
#define P pair<ll,ll>
#define all(v) v.begin(),v.end()

const ll mod = 1e9+7;
const ll INF = 1e18;
const double pi = acos(-1.0);

int main(void)
{
    string s; cin>>s;
    map<char,ll> mp;
    rep(i,s.size()) mp[s[i]]++;
    rep(i,26){
        if(!mp['a'+i]){
            cout<<(char)('a'+i)<<endl;
            return 0;
        } 
    }
    cout<<"None"<<endl;
    return 0;
}

Measured memory_bytes: 3744
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>

using namespace std;

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

	int ans = min(c, b / a);
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define P 1000000007
using namespace std;
template <class T> inline void read(T &x) {
	x = 0; int c = getchar(), f = 1;
	for (; !isdigit(c); c = getchar()) if (c == 45) f = -1;
	for (; isdigit(c); c = getchar()) (x *= 10) += f*(c-'0');
}
int n, m;
int f[1005][1005];
char s[1005][1005];
int main() {
	read(n), read(m), f[0][1] = 1;
	for (int i = 1; i <= n; i++)
		scanf("%s", s[i]+1);
	for (int i = 1; i <= n; i++)
		for (int j = 1; j <= m; j++)
			if (s[i][j] == '.')
				f[i][j] = (f[i-1][j]+f[i][j-1])%P;
	return printf("%d\n", f[n][m]), 0;
}


Measured memory_bytes: 5120
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort(reverse=True)
    return divisors

N, K = map(int,input().split())
A = list(map(int,input().split()))

for d in make_divisors(sum(A)):
  if d==1:
    print(d)
    exit()
  A_ = [a%d for a in A if a%d]
  if max(A_)+K < d:
    continue  
  A_.sort()
  lSum, rSum = 0, 0
  K_need = 1e9
  for a in A_:
    rSum += d - a
  for a in A_:
    lSum += a
    rSum -= d - a
    K_need = min(K_need, max(lSum,rSum))
  if K_need <= K:
    print(d)
    exit()
  

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

#define ALL(v) v.begin(), v.end()
#define V vector
#define P pair
using ll = long long;
using ld = long double;
const int MOD = 1e9+7;
const ll INF = 1LL << 60;


int main() {
    int x; cin >> x;

    int y = x % 100;
    int z = x / 100;

    if(y / 5 <= z){
        z -= y / 5;
        y %= 5;
    }
    if(y / 4 <= z){
        z -= y / 4;
        y %= 4;
    }
    if(y / 3 <= z){
        z -= y / 3;
        y %= 3;
    }
    if(y / 2 <= z){
        z -= y / 2;
        y %= 2;
    }
    if(y <= z){
        z -= y;
        y = 0;
    }
    if(y == 0) cout << 1 << endl;
    else cout << 0 << endl;


    return 0;
}


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

int main()
{
  int n, a, b;
  cin >> n;
  vector<int> v(n);
  int64_t s{0};
  int64_t ans{0};

  for (auto i = 0; i < n; i++) {
    cin >> a >> b;
    v[i] = a + b;
    s += b;
  }
  sort(begin(v), end(v), greater<>());
  for (auto i = 0; i < n; i += 2) {
    ans += v[i];
  }
  cout << ans - s << endl;
}


Measured memory_bytes: 640
import sys
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7

def main():
    X, Y = map(int, readline().split())
    a = (4*X-Y)/2
    b = (Y-X*2)/2
    if a.is_integer() and a>=0 and b.is_integer() and b>=0:
        print('Yes')
    else:
        print('No')

if __name__ == '__main__':
    main()


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

#define ll long long
#define all(x) (x).begin(), (x).end()
const long long INF = 1LL << 60;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)  //(i, 10) i=0～i=9まで
#define repr(i, n) for (int i = n; i >= 0; i--)   // (i, 10) i=10～i=0まで
#define FOR(i, m, n) for (int i = m; i < n; i++)  // (i, 3, 10) i=3～i=9まで

// 総数を1000000007で割った余り
const long long mod = 1e9 + 7;

int main() {
    // cin.tie(0);
    // ios::sync_with_stdio(false);
    // cout << fixed << setprecision(5);

    // 入力
    int r, g, b;
    cin >> r >> g >> b;

    // 処理
    // 出力
    cout << ((g * 10 + b) % 4 == 0 ? "YES" : "NO ") << endl;

    return 0;
}


Measured memory_bytes: 256
#include<atcoder/dsu>
#include<iostream>
int main(){int N,Q,t,u,v,q=0;std::cin>>N>>Q;atcoder::dsu d(N);for(;q<Q;q++){std::cin>>t>>u>>v;if(t)std::cout<<d.same(u,v)<<std::endl;else d.merge(u,v);}}

Measured memory_bytes: 3888
function Main(input) {
input = input.split("\n");
aa = input[0].split(" ");
p = input[1].split(" ");

var x = parseInt(aa[0], 10);
var n = parseInt(aa[1], 10);
  
  for (var i = 0; i < n; i++) {
   p[i]=parseInt(p[i], 10);
  }  

for (var i = 0; i < 101; i++) {
 var s = x - i
 var r = x + i
 
 if (p.indexOf( s ) == -1){
  var result = s;
   break;
   
  } else if (p.indexOf( r ) == -1){
  var result = r;
   break;
  
  } else {
    }
 }
console.log(result);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 29644
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll P;
struct BIT{
  int n,bit[(1<<17)+2];

  void init(int _n ){
    memset(bit,0,sizeof(bit));
    n = _n;
  }

  void add(int i,int x){
    while( i <= n ){
      bit[i] += x;
      bit[i] %= P;
      i += i & -i;
    }
  }

  int sum(int i){
    int s = 0;
    while( i > 0 ) {
      s += bit[i];
      s %= P;
      i -= i & -i;
    }
    return s;
  }

};
int A,B;
BIT dp;
int D[100011];
string s[100011];
int main(){

  while( cin >> A >> B >> P && (A||B||P) ){
    memset(D,-1,sizeof(D));
    int N = B-A+1;
    
    dp.init(N+1);

    for(int i=A;i<=B;i++){
      stringstream sin; sin << i;
      s[i-A] = sin.str();
    }
    sort(s,s+N);
    for(int i=0;i<N;i++){
      stringstream sin(s[i]);
      int d; sin >> d;
      D[d-A] = i;
    }
    D[N] = N;

    for(int i=0;i<N;i++){
      ll num = dp.sum(D[i]);
      dp.add(D[i]+1,(num+1)%P);
    }
    cout << dp.sum(N)%P << endl;
  }
}

Measured memory_bytes: 7624
#include <bits/stdc++.h>
#define REP(i, n) for (int i{ 0 }; i < n; ++i)
#define REP2(i, s, n) for (int i{ s }; i < n; ++i)
#define DREP(i, n) for (int i{ n - 1 }; i <= 0; --i)
#define repa(arr) for (auto& e : arr)
#define DEB(x) (std::cerr << __LINE__ << ": x = " << x << std::endl)
#define DEBa(x) repa(x) DEB(e)

using namespace std;

int main() {
    int N;
    cin >> N;
    std::vector<bool> D(N);

    int cnt{ 0 };
    REP(i,N){
        int d0, d1;
        cin >> d0 >> d1;
        D.at(i) = (d0 == d1);
        if (cnt < 3) {
            if (D.at(i))
                cnt++;
            else
                cnt = 0;
        }
    }

    if (cnt == 3)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}


Measured memory_bytes: 3616
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define INF 100000000
#define rep(i,s,n) for (int i = (int)(s); i < (int)(n); i++)
#define mp make_pair
ll mod = 1000000007;
ll mod2 = 998244353;

int main(){
	int n,m;cin>>n>>m;
    vector<int> G[n+10];
    vector<int> ma(n+10,-1);
    queue<pair<int,int>> que;
    que.push({1,0});
    rep(i,0,m){
        int a,b;cin>>a>>b;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    while (que.size()){
        pair<int,int> q = que.front(); que.pop();
        if (ma[q.first]!=-1) continue;
        ma[q.first] = q.second;
        for (int nex : G[q.first]){
            que.push({nex,q.first});
        }
    }
    rep(i,1,n+1){
        if (ma[i]==-1) {
            cout<<"No"<<endl;
            return 0;
        }
    }
    cout<<"Yes"<<endl;
    rep(i,2,n+1){
        cout<<ma[i]<<endl;
    }
}

Measured memory_bytes: 15588
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
#include<string>
#include<vector>
#include<stack>
#include<bitset>
#include<cstdlib>
#include<cmath>
#include<set>
#include<list>
#include<deque>
#include<map>
#include<queue>
#include<sstream>
using namespace std;
typedef long long LL;
const int INF = 0x3f3f3f3f;
const int MAXN = 1e5 + 5;
int counts = 1,maxn = -INF;
int head[MAXN];
struct node{
	int to;
	int next;
	int color;
}edge[MAXN];

void addedge(int a,int b)
{	
	edge[counts].to = b;
	edge[counts].color = 0;
	edge[counts].next = head[a];
	head[a] = counts++;
}

void dfs(int u,int c)
{
	int tmp = 1;
	for(int i = head[u];i != 0;i = edge[i].next){
		int v = edge[i].to;
		if(tmp == c)
			tmp++;
		edge[i].color = tmp;
		maxn = max(maxn,tmp);
		dfs(v,tmp);
		tmp++;
	}
}

int main()
{
	int n;
	cin >> n;
	for(int i = 0;i < n - 1;i++){
		int a,b;
		scanf("%d %d",&a,&b);
		addedge(a,b);
	}
	dfs(1,0);
	printf("%d\n",maxn);
	for(int i = 1;i < counts;i++){
		printf("%d\n",edge[i].color);
	}
	return 0;
}


Measured memory_bytes: 3968
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define yesno(flg) if(flg){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define MAX_N 1002
#define i197 1000000007

using namespace std;

typedef long long ll;
typedef pair<ll,ll> P1;
typedef pair<int,int> Pi;
typedef pair<double,Pi> Pdi;
typedef pair<ll,int>Pli;
typedef pair<P1,ll> P2;
const ll INF=1000000000000000001;
struct edge{int to,cost;};
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
struct Road{double cost;int a,b;};

char a[1001][1001];
int dp[1002][1002]={};
int main(){

	int h,w;
	cin>>h>>w;

	rep(i,h){
		rep(j,w){
			cin>>a[j+1][i+1];
		}
	}
	dp[1][0]=1;
	rep(i,h){
		rep(j,w){
			dp[j+1][i+1]=dp[j][i+1];
			dp[j+1][i+1]+=dp[j+1][i];
			dp[j+1][i+1]%=1000000007;
			if(a[j+1][i+1]=='#')dp[j+1][i+1]=0;
		}
	}
	cout<<dp[w][h]<<endl;

	return 0;

}


Measured memory_bytes: 5120
#include <stdio.h>
#include <string.h>
#include <ctype.h>

#define BUFFER  128
#define ROTATE(C) \
  ( islower ( (C) ) ? ( (C) == 'z' ? 'a' : (C) + 1 ) \
                    : (C) )

int find (
  const char  *src,
  const char  *s
  )
{
  size_t  len = strlen ( s );
  char  * t;

  while ( ( t = strstr ( src, s ) ) != NULL )
  {
    if ( !islower ( t[ -1 ] ) && !islower ( t[ len ] ) )
    {
      return ( 1 );
    }

    src = t + 1;
  }

  return ( 0 );
}

void rotate (
  char *s
  )
{
  do
  {
    *s = ROTATE( *s );
  }
  while ( *( ++s ) != '\0' );

  return ;
}

/** Application main entry point. */
int main (
  int     argc,
  char  * argv[ ]
  )
{
  char __s[ BUFFER ];
  char * const s = __s + 1;
  *__s = ' ';

  while ( fgets ( s, BUFFER, stdin ) != NULL )
  {
    int i;

    for ( i = 0; i < 26; ++i )
    {
      if ( find ( __s, "the" )
        || find ( __s, "this" )
        || find ( __s, "that" ) )
      {
        break ;
      }

      rotate ( s );
    }

    fputs ( s, stdout );
  }

  return ( 0 );
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[])
{
    long n;
    string s;

    cin >> n;
    long a = 0;
    long b = 0;
    long c = 0;
    long d = 0;
    for (long i = 0; i < n; i++)
    {
        cin >> s;

        if (s == "AC")
        {
            a++;
        }
        if (s == "WA")
        {
            b++;
        }
        if (s == "TLE")
        {
            c++;
        }
        if (s == "RE")
        {
            d++;
        }
    }
    cout << "AC x " << a << endl;
    cout << "WA x " << b << endl;
    cout << "TLE x " << c << endl;
    cout << "RE x " << d << endl;
    return 0;
}


Measured memory_bytes: 3624