akhauriyash/Code-Regression huggingface dataset:
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
use std::io::{Write, BufWriter};
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};
    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, [graph1; $len:expr]) => {{
        let mut g = vec![vec![]; $len];
        let ab = read_value!($next, [(usize1, usize1)]);
        for (a, b) in ab {
            g[a].push(b);
            g[b].push(a);
        }
        g
    }};
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };
    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };
    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };
    ($next:expr, usize1) => (read_value!($next, usize) - 1);
    ($next:expr, [ $t:tt ]) => {{
        let len = read_value!($next, usize);
        read_value!($next, [$t; len])
    }};
    ($next:expr, $t:ty) => ($next().parse::<$t>().expect("Parse error"));
}

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

fn solve() {
    let out = std::io::stdout();
    let mut out = BufWriter::new(out.lock());
    macro_rules! puts {
        ($($format:tt)*) => (let _ = write!(out,$($format)*););
    }
    input! {
        n: usize,
        a: [usize; n],
    }
    let mut tot: i64 = 0;
    const W: usize = 1_000_001;
    let mut tbl = vec![0i64; W];
    let mut div = vec![false; W];
    for &a in &a {
        tbl[a] += 1;
    }
    for i in 1..W {
        if tbl[i] == 0 { continue; }
        for j in 2..(W - 1) / i + 1 {
            if tbl[i * j] > 0 {
                div[i * j] = true;
            }
        }
        if !div[i] && tbl[i] == 1 {
            tot += tbl[i];
        }
    }
    puts!("{}\n", tot);
}

fn main() {
    // In order to avoid potential stack overflow, spawn a new thread.
    let stack_size = 104_857_600; // 100 MB
    let thd = std::thread::Builder::new().stack_size(stack_size);
    thd.spawn(|| solve()).unwrap().join().unwrap();
}


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

int main() {
	int n;
	while(1){
		cin >> n;
		if(n == 0) break;
		int p[9], sum = 0;
		for(int i=0; i<9; i++){
			cin >> p[i];
			sum += p[i];
		}
		int ans = n - sum;
		cout << ans << endl;
	}
	return 0;
}


Measured memory_bytes: 3016
#include <bits/stdc++.h>
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
using namespace std;
int main()
{
	cin.tie(0);
	ios_base::sync_with_stdio(false);

	int X, A, B;
	cin >> X >> A >> B;
	cout << (X - A) % B << '\n';

	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 n = sc.nextInt();
		int a = sc.nextInt();
		int b = sc.nextInt();
		
		System.out.print(Math.min(a, b));
		System.out.print(" ");
		System.out.print(Math.min(a-(n-b),b-(n-a)) > 0 ? Math.min(a-(n-b),b-(n-a)) : "0");
		
		sc.close();
	}

}


Measured memory_bytes: 23764
#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<algorithm>
using namespace std;
#define rep(i,x) for(int i = 0; i < x; i++)
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
typedef long long ll;
typedef pair<int,int> P;
typedef vector<int> ivec;
const ll N = 1e9+7;

int main(){
    int n,k; cin >> n >> k;
    vector<int> ab[n];
    rep(i,n-1){
        int a,b; cin >> a >> b;
        a--;b--;
        ab[a].pb(b);
        ab[b].pb(a);
    }
    ll prob[n] = {};
    fill(prob,prob+n,N);
    prob[0] = k;
    // rep(i,n){
    //     rep(j,ab[i].size()){
    //         cout << ab[i][j] << " ";
    //     }
    //     cout << endl;
    // }
    queue<ll> que;
    que.push(0);
    while(que.size()){
        ll p = que.front();que.pop();
        ll start = 0;
        if(p == 0) start = k-1;
        else start = k-2;
        for(auto i : ab[p]){
            if(prob[i] == N){
                prob[i] = start;
                start--;
                que.push(i);
            }
        }
    }
    // rep(i,n){
    //     int start = 0;
    //     if(i == 0){
    //         start = k-1;
    //     }
    //     else{
    //         start = k-2;
    //     }
    //     rep(j,ab[i].size()){
    //         if(prob[ab[i][j]] == 0){
    //             prob[ab[i][j]] = start;
    //             start--;
    //         }
    //     }
    // }
    // rep(i,n)cout << i  << ' ' << prob[i] << endl;
    ll ans = 1;
    rep(i,n) {
        ans = (ans * prob[i])%N;
        // cout << i  << ' ' << ans << endl;
    }
    if(ans >= 0)cout << ans%N << endl;
    else cout << 0 << endl;
    return 0;
}

Measured memory_bytes: 7672
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		int tap = 0;
		int socket = 1;

		while(socket < B) {
			socket = socket + A - 1;
			tap ++;
		}

		System.out.println(tap);

	}
}

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

using namespace std;

typedef long long ll;
//const ll mod = 1000000007;

int main() {
  ll n,m;
  cin>>n>>m;
  vector<ll> a(n + 1),sum(n + 1,0);
  for (int i = 1; i <= n; i++) {
    cin>>a[i];
    sum[i] = sum[i - 1] + a[i];
  }
  map<ll, ll> mp;
  for (int i = 1; i <= n; i++) {
    ll tmp = sum[i] % m;
    mp[tmp]++;
  }
  ll ans = 0;
  for (auto k : mp) {
    ll key = k.first;
    ll cur = k.second;
    ll res = cur * (cur - 1) / 2;
    if (key == 0) res += cur;
    ans +=res;
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 5760
import java.io.*;
import java.util.*;
public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		Scanner s = new Scanner(new BufferedReader(new InputStreamReader(System.in))); 
		String card = "";
		Integer shaffle_time = 0;
		while(s.hasNext()){
			String input = s.next();
			if(input.equals("-")){
				System.out.println(card);
				break;
			}
			try{
				shaffle_time = Integer.parseInt(input);
				card = card.substring(shaffle_time, card.length()) + card.substring(0, shaffle_time);
			}
			catch(NumberFormatException e){
				if(card == ""){
					card = input;
				}
				else{
					System.out.println(card);
					card = input;
				}
				s.next();
			}
		}
		s.close();
	}
}

Measured memory_bytes: 17356
n, k = map(int, input().split())
a = [int(x) - 1 for x in input().split()]
now = 0
b = [0] * n
while k!= 0:
    if k & 1:
        now = a[now]
    k >>= 1
    for i in range(n):
        b[i] = a[a[i]]
    a = b[:]
print(now+1)

Measured memory_bytes: 169204
#include<iostream>
#include<bits/stdc++.h>
#include<iomanip>
#include<math.h>
#include<vector>
#include<cctype>
#include<string>
#include<set>
#include<map>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
std::string line;
typedef long long ll;

int main(){

   int n,m;
   cin >> n >> m;

   cout << (n-1)*(m-1) << endl;


   return 0;
}

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

#define long long long int
using namespace std;

// @author: pashka

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

    int n;
    cin >> n;
    vector<int> a(n);
    vector<int> b(n);
    for (int i = 0; i < n; i++) cin >> a[i];
    for (int i = 0; i < n; i++) cin >> b[i];

    vector<pair<int, int>> aa(n);
    vector<pair<int, int>> bb(n);
    for (int i = 0; i < n; i++) {
        aa[i] = {a[i], i};
        bb[i] = {b[i], i};
    }
    sort(aa.begin(), aa.end());
    sort(bb.begin(), bb.end());

    for (int i = 0; i < n; i++) {
        if (aa[i].first > bb[i].first) {
            cout << "No\n";
            return 0;
        }
    }

    for (int i = 0; i < n - 1; i++) {
        if (aa[i].first <= bb[i + 1].first &&
            aa[i + 1].first <= bb[i].first) {
            cout << "Yes\n";
            return 0;
        }
    }
    vector<int> p(n);
    for (int i = 0; i < n; i++) {
        p[aa[i].second] = bb[i].second;
    }

    int x = p[0];
    int c = 1;
    while (x != 0) {
        c++;
        x = p[x];
    }

    if (c == n) {
        cout << "No\n";
    } else {
        cout << "Yes\n";
    }

//    2 3 1    
//    1 2 3

    return 0;
}

Measured memory_bytes: 2944
N = int(input())
s = []
for i in range(N):
    s.append(input())
m = 0
a = 0
r = 0
c = 0
h = 0
for person in s:
  if person[0]=='M':
    m += 1
  elif person[0]=='A':
    a += 1
  elif person[0]=='R':
    r += 1
  elif person[0]=='C':
    c += 1
  elif person[0]=='H':
    h += 1
    
ans = m*a*r+m*a*c+m*a*h+m*r*c+m*r*h+m*c*h+a*r*c+a*r*h+a*c*h+r*c*h
print(int(ans))

Measured memory_bytes: 9776
# -*- coding: utf-8 -*-
n = int(input())
a = list(map(int, input().split()))
MAX_RSESULT = 1000000000000000000

result = 1
a.sort(reverse=True)

if a[-1]==0:
    result = 0
else:
    for ai in a:
        result *= ai
        if result > MAX_RSESULT:
            result = -1
            break
print(result)

Measured memory_bytes: 84620
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
            
        int r = sc.nextInt();
        int c = sc.nextInt();
        int sum=0;
        int sum2=0;
        
        int[][] array = new int[r][c];
        
        for(int i=0; i<r ; i++){
            for(int j=0; j<c ; j++){
                array[i][j]=sc.nextInt();
                if(j==0){
                    System.out.print(array[i][j]);
                }else{
                    System.out.print(" "+array[i][j]);
                }
                sum+=array[i][j];
            }
             System.out.println(" "+sum);
            sum=0;
        }
        for(int j=0; j<c ; j++){
            for(int i=0; i<r ; i++){
                sum2+=array[i][j];
            }
                if(j==0){
                    System.out.print(sum2);
                }else{
                    System.out.print(" "+sum2);
                }
                sum+=sum2;
                sum2=0;
        }
        
             System.out.println(" "+sum);
            sum=0;
        
        sc.close();
    }
}


Measured memory_bytes: 40828
using System;
using System.Collections.Generic;
using System.Linq;

namespace AC
{
    class Program
    {
        static void Main(string[] args)
        {
            var input = ReadArrayInt();
            var N = input[0];
            var K = input[1];
            var mod = (int)Math.Pow(10, 9) + 7;
            var ans = 1L;
            var minAdd = 0;
            var maxAdd = N;
            var minSum = 0L;
            var maxSum = 0L;
            for (int i = 0; i < K; i++)
            {
                minSum += minAdd;
                maxSum += maxAdd;
                minAdd++;
                maxAdd--;
            }
            for (int i = K; i <= N; i++)
            {
                ans += maxSum - (minSum - 1);
                ans %= mod;
                minSum += minAdd;
                maxSum += maxAdd;
                minAdd++;
                maxAdd--;
            }

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

        static string Read() { return Console.ReadLine(); }
        static int ReadInt() { return int.Parse(Read()); }
        static long ReadLong() { return long.Parse(Read()); }
        static string[] ReadArrayString() { return Read().Split(' '); }
        static int[] ReadArrayInt() { return Read().Split(' ').Select(s => int.Parse(s)).ToArray(); }
        static long[] ReadArrayLong() { return Read().Split(' ').Select(s => long.Parse(s)).ToArray(); }
    }
}


Measured memory_bytes: 28612
#include<algorithm>
#include<iostream>
#include<string>
#include<vector>
using namespace std;
int P[100000];
int quickSort(int p,int r){
    int i=p-1;
    for(int j=p;j<r;++j){
        if(P[j]<=P[r-1]){
            i++;
            swap(P[i],P[j]);
        }
    }
    return i;
}
int main(){
    int N;
    cin>>N;
    for(int i=0;i<N;++i) cin>>P[i];
    int q = quickSort(0,N);
    string s;
    for(int i=0;i<N;++i){
        if(i==q) s+='['+to_string(P[i])+"] ";
        else s+=to_string(P[i])+' ';
    }
    s.pop_back();
    cout<<s<<endl;
}

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

using namespace std;

int main() {
	int n;
	cin >> n;
	
	switch (n % 10) {
		case 2:
		case 4:
		case 5:
		case 7:
		case 9:
			cout << "hon";
			break;
		case 0:
		case 1:
		case 6:
		case 8:
			cout << "pon";
			break;
		default:
			cout << "bon";
			break;
	}
	
	return 0;
}


Measured memory_bytes: 3636
n, k = map(int, input().split())
arr = list(range(n+1))
ans = 0
MOD = 10**9 + 7

for i in range(k, n+2):
    high = (arr[-i] + arr[-1]) * i // 2
    low = (arr[0] + arr[i-1]) * i // 2
    ans += (high - low + 1) % MOD
print(ans % MOD)


Measured memory_bytes: 16796
#include <iostream>
#include <algorithm>
#include <vector>
#include <utility>

using namespace std;

int main() {
	int n, T; cin >> n >> T;
	vector<pair<int, int>> v;

	while (n--) {
		int c, t; cin >> c >> t;
		if (t > T) {
			continue;
		}
		v.push_back({c, t});
	}
	if (v.size() == 0) {
		cout << "TLE" << endl;
	}
	else {
		sort(v.begin(), v.end());
		cout << v[0].first << endl;
	}
	
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
// #include <boost/multiprecision/cpp_int.hpp> 

#define gc getchar//_unlocked
#define pc putchar//_unlocked
#define ll long long
#define ld long double
#define pb push_back
#define mp make_pair
#define pp pair<int,int>
#define bigint boost::multiprecision::cpp_int
#define finp ios_base::sync_with_stdio(0);cin.tie(0);
#define bc __builtin_popcountll
#define afor(i,a,b) for(int i=a;i<=b;++i)
#define bfor(i,a,b) for(int i=a;i>=b;--i)
#define vi vector<int>
#define vpp vector<pp>
#define vll vector<ll>

using namespace std;
using namespace __gnu_pbds;

char putnb[20];
void putn(ll n) {if(!n)pc('0');if(n<0)pc('-'),n=0-n;int pi=0;while(n)putnb[pi++]=(n%10)+'0',n/=10;while(pi)pc(putnb[--pi]);}
void sci(int *x) {register char c = gc();*x = 0;for(; (c<48)||(c>57);c = gc());for(; (c>47)&&(c<58);c = gc())*x = (int)((((*x)<<1) + ((*x)<<3)) + c - 48);}
void scll(ll *x)  {register char c = gc();*x = 0;for(; (c<48)||(c>57);c = gc());for(; (c>47)&&(c<58);c = gc())*x =  (ll)((((*x)<<1) + ((*x)<<3)) + c - 48);}
ll fp(ll a,ll b,ll c) {if(b==0)return 1%c; if(b==1)return a%c; ll ret=fp(a,b/2,c); ret=(ret*ret)%c; if(b&1)ret=(ret*a)%c; return ret;}

const ll mod=1e9 +7;
const ll mod2=1999999973;
const ll inf=1e18;
const int infs=1e9 + 1000;
const int N=100000;
const long double PI = acos(-1);

template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

ll solvep(ll w,ll h)
{
  if(h%w == 0)
  {
    ll ret = (h/w) * 2*w;
    ret-=w;
    return ret;
  }
 ll ret = (h/w) * 2*w;
 ret+=solvep(h%w,w);

 return ret;

}
int main()
{
  finp;

  ll n,x;
  cin>>n>>x;

  if( n <= 2*x )
  {
    ll curr =  x + (x/(n-x))* 2 * (n-x);

    if( x % (n-x) )
    {
      curr+=n-x;
      curr+=solvep(x%(n-x),n-x);
    }
    cout<<curr;
  }
  else
  {
    cout<<(n + solvep(x,n-x));
  }
  
return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		int count4n = 0, count2n = 0, countOhter = 0;
		int n;
		boolean flg = true;
		Scanner sc = new Scanner(System.in);
		n = sc.nextInt();
		for (int i = 0; i < n; i++) {
			int a = sc.nextInt();
			if (a % 4 == 0) {
				count4n++;
			} else if (a % 2 == 0) {
				count2n++;
			} else {
				countOhter++;
			}
		}

		// 4の倍数がないとき
		if (count4n == 0 && count2n != n) {
			flg = false;
		}

		// ここに来るときは必ず 4の倍数が1つ以上存在することになる
		// n が偶数
		if (n % 2 == 0) {
			if (count4n < countOhter) {
				flg = false;
			}
		}
		// n が奇数
		else {
			if (count4n < countOhter - 1) {
				flg = false;
			}
		}

		if (flg) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}

	}

}

Measured memory_bytes: 48188
S = input().strip()

count_0 = 0
count_1 = 0
for c in list(S):
    if c == "0":
        count_0 += 1
    else:
        count_1 += 1

if count_0 > 0 and count_1 > 0:
    print(2*min(count_0, count_1))
else:
    print(0)


Measured memory_bytes: 3956
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int dp[1002][1002];
const int MOD = (int)1e9 + 7;
int main()
{
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    ll n, ans = 0;
    cin >> n;
    ll a[n];
    for (int i = 0; i < n; i++)
        cin >> a[i];
    for (int i = 1; i < n; i++)
    {
        if(a[i - 1] > a[i])
        {
            ans +=  a[i - 1] - a[i];
            a[i] = a[i - 1];
        }
    }
    cout << ans;

}

Measured memory_bytes: 5212
let iota ?(start=0) ?(step=1) cnt =
  let rec doit i acc =
    if i <= 0 then acc
    else doit (i - 1) (start + step*(i - 1) :: acc) in
  doit cnt []

let rec solve (n, s) =
  let rec doit n s lst =
    match (n, s) with
    | (0, 0) -> 1
    | (0, _) -> 0
    | (n, s) ->
      List.map (fun e ->
        List.filter (fun x -> x > e) lst |> doit (n - 1) (s - e))
        lst
      |> List.fold_left (+) 0 in
  iota 10 |> doit n s

let () =
  let rec main_loop () =
    let (n, s) = Scanf.scanf "%d %d " (fun n s -> n, s) in
    if n = 0 && s = 0 then ()
    else begin
      solve (n, s) |> Printf.printf "%d\n";
      main_loop ()
    end in
  main_loop ()

Measured memory_bytes: 4420
#include <bits/stdc++.h>
using namespace std;
 
int64_t MOD = 1e9+7;
 
//---------- べき乗 ----------
int64_t modpower(int64_t a, int64_t n){
    if(n == 0) return 1;
    
    int64_t res = 1;
    while(n > 0){
        if(n % 2 == 1) res = res * a % MOD;
        a = a * a % MOD;
        n /= 2;
    }
 
    return res;
}
 
//---------- 逆元 ----------
int64_t modinv(int64_t a){
    return modpower(a, MOD-2);
}
 
 
//--------- 組み合わせ ---------
int64_t modcombination(int64_t n, int64_t r){
  int64_t bunbo = 1, bunshi = 1;
 
  for(int i=0; i<r; i++){
    bunbo = bunbo * (r-i) % MOD;
    bunshi = bunshi * (n-i) % MOD;
  }
 
  return bunshi * modinv(bunbo) % MOD;
}
 
 
int main(){ 
  int64_t N, A, B;
  cin >> N >> A >> B;
 
  int64_t ans = modpower(2, N) - modcombination(N, A) - modcombination(N, B) - 1;
  while(ans < 0) ans += MOD;
  
  cout << ans << endl;
}

Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ld long double
#define al(a) (a).begin(),(a).end()
#define mk make_pair
#define check cout<<"?"<<endl;

ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;

int main(){
    int n; cin>>n;
    int p=-1,cnt,ans=0;
    rep(i,n){
        int h; cin>>h;
        if(p<h) cnt=0;
        else cnt++;
        ans=max(ans,cnt);
        p=h;
    }
    cout<<ans<<endl;
}

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

int main() {
    int x;
    cin >> x;
    int h = floor(x / 3600);
    int m = floor((x-3600*h) / 60);
    int s = x-60*m-3600*h;
    cout << h << ":" << m << ":" << s << endl;
}

Measured memory_bytes: 3096
#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <cstring>
#include <cstdio>
#include <iomanip>
#include <cmath>
#include <algorithm>
using namespace std;
#define DBG(x)                         \
    (void)(cout << "L" << __LINE__     \
                << ": " << #x << " = " \
                << (x) << '\n')
typedef long long ll;
const int INF = 0x3f3f3f3f;
const int maxn = 110000;
int x[maxn];
void run_case()
{
    int n;
    cin >> n;
    for (int i = 1; i <= n; i++)
    {
        cin >> x[i];
    }
    int ans = INF;
    for (int pos = 1; pos <= 100; pos++)
    {
        int res = 0;
        for (int i = 1; i <= n; i++)
        {
            res += (x[i] - pos) * (x[i] - pos);
        }
        ans = min(res, ans);
    }
    cout << ans << "\n";
}
int main()
{
    //检查有没有特判0,有没有越界限.
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << setiosflags(ios::fixed) << setprecision(12);
    run_case();
    return 0;
}

Measured memory_bytes: 3632
import math
import sys

def getinputdata():

    # 配列初期化
    array_result = []
    
    data = input()

    
    array_result.append(data.split(" "))

    flg = 1

    try:


        while flg:

            data = input()

            array_temp = []

            if(data != ""):
                
                array_result.append(data.split(" "))

                flg = 1

            else:

                flg = 0
    finally:


        return array_result





arr_data = getinputdata()


n = int(arr_data[0][0])

set01=set()

for v in range(1,1+n):
    
    set01.add(arr_data[v][0])


print(len(set01))

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
typedef vector<int> VI;
typedef long long ll;
typedef pair<int,int> PII;
const ll mod= 998244353;
ll powmod(ll a,ll b) {
	ll res=1;
	a%=mod;
	assert(b>=0);
	for(; b; b>>=1) {
		if(b&1)res=res*a%mod;
		a=a*a%mod;
	}
	return res;
}
ll gcd(ll a,ll b) {
	return b?gcd(b,a%b):a;
}

const int N=3000+10;
int n,s,a[N],f[N];
ll ans=0;
int main() {
	cin>>n>>s;
	rep(i,1,n+1) {
		cin>>a[i];
	}
	rep(i,1,n+1) {
		per(j,a[i],s+1) {
			f[j]=((ll)f[j]+f[j-a[i]])%mod;

		}
		if(a[i]<=s) {
			f[a[i]]=(ll)(f[a[i]]+i)%mod;
		}
		ans=(ans+f[s])%mod;
	}
	cout<<ans;
	return 0;
}


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

int main() {
    string S;
    cin >> S;
    int N = S.size();
    for (int i = 0; i < N/2; i++) {
        if (S[i] != S[N - 1 - i]) {
            cout << "No" << endl;
            return 0;
        }
    }
    for (int i = 0; i < (N - 1)/2/2; i++) {
        if (S[i] != S[(N - 1)/2 - 1 - i]) {
            cout << "No" << endl;
            return 0;
        }
    }
    for (int i = ((N + 3)/2 - 1)/2; i < N; i++) {
        if (S[i] != S[N - 1 - i]) {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}

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

using namespace std;

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

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<char> vc;

int main() {
  int N;
  cin >> N;
  string S,T;
  cin >> S >> T;
  vc ans(N*2);

  rep(i,N) {
    cout << S[i] << T[i];
  }

  cout << endl;

  return 0;
}


Measured memory_bytes: 888
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n)  for (int i = 0; i < (int) (n); i++)
#define REP1(i, n) for (int i = 1; i <= (int) (n); i++)
#define all(x)     (x).begin(), (x).end()
#define SZ(x)      ((int) (x).size())
using ll = long long;
const ll mod = 1e9 + 7;
int main() {
  ll n, k;
  cin >> n >> k;
  ll ans = 0;
  for (ll i = k; i <= n + 1; i++) {
	  ans += i * (n - i + 1) + 1;
	  ans %= mod;
	}
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3640
import java.util.Scanner;

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

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

#include<stdio.h>
#include<algorithm>
#include<iostream>
#include<string.h>
#include<string>
#include<math.h>
#include<vector>

using namespace std;

typedef long long ll;
typedef pair<int,int> pa;

#define fst first 
#define snd second

const int maxn=1500005,maxm=2100;
const double pi=acos(-1.0);
const ll mod=1000000007;

ll dp[maxm][maxm]={0};

int n,m,a[maxn],b[maxn];

int main()
{
	//ios_base::sync_with_stdio(false);
	int i,j;
	scanf("%d %d",&n,&m);
	for(i=0;i<n;i++) scanf("%d",a+i),dp[i][m]=dp[i+1][m]=1;
	for(i=0;i<m;i++) scanf("%d",b+i),dp[n][i]=dp[n][i+1]=1;
	for(i=n-1;i>=0;i--)
	{
		for(j=m-1;j>=0;j--)
		{
			dp[i][j]=(dp[i+1][j]+dp[i][j+1])%mod;
			if(a[i]!=b[j]) dp[i][j]=(dp[i][j]+mod-dp[i+1][j+1])%mod;
		}
	}
	printf("%lld\n",dp[0][0]);
	return 0;
}

Measured memory_bytes: 37248
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <functional>
#include <utility>
#include <fstream>

using namespace std;

#define ll long long
#define INF 2000000000
#define LINF 9000000000000000000
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define du(x) cout<<#x<<'='<<x<<endl
#define du2(x,y) cout<<#x<<'='<<x<<' '<<#y<<'='<<y<<'\n'<<endl
#define du3(x,y,z) cout<<#x<<'='<<x<<' '<<#y<<'='<<y<<' '<<#z<<'='<<z<<'\n'<<endl
#define darr(arr,n) rep(i,(n-arr)){cout<<*(arr+i)<<' ';}cout<<endl
#define ddarr(arr,a,b) rep(i,a){rep(j,b){cout<<*(arr+i*b+j)<<' ';}cout<<endl;}
#define ddd ifstream in("Text.txt");cin.rdbuf(in.rdbuf());


int main() {
    int N;
    cin >> N;
    cout << (N % 2 == 0 ? N : N * 2) << endl;

}

Measured memory_bytes: 384
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <complex>
using namespace std;
#define REP(i,n) for(int i = 0; i < (int)n; i++)
#define FOR(i,a,b) for(int i = a; i < (int)b; i++)
#define pb push_back
#define mp make_pair
typedef vector<int> vi;
typedef pair<int, int> pi;
typedef long long ll;
const ll MOD = 1000000007;
const int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};

const double EPS = 1e-8;
const double INF = 1e12;
typedef complex<double> P;
typedef vector<P> G;

namespace std {
	bool operator < (const P& a, const P& b) {
		return real(a) != real(b) ? real(a) < real(b) : imag(a) < imag(b);
	}
}
double cross(const P& a, const P& b) { return imag(conj(a)*b); }
double dot(const P& a, const P& b) { return real(conj(a)*b); }
struct L : public vector<P> {
	L(const P &a, const P &b) {
		push_back(a); push_back(b);
	}
};
int ccw(P a, P b, P c) {
	b -= a; c -= a;
	if (cross(b, c) > 0) return +1; // counter clockwise
	if (cross(b, c) < 0) return -1; // clockwise
	if (dot(b, c) < 0) return +2; // c--a--b on line
	if (norm(b) < norm(c)) return -2; // a--b--c on line
	return 0;
}
P crosspoint(const L &l, const L &m) {
	double A = cross(l[1] - l[0], m[1] - m[0]);
	double B = cross(l[1] - l[0], l[1] - m[0]);
	if (abs(A) < EPS && abs(B) < EPS) return m[0]; // same line
	return m[0] + B / A * (m[1] - m[0]);
}
#define curr(P, i) P[i]
#define next(P, i) P[(i+1)%P.size()]
G convex_cut(const G& g, const L& l) {
	G Q;
	for (int i = 0; i < g.size(); ++i) {
		P A = curr(g, i), B = next(g, i);
		if (ccw(l[0], l[1], A) != -1) Q.push_back(A);
		if (ccw(l[0], l[1], A)*ccw(l[0], l[1], B) < 0)
			Q.push_back(crosspoint(L(A, B), l));
	}
	return Q;
}
double area2(const G& g) {
	double A = 0;
	for (int i = 0; i < g.size(); ++i) 
		A += cross(curr(g, i), next(g, i));
	return A / 2;
}

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

	int N = 0;
	int a, b, c, d, e, f;
	while(cin >> a >> b >> c >> d >> e >> f, a|b|c|d|e|f) {
		G g;
		g.pb(P(0, 0));
		g.pb(P(10000, 0));
		g.pb(P(10000, 10000));
		g.pb(P(0, 10000));
		P c1((e+a)/2.0, (f+b)/2.0);
		P c2 = P(e-a, f-b) * P(0, 1) + c1;
		g = convex_cut(g, L(c1, c2));
		c1 = P((c+a)/2.0, (d+b)/2.0);
		c2 = P(c-a, d-b) * P(0, 1) + c1;
		g = convex_cut(g, L(c1, c2));
		cout << ++N << ' ' << area2(g) / 1e8 << endl;
	}
	return 0;
}

Measured memory_bytes: 1304
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstring>
#include <cstdlib>
#include <cmath>
using namespace std;
using ll = long long;

int main() {
    int a, b;
    cin >> a >> b;

    cout << (a ^ b) << endl;

    return 0;
}

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

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


  
int main(){
  int h,w;
  cin>>h>>w;
  map<char,int> mp;
  char a;
  REP(i,h){
    REP(j,w){
      cin>>a;
      mp[a]++;
    }
  }
  
  int one,two,four;
  if(h%2==1 && w%2==1){
    one = 1;
    two = (h-1)+(w-1);
    four = h*w -one-two;
  }else if(h%2==1){
    one = 0;
    two = w;
    four = h*w -one-two;
  }else if(w%2==1){
    one = 0;
    two = h;
    four = h*w -one-two;
  }else{
    one = 0;
    two = 0;
    four = h*w;
  }
  
  char ans[h][w];
  for(auto p:mp){
    while(p.second>0){
      if(p.second>=4 && four>0){
        p.second -= 4;
        four -= 4;
      }else if(p.second>=2 && two>0){
        p.second -= 2;
        two -= 2;
      }else if(p.second>=1 && one>0){
        p.second -= 1;
        one -= 1;
      }else{
        break;
      }
    }
  }
  if(one==0 && two==0 && four==0){
    cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <ios> 
#include <vector>
#include <string>
#include <algorithm>
#include <functional>
#include <queue>
#include <stack>
#include <set>
#include <cmath>
#include <bitset>
#include <map>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define sz(c) ((int)(c).size())

using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
//typedef pair<int, int> P;
//typedef pair<int, pair<int, int> > PP;
const int MAX=1e5+10;

int main(){
	int N;
	cin>>N;
	int a[MAX];
	rep(i,N){
		cin>>a[i];
	}
	sort(a, a+N);
	
	bool ans;
	if(a[N-1]-a[0]==0){
		int k=a[0];
		if(k<=N/2 || k==N-1)ans=true;
		else ans=false;
	}
	else if(a[N-1]-a[0]==1){
		int k=a[0];
		int al=0;
		rep(i,N)if(a[i]==k)al++;
		int rm=N-al;
		if(rm>=2 && al+1<=k+1 && k+1<=al+rm/2)ans=true;
		else ans=false;
		
	}
	else ans=false;
	
	if(ans)cout<<"Yes";
	else cout<<"No";
}

Measured memory_bytes: 640
#include<cstdio>
#include<iostream>
#include<vector>
#include<tuple>
#include<queue>
#include<set>
#include<algorithm>
#include<string>
#include<math.h>

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

using namespace std;

int main(int argc, char* argv[]){
  long long int X;
  cin >> X;

  for (long long int i = -1000; i <= 1000; i++){
    for(long long int j = -1000; j <= 1000; j++){
      long long int A = i*i*i*i*i;
      long long int B = j*j*j*j*j;
      if(A-B == X){
        cout << i << " " << j << endl;
        return 0;
      }
    }
  }

  return 0;
}


Measured memory_bytes: 3624
#include <algorithm>
#include <cassert>
#include <climits>
#include <cstdio>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <utility>
#include <vector>

using namespace std;

const int INF = 1e9;
const long long LINF = 1e18;
const double PI=3.14159265358979323846;

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

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

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

    int ans = A[0];
    for (int i = 1; i < N; i++) {
        ans = gcd(ans, A[i]);
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 640
using System;

namespace abc129A
{
    class MainClass
    {
        public static void Main(string[] args)
        {
            string[] str = Console.ReadLine().Split();
            int A = int.Parse(str[0]);
            int B = int.Parse(str[1]);
            int C = int.Parse(str[2]);
            int D = A + B;
            int E = C + B;
            int F = A + C;
            if (D >= E)
            {
                D = E;
            }
            else
            {
                D = D;
            }
            if (D >= F)
            {
                D = F;
            }
            else
            {
                D = D;
            }
            Console.WriteLine(D);
        }
    }
}


Measured memory_bytes: 13140
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define erep(i,a,b) for(int i=a;i<=(int)(b);++i)
#define per(i,a,b) for(int i=(a);i>(b);--i)
#define eper(i,a,b) for(int i=(a);i>=b;--i)
#define fore(x, a) for(auto &x : a)
#define pb push_back
#define mp make_pair
#define INF 100100100100
#define inf 2001001001
#define MOD 1000000007
#define ALL(x) begin(x),end(x)
using namespace std;
using ll = long long;
using pii = pair<int,int>;
using vii = vector<int>;
using vll = vector<ll>;
template<class T>using vv = vector<T>;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
template<class T>void show(const vector<T> &a) { for (int i = 0; i < (int)a.size(); ++i) cout << a[i] << (i != (int)a.size()-1 ? " " : "\n"); }
template<class T>T gcd(T a, T b){ return b ? gcd(b, a % b) : a; }
template<class T>T lcm(T a, T b){ return a / gcd(a, b) * b; }
int dy[]={0, 1, -1, 0};
int dx[]={1, 0, 0, -1};

string s;
int ans = 0;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
    cin >> s;
    int g = 0, p = 0;
    rep(i, 0, s.size()) {
      if (g <= p) {
        g++;
        if (s[i] == 'p') ans--; 
      } else {
        p++;
        if (s[i] == 'g') ans++;
      }
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 512
#pragma region Macros
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i, n) for(int i=(n); i>=0; --i)
#define FOR(i, n, m) for(int i=(m), i##_len=(n); i<i##_len; ++i)
#define EACH(i, v) for(const auto& i : v)
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template<class Value>using vec = vector< Value >;
using ll = long long;
using P = pair< long long, long long >;
#define fi first
#define se second
#define el endl
#pragma endregion
void Main();

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

bool f(string& S, int n){
    bool ret = true;
    REP(i, n){
        if(S[i] != S[i+n]){
            ret = false;break;
        }
    }
    return ret;
}

void Main(){
    vec<int> cnt(10);//8~
    int N;
    cin >> N;
    REP(i, N){
        int a;
        cin >> a;
        if(a<3200){
            cnt[a/400]++;
        }else{
            cnt[8]++;
        }
    }
    int ans = 0;
    REP(i, 8){
        if(cnt[i]!=0){
            ans++;
        }
    }
    if(ans == 0){
        ans++;cnt[8]--;
    }
    cout << ans << " " << ans+cnt[8] << el;
}



Measured memory_bytes: 3548
function Main(input) {

	// 1行目がinput[0], 2行目がinput[1], …に入る
	input = input.split("\n");
    
    let N = parseInt(input[0].split(" ")[0]);
    
    input.shift();
    let a = new Set(input.map(Number)); //NG段
    let cost = Array(N + 1).fill(0n);
    cost[0] = 1n;
    cost[1] = a.has(1) ? 0n : 1n; //cost[i] -> i段目まで登る移動方法
    
    for (let i = 2; i < N + 1; i++) {
        
        if (!a.has(i)) {
        	cost[i] += cost[i - 1];
       		cost[i] += cost[i - 2];
        }
        
    }
    
    console.log(String(cost[N] % 1000000007n));
    
}
    
function chkmin(a, b){
    
    if (a > b) return b;
    else return a;
    
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 493252
#include<iostream>
#include<cstdio>
#include <queue>
#include<cmath>
#include <cstdlib>
#include <algorithm>
#include<vector>
#include<sstream>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
int dx[] = {-1,1,0,0};
int dy[] = {0,0,-1,1};
struct P{
	int x,y;
	P(int a,int b){x = a, y = b;}
	P(){};
};
bool operator<(const P &a,const P &b){
	if(a.x == b.x)return a.y < b.y;
	return a.x < b.x;
}
P get(string to){
	rep(i,to.size())if(to[i] == '-')to[i] = ' ';
	stringstream ss(to);
	pair<int,int> ret;
	char a;int b;
	ss >> a >> b;
	return P(b-1,a-'a');
}
struct NODE{
	P cur,prev;
	int cost;
	NODE(P C,P p,int c){cur = C, prev = p,cost = c;}
	NODE(){}
};
bool operator<(const NODE &a,const NODE &b){
	return a.cost > b.cost;
}
int w,h,d;
int correct(int x,int y){
	return x >= 0 && y >= 0 && y < h && x < w;
}
int main(){
	while(cin >> h >> w , h && w){
		cin >> d;
		int data[101][20][20];
		
		rep(i,101)rep(j,20)rep(k,20)data[i][j][k] = -1;

		vector< pair<P,P> > stop;
		int add[20][20][20][20] = {0};
		int ns; cin >> ns;
		rep(i,ns){
			int c;
			string t;cin >> t >> c;
			P p = get(t);
			rep(j,101){
				data[j][p.y][p.x] = (j/c)%2; //ayasii
			}
		}
		int nc; cin >> nc;
		rep(i,nc){
			string a,b;cin >> a >> b;
			stop.push_back(make_pair(get(a),get(b)));
			stop.push_back(make_pair(get(b),get(a)));
		}
		sort(stop.begin(),stop.end());
		int nj;cin >> nj;
		rep(i,nj){
			string a,b;int c;cin >> a >> b >> c;
			P A = get(a) , B = get(b);
			add[A.y][A.x][B.y][B.x] = add[B.y][B.x][A.y][A.x] = c;
		}
		bool memo[101][20][20] = {0};
		string S,G; cin >> S >> G;
		P start = get(S) , goal = get(G);
		priority_queue<NODE> Q;
		Q.push(NODE(start,P(start.x-1,start.y),0));
		while(Q.size()){
			NODE q = Q.top(); Q.pop();
			//usleep(30000);
			if(memo[q.cost][q.cur.y][q.cur.x])continue;
			else memo[q.cost][q.cur.y][q.cur.x] = true;
			
			if(q.cur.x == goal.x && q.cur.y == goal.y){
				cout << q.cost << endl;
				break;
			}
			rep(i,4){
				int dir = i/2;
				P nextP = P(q.cur.x+dx[i],q.cur.y+dy[i]);
				int nextCost = q.cost + add[q.cur.y][q.cur.x][nextP.y][nextP.x] + d;
				if(
					nextCost > 100 || 
					!correct(nextP.x,nextP.y) || 
					binary_search(stop.begin(),stop.end(),make_pair(q.cur,nextP)) || 
					(nextP.x == q.prev.x && nextP.y == q.prev.y) || 
					(data[nextCost][nextP.y][nextP.x] != -1 && data[nextCost][nextP.y][nextP.x] == dir)
				){
					continue;
				}
				Q.push( NODE(nextP,q.cur,nextCost) );
			}
		}
	}
}

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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
//const ull mod = 1e9 + 7;
const ll mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

// debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

template<class S, class T> ostream& operator << (ostream& os, const pair<S, T> v){
  os << "(" << v.first << ", " << v.second << ")"; return os;
}
template<class T> ostream& operator << (ostream& os, const vector<T> v){
  for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << " ";} os << v[i];} return os;
}
template<class T> ostream& operator << (ostream& os, const vector<vector<T>> v){
  for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << endl;} os << v[i];} return os;
}
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

// conversion number to bit
string num2bit(ll num, ll len){
  string bit = "";
  REP(i, len){
    bit += char('0'+(num>>i & 1));
  }
  return bit;
}

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

    vector<ll> x(4);
    REP(i, 4) cin >> x[i];
    ll N;
    cin >> N;

    ll A = min(x[0]*4, min(x[1]*2, x[2]));
    ll B = x[3];

    cout << min(N*A, (N/2)*B+(N%2)*A) << endl;
    return 0;
}

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

using namespace std ;

#define sz(v) (int)v.size()
#define ll long long
#define all(v)  v.begin() , v.end()
#define rall(v)  v.rbegin() , v.rend()
#define pf push_front
#define pb push_back
#define fast FastInputOutput() ;
#define Clear( container , value ) memset( container , value , sizeof container )
#define PI acos( -1.0 )
#define forn( t , v , be , n ) for( t v = be ; v < n ; v++ )
#define fore( x , j ) for( auto x : j )
#define se second
#define fr first
//#define c_b fflush(stdin);
#define debug(x , y) cerr << #x << " = " << x << y ;

const ll Long_max = numeric_limits < ll > :: max() ;
const int Int_max = numeric_limits < int > :: max() ;

void File_input( string pathIn ) {
    freopen( pathIn.c_str(), "r", stdin ) ;
}

void File_output( string pathOut ) {
    freopen( pathOut.c_str(), "w", stdout ) ;
}

int msg() {
    srand( time( 0 ) ) ;
    vector < string > st = {
        "Wish everyone high ratings!",
        "Good luck!",
        "Have fun!",
        "Please, read all the problems!",
        "Go Go fight!"
    } ;
    cerr << st[ rand() % sz( st ) ] ;
    return 0 ;
}

void FastInputOutput() {
    ios_base :: sync_with_stdio( 0 ) ;
    cin.tie( 0 ) ;
    cout.tie( 0 ) ;
}

int a , b ;

int main(){
 cin >> a >> b ;
 cout << max( a + b , max( a * b , a - b ) ) ;
 return 0 ;
}

/*
A B C D
try to solve A , B in 30 min as possible
If their is subtask try to solve the second one first if the constraints are only differ
Read all Problem so you could find an ex that you can solve fast
A -- don't write big code focus again
B -- greedy , math , bit mask , tricks , DP
C -- solve A , B first then solve C but fast as possible
greedy
DP
binary search
DFS , BFS , DSU( detect a cycle , make sets )
bit mask
number theory , math
meet in the middle
focus on the problem and constraints.
*/


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

int main(void){
    int N,M;
    cin >> N >> M;
    if(N==1&&M==0){
        printf("0");
        return 0;        
    }
    
    if(N==1&&M==1){
        int a,b;
        cin >> a >> b;
        printf("%d",b);
        return 0;        
    }
    //Mは条件数
    int a,b;
    int ans[N];
    for(int i=0;i<N;i++){
        ans[i]=99;
    }
    
    for(int i=0;i<M;i++){
        cin >> a >> b;
        if(ans[a-1]==99){
            ans[a-1] = b;
        }
        else if(ans[a-1]==b){
        }
        else{
             printf("-1");
             return 0;
        }
    }
    //最大の桁が99なら1,0なら条件はずれ
    if(ans[0]==99){
        ans[0]=1;
    }
    else if(ans[0]==0){
        printf("-1");
        return 0;
    }
    
    //仮の数字をもどす
    for(int i=0;i<N;i++){
        if(ans[i]==99){
            ans[i]=0;
        }
    }
    
    if(N==1 && ans[0]==0){
        printf("0");
        return 0;
    }
    

    for(int i=0;i<N;i++){
        printf("%d",ans[i]);
    }
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
	
		int total = 0;

		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int M = sc.nextInt();
		int C = sc.nextInt();
		int A = 0;
		int Bs[] = new int[M];
		int count = 0;
		for (int i = 0; i < M; i++) {
			Bs[i] = sc.nextInt();
		}

		for (int i = 0; i < N; i++) {
			for (int j = 0; j < M; j++) {
				A = sc.nextInt();
				total += A * Bs[j];

			}
			total += C;
			if (total > 0) {
				count++;
			}
			total = 0;
		}
		
		System.out.println(count);

	}

}


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

using namespace std;

int main() {
    int a,b,c;

    cin >> a >> b >> c;

    vector<int> v;
    v.push_back(a);
    v.push_back(b);
    v.push_back(c);
    sort(v.begin(), v.end());

    cout << v[0] << " " << v[1] << " " << v[2] << endl;

    return 0;
}

Measured memory_bytes: 1220
N = int(input())
C = 10 ** 9 + 7
B = 0
a = 0
ans = 0
A = list(map(int, input().split()))
for i in range(N):
    a += A[i]
for i in range(N-1):
    a -= A[i]
    B = A[i] * a
    ans += B
    B = 0    
print(ans % C)        



Measured memory_bytes: 31440
//abc107_c.cpp
//Sat Aug 25 20:19:36 2018

#include <iostream>
#include <string>
#include <queue>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <math.h>
#define INTINF 2147483647
#define LLINF 9223372036854775807
using namespace std;
using ll=long long;
typedef pair<int,int> P;

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


	int firstminus = -1;
	int zero = -1;
	int firstplus = -1;
	int plusnum = 0;
	int minusnum = 0;
	int x[n];
	int flag = 0;
	for (int i=0;i<n;i++){
		cin >> x[i];
		if (x[i]<0){
			firstminus = i;
			minusnum++;
		}else if (x[i] == 0){
			zero = i;
			k--;
		}else if (x[i]>0 && flag == 0){
			firstplus = i;
			flag = 1;
			plusnum++;
		}else {
			plusnum++;
		}
	}

	int distance = INTINF;

	if (plusnum == 0 && minusnum == 0){
		distance = 0; 
	}else if (minusnum == 0){
		distance = abs(x[firstplus+k-1]);
	}else if (plusnum == 0){
		distance = abs(x[firstminus-k+1]);
	}else{
		for (int i=1;i<k;i++){
			if (plusnum < i || minusnum < k-i){
				continue;
			}else {
				int plusdis = x[firstplus+i-1];
				int minusdis = abs(x[firstminus-k+i+1]);
				int tempdis = 0;
				if (plusdis > minusdis){
					tempdis = minusdis*2+plusdis;
				}else {
					tempdis = plusdis*2+minusdis;
				}
				if (tempdis < distance) {
					distance = tempdis;
				}
//				cout << i << " " << plusdis << " " << minusdis << " " <<tempdis << endl;
			}
		}
	}
//	cout << plusnum << " " << minusnum << endl;

	cout << distance << endl;
}

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

int main() {
	int a, b, c;
	cin >> a >> b >> c;
	if (a >= 0 && a <= 100 && b >= 0 && b <= 100 && c >= 0 && c <= 100) {
		if (a < b && b < c) {
			cout << "Yes" << endl;
		}
		else {
			cout << "No" << endl;
		}
	}
	else {
		cout << "error" << endl;
	}
}


Measured memory_bytes: 3096
import java.util.Scanner;

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

Measured memory_bytes: 21204