akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
int main(void) {
	while(1){
		int n;
		scanf("%d",&n);
		if(n==0) break;	
		int i,a[n];
		for(i=0;i<n;i++){
			scanf("%d",&a[i]);
		}
		int p=0,b=0,c=0,d=0,e=0,f=0,g=0;
		for(i=0;i<n;i++){
			if(a[i]<10){
				p++;
			}
			else if(a[i]>=10&&a[i]<20){
				b++;
			}
			else if(a[i]>=20&&a[i]<30){
				c++;
			}
			else if(a[i]>=30&&a[i]<40){
				d++;
			}
			else if(a[i]>=40&&a[i]<50){
				e++;
			}
			else if(a[i]>=50&&a[i]<60){
				f++;
			}
			else{
				g++;
			}
		}
		printf("%d\n",p);
		printf("%d\n",b);
		printf("%d\n",c);
		printf("%d\n",d);
		printf("%d\n",e);
		printf("%d\n",f);
		printf("%d\n",g);
	}
	return 0;
}


Measured memory_bytes: 5628
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin >> N;
  pair<string, int> P;
  queue<pair<string,int>> Q;
  vector<char> vec = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k'};
  string S = "a";
  P = make_pair(S,0);
  Q.push(P);
  vector<string> ans(0);
  while(Q.size()){
    P = Q.front();
    Q.pop();
    string T = P.first;
    if(T.size() == N){
      ans.push_back(T);
      continue;
    }
    else{
      for(int i=0; i<=P.second+1; i++){
        string U = T;
        U += vec.at(i);
        pair<string,int> p;
        p = make_pair(U,max(i,P.second));
        Q.push(p);
      }
    }
  }
  
  sort(ans.begin(),ans.end());
  
  for(int i=0; i<ans.size(); i++){
    cout << ans.at(i) << endl;
  }
}

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

int main() {
    int N,X,Y;
    cin >> N >> X >> Y;
    Graph G(N);
    vector<ll> r(N-1,0);

    rep(i,N-1) {
        G.at(i).push_back(i+1);
        G.at(i+1).push_back(i);
    }
    G.at(X-1).push_back(Y-1);
    G.at(Y-1).push_back(X-1);

    rep(i,N) {
        int t = 0;
        vector<int> d(N,-1);
        queue<int> q;
        q.push(i);
        d.at(i) = 0;

        while(!q.empty()) {
            int x = q.front();
            q.pop();

            for(int nx : G.at(x)) {
                if(d.at(nx) != -1)
                    continue;

                d.at(nx) = d.at(x)+1;
                q.push(nx);
            }
        }

        rep(j,N-i) {
            if(d.at(j+i) != 0)
                ++r.at(d.at(j+i)-1);
        }
    }

    rep(i,N-1)
        cout << r.at(i) << endl;
}

Measured memory_bytes: 384
#include <stdio.h>

int main(){
  int y,i,j,k,x,a,b,c,z=0,g=0;

  scanf("%d",&a);
  scanf("%d",&b);
  scanf("%d",&c);
  scanf("%d",&x);

  for(i=0;i<=a;i++){
    z=500*i;
    y=z;
    for(j=0;j<=b;j++){
      z+=100*j;
      if(z==x){
        g++;
        break;
      }else{
        for(k=1;k<=c;k++){
          z+=50;
          if(z==x){
            g++;
            break;
          }
        }
      }
      z=y;
    }
  }
  printf("%d",g);
  return 0;
}


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

int main() {
  int n,l;
  cin >> n >> l;
  vector<string> s(n);
  for (int i=0; i<n; i++) cin >> s.at(i);
  sort (s.begin(),s.end());
  for (int i=0; i<n; i++) cout << s.at(i);
  cout << endl;
}

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

class humman
{
public:
	double id, h, w;
	humman(int n, int high, int weight)
	{
		id = n;
		h = high / 100.0;
		w = weight;
	}
	double bmi()
	{
		return w / (h * h);
	}
};

int main()
{
	int n;
	while (true)
	{
		cin >> n;
		if (n == 0) break;
		humman nearest(-1, 1, 0xFFFFFF);
		for (int i = 0; i < n; i++)
		{
			int id, w, h;
			cin >> id >> w >> h;
			humman a(id, w, h);
			if (abs(22.0 - a.bmi()) < abs(22.0 - nearest.bmi()))
			{
				nearest = a;
			}
		}
		cout << nearest.id << endl;
	}
	return 0;
}

Measured memory_bytes: 0
using System;
using System.Linq;
using System.Collections.Generic;
public class rectangle
{
    public static void Main()
    {
        string[] strs = Console.ReadLine().Split(' ');
        int[] num = new int[strs.Length];
        for (int i = 0; i < strs.Length; i++)
        {
            num[i] = int.Parse(strs[i]);
        }
        System.Console.Write((num[0] * num[1]) + " ");
        System.Console.WriteLine((num[0] + num[1]) * 2);
    }
}

Measured memory_bytes: 5600
N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

a, b = [0],[0]
for i in range(N):
    a.append(a[i]+A[i])
for i in range(M):
    b.append(b[i]+B[i])

ans, j = 0, M
for i in range(N+1):
    if a[i] > K:
        break
    while b[j] > K - a[i]:
        j -= 1
    ans = max(ans, i+j)
print(ans)

Measured memory_bytes: 47520
use std::io;
use std::cmp;
use std::collections::BinaryHeap;
use std::collections::HashMap;
use std::collections::HashSet;

fn read_line() -> String {
    let mut buf = String::new();
    io::stdin().read_line(&mut buf).ok();
    buf
}

fn func(G: &mut Vec<Vec<(usize, i64)>>, memo: &mut Vec<i64>, s: usize) {
    let mut queue = BinaryHeap::new();

    queue.push((0, s));
    while !queue.is_empty() {
        let (current, v) = queue.pop().unwrap();
        if memo[v] >= 0 {
            continue;
        }
        memo[v] = -current;
        for i in 0..G[v].len() {
            let (u, cost) = G[v][i];
            queue.push((current - cost, u));
        }
    }
}


fn main() {
    let line: Vec<usize> = read_line().split_whitespace().map(|s| s.parse().unwrap()).collect();
    let n = line[0];
    let m = line[1];
    let s = line[2] - 1;
    let t = line[3] - 1;

    let mut G = vec![Vec::new(); n];
    let mut H = vec![Vec::new(); n];
    for i in 0..m {
        let line: Vec<i64> = read_line().split_whitespace().map(|s| s.parse().unwrap()).collect();
        let u = line[0] as usize - 1;
        let v = line[1] as usize - 1;
        let a = line[2];
        let b = line[3];

        G[u].push((v, a));
        G[v].push((u, a));
        H[u].push((v, b));
        H[v].push((u, b));
    }

    let mut memo = vec![-1i64; n];
    let mut memo2 = vec![-1i64; n];
    func(&mut G, &mut memo, s);
    func(&mut H, &mut memo2, t);

    let mut ans = Vec::with_capacity(n);
    for i in 0..n {
        ans.push((1_000_000_000_000_000 - memo[i] - memo2[i], i));
    }
    ans.sort_by(|a, b| b.0.cmp(&a.0));
    let mut pos = 0;
    for i in 0..n {
        while ans[pos].1 < i && pos < n {
            pos+=1;
        }
        println!("{}", ans[pos].0);
    }
}


Measured memory_bytes: 32508
import bisect
import copy
import heapq
import math
import sys
from collections import *
from itertools import accumulate, combinations, permutations, product
from math import gcd
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]

x=int(input())
tmp=100
ans=0
while tmp<x:
    ans+=1
    tmp=math.floor(tmp*1.01)
    # print(tmp)
print(ans)

Measured memory_bytes: 70036
/**
 *  author: mahfuzz
 *  created: 27.06.2020
**/
 
#include <bits/stdc++.h>
using namespace std;
#define all(a) (a).begin(), (a).end()
#define trace(x) cout << #x << ':' << x << "\n"
typedef long long ll;

int main(int argc, char* argv[]){
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    
    string s, t;
    cin >> s >> t;
    
    int cnt = 0;
    for(int i = 0; s[i]; i++){
        if(s[i] != t[i])
            ++cnt;
    }
    
    cout << cnt << "\n";
        
    return 0;
}



Measured memory_bytes: 3768
// E - Yutori

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int INF = 2147483647;
// const ll INF = 9223372036854775807;
// const ll MOD = 1e9 + 7;

int plan1[200000]; // なるべく早い日に働く計画
int plan2[200000]; // なるべく遅い日に働く計画

int main() {
	int N, K, C;
	cin >> N >> K >> C;

	string sch;
	cin >> sch;

	int cnt;

	// なるべく早い日に働く
	cnt = 1;
	for (int i=0; i<N; i++) {
		if (sch[i] == 'x') continue;

		plan1[i] = cnt;
		i += C;
		cnt++;
		if (cnt > K) break;
	}

	// なるべく遅い日に働く
	cnt = K;
	for (int i=N-1; i>=0; i--) {
		if (sch[i] == 'x') continue;

		plan2[i] = cnt;
		i -= C;
		cnt--;
		if (cnt == 0) break;
	}

	for (int i=0; i<N; i++) {
		if (plan1[i] > 0 && plan1[i] == plan2[i]) {
			cout << i+1 << endl;
		}
	}

	return 0;
}

Measured memory_bytes: 3332
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#include <complex>
#include <stdio.h>
#include <time.h>
#include <numeric>
#include <random>
#include <unordered_map>
#include <unordered_set>
#define all(a) a.begin(),a.end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define pb push_back
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll, ll> P;
typedef complex<ld> com;
constexpr int inf = 1000000010;
constexpr ll INF = 1000000000000000010;
constexpr ld eps = 1e-12;
constexpr ld pi = 3.141592653589793238;
template<class T, class U> inline bool chmax(T &a, const U &b) { if (a < b) { a = b; return true; } return false; }
template<class T, class U> inline bool chmin(T &a, const U &b) { if (a > b) { a = b; return true; } return false; }

vector<vector<int>> graph(100010, vector<int>());

void dfs(int n, int p, int d, vector<int> &dis) {
	dis[n] = d;
	for (int i : graph[n]) {
		if (i == p) continue;
		dfs(i, n, d + 1, dis);
	}
}

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(20);

	int n;
	cin >> n;
	rep(_, n - 1) {
		int u, v;
		cin >> u >> v;
		u--; v--;
		graph[u].pb(v);
		graph[v].pb(u);
	}
	vector<int> a(n), b(n);
	dfs(0, -1, 0, a); dfs(n - 1, -1, 0, b);
	int ax = 0, bx = 0;
	rep(i, n) {
		if (a[i] <= b[i]) ax++;
		else bx++;
	}
	cout << (ax > bx ? "Fennec" : "Snuke") << '\n';
}

Measured memory_bytes: 9600
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
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 main(){
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    map<int,int> mp;
    ll ans = 0;
    rep(i,n) {
        int a;
        cin >> a;
        if(mp.count(a) == 0) mp[a] = 1;
        else mp[a]++;
        ans += a;
    }
    int q;
    cin >> q;
    rep(i,q) {
        int b,c;
        cin >> b >> c;
        int cnt;
        if(mp.count(b) != 0) cnt =mp[b];
        else cnt = 0;
        mp[b] = 0;
        if(mp.count(c) == 0) mp[c] = cnt;
        else mp[c] += cnt;
        ans += cnt*(c-b);
        cout << ans << endl;
    }
}


Measured memory_bytes: 8080
#include <iostream>
#include <algorithm>
#include <string> 
#include <vector>
#include <iomanip>
#include <math.h>
#include <map>
using namespace std;

int main()
{
	string s1, s2;
	cin >> s1 >> s2;
	if (s1[0] == s2[2] && s1[1] == s2[1] && s1[2] == s2[0]) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}
}

Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<string>
#include<cstring>
#include<cstdio>
typedef long long LL;
using namespace std;
LL a[200005];
int main()
{
	ios::sync_with_stdio(false);
	LL T,cnt = 1;
	int flag = 0;
	cin >> T;
	for (int i = 0;i < T;i++)
	{
		cin >> a[i];
		if (a[i] == 0)
			flag = 2;
	}
	
	if (flag == 2)
	{
		cout << 0 << endl;
		return 0;
	}
	LL sum=1000000000000000000;
	for (int i = 0;i < T-1;i++)
	{
		if(sum/a[i]<a[i+1]){
			flag=1;
			break;
		}
		cnt*=a[i];
		sum/=a[i];
	}
	if (flag == 1)
		cout << -1 << endl;
	else
		cout << cnt*a[T-1] << endl;
	return 0;
}

Measured memory_bytes: 3936
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef std::vector<ll> lls;
constexpr ll INF = 1LL << 60;
constexpr ll MOD = 10 * 10 * 10 * 10 * 10 * 10 * 10 * 10 * 10 + 7;// 998244353L;
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; }
template<class T> inline T MaxE(vector<T>&v,ll S,ll E){T m=v[S];for(ll i=S;i<=E;i++)chmax(m,v[i]);return m;}//v[S]～v[E]の最大値
template<class T> inline T MinE(vector<T>&v,ll S,ll E){T m=v[S];for(ll i=S;i<=E;i++)chmin(m,v[i]);return m;}
template<class T> inline T MaxE(vector<T>&v,ll N) { return MaxE(v, 0, N - 1); } //先頭N個中の最大値
template<class T> inline T MinE(vector<T>&v,ll N) { return MinE(v, 0, N - 1); }
template<class T> inline T MaxE(vector<T>&v) { T m = v[0]; for (T e : v)chmax(m, e); return m; }
template<class T> inline T MinE(vector<T>&v) { T m = v[0]; for (T e : v)chmin(m, e); return m; }
template<class T> inline ll MaxI(vector<T>&v,ll S,ll E){ll m=S;for(ll i=S;i<=E;i++){if(v[i]>v[m])m=i;}return m;}
template<class T> inline ll MinI(vector<T>&v,ll S,ll E){ll m=S;for(ll i=S;i<=E;i++){if(v[i]<v[m])m=i;}return m;}
template<class T> inline ll MaxI(vector<T>&v,ll N) { return MaxI(v, 0, N - 1); }
template<class T> inline ll MinI(vector<T>&v,ll N) { return MinI(v, 0, N - 1); }
template<class T> inline ll MaxI(vector<T>& v) { return MaxI(v, (ll)v.size() ); }
template<class T> inline ll MinI(vector<T>& v) { return MinI(v, (ll)v.size() ); }


void cinv(lls& llVec, ll n, bool to_0_origin = false) {
	ll val;
	llVec.reserve((size_t)(n));
	for (ll i = 0; i < n; i++) {
		cin >> val;
		if (to_0_origin) val--;
		llVec.push_back(val);
	}
}


int main()
{
	ll H, W;
	cin >> H >> W;
	std::vector<std::string> a(H+1);
	for (ll i = 0; i < H; i++) {
		cin >> a[i];
		a[i] += '#';
	}
	a[H] = std::string(W + 1, '#');

	std::vector<lls> tbl(H + 1, lls(W + 1, 0));

	tbl[0][0] = 1;

	//配るDP
	for (ll i = 0; i < H; i++) {
		for (ll j = 0; j < W; j++) {
			if (a[i][j] == '#') continue;

			if (a[i][j + 1] == '.') {
				tbl[i][j + 1] += tbl[i][j];
				tbl[i][j + 1] %= MOD;
			}
			if (a[i + 1][j] == '.') {
				tbl[i + 1][j] += tbl[i][j];
				tbl[i + 1][j] %= MOD;
			}

		}
	}

	cout << tbl[H-1][W-1] << '\n';

	return 0;
}


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

#define li long long int
#define rep(i, to) for (li i = 0; i < ((li)(to)); i++)
#define MOD 1000000007
typedef pair<li, li> PI;

li n;
li l[11];

int main(void)
{
	cin >> n;
	li sum = 0;
	rep(i, n) {
		cin >> l[i];
		sum += l[i];
	}
	sort(l, l + n);
	cout << (l[n - 1] < sum - l[n - 1] ? "Yes" : "No") << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using u64 = unsigned long long;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

int main() {
    int n, k;
    cin >> n >> k;
    vector<int> v(n);
    for (auto &&i : v) scanf("%d", &i);
    sort(v.begin(),v.end());
    ll ans = 0;
    for (int i = 0; i < n-k; ++i) {
        ans += v[i];
    }
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 1024
n,m=map(int,input().split())
if abs(n-m)>=2:
    print(0)
else:
    tmpd=n
    tmpm=m
    dog=1
    while tmpd>0:
        dog=(dog*tmpd)%(10**9+7)
        tmpd-=1
    monkey=1
    while tmpm>0:
        monkey=(monkey*tmpm)%(10**9+7)
        tmpm-=1
    if abs(n-m)==1:
        print((dog*monkey)%(10**9+7))
    else:
        print((2*dog*monkey)%(10**9+7))


Measured memory_bytes: 3064
#include <stdio.h>

int main() {
  int n, i;
  char str[6];
  int temp;
  int a[3];
  int sum;
  while(1) {
    scanf("%d", &n);
    if(n == 0) break;
    a[0] = 2;
    a[1] = 1;
    a[2] = 3;
    sum = 1;
    getchar();
    for(i = 0; i < n; i++) {
      scanf("%s", str);
      switch((int)str[0]) {
      case (int)'N':
	temp = a[1];
	a[1] = a[0];
	a[0] = 7 - temp;
	break;
      case (int)'E':
	temp = a[2];
	a[2] = a[1];
	a[1] = 7 - temp;
	break;
      case (int)'S':
	temp = a[0];
	a[0] = a[1];
	a[1] = 7 - temp;
	break;
      case (int)'W':
	temp = a[1];
	a[1] = a[2];
	a[2] = 7 - temp;
	break;
      case (int)'R':
	temp = a[0];
	a[0] = a[2];
	a[2] = 7 - temp;
	break;
      case (int)'L':
	temp = a[2];
	a[2] = a[0];
	a[0] = 7 - temp;
	break;
      }
      sum += a[1];

    }
    printf("%d\n", sum);
  }
  return 0;
}

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

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

  size_t s_size = s.length();
  size_t t_size = t.length();
      
  if ((1 <= s_size && s_size <= 10) && (t_size = s_size + 1)) {
    for (i=0;i<s_size;i++) {
      if (s[i] == t[i]) {
        continue;
      }
      else {
        break;
      }
    }
    if (i==s_size) {
      cout << "Yes" << endl;
    }
    else {
      cout << "No" << endl;
    }
  }
  else {
    cout << "No" << endl;
  }
}


Measured memory_bytes: 3624
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop
from itertools import permutations, accumulate
from math import sqrt, ceil, floor
from bisect import bisect_left, bisect_right
from copy import deepcopy
from operator import itemgetter
from fractions import gcd
import sys
def I(): return int(input())  # '123' -> 123
def Is(): return map(int, input().split())  # '123 456' -> 123, 456
def LI(): return list(map(int, input().split()))  # '123 456' -> [123, 456]
def TI(): return tuple(map(int, input().split()))  # '123 456' -> (123, 456)
def IR(n): return [I() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def TIR(n): return [TI() for _ in range(n)]
def S(): return input()
def Ss(): return input().split()  # 'aa bb' -> 'aa','bb' or ['aa','bb']
def LS(): return list(input())  # 'abc123' -> ['a','b','c','1','2','3']
def SR(n): return [S() for _ in range(n)]
def SsR(n): return [Ss() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
sys.setrecursionlimit(1000000)
MOD = 1000000007
INF = float('inf')

n, m = Is()
A = LI()

if n - sum(A) < 0:
    print("-1")
else:
    print(n - sum(A))

Measured memory_bytes: 72892
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
#define IO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)

const int N = 1e5;
int n, m, dp[N + 4];
set<int> bad;
const int MOD = 1e9 + 7;

int solve(int step)
{
    if(bad.count(step) || step > n)
        return 0;
    if(step == n)
        return 1;
    if(dp[step] != -1)
        return dp[step];
    int ans = 0;
    ans = solve(step + 1) % MOD;
    ans += solve(step + 2) % MOD;
    return dp[step] = ans % MOD;
}

int main()
{
    IO;
    cin >> n >> m;
    for(int i = 0; i < m; i++)
    {
        int x;
        cin >> x;
        bad.insert(x);
    }
    memset(dp, -1, sizeof dp);
    cout << solve(0) % MOD;
    return 0;
}


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

using ll = long long;
#define REP(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
string char_to_string(char val) {
  return string(1, val);
}
int char_to_int(char val) {
  return val - '0';
}

int main() {
  int N, M; cin >> N >> M;
  vector<int> k(M);
  vector<vector<int>> s(M);
  REP(i, M) {
      cin >> k[i];
      int S = 0;
      REP(m, k[i]) {
          cin >> S;
          s[i].push_back(S);
      }
  }
  vector<int> p(M);
  REP(i, M) {
      cin >> p[i];
  }

  int ans = 0;
  for(int bit = 0; bit < (1 << N); ++bit) {
      // 全電球の状態を確認する
      REP(i, M) {
          int cnt = 0; // 各電球に対する、押されているスイッチの個数
          REP(m, k[i]) {
              if(bit & (1 << (s[i][m] - 1))) cnt++;
          }
          if(cnt % 2 != p[i]) break;
          if(i == M - 1) ans++;
      }
      // cout << bitset<8>(bit) << " " << ans << endl;
  }

  cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String []args){
		//????????£?????????????????????
		Scanner sc = new Scanner(System.in);
		//??°?????????
		while(true){
			//??????????????????
			int H = sc.nextInt();
			//?¨????????????????
			int W = sc.nextInt();
			//?????¶??? ????????¨???0?????´?????????
			if(H == 0 && W ==0){
				break;
			}
			//?¨?????????°?????????
			for(int i = 0; i < H; i++){
			//???????????°?????????
				for(int j = 0; j < W; j++){
					System.out.print("#");
				}
				System.out.println("");
			}
			System.out.println();
		}
	}
}

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

int main(){
    int h,n,a;
    cin>>h>>n;
    for(int i=0;i<n;i++){
        cin>>a;
        h-=a;
        if(h<=0){
            cout<<"Yes"<<endl;
            return 0;
        }
    }
    cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 384
// Believe in yourself
#include<bits/stdc++.h>
 
using namespace std;
 
typedef unsigned long long int ull;
typedef long long int ll;
typedef long double ld;
 
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define Pair vector<pair<ll,ll>>
#define vec vector <ll> 
#define all(a) a.begin(),a.end()
#define mo 1000000007
#define decimal(i,n) fixed << setprecision(i) << n
#define show(a) for(auto xyz:a)cout<<xyz<<" ";cout<<endl;
#define show_nl(a) for(auto xyz:a)cout<<xyz<<endl;
 
 
void eea(ll a,ll b,ll &x,ll &y)
{
    if (a == 1)
    {
        x = 1; y = 0;
        return;
    }
    ll x1, y1;
    eea(b%a,a,x1,y1);
    x=y1-(b/a)*x1;
    y=x1;
}
ll mi(ll a,ll m)
{
    ll x,y;
    eea(a,m,x,y);
    x= (x%m+m)%m;
    return x;
}
 
/*
Enter the test case
 
 
Some helpful points
1.) Calm yourself
2.) check for semicolon or data type mismatch
*/
 
ll binarysearch(ll *a,ll n,ll k,ll r)
{
    ll l=1,mid;
    ll p=k;
    while(l<r)
    {   
        ll x=0;
        k=p;
        mid=(l+r)/2;
        for(ll i=n-1;i>=0;i--)
        {   
            ll c=((*(a+i))+mid-1)/mid;
            
            if(c==1)
            break;
            k=k-c+1;
            if(k<0)
            {
                x=1;
                break;
            }    
        }
        if(x==1)
        l=mid+1;
        else
        r=mid;
    }
    return l;
}
 
 
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);    
    ll t=1;
    // cin>>t;
    while(t--)
    {
      int b,n;
      cin>>b>>n;
      int s=0,a[n];
      for(int i=0;i<n;i++)
      {
		cin>>a[i];
        s=s+a[i];
      }
      if(s>=b)
        cout<<"Yes\n";
      else
        cout<<"No\n";
    }
}

Measured memory_bytes: 3912
#include <stdio.h>

int main(){
    int s, n[6], k=0;
    scanf("%d", &s);
    for(int i=0; i<6; i++){
        n[i] = s%10;
        s /= 10;
        k += n[i];
    }
    printf("%d", k);
    return 0;
}

Measured memory_bytes: 128
#pragma region _head

#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include<map>
#include<set>
#include<iomanip>
#include<queue>
#include<stack>
#include<numeric>
#include<utility>
#include<regex>

void Init() {
	std::cin.tie(0); std::ios::sync_with_stdio(false);
	struct Init_caller { Init_caller() { Init(); } }caller;
}

#pragma region _define

#define int LL
#define f(i,a,b) for(LL i=a;i<b;i++)
#define f_vI(v,n) f(i,0,n)cin>>v[i]
#define f_v2I(v1,v2,n) f(i,0,n)cin>>v1[i]>>v2[i]
#define f_v3I(v1,v2,v3,n) f(i,0,n)cin>>v1[i]>>v2[i]>>v3[i]
#define f_vO(v,n) f(i,0,n)cout<<v[i]<<endl
#define ei else if
#define all(a) a.begin(),a.end()
#define size(s) ((LL)s.size())
#define F first
#define S second
#define check() cout<<"! ! !"
#define endl "\n"
#define _y() cout<<"Yes"<<endl
#define _Y() cout<<"YES"<<endl
#define _n() cout<<"No"<<endl
#define _N() cout<<"NO"<<endl
#define int_INF 1<<29
#define ll_INF 1LL<<60
#define MOD 1000000007

#pragma endregion

#pragma region _using

using namespace std;

using LL = long long;
using st = string;
using vi = vector<LL>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vd = vector<double>;
using vvd = vector<vd>;
using vvvd = vector<vvd>;
using vc = vector<char>;
using vvc = vector<vc>;
using vs = vector<st>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvvb = vector<vvb>;
using qi = queue<LL>;
using qc = queue<char>;
using qs = queue<st>;
using si = stack<LL>;
using sc = stack<char>;
using ss = stack<st>;
using pi = pair<LL, LL>;
using ppi = pair<pi, LL>;
using mll = map<LL, LL>;
using mcl = map<char, LL>;
using vpi = vector<pi>;
using vppi = vector<ppi>;

#pragma endregion

struct edge {
	int from, to, cost;
};

void y_n(bool p) {
	p ? _y() : _n();
}

void Y_N(bool p) {
	p ? _Y() : _N();
}

LL gcd(LL a, LL b) {
	LL r;
	while ((r = a % b) != 0) {
		a = b;
		b = r;
	}
	return b;
}
LL lcm(LL a, LL b) {
	return (a / gcd(a, b) * b);
}

//素数判定
bool is_prime(int n) {
	for (int i = 2; i*i <= n; i++) {
		if (n % i == 0) {
			return false;
		}
	}
	return true;
}

//階乗計算
LL factorial(LL n) {
	LL a = 1, ret = 1;
	while (a < n) {
		a++;
		ret *= a;
		ret %= MOD;
	}
	return ret;
}


#pragma endregion 


/*****************************************************************************/
signed main(void) {
	int n, m;
	cin >> n >> m;
	vpi p(n);
	f(i, 0, n) {
		cin >> p[i].first >> p[i].second;
	}
	sort(all(p));
	int ans = 0;
	int i = 0;
	while (true) {
		ans += p[i].F*p[i].S;
		m -= p[i].second;
		if (m <= 0) {
			ans -= p[i].first*(-m);
			break;;
		}
		i++;
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
// -----------------<fast IO>------------------
#define IOS             ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define FLSH             fflush(stdout)
#define fileIO(name) \
    freopen(name".in", "r", stdin); \
    freopen(name".out", "w", stdout);
#define PRECISION(x)     cout << fixed << setprecision(x);
#define endl             "\n"
// -----------------<Container manipulation / traversal macros>------------------
#define mp                 make_pair
#define pb                 push_back
#define ff                 first
#define ss                 second
#define sz(x)             ((int)((x).size()))
#define all(x)             (x).begin(),(x).end()
#define rep(i,n)         for(ll (i)=0;(i)<(n);(i)++)
#define forn(i,a,b)     for(ll (i)=(a);(i)<=(b);(i)++)
#define fill(l,a)        memset((l) , (a) , sizeof(l))
// -----------------<Some common useful functions>------------------
#define maX(a,b)        ( (a) > (b) ? (a) : (b))
#define miN(a,b)        ( (a) < (b) ? (a) : (b))
#define checkbit(n,b)   ( (n >> b) & 1)
#define INDEX(arr,i)      ( lower_bound(all(arr),i)-arr.begin())
#define in(b,a)         ( (b).find(a) != (b).end())
// -----------------<TypeDef Start>------------------
typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> pii;
typedef vector<ll> vi;
typedef vector< std::vector<ll> > matrix;
typedef map<ll,ll> mii;
typedef vector<pii> vpii;
// -----------------<Constants>------------------
const int MAXN = 1000005;
const int SQRTN = 1003;
const int LOGN = 22;
const double PI=acos(-1);

const int INF=1e9;

int MOD = 1000000007;
const int FMOD = 998244353;
const double eps = 1e-9;
ll gcd(ll a,ll b)
{
    if(a==0)
    return(b);
    return(gcd(b%a,a));
}
ll lcm(ll a,ll b)
{
    return(a/gcd(a,b)*b);
}
/*ll power(ll a,ll b,ll p)
{
    ll res=1;
    a%=p;
    while(b>0)
    {
        if(b&1)
        res=res*a%p;
        a=a*a%p;
        b>>=1;
    }
    return(res);
}
ll modInverse(ll a, ll m)
{
    ll g = gcd(a, m);
    return(power(a,m-2,m));
}*/
/*ll b_search(ll arr[],ll n,ll s)
{
    ll l=0,r=n-1;
    while(l<=r)
    {
        ll mid=l+(r-l)/2;
        if(arr[mid]==s)
        return(mid);
        if(arr[mid]<s)
        l=mid+1;
        else
        r=mid-1;
    }
    return(-1);
}*/
bool isprime(ll x)
{
    if(x==1)
        return(false);
    for(ll i=2;i*i<=x;i++)
    {
        if(x%i==0)
            return(false);
    }
    return(true);
}
//vector<ll> v[100005];
void solve()
{
    ll k;
    cin>>k;
    string s;
    cin>>s;
    ll c=s.length();
    for(ll i=0;i<min(k,c);i++)
        cout<<s[i];
    if(c>k)
        cout<<"...";
}

int main()
{
    IOS
    ll t=1;
    //cin>>t;
    while(t--)
    {
        solve();
    }
    return(0);
}


Measured memory_bytes: 3660
// A - Table Tennis Training
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main(){
	ll N,A,B; cin>>N>>A>>B;
	ll ans, d = B - A;
	if(d%2) ans = min(A, N-B+1) + (d-1)/2;
	else ans = d/2;
	cout<< ans <<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <complex>
#include <assert.h>
using namespace std;

typedef pair<double, double> Pdd;

const double EPS = 1e-8;
const double INF = 1e12;
typedef complex<double> P;
namespace std {
  bool operator < (const P& a, const P& b) {
    return real(a) != real(b) ? real(a) < real(b) : imag(a) < imag(b);
  }
}
double cross(const P& a, const P& b) {
  return imag(conj(a)*b);
}
double dot(const P& a, const P& b) {
  return real(conj(a)*b);
}

struct L : public vector<P> {
  L(const P &a, const P &b) {
    push_back(a); push_back(b);
  }
};

typedef L Segment;

int ccw(P a, P b, P c) {
  b -= a; c -= a;
  if (cross(b, c) > 0)   return +1;       // counter clockwise
  if (cross(b, c) < 0)   return -1;       // clockwise
  if (dot(b, c) < 0)     return +2;       // c--a--b on line
  if (norm(b) < norm(c)) return -2;       // a--b--c on line
  return 0;
}

bool intersectSS(const Segment &s, const Segment &t) {
  return ccw(s[0],s[1],t[0])*ccw(s[0],s[1],t[1]) <= 0 &&
         ccw(t[0],t[1],s[0])*ccw(t[0],t[1],s[1]) <= 0;
}

P crosspoint(const L &l, const L &m) {
  double A = cross(l[1] - l[0], m[1] - m[0]);
  double B = cross(l[1] - l[0], l[1] - m[0]);
  if (abs(A) < EPS && abs(B) < EPS) return m[0]; // same line
  if (abs(A) < EPS) assert(false); // !!!PRECONDITION NOT SATISFIED!!!
  return m[0] + B / A * (m[1] - m[0]);
}

int main() {
  
  int Tc; cin >> Tc;
  while(Tc--) {
    vector<pair<Pdd, int> > vec;
    double xa, ya, xb, yb;
    cin >> xa >> ya >> xb >> yb;
    Segment express(P(xa, ya), P(xb, yb));
    int N; cin >> N;
    int O, I;
    for(int i=0; i<N; i++) {
      cin >> xa >> ya >> xb >> yb >> O >> I;
      Segment line(P(xa, ya), P(xb, yb));
      if(intersectSS(express, line)) {
        P crs = crosspoint(express, line);
        vec.push_back(make_pair(Pdd(crs.real(), crs.imag()), (O+I)%2));
      }
    }
    
    sort(vec.begin(), vec.end());
    
    int ans = 1<<29;
    for(int s=0; s<2; s++) {
      int cnt = 0, now = s;
      for(int i=0; i<vec.size(); i++) {
        if(now == vec[i].second) {
          cnt ++; now = 1-now;
        }
      }
      ans = min(ans, cnt);
    }
    cout << ans << endl;
  }
  
  return 0;
}

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

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

using namespace std;

int main()
{
  string a;
  cin >> a;
  if (a == "A") {
    cout << "T" << endl;
    return 0;
  }
  if (a == "T")
  {
    cout << "A" << endl;
    return 0;
  }
  if (a == "C")
  {
    cout << "G" << endl;
    return 0;
  }
  if (a == "G")
  {
    cout << "C" << endl;
    return 0;
  }
}


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

using namespace std;

#define pb push_back
#define fs first
#define sc second
#define sz size
#define forn(i, n) for (ll i = 0; i < (ll) (n); ++i)
#define forni(i, n) for (ll i = 2; i <= (ll) (n); ++i)
#define IO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)

using ll = long long;
const ll inf = 1e9+7; 

const double PI =  3.141592653589793;

int main(){
	IO;
	ll n;
	cin>>n;
	(n>999)?cout<<"ABD\n":cout<<"ABC\n";
	return 0;
}

// _   .-')                .-. .-')                 .-')                                               
//( '.( OO )_              \  ( OO )               ( OO ).                                             
// ,--.   ,--.).-'),-----. ,--. ,--.  .-'),-----. (_)---\_) ,--. ,--.     .-----.  ,-.-')  .-'),-----. 
// |   `.'   |( OO'  .-.  '|  .'   / ( OO'  .-.  '/    _ |  |  | |  |    '  .--./  |  |OO)( OO'  .-.  '
// |         |/   |  | |  ||      /, /   |  | |  |\  :` `.  |  | | .-')  |  |('-.  |  |  \/   |  | |  |
// |  |'.'|  |\_) |  |\|  ||     ' _)\_) |  |\|  | '..`''.) |  |_|( OO )/_) |OO  ) |  |(_/\_) |  |\|  |
// |  |   |  |  \ |  | |  ||  .   \    \ |  | |  |.-._)   \ |  | | `-' /||  |`-'| ,|  |_.'  \ |  | |  |
// |  |   |  |   `'  '-'  '|  |\   \    `'  '-'  '\       /('  '-'(_.-'(_'  '--'\(_|  |      `'  '-'  '
// """    """     """""""" """  """"      """""""  """""""  """"""""      """"""   """         """""""

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <functional>
#include <map>
#include <set>

using namespace std;

typedef long long i64;
typedef i64 int_t;
typedef vector<int_t> vi;
typedef vector<vi> vvi;

typedef pair<int_t, int_t> pi;

#define tr(c, i) for(auto i = (c).begin(); i != (c).end(); i++)
#define pb push_back
#define sz(a) int((a).size())
#define all(c) (c).begin(), (c).end()
#define REP(s, e, i) for(i=(s); i < (e); ++i)

int main(int argc, char *argv[]) {

  i64 N, i;
  cin >> N;
  i64 cur = 1, ans = 0;
  REP(0, N, i) {
    i64 a;
    cin >> a;
    if(a == cur) {
      ++cur;
    }
    else {
      ++ans;
    }
  }
  cout << (ans == N ?  -1 : ans) << endl;

  return 0;
}


Measured memory_bytes: 256
def main():
    n = int(input())
    money = sorted([6 ** i for i in range(7)] + [9 ** i for i in range(1, 6)], reverse=True)
    dp = [0] * (n + 1)
    for i in range(1, n + 1):
        dp[i] = min(dp[i - j] + 1 for j in money if i - j >= 0)
    print(dp[n])

if __name__ == '__main__':
    main()

Measured memory_bytes: 3828
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int a = sc.nextInt();
        int b = sc.nextInt();
        int[] p = new int[n];
        for (int i = 0 ; i < n ; i++) {
            p[i] = sc.nextInt();
        }
        int s1 = 0;
        int s2 = 0;
        int s3 = 0;
        for (int i = 0 ; i < n ; i++) {
            if (p[i] <= a) {
                s1++;
            } else if (p[i] > a && p[i] <= b) {
                s2++;
            } else {
                s3++;
            }
        }
        System.out.println(Math.min(s1, Math.min(s2, s3)));
    }

}


Measured memory_bytes: 21844
n, m = map(int ,input().split())

adj = [[] for _ in range(n)]

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

from collections import deque
q = deque()

dist = [-1] * n
ans = [0] * n

q.append(0)
while len(q) != 0:
    now = q.popleft()
    for to in adj[now]:
        if dist[to] != -1:continue
        dist[to] = dist[now] + 1
        q.append(to)
        ans[to] = now

print("Yes")
for i in range(1, n):
    print(ans[i] + 1)

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

int main() {
	int N;
	cin>>N;
	int ans=0;
	for(int i=1;i<N+1;i++){
		int count=0;
		int x=i;
		while(x!=0){
			x=x/10;
			count++;
		}
		if(count%2==1){
			ans++;
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
/* ****revpro**** */
#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define endl	   '\n'
#define pii         pair<ll,ll>
#define vi          vector<ll>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll)x.size()
#define hell        1000000007
#define rep(i,a,b)  for(ll i=a;i<b;i++)
#define repr(i,a,b) for(ll i=b-1;i>=a;i--)    
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define present(c,x) ((c).find(x) != (c).end())
#define cpresent(c,x) (find(all(c),x) != (c).end())
#define mii	    map<ll,ll>
using namespace std;

#define N  100005
signed main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int TESTS=1;
//	cin>>TESTS;
	while(TESTS--)
	{
		ll h,w;
		cin>>h>>w;
		ll a[h][w],b[h][w];
		rep(i,0,h) rep(j,0,w) cin>>a[i][j];
		rep(i,0,h) rep(j,0,w) cin>>b[i][j],a[i][j]=max(a[i][j],b[i][j])-min(a[i][j],b[i][j]);
		bool ans[h][w][15600];
		rep(i,0,h) rep(j,0,w) rep(k,0,15600) ans[i][j][k]=0;
		ans[0][0][a[0][0]+7800]=1;
		ans[0][0][-a[0][0]+7800]=1;
		rep(i,0,h)
		rep(j,0,w){
			rep(k,0,15600){
				if(ans[i][j][k]==0) continue;
				if(i+1<h){
					if(k+a[i+1][j]<15600)
						ans[i+1][j][k+a[i+1][j]]=1;
				    if(k-a[i+1][j]>=0)
						ans[i+1][j][k-a[i+1][j]]=1;
				}
				if(j+1<w){
					if(k+a[i][j+1]<15600)
						ans[i][j+1][k+a[i][j+1]]=1;
				    if(k-a[i][j+1]>=0)
						ans[i][j+1][k-a[i][j+1]]=1;
				}
			}
		}  
		ll tmp=hell;
		rep(i,0,15600) if(ans[h-1][w-1][i]) tmp=min(tmp,abs(i-7800));
		cout<<tmp;
	}
	return 0;
}

Measured memory_bytes: 97920
#include <stdio.h>
int main()
{
    int n, x;
    do
    {
         scanf("%d %d", &n, &x);
        if (n != 0 || x != 0)
        {
            int count = 0;
            for (int a = 1; a <= n; a++)
            {
                for (int b = 1; b <= n; b++)
                {
                    for (int c = 1; c <= n; c++)
                    {
                        if (a < b && b < c && a + b + c == x)
                        {
                            count=count + 1;
                        }
                    }
                }
            }

            printf("%d\n", count);
        }
    } while (n != 0 || x != 0);
    
    return 0;
}


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

typedef long long ll;
const int MOD = 1e9 + 7;

int main() {
	int n;
	cin >> n;
	vector<ll> A(n);
	ll sum = 0, sum2 = 0;
	for (int i = 0; i < n; ++i) {
		cin >> A[i];
		sum = (sum + A[i]) % MOD;
		sum2 = (sum2 + A[i] * A[i]) % MOD;
	}
	ll res = (sum * sum % MOD + MOD - sum2) % MOD;
	if (res % 2 == 0)
		res /= 2;
	else
		res = (res + MOD) / 2;
	cout << res << '\n';
}


Measured memory_bytes: 4788
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define rep2(i, a, n) for(ll i = a; i < (ll)(n); i++)
#define memi cout << endl
#define kono(n) cout << fixed << setprecision(n)
#define all(c) (c).begin(), (c).end()
#define pb push_back
#define hina cout << ' '
#define in(n) cin >> n
#define in2(n, m) cin >> n >> m
#define in3(n, m, l) cin >> n >> m >> l
#define out(n) cout << n
const ll mei = (ll)1e9 + 7;

int main(){
  ll h, w;
  in2(h, w);
  vector<char> a(w);
  rep(i, h){
    rep(j, w)
      in(a[j]);
    rep(j, 2){
      rep(k, w)
        out(a[k]);
      memi;
    }
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <unordered_map>
using namespace std;
unordered_map <int,int> m;
int n,i,x;
int main(){
 cin>>n;
 for(i=1;i<=n;i++){
    cin>>x;
    m[x]++;
    if(m[x]>1){
        cout<<"NO";
        return 0;
    }
 }
 cout<<"YES";
}


Measured memory_bytes: 8520
#include<iostream>
#include<string>
#include<vector>
#include<queue>
#include<cmath>

using namespace std;
int main(){

	string s;
	cin >> s;

	vector<bool>b(s.size());
	for (int i = 0; i < s.size(); i++)
		if (s[i] == 'A' || s[i] == 'C' || s[i] == 'G' || s[i] == 'T')
			b[i] = true;

	int ans = 0, now = 0;
	for (int i = 0; i < s.size(); i++){
		if (b[i])
			now++;
		else{
			ans = max(ans, now);
			now = 0;
		}
	}
	ans = max(ans, now);

	cout << ans << endl;

	return 0;
}

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

int main() {
  int  N;
  string S;
  cin >> N ;
  
  for(int i=0;i<N;i++){
    cin >> S;
    if (S == "Y"){
      cout << "Four" <<endl;
      break;
    }
    else{
      continue;
    }
  }
  if (S != "Y"){
  cout << "Three" <<endl;
  }
      

}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<cstring>

using namespace std;

typedef pair<int,int> P;
const int MAX = 1001;

int Ans[8][MAX];
vector<P> V;

void make(){
  for(int i = 0; i < V.size(); i++)
    for(int k = 0; k < MAX; k++)
      if(Ans[k])
	for(int j = 0; j <= V[i].second; j++){
	  if(k+V[i].first*j >= MAX)break;
	  Ans[i+1][k+V[i].first*j] += Ans[i][k];
	}
}

void init(){
  memset(Ans,0,sizeof(Ans));
  Ans[0][0] = 1;
  V.clear();
}

int main(){

  int m;
  while(cin >> m && m){
    init();
    for(int i = 0; i < m; i++){
      P p;
      cin >> p.first >> p.second;
      V.push_back(p);
    }

    make();

    int g;
    cin >> g;
    while(g--){
      int n;
      cin >> n;
      cout << Ans[V.size()][n] << endl;
    }

  }
  return 0;
}

Measured memory_bytes: 1232
#include<iostream>
using namespace std;
    
struct Card { char suit, value; };
    
void bubble(struct Card A[], int N) {
  for ( int i = 0; i < N; i++ ) {
    for ( int j = N - 1; j >= i; j--) {
      if ( A[j].value < A[j - 1].value ) {
        Card t = A[j]; A[j] = A[j - 1]; A[j - 1] = t;
      }
    }
  }
}
    
void selection(struct Card A[], int N) {
  for ( int i = 0; i < N; i++ ) {
    int minj = i;
    for ( int j = i; j < N; j++ ) {
      if ( A[j].value < A[minj].value ) minj = j;
    }
    Card t = A[i]; A[i] = A[minj]; A[minj] = t;
  }
}
    
void print(struct Card A[], int N){
  for ( int i = 0; i < N; i++ ){
    if ( i > 0 ) cout << " ";
    cout << A[i].suit << A[i].value;
  }
  cout << endl;
}
    
// バブルソートと選択ソートの結果を比較
bool isStable(struct Card C1[], struct Card C2[], int N) {
  for ( int i = 0; i < N; i++ ){
    if( C1[i].suit != C2[i].suit ) return false;
  }
  return true;
}
    
int main() {
  Card C1[100], C2[100];
  int N;
  char ch;
      
  cin >> N;
  for ( int i = 0; i < N; i++ ){
    cin >> C1[i].suit >> C1[i].value;
  }
    
  for ( int i = 0; i < N; i++ ) C2[i] = C1[i];
    
  bubble(C1, N);
  selection(C2, N);
    
  print(C1, N);
  cout << "Stable" << endl;
  print(C2, N);
  if ( isStable(C1, C2, N) ) {
    cout << "Stable" << endl;
  } else {
    cout << "Not stable" << endl;
  }
    
  return 0;
}


Measured memory_bytes: 3096
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define vi vector<int>
#define vll vector<ll>
#define pll pair<ll,ll>
#define pii pair<int,int>
#define pb  push_back
#define ppb pop_back
#define mp  make_pair
#define SIZE 100005
vector<ll> f;
ll a[SIZE],b[SIZE],c[SIZE];
int main(){	
	// #ifndef ONLINE_JUDGE
	// freopen("input.txt", "r", stdin);
	// freopen("output.txt", "w", stdout);
	// #endif
	ios_base::sync_with_stdio(false); 
	cin.tie(NULL);
	ll X,Y,A,B,C;
	cin>>X>>Y>>A>>B>>C;
	// cout<<A+B+C<<endl;
	for(ll i=0;i<A;++i){
		cin>>a[i];
	}
	for(ll i=0;i<B;++i){
		cin>>b[i];
	}
	for(ll i=0;i<C;++i){
		cin>>c[i];
	}
	sort(a,a+A,greater<ll>());
	sort(b,b+B,greater<ll>());
	sort(c,c+C,greater<ll>());
	for(ll i=0;i<X;++i){
		f.pb(a[i]);
	}
	for(ll i=0;i<Y;++i){
		f.pb(b[i]);
	}
	for(ll i=0;i<C;++i){
		f.pb(c[i]);
	}
	sort(f.begin(),f.end(),greater<ll>());
	ll ans=0;
	for(ll i=0;i<X+Y;++i){
		// cout<<f[i]<<" ";
		ans+=f[i];
	}
	cout<<ans<<endl;

}

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

ll A[210000], B[210000];
priority_queue<long long> zen;
priority_queue<long long, vector<long long>, greater<long long> > kou;

int main() {
    int q;
    ll zensum = 0, kousum = 0, sum = 0;
    cin >> q;
    rep(i, q) {
        int m;
        cin >> m;
        if (m == 1) {
            cin >> A[i] >> B[i];
            sum += B[i];

            if (zen.size() > kou.size()) {
                // kou に
                int t = zen.top();
                if (A[i] >= t) {
                    kou.push(A[i]); kousum += A[i];
                }
                else {
                    zen.pop(); zensum -= t;
                    zen.push(A[i]); zensum += A[i];
                    kou.push(t); kousum += t;
                }
            }
            else {
                // zen に
                if (zen.empty()) zen.push(A[i]), zensum += A[i];
                else {
                    int t = kou.top();
                    if (A[i] <= t) {
                        zen.push(A[i]); zensum += A[i];
                    }
                    else {
                        kou.pop(); kousum -= t;
                        kou.push(A[i]); kousum += A[i];
                        zen.push(t); zensum += t;
                    }
                }
            }
        }
        else {
            ll y = zen.top();
            ll res = (y * (int)zen.size() - zensum) + (kousum - y * (int)kou.size()) + sum;
            cout << y << " " << res << endl;
        }
    }
}


Measured memory_bytes: 8076
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm> 
#include <functional>	
using namespace std;

int main() {
	int x, a, b;
	cin >> x >> a >> b;
	if (fabs(a - x) < fabs(b - x)) {
		cout << "A" << endl;
	}
	else {
		cout << "B" << endl;
	}


	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define endl "\n"
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

int main(){
    fast;
    ll n,k;
    cin>>n>>k;
    ll h[n];
    for(ll i=0;i<n;i++)
        cin>>h[i];
    ll ans[n];
    ans[0] = 0;
    
    for(ll i=1;i<n;i++){
        ans[i] = 1e10;
        ll temp = max((ll)0,i-k);
        for(ll j=i-1;j>=temp;j--)
            ans[i] = min(ans[i], ans[j] + abs(h[i]-h[j]));
    }
    
    cout<<ans[n-1]<<endl;
    
    return 0;
}

Measured memory_bytes: 1792
import fractions
A, B, C, D = map(int, input().split(" "))
W = (B-A+1)
x = C*D//fractions.gcd(C,D)

c = (B//C) - ((A-1)//C)
d = (B//D) - ((A-1)//D)
j = (B//x) - ((A-1)//x)

div = (c+d-j)
print(W-div)

Measured memory_bytes: 5052
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include<cstdio>
using namespace std;
int main()
{
	vector<int> n;
	int b;
	for (int i = 0; i < 3; i++) {
		cin >> b;
		n.push_back(b);
	}
	sort(n.begin(), n.end());
	cout << (n[0] + n[1]);
	return 0;
}

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

#define rep(i, n) REP(i, 0, n)
#define repr(i, n) for (int i = (n); i >= 0; i--)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;

int main()
{
    char c;
    cin >> c;
    if (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u')
        OP("vowel");
    else
        OP("consonant");
    return 0;
}

Measured memory_bytes: 256
// God put a smile upon your face <3

#include <bits/stdc++.h>`

#define slld(longvalue) scanf("%lld", &longvalue)

#define ll long long
#define ull unsigned long long
#define pll pair < long long, long long >

#define fastio ios_base:: sync_with_stdio(false); cin.tie(0); cout.tie(0)

#define pb push_back

#define bug printf("BUG\n")

#define mxlld LLONG_MAX
#define mnlld -LLONG_MAX

#define mxd 2e8
#define mnd -2e8

#define pi 3.14159265359

#define mod 958585860497

#define base 2001487

using namespace std;

bool check(ll n, ll pos)
{
	return n & (1LL << pos);
}

ll Set(ll n, ll pos)
{
	return n = n | (1LL << pos);
}

int main()
{
    ll i, j, k, l, m, n, o, r, q;
    ll testcase;
    ll input, flag, tag, ans;

//    freopen("input.txt", "r", stdin);

//    freopen("output.txt", "w", stdout);

	string str;

    while(cin >> str)
    {
		if((str == "ABC")) cout << "ARC" << '\n';
		else cout << "ABC" << '\n';
    }


}




Measured memory_bytes: 3596
#include<bits/stdc++.h>
using namespace std;
map<int,int>t;
int n,a,s;
main(){
    cin>>n;
    while(cin>>a){
        s+=t[a]*-2+1;
        t[a]=1-t[a];
    }
    cout<<s<<endl;
    return 0;
}

Measured memory_bytes: 4992
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<vector>
using namespace std;
#define MAX 100100
int n;
char s[MAX];
int main()
{
	scanf("%s",s+1);n=strlen(s+1);
	if(s[1]=='0'||s[n]=='1'){puts("-1");return 0;}
	for(int i=1;i<n;++i)
		if(i!=n-i&&s[i]!=s[n-i]){puts("-1");return 0;}
	int nw=1,tot=1;
	for(int i=n-1;i;--i)
	{
		printf("%d %d\n",nw,++tot);
		if(s[i]=='1')nw=tot;
	}
	
}


Measured memory_bytes: 1536