akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <algorithm>
#include <sstream>
#include <map>
#include <set>

#define REP(i,k,n) for(int i=k;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1<<30
#define pb push_back
#define mp make_pair

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

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

	vector< vector<int> > v(n, vector<int>(3));
	rep(i, n) {
		rep(j, 3) cin >> v[i][j];
	}

	int d[205];
	memset(d, 0, sizeof(d));

	rep(i, 3) {
		map<int, int> m;
		rep(j, n) {
			m[v[j][i]]++;
		}

		rep(j, n) {
			if(m[v[j][i]] == 1) {
				d[j] += v[j][i];
			}
		}
	}

	rep(i, n) {
		cout << d[i] << endl;
	}
	return 0;
}

Measured memory_bytes: 1224
import sys
input = sys.stdin.readline

############ ---- Input Functions ---- ############
def inp():
    return(int(input()))
def inlt():
    return(list(map(int,input().split())))
def insr():
    s = input()
    return(list(s[:len(s) - 1]))
def invr():
    return(map(int,input().split()))


n = inp()
stones = inlt()

if n == 0: 
	print 0

inf = 2 ** 31
# dp[i] states the minimum cost to stones 1....i
dp = [inf for _ in range(len(stones))]
dp[0] = 0

for i in range(1, len(dp)):
	dp[i] = min(dp[i], dp[i-1] + abs(stones[i] - stones[i-1]))
	if i - 2 >= 0:
		dp[i] = min(dp[i], dp[i-2] + abs(stones[i] - stones[i-2]))

print dp[-1] if dp[-1] != inf else 0


Measured memory_bytes: 12144
def input_one_number():
    return int(input())

def input_multiple_number():
    return map(int, input().split())

def input_multiple_number_as_list():
    return list(map(int, input().split()))


N = input_one_number()

listS = []
import hashlib
for i in range(N):
	listS.append(input())

print(len(set(listS)))



Measured memory_bytes: 37296
use proconio::input;

fn main() {
  input! {
    a: f64,
    b: f64,
    h: f64,
    m: f64,
  }
  
  let dh = 2.0 * std::f64::consts::PI / 12.0 / 60.0;
  let rh = 2.0 * std::f64::consts::PI / 12.0 * h + dh * m;
  let rm = 2.0 * std::f64::consts::PI / 60.0 * m;
  let mut diff = (rh - rm).abs();
  if diff > std::f64::consts::PI {
    diff = 2.0 * std::f64::consts::PI - diff;
  }

  let r = (a * a + b * b - 2.0 * a * b * diff.cos()).sqrt();

  println!("{:.20}", r);
}


Measured memory_bytes: 2956
#include<cstdio>
#include<algorithm>
#include<iostream>
#include<cstdlib>
#include<cstring>
using namespace std;

string s,t;

int main()
{
	cin>>s>>t;
	int  f = 0;
	for(int  i = 0; i < s.size(); i++)
	{
		if(s[i] == t[2-i]) 
			f++;
		}
	if( f == 3) cout<<"YES"<<endl;
	else cout<<"NO"<<endl;;
	return 0;
	}

Measured memory_bytes: 256
import numpy as np

N, M, K = map(int, input().split())

LR = np.zeros(shape=(N + 1, N + 1), dtype=np.int32)
L, R = np.array([input().split() for _ in range(M)], dtype=np.int32).T
np.add.at(LR, (L, R), 1)

np.cumsum(LR, axis=0, out=LR)
np.cumsum(LR, axis=1, out=LR)

P, Q = np.array([input().split() for _ in range(K)], dtype=np.int32).T

P -= 1
ans = LR[Q, Q] - LR[P, Q] - LR[Q, P] + LR[P, P]
print(*ans, sep='\n')


Measured memory_bytes: 77680
#include <cstdio>
#include <cmath>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>

#ifdef _DEBUG
#define DMP(x) cerr << #x << ": " << x << "\n"
#else
#define DMP(x) ((void)0)
#endif

const int MOD = 1000000007, INF = 1111111111; 
using namespace std;
typedef long long lint;

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	int N;
	cin >> N;

	vector<lint> memo(100);
	memo[0] = 2;
	memo[1] = 1;

	auto Lucas = [&](auto &&f, int n) -> lint {

		if (n < 2) return memo[n];
		if (!memo[n - 1]) memo[n - 1] = f(f, n - 1);
		if (!memo[n - 2]) memo[n - 2] = f(f, n - 2);
		return memo[n - 1] + memo[n - 2];
		
	};

	cout << Lucas(Lucas, N) << "\n";

	return 0;
}

Measured memory_bytes: 256
f ::[Int]->Int
f [x,y] = (*) x y
main = do
    n <- readLn
    s <- map read . words <$> getLine
    print$ foldl (+) 0  (map f (map id [[(s!!j),(s!!k)] |j<-[0..n-1],k<-[0..n-1],j<k]))


Measured memory_bytes: 764
#include<iostream>
#include<algorithm>
using namespace std;
signed main()
{
  int a,b,d,r;
  double f;
  cin>>a>>b;
  d=a/b;
  r=a%b;
  f=(double)a/b;
  cout<<d<<" "<<r<<" "<<fixed<<f<<"\n";
  return(0);
}



Measured memory_bytes: 3284
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,k;
	cin>>n>>k;
	int a[n],t=0;
	for(int i=1;i<=n;i++){
		cin>>a[i];
		if(a[i]>=k)    t++; 
	}
	cout<<t<<endl;
	return 0;
}

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

ll gcd(ll x ,ll y){
    ll r = x%y;
    if(r==0)return y;
    else return gcd(y ,r);
}

int main(){
    int sx ,sy ,tx ,ty;
    cin >> sx >> sy >> tx >> ty ;
    int x = tx - sx;
    int y = ty - sy;
    for(int i=0;i<y;i++) cout << 'U';
    for(int i=0;i<x;i++) cout << 'R';
    for(int i=0;i<y;i++) cout << 'D';
    for(int i=0;i<x;i++) cout << 'L';
    cout << 'L' ;
    for(int i=0;i<=y;i++) cout << 'U';
    for(int i=0;i<=x;i++) cout << 'R';
    cout << "DR";
    for(int i=0;i<=y;i++) cout << 'D';
    for(int i=0;i<=x;i++) cout << 'L';
    cout << 'U'<<endl;
}

Measured memory_bytes: 256
x = int(input())

flag = 0
ans = 0
while flag == 0:
    if x == 2:
        ans = 2
        break
    flag = 1
    for i in range(2,x//2+2):
        if x%i == 0:
            flag = 0
            break
    ans = x
    x+=1 

print(ans)

Measured memory_bytes: 3060
N = int(input())

d = {}

for i in range(N):
    s = input()
    if s in d:
        d[s] = d[s] + 1
    else:
        d[s] = 1

hoge = max(d.values())

max_kv_list = [kv[0] for kv in d.items() if kv[1] == hoge]

max_kv_list = sorted(max_kv_list)
for ans in max_kv_list:
    print(ans)

Measured memory_bytes: 33112
<?php
$input=trim(fgets(STDIN));
$array_data=array();
while($input<>""){
	$array_data[]=$input;
	$input=trim(fgets(STDIN));
}

foreach($array_data as $val){
	$array_temp=array();
	$array_temp=explode(" ",$val);

	if($array_temp[0]==0 && $array_temp[1]==0){

		break;
	}

	if($array_temp[0]>$array_temp[1]){

		printf("%d %d\n",$array_temp[1],$array_temp[0]);
	}else{

		printf("%d %d\n",$array_temp[0],$array_temp[1]);

	}

}

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

int main(){
    int h,w;
    cin >> h >> w;
    vector<string> s(h);
    for(int i = 0; i < h;  i++)
    cin >> s[i];
    for(int i = 0; i < h; i++){
        for(int j = 0; j < w; j++){
            int cnt = 0;
            if(s[i][j] == '#')
            continue;
            for(int k = -1; k < 2; k++){
                for(int l = -1; l < 2; l++){
                    if(i + k < 0 || i + k >= h || j + l < 0 || j + l >= w)
                    continue;
                    if(s[i + k][j+ l] == '#')
                    cnt++;
                }
                s[i][j] = char(48 + cnt);
            }
        }
    }
    for(int i = 0; i < h; i++){
       cout << s[i] << endl;
    }
}

Measured memory_bytes: 256
#include <cstdio>
#include <utility>
#include <vector>
#include <algorithm>
using namespace std;

int main() {
	int N, M;
	scanf("%d %d", &N, &M);
	vector<pair<int, int>> cards;
	for(int i = 0; i < N; i++) {
		int a;
		scanf("%d", &a);
		cards.push_back(pair<int, int>(a, 1));
	}
	for(int i = 0; i < M; i++) {
		int b, c;
		scanf("%d %d", &b, &c);
		cards.push_back(pair<int, int>(c, b));
	}
	sort(cards.rbegin(), cards.rend());
	
	int cnt = N, index = 0;
	long max_value = 0;
	while(cnt > 0) {
		pair<int, int> p = cards[index];
		if(cnt >= p.second) {
			max_value += (long)p.first * p.second;
		} else {
			max_value += (long)p.first * cnt;
		}
		cnt -= p.second;
		index++;
	}
	printf("%ld", max_value);
	
	return 0;
}

Measured memory_bytes: 2420
S = input()
words = [chr(c) for c in range(ord("a"), ord("z")+1)]
if S == "".join(words[::-1]):
  print(-1)
elif len(S) != 26:
  for c in words:
    if c not in S:
      print(S + c)
      exit()
else:
  for i in range(1, 26):
    for j in range(i+1):
      if S[-(i+1)] < S[-(j+1)]:
        print(S[:-(i+1)] + S[-(j+1)])
        exit()

Measured memory_bytes: 3064
package main

import "fmt"

func main() {
	var a, b int
	fmt.Scan(&a, &b)

	sum := 0
	for i := 0; i < 2; i++ {
		if a > b {
			sum += a
			a--
		} else {
			sum += b
			b--
		}
	}

	fmt.Println(sum)
}


Measured memory_bytes: 512
n = int(input())
t = [-1,-1]
for i in range(1,n+1):
    tn = i
    x=0
    while(i%2 == 0):
        x+=1
        i=i/2
    if t[1] < x:
        t[0],t[1] = tn,x 
print(t[0])

Measured memory_bytes: 3060
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> P;
typedef pair<ll, P> P1;

#define fr first
#define sc second
#define mp make_pair
#define pb push_back
#define rep(i, x) for (ll i = 0; i < x; i++)
#define rep1(i, x) for (ll i = 1; i <= x; i++)
#define rrep(i, x) for (ll i = x - 1; i >= 0; i--)
#define rrep1(i, x) for (ll i = x; i > 0; i--)
#define sor(v) sort(v.begin(), v.end())
#define rev(s) reverse(s.begin(), s.end())
#define lb(vec, a) lower_bound(vec.begin(), vec.end(), a)
#define ub(vec, a) upper_bound(vec.begin(), vec.end(), a)
#define uniq(vec) vec.erase(unique(vec.begin(), vec.end()), vec.end())
#define mp1(a, b, c) P1(a, P(b, c))

const ll INF = 100000000;
const ll M = 1000000007LL;
const ll dir_4[4][2] = {{1, 0}, {0, 1}, {-1, 0}, {0, -1}};
const ll dir_8[8][2] = {{1, 0},  {1, 1},   {0, 1},  {-1, 1},
                        {-1, 0}, {-1, -1}, {0, -1}, {1, -1}};

/*----------------------------------------------/
/- char         : %c  | char *       : %s  | short        : %hd
/- int          : %d  | long         : %ld | long long    : %lld
/- unsigned short:%hu | unsigned int : %u  | unsigned long: %lu
/- u_long long  : %llu| (octal)      : %o  | (hexadecimal): %x
/- float        : %f  | double       : %lf |
/----------------------------------------------*/

/*----------------------------------------------/
/- INT_MAX, LONG_MAX   : 1<<15 = 2.1*pow(10, 9)       (= 2147483647)
/- UINT_MAX, ULONG_MAX : 1<<16 = 4.2*pow(10, 9)       (= 4294967295)
/- LLONG_MAX           : 1<<63 = 9.2*pow(10, 18)      (= 9223372036854775807)
/- ULLONG_MAX          : 1<<64 = 1.8*pow(10, 19)      (= 18446744073709551615)
/----------------------------------------------*/

ll dp[111][4][4][4];

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

    dp[0][3][3][3] = 1;
    rep(i, n) rep(j, 4) rep(k, 4) rep(l, 4) rep(m, 4) {
        if (k == 0 && l == 1 && m == 2)
            continue;
        if (k == 1 && l == 0 && m == 2)
            continue;
        if (k == 0 && l == 2 && m == 1)
            continue;
        if (j == 0 && l == 1 && m == 2)
            continue;
        if (j == 0 && k == 1 && m == 2)
            continue;
        dp[i + 1][k][l][m] = (dp[i + 1][k][l][m] + dp[i][j][k][l]) % M;
    }

    int ret = 0;
    rep(j, 4) rep(k, 4) rep(l, 4) {
        ret = (ret + dp[n][j][k][l]) % M;
    }
    cout << ret;

    /* ====================================== */
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
char c;
int main() {
	cin >> c;
	if (c == 'a' || c == 'i' || c == 'u' || c == 'e' || c == 'o')cout << "vowel" << endl;
	else cout << "consonant" << endl;
	return 0;
}

Measured memory_bytes: 384
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
#include<stdbool.h>
typedef long long ll;
typedef long double ld;
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k))
#define rrep(i,l,r)for(ll i=(l);i>=(r);i--)
#define INF (1LL<<60)
#define MOD1 1000000007
#define MOD2 998244353
#define MAX_N (1 << 17)
#define YES printf("Yes\n")
#define NO printf("No\n")
#define PN printf("\n")

void swap(ll *a, ll *b){ll c;c=*b;*b=*a;*a=c;}
ll max2(ll a,ll b){return a>=b?a:b;}
ll min2(ll a,ll b){return a>=b?b:a;}
ll min3(ll a, ll b, ll c){return (a<=b && a<=c) ? a : b<=c ? b : c;}
ll max3(ll a, ll b, ll c){return (a>=b && a>=c) ? a : b>=c ? b : c;}
ll minn(ll n, ll a[n]){ll b=INF;rep(i,0,n) b=min2(b,a[i]);return b;}
ll maxn(ll n, ll a[n]){ll b=-INF;rep(i,0,n) b=max2(b,a[i]);return b;}
ll ABS(ll a){return a>=0?a:(-a);}
ll POW(ll a, ll b){ll c=1;rep(i,0,b) c*=a;return c;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
ll mod(ll n){return n%=MOD1;}
int upll(const void*a, const void*b){return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;}
int downll(const void*a, const void*b){return*(ll*)a<*(ll*)b?1:*(ll*)a>*(ll*)b?-1:0;}
void sortup(ll*a,int n){qsort(a,n,sizeof(ll),upll);}
void sortdown(ll*a,int n){qsort(a,n,sizeof(ll),downll);}

typedef struct{ ll aa , bb;}fr;
int cmp1( const void *p, const void *q ) { return ((fr*)p) ->aa - ((fr*)q)->aa;}

/*-------------------------------------------------*/
// Union Find              添字に注意!!!!!!!!!!
typedef struct{
    ll num; //number
    ll par; //parent
    ll height; //height
}UF;
void UFmake(ll n, UF b[n]){for(ll i=0;i<n;i++){
    b[i].par = i;
    b[i].num = i;
    b[i].height = 1;
    }
}
ll UFroot(ll n, ll a,UF b[n]){ return a==b[a].par?a:UFroot(n,b[a].par,b); }
void UFunite(ll n, ll x, ll y, UF b[n]){
    if(b[UFroot(n,x,b)].height > b[UFroot(n,y,b)].height) b[UFroot(n,y,b)].par = UFroot(n,x,b);
    else{ b[UFroot(n,x,b)].par = UFroot(n,y,b); b[UFroot(n,y,b)].height = max2(b[UFroot(n,y,b)].height,b[UFroot(n,x,b)].height+1);}
}
ll UFsame(ll n, ll x, ll y, UF b[n]){ return UFroot(n,x,b) == UFroot(n,y,b) ? 1 : 0; }

int main(void){
    // char ;
    ll n,m,ans=0;
    scanf("%lld%lld",&n,&m);
    ll p[n],x[m],y[m];
    rep(i,0,n){
        scanf("%lld",&p[i]);
    }
    rep(i,0,m){
        scanf("%lld%lld",&x[i],&y[i]);
    }
    UF tr[n];
    UFmake(n,tr);
    rep(i,0,m){
        UFunite(n,x[i]-1,y[i]-1,tr);
    }
    rep(i,0,n){
        if(UFsame(n,p[i]-1,p[p[i]-1]-1,tr)){
            ans++;
        }
    }
    printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 4864
#include<cstdio>
#include<map>
#include<vector>

using namespace std;

typedef pair<int,int> P;
typedef pair<P, int> edge; // source, target, cost
typedef long long int lli;

lli dis[100000];
vector<edge> edges;

int main(void) {
    lli v,e,r;
    scanf("%lld%lld%lld",&v,&e,&r);
    for(lli i=0; i<e; i++) {
        int s,t,d;
        scanf("%d%d%d",&s,&t,&d);
        edges.push_back(edge(P(s,t),d));
    }
    for(lli i=0; i<v; i++)
        dis[i] = 0xFFFFFFFF;


    dis[r] = 0;

    for(lli i=0; ; i++) {
        bool flag = false;
        for(vector<edge>::iterator it=edges.begin(); it != edges.end(); it++) {
            if(dis[it->first.first] == 0xFFFFFFFF)
                continue;
            if(dis[it->first.first] + it->second < dis[it->first.second]) {
                dis[it->first.second] = dis[it->first.first] + it->second;
                flag = true;
            }
        }
        if(!flag) break;
        if(i>2*v) {
            printf("NEGATIVE CYCLE\n");
            return 0;
        }

    }
    for(lli i=0; i<v; i++)
        if(dis[i] == 0xFFFFFFFF)
            printf("INF\n");
        else
            printf("%lld\n", dis[i]);

    return 0;
}

Measured memory_bytes: 1088
/*---Bismillahir Rahmanir Rahim---*/
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <cstring>
#include <unordered_map>
#include <queue>
#define mod 998244353
#define int long long
#define ld long double
#define pb push_back
#define sz(x) (int)x.size()
#define ff first
#define ss second
#define pii pair<int, int>
using namespace std;

inline void solve() { 
	int  n,a,b,ans=0;
	cin >> n >> a >> b ; 
	if((b-a)&1^1) ans = (b-a)/2;
	else ans = min(n-b,a-1)+1+(b-a)/2;
	cout << ans << endl;
} 

signed main()
{
	int n = 1;
	// cin >> n;
	while (n--)
		solve();
	return 0;
}
/*

*/


Measured memory_bytes: 3608
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations, accumulate, groupby
    #from itertools import product
    from bisect import bisect_left,bisect_right
    from heapq import heapify, heappop, heappush
    from math import floor, ceil
    #from operator import itemgetter

    #inf = 10**17
    #mod = 10**9 + 7

    n,m = map(int, input().split())
    py = [list(map(int, input().split())) for _ in range(m)]
    #l[i]:県iの市
    l = [[] for _ in range(n+1)]
    for p, y in py:
        l[p].append(y)
    for i in range(n+1):
        l[i].sort()
    for p, y in py:
        a = bisect_left(l[p], y) + 1
        print('{:06d}{:06d}'.format(p, a))



if __name__ == '__main__':
    main()

Measured memory_bytes: 73308
import java.util.Scanner;

public class Main {

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

		int a = sc.nextInt();
//		int b = sc.nextInt();
		double res = 0;
//		String s = sc.next();
//		String res = "";

		double da = a;

		res = (da/3)*(da/3)*(da/3);
		System.out.printf("%f", res);
		//System.out.println(res);
	}
}


Measured memory_bytes: 21588
/*
USER: caoash3
LANG: JAVA
TASK: 
*/

import java.io.*;
import java.util.*;

public class Main {

	static final boolean stdin = true;
	static final String filename = "";
	static FastScanner br;
	static PrintWriter pw;

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

		if (stdin) {
			br = new FastScanner();
			pw = new PrintWriter(new OutputStreamWriter(System.out));
		}

		else {
			br = new FastScanner(filename + ".in");
			pw = new PrintWriter(new FileWriter(filename + ".out"));
		}

		X solver = new X();
		solver.solve(br, pw);
	}

	static class X {
		
		static int N, oo = 987654321;
		static long[][] adj, dp;
		
		public void solve(FastScanner br, PrintWriter pw) throws IOException {
			N = br.nextInt();
			adj = new long[N][N];
			
			for(int i = 0; i < N; i++) {
				for(int j = 0; j < N; j++) {
					adj[i][j] = br.nextInt();
				}
			}
			
			dp = new long[N+1][1 << N];
			
			dp[0][0] = 1;
			
			long mod = (long) 1e9+7;
			
			
				for(int j = 0; j < (1 << N); j++) {
					
					int i = 0;
					
					for(int cnt = 0; cnt < N; cnt++) {
						if(((1 << cnt) & j) != 0) {
							i++;
						}
					}
					
					for(int c = 0; c < N; c++) {
						if(((1 << c) & j) != 0) {
							if(adj[i-1][c] == 1) {
								dp[i][j] = (dp[i][j] + dp[i-1][j & (~(1 << c))])%mod;
								
							}
						}
					}
				
			}
			
			pw.println(dp[N][(1 << N) - 1]);
			
			
			
			
			pw.close();
		}

	}

	//fastscanner class
	public static class FastScanner {
		BufferedReader br;
		StringTokenizer st;

		public FastScanner(String s) {
			try {
				br = new BufferedReader(new FileReader(s));
			} catch (FileNotFoundException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}

		public FastScanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String nextToken() {
			while (st == null || !st.hasMoreElements()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(nextToken());
		}

		long nextLong() {
			return Long.parseLong(nextToken());
		}

		double nextDouble() {
			return Double.parseDouble(nextToken());
		}
	}

}
 



Measured memory_bytes: 383316
#include <iostream>
#include <vector>
#include <math.h>
using namespace std;
int main()
{
	long n, k, m;
	int c;
	cin >> n;
	m = n;
	k = ceil(sqrt((double)n));
	vector<char> vA(k+1, 0);
	vector<long> vP;
	vector<long> vC;
	vP.reserve(100);
	vC.reserve(100);
	for(int i = 2; i <= k; ++i){
		if( vA[i] == 0 ){
			vA[i] = 1;
			for(int j = 2; j * i <= k; ++j)
				vA[i * j] = 2;
			c = 0;
			while( 0 == m % i){
				m = m / i;
				++c;
			}
			if( 0 != c){
				vP.push_back(i);
				vC.push_back(c);
			}
		}
	}

	if( 1 != m){
		vP.push_back(m);
		vC.push_back(1);
	}

	cout << n << ":";
	for(int i = 0; i < vP.size(); ++i){
		long p = vP[i];
		for(int j = 0; j < vC[i]; ++j)
			cout << " " << p;
	}
	cout << "\n";
	return 0;
}

Measured memory_bytes: 1248
#include <bits/stdc++.h>
using namespace std;
long long modinv(long long a) {
    long long m = 1000000007, u = 1, v = 0;
    long long b=m;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}
int main() {
  int n,k;
  cin >> n >> k;
  const long long MOD = 1000000007;
  long long res=(n-k+1);
  long long nextBUNSI1=n-k+1;
  long long nextBUNBO1=1;
  long long nextBUNSI2=k;
  long long nextBUNBO2=0;
  for(int i=0;i<k;i++){
    cout << res <<endl;
    nextBUNBO1++;
    nextBUNSI1--;
    nextBUNBO2++;
    nextBUNSI2--;
    res=res*nextBUNSI1%MOD*(modinv(nextBUNBO1)%MOD)%MOD;
    res=res*nextBUNSI2%MOD*(modinv(nextBUNBO2)%MOD)%MOD;
  }
  return 0;
}


Measured memory_bytes: 256
from statistics import median

N = int(input())
A = list(map(int,input().split()))

C = [A[i]-i for i in range(N)]
C =sorted(C)

if N%2 ==1:
    B = C[int(N/2)]
else:
    B = (C[int((N-1)/2)]+C[int((N+1)/2)])/2

    
SUM = 0
for i in range(N):
    SUM += abs(C[i] -B)
print(int(SUM))

Measured memory_bytes: 27228
#include<stdio.h>
int main(){
	while(1){
		int max=0;char sec;
		for(int i=0;i<5;i++){
			int a,b;scanf("%d%d",&a,&b);
			if(i==0&&(a|b)==0)return 0;
			if(max<a+b){
				max=a+b;sec='A'+i;
			}
		}printf("%c %d\n",sec,max);
	}
}


Measured memory_bytes: 2580
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
typedef long long ll;
typedef pair<int, int> P;
const int INF = 100100100;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
int main() {
  ll N, C, K;
  cin >> N >> C >> K;
  vector<ll> T(N);
  REP(i, N) cin >> T[i];
  ll ans = 0;
  ll num = 0;
  sort(T.begin(), T.end());
  ll intcnt = 0;
  ll time = T[0];
  REP(i, N) {
    if (K < T[i] - time) {
      ans++;
      num = 0;
      time = T[i];
      intcnt = i;
    }
    if (C <= num) {
      ans++;
      num = 0;
      intcnt = i;
      time = T[i];
    }
    num++;
  }
  if (0 < num) ans++;
  cout << ans << endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
int A, B;
int main()
{
	cin >> A >> B;
	for (int i = 0; i < 1300; i++)
	{
		if ((int)floor(i * 0.08) == A && (int)floor(i * 0.1) == B)
		{
			cout << i << endl;
			return 0;
		}
	}
	cout << -1 << endl;
	return 0;
}


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

using namespace std;

short visited[0xffffff];

inline int is_visited(unsigned s){

    if(visited[s&0xffffff] == -1)
        return 0;
    else
        return 1;
}

inline void set_visited(unsigned s, int n){ visited[s&0xffffff]=n; }

inline unsigned exchange(unsigned s, unsigned p1, unsigned p2, unsigned n){

    unsigned x  = ((s>>p1)^(s>>p2))&((1U<<n)-1);
    unsigned ns = s^((x<<p1)|(x<<p2));

    return ns;

}

int main(){

    cin.sync_with_stdio(false);

    unsigned istate = 0;
    
    for(int i=0;i<8;++i) istate |= (i<<(3*i));

    queue<unsigned> q;
    q.push(istate);

    memset(visited,-1,sizeof(visited));
    set_visited(istate,0);

    for(int n=0;;++n){

        queue<unsigned> nq;

        while(!q.empty()){

            unsigned p = q.front(); q.pop();
            unsigned state = (p&0xffffff);
            unsigned pos = (p>>24);

            int bit_pos = 3*pos;
            unsigned next_state;

            if(pos!=0 && pos!=4){

                next_state = exchange(state,bit_pos,bit_pos-3,3);
                next_state |= ((pos-1)<<24);

                if(!is_visited(next_state)){
                    set_visited(next_state,n+1);
                    nq.push(next_state);
                }

            }

            if(pos!=3 && pos!=7){

                next_state = exchange(state,bit_pos,bit_pos+3,3);
                next_state |= ((pos+1)<<24);

                if(!is_visited(next_state)){
                    set_visited(next_state,n+1);
                    nq.push(next_state);
                }
            }
           
            if(pos<=3){

                next_state = exchange(state,bit_pos,bit_pos+12,3);
                next_state |= ((pos+4)<<24);

                if(!is_visited(next_state)){
                    set_visited(next_state,n+1);
                    nq.push(next_state);
                }

            }

            if(pos>=4){
                next_state = exchange(state,bit_pos,bit_pos-12,3);
                next_state |= ((pos-4)<<24); 
                
                if(!is_visited(next_state)){
                    set_visited(next_state,n+1);
                    nq.push(next_state);
                }
            }

        }
       
        if(nq.empty())break;

        q = nq;

    }

    unsigned int a[8];

    while(cin >> a[0]){

        for(int i=1;i<8;++i) cin >> a[i];
        unsigned state=0;
        for(int i=0;i<8;++i)state |= (a[i]<<(3*i));

        cout << visited[state] << endl;

    }

    return 0;

}

Measured memory_bytes: 34008
// Package main provides
//
// File:  main.go
// Author: ymiyamoto
//
// Created on Sun Jan 27 18:10:19 2019
//
package main

import (
	"fmt"
	"sort"
)

type pair struct {
	x, v int
}

func max(slice ...int) int {
	sort.Ints(slice)
	return slice[len(slice)-1]
}

func main() {
	var N, C int
	fmt.Scan(&N, &C)

	ps := make([]pair, N)
	for i := range ps {
		fmt.Scan(&ps[i].x, &ps[i].v)
	}

	rV := make([]int, N)
	for i := range ps {
		if i == 0 {
			rV[i] = ps[i].v
		} else {
			rV[i] = rV[i-1] + ps[i].v
		}
	}

	rV2 := make([]int, N)
	for i := range rV {
		rV[i] -= ps[i].x
		rV2[i] = rV[i] - ps[i].x
	}

	maxRV := make([]int, N)
	for i := range maxRV {
		if i == 0 {
			maxRV[i] = rV[i]
		} else {
			maxRV[i] = max(rV[i], maxRV[i-1])
		}
	}

	lV := make([]int, N)
	for i := range ps {
		if i == 0 {
			lV[i] = ps[len(ps)-1-i].v
		} else {
			lV[i] = lV[i-1] + ps[len(ps)-1-i].v
		}
	}

	lV2 := make([]int, N)
	for i := range lV {
		lV[i] -= C - ps[len(ps)-1-i].x
		lV2[i] = lV[i] - (C - ps[len(ps)-1-i].x)
	}

	maxLV := make([]int, N)
	for i := range maxLV {
		if i == 0 {
			maxLV[i] = lV[i]
		} else {
			maxLV[i] = max(lV[i], maxLV[i-1])
		}
	}

	ans := max(0, maxRV[len(rV)-1], maxLV[len(lV)-1])
	for i := range rV {
		if i < len(rV)-1 {
			ans = max(ans, rV2[i]+maxLV[len(lV)-2-i], lV2[i]+maxRV[len(rV)-2-i])
		}
	}

	fmt.Println(ans)
}


Measured memory_bytes: 13568
# https://atcoder.jp/contests/arc068/tasks/arc068_a

x = int(input())

# 6の面が上向きになるように置き、次は5にする。そしてまた6に戻す。
# この2回の操作で11点獲得できる。これが2回の操作で得られる最高点である。

n = x // 11
ans = n * 2
x -= n * 11

if x == 0:
    pass
elif x <= 6:
    ans += 1
else:
    ans += 2
print(ans)

Measured memory_bytes: 61820
#include <bits/stdc++.h>
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;
}
using ll = long long;

#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define endl "\n"
const double EPS = 1e-7;
const int INF = 1 << 30;
const ll LLINF = 1LL << 60;
const double PI = acos(-1);
constexpr int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

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

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<int> p(n), q(n);
    for(int i = 0; i < n; i++) {
        cin >> p[i];
    }
    for(int i = 0; i < n; i++) {
        cin >> q[i];
    }
    vector<int> v(n);
    iota(ALL(v), 1);
    vector<vector<int>> rec;
    do {
        rec.emplace_back(v);
    } while(next_permutation(ALL(v)));
    int a, b;
    for(int i = 0; i < rec.size(); i++) {
        if(rec[i] == p) {
            a = i;
        }
        if(rec[i] == q) {
            b = i;
        }
    }
    cout << abs(a - b) << endl;
}

Measured memory_bytes: 3384
#include<bits/stdc++.h> 
//#define <- プログラムの文字列を置換する
//typedef <- 新しい型に名前を付けるためのキーワード

using namespace std;

#define MAX_N 100000

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

const long long MOD = 1e9 + 7;
const long long INF = 1e15;
const int INF_INT = 1e9;

template<class TYPE>
struct edge{
    TYPE to,cost; 
    edge(TYPE t,TYPE c){
        to = t;
        cost = c;
    }
};

int main(){
    string s;
    string t;
    cin >> s >> t;
    reverse(s.begin(),s.end());
    if(s == t) cout << "YES" << endl;
    else cout << "NO" << endl;
    return 0;
}


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

int main(){
    int n;
    scanf("%d",&n);
    int m[n][3];
    int dp[n][3];
    for (int i=0;i<n;i++) scanf("%d %d %d",&m[i][0],&m[i][1],&m[i][2]);
    for (int i=0;i<3;i++) dp[0][i]=m[0][i];
    for (int i=1;i<n;i++) for (int j=0;j<3;j++) {
        if (j==0) dp[i][j]=max(dp[i-1][1],dp[i-1][2])+m[i][0];
        if (j==1) dp[i][j]=max(dp[i-1][0],dp[i-1][2])+m[i][1];
        if (j==2) dp[i][j]=max(dp[i-1][0],dp[i-1][1])+m[i][2];
    }
    printf("%d\n",max(dp[n-1][0],max(dp[n-1][1],dp[n-1][2])));
    return 0;
}


Measured memory_bytes: 2560
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <queue>
using namespace std;
using P = pair<int, pair<int, int>>;

int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    for(int i = 0; i < n; i++) cin >> a[i];

    sort(a.begin(), a.end());
    priority_queue<P> memo;
    long long int ans = 0;
    ans += a[n-1];
    if(n-2 >= 0){
        if(n-3 >= 0){
            ans += min(a[n-1], a[n-2]);
            memo.push(make_pair(min(a[n-1], a[n-2]), make_pair(a[n-1], a[n-2])));
            memo.push(make_pair(min(a[n-1], a[n-3]), make_pair(a[n-1], a[n-3])));
            memo.push(make_pair(min(a[n-2], a[n-3]), make_pair(a[n-2], a[n-3])));

            for(int i = n-4; i >= 0; i--){
                ans += memo.top().first;
                int b1 = memo.top().second.first;
                int b2 = memo.top().second.second;
                memo.pop();
                memo.push(make_pair(min(b1, a[i]), make_pair(b1, a[i])));
                memo.push(make_pair(min(b2, a[i]), make_pair(b2, a[i])));
            }
        }
    }
    cout << ans << endl;
    return 0;
}

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

int main() {
  int num[5];
  for ( int i = 0; i < 5; i++ ) cin >> num[i];
  sort(num,num+5);
  reverse(num,num+5);

  cout << num[0] << " " << num[1] << " " << num[2] << " " << 
    num[3] << " " << num[4] << endl;
  return 0;
}

Measured memory_bytes: 1180
v = list(map(int, input().split()))
while v[0]!=0 or v[1]!=0:
    for i in range(v[0]):
        for j in range(v[1]):
            if i>0 and i<v[0]-1 and j>0 and j<v[1]-1:
                print (".", end="")
            else:
                print ("#", end="")
        print ()
    print ()
    v = list(map(int, input().split()))


Measured memory_bytes: 7008
import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		int W=sc.nextInt();
		int H=sc.nextInt();
        int x=sc.nextInt();
        int y=sc.nextInt();
        int r=sc.nextInt();
        
        if(x-r>=0&&x+r<=W&&y-r>=0&&y+r<=H){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
}


Measured memory_bytes: 26400
package main

import "fmt"

func main() {
    var n int
    var s string
    alp := make([]int, 26)
    mod := int(1e9)+7
    for i := 0; i < 26; i++ {
        alp[i] = 1
    }
    fmt.Scan(&n, &s)

    for i := 0; i < len(s); i++ {
        alp[int(s[i]-'a')]++
    }
    ans := 1

    for i := 0; i < 26; i++ {
        ans *= alp[i]
        ans %= mod
    }
    fmt.Println(ans-1)
}

Measured memory_bytes: 1280
#include<bits/stdc++.h>
#define rep(i,m) for(long long i=0; i<m; i++)
#define per(i,m) for(long long i=m-1; i>=0; i--)
#define FOR(i,n,m) for(long long i=n; i<m; i++)
#define ROF(i,n,m) for(long long i=m-1; i>=n; i--)
#define SORT(v,n) do{sort(v,v+n);reverse(v,v+n);}while(0)
#define all(x) (x).begin(),(x).end()
#define EPS (1e-7)
#define INF (1e18)
#define PI (acos(-1))
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
using namespace std;
typedef long long ll;
const ll MOD = 1000000007;
typedef pair<ll, ll> LP;

ll POW(ll x,ll n){
  if(n==0)return 1;
  if(n%2==0)return POW(x*x,n/2)%MOD;
  return x%MOD*POW(x,n-1)%MOD;
}

ll POW2(ll x,ll n){
  if(n==0)return 1;
  if(n%2==0)return POW2(x*x,n/2);
  return x*POW2(x,n-1);
}

ll gcd(ll u, ll v) {
  ll r;
  while (0 != v) {
    r = u % v; u = v; v = r;
  }
  return u;
}

ll lcm(ll u, ll v) {
  return u*v/gcd(u,v);
}
 
ll KAI(ll m)
{
  if(m<0) return 0;
  if(m==0) return 1;
  return m*KAI(m-1)%MOD;
}
 
ll KAI2(ll m)
{
  if(m<0) return 0;
  if(m==0) return 1;
  return m*KAI2(m-1);
}

ll extGCD(ll a, ll b, ll &x, ll &y) {
    if (b == 0) {
        x = 1;
        y = 0;
        return a;
    }
    ll d = extGCD(b, a%b, y, x);
    y -= a / b * x;
    return d;
}
 
inline ll mod(ll a, ll m) {
    return (a % m + m) % m;
}
 
ll modinv(ll a) {
    ll x, y;
    extGCD(a, MOD, x, y);
    return mod(x, MOD);
}
 
ll COM(ll m,ll n)
{
  if(m<n) return 0;
  if(n<0) return 0;
  if(n==0) return 1;
  if(m==n) return 1;
  return KAI(m)%MOD*modinv(KAI(n)%MOD*KAI(m-n)%MOD)%MOD;
}

ll COM2(ll m,ll n)
{
  if(m<n) return 0;
  if(n<0) return 0;
  if(n==0) return 1;
  if(m==n) return 1;
  return KAI2(m)/KAI2(n)/KAI2(m-n);
}

ll DEC(ll x,ll m,ll n)
{
  return x%POW(m,n+1)/POW(m,n);
}

ll keta(ll x,ll n)
{
  if(x==0)return 0;
  return keta(x/n,n)+1;
}

ll DIV(ll x,ll n)
{
  if(x==0)return 0;
  return x/n+DIV(x/n,n);
}

ll ORD(ll x,ll n)
{
  if(x==0)return INF;
  if(x%n!=0)return 0;
  return 1+ORD(x/n,n);
}

int main()
{
  ll n,a[200000],x[200000],y[200000],c[200000],ans;
  cin >> n;
  rep(i,n)cin >> a[i];
  x[0]=a[0];
  FOR(i,1,n)x[i]=gcd(x[i-1],a[i]);
  y[n-1]=a[n-1];
  per(i,n-1)y[i]=gcd(y[i+1],a[i]);
  c[0]=y[1];
  c[n-1]=x[n-2];
  FOR(i,1,n-1)c[i]=gcd(x[i-1],y[i+1]);
  ans=c[0];
  rep(i,n)ans=max(ans,c[i]);
  printf("%lld",ans);
}

Measured memory_bytes: 6400
use std::io;

fn read_line() -> String {
    let mut in_str = String::new();
    io::stdin().read_line(&mut in_str).unwrap();
    return in_str
}

fn read_words_in_line() -> Vec<String> {
    let s = read_line();
    return s.split_whitespace().map(|x| x.to_string()).collect::<Vec<String>>()
}

fn read_t_in_line<T : std::str::FromStr>() -> Vec<T> {
    let mut v : Vec<T> = Vec::new();
    for e in read_words_in_line().iter().map(|x| x.parse::<T>()) {
        if let Ok(r) = e {
            v.push(r);
        }
        else{
            return Vec::new();
        }
    }
    return v;
}

fn sieve(upper_bound : usize) -> (Vec<i32>, Vec<bool>) {
    // list up primes less than or equal to upper_bound
    // return a prime list and a list which element has true if its index is prime 
    let mut prime_list : Vec<i32>  = Vec::new();
    let mut is_prime               = vec![true ; upper_bound + 1];
    is_prime[0] = false;
    is_prime[1] = false;
    for i in 0..upper_bound + 1 {
        if is_prime[i] {
            prime_list.push(i as i32);
            let mut mul = i + i;
            while mul <= upper_bound {
                is_prime[mul] = false;
                mul += i;
            }
        }
    }
    return (prime_list, is_prime);
}


fn main(){

    const MAX_N : usize = 100010;
    
    let mut ls = [0 ; MAX_N];
    let mut rs = [0 ; MAX_N];

    let v1 = read_t_in_line::<i32>();
    let q : usize = v1[0] as usize;

    for i in 0..q {
        let v2 = read_t_in_line::<i32>();
        ls[i] = v2[0];
        rs[i] = v2[1];
    }

    // calculate prime list
    let (_, is_prime) = sieve(MAX_N);
    
    let mut is_like_2017 = [false ; MAX_N];
    for i in 0..MAX_N {
        if i % 2 == 1 && is_prime[i] && is_prime[(i + 1) / 2] {
            is_like_2017[i] = true;
        }
    }
    
    let mut summed = [0 ; MAX_N];
    for i in 0..(MAX_N-1) {
        summed[i+1] = summed[i] + is_like_2017[i] as i32;
    }

    for i in 0..q {
        let l = ls[i] as usize;
        let r = rs[i] as usize;
        println!("{}", summed[r + 1] - summed[l]);
    }
    
    

}


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

ll n, ans;

int main() {
  cin >> n;
  vector<int> a(n);
  rep (i, n) {
    cin >> a[i];
  }
  sort(a.rbegin(), a.rend());
  ans = 0;
  for (int i = 1; i < n; i++) {
    ans += a[i/2];
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 4020
//  RAKSHIT KADAM
//ALWAYS USE &IT FOR ITERATING USING AUTO ...
//USE COUNT(STARTING ADDRESS, ENDING ADRESS ,VALUE) FOR FINDING THE COUNT IN THE RESPECTIVE DATA STRUCTURE
//NOTE THAT MEMSET CANT FILL THE DOUBLE VALUES;
//ACCUMULATE DOES NOT WORK PROPERLY IF VALUES START SUMMING BEYOND 1E9...
 #include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
// #define ordered_set tree< int ,  null_type ,  less<int> ,  rb_tree_tag ,  tree_order_statistics_node_update>
#warning !!!check the size of arrayss!!!

// NUMERIC DEFINITIONS :
    #define INF 100000000000000005
    #define inf 1000000000
    #define MOD  1000000007
    #define newMOD  998244353
    #define MAX 300006
    #define pi 3.1415926535897932384626433832795
#define ld long double
 #define ll long long
 #define int long long

 #define P(gg) for(auto rax:gg){cout<<rax<<" ";}cout<<endl;
 #define Need_for_speed(activated) ios_base :: sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
 #define satisfy ll t; cin>> t; while(t--)
 #define inp(n) int n;cin >> n
 #define mp make_pair
 #define pb push_back
 #define endl "\n"
 #define x first
 #define y second
 #define fore(i,a,b) for(ll i=a;i<b;i++)
 #define forci(i,n) for(ll i=0;i<n;i++)
 #define vi vector<ll>
 #define Endl endl
 #define lb lower_bound
 #define ub upper_bound
#define pii pair<ll,ll>

 #define input freopen("input.txt", "r", stdin),freopen("output.txt", "w", stdout)
 #define time        cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
using namespace std;

ll gcd(ll a, ll b){if (b == 0)return a;return gcd(b, a % b);}
int power(int x, unsigned int y, unsigned int m){ if (y == 0) return 1;int p = power(x, y/2, m) % m;  p = (p * p) % m;return (y%2 == 0)? p : (x * p) % m;}
ll modInverse(int a, int m){{ return power(a, m-2, m);}}
const int maxn = 500003;
 
void solve()
{
    ll n;cin>>n;
    map <pii , ll>m;ll a,b;
    ll cntt =0;
    ll pow2[200005]={0};
    pow2[0]=1;
    for(ll i=1;i<200005;i++)
    {
        (pow2[i]=pow2[i-1]*(2))%=MOD;
    }
    for(ll i=0;i<n;i++)
    {
        cin>>a>>b;
        if(!a && !b){cntt++;continue;}
        if(a<0)a*=-1,b*=-1;
        if(a==0 || b==0)
        {
            if(a<0)a*=-1;if(b<0)b*=-1;
        }
        ll g = abs(gcd(a,b));
        m[mp(a/g,b/g)]++;
    }
    ll ans=1;
    for(auto it:m)
    {
        if(it.y==0)continue;
        ll l = it.x.x;
        ll r = it.x.y;
        ll cnt = it.y;
        ll p1 = -r;
        ll p2 = l;
        
        m[mp(it.x.x,it.x.y)]=0;
        
        if(p1<0)p1*=-1,p2*=-1;
        if(p1==0 || p2==0)
        {
            if(p1<0)p1*=-1;if(p2<0)p2*=-1;
        }
        ll cnt2 = m[mp(p1,p2)];
        m[mp(p1,p2)]=0;
        (ans*=(pow2[cnt]-1 + pow2[cnt2]-1 +1+MOD))%=MOD;
    }
    cout<<(ans-1+cntt+MOD)%MOD<<endl;
}

signed main()
{
   Need_for_speed(activated);
//
//satisfy
//    {
//  solve();
//   }

    solve();
    
    return 0;
}


Measured memory_bytes: 30020
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,t,sum=0;
	cin>>n;
	t=n;
	while(t){
		sum+=t%10;
		t/=10;
	}
	//printf("%d\n",sum);
	if(n%sum==0||sum%n==0)printf("Yes");
	else printf("No");
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <functional>
#include <limits.h>
#include <set>
#include <map>
#include <tuple>
using namespace std;

#define ll long long
#define ull unsigned long long
#define rep(i,N) for (ll i=0;i<N;i++)
#define loop(i,N,M) for(ll i=N;i<M;i++)
#define MAX(v) *max_element(v.begin(),v.end())
#define MIN(v) *min_element(v.begin(),v.end())
#define SORTL2S(type,v) sort(v.begin(),v.end(),greater<type>())
#define SORTS2L(type,v) sort(v.begin(),v.end())
#define SORTMF(v,func) sort(v.begin(),v.end(),func)

//変数
ll A, B, C;

//解法
void solve() {

	cout << min(B / A, C);

	return;
}

int main() {

	//入力
	cin >> A>>B>>C;

	solve();
	cout << endl;
	return 0;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline

n = int(input())
a = [int(i) for i in input().split()]

# i番目までの和が正(i: 奇数)
res1 = 0
cum = 0
for i in range(n):
    cum += a[i]
    if i % 2 == 1:
        if cum <= 0:
            res1 += (1 - cum)
            cum = 1
    else:
        if cum >= 0:
            res1 += (cum + 1)
            cum = -1

# i番目までの和が正(i: 偶数)
res2 = 0
cum = 0
for i in range(n):
    cum += a[i]
    if i % 2 == 0:
        if cum <= 0:
            res2 += (1 - cum)
            cum = 1
    else:
        if cum >= 0:
            res2 += (cum + 1)
            cum = -1

print(min(res1,res2))

Measured memory_bytes: 15100
#include <bits/stdc++.h>
using namespace std;
int main ()
{
	int k,s,count=0;
	cin>>k>>s;
	for (int x=0;x<=k;x++)
	{
		for (int y=0;y<=k;y++){
		
		int z =s-x-y;
		if (z<=k &&z>=0)
		count++;
	}
}
cout<<count<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std ;
int a[5] , b[5] , c[5][5] ;
int main(){
    for( int i = 1 ; i <= 3 ; i++ )
        for( int j = 1 ; j <= 3 ; j++ )
            cin >> c[i][j] ;
    bool flag = false ;
    for( a[1] = -100 ; a[1] <= 100 ; a[1]++ )
        for( a[2] = -100 ; a[2] <= 100 ; a[2]++ )
            for( a[3] = -100 ; a[3] <= 100 ; a[3]++ ){
                for( int i = 1 ; i <= 3 ; i++ )
                    b[i] = c[1][i] - a[1] ;
                bool gg = true ;
                for( int i = 2 ; i <= 3 ; i++ ){
                    for( int j = 1 ; j <= 3 ; j++ ){
                        if ( c[i][j] != a[i] + b[j] ) gg = false ;
                    }
                }
                if ( gg ) flag = true ;
            }
    if ( flag ) cout << "Yes" << endl ;
    else cout << "No" << endl ;
    return 0 ;
}

Measured memory_bytes: 256
n = int(input())
ac = 0
wa = 0
tle = 0
re = 0
for i in range(n):
	p = input()
	ac += (p == "AC")
	wa += (p == "WA")
	tle += (p == "TLE")
	re += (p == "RE")
print("AC x", ac)
print("WA x", wa)
print("TLE x", tle)
print("RE x", re)


Measured memory_bytes: 69940
import bisect
N = int(input())
MOD = pow(10,9)+7
C = []
dic = {}
for i in range(N):
  temp = int(input())
  C.append(temp)
  if temp not in dic:
    dic[temp] = [i]
  else:
    dic[temp].append(i)  
#print(C)
#print(dic)
dp = [0 for _ in range(N)]
dp[0] = 1
for i in range(N):
  #print(dp)
  if i>= 1 and C[i] == C[i-1]:
    dp[i] = dp[i-1]
    continue
  if i >= 1:
    dp[i] += dp[i-1]%MOD
  #print(dp,i)
  color = C[i]
  temp = bisect.bisect_left(dic[color],i)
  if temp == 0:
    continue
  loc = dic[color][temp-1]
  #print(i,temp,dp[loc])
  dp[i] += dp[loc]%MOD
print(dp[-1]%MOD)

Measured memory_bytes: 50544
#include<bits/stdc++.h>
using namespace std;
string a;
int dp[200001][27];

int f(int pos,char c){
	
	if(dp[pos][c-'a']!=0){
		return dp[pos][c-'a'];
	}
	
	if(pos==a.size()-1){
		if(c!=a[pos])
		return 1;
		else
		return a.size()+1;
	}
	
	
	if(c!=a[pos]){
		return dp[pos][c-'a']=f(pos+1,c);
	}
	else{
		int best=a.size()+1;
		for(int i=0;i<26;i++){
			best=min(best,f(pos+1,'a'+i));
		}
		return dp[pos][c-'a']=best+1;
	}
	
}

int main(){
cin>>a;

for(int i=0;i<26;i++){
	f(0,char('a'+i));
}
int cont=0;

while(cont<a.size()){
	int best=a.size()+1;
	char ans='a';
	
	
	for(int i=0;i<26;i++){
		if(dp[cont][i]<best){
			best=dp[cont][i];
			ans='a'+i;
			
		}
	
	}
	
	cout<<ans;
	
	if(best==1)
	break;
	
	while(a[cont]!=ans)
	cont++;
	
	cont++;
	
}

return 0;
}


Measured memory_bytes: 30980
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define ull unsigned ll
#define ioi exit(0);
 
#define f first
#define s second
 
#define inf (int)1e9 + 7
 
#define NFS ios_base :: sync_with_stdio(0), cin.tie(0), cout.tie(0);
 
#define mp(x,y) make_pair(x,y)
 
#define lb(x) lower_bound(x)
#define ub(x) upper_bound(x)
 
#define pb push_back
#define ppb pop_back
 
#define bitcoin __builtin_popcount
 
#define endl "\n"
 
#define in(x) insert(x)
 
#define sz(x) (int)x.size()
 
#define all(x) x.begin(),x.end()
 
#define pw2(x) (1ll<<x) //2^x
 
#define forit(it,v) for (typeof(v.begin()) it = v.begin(); it != v.end(); ++it)
 
#define sqr(x) ((x) * 1ll * (x))
 
#define UpdateRandom srand (time(NULL));
 
using namespace std;
 
const int N = (int)5e5 + 7, MOD = (int)1e9 + 7;

int n;
int a[N],b[N],c[N];
int dp[N][10];

int main(){
		
	NFS
	
	cin >> n;
	
	for(int i=1;i<=n;i++){
		cin >> a[i] >> b[i] >> c[i];
	}
	
	for(int i=1;i<=n;i++){
		dp[i][1]=max(dp[i-1][2],dp[i-1][3])+a[i];
		dp[i][2]=max(dp[i-1][1],dp[i-1][3])+b[i];
		dp[i][3]=max(dp[i-1][1],dp[i-1][2])+c[i];
	}
	
	cout << max(dp[n][1],max(dp[n][2],dp[n][3])) << endl;

	ioi
}

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

//Made with <3 by MinumCoklatPanas
typedef long long ll;
const int INF = 1e9;
const ll INFF = 1e18;
const int MAXN = 510;
const int MOD = 1e9 + 7;
const double PI = acos(-1.0);
const double INFD = 1E9;
const double EPS = 1e-9;

int tab[110];

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin >> n;
    for (int i = 1 ; i <= n ; i++)
        cin >> tab[i];
    int ans = 0;
    for (int i = 1 ; i <= n ; i++)
        for (int j = i + 1 ; j <= n ; j++)
            for (int k = j + 1 ; k <= n ; k++)
            {
                if (tab[i] != tab[j] && tab[i] != tab[k] && tab[j] != tab[k])
                {
                    bool can = 1;
                    can &= (tab[i] + tab[j] > tab[k]);
                    can &= (tab[i] + tab[k] > tab[j]);
                    can &= (tab[j] + tab[k] > tab[i]);
                    ans += can;
                }
            }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3624
N, K = map(int, input().split())
h = [int(input()) for _ in range(N)]
h.sort()
m = float('inf')
for i in range(N-K+1):
  if h[i+K-1] - h[i] < m:
    m = h[i+K-1] - h[i]
print(m)


Measured memory_bytes: 50264
#include <bits/stdc++.h>
#define repp(i,l,r)for(long long i=(l);i<(r);i++)
#define rep(i,n) for (long long i = 0; i < (n); ++i)
#define per(i,n) for (long long i = (n); i >= 0; --i)
const int INF = 2147483647;//int max
const long long int MOD = 1000000007;
using namespace std;
using ll = long long;
using P = pair<int,int>;
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;
    vector<ll> a(n+1,0);
    repp(i,1,n+1){
        ll in;cin >> in;
        a[i] = a[i-1] + in;
    }
    unordered_map<ll,ll> m;
    for(auto i : a)m[i]++;
    ll res = 0;
    for(auto a : m)res += (a.second*(a.second-1))/2;
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 10056
#include<iostream>
#include<stdio.h>
using namespace std;

int main(){
	double k,t,r;
	cin>>r;
	
	k=r*r*3.141592653589;
	t=2*r*3.141592653589;
	printf ("%.6lf ",k);
	printf ("%.6lf",t);


	return 0;
}


Measured memory_bytes: 3184
#include <stdio.h>
#define N 2000000

int main() {
  int i, n, R[N], max, min;

  scanf("%d", &n);
  for (i = 0; i <  n; i++) {
    scanf("%d", &R[i]);
  }

  max = R[1] - R[0];
  min = R[0];
  for(i = 1; i < n; i++) {
    if(max < R[i] - min) max = R[i] - min;
    if(min > R[i]) min = R[i];
  }

  printf("%d\n", max);
  return 0;
}

Measured memory_bytes: 2868