akhauriyash/Code-Regression huggingface dataset:
fn read_line() -> String {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().to_owned()
}

fn reads<T>() -> Vec<T>
where
    T: std::str::FromStr,
    <T as std::str::FromStr>::Err: std::fmt::Debug,
{
    read_line()
        .split_whitespace()
        .map(|w| w.parse().unwrap())
        .collect()
}

fn main() {
    let n: i32 = reads()[0];
    println!("{}", n / 3);
}


Measured memory_bytes: 4352
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <limits>
#include <iostream>
using namespace std;
long long gcd(long long a, long long b) { return b?gcd(b,a%b):a;}
long long lcm(long long a, long long b) { return a/gcd(a,b)*b;}

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

long long ans(long long h) {
  if (h == 1) return 1;
  return 1 + 2 * ans(h / 2);
}

int main() {
  long long h;
  cin >> h;
  cout << ans(h) << endl;
  return 0;




  long long count = 0;
  if (h == 1) cout << 1 << endl;
  else {
    while(1) {
      if (h == 1) {
        break;
      }
      h = h / 2;
      count++;
    }
  }
  // string ans;
  // cout << ans << endl;
  printf("%lld", ((long long)2 * (long long)pow(2, count) - 1));
  // cout << 2 * pow(2, count) - 1 << endl;

  return 0;
}


Measured memory_bytes: 256
import sys, bisect, math, itertools, string, queue, copy
mod = 10**9+7
def inp(): return int(input())
def inpm(): return map(int,input().split())
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())
def inplm(n): return list(int(input()) for _ in range(n))
def inplL(n): return [list(input()) for _ in range(n)]
def inplT(n): return [tuple(input()) for _ in range(n)]
def inpll(n): return [list(map(int, input().split())) for _ in range(n)]
def inplls(n): return sorted([list(map(int, input().split())) for _ in range(n)])

d, t , s = inpm()
if(d > t * s):
    print('No')
else:
    print('Yes')

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

const int LOSE=1;
const int BACK=2;
int main(){
    int n,t,l,b;  
    while(cin>>n>>t>>l>>b,n){
        vector<int> sq(n+1,0);
        for(int i=0;i<l;i++){
            int buf;
            cin>>buf;
            sq[buf]=LOSE;
        }
        for(int i=0;i<b;i++){
            int buf;
            cin>>buf;
            sq[buf]=BACK;
        }
        vector<vector<double>> movable(t+1,vector<double>(n+1,0));
        vector<vector<double>> stoping(t+1,vector<double>(n+1,0));
        movable[0][0]=1;
        const double p=1.0/6.0;
        for(int turn=1;turn<=t;turn++){
            for(int i=0;i<n;i++){
                for(int j=1;j<=6;j++){
                    int to=(i+j<=n ? i+j : n-(i+j-n));
                    if(sq[to]==BACK){
                        movable[turn][0]+=movable[turn-1][i]*p;
                    }else if(sq[to]==LOSE){
                        stoping[turn][to]+=movable[turn-1][i]*p;
                    }else{
                        movable[turn][to]+=movable[turn-1][i]*p;
                    }
                }
                movable[turn][i]+=stoping[turn-1][i];
            }
            movable[turn][n]+=movable[turn-1][n];
        }
        cout<<fixed<<setprecision(10);
        cout<<movable[t][n]<<endl;
    }

    return 0;
}

Measured memory_bytes: 3356
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;

int main() {
	string first, second, third;
	cin >> first >> second >> third;

	cout << "A" << second.at(0) << "C" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <math.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rrep(i, n) for(int i = 0; i <= (n); i++)
using namespace std;
typedef long long ll;
 
const ll INF = 1LL<<62;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
// 多次元 vector 生成
template<class T>
vector<T> make_vec(size_t a){
    return vector<T>(a);
}
template<class T, class... Ts>
auto make_vec(size_t a, Ts... ts){
  return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}

const int MOD = 1000000007;


int main(){
    ll N,D; cin >> N >> D;
    vector<ll> X(N), Y(N);
    rep(i,N) cin >> X[i] >> Y[i];
    int ans = 0;
    rep(i,N){
        if(X[i]*X[i] + Y[i]*Y[i] <= D*D){
            ans++;
        }
    }

    cout << ans << endl;

}

Measured memory_bytes: 6364
#include <bits/stdc++.h>
using namespace std;
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define reprrev(i,a,b) for(int i=b-1;i>=a;i--) // [a, b)
#define reprev(i,n) reprrev(i,0,n)
typedef long long ll;
typedef unsigned long long ull;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
*/

const ll mod = 1e9+7;

void chmod(ll &M){
    if(M >= mod) M %= mod;
    else if(M < 0){
        M += (abs(M)/mod + 1)*mod;
        M %= mod;
    }
}

ll modpow(ll x, ll n){
    if(n==0) return 1;
    ll res=modpow(x, n/2);

    if(n%2==0) return res*res%mod;
    else return res*res%mod*x%mod;
}

int getl(int i, int N) { return i==0? N-1:i-1; };
int getr(int i, int N) { return i==N-1? 0:i+1; };


// 線分 ab の偏角 返り値は[-π, π]
double argument(const pair<double, double> &a, const pair<double, double> &b){
    double ax=a.first, ay=a.second, bx=b.first, by=b.second;
    return atan2(by-ay, bx-ax);
}

/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */



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

    deque<char> deq;
    int cnt = 0;

    string s; cin >> s;
    rep(i, s.size()) deq.push_back(s[i]);

    int q; cin >> q;
    rep(i, q) {
        int t; cin >> t;
        if(t==1) ++cnt;
        else {
            int f; cin >> f;
            char c; cin >> c;
            if((cnt+f)%2==1) deq.push_front(c);
            else deq.push_back(c);
        }
    }

    if(cnt%2==0) {
        for(auto itr=deq.begin(); itr!=deq.end(); ++itr) cout << *itr;
        cout << endl;
    } else {
        for(auto itr=deq.rbegin(); itr!=deq.rend(); ++itr) cout << *itr;
        cout << endl;
    }
    
    return 0;
}

Measured memory_bytes: 976
n = int(input())
p_list = list(map(int, input().split()))
cnt = 0
for i in range(n-1):
    if p_list[i] == i+1:
        p_list[i+1] = p_list[i]
        cnt += 1
if p_list[n-1] == n:
    cnt += 1
print(cnt)

Measured memory_bytes: 14008
#include"bits/stdc++.h"
//#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=a;i<b;i++)
#define print(x) cout<<x<<endl;
typedef long long ll;

int main() {
	ll n;
	ll a[100002] = {};
	ll b[100002] = {};
	cin >> n;
	rep(i, 0, n)cin >> a[i];
	ll cnt = 0;
	rep(i, 0, n) {
		b[a[i]]++;
		if (b[a[i]] > 1) {cnt++; }
	}
	if (cnt % 2 == 0) { print(n - cnt); }
	else if (cnt % 2 != 0){print(n - cnt-1);}
	return 0;
}

Measured memory_bytes: 1792
N = int(input())
S = 'X' + input()

cnt_R, cnt_G, cnt_B = 0, 0, 0
for s in S[1:]:
    if s == 'R':
        cnt_R += 1
    elif s == 'G':
        cnt_G += 1
    elif s == 'B':
        cnt_B += 1

ans = cnt_R * cnt_G * cnt_B

for i in range(1,N-1):
    for j in range(i+1,N):
        k = 2*j - i
        if k > N:
            break
        
        a = S[i]; b = S[j]; c = S[k]
        if a != b and b != c and c != a:
            ans -= 1

print(ans)

Measured memory_bytes: 9204
#include <bits/stdc++.h>
using namespace std;
const int maxn = 66, mod = 1'000'000'007;
int stk[maxn];
void put(long long a){
	for(int i = 0; i < maxn; i++) stk[i] = a % 2, a /= 2;
}
int len(long long a){
	int sz = 0;
	while(a) sz++, a /= 2;
	return sz;
}
int f[2][2][2][maxn];
int solve(int carry, int fsm, int ssm, int wh){
	if(wh == -1) return carry == 0;
	int & ans = f[carry][fsm][ssm][wh];
	if(~ans) return ans;
	ans = 0;
	int ftp = fsm ? 1 : stk[wh];
	int stp = ssm ? 1 : stk[wh];
	for(int i = 0; i <= ftp; i++){
		for(int j = 0; j <= stp; j++){
			for(int va = 0; va <= 1; va++){
				for(int vb = va; vb <= 1; vb++){
					if((va^vb) != i) continue;
					for(int cr = 0; cr <= 1; cr++){
						int sum = va + vb + cr;
						int val = sum & 1;
						int ncr = (sum >> 1) & 1;
						if(val != j) continue;
						if(ncr != carry) continue;
						ans += solve(cr, fsm || (i < ftp), ssm || (j < stp), wh - 1);
						if(ans >= mod) ans -= mod;
					}
				}
			}
		}
	}
	return ans;
}
int main(){
	long long n; cin >> n;
	put(n);
	memset(f, -1, sizeof(f));
	cout << solve(0, 0, 0, len(n) - 1) << endl;
	return 0;
}


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

int main() {
  string S; cin >> S;
  S = S.substr(0,S.size()-2);
  int ans =0; bool check = true;
  for(int i =S.size()/2; i>0; i--) {
    check = true;
    rep(j,0,i) {
      if (S[j] != S[i+j]) check = false;
    }
    if (check) {
      ans =i*2; break;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 3552
import math

def ketaOk(a, N):#can divided by a+1 digits number
    for i in range(10 ** (a + 1) - 1, 10 ** a - 1, -1):
        if N % i == 0:
            M = max(i, N/i)
            return (math.floor(math.log10(M)) + 1)
        else:
            pass
    else:
        return 0

N = int(input())
a = math.floor(math.log10(N ** 0.5))

while a+1:
    ans = ketaOk(a, N)
    if ans:
        print(ans)
        break
    else:
        a = a - 1

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

int main()
{
    long long int n,a[1000],i,d;
    cin>>n;
    for(i=0; i<n; i++)
    {
        cin>>a[i];
    }
    sort(a,a+n);
    d=a[n-1]-a[0];
    cout<<d<<endl;
    return 0;
}


Measured memory_bytes: 256
#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>;
const int MOD=1000000007;

int main() {
  string s, t;
  int n=0;
  cin >> s >> t;
  if(s[0]==t[0]) n++;
  if(s[1]==t[1]) n++;
  if(s[2]==t[2]) n++;

  cout << n << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n,m;
  cin >> n >> m;
  
  priority_queue<int> q;
  
  int a;
  for(int i=0; i<n; i++){
    cin >> a;
    q.push(a);
  }
  
  int c;
  while(m > 0){
    c = q.top();
    q.pop();
    q.push(c/2);
    m--;
  }
  
  long long ans=0;
  while(!q.empty()){
    ans += q.top();
    q.pop();
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 892
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>

using namespace std;
struct UnionFind {
  vector<int> par;

  UnionFind(int N) : par(N) { 
    for(int i = 0; i < N; i++) par[i] = i;
  }

  int root(int x) { 
    if (par[x] == x) return x;
    return par[x] = root(par[x]);
  }

  void unite(int x, int y) { 
    int rx = root(x); 
    int ry = root(y);
    if (rx == ry) return;
    par[rx] = ry; 
  }

  bool same(int x, int y) { 
    int rx = root(x);
    int ry = root(y);
    return rx == ry;
  }
};

int main(void){

  int n,m;
  std::cin >> n >> m;
  UnionFind uft(n);
  for(int i=0; i<m; i++){
        int x, y, z;
    std::cin >> x >> y >> z;
    uft.unite(x-1,y-1);
  }

  std::set<int> s;
  for(int i=0; i<n; i++){
    s.insert(uft.root(i));
  }
  std::cout << s.size() << std::endl;

  return 0;
}


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

using namespace std;
using ll = long long;

#define all(c) (c).begin(), (c).end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define pb(e) push_back(e)
#define mp(a, b) make_pair(a, b)
#define fr first
#define sc second

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

int main() {
    int b[3];
    rep(i, 3) cin >> b[i];
    if (b[2] == 1) {
        cout << "Open" << endl;
    } else if (b[0] == 1 && b[1] == 1) {
        cout << "Open" << endl;
    } else {
        cout << "Close" << endl;
    }
    return 0;
}

Measured memory_bytes: 3056
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <algorithm>
#include <cassert>
#include <cstring>
#include <queue>
#include <cstdio>
#include <cmath>
#include <sstream>
 
using namespace std;
 
typedef long long Long;

typedef vector<int> VI;
typedef vector<VI> VVI;



int main(int argc, char *argv[]) {
	int N;
	cin >> N;
	vector<int> P(N);
	for (int &v : P) {
		cin >> v;
		v--;
	}
	vector<int> B(N, -1);
	int ma = 0;
	for (int v : P) {
		if (v == 0 || B[v-1] == -1) {
			B[v] = 1;
		} else {
			B[v] = B[v-1] + 1;
		}
		ma = max(ma, B[v]);
	}
	cout << N - ma << endl;
	
}

 


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

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int x;
  cin>>x;
  vector<bool> a(x+1);
  a[1] = 1;
  for(int i = 2; i <= x; i++){
   	int v = i*i;
    while(v <= x) {
      a[v] = true;
      v*=i;
    }
  }
  for(int i = x; i >0; i--){
    if(a[i]){
      cout << i << endl;
      return 0;
    }
  }
  return 0;
}

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

#include <string>
#include <vector>
#include <algorithm>


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

	vector< int > vec( a );

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

	sort( vec.begin(), vec.end() );


	int cnt = 0;


	for( int i=0 ; i<a ; i++ )
	{
		for( int ii=i+1 ; ii<a ; ii++ )
		{
			for( int iii=ii+1 ; iii<a ; iii++ )
			{
				if( vec[i] < vec[ii] + vec[iii] )
				{
					if( vec[ii] < vec[i] + vec[iii] )
					{
						if( vec[iii] < vec[i] + vec[ii] )
						{
							cnt++;
						}
						else break;
					}
					else break;
				}
				else break;
			}
		}
	}




	cout << cnt << endl;

	return 0;
}

Measured memory_bytes: 384
local read = setmetatable({}, {__index = function(t, k) local a = {} for i=1,#k do table.insert(a, string.sub(k, i, i)) end local r = io.read local u = table.unpack return function() return r(u(a)) end end})
local N, K = read.nn()
local count = 0
for i=1,N do
    local h = io.read("n")
    if h >= K then
        count = count + 1
    end
end
print(count)


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


long long dp[3000][3000][4];
long long res[3000][3000];
long long field[3000][3000];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
#ifndef ONLINE_JUDGE
  freopen("in", "r", stdin);
  freopen("out", "w", stdout);
#endif

  int r, c;
  cin >> r >> c;
  int k;
  cin >> k;
  for (int i = 0; i < k; ++i) {
    int x, y;
    cin >> x >> y;
    int val;
    cin >> val;
    field[x - 1][y - 1] = val;
  }
  dp[0][0][1] = field[0][0];
  for (int i = 0; i < r; ++i) {
    for (int j = 0; j < c; ++j) {
      if (j > 0) {
       for (int q = 0; q < 4; ++q) {
          dp[i][j][1] = max(dp[i][j][1], dp[i][j - 1][0] + field[i][j]);
          dp[i][j][2] = max(dp[i][j][2], dp[i][j - 1][1] + field[i][j]);
          dp[i][j][3] = max(dp[i][j][3], dp[i][j - 1][2] + field[i][j]);

          dp[i][j][1] = max(dp[i][j][1], dp[i][j - 1][1]);
          dp[i][j][2] = max(dp[i][j][2], dp[i][j - 1][2]);
          dp[i][j][3] = max(dp[i][j][3], dp[i][j - 1][3]);
        }
      }
      if (i > 0) {
        for (int q = 0; q < 4; ++q) {
          dp[i][j][1] = max(dp[i][j][1], dp[i - 1][j][q] + field[i][j]);
          dp[i][j][1] = max(dp[i][j][1], dp[i - 1][j][q] + field[i][j]);
          dp[i][j][1] = max(dp[i][j][1], dp[i - 1][j][q] + field[i][j]);

          dp[i][j][0] = max(dp[i][j][0], dp[i - 1][j][q]);
          dp[i][j][0] = max(dp[i][j][0], dp[i - 1][j][q]);
          dp[i][j][0] = max(dp[i][j][0], dp[i - 1][j][q]);
        }
      }
    }
  }
  long long ans = 0;
  for (int i = 0; i < 4; ++i) {
      ans = max(ans, dp[r - 1][c - 1][i]);
  }
  cout << ans;
  return 0;
}


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

int main(){
  int n;
  cin >> n;
  long long L[87] = {};
  L[0] = 2, L[1] = 1;
  for(int i = 2; i <= n; i++) L[i] = L[i-1] + L[i-2];
  cout << L[n] << endl;
  return 0;
}


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

#define REP(i, m, n) for(int i = (m); i < (n); i++)
#define rep(i,n) REP(i,0,n)
#define NIL -1
using namespace std;
typedef long long ll;
typedef long long int lli;
static const int MOD = 10000007;
static const int MAX = 100005;


int N;
typedef struct orderp {
  int key;
  int value;

  bool operator < ( const orderp& right ) const {
    return value > right.value;
  }
} ord;


void printset(multiset<ord> st) {
  cout << st.size() << ":";
  for (multiset<ord>::iterator it = st.begin(); it != st.end(); it++) {
    cout << " " << (*it).key;
  }
  cout << " \n";
}
void printsetint(multiset<int> st) {
  cout << st.size() << ":";
  for (multiset<int>::iterator it = st.begin(); it != st.end(); it++) {
    cout << " " << (*it);
  }
  cout << " \n";
}


int main(){
  cin >> N;
  int P[N+1];
  multiset<ord> kt;
  multiset<int> st;

  st.insert(-1);
  st.insert(-1);
  st.insert(N);
  st.insert(N);
  rep(i, N) {
    int p;
    cin >> p;
    kt.insert({i,p});
    P[i] = p;
  }
  // printset(kt);
  lli ans = 0;
  for ( auto k : kt) {
    auto itr = st.lower_bound(k.key);
    lli idx1 = *itr;
    itr++;
    lli idx2 = *itr;
    itr--;
    itr--;
    lli idx3 = *itr;
    itr--;
    lli idx4 = *itr;
    // cout << k.key << " idx: " << idx1 << " " << idx2 << " " << idx3 << " " << idx4 << endl;
    ans += P[k.key]*(idx2 - idx1)*(k.key - idx3);
    ans += P[k.key]*(idx1 - k.key)*(idx3 - idx4);
    st.insert(k.key);
    // printsetint(st);
  }
  cout << ans << endl;

}


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

#define lli long long int
#define st first
#define nd second
#define mp make_pair
#define pb push_back
#define INF 1000000007
#define endl "\n"
#define max(aa, bb) (aa > bb ? aa : bb)
#define min(aa, bb) (aa < bb ? aa : bb)

int main(){
	// #ifndef ONLINE_JUDGE
	// freopen("zgir.gir","r",stdin);
	// freopen("zcik.cik","w",stdout);
	// #endif

	string a,b;
	cin>>a>>b;
	lli dp[a.size()+5][b.size()+5];
	memset(dp, 0, sizeof(dp));
	for (lli i = 0; i <= a.size(); i++){
		for (lli j = 0; j <= b.size(); j++){
			if(i==0 || j==0) dp[i][j]=0;
			else if(a[i-1]==b[j-1]) dp[i][j]=dp[i-1][j-1]+1;
			else dp[i][j]=max(dp[i-1][j], dp[i][j-1]);
		}
	}
	lli i=a.size();
	lli j=b.size();
	string cvp;
	while(i!=0 && j!=0){
		if(a[i-1]==b[j-1]){
			cvp.pb(a[i-1]);
			i--;
			j--;  
		 }
		else {
			if(dp[i-1][j]>dp[i][j-1]) i--;
			else j--;
		}
	}
	reverse(cvp.begin(), cvp.end());
	cout<<cvp;
}

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

typedef long long ll;
#define PI 3.1415926535897932384626433
#define mod 1000000007

int gcd(int a, int b) { return b ? gcd(b, a%b) : a; }

int lcm(int a, int b) { return a * b / gcd(a, b); }

int main(){
    ll n, a, b;
    cin >> n >> a >> b;
    if(a != b && n == 1){
        cout << 0 << endl;
        return 0;
    }
    if(a == b && n == 1){
        cout << 1 << endl;
        return 0;
    }
    if(a > b){
        cout << 0 << endl;
        return 0;
    }

    cout << (b - a) * (n - 2) + 1 << endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){

 long long int a,b,c;
 cin>>a>>b>>c;
 vector<long long int>v;
 v.push_back(a);
v.push_back(b);
v.push_back(c);
sort(v.begin(),v.end());
cout<<v[0]+v[1]<<endl;
}


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

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

    if(k % 2 == 0){
        cout << k * k / 4<< endl;
    }
    else{
        cout << (k / 2) * ((k+1) / 2) << endl;
    }

}



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

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second

template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }

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

const ll INF = 1ll<<29;
const ll MOD = 1000000007;
const bool debug = 0;

int N, X, Y, Z;
bool f[3][100];

int main() {
	cin >> N;
	cin >> X;
	REP(i, X) {
		int a;
		scanf("%d", &a);
		f[0][a - 1] = true;
	}
	
	cin >> Y;
	REP(i, Y) {
		int b;
		scanf("%d", &b);
		f[1][b - 1] = true;
	}
	
	cin >> Z;
	REP(i, Z) {
		int c;
		scanf("%d", &c);
		f[2][c - 1] = true;
	}
	
	int ans = 0;
	REP(i, N) {
		if ((!f[0][i] && f[2][i]) || (f[1][i] && f[2][i])) ans++;
	}
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 3224
#include <bits/stdc++.h>
using namespace std;
long long a, b, c;
int main() {
    cin >> a >> b >> c;
    if(a == b && b == c) {
        if(a % 2 == 0) {
            cout << -1 << endl;
        }else {
            cout << 0 << endl;
        }
    }else {
        int cnt = 0;
        while(1) {
            if(a % 2 == 1 || b % 2 == 1 || c % 2 == 1) {
                break;
            }
            long long halfa = a/2;
            long long halfb = b/2;
            long long halfc = c/2;
            a = halfb + halfc;
            b = halfa + halfc;
            c = halfa + halfb;
            cnt++;
        }
        cout << cnt << endl;
    }
}

Measured memory_bytes: 256
/*
    Author:zeke
    
    pass System Test!
    GET AC!!
*/
#include <iostream>
#include <queue>
#include <vector>
#include <iostream>
#include <vector>
#include <string>
#include <cassert>
#include <algorithm>
#include <functional>
#include <cmath>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <map>
#include <iomanip>
#include <utility>
#include <stack>
#include <bitset>
using ll = long long;
using ld = long double;
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define rep3(var, min, max) for (ll(var) = (min); (var) < (max); ++(var))
#define repi3(var, min, max) for (ll(var) = (max)-1; (var) + 1 > (min); --(var))
#define Mp(a, b) make_pair((a), (b))
#define F first
#define S second
#define Icin(s) \
    ll(s);      \
    cin >> (s);
#define Scin(s) \
    ll(s);      \
    cin >> (s);
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;
}
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef vector<V> VV;
typedef vector<P> VP;
ll mod = 1e9 + 7;
ll MOD = 1e9 + 7;
ll INF = 1e18;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s,t;
    cin >> s >> t;
    VV reg(26);
    rep(i,s.size()){
        reg[s[i] - 'a'].push_back(i + 1);
    }
    ll regclu = 0;
    ll regodd = 0;
    rep(i,t.size()){
        ll S = reg[t[i] - 'a'].size();
        if (S== 0)
        {
            cout<<-1<<endl;
            return 0;
        }
        ll odd = lower_bound(all(reg[t[i] - 'a']), regodd) - reg[t[i] - 'a'].begin();
        if (odd == reg[t[i] - 'a'].size()){
            regclu++;
            regodd = reg[t[i] - 'a'][0] + 1;
        }else{
            regodd = reg[t[i] - 'a'][odd]+1;
        }
    }
    cout << regclu * s.size() + regodd -1 << endl;
}


Measured memory_bytes: 1736
#include<iostream>
#include<cstdio>
#include<cstring>
typedef long long ll;
const int N=55,MOD=1000000007;
char s[2][N];
int a[N];
ll f[N],ans;
int n,tot;
int main()
{
	scanf("%d",&n);
	scanf("%s",s[0]);
	scanf("%s",s[1]);
	tot=0;
	for(int i=0;i<n;)
		if(s[0][i]==s[1][i])a[++tot]=1,i++;
		else a[++tot]=2,i+=2;
	f[1]=a[1]*3;
	for(int i=1;i<=tot;i++)
	{
		if(a[i]==a[i+1] && a[i]==1)f[i+1]=f[i]*2%MOD;
		else if(a[i]==a[i+1] && a[i]==2)f[i+1]=f[i]*3%MOD;
		else if(a[i]==1)f[i+1]=f[i]*2%MOD;
		else f[i+1]=f[i];
	}
	printf("%lld\n",f[tot]);
	return 0;
}


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

using namespace std;
typedef long long ll;

int main(void) {
  ll n, q, s, t;
  cin >> n >> q >> s >> t;
  
  vector<ll> a(n + 2, 0);
  for (int i = 0; i < n + 1; i++) {
    cin >> a[i];
    a[i] *= -1;
  }
  for (int i = n + 1; i > 0; i--) {
    a[i] -= a[i - 1];
  }

  ll T = 0;
  for (int i = 0; i < n + 2; i++) {
    if (a[i] >= 0) T += a[i] * t;
    else T += a[i] * s;
  }

  for (int i = 0; i < q; i++) {
    ll l, r, x;
    cin >> l >> r >> x;
    if (a[l] >= 0) T -= a[l] * t;
    else T -= a[l] * s;
    a[l] -= x;
    if (a[l] >= 0) T += a[l] * t;
    else T += a[l] * s;
    if (a[r + 1] >= 0) T -= a[r + 1] * t;
    else T -= a[r + 1] * s;
    a[r + 1] += x;
    if (a[r + 1] >= 0) T += a[r + 1] * t;
    else T += a[r + 1] * s;

    ll ans = T;
    if (a[n + 1] >= 0) ans -= a[n + 1] * t;
    else ans -= a[n + 1] * s;
    cout << ans << endl;
  }

  return 0;
}


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

int main(){
  int x,a;
  cin >> x >> a;
  if(x<a)cout << 0 << endl;
  else cout << 10 << endl;
}


Measured memory_bytes: 3576
#include <iostream>
#include <stdio.h>

#include <vector>
#include <cctype>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <string>
#include <map>
#include <climits>

using namespace std;

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

	vector<long long> arr(n);

	for (int i = 0; i < n; i++) {
		cin >> arr[i];	
	}

	vector<long long> sum(n+1);
	sum[0] = 0;

	for (int i = 0; i < n; i++) {
		sum[i + 1] = (sum[i] + arr[i])%1000000007;
	}
	
	long long ans = 0;
	
	for (int i = 0; i < n-1;i++) {
			ans += ((arr[i] % 1000000007) * (sum[n]-sum[i+1])) % 1000000007;
			ans = ans % 1000000007;
	}

	if (ans < 0)ans=ans + 1000000007;

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 6380
#include<iostream>
#include<vector>
#include<algorithm>
#include<math.h>
#include<queue>
#include<numeric>
#include<string>
#define all(x) (x).begin(),(x).end()
typedef long long ll;
const ll MOD = 1000000007;
 
using namespace std;

int main()
{
    ll X, Y;    cin >> X >> Y;
    int cnt = 0;
    while(X <= Y){
        X *= 2;
        cnt++;
    }
    cout << cnt << endl;
    return 0;
}

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

int main() {
  int n;
  cin >> n;
  vector<P> p;
  vector<P> p2;
  rep(i, n) {
    int a, b;
    cin >> a >> b;
    p.push_back(P(a, b));
    p2.push_back(P(b, a));
  }
  sort(p.begin(), p.end());
  sort(p2.begin(), p2.end());
  if (n % 2 == 1) {
    int a = p[n / 2].first;
    int b = p2[n / 2].first;
    // cout << a << " " << b << endl;
    cout << (b - a) + 1 << endl;
  } else {
    double a = (double)(p[n / 2 - 1].first + p[n / 2].first) / 2;
    double b = (double)(p2[n / 2 - 1].first + p2[n / 2].first) / 2;
    // cout << a << " " << b << endl;
    cout << (int)((b - a) * 2) + 1 << endl;
  }
}

Measured memory_bytes: 6644
# coding: utf-8
# submission # - User: herp_sy
# https://atcoder.jp/contests/
#
# lang: Python3 (3.4.3)

def gcd(a,b):
  if a == 0:
    return b
  elif b == 0:
    return a
  else:
    return gcd(b,a % b)

a,b = map(int, input().split())
print(int(a / gcd(a,b) * b))


Measured memory_bytes: 2940
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<queue>
#include<cmath>
#include<map>
#include<cstdlib>
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long ll;
int gcd(int a,int b)
{
    return b?gcd(b,a%b):a;
}
int a[100000+5];
int main()
{
    int n;
    scanf("%d",&n);
    n++;
    for(int i=0;i<n;i++)
        scanf("%d",&a[i]);
    sort(a,a+n);
    int g=a[1]-a[0];
    for(int i=1;i<n-1;i++)
    {
        g=gcd(g,a[i+1]-a[i]);
    }
    printf("%d\n",g);
    return 0;
}


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


void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif

#define rep(i, n)    for(int i = 0; i < (n); ++i)
#define repA(i, a, n)  for(int i = a; i <= (n); ++i)
#define repD(i, a, n)  for(int i = a; i >= (n); --i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
#define fill(a)  memset(a, 0, sizeof (a))
#define fst first
#define snd second
#define mp make_pair
#define pb push_back
typedef long double ld;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

void pre(){


}

vector<pii> v;

int main() {
	cin.sync_with_stdio(0); cin.tie(0);
	cin.exceptions(cin.failbit);
	pre();
	int n;cin>>n;
	rep(i,n) {
		ld x;cin>>x;
		ll y = x*1e9+0.5;
		int c2 = -9,c5=-9;
		while(y%2==0) {
			c2++;
			y/=2;
		}
		while(y%5==0){
			c5++;
			y/=5;
		}
		v.pb(mp(c2,c5));
	}
	map<pii,ll> m;
	ll ans = 0;
	trav(i,v){
		trav(j,m){
			if(i.fst+j.fst.fst>=0&&i.snd+j.fst.snd>=0) ans+=j.snd;
		}
		m[i]++;
	}
	cout<<ans;
	return 0;
}



Measured memory_bytes: 5384
#include<iostream>
#include<algorithm>
#include<vector>
#include<numeric>
#include<string>
#include<cmath>
#include<set>
#include<queue>
#include<deque>
#include<bitset>
#include<iomanip>
#include<cctype>
#include<map>
#include<cstring>

#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(x) (x).begin(),(x).end()

using namespace std;
using ll = long long int;

const int inf = 1001001000;
const long long int Inf = 1001001001001001000;


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

void print(vector<vector<long long int>> a){
	for (int i=0;i<a.size();i++){
		for (int j=0;j<a[i].size();j++){
			cout << a[i][j] << " ";
		}
		cout << endl;
	}
}

void print(vector<int> a){
    int n = a.size();
    for (int j=0;j<n;j++) {
        if (j != n-1) cout << a[j] << " ";
        else cout << a[j] << endl;
    }
}

void print(set<int> a){
	for (auto x:a)
		cout << x << " ";
	cout << endl;
}

//mod計算用のクラス
class ModInt{
public:
    long long int x;
    long long int mod;
	ModInt(){}
    ModInt(long long int _x, long long int _mod = 1000000007){
        this->x = _x % _mod;
        this->mod = _mod;
    }
	ModInt operator+(ModInt other){
		return ModInt(this->x + (other.x % this->mod),this->mod);
	}
	ModInt operator-(ModInt other){
		long long int res = this->x - (other.x % this->mod);
		if (res < 0) return ModInt(res + this->mod, this->mod);
		return ModInt(res);
	}
	ModInt operator*(ModInt other){
		return ModInt(this->x * (other.x % this->mod),this->mod);
	}
	ModInt operator/(ModInt other){
		return ModInt(*this * other.inv());
	}
	ModInt pow(long long int n){
		ModInt res(1, this->mod), a(this->x, this->mod);
		while (n){
			if (n & 1){
				res = res * a;
			}
			n >>= 1;
			a = a * a;
		}
		return res;
	}
	ModInt inv(){
		return ModInt(this->pow(this->mod - 2));
	}
	void disp(){
		cout << this->x << endl;
	}
};
ostream& operator<<(ostream& stream, const ModInt m){
	stream << to_string(m.x);
	return stream;
}

//最大公約数を返す関数.
long long int gcd(long long int x, long long int y){
    if (x < y) swap(x,y);
    while (y > 0){
        long long int r = x % y;
        x = y;
        y = r;
    }
    return x;
}

int main() {
	int n;
	cin >> n;
	string s;
	cin >> 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 <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

using namespace std;

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

// This code performs maximum bipartite matching.
//
// Running time: O(|E| |V|) -- often much faster in practice
//
//   INPUT: w[i][j] = edge between row node i and column node j
//   OUTPUT: mr[i] = assignment for row node i, -1 if unassigned
//           mc[j] = assignment for column node j, -1 if unassigned
//           function returns number of matches made

typedef vector<int> VI;
typedef vector<VI> VVI;

bool FindMatch(int i, const VVI &w, VI &mr, VI &mc, VI &seen) {
  for (int j = 0; j < w[i].size(); j++) {
    if (w[i][j] && !seen[j]) {
      seen[j] = true;
      if (mc[j] < 0 || FindMatch(mc[j], w, mr, mc, seen)) {
        mr[i] = j;
        mc[j] = i;
        return true;
      }
    }
  }
  return false;
}

int BipartiteMatching(const VVI &w) {
  VI mr = VI(w.size(), -1);
  VI mc = VI(w[0].size(), -1);
  
  int ct = 0;
  for (int i = 0; i < w.size(); i++) {
    VI seen(w[0].size());
    if (FindMatch(i, w, mr, mc, seen)) ct++;
  }
  return ct;
}

set<int> P;
const int B = 1E7 + 10;
bool sieve[B];

int main() {
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    set<int> M;
    for (int i = 0;i < N;i++) {
    	int n;
    	cin >> n;
    	M.insert(n);
    }
    memset(sieve, 0, sizeof(sieve));
    for (int i = 2;i < B;i++) {
    	if (sieve[i] == 0) {
    		for (int j = i;j < B;j += i) sieve[j] = 1;
    		if (i % 2) P.insert(i);
    	}
    }
    set<int> Q;
    for (auto m : M) {
    	if (M.count(m - 1) == 0) Q.insert(m - 1);
    	if (M.count(m + 1) == 0) Q.insert(m);
    }
    vector<int> R;
    for (auto m : Q) R.push_back(m);
    int sz = R.size();
    vector<int> o, e;
    for (int i = 0;i < sz;i++) {
    	if (R[i] % 2) o.push_back(R[i]);
    	else e.push_back(R[i]);
    }
    vector<int> tmp(e.size(), 0);
    vector<vector<int> > T(o.size(), tmp);
    for (int i = 0;i < o.size();i++) {
    	for (int j = 0;j < e.size();j++) {
    		if (P.count(abs(o[i] - e[j]))) T[i][j] = 1;
    	}
    }
    int mc = 0;
    if (o.size() > 0 && e.size() > 0) mc = BipartiteMatching(T);
    int oo = o.size() - mc;
    int ee = e.size() - mc;
    cout << mc + 2 * (oo / 2 + ee / 2) + 3 * (oo % 2) << endl;
    return 0;
}

Measured memory_bytes: 41352
#include <iostream>                                                                              
#include <string>                                                                                
                                                                                                 
using namespace std;                                                                             
                                                                                                 
int main (void) {                                                                                
  int n;                                                                                         
  string tcard, hcard;                                                                           
  int tpoint=0, hpoint=0;                                                                        
  cin >> n;                                                                                      
  for (int i=0; i<n; i++) {                                                                      
    cin >> tcard >> hcard;                                                                       
    if (tcard == hcard) {                                                                        
      tpoint++;                                                                                  
      hpoint++;                                                                                  
    } else if (tcard > hcard) {                                                                  
      tpoint += 3;                                                                               
    } else {                                                                                     
      hpoint += 3;                                                                               
    }                                                                                            
  }                                                                                              
  cout << tpoint << " " << hpoint << endl;                                                       
}                                                                                                
                             

Measured memory_bytes: 3136
N, A = map(int, input().split())
x = list(map(int, input().split()))

plus = []
minus = []
num_zero = 0
for i in range(N):
    xi_A = x[i] - A
    if xi_A > 0:
        plus.append(xi_A)
    elif xi_A < 0:
        minus.append(xi_A)
    else:
        num_zero += 1

dp_plus = [[0 for _ in range(2501)] for _ in range(len(plus) + 1)]
dp_minus = [[0 for _ in range(2501)] for _ in range(len(minus) + 1)]
dp_plus[0][0] = 1
dp_minus[0][0] = 1
for i in range(1, len(plus) + 1):
    for j in range(2501):
        dp_plus[i][j] += dp_plus[i-1][j]
        if j + plus[i-1] <= 2500:
            dp_plus[i][j + plus[i-1]] += dp_plus[i-1][j]
for i in range(1, len(minus) + 1):
    for j in range(2501):
        dp_minus[i][j] += dp_minus[i-1][j]
        if j - minus[i - 1] <= 2500:
            dp_minus[i][j - minus[i-1]] += dp_minus[i-1][j]

ans = 0
for i in range(2501):
    ans += dp_plus[-1][i] * dp_minus[-1][i] * (2 ** num_zero)
print(ans - 1)


Measured memory_bytes: 41264
//#pragma GCC optimize ("O3")
//#pragma GCC target ("sse4")

#include <bits/stdc++.h>

using namespace std;

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int a;
    string s;
    cin >> a >> s;
    if(a >= 3200)
    {
        cout << s;
    }
    else
    {
        cout << "red";
    }
    


    return 0;
}

Measured memory_bytes: 256
// In the name of God

#include <iostream>
#include <algorithm>
#include <fstream>
#include <vector>
#include <deque>
#include <assert.h>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <stdio.h>
#include <string.h>
#include <utility>
#include <math.h>
#include <bitset>
#include <iomanip>

using namespace std;

const int N = (int) 0, mod = (int) 0;

int32_t main() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int n;
    cin >> n;
    int res = 0;
    while (n--) {
        int x;
        cin >> x;
        res ^= x & 1;
    }
    cout << (res ^ 1? "YES\n": "NO\n");
}



Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <ctime>
#include <cassert>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>
#include <list>
#include <functional>


#ifdef _DEBUG
#define typeof(X) std::identity<decltype(X)>::type //C++0x (for vs2010)
#else
#define typeof(X) __typeof__(X) // for gcc
#endif

using namespace std;
static const double EPS = 1e-6;
typedef long long ll;
const int MODULO = 1000000007;
const int INF = 100000000; //1e8

typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
typedef complex<double> Cd;

char s[12][14];
int dx[] = {1,-1,0,0};
int dy[] = {0,0,1,-1};

void dfs(int y,int x){
	s[y][x] = '0';
	for (int i = 0; i < 4; i++){
		int nx = x + dx[i];
		int ny = y + dy[i];
		if(nx >= 0 && nx < 12 && ny >= 0 && ny < 12 && s[ny][nx] == '1'){
			dfs(ny,nx);
		}
	}
}

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

	return 0;
}

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

using namespace std;

template< typename T >
struct edge
{
  int src, to;
  T cost;

  edge(int to, T cost) : src(-1), to(to), cost(cost) {}

  edge(int src, int to, T cost) : src(src), to(to), cost(cost) {}

  operator int() const { return to; }
};

template< typename T >
using Edges = vector< edge< T > >;
template< typename T >
using WeightedGraph = vector< Edges< T > >;
using UnWeightedGraph = vector< vector< int > >;
template< typename T >
using Matrix = vector< vector< T > >;


template< typename T >
vector< T > shortest_path_faster_algorithm(WeightedGraph< T > &g, int s)
{
  const auto INF = numeric_limits< T >::max();
  vector< T > dist(g.size(), INF);
  vector< int > pending(g.size(), 0), times(g.size(), 0);
  queue< int > que;

  que.emplace(s);
  pending[s] = true;
  ++times[s];
  dist[s] = 0;

  while(!que.empty()) {
    int p = que.front();
    que.pop();
    pending[p] = false;
    for(auto &e : g[p]) {
      T next_cost = dist[p] + e.cost;
      if(next_cost >= dist[e.to]) continue;
      dist[e.to] = next_cost;
      if(!pending[e.to]) {
        if(++times[e.to] >= g.size()) return vector< T >();
        pending[e.to] = true;
        que.emplace(e.to);
      }
    }
  }
  return dist;
}


int main()
{
  int V, E, S;
  scanf("%d %d %d", &V, &E, &S);
  WeightedGraph< int > g(V);
  for(int i = 0; i < E; i++) {
    int x, y, z;
    scanf("%d %d %d", &x, &y, &z);
    g[x].emplace_back(y, z);
  }
  auto cost = shortest_path_faster_algorithm(g, S);
  if(cost.empty()) {
    puts("NEGATIVE CYCLE");
  } else {
    for(int i = 0; i < V; i++) {
      if(cost[i] == numeric_limits< int >::max()) puts("INF");
      else printf("%d\n", cost[i]);
    }
  }
}




Measured memory_bytes: 3312
#include <iostream>
#include <cmath>
#include <algorithm>
#include <utility>
#include <vector>
#define rep(i, n)   for(int i = 0; i < (n); i++)
using namespace std;

int main(){
    int n;  cin >> n;
    vector<vector<pair<int, int> > >dic(n);
    rep(i, n){
        int a;  cin >> a;
        rep(j, a){
            int x,y;
            cin >> x >> y;
            dic[i].push_back(pair<int, int>(--x, y));
        }
    }
    //solve
    int ans = 0;
    vector<int>tmp(n);  //計算用の仮正直者
    for(int i = 0; i < (1 << n); i++){
        //正直者セット
        rep(j, n){
            if(i & (1 << j)){
                tmp[j] = 1;
            }else{
                tmp[j] = 0;
            }
        }
        //矛盾調査
        bool flag = true;
        for(int j = 0; j < n && flag; j++){
            rep(k, dic[j].size()){
                int aite = dic[j][k].first;
                if(tmp[j]){
                    if(tmp[aite] != dic[j][k].second){
                        flag = false;
                        break;
                    }
                }
            }
        }
        if(flag){
            int anstmp = 0;
            rep(j, n){
                if(tmp[j])  anstmp++;
            }
            ans = max(ans, anstmp);
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
char c[1010];
while (cin >>c) {
for (int i = 0; c[i] != '\0'; i++) {
char ch = c[i] - 3;
if (ch < 'A') ch += 26;
cout << ch;
}
cout << endl;
}
return 0;
}



Measured memory_bytes: 3080
def is_circle_in_a_rectangle(W:int, H:int, x:int, y:int, r:int) -> bool:
    if x - r < 0:
        return False
    if y - r < 0:
        return False
    if x + r > W:
        return False
    if y + r > H:
        return False
    return True

if __name__ == "__main__":
    in_str = input()
    in_str = in_str.split()

    W = int(in_str[0])
    H = int(in_str[1])
    x = int(in_str[2])
    y = int(in_str[3])
    r = int(in_str[4])

    if W < 0:
        raise ValueError('Parameter W is less than 0.')
    if W > 100:
        raise ValueError('Parameter W is larger than 100.')
    if H < 0:
        raise ValueError('Parameter H is less than 0.')
    if H > 100:
        raise ValueError('Parameter H is larger than 100.')
    if x < -100:
        raise ValueError('Parameter x is less than -100.')
    if x > 100:
        raise ValueError('Parameter x is larger than 100.')
    if y < -100:
        raise ValueError('Parameter y is less than -100.')
    if y > 100:
        raise ValueError('Parameter y is larger than 100.')
    if r < 0:
        raise ValueError('Parameter r is less than 0.')
    if r > 100:
        raise ValueError('Parameter r is larger than 100.')

    if is_circle_in_a_rectangle(W, H, x, y, r):
        print('Yes')
    else:
        print('No')



Measured memory_bytes: 5608
# 頂点および辺の数を入力
N, M = map(int, input().split())
# 辺のリストを作成
list_edge = [[] for _ in range(N + 1)]
for _ in range(M):
    a, b = map(int, input().split())
    list_edge[a].append(b)
    list_edge[b].append(a)
# パス（リスト）のリストを初期化
list_path = [[1]]
# パスが存在する、かつパスの長さが頂点の数未満である場合に繰り返し
while list_path != [] and len(list_path[0]) < N:
    # パスのリストから先頭のパスを取り出す
    path = list_path.pop(0)
    # パスの最後尾の頂点から訪問可能な頂点について、、
    for node in list_edge[path[-1]]:
        # その頂点にまだ訪問していない場合、、
        if node not in path:
            # パスのリストに新たなパスを加える
            list_path.append(path + [node])
# パスの数を出力する
print(len(list_path))

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

int main(){
  int k,s,v=0;
  cin >> k >> s;
  for(int i=0;i<s+1;i++){
    for(int j=0;j<s-i+1;j++){
      if(j<k+1 && i<k+1 && s-i-j<k+1){
        v++;
      }
    }
  }
  cout << v << endl;
}


Measured memory_bytes: 256
ls = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
num = input()
print(ls[int(num)-1])


Measured memory_bytes: 2940