akhauriyash/Code-Regression huggingface dataset:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;

import java.util.StringTokenizer;

class Main{
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		char[] s = sc.next().toCharArray();
		char[] t = sc.next().toCharArray();
		int[][] dp = new int[s.length + 1][t.length + 1];

		for (int i = s.length - 1; i >= 0; i--) {
			for (int j = t.length - 1; j >= 0; j--) {
				if (s[i] == t[j]) {
					dp[i][j] = 1 + dp[i + 1][j + 1];

				} else {
					if (dp[i + 1][j] >= dp[i][j + 1]) {
						dp[i][j] = dp[i + 1][j];

					} else {

						dp[i][j] = dp[i][j + 1];
					}
				}
			}
		}
		int i = 0;
		int j = 0;
		String sol = "";
		while (i < s.length && j < t.length) {
			if (s[i] == t[j]) {
				sol += s[i];
				i++;
				j++;
			} else if (dp[i + 1][j] >= dp[i][j + 1]) {
				i++;
			} else if (dp[i + 1][j] < dp[i][j + 1]) {
				j++;
			}
		}
		out.println(sol);
		out.close();
	}

	static class Scanner {
		BufferedReader br;
		StringTokenizer st;

		public Scanner(InputStream s) {
			br = new BufferedReader(new InputStreamReader(s));
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}

		public int[] nextIntArr(int n) throws IOException {
			int[] arr = new int[n];
			for (int i = 0; i < n; i++) {
				arr[i] = Integer.parseInt(next());
			}
			return arr;
		}
	}

}


Measured memory_bytes: 82828
#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream>
#include <random>
#include<map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include<fstream>
#include <unordered_map>
#include <cstdlib>
using namespace std;
#define Ma_PI 3.141592653589793
#define eps 0.00000001
#define LONG_INF 3000000000000000000
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007
#define REP(i,n) for(long long i = 0;i < n;++i)    
#define seg_size 524288
vector<long long> input;
long long seg_tree[seg_size * 2];
long long seg_find(int now, int n_l, int n_r, int w_l, int w_r) {
	if (w_l <= n_l && n_r <= w_r) return seg_tree[now];
	if (n_r <= w_l || w_r <= n_l) return 0;
	return seg_find(now * 2, n_l, (n_l + n_r) / 2, w_l, w_r) + seg_find(now * 2 + 1, (n_l + n_r) / 2, n_r, w_l, w_r);
}
long long seg_set(int now) {
	seg_tree[now] = seg_tree[now * 2] + seg_tree[now * 2 + 1];
	if (now != 0) seg_set(now / 2);
	return 0;
}
int solve(long long gogo) {
	vector<long long> label;
	REP(i, input.size()) {
		if (input[i] >= gogo) {
			label.push_back(1);
		}
		else label.push_back(-1);
	}
	for (int i = 0; i < seg_size * 2; ++i) {
		seg_tree[i] = 0;
	}
	long long now = 200000;
	REP(i, label.size()) {
		now += label[i];
	}
	seg_tree[(now+seg_size)]++;
	seg_set((now + seg_size) / 2);
	long long ans = 0;
	for (int i = label.size()-1; i >= 0; --i) {
		now -= label[i];
		ans += seg_find(1, 0, seg_size, now, seg_size);
		seg_tree[(now + seg_size)]++;
		seg_set((now + seg_size) / 2);
	}
	long long border = label.size()*(label.size() + 1) / 2;
	border = (border + 1) / 2;
	if (ans >= border) return 1;
	return 0;
}
int main() {
	int n;
	cin >> n;
	REP(i, n) {
		long long a;
		cin >> a;
		input.push_back(a);
	}
	long long bot = 1;
	long long top = 1000000000;
	while (top - bot > 1) {
		long long mid = (top + bot) / 2;
		if (solve(mid) == 0) {
			top = mid;
		}
		else bot = mid;
	}
	if (solve(top) == 1) {
		cout << top << endl;
	}
	else {
		cout << bot << endl;
	}
	return 0;
}

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

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

    if ((N[0] == N[1] && N[0] == N[2])||
        (N[1] == N[2] && N[1] == N[3])) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
import Prelude

lightpre :: Int-> Int -> Int -> Int 
lightpre a 0 sum = sum-a
lightpre a b sum = lightpre b (a `mod` b) (sum+2 * (a `div` b)* b)

light n x = lightpre (n-x) x n

main :: IO ()
main = do
    -- スペース区切り整数の入力
    [n, x] <- map read . words <$> getLine
    -- 出力
    putStrLn $ show $ light n x



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

using namespace std;

template <long long Mod> struct ModInt { /* {{{ */
  long long v;
  constexpr ModInt(const long long x = 0) {
    v = x % Mod;
    if (v < 0) {
      v += Mod;
    }
  }
  constexpr ModInt operator+(const ModInt rhs) const { return ModInt(*this) += rhs; }
  constexpr ModInt operator-(const ModInt rhs) const { return ModInt(*this) -= rhs; }
  constexpr ModInt operator*(const ModInt rhs) const { return ModInt(*this) *= rhs; }
  constexpr ModInt operator/(const ModInt rhs) const { return ModInt(*this) /= rhs; }
  const ModInt &operator+=(const ModInt rhs) {
    v += rhs.v;
    if (v >= Mod) {
      v -= Mod;
    }
    return *this;
  }
  constexpr ModInt &operator-=(const ModInt rhs) {
    if (v < rhs.v) {
      v += Mod;
    }
    v -= rhs.v;
    return *this;
  }
  constexpr ModInt &operator*=(const ModInt rhs) {
    v = v * rhs.v % Mod;
    return *this;
  }
  constexpr ModInt &operator/=(ModInt rhs) {
    long long exp = Mod - 2;
    while (exp) {
      if (exp & 1) {
        *this *= rhs;
      }
      rhs *= rhs;
      exp >>= 1;
    }
    return *this;
  }
  friend ostream &operator<<(ostream &s, ModInt<Mod> m) {
    s << m.v;
    return s;
  }
  friend istream &operator>>(istream &s, ModInt<Mod> m) {
    s >> m.v;
    return s;
  }
}; /* }}} */

const int mod = 1e9 + 7;
using modint = ModInt<mod>;

int N;
vector<vector<int>> edges;
vector<modint> fact;
vector<int> size;
vector<modint> dp;

void rec(int v, int par) {
  dp[v] = 1;
  size[v] = 1;
  if (edges[v].size() == 1 and edges[v][0] == par) {
    return;
  }
  for (int e : edges[v]) {
    if (e == par) continue;
    rec(e, v);
    dp[v] *= dp[e] / fact[size[e]];
    size[v] += size[e];
  }
  dp[v] *= fact[size[v] - 1];
  return;
}

int main() {
  cin >> N;
  edges.resize(N, vector<int>());
  for (int i = 0; i < N - 1; i++) {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    edges[a].push_back(b);
    edges[b].push_back(a);
  }
  fact.resize(N + 5);
  fact[0] = fact[1] = 1;
  for (int i = 2; i < N + 5; i++) {
    fact[i] = fact[i - 1] * i;
  }
  size.resize(N + 5);
  dp.resize(N + 5);
  rec(0, -1);

  queue<pair<int, int>> que;
  que.push({0, -1});
  while (!que.empty()) {
    auto f = que.front();
    int v = f.first;
    int par = f.second;
    que.pop();
    if (par != -1) {
      dp[v] = dp[par] * size[v] / (N - size[v]);
    }
    for (int e : edges[v]) {
      if (e == par) continue;
      que.push({e, v});
    }
  }

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

  return 0;
}
/* vim:set fdm=marker: */


Measured memory_bytes: 19444
import java.util.*;

public class Main{
	final int MOD = 1000000007;
	final int INF = 1000000000;
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int x = Integer.parseInt(sc.next());
		int y = Integer.parseInt(sc.next());
		sc.close();
		System.out.println(gcd(x, y));
	}

	public static int gcd(int a, int b){
		if(b == 0) return a;
		if(a % b != 0) return gcd(b, a % b);
		return b;
	}
}



Measured memory_bytes: 26192
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
#define MOD (1000000007)
#define INF (1e9)
#define INFL (1e18)

typedef long long ll;
typedef unsigned int ui;
typedef unsigned long long ull;
template<class T>using arr=vector<vector<T>>;
template<class T>void pr(T x){cout << x << endl;}
template<class T>void prvec(vector<T>& a){rep(i, a.size()-1){cout << a[i] << " ";} cout << a[a.size()-1] << endl;}
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int main()
{
    string s; cin >> s;
    for(int i = s.size()-1; i>=0; i--){
        cout << s[i];
    }
    cout << endl;
    return 0;}


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

const int INF = 1e9;
const int MOD = 1e9 + 7;

using namespace std;

typedef long long ll;

#define REP(i, n) for (int i = 0; i < int(n); i++)
#define REPD(i, n) for (int i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for (int i = a; i < int(b); i++)
#define FORD(i, a, b) for (int i = b - 1; i >= int(a); i--)
#define WRAP(y, x, h, w) (0 <= y && y < h && 0 <= x && x < w)

#define ALL(x) (x).begin(), (x).end()

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

struct UnionFind {
    vector<int> par;
    UnionFind(int N)
        : par(N)
    { //最初は全てが根であるとして初期化
        for (int i = 0; i < N; i++)
            par[i] = i;
    }
    int root(int x)
    {
        if (par[x] == x)
            return x;
        return par[x] = root(par[x]);
    }
    void unite(int x, int y)
    {
        int rx = root(x);
        int ry = root(y);
        if (rx == ry)
            return;
        par[rx] = ry;
    }
    bool same(int x, int y)
    {
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

int main()
{
    int n, m;
    cin >> n >> m;
    UnionFind uf(n);
    REP(i,m){
        int a,b;
        cin>>a>>b;
        a--;
        b--;
        uf.unite(a,b);
    }
    set<int> si;
    REP(i,n){
        si.insert(uf.root(i));
    }
    cout<<si.size()-1<<endl;
}

Measured memory_bytes: 7552
using System;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Collections.Generic;

class Program
{
	static int[,] minRoot;

	static string[] root;

	static int H, W;

	static void CheckRoot(int y, int x){
			//直前が#かを判定するフラグ
			bool isContinuous = false;

			//1. スタート地点の場合
			if(y == 0 && x == 0){
					minRoot[y,x] = 0;
			}

			//2. 上の端の場合
			else if(y == 0){
					minRoot[y,x] = minRoot[y,x-1];
					if(root[y][x-1] == '#'){
							isContinuous = true;
					}
			}
			//3. 左端の場合
			else if(x == 0){
					minRoot[y,x] = minRoot[y-1,x];
					if(root[y-1][x] == '#'){
							isContinuous = true;
					}
			}
			//4. その他の場合
			else{
					int min = Math.Min(minRoot[y,x-1], minRoot[y-1,x]);
					minRoot[y,x] = min;
					if(min == minRoot[y,x-1] && root[y][x-1] == '#'){
							isContinuous = true;
					}
					else if(min == minRoot[y-1,x] && root[y-1][x] == '#'){
							isContinuous = true;
					}
			}

			//書き換えが必要な場合
			if(root[y][x] == '#' && !isContinuous){
					minRoot[y,x] ++;
			}
	}

	//Main
	static void Main(string[] args)
	{
		//読み込む
		string[] S = Console.ReadLine().Split(' ');

		H = int.Parse(S[0]);
		W = int.Parse(S[1]);
		root = new string[H];
		minRoot = new int[H, W];

		//経路を取得
		for(int i=0; i<H; i++){
				string line = Console.ReadLine();
				root[i] = line;
		}

		//ループ処理
		for(int i=0; i<H; i++){
				for(int j=0; j<W; j++){
						CheckRoot(i, j);
						//Console.WriteLine(i + " " + j + " " +  minRoot[i,j]);
				}
		}

		Console.WriteLine(minRoot[H-1,W-1]);
	}
}



Measured memory_bytes: 11220
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long
const int N=1e9+7;
set<int>adj[200001];
int vis[200001]={0};
int cnt;
void dfs(int node)
{
    vis[node]=1;
    cnt++;
    for(auto child:adj[node])
    {
        if(vis[child]==0)
        {
            dfs(child);
        }
    }
}
int32_t main()
{
    IOS;
    int n,m;
    cin>>n>>m;
    for(int i=1;i<=m;i++)
    {
        int u,v;
        cin>>u>>v;
        adj[u].insert(v);
        adj[v].insert(u);
    }
    int ans=0;
    for(int i=1;i<=n;i++)
    {
        cnt=0;
        if(vis[i]==0)
        {
            dfs(i);
            ans=max(ans,cnt);
        }
    }
    cout<<ans;
}



Measured memory_bytes: 39536
#include<iostream>
using namespace std;
int main(){
    int n,i,t[1000],c[1000],a,b;
    cin >> n >> i;
    b=1001;
    for(a=1;a<=n;a++)
        cin >> t[a] >> c[a];
    for(a=1;a<=n;a++)
    {
        if(c[a]>i){
            t[a]=0;
        }
        else{
            if(t[a]<=b){
                b=t[a];
            }
        }
    }
    if(b==1001)
        cout << "TLE";
    else
        cout << b ;
    return 0;
}


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


string s[601];

int main() {
    int n;
    cin >> n;
    for(int i = 0; i < n; i++){
        string t;
        cin >> t;
        s[i] = t+t;
        s[n+i] = t+t;
    }
    int ans = 0;
    bool OK = true;
    for(int i = 0; i < n; i++){
        OK = true;
        for(int j = 0; j < n; j++){
            for(int k = j; k < n; k++){
                if(s[j][k+i] != s[k][j+i]){
                    OK = false;
                }
            }
            if(!OK){break;}
        }
        if(OK){ans++;}
    }
    cout << ans*n << endl;

    return 0;
    }


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

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

     if (x < a) {
         cout << "NO" << endl;
     } else if (x > a + b) {
         cout << "NO" << endl;
     } else {
         cout << "YES" << endl;
     }
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#define N 100005
int x,y,k;
int main(){
scanf("%d%d%d",&k,&x,&y);
int p=x%k,q=x/k;
if(((q+1)*(k)>=x&&(q+1)*(k)<=y))printf("OK");
else if(q*k>=x&&q*k<=y)printf("OK");
else printf("NG");
}

Measured memory_bytes: 1728
N=int(input())
A=list(map(int,input().split()))
B=[0]*(N)

S=0
p=1
for i in range(N):
    S+=A[i]*p
    p*=-1


for i in range(N):
    B[i]=S

    S*=-1
    S+=2*A[i]

print(" ".join(map(str,B)))

Measured memory_bytes: 96140
#include<bits/stdc++.h>
#include<vector>
#include<string>
#include<map>
#define int long long
using namespace std;
main()
{
	//freopen("input.txt","rt",stdin);
	int n;
	cin>>n;
	int arr[n];
	int c =0;
	for(int i=0;i<n;i++)
	{
		cin>>arr[i];
		if(arr[i] <=0)
		{
			c++;
		}
	}
	int sum =0;
	if(c%2 == 0)
	{
		for(int i=0;i<n;i++)
		{
			if(arr[i] < 0)
			{
				sum += arr[i] * -1;
			}
			else
			{
				sum += arr[i];
			}
		}
	}
	else
	{
		int mi = INT_MAX;
		for(int i=0;i<n;i++)
		{
			if(arr[i] < 0)
			{
				sum += arr[i] * -1;
				mi = min(arr[i] * -1,mi);
			}
			else
			{
				sum += arr[i];
				mi = min(mi,arr[i]);
			}
		}
		sum -= 2* mi;
	}
	cout<<sum<<endl;
}

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

using namespace std;
int n,m;

int main()
{
    priority_queue<double> que;
    scanf("%d%d",&n,&m);
    int tmp;
    for(int i=0;i<n;++i){
        scanf("%d",&tmp);
        que.push(tmp);
    }
    for(int i=0;i<m;++i){
        double now = que.top();
        que.pop();que.push(now/2);
    }
    long long ans =0;
    while(!que.empty()){
        ans += floor(que.top());
        que.pop();
    }
    printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 1400
#include <bits/stdc++.h>
#define rep(i,a,n) for(int i=a;i<n;i++)
#define repb(i,a,b) for(int i=a;i>=b;i--)
#define all(a) a.begin(),a.end()
#define o(a) cout<<a<<endl
#define int long long
#define fi first
#define se second
using namespace std;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;

int h, w;

bool can(int y, int x){
	return (0 <= y && y < h && 0 <= x && x < w);
}

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

signed main() {
	int t, n;
	cin >> t;
	rep(k, 0, t){
		if(k) cout << endl;
		int a[110][110]={};
		cin >> n;
		h = w = n;
		vi d;
		int tmp = n;
		d.push_back(tmp);
		while(1){
			if(tmp <= 2){
				d.push_back(tmp);
				break;
			}
			rep(i,0,2) d.push_back(tmp);
			tmp -= 2;
		}
		int y = n - 1, x = 0;
		a[y][x] = 1;
		rep(i, 0, d.size()){
			int dir = i % 4;
			rep(j, 0, d[i] - 1){
				y += dy[dir];
				x += dx[dir];
				a[y][x] = 1;
			}
		}
		rep(i, 0, n){
			rep(j, 0, n){
				cout << (a[i][j] ? "#":" ") ;
			}
			cout << endl;
		}
	}
}

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

struct UnionFind{
	vector<ll> rnk,par,num;
	UnionFind(ll N) : rnk(N),par(N),num(N){
		init();
	}
	void init(){
		for(ll i = 0;i < rnk.size();i++){
			rnk[i] = 0;
			par[i] = i;
			num[i] = 1;
		}
	}
	ll find(ll x){
		if(par[x] == x) return x;
		return par[x] = find(par[x]);
	}
	void unite(ll x,ll y){
		x = find(x);
		y = find(y);
		if(x == y) return;
		if(rnk[x] < rnk[y]){
			par[x] = y;
			num[y] += num[x];
		}
		else{
			par[y] = x;
			num[x] += num[y];
			if(rnk[x] == rnk[y]) rnk[x]++;
		}
	}
	bool same(ll x,ll y){
		return (find(x) == find(y));
	}
	ll size(ll x){
		return num[find(x)];
	}
};

signed main(){
 ll n, m; cin >> n >> m;
 vector<ll> a(m), b(m);
 for(int i = 0; i < m; i++){
   scanf("%lld%lld", &a[i], &b[i]);
   --a[i]; --b[i];
 }
 UnionFind tree(n);
 vector<ll> ans;
 ll num = n * (n - 1) / 2;
 ans.push_back(num);
 for(ll i = m - 1; i >= 1; i--){
   ll x = a[i], y = b[i];
   if(!tree.same(x, y)){
     num -= tree.size(x) * tree.size(y);
     tree.unite(x, y);
   }
   ans.push_back(num);
 }
 reverse(ans.begin(), ans.end());
 for(ll i : ans) cout << i << '\n';
}

Measured memory_bytes: 6132
#include<iostream>
#include<string>
#include<vector>
#include<cmath>
#include<queue>
#include<stack>
#include<set>
#include<algorithm>
#include<utility>
#include<map>
using namespace std;
typedef long long ll;
const int mod = 1000000007;
const int INF = 1001001001;

ll pow_mod(ll p, ll n, ll m) {
	if (n == 0) return 1;
	else if (n == 1) return p % m;
	else if (n % 2 == 1) return p * pow_mod(p, n - 1, m) % m;
	else {
		ll tmp = pow_mod(p, n / 2, m);
		return (tmp * tmp) % m;
	}
}

ll gcd(ll x, ll y) {
	if (y == 0) {
		return x;
	}
	return gcd(y, x % y);
}

ll com_mod(ll n, ll k, ll m) {
	if (k == 0) return 1;
	else {
		ll x = 1;
		ll y = 1;
		for (ll i = 0; i < k; i++) {
			x = (x * (n - i)) % m;
			y = (y * (i + 1)) % m;
		}
		ll res = (x * pow_mod(y, m - 2, m)) % m;
		return res;
	}
}

int main() {
	int n; cin >> n;
	int ans = 0;
	for (int i = 0; i < n; i++) ans += i + 1;
	cout << ans << endl;
	return 0;
}

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

int main()
{
    int N, M;
    cin >> N >> M;
    char A[N][N], B[M][M];
    for (int i = 0; i < N; i++)
    {
        for (int j = 0; j < N; j++)
        {
            cin >> A[i][j];
        }
    }
    for (int i = 0; i < M; i++)
    {
        for (int j = 0; j < M; j++)
        {
            cin >> B[i][j];
        }
    }
    //Aの開始位置
    int ans;
    for (int i = 0; i < N - M + 1; i++)
    {
        for (int j = 0; j < N - M + 1; j++)
        {
            ans = 0;
            for (int k = 0; k < M; k++)
            {
                for (int l = 0; l < M; l++)
                {
                    if (A[i + k][j + l] == B[k][l])
                    {
                        ans++;
                    }
                }
            }
            if (ans == M * M)
            {
                cout << "Yes" << endl;
                return 0;
            }
        }
    }
    cout << "No" << endl;
}

Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var correct [100005]bool;
	var penalty [100005]int;

	var n int;
	var m int;

	fmt.Scan(&n);
	fmt.Scan(&m);

	correctCount := 0
	penaltyCount := 0
	for i := 0; i < m; i++ {
		var pname int;
		var ans string;
		fmt.Scan(&pname);
		fmt.Scan(&ans);

		if ans == "WA" {
			penalty[pname]++
		} else {
			if !correct[pname] {
				correct[pname] = true
				correctCount++
				penaltyCount += penalty[pname]
			}
		}
	}

	fmt.Printf("%d %d", correctCount, penaltyCount)

}


Measured memory_bytes: 6400
#include <iostream>
 
using namespace std;
 
int main () {
  long N, K;
  cin >> N >> K;

  long ans = (N / K) * (N / K) * (N / K);
  if (K % 2 == 0) {
    long tmp = (N / (K / 2)) - (N / K);
    ans += tmp * tmp * tmp;
  }

  cout << ans << endl;
}


Measured memory_bytes: 256
const int isDebugMode = 1;
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<long long, long long> P;
struct edge{long long to,cost;};
const int inf = 1 << 27;
const long long INF = 1LL << 60;
const int COMBMAX = 1001001;
const long long MOD = 1000000007;
const long long dy[] = {-1, 0, 0, 1};
const long long dx[] = {0, -1, 1, 0};
string abc = "abcdefghijklmnopqrstuvwxyz";
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define eachdo(v, e) for (const auto &e : (v))
#define all(v) (v).begin(), (v).end()
#define lower_index(v, e) (long long)distance((v).begin(), lower_bound((v).begin(), (v).end(), e))
#define upper_index(v, e) (long long)distance((v).begin(), upper_bound((v).begin(), (v).end(), e))
long long mpow(long long a, long long n, long long mod = MOD){long long res = 1; while(n > 0){if(n & 1)res = res * a % mod; a = a * a % mod; n >>= 1;} return res;}
void pt(){cout << endl; return;}
template<class Head> void pt(Head&& head){cout << head; pt(); return;}
template<class Head, class... Tail> void pt(Head&& head, Tail&&... tail){cout << head << " "; pt(forward<Tail>(tail)...);}
void dpt(){if(!isDebugMode) return; cout << endl; return;}
template<class Head> void dpt(Head&& head){if(!isDebugMode) return; cout << head; pt(); return;}
template<class Head, class... Tail> void dpt(Head&& head, Tail&&... tail){if(!isDebugMode) return; cout << head << " "; pt(forward<Tail>(tail)...);}
template<class T> void debug(T v){if(!isDebugMode) return; rep(i, v.size()) cout << v[i] << " " ; cout << endl;}
template<class T> void debug2(T v){if(!isDebugMode) return; rep(i, v.size()){rep(j, v[i].size()) cout << v[i][j] << " " ; cout << endl;}}
template<class T1, class T2> inline bool chmin(T1 &a, T2 b){if(a > b){a = b; return true;} return false;}
template<class T1, class T2> inline bool chmax(T1 &a, T2 b){if(a < b){a = b; return true;} return false;}
template<class T1, class T2> long long recgcd(T1 a, T2 b){return a % b ? recgcd(b , a % b) : b;}
bool valid(long long H, long long W, long long h, long long w) { return 0 <= h && h < H && 0 <= w && w < W; }

int main(){
    ll H, W; cin >> H >> W;
    ll K; cin >> K;
    vector<string> st(H);
    rep(i, H) cin >> st[i];
    ll ans = 0;
    rep(bit, 1 << (H + W)){
        vector<string> cst = st;
        rep(i, H){
            if(bit >> i & 1){
                rep(j, W) cst[i][j] = 'r';
            }
        }
        rep(i, W){
            if((bit >> (i + H)) & 1){
                rep(j, H) cst[j][i] = 'r';
            }
        }
        ll cnt = 0;
        rep(i, H)rep(j, W){
            if(cst[i][j] == '#') cnt++;
        }
        if(cnt == K) ans++;
    }
    pt(ans);
}

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

namespace AtCoder
{
	class Program
	{
		static void Main(string[] args)
		{
			int n = int.Parse(Console.ReadLine());

			int[] arr = Console.ReadLine().Trim().Split(' ').Select(hogehoge => int.Parse(hogehoge)).ToArray<int>();

			int[] order = new int[n];

			for ( int i = 0; i < n; i++)
			{
				order[arr[i] - 1] = i + 1;
			}

			Console.Write(order[0].ToString());

			for (int j = 1; j < n; j++)
			{
				Console.Write(" " + order[j].ToString());
			}

		}


	}

}


Measured memory_bytes: 24280
N = int(input())
odd_numbers = [i for i in range(1, N + 1) if i % 2 == 1]

def count_divisor(number):
    divisor = 0
    for i in range(1, number + 1):
        if number % i == 0:
            divisor += 1
    return divisor 

def main():
    count = 0
    for i in odd_numbers:
        if count_divisor(i) == 8:
            count += 1
    print(count)

if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
#include <iostream>
#include <sstream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <utility>
#include <map>
#include <list>
#include <climits>
#include <set>
#include <deque>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <bitset>

// #define cerr if(false)cerr
#define watch(x) cerr << "> " << #x << ": " << x << "\n";

using namespace std;

template <typename T>
std::ostream &operator <<(std::ostream &out, vector<T> &v) {
	for (typename vector<T>::size_type i = 0; i < v.size(); ++i)
		out << v[i] << " ";
	out << "\n";
    return out;
}
template <typename T, typename N>
std::ostream &operator <<(std::ostream &out, vector<pair<T, N> > &v) {
	for (size_t i = 0; i < v.size(); ++i)
		out << "(" << v[i].first << ", " << v[i].second << ") ";
	out << "\n";
    return out;
}
template <typename T>
std::ostream &operator <<(std::ostream &out, vector<vector<T> > &v) {
	for (size_t i = 0; i < v.size(); ++i) {
		for (size_t j = 0; j < v[i].size(); ++j) {
			out << v[i][j] << " ";
		}
		out << "\n";
	}
   	return out;
}

int main() {

	std::ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

	int n;
	cin >> n;

	vector<int> a(n), occs(1e5 + 1);
	long long sum = 0;
	for (int i = 0; i < n; ++i) {
		cin >> a[i];
		++occs[a[i]];
		sum += a[i];
	}

	int q;
	cin >> q;

	int b, c;
	while (q--) {
		cin >> b >> c;

		sum -= (long long) occs[b] * b;
		sum += (long long) occs[b] * c;
		occs[c] += occs[b];
		occs[b] = 0;

		cout << sum << "\n";
	}

	return 0;

}

Measured memory_bytes: 3960
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
  long long n,i,k,ans = 0,c = 0;cin >> n;
  long long a[n+1];a[0] = 0;
  for(i=1;i<=n;i++){
    cin >> k;a[i] = a[i-1]+k;
  }
  sort(a,a+n+1);
  for(i=1;i<=n;i++){
    if(a[i] == a[i-1]){
      c++;ans += c;
    } else c = 0;
  }
  cout << ans << endl;
}

Measured memory_bytes: 1792
#include<iostream>
#include<algorithm>
#include<iomanip>
#include<cassert>
using namespace std;
typedef long long ll;
typedef pair<ll,string> pls;
const int N = 20;

main(){
  int n;
  while(cin>>n){
    if (n == 0)break;
    int in[N][30]={0};
    int cnt[30]={0};
    pls ans[N];
    for(int i=0;i<n;i++){
      int m;
      cin>>ans[i].second>>m;
      ans[i].first=0;
      for(int j=0;j<m;j++){
	int tmp;
	cin>>tmp;
	in[i][tmp]++;
	cnt[tmp]++;
	assert(in[i][tmp] == 1);
      }
    }

    for(int i=0;i<n;i++){
      for(int j=0;j<30;j++){
	if (in[i][j])ans[i].first+=(n+1-cnt[j]);
      }
    }

    sort(ans,ans+n);
    cout << ans[0].first<<" " << ans[0].second << endl;
    for(int i=1;i<n;i++){
      if (ans[0].first == ans[i].first)assert(ans[0].second < ans[i].second);
      else if (ans[0].first < ans[i].first);
      else if (ans[0].first > ans[i].first)assert(false);
    }
  }
  return false;
}

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


int main() {
    string S;
    ll K;
    cin >>S>>K;
    ll a= S.size();
    ll mn =min(a,K);
    rep(i,mn){
        if(S[i]>'1'){
            cout<<S[i]<<endl;
            return 0;
}
    }
    cout << 1<<endl;
}

Measured memory_bytes: 256
import math
N=int(input())
MOD=10**9+7
fish={}
ans=1
a=0
b=0
w=0
for i in range(N):
    A,B=map(int,input().split())
    if A==0 and B==0:
        w+=1
    elif A==0:
        a+=1
    elif B==0:
        b+=1
    else:
        c=math.gcd(A,B)
        A=A//c
        B=B//c
        if B<0:
            A,B=-A,-B
        k=(A,B)
        if not k in fish:
            fish[k]=0
        fish[k]+=1
group=set()
for (p,q),v in fish.items():
    invp,invq=-q,p
    if invq<0:
        invp,invq=-invp,-invq
    if not (invp,invq) in group:
        group.add((p,q))
for p,q in group:
    invp,invq=-q,p
    if invq<0:
        invp,invq=-invp,-invq
    t=2**fish[p,q]
    if (invp,invq) in fish:
        t+=2**fish[invp,invq]-1
    ans=(ans*t)%MOD
ans*=2**a+2**b-1
ans=ans+w-1
print(ans%MOD)

Measured memory_bytes: 72128
#include <bits/stdc++.h>
#define REP(i,n) for (int i=0;i<(n);i++)
#define FOR(i,s,e) for (int i=s;i<(e);i++)
#define All(v) (v).begin(),(v).end()
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
using namespace std;
typedef long long llint;
typedef pair<int, int> P;
const int MOD = (int)1e9 + 7;
const int INF = 999999999;

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

    llint ans = (int)1e18;
    int N;
    cin >> N;
    vector<llint> a(201, 0);
    REP(i, N){
        int x;
        cin >> x;
        x+=100;
        REP(j, 201){
            a[j] += (x-j)*(x-j);
        }
    }
    REP(i, 201){
        ans = min(ans, a[i]);
    }
    cout << ans << "\n";
    
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void){
    int m,f,r;
    while(1){
        scanf("%d %d %d",&m,&f,&r);
        if(m==-1&&f==-1&&r==-1){
            break;
        }
        if((m+f)>=80){
            printf("A\n");
        }
        else if(65<=(m+f)&&(m+f)<85){
            printf("B\n");
        }
        else if(50<=(m+f)&&65>(m+f)){
            printf("C\n");
        }
        else if(30<=(m+f)&&50>(m+f)){
            if(r>=50){
                printf("C\n");
            }
            else if((m+f)==49&&r==-1){
                printf("F\n");
            }
            else{
                printf("D\n");
            }
        }
        if((m+f)<30){
            printf("F\n");
        }
        
    }
return 0;
}


Measured memory_bytes: 2044
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define sqr(x) ((x)*(x))
#define mp make_pair
#define uint unsigned
inline char gc(){
    static char buf[100000],*p1=buf,*p2=buf;
    return p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;
}
#define gc getchar
inline int read(){
	int x = 0; char ch = gc(); bool positive = 1;
	for (; !isdigit(ch); ch = gc())	if (ch == '-')	positive = 0;
	for (; isdigit(ch); ch = gc())	x = x * 10 + ch - '0';
	return positive ? x : -x;
}
inline void write(int a){
    if(a>=10)write(a/10);
    putchar('0'+a%10);
}
inline void writeln(int a){
    if(a<0){
    	a=-a; putchar('-');
	}
	write(a); puts("");
}
const int N=3005;
inline int ksm(ll a,int b,int mod){
	int ans=1;
	for(;b;b>>=1){
		if(b&1)ans=ans*a%mod;
		a=a*a%mod;
	}
	return ans;
}
int n,mod,ans;
int s[N][N],ss[N][N],c[N][N];
signed main(){
	n=read(); mod=read();
	s[0][0]=c[0][0]=1; for(int i=0;i<=n;i++)ss[0][i]=1;  
	for(int i=1;i<=n+1;i++){
		s[i][1]=ss[i][1]=1; c[i][0]=1;
		for(int j=1;j<=i;j++)c[i][j]=(c[i-1][j]+c[i-1][j-1])%mod;
		for(int j=2;j<=n+1;j++)ss[i][j]=(ss[i-1][j]+(s[i][j]=((ll)s[i-1][j]*j+s[i-1][j-1])%mod))%mod;
	}
	for(int i=0;i<=n;i++){
		int sum=0;
		for(int j=0;j<=i;j++){
			int t=(ll)ksm(2,(n-i)*j,mod)*c[n][i]%mod,sss=0;
			//if(i<=10)cout<<i<<" "<<j<<" "<<sss<<" "<<s[i+1][j+1]<<endl;
			sum=(sum+(ll)s[i+1][j+1]*t)%mod;
		}
		sum=(ll)sum*ksm(2,ksm(2,n-i,mod-1),mod)%mod;
		ans=(ans+(i&1?-1:1)*sum)%mod;
		//cout<<i<<" "<<sum<<endl;
	}
	cout<<(ans+mod)%mod<<endl;
}
/*
问题：选出任意个不同的n位2进制数，满足对于任意位数，都至少出现了两个1
容斥，求至少i位最多出现1个1的方案数
即对于其中i位，这些数并没有交集 
对于这i位，可以不选，也可以分配掉
这i位有值中有k个出现1个1，i-k没出现1，的选了j个数 
可以发现答案是c(n,i)*c(i,k)*s(k,j)*(2^((n-i)*j))
但这i位没1的情况呢？
这i位没1有2^(n-i)个数，每个选和不选都可以，直接乘2^(2^(n-i)) 
ss是第二类斯特林数的前缀和 
*/ 

Measured memory_bytes: 104704
#include <bits/stdc++.h>
#define X first
#define Y second
#define pb push_back
using namespace std;

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

    vector <int> b(a);
    sort(a.begin(), a.end());

    int ind = n / 2;
    map <int, int> ans;
    for (int i = 0; i < n; i++)
    {
        if (i < ind)
        {
            ans[a[i]] = a[ind];
        }
        else
        {
            ans[a[i]] = a[ind - 1];
        }
    }
    for (int i = 0; i < n; i++)
        cout << ans[b[i]] << ' ';
    return 0;
}


Measured memory_bytes: 12928
h, w = map(int, input().split())
s = [input() for i in range(h)]
up = down = right = left = '.'
for x in range(h):
    for y in range(w):
        if(list(s[x])[y] == '#'):
            if(y != w-1):
                right = list(s[x])[y+1]
            if(x != h-1):
                down = list(s[x+1])[y]
            if(x != 0):
                up = list(s[x-1])[y]
            if(y != 0):
                left = list(s[x])[y-1]
            if(up != '#' and down != '#' and right != '#' and left != '#'):
                print("No")
                exit()
            up = down = right = left = '.'
print("Yes")


Measured memory_bytes: 3064
gets
a=[0]+gets.split.map(&:to_i).sort

(a.size-1).times do |i|
  a[i+1] += a[i]
end

r=0
(a.size-1).downto(1) do |i|
  r+=1
  l,h = a[i-1],a[i]-a[i-1]
  break if 2*l < h
end
p r


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

#define boost ios_base::sync_with_stdio(false);cin.tie(NULL)
#define pb push_back

int n, m;
vector<int>adj[200005];
bool vis[200005];
int ans = 1;
int cnt = 0;
void dfs(int n)
{
  cnt++;
  vis[n] = 1;
  ans = max(ans, cnt);
  for (int x : adj[n])
  {
    if (!vis[x])
    {
      dfs(x);
    }
  }

}
int main()
{



  cin >> n >> m;
  for (int i = 0; i < m; i++)
  {
    int a, b;
    cin >> a >> b;
    adj[a].pb(b);
    adj[b].pb(a);
  }
  for (int i = 1; i <= n; i++)
  {
    if (!vis[i])
    {
      cnt = 0;
      dfs(i);
    }
  }
  cout << ans << endl;



}







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

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define ALL(a)     (a).begin(),(a).end()
#define MOD 1000000007

typedef long long int ll;

const ll INF=(ll)1e18;
//const int INF=(1<<30);

int main(){
  ll k;
  cin >> k;

  int n = 50;

  ll p = k/n;
  int q = k%n;

  vector<ll> a(50,0);
  REP(i,50)a[i]=p+i;

  REP(i,q){
    sort(ALL(a));
    a[0]+=n;
    FOR(j,1,a.size())a[j]--;
  }

  cout << n << endl;
  REP(i,n){
    if(i!=0)cout << " ";
    cout << a[i];
  }
  cout << endl;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int fd[35];
int main() {
  int n, m;
  scanf("%d%d", &n,&m );
  for( int i = 0, k ; i < n ; ++i ) {
    scanf("%d", &k);
    for( int j = 0, x ; j < k ; ++j ) {
      scanf("%d", &x );
      fd[x]++;
    }
  }
  int f = 0;
  for( int i = 0 ; i < 35 ; ++i ) {
    if( fd[i] == n ) ++f;
  }
  printf("%d\n", f );
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(){
	int S,S1,h,m,s;
	h=0;
	m=0;
	s=0;
	scanf("%d",&S);
	h = S/3600;
	S1 = S%3600;
	m = S1/60;
	s = S1%60;
	printf("%d:%d:%d\n",h,m,s);
	return 0;
}

Measured memory_bytes: 2732
let step out key =
    match key with
    | "B" -> 
        begin match out with
        | [] -> []
        | _ :: xs -> xs
        end
    | _ ->
        key :: out

let () =
    read_line ()
    |> Str.split (Str.regexp "")
    |> List.fold_left step []
    |> List.rev
    |> String.concat ""
    |> print_endline


Measured memory_bytes: 512
#include <iostream>
#include <stdlib.h>

using namespace std;

int dir[4][2] = {
	{0, -1},
	{-1, 0},
	{1, 0},
	{0, 1}
};

void shoot(char a[20][20], int s, int t, int x, int y, int d)
{
	if(x < 0 || x == t || y < 0 || y == s){
		return ;
	}
	if(a[y][x] == '.' || a[y][x] == '-'){
		shoot(a, s, t, x+dir[d][0], y+dir[d][1], d);
	} else if(a[y][x] == '*'){
		a[y][x] = '.';
	}
	
	return ;
}

int main(int argc, char **argv)
{
	int n, s, t, x, y, d, m;
	char a[20][20], *c;
	
	cin >> n;
	for(int i = 0; i < n; i++){
		if(i != 0){
			cout << endl;
		}
		cin >> s >> t;
		for(int j = 0, f = 0; j < s; j++){
			scanf("%s", a[j]);
			for(int k = 0; k < t && f == 0; k++){
				if(a[j][k] == '^'){
					x = k;
					y = j;
					f = 1;
					d = 0;
					a[j][k] = '.';
					break;
				}	else if(a[j][k] == '<'){
					x = k;
					y = j;
					f = 1;
					d = 1;
					a[j][k] = '.';
					break;
				} else if(a[j][k] == '>'){
					x = k;
					y = j;
					f = 1;
					d = 2;
					a[j][k] = '.';
					break;
				} else if(a[j][k] == 'v'){
					x = k;
					y = j;
					f = 1;
					d = 3;
					a[j][k] = '.';
					break;
				}
			}
		}
		cin >> m;
		c = (char *)malloc((m+1)*sizeof(char));
		scanf("%s", c);
		for(int j = 0; j < m; j++){
			if(c[j] == 'U'){
				if(y > 0 && a[y-1][x] == '.'){
					y--;
				}
				d = 0;
			} else if(c[j] == 'D'){
				if(y < s-1 && a[y+1][x] == '.'){
					y++;
				}
				d = 3;
			} else if(c[j] == 'L'){
				if(x > 0 && a[y][x-1] == '.'){
					x--;
				}
				d = 1;
			} else if(c[j] == 'R'){
				if(x < t-1 && a[y][x+1] == '.'){
					x++;
				}
				d = 2;
			} else {
				shoot(a, s, t, x+dir[d][0], y+dir[d][1], d);
			}
		}
		free(c);
		for(int k = 0; k < s; k++){
			for(int j = 0; j < t; j++){
				if(k == y && j == x){
					if(d == 0){
						cout << '^';
					} else if(d == 1){
						cout << '<';
					} else if(d == 2){
						cout << '>';
					} else {
						cout << 'v';
					}
				} else {
					cout << a[k][j];
				}
			}
			cout << endl;
		}
	}
	
	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
#define int long long 

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

 int n,w;
 cin>>n>>w;
 int wt[n],val[n];
 int sum_val=0;
 
 for(int i=0;i<n;i++)
 {
      cin>>wt[i]>>val[i];
      sum_val+=val[i];
 }
 
 vector<int> dp(sum_val+1,INT_MAX);  //stores the minimum weight with exactly value i(0<=i<=sum_val)
 dp[0]=0;
 for(int i=0;i<n;i++)
 {
      for(int v=sum_val;v>=val[i];v--)
      {
           dp[v]=min(dp[v],dp[v-val[i]]+wt[i]);
      }
 }
 int ans=0;
 for(int i=0;i<=sum_val;i++)
 {
      if(dp[i]<=w)
      ans=max(ans,i);
 }
 cout<<ans;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
ll ans = 0;
const ll INF = 1LL << 60; //MAX 9223372036854775807
const ll mo = INF;
auto mod = [](ll modx) {modx%=mo;modx+=mo;modx%=mo;return modx; };

ll mypow(ll a, ll b)
{
  ll res = 1;
  a %= mo;
  while (b)
  {
    if (b & 1)
      res = res * a % mo;
    a = a * a % mo;
    b >>= 1;
  }
  return res;
}
int main()
{
ll n ;
cin >> n ;
ll cnt=1;
while(1){
  if(n-mypow(26,cnt)>0){n-=mypow(26,cnt);cnt++;}
  else break;
}
/* cout << cnt << endl;
cout << n << endl; */
vector<ll> v;
n--;
while(1){
  v.push_back(n%26);
  n/=26LL;
  if(n==0LL)break;
}
while(v.size()!=cnt)v.push_back(0);
reverse(v.begin(),v.end());
for(auto an:v)cout << (char)('a'+an) ;
cout << endl;
return 0;
}

Measured memory_bytes: 3572
#include<iostream>

using namespace std;

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

    while(N>0){
        if(N%10==7){
            cout << "Yes" << endl;
            return 0;
        }
        N /= 10;
    }
    cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 3624
from collections import Counter

N, P = map(int, input().split())
A = list(map(int, input().split()))
n0 = 0
n1 = 0
for i, a in enumerate(A):
    b = a % 2
    A[i] = b
    if b == 0:
        n0 += 1
    else:
        n1 += 1
C1 = [1]
for i in range(n1):
    C1.append(C1[-1] * (n1-i)//(i+1))


ans = 0
for i in range(0, 51, 2):
    if i + P > n1:
        break
    ans += C1[i+P] * (2**(n0))


print(ans)



Measured memory_bytes: 3316
n, k = map(int, input().split())
s = list(input())

# 累積和
a = [0]
if s[0] == "0":
	a.append(0)
for i in range(n):
	if i == n-1 or s[i+1] != s[i]:
		a.append(i+1) # 累積和

# print(s[-1])
if s[-1] == "0":
	a.append(a[-1])

if len(a) <= 2*k+1: # 2*k+1
	print(n)
else:
	ans = 0
	for j in range(0, len(a) - 2*k - 1, 2): # len(a)は奇数
		ans = max(ans, a[j+2*k+1] - a[j])
	print(ans)


Measured memory_bytes: 7848
/*
      author : Nishikawa
      created: 09.08.2020 17:15:21
*/

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

int INF = 1e8;

int main(){
    int n,m,x;
    cin >> n >> m >> x;
    vector<vector<int>> a(n,vector<int>(m));
    vector<int> c(n);
    for(int i=0; i<n; i++){
        cin >> c[i];
        for(int j=0; j<m; j++){
            cin >> a[i][j];
        }
    }
    int minf = INF;
    int pat=1;
    for(int i=0; i<n; i++) pat*=2;
    for(int i=1; i<pat; i++){
        vector<int> now(m);
        int c_sum=0;
        int cnt = i;
        for(int j=0; j<n; j++){
            if(cnt&1){
                c_sum+=c[j];
                for(int k=0; k<m; k++){
                    now[k] += a[j][k];
                }
            }
            cnt>>=1;
        }
        bool check=true;
        for(int j=0; j<m; j++){
            if(now[j]<x){
                check = false;
                break;
            }
        }
        if(check) minf=min(minf,c_sum);    
    }
    if(minf!=INF) cout << minf << endl;
    else cout << "-1" << endl;
    return 0;
}

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

using namespace std;
using lli = int_fast64_t;
using ulli = uint_fast64_t;
#define debug(x) cerr << #x << " : " << x << endl
#define debugv(x) cerr << #x << " : {";for(auto value_of_x:x){ cerr << value_of_x << ", ";}cerr << endl
#define debugst(x) auto xt = x;cerr << #x << " : {";for(int i=0;i<x.size();i++){ cerr << xt.top() << ", ";xt.pop();}cerr << endl
#define debugvp(x) cerr << #x << " : {";for(auto value_of_x:x){ cerr << value_of_x.first << " : " << value_of_x.second << ", ";}cerr << endl

const lli MOD = 1000000007;
const lli LIMIT = 1000000000000000000 * 5;
const int tenfive = 100000;

int main() {
	int N;
	cin >> N;
	vector<double> v(N);
	for (int i = 0; i < N; i++) {
		cin >> v[i];
	}
	priority_queue<double, vector<double>, greater<>> pq;
	for (int i = 0; i < N; i++) {
		pq.push(v[i]);
	}
	while (pq.size()!=1) {
		double l = pq.top(); pq.pop();
		double r = pq.top(); pq.pop();
		pq.push((l + r) / 2.0);
	}
	cout << pq.top() << endl;
	return 0;
}


Measured memory_bytes: 256
#include <stdlib.h>
#include <stdio.h>

void Constraints(int n)
{
  if(!(3<=n&&n<=10000))
  {
    printf("条件を満たす入力をしてください。\n");
    exit(0);
  }
}
void CheckNum(int n)
{
  int i=1;
  while(i!=n+1)
  {
    int x=i;
    if(x%3==0)
    {
      printf(" %d",i);
    }
    else if(x%10==3)
    {
      printf(" %d",i);
    }else
    {
      while(x/10!=0)
      {
        x=x/10;
        if(x%10==3){printf(" %d",i); break;}
      }
    }
  i++;
  }
  printf("\n");
}
int main(void)
{
  int n;
  scanf("%d",&n);
  Constraints(n);
  CheckNum(n);
}



Measured memory_bytes: 2104
#include <iostream>
#include <string>
#include <string.h>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cmath>
#include <stdio.h>
#include <vector>
#include <time.h>

//     MLE,TLE魔
//↓↓↓↓↓↓↓↓↓↓↓↓
#define int long long
//↑↑↑↑↑↑↑↑↑↑↑↑
//     MLE,TLE魔
#define endre getchar();getchar();return 0
#define moder 1000000007
#define inf 5000000000000000000
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define P pair<int,int>
#define all(v) v.begin(),v.end()
#define prique(T) priority_queue<T,vector<T>,greater<T>>
#define vecunique(vec) sort(vec.begin(), vec.end());decltype(vec)::iterator result = std::unique(vec.begin(), vec.end());vec.erase(result, vec.end())
using namespace std;

bool prime(int n) {
	for (int i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x * y / gcd(x, y);
}
int mod_pow(int x, int y, int mod) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x%mod;
		}
		x = x * x%mod;
		y >>= 1;
	}
	return res;
}
int kai(int x) {
	if (x == 0)return 1;
	return (kai(x - 1)*x) % moder;
}
int comb(int x, int y) {
	return kai(x)*mod_pow(kai(x - y), moder - 2, moder) % moder*mod_pow(kai(y), moder - 2, moder) % moder;
}
struct edge { int to, cost; };
int dx[5] = { 0,1,0,-1 }, dy[5] = { 1,0,-1,0 };
map<int, int>factor(int x) {
	map<int, int>res;
	for (int i = 2; i*i <= x; i++) {
		while (x%i == 0) {
			x /= i;
			res[i]++;
		}
	}
	if (x != 1)res[x]++;
	return res;
}
/*--------Library Zone!--------*/


signed main() {
	string s;
	stack<char>st;
	cin >> s;
	int ans = 0;
	rep(i, s.size()) {
		if (st.empty()) {
			st.push(s[i]);
		}
		else if (st.top() != s[i]) {
			st.pop();
			ans += 2;
		}
		else st.push(s[i]);
	}
	cout << ans << endl;
	endre;
}


Measured memory_bytes: 512
#pragma GCC optimize ("O3")

#include <bits/stdc++.h>
#define DEBUG true
#ifdef ONLINE_JUDGE
#undef DEBUG
#define DEBUG false
#endif 

using namespace std;

#define TRACE(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); cerr << endl;}

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << "[" << *it << " = " << a << "]";
	err(++it, args...);
}

#define MAXN ((int)2e5+5)
#define MOD ((int)1e9 + 7)
#define INF ((int)1e9 + 9)
#define ll long long
#define _ << " " <<
#define CLEAR(a, b) memset(a, b, sizeof(a))
#define LOG(x) if(DEBUG) cerr << x << endl;
#define pb push_back
#define all(x) x.begin(), x.end()
#define endl "\n"
#define pii pair<int,int>
#define mid ((l+r)/2)

ll a, b, n;

signed main()
{
	ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
	cin >> a >> b >> n;

	ll k = (n+1)/b;
	ll x;

	if(k == 0)
		x = n;
	else
		x = k*b - 1;

	ll ans = ((a*x)/b) - a * (x/b);
	cout << ans << endl;
}

/* stuff you should look for
	* int overflow, array bounds
	* special cases (n=1?)
	* do smth instead of nothing and stay organized
	* WRITE STUFF DOWN
*/

Measured memory_bytes: 3588
#include <iostream>
using namespace std;
int main(void){
    int a, b, c, d, e;
    cin >> a >> b >> c >> d >> e;
    if (a<0){
        cout << -(a)*c + d + b*e << endl;
    }
    else
    cout <<(b - a)*e << endl;
    
}


Measured memory_bytes: 3080
#include<bits/stdc++.h>
using namespace std;
#define inf 1000000000
#define INF 1000000000000000
#define ll long long
#define ull unsigned long long
#define M (int)(1e9+7)
#define P pair<int,int>
#define PLL pair<ll,ll>
#define FOR(i,m,n) for(int i=(int)m;i<(int)n;i++)
#define RFOR(i,m,n) for(int i=(int)m;i>=(int)n;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,n,0)
#define all(a) a.begin(),a.end()
#define IN(a,n) rep(i,n){ cin>>a[i]; }
const int vx[4] = {0,1,0,-1};
const int vy[4] = {1,0,-1,0};
#define PI 3.14159265
#define F first
#define S second
#define PB push_back
#define EB emplace_back
void init(){
  cin.tie(0);
  ios::sync_with_stdio(false);
}



template< typename T >
struct edge {
  int src, to;
  T cost;

  edge(int to, T cost) : src(-1), to(to), cost(cost) {}

  edge(int src, int to, T cost) : src(src), to(to), cost(cost) {}

  edge &operator=(const int &x) {
    to = x;
    return *this;
  }

  operator int() const { return to; }
};

template< typename T >
using Edges = vector< edge< T > >;
template< typename T >
using WG = vector< Edges< T > >;
using UG = vector< vector< int > >;
template< typename T >
using Matrix = vector< vector< T > >;





struct UnionFind
{

  vector<int> par;
  vector<int> sizes;

  UnionFind(int n) : par(n), sizes(n, 1) {
    rep(i,n) par[i] = i;
  }

  int root(int x) {
    if (x == par[x]) return x;
    return par[x] = root(par[x]); 
  }

  bool unite(int x, int y) {

    x = root(x);
    y = root(y);

    if (x == y) return false;

    if (sizes[x] < sizes[y]) swap(x, y);

    par[y] = x;
    sizes[x] += sizes[y];

    return true;
  }

  bool find(int x,int y){
    return root(x)==root(y);
  }

  int size(int x) {
    return sizes[root(x)];
  }
};



int main(){
  init();
  ll n,m;
  cin>>n>>m;
  UnionFind uf(n);
  Edges<int> es;
  rep(i,m){
    int x,y;
    cin>>x>>y;
    es.PB(edge<int>(x-1,y-1,1));
  }
  reverse(all(es));
  vector<ll> ans;
  ll res = n*(n-1)/2;

  rep(i,m){
    ans.PB(res);
    ll a = uf.size(es[i].src);
    ll b = uf.size(es[i].to);
    if(!uf.find(es[i].src,es[i].to)){
      ll ra = a*(a-1)/2;
      ll rb = b*(b-1)/2;
      res+=ra+rb;
      res-=(a+b)*(a+b-1)/2;
    }
    uf.unite(es[i].src,es[i].to);
  }
  reverse(all(ans));
  rep(i,m){
    cout<<ans[i]<<endl;
  }


}


Measured memory_bytes: 5108
#include <bits/stdc++.h>
using namespace std;
int gcd(int a,int b){
  int c;
  while(1){
  c=a%b;
  if(c==0)
    return b;
  a=b;
  b=c;
  }
}
int main() {
  int n,a[111111],i;
  cin>>n;
  for(i=0;i<n;i++)
    cin>>a[i];
  int ans=a[0];
  for(i=1;i<n;i++)
    ans=gcd(a[i],ans);
  cout<<ans<<endl;
}


Measured memory_bytes: 640