akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<sstream>
#include<iterator>
#include<list>

using namespace std;

#define INF LLONG_MAX / 5
#define MOD 1000000007
#define int long long
#define rep(i, n) for (int i = 0; i < n; i++)
#define sort(v) sort((v).begin(), (v).end())
#define reverse(v) reverse((v).begin(), (v).end())
#define upper(v,hoge) upper_bound(v.begin(),v.end(),hoge)
#define lower(v,hoge) lower_bound(v.begin(),v.end(),hoge)
#define enld endl


signed main() {
	int a, b, c;
	cin >> a >> b >> c;
	if (b - a == c - b) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}
}

Measured memory_bytes: 3636
#include<stdio.h>

int main(){
  int n = 0;
  int h[100000] = {};
  int i = 0;
  int topindex = 0;
  int maxdown = 0;
  int down = 0;
  scanf("%d",&n);
  for(i = 0;i < n;i++){
    scanf("%d",&h[i]);
  }
  
  for(i = 0;i < n-1;i++){
    if(h[i] >= h[i+1]){
      down++;
    }else{
      if(maxdown < down){
        maxdown = down;
      }
      down = 0;  
    }
    if(maxdown < down){
        maxdown = down;
      }

  }
  printf("%d",maxdown);
  return 0;
}

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

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

int main() {
  ll n, k;
  cin >> n >> k;
  vector<ll> h(n);
  rep(i, n) cin >> h[i];
  sort(h.begin(), h.end());
  reverse(h.begin(), h.end());
  ll sum = 0;
  for(int i = k; i < n; i++) sum += h[i];
  cout << sum << endl;
}


Measured memory_bytes: 4844
int a[200000];
int ans[200000];
int main(){
int n;
scanf("%d",&n);
for(int i=2;i<=n;i++)scanf("%d",&a[i]);
for(int i=2;i<=n;i++)ans[a[i]]++;
for(int i=1;i<=n;i++)printf("%d\n",ans[i]);
}


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

#if __has_include("print.hpp")
  #include "print.hpp"
#endif

#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define MOD 1000000007

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


int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, m;
  cin >> n >> m;
  int minv = -1;
  int maxv = INT_MAX;
  vector<p> v(m);
  for (int i = 0; i < m; i++) {
    cin >> v[i].first >> v[i].second;
    minv = max(minv, v[i].first);
    maxv = min(maxv, v[i].second);
  }
  int res = maxv - minv + 1;
  res = max(res, 0);
  cout << res << endl;
}


Measured memory_bytes: 1024
#pragma GCC optimize("O3")
#pragma GCC target("avx")
#include <bits/stdc++.h>
#define rep(i ,n) for(int i=0;i<(int)(n);++i)
#define repr(i ,n) for(int i=n;i>(int)(n);--i)
#define rep1(i ,n) for(int i=1;i<=(int)(n);++i)
#define ALL(a) a.begin(), a.end()
#define RSORT(a) sort(ALL(a),greater<>())
#define SORT(a) sort(ALL(a))
#define bit_check(bit, i) ((bit>>(i)) & 1)
#define PRINT(x) printf("%d\n",(x));
#define ENDL printf("\n");
using namespace std;
typedef long long int i64;
typedef unsigned long long u64;
template<class T> using V = vector<T>;
using VI = V<int>;
const int INF = 2e9;
const i64 MOD = 1e9 + 7;

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

signed main(){
    int r ; cin >> r;
    double PI = acos(-1);
    cout << fixed << 2 * PI * (double)r << endl;
}

Measured memory_bytes: 3764
#include <bits/stdc++.h>
using namespace std;
int r;
int main () {
	cin >> r;
	if (r<1200){
		cout << "ABC" << endl;
	} else if (r<2800){
		cout << "ARC" << endl;
	} else {
		cout << "AGC" << endl;
	}
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <vector>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<ll, int> ll_i;
typedef pair<double, int> d_i;
typedef pair<ll, ll> ll_ll;
typedef pair<double, double> d_d;
struct edge { int u, v; ll w; };

ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;

struct dice {
	int x, _x, y, _y, z, _z;
	dice(int X, int _X, int Y, int _Y, int Z, int _Z) {
		x = 1; _x = 6; y = 2; _y = 5; z = 3; _z = 4;
		for (int i = 0; i < 6; i++) {
			i % 2 ? rotx() : roty();
			for (int j = 0; j < 4; j++) {
				if ((!X||x==X) && (!_X||_x==_X) && (!Y||y==Y) && (!_Y||_y==_Y) && (!Z||z==Z) && (!_Z||_z==_Z))
					return;
				rotz();
			}
		}
	}
	void rot(int& a, int& b, int&c, int& d) {
		int tmp = d; d = c; c = b; b = a; a = tmp;
	}
	void rotx()  { rot(y, z, _y, _z); }
	void rot_x() { rot(z, y, _z, _y); }
	void roty()  { rot(z, x, _z, _x); }
	void rot_y() { rot(x, z, _x, _z); }
	void rotz()  { rot(x, y, _x, _y); }
	void rot_z() { rot(y, x, _y, _x); }
};

int main() {
	for (;;) {
		int n; cin >> n;
		if (n == 0) break;
		vector< vector<int> > h(100, vector<int>(100)), a = h;
		while (n--) {
			int t, f; cin >> t >> f;
			dice d(0, 0, t, 0, f, 0);
			int x = 50, z = 50;
			for (;;) {
				int maxi = 3;
				if (h[x + 1][z] < h[x][z] && d.x > maxi) maxi = d.x;
				if (h[x - 1][z] < h[x][z] && d._x > maxi) maxi = d._x;
				if (h[x][z + 1] < h[x][z] && d.z > maxi) maxi = d.z;
				if (h[x][z - 1] < h[x][z] && d._z > maxi) maxi = d._z;
				if (maxi == 3) break;
				if (d.x == maxi) { x++; d.rot_z(); }
				else if (d._x == maxi) { x--; d.rotz(); }
				else if (d.z == maxi) { z++; d.rotx(); }
				else if (d._z == maxi) { z--; d.rot_x(); }
			}
			h[x][z]++;
			a[x][z] = d.y;
		}
		vector<int> b(7);
		for (int x = 0; x < 100; x++)
			for (int z = 0; z < 100; z++)
				b[a[x][z]]++;
		printf("%d %d %d %d %d %d\n", b[1], b[2], b[3], b[4], b[5], b[6]);
	}
}

Measured memory_bytes: 1284
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define fr(a,b) for(int i = a; i < b; i++)
#define rep(i,a,b) for(int i = a; i < b; i++)
#define mod 1000000007
#define inf (1LL<<60)
#define all(x) (x).begin(), (x).end()
#define prDouble(x) cout << fixed << setprecision(10) << x
#define triplet pair<ll,pair<ll,ll>>
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL)
using namespace std;
void go()
{
#ifndef ONLINE_JUDGE
  freopen("inn.txt","r",stdin);
  freopen("o.txt","w",stdout);
  #endif
}
 
int main() {
   fast_io;
   go();
   string s;
   cin>>s;
   if(s[0]=='R' && s[1]=='R' && s[2]=='R')
   	cout << 3 <<"\n";
   else if((s[0]=='R' && s[1]=='R') || (s[2]=='R'&& s[1]=='R'))
   	cout << 2 <<"\n";
   else if(s[0]=='R' || s[1]=='R' || s[2]=='R')
   	cout << 1 <<"\n";
   else
   	cout << 0 <<"\n";
}


Measured memory_bytes: 3636
///বিসমিল্লাহির_রহমানির_রহীম
#include<bits/stdc++.h>
#define     pie                          acos(-1.0)
#define     N                            2000015
#define     eps                          1e-9
#define     ff                           first
#define     ss                           second
#define     nl                           '\n'
#define     mod                          1000000007
#define     sp                           ' '
#define     CLR(a)                       memset(a,0,sizeof(a))
#define     SET(a)                       memset(a,-1,sizeof(a))
#define     all(x)                       x.begin(),x.end()
#define     allr(x)                      x.rbegin(),x.rend()
#define     sz(x)                        (int)(x).size()
#define     Fast_Read                    ios_base::sync_with_stdio(false); cin.tie(nullptr);  cout.tie(nullptr);
#define     Precision(x)                 cout.setf(ios::fixed); cout.precision(x);
#define     bug                          cout<<"debug"<<nl;
using namespace std;
int dx[]={0,0,1,-1,-1,-1,1,1};
int dy[]={1,-1,0,0,-1,1,1,-1};
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
template < class T> inline T biton(T n,T pos){return n |((T)1<<pos);}
template < class T> inline T bitoff(T n,T pos){return n & ~((T)1<<pos);}
template < class T> inline T ison(T n,T pos){return (bool)(n & ((T)1<<pos));}
template < class T> inline T gcd(T a, T b){while(b){a%=b;swap(a,b);}return a;}
inline int nxt(){int aaa;scanf("%d",&aaa);return aaa;}
inline ll lxt(){ll aaa;scanf("%lld",&aaa);return aaa;}
inline double dxt(){double aaa;scanf("%lf",&aaa);return aaa;}
template <class T> inline T bigmod(T p,T e,T m){T ret = 1;
for(; e > 0; e >>= 1){
    if(e & 1) ret = (ret * p) % m;p = (p * p) % m;
} return (T)ret;}
#ifdef obaydullah
     #define debug(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template < typename Arg1 >
    void __f(const char* name, Arg1&& arg1){
        cerr << name << " is " << arg1 << std::endl;
    }
    template < typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){
        const char* comma = strchr(names+1, ',');
        cerr.write(names, comma - names) << " is " << arg1 <<" | ";
        __f(comma+1, args...);
    }
#else
    #define debug(...)
#endif
///******************************************START******************************************
void solve()
{
    ll n=lxt();
    ll a=lxt(),b=lxt();
    ll dif=abs(a-b);
    ll x=n-max(a,b)+1;
    ll y=min(a,b);
    ll mn=x+(n-(min(a,b)+x))/2;
    mn=min(mn,y+((max(a,b)-y)-1)/2);
    debug(mn);
    if(dif%2==0)
        printf("%lld\n",((dif)/2));
    else printf("%lld\n",min(mn,min(max(a,b)-1,n-min(a,b))));
}
int main()
{
    //Fast_Read
    Precision(10)
#ifdef obaydullah
    double start_time = clock();
    ///freopen ("output.txt","w",stdout);
    ///freopen ("input.txt","r",stdin);
#endif
    int tc=1;
    while(tc--)
    {
        solve();
    }
#ifdef obaydullah
    double end_time = clock();
    cerr<<"Time = "<<fixed<<setprecision(10)<<(end_time - start_time) / CLOCKS_PER_SEC<<'\n';
#endif

    return 0;
}


Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
        int[] p = new int[n];
      
      	for(int i = 0; i < p.length; i++){
        	p[i] = sc.nextInt();
		}
      	int min = p[0];
        int count = 1;
        for(int i = 0; i < p.length; i++){
        	if(min > p[i]){
            	min = p[i];
                count += 1;
            }
        }
        System.out.println(count);
     }
}

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

int main () {
	long long n;
	cin >> n;
	long long ans = n;
	for(long long i = 1; i <= sqrt(n); i++) {
		if(n % i == 0) {
			long long temp = i - 1;
			temp += (n / i) - 1;
			ans = min(ans, temp);
		}
	}
	cout << ans;
	return 0;
}  

Measured memory_bytes: 256
// 最小の集合場所の座標はどこかわからないので、
// 総当たりで場所を探し一番コストが少ない場所を集合場所の座標とする

// inputに入力データ全体が入る
function Main(inputString) {
    // 1行目がinput[0], 2行目がinput[1], …に入る
    let inputLineArray = inputString.split("\n");

    // 住んでる座標の文字列配列
    let livingPointStringArray = inputLineArray[1].split(" ");

    // 想定される最小の移動コスト
    let minRequiredPhysicalStrength = 999999;

    // 住んでる座標の文字列配列を数値配列に変換する
    let livingPointArray = [];
    livingPointStringArray.forEach( element => {
        let livingPoint = parseInt( element, 10)
        livingPointArray.push(livingPoint); 
    });

    // 住んでる座標のうち、最小値と最大値を求める
    let minLivingPoint = Math.min.apply( null, livingPointArray);
    let maxLivingPoint = Math.max.apply( null, livingPointArray);

   // 移動コストが最小の座標を求める
    for( i = minLivingPoint; i <= maxLivingPoint; i++ ){
        let tmpMeetingPoint = i;
        // let beforeMinRequiredPhysicalStrength = minRequiredPhysicalStrength;
        minRequiredPhysicalStrength = requiredPhysicalStrengthFunction(livingPointArray, tmpMeetingPoint, minRequiredPhysicalStrength);
        // 関数実行前後で値が変わっていなければこれ以上やっても意味ないのでbreakする
        // if ( beforeMinRequiredPhysicalStrength === minRequiredPhysicalStrength) {
        //     break;
        // }
    }
    console.log('%d', minRequiredPhysicalStrength);
}

    // 必要な体力を計算する関数
function requiredPhysicalStrengthFunction(in_livingPointArray, in_meetingPoint, in_minRequiredPhysicalStrength){
    // 必要な体力の合計値
    let tmpAllRequiredPhysicalStrength = 0;

    // 住んでる座標の配列
    in_livingPointArray.forEach( livingPoint => {
        //必要な体力は(住んでる座標 - 集合場所の候補の座標)の2乗
        let requiredPhysicalStrength = Math.pow(( livingPoint - in_meetingPoint ) , 2);
        tmpAllRequiredPhysicalStrength += requiredPhysicalStrength;
    });
    // 一番小さいと思っている消費コストより今回の座標の消費コストの方が小さければそれを最小値とする
    if(in_minRequiredPhysicalStrength > tmpAllRequiredPhysicalStrength){
        return tmpAllRequiredPhysicalStrength;
    } else {
        return in_minRequiredPhysicalStrength;
    }
}

    //*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
    Main(require("fs").readFileSync("/dev/stdin", "utf8"));
    

Measured memory_bytes: 7500
N, K = map(int, input().split())
A = [int(a) - 1 for a in input().split()]
visited = [False] * N
if N >= K:
    ans = 0
    while K > 0:
        ans = A[ans]
        K -= 1
    print(ans + 1)
    exit()
cur = 0
visited[cur] = True
nxt = A[cur]
turn = 1
path = [[cur, turn]]
while True:
    if visited[nxt]:
        break
    cur = nxt
    visited[cur] = True
    nxt = A[cur]
    turn += 1
    path.append([cur, turn])
st = A[path[-1][0]]
st_turn = 1
for x in path:
    if x[0] == st:
        st_turn = x[1]
        break
fq = path[-1][1] - st_turn + 1
go = (K - (st_turn - 1)) % fq
ans = nxt
while go > 0:
    ans = A[ans]
    go -= 1
print(ans + 1)


Measured memory_bytes: 37396
<?php
  list($n,$m) = explode(" ", trim(fgets(STDIN)));

  if(abs($n-$m) > 1){
    echo "0";
    exit;
  }

  $ans=1;
  for($i=0;$i<$n;$i++){
    $ans=$ans*($n-$i);
    $ans=$ans%1000000007;
  }

  for($i=0;$i<$m;$i++){
    $ans=$ans*($m-$i);
    $ans=$ans%1000000007;
  }

  if($n==$m){
    $ans=$ans*2;
    $ans=$ans%1000000007;
  }
  echo $ans;

Measured memory_bytes: 16276
n = int(input())
a = n // 100
b = a * 100 + a * 10 + a
if(n > b):
  ans = (a + 1) * 100 + (a + 1) * 10 + (a + 1)

else:
  ans = a * 100 + a * 10 + a
print(ans)

Measured memory_bytes: 9180
def main():
    n, m, x = [int(i) for i in input().split()]
    a = [int(i) for i in input().split()]

    ans = min(len([v for v in a if 0 < v and v < x]),
              len([v for v in a if x < v and v <= n]))
        
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 38256
#include <bits/stdc++.h>
using ll = long long;
#define FOR(i, k, n) for(ll i = (k); i < (n); i++)
#define FORe(i, k, n) for(ll i = (k); i <= (n); i++)
#define FORr(i, k, n) for(ll i = (k)-1; i > (n); i--)
#define FORre(i, k, n) for(ll i = (k)-1; i >= (n); i--)
#define REP(i, n) FOR(i, 0, n)
#define REPr(i, n) FORre(i, n, 0)
#define ALL(x) (x).begin(), (x).end()
#define ALLr(x) (x).rbegin(), (x).rend()
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
using namespace std;

const int INF = 1001001001;

int main(void){
  string s, t;
  cin >> s;
  int n = s.size();
  t += s[0];
  REP(i, n){
    if(s[i] != t.back()) t += s[i];
  }
  n = t.size();
  cout << n-1 << endl;

  return 0;
}

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

#define MAXN 55
#define MAXK 1000000
#define int long long
#define LL long long
#define pii pair<long, long>
#define fi first
#define se second
#define fastio ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
#define mtx vector<vector<int>>
#define row vector<int>
using namespace std;

int N, K;
int a[MAXN][MAXN];
int dp[MAXN][MAXK];
int mod = 1e9+7;

mtx mul(mtx a, mtx b) {
    mtx c(a.size(), row(b[0].size(), 0));
    for (int i = 0; i < a.size(); i++) {
        for (int j = 0; j < b[0].size(); j++) {
            for (int k = 0; k < a[0].size(); k++) {
                c[i][j] += a[i][k] * b[k][j] % mod;
                c[i][j] %= mod;
            }
        }
    }
    return c;
}

mtx kpow(mtx a, int b) {
    mtx c(a.size(), row(a.size(), 0));
    for (int i = 0; i < a.size(); i++) c[i][i] = 1;
    while (b) {
        if (b & 1) c = mul(c, a);
        a = mul(a, a);
        b >>= 1;
    }
    return c;
}

signed main() {
    fastio;
    cin >> N >> K;
    mtx a(N, row(N, 0));
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < N; j++) cin >> a[i][j];
    }
    mtx dp(1, row(N, 1));
    a = kpow(a, K);
    dp = mul(dp, a);
    int ans = 0;
    for (int j: dp[0]) ans = (ans + j) % mod;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 384
import sys

read = sys.stdin.buffer.read
input = sys.stdin.buffer.readline
inputs = sys.stdin.buffer.readlines

# mod=10**9+7
# rstrip().decode('utf-8')
# map(int,input().split())
# import numpy as np

def main():
	n=int(input())
	ans=0
	if n>=105:
		ans+=1
	if n>=135:
		ans+=1
	if n>=165:
		ans+=1
	if n>=189:
		ans+=1
	if n>=195:
		ans+=1
	
	print(ans)
	
	
if __name__ == "__main__":
	main()


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

int main(){
	int N;
	cin >> N;
	long long A[200001];
	for (int i = 0; i < N; i++) {
		cin >> A[i];
	}
	long long S=0;
	for (int i = 0; i < N; i++) {
		S = S + A[i];
	}
	long long z = S;
	long long sum=0;
	for (int i = 0; i < N; i++) {
		sum = sum + A[i];
		z = min(z, abs(sum * 2 - S));
	}
	
	
	
		cout << z << '\n';
	return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#include <stdlib.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef pair<ll,ll> P;
typedef priority_queue<P,vector<P>,greater<P>> P_queue;

#define REP(i,a,b) for(int i=(int)a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define mp make_pair
#define ALL(a) a.begin(),a.end()
#define SORT(a) sort(ALL(a))
#define U_ERASE(V) V.erase(unique(ALL(V)), V.end());

const ll MOD=998244353;
const ll mod=1000000007;
const ll INF=1e15;
vec dx={1,0,-1,0};
vec dy={0,1,0,-1};

int main(){
    ll A,B,Q; cin>>A>>B>>Q;
    vec s(A+2,-INF),t(B+2,-INF);
    rep(i,A) cin>>s[1+i];
    rep(i,B) cin>>t[1+i];
    s[A+1]=INF, t[B+1]=INF;
    vec ans;
    vec Que(Q);
    rep(i,Q) cin>>Que[i];
    rep(i,Q){
        ll x=Que[i];
        ll k1=lower_bound(ALL(s),x)-s.begin();
        ll A1=s[k1]-x, A2=x-s[k1-1];
        ll k2=lower_bound(ALL(t),x)-t.begin();
        ll B1=t[k2]-x, B2=x-t[k2-1];
        vec p(6);
        //cout<<i<<':'<<A1<<' '<<A2<<' '<<B1<<' '<<B2<<endl;
        p[0]=max(A2,B2);
        p[1]=max(A1,B1);
        p[2]=2*A1+B2;
        p[3]=2*A2+B1;
        p[4]=2*B1+A2;
        p[5]=2*B2+A1;
        sort(ALL(p));
        ans.pb(p[0]);   
    }
    rep(i,ans.size()) cout<<ans[i]<<endl;
}

Measured memory_bytes: 4596
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(ll i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

int main() {
  ll n, m;
  cin >> n >> m;
  vl x(n), y(n), z(n);
  rep(i, n) cin >> x[i] >> y[i] >> z[i];
  ll ans = 0;
  rep(a, 2) rep(b, 2) rep(c, 2) {
    priority_queue<P> q;
    rep(i, n)
        q.push({x[i] * pow(-1, a) + y[i] * pow(-1, b) + z[i] * pow(-1, c), i});
    ll nx = 0, ny = 0, nz = 0;
    rep(_, m) {
      ll i = q.top().second;
      q.pop();
      nx += x[i];
      ny += y[i];
      nz += z[i];
    }
    ll now = abs(nx) + abs(ny) + abs(nz);
    ans = max(ans, now);
  }
  cout << ans << endl;
}

Measured memory_bytes: 3744
#include<iostream>
#include<vector>
#include<queue>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
ll inf = 1000000007;
int dx[4] = { 1,-1,0,0 };
int dy[4] = { 0,0,1,-1 };
int main() {
	int n, m;
	cin >> n >> m;
	vector<vector<int>>s(m);
	int k;
	for (int i = 0; i < m; i++) {
		cin >> k;
		s[i].resize(k);
		for (int j = 0; j < k; j++) {
			cin >> s[i][j];
			s[i][j]--;
		}
	}
	vector<ll>p(m);
	for (int i = 0; i < m; i++) {
		cin >> p[i];
	}
	ll ans = 0;
	for (int bit = 0; bit<(1 << n); bit++) {
		bool ok = true;
		for (int j = 0; j < m; j++) {
		ll count = 0;
				for (int id : s[j]) {
					if (bit & (1 << id)) {
						count++;
					}
				}
				if (count % 2 != p[j]) {
						ok = false;
				}
		}
		if (ok) {
				ans++;
		}
	}
	cout << ans << endl;
		return 0;
}

Measured memory_bytes: 256
import std.stdio;
import std.algorithm;
import std.math;
import std.conv;
import std.string;

T readNum(T)(){
  return readStr.to!T;
}

T[] readNums(T)(){
  return readStr.split.to!(T[]);
}

string readStr(){
  return readln.chomp;
}

void main(){
  auto nm = readNums!int;
  auto n = new int[](nm[0]);
    int penalty, cleared;
    
    foreach(i; 0 .. nm[1]){
        auto ps = readStr.split;
        if(ps[1] == "WA" && n[ps[0].to!int-1] >= 0){
            n[ps[0].to!int-1]++;   
        } else if(ps[1] == "AC" && n[ps[0].to!int-1] >= 0){
            penalty += n[ps[0].to!int-1];
            cleared++;
            n[ps[0].to!int-1] = -1;
        }
    }
    
    writeln(cleared, " ", penalty);
}


Measured memory_bytes: 3580
N,K=map(int,input().split())
h=list(map(int,input().split()))

dp=[10**9]*(N)
dp[0]=0

for i in range(1,N):
    for j in range(1,K+1):
        if i-j>=0:
            dp[i]=min(dp[i],dp[i-j]+abs(h[i]-h[i-j]))
    
print(dp[-1])

Measured memory_bytes: 52448
#include <iostream>
#include <sstream>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <deque>
#include <queue>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <stdio.h>

using namespace std;

#define fo(i,n) for(int i=0; i<(int)n; i++)
#define rep(it,s) for(__typeof((s).begin()) it=(s).begin();it!=(s).end();it++)
#define mp(a,b) make_pair(a,b)
#define pb(x) push_back(x)
#define pii pair<int,int>

typedef vector<double> vec;
typedef vector<vec> mat;

const double eps = 1.0e-5;

int d;
double x[8];
int m;

vec gauss_jordan(const mat& A, const vec &v) {
	int n = A.size();
	mat B(n,vec(n+1));
	for (int i=0; i<n; i++) 
		for (int j=0; j<n; j++) 
			B[i][j] = A[i][j]; 
	for (int i=0; i<n; i++) 
		B[i][n] = v[i];
	for (int i=0; i<n; i++) {
		int piv = -1;
		double tmp = -1;
		for (int j=i; j<n; j++) {
			if (tmp < abs(B[j][i])) {
				piv = j;
				tmp = abs(B[j][i]);
			}
		}
		if (piv==-1 || tmp<eps) return vec();
		swap(B[piv],B[i]);
		double divNum = B[i][i];
		for (int j=i; j<=n; j++) 
			B[i][j] /= divNum;
		for (int j=0; j<n; j++) {
			if (i==j) continue;
			double mulNum = B[j][i];
			for (int k=i; k<=n; k++)
				B[j][k] -= mulNum*B[i][k];
		}
	}
	vec res(n);
	for (int i=0; i<n; i++) {
		res[i] = B[i][n];
	}
	return res;
}

int solve() {
	for (int i=0; i<m; i++) {
		for (int j=i+1; j<m; j++) {
			mat A(d+1, vec(d+1,0.0));
			vector<int> v;
			for (int k=0; k<m; k++) {
				if (k==i || k==j) continue;
				v.push_back(k);
			}
			for (int k=0; k<v.size(); k++) {
				double cur = 1;
				for (int r=d; r>=0; r--) {
					A[k][r] = cur;
					cur *= v[k];
				}
			}
			vec c(d+1,0);
			for (int k=0; k<d+1; k++) {
				c[k] = x[v[k]];
			}
			vec ans = gauss_jordan(A,c);
			if (ans.size()>0) {
				
				double xx = 1;
				double y = 0.0;
				bool found = 0;
				for (int l=d; l>=0; l--) {
					y += ans[l]*xx;
					xx*=i;
				}
				if (abs(y-x[i])<eps) {
					found = 1; 
				}

				xx = 1;
				y = 0.0;
				for (int l=d; l>=0; l--) {
					y += ans[l]*xx;
					xx*=j;
				}

				if (abs(y-x[j])<eps) {
					if (found) continue;
					if (!found) return i;
				}
				else {
					if (found) return j;
				}
			}
		}
	}
	return -1;
}

int main() {

    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);

	while (cin>>d && d) {
		m = d+3;
		for (int i=0; i<m; i++) cin>>x[i];
		cout<<solve()<<endl;
	}
	
    return 0;

}

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

vector<long long> divisor(long long n) {
    vector<long long> ret;
    for (long long i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            ret.push_back(i);
            if (i * i != n) ret.push_back(n / i);
        }
    }
    sort(ret.begin(), ret.end()); // 昇順に並べる
    return ret;
}

int main(){
    long long n; cin >> n;
    vector <long long> yakusu;
    yakusu = divisor(n);

    long long ans;
    if (yakusu.size() % 2 == 0){
        ans = yakusu.at(yakusu.size() / 2) + yakusu.at((yakusu.size() / 2) - 1);
    }
    else{
        ans = 2 * yakusu.at((yakusu.size() / 2));
    }

    cout << ans - 2 << endl;

}

Measured memory_bytes: 3684
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) FOR(i,0,n)
#define ROF(i,a,b) for(ll i=a;i>=b;i--)
#define per(i,a) ROF(i,a,0)
#define pb push_back
using namespace std;
using ll=long long;
using ld=long double;
using ch=char;
typedef pair<ll,ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<P> vP;
typedef vector<ch> vc;
typedef vector<vc> vvc;
const ll MOD=1000000007;
const ll MOD2=998244353;
const ld PI=acos(-1);
const ll INF=1e18;
struct edge{ll to,cost;};
struct edge2{ll from,to,cost;};

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

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

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll n;
    cin >> n;
    vl h(n+1),a(n);
    rep(i,n+1){
        cin >> h[i];
    }
    rep(i,n){
        cin >> a[i];
    }
    ll ans=0;
    rep(i,n){
        if(h[i]>=0){
            ll atk=min(h[i],a[i]);
            a[i]-=atk;
            ans+=atk;
        }
        if(a[i]>0){
            ll atc=min(a[i],h[i+1]);
            h[i+1]-=atc;
            ans+=atc;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 4756
#include <bits/stdc++.h>
#define rep(i,n)for(long long i=0;i<(n);i++)
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
const ll INF=1e18;
const ll MOD=1e9+7;
const double pi=acos(-1);
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);  
  
  int n,a,b,c,d;
  cin >> n >> a >> b >> c >> d;
 
  cout << min((n+a-1)/a*b,(n+c-1)/c*d) << endl;
}



Measured memory_bytes: 3232
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

  public static void main(String[] args) {
    
    new Main().run();
  }

  public void run() {

    try(BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {

      final int n = Integer.parseInt(br.readLine());
      String op;
      String[] words;
      Tree tree = new Tree();

      for(int i=0,k=0; i<n; i++,k=0){
        words = br.readLine().split(" ");
        op  = words[k++];
        if ( op.equals("insert") ) { 
          tree.insert(Integer.parseInt(words[k++]));
        }
        else {
          tree.dispRoundPath();
        }
      }

    }
    catch(IOException e) {
      System.out.println("IOException!");
    }
  }
}

class Tree {

  static final BTreeNode NIL = new BTreeNode(-1);
  BTreeNode root;
  StringBuilder buf;

  public Tree() {
    root = NIL;
    buf = new StringBuilder();
  }

  public void insert(int val) {
    BTreeNode y = NIL;
    BTreeNode x = root;
    BTreeNode z = new BTreeNode(val);

    while( !x.equals(NIL) ) {
      y = x;
      if( z.key < x.key )
        x = x.left;
      else
        x = x.right;
    }
    z.parent = y;

    if( y.equals(NIL) ){
      root = z;
    }
    else if( z.key < y.key )
      y.left = z;
    else
      y.right = z;
  } 
  void preParse(BTreeNode u) {
    if( !u.equals(NIL) ) {
      buf.append(" ").append(u.key);
      preParse(u.left);
      preParse(u.right);
    }
  }
  void inParse(BTreeNode u) {
    if( !u.equals(NIL) ) {
      inParse(u.left);
      buf.append(" ").append(u.key);
      inParse(u.right);
    }
  }

  void dispRoundPath() {

    inParse(root);
    buf.append("\n");
    preParse(root);
    buf.append("\n");

    System.out.print(buf);
    buf.setLength(0);
  }
}

class BTreeNode {
  int key;
  BTreeNode parent,left,right;

  public BTreeNode(int key) {
    this.key = key;
    this.parent =
    this.left =
    this.right = Tree.NIL;
  }

  @Override
  public boolean equals(Object o) {
    if(o == this) return true;
    if(o == null) return false;
    if(!(o instanceof BTreeNode)) return false;

    BTreeNode node = (BTreeNode)o;
    if(!(this.key == node.key)) return false;

    return true;
  }
}


Measured memory_bytes: 125748
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const long long INF = 1LL << 60; //intじゃ扱えないことに注意！
#define mod 1000000007
#define rep(i, n) for(int i = 0; i < (int)(n); i++) //範囲外参照とループの初期化に注意！

int main() {
  int N;
  cin >> N;
  vector<string> S(N);
  for(int i = 0; i < N; i++){
    cin >> S[i];
  }

  map<string, int> dic;
  for(int i = 0; i < N; i++){
    dic[S[i]]++;
  }

  int maxv = 0;
  for(auto x : dic){
    int v = x.second;
    maxv = max(maxv, v);
  }
  for(auto x : dic){
    if(x.second == maxv) {
      cout << x.first << endl;
    }
  }
}

Measured memory_bytes: 26752
#include <iostream>

using namespace std;

int main(){
	int n,p;
	while(1){
		cin>>n>>p;
		if(n==0&&p==0){
			break;
		}
		int sum=p;
		int cnt=0;
		int *data;
		int state=0;
		data = new int[n];
		for(int i=0;i<n;i++){
			data[i]=0;
		}
		while(1){
			
			if(sum==0){
				sum+=data[cnt];
				data[cnt]=0;
			}
			else{
				data[cnt]++;
				sum--;
				if(sum==0){
					int flag=0;
					for(int i=0;i<n;i++){
						if(i==cnt)continue;
						else{
							if(data[i]>0){
								flag=1;
							}
						}
					}
					if(flag==0){
						cout<<cnt<<endl;
						state=2;
					}
				}
			}
			cnt++;
			cnt%=n;
			if(state==2)break;
		}
	}
	return 0;
}

Measured memory_bytes: 1192
import java.util.*;

class Main {
    public static void main(String[] args) {
        new Solver().run();
    }
}

class Solver {

    public void run() {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] A = new int[N];
        
        for (int i = 0; i < N; i++) {
            A[i] = sc.nextInt();
        }

        Boolean down = null;
        boolean equa = false;
        long cur = Long.MIN_VALUE;

        int cnt = 0;
        cur = A[0];
        for (int i = 1; i < A.length; i++) {
            if (cur == A[i]) {
                equa = true;
                cur = A[i];
                continue;
            } else  {
                equa = false;
            }
                
            if (cur > A[i]) {
                if (down != null && !down) {
                    cnt++;
                    down = null;
                } else {
                    down = true;
                }
            } else {
                if (down != null && down) {
                    cnt++;
                    down = null;
                } else {
                    down = false;
                }
            }
            cur = A[i];
        }

        System.out.println(cnt + 1);

        
        return;
    }

}

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

int main(){
   int N,K,X,Y;

   cin >> N >> K >> X >> Y;

   int ans = 0;

   if(K > N) ans += N * X;

   else ans += K * X + (N - K) * Y;

   cout << ans << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<string>
using namespace std;
int main(){
	int n,i;
	cin>>n;
	string blue[n];
	for(i=0;i<n;i++)
		cin>>blue[i];
	int m;
	cin>>m;
	string red[m];
	for(i=0;i<m;i++)
		cin>>red[i];
	int ans=0;
	for(i=0;i<n;i++){
		string word=blue[i];
		int count=0;
		for(int j=0;j<n;j++)
			if(blue[j]==word)
				count++;
		for(int j=0;j<m;j++)
			if(red[j]==word)
				count--;
		ans=max(count,ans);
	}
	cout<<ans;
	return 0;
}

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

using namespace std;

using ll = long long int;
using ld = long double;

using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pdd = pair<double, double>;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using vvvl = vector<vvl>;
using vd = vector<double>;
using vvd = vector<vd>;
using vs = vector<string>;
using vb = vector<bool>;
using vvb = vector<vb>;

const int INF = (1 << 30) - 1;
const ll INF64 = ((ll)1 << 62) - 1;
const double PI = 3.1415926535897932384626433832795;

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

int gcd(int x, int y) { return y ? gcd(y, x % y) : x; }
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
int lcm(int x, int y) { return x / gcd(x, y) * y; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }

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

	ll n;
	cin >> n;

	
	vl a(n);
	ll sum = 0;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		sum += a[i];
	}

	ll res = INF64, x = 0;
	for (int i = 0; i < n - 1; i++) {
		x += a[i];
		ll y = sum - x;
		res = min(res, abs(x - y));
	}

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

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

int main(void){
    //int  K,A,B;
    string in_str,tmp_str;
    string ans = "NG";
 
//  cin >> in_str;
    cin >>in_str;  

//    int length = int(in_str.length());
  
    if (in_str == "ARC"){
        ans = "ABC";
    }else{
        ans = "ARC";
    }
    
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3628
#include <iostream>
#include <vector>

using namespace std;
typedef long long ll;
ll mod = 1e9+7;

ll mod_pow(ll a, ll x, ll mod) {
    if (x == 1)
        return a;
    if (x % 2 == 0) {
        ll tmp = mod_pow(a, x/2, mod);
        return tmp*tmp%mod;
    }
    else {
        return a*mod_pow(a, x-1, mod) % mod;
    }
}

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

    vector<ll> dp(k+1, 0);
    dp[k] = 1;
    ll ans = k;

    for (ll i = k; i > 1; i--) {
        dp[i-1] = mod_pow(k/(i-1), n, mod);
        for (ll j = 2; j * (i-1) <= k; j++) {
            dp[i-1] -= dp[j*(i-1)];
            dp[i-1] %= mod;
        }
        ans += (i-1)*dp[i-1]%mod;
        ans %= mod;
    }


    cout << (ans+mod)%mod << endl;

    return 0;
}

Measured memory_bytes: 4040
/*
D - Anticube
by.YXH_XianYu
   2018.6.15
 */
#include<algorithm>
#include<iostream>
#include<cstring>
#include<cstdio>
#include<cmath>
#define LLI long long
#define REG register
#define MXN 100010

LLI n,
	l1[MXN],
	l2[MXN];
#include<map>
std::map<LLI,int>cnt;

LLI pri_[MXN],
	pri[MXN];
bool wth[MXN];
void Euler(int n){
	wth[1]=1;
	for(int i=2;i<=n;i++){
		if(!wth[i])
			pri[++pri[0]]=i;
		for(int j=1;j<=pri[0]&&i*pri[j]<=n;j++){
			wth[i*pri[j]]=1;
			if(i%pri[j]==0)
				break;
		}
	}
	for(int i=1;i<=pri[0];i++)
		pri_[i]=pri[i]*pri[i]*pri[i];
}

int main(){

	scanf("%d",&n);
	Euler(3000);
	REG int i,j;
	for(i=1;i<=n;i++){
		LLI si,ti;

		scanf("%lld",&si);
		for(j=1;pri_[j]<=si;j++)
			while(si%pri_[j]==0)
				si/=pri_[j];
		cnt[si]++;
		l1[i]=si;
		
		ti=1;
		for(j=1;pri_[j]<=si;j++)
			if(si%pri[j]==0){
				ti*=(si%(pri[j]*pri[j])==0)?(pri[j]):(pri[j]*pri[j]);
				while(si%pri[j]==0)
					si/=pri[j];
			}
		ti*=((LLI)sqrt(si)*(LLI)sqrt(si)==si)?((LLI)sqrt(si)):(si*si);
		l2[i]=ti;
	}
	int ans=0;
	if(cnt[1]>0)
		ans++,
		cnt[1]=0;
	for(i=1;i<=n;i++)
		ans+=std::max(cnt[l1[i]],cnt[l2[i]]),
		cnt[l1[i]]=0,
		cnt[l2[i]]=0;
	printf("%d\n",ans);
	//system("pause");
	return 0;
}


Measured memory_bytes: 14336
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,K;
  cin >> N >> K;
  vector<int> h(N);
  for(int &x:h){cin >> x;}
  
  int ans =0;
  for(int i=0;i<N;i++)
  {
    if(h.at(i)>=K)ans++;
  }
  cout << ans << endl;
  
  return 0;
}

Measured memory_bytes: 640
/* Code by : Suraj (@suraj1611) */

#include<bits/stdc++.h>
#include <string>

using namespace std;

#define ll long long int
#define rep(i,n) for(int i=0; i<n; i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define mx INT_MAX
#define mn INT_MIN
#define md 1000000007
#define pb push_back
#define mp make_pair
#define maxsize 1100005
#define lb cout<<endl;
#define endl "\n"
#define F first
#define S second
#define label cout<<"hello!"<<endl
#define IOS ios_base::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL);

ll power(ll x, ll  y) 
{ 
	ll m=md;
   	ll ans=1;
    while (y > 0) 
    {
        if (y & 1)
            ans = (ans * x) % m;
        x = (x * x) % m;
        y >>= 1;
    }
    return ans;
} 

int main()
{
	IOS
	


	ll n,k;
	cin>>n>>k;
	ll a[n];
	rep(i,n)
	cin>>a[i];
	ll dp[n];
	memset(dp,-1,sizeof(dp));
	dp[0]=0;
	dp[1]=abs(a[0]-a[1]);
	for(ll i=2;i<n;i++)
	{
		ll x;
		dp[i]=1e15;
		rep1(j,k)
		{
			if((i-j)>=0)
			dp[i]=min(dp[i],dp[i-j]+abs(a[i-j]-a[i]));
		}
	}
	cout<<dp[n-1]<<endl;



    return 0;
}

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

#define ft first
#define sd second

using namespace std;

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


const int MAXT = 9, MAXN = 1000 * 1000 + 3;




int p9[MAXT], p6[MAXT], dp[MAXN], n;


int main() {
	p9[0] = p6[0] = 1;
	for (int i = 1; i < MAXT; i++)
		p9[i] = p9[i - 1] * 9, p6[i] = p6[i - 1] * 6;
	cin >> n;
	memset(dp, 127, sizeof dp);
	dp[0] = 0;
	for (int i = 1; i <= n; i++) {
		dp[i] = dp[i - 1] + 1;
		for (int j = 0; j < MAXT; j++) {
			if (i < p9[j])
				break;
			dp[i] = min(dp[i], dp[i - p9[j]] + 1);
		}
		for (int j = 0; j < MAXT; j++) {
			if (i < p6[j])
				break;
			dp[i] = min(dp[i], dp[i - p6[j]] + 1);
		}
	}
	cout << dp[n];
	return 0;
}

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

using namespace std;
long long int LCM(long long int c, long long int d)
{
   long long int p=(c*d)/__gcd(c,d);
   return p;
}
long long int antidivisor(long long int a,long long int b,long long int c,long long int d)
{
   long long int lcm=LCM(c,d);
    long long int s1=b/c-(a-1)/c;
     long long int s2=b/d-(a-1)/d;
     long long int s3=b/lcm-(a-1)/lcm;
     long long int s=s1+s2-s3;
     return s;

}

int main()
 {
long long int a,b,c,d,c1=0,i,s;
cin>>a>>b>>c>>d;
s=antidivisor(a,b,c,d);
cout<<b-a-s+1;
 }


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include<iostream>
#include<math.h>
using namespace std;

const float TH = 60.0 * M_PI/180.0;

typedef struct {
	float x;
	float y;
} Vertex;

void Koch(int d, Vertex p1, Vertex p2);

int main() {
	int deep;
	Vertex p1;
	Vertex p2;
	p1.x = 0; p1.y = 0;
	p2.x = 100; p2.y = 0;
	cin >> deep;

	cout << p1.x << " " << p1.y << endl;
	Koch(deep, p1, p2);
	cout << p2.x << " " << p2.y << endl;

	return 0;
}

void Koch(int d, Vertex p1, Vertex p2) {
	if (d <= 0) {
		return;
	}

	Vertex s, t, u;
	s.x = (2 * p1.x + 1 * p2.x) / 3;
	s.y = (2 * p1.y + 1 * p2.y) / 3;
	t.x = (1* p1.x + 2 * p2.x) / 3;
	t.y = (1 * p1.y + 2 * p2.y) / 3;
	u.x = (t.x - s.x)*cos(TH) - (t.y - s.y)*sin(TH) + s.x;
	u.y = (t.x - s.x)*sin(TH) + (t.y - s.y)*cos(TH) + s.y;

	Koch(d - 1, p1, s);
	cout << s.x << " " << s.y << endl;
	Koch(d - 1, s, u);
	cout << u.x << " " << u.y << endl;
	Koch(d - 1, u, t);
	cout << t.x << " " << t.y << endl;
	Koch(d - 1, t, p2);

	return;
}

Measured memory_bytes: 3284
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;
using static System.Math;
namespace AtCoder
{
    class Program
    {
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }

        static readonly long Mod = 1000000000 + 7;

        static void Main(string[] args)
        {
            //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
            var cs = new long[3][];
            cs[0] = Sarray();
            cs[1] = Sarray();
            cs[2] = Sarray();


            var deltac = new long[3];
            var deltar = new long[3];
            for (var j = 0; j < 3; ++j)
            {
                for (var i = 0; i < 3; ++i)
                {
                    deltac[i] = cs[(j + 1) % 3][i] - cs[j][i];
                    deltar[i] = cs[i][(j + 1) % 3] - cs[i][j];
                }
                if (deltac.Any(d => d != deltac[0]) || deltar.Any(d => d != deltar[0]))
                {
                    WriteLine("No");
                    return;
                }
            }
            WriteLine("Yes");
            //Out.Flush();
        }
    }
}

Measured memory_bytes: 13524
n,m=map(int,input().split())
a=[list(input()) for a in range(n)]
b=[list(input()) for a in range(m)]
c=0;d=0
for p in range(n-m+1):
  for q in range(n-m+1):
    if b[0]==a[p][q:q+m]:
      for r in range(m):
        if b[r]!=a[p+r][q:q+m]:d+=1
      if d==0:c=1
      else:d=0
if c==0:print('No')
else:print('Yes')

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

using namespace std;

#define int long long
#define endl '\n'
#define maxn 100010
const int MOD = 1000000007;

int pw(int a, int b, int m = MOD) {
    if (b == 0)
        return 1;
    if (b & 1)return a * pw(a, b - 1) % m;
    return pw(a * a % m, b / 2);
}

int inverse(int a) {
    return pw(a, MOD - 2);
}


void solve() {
    int n;
    cin >> n;

    vector<int> v(n);
    int sum = 0, sum2 = 0;
    for (int i = 0; i < n; ++i) {
        cin >> v[i];
        sum += v[i];
        sum2 += (v[i] * v[i]) % MOD;
        sum2 %= MOD;
    }
    sum %= MOD;
    sum = (sum * sum) % MOD;
    sum = (sum - sum2 + MOD) % MOD;
    sum *= inverse(2);
    sum %= MOD;
    cout << sum << endl;
}

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int t = 1;
//    cin >> t;

    while (t--)
        solve();
    return 0;
}

Measured memory_bytes: 4768
#include <bits/stdc++.h>
#define fi first
#define se second
#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 srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
const int MX = 200005;
#define RET(ans) {cout<<ans<<endl;return 0;} 

    // 二次元ベクターの基本
    /*
    vector<vector<int>> dp; // 宣言
    dp.resize(n); // 1次元めの要素数決定
    dp[i].push_back(int); // プッシュバック
    rep(i,n){
        sort(dp[i].begin(),dp[i].end()); // 二次元めを昇順ソート
    }
    */

    // 整数スキャン（複数）
    /*
    int x,y,z;
    scanf("%d%d%d",&x,&y,&z);

    // n個の整数のスキャン
    /*
    ll a[n] = {};
    rep(i,n){
        scanf("%lld",&a[i]);
    }
    */

    // 文字列スキャン
    /*
    string s; cin >> s;
    */

    // n個の文字列スキャン
    /*
    vector<string> slist;
    rep(i,n){
        string s; cin >> s;
        slist.push_back(s);
    }
    */

int main() {
    int a,b,k;
    cin >> a >> b >> k;


    ll ans = 0;
    int count = 0;
    drep(i,101){
        if(a%i==0&&b%i==0){
            count++;
        }
        if(count==k){
            ans=i;
            break;
        }
    }
    
    cout << ans << endl;
    return 0;
}
 
 


Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var s string
	fmt.Scan(&s)
	sum := 0
	for _, v := range s {
		if v == 'o' {
			sum++
		}
	}
	k := 15 - len(s) + sum
	if k >= 8 {
		fmt.Println("YES")
		return
	}
	fmt.Println("NO")
}


Measured memory_bytes: 512
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cassert>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
#include <cassert>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())

int main(){
	string s = "CODEFESTIVAL2016";
	string t; cin >> t;
	int ret = 0;
	for(int i=0;i<t.size();i++){
		ret += (s[i] != t[i]);
	}
	cout << ret << endl;
}

Measured memory_bytes: 764
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,n) for(ll i=0;i<n;i++)
#define P pair<ll,ll>
#define Graph vector<vector<ll>>
#define INF (1ll<<60)
#define mod 1000000007
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return true;} return false;}
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return true;} return false;}

int main(){
    ll h,w,k;cin>>h>>w>>k;
    ll sy,sx,gy,gx;
    cin>>sy>>sx>>gy>>gx;sy--;sx--;gy--;gx--;

    vector<vector<char>> maze(h,vector<char>(w,'.'));
    rep(i,h){
        rep(j,w){
            cin>>maze[i][j];
        }
    }

    queue<P> que;
    que.push(make_pair(sy,sx));
    vector<vector<ll>> score(h,vector<ll>(w,INF));
    score[sy][sx]=0;

    ll dy[4]={0,0,1,-1};
    ll dx[4]={1,-1,0,0};
    while(que.size()){
        P now=que.front();
        que.pop();
        ll ny=now.first,nx=now.second;

        for(ll i=ny+1;i<=ny+k;i++){//下へ
            if(i>=h) break;
            if(maze[i][nx]=='@' || score[i][nx]<=score[ny][nx]) break;
            if(score[i][nx]!=INF) continue;

            score[i][nx]=score[ny][nx]+1;
            que.push(make_pair(i,nx));
        }

        for(ll i=ny-1;i>=ny-k;i--){//上へ
            if(i<0) break;
            if(maze[i][nx]=='@' || score[i][nx]<=score[ny][nx]) break;
            if(score[i][nx]!=INF) continue;

            score[i][nx]=score[ny][nx]+1;
            que.push(make_pair(i,nx));
        }

        for(ll i=nx+1;i<=nx+k;i++){//右へ
            if(i>=w) break;
            if(maze[ny][i]=='@' || score[ny][i]<=score[ny][nx]) break;
            if(score[ny][i]!=INF) continue;

            score[ny][i]=score[ny][nx]+1;
            que.push(make_pair(ny,i));
        }

        for(ll i=nx-1;i>=nx-k;i--){//左へ
            if(i<0) break;
            if(maze[ny][i]=='@' || score[ny][i]<=score[ny][nx]) break;
            if(score[ny][i]!=INF) continue;

            score[ny][i]=score[ny][nx]+1;
            que.push(make_pair(ny,i));
        }
    }

    if(score[gy][gx]!=INF) cout<<score[gy][gx]<<endl;
    else cout<<-1<<endl;
    return 0;
}

Measured memory_bytes: 19908