akhauriyash/Code-Regression huggingface dataset:
#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 SORT(a) sort(ALL(a))
#define bit_check(bit, i) ((bit>>(i)) & 1)
#define PRINT(x) printf("%d\n",(x));
using namespace std;
typedef long long int int64;
typedef unsigned long long uint64;
template<class T> using V = vector<T>;
using I = int;
using VI = V<I>;
const int INF = 2e9;
const int64 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;}


int main(){
    int n; cin >> n;
    vector<int> a(n);
    vector<int> Int(n,0);
    int j=0;
    rep1(i , n){
        if( i%3!=0 && i%5!=0 ) { Int[j]=i; ++j; }
        else continue;
    }
    uint64 ans = 0;
    for(int i=0; Int[i]!=0 ; ++i){
        ans+=Int[i];
    } 
    cout << ans << endl;
}

Measured memory_bytes: 11112
#include <iostream>
#include <vector>
#include <string>
#include <utility>
#include <queue>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <climits>
//#include "h.h"
using namespace std;

#define ll long long
#define pint pair<int, int>
#define pll pair<ll, ll>
#define pb push_back
#define mp make_pair
#define pm(first, second) pb(mp(first, second))
#define SPACE " "
#define fpf first.first
#define fps first.second
#define spf second.first
#define sps second.second

#define all(X) (X).begin(), (X).end()

int main(){

	double N, K;
	cin >> N >> K;
	double ans = 0;
	int tmp;
	for(int i = 1; i <= N; i ++){
		tmp = 0;
		while(true){
			if(pow(2.0, (double)tmp) >= K / i)break;
			tmp += 1;
		}
		ans += 1 / N / pow(2.0, (double)tmp);
	}
	//cout << ans << endl;
	printf("%0.10lf\n", ans);

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main() {
	int n;
	cin >> n;
	for (int i = 0;; i++) {
		if ((n + i) % 111 == 0) {
			cout << n + i << endl;
			return 0;
		}
	}
}

Measured memory_bytes: 256
#!/usr/bin/env python
# coding: utf-8

# In[30]:


S = str(input())


# In[31]:


acgt = ["A", "C", "G", "T"]


# In[32]:


count = 0
ans = 0


# In[33]:


for i in range(len(S)):
    if S[i] in acgt:
        count += 1
        if ans < count:
            ans = count
    else:
        count = 0

print(ans)


# In[ ]:






Measured memory_bytes: 2940
#include <stdio.h>

int main(){
  int X,Y,Z;
  scanf("%d %d %d",&X,&Y,&Z);
  int T;
  T=X;
  X=Y;
  Y=T;
  T=Z;
  Z=X;
  X=T;
  printf("%d %d %d\n",X,Y,Z);
  return 0;
}

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

int		main(void)
{
	int n, m;

	cin >> n >> m;
	int S[n][2];
	int P[m][2];

	for (int i = 0; i < n; i++)
		cin >> S[i][0] >> S[i][1]; 
	for (int i = 0; i < m; i++)
		cin >> P[i][0] >> P[i][1]; 
	for (int i = 0; i < n; i++)
	{
		int ans = 0;
		int range = abs(S[i][0] - P[0][0]) + abs(S[i][1] - P[0][1]);

		for (int j = 1; j < m; j++)
		{
			int tmp = abs(S[i][0] - P[j][0]) + abs(S[i][1] - P[j][1]);

			if (tmp < range)
			{
				range = tmp;
				ans = j;
			}
		}
		cout << ans + 1 << endl;
	}
}


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

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

	long long* a;
	a = new long long[n];
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		if (a[i] == 0) {
			cout << 0 << endl;
			delete [] a;
			return 0;
		}
	}

	long long ans = 1;
	for (int i = 0; i < n; i++) {
		if (a[i] > 1000000000000000000 / ans) {
			ans = -1;
			break;
		}
		ans *= a[i];
	}

	cout << ans << endl;
	delete[] a;
	return 0;
}

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

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
int mod = 1000000007;
ll N, M;
int dp[6005][3005][2];
//dp[i][j][k]:i回操作終了時点で白がj個の場合
//k=1なら、それまでに白球が0個となったことがある
int main() {
    //cout.precision(10);
    cin >> N >> M;
    dp[0][0][1] = 1;
    for(int i = 1; i <= N; i++) dp[0][i][0] = 1;
    for(int time = 1; time <= M; time++) {
        for(int num = 0; num < N; num++) {
            dp[2*time-1][num][0] += dp[2*time-2][num][0];
            dp[2*time-1][num][0] %= mod;
            dp[2*time-1][num][0] += dp[2*time-2][num+1][0];
            dp[2*time-1][num][0] %= mod;
            dp[2*time-1][num][1] += dp[2*time-2][num][1];
            dp[2*time-1][num][1] %= mod;
            dp[2*time-1][num][1] += dp[2*time-2][num+1][1];
            dp[2*time-1][num][1] %= mod;
        }
        dp[2*time-1][0][1] += dp[2*time-1][0][0];
        dp[2*time-1][0][1] %= mod;
        dp[2*time-1][0][0] = 0;
        for(int i = N; i >= 1; i--) {
            dp[2*time-1][i][0] = dp[2*time-1][i-1][0] % mod;
            dp[2*time-1][i][1] = dp[2*time-1][i-1][1] % mod;
        }
        dp[2*time-1][0][0] = 0;
        dp[2*time-1][0][1] = 0;
        for(int num = 0; num <= N; num++) {
            dp[2*time][num][0] += dp[2*time-1][num][0];
            dp[2*time][num][0] %= mod;
            dp[2*time][num][0] += dp[2*time-1][num+1][0];
            dp[2*time][num][0] %= mod;
            dp[2*time][num][1] += dp[2*time-1][num][1];
            dp[2*time][num][1] %= mod;
            dp[2*time][num][1] += dp[2*time-1][num+1][1];
            dp[2*time][num][1] %= mod;
        }
        dp[2*time][0][1] += dp[2*time][0][0];
        dp[2*time][0][1] %= mod;
        dp[2*time][0][0] = 0;
        for(int num = 0; num <= N; num++) {
            dp[2*time][num][0] %= mod;
            dp[2*time][num][1] %= mod;
        }
    }
    ll ans = 0;
    for(int num = 0; num <= N; num++) {
        cerr << num << " " << dp[2*M][num][1] << endl;
        ans += dp[2*M][num][1];
        ans %= mod;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 141184
#include <iostream>
using namespace std;
void ABC150(void);
void ABC151(void);
void ABC152(void);
void ABC153(void);
void ABC154(void);
void ABC155(void);
void ABC156(void);
void ABC157(void);
void ABC158(void);
void ABC159(void);

int main(void){
    ABC155();
}

void ABC155(){
    int a,b,c,k=0;
    cin>>a>>b>>c;
    if(a==b)++k;
    if(b==c)++k;
    if(c==a)++k;
    if(k==1)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

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


int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int64_t n;
    cin >> n;
    string s;
    while (n) {
        n--;
        s += char('a' + n % 26);
        n /= 26;
    }
    reverse(s.begin(), s.end());
    cout << s << endl;
    return 0;
}



Measured memory_bytes: 3560
#include <bits/stdc++.h>
#define REP(i, a, n) for (int i = (a); i < (int)(n); ++i)
#define REPC(i, a, n) for (int i = (a); i <= (int)(n); ++i)
#define ALL(t) t.begin(), t.end()
#define RALL(t) t.rbegin(), t.rend()
#define MATINIT(type, row, col, init)                                          \
  vector<vector<type>>(row, vector<type>(col, init));
#define Yes(cond) cout << (cond ? "Yes" : "No") << endl;
#define YES(cond) cout << (cond ? "YES" : "NO") << endl;
using namespace std;
using LL = long long;
using ULL = unsigned long long;
template <class T> using VEC = std::vector<T>;
template <class T> using MAT = std::vector<std::vector<T>>;
void DUMP() { cerr << endl; }
template <class Head, class... Tail> void DUMP(Head &&head, Tail &&... tail) {
  cerr << head << ", ";
  DUMP(std::move(tail)...);
}
template <typename T> ostream &operator<<(ostream &os, vector<T> &vec) {
  os << "{";
  for (auto v : vec)
    os << v << ",";
  os << "}";
  return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, map<T1, T2> &m) {
  os << "{";
  for (auto p : m)
    os << p << ",";
  os << "}";
  return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, pair<T1, T2> p) {
  os << "[" << p.first << " " << p.second << "]";
  return os;
}

int main() {
  int n;
  cin>>n;
  VEC<LL>l(n+1);
  l[0]=2;
  l[1]=1;
  REP(i,2,n+1){
    l[i]=l[i-1]+l[i-2];
  }
  cout<<l[n]<<endl;

  return 0;
}


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

#define rep(i,N) for(int i=0;i<N;i++)
#define rep2(i,N) for(int i=1;i<=N;i++)
using namespace std;
long long  INF=1e18;
long long mod=1e9+7;

//status unsolved
int main(){
    long long  n,x,y;
    cin>>n>>x>>y;

    int path[2010][2010];

    rep(i,2010)rep(k,2010)path[i][k]=1e6;

    rep(i,n){
        rep(k,n){
            path[i][k]=abs(i-k);
        }
    }
    x--,y--;

    rep(i,n){
        rep(k,n){
            path[i][k]=min(path[i][k],path[i][x]+path[y][k]+1);
        }
    }
    /*
    rep(j,n){
        rep(i,n){
            rep(k,n){
            if(i==k)continue;
            path[i][k]=min(path[i][k],path[i][j]+path[j][k]);
            }
        }
    }
    */
    long long ans[n]={};
    for(int i=0;i<n-1;i++){
        for(int k=i+1;k<n;k++){
            ans[path[i][k]]++;
        }
    }

    rep2(i,n-1)cout<<ans[i]<<endl;

    /*
    vector<vector<int>>edge(n);

    rep(i,n-1){
    edge[i].emplace_back(i+1);
    edge[i+1].emplace_back(i);
    }
    x--,y--;
    edge[x].emplace_back(y);
    edge[y].emplace_back(x);
    */
    return 0;

}
/*
5 2 4

5
4
1
0

3 1 3

3
0

7 3 7

7
8
4
2
0
0

10 4 8

10
12
10
8
4
1
0
0
0
*/


Measured memory_bytes: 16000
n,m = map(int,input().split())
ans,a = 0,[]
for i in range(n):
    a.append(list(map(int,input().split())))
a.sort()
for i in range(n):
    x = min(m,a[i][1])
    ans+=x*a[i][0]
    m-=x
    if m==0: break
print(ans)

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

int main() {
  int N;
  string S;
  string ans = "Three";
  cin >> N;
  for (int i=0; i < N; i++) {
    cin >> S;
    if (S == "Y") {
      ans = "Four";
      break;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
// RMQ.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DSL_2_A&lang=jp

#include <iostream>

#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <queue>
#include <functional>
#include <map>
#include <string>
#include <cstdlib>
#include <cassert>


using lolo=long long;
using namespace std;
using vec=vector<lolo>;
using vvec=vector<vec>;
using vecb=vector<bool>;
#define FOR(i,n) for (lolo i=0; i<n; ++i)
#define FORN(i,a,b) for (lolo i=a; i<b; ++i)
#define REV(i,a,b) for (lolo i=a; i>b; --i)
#define ALL(x) x.begin(), x.end()



// 抽象 SegmentTree (0-indexed・一点更新・区間取得)
template <typename MonoidType>
struct SegmentTree
{
	using Function = function< MonoidType(MonoidType, MonoidType) >; // モノイドの関数

	// node, identity element
	int n;
	vector<MonoidType> node;
	MonoidType E0;

	// update / combine function
	Function upd_f, cmb_f;

	void build(int m, vector<MonoidType> v = vector<MonoidType>())
	{
		if (v != vector<MonoidType>()) m = v.size();
		n = 1; while (n < m) n *= 2;

		node = vector<MonoidType>(2 * n - 1, E0);
		if (v != vector<MonoidType>()) {
			for (int i = 0; i < m; i++) {
				node[n - 1 + i] = v[i];
			}
			for (int i = n - 2; i >= 0; i--) {
				node[i] = cmb_f(node[2 * i + 1], node[2 * i + 2]);
			}
		}
	}

	// initialize
	SegmentTree() {}
	SegmentTree(int n_, MonoidType E0_, // 単位元？
				Function upd_f_, Function cmb_f_, // 両方同じだけど
				vector<MonoidType> v = vector<MonoidType>()) :
		E0(E0_), upd_f(upd_f_), cmb_f(cmb_f_)
	{
		build(n_, v);
	}

	// update k-th element (applied value: x)
	void update(int k, MonoidType x)
	{
		k += n - 1;
		node[k] = upd_f(node[k], x);
		while (k > 0) {
			k = (k - 1) / 2;
			node[k] = cmb_f(node[2 * k + 1], node[2 * k + 2]);
		}
	}

	// range query for [a, b)
	// 非再帰のアイデア: http://d.hatena.ne.jp/komiyam/20131202/1385992406
	MonoidType query(int a, int b)
	{
		MonoidType vl = E0, vr = E0;
		for (int l = a + n, r = b + n; l < r; l >>= 1, r >>= 1) {
			if (l & 1) vl = cmb_f(vl, node[(l++) - 1]);
			if (r & 1) vr = cmb_f(node[(--r) - 1], vr);
		}
		return cmb_f(vl, vr);
	}
};



int main()
{
	lolo N, Q;
	cin >> N >> Q;
	SegmentTree<lolo> seg(N, (lolo(1) << 31 )- 1, 
						  [](lolo a, lolo b) { return b;  },
						  [](lolo a, lolo b) { return min(a, b);  });

	FOR(i, Q)
	{
		lolo com, x, y;
		cin >> com >> x >> y;

		if (com == 0) // update
		{
			seg.update(x, y);
		}
		else {
			cout << seg.query(x, y+1) << endl;
		}
		 
	}
}




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

using namespace std;

#define INF 1000000007
#define LINF (1LL << 62)
#define PI 3.14159265358979

typedef long long i64;
typedef pair<i64,i64> P;

inline i64 mod(i64 a, i64 m) { return (a % m + m) % m; }

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



int a;
void solve(){
	cin >> a;
	
	cout << PI*a*2 << endl;
}

int main(){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	int t = 1;
	//cin >> t;
	while(t--){
		solve();
	}
	
	return 0;
}

Measured memory_bytes: 3800
function Main(input) {
  input = input.split("\n");
var N = parseInt(input[0], 10);
var K = parseInt(input[1], 10);
var X = parseInt(input[2], 10);
var Y = parseInt(input[3], 10);

if( N <= K ){
console.log(N*X);
}else{
var Q = N - K;
console.log(K*X+Q*Y);
}
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 11468
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

public class Main {

	public static void main(String[] args) throws IOException {
		// TODO ?????????????????????????????????????????????
		BufferedReader sc = new BufferedReader(new InputStreamReader(System.in));
		while (true) {
			String line = sc.readLine();
			String[] lineAry = line.split(" ");
			int n = Integer.parseInt(lineAry[0]);// ???????????¬??°
			int m = Integer.parseInt(lineAry[1]);// ?¨?????????¬??°
			int a = Integer.parseInt(lineAry[2]);// ????????????????????????
			List<CrossBar> crbar = new ArrayList<>();
			if (n == 0 && m == 0 && a == 0) {
				return;
			}
			for (int i = 0; i < m; i++) {// ?¨?????????????????????????, ???????????£??????????????????????????2
				line = sc.readLine();
				lineAry = line.split(" ");
				crbar.add(new CrossBar(Integer.parseInt(lineAry[0]), Integer.parseInt(lineAry[1]),
						Integer.parseInt(lineAry[2])));
			}
			
			MyPoint mypoint = new MyPoint(a, 1002);

			while (mypoint.y > 0) {
				//System.out.println("(x, y) = (" + mypoint.x + ", " + mypoint.y + ")");
				mypoint.y--;
				for (int k = 0; k < m; k++) {
					if (crbar.get(k).y == mypoint.y && crbar.get(k).x1 == mypoint.x) {
						mypoint.setPoint(crbar.get(k).x2, mypoint.y);
						break;
					}
					if (crbar.get(k).y == mypoint.y && crbar.get(k).x2 == mypoint.x) {
						mypoint.setPoint(crbar.get(k).x1, mypoint.y);
						break;
					}
				}
			}
			System.out.println(mypoint.x);
		}
	}

	static class MyPoint {

		private int x = 0;
		private int y = 0;

		public MyPoint(int x_val, int y_val) {
			x = x_val;
			y = y_val;
		}

		public void setPoint(int x_val, int y_val) {
			x = x_val;
			y = y_val;
		}

	}

	static class CrossBar implements Comparable<Object> {

		private int x1 = 0;
		private int x2 = 0;
		private int y = 0;

		public CrossBar(int h, int p, int q) {
			y = h;
			x1 = p;
			x2 = q;
		}

		public int compareTo(Object obj) {
			// y?????????????????????
			return Integer.toString(((CrossBar) obj).y).compareTo(Integer.toString(this.y));
		}
	}

}

Measured memory_bytes: 47572
const main = input => (
    (a, b, c) => [...Array(a)]
        .map((_, i) => i + 1)
        .find(y => (b * y + c) % a == 0)
        ? 'YES' : 'NO'
)(...input.split(' ').map(x => +x));

console.log(main(require('fs').readFileSync('/dev/stdin', 'utf8')));


Measured memory_bytes: 7500
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define PI 3.14159265358979323846
#define int long long
constexpr long long INF = numeric_limits<long long>::max() / 2;
constexpr int MOD = 1000000007;
using Graph = vector<vector<int>>;


#include <random>

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

    int D;
    cin>>D;
    int c[26];
    int q[D];
    rep(i,26){
        cin>>c[i];
    }
    int s[D][26];
    rep(i,D){
        rep(j,26){
            cin>>s[i][j];
        }
    }
    int ans=0;
    map<int,int> m;
    int y=0;
    rep(i,D){

        int an=-INF;
        int x=0;
        rep(k,26){
            int a=ans;
            map<int,int> ma=m;
            a+=s[i][k];
            rep(j,26){
                if(j==k){
                    ma[k]=0;
                }else{
                    ma[j]++;
                    a-=ma[j]*c[j];
                }
            }
            if(an<a){
                x=k;
                an=a;
            }
        }
        y=x;
        ans+=s[i][y];
        rep(j,26){
            if(j==y){
                m[y]=0;
            }else{
                m[j]++;
                ans-=m[j]*c[j];
            }
        }
        y++;
        q[i]=y;
    }

    int tr=0;
    std::random_device rnd; 
    while(tr<=18000){
        int g=rnd()%26;
        int h=rnd()%26;
        tr++;
        int ansm=0;
        int r[D];
        rep(i,D){
            if(i==g){
                if(h!=q[i]){
                    r[i]=h;
                }else{
                    r[i]=rnd()%26;
                }

            }else{
                r[i]=q[i];
            }
        }
        map<int,int> mx;
        rep(i,D){
            ansm+=s[i][r[i]];
            rep(j,26){
                if(j==r[i]){
                    mx[r[i]]=0;
                }else{
                    mx[j]++;
                    ansm-=mx[j]*c[j];
                }
            }
        }
        if(ansm>ans){
            rep(i,D){
                q[i]=r[i];
            }
        }
    }
    rep(i,D){
        cout << q[i] << endl;
    }

    



}


Measured memory_bytes: 3728
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rep(i,a,b) for(int i=a;i<b;i++)
const int MAXN = 2e5+10;
int cnt[MAXN];
typedef long long ll;
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);  
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    string s;
    map<ll,ll>map1;
    ll n;cin>>n;
    string arr[4]={"AC","WA","TLE","RE"};
    rep(i,0,n){
        cin>>s;
        if(s=="AC")
        map1[0]++;
        if(s=="WA")
        map1[1]++;
        if(s=="TLE")
        map1[2]++;
        if(s=="RE")
        map1[3]++;
    }
    for(int i=0;i<4;i++){
        cout<<arr[i]<<" "<<"x"<<" "<<map1[i]<<endl;
    }
    return 0;
}


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

int main(){
    string str;
    cin>>str;
    if(str[0]==str[1]&&str[1]==str[2]&&str[0]==str[1]){
        cout<<"No"<<endl;
        return 0;
    }
    cout<<"Yes"<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long int
#define F(i,j,k,in) for(int i=j;i<k;i+=in)
#define DF(i,j,k,in) for(int i=j;i>=k;i-=in)
#define feach(it,l) for (auto it = l.begin(); it != l.end(); ++it)
#define fall(a) a.begin(),a.end()
#define pb push_back
#define ub upper_bound
#define lb lower_bound
#define eq equal_range
#define fs first
#define ss second
#define ins insert
#define mkp make_pair
#define endl "\n"
using namespace std;
typedef vector<ll> vll;
typedef vector<int> vin;
typedef vector<char> vch;
typedef vector<string> vst;
typedef vector<vector<ll>> vvll;
typedef vector<vector<int>> vvin;
typedef vector<pair<ll,ll>> vpll;
typedef vector<pair<int,int>> vpin;
typedef set<ll> sll;
typedef set<int> sint;
typedef set<char> sch;
typedef set<string> sst;
typedef queue<ll> qll;
typedef priority_queue<ll> pqll;
typedef queue<int> qin;
typedef priority_queue<int> pqin;
typedef map<ll,ll> mpll;
typedef map<int,int> mpin;
typedef pair<ll,ll> pll;
typedef pair<int,int> pin;
const ll MOD=1000000007;
const long double PI=3.1415926535897932384626433832795;
ll pwr(ll b,ll p){ll res=1;while(p){if(p&1) {res*=b; p--;}else{b*=b; p>>=1;}}return res;}
int main()
{
ios_base::sync_with_stdio(false) , cin.tie(NULL) , cout.tie(NULL);
int n;
cin>>n;
vin A (n+1);
F (i,1,n+1,1) cin>>A[i];
cout<<A[n]<<" ";
DF (i,n-2,1,2) cout<<A[i]<<" ";
if (n&1) F (i,2,n+1,2) cout<<A[i]<<" ";
  else F (i,1,n+1,2) cout<<A[i]<<" ";
return 0;
}




Measured memory_bytes: 4000
c = []
for i in 0..2
    c[i] = gets.strip.split.map(&:to_i)
end

a_1 = 0
b_1 = c[0][0]
b_2 = c[0][1]
b_3 = c[0][2]
a_2 = c[1][0]-b_1
a_3 = c[2][0]-b_1

if a_2+b_2 == c[1][1] && a_2+b_3 == c[1][2] && a_3+b_2 == c[2][1] && a_3+b_3 == c[2][2]

    puts 'Yes'

else

    puts 'No'

end

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

using namespace std;
typedef long long ll;

#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, a, b) for (int i = (a); i < (b); ++i)
#define all(a) (a).begin(), (a).end()
#define all2(a, b) (a).begin(), (a).begin() + (b)
#define debug(vari) cerr << #vari << " = " << (vari) << endl;

int main()
{
    int n, x;
    cin >> n >> x;
    vector<int> m(n);
    rep(i, n) cin >> m[i];

    int sum = 0, mi = 1001001001;
    rep(i, n)
    {
        sum += m[i];
        mi = min(mi, m[i]);
    }

    cout << (x - sum) / mi + n << endl;

    return 0;
}


Measured memory_bytes: 3632
#include <iostream>
#include <algorithm>

using namespace std;

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

    int T, A;
    long long t_min = 1, a_min = 1, ans;
    for (int i = 0; i < N; i++) {
    	cin >> T >> A;

    	long long n = max((t_min - 1) / T, (a_min - 1) / A) + 1;
        t_min = T * n;
        a_min = A * n;
    }

    ans = t_min + a_min;

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll int64_t
#define ALL(a)  (a).begin(),(a).end()
 
const ll mod = 1000000007;
const ll LINF = 1e13;
const ll LLINF = 1e18;
const ll ALPHABET = 26;
 
template <class T>
void Swap(T& r, T& l) {
  T tmp = r;
  r = l;
  l = tmp;
}
 
template<typename T>
istream& operator >> (istream& is, vector<T>& vec) {
  for (T& x : vec) is >> x; //for(int i=0; i<vec.size(); i++) is >> x[i]; とかでもいい
  return is;
}


int main(){
  ll k,x;

  cin >> k >> x;


  bool ans = 500 * k >= x;

  cout << ((ans==true)?"Yes":"No");


}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int x,n,temp,flag=0;
    set<int> se;
    set<int>::iterator it1,it2,itt;
    cin>>x>>n;
    while(n--)
    {
        cin>>temp;
        se.insert(temp);
        if(temp==x)
        {
            //cout<<"flag";
            flag=1;
            //cout<<flag<<endl;
        }
    }
    if(flag==0)
    {
        cout<<x;
        return 0;
    }
    else
    {
        int x1=x,x2=x;
        while(x!=102)
        {
            x1--;
            //cout<<"x1"<<x1<<endl;
            itt=se.find(x1);
            if(itt==se.end())
            {
                cout<<x1;
                break;
            }
            x2++;
            //cout<<"x2"<<x2<<endl;
            itt=se.find(x2);
            if(itt==se.end())
            {
                cout<<x2;
                break;
            }

        }
    }
    return 0;
}


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

#define pb push_back
#define ppp pop_back
#define fi first
#define se second
#define pii pair<int,int>

const ll p = 1e9 + 7;

struct matrix {
	int size;
	vector<vector<ll>> A;
	matrix(int size_, bool identity = 0) {
		size = size_;
		A = vector<vector<ll>> (size, vector<ll>(size));
		if (identity) {
			for (int i=0; i<size; i++) {
				for (int j=0; j<size; j++) {
					if (i == j) A[i][j] = 1;
					else A[i][j] = 0;
				}
			}
		}
	}
};

void add(ll &a, ll b) {
	a += b;
	if (a >= p) a -= p;
}

matrix mult(matrix a, matrix b) {
	int n = a.size;
	matrix res = matrix(n);
	for (int i=0; i<n; i++) {
		for (int j=0; j<n; j++) {
			res.A[i][j] = 0;
			for (int k=0; k<n; k++) {
				add(res.A[i][j], (a.A[i][k] * b.A[k][j]) % p);
			}
		}
	}
	return res;
}

void print(matrix a) {
    int n = a.size;
    for (int i=0; i<n; i++) {
        for (int j=0; j<n; j++) {
            cout << a.A[i][j] << " ";
        }
        cout << endl;
    }
}

matrix binpow(matrix a, ll b) {
	matrix res = matrix(a.size, 1);
	while (b) {
		if (b & 1) res = mult(res, a);
		b >>= 1;
		a = mult(a, a);
	}
	return res;
}

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
#endif
    int n;
	ll k;
	cin >> n >> k;
	matrix a = matrix(n);
	for (int i=0; i<n; i++) {
        for (int j=0; j<n; j++) {
            cin >> a.A[i][j];
        }
	}
	matrix b = binpow(a, k);
	ll sum = 0;
	for (int i=0; i<n; i++) {
		for (int j=0; j<n; j++) {
			add(sum, b.A[i][j]);
		}
	}
	cout << sum << "\n";
	return 0;
}


Measured memory_bytes: 384
#include <iostream>
using namespace std;
int main(void){
    int N,K,i,i2,x,y,color,flag;//????????????????????? 2?????? 3??????
    cin>>N>>K;
    for(i=0;i<K;i++){
        cin>>x>>y;
        //N?????¶??°????\???°?????£?????´???????????????????????§N?????????????????????????????????????????°???????????????
        if(N%2==0){
            if(x<=N/2)flag=1;
            else flag=0;
        }
        else{
            if(x<=(N/2+1))flag=1;
            else flag=0;
        }
        //?????????????????°????????¨??????x????????????????±??????????
        if(flag==1){
            color=x%3;
            if(color==0)color=3;
        }
        else{
            x=((N-x)+1);
            color=x%3;
            if(color==0)color=3;
        }
        //y?????????????????\??£?????????????????§??????
        if(x-1<y&&y<N-(x-2))cout<<color<<endl;//??\??£????????????xc?????????????????????
        else {
            //??\??£??????????????£?????´???y???????????°???????????????
            if(N%2==0){
                if(y<=N/2)flag=1;
                else flag=0;
            }
            else{
                if(y<=(N/2+1))flag=1;
                else flag=0;
            }
            //?????????????????°????????¨??????y????????????????±??????????
            if(flag==1){
                color=y%3;
                if(color==0)color=3;
            }
            else{
                y=((N-y)+1);
                color=y%3;
                if(color==0)color=3;
            }
            cout<<color<<endl;
        }
    }
}

Measured memory_bytes: 3100
import Foundation

#if swift(>=4.0)
extension String {
    func split(by separator: String) -> [String] {
        return self.components(separatedBy: separator)
    }
    func toArray() -> [String] {
        return self.map{String($0)}
    }
}
func exponentiate(_ lhs: Int, _ rhs: Int) -> Int {
    return (0..<rhs).reduce(1){i,_ in i*lhs}
}
#else
extension String {
    func split(by separator: String) -> [String] {
        return self.componentsSeparatedByString(separator)
    }
    var count: Int {
        return self.characters.count
    }
    func toArray() -> [String] {
        return self.characters.map{String($0)}
    }
    func uppercased() -> String {
        return self.uppercaseString
    }
    func lowercased() -> String {
        return self.lowercaseString
    }
}
//extension Array where Element == String {
//    func joined(separator separator: String) -> String {
//        return self.joinWithSeparator(separator)
//    }
//}
extension Array where Element: Comparable {
    func max() -> Element? {
        return self.maxElement()
    }
    func min() -> Element? {
        return self.minElement()
    }
    func sorted() -> Array {
        return self.sort()
    }
    func reversed() -> Array {
        return self.reverse()
    }
//    func enumerated() -> [(Int, Element)] {
//        return self.enumerate()
//    }
    mutating func sort() {
        self.sortInPlace()
    }
}
extension Array {
    init(repeating: Element, count: Int) {
        self.init(count: count, repeatedValue: repeating)
    }
}
func stride<T: Strideable>(from start: T, to end: T, by stride: T.Stride) -> StrideTo<T> {
    return start.stride(to: end, by: stride)
}
func exponentiate(lhs: Int, _ rhs: Int) -> Int {
    return (0..<rhs).reduce(1){i,_ in i*lhs}
}
#endif
func readInt() -> Int? {
    return Int(readLine()!)
}
func readStringSplit(by separator: String) -> [String] {
    return readLine()!.split(by: separator)
}
func readIntSplit(by separator: String) -> [Int] {
    return readLine()!.split(by: separator).map{Int($0)!}
}

/*************** テストスペース ***************/

//func gcd(x: Int, _ y: Int) -> Int {
//    if y == 0 {
//        return x
//    } else {
//        return gcd(y, x%y)
//    }
//}

/*************** メインプログラム ***************/

let input = readIntSplit(by: " ")
let (R, G, B, N) = (input[0], input[1], input[2], input[3])
var ans = 0
for i in 0...N {
    for j in 0...N {
        let tmp = N - (i*R + j*G)
        if (tmp >= 0) && (tmp % B == 0) {
            ans += 1
        }
    }
}
print(ans)


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


int main(void)
{
    int ok = 0;
    char S[1000001];
    char temp[1024];
    char *p;

    scanf("%s", S);
    p = S;
    while(*p != '\0'){
        if(strlen(p) >= 5){
            strncpy(temp, p, 5);
            temp[5] = '\0';
        }else{
            break;
        }

        if(strcmp(temp, "dream") != 0 && strcmp(temp, "erase") != 0){
            break;
        }

        p += 5;

        if(p[0] == 'e' && p[1] == 'r' && p[2] != 'a'){
            p += 2;
        }else if(p[0] == 'r'){
            p += 1;
        }
    }

    if(*p == '\0'){
        printf("YES\n");
    }else{
        printf("NO\n");
    }

    return 0;
}


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

using namespace std;

#define FOR(i, a, b)   for(int i = (a); i < (b); i++)
#define RFOR(i, a, b)  for(int i = (a); i > (b); i--)
#define rep(i, n)	   for(int i = 0; i < (n); i++)
#define all(c)		   begin(c), end(c)
#define rall(c)		   rbegin(c), rend(c)
#define foritr(itr, c) for(auto itr = begin(c); itr != end(c); itr++)
#define SZ(a)		   ((ll) a.size())

typedef long long int		   ll;
typedef long long unsigned int llu;

void solve(string O, string E) {
	string ans;
	if(SZ(O) == SZ(E)) {
		rep(i, SZ(O)) {
			ans.push_back(O[i]);
			ans.push_back(E[i]);
		}
	}
	else {
		rep(i, SZ(E)) {
			ans.push_back(O[i]);
			ans.push_back(E[i]);
		}
		ans.push_back(O[SZ(O) - 1]);
	}
	cout << ans;
}

int main() {
	string E;
	string O;
	cin >> O;
	cin >> E;
	solve(O, E);
	return 0;
}


Measured memory_bytes: 256
import java.util.*;
import static java.lang.Math.*;
import static java.util.Arrays.*;

public class Main {

	int INF = 1 << 28;

	void run() {
		Scanner sc = new Scanner(System.in);
		for(;;) {
			int k = sc.nextInt();
			if(k==0) break;
			int n = k*(k-1)/2;
			int sum = 0;
			for(int i=0;i<n;i++) sum += sc.nextInt();
			sum/=k-1;
			System.out.println(sum);
		}
	}

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

	void debug(Object... os) {
		System.err.println(Arrays.deepToString(os));
	}
}

Measured memory_bytes: 12000
import collections

N, X, Y = map(int, input().split())

distance_list = []

for i in range(1, N + 1):
    
    for j in range(i + 1, N + 1):
        
        dis_xy = abs(i - X) + 1 + abs(j - Y)
        dis = min(j - i, dis_xy)
        
        distance_list.append(dis)

count = collections.Counter(distance_list)


for i in range(1, N):
    cnt = count[i]
    print(cnt)


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

int main() {
    ll n;
    cin >> n;
    ll x = 0, y = 0;
    for (ll i = 1; i <= sqrt(n); i++) {
        if (n%i == 0) {
            x = i;
            y = n/i;
        }
    }
    ll ans = x-1 + y-1;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3684
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll GCD(ll x,ll y){
    if(y == 0) return x;
    else return GCD(y,x%y);
}

int main() {
    int a,b,c;
    cin >> a >> b >> c;
    if(a+b >= c){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}



Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.IO;

class Program
{
    static void Main()
    {
        long n, W;

        string[] Input = Console.ReadLine().Split(' ');
        n = long.Parse(Input[0]);
        W = long.Parse(Input[1]);

        long[] weight = new long[110];
        long[] value = new long[110];

        for (long i = 0; i < n; i++)
        {
            string[] Input2 = Console.ReadLine().Split(' ');
            weight[i] = long.Parse(Input2[0]);
            value[i] = long.Parse(Input2[1]);
        }

        //DPテーブル
        long[,] dp = new long[110, 100100];

        for (long w = 0; w <= W; w++)
        {
            dp[0, w] = 0;
        }

        //DPループ
        for (long i = 0; i < n; i++)
        {
            for (long w = 0; w <= W; w++)
            {
                if (w >= weight[i])
                {
                    dp[i + 1, w] = max(dp[i, w - weight[i]] + value[i], dp[i, w]);
                }
                else
                {
                    dp[i + 1, w] = dp[i, w];
                }
            }
        }
        Console.WriteLine(dp[n, W]);
    }

    static long max(long a, long b)
    {
        return a > b ? a : b;
    }

}

Measured memory_bytes: 92768
#include <iostream>
#include <string>
#include <vector>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
using namespace std;

int main ()
{
	const int m = 55555 + 1;
	vector<bool> isPrime(m);
	isPrime[0] = false;
	isPrime[1] = false;
	for (int i=2; i<m; ++i) isPrime[i] = true;

	int n;
	cin >> n;

	int count = 0;
	for (int i=2; i<m; ++i)
	{
		if (!isPrime[i]) continue;

		if (1 == i % 5)
		{
			++count;

			if (1 < count) cout << " ";
			cout << i;

			if (n == count) break;
		}

		for (int j=2*i; j<m; j+=i)
			isPrime[j] = false;
	}
	cout << endl;

	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO ?????????????????????????????????????????????
		Scanner sc = new Scanner(System.in);

		String line1 = sc.nextLine();
		int n = Integer.parseInt(line1);
		
		String line2 = sc.nextLine();
		String[] kari2 = line2.split(" ");
		int[] S = new int[n];
		for (int i = 0; i < n; i++) {
			S[i] = Integer.parseInt(kari2[i]);
		}
		
		String line3 = sc.nextLine();
		int q = Integer.parseInt(line3);
		
		String line4 = sc.nextLine();
		String[] kari4 = line4.split(" ");
		int[] T = new int[q];
		for (int i = 0; i < q; i++) {
			T[i] = Integer.parseInt(kari4[i]);
		}
		
		int C = 0;
		
		for (int i = 0; i < q; i++) {
			for (int j = 0; j < n; j++) {
				if (T[i] == S[j]) {
					C++;
					break;
				}
			}
			
		}
		
		System.out.println(C);

	}

}

Measured memory_bytes: 29872
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;

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

    public void solve() {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int N = scan.nextInt();
        int K = scan.nextInt();
        int len = 0;
        while(0 < N) {
            N /= K;
            len += 1;
        }
        System.out.println(len);
    }
}


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

int main() {
  int N;
  cin >> N;
  
  vector<int> d(N);
  for (int i = 0; i < N; i++) {
    cin >> d[i];  
  }
  
  int count = 0;
  while (!d.empty()) {
  	// 最後を取得して削除
	int v = d.back();
    d.pop_back();
 
    // 残りから同じものを探し削除
    d.erase(
      remove_if(
        d.begin(),
        d.end(),
        [&v](auto& element){return element == v;}
      ),
      d.end()
    );
    // 検討済みリストに追加 => 追加の代わりに検討した回数を利用した
    count++;
  }
  
  cout << count << endl;
}


Measured memory_bytes: 3636
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
using namespace std;
vector<int> ivec1,ivec2;
int n,q,a;
bool binarySearch(vector<int> &v,int key){
	int left=0,right=n,mid;
	while(left<right){
		mid=(left+right)>>1;
		if(key < v[mid]) right=mid;
		else left=mid+1;
	}
	left--;
	if(left>=0 && v[left]==key){
		return true;
	}
	else return false;
}
int main()
{
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		scanf("%d",&a);
		ivec1.push_back(a);
	}
	scanf("%d",&q);
	for(int i=0;i<q;i++){
		scanf("%d",&a);
		ivec2.push_back(a);
	}
	sort(ivec1.begin(),ivec1.end());
	int sum=0;
	for(int i=0;i<q;i++){
		if(binarySearch(ivec1,ivec2[i])) sum++;
	}
	printf("%d\n",sum);
	return 0;
}



Measured memory_bytes: 3516
#include <iostream>
#include <vector>
#include <cstdio>
#include <algorithm>
#include <set>
#include <map>
#include <cassert>
#include <numeric>
#include <string>
#include <cstring>
#include <cmath>
using namespace std;

#ifdef LOCAL
	#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
	#define eprintf(...) 42
#endif

typedef long long int int64;


const int N = 1005;
char s[N], t[N], str[N];


int main(int,  char **)
{
#ifdef LOCAL
	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);
#endif

    int n;
    scanf("%d", &n);
    scanf("%s%s", s, t);

    for (int i = n; i <= 2 * n; i++)
    {
        for (int j = 0; j < n; j++)
            str[j] = s[j];
        bool bad = false;
        for (int j = 0; j < n; j++)
            if (i - 1 - j < n && str[i - 1 - j] != t[n - 1 - j])
                bad = true;
        if (!bad)
        {
            printf("%d\n", i);
            return 0;
        }
    }
    throw;




	return 0;
}




Measured memory_bytes: 256
#include<iostream>

using namespace std;


int main() {
	unsigned long long n, m,r,tempn,tempm;
	while (cin >> n >> m) {
		tempn = n, tempm = m;
		if (n < m) { int t = n; n = m; m = t; }
		while (m) {
			r= n % m;
			n = m;
			m = r;
		}
		cout << n << ' ';
		int i;
		for (i = 1; (i*tempn) % tempm != 0; ++i);
			cout << tempn * i << endl;

	}
	return 0;
}


Measured memory_bytes: 2984
#include <iostream>
#include <cmath>
long long result(long long A,long long B){
    return A*A*A*A*A - B*B*B*B*B;
}

using namespace std;
int main(){
    long long A,B,X,ansA=-64,ansB=-64;
    bool ansFound = false;
    cin >> X;
    for(A=0;A<65;A++){
        for(B=-64;B<=0;B++){
            if(result(A,B) == X){
                ansA=A;
                ansB=B;
                ansFound = true;
                break;
            }
        }
        if(ansFound)break;
    }
    A = 34;
    B = 34;
    while(!ansFound){
        while(result(A,B)<=X){
            A++;
            if(result(A,B) == X){
                ansA=A;
                ansB=B;
                ansFound = true;
                break;
            }
        }
        A--;
        B++;
    }
    cout << ansA << " " << ansB << '\n';
    return 0;
}

Measured memory_bytes: 3580
#include<bits/stdc++.h>
using namespace std;
int n,ans;
char c[200005];
int main()
{
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		cin>>c[i];
		ans+=c[i]=='W';
	}
	int t=ans;
	for(int i=n;i>n-t;i--)
		if(c[i]=='W')
			ans--;
	cout<<ans<<endl;
	return 0;
}

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

namespace DDCC2020C3
{
    class Program
    {
        static void Main(string[] args)
        {
            //読み込み
            var hwk = Console.ReadLine().Split().Select(int.Parse).ToArray();
            var h = hwk[0];
            var w = hwk[1];
            var k = hwk[2];

            var map = Enumerable.Repeat(0, h).Select(x => Console.ReadLine()).ToArray();
            var res = Enumerable.Repeat(0, h).Select(x => new int[w]).ToArray();


            int[] firsrtArr = null;
            int[] curArr = null;
            int id = 0;

            for (int i = 0; i < h; i++)
            {
                if (!map[i].Contains('#'))
                {
                    res[i] = curArr;
                    continue;
                }

                bool isFirst = true;
                id++;
                for (int j = 0; j < w; j++)
                {
                    if (map[i][j] == '#')
                    {
                        if (isFirst) isFirst = false;
                        else id++;
                    }
                    res[i][j] = id;
                }

                if (firsrtArr == null) firsrtArr = res[i];
                curArr = res[i];
            }

            for (int i = 0; i < h; i++)
            {
                if (res[i] != null) break;
                res[i] = firsrtArr;
            }
            
            Console.WriteLine(string.Join("\n", res.Select(x => string.Join(" ", x))));
            Console.ReadKey();
        }
    }
}


Measured memory_bytes: 21596
#include<bits/stdc++.h>
#define MAXN 10000

using namespace std;
typedef long long ll;

int main()
{
	//freopen("t.txt","r",stdin);
	int n, a[50];
	cin>>n;
	for (int i=1;i<=n;i++) cin>>a[i];
	
	int d=0;
	for (int i=2;i<=n-1;i++){
		if ( ( a[i] > a[i-1] && a[i] < a[i+1]  ) ||
				( a[i] < a[i-1] && a[i] >a[i+1]  ) ) {
					d++;
				}
	}
	
	cout<<d;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
inline int read() {
	int x = 0; char c = getchar();
	while(!isdigit(c)) c = getchar();
	while(isdigit(c)) x = x * 10 + c - '0', c = getchar();
	return x;
}
int n, ans, cnt;
int a[105];
int main() {
	n = read();
	for(int i = 1; i <= n; ++i) {
		a[i] = read();
		if(a[i] == a[i - 1]) ++cnt;
		else {
			ans += cnt >> 1;
			cnt = 1;
		}
	}
	printf("%d\n", ans + (cnt >> 1));
	return 0;
}

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

int main() {
  int n, d;
  cin >> n >> d;
  
  for (int i=1; i<n; i++) {
  	if ((2*d+1)*i>=n) {
      cout << i << endl;
      return 0;
    }
  }
  cout << 1 << endl;
  return 0;
  
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <string.h>
#include <iomanip>
using namespace std;
int main(){
    int A,B,H,M;
    cin >> A >> B >> H >> M;
    double hd,md,d,cosd,ans;
    double pi = 3.14159265358979323846;
    hd = 30 * H + 0.5 * M;
    md = 6 * M;
    d = (hd > md) ? hd - md : md - hd;
    cosd = cos(d * (pi / 180));
    ans = A * A + B * B - 2 * A * B * cosd;
    ans = sqrt(ans);
    cout << fixed << setprecision(15) << ans << endl;
    return 0;
}

Measured memory_bytes: 4076
import math
a,b = list(map(int, input().split()))

xs = []
for i in range(a):
    x = list(map(int, input().split()))
    xs.append(x)
ans = 0
for i in range(a):
    for j in range(a):
        if(i>=j):
            continue
        dist = 0
        for k in range(b):
            dist+= (xs[i][k]-xs[j][k])**2
        dist = math.sqrt(dist)
        if(dist%1==0):
            ans +=1
            
print(ans)

Measured memory_bytes: 3064
K = int(input())
S = input()
L = len(S)
MOD = 10**9+7

MAXN = L+K+5
fac = [1,1] + [0]*MAXN
finv = [1,1] + [0]*MAXN
inv = [0,1] + [0]*MAXN
for i in range(2,MAXN+2):
    fac[i] = fac[i-1] * i % MOD
    inv[i] = -inv[MOD%i] * (MOD // i) % MOD
    finv[i] = finv[i-1] * inv[i] % MOD

def comb(n,r):
    if n < r: return 0
    if n < 0 or r < 0: return 0
    return fac[n] * (finv[r] * finv[n-r] % MOD) % MOD

ans = 0
for i in range(K+1):
    ans += comb(L-1+K-i, L-1) * pow(25,K-i,MOD) * pow(26,i,MOD)
    ans %= MOD
print(ans)

Measured memory_bytes: 149120
#include<bits/stdc++.h>
using namespace std;
const int maxn=1e5+50;
typedef long long ll;

int n;
char s[maxn];

int main(){
    while(scanf("%d",&n)==1){
        scanf("%s",s);
        int ans=unique(s,s+n)-s;
        printf("%d\n",ans);
    }
    return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
 
#define pb push_back
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define ll long long
 
const int N=1e6+5,MAX=3e7,MOD=1e9+7;
 
using namespace std;
 
int n,m,a,b;
std::vector<int> wa;
std::vector<int> g[N];
int in[N];
int memo[N];
int solve(int u){

	 if(sz(g[u])==0)return 0;
     
     int &ret = memo[u];

     if (ret!=-1)return ret;

	 for(auto v : g[u]){
         
          ret = max(ret , 1+solve(v));
	 }

	 return ret;
}
int main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    //#ifndef ONLINE_JUDGE
      //freopen("test.txt","r",stdin);
    //#endif
    
    scanf("%d %d",&n,&m);

    for(int i=0;i<m;i++){

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

    	  g[a].pb(b);
    	  in[b]++;
    }

    for(int i=1;i<=n;i++){

    	 if(in[i]==0)wa.pb(i);
    }

    memset(memo,-1,sizeof(memo));

    int ans = 0;

    for(auto u : wa){
    	 ans = max(ans , solve(u));
    }

    printf("%d\n",ans );

   
     
}

Measured memory_bytes: 37760
n,m = map(int,input().split())
h = list(map(int,input().split()))

A = [0 for _ in range(m)]
B = [0 for _ in range(m)]
H = [0 for _ in range(n)]

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

c = 0
for i in range(n):
    if(H[i] < h[i]):c += 1
print(c)

Measured memory_bytes: 20132
#include<bits/stdc++.h>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<algorithm>
using namespace std;

int main(){
    int mod=1000000007;
    char s[51];
    int n;
    for (;;) {
        scanf("%d",&n);
        if (n==0) break;

        int ans[n][n];
        for (int i=0;i<n;++i) {
            for (int j=0;j<n;++j) {
                ans[i][j]=-1;
            }
        }

        int x=n/2, y=n/2+1;
        for (int i=1;i<=n*n;++i) {
            ans[y][x]=i;
            y=(y+1)%n;
            x=(x+1)%n;
            if (ans[y][x]!=-1) {
                y=(y+1)%n;
                x=(x+n-1)%n;
            }
        }
        for (int i=0;i<n;++i){
            for (int j=0;j<n;++j) {
                if (j<n-1) {
                    printf("%4d",ans[i][j]);
                } else {
                    printf("%4d\n",ans[i][j]);
                }
            }
        }
    }
    return 0;
}

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

pyi = [[] for i in range(n)]

for i in range(m):
    p, y = map(int, input().split())
    pyi[p - 1].append((y, i))

ans = []

for p in range(n):
    pyi[p].sort()
    for j in range(len(pyi[p])):
        y, i = pyi[p][j]
        ans.append((i, str(p + 1).zfill(6) + str(j + 1).zfill(6)))

ans.sort()
for a in ans:
    print(a[1])

Measured memory_bytes: 42320
N, M = map(int, input().split())
edge = [set() for i in range(N)]
l = []
for i in range(M):
  a, b = map(int, input().split())
  edge[a-1].add(b-1)
  edge[b-1].add(a-1)
  l.append((a-1, b-1))

ans = M

for i in range(M):
  used = [False] * N
  a, b = l[i]
  edge[a].discard(b)
  edge[b].discard(a)

  stack = [0]
  while stack:
    prev = stack.pop()
    if used[prev]: continue

    used[prev] = True
    for to in edge[prev]:
      stack.append(to)
  
  if all(used): ans -= 1

  edge[a].add(b)
  edge[b].add(a)

print(ans)

Measured memory_bytes: 3064
#include <iostream>

int main()
{
    int D, N;
    std::cin >> D >> N;

    int a = 1;
    for (int i = 0; i < D; i++) {
        a *= 100;
    }

    if (N == 100) N = 101;

    std::cout << a * N << std::endl;

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <queue>
using namespace std;

typedef long long ll;

priority_queue<ll> pq;

int main(void)
{
	ll n, m, i, a, ans = 0;

	scanf("%lld %lld" ,&n, &m);
	for (i = 0; i < n; i++)
	{
		scanf("%lld" ,&a);
		pq.push(a);
	}

	for (i = 0; i < m; i++)
	{
		ll num = pq.top(); pq.pop();
		pq.push(num / 2);
	}

	while (!pq.empty())
	{
		ans += pq.top();
		pq.pop();
	}

	printf("%lld" ,ans);
	return 0;
}

Measured memory_bytes: 1400
N, K = map(int, input().split())

A = [0] * N

for i in range(K):
    d = int(input())
    a = list(map(int, input().split()))
    for j in range(len(a)):
        A[a[j]-1] += 1

ans = 0
for i in range(len(A)):
    if A[i] == 0:
        ans += 1

print(ans)

Measured memory_bytes: 9196
#include<stdio.h>

int main(void){
  char S[7];
  scanf("%s", S);
  if(S[0] == 'S'){
    printf("Cloudy\n");
  }
  else if(S[0] == 'C'){
    printf("Rainy\n");
  }
  else{
    printf("Sunny\n");
  }

  return 0;

}


Measured memory_bytes: 128