akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <climits>
#include <cstring>

#define rep(i, m, n) for(int i=int(m);i<int(n);i++)
#define all(c) begin(c),end(c)

template<typename T1, typename T2>
inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }

template<typename T1, typename T2>
inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }

//改造
typedef long long int ll;
using namespace std;
#define INF (1 << 30) - 1
#define INFl (ll)5e15
#define DEBUG 0 //デバッグする時1にしてね
#define dump(x)  cerr << #x << " = " << (x) << endl
#define MOD 1000000007


//ここから編集する
class Solve {
public:
    void input() {

    }

    void solve() {
        input();
        int a, b;

        cin >> a >> b;
        cout << (a - b) + 1 << endl;
    }
};


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

    Solve().solve();


    return 0;
}


Measured memory_bytes: 256
import itertools

n = int(input())

tl = [i for i in range(1, n+1) if i % 10 != 0]

"""
l = list(itertools.product(tl, tl))

# print(l)

ans = []
count = 0
for pair in l:
    a = str(pair[0])
    b = str(pair[1])
    if (a[0] == b[len(b)-1]) and (a[len(a)-1] == b[0]):
        count += 1
        # ans.append(pair)

print(count)
# print(ans)
"""

c = [[0 for j in range(10)] for i in range(10)]
for k in range(1, n+1):
    i = int(str(k)[0])  # 先頭 k=114514 なら1
    j = int(str(k)[len(str(k))-1])  # 末尾 k=114514 なら4
    c[i][j] += 1

count = 0
# print(c)
for i in range(10):
    for j in range(10):
        count += c[i][j]*c[j][i]

print(count)


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

#define pb(x) push_back(x)
#define all(x) x.begin(),x.end()
#define mp(x,y) make_pair(x,y)
#define fi first
#define se second

typedef long long ll;
typedef pair<ll,ll> pll;
typedef pair<ll,int> pli;
typedef pair<ll,pair<int,ll> > plpil;

int N;
ll ans = 0;
bool used[100010] = {0};
vector<pli> X,Y;
vector<pli> E[100020];

int main()
{
    scanf("%d",&N);
    for(int i = 0; i < N; i++)
    {
        ll a,b;
        scanf("%lld%lld",&a,&b);
        X.pb(mp(a,i));Y.pb(mp(b,i));
    }
    sort(all(X));sort(all(Y));
    for(int i = 0; i < X.size() - 1; i++)
    {
        ll xl = X[i + 1].fi - X[i].fi,yl = Y[i + 1].fi - Y[i].fi;
        E[X[i].se].pb(mp(xl,X[i + 1].se));E[X[i + 1].se].pb(mp(xl,X[i].se));
        E[Y[i].se].pb(mp(yl,Y[i + 1].se));E[Y[i + 1].se].pb(mp(yl,Y[i].se));
    }
    priority_queue<pli, vector<pli>, greater<pli> > Q;
    Q.push(mp(0,0));
    while(Q.size())
    {
        pli now = Q.top();
        Q.pop();
        if(used[now.se])continue;
        used[now.se] = true;
        ans += now.fi;
        for(int i = 0; i < E[now.se].size(); i++)
        {
            Q.push(mp(E[now.se][i].fi,E[now.se][i].se));
        }
    }
    printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 20324
n = gets.to_i

countA = 0
countB = 0

for i in 1..n
    input = gets.chomp.split(" ")

    if input[0] == input [1]
        countA += 1
        countB += 1
        next
    end

    tmp = [input[0], input[1]]
    tmp.sort!
    
    if input[0] == tmp[0]
        countB += 3
    else
        countA += 3
    end
end

puts "#{countA} #{countB}"


Measured memory_bytes: 8900
# https://atcoder.jp/contests/abc149/tasks/abc149_d
# r = グー, s=ちょき、p=パー


def main():
    (n, k) = map(int, input().split(" "))
    (point_goo, point_choki, point_par) = map(int, input().split(" "))
    pattern = input()
    # rのときパーで勝てる、sのときグーで勝てる,pのときちょきで勝てる
    # k手前と同じ手は使えないという制約がある
    # つまり一手目から最善手を使えば最大点になるとは限らないということ
    # 途中であえて負ける必要性も出てくる
    # また単純に得点の高い手のときは勝つようにするというのもうまく行かない可能性もある
    point = {"r": point_goo, "s": point_choki, "p": point_par, "-": 0}
    win = {"r": "p", "s": "r", "p": "s", "-": "-"}
    total = 0
    for i in range(n - k):
        total += point[win[pattern[i]]]
        if pattern[i] == pattern[i + k]:
            tmp = pattern[:i + k] + "-" + pattern[i + k + 1:]
            pattern = tmp
    for i in range(n - k, n):
        total += point[win[pattern[i]]]
    print(total)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3472
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cstdlib>
#include<queue>

using namespace std;

#define rep(i, n) for(int i = 0; i < n; i++)
#define P pair<int, int>

int main(){
    int n, m;
    cin >> n >> m;
    int a[m];
    rep(i, m) cin >> a[i];
    rep(i, m) n -= a[i];
    cout << max(n, -1) << endl;
    
}


Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
  long long n;
  cin >> n;
  long long a[n];
  bool f=true;
  for(int i=0;i<n;i++){
    cin >> a[i];
    if(a[i]%2==1){
      f=false;
    }
  }
  if(f){
    cout << "second\n";
  }else{
    cout << "first\n";
  }
  return 0;
}


Measured memory_bytes: 1024
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        long h = sc.nextLong();
        long w = sc.nextLong();
        
        long a = 0;
        long b = 0;
        long c = 0;
        long answer = Long.MAX_VALUE;
        long max, min;

            
            // System.out.println(a + " " + b + " " + c);
        // pattern A
        for (long i = 1; i <= h - 2; i++) {
            a = i * w;
            if ((h - i) % 2 == 0) {
                b = (h - i) / 2 * w;
                c = (h - i) / 2 * w;
            } else {
                b = (h - i) / 2 * w;
                c = ((h - i) / 2 + 1) * w;
            }
            
            max = Math.max(Math.max(a, b), c);
            min = Math.min(Math.min(a, b), c);
            answer = Math.min(answer, max - min);
        }
        
        // pattern B
        for (long i = 1; i <= h - 1; i++) {
            a = i * w;
            if (w % 2 == 0) {
                b = (h - i) * (w / 2);
                c = (h - i) * (w / 2);
            } else {
                b = (h - i) * (w / 2);
                c = (h - i) * (w / 2 + 1);
            }
            
            max = Math.max(Math.max(a, b), c);
            min = Math.min(Math.min(a, b), c);
            answer = Math.min(answer, max - min);
        }
        
        // pattern C
        for (long i = 1; i <= w - 2; i++) {
            a = i * h;
            if ((w - i) % 2 == 0) {
                b = (w - i) / 2 * h;
                c = (w - i) / 2 * h;
            } else {
                b = (w - i) / 2 * h;
                c = ((w - i) / 2 + 1) * h;
            }
            
            max = Math.max(Math.max(a, b), c);
            min = Math.min(Math.min(a, b), c);
            answer = Math.min(answer, max - min);
        }
        
        // pattern D
        for (long i = 1; i <= w - 1; i++) {
            a = i * h;
            if (h % 2 == 0) {
                b = (w - i) * (h / 2);
                c = (w - i) * (h / 2);
            } else {
                b = (w - i) * (h / 2);
                c = (w - i) * (h / 2 + 1);
            }
            
            max = Math.max(Math.max(a, b), c);
            min = Math.min(Math.min(a, b), c);
            answer = Math.min(answer, max - min);
        }
        
        System.out.println(answer);
    }
}


Measured memory_bytes: 22356
#include <bits/stdc++.h>
#include <ext/rope>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#define int long long
#define pb push_back
#define x first
#define y second
#define mk(a,b) make_pair(a,b)
#define rr return 0
#define sqr(a) ((a)*(a))
#define all(a) (a).begin(), (a).end()
#define sz(a) (int)(a).size()

using namespace std;
using namespace __gnu_cxx;
using namespace __gnu_pbds;

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

template<class value, class cmp = less<value> >
using ordered_set = tree<value, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
template<class value, class cmp = less_equal<value> >
using ordered_multiset = tree<value, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
template<class key, class value, class cmp = less<key> >
using ordered_map = tree<key, value, cmp, rb_tree_tag, tree_order_statistics_node_update>;

/// find_by_order()
/// order_of_key()
mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
inline int randll(int l = INT_MIN, int r = INT_MAX) {
    return uniform_int_distribution<int>(l, r)(rng);
}
const int INF = 1e9, MOD = 1e9 + 7; /// think
const ll LINF = 1e18;


const int dx[] = {0, 0, 1, -1}, dy[] = {1, -1, 0, 0};
inline bool inside (int x, int y, int n, int m) {
    return 0 <= x && 0 <= y && x < n && y < m;
}

template<class T> bool umin (T &a, T b) {return a > b ? (a = b, true) : false; }
template<class T> bool umax (T &a, T b) {return a < b ? (a = b, true) : false; }


inline vector<int> do_it (vector <int> a, vector <int> b, int n) {
    vector <int> ans(n);
    for (int i = 0; i < n; i++) {
        ans[i] = b[a[i]];
    }
    return ans;
}

inline vector<int> binpow (vector <int> a, int n, ll k) {
    vector <int> ans(n);
    for (int i = 0; i < n; i++) ans[i] = i;
    for (; k; k >>= 1ll) {
        if (k & 1ll) {
            ans = do_it(ans, a, n);
        }
        a = do_it(a, a, n);
    }
    return ans;
}

main()
{
    ios::sync_with_stdio(0);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n;
    ll k;
    cin >> n >> k;
    vector <int> a(n);
    for (auto &i : a) {
        cin >> i;
        --i;
    }
    for (auto &i : binpow(a, n, k)) {
        cout << i + 1 << ' ';
        break;
    }
    cout << '\n';
}


Measured memory_bytes: 8004
//selectionSort

#include<iostream>

using namespace std;
static const int MAX = 100;

void selectionSort(int array[], int N){
  int i,j,min,tmp;
  int count = 0;
  for(i = 0 ; i < N ; i++){
    min = i;
    for(j = i + 1 ; j < N ; j++){
      if(array[j] < array[min]) min = j;
    }
    tmp = array[i];
    array[i] = array[min];
    array[min] = tmp;
    if(i != min) count++;
  }
  for(i = 0 ; i < N ; i++){
    if(i > 0) cout << " ";
    cout << array[i];
  }
  cout << endl;
  cout << count << endl;
}

int main(){
  int N,array[MAX];
  cin >> N;

  for(int i = 0 ; i < N ; i++) cin >> array[i];
  selectionSort(array,N);
}



Measured memory_bytes: 3096
from itertools import product
import numpy as np

h, w, k = list(map(int, input().split()))
ss = []
for i in range(h):
    s = input()
    s = s.replace("#", "1").replace(".", "0")
    s = list(map(int, list(s)))
    ss.append(s)
ss = np.array(ss)


c = 0
for bih in product([0, 1], repeat = h):
    s = ss.copy()
    s[np.array(bih) == 1] = 0
    for biw in product([0, 1], repeat = w):
        sss = s.copy()
        sss[:, np.array(biw) == 1] = 0
        if np.sum(sss) == k:
            c += 1
#             print(bih, biw)
print(c)

Measured memory_bytes: 27216
//答案错误 
#include<stdio.h>
int main()
{
	int n,m,i,cnt=0;
	int a[105]={0};
	int b[105]={0};
	while(~scanf("%d%d",&n,&m)){
		for(i=1;i<=n;i++){
			scanf("%d",&a[i]);
		}for(i=1;i<=n+1;i++){
			b[i]=b[i-1]+a[i];
		}for(i=0;i<n+1;i++){
			if(b[i]<=m){
				cnt++;
			}
		}printf("%d\n",cnt);
		cnt=0;
	}
}

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

int main(){
    int A, B, C;
    int K;

    cin >> A >> B >> C;
    cin >> K;

    vector<int> num;
    num.push_back(A);
    num.push_back(B);
    num.push_back(C);
    sort(num.begin(), num.end());

    cout << num[2]*pow(2,K)+num[0]+num[1] << endl;
    return 0;
}


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

using ll =  long long;
using pint =  pair<int,int>;

#define INF 99999999
#define rep(i,n) for(int (i)=0,temp=(int)(n);(i)<temp;++(i)) 
#define repi(i,start,end) for(int (i)=(start),temp=(int)(end);i<(end);++(i))
#define rfor(v,x) for(const auto& (x) : (v)) //xは値を表す
#define all(x) (x).begin(),(x).end()
#define SORT(v, n) sort((v), (v)+(n))
#define vsort(v) sort((v).begin(), (v).end())
#define vfsort(v,lambda) sort(all((v)),(lambda))
#define vint vector<int>
#define vvint vector<vector<int>> //vvint v(n,vint(n))のように宣言できる
#define vin(v) rep(i,(v).size()) {cin >> (v)[i];}
//最終奥義(使うときはINFも書き換えろ!!)
//#define int long long
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; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int ctoi(char c) {return c-'0';}
//lambda式 -> [&](int x, int y){return x<y;}
//vector内の重複を削除-> v.erase(unique(all(v)),v.end());

signed main(void){
  int n;cin >> n;
  set<int> a;
  rep(i,n){
    int t;cin >> t;
    if(a.find(t)==a.end())a.insert(t);
    else a.erase(t);
  }
  cout << a.size() << endl;


}


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

using namespace std;

using ll = long long;

const int MAXS = 10000;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<int> idxs(n), w(n), s(n);
    vector<ll> v(n);
    for (int i = 0; i < n; i++) {
        cin >> w[i] >> s[i] >> v[i];
        idxs[i] = i;
    }
    sort(idxs.begin(), idxs.end(), [&](const int i1, const int i2){return w[i1] + s[i1] < w[i2] + s[i2];});

    ll ans = 0;
    vector<ll> dp(MAXS + 1, 0);
    for (int i : idxs) {
        for (int j = s[i]; j >= 0; j--) {
            ans = max(ans, dp[j] + v[i]);
            if (j + w[i] <= MAXS) dp[j + w[i]] = max(dp[j + w[i]], dp[j] + v[i]);
        }
    }
    
    for (int i = 0; i <= MAXS; i++) ans = max(ans, dp[i]);
    cout << ans << endl;
    return 0;
}

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

int main() {
  int h,w;
  cin >>h>>w;
   for (int i=0; i<w+2 ; i++){
     cout<<"#";
   }
  cout <<endl;
  string str;
 
  for (int i=0;i<h;i++){ 
    cin >> str;
    cout <<"#"<<str<<"#"<<endl;
  }
  for (int i=0; i<w+2 ; i++){
     cout<<"#";
  }
  cout << endl;
}


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

using namespace std;

int main(){
    int n;
    cin >> n;
    int a[n];
    for(int i = 0; i < n; i++){
        cin >> a[i];
    }
    for(int i = 0; i < n; i++){
        if (a[i] % 2 == 0) {
            if (a[i] % 3 != 0 && a[i] % 5 != 0) {
                cout << "DENIED\n";
                return 0;
            }
        }
    }
    cout << "APPROVED\n";
}

Measured memory_bytes: 256
n=int(input())
a=[]
for _ in range(n):
    a.append(list(map(int,input().split())))
for i in range(1,n):
    a[i][0]+=max(a[i-1][1],a[i-1][2])
    a[i][1]+=max(a[i-1][0],a[i-1][2])
    a[i][2]+=max(a[i-1][1],a[i-1][0])
print(max(a[n-1]))


Measured memory_bytes: 63100
#include<bits/stdc++.h>
using namespace std;
const int maxn=2e5+5;
char s[maxn];
int main()
{
	int n,l,r,ans=0;
	scanf("%d%s",&n,s+1);
	l=1,r=n;
	while(l<r)
	{
		while(l<r&&s[l]=='R') l++;
		while(l<r&&s[r]=='W') r--;
		if(l<r) ans++;
		l++,r--;
	}
	printf("%d",ans);
}

Measured memory_bytes: 3916
#include <iostream>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
const ll mod = 1000000007;

ll rui[1010];

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

    rep(i, n) {
        cin >> rui[i+1];
        rui[i+1] += rui[i];
    }
	
	ll ans = 0;
	for(int i = 53; i >= 0; i--) {
        ll p = 1LL<<i;
		int c = 0;
		rep(j, n) {
			for(int k = j; k < n; k++) {
				ll t = rui[k+1] - rui[j];
                ll y = ans + p;
				if((t & y) == y) {
                    c++;
                }
			}
		}
		if(c >= K) {
            ans += p;
        }
	}

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

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

using namespace std;
typedef long long ll;

int main()
{
    int n;
    cin >> n;
    n %= 10;
    if(n==3){
        cout << "bon";
    }else if(n== 0 || n==1 || n==6 || n==8){
        cout << "pon";
    }else{
        cout << "hon";
    }
}


Measured memory_bytes: 3592
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
count = 0
ans = 0

N = i()

L = [0]*N

for x in range(1,100):
    for y in range(x,100):
        for z in range(y,100):
            n = x**2 + y**2 + z**2 +x*y + y*z + z*x
            if n > N:
                break
            if x == y and y == z:
                L[n-1] += 1
            elif x ==y or y == z or x == z:
                L[n-1] += 3
            else:
                L[n-1] += 6
for i in L:
    print(i)


Measured memory_bytes: 9176
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD=1e9+7;
const int INF=1e9;

int main(){
    ll a[2];
    cin>>a[0]>>a[1];
    ll f[2]={0LL,0LL};
    for(int i=0;i<2;i++){
        f[i]=(((a[i]+1)/2)&1)^(a[i]&1?0:a[i]);
    }
    cout<<(f[0]^f[1]^a[0])<<endl;
}


Measured memory_bytes: 256
import java.util.Map;
import java.util.Scanner;
import java.util.TreeMap;

class Main {

    public static void main(String[] args) {

        Scanner sc = null;
		Map<String, Integer> countTheFrequency = new TreeMap<String, Integer>();
        try {
            sc = new Scanner(System.in);
            String[] words = sc.nextLine().split(" ");

            int mostFrequent = 0;
            int longest = 0;
            String mostFrequentWord = "";
            String longestWord = "";
            for (String word : words) {
                countTheFrequency.put(word, countTheFrequency.containsKey(word) ? countTheFrequency.get(word) + 1 : 1);
                if (mostFrequent < countTheFrequency.get(word)) {
                    mostFrequent = countTheFrequency.get(word);
                    mostFrequentWord = word;
                }
                if (longest < word.length()) {
                    longest = word.length();
                    longestWord = word;
                }
            }

            System.out.println(mostFrequentWord + " " + longestWord);

        } finally {
            sc.close();
        }
    }
}

Measured memory_bytes: 26200
#include <bits/stdc++.h>
using namespace std;
int ans, n, x, y, k, z, A, B;
int a[1005][1005], b[1005][1005], c[1005][1005], d[1005][1005];
char ch, S[5];
int main(){
	scanf("%d%d",&n,&k);
	for (int i = 1; i <= n; ++ i) {
		scanf("%d %d %c", &x, &y, &ch);
		z = ch == 'B';
		if ((x / k) & 1) z ^= 1;
		if ((y / k) & 1) z ^= 1;
		x %= k; y %= k;
		if (z) ++ a[x][y], ++ c[x][y], ++ A;
		else ++ b[x][y], ++ d[x][y], ++ B;
	}
	for (int i = 0; i < k; ++ i)
		for (int j = 0; j < k; ++ j) {
			if (i) a[i][j] += a[i - 1][j];
			if (j) a[i][j] += a[i][j - 1];
			if (i && j) a[i][j] -= a[i - 1][j - 1];
			if (i) b[i][j] += b[i - 1][j];
			if (j) b[i][j] += b[i][j - 1];
			if (i && j) b[i][j] -= b[i - 1][j - 1];
		}
	for (int i = k - 1; ~ i; -- i)
		for (int j = k - 1; ~ j; -- j) {
			if (i < k - 1) c[i][j] += c[i + 1][j];
			if (j < k - 1) c[i][j] += c[i][j + 1];
			if (i < k - 1 && j < k - 1) c[i][j] -= c[i + 1][j + 1];
			if (i < k - 1) d[i][j] += d[i + 1][j];
			if (j < k - 1) d[i][j] += d[i][j + 1];
			if (i < k - 1 && j < k - 1) d[i][j] -= d[i + 1][j + 1];
		}
	for (int i = 0; i < k; ++ i)
	for (int j = 0; j < k; ++ j) {
		ans = max(ans, a[i][j] + c[i + 1][j + 1] + B - b[i][j] - d[i + 1][j + 1]);
		ans = max(ans, b[i][j] + d[i + 1][j + 1] + A - a[i][j] - c[i + 1][j + 1]);
	}
	printf("%d", ans);
	return 0;
}

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

int main() {
  string s;
  cin >> s;
  int c = s.size();
  vector<int> vec(c, 0);
  for (int i = 0; i < c; i++) {
    vec.at(i) = s[i] - '0';
  }
  int n = s.size() -2;
  vector<int> list(n, 0);
  for (int i = 0; i < n; i++) {
    list.at(i) = 100*vec.at(i) + 10*vec.at(i+1) + vec.at(i+2);
  }
  vector<int> result(n, 0);
  for (int i = 0; i < list.size(); i++) {
    if (753 - list.at(i) > 0) {
      result.at(i) = 753 - list.at(i);
    }
    else {
      result.at(i) = list.at(i) - 753;
    }
  }
  sort(result.begin(), result.end());
  cout << result.at(0) << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
int main(){
  int n;
  int ans=100000;
  int i;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    ans=ans*1.05;
    if(ans%1000!=0){
      ans/=1000;
      ans+=1;
      ans*=1000;
    }
    //printf("%d\n",ans);
  }
  printf("%d\n",ans);
  return 0;
}

Measured memory_bytes: 588
#include<iostream>
using namespace std;
int main(){

    long long int a,b;
    while(cin>>a>>b,a){
        int q=0,w=0,e=0;
        a=b-a;
        while(a!=0){
            if(a>=1000)e++,a-=1000;
            else if(a>=500)w++,a-=500;
            else if(a>=100)q++,a-=100;
        }
        cout<<q<<" "<<w<<" "<<e<<endl;

    }

    return 0;
}

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

using namespace std;

typedef pair<long long int, vector<long long int>> PLVL;


class combination{
public:

//Nの最大値がわかれば代入する
	combination(long long int combinationThreshold = 1e7){
		( *this ).combinationThreshold = combinationThreshold + 2;
	}

	//a^p % mod
	long long int powmod(long long int A, long long int P, long long int M = LLONG_MAX){
		long long int ans = 1;
		long long int mul = A;
		for( ; P > 0; P >>= 1, mul = ( mul*mul ) % M ){
			if( ( P & 1 ) == 1 ) ans = ( ans*mul ) % M;
		}
		return ans;
	}

	//nCk mod m
	long long int cb(long long int N, long long int K, long long int M = LLONG_MAX){
		if( N < combinationThreshold ){// 事前計算O(N)、答えるのはO(1)
			if( inv.size() == 0 ){
				inv = vector<long long int>(combinationThreshold);
				inv[1] = 1;
				for( long long int i = 2; i < combinationThreshold; i++ ){
					inv[i] = M - ( M / i )*inv[M%i] % M;
				}
				fact = vector<long long int>(combinationThreshold);
				fact[0] = 1;
				revFact = vector<long long int>
					(combinationThreshold);
				revFact[0] = 1;
				for( long long int i = 1; i < combinationThreshold; i++ ){
					fact[i] = ( fact[i - 1] * i ) % M;
					revFact[i] = ( revFact[i - 1] * inv[i] ) % M;
				}
			}
			return ( ( ( fact[N] * revFact[K] ) % M )*revFact[N - K] ) % M;
		} else{
			return cbOnce(N, K, M);
		}
	}

	//一回だけなら最速 O(K + log(M))
	long long int cbOnce(long long int N, long long int K, long long int M = LLONG_MAX){
		if( K > N / 2 ) return cbOnce(N, N - K, M);
		long long int ans = 1;
		long long int div = 1;
		for( long long int i = 0; i < K; i++ ){
			ans *= N - i;
			ans %= M;
			div *= i + 1;
			div %= M;
		}
		ans *= powmod(div, M - 2, M);
		return ans % M;
	}

private:
	vector<vector<long long int>>C;//3000以下の答え
	vector<long long int>fact;//階乗
	vector<long long int>revFact;//階乗の逆元
	vector<long long int>inv;//mod pでの逆元

	long long int combinationThreshold;//Nの最大値がわかれば入れる。
};





int main(){
	long long int N;
	cin >> N;
	vector<long long int>A(N);
	for( size_t i = 0; i < N; i++ ){
		cin >> A[i];
	}
	combination cb;
	sort(A.begin(), A.end());
	long double ans = 1050;
	long long int left = 0;
	long long int right = 0;
	for( size_t i = N - 1; i < N; i++ ){
		long long int d = A[i] / 2;
		long long int minv = 0, maxv = i;
		while( minv + 1 < maxv ){
			long long int midv = ( minv + maxv ) / 2;
			if( A[midv] < d ){
				minv = midv;
			} else{
				maxv = midv;
			}
		}
		long double num = 1.L*  A[minv] / A[i];
		if( ans > abs(num - 0.5) ){
			ans = abs(num - 0.5);
			left = A[i];
			right = A[minv];
		}
		if( A[i] != A[minv + 1] ){
			//cout << A[i] << " " << A[minv + 1] << endl;
			num = 1.L* ( A[i] - A[minv + 1] ) / A[i];
			//cout << num << endl;
			if( ans > abs(num - 0.5) ){
				ans = abs(num - 0.5);
				left = A[i];
				right = A[minv + 1];
			}
		}
	}
	cout << left << " " << right << endl;
}



Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repr(i,n) for(int i = (int)(n); i >= 0; i--)
#define all(v) v.begin(),v.end()
typedef long long ll;

ll gcd(ll a, ll b){
    ll r,temp;
    if (a < b){
        temp = a;
        a = b;
        b = temp;
    }
    while ( (r = a % b) != 0){
        a = b;
        b = r;
    }
    return b;
}

int main(){
    ll N,K;
    cin >> N >> K;
    vector<ll> A(N);
    rep(i,N) cin >> A[i];
    sort(all(A));
    ll gcd_num = A[0];
    rep(i,N) gcd_num = gcd(gcd_num, A[i]);
    bool possible = true;
    if (A[N - 1] < K) possible = false;
    if (K % gcd_num != 0) possible = false;
    
    if (possible) cout << "POSSIBLE" << endl;
    else cout << "IMPOSSIBLE" << endl;
}

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

typedef long long ll;

bool primeCheck(ll tar) {
	if (tar == 2)	return true;
	for (ll i = 3; i * i <= tar; i += 2) {
		if (tar % i == 0)return false;
	}
	return true;
}

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

	if (x % 2 == 0 && x != 2)x++;
	for (ll prime = x;; prime += 2) {
		if (primeCheck(prime)) {
			cout << prime << endl;
			return 0;
		}
	}

	return 0;
}

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

int main()
{
    /* Input */
    long long N, M, Q;
    std::cin >> N >> M >> Q;

    std::vector<long long> a(Q), b(Q), c(Q), d(Q);
    for (int i = 0; i < Q; i++)
    {
        std::cin >> a[i] >> b[i] >> c[i] >> d[i];
    }


    /* Solve */

    /**
     *  1 <= A1 <= A2 <= ... <= AN のタネを作る
     *      - 0: 仕切り
     *      - 1: ボール
     * ボールが仕切りのどこにあるかで配列を作る
     * 
     * e.g. N==3, M==4
     *      {1 | 2 | 3   | 4}
     *      {o |   | o o |  }
     *          => {1, 3, 3}
    */
    std::vector<long long> X(N + M-1, 1);
    for (int i = 0; i < M-1; i++) X[i] = 0;

    long long max_score = 0;
    do {
        // スコア初期化
        long long score = 0;

        // 配列 A を作る
        std::vector<long long> A;
        int cnt = 1;
        for (int i = 0; i < X.size(); i++)
        {
            if (X[i] == 1) A.push_back(cnt);
            else cnt++;
        }

        // スコア計算
        for (int i = 0; i < Q; i++)
        {
            if ((A[b[i]-1] - A[a[i]-1]) == c[i])
                score += d[i];
        }

        max_score = std::max(max_score, score);
    }
    while (std::next_permutation(X.begin(), X.end()));

    std::cout << max_score << std::endl;    

    return 0;
}

Measured memory_bytes: 3624
#include <iostream>
#include <vector>
#include <random>
using namespace std;
typedef long long ll;
int D;
int v=27;
vector<int> c(v,0);
vector<vector<int>> s;
vector<int> t;
vector<int> last(v,0);

void init(){
    cin >> D;
    s.resize(D+1);
    t.resize(D+1);
    for(int i=0;i<D+1;i++){
        s[i].resize(v);
    }

    for(int i=1;i<27;i++){
        cin >> c.at(i);
    }
    for(int i=1;i<D+1;i++){
        for(int j=1;j<27;j++){
            cin >> s.at(i).at(j);
        }
    }
/*
    for(int i=1;i<D+1;i++){
        cin >> t.at(i);
    }
*/

}

void init_last(){
  for(int i=0;i<v;i++){
    last.at(i) = 0;
  }
}

ll calc(){
    ll ans=0;
    init_last();
    for(int i=1;i<D+1;i++){
        ans += s.at(i).at(t.at(i));
        last.at(t.at(i)) = i;
        for(int j=1;j<v;j++){
            ans -= c.at(j) * (i - last.at(j));
        }
    }
    return ans;
}

int main(){
    init();

    std::random_device rd;

    std::mt19937 mt(rd());

    for(int i=1;i<D+1;i++){
        t.at(i) = mt() % 26 + 1;
    }

    ll sol = calc();
    ll trial = 1000;
    for(int i=0;i<trial;i++){
        int d,q;
        d = mt()%365 + 1;
        q = mt()%26 + 1;
        int old = t.at(d);
        t.at(d) = q;
        if(sol > calc()){
            t.at(d) = old;
        }
    }

    for(int i=1;i<D+1;i++){
        cout << t.at(i) << endl;
    }
  
  	return(0);
}

Measured memory_bytes: 3696
#include <stdio.h>

int main(void)
{
	int a,b,c;
	int count_1=0;
	int count_2=0;
	
	scanf("%d %d %d",&a,&b,&c);
	if(b>=c){
		printf("%d\n",b+c);
	}else{
		while(b!=0&&c!=0){
			b--;
			c--;
			count_1++;
		}
		
		if(b!=0){
			printf("%d\n",count_1*2);
		}else{
			while(a!=0&&c!=0){
				a--;
				c--;
				count_2++;
			}
			
			if(a>=c){
				printf("%d\n",count_1*2+count_2);
			}else{
				printf("%d\n",count_1*2+count_2+1);
			}
		}
	}
	
	return 0;
}
		

Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <math.h>
using namespace std;
int main(){
  cin.tie(NULL);
  ios::sync_with_stdio(false);
  int a,b,ans=0;
  cin>>a>>b;
  ans=a+b;
  if(ans%3==0){
    cout<<"Possible"<<"\n";
  }
  else{
    if(a%3==0 || b%3==0){
      cout<<"Possible"<<"\n";
    }
    else{
      cout<<"Impossible"<<"\n";
    }
  }

  return 0;
}

Measured memory_bytes: 3588
// Problem : E - Red Scarf
// Contest : AtCoder - AtCoder Beginner Contest 171
// URL : https://atcoder.jp/contests/abc171/tasks/abc171_e
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

//mst,pq,mp,st,q
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define io ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define pb push_back
#define all(x) begin(x),end(x)

int mod = 1e9+7;
int inf = 4e18;
const int N = 5e5+5;
		
signed main()
{
    io
    int tt = 1;
    //cin>>tt;
    while(tt--)
    {
		int n;
		cin>>n;
		int arr[n+1];
		for(int i=0;i<n;++i)
		cin>>arr[i];
		if(n==2)
		{
			cout<<arr[1]<<" "<<arr[0];
			return 0;
		}
		int pre[n+1] = {},suf[n+1] = {};
		pre[0] = arr[0];
		suf[n-1] = arr[n-1];  
		for(int i=1;i<n;++i)
		{
			pre[i] = pre[i-1]^arr[i];
		}
		for(int i=n-2;i>=0;--i)
		{
			suf[i] = suf[i+1]^arr[i];
		}
		for(int i=0;i<n;++i)
		{
			if(i!=0)
			cout<<(pre[i-1]^suf[i+1])<<" ";
			else
			cout<<suf[i+1]<<" ";
		}
			
    }
    return 0;
}


Measured memory_bytes: 8320
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < (n); i++)
#define REP1(i, n) for(int i = 1; i <= (n); i++)
#define REPD(i,a,b) for (int i=(a);i<=(b);i++)
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef set<int> si;
typedef vector<si> vsi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<int, int> pi;
typedef queue<int> qi;
typedef queue<pi> qpi;
typedef pair<ll, ll> pll;
typedef queue<pll> qpll;
typedef vector<pi> vpi;
typedef vector<pll> vpll;
const int mod = 1000000007;
const int INF = 1001001001;
// 小数点　<< fixed << setprecision(0) <<
// sort降順　sort(ALL(),greater<int>());
// 円周率　M_PI
// 文字判定　isupper islower
// 文字変換　
// 順列　do {} while(next_permutation(ALL(X)));
// 最大値　LLONG_MAX
// a内でx以上　auto iter = lower_bound(ALL(a), x);
// a内でxより大きい　auto iter = upper_bound(ALL(a), x);
int dx[8] = {1, 0, -1, 0, 1, 1, -1, -1};
int dy[8] = {0, 1, 0, -1, 1, -1, 1, -1};
struct edge {
    int from; //出発点
    int to;   //到達点
    int cost; //移動コスト
};
typedef struct edge se;
typedef vector<edge> ve;
unsigned Euclidean_gcd(unsigned a, unsigned b) {
  if(a < b) return Euclidean_gcd(b, a);
  unsigned r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}

int digit_sum(int n) {
  int sum=n%10;
  while(n!=0) {
    n/=10;
    sum+=n%10;
  }
  return sum;
}

vpll PrimeFactorization(ll n) {
  vpll res;
  for (ll i=2; i*i<=n; i++) {
    if(n%i!=0) continue;
    ll ex=0;
    while(n%i==0) {
      ex++;
      n/=i;
    }
    res.push_back(pll(i,ex));
  }
  if(n!=1) res.push_back(pll(n,1));
  return res;
}


int main() {  
  int n;
  cin >> n;
  vi h(n);
  REP(i,n) cin >> h[i];
  vi dp(n+1,INF);
  dp[0]=0;
  dp[1]=0;
  dp[2]=abs(h[0]-h[1]);
  REPD(i,3,n) {
    dp[i]=min(dp[i-1]+abs(h[i-1]-h[i-2]),dp[i-2]+abs(h[i-1]-h[i-3]));
  }
  cout << dp[n] << endl;
  return 0;
}


Measured memory_bytes: 4036
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <functional>
#include <string>
#include <cmath>  //sqrt 
#include <iomanip> //setprecision
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
#define ALL(a)  (a).begin(),(a).end()

void _main(){
    vector<int> x(5); rep(i,5) cin >> x[i];
    int outi = find(ALL(x),0)-x.begin() + 1;
    cout << outi << endl;
    return;
}
int main() {
    cout << fixed << setprecision(10);
    _main();
    return 0;
}
    

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

int find(int n){
  int sum=0 ;
    while(n > 0){
      sum += n%10;
      n /= 10;
    }
    return sum;
}

int main(){
  int N,A,B;
  cin >> N >> A >> B ;
  int total = 0;

  for(int i=1; i<=N; i++){
    int sum = find(i);
    if(sum >= A && sum <=B ) total += i;
  }

  cout << total << endl;
}


Measured memory_bytes: 256
use proconio::input;

fn main() {
    input! {
        mut n: i32,
        m: i32,
        a: [i32;m]
    }

    for x in a.iter() {
        n = n-x;
    }
    if n < 0 {println!("-1")}else{    println!("{}", n)}
}

Measured memory_bytes: 2216
#include<stdio.h>
int main()
{
    int n,m,k,i,j,c,t;
    scanf("%d %d",&n,&m);
    int a[m+5],b[m*n],cnt[m+5];
    c=0;
    for(i=1;i<=n;i++)
    {
        scanf("%d",&k);
         for(j=0;j<k;j++)
         {
            scanf("%d",&a[j]);
            b[c]=a[j];
            c++;
         }
    }
    for(i=0;i<=m;i++)
    {
        cnt[i]=0;
     }
       for(i=0;i<c;i++)
     {
       cnt[b[i]]++;
     }
     t=0;
      for(i=0;i<=m;i++)
     {
       if(cnt[i]==n)
       {
           t++;

       }

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




    }



Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define all(x) (x).begin(),(x).end()
using namespace std;
const int INF=1145141919,MOD=1e9+7;
const int64_t LINF=8931145141919364364,LMOD=998244353;
// const int dy[]={0,-1,0,1,1,-1,-1,1};
// const int dx[]={1,0,-1,0,1,1,-1,-1};

int main() {
	string s; cin >> s;
	if(s == "AAA" or s == "BBB") {
		cout << "No" << '\n';
	} else {
		cout << "Yes" << '\n';
	}
	return 0;
}

Measured memory_bytes: 256
/*
How to lambda
  ex) sort(ALL(cont),[](dat a,dat b){return a.l<b.l;});
lower_bound/upper_bound
  1 2 2 2 3 3 
    ^lb   ^ub */
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#define BR "\n"
#define REP(i,n) for(int (i)=0;(i)<(n);++(i))
#define ALL(cont) begin(cont),end(cont)
#define AS_MOD(a,b) ((((a) % (b) ) + (b)) % (b))
#define FEACH(it,cont) for(auto (it) = begin(cont); it!=end(cont);++it)
#define FEACHR(it,cont) for(auto (it) = rbegin(cont); it!=rend(cont);++it)
#define pb push_back
#define pob pop_back
#define fi first
#define se second
#define getll() ([](){ll s;scanf("%lld", &s);return s;})()
#define getld() ([](){ld s;scanf("%Lf", &s);return s;})()
#define prl(P) printf("%lld", P)
#define prd(P) printf("%.10Lf", P)
#define pr(P) printf(P)
#define assign_if_greater(V, T) V=max(V,T)
using namespace std;
typedef long long ll;
typedef long double ld;
int A,B,Q;
ll As[100000];
ll Bs[100000];
ll INF=(ll)1000*1000*1000*1000;
ll fastGet() {
  ll ret=0;
  char c=getchar_unlocked();
  // skipping
  while(c<'0' || c > '9') c=getchar_unlocked();
  do {
    ret *= 10;
    ret += (c-'0');
    c = getchar_unlocked();
  } while(c>='0' && c<='9');
  return ret;
}
void fastPut(ll v) {
  char s[256];
  int p=0;
  do {
    s[p++]=(v%10)+'0';
    v/=10;
  } while(v>0);
  while(p--)
    putchar_unlocked(s[p]);
}
int main() {
  A=fastGet();
  B=fastGet();
  Q=fastGet();
  REP(i,A)
    As[i]=fastGet();
  REP(i,B)
    Bs[i]=fastGet();
  REP(i,Q) {
    ll x=fastGet();
    ll* ita=lower_bound(As, As+A, x);
    ll* itb=lower_bound(Bs, Bs+B, x);
    ll ans=INF;
    ll alis[2],blis[2];
    alis[0]=ita!=As+A?*ita:INF;
    blis[0]=itb!=Bs+B?*itb:INF;
    alis[1]=ita!=As?ita[-1]:-INF;
    blis[1]=itb!=Bs?itb[-1]:-INF;
    for(ll a:alis)
      for(ll b:blis) {
        ans = min(ans,abs(a-x)+abs(b-a));
        ans = min(ans,abs(b-x)+abs(b-a));
      }
    fastPut(ans);
    putchar_unlocked('\n');
  }
  return 0;
}


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

#define rep(i, a, b) for (int i = int(a); i < int(b); i++)
#define rrep(i, a, b) for (int i = int(a) - 1; i >= b; i--)
#define sz(x) (int)(x).size()

using namespace std;
using ll = long long;

const ll INF = 1e18;
const ll MOD = 1e9 + 7;

int main() {
  ll A, B, M;
  cin >> A >> B >> M;
  vector<ll> a(A), b(B);
  ll mna = INF, mnb = INF;
  rep(i, 0, A) {
    cin >> a[i];
    mna = min(mna, a[i]);
  }
  rep(i, 0, B) {
    cin >> b[i];
    mnb = min(mnb, b[i]);
  }
  vector<ll> x(M), y(M), z(M);
  rep(i, 0, M) cin >> x[i] >> y[i] >> z[i];

  ll ans = mnb + mna;
  rep(i, 0, M) {
    ans = min(ans, (a[x[i] - 1] + b[y[i] - 1] - z[i]));
    // cout << a[x[i] - 1] << " " << b[y[i] - 1] << " " << z[i] << endl;
    // cout << ans << endl;
  }
  cout << ans << endl;
}


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

using namespace std;

multiset<int > s;
int k;
int x;
int main(){
    int arr[3];
    cin>>arr[0]>>arr[1]>>arr[2];
    sort(arr,arr+3);
    int ope;
    cin>>ope;
    for(int i=0;i<ope;++i)
        arr[2]=arr[2]*2;
    for(int i=1;i<3;++i)
        arr[0]+=arr[i];
    cout<<arr[0];

    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define fr(i,n) for (int i=0;i<n;i++)
#define rep(i,a,b) for (int i=a;i<=b;i++)
#define per(i,a,b) for (int i=a;i>=b;i--)
#define all(cont) cont.begin(), cont.end()
#define unique(a)  sort(all(a)) , (a).erase(unique((a).begin(), (a).end()),(a).end())
#define rall(cont) cont.rbegin(), cont.rend()
#define sz(x) (int)(x).size()
#define fastio          ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define PB push_back
#define endl "\n"
#define f first
#define s second
#define mset(m,v) memset(m,v,sizeof(m))
#define mod 1000000007
const int N = 2e5 + 5;
#define PI acos(-1.0)
long double EPS = 1e-9;
typedef long long ll;
#define int long long
typedef long double ld;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef vector<pair<int, int>> vpii;
#define pqll_max priority_queue<ll> // max heap. push(),pop(),top(),size(),empty()
#define pqll_min priority_queue<ll,vector<ll>,greater<ll> >
#define lb(v,val)   lower_bound(v.begin(),v.end(),val) //first equal to or lower than [------------
#define ub(v,val)   upper_bound(v.begin(),v.end(),val) //first greater than ------------)
#define bs(v,x) binary_search(v.begin(),v.end(),x)
inline ll add(ll x, ll y) { x += y; if (x >= mod) x -= mod; return x; }
inline ll sub(ll a, ll b) { if (a < b)swap(a, b); return (((a%mod) - (b%mod) + mod) % mod); }
inline ll mul(ll x, ll y) { return (x%mod * 1ll * y%mod) % mod; }
inline ll pwr(ll a, ll b) { ll x = 1 % mod; while (b) { if (b & 1) x = mul(x, a); a = mul(a, a); b >>= 1; }return x % mod; }
inline ll inv(ll a) { return pwr(a, mod - 2) % mod; }
ll gcd(ll a, ll b) { if (!a)return b % mod; return gcd(b%a, a) % mod; }
#define debug(x) cout << #x << " = " << x << endl;
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
	cout << name << " : " << arg1 << 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...);
}
#define in(container) for (auto &it : container) cin>>it;
#define out(container) for (auto it : container) cout << it << " "; cout << endl;
void pre() {
}
void solve() {
	int n;
	cin >> n;
	cout << 2 * PI*n << endl;
}
signed main()
{
	fastio;
	cout<<fixed<<setprecision(15);
	//clock_t begin = clock();
	//pre();
	int tc;
	tc = 1;
	//cin >> tc;
	while (tc--) {
		solve();
	}
	//clock_t end = clock();double elapsed_secs = double(end - begin) / CLOCKS_PER_SEC;cerr << elapsed_secs;
}


Measured memory_bytes: 3816
def gcd(a,b):
  if b==0:
    return a
  else:
    return gcd(b,a%b)

mod=10**9+7
n=int(input())
dic={}
cnt=0
for _ in range(n):
  a,b=map(int,input().split())
  if a!=0 and b!=0:
    g=gcd(abs(a),abs(b))
    if a*b>0:
      if (abs(a)//g,abs(b)//g) not in dic:
        dic[(abs(a)//g,abs(b)//g)]=1
      else:
        dic[(abs(a)//g,abs(b)//g)]+=1
    else:
      if (-abs(a)//g,abs(b)//g) not in dic:
        dic[(-abs(a)//g,abs(b)//g)]=1
      else:
        dic[(-abs(a)//g,abs(b)//g)]+=1
  else:
    if a==0 and b==0:
      cnt+=1
    elif a==0:
      if (1,0) not in dic:
        dic[(1,0)]=1
      else:
        dic[(1,0)]+=1
    elif b==0:
      if (0,1) not in dic:
        dic[(0,1)]=1
      else:
        dic[(0,1)]+=1
ans=1
s=set()
for a,b in dic.keys():
  if (a,b) in s:
    continue
  s.add((a,b))
  if a*b!=0:
    if a>0:
      if (-b,a) in dic:
        s.add((-b,a))
        cnt1=dic[(a,b)]
        cnt2=dic[(-b,a)]
        ans*=(pow(2,cnt1,mod)+pow(2,cnt2,mod)-1)%mod
        ans%=mod
      else:
        ans*=pow(2,dic[(a,b)])
        ans%=mod
    elif a<0:
      if (b,-a) in dic:
        s.add((b,-a))
        cnt1=dic[(a,b)]
        cnt2=dic[(b,-a)]
        ans*=(pow(2,cnt1,mod)+pow(2,cnt2,mod)-1)%mod
        ans%=mod
      else:
        ans*=pow(2,dic[(a,b)])
        ans%=mod
  else:
    if (b,a) in dic:
      s.add((b,a))
      cnt1=dic[(a,b)]
      cnt2=dic[(b,a)]
      ans*=(pow(2,cnt1,mod)+pow(2,cnt2,mod)-1)%mod
      ans%=mod
    else:
      ans*=pow(2,dic[(a,b)])
      ans%=mod
print((ans+cnt-1)%mod)

Measured memory_bytes: 141724
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << x << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
typedef long long ll;
int N,V;
const int MAX_V=35;
vector<int> G[MAX_V];
bool used[MAX_V];
int ord[MAX_V];
int cnt[MAX_V];		//cnt[v] = the num of selected verticies connected with v;
typedef long long ll;
set<ll> done;

bool can1(){
	rep(i,N) if(!G[i].empty()) return 0;
	return 1;
}
int vis[MAX_V];
bool dfs2(int v,bool t){
	vis[v]=t;
	for(int u:G[v]) if(!used[u]){
		if(vis[u]<0){
			if(!dfs2(u,!t)) return 0;
		}else{
			if(t==vis[u]) return 0;
		}
	}
	return 1;
}
bool can2(){
	rep(i,N) vis[i]=-1;
	rep(i,N) if(!used[i]&&vis[i]<0){
		if(!dfs2(i,0)) return 0;
	}
	return 1;
}
bool c3;
void dfs(int it){
	if(it==V){
		ll x=0;
		rep(i,V) if(used[i]) x|=(1LL<<i);
		if(done.find(x)!=done.end()) return;
		done.insert(x);
//		rep(i,V) cout<<used[i];
//		puts("");
		if(can2()) c3=1;
		return;
	}
	int v=ord[it];
	if(used[v]||cnt[v]){
		dfs(it+1);
		return;
	}
	//use v
	used[v]=1;
	for(int u:G[v]) cnt[u]++;
	dfs(it+1);
	used[v]=0;
	for(int u:G[v]) cnt[u]--;

	for(int u:G[v]) if(cnt[u]==0&&!used[u]){
		used[u]=1;
		for(int w:G[u]) cnt[w]++;
		dfs(it+1);
		used[u]=0;
		for(int w:G[u]) cnt[w]--;
	}
}
void enum_ind(int N){
	V=N;
	typedef pair<int,int> P;
	vector<P> tmp;
	rep(i,N) tmp.pb(P(G[i].size(),i));
	sort(all(tmp));
	rep(i,N) ord[i]=tmp[i].sc;
	rep(i,N) used[i]=0,cnt[i]=0;
	done.clear();
	dfs(0);
}

bool can3(){
	c3=0;
	enum_ind(N);
	return c3;
}


typedef double D;
typedef complex<D> P;
typedef pair<P,P> L;
typedef vector<P> Pol;
D eps=1e-8;
bool eq(D a,D b){return abs(a-b)<eps;}
int sig(D x){return eq(x,0)?0:(x>0?1:-1);}
D cro(P a,P b){return imag(conj(a)*b);}
bool ispal(L a,L b){
	return sig(cro(a.fs-a.sc,b.fs-b.sc))==0;
}
bool hasLen(L a,L b){
	if(!ispal(a,b)) return 0;
	if(sig(cro(a.sc-a.fs,b.fs-a.fs))!=0) return 0;
	P p=(a.sc-a.fs)*P(0,1);
	D x=cro(a.fs-a.fs,p),y=cro(a.sc-a.fs,p),z=cro(b.fs-a.fs,p),w=cro(b.sc-a.fs,p);
	if(x>y) swap(x,y);
	if(z>w) swap(z,w);
	return z+eps<y&&x+eps<w;
}
Pol pol[MAX_V];
int main(){
	while(true){
		cin>>N;
		if(N==0) break;
		rep(i,N) pol[i].clear();
		rep(i,N) G[i].clear();
		rep(i,N){
			int s;
			cin>>s;
			rep(j,s){
				int x,y;
				cin>>x>>y;
				pol[i].pb(P(x,y));
			}
		}
		rep(i,N) rep(j,i){
			bool is=0;
			rep(a,pol[i].size()) rep(b,pol[j].size()){
				L x=L(pol[i][a],pol[i][(a+1)%pol[i].size()]);
				L y=L(pol[j][b],pol[j][(b+1)%pol[j].size()]);
				if(hasLen(x,y)) is=1;
			}
			if(is) G[i].pb(j),G[j].pb(i);
		}
/*		rep(i,N){
			cout<<i<<"   ";
			for(int v:G[i]) cout<<v<<" ";
			puts("");
		}*/
		if(can1()) puts("1");
		else if(can2()) puts("2");
		else if(can3()) puts("3");
		else puts("4");
	}
}

Measured memory_bytes: 17796
import math

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

count = 0
countMax = 0

for i in range(N - 1):
	if H[i] >= H[i + 1]:
		count+=1
		countMax = max(count,countMax)
	else:
		count = 0

print(countMax)

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

typedef long long ll;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define each(itr,c) for(__typeof(c.begin()) itr=c.begin(); itr!=c.end(); ++itr)
#define all(x) (x).begin(),(x).end()
#define mp make_pair
#define pb push_back
#define fi first
#define se second

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

    vector<int> p(m);
    rep(i,m)
    {
        scanf(" %d", &p[i]);
        --p[i];
    }

    vector<int> a(n-1),b(n-1),c(n-1);
    rep(i,n-1) scanf(" %d %d %d", &a[i], &b[i], &c[i]);

    //??????i??????????????°
    int ct[100002]={0};
    rep(i,m-1)
    {
        int l=min(p[i],p[i+1]), r=max(p[i],p[i+1]);

        ++ct[l];
        --ct[r];
    }

    rep(i,n) ct[i+1]+=ct[i];

    ll ans=0;
    rep(i,n-1)
    {
        ll x=(ll)a[i]*ct[i];
        ll y=(ll)b[i]*ct[i]+c[i];
        ans+=min(x,y);
    }

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

Measured memory_bytes: 4712
#include <bits/stdc++.h>
using namespace std;
int main(){
int A,B,C,D;
  cin>>A>>B>>C>>D;
  int ans=0;
  for(int i=0;i<100;i++){
    if(A<=i&&i<B&&C<=i&&i<D) ans++;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;


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

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

#define rep(i,n) for(int i = 0; i < n; i++)
#define Rep(i,n) for(int i = 1; i <= n; i++)
#define sz(x) int(x.size())
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define YesorNo(a) printf(a ? "Yes\n" : "No\n")
#define endl '\n'
#define fi first
#define se second
using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
template<class T> using V = vector<T>;
const int dx[] = {0,1,0,-1,1,1,-1,-1};
const int dy[] = {1,0,-1,0,1,-1,-1,1};
const int inf = (1<<30)-1;
const ll infll = (1LL<<62)-1;
ll ceil(const ll &a, const ll &b){return ((a)+(b)-1)/b;}
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; }

struct op {int x, y, x2, y2;};

int main(){
    
    int h, w;
    cin >> h >> w;
    V<V<int>> a(h,V<int>(w));
    rep(i,h)rep(j,w) cin >> a[i][j];

    V<op> ops;
    int cur = 0;
    rep(i,h) {
        cur = 0;
        rep(j,w) {
            a[i][j] += cur;            
            if(j != 0 && cur) ops.push_back(op{i, j-1, i, j});
            cur = (a[i][j] % 2);
        }
    }

    cur = 0;
    rep(i,h) {
        a[i][w-1] += cur;
        if(i != 0 && cur) ops.push_back(op{i-1, w-1, i, w-1});
        cur = (a[i][w-1] % 2);
    }

    int ans = sz(ops);
    cout << ans << endl;
    rep(i,ans) {
        printf("%d %d %d %d\n", ops[i].x+1, ops[i].y+1, ops[i].x2+1, ops[i].y2+1);
    }

}

Measured memory_bytes: 6280
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(k,i,n) for(ll i=k;i<n;++i)
int main(void){
    ll h,w,x,y;
    cin>>h>>w>>x>>y;
    cout<<fixed<<setprecision(10)<<(1.*h*w)/2.;
    cout<<" ";
    if(h==2*x && w==2*y)cout<<1<<endl;
    else cout<<0<<endl;
}

Measured memory_bytes: 256