akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
ll MOD = 1e9+7;

#define vec     vector<int>
#define vecll   vector<ll>
#define vec2    vector<vector<int>>
#define vec2ll  vector<vector<ll>>
#define vpair   vector<pair<int, int>>
#define vpairll vector<pair<ll, ll>>
#define vecst   vector<string>
#define vecb    vector<bool>

#define rep(i,n)         for(ll i=(ll)0; i<(ll)n; i++)
#define REP(i,m,n)       for(ll i=(ll)m; i<(ll)n; i++)
#define arr(var, n)      vec var(n); rep(i,n){cin >> var[i];}
#define arrll(var, n)    vecll var(n); rep(i,n){cin >> var[i];}
#define arrst(var, n)    vecst var(n); rep(i,n){cin >> var[i];}
#define all(var)         (var).begin(), (var).end()
#define sortall(var)     sort(all(var))
#define uniqueall(v)     v.erase(unique(v.begin(), v.end()), v.end());
#define f_sum(var)       accumulate(all(var), 0)
#define f_sumll(var)     accumulate(all(var), 0LL)
#define chmin(v1, v2)    v1 = min(v1, v2)
#define chmax(v1, v2)    v1 = max(v1, v2)
#define mpair(v1, v2)    make_pair(v1, v2)
#define pb(var)          push_back(var)
#define prt(var)         cout << var << "\n"
#define prtd(n, var)     cout << fixed << setprecision(n) << var << "\n"
#define prtfill(n, var)  cout << setw(n) << setfill('0') << var;
#define prt2(v1, v2)     cout << v1 << " " << v2 << "\n"
#define prt3(v1, v2, v3) cout << v1 << " " << v2 << " " << v3 << "\n"
#define prtall(v)        rep(i,v.size()){cout<<v[i]<<(i!=v.size()-1?" ":"\n");}
void prtok(bool ok){prt((ok ? "Yes" : "No"));}
//----------------------------------------------------------------

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

  if(s=="ABC") prt("ARC");
  if(s=="ARC") prt("ABC");
}


Measured memory_bytes: 3572
import math

PI = math.pi
EPS = 10**-10

def edge(a, b):
    return ((a[0]-b[0])**2+(a[1]-b[1])**2)**.5

def area(a, b, c):
    s = (a+b+c)/2
    return (s*(s-a)*(s-b)*(s-c))**.5

def LawOfCosines(a, b, c): #余弦定理
    return math.acos( (b*b+c*c-a*a) / (2.0*b*c) );

def is_same(x, y): 
    return abs(x-y) < EPS

class Triangle:
    def __init__(self, p):
        a, b, c = p
        self.a = a
        self.b = b
        self.c = c

        self.edgeA = edge(b, c)
        self.edgeB = edge(c, a)
        self.edgeC = edge(a, b)

        self.area = area(self.edgeA, self.edgeB, self.edgeC)

        self.angleA = LawOfCosines(self.edgeA, self.edgeB, self.edgeC)
        self.angleB = LawOfCosines(self.edgeB, self.edgeC, self.edgeA)
        self.angleC = LawOfCosines(self.edgeC, self.edgeA, self.edgeB)

    def circumscribeadCircleRadius(self): #外接円の半径を返す
        return self.edgeA / math.sin(self.angleA) / 2.0

    def circumscribedCircleCenter(self): #外接円の中心の座標を返す
        a = math.sin(2.0*self.angleA);
        b = math.sin(2.0*self.angleB);
        c = math.sin(2.0*self.angleC);
        X = (self.a[0] * a + self.b[0] * b + self.c[0] * c) / (a+b+c);
        Y = (self.a[1] * a + self.b[1] * b + self.c[1] * c) / (a+b+c);
        return X, Y

    def inscribedCircleRadius(self): #内接円の半径
        return 2 * self.area / (self.edgeA + self.edgeB + self.edgeC)

    def inscribedCircleCenter(self): #内接円の中心の座標
        points = [self.a, self.b, self.c]
        edges = [self.edgeA, self.edgeB, self.edgeC]
        s = sum(edges)
        return [sum([points[j][i]*edges[j] for j in range(3)])/s for i in range(2)]

    def isInner(self, p): #点が三角形の内側か判定
        cross = lambda a, b: a[0]*b[1]-a[1]*b[0]

        c1 = 0
        c2 = 0
        points = [self.a, self.b, self.c]
        for i in range(3):
            a = [points[i][0]-points[(i+1)%3][0], points[i][1]-points[(i+1)%3][1]]
            b = [points[i][0]-p[0],  points[i][1]-p[1]]
            c = cross(a, b)
            if c > 0:
                c1 += 1
            elif c < 0:
                c2 += 1
        if c1 == 3 or c2 == 3:
            return True
        else:
            return c1+c2 != 3 and (c1 == 0 or c2 == 0)


if __name__ == "__main__":
    n = int(input())
    for _ in range(n):
        points = []
        c = list(map(float, input().split()))
        points = [(c[i], c[i+1]) for i in range(0, 6, 2)]
        t = Triangle(points)

        #外接円
        x, y = t.circumscribedCircleCenter()
        r = t.circumscribeadCircleRadius()
        print("{:.3f} {:.3f} {:.3f}".format(x,y,r))



Measured memory_bytes: 5836
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.Map;
import java.util.Queue;
import java.util.Scanner;
import java.util.Set;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		while (true) {
			String init = sc.next();
			if (init.equals("0"))
				break;
			Queue<String> q = new LinkedList<String>();
			Map<String, Integer> nodes = new HashMap<String, Integer>();
			Set<String> visited = new HashSet<String>();
			nodes.put(init, 0);
			q.add(init);
			String anss[] = { init.replaceAll(".", "r"),
					init.replaceAll(".", "g"), init.replaceAll(".", "b") };
			String ans = "";
			boolean flag = false;
			while (q.peek() != null) {
				String bug = q.poll();
				for (int i = 0; i < 3; i++) {
					if (bug.equals(anss[i])) {
						flag = true;
						ans = anss[i];
						break;
					}
				}
				if (flag)
					break;
				if (visited.contains(bug))
					continue;
				visited.add(bug);

				for (int i = 0; i < bug.length() - 1; i++) {
					char a = bug.charAt(i);
					char b = bug.charAt(i + 1);
					if (a != b) {
						char[] cs = bug.toCharArray();
						if (a != 'r' && b != 'r') {
							cs[i] = cs[i + 1] = 'r';
						} else if (a != 'g' && b != 'g') {
							cs[i] = cs[i + 1] = 'g';
						} else {
							cs[i] = cs[i + 1] = 'b';
						}
						String nbug = (new StringBuilder()).append(cs)
								.toString();
						q.add(nbug);
						nodes.put(nbug, nodes.get(bug) + 1);
					}
				}
			}

			System.out.println(flag ? nodes.get(ans) : "NA");
		}
	}
}

Measured memory_bytes: 17000
import java.util.*;

public class Main {
 public static void main(String[] argv) {
  int n;
  Scanner in = new Scanner(System.in);
  n = in.nextInt();
  int[] list = new int[n];
  for(int i = 0; i < n; i ++) {
   list[i] = in.nextInt();
  }
  for(int i = 0; i < n; i ++) {
   System.out.println(calculation(list, i));
  }
 }
 
 public static String calculation(int[] list, int i){
  int id = i+1;
  int k = list[i];
  int pk = 0;
  int lk = 0;
  int rk = 0;
  String combination = "node " + id + ": key = " + k + ", ";
  if(id != 1){
    combination = combination + "parent key = " + list[(i-1)/2] +", ";
  }
  if((2*i+1) < list.length){
    combination = combination + "left key = " + list[2*i+1] + ", ";
  }
  if((2*i+2) < list.length){
    combination = combination + "right key = " + list[2*i+2] + ", ";
  }
  return combination;
 }
}


Measured memory_bytes: 27748
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
/*
//#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
*/

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
/*
//#if __cplusplus >= 201103L
#include <array>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
*/
using namespace std;
#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define maxch(x,y) x=max(x,y)
#define minch(x,y) x=min(x,y)
#define mp(a,b) make_pair(a,b)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define maxch(x,y) x=max(x,y)
#define minch(x,y) x=min(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
template<class T,class U>inline void chmin(T &t,U f){if(t>f)t=f;}
template<class T,class U>inline void chmax(T &t,U f){if(t<f)t=f;}
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) > (b) ? (b) : (a))

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> PPI;

#define INF INT_MAX/3
#define MAX_N 1000

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

ll a[int(1e5)+5];

int main(){

    ll n,x;
    ll cnt=0;
    cin >> n >> x;
    for(ll i=0; i<n; i++) cin >> a[i];

    for(ll j=0; j<n-1; j++){
        if(a[j] + a[j+1] <= x) continue;
            ll tmp_sum = a[j] + a[j+1];
            cnt += tmp_sum - x;
            a[j+1] -= (tmp_sum - x);
            if(a[j+1] < 0) {
                a[j+1] = 0; //マイナスになられては困るので
            } //同様
    }

    cout << cnt << endl;

}


Measured memory_bytes: 1024
#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <ctime>
#include <vector>
#define LL long long
#define int long long
#define N 600011
using namespace std;
int indexx[N],d[N],fa[N],n,tot,deep[N];
LL ans,sum;
struct apple{
	int v,nxt;
	LL q;
}edge[N*2];
struct node{
	LL x,y;
}t1[N],t2[N],temp;
vector<node> V[N],V1;
void addedge(int x,int y,LL z){
	edge[++tot].v=y;
	edge[tot].q=z;
	edge[tot].nxt=indexx[x];
	indexx[x]=tot;
}
int check(node u,node v,LL fin,LL avr){
	if(u.y+v.x-fin*2<=avr) return 1;
	return 0;
}
void dfs(int u,LL avr){
	if(!indexx[u]){
		temp.x=deep[u];
		temp.y=deep[u];
		V[u].push_back(temp);
		return;
	}
	int t=indexx[u],p=-1,siz1=0,siz2=0;
	int l=edge[t].v;
	deep[l]=deep[u]+edge[t].q;
	t=edge[t].nxt;
	int r=edge[t].v;
	deep[r]=deep[u]+edge[t].q;
	dfs(l,avr);dfs(r,avr);
	int len1=V[l].size();
	int len2=V[r].size();
	for(int i=0;i<len1;i++){
		while(p<len2-1 && check(V[l][i],V[r][p+1],deep[u],avr)) p++;
		if(p>=0){
			t1[++siz1].x=V[l][i].x;
			t1[siz1].y=V[r][p].y;
			t2[++siz2].x=V[r][p].y;
			t2[siz2].y=V[l][i].x;
		}
	}
	for(int i=1;i<=siz2;i++){
		if(i<siz2-i+1) swap(t2[i],t2[siz2-i+1]);
		else break;
	}
	int i=1,j=1;
	while(i<=siz1 && j<=siz2){
		if(t1[i].x<=t2[j].x) V1.push_back(t1[i++]);
		else V1.push_back(t2[j++]);
	}
	while(i<=siz1) V1.push_back(t1[i++]);
	while(j<=siz2) V1.push_back(t2[j++]);
	int len=V1.size();
	for(int i=0;i<len;i++){
		if(i==0 || V1[i].y<V1[i-1].y) V[u].push_back(V1[i]);
	}
	V1.clear();
}
int judge(LL avr){
	for(int i=1;i<=n;i++) V[i].clear();
	dfs(1,avr);
	if(V[1].size()>0) return 1;
	else return 0;
}
void bin(){
	LL head=0,tail=sum,mid;
	while(head<=tail){
		mid=(head+tail)/2;
		if(judge(mid)){
			tail=mid-1;
			ans=mid;
		}
		else head=mid+1;
	}
}
signed main(){
	LL z;
	scanf("%lld",&n);
	for(int i=2;i<=n;i++){
		scanf("%lld%lld",&fa[i],&z);
		addedge(fa[i],i,z);
		d[fa[i]]++;
		sum+=z;
	}
	bin();
	printf("%lld",ans);
	return 0;
}

Measured memory_bytes: 59252
import math
import sys
from itertools import accumulate
from functools import reduce
from collections import Counter
import queue
from fractions import gcd

def lcm(a, b):
    return a * b // gcd(a, b)

def combination_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

def permutations_count(n, r):
    return math.factorial(n) // math.factorial(n - r)

sys.setrecursionlimit(10000)

mod = 1000000007

"""
# 0埋め, 小数点出力桁指定時のときの出力
a = 100
b = 0.987654321
print("{0:06d}-{1:6f}".format(a,b))
000100-0.987654

# 文字列をリストに格納
char_list = list("abcd") # ["a","b","c","d"]

# 標準入力取得
## 文字列
    = sys.stdin.readline().rstrip()
    = list(sys.stdin.readline().rstrip())

## 数値
    = int(sys.stdin.readline())
    = map(int, sys.stdin.readline().split())
    = list(map(int, sys.stdin.readline().split()))
    = [list(map(int,list(sys.stdin.readline().split()))) for i in range(h)]  # 二次元配列入力　二次元マップみたいな入力のとき
"""

if __name__ == "__main__":
    N = int(sys.stdin.readline())
    L = list(map(int, sys.stdin.readline().split()))
    l = N // 2
    eL = Counter([L[i] for i in range(N) if i % 2 != 0])
    oL = Counter([L[i] for i in range(N) if i % 2 == 0])
    eLc = eL.most_common() # even list most common
    oLc = oL.most_common() # odd  list most common

    if len(eLc) == 1 or len(oLc) == 1:
        if len(eLc) == 1 and len(oLc) == 1:
            if eLc[0] != oLc[0]:
                print(0)
            else:
                print(l)
        elif len(eLc) == 1:
            print((l - oLc[0][1]))
        else:
            print((l - eLc[0][1]))
    else:
        if eLc[0][0] != oLc[0][0]:
            print((l - eLc[0][1]) + (l - oLc[0][1]))
        else:
            print(min((l - eLc[1][1]) + (l - oLc[0][1]), (l - eLc[0][1]) + (l - oLc[1][1])))


Measured memory_bytes: 22856
#include <stdio.h>
#include <stdlib.h>
#define MAX 2000001
#define VMAX 10000

int main(){
  unsigned short *A, *B;
  int C[VMAX+1];
  int n, i, j;

  scanf("%d", &n);

  A = malloc(sizeof(short)*n+1);
  B = malloc(sizeof(short)*n+1);
  for (i=0;i<=VMAX;i++) C[i] = 0;
  for (j=1;j<=n;j++){
    scanf("%d",&A[j]);
    C[A[j]]++;
  }
  //  printf("%d",n);                                                           
  for (i=1;i<=VMAX;i++) C[i] = C[i] + C[i-1];
  for (j=n;j>=1;j--){
    B[C[A[j]]] = A[j];
    C[A[j]]--;
  }
  for(i=1;i<=n;i++){
    if(i>1)printf(" ");
    printf("%d",B[i]);
  }
    printf("\n");

  return 0;
}





Measured memory_bytes: 9584
#include <bits/stdc++.h>
//#include <atcoder/all>
using namespace std;
template <typename T> bool chmax(T &u, const T z) { if (u < z) {u = z; return true;} else return false; }
template <typename T> bool chmin(T &u, const T z) { if (u > z) {u = z; return true;} else return false; }
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long 
typedef pair<ll, ll> P;
const ll INF=1LL<<60;
ll gcd(ll x,ll y){return y? gcd(y,x%y) :x;}

int main(){
    int n;
    ll h;
    cin>>n>>h;
    priority_queue<ll> a,b;
    rep(i,n){
        ll x,y;
        cin>>x>>y;
        a.push(x);
        b.push(y);
    }
    ll cnt=0;
    while(h){
        cnt++;
        //cout<<cnt<<" "<<h<<" ";
        ll x,y;
        x=a.top();a.pop();
        if(b.empty())y=0;
        else {y=b.top();b.pop();}
        //cout<<x<<" "<<y<<endl;
        if(x>=y){
            ll kazu=h/x;
            if(h%x!=0)kazu++;
            cnt+=kazu-1;
            h=0;
            a.push(x);
            b.push(y);
            //cout<<"a";
        }else {
            h-=y;
            a.push(x);
            //cout<<"b";
        }
        if(h<=0)break;
    }
    cout<<cnt<<endl;
}

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

using namespace std;

#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=s;i<n;i++)
#define all(a) (a).begin(),(a).end()

int main(){
    char ch;
    while(1){
        scanf("%c", &ch);
        if(ch == '\n')break;

        if(ch >= 'A' && ch <= 'Z')ch += 32;
        else if(ch >= 'a' && ch <= 'z')ch -= 32;

        printf("%c", ch);
    }
    printf("\n");
    return 0;
}


Measured memory_bytes: 3080
#include <stdio.h>
#include <deque>

using namespace std;

int main() {
	int left = 1, right, mid, ans, n, k, sz, zero;
	char s[100010];
	bool bisa;
	deque<char> temp;
	scanf("%d %d\n%s", &n, &k, s);
	right = n;
	while (left <= right) {
		mid = (left + right) / 2;
		temp.clear();
		for (int i = 0; i < mid; i++) {
			sz = temp.size();
			if (i < 1)
				temp.push_back(s[i]);
			else if (temp[sz - 1] != s[i])
				temp.push_back(s[i]);
		}
		bisa = false;
		for (int i = 0; i <= n - mid; i++) {
			sz = temp.size();
			zero = sz / 2;
			if (temp[0] == '0')
				zero = (sz + 1) / 2;
			if (zero <= k) {
				ans = mid;
				left = mid + 1;
				bisa = true;
				break;
			}
			if (i == n - mid)
				break;
			if (s[i] != s[i + 1])
				temp.pop_front();
			if (s[i + mid] != s[i + mid - 1])
				temp.push_back(s[i + mid]);
		}
		if (!bisa)
			right = mid - 1;
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
const int inf = 1e9 + 7;
const ll INF = 1e18;
int mod = 1000000007;
#define abs(x) (x >= 0 ? x : -(x))
#define lb(v, x) (int)(lower_bound(all(v), x) - v.begin())
#define ub(v, x) (int)(upper_bound(all(v), x) - v.begin())
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
template<typename T> T pow(T a, int b) { return b ? pow(a * a, b / 2) * (b % 2 ? a : 1) : 1; }
ll modpow(ll a, ll b, ll _mod) { return b ? modpow(a * a % _mod, b / 2, _mod) * (b % 2 ? a : 1) % _mod : 1; }
template<class T> ostream& operator << (ostream& os, const vector<T>& vec) { for (auto &vi: vec) os << vi << " "; return os; }
template<class T, class U> ostream& operator << (ostream& os, const pair<T, U>& p) { os << p.F << " " << p.S; return os; }
template<typename T >inline istream& operator >> (istream& is, vector<T>& v) { rep(j, sz(v)) is >> v[j]; return is; }
template<class T> inline void add(T &a, int b) { a += b; if (a >= mod) a -= mod; }


void solve();

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

  int T;
  // cin >> T;
  T = 1;

  while (T--) {
    solve();
  }
}
void solve() {
  int n, k;
  cin >> n >> k;
  vector<int> x(n + 1);
  rep3(i, 1, n + 1) {
    int j = i;
    while (j < k) {
      j *= 2;
      x[i]++;
    }
  }
  // cout << x << endl;
  double ans = 0;
  rep3(i, 1, n + 1) {
    double tmp = 1.0 / n;
    rep(j, x[i]) tmp *= 1.0 / 2;
    ans += tmp;
  }
  cout << ans << endl;
}


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

using namespace std;

#define ll long long
#define pb push_back
#define mp make_pair
#define fst first
#define snd second

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

    vector<int> cnt(35);
    for(int i = 0; i < s.size(); i++)
        cnt[s[i] - 97]++;

    if(cnt[0] && cnt[1] && cnt[2])
        cout << "Yes";
    else
        cout << "No";

    return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

		String N = sc.next();	
		
		int price = 700;
		
		if(N.equals("ooo"))
			price=1000;
		else if(N.equals("oox")||N.equals("oxo")||N.equals("xoo"))
			price=900;
		else if(N.equals("xxx"))
			price=700;
		else
			price=800;
		
		System.out.println(price);
		

	}

}


Measured memory_bytes: 20308
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
typedef vector<int> VI;
typedef pair<int, int> pii;
typedef priority_queue<int> PQ;
#define fore(i,a) for(auto &i:a)
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
//vector<vector<int> > dp;
//vector<vector<vector<int> > > vvvi;
//dp=vector<vector<int> >(N, vector<int>(M,0));
//vector<pair<int,int> > v;
//v.push_back(make_pair(x,y));
//priority_queue<int,vector<int>, greater<int> > q2;



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

	int A,B;
	cin >> A >> B;

	if ((A + B) % 2 == 0) {
		cout << (A + B) / 2 << endl;
	}
	else {
		cout << "IMPOSSIBLE" << endl;
	}
	return 0;
}



Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] a) throws IOException{

		String strLine ="";
		BufferedReader stdReader =
				new BufferedReader(new InputStreamReader(System.in));

		int i = 0;
		int max = 50;
		int[] tempInt = new int[2];

		while ( i <= max && ((strLine = stdReader.readLine()) != null) ){


				//??????????????§?????????
				String[] temp = strLine.split(" ",-10);
				tempInt[0] =Integer.parseInt(temp[0]);
				tempInt[1] = Integer.parseInt(temp[1]);

				int maxYakusu = 1;

				for(int k = tempInt[1]-1 ; k > 1 ; k--){

					if((tempInt[0]%k == 0)&&(tempInt[1]%k == 0)){
						tempInt[0] = tempInt[0]/k;
						tempInt[1] = tempInt[1]/k;
						maxYakusu = maxYakusu * k;


					}

				}


				//????°???¬?????°????±????????????????????´???????
				int maxBaisu = maxYakusu * tempInt[0] * tempInt[1];

				System.out.println(maxYakusu+" "+maxBaisu);
				i++;
		}

	}

}

Measured memory_bytes: 25356
#include <iostream>

int main(int argc, char** argv)
{
	int a = 0;
	int b = 0;

	while (true)
	{
		std::cin >> a >> b;
		if (a == 0 && b == 0)
		{
			break;
		}

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

	return 0;
}


Measured memory_bytes: 3016
#include<iostream>
using namespace std;
int main(){
  int a,b;
  cin >> a >> b;
  
  if(a <= 8 && b <= 8){
    
    cout << "Yay!" << endl;
  }else{
    cout << ":(" << endl;
  }
  
  return 0;
  
  
}
  
  

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();// <10^5
        int m = sc.nextInt();// <10^9
        
        
        int[] a = new int[n];
        
        // Arrays.fill(a, 1);
        int probMaxGcd = m / n;
        int gcd;
        for(gcd = probMaxGcd; gcd >= 1; gcd--) {
            // 最大公約数*整数の和も最大公約数で割り切れ
            if(m % gcd != 0) {
                continue;
            }
            // NGはここで超える
            // 超えてなければ答え
            if(gcd * n <= m) {
                break;
            }
        }
        System.out.println(gcd);
    }
}


Measured memory_bytes: 23124
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int , int> i_i;
typedef vector<ll> vl;
typedef vector<int> vi;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> vvl;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvec;
typedef vector<vector<bool>> vveb;
typedef vector<vector<string>> vves;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define fs first
#define sc second
#define pb push_back
#define pp pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)
typedef long long int64;
//const int64 INF = 1LL << 58;
#define dame { puts("-1"); return 0;}
#define YES { cout << "YES" << endl; return 0; }
#define NO { cout << "NO" << endl; return 0; }
#define Yes { cout << "Yes" << endl; return 0; }
#define No { cout << "No" << endl; return 0; }
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
int dx[] = {0, 0, -1, 1};
int dy[] = {1, -1, 0, 0};

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

    ll N, M; cin >> N >> M;
    vl A(N); rep(i,N) cin >> A[i];
    vl S(N+1,0); rep(i,N) S[i+1] = S[i] + A[i];
    rep(i,N+1) S[i] %= M;
    sort(all(S));

    int now = -1;
    ll cnt = 1;
    ll ans = 0;
    rep(i,N+1){
        if(S[i] == now) cnt++;
        else {
            ans += cnt * (cnt - 1) / 2;
            cnt = 1;
            now = S[i];
        }
    }
    if(cnt != 1) ans += cnt * (cnt - 1LL) / 2;
    cout << ans << endl;
}



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


int main() {
    int a,b,c;cin >> a >> b >> c;
    if (a+b == c || b+c == a || c+a == b){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    

}       

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define rep(i, a, b) for(int i = (a); i < (b); ++i)
#define per(i, a, b) for(int i = (b) - 1; i >= (a); --i)
#define sz(a) (int)a.size()
#define de(c) cout << #c << " = " << c << endl
#define dd(c) cout << #c << " = " << c << " "
#define all(a) a.begin(), a.end()
#define pw(x) (1ll<<(x))
#define endl "\n"
typedef long long ll;
typedef double db;
typedef pair<int, int> pii;
typedef vector<int> vi;

typedef db T;
const db eps = 1e-9 , pi = acosl(-1.);
int sgn(T x){return (x>eps)-(x<-eps);}
struct P{
  T x,y; P(){} P(T x,T y):x(x),y(y){}
  P operator - (const P&b) const {return P(x-b.x,y-b.y);}
  P operator + (const P&b) const {return P(x+b.x,y+b.y);}
  T operator * (const P&b) const {return x*b.x+y*b.y;}
  T operator / (const P&b) const {return x*b.y-y*b.x;}
  P operator * (const T&k) const {return P(x*k,y*k);}
  P operator / (const T&k) const {return P(x/k,y/k);}
};
T norm(P a){return a*a;}
P proj(P p,P a,P b){return (b-a)*((p-a)*(b-a)/norm(b-a))+a;}
P reflect(P p,P a,P b){return proj(p,a,b)*2-p;}
T cross(P o,P a,P b){return (a-o)/(b-o);}
int crossOp(P o,P a,P b){return sgn(cross(o,a,b));}
bool onPS(P p,P s,P t){return sgn((t-s)/(p-s))==0&&sgn((p-s)*(p-t))<=0;}

P a, b, c, d;

int main() {
	std::ios::sync_with_stdio(0);
	std::cin.tie(0);
	int q;
	cin >> q;
	cout << setiosflags(ios::fixed);
	cout << setprecision(10);
	while(q--) {
		cin >> a.x >> a.y >> b.x >> b.y;
		cin >> c.x >> c.y >> d.x >> d.y;
		if(sgn((b - a) / (d - c)) == 0) {
			cout << 2 << endl;
		} else if(sgn((b - a) * (d - c)) == 0) {
			cout << 1 << endl;
		} else {
			cout << 0 << endl;
		}
	}
	return 0;
}


Measured memory_bytes: 3328
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

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

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

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

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

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

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

trait IteratorExt: Iterator + Sized {
    fn vec(self) -> Vec<Self::Item> {
        self.collect()
    }
}

impl<T: Iterator> IteratorExt for T {}

#[allow(unused)]
use std::cmp::{max, min};
#[allow(unused)]
use std::collections::HashMap;

fn main() {
    input! {
        // usize
        // n: usize,
        // vec
        // v: [i64; n],
        a: i64,
        b: i64,
        c: i64,
        d: i64,
    }

    let l = lcm(c, d);
    let bc = b / c;
    let bd = b / d;
    let bcd = b / l;
    let ac = (a - 1) / c;
    let ad = (a - 1) / d;
    let acd = (a - 1) / l;

    println!("{}", (b - (bc + bd - bcd)) - (a - (ac + ad - acd)) + 1);
}

fn gcd(c: i64, d: i64) -> i64 {
    if d == 0 {
        c
    } else {
        gcd(d, c % d)
    }
}

fn lcm(c: i64, d: i64) -> i64 {
    c * d / gcd(c, d)
}


Measured memory_bytes: 4352
#include <cstdio>
#include <vector>
#include <queue>
#include <algorithm>
using namespace std;


const int inf = (int)30000;


int calc_cost(vector<vector<char> > &m, int x, int y)
{
	int w = m.size(), h = m[0].size();
	if(x < 0 || x >= w || y < 0 || y >= h)
		return inf;
	if(m[x][y] < '0' || m[x][y] > '9')
		return (m[x][y] == 'T' || m[x][y] == 'S') ? 0 : inf;
	return m[x][y] - '0'; 
}


int calc_idx(vector<vector<char> > &m, int x1, int y1, int x2, int y2, int next)
{
	int w = m.size(), h = m[0].size();
	return ((x1 * h + y1) * (w * h) + (x2 * h + y2)) * 2 + next;
}


int main()
{
	while(true) {

		int w, h, wh;
		vector<vector<char> > m;
		const int dx[] = {1, 1, 1, 1, 1, 2, 2, 2, 3};
		const int dy[] = {-2, -1, 0, 1, 2, -1, 0, 1, 0};
		const int dir = 9;

		scanf("%d%d", &w, &h);
		if(w == 0)
			break;
		wh = w * h;
		m.resize(w);
		for(int i = 0; i < w; ++i)
			m[i].resize(h);
		for(int y = 0; y < h; ++y) {
			for(int x = 0; x < w; ++x)
				scanf(" %c", &m[x][y]);
		}

		vector<short> distl, distr;
		priority_queue<pair<int, int> > q;
		int ans = inf;

		distl.resize(wh * wh * 2, inf);
		distr.resize(wh * wh * 2, inf);

		for(int y = 0; y < h; ++y) {
			for(int x = 0; x < w; ++x) {

				if(m[x][y] != 'S')
					continue;

				for(int d = 0; d < dir; ++d) {
					int nx1 = x + dx[d], nx2 = x - dx[d];
					int ny1 = y + dy[d], ny2 = y + dy[d];
					int c1 = calc_cost(m, nx1, ny1);
					int c2 = calc_cost(m, nx2, ny2);
					if(c1 < inf)
						q.push(make_pair(-c1, calc_idx(m, x, y, nx1, ny1, 0)));
					if(c2 < inf)
						q.push(make_pair(-c2, calc_idx(m, nx2, ny2, x, y, 1)));
				}
			}
		}

		while(!q.empty()) {

			int cost = -q.top().first;
			int idx = q.top().second;
			q.pop();

			int x1 = ((idx / 2) / wh) / h;
			int y1 = ((idx / 2) / wh) % h;
			int x2 = ((idx / 2) % wh) / h;
			int y2 = ((idx / 2) % wh) % h;
			int next = idx % 2;

			//printf("%d %d %d %d (%d) -> %d  / %c %c\n", x1, y1, x2, y2, next, cost,
			//	m[x1][y1], m[x2][y2]);

			if(next == 0) {
				if(distr[idx] <= cost)
					continue;
				distr[idx] = cost;
			} else {
				if(distl[idx] <= cost)
					continue;
				distl[idx] = cost;
			}

			if((m[x1][y1] == 'T') || (m[x2][y2] == 'T')) {
				ans = min(ans, cost);
				continue;
			}

			if(next == 0) {

				for(int d = 0; d < dir; ++d) {
					int nx = x2 - dx[d], ny = y2 + dy[d];
					int c = calc_cost(m, nx, ny) + cost;
					int i = calc_idx(m, nx, ny, x2, y2, 1);
					if(c >= inf)
						continue;
					if(c >= distl[i])
						continue;
					q.push(make_pair(-c, i));
				}

			} else {

				for(int d = 0; d < dir; ++d) {
					int nx = x1 + dx[d], ny = y1 + dy[d];
					int c = calc_cost(m, nx, ny) + cost;
					int i = calc_idx(m, x1, y1, nx, ny, 0);
					if(c >= inf)
						continue;
					if(c >= distr[i])
						continue;
					q.push(make_pair(-c, i));
				}	
			}
		}

		if(ans < inf)
			printf("%d\n", ans);
		else
			printf("-1\n");
	}

	return 0;
}

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

int main(){
  int n,a,b,c,d;
  string s;
  cin >> n >> a >> b >> c >> d >> s;
  a--;
  b--;
  c--;
  d--;

  for (int i = a; i < max(c,d); i++)
  {
    if(s[i]=='#' && s[i+1]=='#'){
      puts("No");
      return 0;
    }
  }

  bool ok = true;
  if(d<c){
    ok = false;
    for (int i = b; i <= d; i++)
    {
      if(s[i-1]=='.' && s[i]=='.' && s[i+1]=='.') ok = true;
    }
  }
  if(ok) puts("Yes");
  else puts("No");
}

Measured memory_bytes: 640
#include<bits/stdc++.h> 
using namespace std;
int dp[500001];
long long sum=0, n,k,p=1;
int  arr[11];
int main(){
    int n;
    cin>>n;
int** a = new int*[n];
for(int i = 0; i < n; ++i)
    a[i] = new int[3];
    for(int i=0;i<n;i++){
        cin>>a[i][0]>>a[i][1]>>a[i][2];
    }
    for(int i=1;i<n;i++){
        a[i][0]+=max(a[i-1][1],a[i-1][2]);
        a[i][1]+=max(a[i-1][0],a[i-1][2]);
        a[i][2]+=max(a[i-1][1],a[i-1][0]);
    }
    cout<<max(a[n-1][0],max(a[n-1][1],a[n-1][2]));
 return 0;
}


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

long long n,m,a,b,c;
long long cnt[100010];
priority_queue<int,vector<int>,greater<int> >PQ[2];

int main(){
	cin>>n>>m>>a;
	for(int i=1;i<m;i++){
		cin>>b;
		PQ[0].push(min(a,b)-1);
		PQ[1].push(max(a,b)-1);
		a=b;
	}
	c=0;
	for(int i=0;i<n;i++){
		while(!PQ[0].empty()){
			if(PQ[0].top()!=i)break;
			c++;
			PQ[0].pop();
		}
		while(!PQ[1].empty()){
			if(PQ[1].top()!=i)break;
			c--;
			PQ[1].pop();
		}
		cnt[i]=c;
	}

	long long ans=0;
	for(long long i=0;i<n-1;i++){
		cin>>a>>b>>c;
		ans+=min(a*cnt[i],c+(b*cnt[i]));
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 4544
#include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<vector>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<time.h>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double EPS=1e-10;
const int inf=1e8;
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
int main(){
	int n;
	while(cin>>n,n){
		vector<int>in(25*60*60);
		rep(i,n){
			int a,b,c;char d;
			cin>>a>>d>>b>>d>>c;
			in[a*60*60+b*60+c]++;
			cin>>a>>d>>b>>d>>c;
			in[a*60*60+b*60+c]--;
		}
		int ma=0;
		int co=0;
		rep(i,25*60*60){
			co+=in[i];
			ma=max(ma,co);
		}
		cout<<ma<<endl;
	}
}

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

int main()
{
    int a , b , t , s = 0 ;
    float time ;
    cin >> a  >> b >> t ;
    time = t + 0.5 ;
    while (time >= a) {
            time -= a ;
            s += b ;
    }
    cout << s ;
    return 0;
}


Measured memory_bytes: 3652
btc_rate = 380000.0

N = int(input())

otoshidama = 0
for i in range(N):
    x, v = input().split()
    if v == 'BTC':
        otoshidama += float(x) * btc_rate        
    else :
        otoshidama += int(x)
        
print(otoshidama)

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

using namespace std;

template <long long Mod> struct ModInt { /* {{{ */
  long long v;
  constexpr ModInt(const long long x = 0) {
    v = x % Mod;
    if (v < 0) {
      v += Mod;
    }
  }
  constexpr ModInt operator+(const ModInt rhs) const {
    return ModInt(*this) += rhs;
  }
  constexpr ModInt operator-(const ModInt rhs) const {
    return ModInt(*this) -= rhs;
  }
  constexpr ModInt operator*(const ModInt rhs) const {
    return ModInt(*this) *= rhs;
  }
  constexpr ModInt operator/(const ModInt rhs) const {
    return ModInt(*this) /= rhs;
  }
  const ModInt &operator+=(const ModInt rhs) {
    v += rhs.v;
    if (v >= Mod) {
      v -= Mod;
    }
    return *this;
  }
  constexpr ModInt &operator-=(const ModInt rhs) {
    if (v < rhs.v) {
      v += Mod;
    }
    v -= rhs.v;
    return *this;
  }
  constexpr ModInt &operator*=(const ModInt rhs) {
    v = v * rhs.v % Mod;
    return *this;
  }
  constexpr ModInt &operator/=(ModInt rhs) {
    long long exp = Mod - 2;
    while (exp) {
      if (exp % 2) {
        *this *= rhs;
      }
      rhs *= rhs;
      exp /= 2;
    }
    return *this;
  }
  friend ostream &operator<<(ostream &s, ModInt<Mod> m) {
    s << m.v;
    return s;
  }
  friend istream &operator>>(istream &s, ModInt<Mod> m) {
    s >> m.v;
    return s;
  }
}; /* }}} */

const int mod = 1e9 + 7;
using modint = ModInt<mod>;

int main() {
  int N;
  cin >> N;
  vector<long long> C(N);
  for (auto &c : C) {
    cin >> c;
  }
  sort(C.rbegin(), C.rend());
  modint ans = 0;
  for (int i = 0; i < N; i++) {
    ans += (i + 2) * C[i];
  }
  for (int i = 0; i < N - 1; i++) {
    ans *= 4;
  }
  cout << ans << endl;

  return 0;
}
/* vim:set fdm=marker: */


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define inf 1001001001001001001
#define mod 1000000007
#define mod2 998244353
#define pi acos(-1)
#define all(v) v.begin(),v.end()

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

Measured memory_bytes: 3552
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <chrono>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <string>
#include <tuple>
#include <unordered_map>
#include <vector>
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()

const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
/*----------------------------------------*/

int main() {
  cin.tie(0); ios::sync_with_stdio(false);
  // freopen("input.txt", "r", stdin);

  string s; cin >> s;
  sort(ALL(s));
  cout << (s == "abc"? "Yes" : "No") << '\n';
  return 0;
}


Measured memory_bytes: 256
K,N = map(int, input().split())
A = list(map(int, input().split()))

dist = []
for i in range(N):
  if i == N-1:
    dist.append(K+A[0]-A[i])
  else:
    dist.append(A[i+1]-A[i])
max_dist = max(dist)
print(sum(dist)-max_dist)

Measured memory_bytes: 32252
#include "bits/stdc++.h"
#define Rep(i,n) for(int i=0;i<n;i++)
#define For(i,n1,n2) for(int i=n1;i<n2;i++)
#define REP(i,n) for(ll i=0;i<n;i++)
#define FOR(i,n1,n2) for(ll i=n1;i<n2;i++)
#define put(a) cout<<a<<endl;
#define all(a)  (a).begin(),(a).end()
#define SORT(c) sort((c).begin(),(c).end())
#define TDARRAY(int,a,n,m) vector<vector<int>> a(n,vector<int>(m,0));
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;}

int n;

int main(){
    cin >> n;
    if(n%2==0){
        int m = n/2;
        vector<P> p;
        p.push_back(P(1,2));
        p.push_back(P(1,2*m-1));
        p.push_back(P(2,2*m));
        p.push_back(P(2*m-1,2*m));
        int low=2;
        int up=2*m-1;
        FOR(i,3,m+1){
            FOR(j,1,low+1){
                p.push_back(P(i,j));
                p.push_back(P(n+1-i,j));
            }
            FOR(j,up,n+1){
                p.push_back(P(i,j));
                p.push_back(P(n+1-i,j));
            }
            
            low++;
            up--;
            
        }
        put(p.size());
        REP(i,p.size()){
            cout << p[i].first << " " << p[i].second << endl;
        }
    }else{
        int m = n/2;
        vector<P> p;
        p.push_back(P(1,2*m+1));
        p.push_back(P(2*m,2*m+1));
        int low=1;
        int up=2*m;
        FOR(i,2,m+1){
            FOR(j,1,low+1){
                p.push_back(P(i,j));
                p.push_back(P(n-i,j));
            }
            FOR(j,up,n+1){
                p.push_back(P(i,j));
                p.push_back(P(n-i,j));
            }
            
            low++;
            up--;
            
        }
        put(p.size());
        REP(i,p.size()){
            cout << p[i].first << " " << p[i].second << endl;
        }
    }
    return 0;
}


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

typedef long long ll;
const ll mod = 1e9+7;

ll modpow(ll a, ll b, ll p = 1e9+7){
    if(b == 0)  return 1;

    if(b % 2 == 0){
        ll d = modpow(a, b/2, p);
        return (d*d) % p;
    }else{
        return (a%p * modpow(a, b-1, p)) % p;
    }
}

struct ModComb{
    vector<ll> po, inv;
    ll N;

    ModComb(ll n) : N(n), po(n), inv(n) {
        po[0] = 1;
        for(int i = 1; i < N; i++)  po[i] = (po[i-1] * i) % mod;
        inv[N-1] = modpow(po[N-1], mod-2, mod);
        for(int i = N-2; i >= 0; i--)   inv[i] = (inv[i+1] * (i+1)) % mod;
    }
    
    ll nCk(ll n, ll k){
        if(k == 0)  return 1;
        if(n < k)   return 0;
        return (((po[n]*inv[n-k])%mod)*inv[k])%mod;
    }

    ll nPk(ll n, ll k){
        if(k == 0)  return 1;
        if(n < k)   return 0;
        return (po[n]*inv[n-k])%mod;
    }

    ll nHk(ll n, ll k){
        if(n == 0 && k == 0)    return 1;
        return nCk(n+k-1, k-1);
    }
};

int main(){
    int k;
    string s;
    cin >> k >> s;
    int n = s.length();
    ModComb mc(k+n+1);
    ll ans = 0;
    for(int i = n; i <= n+k; i++){
        (ans += mc.nCk(i-1,n-1)*modpow(25,i-1-(n-1))%mod*modpow(26,n+k-i)%mod) %= mod;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 35592
#include <stdio.h>

int main()
{
  int a, b, c;
  int i;
  int count = 0;
  
  scanf("%d %d %d", &a, &b, &c);
  for (i = a; i <= b; i++) {
    if (!(c % i)) count++;
  }
  printf("%d\n", count);

  return 0;
}



Measured memory_bytes: 2092
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define vll vector<ll>
#define pll pair<ll,ll>
#define forA(i,a,n,x) for(auto i=a;i<n;i+=x)
#define forD(i,a,n,x) for(auto i=n-1;i>=0;i-=x)
#define ranit(it,n) for(auto it:n)
#define testCases ll t;cin>>t;while(t--)
#define mp make_pair
#define pb push_back
#define F first
#define S second
#define mod 1000000007

int main()
{
	ios_base::sync_with_stdio(false);	cin.tie(NULL);	cout.tie(NULL);
	ll n; cin>>n; vll stone(n,0); forA(i,0,n,1)cin>>stone[i];
	ll dp[n]={0}; dp[0]=0; dp[1]=abs(stone[1]-stone[0]);
	forA(i,2,n,1)
	{
		dp[i]= min(dp[i-1]+abs(stone[i]-stone[i-1]) , dp[i-2]+abs(stone[i]-stone[i-2]));
	}
	cout<<dp[n-1];
	return 0;
}

Measured memory_bytes: 4768
#include <iostream>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<vector>
#define pb push_back
#define fi first
#define se second
#define sz(x)  x.size()
#define cl(x)  x.clear()
#define all(x)  x.begin() , x.end()
#define rep(i , x , n)  for(int i = x ; i <= n ; i ++)
#define per(i , n , x)  for(int i = n ; i >= x ; i --)
#define mem(x)  memset(x , 0 , sizeof(x))
#define mem_1(x)  memset(x , -1 , sizeof(x))
#define mem_inf(x)  memset(x , 0x3f3f3f3f , sizeof(x))
#define debug(x)  cout << '*' << x << '\n'
#define ddebug(x , y)  cout << '*' << x << ' ' << y << '\n'
using namespace std ;
typedef long long ll ;
typedef pair<int , int> pii ;
typedef pair<ll , ll> pll ;
const ll mod =  1e9+7;
const ll maxn = 1e5 + 10 ;
const int inf = 0x3f3f3f3f ;
const double eps = 1e-8 ;


int main(){
    int n,ans=0,a;
    cin>>n;
    rep(i,1,n){
        cin>>a;
        if(i%2 && a%2)ans++;
    }
    cout<<ans;

}


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

using namespace std;

typedef long long int li;
typedef long double ld;
typedef vector<li> vi;
typedef pair<li,li> pi;
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define B begin()
#define E end()
#define f(i,l,r) for(li i=l;i<=r;++i)
#define fr(i,l,r) for(li i=l;i>=r;--i)
#define u_map unordered_map
#define endl "\n"

li fastpow(li base,li exp,li M) 
{
    li res=1;
    while(exp>0) {
        if(exp&1)
            res=(res*base)%M;

        base=(base*base)%M;
        exp>>=1;
    }
    return res;
}

int main()
{    
    

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

    ld r;

    cin>>r;

    cout<<fixed<<setprecision(12);

    cout<<2*3.14159265358979323846*r;

    return 0;
}

Measured memory_bytes: 3804
//Tonight's the night and it is going to happen again and again.
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mp make_pair
#define pb push_back
#define T ll t; cin>>t; while(t--)
#define mod 1000000007
#define f(n) for(ll i = 0;i<n;i++)
#define endl "\n"
ll gcd(ll a,ll b){if(b==0){return a;}return gcd(b,a%b);}
int main()
{
   ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
   #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
   #endif
    ll n1,n,x,y,d;cin>>n1>>d;
    int c=0;f(n1)
    {
    	cin>>x>>y;
    	double n=sqrt(x*x+y*y);
    	if(n<=d)
    	{
          c++;
    	}
    }
    cout<<c;
}

Measured memory_bytes: 3696
#include <bits/stdc++.h>
using namespace std;
int main()
{
  int n; cin>>n;
  vector<int> s(n);
  for(int i=0; i<n; i++) cin>>s[i];
  int q; cin>>q;
  vector<int> t(q);
  for(int i=0; i<q; i++) cin>>t[i];
  
  sort(s.begin(), s.end());
  int cnt = 0;

  for(int i=0; i<q; i++) if (binary_search(s.begin(), s.end(), t[i])) cnt++;
  cout << cnt << "\n";
}


Measured memory_bytes: 3424
// AOJ 0527: Setting Go Stones
// 2017.10.29 bal4u@uu

#include <stdio.h>
#include <stdlib.h>

int  a[100005], sz;		// length
char c[100005];			// color
char buf[10];

int main()
{
	int n, i, color, ans;

	while (fgets(buf, 10, stdin) && *buf != '0') {
		n = atoi(buf);
		fgets(buf, 5, stdin);
		a[0] = 1, c[0] = *buf & 1;
		for (sz = 0, i = 2; i <= n; i++) {
			fgets(buf, 5, stdin), color = *buf & 1;
			if (c[sz] == color) a[sz]++;
			else if (i & 1) a[++sz] = 1;	// odd pos.
			else {							// even position
				if (sz == 0) a[sz]++;
				else a[sz-1] += a[sz] + 1, sz--;
			}
			c[sz] = color;
		}
		for (ans = 0, i = 0; i <= sz; i++)
			if (!c[i]) ans += a[i];
		printf("%d\n", ans);
	}
	return 0;
}

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

using ll = long long int;

const int MAX = (int)(1e5 + 5);
const ll INF = (ll)(1e10 + 5);

string s;

int main(void) {
  // Here your code !
  cin >> s;

  int ab_num = 10 * (s[0] - '0') + (s[1] - '0');
  int cd_num = 10 * (s[2] - '0') + (s[3] - '0');

  bool ab_is_month = (1 <= ab_num) && (ab_num <= 12);
  bool cd_is_month = (1 <= cd_num) && (cd_num <= 12);

  if (ab_is_month && cd_is_month) {
    printf("AMBIGUOUS\n");
  }
  else if (ab_is_month) {
    printf("MMYY\n");
  }
  else if (cd_is_month) {
    printf("YYMM\n");
  }
  else {
    printf("NA\n");
  }

  return 0;
}


Measured memory_bytes: 256
# coding: utf-8

str_s = input()
str_t = input()
str_len = len(str_s)
str_match_cnt = 0

st_converter = lambda s,t : s == t

for i in range(str_len):
    if not st_converter(str_s[i], str_t[i]):
        str_match_cnt += 1

print(str_match_cnt)    

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

int main() {
    int N;
    cin >> N;
    int A, B;
    bool flag = false;
    for(int i = 1; i <= N; i++) {
        if(N % i == 0) {
            A = i;
            B = N / i;
        }
        if(A <= 9 && B <= 9) {
            flag = true;
        }
    }
    if(flag) {
    cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		String n = sc.next();

		char c = n.charAt(n.length() - 1);
		switch (c) {
		case '2':
		case '4':
		case '5':
		case '7':
		case '9':
			System.out.println("hon");
			break;
		case '0':
		case '1':
		case '6':
		case '8':
			System.out.println("pon");
			break;
		default:
			System.out.println("bon");
		}
	}

}


Measured memory_bytes: 35688