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

#define rep(i,s,n) for (int i = (int)s; i < (int)n; i++)
#define ll long long
#define ld long double
#define pb push_back
#define eb emplace_back
#define All(x) x.begin(), x.end()
#define Range(x, i, j) x.begin() + i, x.begin() + j
#define lbidx(x, y) lower_bound(x.begin(), x.end(), y) - x.begin()
#define ubidx(x, y) upper_bound(x.begin(), x.end(), y) - x.begin()
#define llbidx(x, y, z) lower_bound(x.begin(), x.end(), z) - lower_bound(x.begin(), x.end(), y) // 二要素間の距離
#define deg2rad(deg) ((((double)deg)/((double)360)*2*M_PI))
#define rad2deg(rad) ((((double)rad)/(double)2/M_PI)*(double)360)
#define Find(set, element) set.find(element) != set.end()
#define Decimal(x) printf("%.10f\n", x) // 小数点を10桁まで表示
// debug用
#define PrintVec(x) for (auto elementPrintVec: x) { cout << elementPrintVec << " "; } cout << "\n";
#define debug(x) cerr << #x << ": " << (x) << "\n";
#define endl "\n"
// gcj print用
#define Case(x) printf("Case #%d: ", x);

typedef pair<int, int> PI;
typedef pair<ll, ll> PLL;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<vector<vector<int>>> vvvi;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<vector<int>>> vvvl;
typedef vector<PI> vpi;
typedef vector<vector<PI>> vvpi;
typedef vector<vector<vector<PI>>> vvvpi;
typedef vector<PLL> vpl;
typedef vector<vector<PLL>> vvpl;
typedef vector<vector<vector<PLL>>> vvvpl;

int POWINT(int x, int n) {
  int ret = 1;
  while (n > 0) {
    if (n & 1) ret *= x;
    x *= x;
    n >>= 1;
  }
  return ret;
};

ll POWLL(ll x, int n) {
  ll ret = 1;
  while (n > 0) {
    if (n & 1) ret *= x;
    x *= x;
    n >>= 1;
  }
  return ret;
};

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;
};

void print() {
  cout << endl;
}

template <class T>
void print(vector<T> &vec) {
  for (auto& a : vec) {
    cout << a;
    if (&a != &vec.back()) cout << " ";
  }
  cout << endl;
}

template <class T>
void print(vector<T> &vec, ll k){
   ll n = vec.size();
   k = min(k, n);
   rep(i, 0, k-1) cout << vec[i] << " ";
   cout << vec[k-1] << endl;
}

template <class T>
void print(vector<vector<T>> &df) {
  for (auto& vec : df) {
    print(vec);
  }
}

template<class T, class U>
void print(pair<T,U> &p){
  cout << p.first << " " << p.second << "\n";
}

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

  int N;
  cin >> N;
  int K;
  cin >> K;

  vector<bool> v(N, false);
  rep(i, 0, K) {
    int d;
    cin >> d;
    rep(j, 0, d) {
      int a;
      cin >> a;
      a--;
      v[a] = true;
    }
  }

  int ans = 0;
  rep(i, 0, N) {
    if (!v[i]) ans++;
  }

  cout << ans << endl;

  return 0;
};


Measured memory_bytes: 3656
# include "bits/stdc++.h"
using namespace std;
using LL = long long;
using ULL = unsigned long long;
const double PI = acos(-1);
template<class T>constexpr T INF() { return ::std::numeric_limits<T>::max(); }
template<class T>constexpr T HINF() { return INF<T>() / 2; }
template <typename T_char>T_char TL(T_char cX) { return tolower(cX); };
template <typename T_char>T_char TU(T_char cX) { return toupper(cX); };
typedef pair<LL, LL> pii;
const int vy[] = { -1, -1, -1, 0, 1, 1, 1, 0 }, vx[] = { -1, 0, 1, 1, 1, 0, -1, -1 };
const int dx[4] = { 0,1,0,-1 }, dy[4] = { 1,0,-1,0 };
int popcnt(unsigned long long n) { int cnt = 0; for (int i = 0; i < 64; i++)if ((n >> i) & 1)cnt++; return cnt; }
int d_sum(LL n) { int ret = 0; while (n > 0) { ret += n % 10; n /= 10; }return ret; }
int d_cnt(LL n) { int ret = 0; while (n > 0) { ret++; n /= 10; }return ret; }
LL gcd(LL a, LL b) { if (b == 0)return a; return gcd(b, a%b); };
LL lcm(LL a, LL b) { LL g = gcd(a, b); return a / g*b; };
# define ALL(qpqpq)           (qpqpq).begin(),(qpqpq).end()
# define UNIQUE(wpwpw)        sort(ALL((wpwpw)));(wpwpw).erase(unique(ALL((wpwpw))),(wpwpw).end())
# define LOWER(epepe)         transform(ALL((epepe)),(epepe).begin(),TL<char>)
# define UPPER(rprpr)         transform(ALL((rprpr)),(rprpr).begin(),TU<char>)
# define FOR(i,tptpt,ypypy)   for(LL i=(tptpt);i<(ypypy);i++)
# define REP(i,upupu)         FOR(i,0,upupu)
# define INIT                 std::ios::sync_with_stdio(false);std::cin.tie(0)

int n, m;
int a[101010];
LL dp[101010];
map<int, bool> mp;
const LL mod = 1e9 + 7;

int main(){
	cin >> n >> m;
	REP(i, m){
		cin >> a[i];
		mp[a[i]] = true;
	}
	dp[0] = 1;
	REP(i, n + 1){
		if(!mp[i + 1])(dp[i + 1] += dp[i]) %= mod;
		if(!mp[i + 2])(dp[i + 2] += dp[i]) %= mod;
	}
	cout << dp[n] << endl;
}

Measured memory_bytes: 5888
#include <cmath>
#include <string>
#include <vector>
#include <iostream>
#include <algorithm>
#include <functional>
using namespace std;
int N, M, a;
int main() {
	cin >> N >> M;
	int ret = 0;
	for (int i = 0; i < N; i++) {
		cin >> a;
		ret += min(a, M - a) * 2;
	}
	cout << ret << endl;
	return 0;
}

Measured memory_bytes: 256
/*--------------------------"SABUJ-JANA"------"JADAVPUR UNIVERSITY"--------*/
/*-------------------------------@greenindia-----------------------------------*/
//
//		  _____       _           _        _
//		 / ____|     | |         (_)      | |
//		| (___   __ _| |__  _   _ _       | | __ _ _ __   __ _
//		 \___ \ / _` | '_ \| | | | |  _   | |/ _` | '_ \ / _` |
//		 ____) | (_| | |_) | |_| | | | |__| | (_| | | | | (_| |
//		|_____/ \__,_|_.__/ \__,_| |  \____/ \__,_|_| |_|\__,_|
//		                        _/ |
//		                       |__/
/*---------------------- Magic. Do not touch.-----------------------------*/
/*------------------------------God is Great/\---------------------------------*/
#include <bits/stdc++.h>
using namespace std;
#define crap ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
//cout<<fixed<<showpoint<<setprecision(12)<<ans<<endl;
#define int long long int
#define double long double
#define PI acos(-1)

void print1d(const vector<int>& vec) {for (auto val : vec) {cout << val << " ";} cout << endl;}

void print2d(const vector<vector<int>>& vec) {for (auto row : vec) {for (auto val : row) {cout << val << " ";} cout << endl;}}

signed main() {
// #ifndef ONLINE_JUDGE
// 	freopen("input.txt", "r", stdin);
// #endif
	crap;

	string str;
	cin>>str;

	if(str[0] == 'A' and str[1] == 'A' and str[2] == 'A')
		cout << "No" << endl;
	else if(str[0] == 'B' and str[1] == 'B' and str[2] == 'B')
		cout << "No" << endl;
	else
		cout << "Yes" << endl;

	return 0;
}






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

int main()
{
    string s;
    cin>>s;
    set<char>st;
    for(int i=0;i<s.length();i++)
    {
        if(s[i]=='a' || s[i]=='b' || s[i]=='c')
            st.insert(s[i]);
    }
    if(st.size()==3)
    {
        cout<<"Yes"<<endl;
    }
    else
        cout<<"No"<<endl;

}


Measured memory_bytes: 256
def main():
    n = int(input().strip())
    s = [input().strip() for _ in range(n)]
    m = int(input().strip())
    t = [input().strip() for _ in range(m)]


    cand = list(set(s))
    g = [s.count(c) - t.count(c) for c in cand]
    ans = max(g)
    if ans < 0:
        print(0)
    else:
        print(ans)

if __name__ == '__main__':
    main()


Measured memory_bytes: 38256
import math, string, itertools, fractions, heapq, collections, re, array, bisect, copy, functools, random
import sys
from collections import deque, defaultdict, Counter; from heapq import heappush, heappop
from itertools import permutations, combinations, product, accumulate, groupby
from bisect import bisect_left, bisect_right, insort_left, insort_right
from operator import itemgetter as ig
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20; INF = float("INF"); ans = 0; tmp = 0; ansli = []; tmpli = []; candili = []
eps = 1.0 / 10 ** 10; mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]; ddn = dd + [(-1, 1), (1, 1), (1, -1), (-1, -1)]; ddn9 = ddn + [(0, 0)]
"""for dx, dy in dd:
        nx = j + dx; ny = i + dy
            if 0 <= nx < w and 0 <= ny < h:"""
def wi(): return list(map(int, sys.stdin.readline().split()))
def wip(): return [int(x) - 1 for x in sys.stdin.readline().split()]#WideIntPoint
def ws(): return sys.stdin.readline().split()
def i(): return int(sys.stdin.readline())
def s(): return input()
def hi(n): return [i() for _ in range(n)]
def hs(n): return [s() for _ in range(n)]#HeightString
def mi(n): return [wi() for _ in range(n)]#MatrixInt
def mip(n): return [wip() for _ in range(n)]
def ms(n): return [ws() for _ in range(n)]

n, m, k = wi()

for i in range(n):
    ans += m ** 2 * i * (n - i)
    ans = ans % mod

for j in range(m):
    ans += n ** 2 * j * (m - j)
    ans = ans % mod

MAX_N = 3 * 10 ** 5 + 100
factorial = [1] * MAX_N
#事前に階上テーブルを用意
def calc_factorial():
    for i in range(1, MAX_N):
        factorial[i] = i * factorial[i - 1] % mod

def comb(n, k):
    a = factorial[n] % mod
    b = (factorial[k] * factorial[n - k]) % mod
    b_ = pow(b, mod - 2, mod)
    return (a * b_) % mod


# 階乗を用意
calc_factorial()

ans *= comb(n * m - 2, k - 2)
print(ans % mod)

Measured memory_bytes: 18128
A, B = map(int,input().split())
left = max(12.5*A,10*B)
right = min(12.5*(A+1),10*(B+1))
LEFT = int(left)
if left != LEFT:
    LEFT += 1
RIGHT = int(right)
if right == RIGHT:
    RIGHT -= 1
if LEFT <= RIGHT:
    print(LEFT)
else:
    print(-1)

Measured memory_bytes: 3064
fun main(args: Array<String>) = println(run {
    val (k, n) = readLine()!!.split(" ").map { it.toInt() }
    val a = readLine()!!.split(" ").map { it.toInt() }

    val d = IntArray(n)
    d[0] = a[0] + k - a.last()
    for (i in 1..a.lastIndex) {
        d[i] = a[i] - a[i-1]
    }

    k - d.max()!!
})

Measured memory_bytes: 80860
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <set>
#include <string>
#include <ctime>
using namespace std;

string s; int K;
void input()
{
    cin >> s >> K;
}

void solve()
{
    int n = s.size();
    set<string> st;
    for (int i = 0; i < n; ++i){
        for (int j = 1; j <= min(K,n-i); ++j){
            // cout << s.substr(i,j) << endl;
            st.insert(s.substr(i,j));
        }
    }

    vector<string> vs;
    for (auto itr = st.begin(); itr != st.end(); ++itr){
        vs.emplace_back(*itr);
    }

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

    cout << vs.at(K-1) << endl;
} 

int main()
{
    cin.tie();
    ios::sync_with_stdio(false);
    // int ti = clock();
    input();
    solve();
    // printf("Execution Time: %.4lf sec\n", 1.0 * (clock() - ti) / CLOCKS_PER_SEC);
    return 0;
}

Measured memory_bytes: 5132
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
)

func configure(scanner *bufio.Scanner) {
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 1000005), 1000005)
}
func getNextString(scanner *bufio.Scanner) string {
	scanned := scanner.Scan()
	if !scanned {
		panic("scan failed")
	}
	return scanner.Text()
}
func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}
func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}
func getNextFloat64(scanner *bufio.Scanner) float64 {
	i, _ := strconv.ParseFloat(getNextString(scanner), 64)
	return i
}
func main() {
	fp := os.Stdin
	wfp := os.Stdout
	extra := 0
	if os.Getenv("I") == "IronMan" {
		fp, _ = os.Open(os.Getenv("END_GAME"))
		extra = 100
	}
	scanner := bufio.NewScanner(fp)
	configure(scanner)
	writer := bufio.NewWriter(wfp)
	defer func() {
		r := recover()
		if r != nil {
			fmt.Fprintln(writer, r)
		}
		writer.Flush()
	}()
	solve(scanner, writer)
	for i := 0; i < extra; i++ {
		fmt.Fprintln(writer, "-----------------------------------")
		solve(scanner, writer)
	}
}
func solve(scanner *bufio.Scanner, writer *bufio.Writer) {
	n := getNextInt(scanner)
	k := getNextInt(scanner)
	pp := make([]int, n)
	cc := make([]int64, n)
	var ans, sum int64
	for i := 0; i < n; i++ {
		pp[i] = getNextInt(scanner) - 1
	}
	for i := 0; i < n; i++ {
		cc[i] = getNextInt64(scanner)
	}
	ans = math.MinInt64
	if k < n {
		ans = calc(0, k, pp, cc)
		for i := 0; i < n; i++ {
			a := calc(i, k, pp, cc)
			if ans < a {
				ans = a
			}
		}
		fmt.Fprintln(writer, ans)
		return
	}
	for i := 0; i < n; i++ {
		sum = 0
		v := make([]int, n)
		s := i
		c := 0
		for j := 0; j < n; j++ {
			if v[s] == 1 {
				break
			}
			sum += cc[pp[s]]
			if ans < sum {
				ans = sum
			}
			v[s] = 1
			s = pp[s]
			c++
		}
		if sum < 0 {
			a := calc(i, k%n, pp, cc)
			if ans < a {
				ans = a
			}
			continue
		}
		a := sum * int64((k-c)/c)
		if ans < a {
			ans = a
		}
		for j := 0; j < k%c+c; j++ {
			a += cc[pp[s]]
			if ans < a {
				ans = a
			}
			s = pp[s]
		}
	}
	fmt.Fprintln(writer, ans)
}

func calc(s, k int, pp []int, cc []int64) int64 {
	var ans int64 = cc[pp[s]]
	a := ans
	s = pp[s]
	for i := 1; i < k; i++ {
		a += cc[pp[s]]
		if ans < a {
			ans = a
		}
		s = pp[s]
	}
	return ans
}


Measured memory_bytes: 5412
#include<bits/stdc++.h>
using namespace std;
vector<string> vt;
int num=0;
queue<string> q;
bool cmp(string s1,string s2){
	if(s1.length()==s2.length()){
		return s1<s2;
	}
	else return s1.length()<s2.length();
}
//void dfs(string s){
//	vt.push_back(s);
//	num++;
//	if(num>20) return ;
//	
//	int len = s.length();
//	cout<<" len = "<<len<<endl;
//	char ch = s[len-1];
//	if(ch==9) {
//		dfs(s+"8"); dfs(s+"9");
//	}
//	else{
//		char ch1=ch-1;
//		string s1=s,s2=s,s3=s;
//		s1.insert(s1.end(),ch1); dfs(s1);	
//		ch1=ch;
//		s2.insert(s2.end(),ch1); dfs(s1);
//		ch1=ch+1;
//		s3.insert(s3.end(),ch1); dfs(s3);
//	}
//}
int main(){
	
//	dfs("1");
//	dfs("2");
//	dfs("3");
//	dfs("4");
//	dfs("5");
//	dfs("6");
//	dfs("7");
//	dfs("8");
//	dfs("9");

	q.push("1");
	q.push("2");
	q.push("3");
	q.push("4");
	q.push("5");
	q.push("6");
	q.push("7");
	q.push("8");
	q.push("9");
	
	while(!q.empty() and num<100005){
		string s=q.front();
		q.pop();
		vt.push_back(s);
		num++;
		
		int len=s.length();
		char ch=s[len-1];
		if(ch=='9'){
			q.push(s+'8');
			q.push(s+'9');
		}
		else if(ch=='0'){
			q.push(s+'0');
			q.push(s+'1');
		}
		else{
			char ch1= ch-1,ch2=ch,ch3=ch+1;
			string s1=s,s2=s,s3=s;
			s1.insert(s1.end(),ch1);
			s2.insert(s2.end(),ch2);
			s3.insert(s3.end(),ch3);
			
			q.push(s1);
			q.push(s2);
			q.push(s3);
		}
	}

	sort(vt.begin(),vt.end(),cmp);
	
	int n;cin>>n;
	n--;
	cout<<vt[n]<<endl;


//	cout<<vt.size()<<endl;
//	for(auto i:vt){
//		cout<<i<<endl;
//	}
	return 0;
}

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

#define rep(i,n) for(int i = 0; i<n; ++i)
const int INF = 100100100;
const int MOD = (int)1e9 + 7;
typedef long long ll;

int main(){
    int n; string s ;cin>>n>>s;
    if(n%2==0){
        rep(i,n/2){
            if(s[i] != s[n/2+i]){cout<<"No"<<endl; return 0;}
        }
        cout<<"Yes"<<endl;return 0;
    }else{
        cout<<"No"<<endl; return 0;
    }
}


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

int main() {
  int a,b,c,d,e;
  cin >> a >> b >> c >> d >> e;
  
  int x = (c * 60 + d) - (a * 60 + b);
  int y = x - e;
  
  cout << y << endl;
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
#define SZ(x) (int)(x.size())
#define REP(i, n) for(int i=0;i<(n);++i)
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define RREP(i, n) for(int i=(int)(n)-1;i>=0;--i)
#define RFOR(i, a, b) for(int i=(int)(b)-1;i>=(a);--i)
#define ALL(a) a.begin(),a.end()
#define DUMP(x) cerr<<#x<<" = "<<(x)<<endl
#define DEBUG(x) cerr<<#x<<" = "<<(x)<<" (L"<<__LINE__<<")"<< endl;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using P = pair<int, int>;
const double eps = 1e-8;
const ll MOD = 1000000007;
const int INF = INT_MAX / 2;
const ll LINF = LLONG_MAX / 2;
template <typename T1, typename T2>
bool chmax(T1 &a, const T2 &b) {
    if (a < b) { a = b; return true; }
    return false;
}
template <typename T1, typename T2>
bool chmin(T1 &a, const T2 &b) {
    if (a > b) { a = b; return true; }
    return false;
}
template<typename T>
ostream &operator<<(ostream &os, const vector<T> &v) {
    os << "[";
    REP(i, SZ(v)) {
        if (i) os << ", ";
        os << v[i];
    }
    return os << "]";
}
template<typename T1, typename T2>
ostream &operator<<(ostream &os, const map<T1, T2> &mp) {
    os << "{";
    int a = 0;
    for (auto &tp : mp) {
        if (a) os << ", "; a = 1;
        os << tp;
    }
    return os << "}";
}
template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) {
    os << p.first << ":" << p.second;
    return os;
}


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

    for (;;) {
        int N, L, R; cin >> N >> L >> R;
        if (N == 0) break;
        vi A(N);
        REP(i, N) cin >> A[i];
        A.push_back(1);
        int ans = 0;
        FOR(x, L, R+1) {
            int idx = -1;
            REP(i, N+1) {
                if (x % A[i] == 0) {
                    idx = i;
                    break;
                }
            }
            ans += idx % 2 == 0;
        }
        cout << ans << endl;
    }

    return 0;
}



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

using namespace std;
using ll = long long;

#define REP(i, n) for (ll i = 0; i < n; i++)
#define INF 9223372036854775807
#define all(x) (x).begin(), (x).end()

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

  ll n;
  cin >> n;

  vector<int> t(n);
  vector<int> tCopy(n);
  REP(i, n) { cin >> t[i]; }

  ll m;
  cin >> m;

  REP(i, m) {
    ll p, x;
    cin >> p >> x;

    ll sum = 0;

    tCopy = t;

    tCopy[p - 1] = x;

    REP(j, n) { sum += tCopy[j]; }

    cout << sum << "\n";
  }
}

Measured memory_bytes: 256
N = str(input())
if  N[len(N)-1] == "3" :
  print("bon")
if N[len(N)-1] == "0" or N[len(N)-1] =="1" or N[len(N)-1] =="6" or N[len(N)-1] == "8": 
  print("pon")
elif N[len(N)-1]== "2" or N[len(N)-1] == "4" or N[len(N)-1] =="5" or N[len(N)-1] =="7" or N[len(N)-1] =="9":
  print("hon")
  



Measured memory_bytes: 9136
#include <iostream>
#include <stack>
#include <algorithm>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <functional>
#include <string>
#include <cstdlib>
#include <numeric>
#include <cstdbool>
#include <cstring>
#include <map> 
#include <set>
#include <queue>
#include <iomanip>
#include <sstream>
typedef long long ll;

#define rep(i,n) for(ll i=0;i<n;i++)
using namespace std;

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

const long long INF = 1000000000000000;
const ll inf = -1e18;
typedef pair<ll, ll> P;
ll ma = 1000000000 + 7;
ll mx = 1000003;
ll h,n, w,m,t; string s;
ll R, C;
ll sy, sx, gy, gx;
char maze[510][510];
ll dis[20][20];
int dx[4] = { 1, 0, -1, 0 };
int dy[4] = { 0, 1, 0, -1 };
ll gcd(ll x, ll y) {
	if (x % y == 0) return y;
	return gcd(y, x % y);
}
ll lcm(ll a,ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
void comb(vector<vector <ll> >& v) {
	for (ll i = 0; i < v.size(); i++) {
		v[i][0] = 1;
		v[i][i] = 1;
	}
	for (ll k = 1; k < v.size(); k++) {
		for (int j = 1; j < k; j++) {
			v[k][j] = (v[k - 1][j - 1] + v[k - 1][j])%ma;
		}
	}
}

ll GetDigit(ll num) {
	return log10(num) + 1;
}
ll Combination(int n, int r)
{
	if (n - r < r) r = n - r;
	if (r == 0) return 1;
	if (r == 1) return n;

	vector<ll> numerator(r);
	vector<ll> denominator(r);

	for (int k = 0; k < r; k++)
	{
		numerator[k] = n - r + k + 1;
		denominator[k] = k + 1;
	}

	for (int p = 2; p <= r; p++)
	{
		int pivot = denominator[p - 1];
		if (pivot > 1)
		{
			int offset = (n - r) % p;
			for (int k = p - 1; k < r; k += p)
			{
				numerator[k - offset] /= pivot;
				denominator[k] /= pivot;
			}
		}
	}

	ll result = 1;
	for (int k = 0; k < r; k++)
	{
		if (numerator[k] > 1) result *= numerator[k];
		result %= ma;
	}

	return result;
}
/*
ll bfs() {
	queue<P> que;
	for (int i = 0; i < R; i++) {
		for (int j = 0; j < C; j++) dis[i][j] = INF;
	}
	que.push(P(sy - 1, sx - 1));
	dis[sy - 1][sx - 1] = 0;

	while (que.size() > 0) {
		P p = que.front();
		que.pop();
		if (p.first == gy - 1 && p.second == gx - 1) break;
		for (ll i = 0; i < 4; i++) {
			ll ny = p.first + dy[i];
			ll nx = p.second + dx[i];
			if (0 <= ny && ny < R && 0 <= nx && nx < C && maze[ny][nx] == '.' && dis[ny][nx] == INF) {
				que.push(P(ny, nx));
				dis[ny][nx] = dis[p.first][p.second] + 1;
			}
		}
	}
	return dis[gy - 1][gx - 1];
}*/
int main() {
	ll p;
	cin >> n >> p;
	vector<ll> a(n);
	ll aa = 0;
	ll bb = 0;
	ll res = 0;
	rep(i, n) {
		cin >> a[i];
		if (a[i] % 2 == 0) {
			++aa;
		}
		else {
			++bb;
		}
	}
	if (bb == 0) {
		if (p == 1) {
			res = 0;
		}
		else {
			res = pow(2, n);
		}
	}
	else {
		res = pow(2, n - 1);
	}
	cout << res << endl;
}

Measured memory_bytes: 4068
n, m = map(int, input().split())

h = tuple(map(int, input().split()))

ans = [1]*n

for i in range(m):
    a, b = map(int,input().split())
    if h[a-1] == h[b-1]:
        ans[a-1] = 0
        ans[b-1] = 0
    elif h[a-1] > h[b-1]:
        ans[b-1] = 0
    else:
        ans[a-1] = 0

print(ans.count(1))

Measured memory_bytes: 84628
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <algorithm>
#include <functional>
#include <stack>
#include <queue>
#include <map>
#include <unordered_map>
#include <bitset>
#include <numeric>
#include <unordered_set>
#include <bitset>
#include <limits>
#include <random>
#include <complex>
#include <numeric>
#include <cstdlib>
#include <random>
#include <bits/stdc++.h>


using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef vector<ll> vec;
typedef vector<vec> mat;

const ll mod=1000000007ll;
const ll inf=1000000000000000ll;

const ll MAX_N=1000;

ll N,K;

ll d_sum(ll n){
  ll res=0;
  while(n>0){
    res+=n%10;
    n/=10;
  }
  return res;
}

double sn(ll n){
  return (double)(n)/d_sum(n);
}

int main(){
  cin>>K;
  ll b=1;
  vector<ll> candidate;
  for(ll i=0;i<15;i++){
    for(ll j=1;j<140;j++){
      candidate.emplace_back(b*(j+1)-1);
    }
    b*=10;
  }
  sort(candidate.begin(), candidate.end());
  candidate.erase(unique(candidate.begin(), candidate.end()), candidate.end());
  for(ll i=0;i<candidate.size();i++){
    for(ll j=i+1;j<candidate.size();j++){
      if(sn(candidate[i])>sn(candidate[j])){
        candidate.erase(candidate.begin()+i);
        i--;
        break;
      }
    }
  }

  for(ll i=0;i<K;i++){
    cout<<candidate[i]<<endl;
  }
  return 0;
}


Measured memory_bytes: 256
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <queue>
# define MOD 1000000000+7
# define INF 1000000000
#define rep(i,rept)	for(ll i = 0; i<rept;i++)
typedef long long ll;
using namespace std;
long double a = 0, b = 0, c = 0,d=0,e=0, ans = 0, x = 0, y = 0, z = 0, n = 0, m = 0, maxy = 0, mini = 9999, counter = 0, endp = 0, checker = 0;

std::vector <long long int> vec{}, vecsec{}, vecth{};
long long int iremono[100001], koware[100001];
long long int iremono2[100001], check[100001],xpo[10000001],ypo[10000001],hei[1000001];
std::vector<std::string>kinds{}, kaku{};
char maze[1000][1000];
int sx, sy;
int gx, gy;
pair<long long int, long long int>pairs[101],pointkaku[10000000];
int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
bool okada = false, okada2 = false;
std::string output, output2, input, input2;
char re;
int starta, startb, enda, endb,ab;


unsigned long long int LCM(unsigned long long int a, unsigned long long int b) {
	unsigned long long int i, j;
	i = a; j = b;
	while (true) {

		c = i % j;
		i = j;
		if (c != 0) {

			j = c;

		}
		else {
			break;
		}
	}
	return j * (a / j) * (b / j);
}
int kaizyo(int k) {
	int sum = 1;
	for (int i = 1; i <= k; ++i)
	{
		sum *= i;
	}
	return sum;
}

int H, W;//はんい
bool qw = false, er = false, ty = false,ui=false;
int main() {
	cin >> a>>b>>c>>d;
	cout << std::setprecision(9)<<a*b/2 << " ";
	if (c == a / 2 && d == b / 2) {
		cout << 1 << endl;
	}
	else {
		cout << 0 << endl;
	}

}


Measured memory_bytes: 2304
import Control.Monad


main :: IO ()
main = do
  n <- readLn
  if n == -1
    then return ()
    else do
      ls <- replicateM n readLn
      let ans = solve ls
      mapM_ putStrLn ans
      main


solve :: [Int] -> [String]
solve ls = update ls "0000000" []
  where
    update :: [Int] -> String -> [String] -> [String]
    update [] _ save = save
    update (x:xs) now save = update xs now' (save ++ [differ now' now])
      where
        now' = toDigit x
          where
            toDigit :: Int -> String
            toDigit n = findD n digit
              where
                digit = [(0,"0111111"),(1,"0000110"),(2,"1011011"),(3,"1001111"),(4,"1100110"),
                         (5,"1101101"),(6,"1111101"),(7,"0100111"),(8,"1111111"),(9,"1101111")]
                findD :: Int -> [(Int,String)] -> String
                findD n ((a,b):r)
                  | n == a = b
                  | otherwise = findD n r
                  
        differ :: String -> String -> String
        differ [] _ = []
        differ (x:xs) (y:ys)
          | x == y = '0':(differ xs ys)
          | otherwise = '1':(differ xs ys)

Measured memory_bytes: 3972
import sys
sys.stdin.readline
INF = float("inf")

def digitsum(b, n):
    ans = 0
    while n:
        n, m = divmod(n, b)
        ans += m
    return ans

def solve():
    n = int(input())
    s = int(input())
    if s == n: return n+1
    if s > n: return -1
    for b in range(2, int(n**.5)+1):
        if digitsum(b, n) == s: return b
    ans = INF
    for d in range(1, int(n**.5)+1):
        b = (n - s) // d + 1
        if b < 2: continue
        if digitsum(b, n) == s:
            ans = min(ans, b)
    if ans == INF:
        ans = -1
    return ans

if __name__ == "__main__":
    print(solve())

Measured memory_bytes: 3188
#include<bits/stdc++.h>
 
#define fi first
#define se second
#define pb push_back
#define mp make_pair
 
#define all(x) (x).begin() , (x).end()
#define rall(x) (x).rbegin() , (x).rend()
 
#define PII pair<LL,LL>
#define mem(v, x) memset(v, x, sizeof v)
 
#define si(x) scanf("%d", &x)
#define sii(x, y) scanf("%d %d", &x, &y)
#define siii(x, y, z) scanf("%d %d %d", &x, &y, &z)
 
#define sf(x) scanf("%lf", &x)
#define endl '\n'

#define FOR(i , N) for(int i = 0  ; i < N ; i++)
#define FOR1(i , N) for(int i = 1  ; i <= N ; i++)

template <typename T> T six(T &n){n = 0;bool neg = false;char c = getchar();while( c < '0' || c > '9'){if(c == '-') neg = true;c = getchar();}while(c >= '0' && c <= '9'){n = n*10 + c-48;c = getchar();}if(neg) n = ~(n-1);return n;}

using namespace std;
 
typedef long long LL;
 
int SET(int N,int pos){return N=N | (1<<pos);}
int RESET(int N,int pos){return N= N & ~(1<<pos);}
bool CHECK(int N,int pos){return (bool)(N & (1<<pos));}

const int MAX = 100001;
const LL inf = (LL) 1e17;
int N, cap;
int w[MAX + 10], v[MAX + 10];
LL dp[101][MAX + 10];

LL rec(int pos, int make) {
   if(pos == N) return 0;
   LL &ret = dp[pos][make];
   if(ret != -1) return ret;
   LL ans1 = 0, ans2 = 0;
   if(make - w[pos] >= 0) ans1 = v[pos] + rec(pos + 1, make - w[pos]);
   ans2 = rec(pos + 1, make);
   return ret = max(ans1, ans2);
}

int main()
{

#ifndef ONLINE_JUDGE // dont use this in toph/codemarshal
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
#endif
    mem(dp , -1);
    cin >> N;
    cin >> cap;
    FOR(i , N) cin >> w[i] >> v[i];
    cout << rec(0, cap) << endl;
}


// Iterative ta parlam na :( 

Measured memory_bytes: 79232
#include<iostream>
#include<vector>
#include<string>
#include<cmath>
#include<algorithm>
#include <numeric>
#include<map>
 
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<n;i++)
#define all_map(itr,mp) for(auto itr=mp.begin();itr!=mp.end();itr++)
#define ALL(a) (a).begin(),(a).end()


int main(){
    string s, t;
    cin >> s >> t;
    sort(ALL(s));
    sort(ALL(t), greater<char>());
    if(s <  t)cout << "Yes";
    else cout << "No";
}

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

int main() {
    cout << fixed << setprecision(10);
    
    int N, M; cin >> N >> M;
    vector<int> A(M);
    rep(i, M) cin >> A[i];

    rep(i, M) {
        N -= A[i];
    }
    if (N < 0) {
        cout << -1 << endl;
    } else {
        cout << N << endl;
    }
    return 0;
}

Measured memory_bytes: 3632
#include<iostream>
#include<algorithm>
using lint=long long;
using namespace std;

int main()
{
	int a[3]={};
	
	for(int i=0;i<3;i++)
		cin >> a[i];
	
	sort(a,a+3);
	cout << (a[0]*a[1])/2 << endl;
	return 0;
}



Measured memory_bytes: 764
public class Main {

    /**
     * ????????????
     *
     * @param args
     */
    public static void main(String[] args) {
        for (int i = 1; i < 10; i++) {
            for (int j = 1; j < 10; j++) {
                System.out.println(i + "x" + j + "=" + i * j);
            }
        }
    }
}

Measured memory_bytes: 24308
#include <iostream>
#include <vector>
#include <algorithm>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define INF 999999999
using namespace std;

int main(){
          int a,b,k;
          cin >> a >> b >> k;
          for(int i=a;i<=min(b,a+k-1);i++) cout << i << endl;
          for(int i=max(b-k+1,a+k);i<=b;i++) cout << i << endl;
          return 0;
}


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

int main(){
    long long int n; cin >> n;
    string ans="";
    while(n){
        n--;
        ans += 'a'+ n%26;
        n/=26;
    }
    reverse(ans.begin(),ans.end());
    cout << ans << endl;
}
        



Measured memory_bytes: 3608
#include<stdio.h>
#define N 36

typedef struct{
  char kind;
  int num;
}Card;

void bubblesort(Card * ,int);
void selectionsort(Card *,int);
//void swap(Card *,Card *);
int isStable(Card *,Card *,int n);

int main(){
  int n;
  int i;
  Card card1[N],card2[N];
  int flag=0;
  
  scanf("%d",&n);//枚数の入力
  for(i=0;i<n;i++){
    scanf(" %c%d",&card1[i].kind,&card1[i].num);
    card2[i]=card1[i];
  }
  
  
  bubblesort(card1,n);
  for(i=0;i<n-1;i++){
    printf("%c%d ",card1[i].kind,card1[i].num);
  }
  printf("%c%d\n",card1[n-1].kind,card1[n-1].num);
  printf("Stable\n");
  
  selectionsort(card2,n);
  for(i=0;i<n-1;i++){
    printf("%c%d ",card2[i].kind,card2[i].num);
  }
  printf("%c%d\n",card2[n-1].kind,card2[n-1].num);
  for(i=0;i<n;i++){
    flag=flag+isStable(card1,card2,n);
  }
  if(flag==0)printf("Not stable\n");
  else printf("Stable\n");
  return 0;
}

void bubblesort(Card A[],int n){
  int i,j;
  Card temp;
  for(i=0;i<=n-1;i++){
    for(j=n-1;j>=i+1;j--){
      if(A[j].num<A[j-1].num){
	//swap(&A[j],&A[j-1]);
	temp=A[j];
	A[j]=A[j-1];
	A[j-1]=temp;
      }
    }
  }
  
}

void selectionsort(Card A[],int n){
  int i,j,minj;
  Card temp;
  for(i=0;i<=n-1;i++){
    minj=i;
    for(j=i;j<=n-1;j++){
      if(A[j].num<A[minj].num)
	minj=j;
      }
    
   
   
      temp=A[i];
      A[i]=A[minj];
      A[minj]=temp;
    }
  
}
 
/*void swap(Card *a,Card *b){
  Card temp;
  temp=*a;
  *a=*b;
  *b=temp;
  }*/

int isStable(Card *a,Card *b,int n){
  int i;

  for(i=0;i<n;i++){
    if(a[i].kind!=b[i].kind) 
    return 0;
  }
  return 1;
}



Measured memory_bytes: 2056
n, m = list(map(int, input().split()))
city_dict = {}

for i in range(m):
    p, y = list(map(int, input().split()))
    if city_dict.get(p) == None:
        city_dict[p] = [[y, i]]
    else:
        city_dict[p].append([y, i])

ID = []

for ken, city_and_id in city_dict.items():
    city_and_id.sort()
    for j, city in enumerate(city_and_id):
       num_padded = '%06d' % (j+1)
       ken_padded = '%06d' % ken
       ID.append([str(ken_padded)+str(num_padded), city[1]])

ID = sorted(ID, key=lambda x:x[1])

for city_id in ID:
    print(city_id[0])

Measured memory_bytes: 58812
#include <iostream>
using namespace std;
int main()
{
    unsigned long long int n, a, b, c, d, ans;
    cin >> n >> a >> b;
    c = n / (a + b);
    d = n % (a + b);
    ans = c * a;
    if (d < a)
        ans += d;
    else
        ans += a;
    cout << ans << endl;
}


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

#define ll long long
#define pb push_back
#define mp make_pair


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n,k;
    cin>>n>>k;
    int a[n];
    for(int i=0;i<n;i++)cin>>a[i];
    sort(a,a+n);
    ll s=0;
    for(int i=0;i<k;i++)
    s+=a[i];
    cout<<s<<endl;
		
	
}

   

Measured memory_bytes: 3620
#include <bits/stdc++.h>
#define lli long long int
using namespace std;
int main() {
	lli n,a,b,t;
	cin >> n;
	lli dp[n];
	for(int i=0;i<n;i++)	cin >> dp[i];
	sort(dp,dp+n);
	if(dp[0]==0){cout<<"0";return 0;}
	lli ans=1,ans1=1;
	for(int i=0;i<n;i++){
		ans=(ans*dp[i]);
		if(ans>1000000000000000000){
			cout<<"-1";return 0;
		}
		if(ans<ans1){
			cout<<"-1";return 0;
		}
		ans1=ans;
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 4380
import Data.List (intersperse, sort)

sortNumTwo :: String -> String
sortNumTwo line =
  let sortedList = sort . map read . words $ line :: [Int]
  in concat . intersperse " " . map show $ sortedList

main = do
  line <- getLine
  let res = sortNumTwo $ line
  if res == "0 0" then return ()
  else do
    putStrLn res
    main

Measured memory_bytes: 3960
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cstdlib>
#include <cmath>
using namespace std;
#define N 2050
typedef long long ll;
ll X;
int n,a[N],b[N];
int main() {
	// freopen("cube.in","r",stdin);
	// freopen("cube.out","w",stdout);
	scanf("%d%lld",&n,&X);
	int i,j,k;
	for(i=0;i<n;i++) {
		scanf("%d",&a[i]); b[i]=a[i];
	}
	ll ans=1ll<<60;
	for(i=0;i<n;i++) {
		for(j=0;j<n;j++) b[j]=min(b[j],a[(j-i+n)%n]);
		ll tmp=0; for(j=0;j<n;j++) tmp+=b[j];
		ans=min(ans,tmp+i*X);
	}
	printf("%lld\n",ans);
}
/*
5 5
.....
..#..
.#.#.
..#..
.....
*/

Measured memory_bytes: 128
#![allow(non_snake_case)]
#![allow(unused_variables)]

fn main() {
    let N: usize = {
        let mut line: String = String::new();
        std::io::stdin().read_line(&mut line).unwrap();
        line.trim().parse().unwrap()
    };
    let H: Vec<i64> = {
        let mut line: String = String::new();
        std::io::stdin().read_line(&mut line).unwrap();
        line.split_whitespace()
            .map(|x| x.parse().unwrap())
            .collect()
    };

    let mut dp = vec![0; N];
    for i in (0..(N - 1)).rev() {
        if H[i] >= H[i + 1] {
            dp[i] = dp[i + 1] + 1;
        } else {
            dp[i] = 0;
        }
    }

    let ans = *dp.iter().max().unwrap();
    println!("{}", ans);
}


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

int main() {
  int N;
  cin >> N;
  int sum = 0;

  for (int i; i < N; i ++){
    int l, r;
    cin >> l >> r;
    sum += (r-l+1);
  }
  cout << sum << endl;
  
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define MX 200005
int dp[MX];
signed main() {
    int n,W;cin>>n>>W;
    for(int i = 0; i < MX; i++) dp[i]=1234567890123456;
    dp[0]=0;
    for(int i = 0; i < n; i++) 
    {
        int w,v;cin >>w>>v;
        for(int j = MX-v; j >= 0; j--)
        {
            dp[j+v] = min(dp[j+v],dp[j]+w);
        }
    }
    int ans = 0;
    for(int i = 0; i < MX; i++)
    {
        if(dp[i]<=W)ans=i;
    }
    
    cout << ans << endl;
    
    return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using Graph=vector<vector<int>>;
#define MAX 5100000
#define MOD 10007
#define INF 100000000000000

int main(){
  int N,M;
  cin>>N>>M;
  vector<int> a(M),b(M),c(M);
  vector<vector<pair<int,int>>> G(N);
  for(int i=0;i<M;i++){
    cin>>a.at(i)>>b.at(i)>>c.at(i);
    a.at(i)--;
    b.at(i)--;
    G.at(a.at(i)).push_back(make_pair(b.at(i),i));
    G.at(b.at(i)).push_back(make_pair(a.at(i),i));
  }

  vector<bool> path(M,false);
  for(int i=0;i<N;i++){
    vector<int> dist(N,1000000000);
    dist.at(i)=0;
    priority_queue<pair<int,int>,vector<pair<int,int>>,greater<pair<int,int>>> pq;
    pq.push(make_pair(0,i));
    while(!pq.empty()){
      int v=pq.top().second;
      for(auto p:G.at(v)){
        int nv=p.first;
        if(dist.at(v)+c.at(p.second)<dist.at(nv)){
          dist.at(nv)=dist.at(v)+c.at(p.second);
          pq.push(make_pair(dist.at(nv),nv));
        }
      }
      pq.pop();
    }

    pq.push(make_pair(0,i));
    while(!pq.empty()){
      int v=pq.top().second;
      for(auto p: G.at(v)){
        int nv=p.first;
        if(dist.at(v)+c.at(p.second)==dist.at(nv)){
          path.at(p.second)=true;
          pq.push(make_pair(dist.at(nv),nv));
        }
      }
      pq.pop();
    }
  }

  int ans=0;
  for(int i=0;i<M;i++){
    if(!path.at(i)){
      ans++;
    }
  }
  cout<<ans<<endl;

}


Measured memory_bytes: 256
#include<iostream>
#include<sstream>
#include<fstream>
#include<vector>
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<algorithm>
#include<functional>
#include<climits>
#include<utility>
#include<iomanip>
#include<map>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pi;

#define max(a,b) (a>b?a:b)
#define min(a,b) (a<b?a:b)
#define FOR(i,s,e) for (int i = int(s); i < int(e); i++)
#define REP(i,x) FOR(i,0,x)
#define CLR(a) memset((a), 0 ,sizeof(a))


const ll MOD = 1e+9+7;
const double PI  = acos(-1.0);

int main(){
  int n;
  cin>>n;
  ll a[n],b[n],c[n];
  REP(i,n) cin>>a[i];
  REP(i,n) cin>>b[i];
  REP(i,n) cin>>c[i];
  sort(a,a+n);
  sort(b,b+n);
  sort(c,c+n);
  ll bdp[n],cdp[n];
  CLR(bdp);
  CLR(cdp);
  int ind=0;
  REP(i,n){
    while(ind <n && a[ind]<b[i]) ind++;
    bdp[i]=ind;
    if(i!=0) bdp[i]+=bdp[i-1];
  }
  ind=0;
  REP(i,n){
    while(ind <n && b[ind]<c[i]) ind++;
    if(ind==0) cdp[i]=0;
    else cdp[i]=bdp[ind-1];
    if(i!=0) cdp[i]+=cdp[i-1];
  }
  cout<<cdp[n-1]<<"\n";
}


Measured memory_bytes: 4096
/*author - Aryan Mittal*/
#include<bits/stdc++.h>
using namespace std;

#pragma GCC push_options
#pragma GCC optimize ("unroll-loops")

#define watch(x) cout << (#x) << " is " << (x) << "\n"
#define watch2(x,y) cout <<(#x)<<" is "<<(x)<<" and "<<(#y)<<" is "<<(y)<<"\n"

#define pow2(x) ((x)*(x))
#define ll long long
#define ld long double
#define eb emplace_back
#define pb push_back
#define pf push_front

#define mod 1000000007
#define clock (clock() * 1000.0 / CLOCKS_PER_SEC)

#define mp make_pair
#define ff first
#define ss second
#define null NULL

#define all(c) (c).begin(),(c).end()
#define nl "\n"

typedef vector<ll> vl;
typedef vector< vl > vvl;
typedef pair< ll,ll> pll;
typedef map< ll,ll> mll;

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

    ll r;
    cin>>r;

    double ans = 2*M_PI*r;

    cout<<ans<<"\n";
    
    
    return 0;
}

Measured memory_bytes: 3796
#include <stdio.h>
#define MAX 10000

int main(void){
    int list[MAX]={0}, q;
    
    // determine primes
    for (int i=2; i<MAX; i++){
        if (list[i]==-1) continue;
        list[i]=1;
        for (int j=2*i; j<MAX; j+=i){
            list[j] = -1;
        }
    }
    
    while (scanf("%d",&q),q){
        for (int i=q; i>=5; i--){
            if (list[i]==1 && list[i-2]==1){
                printf("%d %d\n",i-2, i);
                break;
            }
        }
    }
    
    return 0;
}

Measured memory_bytes: 2632
import sys
def 解():
    iN,iM = [int(_) for _ in input().split()]
    def addCity(d,p,m,i):
        if p in d:
            d[p].append((m,i))
        else:
            d[p]=[(m,i)]
    dC = {}
    for i in range(iM):
        p,m = (int(_) for _ in sys.stdin.readline().split())
        addCity(dC,p,m,i)
    oAns = []
    for iCity in dC.keys():
        iIndex = 1
        for m,originIndex in sorted(dC[iCity]):
            oAns.append((originIndex,'{:06}{:06}'.format(iCity,iIndex)))
            iIndex += 1
    oAns.sort()
    print("\n".join(map(lambda x:x[1] ,oAns)))
解()


Measured memory_bytes: 53048
#include <iostream>
using namespace std;
int main(){
  long long int N;
  while(cin >> N, N){
    long long int s = 0;
    bool f = false;
    for(long long int i = 1; i*i <= N; ++i){
      if(!(N%i)){
        s += i;
        if(N/i != i) s += N/i;
      }
      if(s > 2*N){
        cout << "abundant number" << endl;
        f = true;
        break;
      }
    }
    if(f) continue;
    if(s == 2*N){
      cout << "perfect number" << endl;
    }else{
      cout << "deficient number" << endl;
    }
  }
  return 0;
}



Measured memory_bytes: 3080
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define REP(i, a, b) for (int i = a; i < b; i++)
typedef pair<ll,ll> pi;
typedef vector<ll> vi;
ll n;
ll leave[100005];
ll answer = 0;
pi whyi[100005];
const ll INF = 1000000000000000000;
 
ll power(ll a, ll b){
	if (b == 0) return 1;
	if (b == 1) return a;
	ll half = power(a, b/2);
	half *= half;
	if (b % 2) half *= a;
	return half;
}
 
int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cin >> n;
	REP(i, 0, n + 1){
		cin >> leave[i];
	}
	if (n == 0 && leave[0] == 1){
		cout << 1 << endl;
		return 0;
	} else if (n == 0){
		cout << -1 << endl;
		return 0;
	}
	for (int i = 0; i <= n; i++){
		if (i == 0){
			whyi[i] = make_pair(1, 1);
			continue;
		}
		
		whyi[i] = MP(max(whyi[i - 1].F - leave[i - 1], (ll)0), min(INF, 2*(whyi[i - 1].S - leave[i - 1])));
		if (whyi[i].S < leave[i]){
			cout << -1 << endl;
			return 0;
		}
	}
	ll node;
	for (int i = n; i >= 0; i--){
		if (i == n){
			answer += leave[i];
			node = leave[i];
			continue;
		}
		node += leave[i];
		node = min(node, whyi[i].S);
		answer += node;
	}
	cout << answer << endl;
	
 
}

Measured memory_bytes: 5936
#define KAKUSUKO
#include <iostream>
#include <algorithm>
#include <bitset>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <cstring>
#include <utility>
#include <vector>
#include <complex>
#include <valarray>
#include <fstream>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <numeric>
#include <climits>
#include <random>

#define _overload(a, b, c, d, ...) d
#define _rep1(X, A, Y) for (int (X) = (A);(X) <= (Y);++(X))
#define _rep2(X, Y) for (int (X) = 0;(X) < (Y);++(X))
#define rep(...) _overload(__VA_ARGS__, _rep1, _rep2)(__VA_ARGS__)
#define rrep(X,Y) for (int (X) = Y-1;(X) >= 0;--(X))
#define all(X) (X).begin(),(X).end()
#define len(X) ((int)(X).size())
#define mod(n, m) (((n)%(m)+(m))%m)
#define fi first
#define sc second
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
const int INFINT = 1 << 30;                          // 1.07x10^ 9
const ll INFLL = 1LL << 60;                          // 1.15x10^18
const double EPS = 1e-10;
const int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};

const int MAX_N = 10, MAX_D = 10;
int N, D;
int X[MAX_N][MAX_D];


int dist(int y, int z) {
  int res = 0;
  for (int i = 0; i < D; ++i) {
    res += (X[y][i]-X[z][i])*(X[y][i]-X[z][i]);
  }
  return res;
}

bool isSq(int num) {
  for (int i = 1; i*i <= num; ++i) {
    if (i*i == num) {
      return true;
    }
  }
  return false;
}

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

  cin >> N >> D;
  rep(i, N) {
    rep(j, D) {
      cin >> X[i][j];
    }
  }

  int ans = 0;
  for (int i = 0; i < N; ++i) {
    for (int j = i+1; j < N; ++j) {
      int d = dist(i, j);
      if (isSq(d)) {
        ++ans;
      }
    }
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream> 
using namespace std;
int a[100000+10];
int n;
 
 
int partition(int p,int r){
	int x,i,j,t;
	x=a[r];
	i=p-1;
	for(j=p;j<r;j++){
		if(a[j]<=x){
			i++;
			t=a[i];a[i]=a[j];a[j]=t;
		}
	}
	t=a[i+1];a[i+1]=a[r];a[r]=t;
	return i+1;
}
 
int main() {
	
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	
	int q=partition(0,n-1);
	
	
	for(int i=0;i<n;i++){
		if(i) cout<<" ";
		if(i==q) cout<<"[";
			cout<<a[i];
		if(i==q) cout<<"]";
	}
	cout<<endl; 
	return 0;
}

Measured memory_bytes: 3468
using System;
using System.Linq;
using System.Collections.Generic;

using E = System.Linq.Enumerable;

public class Program
{
    public static void Main()
    {
        var pqr = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();
        var p = pqr[0];
        var q = pqr[1];
        var r = pqr[2];
        
        Console.WriteLine(new [] { p + q, q + r, r + p }.Min());
    }
}


Measured memory_bytes: 13396
#include<bits/stdc++.h>
#define U [7<<15]={}
#define G )+((c=A[a]+A[P[a]]+C[a])%k?c:0)-M(
typedef long long L;using namespace std;map<L,L>T U;
L P U,E U,Z U,H U,C U,A U,O U,X U,B U,k,n,a,b,c;char s U;
L M(L f){return f?B[f]+M(f^f&-f):0;}
L S(L a,L i){for(a=M(i++G i);i<2e5;i+=i&-i)B[i]+=a;}
L D(L f){L d;for(map<L,L>::iterator I=T[f].begin();I!=T[f].end();I++)
  d=I->first,!Z[d]?P[d]=f,E[d]=E[f]+1,C[d]=I->second,Z[d]=1,D(d),Z[f]+=Z[d],Z[H[f]]<Z[d]?H[f]=d:0:0;}
L K(L f){a=X[f];n=X[b];return a-n?M(O[E[a]<E[n]?a=n,n=b,b=f,n:f]G O[a])+K(P[a]):abs(M(O[f])-M(O[b]));}
int N;
main(){for(cin>>n>>k,N=n;--n;*Z-=T[a][b]=T[b][a]=c)cin>>a>>b>>c;
       for(D(a=0);n<N;a=H[P[++n]]-n?n:0)for(;!O[a];S(a=H[a],O[a]=++b))X[a]=n;
       //*Z-=*O=W(*O=0);
       for(cin>>a;cin>>s>>a>>b;S(H[a],O[a]),S(a,O[a]-1))*s&2?cout<<K(a)<<endl,0:A[a]+=b;}

Measured memory_bytes: 38008
##B - 文字列大好きいろはちゃんイージー / Iroha Loves Strings (ABC Edition)
#1行目
n, l = gets.chomp.to_i

#2行目以降読み込み
x = $stdin.read.split("\n")
x = x.min(n)
x = x.join

print x

Measured memory_bytes: 1788
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#define int long long
using namespace std;
string a(string s) {
	string st = s;
	for (int i = 0; i < st.size(); i++)if (st[i] == '?')st[i] = 'a';
	return st;
}
string z(string s) {
	string st = s;
	for (int i = 0; i < st.size(); i++)if (st[i] == '?')st[i] = 'z';
	return st;
}
int n; string p[11000], s;
signed main() {
	cin >> n;
	for (int i = 0; i < n; i++)cin >> p[i];
	cin >> s;
	int ans1 = 1, ans2 = n + 1;
	for (int i = 0; i < n; i++) {
		if (z(p[i]) < s)ans1++;
		if (a(p[i]) > s)ans2--;
	}
	for (int i = ans1; i <= ans2; i++) {
		if (i != ans1)cout << ' ';
		cout << i;
	}cout << endl;
}

Measured memory_bytes: 896
#include<stdio.h>
#include<stdint.h>
#include<limits.h>
#define min(lhs,rhs) ((rhs)<(lhs)?(rhs):(lhs))

int main(void){
    register int i,j;
    int n,m,x;
    scanf("%d%d%d",&n,&m,&x);
    int c[n],a[n][m];
    for(i = 0;i < n;i++){
        scanf("%d",&c[i]);
        for(j = 0;j < m;j++)scanf("%d",&a[i][j]);
    }
    long amin = LONG_MAX;
    uint16_t bits[n],maxb = 0,curb;
    bits[0] = 1u;
    for(i = 1;i < n;i++)bits[i] = bits[i-1] << 1;
    for(i = 0;i < n;i++)maxb += bits[i];
    long cux[m],curm;
    int flag;
    for(curb = 0u;curb <= maxb;curb++){
        curm = 0;
        flag = 1;
        for(i = 0;i < m;i++)cux[i] = 0;
        for(i = 0;i < n;i++)if(curb & bits[i]){
            curm += c[i];
            for(j = 0;j < m;j++)cux[j] += a[i][j];
        }
        for(i = 0;i < m;i++)if(cux[i] < x)flag = 0;
        if(!flag)continue;
        amin = min(amin,curm);
    }
    printf("%ld",amin == LONG_MAX ? -1 : amin);
}

Measured memory_bytes: 1728