akhauriyash/Code-Regression huggingface dataset:
#!/usr/bin/env python3

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

x = I()
for i in range(-1000, 1000):
    for j in range(-1000, 1000):
        if i**5 - j**5 == x:
            print(i,j)
            quit()


Measured memory_bytes: 68196
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define all(V) V.begin(),V.end()

int main(){
	int N;
	cin >> N;
	int ol, nw, cnt = 0;
	cin >> ol;
	for (int i = 1;i < N;i++) {
		cin >> nw;
		if (nw == ol) {
			nw = 10000;
			cnt++;
		}
		swap(ol, nw);
	}
	cout << cnt << endl;
}

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

if sum(A) < sum(B):
    print(-1)
    exit()

minus_sum = 0
plus_list = []
ans = 0
for i in range(N):
    if A[i] < B[i]:
        minus_sum += (B[i] - A[i])
        ans += 1
    elif A[i] > B[i]:
        plus_list.append(A[i] - B[i])
plus_list.sort(reverse=True)

if minus_sum == 0:
    print(0)
    exit()

i = 0
while minus_sum > 0:
    minus_sum -= plus_list[i]
    ans += 1
    i += 1

print(ans)


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

int main() {
  int n; cin >> n; if (n%2==1) return puts("No") * 0;
  string s; cin >> s;
  for(int i=0; i<n/2; i++) {
    if (s[i] != s[n/2+i]) return puts("No") * 0;
  }
  cout << "Yes" << endl;
}


Measured memory_bytes: 256
def m(ss):
    if ss > 0 and ss <= 12:
        return 1
    return 0

s = list(input())
s1 = int(s[0]+s[1])
s2 = int(s[2]+s[3])
#print(s1,s2)
if m(s1) and m(s2):
    print("AMBIGUOUS")
elif m(s1) and not(m(s2)):
    print("MMYY")
elif not(m(s1)) and m(s2):
    print("YYMM")
else:
    print("NA")

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

int main() {
  int n;string s;cin>>n>>s;
  int ans=0;
  rep(i,1000){
    string t;
    int x=i;
    rep(j,3){
      t+='0'+x%10;
      x/=10;
    }
    int a=0;
    rep(j,n){
      if(s[j]==t[a]){
        a++;
        if(a==3){
          ans++;
          break;
        }
      }
    }
  }
  cout<<ans<<endl;
}

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

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

    vector<int> v(n);
    long long sum = 0;
    for(int i = 0; i < n; i++){
        cin >> v[i];
        sum += v[i];
    }

    sort(v.begin(), v.end());
    cout << v[0] << " " << v[n - 1] << " " << sum << endl;      
}


Measured memory_bytes: 3152
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define reps(i,n) for(int i=1;i<(int)(n);i++)

typedef long long ll;
using namespace std;
int main()
{

  ll a[3];
  cin>>a[0]>>a[1]>>a[2];
  sort(a,a+3,greater<int>());

  if(a[0]==a[1]+a[2]){
    cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  }
  return 0;
}


Measured memory_bytes: 3648
import java.io.InputStreamReader
import java.io.BufferedReader

fun main(args: Array<String>) {
  val br = BufferedReader(InputStreamReader(System.`in`))

  val a = br.readLine()
  val b = br.readLine()

  val great = "GREATER"
  val less = "LESS"
  val equal = "EQUAL"
  val ans = when {
    a.length > b.length -> great
    a.length < b.length -> less
    else -> when {
      a > b -> great
      a < b -> less
      else -> equal
    }
  }

  println(ans)
}

Measured memory_bytes: 31516
import itertools
from operator import mul
from functools import reduce

def combinations_count(n, r):
    r = min(r, n - r)
    numer = reduce(mul, range(n, n - r, -1), 1)
    denom = reduce(mul, range(1, r + 1), 1)
    return numer // denom
  
N,M,Q=map(int,input().split())
a=[0]*Q;b=[0]*Q;c=[0]*Q;d=[0]*Q
for i in range(Q):
  a[i],b[i],c[i],d[i]=map(int,input().split())
l=range(1,M+1)


h=combinations_count(M+N-1, N)
H=[0]*h;i=0
for v in itertools.combinations_with_replacement(l, N):
    H[i]=v
    i+=1

D=[0 for j in range(h)]

for i in range(h):
  for j in range(Q):
    if H[i][b[j]-1]-H[i][a[j]-1]==c[j]:
      D[i]+=d[j]
  
print(max(D))


Measured memory_bytes: 25496
import java.util.*;
import java.security.NoSuchAlgorithmException;
import java.util.ArrayList;
import java.util.HashMap;

public class Main {
	
	public static HashMap<String,String> map = new HashMap<>();
	static int N;
	static int M;
	static int[] ar;
	static int[] c;
	static int INF = 2 << 28;

	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		
		N = sc.nextInt();
		M = sc.nextInt();
		ar = new int[N];
		c  = new int[M];
		for(int i = 0; i < N; i++) {
			ar[i] = sc.nextInt()-1;
			c[ar[i]]++;
		}
		

		int[][] dp = new int[M+1][1 << M];
		int[][] dd = new int[M+1][1 << M];
		int[][] ck = new int[M][N];
		
		for(int i = 0; i < dp.length; i++) {
			Arrays.fill(dp[i], INF);
			Arrays.fill(dd[i], INF);
		}
		for(int i = 0; i < M; i++) {
			Arrays.fill(ck[i], INF);
		}
		dp[0][0] = 0;
		dd[0][0] = 0;
		for(int i = 0; i < M; i++) {
			for(int j = 0; j < dp[i].length; j++) {
				if(dp[i][j] == INF) continue;
				int tmp = dd[i][j];
				for(int k = 0; k < M; k++) {
					if((j & (1 << k)) != 0) continue;
					int next = j & (1 << k);
					int sum  = 0;
					if(ck[k][tmp] == INF) {
						for(int l = 0; l < c[k]; l++) {
							if(ar[l + tmp] != k) sum++;
						}
						ck[k][tmp] = sum;
					} else {
						sum = ck[k][tmp];
					}
					dp[i+1][j | (1 << k)] = Math.min(dp[i+1][j | (1 << k)], dp[i][j] + sum);
					dd[i+1][j | (1 << k)] = tmp + c[k];
				}
			}
		}
		System.out.println(dp[dp.length-1][dp[0].length-1]);
		
	}
}

Measured memory_bytes: 230468
def d_moving_piece():
    N, K = [int(i) for i in input().split()]
    P = [int(i) - 1 for i in input().split()]  # マスの番号は 0-indexed とする
    C = [int(i) for i in input().split()]

    # 順列をサイクルごとに分解
    is_visited = [False] * N
    cycles = []  # サイクルごとのスコアを記録
    for i in range(N):
        if is_visited[i]:
            continue

        current = i
        t = []
        while not is_visited[current]:
            is_visited[current] = True
            t.append(C[current])
            current = P[current]
        cycles.append(t)

    ans = -float('inf')
    for s in cycles:
        m = len(s)

        # サイクルを 2 周したものの累積和
        total = [0] * (2 * m + 1)
        for i in range(2 * m):
            total[i + 1] = total[i] + s[i % m]

        reminder = [-float('inf')] * m  # [r]: 連続する r 個の和の最大値
        for i in range(m):
            for j in range(m):
                reminder[j] = max(reminder[j], total[i + j] - total[i])

        # 「余り」の長さで場合分け
        for r in range(m):
            if r > K:
                continue  # 移動できる回数より多く動いたことになり、矛盾

            q = (K - r) // m  # この回数だけサイクルを 1 周する
            if r == 0 and q == 0:
                continue  # 動いていないので、除外

            if total[m] > 0:
                # 周回したほうが得なので、可能な限り周回する
                ans = max(ans, reminder[r] + total[m] * q)
            elif r > 0:
                # 周回すると損なので、必要なだけ (r 回) 移動したら終わる
                ans = max(ans, reminder[r])
    return ans

print(d_moving_piece())


Measured memory_bytes: 74484
#include <stdio.h>

int main(void)
{

	int a, b, c;
	int e;
	scanf("%d %d %d", &a, &b, &c);
	if (a >= b) {
		e = a;
		a = b;
		b = e;
	}
	if (b >= c) {
		e = b;
		b = c;
		c = e;
	}
	if (a >= b) {
		e = a;
		a = b;
		b = e;
	}
	printf("%d %d %d\n", a, b, c);

	return 0;
}


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

namespace CSharpSample01
{
	class Program
	{



	static void Main(string[] args)
		{
			var S = Console.ReadLine();

			if(S == "ABC")
			{
				Console.WriteLine("ARC");
			}
			else
			{
				Console.WriteLine("ABC");
			}

		}
	}
}

Measured memory_bytes: 25884
///in the name of Allah the most beneficent the most merciful.
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define MAX 1e18
#define MIN -1e18
#define MOD 1000000007
//#define mod2 20071027
//#define MOD 998244353
#define base 139
//#define mod 1000074259
#define base2 31
#define memz(a) memset(a, 0, sizeof(a))
#define memn(a) memset(a, -1, sizeof(a))
#define in1(a) scanf("%lld", &a)
#define in2(a, b) scanf("%lld%lld", &a, &b)
#define TC(c) printf("Case #%lld: ", ++c)
#define FAST ios_base::sync_with_stdio(false); cin.tie(NULL);
#define FILE   freopen("input.txt", "r", stdin);  freopen("out.txt", "w", stdout);
#define out(x) cout << #x << " -> " << x << endl;
using namespace std;
const ll N = 200010, M = 10000005;
ll nod[M], n, res;

int solve()
{
    for (ll i = 1; i <= 10000000; i++)
    {
        for (ll j = i; j <= 10000000; j += i)
        {
            nod[j]++;
        }
    }
    cin >> n;
    for (int i = 1; i <= n; i++)
    {
        res += (i * nod[i]);
    }
    cout<<res<<endl;
    return 0;
}
int main()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    int ret = solve();
    return 0;
}
/*

*/


Measured memory_bytes: 81760
#include <stdio.h>
#include <string.h>
int a[200][2];
int b[1000][2];
int main()
{
  int m,n,x,y,i,j,k;
  for(;;){
    scanf("%d",&m);
    if(m==0) break;
    memset(a,0,sizeof(a));
    memset(b,0,sizeof(b));
    for(i=0;i<m;i++){
      scanf("%d%d",&a[i][0],&a[i][1]);
    }
    scanf("%d",&n);
    for(i=0;i<n;i++){
      scanf("%d%d",&b[i][0],&b[i][1]);
    }
    for(i=0;i<n;i++){
      x = b[i][0] - a[0][0];
      y = b[i][1] - a[0][1];
      for(j=1;j<m;j++){
	for(k=0;k<n;k++){
	  if(a[j][0]+x == b[k][0] && a[j][1]+y == b[k][1]) break;
	}
	if(k==n) break;
      }
      if(j==m) break;
    }
    printf("%d %d\n",x,y);
  }
  return 0;
}

Measured memory_bytes: 0
// 0200
#include <iostream>
#include <vector>
#include <queue>
#define  N   10000000
using namespace std;

struct rail{
	int st;
	int num;
};

int com_min(int p, int q, vector<vector<rail> > table){
	vector<int> store;
	for(int i=0;i<table.size();i++)
		store.push_back(N);

	store[p] = 0;
	queue<int> sta;
	sta.push(p);

	while(!sta.empty()){
		int x = sta.front();
		for(int i=0;i<table[x].size();i++){
			if(store[table[x][i].st] > store[x] + table[x][i].num){
				store[table[x][i].st] = store[x] + table[x][i].num;
				sta.push(table[x][i].st);
			}
		}
		sta.pop();
	}

	return store[q];
}

int main(){
	while(1){
		int m, n, a, b, cost, time;
		rail ra;
		vector<vector<rail> > c_table, t_table;

		cin>>n>>m;
		if((n == 0) && (m == 0))
			break;

		c_table.resize(m+1);
		t_table.resize(m+1);

		for(int i=0;i<n;i++){
			cin>>a>>b>>cost>>time;
			ra.st = b;
			ra.num = cost;
			c_table[a].push_back(ra);
			ra.num = time;
			t_table[a].push_back(ra);
			ra.st = a;
			t_table[b].push_back(ra);
			ra.num = cost;
			c_table[b].push_back(ra);
		}

		int k, p, q, r;

		cin>>k;
		for(int i=0;i<k;i++){
			cin>>p>>q>>r;
			
			if(r == 0)
				cout<<com_min(p, q, c_table)<<endl;
			else if(r == 1)
				cout<<com_min(p, q, t_table)<<endl;
		}

	}
	return 0;
}

Measured memory_bytes: 1380
local s = io.read()
local n = #s + 1
local llen, rlen = 0, 0
local toup = true
local lpos = s:sub(1, 1) == ">" and 0 or 1
local turnpos = 0
local sum = 0
if s:sub(n - 1, n - 1) == "<" then
  s = s .. ">"
else
  s = s .. "<"
end
for i = 1, n do
  local ss = s:sub(i, i)
  if ss == "<" then
    if not toup then
      local rlen = i - turnpos
      if llen < rlen then
        sum = sum + llen * (llen - 1) // 2 + rlen * (rlen + 1) // 2
      else
        sum = sum + llen * (llen + 1) // 2 + rlen * (rlen - 1) // 2
      end
      -- print(sum)
      lpos = i
      toup = true
    end
  else
    if toup then
      turnpos = i
      llen = i - lpos
      toup = false
    end
  end
end
if not toup then
  local rlen = n - turnpos
  -- print(rlen)
  if llen < rlen then
    sum = sum + llen * (llen - 1) // 2 + rlen * (rlen + 1) // 2
  else
    sum = sum + llen * (llen + 1) // 2 + rlen * (rlen - 1) // 2
  end
end
print(sum)


Measured memory_bytes: 1292
#include <stdio.h>
#include <math.h>

int main(void){
	char a[1000];
	int t;

	gets(a);

	for(t=0;a[t]!=0;t++){
		if(a[t]>'C'){
			a[t]-=3;
		}
		else{
			a[t]+=23;
		}
	}
	printf("%s\n",a);
	
	return 0;	
}

Measured memory_bytes: 524
N,H,W=map(int,input().split())
A = []
B = []
for i in range(N):
    x1,y1=[int(i) for i in input().split()]
    A.append(x1)
    B.append(y1)

cnt=0

for i in range(N):
    if A[i]>=H and B[i]>=W:
        cnt+=1

print(cnt)

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

int main(){
  ll Q,H,S,D,N;
  cin>>Q>>H>>S>>D>>N;
  H=min(H,Q*2);
  S=min(S,H*2);
  D=min(D,S*2);
  N*=4;
  
  ll ans=0;
  
  ans+=(N/8)*D;
  N%=8;

  ans+=(N/4)*S;
  N%=4;

  ans+=(N/2)*H;
  N%=2;

  ans+=(N/1)*Q;
  N%=1;

  cout<<ans<<endl;
  return 0;
}


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

class D2
{
	struct P
	{
		public int i, j;
		public P(int _i, int _j) { i = _i; j = _j; }
		public bool IsInRange => 0 <= i && i < h && 0 <= j && j < w;
		public P[] Nexts() => new[] { new P(i, j - 1), new P(i, j + 1), new P(i - 1, j), new P(i + 1, j) };
	}

	static int h, w;

	static int[] Read() => Console.ReadLine().Split().Select(int.Parse).ToArray();
	static void Main()
	{
		var z = Read();
		h = z[0]; w = z[1];
		var s = Read();
		var g = Read();
		var c = new int[h].Select(_ => Console.ReadLine()).ToArray();

		var sp = new P(s[0] - 1, s[1] - 1);
		var gp = new P(g[0] - 1, g[1] - 1);

		var u = new int[h, w];
		for (int i = 0; i < h; i++)
			for (int j = 0; j < w; j++)
				u[i, j] = c[i][j] == '.' ? 1 << 30 : -1;
		var pq = PQ<(P, int v)>.Create(_ => _.v);

		u[sp.i, sp.j] = 0;
		pq.Push((sp, 0));

		// Dijkstra
		while (pq.Any())
		{
			var (p, r) = pq.Pop();
			if (p.Equals(gp)) { Console.WriteLine(r); return; }

			foreach (var x in p.Nexts())
			{
				if (!x.IsInRange || u[x.i, x.j] <= u[p.i, p.j]) continue;
				u[x.i, x.j] = u[p.i, p.j];
				pq.Push((x, u[x.i, x.j]));
			}

			for (int i = -2; i <= 2; i++)
				for (int j = -2; j <= 2; j++)
				{
					var x = new P(p.i + i, p.j + j);
					if (!x.IsInRange || u[x.i, x.j] <= u[p.i, p.j] + 1) continue;
					u[x.i, x.j] = u[p.i, p.j] + 1;
					pq.Push((x, u[x.i, x.j]));
				}
		}
		Console.WriteLine(-1);
	}
}

class PQ<T> : List<T>
{
	public static PQ<T> Create(T[] vs = null, bool desc = false)
	{
		var c = Comparer<T>.Default;
		return desc ?
			new PQ<T>(vs, (x, y) => c.Compare(y, x)) :
			new PQ<T>(vs, c.Compare);
	}

	public static PQ<T> Create<TKey>(Func<T, TKey> getKey, T[] vs = null, bool desc = false)
	{
		var c = Comparer<TKey>.Default;
		return desc ?
			new PQ<T>(vs, (x, y) => c.Compare(getKey(y), getKey(x))) :
			new PQ<T>(vs, (x, y) => c.Compare(getKey(x), getKey(y)));
	}

	Comparison<T> c;
	public T First => this[0];

	PQ(T[] vs, Comparison<T> _c)
	{
		c = _c;
		if (vs != null) foreach (var v in vs) Push(v);
	}

	void Swap(int i, int j) { var o = this[i]; this[i] = this[j]; this[j] = o; }
	void UpHeap(int i) { for (int j; i > 0 && c(this[j = (i - 1) / 2], this[i]) > 0; Swap(i, i = j)) ; }
	void DownHeap(int i)
	{
		for (int j; (j = 2 * i + 1) < Count;)
		{
			if (j + 1 < Count && c(this[j], this[j + 1]) > 0) j++;
			if (c(this[i], this[j]) > 0) Swap(i, i = j); else break;
		}
	}

	public void Push(T v)
	{
		Add(v);
		UpHeap(Count - 1);
	}
	public T Pop()
	{
		var r = this[0];
		this[0] = this[Count - 1];
		RemoveAt(Count - 1);
		DownHeap(0);
		return r;
	}
}


Measured memory_bytes: 45812
N = int(input())
H = list(map(int,input().split()))
dp = [0]*N
dp[1] = abs(H[1]-H[0])
for i in range(2,N):
    dp[i] = min(dp[i-1]+abs(H[i]-H[i-1]),dp[i-2]+abs(H[i]-H[i-2]))
print(dp[-1])

Measured memory_bytes: 13928
#include <bits/stdc++.h> //C++の標準ライブラリを一行で一括でインクルードする
#include <math.h> //数学関数と数学定数を利用する
#define rep(i,n) for (long long i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
template<class T> void chmax(T &a,T b) { if (a<b) a=b;}
template<class T> void chmin(T &a,T b) { if (a>b) a=b;}

int main(){
  int N,W; cin >> N >> W;
  vector<ll> w(N),v(N);
  rep(i,N) cin >> w[i] >> v[i];
  
  vector<vector<ll>> q(4);
  
  rep(i,N){
    q[w[i]-w[0]].push_back(v[i]);
  }
  
  rep(i,4){
    sort(q[i].begin(),q[i].end(),greater<ll>());
  }
  
  vector<vector<ll>>q_c(4);
  rep(i,4){
    q_c[i].push_back(0);
    rep(j,q[i].size()){
      ll tmp = q_c[i].back();
      q_c[i].push_back(tmp + q[i][j]);
    }
  }
  
  ll ans = 0;
  rep(i,q[0].size()+1){
    ll weight = 0, value = 0;
    rep(j,q[1].size()+1){
      rep(k,q[2].size()+1){
        rep(l,q[3].size()+1){
          weight = w[0]*i+(w[0]+1)*j+(w[0]+2)*k+(w[0]+3)*l;
          value = q_c[0][i]+q_c[1][j]+q_c[2][k]+q_c[3][l];
          if(weight <= W) chmax(ans,value);
        }
      }
    }
  }
/*  
  rep(i,4){
    for(auto x:q_c[i]){
      cout << x << " ";
    }
    cout << endl;
  }
*/
  cout << ans << endl;
  
  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
 
public class Main {
 
    public static void main(String[] args) {
    
 
        Scanner sc = new Scanner(System.in);
        int H = sc.nextInt();
        int W = sc.nextInt();
 
        while(H != 0 || W != 0){
            if(H == 0 && W == 0){
                break;
            }
            for(int i = 0; i < H; i++) {
                if(i % 2 == 0){
                    for(int j = 0; j < W; j++) {
                        if(j % 2 == 0) {
                            System.out.print("#");
                        }else if(j % 2 == 1){
                            System.out.print(".");
                        }
                    }
                }else if(i % 2 == 1){
                    for(int j = 0; j < W; j++) {
                        if(j % 2 == 0) {
                            System.out.print(".");
                        }else if(j % 2 == 1){
                            System.out.print("#");
                        }
                    }
                }
                System.out.println("");
            }
            System.out.println("");
            H = sc.nextInt();
            W = sc.nextInt();
        }
 
    }
 
}



Measured memory_bytes: 33152
#include<stdio.h>

void maxheap(int);
void swap(int,int);
int num;
int array[2000001];

int main(){

   int i;
  scanf("%d",&num);
  for(i = 1;i <= num;i++){
    scanf("%d",&array[i]);
  }
  for(i = num / 2;i >= 1;i--){
    maxheap(i);
  }
  for(i = 1;i <= num;i++){
    printf(" %d",array[i]);
  }
  printf("\n");
  return 0;
}

void maxheap(int i){
  int left = 0;
  int right = 0;
  int largest = 0;
  int change;

  left = 2 * i;
  right = 2 * i + 1;

  if(left <= num && array[left] > array[i]){
    largest = left;
  }
  else{
    largest = i;
  }
  if(right <= num && array[right] > array[largest]){
    largest = right;
  }
  if(largest != i){
    change=array[i];
    array[i]=array[largest];
    array[largest]=change;
    maxheap(largest);
  }
}



Measured memory_bytes: 3736
#include<cstdio>
#include<cstdlib>
#include<ctime>
#include<cmath>
#include<cstring>
#include<cctype>
#include<complex>
#include<iostream>
#include<sstream>
#include<algorithm>
#include<functional>
#include<vector>
#include<string>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<bitset>
#include<numeric>
using namespace std;
const int dx[] = {1,0,-1,0},dy[] = {0,1,0,-1};
#define INF 1e+8
#define EPS 1e-8
#define PB push_back
#define fi first
#define se second
#define ll long long 
#define reps(i,j,k) for(int i = (j); i < (k); i++)
#define rep(i,j) reps(i,0,j)
typedef pair<int,int> Pii;
typedef vector <int> vi;
bool check(int a, string str){
    if(a%15 == 0)
        return str == "FizzBuzz";
    if(a%5 == 0)
        return str == "Buzz";
    if(a%3 == 0)
        return str == "Fizz";
    return a == atoi(str.c_str());
}
 
int main(){
    int n, m;
    while(scanf("%d%d", &n, &m), n){
        set<int> player;
        
        rep(i, n){
            player.insert(i);
        }

        set<int>::iterator itr = player.begin();
        
        rep(i, m){
            string str;
            int len;
            do{
                cin >> str;
                len = str.size();
                if(str[len-1] == '\n'){
                    str[len-1] = '\0';
                    --len;
                }
            }while(len==0);
            if(player.size() > 1){
                if(check(i+1, str)){
                    ++itr;
                }
                else{
                    player.erase(itr++);
                }
                if(itr == player.end()){
                    itr = player.begin();
                }
            }
        }
 
        int roop = 0;
        for(itr=player.begin(); itr!=player.end(); ++itr, ++roop){
            printf("%d%c", *itr+1, roop+1==player.size() ? '\n' : ' ');
        }
    }
    return 0;
}

Measured memory_bytes: 1304
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define sz(a) (a).size() 
#define all(c) (c).begin(),(c).end()
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,a,n) for(int i=a;i<n;i++)
#define foreach(c,itr) for(__typeof((c).begin(),(c).end())itr=c.begin();itr!=c.end();itr++) 
#define fill(a,b) memset(a,b,sizeof(a))
#define INF 1e9
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pi;
typedef vector<int> vi;
int main(){
	int n,k;
	cin>>n>>k;
	int a[n];
	int ans=0;
	rep(i,n){
		cin>>a[i];
		if(a[i]>=k){
			ans++;
		}
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 640
// Problem : C - Multiplication 3
// Contest : AtCoder - AtCoder Beginner Contest 169
// URL : https://atcoder.jp/contests/abc169/tasks/abc169_c
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define db long double
#define pb push_back
#define pii pair<int,int>
#define vi vector<int>
#define vl vector<ll>
#define vii vector<pii>
#define mi map<int,int>
#define ml map<ll,ll>
#define mii map<pii,int>
#define fi first
#define se second
#define all(a) (a).begin(),(a).end()
#define sz(x) (int)x.size()
#define mod 1000000007
#define MAX 4294967295
#define EPS 1e-9
#define io ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define MAXN 15000005
#define inf 1e10
#define PI acos(-1.0)
#define int long long

void solve(){
    int a,c;
    db b;
    cin>>a>>b;
    c = b*100+0.5;
    int res = (a*c)/100;
    cout<<res<<endl;
}

signed main(){
    io;
    //freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
    int t;
    //cin>>t;
    t = 1;
    while(t--){
        solve();
    }
    return 0;
}

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

using namespace std;

const ll mod=1000000007;
const ll inf=1e18;

int main(){

  /*ll s;
  cin >> s;

  ll a=s/100;
  ll b=s%100;
  */
  string s;
  cin >> s;
  ll a=stoi(s.substr(0,2));
  ll b=stoi(s.substr(2,2));

  if(0<a && a<13 && 0<b && b<13)cout << "AMBIGUOUS" << endl;
  else if(0<a && a<13) cout << "MMYY" <<endl;
  else if( 0<b && b<13) cout << "YYMM" << endl;
  else cout << "NA" << endl;

}

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

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

  int leng = S.size(), cnt = 0;
  for (int i = 0; i < leng / 2; i++) {
    if (S.at(i) != S.at(leng - i - 1)) {
      cnt++;
    }
  }
  cout << cnt << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#define MAX 500001
#define SENTINEL 1e9+1

int L[MAX/2+2], R[MAX/2+2];
int cnt;

void merge(int A[], int left, int mid, int right) {
    int i, j, k;
    int n1 = mid - left;
    int n2 = right - mid;
    for (i = 0; i < n1; i++) { L[i] = A[left + i]; }
    for (i = 0; i < n2; i++) { R[i] = A[mid + i]; }

    L[n1] = R[n2] = SENTINEL;

    i = 0; j = 0;

    for (k = left; k < right; k++) {
        cnt++;
        if (L[i] <= R[j]) {
            A[k] = L[i++];
        }
        else {
            A[k] = R[j++];
        }
    }
}

void mergeSort(int A[], int left, int right) {
    if (left+1 < right) {
        int mid = (left + right) / 2;
        mergeSort(A, left, mid);
        mergeSort(A, mid, right);
        merge(A, left, mid, right);
    }
}

int main() {
    int A[MAX], n, i;
    cnt = 0;

    scanf("%d", &n);

    for (i = 0; i < n; i++) {
        scanf("%d", &A[i]);
    }

    mergeSort(A, 0, n);

    for (i = 0; i < n; i++) {
        printf("%d", A[i]);
        printf( (i == n-1) ? "\n" : " ");
    }

    printf("%d\n", cnt);

    return 0;
}

Measured memory_bytes: 5640
#include <limits.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <math.h>

#define P 1000000007

int comp(const void *a, const void *b){return *(int*)a-*(int*)b;}

int k[200000];
int r[200000];

int getk(int a, int x){
	if(x==1) return a;
	int b = getk(a, x/2);
	b = ((long)b)*b%P;
	if((x&1)==0){
		return b;
	}else{
		return ((long)b)*a%P;
	}
}
 
int comb(int a, int b){
	if(a<b) return 0;
	return ((long)k[a])*r[b]%P*r[a-b]%P;
}

void init(int n){
	k[0]=1;
	for(int i=1; i<=n; i++){
		k[i]=k[i-1]*((long)i)%P;
	}	
	r[n]=getk(k[n], P-2);
	for(int i=n-1; i>=0; i--){
		r[i]=((long)r[i+1])*(i+1)%P;
	}
}

int main(void){
	int h, w, a, b;
	scanf("%d%d%d%d", &h, &w, &a, &b);
	init(h+w);
	long ans=0;
	for(int i=h-a; i>0; i--){
		int x = comb(b-1+i-1, i-1);
		int y = comb(w-b-1+h-i, h-i);
		ans += ((long)x)*y%P;
		ans %= P;
	}
	printf("%d\n", (int)ans);
}


Measured memory_bytes: 1664
#include "bits/stdc++.h"
using namespace std;
using ll = long long; using pii = pair<int, int>;
const int MOD = (int)1e9 + 7, INF = (1 << 27); const ll INFLL = (1LL << 55);
#define FOR(i,a,b) for(int (i)=(a);i<(int)(b);i++)
#define rep(i,n) FOR(i,0,n)
template<typename T> void dbg(T x) { cout << x << "\n"; }
template<typename T, typename U> static void chmin(T &x, U y) { if (y < x) x = y; }
template<typename T, typename U> static void chmax(T &x, U y) { if (x < y) x = y; }

int N, A;
int x[55];

ll dp[55][55][50 * 50 + 5];
ll rec(int i, int c, int sum) {
    ll &r = dp[i][c][sum];
    if (r != -1) return r;
    if (i >= N) {
        if (c == 0 || sum % c != 0) return r = 0;
        return r = (sum / c == A ? 1 : 0);
    }
    return r = rec(i + 1, c, sum) + rec(i + 1, c + 1, sum + x[i]);
}

int main() {
    cin >> N >> A;
    rep(i, N) cin >> x[i];
    memset(dp, -1, sizeof(dp));
    cout << rec(0, 0, 0) << endl;
    return 0;
}

Measured memory_bytes: 59392
#include <iostream>
#include <cmath>
#include <vector>
#include <set>
using namespace std;

int mod = 998244353;

#define swap(x,y){ long long temp = x; x = y; y = temp;}


int main()
{
	 string s;
	 cin >> s;
	 for(int i=0;i<s.length();i++)
	 {
		 	if(s[i]=='?')
			{
				s[i] = 'D';
			}
	 }

	 cout << s << endl;

}


Measured memory_bytes: 3664
import java.util.*;

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

        int n = sc.nextInt();

        if (n == 0) {
            System.out.println('0');
            return;
        }

        while (n != 0) {
            int tmp = n % -2;
            if (tmp == -1) {
                n--;
                tmp = 1;
            }
            sb.append(tmp);

            n /= -2;
        }

        String s = sb.reverse().toString();
        System.out.println(s);
    }
}


Measured memory_bytes: 21844
/*
confirm 0LL and 1LL
confirm cornercases such as 0
confirm times of cin < 10^6
*/
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
using Pld = pair<ld, ld>;
using Vec = vector<ll>;
using VecP = vector<P>;
using VecB = vector<bool>;
using VecC = vector<char>;
using VecD = vector<ld>;
using VecS = vector<string>;
using Graph = vector<VecP>;
template <typename T>
using Vec1 = vector<T>;
template <typename T>
using Vec2 = vector<Vec1<T> >;
#define REP(i, m, n) for(ll (i) = (m); (i) < (n); ++(i))
#define REPN(i, m, n) for(ll (i) = (m); (i) <= (n); ++(i))
#define REPR(i, m, n) for(ll (i) = (m)-1; (i) >= (n); --(i))
#define REPNR(i, m, n) for(ll (i) = (m); (i) >= (n); --(i))
#define rep(i, n) REP(i, 0, n)
#define repn(i, n) REPN(i, 1, n)
#define repr(i, n) REPR(i, n, 0)
#define repnr(i, n) REPNR(i, n, 1)
#define all(s) (s).begin(), (s).end()
#define pb push_back
#define mp make_pair
#define fs first
#define sc second
template <typename T>
bool chmax(T &a, const T b){if(a < b){a = b; return true;} return false;}
template <typename T>
bool chmin(T &a, const T b){if(a > b){a = b; return true;} return false;}
template <typename T>
ll pow2(const T n){return (1LL << n);}
template <typename T>
void cosp(const T n){cout << n << ' ';}
template <typename T>
void co(const T n){cout << n << '\n';}
template <typename T1, typename T2>
void co(pair<T1, T2> p){cout << p.fs << ' ' << p.sc << '\n';}
template <typename T>
void co(const Vec1<T> &v){for(T i : v) cosp(i); cout << '\n';}
template <typename T>
void co(initializer_list<T> v){for(T i : v) cosp(i); cout << '\n';}
template <typename T>
void ce(const T n){cerr << n << endl;}
void sonic(){ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);}
void setp(const ll n){cout << fixed << setprecision(n);}
const ll INF = 1e9+1;
const ll LINF = 1e18+1;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const ld PI = acos(-1);
const ld EPS = 1e-11;

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

	Vec dp0(n, LINF), dp1(n, LINF);
	rep(i, n){
		ll c = s[i]-'0';
		if(!i){
			dp0[i] = c;
			dp1[i] = 11-c;
		}else{
			dp0[i] = min(dp0[i-1]+c, dp1[i-1]+c);
			dp1[i] = min(dp0[i-1]+11-c, dp1[i-1]+9-c);
		}
	}
	co(min(dp0[n-1], dp1[n-1]));

	return 0;
}


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

int main(){
  int a,b;
  cin >> a >> b;
  if(a >= 9 || b >= 9) cout << ":(" << endl;
  else cout << "Yay!" << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<algorithm>
#include<math.h>
using namespace std;
double PI=3.14159265359;
int x[2000];
int y[2000];
int r[2000];
pair<double,double> p[2000];
pair<double,double> c[2000];
double dp[2000][2000];
int main(){
	int a,b;
	scanf("%d%d",&a,&b);
	for(int i=0;i<a;i++){
		scanf("%d%d%d",x+i,y+i,r+i);
		double d=sqrt(x[i]*x[i]+y[i]*y[i]);
		double q=atan2(y[i],x[i]);
		if(q<-PI/2)q+=PI*2;
		double v=asin((double)r[i]/d);
		//printf("%f %f\n",(q-v)/PI*180,(q+v)/PI*180);
		p[i]=make_pair(max(0.0,min(PI,q-v)),min(PI,max(0.0,q+v)));
	}
	std::sort(p,p+a);
	int sz=0;
	for(int i=0;i<a;i++){
		bool ok=true;
		for(int j=0;j<a;j++){
			if(i!=j&&p[j].first<p[i].first&&p[i].second<p[j].second)ok=false;
		}
		if(ok){
			c[sz++]=p[i];
		}
	}
	double ret=0;
	for(int i=1;i<=b;i++){
		double tmp=0;
		int at=0;
		for(int j=0;j<sz;j++){
			while(c[at].second<c[j].first){tmp=max(tmp,dp[i-1][at]);at++;}
			dp[i][j]=max(tmp+c[j].second-c[j].first,dp[i-1][at]+c[j].second-c[at].second);
			ret=max(ret,dp[i][j]);
		}
	}printf("%.12f\n",ret/PI);
}

Measured memory_bytes: 25808
#include <iostream>
#include <vector>
using namespace std;
using ll = long long;

int main(int argc, char* argv[]) {
    int n; cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; i++) cin >> a[i];

    ll res = 0;
    int right = 0;
    int sum = 0;

    for (int left = 0; left < n; left++) {
        while (right < n && (sum ^ a[right]) == (sum + a[right])) {
            sum += a[right];
            right++;
        }
        res += right - left;
        if (left == right) right ++;
        else {
            sum -= a[left];
        }
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 1024
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

static const double EPS = 1e-8;
static const double PI = 4.0 * atan(1.0);
static const double PI2 = 8.0 * atan(1.0);

#define REP(i,n)	for(int i=0;i<(int)n;++i)
#define ALL(c)		(c).begin(),(c).end()
#define CLEAR(v)	memset(v,0,sizeof(v))
#define MP(a,b)		make_pair((a),(b))
#define ABS(a)		((a)>0?(a):-(a))
#define FOR(i,s,n)	for(int i=s;i<(int)n;++i)

int main(int argc, char **argv) {
	int x;
	cin >> x;
	cout << (x < 1200 ? "ABC" : "ARC") << endl;
	return 0;
}


Measured memory_bytes: 764
#include<stdio.h>
#define MAX 500005

int heap[MAX];
int size;

int parent(int);
int left(int);
int right(int);
void maxHeapify(int);
void builtMaxHeap(void);

int main(){
	int i,n;

	scanf("%d",&n);
	size = n;
	for(i = 1; i <= n; i++)
		scanf("%d",&heap[i]);

	builtMaxHeap();

	for(i = 1; i <= n; i++)
		printf(" %d",heap[i]);
	printf("\n");
	return 0;
}

void maxHeapify(int i){
	int l,r,largest,tmp;

	l = left(i);
	r = right(i);
	if(l <= size && heap[l] > heap[i])
		largest = l;
	else
		largest = i;
	if(r <= size && heap[r] > heap[largest])
		largest = r;
	if(largest != i){
		tmp = heap[i];
		heap[i] = heap[largest];
		heap[largest] = tmp;
		maxHeapify(largest);
	}
}

void builtMaxHeap(){
	int i;

	for(i = size/2; i > 0; i--)
		maxHeapify(i);
}

int left(int i){
	return 2 * i;
}

int right(int i){
	return 2 * i + 1;
}

int parent(int i){
	return i / 2;
}

Measured memory_bytes: 2552
#include <cstdio>

typedef long long ll;
const int maxn=2000000+10,mod=1000000007;
ll fac[maxn],ifac[maxn];

ll power(ll a,ll b){
	ll ret=1;
	while(b){
		if(b&1)ret=ret*a%mod;
		a=a*a%mod;
		b>>=1;
	}
	return ret;
}

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

ll C(ll n,ll m){
	return fac[n]*ifac[m]%mod*ifac[n-m]%mod;
}

int main(){
	// freopen("in.txt","r",stdin);
	fac[0]=ifac[0]=1;
	for(int i=1;i<maxn;++i)fac[i]=fac[i-1]*i%mod;
	ifac[maxn-1]=inv(fac[maxn-1]);
	for(int i=maxn-2;i>=1;--i)ifac[i]=ifac[i+1]*(i+1)%mod;
	int r1,c1,r2,c2;
	scanf("%d%d%d%d",&r1,&c1,&r2,&c2);
	printf("%lld\n",(C(r2+c2+2,r2+1)+C(r1+c1,r1)-C(r2+c1+1,r2+1)-C(r1+c2+1,c2+1)+mod+mod)%mod);
	// printf("%lld %lld %lld %lld\n",C(r2+c2+2,r2+1),C(r1+c1+2,r1+1),C(r2+c1+1,r2+1),C(r1+c2+1,c2+1));
	return 0;
}

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

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef vector<ll> vll;

#define forn(i, n) for (int (i) = 0; (i) != (n); (i)++)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define popcount(x) __builtin_popcount(x)
#define popcountll(x) __builtin_popcountll(x)
#define fi first
#define se second
#define re return
#define pb push_back
#define uniq(x) sort(all(x)); (x).resize(unique(all(x)) - (x).begin())

#ifdef LOCAL
#define dbg(x) cerr << __LINE__ << " " << #x << " " << x << endl
#define ln cerr << __LINE__ << endl
#else
#define dbg(x) void(0)
#define ln void(0)
#endif // LOCAL

signed main()
{
    int k;
    cin >> k;
    ll r = 0;
    for (int i = 1; i <= 2 * k; i++)
    {
        r = (10 * r + 7) % k;
        if (r == 0)
        {
            cout << i;
            return 0;
        }
    }
    cout << -1;
}


Measured memory_bytes: 3628
def MI():return map(int,input().split())
def LI():return list(MI())

# n,k,c=MI()
# s=input()

"""nを素因数分解"""
"""2以上の整数n => [[素因数, 指数], ...]の2次元リスト"""

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors[1:]

n=int(input())
l=[]

yakusuu=(make_divisors(n-1))

for k in range(2,min(10**6,n)+1):
    NN=int(n)
    while NN>=k:
        if NN%k==0:
            NN=NN//k
        else:
            NN=NN%k
    if NN==1:
        l+=k,

ll=(l+yakusuu+[n])

print(len(set(ll)))

Measured memory_bytes: 3064
import java.io.PrintWriter

fun next() = readLine()!!
fun nextInt() = next().toInt()
fun nextLong() = next().toLong()
fun nextDouble() = next().toDouble()
fun nextList() = next().split(" ")
fun nextIntList() = nextList().map(String::toInt)
fun nextLongList() = nextList().map(String::toLong)
fun nextDoubleList() = nextList().map(String::toDouble)

val pw = PrintWriter(System.out)
fun print(s: Any = "") = pw.print(s)
fun println(s: Any = "") = pw.println(s)

fun <T> Iterable<T>.join(separator: CharSequence = ", ", prefix: CharSequence = "", postfix: CharSequence = "") = joinToString(separator, prefix, postfix)
fun <T> Array<T>.join(separator: CharSequence = ", ", prefix: CharSequence = "", postfix: CharSequence = "") = joinToString(separator, prefix, postfix)

fun main(args: Array<String>) {
    main()
    pw.flush()
}

fun main() {
    val (H, W) = nextIntList()
    val S = Array(H) { next() }
    val TX = Array(H) { IntArray(W) }
    val TY = Array(H) { IntArray(W) }
    for (y in 0 until H) {
        for (x in 0 until W) {
            if (TX[y][x] != 0 || S[y][x] == '#') continue
            var xx = x
            while (xx < W && S[y][x] == S[y][xx]) xx++
            for (i in x until xx) TX[y][i] += xx - x
        }
    }
    for (y in 0 until H) {
        for (x in 0 until W) {
            if (TY[y][x] != 0 || S[y][x] == '#') continue
            var yy = y
            while (yy < H && S[y][x] == S[yy][x]) yy++
            for (j in y until yy) TY[j][x] += yy - y
        }
    }
    val T = Array(H) { y -> IntArray(W) { x -> TX[y][x] + TY[y][x] } }
    val ans = T.map { it.max()!! }.max()!! - 1
    println(ans)
}

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

template<typename T>
void out(T x) { cout << x << endl; exit(0); }
#define watch(x) cout << (#x) << " is " << (x) << endl




typedef long long ll;
const ll mod = 1e9+7;
const int maxn = 1e6 + 5;





int main() {
    ios_base::sync_with_stdio(false); cin.tie(0);  cout.tie(0);
    ll ans = 0;
    int k; cin>>k;
    for (int a=1; a<=k; a++) {
	for (int b=1; b<=k; b++) {
	    for (int c=1; c<=k; c++) {
		ans += __gcd(a,__gcd(b,c));
	    }
	}
    }

    cout<<ans<<endl;

    return 0;
}


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

using namespace std;
using ll = long long;
using vec = vector<ll>;
using mat = vector<vec>;
using vec_b = vector<bool>;
using vec_str = vector<string>;

#define INF (1LL << 60)
#define MOD 1000000007

#define REP(i,m,n) for(ll (i)=(m),i##_len=(n);(i)<(i##_len);++(i))
#define FORR(i,v) for(auto (i):v)
#define ALL(x) (x).begin(), (x).end()
#define _PR(x) cout << (x) << endl
#define _PS(x) cout << (x) << " "
#define SZ(x) ((ll)(x).size())
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define pb push_back


int main()
{
    ll r;
    cin >> r;
    _PR(r*r);
    

    return 0;
}

/*



*/

Measured memory_bytes: 256
a, b, c, x = [int(input()) for i in range(4)]
count = 0
for i in range(a + 1):
	if (500 * i > x):
		break
	for j in range(b + 1):
		n = x - (500*i + 100*j)
		if n < 0:
			break
		m = n / 50
		if (m <= c):
			count += 1
print(count)

Measured memory_bytes: 38640
#include <stdio.h>
#include <iostream>
using namespace std;

void moveE(int dice[]);
void moveN(int dice[]);
void moveS(int dice[]);
void moveW(int dice[]);
void moveR(int dice[]);

int main(void)
{	
	int dice[6];
	for (int i = 0; i < 6; i++) cin >> dice[i];
	
	int q;
	cin >> q;
	for (int i = 0; i < q; i++) {
		int num0, num1;
		cin >> num0 >> num1;
		
		int cnt = 0;
		while (dice[0] != num0) {
			if (cnt < 3) moveE(dice);
			else moveN(dice);
			cnt++;
		}
		while (dice[1] != num1) moveR(dice);
		
		cout << dice[2] << endl;
	}
	
	return 0;
}

void moveE(int dice[])
{
	int temp = dice[0];
	dice[0] = dice[3];
	dice[3] = dice[5];
	dice[5] = dice[2];
	dice[2] = temp;
}

void moveN(int dice[])
{
	int temp = dice[0];
	dice[0] = dice[1];
	dice[1] = dice[5];
	dice[5] = dice[4];
	dice[4] = temp;
}

void moveS(int dice[])
{
	int temp = dice[0];
	dice[0] = dice[4];
	dice[4] = dice[5];
	dice[5] = dice[1];
	dice[1] = temp;
}

void moveW(int dice[])
{
	int temp = dice[0];
	dice[0] = dice[2];
	dice[2] = dice[5];
	dice[5] = dice[3];
	dice[3] = temp;
}

void moveR(int dice[])
{
	int temp = dice[1];
	dice[1] = dice[2];
	dice[2] = dice[4];
	dice[4] = dice[3];
	dice[3] = temp;
}

Measured memory_bytes: 3100
#include <bits/stdc++.h>
 
using namespace std;
 
template<class T> void ckmin(T &a, T b) { a = min(a, b); }
template<class T> void ckmax(T &a, T b) { a = max(a, b); }
 
#define pb push_back
#define mp make_pair
#define cotu cout
#define itn int
#define Red ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define F first
#define S second
#define sz(x) (int)x.size()
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for(int i = 0; i < n; ++i)
#define repr(i,n) for(int i = n - 1; i >= 0; --i)
#define Rep(i, a, n) for(int i = (a); i <=(n); ++i)
#define repst(i, n) for(auto it = n.begin(); it != n.end(); ++it)
#define Repr(i, a, n) for(int i = (n); i >= (a); --i)
 
#define ordered_set tree<int , null_type,less<int >, rb_tree_tag,tree_order_statistics_node_update> 
 
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
 
typedef long long ll;
 
const int inf = int(1e9);
const int mod = inf + 7;
const int N = 1e6 + 555;
const double PI = acos(-1.0); 
void solve()
{
	string s;
	cin >> s;
	rep(i, sz(s)){
		if(i % 2){
			if(s[i] == 'L' || s[i] == 'U' || s[i] == 'D');
			else{
				cout << "No";
				return;
			}
		}
		else{
			if(s[i] == 'R' || s[i] == 'U' || s[i] == 'D');
			else{
				cout << "No";
				return;
			}
		}
	}
	cout << "Yes";

}	

 
 
int main()
{
	Red;
	solve();
	return 0;
}

Measured memory_bytes: 256
s=input()
n=len(s)
a=[0]*(n+1)
b=a[:]
x=0
for i in range(n):
  if s[i]=="<":
    x+=1
  else:
    x=0
  a[i+1]=x
x=0
for i in range(n-1,-1,-1):
  if s[i]==">":
    x+=1
  else:
    x=0
  b[i]=x
print(sum([max(i,j) for (i,j) in zip(a,b)]))

Measured memory_bytes: 31908
#include <bits/stdc++.h>
#define REP(i, n) for (int (i) = 0; (i) < (int)(n); i++) 
#define FOR(i, a, b) for(int (i) = a; (i) < (int)b; i++)
#define RREP(i, n) for(int (i)=((int)(n)-1); (i)>=0; i--)
#define RFOR(i, a, b) for(int (i) =((int)(b)-1); (i)>=(int)a; i--)
#define ALL(v) (v).begin(),(v).end()
#define MOD 1000000007
#define NIL -1
#define FI first
#define SE second
#define MP make_pair
#define PB push_back
#define SZ(x)  (int)x.size()
#define SP(x)  setprecision((int)x)


using namespace std ;
typedef long long ll;
typedef vector<int> vint;
typedef vector<vint> vvint;
typedef vector<string> vstr;
typedef pair<int, int> pii;
const int INF = 1e9;
const ll LINF = 1e18;
const double EPS = 1e-9;
ll gcd(ll a, ll b) {return b ? gcd(b, a % b) : a;} //最大公約数
ll lcm(ll a, ll b) {return a / gcd(a, b) * b;} //最小公倍数

//-------------------------------------------------
//コピペするとこ



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


int main()
{
  vector<int> arr(100000+3) ;
  int n ;
  cin >> n ;
  REP(i,n){
    int m ;
    cin >> m ;
    arr.at(m)++ ;
    arr.at(m+1)++ ;
    arr.at(m+2)++ ;
  }
  int ans = 0 ;
  REP(i,100000+3){
    ans = max(ans,arr.at(i)) ;
  }
  
  cout << ans <<endl;
    
  return 0 ;
}




Measured memory_bytes: 640
#include <stdio.h>

int main(void) {
	unsigned long prm[10000]={2,3};
	int i,j,cnt=2,judge;
	for(i=5;cnt<10000;i+=2) {
		judge=1;
		for(j=0;prm[j]*prm[j]<=i;j++) {
			if(!(i%prm[j])) {
				judge=0;
				break;
			}
		}
		if(judge) {
			prm[cnt++]=i;
		}
	}
	unsigned long long ans;
	while(scanf("%d",&i),i) {
		ans=0;
		for(j=0;j<i;ans+=prm[j++]){}
		printf("%lld\n",ans);
	}
	return 0;
}

Measured memory_bytes: 684
#変数: S, num, formula
    
S = input()
num = len(S) - 1

for i in range(2**num):
    op=["-"]*num
    for j in range(num):
        if (i>>j)&1:
            op[num-j-1]="+"
            
    formula=""
    for op_S,op_num in zip(S,op+[""]):
        formula += op_S + op_num

    if eval(formula)==7:
        print(formula+"=7")
        break

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

int main() {
    int a, b, c, k;
    cin >> a >> b >> c;
    cin >> k;
    for (int i = 0; i <= k; i++)
    {
        if (a < b && b < c) {
            cout << "Yes" << endl;
            return 0;
        }
        if (a >= b) {
            b *= 2;
        }
        else if (b >= c) {
            c *= 2;
        }
        
    }
    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 3600
from collections import *

N,W=map(int,input().split())
d=defaultdict(int)
d[0]=0
for i in range(N):
    w,v=map(int,input().split())
    c=d.copy()
    for p,q in c.items():
        if p+w<=W:
            d[p+w]=max(d[p+w],q+v)
print(max(d.values()))

Measured memory_bytes: 4084
#include<iostream>
 using namespace std;
int main()
{
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    if(a+b>c+d){
        cout<<"Left"<<endl;

    }else if(a+b<c+d){
        cout<<"Right"<<endl;

    }else if(a+b==d+c){
        cout<<"Balanced"<<endl;

    }
    return 0;




}


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

int main(){
    int n;
    cin>>n;
    long long ans=0;
    for(int i=1;i<=n;i++){
    	if(i%3!=0&&i%5!=0)ans+=i;
	}
	cout<<ans<<endl;
	return 0;
}


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

int main() {
  long long int a, b, c, d;
  cin >> a >> b >> c >> d;

  cout << max({a*c, a*d, b*c, b*d}) << endl;

  /*vector<unsigned long long int> input_vec(N);
  for (int i = 0; i < N; i++) {
    cin >> input_vec.at(i);
  }

  for (int i = 0; i < input_vec.size(); i ++){
    cout << input_vec.at(i) << endl;
  }*/
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll inf = 1e18;
#define rep(i, a, b) for (int i = a; i < b; i++)
#define per(i, a, b) for (int i = b - 1; i >= a; i--)
#define int ll
using pint = pair<int, int>;
int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
int n;
struct UnionFind {
    vector<int> par;

    UnionFind(int n) : par(n, -1) {}  //親は-1

    int root(int x) {
        if (par[x] < 0)
            return x;  //自身が親
        else
            return par[x] = root(par[x]);  //再帰
    }

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

    void merge(int x, int y) {
        x = root(x);
        y = root(y);
        if (x == y) return;  //既に同じ根
        // xとyのサイズの大きいほうにまとめたい
        if (size(x) < size(y)) swap(x, y);
        par[x] += par[y];  //根のparは-(要素数)になる
        par[y] = x;        //親を更新
        return;
    }

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

signed main() {
    int m;
    cin >> n >> m;
    int a, b;
    UnionFind tree(n);
    rep(i, 0, m) {
        cin >> a >> b;
        tree.merge(--a, --b);
    }
    int cnt = 0;
    rep(i, 0, n) if (tree.root(i) == i) cnt++;
    cout << cnt - 1 << "\n";
}

Measured memory_bytes: 3976
# -*- coding: utf-8 -*-
import sys
from collections import deque, defaultdict
from math import sqrt, factorial, gcd, ceil, atan, pi
# def input(): return sys.stdin.readline()[:-1] # warning not \n
# def input(): return sys.stdin.buffer.readline().strip() # warning bytes
# def input(): return sys.stdin.buffer.readline().decode('utf-8')
import string
# string.ascii_lowercase
from bisect import bisect_left
MOD = int(1e9)+7
INF = float('inf')


def solve():
    # n, m = [int(x) for x in input().split()]
    n = int(input())
    a = [int(x) for x in input().split()]
    a.sort()
    x = a[-1]
    y = a[0]
    t = x
    d = float('inf')
    for e in a:
        if abs(t - (x - e) * 2) < d:
            y = e
            d = abs(t - (x - e) * 2)
    print(x, y)
        

t = 1
# t = int(input())
for case in range(1,t+1):
    ans = solve()


"""
a b a
d c d
a b a
"""


Measured memory_bytes: 21096