akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define IOS ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep1(i,n) for(ll i=1;i<=n;i++)
#define rep_start(a,i,n) for(ll i=a;i<=n;i++)
#define rev(i,n) for(ll i=n-1;i>=0;i--)
#define rev1(i,n) for(ll i=n;i>0;i--)
#define sz(a) int((a).size())
#define all(c) c.begin(),c.end()
#define tr(c,i) for(typeof(c).begin() i+=c.begin; i!=c.end(); i++)
#define present(c,x) (c.find(x)!=c.end())
#define cpresent(c,x) (find(all(c),x)!=c.end())
#define pb push_back
#define F first
#define S second
#define INF INT_MAX
#define mod 1000000007
#define print1(a) cout<<a<<"\n";
#define print2(a,b) cout<<a<<" "<<b<<"\n";
#define print3(a,b,c) cout<<a<<" "<<b<<" "<<c<<"\n";
#define mt make_tuple
#define eb emplace_back

typedef unsigned long long int ll;
typedef vector<ll> vi;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<vi> vvi;
typedef pair<ll,ll> ii;
typedef vector<ii> vii;
typedef tuple<int,int,int> State;

void solve(){
    string s;cin>>s;
    if(s=="ABC") cout<<"ARC";
    else cout<<"ABC";
}

signed main() {
    // your code goes here
    IOS
    ll t=1;
    //cin>>t;
    rep1(i,t){
        solve(); 
    }
    return 0;
}

Measured memory_bytes: 3592
import sys
INF = 1 << 60
MOD = 10**9 + 7 # 998244353
sys.setrecursionlimit(2147483647)
input = lambda:sys.stdin.readline().rstrip()
def resolve():
    a, b = map(int, input().split())
    print((a + b + 1) // 2)
resolve()

Measured memory_bytes: 61736
import java.util.Scanner;
import java.util.List;
import java.util.ArrayList;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();  // input Integer
//    String a = sc.next();  // input String
    int d=0;
    for (int i=1; i<=4; i++){
      d=sc.nextInt();
    }
    int k=sc.nextInt();
    if (d-a>k){
      System.out.println(":(");
    } else {
      System.out.println("Yay!");
    }
  }
}


Measured memory_bytes: 21844
m = int(input())

if 400<= m <=599:
  print(8)
elif 600<= m <= 799:
  print(7)
elif 800<= m <= 999:
  print(6)
elif 1000 <= m <= 1199:
  print(5)
elif 1200 <= m <= 1399:
  print(4)
elif 1400 <= m <= 1599:
  print(3)
elif 1600 <= m <= 1799:
  print(2)
else:
  print(1)

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

using ll = long long;

int main(){
    int k;
    cin >> k;
    vector<ll> a;
    rep(i,9) a.push_back(i+1);
    while(1){
        if(a.size() >= k){
            cout << a[k-1] << endl;
            return 0;
        }else{
            k -= a.size();
        }
        vector<ll> prev;
        swap(prev,a);
        for(ll x : prev){
            for(int d = -1; d <= 1; d++){
                int nx = x%10 + d;
                if(nx < 0 || 9 < nx) continue;
                a.push_back(10*x + nx);
            }
        }
    }
}

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

int main(){
  int n,ans=0;
  cin >> n;
  vector<int> l(n);
  for(int i=0; i<n; i++){
    cin >> l[i];
    ans+=l[i];
  }
  sort(l.begin(), l.end());
  if(2*l[n-1]<ans){
    cout << "Yes";
  }else{
    cout << "No";
  }
  
}

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

typedef long long ll;
typedef unsigned long long ull;

#define pb push_back
#define mp(x,y) make_pair(x,y)
#define scd(n) scanf("%d",&n)
#define sclf(n) scanf("%lf",&n)
#define scl(n) scanf("%I64d",&n)
#define repi(a,b,c) for(int i=a;i<b;i+=c)
#define repis(a,b,c) for(int i=a-1;i>=b;i-=c)
#define repj(a,b,c) for(int j=a;j<b;j+=c)
#define repjs(a,b,c) for(int j=a-1;j>=b;j-=c)
#define repk(a,b,c) for(int k=a;k<b;k+=c)
#define repks(a,b,c) for(int k=a-1;k>=0;k-=c)
#define fi first
#define se second

/*
 fast I/O

ios_base::sync_with_stdio(false);
cin.tie(NULL);

 freeopen

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

typedef pair<ll,ll> ii;
const int mx = 200100;
const int md = 1000000007;
const double EULER = 2.71828182845904523536;

int n,arr[4][100100];
ll visit[4][100100] = {};

int bs(int x,int p)  {
    int a=0,b=n-1,mid;
    while(a < b) {
        mid = (a+b)/2;
        if(arr[p][mid] <= x) a = mid+1;
        else b = mid;
    }
    if(arr[p][a] <= x) return -1;
    return a;
}

int main () {
    ll ans = 0;
    int temp;
    scd(n);
    repi(0,3,1) {
        repj(0,n,1) scd(arr[i][j]);
        sort(arr[i],arr[i]+n);
    }

    // middle and bottom
    repis(n,0,1) {
        temp = bs(arr[1][i],2);
        if(temp != -1) visit[1][i] = n-temp;
        visit[1][i] += visit[1][i+1];
    }
    // top and middle
    repi(0,n,1) {
        temp = bs(arr[0][i],1);
        if(temp != -1) ans += visit[1][temp];
    }
    cout << ans << endl;
}


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

int n, q;
vector<int> edge[200000];
int64_t res[200000];

void dfs(int i, int p){
    for (int j : edge[i]) if (j != p){
        res[j] += res[i];
        dfs(j, i);
    }
}

int main(){
    cin >> n >> q;
    for (int i = 0; i < n-1; i++){
        int a, b;
        cin >> a >> b;
        --a, --b;
        edge[a].push_back(b);
        edge[b].push_back(a);
    }
    for (int i = 0; i < q; i++){
        int p, x;
        cin >> p >> x;
        --p;
        res[p] += x;
    }
    dfs(0, -1);
    for(int i = 0; i < n; i++) cout << res[i] << " ";
    cout << endl;
}

Measured memory_bytes: 24320
#pragma GCC optimize("Ofast")
#pragma GCC optimize("inline")
#pragma GCC optimize("-fgcse")
#pragma GCC optimize("-fgcse-lm")
#pragma GCC optimize("-fipa-sra")
#pragma GCC optimize("-ftree-pre")
#pragma GCC optimize("-ftree-vrp")
#pragma GCC optimize("-fpeephole2")
#pragma GCC optimize("-ffast-math")
#pragma GCC optimize("-fsched-spec")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("-falign-jumps")
#pragma GCC optimize("-falign-loops")
#pragma GCC optimize("-falign-labels")
#pragma GCC optimize("-fdevirtualize")
#pragma GCC optimize("-fcaller-saves")
#pragma GCC optimize("-fcrossjumping")
#pragma GCC optimize("-fthread-jumps")
#pragma GCC optimize("-funroll-loops")
#pragma GCC optimize("-fwhole-program")
#pragma GCC optimize("-freorder-blocks")
#pragma GCC optimize("-fschedule-insns")
#pragma GCC optimize("inline-functions")
#pragma GCC optimize("-ftree-tail-merge")
#pragma GCC optimize("-fschedule-insns2")
#pragma GCC optimize("-fstrict-aliasing")
#pragma GCC optimize("-fstrict-overflow")
#pragma GCC optimize("-falign-functions")
#pragma GCC optimize("-fcse-skip-blocks")
#pragma GCC optimize("-fcse-follow-jumps")
#pragma GCC optimize("-fsched-interblock")
#pragma GCC optimize("-fpartial-inlining")
#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("-freorder-functions")
#pragma GCC optimize("-findirect-inlining")
#pragma GCC optimize("-fhoist-adjacent-loads")
#pragma GCC optimize("-frerun-cse-after-loop")
#pragma GCC optimize("inline-small-functions")
#pragma GCC optimize("-finline-small-functions")
#pragma GCC optimize("-ftree-switch-conversion")
#pragma GCC optimize("-foptimize-sibling-calls")
#pragma GCC optimize("-fexpensive-optimizations")
#pragma GCC optimize("-funsafe-loop-optimizations")
#pragma GCC optimize("inline-functions-called-once")
#pragma GCC optimize("-fdelete-null-pointer-checks")
#pragma GCC optimize(2)
#include<cstdio>
#include<algorithm>
#include<cmath>
using namespace std;
int main()
{
    int n,k;
    int ans=1;
    scanf("%d%d",&n,&k);
    for(int i=1;i<=n;i++)
    {
        ans+=min(ans,k);
    }
    printf("%d",ans);
    return 0;
}

Measured memory_bytes: 256
N = int(input())
ans = [0,0,0,0]
for i in range(N):
    s = input()
    if s == "AC":
        ans[0] += 1
    elif s == "WA":
        ans[1] += 1
    elif s == "TLE":
        ans[2] += 1
    else:
        ans[3] += 1
print("AC x",end = " ")
print(ans[0])
print("WA x",end = " ")
print(ans[1])
print("TLE x",end = " ")
print(ans[2])
print("RE x",end = " ")
print(ans[3])

Measured memory_bytes: 9216
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
#define _ << " " <<
#define all(v) v.begin(), v.end()
#define sp(n) fixed << setprecision(n)

using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;


int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int n;
	cin >> n;
	vector<int> p(n);
	for (int& i : p) cin >> i;
	int ans = 0;
	for (int i = 1; i < n - 1; i++) {
		if ((p[i] > p[i - 1] && p[i] < p[i + 1]) || (p[i] < p[i - 1] && p[i] > p[i + 1])) ans++;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)a;i<(int)b;++i)
int main(){
    string s,t;cin>>s>>t;
    cout<<t<<s<<endl;
    return 0;
}

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

int main() {
  
  string S; cin >> S; int ans = 1000;
  
  for (int i = 0; i < S.size() - 2; i++) {
    string tmp = S.substr(i, 3);
    int dif = abs(753 - stoi(tmp));
    ans = min(ans, dif);
  }
  
  cout << ans << endl;
  
}

Measured memory_bytes: 256
#[allow(unused_imports)]
use std::cmp;

// Input macro from https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
  (source = $s:expr, $($r:tt)*) => {
    let mut iter = $s.split_whitespace();
    input_inner!{iter, $($r)*}
  };
  ($($r:tt)*) => {
    #[allow(unused_mut)]
    let mut s = {
      use std::io::Read;
      let mut s = String::new();
      std::io::stdin().read_to_string(&mut s).unwrap();
      s
    };
    let mut iter = s.split_whitespace();
    input_inner!{iter, $($r)*}
  };
}

macro_rules! input_inner {
  ($iter:expr) => {};
  ($iter:expr, ) => {};

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

macro_rules! read_value {
  ($iter:expr, ( $($t:tt),* )) => {
    ( $(read_value!($iter, $t)),* )
  };

  ($iter:expr, [ $t:tt ; $len:expr ]) => {
    (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
  };

  ($iter:expr, chars) => {
    read_value!($iter, String).chars().collect::<Vec<char>>()
  };

  ($iter:expr, usize1) => {
    read_value!($iter, usize) - 1
  };

  ($iter:expr, $t:ty) => {
    $iter.next().unwrap().parse::<$t>().expect("Parse error")
  };
}

fn main() {
  input! {
    h: usize,
    w: usize,
    fld: [chars; h],
  }
  let mut right = vec![vec![0i32; w+2]; h+2];
  let mut left = vec![vec![0i32; w+2]; h+2];
  let mut up = vec![vec![0i32; w+2]; h+2];
  let mut down = vec![vec![0i32; w+2]; h+2];
  for i in 0 .. h {
    for j in 0 .. w {
      if fld[i][j] == '.' {
        left[i+1][j+1] = left[i+1][j] + 1;
        up[i+1][j+1] = up[i][j+1] + 1;
      }
    }
  }
  for i in (0 .. h).rev() {
    for j in (0 .. w).rev() {
      if fld[i][j] == '.' {
        right[i+1][j+1] = right[i+1][j+2] + 1;
        down[i+1][j+1] = down[i+2][j+1] + 1;
      }
    }
  }
  let mut ans = - (1 << 30);
  for i in 1 .. h+1 {
    for j in 1 .. w+1 {
      ans = cmp::max(ans, left[i][j] + right[i][j] + up[i][j] + down[i][j] - 3);
    }
  }

  println!("{}", ans);
}


Measured memory_bytes: 90360
//#pragma GCC optimize ("Ofast")
//#pragma GCC optimize ("unroll-loops")
//#pragma GCC target("avx,avx2,fma")

#include <bits/stdc++.h>
#include<ext/pb_ds/tree_policy.hpp>
#include<ext/pb_ds/assoc_container.hpp>

#define ios ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define file(s) if (fopen(s".in", "r")) freopen(s".in", "r", stdin), freopen(s".out", "w", stdout)
#define all(a) a.begin() , a.end()
#define fi first
#define se second

using namespace std;
using ll = long long;
using namespace __gnu_pbds;


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

const int N = 3e5 + 10 , inf = 2e9 + 7;
const ll INF = 1e18 , mod = 1e9+7;

void solve() {
    int x;
    cin >> x;
    if(x < 600) {
        cout << 8;
    }
    else if(x < 800) {
        cout << 7;
    }
    else if(x < 1000) {
        cout << 6;
    }
    else if(x < 1200) {
        cout << 5;
    }
    else if(x < 1400) {
        cout << 4;
    }
    else if(x < 1600) {
        cout << 3;
    }
    else if(x < 1800) {
        cout << 2;
    }
    else if(x < 2000) {
        cout << 1;
    }
}
/*
*/
main() {
    ios;
    int tt = 1;
   // cin >> tt;
    while(tt --) {
        solve();
    }
    return 0;
}


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

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); i++) 
#define ll long long
#define ld long double
#define repl(i, n) for (ll i = 0; i < (ll)(n); i++)  
#define outdeb(fir, sec, thr) cout << fir << ":" << sec << ":" << thr << endl
#define DEV_VAL (1000000000 + 7)

int main()
{
  ll n;
  cin >> n;
  map<ll, ll, greater<ll>> data;

  repl(i, n)
  {
    ll tmp;
    cin >> tmp;
    data[tmp] = data[tmp]+1;
  }
  
  ll ans = 0;
  ll comer = n;
  ll upperNum = 0;
  for(auto iter = data.begin(); iter != data.end(); ++iter)
  {
    auto target = *iter;
    if(comer == n)
    {
      if(comer <= 2 * target.second)
      {
        ans = target.first * (comer - 1);
        break;
      }
      else if(target.second == 1)
      {
        comer -= 2;
        ans = target.first;
        upperNum += 1;
      }
      else
      {
        comer -= (2 * target.second);
        ans = target.first * (2 * target.second - 1);
        upperNum = target.second;
      }
    }
    else
    {
      ll vanum = 2 * target.second;
      if(upperNum < target.second)
      {
        vanum -= (target.second - upperNum);
      }
      if(vanum >= comer)
      {
        ans += target.first * comer;
        break;
      }
      else
      {
        ans += target.first * vanum;
        upperNum += target.first;
        comer -= vanum;
      }
    }

  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 16112
'use strict'
function main(input) {
  input = input.trim().split(' ');
  const birth = Number(input[0]);
  const price = birth > 5
    ? birth <=12
      ? Number(input[1]) / 2
      : Number(input[1])
    : 0
  console.log(price)
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));


Measured memory_bytes: 15304
/**
 * Author: Behradm
 * Created: 11-05-2020 12:06:42
 * In the Name of God
**/
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef vector<int> vi;

#define F first
#define S second
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define LOCAL

#ifdef LOCAL
	#define debugi(x) cerr << "{" << #x << "}: " << (x) << '\n'
	#define debug(v, begin, end) cerr << "{ | "; for(auto i = begin; i < end; i++){cerr << #v << "[" << i << "]: " << v[i] << " | ";} cerr << " }\n"
	#define debugp(a, b) cerr << "\n{ " << a << " " << b << " }\n"
#else
	#define debugi(x) 42
	#define debug(v, begin, end) 42
	#define debugp(a, b) 42 
#endif

int32_t main()
{
	ios_base::sync_with_stdio(false); cin.tie(0);
	cout.tie(0);
	cout.precision(6);
	int n, m, x;
	cin >> n >> m >> x;
	vector<vector<int>> a(n, vector<int>(m + 1));
	for (int i = 0; i < n; i++) {
		cin >> a[i][0];
		for (int j = 1; j <= m; j++)
			cin >> a[i][j];
	}

	long long res = -1;
	for (int i = 0; i < (1 << n); i++){
		vector<int> al(m, 0);
		long long s = 0LL;
		for (int j = 0; j < n; j++) {
			if (i & (1 << j)){
				for (int k = 0; k < m; k++)
					al[k] += a[j][k + 1];
				s += a[j][0];
			}
		}

		bool bad = false;
		for (int j = 0; j < m; j++) {
			if (al[j] < x){
				bad = true;
				break;
			}
		}

		if (!bad) {
			if (res == -1)
				res = s;
			else
				res = min(res, s);
		}
	}

	cout << res << '\n';
	return 0;
}



Measured memory_bytes: 3668
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
//namespace mp = boost::multiprecision;

using namespace std;

const double PI = 3.14159265358979323846;
typedef long long ll;
const double EPS = 1e-9;
#define rep(i, n) for (int i = 0; i < (n); ++i)
//#define rep(i, n) for (ll i = 0; i < (n); ++i)
typedef pair<ll, ll> P;
const ll INF = 10e17;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
#define ret() return 0;

double equal(double a, double b) {
    return fabs(a - b) < DBL_EPSILON;
}

std::istream &operator>>(std::istream &in, set<int> &o) {
    int a;
    in >> a;
    o.insert(a);
    return in;
}

std::istream &operator>>(std::istream &in, queue<int> &o) {
    ll a;
    in >> a;
    o.push(a);
    return in;
}

bool contain(set<int> &s, int a) { return s.find(a) != s.end(); }

//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);
//const ll mod = 1e10;

typedef priority_queue<ll, vector<ll>, greater<ll> > PQ_ASK;

int main() {
    int n;
    cin >> n;
    vector<ll> members(n);
    rep(i, n) cin >> members[i];

    sort(members.rbegin(), members.rend());
    priority_queue<ll> q;

    ll ans = members[0];
    q.push(members[1]);
    q.push(members[1]);

    for (int i = 2; i < n; i++) {
        ans += q.top();
        q.pop();
        q.push(members[i]);
        q.push(members[i]);
    }
    cout << ans << endl;
}


Measured memory_bytes: 6908
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define LOOP(i,x,n) for(int i=x;i<n;i++)
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define MP make_pair
#define FIR first
#define SEC second
#define int long long
using namespace std;
const int MOD=1000000007;
const int INF=1000000009;
typedef string::const_iterator State;
class ParseError{};

int factor(State &);

void consume(State &begin,char expected){
  if(*begin==expected){
    begin++;
  }else{
    cerr<<"Expected '"<<expected<<"'but got '"<<*begin<<"''"<<endl;
    cerr<<"Rest string is '";
    while(*begin){
      cerr<<*begin++;
    }
    cerr<<"'"<<endl;
    throw ParseError();
  }
}

int number(State &begin){
  int ret=0;
  while(isdigit(*begin)){
    ret*=10;
    ret+=*begin-'0';
    begin++;
  }
  return ret;
}

int term(State &begin){
  int ret=factor(begin);
  for(;;){
    if(*begin=='*'){
      begin++;
      ret*=factor(begin);
    }else if(*begin=='/'){
      begin++;
      ret/=factor(begin);
    }else{
      break;
    }
  }
  return ret;
}

int expr(State &begin){
  int ret=term(begin);
  for(;;){
    if(*begin=='+'){
      begin++;
      ret+=term(begin);
    }else if(*begin=='-'){
      begin++;
      ret-=term(begin);
    }else{
      break;
    }
  }
  return ret;
}
int factor(State &begin){
  if(*begin=='('){
    begin++;
    int ret=expr(begin);
    begin++;
    return ret;
  }else{
    return number(begin);
  }
}

signed main(){
  int n;
  cin>>n;
  cin.ignore();
  REP(i,n){
    string s;
    getline(cin,s);
    State begin=s.begin();
    int ans=expr(begin);
    cout<<ans<<endl;
  }
  return 0;
}

Measured memory_bytes: 3140
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <queue>
#include <cstring>
#include <vector>
#include <map>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <bitset>
#include <set>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)
#define all(i,n) (i),(i+n)

int dx4[4]={1,0,-1,0};
int dy4[4]={0,-1,0,1};
int dx8[8]={1,0,-1,1,-1,1,0,-1};
int dy8[8]={1,1,1,0,0,-1,-1,-1};

typedef pair<int, int> P;
typedef pair<string, int> SP;
typedef long long ll;
typedef pair<ll, ll> PLL;

const int INF = 1e9;
const ll LLINF = 1e18;
const int MAX_V = 1e6+1;
const ll mod = 1000000007;

// --------------------------------------
ll k, n;
ll a[300000];
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  cin >> k >> n;

  ll ma = 0;
  ll s = 0;
  REP(i, n) {
    cin >> a[i];
    ma = max(a[i] - s, ma);
    s = a[i];
  }

  ma = max(a[0] + k - a[n - 1], ma);
  cout << (k - ma) << endl;
}


Measured memory_bytes: 1792
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip> 
#include <complex> 
#include <string>
#include <vector> 
#include <list>
#include <deque> 
#include <stack> 
#include <queue> 
#include <set>
#include <map>
#include <bitset>
#include <functional>
#include <utility>
#include <algorithm> 
#include <numeric> 
#include <typeinfo> 
#include <cstdio>
#include <cstdlib> 
#include <cstring>
#include <cmath>
#include <climits> 
#include <ctime>
using namespace std;

int n;
int a[3][301];
int cnt[301];
int check[301];
int main(void){
	scanf("%d",&n);
	for(int i=0;i<n;i++)scanf("%d%d%d",&a[0][i],&a[1][i],&a[2][i]);
	for(int i=0;i<3;i++){
		memset(check,0,sizeof(check));
		for(int j=0;j<n;j++){
			check[a[i][j]]++;
		}
		for(int j=0;j<n;j++){
			if(check[a[i][j]]==1)cnt[j]+=a[i][j];
		}
	}
	for(int i=0;i<n;i++)printf("%d\n",cnt[i]);
	return 0;
}

Measured memory_bytes: 1192
#include<stdio.h>
int main()
{
	int a, b, c;
	for (;;)
	{
		scanf("%d %d", &a, &b);
		if (a == 0 && b == 0) break;
		else if (a > b)
		{
			c = a;
			a = b;
			b = c;
		}
		printf("%d %d\n", a, b);
	}
	return 0;
}


Measured memory_bytes: 2572
#include <iostream>
#include <string>
#include <stack>

using std::cin;
using std::cout;
using std::endl;

int main(void) {
	std::string str;
	getline(cin, str);

	while (str[0] != '.' && str.length() != 0) {
		std::stack<int> check;
		bool much = true;
		for (int i = 0; i < str.length()+1; i++) {
			if (much) {
				if (str[i] == '(') {
					check.push(1);
				}
				if (str[i] == ')') {
					if (check.empty()) {
						much = false;
					} else {
						if (check.top()!=1) {
							much = false;
						}
						check.pop();
					}
				}
				if (str[i] == '[') {
					check.push(2);
				}
				if (str[i] == ']') {
					if (check.empty()) {
						much = false;
					} else {
						if (check.top()!=2) {
							much = false;
						}
						check.pop();
					}
				}
			}
		}
		if (much && check.empty()) {
			cout << "yes" << endl;
		} else {
			cout << "no" << endl;
		}
		getline(cin, str);
	}

	return 0;
}

Measured memory_bytes: 3212
# -*- coding: utf-8 -*-

N = int(input())

A = [1]
i = 1
while 6 ** i <= 100000:
    A.append(6 ** i)
    i += 1
j = 1
while 9 ** j <= 100000:
    A.append(9 ** j)
    j += 1
A.sort()  # 引き出せる金額のリスト

# i円を引き出す最小の操作回数をメモ、参照するのは常に前の値なのでループを回せる
table = [1000000 for _ in range(N + 1)]
table[0] = 0

for i in range(1, N+1):
    a = 0
    while 6 ** a <= i:
        # 1円,6円,36円,...を使って操作回数を減らす
        table[i] = min(table[i], table[i - 6 ** a] + 1)
        a += 1
    b = 0
    while 9 ** b <= i:
        # 1円,9円,81円,...を使って操作回数を減らす
        table[i] = min(table[i], table[i - 9 ** b] + 1)
        b += 1

print(table[N])


Measured memory_bytes: 3864
#!/usr/bin/env python3
import sys
import itertools

def solve(N: int, d: "List[int]"):
    l = list(itertools.combinations(d, 2))
    ans = 0
    for x,y in l:
        ans += x*y
    print(ans)
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    d = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, d)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
import sys
input_lines = [int(i) for i in sys.stdin.readlines()]
n = input_lines[0]
ans = input_lines[2] - input_lines[1]
if n > 2:
    min_num = min(input_lines[1], input_lines[2])
    for i in input_lines[3:]:
        ans = max(ans, i-min_num)
        min_num = min(i, min_num)
print(ans)


Measured memory_bytes: 27828
#include <cstdio>
#include <queue>;
using namespace std;

int cols[10010];
int res[101][101];
int main()
{
	int row, col, n;
	scanf("%d %d %d", &row, &col, &n);
	for (int i = 1; i <= n; i++)
		scanf("%d", &cols[i]);
	int c = 1;
	for (int i = 0; i < row; i++)
	{
		if (i % 2 == 0)
		{
			for(int j = 0; j < col; j++)
			{ 
				if (cols[c] <= 0)
					c++;
				res[i][j] = c;
				cols[c]--;
			}

		}
		else
		{
			for (int j = col - 1; j >= 0; j--)
			{
				if (cols[c] <= 0)
					c++;
				res[i][j] = c;
				cols[c]--;
			}
		}
	}
	for (int i = 0; i < row; i++)
	{
		for (int j = 0; j < col; j++)
		{
			printf("%d", res[i][j]);
			if (j != col - 1)
				printf(" ");
		}
		printf("\n");
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <iomanip>
#include <limits>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <map>
#include <list>
#include <cctype>
using namespace std;
typedef long long ll;
#define rep(i,n) for(ll i=0;i<(n);i++)
double PI=acos(-1);

int main(){
    cout << fixed << setprecision(5);
    ll n;
    cin >> n;
    ll x[n],y[n];
    rep(i,n) cin >> x[i];
    rep(i,n) cin >> y[i];
    double d1=0,d2=0,d3=0,dinf=0;
    rep(i,n) d1 += abs(x[i]-y[i]);
    cout << d1 << endl;
    rep(i,n) d2 += pow(abs(x[i]-y[i]),2);
    cout << sqrt(d2) << endl;
    rep(i,n) d3 += pow(abs(x[i]-y[i]),3);
    cout << cbrt(d3) << endl;
    rep(i,n) if(abs(x[i]-y[i])>dinf) dinf=abs(x[i]-y[i]);
    cout << dinf << endl;
}


Measured memory_bytes: 3468
N,M=map(int,input().split())
a=list(int(input())for _ in range(M))
L=[1 for i in range(N+1)]
dp=[0 for _ in range(N+1)]
#L[0]=0
dp[0]=1
mod=1000000007
for j in a:
    L[j]=0
for i in range(1,N+1):
    if i>=2:
        dp[i]=(dp[i-1]*L[i-1]+dp[i-2]*L[i-2])*L[i]

    elif i==1:
        dp[i]=1
    dp[i]%=mod

print(dp[N])

Measured memory_bytes: 56536
#include<bits/stdc++.h>
const int N=500005,M=1000000007;
using namespace std;
int n,x,y,b[N],c[N];
struct seg{
	int a,b;
}l[N],s[N];
bool operator<(seg x,seg y){
	return x.b==y.b?x.a<y.a:x.b<y.b;
}
int main(){
	scanf("%d",&n);
	for(int i=0;i<n;i++)
	scanf("%d%d",c+i,&l[i].b),
	l[i].a=c[i];
	sort(l,l+n),sort(c,c+n);
	for(int i=n-1;~i;i--){
		x=l[i].a=upper_bound(c,c+n,l[i].a)-c;
		for(int j=x;j<=n;j+=j&-j)
		b[j]=max(b[j],i);
		for(int j=x;j;j-=j&-j)
		s[i].b=max(s[i].b,b[j]);
	}
	memset(b,0x3f,N*4);
	for(int i=0;i<n;i++){
		x=l[i].a;
		for(int j=x;j;j-=j&-j)
		b[j]=min(b[j],i);
		s[i].a=1e9;
		for(int j=x;j<=n;j+=j&-j)
		s[i].a=min(s[i].a,b[j]);
	}
	sort(s,s+n);
	memset(b,0,N*4);b[1]=1;
	for(int i=0;i<n;i++){
		for(x=s[i].a+1,y=0;x<=n+1;x+=x&-x)
		(y+=b[x])%=M;
		for(x=s[i].b+2;x;x-=x&-x)
		(b[x]+=y)%=M;
	}printf("%d",b[n+1]);
}

Measured memory_bytes: 11520
#include <bits/stdc++.h>
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(), (v).end()
using namespace std;
using lint = long long;
using pi = pair<int, int>;
const int MAXN = 200005;

int n, a[MAXN], b[MAXN];

int main(){
	scanf("%d",&n);
	for(int i=0; i<n; i++){
		scanf("%d",&a[i]);
		b[i] = a[i];
	}
	sort(b, b + n);
	for(int i=0; i<n; i++){
		if(a[i] <= b[n / 2 - 1]) printf("%d\n", b[n / 2]);
		else printf("%d\n", b[n / 2 - 1]);
	}
}


Measured memory_bytes: 3712
import java.util.Scanner;

class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		
		int n = scan.nextInt();
		
		int[] data = new int[n + 1];
		int[][] cost = new int[n + 1][n + 1];

		for(int i = 1; i <= n; i++) {
			cost[i][i] = 0;
		}
		
		data[0] = scan.nextInt();
		data[1] = scan.nextInt();
		
		for(int i = 2; i <= n; i++) {
			scan.nextInt();
			data[i] = scan.nextInt();
		}
		
		
		for(int i = 1; i < n; i++) {
			cost[i][i + 1] = data[i - 1] * data[i] * data[i + 1];
		}
		
		for(int i = 0; i <= n - 3; i++) {
			for(int j = 3 + i; j <= n; j++) {
				cost[j - 2 - i][j] = scan(j - 2 - i, j, cost, data);
			}
		}
		
		System.out.println(cost[1][n]);
		scan.close();
	}
	
	static int scan(int a, int b, int[][] cost, int[] data) {
		int MIN = Integer.MAX_VALUE;
		int num = b - a;
		
		for(int i = 0; i < num; i++) {
			int min = cost[a][a + i] + cost[a + i + 1][b] + data[a - 1] * data[a + i] * data[b];
			if(MIN > min) {
				MIN = min;
			}
		}
		return MIN;
	}
}

Measured memory_bytes: 26580
parseInt(x) = parse(Int, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)
function root(uf::Array{Int,1},x);s=x;while uf[s]>0;s=uf[s];end;s;end
same(uf::Array{Int,1},x,y)=root(uf,x)==root(uf,y)?true:false;
function unite(uf::Array{Int,1},x,y);l=root(uf,x);r=root(uf,y);if l!=r;if uf[l]<uf[r];uf[l]+=uf[r];uf[r]=l;else;uf[r]+=uf[l];uf[l]=r;end;end;end

function main()
	h,w = readline() |> split |> parseMap
	g = String["" for i in 1:h]
	c = zeros(Int,h*w)
	uf = -ones(Int,h*w)
	for i in 1:h
		g[i] = readline() |> chomp
	end
	for i in 1:h
		for j in 1:w
			x = (i-1)*w+j
			if g[i][j]=='#'
				c[x] = 1
			end
			if i>1
				if c[(i-2)*w+j]!=c[x]
					unite(uf,(i-2)*w+j,x)
				end
			end
			if j>1
				if c[(i-1)*w+j-1]!=c[x]
					unite(uf,(i-1)*w+j-1,x)
				end
			end
		end
	end
	bd = Dict{Int,Int}()
	wd = Dict{Int,Int}()
	for i in 1:h*w
		r = root(uf,i)
		if c[i]==0
			if haskey(wd,r)
				wd[r] += 1
			else
				wd[r] = 1
			end
		else
			if haskey(bd,r)
				bd[r] += 1
			else
				bd[r] = 1
			end
		end
	end
	ans = 0
	for i in keys(bd)
		if haskey(wd,i)
			ans += bd[i]*wd[i]
		end
	end
	println(ans)
end

main()

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


int main() {
  int A, B;
  cin >> A >> B;
  if (A <= 5) {
    cout << 0 << endl;
  }
  else if (A >= 13) {
    cout << B << endl;
  }
  else {
    cout << B / 2 << endl;
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define MAX 1e18
#define MIN -1e18
#define MOD 1000000007
#define mod2 20071027
//#define mod 1000074259
#define base 139
#define base2 31
#define memz(a) memset(a, 0, sizeof(a))
#define memn(a) memset(a, -1, sizeof(a))
#define in1(a) scanf("%lld", &a)
#define in2(a, b) scanf("%lld%lld", &a, &b)
#define TC(c) printf("Case %lld: ", ++c)
#define FAST ios_base::sync_with_stdio(false); cin.tie(NULL);
using namespace std;
const ll N=300010;
ll h, n, k, a[N], f=0, res;
int main()
{
    in1(n);
    ll sum=0, lim=n;
    for(int i=0;i<62 && sum<lim;i++)
    {
        if(n&(1LL<<i))
        {
            sum+=(1LL<<i);
        }
        else
        {
            n=(n|(1LL<<i));
        }

    }
    cout<<n<<endl;

    return 0;
}

/*

*/


Measured memory_bytes: 256
def isok(k):
  b=[i[::-1] for i in a]
  d=[0]*(m+1)
  while all(b):
    flag=1
    c=[0]*(m+1)
    for i in range(n):
      c[b[i][-1]]+=1
    for i in range(n):
      if c[b[i][-1]]>k or d[b[i][-1]]:
        d[b[i][-1]]=1
        b[i].pop()
        flag=0
    if flag:break
  return all(b)
def bsearch(a):
  ok=n
  ng=-1
  while abs(ok-ng)>1:
    mid=(ok+ng)//2
    if isok(mid):ok=mid
    else:ng=mid
  return ok
n,m=map(int,input().split())
a=[list(map(int,input().split())) for _ in range(n)]
print(bsearch(a))

Measured memory_bytes: 76452
S = input()

N = len(S)
a = int((N - 1) / 2)
b = int((N + 3) / 2)
A = S[:a]
B = S[b - 1:]

if A == B:
    if A == A[::-1] and B == B[::-1]:
        print("Yes")
    else:
        print("No")
else:
    print("No")

Measured memory_bytes: 3060
from fractions import gcd
N, M = map(int, input().split())
S = input()
T = input()

GCD = gcd(N, M)
LCM = int(N * M / GCD)
flg = True

for i in range(GCD):
    if S[i*N//GCD] == T[i*M//GCD]:
        continue
    else:
        flg = False
if flg:
    print(LCM)
else:
    print(-1)

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

int main(){
  string A, B, C;
  cin >> A >> B >> C;
  if (A[A.size()-1] == B[0] && B[B.size()-1] == C[0]) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
int N,i,j,k,G[30][30],f;
char S[501][11],*s,*t;
int main()
{
	for(;scanf("%d\n",&N),N;)
	{
		f=0;
		memset(G,0,sizeof(G));
		for(i=0;i<N;i++)
			gets(S[i]);
		for(i=1;i<N;i++)
		{
			s=S[i-1],t=S[i];
			for(j=0;s[j]&&s[j]==t[j];j++);
			if(s[j]&&!t[j])
				f=1;
			else if(s[j]&&t[j]&&s[j]!=t[j])
				G[s[j]-'a'][t[j]-'a']=1;
		}
		for(k=0;k<26;k++)
			for(i=0;i<26;i++)
				for(j=0;j<26;j++)
					G[i][j]|=G[i][k]&&G[k][j];
		for(i=0;i<26;i++)
			f|=G[i][i];
		puts(f?"no":"yes");
	}
	return 0;
}

Measured memory_bytes: 596
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define N 100000

int compare_c(const void *a, const void *b) {
	char ca = *(char *) a;
	char cb = *(char *) b;

	return ca - cb;
}

int compare_s(const void *a, const void *b) {
	char *s = *(char **) a;
	char *t = *(char **) b;

	return strcmp(s, t);
}

int main() {
	static char *ss[N], s[16];
	int n, i, k;
	long long ans;

	scanf("%d", &n);
	for (i = 0; i < n; i++) {
		scanf("%s", s);
		qsort(s, 10, sizeof *s, compare_c);
		ss[i] = strdup(s);
	}
	qsort(ss, n, sizeof *ss, compare_s);
	ans = 0;
	k = 1;
	for (i = 1; i <= n; i++)
		if (i < n && strcmp(ss[i - 1], ss[i]) == 0)
			k++;
		else {
			ans += (long long) k * (k - 1) / 2;
			k = 1;
		}
	printf("%lld\n", ans);
	return 0;
}


Measured memory_bytes: 4860
fun main(args: Array<String>) {
    val line = readLine()!!.trim()
    var (takahasi_hp: Int, takahasi_attack: Int, aoki_hp: Int, aoki_attack: Int) = line.split(" ").map {it.toInt()}

    while (true) {
        aoki_hp -= takahasi_attack
        if (aoki_hp <= 0) {
            println("Yes")
            break
        }

        takahasi_hp -= aoki_attack
        if (takahasi_hp <= 0) {
            println("No")
            break
        }
    }
}

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

using namespace std;
typedef long long ll;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using vd = vector<double>;
using vvd = vector<vd>;

#define out(a) cout << a << endl
#define out1(a) cout << a
#define in(a) cin >> a
#define in2(a, b) cin >> a >> b
#define in3(a, b, c) cin >> a >> b >> c
#define rep(i, N) for (ll i = 0; i < (ll)N; i++)
#define rep1(i, N) for (ll i = 1; i <= (ll)N; i++)
#define repi(i, j, N) for (ll j = (ll)i + 1; j < (ll)N; j++)
#define all(v) v.begin(), v.end()

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

constexpr int inf = 1e9;
constexpr ll linf = 1e18;
constexpr ll mod = 1e9 + 7;

void solve();

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

void solve()
{
    int n;
    in(n);
    out(n * n * n);
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cmath>
#include<cstdlib>
#include<vector>
#include<map>
#include<set>
#include<algorithm>

using namespace std;

int n;
int x[100005];

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

  sort(x,x+n);

  double diff = 1000000005;
  int ans = -1;

  for(int i=0;i<n-1;i++){
    //cout<<x[i]<<" "<<abs(((double)x[n-1]/2.0)-x[i])<<endl;
    if(diff > abs(((double)x[n-1]/2.0)-(double)x[i])){
      diff = abs(((double)x[n-1]/2.0)-(double)x[i]);
      ans = x[i];
    }
  }

  cout<<x[n-1]<<" "<<ans<<endl;

  return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define SZ(i) int(i.size())
#ifdef tmd
#define IOS()
#define debug(...) fprintf(stderr,"%s - %d (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);_do(__VA_ARGS__);
template<typename T> void _do(T &&x){cerr<<x<<endl;}
template<typename T, typename ...S> void _do(T &&x, S &&...y){cerr<<x<<", ";_do(y...);}
#else
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0);
#define endl '\n'
#define debug(...)
#endif

const int MAXN = 500005;
const ll INF = 0x3f3f3f3f3f3f3f3f;
typedef pair<int, int> pii;

int n, k, dp[MAXN];
char s[MAXN], t[MAXN];
/*********************GoodLuck***********************/
int main () {
    IOS();

    cin >> n >> k;
    s[0] = t[0] = 'X';
    REP1 (i, n) {
        cin >> s[i];
    }
    REP1 (i, n) {
        cin >> t[i];
    }

    dp[0] = 0;
    int df = 0, ft = 0;
    vector<pii> que;
    REP1 (i, n) {
        if (t[i] != t[i-1]) {
            df++;
        }
        int cur = (-df + 1 + 2) + dp[i-1] * 2;
        while (SZ(que) > ft && cur <= que.back().second) {
            que.pop_back();
        }
        que.emplace_back(i, cur);

        debug(i, df);
        for (int j=ft; j<SZ(que); j++) {
            debug(que[j].first, que[j].second);
        }
        if (s[i] == t[i]) {
            dp[i] = dp[i-1];
        } else {
            while (i - que[ft].first + 1 > k) {
                ft++;
            }
            dp[i] = (que[ft].second + df) / 2;
        }

        debug(dp[i]);
    }

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



Measured memory_bytes: 9664
#include <iostream>
#include <vector>
#include <algorithm>
#include <vector>
#include <queue>
#define int long long
using namespace std;
 
signed main(){
    int n;
    int max=0;
    int min=0;
    cin>> n;
    int N=3*n;
    int a[N];
 
    priority_queue<int> PQ1;
    priority_queue<int, vector<int>, greater<int> >PQ2;
 
    int max_arr[n+1]={0};
    int min_arr[n+1]={0};
    
    for(int i=0;i<3*n;i++){
        cin>>a[i];
        
    }
 
    for(int i=0;i<n;i++){
        max+=a[i];
        min+=a[i+2*n];
    }
 
    // cout<<max<<" "<<min<<endl;
 
    max_arr[0]=max;
    
    for(int i=0;i<n;i++){
        PQ2.push(a[i]);
    }
 
    for(int i=n;i<2*n+1;i++){
        PQ2.push(a[i]);
        max+=a[i];
        max-=PQ2.top();
        PQ2.pop();
        max_arr[i-n+1]=max;
 
    }
 
    // for(int i=0;i<n+1;i++){
    //     cout<<max_arr[i]<<" ";
    // }
 
    min_arr[n]=min;
    for(int i=2*n;i<3*n;i++){
        PQ1.push(a[i]);
    }
    for(int i=3*n;i>2*n;i--){
        // cout<<i-n-1<<endl;
        PQ1.push(a[i-n-1]);
        min+=a[i-n-1];
        min-=PQ1.top();
 
        // cout<<PQ1.top()<<endl;
        PQ1.pop();
        min_arr[(i-2*n)-1]=min;
    }
    // cout<<count<<endl;
 
 
    // for(int i=0;i<n+1;i++){
    //     cout<<min_arr[i]<<" ";
    // }
 
 
    // for(int i=0;i<n+1;i++){
    //     max[i]=
    // }
 
    int ans=max_arr[0]-min_arr[0];
    for(int i=0;i<n+1;i++){
        if(ans<max_arr[i]-min_arr[i]){
            ans=max_arr[i]-min_arr[i];
        }
        // ans=max(ans,);
    }
    cout<<ans<<endl;
 
}

Measured memory_bytes: 6516
N = int(input())
A = [int(s) for s in input().split()]

def func_half(x):
    result = 0
    if x % 2 == 0:
        i = 1
        while x % (2**i) == 0:
            result = i
            i += 1
    return result

ans = 10**9
for a in A:
    buf = func_half(a)
    if buf == 0:
        ans = 0
        break
    ans = min(ans, buf)

print(ans)

Measured memory_bytes: 9052
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fst first
#define snd second
#define all(cont) cont.begin(), cont.end()
#define foreach(it, l) for (auto it = l.begin(); it != l.end(); it++)
#define fore(i,a,b) for(int i=a,almo5t=b;i<almo5t;++i)
#define SZ(x) ((int)x.size())
#define EPS 1e-9
#define PI acos(-1)
#define MOD 1000000007
#define FIN std::ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
 
const int N = 0;
 
typedef long long int ll;
 
using namespace std;


 
int main(){
    FIN;
    //freopen("../input.txt", "r", stdin);freopen("../output.txt", "w", stdout);
    int n;cin>>n;
    set<string> rep;
    fore(i,0,n){
        string s;cin>>s;
        rep.insert(s);
    }
    cout<<rep.size();

    return 0;
}

// ============== Notes =============== //
// common bugs
// - remove reader 
// - fastio
// - int overflow (especially intermediate expressionns)
// - array bounds (indices bigger than MAXN?, is MAXN correct?)
// - special cases (n=1, graph not connected?)
// - re-initialize efficiently between test cases

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

#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define endl '\n'
#define fcin ios::sync_with_stdio(false); cin.tie(nullptr);
#define INF 0x3f3f3f3f
#define all(x) x.begin(), x.end()
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

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

template <typename A, typename B>
string to_string(pair<A, B> p){
    return "(" + to_string(p.fi) + ", " + to_string(p.se) + ")";
}

template <typename T>
string to_string(T v){
    string s = "{";
    bool first = true;
    for(const auto & x : v){
        if(!first) s += ", ";
        first = false;
        s += to_string(x);
    }
    return s + "}";
}

void debug_out(){ cerr << endl;}
template <typename First, typename... Next>
void debug_out(First F, Next... N){
    cerr << " " << to_string(F);
    debug_out(N...);
}

#ifdef LOCAL
    #define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
    #define debug(...) 1
#endif

int main(){
    fcin;
    int n, m;
    cin >> n >> m;

    cout << max(0, n * (n-1)/2) + max(0, m * (m-1)/2) << endl;
    return 0;
}



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

int main() {
  int a,b,k,n;
  cin >> a >> b >> k;
  if(a == b)
    n = a;
  else if(a < b)
    n = b - a;
  else if(b < a)
    n = a - b;
  for(int i = n; i > 0; i--){
    if(a % i == 0 && b % i == 0){
      k--;
      if(k == 0){
        k = i;
        break;
      }
    }
  }
  cout << k << endl;
}


Measured memory_bytes: 256
n = int(input())
s = [input() for _ in range(n)]
dic = {"AC": 0, "WA": 0, "TLE": 0, "RE":0}

for v in s:
  dic[v] += 1

print("AC x {}".format(dic["AC"]))
print("WA x {}".format(dic["WA"]))
print("TLE x {}".format(dic["TLE"]))
print("RE x {}".format(dic["RE"]))


Measured memory_bytes: 16272
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int a[100010], b[100010];

typedef struct {
	int a;
	int b;
} square;
square topleft[900010];

int sqcmp(const void *a, const void *b) {
	int A = (*(square *)a).a - (*(square *)b).a;
	int B = (*(square *)a).b - (*(square *)b).b;
	if (A>0 || (A==0 && B>0)) return 1;
	else if (A==0 && B==0) return 0;
	else return -1;
}

int main() {
	int i, j, k, N;
	long long H, W, num[10]={0};
	scanf("%lld%lld%d", &H, &W, &N);
	for (i=0;i<N;i++) scanf("%d%d", &a[i], &b[i]);

	j = 0;
	for (i=0;i<N;i++) {
		if (a[i]>2 && b[i]>2) {
			topleft[j].a = a[i]-2;
			topleft[j].b = b[i]-2;
			j++;
		}
		if (a[i]>1 && a[i]<H && b[i]>2) {
			topleft[j].a = a[i]-1;
			topleft[j].b = b[i]-2;
			j++;
		}
		if (a[i]<H-1 && b[i]>2) {
			topleft[j].a = a[i];
			topleft[j].b = b[i]-2;
			j++;
		}
		if (a[i]>2 && b[i]>1 && b[i]<W) {
			topleft[j].a = a[i]-2;
			topleft[j].b = b[i]-1;
			j++;
		}
		if (a[i]>1 && a[i]<H && b[i]>1 && b[i]<W) {
			topleft[j].a = a[i]-1;
			topleft[j].b = b[i]-1;
			j++;
		}
		if (a[i]<H-1 && b[i]>1 && b[i]<W) {
			topleft[j].a = a[i];
			topleft[j].b = b[i]-1;
			j++;
		}
		if (a[i]>2 && b[i]<W-1) {
			topleft[j].a = a[i]-2;
			topleft[j].b = b[i];
			j++;
		}
		if (a[i]>1 && a[i]<H && b[i]<W-1) {
			topleft[j].a = a[i]-1;
			topleft[j].b = b[i];
			j++;
		}
		if (a[i]<H-1 && b[i]<W-1) {
			topleft[j].a = a[i];
			topleft[j].b = b[i];
			j++;
		}
	}
	qsort(topleft, j, sizeof(square), sqcmp);

	for (i=0;i<j;i++) {
		for (k=i+1;k<j;k++) {
			if (topleft[k].a != topleft[i].a || topleft[k].b != topleft[i].b) break;
		}
		num[k-i]++;
		i = k-1;
	}

	num[0] = (H-2)*(W-2);
	for (i=1;i<10;i++) num[0] -= num[i];

	for (i=0;i<10;i++) printf("%lld\n", num[i]);
	return 0;
}


Measured memory_bytes: 14972
#include <iostream>
#include <utility>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <map>
using namespace std;
typedef long long ll;
const long long mod = 1e9 + 7;
int main() {
    int r;
    cin >> r;
    cout << 2*r*3.14159;
    return 0;
}

Measured memory_bytes: 3772
import java.io.BufferedReader
import java.io.InputStream
import java.io.InputStreamReader
import java.util.*

fun main(args: Array<String>) {
    val sc = FastScanner(System.`in`)

    val x = sc.nextInt()
    val y = sc.nextInt()
    val z = sc.nextInt()

    var k = 0
    var count = 0
    while (k + z + y <= x - z) {
        k += z + y
        count += 1
    }

    println(count)


}

class FastScanner(s: InputStream) {
    private var st = StringTokenizer("")
    private val br = BufferedReader(InputStreamReader(s))

    fun next(): String {
        while (!st.hasMoreTokens()) st = StringTokenizer(br.readLine())

        return st.nextToken()
    }

    fun nextInt() = next().toInt()
    fun nextLong() = next().toLong()
    fun nextLine() = br.readLine()
    fun nextDouble() = next().toDouble()
    fun ready() = br.ready()
}

Measured memory_bytes: 31272
#include<bits/stdc++.h>
using namespace std;
const int N = 205;
const int maxS = 40005;
long long f[2][2*maxS],n,m,a[N];
const int MOD =1e9+7;
void init()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    freopen("AVERAGE.inp","r",stdin);
    freopen("AVERAGE.out","w",stdout);
}
void nhap()
{
    cin >> n >> m;
    for (int i=1; i<=n; i++) {
        cin >> a[i];
        a[i] -= m;
    }
}
void xuli()
{
    memset(f,0,sizeof(f));
    f[0][maxS] = 1;
    for (int i = 1; i<=n; i++) {
        for (int j = 0; j<2*maxS; j++) {
             f[1][j] += f[0][j];
             if (j+a[i]<2*maxS) f[1][j+a[i]] += f[0][j];
        }
        for (int j = 0; j<2*maxS; j++) {
            f[0][j] = f[1][j];
            f[1][j] = 0;
        }
    }
    cout << f[0][maxS] - 1  << '\n';
}
int main()
{
        nhap();
        xuli();

}


Measured memory_bytes: 1536
a, b = map(int, input().split())
num = -1

if a <= b:
    for i in range(1000000):
        if int(i*0.08) == a and int(i*0.1) == b:
            num = i
            break

        elif int(i*0.08) > a or int(i*0.1) > b:
            break

print(num)

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

namespace B
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            int ans = 0;
            for (int i = 1; i <= N; i++) {
                if(i.ToString().Length % 2 == 1) {
                    ans++;
                }
            }
            Console.WriteLine(ans);
        }
    }
}


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

int isM(int a)
{
  return 1 <= a && a <= 12;
}

int main(void)
{
  char S[10];
  scanf("%s", S);
  int a = (S[0]-'0')*10+S[1]-'0';
  int b = (S[2]-'0')*10+S[3]-'0';
  if(isM(a) || isM(b)){
    if(isM(a) && isM(b))
      printf("%s\n", "AMBIGUOUS");
    else if(isM(a))
      printf("%s\n", "MMYY");
    else
      printf("%s\n", "YYMM");
  }
  else
    printf("%s\n", "NA");
  return 0;
}


Measured memory_bytes: 128
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Threading.Tasks;

namespace AtCorder
{
	public class Program
	{
		static void Main(string[] args)
		{
			string s = Console.ReadLine();
			string t = Console.ReadLine();
			int n = s.Length;
			int m = t.Length;

			var dp = new int[n + 1, m + 1];
			for (int i = 0; i < n; i++) {
				for (int j = 0; j < m; j++) {
					if (s[i] == t[j]) {
						dp[i + 1, j + 1] = Math.Max(dp[i + 1, j + 1], dp[i, j] + 1);
					}

					dp[i + 1, j + 1] = Math.Max(dp[i + 1, j + 1], dp[i + 1, j]);
					dp[i + 1, j + 1] = Math.Max(dp[i + 1, j + 1], dp[i, j + 1]);
				}
			}

			int ii = n;
			int jj = m;
			string ans = "";
			while (ii > 0 && jj > 0) {
				if (dp[ii, jj] == dp[ii, jj - 1]) {
					jj--;
				} else if (dp[ii, jj] == dp[ii - 1, jj]) {
					ii--;
				} else {
					ii--;
					jj--;
					ans = s[ii] + ans;
				}
			}

			Console.WriteLine(ans);
		}
	}
}

Measured memory_bytes: 48088