akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cstdio>
#include<cstring>
using namespace std;

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

int main()
{
    for(int i=1;i<=9;i++)for(int j=1;j<=9;j++) cout << i << "x" << j << "=" << i * j << endl;
    return 0;
}

Measured memory_bytes: 1116
#include "bits/stdc++.h"
using namespace std;

int main(){
  int N, K;
  cin >> N >> K;
  vector<int> stick;
  for(int i = 0; i < N; i++){
    int x;
    cin >> x;
    stick.push_back(x);
  }
  sort(stick.begin(), stick.end());
  reverse(stick.begin(), stick.end());
  int sum = 0;
  for(int i = 0; i < K; i++){
    sum += stick.at(i);
  }
  cout << sum << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	static int[] con = new int[6];
	static int[] price = new int[] {100,101,102,103,104,105};
	static int[] memo;

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int X = sc.nextInt();
		Main main = new Main();
		memo = new int[100105];
		if (main.DP(X, 0)) {
			System.out.println("1");
		} else {
			System.out.println("0");
		}

	}

	public boolean DP(int X,int sum) {
		if (memo[sum] == 1) {
			return false;
		}else {
			if (sum > X) {
				memo[sum] = 1;
				return false;
			}else if (sum == X ) {
				return true;
			}else {
				for (int i = 0; i < 6; i++) {
					if (con[i] < 1001) {
						con[i]++;
						if (DP(X, sum + price[i])) {
							return true;
						}
						con[i]--;
					}
				}
				memo[sum] = 1;
				return false;
			}
		}
	}
}

Measured memory_bytes: 36524
#include<stdio.h>
int main(){
	
	int d,b,c;
	int p,q,r;
	int s=0;
	int a[1000000];
	int i,temp,j;
	for(i=0;i<3;i++){
		
		scanf("%d",&a[i]);
		}
	
	for(i=0;i<3;i++){
		for(j=i;j<3;j++){
			if(a[i]>a[j]){
				temp=a[i];
				a[i]=a[j];
				a[j]=temp;
				}
			}
		}
		
		
	for(i=1;i<3;i++){
		p=a[i]-a[i-1];
		if(p<0)p*=-1;
		s=s+p;
		
		}
		printf("%d\n",s);
	return 0;
	}


Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <string>
#include <list>
#include <queue>
#include <algorithm>
#define rep(i, n) for(i = 0; i < (n); i++)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define MOD 1000000007
#define PI 3.14159265358979323846
#define INF 1 << 30

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

int main(void) {
	int num, i;
	cin >> num;
	num %= 1000;
	if (num == 0)
		num = 1000;
	cout << 1000 - num << "\n";
	return 0;
}

Measured memory_bytes: 3620
import sys
import math
def I():return int(sys.stdin.readline().replace("\n",""))
def I2():return map(float,sys.stdin.readline().replace("\n","").split())
def S():return str(sys.stdin.readline().replace("\n",""))
def L():return list(sys.stdin.readline().replace("\n",""))
def Intl():return [int(k) for k in sys.stdin.readline().replace("\n","").split()]
def Lx(k):return list(map(lambda x:int(x)*-k,sys.stdin.readline().replace("\n","").split()))


a,b = input().split()
b = b.replace(".","")
a = int(a)
b = list(b)
b = [int(i) for i in b]
ans = 0
for i in range(len(b)):
    if i == 0:
        ans += a*b[i]*100
    elif i == 1:
        ans += a*b[i]*10
    elif i == 2: 
        ans += a*b[i]
print(int(ans//100))

Measured memory_bytes: 9256
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <functional>
#include <utility>
#include <numeric>

using namespace std;

const int MAX_V = 300;
using Cap = int;
using Cost = int;

const int inf = 1e9;

class BM {
public:
    int V;
    vector<vector<int>> g;
    vector<int> match;
    vector<int> used;
    bool dfs(int v) {
        used[v] = true;
        for (int u : g[v]) {
            int w = match[u];
            if (w < 0 || (!used[w] && dfs(w))) {
                match[v] = u;
                match[u] = v;
                return true;
            }
        }
        return false;
    }

    BM(int v) : V(v), g(v), match(v), used(v) {}
    void ae(int u, int v) {
        g[u].emplace_back(v);
        g[v].emplace_back(u);
    }
    int mm() {
        int res = 0;
        fill(match.begin(), match.end(), -1);
        for (size_t v = 0; v < V; v++) {
            if (match[v] < 0) {
                fill(used.begin(), used.end(), 0);
                if (dfs(v)) res++;
            }
        }
        return res;
    }
};

int main() {
    int n, m;
    while (cin >> n >> m && n) {
        int x1[110], y1[110], v[110];
        int x2[110], y2[110];

        for (size_t i = 0; i < n; i++) {
            cin >> x1[i] >> y1[i] >> v[i];
        }
        for (size_t i = 0; i < m; i++) {
            cin >> x2[i] >> y2[i];
        }

        double lb = 0, ub = 1e9;
        for (size_t i = 0; i < 70; i++) {
            double mid = (lb + ub) / 2;
            BM bm(n + m + 2);
            for (size_t i = 0; i < n; i++) {
                for (size_t j = 0; j < m; j++) {
                    double dx = x1[i] - x2[j];
                    double dy = y1[i] - y2[j];
                    double d = sqrt(dx*dx + dy*dy) / v[i];
                    if (d <= mid) {
                        bm.ae(i, j + n);
                    }
                }
            }

            if (bm.mm() == m) {
                ub = mid;
            } else {
                lb = mid;
            }
        }
        printf("%.10lf\n", ub);
    }

}

Measured memory_bytes: 3416
# Aizu Problem ALDS_1_2_A: Bubble Sort
#
import sys, math, os

# read input:
PYDEV = os.environ.get('PYDEV')
if PYDEV=="True":
    sys.stdin = open("sample-input2.txt", "rt")


def printA(A):
    print(' '.join([str(a) for a in A]))

def bubble_sort(A):
    swaps = 0
    for i in range(len(A) - 1):
        for j in range(len(A) - 1, i, -1):
            if A[j] < A[j - 1]:
                swaps += 1
                A[j], A[j - 1] = A[j - 1], A[j]
    return A, swaps

        
N = int(input())
A = [int(_) for _ in input().split()]
A, swaps = bubble_sort(A)
printA(A)
print(swaps)

Measured memory_bytes: 7808
#include <iostream>
#include <vector>
#include <string>
#include <bitset>
#include <cmath>
#include <iomanip>
#include <stack>
#include <queue>
#include <algorithm>
#include <deque>
using namespace std;

#define INF 1e18
#define int long long

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

    int diff = INF;
    for(int i = 0; i < n; i++) {
        int s1 = 0;
        int s2 = 0;
        for(int j = 0 ; j <= i; j++) {
            s1 += w[j];
        }
        for(int k = i + 1; k < n; k++) {
            s2 += w[k];
        }
        diff = min(diff, abs(s1 - s2));
    }

    cout << diff << endl;
    return 0;
}


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

S = []
for i in range(N):
  S.append(str(input()))


M = int(input())

T = []
for i in range(M):
  T.append(str(input()))

ans = 0
for s in S:
  S_count = S.count(s)
  T_count = T.count(s)
  ans = max(ans,S_count - T_count)

print(ans)




Measured memory_bytes: 3060
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>
#define REP(i,n) for(i=0;i<(int)(n);++i)
#define SIZE 3010//文字列の長さの最大値
int i,j;//for文の添字

int max(int a,int b){//a,bのうち大きい方を返す
    if(a>b)return a;
    else return b;
}

int main(){
    //変数の初期化
    char s1[SIZE],s2[SIZE];
    int ls1=0,ls2=0;
    int dp[SIZE][SIZE]={};
    char res[SIZE];
    int lcslen;
    int ms1,ms2;
    int cnt = 0;
    memset(res,'\0',SIZE);
    //入力処理
    fgets(s1,SIZE,stdin);
    fgets(s2,SIZE,stdin);

    ls1 = strlen(s1);
    ls2 = strlen(s2);
    //動的計画法
    REP(i,ls1){
        REP(j,ls2){
            if(i==0||j==0){
                dp[i][j]=0;
            }else{
                if(s1[i-1]==s2[j-1]){
                    dp[i][j]=dp[i-1][j-1]+1;
                }else{
                    dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
                }
            }
        }
    }
    //動的計画法の復元
    lcslen = dp[ls1-1][ls2-1];
    ms1=ls1-1;
    ms2=ls2-1;
    cnt = lcslen-1;
    while(dp[ms1][ms2]!=0){
        if(s1[ms1-1]==s2[ms2-1]){
            res[cnt--] = s1[ms1-1];
            ms1--;
            ms2--;
        }else if(dp[ms1-1][ms2]>=dp[ms1][ms2-1]){
            ms1--;
        }else{
            ms2--;
        }
    }
    //出力処理
    printf("%s\n",res);
    return 0;
}

Measured memory_bytes: 35584
def no():
    print("No")
    exit()

n, a, b, c, d = map(int, input().split())
s = list(input())
for i in range(a - 1, c - 1):
    if s[i] == s[i + 1] == "#":
        no()
for i in range(b - 1, d - 1):
    if s[i] == s[i + 1] == "#":
        no()
if c > d:
    t = 0
    for i in range(b - 2, d - 1):
        if s[i] == s[i + 1] == s[i + 2] == ".":
            t = 1
    if t == 0:
        no()
print("Yes")

Measured memory_bytes: 4916
#include<stdio.h>
int main(void){
  int b,f,r,v,n,i=0;
  int ryo[5][4][11]={0};
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d%d%d%d",&b,&f,&r,&v);
  ryo[b][f][r]+=v;
  }
  b,f,r=1;
  for(b=1;b<5;b++){
    if(f==4){
puts("\n####################");
 r=1;
    }
  for(f=1;f<4;f++){
    if(r==11){
      puts("");
    }
  for(r=1;r<11;r++){
    printf(" %d",ryo[b][f][r]);
  }
  }
  }
  puts("");
  return 0;
}



Measured memory_bytes: 2104
#include <iostream>
#include <cmath>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
#include <set>
using namespace std;
#define MOD 1000000007
#define INF 1<<30
#define LINF (ll)1<<62
#define rep(i,n) for(ll i=0; i<(n); i++)
#define REP(i,a,b) for(ll i=(a); i<(b); i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll, ll> P;
typedef vector<pair<ll, ll>> vpl;


int main(){
    ll n; cin >> n;
    vl p(n);
    ll sw;
    int flag = 0;
    rep(i,n) cin >> p[i];
    rep(i,n-1){
        if(p[i] > p[i+1]){
            if(flag == 0){
                sw = i;
                flag = 1;
            }else if(flag == 1){
                swap(p[sw], p[i+1]);
                flag = 2;
            }else{
                cout << "NO" << endl;
                return 0;
            }
        }
    }

    rep(i,n-1){
        if(p[i]>p[i+1]){
            cout << "NO" << endl;
            return 0;
        }
    }
    cout << "YES" << endl;
}

Measured memory_bytes: 256
N = input()
An = [int(i) for i in input().split()]
isOdd = False
count = 0
while True:
    for num in An:
        if num % 2 == 1:
            isOdd = True
    if isOdd == False:
        for num in An:
            An[An.index(num)]  = int(num/2)
        count += 1
    else:
        break
print(count)


Measured memory_bytes: 3060
#include<iostream>
#include <algorithm>
#include <vector>
#include <string>
using namespace std;
int main()
{
    int n;
    cin >> n;

    vector<float> v;
    v.reserve(n); 
    for(int i=0;i<n;i++){
        float tmp = 0;
        cin >> tmp;
        v.push_back(tmp);
    }

    sort(v.begin(), v.end());

    float tmp = v[0];
    for(int i=1;i<n;i++){
        tmp = (tmp + v[i]) / 2;
    }
    cout << tmp << endl;
    return 0;
}

Measured memory_bytes: 256
include Math
x,y = 0,0
angle=90                #??????90???(PI/2rad.),??±???0?????¨??????

while buf = gets
        d,c = buf.split(',').map(&:to_f)
        break if buf.chomp=="0,0"
#p angle
        x+=(cos(angle*PI/180.0)*d)
#puts("x=#{x}")
        y+=(sin(angle*PI/180.0)*d)

        angle+=c
end

puts x.to_i*-1,y.to_i

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

int main() {
	int a,b,c,d;
	cin >> a >> b >> c >> d;
	
	int atoc = c - a;
	int atob = b-a;
	int btoc = c - b;
	
	atoc = abs(atoc);
	atob = abs(atob);
	btoc = abs(btoc);
	
	if(atoc <= d) cout << "Yes";
	else if(atob<=d && btoc < d) cout << "Yes";
	else cout << "No";
	
	cout << endl;

	return 0;
}

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

#define REP(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define RREP(i,n) for(int (i)=(int)(n)-1;i>=0;i--)
#define REMOVE(Itr,n) (Itr).erase(remove((Itr).begin(),(Itr).end(),n),(Itr).end())
typedef long long ll;

ll cnt[100010];

int main() {

   REP(i,100010) cnt[i] = 0;

   ll N,K; cin >> N >> K;
   set<ll> aa;
   REP(i,N) {
      ll a,b; cin >> a >> b;
      cnt[a] += b;
      aa.insert(a);
   }

   ll sum = 0;
   for(auto itr=aa.begin();itr!=aa.end();itr++) {
      sum += cnt[*itr];
      if(sum >= K) {
         cout << *itr << endl;
         return 0;
      }
   }

   return 0;
}


Measured memory_bytes: 3968
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <unordered_map>
#include <unordered_set>
#include <cstring>
#include <climits>
#define mk make_pair
#define pb push_back
#define scanf scanf_s
#define printf printf_s
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef pair<ll, ll> pos;
const ll N = 60, MOD = 1000000007;

ll mn(ll a, ll b) {
	if (a == -1)return b;
	if (b == -1)return a;
	return min(a, b);
}

int bb(int v1) {
	if (v1 % 2 == 0)return v1 / 2 - 1;
	else return v1 / 2;
}

ll pw(ll a, ll b) {
	ll v = 1;
	for (; b > 0; b = (b >> 1), a = (a * a) % MOD) {
		if ((b & 1) > 0)v = (v * a) % MOD;
	}
	return v;
}
ll n, m, s;
pos cd[N];
vector<pair<int, pos> > g[N];
ll dp[N][(50 * 50 + 2)],vs[N][(50 * 50 + 2)];

int main() {
	cin >> n >> m >> s;
	while (m--) {
		int v1, v2, v3, v4; 
		cin >> v1 >> v2 >> v3 >> v4;
		g[v1].pb(mk(v2, mk(v3, v4)));
		g[v2].pb(mk(v1, mk(v3, v4)));
	}
	for (int i = 1; i <= n; i++)cin >> cd[i].first >> cd[i].second;
	for (int t = 2; t <= n; t++) {
		memset(dp, -1, sizeof(dp));
		memset(vs, false, sizeof(vs));
		priority_queue < pair<ll, pair<int, int> > > q;
		q.push(mk(0, mk(min(s, (ll)2501), 1)));
		while (!q.empty()) {
			if (q.top().second.second == t)
			{ cout << -q.top().first << endl; break; }
			ll v1 = -q.top().first;
			int v2 = q.top().second.first, v3 = q.top().second.second;
			q.pop();
			if (vs[v3][v2] )continue;
			dp[v3][v2] = v1;
			vs[v3][v2] = true;
			for (int i = 1;; i++) {
				ll v23 = min(v2 + cd[v3].first * i,(ll)2501),nv1= cd[v3].second * i + v1;
				if (dp[v3][v23] != -1&&dp[v3][v23]<=nv1)break;
				dp[v3][v23] = nv1;
				q.push(mk(-nv1, mk(v23, v3)));
				if (v2 + cd[v3].first * i >= 2501)break;
			}

			for (int i = 0; i < g[v3].size(); i++) {
				if (v2 - g[v3][i].second.first < 0)continue;
				ll ni = g[v3][i].first,nv1=v1+g[v3][i].second.second,nv2= v2 - g[v3][i].second.first;
				if (dp[ni][nv2] != -1&&dp[ni][nv2]<=nv1)continue;
				q.push(mk(-nv1, mk(nv2, ni)));
				dp[ni][nv2] = nv1;
			}
		}
	}
	return 0;
}


Measured memory_bytes: 12692
#define _GLIBCXX_DEBUG //エラーを出すためのおまじない
#include <bits/stdc++.h>
//#include <cstdlib>  // abs() for integer
#include <cmath>    // abs() for float, and fabs()
#include <math.h>
using namespace std;
#define coYES cout << "YES" << endl
#define coNO cout << "NO" << endl
#define coYes cout << "Yes" << endl
#define coNo cout << "No" << endl
#define coyes cout << "yes" << endl
#define cono cout << "no" << endl
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
  int n;
  cin >> n;
  vector<int> a(3*n);
  rep(i, 3*n) {
    int num;
    cin >> num;
    a.at(i) = num;
  }
  int64_t sum = 0;
  sort(a.begin(), a.end());
  reverse(a.begin(), a.end());
  int count = 1;
  rep(i, n) {
    sum += a.at(count);
    count += 2;
  }
  cout << sum << endl;
}


Measured memory_bytes: 4520
import "dart:io";

void main(List<String> args) {
  int n = int.parse(stdin.readLineSync());
  int sum = 0;

  for (var i = 1; i <= n; i++) {
    if (i%3 != 0 && i%5 != 0) sum += i;
  }

  print(sum);
}

Measured memory_bytes: 13128
#include <iostream>
#define INF 1e+18
#define int long long
using namespace std;

signed main(){
	int n,x,a[4000],mi[2000],res = INF;
	cin >> n >> x;
	for(int i = 0;i < n;i++){
		cin >> a[i];
		mi[i] = a[i];
		a[i + n] = a[i];
	}
	for(int i = 0;i < n;i++){
		int sum = x * i;
		for(int j = 0;j < n;j++) sum += mi[j];
		res = min(res,sum);
		for(int j = 0;j < n;j++){
			mi[j] = min(mi[j],a[j + n - i - 1]);
		}
	}
	cout << res << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n;
long long s,g,a[100005],x[100005];
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;++i){
		scanf("%lld",&a[i]);
		s+=a[i];
		a[i]<<=1;
	}
	for(int i=1;i<n;i+=2){
		g+=a[i];
	}
	x[n]=s-g;
	for(int i=n-1;i;i--){
		x[i]=a[i]-x[i+1];
	}
	for(int i=1;i<=n;++i)printf("%lld ",x[i]);
}

Measured memory_bytes: 2816
#include<bits/stdc++.h>
#define PI 3.1415926535
using namespace std;
int n, m;
int a, b, c;
int d[3];
int x ,y, w, h, r;
int p = 1;
int cnt = 0;
int main(){
    char t;
    while (scanf("%d %c %d", &n, &t, &m)){
        if(t == '?') break;
        else if(t == '+') printf("%d\n", n+m);
        else if(t == '-') printf("%d\n", n-m);
        else if(t == '*') printf("%d\n", n*m);
        else if(t == '/') printf("%d\n", n/m);
     }

    return 0;
}


Measured memory_bytes: 3240
#include <iostream>
using namespace std;
int main()
{
	int A, B;
	cin >> A >> B;
	int res = 0;
	if(A > B)
	{
		res += A--;
	}
	else
	{
		res += B--;
	}
	if(A > B)
	{
		res += A--;
	}
	else
	{
		res += B--;
	}
	cout << res << endl;
	return 0;
}


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

using namespace std;

int main() {
	const Int INF = 1e9 + 10;
	int N;
	cin >> N;
	vector<pair<Int, Int>> LR;
	for (int i = 0; i < N; ++i) {
		Int L, R;
		cin >> L >> R;
		LR.emplace_back(L, R);
	}
	sort(LR.begin(), LR.end());

	vector<Int> dl(N, 0), dr(N, 0);
	Int min_R = INF;
	for (int i = 0; i < N; ++i) {
		min_R = min(min_R, LR[i].second);
		dl[i] = max(dl[i], min_R - LR[i].first + 1);
	}
	min_R = 1e9 + 10;
	for (int i = N - 1; i >= 0; --i) {
		min_R = min(min_R, LR[i].second);
		dr[i] = max(dr[i], min_R - LR.back().first + 1);
	}

	Int ans = max(dl.back(), dr[0]);
	for (int i = 0; i + 1 < N; ++i) {
		ans = max(ans, dl[i] + dr[i + 1]);
	}

	multiset<Int> sL, sR;
	for (int i = 0; i < N; ++i) {
		sL.insert(-LR[i].first);
		sR.insert(LR[i].second);
	}
	for (int i = 0; i < N; ++i) {
		Int L = LR[i].first, R = LR[i].second;
		Int tmp = R - L + 1;
		sL.erase(sL.lower_bound(-L));
		sR.erase(sR.lower_bound(R));
		tmp += max(Int(0), *sR.lower_bound(0) + *sL.lower_bound(-INF) + 1);
		ans = max(ans, tmp);
		
		sL.insert(-L);
		sR.insert(R);
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 12784
si = lambda: input()
ni = lambda: int(input())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))
s=input()
cur=s[0]
counter=1
for i,ss in enumerate(s):
    if i==0:
        continue
    if ss!=cur:
        counter+=1
        cur=ss
print(counter-1)

Measured memory_bytes: 3188
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<string>
#include<cstring>
#include<algorithm>
#include<functional>
#include<vector>
#include<map>

using namespace std;
#define endl '\n'
#define pb push_back
#define fst first
#define scd second
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define MOD (1e9 + 7)
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define REP(i,n) for(int i = 0;i < (n);i++)
#define FOR(i,a,b) for(int i = (a);i <= (b);i++)
#define YES(n) cout << ((n) ? "YES" : "NO" ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No" ) << endl


typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<vector<int>> vii;

template <class T = int> T in() { T x; cin >> x; return (x); }
template <class T = int> void out(T x) { cout << (x) << endl; }

int gcd(int a, int b) { return b ? gcd(b, a%b) : a; }

void solve() {

	int r = in();

	if (r >= 2800) {
		out<string>("AGC");
		return;
	}
	if (r >= 1200) {
		out<string>("ARC");
		return;
	}

	out<string>("ABC");

	return;

}

int main() {

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

	solve();

	return 0;

}

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

// typedef
// -----------------------------------------------------------------------------
typedef long long ll;
typedef long double ld;

// container util
// -----------------------------------------------------------------------------
#define ALL(c)  (c).begin(),(c).end()
#define SZ(c) ((ll)(c).size())
#define MAX(c) *max_element(ALL(c))
#define MIN(c) *min_element(ALL(c))
#define SORT(c) sort((c).begin(),(c).end())

// repetition
// -----------------------------------------------------------------------------
#define FOR(i, a, b) for(int i= (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)

// constant
// -----------------------------------------------------------------------------
const int INF = 1e9;
const int MOD = 1e9 + 7;
const double EPS = 1e-9;
const double PI = acos(-1.0);

// debug
// -----------------------------------------------------------------------------
#define DUMP(x)  cerr << #x << " = " << (x) << endl


int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(15);
    vector<int> A(11, 0); 
    REP(i, 3) {
        int j; cin >> j;
        A[j]++;
    }
    if(A[5] == 2 && A[7] == 1) {
        cout << "YES" << "\n";
    } else {
        cout << "NO" << "\n";
    }
}

Measured memory_bytes: 3608
#include<bits/stdc++.h>
using namespace std;
int N, a[55];
int main(){
	cin>>N;
	for(int i = 1;i <= N; i++)cin>>a[i];
	int t = 0;
	for(int i = 1;i <= N; i++){
		if(a[i] != i)t++;
	}
	if(t > 2)puts("NO");
	else puts("YES");
	return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#define INF 0x3f3f3f3f
#include <cstdio>
#include <iostream>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>
#include <cctype>
#include <utility>

using namespace std;

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

int tx[] = {0,1,0,-1};
int ty[] = {-1,0,1,0};

static const double EPS = 1e-8;

int main(){

	int n,k,m;

	while(~scanf("%d %d %d",&n,&k,&m)){
		if(n==0) break;

		vector<int> nums;
		for(int i=1;i<=n;i++){
			nums.push_back(i);
		}

		int pos = m-1;

		while(nums.size() > 1){
			nums.erase(nums.begin()+pos);
			pos--;
			pos = (pos + k) % nums.size();
		}

		printf("%d\n",nums[0]);
	}
}

Measured memory_bytes: 1316
import sys
import queue

#+++++

def sa(v, p):
	return v //p, v %p

def ggg(value, p_list, ctv):
	dd=p_list[:]
	#print('gfg',dd)
	if len(dd)==0:
		return None
	a=dd.pop(0)
	if a > value:
		return None
	
	m,p=sa(value, a)
	if p == 0:
		aa= [max(ctv[a])]*(m)
		return aa
	else:
		best_st=None
		for i in range(min(m+1,6)):
			nokori=p+i*a
			ret=bbb(nokori, ctv)
			if ret is not None:
				aa= [max(ctv[a])]*(m-i)
				st=ret+aa
				if is_big(st, best_st):
					best_st=st
				
		return best_st

def bbb(value, ctv):
	ol=queue.PriorityQueue()
	kk_costs=ctv.keys()
	
	best_st=None
	
	cc=0
	st=[]
	ol.put((cc,(cc, st)))
	while not ol.empty():
		scc, (cc, st) = ol.get()
		#pa((scc,cc,st))
		if scc > value:
			return best_st
			
		if scc == value:
			if is_big(st, best_st):
				best_st=st
			continue
				
		for cost in kk_costs:
			tst=st[:]
			tst.append(max(ctv[cost]))
			ol.put((cc+cost, (cc+cost, tst)))
	return None
	
def is_big(base, other):
	if other is None:
		return True
	if base is None:
		return False
		
	if len(base) != len(other):
		return len(base) > len(other)
	return base > other


def mk_value(a_ll):
	if a_ll is None:
		return 0
		
	a_ll.sort(reverse=True)
	a_ll2=[str(v) for v in a_ll]
	ans=''.join(a_ll2)
	return ans
	
def main():
	n , _ = map(int, input().split())
	al = list(map(int, input().split())	)
	
	cost_list=[1000, 2,5,5,4,5,6,3,7,6]
	
	aal=[(v, cost_list[v]) for v in al]
	aal.sort(key=lambda x:-x[0])
	ctv={}
	for v in aal:
		ctv.setdefault(v[1], []).append(v[0])
	
	#for kk in ctv.keys():
	#	pa((kk,':',ctv[kk]))
	aal=list(ctv.keys())
	aal.sort()
	
	ccc = ggg(n, aal, ctv)
	ans=mk_value(ccc)
	
	print(ans)
	
	
#+++++
isTest=False

def pa(v):
	if isTest:
		print(v)

if __name__ == "__main__":
	if sys.platform =='ios':
		sys.stdin=open('inputFile.txt')
		isTest=True
	else:
		pass
		#input = sys.stdin.readline
			
	ret = main()
	if ret is not None:
		print(ret)

Measured memory_bytes: 4336
#include <algorithm>
#include <iostream>
#define MAX_N 100000
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;

int gcd(int m, int n) {
  int tmp;
  while (m % n != 0) {
    tmp = n;
    n = m % n;
    m = tmp;
  }
  return n;
}

int main(void) {
  int N, X;
  cin >> N >> X;
  int x[MAX_N + 1];
  rep(i, N) { cin >> x[i]; }
  x[N] = X;
  sort(x, x + N + 1);
  int y[MAX_N];
  rep(i, N) { y[i] = abs(x[i] - x[i + 1]); }

  int Ans = y[0];
  for (int i = 1; i < N; i++) {
    Ans = gcd(Ans, y[i]);
  }
  cout << Ans << endl;
  return 0;
}

Measured memory_bytes: 1024
from math import atan, degrees

def d():
    a, b, x = map(int, input().split())
    vol = a * a * b
    if vol / 2 < x:
        print(degrees(atan(2 * (a * a * b - x) / a ** 3)))
    elif vol / 2 == x:
        print(degrees(atan(a * a * a / 2 / x)))
    else:
        print(degrees(atan(a * b * b / 2 / x)))


if __name__ == '__main__':
    d()

Measured memory_bytes: 38256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.*;

public class Main {
    // static int INF = (1 << 30) - 1;
    // static long L_INF = (1L << 62) - 1;
    static long MOD = (long) 1e9 + 7;

    static class Solver {
        long m, n;

        // 繰り返し二乗法 (O(logn))
        long modPow(long x, long n) {
            long res = 1;
            while (n > 0) {
                if ((n & 1) > 0) {
                    res = res * x % MOD;
                }
                x = x * x % MOD;
                n >>= 1;
            }
            return res;
        }

        // write your code
        void solve(InputReader in, PrintWriter out) {
            m = in.nextLong();
            n = in.nextLong();
            out.println(modPow(m, n));
        }

        void debug(Object... os) {
            System.err.println(Arrays.deepToString(os));
        }
    }

    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Solver solver = new Solver();
        solver.solve(in, out);
        out.close();
    }

    static class InputReader {
        BufferedReader reader;
        StringTokenizer tokenizer;

        InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

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

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



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

using namespace __gnu_pbds;
using namespace std;

#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
// order_of_key (val): returns the no. of values less than val
// find_by_order (k): returns the kth largest element.(0-based)

#define ll long long int
#define ld long double
#define ff first
#define ss second
#define pb push_back
#define pi pair<ll,ll>
#define pii pair<ll,pi >
#define ppi pair<pi,ll>
#define ppp pair<pi,pi >
#define ex(str,a,b) str.substr((int)(a),min((int)str.size()-a,(int)(b-a+1))) 
#define all(X) X.begin(),X.end()
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

// for pair comparison function(ascending order) use return (i1.ff < i2.ff);

/* string operations :
   str.substr (x,y) : returns a substring str[x],str[x+1],...str[x+y-1]
   __builtin_popcount(n) : no. of set bits in n.
*/

const int M = (1<<20)+5;
const int md = 1e9+7;

priority_queue<ll,vector<ll >,greater<ll > > pq;

ll pwr(ll a,ll n,ll m)
{
	ll p=1;
	while(n>0)
	{
		if(n%2==1)
			p=(p*a)%m;
		a=(a*a)%m;
		n=n/2;
	}
	return p;
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	ll i,t;
	for(i=1;i<=5;++i)
	{
		cin >> t;
		if(t == 0)
		{
			cout << i << endl;
			return 0;
		}
	}
}

Measured memory_bytes: 3604
N, M = map(int, input().split())
X=[]
for i in range(M):
    X.append(list(map(int, input().split())))
P=list(map(int, input().split()))
ans=0

key='{:0'+str(N)+"b}"
for k in range(2**N):
    
    switch=list(key.format(k))
    for i in range(M):
        odd=1
        even=0
        if P[i]==1:
            odd=0
            for j in range(X[i][0]):
                odd+=int(switch[ X[i][j+1]-1] )
            if odd%2==0:
                break
            
        else:
            even=0
            for j in range(X[i][0]):
                even+=int(switch[ X[i][j+1]-1] )
            if even%2==1:
                break
    
    if odd%2==1 and even%2==0:
        ans+=1
        #print(X[i],switch,odd,even)
            
print(ans)






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

int main(){
  int n;
  cin >> n;
  vector<int> v(n),c(n);
  for(auto& x:v)
    cin >> x;
  for(auto& x:c)
    cin >> x;
  int ans=0;
  for(int i=0;i<n;i++)
    ans += max(0,v.at(i)-c.at(i));
  cout << ans << endl;
}

Measured memory_bytes: 256
N = int(input())
B = list(map(int, input().split()))
A = [(B[i], i) for i in range(N)]

A.sort(key = lambda x: x[0], reverse = True)

A.append((0, 0))

ans = [0] * N
tmp = N + 1
count = 1
for index, a in enumerate(A[:-1]):
    tmp = min(tmp, a[1])
    ans[tmp] += count * (a[0] - A[index + 1][0])
    count += 1

print (*ans, sep = '\n')

# print (A)


Measured memory_bytes: 23816
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<vvll> vvvll;
typedef vector<string> vstr;
typedef pair<ll, ll> pll;
typedef vector<pll> vp;
typedef map<ll, ll> mll;
typedef map<string, ll> mstrll;
#define pb push_back
#define mp make_pair
#define fir first
#define sec second
#define maxs(x, y) (x = max(x, y))
#define mins(x, y) (x = min(x, y))
#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for(ll i = ll(a); i < ll(b); i++)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep,)(__VA_ARGS__)
#define each(i, n) for(auto&& i: n)
#define out(x) cout << (x)
#define indent() cout << '\n'
#define print(x) cout << (x) << '\n'
#define debug(x) cerr << #x << ": " << (x) << '\n'
ll gcd(ll a, ll b){return b != 0 ? gcd(b, a % b) : a;}
ll lcm(ll a, ll b){return a / gcd(a, b) * b;}
ll factorial(ll a){return a < 2 ? 1 : factorial(a - 1) * a;}
ll summation(ll a){return a < 1 ? 0 : (a * a + a) / 2;}
const ll INF = 1e16;
const ll MOD = 1e9 + 7;
const string ALPHABETS = "abcdefghijklmnopqrstuvwxyz";
ll dx[] = {-1, 0, 1, 0}, dy[] = {0, -1, 0, 1};
//ll dx[] = {-1, 0, 1, -1, 1, -1, 0, 1}, dy[] = {-1, -1, -1, 0, 0, 1, 1, 1};
ll n, m, x, y, z, w, h;
string s, t;

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    while(cin >> x >> y){
        ll ans = abs(abs(x) - abs(y)), tmp = 0, cnt = 0, mx = -INF, mn = INF;
        ll a[] = {}, b[] = {}, c[] = {};
        vll v;
        if(ans == 0){
            if(x == y){
                print(0);
            }else{
                print(1);
            }
        }else if(x == 0){
            if(y > 0){
                print(ans);
            }else{
                print(ans + 1);
            }
        }else if(y == 0){
            if(x < 0){
                print(ans);
            }else{
                print(ans + 1);
            }
        }else if(x > y){
            if(x > 0 == y > 0){
                print(ans + 2);
            }else{
                print(ans + 1);
            }
        }else if(x > 0 != y > 0){
            print(ans + 1);
        }else{
            print(ans);
        }
    }
}


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

using namespace std;

int main()
{
  int R0, W0, C, R;
  while(cin >> R0 >> W0 >> C >> R, R0) {
    cout << max(0, (C * W0 - R0 + R - 1) / R) << endl;
  }
}

Measured memory_bytes: 2996
#include <iostream>
#include <vector>
#include <numeric>
#include <algorithm>
#include <cstring>
#include <map>
#include <set>
#include <cmath>
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define INF 1145141919
typedef long long int ll;
using namespace std;

template <typename T>
istream &operator>>(istream &is, vector<T> &vec)
{
    for (T &x : vec)
        is >> x;
    return is;
}

ll gcd(ll m, ll n)
{
    if ((0 == m) || (0 == n))
        return 0;
    while (m != n)
    {
        if (m > n)
            m = m - n;
        else
            n = n - m;
    }
    return m;
}

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

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

    vector<ll> X(M);
    REP(i,M){
        cin >> X[i];
    }

    sort(X.begin(), X.end());

    /*REP(i,M){
        cout << X[i] << endl;
    }

    cout << "diff are " << endl;*/

    vector<ll> diff(M-1);
    REP(i,M-1){
        diff[i] = abs(X[i+1]-X[i]);
    }

    sort(diff.begin(), diff.end());

    ll ans = 0;

    REP(i,M-N){
        ans += diff[i];
    }

    cout << ans << endl;

    return 0;
}

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

int main(){

    string s,r,l;
    cin>>s;
    int size=(s.size()-1)/2;
    r=s.substr(0,size);
    l=s.substr(size+1,size);

    string rs=s,rr=r,rl=l;
    reverse(rs.begin(),rs.end());
    reverse(rr.begin(),rr.end());
    reverse(rl.begin(),rl.end());

    if(s==rs&&r==rr&&l==rl) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;






    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
template<class T> ostream& operator<<(ostream &os, vector<T> V) {
os << "[ "; for(auto v : V) os << v << " "; return os << "]";}
template<class L, class R> ostream& operator<<(ostream &os, pair<L,R> P) {
    return os << "(" << P.first << "," << P.second << ")";}

// #define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cout << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...) 1
#endif
typedef long long ll;
typedef double ld;
#define pll pair<ll,ll>
#define pb push_back
#define mp(x, y) make_pair((x), (y))
#define F first
#define S second
#define I insert
#define vll vector<ll>
#define vpll vector<pll>
#define all(x) (x).begin(), (x).end()
#define sz(x) (ll)(x).size()
   
const ll Mod = 1e9 + 7;
int main(){
   ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); 
   double a , b , t;
   cin >> a >> b >> t;
   int times = (t+0.5)/a;
   cout << (int)(b*times) << endl;
   return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,w,i,j;
    cin>>n>>w;
    vector<pair<int,int> > v;
    for(i=0;i<n;i++)
    {
        int a,b;
        cin>>a>>b;
        pair<int,int> p;
        p.first=a;
        p.second=b;
        v.push_back(p);
    }
    sort(v.begin(),v.end());
    long long int c[n+1][w+1]={};
    for(i=1;i<=n;i++)
    {
        for(j=1;j<=w;j++)
        {
            if(j<v[i-1].first)
            {
                c[i][j]=c[i-1][j];
            }
            else
            {
                c[i][j]=max(c[i-1][j],v[i-1].second+c[i-1][j-v[i-1].first]);
            }
        }
    }
    cout<<c[n][w];
}


Measured memory_bytes: 79104
#include "bits/stdc++.h"
using namespace std;

// コンテスト中のみ
#define int long long

#define ll long long
#define rep(i,n) for(int i = 0; i < (n); i++)
#define P pair<ll,ll>
int MOD = 1000000007;
const ll INF = 1LL << 60;


signed main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	string s; cin >> s;
	int now = 0;
	int ans = 0;
	rep(i, 2) {
		if (s[i] =='R'&&s[i]==s[i+1]) {
			now++;
		}
		else {
			
			ans = max(ans, now);
			now = 0;
		}
	}
	ans = max(ans, now);
	if (s == "SSS") {
		ans = -1;
	}
	cout << ans + 1<< endl;
	return 0;
}

Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define sz(x) (int)(x.size())
#define fi first
#define se second
#define pii pair<int, int>

const int N = 110, V = 110100;
vector<int> w(N), v(N);
vector<vector<int>> dp(N, vector<int>(V, 1e14));
signed main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    int n, W;
    cin >> n >> W;
    for (int i = 1; i <= n; i++) {
        cin >> w[i] >> v[i];
    }
    for(int i = 0; i <= n; i++) {
        dp[i][0] = 0;
    }
    for (int i = 1; i <= n; i++) {
        for (int j = 0; j < V; j++) {
            dp[i][j] = dp[i - 1][j];
        }
        for (int j = V - v[i] - 1; j >= v[i]; j--) {
            dp[i][j] = min(dp[i][j], w[i] + dp[i][j - v[i]]);
        }
    }
    int ans = 0;
    for (int j = 0; j < V; j++) {
        if(dp[n][j] <= W) ans = j;
    }
    cout << ans << "\n";
}

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

    class Program
    {

        static void Main(string[] args)
        {
            ProblemA(args);
            //ProblemB(args);
            //ProblemC(args);
            //ProblemD(args);
            System.Console.ReadLine();
        }
static void ProblemA(string[] args)
        {
            int[] n = System.Console.ReadLine().Split(' ').Select((i) => int.Parse(i)).ToArray();
            int A = n[0];    // 3 <= A,B <=20
            int B = n[1];
            int ans = 0;
            for (int i = 0; i < 2; i++) { 
               if (A < B)
               {
                   ans += B;
                   B--;
               }
               else
               {
                   ans += A;
                   A--;
               }
            }

            System.Console.WriteLine(ans.ToString());
        }
	}

Measured memory_bytes: 11348
import java.util.HashSet;
import java.util.Scanner;

public class Main {
	public static void main(String args[]) {
		Scanner scan = new Scanner(System.in);
		int len = scan.nextInt();
		String str = scan.next();
		int ans = 0;
		for (int i = 0; i < len - 1; i++) {
			int temp = check(str.substring(0, i + 1), str.substring(i + 1, len));
			if (temp > ans) {
				ans = temp;
			}
		}
		System.out.println(ans);
	}

	public static int check(String tag1, String tag2) {
		int cnt = 0;
		HashSet<Character> set1 = new HashSet<>();
		HashSet<Character> set2 = new HashSet<>();
		for (int i = 0; i < tag1.length(); i++) {
			set1.add(tag1.charAt(i));
		}
		for (int i = 0; i < tag2.length(); i++) {
			set2.add(tag2.charAt(i));
		}
		for (char c : set1) {
			if (set2.contains(c)) {
				cnt++;
			}
		}
		return cnt;
	}
}

Measured memory_bytes: 22228
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<iostream>
#include<vector>
#include<queue>
#include<string>
#include<cstring>
#include<queue>
#include<map>
#include<set>
#include<stack>
using namespace std;
#define ll long long
#define ull unsigned long long
#define up(i,a,b) for(register int i=(a);i<=(b);i++)
#define down(i,a,b) for(register int i=(a);i>=(b);i--)
#define mem(x,y) memset(x,(y),sizeof x)
#define ff first
#define ss second
#define mp(x,y) make_pair(x,y)
#define pb(x) emplace_back(x)
#define sc(a) scanf("%d",&a)
#define scl(a) scanf("%lld",&a)
#define scs(a) scanf("%s",a)
#define pr(a,b) printf("%d%c",a,b)
#define prl(a,b) printf("%lld%c",a,b)
#define PQ priority_queue
#define ld long double
#define all(v) v.begin(),v.end()
#define IOS ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)

typedef pair<int,int> pii;
typedef map<int,int> mii;
typedef vector<int> V;

int main() {
	IOS;
	int n,m;cin>>n>>m;
	if(n<=5)cout<<0;
	else if(n<=12)cout<<m/2;
	else cout<<m;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.StringTokenizer;

class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Task solver = new Task();
        solver.solve(in, out);
        out.close();
    }

    static class Task {
    	int ans = Integer.MAX_VALUE;
    	
        void solve(InputReader in, PrintWriter out) {
        	Integer[] menu = {
        		in.nextInt(),
        		in.nextInt(),
        		in.nextInt(),
        		in.nextInt(),
        		in.nextInt()
        	};
        	PatternUtils<Integer> pt = new PatternUtils<>(Arrays.asList(menu));
        	
        	for (Object[] list : pt.permutation(5)) {
        		int fin = 0;
        		for (Object t : list) {
        			fin += (10 - fin % 10) % 10 + (Integer)t;
        		}
        		ans = Math.min(fin, ans);
        	}
        	
        	out.println(ans);
        }
    }
    
    static class PatternUtils<E> {
		private int[] indexes;
		private List<E> original;
		private List<Object[]> pattern;
		
		public PatternUtils(List<E> l) {
			this.original = l;
			this.indexes = new int[original.size()];
			for (int i = 0; i < original.size(); ++i) indexes[i] = i;
		}
		
		void search(int[] perm, Object[] items, int rem) {
			if (rem == 0 || perm.length == 0) {
				pattern.add(items);
			} else {
				int[] nperm = Arrays.copyOfRange(perm, 1, perm.length);
				
				int len = items.length + 1;
				Object[] nitems = Arrays.copyOfRange(items, 0, len);
 				for (int i = 0; i < perm.length; ++i) {
 					nitems[len - 1] = original.get(perm[i]);
					search(nperm, nitems, rem - 1);
					if (i < nperm.length) nperm[i] = perm[i];
				}
			}
		}
		
		List<Object[]> permutation(int n) {
			pattern = new ArrayList<>();
			
			search(indexes, new Object[0], n);
			
			return pattern;
		}
    }
    
    static class InputReader {
        BufferedReader reader;
        StringTokenizer tokenizer;

        InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream));
            tokenizer = null;
        }

        String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

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

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

        long[] nextLongArray(int n) {
        	long[] arr = new long[n];
        	for (int i = 0; i < n; ++i) {
        		arr[i] = nextLong();
        	}
        	return arr;
        }
    }
}


Measured memory_bytes: 21460
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int mod=1e9+7,inv2=(mod+1)/2;
ll f[3010][3010],g[3010][3010];
int a[4040];
inline int read()
{
	char c=getchar();int x=0,flag=1;
	while(!isdigit(c)){if(c=='-') flag=-1;c=getchar();}
	while(isdigit(c)) x=x*10+c-'0',c=getchar();
	return x*flag;
}
int main()
{
	int n=read(),q=read(),qq=q;
	for(int i=1;i<=n;i++) a[i]=read();
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=n;j++)
		{
			if(a[i]>a[j]) f[i][j]=1;
		}
	}
	while(q--)
	{
		int x=read(),y=read();
		for(int i=1;i<=n;i++) g[i][x]=f[i][x],g[i][y]=f[i][y],g[x][i]=f[x][i],g[y][i]=f[y][i];
		for(int i=1;i<=n;i++)
		{
		//	if(i==x) continue;
			if(i==y) f[i][x]=(g[x][y]*inv2+g[y][x]*inv2)%mod;
			else f[i][x]=(g[i][x]*inv2+g[i][y]*inv2)%mod;
		}
		for(int i=1;i<=n;i++)
		{
		//	if(i==x) continue;		
			if(i==y) f[x][i]=(g[x][y]*inv2+g[y][x]*inv2)%mod;
			else f[x][i]=(g[x][i]*inv2+g[y][i]*inv2)%mod;
		}
		for(int i=1;i<=n;i++)
		{
		//	if(i==y) continue;
			if(i==x) f[i][y]=(g[x][y]*inv2+g[y][x]*inv2)%mod;
			else f[i][y]=(g[i][y]*inv2+g[i][x]*inv2)%mod;
		}
		for(int i=1;i<=n;i++)
		{
		//	if(i==y) continue;
			if(i==x) f[y][i]=(g[x][y]*inv2+g[y][x]*inv2)%mod;
			else f[y][i]=(g[y][i]*inv2+g[x][i]*inv2)%mod;
		}
	}
	ll ans=0;
	for(int i=1;i<=n;i++)
	{
		for(int j=i+1;j<=n;j++)
		{
			ans=(ans+f[i][j])%mod;
		}
	}
	for(int i=1;i<=qq;i++) ans=ans*2%mod;
	cout<<ans;
	return 0;
}


Measured memory_bytes: 141568
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define ROOP(i, N) for(int i=0; i<N; i++)
#define RVROOP(i, N) for(int i=N; i>=0; i--)
#define INF 1e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main() {
  int N; cin>>N;
  string S,T, ans; cin>>S>>T;
  ans=S+T;
  for(int i=0; i<N; i++){
    ans.at(2*i)=S.at(i);
    ans.at(2*i+1)=T.at(i);
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
const int MAX = 100004;
int n,h[MAX],dp[MAX];

int main()
{
    scanf("%d",&n);
    for(int i=0; i<n; i++)
    {
        cin>>h[i];
    }
    dp[0]=0;
    dp[1]=abs(h[0]-h[1]);
    for(int j=2; j<n; j++)
    {
        dp[j]=min(dp[j-1]+abs(h[j]-h[j-1]),dp[j-2]+abs(h[j-2]-h[j]));
    }

    cout<<dp[n-1]<<endl;
    return 0;
}


Measured memory_bytes: 1024
def solve1():
	maxx = maxy = 0
	minx = miny = 1000111000
	for i in xrange(n):
		maxx = max(maxx, x[i])
		minx = min(minx, x[i])
		maxy = max(maxy, y[i])
		miny = min(miny, y[i])
	return (maxx-minx)*(maxy-miny)

def solve2a(minx):
	miny = min(x)
	maxy = max(y)
	maxx = 0
	
	for i in xrange(n):
		if y[i] < minx:
			return 2**60
		if minx <= x[i]:
			maxx = max(maxx, x[i])
		else:
			maxx = max(maxx, y[i])
	return (maxx-minx)*(maxy-miny)

def solve2_():
	res = 2**60
	for minx in x:
		res = min(res, solve2a(minx))
	for minx in y:
		res = min(res, solve2a(minx))
	return res

def solve2():
	res = 2**60
	xy = x+y
	xy.sort()
	miny = min(x)
	maxy = max(y)
	my = min(y)
	
	pi = 0
	for minx in xy:
		if my < minx:
			break
		while pi < n and p[pi][0] < minx:
			pi += 1
		maxx = max(ly[pi], rx[pi+1])
		res = min(res, (maxx-minx)*(maxy-miny))
	return res

n = int(raw_input())

x = [0]*n
y = [0]*n
p = [(0,0)]*n
mini = maxi = 0
for i in xrange(n):
	x[i],y[i] = map(int, raw_input().split())
	x[i],y[i] = min(x[i],y[i]),max(x[i],y[i])
	p[i] = x[i],y[i]
	if x[i] < x[mini]:
		mini = i
	if y[maxi] < y[i]:
		maxi = i
p.sort()
ly = [0]*(n+2)
rx = [0]*(n+2)
mx = my = 0
for i in xrange(n):
	my = max(my, p[i][1])
	ly[i+1] = my

for i in xrange(n-1,-1,-1):
	mx = max(mx, p[i][0])
	rx[i+1] = mx

ans = solve1()
if mini != maxi:
	ans = min(ans, solve2())
print ans


Measured memory_bytes: 39724
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <cstdio>
#include <vector>

using namespace std;

typedef long long ll;

int main()
{
//	freopen("input.txt","r",stdin);
	
	ll n;
	cin>>n;
	ll ans=0;
	for(ll i=1;i<n;i++) ans+=i;
	cout<<ans<<endl;

	return 0;
}

//有n个仓库，m个工人，任何 

Measured memory_bytes: 256