akhauriyash/Code-Regression huggingface dataset:
import sys
sys.setrecursionlimit(10**7)
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return sys.stdin.readline().strip()
INF = 10 ** 18
MOD = 10 ** 9 + 7

def calcans(ans, a_list):  
  sm = 0
  for a in a_list:
    sm += a^ans
  print(sm)

def solve():
  N, K = LI()
  a_list = LI()
  if K == 0:
    calcans(0, a_list)
    return
  # Kの可能な最大桁（1オリジン）
  import math
  nk = math.floor(math.log2(K)) + 1
  bink = '{0:050b}'.format(K)
  bin_list = []
  for a in a_list:
    bin_list.append('{0:050b}'.format(a))

  # 最大の桁から順に決める nk桁目～1桁目
  bind = True
  ans = ''
  for i in range(nk, 0, -1):
    n1 = 0
    for b in bin_list:
      # i桁目の数字は string の index で見て -i
      if b[-i] == '1':
        n1 += 1

    if n1 > N // 2:
      optimal = '0'
    else:
      optimal = '1'

    if bink[-i] == '1':
      ans += optimal
      if optimal == '0':
        bind = False
    else:
      if bind == True:
        ans += '0'
      else:
        ans += optimal

  ansint = int(ans, 2)
  calcans(ansint, a_list)
  
solve()

Measured memory_bytes: 18852
#include <stdio.h>

int main(void)
{
  int c;

  for(int i=1;;i++)
    {
      scanf("%d",&c);

      if(c==0)
	{
	  break;
	}

      printf("Case %d: %d\n",i,c);

      
    }

  return 0;

}

Measured memory_bytes: 1032
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var arr=input.trim().split("\n");
arr.some(function(v){
   if(v=="0 0")return true;
   var ns=v.split(" ").map(Number);
   var n=ns[0];
   var s=ns[1];
   var all=[];
   var loop=function(start,ary){
      if(ary.length==n)all.push(ary);
      else{
         for(var i=start;i<=9;i++)loop(i+1,ary.concat(i));
      }
   };
   loop(0,[]);
   var cnt=0;
   all.forEach(function(v){
      var sum=v.reduce(function(a,b){return a+b;});
      if(sum==s)cnt++;
   });
   console.log(cnt);
});

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

#define REP(i, n) for(int (i)=0; (i)<(n); (i)++)
#define ALL(x) (x).begin(), (x).end()
#define OUT(a) cout << (a) << "\n"

typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;

const ll MOD = 10e9 + 7;

int main() {
    int n,h,w;
    cin >> h >> w >> n;
    cout << ceil(double(n) / double(max(h, w))) << endl;
    return 0;
}


Measured memory_bytes: 256
import itertools

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

acc = list(itertools.accumulate(A))
ans = 0
mod = 10**9 + 7

for i in range(N-1):
    ans += acc[i]*(acc[i+1] -acc[i])
    

print(ans%mod)

Measured memory_bytes: 107056
#include<stdio.h>
#include<string.h>

int main(){

long long a [100010];

int i,n;
scanf("%d",&n);
for( i=0;i<n;i++) scanf("%lld",&a[i]);
int zero =0;

for( i=0;i<n;i++)if(a[i]==0) zero ++;
if(zero >0){
// a[i] contains 0
printf("0\n");
return 0;
}
long long prod =1;
for(i=0;i<n;i++){
if(a[i] <=1000000000000000000/ prod ){

prod *=a[i];
}else{
printf("-1\n");
return 0;
}
}
printf("%lld\n",prod );


	

	return 0;
}	

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

int main(){
    int n,m,l;
    long long a[100][100],b[100][100],c[100][100];
    cin >> n >> m >> l;
    for(int i=0;i<n;i++)
        for(int j=0;j<m;j++)cin >> a[i][j] ;
    for(int i=0;i<m;i++)
        for(int j=0;j<l;j++)cin >> b[i][j] ;
    
     for(int i=0;i<n;i++){
        for(int j=0;j<l;j++){
    c[i][j]=0;
    for(int k=0;k<m;k++){
        c[i][j]+=a[i][k]*b[k][j];
      }
    }
 }
 
 for(int i=0;i<n;i++){
     for(int j=0;j<l;j++){
         if(j)cout << " ";
         cout << c[i][j];
     }
     cout << endl;
 }
 return 0;
} 


Measured memory_bytes: 3280
import numpy as np
a,b = map(int, input().split())
mod = 2019
min_score = 2019

for i in range(a, b+1):
    for j in range(a, b+1):
        if i != j:
            temp = (i)*(j) %mod
            if min_score > temp:
                min_score = temp
            if min_score == 0:
                print(min_score)
                exit()

print(min_score)

Measured memory_bytes: 12420
from collections import defaultdict
n = int(input())
d = defaultdict(list)
for i in range(n):
  s, p = map(str, input().split())
  d[s].append([int(p), i + 1])
d = dict(d)
d = sorted(d.items(), key=lambda x:x[0])
for e in d:
  e[1].sort(key=lambda x: x[0], reverse=True)
  for i in range(len(e[1])):
    print(e[1][i][1])

Measured memory_bytes: 3316
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#include<ctime>
#include<queue>
#include<deque>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vector<int> >;
using pii = pair<int, int>;
using ppi = pair<pii, int>;

int f_dir[2][4] = {{-1, 0, 1, 0}, {0, 1, 0, -1}}; //↑→↓←
int e_dir[2][8] = {{-1, -1, -1, 0, 0, 1, 1, 1}, {-1, 0, 1, -1, 1, -1, 0, 1}};
bool is_in_field(int y, int x, int h, int w){
  return (y >= 0 && y < h && x >= 0 && x < w);
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int ti = clock();
  // start-----------------------------------------------
  ll n; cin >> n;
  string s; cin >> s;
  deque<int> w;
  deque<int> r;
  for(int i = 0; i < n; i++){
    if(s[i] == 'W') w.push_back(i);
    else r.push_front(i);
  }
  int cnt = 0;
  int k = min(w.size(), r.size());
  for(int i = 0; i < k; i++){
    if(w[0] < r[0]) cnt++;
    else break;
    w.pop_front();
    r.pop_front();
  }
  cout << cnt << endl;

  // end-----------------------------------------------
  // cerr << 1.0 * (clock() - ti) / CLOCKS_PER_SEC << endl;
}


Measured memory_bytes: 4348
#include <stdio.h>
#define m 100000
struct Card{
	char c;int v;
};
struct Card L[m/2+2],R[m/2+2];
void swap(struct Card A,struct Card B){
	struct Card t = A;
	A = B;
	B = t;
}
void merge(struct Card a[],int left,int mid,int right){
	int i,j,k;
	int n1 = mid - left;
	int n2 = right - mid;
	for(i=0;i<n1;i++) L[i] = a[left+i];
	for(i=0;i<n2;i++) R[i] = a[mid+i];
	i = j = 0;
	L[n1].v = R[n2].v = 2000000000;
	for(k=left;k<right;k++){
		if(L[i].v<=R[j].v) a[k] = L[i++];
		else a[k] = R[j++];
	}
}
void mergeSort(struct Card a[],int left,int right){
	if(left+1<right){
		int mid = (left+right)/2;
		mergeSort(a,left,mid);
		mergeSort(a,mid,right);
		merge(a,left,mid,right);
	}
}
int partition(struct Card a[],int left,int right){
	struct Card x,t;
	x = a[right];
	int i = left - 1;
	for(int j=left;j<right;j++){
		if(a[j].v<=x.v){
			i++;
			t = a[i];a[i] = a[j];a[j]=t;
		}
	}
	t = a[i+1];a[i+1] = a[right];a[right]=t;
	return i+1;
} 
void quickSort(struct Card a[],int left,int right){
	if(left<right){
		int p = partition(a,left,right);
		quickSort(a,left,p-1);
		quickSort(a,p+1,right);
	}
}
int main(){
	struct Card A[m],B[m];
	int n,i,num;
	char s[10]; 
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%s %d",s,&num);
		A[i].c=B[i].c=s[0];
		A[i].v=B[i].v=num;
	}
	mergeSort(A,0,n);
	quickSort(B,0,n-1);
	int flag = 1;
	for(i=0;i<n;i++){
		if(A[i].c != B[i].c){
			flag = 0;
			break;
		}
	}
	if(flag) printf("Stable\n");
	else printf("Not stable\n");
	for(i=0;i<n;i++){
		printf("%c %d\n",B[i].c,B[i].v);
	}
	return 0;
}


Measured memory_bytes: 4040
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <functional>
#include <algorithm>
#include <string>
#include <vector>
#include <limits>
#include <numeric>
#include <type_traits>
#include <queue>
#include <cmath>
#include <queue>
#include <set>
#include <map>

using namespace std;

#define INF (1ll<<60)
#define INFint (1<<30)
#define MOD 1000000007
#define BOUND 27182818284

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

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i, a, b) for(int i=int(a);i<int(b);++i)

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

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

// gcd
template<typename T>
T gcd(T a, T b) {
    if (a == 0)
        return b;
    return gcd(b % a, a);
}

int findGCD(int arr[], int n) {
    int result = arr[0];
    for (int i = 1; i < n; i++)
        result = gcd(arr[i], result);
    return result;
}

template<typename T>
T lcm(T m, T n) {
    // 引数に0がある場合は0を返す
    if ((0 == m) || (0 == n))
        return 0;
    return ((m / gcd(m, n)) * n); // lcm = m * n / gcd(m,n)
}

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
    fill((T *) array, (T *) (array + N), val);
}


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

// v.front() = -BOUND;
// v.back() = BOUND;

//struct edge{
//    int cost, to;
//
//    edge(int in_cost, int in_to){
//        cost=in_cost;
//        to=in_to;
//    }
//    bool operator<(const edge &a) const
//    {
//        return cost > a.cost;
//    }
//};
vector<int> G[200010];
vector<int> c(10010, 0);
int num[200010];
bool used[200010];
int now_c = 0;

int dfs(int s) {
    if (used[s]) {
        return 0;
    } else {
        used[s] = true;
    }

    num[s] = c[now_c];
    now_c++;

    for (int i = 0; i < G[s].size(); i++) {
        dfs(G[s][i]);
    }
    return 0;
}

int main() {
    int N; cin >> N;
    vector<int> h(N);

    rep(i,N)
        cin >> h[i];

    int temp=0;
    int ans=0;

    for(int i=1; i<N; i++){
        if(h[i]<=h[i-1]){
            temp++;
        }else{
            temp=0;
        }
        ans=max(temp, ans);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 5376
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define fin(ans) cout<<(ans)<<endl
#define STI(s) atoi(s.c_str())
#define mp(p,q) make_pair(p,q)
#define pb(n) push_back(n)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define Sort(a) sort(a.begin(),a.end())
#define Rort(a) sort(a.rbegin(),a.rend())
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
const int P = 1000000007;
const int INF = INT_MAX;
const ll LLINF = 1LL<<60;


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

    int n;
    cin>>n;
    vector<pair<int,int>> r(n),b(n);
    int c,d;
    rep(i,n){
        cin>>c>>d;
        r[i]=mp(c,d);
    }
    rep(i,n){
        cin>>c>>d;
        b[i]=mp(c,d);
    }
    int ans=0;
    Rort(r);
    Sort(b);
    for(int i=0;i<n;i++){
        ll ymax=-1,chpos=-1;
        for(int j=0;j<n;j++){
            if(r[j].first<b[i].first&&r[j].second<b[i].second){
                if(ymax<r[j].second){
                    ymax=r[j].second;
                    chpos=j;
                }
            }
        }
        if(ymax==-1)continue;
        else{
            r[chpos].first=INF;
            r[chpos].second=INF;
            ans++;
        }
    }
    fin(ans);

//////////////////////////////////////////////////////
return 0;}

Measured memory_bytes: 256
/*#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>

#include <boost/rational.hpp>
*/
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
using ll = long long;
using ld = long double;
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
#define rep3(i, n) for (ll i = 1; i < (ll)(n+1); i++)
#define rep4(i, s, n) for (ll i = (s); i < (ll)(n+1); i++)
#define repr(i,n) for (ll i = (n-1); i>=0;i--)
#define repr3(i,n) for(ll i = (n);i>0;i--)
#define repr4(i,s,n) for(ll i = (n);i>=(s);i--)
#define stlen(s) ll s.size()-1
#define all(v) v.begin(), v.end()
#define cout(n) cout<<std::fixed<<std::setprecision(n)
using Graph = vector<vector<int>>;
using Graphw = vector<vector<pair<ll,ll>>>;
#define INF1  INT_MAX;
#define INF2  LLONG_MAX;
#define PI  3.14159265358979323846;
#define MOD 1000000007;
/*
namespace mp = boost::multiprecision;
// 任意長整数型
using Bint = mp::cpp_int;
// 仮数部長が32の浮動小数点数型
using Real32 = mp::number<mp::cpp_dec_float<32>>;
// 仮数部長が1024の浮動小数点数型
using Real1024 = mp::number<mp::cpp_dec_float<1024>>;
// 有理数型
using Rat = boost::rational<Bint>;
*/



int main() {
int n;
cin>>n;
ll a;
deque<ll> deq;
if(n%2==0){
rep(i,n){
    cin>>a;
    if(i%2==0){
        deq.push_back(a);

    }
    else{
        deq.push_front(a);
    }
}
}
else{
    rep(i,n){
    cin>>a;
    if(i%2==0){
        deq.push_front(a);

    }
    else{
        deq.push_back(a);
    }
}


}
rep(i,n){
    
    ll b=deq.front();
    deq.pop_front();
    if(i!=n-1){
    cout<<b<<" ";

    }
    else{
        cout<<b<<endl;
    }
    
}

return 0;
}


Measured memory_bytes: 3840
#include<stdio.h>

int main()
{
    int n,i;
    scanf("%d", &n);
    int a[n+1];
    int j[n + 1];
    for (i = 1; i < n + 1; i++)
        scanf("%d", &a[i]);
    for (i = 1; i < n + 1;i++)
        j[a[i]] = i;
    for (i = 1; i < n + 1;i++)
        printf("%d ", j[i]);
    printf("\n");
    return 0;
}

Measured memory_bytes: 1536
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <queue>
#include <vector>
#include <map>
#include <set>

using namespace std;

typedef long long LL;
typedef pair<int , int> P2;
typedef pair<pair<int , int> , int> P3;
typedef pair<pair<int , int> , pair<int , int> > P4;
#define Fst first
#define Snd second
#define MP(a , b) make_pair((a) , (b))
#define M3P(a , b , c) make_pair(make_pair((a) , (b)) , (c))
#define M4P(a , b , c , d) make_pair(make_pair((a) , (b)) , make_pair((c) , (d)))
#define Mx(a , b) ((a) > (b) ? (a) : (b))
#define Mn(a , b) ((a) < (b) ? (a) : (b))

const double EPS = 1e-10;
const int INF = 2147483647;

int N;
int A[100010];
int B[50010];
int ans;

int main(){
	scanf("%d" , &N);
	for(int i = 0 ; i < N ; ++i){
		scanf("%d" , A + i);
		if(i % 2 == 1) B[i / 2] = A[i];
	}
	sort(A , A + N);
	sort(B , B + N / 2);
	int x = 0 , y = 1;
	while(y < N){
		if(x == N / 2){
			++ans;
			y += 2;
		} else if(A[y] == B[x]){
			++x;
			y += 2;
		} else if(A[y] < B[x]){
			++ans;
			y += 2;
		} else {
			++x;
		}
	}
	printf("%d\n" , ans);
	return 0;
}


Measured memory_bytes: 768
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main(){
    int N;
    cin >> N;
    string st;
    cin >> st;
    for(char c: st){
        int ch = (c - 'A' + N)%26 + 'A';
        cout << (char)(ch);
    }
    cout << endl;
}   

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

using namespace std;

int main(){

    long long int n,m;
    cin >> n >> m;

    long long int a[m];
    for(int i=0;i<m;i++)cin >> a[i];

    for(int i=0;i<m;i++)n -= a[i];


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

Measured memory_bytes: 3696
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		double sum = 0;
		for(int i = 0; i < n; i++){
			sum += 1 / sc.nextDouble();
		}
		System.out.println(1 / sum);
	}
}


Measured memory_bytes: 23636
X,N=list(map(int, input().split(' ')))
if N>0:
    p=list(map(int, input().split(' ')))
else:
    p=[]
A=0
A2=400
A3=0
for i in range(0,200):
    if i in p:
        v=0
    else:
        A=abs(i-X)
        if A<A2:
            A2=A
            A3=i
        else:
            print(A3)
            exit()

Measured memory_bytes: 9208
#include <iostream>

using namespace std;

int main(int argc, char* argv[])
{
    int D; cin >> D;

    string out;
    switch (D) {
        case 22:
            out = "Christmas Eve Eve Eve";
            break;
        case 23:
            out = "Christmas Eve Eve";
            break;
        case 24:
            out = "Christmas Eve";
            break;
        case 25:
            out = "Christmas";
            break;
        default:
            out = "";
            break;
    }

    cout << out << endl;
         
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
int main(){
    string s;
    cin >> s;
    int n =s.size();
    vector<string> num; 
    for(int i =0;i<n;i++){
        num.push_back(s.substr(i,1));
    }

    long ans = 0;
    for(int i=0;i< (1<<(n-1));i++){
        long sum_tmp = 0;
        string baf = "";
        baf += num[0];
        for(int k=0;k<n-1;k++){
            if(i&(1<<k)){
                ans += stol(baf);
                baf = "";
            }
            baf += num[k+1];
        }
        ans+= stol(baf);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
# include <iostream>

int main() {
    int K;
    std::cin >> K;

    int N[] = { 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51 };

    std::cout << N[K-1];

    return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
#define endl "\n"
#define sz(x) ((ll)(x).size())
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define prt(x) cout << (x)
#define prtl(x) cout << (x) << endl
#define rep(i,a,b) for(ll i=a; i<b; i++)
#define rrep(i,a,b) for(ll i=a; i>b; i--)
#define mp(a, b) make_pair(a, b)
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
using namespace std;
using vi = vector<int>;
using vll = vector<long long int>;
using vb = vector<bool>;
using vvb = vector<vector<bool>>;
using vc = vector<char>;
using vvi = vector<vector<int>>;
using vvll = vector<vector<long long int>>;
using vvc = vector<vector<char>>;
using ll = long long int;
using P = pair<long long int, long long int>;
using Map = map<long long int, long long int>;

vector<pair<long long, long long> > prime_factorize(long long N) {
    vector<pair<long long, long long> > res;
    for (long long a = 2; a * a <= N; ++a) {
        if (N % a != 0) continue;
        long long ex = 0; // 指数

        // 割れる限り割り続ける
        while (N % a == 0) {
            ++ex;
            N /= a;
        }

        // その結果を push
        res.push_back({a, ex});
    }

    // 最後に残った数について
    if (N != 1) res.push_back({N, 1});
    return res;
}


int main(){
    ll N; cin >> N;
    vector<P> res = prime_factorize(N);
    ll a = 0;
    rep(i, 0, sz(res)){
        ll s = res[i].first, t = res[i].second;
        ll b = 1;
        while(t > 0){
            if(t >= b){
                t -= b;
                b++;
                a++;
            }else{
                break;
            }
        }
    }
    prt(a);
}

Measured memory_bytes: 3632
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Convert;
using static System.Math;
using Pair = System.Tuple<int, int>;
using Edge = System.Tuple<int, int, long>;
//using Debug;
//using static System.Globalization.CultureInfo;

class Program
{
    static void Main(string[] args)
    {
        var nm = Input.ar;
        var list = new List<int>();
        for(var i=1;i*i<=nm[1];i++)
            if (nm[1] % i==0)
            {
                list.Add(i);
                list.Add(nm[1] / i);
            }
        WriteLine(list.Where(v => v <= nm[1] / nm[0]).Max());
    }
}

public class Input
{
    public static string read => ReadLine();
    public  static int[] ar => Array.ConvertAll(read.Split(' '), int.Parse);
    public  static int num => ToInt32(read);
    public static long[] arL => Array.ConvertAll(read.Split(' '), long.Parse);
    public  static long numL => ToInt64(read);
    public static char[][] gred(int h) 
        => Enumerable.Repeat(0, h).Select(v => read.ToCharArray()).ToArray();
    public static int[][] ar2D(int num)
        => Enumerable.Repeat(0, num).Select(v => ar).ToArray();
    public static long[][] arL2D(int num)
        => Enumerable.Repeat(0, num).Select(v => arL).ToArray();
    public const long Inf = (long)1e18;
    public const double eps = 1e-6;
    public  const string Alfa = "abcdefghijklmnopqrstuvwxyz";
    public  const int MOD = 1000000007;
}


Measured memory_bytes: 13396
#include<bits/stdc++.h>
typedef long long ll;
#define M 1000000007
using namespace std;
int main()
{
    ios::sync_with_stdio(0);cin.tie(0);
    int n;
    cin>>n;
    int k;
    cin>>k;

    int h[n];
    for(int i=0;i<n;i++)
    {
        cin>>h[i];
    }
    int dp[n];
    dp[0]=0;
    dp[1]=abs(h[1]-h[0]);
    for(int i=2;i<n;i++)
    {
        dp[i]=1000000005;
        for(int j=i-1;j>=0 && i-j<=k;j--)
        {
            dp[i]=min(dp[i],dp[j]+abs(h[i]-h[j]));
        }
    }
    cout<<dp[n-1];
}


Measured memory_bytes: 1024
S = list(str(input()))
F1 = int(str(S[0]) + str(S[1]))
F2 = int(str(S[2]) + str(S[3]))
#print(F1)
FLAG_MMYY = 1
FLAG_YYMM = 1
if F1 >= 13:
    FLAG_MMYY = 0
if F2 >= 13:
    FLAG_YYMM = 0
if F1 == 0:
    FLAG_MMYY = 0
if F2 == 0:
    FLAG_YYMM = 0

if FLAG_MMYY == 1 and FLAG_YYMM == 1:
    print("AMBIGUOUS")
elif FLAG_MMYY == 1:
    print("MMYY")
elif FLAG_YYMM == 1:
    print("YYMM")
else:
    print("NA")

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

int main(){
    string s;
    cin >> s;
    for(int i=0;i<3;i++){
        if(s.at(i)=='7'){
            cout << "Yes"<< endl;
            return 0;
        }
    }
    cout << "No" << endl;
}

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


int main(){
  int N;

  cin >> N;
  if(N % 10 == 7 || (N % 100) / 10 == 7 || N / 100 == 7){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
  return 0;
}


Measured memory_bytes: 3616
#![allow(unused_mut, non_snake_case, unused_macros,unused_imports)]
use std::cmp::{max, min, Ordering};
use std::collections::{HashMap, HashSet, BinaryHeap, VecDeque};
use std::iter::FromIterator;

//　高速 EOF要
//macro_rules! input {(source = $s:expr, $($r:tt)*) => {let mut iter = $s.split_whitespace();input_inner!{iter, $($r)*}};($($r:tt)*) => {let mut s = {use std::io::Read;let mut s = String::new();std::io::stdin().read_to_string(&mut s).unwrap();s};let mut iter = s.split_whitespace();input_inner!{iter, $($r)*}};}
//macro_rules! input_inner {($iter:expr) => {};($iter:expr, ) => {};($iter:expr, $var:ident : $t:tt $($r:tt)*) => {let $var = read_value!($iter, $t);input_inner!{$iter $($r)*}};}
//macro_rules! read_value {($iter:expr, ( $($t:tt),* )) => {( $(read_value!($iter, $t)),* )};($iter:expr, [ $t:tt ; $len:expr ]) => {(0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()};($iter:expr, chars) => {read_value!($iter, String).chars().collect::<Vec<char>>()};($iter:expr, usize1) => {read_value!($iter, usize) - 1};($iter:expr, $t:ty) => {$iter.next().unwrap().parse::<$t>().expect("Parse error")};}
// 低速 EOF不要
macro_rules! input {(source = $s:expr, $($r:tt)*) => {let mut iter = $s.split_whitespace();let mut next = || { iter.next().unwrap() };input_inner!{next, $($r)*}};($($r:tt)*) => {let stdin = std::io::stdin();let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));let mut next = move || -> String{bytes.by_ref().map(|r|r.unwrap() as char).skip_while(|c|c.is_whitespace()).take_while(|c|!c.is_whitespace()).collect()};input_inner!{next, $($r)*}};}
macro_rules! input_inner {($next:expr) => {};($next:expr, ) => {};($next:expr, $var:ident : $t:tt $($r:tt)*) => {let $var = read_value!($next, $t);input_inner!{$next $($r)*}};}
macro_rules! read_value {($next:expr, ( $($t:tt),* )) => {( $(read_value!($next, $t)),* )};($next:expr, [ $t:tt ; $len:expr ]) => {(0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()};($next:expr, chars) => {read_value!($next, String).chars().collect::<Vec<char>>()};($next:expr, usize1) => {read_value!($next, usize) - 1};($next:expr, $t:ty) => {$next().parse::<$t>().expect("Parse error")};}

/*
 <url:>
 問題文============================================================
 =================================================================
 解説=============================================================
 ================================================================
 */

fn gcd(mut n: u64,mut m:u64) -> u64{
    assert!(n != 0 && m != 0);
    while m != 0{
        if m < n{
            let t = m;
            m = n;
            n = t;
        }
        m = m % n;
    }
    n
}
fn main(){
    input!{
    N:usize,
    X:usize,
    x:[usize;N]
    }
    let N:usize = N;
    let X:usize = X;
    let x:Vec<usize> = x;
    let y:Vec<usize> = x.into_iter().map(|v| (max(v,X)-min(v,X))).collect();
    let mut GCD = y[0] as u64;
    for i in 1..N{
        GCD = gcd(GCD,y[i] as u64);
    }
    println!("{}",GCD);
}

Measured memory_bytes: 6396
#include <stdio.h>
int main(void)
{
  int N, A, B;
  scanf("%d", &N);
  if (N==1){
    printf("Hello World");
  }
  else if (N==2){
    scanf("%d", &A);
    scanf("%d", &B);
    printf("%d", A+B);
  }
  return 0;
}


Measured memory_bytes: 128
S = input()
K = int(input())
li = []
num = 1

#数えるセクション
for i in range(len(S)-1): #もしlen(S)==1の場合、ループは一回も回らない。（エラーもでない？）
    if S[i] == S[i+1]:
        num += 1
    else:
        li.append(num)
        num = 1
li.append(num)
#print(li)

#合計セクション
g = 0
for l in li:
    g += (l // 2)
#print(g)

#解答セクション
tmp = 0
result = 0
if len(li) == 1:
    result = (li[0] * K) // 2
else:
    tmp = sum(j // 2 for j in li)
    if S[0] != S[-1]:
        result = tmp * K
    else:
        if li[0] % 2 == li[-1] % 2 == 1: #最初と最後がどちらも奇数個の連続ならば、プラス1する必要がある。
            result = tmp * K + (1 * (K-1))
        else:
            result = tmp * K

print(result)

Measured memory_bytes: 3064
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
  int n,k,x,y,ans=0;
  cin>>n>>k>>x>>y;
  if(n>k){
    ans+=k*x;
    ans+=(n-k)*y;
  }else{
    ans=n*x;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define x first
#define y second
#define dbg(x) cout << #x << '=' << x << '\n';
#define ll long long
#define pi pair<int,int>
#define pl pair<ll,ll>
#define pd pair<double,double>
#define ld long double
#define pld pair<ld,ld>
#define lg length()
#define sz size()
#define pb push_back
#define MAXN 100005
#define INF 1000000005
#define LINF 1000000000000000005
#define x1 xdddddddddddddddddd
#define y1 ydddddddddddddddddd

int n,c[505],s[505],f[505],x;

int32_t main(){
    ios_base :: sync_with_stdio(0); cin.tie(); cout.tie();
    cin >> n; x=0;
    for(int i=1;i<n;i++){
        cin >> c[i] >> s[i] >> f[i];
    }
    for(int i=1;i<=n;i++){
        x=0;
        for(int j=i;j<n;j++){
            if(x<=s[j]) x=s[j];
            while(x%f[j]) x++;
            x+=c[j];
        }
        cout << x << '\n';
    }
}


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

using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second

template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<int, pll> pip;
const ll INF = 1ll<<29;
const ll MOD = 1000000007;
const double EPS  = 1e-9;

int M, N;
int T[100];
pii data[10][2]; // ????????????, ??´?????????
pii ud = pii(INF, 0);

int main() {
	while (cin >> M >> N, M || N) {
		REP(i, N) scanf("%d", T + i);
		
		fill(data[0], data[M], ud);
		
		queue<pii> in; // ???????????? time, number
		REP(i, N) in.push(pii(i * 10, i + 1));
		
		priority_queue<pip, vector<pip>, greater<pip> > out; // ????????????, ?§??????????, ???
		vector<int> ans;
		
		int t = 0;
		while (true) {
		
			while (!out.empty()) {
				int nt = out.top().fi;
				int snum = out.top().se.fi;
				int g = out.top().se.se;
				
				bool ok = false;
				
				if (nt <= t) {
					
					if (g == 1 && data[snum - 1][0] != ud) {
						out.pop();
						data[snum - 1][1].fi = data[snum - 1][0].fi;
						out.push(pip(data[snum - 1][0].fi, pii(snum, 1)));
					}
					else {
						ans.push_back(data[snum - 1][g].se);
						data[snum - 1][g] = ud;
						out.pop();
					}
				}
				else {
					break;
				}
			}
		
			while (!in.empty()) {
				int nt = in.front().fi;
				int num = in.front().se;
				
				if (nt <= t) {
					// ??¢????????????
					bool stop = false;
					
					// 1
					REP(i, M) {
						if (data[i][0] == pii(INF, 0) && data[i][1] == ud) {
							data[i][1] = pii(t + T[num - 1], num);
							out.push(pip(t + T[num - 1], pii(i + 1, 1)));
							stop = true;
							break;
						}
					}
					if (stop) { in.pop(); continue; }
					/////
					
					// 2,3
					pii mi1 = ud, mi2 = ud;
					REP(i, M) if (data[i][1] != ud && data[i][0] == ud) {
						int gotime = data[i][1].fi - t;
						if (gotime >= T[num - 1]) chmin(mi1, pii(abs(gotime - T[num - 1]), i + 1));
						else chmin(mi2, pii(abs(gotime - T[num - 1]), i + 1));
					}
					
					if (mi1 != ud) {
						data[mi1.se - 1][0] = pii(t + T[num - 1], num);
						out.push(pip(t + T[num - 1], pii(mi1.se, 0)));
						stop = true;
					}
					else if (mi2 != ud) {
						data[mi2.se - 1][0] = pii(t + T[num - 1], num);
						out.push(pip(t + T[num - 1], pii(mi2.se, 0)));
						stop = true;
					}
					
					if (stop) { in.pop(); continue; }
					
					break;
				}
				else {
					break;
				}
			}
			
			int nextt = INF;
			if (!in.empty()) chmin(nextt, in.front().fi);
			if (!out.empty()) chmin(nextt, out.top().fi);
			if (nextt == INF) break;
			
			chmax(nextt, t + 1);
			t = nextt;
		}
		
		REP(i, ans.size()) printf("%d%c", ans[i], i == ans.size() - 1 ? '\n' : ' ');
		
	}
	return 0;
}

Measured memory_bytes: 3092
#include <iostream>
using namespace std;
int main(){
  int n;
  cin >> n;
  int max = -1;
  int min = 1001;
  for(int i = 0; i < n; i++){
    int a;
    cin >> a;
    if(a > max) max = a;
    if(a < min) min = a;
  }
  cout << max-min << endl;
}


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

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

ll mod = 998244353;

vector<int> cnt;
vector<int> ret;
vector<vector<int>> tree;

void calc(int root,int cur){
  ret[cur] += cnt[cur];
  for(int i = 0;i < tree[cur].size();i++){
    if(tree[cur][i] == root)continue;
    ret[tree[cur][i]] += ret[cur];
    calc(cur,tree[cur][i]);
  }
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  int n,q;
  cin >> n >> q;

  tree = vector<vector<int>>(n);
  cnt = vector<int>(n);
  ret = vector<int>(n);
  for(int i = 0;i < n-1;i++){
    int a,b;
    cin >> a >> b;
    a--;b--;
    tree[a].push_back(b);
    tree[b].push_back(a);
  }

  for(int i = 0;i < q;i++){
    int p,x;
    cin >> p >> x;
    p--;
    cnt[p] += x;
  }

  calc(0,0);
  for(int i = 0;i < n;i++){
    cout << ret[i] << " ";
  }
  cout << endl;
}

Measured memory_bytes: 24320
#define _USE_MATH_DEFINES
#include<cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iterator>
#include<iomanip>

using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

#define int ll
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

typedef long long ll;
//typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pdd;
typedef vector<vector<int>> mat;
//typedef unsigned int uint;

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

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;

pair<int,int> P[100010];

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

	int N, M;
	cin >> N >> M;
	rep(i, 0, M)
	{
		cin >> P[i].second >> P[i].first;
	}

	sort(P, P + M);

	int r = 0;
	int ans = 0;
	rep(i, 0, M)
	{
		if (r <= P[i].second)
		{
			ans++;
			r = P[i].first;
		}
	}

	cout << ans << endl;

	return 0;
}

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

int main(void) {
  int n; ll x, cnt=0; 
  cin >> n >> x;
  ll a[n];
  rep(i,n) cin >> a[i];

  rep(i,n-1) {
    if(a[i+1] > 0) {
      if(a[i]+a[i+1]>x) {
        cnt += (min(a[i+1],a[i]+a[i+1]-x));
        a[i+1] -= min(a[i+1],a[i]+a[i+1]-x);
      } else ;
    }
    if(a[i]>0) {
      if(a[i]+a[i+1]>x) {
        cnt += (min(a[i],a[i]+a[i+1]-x));
        a[i] -= min(a[i],a[i]+a[i+1]-x);
      } else ;
    }
  }
  //rep(i,n) cout << a[i] << endl;
  cout << cnt << endl;
}

Measured memory_bytes: 4360
#include <bits/stdc++.h>
#define endl "\n"
using namespace std;
#define ll long long
#define ld long double
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repo(i,n) for(int i = 1; i < (int)(n); i++)
#define pb push_back
#define mp make_pair
#define np next_permutation
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define uniq(v) v.erase(unique(v.begin(),v.end()),v.end())
#define lb(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define ub(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
using Pair = pair<ll,pair<int,int>>;
#define pq priority_queue<Pair, vector<Pair>, greater<Pair>> 
const ll mod=1000000007;
//const ll mod=998244353;
const ld pi=acos(-1.0);
const ll INF = 1LL<<61;
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; }
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//'大文字'+=32;    で小文字に
//  cout << fixed << setprecision (20);   小数点以下2０桁まで
//実行時間制約2秒では２×10^8回くらいまで計算できる


//—————————————UnionFind木   UF uf(n);——————————————————————

struct UF {
    vector <ll> par; // 各元の親を表す配列
    vector <ll> siz; // 素集合のサイズを表す配列(1 で初期化)

    UF(ll sz_): par(sz_), siz(sz_, 1LL) {
        for (ll i = 0; i < sz_; ++i) par[i] = i; // 初期では親は自分自身
    }
    void reset(ll sz_) {
        par.resize(sz_);
        siz.assign(sz_, 1LL);
        for (ll i = 0; i < sz_; ++i) par[i] = i; // 初期では親は自分自身
    }

    ll root(ll x) { // 根の検索
        while (par[x] != x) {
            x = par[x] = par[par[x]]; // x の親の親を x の親とする
        }
        return x;
    }

    bool unite(ll x, ll y) {
        x = root(x);
        y = root(y);
        if (x == y) return false;
        // merge technique（データ構造をマージするテク．小を大にくっつける）
        if (siz[x] < siz[y]) swap(x, y);
        siz[x] += siz[y];
        par[y] = x;
        return true;
    }

    bool same(ll x, ll y) { // 連結判定
        return root(x) == root(y);
    }

    ll size(ll x) { // 素集合のサイズ
        return siz[root(x)];
    }
};

//—————————————————————————————————————————————————




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

  int n;
  cin>>n;

  vector<pair<pair<ll,ll>,int>> p(n);
  vector<pair<pair<ll,ll>,int>> q(n);
  rep(i,n){
    cin>>p[i].fi.fi>>p[i].fi.se;
    p[i].se=i;
    q[i]={{p[i].fi.se,p[i].fi.fi},i};
  }

  sort(all(p));
  sort(all(q));

  priority_queue<pair<ll,pair<int,int>>, vector<pair<ll,pair<int,int>>> ,greater<pair<ll,pair<int,int>>> > que;
  repo(i,n){
    ll x=p[i].fi.fi-p[i-1].fi.fi;
    int a=p[i].se;
    int b=p[i-1].se;
    que.push({x,{a,b}});
  }
  repo(i,n){
    ll x=q[i].fi.fi-q[i-1].fi.fi;
    int a=q[i].se;
    int b=q[i-1].se;
    que.push({x,{a,b}});
  }

  ll ans=0;
  UF uf(n);
  while(!que.empty()){
    auto z=que.top();
    que.pop();
    ll x=z.fi;
    int a=z.se.fi;
    int b=z.se.se;
    if(!uf.same(a,b)) {
      uf.unite(a,b);
      ans+=x;
    }
  }

  cout << ans << endl;
}

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

struct flower{
    int height;
    int beauty;
};

ll maxBeauty(vector<flower>& v,int n){
    vector<ll> dp(n+1);
    map<ll,ll> meaningful;
    dp[1] = v[1].beauty;
    meaningful[v[1].height] = dp[1];
    ll ans = dp[1];
    for(int i=2;i<=n;i++){
        dp[i] = v[i].beauty;
        auto it = meaningful.lower_bound(v[i].height + 1);
        if(it != meaningful.begin()){
            it--;
            dp[i] = dp[i] + it->second;
        }
        meaningful[v[i].height] = dp[i];
        it = meaningful.upper_bound(v[i].height);
        while(it!=meaningful.end() && it->second<=dp[i]){
            auto temp = it;
            temp++;
            meaningful.erase(it);
            it = temp;  
        }
        ans = max(ans,dp[i]);
    }
    return ans;
}

int main(){
    int n;
    cin>>n;
    vector<flower> v(n+1);
    for(int i=1;i<=n;i++){
        cin>>v[i].height;
    }
    for(int i=1;i<=n;i++){
        cin>>v[i].beauty;
    }
    cout<<maxBeauty(v,n);
    return 0;
}


Measured memory_bytes: 15872
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

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

const ll INF = 1e17;
// https://atcoder.jp/contests/abc143/submissions/8034843

bool checkIndex(int M, int line, int index, vector<string> &vec_A, vector<string> &vec_B)
{
    //cout << line << "," << M << endl;
    for (int i =1; i < M; i++)
    {
      //cout <<  vec_A[line+i] << "\n" << vec_B[i] << "\n" << endl;
      auto hoge = vec_A[line+i].find(vec_B[i], index);
      //cout << index << "," << hoge << endl;
        if (vec_A[line+i].find(vec_B[i], index) != index)
        {
            return false;
        }
    }
    return true;
}

int main() {
    // input
    int N,M;
    cin >> N >> M;

    vector<string> vec_A;
    vector<string> vec_B;
    vec_A.resize(N);
    vec_B.resize(M);
    for (int i=0; i < N; i++) cin >> vec_A.at(i);
    for (int i=0; i < M; i++) cin >> vec_B.at(i);

    // resolve
    for (int i=0; i < N-M+1; i++)
    {
        auto start=0;
        auto index = vec_A[i].find(vec_B[0], start);
        while(index != string::npos)
        {
            if (checkIndex(M, i, index, vec_A, vec_B))
            {
                cout << "Yes" << endl;
                return 0;
            }
            start=index+1;
            index = vec_A[i].find(vec_B[0], start);
          //cout << "index:" << index << endl;
        }
    }
  
    cout << "No" << endl;

    return 0;
}


Measured memory_bytes: 256
#ifdef _MSC_VER
#include "stdc++.h"
#endif
#ifdef __GNUC__
#include<bits/stdc++.h>
#endif
using namespace std;

using ll = long long;

//constant
const double EPS = 1e-10;

#define REP(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, s, e) for (ll i = s; i < e; i++)
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(), (x).rend()

//debug
#define DUMP(x)  cerr << #x << " = " << (x) << endl;
#define DEBUG(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl;

// vector
//template<typename T> vector<vector<T>> vv(ll H, ll W, T v) { return vector<vector<T>> vec(H, vector<T>(W, v)); }

// view vector
template<typename T> void view(T e) { cout << e << endl; }
template<typename T> void view(const vector<T>& v) { for (const auto& e : v) { cout << e << " "; } cout << endl; }
template<typename T> void view(const vector<vector<T> >& vv) { for (const auto& v : vv) { view(v); } }

// DP
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 main(){

    int R;
    cin >> R;
    cout << 2 * M_PI * R << endl;

    return 0;
}


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

int main(){
    int n, k;
    cin >> n >> k;
    int i, j;
    int ans = 1;
    for(i = 1; i >= 1; i++){
        if(pow(k, i) > n){
            break;
        }
        ans++;
    }
    cout << ans << endl;
    return 0;
}

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

using namespace __gnu_pbds;
using namespace std;

#ifdef LOCAL
	#define debug(...) fprintf(stderr, __VA_ARGS__);fflush(stderr);
#else
	#define debug(...) 42
#endif

#define sf scanf
#define pf printf
#define nl printf("\n")
#define ps(s) printf("%s",s.c_str())
#define mem(x,val) memset(x,val,sizeof x)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend() 
#define sz(x) (int)(x).size()
#define test_case int ___t;scanf("%d", &___t);for(int cs=1;cs<=___t;cs++)

inline string getString(int n){char ch[n+5];sf(" %s",ch);return string(ch);}
inline string getLine(int n)
{char ch[n+5];fgets(ch,n+5,stdin);string s=string(ch);s.pop_back();return s;}

//typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> new_data_set;
typedef long long ll;

const int S=100100;
const int mod=1e9+7;
int main()
{
	ll n,k;
	while(~sf("%lld %lld",&n,&k))
	{
		ll ans=1;
		for(ll i=k;i<=n;i++)
		{
			ll x=n-i;
			x=(x*(x+1))/2;
			ll y=n;
			y=(y*(y+1))/2;
			ll mx=y-x;

			x=i-1;
			ll mn=(x*(x+1))/2;;
			
			ll cur=mx-mn+1;
			ans=(cur+ans)%mod;
		}
		pf("%lld\n",ans);
	}
    return 0;
}



































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

int partition(int *,int,int);
void change(int*,int*);

int main() {
  int n=0;
  int *A;
  int i;
  int q;

  // Input
  scanf("%d",&n);
  A=(int *)malloc(n*sizeof(int));
  for(i=0;i<n;i++){
    scanf("%d",&A[i]);
  }

  q=partition(A,0,i-1);

  for(i=0;i<n-1;i++){
    if(i==q) printf("[%d] ",A[i]);
    else printf("%d ",A[i]);
  }
  printf("%d\n",A[i]);

  return 0;
}

int partition(int *A,int p,int r){
  int x=A[r];
  int i=p-1;
  int j;

  for(j=p;j<r;j++){
    if(A[j]<=x){
      i++;
      change(&A[i],&A[j]);
    }
  }
  change(&A[i+1],&A[r]);

  return i+1;

}

void change(int *a,int *b){
  int temp;

  temp=*a;
  *a=*b;
  *b=temp;

}



Measured memory_bytes: 2092
from collections import defaultdict

class que(object):
    def __init__(self):
        self.item = []

    def push(self,x):
        self.item.append(x)
    
    def front(self):
        return self.item[0]
    
    def pop(self):
        self.item.pop(0)
    
    def empty(self):
        return len(self.item) == 0

n,m = map(int , input().split())
path = defaultdict(list)

ans = [-1 for i in range(n)]

for i in range(m):
    a,b = map(int, input().split())
    path[a-1].append(b-1)
    path[b-1].append(a-1)

q = que()

q.push(0)

ans[0] = 0

while not q.empty():
    now = q.front()
    q.pop()


    for tmp in path[now]:
        # print(tmp, now)
        if tmp == now:
            continue
        
        if ans[tmp] != -1:
            continue
            
        else:
            ans[tmp] = now
            q.push(tmp)
    # print(now)

# print(ans)

for tmp in ans:
    if tmp == -1:
        print("No")
        exit()

print("Yes")

for tmp in ans[1:]:
    
    print(tmp+1)
            


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

// auto mod int
// https://youtu.be/L8grWxBlIZ4?t=9858
// https://youtu.be/ERZuLAxZffQ?t=4807 : optimize
// https://youtu.be/8uowVvQ_-Mo?t=1329 : division
const int mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  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&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];
  }
};

mint choose (int n, int a) {
    mint x = 1, y = 1;
    rep(i,a) {
        x *= n-i;
        y *= i+1;
    }
    return x / y;
}

int main() {
    int n, a, b;
    cin >> n >> a >> b;
    mint ans = mint(2).pow(n);
    ans -= 1;
    ans -= choose(n,a);
    ans -= choose(n,b);
    cout << ans.x << endl;
    return 0;
}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
#define FAST ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
long long mx(long long a,long long b){if(a>b)return a;else return b;}
long long mn(long long a,long long b){if(a<b)return a;else return b;}
long long cei(long long a,long long b){if(a%b==0)return a/b;else return (a/b+1);}
const int MOD=1e9+7;
long long po(long long a,long long b){long long res=1;while(b>0){res=(res*a);res%=MOD;b--;}return res;}
double dist(int a,int b)
{
double ans=sqrt((a*a)+(b*b));
return ans;
}

int main()
{
int n;
cin>>n;
double d;
cin>>d;
int count=0;
for(int i=0;i<n;i++)
{
double x,y;
cin>>x>>y;
if(x*x+y*y<=(d*d))count++;
//if(x+y<=d)count++;
}

cout<<count<<endl;

}

Measured memory_bytes: 3852