akhauriyash/Code-Regression huggingface dataset:
#include"bits/stdc++.h"
#include<math.h>
using namespace std;

int main() {
	int N,R,m,n,o,p,q,r,s,t,u;
	cin >> N;
	m = N/pow(10,8);
	n = N / pow(10,7) - m * 10;
	o = N / pow(10,6) - m *pow(10,2) - n * 10;
	p = N / pow (10,5) - m * pow(10,4) - n * pow(10 , 2) - o * 10;
	q = N / pow(10 , 4) - m * pow (10 , 4) - n * pow (10 , 3) - o * pow (10 , 2) - p * 10;
	r = N / pow(10 , 3) - m * pow (10 , 5) - n * pow (10 , 4) - o * pow (10 , 3 )- p * pow (10 , 2 )- q * 10;
	s = N / pow (10 , 2) - m * pow  (10 , 6) - n * pow (10 , 5) - o * pow (10 , 4 )- p * pow (10 , 3 )- q * pow(10 , 2) - r * 10;
	t = N / 10       - m * pow (10 , 7) - n * pow (10 , 6) - o * pow (10 , 5 )- p * pow (10 ,4 )- q * pow(10 , 3) - r * pow(10 , 2)-  s  * 10;
	u = N            - m * pow (10 , 8) - n * pow (10 , 7) - o * pow (10 , 6 )- p * pow (10 , 5) - q * pow (10 , 4) - r * pow (10, 3) - s  * pow(10 , 2) - t * 10;
	R = m + n + o + p + q + r + s + t + u;
	if (N%R == 0) {
		cout << "Yes";
	}
	else {
		cout << "No";
	}
}



Measured memory_bytes: 256
n=int(input())
A=list(map(int,input().split()))
q=int(input())
coun=[0]*10**5
A_=sum(A)
for i in A:
  coun[i-1]+=1
for _ in range(q):
  b,c=map(int,input().split())
  A_+=(c-b)*coun[b-1]
  coun[c-1]+=coun[b-1]
  coun[b-1]=0
  print(A_)


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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<int, int> Pi;
typedef vector<ll> Vec;
typedef vector<int> Vi;
typedef vector<string> Vs;
typedef vector<vector<ll>> VV;
typedef vector<vector<int>> VVi;

#define REP(i, a, b) for(ll i=(a); i<(b); i++)
#define PER(i, a, b) for(ll i=(a); i>=(b); i--)
#define rep(i, n) REP(i, 0, n)
#define per(i, n) PER(i, n, 0)
const ll INF=1e18+18;
const ll MAX=100005;
const ll MOD=1000000007;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl;
#define YES(n) cout << ((n) ? "YES" : "NO") << endl;
#define ALL(v) v.begin(), v.end()
#define rALL(v) v.rbegin(), v.rend()
#define pb(x) push_back(x)
#define mp(a, b) make_pair(a,b)
#define Each(a,b) for(auto &a :b)
#define REPM(i, mp) for (auto i = mp.begin(); i != mp.end(); ++i)
#define dbg(x_) cerr << #x_ << ":" << x_ << endl;
#define dbgmap(mp) cerr << #mp << ":"<<endl; for (auto i = mp.begin(); i != mp.end(); ++i) { cerr << i->first <<":"<<i->second << endl;}
#define dbgarr(n,m,arr) rep(i,n){rep(j,m){cerr<<arr[i][j]<<" ";}cerr<<endl;}
#define dbgdp(n,arr) rep(i,n){cerr<<arr[i]<<" ";}cerr<<endl;
#define sum(v) accumulate(ALL(v),0)
#define fi first
#define se second

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }

template<typename T1, typename T2>
ostream &operator<<(ostream &s, const pair<T1, T2> &p) { return s<<"("<<p.first<<", "<<p.second<<")"; }

// vector
template<typename T>
ostream &operator<<(ostream &s, const vector<T> &v) {
    int len=v.size();
    for(int i=0; i<len; ++i) {
        s<<v[i];
        if(i<len-1) s<<"	";
    }
    return s;
}

// 2 dimentional vector
template<typename T>
ostream &operator<<(ostream &s, const vector<vector<T> > &vv) {
    int len=vv.size();
    for(int i=0; i<len; ++i) {
        s<<vv[i]<<endl;
    }
    return s;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<std::setprecision(10);

    ll n;
    cin>>n;
    string s;
    s = to_string(n);
    ll m=0;
    rep(i,s.length()){
        m += s[i]-'0';
    }
    Yes(n%m==0)
    return  0;
}


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

const int INF = 1e9;

int main(){
    int N, K; cin >> N >> K;
    vector<int> h(N);
    for (int i = 0; i < N; i++)
    {
        cin >> h[i];
    }
    vector<int> dp(N, INF);
    dp[0] = 0;
    for (int i = 1; i < N; i++)
    {
        for(int j = i - 1; j >= max(i - K, 0); j--){
            dp[i] = min(dp[i], dp[j] + abs(h[i] - h[j])); 
        }
    }
    cout << dp[N - 1] << endl;
    
}

Measured memory_bytes: 1024
#include<cstdio>
#include<cstring>
#include<iostream>
using namespace std;
typedef long long ll;
int main()
{
	ll a,b,i,j,t1=1,t2;
	cin>>a>>b;
	for(i=0;i<b;i++)
		t1*=2;
	t2=b*1900+(a-b)*100;
	cout<<t1*t2<<endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main { 
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		long ans = 0;
		int n = sc.nextInt();
		long[] a = new long[n];
		for(int i = 0; i < n; i++) {
			long tp = sc.nextLong();
			a[i] =  tp;
		}
		for(int i = 0; i < n; i++) {
			for(;;) {
				if(a[i] % 2 == 1 || a[i] / 2 < 1) {
					break;
				}
				ans += 1;
				a[i] = a[i]/2; 
			}
		}
		System.out.println(ans);
     }
}

Measured memory_bytes: 35704
#include <bits/stdc++.h>
using namespace std;
#define rep0(i,n) for(ll (i) = 0; (i) < (n); ++(i))
#define rrep0(i,n) for(ll (i) = (n) - 1; (i) >= 0; --(i))
#define rep1(i,n) for(ll (i) = 1; (i) <= (n); ++(i))
#define rrep1(i,n) for(ll (i) = (n); (i) >= 1; --(i))
#define nfor(i,a,b) for(ll (i) = (a); (i) < (b); ++(i))
#define rnfor(i,a,b) for(ll (i) = (a) - 1; (i) >= (b); --(i))
#define ll long long
#define mod (1000000007)
#define pf(x) cout << (x) << endl
#define all(x) (x).begin(),(x).end()

ll gcd(ll a,ll b){
    if(a < b)swap(a, b);
    if(b == 0) return a;
    return gcd(b,a%b);
}

ll lcm(ll a,ll b){
    ll g = gcd(a,b);
    return a / g * b;
}

ll factorial(ll n){
    ll t = 1;
    rep1(i, n)t *= i;
    return t;
}

ll combinations(ll n, ll k) {
    ll r = 1;
    rep1(i, k)r = r * n-- / i;
    return r;
}

int main(){
    ll n,cnt = 0,m = 1e9,ans = 0;
    bool zero = false;
    cin >> n;
    rep0(i, n){
        ll a;
        cin >> a;
        ans += abs(a);
        m = min(abs(a),m);
        if(a < 0)++cnt;
        if(a == 0)zero = true;
    }
    if(!zero && cnt % 2 == 1)ans -= m * 2;
    pf(ans);
    return 0;
}


Measured memory_bytes: 384
def main():
  import sys
  from scipy.sparse.csgraph import floyd_warshall as f
  n,m,l,*t=map(int,sys.stdin.buffer.read().split())
  d=[[0]*(n+1)for _ in range(n+1)]
  for a,b,c in zip(*[iter(t[:m*3])]*3):d[a][b]=c
  d=f(f(d,0)<=l)
  d[d>n]=0
  d-=1
  print('\n'.join(map(str,map(int,[d[i]for i in zip(*[iter(t[m*3+1:])]*2)]))))
main()

Measured memory_bytes: 36308
#include<bits/stdc++.h>
using namespace std;
const int N=200005;
int n,k,a[N],ans=1,bl[N];
set<int> st;
int main()
{
    scanf("%d%d",&n,&k);
    for(int i=1;i<=n;i++) scanf("%d",&a[i]);
    for(int i=1;i<=k;i++) st.insert(a[i]);
    int l=1;
    for(int i=2;i<=n;i++)
    {
        if(a[i]<a[i-1]) l=i;
        else if(i-l+1>=k) bl[i]=1;
    }
    int used=bl[k];
    for(int i=k+1;i<=n;i++)
    {
        int be=*st.begin();
        if(bl[i]&&used)
        {
            st.erase(a[i-k]); st.insert(a[i]);
            continue;
        }
        if(be!=a[i-k]||st.lower_bound(a[i])!=st.end()) 
        {
            ans++;
        }
        if(bl[i]) used=1;
        st.erase(a[i-k]); st.insert(a[i]);
    }
    cout<<ans<<endl;
    return 0;
}

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

int N,K,arr[1001];

int main(){
	cin>>N>>K;
	for(int i=0; i<N; i++)cin>>arr[i];
	sort(arr,arr+N);
	int total=0;
	for(int i=0; i<K; i++){
		total+=arr[i];
	}
	cout<<total<<'\n';
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define pb push_back
#define fi first
#define se second
const int N = 3e5+6;
const int mod = 1e9+107;
const int inf = 1e8;
int cnt[N];
void solve(){
    int n,k;
    cin>>n>>k;
    for(int i=0;i<k;i++){
        int d;
        cin>>d ;
        for(int j=0;j<d;j++){
            int x;
            cin>>x;
            cnt[x]++;
        }
    }
    int ans = 0;
    for(int i=1;i<=n;i++)if(cnt[i]==0)ans++;
    cout<<ans<<endl;
}
int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int t=1;
//    cin>>t;
    while(t--)solve();
    return 0;
}


Measured memory_bytes: 3640
import sys
import math
from collections import deque

sys.setrecursionlimit(1000000)
MOD = 10 ** 9 + 7
input = lambda: sys.stdin.readline().strip()
NI = lambda: int(input())
NMI = lambda: map(int, input().split())
NLI = lambda: list(NMI())
SI = lambda: input()


def make_grid(h, w, num): return [[int(num)] * w for _ in range(h)]


def main():
    K = NI()
    tmp = 7
    for i in range(1000005):

        if tmp % K == 0:
            print(i+1)
            exit()
        tmp = tmp * 10 + 7
        tmp = tmp % K
    print(-1)


if __name__ == "__main__":
    main()

Measured memory_bytes: 9480
// -----------------------------------------------
// Framework <https://github.com/vain0x/procon>
//
// See the bottom of file for solution.
// -----------------------------------------------

#![allow(unused_imports)]
#![allow(non_snake_case)]

use std::cell::RefCell;
use std::cmp::{max, min, Ordering};
use std::collections::*;
use std::fmt::{Debug, Formatter, Write as FmtWrite};
use std::io::{stderr, stdin, BufRead, Write};
use std::mem::{replace, swap};
use std::ops::*;
use std::rc::Rc;

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

#[allow(unused_macros)]
macro_rules! read {
    ([$t:ty] ; $n:expr) =>
        ((0..$n).map(|_| read!([$t])).collect::<Vec<_>>());
    ($($t:ty),+ ; $n:expr) =>
        ((0..$n).map(|_| read!($($t),+)).collect::<Vec<_>>());
    ([$t:ty]) =>
        (rl().split_whitespace().map(|w| w.parse().unwrap()).collect::<Vec<$t>>());
    ($($t:ty),*) => {{
        let buf = rl();
        let mut w = buf.split_whitespace();
        ($(w.next().unwrap().parse::<$t>().unwrap()),*)
    }};
}

#[allow(dead_code)]
fn rl() -> String {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();
    buf.trim_right().to_owned()
}

// -----------------------------------------------
// Solution
// -----------------------------------------------

fn main() {
    let S = rl().chars().collect::<Vec<_>>();

    let mut min_d = std::i64::MAX;
    for r in 3..S.len() + 1 {
        let l = r - 3;

        let d = (S[l..r]
            .iter()
            .cloned()
            .collect::<String>()
            .parse::<i64>()
            .unwrap()
            - 753)
            .abs();
        if min_d > d {
            min_d = d;
        }
    }

    println!("{}", min_d)
}


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

std::vector<int> g[100000];
long long dp[2][100000];
long long mo=1000000000+7;

void dfs(int cur,int par){
  dp[0][cur]=1;
  dp[1][cur]=1;
  for(int dst:g[cur]){
    if(dst==par)continue;
    dfs(dst,cur);
    dp[0][cur]=dp[0][cur]*(dp[0][dst]+dp[1][dst])%mo;
    dp[1][cur]=dp[1][cur]*dp[0][dst]%mo;
  }
  return;
}

int main(){
  int N;
  std::cin>>N;
  for(int i=0;i<N-1;++i){
    int x,y;
    std::cin>>x>>y;
    --x;
    --y;
    g[x].push_back(y);
    g[y].push_back(x);
  }
  for(int i=0;i<2;++i){	  
    for(int j=0;j<100000;++j){
      dp[i][j]=0;
    }
  }
  dfs(0,-1);
  std::cout<<(dp[0][0]+dp[1][0])%mo<<std::endl;
  
  return 0;
}



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

while n!=0:
    a = list(map(int,input().split()))
    data = []
    for i in range(len(a)-1):
        for j in range(i+1,len(a)):
            data.append(abs(a[i]-a[j]))
    n = int(input())
    print(min(data))


Measured memory_bytes: 27044
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <string>
#include <map>

using namespace std;

pair<char, int> max_kay(map<char, int>& m) {
  int max = 0;
  char key = m.begin()->first;
  for (map<char, int>::iterator it = m.begin(); it != m.end(); it++) {
    if (max < it->second) {
        max = it->second;
        key = it->first;
    }
  }
  return make_pair(key, max);
}

int main(int argc, const char * argv[]) {
    
    string s, t;
    cin >> s >> t;

    map<char, int> ms, mt;

    for (int i=0; i<s.size(); i++) {
        ms[s[i]]++;
        mt[t[i]]++;
    }

    bool b = true;

    for (int i=0; i<ms.size(); i++){
        
        pair<char, int> sp = max_kay(ms);
        pair<char, int> tp = max_kay(mt);
        if (sp.second != tp.second) {
            b = false;
            break;
        }
        ms[sp.first] = 0;
        mt[tp.first] = 0;
    }

    cout << ( b ? "Yes" : "No" ) <<  endl;


    return 0;
}

Measured memory_bytes: 776
package main

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

func getScanner(fp *os.File) *bufio.Scanner {
	scanner := bufio.NewScanner(fp)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 1000005), 1000005)
	return scanner
}

func getNextString(scanner *bufio.Scanner) string {
	scanner.Scan()
	return scanner.Text()
}

func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}

func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}

func getNextUint64(scanner *bufio.Scanner) uint64 {
	i, _ := strconv.ParseUint(getNextString(scanner), 10, 64)
	return i
}

func getNextFloat64(scanner *bufio.Scanner) float64 {
	i, _ := strconv.ParseFloat(getNextString(scanner), 64)
	return i
}

func main() {
	fp := os.Stdin
	wfp := os.Stdout
	cnt := 0

	if os.Getenv("MASPY") == "ますピ" {
		fp, _ = os.Open(os.Getenv("BEET_THE_HARMONY_OF_PERFECT"))
		cnt = 2
	}
	if os.Getenv("MASPYPY") == "ますピッピ" {
		wfp, _ = os.Create(os.Getenv("NGTKANA_IS_GENIUS10"))
	}

	scanner := getScanner(fp)
	writer := bufio.NewWriter(wfp)
	solve(scanner, writer)
	for i := 0; i < cnt; i++ {
		fmt.Fprintln(writer, "-----------------------------------")
		solve(scanner, writer)
	}
	writer.Flush()
}

func solve(scanner *bufio.Scanner, writer *bufio.Writer) {
	a := getNextInt(scanner)
	b := getNextInt(scanner)
	if a+b == 15 {
		fmt.Fprintln(writer, "+")
		return
	}
	if a*b == 15 {
		fmt.Fprintln(writer, "*")
		return
	}
	fmt.Fprintln(writer, "x")
}


Measured memory_bytes: 640
x, k, d = map(int, input().split())

if abs(x) >= d * k:
  ans = min(abs(x-k*d), abs(x+k*d))
else:
  tmp_k = x // d
  if (k - tmp_k) % 2 == 0:
    ans = min(abs(x-tmp_k*d), abs(x+tmp_k*d))
  else:
    ans = min(abs(x-tmp_k*d), abs(x+tmp_k*d))
    ans = d - ans

print(ans)

Measured memory_bytes: 61780
#include<stdio.h>
#include<stdlib.h>
#include<math.h>

typedef long long int int64;

void run(void){
  int64 n,p;
  scanf("%lld%lld",&n,&p);
  if(n==1){
    printf("%lld\n",p);
    return;
  }
  if(n>=40){
    printf("1\n");
    return;
  }
  int64 max=1;
  int64 k=2;
  while(pow(k,n)<=p){
    int64 t=p;
    int cnt=0;
    while(t%k==0){
      t/=k;
      cnt++;
    }
    if(cnt>=n){
      max=k;
    }
    k++;
  }
  printf("%lld\n",max);
}

int main(void){
  run();
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
#include<iomanip>
#include<queue>
#include<cmath>
#include<stack>
#include <map>
#define ll long long int
#define skip cin>>ws;
#define vll vector<ll> 
#define vb vector<bool>
#define vpll vector<pair<ll,ll>>
#define vvll vector<vector<ll>>
#define pll pair<ll,ll>
#define vs vector<string>
#define vvpll vector<vector<pair<ll, ll>>>
#define pb push_back
#define pob pop_back()
#define MOD (ll)(1e9 + 7)
#define test ll t; cin>>t; while(t--)

using namespace std;

void enter(vll &ar)
{
    ll n = ar.size();

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

void show(vll &a)
{
    ll n = a.size();

    for(ll i=0;i<n;i++)
    {
        cout<<a[i]<<" ";
    }
    cout<<"\n";
}

void SieveOfErat1sthenes(int n, vll &pri) 
{ 
    vb prime(n+1, true); 
   
    for (int p=2; p*p<=n; p++) 
    { 
        
        if (prime[p] == true) 
        { 
            pri.pb(p);
            
            for (int i=p*p; i<=n; i += p) 
                prime[i] = false; 
        } 
    } 
}

ll mo(ll a)
{
    return a%MOD;
}

bool compare(pll a, pll b)
{
    return a.first>b.first;
}


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

    ll n, m;
    cin>>n>>m;

    vvll gr(n+1);
    vll towards(n+1, 0);

    for(ll i=0;i<m;i++)
    {
        ll a, b;
        cin>>a>>b;

        gr[a].pb(b);
        towards[b]++;
    }

    vll dp(n+1, 0);
    queue<ll> beg;

    for(ll i=1;i<=n;i++) if(!towards[i]) beg.push(i);

    while(!beg.empty())
    {
        ll f = beg.front();
        beg.pop();

        for(ll ele: gr[f])
        {
            dp[ele] = max(dp[ele], dp[f]+1);
            towards[ele]--;
            if(!towards[ele]) beg.push(ele);
        }
    }

    ll ans = *max_element(dp.begin(), dp.end());
    cout<<ans<<"\n";

    return 0;
}


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

using namespace std;

int main() {
    int N,M,C; cin>>N>>M>>C;
    
    vector<int> Bn(M);
    for (int i=0;i<M;i++) {
        cin >> Bn[i];
    }

    int cnt=0;

    vector<int> An(M);
    for (int c=0;c<N;c++) {
        int sum=0;
        for (int i=0;i<M;i++) {
            cin >> An[i];
            sum += An[i] * Bn[i];
        }
        if (sum+C > 0) {
            cnt++;
        }
    }

    cout << cnt << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <utility>
#include <string>
#include <math.h>
typedef unsigned long ul;

using namespace std;

int arr[1000000] = {0};

int main(){
	for(int i = 2; i < 999999; i++)arr[i] = 1;
	for(int i = 2; i*i < 999999; i++){
		for(int j = i*2; arr[i] == 1 && j <= 999999; j += i){
			arr[j] = 0;
		}
	}
	for(int i = 1; i <= 999999;i++)arr[i] += arr[i-1];

	int n;
	while(cin >> n){
		cout << arr[n] << endl;
	}
}

Measured memory_bytes: 5064
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<vector>
#include<queue>
#include<map>
#include<iomanip>
#include<set>
#include<bitset>
#define rep(index,num) for(int index=0;index<num;index++)
#define rep1(index,num) for(int index=1;index<=num;index++)
#define brep(index,num) for(int index=num-1;index>=0;index--)
#define brep1(index,num) for(int index=num;index>0;index--)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-7
#define mp(a1,a2) make_pair(a1,a2)
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
typedef long long ll;
typedef long double ld;
using namespace std;
typedef pair<ll,ll> pll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
typedef vector<pll> vpll;
ll INFl=(ll)1e+18+1;
int INF=1e+9+1;
int main(){
	int N,X[101];
	scan(N);
	rep(i,N){
		scan(X[i]);
	}
	int ans=INF;
	rep1(z,100){
		int sum=0;
		rep(i,N){
			sum+=(X[i]-z)*(X[i]-z);
		}
		ans=min(ans,sum);
	}
	prin(ans);
	return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using Pair = System.Collections.Generic.KeyValuePair<int, int>;

class Program
{
    static void Main()
    {
        var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
        Console.SetOut(sw);
        new Program().solve();
        Console.Out.Flush();
    }
    Scanner cin = new Scanner();


    void solve()
    {
        var A = cin.nextint;
        var op = cin.next;
        var B = cin.nextint;

        Console.WriteLine(op == "+" ? A + B : A - B);
    }

}

class Scanner
{
    string[] s; int i;
    char[] cs = new char[] { ' ' };
    public Scanner() { s = new string[0]; i = 0; }
    public string[] scan { get { return Console.ReadLine().Split(); } }
    public int[] scanint { get { return Array.ConvertAll(scan, int.Parse); } }
    public long[] scanlong { get { return Array.ConvertAll(scan, long.Parse); } }
    public double[] scandouble { get { return Array.ConvertAll(scan, double.Parse); } }
    public string next
    {
        get
        {
            if (i < s.Length) return s[i++];
            string st = Console.ReadLine();
            while (st == "") st = Console.ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            i = 0;
            return next;
        }
    }
    public int nextint { get { return int.Parse(next); } }
    public long nextlong { get { return long.Parse(next); } }
    public double nextdouble { get { return double.Parse(next); } }
}


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

int main()
{
    int H,W;
    cin >> H >> W;

    vector<vector<char>> HW(H,vector<char>(W));

    for(int i = 0; i < H;i++)
    {
        for(int j = 0; j < W; j++)
        {
            cin >> HW.at(i).at(j);
        }
    }

    int ii[8] = {0,1,-1,1,-1,0,1,-1};
    int jj[8] = {1,1,1,0,0,-1,-1,-1};
    for(int i = 0; i < H;i++)
    {
        for(int j = 0; j < W; j++)
        {
            if(HW.at(i).at(j) == '#')continue;
            int count = 0;
            for(int d = 0; d < 8; d++)
            {
                int ni = i+ii[d];
                int nj = j+jj[d];

                if(ni < 0 || H <= ni)continue;
                if(nj < 0 || W <= nj)continue;

                if(HW[ni][nj] == '#')count++;
            }
            
            HW[i][j] = char(count + '0');
        }
    }

    for(int i = 0; i < H;i++)
    {
        for(int j = 0; j < W; j++)
        {
           cout << HW.at(i).at(j);
        }
        cout << endl;
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <bitset>
#include <cmath>
#include <string>
#include <fstream>
#define FI first
#define SE second
#define VE vector<int>
#define PB push_back
#define PA pair<int,int>
#define MA make_pair
#define LL long long
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define ROF(i,a,b) for(int i=b-1;i>=a;i--)
#define YES(i) cout<<(i?"YES":"NO")<<endl
#define Yes(i) cout<<(i?"Yes":"No")<<endl
using namespace std;
//
const int INF=1e9+7;
const int MOD=1e9+7;
//
int N;
int T[100000],A[100000];
bool ht[100000],ha[100000];
int main(){
  cin>>N;
  FOR(i,0,N){
    cin>>T[i];
  }
  FOR(i,0,N){
    cin>>A[i];
  }
  int M=-1;
  FOR(i,0,N){
    if(M<T[i]){
      M=T[i];
      ht[i]=true;
    }
  }
  M=-1;
  ROF(i,0,N){
    if(M<A[i]){
      M=A[i];
      ha[i]=true;
    }
  }
  long long ans=1;
  FOR(i,0,N){
    if(ht[i]||ha[i]){
      if(ht[i]&&ha[i]){
        if(T[i]!=A[i]){
          cout<<0<<endl;
          return 0;
        }
      }else if(ht[i]){
        if(T[i]>A[i]){
          cout<<0<<endl;
          return 0;
        }
      }else if(ha[i]){
        if(T[i]<A[i]){
          cout<<0<<endl;
          return 0;
        }
      }
      continue;
    }else{
      (ans*=min(T[i],A[i]))%=INF;
    }
  }
  if(T[N-1]!=A[0]){
    cout<<0<<endl;
  }else{
    cout<<ans<<endl;
  }
  return 0;
}


Measured memory_bytes: 1152
#include<iostream>
#include<algorithm>
#include<string> 
#include<map>
#include<set>
#include<vector>
#include<string.h>
#include<math.h>
#include<stdio.h>
#include<queue>
#include<utility>
#include<cstdio>
#include<cstring>
#define fo(i,w,n) for(int i=(int) w;i<(int) n;i++)
#define qui queue<int>
#define vit vector<int>
#define ll long long
#define pb push_back
#define lb lower_bound
#define ub upper_bound
using namespace std;
int a[300100];
int main()
{string s;int n,e=0,f=0,h=999999;cin>>n>>s;
fo(i,1,n)if(s[i]=='E')f++;
a[e++]=f;
fo(i,1,n){
	if(s[i-1]=='W')f++;
	if(s[i]=='E')f--;
	a[e++]=f;
}
fo(i,0,e)h=min(a[i],h);
cout<<h;
system("pause");
return 0;
}

Measured memory_bytes: 2044
import math
n=int(input())
x=[[0]*n for i in range(n)]
y=[[0]*n for i in range(n)]
for i in range(n):
  x[i],y[i]=map(int,input().split())
ans=0
cmb=0
for i in range(n-1):
  cmb+=i+1
  for j in range(i+1,n):
    ans+=math.sqrt(((x[i]-x[j])**2 + (y[i]-y[j])**2))
print((n-1)*ans/cmb) 

Measured memory_bytes: 3064
open Str

let read_list f =
  split (regexp " +") (read_line ()) |> List.map f

let () =
  let _ = read_line () in
  let ls = read_list int_of_string in
  let (o, e, f) = List.fold_left (fun (o', e', f') x ->
                                  if x mod 4 = 0 then (o', e', f'+1)
                                  else if x mod 2 = 0 then (o', e'+1, f')
                                  else (o'+1, e', f')) (0,0,0) ls in
  (if e = 0 then
     if o - 1 <= f then "Yes" else "No"
   else
     if o <= f then "Yes" else "No") |> print_endline


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

const long long int MOD = 1e9+7;
#define pb push_back
typedef long long ll;
const long long int N = 1e5;

void dfs(int u,int parent,vector<vector<int>>& adj, vector<vector<ll>>& dp){
    for(auto it:adj[u]){
        if(it==parent) continue;
        dfs(it,u,adj,dp);
        dp[u][1] = (dp[u][1]*dp[it][0])%MOD;
        dp[u][0] = (dp[u][0]*((dp[it][0]+dp[it][1])%MOD))%MOD;
    }
    return;
}

int main(){
    int n;
    cin>>n;
    vector<vector<int>> adj(n+5);
    for(int i=0;i<n-1;i++){
        int u,v;
        cin>>u>>v;
        adj[u].pb(v);
        adj[v].pb(u);
    }
    vector<vector<ll>> dp(n+5,vector<ll>(2,1));
    dfs(1,-1,adj,dp);
    cout<<(dp[1][0]+dp[1][1])%MOD;
    return 0;
}

Measured memory_bytes: 22288
#include <bits/stdc++.h>
#define For(i, a, b) for(int (i)=(a); (i)<(b); ++(i))
#define rFor(i, a, b) for(int (i)=(a)-1; (i)>=(b); --(i))
#define rep(i, n) For((i), 0, (n))
#define rrep(i, n) rFor((i), (n), 0)
#define fi first
#define se second
using namespace std;
typedef long long lint;
typedef pair<int, int> pii;
typedef complex<double> xy_t;
const lint mod = 1e9 + 7;

int n, q;
int par[100010], init_par[100010];
char c[100010];
int v[100010], first_marked[100010];

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

int main(){
    while(scanf("%d%d", &n, &q) && n){
        par[1] = init_par[1] = first_marked[1] = -1;
        rep(i, n-1){
            int r;
            scanf("%d", &r);
            par[i+2] = init_par[i+2] = r;
			first_marked[i+2] = -1;
        }
        rep(i, q){
            scanf(" %c %d", &c[i], &v[i]);
            if(c[i] == 'M'){
				par[v[i]] = -v[i];
				if(first_marked[v[i]] < 0) first_marked[v[i]] = i;
			}
        }
        lint ans = 0;
        rrep(i, q){
            if(c[i] == 'Q') ans += (lint)find(v[i]);
            else if(first_marked[v[i]] == i) par[v[i]] = init_par[v[i]];
        }
        printf("%lld\n", ans);
    }
}


Measured memory_bytes: 5020
#include <iostream>
using namespace std;
long long n, k, s, mx, t;
int main() {
	cin>>n;
	for(k=1; ; k*=10) {
		t = n/k*k;
		if(t==0) break;
		if(k>1) t--;
		for(s=0; t; t/=10) s += t%10;
		mx = max(mx, s);
	}
	cout<<mx;
	return 0;
}

Measured memory_bytes: 256
//#include "pch.h" 
#include <iostream>
#include <string>
#include <string.h>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cmath>
#include <stdio.h>
#include <vector>
#include <time.h>
#include <iomanip>
#include <thread>
#include <atomic>
#include <mutex>
#include <future>
#define double long double
#define int long long
#define low lower_bound
#define upp upper_bound
#define mod 1000000007 //10^9+7
#define inf 10000000000000000 //10^16
#define rep(i,n) for(int i=0;i<n;i++)
#define all(vec) vec.begin(),vec.end()
#define vsort(vec) sort(all(vec))
#define vrever(vec) reverse(all(vec));
#define vunsort(vec) vsort(vec); vrever(vec);
#define bisea binary_search
#define cend cout<<endl;
using namespace std;

signed main() {
	int H, W, h, w;
	cin >> H >> W >> h >> w;
	cout << (H - h)*(W - w) << endl;
}

Measured memory_bytes: 256
N = gets.to_i
arr = N.times.map{ gets.to_i }
stacks = [arr.shift]

arr.each do |i|
  overwrite_index = stacks.bsearch_index { |target| target < i }
  if overwrite_index.nil?
    stacks.push(i)
  else
    stacks.delete_at(overwrite_index)
    insert_index = stacks.bsearch_index { |target| target <= i }
    if insert_index.nil?
      stacks.push(i)
    else
      stacks.insert(insert_index, i)
    end
  end
end
puts stacks.count

Measured memory_bytes: 4020
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0;i<n;i++)
#include <bits/stdc++.h>
#include <numeric>
using namespace std;
typedef long long ll;
const int mod= 1e+9+7;

const int dy[4]={1,0,-1,0};
const int dx[4]={0,1,0,-1};

int main(){
  int H,W; cin>>H>>W;
  vector<vector<char>>a(H,vector<char>(W));
  rep(i,H){
      rep(j,W)cin>>a[i][j];
  }
  int mx=0;
  rep(i,H){
      rep(j,W){
          if(a[i][j]=='#')continue;
          vector<vector<int>>dist(H,vector<int>(W,-1));
          dist[i][j]=0;
          queue<pair<int,int>>q;
          q.push(make_pair(i,j));
          while(!q.empty()){
              ll y=q.front().first,x=q.front().second;
              q.pop();
              rep(k,4){
                  ll ny=y+dy[k],nx=x+dx[k];
                  if(ny<0||nx<0||ny>=H||nx>=W)continue;
                  if(a[ny][nx]=='#')continue;
                  if(dist[ny][nx]!=-1)continue;
                  q.push(make_pair(ny,nx));
                  dist[ny][nx]=dist[y][x]+1;
                  mx=max(dist[ny][nx],mx);
              }
          }
      }
  }
  cout<<mx<<endl;
}





Measured memory_bytes: 256
n=int(input())
a=list(map(int,input().split()))
money=1000
num=0
for i in range(n-1):
    if a[i]==a[i+1]:
        money=money
    elif a[i]<a[i+1]:
        num+=money//a[i]
        money-=(money//a[i])*a[i] 
    elif a[i]>a[i+1]:
        money+=a[i]*num
        num=0 
if a[-1]>=a[-2]:
    money+=a[-1]*num
elif a[-1]<a[-2]:
    money=money
print(money)


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

int main(){
  int n,m;
  cin >>n >>m;
  int L=-10000,R=10e9;
  for(int i=0;i<m;i++){
      int z,zz;
      cin >> z >>zz;
      L =max(L,z);
      R = min(zz,R);
  }
  if(R>=L){
           cout <<R-L+1 <<endl;
  }
    else{
   cout << 0 <<endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define MAX_INT 2100000000
#define rep(i,n) for (i=1;i<=(n);++i)
using namespace std;
typedef long long int ll;
#ifdef COMPILE_IN_VCPP
#include <windows.h>
HWND GetConsoleHwnd(void)
{
#define MY_BUFSIZE 1024 // Buffer size for console window titles.
	HWND hwndFound;         // This is what is returned to the caller.
	char pszNewWindowTitle[MY_BUFSIZE]; // Contains fabricated// WindowTitle.
	char pszOldWindowTitle[MY_BUFSIZE]; // Contains original// WindowTitle.
	ULARGE_INTEGER nt;
	nt.QuadPart = GetTickCount64();
	GetConsoleTitle(pszOldWindowTitle, MY_BUFSIZE);
	wsprintf(pszNewWindowTitle, "%d%d/%d", nt.HighPart, nt.LowPart, GetCurrentProcessId());
	SetConsoleTitle(pszNewWindowTitle);
	Sleep(40);
	hwndFound = FindWindow(NULL, pszNewWindowTitle);
	SetConsoleTitle(pszOldWindowTitle);
	return(hwndFound);
}
#endif
ll mod = 1e9 + 7;
ll countr(vector<string> a)
{
	vector<ll> c;
	int n=1;
	ll ans = 0;
	for (int i = 0; i < a.size() - 1; i++)
	{
		if (a[i] != a[i + 1])
		{
			c.push_back(n);
			n = 1;
		}
		else n++;
	}
	c.push_back(n);
	for (int i = 0; i < c.size(); i++)
	{
		ans += c[i] * (c[i]-1) / 2;
		printf("%d\n", c[i]);
	}
	return ans;
}
int main()
{
	int n, i, j, k, v[60];
	double ans = 0;
	cin >> n;
	for (i = 1; i <= n; i++)
	{
		cin >> v[i];
	}
	sort(v + 1, v + n + 1);
	ans = v[1];
	for (i = 2; i <= n; i++)
	{
		ans = (ans + v[i]) / 2;
	}
	cout << ans << endl;
}


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

/* Name of the class has to be "Main" only if the class is public. */
public class Main
{
	public static void main (String[] args) throws java.lang.Exception
	{
		Scanner sc = new Scanner(System.in);
		int res = 0;
		String s = sc.next();
		String t = sc.next();
		for(int i=0;i<s.length();i++) {
			if(s.charAt(i)!=t.charAt(i))
				res++;
		}
		System.out.println(res);
		sc.close();

	}
}


Measured memory_bytes: 41104
#include <bits/stdc++.h>
using namespace std;
int main(){
  int A[3][3] = {};
  for(int i=0; i<3; i++)for(int j=0; j<3; j++){
    cin>>A[i][j];
  }
  int N;
  cin>>N;

  int b;
  for(int i=0; i<N; i++){
    cin>>b;
    for(int i=0; i<3; i++)for(int j=0; j<3; j++){
      A[i][j] *= (A[i][j]==b? 0: 1);
    }
  }

  for(int i=0; i<3; i++){
    if((A[i][0]+A[i][1]+A[i][2])==0){
      cout<<"Yes\n";
      return 0;
    }
  }
  for(int i=0; i<3; i++){
    if((A[0][i]+A[1][i]+A[2][i])==0){
      cout<<"Yes\n";
      return 0;
    }
  }
  if((A[0][0]+A[1][1]+A[2][2])==0){
    cout<<"Yes\n";
    return 0;
  }
  if((A[0][2]+A[1][1]+A[2][0])==0){
    cout<<"Yes\n";
    return 0;
  }
  cout<<"No\n";
  return 0;
}

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

using namespace std;

long long work(vector<int> &num, bool flag) {

	long long sum = 0, count = 0;
	for (int i = 0; i < num.size(); ++i) {
		sum += num[i];
		if (i % 2 == flag) {
			if (sum <= 0) {
				count += 1 - sum;
				sum = 1;
			}
		} else {
			if (sum >= 0) {
				count += sum + 1;
				sum = -1;
			}
		}
	}
	return count;

}

int main(void) {

	int n; cin >> n;
	vector<int> num(n);

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

	cout << min(work(num, true), work(num, false)) << endl;
	return 0;

}

Measured memory_bytes: 640
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef double db;
ll N,D,X1[15],Y1[15],X2[15],Y2[15];
vector<P> v1,v2;
ll n;
ll dat[58000000];
const ll INF=0xfffffffffffffff;
void init(ll n_){
	n=1;
	while(n<n_) n*=2;
	for(ll i=0;i<2*n-1;i++) dat[i]=-INF;
	return;
}

void update(ll k,ll a){
	k+=n-1;
	dat[k]=a;
	while(k>0){
		k=(k-1)/2;
		dat[k]=max(dat[k*2+1],dat[k*2+2]);
	}
	return;
}

ll query(ll a,ll b,ll k,ll l,ll r){
	if(b<=l||r<=a) return -INF;
	if(a<=l&&r<=b) return dat[k];
	return max( query(a,b,k*2+1,l,(l+r)/2),query(a,b,k*2+2,(l+r)/2,r) );
}

int main()
{
	scanf("%lld%lld",&N,&D);
	ll n1=N/2;
	ll n2=N-n1;
	v1.push_back(P(0,0));
	v2.push_back(P(0,0));
	ll s;
	for(ll i=0;i<n1;i++){
		scanf("%lld%lld",&X1[i],&Y1[i]);
		s=v1.size();
		for(ll j=0;j<s;j++){
			v1.push_back(P(v1[j].first+X1[i],v1[j].second+Y1[i]));//x y
			v1.push_back(P(v1[j].first-X1[i],v1[j].second-Y1[i]));
		}
	}
	sort(v1.begin(),v1.end());
	for(ll i=0;i<n2;i++){
		scanf("%lld%lld",&X2[i],&Y2[i]);
		s=v2.size();
		for(ll j=0;j<s;j++){
			v2.push_back(P(v2[j].first+X2[i],v2[j].second+Y2[i]));//x y
			v2.push_back(P(v2[j].first-X2[i],v2[j].second-Y2[i]));
		}
	}
	sort(v2.begin(),v2.end());
	init(v2.size());
	for(ll i=0;i<v2.size();i++) update(i,v2[i].second);
	ll ans=0;
	/*for(auto x:v1){
		cout<<x.first<<" "<<x.second<<endl;
	}
	cout<<endl;
	for(auto x:v2){
		cout<<x.first<<" "<<x.second<<endl;
	}
	cout<<endl;*/
	for(ll i=0;i<v1.size();i++){
		ll l=lower_bound(v2.begin(),v2.end(),P(-D-v1[i].first,-INF))-v2.begin();
		ll r=upper_bound(v2.begin(),v2.end(),P(D-v1[i].first,INF))-v2.begin();
		//if(ans<v1[i].second+query(l,r,0,0,n)){
		//	printf("%lld %lld %lld %lld %lld\n",v1[i].first,v1[i].second,l,r,query(l,r,0,0,n));
		//}
		ans=max(ans,v1[i].second+query(l,r,0,0,n));
	}
	printf("%lld\n",ans);
}

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

public class Main {
	public static void main(String[] args) {
		try {
			BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
			String str;
			while (null != (str = in.readLine())) {
				String[] sar = str.split(" ");
				System.out.println(String.valueOf(Integer.parseInt(sar[0]) + Integer.parseInt(sar[1])).length());

			}
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}

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

int main() {
    int N, Y;
    cin >> N >> Y;

    for (int x = 0; x <= N; x++) {
        for (int y = 0; y <= N; y++) {
            if (N - x - y < 0) break;
            int total = 10000 * x + 5000 * y + 1000 * (N - x - y);

            if (total == Y) {
                cout << x << " " << y << " " << (N - x - y) << endl;
                return 0;
            }
        }
    }
    cout << "-1 -1 -1" << endl;
}

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

int main(){
  int x,y,z;cin >> x>> y >> z;
  printf("%d %d %d\n", z, x, y);
  return 0;
}


Measured memory_bytes: 256
N, C = gets.split.map(&:to_i)
stc = N.times.map { gets.split.map(&:to_i) }
a = Array.new(C) { Array.new(100001, 0) }

stc.each do |s, t, c|
  a[c-1][s] += 1
  a[c-1][t] -= 1
end

b = Array.new(200002, 0)
a.each do |ai|
  100000.times do |i|
    if ai[i] == 1
      b[i*2-1] += 1
    elsif ai[i] == -1
      b[i*2] -= 1
    end
  end
end

max = c = 0
b.each do |i|
  c += i
  max = [max, c].max
end

p max


Measured memory_bytes: 34940
#include<iostream>
#include<algorithm>
#include<string>
#include<cstdlib>
#include<map>
#include<iomanip>
#include<sstream>
#include<vector>
#include<stack>
#include<math.h>
#include<queue>
#include<complex>
using namespace std;


int main() {
    const long long int mod = 1000000007,INF=50000000000000;
    typedef pair<long long int,long long int>P;
	map<long long int, long long int>mp;
    priority_queue<P,vector<P>,greater<P> >mazuisushi;
    
    priority_queue<P>umaisushi;
	cout << fixed << setprecision(10);
    string str;
    long long int n,k,t,d,a,b,now=-1,tmp=0,typ=0;
    long long int res=0,ng[200005]={};
    cin>>n>>k;
    for(int i=0;i<n;i++){
        cin>>t>>d;
        umaisushi.push({d,t});
    }
    for(int i=0;i<k;i++){
        if(ng[umaisushi.top().second]==0){
            ng[umaisushi.top().second]=1;
            typ++;
            tmp+=umaisushi.top().first;
        }else{
            mazuisushi.push(umaisushi.top());
            tmp+=umaisushi.top().first;
        }
        umaisushi.pop();


    }
    res=tmp+typ*typ;
    while(!umaisushi.empty()&&!mazuisushi.empty()){
        if(ng[umaisushi.top().second]==0){
            ng[umaisushi.top().second]=1;
            typ++;
            tmp+=umaisushi.top().first;
            tmp-=mazuisushi.top().first;
            mazuisushi.pop();
            res=max(res,tmp+typ*typ);
        }
        umaisushi.pop();
    }
    cout<<res;
} 


Measured memory_bytes: 5104
import java.util.Scanner;
import static java.lang.Math.*;
public class Main {
	static int a,b,c,d,e,f;
	static Scanner sc = new Scanner(System.in);
	
	static boolean read() {
		if(!sc.hasNextInt()) return false;
		a = sc.nextInt();
		b = sc.nextInt();
		c = sc.nextInt();
		d = sc.nextInt();
		e = sc.nextInt();
		f = sc.nextInt();
		return true;
	}
	
	static void solve() {
		int det = a * e - b * d;
		double x, y;
		x =  (double)(c*e - b*f) / det;
		y =  (double)(a*f - c*d) / det;
		x = floor(x * 1000 + 0.5) / 1000;
		y = floor(y * 1000) / 1000;
		System.out.printf("%.3f %.3f\n", x, y);
	}
	
	public static void main(String[] args) {
		while(read()) {
			solve();
		}
	}

}

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

using namespace std;

const long long MAX = 1000000000000000000LL;

int main() {
	int n; cin >> n;
	vector<long long> a(n);
	for (auto& e : a) cin >> e;
	sort(a.begin(), a.end());
	long long ans = 1;
	for (int i = 0; i < n; ++i) {
		if (ans && a[i] > MAX / ans) {
			cout << -1 << endl;
			return 0;
		}
		ans *= a[i];
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 4044
def magic(n):
    c=1
    x=n/2
    y=x+1
    while 1:
        A[y][x]=c
        if c==n*n:break
        while 1:
            x,y=(x+1)%n,(y+1)%n
            if A[y][x]==0:break
            x,y=(x-1)%n,(y+1)%n
            if A[y][x]==0:break
        c+=1
    return
while 1:
    n=input()
    if n==0:break
    N=range(n)
    A=[[0]*n for i in N]
    magic(n)
    for i in N:
        print "".join(["%4d" %(e)for e in A[i]])

Measured memory_bytes: 4248
import sys
from collections import deque
from bisect import bisect_left, bisect_right
input = sys.stdin.readline
Q = int(input())
P = 10 ** 5
c1 = [i % 2 == 1 for i in range(P)]
c2 = [False for i in range(P)]
c1[2] = True
c2[3] = True
L = deque([])
for i in range(2, P):
    if c1[i]:
        ind = i*2-1
        if ind < P:
            c2[ind] = True
        ind = i * 2
        while ind < P:
            c1[ind] = False
            ind += i
    if c1[i] and c2[i]:
        L.append(i)

for q in range(Q):
    l, r = [int(x) for x in input().strip().split()]
    print(bisect_right(L, r) -  bisect_left(L, l))


Measured memory_bytes: 5816
#include <iostream>

using namespace std;

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

Measured memory_bytes: 1156
using System;

namespace Aizu {
    public class OnlineJudge {
        static void Main() {
            var p = 0;
            foreach (var c in Console.ReadLine()) {
                if (c == '*') {
                    break;
                }

                switch (c) {
                    case '(':
                        ++p;
                        break;
                    case ')':
                        --p;
                        break;
                }
            }

            Console.WriteLine(p);
        }
    }
}



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

ll A, B;

ll gcd(ll a, ll b) {
    ll large = max(a, b);
    ll small = min(a, b);
    if (small == 0) return large;
    else return gcd(small, large % small);
}

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

    cout << A*B / gcd(A, B) << endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
/*
alias g='g++ -std=c++17 -O2 pra.cpp'
alias a='./a.out'
cd programming
cd cpp
cd practice

*/
#define rep(i, n) for(int (i)=0; (i)<(n); i++)
#define pb push_back
using veci = vector<int>;
using ll = long long;
using G = vector<vector<int>>;
struct Node{
    int id;
    int parent;
    int depth;
    veci children;
    void addChild(int num){
        children.pb(num);
    }
};

using P = pair<Node, int>;

Node tree[100100];
void init(int n){
    rep(i, n){
        tree[i].depth = tree[i].parent = -1;
        tree[i].children.clear();
    }
    return;
}
int main(){
    int n, id, num, childsid;
    cin >> n;
    
    init(n);
    rep(i, n){
        cin >> id >> num;
        tree[id].id = id;
        rep(j, num){
            cin >> childsid;
            tree[id].addChild(childsid);
            tree[childsid].parent = id;
            }
    }
    int root;
    rep(i, n){
        if (tree[i].parent == -1){
            root = i;
            break;
        }
    }
    queue<P> q;
    q.push(make_pair(tree[root], -1));
    while(!q.empty()){
        P p = q.front(); q.pop();
        tree[p.first.id].depth = p.second + 1;
        rep(i, p.first.children.size()){
            q.push(make_pair(tree[p.first.children[i]], p.second+1));
        }
    }

    rep(i, n){
        cout << "node " << i << ": parent = ";
        cout << tree[i].parent << ", depth = ";
        cout << tree[i].depth << ", "; 
        if(tree[i].parent == -1){
            cout << "root";
        }
        else if(tree[i].children.empty())cout << "leaf";
        else cout << "internal node";
        cout << ", [";
        rep(j, tree[i].children.size()){
            cout << tree[i].children[j];
            if (j != tree[i].children.size()-1) cout << ", ";
        }
        cout << "]" << endl;
    }
}


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

#define rep(i, n) for (int i = 0; i < n; ++i)
#define all(x) (x).begin(),(x).end()

using ll = long long;
using P = pair<int,int>;

const int MOD = 1e9 + 7;
const int INF = 1001001001;


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

    string s, t;
    cin >> s >> t;

    bool ok = true;
    rep(i, s.size()){
        if(s[i] != t[i]){
            ok = false;
        }
    }

    cout << (ok ? "Yes" : "No") << "\n";
    

    return 0;
}


Measured memory_bytes: 3636
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		
		int n = scan.nextInt();
		
		Set<String> set = new HashSet<>();
		for(int i = 0; i < n; i++)
			set.add(scan.next());
		scan.close();
		
		System.out.println(set.size());
	}

}


Measured memory_bytes: 78448
#include <iostream>
#include <iomanip>
#include <cstdint>
#include <cmath>
#include <climits>
#include <cassert>
#include <string>
#include <vector>
#include <valarray>
#include <list>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <numeric>
#include <functional>
#include <memory>
#include <optional>

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

using namespace std;

template<class T, class U>
istream& operator>>(istream& is, pair<T, U>& pair)
{
    is >> pair.first >> pair.second;
    return is;
}

template<class T>
istream& operator>>(istream& is, vector<T>& collection)
{
    for(auto& item : collection) is >> item;
    return is;
}

template<class T>
istream& operator>>(istream& is, valarray<T>& collection)
{
    for(auto& item : collection) is >> item;
    return is;
}

template <class T>
T peak_and_pop(std::queue<T>& q)
{
    assert(!q.empty());
    T t = move(q.front());
    q.pop();
    return t;
}

template <class T>
T peak_and_pop(std::priority_queue<T>& q)
{
    assert(!q.empty());
    T t = move(q.top());
    q.pop();
    return t;
}

template <class T>
T peak_and_pop(std::stack<T>& q)
{
    assert(!q.empty());
    T t = move(q.top());
    q.pop();
    return t;
}

struct book_t {
    int price;
    valarray<int> skill;
};

void solution()
{
    int n,m,x;
    cin >> n >> m >> x;
    vector<book_t> books(n);
    for(auto& b : books){
        cin >> b.price;
        b.skill = valarray<int>(m);
        cin >> b.skill;
    }
    optional<int64_t> min_cost = nullopt;
    for(int buy = 0; buy < (1<<n); ++buy){
        valarray<int> skill(m);
        bitset<12> buy_pattern = buy;
        int64_t cost = 0;
        for(int i = 0; i < n; ++i){
            if(buy_pattern[i]){
                skill += books[i].skill;
                cost += books[i].price;
            }
        }
        if(all_of(begin(skill), end(skill), [=](int s){return s >= x;})){
            min_cost = min_cost ? min(*min_cost, cost) : cost;
        }
    }
    if(min_cost){
        cout << *min_cost << '\n';
    }
    else{
        cout << "-1\n";
    }
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(10);
    solution();
    return 0;
}


Measured memory_bytes: 3660
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath> 
#include <iomanip>
#include <sstream>
#include <stdio.h>
#include <typeinfo>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0; i<n; i++)
int a=0,b=0,c=0;

signed main(){
    string n;
    cin>>n;
    string str;
    rep(i,n.size()){
        str=n[i];
        b=atoi(str.c_str());
        a+=b;
    }
    if (a%9==0)
    {
        cout<<"Yes"<<endl;
    }else
    {
        cout<<"No"<<endl;
    }
    
    


    
}

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

#define REP(i,s,n) for(int i=s;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define fst first
#define snd second
#define pb push_back
#define ALL(x) x.begin(),x.end()
#define EPS (1e-9)
#define equals(a,b) (fabs((a)-(b))<EPS)

using namespace std;

bool LT(double a,double b) { return !equals(a,b) && a < b; }
bool LTE(double a,double b) { return equals(a,b) || a < b; }

const string YES = "";
const string NO  = "";

typedef long long ll;

void solve() {

}

int main() {
  int K;
  cin >> K;
  ll sum = 0;
  REP(i,1,K+1) {
    REP(j,1,K+1) {
      REP(k,1,K+1) {
	sum += (ll)__gcd(i,__gcd(j,k));
      }
    }
  }
  cout << sum << endl;
  return 0;
}


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

def battle(hp, pw):
	count = 0
	while hp > 0:
		hp -= pw
		count += 1
	return count-1

taka_count = battle(a,d)
ao_count = battle(c,b)

if taka_count >= ao_count:
	print('Yes')
else:
	print('No')

Measured memory_bytes: 9168