akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<math.h>
#include<queue>
#include<deque>
#include<stack>
#include<cstdio>
#include<utility>
#include<set>
#include<list>
#include<cmath>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
const int INF = 1e9;
int main() {
	int A, B, C, D, E, F;
	double mx = -1;
	int max_ws = 0,max_su = 0;
	cin >> A >> B >> C >> D >> E >> F;
	//a,b,c,dは操作1,2,3,4の回数
	for (int a = 0; 100*A*a<=F; ++a) {
		for (int b = 0; 100*B*b<=F; ++b) {
			int s = (A*a + B * b)*E;//水に溶ける砂糖の最大値
			for (int c = 0; C*c<=s; ++c) {
				for (int d = 0; D*d<=s; ++d) {
					int su = C * c + D * d;//砂糖の量
					int ws = 100 * A*a + 100 * B*b + su;//全体量
					if (su > s)continue;
					if (ws > F)continue;
					if (mx < 100 * su / (double)ws) {
						mx = 100 * su / (double)ws;
						max_ws = ws;
						max_su = su;
					}
				}
			}
		}
	}
	cout << max_ws << " " << max_su << endl;
	return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <stack>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <list>
#include <string.h>
#include <functional>
#include <unordered_set>
#include <unordered_map>
#include <array>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <cstring>
#include <utility>
#include <memory>
#include <sstream>
#include <complex>
#include <cassert>
#include <bitset>
#define rep(i, n) for(int i = 0; i < n; i++)
#define fi first
#define se second
using namespace std;
typedef long long int ll; typedef pair <int, int> P; typedef vector <int> vecint; typedef pair<int, P> P1; typedef pair<P, P> P2;
const int inf = 1000000000;
const ll INF = 9000000000000000000;
const double EPS = 10e-9;
int n, root;
vecint G[100001];
int num[100001];
int res;
vecint edge;
int dfs(int v, int p)
{
	//cout << "v " << v << endl;
	int num0 = 0;
	rep(i, G[v].size())
	{
		if (G[v][i] == p) continue;
		if (G[G[v][i]].size() == 1) num0++;
		else
		{
			int chi = dfs(G[v][i], v);
			//cout << "chi " << chi << endl;
			if (chi == 0)
				num0++;
			else num[v] += chi;
		}
	}
	//cout << "num0 " << num0 << endl;
	if (num0) num[v] += (num0 - 1);
	//cout << "numv " << num[v] << endl << endl;
	return num[v];
}
/*void dfs1(int v, int p)
{
	if (p == -1 && G[v].size() == 1) edge.push_back(v);
	rep(i, G[v].size())
	{
		if (G[v][i] == p) continue;
		if (G[G[v][i]].size() == 1)
		{
			edge.push_back(G[v][i]);
		}//{ root = G[v][i]; break; }
		else dfs1(G[v][i], v);
		//if (root >= 0) break;
	}
}*/
int main()
{
	cin >> n;
	res = inf;
	rep(i, n - 1)
	{
		int a, b; cin >> a >> b;
		G[a].push_back(b);
		G[b].push_back(a);
	}
	root = -1;
	rep(i, n)
		if (G[i].size() > 2) { root = i; break; }
	//dfs1(0, -1);
	//cout << "root" << root << endl;
	if (root < 0) puts("1");
	else
	{
		res = dfs(root, -1);
		//int res = dfs(root, -1);
		//res++;
		cout << res << endl;
	}
	return 0;
}


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

string s[110],t[110];

int main() {
    int n; cin >> n;
    rep(i,n) cin >> s[i];

    int m; cin >> m;
    rep(i,m) cin >> t[i];

    int ans=0;

    rep(i,n){
        int score=0;
        rep(j,n)  if(s[i]==s[j]) score++;
        rep(j,m)  if(s[i]==t[j]) score--;
        ans=max(ans,score);        
    }
    cout << ans << endl;

}

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

if n < 10:
    print(n)
elif 10 <= n < 100:
    print(9)
elif 100 <= n < 1000:
    print(n - 90)
elif 1000 <= n < 10000:
    print(909)
elif 10000 <= n < 100000:
    print(n - 9090)
else:
    print(90909)


Measured memory_bytes: 2940
#include <bits/stdc++.h>
#define REP(i,n) for (int i=0;i<(n);i++)
using namespace std;
int gcd(int a,int b){
    if(b==0)return a;
    return gcd(b,a%b);
}
int main(){
    int p,q;
    cin>>p>>q;
    int r=gcd(q,p);
    p/=r;q/=r;
    int ans=1;
    for(int i=2;i*i<=q;i++){
        if(q%i!=0)continue;
        ans*=i;
        while(q%i==0)q/=i;
    }
    ans*=q;
    cout<<ans<<endl;
}

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

int main() {

    ll n, count, count2;
    count = 0;
    count2 = 0;
    cin >> n;
    ll x;
    cin >> x;
    rep(i, n - 1){
        ll a;
        cin >> a;
        if(x >= a){
            count++;
        }else{
            count2 = max(count, count2);
            count = 0;
        }
        x = a;
    }
    cout << max(count, count2) << endl;
    

}

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

using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
#define a first
#define b second
#define sz size()
#define pb(x) push_back(x) 
#define bg begin()
#define ed end()
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep1(i,n) for(ll i=1;i<=n;i++)
#define mp(x,y) make_pair(x,y)
const ll MOD=1000000007;
const ll INF=1000000000000000;

vector<ll> pw2(51,1); vector<ll> pw10(19,1);
ll maxx(ll x,ll y,ll z){return max(max(x,y),z);}
ll minn(ll x,ll y,ll z){return min(min(x,y),z);}
ll mid(ll x,ll y,ll z){return x>y?y>=z?y:min(z,x):x>=z?x:min(y,z);}
ll gcd(ll x,ll y){if(x%y==0) return y;else return gcd(y,x%y);}
ll lcm(ll x,ll y){return x*(y/gcd(x,y));}
ll myceil(ll x,ll y){if(x<=y) return 1;else if(x%y==0) return x/y;else return x/y+1;}
ll digsz(ll x){if(x==0) return 1;else{ll ans=0;while(x){x/=10;ans++;}return ans;}}
ll digsum(ll x){ll sum=0;while(x){sum+=x%10;x/=10;}return sum;}
vector<ll> divisor(ll x){vector<ll> div;
	for(ll i=1;i*i<=x;i++){if(x%i==0){div.pb(i);if(i*i!=x)div.pb(x/i);}}
	sort(div.bg,div.ed);return div;}


int main(){
	string s; cin>>s;
	ll Scnt=0,Tcnt=0,cnt=0;
	rep(i,s.sz){
		if(Scnt>0 && s[i]=='T'){
			Scnt--;
			cnt+=2;
		}
		else if(s[i]=='T') Tcnt++;
		else if(Tcnt>0){
			Scnt=1;
			Tcnt=0;
		}
		else Scnt++;
		//cout<<Scnt<<Tcnt<<endl;
	}
	cout<<s.sz-cnt;
}

Measured memory_bytes: 640
#include<iostream>
using namespace std;
int main(){
    int n,t=0,x=0,y=0,f=0;
    cin>>n;
    for(int i=0;i<n;i++){
    	int nt,nx,ny;
        cin>>nt>>nx>>ny;
        if((abs(nx-x)+abs(ny-y))%2!=(nt-t)%2)f=1;
        else if(abs(nx-x)+abs(ny-y)>(nt-t))f=1;
        t=nt,x=nx,y=ny;
    }
    if(!f)cout<<"Yes";
    else cout<<"No";
    return 0;
}

Measured memory_bytes: 256
from heapq import heappop, heapify, heappush

n = int(input())
a = list(map(int, input().split()))

a_front = a[0 : n]
a_back = list(map(lambda x: -1*x, a[2*n : 3*n]))
heapify(a_front)
heapify(a_back)

sum_f = [0]*(n+1)
sum_b = [0]*(n+1)
sum_f[0] = sum(a_front)
sum_b[n] = sum(a_back)*-1

for i in range(n, 2*n):
    # 前半の処理
    heappush(a_front, a[i])
    sum_f[i-n+1] = sum_f[i-n] + a[i] - heappop(a_front)
    # 後半の処理
    heappush(a_back, -1 * a[3*n-i-1])
    sum_b[2*n-i-1] = sum_b[2*n-i] + a[3*n-i-1] + heappop(a_back)

ans = sum_f[0] - sum_b[0]
for i in range(1, n+1):
    tmp = sum_f[i] - sum_b[i]
    if tmp > ans:
        ans = tmp
        
print(ans)

Measured memory_bytes: 37212
n=int(input())
p=list(map(int,input().split()))

cnt=0
if p[0]==1:
    p[1],p[0]=p[0],p[1]
    cnt+=1

for i in range(1,n-1):
    if p[i]==i+1:
        p[i],p[i+1]=p[i+1],p[i]
        cnt+=1
    else:
        continue
if p[-1]==n:
    cnt+=1
print(cnt)

Measured memory_bytes: 14008
N=int(input())
a=list(map(int,input().split()))
k=1
count=0
while True:
    for n in range(0,N):
        if a[n]!=k:
            count+=1
        elif a[n]==k:
            k+=1
        elif a[n]==a[N-1]:
            break
    if k==1:
        print("-1")
        break
    else:
        print(count)
        break

Measured memory_bytes: 24744
n, q = gets.chomp.split.map &:to_i
 
node = {}
 
(n-1).times{
	a, b = gets.chomp.split.map &:to_i
 
	if node[a] then
		node[a] << b
	else
		node[a] = [b]
	end

	if node[b] then
		node[b] << a
	else
		node[b] = [a]
	end
}
 
count = {}
 
q.times{
	p, x = gets.chomp.split.map &:to_i
 
	if count[p] == nil then
		count[p] = x
	else
		count[p] += x
	end
}
 
tmp = {}
next_tmp = {1 => 0}
checked = {}
result = []
 
while next_tmp.keys.size > 0
	tmp = next_tmp
	next_tmp = {}
	tmp.each { |k, v|
		checked[k] = true
		result[k] = v + (count[k] ? count[k] : 0)
		if node[k] then
			node[k].each{ |s|
				if checked[s] == nil then
					next_tmp[s] = result[k]
				end
			}
		end
	}
end
 
puts result[1..-1].map(&:to_i).join(" ")

Measured memory_bytes: 75500
using System;
using System.Linq;

class Program{
  static void Main(){
    int N = int.Parse(Console.ReadLine());
    string S = Console.ReadLine();
    
    int counter = 0;
    string former = "R";
    
    for (int i = 0; i < N; i++){
      string str = S.Substring(i, 1);
      if (str != former){
        counter++;
        former = str;
      }
    }
    Console.WriteLine(counter);
  }
}

Measured memory_bytes: 13280
#include <iostream>
#include <vector>
#include <string>
#include <cmath>

int main(){
  int A;

  std::cin >> A;

  std::string str = std::to_string(A);
  int digit = (int)str.size();
  int ans = 0;
  for(int i = 1 ; i <= digit ; i++){
    if(i < digit){
      if(i%2 == 1){
	ans += (int)std::pow(10, i - 1) * 9;
      }
    }
    if(i == digit && i % 2 == 1){
      ans += A - (int)std::pow(10, i - 1) + 1;
    }
  }
  std::cout << ans << std::endl;
 return 0;
  
}



Measured memory_bytes: 256
def get_i() #空白区切の入力を数値(整数)の配列で返す
  return gets.chomp.split(" ").map(&:to_i)
end
def get_f() #空白区切の入力を数値(実数)の配列で返す
  return gets.chomp.split(" ").map(&:to_f)
end
def get() #空白区切の入力を文字列の配列で返す
  return gets.chomp.split(" ")
end
def get_nsp() #入力されたものを一文字ずつに区切った文字列の配列で返す
  return gets.chomp.split("")
end
def yn_judge(bool,y="Yes",n="No") #boolに真偽を投げることで、trueならy、falseならnの値を出力する
  return bool ? y : n 
end
def array(size1,init=nil,size2=1) #size2に二次元配列時の最初の要素数、size1に次の配列の大きさ、initに初期値を投げることでその配列を返す
  if size2==1
    return Array.new(size1){init}
  else
    return Array.new(size2){Array.new(size1){init}}
  end
end

N,K=get_i
A=get_i
puts ((N-1).to_f/(K-1).to_f).ceil

Measured memory_bytes: 8708
N = gets.to_i
T = gets.split.map(&:to_i)
V = gets.split.map(&:to_i)

max_speed = Array.new(2 * T.inject(:+) + 1, Float::INFINITY)
max_speed[0] = 0
max_speed[-1] = 0

idx = 0
cur_speed = 0

T.zip(V) do |t, v|
  (2 * t).times do
    idx += 1

    cur_speed = [cur_speed + 0.5, v].min

    if max_speed[idx] > cur_speed
      max_speed[idx] = cur_speed
    end
  end
end

idx = -1
cur_speed = 0

T.reverse.zip(V.reverse) do |t, v|
  (2 * t).times do
    idx -= 1

    cur_speed = [cur_speed + 0.5, v].min

    if max_speed[idx] > cur_speed
      max_speed[idx] = cur_speed
    end
  end
end

list = 0.step(T.inject(:+), 0.5).to_a

list.zip(max_speed).each do |t, v|
  # puts [t, v].join(' ')
end
ans = 0

max_speed.each_cons(2) do |a, b|
  ans += Rational(0.5 * (a + b), 2)
end

puts ans.to_f


Measured memory_bytes: 6140
#include <stdio.h>
#include <algorithm>
#include <assert.h>
#include <bitset>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <time.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#pragma warning(disable:4996)
#pragma comment(linker, "/STACK:336777216")
using namespace std;

#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define ldb ldouble

typedef tuple<int, int, int> t3;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ldb;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair <ll, int> pli;
typedef pair <db, db> pdd;

int IT_MAX = 1 << 19;
int MOD = 10000000;
const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
const db PI = acos(-1);
const db ERR = 1e-10;
#define szz(x) (int)(x).size()
#define rep(i, n) for(int i=0;i<n;i++)
#define Se second
#define Fi first

const int MX = 100005;
int A[MX], B[MX];

int main()
{
	int N;
	ll sum = 0, need = 0;
	scanf("%d", &N);
	for(int i = 1; i <= N; i++) scanf("%d", A+i), sum -= A[i];
	for(int i = 1; i <= N; i++) scanf("%d", B+i), sum += B[i];
	for(int i = 1; i <= N; i++){
		int t = A[i];
		if( B[i] >= A[i] && B[i]%2 != A[i]%2 ) t = B[i]+1;
		need += (B[i] <= t? t - B[i] : 0);
	}

	if( sum < need ) return !printf("No\n");
	printf("Yes\n");
}


Measured memory_bytes: 384
///-----Bismillahir Rahmanir Rahim-----///

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

///---FAST I/O---///
#define Boost() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

///---DATA TYPE---///
typedef long long ll;
typedef long long int lli;
///vector
typedef vector<int> vi;
typedef vector<ll> vl;
///pair
typedef pair<int,int> pii;
typedef pair<double, double> pdd;
typedef pair<ll, ll> pll;

///---LOOP---///
#define rep0(i,n) for(i=0;i<n;i++)
#define rep1(i,n) for(i=1;i<=n;i++)

///---I/O---///
#define sf scanf
#define pf printf

///---OTHERS---///
#define pb push_back
#define all(c)		c.begin(),c.end()
#define MK make_pair
#define F first
#define S second
#define endl '\n'


///---INITIALIZATION---//
#define mem(a,b) memset(a, b, sizeof(a) )

///---CALCULATE---///
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*(b/gcd(a,b)))
#define sqr(a) ((a) * (a))

///---BIT OPERATION---///
inline bool checkBit(ll n, int i)
{
    return n&(1LL<<i);
}
inline ll setBit(ll n, int i)
{
    return n|(1LL<<i);;
}
inline ll resetBit(ll n, int i)
{
    return n&(~(1LL<<i));
}

///---CONSTANT---///
const double PI = acos(-1);
const double eps = 1e-9;
const int inf = 2000000000;
const ll infLL = 9000000000000000000;
#define MOD 1000000007

int main()
{
    Boost();

    int t;
    t=1;
    //cin>>t;
    while(t--)
    {
        int ani,leg;
        cin>>ani>>leg;
        if(ani*2==leg || ani*4==leg)
        {
            cout<<"Yes"<<endl;
            return 0;
        }
        while(ani*4!=leg && leg>1 && ani>0)
        {
            leg-=2;
            ani--;
        }
        if(ani*4==leg) cout<<"Yes"<<endl;
        else cout<<"No"<<endl;

    }
    return 0;
}



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

#define MAX 100002

int n;
int m;

vector<int> v;

vector<int> vv[2];
vector<int> w;

vector<int> ans;
int main(){
	cin >> n >> m;
	for (int i = 0; i < m; i++){
		int a;
		scanf("%d", &a);
		vv[a&1].push_back(a);
		w.push_back(a);
	}
	if (m == 1 && w[0] == 1){
		cout << w[0] << endl;
		cout << 1 << endl;
		cout << 1 << endl;
		return 0;
	}
	if (m == 1){
		cout << w[0] << endl;
		cout << 2 << endl;
		cout << w[0] - 1 <<" "<<1<< endl;
		return 0;
	}
	if (vv[1].size()>
		2){
		puts("Impossible");
		return 0;
	}
	if (vv[1].size()){
		vv[0].insert(0 + vv[0].begin(), vv[1].back());
		vv[1].pop_back();
	}
	if (vv[1].size()){
		vv[0].push_back(vv[1].back());
		vv[1].pop_back();
	}
	for (int i : vv[0]){
		ans.push_back(i);
	}
	ans[0]--;
	if (ans[0] == 0){
		ans.erase(ans.begin() + 0, ans.begin() + 1);
	}
	ans.back()++;
	for (int i = 0; i < vv[0].size(); i++){
		if (i){
			printf(" ");
		}
		printf("%d", vv[0][i]);
	}
	puts("");
	cout << ans.size()<< endl;
	for (int i = 0; i < ans.size(); i++){
		if (i){
			printf(" ");
		}
		printf("%d", ans[i]);
	}
	puts("");
	return 0;
}

Measured memory_bytes: 256
import Control.Monad (replicateM)

main :: IO ()
main = readLn >>= print . solve

solve :: Int -> Int
solve = length . all753Nums

all753Nums :: Int -> [Int]
all753Nums n = between 1 n [read s | i <- [3..l]
                                   , s <- replicateM i "357"
                                   , contains753 s]
  where l = length $ show n

between :: Ord a => a -> a -> [a] -> [a]
between a b = takeWhile (<=b) . dropWhile (<a)

contains753 :: String -> Bool
contains753 s = and [c `elem` s | c <- "753"]


Measured memory_bytes: 2300
n,m=map(int,input().split())
p=[input().split() for _ in range(n)]
cnt=0
while(p):
    if int(p[0][1])>m:
        p[0][1]=int(p[0][1])-m
        x=p[0]
        del(p[0])
        p.append(x)
        cnt+=m
    else:
        cnt+=int(p[0][1])
        print(p[0][0], cnt)
        del(p[0])


Measured memory_bytes: 17124
#include "bits/stdc++.h"
#pragma comment (linker, "/STACK:526000000")
#define  _CRT_SECURE_NO_WARNINGS

using namespace std;
typedef string::const_iterator State;
#define eps 1e-11L
#define MAX_MOD 1000000007LL
#define GYAKU 500000004LL

#define MOD 998244353LL
#define seg_size 262144*2LL
#define pb push_back
#define mp make_pair
typedef long long ll;
#define REP(a,b) for(long long (a) = 0;(a) < (b);++(a))
#define ALL(x) (x).begin(),(x).end()

void init() {
	iostream::sync_with_stdio(false);
	cout << fixed << setprecision(20);
}


#define int ll
void solve(){
	int cnt[10] = {};
	int a, b, c;
	cin >> a >> b >> c;
	cnt[a]++;
	cnt[b]++;
	cnt[c]++;
	REP(i, 10) {
		if (cnt[i] == 2) {
			cout << "Yes" << endl;
			return;
		}
	}
	cout << "No" << endl;
}
#undef int
int main() {
	init();
	solve();
}

Measured memory_bytes: 256
import java.util.*;

class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		SortedMap<Integer, Integer> S = new TreeMap<Integer, Integer>();
		int q = sc.nextInt();
		int cnt = 0;
		for(int i = 0; i < q; i++){
			int com = sc.nextInt();
			if(com == 0){
				int x = sc.nextInt();
				if(S.containsKey(x)){
					int num = S.get(x);
					S.put(x, num + 1);
				}else{
					S.put(x, 1);
				}
				cnt++;
				System.out.println(cnt);
			}else if(com == 1){
				int x = sc.nextInt();
				if(S.containsKey(x)) System.out.println(S.get(x));
				else System.out.println(0);
			}else if(com == 2){
				int x = sc.nextInt();
				if(!S.containsKey(x)) continue;
				cnt -= S.get(x);
				S.remove(x);
			}else{
				int L = sc.nextInt();
				int R = sc.nextInt();
				SortedMap<Integer, Integer> SS = S.subMap(L, R + 1);
				for(Integer num : SS.keySet()){
					for(int j = 0; j < SS.get(num); j++) System.out.println(num);
				}
			}
		}
	}
}



Measured memory_bytes: 183816
#include<cstdio>
#include<algorithm>
using namespace std;
int N;
int main(){
	scanf("%d",&N);
	for(int i=1;i<=9;i++)
		for(int j=1;j<=9;j++)
			if(i*j==N){
				printf("Yes\n");
				return 0;
			}
	puts("No");
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
#define ll                 long long int
#define mod                1000000007
#define pi                 3.14159265358979323846264338327950288419716939937510
#define setbit(x)          __builtin_popcountll(x)
#define db                 long double
#define pp(x)              pair<x,x>
#define ff                 first
#define ss                 second
#define FIO                ios_base::sync_with_stdio(false); cin.tie(NULL);
#define tc                 ll tc; cin>>tc; for(ll number = 1 ; number <= tc ; number ++ )
#define vv(x)              vector<x>
#define pb                 push_back
#define pob                pop_back
#define pf                 push_front
#define pof                pop_front
#define endl               "\n"
#define pq                 priority_queue
#define dbg(x)             { cout<< #x << ": " << (x) << endl; }
#define dbg2(x,y)          { cout<< #x << ": " << (x) << " , " << #y << ": " << (y) << endl; }
#define bp                 ll kkk; cin >>kkk;
#define dbgArr(a,n)        cout<<"Array "<<#a<<endl; for(ll i=0 ; i<n ; i++) cout<<a[i]<<" "; cout<<endl;
#define maxE(a,n)          *max_element(a,a+n);
#define minE(a,n)          *min_element(a,a+n);
#define forn(i,s,n)        for(ll i=s ; i<n ; i++)
#define fornr(i,e,s)       for(ll i=e-1 ; i>=s ; i--)
#define arr1(a,n)          for(ll i=1;i<=n;i++){ cin>>a[i]; }
#define file freopen("input.txt","r",stdin); freopen("output.txt","w",stdout)
#define print cout<<"Case #"<<number<<": "
#define all(x) x.begin(), x.end()
ll power(ll x, ll b) {ll p = 1;while (b > 0) {if(b&1) {p = p * x; p %= mod;} b >>= 1; x *= x; x %= mod;} return p % mod;}
using namespace std;
# define INF 1e15
struct ppp{
    ll a,b,c;
};
struct lex_compare {
    bool operator() (ppp p1, ppp p2){
        if(p1.a == p2.a){
            if(p1.b == p2.b) return p1.c < p2.c;
            else return p1.b < p2.b;
        }else{
            return p1.a < p2.a;
        }
    }
};


int main(){
    FIO;
    ll n, x, m; cin >> n >> x >> m;
    map<ll,pp(ll)> me;
    ll ans = 0;
    ll j = n;
    while(j > 0){
        if(me.count(x) == 0){
            me[x] = {j, ans};
            ans += x;
            j--;
        }else{
            pp(ll) temp = me[x];
            ll stepr = temp.ff-j;
            ll diff = ans-temp.ss;
            ans += (diff)*(j/stepr);
            j -= (j/stepr)*(stepr);
            if(j > 0){
                ans += x;
                j--;
            }
        }
        x = (x*x)%m;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 6668
#include<bits/stdc++.h>
#define rep(i,x,y) for (int i=(x);i<=(y);i++)
#define gc getchar
#define ll long long
#define db double
#define pii pair<int,int>
#define fi first
#define se second
#define Vi vector<int>
#define Vp vector<pii>

using namespace std;

inline void cmax(int &x,int y){y>x?x=y:0;}
inline void cmin(int &x,int y){y<x?x=y:0;}

int read(){
	char ch=gc(); int x=0,op=1;
	for (;!isdigit(ch);ch=gc()) if (ch=='-') op=-1;
	for (;isdigit(ch);ch=gc()) x=(x<<1)+(x<<3)+ch-'0';
	return x*op;
}

int main(){
	int t=0,n; ll ans=0;
	scanf("%d",&n);
	rep (i,1,n){
		int x; scanf("%d",&x);
		if (!x){t=0; continue;}
		x+=t; ans+=x/2; t=x%2;
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 256
using System;
class Program
{
    static void Main(string[] args)
    {
		string[] str = Console.ReadLine().Split(' ');
		int n = int.Parse(str[0]);
		int k = int.Parse(str[1]);
		int output = 0;

		if(n%k == 0){
			output = 0;
		}
		else{
			output = 1;
		}

        //出力        
		Console.WriteLine(output);

    }
}

Measured memory_bytes: 13140
#21:35

offset_y = [0,-1,0,1]
offset_x = [-1,0,1,0]

while True:
    num_sqale = int(input())
    if num_sqale ==0:
        break
    work =  [[-1] * num_sqale*2 for i in range(num_sqale*2)]
    # 真ん中を初期化
    work[num_sqale][num_sqale] = 0
    index_x = [num_sqale]
    index_y = [num_sqale]

    for i in range(1,num_sqale):
        target,offset = map(int,input().split())
        hight = index_y[target]
        witdh = index_x[target]
        n_hight = hight + offset_y[offset]
        n_width = witdh + offset_x[offset]
        work[n_hight][n_width] = i
        index_x.append(n_width)
        index_y.append(n_hight)
        
    print(str(max(index_x)-min(index_x)+1)+" "+str(max(index_y)-min(index_y)+1))



Measured memory_bytes: 8148
n = int(input())
s = input()

def rot(c, n):
	new_c_ord = ord(c) + n
	if new_c_ord >= 91:
		new_c_ord -= 26
	return chr(new_c_ord)

res = ''.join([rot(c, n) for c in list(s)])

print(res)

Measured memory_bytes: 3188
//#pragma GCC target("avx2,avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <atcoder/all>
using namespace atcoder;
//using mint = modint998244353;
//using mint = modint1000000007;
#include <bits/stdc++.h>
using namespace std;
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
//using i128 = __int128_t;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<long long, long long>;
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
constexpr char ln = '\n';
template<class T1, class T2> inline bool chmax(T1 &a, T2 b) {if (a < b) {a = b; return true;} return false;}
template<class T1, class T2> inline bool chmin(T1 &a, T2 b) {if (a > b) {a = b; return true;} return false;}
inline int topbit(int x) {return x == 0 ? -1 : 31-__builtin_clz(x);}
inline int topbit(long long x) {return x == 0 ? -1 : 63-__builtin_clzll(x);}
inline int botbit(int x) {return x == 0 ? 32 : __builtin_ctz(x);}
inline int botbit(long long x) {return x == 0 ? 64 : __builtin_ctzll(x);}
inline int popcount(int x) {return __builtin_popcount(x);}
inline int popcount(long long x) {return __builtin_popcountll(x);}
inline int kthbit(long long x, int k) {return (x>>k)&1;}
inline void print() {cout << "\n";}
template<class T>
inline void print(const vector<T> &v) {
    for (auto itr = v.begin(); itr != v.end(); ++itr) cout << *itr << " ";
    print();
}
template<class T, class... Args>
inline void print(const T &x, const Args &... args) {
    cout << x << " ";
    print(args...);
}
#ifdef MINATO_LOCAL
#define dump(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl;
inline void debug() {cerr << endl;}
template<class T>
inline void debug(const vector<T> &v) {
    for (auto itr = v.begin(); itr != v.end(); ++itr) cerr << *itr << " ";
    debug();
}
template<class T, class... Args>
inline void debug(const T &x, const Args &... args) {
    cerr << x << " ";
    debug(args...);
}
#else
#define dump(x) void(0)
inline void debug() {}
template<class T> inline void debug(const vector<T> &v) {}
template<class T, class... Args> inline void debug(const T &x, const Args &... args) {}
#endif
struct Fast_ios {Fast_ios() {cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(20);};} fast_ios;
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

int main() {
    int N,Q; cin >> N >> Q;
    fenwick_tree<ll> BIT(N);
    rep(i,N) {
        int a; cin >> a;
        BIT.add(i,a);
    }
    while (Q--) {
        int t; cin >> t;
        if (t) {
            int l,r; cin >> l >> r;
            cout << BIT.sum(l,r) << ln;
        } else {
            int p,x; cin >> p >> x;
            BIT.add(p,x);
        }
    }
}


Measured memory_bytes: 8256
import java.io.*;
import java.util.*;
 
class Main {
  public static void main(String[] args)throws IOException{
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    String str = br.readLine();
     
    String[] strAry = str.split(" ");
    
    Arrays.sort(strAry);
    System.out.println(strAry[0] + " " + strAry[1] + " " + strAry[2]);
  
    
  }
}

Measured memory_bytes: 24244
x, y, z, k = gets.split.map(&:to_i)
ones = gets.split.map(&:to_i).sort { |a, b| b <=> a }
twos = gets.split.map(&:to_i).sort { |a, b| b <=> a }
threes = gets.split.map(&:to_i).sort { |a, b| b <=> a }

answers = []
ones.each do |one|
  twos.each do |two|
    changed = false
    threes.each do |three|
      sum = one + two + three
      if answers.size < k || sum > answers.first
        index = answers.bsearch_index { |item| item > sum }
        index ||= -1
        answers.insert(index, sum)
        changed = true
        answers.shift if answers.size > k
      else
        break
      end
    end
  # break unless changed
  end
end
answers.reverse.each { |answer| puts answer }


Measured memory_bytes: 1912
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define srep(i,s,t) for(int i = s; i < t; ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
#define yn {puts("Yes");}else{puts("No");}
#define MAX_N 200005

vector<P> G[MAX_N];

int now = 0;
int ans = 0;

int col[MAX_N];

void dfs(int x){
    int keep = now;
    rep(i,G[x].size()){
        if(col[G[x][i].second] != -1){
            ;
        }else{
            col[G[x][i].second] = (now + 1) % ans;
            now++;
            dfs(G[x][i].first);
        }
    }
    now = keep;
}

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

    int cnt[n] = {};
    rep(i,n)col[i] = -1;

    rep(i,n-1){
        int a, b;
        cin >> a >> b;
        a--; b--;
        G[a].push_back(P(b,i));
        G[b].push_back(P(a,i));
        cnt[a]++;
        cnt[b]++;
        ans = max(ans, cnt[a]);
        ans = max(ans, cnt[b]);
    }

    // dfs(0);

    queue<pair<int,int>> que;
    que.push(P(0,-1));

    while(que.size() > 0){
        int x = que.front().first;
        now = que.front().second;
        que.pop();

        

        rep(i, G[x].size()){
            if(col[G[x][i].second] == -1){
                col[G[x][i].second] = (now+1) % ans;
                now++;
                que.push(P(G[x][i].first, col[G[x][i].second]));
            }
        }

    }


    cout << ans << endl;
    rep(i,n-1)cout << col[i] + 1 << endl;

    return 0;
}




Measured memory_bytes: 12956
#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
int main() {
	int a,b;
	while(scanf("%d %d",&a,&b)!=EOF&&(a!=0||b!=0)) {
		for(int i=0; i<a; i++) {
			for(int j=0; j<b; j++)
				{
				if(j!=0&&j!=b-1&&i!=0&&i!=a-1)
					cout<<".";
				else
					cout<<"#";
					}
			cout<<endl;
		}
		cout<<endl;
	}
	return 0;
}


Measured memory_bytes: 3152
#include <bits/stdc++.h>
using namespace std;
const long long infty = 1e18;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, m;
  cin >> n >> m;
  vector<vector<long long>> dst(n, vector<long long>(n));
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      if (i != j) {
        dst[i][j] = infty;
      } else {
        dst[i][j] = 0;
      }
    }
  }
  for (int i = 0; i < m; i++) {
    int s, t, d;
    cin >> s >> t >> d;
    dst[s][t] = d;
  }  
  for (int k = 0; k < n; k++) {
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < n; j++) {
        if (dst[i][k] != infty && dst[k][j] != infty) {
          dst[i][j] = min(dst[i][j], dst[i][k] + dst[k][j]);
        }
      }
    }
  }
  for (int i = 0; i < n; i++) {
    if (dst[i][i] < 0) {
      cout << "NEGATIVE CYCLE" << '\n';
      return 0;
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      if (dst[i][j] != infty) {
        cout << dst[i][j];
      } else {
        cout << "INF";
      }
      if (j < n - 1) {
        cout << ' ';
      } else {
        cout << '\n';
      }
    }
  }
  return 0;
}


Measured memory_bytes: 3228
//ABC115B
#include <bits/stdc++.h>
#include <iostream>
#include <iomanip>
#include <numeric>
#include <math.h>
#include<stdio.h>
using namespace std;

int main(){
	int n;
	cin >> n;
	vector<int> p(n);
	int ans = 0;
	for(int i=0;i<n;i++){
		cin >> p.at(i);
	}
	sort(p.begin(),p.end());
	for(int i=0;i<n-1;i++){
		ans += p.at(i);
	}
	ans += p.at(n-1)/2;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#define MAX_N 100000
using namespace std;
int main(void){
    // Here your code 
    int n,ans=1;
    cin>>n;
    int a[n],k[MAX_N]={0};
    bool flag=false;
    
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    
    int up=0,down=0;
    
    for(int i=0;i<n-1;i++){
        if(a[i]<a[i+1]){
            up++;
        }
        if(a[i]>a[i+1]){
            down++;
        }
        if(up*down){
            up=0;
            down=0;
            ans++;
        }
    }
    
    cout<<ans<<endl;
}


Measured memory_bytes: 640
//#pragma GCC optimize("Ofast",3,"inline")
#include<bits/stdc++.h>
using namespace std;
#define fir first
#define sec second
#define m_p make_pair
#define y1 ygftgfgcdtfgxffgx
#define y2 yfdsesgvtyghftfvv
#define x1 xvyr6cf6fgcfgf676
#define x2 xcr6rfc5r66y6r6fr
#define up_bound upper_bound
#define low_bound lower_bound
#define next_per next_permutation
#define pb push_back
#define i_to_s to_string
typedef priority_queue<int> p_queue;
typedef priority_queue<int, vector<int>, greater<int> > min_p_queue;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
int mon[20]={31,28,31,30,31,30,31,31,30,31,30,31};
ll gcd(ll x,ll y){return ((y==0)?x:gcd(y,x%y));}
long long n,ans1,f[100001],a[100001];
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
//	freopen(".in","r",stdin);
//	freopen(".out","w",stdout);
   	cin>>n;
   	for(int i=1;i<=n;i++)
   		cin>>a[i];
    for(int i=n-1;i>=1;i--){
        if(a[i]>=a[i+1])f[i]=f[i+1]+1;
        ans1=max(ans1,f[i]); 
    }
    cout<<ans1;
}


Measured memory_bytes: 1792
module Main where

import Control.Applicative
import Control.Monad
import Text.Printf (printf)

main :: IO ()
main = do
    [x1, y1, x2, y2] <- fmap read . words <$> getLine :: IO [Int]
    let dx = - (y2 - y1)
    let dy = x2 - x1
    printf "%d %d %d %d\n"
        (x2 + dx) (y2 + dy) (x1 + dx) (y1 + dy)

Measured memory_bytes: 508
#include<bits/stdc++.h>
using namespace std;
#define INF 1000000000

int main(){
    typedef struct TEAM{
        int AC;
        int WA[12];
        int PE;
        int num;
    } team;

    while(1){
        int m, t, p, r; cin >> m >> t >> p >> r;
        if(t == 0) break;
        team Team[55];
        
        //?????????
        for(int i = 1; i <= t; i++){
            Team[i].num = i;
            Team[i].AC = 0;
            Team[i].PE = 0;
            for(int j = 1; j <= p; j++) Team[i].WA[j] = 0;
        }

        
        //?????°????????????
        for(int i = 0; i < r; i++){
            int tID, pID, ti; cin  >> ti >> tID >> pID;
            int j; cin >> j;

            if(j != 0){
                Team[tID].WA[pID]++;
            }else{
                Team[tID].AC++;
                Team[tID].PE += Team[tID].WA[pID] * 20 + ti;
            }
        }

        int flag = 1;

        while(flag == 1){
            flag = 0;
            for(int i = 1; i < t; i++){
                if(Team[i].num < Team[i + 1].num){
                    team temp;
                    temp = Team[i];
                    Team[i] = Team[i + 1];
                    Team[i + 1] = temp;
                    flag = 1;
                    //if(Team[i].PE == Team[j].PE) cout << "nuko" << endl;
                }
            }
        }

        flag = 1;

        while(flag == 1){
            flag = 0;
            for(int i = 1; i < t; i++){
                if(Team[i].PE > Team[i + 1].PE){
                    team temp;
                    temp = Team[i];
                    Team[i] = Team[i + 1];
                    Team[i + 1] = temp;
                    flag = 1;
                    //if(Team[i].PE == Team[j].PE) cout << "nuko" << endl;
                }
            }
        }

        flag = 1;
        while(flag == 1){
            flag = 0;
            for(int i = 1; i < t; i++){
                if(Team[i].AC < Team[i + 1].AC){
                    team temp;
                    temp = Team[i];
                    Team[i] = Team[i + 1];
                    Team[i + 1] = temp;
                    flag = 1;
                    //if(Team[i].PE == Team[j].PE) cout << "nuko" << endl;
                }
            }
        }

        for(int i = 1; i <= t; i++){
            if(i == t) cout << Team[i].num;
            else if(Team[i].AC == Team[i + 1].AC && Team[i].PE == Team[i + 1].PE) cout << Team[i].num << "=";
            else cout << Team[i].num << ",";
        }
        cout << endl;
    }

    
    return 0;
}

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

///Author:Refat(BSMRSTU)///

#define ll long long
#define ull unsigned long long
#define ff first
#define ss second
#define pb push_back
#define vi vector<int>
#define pii pair<int,int>
#define pil pair<int,ll>
const int N = 1e5 + 5;
const int M = 1e9 + 7;
int Set(int N,int pos) {
    return N=N | (1<<pos);
}
int reset(int N,int pos) {
    return N= N & ~(1<<pos);
}
bool check(int N,int pos) {
    return (bool)(N & (1<<pos));
}
int ar[100005];
int main() {
    /// freopen("input.txt","r",stdin);
    /// freopen("output.txt","w",stdout);
    int n,ck=1;
    scanf("%d",&n);
    for(int i=1; i<=n; i++) {
        scanf("%d",&ar[i]);
    }
    for(int i=n; i>=1; i--) {
        if(ar[i-1]>ar[i]) {
            ar[i-1]-=1;
        }
    }
    for(int i=1; i<=n; i++) {
        if(ar[i-1]>ar[i]) {
            ck=0;
            break;
        }
    }
    if(ck==1) {
        printf("Yes\n");
    } else {
        printf("No\n");
    }
   // main();
    return 0;
}



Measured memory_bytes: 640
using System;
using System.Linq;

namespace ABC103
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int[] a = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int answer = 0;
            for (int i = 0; i < a.Length; i++)
            {
                answer += a[i];
            }
            answer -= a.Length;
            Console.WriteLine(answer);
        }
    }
}


Measured memory_bytes: 13268
#include <iostream>

int main(void){

	int W, _a, _b;

	std::cin >> W >> _a >> _b;

	int a = (_a<_b) ? _a:_b;
	int b = (_a>_b) ? _a:_b;

	int r = (b-a-W);

	std::cout << ((r>0)?r:0);

	return 0;
}


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

#define rep(i,n) for(ll i = 0; i < n; i++)
#define per(i,n) for(ll i = n-1; i >= 0; i--)
#define REP(i,n) for(ll i = 1; i < n; i++)
#define PER(i,n) for(ll i = n; i >= 1; i--)
#define sz(x) int(x.size())
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define YesorNo(a) printf(a ? "Yes\n" : "No\n")
#define endl '\n'
#define fi first
#define se second
using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
using vi = vector<int>;
using vii = vector<vi>;
using vl = vector<ll>;
using vll = vector<vl>;
using vs = vector<string>;
using vb = vector<bool>;
using vc = vector<char>;
using vcc = vector<vc>;
using vP = vector<P>;
using vPP = vector<vP>;
using vPl = vector<Pl>;
const int dx[] = {0,1,0,-1,1,1,-1,-1};
const int dy[] = {1,0,-1,0,1,-1,-1,1};
const int inf = (1<<30)-1;
const ll infll = (1LL<<62)-1;
ll ceil(const ll &a, const ll &b){return ((a)+(b)-1)/b;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }



int main(){
  int a, b;
  cin >> a >> b;
  cout << a*b << endl;
}

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

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

    int tap_flag = 1;
    for (int i = 0; i < n; ++i){
        if (i%2==0){
            if (s[i]=='R' or s[i]=='U' or s[i]=='D'){
                continue;
            }else{
                tap_flag = 0;
                break;
            }
        }else{
            if (s[i]=='L' or s[i]=='U' or s[i]=='D'){
                continue;
            }else{
                tap_flag = 0;
                break;
            }
        }
    }
    if (tap_flag==1){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}


Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <cmath>
#include <climits>
#include <cstdlib>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define DEBUG 1
using namespace std;
constexpr int kMod = 1000000007;
typedef long long LL;

std::vector<bool> UpFlags(int n, int size) {
  std::vector<bool> up_flags(size);
  for (int i = 0; i < size; ++i) {
    if (n & (1<<i)) up_flags[i] = true;
    else            up_flags[i] = false;
  }
  return up_flags;
}

int main() {
  string S; cin >> S;
  int L = S.size() - 1;
  LL total = 0;
  for (int i = 0; i < (1 << L); ++i) {
    auto flags = UpFlags(i, L+1);
    LL sum = 0;
    string ss;
    ss = S[0];
    for (int j = 0; j < L; ++j) {
      if (flags[j]) {
        sum += stol(ss);
        ss = S[j+1];
      } else {
        ss += S[j+1];
      }
    }
    sum += stol(ss);
    total += sum;
  }
  cout << total << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define FAST ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
ll inf = 1LL << 55;
ll mod = 1000000007;

using namespace std;

int h[110];

int water (int l, int r){
    if (l > r) return 0;

    int mn = h[l], index = l;
    for (int i = l; i <= r; i++){
        if (mn > h[i]) {
            mn = h[i];
            index = i;
        }
    }

    int res = mn;

    for (int i = l; i <= r; i++){
        h[i] -= res;
    }

    res += water(l, index-1) + water(index+1, r);

    return res;
}

int main(){
    FAST;
    //freopen("in.in", "r", stdin);

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

    cout << water(0, n-1) << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define l_ength size
const int inf = (1<<30);
const int mod = 1000000007; // 998244353
using ll = long long;
using namespace std;

int main(){
	string s; cin >> s;
	cout << ( regex_match(s, regex("^A?KIHA?BA?RA?")) ? "YES" : "NO" ) << endl;
}

Measured memory_bytes: 256
import java.util.*;

public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		List<Integer> listH = new ArrayList<Integer>();
		List<Integer> listW = new ArrayList<Integer>();
		for(;;){
			int H = scan.nextInt();
			int W = scan.nextInt();
			if((H == 0) && (W == 0)){
				break;
			}
			listH.add(H);
			listW.add(W);
		}

		for(int k = 0; k < listH.size(); k++){
			int h = listH.get(k);
			int w = listW.get(k);
			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: 35216
#include<iostream>
#include<string>
using namespace std;
int main()
{
    long long n,m=0,a=0,r=0,c=0,h=0;
    long long x=0;
    string s;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>s;
         if(s[0]=='M')
            m++;
         if(s[0]=='A')
            a++;
         if(s[0]=='R')
            r++;
         if(s[0]=='C')
            c++;
         if(s[0]=='H')
            h++;
    }
    x=m*a*r+m*a*c+m*a*h+m*r*c+m*r*h+m*c*h+a*r*c+a*r*h+a*c*h+r*c*h;
    cout<<x<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>

using namespace std;
int main()
{
	int a, b;
	cin >> a;
	bool flg=false;
	for (int i = 1; i <= 9; i++) {
		for (int k = 1; k <= 9; k++) {
			if (i * k == a) {
				flg = true;
				
				break;
			}
			
		}
	}
	if (flg) {
		flg = true;
		cout << "Yes" << endl;
		
	}
	else {
		cout << "No" << endl;

	}

}



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

using namespace std;

int n;

struct node
{
    int x,t;
}a[200001];

bool cmp(node a, node b)
{
    return a.x > b.x;
}

int main()
{
    scanf("%d",&n);
    for(int i = 1;i <= n;i++)
        scanf("%d%d",&a[i].t,&a[i].x);
    sort(a + 1,a + 1 + n,cmp);
    int s = a[1].x;
    int flag = 0;
    for(int i = 1;i <= n;i++)
    {
        if(s > a[i].x)
            s = a[i].x;
        s -= a[i].t;
        if(s < 0)
            flag = 1;
    }
    if(flag)
        printf("No\n");
    else
        printf("Yes\n");
    return 0;
}


Measured memory_bytes: 1792
using namespace std;
#include <algorithm>
#include <cstdio>

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

#define MAX_N 100
#define MAX_M 100

int N, M;
int t_cards[MAX_N];
int h_cards[MAX_M];


void load1() {
  scanf("%d %d", &N, &M);
  REP(i, N) {
    scanf("%d", &t_cards[i]);
  }
  REP(i, M) {
    scanf("%d", &h_cards[i]);
  }
}

int solve1() {
  if( N == 0 and M == 0 ) {
    return 0;
  }
  int t_sum = 0;
  REP(i, N) {
    t_sum += t_cards[i];
  }
  int h_sum = 0;
  REP(i, M) {
    h_sum += h_cards[i];
  }
  sort(t_cards, t_cards+N);
  sort(h_cards, h_cards+M);
  int diff = t_sum - h_sum;
  int i = 0;
  int j = 0;
  
  while(i < N and j < M) {
    int d = (t_cards[i] - h_cards[j])*2;
    if( d == diff ) {
      printf("%d %d\n", t_cards[i], h_cards[j]);
      return 1;
    }
    if( d > diff ) {
      ++j;
      continue;
    } else {
      ++i;
      continue;
    }
  }
  printf("-1\n");
  return 1;
}

int main() {
  do {
    load1();
  } while( solve1() );
  return 0;
}

Measured memory_bytes: 1056
//#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
template <typename T>
using ordered_set =
    tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define ll long long
#define ld long double
#define pi pair<int,int>
#define pd pair<ld,ld>
#define ft first
#define sd second
#define st first
#define nd second
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define FOR(i,a,b) for(int i=(a); i<=(b);i++)
#define F(i,a,b) FOR(i,(a),(b)-1)
#define REV(i,a,b) for(int i=(a); i>=(b);i--)
#define VI vector<int>
#define VPI vector<pi>
#define VPD vector<pd>
#define PI 3.14159265
#define all(x) (x).begin(), (x).end()
#define sz(a) (int)((a).size())
#define int long long

template<class TH> void _dbg(const char *sdbg, TH h){cerr<<sdbg<<"="<<h<<"\n";}
template<class TH, class... TA> void _dbg(const char *sdbg, TH h, TA... a) {
	while(*sdbg!=',')cerr<<*sdbg++;cerr<<"="<<h<<","; _dbg(sdbg+1, a...);
}
#define debug(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
mt19937 r(chrono::steady_clock::now().time_since_epoch().count());
int rand_range(int a, int b)
{
	assert(a<=b);
	return a+r()%(b-a+1);
}
const long long K = 1000;
const long long KK = K*K;
const long long MIL = KK*K;
const long long INF = MIL*MIL;
const long long MOD = MIL+7;
const long long N = 2e6 + 10, M=10;

void solve(){
    int k, x;
    cin>>k>>x;
    set<int> s;
    FOR(i,x-k+1, x)
        s.insert(max(-2*KK, i));
    FOR(i,x, x + k - 1)
        s.insert(min(2*KK, i));
    for(auto i:s)
        cout<<i<<" ";
}

int32_t main()
{
//	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);

	//ios_base::sync_with_stdio(0);
	//cin.tie(0);
	//cout.tie(0);
	cerr.tie(0);
	cout<<setprecision(9)<<fixed;
	cerr<<setprecision(6)<<fixed;
	int test = 1, f;
    //cin>>test;
	F(_test, 0, test){
        //cout<<"Case #"<<_test + 1<<": ";
		solve();
//		if(_test == 1)
//            return 0;
	}
}
/*
1
WSSWW
*/


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long int
#define ld long double
#define inf LLONG_MAX>>2
#define MAX 1000000
#define mod 1000000007
#define pb push_back
#define f(i,a,n,x) for ((i)=(a);(i)<(n);(i)+=(x))
#define fd(i,a,n,x) for ((i)=(a);(i)>=(n);(i)-=(x))
#define fi first
#define se second
#define mk make_pair
#define pi pair
#define vt vector
using namespace std;
void read(vt<ll> &a,ll n){ll i,temp;f(i,0,n,1){cin>>temp;a.pb(temp);}}
void solve(){
    ll n,i,ans=0,a,b;
    vt<ll> x;
    cin>>n>>a>>b;
    read(x,n);
    f(i,0,n-1,1)
        if ((x[i+1]-x[i])*a>b)
            ans+=b;
        else
            ans+=(x[i+1]-x[i])*a;
    cout<<ans<<endl;
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll t=1;
    //cin>>t;
    while(t--)
        solve();
    return 0;
}

Measured memory_bytes: 4264
N = int(input())
# 二重階乗
if N % 2 == 1:
    print(0)
    exit()
# 単純に5の素因数数を数えたので事足りる?
ans = N // 10
for i in range(2,30):
    m = 10**i//2**(i-1)
    ans += N // m 
print(ans)


Measured memory_bytes: 2940
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define pb(x) push_back(x);
#define mp(x,y) make_pair(x,y)
#define X first
#define Y second
typedef long long int ll;
typedef pair<ll,ll> pp;

#define debug(x) cout << #x << " :: "<< x <<"\n";
#define debug2(x,y) cout << #x << " :: "<< x << "\t" << #y << " :: " << y << "\n";
#define debug3(x,y,z) cout << #x << " :: "<< x << "\t" << #y << " :: " << y << "\t" << #z << " :: " << z << "\n";
#define boost ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree< pair<ll,ll> , null_type,less< pair<ll,ll> >, rb_tree_tag,tree_order_statistics_node_update>

int main()
{
    boost
    ll a,b,m;
    cin >> a >> b >> m;
    ll v1[a],v2[b],x1=LLONG_MAX,y1=LLONG_MAX;
    for(ll i=0;i<a;i++) {
        cin >> v1[i];
        x1=min(x1,v1[i]);
    }
    for(ll i=0;i<b;i++) {
        cin >> v2[i];
        y1=min(x1,v2[i]);
    }
    ll ans=LLONG_MAX;
    for(ll i=0;i<m;i++) {
        ll x,y,c;
        cin >> x >> y >> c;
        ans=min(ans,max(0LL,v1[x-1]+v2[y-1]-c) );
    }
    ans=min(ans,x1+y1);
    cout << ans ;
    return 0;
}


Measured memory_bytes: 1792
def cal_expe(x):
  ret = (1 + x) / 2
  return ret

N,K = map(int, input().split())
data = [int(i) for i in input().split()]
sma = 0
for i in range(N):
  data[i] = cal_expe(data[i]) + sma
  sma = data[i]
max_score = data[K-1]
for i in range(K-1,N):
  pro = data[i] - data[i-K]
  if pro > max_score:
    max_score = pro
print(max_score)

Measured memory_bytes: 25188