akhauriyash/Code-Regression huggingface dataset:
#include <functional>
#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>
typedef long long ll;
using namespace std;
const ll MOD = 1000000007LL;

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

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

    auto possible = [&](int len) -> bool {
        int count = 0;
        for (int i = 0; i < n; i++) {
            count += a[i] / len;
            if (a[i] % len == 0) count--;
            if (count > k) return false;
        }
        return true;
    };

    int l = 0, r = 1e9;
    while (r - l > 1) {
        int mid = (l + r) / 2;
        if (possible(mid)) {
            r = mid;
        } else {
            l = mid;
        }
    }

    cout << r << endl;
    return 0;
}

Measured memory_bytes: 3964
s=input()
a=0
b=0
c=0
for i in range(len(s)):
    if s[i]=='a':
        a+=1
    if s[i]=='b':
        b+=1
    if s[i]=='c':
        c+=1

if abs(a-b) > 1 or abs(b-c) > 1 or abs(c-a)>1:
    print("NO")
else:
    print("YES")


Measured memory_bytes: 3188
#include<iostream>
#include<set>
#include<stack>
#include<queue>
#include<string>
#include<algorithm>//min,max,swap,rand,reverse,sort,lower_bound
#include<functional>
#include<vector>
#include<list>
#include<map>
#include<tuple>
#include<cmath>//abs, sin, cos
#include<bitset>
using namespace std;

int main()
{
	char S[20];
	cin >> S;
	cout << S[0];
	cout << S[1];
	cout << S[2];
	return 0;
}

Measured memory_bytes: 3060
// 2011/07/20 Tazoe

#include <iostream>
#include <queue>
#include <map>
using namespace std;

struct state{
	int tx;
	int ty;
	int kx;
	int ky;
	int tim;
};

int main()
{
	while(true){
		int X, Y;
		cin >> X >> Y;
		if(X==0&&Y==0)
			break;

		int d[52][52];
		for(int y=0; y<=Y+1; y++)
			for(int x=0; x<=X+1; x++)
				d[y][x] = 1;

		struct state now;
		cin >> now.tx >> now.ty;
		cin >> now.kx >> now.ky;
		now.tim = 0;

		queue<struct state> que;
		que.push(now);

		map<int, bool> memo;

		for(int y=1; y<=Y; y++)
			for(int x=1; x<=X; x++)
				cin >> d[y][x];

		while(true){
			if(que.empty()){
				cout << "NA" << endl;
				break;
			}

			now = que.front();
			que.pop();

			int tk = ((now.tx*100+now.ty)*100+now.kx)*100+now.ky;
			if(memo.find(tk)!=memo.end())
				continue;
			else
				memo[tk] = true;

			if(now.tim>=100){
				cout << "NA" << endl;
				break;
			}

			if(now.tx==now.kx&&now.ty==now.ky){
				cout << now.tim << endl;
				break;
			}

			struct state nxt = now;
			if(d[nxt.ty-1][nxt.tx]==0)
				nxt.ty--;
			if(d[nxt.ky+1][nxt.kx]==0)
				nxt.ky++;
			nxt.tim++;
			que.push(nxt);

			nxt = now;
			if(d[nxt.ty+1][nxt.tx]==0)
				nxt.ty++;
			if(d[nxt.ky-1][nxt.kx]==0)
				nxt.ky--;
			nxt.tim++;
			que.push(nxt);

			nxt = now;
			if(d[nxt.ty][nxt.tx-1]==0)
				nxt.tx--;
			if(d[nxt.ky][nxt.kx+1]==0)
				nxt.kx++;
			nxt.tim++;
			que.push(nxt);

			nxt = now;
			if(d[nxt.ty][nxt.tx+1]==0)
				nxt.tx++;
			if(d[nxt.ky][nxt.kx-1]==0)
				nxt.kx--;
			nxt.tim++;
			que.push(nxt);
		}
	}

	return 0;
}

Measured memory_bytes: 0
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

class Program {
    static void Main (string[] args) {
        string[] inme = Console.ReadLine ().Split(' ');
        long　a = long.Parse(inme[0]);
        long　b = long.Parse(inme[1]);

        long ans = (a+b) /2;
        long flg = (a+b) %2;


        if( flg == 0){
            Console.WriteLine(ans);            
        }else{
            Console.WriteLine("IMPOSSIBLE");            
        }  

    }
}

Measured memory_bytes: 11092
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():
    h, w = input_int_map()
    rows = []

    for _ in range(h):
        rows.append(list(input()))

    for row in range(h):
        for col in range(w):
            replace_space(row, col, rows)

    for row in rows:
        print("".join(map(str, row)))

def replace_space(row: int, col:int, rows: []):

    if rows[row][col] != '.':
        return

    h = len(rows)
    w = len(rows[0])

    nums = [(1, -1), (1, 0), (1, 1), (0, -1), (0, 1), (-1, -1), (-1, 0), (-1, 1)]

    bomb_count = 0
    for y_diff, x_diff in nums:
        y = row + y_diff
        x = col + x_diff

        if y >= h or y < 0:
            continue

        if x >= w or x < 0:
            continue

        if rows[y][x] == '#':
            bomb_count += 1

    rows[row][col] = bomb_count

run()

# 1, 2, 3
# 2  3  1

# 1  2

# 1, 2  3, 4
# 2  3  4  1













Measured memory_bytes: 68596
package main

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

func main() {
	var n, k int
	fmt.Scan(&n)
	fmt.Scan(&k)

	scanner := bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)

	nodes := make([][]int, n)
	for i := 0; i < n; i++ {
		nodes[i] = []int{}
	}

	for i := 0; i < n-1; i++ {
		scanner.Scan()
		a, _ := strconv.Atoi(scanner.Text())
		scanner.Scan()
		b, _ := strconv.Atoi(scanner.Text())
		nodes[a-1] = append(nodes[a-1], b-1)
		nodes[b-1] = append(nodes[b-1], a-1)
	}

	mod := 1000000007
	ret := k % mod
	p := k - 1
	var queue [][]int
	for i := 0; i < len(nodes[0]); i++ {
		queue = append(queue, []int{0, nodes[0][i]})
		ret = (ret * p) % mod
		p--
	}

	for len(queue) > 0 {
		parent := queue[0][0]
		current := queue[0][1]
		queue = queue[1:]

		p := k - 2
		for i := 0; i < len(nodes[current]); i++ {
			if nodes[current][i] == parent {
				continue
			}
			queue = append(queue, []int{current, nodes[current][i]})
			ret = (ret * p) % mod
			p--
		}
	}

	fmt.Println(ret)
}


Measured memory_bytes: 18048
#define _CRT_SECURE_NO_WARNINGS
#pragma comment(linker, "/stack:512000000")
#include<utility>
#include<iostream>
#include<fstream>
#include<vector>
#include<array>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<ctime>
#include<functional>
#include<random>
#include<climits>
#include<queue>
#include<stack>
#include<deque>
#include<bitset>
#include<map>
#include<set>
#include<unordered_map>
#include<unordered_set>
#include<cassert>
#include<ccomplex>

#ifdef ONLINE_JUDGE
#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,tune=native")
#pragma GCC optimize("unroll-loops")
#define int128 __int128
#else
#define int128 long long
#endif

#define all(x) x.begin(), x.end()
#define mp make_pair
#define X first
#define Y second

using namespace std;

using ll = long long;
using ull = unsigned long long;
using ld = long double;
mt19937_64 gen(time(nullptr));

ll const mod = 1e9 + 7;

namespace {
	ll mul(ll a, ll b) {
		ll val = a * b - (ll)((ld)a * b / mod) * mod;
		if (val < 0) val += mod;
		if (val >= mod) val -= mod;
		return val;
	}

	ll poww(ll a, ll b) {
		ll val = 1;
		a %= mod;
		while (b > 0) {
			if (b % 2) val = mul(a, val);
			a = mul(a, a);
			b >>= 1;
		}
		return val % mod;
	}

	ll inv(ll a) {
		return poww(a, mod - 2);
	}
}

int const maxn = 3e5 + 5;

signed main() {
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	string s; cin >> s;
	if (s[2] == s[3] and s[4] == s[5]) {
		cout << "Yes\n";
	} else {
		cout << "No\n";
	}

	return 0;
}

/*
8 6

4 5 1 2 3 5 3 3

*/

Measured memory_bytes: 384
#include <iostream>

using namespace std;
int A[256];
string s;
int i;
int main()
{
    cin>>s;
    for(i=0;i<s.size();i++)
         A[s[i]]=1;
    if(((A['N']^A['S'])|(A['E']^A['W']))) cout<<"No";
    else cout<<"Yes";
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>
#include<stack>
#include<queue>
#include<vector>
#include<algorithm>
#include<iomanip>
typedef long long int ll;
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define REP(i,n) for (unsigned int i=0;i<(n);i++)
#define EREP(i,n) for (int i=1;i<=(n);i++)
#define ALL(a) (a).begin(),(a).end()
//#define EVEL 1

#ifdef EVEL
#define DEB(X) cout << #X << ":" <<X<<" " ;
#define TF(f) f ? cout<<"true  " : cout<<"false ";
#define END cout<<"\n";
#else
#define DEB(X) {}
#define TF(f) {}
#define END {}
#endif
const int MOD =  1000000007 ;
const int INF = 2000000000;


    ll A,B,C,D,N;
    ll ans=0;
    string S;
    bool F;
int main(){
    cin>>A>>B;
    cout<<A*(A-1)/2+B*(B-1)/2;



    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
 
#define ll long long
#define ull unsigned long long
#define db long double
#define pb push_back
#define ppb pop_back
#define F first
#define S second
#define mp make_pair
#define all(x) (x).begin(), (x).end()

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
typedef array <int, 2> pii;
typedef vector <int> vi;

typedef tree <pii, null_type, less <pii>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

const int N = 2e5 + 123;
ll n, a[N], p[2][N], s[N], suf[N];

int main() {
	ios_base::sync_with_stdio(false), cin.tie(NULL);
	#ifdef LOCAL
		freopen("input.txt", "r", stdin);
	#endif
	
	cin >> n;
	for (int i = 1; i <= n; i++) {
		cin >> a[i];
		p[0][i] = p[0][i - 1], p[1][i] = p[1][i - 1];
		p[a[i] & 1][i]++;
		if (a[i] == 0) {
			p[1][i] += 2;
		}
		s[i] = s[i - 1] + a[i];
	}
	suf[n] = p[1][n] - s[n];
	for (int i = n - 1; i >= 1; i--) {
		suf[i] = min(suf[i + 1], p[1][i] - s[i]);
	}
	ll res = s[n], cur = 0;
	for (int i = 1; i <= n; i++) {
		res = min(res, s[n] - s[i] + p[1][i] + cur);
		cur = min(cur, s[i] - p[1][i]);
	}
	cur = 0;
	ll mn = 0;
	for (int i = 1; i <= n; i++) {
		res = min(res, s[n] + p[0][i] - p[1][i] + suf[i] + mn);
		cur = min(cur, s[i] - p[1][i]);
		mn = min(mn, p[1][i] - p[0][i] + cur);
	}
	cout << res;
}


Measured memory_bytes: 8064
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define ALL(A) A.begin(), A.end()

using namespace std;

typedef long long ll;
typedef pair<int, int> P;

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	string S; cin >> S;
	int n = S.length();

	string T = "FESTIVAL";


	string res = "";
	for (int i = 0; i < n - (int)T.length(); ++i){ 
		res += S[i];
	} // end for

	cout << res << endl;

	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
#include <queue>
#include <string>

int main() {
    char buf[128];
    scanf("%*d %s", buf);

    std::string S=buf;
    int open=0, cur=0;
    for (size_t i=0; i<S.length(); ++i) {
        cur += (S[i]=='('? -1:1);
        if (open < cur)
            open = cur;
    }

    int close=0;
    cur = 0;
    for (size_t i=S.length(); i--;) {
        cur += (S[i]==')'? -1:1);
        if (close < cur)
            close = cur;
    }

    printf("%s", std::string(open, '(').c_str());
    printf("%s", S.c_str());
    printf("%s\n", std::string(close, ')').c_str());

    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using P = pair<ll,ll>;
const ll mod = 1e9+7;
#define ALL(x) (x).begin(),(x).end()
#define pow(x,y) modpow(x,y)
#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)

template <class T = int>T in(){
    T x;
    cin >> x;
    return (x);
}

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<fixed<<setprecision(10);
    int a = in(),b = in(),c = in(),d = in();
    cout << (abs(a-c)<=d ||( abs(a-b)<= d && abs(b-c) <= d) ? "Yes" : "No") << "\n";
}

Measured memory_bytes: 256
list = []
for i in range(10001):
    a, b = (int(x) for x in input().split())
    if a == 0 and b == 0:
        break
    list.append([min(a,b), max(a, b)])
for n in range(len(list)):
    print(str(list[n][0]), str(list[n][1]))



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

ll count(ll n,ll a){
    if(n%a==0){
        return n/a;
    }else{
        return n/a+1;
    }
}

int main(){
    ll N;
    ll cap[5];
    cin>>N;
    ll min_cap = LLONG_MAX;
    ll min_cap_i = -1;
    rep(i,5){
        cin>>cap[i];
        if(cap[i]<min_cap){
            min_cap = cap[i];
            min_cap_i = i;
        }
    }
    ll c=count(N, min_cap)+4;
    
    cout << c << endl;
    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 a = 0, b = 0;
		String temp;
		try{
			temp = scan.next();
			a = Integer.parseInt(temp);
			temp = scan.next();
			b = Integer.parseInt(temp);
		}catch( IllegalStateException e ){
			System.out.println(e);
		}
		System.out.println((a * b) + " " + (2 * (a + b)));
		return;
	}
}

Measured memory_bytes: 17124
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
 
int main(void)
{
	int a, i, j, smin, tmax, slen, tlen, count, temp, countans = 0;
	char s[101],t[101];
	a = scanf("%s", s);
	a = scanf("%s", t);
	slen = strlen(s);
	tlen = strlen(t);
	smin = s[0];
	tmax = t[0];
	for(i = 1; i < slen; i++){
		if(smin > s[i])
			smin = s[i];
	}
	for(i = 1; i < tlen; i++){
		if(tmax < t[i])
			tmax = t[i];
	}
	if(smin < tmax)
		printf("Yes");
	else if(smin > tmax)
		printf("No");
	else{
		if(slen >= tlen){
			printf("No");
		}
		else{
			for(i = 1; i < slen; ++i)
				for(j = slen; j >= i; --j){
					if(s[j-1] > s[j]){
						temp = s[j-1];
						s[j-1] = s[j];
						s[j] = temp;
					}
				}
			for(i = 1; i < tlen; ++i)
				for(j = tlen; j >= i; --j){
					if(t[j-1] < t[j]){
						temp = t[j-1];
						t[j-1] = t[j];
						t[j] = temp;
					}
				}
			for(i = 1; i < slen; i++){
				if(s[i] > t[i]){
					printf("No");
					countans = 1;
					break;
				}
			}
			if(countans == 0)
				printf("Yes");
		}
	}
	return 0;		
}


Measured memory_bytes: 128
#include <iostream>
#include<queue>
#include<stack>
#include<vector>
#include<set>
#include<map>
#include<algorithm>
#include<cstring>
#include<string>
#include<cassert>
#include<cmath>
#include<climits>
#include<iomanip>
#include<bitset>
#include<unordered_map>

using namespace std;

#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define rep(i,j,n) for(ll (i)=(j);(i)<(n);(i)++)
#define FOR(i,c) for(decltype((c).begin())i=(c).begin();i!=(c).end();++i)
#define ll long long
#define ull unsigned long long
#define all(hoge) (hoge).begin(),(hoge).end()
#define en '\n'
typedef pair<ll, ll> P;
const long long INF = 1LL << 60;
const long long MOD = 1e9 + 7;
typedef vector<ll> Array;
typedef vector<Array> Matrix;
const int loose = 0;
const int tight = 1;

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;
}

//グラフ関連
struct Edge {//グラフ
	ll to, cap, rev;
	Edge(ll _to, ll _cap, ll _rev) {
		to = _to; cap = _cap; rev = _rev;
	}
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;

void add_edge(Graph& G, ll from, ll to, ll cap, bool revFlag, ll revCap) {
	G[from].push_back(Edge(to, cap, (ll)G[to].size()));
	if (revFlag)G[to].push_back(Edge(from, revCap, (ll)G[from].size() - 1));
}

ll mod_pow(ll x, ll n, ll mod) {
	ll res = 1LL;
	while (n > 0) {
		if (n & 1) res = res * x % mod;
		x = x * x % mod;
		n >>= 1;
	}
	return res;
}

ll mod_inv(ll x, ll mod) {
	return mod_pow(x, mod - 2, mod);
}

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

	ll n, a, b;
	cin >> n >> a >> b;

	ll ans = mod_pow(2, n, MOD);

	ll con = 1;
	REP(i, a) {
		(con *= n - i) %= MOD;
		(con *= mod_inv(i + 1,MOD)) %= MOD;
	}
	(ans = MOD + ans - con) %= MOD;
	con = 1;
	REP(i, b) {
		(con *= n - i) %= MOD;
		(con *= mod_inv(i + 1, MOD)) %= MOD;
	}
	(ans = MOD + ans - con) %= MOD;

	(ans = MOD + ans - 1) %= MOD;

	cout << ans << en;

	return 0;
}

Measured memory_bytes: 256
Spr = input()
T = list(input())
S = list(Spr)

change = ""
ok = 0

for i in range(len(S)):
  if S[0] == T[i]:
    for j in range(len(S) - i):
      change += T[j+i]
    for k in range(i):
      change += T[k]
    if Spr == change:
      if ok == 0:
      	print("Yes")
      	ok = 1
    change = ""

if i == len(S) - 1 and ok == 0:
  print("No")    

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3f
#define EPS (1e-10)
#define MOD 1000000007
using namespace std;
typedef long long ll;
typedef pair<int,int>P;

signed main(){
	int n;scanf("%d",&n);
	set<string>s;
	rep(i,n){
		string t;cin>>t;
		s.insert(t);
	}
	if(s.size()==3)puts("Three");
	else puts("Four");
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define ALL(v) (v).begin(), (v).end()
using ll = long long;
using P = pair<int, int>;
constexpr int INF = 1e9;
constexpr long long LINF = 1e18;
constexpr long long MOD = 1e9 + 7;

signed main() {
    int n, m;
    cin >> n >> m;
    vector<P> ans;
    int k = (n - 1) / 2;
    int odd = (k + 1) / 2, even = k / 2;
    int t = 2 * odd - 1;
    rep(i, odd) {
        ans.emplace_back(i + 1, i + 1 + t);
        t -= 2;
    }
    t = even * 2;
    rep(i, even) {
        ans.emplace_back(i + 1 + 2 * odd, i + 1 + 2 * odd + t);
        t -= 2;
    }
    rep(i, m) {
        cout << ans[i].first << " " << ans[i].second << endl;
    } 
    return 0;
}

Measured memory_bytes: 4224
import sys
import math
from collections import defaultdict, deque
from copy import deepcopy
    
input = sys.stdin.readline
def RD(): return input().rstrip()
def F(): return float(input().rstrip())
def I(): return int(input().rstrip())
def MI(): return map(int, input().split())
def MF(): return map(float,input().split())
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float,input().split()))
def Init(H, W, num): return [[num for i in range(W)] for j in range(H)]
def end_of_loop():raise StopIteration

def main():
    N, K = MI()
    P = LI()
    C = LI()
    #1週下再に加算されるスコア並びにあるますから出発した際に１マス進んだ際のスコアがわかればよい。
    #初期化
    ans = []
    result = -float('inf')
    #開始点
    for i in range(N):
        result2= 0
        # start
        temp = i
        d = [-float('inf')] * N
        for j in range(N):
            temp = P[temp]-1
            result2+=C[temp]
            d[j] = result2
            if temp == i:
                index = j+1
                score = result2
                if index < K:
                    amari = K % index
                    syou = K // index
                    if amari !=0:
                        result = max(result, syou*score, syou*score+max(d[0:amari]), (syou-1)*score+max(d[0:index-1]), max(d), (syou-1)*score+max(d[0:index-1]))
                    else:
                        result = max(result, syou*score, max(d), (syou-1)*score+max(d[0:index-1]))
                    break
                else:
                    result = max(result, max(d[0:K]))
                    break
    print(result)

if __name__ == "__main__":
    main()

Measured memory_bytes: 96204
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
const ll mod = 1000000007;
const ll INF = 9223372036854775807;
#define Sort(a) sort(a.begin(), a.end())
#define Bsort(a) sort(a.begin(), a.end(), greater<ll>())
#define Pi acos(-1)

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << setprecision(15) << fixed;
  ll a, b, x;
  cin >> a >> b >> x;
  ll p = a/x+1; //a!=0
  ll q = b/x+1;
  ll ans = q-p;
  if (a%x == 0) ans++;
  cout << ans << '\n';
}

Measured memory_bytes: 256
n, m = map(int, input().split())
list_a = list(map(int, input().split()))

total_vote = 0
for a in list_a:
  total_vote += a
count = 0
for a in list_a:
  if a >= total_vote/(4*m):
  	count += 1
if count >= m:
  print('Yes')
else:
  print('No')

Measured memory_bytes: 3064
import numpy as np
n=int(input())
a=list(map(int,input().split()))
arr=np.array(a)

count=0
f=0

while 1:
    for i in arr:
        if i%2==1:
            f=f+1
    if f==0:
        arr=arr//2
        count+=1
        f=0
    else:
        break
print(count)

Measured memory_bytes: 13224
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <stack>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <bitset>
#include <sstream>
#include <iomanip>
using namespace std;


#define int int64_t
#define vi vector<int>
#define vb vector<bool>
#define vbb vector< vector<bool> >
#define all(x) (x).begin(), (x).end()
#define vii vector< vector<int> >
#define rip(dp, n, m) vector< vector<int> > dp(n, vector<int>(m,0))
#define ff first
#define ss second
#define pii pair<int64_t, int64_t>
#define miv map<int, vector<int> >
#define mp make_pair
#define pb push_back
#define prr(x) cout << (#x) <<'	' << (x) << endl
#define pr(x) cout  << (x) << endl
#define f(i,n) for(i=0;i<n;i++)
#define pqb priority_queue<int>
#define pqs priority_queue<int,vi,greater<int> >
#define setbits(x)  __builtin_popcountll(x)
#define zrobits(x)  __builtin_ctzll(x)
#define mod 1000000007
#define inf 1e18
#define ps(x,y) fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x) int x; cin>>x; while(x--)
#define FIO  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int dr8[] = {1,1,0,-1,-1,-1, 0, 1};
int dc8[] = {0,1,1, 1, 0,-1,-1,-1};
int dr4[] = {1,0,0,-1};
int dc4[] = {0,1,-1,0};

int32_t main()
{
    FIO;
    int i, n, j, m, k, l, t;
    // w(X)
    {
        int d, s;
        cin >> d >> t >> s;
        k = s*t;
        if(k>=d) cout << "Yes";
        else cout << "No";
    }
}

Measured memory_bytes: 3652
import sys
input = sys.stdin.readline
N, K = map(int, input().split())
a = list(map(int, input().split()))
mod = 10 ** 9 + 7

dp = [0] * (K + 1)
dp[K] = 1
for i in range(N):
  x = a[i]
  imos = [0] * (K + 2)
  for j in range(K + 1):
    if j - x >= 0:
      imos[j - x] += dp[j]
      imos[j - x] %= mod
    else:
      imos[0] += dp[j]
      imos[0] %= mod
    imos[j + 1] -= dp[j]
    imos[j + 1] %= mod
  for j in range(K + 1):
    imos[j + 1] += imos[j]
    imos[j + 1] %= mod
  for j in range(K + 1):
    dp[j] = imos[j]
print(dp[0])

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


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

	int a, b, c, d;
	cin >> a >> b >> c >> d;
	cout << max(a*b, c*d) << '\n';
	
	return 0;
}

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


#define int long long
#define ct(n) cout << n << endl;
#define cts(n) cout << n << " ";
#define cte cout << endl;
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define repo(i,o,n) for(int i=o;i<n;i++)
#define repm(i,n) for(int i=n-1;i>=0;i--)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define sperase(v,n) (v).erase(remove(all(v), n), (v).end());
#define vdelete(v) (v).erase(unique(all(v)), (v).end());
#define vcopy(v1,v2) copy((v1).begin(), (v1).end(), back_inserter((v2)));
#define pb(n) push_back(n);

int c[3][3];

main() {
    rep(i,3) rep(j,3) cin >> c[i][j];
    rep(i,3) {
        int a = 100;
        rep(j,3) a = min(a,c[i][j]);
        rep(j,3) c[i][j] -= a;
    }
    rep(j,3) {
        int a = 100;
        rep(i,3) a = min(a,c[i][j]);
        rep(i,3) {
            c[i][j] -= a;
            if (c[i][j]) {
                cout << "No" << endl;
                return 0;
            }
        }
    }
    cout << "Yes" << endl;
}



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

using namespace std;

typedef long long ll;
typedef pair<int, int> P;

int main(){
	int n;
	cin >> n;
	ll a[n];
	for(int i=0;i<n;i++) cin >> a[i];
	sort(a,a+n);
	for(int i=0;i<n-1;i++){
		if(a[i]==a[i+1]){
			cout << "NO" << endl;
			return 0;
		}
	}
	cout << "YES" << endl;
	return 0;
}

Measured memory_bytes: 5096
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MOD 1000000007
#define INF 1LL<<30
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()

int main(){
    int n;
    cin>>n;
    vector<ll> b(n+1,0);
    b[0]=3;

    ll ans=1;
    rep(i,n){
        ll a;
        cin>>a;
        ans=(ans*b[a])%MOD;
        b[a]--;
        b[a+1]++;
    }
    cout<<ans<<endl;

}


Measured memory_bytes: 1024
#include <stdio.h>
#include <vector>
#include <iostream>
#include <queue>
#include <bits/stdc++.h>
 
#define rep(i,n) for (int i=0;i<(n);++i)
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<double> vd;
typedef pair<int, int> pi;


bool kaibun(string s){
  string r = s;
  reverse(r.begin(), r.end());
  return s == r;
}

int main() {
  string s;
  cin >> s;
  int n = s.size();

  string ans = "No";
  if (kaibun(s) and kaibun(s.substr(0, (n-1)/2)) and kaibun(s.substr(((n+3)/2) - 1, n))) ans = "Yes";
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
-- Your code here!
-- Your code here!

import Data.List.Split
import Data.List

-- Your code here!
main :: IO()
main = do
  ls <- getLines
  mapM_ putStrLn $ getMosts ls
  
getMosts :: [String] -> [String]
getMosts l = map (\(a,b) -> a) $ filter (\(a,b) -> b == maxnum) cs 
  where 
   cs = counts l
   maxnum = myMax cs

myMax :: [(String,Int)] -> Int
myMax l = maximum $ map (\(a,b) -> b) l

counts :: [String] -> [(String,Int)]
counts l = map count' es
  where
    es = nub l
    count' e = (e, count e l)

count e l = length $ filter (e==) l

getLines =  do
  s <- getContents
  return $ lines s



Measured memory_bytes: 3572
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <sstream>
#include <functional>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <stack>
#include <deque>
#include <list>
#include <numeric>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<P,ll> PPI;
typedef pair<ll,P> PIP;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<P> vp;
#define PQ(T) priority_queue<T,vector<T>,greater<T>>
#define PQ2(T) priority_queue<T>
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const ll INF = 1LL<<29;
const ll mod = 1e9+7;
#define REP(i,a,b) for(ll (i)=a;(i)<(ll)(b);++(i))
#define rep(i,n) REP(i,0,n)
#define rep1(i,n) REP(i,1,n+1)
#define repd(i,n,d) for(ll (i)=0;(i)<(ll)(n);(i)+=(d))
#define all(v) (v).begin(), (v).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset((m),(v),sizeof(m))
#define chmin(x,y) ((x)=min((x),(y)))
#define chmax(x,y) ((x)=max((x),(y)))
#define fst first
#define snd second
#define UNIQUE(x) (x).erase(unique(all(x)),(x).end())
#define DEBUG(x) cerr<<"line ("<<__LINE__<<")  "<<#x<<": "<<x<<endl;
template<class T> ostream &operator<<(ostream &os, const vector<T> &v){int n=v.size();rep(i,n)os<<v[i]<<(i==n-1?"":" ");return os;}

ll half = (mod+1)/2;
ll n, K;


ll pow_mod(ll a, ll r, ll m = mod){
	ll x = 1;
	while(r){
		if(r&1) (x*=a)%=m;
		(a*=a)%=m;
		r>>=1;
	}
	return x;
}

#define N 2000
ll dp[N];

int main(){
	cin>>n>>K;
	ll res = 0;
	vector<ll> v;
	for(ll i = 1; i*i <= n; i++){
		if(n%i) continue;
		v.pb(i);
		if(i*i!=n) v.pb(n/i);
	}
	sort(all(v));
	int m = v.size();
	rep(i, m){
		dp[i] = pow_mod(K, (v[i]+1)/2);
		rep(j, i) if(v[i]%v[j]==0) dp[i] -= dp[j];
		dp[i] = (dp[i]%mod+mod)%mod;
		(res+=dp[i]*(v[i]%2?1:half)%mod*v[i]%mod)%=mod;
	}
	cout<<res<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define P pair<int,int>
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<n;i++)
#define all(v) v.begin(),v.end()
#define pb push_back
template<class T>void chmax(T & a, T b) { if (a < b)a = b; }
template<class T>void chmin(T & a, T b) { if (a > b)a = b; }
constexpr int INF = 1000000000000000000;
constexpr int mod = 1000000007;
int dx[] = { 0,1,0,-1 }, dy[] = { 1,0,-1,0 };
int kaijo[2000010];
struct edge { int to, cost; };
int gcd(int a, int b) {
    if (b == 0)return a;
    return gcd(b, a % b);
}
int lcm(int a, int b) {
    return a / gcd(a, b) * b;
}
bool prime(int a) {
    if (a == 1)return false;
    for (int i = 2; i * i <= a; i++) {
        if (a % i == 0)return false;
    }
    return true;
}
void init_fact() {
    kaijo[0] = 1;
    for (int i = 1; i <= 2000000; i++) {
        kaijo[i] = kaijo[i - 1] * i;
        kaijo[i] %= mod;
    }
}
int modpow(int a, int b) {
    if (b == 0)return 1;
    if (b % 2)return modpow(a, b - 1) * a % mod;
    int memo = modpow(a, b / 2);
    return memo * memo % mod;
}
int comb(int a, int b) {
    if (!kaijo[0])init_fact();
    return kaijo[a] * modpow(kaijo[a - b], mod - 2) % mod * modpow(kaijo[b], mod - 2) % mod;
}
int inv(int x) {
    x = modpow(x, mod - 2);
    return x;
}
bool kosa(double ax, double ay, double bx, double by, double cx, double cy, double dx, double dy) {
    double ta = (cx - dx) * (ay - cy) + (cy - dy) * (cx - ax);
    double tb = (cx - dx) * (by - cy) + (cy - dy) * (cx - bx);
    double tc = (ax - bx) * (cy - ay) + (ay - by) * (ax - cx);
    double td = (ax - bx) * (dy - ay) + (ay - by) * (ax - dx);
    return tc * td < 0 && ta * tb < 0;
}
double dist(double ax, double ay, double bx, double by) {
    return sqrt((bx - ax) * (bx - ax) + (ay - by) * (ay - by));
}

signed main() {
    int n;
    cin >> n;
    cout << (n + 1) / 2 << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
#include <iomanip>
#define REP(i,n) for(int i = 0; i < (n); i++)
#define FI first
#define SE second
#define MP make_pair
#define INF 1100000000

using namespace std;

int dx[] = {-1, 0, 1, 0};
int dy[] = {0, -1, 0, 1};
int dist[60][60];
char mp[60][60];

int main()
{
  REP(i, 60)REP(j,60) {
    dist[i][j] = INF;
    mp[i][j] = '#';
  }

  int H, W; cin >> H >> W;
  int b = 0;
  for (int i = 1; i <= H; i++) {
    for (int j = 1; j <= W; j++) {
      char c; cin >> c;
      mp[i][j] = c;
      if (c == '#') b++;
    }
  }

  queue<pair<int, int>> q;
  q.push(MP(1, 1));
  dist[1][1] = 0;
  while (!q.empty()) {
    pair<int, int> pos = q.front(); q.pop();
    int ty = pos.FI;
    int tx = pos.SE;
    REP(i, 4) {
      int ny = ty + dy[i];
      int nx = tx + dx[i];
      if (mp[ny][nx] != '#' && dist[ty][tx] + 1 < dist[ny][nx]) {
        dist[ny][nx] = dist[ty][tx] + 1;
        q.push(MP(ny, nx));
      }
    }
  }

  if (dist[H][W] == INF) cout << -1 << endl;
  else cout << (H*W - (dist[H][W] + 1) - b) << endl;

  return 0;
}


Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))
a.sort()
cand = [0]
p = 0
for i in range(n-1,-1, -2):
    if a[i] == a[i-1]:
        if p:
            cand.append(p*a[i])
            break
        else:
            p = a[i]

p = 0
for i in range(n-2,-1, -2):
    if a[i] == a[i-1]:
        if p:
            cand.append(p*a[i])
            break
        else:
            p = a[i]

print(max(cand))

Measured memory_bytes: 14252
#include <bits/stdc++.h>
using namespace std;
//using lint = long long;

struct P
{
    int x,y;

    bool operator<(const P &a)const{
        if(x!=a.x)
              return x>a.x;
        return y>a.y;
    }

};

vector<int> v;

//bitset<4001000> b;
int i,n,d,m,k,a,b,c;

long long o[3333][4];
long long l[222221];
long long j[222221];
int e;


//int dx[10]={2,2,-2,-2,1,1,-1,-1},dy[10]={1,-1,1,-1,2,-2,2,-2};

int dx[10]={0,1,0,-1,1,1,-1,-1},dy[10]={1,0,-1,0,1,-1,1,-1},dz[10]={0,0,0,0,1,-1};
long long mod=1000000007,mod2=1000000009,mod3=2017;
long long x,z,y;
double pi=3.14159265;
P u[3331];
stack<int> s;
//set<int> se;
//priority_queue<int,vector<int>,greater<int> > q;
//queue<int> q;
//2147483647
//'1'==49;
//'A'==65;
//'a'==97;
//unordered_
//map<int,int> p;
/*
struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
unordered_map<long long, int, custom_hash> safe_map;
*/
//list<int> l;

//string r,r1;
char r[552];
//deque<int> de;
//srand((int)time(NULL));
/*bool as(P a,P b)
{
    if(a.x!=b.x)
    return a.x<b.x;
    return a.y<b.y;
}*/



bool as(P a,P b)
{
    if(a.x!=b.x)
       return a.x<b.x;
    return a.y<b.y;


}

long long qwer(long long x,long long y)
{
    long long p=1;
    for(;y;y/=2,x*=x,x%=mod)
        if(y%2)
        p*=x,p%=mod;
    return p;
}

long long f(int n,int m)
{
    int x=u[n].x-u[m].x,y=u[n].y-u[m].y;
    //printf("%d %d\n",x,y);
    return l[x+y]*j[x]%mod*j[y]%mod;
}

int main()
{
    j[0]=l[0]=1;
    for(int t=1;t<=200000;t++)
        l[t]=l[t-1]*t%mod,j[t]=qwer(l[t],mod-2);
    scanf("%d %d %d",&a,&b,&c);
    u[0]={1,1};
    u[c+1]={a,b};
    o[0][0]=1;
    for(int t=1;t<=c;t++)
        scanf("%d %d",&u[t].x,&u[t].y);
    sort(u+1,u+c+1,as);

    for(int t=1;t<=c;t++)
    for(int w=0;w<t;w++)
    if(u[t].x>=u[w].x&&u[t].y>=u[w].y)
    for(int h=0;h<2;h++)
    {
        o[t][h]+=o[w][(h+1)%2]*f(t,w)%mod;
        o[t][h]%=mod;
    }
    x=f(c+1,0);
    for(int t=1;t<=c;t++)
    {
        //printf("%lld %lld %lld\n",o[t][0],o[t][1],f(c+1,t));

        x+=(o[t][0]-o[t][1]+mod)%mod*f(c+1,t)%mod,x%=mod;
    }
    printf("%lld",x);
}





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

int main()
{
    int a,b;
    cin>>a>>b;
    
    if(a>b) cout<<"a > b"<<"\n";
    
    else if(a<b) cout<<"a < b"<<"\n";
    
    else cout<<"a == b"<<"\n";
    return 0;
}



Measured memory_bytes: 3064
n,k=map(int, input().split())
List=list(map(int, input().split()))
a=[]
for i in range(n-k+1):
    l=List[i]
    r=List[i+k-1]
    a.append(min(abs(l)+abs(r-l), abs(r)+abs(l-r)))
print(min(a))

Measured memory_bytes: 14252
#include <iostream>
#include <array>
#include <map>
#include <algorithm>
#include <cmath>
#include <vector>
#include <fstream>
#include <string>
#include <random>
#include <queue>
#include <iomanip>
#include <functional>
#include <climits>
#include <tuple>
#include <unordered_map>
#include <limits>
#include <functional>
#include <cassert>
#include <numeric>
#include <bitset>

#define FOR(x,n) for(int x = 0; x < n; x++)
#define INPUT(x) scanf("%d",&x);
#define PUT(x) cout << x << endl
#define DPUT(x) printf("%.15lf\n",x)
#define GET(x,y) std::get<x>(y)
#define CHMAX(x,y) x = std::max(x,y)
#define CHMIN(x,y) x = std::min(x,y)
#define SP_END (i != n - 1 ? ' ' : '\n') ;

using namespace std;

using ll = long long int;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vll = std::vector<ll>;
using vpll = std::vector<pll>;
using vpii = std::vector<pii>;
using vi = std::vector<int>;
using vvi = std::vector<vi>;
using vvpii = std::vector<vpii>;
using vch = std::vector<char>;
using vvch = std::vector<vch>;
using tiii = std::tuple<int, int, int>;

const ll mod197 = 1000000007LL;
const ll INF = 10000000000LL;

const double PI11 = 3.14159265359;

const int dis[5] = { 0,1,0,-1,0 };

const int disD[4] = { 0,1,1,0 };
const int disLD[3] = { 0,1,0 };

const char disC[4] = { 'U','D','R','L' };
const char disY[4] = { -1,1,0,0 };
const char disX[4] = { 0,0,1,-1 };

int main(void)
{

	ll charactor['Z' + 1] = {};
	int n;
	cin >> n;

	for (int i = 0; i < n; i++) {
		string s;
		cin >> s;
		charactor[s[0]]++;
	}

	ll answer = 0;
	string march = "MARCH";

	for (int i = 0; i < 5; i++) {
		for (int j = i + 1; j < 5; j++) {
			for (int k = j + 1; k < 5; k++) {
				answer += charactor[march[i]] * charactor[march[j]] * charactor[march[k]];
			}
		}
	}

	cout << answer << endl;

	return 0;
}



Measured memory_bytes: 256
#include <iostream>


bool isTriangle(int a, int b, int c) {
  int a2 = a*a, b2 = b*b, c2=c*c;
  int sum = a2 + b2 + c2;
  if ((sum - 2 * std::max(std::max(a2, b2), c2)) == 0)
    return true;
  else
    return false;
}


int main () {
  int a, b, c;
  int n;
  std::cin >> n;
  for (int i = 0; i < n; i ++) {
    std::cin >> a >> b >> c;
    if (isTriangle(a, b, c))
      std::cout << "YES" << std::endl;
    else
      std::cout << "NO" << std::endl;
  }
}

Measured memory_bytes: 2980
/**
 * @copyright (c) 2020 Daisuke Hashimoto
 */

#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
using Pair = pair<int32_t, int32_t>;

// std::cout << std::setprecision(20) << 1.1 << endl;

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

  int32_t A, B, C, X;
  cin >> A >> B >> C >> X;
  int32_t result = 0;
  for (int32_t a = 0; a <= A; ++a) {
    for (int32_t b = 0; b <= B; ++b) {
      const int32_t residual = X - a * 500 - b * 100;
      const int32_t temp = residual / 50;
      if (residual % 50 == 0 && temp >= 0 && temp <= C) {
        result++;
      }
    }
  }
  cout << result << endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long int
signed main()
{
  int n,k,i,j;
  cin>>n>>k;
  int h[n];
  for(i=0;i<n;i++)
  cin>>h[i];
  vector<int>dp(n,INT_MAX);
  dp[0]=0;
  for(i=0;i<n;i++)
  {
   for(j=1;j<=k;j++)
   {
       if(i+j<n)
       {
           dp[i+j]=min(dp[i+j],dp[i]+abs(h[i]-h[i+j]));
       }
   }
  }
  cout<<dp[n-1]<<endl;
}

Measured memory_bytes: 1792
def get_matrix_size(x):
    row = len(x)
    col = len(x[0])
    return row, col

def get_matrix(x):
    row, col = get_matrix_size(x)
    for i in range(row):
        line = list(map(int, input().split()))
        if len(line) != col:
            break
        x[i] = line

def get_matrix_product(a, b):
    a_row, a_col = get_matrix_size(a)
    b_row, b_col = get_matrix_size(b)
    if a_col != b_row:
        return
    c_row = a_row
    c_col = b_col
    c = [[0 for j in range(c_col)] for i in range(c_row)]
    for i in range(c_row):
        for j in range(c_col):
            for k in range(a_col):
                c[i][j] += a[i][k] * b[k][j]    
    return c

n, m = map(int, input().split())
a = [[0 for j in range(m)] for i in range(n)]
b = [[0 for j in range(1)] for i in range(m)]
get_matrix(a)
get_matrix(b)
c = get_matrix_product(a, b)
for i in range(len(c)):
    print(c[i][0])



Measured memory_bytes: 6040
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
string s;
 
int main() {
  cin >> s;
  ll date = (s.compare("SUN") == 0) ? 7 :
            (s.compare("MON") == 0) ? 6 :
            (s.compare("TUE") == 0) ? 5 :
            (s.compare("WED") == 0) ? 4 :
            (s.compare("THU") == 0) ? 3 :
            (s.compare("FRI") == 0) ? 2 :
            (s.compare("SAT") == 0) ? 1 : 0;
  cout << date << endl;
  return 0;
}

Measured memory_bytes: 256
N = int(input())
es = [[] for i in range(N)]
for i in range(N-1):
    a,b = map(lambda x:int(x)-1,input().split())
    es[a].append(b)
    es[b].append(a)

def path(s,g):
    visited = [0] * N
    back = [-1] * N
    stack = [(s,-1)]
    while stack:
        a,prev = stack.pop()
        visited[a] = 1
        back[a] = prev
        for to in es[a]:
            if visited[to]: continue
            if to == g:
                ret = [g,a]
                while back[ret[-1]] >= 0:
                    ret.append(back[ret[-1]])
                return list(reversed(ret))
            stack.append((to,a))

def fennec_win():
    win_border = (N//2)+1
    p = path(0,N-1)
    cant_go = p[(len(p)+1)//2]
    visited = [0] * N
    stack = [0]
    count = 0
    while stack:
        a = stack.pop()
        visited[a] = 1
        count += 1
        if count >= win_border:
            return True
        for to in es[a]:
            if visited[to] or to == cant_go: continue
            stack.append(to)
    return False

print('Fennec' if fennec_win() else 'Snuke')


Measured memory_bytes: 24420
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;
typedef long long unsigned int ll;
set<pair<int, int> > st;
ll ans[10];
ll h, w;
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

void check(int a, int b)
{
    if((a < 2) || (a > h - 1) || (b < 2) || (b > w - 1)){
        return;
    }
    int number = 0;
    for(int i = a - 1; i <= a + 1; i++){
        for(int j = b - 1; j <= b + 1; j++){
            pair<int, int> in;
            in.first = i;
            in.second = j;
            if(st.count(in) > 0){
                number++;
            }
        }
    }
    ans[number]--;
    ans[number + 1]++;
    return;
}

int main() {
    int n;
    cin >> h >> w >> n;
    for(int i = 0; i < 10; i++){
        ans[i] = 0;
    }
    ans[0] = (h - 2) * (w - 2);
    for(int i = 1; i <= n; i++){
        int a, b;
        cin >> a >> b;
        for(int j = -1; j <= 1; j++){
            for(int k = -1; k <= 1; k++){
                check(a + j, b + k);
            }
        }
        pair<int, int> in;
        in.first = a;
        in.second = b;
        st.insert(in);
    }
    for(int i = 0; i < 10; i++){
        cout << ans[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 4992
#!/usr/bin/env python3
import sys


def solve(N: int, M: int, p: "List[int]", S: "List[str]"):
    wa_flag = [0] * N
    num_penalty = 0
    for i in range(M):
        if S[i] == "WA":
            if wa_flag[p[i]-1] != -1:
                wa_flag[p[i]-1] += 1
        else:
            if wa_flag[p[i]-1] != -1:
                num_penalty += wa_flag[p[i]-1]
                wa_flag[p[i]-1] = -1
    num_ac = wa_flag.count(-1)
    print(num_ac, num_penalty)
# 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)
def main():
    N, M = map(int, input().split())
    p = [None] * M
    S = [None] * M
    for i in range(M):
        pi, si = input().split()
        p[i] = int(pi)
        S[i] = str(si)
    solve(N, M, p, S)

if __name__ == '__main__':
    main()


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

#define loop(i,n) for(int i = 0;i < int(n);i++)
#define rloop(i,n) for(int i = int(n);i >= 0;i--)
#define range(i,a,b) for(int i = int(a);i <= int(b);i++)
#define SZ(c) int(c.size())
#define ALL(c) c.begin(), c.end()
#define RALL(c) c.rbegin(), c.rend()
#define PI acos(-1)
#define pb push_back
#define mp make_pair
#define fr first
#define sc second
#define sfi1(v) scanf("%d",&v)
#define sfi2(v1,v2) scanf("%d %d",&v1,&v2)
#define sfi3(v1,v2,v3) scanf("%d %d %d",&v1,&v2,&v3)
#define sfll1(v) scanf("%I64d",&v);
#define sfll2(v1,v2) scanf("%I64d %I64d",&v1,&v2)
#define sfll3(v1,v2,v3) scanf("%I64d %I64d %I64d",&v1,&v2,&v3)
#define endl '\n'

typedef vector<int> vi;
typedef vector<pair<int,int> > vii;
typedef long long ll;
typedef pair<int, int> pii;


int main()
{

#ifndef ONLINE_JUDGE
	//freopen("in.in", "r", stdin);
	//freopen("out.in", "w", stdout);
#endif
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

    int n;
    cin >> n;
    vi v(n);
    for(int &x : v)cin >> x;
    sort(ALL(v));

    double ans = v[0];
    range(i,1,n-1){
        ans += v[i];
        ans /= 2;
    }

    cout << fixed << setprecision(12) << ans << endl;

    return 0;
}


Measured memory_bytes: 256
N, M = map(int, input().split())
l = 1
r = 10 ** 6
for i in range(M):
    lr = list(map(int, input().split()))
    l = max(l, lr[0])
    r = min(r, lr[1])
ans = 0
for i in range(N):
    if l <= i + 1 <= r:
        ans += 1
print(ans)


Measured memory_bytes: 3060
import java.util.*;

public class Main {

	private static List<Integer> getStrings(Scanner sc, int num) {
		List<Integer> stringList = new ArrayList<>();
		while(num>0) {
			int nextInt = sc.nextInt();
			stringList.add(nextInt);
			num--;
		}
		return stringList;
	}

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int k = sc.nextInt();
		List<List<Integer>> lists = new ArrayList<>();
		while(k>0) {
			int d = sc.nextInt();
			List<Integer> list = getStrings(sc, d);
			lists.add(list);
			k--;
		}

		Set<Integer> set = new HashSet<>();
		for (int i = 0; i < lists.size(); i++) {
			List<Integer> cur = lists.get(i);
			for (int j = 0; j < cur.size(); j++) {
				set.add(cur.get(j));
			}
		}
		int sum = 0;
		for (int i = 1; i <= n; i++) {
			if (!set.contains(i)) {
				sum++;
			}
		}
		System.out.println(sum);
	}

}


Measured memory_bytes: 45996
N = int(input())
X = list(map(int, input().split()))

res = 0
for _ in range(100):
    if all(v == 0 for v in X):
        break

    flag = False
    for i in range(N):
        if X[i] > 0:
            X[i] -= 1
            flag = True
        elif flag:
            flag = False
            res += 1

    if flag:
        res += 1

print(res)


Measured memory_bytes: 72664
def main():
    A,B = map(int,input().split())
    
    originalList = set(list(map(int,input().split()))[1:])
    for i in range(A-1):
        list1=set(list(map(int,input().split()))[1:])
        originalList = originalList & list1

    print(len(originalList))


if __name__== "__main__":
    main() 

Measured memory_bytes: 3060
#include <iostream>
#include <stdio.h>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <vector>
#include <cstdlib>
using namespace std;
#define REP(i,n) for(int i = 0;i < (int)(n);i++)

int main() {
int x,a,b,i=1;
cin >> x >>a >> b;
x -= a;
  while((x-b*i)>=0){
    i++;
  }
  x -= b*(i-1);
  cout << x;
return(0);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin>>n;
    vector<int> a(n);
    for(int i=0;i<n;i++){
        cin>>a.at(i);
    }
    vector<int> b(n);
    for(int i=0;i<n;i++){
        cin>>b.at(i);
    }
    vector<int> c(n-1);
    for(int i=0;i<n-1;i++){
        cin>>c.at(i);
    }
    int sum=0;
    for(int i=0;i<n;i++){
        sum+=b.at(a.at(i)-1);
        if(i!=n-1){
            if(a.at(i)+1==a.at(i+1)) sum+=c.at(a.at(i)-1);
        }
        else continue;
    }
    cout<<sum<<endl;
}

Measured memory_bytes: 3612
#include <iostream>
#include <cstring>
#include <iomanip>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

// 入力
int N;

// DP テーブル
double dp[310][310][310];
double rec(int i, int j, int k) {
    if (dp[i][j][k] >= 0) return dp[i][j][k];
    if (i == 0 && j == 0 && k == 0) return 0.0;

    double res = 0.0;
    if (i > 0) res += rec(i-1, j, k) * i;
    if (j > 0) res += rec(i+1, j-1, k) * j;
    if (k > 0) res += rec(i, j+1, k-1) * k;
    res += N;
    res *= 1.0 / (i + j + k);

    return dp[i][j][k] = res;
}

int main() {
    cin >> N;
    int one = 0, two = 0, three = 0;
    for (int i = 0; i < N; ++i) {
        int a; cin >> a;
        if (a == 1) ++one;
        else if (a == 2) ++two;
        else ++three;
    }

    // 初期化
    memset(dp, -1, sizeof(dp));

    // 答え
    cout << fixed << setprecision(10) << rec(one, two, three) << endl;
}

Measured memory_bytes: 233088
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define ii pair <int, int>
#define app push_back
#define all(a) a.begin(), a.end()
#define bp __builtin_popcountll
#define ll long long
#define mp make_pair
#define f first
#define s second
#define Time (double)clock()/CLOCKS_PER_SEC
signed main() {
    #ifdef HOME
    freopen("input.txt", "r", stdin);
    #else
    #define endl '\n'
    ios_base::sync_with_stdio(0); cin.tie(0);
    #endif
    string s;
    cin >> s;
    cout << s.substr(0,3) << endl;
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
#define ll long long int
using namespace std;
int main () {
ios_base::sync_with_stdio(false);
    cin.tie(NULL);
  ll n,k;
  cin>>n>>k;
  ll a[n];
  ll i;
  for(i=0;i<n;i++)
  cin>>a[i];
   i=0;ll j=k;
  ll i1;
  for(i1=0;i1<n-k;i1++)
  {
  	if(a[j]>a[i])
	  {
	  	cout<<"Yes"<<endl;
	  }
	  else
	  cout<<"No"<<endl;
	  i++;j++;
}
  
return 0;
}

Measured memory_bytes: 5136