akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <queue>
#include <stack>
#include <utility>
#include <vector>
using std::cin;
using std::cout;
using std::endl;

const int N_MAX = 100000;

int main(void) {
    cout << std::fixed << std::setprecision(10);
    cin.tie(0);
    std::ios::sync_with_stdio(false);
    int64_t n;
    int64_t result = 0;
    cin >> n;
    std::vector<int64_t> a, b, c;
    for (int64_t i = 0; i < n; i++) {
        int64_t m1;
        cin >> m1;
        a.push_back(m1);
    }
    for (int64_t i = 0; i < n; i++) {
        int64_t m1;
        cin >> m1;
        b.push_back(m1);
    }
    for (int64_t i = 0; i < n; i++) {
        int64_t m1;
        cin >> m1;
        c.push_back(m1);
    }
    std::sort(a.begin(), a.end());
    std::sort(b.begin(), b.end());
    std::sort(c.begin(), c.end());

    // cout << "sort is finished" << endl;

    int64_t match[N_MAX]={};
    int64_t pos_c = 0;
    for (int64_t pos_b = 0; pos_b < n; pos_b++) {
        while (b[pos_b] >= c[pos_c] && pos_c < n) {
            pos_c++;
        }
        if (pos_c != n) {
            match[pos_b] = n - pos_c;
        }
    }
    int64_t cum_match[N_MAX]={};
    cum_match[0] = match[0];
    // cout << "cum_match "
    //      << "0"
    //      << " is " << cum_match[0] << endl;
    for (int64_t i = 1; i < n; i++) {
        cum_match[i] = match[i] + cum_match[i - 1];
        // cout << "cum_match " << i << " is " << cum_match[i] << endl;
    }

    // cout << "setup finished" << endl;

    int64_t pos_b_ = 0;
    for (int64_t pos_a = 0; pos_a < n; pos_a++) {
        while (a[pos_a] >= b[pos_b_] && pos_b_ < n) {
            pos_b_++;
        }
        if (pos_b_ >= 1) {
            result += cum_match[n - 1] - cum_match[pos_b_ - 1];
        } else if (pos_b_ == 0) {
            result += cum_match[n - 1];
        } else {
            // nothing
        }
        // cout << result << endl;
    }
    cout << result << endl;

    return 0;
}


Measured memory_bytes: 4340
from collections import deque

n, m = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(m)] #Ex.ab = [[A1,B1],[A2,B2],…[]]
 
ans = [-1 for _ in range(n)] # 道標を記録。最後にこれを出力。
ans[0] = 0
tree = [[] for _ in range(n)] # 部屋間のつながりを記録
for a, b in ab:
    tree[a-1].append(b-1)
    tree[b-1].append(a-1)
#　Ex.　tree = [[2,4][3]…[]]

q = deque([0]) #キュー。次に探索する部屋を記録していく。最初は0が格納。
while q: #キューが空になれば終了。
    p = q.popleft() #キューなので左から取り出す。
    for i in tree[p]:
        if ans[i] < 0: # visit[i] >= 0なら既に探索しているので無視。
            ans[i] = p
            q.append(i) #新たにキューに加える。

print("Yes")
for i in ans[1:]:
    print(i+1)

Measured memory_bytes: 71020
n, k = map(int, input().split())
ps = [tuple(map(int, input().split())) for i in range(n)]
sx = sorted(ps)
nx = list(enumerate(sx))

ans = 5e18
for l, (x1, y1) in nx[:n - k + 1]:
    for r, (x2, y2) in nx[l + k - 1:]:
        dx = x2 - x1
        sy = sorted(y for x, y in sx[l:r + 1])
        for y3, y4 in zip(sy, sy[k - 1:]):
            if y3 <= y1 and y2 <= y4:
                ans = min(ans, dx * (y4 - y3))
print(ans)


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
double getExpected(int n)
{
    double ret = 0;
    for(int i = 1; i <= n; i++)
        ret += ((double)i / (double)n);
    return ret;
}
int main()
{
    int n, k;
    cin >> n >> k;
    double ans[n + 5], sum[n + 5] = {}, mx = 0;
    for(int i = 0, a; i < n; i++)
    {
        cin >> a;
        ans[i] = getExpected(a);
    }
    for(int i = 1; i <= n; i++)
        sum[i] = sum[i - 1] + ans[i - 1];
    /*for(int i = 0; i < n; i++)
        cout << ans[i] << " ";
    cout << endl;
    for(int i = 0; i <= n; i++)
        cout << sum[i] << " ";
    cout << endl << endl;*/
    for(int i = k; i <= n; i++)
        mx = max(mx, sum[i] - sum[i - k]);
    cout << fixed << setprecision(6) << mx;
    return 0;
}


Measured memory_bytes: 3328
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int k = sc.nextInt();
		long count = 0L;
		while (n > 0) {
			++count;
			n /= k;
		}
		System.out.println(count);
	}
}


Measured memory_bytes: 21332
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;

namespace MyProject
{
    class Program
    {
        static void Main(string[] args)
        {
#if Local
            var sw = new Stopwatch();
            sw.Start();
            Console.SetIn(new StreamReader("input.in"));
#endif

            var solver = new Solver();
            solver.Solve();
#if Local
            Console.WriteLine($"{sw.ElapsedMilliseconds}ms");
#endif
        }
    }

    class Solver
    {
        public void Solve()
        {
            var items = Console.ReadLine().Split().Select(elem => int.Parse(elem)).ToArray();
            var K = items[0];
            var X = items[1];
            var answer = (500 * K) >= X ? "Yes" : "No"; 

            Console.WriteLine(answer);
        }
    }
}


Measured memory_bytes: 13268
import math
from typing import List, Any


def read_int() -> int:
    return int(input().strip())


def read_ints() -> List[int]:
    return list(map(int, input().strip().split(' ')))


def solve() -> Any:
    N = read_int()
    answer = 0
    INF = 10**10
    XL = []
    for i in range(N):
        XL.append(read_ints())
    XL.sort(key=lambda xl: xl[0]+xl[1])
    current = -INF
    for x, l in XL:
        if x-l >= current:
            answer += 1
            current = x+l
    return answer


if __name__ == '__main__':
    print(solve())


Measured memory_bytes: 96288
# エラトステネスを素因数分解とlcm


N = int(input())
A = list(map(int, input().split()))
mod = 10 ** 9 + 7

def inverse(a): #aに対し、a**(mod-2)、つまり逆元を返す
  return pow(a, mod-2, mod)

def eratosthenes(n): #エラストテネスの篩(最大の素因数を格納した配列)
    A = [0] * n
    A[0], A[1] = -1, -1
    for i in range(2, n):
      if A[i] == 0:
        j = i
        while j < n:
          A[j] = i
          j += i
    return A

E = eratosthenes(10**6+5)
l = {}

for a in A:
  now = a
  f = [] #素因数格納配列

  while now > 1:
    f.append(E[now])
    now //= E[now]

  chk = 0 

  for p in f:
    if chk == p: #同じ素因数が複数あるときに飛ばす
      continue
    chk = p
    if p in l.keys(): #辞書に素因数がある場合、個数の多いほう
      l[p] = max(l[p], f.count(p))
    else: #辞書にない場合新規追加
      l[p] = f.count(p)
 
lcm = 1
for k in l:
  for i in range(l[k]):
      lcm= lcm * k % mod

s = 0
for i in range(N):
    s += lcm * inverse(A[i])
    s %= mod
print(s)

Measured memory_bytes: 15664
#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 f(ll a, ll b)
{
  ll mx = max(a, b);
  int cnt = 0;
  while (mx)
  {
    mx /= 10;
    cnt++;
  }
  return cnt;
}

int main()
{
  ll n;
  cin >> n;
  int nn = (int)sqrt(n) + 1;
  int ans = 1e9;
  for (int i = 1; i <= nn; i++)
  {
    if (n % i == 0)
    {
      ll j = n / i;
      int cnt = f(i, j);
      ans = min(cnt, ans);
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3664
from collections import defaultdict


def resolve():
    d = defaultdict(int)
    ab = list(list(map(int, input().split())) for _ in range(3))
    for a, b in ab:
        d[a] += 1
        d[b] += 1
    print("YES" if set(d.keys()) == {1, 2, 3, 4} and all(v < 3 for v in d.values()) else "NO")


if __name__ == "__main__":
    resolve()


Measured memory_bytes: 38384
#include<iostream>
using namespace std;
int main()
{
	int n,m,t=0,k,l;
	cin>>n>>m>>k;
	for (int i=1;i<=n;i++)
	{
		cin>>l;
		if (l<m||l>=k) t++;
	}
	cout<<t<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define rrep(i,n) for(int i=1;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define maxs(a, b) a = max(a, b)
#define mins(a, b) a = min(a, b)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const ll linf = (1ll << 61);
const int inf = 1001001001;
const int mod = 1000000007;

map<ll, ll> cal(ll a) {
	map<ll, ll> res;
	for (ll i = 2; i * i <= a; ++i) {
		while (a % i == 0) {
			a /= i;
			res[i]++;
		}
	}
	res[1]++;
	if (a != 1) res[a]++;
	return res;
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	ll a, b;
	cin >> a >> b;
	auto mp1 = cal(a);
	auto mp2 = cal(b);
	vector<ll> rec;
	for (auto c : mp1) {
		for (auto c_ : mp2) {
			if (c.first == c_.first) rec.push_back(c.first);
		}
	}
	sort(rec.begin(), rec.end());
	int sz = rec.size();
	set<int> st;
	for (int i = 0; i < sz; ++i) {
		for (int j = i + 1; j < sz; ++j) {
			if (rec[i] != 1 && rec[j] % rec[i] == 0) st.insert(rec[j]);
		}
	}
	cout << sz - (int)st.size() << endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;++i)
#include<string>
#include<vector>
using namespace std;
typedef long long ll;
typedef pair<int, int>P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
//max=({});
//条件式が真ならwhileの中身を回し続ける
//printf("%d\n", ans);

//pairの入力
//vector<pair<ll, ll>>work(n);
//rep(i, n) {
//	ll a, b;
//	cin >> a >> b;
//	work[i] = make_pair(a, b);
//for(auto p:mp)(mapの探索)
//printf("%.10f\n",なんちゃら)

int g[15][15];
const int INF = 1001001001;
const int dx[4] = { -1,0,1,0 };
const int dy[4] = { 0,-1,0,1 };

//最大公約数
ll gcd(ll x, ll y) {
	return y ? gcd(y, x % y) : x;
}

ll lcm(ll x, ll y) {
	if (x == 0 || y == 0)return 0;
	return (x / gcd(x, y) * y);
}

//素因数分解
vector<pair<ll, int>>factorize(ll n) {
	vector<pair<ll, int>>res;
	for (ll i = 2;i * i <= n;++i) {
		if (n % i)continue;
		res.emplace_back(i, 0);
		while (n % i == 0) {
			n /= i;
			res.back().second++;
		}
	}
	if (n != 1)res.emplace_back(n, 1);
	return res;
}

int bingo[3][3];
bool flag[3][3];
int cnt[2][105];
int h, w;
int choco[1010][1010];
int s[11][11];

int main() {
	int n;
	cin >> n;
	vector<int>a(n+2);
	for (int i = 1;i <= n;++i) {
		cin >> a[i];
	}
	ll ans = 0;
	for (int i = 1;i <= n+1;++i) {
		ans += abs(a[i] - a[i - 1]);
	}
	for (int i = 1;i <= n;++i) {
		int res = ans;
		res -= abs(a[i] - a[i - 1]);
		res -= abs(a[i + 1] - a[i]);
		res += abs(a[i + 1] - a[i - 1]);
		cout << res << endl;
	}
	return 0;
}


Measured memory_bytes: 1664
#include<iostream>
#include <algorithm>
#include <functional>
#include<vector>
#include<math.h>
#include<bitset>
#include<string>
#include <deque>
#include<queue>
#include <iomanip>
#include<map>
#include <random>
#include<type_traits>
#include<stack>
#include <sstream> 
using namespace std;


#define ll long long int
#define all(v) begin(v), end(v)
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define reps(i, s, n) for(int i = (int)(s); i < (int)(n); i++)
typedef vector<int> V;
typedef vector<V> VV;
typedef vector<VV> VVV;
typedef pair<int, int> Edge;

vector<long long int> divi;


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


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>

int main(void) {
	int r=0,c=0,tmp=0,sum=0;
	scanf("%d %d", &r, &c);
	int chart[101][101] = { 0 };
	for (int i = 0; i < r; i++) {
		for (int j = 0; j < c; j++) {
			scanf("%d", &tmp);
			//printf("@@%d", tmp);
			chart[i][j] = tmp;
			sum += tmp;
		}
	}
	chart[r][c] = sum;
	for (int i = 0; i < r; i++) {
		int r_sum = 0;
		for (int j = 0; j < c; j++) {
			r_sum += chart[i][j];
		}
		chart[i][c] = r_sum;
	}

	for (int i = 0; i < c; i++) {
		int c_sum = 0;
		for (int j = 0; j < r; j++) {
			c_sum += chart[j][i];
		}
		chart[r][i] = c_sum;
	}

	for (int i = 0; i <= r; i++) {
		for (int j = 0; j <= c; j++) {
			if (j == c) {
				printf("%d",chart[i][j]);
			}
			else {
			printf("%d ", chart[i][j]);
			}
		}
		printf("\n");
	}
	return 0;
}

Measured memory_bytes: 2752
A, B =list(map(int, input().split()))
i=0
for N in range(1,1001):
    N_a=int(N*0.08)
    N_b=int(N*0.1)
    
    if A==N_a and B==N_b:
        print(N)
        i+=1
        break
if i==0:
    print(-1)

Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>
#include <limits>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <vector>
#include <deque>
#include <stack>
#include <queue>
#include <vector>
#include <deque>
#include <cmath>

using namespace std;
const int mod = 998244353;
int n, k;

int main() {
    scanf("%d %d", &n, &k);
    vector<pair<int, int>> s;
    for (int i = 0; i < k; ++i) {
        int l, r;
        scanf("%d %d", &l, &r);
        s.push_back({l, r});
    }

    vector<long long> cnt(n + 1, 0);
    vector<long long> preSum(n + 1, 0);
    cnt[1] = 1;
    preSum[1] = 1;
    for (int i = 2; i <= n; ++i) {
        for (int j = 0; j < k; ++j) {
            int l = i - s[j].second;
            int r = i - s[j].first;
            if (r < 0) continue;
            l = max(1, l);
            cnt[i] += preSum[r] - preSum[l - 1];
            cnt[i] %= mod;
        }
        preSum[i] = preSum[i - 1] + cnt[i];
    }
    printf("%lld\n", cnt[n]);
    return 0;
}

Measured memory_bytes: 6416
import sys
 
IDX_TBL = {1:[2,3,5,4], 2:[3,1,4,6], 3:[1,2,6,5],
           4:[1,5,6,2], 5:[1,3,6,4], 6:[2,4,5,3]}
OPPSITE_TBL = {1:6, 2:5, 3:4, 4:3, 5:2, 6:1}

def is_same(l1, l2):
    if l1[1] in l2:
        idx_list = [i for i,x in enumerate(l2) if x==l1[1]]
        for idx in idx_list:
            nstr1 = "".join([l1[i] for i in IDX_TBL[1]])
            nstr2 = "".join([l2[i] for i in IDX_TBL[idx]])
            if nstr2 in nstr1*2:
                if l1[6] == l2[7-l2.index(l1[1])]:
                    return True
    return False

n=input()
nums_list = []
for _ in range(n):
    nums_list.append(["_"] + raw_input().split(" "))

for i in range(0, n):
    for j in range(i+1, n):
        if is_same(nums_list[i], nums_list[j]):
            print "No"
            sys.exit(0)
print "Yes"

Measured memory_bytes: 4300
#include<bits/stdc++.h>
#define int long long int
#define ld long double
#define getFaster ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define rep(i,init,n) for(int i=init;i<n;i++)
#define rev(i,n,init) for(int i=n;i>=init;i--)
#define MAXN 200005
#define MOD2 998244353
#define MOD1 1e9+7
#define f first
#define s second
#define endl '\n'
#define pii pair<int,int>
#define piii pair<pii,int>
#define precise(i) cout<<fixed<<setprecision(i)
#define codejam cout<<"Case #"<<ii+1<<": ";
#define impossible cout<<"IMPOSSIBLE"<<endl;
#define error(s) throw runtime_error(s)
using namespace std;
const long double PI = atan(1.0)*4;
const int64_t INF=8e18;
const int32_t LOG=21;
const int MOD=MOD1;

int32_t main()
{ 
      getFaster;
      int tests=1;
      //cin>>tests;
      rep(ii,0,tests)
      {
         int a,b;
         cin>>a>>b;
         if(b>=a)cout<<"unsafe"<<endl;
         else cout<<"safe"<<endl;
      }     
      return 0;                         
}

/*
 TIPS:
 1.) Check for corner cases (like 0 is exception case)
 2.) Check for global memory sizes,memory refreshments and its complexity 
 3.) Check for sorting criteria (if used 1-based indexing)
 4.) Check for numbers overflow (while multiplying and doing MOD)
 5.) Check for typecasting issues like int to float( while dividing numbers)
*/

Measured memory_bytes: 3640
//======================================================================
// Contents    : AOJ ITP1_5_D
//               n までの整数のうち、以下を出力
//                 ・ 3 で割り切れる整数
//                 ・ いずれかの桁に 3 があるとき
// Input       : n
// Output      : ans
//             : exp) n = 30 の入力時、以下のように出力される
//                    " 3 6 9 12 13 15 18 21 23 24 27 30"
// Constraints : 3 ≤ n ≤ 10000
//               数字の前に空白
// Author      : 廣部智也
// LastUpdate  : 2020/06/05
// Since       : 2020/06/05
//======================================================================

#include <stdio.h>
#include <stdlib.h>                                                 // exit 関数を使用するため

#define LOWER_LIMIT     3
#define UPPER_LIMIT 10000

int Input_error( int number, int Lower_limit, int Upper_limit );    // 入力エラーを判断する関数

void Multiples3_or_anydigit3( int n );

int main(){

    int n = 0;
        
    // データの入力
	scanf("%d", &n );

    // 入力エラーの判断
    Input_error( n, LOWER_LIMIT, UPPER_LIMIT );

    // データの演算と出力
    Multiples3_or_anydigit3( n );

	return 0;
}



//============================================================
// Contents    : 入力エラーを判断
// Input       : 調べる変数, 下限, 上限
// Output      : エラーなら強制終了
// Author      : 廣部智也
// LastUpdate  : 2020/06/05
// Since       : 2020/06/05
//============================================================

int Input_error( int number, int Lower_limit, int Upper_limit ){
    
    if( number < Lower_limit || number > Upper_limit ){ 
        printf("Input error\n");
        exit(1);
    }

    return 0;
}



//============================================================
// Contents    : n までの整数のうち、以下を出力
//                 ・ 3 で割り切れる整数
//                 ・１桁目が 3 の整数 (10で割ると3余る)
// Input       : n
// Output      : '#'と'.'
// Author      : 廣部智也
// LastUpdate  : 2020/06/05
// Since       : 2020/06/05
//============================================================

void Multiples3_or_anydigit3( int n ){

    int i = 0;
    int x = 0;

    for(i = 1; i <= n ; i++ ){

        if( i % 3 == 0 ){                       // 3の倍数を出力
            printf(" %d",i );
        }

        else{
            x = i;
            while( x > 0){                     // 3がつく数字を出力

                if ( x % 10 == 3 ){
                    printf(" %d",i);
                    break;                     // 133などが続けて出力されないため
                }

                x /= 10;

            }
        }

    }

    putchar('\n');  

    return;
}                                            


Measured memory_bytes: 2092
fun main(args: Array<String>) {
    agc006a()
}

fun agc006a() {
    val n = readLine()!!.toInt()
    val s = readLine()!!
    val t = readLine()!!

    for (i in 0 until n) {
        if (s.substring(i..s.lastIndex) == t.substring(0..s.lastIndex - i)) return println(n + i)
    }

    return println(n * 2)
}


Measured memory_bytes: 33732
import java.util.Scanner;
 
public class Main{
    public static void main(String[] args){
     Scanner scan = new Scanner(System.in);
     int a = scan.nextInt();
     int b = scan.nextInt();
     if( a < b ) {
         System.out.println("a < b");
     }else if( a > b ){
         System.out.println("a > b");
     }else{
         System.out.println("a == b");
     }
    }
}


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

using namespace std;
#define ll long long int

int main()
{
   ll t;
   t = 1;	
   //cin >> t;
   while(t--){
          ll x;
          cin >> x;
          int count = 0;
          ll total = 100;
          while(total < x)
          {
              total += total / 100;
              count ++;
          }   
          cout << count << endl;
   }
}


Measured memory_bytes: 3568
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <set>
#include <tuple>
#include <map>
#include <cmath>
#include <numeric>
#include <utility>

using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;
typedef pair<ll, ll> Pl;
typedef tuple<ll, ll, ll> Tl;

#define REP(i,n) for(int i=0;i < n;i++)
#define EACH(it,a) for(auto it=a.begin();it!=a.end();it++)

int main() {
		int n,u,v,m;cin >> n >> u >> v >> m;
		vector<vector<int>> us(n,vector<int>(n)),ns(n,vector<int>(n));

		REP(y,n)REP(x,n) cin >> us[y][x];
		REP(y,n)REP(x,n) cin >> ns[y][x];

		map<int,pair<int,int>> umap,nmap;
		
		vector<int> ms(m);
		REP(i,m) cin >> ms[i];

		REP(y,n)REP(x,n)umap[us[y][x]]=make_pair(y,x);
		REP(y,n)REP(x,n)nmap[ns[y][x]]=make_pair(y,x);
		
		int win=0;int uc=0,nc=0;
		vector<int> utate(n),uyoko(n);int ucross1=0,ucross2=0;
		vector<int> ntate(n),nyoko(n);int ncross1=0,ncross2=0;
		

		REP(i,m){
			if(umap.count(ms[i])){
				pair<int,int> p=umap[ms[i]];
				int y=p.first,x=p.second;
				uyoko[y]++;
				if(uyoko[y]==n)uc++;

				utate[x]++;
				if(n>1 && utate[x]==n)uc++;

				if(n>1 && x+y==n-1){
					ucross1++;
					if(ucross1==n)uc++;
				}
				if(n>1 && y-x==0){
					ucross2++;
					if(ucross2==n)uc++;
				}
			}
			if(nmap.count(ms[i])){
				pair<int,int> p=nmap[ms[i]];
				int y=p.first,x=p.second;
				nyoko[y]++;
				if(nyoko[y]==n)nc++;

				ntate[x]++;
				if(n>1 && ntate[x]==n)nc++;

				if(n>1 && x+y==n-1){
					ncross1++;
					if(ncross1==n)nc++;
				}
				if(n>1 && y-x==0){
					ncross2++;
					if(ncross2==n)nc++;
				}
			}
		
			//cerr << i<<" "<<uc<<" "<<nc<<endl;
			if(uc>=u && nc<v)win=1;
			else if(uc<u && nc>=v)win=-1;
		}

		if(win==1) cout << "USAGI" << endl;
		if(win==-1) cout << "NEKO" << endl;
		if(win==0) cout << "DRAW" << endl;
}

Measured memory_bytes: 20316
#include <bits/stdc++.h>
#define fi first
#define se second
#define pb push_back

using namespace std;
typedef long long ll;

const int MAXN = 3000 + 7;
const int SS = 1<<20;
const long long INF = 1000*1000*1000 + 7;

int val[MAXN][MAXN];
long long dp[MAXN][MAXN][4];
int n, m, k;

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

	int T;
	//cin >> T;
	T = 1;
	while(T--)
	{
		cin >> n >> m >> k;
		for(int i=1; i<=k; i++)
		{
			int r, c, v;
			cin >> r >> c >> v;
			val[r][c] = v;
		}
		long long res = 0;
		for(int i=0; i<=n+1; i++)
			dp[i][0][1] = dp[i][0][2] = dp[i][0][3] = -(INF*INF);
		for(int j=0; j<=m+1; j++)
			dp[0][j][1] = dp[0][j][2] = dp[0][j][3] = -(INF*INF);
		for(int i=1; i<=n; i++)
		{
			for(int j=1; j<=m; j++)
			{
				for(int l=0; l<=3; l++)
					dp[i][j][l] = dp[i][j-1][l];
				dp[i][j][0] = max({dp[i-1][j][0], dp[i-1][j][1], dp[i-1][j][2], dp[i-1][j][3], dp[i][j][0]});
				dp[i][j][1] = max(val[i][j] + max({dp[i-1][j][0], dp[i-1][j][1], dp[i-1][j][2], dp[i-1][j][3]}), dp[i][j][1]);
				for(int l=3; l>=1; l--)
					dp[i][j][l] = max({dp[i][j-1][l-1] + val[i][j], dp[i][j][l]});
				//cout << i << ' ' << j << ": " << dp[i][j][0] << " " << dp[i][j][1] << " " << dp[i][j][2] << " " << dp[i][j][3] << '\n';
				for(int l=0; l<=3; l++)
					res = max(dp[i][j][l], res);
			}
		}
		cout << res << '\n';
	}
	return 0;
}


Measured memory_bytes: 320760
#include <bits/stdc++.h>
#include <iomanip>
#include <ios>

using namespace std;

int main(int argc, const char *argv[]) {
  int r;
  cin >> r;
  cout << fixed << setprecision(9) << r * 2 * 3.14159265359 << '\n';
  return 0;
}

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

#ifdef LOCAL
#define debug(var) cerr << (#var) << " = " << (var) << endl;
#else
#define debug(var)
#endif

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

void solve() {
  int n; scanf("%d", &n);
  printf("%d\n", n*(n-1)/2 - n/2);
  for (int i = 1; i < n; ++i) {
    for (int j = i+1; j <= n; ++j) {
      if (n%2 == 0 && j == n-i+1) continue;
      if (n%2 == 1 && j == n-i) continue;
      printf("%d %d\n", i, j);
    }
  }
}

int main() {
  init();
  int t = 1; //scanf("%d", &t);
  while (t--) {
    solve();
  }
  return 0;
}


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

int n;
map<string, int> mp;

int main(){
  cin >> n;
  rep(i, n){
    string s; cin >> s;
    mp[s]++;
  }
  int M = 0;
  for(pair<string, int> x : mp){
    M = max(x.second, M);
  }
  for(pair<string, int> x : mp){
    if(x.second == M){
      cout << x.first << endl;
    }
  }
  return 0;
}


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

int main()
{
  int n, m;
  priority_queue<int64_t> a;

  cin >> n >> m;

  for (int i = 0; i < n; i++) {
    int64_t t;
    cin >> t;
    a.push(t);
  }

  for (int i = 0; i < m; i++) {
    int t = a.top();
    a.pop();
    a.push(t / 2);
  }

  int64_t ans = 0;

  while (!a.empty()) {
    ans += a.top();
    a.pop();
  }

  cout << ans << endl;
}


Measured memory_bytes: 1400
#include <bits/stdc++.h>
#include <numeric>
using namespace std;
using ll = long long;

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

  int n, k;
  cin >> n >> k;

  ll h[n];
  for (int i = 0; i < n; ++i) cin >> h[i];

  sort(h, h+n, greater<ll>());
  for (int i = 0; i < min(k, n); ++i) h[i] = 0;

  cout << accumulate(h, h+n, 0LL) << '\n';

  return (0);
}


Measured memory_bytes: 5212
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,m,n) for(int i=(m);i<(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
using ll = long long;
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-8;
const int MOD = 1000000007;
// const int MOD = 998244353;
const int dy[] = {1, 0, -1, 0}, dx[] = {0, -1, 0, 1};
const int dy8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dx8[] = {0, -1, -1, -1, 0, 1, 1, 1};
template <typename T, typename U> inline bool chmax(T &a, U b) { return a < b ? (a = b, true) : false; }
template <typename T, typename U> inline bool chmin(T &a, U b) { return a > b ? (a = b, true) : false; }
struct IOSetup {
  IOSetup() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);
  }
} iosetup;

int main() {
  const int X = 28;
  int n, t; cin >> n >> t;
  vector<int> a, b;
  vector<ll> zero;
  while (n--) {
    int ai, bi; cin >> ai >> bi;
    if (ai == 0) {
      zero.emplace_back(bi);
    } else {
      a.emplace_back(ai);
      b.emplace_back(bi);
    }
  }
  n = a.size();
  int m = zero.size();
  sort(ALL(zero));
  REP(i, m) {
    ++zero[i];
    if (i > 0) zero[i] += zero[i - 1];
  }
  vector<int> idx(n);
  iota(ALL(idx), 0);
  sort(ALL(idx), [&](int l, int r) { return 1LL * a[l] * (b[r] + 1) > 1LL * a[r] * (b[l] + 1); });
  // REP(i, n) cout << idx[i] << " \n"[i + 1 == n];
  vector<vector<ll> > dp(n + 1, vector<ll>(X + 1, INF));
  dp[0][0] = 0;
  REP(i, n) {
    int now = idx[i];
    REP(j, X + 1) {
      chmin(dp[i + 1][j], dp[i][j]);
      if (j + 1 <= X) chmin(dp[i + 1][j + 1], dp[i][j] + 1 + (dp[i][j] + 1) * a[now] + b[now]);
    }
  }
  int ans = 0;
  REP(j, X + 1) {
    if (dp[n][j] <= t) chmax(ans, j + upper_bound(ALL(zero), t - dp[n][j]) - zero.begin());
  }
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 54124
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a;
  int b;
  int c;
  
  cin >> a;
  cin >> b;
  cin >> c;
  
  if(a*b<c)
     cout << a*b << endl;
  else
     cout << c << endl;
}

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

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

int a, b;

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

	int t = 0;

	rep(i, b - a) {
		t += i + 1;
	}

	cout << t - b << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  long long n;cin >> n;
  string s = "";
  while(n){
    n--;
    s += char('a'+n%26);
    n /= 26;
  }
  reverse(s.begin(),s.end());
  cout << s << "\n";
}

Measured memory_bytes: 3628
N, Y = map(int, input().split())

aMax = Y//10000

flag = False

for i in range(aMax+1):
    for j in range(N-i+1):
        if i*10000 + j*5000 + (N-i-j)*1000 == Y:
            a = i
            b = j
            c = N-i-j
            flag = True
            break
    if flag:
        break
            
if flag:
    print(a, b, c)
else:
    print(-1, -1, -1)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define FORR(i,a,b) for (int i=(a);i>=(b);i--)
#define pb push_back
#define pcnt __builtin_popcount
#define show(x) cout<<#x<<" = "<<x<<endl;
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define fi first
#define se second
#define rng(a) (a.begin()),(a.end())
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define sz(x) (int)(x).size()
#define mp make_pair

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
typedef set<int> si;
typedef pair<ll,ll> pll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<pll> vpll;
typedef set<ll> sl;
typedef __int128_t lll;
typedef pair<lll,lll> plll;
typedef vector<lll> vlll;
template<typename T>string join(vector<T>&v)
{stringstream s;FOR(i,0,sz(v))s<<' '<<v[i];return s.str().substr(1);}
ll gcd(ll a,ll b){if(a>b)swap(a,b);for(;a>0;b%=a,swap(a,b));return b;}
int modpow(ll a,ll n,int m){if(a==0)return a;ll p=1;for(;n>0;n/=2,a=a*a%m)if(n&1)p=p*a%m;return(int)p;}
void dout(double d){printf("%.12f\n",d);}

const int iinf = 1e9;
const ll linf = 1e18;
const int mod = 1e9+7;
const double pi = acos(-1);
const double eps = 1e-10;
ll n, a[100005], b[100005];
main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> n;
  FOR(i, 0, n) cin >> a[i] >> b[i];
  ll s = 0;
  FORR(i, n-1, 0){
    ll d = (a[i] + s) % b[i];
    if(d) d = b[i] - d;
    s += d;
  }
  cout << s << endl;
  return 0;
}

Measured memory_bytes: 1792
import sys, itertools
f = sys.stdin

def take2(iterable):
    i = iter(iterable)
    while True:
        yield next(i), next(i)

n = int(f.readline())
adj =[[(v, c) for v, c in take2(map(int, f.readline().split()[2:]))] for _ in range(n)]
d = [100000 * 100 + 1] * n

d[0] = 0
queue ={0}
while len(queue):
    parent = queue.pop()
    for v, c in adj[parent]:
        if d[v] > d[parent] + c:
            d[v] = d[parent] + c
            queue.update([v])

for i in range(n):
    print(i, d[i])

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

int main() {
    int N; long long sum=0;
    cin>>N;
    while(N!=0){
        if(N%3==0 || N%5==0){
            N--;
        }else{
            sum += N;
            N--;
        }
    }
    cout<<sum<<endl;
}


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

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

    ll maxNumberOfDigits = LLONG_MAX;

    // A * Bの関係性を求める中でAが小さい方の値だとすると、Aが取りうる値はsqrt(N)
    // Aが確定すれば、Bも確定する。
    ll sqN = floor(sqrt(N));

    // loop回して、Aを求め、それに対応するBを求める。
    for (ll i = 1; i <= sqN; ++i)
    {
        if (N % i == 0)
        {
            ll A = i;
            ll B = N / i;

            // F(A, B)を求める
            ll numberOfDigits = max(to_string(A).length(), to_string(B).length());

            // 最小値判定
            if (maxNumberOfDigits > numberOfDigits)
            {
                maxNumberOfDigits = numberOfDigits;
            }
        }
    }

    std::cout << maxNumberOfDigits << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define int long long
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e18;

signed main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	int n, m;
	cin >> n >> m;
	vector<int> p(m);
	vector<string> s(m);
	vector<bool> ac(n);
	vector<int> wa(n);
	int count = 0, pen = 0;
	rep(i, 0, m){
		cin >> p[i] >> s[i];
		p[i]--;
		if(ac[p[i]] == false){
			if(s[i] == "AC"){
				count++;
				pen += wa[p[i]];
				ac[p[i]] = true;
			}else{
				wa[p[i]]++;
			}
		}
	}
	cout << count << ' ' << pen << endl;
}

Measured memory_bytes: 7296
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>
#include <fstream>
#include <bitset>
#include <time.h>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef complex<double> Point;

#define PI acos(-1.0)
#define EPS 1e-10
const ll INF = (1LL << 31) - 1;
const ll MOD = 1e9 + 7;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,N) for(int i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )
#define fi first
#define se second
#define N_SIZE (1LL << 20)
#define NIL -1
#define MAX_N 100100 * 3

ll n;
ll a[101000];

int main() {
	cin >> n;
	REP(i, n)cin >> a[i];
	ll MAX = 0, MIN = INF;
	REP(i, n) {
		MAX = max(MAX, a[i]);
		MIN = min(MIN, a[i]);
	}
	if (MAX - MIN > 1) {
		cout << "No" << endl;
		return 0;
	}
	if (MAX == MIN) {
		if (a[0] == n - 1 || a[0] <= n / 2)cout << "Yes" << endl;
		else cout << "No" << endl;
	}
	else {
		int p = 0, q = 0;
		REP(i, n) {
			if (a[i] == MAX)q++;
			else p++;
		}
		if (MAX >= p + 1 && MAX <= p + q / 2 && q != 1)cout << "Yes" << endl;
		else cout << "No" << endl;
	}
}

Measured memory_bytes: 1024
#include <cstdio>
#include <fstream>
#include <iomanip>
#include <ios>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <random>
#include <cstring>
#include <array>
#include <bitset>
#include <deque>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <string>
#include <tuple>
#include <vector>
#include <stack>

using namespace std;

using ll = long long;
#define P pair<ll, ll>
#define Pvec vector<P>
#define rep(i, n) for (int i=0; i < (n); i++)

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    for(int i = 0; i < n; i++) {
        cin >> a[i];
    }
    int count = 0;
    
    for (int i = 1; i < n-1; i++) {
        if (a[i-1] < a[i] && a[i] < a[i + 1]) count += 1;
        else if (a[i-1] > a[i] && a[i] > a[i + 1]) count += 1;
    }
    cout << count << endl;
    
    return 0;
}

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

#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REPl(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define REPRl(i, n) for(ll i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < (int)n; i++)
#define FORl(i, m, n) for(ll i = m; i < (ll)n; i++)
#define ALL(v) v.begin(), v.end()
ll gcd(ll a,ll b) {
  return b? gcd(b,a%b): a;  
}
ll lcm(ll a,ll b) {
  return a*b/gcd(a,b);
}
int main() {
  int k,x;cin>>k>>x;
  bool ans=(k*500>=x);
  cout << (ans?"Yes":"No") << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(void)
{
  int k,n;
  cin >> k >> n;
  int a[n];
  for(int i = 0;i<n;i++) cin >> a[i];
  int max = -1;
  for(int i = 0;i<n-1;i++)
  {
      if(max < a[i+1] - a[i]) max = a[i+1] - a[i];
  }
  if(a[n-1] - a[0] < k - max) cout << a[n-1] - a[0] << endl;
  else cout << k - max << endl;
  return 0;
}


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

using namespace std;
typedef long long ll;

#define MOD (long long)(1e9+7)
#define REP(i,n) for(ll i = 0; i < n; i++)
#define REP1(i,n) for(ll i = 1; i <= n; i++)

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

int main(void)
{
  ll n; cin >> n;
  // ll x, y, z; cin >> x >> y >> z;
  string s[n]; REP(i, n) cin >> s[i];
  // ll ans = 0;
  bool ok = true;
  REP(i, n-1) {
    if(s[i][s[i].size()-1] != s[i+1][0]) ok = false;
    REP(j, n) {
      if(i!=j && s[i]==s[j]) ok = false;
    }
  }
  // cout << ans << endl;
  cout << (ok?"Yes":"No") << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <bitset>
#include <string>
#include <cmath>
#include <complex>
#include <numeric>
#include <cassert>

#include <vector>
#include <array>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <utility>

#define int64 long long
#define uint64 unsigned long long
using namespace std;

int main()
{
	int64 ww, hh, xx, yy;
	cin >> ww >> hh >> xx >> yy;
	cout << (long double)(ww * hh) / 2.0;
	if(2 * xx == ww && 2 * yy == hh)
	{
		puts(" 1");
	}
	else
	{
		puts(" 0");
	}
	return 0;
}

Measured memory_bytes: 3724
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <tuple>
#include <numeric>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;

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

    vl a(n);
    rep(i, n) {
        cin >> a[i];
    }

    vl dp(2*k);  // dp[i] : 石がi個のとき先手が勝つなら1
    rep(i, k) {
        if(dp[i] == 0) {
            rep(j, n) {
                dp[i + a[j]] = 1;
            }
        }
    }

    if(dp[k]) {
        out("First");
    }
    else {
        out("Second");
    }

    re0;
}

Measured memory_bytes: 4864
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <bitset>
#include <utility>
#include <numeric>

using namespace std;

using ll = long long;
using ull = unsigned long long;

const ll inf = (ll)1e9;
const ll mod = (ll)1e9 + 7;

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

	vector<vector<int>> a(n, vector<int>(3));
	for (int i = 0; i < n; i++)
	{
		for (int j = 0; j < 3; j++)
		{
			cin >> a.at(i).at(j);
		}
	}

	vector<vector<int>> dp(n + 1, vector<int>(3));


	for (int i = 0; i < n; i++)
	{
		for (int j = 0; j < 3; j++)
		{
			for (int k = 0; k < 3; k++)
			{
				if (j != k)
				{
					dp.at(i + 1).at(k) = max(dp.at(i + 1).at(k),  dp.at(i).at(j) + a.at(i).at(k));
				}
			}
		}
	}

	int res = 0;
	for (int i = 0; i < 3; i++)
	{
		res = max(res, dp.at(n).at(i));
	}

	cout << res << endl;
}


Measured memory_bytes: 11136
#include<iostream>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<cassert>
using namespace std;
#define REP(i,b,n) for(int i=b;i<n;i++)
#define rep(i,n)   REP(i,0,n)
const int N = 18;
int bit[10010];
int dp[1<<N];
int w[1<<N];
int h[1<<N];

int solve(int n,int st,const int wlim){
  if (st == (1<<n)-1){
    return dp[st] = 0;
  }
  int &ret = dp[st];
  if (ret != -1){
    return ret;
  }
  ret = (1<<20);
  REP(i,1,(1<<n)){
    if (i&st)continue;
    int score = h[i];
    if (wlim < w[i])continue;
    ret = min(ret,solve(n,st|i,wlim)+1);
  }
  return ret;
}


main(){
  int n,m,wlim;
  while(cin>>n>>m>>wlim && n){
    rep(i,n)bit[i] = 0;
    m--;
    int maxheight = 0;
    vector<int> height,weight;
    rep(i,n){
      int cnt;
      cin>>cnt;
      rep(j,cnt){
	int tmp;
	cin>>tmp;
	bit[i] |= (1<<height.size());
	height.push_back(i);
	weight.push_back(tmp);
	maxheight = i;
      }
    }
    if (maxheight == 0){
      cout << 0 << endl;
      continue;
    }

    int size = height.size();
    rep(i,(1<<size)){
      h[i] = 0;
      w[i] = 0;
      rep(j,size){
	if ((1<<j)&i){
	  h[i] = max(h[i],height[j]);
	  w[i] += weight[j]; 
	}
      }
    }
    rep(i,(1<<N))dp[i] = -1;
    solve(size,0,wlim);
    int ans = 0;
    int cur = (1<<size)-1;
    for(int i=n-1;i>0;i--){
      cur ^= bit[i];
      //cout << i <<" " << cur << endl;
      ans += dp[cur]*2;
    }
    int tmp = m > maxheight?m-maxheight:-m;
    //cout << ans <<" " << tmp << " " << ans+tmp << endl;
    cout << ans+tmp << endl;
  }
}

Measured memory_bytes: 2160
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<string> vs;
typedef pair<int, int> p;
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    int a, b, c;
    cin >> a >> b >> c;

    cout << a * b / 2 << endl;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define mkp make_pair
#define pub push_back
typedef long long LL;
const int md = 1e9 + 7;
const int maxn = 1e5 + 5;
int a[maxn], id[maxn];

bool cmp(int i, int j){
    return a[i] < a[j];
}

int main(){
    int n;
    scanf("%d", &n);
    for(int i = 1; i <= n; i++){
        scanf("%d", &a[i]);
        id[i] = i;
    }
    sort(id + 1, id + 1 + n, cmp);
    int ans = 0;
    for(int i = 1; i <= n; i++){
        if(i % 2 != id[i] % 2) ans++;
    }
    ans /= 2;
    printf("%d\n", ans);
    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); i++)
#define ALL(v) (v).begin(),(v).end()
using ll = long long;
using P = pair<int, int>;
const int INF = 1e9;
const long long LINF = 1e18;
const long long MOD = 1e9 + 7;

/*
    基数として乱数をとりたい場合 : 
    ll MOD_1 = 1000000007, MOD_2 = 1000000009;
    random_device rnd;
    mt19937 mt(rnd());
    B_1 = mt() % (MOD_1 - 2) + 2;
    B_2 = mt() % (MOD_2 - 2) + 2;
    RolligHash rh(s, B_1, B_2, MOD_1, MOD_2);
*/
struct RollingHash{
    using T = long long;
    using P = pair<T, T>;
    T B_1, B_2, MOD_1, MOD_2;
    vector<T> hash_1, hash_2, pow_1, pow_2;
    
    RollingHash(string & s, T B_1 = 1007, T B_2 = 1009, T MOD_1 = 1000000007, T MOD_2 = 1000000009)
     : B_1(B_1), B_2(B_2), MOD_1(MOD_1), MOD_2(MOD_2) {
        int n = s.size();
        hash_1.assign(n + 1, 0);
        hash_2.assign(n + 1, 0);
        pow_1.assign(n + 1, 1);
        pow_2.assign(n + 1, 1);
        for(int i = 0; i < n; i++){
            hash_1[i + 1] = (hash_1[i] * B_1 + s[i]) % MOD_1;
            hash_2[i + 1] = (hash_2[i] * B_2 + s[i]) % MOD_2;
            pow_1[i + 1] = pow_1[i] * B_1 % MOD_1;
            pow_2[i + 1] = pow_2[i] * B_2 % MOD_2;
        }
    }

    P get(int l, int r){
        T res_1 = ((hash_1[r] - hash_1[l] * pow_1[r - l]) % MOD_1 + MOD_1) % MOD_1;
        T res_2 = ((hash_2[r] - hash_2[l] * pow_2[r - l]) % MOD_2 + MOD_2) % MOD_2;
        return P(res_1, res_2);
    }
};

signed main(){
    string t,p;
    cin >> t;
    cin >> p;
    RollingHash rht(t), rhp(p);
    rep(i,(int)t.size() - (int)p.size() + 1){
        if(rht.get(i, i + p.size()) == rhp.get(0, p.size())){
            cout << i << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 35612
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <math.h>
#include <string>
#include <numeric>
#include <queue>
#include <cstdio>
#include <cstring>
#define ll long long
#define rep(i,n) for(ll i=0;i<n;++i)
#define rep1(i,n) for(ll i=1;i<n;++i)
#define mrep(i,n) for(ll i=n;i>=0;--i)
#define all(a) (a).begin(),(a).end()
#define vl vector<ll>
#define vvl vector<vector<ll> >
#define vb vector<bool>
#define vvb vector<vector<bool> >
#define pl pair<ll,ll>
#define inf 1001001001001001000
#define mod 1000000007
//#define mod 998244353
#define pi 3.1415926535
using namespace std;
struct __INIT{
    __INIT(){
        cin.tie(0);
        ios::sync_with_stdio(false);
        cout<<fixed<<setprecision(15);
    }
}__init;

ll gcd(ll a,ll b){
    if(a<b) return gcd(b,a);
    ll r;
    while((r=a%b)){
        a = b;
        b = r;
    }
    return b;
}
int main(){
    ll n;
    cin>>n;
    map<string,ll> pitsu;
    rep(i,n){
        string s;
        cin>>s;
        pitsu[s]++;
    }
    cout<<"AC x "<<pitsu["AC"]<<endl;
    cout<<"WA x "<<pitsu["WA"]<<endl;
    cout<<"TLE x "<<pitsu["TLE"]<<endl;
    cout<<"RE x "<<pitsu["RE"]<<endl;
    return 0;
}


Measured memory_bytes: 3664
#include <bits/stdc++.h>
#define LL long long int
using namespace std;
int const MAXN = 1e6+5;
int main (){
    ios_base::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    string s;
    cin >> s;
    int n  = s.size();
    int ans = 0;
    for (int i = 0; i < n/2;i++){
        ans += (s[i]!=s[n-1-i]);
    }
    cout << ans ;
}


Measured memory_bytes: 256
s = input()

op_n = len(s) - 1

ans = 0

for i in range(1 << op_n):
  sign = [""] * op_n
  for j in range(op_n):
    if ((i>>j)&1):
      sign[j] = "+"
  formula = ""
  for k in range(op_n):
    formula += s[k] + sign[k]
  formula += s[op_n] 
  ans += eval(formula)
print(ans)  
    
      
       

Measured memory_bytes: 3060
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<iostream>
using namespace std;

int main() {
	
	int n, m, l;
	int a[100][100];
	int b[100][100];

	cin >> n >> m >> l;

	for (int i = 0; i < n; i++) {
		for (int j = 0; j < m; j++) {
			cin >> a[i][j];
		}
	}
	for (int i = 0; i < m; i++) {
		for (int j = 0; j < l; j++) {
			cin >> b[i][j];
		}
	}

	long sum;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < l; j++) {
			sum = 0;
			for (int k = 0; k < m; k++) {
				sum += (a[i][k] * b[k][j]);

			}
			printf("%lu", sum);
			if (j + 1 != l)printf(" ");

		}
		printf("\n");
	}

	//system("pause");
	return 0;
}


Measured memory_bytes: 3224
use std::io::Read;

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();

    let answer = solve(&buf);

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

fn solve(input: &str) -> String {
    let mut iterator = input.split_whitespace();

    let mut t: Vec<char> = iterator.next().unwrap().chars().collect();

    let mut result = String::new();
    for i in 0..t.len() {
        if t[i] == '?' {
            t[i] = 'D';
        }
        result.push(t[i]);
    }
    return result;
}


Measured memory_bytes: 3336
/*I MAY NOT GET THE SUCCESS IMMEDIATELY BUT I WILL GET IT FOR SURE*/
#include<bits/stdc++.h>
#define opt std::ios_base::sync_with_stdio(false)
#define I int
#define li		int32_t
#define lli		long long
#define ulli unsigned long long

#define pn			 printf("\n")
#define nl			 cout<<'\n'
#define sf(N)        scanf("%lld",&N)
#define pf(N)        printf("%lld",N)
#define sf1(N1,N2)    scanf("%lld %lld",&N1,&N2)
#define pf1(N1,N2)    printf("%lld %lld",N1,N2)
#define sf2(N1,N2,N3) scanf("%lld %lld %lld",&N1,&N2,&N3)
#define pf2(N1,N2,N3) printf("%lld %lld %lld",N1,N2,N3)

#define sl          cout<<' '
#define ps          printf(" ")

#define rep(i,a,b)	for(i=a;i<b;i++)
#define repr(i,a,b)	for(i=a;i>b;i--)
#define elif		else if
#define mset(a,b)	memset(a,b,sizeof(a))

#define pb		push_back
#define pob		pop_back
#define itr		iterator
#define sz()	size()
#define szof    sizeof
#define lb		lower_bound
#define ub		upper_bound
#define mp		make_pair
#define vlli    vector<lli>
#define plli	pair<lli,lli>
#define vplli	vector<plli >
#define F   	first
#define S		second
#define Dup     erase(unique(V.begin(),V.end()),V.end())

#define bs      binary_search
#define ub      upper_bound
#define lb      lower_bound

#define ALL(V)  V.begin(),V.end()

#define MX1     100000
#define MX2     1000000
#define Inf     1000000000000000
#define mod		1000000007
using namespace std;

lli Power(lli a,lli b)
{
    lli result=1;

    while(b)
    {
        if(b%2)
        {
            result=(result*a)%mod;
        }

        b=b>>1;
        a=(a*a)%mod;
    }

 return result;
}

int main()
{
    opt;

    /*#ifndef ONLINE_JUDGE
    freopen("double_squares.txt","r",stdin);
    freopen("double_squares_out.txt","w",stdout);
    #endif // ONLINE_JUDGE*/

    lli N,i;
    cin>>N;

    set<lli>s;
    rep(i,0,N)
    {
        lli x;
        cin>>x;

        if(s.find(x)!=s.end())
        {
            s.erase(x);
        }
        else
        {
            s.insert(x);
        }
    }

    cout<<s.sz();






 return 0;
}


Measured memory_bytes: 4992
// 2019/07/15
// AtCoder Beginner Contest 053 - C
// 
// For the answer:
// Int(n/11)*2
// 11で割った余りを出す
// 11以下:
// あまりが0: +0
// あまりが6以下:+0
// あまりが11以下:+1

#include <bits/stdc++.h>
using namespace std;

int main() {
    long long x, wkx, remx, ans;
    
    cin >> x;
    ans = floor(x / 11) * 2 + 1;
    remx = x % 11;
    if(remx > 6){
        ans = ans + 1;
    } else if (remx == 0) {
        ans = ans - 1;
    }
    
    cout << ans;
}

Measured memory_bytes: 256