akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
#include<math.h>
#include<iostream>
#include<algorithm>
#include<string.h>
using namespace std;
bool f[200],s[200];
int main()
{
	int n;
	int h;
	int m=0;
	scanf("%d",&n);
	char a[200];
	scanf("%s",a);
	memset(f,false,sizeof(f));
	for(int i=0;i<n;i++)
	{
		f[a[i]-'a']=true;
		memset(s,false,sizeof(s));
		for(int j=i+1;j<n;j++)
		{
			s[a[j]-'a']=true;
		}
		h=0;
		for(int j=0;j<26;j++)
		{
			if(f[j]==true&&s[j]==true)
			{
				h++;
			}
		}
		m=max(m,h);
	}
	printf("%d\n",m);
	return 0;
} 

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String args[]){
		Scanner scan = new Scanner(System.in); 
		
		int x = scan.nextInt();
		int n[] = new int[x];
		int min, max;
		long sum;
		
		for(int i = 0; i < x; i++){
			n[i] = scan.nextInt();
		}
		
		min = n[0];
		max = n[0];
		sum = 0;
		
		for(int i = 0; i < x; i++){
			if(max < n[i]){
				max = n[i];
			}
			if(min > n[i]){
				min = n[i];
			}
			sum += n[i];
		}
		
		System.out.println(min + " " + max + " " + sum);
	}
}

Measured memory_bytes: 42040
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();
		String t = sc.next();
		sc.close();
		for(int i = 0; i < N; i++) {
			boolean flag = true;
			for(int j = 0; j + i < N; j++) {
				char cs = s.charAt(j + i);
				char ct = t.charAt(j);
				if(cs != ct) {
					flag = false;
					break;
				}
			}
			if(flag) {
				System.out.println(N + i);
				break;
			}
			if(i == N - 1) {
				System.out.println(2 * N);
			}
		}
	}
}

Measured memory_bytes: 23764
#include <stdio.h>

int main()
{
    int a,b;
    scanf("%d %d", &a, &b);
    if(a == b){
        printf("Draw");
    }
    else if(a == 1){
        printf("Alice");
    }
    else if(b == 1){
        printf("Bob");
    }
    else if(a<b){
        printf("Bob");
    }
    else{
        printf("Alice");
    }
}


Measured memory_bytes: 128
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <random>
#include <bitset>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
#define rep(i,n) for (int i=0; i<n;++i)
typedef long long ll;
using namespace std;
const ll MOD = 1000000007LL;
int A, B;

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

  cin >> A >> B;
  if ((A-B)%2){
    cout << "IMPOSSIBLE"<< endl;  
    return 0;  
  }
  if (A > B){
    cout << B + (A-B)/2 << endl;
  }else{
    cout << A + (B-A)/2 << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define rep(i,N) for(int i = 0; i < (N); i++)
#define erep(i,N) for(int i = N; i >= 0; i--)
#define PI 3.1415926535

template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true;} return false;}

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true;} return false;}

char upper(char c){
    if('a' <= c && c <= 'z'){
        c = c - ('a' - 'A');
    }
    return c;
}

char lower(char c){
    if('A' <= c && c <= 'Z'){
        c = c + ('a' - 'A');
    }
    return c;
}

const ll INF = 1000000000000000000;

//input
ld A,B,H,M;

//processing


//dpTable
int dp[100050];

int main(){
    cin >> A >> B >> H >> M;
    ld angle = min(abs(30 * H - 5.5 * M),360 - abs(30 * H - 5.5 * M));
    angle = (angle / 180) * PI;
    ld c = A * A + B * B - 2 * A * B * cos(angle);
    c = sqrt(c);
    cout << setprecision(10) << c << endl;
}

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

bool prime(int n) {
    switch (n) {
        case 1: return false;
        case 2: return true;
    }
    if (n % 2 == 0) return false;
    int j = sqrt(n);
    for (int i=3; i <= j; i++) {
        if (n % i == 0) return false;
    }
    return true;
}

int main()
{
    int x;
    cin >> x;
    int i = x; 
    while (true) {
        if (prime(i)) {
            cout << i << endl;
            return 0;
        }
        i++;
    }
}


Measured memory_bytes: 256
n = int(input())
lst = list(map(int, input().split()))
# dct = {}
# for i in range(n):
#     dct[i] = lst[i]

# ans = sorted(dct.items(), key = lambda x : x[1])
# if ans[1][0]==2:
   
cnt = 0
for i in range(n-2):
    if lst[i] < lst[i+1] < lst[i+2]\
    or lst[i] > lst[i+1] > lst[i+2]:
        cnt += 1
        
print(cnt)

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

#define forn(i, n) for (int i = 0; i < int(n); ++i)
#define for1(i, n) for (int i = 1; i <= int(n); ++i)
#define ms(a, x) memset(a, x, sizeof(a))
#define F first
#define S second
#define all(x) (x).begin(),(x).end()
#define pb push_back

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int INF = 0x3f3f3f3f;
mt19937 gen(chrono::steady_clock::now().time_since_epoch().count());
template<typename... Args> void rd(Args&... args) {((cin >> args), ...);}
template<typename... Args> void wr(Args... args) { ((cout << args << " "), ...); cout<<endl;}

template <int MOD>
struct ModInt {
    int val;
    // constructor
    ModInt(ll v = 0) : val(int(v % MOD)) {
        if (val < 0) val += MOD;
    };
    operator int(){return val;}
    // unary operator
    ModInt operator+() const { return ModInt(val); }
    ModInt operator-() const { return ModInt(MOD - val); }
    ModInt inv() const { return this->pow(MOD - 2); }
    // arithmetic
    ModInt operator+(const ModInt& x) const { return ModInt(*this) += x; }
    ModInt operator-(const ModInt& x) const { return ModInt(*this) -= x; }
    ModInt operator*(const ModInt& x) const { return ModInt(*this) *= x; }
    ModInt operator*(const int& x) const { return ModInt(*this) *= (ModInt)x; }
    ModInt operator/(const ModInt& x) const { return ModInt(*this) /= x; }
    ModInt pow(ll n) const {
        auto x = ModInt(1);
        auto b = *this;
        while (n > 0) {
            if (n & 1) x *= b;
            n >>= 1;
            b *= b;
        }
        return x;
    }
    // compound assignment
    ModInt& operator+=(const ModInt& x) {
        if ((val += x.val) >= MOD) val -= MOD;
        return *this;
    }
    ModInt& operator-=(const ModInt& x) {
        if ((val -= x.val) < 0) val += MOD;
        return *this;
    }
    ModInt& operator*=(const ModInt& x) {
        val = int(ll(val) * x.val % MOD);
        return *this;
    }
    ModInt& operator/=(const ModInt& x) { return *this *= x.inv(); }
    // compare
    bool operator==(const ModInt& b) const { return val == b.val; }
    bool operator!=(const ModInt& b) const { return val != b.val; }
    // I/O
    friend std::istream& operator>>(std::istream& is, ModInt& x) noexcept { return is >> x.val; }
    friend std::ostream& operator<<(std::ostream& os, const ModInt& x) noexcept { return os << x.val; }
};
typedef ModInt<998244353> mint;
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n,m,k;
    cin>>n>>m>>k;
    vector<mint> fac(n+1);
    fac[0]=1;
    for1(i,n){
        fac[i]=fac[i-1]*i;
    }
    mint ans=0;
    for(int i=n-k;i<=n;i++){
        mint par=fac[n-1]/fac[n-i]/fac[i-1];
        ans+=par*m*mint(m-1).pow(i-1);
    }
    cout<<ans;
    return 0;
}



Measured memory_bytes: 4020
# ABC089C - March
from itertools import combinations as comb


def main():
    N, *S = open(0).read().split()
    cnt = [sum(s.startswith(i) for s in S) for i in "MARCH"]
    ans = sum(x * y * z for x, y, z in comb(cnt, 3))
    print(ans)


if __name__ == "__main__":
    main()

Measured memory_bytes: 10864
#include "bits/stdc++.h"
using namespace std;

#define pb  push_back
#define mp  make_pair
#define ll  long long
#define itr iterator

typedef pair<ll,ll> pii;

const ll MAX=2e5+9;
const ll INF=1e12;

string X;

signed main()
{
	ios_base::sync_with_stdio(false);

	cin>>X;
	if(X[X.size()-1]=='2' or X[X.size()-1]=='4' or X[X.size()-1]=='5' or X[X.size()-1]=='7' or X[X.size()-1]=='9')
		cout<<"hon";
	if(X[X.size()-1]=='0' or X[X.size()-1]=='1' or X[X.size()-1]=='6' or X[X.size()-1]=='8')
		cout<<"pon";
	if(X[X.size()-1]=='3')
		cout<<"bon";
	return 0;
}

Measured memory_bytes: 3668
N,Q = map(int,input().split())
S = list(input())

a = [0 for i in range(N)]
b = [0 for i in range(N)]

for i in range(N-1):
  if S[i] == "A" and S[i+1] == "C":
    a[i] = 1
    b[i+1] = 1
    
def cumsum(xs):
  result = [xs[0]]
  for x in xs[1:]:
    result.append(result[-1] + x)
  result.append(0)
  result.sort()
  return result

A = cumsum(a)
B = cumsum(b)

for i in range(Q):
  l,r = map(int,input().split())
  print(int(B[r] - A[l-1]))

Measured memory_bytes: 63240
x = input()
s = [int(i) for i in list(str(x))]
a, b, c, d = s

sm = 0
for i in range(2):
	for j in range(2):
		for k in range(2):
			a, b, c, d = s
			if(i == 0):
				b *= -1
			if(j == 0):
				c *= -1
			if(k == 0):
				d *= -1
			sm = a + b + c + d
			if(sm == 7):
				if(b >= 0):
					b = "+" + str(b)
				if(c >= 0):
					c = "+" + str(c)
				if(d >= 0):
					d = "+" + str(d)
				break
		else:
			continue
		break
	else:
		continue
	break
print (str(a) + str(b) + str(c) + str(d) + "=7")

Measured memory_bytes: 3064
#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<set>
#include<bitset>
#include<map>

#define fo(i,a,b) for(int i=a;i<=b;i++)
#define fd(i,a,b) for(int i=a;i>=b;i--)

using namespace std;

typedef long long LL;
typedef double db;

int get(){
	char ch;
	while(ch=getchar(),(ch<'0'||ch>'9')&&ch!='-');
	if (ch=='-'){
		int s=0;
		while(ch=getchar(),ch>='0'&&ch<='9')s=s*10+ch-'0';
		return -s;
	}
	int s=ch-'0';
	while(ch=getchar(),ch>='0'&&ch<='9')s=s*10+ch-'0';
	return s;
}

const int N =505;

int n,m;
int a[N][N],b[N][N];

int main(){
	n=get();m=get();
	fo(i,1,n)
	if (i&1){
		a[i][1]=1;
		fo(j,2,m)b[i][j]=1;
	}
	else{
		fo(j,1,m-1)a[i][j]=1;
		b[i][m]=1;
	}
	fo(i,1,n){
		char s[N];
		scanf("%s",s+1);
		fo(j,1,m)
			if (s[j]=='#')a[i][j]=b[i][j]=1;
	}
	fo(i,1,n){
		fo(j,1,m)putchar(a[i][j]?'#':'.');
		putchar('\n');
	}
	putchar('\n');
	fo(i,1,n){
		fo(j,1,m)putchar(b[i][j]?'#':'.');
		putchar('\n');
	}
	return 0;
}

Measured memory_bytes: 2688
#include <iostream>
#include <climits>
#include <algorithm>
#define MAX_N 20001
#define MAX_M 16
#define MAX_X 256
#define INIT 128
using namespace std;

long long dp[MAX_N][MAX_X];
int c[MAX_M];
int x[MAX_N];
int n, m;

void solve() {
  dp[0][128] = 0;
  for (int i = 0; i + 1 <= n; i++) {
    for (int j = 0; j < MAX_X; j++) {
      if (dp[i][j] == LONG_MAX) continue;

      for (int k = 0; k < m; k++) {
	int t = j + c[k];
	if (t < 0) t = 0;
	if (t > 255) t = 255;
	int s = (t - x[i + 1]) * (t - x[i + 1]);
	dp[i + 1][t] = min(dp[i][j] + s, dp[i + 1][t]);
      }
    }
  }
  long long ans = LONG_MAX;
  for (int i = 0; i < MAX_X; i++)
    ans = min(ans, dp[n][i]);
  cout << ans << endl;
}

void init() {
  for (int i = 0; i < MAX_N; i++)
    for (int j = 0; j < MAX_X; j++)
      dp[i][j] = LONG_MAX;

  for (int i = 0; i < MAX_M; i++)
    c[i] = 0;
  for (int i = 0; i < MAX_N; i++)
    x[i] = 0;
}

int main() {
  while (true) {
    cin >> n >> m;
    if (n == 0 && m == 0) return 0;

    init();
    for (int i = 0; i < m; i++)
      cin >> c[i];
    for (int i = 1; i <= n; i++)
      cin >> x[i];

    solve();
  }
}

Measured memory_bytes: 43168
#include<stdio.h>

int main()
{
    int a, b, sum;
    scanf("%d %d", &a, &b);
    sum = a + b;
    if (sum % 2 == 0)
    {
        printf("%d", sum / 2);
    }
    else
    {
        printf("IMPOSSIBLE");
    }
    printf("\n");
    return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a[100003],n,ans=0,max1=0;
	cin>>n>>a[1];
	for(int i=2;i<=n;i++)
	{
		cin>>a[i];
		if(a[i]<=a[i-1])
			max1++;
		else if(max1>ans)
			{
			ans=max1;
			max1=0;
			}
		else 
			max1=0;	
	}
	if(max1>ans)
		ans=max1;
	cout<<ans;
	return 0;
}

Measured memory_bytes: 640
#define _USE_MATH_DEFINES
#pragma region include
#include <iostream>
#include <iomanip>
#include <stdio.h>

#include <sstream>
#include <algorithm>
#include <iterator>
#include <cmath>
#include <complex>

#include <string>
#include <cstring>
#include <vector>
#include <bitset>

#include <queue>
#include <set>
#include <map>
#include <stack>
#include <list>

#include <ctime>
////
//#include <random>//
#pragma endregion //#include
/////////

#pragma region typedef
typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;
#pragma endregion //typedef
////定数
const int INF = (int)1e9;
const LL MOD = (LL)1e9+7;
const LL LINF = (LL)4e18+20;
const LD PI = acos(-1.0);
const double EPS = 1e-9;
/////////
using namespace::std;

void solve(){
	int A,B,C,X;
	cin>>A>>B>>C>>X;
	int ans = 0;
	for(int a=0;a<=A;++a){
		for(int b=0;b<=B;++b){
			int ter = X-500*a-100*b;
			if(ter<0){
				break;
			}
			if(ter/50 > C){
				continue;
			}
			++ans;
		}
	}
	cout<<ans<<endl;
}

#pragma region main
signed main(void){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	std::cout << std::fixed;//小数を10進数表示
	cout << setprecision(16);//小数点以下の桁数を指定//coutとcerrで別	

	solve();
}
#pragma endregion //main()


Measured memory_bytes: 256
//#pragma GCC optimize(\"Ofast,no-stack-protector\")
//#pragma GCC target(\"sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx\")
//#pragma GCC target(\"avx,tune=native\")
// Neil

#include<bits/stdc++.h>

using namespace std;

typedef complex<double> base;
typedef long double ld;
typedef long long ll;

#define endl "\n"
#define pb push_back
#define pii pair<int,int>
#define pll pair< ll , ll >
#define vi vector<int>
#define vvi vector< vi >
const int MAXN=(int)(2e5+5);
const ll MOD=(ll)(1e9+7);
int t;
int main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);
    string str1, str2;
    cin>>str1>>str2;
    bool fl = 1;
    for(int i=0;i<str1.size();i++){
        if(str1[i]==str2[i])
            continue;
        else{
            cout<<"No"<<endl;
            fl = 0;
            break;
        }
    }
    if(fl)
        cout<<"Yes"<<endl;
    return 0;
}

Measured memory_bytes: 3656
import math
n, a, b = map(int,input().split())
ans = []

for v in range(1,n+1):
    size = int (math.log10(v) + 1)
    if size==1 and a<=v and v<=b:
        ans.append(v)
    else:
        s=0
        strNum=str(v)
        for p in range(len(strNum)):
            s+=int(strNum[p])
        if a<=s and s<=b:
            ans.append(v)

print(sum(ans))

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

using namespace std;

int main(){

    long N;
    vector<long> vec(5);

    cin >> N >> vec.at(0) >> vec.at(1) >> vec.at(2) >> vec.at(3) >> vec.at(4);
    
    sort(vec.begin(), vec.end());

    long bottleneck = vec.at(0);

    if(bottleneck >= N){
	cout << 5 << endl;
	return 0;
    }

    long t = (N - bottleneck) / bottleneck;
    
    if((N - bottleneck) % bottleneck > 0) t++;
    cout << (t + 5) << endl;
}


Measured memory_bytes: 256
# ABC_150_C_Count_Order.py

from itertools import permutations

N = int(input())
p = list(map(int, input().split()))
q = list(map(int, input().split()))

pp = sorted(p)
qq = sorted(q)
P = list(permutations(pp))
Q = list(permutations(qq))
# print(P, Q)

a=P.index(tuple(p))
b=Q.index(tuple(q))
print(abs(a-b))


Measured memory_bytes: 73360
#include<stdio.h>
int main(){
	long n,a=0,b,c;
	scanf("%d",&n);
	c=n;
	while(n!=0){
		b=n%10;
		a=a+b;
		n=n/10;
		
	}
	if(c%a==0) printf("Yes");
	else printf("No");
	
	
	return 0;
}


Measured memory_bytes: 128
sx, sy, tx, ty = map(int, input().split())
x = tx - sx
y = ty - sy


def add(A, item, times):
    for _ in range(times):
        A.append(item)


answer = []
add(answer, 'U', y)
add(answer, 'R', x)
add(answer, 'R', 1)
add(answer, 'D', y+1)
add(answer, 'L', x+1)
add(answer, 'U', 1)
add(answer, 'R', x)
add(answer, 'U', y)
add(answer, 'U', 1)
add(answer, 'L', x+1)
add(answer, 'D', y+1)
add(answer, 'R', 1)
print("".join(answer))


Measured memory_bytes: 3188
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
//INSERT ABOVE HERE
signed main(){
  string s;
  cin>>s;
  if(s=="zyxwvutsrqponmlkjihgfedcba"){
    cout<<-1<<endl;
    return 0;
  }
  if(s.size()<26u){
    cout<<s;
    for(Int i=0;i<26;i++){
      if(count(s.begin(),s.end(),char('a'+i))) continue;
      cout<<char('a'+i)<<endl;
      break;
    }
    return 0;
  }
  string b=s;
  vector<Int> c(27,1);
  c[s.back()-'a']=0;
  s.pop_back();
  while(!(b<s)){
    c[s.back()-'a']--;
    c[++s.back()-'a']++;
    while(s.back()<='z'&&c[s.back()-'a']>1){
      c[s.back()-'a']--;
      c[++s.back()-'a']++;
    }
    if(s.back()=='z'+1) s.pop_back();
    //cout<<b<<":"<<s<<endl;
  }
  cout<<s<<endl;
  return 0;
}


Measured memory_bytes: 256
def input_int():
    return(int(input()))

def input_int_list():
    return(list(map(int,input().split())))

def input_int_map():
    return(map(int,input().split()))

def run():
    s = input()

    b_count = s.count('B')

    b_to_end_sum = 0
    for i in range(len(s)):
        target = s[i]
        if target == 'B':
            b_to_end_sum += (len(s) - i - 1)

    result = b_to_end_sum - sum([i for i in range(b_count)])
    print(result)

run()

# bbww
# bwdw 1
# wddw 1
# wdwd 1
# wwdd 1
#
# wwwwbbbbwbw
#
# wwwwdddwdwd 2
#
# wwwwddwdwdd 2
#
# wwwwdwdwddd 2
# wwwwwdwdddd 1
# wwwwwwddddd


Measured memory_bytes: 97320
#include<stdio.h>
int main()
{
  int a ,b;
  char op;

  while(1){
  scanf("%d %c %d",&a ,&op ,&b);

  if(op == '?') break;
  
    switch(op){
    case '+' :
      printf("%d\n", a + b);
      break;
      
    case '-':
      printf("%d\n", a - b);
      break;
      
    case '*':
      printf("%d\n", a * b);
      break;
      
    case '/':
      printf("%d\n", a / b);
      break;

    }
    
  }

  return 0;
  
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define fr(i,n) for(i=0;i<n;i++)
#define F first
#define S second
#define fast std::ios_base::sync_with_stdio(false)
#define mod 1000000007
#define pi 3.14159265
int main() {
	fast;
	lli n;
	cin>>n;
	lli a[n],i,sum=0;
	fr(i,n)
	{
		cin>>a[i];
	}
	sort(a,a+n);
	if(n%2!=0)
	{
		lli j=n-1;
		fr(i,n/2)
		{
			sum+=a[j];
			j--;
		}
		j=n-2;
		fr(i,n/2)
		{
			sum+=a[j];
			j--;
		}
		cout<<sum;
	}
	else
	{
		lli temp=n-1;
		lli j=n-1;
		fr(i,n/2)
		{
			sum+=a[j];
			j--;
		}
		j=n-2;
		fr(i,temp/2)
		{
			sum+=a[j];
			j--;
		}
		cout<<sum;
	}
	
	return 0;
}

Measured memory_bytes: 5196
import sys
readline = sys.stdin.readline
from bisect import bisect_left

def main():
    N = int(readline())
    A = list(map(int, readline().rstrip().split()))
    A.sort()
    B = list(map(int, readline().rstrip().split()))
    B.sort()
    C = list(map(int, readline().rstrip().split()))
    C.sort()

    B2 = [bisect_left(A, b) for b in B]
    B3 = [B2[0]]
    pre = B3[0]
    for b in B2[1:]:
        pre += b
        B3.append(pre)
    C2 = [bisect_left(B, c) for c in C]
    B3.append(0)
    ans = sum([B3[c-1] for c in C2])
    print(ans)
    
if __name__ == '__main__':
    main()

Measured memory_bytes: 30068
#include<stdio.h>

int main(){
	int a;
	while(1){
		scanf("%d",&a);
		if(a==0)return 0;
		int s[7]={0};
		for(int i=0;i<a;i++){
			int b;
			scanf("%d",&b);
			if(b>=60)s[6]++;
			else s[b/10]++;
		}
		for(int i=0;i<7;i++)printf("%d\n",s[i]);
	}
}

Measured memory_bytes: 756
package main

import (
	"bufio"
	"fmt"
	"io"
	"log"
	"os"
	"strconv"
)

func main() {
	i := readInt()*100 + readInt()*10 + readInt()
	if i%4 == 0 {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}

// sort ------------------------------------------------------------

type xxx struct {
	x int
}

type sortArray []xxx

func (s sortArray) Len() int           { return len(s) }
func (s sortArray) Swap(i, j int)      { s[i], s[j] = s[j], s[i] }
func (s sortArray) Less(i, j int) bool { return s[i].x < s[j].x }

// -----------------------------------------------------------------

var (
	readString func() string
	readBytes  func() []byte
)

func init() {
	log.SetFlags(log.Lshortfile)
	readString, readBytes = newReadString(os.Stdin)
}

func newReadString(ior io.Reader) (func() string, func() []byte) {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	f1 := func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
	f2 := func() []byte {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Bytes()
	}
	return f1, f2
}

func readInt() int {
	return int(readInt64())
}

func readInt64() int64 {
	i, err := strconv.ParseInt(readString(), 10, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readFloat64() float64 {
	f, err := strconv.ParseFloat(readString(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

func sum(a []int) int {
	var ret int
	for i := range a {
		ret += a[i]
	}
	return ret
}

func sumFloat64(a []float64) float64 {
	var ret float64
	for i := range a {
		ret += a[i]
	}
	return ret
}

func gcd(m, n int) int {
	for m%n != 0 {
		m, n = n, m%n
	}
	return n
}

func lcm(m, n int) int {
	return m / gcd(m, n) * n
}


Measured memory_bytes: 640
def DFS(s):
    global ans,color
    color[s]="gray"
    if "white" not in color:
        ans +=1
    for i in M[s]:
        if color[i]=="white":
            DFS(i)
    color[s]="white"


n,m=map(int,input().split())

M=[[] for _ in range(n)]
for i in range(m):
    a,b=map(int,input().split())
    M[a-1].append(b-1)
    M[b-1].append(a-1)

color=["white" for _ in range(n)]
ans=0
DFS(0)

print(ans)

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

int main() {
    int n;
    cin >> n;
    int sum = 1;
    for (int i = 1; i <= n; i++) {
        int ans = i;
        while (ans % 2 == 0 && ans != 1) {
            ans /= 2;
        }
        if (ans == 1)
            sum = max(i, sum);
    }
    cout << sum << endl;
    return 0;
}

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

using namespace std;

using ll = long long;

char a[10][10];
int main() {
#ifdef BZ
    freopen("input.txt", "r", stdin);
#endif
    ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
    int n, m;
    cin >> n >> m;
    for (int i = 1; i <= n; i++) {
        string s;
        cin >> s;
        for (int j = 1; j <= m; j++) {
            a[i][j] = s[j - 1];
        }
    }
    int x = 1, y = 1;
    while (true) {
        a[x][y] = '.';
        if (a[x + 1][y] == '#') {
            x++;
        } else if (a[x][y + 1] == '#') {
            y++;
        } else {
            break;
        }
    }
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= m; j++) {
            if (a[i][j] == '#') {
                cout << "Impossible\n";
                return 0;
            }
        }
    }
    cout << "Possible\n";
}

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


int main()
{
    int n;cin>>n;
    vector<int>cnt(n+1,0);
    for(int x=1 ; x*x<=n ; x++)
    {
        for(int y=1 ; y*y<=n ; y++)
        {
            for(int z=1 ; z*z<=n ; z++)
            {
                int res = x*x+y*y+z*z+x*y+y*z+z*x;
                if(res>n) break;
                cnt[res]++;
            }
        }
    }   
    for(int i=1 ; i<=n ; i++)
        cout<< cnt[i]<<endl;

    return 0;

}

Measured memory_bytes: 3552
def main():
    h, w = map(int, input().split())
    a = [["." for j in range(w+2)] for i in range(h+2)]
    for i in range(h):
        s = list(input().rstrip())
        for j in range(w):
            a[i+1][j+1] = s[j]
    y, x = 1, 1
    f = True
    while y != h or x != w:
        a[y][x] = "."
        if a[y-1][x] == "#" or a[y][x-1] == "#" or (a[y+1][x] == "#" and a[y][x+1] == "#"):
            f = False
            break
        else:
            if a[y+1][x] == "#":
                y += 1
            else:
                x += 1
    if a[y-1][x] == "#" or a[y][x-1] == "#":
        f = False
    if f:
        print("Possible")
    else:
        print("Impossible")

if __name__ == "__main__":
    main()

Measured memory_bytes: 3064
n, m = map(int, input().split())
sc = [list(map(int, input().split())) for _ in range(m)]

s = 10**(n-1)
if s == 1:
    s = 0
for i in range(s, 10**n):
    a = list(map(int, list(str(i))))
    for j in sc:
        if a[j[0]-1] != j[1]:
            break
    else:
        print(i)
        exit()
print(-1)

Measured memory_bytes: 9180
#include <stdio.h>
#include <string.h>
int main(void)
{
  char weather[100];
  char sunny[10]="Sunny";
  char cloudy[10]="Cloudy";
  char rainy[10]="Rainy";
  scanf("%s", weather);
//  printf("%s", weather);
  
  if(strcmp(weather,sunny)==0){
    printf("Cloudy");
  };
  if(strcmp(weather,cloudy)==0){
    printf("Rainy");
  };
    if(strcmp(weather,rainy)==0){
    printf("Sunny");
  };
  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <vector>
#include <tuple>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define fi first
#define se second
typedef long long ll;

int N,M,H,W,K,A,B;
string S;
string alpha = "abcdefghijklmnopqrstuvwxyz";
string ALPHA = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";

int main() {
    cin>>N>>M;
    int l = 0;
    int r = N;
    rep(i,M){
        cin>>H>>W;
        l = max(l,H);
        r = min(r,W);
    }
    if(r-l+1<0) {
        cout<<0<<endl;
        return 0;
    }
    cout<<r-l+1<<endl;
    
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;

internal class Program {
    static void Main() => CustomMain();

    static void Solve() {
        var c = ReadString().ToCharArray();

        var ans = new List<Char>();
        for (int i = 0; i < c.Length; i++) {
            if (c[i] == 'B') {
                if (0 < ans.Count) {
                    ans.RemoveAt(ans.Count - 1);
                }
            } else {
                ans.Add(c[i]);
            }
        }

        WriteAnswer(new string(ans.ToArray()));
    }


    static void CustomMain() {
#if DEBUG
        // ファイルからテストケースを読み込む
        ChangeStdIn();
        // 時間計測
        var stopwatch = new Stopwatch();
        stopwatch.Start();
#endif
        // 出力高速化
        var streamWriter = new StreamWriter(Console.OpenStandardOutput()) {AutoFlush = false};
        Console.SetOut(streamWriter);
        // 回答
        Solve();
#if DEBUG
        stopwatch.Stop();
        Console.WriteLine(stopwatch.Elapsed);
#endif
        Console.Out.Flush();
    }

    static string ReadString() => Console.ReadLine().Trim();
    static int ReadInt() => int.Parse(ReadString());
    static long ReadLong() => long.Parse(ReadString());
    static float ReadFloat() => float.Parse(ReadString());
    static double ReadDouble => double.Parse(ReadString());

    static string[] ReadStringArray() => ReadString().Split(' ');
    static int[] ReadIntArray() => Array.ConvertAll(ReadString().Split(' '), int.Parse);
    static long[] ReadLongArray() => Array.ConvertAll(ReadString().Split(' '), long.Parse);
    static float[] ReadFloatArray() => Array.ConvertAll(ReadString().Split(' '), float.Parse);
    static double[] ReadDoubleArray() => Array.ConvertAll(ReadString().Split(' '), double.Parse);

    static T TypeConversion<T>(string s) {
        if (typeof(T) == typeof(int)) {
            return (T) Convert.ChangeType(int.Parse(s), typeof(T));
        } else if (typeof(T) == typeof(long)) {
            return (T) Convert.ChangeType(long.Parse(s), typeof(T));
        } else if (typeof(T) == typeof(double)) {
            return (T) Convert.ChangeType(double.Parse(s), typeof(T));
        } else {
            return (T) Convert.ChangeType(s, typeof(T));
        }
    }

    static void ReadMulti<T, U>(out T a, out U b) {
        var str = ReadStringArray();
        a = TypeConversion<T>(str[0]);
        b = TypeConversion<U>(str[1]);
    }

    static void ReadMulti<T, U, V>(out T a, out U b, out V c) {
        var str = ReadStringArray();
        a = TypeConversion<T>(str[0]);
        b = TypeConversion<U>(str[1]);
        c = TypeConversion<V>(str[2]);
    }

    static void WriteAnswer(object ans) => Console.WriteLine(ans);

    static bool IsOdd(long num) {
        return (num & 1) == 1;
    }

    static bool IsEven(long num) {
        return (num & 1) == 0;
    }

    static long GCD(long a, long b) {
        return b != 0 ? GCD(b, a % b) : a;
    }


    static void ChangeStdIn() {
        var path = "./../../TestCase.txt";
        var exStdIn = new System.IO.StreamReader(path);
        Console.SetIn(exStdIn);
    }
}

Measured memory_bytes: 13140
let () =
  let n = read_int () in
  let tbl = Hashtbl.create ~random:true n in
  for _ = 0 to n - 1 do
    match Scanf.scanf "%s %s\n" (fun inst str -> (inst, str)) with
    | ("find", s) -> print_endline (if Hashtbl.mem tbl s then "yes" else "no")
    | (_, s) -> Hashtbl.add tbl s ()
  done

Measured memory_bytes: 44040
//	-*- mode: C++ -*-
//	Distance
//
//		Write a program which calculates the distance between two points P1(x1, y1) and P2(x2, y2).
//
//	Input
//		Four real numbers x1, y1, x2 and y2 are given in a line.
//
//	Output
//		Print the distance in real number. The output should not contain an absolute error greater than 10-4.

//	Sample Input
//		0 0 1 1
//	Sample Output
//		1.41421356

#include <iostream>
#include <iomanip>
#include <cmath>

int	main(int	argc,
		 char*	argv[])
{
	double	x1	{0};
	double	y1	{0};
	double	x2	{0};
	double	y2	{0};

	std::cin >> x1 >> y1 >> x2 >> y2;

	double	x	= x2 - x1;
	double	y	= y2 - y1;

	std::cout << std::fixed << std::setprecision(6) << sqrt((x * x) + (y * y)) << '\n';
    return 0;
}



Measured memory_bytes: 3284
#include<iostream>

using namespace std;

int main(){
    int A[3][3],N,*b,flag=0;
    int B[3][3] = {0};
    for(int i=0;i<3;i++){
        cin >> A[i][0] >> A[i][1] >> A[i][2];
    }
    cin >> N;
    b = new int[N];
    for(int i=0;i<N;i++){
        cin >> b[i];
        for(int j=0;j<3;j++){
            for(int k=0;k<3;k++){
                if(A[j][k] == b[i]) B[j][k] = 1;
            }
        }
    }
    if(B[0][0] == 1){
        if(B[0][1] == 1){
            if(B[0][2] == 1) flag = 1;
        }if(B[1][0] == 1){
            if(B[2][0] == 1) flag = 1;
        }if(B[1][1] == 1){
            if(B[2][2] == 1) flag = 1;
        }
    }if(B[0][1] == 1){
        if(B[1][1] == 1){
            if(B[2][2] == 1) flag = 1;
        }
    }if(B[0][2] == 1){
        if(B[1][1] == 1){
            if(B[2][0] == 1) flag = 1;
        }if(B[1][2] == 1){
            if(B[2][2] == 1) flag = 1;
        }
    }if(B[1][0] == 1){
        if(B[1][1] == 1){
            if(B[1][2] == 1) flag = 1;
        }
    }if(B[2][0] == 1){
        if(B[2][1] == 1){
            if(B[2][2] == 1) flag = 1;
        }
    }
    if(flag == 1) cout << "Yes";
    else cout << "No";
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <unordered_map>
using namespace std;

#define REP(i, s) for (int i = 0; i < s; ++i)
#define ALL(v) (v.begin(), v.end())
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T> ostream& operator << (ostream &s, set<T> P)
{ EACH(it, P) { s << "<" << *it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }


long long n, k;
int main() {
    while (cin >> n >> k) {
        if (k % 2 == 0) {
            long long a = n / (k);
            long long b = (n + (k/2)) / (k);
            cout << a*a*a + b*b*b << endl;
        }
        else {
            long long a = n / k;
            cout << a*a*a << endl;
        }
    }
}






























Measured memory_bytes: 256
#include <iostream>

using namespace std;

int cases[31];

int main() {
    cases[1] = 1;
    cases[2] = 2;
    cases[3] = 4;
    for (int n = 4; n < 31; n++)
        cases[n] = cases[n-1] + cases[n-2] + cases[n-3];

    int N = 0;
    while (cin>>N && N != 0) {
        cout<<((cases[N]+9)/10+364)/365<<endl;
    }
}

Measured memory_bytes: 3052
using System;


class Program
{
    static void Main()
    {
        string[] x = Console.ReadLine().Split(' ');
        int a = int.Parse(x[0]);
        int b = int.Parse(x[1]);
        if (a > b) 
        {
            Console.WriteLine("a > b");
        }
        else if (a < b)
        {
            Console.WriteLine("a < b");
        }
        else
        {
            Console.WriteLine("a == b");
        }
    }
}


Measured memory_bytes: 15904
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define sc second
typedef pair<int,int> P;
int N,K;
int C[5003],R[5003];
int A,B;
vector<int>G[5003];int s1[5003];bool f[5003];
vector<P>G2[5003];
int main()
{
	scanf("%d%d",&N,&K);
	for(int i=0;i<N;i++){
		scanf("%d%d",&C[i],&R[i]);
	}
	for(int i=0;i<K;i++){
		scanf("%d%d",&A,&B);A--;B--;
		G[A].pb(B);
		G[B].pb(A);
	}
	for(int i=0;i<N;i++){
		for(int j=0;j<N;j++){
			s1[j]=N+1;f[j]=false;
		}
		vector<int>ver;
		ver.pb(i);int ss=0;
		while((int)ver.size()!=0){
			vector<int>ver1;
			for(int j=0;j<(int)ver.size();j++){
				if(f[ver[j]])continue;
				//printf("%d ",ver[j]);
				f[ver[j]]=true;s1[ver[j]]=ss;
				for(int k=0;k<(int)G[ver[j]].size();k++){
					ver1.pb(G[ver[j]][k]);
				}
			}
			ver.erase(ver.begin(),ver.end());
			for(int j=0;j<(int)ver1.size();j++){
				ver.pb(ver1[j]);
			}
			//printf("\n");
			ss++;
		}
		for(int j=0;j<N;j++){
			if(i==j)continue;
			if(R[i]>=s1[j]){
				//printf("%d %d\n",i,j);
				G2[i].pb(P(j,C[i]));
			}
		}
	}
	for(int j=0;j<N;j++){
		s1[j]=10000*N+1;
	}
	priority_queue<P,vector<P>,greater<P> >que;que.push(P(0,0));
	while(!que.empty()){
		P p=que.top();que.pop();
		if(s1[p.sc]<=p.fi)continue;
		s1[p.sc]=p.fi;
		for(int i=0;i<(int)G2[p.sc].size();i++){
			if(s1[G2[p.sc][i].fi]>p.fi+G2[p.sc][i].sc){
				que.push(P(p.fi+G2[p.sc][i].sc,G2[p.sc][i].fi));
			}
		}
	}
	printf("%d\n",s1[N-1]);
	return 0;
}

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

const int N = 1e6 + 10;
vector<int> v[N];

int main() {
	int n , m ; cin >> n >> m;
	for(int i = 0 ; i < m ; i ++ ) {
		int a , b ; cin >> a >> b;
		v[a].push_back(b);
	}
	vector<int> ans;
	
	for(int i = 1 ; i <= n ; i ++) {
		queue<int> q;
		vector<int> parent(n + 1 , -1);
		for(int nxt : v[i]) {
			parent[nxt] = i;
			q.push(nxt);
		}
		while(!q.empty()) {
			int now = q.front();
			q.pop();
			if(now == i) {
				vector<int> _ans = {now};
				now = parent[now];
				while(now != i) {
					_ans.push_back(now);
					now = parent[now];
				}
				if(_ans.size() < ans.size() || ans.empty()) {
					ans = _ans;
				}
			}
			
			for(int nxt : v[now]) {
				if(parent[nxt] == -1) {
					parent[nxt] = now;
					q.push(nxt);
				}
			}
		}
	}
	if(!ans.size()) cout << -1 ;
	else {
		cout << ans.size() << endl;
		for(auto i : ans) cout << i << '\n';
	}
}


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

int main(){
ll n;
cin>>n;
ll a[n+1];
for(int i=1;i<=n;i++) cin>>a[i];
ll dp[n+1][n+1];
memset(dp,0,sizeof(dp));

for(int i=1;i<=n;i++) dp[i][i]=a[i];

for(int len=1;len<n;len++){
ll i=1;
for(int j=i+len;j<=n;j++){
    dp[i][j]=max(a[i]-dp[i+1][j],a[j]-dp[i][j-1]);
    i++;
}

}

cout<<dp[1][n]<<endl;



}

Measured memory_bytes: 70656
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <cstring>
#include <climits>
#include <iomanip>
#include <bitset>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <list>
#include <map>

using namespace std;

int main() {
  int n;
  cin >> n;
  long long ans = 0;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    ans |= x;
  }
  if (ans & 1) {
    cout << "first" << endl;
  } else {
    cout << "second" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
/*
            _ _  ___            __ _ _  _       _     
 _   _  ___| | |/ _ \__      __/ _| | || |  ___| |__  
| | | |/ _ \ | | | | \ \ /\ / / |_| | || |_/ __| '_ \ 
| |_| |  __/ | | |_| |\ V  V /|  _| |__   _\__ \ | | |
 \__, |\___|_|_|\___/  \_/\_/ |_| |_|  |_| |___/_| |_|
 |___/                 

*/

#include <bits/stdc++.h>
using namespace std;
#define sz(x) (ll)(x).size()
#define trav(x) for(auto& it: x)
#define all(x) x.begin(), x.end()
#define stp fixed<<setprecision(20)
#define tc ll tt; cin>>tt; while(tt--)
#define For(i, st, en) for(ll i=st; i<en; i++)
#define rFor(i, st, en) for(ll i=st; i>=en; i--)
#define present(c,x) ((c).find(x) != (c).end())
#define cpresent(c,x) (find(all(c),x) != (c).end())
#define tr(x) for(auto it=x.begin(); it!=x.end(); it++)
#define fast std::ios::sync_with_stdio(false);cin.tie(NULL);
#define printv(x) For(i, 0, sz(x)){cout<<x[i]<<" ";} cout<<endl;
#define print2v(x) For(i, 0, sz(x)){For(j, 0, sz(x[i])){cout<<x[i][j]<<" ";} cout<<endl;}
#define ll long long
#define int long long
#define F first
#define S second
#define pb push_back
#define lb lower_bound
#define ub upper_bound
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef vector<vi> vvi;
typedef vector<pii> vpi;
#define endl '\n'
#define MAXN 300005
#define MOD 1000000007
#define INF 1000000000000000007
#define bitc __builtin_popcountll

int begtime = clock();
#define end_routine() cout << "\n\nTime elapsed: " << (double)(clock() - begtime)*1000/CLOCKS_PER_SEC << " ms\n";

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cout << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}

void splitx(string s, char c, vector<string> &v){
    int i=0, j;
    while(i<sz(s)){
        j=i; string temp;
        while(j<sz(s) && s[j]!=c){temp+=s[j]; j++;}
        v.pb(temp); i=j+1;
    }
}

vi dx{1, 0, -1, 0, 1, 1, -1, -1};
vi dy{0, 1, 0, -1, 1, -1, 1, -1};

/*################################ ¯\_(ツ)_/¯ ################################*/



signed main(){
    fast
    cout<<stp;
    int n;
    cin>>n;
    vector<double> v(n+1);
    For(i, 1, n+1){
        cin>>v[i];
    }

    vector<vector<double>> dp(n+1, vector<double>(n+1, 0));
    For(i, 0, n+1){
        For(j, 0, n+1){
            if(i==0 && j==0){
                dp[0][0]=1;
            }else if(i==0){
                dp[0][j]=0;
            }else if(j==0){
                dp[i][0] = dp[i-1][0]*(1-v[i]);
            }else{
                dp[i][j] = dp[i-1][j-1]*v[i] + dp[i-1][j]*(1-v[i]);
            }
        }
    }
    double ans=0;
    For(i, (n+1)/2, n+1) ans+= dp[n][i];
    cout<<ans<<endl;
    // end_routine()
    return 0;
}



Measured memory_bytes: 70784
def after_exp():
    N = int(input())
    a = list(map(int, input().split()))
    b = list(map(int, input().split()))

    count = sum(b) - sum(a)
    if count < 0: return print('No')
    if a == b: return print('Yes')

    Amove = 0
    Bmove = 0
    for i in range(N):
        if a[i] > b[i]:
            Amove += a[i] - b[i]
        else:
            Bmove += (b[i] - a[i]) //2

    if Amove > Bmove:
        return print('No')
    else:
        return print('Yes')


# main()
after_exp()


Measured memory_bytes: 4596
from itertools import groupby as gb
N = int(input())
a,b = gb(input()),gb(input())
res = -1
for (w,x),(y,z) in zip(a,b):
    if res==-1:
        prev = w!=y
        res = 3 * (1+prev)
    elif prev:
        prev = w!=y
        res *= 1 + prev*2
    else:
        prev = w!=y
        res *= 2
print(res % (10**9+7))


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

int main() {
    string s; cin >> s;
    vector<int> n(s.size());
    int init_pos = 0;
    while (init_pos < s.size()) {
        int pos = init_pos;
        while(s[pos] == 'R') pos++;
        int side_r = pos - 1;
        int side_l = pos;
        while(s[pos+1] == 'L') pos++;
        for (int i = init_pos; i <= pos; i++) {
            if (i % 2 == side_r % 2) n[side_r]++;
            else n[side_l]++;
        }
        init_pos = pos + 1;
    }
    for(int i = 0; i < s.size(); i++) cout << n[i] << " ";
    cout << endl;
    return 0;
}


Measured memory_bytes: 1024
//INCLUDE
//------------------------------------------
#include <bits/stdc++.h>
//DEFINE
//------------------------------------------
#define ll long long
#define ld long double
#define ALLv(a)  (a).begin(),(a).end()
#define ALL(a,n)  (a),(a)+n
#define vi vector<long long>
#define vd vector<long double>
#define vs vector<string>
//CONST
//------------------------------------------
#define INF 1010000000000000017LL
#define MOD 1000000007LL
#define EPS 1e-12
#define PI 3.14159265358979323846
//REPEAT
//------------------------------------------
#define   FOR(i,m,n) for(ll (i)=(m);   (i)<(n);  (i)++)
#define   REP(i,n)   for(ll (i)=0;     (i)<(n);  (i)++)
#define  REPS(i,x)   for(ll (i)=1;     (i)<=(x); (i)++)
#define  RREP(i,x)   for(ll (i)=(x)-1; (i)>=0;   (i)--)
#define RREPS(i,x)   for(ll (i)=(x);   (i)> 0;   (i)--)
#define  WREP(i,in,j,jn) REP(i,in)REP(j,jn)
//-----------------------------------------
#define dcml(n) fixed<<setprecision(n)
using namespace std;
int main(void){
    ll X;cin>>X;
    ll n=100;
    ll i=0;
    while(n<X){
        n*=1.01;
        i++;
    }
    cout<<i<<"\n";
}

Measured memory_bytes: 3624
def gcd(a,b):
    i=0
    while b!=0:
        c=a%b
        a,b=b,c
        i+=1
    return [a,i]
            
while True:
    a,b=map(int,input().split())
    if a==0 and b==0:
        break
    if a<b:
        a,b=b,a
    print(*gcd(a,b))


Measured memory_bytes: 5608
import java.util.*;

public class Main{
	int m;
	private void doit(){
		Scanner sc = new Scanner(System.in);
		while(true){
			int n = sc.nextInt();
			m = sc.nextInt();
			int a = sc.nextInt();
			int b = sc.nextInt();
			int c = sc.nextInt();
			int t = sc.nextInt();
			if((n|m|a|b|c|t) == 0){
				break;
			}
			int [][] s = new int[n][1];
			for(int i = 0; i < n; i++){
				s[i][0] = sc.nextInt();
			}
			int [][] mat = new int[n][n];
			for(int i = 0; i < n; i++){
				if(i - 1 >= 0){
					mat[i][i - 1] = a;
				}
				mat[i][i] = b;
				if(i + 1 < n){
					mat[i][i + 1] = c;
				}
			}

			int [][] matrixpowmat = matrixPow(mat, t);
			int [][] ans = mul(matrixpowmat, s);
			for(int i = 0; i < n-1; i++){
				System.out.print(ans[i][0] + " ");
			}
			System.out.println(ans[n-1][0]);
		}
	}

	private int[][] matrixPow(int[][] a, int n) {
		int [][] b = new int [a.length][a[0].length];
		for(int i = 0; i < a.length; i++){
			b[i][i] = 1;
		}
		while(n > 0){
			if((n & 1) != 0){
				b = mul(b,a);
			}
			a = mul(a,a);
			n >>= 1;
		}
		return b;
	}

	private int[][] mul(int[][] a, int[][] b) {
		int [][] c = new int[a.length][b[0].length];
		for(int i = 0; i < a.length; i++){
			for(int k = 0; k < b.length; k++){
				for(int j = 0; j < b[0].length; j++){
					c[i][j] = (c[i][j] + a[i][k] * b[k][j]) % m;
				}
			}
		}
		return c;
	}

	private void debug(Object... o) {
		System.out.println("debug = " + Arrays.deepToString(o));
	}

	public static void main(String[] args) {
		new Main().doit();
	}
}

Measured memory_bytes: 46340
N = int(input())
AB = [[int(i) for i in input().split()] for _ in range(N)]
AB.sort(key=lambda x:x[1])

time = 0
flag = False
for i in range(N):
    time += AB[i][0]
    if time <= AB[i][1]:
        continue
    else:
        flag = True
        break

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

Measured memory_bytes: 41176
#include<bits/stdc++.h>
#define int long long

using namespace std;

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

    char c;
    map<char, int> mp;
    for (int i = 0; i < 4; i++)
        cin >> c, mp[c]++;
    if (mp.size() != 2)
        cout << "No\n";
    else if ((*mp.begin()).second != 2 || (*prev(mp.end())).second != 2)
        cout << "No\n";
    else
        cout << "Yes\n";

    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#include<iostream>
#include<math.h>
#include<string>
#include<vector>
#include<map>
#include<queue>
#include<cmath>
#include<algorithm>
using namespace std;
using ll = long long int;
//typedef pair<int,int> P;

int main(void){
	int X,Y;
	cin >> X >>Y;
	int turu=0;
	if(Y%2==1){
		cout << "No";
		return 0;
	}
	turu=Y/2;
	int kame=0;
	while(turu>=0){
		if(turu+kame==X){
			cout << "Yes";
			return 0;
		}
		turu-=2;
		kame++;
	}
	cout <<"No";
	
	return 0;
}


Measured memory_bytes: 3632
#include <algorithm>
#include <cmath>
#include <climits>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <cassert>
#include <functional>

using namespace std;

#define LOG(...) printf(__VA_ARGS__)
//#define LOG(...)
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define RSORT(c) sort((c).rbegin(),(c).rend())
#define CLR(a) memset((a), 0 ,sizeof(a))

typedef long long ll;
typedef unsigned long long ull;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vb> vvb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

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

struct Rect{
	int w, h;

	bool operator <(const Rect& r) const{
		int a = w*w+h*h, b=r.w*r.w+r.h*r.h;
		if(a == b) return h < r.h;
		return a < b;
	}
};

int main() {
	int w, h;
	while(cin >> h >> w, w|h){

		Rect r = {w, h};
		Rect ma = {150, 150};
		FOR(y, 1, 150 + 1){
			FOR(x, y + 1 ,150 + 1){
				Rect hi = {x, y};
				if( r < hi ){
					if(hi < ma){
						ma = hi;
					}
				}
			}
		}

		cout << ma.h << " " << ma.w << endl;
	}
}

Measured memory_bytes: 1160
n=int(input())
dic = dict()

a = 0
for i in range(n):
    s = str(input())
    if s in dic:
        dic[s] += 1
    else:
        dic[s] = 1
    if dic[s] > a:
        a = dic[s]
box= []
for i in dic:
    if dic[i] == a:
        box.append(i)

ans = sorted(box)
for i in range(len(ans)):
    print(ans[i])

Measured memory_bytes: 32988