akhauriyash/Code-Regression huggingface dataset:
package main

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

// I/O
type Scanner struct {
	sc *bufio.Scanner
}

func NewScanner() *Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), int(1e+9))
	return &Scanner{sc}
}

func (s *Scanner) nextStr() string {
	s.sc.Scan()
	return s.sc.Text()
}

func (s *Scanner) nextInt() int {
	i, e := strconv.Atoi(s.nextStr())
	if e != nil {
		panic(e)
	}
	return i
}

func (s *Scanner) nextFloat() float64 {
	f, e := strconv.ParseFloat(s.nextStr(), 64)
	if e != nil {
		panic(e)
	}
	return f
}

func (s *Scanner) nextRuneSlice() []rune {
	return []rune(s.nextStr())
}

func (s *Scanner) nextIntSlice(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextInt()
	}
	return res
}

func (s *Scanner) nextFloatSlice(n int) []float64 {
	res := make([]float64, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextFloat()
	}
	return res
}

// Arithmetic
func max(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m < i {
			m = i
		}
	}
	return m
}

func min(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m > i {
			m = i
		}
	}
	return m
}

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

func pow(x, y int) int {
	res := 1
	for i := 0; i < y; i++ {
		res *= x
	}
	return res
}

func ceil(a, b int) int {
	if a%b == 0 {
		return a / b
	} else {
		return a/b + 1
	}
}

// Sort
type RuneSlice []rune

func (a RuneSlice) Len() int           { return len(a) }
func (a RuneSlice) Less(i, j int) bool { return a[i] < a[j] }
func (a RuneSlice) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }

// Main
func gcd(a, b int) int {
	if b == 0 {
		return a
	}
	return gcd(b, a%b)
}

func lcm(a, b int) int {
	return a / gcd(a, b) * b
}

func main() {
	sc := NewScanner()
	wtr := bufio.NewWriter(os.Stdout)
	N, M := sc.nextInt(), sc.nextInt()
	A := sc.nextIntSlice(N)
	for i, a := range A {
		A[i] = a / 2
	}
	num := A[0]
	for i := 1; i < N; i++ {
		num = lcm(num, A[i])
	}
	for i := 0; i < N; i++ {
		if (num/A[i])%2 == 0 {
			fmt.Fprintln(wtr, 0)
			wtr.Flush()
			return
		}
	}
	sum := M / num

	//fmt.Fprintln(wtr, num)
	//fmt.Fprintln(wtr, sum)
	if sum%2 == 0 {
		fmt.Fprintln(wtr, sum/2)
	} else {
		fmt.Fprintln(wtr, sum/2+1)
	}

	wtr.Flush()
}


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

int main(){
  map<int,int> m;
  int n;cin >> n;
  int a[n];rep(i,n)cin >> a[i];
  rep(i,n){
    if(m[a[i]] == 100){cout << "NO" << endl;return 0;}
    else m[a[i]] = 100;
  }
  cout << "YES" << endl;
  return 0;
}

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

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

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

    ll ans = n - 1;
    for (ll a = 2; a < n; a++) {
        // cout << a << " " << n / a << endl;
        ans += n / a;
        if (n % a == 0) ans--;
    }

    cout << ans << endl;

    return 0;
}

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

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

using namespace std;

int main(){
	int a,b; cin>>a>>b;
	if(a>=13) cout<<b; else if(a>=6) cout<<b/2; else cout<<0;

	return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <algorithm>
#include <string>

struct {
	int parent;
	int left;
	int right;
} typedef node;


using namespace std;
const int NIL = -1;

node tree[100000];
int D[100000];
int H[100000];

// Calculate depth of nodes
void depth(int u, int p)
{
	D[u] = p;
	if (tree[u].right != NIL)
		depth(tree[u].right, p + 1);
	if (tree[u].left != NIL)
		depth(tree[u].left, p + 1);
}

// Calculate height of nodes
int height(int u)
{
	int h1, h2;
	h1 = h2 = 0;
	if (tree[u].left != NIL)
		h1 = height(tree[u].left) + 1;
	if (tree[u].right != NIL)
		h2 = height(tree[u].right) + 1;
	return H[u] = max(h1, h2);
}

// MAIN FUNCTION
int main(int argc, char** argv)
{
	// Input
	int n;
	cin >> n;
	for (int i = 0; i < n; i++) {
		tree[i].left = tree[i].parent = tree[i].right = NIL;
	}
	int degree;
	int v;
	int s;
	int pre;
	int l, r;
	for (int i = 0; i < n; i++) {
		cin >> v >> l >> r;
		tree[v].left = l;
		tree[v].right = r;
		tree[l].parent = v;
		tree[r].parent = v;
	}
	
	// Find root
	int root = 0;;
	while (tree[root].parent != NIL) {
		root = tree[root].parent;
	}
	// Calculate depth
	depth(root, 0);
	// Calculate height
	height(root);

	// Output
	for (int i = 0; i < n; i++) {
		cout << "node " << i << ":" << " parent = " << tree[i].parent << ", ";
		// Out put sibling
		cout << "sibling = ";
		if (tree[i].parent == NIL)
			cout << -1;
		else if (tree[tree[i].parent].left != i)
			cout << tree[tree[i].parent].left;
		else
			cout << tree[tree[i].parent].right;
		// Output degree
		cout << ", degree = ";
		if (tree[i].left != NIL && tree[i].right != NIL)
			cout << 2;
		else if (tree[i].left == NIL && tree[i].right == NIL)
			cout << 0;
		else
			cout << 1;
		// Output depth
		cout << ", depth = " << D[i];
		// Output height
		cout << ", height = " << H[i];
		// Output type of node
		cout << ", ";
		if (tree[i].parent == NIL)
			cout << "root";
		else if (tree[i].left == NIL && tree[i].right == NIL)
			cout << "leaf";
		else
			cout << "internal node";
		cout << endl;
	}

	return 0;
}

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

string s;
set<int> ans;

bool f(int x){
	return x != 0;
}

void solve(vector<int> cnt,int n, int i)
{
	if(count_if(cnt.begin(),cnt.end(),f) == 0){
		ans.insert(n);
		return;
	}
	int t = cnt[i];
	
	if(t >= 3){
		cnt[i] -= 3;
		if(cnt[i] == 0){
			solve(cnt,n,i + 1);
		} else if(min(cnt[i + 1],cnt[i + 2]) >= 1){
			cnt[i]--;
			cnt[i + 1]--;
			cnt[i + 2]--;
			solve(cnt,n,i + 1);
			cnt[i]++;
			cnt[i + 1]++;
			cnt[i + 2]++;
		}
		cnt[i] += 3;
		}
		
	if(min(cnt[i + 1],cnt[i + 2]) >= cnt[i]){
		cnt[i] -= t;
		cnt[i + 1] -= t;
		cnt[i + 2] -= t;
		solve(cnt,n,i + 1);
		cnt[i] += t;
		cnt[i + 1] += t;
		cnt[i + 2] += t;
	}
}

int main()
{
	while(getline(cin,s)){
		ans.clear();
		if(s == "0")break;
		vector<int> cnt(12);
		for(int i = 0; i < (int)s.size(); ++i){
			cnt[s[i] - '0']++;
		}
		for(int i = 1; i < 10; ++i){
			if(cnt[i] == 4)continue;
			cnt[i]++;
			for(int j = 1; j < 10; ++j){
				if(cnt[j] >= 2){
					cnt[j] -= 2;
					solve(cnt,i,1);
					cnt[j] += 2;
				}
			}
			cnt[i]--;
		}
		
		if(ans.size() == 0){
			cout << 0 << endl;
		} else {
			for(set<int>::iterator it = ans.begin(); it != ans.end(); ++it){
				if(it != ans.begin())cout << ' ';
				cout << *it;
			}
			cout << endl;
		}
	}
}

Measured memory_bytes: 1196
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
class b{
    public static void Main(){
        string str = Console.ReadLine();
        int sum = 0;
        string ans = "No";
        foreach(char c in str){
            sum += (c - '0');
        }
        if(sum%9 == 0){
            ans = "Yes";
        }
        Console.WriteLine(ans);
    }
}


Measured memory_bytes: 17328
#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#include<bits/stdc++.h>
using namespace std;
	int n;
	
	int main(){
		IOS
		cin>>n;
		int ans=n/2;
		if(n%2)
			ans++;
		cout<<ans<<endl;
	} 

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll fun(ll n, ll m)
{
    if((m/2)<n)return m/2;
    ll ans=n;
    m=m-n*2;
    ans=ans+m/4;
    return ans;
}  
int main()
{
    ll n,m;
    scanf("%lld%lld",&n,&m);
    ll ans=fun(n,m);
    printf("%lld\n",ans);
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
//INSERT ABOVE HERE
signed main(){
  const Int MAX = 1e6+10;
  vector<Int> p(MAX,0);
  for(Int i=2;i<MAX;i++){
    if(p[i]) continue;
    for(Int j=i+i;j<MAX;j+=i) p[j]=1;
  }
  Int n;
  cin>>n;
  vector<Int> q(n);
  for(Int i=0;i<n;i++) cin>>q[i];

  vector<Int> dp(n+1,0);
  const Int MOD = 1e9+7;
  dp[0]=!p[q[0]];
  for(Int i=0;i<n;i++){
    if(i+1==n) (dp[i+1]+=dp[i])%=MOD;
    if(i+2==n) (dp[i+2]+=dp[i])%=MOD;

    if(i+1<n&&!p[q[i+1]]&&q[i]<q[i+1]) (dp[i+1]+=dp[i])%=MOD;
    if(i+2<n&&!p[q[i+2]]&&q[i]<q[i+2]) (dp[i+2]+=dp[i])%=MOD;
  }

  cout<<dp[n]<<endl;
  return 0;
}



Measured memory_bytes: 12320
#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define F first
#define S second
#define MAXN   1000005
#define Tsetso ios_base::sync_with_stdio(0) ; cin.tie(0) ;
using namespace std;
int main()
{
    string x , y ;
    cin >> x >> y;
    string z = y ;
    reverse(y.begin(),y.end());
    if ( y != x)
            return cout << "NO" , 0;
    reverse(x.begin(),x.end());
    if ( x != z)
            return cout << "NO" , 0;
    cout << "YES" ;
}


Measured memory_bytes: 3624
#include"bits/stdc++.h"
using namespace std;

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep3(i,m,n) for(int (i)=m;(i)<=(n);(i)++)
#define rep3rev(i,m,n) for(int (i)=m;(i)>=(n);(i)--)
#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define eb emplace_back

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

void Main(){
	int n;
	cin >> n;
	rep(i,30){
		rep(j,20){
			if(4*i+7*j == n){
				puts("Yes");
				return;
			}
		}
	}
	puts("No");
	return;
}

int main(){
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
	return 0;
}

Measured memory_bytes: 256
class UF:
    def __init__(self, N):
        self.uf = [-1]*N
        self.n = N

    def find(self, x):
        if self.uf[x]<0: return x
        self.uf[x] = self.find(self.uf[x])
        return self.uf[x]

    def size(self, x):
        return -self.uf[self.find(x)]

    def union(self, x, y):
        x, y = self.find(x), self.find(y)
        if x==y: return
        if self.size(x) > self.size(y): x, y = y, x
        self.uf[y] += self.uf[x]
        self.uf[x] = y
        self.n -= 1

N, M = map(int, input().split())
uf = UF(N)
for _ in range(M):
    A, B = map(int, input().split())
    uf.union(A-1, B-1)
    
print(uf.n-1)


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

using namespace std;
typedef long long int ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) for (int i = 0; i < (n); i++)
#define fst first
#define snd second
#define ALL(obj) (obj).begin(), (obj).end()
#define debug(x) cout << #x << ": " << x << endl
#define out(x) cout << x << endl
//#define int long long int
const int MOD = 1000000007;
const ll LINF = (ll)1e20;
const int INF = 1e9;
const double EPS = 0.000000001;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  vector<pair<ll, ll> > v;
  REP(i, n){
    ll a;
    ll b;
    cin >> a >> b;
    v.emplace_back(a, b);
  }
  sort(ALL(v), [&](pair<ll, ll> x, pair<ll, ll> y){return x.snd < y.snd;});
  ll time = 0;
  bool flag = false;
  REP(i, n){
    if(time + v[i].fst > v[i].snd){
      flag = true;
      break;
    }
    else{
      time += v[i].fst;
    }
  }
  puts(!flag ? "Yes" : "No");
  return 0;
}


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

int main(){
    int n;
    cin>>n;
    int dp[n+1];
    fill(dp,dp+n+1,1e9);
    for(int i=0;i<n;i++){
        int a;
        cin>>a;
        *lower_bound(dp,dp+n+1,a)=a;
    }
    cout<<lower_bound(dp,dp+n+1,1e9)-dp<<endl;
}

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

int main()
{
  int N;
  cin >> N;
  bool can = false;
  for (int i = 1; i <= 9; i++)
  {
    for (int j = 1; j <= 9; j++)
    {
      if (N == i * j)
        can = true;
    }
  }
  if (can)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<math.h>
using namespace std;
int main(){
int n;
cin >> n;
vector<int> numbers(n);
int count = 0;
for(int i = 0; i < n; i++){
    cin >> numbers[i];
}
for(int i = 0; i < n; i++){
    bool pon = true;
    if((numbers[i] % 2 == 0 && numbers[i] != 2) || numbers[i] < 2){
        pon = false;
    }
    if(numbers[i] == 2){
        pon = true;
    }
    if(numbers[i] > 2 && numbers[i] % 2 != 0){
        double a = sqrt(numbers[i]);
        for(int j = 3; j < a + 1; j += 2){
            if(numbers[i] % j == 0)
            pon = false;
        }
    }
    if(pon) count++;
}
cout << count << endl;
}


Measured memory_bytes: 3120
#include<bits/stdc++.h>
#include<cctype>
using namespace std;
#define rep(i,n) for (int i=0;i<(n);i++)
#define all(v) (v).begin(),(v).end()
typedef long long int ll;
#define pi 3.1415926535897932384
#define E9 1000000000
#define eps 1e-4
#define pii pair<int,int>

int main(){
  int N, M; cin >> N >> M;
  int X = 1900*M + 100*(N-M);
  int p = (1<<M);
  cout << p*X << endl;


  
  // cout << fixed << setprecision(10);
  
  return 0;
}


Measured memory_bytes: 3596
#include<cstdio>
#include<cmath>
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
    int N;
    while(cin>>N){
        if(!N)break;
        for(int i=0;i<N;i++){
            int su,ei,koku;
            cin>>su>>ei>>koku;
            if(su==100||ei==100||koku==100||180<=su+ei||240<=su+ei+koku)puts("A");
            else if(210<=su+ei+koku||(150<=su+ei+koku&&(80<=su||80<=ei)))puts("B");
            else puts("C");
        }
    }
    return 0;
}

Measured memory_bytes: 1116
S = input()[::-1]

modCount = [1]+[0]*2018
mod = 0
dig = 1
result = 0

for i in range(len(S)):
  mod = (int(S[i:i+1])*dig+mod)%2019
  dig = (dig*10)%2019
  result += modCount[mod]
  modCount[mod] += 1

print(result)

Measured memory_bytes: 9200
#[allow(unused_imports)]
use itertools::Itertools;
use proconio::input;
#[allow(unused_imports)]
use proconio::marker::*;

fn main() {
    input! {
        n: i64,
        x: i64,
        t: i64,
    }
    println!("{}", (n + x - 1) / x * t);
}


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

void input(int& rnTrgSu, int& rnTrgKin)
{
  cin >> rnTrgSu >> rnTrgKin;
}

void searchCntl(int nTrgSu, int nTrgKin)
{
  for (int n10000 = 0; n10000 <= nTrgSu; ++n10000)
    for (int n5000 = 0; n5000 <= (nTrgSu - n10000); ++n5000)
    {
      int n1000 = nTrgSu - n10000 - n5000;
      if (nTrgKin == 10000 * n10000 + 5000 * n5000 + 1000 * n1000)
      {
        cout << n10000 << " " << n5000 << " " << n1000 << endl;
        return;
      }
    }
  cout << -1 << " " << -1 << " " << -1 << endl;
}

int main()
{
  int nTrgSu, nTrgKin;
  
  input(nTrgSu, nTrgKin);
  searchCntl(nTrgSu, nTrgKin);

  return 0;
}

Measured memory_bytes: 3632
#include <cstdio>

int main(void) {
    int N, Y;
    (void)std::scanf("%d %d", &N, &Y);

    int D = Y / 1000 - N;
    for(int a = 0; a <= N; ++a) {
        if(10000 * a > Y)   break;

        int tmp = D - 9*a;
        if(tmp % 4 == 0) {
            int b = tmp / 4;
            int c = N - a - b;
            
            if(b < 0)   continue;
            if(c < 0)   continue;
            
            std::printf("%d %d %d\n", a, b, c);
            return 0;
        }
    }

    std::printf("-1 -1 -1\n");
}


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

int main() {
	int n;
	cin >> n;
	bool flag = false;
	int ans = 0;
	rep(i, n+1) {
		int res = i*1.08;
		if (res == n) {
			flag = true;
			ans = i;
		}
	}
	if (flag == true)cout << ans << endl;
	else cout << ":(" << endl;
}

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

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

int main(void){
    int n, k, h, ans = 0;

    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n >> k;
    REP(i, n) {
        cin >> h;
        if (k <= h) {
            ans++;
        }
    }

    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
#define inf (int)(1e9+7)
#define abs(x) (x >= 0 ? x : -(x))
#define ceil(a, b) a / b + !!(a % b)
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }




double eudis(pii a, pii b) {
    return sqrt((a.F - b.F) * (a.F - b.F) + (a.S - b.S) * (a.S - b.S));
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    
    int n;
    cin >> n;
    vector<pii> v(n);
    rep(i, n) cin >> v[i].F >> v[i].S;
    double sum = 0;
    rep(i, n) rep3(j, i + 1, n) sum += eudis(v[i], v[j]);
    cout << fixed << setprecision(7) << sum * 2 / n << endl;
}



Measured memory_bytes: 256
#include <bits/stdc++.h> //C++の標準ライブラリを一行で一括でインクルードする
#include <math.h> //数学関数と数学定数を利用する
#define rep(i,n) for (int i = 0; i < (n); i++)
#define PI 3.141592653589793
using namespace std;
typedef long long ll;
template<class T> void chmax(T &a,T b) { if (a<b) a=b;}
template<class T> void chmin(T &a,T b) { if (a>b) a=b;}
int gcd(int a, int b){//ユークリッドの互除法
  if (a < b) gcd(b,a); //aの方がbよりでかいのが前提
  if (b == 0) return a; //aをbで割り切れたらreturn
  else gcd(b, a % b);
}

const int MOD = 1000000007;


int main(){
  int n; cin >> n;
  vector<double> x(n),y(n);
  vector<int> perm(n);
  
  rep(i,n){
    cin >> x[i] >> y[i];
    perm[i] = i;
  }
    
  double ans;
  double all = 0.0;
  int cnt = 0;
  do{
    rep(i,n-1){
      int from = perm[i], to=perm[i+1];
      all += sqrt((x[from]-x[to])*(x[from]-x[to])+(y[from]-y[to])*(y[from]-y[to]));
    }
    cnt++;
  }while(next_permutation(perm.begin(), perm.end()));// 次の順列を生成   
  
  ans = all / cnt;
  
  printf("%.10f\n",ans);
  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int numA = sc.nextInt();
        int numB = sc.nextInt();
        int numM = sc.nextInt();
        int min;
        int minA = 0;
        int minB = 0;
        int a[] = new int[numA];
        int b[] = new int[numB];
        int m [][] = new int[numM][3];
        for (int i = 0; i < numA; i++){
            a[i] = sc.nextInt();
            if (i == 0){
                minA = a[i];
            }
            if (minA > a[i]){
                minA = a[i];
            }
        }
        for (int i = 0; i < numB; i++){
            b[i] = sc.nextInt();
            if (i == 0){
                minB = b[i];
            }
            if (minB > b[i]){
                minB = b[i];
            }
        }
        min = minA + minB;
        for (int i = 0; i < numM; i++){
         for (int j = 0; j < 3; j++){
             m[i][j] = sc.nextInt();
         }
            if (min > a[m[i][0] - 1] + b[m[i][1] - 1] - m[i][2]){
                min = a[m[i][0] - 1] + b[m[i][1] - 1] - m[i][2];
            }
        }
        System.out.println(min);
    }
}


Measured memory_bytes: 161468
#include "bits/stdc++.h"
using namespace std;

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

	vector<int> vec(n);
	for (auto& e : vec) {
		cin >> e;
	}
	sort(vec.rbegin(), vec.rend());

	long long int x = 0;
	long long int y = 0;
	for (int i = 1; i < n; i++) {
		if (x != 0 && y != 0) break;
		int cnt = 1;
		while (vec.at(i) == vec.at(i - 1)) {
			if (x != 0 && y != 0) break;
			cnt++;

			if (x != 0) {
				y = vec.at(i);
			}else{
				x = vec.at(i);
			}

			if (cnt >= 4) {
				y = vec.at(i);
			}
			i += 2;
			if (i >= n) break;
		}
	}
	cout << x * y << endl;
}

Measured memory_bytes: 640
def e_sequence_sum():
    N, X, M = [int(i) for i in input().split()]

    appear = set([X])
    seq = [X]
    while True:
        seq.append(seq[-1]**2 % M)
        if seq[-1] in appear:
            break
        appear.add(seq[-1])
    loop_length = len(seq) - seq.index(seq[-1]) - 1
    seq.pop()
    first, loop = seq[:-loop_length], seq[-loop_length:]
    loop_count, reminder = divmod(N - len(first), loop_length)
    ans = sum(first) + sum(loop) * loop_count
    for i in range(reminder):
        ans += loop[i % reminder]
    return ans

print(e_sequence_sum())

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

const long long MOD = 1000000007LL;
long long GCD(long long a, long long b){return b == 0 ? a : GCD(b, a % b);}
long long fast_exp(long long base, long long exp, long long mod = MOD) {
    long long tot = 1;
    for(;exp > 0;exp >>= 1) {
       if((exp & 1) == 1) tot = tot * base % mod;
       base = base * base % mod;
    }
    return tot;
}
long long slow_mult(long long base, long long exp, long long mod = MOD) {
    long long tot = 0;
    for(;exp > 0;exp >>= 1){
       if((exp & 1) == 1) tot = (tot + base) % mod;
       base = base * 2 % mod;
    }
    return tot;
}

int freq[27];

int main(){

    cin.sync_with_stdio(0); cin.tie(0); cout.tie(0);

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

    string s; cin >> s;
    
    for(auto i : s)
        freq[i - 'A']++;
    
    for(int i = 0; i < 26; ++i){
        if(freq[i] > 0 && freq[i] != 2){
            cout << "No\n";
            return 0;
        }
    }
    cout << "Yes";
    return 0;

    if(s[0] == s[1] && s[2] == s[3]){
        cout << "Yes";
        return 0;
    }
    if(s[0] == s[2] && s[1] == s[3]){
        cout << "Yes";
        return 0;
    }
    if(s[0] == s[3] && s[1] == s[2]){
        cout << "Yes";
        return 0;
    }
    cout << "No";

    return 0;
}


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

using namespace std;

int main() {
	int N;
	cin >> N;
	vector<int> a(N);
	for (int i = 0; i < N; ++i) { cin >> a[i]; }

	multiset<int> st;
	st.insert(-a[0]);
	for (int i = 1; i < N; ++i) {
		auto it = st.upper_bound(-a[i]);
		if (it != st.end()) {
			st.erase(it);
		}
		st.insert(-a[i]);
	}
	cout << st.size() << endl;

	return 0;
}
/*
#include <iostream>
#include <climits>
#include <set>
#include <string>
#include <algorithm>
#include <vector>
#define MAX 1000000007


using namespace std;
#define ll long long
#define dbg if(0)
#define ISRANGE(val,lo,hi) ((lo<=val)&&(val<hi))



int main(){
    ll ans,n;
    cin>>n;
    ll a;
    vector<ll> nlist;
    for(int i=0;i<n;i++){
        cin>>a;
        bool notfound=true;
        vector<ll>::iterator itr=nlist.begin();
        for(;itr!=nlist.end();itr++){
            if(a>*itr){
                *itr=a;
                notfound=false;
                break;
            }
        }
        if(notfound){
            nlist.push_back(a);
        }
    }

    cout <<nlist.size()<<endl;

    return 0;

}
*/

Measured memory_bytes: 5376
N = int(input())
h = [int(i) for i in input().split()]
c = [0]*N

c[0]=0
c[1]=abs(h[1]-h[0])
for i in range(2,N):
    c[i] = min(abs(h[i]-h[i-1])+c[i-1],abs(h[i]-h[i-2])+c[i-2])

print(c[N-1])

Measured memory_bytes: 52208
#include<iostream>
#include<cstdio>
using namespace std;
const int maxn=15;
int n,m,a[maxn][maxn];
bool flag=false;
char c;

void dfs(int x,int y){
	if(x==n && y==m){
		for(int i=1;i<=n;i++) for(int j=1;j<=m;j++) if(a[i][j]) return;
		flag=true; return;
	}
	if(flag) return;
	if(a[x+1][y]){
		a[x+1][y]=0;
		dfs(x+1,y);
		a[x+1][y]=1;
	}
	else if(a[x][y+1]){
		a[x][y+1]=0;
		dfs(x,y+1);
		a[x][y+1]=1;
	}
	else return;
}

int main(){
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++){
		for(int j=1;j<=m;j++){
			cin>>c;
			if(c=='#') a[i][j]=1;
		}
	}
	a[1][1]=0,dfs(1,1);
	if(flag) puts("Possible");
	else puts("Impossible");
	return 0;
}

Measured memory_bytes: 256
lst = []
for h in range(1, 151):
    for w in range(h + 1, 151):
        lst.append((h ** 2 + w ** 2, h, w))
lst.sort()
while True:
    h, w = map(int, input().split())
    if h == 0:break
    ind = lst.index((h ** 2 + w ** 2, h, w))
    print(*lst[ind + 1][1:])


Measured memory_bytes: 6748
#![allow(unused_imports)]
#![allow(non_snake_case)]
use std::cmp::*;
use std::collections::*;
use std::io::Write;

#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), std::io::stderr());
            writeln!(err, "{} = {:?}", e, $e).unwrap()
        })*
    };
}

fn main() {
    let n = read::<usize>();
    let x = read_vec::<i64>();

    let mut ans = std::i64::MAX;
    for i in 1..101 {
        let mut temp = 0;
        for &xnum in x.iter() {
            temp += (xnum - i) * (xnum - i);
        }
        ans = min(ans, temp);
    }
    println!("{}", ans);
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}


Measured memory_bytes: 4476
#include<iostream>
#include<vector>
#include<algorithm>

int main()
{
	std::vector<int> v(5);

	for(int i=0;i<5;++i)
	{
		std::cin >> v[i];
	}

	std::sort(v.begin(),v.end());

	for(int i=4;i>0;--i)
	{
		std::cout << v[i] << ' ';
	}

	std::cout << v[0] << '\n';
}

Measured memory_bytes: 1208
#include <iostream>
#include <string>
#include <cstdio>

using namespace std;

int main() {
    string s;
    while (cin >> s) {
        for (int i = 0; i < s.size(); i++) {
            if (s[i] == '@') {
                for (int j = 0; j < s[i+1] - '0'; j++) {
                    putchar(s[i+2]);
                }
                i+=2;
            } else {
                putchar(s[i]);
            }
        }
        putchar('\n');
    }
    return 0;
}

Measured memory_bytes: 0
# -*- coding: utf-8 -*-
s = list(str(input()))

numberA = []
numberZ = []
for i in range(len(s)):
    if s[i] == 'A':
        numberA.append(i)
    if s[i] == 'Z':
        numberZ.append(i)
print(max(numberZ) - min(numberA) + 1)


Measured memory_bytes: 12604
#include <stdio.h>

int main()
{
    int a, b, res;
    char o;
    while(1) {
        scanf("%d %c %d", &a, &o, &b);
        if     (o=='+') res=a+b;
        else if(o=='-') res=a-b;
        else if(o=='*') res=a*b;
        else if(o=='/') res=a/b;
        else break;
        printf("%d\n", res);
    }
    return 0;
}

Measured memory_bytes: 600
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp>
#define int long long
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL);

using namespace std;
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " = " << a << endl;
  err(++it, args...);
}
inline int max(int a , int  b){
  if(a > b) return a;
  else return b;

}
int min(int a , int b){
  if(a < b) return a;
  else return b;
}

long long binpow(long long a, long long b, long long m) {
    a %= m;
    long long res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a % m;
        a = a * a % m;
        b >>= 1;
    }
    return res;
}
int gcd(int a , int b){
  if (b == 0) 
        return a; 
    return gcd(b, a % b);
}
int32_t main() 
{ 
  fast;
  int x,n;
  map < int , int > sd;
  cin >> x >> n;
  for(int i = 0 ; i < n ; i++) {
    int tmp;
    cin >> tmp;
    sd[tmp]++;
  }
  int ans = LLONG_MAX;
  int res;
  for(int i = -100 ; i < 200 ; i++){
    if(sd[i] == 0 && abs(x-i) < ans ){
        ans = abs(x-i);
        res= i;
    } 
  }
  cout << res << "\n";
}

// 2*a + 4*b = Y
// a+b = X
// a = x-b
// 2x - 2b + 4b = y
// 2x +2b = y
//(y/2)-x;

Measured memory_bytes: 3676
#標準入力と変数の初期化
num = int(input())
coin = 0

#25セントを使える枚数を調べ合計金額から減らす
coin += num // 25
num -= num // 25 * 25

#10セントを使える枚数を調べ合計金額を減らす
coin += num // 10
num -= num // 10 * 10

#5セントを使える枚数を調べ合計金額を減らす
coin += num // 5
num -= num // 5 * 5

#1セントの枚数を足し出力する
print(coin + num)


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

typedef long long ll;

int N, X;
ll con[6010][6010];
ll mod = 998244353;
ll ans;

int main()
{
    cin >> N >> X;

    for(int i = 0; i < 6010; i++)for(int j = 0; j <= i; j++)
    {
        if(i == j)con[i][j] = 1;
        else if(j == 0)con[i][j] = 1;
        else con[i][j] = (con[i - 1][j] + con[i - 1][j - 1]) % mod;
    }

    for(int i = 0; i <= N; i++)
    {
        ll tmp = 0;
        for(int j = 0; j <= i; j++)
        {
            if(2 * j < X - 1)continue;
            int t = (X - 1) - j;
            if(j - t != 0 && t < i - j)continue;
            tmp += con[max(0, j - (i - j))][max(0, t - (i - j))] * con[N][i];
            tmp %= mod;
        }
        ans += tmp;
        ans %= mod;
    }

    for(int i = 0; i <= N; i++)
    {
        ll tmp = 0;
        for(int j = 0; j <= i; j++)
        {
            if(i - j + j * 2 < X - 1)
            {
                tmp += con[N][i] * con[i][j] % mod;
                tmp %= mod;
            }
        }
        ans += tmp;
        ans %= mod;
    }

    cout << ans << endl;
}


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

using namespace std;

int main(){
  long long int X;
  cin >>X;
  int A=0,B=0;
  for(;X>=500;X-=500)
    A++;
  for(;X>=5;X-=5)
    B++;

  cout<<(long long int)1000*A+5*B<<endl;

  return 0;
}


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

const int MOD = 1e9 + 7;
vector<int> adj[100100];
long long ans = 1;
int K;

void solve(int u, int parent = -1) {
    int res = K - (parent != -1);
    for (auto to : adj[u]) {
        if (to == parent) continue;
        res--;
        ans *= res;
        ans %= MOD;
        solve(to, u);
    }
}

int main() {
    int N;
    cin >> N >> K;
    for (int i = 0; i < N - 1; i++) {
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        adj[a].push_back(b);
        adj[b].push_back(a);
    }
    ans *= K;
    solve(0);
    cout << ans << endl;
}


Measured memory_bytes: 10368
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
using System.Linq;
using System.Linq.Expressions;
using static System.Console;
using static System.Math;

class AC
{

    void Solve()
    {
        var abc = new int[]
        {
            111, 222, 333, 444, 555, 666, 777, 888, 999, 1111, -1
        };

        var N = io.Int;

        for (var i = 0; i < abc.Length - 1; ++i)
        {
            if (N == abc[i])
            {
                WriteLine(abc[i]);
                break;
            }
            else
            {
                if (N < abc[i])
                {
                    WriteLine(abc[i]);
                    break;
                }
            }
        }

    }

    IoTiny io = new IoTiny();

    public static void Main(string[] args) => new AC().Stream();

    private void Stream()
    {
        //var exStdIn = new System.IO.StreamReader("stdin.txt");
        //SetIn(exStdIn);
        Solve();
        io.Flush();
    }

}

class IoTiny
{

    string[] _nextBuffer;
    int _bufferCnt;
    char[] cs = new char[] {' ', '"', ','};
    StreamWriter sw = new StreamWriter(OpenStandardOutput())
    {
#if DEBUG
        AutoFlush = true
#else
        AutoFlush = false
#endif
    };

    public IoTiny()
    {
        _nextBuffer = new string[0];
        _bufferCnt = 0;
        SetOut(sw);
    }

    string Next()
    {
        if (_bufferCnt < _nextBuffer.Length) return _nextBuffer[_bufferCnt++];
        var st = ReadLine();
        while (st == "") st = ReadLine();
        _nextBuffer = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        _bufferCnt = 0;
        return _nextBuffer[_bufferCnt++];
    }

    public string String => Next();
    public char Char => char.Parse(String);
    public int Int => int.Parse(String);
    public long Long => long.Parse(String);
    public double Double => double.Parse(String);

    public void Flush() => Out.Flush();

}


Measured memory_bytes: 11092
N = int(input())
H = list(map(int, input().split()))
is_init = True
is_end = False
ans = 0
while not is_end:
    is_init = True
    for i in range(N):
        h = H[i]
        if h <= 0:
            if i == N - 1 and is_init:
                is_end = True
            H[i] -= 1
        else:
            is_init = False
            if i - 1 >= 0:
                pre = H[i - 1]
                if pre <= -1:
                    ans += 1
            else:
                if h != 0:
                    ans += 1
            H[i] -= 1
print(ans)

Measured memory_bytes: 9108
import java.util.Scanner;

class Main {
  public static void main(String args[]) {
      Scanner scanner = new Scanner(System.in);
      int a = scanner.nextInt();
      int b = scanner.nextInt();
      int c = scanner.nextInt();
      if (a <= b && b<=c) {
    	  System.out.println(a+" "+b+" "+c);
      } else if(a<=c&&c<=b){
    	  System.out.println(a+" "+c+" "+b);
      } else if(b<=a&&a<=c){
    	  System.out.println(b+" "+a+" "+c);
      }else if(b<=c&&c<=a){
    	  System.out.println(b+" "+c+" "+a);
      }else if(c<=a&&a<=b){
    	  System.out.println(c+" "+a+" "+b);
      }else if(c<=b&&b<=a){
    	  System.out.println(c+" "+b+" "+a);
      }
      scanner.close();
  }
}


Measured memory_bytes: 26432
#include<bits/stdc++.h>
using namespace std;
#define stop exit(0)
int main(){
    vector <long long> v;
    long long a,b,c=0,d=0,e=0,f=0,g=0,i,j,k=1,l=0,r=1,n,m[4097],z[4097][13],h[13][13],p[13];
    string s,t,x,y;
    double q,u,w;
    cin>>a>>b>>c;
    for(i=1;i<=a;i++){
        cin>>p[i];
        for(j=1;j<=b;j++){
            cin>>h[i][j];
        }
    }
    d=a;
    while(d--){
        k*=2;
    }
    for(i=1;i<k;i++){
        for(j=1;j<=b;j++){
            z[i][j]=0;
        }
        d=i;
        e=a;
        r=0;
        m[i]=0;
        while(d>0){
            if(d%2==1){
                for(j=1;j<=b;j++){
                    z[i][j]+=h[e][j];
                }
                m[i]+=p[e];
            }
            e--;
            d/=2;
        }
        for(j=1;j<=b;j++){
            if(z[i][j]<c){
                r=1;
                break;
            }
        }
        if(r==0){
            v.push_back(m[i]);
            l=1;
        }
    }
    sort(v.begin(),v.end());
    if(l==1){
        cout<<v[0];
    }
    else{
        cout<<-1;
    }
}

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

int main() {
  int N, K;
  cin >> N >> K;
  vector<long long> H(N);
  for(int i = 0; i < N; i++) {
    cin >> H.at(i);
  }
  long long cnt = 0;
  sort(H.begin(), H.end());
  for(int i = 0; i < N-K; i++) {
    cnt += H.at(i);
  }
  cout << cnt << endl;
}


Measured memory_bytes: 1920
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define inf 1e15
ll vec[1000009];
int main()
{
    ll a,b,c,d,e,i,j,k,l,n,m,x,y,t,p;
    scanf("%lld",&n);
    x=0;
    for(i=1;i<=n;i++)
    {
        scanf("%lld",&a);
        vec[a]++;
        x=__gcd(x,a);
    }
    if(x!=1)
    {
        printf("not coprime\n");
        return 0;
    }

    c=0;
    for(i=2;i<=1000000;i++)
    {
        x=0;
        for(j=i;j<=1000000;j+=i)
        {
            x+=vec[j];
        }
        if(x>1)
        {
            c=1;
            break;
        }
    }
    if(c)
    {
        printf("setwise coprime\n");
    }
    else
    {
        printf("pairwise coprime\n");
    }
}


Measured memory_bytes: 11480
#include<bits/stdc++.h>
using namespace std ;
#define f(i,s,n) for(int i=s;i<n;i++)
int main()
{
    int x;cin>>x ;
    if(x<100) cout<<0<<"\n" ;
    else 
    {
        vector<bool> dp(x+1,false) ;
        dp[100]=dp[101]=dp[102]=dp[103]=dp[104]=dp[105]=true ;
        f(i,100,x+1)
        {
            if(dp[i] && i+100<=x) dp[i+100] = true ;
            if(dp[i] && i+101<=x) dp[i+101] = true ;
            if(dp[i] && i+102<=x) dp[i+102] = true ;
            if(dp[i] && i+103<=x) dp[i+103] = true ;
            if(dp[i] && i+104<=x) dp[i+104] = true ;
            if(dp[i] && i+105<=x) dp[i+105] = true ;
        }
        cout<<(dp[x]?1:0)<<"\n" ;
    }

}

Measured memory_bytes: 256
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		final int N = Integer.parseInt(sc.next());
		final int D = Integer.parseInt(sc.next());

		BigDecimal ans = BigDecimal.valueOf(N / (D * 2 + 1.0));
		ans =  ans.setScale(0, RoundingMode.CEILING);
		System.out.println(ans);


	}

}


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

#define ll long long //data types used often, but you don't want to type them time by time
#define ull unsigned long long
#define ui unsigned int
#define mod 1000000007
#define inf 100000000000010
#define us unsigned short
#define IOS ios_base::sync_with_stdio(0); //to synchronize the input of cin and scanf
#define INF LONG_MAX
#define PI 3.1415926535897932384626
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define rep(x,j,n)for(int x=j;x<n;x++)
#define all(x) (x).begin(), (x).end()

typedef vector<pair<ll,ll>> vpi;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef pair<ll,ll> pi;

bool isprime(ll n)
{
    if(n<=1)return false;
    if(n<=3)return true;
    if(n%2==0||n%3==0)return false;
    for(ll i=5;i*i<=n;i+=6)
    {
        if(n%i==0||n%(i+2)==0)return false;
    }
    return true;
}

ll modexp(ll a,ll b,ll m)
{
    ll r=1;
    a=a%m;
    while(b>0)
    {
        if(b&1)r=(r*a)%m;
        b = b>>1;
        a=(a*a)%m;
    }
    return r%m;
}

struct CustomCompare
{
    bool operator()(const int& lhs, const int& rhs)
    {
        return lhs < rhs;
    }
};

bool comp(pair<ll, ll>a,pair<ll,ll>b)
{
    return a.fi>=b.fi;
}

ll builtin_popcount(ll x)
{
    ll cnt = 0;
    for(ll i=60;i>=0;i--)
    {
        if((1LL<<i)&x)cnt++;
    }
    return cnt;
}

ll addmod(ll a,ll b)
{
    a%=mod;
    b%=mod;
    return (a+b)%mod;
}
ll mulmod(ll a,ll b)
{
    a%=mod;
    b%=mod;
    return (a*b)%mod;
}
/*
const int mxn = 5*(1e6) +10;
vi spf(mxn);
void sieve()
{
    for(ll i =0;i<mxn;i++)spf[i]  = i;
    for(ll i=2;i<mxn;i+=2)spf[i] = 2;
    for(ll i = 3;i*i<mxn;i++)
    {
        if(spf[i]==i)
        {
            for(ll j = i*i;j<mxn;j+=i)
            {
                if(spf[j]==j)spf[j] = i;
            }
        }
    }
}
*/

int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);cout.tie(0);
ll n; cin>>n;
ll x = (n%1000);
x = 1000 - x;
x%=1000;
cout<<x<<endl;
return 0;

}
/*
1
8
1 7 3 4 7 6 2 9
*/


Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
#define arep(i, x, n) for (int i = int(x); i < (int)(n); i++)
#define rep(i, n) for (long long i = 0; i < n; ++i)
#define pi 3.141592653589793
#define eps 0.00000001
#define INF 1e9 + 7
using ll = long long;

int main() {
    string a;
    string b;
    cin >> a >> b;
    string c = a + b;

    std::string::size_type sz;
    int cNum = stoi(c, &sz);

    bool isLoop = true;
    bool isFind = false;
    
    int num = 1;
    while(isLoop){

        int sum = num * num;

        if(sum > cNum){
            isLoop = false;
        }else if(sum == cNum){
            isLoop = false;
            isFind = true;
        }else{
            num++;
        }
    }

    if(isFind){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, n) for (int i = n; i > 0; i--)
#define rep3(i, s, e) for (int i = (s); i < (int)(e); i++)
#define rep4(i, s, e) for (int i = (e); i < (int)(s); i--)

int main() {
    int a, b;
    char s;
    cin >> a >> s >> b;
    if (s == '-') {
        cout << a - b << endl;
    } else {
        cout << a + b << endl;
    }
}


Measured memory_bytes: 256
class Combination:
    def __init__(self, n, mod):
        self.n = n
        self.mod = mod
        self.fac = [1 for i in range(self.n + 1)]
        self.finv = [1 for i in range(self.n + 1)]
        for i in range(2, self.n+1):
            self.fac[i] = (self.fac[i - 1] * i) % self.mod
            self.finv[i] = (self.finv[i-1] * pow(i, -1, self.mod)) % self.mod

    def comb(self, n, m):
        return self.fac[n] * (self.finv[n-m] * self.finv[m] % self.mod) % self.mod
def iparse():
    return list(map(int, input().split()))

if __name__ == "__main__":
    n = int(input())
    a = iparse()
    ans = 10000000000
    for i in range(-100, 101):
        tmp = 0
        for e in a:
            tmp += (e - i)** 2
        ans = min(tmp, ans)
    print(ans)
    


Measured memory_bytes: 9136
#include<bits/stdc++.h>
using namespace std;
 
int main(){
int N,T,A;
cin >> N;
cin >> T >> A;
int H[N];
int num;
int x;

for(int i=0; i<N;i++) cin >> H[i];
int  d = 0;
int ans = 10000000;
for(int i=0; i<N; i++){
    d = T*1000 - H[i]*6 - A*1000;
    if(d < 0) d = -d;
    if(d < ans){ans = d; x = H[i]; num = i+1;} 
}

cout << num;
 return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <math.h>
#include <algorithm>

using namespace std;

int main()
{
  int A, B, K;
  cin >> A >> B >> K;

  int min = A < B ? A : B;
  int count = 0;
  for (int i = min; i > 0; --i)
  {
    if (B%i == 0 && A%i == 0) ++count;
    if (count == K)
    {
      cout << i << endl;
      return 0;
    }
  }
}

Measured memory_bytes: 256
#include <stdio.h>

int
main(void)
{
    int a, b;
    scanf("%d %d", &a, &b);

    if (a < b)
        printf("a < b\n");
    else if (a > b)
        printf("a > b\n");
    else
        printf("a == b\n");

    return 0;
}


Measured memory_bytes: 2044
(defun solve (xs &optional (cnt 0))
  (cond
    ((= cnt 3) t)
    ((null xs) nil)
    ((= (first (first xs)) (rest (first xs))) (solve (rest xs) (1+ cnt)))
    (t (solve (rest xs) 0))))


(defun main ()
  (let* ((n (read))
         (xs (loop repeat n collect (cons (read) (read)))))
    (princ (if (solve xs)
               "Yes"
               "No"))
    (fresh-line)))

#-swank (main)


Measured memory_bytes: 23680
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;


public class Main{
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String str;
		int n=0;

		while(null != (str=br.readLine())){

			int count = 0;
			n = Integer.parseInt(str);

			if(n <= 36){
				for(int a=0; a<10;a++){
					for(int b=0; b<10; b++){
						for(int c=0; c<10; c++){
							for(int d=0; d<10; d++){
								if((a+b+c+d) == n){
									count++;
								}
							}
						}
					}
				}
			}else{
				count=0;
			}
			System.out.println(count);
		}
	}
}

Measured memory_bytes: 18756
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef tuple<int,int,int> tii;
#define rep(i,s,n) for(int i=(int)(s);i<(int)(n);i++)


int main(){
  ll X;
  cin >> X;
  for(ll i=0;i<=120;i++){
    ll a = i*i*i*i*i;
    for(ll j=-120;j<=120;j++){
      ll b = j*j*j*j*j;
      if(a-b==X){
        cout << i << " " << j << endl;
        return 0;
      }
    }
    
  }
}


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

int main() {
    int k;
    cin >> k;
    
    int s = 7, ans = 1;
    while (ans <= k) {
        if (s%k == 0) {
            cout << ans << endl;
            return 0;
        }
        s = (s%k)*10 + 7;
        ans++;
    }
    cout << -1 << endl;
}

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



int main(){
  
  string S;
  cin>>S;
  if(S=="AKIHABARA"||S=="AKIHABAR"||S=="AKIHABRA"
     ||S=="AKIHBARA"||S=="KIHABARA"||S=="AKIHABR"
     ||S=="AKIHBAR"||S=="KIHABAR"||S=="AKIHBRA"
     ||S=="KIHABRA"||S=="KIHBARA"||S=="AKIHBR"
     ||S=="KIHABR"||S=="KIHBAR"||S=="KIHBRA"||S=="KIHBR"){
    cout<<"YES"<<endl;
  }
  else cout<<"NO"<<endl;
    
      
  
}

Measured memory_bytes: 3584
import java.util.*;

public class Main {
    public static void main (String[] args) {
        Scanner scanner = new Scanner(System.in);
        
        while (scanner.hasNext()) {
           int d = scanner.nextInt();
           int sum = 0;
           
           for (int i = 0; i < 600; i+=d) {
               sum += d * (i*i);
           }
           System.out.println(sum);
        }
    }
}

Measured memory_bytes: 17172
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define rep(i,k,n) for (ll i = k; i < n; ++i)
#define inputar(a,n) ll a[n];rep(i,0,n)cin>>a[i]
#define PI 3.14159265
const int MOD=1e9+7;
const int N=1e5+10;


#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(a)  (a).begin(),(a).end()


#define test4(x,y,z,a) cout<<"x is "<<x<<"		y is "<<y<<"		z is "<<z<<"		a is "<<a<<endl;
#define test3(x,y,z) cout<<"x is "<<x<<"		y is "<<y<<"		z is "<<z<<endl;
#define test2(x,y) cout<<"x is "<<x<<"		y is "<<y<<endl;
#define test1(x) cout<<"x is "<<x<<endl;

bool isPrime(int n) 
{ 
    if (n <= 1) 
        return false; 
    for (int i = 2; i < n; i++) 
        if (n % i == 0) 
            return false; 
  
    return true; 
} 
int binomialCoeff(int n, int k)  
{
    if (k == 0 || k == n)  
        return 1;  

    return binomialCoeff(n - 1, k - 1) +  
                binomialCoeff(n - 1, k);  
}  
long long power(ll a, ll b)
{
    ll ans=1;
    while(b)
    {
        if(b&1)
            ans=(ans*a)%MOD;
        b/=2;
        a=(a*a)%MOD;
    }
    return ans;
}

int gcd(int a, int b) 
{ 
    if (b == 0) 
        return a; 
    return gcd(b, a % b);  
      
}






int main()
{
    IOS;
    int a;
    cin>>a;
    string s;
    cin>>s;
    if(a<3200) cout<<"red"<<endl;
    else cout<<s<<endl;


}

Measured memory_bytes: 256