akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>

int main(void)
{
	float f;
	
	while (scanf("%f", &f) != EOF){
		if (91.0 < f){
			printf("heavy\n");
		}
		else if (81.0 < f){
			printf("light heavy\n");
		}
		else if (75.0 < f){
			printf("middle\n");
		}
		else if (69.0 < f){
			printf("light middle\n");
		}
		else if (64.0 < f){
			printf("welter\n");
		}
		else if (60.0 < f){
			printf("light welter\n");
		}
		else if (57.0 < f){
			printf("light\n");
		}
		else if (54.0 < f){
			printf("feather\n");
		}
		else if (51.0 < f){
			printf("bantam\n");
		}
		else if (48.0 < f){
			printf("fly\n");
		}
		else if (48.0 >= f){
			printf("light fly\n");
		}
	}
	
	return 0;
}

Measured memory_bytes: 604
#include<bits/stdc++.h>
using namespace std;
typedef complex<double> P;
double PI = acos(-1);

int main(){
  double a,b;
  scanf("%lf %lf",&a,&b);
  a=a/180.0*PI;
  b=b/180.0*PI;
  
  P A=P( cos(a) , sin(a) );
  P B=P( cos(b) , sin(b) );

  
  P C=A+B;
  double ans=arg(C)/PI*180.0;
  while(ans<0)ans+=360.0;
  
  printf("%.8f\n", ans );
  return 0;
}

Measured memory_bytes: 3580
// be name khoda
#include<bits/stdc++.h>

using namespace std;

#define F first
#define S second
#define int long long
#define mpr make_pair 
#define pii pair<int,int>
typedef long long ll;
#pragma GCC optimize("Ofast")

const int maxn = 2e5+10;
const int mod = 998244353;
const int inf = 1e9+10;

int n, m;
int p[maxn], q[maxn];

signed main()
{
    //ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    cin>> n;
    for(int i = 1; i <= n; i++)
    {
        cin>> p[i];
        q[p[i]] = i;
    }

    for(int i = 1; i <= n; i++)
        cout<< q[i] + (n+1) * i <<" ";
    cout<<"\n";
    for(int i = 1; i <= n; i++)
        cout<< (n+1) * (n+1) - (n+1) * i <<" ";
}

 





Measured memory_bytes: 896
import math
a, b, h, m = map(int, input().split())
angle = abs((h + 1 / 60 * m) / 12 * 2 * math.pi - m / 60 * 2 * math.pi)
ans = math.sqrt(a ** 2 + b ** 2 - 2 * a * b * math.cos(angle))
#print(math.degrees(angle))
#print(math.cos(angle))
print(ans)

Measured memory_bytes: 9500
from collections import Counter
n = int(input())
A = list(map(int, input().split()))
B = Counter(A)
ans = sum(A)
Q = int(input())

#print(B)
for i in range(Q):
    b, c =map(int, input().split())
    x = B[b]
    if x == 0:
        print(ans)
        continue
    if c in B:
        B[c] += x 
    else:
        B[c] = x
    B.pop(b)
    ans = ans + (c - b) * x
    #print(B)
    print(ans)
    

Measured memory_bytes: 21460
from sys import stdin
import sys
import numpy as np
import collections
from functools import cmp_to_key

##  input functions for me
def rsa(sep = ''):
    if sep == '' :
        return input().split() 
    else: return input().split(sep)
def rip(sep = ''):
    if sep == '' :
        return map(int, input().split()) 
    else: return map(int, input().split(sep))
def ria(sep = ''): 
    return list(rip(sep))
def ri(): return int(input())
def rd(): return float(input())
def rs(): return input()
##
def main():
    N, A, B = rip()
    if (B - A) % 2 == 0:
        print((B - A) // 2)
    else :
        a = A
        b = B
        l = 0
        l += a - 1
        b -= a - 1
        a -= a - 1
        l += 1
        b -= 1
        l += (b - a) // 2
        
        a = A
        b = B
        r = 0
        r += N - b
        a += N - b
        b += N - b
        r += 1
        a += 1
        r += (b - a) // 2
        print(min(l, r))




if __name__ == "__main__":
    main()


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

using namespace std;
using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
#define REP(i,n) for(ll i = 0;i < (ll)n;i++)
#define REPD(i,n) for(ll i = (ll)n - 1;i >= 0;i--)
#define ALL(x) (x).begin(),(x).end()
#define FILLl(n,first_dimension_size,value) fill((ll*)n,(ll*)(n+first_dimension_size),value)
#define FILL(n,first_dimension_size,value) fill((int*)n,(int*)(n+first_dimension_size),value)
#define INF (1 << 30)
#define MOD 1000000007
//int dy[4] = {-1,0,0,1};
//int dx[4] = {0,1,-1,0};



int main(){
  
  int k;
  cin >> k;
  ll res = 0;
  for(int a = 1;a <= k;a++){
    for(int b = 1;b <= k;b++){
      for(int c = 1;c <= k;c++){
        res += __gcd(a,__gcd(b,c));
      }
    }
  }    
  cout << res << endl;

  return 0;
}


Measured memory_bytes: 3636
#include <iostream>
#include <cassert>
#include <vector>
#include <algorithm>
#include <climits>
#include <bitset>

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

#include <tuple>
// #include <cmath>
// #include <numeric>

using namespace std;


typedef long long ll;
typedef pair<long long,long long> pll;
typedef pair<int,int> pii;
typedef pair<int,long long> pil;
typedef pair<long long,int> pli;
typedef vector<vector<long long>> vvl;
typedef vector<vector<int>> vvi;
typedef vector<int> vi;
typedef vector<long long> vl;
typedef vector<bool> vb;
typedef priority_queue<int, vector<int>, greater<int> > minq;
typedef priority_queue<int> maxq;
// to initialize PQs with a vector, do 
// minq(v.begin(),v.end()) or maxq(v.begin(),v.end())
// or minq(a,a+10) for arrays

#define emplace_back pb
const char el = '\n';

/*
Edge cases:


*/

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

    ll x; cin>>x; cin.ignore();

    ll curr=100;


    int ct=0;

    while (curr<x) {
        ll interest = curr/100;
        curr += interest;
        ++ct;
    }

    cout<<ct<<el;


}

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

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


    for(long long i = 0; i <= 50000; i++){
        long double x = (long double) i;
        long long x2 = (long long) (x * 1.08);

        if(x2 == n){
            printf("%lld\n", i);
            
            return 0;
        }
    }

    printf(":(\n");

    return 0;
}

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


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

  ll ans = 0;
  for (int i = 0; i < S.size(); i++) {
    if (S[i] != T[i]) ans++;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3836
import sys
IS = lambda: sys.stdin.readline().rstrip()
II = lambda: int(IS())
MII = lambda: list(map(int, IS().split()))
from bisect import bisect_left, bisect_right

def main():
    n, q = MII()
    s = IS()
    lr = [(MII()) for _ in range(q)]
    ac_index = []
    for i in range(n-1):
        if s[i:i+2] == 'AC': ac_index.append(i)
    cnt = 0
    for l, r in lr:
        i = bisect_left(ac_index, l-1)
        j = bisect_left(ac_index, r-1)
        print(j-i)

if __name__ == '__main__':
    main()


Measured memory_bytes: 30324
#include <iostream>
#include <vector>

using namespace std;

struct node {
    int parent;
    int depth;
    string type;
    vector<int> children;

    node() {
        parent = -1;
        depth = -1;
        type = "leaf";
    }

    void printInfo(int i) {
        printf("node %d: parent = %d, depth = %d, %s, [", i, parent, depth, type.c_str());
        if (!children.empty()) printf("%d", children[0]);
        for (int j = 1; j < children.size(); ++j) printf(", %d", children[j]);
        printf("]\n");
    }
};

vector<node> tree;

void dfs(int cur, int depth) {
    tree.at(cur).depth = depth++;
    if (!tree[cur].children.empty()) tree[cur].type = "internal node";
    for (const auto &n:tree[cur].children) {
        dfs(n, depth);
    }
}

int main() {
    int n;
    cin >> n;
    tree = vector<node>(n);
    for (int i = 0; i < n; ++i) {
        int id, k;
        cin >> id >> k;
        for (int j = 0; j < k; ++j) {
            int c;
            cin >> c;
            tree[id].children.push_back(c);
            tree[c].parent = id;
        }
    }
    int rootIndex = -1;
    for (int i = 0; i < n; ++i) if (tree[i].parent == -1) rootIndex = i;
    dfs(rootIndex, 0);
    tree[rootIndex].type = "root";
    for (int i = 0; i < n; ++i) tree[i].printInfo(i);
    return 0;
}



Measured memory_bytes: 12364
h, w = map(int, input().split())
mine_area = []
output = [[0 for _ in range(w)] for _ in range(h)]


def check_num(i, j):
    a = i - 1
    b = i + 1
    c = j - 1
    d = j + 1
    if i == 0:
        a = i
    if i == h-1:
        b = i
    if j == 0:
        c = j
    if j == w-1:
        d = j
    count = 0
    for p in range(a, b+1):
        for q in range(c, d+1):
            if p == i and q == j:
                continue
            if mine_area[p][q] == '#':
                count += 1
    return count


for _ in range(h):
    mine_line = list(input())
    mine_area.append(mine_line)

for i in range(h):
    for j in range(w):
        if mine_area[i][j] == '#':
            mine_area[i][j] = '#'
        else:
            mine_area[i][j] = check_num(i, j)

for i in range(h):
    for j in range(w):
        print(mine_area[i][j], end='')
        if j == w-1:
            print()


Measured memory_bytes: 3572
using System;
using System.Collections.Generic;
using System.Linq;

namespace ConsoleApp
{
    class Program
    {
        static void Main(string[] args)
        {
            var ss = new string[3];
            for (int i = 0; i < ss.Length; i++)
                ss[i] = Console.ReadLine();

            var j = 0;
            for (int i = 0; i < ss.Length; i++)
                Console.Write(ss[i][j++]);

            Console.WriteLine();
        }
    }
}


Measured memory_bytes: 11092
fn read_stdin() -> String {
    use std::io::Read;
    let mut input = String::new();
    std::io::stdin().read_to_string(&mut input).unwrap();
    input
}

fn scan<'a, I: Iterator<Item = &'a str>, T: std::str::FromStr>(tokens: &mut I) -> T {
    tokens.next().unwrap().parse().ok().unwrap()
}

fn main() {
    let input = read_stdin();
    let tokens = &mut input.split_whitespace();
    let s: String = scan(tokens);
    let s: Vec<u8> = s.into_bytes();
    if s.len() % 2 == 1 {
        println!("No");
        return;
    }
    for i in 0..s.len() {
        if i % 2 == 0 && s[i] != b'h' {
            println!("No");
            return;
        }
        if i % 2 == 1 && s[i] != b'i' {
            println!("No");
            return;
        }
    }
    println!("Yes");
}


Measured memory_bytes: 4352
while True:
    a,op,b=input().split()
    a=int(a)
    b=int(b)
    if op == '?':
        break
    elif op == '+':
        print(a+b)
    elif op == '-':
        print(a-b)
    elif op == '*':
        print(a*b)
    elif op == '/':
        print(a//b)


Measured memory_bytes: 5596
#include <bits/stdc++.h>
using namespace std;
int main()
{
  string s;
  cin>>s;
  string s1[7]={"SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"};
  auto itr=find(s1,s1+7,s);
  cout<<7-distance(s1,itr);
  return 0;
}

  

Measured memory_bytes: 256
import java.util.Scanner;

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

        int a = stdIn.nextInt();
        int b = stdIn.nextInt();

        int cir = 2*(a+b);
        int area = a*b;

        System.out.println(area+ " " +cir);
    }
}

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

aka_list = [True]
for i in range(1, n):
    aka_list.append(False)
balls = [1] * n

for i in range(m):
    if aka_list[x_y[i][0] - 1]:
        aka_list[x_y[i][1]-1] = True
    balls[x_y[i][0] - 1] -= 1
    balls[x_y[i][1] - 1] += 1
    if balls[x_y[i][0] - 1] == 0:
        aka_list[x_y[i][0] - 1] = False

print(sum([1 for i in range(len(aka_list)) if aka_list[i]]))


Measured memory_bytes: 29472
#include <iostream> // cin, cout, cerr
#include <algorithm> // minmax, sort, swap
#include <numeric> // iota
#include <cstdio> // printf, scanf
#include <string> // string, stoi, to_string
#include <vector> // vector
#include <queue> // queue, priority_queue
#include <deque> // deque
#include <map> // key-value pairs sorted by keys
#include <set> // set
#include <iomanip> // cout<<setprecision(n)
#include <functional> // function<void(int)>
#include <cmath>
#include <cassert>
#include <bitset>

#ifdef DEBUG
#include "debug.hpp"
#else
#define debug(...)
#endif

#define int long long // at least int64 > 9*10^18
#define EL '\n'
#define rep(i,n) for(int i = 0; i < (n); i++)
#define print(i) std::cout << std::setprecision(10) << (i) << '\n'
#define all(v) (v).begin(), (v).end()
using Graph = std::vector<std::vector<int> >;
const int INF = 1e17;
/* libraries */

signed main() {
	const double PI = 3.141592;
	int r;
	std::cin >> r;
	print((double)(2*r)*PI);
	return 0;
}


Measured memory_bytes: 3752
using System;

namespace A
{
    class Program
    {
        static void Main(string[] args)
        {
            string s = Console.ReadLine();
            string t = Console.ReadLine();
            int cnt = 0;
            for(int i = 0; i < 3; i++)
            {
                if (s[i] == t[i]) cnt++;
            }
            Console.WriteLine(cnt);
        }
    }
}


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

int main() {
  int x, y;
  cin >> x >> y;
  if (x < y) cout << min(y - x, abs(y + x) + 1) << endl;
  else cout << min(x - y + 1, abs(x + y)) + 1 << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=5e5+10;
char s[N];
int n,ans[N];
ll res;
int main()
{
	scanf("%s",s+1);
	n=strlen(s+1);
	int i,j;
	ans[0]=0;
	for(i=1;i<=n;)
	{
		if(s[i]=='<')
		{
			ans[i]=ans[i-1]+1;
			i++;
			continue;
		}
		j=i;
		while(j<=n&&s[j]=='>')j++;
		j--;
		ans[j]=0;
		for(int k=j-1;k>=i;--k)
		ans[k]=ans[k+1]+1;
		ans[i-1]=max(ans[i-1],ans[i]+1);
		i=j+1;
	}
	for(i=0;i<=n;++i)
	//printf("%d:%d\n",i,ans[i]),
	res+=ans[i];
	printf("%lld\n",res);
	return 0;
} 

Measured memory_bytes: 2688
#include<stdio.h>

int main(){
  int i=0,n,j,a[100],count=0,temp;
  int flag=1;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&a[i]);
  }
  i=0;
  while(flag){
    flag=0;
    for(j=n-1;j>=i+1;j--){
      if(a[j]<a[j-1]){
        temp = a[j];
        a[j]=a[j-1];
        a[j-1]=temp;
        flag=1;
        count++;
      }
    }
    i++;
  }
  for(i=0;i<n;i++){
    if(i<n-1){
      printf("%d ",a[i]);
    }
    else{
      printf("%d\n",a[i]);
    }
  }
  printf("%d\n",count);
  return 0;
}



Measured memory_bytes: 2140
N, M = [int(x) for x in input().split()]

A = [int(x) for x in input().split()]
B = [int(x) for x in input().split()]

cntA = [0] * 1001
cntB = [0] * 1001

for a in A:
    cntA[a] = cntA[a] + 1

for b in B:
    cntB[b] = cntB[b] + 1

ans = 0
for a in range(1001):
    for b in range(1001):
        ans = ans + (a * b * cntA[a] * cntB[b])

print(ans)



Measured memory_bytes: 18524
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>
#include <iostream>
#include <string>
#include <set>
#include <map>
#include <unordered_map>
#include <complex>
#include <iomanip>
#include <cmath>
#include <tuple>
using namespace std;

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

    cout << a / b << endl;
}


Measured memory_bytes: 256
ans = []
while True:
	a, b = map(int, raw_input().split())
	if a + b == 0: break
	tmp = []
	for i in range(a, b+1):
		if i % 4 == 0:
			if i % 400 == 0:
				tmp.append(i)
			elif i % 100 == 0:
				continue
			else:
				tmp.append(i)
	if len(tmp) == 0: tmp.append("NA")
	ans.append(tmp)

for i in range(len(ans)):
	for s in ans[i]:
		print s
	if i != len(ans)-1:
		print

Measured memory_bytes: 4332
k, s = map(lambda x: int(x), input().split(' '))
r = 0
for a in range(k + 1):
    if a > s:
        break
    for b in range(k + 1):
        if a + b > s:
            break
        elif s - (a + b) < k + 1:
            r += 1
print(r)


Measured memory_bytes: 2940
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>

using namespace std;

#define ll long long
#define ull unsigned long long
#define REP(i, n) for(int i=0; i<n; i++)

ll a[100];
int main(){
    int N;
    cin >> N;
    ll x;
    cin >> x;
    REP(i,N){
        cin >> a[i];
    }
    sort(a,a+N);
    ll num = 0;
    while(x > 0 && num < N){
        x -= a[num++];
        if(x == 0)
            num++;
    }
    cout << num-1 << endl;
    return 0;
}


Measured memory_bytes: 256
# coding: utf-8
import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

S = sr()
T = sr()
bl = True
for s, t in zip(S, T):
    if s != t:
        bl = False
print('Yes' if bl else 'No')


Measured memory_bytes: 9044
#include<stdio.h>
#include<iostream>
#include<vector>
#include<math.h>
#include<queue>
#include<map>
#include<algorithm>
#include<string.h>
#include<functional>
#include<limits.h>
#include<stdlib.h>
#include<string>
#include<unordered_map>
#include<set>
using namespace std;

#define intmax INT_MAX
#define lmax LONG_MAX
#define uintmax UINT_MAX
#define ulmax ULONG_MAX
#define llmax LLONG_MAX
#define ll long long
#define rep(i,a,N) for((i)=(a);(i)<(N);(i)++)
#define rrp(i,N,a) for((i)=(N)-1;(i)>=(a);(i)--)
#define llfor ll i,j,k
#define sc(a) cin>>a
#define pr(a) cout<<a<<endl
#define pY puts("YES")
#define pN puts("NO")
#define py puts("Yes")
#define pn puts("No")
#define pnn printf("\n")
#define all(a) a.begin(),a.end()
#define push(a,b) (a).push_back(b)
#define llvec vector<vector<ll>>
#define charvec vector<vector<char>>
#define sizeoof(a,b) (a,vector<ll>(b))
#define llpvec vector<pair<ll,ll>>
/*繰り上げ除算*/ll cei(ll x,ll y){ll ans=x/y;if(x%y!=0)ans++;return ans;}
/*最大公約数*/ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}
/*最小公倍数*/ll lcm(ll x,ll y){return x/gcd(x,y)*y;}
/*n乗*/ll llpow(ll x,ll n){ll i,ans=1;rep(i,0,n)ans*=x;return ans;}
/*階乗*/ll fact(ll x){ll i,ans=1;rep(i,0,x)ans*=(x-i);return ans;}
/*nCr*/ll ncr(ll n,ll r){return fact(n)/fact(r)/fact(n-r);}
/*nPr*/ll npr(ll n,ll r){return fact(n)/fact(n-r);}
/*primejudge*/bool prime(ll a){if(a<=1)return false;ll i;for(i=2;i*i<=a;i++){if(a%i==0)return false;}return true;}
/*約数*/vector<ll>div(ll a){vector<ll>b;ll i;rep(i,1,a){if(!a%i)push(b,a);}return b;}
/*円周率*/ double pi=acos(-1);
llfor;///////////////////////////////////////////////////////////
int main(){
 ll n,k;
 sc(n);sc(k);
 llpvec a(n);
 ll x,y;
 rep(i,0,n){
  sc(x);sc(y);
  a[i]={x,y};
 }
 sort(all(a));
 ll cnt=0;
 rep(i,0,n){
  cnt+=a[i].second;
  if(cnt>=k){
   pr(a[i].first);
   return 0;
  }
 }
return 0;}



Measured memory_bytes: 4784
#include <iostream>
#include <string>
#include <algorithm>
#include <math.h>
#include <map>
#include <set>
using namespace std;
typedef long long ll;
#define rep(i,s,n)for(ll i = s;i<n;i++)
#define repe(i,s,n)for(ll i = s;i<=n;i++)
ll A[100001] = {};
ll B[100001] = {};
int main() {
	ll N; cin >> N;

	rep(i, 0, N) {
		cin >> A[i];
		B[A[i]]++;
	}
	if (N % 2 == 0) {
		rep(i, 0, N) {
			if (i % 2 == 0) {
				if (B[i] != 0) {
					cout << 0 << endl;
					return 0;
				}
			}
			else if (i % 2 != 1) {
				if (B[i] != 2)
				{
					cout << 0 << endl;
					return 0;
				}
			}
		}
	}
	else {
		rep(i, 0, N) {
			if (i == 0) {
				if (B[i] != 1) {
					cout << 0 << endl;
					return 0;
				}
			}
			else if (i % 2 == 0) {
				if (B[i] != 2) {
					cout << 0 << endl;
					return 0;
				}
			}
			else {
				if (B[i] != 0)
				{
					cout << 0 << endl;
					return 0;
				}
			}
		}
	}
	ll ans = 1;
	repe(i, 1, N / 2) {
		ans = 2 * ans % 1000000007;
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 1792
#include <iostream>

using namespace std;

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

    int n, m;
    cin >> n >> m;

    int digits[4] = { -1, -1, -1, -1 };

    for (int i = 0; i < m; i++)
    {
        int s, c;
        cin >> s >> c;

        if (digits[s - 1] != -1 && digits[s - 1] != c)
        {
            cout << "-1\n";
            return 0;
        }

        digits[s - 1] = c;
    }

    if (digits[0] == 0 && n != 1)
    {
        cout << "-1\n";
        return 0;
    }

    if (digits[0] == -1)
    {
        if (n == 1)
            digits[0] = 0;
        else
            digits[0] = 1;
    }

    for (int i = 1; i < n; i++)
        if (digits[i] == -1)
            digits[i] = 0;

    for (int i = 0; i < n; i++)
        cout << digits[i];

    cout << "\n";

    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();

		int sum = 0;
		int n = x;
		while(n > 0) {
			sum += n % 10;
			n /= 10;
		}

		String result = (x % sum == 0) ? "Yes" : "No";
		System.out.println(result);
	}

}

Measured memory_bytes: 21716
a, b = input().split()
c = int(a+b)

# print(c)

def try_square_root_naive(n):
    m = int(n**.5)
    return m if abs(m*m - n) < 1e-6 else None

if try_square_root_naive(c)==None:
    print('No')
else:
    print('Yes')

Measured memory_bytes: 2940
n = int(input())
s = [input() for _ in range(n)]
m = int(input())
t = [input() for _ in range(m)]
ans = [0]*n
for i in range(n):
    for j in range(n):
        if s[i] == s[j]:
            ans[i] += 1
    for j in range(m):
        if s[i] == t[j]:
            ans[i] -= 1
print(max(0, max(ans)))

Measured memory_bytes: 3064
object Main {
    def main(args: Array[String]): Unit = {
      val lines = io.Source.stdin.getLines().toSeq
      println(solve(lines))
    }

    def solve(lines: Seq[String]): String = {
      val s = lines.head.split("").filter(_.length > 0).take(4)
      debug(s)

      val left = s.slice(0, 2).mkString("").toInt
      val right = s.slice(2, s.length).mkString("").toInt
      debug(left, right)

      val isLeftMonth = isMonth(left)
      val isRightMonth = isMonth(right)

      var ans = ""
      if (isLeftMonth != isRightMonth) {
        ans = if (isLeftMonth) "MMYY" else "YYMM"
      } else if (!isLeftMonth && !isRightMonth) {
        ans = "NA"
      } else {
        ans = "AMBIGUOUS"
      }
      ans
    }

    def isMonth(n: Int): Boolean = {
      n >= 1 && n <= 12
    }

    private def debug(x: Any): Unit = {
      if (System.getenv("LOCAL_DEBUG") != null) println(x)
    }
  }

Measured memory_bytes: 27200
#include <bits/stdc++.h>
using namespace std;
long long  gcd(long long  a, long long  b){
    if(b==0) return a;
    return gcd(b, a%b);
}

int main(){
  long long a,b;
  cin>>a>>b;
  cout<<3*(a-gcd(a,b));
}

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

count = 0

for i in range (0, len(S)):
	if S[i] == 'W':
		count+=1

choma = 0

for i in range (0, len(S)):
	if S[i] == 'W':
		choma+=(i+1)

if count*(count+1)/2 < choma:
	print(int(choma-count*(count+1)/2))
else:
	print(0)

Measured memory_bytes: 3500
#include<iostream>
#include<cmath>
#include<algorithm>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<set>
#include<map>
#include<iomanip>
#include<bitset>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<ll,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define fi first
#define sc second
#define rep(i,x) for(ll i=0;i<x;i++)
#define repn(i,x) for(ll i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())

const int MAX = 510000;
const int mod = 1000000007;

struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};

int main(){
  ll N; cin >> N;
  vector<ll> a(N); rep(i,N) cin >> a[i];
  vector<ll> cnt(N);
  cnt[0] = 3;

  mint ans = 1;
  rep(i,N){
    cnt[a[i] + 1]++;
    ans *= cnt[a[i]];
    cnt[a[i]]--;
    // cout << ans.x << endl;
  }
  cout << ans.x << endl;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
const int maxn=100005;
const long long mod=10e9+5;
long long dp[maxn],a[maxn];
int main()
{
    int n,k;
    cin>>n>>k;
    for(int i=0;i<n;i++)
        dp[i]=mod;
    for(int i=0;i<n;i++)
        cin>>a[i];
    dp[0]=0;
    for(int i=0;i<n;i++)
    for(int j=i+1;j<=i+k;j++)
        if(j<n)
        dp[j]=min(dp[j],dp[i]+abs(a[i]-a[j]));
    cout<<dp[n-1]<<endl;
    return 0;
}


Measured memory_bytes: 1792
S = input()
ls = []
rs = []
if S[0] == '>':
    ls.append(0)
pre = None
seq = 0
for c in S:
    if c == pre:
        seq += 1
    else:
        if pre:
            if pre=='<':
                ls.append(seq)
            else:
                rs.append(seq)
        seq = 1
        pre = c
if pre=='<':
    ls.append(seq)
else:
    rs.append(seq)
if len(ls) > len(rs):
    rs.append(0)

ans = 0
for l,r in zip(ls,rs):
    if l<r: l,r = r,l
    ans += l*(l+1)//2 + r*(r-1)//2
print(ans)

Measured memory_bytes: 6300
import java.util.Scanner;

public class Main {

    /**
     * 本処理を実行します。
     */
    public static void execute() {
        Scanner sc = new Scanner(System.in);

        String s = nextString(sc);
        int count = 0;
        char[] c = s.toCharArray();

        for (char cc : c) {
            if (cc == '1') {
                count++;
            }
        }

        out(count);

    }

    /**
     * 次の標準入力をintで受け取ります。
     * @return 標準入力値(int)
     */
    public static int nextInt(Scanner sc) {
        return sc.nextInt();
    }

    /**
     * 次の標準入力をStringで受け取ります。
     * @return 標準入力値(String)
     */
    public static String nextString(Scanner sc) {
        return sc.next();
    }

    /**
     * 次の標準入力を指定回数分intで受け取ります。
     * @param n 取得回数
     * @return 取得した標準入力値の配列(int)
     */
    public static int[] nextInts(Scanner sc, int n) {
        int[] arr = new int[n];

        for (int i = 0; i < n; i++) {
            arr[i] = nextInt(sc);
        }

        return arr;
    }

    /**
     * 標準出力にオブジェクトを出力します。
     * @param o 出力対象
     */
    public static void out(Object o) {
        System.out.println(o);
    }

    public static void main(String[] args) {
        execute();
    }
}

Measured memory_bytes: 23636
n = int(input())
a =  list(map(int, input().split()))

money =1000
stock = 0

for i in range(n-1):
    if a[i] <a[i+1]:
        stock += money//a[i]
        money =money%a[i]
    elif a[i] >a[i+1]:
        money +=stock*a[i]
        stock = 0
 
print(money+stock*a[n-1])

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

int main(){
    int n; cin>>n;
    int c[n],s[n],f[n];
    for(int i=0;i<n-1;i++){
        cin>>c[i]>>s[i]>>f[i];
    }

    for(int i=0;i<n-1;i++){
        int time=s[i]+c[i];
        for(int j=i+1;j<n-1;j++){
            while(true){
                if(time>=s[j] and time%f[j]==0) break;
                time++;
            }
            time+=c[j];
        }
        cout<<time<<endl;
    }
    cout<<0<<endl;
    return 0;
}


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

#define rep(i,a,b) for(int (i)=(a);(i)<=(b);(i)++)
#define pii pair<int,int>
#define vi vector<int>
#define vit vector<int>::iterator it
#define mii map<int,int>
#define mis map<int,string>
#define msi map<string,int>
#define X first
#define Y second
#define all(a) a.begin(), a.end()
#define pb push_back
#define mp make_pair
#define sz(v) (int)(v.size())
#define si set<int>
#define ms(a,f) memset((a),(f),sizeof (a))

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
const int inf=0x7f7f7f7f;
const int N=1e5+10;

int main() {
    string st;
    cin>>st;
    for(int i=0;i<sz(st);i++) if(st[i]=='7') {
        cout<<"Yes"<<endl;
        return 0;
    }
    cout<<"No\n";
    return 0;
}

Measured memory_bytes: 3620
s=input()+"9";n=len(s);X=[0]*4;Y=[0]*4;
while n:
 n-=1;k=4
 while k:k-=1;a=int(s[n]);Y[k],X[k]=(X[k]+(a-1)*X[k-1]+Y[k-1]if a else Y[k],X[k]+9*X[k-1])if k else (1,1)
print(Y[int(input())])

Measured memory_bytes: 38384
#include <iostream>
using std::cin;
using std::cout;
using std::endl;

#include <string>
using std::string;

int main()
{
  string s;
  cin >> s;
  
  for (int i = 0; i < s.size(); i++)
  {
    if (s.at(i) == '7')
    {
      cout << "Yes" << endl;
      return 0;
    }
  }
  
  cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 3624
#include <iostream>
#include <vector>

using namespace std;

int main()
{
	int n, m;
	cin >> n >> m;
	vector<int> a(n);
	int c, b;
	for (int i = 0; i < m; i++) {
		cin >> c >> b;
		c--;
		b--;
		a[c]++;
		a[b]++;
	}
	for (int i = 0; i < n; i++) {
		cout << a[i] << endl;
	}

	return 0;
}

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

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

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

	string ans = "";
	for (int i = 0; i < n; ++i) {
		ans += s[i];
		ans += t[i];
	}

	cout << ans;
	
	return 0;
}
	

Measured memory_bytes: 256
N = int(input())

def f(k):
    s = str(k)
    n = len(s)
    ans = 0
    for i in range(n):
        ans += int(s[i])
    return ans

ans = float("INF")
for i in range(1, N):
    j = N-i
    t = f(i) + f(j)
    ans = min(ans, t)

print(ans)

Measured memory_bytes: 9188
import java.util.*;

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

        int n = sc.nextInt();
        int[] list = new int[n];

        for (int i = 0; i< n; i++){
            list[i] = sc.nextInt();
        }

        Arrays.sort(list);

        System.out.println(Math.abs(list[n-1] - list[0]));
    }
}



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

int main() {
  int n;
  ll a,b,ans = 0,pos = 0;
  cin >> n >> a >> b;
  rep(i,0,n){
    ll x;
    cin >> x;
    if(i == 0){
      pos = x;
      continue;
    }
    if((x-pos)*a >= b) ans += b;
    else ans += (x-pos)*a;
    pos = x;
  }
  cout << ans << endl;
}

Measured memory_bytes: 3604
N = gets.to_i
D = N.times.map{gets.split.map(&:to_i)}
ans = 0

(0..N-3).each do |i|
  if D[i][0]==D[i][1] && D[i+1][0]==D[i+1][1] && D[i+2][0]==D[i+2][1]
    ans += 1
  end
end

if ans > 0
  puts 'Yes'
else
  puts 'No'
end

Measured memory_bytes: 14388
use proconio::input;

fn main() {
    input! {
        s: String
    }
    let mut res:i64 = 0;
    for ch in s.chars() {
        res = res + (ch as i32 - '0' as i32 ) as i64;
    }
    if res%9!=0 {
        println!("No")
    } else {
        println!("Yes")
    }
}


Measured memory_bytes: 2400
#include <stdio.h>
int main(){
  int n,i;
  scanf("%d",&n);
  double x[n],sum=0.0;
  char u[n][4];
  for(i=0;i<n;i++){
   scanf("%lf %s",&x[i],u[i]);
  if(u[i][0]=='J')
   sum+=x[i];
  else
   sum+=380000.0*x[i];
  }
 printf("%f",sum);
return 0;
}

Measured memory_bytes: 128
import sys


if __name__ == "__main__":
    N, S = map(lambda x: int(x), input().split())
    a = list(map(lambda x: int(x), input().split()))

    ans = sys.maxsize
    s = 0
    e = 0
    value = 0
    for idx in range(N):
        value += a[idx]
        if (S <= value):
            e = idx
            while (S <= value):
                value -= a[s]
                s += 1
            ans = min(ans, e - s + 2)
    ans = ans if ans != sys.maxsize else 0
    print(ans)



Measured memory_bytes: 16384
/** 
 * Dont raise your voice, improve your argument.
 * --Desmond Tutu
 */

#include <bits/stdc++.h>
using namespace std;

/* see https://github.com/pllk/cphb/ */
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
typedef tree<int,null_type,less<int>,rb_tree_tag,
    tree_order_statistics_node_update> indexed_set;

typedef unsigned int uint;
typedef long long ll;
typedef __int128 lll;

#define fori(n) for(ll i=0; i<(n); i++)
#define forn(i, n) for(ll i=0; i<(n); i++)
#define forn3(i, x, n) for(ll i=(x); i<(n); i++)

int main() {
cin.tie(nullptr);
std::ios::sync_with_stdio(false);
    int n, k;
    cin>>n>>k;

    if(k<2)
        cout<<0<<endl;
    else {
        int ans=n-k;
        cout<<ans<<endl;
    }

}



Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<utility>
#include<algorithm>
#include<map>
#include<cstdlib>
#include<cmath>
#include<numeric>
using namespace std;
using ll =long long;

int main() {
	ll N;
	map<ll,ll>A;
	cin >> N;
	ll c;
	for (ll i = 0; i < N; i++) {
		cin >> c;
		A[c]++;

	}
	for (auto i = A.begin(); i !=A.end(); i++) {


		if (i->second > 1) {


			cout << "NO";
			return 0;
		}
	}

	cout << "YES";

	/*
	string S;
	cin >> S;
	for (int i = 0; i < S.size(); i++) {

		cout << "x";


	}*/

}

Measured memory_bytes: 12800
#[allow(unused_imports)]
use std::cmp::{max, min, Ordering};

#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};

#[allow(unused_imports)]
use std::io::{stdin, stdout, BufWriter, Write};

#[allow(unused_imports)]
use std::iter::FromIterator;

#[allow(unused_macros)]
macro_rules! min {
    ($x: expr) => ($x);
    ($x: expr, $($z: expr),+) => {{
        min($x, min!($($z),*))
    }}
}

#[allow(unused_macros)]
macro_rules! max {
    ($x: expr) => ($x);
    ($x: expr, $($z: expr),+) => {{
        max($x, max!($($z),*))
    }}
}

#[allow(unused_macros)]
macro_rules! get { 
    ([$t: ty]) => { 
        { 
            let mut line = String::new(); 
            stdin().read_line(&mut line).unwrap(); 
            line.split_whitespace().map(|t|t.parse::<$t>().unwrap()).collect::<Vec<_>>()
        }
    };
    ([$t: ty];$n: expr) => {
        (0..$n).map(|_|get!([$t])).collect::<Vec<_>>()
    };
    ($t: ty) => {
        {
            let mut line = String::new();
            stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t: ty),*) => {
        { 
            let mut line = String::new();
            stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            ($(iter.next().unwrap().parse::<$t>().unwrap(),)*)
        }
    };
    ($t: ty; $n: expr) => {
        (0..$n).map(|_|get!($t)).collect::<Vec<_>>()
    };
    ($($t: ty),*; $n: expr) => {
        (0..$n).map(|_|get!($($t),*)).collect::<Vec<_>>()
    };
}

#[allow(unused_macros)]
macro_rules! debug { 
    ($($a: expr),*) => { 
        println!(concat!($(stringify!($a)," = {:?}, "),*), $($a),*);
    } 
}

const BIG_STACK_SIZE: bool = true;

#[allow(dead_code)]
fn main() {
    use std::thread;
    if BIG_STACK_SIZE {
        thread::Builder::new()
            .stack_size(32 * 1024 * 1024)
            .name("solve".into())
            .spawn(solve)
            .unwrap()
            .join()
            .unwrap();
    } else {
        solve();
    }
}

#[allow(dead_code)]
fn read<T>() -> Vec<T>
where T:
    std::str::FromStr,
    T::Err: std::fmt::Debug {

    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();
    buf.split_whitespace()
        .map(|s| s.trim().parse().unwrap())
        .collect()
}

fn fx(x: u64) -> u64 {
    let mut res = 0u64;
    res |= if (x+1) % 4 < 2 {
        0
    } else {
        1
    };
    for i in 1..40 {
        let tmp = x % (1<<(i+1));
        res |= if tmp < (1<<i) {
            0
        } else {
            ((tmp-(1<<i)+1) % 2) << i
        };
    }
    res
}

fn solve() {
    let (a, b) = get!(u64, u64);
    
    if a == 0 {
        println!("{}", fx(b));
        return;
    }
    println!("{}", fx(b) ^ fx(a-1));
}


Measured memory_bytes: 8572
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {

	static BufferedReader reader;
	//static field here
	
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		reader = new BufferedReader(new InputStreamReader(System.in));
		//code here
		String[] strings = readLine();
		int H = Integer.parseInt(strings[0]);
		int A = Integer.parseInt(strings[1]);
		
		print((H+A-1)/A);
		//String[] s = readLine();
		//print(num);
	}
	
	//functions here
	//note that all methods should be STATIC

	private static String[] readLine(){
		try{
			return reader.readLine().split(" ");
		}catch(Exception e){
			e.printStackTrace();
			return new String[]{e.getMessage()};
		}
	}
	private static void print(Object o){
		System.out.println(o);
	}
	private static void print(){
		System.out.println();
	}
}


Measured memory_bytes: 21076
#include <iostream>

using namespace std;

int main(){
	int a, b, c, k;
	cin >> a >> b >> c >> k;
	int max = 0;

	while(a>0 && k>0){
		max += 1;
		a--;
		k--;
	}

	while(b>0 && k>0){
		b--;
		k--;
	}

	while(c>0 && k>0){
		max -= 1;
		c--;
		k--;
	}

	cout << max << endl;
	
	return 0;
}

Measured memory_bytes: 3636
def main():
    from heapq import heappop, heappush
    import sys
    input = sys.stdin.readline

    Q = int(input())

    left = []
    right = []
    sum_l = 0
    sum_r = 0
    cnt = 0
    b = 0
    for _ in range(Q):
        query = map(int, input().split())
        t = next(query)
        if t == 1:
            x, b_ = query
            b += b_
            cnt += 1
            if cnt % 2 == 0:
                heappush(left, -x)
                sum_l += x
                x = -heappop(left)
                sum_l -= x
                heappush(right, x)
                sum_r += x
            else:
                heappush(right, x)
                sum_r += x
                x = heappop(right)
                sum_r -= x
                heappush(left, -x)
                sum_l += x
        else:
            x = -left[0]
            ans = b + sum_r - sum_l + x * (cnt % 2)
            print(x, ans)


if __name__ == '__main__':
    main()

# import sys
# input = sys.stdin.readline
#
# sys.setrecursionlimit(10 ** 7)
#
# (int(x)-1 for x in input().split())
# rstrip()


Measured memory_bytes: 11148
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**13
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)

def main():
    n = I()
    a = LI()
    c1 = collections.defaultdict(int)
    c2 = collections.defaultdict(int)
    c1['.'] = 0
    c2['a'] = 0
    for i in range(n//2):
        c1[a[i*2]] += 1
        c2[a[i*2+1]] += 1
    m = 0
    for k,v in sorted(c1.items(), key=lambda x: [-x[1], x[0]])[:2]:
        for k2,v2 in sorted(c2.items(), key=lambda x: [-x[1], x[0]]):
            if k2 == k:
                continue
            if m < v+v2:
                m = v+v2
                break

    return n - m


print(main())


Measured memory_bytes: 24772
#include <bits/stdc++.h>
#define SZ(x) ((int) (x).size())
using namespace std;

typedef long long i64;

int main() {
    #ifdef LOCAL_RUN
    freopen("task.in", "r", stdin);
    freopen("task.out", "w", stdout);
    //freopen("task.err", "w", stderr);
    #endif // ONLINE_JUDGE
    ios::sync_with_stdio(false);
    cin.tie(0);

    int n;
    cin >> n;

    if (n == 1) {
        cout << "YES\n";
        return 0;
    }

    vector<int> A(n);
    int64_t sum = 0;
    for (int i = 0; i < n; ++i) {
        cin >> A[i];
        sum += A[i];
    }
    int64_t xadd = (int64_t) n * (n + 1) / 2;
    if (sum % xadd) {
        cout << "NO\n";
        return 0;
    }
    int64_t cnt = sum / xadd;
    vector<int> take(n, 0);
    for (int i = 0; i < n; ++i) {
        int a = A[i], b = A[(i + 1) % n];
        int xcnt = cnt;
        if (b >= a) {
            xcnt -= b - a;
        } else {
            int x = ((a - b) + n - 2) / (n - 1);
            xcnt -= x;
            a -= x * (n - 1);
            if (a < 0) {
                cout << "NO\n";
                return 0;
            }
            xcnt -= b - a;
        }
        if (xcnt < 0) {
            cout << "NO\n";
            return 0;
        }
        if (xcnt % n != 0) {
            cerr << i << ' ' << xcnt << endl;
            cout << "NO\n";
            return 0;
        }
    }
    cout << "YES\n";
}


Measured memory_bytes: 1024
#define _GLIBCXX_DEBUG
#pragma GCC diagnostic ignored "-Wsign-compare"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < int(n); ++i)

void solve() {
    int n, m;
    cin >> n >> m;
    vector<vector<int>> S(m, vector<int>(0));
    int k, s;
    rep(i, m) {
        cin >> k;
        rep(j, k) {
            cin >> s;
            S[i].push_back(s - 1);
        }
        sort(S[i].begin(), S[i].end());
    }
    vector<int> P(m);
    for (auto &e : P) {
        cin >> e;
    }
    int ans = 0;
    for (int bit = 0; bit < (1 << n); bit++) {
        int cnt = 0;
        rep(j, m) {
            k = 0;
            rep(i, n) {
                if (bit & (1 << i)) {
                    // スイッチiが押された
                    for (auto &e : S[j])
                        if (e == i) k++;
                }
            }
            if (P[j] == k % 2)
                cnt++;
            else
                break;
        }
        if (cnt == m) ans++;
    }
    cout << ans << "\n";
}
int main() {
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    solve();
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <climits>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#include <set>
using namespace std;

#define rep(i,n) for(ll (i)=0;(i)<(n);(i)++ )
#define repf(i,m,n) for(ll (i)=m;(i)<n;(i)++)
#define all(v) (v).begin(), (v).end()
#define ll long long
#define vec(name,num) vector<ll> name((num),0);
#define op(i) cout<<(i)<<endl;
#define opf(i) cout<<fixed<<setprecision(10)<<(i)<<endl;
#define ip(i) cin>>(i);
#define opN cout<<"No"<<endl;
#define opY cout<<"Yes"<<endl;
#define opP cout<<"Possible"<<endl;
#define opI cout<<"Impossible"<<endl;
#define mat(name,fnum,snum); vector<vector<ll>> name((fnum),vector<ll>((snum),0));
#define matC(name,fnum,snum); vector<vector<char>> name((fnum),vector<char>((snum),0));
#define debugP int debug_point; cin>>debug_point;
#define FI first
#define SE second
const ll MOD= 1e9 + 7;
vec(ans,0);
//
void solve(long long N, long long M, string S){
  ll i=N;
  while(i>0){
    ll fla=1;
    for(ll j=M;j>=1;j--){
      if(i-j<0)j=i;
      if(S[i-j]=='0'){
        ans.push_back(j);
        i=i-j;
        fla=0;
        break;
     
      }
    }
    if(fla){
    op(-1);
    return;
    }
  }
  for(ll i=ans.size()-1;i>=0;i--){
   if(i!=0) cout<<ans[i]<<" ";
   else cout<<ans[i];
  }
  cout<<endl;
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long N;
    scanf("%lld",&N);
    long long M;
    scanf("%lld",&M);
    string S;
    cin>>S;
    solve(N, M, S);
    return 0;
}


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

using namespace std;

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

	int x1, x2, x3, x4, x5;
	cin >> x1 >> x2>> x3>> x4>> x5;
	
	if(x1 == 0){ cout << 1 <<'\n';}
	if(x2 == 0){ cout << 2 <<'\n';}
	if(x3 == 0){ cout << 3 <<'\n';}
	if(x4 == 0){ cout << 4 <<'\n';}
	if(x5 == 0){ cout << 5 <<'\n';}
  
  return 0;

}


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

#define INF 1e9
using namespace std;

int main() {

    int N; cin >> N;

    vector<pair<int, int>> W(N);

    for (int i = 0; i < N; ++i) {
        int A, B;
        cin >> A >> B;

        W[i] = make_pair(B, A);
    }

    sort(W.begin(), W.end());

    int time = 0;

    for (int i = 0; i < N; ++i) {
        time += W[i].second;
        if (W[i].first < time ) {
            cout << "No" << endl;
            return 0;
        }
    }

    cout << "Yes" << endl;
}

Measured memory_bytes: 1792
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cassert>
#include <cstring>
#include <string>
#include <vector>
#include <random>
#include <bitset>
#include <queue>
#include <cmath>
#include <unordered_map>
#include <set>
#include <map>
#define rep(i,n) for (int i=0; i<n;++i)
#define ALL(a)  (a).begin(),(a).end()
#define PI 3.14159265358979
typedef long long ll;
using namespace std;
const ll MOD = 1e9+7LL;
const int INF = 2e9;
int s;
vector<int> a;
map<int, int> M; 

void calc(int idx) {
  if (a[idx-1]%2==0) a.push_back(a[idx-1]/2);
  else a.push_back(a[idx-1]*3+1);
} 

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

  cin >> s;
  a.push_back(s);
  M[s] = 1;
  int idx = 1;
  while(true) {
    calc(idx);
    if (M[a[a.size()-1]]>0) {
      cout << a.size() << "\n";
      return 0;
    }
    M[a[idx]] = idx;
    idx++;
  }
  
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<queue>
using namespace std;
 
#define BLANK 0
#define BLOCK 1
#define POSSIBLE 2
#define CENTER 100
#define MAX 200+1
 
struct point{int x,y,d;};
 
int main()
{
  int t,n,cnt;
  int i,j,a,b;
  int dx[6]={0,1,1,0,-1,-1};
  int dy[6]={1,1,0,-1,-1,0};
  int field[MAX][MAX];
  queue<point> q;
  point p,p2;
  while(cin>>t>>n,t||n){
    for(i=0;i<MAX;i++)for(j=0;j<MAX;j++)field[i][j]=BLANK;
    for(i=0;i<n;i++){
      cin>>a>>b;
      field[a+CENTER][b+CENTER]=BLOCK;
    }
 
    cnt=1;
    while(!q.empty())q.pop();
    cin>>a>>b;
    p.x=a+CENTER;
    p.y=b+CENTER;
    p.d=0;
field[p.x][p.y]=POSSIBLE;
    q.push(p);
    while(!q.empty()){
      p=q.front();
      q.pop();
      if(p.d>=t)continue;
      for(i=0;i<6;i++){
        p2.x=p.x+dx[i];
        p2.y=p.y+dy[i];
        p2.d=p.d+1;
        if(field[p2.x][p2.y]!=BLANK)continue;
field[p2.x][p2.y]=POSSIBLE;
q.push(p2);
cnt++;
      }
    }
    cout<<cnt<<endl;
  }
}

Measured memory_bytes: 0
from sys import stdin
import numpy as np
from operator import itemgetter

N = int(stdin.readline().rstrip().split()[0])
A = [int(x) for x in stdin.readline().rstrip().split()]

ans = "Yes"
L = []
L_cnt = {}
for a in A:
    if a in L:
        L_cnt[a]+=1
        continue

    if len(L)>=3:
        ans = "No"
        break
    L.append(a)
    L_cnt[a]=1

if len(L)==3:
    l1, l2, l3 = L
    if N%3!=0:
        ans="No"
    if not L_cnt[l1]==L_cnt[l2]==L_cnt[l3]:
        ans="No"
    while ans=="Yes":
        sumL = l1%2 + l2%2 + l3%2
        if sumL!=0 and sumL!=2:
            ans = "No"
            break
        l1 = l1//2
        l2 = l2//2
        l3 = l3//2
        if l1+l2+l3==0:
            break
    print(ans)
elif len(L)==2:
    if N%3!=0:
        ans="No"
    if L_cnt[0]!=N//3:
        ans="No"
    if L[0]!=0 and L[1]!=0:
        ans="No"
    print(ans)
else:
    if sum(L)!=0:
        ans="No"
    print(ans)


Measured memory_bytes: 23168