akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define rrep(i,n) for (int i = n-1; i >= 0; i--)
#define rep2(i,s,n) for (int i = s; i < n; ++i)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define tmax(a,b,c) max(a,max(b,c))
#define tmin(a,b,c) min(a,min(b,c))
#define pb push_back
#define eb emplace_back
#define vi vector<int>
#define vvi vector<vector<int>>
#define vl vector<ll>
#define vs vector<string>
#define vc vector<char>
#define vb vector<bool>
#define vp vector<P>
using namespace std;
using ll = long long;
using P = pair<int,int>;
using LP = pair<ll,ll>;
template<class T> istream& operator>>(istream& is,vector<T>& v) { for(T& t:v){is>>t;} return is; }
template<class T> ostream& operator<<(ostream& os,const vector<T>& v) { for(T t:v){os<<t<<" ";} os<<"\n"; return os; }
void Yes(bool b) { cout << (b ? "Yes" : "No") << endl; }
void YES(bool b) { cout << (b ? "YES" : "NO") << endl; }
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;}
const int inf = 1001001001;
const ll linf = 1001001001001001001;

const int mod = 1000000007;
struct mint {
  ll x;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) { if ((x += a.x) >= mod) x -= mod; return *this;}
  mint& operator++() { x += 1; return *this;}
  mint& operator-=(const mint a) { if ((x += mod-a.x) >= mod) x -= mod; return *this; }
  mint& operator--() { x -= 1; return *this;}
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this; }
  mint operator+(const mint a) const { mint res(*this); return res+=a; }
  mint operator-(const mint a) const { mint res(*this); return res-=a; }
  mint operator*(const mint a) const { mint res(*this); return res*=a; }
  bool operator==(const int n) const { mint a(n); return this->x == a.x; }
  bool operator==(const ll n) const { mint a(n); return this->x == a.x; }
  bool operator!=(const int n) const { mint a(n); return this->x != a.x; }
  bool operator!=(const ll n) const { mint a(n); return this->x != a.x; }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }
  // for prime mod
  mint inv() const { return pow(mod-2); }
  mint& operator/=(const mint a) { return (*this) *= a.inv(); }
  mint operator/(const mint a) const { mint res(*this); return res/=a; }
};
istream& operator>>(istream& is,const mint& m) { return is >> m.x; }
ostream& operator<<(ostream& os,const mint& m) { return os << m.x; }

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr); cout.tie(nullptr);
    int n,k;
    cin >> n >> k;
    mint ans = 0;
    rep2(i,k,n+2) {
        mint mn = mint(i)*mint(i-1)/mint(2);
        mint mx = (mint(n-i+1)+mint(n))*mint(i)/mint(2);
        ans += mx-mn+1;
    }
    cout << ans << endl;
}


Measured memory_bytes: 3640
#include <iostream>

using namespace std;

int main(int argc, const char *argv[])
{
  int a, b;
  cin >> a >> b;
  if (a >= 13) {
    cout << b;
  } else if (a >= 6 && a <= 12) {
    cout << b / 2 << "\n";
  } else {
    cout << "0\n";
  }
  
  return 0;
}

Measured memory_bytes: 256
N = gets.to_i
S = gets.chomp

ew = we = 0
N.times do |i|
  we += 1 if S[i] == 'E'
end

ans = 1000000
N.times do |i|
  we -= 1 if S[i] == 'E'
  ans = [ans, ew + we].min
  ew += 1 if S[i] == 'W'
end

puts ans


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

const int N = 1e5 + 5;
int n, h[N], dp[N];

int main() {
  ios_base::sync_with_stdio(0), cin.tie(0);
  cin >> n;
  for(int i = 1; i <= n; i++) cin >> h[i];
  memset(dp, 63, sizeof dp);
  dp[1] = 0;
  for(int i = 1; i <= n; i++) {
    if(i+1 <= n) dp[i+1] = min(dp[i+1], dp[i] + abs(h[i+1] - h[i]));
    if(i+2 <= n) dp[i+2] = min(dp[i+2], dp[i] + abs(h[i+2] - h[i]));
  }
  cout << dp[n] << "\n";
} 


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define MOD (int) (1e9+7)
#define INF (int) 2e9
#define LLINF (ll) 2e18

int main(){
    int n, m;
    cin >> n >> m;
    int a[n];
    int sum = 0;
    rep(i, n){
        cin >> a[i];
        sum += a[i];
    }

    sort(a, a+n, greater<>());

    if(a[m-1]*4*m >= sum){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }

    // printf("%d\n", N);
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(){
  long total;
  total=0;
  int N,i;
  scanf("%d",&N);
  for(i=1;i<N+1;i++){
    if(i%3!=0 && i%5!=0){
      total+=i;
    }
  }
  printf("%ld\n",total);
  return 0;
}

Measured memory_bytes: 1732
#include <bits/stdc++.h>
using namespace std;
#define rep(i, c) for (int i = 0; i < (int)c; i++)
int main()
{
	int n;
	scanf("%d", &n);
	vector<int> a(n);
	rep(i, n) scanf("%d", &a[i]);
	int ans = 0;
	rep(i, n - 1)
	{
		if (a[i] == a[i + 1])
		{
			a[i + 1] = -1;
			ans++;
		}
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 3720
fun main(args: Array<String>) {
    val m = readLine()!!.split(' ').map { it.toInt() }[1]
    val list = (1..m).map {
        val (a, b) = readLine()!!.split(' ').map { it.toInt() }
        return@map a to b
    }.sortedBy { it.second }

    var x = 0
    var count = 0

    for ((a, b) in list) {
        if (a > x) {
            x = b - 1
            count++
        }
    }

    println(count)
}

Measured memory_bytes: 79776
import sys
import math
from collections import defaultdict
from bisect import bisect_left, bisect_right

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

mod = 998244353

def I(): return int(input())
def LI(): return list(map(int, input().split()))
def LIR(row,col):
    if row <= 0:
        return [[] for _ in range(col)]
    elif col == 1:
        return [I() for _ in range(row)]
    else:
        read_all = [LI() for _ in range(row)]
        return map(list, zip(*read_all))

#################

N,S = LI()
A = LI()

d = defaultdict(int)
ans = 0
for i in range(N):
    temp = defaultdict(int)
    for k,v in d.items():
        temp[k] = v
    ans += d[S-A[i]]*(N-i)
    if S == A[i]:
        ans += (i+1)*(N-i)
    ans %= mod
    d[A[i]] += i+1
    for k in range(A[i]+1,3001):
        d[k] += temp[k-A[i]]
    #print(i,ans,d)
print(ans)

Measured memory_bytes: 128012
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000
#define int long long
int dp[3010][3010];
int a[3010];
int N;
int dfs(int L, int R, bool turn) {
    //cout << L << " " << R << " " << turn << endl;
    if (dp[L][R] != INF2) return dp[L][R];
    if (L + R == N - 1) {
        if (N % 2 == 0)
            return dp[L][R] = -a[L];
        else
            return dp[L][R] = a[L];
    }
    if(turn) {
        int tmpL = dfs(L + 1, R, !turn) + a[L];
        int tmpR = dfs(L, R + 1, !turn) + a[N - R - 1];
        return dp[L][R] = max(tmpL, tmpR);
    } else {
        int tmpL = dfs(L + 1, R, !turn) - a[L];
        int tmpR = dfs(L, R + 1, !turn) - a[N - R - 1];
        return dp[L][R] = min(tmpL, tmpR);   
    }
}

signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> N;
    rep(i, N) cin >> a[i];
    rep(i, 3010) rep(j, 3010) dp[i][j] = INF2;
    cout << dfs(0, 0, true) << endl;
    //rep(i, N) rep(j, N) cout << i << " " << j << " " << dp[i][j] << endl;
    

    return 0;
}


Measured memory_bytes: 71168
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
using namespace std;

const int mnx = 1e6 + 9;
const int mod = 1e9 + 7;

ll n, k;
ll a[mnx];
ll dp[mnx];

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

    for(int i = 1; i <= n; i++){
        cin >> a[i];
        dp[i] = mod;
    }

    dp[1] = 0;

    for(int i = 1; i <= n; i++){
        for(int j = 1; j <= k; j++){
            dp[i + j] = min(dp[i] + abs(a[i] - a[i + j]), dp[i + j]);
        }
    }

    cout << dp[n] << '\n';

    return 0;
}























Measured memory_bytes: 5120
#include <stdio.h>

int main() {
	// your code goes here
	while(1){
		int x, y, t;
		scanf("%d %d", &x, &y);
		if(0==x && 0==y) break;
		
		if(y > x){
			t=y;
			y=x;
			x=t;
		}
		printf("%d %d\n", y, x);
	}
	return 0;
}

Measured memory_bytes: 1024
#include <algorithm>  // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <bitset>     // bitset
#include <cctype>     // isupper, islower, isdigit, toupper, tolower
#include <cstdint>    // int64_t, int*_t
#include <cstdio>     // printf
#include <deque>      // deque
#include <iomanip>    // fixed, setprecision
#include <iostream>   // cout, endl, cin
#include <map>        // map
#include <numeric>    // accumulate
#include <queue>      // queue, priority_queue
#include <set>        // set
#include <stack>      // stack
#include <string>     // string, to_string, stoi
#include <tuple>      // tuple, make_tuple
#include <unordered_map>  // unordered_map
#include <unordered_set>  // unordered_set
#include <utility>        // pair, make_pair
#include <vector>         // vector
using namespace std;
typedef long long ll;
typedef unsigned long long ull;

int main() {
  ll N, ans = 0, k;
  cin >> N;

  if (N == 1) {
    cout << 0 << endl;
    return 0;
  }

  vector<bool> eras((ll)sqrt(N) + 1, true);
  for (ll i = 4; i < eras.size(); i += 2) eras[i] = false;
  if (N % 2 != 0) {
    eras[2] = false;
  } else {
    k = 2;
    while (N % k == 0) {
      N /= k;
      k *= 2;
      ans++;
    }
    while (N % 2 == 0) N /= 2;
  }

  for (ll i = 3; i < eras.size(); i += 2) {
    if (eras[i] == false) continue;
    for (ll j = i * 2; j < eras.size(); j += i) eras[j] = false;
    if (N % i != 0) {
      eras[i] = false;
    } else {
      k = i;
      while (N % k == 0) {
        N /= k;
        k *= i;
        ans++;
      }
      while (N % i == 0) N /= i;
    }
  }

  if (N > eras.size()) ans++;

  cout << ans << endl;
}


Measured memory_bytes: 3240
#include <bits/stdc++.h>
#define arep(a,i,n) for(ll i=(a);i<(n);i++)
#define rep(i,n) for(ll i=0;i<(n);i++)
#define cinf(x,n) for(ll i=0;i<(n);i++)cin>>x[i];
#define coutf(x,n) for(ll i=0;i<(n);i++)cout<<x[i]<<endl;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

using namespace std;

ll cnt;

int main(){
	ll n;
	cin >> n;
	ll a[n];
	cinf(a,n);
	ll start=1;
	while(start!=2){
		start=a[start-1];
		cnt++;
		if(cnt>n){
			cout << -1 << endl;
			return 0;
		}
	}
	cout << cnt << endl;
}

Measured memory_bytes: 4416
#include<bits/stdc++.h>
using namespace std;
#define ALL(obj) (obj).begin(), (obj).end()
#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define REP(i, n) for(int i = 0; i < (n); ++i)

#define ABS(a) ((a < 0) ? ((-1)*(a)) : (a))

#define endl "\n"
#define pb push_back
#define rtn return
#define elif else if

#define MOD 1000000007
 
const int dx[]={1,0,-1,0}, dy[]={0,-1,0,1};
const int dx_8[]={1,1,0,-1,-1,-1,0,1}, dy_8[]={0,-1,-1,-1,0,1,1,1};

typedef long long ll;
typedef unsigned long long ull;

template <typename T>
inline T GCD(T a,T b){T c;while(b!=0){c=a%b;a=b;b=c;}return a;}
template <typename T>
inline T LCM(T a,T b){T c=GCD(a,b);a/=c;return a*b;}
template <typename T>
inline T nCr(T a,T b){T i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
template <typename T>
inline T nHr(T a,T b){return nCr(a+b-1,b);}
template <typename T>
inline T POW(T a,T b){int i,r=1;for(i=1;i<=b;i++){r*=a;}return r;}

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

	string s, t;
	cin >> s >> t;

	int scnt[26] = {0}, tcnt[26] = {0};
	for(char i = 'a'; i <= 'z'; i++){
		REP(j, s.size()){
			if(i == s[j]) scnt[i-'a']++;
		}
		REP(j, t.size()){
			if(i == t[j]) tcnt[i-'a']++;
		}
	}
	sort(scnt, scnt+26);
	sort(tcnt, tcnt+26);
	string ans = "Yes";
	REP(i, 26){
		if(scnt[i] != tcnt[i]) ans = "No";		
	}
	cout << ans << endl;
	rtn 0;
}

Measured memory_bytes: 916
object Main extends App {


  val sc = new java.util.Scanner(System.in)
  var fee, cols = sc.nextInt
  val xss = List.fill(cols)(sc.nextInt)
  var ten: List[Int] = List(0, 1, 2, 3, 4, 5, 6, 7, 8, 9)
  var cash = 0
  var count = 0
  var n = 1000
  var flag = false

  for (i <- 0 to 9) {
    if (xss.contains(i)) {
      ten = ten.filter {
        _ != i
      }
    }
  }


  for(i <- fee to 10000){
    if(!flag) {
      if ((ten.contains(i / 1000) || i / 1000 == 0) &&
        (ten.contains(i % 1000 / 100) || (i / 1000 == 0 && i % 1000 / 100 == 0)) &&
        (ten.contains(i % 100 / 10) || (i / 1000 == 0 && i % 1000 / 100 == 0 && i % 100 / 10 == 0)) &&
        (ten.contains(i % 10))) {
        flag = true
        cash = i
      }
    }
  }

  if(!flag){
    if(ten.head != 0){
      cash = ten.head * 11111
    }else{
      for(i <- 1 to 9){
        if(ten.contains(i) && !flag){
          cash = i * 10000
          flag = true
        }
      }

    }
  }

  print(cash)

}

Measured memory_bytes: 27304
#include<bits/stdc++.h>
int main() {
	std::string name;
	int num; std::cin >> num;
	int arr1[4]{};
	for (int x = 0; x < num; x++) {
		std::cin >> name;
		if (name == "AC") {
			arr1[0]++;
		}
		else if (name == "WA") {
			arr1[1]++;
		}
		else if (name == "TLE") {
			arr1[2]++;
		}
		else {
			arr1[3]++;
		}
	}
	std::cout << "AC x " << arr1[0]<<"\n";
	std::cout << "WA x " << arr1[1]<<"\n";
	std::cout << "TLE x " << arr1[2]<<"\n";
	std::cout << "RE x " << arr1[3];

}

Measured memory_bytes: 3632
N, K = map(int, input().split())
D = list(input().split())

ans, i, OK = str(N), 0, False
while not OK:
    OK = True
    digit = len(ans)
    for i in range(digit):
        if ans[i] in D:
            k = digit - i - 1
            ans = str((int(ans)//(10**k) + 1)*10**k)
            OK = False
            break
print(ans)

Measured memory_bytes: 3060
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//イテレータあるけど順序保持しないmap
#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列

using namespace std;
typedef long long ll;

//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
//xにはvectorなどのコンテナ
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x)) //最大値を求める
#define MIN(x) *min_element(ALL(x)) //最小値を求める
//定数
#define INF 9000000000000000000 //9e18:極めて大きい値
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
#define LOGMAXR 18 // floor(log2(10^5)) + 1: 配列の最大のrangeのlog
//略記
//#define PB push_back //vectorヘの挿入
//#define MP make_pair //pairのコンストラクタ
//#define F first //pairの一つ目の要素
//#define S second //pairの二つ目の要素

int main(){
  ll A, B, C, D;
  cin >> A >> B >> C >> D;
  while(1){
    C -= B;
    if(C <= 0){
      cout << "Yes" << endl;
      return 0;
    }
    A -= D;
    if(A <= 0){
      cout << "No" << endl;
      return 0;
    }
  }

  return 0;
}


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

#define INF 999999999
typedef long long ll;
#define rep(i, n) for (int i = 0; i < n; i++)
#define all(v) v.begin(), v.end()
#define pub push_back
#define pob pop_back
#ifdef LOCAL
  #define de(e) cout << "L" << __LINE__ << ": " << e << "\n" // debug echo
  #define dr(e) cout << "L" << __LINE__ << ": " << #e << " -> " << e << "\n" // debug repr
#else
  #define de(e)
  #define dr(e)
#endif
#define out(fmt, ...) printf(fmt, __VA_ARGS__); printf("\n")
int gcd(int m, int n) { if((0 == m) || (0 == n)){return 0;} while(m != n){ if(m > n){m -= n;}else{n -= m;} } return m; }
int lcm(int m, int n) { if((0 == m) || (0 == n)){return 0;} return (m / gcd(m, n)) * n; }

//
// Implementation
//

int main() {
  int A, B, C, D; cin >> A >> B >> C >> D;

  if (A+B > C+D) {
    cout << "Left" << endl;
  } else if (A+B < C+D) {
    cout << "Right" << endl;
  } else {
    cout << "Balanced" << endl;
  }
}


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

int main(){
	cin.tie(0),ios::sync_with_stdio(false);
	while(true){
		string x; cin>>x;
		if(x=="0"s)break;
		int sum=0;
		for(auto&&i:x)sum+=i-'0';
		cout<<sum<<"\n"s;
	}
}


Measured memory_bytes: 3184
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	int h, w, n;
	cin >> h >> w >> n;
	vector<int> a(n);
	for (auto& v : a) cin >> v;
	vector<vector<int>> grid(h, vector<int>(w));
	int direction = 1;
	int index = 1;
	int x = 0, y = 0;
	for (auto to_paint : a) {
		for (int i = 0; i < to_paint; i++) {
			grid[x][y] = index;
			if (   (direction == 1 && y == w-1)
					|| (direction == -1 && y == 0)) {
				x++;
				direction = -direction;
			}
			else y += direction;
		}
		index++;
	}
	for (auto& row : grid) {
		cout << row.front();
		for_each(begin(row) + 1, end(row),
				[] (int color) { cout << ' ' << color; });
		cout << endl;
	}
}


Measured memory_bytes: 384
package main

import "fmt"

func main() {

	var A string
	fmt.Scan(&A)

	if A == "Sunny" {
		fmt.Println("Cloudy")
	}else if A =="Cloudy" {
		fmt.Println("Rainy")
	}else {
		fmt.Println("Sunny")
	}
	
}


Measured memory_bytes: 512
#include <iostream>
#include<cstring>
using namespace std;

int numPaths(char **grid,int r,int c){
    const int mod = 1000000007;
    int dp[r][c];
    memset(dp,0,sizeof(dp));
    dp[0][0] = 1;
    for(int j=1;j<c;j++){
        if(grid[0][j]=='.')
        dp[0][j] = dp[0][j-1];
        else break;
    }
    for(int i=1;i<r;i++){
        if(grid[i][0]=='.')
        dp[i][0] = dp[i-1][0];
        else break;
    }
    for(int i=1;i<r;i++){
        for(int j=1;j<c;j++){
            if(grid[i][j]=='.')
            dp[i][j] = (dp[i-1][j] + dp[i][j-1])%mod;
        }
    }
    return dp[r-1][c-1];
}

int main() {
    int r,c;
    cin>>r>>c;
    char **grid = new char*[r];
    for(int i=0;i<r;i++){
        grid[i] = new char[c];
    }
    for(int i=0;i<r;i++){
        for(int j=0;j<c;j++){
            cin>>grid[i][j];
        }
    }
    cout<<numPaths(grid,r,c);

    return 0;
}

Measured memory_bytes: 8460
#include <bits/stdc++.h>
using namespace std;
 
int main() {
	int N,M;
  cin >> N >> M;
  vector<int> Rn(N,0);//各都市の道路本数
  int End;
  for(int i;i < 2*M;i++){
    cin >> End;
    for(int j = 0;j < N;j++){//Endに書かれている数値の都市のRnを増やす
      if(j == End - 1) Rn.at(j)++;
    }
  }
  for(int i;i < N;i++){
   cout << Rn.at(i) << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <vector>
#include <iostream>
#include<algorithm>
#include<string>
#include <map>
#include <queue>
#include <stack>
#include<set>
#include<tuple>

#define DIV 1000000007
using namespace std;
using ll = long long;
using ldb = long double;

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

	vector<int> num(1e6+1);
	num[1] = 1;
	for (int i = 2; i <= 1e6; i++) {
		if (num[i] == 0) {
			num[i] = i;
			for (int j = 2; i * j <= 1e6; j++) {
				if (num[i * j] == 0)
					num[i * j] = i;
			}
		}
	}

	map<int,int> cnt;
	vector<map<int, int>> mul(N);
	for (int i = 0; i < N; i++) {
		while (a[i] != 1) {
			mul[i][num[a[i]]]++;
			if (mul[i][num[a[i]]] == 1)cnt[num[a[i]]]++;
			a[i] /= num[a[i]];
		}
	}

	int ty = 0;
	for (auto y : cnt) {
		if (y.second == N) {
			ty = 2;
			break;
		}
		else if (y.second >= 2) {
			ty = 1;
		}
		
	}

	if (ty == 0)cout << "pairwise coprime" << endl;
	if (ty == 1)cout << "setwise coprime" << endl;
	if (ty == 2)cout << "not coprime" << endl;
}


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

using namespace std;


int main() {
    string s;
    cin >> s;
    for (int i = 1; i <= s.size(); i++) {
        if (i % 2 && s[i - 1] == 'L') {
            cout << "No";
            return 0;
        }
        if (i % 2 == 0) {
            if (s[i - 1] == 'R') {
                cout << "No";
                return 0;
            }
        }
    }
    cout << "Yes";
    return 0;
}


Measured memory_bytes: 384
#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(){
	int n;
	cin >> n;
	int sum = 0;
	vector<int> d(n);
	rep(i,n) cin >> d[i];
	rep(i,n)rep(j,n){
		if(i == j) continue;
		sum += d[i]*d[j];
	}
	cout << sum/2 << endl;
}

Measured memory_bytes: 3508
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
#define fr(i,n) for(ll i=0;i<(n);++i)
#define Fr(i,n) for(long long i=1;i<=(n);++i)
#define ifr(i,n) for(long long i=(n)-1;i>=0;--i)
#define iFr(i,n) for(long long i=(n);i>0;--i)

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  ll arr[60]{};
  int n;
  ll a,ans;
  ans=0;
  cin>>n;
  fr(i,n){
    cin>>a;
    fr(l,60){
    if(a%2==1){
      ++arr[l];
      }
      a = a/2;
    }
  }
  fr(i,60){
    ans=ans*2;
    ans+=arr[59-i]*(n-arr[59-i]);
    ans=ans%1000000007;
  }
  cout<<ans;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#include <ext/hash_map>
#include <ext/numeric>

using namespace std;
using namespace __gnu_cxx;

#define REP(i,n) for( (i)=0 ; (i)<(n) ; (i)++ )
#define rep(i,x,n) for( (i)=(x) ; (i)<(n) ; (i)++ )
#define REV(i,n) for( (i)=(n) ; (i)>=0 ; (i)-- )
#define FORIT(it,x) for( (it)=(x).begin() ; (it)!=(x).end() ; (it)++ )
#define foreach(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();++it)
#define rforeach(it,c) for(__typeof((c).rbegin()) it=(c).rbegin();it!=(c).rend();++it)
#define foreach2d(i, j, v) foreach(i,v) foreach(j,*i)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define SZ(x) ((int)(x).size())
#define MMS(x,n) memset(x,n,sizeof(x))
#define mms(x,n,s) memset(x,n,sizeof(x)*s)
#define pb push_back
#define mp make_pair
#define NX next_permutation
#define UN(x) sort(all(x)),x.erase(unique(all(x)),x.end())
#define CV(x,n) count(all(x),(n))
#define FIND(x,n) find(all(x),(n))-(x).begin()
#define ACC(x) accumulate(all(x),0)
#define PPC(x) __builtin_popcountll(x)
#define LZ(x) __builtin_clz(x)
#define TZ(x) __builtin_ctz(x)
#define mxe(x) *max_element(all(x))
#define mne(x) *min_element(all(x))
#define low(x,i) lower_bound(all(x),i)
#define upp(x,i) upper_bound(all(x),i)
#define NXPOW2(x) (1ll << ((int)log2(x)+1))
#define PR(x) cout << #x << " = " << (x) << endl ;

typedef unsigned long long ull;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef pair<int, int> pii;

const int OO = (int) 2e9;
const double eps = 1e-9;

const int mod = (int) 1e9 + 7;
const int N = 1e5 + 5;

ll f(int x) {
	return x * (x + 1LL) / 2;
}

int main() {
	std::ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
#ifndef ONLINE_JUDGE
//	freopen("in.txt", "rt", stdin);
//	freopen("out.txt", "wt", stdout);
#endif
	string s;
	cin >> s;
	int n = SZ(s);
	vector<int> a;
	vector<char> b;
	int cnt = 0;
	char prv = s[0];
	for (int i = 0; i < n; i++) {
		if (prv == s[i])
			cnt++;
		else {
			a.pb(cnt);
			b.pb(prv);
			cnt = 1;
			prv = s[i];
		}
	}
	a.pb(cnt);
	b.pb(prv);
	ll sum = 0;
	for (int i = 0; i < SZ(a); i++) {
		sum += f(a[i]);
		if (i && b[i - 1] == '<')
			sum -= min(a[i], a[i - 1]);
	}
	cout << sum << endl;
	return 0;
}


Measured memory_bytes: 2332
#include<bits/stdc++.h>
#define int long long 
using namespace std;
const int MAXN = 1e5 + 10;
int N;
int a[1001][1001], vis[MAXN], prime[MAXN], tot;
void GetPhi() {
	vis[1] = 1;
	for(int i = 2; i; i++) {
		if(!vis[i]) prime[++tot] = i;
		if(tot == 1000) break; 
		for(int j = 1; j <= tot && (i * prime[j] <= 10000); j++) {
			vis[i * prime[j]] = 1;
			if(!(i % prime[j])) break;
		}
	}
}
int lcm(int x, int y) {
	if(x == 0 || y == 0) return x + y;
	return x / __gcd(x, y) * y;
}
main() {
	GetPhi();
	cin >> N;
	if(N == 2) {
		printf("4 7\n23 10");
		return 0;
	}
	for(int i = 1; i <= N; i++) 
		for(int j = 1; j <= N; j++)
			if(!((i + j) & 1)) a[i][j] = prime[(i + j) / 2] * prime[N + (i - j) / 2 + (N + 1) / 2];
	for(int i = 1; i <= N; i++)
		for(int j = 1; j <= N; j++)
			if(!a[i][j]) 
				a[i][j] = lcm(lcm(a[i - 1][j], a[i][j - 1]), lcm(a[i][j + 1], a[i + 1][j])) + 1;
	for(int i = 1; i <= N; i++, puts(""))
		for(int j = 1; j <= N; j++)
			cout << a[i][j] << " ";
	return 0;
}


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

int main() {
	// your code goes here
	string s = "abcdefghijklmnopqrstuvwxyz";
	char a;
	cin>>a;
	for(int i = 0; i<s.size(); ++i){
	    if(s[i]==a){cout<<s[i+1];break;}
	    
	}
	return 0;
}


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

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

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<queue>
using namespace std;
static const int MAX = 10000;
static const int INFTY = (1 << 20);
static const int WHITE = 0;
static const int GRAY = 1;
static const int BLACK = 2;

int n;
vector<pair<int, int> > adj[MAX];

void dijkstra() {
	priority_queue<pair<int, int> > PQ;
	int color[MAX];
	int d[MAX];
	for (int i = 0; i < n; i++) {
		d[i] = INFTY;
		color[i] = WHITE;
	}

	d[0] = 0;
	PQ.push(make_pair(0, 0));
	color[0] = GRAY;

	while (!PQ.empty()) {
		pair<int, int> f = PQ.top();
		PQ.pop();
		int u = f.second;

		color[u] = BLACK;

		if (d[u] < f.first*(-1))continue;

		for (int j = 0; j < adj[u].size(); j++) {
			int v = adj[u][j].first;
			if (color[v] == BLACK)continue;
			if (d[v] > d[u] + adj[u][j].second) {
				d[v] = d[u] + adj[u][j].second;
				PQ.push(make_pair(d[v] * (-1), v));
				color[v] = GRAY;
			}
		}
	}

	for (int i = 0; i < n; i++) {
		cout << i << " " << (d[i] == INFTY ? -1 : d[i]) << endl;
	}
}

int main() {
	int k, u, v, c;

	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> u >> k;
		for (int j = 0; j < k; j++) {
			cin >> v >> c;
			adj[u].push_back(make_pair(v, c));
		}
	}

	dijkstra();

	return 0;
}


Measured memory_bytes: 7996
import math

n, k = map(int, input().split())

def calc_p(i, k):
    if k <= i:
        return 0
    return math.ceil(math.log2(k)-math.log2(i))

print(sum([(1/n)*(1/2)**calc_p(i,k) for i in range(1,n+1)]))

Measured memory_bytes: 6296
#include<stdio.h>
#include<stdlib.h>
int partition(int *, int, int);
main(){
  int n, i, c;
  int *A;
  scanf("%d", &n);
  A = (int *)malloc(sizeof(int)*n);
  if(A == NULL) exit(1);
  
  for(i = 0; i < n; i++){
    scanf("%d", &A[i]);
  }
  c = partition(A, 0, n);
  for(i = 0; i < n; i++){
    if     (i == n-1 && i != c) printf("%d\n",   A[i]);
    else if(i == n-1 && i == c) printf("[%d]\n", A[i]);
    else if(i != n-1 && i == c) printf("[%d] ",  A[i]);
    else if(i != n-1 && i != c) printf("%d ",    A[i]);
  }
  free(A);
  return 0;
}

int partition(int *A, int p, int r){
  int i, j, x, a;
  x = A[r-1];
  i = p-1;
  for(j = p; j < r-1; j++){
    if(A[j] <= x){
      i += 1;
      a = A[i];
      A[i] = A[j];
      A[j] = a;
    }
  }
  a = A[i+1];
  A[i+1] = A[r-1];
  A[r-1] = a;
  return i+1;
}

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


int main()
{
 int A;
 int B;
 int K;
 int a;
 int b;
 cin>>A>>B>>K;
 for(int i=0;i<K;++i){
	 a=A+i;
	 if(a<B+1){
	 cout<<a<<endl;}}
 
 for(int j=0;j<K;++j){
	 b=B-K+1+j;
	 if(b<B+1){
	  if(b>A+K-1)
	  {cout<<b<<endl;}
     }
    }
}

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

namespace ABC145C
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            int[] x = new int[N];
            int[] y = new int[N];
            for(int i = 0; i < N; i++)
            {
                string[] xy = Console.ReadLine().Split(' ');
                x[i] = int.Parse(xy[0]);
                y[i] = int.Parse(xy[1]);
            }
            double sum = 0;
            for(int i = 0; i < N - 1; i++)
            {
                for (int j = i + 1; j < N; j++)
                {
                    double d = Math.Sqrt(((double)x[i] - x[j]) * (x[i] - x[j]) + (y[i] - y[j]) * (y[i] - y[j]));
                    //Console.WriteLine(d);
                    sum += d;
                }
            }
            //Console.WriteLine(sum);
            
            double ans = sum * 2 / N;
            Console.WriteLine(ans);
        }
    }
}


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

typedef long long ll;

int main()
{
    int N;
    int minans = 0;
    int over =0;
    cin >> N;
    set<int> st;

    for (int i=0;i<N;++i)
    {
        int temp;
        cin >> temp;
        if (temp<3200) {
            st.insert(temp/400);
        }
        else {
            ++over;
        }

    }
    cout << max(1, (int)st.size()) << " ";
    cout << st.size()+over << endl;


}


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

int M[105][100005];
int A[105];

inline void filly(int n, int k)
{
    for(int i = 1; i < n; i++)
    {
        M[i][0] = 1;
        for(int j = 1; j <= k; j++)
        {
                M[i][j] = M[i][j-1];
                M[i][j] += (M[i-1][j] - (j - A[i] - 1 >= 0 ? M[i-1][j - A[i] - 1] : 0) + 1000000007) % 1000000007;
                M[i][j] %= 1000000007;
        }
    }
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    
    int n, k;
    cin >> n >> k;

    for(int i = 0; i < n; i++)
        cin >> A[i];
    for(int i = 0; i <= A[0]; i++)
        M[0][i] = i+1;
    for(int i = A[0]+1; i <= k; i++)
        M[0][i] = M[0][A[0]];

    filly(n, k);
    cout << (M[n-1][k] - M[n-1][k-1] + 1000000007) % 1000000007;

    return 0;
}


Measured memory_bytes: 41216
inputs = [s.strip() for s in open(0).readlines()]
import numpy as np
class Grid():
    def __init__(self, grid, w=0, h=0, function=lambda x: x):
        self.w = w = w if w else len(grid[0])
        self.h = h = h if h else len(grid)
        dtype = type(function(grid[0][0]))
        self.grid = np.empty((h, w), dtype=dtype)
        for i, row in zip(range(h), grid):
            for j, val in zip(range(w), row):
                self.grid[i][j] = function(val)
    
    def is_valid_x(self, x):
        return 0 <= x < self.w
    def is_valid_y(self, y):
        return 0 <= y < self.h
    def is_valid_xy(self, x, y):
        return self.is_valid_x(x) and self.is_valid_y(y) 
    
    def __iter__(self):
        return iter(self.grid)
    def __repr__(self):
        return '\n'.join([' '.join(map(str, row)) for row in self.grid])
    def __getitem__(self, x):
        return self.grid[x]
    def __setitem__(self, x, val):
        self.grid[x] = val

h, w = map(int, inputs[0].split())
grid = Grid(inputs[1:]).grid

h, w = map(int, inputs[0].split())
grid = Grid(inputs[1:])

dp = Grid(np.zeros((h, w), np.int))
dp[0, 0] = int(grid[0, 0] == '#')
for i in range(1, w):
    dp[0, i] = dp[0, i-1] + int(grid[0, i-1] + grid[0, i] == '.#')
for i in range(1, h):
    dp[i, 0] = dp[i-1, 0] + int(grid[i-1, 0] + grid[i, 0] == '.#')
x = y = 1
while not (x == w-1 and y == h-1):
    for i in range(x, w):
        dp[y, i] = min(dp[y, i-1] + int(grid[y, i-1] + grid[y, i] == '.#'),
                       dp[y-1, i] + int(grid[y-1, i] + grid[y, i] == '.#'))
    for i in range(y+1, h):
        dp[i, x] = min(dp[i-1, x] + int(grid[i-1, x] + grid[i, x] == '.#'),
                       dp[i, x-1] + int(grid[i, x-1] + grid[i, x] == '.#'))
    x, y = min(x+1, w-1), min(y+1, h-1)
print(min(dp[y-1, x] + int(grid[y-1, x] + grid[y, x] == '.#'), 
          dp[y, x-1] + int(grid[y, x-1] + grid[y, x] == '.#')))

Measured memory_bytes: 12680
#include <stdio.h>
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <algorithm>
#include <queue>
#include <list>
#include <stack>
#include <math.h>
#include <map>
#include <unordered_map>
#include <set>
using namespace std;

#define ll long long
#define ull unsigned long long

#define	max	1000000007

class mod
{
public:
	ll val;

	mod(ll v)
	{
		val = v % max;
	}

	mod()
	{
		val = 0;
	}

	void operator -=(const mod &v)
	{
		val -= v.val;

		if (val < 0)
			val += max;		
	}

	void operator +=(const mod &v)
	{
		if (val + v.val >= max)
			val -= max;
		val += v.val;
	}

	void operator +=(ll &v)
	{
		if (val + v >= max)
			val -= max;
		val += v;
	}

	void operator *=(const mod &v)
	{
		val *= v.val;
		val %= max;
	}

	void operator *=(ll &v)
	{
		val *= v;
		val %= max;
	}

	ll modinv(ll a)
	{
		ll b = max, u = 1, v = 0;
		while (b) 
		{
			ll t = a / b;
			a -= t * b; swap(a, b);
			u -= t * v; swap(u, v);
		}
		u %= max;
		if (u < 0)
			u += max;
		return u;
	}

	void operator /=(const mod &v)
	{
		val *= modinv(v.val);
		val %= max;
	}

	void operator /=(ll &v)
	{
		val *= modinv(v);
		val %= max;
	}
};

int main()
{
	ll x, y;
	cin >> x >> y;
	ll r = 0;
	for (; x <= y; x *= 2, r++);

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


Measured memory_bytes: 384
#include "bits/stdc++.h"
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a),i##_len=(b);i<i##_len;++i)
#define MSVC_UNKO(x) x
#define rep(...) MSVC_UNKO(_overload3(__VA_ARGS__,repi,_rep,_rep)(__VA_ARGS__))
#define all(c) c.begin(),c.end()
#define write(x) cout<<(x)<<'\n'
using namespace std; typedef long long ll; template<class T>using vv = vector<vector<T>>;
template<class T>auto vvec(int n, int m, T v) { return vv<T>(n, vector<T>(m, v)); }
template<class T, class U>bool chmax(T& a, U&& b) { return a < b ? a = b, 1 : 0; }
template<class T, class U>bool chmin(T& a, U&& b) { return b < a ? a = b, 1 : 0; }
constexpr int INF = 1 << 29, MOD = int(1e9) + 7; constexpr ll LINF = 1LL << 60;
struct aaa { aaa() { cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(10); }; }aaaa;

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

    vector<int> ans;

    if (N == 3) {
        ans = { 2, 5, 63 };
    }
    else if (N == 4) {
        ans = { 2, 4, 3, 9 };
    }
    else if (N <= 15002) {
        int n = N - 2;
        int m = n / 3;
        rep(i, m) {
            ans.push_back(6 * i + 2);
            ans.push_back(6 * i + 4);
            ans.push_back(6 * i + 6);
        }

        if (n % 3 == 1) {
            ans.push_back(30000);
        }
        else if (n % 3 == 2) {
            ans.push_back(29998);
            ans.push_back(29996);
        }

        ans.push_back(3);
        ans.push_back(9);
    }
    else {
        int l = min(5000, (N - 3) / 2 * 2);
        rep(i, l) {
            ans.push_back(6 * i + 3);
        }

        int n = N - l;
        int m = n / 3;
        rep(i, m) {
            ans.push_back(6 * i + 2);
            ans.push_back(6 * i + 4);
            ans.push_back(6 * i + 6);
        }

        if (n % 3 == 1) {
            ans.push_back(30000);
        }
        else if (n % 3 == 2) {
            ans.push_back(29998);
            ans.push_back(29996);
        }
    }

    for (int i = 0; i < N; ++i) {
        cout << ans[i] << (i == N - 1 ? '\n' : ' ');
    }
}

Measured memory_bytes: 640
/*
  Contest 084
  B - Postal Code
  Rakesh Kumar --> 17/09/2020
 */

#include <bits/stdc++.h>

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

    std::size_t a = 0, b = 0;
    std::cin >> a >> b;
    std::cin.ignore();
    std::string pin_code;
    std::getline(std::cin, pin_code);
    if (a + b + 1 != pin_code.size()) {
        std::cout << "No";
        return 0;
    }
    std::string r = "Yes";
    for (std::size_t i = 0; i < pin_code.size(); ++i) {
        if (i == a) {
            if (pin_code[i] != '-') {
                r = "No";
                break;
            }
        } else {
            if (!std::isdigit(pin_code[i])) {
                r = "No";
                break;
            }
        }
    }
    std::cout << r << std::endl;

    return 0;
}


Measured memory_bytes: 3620
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
using namespace std;
#define IOS {ios :: sync_with_stdio(false); cin.tie(0);cout.tie(0); }
#define F first
#define S second
#define pb push_back
typedef long double ld;
#define deci(n) cout << fixed << setprecision(n);
typedef long long ll;

#define mem0(x)  memset(x,0,sizeof(x));
#define mem1(x)  memset(x,1,sizeof(x));
#define memm1(x) memset(x,-1,sizeof(x));
#define all(a) a.begin(), a.end()
#define pll pair<ll, ll>
#define bits(x) __builtin_popcount(x)
#define fori(n)  for (ll i = 0; i < n; i++)
#define fori2(n) for(ll i=1;i<=n;i++)
#define forj(n)  for (ll j = 0; j < n; j++)
#define forj2(n) for(ll j=1;j<=n;j++)
#define fork(n)  for (ll k = 0; k < n; k++)
#define fork2(n) for(ll k=1;k<=n;k++)
#define vll vector <ll>
#define mll map <ll, ll>
#define vpll vector <pll>
const ll md = 1e9 + 7;

#define BSET(a, p) ((a) | (1ll << (p)))
#define BCHK(a, p) ((a) & (1ll << (p)))
#define BXOR(a, p) ((a) ^ (1ll << (p)));
#define BREM(a, p) (BCHK(a, p)?(BXOR(a, p)):(a))
#define BSHO(a, N) (bitset<N>(a))
// const ll N = 100005;
// ll fac[N] = {1};
// #define calfac for(ll i=1  ;i<N;i++) fac[i] = (fac[i-1]*i)%md;
// ll C[N+1][M+1]; 
// void  ncr(){
//     ll n = N,k = M; 
//     for (ll i = 0; i <= n; i++) { 
//         for (ll j = 0; j <= min(i, k); j++) { 
//             if (j == 0 || j == i)  C[i][j] = 1; 
//             else C[i][j] = C[i - 1][j - 1] +  C[i - 1][j]; 
//         } 
//     } 
// } 


#define RBTTYPE int
#define ordered_set tree<RBTTYPE, null_type, less<RBTTYPE>, rb_tree_tag,tree_order_statistics_node_update> 
// Ordered set docs:
// order_of_key (k) : Number of items strictly smaller than k .
// find_by_order(k) : K-th element in a set (counting from zero).
ll modexp(ll x, ll ex) {
    ll ans = 1ll;
    while (ex > 0) {
        if (ex & 1ll) ans = (ans * x) % md;
        ex >>= 1ll;
        x = (x * x) % md;
    }
    return ans;
}
ll modInv(ll a)
{
    return pow(a,md-2);
}
 
// ll nCr(ll n,ll r)
// {
//     return (fac[n]*modInv((fac[r]*fac[n-r])%md))%md;
// }

 
ll po(ll x,ll n){
    if(n==0) return 1;
    if(n%2==1) return (x*po(x,n-1));
    else {
        ll k=po(x,n/2);
        return (k*k);
    }
}
 
ll gcd(ll x, ll y) {
    if (x < y) return gcd(y, x);
    if (y == 0) return x;
    return gcd(y, x % y);
}

ll a[105];
 
int32_t main(){
    IOS;
    ll i,j,k,n,cnt=0;
    cin >> n;
    fori2(n){
        cin >> a[i];
        if(i%2 && a[i]%2) cnt++;
    }
    cout << cnt <<"\n";
} 

Measured memory_bytes: 3664
#include<bits/stdc++.h>
#define int long long
#define endl "\n"
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;

int32_t main()
{
	IOS
	int N,W;cin>>N>>W;
	int MAX_VALUE = 100000;
	vector<int>dp(MAX_VALUE+1,1e15);
	dp[0]=0;
	for(int i=0;i<N;i++)
	{
		int w,v;cin>>w>>v;
		for(int j=MAX_VALUE-v;j>=0;j--)
		{
			dp[j+v]=min(dp[j+v],dp[j]+w);
		}
	}
	for(int i=MAX_VALUE;i>=0;i--)
	{
		if( dp[i] <= W )
		{
			cout<<i<<endl;
			return 0;
		}
	}
	
	
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i,n) for (long i=0;i<n;i++)
using namespace std;
 
int main() {
	int a, b;
	cin >> a >> b;
	if (a + b >= 10) cout << "error" << endl;
	else cout << a + b << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <iomanip>
#include <cmath>
#define REP(i,n) for (int i=0;i<(n);++i)
using namespace std;
using ll = long long;
constexpr ll MOD = 1e9 + 7;
constexpr ll INF = 1LL << 60;

ll n, k, a[200010];

int main() {
  ios::sync_with_stdio(false); cin.tie(0);
  cin >> n >> k;
  cout << (n + k - 1) / k;
  return 0;
}


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

int main(){
    static const double pi = 3.141592653589793;
    long double A, B, H, M;
    cin >> A >> B >> H >> M;
    long double theta_A = (30 * H + 0.5 * M) * 2 * pi / 360.0;
    long double theta_B = 6 * M * 2 * pi / 360.0;
    //cout << theta_A << ' ' << theta_B << endl;
    long double ans;
    ans = sqrt(A * A + B * B - 2 * A * B * cos(theta_B - theta_A));
    cout << fixed << setprecision(16) << ans << endl;
    return 0;
}


Measured memory_bytes: 4164
import heapq

k, n = map(int, input().split())
a = [int(x) for x in input().split()]
qa = []
heapq.heapify(qa)

for x in range(len(a) - 1):
    heapq.heappush(qa, abs(a[x] - a[x + 1]))
heapq.heappush(qa, k - a[-1] + a[0])

dis = 0
for x in range(len(qa) - 1):
    dis += heapq.heappop(qa)

print(dis)



Measured memory_bytes: 26164
#include<bits/stdc++.h>
using namespace std;
int main(){
    int w,a,b;
    cin>>w>>a>>b;
    if((a<=b&&b<=a+w)||(a<=b+w&&b<=a)) cout<<0<<endl;
    if(a+w<b) cout<<b-(a+w)<<endl;
    if(b+w<a) cout<<a-(b+w)<<endl;
    
}

Measured memory_bytes: 3640
#include <stdio.h>
#include <string.h>
#include <stdbool.h>

#define S_MAX 200000
#define N_MAX 100000
#define M_MAX 100000
#define INF 10000000
#define MOD 1000000007
#define SMAP(a, b) ((a)!=(b))&&((a)^=((b)^=((a)^= (b))))

typedef unsigned long long ull;
typedef   signed long long dll;

int n, m;
int h, w;
int i, j, k;

int a[N_MAX];
int b[N_MAX];

typedef struct {
	int in;
	int out;
} twoway;

void solve(){
	int lastindex = -1;
	int leftestcol;

	int result = 0;

	if (n == 1) printf("%d\n", a[0] ^ 1);
	for (i = 0; i < (n >> 1); i++) {
		if (lastindex == -1) {
			lastindex++;
			b[lastindex] = 1;
			leftestcol = a[1];
		} else if ((lastindex & 1) ^ leftestcol == a[(i << 1) + 1]) {

			b[lastindex]++;
		} else if (a[i << 1] == a[(i << 1) + 1]) {
			lastindex++;
			b[lastindex] = 1;
		} else if (lastindex) {
			b[lastindex - 1] += b[lastindex];
			b[lastindex - 1]++;
			lastindex--;
		} else {
			b[0]++;
			leftestcol ^= 1;
		}

		// for (j = 0; j <= lastindex; j++) printf("%dx%d, ", (lastindex & 1) ^ leftestcol, b[j]);
		// 	putchar('\n');
	}

	for (i = leftestcol; i <= lastindex; i += 2) {
		result += b[i];
	}

	result *= 2;
	if (n & 1) result += (a[n-1] ^ 1);

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

	return;
}

int main (void) {
	while (scanf("%d", &n), n) {
		for (i = 0; i < n; i++) scanf("%d", &a[i]);
		solve();
	}
	return 0;
}

Measured memory_bytes: 996
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))

x,y = iim()
cnt = 0
while x <= y:
    cnt += 1
    x *= 2
print(cnt)

Measured memory_bytes: 3060
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.lang.StringBuffer;

/*Question
/????????¨??±?????????????????????????????????????????????????????????n???????????????????????£????????????n??????????????????????????????
/??????????????§???????????????1??????????????????????????????
/?????????????????¢????????????????????????????????????????????????????????????????????????????????§??§?????????????????????????????????????????¨?????????
/????????????3????????????????????????????????´?????????????????????1?????????????????????????????????
/????????¨??±???????????????????????????????????±???????????????????????????????????????????????????????????????????????????????????°????????????????????????
*/
/*Input
/??????????????????????????°n?????????????????????
/?¶????n??????????????????????????????????????±?????????????????????
/1????????????????????????????????????????????????????????????????????????2???????????????????????±???????????????????????????????????????????????§?????????
*/

public class Main {
	public static void main(String[] args) throws Exception{
		BufferedReader sc = new BufferedReader(new InputStreamReader(System.in));
		//????????¨
		StringBuffer sb = new StringBuffer();
		//?????????????????????
		int t = 0;
		//??±??????????????????
		int h = 0;
		//???????????????????????\???(?????????????????°)
		int n = Integer.parseInt(sc.readLine());
		//?????????????????????(??????????????????????????????)
		for(int i = 0;i < n;i++){
			/*??????????????\???
			/?????????????????????" "(??????)??§????????£?????????s??¨??????
			/s[0]????????????s[1]?????±?????¨??????
			*/
			String[] s = sc.readLine().split(" ");
			/*??????????????????
			/??????????????§???????°???????????????§??????????????????
			/??????????????????????????¨?????????????????????
			/???????????????0????????§?????????????????????????????§
			/??????????????±???
			/????????\?????????????????????????????????????????????????????¨??????(????????????????????????????????¨??????)
			*/
			if(s[0].compareToIgnoreCase(s[1]) > 0){
				t += 3;
			}else if(s[0].compareToIgnoreCase(s[1]) < 0){
				h += 3;
			}else{
				t++;
				h++;
			}
		}
		//?????????????????????????????????????????¨?????????????????¨(sb)?????¨????´?(????????????????????????????????????????????????????????§?????¨??????????????¨???sb????????¨)
		sb.append(t+" "+h+"\n");
		System.out.print(sb);
	}
}

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

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG //これつけるとA[N]でもいいらしい
//for文のマクロ
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define big 1000000007

int main(){
    int a,b;
    cin>>a>>b;
    vector<string> A(2);
    rep(i,a){
        A[0] += to_string(b);
    }
    rep(i,b){
        A[1] += to_string(a);
    }
    sort(A.begin(),A.end());
    cout<<A[0]<<endl;
}

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

using namespace std;

typedef long long ll;
typedef vector<int> VI;

#define FOR(i,n) for(int (i)=0;(i)<(n);(i)++)
#define FOR1(i,n) for(int (i)=1;(i)<(n);(i)++)
#define eFOR(i,n) for(int (i)=0;(i)<=(n);(i)++)
#define eFOR1(i,n) for(int (i)=1;(i)<=(n);(i)++)
#define SORT(i) sort((i).begin(),(i).end())

int main() {

	int n, k;
	cin >> n >> k;
	string s;
	cin >> s;

	VI a;
	int cnt = 1;
	char z = s[0];
	FOR1(i, n) {
		if (s[i] == z)cnt++;
		else {
			a.push_back(cnt);
			cnt = 1;
			z = s[i];
		}
	}
	a.push_back(cnt);
	FOR1(i, a.size())a[i] += a[i - 1];

	int x;
	cnt = 0;
	int ans = 0;
	if (s[0] == '0') {
		x = k * 2 - 1;
		if (x >= a.size())x = a.size() - 1;
		cnt = a[x];
		ans = max(ans, cnt);
		cnt = 0;
		FOR1(i, a.size()) {
			if (i % 2 == 1) {
				x = i + k * 2;
				if (x >= a.size())x = a.size() - 1;
				cnt = a[x] - a[i - 1];
				ans = max(ans, cnt);
				cnt = 0;
			}
			else {
				x = i + k * 2 - 1;
				if (x >= a.size())x = a.size() - 1;
				cnt = a[x] - a[i - 1];
				ans = max(ans, cnt);
				cnt = 0;
			}
		}
	}
	else {
		x = k * 2;
		if (x >= a.size())x = a.size() - 1;
		cnt = a[x];
		ans = max(ans, cnt);
		cnt = 0;
		FOR1(i, a.size()) {
			if (i % 2 == 0) {
				x = i + k * 2;
				if (x >= a.size())x = a.size() - 1;
				cnt = a[x] - a[i - 1];
				ans = max(ans, cnt);
				cnt = 0;
			}
			else {
				x = i + k * 2 - 1;
				if (x >= a.size())x = a.size() - 1;
				cnt = a[x] - a[i - 1];
				ans = max(ans, cnt);
				cnt = 0;
			}
		}
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 1020
#include<bits/stdc++.h>
using namespace std;
int main()
{
	ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
	string a,b;
	long int i,count=0;;
cin>>a>>b;
	for(i=0;a[i]!='\0';i++)
	{
	if(a[i]!=b[i])
	count++;
	}
	cout<<count;
}

Measured memory_bytes: 3792