akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define IOS ios_base::sync_with_stdio(false);cin.tie(0)
#define pb push_back
#define ff first
#define ss second
#define all(a) a.begin(),a.end()
#define int long long
const int MOD=1e9+7;
const int N=2e5+10;
int gcd(int n,int m)
{
    if(n==0)
        return m;
    else
        return gcd(m%n,n);
}
int32_t main()
{
    IOS;
    int h,w,n;
    cin>>h>>w>>n;
    int k=max(h,w);
    cout<<(n+k-1)/k<<endl;
    


}

Measured memory_bytes: 256
import java.util.Scanner;

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

		int n = sc.nextInt();
		int a = sc.nextInt();
		int b = sc.nextInt();
		int sum=0;

		for(int i=0;n>=i;i++) {
			int s=i;
			int check=0;
			while(true) {
			    check=check+(s%10);
			    s=s/10;
			    if(s==0)
			    	break;
			}
			if(check>=a&&check<=b) {
				sum=sum+i;
			}

		}
		System.out.println(sum);



	}

}


Measured memory_bytes: 21844
import itertools
n = int(input())
p = list(map(float,input().split()))
p = [0] + p
#３回コインを投げて表が２回出る確率＝既に表が２回出ていて３回目に裏が出る確率＋既に表が１回出ていて３回目に表が出る確率
dp = [[0] * (n+1) for i in range(n+1)]
dp[1][0] = 1 - p[1]
dp[1][1] = p[1]
for i in range(1,n):
    for j in range(i+2):
        if j != 0:
            dp[i+1][j] = dp[i][j] * (1 - p[i+1]) + dp[i][j-1] * p[i+1]
        else:
            dp[i+1][j] = dp[i][j] * (1 - p[i+1])
ans = 0

for i in range(n // 2 + 1, n+1):
    ans +=dp[-1][i]
print(ans)

Measured memory_bytes: 203768
import java.util.Scanner;
 
public class Main {
 
	public static final MyScanner in = new MyScanner();
 
	public static void main(String[] args) {

		long K = in.nextInt();
		long sum = 0;
		for(int i=1;i<K+1;i++) {
			for (int j=1;j<K+1;j++) {
				for(int k=1;k<K+1;k++) {
					int a = gcd(i,j);
					sum += gcd(a, k);
				}
			}
		}

		System.out.println(sum);

	}

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

	    return gcd(b, a % b);
	}

	public static class MyScanner {
		Scanner sc = new Scanner(System.in);
		String next() { return sc.next();}
		int nextInt() { return Integer.valueOf(sc.next());}
		long nextLong() { return Long.valueOf(sc.next()); }
	}
}

Measured memory_bytes: 35708
package main

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

func main() {
	r := bufio.NewReader(os.Stdin)
	var n int
	var t int
	fmt.Fscan(r, &n)
	fmt.Fscan(r, &t)
	ts := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Fscan(r, &ts[i])
	}

	sum := 0
	b := ts[0]
	for i := 1; i < n; i++ {
		sum += min(ts[i]-b, t)
		b = ts[i]
	}
	sum += t
	fmt.Println(sum)
}

func min(x, y int) int {
	if x < y {
		return x
	}
	return y
}

func max(x, y int) int {
	if x > y {
		return x
	}
	return y
}

func abs(x int) int {
	if x < 0 {
		return -x
	}
	return x
}


Measured memory_bytes: 4992
import scala.util.control.Breaks._

object Main extends App {
  val Array(n, k) = scala.io.StdIn.readLine.split(" ").map(_.toLong)

  val list = List.fill(n.toInt) { scala.io.StdIn.readLine.split(" ").map(_.toLong) }

  val sorted_list = list.sortBy(_.head)

  var count = 0L
  breakable {
    for (i <- sorted_list) {

      if (count + i(1) >= k) {
        println(i.head)
        break
      } else {
        count += i(1)
      }
    }
  }
}


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

typedef pair<int, int> Pii;

int main() {
  int T, P, R;
  while ( cin >> T >> P >> R, T ) {
    vector<int> cnt(T, 0);
    vector<vector<int> > solved(T, vector<int>(P, 0));    
    vector<int> times(T, 0);    
    vector<vector<int> > pena(T, vector<int>(P, 0));    
    while ( R-- ) {
      int m, t, p;
      string j;
      cin >> t >> p >> m;
      cin >> j;
      t--; p--;
      if ( j == "CORRECT" ) {
	if ( solved[t][p] ) continue;
	solved[t][p] = 1;
	times[t] += m;
	times[t] += pena[t][p]*1200;	
	cnt[t]++;	
      } else if ( !solved[t][p] ) {
	pena[t][p]++;
      }
    }

    vector<Pii> ps[P+1];    
    for ( int i = 0; i < T; i++ ) {
      ps[cnt[i]].push_back(Pii(times[i], i));      
    }

    for ( int i = P; i >= 0; i-- ) {
      if ( !ps[i].size() ) continue;
      sort(ps[i].begin(), ps[i].end());
      for ( int j = 0; j < (int)ps[i].size(); j++ ) {
	cout << ps[i][j].second+1 << " " << i << " " << ps[i][j].first << endl;	
      }
    }
      
  }

  return 0;
}



Measured memory_bytes: 3200
N = int(input())
H = list(map(int,input().split()))
J = [0 for k in range(N+1)]

for k in range(1,N):
    if H[k-1] >= H[k] and J[k-1] > 0:
        J[k] = J[k-1]+1
    elif H[k-1] >= H[k] and J[k-1] == 0:
        J[k] = 1

print(max(J))


Measured memory_bytes: 64228
#include <stdio.h>
#include <string>
#include <iostream>
#include <vector>
#include <queue>
#include <list>
#include <algorithm>
#include <map>
#include <iterator>
#include <limits>
#include <numeric>
#include <type_traits>
#include <cmath>
#include <cstdlib>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
using namespace std;

#define ALL(v) (v).begin(), (v).end()
#define endl "\n"
typedef long long int ll;

template<typename T>
ostream& operator << (ostream& os, vector<T>& vec) {
	for (int i = 0; i<vec.size(); i++) {
		os << vec[i] << (i + 1 == vec.size() ? "" : " ");
	}
	return os;
}

int SumDigitValues(int x)
{
	int sum = 0;
	while (x)
	{
		sum += x % 10;
		x = x / 10;
	}

	return sum;
}

int Factorial(int n)
{
	if (n < 0) return 0;
	if (n == 0) return 1;
	return n * Factorial(n - 1);
}

int factorial(int n)
{
	if (n > 1)
	{
		return n * factorial(n - 1);
	}
	else
	{
		return 1;
	}
}

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

vector<int> Divisors(int x)
{
	vector<int> divisors;
	divisors.push_back(1);
	for (int a = 2; a <= x; a++)
	{
		if (x % a == 0) divisors.push_back(a);
	}
	return divisors;
}

vector<int> CommonDivisors(int a, int b)
{
	vector<int> divisorsA = Divisors(a);
	vector<int> divisorsB = Divisors(b);
	vector<int> commonDivisors;
	set_intersection(divisorsA.begin(), divisorsA.end(), divisorsB.begin(), divisorsB.end(), std::back_inserter(commonDivisors));
	return commonDivisors;
}

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

	int a, b;
	cin >> a >> b;
	if (a >= 13)
	{
		cout << b << endl;
		return 0;
	}

	if (6 <= a && a <= 12)
	{
		cout << b / 2 << endl;
		return 0;
	}

	cout << 0 << endl;
}

Measured memory_bytes: 256
n = int(input())
a = [int(v) for v in input().split()]
b = [int(v) for v in input().split()]
c = [int(v) for v in input().split()]

ans = b[a[0] - 1]
for i in range(1, n):
    ans += b[a[i] - 1]
    if a[i-1] + 1 == a[i]:
        ans += c[a[i-1]-1]

print(ans)


Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define gc getchar()
#define ll long long
#define pb push_back
#define mk make_pair
#define rint register int
using namespace std;
const int mod = 1e9+7;
inline int read(){int w=1,s=0;char ch=getchar();while(!isdigit(ch)){if(ch=='-')w=-1;ch=getchar();}while(isdigit(ch)){s=s*10+ch-'0';ch=getchar();}return  w*s;}
int f[1000100];
int dp[630][630];
int X[100010],Y[100010];
int n,k;
int vis[1000010];
int lk[1000001];
int main()
{
	n=read();k=read();
	for(rint i=1;i<=k;++i)
	{
		X[i]=read(),Y[i]=read();
		vis[X[i]]=vis[Y[i]]=1;lk[X[i]]=Y[i];lk[Y[i]]=X[i];
	}
	for(rint i=1;i<=n<<1;++i) vis[i]+=vis[i-1];
	f[0]=1; ll res=0;
	for(rint i=2;i<=n<<1;i+=2) f[i]=1LL*f[i-2]*(i-1)%mod;
	for(rint l=1;l<=(n<<1);++l)
	{
		for(rint r=l+1;r<=n<<1;r+=2)
		{	int fl=1;
			for(rint p=l;p<=r;++p)
			{
				if(lk[p]&&(lk[p]<l||lk[p]>r)) {fl=0;break;}
			}
			if(!fl) continue;
			dp[l][r]=1ll*f[(r-l+1-vis[r]+vis[l-1])];
			for(rint p=l;p<r;++p)
			{
				dp[l][r]-=1ll*dp[l][p]*f[r-p-vis[r]+vis[p]]%mod;
				dp[l][r]+=mod;
				dp[l][r]%=mod;
			}
			res+=1ll*dp[l][r]*f[2*n-(r-l+1)-vis[n*2]+vis[r]-vis[l-1]]%mod;
			res%=mod;
		}
	}cout<<res;
	return 0;
}
/*
by was_n
18.10.15
*/


Measured memory_bytes: 6400
#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() {
  string s;
  cin >> s;
  if (s.size() < 26) {
    map<char, int> mp;
    rep(i, s.size()) mp[s[i]]++;
    for (char c = 'a'; c <= 'z'; c++) {
      if (mp[c] == 0) {
        cout << s << c << endl;
        return 0;
      }
    }
  }

  if (s == "zyxwvutsrqponmlkjihgfedcba") {
    cout << -1 << endl;
    return 0;
  }

  string t = s;
  next_permutation(t.begin(), t.end());
  rep(i, 26) {
    cout << t[i];
    if (s[i] != t[i]) break;
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 3616
def divisor(x):
    y = list()
    for i in range(1, int(x ** 0.5 + 1)):
        if x % i == 0:
            y.append(i)
            y.append(x // i)
    return y

n = int(input())
a = list(map(int, input().split()))
a.sort()
d0 = divisor(a[0])
d1 = divisor(a[1])
d = dict.fromkeys(d0 + d1)
ans = 1
for di in sorted(list(d.keys()))[::-1]:
    flag = False
    ans_flag = True
    for ai in a:
        if ai % di != 0:
            if flag:
                ans_flag = False
                break
            else:
                flag = True
    if ans_flag:
        ans = di
        break
print(ans)


Measured memory_bytes: 14436
<?php
/*
    URL    : http://kupc2016.contest.atcoder.jp/tasks/kupc2016_b
 
    Score  :
    Result :
    Time   : ms
    Memory : KB
 */
 
ini_set('error_reporting', E_ALL & ~E_NOTICE);
 
$ans = 0;
$arrI = array();
$arrExam = array();
$tmpExam = array();
 
fscanf(STDIN, "%d %d", $N, $K);
for ($i = 0; $i < $N; $i++) {
	fscanf(STDIN, "%s", $P);
	$tmpP = str_split($P);
	$arrI[$tmpP[0]]++;
}
 
while(true) {
	// sleep(1);
	arsort($arrI);
	// var_dump($arrI);
	$arrIkey = array_keys($arrI);
	$cntI = count($arrI);
	if ($cntI < $K) break;
	for ($i = 0; $i < $K; $i++) {
		// echo $arrIkey[$i] . PHP_EOL;
		if ($arrI[$arrIkey[$i]] > 0) {
			$arrI[$arrIkey[$i]]--;
		} else {
			break;
		}
		if ($arrI[$arrIkey[$i]] == 0) {
			unset($arrI[$arrIkey[$i]]);
		}
	}
	$ans++;
}
 
 
echo $ans . PHP_EOL;

Measured memory_bytes: 3580
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		
		int[] cnt = new int[26];
		for(int i=0;i<N;i++){
			for(int j=0;j<M;j++) cnt[S[i][j] - 'a']++;
		}
		
		if(N % 2 == 0 && M % 2 == 0){
			bool chk = true;
			for(int i=0;i<26;i++) if(cnt[i] % 4 != 0) chk = false;
			Console.WriteLine(chk ? "Yes" : "No");
			return;
		}
		if(N % 2 == 1 && M % 2 == 1){
			int n4 = (N / 2) * (M / 2);
			int n2 = (N / 2) + (M / 2);
			for(int i=0;i<26;i++){
				if(n4 == 0) break;
				int nn = Math.Min(n4,cnt[i] / 4);
				n4 -= nn;
				cnt[i] -= 4 * nn;
			}
			if(n4 != 0){
				Console.WriteLine("No");
				return;
			}
			for(int i=0;i<26;i++){
				if(n2 == 0) break;
				int nn = Math.Min(n2,cnt[i] / 2);
				n2 -= nn;
				cnt[i] -= 2 * nn;
			}
			if(n2 != 0){
				Console.WriteLine("No");
				return;
			}
			Console.WriteLine("Yes");
			return;
		}
		
		if(N % 2 == 0 && M % 2 == 1){
			int n4 = (N / 2) * (M / 2);
			int n2 = (N / 2) ;
			for(int i=0;i<26;i++){
				if(n4 == 0) break;
				int nn = Math.Min(n4,cnt[i] / 4);
				n4 -= nn;
				cnt[i] -= 4 * nn;
			}
			if(n4 != 0){
				Console.WriteLine("No");
				return;
			}
			for(int i=0;i<26;i++){
				if(n2 == 0) break;
				int nn = Math.Min(n2,cnt[i] / 2);
				n2 -= nn;
				cnt[i] -= 2 * nn;
			}
			if(n2 != 0){
				Console.WriteLine("No");
				return;
			}
			Console.WriteLine("Yes");
			return;
		}
		
		
		if(N % 2 == 1 && M % 2 == 0){
			int n4 = (N / 2) * (M / 2);
			int n2 = (M / 2) ;
			for(int i=0;i<26;i++){
				if(n4 == 0) break;
				int nn = Math.Min(n4,cnt[i] / 4);
				n4 -= nn;
				cnt[i] -= 4 * nn;
			}
			if(n4 != 0){
				Console.WriteLine("No");
				return;
			}
			for(int i=0;i<26;i++){
				if(n2 == 0) break;
				int nn = Math.Min(n2,cnt[i] / 2);
				n2 -= nn;
				cnt[i] -= 2 * nn;
			}
			if(n2 != 0){
				Console.WriteLine("No");
				return;
			}
			Console.WriteLine("Yes");
			return;
		}
		
		
		
		
		
		
	}
	int N,M;
	String[] S;
	public Sol(){
		var d = ria();
		N = d[0]; M = d[1];
		S = new String[N];
		for(int i=0;i<N;i++) S[i] = rs();
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}


Measured memory_bytes: 13396
#include "cstdio"
#include "cstring"
using namespace std;

const int maxn=120;
int n,m,ans;
int dx[4]={0,0,1,-1};
int dy[4]={1,-1,0,0};
int vis[maxn][maxn];
char mp[maxn][maxn];

void dfs(int x,int y,char t)
{
	vis[x][y]=1;
	for(int i=0;i<4;i++)
	{
		int px=x+dx[i];
		int py=y+dy[i];
		if(px>=0 && py>=0 && px<n && py<m && !vis[px][py] && mp[px][py]==t)
			dfs(px,py,t);
	}
}

int main()
{
	//freopen("c.txt","r",stdin);
	while(scanf("%d%d",&n,&m) && n && m)
	{
		for(int i=0;i<n;i++)
			for(int j=0;j<m;j++)
			{
				mp[i][j]=getchar();
				while(mp[i][j]=='\0' || mp[i][j]=='\n')mp[i][j]=getchar();
			}
		ans=0;
		memset(vis,0,sizeof(vis));
		for(int i=0;i<n;i++)
			for(int j=0;j<m;j++)
				if(!vis[i][j])
				{
					ans++;
					dfs(i,j,mp[i][j]); 
				}
		printf("%d\n",ans);
	}
	return 0;
}


Measured memory_bytes: 3228
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int r = sc.nextInt();

        if (n < 10) {
            // 100 × (10 − K)
            System.out.println(r + (100 * (10 - n)));
        } else {
            System.out.println(r);
        }
        sc.close();
    }
}


Measured memory_bytes: 23120
from collections import defaultdict

K = int(input())


def calcGcd(a, b):
    large = max(a, b)
    small = min(a, b)
    while (True):
        num = large % small
        large = small
        small = num
        if small == 0:
            return large


ans = 0
dd = defaultdict(int)
for i in range(1, K + 1):
    for j in range(1, K + 1):
        dd[calcGcd(i, j)] += 1

for num in dd.keys():
    for k in range(1, K + 1):
        ans += calcGcd(num, k) * dd[num]

print(ans)


Measured memory_bytes: 9464
n = int(input())
d = list()
for a in range(0, n):
    d.append(int(input()))

d.sort(reverse=True)
before = d[0]
ans = 0

for a in range(1, n):
    if before > d[a]:
        ans += 1
    before = d[a]

print(ans+1)


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

#define ll long long int
#define f(i,g,n) for(int i=g;i<=n;i++)

int main()
{
	ios::sync_with_stdio(false);

	int a;
	string S;
	cin>>a>>S;
	a < 3200 ? cout<<"red\n" : cout<<S<<"\n";

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,s,n) for (int i = (s); i < (n); ++i)
#define rrep(i,n,g) for (int i = (n)-1; i >= (g); --i)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define len(x) (int)(x).size()
#define dup(x,y) (((x)+(y)-1)/(y))
#define pb push_back
#define Field(T) vector<vector<T>>
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main() {
  int n, k;
  cin >> n >> k;
  cout << 1 + dup(n-k, k-1) << endl;
  return 0;
}


Measured memory_bytes: 3624
// Author : ps41

#include <bits/stdc++.h>
using namespace std;
#define ll int64_t
const ll M = 1e9 + 7, N = 1e6 + 5;
ll vis[N];
vector<vector<ll>> G(N);

void dfs(ll node)
{
    vis[node] = 1;
    for (auto i: G[node]) if (!vis[i]) dfs(i);
}

int main()
{
    ios::sync_with_stdio(false), cin.tie(nullptr);
    ll n, m;
    cin >> n >> m;
    for (ll i = 0; i < m; i++)
    {
        ll u, v;
        cin >> u >> v;
        G[u].push_back(v);
        G[v].push_back(u);
    }
    ll ans = 0;
    for (ll i = 1; i <= n; i++)
    {
        if (!vis[i]) ans++, dfs(i);
    }
    cout << ans - 1;
}

Measured memory_bytes: 31660
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstring>
using namespace std;

const int N_MAX = 100002;
bool ac[N_MAX];
int wa[N_MAX];

int main(){
    int n, m;
    cin >> n >> m;
    memset(ac, false, sizeof(ac));
    memset(wa, 0, sizeof(wa));

    for(int i = 0; i < m; i++){
        int p;
        string S;
        cin >> p >> S;
        if (S == "AC")ac[p] = true;
        else {
            if (!ac[p])wa[p]++;
        }
    }
    int wanum = 0;
    int acnum = 0;
    for(int i = 1; i <= n; i++){
        if (ac[i]){
            acnum++;
            wanum += wa[i];
        }
    }
    cout << acnum << " " << wanum << endl;
    return 0;
}

Measured memory_bytes: 768
;; -*- coding: utf-8 -*-
(eval-when (:compile-toplevel :load-toplevel :execute)
  (defparameter OPT
    #+swank '(optimize (speed 3) (safety 2))
    #-swank '(optimize (speed 3) (safety 0) (debug 0)))
  #+swank (progn (ql:quickload '(:cl-debug-print :fiveam))
                 (shadow :run)
                 (use-package :fiveam)))
#+swank (cl-syntax:use-syntax cl-debug-print:debug-print-syntax)

;; BEGIN_INSERTED_CONTENTS
(defmacro with-output-buffer (&body body)
  "Buffers all outputs to *STANDARD-OUTPUT* and flushes them to
*STANDARD-OUTPUT* at the end. Note that only BASE-CHAR is allowed."
  (let ((out (gensym)))
    `(let ((,out (make-string-output-stream :element-type 'base-char)))
       (let ((*standard-output* ,out))
         ,@body)
       (write-string (get-output-stream-string ,out)))))

(defmacro dbg (&rest forms)
  #+swank
  (if (= (length forms) 1)
      `(format *error-output* "~A => ~A~%" ',(car forms) ,(car forms))
      `(format *error-output* "~A => ~A~%" ',forms `(,,@forms)))
  #-swank (declare (ignore forms)))

(defmacro define-int-types (&rest bits)
  `(progn
     ,@(mapcar (lambda (b) `(deftype ,(intern (format nil "UINT~A" b)) () '(unsigned-byte ,b))) bits)
     ,@(mapcar (lambda (b) `(deftype ,(intern (format nil "INT~A" b)) () '(signed-byte ,b))) bits)))
(define-int-types 2 4 7 8 15 16 31 32 62 63 64)

(declaim (inline println))
(defun println (obj &optional (stream *standard-output*))
  (let ((*read-default-float-format* 'double-float))
    (prog1 (princ obj stream) (terpri stream))))

(defconstant +mod+ 1000000007)

;; Body
(defun main ()
  (declare #.OPT)
  (let* ((m (read))
         (k (read))
         (len (expt 2 (+ m 1)))
         (res (make-array len :element-type 'uint32)))
    (declare (uint32 k)
             ((integer 0 17) m))
    (with-output-buffer
      (cond ((zerop k)
             (dotimes (i len (terpri))
               (unless (zerop i) (write-char #\ ))
               (write (floor i 2))))
            ((and (/= m 1) (< k (expt 2 m)))
             (let ((index 0))
               (dotimes (num (expt 2 m))
                 (if (= num k)
                     (progn (setf (aref res (- (expt 2 m) 1)) num)
                            (setf (aref res (- len 1)) num))
                     (progn
                       (setf (aref res index) num)
                       (setf (aref res (- len 2 index)) num)
                       (incf index)))))
             (loop with init = t
                   for c across res
                   do (if init
                          (setq init nil)
                          (write-char #\ ))
                      (princ c))
             (terpri))
            (t (println -1))))))

#-swank(main)


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


int main()
{
    string S;
    cin >> S;
    int As = 0;
    int Bs = 0;
    for(int i = 0; i < S.size(); i++)
    {
        if(S[i] == 'A') As++;
        else Bs++;
    }

    if(As >= 1 && Bs >= 1 ) 
    {
        cout << "Yes" << endl;
    }
    else 
    {
        cout << "No" << endl;
    }


    return 0;
}

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

m = {}
for a in A:
	if a not in m:
		m[a] = 1
	else:
		m[a] += 1

r = 0
for n in m:
	t = m[n]
	if n + 1 in m:
		t += m[n + 1]
	if n + 2 in m:
		t += m[n + 2]
	r = max(r, t)

print(r)


Measured memory_bytes: 14180
#include<iostream>
#include<algorithm>
#include<vector>
#define PP std::pair<int,int>
int N, M;
std::vector<PP> G;
int par[200010];
int rank[200010];
void init() {
	for (int i = 1; i <= 200003; i++) {
		par[i] = i;
		rank[i] = 0;
	}
}

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

void unite(int x, int y) {
	x = find(x);
	y = find(y);
	if (x == y)return;
	if (rank[x] < rank[y]) {
		par[x] = y;
	}
	else {
		par[y] = x;
		if (rank[x] == rank[y])rank[x]++;
	}
}

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


int main() {
	std::cin >> N >> M;
	init();
	for (int i = 1; i <= N; i++) {
		int K;
		std::cin >> K;
		for (int j = 1; j <= K; j++) {
			int tmp;
			std::cin >> tmp;
			G.push_back({ i,tmp + 100000 });
		}
	}
	for (auto u : G) {
		if (!same(u.first, u.second)) {
			unite(u.first, u.second);
		}
	}
	for (int i = 1; i < N; i++) {
		if (!same(i, i + 1)) {
			std::cout << "NO" << std::endl;
			return 0;
		}
	}
	std::cout << "YES" << std::endl;
	return 0;
}

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

int main()
{
    int n;
    cin>>n;
    string s;
    string t;
    cin>>s>>t;
    int flag=0;
    for(int i=0;i<s.size();i++)
    {
        cout<<s[i]<<t[i];
    }
    return 0;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <math.h>
#include <queue>
#include <stack>
#include <list>
#include <functional>
#include <numeric>
#include <iostream>

using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (n); ++i)


int main() {

	int A[3];
	scanf("%d%d%d", &A[0], &A[1], &A[2]);

	sort(A, A + 3);

	printf("%d\n", abs(A[1] - A[0]) + abs(A[2] - A[1]));

	return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int A, B;
    cin >> A >> B;
    REP(i, 1, 2000000) {
        int a = (i * 0.08);
        int b = (i * 0.10);
        if (A == a && B == b) {
            cout << i << endl;
            return 0;
        }
    }
    cout << -1 << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <stack>
#include <istream>
#include <map>
#include <set>
#include <queue>
#define rep0(i,n) for (int i = 0; i <= (n); ++i)
#define rep1(i,n) for (int i = 1; i <= (n); ++i)
#define REP(a,b) for (int i = a; i <= (b); ++i) 
#define mREP(a,b) for (int i = a; i == (b); --i) 
typedef long long ll;
using namespace std;
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	/*
	　　　  　 ,ﾍ／L──- 、
	　　　   　Lﾆ)r_」=＝= ｲ
	　　 　,ﾍ、i ﾉノλﾉﾊﾉﾍ
	　　   ,'　｀(ﾊﾘ ﾟ ヮﾟﾉi)　',
	　　 .i　　 >〈(つ,i!と)　　i
	　　  vﾍγk´_/___i,ゝﾍノ
	　　　　　 ｀ﾞr_,ｨ_ｧﾞ´
	*/
	int n; cin >> n;
	vector<ll>a(n);
	int count = 0;
	int ans = 0;
	ll now = 0;
	rep0(i, n - 1) {
		cin >> a[i];
	}

	rep0(k, n - 1) {
		if (now >= a[k]) {
			count++;
			now = a[k];
		}
		else {
			count = 0;
			now = a[k];
		}
		ans = max(ans, count);
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 1024
#define _USE_MATH_DEFINES

#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <unordered_map> 
#include <unordered_set>
#include <functional>

using namespace std;

typedef pair<long long int, long long int> P;
typedef tuple<int, int, int> T;

long long int INF = 1e18;
long long int MOD = 1e9 + 7;

int main(){
	string S;
	cin >> S;
	vector<long long int> v(S.size() + 10);
	long long int cnt = 0;
	for(int i = 0; i < S.size(); i++){
		if(S[i] == '<'){
			cnt += 1;
		}else{
			cnt = 0;
		}
		v[i + 1] = max(v[i + 1], cnt);
	}
	for(int i = S.size() - 1; i >= 0; i--){
		if(S[i] == '>'){
			cnt += 1;
		}else{
			cnt = 0;
		}
		v[i] = max(v[i], cnt);
	}
	long long int ans = 0;
	for(int num : v){
		ans += num;
	}
	cout << ans << endl;
	return 0;
}

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

const long long MOD = 1000000007;

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n; cin >> n;
	vector<int> t(n+2), a(n+2), h(n+2, 0);
	t[0] = 0;
	a[n+1] = 0;
	for(int i = 1; i <= n; i++){
		cin >> t[i];
		if(t[i] != t[i-1]) h[i] = t[i];
	}
	for(int i = 1; i <= n; i++){
		cin >> a[i];
	}
	for(int i = n; i >= 1; i--){
		if(a[i] != a[i+1]){
			if(h[i] == 0) h[i] = a[i];
			else{
				if(h[i] != a[i]){
					cout << 0 << endl;
					return 0;
				}
			}
		}
	}
	long long ans = 1;
	for(int i = 1; i <= n; i++){
		if(h[i] == 0){
			ans = (ans * min(t[i], a[i])) % MOD;
		}
		else{
			if(t[i] < h[i] || a[i] < h[i]){
				ans = 0;
				break;
			}
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1536
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		int C = sc.nextInt();
		
		int x = B;
		int count = 0;
		
		while(x >= A && count < C) {
			count++;
			x -= A;
		}
		System.out.println(count);
	}
}


Measured memory_bytes: 23252
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (ll)n; ++i)
static const int dx[4] = { 0, 1, 0, -1 };
static const int dy[4] = { 1, 0, -1, 0 };
static const char dir[4] = { 'u', 'r', 'd', 'l' };
static const ll INF = 1 << 21;
static const ll MOD = 1e9 + 7;
ll X;
ll cnt, rem;

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

    cnt = X / 100;
    rem = X % 100;
    if (rem <= cnt * 5) {
        cout << 1 << endl;
    } else {
        cout << 0 << endl;
    }

    return 0;
}

Measured memory_bytes: 256
l = []
for i in range(3):
    l.append(list(map(int,input().split())))
n = int(input())
b=[]
for _ in range(n):
    b.append(int(input()))

for i in range(3):
    if l[i][0] in b and l[i][1] in b and l[i][2] in b :
        print("Yes")
        exit()
for j in range(3):
    if l[0][j] in b and l[1][j] in b and l[2][j] in b :
        print("Yes")
        exit()

if l[0][0] in b and l[1][1] in b and l[2][2] in b :
    print("Yes")
    exit()
if l[2][0] in b and l[1][1] in b and l[0][2] in b :
    print("Yes")
    exit()

print("No")

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

//const long double PIL = 3.141592653589793238462643383279502884L;
//const double PI = 3.14159265358979323846;

#define sz(a) int((a).size())
#define all(c) (c).begin(), (c).end()
#define what_is(x) cerr << #x << " is " << x << endl;

using ll = long long;
using ii = pair<int,int>;
using vi = vector<int>;
using vll = vector<long long>;
using vii = vector<pair<int,int>>;

int main() {
	//~ ios::sync_with_stdio(0);
	//~ cin.tie(0);
	int a, b;
	cin >> a >> b;
	int answer = a * b - a - b + 1;
	cout << answer << endl;
}


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

using namespace std;
struct aaa{aaa(){cin.tie(nullptr); ios::sync_with_stdio(false); cout<<fixed<<setprecision(20);};}aaa;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v){o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}
#define debug(v) {cerr<<"\033[1;36m[debug]\033[m "<<#v<<" : "<<v<<endl;}

using int64 = long long;

int main() {
    int x,y,z;
    cin >> x >> y >> z;
    cout << z << " " << x << " " << y << endl;
}

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

int main(){
  int w,h,n;
  cin >> w >> h >> n;
  
  vector<vector<int>> vec(n, vector<int>(3));
  for (int i=0; i<n; i++){
    for (int j=0; j<3; j++){
      cin >> vec.at(i).at(j);
    }
  }
  
  int x_min = 0;
  int x_max = w;
  int y_min = 0;
  int y_max = h;
  
  for (int i=0; i<n; i++){
    if (vec.at(i).at(2) == 1){
      x_min = max(x_min,vec.at(i).at(0));
    }
    if (vec.at(i).at(2) == 2){
            x_max = min(x_max,vec.at(i).at(0));
    }
    if (vec.at(i).at(2) == 3){
            y_min = max(y_min,vec.at(i).at(1));
    }
    if (vec.at(i).at(2) == 4){
            y_max = min(y_max,vec.at(i).at(1));
    }
  }
  
  if (x_min <= x_max && y_min <= y_max){
    cout << (x_max - x_min)*(y_max - y_min) << endl;
  }
  else {
    cout << 0 << endl;
  }
}


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

using std::cin;
using std::cout;
using std::endl;

using std::vector;

int main(){
    char x, y;
    cin >> x >> y;
    char ans;
    if(x < y){
        ans = '<';
    }else if(x > y){
        ans = '>';
    }else{
        ans = '=';
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 256
import java.util.*;
import java.io.*;

public class Main {
	
	public  void solve() throws IOException{
		while( stdIn.hasNext() ){
			int n = stdIn.nextInt();
			StringBuilder ans = new StringBuilder("3C");
			int x = (n%39 != 0) ? n%39 : 39;
			if( x/10 == 0 ){
				ans.append("0");
			}
			ans.append(x);
			writer.println(ans);
			writer.flush();
		}
		writer.flush();				
	}
	public static void main (String args[]) throws IOException{
		new Main().run();
	}
	
	Scanner stdIn;
	PrintWriter writer;
	
	public void run() throws IOException{
		stdIn = null;
		try{
			stdIn = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
			writer = new PrintWriter(System.out);
			solve();
			stdIn.close();
			writer.close();
		} catch (Exception e){
			e.printStackTrace();
			System.exit(1);
		}
	}	
}

Measured memory_bytes: 12000
#include <iostream>
#include <vector>
#include <stack>

using namespace std;

class UnionFind {
    vector<long long> par;
    vector<long long> tree_count;

public:
    UnionFind(long long N) : par(N), tree_count(N) {
        for(long long i = 0; i < N; i++) {
            par[i] = i;
            tree_count[i] = 1;
        }
    }

    long long size(long long x) {
        return tree_count[root(x)];
    }

    long long root(long long x) {
        if(par[x] == x) return x;
        //親を探すときに経路上のノードを親にくっつける
        return par[x] = root(par[x]);
    }

    void unite(long long x, long long y) {
        long long rx = root(x);
        long long ry = root(y);
        if(rx == ry) return;
        //ryに所属するグループの頂点数を格納(親でなくなった頂点は-1)
        tree_count[ry] += tree_count[rx];
        tree_count[rx] = -1;
        //xの親をyの親の下にくっつける
        par[rx] = ry;
    }

    bool same(long long x, long long y) {
        long long rx = root(x);
        long long ry = root(y);
        return rx == ry;
    }
};


int main() {
    long long N, M;
    cin >> N >> M;

    vector<long long> A(M, 0);
    vector<long long> B(M, 0);
    for(long long i = 0; i < M; i++) {
        cin >> A[i] >> B[i];
    }

    vector<long long> ret(M, 0);
    UnionFind uf(N);
    long long change = 0;
    ret[M-1] = (long long)((N*(N-1))/2);
    for(long long i = M - 2; i >= 0; i--) {
        if (!uf.same(A[i+1] - 1, B[i+1] - 1)) 
            change =  (uf.size(A[i+1]-1) * uf.size(B[i+1]-1));
        else 
            change = 0;

        //cout << "change:" << change   << endl;
        
        uf.unite(A[i+1]-1, B[i+1]-1);
        ret[i] = ret[i+1] - change;
        //cout << (uf.size(A[i]-1)) << "," << (uf.size(B[i]-1)) <<endl;

    }
    
    for(long long i = 0; i < M; i++) {
        cout << ret[i] << endl;
    }
}

Measured memory_bytes: 5248
#include <algorithm>
#include <cassert>
// #include <chrono>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
// #include <random>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>

/*
unsigned seed1 = std::chrono::system_clock::now().time_since_epoch().count();
mt19937 g1.seed(seed1);
*/
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<pii, pii> ppiipii;
typedef pair<int, ppiipii> pippiipii;
typedef pair<int, pii> pipii;
typedef pair<pii, int> ppiii;
typedef pair<int, ppiii> pippiii;
typedef pair<int, ll> pill;
typedef pair<int, double> pid;
typedef pair<string, string> pss;
// note to self, the below two triggers someone
typedef pair<ll, ll> pll;
typedef pair<ll, int> plli;
typedef long double ld;

int main() {
  int a, b, c, k;
  scanf("%d%d%d%d", &a, &b, &c, &k);
  int ret = a+b+(c<<k);
  ret = max(ret, a+c+(b<<k));
  ret = max(ret, b+c+(a<<k));
  printf("%d\n", ret);
}


Measured memory_bytes: 256
s = input()
n = len(s)
a = [0]
for i in range(n):
    if s[i] == ">":
        temp = a[-1] - 1
        a.append(temp)
        if i == n - 1 or s[i + 1] == "<":
            a[i + 1] = 0
            for j in range(i, -1, -1):
                if s[j] == ">":
                    if s[j - 1] == "<":
                        a[j] = max(a[j], a[j + 1] + 1)
                    else:
                        a[j] = a[j + 1] + 1
                else:
                    break
    else:
        a.append(a[-1] + 1)
print(sum(a))

Measured memory_bytes: 29608
macro_rules !input {(source =$s :expr ,$($r :tt ) *) =>{let mut iter =$s .split_whitespace () ;let mut next =||{iter .next () .unwrap () } ;input_inner !{next ,$($r ) *} } ;($($r :tt ) *) =>{let stdin =std ::io ::stdin () ;let mut bytes =std ::io ::Read ::bytes (std ::io ::BufReader ::new (stdin .lock () ) ) ;let mut next =move ||->String {bytes .by_ref () .map (|r |r .unwrap () as char ) .skip_while (|c |c .is_whitespace () ) .take_while (|c |!c .is_whitespace () ) .collect () } ;input_inner !{next ,$($r ) *} } ;}
macro_rules !input_inner {($next :expr ) =>{} ;($next :expr ,) =>{} ;($next :expr ,$var :ident :$t :tt $($r :tt ) *) =>{let $var =read_value !($next ,$t ) ;input_inner !{$next $($r ) *} } ;}
macro_rules !read_value {($next :expr ,($($t :tt ) ,*) ) =>{($(read_value !($next ,$t ) ) ,*) } ;($next :expr ,[$t :tt ;$len :expr ] ) =>{(0 ..$len ) .map (|_ |read_value !($next ,$t ) ) .collect ::<Vec <_ >>() } ;($next :expr ,chars ) =>{read_value !($next ,String ) .chars () .collect ::<Vec <char >>() } ;($next :expr ,usize1 ) =>{read_value !($next ,usize ) -1 } ;($next :expr ,$t :ty ) =>{$next () .parse ::<$t >() .expect ("Parse error" ) } ;}

const INF: usize = 1001001001001001;

fn main() {
   input! {
      n: usize,
      wm: usize,
      wv: [(usize, usize); n]
   }
   let mut dp = [INF; 100001];
   dp[0] = 0;
   for (w, v) in wv {
      for i in (v..100001).rev() {
         if dp[i - v] != INF {
            dp[i] = std::cmp::min(dp[i], dp[i - v] + w);
         }
      }
   }
   let mut ans = 0;
   for i in 1..100001 {
      if dp[i] <= wm {
         ans = i;
      }
   }
   println!("{}", ans);
}


Measured memory_bytes: 5116
import math
ini = lambda : int(input())
inm = lambda : map(int,input().split())
inl = lambda : list(map(int,input().split()))
gcd = lambda x,y : gcd(y,x%y) if x%y else y
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

#maincode-------------------------------------------------
n = input()
ans = 0
for i in n:
    ans = ans%9 + int(i)
if ans%9 == 0:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 9224
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String b = sc.next();
		if(b.equals("A")) System.out.println("T");
		else if(b.equals("T")) System.out.println("A");
		else if(b.equals("G")) System.out.println("C");
		else System.out.println("G");
	}
}

Measured memory_bytes: 20688
def solve():
    O = input()
    E = input()

    size = min(len(O), len(E))

    res = ""
    for i in range(size):
        res += O[i] + E[i]

    if len(O) > size:
        res += O[len(E):]
    elif len(E) > size:
        res += E[len(O):]

    return res


if __name__ == '__main__':
    res = solve()
    print(res)


Measured memory_bytes: 61860
//include,namespace
 #include<bits/stdc++.h>
 #include<iostream> 
 #include <queue>
 #include <vector>
 #include <string>
 using namespace std;
//REPmacro
 #define all(x) (x).begin(),(x).end()             //ソート
 #define FOR(i,x,n)for(int i=(x);i<(n);i++)
 #define FOR_R(i,x,n) for(int i=(n-1);i>=(x);i--)
 #define REP(i, n) FOR(i, 0, n)
 #define REP_R(i, n) FOR_R(i, 0, n)
//long long(define)
 using ll = long long;
 typedef long long ll;
 typedef long long int64;
 typedef long long lint;
 typedef long long lli;
////////////////いろいろあるよ//////////////////////////////////

long nCr(int n, int r) {
    long ans = 1;
    for (int i = n; i > n - r; --i) {
        ans = ans*i;
    }
    for (int i = 1 ; i < r + 1; ++i) {
        ans = ans / i;
    }
    return ans;
}

int main(){
    
    int N ,M;
  	cin >>N >>M;
  	cout << nCr(N,2)+nCr(M,2) << endl;
	return 0; 
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<queue>
#include<stack>
using namespace std;
#define MOD 1000000007
#define INF (1<<29)
#define LINF (1LL<<60)
#define EPS (1e-10)
typedef long long Int;
typedef pair<Int, Int> P;

Int fact[1080000];
Int revfact[1080000];
Int rev[1080000];

void init(){
  Int m = MOD;
  fact[0] = 1;
  revfact[0] = 1;
  rev[0] = 0;
  rev[1] = 1;
  for(int i = 1;i < 1080000;i++){
    fact[i] = fact[i-1] * i % m;
    if(i>1)rev[i] = MOD / i * (MOD-rev[MOD % i]) % MOD;
    revfact[i] = revfact[i-1] * rev[i] % MOD;
  }
}

Int nCk(Int n, Int k){
  if(n < k)return 0;
  return fact[n] * revfact[n-k] % MOD * revfact[k] % MOD;
}

Int mod_pow(Int x, Int a, Int m = MOD){
  if(a == 0)return 1;
  Int res = mod_pow(x, a / 2, m);
  res = res * res % m;
  if(a % 2)res *= x;
  return res % m;
}


Int inv(Int x, Int m = MOD){
  return mod_pow(x, m-2, m);
}

Int ans[216000];
Int b, n, w;

int main(){
  init();
  cin >> b >> w;
  n = b + w;
  for(int k = 1;k <= b;k++){
    Int tmp = nCk(n-k-1, w-1) * mod_pow(rev[2], n - k) % MOD;
    Int l = tmp * (b-k) % MOD * rev[n-k-1] % MOD;
    
    (ans[0] += l) %= MOD;
    (ans[n-1-k] -= l) %= MOD;
    (ans[n-k] += tmp) %= MOD;
    (ans[n] -= tmp) %= MOD;
  }

  for(int k = 1;k <= w;k++){
    Int tmp = nCk(n-k-1, b-1) * mod_pow(rev[2], n - k) % MOD;
    Int l = tmp * (b-1) % MOD * rev[n-k-1] % MOD;
    (ans[0] += l) %= MOD;
    (ans[n-1-k] -= l) %= MOD;
    (ans[n-1-k] += tmp) %= MOD;
    (ans[n-k] -= tmp) %= MOD;
  }
  for(int i = 0;i < n;i++){
    if(i)ans[i] += ans[i-1];
    ans[i] %= MOD;
    if(ans[i] < 0)ans[i] += MOD;
    cout << ans[i] << endl;
  }
  return 0;
}

Measured memory_bytes: 29056
in_n, in_cond = map(int, input().split())
def hoge(n, cond):
    for i in range(n+1):
        for j in range(n + 1 -i):
            if(10000 * i + 5000 * j + 1000 * (n - i - j) == cond):
                return [str(i), str(j), str(n - i - j)]
    return ["-1","-1","-1"]
print(" ".join(hoge(in_n, in_cond)))

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

namespace C___GCD_on_Blackboard
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = int.Parse(Console.ReadLine());
            var Ai = Console.ReadLine().Split().Select(int.Parse).ToList();
            var L = new int[N + 1];
            var R = new int[N + 1];
            var M = new int[N];

            L[0] = 0;
            for (int i = 0; i < N; i++)
                L[i + 1] = Gcd(L[i], Ai[i]);

            R[N] = 0;
            for (int i = N - 1; i >= 0; i--)
                R[i] = Gcd(R[i + 1], Ai[i]);

            for (int i = 0; i < N; i++)
                M[i] = Gcd(L[i], R[i + 1]);

            Console.WriteLine(M.Max());
        }

        static int Gcd(int a, int b)
        {
            if (a == 0) return b;
            if (b == 0) return a;

            return a > b ? GcdRecursive(a, b) : GcdRecursive(b, a);
        }

        private static int GcdRecursive(int l, int r) => r == 0 ? l : GcdRecursive(r, l % r);
    }
}


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

int main() {
    int n,k,x,y;
    cin >> n >> k >> x >> y;
    int ans;
    if (n<=k){
        ans = x*n;
    }else{
        ans = x*k + y*(n-k);
    }
    
    cout << ans << endl;
    return 0;
}

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

int main()
{
  int n;
  cin>>n;
  vector<int> arr(n);
  for(int i=0;i<n;i++)
    cin>>arr[i];
  vector<int> dp(n);
 
  dp[1] = abs(arr[0]-  arr[1]);
  for(int i=2;i<n;i++)
  {
    dp[i] = min(dp[i-1]+abs(arr[i]-arr[i-1]),dp[i-2] + abs(arr[i]-arr[i-2]));
  }
  cout<<dp[n-1];
  return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
constexpr int lcm(int a,int b){return b?lcm(b,a%b):a;}
constexpr int gcd(int a,int b){return a*b/lcm(a,b);}
 
int main(void){
    float a,b;
    cin>>a>>b;
    cout<<(int)ceil((a+b)/2)<<endl;
}

Measured memory_bytes: 256
n = input()
alist = input().split()
intalist = [int(a) for a in alist]
count = 0
intcount = 0
for i in range(0,int(n)):
  if intalist[i] % 2 == 0:
    intcount += 1
    if intalist[i] % 3 == 0:
      count += 1
    elif intalist[i] % 5 == 0:
      count += 1
if count == intcount:
  print("APPROVED")
else:
  print("DENIED")


Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <string>

int main(void)
{
 int N;
  std::cin >> N;
  std::vector<std::string> S;
  for(int i=0;i<N;i++)
  {
  	std::string s_x;
    std::cin >> s_x;
    S.push_back(s_x);
  }
  
  int flag=0;
  for(int i=0;i<N;i++)
  {
    if(S[i] == "Y")
    {
      flag = 1;
    }
  }
  
  if(flag == 1)
  {
    std::cout << "Four" << std::endl;
  }
  else 
  {
    std::cout << "Three" << std::endl;
  }
  
  return 0;
}

Measured memory_bytes: 256
# coding: utf-8
from collections import Counter


def solve(*args: str) -> str:
    n = int(args[0])
    A = map(int, args[1].split())
    C = Counter(A)

    return '\n'.join(str(C[i+1]) for i in range(n))


if __name__ == "__main__":
    print(solve(*(open(0).read().splitlines())))


Measured memory_bytes: 46732
#include <bits/stdc++.h>
	using namespace std;
	typedef long long ll;
	#define PI 3.14159265358979
	#define EPS 1e-8
	#define mod 
	#define fi first
	#define se second
	#define mp make_pair
	#define pb push_back
	#define endl "\n"
		 
	const ll INF=1e15;	
	const int N=2e5+50;
	 

	 
	long long binpow(long long a, long long b, long long m) {
		a %= m;
		long long res = 1;
		while (b > 0) {
			if (b & 1)
				res = res * a % m;
			a = a * a % m;
			b >>= 1;
		}
		return res;
	}
	
	
	int main()
	{
		ios_base::sync_with_stdio(false);
		cin.tie(NULL);cout.tie(0);
		
		ll n;
		cin>>n;
		
		vector<ll> a(n+1),b(n+1);
		vector<ll> v1,v2;
		for(ll i=1;i<=n;i++)
		{
			cin>>a[i]>>b[i];
			v1.pb(a[i]);
			v2.pb(b[i]);
		}
		
		sort(v1.begin(),v1.end());
		
		sort(v2.begin(),v2.end());
		
		if(n%2==1)
		{
			ll lo=v1[n/2];
			ll hi=v2[n/2];
			
			cout<<(hi-lo+1);
		}
		else
		{
			long double lo=v1[n/2-1];
			long double hi=v1[n/2];
			
			long double l1=(lo+hi)/2;
			
			lo=v2[n/2];
			hi = v2[n/2-1];
			
			long double l2=(lo+hi)/2;
			
	
			cout<<(ll)(((abs(l2-l1))/0.5)+1);
			
		}
		
		
		
	}
		
		
	


Measured memory_bytes: 9796
x = int(input())

if 400 <= x <= 599:
    print("8")
if 600 <= x <= 799:
    print("7")
if 800 <= x <= 999:
    print("6")
if 1000 <= x <= 1199:
    print("5")
if 1200 <= x <= 1399:
    print("4")
if 1400 <= x <= 1599:
    print("3")
if 1600 <= x <= 1799:
    print("2")
if 1800 <= x <= 1999:
    print("1")

Measured memory_bytes: 9188
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<vector>
#include<cctype>
#include<cstring>
#define maxn 2007
#define ll long long 
#define SDOI2020 RP++ 
using namespace std;
ll a,b,c; 
inline ll read()
{
	ll x=0;
	ll flag=0;
	char ch;
	ch=getchar();
	while(!isdigit(ch)) 
	{
		if(ch=='-') flag=1;
	ch=getchar();	
	}
	while(isdigit(ch))
	{
		x=(x<<3)+(x<<1)+ch-48;
		ch=getchar();
		}
		if(flag==1) x=-x;	
		return x;
}


int main()
{
	a = read();
	b = read();
	ll sum = b;
	ll cnt = 1;
	while(sum <= a)
	{
		sum *= b;
		cnt++;
	}
	printf("%lld\n",cnt);
	return 0;
} 

Measured memory_bytes: 256
from collections import Counter
n = int(input())
input_list = [input() for i in range(n)]
cnt = Counter()
for word in input_list:
  cnt[word] += 1
max_value = max(cnt.values())
answer = [i for i, j in cnt.items() if j == max_value]
answer.sort()
for i in answer:
  print(i)

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

using ll = long long;
using P = pair<int, int>;
#define reps(i,n) for (int i=1; i<=n; i++)
#define zarray(x,n) x[n+1]; reps(i,n) {x[i]=0;} 
#define zarray2(x,n,m) x[n+1][m+1]; reps(i,n) { reps(j,m) {x[i][j]=0;}}

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

    int zarray(sunuke,n);

    reps(i,k) {
        int di;
        cin >> di;
        reps(j,di) {
            int a;
            cin >> a;
            sunuke[a]++;
        }
    }
    int ans = 0;
    reps(i,n) {
        if (sunuke[i] == 0) ans++;
    }
    cout << ans << endl;
}


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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

int A,B,C,D;

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>A>>B>>C>>D;
	
	if(abs(A-C)<=D || (abs(A-B)<=D&&abs(B-C)<=D)) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}


Measured memory_bytes: 256
import math


def chmax(a, b):
    if a >= b:
        return a
    return b


def chmin(a, b):
    if a <= b:
        return a
    return b


def main():
    nn = int(input())
    arr = [list(map(int, input().split())) for l in range(nn)]
    dp = [[0] * 3 for i in range(nn+1)]

    for i in range(nn):
        for j in range(3):
            for k in range(3):
                if j == k:
                    continue
                dp[i+1][j] = chmax(dp[i+1][j],dp[i][k]+arr[i][k])

    print(max(dp[nn][0],dp[nn][1],dp[nn][2]))


main()

Measured memory_bytes: 100660
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <numeric>
    
using namespace std;    
typedef long long ll;
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()

int main(){

    int a, b;
    cin >> a >> b;

    int num;
    if(b / 100 >= 1){
        num = 1000 * a + b;
    }
    else if(b / 10 >= 1){
        num = 100 * a + b;
    }
    else if(b / 1 >= 1){
        num = 10 * a + b;
    }

    for(int i = 1; i <= num; i++){
        if(i * i == num){
            cout << "Yes" << endl;
            return 0;
        }
    }

    cout << "No" << endl;


}

Measured memory_bytes: 256