akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll zero = 0;
const ll INF = 3000000000000000000; //3*10^18
const ll MOD = 1000000007; //10^9+7
const ll MOD2 = 998244353;

ll po(ll a, ll b){
    ll res = 1;
    ll tmp = a;
    while(b > 0){
        if(b % 2 == 1) res = res * tmp % MOD;
        b = b / 2;
        tmp = tmp*tmp % MOD; 
    }
    return res;
}

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

int main(){
    ll N;
    cin >> N;
    vector<ll> a(N),b(N);
    for (ll i = 0; i < N; i++) {
        cin >> a[i] >> b[i];
    }
    map<pair<ll,ll>, pair<ll,ll>> M;
    ll tmp;
    ll cnt = 0;
    for (ll i = 0; i < N; i++) {
        if(a[i] < 0 && b[i] < 0){
            a[i] = -1*a[i];
            b[i] = -1*b[i];
        }
        if(b[i] < 0){
            a[i] = -1*a[i];
            b[i] = -1*b[i];
        }
        if(a[i] == 0 && b[i] == 0){
            cnt += 1;
            continue;
        }
        else if(b[i] == 0){
            if(!M.count(make_pair(INF,0))){
                M[make_pair(INF,0)] = make_pair(zero,zero);
            }
            M[make_pair(INF,0)].first++;
        }
        else if(a[i] == 0){
            if(!M.count(make_pair(INF,0))){
                M[make_pair(INF,0)] = make_pair(zero,zero);
            }
            M[make_pair(INF,0)].second++;
        }
        else{
            tmp = gcd(abs(a[i]), b[i]);
            a[i] = a[i] / tmp;
            b[i] = b[i] / tmp;
            if(a[i] > 0){
                if(!M.count(make_pair(a[i],b[i]))){
                    M[make_pair(a[i],b[i])] = make_pair(zero,zero);
                }
                M[make_pair(a[i],b[i])].first++;
            }
            else{
                a[i] = -1*a[i];
                if(!M.count(make_pair(b[i],a[i]))){
                    M[make_pair(b[i],a[i])] = make_pair(zero,zero);
                }
                M[make_pair(b[i],a[i])].second++;
            }
        }

    }
    ll ans;
    ans = 1;
    for (pair<pair<ll,ll>, pair<ll,ll>> p : M){
        if(p.second.first == 0){
            tmp = po(2, p.second.second) % MOD;
        }
        else if(p.second.second == 0){
            tmp = po(2, p.second.first) % MOD;
        }
        else{
            tmp = (po(2, p.second.first)%MOD + po(2, p.second.second)%MOD +MOD - 1) % MOD;
        }
        ans = ans * tmp % MOD;
    }
    ans = (MOD + ans - 1) % MOD;
    ans = (ans + cnt) %MOD;
    printf("%lld\n", ans);

    
}

Measured memory_bytes: 21892
#define DEBUG 0
#include <bits/stdc++.h>
#define all(v) (v).begin(), (v).end()
#define pb push_back
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++)
using namespace std;
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
template<class T>using numr=std::numeric_limits<T>;
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 int INF = 1e9;
const ll LLINF = 1e16;
const int mod = 1000000007;
const int mod2 = 998244353;
void debug_impl() { std::cerr << std::endl; }
template <typename Head, typename... Tail>
void debug_impl(Head head, Tail... tail) { std::cerr << " " << head; debug_impl(tail...); }
#if DEBUG
#define debug(...)\
    do {\
        std::cerr << std::boolalpha << "[" << #__VA_ARGS__ << "]:";\
        debug_impl(__VA_ARGS__);\
        std::cerr << std::noboolalpha;\
    } while (false)
#else
#define debug(...) {}
#endif

template < typename Container, typename Value = typename Container::value_type, std::enable_if_t<!std::is_same< Container, std::string >::value, std::nullptr_t> = nullptr>
std::istream& operator>> (std::istream& is, Container& v)
    { for (auto & x : v) { is >> x; } return is; }

template < typename Container, typename Value = typename Container::value_type, std::enable_if_t<!std::is_same< Container, std::string >::value, std::nullptr_t> = nullptr >
std::ostream& operator<< (std::ostream& os, Container const& v) {
os << "{";
    for (auto it = v.begin(); it != v.end(); it++)
        {os << (it != v.begin() ? "," : "") << *it;}
    return os << "}";
}

int main() {
    std::cin.tie(nullptr);
    std::ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<int> d(n);
    cin >> d;
    sort(all(d));
    if(n%2==1) cout << '0' << endl;
    else cout << d[n/2] - d[n/2-1]  << endl;
    
}

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

int main(void)
{
	int A,B,ans=0;
	int fail=-1;
	cin >> A >> B;

	if(A<1 || A>9 || B<1 || B>9)
		cout << fail <<endl;
	
	else
		{

			ans=A*B;
			cout << ans << endl;
		}

}



Measured memory_bytes: 256
# -*- coding: utf-8 -*-
# !/usr/bin/env python
# vim: set fileencoding=utf-8 :

"""
#
# Author:   Noname
# URL:      https://github.com/pettan0818
# License:  MIT License
# Created:  2016-10-07
#

# Usage
#
"""

def read():
    """Read like as below.
    N A B
    t_1
    t_n
    """
    line_1 = input().split(" ")
    num_of_class = int(line_1[0])
    blocked_class = line_1[1:2]
    blocked_class = range(int(line_1[1]), int(line_1[2]))

    following_class = {int(input()) for _ in range(num_of_class)}

    return following_class, blocked_class


def check_available_class(following_class, blocked_class):
    """Check how many class you can attend.
    >>> check_available_class([4,3,6,9,1], [5,6,7,8])
    4
    >>> check_available_class([5,6,7,8,9], [4,5,6,7,8])
    1
    """
    # return len(set(following_class).difference(blocked_class))
    attendable = [i for i in following_class if not i in blocked_class]
    return len(attendable)

if __name__ == "__main__":
    import doctest
    doctest.testmod()
    f, b = read()
    print(check_available_class(f,b))


Measured memory_bytes: 7096
import math

def main():
    s = str(input())
    first = s[0]
    cnt_l = []
    tmp_cnt = 1
    prev_s = first
    for curr_s in s[1:]:
        if prev_s != curr_s:
            cnt_l.append(tmp_cnt)
            tmp_cnt = 1
        else:
            tmp_cnt+=1
        prev_s = curr_s
    cnt_l.append(tmp_cnt)

    ans_l = []
    last_num = 0
    if first == '>':
        down_cnt = cnt_l[0]
        for d in range(down_cnt):
            ans_l.append(down_cnt-d)
        cnt_l = cnt_l[1:]

    # if first == '<':
    # print(cnt_l)
    ans_l.append(0)
    last_num = 0
    for i in range(math.ceil(len(cnt_l)/2)):
        # print('i',i)
        up_cnt = cnt_l[i*2]
        if i*2+1 >= len(cnt_l):
            down_cnt = 0
        else:
            down_cnt = cnt_l[i*2+1]
        # print(up_cnt,down_cnt)
        # print()
        for u in range(up_cnt):
            if u != up_cnt-1:
                last_num+=1
                ans_l.append(last_num)
            else:
                last_num = max(last_num+1, down_cnt)
                ans_l.append(last_num)
        for d in range(down_cnt):
            if d==0:
                if last_num > down_cnt:
                    last_num = down_cnt-1
                else:
                    last_num-=1
                ans_l.append(last_num)
            else:
                last_num-=1
                ans_l.append(last_num)

    # print(ans_l)
    print(sum(ans_l))

if __name__ == "__main__":
    main()

Measured memory_bytes: 23836
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for(ll i = 0; i < (n); ++i)
#define FOR(i, m, n) for(ll i = m; i < (n); i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
using vi = vector<int>;
using vii = vector<vi>;
using pii = pair<int, int>; 
using vl = vector<ll>;
using vll = vector<vl>;
using pll = pair<ll, ll>;

int main() {
    ll L, R, d;
    cin >> L >> R >> d;
    ll ans = 0;
    for(ll i = L; i <= R; i++){
        if(i % d == 0) ans++;
    }
    cout << ans;
}

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

int main(){
  ll n,x;
  cin>>n>>x;
  --x;
  vector<vector<ll>> index(n+1,vector<ll>(3));
  vector<ll> p(n+1);
  index[0][0]=0;
  index[0][1]=0;
  index[0][2]=0;
  p[0]=1;
  for(int i =1; i <= n; i++){
    index[i][0]=0;
    index[i][2]=(index[i-1][2]+1)*2+3-1;
    index[i][1]=index[i][2]/2;
    p[i]=p[i-1]*2+1;
  }
  ll ans=0;
  for(int i = n; i >= 0; i--){
    if(x==index[i][1]){
      ans+=p[i]/2+1; break;
    }
    if(x==index[i][0]) break;
    if(x==index[i][2]){
      ans+=p[i]; break;
    }
    if(index[i][0]<x && x<index[i][1]){
      x--;
    }
    if(index[i][1]<x && x<index[i][2]){
      x=x-index[i][1]-1;
      ans+=p[i]/2+1;
    }
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 3604
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int32_t main(){

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll a,b,k;
    cin>>a>>b>>k;
    if(k>=a){

        k-=a;
        a=0;
    }
    else{
        a-=k;
        k=0;
    }
    if(k!=0){
            //cout<<k<<endl;
        if(k>=b)
            b=0;
        else
            b-=k;
    }
    cout<<a<<" "<<b<<endl;
    return 0;
}



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

int main(){
    ll m = 1000;
    ll n;
    cin >> n;
    vector<ll> a(87);
    for(int i = 1; i <= n; i++){
        cin >> a[i];
    }
    for(int i = 1; i <= n - 1; i++){
        ll s = 0;
        if(a[i] < a[i + 1]) s = m/a[i];
        m += (a[i + 1] - a[i])*s;
    }

    cout << m << endl;
    
    return 0;
}

Measured memory_bytes: 3592
#include<bits/stdc++.h>
using namespace std;
const int maxn=100100;
const double pi=acos(-1.0);
double Ans[maxn];
struct node{
	int x,y,id;
	void print(){
		printf("x=%d y=%d\n",x,y);
	}
}a[maxn];
long long cross(const node &A,const node &B){
	return A.x*(long long)B.y-A.y*(long long)B.x;
}
long long operator * (const node &A,const node &B){
	return A.x*(long long)B.x+A.y*(long long)B.y;
}
node operator - (const node &A,const node &B){
	return (node){A.x-B.x,A.y-B.y,A.id};
}
bool cmp1(const node &A,const node &B){
	return A.x==B.x?A.y<B.y:A.x<B.x;
}
long long pf(const node &A){
	return A.x*(long long)A.x+A.y*(long long)A.y;
}
bool cmp2(const node &A,const node &B){
	if(cross(A,B)==0) return pf(A)<pf(B);
	return cross(A,B)>0;
}
double getdis(const node &A){
	return sqrt(A.x*(long long)A.x+A.y*(long long)A.y);
}
int main(){
//		freopen("B.in","r",stdin);
	int n;
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		scanf("%d%d",&a[i].x,&a[i].y);
		a[i].id=i;
	}
	sort(a+1,a+n+1,cmp1);
	for(int i=n;i>=1;i--)
		a[i]=a[i]-a[1];
	sort(a+2,a+n+1,cmp2);
	static node stk[maxn];
	int top=1;
	stk[1]=a[1];
	for(int i=2;i<=n;i++){
		while(top>1&&cross(a[i]-stk[top-1],stk[top]-stk[top-1])>=0)
			top--;
		stk[++top]=a[i];
	}
	if(top==1){
		for(int i=1;i<=top;i++)
			Ans[stk[i].id]=1.0;
	}
	else if(top==2){
		for(int i=1;i<=top;i++)
			Ans[stk[i].id]=0.5;
	}
	else{
		double x;
		for(int i=1;i<=top;i++){
			x=(stk[i%top+1]-stk[i])*(stk[(i+top-2)%top+1]-stk[i]);
			x=x/(getdis(stk[i%top+1]-stk[i])*getdis(stk[(i+top-2)%top+1]-stk[i]));
			Ans[stk[i].id]=(pi-acos(x))/(pi*2);
		}
	}
	for(int i=1;i<=n;i++)
		printf("%.10f\n",Ans[i]);
	return 0;
}


Measured memory_bytes: 256
/* ファイル名：ITP1_7_C.c	*/
/* 内容：表の行数rと列数c、r × c の要素を持つ表を読み込んで、各行と列の合計を挿入した新しい表を出力する	*/

/* include	*/
#include <stdio.h>

/* 外部変数宣言	*/

/* プロトタイプ宣言	*/

/* 関数名:main	*/
/* 処理内容:表計算を行う	*/
int main( void )
{
	/* 内部変数定義	*/
	/* 入力	*/
	int r;		/* 表の行数	*/
	int c;		/* 表の列数	*/
	long int board[101][101];	/* 表*/
	
	/* 処理	*/
	int i;	/* ループ用変数1	*/
	int j;	/* ループ用変数2	*/
	
	scanf("%d %d",&r,&c);	/* 行数と列数の取得	*/
	
	/* 表への値の格納	*/
	for(i = 0; i < r; i++){
		for(j = 0; j < c; j++){
			scanf("%ld",&board[i][j]);	/* 要素に値を格納	*/
		}
	}
	
	/* 行ごとの合計を初期化	*/
	for(i = 0; i < r; i++){
		board[i][c] = 0;
	}
	
	/* 列ごとの合計を初期化	*/
	for(j = 0; j < c; j++){
		board[r][j] = 0;
	}
	
	board[r][c] = 0;/* 全体の合計を初期化*/
	
	/* 行および列ごとの合計を算出	*/
	for(i = 0; i < (r + 1); i++){
		for(j = 0; j < c; j++){
			board[i][c] += board[i][j];	/* 行ごとの合計を出す	*/
			
			/* 列ごとの合計の行ではない場合*/
			if(i != r){
				board[r][j] += board[i][j];	/* 列ごとの合計を出す	*/
			}
			/* 列ごとの合計の行の場合*/
			else{
				/* 処理なし	*/
			}
		}
	}
	
	/* 結果の出力	*/
	for(i = 0; i < (r + 1); i++){
		for(j = 0; j < (c + 1); j++){
			/* 行ごとの合計(最後の要素)ではない場合*/
			if(j != c){
				printf("%ld ",board[i][j]);	/* 要素を出力	*/
			}
			/* 行ごとの合計の場合*/
			else{
				printf("%ld",board[i][j]);	/* 合計を出力	*/
			}
		}
		printf("\n");	/* 行ごとに改行	*/
	}
	
	return 0;
}



Measured memory_bytes: 2136
#include<bits/stdc++.h>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
#define ll long long
#define MOD (ll)1e9+7
#define REP(i,b,e) for(int (i)=b;(i)<e;(i)++)
const ll INF= 1LL << 60;

class UnionFind {
	vector<int> data;
public:
	UnionFind(int size) : data(size, -1) { }
	bool unionSet(int x, int y) {
		x = root(x); y = root(y);
		if (x != y) {
			if (data[y] < data[x]) swap(x, y);
			data[x] += data[y]; data[y] = x;
		}
		return x != y;
	}
	bool findSet(int x, int y) {
		return root(x) == root(y);
	}
	int root(int x) {
		return data[x] < 0 ? x : data[x] = root(data[x]);
	}
	int size(int x) {
		return -data[root(x)];
	}
};


//入力
int N;
vector<double> p;

int main(){
  int A,B,C;
  cin >>A>>B>>C;
  int ans=0;
  while(A!=B|B!=C){
    if(A==B){
      if(A<C){
        A++;
        B++;
      }else{
        C+=2;
      }
    }else if(A==C){
      if(A<B){
        A++;
        C++;
      }else{
        B+=2;
      }
    }else if(B==C){
      if(B<A){
        C++;
        B++;
      }else{
        A+=2;
      }
    }else{
      if(A<B&A<C){
        A+=2;
      }else if(B<A&B<C){
        B+=2;
      }else{
        C+=2;
      }
    }
    ans++;
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 256
z[11];main(a,b,c,r){for(;~scanf("%d%d%d",&a,&b,&c);puts(r>3?"YES":"NO")){
	memset(z,1,sizeof(z));z[a]=z[b]=z[c]=0;a+=b;
	for(r=0,b=1;b<11;b++)if(z[b]&&a+b<21)r++;
}exit(0);}

Measured memory_bytes: 576
import heapq


class ShortestPath:
    """Dijkstra's algorithm : find the shortest path from a vertex
       Complexity: O(E + log(V))
       used in GRL1A(AOJ)
    """

    def __init__(self, V, E, start, INF=10**9):
        """ V: the number of vertexes
            E: adjacency list (all edge in E must be 0 or positive)
            start: start vertex
            INF: Infinity distance
        """
        self.V = V
        self.E = E
        self.dijkstra(start, INF)

    def dijkstra(self, start, INF):
        que = list()
        self.distance = [INF] * self.V  # distance from start
        self.prev = [-1] * self.V  # prev vertex of shortest path
        self.distance[start] = 0
        heapq.heappush(que, (0, start))

        while len(que) > 0:
            dist, fr = heapq.heappop(que)
            if self.distance[fr] < dist:
                continue
            for to, cost in self.E[fr]:
                if self.distance[fr] + cost < self.distance[to]:
                    self.distance[to] = self.distance[fr] + cost
                    heapq.heappush(que, (self.distance[to], to))
                    self.prev[to] = fr

    def getPath(self, end):
        path = [end]
        while self.prev[end] != -1:
            end = self.prev[end]
        return path[::-1]
V = int(input())
edge = [[] for _ in range(V)]
for _ in range(V):
    u, _, *e = map(int, input().split())
    for t, d in zip(e[::2], e[1::2]):
        edge[u].append((t, d))

sp = ShortestPath(V, edge, 0)
for i, d in enumerate(sp.distance):
    print(i, d)

Measured memory_bytes: 8204
import java.io.BufferedReader;
import java.io.InputStreamReader;

//public class Problem1100_AreaOfPolygons {
public class Main {
	public static void main(String[] args) {
		try {
		//	Problem1100_AreaOfPolygons test = new Problem1100_AreaOfPolygons();
			Main test = new Main();
			
			BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
			
			int caseNumber = 0;
			String line;
			while((line = reader.readLine()) != null) {
				caseNumber++;
				int[][] vertices = new int[Integer.parseInt(line)][2];
				if(vertices.length == 0) {
					break;
				}
				for(int i = 0; i < vertices.length; i++) {
					String[] textArray = reader.readLine().split(" ");
					
					vertices[i][0] = Integer.parseInt(textArray[0]);
					vertices[i][1] = Integer.parseInt(textArray[1]);
				}
				test.showAnswer(vertices, caseNumber);
				reader.readLine();
			}
		} catch(Exception e) {
			e.printStackTrace();
		}
	}
	void showAnswer(int[][] vertices, int caseNumber) {
		int summationArea = getArea(vertices, vertices.length-1, 0);
		for(int i = 1; i < vertices.length; i++) {
			summationArea += getArea(vertices, i-1, i);
		}
		summationArea = Math.abs(summationArea);
		double answer = (double)(summationArea) /2;
		
	//	System.out.printf(caseNumber + " %.1f", summationArea);
		System.out.println(caseNumber + " " + answer);
	}
	int getArea(int[][] vertices, int point1, int point2) {	//OÏ
		int area = vertices[point1][0] * vertices[point2][1] - vertices[point2][0] * vertices[point1][1];
		
		return area;
	}
	
}

Measured memory_bytes: 0
from decimal import *

a, b, c = map(Decimal, input().split())

s_a = a**Decimal(0.5)
s_b = b**Decimal(0.5)
s_c = c**Decimal(0.5)

if s_a + s_b < s_c:
    ans = 'Yes'
else:
    ans = 'No'
print(ans)

Measured memory_bytes: 5076
#include<bits/stdc++.h>
#define FOR(i,x,y) for(int i=(x),i##END=(y);i<=i##END;++i)
#define DOR(i,x,y) for(int i=(x),i##END=(y);i>=i##END;--i)
template<typename T,typename _T>inline bool chk_min(T &x,const _T y){return y<x?x=y,1:0;}
template<typename T,typename _T>inline bool chk_max(T &x,const _T y){return x<y?x=y,1:0;}
typedef long long ll;
const int N=200005;
int a[N],pre[N],las[N];
int n;

int main()
{
	scanf("%d",&n);
	FOR(i,1,n)scanf("%d",&a[i]);
	FOR(i,1,n)pre[i]=std::max(pre[i-1],a[i]);
	DOR(i,n,1)las[i]=std::max(las[i+1],a[i]);
	FOR(i,1,n)printf("%d\n",std::max(pre[i-1],las[i+1]));
	return 0;
}


Measured memory_bytes: 3968
/*
 _____ _             _              _           _ 
|_   _| |__   ___   / \   _ __  ___| |__  _   _| |
  | | | '_ \ / _ \ / _ \ | '_ \/ __| '_ \| | | | |
  | | | | | |  __// ___ \| | | \__ \ | | | |_| | |
  |_| |_| |_|\___/_/   \_\_| |_|___/_| |_|\__,_|_|                                                

*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp>
#define ll          long long
#define pb          push_back
#define ppb         pop_back
#define	endl		'\n'
#define mii         map<ll,ll>
#define msi         map<string,ll>
#define mis         map<ll, string>
#define rep(i,a,b)    for(ll i=a;i<b;i++)
#define repr(i,a,b) for(ll i=b-1;i>=a;i--)
#define trav(a, x) 	for(auto& a : x)
#define pii         pair<ll,ll>
#define vi          vector<ll>
#define vii         vector<pair<ll, ll>>
#define vs          vector<string>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll)x.size()
#define hell        1000000007
#define lbnd        lower_bound
#define ubnd        upper_bound
#define max(a,b)	(a>b?a:b)
#define min(a,b)	(a<b?a:b)

/*	For Debugging	*/
#define DEBUG 		cerr<<"\n>>>I'm Here<<<\n"<<endl;
#define display(x) trav(a,x) cout<<a<<" ";cout<<endl;
#define what_is(x)  cerr << #x << " is " << x << endl;

std::mt19937_64 rng(std::chrono::steady_clock::now().time_since_epoch().count());
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 
#define TIME        cerr << "\nTime elapsed: " << setprecision(5) <<1000.0 * clock() / CLOCKS_PER_SEC << "ms\n";
#define DECIMAL(n)  cout << fixed ; cout << setprecision(n);
#define FAST ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace __gnu_pbds;
using namespace std;
#define PI 3.141592653589793
#define N  200005
ll a[N];
ll fun(ll n)
{
	return (n*(n-1))/2;
}
void solve()
{
	ll n;
	cin>>n;
	vi v(n);
	rep(i,0,n)
	{
		cin>>v[i];
		a[v[i]]++;
	}
	ll ans=0;
	rep(i,1,n+1)
	ans+=fun(a[i]);
	rep(i,0,n)
	{
		cout<<ans-fun(a[v[i]])+fun(a[v[i]]-1)<<endl;
	}
	return;
}
int main()
{
	FAST
	int TESTS=1;
//	cin>>TESTS;
	while(TESTS--)
	{
		solve();
	}
	TIME
	return 0;
}

Measured memory_bytes: 4736
import math 
n=int(input())
f=0
if(n==2):
    print(2)
else:
    if(n%2==0):
        n=n+1
    while(f==0):
        k=math.sqrt(n)
        k=math.ceil(n)
        l=0
        for i in range(2,k):
            if(n%i==0):
                break
            else:
                l=l+1
        if(l==k-2):
            f=1
            print(n)
        else: 
            n=n+2
        


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

int  main()
{

    long long x,k ,d ,ans = 0; 

    cin>>x>>k>>d; 
    if(x< 0 )
    {
        x *=-1 ; 

    }
    double q= (double) x/d; 



    if(q > k)
    {
        ans = x - k*d; 
    } 
    else 
    {
        
        k  -= x/d ;
    
        
        
         

        if(k%2 ==0 )
        {
            ans = x%d; 
        } 
        else
        {
            ans = abs( d - x%d) ; 
        }
        

        
    }

    cout<<ans; 


    





}

Measured memory_bytes: 3620
N,M = map(int,input().split(" "))
a_to = []
N_to = []
for i in range(M):
	a, b = map(int,input().split(" "))
	if a == 1 or b == 1:
		a_to.append(max(a,b))
	elif b == N or a == N:
		N_to.append(min(a,b))

a_set = set(a_to)
N_set = set(N_to)

if (len(a_set&N_set) >= 1):
	print("POSSIBLE")
else:
	print("IMPOSSIBLE")


Measured memory_bytes: 21844
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define isin(x,l,r) ((l) <= (x) && (x) < (r))  // xが範囲内か
#define sort_u(x) sort((x).begin(),(x).end())
#define sort_d(x) sort((x).begin(),(x).end(), greater<int>())
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()  // 配列のサイズ
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cerr<<#x<<" = "<<x<<endl;  // 確認したいとき
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))  // 切り上げたいとき
#define newline puts("")
#define v(T) vector<T>  // Tはどんな型でもいい
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
typedef vector<int> vi;  // ******
typedef vector<vi> vvi;
typedef vector<ll> vl;  // ******
typedef vector<P> vp;
typedef vector<T> vt;
int getInt(){int x;scanf("%d",&x);return x;}
template<typename T>istream& operator>>(istream&i,v(T)&v){rep(j,sz(v))i>>v[j];return i;}  // vi a(n); cin>>a;
template<typename T>string join(const v(T)&v){stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>ostream& operator<<(ostream&o,const v(T)&v){if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>istream& operator>>(istream&i,pair<T1,T2>&v){return i>>v.fi>>v.se;}
template<typename T1,typename T2>ostream& operator<<(ostream&o,const pair<T1,T2>&v){return o<<v.fi<<","<<v.se;}
template<typename T>bool mins(T& x,const T&y){if(x>y){x=y;return true;}else return false;}
template<typename T>bool maxs(T& x,const T&y){if(x<y){x=y;return true;}else return false;}
template<typename T>ll suma(const v(T)&a){ll res(0);for(auto&&x:a)res+=x;return res;}
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
//mins(ans,now);  ansに最小値が入る
//if(max(ans,now)) ansが小さければ更新して実行。cnt++とか。
//ll sum = suma(a);

int main() {
    int n, k; cin >> n >> k;
    vi h(n); cin>>h;
    int ans = 0;
    rep(i,n){
        if(h[i]>=k) ans++;
    }
    cout << ans << endl;
}

/*
g++ a.cpp
./a.out

oj d
oj t

debug:ctrl+shift+B problemin

*/


Measured memory_bytes: 3712
/*
 
 Author : Bisma
 
 */
#include<algorithm>
#include <assert.h>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>

#define ll long long
#define sl(n) scanf("%lld", &n)
#define sf(n) scanf("%lf", &n)
#define si(n) scanf("%d", &n)
#define ss(n) scanf("%s", n)
#define pii pair <int, int>
#define pll pair <long long, long long >
#define plp pair <int, pll >
#define pb push_back
using namespace std;
#define rep(a,b,c) for(int a=b;a<=c;a++)
#define ll long long 
#define sum(a,b) a=a+b
#define repn(a,b,c) for(int a = b ; a>=c ; a--)
#define mem(a, b) memset(a, (b), sizeof(a))



ll max(ll a , ll b){
  if(a>b) return a;
  return b;
}

void fast(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    
}

ll a[1005];
ll b[1005];
ll c[1005];

vector<ll>val;

int main(){
  
  fast();    

  ll x,y,z,take;
  cin>>x>>y>>z>>take;

  rep(i,1,x) cin>>a[i];
  rep(i,1,y) cin>>b[i];
  rep(i,1,z) cin>>c[i];


  rep(i,1,x){
    rep(j,1,y){
      val.pb(a[i] + b[j]);
    }
  }

  sort(val.begin(),val.end(),greater<ll>());

  sort(c+1,c+z+1,greater<ll>());

  ll i = 1;

  ll no = take;

  ll size = val.size()-1;

  ll loop = 0;

  // rep(i,0,size){
  //   cout<<val[i]<<endl;
  // }
  // cout<<endl;
  vector<ll>ans;

  ll index[1002];

  mem(index , 0);

  ll cur;

  rep(way,1,no){

    ll maxi = -1;

    ll pos = 0;

    rep(i,1,z){
      ll dex = index[i];
      ll pl = val[dex];
      if(dex > size) pl = 0;
      ll sum = c[i] + pl;

      if(sum > maxi){
        maxi = sum;
        pos = i;
      }
    }
    
    ans.pb(maxi);

    index[pos]++;

    // cout<<"DAYY :: "<<way<<endl;
    // rep(i,1,z){
    //   cout<<i<<"::::"<<index[i]<<endl;
    // }

  }


  rep(i,0,take-1){
    cout<<ans[i]<<endl;
  }


    return 0;

}


Measured memory_bytes: 10604
#include <bits/stdc++.h>
#define int long long
using namespace std;

const int MAX = 100000;
const int zero = MAX/2;

int h, w;
int A[80][80];
int B[80][80];
bool dp[81][81][MAX];


signed main(){
  
  cin>>h>>w;
  
  for(int i=0;i<h;i++)
    for(int j=0;j<w;j++) cin>>A[i][j];

  for(int i=0;i<h;i++)
    for(int j=0;j<w;j++) cin>>B[i][j];
  
  dp[0][0][zero] = true;
  
  for(int i=0;i<h;i++){
    
    for(int j=0;j<w;j++){
      
      for(int k=0;k<MAX;k++){
	
	if( !dp[i][j][k] ) continue;
	
	for(int l=0;l<2;l++){
	
	  int add;
	  
	  if( l == 0 ) add = A[i][j] - B[i][j];
	  else add = B[i][j] - A[i][j];
	  
	  int nk = k + add;
	  
	  if( nk < 0 || MAX <= nk ) continue;
	  
	  dp[i+1][j][nk] = dp[i][j+1][nk] = true;
	  
	}
	
      }
      
    }
    
  }
  
  int ans = 80;
  
  for(int i=0;i<MAX;i++){
    
    if( dp[h-1][w][i] || dp[h][w-1][i] ) ans = min( ans, abs( i - zero ) );
    
  }
  
  cout<<ans<<endl;
  
  return 0;
}


Measured memory_bytes: 637824
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <cmath>
# include <functional>
# include <utility>
# include <queue>
# include <stack>
# define MOD 1000000007
# define INF 2000000000
#define rep(i,rept)	for(ll i = 0; i<rept;i++)
typedef long long ll;
using namespace std;
int main() {
	int ans = 0, counter = 0, maxi = -1, mini = INF;
	//new
	int a = 0;
	char slime[100001];
	cin >> a;
	rep(i, a) {
		cin >> slime[i];
	}
	ans = 1;
	for (int i = 1; i <= a - 1; i++) {
		if (slime[i] != slime[i - 1])ans++;
	}
	cout << ans << endl;
}



Measured memory_bytes: 384
#include <iostream>
using namespace std;
int main() {
    long long k,a,b;
    cin>>k>>a>>b;
    if(k<=a)cout<<1<<endl;
    else if(a<=b)cout<<-1<<endl;
    else if((k-a)%(a-b)==0)cout<<((k-a)/(a-b))*2+1<<endl;
    else cout<<((k-a)/(a-b))*2+3<<endl;
    
}

Measured memory_bytes: 256
import math
from operator import itemgetter
import functools
import itertools
import numpy as np
import sys
MAX_INT = int(10e10)
MIN_INT = -MAX_INT
mod = 1000000007
sys.setrecursionlimit(1000000)
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

N,H = IL()
ab = [IL() for i in range(N)]

ab.sort(reverse=True)
attack = ab[0][0]
skill = ab[0][1]

ab.sort(reverse=True,key=itemgetter(1))
cnt = 0
f = 0
for i in range(N):
	if ab[i][1] > attack:
		H -= ab[i][1]
		cnt += 1
	if H <= 0:
		print(cnt)
		exit()

print(cnt + math.ceil(H/attack))

Measured memory_bytes: 38124
#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define inf 1e+9
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T, class C> void chmax(T& a, C b){ a>b?:a=b; }
template<class T, class C> void chmin(T& a, C b){ a<b?:a=b; }

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

    int n,k,ans=0;

	cin >> n >> k;
	

	if(k==1){
		cout << 0 << endl;
	}
	else{
	cout << n-k << endl;
	}
}

Measured memory_bytes: 888
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace atcoder;
using namespace std;
#define all(v) v.begin(), v.end()
using in = int64_t;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define YES cout<<"YES"<<endl
#define NO cout<<"NO"<<endl
const double PI=3.14159265358979323846;
const in MOD = 1000000007;
const in INF=1e18+7;
const int inf=1e9+7;
using P=pair<int,int>;
vector<int> dx={0,1,-1,0};
vector<int> dy={1,0,0,-1};


int main(){
ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
cout << fixed << setprecision(10);
    int n,m;
    cin>>n>>m;
    vector<in> a(n);
        rep(i,n) cin>>a.at(i);
    vector<in> b(m);
        rep(i,m) cin>>b.at(i);
    vector<in> c= convolution<998244353>(a,b);
    for(auto x:c) cout<<x<<" ";
    cout<<endl;
}/*
./problem.exe
*/

Measured memory_bytes: 27308
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define perl(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define ins insert
#define pqueue(x) priority_queue<x,vector<x>,greater<x>>
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
#define vtpl(x,y,z) vector<tuple<x,y,z>>
#define rev(x) reverse(x);
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
using vpl=vector<pl>;
using vvpl=vector<vpl>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[8]={1,0,-1,0,1,1,-1,-1};
const ll dx[8]={0,-1,0,1,1,-1,1,-1};
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
int main(){
  ll n;cin >> n;
  vl v(3*n);rep(i,3*n)cin >> v[i];
  vl left(n+1,0),right(n+1,0);
  rep(i,n)left[0]+=v[i];
  rep(i,n)right[0]+=v[3*n-1-i];
  priority_queue<ll,vl,greater<ll>> que;
  rep(i,n)que.push(v[i]);
  rep(i,n){
    ll d=v[n+i];
    ll tmp=left[i];
    if(d>que.top()){
      tmp-=que.top();que.pop();
      que.push(d);
      tmp+=d;
    }
    left[i+1]=tmp;
  }
  priority_queue<ll,vl,less<ll>> q;
  rev(all(v));
  rep(i,n)q.push(v[i]);
  rep(i,n){
    ll d=v[n+i];
    ll tmp=right[i];
    if(d<q.top()){
      tmp-=q.top();q.pop();
      q.push(d);
      tmp+=d;
    }
    right[i+1]=tmp;
  }
  rev(all(right));
  ll ans=-INF;
  rep(i,n+1)chmax(ans,left[i]-right[i]);
  //rep(i,n+1)cout << left[i] <<" " << right[i] <<endl;
  cout << ans <<endl;
}

Measured memory_bytes: 6516
import math

def makelist(n, m):
    return [[0 for _ in range(m)] for _ in range(n)]

# n = int(input())
# 
# s = input()

N, K = list(map(int, input().split()))
ans = 0
while N > 0:
    N //= K
    ans +=1
print(ans)


Measured memory_bytes: 3064
#include <iostream>
#include <vector>
using namespace std;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  int n, m, l;
  cin >> n >> m >> l;

  vector<vector<int>> mat1(n, vector<int>(m));
  vector<vector<int>> mat2(m, vector<int>(l));
  vector<vector<long>> res(n, vector<long>(l));

  for(int i=0; i<n; i++) {
    for(int j=0; j<m; j++) {
      cin >> mat1.at(i).at(j);
    }
  }

  for(int i=0; i<m; i++) {
    for(int j=0; j<l; j++) {
      cin >> mat2.at(i).at(j);
    }
  }

  for(int i=0; i<n; i++) {
    for(int j=0; j<l; j++) {
      for(int k=0; k<m; k++) {
        res.at(i).at(j) += mat1.at(i).at(k) * mat2.at(k).at(j);
      }
    }
  }

  for(int i=0; i<n; i++) {
    for(int j=0; j<l; j++) {
      cout << res.at(i).at(j);
      if(j != l-1) cout << " ";
      else cout << "\n";
    }
  }
  return 0;
}



Measured memory_bytes: 3360
#include <vector>
#include <map>
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long int ll;

#define REP(i, n) for(ll i = 0; i < (ll)(n); i++)

int main(int argc, const char * argv[]) {
    
    ll N;
    cin >> N;
    vector<ll> dataA = vector<ll>(N+1, 0);
    for (ll i = 0; i < (N+1); i++) {
        cin >> dataA[i];
    }
    vector<ll> dataB = vector<ll>(N+1, 0);
    for (ll i = 0; i < N; i++) {
        cin >> dataB[i];
    }
    ll score = 0;
    ll remain = 0;
    for (ll i = 0; i < (N+1); i++) {
        if (dataA[i] >= remain) {
            dataA[i] -= remain;
            score += remain;
            
            ll p = min(dataA[i], dataB[i]);
            score += p;
            remain = dataB[i] - p;
        } else {
            score += dataA[i];
            remain = dataB[i];
        }
    }

    cout << score;
    
    return 0;
}


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++)

int main() {
  string o,e;cin>>o>>e;
  rep(i,e.size()) cout << o[i] << e[i];
  if (o.size() > e.size()) cout << o[o.size()-1];
}


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

#pragma GCC optimize("Ofast")
#define rep(i,a,n) for(int i=a; i<n; i++)
typedef long long ll;
typedef pair<int,int> P;
const ll MOD = (int)1e9+7;
const ll INF = MOD*MOD;
const ll powll = 1LL<<1;

int main(){
	int n; cin >> n;
    int a[n]; rep(i,0,n-1) cin >> a[i];

     int ans[n] ={};
     rep(i,0,n-1){
         ans[a[i]-1]++; 
     }
     rep(i,0,n){
         cout << ans[i] << "\n";
     }
}

Measured memory_bytes: 5156
import numpy as np
n, k = map(int, input().split())
a = list(map(int, input().split()))
b = np.prod(a[:k])
for i in range(k, n):
  c = a[i - k]
  d = a[i]
  if c < d:
    print('Yes')
  else:
    print('No')
  b = b * d // c

Measured memory_bytes: 49948
#include <iostream>
#include <cstdio>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <vector>
#include <string>
#include <sstream>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <iomanip>

#define D(x) cout<< #x <<" = "<<x<<"\n"
#define IL(a,n) for (int i=a; i<n; i++)
#define II() ( { int a ; read(a) ; a; } )
#define LL() ( { Long a ; read(a) ; a; } )
#define DD() ({double a; scanf("%lf", &a); a;})

using namespace std;

//Fast Reader
template<class T>inline bool read(T &x){
    int c=getchar();int sgn=1;
    while(~c&&c<'0'||c>'9'){if(c=='-')sgn=-1;c=getchar();}
    for(x=0;~c&&'0'<=c&&c<='9';c=getchar())x=x*10+c-'0'; 
    x*=sgn; return ~c;
}

typedef long long Long;
typedef vector<int> VI;
typedef vector<VI> VVI;

const int INF=2e9;
const int MX=100005;
const int MOD=1000000007;
const double PI=acos(-1.0);

/*_______________________________________________*/

int main()
{
	string s;
	cin >> s;
	int cnt = 0;
	bool flag[(int)s.size()];
	for(int i = 0; i<(int)s.size(); i++)
		if(s[i] == '0')
			flag[i] = false;
		else
			flag[i] = true;

	for(int i = 1; i<(int)s.size(); i++)
	{
		if(flag[i] == flag[i-1])
		{
			cnt++;
			flag[i] = !flag[i];
		}
	}

	int cnt2 = 1;

	for(int i = 0; i<(int)s.size(); i++)
		if(s[i] == '0')
			flag[i] = false;
		else
			flag[i] = true;

	flag[0] = !flag[0];

	for(int i = 1; i<(int)s.size(); i++)
	{
		if(flag[i] == flag[i-1])
		{
			cnt2++;
			flag[i] = !flag[i];
		}
	}

	printf("%d\n",min(cnt,cnt2));

	return 0;
}

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

#define ll long long
#define vi vector<int>
#define pb push_back
//#define unordered_map<int,int> um

int  main(){

    int n,m;cin>>n>>m;
    int p=0,q=0;
    if(n>=2)
    {
    	p=(n*(n-1))/2;
	}
	if(m>=2)
	{
		q=((m*(m-1))/2);
	}
	cout<<(p+q)<<endl;
    return 0;	
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
namespace QiFeng233{
	ll n,sn,ans;
	bool chk(ll x){
		ll tmp=n;
		while(tmp>1){
			if(tmp%x==0)tmp/=x;
			else{
				if((tmp-1)%x==0)return 1;
				else return 0;
			}
		}
		if(tmp==1)return true;
		else return false;
	}
	void solve(){
		scanf("%lld",&n);
		sn=(ll)sqrt((double)n);
		for(ll i=2;i<=sn;++i){
			if(chk(i))++ans;
		}
		for(ll i=1;i<=sn;++i)if((n-1)%i==0)++ans;
		if(n-1==sn*sn)--ans;
		printf("%lld",ans+1);
	}
}
signed main(){
	QiFeng233::solve();
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){
    int n;
    int yes=0;
    int a[200];
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        scanf("%d",&a[i]);
    }

    for(int i=0;i<n;i++){
        if((i+1)%2!=0&&a[i]%2!=0){yes++;}
    }
    printf("%d",yes);

}


Measured memory_bytes: 1700
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#define REP(i, n) for (int i = 0; i < (n); i++)

using namespace std;
int H, W, h, w;

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

  cin >> H >> W >> h >> w;

  cout << H * W - (W * h) - (H * w) + h * w << '\n';
}

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

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

int main() {
	string in;
	while(cin >> in, in!="#") {
		string s="";
		rep(i, in.length()) {
			if(in[i] == 'w') {
				i += 3;
				s += "w";
			} else {
				i += 4;
				s += "n";
			}
		}
		reverse(s.begin(), s.end());
		int a = 0;
		rep(i, s.length()) {
			a *= 2;
			if(s[i]=='w') {
				a += 90;
			} else {
				a -= 90;
				if(a<0) a = 0;
			}
		}
		int b = 1 << (s.length()-1);
		int g = __gcd(a, b);
		a /= g;  b /= g;
		cout << a;
		if(b>1) {
			cout << '/' << b;
		}
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 1200
#define ll long long
#define MOD 1000000007
#define MOD2 998244353
#define INF 1e12
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define set2d(array, val, m, n) memset(array, val, sizeof(array[0][0]) * m * n);
#define FOR(i, n) for (int i = 0; i < n; i++)
#define FORE(i, a, b) for (int i = a; i <= b; i++)
#define pii pair<int, int>
#define pll pair<ll, ll>
#include <bits/stdc++.h>
using namespace std;
ll power(ll x, ll y, ll p)
{
    ll res = 1;
    x %= p;
    while (y > 0)
    {
        if (y & 1)
            res = (res * x) % p;
        y = y >> 1;
        x = (x * x) % p;
    }
    return res;
}
ll po(ll base, ll powerRaised)
{
    if (powerRaised != 0)
        return (base * po(base, powerRaised - 1));
    else
        return 1;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll a, b, c, d;
    cin >> a >> b >> c >> d;
    for (int i = 0;; i++)
    {
        if (i % 2 == 0)
        {
            c -= b;
            if (c <= 0)
            {
                cout << "Yes";
                return 0;
            }
        }
        else
        {
            a -= d;
            if (a <= 0)
            {
                cout << "No";
                return 0;
            }
        }
    }
}

Measured memory_bytes: 3640
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<map>
#include<set>
using namespace std;
int main()
{
    int a,b,c;
    scanf("%d%d%d",&a,&b,&c);
    if(c>=a&&c<=b)
        printf("Yes\n");
    else
        printf("No\n");
    return 0;
}


Measured memory_bytes: 256
use proconio::input;

fn cal(a: u64, k: u64) -> u64 {
    if a < k {
        0
    } else if a % k == 0 {
        a / k
    } else {
        let r = a % k;
        let step = a / k + 1;
        let times = (r + step - 1) / step;
        cal(a - step * times, k)
    }
}
fn main() {
    input!(n: usize, ak: [(u64, u64); n]);
    println!(
        "{}",
        if ak
            .iter()
            .map(|&(a, k)| cal(a, k))
            .fold(0, std::ops::BitXor::bitxor)
            == 0
        {
            "Aoki"
        } else {
            "Takahashi"
        }
    );
}


Measured memory_bytes: 2168
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define rep(i,n) for(ll i=0;i<(n);i++)
#define pll pair<ll,ll>
#define pq priority_queue
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define lb(c,x) distance(c.begin(),lower_bound(all(c),x))
#define ub(c,x) distance(c.begin(),upper_bound(all(c),x))

using namespace std;

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

const ll INF=1e18;


int main(){
    ll a,b,c;
    cin >> a >> b >> c;
    if(a<=c && c<=b) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 3628
#include <iostream>
#include <algorithm>
#include <functional>
#include <vector>
#include <map>
using namespace std;

typedef long long ll;

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

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



int main() {

  int a[3][3];
  int c[3][3];
  rep(i, 3) {
    rep(j, 3) {
      cin >> a[i][j];
      c[i][j] = 0;
    }
  }
  int n;
  cin >> n;
  int b[n];
  rep(i, n) cin >> b[i];

  rep(i, n) {
    int x = b[i];
    rep(j, 3) {
      rep(k, 3) {
        if(a[j][k]==x) {
          c[j][k] = 1;
        }
      }
    }
  }

  rep(i, 3) {
    bool f = true;
    rep(j, 3) {
      if(c[i][j]!=1) f = false;
    }
    if(f) {
      cout << "Yes" << endl;
      return 0;
    }
  }

  rep(i, 3) {
    bool f = true;
    rep(j, 3) {
      if(c[j][i]!=1) f = false;
    }
    if(f) {
      cout << "Yes" << endl;
      return 0;
    }
  }

  if(c[0][0]+c[1][1]+c[2][2]==3)
    cout << "Yes" << endl;
  else if(c[0][2]+c[1][1]+c[2][0]==3)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;

  return 0;
}


Measured memory_bytes: 256
n=int(input())
S=list(map(int,input().split()))
q=int(input())
T=list(map(int, input().split()))

def bin_search(t):
    l=0
    r=n-1
    if S[r]==t:
        return 1
    else:
        while r-l > 1:
            m=(l+r)//2
            if S[m] > t:
                r=m
            else:
                l=m
        if S[l] == t:
            return 1
        else:
            return 0
cnt=0
for t in T:
    cnt += bin_search(t)

print(cnt)



Measured memory_bytes: 16708
#include <iostream>
#include <string>
#include <algorithm>
#include <set>
#include <cmath>
#include <vector>
#include <numeric>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <queue>

using ll = long long int;
using ul = unsigned long long int;
const ll LL_MAX (1LL<<60);
const ll MOD (1000000007);

#define rep(i,s,e) for(ll i=(s); i<(e); i++) 

using namespace std;

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

    ll n, r;
    cin >> n >> r;

    ll ans;
    if (n<10)
        ans = r + 100 *(10 - n);
    else
        ans = r;

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <queue>
#include <iostream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <string>
#include <vector>


using namespace std;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
typedef long long ll;
typedef vector<int> vint;
typedef vector<string> vstr;
typedef pair<ll, ll> pint;
ll inf = 1000000000 + 7;

//bool operator< (pint a, pint b) {
	//return a.second < b.second;

//}



ll gcd(ll a, ll b) {

	if (b == 0)
		return a;

	return gcd(b, a % b);


}

vector<ll> A;

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

	rep(i, N) {
		cin >> a;
		A.push_back(a);
	}
	ll ans = A[0];
	rep(i, N - 1) {
		ans = gcd(ans, A[i + 1]);

	}


	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 1400
#include <stdio.h>

int main (){
	int a, b, x, y, i, j, n;
	while(scanf("%d", &n)&&(n != 0)){
		a = 0, b = 0;
		for(i = 0; i<n;i++){
			scanf("%d %d", &x, &y);
			if(x == y){
				a+= x;
				b+= y;
			} else if(x < y){
				b+= x+y;
			} else if(x > y){
				a+= x+y;
			}
		}
		printf("%d %d\n", a, b);
	}
	return 0;
}

Measured memory_bytes: 600
#include <cstring>
#include <cstdio>
#include <queue>
#define REP(i,n) for(int i=0; i<(int)(n); i++)

#define IN(x,s,g) ((x) >= (s) && (x) < (g))
#define ISIN(x,y,w,h) (IN((x),0,(w)) && IN((y),0,(h)))

using namespace std;

char g[100][128];

int dp[11][100][100][4];

enum{
  LEFT = 0,
  DOWN = 1,
  RIGHT = 2,
  UP = 3
};

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

inline int encode(int a1, int a2, int x, int y, int dir){
  return dir | (y << 2) | (x << (2 + 8)) | (a2 << (2 + 8 + 8)) | (a1 << (2 + 8 + 8 + 4));
}

inline void decode(int val, int &a1, int &a2, int &x, int &y, int &dir){
  a1 = (val >> (2 + 8 + 8 + 4)) & ((1 << 4) - 1);
  a2 = (val >> (2 + 8 + 8)) & ((1 << 4) - 1);
  x = (val >> (2 + 8)) & ((1 << 8) - 1);
  y = (val >> (2)) & ((1 << 8) - 1);
  dir = val & ((1 << 2) - 1);
}

int main(){
  int h, w, a; scanf("%d%d%d", &h, &w, &a);
  REP(i,h) scanf("%s", g[i]);
  memset(dp, -1, sizeof(dp));

  priority_queue<int> pq;
  REP(i,h) REP(j,w) if(g[i][j] == 'S'){
    pq.push(encode(a, a, j, i, DOWN));
  }

  int ans = 100;
  while(pq.size()){
    int a1, a2, x, y, dir;
    int d = pq.top(); pq.pop();
    decode(d, a1, a2, x, y, dir);

    // printf("a1=%d a2=%d x=%d y=%d dir=%d\n", a1, a2, x, y, dir);
    if(g[y][x] == 'S' && dir == UP) continue;
    if(dp[a2][y][x][dir] != -1) continue;
    dp[a2][y][x][dir] = a1;

    if(g[y][x] == 'G'){
      ans = min(ans, (a - a1) + (a - a2));
    }

    REP(k,3){
      int dd = (dir + k + 3) % 4;
      int xx = x + dx[dd];
      int yy = y + dy[dd];
      if(g[y][x] == 'S' && k != 1) continue;
      if(ISIN(xx, yy, w, h) && (g[yy][xx] != '#' || g[yy][xx] == 'S')){
        int aa1 = a1;
        int aa2 = a2;
        if(k == 0){
          // turn right
          if(dir & 1) aa1--;
          else aa2--;
        }else if(k == 2){
          // turn left
          if(dir & 1) aa2--;
          else aa1--;
        }

        if(aa1 >= 0 && aa2 >= 0){
          if(dp[aa2][yy][xx][dd] == -1){
            pq.push(encode(aa1, aa2, xx, yy, dd));
          }
        }
      }
    }
  }

  if(ans == 100) puts("-1");
  else printf("%d\n", ans);

  return 0;
}

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

using namespace std;
using ll = long long;

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

  ll n;
  cin >> n;

  string ans;
  while (n > 0) {
    n--;
    ans += 'a' + n % 26;
    n /= 26;
  }

  reverse(ans.begin(), ans.end());
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3608