akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < (n); i++)
#define REPR(i, n) for(int i = n - 1; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define FORR(i, m, n) for(int i = m; i >= n; i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)

ll mod = 1e09;

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

  string s;
  cin >> s;
  map<char, int> m;

  REP(i, s.size()) m[s[i]]++;

  int rec = 1;

  for(char i = 'a'; i <= 'z'; i++){
    if(m[i] % 2) rec = 0;
  }

  if(rec) cout << "Yes";
  else cout << "No";

  return 0;
}


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


int main() {
  int k,x;

  cin >> k >> x;

  if (500 * k >= x){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
} 

Measured memory_bytes: 256
S = input()
e = S.count("E")
w = S.count("W")
n = S.count("N")
s = S.count("S")

ew_flag = False
ns_flag = False

if (e > 0 and w > 0) or (e == 0 and w == 0):
  ew_flag = True
if (n > 0 and s > 0) or (n == 0 and s == 0):
  ns_flag = True

if ew_flag and ns_flag:
  print("Yes")
else:
  print("No")

Measured memory_bytes: 3064
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif




#define int long long
#define rng(i,l,r) for(size_t i=(l);i<(r);++i)
#define rep(i,n) rng(i,0,n)
#define gnr(i,l,r) for(size_t i=(r)-1;i>=(l);i--)
#define per(i,b) gnr(i,0,b)
#define ALL(obj) (obj).begin(), (obj).end()   //1,2,3,...
#define rALL(obj) (obj).rbegin(), (obj).rend()//...,3,2,1

using namespace std;


//constant
const int MOD = 1e9+7;
const int INF = 1e18;
const int dx4[4] = {1, 0, -1, 0};
const int dy4[4] = {0, 1, 0, -1};
const int dx8[8] = {1,1,0,-1,-1,-1,0,1};
const int dy8[8] = {0,1,1,1,0,-1,-1,-1};
const double pi = acos(-1);


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; }

int gcd(int a,int b){return b?gcd(b,a%b):a;}
//*max_element(ALL(vector))
//count(ALL(vector),num) -> n
//memset(obj,value,sizeof(obj));




void solve(){
    
    // remove the bottom 3 lines when you submit this code.
    std::ifstream in("sample.txt");
    std::cin.rdbuf(in.rdbuf());

    cin.tie(0);
    ios::sync_with_stdio(false);
    
    
    vector<int> A(3); rep(i,3) cin >> A[i];
    int ans = 0;
    while(!(A[0]==A[1]&&A[1]==A[2])){
        sort(ALL(A));//1,2,3,...
        
        if(A[0]+2<=A[1] || A[1]==A[2]){
            A[0] += 2;
        }else{
            A[0]++;
            A[1]++;
        }
        ans++;
    }
    
    cout << ans << endl;
    
    
}





signed main() {
    solve();
    return 0;
}




Measured memory_bytes: 256
# Python3 (3.4.3)
import sys
input = sys.stdin.readline

# -------------------------------------------------------------
# function
# -------------------------------------------------------------


# -------------------------------------------------------------
# main
# -------------------------------------------------------------
N = int(input())
AB = [tuple(map(int,input().split())) for _ in range(N)]

AB.sort(key=lambda x:x[1]) 

ans = "Yes"
total = 0
for a,b in AB:
    total += a
    if total > b:
        ans = "No"
        break

print(ans)

Measured memory_bytes: 31848
#[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! {
    n: usize,
    m: usize,
    xs: [i32; m]
  }
  let mut xs = xs;
  xs.sort();
  let mut dist: Vec<i32> = vec![];
  for i in 0..m-1 {
    dist.push(xs[i+1] - xs[i]);
  }
  dist.sort();
  let mut ans = 0i32;
  for i in 0..m.saturating_sub(n) {
    ans += dist[i];
  }
  println!("{}", ans);
}


Measured memory_bytes: 6396
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int m = sc.nextInt();
		int sum = 0;

		//入力したm回数分繰り返す
		for(int i = 0;i < m;i++) {
			int a = sc.nextInt();
				sum += a;
		}
		//合計が日数より大きければ
		if(sum > n) {
			System.out.println(-1);
		}
		else {
			System.out.println(n-sum);
		}
		System.out.println();
		sc.close();

	}

}


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

using namespace std;

#ifdef WIN32
	#define I64 "%I64d"
#else
	#define I64 "%lld"
#endif

typedef long long ll;

#define f first
#define s second
#define mp make_pair
#define pb push_back
#define all(s) s.begin(), s.end()
#define sz(s) (int(s.size()))
#define fname "a"


int n, m;
int g[12][12];
ll d[1 << 10][10];

int main()
{
	#ifdef LOCAL
	freopen(fname".in", "r", stdin);
	freopen(fname".out", "w", stdout);
	#endif

	scanf("%d%d", &n, &m);
	for (int i = 0; i < m; ++i) {
		int v1, v2;
		scanf("%d%d", &v1, &v2);
		--v1, --v2;
		g[v1][v2] = 1;
		g[v2][v1] = 1;
	}

	d[1][0] = 1;
	for (int mask = 0; mask < (1 << n); ++mask) {
		for (int i = 0; i < n; ++i) {
			if (!d[mask][i]) continue;
			for (int j = 0; j < n; ++j) {
				if (((mask >> j) & 1) || !g[i][j]) continue;
				d[mask | (1 << j)][j] += d[mask][i];
			}
		}
	}

	ll ans = 0;
	for (int i = 0; i < n; ++i)
		ans += d[(1 << n) - 1][i];

	printf(I64"\n", ans);

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int N;
int P[300005];
void Read()
{
    cin >> N;
    for(int i = 1; i <= N; i++)
        cin >> P[i];
}

void Solve()
{
    for(int i = 1; i <= N; i++)
    {
        if(P[i] == i)
        {
            continue;
        }
        int l = i, r = i;
        while(1)
        {
            if(r == N) break;
            if(r + 1 > N || P[r + 1] != r + 1)
                break;
            if(r + 2 > N || P[r + 2] == r + 2)
                break;
            r += 2;
        }
        int Min = N + 3, Max = 0;
        for(int j = l; j <= r; j += 2)
        {
            Min = min(Min, P[j]);
            Max = max(Max, P[j]);
        }
        if(Min < l || Max > r)
        {
            cout << "No\n";
            return;
        }
        int last = 0;
        for(int j = l; j <= r; j += 2)
            if(P[j] < j)
            {
                if(P[j] < last)
                {
                    cout << "No\n";
                    return;
                }
                last = P[j];
            }
        last = 0;
        for(int j = l; j <= r; j += 2)
            if(P[j] > j)
            {
                if(P[j] < last)
                {
                    cout << "No\n";
                    return;
                }
                last = P[j];
            }
        i = r;
    }
    cout << "Yes\n";
}
int main()
{
    Read();
    Solve();
    return 0;
}


Measured memory_bytes: 1408
#include <iostream>
#include <string>
#include <algorithm>
#include <queue>
#define rep(i, n) for(long long i = 0;(i) < (n);(i)++)
using namespace std;
using ll = long long;

int a[10];

int main()
{
	ll N;
	cin >> N;
	int odd, even = 0;
	for (int i = 1; i <= N; i++) {
		if (i % 2 == 1) {
			even++;
		}
	}
	cout << even / (double)N << endl;
	return 0;
}



Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var a1, a2, a3 int
	fmt.Scan(&a1, &a2, &a3)

	if a1+a2+a3 >= 22 {
		fmt.Println("bust")
	} else {
		fmt.Println("win")
	}

}


Measured memory_bytes: 512
#include <cstdio>
#include <map>
#include <iostream>
#include <cstdlib>
#include <cstring>
#include <set>
#include <map>
#include <vector>
#include <queue>
#include <algorithm>
#include <cmath>

using namespace std;

//const int mod = int(1e9) + 7;
//const int SZ = 1010;
const int MX = 300500;

#define pii pair<int,int>


int a[MX];
int b[MX];

int main(int argc, char** argv)
{
#ifdef LOCAL
    freopen("/Users/melnykroman/CLionProjects/cf/in.txt", "r", stdin);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(0);

    int n;
    cin >> n;
    for(int i = 0; i < n; i++){
        cin >> a[i];
    }
    sort(a, a + n);
    int m;
    cin >> m;
    for(int i = 0; i < m; i++){
        cin >> b[i];
    }
    sort(b, b + m);
    int pos = 0;
    for(int i = 0; i < m; i++){
        while(pos < n && a[pos] < b[i]) pos++;
        if(pos == n || a[pos] != b[i]) {
            cout << "NO" << endl;
            return 0;
        }
        pos++;
    }
    cout << "YES" << endl;
    return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define FOR(i, a, n) for(ll i = (ll)a; i < (ll)n; i++)
#define rep(i, n) FOR(i, 0, n)
#define ALL(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;

constexpr ll Mod = 998244353;
constexpr ll mod = 1e9 + 7;
constexpr ll inf = 1LL << 60;

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

/*-------------------------------------------*/

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

    ll n, a, b;
    cin >> n >> a >> b;
    ll ab = a + b;
    ll x = n / ab, y = n % ab;
    ll ans = x * a + min(a, y);
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<cctype>
#include<cstring>
#include<algorithm>
#include<set>
#include<ctime>
#define REP(r,x,y) for(register int r=(x); r<(y); r++)
#define REPE(r,x,y) for(register int r=(x); r<=(y); r++)
#define PERE(r,x,y) for(register int r=(x); r>=(y); r--)
#ifdef sahdsg
#define DBG(...) printf(__VA_ARGS__),fflush(stdout)
#else
#define DBG(...) (void)0
#endif
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;

char ch; int si;
char buf[1<<21],*p1=buf,*p2=buf;
int beof = 0;
#define gc() (beof?EOF:(p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?(beof=EOF):*p1++))
#define gl(x) {char*s=x;while(isspace(*s=gc()));s++;while(!isspace(*s=gc()))s++;*s=0;}

template<class T>
inline void read(T &x) {
    x=0; si=1; for(ch=gc();!isdigit(ch) && ch!='-';ch=gc()) if(beof) return;
    if(ch=='-'){si=-1,ch=gc();} for(;isdigit(ch);ch=gc())x=x*10+ch-'0';
    x*=si;
}
//template<class T, class...A> inline void read(T &x, A&...a){read(x); read(a...);}

char sa[1028], sb[1028];

int main() {
#ifdef sahdsg
    freopen("in.txt","r",stdin);
#endif
    int k,n; read(n); read(k);
    printf("%d\n", n-k+1);
    return 0;
}


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

using namespace std;

#define sqr(x) ((x) * (x))
#define pb push_back
#define mp make_pair
#define X first
#define Y second
#define fin(name) freopen(name, "r", stdin)
#define fout(name) freopen(name, "w", stdout)
#define I(x, a) for(auto x : a)
#define F(i, l, r) for(auto i = l; i < r; ++i)
#define DF(i, l, r) for(auto i = l; i > r; --i)
#define clean(a) memset((a),0,sizeof (a))
#define sync ios_base::sync_with_stdio(0);cin.tie(0)
#define all(x) x.begin(),x.end()
#define ret return
#define cont continue
#define brk break
#define ins insert
#define sz(a) ((int)(a).size())

typedef long long ll;
typedef unsigned long long ull;
typedef long double dbl;
typedef pair <int, int> pii;

const int inf = (int)1e9;
const ll linf = (ll)1e18;
const int mod = (int)1e9 + 7;
const dbl eps = (dbl)1e-8;
const int maxn = (int)1e5 + 5;
const dbl pi = acos(-1);


int main() {
//    fin("t.in");
    sync;
    ll n, a, b;
    cin >> n >> a >> b;
    if (abs(a - b) % 2 == 1) {
    	cout << "Borys\n";
    } else {
    	cout << "Alice\n";
    }
    return 0;
}

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

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
	char key[] = {'k','e','y','e','n','c','e'};
    int key_count = 0;
    int st_count;
    int el = 0;
    boolean ans = false;
    boolean con = true;
    boolean con2;
    
    for(int i = 0;i < s.length() && con; i++){
    	if(s.charAt(i) == key[key_count] && el == 0) {
          key_count++;
          if(key_count == 7) {
            con = false;
          	ans = true;
          }
        } else if(el == 0) {
          el = 1;
          i = s.length() -(7-key_count)-1;
        }
      	else if(s.charAt(i) == key[key_count]){
          el = 2;
          key_count++;
          if(key_count == 7) {
            con = false;
          	ans = true;
          }
        }
      	else if(el == 2) con = false;    	
    }
     	
    if(ans) System.out.println("YES");
  	else System.out.println("NO");
  }
}


Measured memory_bytes: 35616
#include <iostream>
using namespace std;
int main(void){
    int a,b,c;
    cin >> a >> b >> c;
    if(a==b&&b==c&&a==c){
        cout<<"1";
    }
    else if(a==b||b==c||a==c){
        cout<<"2";
    }
    else{
        cout<<"3";
    }

    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;
using P = pair<int,int>;

int main() {

  double l;
  cin >> l;
  double ans;
  ans = pow(l, 3) / 27;

  printf("%.12f\n",ans);


  return 0;
}

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

using namespace std;
int main() {
    int a,c,k;
    cin >> a;
    int b[a];
    for (int i=0 ; i<a; i++) {
        cin >> b[i];
    }

    for (int i=1; i<a; i++) {
        for(int j=0;j<a;j++){
            if (j==0) {
                cout <<b[j];
            }
            else {
                cout <<" "<<b[j];
            }
        }
        c=b[i];
        k = i-1;
        while(k>=0 && c<b[k]){
            b[k+1]=b[k];
            k--;
        }
        b[k+1]=c;
        
        cout << endl;
}
    for(int j=0;j<a;j++){
        if (j==0) {
            cout <<b[j];
        }
        else {
            cout <<" "<<b[j];
        }
        
    }
    cout << endl;

}



Measured memory_bytes: 3080
#include<bits/stdc++.h>
using namespace std;
int main(){
	cin.tie(0);
	ios::sync_with_stdio(0);
	string s;
	cin>>s;
	int l=s.length();
	if(s[l-1]=='s')s+="es";
	else s+='s';
	cout<<s;
return 0;
}


Measured memory_bytes: 3664
#include <iostream>
using namespace std;
#define REP(i,k,n) for(int i=k;i<n;i++)
#define rep(i,j) for(int i=0;i<j;i++)

int main(void){
	int a,b;

	while(1){

		cin >> a >> b;
		if(a == 0 && b == 0) break;

		if(a < b){
			cout << a << " " << b << endl;
		} else {
			cout << b << " " << a << endl;
		}
	}

	return 0;
}

Measured memory_bytes: 1160
il = [int(k) for k in input().split()]
S = input()
N = il[0]
A = il[1]
B = il[2]

S = "z"+S

passed = 0
passed_oversea = 0

for i in range(len(S)):
    if S[i] == "a":
        if passed < A+B:
            passed += 1
            print("Yes")
        else:
            print("No")
    elif S[i] == "b":
        passed_oversea += 1
        if passed < A+B and passed_oversea <= B:
            passed += 1
            print("Yes")
        else:
            print("No")
    elif S[i] == "c":
        print("No")


Measured memory_bytes: 4040
#include <iostream>

using namespace std;
typedef long long ll;

#define INF (1e9)

ll digit(ll a)
{
    ll ans = 0;
    while (a > 0)
    {
        a /= 10;
        ans++;
    }
    return ans;
}

ll F(ll A, ll B)
{
    return max(digit(A), digit(B));
}

int main(int argc, const char *argv[])
{
    ll N;
    cin >> N;

    ll ans = INF;
    for (ll i = 1; i * i <= N; i++)
    {
        if (N % i != 0)
        {
            continue;
        }
        ans = min(ans, F(i, N / i));
    }

    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
use std::io::BufRead;

fn main() {
  let stdin = std::io::stdin();
  let mut lines = stdin.lock().lines();

  let mut str = lines.next().unwrap().unwrap().to_string();
  let n = lines.next().unwrap().unwrap().parse::<usize>().unwrap();

  for line in lines.take(n) {
    let line = line.unwrap();
    let mut ite = line.split_whitespace();
    let command = ite.next().unwrap();
    let a = ite.next().unwrap().parse::<usize>().unwrap();
    let b = ite.next().unwrap().parse::<usize>().unwrap();

    match command {
      "replace" => {
        let w = ite.next().unwrap();
        str.drain(a..b+1);
        str.insert_str(a, &w);
      }
      "reverse" => {
        let rev = str.drain(a..b+1).rev().collect::<String>();
        str.insert_str(a, &rev);
      }
      "print" => {
        println!("{}", &str[a..b+1]);
      }
      _ => { }
    }
  }
}


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

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

  if (a > b) {tmp = a; a = b; b = tmp;}
  if (b > c) {tmp = b; b = c; c = tmp;}
  if (a > b) {tmp = a; a = b; b = tmp;}
  cout << a << " " << b << " " << c << endl;
  return 0;
}

Measured memory_bytes: 3084
/**
 * @brief 8クイーン問題を扱う
 *
 * @date 2016/02/29
 */



//****************************************
// 必要なヘッダファイルのインクルード
//****************************************

#include <iostream>
#include <vector>



//****************************************
// 型シノニム
//****************************************

using array1D = std::vector<int>;
using array2D = std::vector<array1D>;



//****************************************
// 大域変数の定義
//****************************************

static const int N = 8;                 /**< マスの数 */
static const int FREE = 0, NOFREE = 1;  /**< クイーンが配置できるか否か */



//****************************************
// 構造体の定義
//****************************************

struct board {
    array1D row;    /**< row[x]がNOFREEならば行xは被襲撃位置 */
    array1D col;    /**< col[x]がNOFREEならば列xは被襲撃位置 */
    array1D dpos;   /**< dpos[x]がNOFREEならば左下の列xは被襲撃位置 */
    array1D dneg;   /**< dneg[x]がNOFREEならば右下の列xは被襲撃位置 */
    
    array2D state;  /**< 盤面の状態  */

    board() : row(N, FREE), col(N, FREE),
              dpos(2 * N - 1, FREE), dneg(2 * N - 1, FREE),
              state(N, array1D(N, FREE)) { }

    /**< 盤面の状態を印刷する */
    void print()
    {
        for (int y = 0; y < N; y++) {
            for (int x = 0; x < N; x++) {
                if (state[y][x] && row[y] != x) { return; }
            }
        }
        for (int y = 0; y < N; y++) {
            for (int x = 0; x < N; x++) {
                std::cout << ((row[y] == x) ? "Q" : ".");
            }
            std::cout << std::endl;
        }
    }

    /**< @brief 座標(x, y)にQueenを配置する */
    void move(int x, int y)
    {
        row[y] = x;
        col[x] = dpos[y + x] = dneg[y - x + N - 1] = NOFREE;
    }

    /**< @brief 座標(x, y)からQueenを取り除く */
    void undo(int x, int y)
    {
        row[y] = col[x] = dpos[y + x] = dneg[y - x + N - 1] = FREE;
    }

    /**< @brief 座標(x, y)にQueenを配置可能かどうか調べる */
    bool canMove(int x, int y)
    {
        return !(col[x] || dpos[y + x] || dneg[y - x + N - 1]);
    }

    /**
     * @brief 再帰的に盤面を探索し、Queenが配置できる場所を探す
     * @param 探索対象のy座標
     */
    void visit(int y)
    {
        // Queenの配置に成功した
        if (y >= N) { print(); return; }
    
        for (int x = 0; x < N; x++) {
            // 座標(x, y)が配置不可能な場合、continue
            if (!canMove(x, y)) { continue; }
       
            move(x, y);    // 座標(x, y)にQueenを配置する
               
            visit(y + 1);  // 次の行へ再帰

            undo(x, y);    // 座標(x, y)からQueenを取り除く
        }
    }

    /**< @brief 座標(x, y)にQueenを初期段階で配置する */
    void initqueen(int x, int y)
    {
        state[y][x] = true;
    }
};



//****************************************
// 関数の定義
//****************************************

int main()
{
    using namespace std;
    board B;

    int k; cin >> k;
    for (int i = 0; i < k; i++) {
        int r, c; cin >> r >> c;
        B.initqueen(c, r);
    }

    B.visit(0);

    return 0;
}

Measured memory_bytes: 3144
import sys
N=int(input())
a=list(map(int,input().split()))
b=[0 for _ in range(N)]
if(N%2==0):
    l=int(N/2)-1
else:
    l=int(N/2)
r=l+1
for i in range(N):
    if(i%2==(N-1)%2):
        b[l]=a[i]
        l-=1
    else:
        b[r]=a[i]
        r+=1
for index,item in enumerate(b):
    if(index==len(b)-1):
        break
    sys.stdout.write(str(item)+" ")
sys.stdout.write(str(b[N-1])+"\n")

Measured memory_bytes: 26180
import std.stdio, std.conv, std.string, std.array, std.range, std.algorithm, std.container;
import std.math, std.random, std.bigint, std.datetime, std.format;
void main(string[] args){ if(args.length > 1) if(args[1] == "-debug") DEBUG = 1; solve(); }
void log()(){ writeln(""); } void log(T, A ...)(T t, lazy A a){ if(DEBUG) write(t, " "), log(a); } bool DEBUG = 0; 
string rstring(){ static string[] ss; while(!ss.length) ss = readln.chomp.split; string res = ss[0]; ss.popFront; return res; }
T rtype(T)(){ return rstring.to!T; } alias rint = rtype!int, rlong = rtype!long, rreal = rtype!real;
T[] rtypes(T)(int n){ return n.iota.map!(i => rtype!T()).array; } alias rint = rtypes!int, rlong = rtypes!long, rreal = rtypes!real;
T[][] rtypess(T)(int n, int m){ return n.iota.map!(i => rtypes!T(m)).array; } alias rint = rtypess!int, rlong = rtypess!long, rreal = rtypess!real;
T chmin(T)(ref T x, T y){ if(x > y) x = y; return x; } T chmax(T)(ref T x, T y){ if(x < y) x = y; return x; }

// ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- //

void solve(){
	long n = rlong, a = rlong, b = rlong;

	long ans = n / (a + b) * a;
	long d = n % (a + b);
	if(d <= a) ans += d;
	else ans += a;

	ans.writeln;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int N=2e5+50,mod=1e9+7;
int n,c[N],ans,pw[N];
int read(){
    int x=0,c;
    while(!isdigit(c=getchar()));
    while(isdigit(c))x=x*10+c-48,c=getchar();
    return x;
}
int main(){
    n=read();pw[0]=1;
    for(int i=1;i<=n;i++)pw[i]=pw[i-1]*2%mod;
    for(int i=1;i<=n;i++)c[i]=read();
    sort(c+1,c+n+1,[&](int a,int b){
        return a>b;
    });
    for(int i=1;i<=n;i++){
        int dat=pw[i-1];
        if(i>1)dat=(dat+1ll*pw[i-2]*(i-1))%mod;
        ans=(ans+1ll*dat*c[i]%mod*pw[n-i])%mod;
    }
    printf("%d\n",1ll*ans*pw[n]%mod);
    return 0;
}

Measured memory_bytes: 1792
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;

template <typename T>
void print_vec(const vector<T>& v, bool is_reverse=false, int num=0){
  if(num == 0) num = (int)v.size();
  if(is_reverse) for(int i=num-1; i>=0; i--){ cout<<v[i]; if(i!=0) cout<<" ";}
  else for(int i=0; i<num; i++){ cout<<v[i]; if(i!=num-1) cout<<" ";}
  cout << endl;
}

template <typename T>
void print_pairvec(const vector<T> &v, int num=0){
  if(num == 0) num = (int)v.size();
  cout << endl;
  for(int i=0; i<num; i++){ cout << v[i].first << " " << v[i].second << endl;}
}


template <typename TYPE>
void print_vec2(const vector<vector<TYPE>>& v){
  cout << endl; cout << "       ";
  for(int i=0; i<v[0].size(); i++) cout << i << "   "; 
  cout << endl;
	for(int i=0; i<v.size(); i++){
		cout << "i=" << i << ":   ";
		for(int j=0; j<v[i].size(); j++){
			if(v[i][j] == 0) cout << "\x1B[0m" << v[i][j] << "   ";
      else cout << "\x1B[31m" << v[i][j] << "   ";//https://stackoverrun.com/ja/q/12618775
		}
		cout << "\x1B[0m" << endl;
	}
}

int main(){
  ll W, H, x, y;
  cin >> W >> H >> x >> y;
  long double S = W * H /2.0;
  // ll S = W * H;
  ll ans = 0;
  if(W == 2*x && H == 2*y) ans = 1;

 cout << fixed;//小数点を確実に10桁で表示するためのもの
 cout << setprecision(10); 

  cout << S << " " << ans << endl;
//  if(S%2 == 0) cout << S/2 << " " << ans << endl;
//  else cout << S/2 << ".5 " << ans << endl;

	return 0;
}



Measured memory_bytes: 3760
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
using namespace std;
const int maxn = 1e5 + 50;
const int mod = 1e9+7;
int n, m;
int d[maxn], deg[maxn];
vector<int> G[maxn];
bool vis[maxn];
int dfs(int u){
    vis[u] = true;
    if((int)G[u].size() == 0) {return 0;}
    int sum = 0;
    int val;
    for(int i = 0; i < G[u].size(); i++){
        if(!vis[G[u][i]])  val = dfs(G[u][i]) + 1;
        else val = d[G[u][i]] + 1;
        sum = max(sum, val);
    }
    d[u] = sum;
    return sum;
}

int main(){
    int x, y;
    scanf("%d%d",&n, &m);
    for(int i = 0; i < m; i++){
        scanf("%d%d", &x, &y);
        G[x].pb(y);
        deg[y]++;
    }
    int ans = 0;
    for(int i = 1; i <= n; i++)if(deg[i] == 0){
        ans = max(dfs(i), ans);
    }
    printf("%d\n", ans);
    return 0;
}





Measured memory_bytes: 11264
#include <iostream>
#define rep(i, n) for(int i = 0; i < n; ++i)
using namespace std;

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

  // Rx+By+Gz = N
  int R, G, B, N; cin >> R >> B >> G >> N;
  int ans = 0;
  rep(x, N+1) rep(y, N+1) {
      int z = N - R*x - B*y;
      if(z >= 0 && z%G==0) ++ans;
  }
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 256
def trial_division(n):
    a = []  
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2   
    if n != 1: a.append(n)

    return a

from fractions import gcd

A,B = map(int,input().split())

g = gcd(A,B)

L = trial_division(g)

D = {}

for i in L :
    if i not in D :
        D[i] = 1

print(len(D)+1)


Measured memory_bytes: 5688
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main() {
 int a,b,c;
 cin >> a >> b >> c;
 if((100*a+10*b+c)%4==0){
  cout << "YES" << endl;
 }else{
  cout << "NO" << endl;
 }
 return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define st first
#define nd second
#define PQ priority_queue

using ll = long long ;
using namespace std;
using pii = pair<int,int>;
const int N = 8e5 + 10;
const int mod = 0;
struct lazy{
	int a[N];
	int lazy[N];
	const int INF = 1e9;
	void build(int id, int l, int r, int val){
		if(l > r) return;
		a[id] = val;
		lazy[id] = INF;
		if(l == r) return;
		int mid = (l + r) >> 1;
		build(2*id, l, mid, val), build(2*id + 1, mid + 1, r, val);
	}
	void push(int id, int l, int r){
		if(l == r || lazy[id] == INF) return;
		a[2 * id] = min(a[2 * id], lazy[id]);
		a[2 * id + 1]= min(a[2 * id+1], lazy[id]);
		lazy[2 * id + 1]= min(lazy[2 * id + 1], lazy[id]);
		lazy[2 * id] = min(lazy[2 * id], lazy[id]);
		lazy[id] = INF;
	}
	void update(int id, int val, int l, int r, int L, int R){
		if(R == 0) return;
		if(l > R || r < L) return;
		push(id, l, r);
		a[id] = min(a[id], val);
		if(l >= L && r <= R){
			lazy[id] = val;
			return;
		}
		update(2 * id, val, l, (l + r >> 1), L, R);
		update(2 * id + 1, val, (l + r >> 1) + 1, r, L, R);
	}
	int query(int id,int l, int r, int L, int R){
		if(R == 0) return 0;
		if(l > R || r < L) return INF;
		push(id, l, r);
		if(l >= L && r <= R) return a[id];
		int ret = min(query(2 * id, l, l + r>> 1, L, R), query(2 * id + 1, (l + r >> 1) + 1, r, L, R));
		return ret;
	}
}row, col;
int main(){
	int n, q;
	scanf("%d %d", &n, &q);
	ll ans = 1LL * (n - 2) * (n - 2);
	row.build(1, 1, n - 2, n - 2);
	col.build(1, 1, n - 2, n - 2);
	for(int i = 1; i <= q; i++){
		int x, y;
		scanf("%d %d" ,&x, &y);
		if(x == 1){
			int k = col.query(1, 1, n - 2, y - 1, y - 1);
			ans -= 1LL * k;
			row.update(1, y - 2, 1, n - 2, 1, k);
		}
		else if(x == 2){
			int k = row.query(1, 1, n-2, y - 1, y - 1);
			ans -= 1LL * k;
			col.update(1, y - 2, 1, n - 2, 1, k);
		}
	}
	printf("%lld", ans);
}

Measured memory_bytes: 11988
N = int(input())
l = [0]*(N+1)

for i in range(N+1):
    if i == 0:
        l[i] = 2
    elif i == 1:
        l[i] = 1
    else:
        l[i] = l[i-1] + l[i-2]

print(l[N])

Measured memory_bytes: 3060
N = int(input())
F, P = [], []
for i in range(N):
    F.append([int(Fi) for Fi in input().split()])
for i in range(N):
    P.append([int(Pi) for Pi in input().split()])

def profit(action):
    p = 0
    for i in range(N):
        ci = sum([int(action[j]) * F[i][j] for j in range(10)])
        p += P[i][ci]
    return p

pmax = -float('inf')
for i in range(1, 1024):
    pmax = max(pmax, profit(format(i, '010b')))
print(pmax)

Measured memory_bytes: 3064
//abc050_b.cpp
//Sun Oct 21 17:14:20 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;
	cin >> n;

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

	int m;
	cin >> m;
	int p[m],x[m];
	for (int i=0;i<m;i++){
		cin >> p[i] >> x[i];
		cout << total - t[p[i]-1] + x[i] << endl;
	}

}

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

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

    if ((a + b == c || b + c == a || c + a == b))
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <set>
#include <algorithm>
#include <array>
#include <complex>
#include <string>
#include <utility>
#include <map>
#include <queue>
#include <list>
#include <functional>
#include <numeric>
#include <stack>
#include <tuple>
#include <fstream>
using namespace std;
int dx[4] = { -1,0,1,0 };
int dy[4] = { 0,1,0,-1 };
const int INF = 100000000;
const long long LINF = 1000000000000000000;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-6;
const double pi = 3.14159265359;
using pii = std::pair<int, int>;
using ll = long long;
using pLL = std::pair<ll, ll>;
#define SORT(v) std::sort(v.begin(), v.end())
#define RSORT(v) std::sort(v.rbegin(), v.rend())
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define Rep(i, n) for (int i = (int)(n-1); i >= 0; i--)
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int N;
    cin >> N;
    vector<ll> a(N+1),b(N);
    rep(i, N+1) cin >> a[i];
    rep(i, N) cin >> b[i];
    ll ans = 0;
    rep(i, N) {
        ll kill = 0;
        kill += min(a[i], b[i]);
        kill += min(a[i + 1], (b[i] - min(a[i], b[i])));
        a[i + 1] -= min(a[i+1], (b[i] - min(a[i], b[i])));
        ans += kill;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include<sstream>
#include<string>
#include<vector>
#include <cmath>
#include <limits>
#include <queue>
#include<algorithm>
#include<cstring>
#include <cstdlib>
#include <cstdio>
#include <set>
#include <iomanip>
#include <map>
#include <stack>
 
using namespace std;
 
#define rep(i,n) for (int (i)=0;(i)<(n);i++)
const int maxV = 1e5;
const int NIL = -1;


struct Node{
    int parent, left, right;
};


int getDepth(int id, Node T[], int n){
    int now = T[id].parent;
    int depth = 0;
    while (now != NIL){
        ++depth;
        now = T[now].parent;
    }
    return depth;
}


int getHeight(int id, Node T[], int n){
    int h1 = 0, h2 = 0;
    if (T[id].right != NIL) h1 = getHeight(T[id].right, T, n)+1;
    if (T[id].left != NIL) h2 = getHeight(T[id].left, T, n)+1;
    if (h1 > h2) return h1;
    else return h2;
}


void printSibling(int id, Node T[], int n){
    int parent, sibling;
    parent = T[id].parent;
    if (parent == NIL) sibling = NIL;
    else if (T[parent].left == NIL || T[parent].right == NIL) sibling = NIL;
    else if (T[parent].left == id) sibling = T[parent].right;
    else sibling = T[parent].left;
    cout << "sibling = " << sibling << ", ";
}


void printDegree(int id, Node T[], int n){
    int degree;
    if (T[id].left == NIL && T[id].right == NIL) degree = 0;
    else if (T[id].left == NIL || T[id].right == NIL) degree = 1;
    else degree = 2;
    cout << "degree = " << degree << ", ";
}


void printType(int id, Node T[], int n){
    if (T[id].parent == NIL) cout << "root";
    else if (T[id].left == NIL && T[id].right == NIL) cout << "leaf";
    else cout << "internal node";
}


int main(){
    int n;
    cin >> n;
    Node T[n];
    rep(i,n) T[i].parent = T[i].left = T[i].right = NIL;
    int id,left,right;
    rep(i,n){
        cin >> id >> left >> right;
        T[id].left = left;
        T[id].right = right;
        T[left].parent = T[right].parent = id;
    }
    rep(i,n){
        cout << "node " << i << ": ";
        cout << "parent = " << T[i].parent << ", ";
        printSibling(i,T,n);
        printDegree(i,T,n);
        cout << "depth = " << getDepth(i,T,n) << ", ";
        cout << "height = " << getHeight(i,T,n) << ", ";
        printType(i,T,n); cout << endl;
    }

    return 0;
}



Measured memory_bytes: 3076
#include <bits/stdc++.h> 
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
#include<cmath>
#include<string>
#define pb push_back
#define ll long long
#define ull unsigned long long
#define deb(x) cerr<<#x<<" "<<x<<"\n"
#define debi cerr<<"hey sparky\n"
#define x first
#define y second
#define fast ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define eps (double)1e-9
#define all(x) x.begin(),x.end()
#define int long long
using namespace std;
using namespace __gnu_pbds; 
typedef tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> pdbs;
 
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
//void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}
 
template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
 
// look for  all edge cases
//search for a pattern

//const int nax = 1e5 + 2;
 




signed main() {    
    ios::sync_with_stdio(0);
    cout.tie(0);
    cin.tie(0);
    
    int n;
    cin >> n;
    if(n%2 == 0){
		cout<<"-1";
	}   
	else{
		
		int curr = 7;
		int cnt = 0;
		while(curr != 0 && cnt <= 1e7){
			int temp = curr % n;
			
			if(temp == 0){
				curr = 0;
			}
			else
				curr = temp*10 + 7;
			cnt += 1;
		}
		
		if(curr != 0){
			cout<<"-1\n";
		}
		else
			cout<<cnt;
	}
	 
    return 0;
}


Measured memory_bytes: 3652
n, q = map(int, input().split())
answer = []

size = 1
while size < n :
    size *= 2
size = size * 2 - 1

seg_tree = [2**31 -1 for x in range(size)]

def update(i, x) :
    ind = size // 2 + i
    seg_tree[ind] = x
    
    while ind : 
        ind = (ind - 1) // 2
        ch1 = seg_tree[ind * 2 + 1]
        ch2 = seg_tree[ind * 2 + 2]
        seg_tree[ind] = min(ch1, ch2)
        
def find(s, t, k, l, r) :
    # no overlap
    if r < s or t < l :
        return 10 ** 20
    # total overlap
    if s <= l and r <= t :
        return seg_tree[k]
    # partial overlap
    else :
        vl = find(s, t, k * 2 + 1, l, (l + r) // 2)
        vr = find(s, t, k * 2 + 2, (l + r) // 2 + 1, r)
        
        return min(vl, vr)

for i in range(q) :
    com, x, y = map(int, input().split())
    
    if com == 0 :
        update(x, y)
    else :
        answer.append(find(x, y, 0, 0, size // 2))

for a in answer :
    print(a)
    


Measured memory_bytes: 10496
x,y,a,b,c = map(int,input().split())
r = sorted(list(map(int,input().split())))[::-1]
g = sorted(list(map(int,input().split())))[::-1]
c = sorted(list(map(int,input().split())))[::-1]
l =[]
count = 0
count1=0
for i in range(x):
  l.append(r[i])
for i in range(y):
  l.append(g[i])
l = sorted(l)
while count1< len(l) and count<len(c):
  if l[count1] >= c[count]:
    count1+=1
  else:
    l[count1] = c[count]
    count1+=1
    count+=1
print(sum(l))
    

    


Measured memory_bytes: 23328
#include <stdio.h>
#include <vector>
#include <iostream>
#include <queue>
#include <bits/stdc++.h>
 
#define rep(i,n) for (int i=0;i<(n);++i)
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<double> vd;
typedef pair<int, int> pi;


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

  string ans = "YES";
  map<int, int> mp;
  rep(i, n){
    int x;
    cin >> x;
    mp[x]++;
    if (mp[x] > 1) ans = "NO";
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 9600
use std::io::stdin;
use std::io::BufRead;

fn main() {
    let stdin = stdin();
    let mut stdin = stdin.lock();

    let mut n = String::new();
    stdin.read_line(&mut n).unwrap();
    let n = n.trim().parse::<i64>().unwrap();

    let mut house: [[[i8; 10]; 3]; 4] = [
        [
            [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
            [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
            [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
        ], [
            [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
            [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
            [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
        ], [
            [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
            [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
            [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
        ], [
            [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
            [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
            [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
        ]
    ];

    for _ in 0..n {
        let mut data = String::new();
        stdin.read_line(&mut data).unwrap();
        let data = data.split_whitespace().collect::<Vec<_>>();

        let b = data.get(0).unwrap().parse::<i8>().unwrap();
        let f = data.get(1).unwrap().parse::<i8>().unwrap();
        let r = data.get(2).unwrap().parse::<i8>().unwrap();
        let v = data.get(3).unwrap().parse::<i8>().unwrap();

        *house.get_mut(b as usize - 1).unwrap()
            .get_mut(f as usize - 1).unwrap()
            .get_mut(r as usize - 1).unwrap() += v;
    }

    for building in house.iter().enumerate() {
        for floor in building.1.iter().enumerate() {
            for (room_number, tenant_count) in floor.1.iter().enumerate() {
                print!(" {}", tenant_count);
            }
            println!();
        }

        if building.0 != 3 { println!("####################"); }
    }
}


Measured memory_bytes: 5032
/* be name Khoda */
// VJUDGE
#include <bits/stdc++.h>
using namespace std;

const int N = 100 * 1001;
int dp[N], n, m;
vector<int> adj[N];
bool mark[N];

void dfs(int u) {
	mark[u] = true;
	for (auto v : adj[u]) {
		if (!mark[v]) {
			dfs(v);
			dp[u] = max(dp[u], dp[v] + 1);
		}
		dp[u] = max(dp[u], dp[v] + 1);
	}
}

int main() {
	cin >> n >> m;
	for (int i = 0; i < m; i++) {
		int u, v;
		cin >> u >> v;
		u--, v--;
		adj[u].push_back(v);
	}
	for (int i = 0; i < n; i++) 
		if (!mark[i]) 
			dfs(i);
	int maxi = 0;
	for (int i = 0; i < n; i++)
		maxi = max(maxi, dp[i]);
	cout << maxi << endl;
}
		

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

int main(){
    int n, x, t;
    cin >> n >> x >> t;
    int ans = 0;
    while(true){
        ans += t;
        n -= x;
        if(n <= 0){
            cout << ans << endl;
            break;
        }
    }
    return 0; 
}


Measured memory_bytes: 3592
#ifdef _MSC_VER
#include "stdc++.h"
#endif
#ifdef __GNUC__
#include<bits/stdc++.h>
#endif
using namespace std;

using ll = long long;

//vector
using vi = vector<int>;
using vii = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;

//constant
const double EPS = 1e-10;

#define REP(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, s, e) for (ll i = s; i < e; i++)
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(), (x).rend()

//debug
#define DUMP(x)  cerr << #x << " = " << (x) << endl;
#define DEBUG(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl;

// vector
//template<typename T> vector<vector<T>> vv(ll H, ll W, T v) { return vector<vector<T>> vec(H, vector<T>(W, v)); }

// view vector
template<typename T> void view(T e) { cout << e << endl; }
template<typename T> void view(const vector<T>& v) { for (const auto& e : v) { cout << e << " "; } cout << endl; }
template<typename T> void view(const vector<vector<T> >& vv) { for (const auto& v : vv) { view(v); } }

// DP
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 Monoid> struct SegTree {
    using Func = function<Monoid(Monoid, Monoid)>;
    const Func F;
    const Monoid UNITY;
    int SIZE_R;
    vector<Monoid> dat;

    SegTree(int n, const Func f, const Monoid& unity) : F(f), UNITY(unity) { init(n); }
    void init(int n) {
        SIZE_R = 1;
        while (SIZE_R < n) SIZE_R *= 2;
        dat.assign(SIZE_R * 2, UNITY);
    }

    /* set, a is 0-indexed */
    void set(int a, const Monoid& v) { dat[a + SIZE_R] = v; }
    void build() {
        for (int k = SIZE_R - 1; k > 0; --k)
            dat[k] = F(dat[k * 2], dat[k * 2 + 1]);
    }

    /* update a, a is 0-indexed */
    void update(int a, const Monoid& v) {
        int k = a + SIZE_R;
        dat[k] = v;
        while (k >>= 1) dat[k] = F(dat[k * 2], dat[k * 2 + 1]);
    }

    /* get [a, b), a and b are 0-indexed */
    Monoid get(int a, int b) {
        Monoid vleft = UNITY, vright = UNITY;
        for (int left = a + SIZE_R, right = b + SIZE_R; left < right; left >>= 1, right >>= 1) {
            if (left & 1) vleft = F(vleft, dat[left++]);
            if (right & 1) vright = F(dat[--right], vright);
        }
        return F(vleft, vright);
    }
    inline Monoid operator [] (int a) { return dat[a + SIZE_R]; }

    /* debug */
    void print() {
        for (int i = 0; i < SIZE_R; ++i) {
            cout << (*this)[i];
            if (i != SIZE_R - 1) cout << ",";
        }
        cout << endl;
    }
};

int main() {

    int N;
    cin >> N;

    SegTree<ll> st(N + 1, [](ll a, ll b) {return max(a, b); }, 0);

    vll A(N), H(N);
    REP(i, N) cin >> H[i];
    REP(i, N) cin >> A[i];

    ll ans = 0;
    REP(i, N) {
        auto x = st.get(0, H[i]);
        auto y = st.get(H[i], H[i] + 1);
        if (y < x + A[i]) st.update(H[i], x + A[i]);
        chmax(ans, x + A[i]);
    }

    cout << ans << endl;

#ifdef _MSC_VER
    system("PAUSE");
#endif

    return 0;
}

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


#define li          long long int
#define rep(i,to)   for(li i=0;i<((li)(to));i++)
#define repp(i,start,to)    for(li i=(li)(start);i<((li)(to));i++)
#define pb          push_back
#define sz(v)       ((li)(v).size())
#define bgn(v)      ((v).begin())
#define eend(v)     ((v).end())
#define allof(v)    (v).begin(), (v).end()
#define dodp(v,n)       memset(v,(li)n,sizeof(v))
#define bit(n)      (1ll<<(li)(n))
#define mp(a,b)     make_pair(a,b)
#define rin rep(i,n)
#define EPS 1e-12
#define ETOL 1e-8
#define MOD 1000000007
typedef pair<li, li> PI;

#define INF bit(60)

#define DBGP 1


#define idp if(DBGP)
#define F first
#define S second
#define p2(a,b)     idp cout<<a<<"\t"<<b<<endl
#define p3(a,b,c)       idp cout<<a<<"\t"<<b<<"\t"<<c<<endl
#define p4(a,b,c,d)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<endl
#define p5(a,b,c,d,e)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<endl
#define p6(a,b,c,d,e,f)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<endl
#define p7(a,b,c,d,e,f,g)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<endl
#define p8(a,b,c,d,e,f,g,h)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<endl
#define p9(a,b,c,d,e,f,g,h,i)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<endl
#define p10(a,b,c,d,e,f,g,h,i,j)        idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<"\t"<<j<<endl
#define foreach(it,v)   for(__typeof((v).begin()) it=(v).begin(); it!=(v).end(); ++it)
#define p2p(x)      idp p2((x).F, (x).S)
#define dump(x,n)   idp{rep(i,n){cout<<x[i]<<" ";}puts("");}
#define dump2(x,n)  idp{rep(i,n){cout<<"["<<x[i].F<<" , "<<x[i].S<<"] ";}puts("");}
#define dumpi(x)    idp{foreach(it, x){cout<<(*it)<<" ";}puts("");}
#define dumpi2(x)   idp{foreach(it, x){cout<<"["<<(it)->F<<" , "<<(it)->S<<"] ";}puts("");}

#define read2d(a,w,h)   rep(i,h)rep(j,w)cin>>a[i][j]
#define dump2d(a,w,h)   rep(i,h){rep(j,w)cout<<a[i][j]<<" ";puts("");}

typedef pair<li, li> PI;

li p[22];

int main() {
    li n;
    cin >> n;
    rin{
        cin >> p[i];
    }
    sort(p, p + n);
    li res = 0;
    rin{
        res += p[i];
    }
    res -= p[n - 1] / 2;
    cout << res << endl;
    return 0;
}

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

int main()
{
  int n;
  std::cin >> n;
  std::unordered_set<std::string> s;
  for (int i = 0; i < n; ++i)
  {
    std::string tmp;
    std::cin >> tmp;
    s.emplace(tmp);
  }
  std::cout << s.size() << std::endl;
  
  return 0;
}

Measured memory_bytes: 17732