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

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define Max(x,y,z) max(x,max(y,z))
#define Min(x,y,z) min(x,min(y,z))
#define fr(i,s,e) for(i=s;i<e;i++)
#define rf(i,s,e) for(i=s-1;i>=e;i--)
#define pb push_back
#define eb emblace_back
#define mp make_pair
#define ff first
#define ss second
#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl

typedef long long ll;
typedef long double ld;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<vvvi> vvvvi;
typedef vector<long long> vll;
typedef vector<vll> vvll;
typedef vector<vvll> vvvll;
typedef vector<vvvll> vvvvll;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<vvc> vvvc;
typedef vector<pair<long long,long long> > vpll;
typedef vector<vector<pair<ll,ll> > > vvpll;
typedef vector<bool> vb;
typedef vector<vb> vvb;

#define PI 3.141592653589793
#define MOD 1000000007

template<typename T> T gcd(T a,T b) { if(a==0) return b; return gcd(b%a,a); }
template<typename T> T pow(T a,T b, ll m){T ans=1; while(b>0){ if(b%2==1) ans=(ans*a)%m; b/=2; a=(a*a)%m; } return ans%m; }

int main()
{
	IOS;
	ll n;
	cin>>n;
	vll v(n);
	for(ll i=0;i<n;i++)
	{
		cin>>v[i];
	}
	ll ans=0;
	while(true)
	{
		bool check=false;
		for(ll i=0;i<n;i++)
		{
			if(v[i]>=n)
			{
				check=true;
			}
		}
		if(!check)
		{
			break;
		}
		for(ll i=0;i<n;i++)
		{
			ans+=v[i]/n;
			ll st=v[i]/n;
			v[i]-=(v[i]/n) * n;
			for(ll j=0;j<n;j++)
			{
				if(j==i)
					continue;
				v[j]+=st;
			}
		}
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		int A, B, T;
		Scanner scanner = new Scanner(System.in);
		
		A = scanner.nextInt(); 
		B = scanner.nextInt(); 
		T = scanner.nextInt();
	
		scanner.close();
		
		int gen = 0;
		for (int time = 1; time <= T; time++) {
			if (time % A == 0) {
				gen = gen + B;
			}
		}
		System.out.println(gen);
		
		
	}

}


Measured memory_bytes: 24276
#include <iostream>
using namespace std;
 
int main() {
  int a,b,c,d,e;
  cin >> a;
  cin >> b;
  cin >> c;
  cin >> d;
  cin >> e;
  if(a > 0) { 
      cout << e*(b-a) << std::endl;
  } else {
      cout << (-a)*c + d + b*e << std::endl;
  }
}


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

#define int long long
#define rep(i, l, r) for (int i = (int)(l); i < (int)(r); i++)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)x.size())
template <class T> bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T> bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}

template <class T> using V = vector<T>;
using P = pair<int, int>;

/*
 */

int n;
V<int> es[101010];

int dfs(int v, int p){
  int g = 0;
  for(int to : es[v]){
    if(to == p) continue;
    g ^= dfs(to, v) + 1;
  }

  return g;
}

signed main() {
  cin >> n;
  rep(i, 0, n-1){
    int x, y;
    cin >> x >> y;
    x--; y--;
    es[x].emplace_back(y);
    es[y].emplace_back(x);
  }

  cout << (dfs(0, -1) ? "Alice" : "Bob") << endl;

  return 0;
}


Measured memory_bytes: 10368
n = int(input())
alst = list(map(int, input().split()))
num_pos = [-1 for _ in range(n)]

MOD = 10 ** 9 + 7
N = n + 10

fact = [0 for _ in range(N)]
invfact = [0 for _ in range(N)]
fact[0] = 1
for i in range(1, N):
    fact[i] = fact[i - 1] * i % MOD

invfact[N - 1] = pow(fact[N - 1], MOD - 2, MOD)

for i in range(N - 2, -1, -1):
    invfact[i] = invfact[i + 1] * (i + 1) % MOD
def nCk(n, k):
    if k < 0 or n < k:
        return 0
    else:
        return fact[n] * invfact[k] * invfact[n - k] % MOD

for i, num in enumerate(alst):
    if num_pos[num - 1] == -1:
        num_pos[num - 1] = i
    else:
        bef = num_pos[num - 1]
        aft = n - i
for i in range(1, n + 2):
    ans = nCk(n + 1, i) - nCk(bef + aft, i - 1)
    ans %= MOD
    print(ans)
    
    
    

Measured memory_bytes: 25384
n = int(input())
c = list(input())

cnt = 0
l = 0
r = n-1
while l < r:
    if c[l] == 'R':
        l += 1
    elif c[l] == 'W':
        if c[r] == 'R':
            c[l] = 'R'
            c[r] = 'W'
            cnt += 1
        else:
            r -= 1

print(cnt)

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

const int MAXN = 100005;

int sum[MAXN];

int main()
{
	int n;
	cin >> n;
	for (int i = 1; i <= n; i++) sum[i] = sum[i/10]+i%10;
	int ans = 1e9;
	for (int i = 1; i < n; i++) ans = min(ans, sum[i]+sum[n-i]);
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#include <climits>
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define srep(i, begin, end) for (__typeof(end) i = begin; i != end; i++)
#define si(x) int x = scanInt();
#define sll(x) LL x = scanLong();
#define sci(x) int x; scanf("%d", &x);
#define scll(x) LL x; scanf("%lld", &x);
#define pi(x) printf("%d ", x)
#define pll(x) printf("%lld ", x)
#define nl printf("\n")
#define clr(a) memset(a, 0, sizeof(a))
#define PB push_back
#define MP make_pair
using namespace std;
typedef unsigned int UI; // 32 bit integer
typedef long int LI; // 32 bit integer
typedef unsigned long int ULI; // 32 bit unsigned integer
typedef long long int LL; // 64 bit integer
typedef unsigned long long int  ULL; // 64 bit unsigned integer
typedef long double LD;
typedef vector<int> VI;
typedef vector<LL> VLL;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;
const LL MOD = 1e9+7;

/* Fast I/O */
inline int scanInt() {
	int n = 0;
	char ch = getchar();
	int sign = 1;
	while(ch < '0' || ch > '9') {
		if(ch == '-')	sign = -1;
		ch = getchar();
	}
	while(ch >= '0' && ch <= '9') {
		n = (n<<1)+(n<<3)+(int)(ch-'0');
		ch = getchar();
	}
	return n*sign;
}

inline LL scanLong() {
	LL n = 0;
	char ch = getchar();
	LL sign = 1;
	while(ch < '0' || ch > '9') {
		if(ch == '-')	sign = -1;
		ch = getchar();
	}
	while(ch >= '0' && ch <= '9') {
		n = (n<<1)+(n<<3)+(LL)(ch-'0');
		ch = getchar();
	}
	return n*sign;
}

int main() {
	sll(n); sll(q);
	string s; cin >> s;
	LL count[n-1];
	clr(count);
	rep(i, 0, n-1) {
		count[i] = (i > 0 ? count[i-1] : 0);
		if(s[i] == 'A' && s[i+1] == 'C')	count[i]++;
	}
	rep(i, 0, q) {
		sll(l); sll(r); l--; r--;
		LL ans = count[r-1] - (l > 0 ? count[l-1] : 0);
		pll(ans); nl;
	}
}


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

int main(){
  int r, d, x;
  cin >> r >> d >> x;
  
  int ans=x;
  for(int i = 0;i<10;i++){
    ans = ans * r -d;
    cout << ans << endl;
  }
  
  return 0;
}

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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define CHMIN(a,b) a=min((a),(b))
#define CHMAX(a,b) a=max((a),(b))

// mod
const ll MOD = 1000000007ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

// floating
typedef double Real;
const Real EPS = 1e-11;
#define EQ0(x) (abs(x)<EPS)
#define EQ(a,b) (abs(a-b)<EPS)
typedef complex<Real> P;

int n;
ll k;
ll a[125252];
int cnt1[62];

ll memo[62][2];
ll dfs(int b, bool less){
  if(b<0)return 0ll;
  if(memo[b][less]!=-1)return memo[b][less];
  ll ans = 0;
  if(!less){
    if(k>>b&1){
      // 0
      CHMAX(ans, dfs(b-1,true)+(((ll)cnt1[b])<<b));
      // 1
      CHMAX(ans, dfs(b-1,false)+(((ll)(n-cnt1[b]))<<b));
    }else{
      // 0
      CHMAX(ans, dfs(b-1,false)+(((ll)cnt1[b])<<b));
    }
  }else{
    // 0
    CHMAX(ans, dfs(b-1,true)+(((ll)cnt1[b])<<b));
    // 1
    CHMAX(ans, dfs(b-1,true)+(((ll)(n-cnt1[b]))<<b));
  }
  return memo[b][less] = ans;
}

int main(){
  scanf("%d%lld", &n, &k);
  REP(i,n)scanf("%lld",a+i);
  REP(i,n)REP(b,62){
    cnt1[b] += (a[i]>>b&1);
  }
  REP(i,62)REP(j,2)memo[i][j]=-1;
  ll ans = dfs(60,false);
  printf("%lld\n",ans);
  return 0;
}


Measured memory_bytes: 1024
#include<iostream>
#include<algorithm>
#include<vector>
#define mod 1000000007
using namespace std;

int main()
{
  int N,T,a;
  long long ans=1;
  vector<int> V;
  vector<int>::iterator p,q;

  cin>>N>>T;
  for(int i=0;i<N;i++){
    cin>>a;
    V.push_back(a);
  }

  sort(V.begin(),V.end());
  for(int i=1;i<N;i++){
    p=lower_bound(V.begin(),V.begin()+i,V[i]-T);
    q=upper_bound(V.begin(),V.begin()+i,V[i]);
    ans*=(q-p)+1;
    ans%=mod;
  }
  cout<<ans<<endl;;
  return 0;
}

Measured memory_bytes: 1676
#include<bits/stdc++.h>
using namespace std;
int main(){
    string s;
    int n;
    int N=0;
    vector<string> ans(10);
    while(1){
        cin >> s;
        if(s=="-") {
            break;
        }
        cin >> n;
        int h[n];
        for(int i=0;i<n;i++){
            cin >> h[i];
            string sub1=s.substr(0,h[i]);
            string sub2=s.substr(h[i], s.size()-h[i]);
            s=sub2+sub1;
        }
        ans[N]=s;
        N++;
    }
    for(int i=0;i<N;i++){
        cout << ans[i] << endl;
    }
    return 0;
}


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

int main()
{
	int a;
	cin >> a;
	string s;
	cin >> s;
	int k;
	cin >> k;
	char n = s[k-1];
	for(int i=0;i<a;i++)
	{
		if(s[i]==n)
		{
			cout << s[i];
		}
		else
		{
			cout << '*';
		}
	}
	cout << endl;
}

Measured memory_bytes: 256
a = gets.chomp.split("\s")
if a[0].to_i <= a[2].to_i and a[0].to_i < a[1].to_i
  if a[2].to_i < a[1].to_i
    puts "#{a[0]} #{a[2]} #{a[1]}"
  else
    puts "#{a[0]} #{a[1]} #{a[2]}"
  end
elsif a[2].to_i <= a[1].to_i and a[2].to_i < a[0].to_i
  if a[1].to_i < a[0].to_i
    puts "#{a[2]} #{a[1]} #{a[0]}"
  else
    puts "#{a[2]} #{a[0]} #{a[1]}"
  end
else 
  if a[2].to_i < a[0].to_i 
    puts "#{a[1]} #{a[2]} #{a[0]}"
  else
    puts "#{a[1]} #{a[0]} #{a[2]}"
  end
end

Measured memory_bytes: 8668
def preorder(i, A):
    if i == -1:
        return ""
    n = A[i]
    l = n[1]
    ls = preorder(l, A)
    r = n[2]
    rs = preorder(r, A)
    ans = " {}".format(i)
    if ls != "":
        ans += ls
    if rs != "":
        ans += rs

    return ans

def inorder(i, A):
    if i == -1:
        return ""
    n = A[i]
    l = n[1]
    ls = inorder(l, A)
    r = n[2]
    rs = inorder(r, A)
    ans = " {}".format(i)
    if ls != "":
        ans = ls + ans
    if rs != "":
        ans += rs

    return ans

def postorder(i, A):
    if i == -1:
        return ""
    n = A[i]
    l = n[1]
    ls = postorder(l, A)
    r = n[2]
    rs = postorder(r, A)
    ans = ""
    if ls != "":
        ans = ls
    if rs != "":
        ans += rs
    ans += " {}".format(i)

    return ans

n = int(input())
root = set([x for x in range(n)])

T = [None] * n
for x in range(n):
    N = list(map(int, input().split()))
    T[N[0]] = N
    root -= set(N[1:])

r = root.pop()
print("Preorder")
print(preorder(r, T[:]))

print("Inorder")
print(inorder(r, T[:]))

print("Postorder")
print(postorder(r, T[:]))

Measured memory_bytes: 7800
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  int a[] = {1,3,1,2,1,2,1,1,2,1,2,1};
  int x, y;
  cin >> x >> y;
  if (a[x-1] == a[y-1]) {
  	cout << "Yes\n";
  }else {
  	cout << "No\n";
  }
}

Measured memory_bytes: 256
from heapq import heappush as hpush, heappop as hpop

n, m = map(int, raw_input().strip().split())
a = map(int, raw_input().strip().split())

heap = []
for num in a:
    hpush(heap, -num)

while m > 0:
    x = hpop(heap)
    if x == 0: break
    x = -x
    x /= 2
    hpush(heap, -x)
    m -= 1

ans = 0
while heap:
    x = hpop(heap)
    ans -= x

print ans

Measured memory_bytes: 47608
# _*_ coding:utf-8 _*_
#  Atcoder_EducationDP_ContestX-1
#  TODO https://atcoder.jp/contests/dp/tasks/dp_a
#  参考文献 https://qiita.com/drken/items/dc53c683d6de8aeacf5a#%E8%A7%A3%E6%B3%95
#  C++ バージョンを上から書き下す
#  貰う型DP
import sys

# 初期化
# 足場の数となる要素数は足場の値の最大値であるMAX
blockMAXElement = 100010
blockElementRange = range(0,blockMAXElement,+1)
# DPテーブルの中身は今回は最小値を求めるため最大値を利用
dp = list()
for _ in blockElementRange:
	dp.append(sys.maxsize)

N = int(input().strip())
blockRange = range(0,N,+1)
h = list(map(int,input().strip().split(' ')))

# 初期の条件 0歩の時は値が与えられていないのでDPは0にセット
dp[0] = 0
for position in range(1,N,+1):
#   一つ手前の足場までで最適な値のはず、のコスト
	previousMinCost = dp[position-1]
#   一つ手前から来た場合の足場positionでのコスト計
#   pM = previousMin
	pMNowCost = dp[position-1]+abs(h[position]-h[position-1])
#   今の足場で設定されている足場へのコストより小さくなるならそれを改めて入れる
	if pMNowCost <= dp[position]:
		dp[position] = pMNowCost
#   これは二つ手前から来たケースを考えるのでpositon = 1の場合を除いて考える
#   それ以降は一個手前からと同じ
	if 1 < position:
		previous2MinCost = dp[position-2]
		pM2NowCost = dp[position-2]+abs(h[position]-h[position-2])
		if pM2NowCost <= dp[position]:
			dp[position] = pM2NowCost

print("{}".format(dp[N-1]))


Measured memory_bytes: 14912
#include <iostream>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <queue>
#include <stack>
#include <math.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)

int main(void){
    string buf;
    cin >> buf;

    if(buf.at(1) == 'B'){
        cout << "ARC" << endl;
    }else{
        cout << "ABC" << endl;
    }
    return 0;
}

Measured memory_bytes: 3624
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <map>
#include <vector>
#include <set>
#include <cstdlib>
#include <deque>
#include <stack>

using namespace std;
const long long P = 1000000007;
const long long INF = 1LL << 60;

int main() {
  string s,t;
  cin >> s >> t;
  t.pop_back();
  if(s == t) {
    cout << "Yes" << endl;
  }else {
    cout << "No" << endl;
  }
  return 0;
}


Measured memory_bytes: 3628
import java.util.Arrays;
import java.util.Scanner;

class Main{
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int A=sc.nextInt();
		int B=sc.nextInt();
		int C=sc.nextInt();
		int max=Math.max(Math.max(A,B), C);
		int difA=max-A;
		int difB=max-B;
		int difC=max-C;
		int[] matome= {difA,difB,difC};
		Arrays.sort(matome);
		int kaisu=matome[1];

		if((matome[2]-matome[1])%2==0) {
			kaisu+=(matome[2]-matome[1])/2;
		}

		else if((matome[2]-matome[1])%2==1) {
			kaisu+=(matome[2]-matome[1])/2;
			kaisu+=2;
		}
		System.out.println(kaisu);
	}
}

Measured memory_bytes: 23892
#include <algorithm>
#include <cassert>
#include <iostream>
#include <vector>

int cnt = 0;

void trace(int* array, int size) {
  for (int i = 0; i < size; i++) {
    std::cout << array[i] << (i == size - 1 ? "\n" : " ");
  }
}

void trace(std::vector<long> vec) {
  for (int i = 0; i < vec.size(); i++) {
    std::cout << vec[i] << (i < vec.size() - 1 ? " " : "\n");
  }
}

void insertionSort(long* array, int size, int start) {
  for (int i = start; i < size; i++) {
    int v = array[i];
    int j = i - start;
    while (j >= 0 && array[j] > v) {
      array[j + start] = array[j];
      j = j - start;
      cnt++;
    }
    array[j + start] = v;
  }
}

std::vector<long> getWidthListVec(int limit) {
  int next = 1;
  std::vector<long> vec;
  while (next <= limit) {
    vec.insert(vec.begin(), next);
    next = 3 * vec[0] + 1;
  }
  return vec;
}

void shellSort(long* array, int size, std::vector<long> widthList) {
  cnt = 0;
  int m = widthList.size();
  for (int i = 0; i < m; i++) {
    insertionSort(array, size, widthList[i]);
  }
}

bool eql(int* a, int* b, int n) {
  for (int i = 0; i < n; i++) {
    if (a[i] != b[i]) return false;
  }
  return true;
}
void test() {
  trace(getWidthListVec(1));

  int a[3] = {5, 3, 2};
  int ab[3] = {2, 3, 5};

  trace(a, 3);
  if (eql(a, ab, 3)) {
    std::cout << "Equal";
  } else {
    std::cout << "Not Equal";
  }
}

void solve() {
  int n;
  std::cin >> n;
  long array[n];
  for (int i = 0; i < n; i++) {
    std::cin >> array[i];
  }
  auto wl = getWidthListVec(n);
  std::cout << wl.size() << std::endl;
  trace(wl);
  shellSort(array, n, wl);
  std::cout << cnt << std::endl;
  for (int i = 0; i < n; i++) {
    std::cout << array[i] << std::endl;
  }
}

int main() {
  solve();
  return 0;
}



Measured memory_bytes: 10960
#include <iostream>
#include <cmath>
#include <string>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <math.h>
#include <iomanip>
#include <bitset>
#include <cstring>
#include <stdlib.h>
#include <utility>
#include <set>
#include <map>
#include <string.h>
#include <cstring>

using namespace std;

int main(){
   
    long long n, a, b;
    cin >> n >> a >> b;
    long long ans = n/(a+b);
    long long m = 0;
    
    if(n%(a+b)>a){
        ans++;
    }
    
    else m= n%(a+b);
    
    cout << ans*a+m << endl;
        
    
    return 0;
}


Measured memory_bytes: 256
import math
a, b, h, m = map(float, input().split())
h = h * 60 + m
ra = h * 0.5
rb = m * 6
rc = max(ra, rb) - min(ra, rb)

if rc > 180.0:
	rc = 360.0 - rc

if rc == 180.0:
	ans = a + b
else:
	ans = a**2 + b**2 - 2 * a* b * math.cos(math.radians(rc))
	ans = math.sqrt(ans)

print(ans)


Measured memory_bytes: 9444
// AOJ 	2529: Brainf*ck
// 2018.2.7 bal4u
 
#include <stdio.h>
#include <math.h>

#define ABS(a)	((a)>=0?(a):-(a))

char s[1003];
int tbl[12];

int main()
{
	int i, pi;
	char *p;

	fgets(s, 1003, stdin);

	pi = 0;
	for (p = s; *p > ' '; p++) {
		i = (*p-33) >> 3;
		if      (pi < i) while (pi < i) putchar('>'), pi++;
		else if (pi > i) while (pi > i) putchar('<'), pi--;

		if      (tbl[i] < *p) while (tbl[i] < *p) putchar('+'), tbl[i]++;
		else if (tbl[i] > *p) while (tbl[i] > *p) putchar('-'), tbl[i]--;

		putchar('.');
	}
    return 0;
}



Measured memory_bytes: 2108
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <string>
#include <map>
#include <queue>

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = (n) - 1; i >= 0; i--)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (a); i > (b); i--)
#define ALL(a) (a).begin(), (a).end()


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

    queue<ll> q;
    FOR(i, 1, 10) q.push(i);

    ll n = 0;
    REP(i, K) {
        n = q.front(); q.pop();
        if (n % 10 == 0) {
            q.push(n * 10);
            q.push(n * 10 + 1);
        }
        else if (n % 10 == 9) {
            q.push(n * 10 + 8);
            q.push(n * 10 + 9);
        }
        else {
            FOR(j, -1, 2) q.push(n * 10 + n % 10 + j);
        }
    }
    cout << n << endl;
    return 0;
}

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

using vi = vector<int>;

int main()
{
    ios_base::sync_with_stdio(0);

    int n; cin >> n;

    vi v(n);

    for(int i = 0; i < n; i++) cin >> v[i];

    vi ans(n);

    for(int i = n - 1, j = 0, a = 0, b = n - 1; i >= 0; i--, j++)
    {
        if(j % 2 == 0) ans[a++] = v[i];
        else ans[b--] = v[i];
    }

    for(auto x : ans) cout << x << ' '; cout << endl;
    return 0;
}

Measured memory_bytes: 3712
#!/Library/Frameworks/Python.framework/Versions/3.5/bin/python3
import math

x = int(input())

t = math.floor(math.sqrt(x))

amax = 1
for i in range(t - 1):
    a = 1
    n = 1
    while a <= x:
        if amax < a:
            amax = a
        a = (i + 2) ** n
        n += 1

print(amax)


Measured memory_bytes: 2940
import qualified Data.IntMap.Strict as M

main = interact $ show . sol . read

sol = fst . f M.empty

f m 0 = (1,M.insert 0 1 m)
f m 1 = (2,M.insert 1 2 m)
f m n
  | n `M.member` m  = (m M.! n,m)
  | otherwise       = (a,M.insert n a m1)
  where
  k = n `div` 2
  (a0,m0) = f m k
  (a1,m1) = f m0 (k-1)
  a = (if odd n then 2*a0+a1 else a0+2*a1) `mod` p 

p = 10^9+7 :: Int

-- OEIS A007729	: 6th binary partition function.
-- a(2k) = 2*a(k-1) + a(k); a(2k+1) = 2*a(k) + a(k-1)
-- 1,2,4,5,8,10,13,14,18,21,26,28,33,36,40,41,46,50,57,60,68,73,80,82,89,94..

Measured memory_bytes: 508
import java.util.Scanner;
public class Main{
	public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        
        while(true){
            int n = sc.nextInt();
            int r = sc.nextInt();
            if(n == 0&&r == 0) break;
            int[] OLD = new int[n];
            int[] NEW = new int[n];
            for(int i = 0; i < n; i++){
                OLD[i] = n - i;
                NEW[i] = n - i;
            }
            for(int i = 0; i < r; i++){
                int p = sc.nextInt(); 
                int c = sc.nextInt(); 
                for(int j = 0; j < p-1; j++){
                    NEW[j + c] = OLD[j];
                }
                for(int j = 0; j < c; j++){
                    NEW[j] = OLD[j + p - 1];
                }

                for(int j = 0; j < n; j++){
                    OLD[j] = NEW[j];
                }
            }
            System.out.println(OLD[0]);
        }
        sc.close();
        
    }
}



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

class Program {
    static int ReadInt() { return int.Parse(Console.ReadLine()); }
    static int[] ReadInts() { return Console.ReadLine().Split().Select(int.Parse).ToArray(); }
    static string[] ReadStrings() { return Console.ReadLine().Split(); }

    static int Calc(int[] xs) {
        int min = xs.Min();
        int max = xs.Max();

        int ans = int.MaxValue;
        for (int i = min; i <= max; i++) {
            int d = 0;
            for (int j = 0; j < xs.Length; j++) {
                int x = Math.Abs(xs[j] - i);
                d += x * x;
            }
            ans = Math.Min(ans, d);
        }
        return ans;
    }

    static void Main() {
        ReadInt();
        var xs = ReadInts();
        Console.WriteLine(Calc(xs));
    }
}

Measured memory_bytes: 3032
a = [[0 for i in range(3)] for j in range(200)]
ans = [0]*200
n = input()
for i in range(n):
    a[i] = map(int, raw_input().split())
for t in range(3):
    for i in range(n):
        c = 1
        for j in range(n):
            if i==j: continue
            if a[i][t]==a[j][t]:
                c = 0; break;
        if c: ans[i] += a[i][t]
for i in range(n):
    print ans[i]

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

// 解説資料：https://img.atcoder.jp/abc166/editorial.pdf
// 変数分離により、計算量を減らしている
// 連想配列の意識も足りなかった（思いつく可能性はあったと思う）

#define NPERSON 200000

int main() {
    // 入力
    int nPerson;
    cin >> nPerson;
    int a[NPERSON+1];
    for (int i = 1; i <= nPerson; i++){   
        cin >> a[i];
    }
    
    // i + A[i] を求め、連想配列で格納する（i + A[i] を満たす i の数を配列に記録する）
    int cntList[NPERSON + 1];      // 
    for (int i = 1; i <= nPerson; i++){
        cntList[i] = 0;
    }
    
    for (int i = 1; i <= nPerson; i++){
        int tmp = i + a[i];
        if(tmp > nPerson){
            continue;
        }
        cntList[tmp]++;
    }

    // j - A[j] を求め、その値の連想配列へアクセスすることで、条件を満たす (i + A[i] = j - A[j] となる) ペア数がわかるので、その値を加算する
    long cnt = 0;
    for (int i = 1; i <= nPerson; i++){
        int tmp = i - a[i];
        if(tmp <= 0){
            continue;
        }
        cnt += (long)cntList[tmp];
    }

    // 出力
    cout << cnt << endl;

    return 0;
}


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

using namespace std;

int a, max1 = 1001 , max2 = 10001;

int main()
{
    for (int i = 1 ; i <= 2 ; i++)
    {
        cin >> a;
        max1 = min(max1 , a);
    }
    for (int i = 1 ; i <= 2 ; i++)
    {
        cin >> a;
        max2 = min(max2 , a);
    }
    cout << max1 + max2;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int x,y,cnt[5],ans;
int main()
{
	for(int i=1;i<=3;i++)
	{
		scanf("%d%d",&x,&y);
		cnt[x]++,cnt[y]++;
	}
	for(int i=1;i<=4;i++) if(cnt[i]&1) ans++;
	puts(ans<=2?"YES":"NO");
	return 0; 
}

Measured memory_bytes: 256
n = int(input())
A = list(map(int, input().split()))
ans = 1
zero = 0
fail = 0
for a in A:
    if a == 0:
        zero = 1
    if fail == 0:
        ans *= a
    if ans > 10**18:
        fail = 1
if zero == 1:
    print(0)
else:
    if fail == 1:
        print(-1)
    else:
        print(ans)


Measured memory_bytes: 21700
#include "bits/stdc++.h"

#define REP(i,n) for(ll i=0;i<ll(n);++i)
#define RREP(i,n) for(ll i=ll(n)-1;i>=0;--i)
#define FOR(i,m,n) for(ll i=m;i<ll(n);++i)
#define RFOR(i,m,n) for(ll i=ll(n)-1;i>=ll(m);--i)
#define ALL(v) (v).begin(),(v).end()
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());
#define INF 1000000001ll
#define MOD 1000000007ll
#define EPS 1e-9

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


using namespace std;

using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vvl = vector<vl>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

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


int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n; cin >> n;
	vvi v(2, vi(3));
	REP(i, 2)REP(j, 3)cin >> v[i][j];
	vvl dpa(4, vl(n + 1, -INF * INF));
	REP(i, 4)dpa[i][0] = 0;

	REP(i, 3) {
		REP(j, dpa[i].size())chmax(dpa[i + 1][j], dpa[i][j]);
		FOR(j, v[0][i], dpa[i].size()) {
			chmax(dpa[i + 1][j], dpa[i + 1][j - v[0][i]] + v[1][i]);
		}
	}
	ll m = -INF * INF;
	REP(i, n + 1) {
		chmax(m, n - i + dpa[3][i]);
	}
	vvl dpb(4, vl(m + 1, -INF * INF));
	REP(i, 4)dpb[i][0] = 0;

	REP(i, 3) {
		REP(j, dpb[i].size())chmax(dpb[i + 1][j], dpb[i][j]);
		FOR(j, v[1][i], dpb[i].size()) {
			chmax(dpb[i + 1][j], dpb[i + 1][j - v[1][i]] + v[0][i]);
		}
	}
	ll ans = -INF * INF;
	REP(i, m + 1) {
		chmax(ans, m - i + dpb[3][i]);
	}
	cout << ans << endl;
}

Measured memory_bytes: 977024
N, T = map(int, input().split())
c, t = [0]*N, [0]*N
best = float('inf')
flag = False
for i in range(N):
    ci, ti = map(int, input().split())
    if ti <= T:
        flag = True
        best = min(best, ci)
if flag:
    print(best)
else:
    print('TLE')


Measured memory_bytes: 3060
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <fstream>
#include <sstream>
#include <iomanip>
#define ll long long

using namespace std;

long long MOD = 1000000007;

int main(){
    ll N;
    cin >> N;
    vector<ll> A(N,0);
    ll sum_=1;
    for(auto &a:A){
        cin >> a;
        if(a==0){
            cout << 0 << endl;
            return 0;
        }
    }
    for(const auto &a:A){
        if(sum_==0){
            cout << 0 << endl;
            return 0;
        }else if(1000000000000000000LL/sum_<a){
            cout << -1 << endl;
            return 0;
        }
        sum_*=a;
        //cout << 1000000000000000000LL/sum_ << endl;
        //cout << a << endl;
    }
    cout << sum_ << endl;
}

Measured memory_bytes: 4036
#include<bits/stdc++.h>
typedef long long int ll;
using namespace std;
ll pref_sum[404][404] , dp[404][404];
int a[3000];
int main()
{
    int n;
    cin>>n;
    for(int i=0;i<n;i++)
    cin>>a[i];
    if(n==1)
    {
        cout<<a[0]<<endl;
        return 0;
    }
    if(n==2)
    {
        cout<<a[0]+a[1]<<endl;
        return 0;
    }
    memset(pref_sum,0,sizeof(pref_sum));
    memset(dp,0,sizeof(dp));
    for(int i=0;i<n;i++)
    {
        pref_sum[i][i]=a[i];
        dp[i][i]=a[i];
        dp[i][i+1] = a[i]+a[i+1];
        for(int j=i+1;j<n;j++)
            pref_sum[i][j] = pref_sum[i][j-1] + a[j];
    }
    int i=0,j=2;
    int jstart=1;
    while( true)
    {
        ll val;
        ll minval=LONG_LONG_MAX;
        for(int z=i;z<j;z++){
            val=pref_sum[i][j] + dp[i][z] + dp[z+1][j];
            if(z==i)
                val-=a[i];
            if(z+1==j)
                val-=a[j];
            minval=min(val,minval);
        }
        dp[i][j] = minval;
        if((i==0 && j==n-1))
            break;
        i++;
        j++;
        if(j==n)
        {
            i=0;
            jstart++;
            j=jstart;
        }
    }
    cout<<dp[0][n-1]<<endl;
}


Measured memory_bytes: 2816
// Hail god Yato
 
#include <bits/stdc++.h> 
using namespace std;
 
#define hs ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
typedef long long ll;
const ll mod = 1000000007;
const ll INF = 1e18;
const ll MAX = 100001;
//
//
void solve(){
    string str;
    cin>>str;
    ll sm = 0;
    for(char ch : str){
        sm += (ch-'0');
    }
    if(sm%9 == 0)
        cout<<"Yes";
    else
        cout<<"No";
}
int main(){ 
        hs;
        ll t;
        t=1;
        // cin>>t;
        for (int i=1; i<=t; i++){
                //cout<<"Case #"<<i<<": ";
                solve();
         }
        return 0; 
}

Measured memory_bytes: 3696
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"

using namespace std;

//const long long int MOD = 1000000007;
const int MOD = 1000000007;
//const int MOD = 998244353;
//const long long int MOD = 998244353;
const double EPS = 1e-8;

//int N, M, K, H, W, L, R;
long long int N, M, K, H, W, L, R;


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

	cin >> N;
	vector<int>v(N);
	for (auto &i : v)cin >> i;
	for (int i = 1; i < N - 1; i++) {
		if (v[i] > v[i - 1] && v[i] < v[i + 1])M++;
		if (v[i] < v[i - 1] && v[i] > v[i + 1])M++;
	}
	cout << M << endl;
}

Measured memory_bytes: 256
n = int(input())
s = list(input())
a = [0]*n
for i in range(n):
  if s[i] == 'E':
    a[i] = a[i-1]+1
  else:
    a[i] = a[i-1]
b = [0]*n
for i in range(n):
  if i == 0:
    b[i] = a[n-1] - a[i]
  elif i == n-1:
    b[i] = i - a[i-1]
  else:
    b[i] = i - a[i-1] + a[n-1] - a[i]
print(min(b))

Measured memory_bytes: 29176
#include <bits/stdc++.h>
#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 all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define bit(n) (1<<(n))
#define ii(x) int x; cin >> (x)
#define ii2(x, y) int x, y; cin >> (x) >> (y)
#define ii3(x, y, z) int x, y, z; cin >> (x) >> (y) >> (z)
#define yn(x, ok, ng) cout << ((x)?(ok):(ng)) << endl
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<bool> vb;
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; }
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}
int const INF = 1001001001;


// modint: mod 計算を int を扱うように扱える構造体
template<int MOD> struct Fp {
long long val;
constexpr Fp(long long v = 0) noexcept : val(v % MOD) {
if (val < 0) val += MOD;
}
constexpr int getmod() { return MOD; }
constexpr Fp operator - () const noexcept {
return val ? MOD - val : 0;
}
constexpr Fp operator + (const Fp& r) const noexcept { return Fp(*this) += r; }
constexpr Fp operator - (const Fp& r) const noexcept { return Fp(*this) -= r; }
constexpr Fp operator * (const Fp& r) const noexcept { return Fp(*this) *= r; }
constexpr Fp operator / (const Fp& r) const noexcept { return Fp(*this) /= r; }
constexpr Fp& operator += (const Fp& r) noexcept {
val += r.val;
if (val >= MOD) val -= MOD;
return *this;
}
constexpr Fp& operator -= (const Fp& r) noexcept {
val -= r.val;
if (val < 0) val += MOD;
return *this;
}
constexpr Fp& operator *= (const Fp& r) noexcept {
val = val * r.val % MOD;
return *this;
}
constexpr Fp& operator /= (const Fp& r) noexcept {
long long a = r.val, b = MOD, u = 1, v = 0;
while (b) {
long long t = a / b;
a -= t * b; swap(a, b);
u -= t * v; swap(u, v);
}
val = val * u % MOD;
if (val < 0) val += MOD;
return *this;
}
constexpr bool operator == (const Fp& r) const noexcept {
return this->val == r.val;
}
constexpr bool operator != (const Fp& r) const noexcept {
return this->val != r.val;
}
friend constexpr ostream& operator << (ostream &os, const Fp<MOD>& x) noexcept {
return os << x.val;
}
friend constexpr Fp<MOD> modpow(const Fp<MOD> &a, long long n) noexcept {
if (n == 0) return 1;
auto t = modpow(a, n / 2);
t = t * t;
if (n & 1) t = t * a;
return t;
}
};

const int MOD = 1000000007;
using mint = Fp<MOD>;

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

int n;
cin >> n;
vi c(3);
mint ans = 1;
rep(i,n) {
    int a;
    cin >> a;
    int cnt = 0;
    rep(j,3) {
        if(a == c[j]) cnt++;
    }
    if(cnt == 0) {
        cout << 0 << endl;
        return 0;
    }
    ans *= cnt;
    rep(j,3) {
        if(a == c[j]) {
            c[j]++;
            break;
        }
    }
}
cout << ans << endl;
return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <fstream>
#include <algorithm>
#include <map>
#include <set>
#include <unordered_map>
#include <iomanip>
#include <math.h>
#include <queue>
#include <stack>
using namespace std;
 
#define pb push_back
#define f first
#define s second
#define endl '\n'
#define EPS 1e-9
#define PI acos(-1)
 
using ll = long long;
using pll = pair<ll,ll>;
using ii = pair<int,int>;
using iii = pair<pair<int,int>,int>;
using viii = vector<iii>;
using vi = vector<int>;
using vii = vector<ii>;
using vll = vector<ll>;
using ui = unsigned int;
 

ll valores[105];
ll peso[105];	

ll dp[105][100005];

void iniciar(){
	for(int i=0;i<105;i++){
		for(int j =0;j<100005;j++){
			dp[i][j] = -1;
		}
	}
}
ll max(ll a,ll b){
	if(a > b) return a;
	return b;
}

ll f(ll n,ll p){
	if(n == 0 || p == 0){
		return 0;
	} 
	if(dp[n][p] == -1){
		if(p >= peso[n]){
			return dp[n][p] = max(f(n-1,p-peso[n])+valores[n] , f(n-1,p));
		}
		else{
			return dp[n][p] = f(n-1,p);
		}
	}
	else return dp[n][p];
}
int main() {
    ofstream out("output.txt");
    ios_base::sync_with_stdio(false);
	
	iniciar();
	ll n,p;
	cin>>n>>p;
	for(int i =1;i<=n;i++) cin>>peso[i]>>valores[i];
	/*for(int i =1;i<=n;i++){
		cout<<peso[i]<<" "<<valores[i]<<endl;
	}*/
	cout<<(f(n,p))<<endl;
	
    return 0;
}   


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

bool cmp(int a, int b)
{
	return a > b;
}

int main()
{
    int n, k;
    cin >> n >> k;
    
    int a[n];
    for (int i = 0; i < n; i++)
    {
    	cin >> a[i];
    }
    
    sort(a, a+n, cmp);
    
    int sum = 0;
    
    for (int i = 0; i < k; i++)
    {
    	sum += a[i];
    }
    
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
double func(int T,int N,int K){
  int c = 0;
  while(true){
    if(T>=K) break;
    T *= 2;
    c++;
  }
  double p = N;
  for(int i = 0;i<c;i++){
    p = p*2;
  }
  return 1/p;
}
 
int main() {
  int N,K;
  cin >> N >> K;
  double ans = 0;
  for(int T = 1;T<=N;T++){
    ans += func(T,N,K);
  }
    
  cout << fixed << setprecision(10);
  cout << ans << endl;


}

Measured memory_bytes: 256
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <cmath>
#include <math.h> // sqrt()
#include <iomanip>
#define rep(i , n) for (int i = 1; i <= (int)(n); i++)
#define repz(i , n) for (int i = 0; i < (int) n; i++)
#define repi(i , r, n) for (int i = r; i <= (int)(n); i++)
#define repd(i , r, n) for (int i = r; i >= (int)(n); i--)


using namespace std;


int main(){
    int n , k ;
    int64_t ans;
    cin >> n >> k;
    ans = pow( ( n / k) , 3);
    if ( k % 2 == 0){
        ans += pow( ( n / k) + (( n - (( n / k) * k)) / ( k / 2)  ) , 3);
    }
    cout << ans << endl;
    
    
}


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

#define lli long long int
#define LLI(n) lli n; cin >> n;
#define STR(n) string n; cin >> s;
#define Sort(n) sort(n.begin(), n.end());
#define Reve(n) reverse(n.begin(), n.end());
#define yes cout << "Yes" << endl;
#define no cout << "No" << endl;
#define C45(n) (n + 1) / 2
#define OUT(n) cout << n << endl;
#define SRC(n, c)for (lli i = 0;i < s.size(); i++) { if (s.at(i) == c) { n++; } };

//素数
bool IsPrime(lli num)
{
  if (num < 2) return false;
  else if (num == 2) return true;
  else if (num % 2 == 0) return false;
  long double sqrtNum = sqrt(num);
  for (lli i = 3; i <= sqrtNum; i += 2)
  {
    if (num % i == 0)return false;
  }
  return true;
}
//各桁の和
lli Sum(lli n)
{
  lli sum=0;
  if (n<0) return 0;
  while (n>0)
  {
    sum += n%10;
    n /= 10;
  }
  return sum;
}

int main(void)
{
  ios::sync_with_stdio(false);
  lli ans = 700;
  lli flag = 0;
  STR(s);
  SRC(flag, 'o')
  OUT(ans+flag*100)
  return 0;
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline

N = int(input())
AC = 0
WA = 0
TLE = 0
RE = 0
for i in range(N):
    s = input().strip()
    if s == 'AC':
        AC += 1
    elif s == 'WA':
        WA += 1
    elif s == 'TLE':
        TLE += 1
    elif s == 'RE':
        RE += 1

print("AC x",AC)
print("WA x",WA)
print("TLE x",TLE)
print("RE x",RE)


Measured memory_bytes: 73468
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <unordered_map>
#include <memory>

//#define int long long

using namespace std;

void Main()
{
	int n, l;
	cin >> n >> l;

	int sum = 0;
	int tasteMin = 0;

	for (int i = 1; i < n + 1; i++) {
		int taste = l + i - 1;
		if (i == 1) {
			tasteMin = taste;
		}
		else {
			if (abs(taste) < abs(tasteMin)) {
				tasteMin = taste;
			}
		}
		sum += taste;
	}

	cout << sum - tasteMin << endl;
}

int32_t main()
{
	Main();
	return 0;
}



Measured memory_bytes: 256
/*
Author : N_o_o_B
Created : June 13 2020 17:52:44 
*/
#include <bits/stdc++.h>
using namespace std;
/*
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
*/
#define TRACE
#ifdef TRACE
#define trace(...) { cerr<<"[ "; __trace__(#__VA_ARGS__, __VA_ARGS__);}
#undef endl
template <typename Arg1,typename Arg2>
ostream& operator << (ostream& out, const pair<Arg1,Arg2> &x) {
    return out<<"("<<x.first<<","<<x.second<<")";
}
 
template <typename Arg1>
ostream& operator << (ostream& out, const vector<Arg1> &a) {
    out<<"[";for(const auto &x:a)out<<x<<",";return out<<"]";
}
 
template <typename Arg1>
ostream& operator << (ostream& out, const set<Arg1> &a) {
    out<<"[";for(const auto &x:a)out<<x<<",";return out<<"]";
}
 
template <typename Arg1,typename Arg2>
ostream& operator << (ostream& out, const map<Arg1,Arg2> &a) {
    out<<"[";for(const auto &x:a)out<<x<<",";return out<<"]";
}
 
template <typename Arg1>
void __trace__(const string name, Arg1&& arg1){
    cerr << name << " : " << arg1 << " ] " << endl;
}
 
template <typename Arg1, typename... Args>
void __trace__(const string names, Arg1&& arg1, Args&&... args){
    const string name = names.substr(0,names.find(','));
    cerr<<name<<" : "<<arg1<<" | ";
    __trace__(names.substr(1+(int)name.size()), args...);
}
#else
    #define trace(args...)
#endif
 
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<pair<int,int>> vii;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<pair<ll,ll>> vll;
typedef vector<vl> vvl;
//typedef tree<pii, null_type, less<pii>, rb_tree_tag, tree_order_statistics_node_update> oset;
#define fori(i,n) for(int i=0;i<n;i++)
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define repd(i,a,b) for(int i=a;i>=b;i--)
#define ford(i,n)  for(int i=n-1;i>=0;i--)
#define trav(x,a) for(auto& x:a)
#define all(x) x.begin(),x.end()
#define pb push_back
#define endl '\n'
#define sz(a) (int)a.size()
#define fi first
#define se second
clock_t time_p=clock();
void time_taken()
{
    time_p=clock()-time_p;
    cerr<<"Time Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";
}
//const ll mod=998244353;
const ll mod=1e9+7;
const ll INF=1e18;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    cout.precision(12);cout << fixed;

    int n=2e5,k=2e5;
    cin >> n >> k;
    vi a(n);
    fori(i,n){
        cin >> a[i];
    }
    int i=0;
    int mn = *min_element(all(a));
    bool ok = (mn != n);
    while(i<k and ok){
        vi na(n+1);
        fori(i,n){
            na[max(i-a[i],0)]++;
            na[min(i+a[i]+1,n)]--;
        }
        rep(i,1,n-1) na[i] += na[i-1];
        na.pop_back();
        int mn = na[0];
        fori(i,n){
            mn = min(mn,na[i]);
        }
        ok = (mn != n);
        swap(a,na);
        i++;
    }

    for(int x:a) cout << x << " ";
    cout << endl;


    time_taken();
    return 0;
}

Measured memory_bytes: 5060
using System;

namespace TestSpace
{
    class Test
    {
        static void Main(string[] args)
        {
            string[] arrRead;
            arrRead = Console.ReadLine().Split(' ');
            int a, b;
            a = int.Parse(arrRead[0]);
            b = int.Parse(arrRead[1]);

            Console.WriteLine("{0} {1}", a*b,2*(a+b));
        }
    }
}



Measured memory_bytes: 15960
#include<iostream>
#include<cstdio>
#include<fstream>
#include<algorithm>
#include<cmath>
#include<deque>
#include<vector>
#include<queue>
#include<string>
#include<cstring>
#include<map>
#include<stack>
#include<set>
#include<cstdlib>
#include<bitset>
#include<climits>
#include<list>
#include<iomanip>
#include<ctime>
#include<functional>
#include<sstream>
#include<deque>
using namespace std;
long long n,a[2020],b[2020],ans=2000010000000,x,cnt,i,j,k,m;
int main()
{
	memset(a,0x3f,sizeof(a));
    cin>>n>>x;
    for(i=0;i<n;i++)
        cin>>b[i];
    for(i=0;i<n;i++)
    {
        cnt=0;
        for(j=0;j<n;j++)
            a[j]=min(a[j],b[(j-i+n)%n]);
        for(j=0;j<n;j++)
            cnt+=a[j];
        ans=min(ans,i*x+cnt);
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
#define rep(i, n) for(ll i = 0;i < n;i++)
#define all(i) i.begin(), i.end()
template<class T, class U> void cmax(T& a, U b) { if (a<b) a = b; }
template<class T, class U> void cmin(T& a, U b) { if (a>b) a = b; }

class UnionFind {
  private:
    vector<int> parent;
    vector<int> rank;

  public:
    UnionFind(int size) : parent(size), rank(size, 0) {
      for (int i = 0; i < size; i++) {
        parent[i] = i;
      }
    }

    int find(int x) {
      if (parent[x] == x) {
        return x;
      } else {
        return parent[x] = find(parent[x]);
      }
    }

    void unite(int x, int y) {
      x = find(x);
      y = find(y);
      if (x == y) return;

      if (rank[x] < rank[y]) {
        parent[x] = y;
      } else {
        parent[y] = x;
        if (rank[x] == rank[y]) rank[x]++;
      }
    }

    bool same(int x, int y) {
      return find(x) == find(y);
    }
};

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

  ll n, m;
  cin >> n >> m;
  vector<pll> edge(m);
  rep(i, m) {
    cin >> edge[i].first >> edge[i].second;
  }

  vector<ll> ans(m);
  ans[0] = n*(n-1)/2;

  UnionFind uf(n);
  vector<ll> size(n, 1);

  rep(i, m-1) {
    ll l = edge[m-i-1].first-1;
    ll r = edge[m-i-1].second-1;

    ll ls = size[uf.find(l)];
    ll rs = size[uf.find(r)];

    if (!uf.same(l, r)) {
      uf.unite(l, r);
      size[uf.find(l)] = ls + rs; 
      ans[i+1] = ans[i]-ls*rs;
    } else {
      ans[i+1] = ans[i];
    }
  }

  rep(i, m) {
    cout << ans[m-i-1] << endl;
  }
}


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

#define name ""
#define ini freopen(name".inp","r",stdin); freopen(name".out","w",stdout)
#define foe(it,c) for (__typeof(c.begin()) it = c.begin(); it != c.end(); it++)
#define long long long 
#define db double 
#define pii pair <int, int>
#define pll pair <long, long>
#define all(c) c.begin(), c.end()
#define fastio ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)

const int INF = 1e9+7;
const int MOD = 1e9+7;
const int dx[4] = {0,0,-1,1};
const int dy[4] = {-1,1,0,0};

int k;
vector <long> memo;

int main()
{
  fastio;
  cin >> k;
  for (int i = 1; i < 10; i++) memo.push_back(i);
  int ptr = 0;
  while (memo.size() < k){
    long x = memo[ptr];
    int y = x % 10;
    if (y - 1 >= 0) memo.push_back(x * 10 + y - 1);
    memo.push_back(x * 10 + y);
    if (y + 1 <= 9) memo.push_back(x * 10 + y + 1);
    ptr++;
  }
  cout << memo[k - 1];
  return 0;
}

Measured memory_bytes: 1400
import sys
def input(): return sys.stdin.readline().strip()


def main():
    N = int(input())
    A = list(map(int, input().split()))
    cnt = 0
    for a in A:
        while a % 2 == 0:
            cnt += 1
            a //= 2
    print(cnt)

if __name__ == "__main__":
    main()


Measured memory_bytes: 68608
#include <bits/stdc++.h>
#define ll long long 
#define ull unsigned long long 
#define f(i,x,n) for(ll int i=x;i<n;i++) 
#define re(j,x,n) for(ll int j=x;j>=n;j--)
#define f1(k,x,n) for(ll int k=x;k<=n;k++)
#define mp make_pair
#define pb push_back
#define mod 1000000007
#define MAX 1000001
using namespace std;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll int n;
    cin>>n;
    ll int l[n];
    f(i,0,n)
     cin>>l[i];
    ll int ans=0;
    sort(l,l+n);
    f(i,0,n)
    {
      f(j,i+1,n)
      {
      	f(k,j+1,n)
      	{
      	  if(l[i]<l[j]+l[k]&&l[j]<l[i]+l[k]&&l[k]<l[j]+l[i])
      	  	ans++;
      	  else 
      	  	break;
      	}
      }
    }
    cout<<ans;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std;

int main() {
  
  int a,b,c,d,x;
  long long la,lb;
  double da,db;
  string s,ss,sss;
  
  int ans = 0;
  string anss = "";
  
  cin >> s;
  
  int ab [] = {0 , 1 , 3 , 1 , 2 , 1 , 2 , 1 , 1 , 2 , 1 , 2 , 1};
  int result3 = std::max({a, b, c});
//--------------------------------------------------------------------------------

  if(s == "Sunny") anss = "Cloudy";
  if(s == "Cloudy") anss = "Rainy";
  if(s == "Rainy") anss = "Sunny";
//  else anss = "red";

  cout << anss << endl;

}

Measured memory_bytes: 256