akhauriyash/Code-Regression huggingface dataset:
/// However long the night,
///     The dawn will break
/// ICPC next year

#include<bits/stdc++.h>
using namespace std ;
const int N = 1e5+5 ;

int n ,arr[N] ;
long long sum ,cur ,best=1e18 ;
int main(){
    cin >> n ;
    for(int i=0;i<n;++i){
        scanf("%d",arr+i);
        sum += arr[i] ;
    }
    for(int i=0;i+1<n;++i){
        cur += arr[i] ;
        sum -= arr[i] ;
        best = min(best,abs(sum-cur));
    }
    cout << best;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <unordered_set>
using namespace std;
int main()
{
        int grid[3][3],n,aux,bingo=0;
        for (int i = 0; i < 3; i++)
                for (int j = 0; j < 3; j++)
                        cin >> grid[i][j];
        cin >> n;
        unordered_set<int> number;
        while (n--) {
                cin >> aux;
                number.insert(aux);
        }
        if (number.count(grid[0][0]) && number.count(grid[0][1]) && number.count(grid[0][2]))
                bingo = 1;
        if (number.count(grid[1][0]) && number.count(grid[1][1]) && number.count(grid[1][2]))
                bingo = 1;
        if (number.count(grid[2][0]) && number.count(grid[2][1]) && number.count(grid[2][2]))
                bingo = 1;
        if (number.count(grid[0][0]) && number.count(grid[1][0]) && number.count(grid[2][0]))
                bingo = 1;
        if (number.count(grid[0][1]) && number.count(grid[1][1]) && number.count(grid[2][1]))
                bingo = 1;
        if (number.count(grid[0][2]) && number.count(grid[1][2]) && number.count(grid[2][2]))
                bingo = 1;
        if (number.count(grid[0][0]) && number.count(grid[1][1]) && number.count(grid[2][2]))
                bingo = 1;
        if (number.count(grid[0][2]) && number.count(grid[1][1]) && number.count(grid[0][1]))
                bingo = 1;
        if (bingo)
                cout << "Yes" << endl;
        else
                cout << "No" << endl;
        return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL),cout.tie(NULL);
    int n; cin>>n;
    bool flag=false;
    while(n!=0){
        if(n%10==7)
          { flag=true; break; }
        n=n/10;  
    }
    if(flag)
      cout<<"Yes"<<endl;
    else 
      cout<<"No"<<endl; 
}

Measured memory_bytes: 3584
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
int main()
{
    long long n,k,i,r,s,p,total=0;
    string str;
    cin>>n>>k;
    cin>>r>>s>>p;
    cin>>str;
    for(i=0;i<k;i++)
    {
        if(str[i]=='r')
        {
            total+=p;
        }
        else if(str[i]=='s')
        {
            total+=r;
        }
        else if(str[i]=='p')
        {
            total+=s;
        }
    }
    for(i=k;i<str.size();i++)
    {
        if(str[i]==str[i-k])
        {
            str[i]='x';
            total+=0;
        }
        else
        {
            if(str[i]=='r')
            {
                total+=p;
            }
            else if(str[i]=='s')
            {
                total+=r;
            }
            else if(str[i]=='p')
            {
                total+=s;
            }
        }
    }
    cout<<total<<endl;
    return 0;
}

Measured memory_bytes: 3724
# h*wのマスにかかれているそれぞれの数字の位置は関係ないしどうでもいい
# それぞれの数がどれだけあるかに興味がある
# iから1に至る最小値を全探索 間に合うのか？ まあいけるやろ
h, w = map(int, input().split())
table = []
for _ in range(10):
    table.append(list(map(int, input().split())))

wall = {}
for _ in range(h):
    x = list(map(int, input().split()))
    for v in x:
        if v not in wall:
            wall[v] = 1
        else:
            wall[v] += 1


def rec(idx, cost, used):
    if idx == 1:
        return cost
    ret = 10 ** 10
    for i in range(10):
        if i in used:
            continue
        next_used = used[:]
        next_used.append(i)
        ret = min(ret, rec(i, cost + table[idx][i], next_used))
    return ret


arr = [0 for _ in range(10)]
for i in range(10):
    if i == 1:
        continue
    arr[i] = rec(i, 0, [i])

ans = 0
for k, v in wall.items():
    if k != -1 and k != 1:
        ans += arr[k] * v
print(ans)


Measured memory_bytes: 50652
#include <iostream>

using namespace std;

void change(int deck[], int s, int e) {
	int t[50];
	for (int i = 0; i < e; i++) {
		t[i] = deck[i];
	}
	for (int i = 0; i < s; i++) {
		deck[i - s + e] = t[i];
	}
	for (int i = 0; i < e - s; i++) {
		deck[i] = t[i + s];
	}
}

int main()
{
	int deck[50];
	int n, r, s, e;
	while (true) {
		cin >> n >> r;
		if (n == 0 && r == 0) break;
//		cout << n << r << endl;
		for (int i = 0; i < 50; i++) deck[i] = n - i - 1;
		for (int i = 0; i < r; i++) {
			cin >> s >> e;
			change(deck, s - 1, e + s - 1);
		}
		cout << deck[0] + 1 << endl;
	}
	return 0;
}


Measured memory_bytes: 2996
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
const int INF = 1e9;

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

    vector<int> dp(n + 1, INF);
    dp[0] = 0;
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= i; j *= 6) {
            dp[i] = min(dp[i], dp[i - j] + 1);
        }
        for (int j = 1; j <= i; j *= 9) {
            dp[i] = min(dp[i], dp[i - j] + 1);
        }
    }
    
    cout << dp[n] << endl;

    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#include <cmath>
using namespace std;
 
#define coutv(v) for (int i = 0; i < (v).size(); ++i) cout << v[i] << ' '; cout << endl;
#define coutvv(v) for (int i = 0; i < (v).size(); ++i) {for (int j = 0; j < (v[i]).size(); ++j) cout << v[i][j] << ' '; cout << endl;}
#define debugv(v) {for (int i = 0; i < (v).size(); ++i) cerr << v[i] << ' '; cerr << endl;}
#define debugvv(v) {for (int i = 0; i < (v).size(); ++i) {for (int j = 0; j < (v[i]).size(); ++j) cerr << v[i][j] << ' '; cerr << endl;}}
#define TC int TESTCASE; cin >> TESTCASE; while (TESTCASE--)
typedef long long ll;
 



int main() {
	string a,b;
	cin >> a >> b;
	cout << b << a;
}
 


Measured memory_bytes: 3600
#include<bits/stdc++.h>
#define all(v) v.begin(),v.end()
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
const ll MOD=1000000007;
const ll INF=1000000000;
const ll LINF=4000000000000000010;
int main(){
    int n;cin>>n;
    vector<P> v;
    ll a[500010],b[500010];
    for(int i=0;i<n;i++){
        cin>>a[i]>>b[i];
        v.push_back(P(a[i],b[i]));
    } 
    sort(all(v));
    ll sum=0,ma=0,ans=0;
    for(int i=0;i<n;i++){
        ma=max(ma,v[i].first-sum);
        ans=max(ans,sum+v[i].second+ma-v[i].first);
        sum+=v[i].second;
    }
    cout<<ans<<endl;
}	



Measured memory_bytes: 18692
#include <bits/stdc++.h>
#define rep(i, n) for(ll i = 0; i < n; ++i)
#define repR(i, n) for(ll i = n; i >= 0; ++i)
#define FDS(i, n) for(ll i = 0; i < n; ++i)
#define FDSR(i, n) for(ll i = n; i >= 0; ++i)
#define FOR(i, m, n) for(ll i = m; i < n; ++i)
#define FORR(i, m, n) for(ll i = m;i >= n;--i)
#define VSORT(v) sort(v.begin(), v.end());
#define VREV(v) reverse(v.begin(), v.end());
#define INF 999999999
#define itn ll
#define ednl endl
using namespace std;
typedef long long ll;template<typename Typell>Typell G_C_D(Typell a, Typell b){if (a < 0) a = -a;if (b < 0) b = -b;while (b != 0) {a %= b;if (a == 0) return b;b %= a;}return a;}template<typename Typell>
Typell G_C_D(const std::vector<Typell> &list){Typell a = list[0];for (size_t i = 1; i < list.size(); ++i) {a = G_C_D(a, list[i]);}return a;}template<typename Typell>Typell L_C_M(Typell a, Typell b) {if( a == 0 && b == 0)return 0;return a / G_C_D(a, b) * b;}
template<typename Typell>Typell L_C_M(const std::vector<Typell> &list){Typell a = list[0];for (size_t i = 1; i < list.size(); ++i) {a = L_C_M(a, list[i]);}return a;}

int main(){
	cin.tie(0);ios::sync_with_stdio(false);
	int N,K;
	cin>>N>>K;
	vector<int> l(N);
	FDS(i,N){
		cin>>l[i];
	}
	VSORT(l);
	VREV(l);
	int ans=0;
	FDS(i,K){
		ans+=l[i];
	}
	
	cout<<ans<<endl;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 2087;
ll dp[N][N];
pair<int, int> a[N];
int main()
{
    ll n;
    cin >> n;
    for (int i = 0; i < n; ++i) {
        cin >> a[i].first;
        a[i].second = i + 1;
    }
    sort(a, a + n);
    for (int w = 1; w <= n; ++w) {
        int x, v;
        tie(v, x) = a[w - 1];
        for (ll l = 1, r = l + w - 1; r <= n; ++l, ++r) 
            dp[l][r] = max(dp[l + 1][r] + v * abs(l - x), dp[l][r - 1] + v * abs(r - x));
    }
    cout << dp[1][n] << endl;
}


Measured memory_bytes: 26508
#include<stdio.h>
int main(void)
{
 int a,b; 

 scanf("%d %d",&a,&b);

 if(a>b)
  printf("a > b\n");
 else if(a<b)
  printf("a < b\n");
 else
  printf("a == b\n");

 return(0);
}

Measured memory_bytes: 580
k, a, b = map(int, input().split())
if a >= b - 1 or 1 + k <= a:
    print(1 + k)
else:
    now = a
    k -= a - 1
    if k % 2 == 1:
        now += 1
        k -= 1
    now += (k // 2) * (b - a)
    print(now)



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

ll N;
vector<ll> t, x, y;

int main() {
    cin >> N;
    t.resize(N+1), x.resize(N+1), y.resize(N+1);
    t[0] = x[0] = y[0] = 0;
    for (int i = 1; i <= N; i++) scanf("%Ld%Ld%Ld", &t[i], &x[i], &y[i]);
    int flag = 1;
    for (int i = 0; i < N && flag; i++) {
        int dt = t[i+1] - t[i];
        int dx = abs(x[i+1]-x[i]);
        int dy = abs(y[i+1]-y[i]);
        if (dt < dx + dy) flag = 0;
        else if (dt%2 != (dx+dy)%2) flag = 0;
    }
    cout << (flag ? "Yes" : "No") << endl;
}

Measured memory_bytes: 2560
#include<iostream>
#include<algorithm>
#include<vector>
#include <iomanip>

using namespace std;

int main(){

	int n;
  	cin >> n;
  	vector<int> a;
  	int input;
  
  	while(cin >> input){
    	a.push_back(input);
    }
  
  	int64_t sum =0;
  	int maximum = -1000000;
  	int minimum = 1000000;
  	for(int i =0; i< n; i++){
    	sum += a.at(i);
      	if(maximum < a.at(i)) maximum = a.at(i);
        if(minimum > a.at(i)) minimum = a.at(i);
    }
  
  	cout << minimum << " " << maximum << " " << sum << endl;

    return 0;
}


Measured memory_bytes: 3248
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric, std.container;

alias E = Tuple!(int, "from", int, "to", long, "c");

void main()
{
    auto nmp = readln.split.to!(int[]);
    auto N = nmp[0];
    auto M = nmp[1];
    long P = nmp[2];
    E[] es;
    foreach (_; 0..M) {
        auto abc = readln.split.to!(int[]);
        auto A = abc[0]-1;
        auto B = abc[1]-1;
        long C = abc[2];
        es ~= E(A, B, C - P);
    }

    auto DP = new long[](N);
    DP[] = long.min/3;
    DP[0] = 0;

    foreach (_; 0..N) {
        foreach (e; es) {
            if (DP[e.to] < DP[e.from] + e.c) {
                DP[e.to] = DP[e.from] + e.c;
            }
        }
    }

    auto x = DP[N-1];
    foreach (_; 0..N) {
        foreach (e; es) {
            if (DP[e.from] > long.min/4 && DP[e.to] < DP[e.from] + e.c) {
                DP[e.to] = long.max/3;
            }
        }
    }
    writeln(DP[N-1] > x ? -1 : max(0, x));
}

Measured memory_bytes: 3948
// ABC 073 B- Theater
// repの練習

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

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

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


Measured memory_bytes: 3580
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(10**7)
import bisect
import heapq
import itertools
import math
from collections import Counter, defaultdict, deque
from copy import deepcopy
from decimal import Decimal
from math import gcd
from operator import add, itemgetter, mul, xor
def cmb(n,r,mod):
  bunshi=1
  bunbo=1
  for i in range(r):
    bunbo = bunbo*(i+1)%mod
    bunshi = bunshi*(n-i)%mod
  return (bunshi*pow(bunbo,mod-2,mod))%mod
mod = 10**9+7
def I(): return int(input())
def LI(): return list(map(int,input().split()))
def MI(): return map(int,input().split())
def LLI(n): return [list(map(int, input().split())) for _ in range(n)]

#bisect.bisect_left(list,key)はlistのなかでkey未満の数字がいくつあるかを返す
#つまりlist[i] < x となる i の個数
#bisect.bisect_right(list, key)はlistのなかでkey以下の数字がいくつあるかを返す
#つまりlist[i] <= x となる i の個数
#これを応用することで
#len(list) - bisect.bisect_left(list,key)はlistのなかでkey以上の数字がいくつあるかを返す
#len(list) - bisect.bisect_right(list,key)はlistのなかでkeyより大きい数字がいくつあるかを返す
#これらを使うときはあらかじめlistをソートしておくこと！
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr
n = I()
c = factorization(n)
ans = 0
if n == 1:
  print(0)
else:
  for i in range(len(c)):
    k = c[i][1]
    for j in range(100):
        if j*(j+1)//2 > k:
            ans += j-1
            break
  print(ans)

Measured memory_bytes: 10256
#include <vector>
#include <iostream>
#include <utility>
#include <algorithm>
#include <string>
#include <deque>
#include <queue>
#include <tuple>
#include <queue>
#include <functional>
#include <cmath>
#include <iomanip>
#include <map>
#include <set>
#include <numeric>
#include <unordered_map>
#include <unordered_set>
#include <complex>
#include <iterator>
#include <array>
#include <memory>
#include <stack>
#define vi vector<int>
#define vvi vector<vector<int> >
#define ll long long int
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>
#define ld long double
#define INF 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define all(in) in.begin(), in.end()
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
#define MAX 9999999
using namespace std;
typedef pair<int, int> pii;
typedef pair<double,double>pdd;
typedef pair<ll,ll>pll;
int main(){
    int n;
    vi v(9,0);
    cin>>n;
    int sp=0;
    rep(i,n){
        int temp;cin>>temp;
        if(1<=temp&&temp<=399)v[0]++;
        else if(400<=temp&&temp<=799)v[1]++;
        else if(800<=temp&&temp<=1199)v[2]++;
        else if(1200<=temp&&temp<=1599)v[3]++;
        else if(1600<=temp&&temp<=1999)v[4]++;
        else if(2000<=temp&&temp<=2399)v[5]++;
        else if(2400<=temp&&temp<=2799)v[6]++;
        else if(2800<=temp&&temp<=3199)v[7]++;
        else sp++;
    }
    int cnt=0;
    rep(i,9)if(v[i]!=0)cnt++;
    cout<<max(1,cnt)<<" "<<cnt+sp<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main()
{
 
    int x;
    cin>>x;
 
    int wk1,wk2;
    wk1=x/100;
    wk2=x%100;
 
    bool flag = false;
    for(int i=0;i<=wk1;i++){
        for(int j=0;j+i<=wk1;j++){
            for(int k=0;i+j+k<=wk1;k++){
                for(int l=0;i+j+k+l<=wk1;l++){
                        int m=(wk2-i*1-j*2-k*3-l*4)/5;
                        if(i*1+j*2+k*3+l*4+m*5==wk2 && i+j+k+l+m<=wk1 ){
                            flag=true;
                            break;
                        }
                }
            }
        }
    }
 
    if(flag)
        cout<<1<<endl;
    else
        cout<<0<<endl;
    
 
    return 0;
}  

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

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

int main(){
int n;
cin>>n;
int a[n];
int average=0;
rep(i,n){
  cin>>a[i];
}
int ans=100000007;

for(int i=-1000;i<1000;i++){
int count=0;
rep(p,n){
  count+=abs(i-a[p])*abs(i-a[p]);
}
ans=min(ans,count);
}

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


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <set>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <limits>

typedef long long int lli;
#define rep(i,s,N) for(int i=s;i<N;i++)
using namespace std;


int main(void)
{
	set<char> alphabets;
	string s; cin >> s;
	rep(i, 0, s.length())alphabets.insert(s[i]);

	if (alphabets.size() >= 26)cout << "None" << endl;
	else {
		int c = 0;
		while (alphabets.find('a' + c) != alphabets.end())c++;
		//char ans = 'a' + c;
		cout << (char)('a' + c) << endl;
	}

	return 0;
}

Measured memory_bytes: 512
#include<cstdio>
#include<algorithm>
#include<vector>
#include<queue>
using namespace std;
typedef long long ll;

ll n, w, d[201], dp[201][10001], mod = 1000000007, sum[202];

int main() {
  scanf("%lld%lld", &n, &w);
  for (ll i = 0; i < n; i++) scanf("%lld", &d[i]);
  sort(d, d+n, greater<ll>());
  for (ll i = n; i > 0; i--) sum[i] = sum[i+1] + d[i-1];
  dp[0][0] = 1;
  ll ans = 0;
  for (ll i = 1; i <= n; i++) {
    dp[i][0] = 1;
    for (ll j = 0; j <= w; j++) {
      if (j >= d[i-1]) dp[i][j] = dp[i-1][j-d[i-1]] + dp[i-1][j];
      if (j + sum[i+2] + d[i] > w && j + sum[i+2] <= w) ans = (ans + dp[i][j]) % mod;
    }
  }
  if (ans == 0) ans = 1;
  printf("%lld\n", ans);
}



Measured memory_bytes: 16016
#include <cstdio>
#include <cstring>
#include <cmath>
#include <utility>
#include <iostream>
#include <functional>
#include <bitset>
#include <algorithm>
#include <vector>
#include <forward_list>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <numeric>
#include <iomanip>  //setprecision(桁)
using namespace std;
#define pb push_back
#define rep(i,n) for(int i = 0;i < n;i++)
#define INF 1e+9

struct edge {
    int to;
    double cost;
};

// <最短距離, 頂点の番号>
using P = pair<double, int>;

int V;
const int ci = 2e5+ 5;
vector<edge> G[ci];
double d[ci];

void dijkstra(int s) {
    priority_queue<P, vector<P>, greater<P> > que;
    fill(d, d+V, INF);
    d[s] = 0;
    que.push(P(0, s));

    while (!que.empty()) { //cout << "On" << endl;
        P p = que.top();
        que.pop();
        int v = p.second; //cout << "v=" << v << endl;
        if (d[v] < p.first) continue;
        for (int i=0; i<G[v].size(); i++) {
            edge e = G[v][i]; //cout << "koo" << endl;
            if (d[e.to] > d[v] + e.cost) { //cout << e.cost << endl;
                d[e.to] = d[v] + e.cost;
                que.push(P(d[e.to], e.to));
            }
        }
    }
}

int main(){
  int a,b; cin >> a >> b;
  cout << a * b << endl;
}

Measured memory_bytes: 8320
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
#define all(x) (x).begin(),(x).end()
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

void yes(){
    cout << "Yes" << endl;
    exit(0);
}

void no(){
    cout << "No" << endl;
    exit(0);
}

int main() {
    string s;
    cin >> s;
    bool N, W, S, E;
    N = W = S = E = false;

    for (int i=0; i<s.size(); i++){
        if (s[i] == 'N')N = true;
        if (s[i] == 'W')W = true;
        if (s[i] == 'S')S = true;
        if (s[i] == 'E')E = true;
    }

    if (N){
        if(!S)no();
    }
    if (W){
        if (!E)no();
    }
    if (S){
        if(!N)no();
    }

    if (E){
        if(!W)no();
    }
    
    yes();  
}

Measured memory_bytes: 256
(function(input) {
  var inputs = input.replace(/\n$/, '').split('\n');
  while (true) {
    p = inputs.shift();
    if (!p) {
      return;
    }
    n = 0;
    while (true) {
      var str = convert(p, ++n);
      if (check(str, n)) {
        console.log(str);
        break;
      }
    }
  }
})(require('fs').readFileSync('/dev/stdin', 'utf8'));

function convert(p, n) {
  var alphabets = 'abcdefghijklmnopqrstuvwxyz'.split('');
  return p.split('').map(function(e) {
    var index = alphabets.indexOf(e);
    if (index < 0) {
      return e;
    }
    index += n;
    if (index >= alphabets.length) {
      index -= alphabets.length;
    }
    return alphabets[index];
  }).join('');
}

function check(p) {
  return p.split(' ').some(function(e) {
    return ['the', 'this', 'that'].indexOf(e) >= 0;
  });
}

Measured memory_bytes: 9528
num = input()
goukei = 0
for i in range(1,6,2):
    if i < len(num):
        goukei += 9*(10**(i-1))
    elif i == len(num):
        goukei += int(num) - (10**(i-1)) +1
        break
    else:
        break
print(goukei)

Measured memory_bytes: 3060
#include<stdio.h>
#include<math.h>

#define PI 3.14159265

typedef struct{
  double x;
  double y;
}XY;

//prototype
void cohho(int,XY,XY);

int main(){
  int n;
  XY p1={0.0,0.0}, p2={100.0,0.0};
    
  //input
  scanf("%d",&n);

  //output
  printf("%f %f\n",p1.x,p1.y);
  cohho(n,p1,p2);
  printf("%f %f\n",p2.x,p2.y);
  
  return 0;
}

void cohho(int n,XY p1, XY p2){
  XY s, t, u;
  
  if(n==0) return;

  //s
  s.x=(2.0*p1.x+p2.x)/3;
  s.y=(2.0*p1.y+p2.y)/3;
    
  //t
  t.x=(p1.x+2.0*p2.x)/3;
  t.y=(p1.y+2.0*p2.y)/3;
  
  //u
  u.x=(t.x-s.x)*cos(60.0*PI/180)-(t.y-s.y)*sin(60.0*PI/180)+s.x;
  u.y=(t.x-s.x)*sin(60.0*PI/180)+(t.y-s.y)*cos(60.0*PI/180)+s.y;
    
  cohho(n-1,p1,s);
  printf("%f %f\n",s.x,s.y);
  cohho(n-1,s,u);
  printf("%f %f\n",u.x,u.y);
  cohho(n-1,u,t);
  printf("%f %f\n",t.x,t.y);
  cohho(n-1,t,p2);
  
}



Measured memory_bytes: 2036
use std::io;

fn gets() -> String {
    let mut buf = String::new();
    io::stdin().read_line(&mut buf).ok();
    buf
}

fn main() {
    let line = gets();
    let s = line.trim();
    let vowels = vec!["a", "i", "u", "e", "o"];
    let mut flag = false;
    for x in vowels {
        if s == x {
            flag = true;
        }
    }
    if flag {
        println!("vowel");
    } else {
        println!("consonant");
    }
}


Measured memory_bytes: 4352
N, Y =map(int, input().split())
x=0
y=0
z=0
m=0
for s in range(N+1):
    for t in range(N+1-s):
        if 10000*s+5000*t+1000*(N-s-t)==Y:
            x = s
            y = t
            z = N-s-t
            m +=1
            break
if m==0:
    print('-1 -1 -1')
else:
    print(str(x)+' '+str(y)+' '+str(z))

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

int main(){
    int k,x;
    cin>>k>>x;
    for(int i=k-1;i>0;i--){
        cout<<x-i<<" ";
    }
    cout<<x<<' ';
    for(int i=1;i<k;i++){
        cout<<x+i<<' ';
    }
    cout<<endl;
    return 0;
}   

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

#define int long long
typedef vector<int> vint;
typedef pair<int, int> pint;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
template<typename T, typename U> inline bool chmax(T &a, const U &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template<typename T, typename U> inline bool chmin(T &a, const U &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}
struct Init {
    Init() {
        cout << fixed << setprecision(20);
    };
} init;

int N, K;
bool G[110][110];
signed main() {
    cin >> N >> K;
    if (K > (N - 1) * (N - 2) / 2) {
        cout << -1 << endl;
        return 0;
    }
    cout << N * (N - 1) / 2 - K << endl;
    for (int i = 1; K > 0; i++) {
        for (int j = i + 1; j < N && K > 0; j++, K--) {
            G[i][j] = true;
        }
    }
    for (int i = 1; i <= N; i++) {
        for (int j = i + 1; j <= N; j++) {
            if (!G[i][j]) { cout << i << " " << j << endl; }
        }
    }
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
        int count = 0;
        Scanner scan = new Scanner(System.in);
        int a = scan.nextInt();
        int b = scan.nextInt();
        int c = scan.nextInt();


        if(a*b*c==5*5*7){
            System.out.println("YES");
        }
        else{
            System.out.println("NO");

        }

    }
}



Measured memory_bytes: 21844
#include <iostream>
#include <map>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <sstream>
#include <cmath>
#include <math.h>
#include <string>
using namespace std;
typedef long long ll;
#define rep(n) for( int i = 0 ; i < n ; i++ )
#define REP(n) for( int i = 1 ; i <= n ; i++ )
#define repll(n) for( ll i = 0 ; i < n ; i++ )
#define REPll(n) for( ll i = 1 ; i <= n ; i++ )

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll n , k;
  	cin >> n >> k;
  	ll ans = ( n / k ) * ( n / k ) * ( n / k );
	if ( k % 2 == 1 ) {
		cout << ans;
		return 0;
	}
	ll c = 0;
    c = ( n + ( k / 2 ) ) / k;
	cout << ans + c * c * c;
}


Measured memory_bytes: 3616
a = []
3.times {a << gets.split.map(&:to_i)}

n = gets.to_i
b = []
n.times {b << gets.to_i}

a.map!{|e| e.map!{|elt| b.include?(elt)}}

3.times do |i|
    if a[i].all?{|e| e}
        puts "Yes"
        exit
    end
end

3.times do |i|
    x = true
    3.times {|j| x &= a[j][i]}
    if x
        puts "Yes"
        exit
    end
end

if (a[0][0] && a[1][1] && a[2][2]) || (a[0][2] && a[1][1] && a[2][0])
    puts "Yes"
    exit
end

puts "No"

Measured memory_bytes: 1788
date = [
    "{0} {1}".format(s,r)
    for s in ('S', 'H', 'C', 'D')
    for r in range(1,13+1)
    ]

count= int(input())
for c in range(count):
    card = input()
    date.remove(card)

for c in date:
    print(c)

Measured memory_bytes: 7652
#include <iostream>
#include <vector>
#include <string>
using namespace std;
int dx[]={1,0,-1,0},dy[]={0,-1,0,1};
vector<string>s(12);
void dfs(int x,int y){
	s[x][y]='0';
	for(int i=0;i<4;i++){
		int sx=x+dx[i];
		int sy=y+dy[i];
		if(0<=sx&&sx<12&&0<=sy&&sy<12&&s[sx][sy]=='1'){
			dfs(sx,sy);
		}
	}
	return ;
}

int main(){
	while(1){
		int cnt=0;
		for(int i=0;i<12;i++){
			if(!(cin >> s[i])) return 0;
		}
		for(int i=0;i<12;i++){
			for(int j=0;j<12;j++){
				if(s[i][j]=='1'){
					dfs(i,j);
					cnt++;
				}
			}
		}
		cout<<cnt<<endl;
	}
}

Measured memory_bytes: 3048
#include<stdio.h>
	int main()
{
	int H, W, i, j;
	scanf("%d %d", &H, &W);
	while(H != 0 && W != 0){
		for(i = 0; i < H; i++){
			for(j = 0 ; j < W; j++){
				if(i == 0 || i == H-1){
					printf("#");
				}else if(j == 0 || j == W-1){
					printf("#");
				}else{
					printf(".");
				}
			}
			printf("\n");
		}
		printf("\n");
		scanf("%d %d", &H, &W);
	}
	return 0;
}

Measured memory_bytes: 572
K = int(input())

hoge = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

print(hoge[K-1])

Measured memory_bytes: 3060
#include <iostream>
using namespace std;
int res = 0;

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

cin >> A;
cin >> B;
cin >> C;
cin >> X;

for(int a = 0; a <= A; a++)
{
for(int b = 0; b <= B; b++)
{
for(int c = 0; c <= C; c++)
{
int total = 500*a + 100*b + 50*c;
if (total == X) ++res;
}
}

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

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

#define REP(i,n) for(int i = 0; i < n; i++)
#define FOR(i,l,r) for(int i = l; i <= r; i++)
#define TR(e,x) for(auto e = x.begin(); e != x.end(); e++)
#define DEBUG(x) cout << #x << "=" << x << endl;
#define SHOW1(A,n) { REP(i,n-1) printf("%d ", A[i]); printf("%d\n", A[n-1]); }
#define SHOW2(A,m,n) { REP(i,m) { REP(j,n-1) printf("%d ", A[i][j]); printf("%d\n", A[i][n-1]); } }
#define PB push_back
#define ALL(x) x.begin(),x.end()
#define SZ(x) (int)((x).size())
typedef long long LL;
const int MAXN  = 8e5, INF = ~0U>>1, MOD = ~0U>>1;



int main()
{
#ifdef LOCAL
    //freopen("i.txt", "r", stdin);
    //freopen("o.txt", "w", stdout);
#endif //LOCAL

    int a, b;
    scanf("%d%d", &a,&b);
    int ans = a+b;
    ans = max(ans, a-b);
    ans = max(ans, a*b);
    printf("%d\n", ans);

    return 0;
}


















































































Measured memory_bytes: 256
/* Author - thiolhub */

#include <bits/stdc++.h>

using namespace std;

#define ll              long long int
#define ld              long double
#define db              double
#define pi              3.1415926535897932384626
#define PI              acos(-1.0)
#define endl            "\n"
#define mod             1000000007
#define mk              make_pair
#define pb              push_back
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define ps(x,y)         fixed<<setprecision(y)<<x
#define w(t)            ll t; cin>>t; while(t--)
#define sc(a)	        scanf("%lld",&a);
#define pr(a)	        printf("%lld\n",a)
#define f(i,a,n)		for(ll i=a;i<n;i++)
#define m(a)		    memset(a,0,sizeof(a))
#define FastIO          ios_base::sync_with_stdio(0);cin.tie(0),cout.tie(0)



int main(){ FastIO;

int n;cin>>n;
if(n%2==0) cout<<n;
else cout<<n*2;



return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cmath>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>

#ifdef _DEBUG
#define DMP(x) cerr << #x << ": " << x << "\n"
#else
#define DMP(x) ((void)0)
#endif

const int MOD = 1000000007, INF = 1111111111; 
using namespace std;
typedef long long lint;

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	lint N;
	cin >> N;

	string ans;

	if (N >= 0) {

		int st = 1;
		for (int i = 0; i <= 32; i++) {
			if (i % 2) st += (1LL << (i - 1));
			ans += int((N - st + (1LL << (i + 1))) % (1LL << (i + 1)) < (1LL << i)) + '0';
		}
		reverse(ans.begin(), ans.end());
	}
	else {

		int st = 1;
		for (int i = 0; i <= 32; i++) {
			if (i % 2) st += (1LL << (i - 1));
			ans += int((-(N-1)/2 - st + (1LL << (i + 1))) % (1LL << (i + 1)) < (1LL << i)) + '0';
		}
		reverse(ans.begin(), ans.end());
		ans += -N % 2 + '0';
	}

	for (int i = 0; i <= 32; i++) {
		if (ans[i] == '1') {
			cout << ans.substr(i) << "\n";
			break;
		}
		if (i == 32) cout << 0 << "\n";
	}

	return 0;
}

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

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	int n, k;
	cin >> n >> k;
	int l[n];
	for (int i = 0; i < n; i++) {
		cin >> l[i];
	}
	sort(l, l + n);
	reverse(l, l + n);
	int sum = 0;
	for (int i = 0; i < k; i++) {
		sum += l[i];
	}
	cout << sum << '\n';
	
	return 0;
}


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

int main()
{
	ll A,B,K;
	cin>>A>>B>>K;
	if(A>=K){
		A-=K;
		K=0;
	}else{
		K-=A;
		A=0;
	}

	if(B>=K){
		B-=K;
		K=0;
	}else{
		K-=B;
		B=0;
	}
	cout<<A<<" "<<B<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <regex>
#define REP(i,n) for(int i = 0; i < n; i++)
#define FOR(i,j,n) for(int i = j; i < n; i++)
#define RFOR(i,j,n) for(int i = j-1; i >= n; i--)
#define PREC(n) fixed << setprecision(n)
#define print_array(v) REP(__k, v.size()) { cout << v[__k]; if(__k != v.size()-1) cout << " "; else cout << endl; }
#define YesorNo(a) printf(a?"Yes\n":"No\n")
#define _LIBCPP_DEBUG 0
using namespace std;
int64_t MOD = 1000000007;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n, m, x, c0 = 0, cn = 0;
  vector<int> a(m);
  cin >> n >> m >> x;
  REP(i,m) cin >> a[i];
  for(int i = x; i > 0; i--) {
    REP(k,m) if(i == a[k]) c0++;
  }
  for(int j = x; j < n; j++) {
    REP(k,m) if(j == a[k]) cn++;
  }
  cout << min(c0,cn) << endl;
  return 0;
}
//templete by private_yusuke

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

int main() {
    string s;
    cin >> s;
    vector<bool> v(26, false);

    for (int i = 0; i < s.size(); i++) {
        v[s[i] - 'a'] = true;
    }
    for (int i = 0; i < v.size(); i++) {
        if (!v[i]) {
            cout << (char)(i + 'a') << endl;
            return 0;
        }
    }
    cout << "None" << endl;
    return 0;
}


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

int main(void)
{

	char c_str[100000];
	char r_str[200000];
	char l_str[200000];
	char ans[500000];
	
	unsigned long dir = 0;
	unsigned long num;
	unsigned long num_q2;
	unsigned long r_c = 0;
	unsigned long l_c = 0;

	char z;
	int i=0,j,k,l,x,y;	
	
	unsigned long c_len,r_len,l_len;
	
	scanf("%s",c_str);
	c_len = strlen(c_str);
	
	scanf("%lu",&num);

	num_q2 = num;
	
	while(i < num_q2){
		i++;
		scanf("%d",&x);
		num_q2 = num;

		if(x == 1){
			++dir;
		}else{
			scanf("%d %c",&y,&z);
			num_q2 = num;
			if(dir%2 == 0){
				if(y == 1){
					l_str[l_c]=z;
					l_c++;
				}else{
					r_str[r_c]=z;
					r_c++;
				}
			}else{
				if(y == 1){
					r_str[r_c]=z;
					r_c++;
				}else{
					l_str[l_c]=z;
					l_c++;
				}
			}
		}
	}
	
	c_len = strlen(c_str);
	r_len = strlen(r_str);
	l_len = strlen(l_str);
	
	if(dir%2 == 0){
		for(j=0;j<l_len;j++)
			ans[j]=l_str[l_len-1-j];
		for(k=0;k<c_len;k++)
			ans[k+l_len] = c_str[k];
		for(l=0;l<r_len;l++)
			ans[l+l_len+c_len] = r_str[l];
		printf("%s",ans);
	}else{
		for(j=0;j<r_len;j++)
			ans[j]=r_str[r_len-1-j];
		for(k=0;k<c_len;k++)
			ans[k+r_len]=c_str[c_len-1-k];
		for(l=0;l<l_len;l++)
			ans[l+r_len+c_len]=l_str[l];
		printf("%s",ans);
	}
	
	return 0;
}



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

int main() {
  int A, B, C;
  cin >> A >> B >> C;
  
  if( A == B && A != C ){
    cout << C << endl;
  }else if( B == C && A != B ){
    cout << A << endl;
  }else if( A == C && A != B ){
    cout << B << endl;
  }
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int n;
vector <vector <int> > input;
vector <int> dp;
int func(int node)
{
    if(input[node].size() == 0)
        return 0;
    if(dp[node] != -1)
        return dp[node];
    int result = 0;
    for(int i=0;i<input[node].size();i++)
    {
        result = max(result,1+func(input[node][i]));
    }
    return dp[node] = result;
}
int main()
{
    int n,m;cin>>n>>m;
    input.clear();
    input.resize(n+1);
    for(int i=0;i<m;i++)
    {
        int a,b;
        cin>>a>>b;
        input[a].push_back(b);
    }
    dp.clear();
    dp.resize(n+1,-1);
    int ans =1;
    for(int i=1;i<=n;i++)
    {
        if(dp[i] == -1)
        {
            ans = max(ans,func(i));
        }
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 8192
import sys
sys.setrecursionlimit(10**7)

N = int(input())
S = [input() for i in range(N)]

es = [[] for i in range(N)]
for i,row in enumerate(S):
    for j,c in enumerate(row):
        if c=='1':
            es[i].append(j)
            es[j].append(i)

#n個の頂点の色を初期化。0:未着色、1:黒、-1:白
colors = [0 for i in range(N)]

#頂点vをcolor(1 or -1)で塗り、再帰的に矛盾がないか調べる。矛盾があればFalse
def dfs(v,color):
    #今いる点を着色
    colors[v] = color
    #今の頂点から行けるところをチェック
    for to in es[v]:
        #同じ色が隣接してしまったらFalse
        if colors[to] == color:
            return False
        #未着色の頂点があったら反転した色を指定し、再帰的に調べる
        if colors[to] == 0 and not dfs(to, -color):
            return False
    #調べ終わったら矛盾がないのでTrue
    return True

#2部グラフならTrue, そうでなければFalse
def is_bipartite():
    return dfs(0,1) # 頂点0を黒(1)で塗ってDFS開始

if not is_bipartite():
    print(-1)
    exit()

INF = float('inf')
dists = [[1 if c=='1' else INF for c in row] for row in S]
for i in range(N):
    dists[i][i] = 0

for k in range(N):
    for i in range(N):
        for j in range(N):
            dists[i][j] = min(dists[i][j], dists[i][k] + dists[k][j])

print(max(max(row) for row in dists) + 1)

Measured memory_bytes: 68828
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <stdio.h>
#include <queue>
#include <deque>
#include <cstdio>
#include <set>
#include <bitset>
using namespace std;
int main() {
	int n;
	int h[110];
	int ans = 0, ans1 = 0;
	bool w = false;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> h[i];
	}
	h[n] = 0;
	for (;;) {
		for (int j = 0; j < n+1; j++) {
			if (h[j] > 0) {
				h[j]--;
				w = true;
			}
			else if (w == true) {
				ans++;
				w = false;
			}
		}
		for (int k = 0; k < n; k++) {
			if (h[k] != 0) {
				break;
			}
			ans1++;
			if (ans1==n){
				cout << ans << endl;
				return 0;
			}
		}
		ans1 = 0;
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define pb emplace_back
typedef long long ll;
typedef pair<int,int> pint;

string s;
int n;
int ans[100001];
int main(){
    cin>>s;
    n=s.size();
    int cur=0;
    rep(i,n){
        if(s[i]=='R') ++cur;
        else ans[i]+=cur/2,ans[i-1]+=(cur+1)/2,cur=0;
    }
    cur=0;
    for(int i=n-1;i>=0;--i){
        if(s[i]=='L') ++cur;
        else ans[i]+=cur/2,ans[i+1]+=(cur+1)/2,cur=0;
    }
    rep(i,n) cout<<ans[i]<<" ";
    cout<<endl;
    return 0;
}


Measured memory_bytes: 1024
S = input()
K = int(input())

S = [ord(c)-97 for c in S]
k = K
for i, s in enumerate(S[:]):
    if s==0:
        continue
    elif 26-s <= k:
        S[i] = 0
        k -= 26-s
S[-1] = (S[-1]+k) % 26
print("".join(map(lambda c: chr(c+97), S)))


Measured memory_bytes: 4820
#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
#define int long long
using namespace std;
inline int read(){
	int f=1,ans=0;char c=getchar();
	while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}
	while(c>='0'&&c<='9'){ans=ans*10+c-'0';c=getchar();}
	return f*ans;
}
const int MAXN=100001;
int m,k,ans,n,x[MAXN],d[MAXN],a[MAXN],fa[MAXN][61],p[MAXN];
signed main(){
//	freopen("2.in","r",stdin);
	n=read();
	for(int i=1;i<=n;i++) x[i]=read(),d[i]=i,p[i]=x[i]-x[i-1];
	m=read(),k=read();
	for(int i=1;i<=m;i++) a[i]=read(),swap(d[a[i]],d[a[i]+1]);
	for(int i=1;i<=n;i++) fa[i][0]=d[i];
	for(int j=1;j<=60;j++)
		for(int i=1;i<=n;i++) fa[i][j]=fa[fa[i][j-1]][j-1];
	for(int i=1;i<=n;i++){
		int res=i;
		int K=k;
		for(int j=60;j>=0;j--) if(K-(1ll<<j)>=0) K-=(1ll<<j),res=fa[res][j];
		ans+=p[res];
		printf("%.1f\n",(double)ans);
	}return 0;
}/*
3
1 -1 1
2 2
2 2
*/

Measured memory_bytes: 52224
#include <iostream>

using namespace std;

int main(void){
    int     num, flag, i;
    string  chs;

    cin >> num >> chs;

    flag = 1;
    for (i = 0; i < num; i++) {
        cout << chs[i];
        if ((chs[i] == '\0') || (chs[i + 1] == '\0')) {
            cout << endl;
            flag = 0;
            break;
        }
    }
    if (flag == 1) {
        cout << "..." << endl;
    }

    return 0;
}


Measured memory_bytes: 3628
N = int(input())
H = [int(h) for h in input().split()]
H.append(1e10)
dH = [H[i + 1] - H[i] for i in range(N)]
m, c = 0, 0
for i in range(N):
    d = H[i + 1] - H[i]
    if d <= 0:
        c += 1
    else:
        if c > m:
            m = c
        c = 0
print(m)

Measured memory_bytes: 14252
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define BUF_UNIT_SIZE 10000
#define MAX_LINE_LENGTH 1000

typedef struct {
    int x, y;
} vector_t;

void complex_mul(const vector_t *v1, const vector_t *v2, vector_t *t) {
    t->x = v1->x * v2->x - v1->y * v2->y;
    t->y = v1->x * v2->y + v1->y * v2->x;
}

char *bufp[100], *wall[1000], path[10000];
const vector_t next_dir[] = {{0, -1}, {1, 0}, {0, 1}, {-1, 0}};
const char dir_char[][3] = {
    {' ', 'U', ' '}, {'L', ' ', 'R'}, {' ', 'D', ' '}
};

int main(void) {
    int W, H, i;
    int buf_idx, buf_len, path_idx, nx, ny;
    char *buf;
    vector_t pos, dir, ndir;

    buf_idx = 0;
    buf_len = 0;
    buf = (char*)malloc(BUF_UNIT_SIZE * sizeof(char));
    bufp[buf_idx++] = buf;
    for (i = 0, W = 0; gets(buf) != NULL; i++) {
        wall[i] = buf;
        if (W == 0) W = strlen(buf);
        buf_len += strlen(buf) + 1;
        if (buf_len + MAX_LINE_LENGTH > BUF_UNIT_SIZE) {
            buf = (char*)malloc(BUF_UNIT_SIZE * sizeof(char));
            bufp[buf_idx++] = buf;
            buf_len = 0;
        }
        else {
            buf += strlen(buf) + 1;
        }
    }
    H = i;

    path_idx = 0;
    path[path_idx++] = 'R';
    pos.x = 0;
    pos.y = 0;
    dir.x = 1;
    dir.y = 0;
    while (1) {
        for (i = 0; i < 3; i++) {
            complex_mul(&dir, &next_dir[i], &ndir);
            if ((pos.y&1) == 0) {
                ny = pos.y + ndir.y;
                nx = pos.x + ndir.x + (dir.x > 0)*((ny+2)&1);
            }
            else {
                ny = pos.y + ndir.y + dir.y;
                nx = pos.x + ndir.x - (ndir.x > 0);
            }
            if (nx < 0 || W+(ny&1) <= nx || ny < 0 || H <= ny) continue;
            if (wall[ny][nx] == '1') break;
        }
        if (i == 3) {
            dir.x = - dir.x;
            dir.y = - dir.y;
        }
        else {
            pos.x = nx;
            pos.y = ny;
            dir.x = ndir.x;
            dir.y = ndir.y;
        }
        path[path_idx++] = dir_char[1+dir.y][1+dir.x];

        if ((pos.x == 0 && pos.y == 0 && dir.x == -1) ||
            (pos.x == 0 && pos.y == 1 && dir.y == -1)) break;
    }

    path[path_idx] = '\0';
    puts(path);

    for (i = 0; i < buf_idx; i++) {
        free(bufp[i]);
    }
    return 0;
}

Measured memory_bytes: 544
package main

import (
	"fmt"
	"math"
	"strconv"
)

func main() {
	var n int
	fmt.Scan(&n)
	digits := len(strconv.Itoa(n))
	sum := 0
	for i := 1; i < digits; i += 2 {
		num := math.Pow(10, float64(i))
		sum += int(num) - (int(num) / 10)
	}
	if digits % 2 != 0 {
		sum += n - int(math.Pow(10, float64(digits - 1))) + 1
	}
	fmt.Println(sum)
}


Measured memory_bytes: 512
#include<stdio.h>

int main(void){

int n,k,count=0;

scanf("%d %d",&n,&k);

int h[n];

for(int i=0;i<n;i++){
  scanf("%d",&h[i]);
  if(h[i]>=k){count++;}
}

printf("%d",count);

return 0;
}


Measured memory_bytes: 2040
import sys
import threading

S = int(input())
A = [-1 for _ in range(2001)]
A[0] = 0
A[1] = 0
A[2] = 0
A[3] = 1

for i in range(S+1):
  if A[i] == -1:
    A[i] = A[i-1] + A[i-3]

print(A[S]%(10**9+7))

Measured memory_bytes: 9352
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
#define ll long long
#define ld long double
#define mk make_pair
#define fi first
#define se second
#define vll vector<ll>
#define pii pair<ll,ll>
#define vvll vector< vector<ll> >
#define pb push_back
#define sz(v) (v).size()
#define inf 1e18
#define md 1000000007
#define all(v) (v).begin(),(v).end()
#define rep(i,a,b) for(ll i=a;i<b;++i)
#define tel(a){cout<<a<<"\n";}
#define tell(a,b){cout<<a<<" | "<<b<<"\n";}
#define telll(a,b,c){cout<<a<<" | "<<b<<" | "<<c<<"\n";}
#define teln(v,n){cout<<"v- ";rep(i,0,n)cout<<v[i]<<" ";cout<<"\n";}
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0); 

using namespace std;
using namespace __gnu_pbds;

template<typename T>
using o_set=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define M 1000010
ll spf[M];
void seive(){
	rep(i,1,M)spf[i]=i;
	rep(i,2,M)if(spf[i]==i)for(ll j=2*i;j<M;j+=i)if(spf[j]==j)spf[j]=i;
	// teln(spf,20);
}
ll f(ll a,ll b){
	ll ans=1;
	while(b){
		if(b&1)ans=(ans*a)%md;
		a=(a*a)%md;b/=2;
	}
	return ans;
}
int main(){
	IOS;
	seive();
	ll n;cin>>n;
	ll l=1;
	ll a[n];
	ll pr[M];
	rep(i,0,M)pr[i]=0;
	rep(i,0,n){
		cin>>a[i];
		ll p,cnt,n=a[i];
		while(n>1){
			p=spf[n],cnt=0;
			while(n%p==0)cnt++,n/=p;
			pr[p]=max(pr[p],cnt);
		}
	}
	rep(i,0,M)l=(l*f(i,pr[i]))%md;
	// tel(l);
	ll ans=0;
	rep(i,0,n){
		ll cnt = (l*f(a[i],md-2))%md;
		// tell(i,cnt);
		ans=(ans+cnt)%md;
	}
	cout<<ans;
	
	return 0;
}



Measured memory_bytes: 16000
<?php
fscanf(STDIN,"%d",$s);
$len = strlen($s);
$n = pow(2,$len-1);
$ans = 0;
for($i = 0 ; $i < $n ; ++$i){
    //2進数0左詰め
    //str_pad(decbin($i),$n,"0",STR_PAD_LEFT);
    //sprintf("%'0".$len."b",$i);
    $str_formula = "\$ans += ";
    $bin = array();
    $bin = str_split(sprintf("%'0".$len."b",$i));
    for($j = 0; $j < $len ; ++$j ){
        if(intval($bin[$j])===0){
            $str_formula .= strval($s)[$j];
        }else{
            $str_formula .= "+".strval($s)[$j];
        }
    }
    eval($str_formula.";");
}
echo $ans,PHP_EOL;

Measured memory_bytes: 3832
#include <iostream>
#include <vector>
#include <string>
#define rep(i, n)   for(int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;

vector<ll>a;
struct Tree{
    int n;  //最下端のノード数
    vector<ll>node;
    Tree(int v){
        n = 1;
        while(n < v)    n *= 2;
        node.resize(2*n-1, 0);
    }
    ll Max(ll a, ll b){
        return (a > b)?a:b;
    }
    void update(int x, ll val){
        int i = x + n - 1;
        node[i] = getmax(0, x, 0, 0, n) + val;
        while(i > 0){
            i = (i-1)/2;
            node[i] = Max(node[i*2+1], node[i*2+2]);
        }
    }
    ll getmax(int a, int b, int k, int l, int r){
        if(r <= a || b <= l)    return 0;
        if(a <= l && r <= b)    return node[k];
        else{
            ll vl = getmax(a, b, 2*k+1, l, (l+r)/2);
            ll vr = getmax(a, b, 2*k+2, (l+r)/2, r);
            return Max(vl, vr);
        }
    }
    ll ans(){
        return node[0];
    }
    void debug(){
        rep(i, node.size()){
            printf("%d:%lld\n", i, node[i]);
        }
    }
};

int main(){
    int n;  cin >> n;
    vector<int>h(n);
    a.resize(n);
    rep(i, n)   cin >> h[i];
    rep(i, n)   cin >> a[i];
    Tree T(n);
    rep(i, n){
        T.update(h[i]-1, a[i]);
    }
    cout << T.ans() << endl;
}


Measured memory_bytes: 6656
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Numerics;

namespace Atcoder {
    class Program {
        static void Main(string[] args) {
            //var N = int.Parse(Console.ReadLine());
            //var inputList = new List<int>();
            //foreach (var i in Enumerable.Range(0, N))
            //    inputList.Add(int.Parse(Console.ReadLine()));


            //var NK = Console.ReadLine().Split(' ');
            //var N = int.Parse(NK.First());
            //var K = int.Parse(NK.Last());

            var A =long.Parse( Console.ReadLine());
            var B =long.Parse( Console.ReadLine());
            var C =long.Parse( Console.ReadLine());
            var D =long.Parse( Console.ReadLine());

            var result = min(A, B) + min(C, D);
            Console.WriteLine(result);

            return;
        }

        static long max(long left, long right) {
            if (left >= right)
                return left;
            return right;
        }

        static long min(long left,long right) {
            if (left >= right)
                return right;
            return left;
        }
    }
}


Measured memory_bytes: 13140
from collections import deque
import sys
sys.setrecursionlimit(10 ** 9)
import numpy as np
# import numpy as np
# 答えの提出の時にi+1とj+1は忘れないように
h, w = map(int, input().split())
cost = [[-1 for i in range(10)] for j in range(10)]

for i in range(10):
    cost[i] = list( map(int, input().split()))

cost = np.array(cost).T

def dijkstra(s,n,w,cost):
    #始点sから各頂点への最短距離
    #n:頂点数,　w:辺の数, cost[u][v] : vからuへのコスト(逆にした)
    d = [float("inf")] * (n+1)
    used = [False] * n
    d[s] = 0
    num = [0]*n # 視点sから各頂点への最短経路の経路数を保存するリスト
    num[s] = 1 # 辺の重みが0のやつがあったらここ使えないな

    while True:
        v = -1
        #まだ使われてない頂点の中から最小の距離のものを探す
        for i in range(n):
            if (not used[i]) and (v == -1):
               v = i
            elif (not used[i]) and d[i] < d[v]:
                v = i
        if v == -1:
               break
        used[v] = True

        for j in range(n):
            if d[j] > d[v]+cost[v][j]: # vを使った場合と使わない場合の最短値で比較
                d[j] = d[v]+cost[v][j]

    return d

d = dijkstra(1,10,100,cost)
d[-1] = 0

ans = 0
for _ in range(h):
    for number in list( map(int, input().split())):
        ans += d[number]

print(ans)

Measured memory_bytes: 12504