akhauriyash/Code-Regression huggingface dataset:
import * as fs from 'fs';

export class Reader {
    lines: string[];
    currentLine: number;

    constructor() {
        this.lines = fs.readFileSync("/dev/stdin", "utf8").trim().split("\n");
        this.currentLine = 0;
    }

    readLine(): string {
        return this.lines[this.currentLine++];
    }

	readChars(): string[] {
		let S = this.readLine();
		return new Array(S.length).fill(null).map((_, i) => S.charAt(i));
	}

    readInt(): number {
        return Number(this.readLine());
    }

    readInts(): number[] {
        return this.readLine().split(" ").map(Number);
    }
} 

class DisjointSet {
	parents: number[];
	sizes: number[];
	constructor(readonly size: number) {
		this.parents = new Array(size).fill(0).map((val, index) => index);
		this.sizes = new Array(size).fill(1);
	}
	find(index: number): number {
		let path: number[] = [];
		while (index != this.parents[index]) {
			path.push(index);
			index = this.parents[index];
		}
		while (path.length > 0) {
			this.parents[path.pop()] = index;
		}
		return index;
	}
	union(index1: number, index2: number): number {
		let parent1 = this.find(index1),
			parent2 = this.find(index2);
		let answer = 0;
		if (parent1 != parent2) {
			answer = this.sizes[parent1]*this.sizes[parent2];
			this.parents[parent1] = parent2;
			this.sizes[parent2] += this.sizes[parent1];
		}
		return answer;
	}
}

let reader = new Reader();
let [N, M] = reader.readInts();
let AB: [number, number][] = [];

for(let i=0; i<M; i++) {
	AB.push(reader.readInts().map((val) => val-1) as [number, number]);
}

let disjointSet: DisjointSet = new DisjointSet(N);
let answers: number[] = [Math.floor(N*(N-1)/2)];
while(AB.length > 0) {
	let [a, b] = AB.pop();
	let lastAnswer = answers[answers.length-1];
	answers.push(lastAnswer-disjointSet.union(a, b));
}

answers.pop();
while(answers.length > 0) {
	console.log(answers.pop());
}


Measured memory_bytes: 87252
n = int(input())
s = str(input())

ans = s
ans = list(ans)

cum = 0
for i in range(n):
    if s[i] == '(':
        cum += 1
    else:
        cum -= 1
    if cum < 0:
        ans = ['('] + ans
        cum = 0
else:
    ans = ans + [')']*cum

print(''.join(ans))


Measured memory_bytes: 38384
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdbool.h>
#include <math.h>

int main(void){

    int A, B, C, D, E, F;

    scanf("%d%d%d%d%d%d", &A, &B, &C, &D, &E, &F);

    double max = 0;
    int a = 100*A, b = 0;
    double limit;

    for(int i = 0; ; i++){
        if(100 * A * i > F){
            break;
        }
        for(int j = 0; ; j++){
            if(100 * A * i + 100 * B * j > F){
                break;
            }
            for(int k = 0; ; k++){
                if(100 * A * i + 100 * B * j + C * k > F){
                    break;
                }
                for(int l = 0; ; l++){
                    if(i != 0 || j != 0 || k != 0 || l != 0){
                        int x = 100 * A * i + 100 * B * j;
                        int y = C * k + D * l;
                        if(x + y > F){
                            break;
                        }else{
                            double n;
                            n = (double)(100*y) / (double)(x+y);
                            if(n > max && x * E >= 100 * y){
                                max = n;
                                a = x+y;
                                b = y;
                            }
                        }
                    }
                }
            }
        }
    }

    printf("%d %d\n", a, b);

    return 0;
}

Measured memory_bytes: 1712
N,M = map(int,input().split())
mod = 1000000007
if abs(N - M) > 1:
    print(0)
else:
    fact = 1

    for i in range(1,max(N,M)+1):
        fact *= i
        fact %= mod

        if i == min(N,M):
            ans = fact

    ans *= fact
    ans %= mod

    if N == M:
        ans = 2*ans % mod
    else:
        ans = ans

    print(ans)


Measured memory_bytes: 3060
X = int(input())

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)
      #else:
      #  divisors.append([i, i])
  return divisors


def solve(a, b, c):
  D = (b**2 - 4*a*c) ** (1/2)
  x_1 = (-b + D) / (2 * a)
  x_2 = (-b - D) / (2 * a)
  return x_1, x_2

for pattern in make_divisors(X):
  diff = pattern
  A = 5
  B = 5 * (diff ** 2)
  C = diff ** 4 - X//diff
  sekiss = solve(A, B, C)
  for sekis in sekiss:
    if sekis == int(sekis):
      #print(int(sekis), diff)
      kouhos = solve(1, -diff, -int(sekis))
      if kouhos[0].imag == 0.0:
        print(int(kouhos[0]), int(kouhos[0] - diff))
      break

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

using namespace std;

int main(){
  string s;
  cin >> s;
  int p = s.size();
  string v[4] =  {"dream", "dreamer", "erase", "eraser"};
  bool f = true;
  while(p > 0){
    bool matched = false;
    for(int i = 0; i < 4; i++){
      //matched = false;
      if(p < v[i].size()) continue;
      if(s.substr(p-v[i].size(), v[i].size()) == v[i]){
        //cout << s.substr(p-v[i].size(), v[i].size());
        matched = true;
        p -= v[i].size();
        
        break;
      }
    }
    if(!matched){
      f = false;
      break;
    }
  }
  if(f) cout << "YES";
  else cout << "NO";
}


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

public class Main {
	static final int MOD = (int)1e9+7;

	public static void main(String[] args){
		FastScanner sc = new FastScanner(System.in);
		PrintWriter out = new PrintWriter(System.out);

		solve(sc,out);

		out.flush();
	}

	public static void solve(FastScanner sc, PrintWriter out) {
		int max = 0;
		int x = sc.nextInt();
		
		for(int i = 1; i <= 1000; i++) {
			for(int j = 2; j <= 1000; j++) {
				int e = (int)Math.pow(i, j);
				
				if(e <= x) {
					max = Math.max(e, max);
				}
			}
		}
		
		out.println(max);
	}

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

	public static long lcm(long a, long b) {
		return a / gcd(a, b) * b;
	}

	public static long factorial(int n) {
		long a;

		if(n > 0) {
			a = n * factorial(n - 1);
		}else{
			a = 1;
		}

		return a;
	}
}

class Pair<K, V> extends AbstractMap.SimpleEntry<K, V> {

    public Pair(K key, V value) {
        super(key, value);
    }

    public Pair<V, K> swap() {
    	return new Pair<V, K>(getValue(), getKey());
    }
 }

class UnionFind {
	int[] par;

	public UnionFind(int n) {
		par = new int[n];

		Arrays.fill(par, -1);
	}

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

	boolean unite(int x,int y) {
		x = root(x);
		y = root(y);

		if(x == y) return false;

		if(size(x) < size(y)) {
			int tmp = x;
			x = y;
			y = tmp;
		}

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

		return true;
	}

	boolean same(int x,int y) {
		int rx = root(x);
		int ry = root(y);
		return rx == ry;
	}

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

class FastScanner {
    private BufferedReader reader = null;
    private StringTokenizer tokenizer = null;

    public FastScanner(InputStream in) {
        reader = new BufferedReader(new InputStreamReader(in));
        tokenizer = null;
    }

    public String next() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

    public String nextLine() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                return reader.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }

        return tokenizer.nextToken("\n");
    }

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

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

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

    public int[] nextIntArray(int n) {
        int[] a = new int[n];
        for (int i = 0; i < n; i++)
            a[i] = nextInt();
        return a;
    }

    public long[] nextLongArray(int n) {
        long[] a = new long[n];
        for (int i = 0; i < n; i++)
            a[i] = nextLong();
        return a;
    }
}

Measured memory_bytes: 21588
#include <iostream>
#include <limits.h>
#include <stdint.h>

using namespace std;

int main()
{
  int64_t r, D, x;

  cin >> r >> D >> x;

  for (int ii=2001; ii<= 2010; ++ii) {
    x = r * x - D;
    cout << x << endl;
  }
 

  return 0;
}

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

int main(){
  char b;
  cin >> b;
  if(b=='A'){
    cout << "T" << endl;
  }
  else if(b=='T'){
    cout << "A" << endl;
  }
  else if(b=='C'){
    cout << "G" << endl;
  }
  else{
    cout << "C" << endl;
  }
}

Measured memory_bytes: 256
m, d = map(int, input().split())

ans = 0

for i in range(1, m+1):
  for j in range(1, d+1):
    if j//10 == 1 or j%10 == 1:
      continue
    a = (j//10) * (j%10)
    if i == a:
      ans += 1
    
print(ans)


Measured memory_bytes: 3064
#include<iostream>
#include<vector>
#define rep(i, n) for (int i=0;i<n;i++)
using namespace std;

int main(void){
    int k, x;
    cin>>k>>x;
    for (int i=x-k+1;i<x+k;i++){
        cout<<i<<endl;
    }
    
}

Measured memory_bytes: 256
n=int(input())
s=[]
for i in range(n):
  s.append(input())
s.sort()
# print(s)
count=1
counts=[]
max=0
top_number=[]
for i in range(n-1):
  if s[i]==s[i+1]:
    count+=1
  if i==n-2 and s[i]==s[i+1]:
    counts.append(count)
    if max<count:
      max=count
      top_number=[i]
    elif max==count:
      top_number.append(i)
  if i==n-2 and s[i]!=s[i+1]:
    counts.append(count)
    if max<count:
      max=count
      top_number=[i]
    elif max==count:
      top_number.append(i)
    if max==1:
      top_number.append(i+1)
  elif s[i]!=s[i+1]:
    counts.append(count)
    if max<count:
      max=count
      top_number=[i]
    elif max==count:
      top_number.append(i)
    count=1
# print(counts)
# print(top_number)
for i in range(len(top_number)):
  print(s[top_number[i]])

Measured memory_bytes: 29020
#include<bits/stdc++.h>
using namespace std;
const int maxn=199999,maxlg=30;
struct QQ{
	char mo;
	int i,j,k;
	QQ(){}
	QQ(char _m,int _i,int _j,int _k):mo(_m),i(_i),j(_j),k(_k){}
};
vector<QQ> q;
vector<int> PW2,v;
int cnt;
int pw2(int p,int k){
	for(int i=1;i<=k;i++)q.emplace_back('+',p,p,++cnt),p=cnt;
	return p;
}
int Less(int p1,int p2){
	q.emplace_back('<',p1,p2,++cnt);
	return cnt;
}
int Plus(int p1,int p2){
	q.emplace_back('+',p1,p2,++cnt);
	return cnt;
}
int Minus(int p1,int p2){
	p1=Plus(p1,PW2[0]);
	int ret=maxn;
	for(int i=maxlg-1;i>=0;i--){
		int b=Less(Plus(p2,PW2[i]),p1),c=pw2(b,i);
		p2=Plus(p2,c);
		ret=Plus(ret,c);
	}
	return ret;
}
int ifelse(int b,int p){ //b?p:0 => p-(b<<30)
	return Minus(p,pw2(Less(b,PW2[0]),30));
}
void solve(int x,vector<int> &v){
	x=Plus(x,PW2[0]);
	for(int i=maxlg-1;i>=0;i--){
		int b=Less(PW2[i],x),c=ifelse(b,PW2[i]);
		x=Minus(x,c);
		v.push_back(b);
	}
	reverse(v.begin(),v.end());
}
int mul(){
	int ret=maxn;
	for(int i=0;i<maxlg;i++){
		ret=Plus(ret,pw2(ifelse(v[i],0),i));
	}
	return ret;
}
int main(){
	cnt=1;
	PW2.push_back(Less(maxn,Plus(0,1)));
	for(int i=1;i<maxlg;i++){
		PW2.push_back(Plus(i+2,i+2));
	}
	solve(1,v);
	q.emplace_back('+',mul(),maxn,2);
	cout<<q.size()<<endl;
	for(int i=0;i<q.size();i++)cout<<q[i].mo<<' '<<q[i].i<<' '<<q[i].j<<' '<<q[i].k<<endl;
	return 0;
}

Measured memory_bytes: 4144
a,b,c,d = map(int,input().split())

if c%b==0:
    taka = c/b
else :
    taka = (c-c%b)/b + 1

if a%d==0:
    aoki = a/d
else :
    aoki = (a-a%d)/d + 1

if aoki < taka:
    print("No")
else :
    print("Yes")

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

int check(ll p){
  int flag3 = 0, flag5 = 0, flag7 = 0;
  while(p > 0){
    if(p%10 == 3) flag3 = 1;
    else if(p%10 == 5) flag5 = 1;
    else if(p%10 == 7) flag7 = 1;
    p /= 10;
  }
  return flag3 * flag5 * flag7;
}

int main(){
  int x;
  cin >> x;
  
  vector<ll> ans;
  ans.push_back(3);
  ans.push_back(5);
  ans.push_back(7);
  
  int l=0;
  int r=3;
  
  for(int i=0; i<9; i++){
    for(int j=l; j<r; j++){
      ans.push_back(ans[j] * 10 + 3);
      ans.push_back(ans[j] * 10 + 5);
      ans.push_back(ans[j] * 10 + 7);
    }
    l=r;
    r = ans.size();
  }
  
  int cnt = 0;
  for(int i:ans){
    if(check(i) && i <= x){
      cnt++;
    }
  }
  cout << cnt << endl;
}

Measured memory_bytes: 1400
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
const double PI = acos(-1);
const double EPS = 1e-15;
long long INF=(long long)1E17;
#define i_7 (long long)(1E9+7)
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
using namespace std;
bool prime(int n){
  if(n==1){
    return false;
  }else if(n==2){
    return true;
  }else{
    for(int i=2;i<=sqrt(n);i++){
      if(n%i==0){
        return false;
      }
    }
    return true;
  }
}

long long gcd(long long a, long long b){
  if(a<b){
    swap(a,b);
  }
  if(a%b==0){
    return b;
  }else{
    return gcd(b,a%b);
  }
}
 
long long lcm(long long x, long long y){
  return (x/gcd(x,y))*y;
}
 
class UnionFind {
    public:
    //各頂点の親の番号を格納する。その頂点自身が親だった場合は-(その集合のサイズ)を入れる。
    vector<int> Parent;
    
    //クラスを作るときは、Parentの値を全て-1にする。
    //以下のようにすると全てバラバラの頂点として解釈できる。
    UnionFind(int N) {
        Parent = vector<int>(N, -1);
    }
    
    //Aがどのグループに属しているか調べる
    int root(int A) {
        if (Parent[A] < 0) return A;
        return Parent[A] = root(Parent[A]);
    }
    
    //自分のいるグループの頂点数を調べる
    int size(int A) {
        return -Parent[root(A)];//先祖をrootで取っておきたい。
    }
    
    //AとBをくっ付ける
    bool connect(int A, int B) {
        //AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
        A = root(A);
        B = root(B);
        if (A == B) {
            //すでにくっついてるからくっ付けない
            return false;
        }
        
        //大きい方(A)に小さいほう(B)をくっ付けたい
        //大小が逆だったらAとBをひっくり返す。
        if (size(A) < size(B)) swap(A, B);
        
        //Aのサイズを更新する
        Parent[A] += Parent[B];
        //Bの親をAに変更する
        Parent[B] = A;
        
        return true;
    }
};

int main(){
  int n;
  cin>>n;
  long long a[n],b[n];
  long long ans=0;
  REP(i,n){
    cin>>a[i]>>b[i];
    a[i] %= b[i];
  }
  for(int i=n-1;i>=0;i--){
    a[i]=(a[i]+ans)%b[i];
    ans += (b[i]-a[i])%b[i];
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define ll long long
#define PB push_back
#define MP make_pair
#define ff first
#define ss second
#define pri 1000000007
using namespace std;
void run(){
	ll n,k;
	cin>>n>>k;
	string a;
	cin>>a;
	a[k-1]=a[k-1]+('a'-'A');
	cout<<a;
	
}
int main() {
	ll t=1;
	//cin>>t;
	for(ll j=0;j<t;j++)run();
	// your code goes here
	return 0;
}

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

using namespace std;

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


void solve()
{
    int n;
    cin >> n;
    vector<long long> len(n);
    for(auto& i : len)
        cin >> i;

    sort(len.rbegin(), len.rend());
    // cout << "sorted: ";
    // for(auto& i : len) cout << i << " ";
    // cout << endl;
    long long count = 0;
    for(int i=0; i<n-2; i++)
    {
        for(int j=i+1; j<n-1; j++)
        {
            if(len[i] == len[j]) continue;
            for(int k = j+1; k<n; k++)
            {
                if((len[k] == len[i]) || (len[k] == len[j])) continue;
                count += (len[i] < len[j] + len[k]);
                // cout << len[i] << " < " << len[j] << " + " << len[k] << "? " << (len[i] < len[j] + len[k]) << '\n';
            }
        }
    }
    cout << count << '\n';
}

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

    int nCases = 1;
    // cin >> nCases;

    while(nCases--)
        solve();

    return 0;
}


Measured memory_bytes: 3652
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		Scanner sc = new Scanner(System.in);
		//入力表示
		int N= sc.nextInt();
      
		//N=1だったら表示
        //N=2だったら計算をする
		if(N==1) {
			System.out.println("Hello World");
			
		}else if(N==2) {
			int A= sc.nextInt();
			int B= sc.nextInt();
			System.out.println(A+B);
		}
	}
}


Measured memory_bytes: 23252
N = int(input())

divisor = 100
N_temp = N

there_is_seven = False
while divisor != 0.1:
    if N_temp // divisor == 7:
        there_is_seven = True
    N_temp %= divisor
    divisor /= 10

if there_is_seven: 
    print("Yes")
else:
    print("No")

Measured memory_bytes: 9172
/*                        ______
 _______   /\     |``\   |        |  /
    |     /  \    |__/   |____    |/
    |    / _ _\   |  \   |        |\
    |   /      \  |   \  |______  |  \

            Dept. of CSE
        Comilla  University

*/
#include<bits/stdc++.h>
#define pi 2*acos(0.0)
#define ll long long
#define FIO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define Node struct node
#define spc " "
#define  E  2.71828182845904523536
#define pb push_back
#define pp pop_back
#define valid(nx,ny) nx>=0 && nx<n && ny>=0 && ny<m
#define ee endl
#define pii pair<int,int>
#define infinity 10000000000000000
#define mod 1000000007
int fx[]={0,0,+1,-1};
int fy[]={+1,-1,0,0};

using namespace std;
///check n=1;
///check corner case;
const int maX=1e5+1;
vector<ll>Graph[maX],cost[maX];
ll visit[maX];
ll x[10];
ll y[10];

int main()
{
    ll a,b;cin>>a>>b;
    if(b%a==0)cout<<a+b<<endl;
    else cout<<b-a<<endl;
return 0;
}


Measured memory_bytes: 4992
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<sstream>
#include<set>
#include<map>
#include <cstdint>
using namespace std;
#define rep(N) for(int i=0;i<N;i++)
#define rep2(N1,N2) for(int i=0;i<N1;i++)for(int j=0;j<N2;j++)
#define rep3(N1,N2,N3)for(int i=0;i<N1;i++)for(int j=0;j<N2;j++)for(int k=0;k<N3;k++)
#define For(i,N) for(int i=0;i<N;i++)
#define ll long long int
void yn(bool b) {
	if (b)printf("yes\n");
	else printf("no\n");
}

void Yn(bool b) {
	if (b)printf("Yes\n");
	else printf("No\n");
}

void YN(bool b) {
	if (b)printf("YES\n");
	else printf("NO\n");
}

int ctoi(char c) {
	return c - '0';
}

ll kai(ll x) {
	ll a = 1;
	if (x <= 0)
		return 1;
	else {
		for(ll i=0;i<x;i++)
			a = a * (i + 1);
		return a;
	}
}

ll rui(ll x, ll y) {
	ll a = 1;
	for (ll i = 0; i < y; i++)
		a = a * x;
	return a;
}
const int nmax = 150;
int cccc[nmax][nmax];
ll comb(ll n, ll k) {
	if (n < k) {
		cout << "error n<k"<<endl;
		return -1;
	}
	if (cccc[n][k] > 0)return cccc[n][k];
	if (k == 0 || n == k)return 1;
	return cccc[n][k] = comb(n - 1, k - 1) + comb(n - 1, k);
}

int main() {
	ll A, B;
	cin >> A >> B;
	if (A != 1 && B != 1)
		cout << 1;
	else if (A != 2 && B != 2)
		cout << 2;
	else
		cout << 3;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<map>
#include<cstdio>
#include<vector>
#define F first
#define S second
using namespace std;
typedef pair<int,int> P;

bool cmp(const P &p,const P &q){
  if(p.S != q.S)return p.S > q.S;
  return p.F < q.F;
}

int main(){
  int id,sol;
 vector<P> info;
  while(true){   
    scanf("%d,%d",&id,&sol);
    if(id+sol == 0)break;
    info.push_back(P(id,sol));
  }
  sort(info.begin(),info.end(),cmp);
  int pre = info[0].S;
  int cnt = 1;
  map<int,int> rank;
  for(int i=0;i<=info.size();i++){
    if(pre != info[i].S){cnt++; pre = info[i].S;}
    rank[info[i].F] = cnt;
  }
  int exec;
  while(cin >> exec){
    cout << rank[exec] << endl;
  }
  return 0;
}

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

#define dbg(a)  cerr << __LINE__ << ": " << #a << " = " << a << '\n'

template<class T> inline istream& operator>>(istream& str, vector<T> &a) { for (auto &i : a) str >> i; return str; }

typedef long long ll;

int main(){
  ios::sync_with_stdio(0), cin.tie(0);
  
  int n;  cin >> n;
  vector<int> a(n);  cin >> a;
  int ans = 0;
  for (int i = 0; i < n; ++i){
    int now = 0;
    while(a[i]%2==0){
      a[i] /= 2, now++;
    }
    ans += now;
  }
  cout << ans << "\n";
  return 0;
}

Measured memory_bytes: 3524
S = list(input())
temp_ans = 0
ans = 0
for i in range(3):
  if S[i] == 'R':
    temp_ans += 1
  else:
    if ans < temp_ans:
      ans = temp_ans
      temp_ans = 0
else:
  if ans < temp_ans:
    ans = temp_ans
      
print(ans)

Measured memory_bytes: 9092
#include<stdio.h>
int main(void){
int a,b,c;
scanf("%d %d",&a,&b);
if((((a*b)%2)==0)){
printf("No");
}else if(c==1){
printf("Yes");
}else if(c==2){
printf("No");
}else{
printf("Yes");
}
return 0;
}

Measured memory_bytes: 128
solve :: [Int] -> [Int] -> (Int,Int)

solve [] [] = (0,0)

solve [] (y:ys) = (0,y)

solve (x:xs) [] = (0,0)

solve (x:xs) (y:ys) = 
    let (x1,y1) = solve xs ys
        y2 = y + y1
    in if x < y2
        then (x+x1,if y < (y2-x) then y else (y2-x))
        else (y2+x1,0)

main :: IO ()
main = do 
    
    line <- getLine

    input1 <- map read . words <$> getLine

    input2 <- map read . words <$> getLine    

    let (result,_) = solve input1 (0:input2)
    
    putStrLn ( show result )


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

vector<pair<int,int>> dv = {{1,0}, {0,1}};  // 右と下

int main()
{
    int h,w;
    cin >> h >> w;
    vector<string> v(h);
    for(int i=0; i<h; i++) cin >> v[i];
    // 二次元配列を i*w+j によって一次元ノードに変換
    int n = h * w;
    vector<vector<int>> d(n, vector<int>(n, 1e9));
    for(int i=0; i<n; i++) d[i][i] = 0;
    
    // 隣接行列の準備
    for(int i=0; i<h; i++){
        for(int j=0; j<w; j++){
            if(v[i][j] == '#') continue;
            for(auto e: dv){
                int x = i + e.first;
                int y = j + e.second;
                if(x < 0 || x >= h || y < 0 || y >=w ) continue;
                if(v[x][y] == '#') continue;
                d[i*w + j][x*w + y] = 1;
                d[x*w + y][i*w + j] = 1;
            }
        }
    }
    
    for(int k=0; k<n; k++){         // Warshall-Floyd
        for(int i=0; i<n; i++){
            for(int j=0; j<n; j++){
                d[i][j] = min(d[i][k] + d[k][j], d[i][j]);
            }
        }
    }
    int ans = 0;
    for(auto v: d){
        for(auto e: v){
            if(e >= 1e9)  continue;
            ans = max(ans, e);
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 896
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repi(i, s, n) for (int i = (s); i < (n); i++)
#ifdef LOCAL
#define INPUT_FILE                   \
  ifstream in("abc176/abc176_a.txt"); \
  cin.rdbuf(in.rdbuf());
#define print_vec(v) \
rep(l, v.size()) { cout << v[l] << " "; } \
cout << endl;
#else
#define INPUT_FILE
#define print_vec(v)
#endif
#define CIN_OPTIMIZE \
  cin.tie(0);        \
  ios::sync_with_stdio(false);
typedef pair<int, int> P;
typedef long long ll;
typedef pair<ll, ll> pl;
const int INF = 100100100;
const ll LINF = 1e18+100;
const int MOD = 1e9 + 7;

int main() {
  INPUT_FILE CIN_OPTIMIZE;

  int N, X, T;
  cin >> N >> X >> T;
  
  ll ans = ceil((double)N / X) * T;

  cout << ans << endl;
}

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

using namespace std;

#define long long long
#define INF ((long) 2e18)
#define MOD ((long) (998244353))
#define umap unordered_map

struct Node
{
    long total = 1;
    set<long> adj;
};

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

    long t = 1;
    //cin >> t;

    while (t--) {
        long x;
        cin >> x;

        long ans = 0;
        long k = x / 500;
        ans += 1000 * k;
        x -= 500 * k;
        k = x / 5;
        ans += 5 * k;
        printf("%lld\n", ans);
    }
}


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

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef vector<ld> vd;
typedef vector<ll> vll;
typedef vector<string> vstr;
typedef vector<vector<ll>> vvll;
typedef vector<pair<ll, ll>> vpll;
typedef priority_queue<ll, vector<ll>, greater<ll>> spqll;  // 小さい順に取り出し
typedef priority_queue<ll, vector<ll>, less<ll>> bpqll;     // 大きい順に取り出し

#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define FOR(i, a, b) for (ll i = (ll)a; i < (ll)b; i++)
#define IREP(i, v) for (auto i = (v).begin(); i != (v).end(); i++)
#define FI first
#define SE second
#define MP make_pair
#define MT make_tuple
#define PB push_back
#define TS to_string
#define NP next_permutation
#define ALL(v) (v).begin(), (v).end()
#define SZ(x) (ll) x.size()
#define SP(x) setprecision((ll)x)


ll INF = 1e9;
ll NIL = -1;
ll MOD = 1000000007;
ll LINF = 1e18;
ld EPS = 1e-9;
ld PI = M_PI;
vll dx = {1, 0, -1, 0, 1, -1, -1, 1};
vll dy = {0, 1, 0, -1, 1, 1, -1, -1};
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a;} //最大公約数
ll lcm(ll a, ll b) { return a / gcd(a, b) * b;}     //最小公倍数

void yes(){ cout << "Yes" << endl;}
void no(){ cout << "No" << endl;}

//-----------------------------------------
string s, t;
const ll L_MAX = 3000+10;

ll dp[L_MAX][L_MAX]; // dp[i][j] = (s[i],t[j]までの最長共通部分列長)
string ans[L_MAX][L_MAX]; // ans[i][j] = (s[i],t[j]までの最長共通部分)

ll q(ll x, ll y){
    if(dp[x][y]!=-1) return dp[x][y];

    if(s[x-1]==t[y-1]) dp[x][y] = q(x-1,y-1) + 1;
    else dp[x][y] = max(q(x-1,y),q(x,y-1));

    return dp[x][y];
}

string solve(ll x, ll y){
    if(dp[x][y]==0) return "";

    if(s[x-1]==t[y-1]) ans[x][y] = solve(x-1,y-1) + s[x-1];
    else{
        if(dp[x-1][y]>=dp[x][y-1]) ans[x][y] = solve(x-1,y);
        else ans[x][y] = solve(x,y-1);
    }

    return ans[x][y];
}



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

    cin >> s >> t;

    ll n = SZ(s);
    ll m = SZ(t);

    for(ll i=0;i<=n;i++){
        for(ll j=0;j<=m;j++){
            if(i==0 || j==0){
                dp[i][j] = 0;
            }
            else{
                dp[i][j] = -1;
            }
        }
    }

    ll k = q(n,m);

    cout << solve(n,m) <<endl;

    return 0;
}



Measured memory_bytes: 366660
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int x = 0;
		int n = sc.nextInt();

		int n10, n100, n1000;

		for (int i = 1; i <= n; i++) {

			n10 = i / 10;//10の位が3かどうか
			n100 = i / 100;//100の位が3かどうか
			n1000 = i / 1000;//1000の位が3かどうか

			if (i % 3 == 0 || i % 10 == 3 || n10 % 10 == 3 || n100 % 10 == 3 || n1000 % 10 == 3) {
				System.out.print(" " + i);

			}

		}
		System.out.println();
	}
}



Measured memory_bytes: 28984
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <numeric>
#include <ctime>
#include <complex>
#include <bitset>
#include <random>
#include <stack>

using namespace std;

typedef long long ll;
typedef long double ld;

//#define int ll
#define double ld
#define loop(i, n) for(int i = 0; i < (int)n; ++i)
#define loop1(i, n) for(int i = 1; i <= (int)n; ++i)
#define F first
#define S second
#define pb push_back
#define pi pair <int, int>
#define all(x) begin(x), end(x)
#define ti tuple <int, int, int>
#define Point Vect
#define mkt make_tuple
#define no {cout << -1; return;}

void solve() {
    int m, k;
    cin >> m >> k;
    if (m == 1) {
        if (k == 0)
            cout << "1 1 0 0";
        else
            cout << -1;
        return;
    }
    if (k > (1 << m) - 1)
        no;
    loop(i, (1 << m))
        if (i != k)
            cout << i << " ";
    cout << k << " ";
    for (int i = (1 << m) - 1; i >= 0; --i)
        if (i != k)
            cout << i << " ";
    cout << k;

}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    //freopen("output.txt", "w", stdout);
    //int t; cin >> t; loop(i, t)
    solve();
    return 0;
}

Measured memory_bytes: 3572
#include <stdio.h>
#include <string.h>
#define max(x,y) ((x)>(y)?(x):(y))
#define min(x,y) ((x)<(y)?(x):(y))
#define FOR(i,m,n) for(i=m;i<n;i++)

int main(void)
{
	int a=0,b=0,d,i;
	char c[110];
	scanf("%s",&c);
	d=strlen(c);
	if(c[0]=='k') a++;
	if(c[1]=='e'&&a==1) a++;
	if(c[2]=='y'&&a==2) a++;
	if(c[3]=='e'&&a==3) a++;
	if(c[4]=='n'&&a==4) a++;
	if(c[5]=='c'&&a==5) a++;
	if(c[6]=='e'&&a==6) a++;
	if(c[d-1]=='e') b++;
	if(c[d-2]=='c'&&b==1) b++;
	if(c[d-3]=='n'&&b==2) b++;
	if(c[d-4]=='e'&&b==3) b++;
	if(c[d-5]=='y'&&b==4) b++;
	if(c[d-6]=='e'&&b==5) b++;
	if(c[d-7]=='k'&&b==6) b++;
	if(a+b>6){
		printf("YES\n");
	}else{
		printf("NO\n");
	}
	return 0;
}

Measured memory_bytes: 128
import math
def func(h, w, d, a, query):
    imos = [0 for _ in range(h*w)]
    pos = [[0, 0] for _ in range(h*w)]
    for i in range(h):
        for j in range(w):
            pos[a[i][j]] = [i, j]
    for i in range(d):
        for j in range(math.ceil((h*w-i)/d)):
            if j == 0:
                continue
            else:
                imos[i + d * j] = imos[i + d * (j-1)]\
                                  + abs(pos[i + d * j][0] - pos[i + d * (j-1)][0])\
                                  + abs(pos[i + d * j][1] - pos[i + d * (j-1)][1])
    for i in range(len(query)):
        print(imos[query[i][1]] - imos[query[i][0]])
    return
h, w, d = [int(i) for i in input().split()]
a = [[0 for _ in range(w)] for _ in range(h)]
for i in range(h):
    a[i] = [int(i) - 1 for i in input().split()]
q = int(input())
query = [[0, 0] for _ in range(q)]
for i in range(q):
    query[i] = [int(i) - 1 for i in input().split()]
func(h, w, d, a, query)
"""
func(3, 3, 2, [[0, 3, 2], [1, 4, 6], [7, 8, 5]], [[3, 7]])
print("ans: 5\n")
func(4, 2, 3, [[2, 6], [0, 3], [4, 1], [5, 7]], [[1, 1], [1, 1]])
print("ans: 0, 0\n")
func(5, 5, 4, [[12, 24, 6, 14, 16], [15, 21, 19, 1, 8], [13, 10, 11, 0, 18], [9, 5, 22, 7, 17], [2, 20, 4, 23, 3]], [[12, 12], [1, 9], [12, 12]])
print("ans: 0, 5, 0")
"""
# print("func({}, {}, {}, {}, {})".format(h, w, d, a, query))


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

typedef long long LL;

const int N=2e5+10;

pair<LL,LL>A[N];
LL f[N][3];

int cmp(pair<LL,LL>a,pair<LL,LL>b)
{
	if(a.first==b.first) return a.second<b.second;
	return a.first<b.first;
}
	

int n;
LL Ans;


int main()
{
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		LL x,y;
		scanf("%lld%lld",&x,&y);
		if(x>y) swap(x,y);
		A[i]=make_pair(x,y);
	}
	sort(A+1,A+n+1,cmp);
	Ans=1e18;
	for(int i=1;i<=n;i++) f[i][0]=max(f[i-1][0],A[i].second);
	for(int i=n;i;i--) f[i][1]=max(f[i+1][1],A[i].second);
	f[0][2]=1e18;
	for(int i=1;i<=n;i++) f[i][2]=min(f[i-1][2],A[i].second);
	LL R1,R2,B1,B2;
	R1=A[n].first,R2=A[1].first,B1=0,B2=1e9;
	for(int i=1;i<=n;i++) B1=max(B1,A[i].second),B2=min(B2,A[i].second);
	Ans=(R1-R2)*(B1-B2);
	for(int i=1;i<n;i++)
	{
		R1=max(R1,A[i].second);
		R2=min(A[i+1].first,f[i][2]);
		B1=f[i+1][1];
		B2=A[1].first;
		if(R2<=f[i][0]) Ans=min(Ans,(R1-R2)*(B1-B2));
	}			
	cout<<Ans<<endl;
}
	
	
	

Measured memory_bytes: 8064
parseInt(x) = parse(Int,x)

function main()
  (P,Q,R) = map(parseInt,split(readline()))
  dist=zeros(Int64,6)
  dist[1]=P+Q
  dist[2]=P+R
  dist[3]=Q+P
  dist[4]=Q+R
  dist[5]=R+P
  dist[6]=R+Q
  println(findmin(dist)[1])
end

main()

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

int main ()
{
  int n,k;
  cin>>n>>k;
  int a[n];
  for(int i=0;i<n;i++)
    cin>>a[i];
  sort(a,a+n);
  int sum=0;
  for(int i=0;i<k;i++)
    sum+=a[i];
  cout<<sum<<endl;
}

Measured memory_bytes: 3540
import java.util.*;
class Main{
    Scanner sc=new Scanner(System.in);
    void main(){
	while(true){
	    int h=sc.nextInt();
	    int w=sc.nextInt();
	    if(h==0&&w==0)break;
	    for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
		    if((i+j)%2==0)System.out.print("#");
		    else System.out.print(".");
		}
		System.out.println();
	    }
	    System.out.println();
	}
    }
    public static void main(String[]ag){
	new Main().main();
    }
}

Measured memory_bytes: 35604
a=input()
b=input()
c=input()

flag=""
phase=0
card=''

while flag=="":
    if phase==0:
        if len(a)==0:
            flag="A"
        else:
            card=a[0]
            a=a[1:len(a)]
    if phase==1:
        if len(b)==0:
            flag="B"
        else:
            card=b[0]
            b=b[1:len(b)]
    if phase==2:
        if len(c)==0:
            flag="C"
        else:
            card=c[0]
            c=c[1:len(c)]
    if card=='a':
        phase=0
    if card=='b':
        phase=1
    if card=='c':
        phase=2

print(flag)

Measured memory_bytes: 3064
use std::io::{stdin, Read, StdinLock};
use std::str::FromStr;
use std::vec::Vec;
use std::{vec, cmp, num};


struct Scanner<'a> {
    cin: StdinLock<'a>,
}

impl<'a> Scanner<'a> {
    fn new(cin: StdinLock<'a>) -> Scanner<'a> {
        Scanner {cin: cin}
    }

    fn read1<T: FromStr>(&mut self) -> Option<T> {
        let token = self.cin.by_ref().bytes().map(|c| c.unwrap() as char)
                    .skip_while(|c| c.is_whitespace())
                    .take_while(|c| !c.is_whitespace())
                    .collect::<String>();
        token.parse::<T>().ok()
    }

    fn read<T: FromStr>(&mut self) -> T {
        self.read1().unwrap()
    }
}

// create Vec<char> from String
#[allow(dead_code)]
fn to_chars(s: String) -> vec::Vec<char> {
    let mut cs = s.chars();
    let mut res = vec::Vec::new();
    while let Some(c) = cs.next() {
        res.push(c);
    }
    res
}

fn main() {
    let cin = stdin();
    let cin = cin.lock();
    let mut sc = Scanner::new(cin);
    let m: i32 = sc.read();
    println!("{}", 48 - m);
}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define debug(x) cerr << #x << ": " << x << '\n';
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = (int)1e9;

int w, h;
int c[51][51];
int dx[] = {1, -1, 0, 0, 1, 1, -1, -1};
int dy[] = {0, 0, 1, -1, 1, -1, 1, -1};

void dfs(int y, int x){
	c[y][x] = 0;
	for(int i = 0; i < 8; i++){
		int ny = y + dy[i], nx = x + dx[i];
		if(0<=ny and ny<h and 0<=nx and nx<w and c[ny][nx]==1){
			dfs(ny, nx);
		}
	}
}

int solve(){
	int res = 0;
	for(int i = 0; i < h; i++){
		for(int j = 0; j < w; j++){
			if(c[i][j] == 1){
				dfs(i, j);
				res++;
			}
		}
	}

	return res;
}

int main(void){
	while(scanf("%d%d", &w, &h) != EOF){
		if(w == 0 and h == 0) break;
		for(int i = 0; i < h; i++){
			for(int j = 0; j < w; j++){
				scanf("%d", &(c[i][j]));
			}
		}
		printf("%d\n", solve());
	}

	return 0;
}



Measured memory_bytes: 3252
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int[] a = new int[n];
        for (int i = 0; i < n; ++i) a[i] = in.nextInt();
        int res = Integer.MAX_VALUE;
        for (int i = -100; i <= 100; ++i) {
            int sum = 0;
            for (int x : a) {
                if (x == i) continue;
                sum += getPrice(x, i);
            }
            res = Math.min(res, sum);
        }
        System.out.println(res);
    }

    static int getPrice(int x, int y) {
        return (int) Math.pow((x - y), 2);
    }
}


Measured memory_bytes: 23636
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;

int main()
{
    string s;
    cin >> s;
    int a, z;
    for (int i = 0; i < s.size(); i++) {
        if (s[i] == 'A') {
            a = i;
            break;
        }
    }
    for (int i = s.size() - 1; i > 0; i--) {
        if (s[i] == 'Z') {
            z = i;
            break;
        }
    }
    cout << z - a + 1 << endl;
    return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
#define maxn 500005
using namespace std;
inline int read()
{
	char x = getchar();
	int lin = 0, f = 1;
	while(x < '0' || x > '9')
	{
		if(x == '-') f = -1;
		x = getchar();
	}
    while(x >= '0' && x <= '9')
	{
		lin = lin * 10 + x - '0';
		x = getchar();
	}
	return lin * f;
}
#define PII pair<int,int>
#define fir first
#define sec second
#define ma(a,b) make_pair(a,b)
signed main(){
	int n = read();
	if(n == 1)
	{
		cout << "Hello World";
		return 0;
	}
	int a,b;
	a = read(); b = read();
	cout << a + b;
}

Measured memory_bytes: 768
import math
N = int(input())
S = 0
ans = 0
for i in range(1000, 10001, 1000):
    if i - N == 0:
        ans = 0
        break
    if i - N > 0:
        ans = i - N
        break
        # ans = min(ans, i - N)
        
print(ans)

Measured memory_bytes: 9120
N, M = map(int,input().split())
Low = 0
High = N

for x in range(M):
    L, R = map(int,input().split())
    Low = max(Low, L)
    High = min(High, R)

if High >= Low:
    answer = High - Low + 1
else:
    answer = 0
    
print(answer)

Measured memory_bytes: 3060
N,C,K = map(int,input().split())
T = [int(input()) for _ in range(N)]
T.sort()
time = T.pop(0)
people = 1
ans = 1
for t in T:
    if t <= time + K and people < C:
        people += 1
    else:
        time = t
        people = 1
        ans += 1
print(ans)

Measured memory_bytes: 7488
#import <Foundation/Foundation.h>

int main()
{
    @autoreleasepool{
        NSData *stdinData = [[NSFileHandle fileHandleWithStandardInput] availableData];
        NSString *stdinString = [[NSString alloc] initWithData:stdinData encoding:NSUTF8StringEncoding];
		NSInteger R = [stdinString intValue];
		NSString *ans = [NSString stringWithFormat:@"%.2f\n", 2 * M_PI * R];

        NSFileHandle *fileHandle = [NSFileHandle fileHandleWithStandardOutput];
        [fileHandle writeData:[ans dataUsingEncoding:NSUTF8StringEncoding]];
        [fileHandle closeFile];
    }
}


Measured memory_bytes: 16760
#include <iostream>
#include <string>
#include <cstdlib>
#include <cstdio>
#include <queue>
#include <stack>
#include <list>
#include <utility>
#include <vector>
#include <set>
#include <algorithm>
#include <cmath>
#include <climits>
#include <map>
#include <unordered_map>
#include <string.h>
#include<iomanip>
#include <iterator>
#include <locale>

#define all(a) a.begin(),a.end()
#define VV(T) vector<vector< T > >
#define rep(i,N) for(int i = 0; i <N; i++)
#define repsg(i,s,g) for(int i = s; i <g; i++)
#define name(x) #x
using namespace std;


const int INF = 10000000;
const long long INFL = (1LL<<40);
const int MOD = pow(10,9)+7;
int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};

typedef long long ll,LL;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;
typedef pair<int,int> pii;
typedef pair<LL, LL> pLL;


// vector入力
template<typename T>
istream& operator >> (istream& is, vector<T>& vec){
    for(T& x: vec) is >> x;
    return is;
}
// vector出力
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;
}

template< typename T >
struct edge{
    int src, to;T cost;
    edge(int to,T cost) :src(-1),to(to),cost(cost){}
    edge(int src, int to, T cost) :src(src),to(to),cost(cost){}edge
    &operator=(const int &x){
        to =x;
        return *this;
    }
    operator int() const{ return to;}
};

double dist (double a, double b,  double c, double d){
    
    return sqrt((a-c)*(a-c) + (b-d)*(b-d));
    
}

int main() {
    string s;cin>>s;
    int p = 0;
    int l = s.size()-1;
    
    while(1){
        if(s[p]!='A'){p++;continue;}
        break;
        
    }
    while(1){
        if(s[l]!='Z'){l--;continue;}
        break;
    }
    
    cout << l - p +1<<endl;
    return 0;
}







Measured memory_bytes: 640
S = input()
ans = 0
for i in range(1<<(len(S)-1)):
    li = []
    last = 0
    for j in range(len(S)-1):
        if((i>>j & 1)==1):
            li+=[int(S[last:j+1])]
            last = j+1
    if(last!=len(S)):
        li+=[int(S[last:])]
    ans += sum(li)
print(ans)

Measured memory_bytes: 3064
using System;
using System.Collections.Generic;
/*using System.Linq;
using System.Text;
using System.Threading.Tasks;*/

class Program
{
    static void Main(string[] args)
    {
        String s = Console.ReadLine();
        String [] c = s.Split(' ');
        int a = int.Parse(c[0]);
        int b = int.Parse(c[1]);
        Console.WriteLine("{0} {1}", a * b, (a + b) * 2);
    }
}

Measured memory_bytes: 9132
import core.bitop;
import std.algorithm;
import std.ascii;
import std.bigint;
import std.conv;
import std.functional;
import std.math;
import std.numeric;
import std.range;
import std.stdio;
import std.string;
import std.random;
import std.typecons;
import std.container;

alias sread = () => readln.chomp();
alias Point2 = Tuple!(long, "y", long, "x");

T lread(T = long)()
{
    return readln.chomp.to!T();
}

T[] aryread(T = long)()
{
    return readln.split.to!(T[])();
}

void scan(TList...)(ref TList Args)
{
    auto line = readln.split();
    foreach (i, T; TList)
    {
        T val = line[i].to!(T);
        Args[i] = val;
    }
}

void main()
{
    long[] high = new long[1000];
    high[0] = 1;
    foreach (e; 1 .. 1000)
    {
        high[e] = high[e - 1] + (e + 1);
    }

    long a, b;
    scan(a, b);
    long dif = abs(a - b);

    writeln(high[dif - 1] - b);
}

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

int main() {
  string S;
  cin >> S;
  int countOdd0 = 0;
  int countOdd1 = 0;
  int countEven0 = 0;
  int countEven1 = 0;
  
  for (int i = 0; i < S.size(); i += 2) {
    if (S.at(i) == '0') {
      countOdd0++;
    }
    else {
      countOdd1++;
    }
  }
  for (int i = 1; i < S.size(); i += 2) {
    if (S.at(i) == '0') {
      countEven0++;
    }
    else {
      countEven1++;
    }
  }
  
  int case1 = countOdd0 + countEven1;
  int case2 = countOdd1 + countEven0;
  
  cout << min(case1, case2) << endl;
}
  

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

int main() {
  int N, K; cin>>N>>K;
  set<int> S;
  while(--K >= 0) {
    int d; cin>>d;
    for(int i = 0; i < d; i++) {
      int v; cin>>v;
      S.insert(v);
    }
  }
  cout << N - S.size() << endl;
  return 0;
}


Measured memory_bytes: 3160
#!/usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def LS(): return list(map(list, input().split()))
def S(): return list(input().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = 1e10

#solve
def solve():
    n, k = LI()
    a = LI()
    acc = [0] + list(itertools.accumulate(a))
    lis = []
    for i in range(n):
        for j in range(i + 1, n + 1):
            lis.append(acc[j] - acc[i])
    lis.sort()
    ans = deque()
    for l in lis:
        ans.append(l)
    ansnum = 0
    N = len(bin(acc[-1])) - 2
    for i in range(N):
        tmp = deque()
        lenans = len(ans)
        for _ in range(lenans):
            p = ans.popleft()
            if (1 << (N - 1 - i)) & p:
                ans.append(p)
            else:
                tmp.append(p)
        if len(ans) < k:
            while tmp:
                t = tmp.pop()
                ans.append(t)
        else:
            ansnum |= (1 << (N - 1 - i))
    print(ansnum)
    return


#main
if __name__ == '__main__':
    solve()


Measured memory_bytes: 77956
/**
 *    author:  otera    
**/
#include<iostream>
#include<string> 
#include<cstdio>
#include<cstring>
#include<vector>
#include<cmath>
#include<algorithm> 
#include<functional>
#include<iomanip>
#include<queue>
#include<deque>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;

//#define int long long
typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef long double ld;
const int inf=1e9+7;
const ll INF=1LL<<60 ;
const ll mod=1e9+7 ;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<int, int> P;
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
#define debug(x)  cerr << #x << " = " << (x) << endl;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

void solve() {
	int x[5];
    rep(i, 5) {
        cin >> x[i];
    }
    rep(i, 5) {
        if(x[i] == 0) {
            cout << i + 1 << endl;
            return;
        }
    }
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(10);
	//int t; cin >> t; rep(i, t)solve();
	solve();
    return 0;
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, s, e) for (int i = (int)(s); i <= (int)(e); i++)
#define printYesNo(is_ok) puts(is_ok ? "Yes" : "No");
#define printVector(v) rep(i, v.size()) cout << v[i] << endl;

int SameAlphabetNum(string X, string Y)
{
  vector<bool> CountX(30), CountY(30);
  rep(i, X.size())
  {
    CountX[X[i] - 'a'] = true;
  }
  rep(i, Y.size())
  {
    CountY[Y[i] - 'a'] = true;
  }
  int dst = 0;
  rep(i, 30)
  {
    if (CountX[i] && CountY[i])
      dst++;
  }
  return dst;
}

int main()
{
  int N;
  string S;
  cin >> N >> S;
  int ans = 0;
  rep(i, N + 1)
  {
    string X = S.substr(0, S.size() - i);
    string Y = S.substr(S.size() - i, i);
    ans = max(ans, SameAlphabetNum(X, Y));
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
open Printf
open Scanf

let () =
  let n = scanf "%d " (fun x -> x) in
  let ar = Array.init n (fun _ -> scanf "%s %d " (fun x y -> (x, y))) in
  let (_, db) = Array.fold_right (fun (nm, t) (tt, ls) -> (t + tt, (nm, tt) :: ls)) ar (0, []) in
  let s = scanf "%s " (fun x -> x) in
  printf "%d\n" @@ List.assoc s db


Measured memory_bytes: 384
import sys
input = sys.stdin.readline

n,m,k = map(int,input().split())
a =[0] + list(map(int,input().split())) 
b =[0] + list(map(int,input().split()))

if min(a[1],b[1]) > k:
    print(0)
    exit()

asum = [a[0]]
bsum = [b[0]]

for i in range(1,n+1):
    ain = asum[-1]+a[i]
    asum.append(ain)
for i in range(1,m+1):
    bsum.append(bsum[-1]+b[i])

for i in range(n+1):
    if asum[i] > k:
        aind = i-1
        break
else:
    aind = n

for i in range(m+1):
    if bsum[i] > k:
        bind = i-1
        break
else:
    bind = m
# print(aind,bind)
while asum[aind] + bsum[bind] > k:
    bind -= 1
    if bind == 0:
        break



ans = aind + bind
# print(ans,aind,bind)
for i in range(aind-1,-1,-1):
    while asum[i] + bsum[bind] <= k:
        bind += 1
        if bind == m+1:
            bind -= 1
            ans = max(ans,i+bind)
            break
    else:
        bind -= 1
        ans = max(ans,i+bind)

print(ans)

Measured memory_bytes: 47620
import java.util.*;

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

    String S = sc.next();
    char[] c = S.toCharArray();
    sc.close();

    int cnt =0;
    for (int i = 2; i < N; ++i) {
      if(c[i - 2] == 'A') {
        if(c[i - 1] == 'B') {
          if(c[i] == 'C'){
            ++cnt;
          }
        }
      }
    }

    System.out.println(cnt);
  }


}

Measured memory_bytes: 23892