akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
#define REP(i, n) for(int i=0; i<n; i++)
#define REPi(i, a, b) for(int i=int(a); i<int(b); i++)
#define MEMS(a,b) memset(a,b,sizeof(a))
#define mp make_pair
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; }
const ll MOD = 1e9+7;

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

    ll ans = 0;

    REPi(i,1,N+1){
        if(i % 3 == 0)
            continue;
        if(i % 5 == 0)
            continue;
        ans += i;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3632
s=input();a,b=map(int,(s[:2],s[2:]));print('AMBIGUOUS'if 1<=a<=12 and 1<=b<=12 else'MMYY'if 1<=a<=12 and 0<=b<=99 else'YYMM'if 0<=a<=99 and 1<=b<=12 else'NA')

Measured memory_bytes: 8984
#include <bits/stdc++.h>
#define LLF long double

using namespace std;
const LLF PI=3.14159265358979323846;

int main(){
  cin.sync_with_stdio(0);
  int a,b,h,m;
  cin>>a>>b>>h>>m;
  LLF ha,ma;
  ha=PI/6*h+PI/360*m,ma=PI/30*m;
  //printf("%llf %llf",ha/PI*180,ma/PI*180);
  LLF ang=fabs(ha-ma);
  if(ang>PI)ang=2*PI-ang;
  LLF ans=sqrt(a*a+b*b-2*cos(ang)*a*b);
  printf("%.10llf",ans);
}

Measured memory_bytes: 4172
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <string>
#include <vector>
#define rep(i, x, n) for(int i = x; i < n; i++)
using namespace std;
const long long INF = 1LL << 60;
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;
}
const int MOD = 1000000007;

int main() {
    long long H, N;
    cin >> H >> N;
    rep(i, 0, N) {
        long long a;
        cin >> a;
        H -= a;
    }
    if(H <= 0) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
A = []
check = []

for i in range(3):
	a, b, c = map(int, input().split())
	A.append(a)
	check.append(False)
	A.append(b)
	check.append(False)
	A.append(c)
	check.append(False)

N = int(input())

for i in range(N):
	b = int(input())
	for j in range(len(A)):
		if A[j] == b:
			check[j] = True

c = False
for i in range(3):
	if check[i*3] and check[i*3+1] and check[i*3+2]:
		c = True

for i in range(3):
	if check[i] and check[i+3] and check[i+6]:
		c = True

if check[0] and check[4] and check[8]:
	c = True

if check[2] and check[4] and check[6]:
	c = True

if c:
	print("Yes")
else:
	print("No")


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

#define el '\n'

typedef long long ll; 

const int MAXN = 100005;
const int MOD = 1e9+7;

vector<int> adj[100005];
int dp[100005][2]; //0 if white, 1 if black
bool vis[100005];

int kali(int a, int b){
  return (ll) a*b %MOD;
}

void dfs(int u){
  if(vis[u]) return;
  vis[u] = true;

  int ans1 = 1;
  int ans2 = 0;

  for(int v: adj[u]){
    if(!vis[v]){
      dfs(v); 
      ans2 = (kali(ans1,dp[v][1]) + kali(ans2, (dp[v][0]+dp[v][1])%MOD))%MOD;
      ans1 = kali(ans1,dp[v][0]);
    }
  }
  dp[u][0] = (ans1 + ans2)%MOD;
  dp[u][1] = ans1;
}

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

  int n;
  cin >> n;
  for(int i = 0; i < n-1; i++){
    int u, v;
    cin >> u >> v;
    adj[u].push_back(v);
    adj[v].push_back(u);
  }  

  dfs(1);
  cout << (dp[1][0]+dp[1][1])%MOD << el;

  return 0;
}

Measured memory_bytes: 13568
n, k = map(int, input().split())
r, s, p = map(int, input().split())
T = input()
hand = ('r', 's', 'p')

def rps(hero, villain):
    hero = hand.index(hero)
    villain = hand.index(villain)
    result = hero - villain
    if result % 3 == 0 or result % 3 == 1:
        return 0
    else:
        return 1

if_rock, if_scissors, if_paper = ([0]*k for _ in range(3))
for i in range(n):
        tmp_r = rps('r', T[i]) * r + max(if_scissors[i%k], if_paper[i%k])
        tmp_s = rps('s', T[i]) * s + max(if_rock[i%k], if_paper[i%k])
        tmp_p = rps('p', T[i]) * p + max(if_rock[i%k], if_scissors[i%k])
        if_rock[i%k] = tmp_r
        if_scissors[i%k] = tmp_s
        if_paper[i%k] = tmp_p

maxpoint = 0
for i in range(k):
    maxpoint += max(if_rock[i], if_scissors[i], if_paper[i])
print(maxpoint)

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

using namespace std;
typedef pair<int, int> P;
typedef long long int ll;

int main(){
  ll n, m;cin>>n>>m;
  if(ll(2)*n<=m)cout<<n+(m-ll(2)*n)/ll(4)<<endl;
  else cout<<m/ll(2)<<endl;
}


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

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> pll;
typedef pair<string, string> pss;
typedef vector<ll> vll;
typedef vector<pll> vpll;
typedef vector<vll> vvll;
typedef vector<vpll> vvpll;
typedef unordered_map<ll, ll> um;
typedef unordered_set<ll> us;

#define fastio ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
#define ts ll t; in(t) while (t--) solve();
#define ks ll t; in(t) FOR(i, 1, t+1) out("Case #" << i << ": " << solve());
#define endl '\n'
#define ln cout << endl;
#define in(x) cin >> x;
#define out(x) cout << x << endl;
#define flush cout << flush;
#define reset(a, b) memset(a, b, sizeof(a));
#define ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
#define FOR(i, a, b) for (ll i = a; i < b; ++i)
#define FORI(i, a, b, c) for (ll i = a; i < b; i += c)
#define FORD(i, a, b) for (ll i = a; i > b; --i)
#define FOREACH(it, v, r) for (auto it = v.begin() + r; it != v.end(); it++)
#define FORALL(it, v) for (auto it : v)
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define vin(v, x) vll v(x); FOR(i, 0, x) in(v[i])
#define all(v) v.begin(), v.end()
#define allr(v, r) v.begin(), v.begin() + r
#define showv(v) FORALL(it, v) cout << it << ' '; ln
#define printv(v) FORALL(it, v) out(it)
#define show2d(v) FORALL(it, v) { FORALL(j, it) cout << j << ' '; ln}
#define showm(v) FORALL(it, v) cout << it.F << ": " << it.S << ' '; ln
#define sortv(v) sort(all(v));
#define revv(v) reverse(all(v));
#define maxv(v) *max_element(all(v))
#define minv(v) *min_element(all(v))
#define gcd __gcd
#define checkbit(n, i) (n >> i) & 1               // check ith bit
#define bitcount __builtin_popcount               // count set bits
#define firstbitindex __builtin_ctz               // count trailing zeros
#define lastbitindex __builtin_clz                // count leading zeros
#define bitparity __builtin_parity                // check set bits are even or odd
#define findv(v, x) (find(all(v), x) != v.end())  // find in a vector
#define findsm(u, x) (u.find(x) != u.end())       // find in a set / map
#define findstr(s, x) (s.find(x) != string::npos) // find in a string
#define sz(a) a.size()
#define precise(x) cout << fixed << setprecision(x);

const ll MAXN = 1e5 + 1, MOD = 998244353, SIZE = 2e7;//, INF = 0x7f7f7f7f7f7f7f7f;
const double EPS = 1e-9, PI = acos(-1);
const int INFi = 0x7f7f7f7f;

//<<------Declare Variables Here----->>//
ll n, q, s, a[MAXN], b, c, d;

//<<-----Implement Functions Here---->>//
void solve()
{
    in(n)
    FOR(i, 0, n)
    {
        in(d)
        a[d]++;
        s += d;
    }
    in(q)
    FOR(i, 0, q)
    {
        in(b >> c)
        s += a[b] * (c - b);
        a[c] += a[b];
        a[b] = 0;
        out(s)
    }
}

//<<----------Start of Main---------->>//
int main()
{
    fastio
    //ts
    solve();
    return 0;
}

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

int main() {
  int n;
  while(cin >> n){
    if(n==0) return 0;
    int ans = 1e9;
    vector<int> v(n);
    rep(i, n){
      cin >> v[i];
    }
    sort(v.begin(), v.end());
    REP(i, 1, n){
      ans = min(ans, abs(v[i-1]-v[i]));
    }
    cout << ans << endl;
  }
  return 0;
}


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

using namespace std;

#define int long long

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int n;
    string s;
   	cin >> n;
   	cin >> s;
   	if(n % 2 == 1){
   		cout << "No" << "\n";
   	}else{
   		int pos = (n/2);
   		string s1 = s.substr(0, pos);
   		string s2 = s.substr(pos, n-1);
   		if(s1.compare(s2) == 0){
   			cout << "Yes" << "\n";
   		}else{
   			cout << "No" << "\n";
   		}
   	}
   	return 0;
}

Measured memory_bytes: 3656
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <deque>
#include <queue>
#include <array>
#include <set>
#include <map>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cstdint>
#include <cassert>

using namespace std;
using i64 = int64_t;
using i32 = int32_t;
template<class T, class U> void init_n(vector<T>& v, size_t n, U x) 
{ v = vector<T>(n, x); }
template<class T> void init_n(vector<T>& v, size_t n) { init_n(v, n, T()); }
template<class T> void read_n(vector<T>& v, size_t n, size_t o = 0) 
{ v = vector<T>(n+o); for (size_t i=o; i<n+o; ++i) cin >> v[i]; }
template<class T> void read_n(T a[], size_t n, size_t o = 0)
{ for (size_t i=o; i<n+o; ++i) cin >> a[i]; }
template<class T> T gabs(const T& x) { return max(x, -x); }
#define abs gabs

i64 n, k;
vector<i64> a;
int main() {
  cin >> n >> k;
  read_n(a, n);
  i64 sum = accumulate(begin(a), end(a), i64(0));
  set<i64> f;
  for (i64 i = 1, x = sum; i < min(sum, i64(30000)); ++i) {
    if (x % i == 0) {
      f.insert(i);
      f.insert(x / i);
    }
  }
  cerr << "sum: " << sum << endl;
  for (i64 x : f) cerr << x << ' ';
  cerr << endl;

  i64 ans = 1;
  for (i64 x : f) {
    vector<i64> b;
    for (i64 i = 0; i < n; ++i) {
      i64 c = a[i] % x;
      if (c != 0) b.push_back(c);
    }
    sort(begin(b), end(b));
    i64 c = 0;
    for (i64 i = 0, j = b.size() - 1; i != j && j >= 0; ++i) {
      i64 y = b[i];
      c += y;
      for (; j > i; --j) {
        i64 z = min(y, x - b[j]);
        y -= z;
        b[j] += z;
        if (y == 0) break;
      }
    }
    if (c <= k) ans = max(ans, x);
  }
  cout << ans << endl;
  return 0;
}


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

public class Main {
    static ArrayList<Integer>adj[];
    public static void main(String[] args) throws IOException {
        Scanner sc = new Scanner(System.in);
        PrintWriter pw = new PrintWriter(System.out);
        int n = sc.nextInt();
        int ans=0;
        for (int i =1;i<=n;i++){
            if ((""+i).length()%2==1)ans++;
        }
        pw.println(ans);
        pw.flush();
    }
    static int max;
    static int start;
    static class SufT{
        static class Node{Node[]nxt= new Node[26];int val=0;int dis=0;};
        Node root= new Node();
        void put(char[]s){
            Node cur = root;
            for (char c:s){
                Node nxt=cur.nxt[c-'a'];
                if (nxt==null){
                    nxt=cur.nxt[c-'a']= new Node();
                    nxt.dis=cur.dis+1;
                }
                cur=nxt;
                cur.val++;
            }
        }
        void search(){
            Queue<Node>q= new LinkedList<>();
            ((LinkedList<Node>) q).add(root);
//            boolean[][]vis= new boolean[26][200];
            while (!q.isEmpty()) {
                Node x = q.poll();
                for (int i =0;i<26;i++){
                    Node nxt=x.nxt[i];
                    if (nxt!=null){
                        ((LinkedList<Node>) q).add(nxt);
//                        vis[i][nxt.dis]=true;
                    }
                }
                if (x.val>=3){
                    max=x.val;
                    start=Math.max(start,x.dis);
                }
            }
        }
    }

    static long modPow(long a ,int e ,int mod){
        a%=mod;
        long res=1;
        while (e>0){
            if ((e%2)==1){
                res=(res*a)%mod;
            }
            a=(a*a)%mod;
            e>>=1;
        }
        return res%mod;
    }
    static class Scanner{
        StringTokenizer st;
        BufferedReader br;
        public  Scanner(InputStream s){
            br = new BufferedReader(new InputStreamReader(s));
        }
        public String next() throws IOException{
            while (st==null||!st.hasMoreTokens())st= new StringTokenizer(br.readLine());
            return st.nextToken();
        }
        public String nextLine() throws IOException {return br.readLine();};
        public int nextInt() throws IOException {return Integer.parseInt(next());}
        public long nextLong() throws IOException {return Long.parseLong(next());}

    }
}


Measured memory_bytes: 32212
#include<stdio.h>
#include<string.h>

int main(void){
    int n, q, i, j, l, r, a = 0;
    char s[100000];
    int  ans[100000] = {0}, num[100000] = {0};
    scanf("%d %d",&n, &q);
    scanf("%s",s);
    for(i = 1; i < n; i++){
        char c[3] = {s[i-1],s[i]};
        if(strncmp(c, "AC", 2) == 0){
            a++;
        }
        num[i] = a;
    }
    for(i = 0; i < q; i++){
        scanf("%d %d",&l, &r);
        ans[i] = num[r-1] - num [l-1];
    }
    for(i = 0;i < q; i++){
        printf("%d\n",ans[i]);
    }
    return 0;
}


Measured memory_bytes: 1664
#include <cstdio>
#include <cstring>
#include <string>
#include <iostream>
#define INF 1e8
using namespace std;

int h,w;
int fie[51][51];
int dp[51][51];
int main(void){
	scanf("%d %d",&h,&w);
	for(int i=0;i<h;i++){
		string str;
		cin >> str;
		for(int j=0;j<w;j++){
			fie[j][i]=str[j]-'0';
		}
	}
	for(int i=0;i<=h;i++){
		for(int j=0;j<=w;j++){
			dp[j][i]=INF;
		}
	}
	dp[0][0]=fie[0][0];
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			if(dp[j][i]!=INF){
				dp[j+1][i]=min(dp[j+1][i],dp[j][i]+fie[j+1][i]);
				dp[j][i+1]=min(dp[j][i+1],dp[j][i]+fie[j][i+1]);
			}
		}
	}
	printf("%d\n",dp[w-1][h-1]);
	return 0;
}

Measured memory_bytes: 1252
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from heapq import heapify, heappop, heappush
 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
 
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
A = LIST()
B = [0] * N # 入っている箱 0 1 0 1とか
wa = 0
tmp = 0
for i in range(N, 0, -1):
    tmp = 0
    for j in range(i, N+1, i):
        if i == j:
            continue
        else:
            # print(j)
            tmp ^= B[j-1]
    # print("*****")
    if tmp == A[i-1]:
        B[i-1] = 0
    else:
        B[i-1] = 1
# print(B)
M = sum(B)
if M == 0:
    print(M)
    exit()
else:
    print(M)
    for i, b in enumerate(B):
        if b == 1:
            print(i+1, end=" ")
    print()

Measured memory_bytes: 8752
#include <iostream>
//#include <algorithm>
//#include <vector>
//#include <string>
//typedef long long LL;
using namespace std;
 
int main(){
    int a;
    int p;
    int ans;

    cin >> a >> p;
    ans = (3 * a + p)/2;

    cout << ans << endl;
}

Measured memory_bytes: 256
#!/usr/bin/env python
import os
import sys
from io import BytesIO, IOBase


def f(n: int) -> int:
    if n % 2 == 0:
        return n // 2
    return 3 * n + 1


def main() -> None:
    s = int(input())

    seen = set()
    seen.add(s)
    a = [s]

    m = 2
    while True:
        latest = f(a[-1])
        if latest in seen:
            print(m)
            exit(0)
        m += 1
        a.append(latest)
        seen.add(latest)





# region fastio

BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self, **kwargs):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")

# endregion

if __name__ == "__main__":
    main()


Measured memory_bytes: 62776
#include <stdio.h>
#include <string.h>

int div2(int b)
{
    int count = 0;
    while(0 == b % 2)
    {
        count++;
        b /= 2;
    }

    return count;
}

int main(void){
int N;
scanf("%d",&N);
   int number[N];
    int ok,cal;
   for(int i=0;i<N;i++){
        scanf("%d",&number[i]);
}
     
  for(int i=0;i<N;i++){
      cal = div2(number[i]);
          ok = ok + cal;
}
 printf("%d\n",ok);

return 0;

}

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

#define stirng string
#define vvi vector<vector<int>>
#define vi vector<int>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;

const int inf = 1e9 + 7;

int main() {
  int n,T;
  cin >> n >> T;
  int c[n];
  int t[n];
  for(int i=0;i<n;i++){
    cin >> c[i] >> t[i];
  }
  int ans = inf;
  for(int i=0;i<n;i++){
    if(t[i] <= T){
      if(c[i] < ans){
        ans = c[i];
      }
    }
  }
  if(ans != inf){
    cout << ans << endl;
  }
  else{
    cout << "TLE" << endl;
  }
  return 0;
}


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

namespace abc55 {
    class Program {
        static void Main(string[] args) {
            var inp = Array.ConvertAll(Console.ReadLine().Split(' '), long.Parse);
            long n = inp[0];
            long m = inp[1];
            if (2 * n >= m) {
                Console.WriteLine(m/2);
            } else {
                m += 2 * n;
                Console.WriteLine(m / 4);
            }

        }
    }
}


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

using namespace std;

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

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

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

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

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

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

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

    string s;
    ll n;
    cin>>s;
    n = s.size();
    ll ans = 0;
    rep(i,n/2){
        if(s[i]!=s[n-1-i]){
            ans++;
        }

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


Measured memory_bytes: 256
/**********************************************
#code by --> @ { shadat </> sk40 [ o_o  ^_^ ] } }
**********************************************/
#include<bits/stdc++.h>
#include<algorithm>
#include<queue>
#include<list>
#include<map>
#include <math.h>
#include<numeric>
using namespace std;
#define tezz ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long int
#define ull unsigned long long int
#define doub long double
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define pii pair<int , int>
#define pdd pair<double , double>
#define pll pair<long long int,long long int>
#define vpl vector<pll >
#define vll vector<ll >
#define mod 1000000007
#define stp setprecision(20)
string s;
string dd={'a','e','i','o','u','y'};
ll count1[1<<20];
ll total[1<<20];
bool contains(char c,string f){
	for(int i=0;i<f.length();i++){
		if(c==s[i]){
			return true;
		}
	}
	return false;
}
const int maxi=1e5;
int main(){
	std::ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	ll n;cin>>n;
	ll sum=0;
	for(ll i=1;i<=n;i++)
	{
		ll count=0;
		ll no=i;
		while(no>0)
		{
			ll d=no%10;
			count=count+1;
			no=no/10;
		}
		if(count%2!=0)
		sum=sum+1;
	}
	cout<<sum;
	
	return 0;
}

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

using namespace std;
using ll = long long;

int main() {
    ios_base::sync_with_stdio(0);
	cin.tie(0);
    
    int sz;
    cin >> sz;
    
    vector<int> hs(sz, 0);
    for (auto &h : hs) {
        cin >> h;
    }
    
    vector<int> dp(sz, INT_MAX);
    dp[0] = 0;
    for (int i = 1; i < sz; ++i) {
        dp[i] = min(
            i == 1 ? INT_MAX : dp[i - 2] + abs(hs[i - 2] - hs[i]),
            dp[i - 1] + abs(hs[i - 1] - hs[i])
        );
    }
    
    cout << dp.back() << endl;

    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define ALL(A) (A).begin(),(A).end()
#define ll long long
#define rep(i,n) for(int i=0;i<(n);i++)

const ll mod = 1e9+7;
const ll INF = -1*((1LL<<63)+1);
const int inf = -1*((1<<31)+1);

using namespace std;

int main(void){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N;
    cin >> N ;
    vector<ll> A(N);
    rep(i,N)cin >> A[i];
    ll ans = 0;
    ll x = 2;
    ans += A[0] - 1;
    for(int i=1;i<N;i++){
        if(A[i]<x)continue;
        if(A[i]==x){
            x++;
            continue;
        }
        ans += (A[i]-1)/x;
    }
    cout << ans << endl;
}

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

using namespace std;

int main(){
    int D;
    string day;
    cin>>D;
    if(D==25)day="Christmas";
    if(D==24)day="Christmas Eve";
    if(D==23)day="Christmas Eve Eve";
    if(D==22)day="Christmas Eve Eve Eve";
    cout<<day;

}

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

using namespace std;

typedef long long ll;
typedef vector<int> pi;
typedef pair<int,int> vi;

#define F first
#define S second
#define PB push_back
#define MK make_pair
#define REP(i, a, b) for (int i=a; i < b; i++)


bool sort_by(vi c, vi d){
	return c.S < d.S;
}

int main() {
	string st;
	int n = 0, s = 0, w=0, e=0;
	cin >> st;	
	for(char x: st){
		if(x == 'N') ++n;
		else if(x == 'S') ++s;
		else if(x == 'W') ++w;
		else ++e;
	}
	
	if((n > 0 && s==0) ||(s > 0 && n==0) ||(e > 0 && w==0) ||(w > 0 && e==0)) cout << "No";
	else cout << "Yes";

}


Measured memory_bytes: 256
/*input
3
0 0
1 0
0 1
*/
#include<bits/stdc++.h>
#define int long long
#define MOD 1000000007
#define MAX 100005
#define pb push_back
#define mp make_pair
#define pii pair<int,int>
#define mii map<int,int>
#define vi vector<int>
#define ff first
#define ss second
#define T int t;cin>>t;while(t--)
#define loop(i,a,b) for(int i=a;i<b;i++)
#define umi unordered_map<int,int>
#define maxheap priority_queue<int>
#define minheap priority_queue<int,vector<int>,greater<int> >
#define inp(n) for(int i=0;i<n;i++)
#define N 2000005

using namespace std;
using namespace std::chrono;

int p[10][2];

long double solve(string s){
	long double ans = 0;
	for(int i=1;s[i];i++){
		int p1 = s[i]-'0',p2 = s[i-1]-'0';
		int x = p[p1][0]-p[p2][0],y = p[p1][1]-p[p2][1];
		int d = x*x + y*y;
		ans += sqrt(d);
	}
	return ans;
}

int fact(int n){
	return n==0?1LL:n*fact(n-1);
}

signed main(){
	int n;
	cin >> n;
	string s;
	loop(i,1,n+1){
		cin >> p[i][0] >> p[i][1];
		s+=(char)(i+'0');
	}
	long double ans = solve(s);
	while(next_permutation(s.begin(),s.end())){
		ans += solve(s);
	}
	cout << fixed << setprecision(10) << ans/fact(n);
}


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <string>
#include <sstream>
#include <random>
#include <utility>
#include <map>
#include <vector>
#define REP(i,x) for(int i=0; i<(x); i++)

using namespace std;

int main(int argc, const char * argv[]) {
    int a,b;
    cin >> a >> b;
    int c[a];
    int d[200000]={};
    int e =0;
    REP(i, a){
        cin >> c[i];
        if(d[c[i]] == 0){
            e++;
        }
        d[c[i]]++;
    }
    int f =1;
    int g =0;
    int h[200000]={};
    while(e>b){
        REP(i, a){
            if(d[c[i]]==f){
                if(h[c[i]])continue;
                g += f;
                e--;
                h[c[i]]++;
                if (e <= b){
                    break;
                }
            }
        }
        f++;
    }
    cout << g << endl;
    
    return 0;
}


Measured memory_bytes: 2560
N,K = map(int,input().split(' '))
R,S,P = map(int,input().split(' '))
T = input()

def reverse_rocks(s):
    if 'r' == s:
        return 'p'
    elif 's' == s:
        return 'r'
    elif 'p' == s:
        return 's'

def except_rocks(s):
    if 'r' == s:
        return ['s','p']
    elif 's' == s:
        return ['r','p']
    elif 'p' == s:
        return ['s','r']

def score(s):
    if 'r' == s:
        return R
    elif 's' == s:
        return S
    elif 'p' == s:
        return P

sum_score = 0
chechs = []
for i in range(N):
    must_not_char = ''
    if i >= K: 
        flag = True
        for c in chechs[i-K]:
            if c != reverse_rocks(T[i]):
                sum_score += score(reverse_rocks(T[i]))
                chechs.append([reverse_rocks(T[i])])
                flag = False
                break
        if flag:
            chechs.append(except_rocks(reverse_rocks(T[i])))
        continue
            
    sum_score += score(reverse_rocks(T[i]))
    chechs.append([reverse_rocks(T[i])])
            
print(sum_score)

Measured memory_bytes: 57136
#include "bits/stdc++.h"

#define REP(i,n) for(ll i=0;i<n;++i)
#define RREP(i,n) for(ll i=n-1;i>=0;--i)
#define FOR(i,m,n) for(ll i=m;i<n;++i)
#define RFOR(i,m,n) for(ll i=n-1;i>=m;--i)
#define ALL(v) (v).begin(),(v).end()
#define PB(a) push_back(a)
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());
#define DUMP(v) REP(i, (v).size()) { cout << v[i]; if (i != v.size() - 1)cout << " "; else cout << endl; }
#define INF 1000000001ll
#define MOD 1000000007ll
#define EPS 1e-9

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


using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
ll max(ll a, int b) { return max(a, ll(b)); }
ll max(int a, ll b) { return max(ll(a), b); }
///(?´????????`)(?´????????`)(?´????????`)(?´????????`)(?´????????`)(?´????????`)///
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	while (1) {
		string s;
		cin >> s;
		if (s == "#")break;
		double angle = 0;
		int w = 0, n = 0;
		string tmp = "";
		REP(i, s.size()) {
			if (s[i] == 'n') {
				tmp += 'n';
				i += 4;
			}
			else {
				tmp += 'w';
				i += 3;
			}
		}
		reverse(ALL(tmp));
		REP(i,tmp.size()) {
			if (tmp[i] == 'n') {
				if (w + n == 0)angle =0;
				else angle -= 90 / pow(2, w + n);
				n++;
			}
			else {
				if (w + n == 0)angle = 90;
				else angle += 90 / pow(2, w + n);
				w++;
			}
		}
		int a = 1;
		REP(i, INF) {
			if (abs(angle - int(angle)) < EPS)break;
			angle *= 2;
			a *= 2;
		}
		if (a == 1)cout << int(angle) << endl;
		else cout << int(angle) << '/' << a << endl;
	}
	return 0;
}

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

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

using ll = long long;

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

ll dp[100100];

int main() {
  ll N,M;
  cin >> N >> M;
  vector<ll> v(100100,0LL);
  for(ll i = 0LL; i<M; i++) {
    ll s;
    cin >> s;
    v[s]=1LL;
  }
  dp[0]=1LL;
  if(v[1]==1LL) dp[1]=0LL;
  if(v[1]==0LL) dp[1]=1LL;
  for(ll i = 2;i<100100LL;i++) {
    if(v[i]==1LL) dp[i]=0LL;
    if(v[i]==0LL) dp[i]=(dp[i-1]+dp[i-2])% 1000000007LL;
  }
  cout<<dp[N]<<endl;
}

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

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
//const ll mod = 1000000007;

int main() {
    //cout.precision(10);
    int N, K;
    cin >> N >> K;
    if((N + 1) / 2 >= K) cout << "YES" << endl;
    else cout << "NO" << endl;
    return 0;
}


Measured memory_bytes: 256
function Main(input){
    const position=input.split(' ');
    const x1=Number(position[0]);
    const y1=Number(position[1]);
    const x2=Number(position[2]);
    const y2=Number(position[3]);
    const x4=x1+y1-y2;
    const y4=y1-x1+x2;
    const x3=x4+y4-y1;
    const y3=y4+x1-x4;
    console.log(x3 + ' ' + y3 + ' '+x4 +' '+y4);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7372
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repp(i, a, b) for (int i = a; i <= (b); ++i)
#define repr(i, a, b) for (int i = a; i >= (b); --i)
typedef long long ll;
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7;

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 main() {
  int N, M;
  cin >> N >> M;
  vector<int> K(N);

  vector<int> cnt(M);

  rep(i, N) {
    cin >> K[i];
    rep(j, K[i]) {
      int temp;
      cin >> temp;
      temp--;
      cnt[temp]++;
    }
  }

  int ans = 0;
  rep(i, M) {
    if (cnt[i] == N) ans++;
  }
  cout << ans << endl;
}

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

int main(){
  int n,max,min;
  char in[8];
  cin >> n;
  for(int r=0;r<n;r++){
	for(int i=0;i<8;i++) cin >> in[i];
	sort(in,in+8);
	min = stoi(string(in));
	reverse(in,in+8);
	max = stoi(string(in));
	cout << max - min << endl;
  }
  return 0;
}

Measured memory_bytes: 1228
#include<iostream>
#include<cstdio>

using namespace std;

int main(void)
{
    double s=0,l;
    scanf("%lf", &l);
    s = (l / 3.0) * (l / 3.0) * (l / 3.0);
    printf("%.12lf", s);
    return 0;
}

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

int main()
{
    int cost0 = 0, cost1 = 0;
    int n, m, x;
    std::cin >> n >> m >> x;
    std::vector<int> vec(m);
    for (int i = 0; i < m; i++) { std::cin >> vec[i]; }

    cost0 = std::count_if(vec.begin(), vec.end(), [&x](int i) { return x > i; });
    cost1 = std::count_if(vec.begin(), vec.end(), [&x](int i) { return x < i; });
    std::cout << std::min(cost0, cost1) << std::endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    private static Scanner scan = new Scanner(System.in);

    public static void main(String[] args) {
	long N = Long.parseLong(scan.next());
	long x = Long.parseLong(scan.next());

	long count = 0;
	long a0;
	long a1 = Long.parseLong(scan.next());
	for (int i = 1; i < N; i++) {
	    a0 = a1;
	    a1 = Long.parseLong(scan.next());

	    long sum = a0 + a1;
	    long diff = sum - x;

	    if(diff > 0) {
		if(diff <= a1) {
		    count = count + diff;
		    a1 = a1 - diff;
		    sum = sum - diff;
		} else {
		    count = count + a1;
		    a1 = 0;
		    sum = a0;
		}
	    }
	    
	    diff = sum - x;
	    if(diff > 0) {
		count = count + diff;
	    }
	}

	System.out.println(count);
	scan.close();
    }
}


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

typedef long long ll;

ll best, a[1005];
vector<int> ans;
int n;

int main()
{
	scanf("%d", &n);
	for (int i = 0;i < n;i++) scanf("%lld", a+i);
	if (true)
	{
		vector<int> take;
		for (int i = 0;i < n;i+=2) if (a[i] > 0) take.push_back(i);
		if (take.size() == 0)
		{
			take.push_back(0);
			for (int i = 0;i < n;i+=2) if (a[i] > a[take[0]]) take[0] = i;
		}
		for (int i = take.size()-1;i >= 0;i--)
		{
			if (i+1 == take.size()) for (int j = 0;j < n-take[i]-1;j++) ans.push_back(n-j);
			else
			{
				for (int j = 1;j < (take[i+1]-take[i])/2;j++) ans.push_back(take[i]+3);
				ans.push_back(take[i]+2);
			}
		}
		for (int i = 0;i < take[0];i++) ans.push_back(1);
		for (int i: take) best += a[i];
	}
	if (!false)
	{
		vector<int> take, alt;
		for (int i = 1;i < n;i+=2) if (a[i] > 0) take.push_back(i);
		if (take.size() == 0)
		{
			take.push_back(1);
			for (int i = 1;i < n;i+=2) if (a[i] > a[take[0]]) take[0] = i;
		}
		for (int i = take.size()-1;i >= 0;i--)
		{
			if (i+1 == take.size()) for (int j = 0;j < n-take[i]-1;j++) alt.push_back(n-j);
			else
			{
				for (int j = 1;j < (take[i+1]-take[i])/2;j++) alt.push_back(take[i]+3);
				alt.push_back(take[i]+2);
			}
		}
		for (int i = 0;i < take[0];i++) alt.push_back(1);
		ll altval = 0;
		for (int i: take) altval += a[i];
		if (altval > best)
		{
			best = altval;
			ans = alt;
		}
	}
	printf("%lld\n%lu\n", best, ans.size());
	for (int i: ans) printf("%d\n", i);
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<stack>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
using namespace std;

class Node{
public:
	int x,y;
	int node;
	Node(int p,int q){
		x=p;
		y=q;
	}
};

int main(){
	int w,h;
	while(1){
		cin>>w>>h;
		if(w==0 && h==0)break;
		stack<Node> st;
		int dt[h][w];
		bool flg[h][w];
		rep(i,h){
			rep(j,w){
				cin>>dt[i][j];
				flg[i][j]=false;
			}
		}
		int ho[8]={1,1,0,-1,-1,-1,0,1};
		int ve[8]={0,1,1,1,0,-1,-1,-1};
		int ans=0;
		rep(i,h){
			rep(j,w){
				if(!flg[i][j] &&  dt[i][j]==1){
					st.push(Node(j,i));
					while(!st.empty()){
						Node now=st.top();
						flg[now.y][now.x]=true;
						st.pop();
						rep(k,8){
							int nx=now.x+ho[k];
							int ny=now.y+ve[k];
							if(nx>=0 && ny>=0 && nx<w && ny<h && flg[ny][nx]==false){
								if(dt[ny][nx]==dt[now.y][now.x]){
									Node next(nx,ny);
									st.push(next);
								}
							}
						}
					}
					ans++;
				}
			}
		}
		cout<<ans<<endl;
	}
	return 0;
}

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

using namespace std;

using ll = long long;

int hoge[4];

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int H, W;
    cin >> H >> W;
    vector<int> cnt(26, 0);
    for (int i = 0; i < H; i++) {
        string s;
        cin >> s;
        for (int j = 0; j < W; j++) {
            cnt[s[j]-'a']++;
        }
    }

    for (int i = 0; i < 26; i++) {
        hoge[0] += cnt[i] / 4;
        cnt[i] %= 4;
        hoge[2] += cnt[i] / 2;
        cnt[i] %= 2;
        hoge[1] += cnt[i];
    }
    bool ans = true;
    if (hoge[0]*4<(H/2*2)*(W/2*2)) ans = false;
    hoge[0]-=(H/2*2)*(W/2*2)/4;
    if (H % 2 == 1 && W % 2 == 1) {
        if (hoge[1]!=1) ans = false;
        if (hoge[2]+hoge[0]*2<(H+W-1)/2) ans = false;
    } else if (H % 2 == 1) {
        if (hoge[2]+hoge[0]*2<W/2) ans = false;       
    } else if (W % 2 == 1) {
        if (hoge[2]+hoge[0]*2<H/2) ans = false; 
    }
    cout << (ans ? "Yes" : "No") << endl;
    return 0;
}

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

int main(){
    string s;
    cin >> s;

    int len = s.length();
    int ans = 0;
    for(int i = len - 2; i >= 0; i--){
        if(s.substr(i, 2) == "01" || s.substr(i, 2) == "10"){
            s.erase(i, 2);
            ans += 2;
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 512
import sys

sys.setrecursionlimit(10**7)
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int,sys.stdin.readline().rstrip().split())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))  #空白あり
def LI2(): return list(map(int,sys.stdin.readline().rstrip()))  #空白なし
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())  #空白あり
def LS2(): return list(sys.stdin.readline().rstrip())  #空白なし

A = list(map(int,sys.stdin.readline().rstrip()))

from itertools import product

X = ['+','-']
for a in product(X,repeat=3):
    b = A[0]
    for i in range(3):
        if a[i] == '+':
            b += A[i+1]
        else:
            b -= A[i+1]
    if b == 7:
        print(str(A[0])+a[0]+str(A[1])+a[1]+str(A[2])+a[2]+str(A[3])+'=7')
        break


Measured memory_bytes: 62196
#include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;
int main() {
  int r,g,b,n,cnt,ans=0;
  cin >> r >> g >> b >> n;
  for(int i=0; i<=n/r; i++) {
    for(int j=0; j<=n/g; j++) {
      cnt=n-r*i-g*j;
      if(cnt%b==0&&cnt>=0) {
        ans++;
      }
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, s, n) for (int i = s; i < n; i++)
#define ALL(a) a.begin(), a.end()
#define MOD 1000000007
using namespace std;
typedef long long ll;

int main() {
    int N, M, Q; cin >> N >> M >> Q;
    vector<vector<int>> trains(N + 1, vector<int>(N + 1, 0));
    REP(i, 0, M) {
        int l, r; cin >> l >> r;
        trains[l][r]++;
    }

    REP(i, 0, N) REP(j, 0, N) trains[i + 1][j + 1] += trains[i + 1][j] + trains[i][j + 1] - trains[i][j];

    REP(i, 0, Q) {
        int p, q; cin >> p >> q;
        cout << trains[q][q] - trains[q][p - 1] - trains[p - 1][q] + trains[p - 1][p - 1] << endl;
    } 
    return 0;
}

Measured memory_bytes: 1920
/**
 *    author:  tourist
 *    created: 03.06.2018 15:17:43       
**/
#include <bits/stdc++.h>

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, d1, d2;
  cin >> n >> d1 >> d2;
  vector<int> SQRT(4 * n * n + 1, -1);
  for (int i = 0; i <= 2 * n; i++) {
    SQRT[i * i] = i;
  }
  vector<vector<int>> alive(2 * n, vector<int>(2 * n, 1));
  for (int rot = 0; rot < 2; rot++) {
    int d = (rot == 0 ? d1 : d2);
    vector<vector<int>> was(2 * n, vector<int>(2 * n, 0));
    for (int i = 0; i < 2 * n; i++) {
      for (int j = 0; j < 2 * n; j++) {
        if (was[i][j] || !alive[i][j]) {
          continue;
        }
        vector<pair<int,int>> que(1, make_pair(i, j));
        was[i][j] = 1;
        for (int b = 0; b < (int) que.size(); b++) {
          int x = que[b].first;
          int y = que[b].second;
          for (int xx = 0; xx < 2 * n; xx++) {
            int dy = d - (x - xx) * (x - xx);
            if (dy >= 0 && dy <= 4 * n * n && SQRT[dy] != -1) {
              dy = SQRT[dy];
              int yy = y - dy;
              if (yy >= 0 && yy < 2 * n && was[xx][yy] == 0 && alive[xx][yy]) {
                que.emplace_back(xx, yy);
                was[xx][yy] = 3 - was[x][y];
              }
              if (dy != 0) {
                yy = y + dy;
                if (yy >= 0 && yy < 2 * n && was[xx][yy] == 0 && alive[xx][yy]) {
                  que.emplace_back(xx, yy);
                  was[xx][yy] = 3 - was[x][y];
                }
              }
            }
          }
        }
        vector<int> cc(3, 0);
        for (auto &p : que) {
          cc[was[p.first][p.second]]++;
        }
        int best = (cc[1] > cc[2] ? 1 : 2);
        for (auto &p : que) {
          if (was[p.first][p.second] != best) {
            alive[p.first][p.second] = 0;
          }
        }
      }
    }
  }
  int cc = n * n;
  for (int i = 0; i < 2 * n; i++) {
    for (int j = 0; j < 2 * n; j++) {
      if (alive[i][j] && cc > 0) {
        cout << i << " " << j << '\n';
        cc--;
      }
    }
  }
  return 0;
}


Measured memory_bytes: 10480
#include <iostream>

using namespace std;

int main() {
	
	int x,y;
	
	cin >> x >> y;
	
	if((1 <= x) || (x <= 100) || (1 <= y) || y <= 100) {
	
		cout << x + ( y / 2) << endl; 

	}
	
	

}

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

int main(){
    int N;
    cin >> N;
    vector<string> Wi(N,"");
    string w;    
    for(int i=0; i<N; i++){
        cin >> w;
        Wi[i] = w;
    }

    for(int i=1; i<N; i++){
        char ch = Wi[i-1][Wi[i-1].size()-1];
        if(Wi[i][0] != ch){
            cout << "No" << endl;
            return 0;
        }

        for(int j=i-1; j >= 0; j--){
            if(Wi[i]==Wi[j]){
                cout << "No" << endl;
                return 0;
            }
        }
    }

    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 3636
#include <stdio.h>
#include <string.h>

int main(void){
  int a=0;
  char s[2000000], t[2000000];

  scanf("%s", s);
  scanf("%s", t);
  for(int i=0; i<strlen(s); i++)
    if(s[i]!=t[i])
      a++;
  printf("%d\n", a);
  
return 0;}


Measured memory_bytes: 2132
/*
                       _oo0oo_
                      o8888888o
                      88" . "88
                      (| -_- |)
                      0\  =  /0
                    ___/`---'\___
                  .' \\|     |// '.
                 / \\|||  :  |||// \
                / _||||| -:- |||||- \
               |   | \\\  -  /// |   |
               | \_|  ''\---/''  |_/ |
               \  .-\__  '-'  ___/-. /
             ___'. .'  /--.--\  `. .'___
          ."" '<  `.___\_<|>_/___.' >' "".
         | | :  `- \`.;`\ _ /`;.`/ - ` : | |
         \  \ `_.   \_ __\ /__ _/   .-` /  /
     =====`-.____`.___ \_____/___.-`___.-'=====
                       `=---='
                   JAY KHODIYAR MAA
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 JENISH MONPARA S.      IIT PATNA      ADITI GOEL IS LOVE
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
// while(scanf("%d",&n)!=EOF)

#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
#pragma GCC optimize("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
#define ii int64_t
#define lli long long int
#define li long int
#define deb(x) cout<<"\nhi"<<x<<"\n"
#define mod 1000000007
#define fio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
using namespace std;

ii c(ii x)
{
    return ((x)*(x-1))/2;
}


int main()
{
    fio;
    
    unordered_map<ii,ii> m;
    ii n,i,j,sum=0,x;
    cin>>n;
    ii a[n+3];
    vector<bool> v(n+3,true);
    for(i=0;i<n;i++)
    {
        cin>>a[i];m[a[i]]++;
    }
    for(i=0;i<n;i++)
    {
        if(v[a[i]])
        {sum+=c(m[a[i]]);v[a[i]]=false;}
        
        //cout<<sum<<endl;
        
    }
    for(i=0;i<n;i++)
    {
        cout<<sum-c(m[a[i]])+c(m[a[i]]-1)<<"\n";
        
    }
    
}


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

int main()
{
  int n;
  cin >> n;
  for (int dataset=0; dataset<n; dataset++)
  {
    int rand;
    cin >> rand;
    cout << "Case " << dataset+1 << ':' << endl;
    for (int i=0; i<10; i++)
    {
      rand = rand*rand;
      rand = rand/100 - (rand/1000000)*10000;
      cout << rand << endl;
    }
  }
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef pair<P,int> T;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000
#define LLINF 1000000000000000ll
#define sz(x) ((int)(x).size())
#define fi first
#define sec second
#define all(x) (x).begin(),(x).end()
#define sq(x) ((x)*(x))
#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define repn(i,a,n) for(int (i)=(a);(i)<(int)(n);(i)++)
#define EQ(a,b) (abs((a)-(b))<eps)
template<class T> void chmin(T& a,const T& b){if(a>b)a=b;}
template<class T> void chmax(T& a,const T& b){if(a<b)a=b;}
template<class T>
void dump(vector<T> &vec){
	for(int i=0;i<vec.size();i++){
		cout << vec[i];
		if(i+1<vec.size())cout << ' ';
		else cout << endl;
	}
	return;
}
template<class T>
void input(vector<T>& vec,int n){
	vec.resize(n);
	for(int i=0;i<n;i++){
		cin >> vec[i];
	}
}
int main(){
	int N;
	cin >> N;
	cout << N*N*N << endl;
	return 0;
}


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

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

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	int n; cin>>n;
	vector<ll> a(n);
	ll sum=0;
	for (int i=0; i<n; i++) {
		cin>>a[i];
		sum+=a[i];
	}
	ll ret=LLONG_MAX, pre=0;
	for (int i=0; i<n; i++) {
		pre+=a[i];
		ret=min(ret,abs(pre-(sum-pre)));
	}
	cout<<ret<<"\n";
	return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <deque>
#include <numeric>
#include <utility>
#define sign(a) ((a>0)-(a<0))
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define LL long long
#define INF (LL)(1LL<<60)
#define all(a) a.begin(), a.end()
#define gr greater<LL>()

using namespace std;


void solve(long long N, std::vector<long long> L){
    map<LL,LL> s;
    sort(all(L));
    LL ans=0;
    rep(i,N){
        auto it = s.upper_bound(L[i]);
        for(auto iit = s.rbegin(); iit != s.rend(); iit++){
            if((*iit).first <= L[i])break;
            ans += (*iit).second;
        }

        for(int j=0; j<i; j++){
            s[L[i]+L[j]]++;
        }
    }
    cout << ans << endl;
}

int main(){
    long long N;
    scanf("%lld",&N);
    std::vector<long long> L(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&L[i]);
    }
    solve(N, std::move(L));
    return 0;
}


Measured memory_bytes: 384