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

#define all(a) (a).begin(), (a).end()
#define sz(a) (int)(a).size()
#define pb push_back

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef long double ld;
typedef pair<ld, ld> pld;

const int mod = 1e9 + 7;

void add(int& a, int b) {
	a += b;
	if (a >= mod) {
		a -= mod;	
	}
}

int main() {

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

	//ifstream cin("input.txt");
	//freopen("input.txt", "r", stdin);
	//ofstream cout("output.txt");

	int n;
	cin >> n;

	string a, b;
	cin >> a >> b;

	vector<vector<vector<int> > > dp(n, vector<vector<int> >(3, vector<int>(3)));
	if (a[0] == b[0]) {
		for (int c = 0; c < 3; ++c) {
			dp[0][c][c] = 1;
		}
	} else {
		for (int i = 0; i < 3; ++i) {
			for (int j = 0; j < 3; ++j) {
				if (i != j) {
					dp[0][i][j] = 1;
				}
			}
		}
	}

	for (int i = 1; i < n; ++i) {
		for (int x = 0; x < 3; ++x) {
			for (int y = 0; y < 3; ++y) {
				for (int u = 0; u < 3; ++u) {
					for (int v = 0; v < 3; ++v) {
						if (a[i] == a[i - 1] && u != x) {
							continue;
						}
						if (a[i] != a[i - 1] && u == x) {
							continue;
						}
						if (a[i] != b[i] && u == v) {
							continue;
						}
						if (a[i] == b[i] && u != v) {
							continue;
						}
						if (b[i] == b[i - 1] && v != y) {
							continue;
						}
						if (b[i] != b[i - 1] && v == y) {
							continue;
						}
						add(dp[i][u][v], dp[i - 1][x][y]);
					}
				}
			}
		}
	}

	int ans = 0;
	for (int x = 0; x < 3; ++x) {
		for (int y = 0; y < 3; ++y) {
			add(ans, dp[n - 1][x][y]);
		}
	}

	cout << ans << "\n";

}


Measured memory_bytes: 256
import java.util.Scanner;
public class Main{
	public static void main(String[] args) {
		Scanner scn = new Scanner(System.in);
      	int N = scn.nextInt();
      	int ans = 0;
      	ans = N % 10;
      	if(ans == 0 || ans == 1 || ans == 6 || ans == 8){
        	System.out.println("pon");
        }else if(ans == 2 || ans == 4 || ans == 5 || ans == 7 || ans == 9){
        	System.out.println("hon");
        }else{
        	System.out.println("bon");
        }
	}
}

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

using namespace std;

int main(){
	
	int n;
	
	cin >> n;
	
	int a[n+1];
	
	for (int i = 0; i < n; i++){
		cin >> a[i];
	}
	
	int ans = 0;
	
	for (int i = 1; i < n-1; i++){
		if (a[i-1] < a[i] && a[i+1] > a[i]){
			ans++;
		} else if (a[i-1] > a[i] && a[i+1] < a[i]){
			ans++;
		}
	}
	
	cout << ans;
	
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-


def main():
    n, k = map(int, input().split())
    a = list(map(int, input().split()))
    dp = [0 for _ in range(k + 1)]  # Firstが到達できるかどうかを管理

    # 石を順番に積み上げる(石を取り去る，を言い換え)
    # See:
    # https://atcoder.jp/contests/dp/submissions/3956066
    for i in range(k):
        # 既にFirstが到達可能な場合
        if dp[i]:
            continue

        # ある個数から，集合Aをすべて試す
        for ai in a:
            # k個より大きくなったら，計算を打ち切る
            # 範囲外参照を防ぐため
            if i + ai > k:
                break

            # 更新
            dp[i + ai] = 1

    if dp[-1] == 1:
        print('First')
    else:
        print('Second')


if __name__ == '__main__':
    main()


Measured memory_bytes: 44892
// B - ROT N
#include <bits/stdc++.h>
using namespace std;
#define rp(i,s,e) for(int i=(s);i<(e);++i)

int main(){
	int N; string S; cin>>N>>S;
	rp(i, 0, S.size()) cout<<(char)((S[i]-'A'+N)%26+'A'); puts("");
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cmath>

using namespace std;

typedef long long ll;

template<class T>
T gcd(T a,T b){
	while(a % b != 0){
		T buf = b;
		b = a%b;
		a = buf;
	}
	return b;
}

int main(){
	ll a,b;
	while(cin>>a>>b){
		ll g = gcd(a,b);
		ll l = a / g * b;

		cout << g << " " << l << endl;
	}
	return 0;
}

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

#define fio ios_base::sync_with_stdio(false); cin.tie(NULL);
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define FORD(i,a,b) for(int i=(a);i>=(b);i--)
#define sortv(v) sort(v.begin(),v.end());
#define sorta(a,n) sort(a,a+n);
#define arrayin(a,n) for(int i=0;i<n;i++) cin>>a[i];
#define arrayout(a,n) for(int i=0;i<n;i++) cout<<" ";cout<<"\n";
#define INF INT_MAX //Infinity
#define mp make_pair
#define pb push_back
#define mt make_tuple
#define MOD 1000000007
#define fi first
#define se second
#define ii pair<int,int>
#define vi vector<int>
#define vii vector<ii>
#define vi64 vector<lli>
#define viii vector<tuple<int,int,int>>
#define prq priority_queue<int>
#define mii map<int,int>
#define nl "\n"

typedef long long int lli;
typedef unsigned long long int ulli;
typedef double ld;

using namespace std;

int main()
{
	fio;
	/*int t;
	cin>>t;
	while(t--)
	{
		int n;
		cin>>n;
	}*/
	int h,w;
	cin>>h>>w;
	char a[h][w];
	REP(i,h)
	{
		REP(j,w)
			cin>>a[i][j];
	}
	REP(i,w+2) cout<<"#";
	cout<<endl;
	REP(i,h)
	{
		cout<<"#";
		REP(j,w) cout<<a[i][j];
		cout<<"#"<<endl;
	}
	REP(i,w+2) cout<<"#";
	cout<<endl;
}

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

#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define REP(i, n) for(int i = 0; i < (n); ++i)
#define REPr(i, n) for(int i = (n)-1; i >= 0; --i)
#define FORq(i, m, n) for(int i = (m); i <= (n); ++i)
#define FORqr(i, m, n) for(int i = (n); i >= (m); --i)
#define MP make_pair
#define SIN(x, S) (S.count(x) != 0)
#define M0(x) memset(x, 0, sizeof(x))
#define FILL(x, y) memset(x, y, sizeof(x))
#define MM(x) memset(x, -1, sizeof(x))
#define ALL(x) (x).begin(), (x).end()
#define DB(x) cerr << #x << " = " << x << endl
#define DB2(x, y)                                                              \
    cerr << "(" << #x << ", " << #y << ") = (" << x << ", " << y << ")\n";
#define DEBUG                                                                  \
    int x12345;                                                                \
    cin >> x12345;
typedef pair<int, int> PII;
typedef pair<long long, long long> PLL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<long long> VL;
typedef long long ll;
typedef long long integer;
///////////////////////////////////////////////
const long long MOD = 1e9 + 7;
template <class T> inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}

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

///////////////////////////////////////////////
/// 🍈( '-' 🍈 |AC|
int main() {
    int H,W,K;
    cin >> H >> W >> K;
    char grid[302][302] = {};
    int ans[302][302] = {};
    int firsth = 5000;
    char firstgrid[302] = {};
    vector<int> emptyh;

    REP(h,H){
        REP(w,W){
            cin >> grid[h][w];
        }
    }

    bool cuth[302] = {};
    REP(h,H){
        int st = 0;
        REP(w,W){
            if (grid[h][w] == '#') {
                st++;
                chmin(firsth,h);
            }
        }
        if (st >= 1) cuth[h] = true;
        if (st == 0) emptyh.push_back(h);
    }


    REP(h,10){
        DB2(h,cuth[h]);
    }

    int num = 1;
    bool ncut = true;
    REP(h,H){
        int st = 0;
        REP(w,W){
            if (grid[h][w] == '#'){
                if (st >= 1) num++;
                st++;
            }    
            ans[h][w] = num;
        }


        if (cuth[h]) {
            ncut = true;
            num++;
        }else{
            ncut = false;
        }
    }

    
    REP(w,W){
        firstgrid[w] = ans[firsth][w];
    }

    REP(k,emptyh.size()){
        REP(w,W){
            if ((k == 0) and (emptyh[k] < firsth)){
                ans[emptyh[k]][w] = firstgrid[w];
            }else{
                ans[emptyh[k]][w] = ans[emptyh[k] - 1][w];
            }
        }
    }

    REP(h,H){
        REP(w,W){
            cout << ans[h][w] << " ";
        }
        cout << "\n";
    }
}

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

using namespace std;
#define endl "\n"

const int MOD = 1e9 + 7;

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


	int a,b;
	cin >> a >> b;
	if(a >= b){
		for(int i=0; i<a; i++){
			cout << b;
		}
		cout << endl;
		return 0;
	} else {
	for(int i=0; i<b; i++){
			cout << a;
		}
		cout << endl;
		return 0;
	}


	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep2(i,x,y) for (int i = x; i < (y); ++i)
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
int INF = 100100101;
int main()
{
  ios::sync_with_stdio(false);  cin.tie(0); cout.tie(0);
  int a, b, c;
  cin >> a >> b >> c;
  int count = 0;
  for(int i = a; i <= b; i++){
    if(c % i == 0) count++;
  }
  cout << count << endl;
  return 0;
}


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

int MIN(int a, int b)
{
  if (a < b)
  {
    return a;
  }
  else
  {
    return b;
  }
}

int MAX(int a, int b)
{
  if (b < a)
  {
    return a;
  }
  else
  {
    return b;
  }
}

int main()
{
  int A, B, C, X, Y;
  cin >> A >> B >> C >> X >> Y;

  int all_AB = 2 * C * MAX(X, Y);
  int no_AB = A * X + B * Y;
  int partial_AB = A * (X - MIN(X, Y)) + B * (Y - MIN(X, Y)) + 2 * C * MIN(X, Y);

  int min = MIN(MIN(all_AB, no_AB), partial_AB);

  cout << min << endl;
}

Measured memory_bytes: 256
#pragma comment(linker, "/STACK:1000000000")
#pragma GCC optimize("Ofast,no-stack-protector")
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <algorithm>
#include <memory.h>
#include <cassert>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <cmath>
#include <ctime>
#include <random>
#include <bitset>
#include <limits.h>
#include <fstream>

#define mp make_pair
#define all(a) (a).begin(), (a).end()
#define pll pair <ll, ll>

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef double ld;
#define uint unsigned int

const int maxn = 2010;
int mod;

int add(int x, int y) {
	x += y;
	if (x >= mod) {
		x -= mod;
	}
	return x;
}

int sub(int x, int y) {
	x -= y;
	if (x < 0) {
		x += mod;
	}
	return x;
}

int mul(int x, int y) {
	return (ll)x * y % mod;
}

int dp[3 * maxn][maxn][2][2];

int go(int n, int x, bool y, bool tp) {
	if (x < 0) {
		x = -x;
		y = !y;
	}
	if (n < 0) {
		return 0;
	}

	if (dp[n][x][y][tp] != -1) {
		return dp[n][x][y][tp];
	}

	if (n == 0) {
		return dp[n][x][y][tp] = (tp == 0 && x == 0 && y == 0) || (tp == 1 && x == 0);
	}

	int ans = mul(n - 1, mul(n - 2, go(n - 3, x, y, tp)));

	if (!tp) {
		if (y) {
			ans = add(ans, mul(n - 1, go(n - 2, x, false, tp)));
		}
		else {
			ans = add(ans, mul(n - 1, go(n - 2, x + 1, y, tp)));
		}

		if (x > 0) {
			ans = add(ans, go(n - 1, x - 1, y, tp));
		}
		else if (!y) {
			ans = add(ans, go(n - 1, x, true, tp));
		}
		else {
			ans = add(ans, go(n - 1, x + 1, false, tp));
			ans = add(ans, go(n - 1, 2, false, true));
		}
	}
	else {
		if (!y) {
			ans = add(ans, mul(n - 1, go(n - 2, x - 1, y, tp)));
			ans = add(ans, go(n - 1, x + 1, y, tp));
		}
		else {
			ans = add(ans, mul(n - 1, go(n - 2, x + 1, y, tp)));
			ans = add(ans, go(n - 1, x - 1, y, tp));
		}
	}

	return dp[n][x][y][tp] = ans;
}

int main() {
	int n;

	cin >> n >> mod;

	memset(dp, -1, sizeof dp);

	cout << go(3 * n, 0, false, false) << '\n';
}

Measured memory_bytes: 190336
package main

import (
	"fmt"
	"sort"
)

func nextInt() int {
	var x int
	fmt.Scan(&x)
	return x
}

func main() {
	n := nextInt()
	k := nextInt()

	dic := map[int]int{}
	for range make([]struct{}, n) {
		a := nextInt()
		dic[a]++
	}
	seq := []int{}
	for _, v := range dic {
		seq = append(seq, v)
	}
	sort.Sort(sort.Reverse(sort.IntSlice(seq)))

	cnt := 0
	for len(seq) > k {
		m := len(seq)
		cnt += seq[m-1]
		seq = seq[:m-1]
	}
	fmt.Println(cnt)
}


Measured memory_bytes: 17920
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int N = sc.nextInt();
		// スペース区切りの整数の入力
		int A = sc.nextInt();
		int B = sc.nextInt();

		int min;
		int max;

		//max
		if(A>B) max=B;
		else max=A;

		//min
		if(A+B<=N)min=0;
		else {min=A+B-N;}
		
		// 出力	
		System.out.println(max + " " + min);
	}
}


Measured memory_bytes: 21588
function gets(str){
  this._s = str.split("\n");
  this._y = 0;
};
gets.prototype = {
  a: function(f){
    var s = this._s, y = this._y, r;
    if(typeof s[y] === "string")s[y] = s[y].split(" ").reverse();
    r = s[y].pop();
    if(!s[y].length)this._y++;
    return f?r:+r;
  },
  l: function(f){
    var s = this._s[this._y++].split(" ");
    return f?s:s.map(a=>+a);
  },
  m: function(n,f){
    var s = this._s, y = this._y, r = [], i = 0;
    if(f)for(;i < n; i++)r[i] = s[y+i].split(" ");
    else for(;i < n; i++)r[i] = s[y+i].split(" ").map(a=>+a);
    this._y += n;
    return r;
  },
};
var o=new gets(require("fs").readFileSync("/dev/stdin","utf8"));

console.log(main());
function main(){
  var n = o.a();
  var x = o.a();
  var a = o.l();
  a.sort((a,b)=>a-b);
  for(var i = 0; i < n; i++){
    x -= a[i];
    if(x < 0)return i;
  }
  return x ? i-1:i;
}

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

const string S[] = {"SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"};

string s;

int main()
{
    cin >> s;
    for (int i = 0; i < 7; i++)
        if (s == S[i]) { printf("%d\n", 7 - i); return 0; }
    return 0;
}


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

using namespace std;

struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}init;

typedef long long LL;

template<typename T>void chmin(T &a,T b){a=min(a,b);}
template<typename T>void chmax(T &a,T b){a=max(a,b);}
template<typename T>
istream& operator>>(istream &is,vector<T> &v){
    for(auto &it:v)is>>it;
    return is;
}
typedef long long LL;
template <typename T> class svector:private std::vector<T>{
    using V=std::vector<T>;
    using SV=svector;
private:
    int sz;
public:
    using V::begin;
    using V::end;
    svector(int n,T ini):V(n*2+1,ini),sz(n){}
    svector(int n):SV(n,T()){}
    svector():V(),sz(0){}
    int size(){return sz;}
    T& operator[](int id){
        //  assert(abs(id)<=sz);
        return V::operator[](id+sz);
    }
    SV& copy(const SV &other){
        V::operator=(other);
        sz=other.sz;
        return (*this);
    }
    SV& operator=(const SV& other){
        return copy(other);
    }
};

int main(){
    int R,C;
    cin>>R>>C;
    LL res=0;
    vector<string> c(R);
    
    cin>>c;
    reverse(c.begin(),c.end());

    for(int i=0;i+1<C;i++){
        svector<vector<LL>> wa(R,vector<LL>(R+3,0));
        vector<vector<LL>> dp(R+1,vector<LL>(R+1,0));
        
        for(int l=0;l<R;l++)
            for(int r=0;r<R;r++){
                if(c[l][i]==c[r][i+1]){
                    wa[r-l][R-l]++;
                    //  printf("add(%d,%d)\n",l-r,R-l);
                }
            }
        
        for(int l=1;l<=R;l++)
            for(int r=1;r<=R;r++){
                wa[l-r][l]=wa[l-r][l]+wa[l-r][l-1];
            }
        for(int j=0;j<=R;j++)
            dp[j][0]=dp[0][j]=0;
        for(int l=1;l<=R;l++)
            for(int r=1;r<=R;r++){
                dp[l][r]=min(dp[l-1][r],dp[l][r-1])+wa[l-r][l];
                //                cout<<l<<" "<<r<<" "<<dp[l][r]<<endl;
            }
        res+=dp[R][R];
        // cout<<dp[R][R]<<endl;
    }

    cout<<res<<endl;
    
    return 0;
}


Measured memory_bytes: 2608
#include <iostream>
#include <string>
#include <vector>
#include <numeric>
#include <algorithm>
#include <set>
using namespace std;

#ifdef INPUT
#include <sstream>
stringstream input(R"(
999999999
)");
#define cin input
#endif

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

	if (n%2==1)
		cout << 2*n << endl;
	
	else
	{
		cout << n << endl;
	}
	
}

Measured memory_bytes: 256
/***
*  author  :_shamim
*  created : 06.05.2020
*
***/

#include <iostream>
#include <string.h>
#include <stdio.h>
#include <math.h>
#include <list>
#include <set>
#include <queue>
#include <iterator>
#include <bitset>
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#define ll             long long
#define _              ios_base::sync_with_stdio(0);cin.tie(0);
#define loop           for(i=0;i<n;i++)
#define pb             push_back
#define tc()           int t;cin>>t;while(t--)          

using namespace std;

ll i,j,temp;

int main()
{_

	int x,a;
	cin>>x>>a;
	cout<<x*x - a<<endl;
	return 0;

}

Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
#define LL long long
using namespace std;
LL i,j,k,n,f,trs,bgs,ans;
LL a[55];
int main()
{
	scanf("%lld",&n);
	for (i=1;i<=n;++i)
		scanf("%lld",&a[i]);
	f=0;
	while (!f)
	{
		f=1;
		for (i=1;i<=n;++i)
			if (a[i]>(n<<1))
			{
				f=0;
				trs=(a[i]-(n<<1)-1)/n+1;
				ans+=trs;
				a[i]-=trs*n;
				for (j=1;j<=n;++j)
					if (i!=j)
						a[j]+=trs;
			}
	}
	while (true)
	{
		bgs=1;
		for (i=2;i<=n;++i)
			if (a[bgs]<a[i])
				bgs=i;
		if (a[bgs]<n)
			break;
		else
		{
			++ans;
			a[bgs]-=n;
			for (i=1;i<=n;++i)
				if (i!=bgs)
					++a[i];
		}
	}
	printf("%lld",ans);
	return 0;
}

Measured memory_bytes: 128
import sys
import copy
import math
import bisect
import pprint
import bisect
from functools import reduce
from copy import deepcopy
from collections import deque

def lcm(x, y):
    return (x * y) // math.gcd(x, y)

if __name__ == '__main__':
    a = [int(i) for i in input().split()]

    if (a[0] < a[1] and a[0]<a[2] and a[2] <a[1]) or (a[0] > a[1] and a[0]>a[2] and a[2] >a[1]):
        print("Yes")
    else:
        print("No")


Measured memory_bytes: 3828
#include <cstdio>
#include <stack>
#include <set>
#include <cmath>
#include <map>
#include <time.h>
#include <vector>
#include <iostream>
#include <string>
#include <algorithm>
#include <memory.h>
#include <cstdlib>
#include <queue>
#define P pair<int, int>
#define LL long long
#define LD long double
#define PLL pair<LL, LL>
#define mset(a, b) memset(a, b, sizeof(a))
#define PI acos(-1.0)
#define random(x) rand() % x
using namespace std;
const int inf = 0x3f3f3f3f;
const LL __64inf = 0x3f3f3f3f3f3f3f3f;
const int MAX = 1e5 + 5;
const int Mod = 1e9 + 7;

LL dp1[MAX], dp2[MAX];

int main()
{
    dp1[0] = 1;
    dp2[0] = 1;
    string s;
    cin >> s;
    s += '0';
    reverse(s.begin(), s.end());
    int n = s.size();
    for(int i = 1; i <= n; i++)
    {
        if(s[i] == '1'){
            dp1[i] = (dp1[i-1] * 3) % Mod;
            dp2[i] = (dp2[i-1] * 2 + dp1[i-1]) % Mod;
        }
        else{
            dp1[i] = (dp1[i-1] * 3) % Mod;
            dp2[i] = dp2[i-1];
        }
    }
    cout << dp2[n] << endl;
    return 0;
}

Measured memory_bytes: 2048
#include <bits/stdc++.h>
using namespace std;
#define TRACE(x) x
#define WATCH(x) TRACE( cout << #x" = " << x << endl)
#define PRINT(x) TRACE(printf(x))
#define WATCHR(a, b) TRACE( for(auto c = a; c != b;) cout << *(c++) << " "; cout << endl)
#define WATCHC(V) TRACE({cout << #V" = "; WATCHR(V.begin(), V.end()); } )
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x).size()
#define mp make_pair
#define st first
#define nd second

using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using ld = long double;
using pll = pair<ll, ll>;
using vll = vector<ll>;
using pll = pair<ll, ll>;

void buff() { ios::sync_with_stdio( false ); cin.tie( nullptr ); }

constexpr ll MOD = 1e9 + 7;

inline ll pow_mod( ll a, ll b, ll mod = MOD) {
    ll res = 1; a %= mod; assert(b >= 0);
    for(;b;b>>=1) {
        if(b&1) res = (res * a) % mod;
        a = (a * a) % mod;
    }
    return res;
}
// End of template code!
int main() 
{
    buff();
    string s;
    cin >> s;
    if(s[1] == 'B') s[1] = 'R';
    else s[1] = 'B';
    cout << s << '\n';
    return 0;
}



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

int main(){
  long long int a,b,k;

  cin >> a >> b >> k;
  
  if(k >= a){
    k -= a;
    a = 0;
    b -= k;
    if(b < 0)
      b = 0;
  }else{
    a -= k;
  }

  cout << a << " " << b << endl;
}

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

int main() {
  ll ans = 2018; bool fin = false;
  ll L,R; cin >> L >> R;
  for(ll i=L; i<R; i++){
    for(ll j=i+1; j<R+1; j++){
      ll mod = (i*j)%2019;
      if(mod < ans) ans = mod;
      if(ans == 0){ fin = true; break; }
    }
    if(fin) break;
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 3640
#include<stdio.h>
#include<stdlib.h>

int main(){
		int h,w,d,i,j;
		int a[100][100];
		int as[100000][2];
		scanf("%d%d%d",&h,&w,&d);
		for(i=0;i<h;i++){
				for(j=0;j<w;j++){
						scanf("%d",&a[i][j]);
						as[a[i][j]][0]=i;
						as[a[i][j]][1]=j;
				}
		}
		int anss[100000]={0};
		for(i=1;i<=d;i++){
				for(j=i+d;j<=h*w;j+=d){
						anss[j]=anss[j-d]+abs(as[j][0]-as[j-d][0])+abs(as[j][1]-as[j-d][1]);
				}
		}
		int q;
		scanf("%d",&q);
		for(i=0;i<q;i++){
				int l,r;
				scanf("%d%d",&l,&r);
				printf("%d\n",anss[r]-anss[l]);
		}
		return 0;
}


Measured memory_bytes: 2176
from functools import reduce

N = int(input())
S = [input() for _ in range(N)]
s_map = {}

for i, s in enumerate(S):
    if s in s_map:
        s_map[s] += 1
    else:
        s_map[s] = 1

s_list = list(s_map.items())
s_list.sort(key=lambda x:x[1], reverse=True)
max_num = s_list[0][1]
res = list(filter(lambda item: item[1] == max_num, s_list))
res.sort(key=lambda x: x[0], reverse=False)
for i, item in enumerate(res):
    print(item[0])



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

int main(){
  string s = "Yes";
  int N;
  cin >> N;
  vector<pair<int,int>> a;
  for(int i=0;i<N;i++){
    int b,c;
    cin >> b >> c;
    a.push_back(make_pair(c,b));
  }
  sort(a.begin(),a.end());
  int sum=0;
  for(pair<int,int> t:a){
    int x,y;
    tie(x,y)=t;
    sum+=y;
    if(x<sum)
      s = "No";
  }
    cout << s << endl;
}

Measured memory_bytes: 2420
#include <stdio.h>

int main(void){
  int num,max,l1,l2,people,people1;
  while(1){
    scanf("%d",&num);
    if(num == 0)
      break;
    max=0;people1=0;
    while(num){
      scanf("%d %d %d",&people,&l1,&l2);
      if(max < l1+l2){
	max=l1+l2;
	people1=people;
      }
      num--;
    }
    printf("%d %d\n",people1,max);
  }
  return 0;
}

Measured memory_bytes: 600
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
using namespace std;
#define REP(i,n) for (int i=0;i<(n);++i)
#define rep(i,a,b) for(int i=a;i<(b);++i)
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;}
typedef long long ll;
typedef pair<int,int> pii;
const ll INF = 1LL << 60;
const ll MOD = 1e9 + 7;

// graph //
struct Edge {
    int from,to,cost;
    Edge(int f,int t, int c) : from(f), to(t), cost(c) {}
    bool operator<(const Edge &e){return cost < e.cost;}
};

using Graph = vector<Edge>;

template<class T>
class ShortestPath {
    public:
        ShortestPath(int size){
            mDst.assign(size,INF);
        }

        bool bellman_ford(int s, int V,  Graph &g){
            mDst[s] = 0;
            for(int i = 0; i < V;++i){
                for(auto e : g){
                    if(mDst[e.from]!=INF && mDst[e.to] > mDst[e.from] + e.cost){
                        mDst[e.to] = mDst[e.from] + e.cost;
                        if(i == V-1) return true;
                    }
                }
            }
            return false;
        }

        vector<T> getDst(){return mDst;}
    private:
        vector<T> mDst;
};


int main() {
    cin.tie(0); ios_base::sync_with_stdio(false);
    int V,E,r,s,t,d;
    cin >> V >> E >> r;

    Graph g;
    ShortestPath<ll> sp(V);
    REP(i,E){
        cin >> s >> t >> d;
        g.emplace_back(s,t,d);
    }
    if(sp.bellman_ford(r,V,g)){
        cout << "NEGATIVE CYCLE" << '\n';
        return 0;
    }
    auto dst = sp.getDst();
    REP(i,V){
        if(dst[i]==INF) cout << "INF" << '\n';
        else cout << dst[i] << endl;
    }
    return 0;
}


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

int main(){
  long long int a_price, b_price, ab_price, a_num, b_num;
  cin >> a_price >> b_price >> ab_price >> a_num >> b_num;
  if(a_price + b_price <= ab_price * 2){
    cout << a_price * a_num + b_price * b_num << endl;
    return 0;
  }
  if(a_num < b_num) {
    int swap;
    swap = a_price;
    a_price = b_price;
    b_price = swap;
    swap = a_num;
    a_num = b_num;
    b_num = swap;
  }
  long long  int price = b_num * ab_price * 2;
  a_num -= b_num;
  price += min(a_price*a_num, ab_price*a_num*2);
  //a_price * a_num
  cout << price << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
#define rep(i,q) for(int i = 0; (q) > i; i++)
#define repp(i,n,q) for(int i = n; (q) > i; i++)
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define allDESC(c) (c).begin(),(c).end(),greater<int>()
int main(){
  int N;cin>>N;
  vector<int>a;
  rep(i,N){
    int tmp;cin>>tmp;a.pb(tmp);
  }
  sort(allDESC(a));
  int kekka = 1;
  repp(i,1,N){
    if(a[i] != a[i-1])kekka++;
  }
  cout << kekka << endl;
  
}

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

 int main(){
 string S, T;
 cin >> S >> T;
 int N = S.size(), ans = 0; 
   for(int i = 0; i < N; ++i){
  if(S[i] != T[i]) ++ans;
 }
cout << ans << endl;
 }

Measured memory_bytes: 3924
#include<bits/stdc++.h>
#define ll long long
#define l long
#define mk make_pair
#define pb push_back
#define in insert
#define se second
#define fi first
#define mod 1000000007
#define watch(x) cout << (#x) << " is " << (x) << "\n"
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL);
#define pii pair<int,int>
using namespace std;
ll findTrailingZeros(ll n) 
{ 
    ll count = 0; 
  
    for (ll i = 5; n / i >= 1; i *= 5) 
    {
        count += n / i; 
    }
 
    return count; 
} 
int main()
{
    fast;
  
    ll n,i,ans=0;
    cin>>n;
    if(n&1) cout<<"0";
    else
    {
    	n /= 2;
    	cout<<findTrailingZeros(n);
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define F first
#define S second

using namespace std;
typedef long long int64;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	int r;
	cin >> r;
	long double area = 2.0 * (22.0/7.0) * r;
	cout << fixed << setprecision(10) << area;
}

Measured memory_bytes: 3804
#include <iostream>
#include <cstdlib>
using namespace std;
int pt,py,px;bool flag=1;
int main(){
  int n;
  cin >> n;
  int t[n];int x[n]; int y[n];
  for(int i=0;i<n;i++){
    cin >> t[i]>> x[i]>> y[i];
  }
  for(int i=0;i<n;i++){
    int d=abs(px-x[i])+abs(py-y[i]);//進む距離
    int dt=t[i]-pt;//到着予定時間-今まで使った時間
    if(dt<d||(dt-d)%2==1){//時間が余っても2で割りきれれば一個前に行ったり戻ったりして時間をぴったり潰せる
         flag=false;
         break;
    }
    pt=t[i];px=x[i];py=y[i];
  }
  if(!flag) cout <<"No" << endl;
  else cout <<"Yes" << endl;
}


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

#define rep(i, n) for (int i = 0; i < (n); i++)
#define repr(i, n) for (int i = (n)-1; i >= 0; i--)
using namespace std;
typedef long long ll;

const int INF = 1e9;

int main() {
  int n;
  cin >> n;
  ll ans = 0;
  vector<string> s(n);
  unordered_map<string, int> mp;
  rep(i, n) {
    cin >> s[i];
    sort(s[i].begin(), s[i].end());
    ans += mp[s[i]];
    mp[s[i]] = ++mp[s[i]];
  }

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


Measured memory_bytes: 17700
import java.util.Scanner;


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

		int d[] = new int[n];
		
		for(int i=0; i<n; i++) {
			d[i] = sc.nextInt();
//			System.out.println(i + " : " + x[i]);
		}
		
		int p = 0;
		for (int i=0; i<n-1;i++) {
			for(int j=i+1;j<n;j++) {
				p += d[i]*d[j];
			}
		}
		
		System.out.println(p);
	}

}

Measured memory_bytes: 23252
#include <stdio.h>

int main(void)
{
	int n,a,b,i=1,div,rest,sum=0,ans=0;
	scanf("%d%d%d",&n,&a,&b);
	while(i <= n)
		{
		sum = 0;
		rest = i;
		for(div=10000;div >= 1;div /= 10)
			{
			sum += rest / div;
			rest = rest % div;
			}
		if(sum >= a && sum <= b)
			{ans += i;}
		i++;
		}
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 128
from collections import Counter
while 334:
    N=int(input())
    if N==0:break
    Hyoes = input().split()
    C=dict([])
    for t in "ABCDEFGHIJKLMNOPQRSTUVWXYZ":
        C[t]=0
    curtop=["A",0]
    for hyo,c in enumerate(Hyoes,1):
        C[c] += 1
        if C[c]>curtop[1]:
            curtop=[c,C[c]]
        D=sorted(C.values(),reverse=True)
        if D[0]>D[1]+N-hyo:
            print(curtop[0],hyo)
            break
        if hyo==N:
            print("TIE")


Measured memory_bytes: 5996
n = int(input())
s = list(input())
ans = (s.count("R")*s.count("G")*s.count("B"))

for i in range(n):
    for j in range(n-2*i):
        if {s[j], s[j+i], s[j+2*i]} == {"R", "G", "B"}:
            ans -= 1
print(ans)

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

using namespace std;
using ll = long long;

const int mod = 1e9 + 7;

void add_self(int& a, int b) {
    a += b;
    if(a >= mod) {
        a -= mod;
    }
}

signed main() {
    int n;
    scanf("%d", &n);
    vector<vector<int> > can(n, vector<int>(n));
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            scanf("%d", &can[i][j]);
        }
    }
    vector<int> dp(1 << n); // 2^n
    dp[0] = 1;
    for (int mask = 0; mask < (1 << n) - 1; mask++) {
        int a = __builtin_popcount(mask); // the number of bits set to 1
        for (int b = 0; b < n; b++) {
            if (can[a][b] && !(mask & (1 << b))) {
                int m2 = mask ^ (1 << b);
                add_self(dp[m2], dp[mask]);
            }
        }
    }
    printf("%d\n", dp[(1 << n) - 1]);
    return false;
}

Measured memory_bytes: 8448
#include <iostream>
#include <bits/stdc++.h>
#define all(v) (v).begin(), (v).end()
#define pb push_back
#define ll long long int

using namespace std;
using pi = pair<ll, ll>;



int main(){
	ios_base::sync_with_stdio(0);
    cin.tie(0);
	char ch ;
	cin>>ch;
	ll ans = ch;
	ans++;
	ch =ans;
	cout <<ch<<endl;
}

Measured memory_bytes: 256
/****************************
** In the name of Allah    **
** Author: Farhad          **
** From  : IIT,JU          **
*****************************/
#include<bits/stdc++.h>
using namespace std;
#define PI 2*acos(0.0)
#define GCD(a,b) _gcd(max(a,b),min(a,b))
int main ()
{
    int a,b,c;
    cin>>a>>b>>c;
    cout<<(a-b)%c<<endl;
    return 0;
}


Measured memory_bytes: 256
/*
    Written by Nitrogens
    Desire for getting accepted!!
*/
#include <cstdio>
#include <ctime>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <queue>
#include <map>
#include <bitset>
#include <stack>
#include <set>
#include <vector>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair <ll, int> pli;
typedef pair <db, db> pdd;

const int maxn = 2e5+5;
const int Mod = 1000000007;
const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
const double e = exp(1);
const db PI = acos(-1);
const db ERR = 1e-10;

#define Se second
#define Fi first
#define pb push_back
#define dbg(x) cout<<#x<<" = "<< (x)<< endl
#define dbg2(x1,x2) cout<<#x1<<" = "<<x1<<" "<<#x2<<" = "<<x2<<endl
#define dbg3(x1,x2,x3) cout<<#x1<<" = "<<x1<<" "<<#x2<<" = "<<x2<<" "<<#x3<<" = "<<x3<<endl

ll dp[maxn], h[maxn];
int q[maxn];

ll deltay(int j, int i)
{
    ll fj = dp[j] + h[j] * h[j];
    ll fi = dp[i] + h[i] * h[i];
    return fj - fi;
}

ll deltax(int j, int i)
{
    return h[j] - h[i];
}

int main()
{
    //ios::sync_with_stdio(false);
    //freopen("a.txt","r",stdin);
    //freopen("b.txt","w",stdout);

    int n;
    ll c;
    scanf("%d%lld", &n, &c);

    for(int i = 1; i <= n; i++) scanf("%lld", &h[i]);

    memset(dp, 0x3f, sizeof(dp));
    int head = 1, tail = 1;
    q[1] = 1;
    dp[1] = 0;
    for(int i = 2; i <= n; i++)
    {
        while(head < tail && deltay(q[head + 1], q[head]) <= deltax(q[head + 1], q[head]) * 2LL * h[i]) head++;
        dp[i] = dp[q[head]] + deltax(i, q[head]) * deltax(i, q[head]) + c;
        while(head < tail && deltay(q[tail], q[tail - 1]) * deltax(i, q[tail]) >= deltay(i, q[tail]) * deltax(q[tail], q[tail - 1]))  tail--;
        q[++tail] = i;
        //dbg2(i, dp[i]);
    }
    /*
    for(int i = 2; i <= n; i++)
    {
        for(int j = 1; j < i; j++) dp[i] = min(dp[i], dp[j] + (h[i] - h[j]) * (h[i] - h[j]) + c);
    }
    */

    printf("%lld\n", dp[n]);

    //cout << "time: " << (long long)clock() * 1000 / CLOCKS_PER_SEC << " ms" << endl;
    return 0;
}


Measured memory_bytes: 4224
from sys import stdin
##  input functions for me
def ria(sep = ''):
    if sep == '' :
        return list(map(int, input().split())) 
    else: return list(map(int, input().split(sep)))
def rsa(sep = ''):
    if sep == '' :
        return input().split() 
    else: return input().split(sep)
def ri(): return int(input())
def rd(): return float(input())
def rs(): return input()
##

## main ##
N = ri()
A = ria()
inf = int(1e18)

dp = [0] * 2
dp[0] = [-inf] * (N + 1)
dp[1] = [-inf] * (N + 1)

dp[0][1] = A[0]
dp[1][1] = - A[0]
for i in range(1, N - 1):
    dp[0][i + 1] = max(dp[0][i + 1], dp[0][i] + A[i])
    dp[1][i + 1] = max(dp[1][i + 1], dp[0][i] - A[i])
    dp[0][i + 1] = max(dp[0][i + 1], dp[1][i] - A[i])
    dp[1][i + 1] = max(dp[1][i + 1], dp[1][i] + A[i])

ma = max(dp[0][N - 1] + A[N - 1], dp[1][N - 1] - A[N - 1])

print(ma)




Measured memory_bytes: 16800
//
//  main.cpp
//  ABC139C2
//
#include <iostream>
#include <vector>
#include<algorithm>
using namespace std;
int main(int argc, const char * argv[]) {
    
    int N;
    cin >> N;
    vector<long>H(N);
    vector<long>count(N);
    for (int i=0; i<N; i++) {
        cin >> H.at(i);
    }
    long max=0;
    long height=0;
    int k=0;
    //for (int j=0; j<N-1; j++) {
    int j=0;
    while(j<N-1){
        height=H.at(j);//注目するマスの高さ
        k=j+1;
        while ((k<N)&&height>=H.at(k)) {
            height=H.at(k);//注目するマスの高さの値を入れ替える
            count.at(j)++;
            k++;
        }
        if (max<count.at(j)) {
            max=count.at(j);
        }
        j=k;
    }
    //}
    cout << max << endl;
    return 0;
}


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

int main() {
  int N, K, g = 0, ma = 0;
  scanf("%d%d", &N, &K);
  for (int i = 0; i < N; i++) {
    int t; scanf("%d", &t);
    g = __gcd(g, t);
    ma = max(ma, t);
  }
  if (K % g == 0 && K <= ma) cout << "POSSIBLE" << endl;
  else cout << "IMPOSSIBLE" << endl;
}


Measured memory_bytes: 384
#include<iostream>
#include<cctype>
#include<vector>
#include <ctype.h>
#include<algorithm>
#include<queue>
#include<string>
#include <math.h>
#include <iomanip>
using namespace std;
long long n,p,t=0;
int main() {
	cin >> n>>p;
	if (n*2 <= p) {
		p-= n * 2;
		t+=n;
		t += (p - p % 4) / 4;
		cout << t << endl;
	}
	else cout << (p - p % 2) / 2 << endl;
	return 0;
}

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

using namespace std;

int main(){
    string S;
    cin >> S;
    if(S=="RRR"){
        cout << 3;
    }else if(S=="RRS" || S=="SRR"){
        cout << 2;
    }else if(S=="SSS"){
         cout << 0;
    }else{
        cout << 1;
    }

    return 0;
}

Measured memory_bytes: 3620
package main

import (
	"fmt"
	"math"
)

func main() {
	var X int
	fmt.Scan(&X)
	max := 0
	if X == 1 {
		fmt.Println("1")
		return
	}
	for i := 2; i < 35; i++ {
		for j := 2; j < 10; j++ {
			n := int(math.Pow(float64(i), float64(j)))
			if n > X {
				break
			}
			if n > max {
				max = n
			}
		}
	}
	fmt.Println(max)
}

Measured memory_bytes: 512
import numpy as np
n=int(input())
s=list(map(float,input().split()))
a=np.zeros(n+1,dtype="float")
a[0]=1
for i in range(n):
    k=s[i]
    p=a*(1-k)
    p[1:]+=a[:-1]*k
    a=p
print(sum(a[n//2+1:]))

Measured memory_bytes: 12496
#include <iostream>
#include <stack>
#include <cstdlib>
#include <cstdio>
using namespace std;

int main()
{
    stack<int> q;
    string s;
    int a, b;
    while(1)
    {
        cin >> s;
        if(s[0]=='+')
        {
            a = q.top();
            q.pop();
            b = q.top();
            q.pop();
            q.push(a+b);

        }
        else if(s[0]=='-')
        {
            a = q.top();
            q.pop();
            b = q.top();
            q.pop();
            q.push(b-a);

        }
        else if(s[0]=='*')
        {
            a = q.top();
            q.pop();
            b = q.top();
            q.pop();
            q.push(a*b);

        }
        else
        {
            q.push(atoi(s.c_str()));
        }
        a = getchar();
        if(a == 0xa)    break;
    }
    cout << q.top() << endl;
    return 0;
}

Measured memory_bytes: 3200
#line 1 "/workspaces/compro/lib/template.hpp"


#line 1 "/workspaces/compro/lib/io/vector.hpp"
#include <iostream>
#include <vector>

#ifndef IO_VECTOR
#define IO_VECTOR

template <class T> std::ostream &operator<<(std::ostream &out, const std::vector<T> &v) {
  int size = v.size();
  for (int i = 0; i < size; i++) {
    std::cout << v[i];
    if (i != size - 1)
      std::cout << " ";
  }
  return out;
}

template <class T> std::istream &operator>>(std::istream &in, std::vector<T> &v) {
  for (auto &el : v) {
    std::cin >> el;
  }
  return in;
}

#endif
#line 4 "/workspaces/compro/lib/template.hpp"
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) (v).begin(), (v).end()
#define coutd(n) cout << fixed << setprecision(n)
#define ll long long int
#define vl vector<ll>
#define vi vector<int>
#define MM << " " <<

using namespace std;

template <class T> void say(bool val, T yes, T no) { cout << (val ? yes : no) << "\n"; }

void say(bool val, string yes = "Yes", string no = "No") { say<string>(val, yes, no); }

template <class T> void chmin(T &a, T b) {
  if (a > b)
    a = b;
}

template <class T> void chmax(T &a, T b) {
  if (a < b)
    a = b;
}

// C++ 17に完全移行したら消す
// 最大公約数を求める
template <class T> T gcd(T n, T m) { return n ? gcd(m % n, n) : m; }

// 最小公倍数を求める
template <class T> T lcm(T n, T m) {
  int g = gcd(n, m);
  return n * m / g;
}

// 重複を消す。計算量はO(NlogN)
template <class T> void unique(std::vector<T> &v) {
  std::sort(v.begin(), v.end());
  v.erase(std::unique(v.begin(), v.end()), v.end());
}


#line 2 "main.cpp"

long long solve(long long a, long long b, long long c, long long d) {
  return max(a * c, max(a * d, max(b * c, b * d)));
}

// generated by online-judge-template-generator v4.4.0 (https://github.com/kmyk/online-judge-template-generator)
int main() {
  long long a, b, c, d;
  std::cin >> a >> b >> c >> d;
  auto ans = solve(a, b, c, d);
  std::cout << ans << std::endl;
  return 0;
}


Measured memory_bytes: 3628
using System;
using System.Collections.Generic;

class Class3
{
    static void Main(string[] args)
    {
        long N = long.Parse(Console.ReadLine());

        string str = "";

        while(N > 26)
        {
            long a = N / 26;

            long b = N % 26;

            if (b != 0)
            {
                b += 96;
                N = a;
            }
            else
            {
                b += 122;
                N = a - 1;
            }
            str = (char)b + str;

        }

        if (N != 0)
        {
            N += 96;
        }
        else
        {
            N += 122;
        }
        str = (char)N + str;


        // 97 -> a
        // 122 -> z

        Console.WriteLine(str);
    }
}

Measured memory_bytes: 27508
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ff first
#define ss second
#define pb push_back
#define mp makepair
#define deb(x) cout<<x<<"\n";
#define deB(x,y) cout<<x<<" "<<y<<"\n";
#define YES cout<<"YES\n";
#define Yes cout<<"Yes\n";
#define NO cout<<"NO\n";
#define No cout<<"No\n";
#define all(v) (v).begin(),(v).end()
#define PI 3.1415926535

int main()
{
    int R;
    cin>>R;
    float c;
    c=2*R*PI;

    cout<<c;
}


Measured memory_bytes: 3788
import java.util.*;

public class Main {

	private class Edge implements Comparable<Edge> {

		int from;
		int to;
		int cost;

		public Edge(int a, int b, int c) {
			from = a;
			to = b;
			cost = c;
		}

		@Override
		public int compareTo(Edge other) {

			return cost - other.cost;
		}

	}

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

		Main obj = new Main();

		int vertex = sc.nextInt();
		int edge = sc.nextInt();

		int source = sc.nextInt();

		int[] cost = new int[vertex];

		ArrayList<Edge>[] graph = new ArrayList[vertex];
		for (int i = 0; i < vertex; i++) {
			cost[i] = 1 << 30;
			graph[i] = new ArrayList<Edge>();
		}

		for (int i = 0; i < edge; i++) {
			int a = sc.nextInt();
			int b = sc.nextInt();
			int c = sc.nextInt();

			graph[a].add(obj.new Edge(a, b, c));
		}

		HashSet<Integer> visited = new HashSet<>();
		PriorityQueue<Edge> pq = new PriorityQueue<>();

		cost[source] = 0;
		pq.add(obj.new Edge(source, source, 0));

		while (!pq.isEmpty()) {
			Edge e = pq.poll();
			if (visited.contains(e.to)) {
				continue;
			}
			visited.add(e.to);
			cost[e.to] = e.cost;

			for (Edge f : graph[e.to]) {
				pq.offer(obj.new Edge(f.from, f.to, f.cost + e.cost));
			}

		}
		for (int e : cost) {
			if (e != 1 << 30) {
				System.out.println(e);
			} else {
				System.out.println("INF");
			}
		}

	}

}



Measured memory_bytes: 331568
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <vector>
#include <queue>
#include <iostream>
#include <set>
#include <map>
#include <string>
#include <algorithm>

using namespace std;

#define mod 1e9+7
#define ll long long int
#define epsilon 1e-7

ll mi(ll x, ll y){
    if(x<y)return x;
    return y;
}
struct hoge
{
    int type, p;
};
struct hoge arr[200000];
int compare_int(const void *a, const void *b){
	struct hoge *A = (struct hoge *)a;
	struct hoge *B = (struct hoge *)b;
    return (B->p) - (A->p);
}
int main(void){
    int n, h;
    scanf("%d %d", &n, &h);
    for(int i = 0;i < n;i++){
        scanf("%d %d", &arr[i*2].p, &arr[i*2+1].p);
        arr[i*2].type = 0;
        arr[i*2+1].type = 1;
    }
    qsort(arr, n * 2, sizeof(struct hoge), compare_int);
    int count = 0;
    int d = 0;
    int i = 0;
    while(d < h){
        if(arr[i].type){
            d += arr[i].p;
            count++;
        }else{
            count += ceil((double)(h-d)/(double)arr[i].p);
            break;
        }
        i++;
    }
    printf("%d\n", count);
    return 0;
}


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

a = list(map(int,input().split()))

sum = 0
for n in a:
    sum += n

ave = float(sum) / N

ans_content = N
for i,n in enumerate(a):
    if ans_content > abs(n-ave):
        ans = i
        ans_content = abs(n-ave)

print(ans)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
vector<int> adj[200200];
int main(){
	
	int n,m; cin>>n>>m; int arr[n];
	for(int i = 0; i < n;i++){
		cin>>arr[i];
	}
	for(int i = 0; i < m; i++){
		int x,y; cin>>x>>y;
		adj[x].push_back(y);
		adj[y].push_back(x);
	}
	int co = 0;
	for(int i = 0; i < n; i++){
		bool flag = true;
		for(auto xx : adj[i+1]){
			if(arr[xx-1] >= arr[i]) flag = false;
		}
		if(flag) co++;
	}
	cout<<co<<"\n";
}

Measured memory_bytes: 11432
#include <iostream>

int main(void){
	int a, b, c;
	int c5=0, c7=0;
	std::cin >> a >> b >> c;
	if      (a == 5) c5++;
	else if (a == 7) c7++;
	if      (b == 5) c5++;
	else if (b == 7) c7++;
	if      (c == 5) c5++;
	else if (c == 7) c7++;
	if (c5==2 && c7==1)
		std::cout << "YES\n";
	else
		std::cout << "NO\n";
	
	return 0;	
}

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

using namespace std;
long long a[86] = {};
long long f(int n);
int main()
{
	int n;
	cin >> n;
	cout << f(n) << endl;
    return 0;
}
long long f(int n) {
	if (n == 0) return 2;
	else if (n == 1) return 1;
	else {
		if (a[n - 1] == 0) return a[n - 1] = f(n - 1) + f(n - 2);
		else return a[n - 1];
	}
}



Measured memory_bytes: 256
#include <stdio.h>
#include <algorithm>
#include <math.h>

using namespace std;


int main(){

	int id;
	double weight,height;

	while(scanf("%d,%lf,%lf",&id,&weight,&height)!=EOF){
		if((weight/(height*height)) >= 25.0){
			printf("%d\n",id);
		}
	}
	return 0;
}

Measured memory_bytes: 2588
def factorization(n):
    L=[]
    temp=n
    print(n,end="")
    print(":",end="")
    for i in range(2, int(n**(1/2)//1)+1):
        if temp%i==0:
            c=0
            while temp%i==0:
                c+=1
                temp//=i
            L.append([i, c])
            for j in range(c):
                print("",i,end="")
                

    if temp!=1:
        print("",temp,end="")

    print()

n=int(input()) 
factorization(n)


Measured memory_bytes: 5628
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
const int INT_INF = 2147483647;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
typedef pair<int,int> P;

const int mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};
// combination mod prime
// https://www.youtube.com/watch?v=8uowVvQ_-Mo&feature=youtu.be&t=1619
struct combination {
  vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
};

int main() {
  ll n,m,k;
  cin >> n >> m >> k;
  // 前処理
  combination c(200005);
  // 計算例
  mint w = c(n*m-2,k-2);
  // cout << now.x << endl;
  mint ans = 0;
  rep(i,n){
    ans += i*(n-i)*(pow(m,2));
  }
  rep(i,m){
    ans += i*(m-i)*(pow(n,2));
  }
  ans *= w;
  cout << ans.x << endl;
}


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

using ll = long long;
using ld = long double;
using pii = pair<int, int>;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))

int dx4[4] = {1,0,-1,0}, dy4[4] = {0,1,0,-1};

int main(){
    int n;
    string s;
    cin>>n>>s;
    //..## ni suru
    vector<int> b(n+1),w(n+1);
    for (int i = 0; i < n; i++)
    {
        b[i+1]=b[i];
        w[i+1]=w[i];
        if(s[i]=='.') w[i+1]++;
        else b[i+1]++;
    }
    int ans = n;
    for (int i = 0; i <= n; i++)
    {
        int tmp = b[i]+ (w[n]-w[i]);
        ans=min(ans,tmp);
    }
    
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 2180
N, W = (int(x) for x in input().split())
weights = []
values = []
for _ in range(N):
  w, v = (int(x) for x in input().split())
  weights.append(w)
  values.append(v)

sumValues = sum(values)
dp = [float('inf')] * (sumValues + 1) # Minimum weight at value v.
dp[0] = 0
for item in range(N):
  for value in range(sumValues-values[item], -1, -1):
    dp[value+values[item]] = min(dp[value+values[item]], dp[value]+weights[item])

res = 0
for i in range(sumValues+1):
  if dp[i] <= W:
    res = max(res, i)
print(res)

Measured memory_bytes: 77548