akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <stdlib.h>
#include <string>
using namespace std;

int main(){
    std::ios::sync_with_stdio(false);
    std::cin.tie(NULL);
    int X;
    cin >> X;
    int p;


    p=X/500*1000;
    X=X%500;
    p=p+X/5*5;
    cout << p;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define LL long long
using namespace std;
int main(){
	LL n, a, b;
	cin>>n>>a>>b;
	if(n==1){
		if(b==a) cout<<1<<endl;
		else cout<<0<<endl;
		return 0;
	}
	LL bot = (n-1)*a+b;
	LL top = (n-1)*b+a;
	cout<<max(top-bot+1,0LL)<<endl;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(void){
int A , B;
scanf("%d %d" , &A, &B);
if(A>B){
    printf("%d\n" , A*2-1);
}else if(A==B){
    printf("%d\n" , A + B);
}else{
    printf("%d\n" , B*2-1);
}

return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<vector>
#include<string>
using namespace std;
int main()
{
	ios_base::sync_with_stdio(false);
	string s1,s2,s3;
	cin>>s1>>s2>>s3;
	if(s1[s1.size()-1]==s2[0]&&s2[s2.size()-1]==s3[0])
		cout<<"YES"<<endl;
	else
		cout<<"NO"<<endl;
	return 0;
}

Measured memory_bytes: 256
#みんなのプロコン2019-C
import sys
readline = sys.stdin.buffer.readline
def even(n): return 1 if n%2==0 else 0

k,a,b = map(int,readline().split())

if b-a <= 2:
    print(k+1)
    exit()

res = max(0,(k-(a-1))//2)

ans = a+res*(b-a)

if not even(k-(a-1)):
    ans += 1

print(ans)

Measured memory_bytes: 61344
use std::io::Write;

#[allow(unused)]
macro_rules! debug {
    ($($format:tt)*) => (write!(std::io::stderr(), $($format)*).unwrap());
}
#[allow(unused)]
macro_rules! debugln {
    ($($format:tt)*) => (writeln!(std::io::stderr(), $($format)*).unwrap());
}

fn main() {
    let n: usize = {
        let mut s = String::new();
        std::io::stdin().read_line(&mut s).unwrap();
        let s = s.trim_right().to_owned();
        s.parse().unwrap()
    };

    let p: Vec<usize> = {
        let mut s = String::new();
        std::io::stdin().read_line(&mut s).unwrap();
        let s = s.trim_right().to_owned();
        s.split_whitespace().map(|x| x.parse().unwrap()).collect()
    };

    let q: Vec<usize> = {
        let mut s = String::new();
        std::io::stdin().read_line(&mut s).unwrap();
        let s = s.trim_right().to_owned();
        s.split_whitespace().map(|x| x.parse().unwrap()).collect()
    };

    let ord1 = calc_order(&p);
    let ord2 = calc_order(&q);
    if ord1 < ord2 {
        println!("{}", ord2 - ord1);
    } else {
        println!("{}", ord1 - ord2);
    }
}

fn calc_order(v: &Vec<usize>) -> usize {
    let n = v.len();

    let mut used = vec![false; n + 1];
    used[0] = true;

    let mut ret = 0;
    for i in 0..n {
        let a = used[1..v[i]].iter().filter(|x| **x == false).count();
        // debugln!("{}, {}", n, a);
        ret += a * factorial(n - i - 1);
        used[v[i]] = true;
    }

    ret + 1
}

fn factorial(n: usize) -> usize {
    let mut ret = 1;
    for i in 1..(n + 1) {
        ret *= i;
    }
    ret
}

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn factorial1() {
        assert_eq!(6, factorial(3));
    }

    #[test]
    fn factorial2() {
        assert_eq!(24, factorial(4));
    }

    #[test]
    fn calc_order1() {
        assert_eq!(5, calc_order(&vec![3, 1, 2]));
        assert_eq!(2, calc_order(&vec![1, 3, 2]));
    }
}


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

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

using namespace std;

const int MOD = 1e9 + 7;
const int MAXN = 10000010;

int sum0[MAXN];
int sum[MAXN];
int pref[MAXN];
int last[MAXN];

int add(int a, int b) {
    return ((ll) a + b) % MOD; 
}

int mul(int a, int b) {
    return ((ll) a * b) % MOD; 
}

int main() {
    ios_base::sync_with_stdio(false);
    REP(i, MAXN) sum0[i] = 1, last[i] = -1;
    sum[0] = 1;

    int n;
    cin >> n;

    int x = 0;
    REP(i, n) {
        int y;
        cin >> y;

        if (i > 0) pref[i] += pref[i - 1];

        x ^= y;
        if (x == 0) {
            pref[i]++;
            
            if (i == n - 1) {
                //assert(0);
                int out = 0;
                REP(i, MAXN) out = add(out, sum[i]);
                cout << out << "\n";
                return 0;
            }

            sum[0] = add(sum[0], sum[0]);
        } else {
            int num = pref[i];
            if (last[x] >= 0) num -= pref[last[x]];

            sum0[x] = add(sum0[x], mul(sum[x], num));
            sum[x] = add(sum[x], sum0[x]);
            last[x] = i;

            if (i == n - 1) {
                cout << sum0[x] << "\n";
                return 0;
            }
        }
    }


    return 0;
}

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

using namespace std;

using ll = long long;
using Graph = vector< vector<int> >;

const ll MOD = 1000000007;
const ll INV2 = (MOD + 1) / 2;

ll modpow(ll x, ll n, ll mod = MOD) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * x % mod;
        x = x * x % mod;
        n >>= 1;
    }
    return res;
}

void pre_dfs(int cur, int par, const Graph& g, vector<ll>& cnt) {
    cnt[cur] = 1;
    for (int nex : g[cur]) {
        if (nex == par) continue;
        pre_dfs(nex, cur, g, cnt);
        cnt[cur] += cnt[nex];
    }
}

void dfs(int cur, int par, const Graph& g, const vector<ll>& cnt, ll& ans) {
    cerr << cur << " " << cnt[cur] << endl;
    int n = g.size();
    ll par_cnt = n - 1;
    for (int nex : g[cur]) {
        if (nex == par) continue;
        par_cnt -= cnt[nex];
    }

    ll hoge = modpow(INV2, n - 1);
    ll res = (MOD + 1 - hoge) % MOD;
    res = (res + MOD - hoge * modpow(2, par_cnt) % MOD * (MOD + 1 - modpow(INV2, par_cnt)) % MOD) % MOD;
    for (int nex : g[cur]) {
        if (nex == par) continue;
        res = (res + MOD - hoge * modpow(2, cnt[nex]) % MOD * (MOD + 1 - modpow(INV2, cnt[nex])) % MOD) % MOD;
        dfs(nex, cur, g, cnt, ans);
    }   
    (res *= INV2) %= MOD;
    (ans += res) %= MOD;
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    
    int n;
    cin >> n;
    
    Graph g(n);
    for (int i = 1; i < n; ++i) {
        int a, b;
        cin >> a >> b;
        --a; --b;

        g[a].push_back(b);
        g[b].push_back(a);
    }

    vector<ll> cnt(n, 0);
    pre_dfs(0, -1, g, cnt);

    ll ans = 0;
    dfs(0, -1, g, cnt, ans);
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 28288
program main
real*8 :: a,b,h,m,pi,om1,om2,x1,y1,x2,y2,t,ans
read(*,*) a,b,h,m

pi = 3.141592653589793d0
om1 = 2.d0*pi/(12.d0 * 60.d0)
om2 = 2.d0*pi/60.d0
t = 60.d0 * h + m
x1 = a*cos(om1*t)
y1 = a*sin(om1*t)
x2 = b*cos(om2*t)
y2 = b*sin(om2*t)

ans = sqrt((x1 - x2)**2 + (y1 - y2)**2)
write(*,*)ans
end program

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

const ll mod = 1e9+7;

ll solve(string &s,int k = 0,bool status = 1){
    static ll dp[100001][2];
    if(!k) memset(dp,-1,sizeof(dp));
 
    if(k==s.size()){
        return 1;
    }
 
    ll &res = dp[k][status];
    if(res!=-1) return res;
    else res = 0;
 
    int r = (status?s[k]-'0':1);
 
    for(int i = 0;i <= r;i ++){
        int cnt = solve(s,k+1,status && i==r);
        res += i?cnt*2:cnt;
        res %= mod;
    }
    return res;
}

int main(){
    string s;
    cin >> s;
    cout << solve(s) << endl;
    return 0;
}

Measured memory_bytes: 9856
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,k,n) for(int i = (k); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) a.begin(), a.end()
#define MS(m,v) memset(m,v,sizeof(m))
#define D10 fixed<<setprecision(10)
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
const int INF = 114514810;
const int MOD = 1000000007;
const double EPS = 1e-10;
template<class T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<class T> T &chmax(T &a, const T &b) { return a = max(a, b); }

/*--------------------template--------------------*/
string s;
int p, var[11];
bool f;

int parse();

int unit()
{
	int res;
	if (s[p] == '-'&&s[p + 1] != '>')
	{
		p++;
		int a = unit();
		res = 1 - a;
	}
	else if (s[p] == '(')
	{
		p++;
		res = parse();
		p++;
	}
	else
	{
		p++;
		if (s[p-1] == 'T') return res = 1;
		else if (s[p-1] == 'F') return res = 0;
		else
		{
			int t = s[p-1] - 'a';
			res = var[t];
		}
	}
	return res;
}

int parse()
{
	int a = unit();
	if (s[p] == '+')
	{
		p++;
		int b = unit();
		a = max(a, b);
	}
	else if (s[p] == '*')
	{
		p++;
		int b = unit();
		a = min(a, b);
	}
	else if(s[p]=='-'&&s[p+1]=='>')
	{
		p+=2;
		int b = unit();
		if (a == 1 && b == 0) a = 0;
		else a = 1;
	}
	return a;
}

void solve()
{
	p = 0;
	int l = parse();
	p++;
	int r = parse();
	if (l != r) f = false;
}

int main()
{
	while (cin >> s&&s != "#")
	{
		f = true;
		REP(i, 1 << 11)
		{
			REP(j, 11)
			{
				var[j] = (i >> j) & 1;
				solve();
			}
		}
		puts(f ? "YES" : "NO");
	}
	return 0;
}

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

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

typedef long long ll;

const int INF = 1 << 30;
const ll LLINF = 1LL << 60;

int mod = 1000000007;

int main(void){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N; cin >> N;
    int L[N]; rep(i, N) cin >> L[i];
    ll ans = 0;
    sort(L, L+N);
    for(int i = 0; i < N; i++){
        for(int j = i+1; j < N; j++){
            //k > j かつ L[k] < L[j]+L[i]を満たすKの個数
            int ok = j, ng = N;
            int m = (ok+ng)/2;
            while(abs(ok-ng) > 1){
                if(L[m] < L[j]+L[i]) ok = m;
                else ng = m;
                m = (ok+ng)/2;
            }
            ans += ok-j;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Beg123B
{
    class Program
    {
        static void Main(string[] args)
        {
            var mins = new int[5];
            mins[0] = int.Parse(Console.ReadLine());
            mins[1] = int.Parse(Console.ReadLine());
            mins[2] = int.Parse(Console.ReadLine());
            mins[3] = int.Parse(Console.ReadLine());
            mins[4] = int.Parse(Console.ReadLine());

            var diffs = mins.Select(x => x % 10 == 0 ? 0 : 10 - x % 10);
            var ans = mins.Sum() + diffs.Sum() - diffs.Max();
            Console.WriteLine(ans);
        }
    }
}


Measured memory_bytes: 11348
import java.util.Scanner;

public class Main {

	public static int count = 0;
	
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int length = scanner.nextInt();
		int[] array = new int[length];
		for (int i=0; i<length; i++) {
			array[i] = scanner.nextInt();
		}
		scanner.close();
		
		bubbleSort(array, length);
		printArray(array);
		System.out.println(count);
	}
	
	public static void bubbleSort(int[] array, int length) {
		for (int i=0; i<length; i++) {
			for (int j=length-1; j>i; j--) {
				if (array[j] < array[j-1]) {
					array[j-1] = array[j-1] + array[j];
					array[j] = array[j-1] - array[j];
					array[j-1] = array[j-1] - array[j];
					count++;
				}
			}
		}
	}
	
	public static void printArray(int[] array) {
		for (int i = 0; i < array.length; i++) {
			if (i>0) System.out.print(" ");
			System.out.print(array[i]);
		}
		System.out.print("\n");
	}

}



Measured memory_bytes: 26328
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace A
{
    class Program
    {
        public static void Main(string[] args)
        {
            var s = ReadLineInt();
            var result = 0;

            if(s <= 2) {
                result = 0;
            }

            result = s / 3;

            Console.WriteLine(result);
            ReadLine();
        }

        public static string ReadLine()
        {
            return Console.ReadLine();
        }

        public static int ReadLineInt()
        {
            return int.Parse(Console.ReadLine());
        }

        public static string[] ReadLineStringSplit(char a = ' ')
        {
            return ReadLine().Split(a).ToArray();
        }

        public static int[] ReadLineIntSpilit(char a = ' ')
        {
            return ReadLine().Split(a).Select(x => int.Parse(x)).ToArray();
        }
    }
}

Measured memory_bytes: 11092
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <string>
#include <cmath>
#include <iostream>
#include<stack>
#include<queue>

#define ll long long int
#define all(x) x.begin(), x.end()
#define MOD 1000000007


using namespace std;

void solve()
{
    double R;
    cin >> R;

    cout << 2 * 3.141592 * R << endl;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int T = 1;
    //cin >> T;
    while (T--)
    {
        solve();
    }
    return 0;
}



Measured memory_bytes: 3804
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
const int INF = (1<<30)-1;
const long long LINF = (1LL<<62)-1;
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, 1, 0, -1};
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, p;
  string s;
  cin >> s;
  n = s.size(), p = 2019;
  if (p != 2 && p != 5) {
    vector<ll> num(p);
    ll prev = (s[n-1]-'0')%p, rem10n = 1;
    num[prev]++;
    for (int i = n-2; i >= 0; i--) {
      (rem10n *= 10) %= p;
      prev = ((s[i]-'0')%p*rem10n+prev)%p;
      num[prev]++;
    }
    ll ans = 0;
    rep(i, p)
      ans += num[i]*(num[i]-1)/2;
    ans += num[0];
    cout << ans << endl;
  } else {
    vector<vector<ll>> dp(n+1, vector<ll>(p));
    rep(i, n) {
      int a = s[i]-'0';
      rep(j, p)
        dp[i+1][(j*10+a)%p] += dp[i][j];
      dp[i+1][a%p]++;
    }
    ll ans = 0;
    rep(i, n+1)
      ans += dp[i][0];
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 3784
import sys
import numpy as np

def power_table(MOD, w, size):
    w_table = [0] * size
    w_table[0] = 1
    for i in range(1, size):
        w_table[i] = w_table[i - 1] * w % MOD
    return w_table

def numpy_ntt(MOD, w_table, data, scale=None):
    size = data.size
    step = 1
    while step < size:
        batch_size = size // (step * 2)
        data = data.reshape(step * 2, -1)
        odd = data[0::2]
        even = data[1::2]
        w1 = w_table[0:size // 2:batch_size]
        w2 = w_table[size // 2:size:batch_size]
        sub1 = (odd + even * w1) % MOD
        sub2 = (odd + even * w2) % MOD
        data = np.concatenate((sub1, sub2))
        step *= 2
    if scale is not None:
        data = data * scale % MOD
    return data.flatten()

def read_data():
    int_list = [int(s) for s in sys.stdin.read().split()]

    n = int_list[0]

    graph = [[] for _ in range(n)]
    for i in range(0, (n - 1) * 2, 2):
        a = int_list[i + 1] - 1
        b = int_list[i + 2] - 1
        graph[a].append(b)
        graph[b].append(a)

    size_table = [1] * n

    ret = 0
    stack = [-1, 0, 0]

    while True:
        node = stack[-1]
        index = stack[-2]
        size_table[node] += ret
        if index < len(graph[node]):
            dtr = graph[node][index]
            stack[-2] += 1
            if dtr != stack[-3]:
                stack.extend((0, dtr))
            ret = 0
        else:
            del stack[-2:]
            if len(stack) <= 1: break
            ret = size_table[node]

    g = [0] * n
    for s in size_table:
        if s != n:
            g[s - 1] += 1
            g[n - s - 1] += 1
    return (n, g)


def solve():
    MOD = 924844033

    def pow_mod(a, n):
        ret = 1
        while n != 0:
            if n % 2 == 1: ret = ret * a % MOD
            a = a * a % MOD
            n //= 2
        return ret

    n, answer = read_data()

    fac = [0] * (n + 1)
    fac[0] = 1
    for i in range(1, n + 1):
        fac[i] = fac[i - 1] * i % MOD

    ifac = [0] * (n + 1)
    ifac[n] = pow_mod(fac[n], MOD - 2)
    for i in range(n, 0, -1):
        ifac[i - 1] = ifac[i] * i % MOD

    def comb(x, y):
        return fac[x] * ifac[y] % MOD * ifac[x - y] % MOD

    for i in range(n):
        answer[i] = answer[i] * fac[i + 1] % MOD
    answer.reverse()

    ntt_size = 1
    while ntt_size <= n * 2: ntt_size *= 2

    w_table = power_table(MOD, pow_mod(5, (MOD - 1) // ntt_size), ntt_size)

    np_w_table = np.array(w_table).reshape(-1, 1)
    ifac_ntt = numpy_ntt(MOD, np_w_table, np.array(ifac[:n] + [0] * (ntt_size - n)))
    answer_ntt = numpy_ntt(MOD, np_w_table, np.array(answer + [0] * (ntt_size - n)))

    answer_ntt = answer_ntt * ifac_ntt % MOD

    for i in range(1, ntt_size // 2):
        w_table[i], w_table[ntt_size - i] = w_table[ntt_size - i], w_table[i]
    answer = numpy_ntt(MOD, np.array(w_table).reshape(-1, 1), answer_ntt, pow_mod(ntt_size, MOD - 2)).tolist()

    for i in range(1, n + 1):
        a = n * comb(n, i) % MOD
        b = answer[n - i] * ifac[i] % MOD
        print((a - b + MOD) % MOD)

solve()


Measured memory_bytes: 112892
#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
using str = string;
using P = pair<int, int>;
using Pll = pair<ll, ll>;
const double PI = 3.141592653589793238;
const ll mod = 1000000007;
#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define REP(i, m, n) for (int i = m; i < (int)n; i++)
#define all(a) (a).begin(), (a).end()
#define allg(a) (a).begin(), (a).end(), greator<>()
#define d20 std::setprecision(20)
#define veci vector<int>
#define vecll vector<long long int>
#define vecb vector<bool>
#define vecd vector<double>
template <typename T>
T lcm(T a, T b)
{
	return a / __gcd(a, b) * b;
}

int main()
{
	int n;
	double d;
	cin >> n >> d;
	int ans = 0;
	rep(i, n)
	{
		double x, y;
		cin >> x >> y;
		if (sqrt(x * x + y * y) <= d)
		{
			ans++;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3760
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ii = pair<int, int>;
using iii = pair<ii, int>;
#define vt vector
#define pq priority_queue
#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second
#define __lcm(a, b) a * b / __gcd(a, b)x
const int MOD = 1e9 + 7;
const int INF = 2e9;
const int N = 3e3 + 5;

int n, half;
double prob[N];
double dp[N][N];
bool vis[N][N];

double f(int idx, int tail) {
    if(idx > n) return tail < half ? 1 : 0;
    double &sol = dp[idx][tail];
    if(vis[idx][tail]) return sol;
    vis[idx][tail] = true;
    sol = f(idx + 1, tail) * prob[idx] + f(idx + 1, tail + 1) * (1 - prob[idx]);
    return sol;
}

void solve() {
    cin >> n;
    half = n / 2 + (n & 1 ? 1 : 0);
    for(int i = 1; i <= n; i++) {
        cin >> prob[i];
    }
    cout << fixed << setprecision(10) << f(1, 0) << "\n";
}

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

    solve();
    
}

Measured memory_bytes: 58840
#include <iostream>
#include <stdio.h>
#include <cstring>
#include <cstdio>
#include <math.h>
#include <algorithm>
#include <vector>
#include <string>
#include <stdlib.h>
#include <queue>
#include <stack>
#include <utility>
#include <fstream>
//#include <random>
#include <map>
//#include <unordered_map>
#include <cstdlib>
#include <functional>
#include <time.h>
//#include <chrono>
#include <sstream>
#include <iomanip>
#include <numeric>
#include <iostream>
#include <limits>
#include <numeric>
//#include <type_traits>
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define ll long long
#define INF 1000000001
#define MOD 1000000007
#define SORT(s) sort(s.begin(), s.end());
#define REVERSE(s) reverse(s.begin(), s.end());
#define SUM(s) accumulate(s.begin(), s.end(), 0LL);
#define P pair<int,int>
#define mp make_pair
#define valid(x,y,h,w) (0<=x&&x<h&&0<=y&&y<w)
//#define int ll
int dx[4] = { 0,1,0,-1 };
int dy[4] = { 1,0,-1,0 };
int ndx[8] = { 0,1,0,-1, 1,1,-1,-1 };
int ndy[8] = { 1,0,-1,0, 1,-1,-1,1 };
double pi = 3.141592653589793;
using namespace std;
int POW(int x, int y) { return int(pow(double(x), double(y))); }
double log(double a, double b) { return log(b) / log(a); }

//void solve1();
int score1();
int change(int, int, int);

int ti;
int D;
int sumC;
int k = 26;
vector<int> c(k), t;
vector<vector<int>> s;

int main() {
	srand((unsigned)time(NULL));
	cin >> D;
	s.resize(D);

	rep(i, k) {
		cin >> c[i];
		sumC += c[i];
	}
	rep(i, D) {
		s[i].resize(k);
		rep(j, k) {
			cin >> s[i][j];
		}
	}
	t.resize(D);
	rep(i, D) {
		cin >> t[i];
		t[i]--;
	}

	int score = score1();

	int m;
	cin >> m;

	rep(i, m) {
		int d;
		int q;
		cin >> d >> q;
		d--;
		q--;
		score = change(score, d, q);
		cout << score << endl;
	}

}

void solve1() {

	ti = clock();

	while (1) {
		double time = (double)(clock() - ti) / CLOCKS_PER_SEC;
		if (time > 9.9) {
			break;
		}


	}
}

int score1() {
	//最後にコンテストが行われた日
	vector<int> last(k, -1);
	int ans = 0;

	rep(i, D) {
		ans += s[i][t[i]];
		last[t[i]] = i;
		rep(j, k) {
			ans -= c[j] * (i - last[j]);
		}
		//cout << ans << endl;
	}
	return ans;
}

int change(int score, int d, int q) {
	score += s[d][q] - s[d][t[d]];
	int x = d + 1;
	while (x != D && t[x] != q) {
		x++;
	}
	int y = d - 1;
	while (y >= 0 && t[y] != q) {
		y--;
	}
	score += c[q] * (d - y) * (x - d);

	x = d + 1;
	while (x != D && t[x] != t[d]) {
		x++;
	}
	y = d - 1;
	while (y >= 0 && t[y] != t[d]) {
		y--;
	}
	score -= c[t[d]] * (d - y) * (x - d);
	t[d] = q;

	return score;
}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
void pt(int a, int b){
	for (int i = 0; i < b; i++) {
		cout<<a;
	}
	cout<<'\n';
	return;
}
int main(int argc, char const *argv[]) {
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	int a,b;
	cin>>a>>b;
	if (a<b) {
		pt(a,b);
	}else{
		pt(b,a);
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
using graph = vector<vector<ll>>;

int main() {
	ll n;
	string s, t;
	cin >> n;
	cin >> s >> t;
	for (ll i = 0; i < n; i++) {
		cout << s[i] << t[i];
	}
	cout << endl;
	return 0;
}

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

using namespace std;
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define PRINT(item) cout << (item) << endl;
#define PRINT_VEC(V) \
    for (auto v : (V)) cout << v << ' ';
#define PRINT_ENTER() cout << endl;

int main() {
    /* code */
    int N, M;
    cin >> N >> M;
    vector<int> s(M), c(M);
    REP(i, M) { cin >> s[i] >> c[i]; }
    vector<int> ans(N, -1);
    REP(i, M) {
        if (ans[s[i] - 1] == -1) {
            // 未初期化
            ans[s[i] - 1] = c[i];
        } else if (ans[s[i] - 1] != c[i]) {
            // 初期化済だが桁上書きしようとしている
            cout << "-1";
            return 0;
        }
    }

    if (N == 1) {
        // 一桁は例外扱い
        if (ans[0] == -1) {
            cout << 0;
        } else {
            cout << ans[0];
        }
        return 0;
    } else if (ans[0] == -1) {
        cout << 1;
    } else if (ans[0] == 0) {
        cout << -1;
        return 0;
    } else {
        cout << ans[0];
    }
    for (int i = 1; i < N; ++i) {
        if (ans[i] == -1) {
            cout << 0;
        } else {
            cout << ans[i];
        }
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
int main(){
	int X,Y;
	int d[16][16],p[16][16];
	int sum;
	
	while(cin>>X>>Y,X){
		sum=0;
		for(int i=1;i<=Y;i++){
			for(int j=1;j<=X;j++){
				cin>>d[j][i];
				if(i==1 && d[j][i]==0)p[j][i]=1;
				else p[j][i]=0;
			}
		}
		
		for(int i=1;i<=Y-1;i++){
			for(int j=1;j<=X;j++){
				if(d[j][i]==0){
					if(j>1)if(d[j-1][i+1]==0)p[j-1][i+1]+=p[j][i];
					if(j<X)if(d[j+1][i+1]==0)p[j+1][i+1]+=p[j][i];
					if(d[j][i+1]!=1)p[j][i+1]+=p[j][i];
				}
				else if(d[j][i]==2){
					if(i==Y-1 || i==Y){
						sum+=p[j][i];
					}
					else if(d[j][i+2]!=1)p[j][i+2]+=p[j][i];
				}
				
			}
			
		}
		
		
		for(int i=1;i<=X;i++)sum+=p[i][Y];
		cout<<sum<<endl;
		
	}
	
	return 0;
}


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

using namespace std;

int main() {
    int n;
    cin >> n;
    string p(n, 'a'), q(n, 'a');
    for (int i = 0; i < n; i++) {
        cin >> p[i];
    }
    for (int i = 0; i < n; i++) {
        cin >> q[i];
    }
    set<string> s;
    s.insert("");
    for (int i = 1; i <= n; i++) {
        set<string> new_s;
        for (auto e: s) {
            int size = e.size();
            for (int k = 0; k < size; k++) {
                string ns = e.substr(0, k) + to_string(i) + e.substr(k, size - k);
                new_s.insert(ns);
            }
            new_s.insert(e + to_string(i));
        }
        s = new_s;
    }
    int idx = 0;
    int a = 0, b = 0;
    for (auto ss: s) {
        if (ss == p) {
            a = idx;
        }
        if (ss == q) {
            b = idx;
        }
        idx++;
    }
    cout << abs(a - b) << "\n";
    return 0;
}


Measured memory_bytes: 5888
#include <iostream>
#include <fstream>

using namespace std;

#define MAX 2000

int n, q;
int A[MAX];
int m[MAX];

bool Solve(int index, int value)
{
	if (index == n) return false;
	if (A[index] == value) return true;

	return Solve(index + 1, value - A[index]) || Solve(index + 1, value);
}

int main()
{
	cin >> n;
	for (int i = 0; i < n; ++i) cin >> A[i];
	cin >> q;
	for (int i = 0; i < q; ++i) cin >> m[i];

	for (int i = 0; i < q; ++i)
	{
		if (Solve(0, m[i])) cout << "yes" << endl;
		else cout << "no" << endl;
	}
}


Measured memory_bytes: 3088
#include <iostream>
using namespace std;
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int p, q, r;
    cin >> p >> q >> r;
    /*
    p:a->b
    q:b->c
    r:c->a
    */
    cout << min(p + q, min(p + r, q + r)) << endl;
    //system("pause");
    return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define double long double

int32_t main()
{
    cout << fixed << setprecision(15);
    int n;
    cin >> n;
    vector<pair<double, pair<double,double>>> a;
    for (int i = 0; i < n; ++i)
    {
        int x, y;
        cin>>x>>y;
        a.push_back({arg( complex<double>({x, y}) ), {x, y}});
    }
    sort(a.begin(), a.end());
    for(int i=0; i<n; ++i) a.push_back(a[i]);

    double ans = 0;
    for (int i = 0; i < n; ++i)
    {
        double x=0, y=0;
        for (int j = i; j < n+i; ++j)
        {
            x+=a[j].second.first;
            y+=a[j].second.second;
            ans = max<double>(ans, sqrt(x*x + y*y));
        }
    }
    cout<<ans<<endl;
}


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

using namespace std;

#define int long long

#define PB	push_back
#define ALL(x)	(x).begin(), (x).end()
#define ALLR(x)	(x).rbegin(), (x).rend()
#define MP	make_pair

#define debug(args...) { string _s = #args; replace(ALL(_s), ',', ' '); stringstream ss(_s); cerr << endl;_debug(ss, args); }
#define _rg auto it = next(v.begin()); it != v.end(); it++
#define _input ostream& operator <<(ostream& out

template<typename T, typename U>
_input, const pair<T, U>& p) {
	out << "(" << p.first << ", " << p.second << ")";
	return out;
}

#define cont(c) template<typename T> _input, const c<T>& v) { \
					if (v.empty()) return out; \
					out << "[" << *v.begin(); \
					for (_rg) out << ", " << *it; \
					out << "]"; return out; \
				}
				
#define cont2(c) template<typename T, typename U> _input, const c<T, U>& v) { \
					if (v.empty()) return out; \
					out << "[" << *v.begin(); \
					for (_rg) out << ", " << *it; \
					out << "]"; return out; \
				}

cont(vector) cont(set) cont(multiset) cont(queue) cont2(map)

template<typename T, size_t n, typename= enable_if_t<!is_same<T, char>::value>>
_input, const T(&v)[n]) {
	if (n == 0) return out;
	out << "[" << v[0];
	for (int i = 1; i < (int)n; i++) out << ", " << v[i];
	out  << "]"; return out;
}

template<typename T, typename... Ts>
void _debug(stringstream& ss, const T &arg) {
	string name; ss >> name;
	cerr << name << " = " << arg << endl;
}

template<typename T, typename... Ts>
void _debug(stringstream& ss, const T& arg, const Ts&... args) {
	string name; ss >> name; 
	cerr << name << " = " << arg << ", ";
	if (is_class<T>::value || is_array<T>::value) cerr << endl;
	_debug(ss, args...);
}

#define FAST_IO ios::sync_with_stdio(false); cin.tie(0)

typedef pair<int, int> ii;
typedef pair<pair<int, int>, int> iii;
typedef vector<int> vi;
typedef vector<iii> viii;
typedef vector<vi> vvi;
typedef vector<ii> vii;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef unsigned long long ull;

const int INF = LONG_LONG_MAX/2;
const int NINF = LONG_LONG_MIN/2;
const double PI = 3.141592653589793238;

int32_t main() {
	FAST_IO;
	
	int x, n;
	cin >> x >> n;
	
	set<int> p;
	for (int i = 0; i < n; i++) {
		int y;
		cin >> y;
		p.insert(y);
	}
	
	int ans = INF;
	int diff = INF;
	//~ debug(p);
	for (int i = 0; i <= 509; i++) {
		if (p.count(i) == 0) {
			//~ debug(i);
			if (abs(x-i) < diff) {
				ans = i;
				diff = abs(x-i);
			}
			//~ debug(diff);
		}
	}
	
	cout << ans << endl;
}
// g++ -Wall -Wextra -Wshadow -fsanitize=undefined -std=c++17


Measured memory_bytes: 3620
from collections import Counter

def cntmin(c1, c2):
    c = Counter()
    for k in c1:
        c[k] = min(c1[k], c2[k])
    return c

n = int(raw_input())
S = [raw_input() for _ in range(n)]

ans = None
for s in S:
    c = Counter(s)
    if ans != None:
        ans = cntmin(ans, c)
    else:
        ans = c

print "".join(sorted(ans.elements()))


Measured memory_bytes: 2808
#include <bits/stdc++.h>
#define ll long long
#define intm INT_MAX
#define llm LLONG_MAX

using namespace std;
int MOD = 998244353;

int fronty[200030];
int backy[200030];

int main(){
	ios_base::sync_with_stdio(false); cin.tie(0);
	int N,k,c;
	string s;
	cin >> N >> k >> c >> s;
	vector<int> v1;
	for(int i=0; i < s.length(); i++){
        if( s[i] == 'o' ) v1.push_back(i+1);
	}
	vector<int> vf; vector<int> vb;
	vf.push_back(v1[0]); vb.push_back(v1[v1.size()-1]);
	int idxfront = 0;
	for(int i=1; i <=v1.size()-1; i++){
        if( v1[i]-v1[idxfront] >= c+1 ){
            vf.push_back(v1[i]);
            idxfront = i;
        }
	}
	int idxback = v1.size()-1;
	for(int i=v1.size()-2; i >= 0; --i){
        if( v1[idxback]-v1[i] >= c+1 ){
            vb.push_back(v1[i]);
            idxback = i;
        }
	}
	reverse( vb.begin(), vb.end() );
	/*
	for(auto c: vf) cout << c << " ";
	cout << endl;
	for( auto c: vb) cout << c << " ";
	cout << endl;
	*/
	for(int i=1; i <= k; i++) fronty[i] = vf[i-1];
	int xx = vb.size()-1;
	for(int i=k; i >= 0; --i){
        backy[i] = vb[xx];
        --xx;
	}


    for(int i=1; i <= k; i++){
        if( backy[i] == fronty[i] ) cout << fronty[i] << endl;
    }
    //
    //for(int i=1; i <= k; i++) cout << fronty[i] << " " << backy[i] << endl;





}


Measured memory_bytes: 5772
#include<iostream>
#include<sstream>
#include<vector>
#include<iterator>
#include<cmath>
using namespace std;

int main(void)
{
	int Q;
	cin >> Q;

	long long A, B;
	for(int i=0; i<Q; i++){
		cin >> A >> B;

		if(A > B)
			swap(A, B);

		if(A == B)
			cout << 2 * (A-1) << endl;
		else{
			long long c = sqrt(A*B);
			if(c*c == A*B)
				cout << 2*c - 3 << endl;
			else if(c*(c+1) >= A*B)
				cout << 2 * (c-1) << endl;
			else
				cout << 2*c - 1 << endl;
		}
	}

	return 0;
}


Measured memory_bytes: 256
from collections import defaultdict
import string

alf = string.ascii_lowercase

d = defaultdict(int)
S = ''.join(sorted(input()))
for v in alf:
    d[v] = 0

for i, v in enumerate(S):
    d[v] += 1
# print(sorted(d.items()))

sd = sorted(d.items())

count = 0
for v in sd:
    if(v[1] == 0):
        print(v[0])
        exit()
    else:
        count += 1
        continue

if (count == 26):
    print('None')


Measured memory_bytes: 4924
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>

#define MP make_pair
#define PB push_back
#define in int
#define ll long long
#define ull unsigned long long
#define vc vector
#define SQ(j) (j)*(j)
#define x first
#define y second
//
//#define ld long double
#define dbl  long double
#define pll pair<long long,long long>
#define pii pair<int,int>
#define pdd pair<dbl,dbl>
#define sz(xxx) ((int)(xxx.size()))
#define all(j) j.begin(), j.end()
#define loop(xxx, yyy) for(int xxx = 0; xxx < yyy; xxx++)
//#define printf(fmt, ...) (0)
//#define HOME
//#define y0 ngacaleiebinvoaeu
//#define y1 gnarpipipaigare
#define j1 adsfndnasfafoasp

//#define printf(...) (0)
#define db(x) if(DEBUG) {cout << #x << " = " << x << endl;}
#define dbCont(x) if(DEBUG) {cout << #x << ": "; for(auto shun: x) cout << shun << ' '; cout<<endl;}

using namespace std;

template<class K, class V>
ostream &operator<<(ostream &out, pair<K, V> &elem) {
    out << "{" << elem.first << "," << elem.second << "}";
    return out;
}

// 4:13

int DEBUG = 0;

using namespace std;

const int N = 100 * 1000 + 5;
const ll MOD = 1000 * 1000 * 1000 + 7;



int get(int n, int h){
    if(n%h == 0) return n/h;

    return n/h + 1;
}
int main() {


    int h,w;
    cin >> h >> w;

    int n;
    cin >> n;
    cout << min(get(n,h), get(n,w)) <<endl;

    return 0;
}

/*



 */

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define pii pair<int,int> 
#define mp make_pair
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fi first
#define se second
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
int main(){
    int a,b;
    cin>>a>>b;
    cout<<(a+b-1)/b<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef vector<int> VI;
 
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()

int main() {
    int n, m;
    cin >> n >> m;
    priority_queue<int> pq;
    rep(i, n) {
        int tmp;
        cin >> tmp;
        pq.push(tmp);
    }
    rep (i, m) {
        int top = pq.top();
        top /= 2;
        pq.pop();
        pq.push(top);
    }
    ll sum = 0;
    rep (i, n) {
        int top = pq.top();
        pq.pop();
        sum += top;
    }
    cout << sum << endl;
}


Measured memory_bytes: 892
#include <bits/stdc++.h>
// statics
using namespace std;
using int64 = int_fast64_t;
using PAIR = pair<int, int>;
constexpr int INF = 1 << 30;
constexpr int64 LINF = 1LL << 60;
constexpr int MOD = 1e9 + 7;
constexpr int MAX_N = 1e5 + 1;

// init/input
#define int int64
#define INIT ios::sync_with_stdio(false);cin.tie(0);
#define VAR(type, ...) type __VA_ARGS__;MACRO_VAR_Scan(__VA_ARGS__);
template<typename T> void MACRO_VAR_Scan(T &t) {cin>>t;}
template<typename First, typename...Rest> void MACRO_VAR_Scan(First &first, Rest&...rest) {cin>>first;MACRO_VAR_Scan(rest...);}
#define VEC(type, c, n) vector<type> c(n);for(auto &&i:c)cin>>i;

// out
#define OUT(dist) cout<<(dist);
#define FOUT(n, dist) cout<<fixed<<setprecision(n)<<(dist);
#define SP cout<<" ";
#define BR cout<<"\n";
#define debug(x) cerr<<#x<<":"<< (x);BR;

// utility
#define ALL(a) (a).begin(), (a).end()
#define EACH(i, a) for(auto &&i:(a))
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define RFOR(i, a, b) for(int i=(b)-1;i>=0;--i)
#define REP(i, n) for(int i=0;i<(n);++i)
#define RREP(i, n) for(int i=(n)-1;i>=0;--i)

signed main() {
  INIT;
	VAR(string, s);
	int ans = 0;
	bool ok = false;
	REP(i, (s.size() + 1) / 2) {
		ok = false;
		REP(j, i) {
			if (s[j] != s[i + j]) break;
			if (j == i - 1) ok = true;
		}
		if (ok) ans = i * 2;
	}
	OUT(ans)BR;
	
  
  return 0;
}


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

typedef long long int ll;

int main()
{
    ll h, w;
    cin >> h >> w;
    vector<string> a(h);
    for(ll i = 0;i < h;i++){
        cin >> a[i];
    }

    vector<vector<bool>> ba1(h, vector<bool>(w, false)), ba2(h, vector<bool>(w, false));

    for(ll i = 0;i < h;i++){
        bool f = false;
        for(ll j = w - 1;j >= 0;j--){
            ba1[i][j] = f;
            if(a[i][j] == '#'){
                f = true;
            }
        }
    }

    for(ll i = 0;i < w;i++){
        bool f = false;
        for(ll j = h - 1;j >= 0;j--){
            ba2[j][i] = f;
            if(a[j][i] == '#'){
                f = true;
            }
        }
    }

    bool ans = true;
    for(ll i = 0;i < h;i++){
        for(ll j = 0;j < w;j++){
            if(a[i][j] == '#' && !(i == h - 1 && j == w - 1)){
                if(ba1[i][j] && ba2[i][j] || !ba1[i][j] && !ba2[i][j]){
                    ans = false;
                }
            }
        }
    }

    /*for(ll i = 0;i < h;i++){
        for(ll j = 0;j < w;j++){
            cout << ba1[i][j];
        }
        cout << endl;
    }
    
    for(ll i = 0;i < h;i++){
        for(ll j = 0;j < w;j++){
            cout << ba2[i][j];
        }
        cout << endl;
    }*/

    if(ans){
        cout << "Possible";
    }
    else{
        cout << "Impossible";
    }

    return 0;
    
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define exrep(i, a, b) for(long long i = a; i <= b; i++)
#define rep(i,n)for(long long i=0;i<(long long)(n);i++)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> P;
typedef vector<ll> vl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vector<ll> > vvl;
typedef vector<vector<P> > vvp;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
 
const ll MOD=1e9+7;
const ll INF=1e18;
const int MAX=510000;
const double pi=acos(-1);
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false); 
  string s,t;
  cin >> s>> t;
  
  bool ok=false;
  rep(i,26){
    string u=s+char('a'+i);
    if(u==t)ok=true;
  }
  if(ok)cout << "Yes" << endl;
  else cout << "No" << endl;
  
  return 0;     
}


Measured memory_bytes: 3656
#include <bits/stdc++.h>
using namespace std;
int main(void){
    
    //*
    int a;
    cin >> a ;
    //*/

    /*
    vector<int> vec(3);
    cin >> vec.at(0) >> vec.at(1) >> vec.at(2) ;
    
    sort(vec.begin(), vec.end());
    */
    
    /*
    if( a % b == 0 ){
        cout << 0 << endl;
    } else {
        cout << 1 << endl;
    }
    */
    
    cout << ( a / 2 ) * ( a / 2 + a % 2 ) << endl;

    return 0; 
}


Measured memory_bytes: 3468
from math import factorial
N, M = map(int, input().split())
if N > 1:
  a = factorial(N) / (factorial(2) * factorial(N-2))
else:
  a = 0
if M > 1:
  b = factorial(M) / (factorial(2) * factorial(M-2))
else:
  b = 0
print(int(a+b))

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

using namespace std;

int main()
{
	// 入力
	string S;
	cin >> S;
	
	vector<string> sChar(S.length());
	
	for (int i = 0; i < S.length(); i++)
	{
		// 1文字ずつ格納
		sChar[i] = S.substr(i, 1);
	}
	
	bool isYes = false;
	
	if (sChar[0] == sChar[1] && sChar[1] != sChar[2] && sChar[2] == sChar[3])
	{
		isYes = true;
	}
	else if (sChar[0] == sChar[2] && sChar[2] != sChar[1] && sChar[1] == sChar[3])
	{
		isYes = true;
	}
	else if (sChar[0] == sChar[3] && sChar[3] != sChar[1] && sChar[1] == sChar[2])
	{
		isYes = true;
	}
	
	if (isYes == true)
	{
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#define yes "Yes\n"
#define no "No\n"
#define pi 3.1416
//int m,n;
//int i,j,k,l;
//int a,b,c,d,e,f,g;
//int sum,total;
//long long int ;
//float ;
//double ;
//char a[101],b[101],s[101],t[101],u[101];
int r;
int main(void){
    scanf("%d",&r);
    printf("%d\n",(int)(pow(r,2)));
    return 0;
    
}

Measured memory_bytes: 128
#include <stdio.h>
#include <stdlib.h>

int compare(const void *x, const void *y)
{
	if (*(long*)x < *(long*)y) return 1;
	if (*(long*)x > *(long*)y) return -1;
	return 0;
}

void calc(long A, long *ans, int tmp)
{
	if (tmp == 0) *ans = A;
	else *ans *= A;
}

int main(void)
{
	int N, tmp = 0, i;
	long A[100000], ans;
	scanf("%d", &N);
	for (i = 0; i < N; ++i) scanf("%ld", &A[i]);
	qsort(A, N, sizeof(long), compare);
	for (i = 0; i < N - 1 && tmp != 2; ++i) {
		if (A[i] == A[i + 1]) {
			calc(A[i], &ans, tmp);
			if (tmp == 0) tmp = 1;
			else tmp = 2;
			++i;
		}
	}
	if (tmp == 2) printf("%ld", ans);
	else puts("0");
	return 0;
}

Measured memory_bytes: 1788
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Console;
using static System.Math;

namespace AtTest.Panasonic2020
{
    class D
    {
        static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(OpenStandardOutput()) { AutoFlush = false };
            SetOut(sw);

            Method(args);

            Out.Flush();
        }

        static void Method(string[] args)
        {
            int n = ReadInt();
            int[] tmp = new int[n];
            int[] maxs = new int[n];
            for(int i = 0; i < n; i++)
            {
                Write('a');
            }
            WriteLine();
            while (true)
            {
                int index = -1;
                for (int i = n - 1; i > 0; i--)
                {
                    if (tmp[i] - maxs[i - 1] <= 0)
                    {
                        index = i;
                        break;
                    }
                }
                if (index == -1)
                {
                    break;
                }

                tmp[index]++;
                for(int i = 1; i < n; i++)
                {
                    maxs[i] = Max(maxs[i - 1], tmp[i]);
                }

                for(int i = index + 1; i < n; i++)
                {
                    tmp[i] = 0;
                }
                
                for(int i = 0; i < n; i++)
                {
                    Write((char)('a' + tmp[i]));
                }
                WriteLine();
            }
        }

        private static string Read() { return ReadLine(); }
        private static char[] ReadChars() { return Array.ConvertAll(Read().Split(), a => a[0]); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
    }
}


Measured memory_bytes: 12372
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(); 
    if(a>=b){
      if(b>=c){
        System.out.printf("%d %d %d\n",c,b,a);
      }
      else if(b<c){
        if(a>=c){
          System.out.printf("%d %d %d\n",b,c,a);
        }
        else if(a<c){
          System.out.printf("%d %d %d\n",b,a,c);
        }
      }
    }
    else if(a<b){
      if(b<c){
        System.out.printf("%d %d %d\n",a,b,c);
      }
      else if(b>=c){
        if(a>=c){
          System.out.printf("%d %d %d\n",c,a,b);
        }
        else if(a<c){
          System.out.printf("%d %d %d\n",a,c,b);
        }
      }
    }
  }
}

Measured memory_bytes: 26204
n = int( input() )
a = list( map( int, input().split() ) )
 
for x in a:
    if x % 2 == 0:
        if x % 3 == 0:
            continue
        if x % 5 == 0:
            continue
        print( "DENIED" )
        break
else:
    print( "APPROVED" )

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

using namespace std;

int main(){
  int a,b,c;
  cin >> a >> b >> c;
  if(a==7&&b==5&&c==5){
    cout << "YES" << endl;
  }
  else if(a==5&&b==7&&c==5){
      cout << "YES" << endl;
    }
    else if(a==5&&b==5&&c==7){
        cout << "YES" << endl;
      }
      else{
        cout << "NO" << endl;
      }
}


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

int main(){
  string s,t;
  cin >> s >> t;
  if(s.size() > t.size()){
    for(int i = 0; i < t.size(); i++){
      cout << s[i] << t[i];
    }
    cout << s[s.size() - 1] << endl;
    return 0;
  }else{
    for(int i = 0; i < t.size(); i++){
      cout << s[i] << t[i];
    }
    cout << endl;
    return 0;
  }
}


Measured memory_bytes: 3640
import statistics
import numpy as np
import math
#-------------
N = int(input())
A = list(map(int, input().split()))
#-------------
 
B = [A[i]-i-1 for i in range(N)]
 
point = statistics.median(B)
point = math.floor(point)
 
ans_list = []
ans = 0
for b in range(point-2 , point+2):
  for i in range(N):
    X = B[i]-b
    ans += np.abs(X)
  ans_list.append(ans)
  ans = 0

min_ans_list = min(ans_list)
print(min_ans_list)

Measured memory_bytes: 49472
N=int(input())
A=[int(input()) for i in range(N)]
A.sort()
i=0
ans=0
while i<N:
  p=A[i]
  count=0
  for j in range(i,N):
    if A[j]==A[i]:
      count+=1
    else:
      break
  if count%2==1: ans+=1
  i+=count
print(ans)

Measured memory_bytes: 7388
#include "bits/stdc++.h"
#define F first
#define S second
using namespace std;
#define ll long long
#define ld long double
#define pb push_back
#define eb emplace_back
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  ll n = 0;
  cin >> n;
  ll ar[n];
  ll ans = INT_MAX;
  for (ll i = 0; i < n; ++i)
    cin >> ar[i];
  sort(ar, ar + n);
  for (ll i = ar[0]; i <= ar[n - 1]; ++i) {
    ll cost = 0;
    for (ll j = 0; j < n; ++j) {
      //if (i != j)
      cost += ((ar[j] - i) * (ar[j] - i));
    }
    ans = min(ans, cost);
  }
  cout << ans;
}


Measured memory_bytes: 3620
mod=10**9+7
N,K=map(int,input().split())

term1=N-K+1
term2=1
for i in range(1,K+1):
  #print((term1,term2))
  print((term1*term2)%mod)
  
  #term1 = ((term1*(N-K+1-i))//(i+1))%mod
  #term2 = ((term2*(K-i))//i)%mod
  term1 = (term1*(N-K+1-i))//(i+1)
  term2 = (term2*(K-i))//i
  


Measured memory_bytes: 3444
#include<stdio.h>
int main() {
	int N;
	scanf("%d", &N);
	int *A = (int *)malloc(sizeof(int)*N);
	for (int i = 0; i < N; i++)
	{
		scanf("%d", &A[i]);
	}

	int ans = 0;
	for (int i = 0; i < N; i++)
	{
		ans++;
		while (A[i] == A[i + 1]) { i++; }
		if (A[i] - A[i + 1] <= 0) 
		{
			while (A[i] - A[i + 1] <= 0) { i++; }
		}
		else
		{
			while (A[i] - A[i + 1] >= 0)
			{
				while (A[i] - A[i + 1] >= 0) { i++; }
			}
		}
	}
	printf("%d\n", ans);

	return 0;
}

Measured memory_bytes: 512
#include <iostream>

using namespace std;
int main(){
    int n;
    cin >> n;

    int max_r = -1;
    int min_r = 1000000001;
    int max_d = -1000000001;

    int r_init;
    cin >> r_init;
    min_r = r_init;

    for (int i=0; i<n-1; i++){
        int r, d;
        cin >> r; 
        if(r <= min_r){
            max_r = r;
            d = r - min_r;
            if (d > max_d) {
                max_d = d;
            }
            min_r = r;
        } else if (r > max_r) {
            max_r = r;
            d = max_r - min_r;
            if (d > max_d) {
                max_d = d;
            }
        }
    }
    cout << max_d << endl;
}


Measured memory_bytes: 3080