akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n ; i++)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define whole(f, x, ...) ([&](decltype((x)) whole) { return (f)(begin(whole), end(whole), ## __VA_ARGS__); })(x) // decltypeで型取得、引数があればva_argsのところに入れる
using namespace std;
typedef long long ll; // long longをllでかけるようにした
const int INF = 1e9;

int main(void){
    int n; cin >> n;
    int first = 0, second = 0, youso;
    vector<int> A(n);
    REP(i, n){
        cin >> A[i];
        if(first <= A[i]){
            second = first;
            first = A[i];
            youso = i;
        }
        else if(second <= A[i]) second = A[i];
    }
    REP(i, n){
        if(youso == i) cout << second << endl;
        else cout << first << endl;
    }
}

Measured memory_bytes: 2432
#include <stdio.h>
int main(void){
	int l, r, d;
	int x = 0;
	scanf("%d", &l);
	scanf("%d", &r);
	scanf("%d", &d);
	for(int i=l; i<=r; i++){
		if(i%d == 0){
			x++;
		}
	}
	printf("%d\n", x);
	return 0;
}

Measured memory_bytes: 1728
#include "bits/stdc++.h"
using namespace std;

struct Solver {
	Solver() {
		ios::sync_with_stdio( false );
		cout << fixed << setprecision( 10 );
	}

	void solve() {
		int N, H, W;
		cin >> N >> H >> W;
		int ans = 0;
		for( int i = 0; i < N; ++i ) {
			int a, b;
			cin >> a >> b;
			ans += a >= H && b >= W;
		}
		cout << ans << endl;
	}
};

int main() {
	Solver().solve();
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<math.h>
#include<vector>
#include<array>
#include<algorithm>
#include<numeric>
#include<map>
#include<queue>
#include<deque>
#include<set>
#include<cstdio>
#include<cstring>
#include<string>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vector<ll>> mat;

int main(){
    int N;cin>>N;
    vec P(200010);
    ll m=pow(10,9),ans=0;
    for(int i=0;i<N;i++){
        cin>>P[i];
        if(P[i]<=m){ans++;}
        m=min(m,P[i]);
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define rep(i, n) for(long long i = 0; i < n; i++)
using ll = long long;
using ld = long double;
using namespace std;
int main() {
  ll N, T, X;
  cin >> N >> T;
  X = T;
  vector<int>t(N), u(N - 1);
  rep(i, N) {cin >> t.at(i);}
  rep(i, N - 1) {u.at(i) = t.at(i + 1) - t.at(i);}
  rep(i, N - 1) {
    if (u.at(i) < T) {X += u.at(i);}
    else {X += T;}
  }
  cout << X << endl;
}


Measured memory_bytes: 4720
from collections import deque
N = int(input())
adj = [[] for _ in range(N)]
for i in range(N-1):
    a, b = map(int, input().split())
    adj[a-1].append((b, i))
    adj[b-1].append((a, i))
# print(adj)
color = [0]*N
visited = [False]*N
visited[0] = True
queue = deque([1])
ans = [0]*(N-1)
while queue:
    now = queue.popleft()
    cnt = 1
    for n, e in adj[now-1]:
        if visited[n-1]:
            continue
        if color[now-1] == cnt:
            cnt += 1
        color[n-1] = cnt
        visited[n-1] = True
        ans[e] = cnt
        cnt += 1
        queue.append(n)
print(max(color))
print(*ans, sep='\n')

Measured memory_bytes: 42448
while True:
    n=int(input())
    if n==0:
        break
    for i in range(n):
        m,e,j=map(int,input().split())
        if m==100 or e==100 or j==100 or (m+e)//2>=90 or (m+e+j)//3>=80:
            print("A")
        elif (m+e+j)//3>=70 or (m+e+j)//3>=50 and m>=80 or e>=80:
            print("B")
        else:
            print("C")


Measured memory_bytes: 5612
object Main extends App {
  val nk = scala.io.StdIn.readLine()
  val nkArray = nk.split(" ").map(_.toInt).toVector
  val k = nkArray(1)

  val h = scala.io.StdIn.readLine()
  val hArray = h.split(" ").map(_.toInt).toVector
  println(hArray.filter(_ >= k).size)
}

Measured memory_bytes: 41808
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i = 0; i < (N); i++)
#define repo(i,N) for(int i = 1; i < (N); i++)
//#define int long long
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
//#define num 1000000007
#define pi acos(-1.0)
//cout << fixed << setprecision (10);   小数点以下１０桁まで
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//'大文字'+=32;    で小文字に
//string s = to_string(int数);
//int n = stoi(string文字列);

int main() {
  int n;
  cin >>n;
  
  vector<pair<string,int>> res(n);
  
  rep(i,n) {
  cin >> res.at(i).fi;
  int x;
  cin >> x;
  res.at(i).se = -x;
  }
  
  auto copy = res;
  
  sort(all(res));
  
  rep(i,n) {
    rep(j,n) {
      if (res.at(i) == copy.at(j)) {
      cout << j+1 << endl;
      }
    }
  }
  
}

Measured memory_bytes: 256
use proconio::{fastout, input};

#[fastout]
fn main() {
    input! {in_n: i64};
    let mut count = 0;

    if in_n <= 4 {
        println!("{}", in_n - 1);
        return;
    }

    for p in 2..=in_n {
        if p * p > in_n {
            break;
        }

        if in_n % p != 0 {
            continue;
        }

        let q = in_n / p;
        let mut n = in_n;
        let mut m = in_n;

        while n % p == 0 {
            n /= p;
        }

        while m % q == 0 {
            m /= q;
        }

        if n % p == 1 {
            count += 1;
        }

        if m != q && p % q == 1 {
            count += q;
        }
    }

    for p in 2..=in_n {
        if p * p > in_n {
            break;
        }

        if in_n % p != 1 {
            continue;
        }

        let q = (in_n - 1) / p;

        if p == q {
            count += 1;
        } else {
            count += 2;
        }
    }

    println!("{}", count + 2);
}


Measured memory_bytes: 2200
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
const lint MAX = 1000001;
const lint MOD = 1000000007;

lint fac[MAX], finv[MAX], inv[MAX];

void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (lint i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

lint COM(lint n, lint k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

signed main(){
	lint N, x, y; cin >> N;
	COMinit();
	vector<lint> data(100010, 0), a(N + 1);
	for(lint i = 0; i <= N; i++){
		cin >> a[i];
		if(data[a[i]] != 0) y = i; data[a[i]]++; 
	}
	for(lint i = 0; i <= N; i++){
		if(a[i] == a[y]) {
			x = i; break;
		}
	}
	for(lint k = 1; k <= N + 1; k++){
		lint ans = COM(N + 1, k) - COM(N - y + x, k - 1) + MOD;
		ans %= MOD;
		cout << ans << endl;
	}
}

Measured memory_bytes: 26240
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <map>
#include <numeric>
#include <cmath>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <complex>
#include <string.h>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <iomanip>
#include <sys/time.h>
#include <tuple>
#include <random>
using namespace std;

#define endl '\n'
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define UNIQ(v) (v).erase(unique((v).begin(), (v).end()), (v).end())

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, int> T;
typedef complex<double> comp;
typedef vector< vector<ld> > matrix;
struct pairhash {
public:
    template<typename T, typename U>
    size_t operator()(const pair<T, U> &x) const {
	size_t seed = hash<T>()(x.first);
	return hash<U>()(x.second) + 0x9e3779b9 + (seed<<6) + (seed>>2);
    }
};
const int inf = 1e9 + 9;
const ll mod = 1e9 + 7;
const double eps = 1e-8;
const double pi = acos(-1);

ll n;

vector<ll> divisor(ll n) {
    vector<ll> res;
    for (ll i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            res.push_back(i);
            if (i != n/i) res.push_back(n/i);
        }
    }
    return res;
}

ll solve() {
    vector<ll> d0 = divisor(n);
    vector<ll> d1 = divisor(n-1);
    ll res = (ll)d1.size() - 1;

    for (ll v : d0) {
        if (v == 1) continue;
        ll m = n;
        while (m % v == 0) m /= v;
        if (m % v == 1)
            res++;
    }
    return res;
}

void input() {
    cin >> n;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(15);

    input();
    cout << solve() << endl;
}


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

using namespace std;

typedef vector<int> vi;

int N;
vi A;
int main() {
    cin >> N;
    A = vi(N);
    for (int i = 0; i < N; ++i) cin >> A[i];
    int mx = *max_element(A.begin(), A.end()), mn = *min_element(A.begin(), A.end());
    if (mx-mn > 1) {
        cout << "No" << endl;
        return 0;
    }
    if (mx == mn) {
        bool ans = false;
        if (mx == N-1) ans = true; // 全部別の色
        else if (mx <= N/2) ans = true; // 全色複数個ある
        cout << (ans ? "Yes" : "No") << endl;
        return 0;
    }
    int count = 0;
    for (int i = 0; i < N; ++i) if (A[i] == mn) count++;
    bool ans = (N-count)/2+count >= mx && count < mx;
    cout << (ans ? "Yes" : "No") << endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
 
using namespace std;
 
int main(int argc, char *argv[])
{
    // input from txt （提出時にこの箇所は削除すること）
    //ifstream in("in.txt");
    //cin.rdbuf(in.rdbuf());
 
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int N, K;
    cin >> N >> K;
    long long a[20] = {0};
    
    for (int i = 0; i < N; i++) {
        cin >> a[i];
    }
    const long long INF = 0xfffffffffffff;

    long long min_cost = INF;
    
    for (int i = 0; i < (1 << (N - 1)); i++) {
        bitset<15> bits(i);
        int visible = (int) bits.count() + 1;
        
        long long max_height = a[0];
        long long cost = 0;
        for (int j = 0; j < N - 1; j++) {
            if (!(i & (0x1 << j))) {
                if (a[j + 1] > max_height) {
                    max_height = a[j + 1];
                    visible++;
                    continue;
                }
                continue;
            }
            
            if (a[j + 1] > max_height) {
                max_height = a[j + 1];
                continue;
            }
            
            cost += max_height - a[j + 1] + 1;
            max_height++;
            
        }
        if (visible < K) {
            continue;
        }
        min_cost = min(min_cost, cost);
        
    }
    
    cout << min_cost << endl;
    
    
    return 0;
}


Measured memory_bytes: 3588
#include <stdio.h>
#include <iostream>
#include <math.h>
#include <string>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <queue>

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

int check_div_2(ll a){
  int cnt = 0;
  while(a%2 == 0){
    cnt++;
    a/=2;
  }
  return cnt;
}

int main() {
  int N;
  cin >> N;
  ll ans = 0, tmp;
  rep(i, N){
    cin >> tmp;
    ans += check_div_2(tmp);
  }
  cout << ans << endl;

}


Measured memory_bytes: 256
// 解き直し.
// AGC024解説.
// https://img.atcoder.jp/agc024/editorial.pdf
#include <bits/stdc++.h>
using namespace std;
const int MAX = 2e5 + 1;
int dp[MAX], P[MAX];

int main() {
    
    // 1. 入力情報取得.
    int N;
    cin >> N;
    for(int i = 1; i <= N; i++) cin >> P[i];
    
    // 2. 解説通り.
    int ans = 0;
    for(int i = 1; i <= N; i++){
        int p = P[i];
        dp[p] = dp[p - 1] + 1;
        ans = max(ans, dp[p]);
    }
    
    // 3. 最終要素を出力.
    cout << N - ans << endl;
    return 0;
    
}

Measured memory_bytes: 1792
#include <stdio.h>

int main(void)
{
	int i=0,c=0;
	char s[101];

	scanf("%s", s);

	printf("%c", s[0]);
	while (s[++i])
		c++;
	printf("%d",c-1);
	printf("%c\n",s[c]);

	return 0;
}

Measured memory_bytes: 128
n,k = map(int,input().split())
dpw = [[0]*(4*k+1) for i in range(4*k+1)]
for i in range(n):
  x,y,c = map(str,input().split())
  x = int(x)
  y = int(y)
  if c == "W":
    dpw[x%(2*k)+1][y%(2*k)+1] += 1
    dpw[x%(2*k)+2*k+1][y%(2*k)+2*k+1] += 1
    dpw[x%(2*k)+2*k+1][y%(2*k)+1] += 1
    dpw[x%(2*k)+1][y%(2*k)+2*k+1] += 1
  else:
    y+=k
    dpw[x%(2*k)+1][y%(2*k)+1] += 1
    dpw[x%(2*k)+2*k+1][y%(2*k)+2*k+1] += 1
    dpw[x%(2*k)+2*k+1][y%(2*k)+1] += 1
    dpw[x%(2*k)+1][y%(2*k)+2*k+1] += 1
for i in range(1,4*k+1):
  for j in range(1,4*k+1):
    dpw[i][j] += dpw[i-1][j] + dpw[i][j-1]-dpw[i-1][j-1]
ans = 0
for i in range(1,2*k+1):
  for j in range(1,2*k+1):
    tmp = 0
    tmp += dpw[k+i-1][k+j-1]+dpw[i-1][j-1]-dpw[i-1][j+k-1]-dpw[i+k-1][j-1]
    tmp += dpw[k+i-1+k][k+j-1+k]+dpw[i-1+k][j-1+k]-dpw[i-1+k][j+k-1+k]-dpw[i+k-1+k][j-1+k]
    ans = max(ans,tmp)
print(ans)

Measured memory_bytes: 165852
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
using namespace std;
#ifndef FAST_IO
 #define IOS ios_base::sync_with_stdio(false);cin.tie(nullptr);
#endif

#define FILE_IO freopen("input.txt","r",stdin)
#define int long long
#define f first
#define s second
#define endl '\n'
#define all(c) c.begin(),c.end()
#define bp __builtin_popcount
#define debug(x) cerr << #x << " = " << x << endl;

const int MOD = 1e9 + 7;
const int INF = 1e18;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template <typename T>void print(T t){for(auto &it : t)cout<<it<<" ";}
inline int powerexp(int a, int b, int m = MOD){ int res = 1;while(b){if(b&1)res = res * a % m;a = a * a % m,b >>= 1;}return res % m;}
inline int modinv(int a){ return powerexp(a,MOD-2,MOD);}
inline int lcm(int a, int b){ int g = __gcd(a,b);return a/g*b;}
inline int add(int x, int y){ x += y; if (x >= MOD) x -=  MOD; return x;}
inline int mul(int x, int y){ return (x * 1ll * y) % MOD;}
inline int sub(int x, int y){ x -= y; if (x<0) x += MOD; return x ;}

//-------------------< start here >-------------------------// 

void solve(){
    vector<int> v;
    int n;
    cin >> n;
    for(int i = 0; i < n; i++){
	  int x;
	  cin >> x;
	  v.push_back(x);	
    }  
   int a = *min_element(all(v));
   int b = *max_element(all(v));
   int ret = 0;
   for(auto it : v) ret += it;
   cout << a << " " << b << " " << ret << endl;
}

//-----------------------------
//comment from here for TOPCODER 
int32_t main(){
   IOS;
   solve();
   //find();
   #ifdef LOCAL_DEFINE
   cerr << "time elapsed " << (double)clock()/CLOCKS_PER_SEC << endl;
   #endif
}



Measured memory_bytes: 3248
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<map>
#include<string>
#include<sstream>
using namespace std;
int inf = 1000000000;


int main(){

  string s;
  cin >> s;
  for(int i=0; i<s.size(); i++){
    if( i%2 == 0 ) cout << s[i];
  }
  cout << endl;


  return 0;
}





//


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

signed main () {
    int h, w, n, sr, sc;
    string s, t;
    cin >> h >> w >> n >> sr >> sc >> s >> t;
 
    auto func = [&](char mi, char ma, int pos, int siz) -> bool {
        int posmi = pos, posma = pos;
        for (int i = 0; i < n; ++i) {
            if (s[i] == ma)
                posma++;
            else if (s[i] == mi)
                posmi--;
            if (posma > siz)
                return true;
            if (posmi < 1)
                return true;
            if (t[i] == ma)
                posmi = min(posmi + 1, siz);
            else if (t[i] == mi)
                posma = max(posma - 1, 1);
            if (posma > siz)
                return true;
            if (posmi < 1)
                return true;
        }
        return false;
    };
 
    bool res = false;
    res |= func('U', 'D', sr, h);
    res |= func('L', 'R', sc, w);
 
    cout << (res ? "NO" : "YES") << '\n';
}


Measured memory_bytes: 776
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n - 1; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define FORR(i, m, n) for(int i = m; i >= n; i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)

ll mod = 1e09;

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

  int a, b, c;
  cin >> a >> b >> c;

  if(c >= a && c <= b) cout << "Yes";
  else cout << "No";
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define Inf 0x3f3f3f3f
#define rg register
#define pii pair<int, int>
#define mp(x, y) make_pair(x, y)
using namespace std;
typedef long long ll;
const int Maxn = 1e5 + 5;
typedef int arr[Maxn];
//ll Add(ll x, ll y) { return (x += y) >= Mod ? x - Mod : (x < 0 ? x + Mod : x); }
ll min(ll x, ll y) { return x < y ? x : y; }
ll max(ll x, ll y) { return x > y ? x : y; }
inline ll read()
{
	rg ll res = 0, sign = 1;
	rg char ch = getchar();
	while (!isdigit(ch))
	{
		if (ch == '-')
			sign = -1;
		ch = getchar();
	}
	do
	{
		res = (res << 3) + (res << 1) + (ch ^ 48);
		ch = getchar();
	} while (isdigit(ch));
	return res * sign;
}
int n, m, ac;
int wa[Maxn];
bool aced[Maxn];
char s[5];
int main()
{
	rg int a, p = 0;
	cin >> n >> m;
	for (int i = 1; i <= m; i++)
	{
		a = read();
		scanf("%s", s);
		if (s[0] == 'A')
		{
			if (!aced[a])
			{
				ac++;
				aced[a] = true;
			}
		}
		else if (!aced[a])
			wa[a]++;
	}
	for (int i = 1; i <= n; i++)
		if (aced[i])
			p += wa[i];
	cout << ac << ' ' << p << '\n';
	return 0;
}


Measured memory_bytes: 768
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
#pragma warning(disable : 4996)
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<unordered_map>
#include<unordered_set>
#include<time.h>
#include<random>
#include<array>


using namespace std;

#define REP(i, n) for(int i = 0;i < n;++i)
#define REPR(i, n) for(int i = n-1;i >= 0;--i)
#define FOR(i, m, n) for(int i = m;i < n;++i)
#define FORR(i, m, n) for(int i = m-1;i >= n;--i)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v,n) reverse(v,v+n);
#define VREVERSE(v) reverse(v.begin(), v.end())
#define ll long long
#define print(x) cout<<(x)<<'\n'
#define pe(x) cout<<(x)<<" "
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define lb(v,n) lower_bound(v.begin(), v.end(), (n))
#define ub(v,n) upper_bound(v.begin(), v.end(), (n))
#define int long long
//#define double long double
#define all(x) (x).begin(), (x).end()
#define print_space(v) REP(i,v.size())cout << v[i] << ((i == v.size() - 1) ? "\n" : " ")
template<typename T1, typename T2> inline void chmin(T1 & a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1& a, T2 b) { if (a < b) a = b; }
typedef pair<int, int>pii;
typedef array<int, 3> arr3;
std::random_device rd;
std::mt19937 mt(rd());
constexpr ll MOD = 1e9 + 7; constexpr int MAX = 2000020;
const double pi = acos(-1); constexpr double EPS = 1e-8;
constexpr ll INF = 1e18;

void test() {
	int N; cin >> N;
	FOR(K, 2, N + 1) {
		int rem = N;
		while (rem >= K) {
			if (rem%K == 0)rem /= K;
			else rem -= K;
		}
		if (rem == 1)print(K);
	}
}
void solve() {
	//test();
	int N; cin >> N;
	set<int>ans;
	ans.insert(N);
	int r = N - 1;
	ans.insert(r);
	if (r >= 2) {
		for (int i = 2; i*i <= r; i++) {
			if (r%i == 0) {
				ans.insert(i);
				ans.insert(r/i);
			}
		}
	}
	int sq = 1;
	while (sq*sq <= N)sq++;
	//print(sq);
	FOR(K, 2, sq + 1) {
		int rem = N;
		//print(K);
		while (rem >= K) {
			if (rem%K == 0)rem /= K;
			else if (rem%K != 1)break;
			else {
				rem = 1; break;
			}
		}
		if (rem == 1)ans.insert(K);
	}
	ans.erase(1);
	print(ans.size());
}

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	//int q; cin >> q;
	//while (q--)
	solve();
}




Measured memory_bytes: 256
#include<cstdio>
int main()
{
    long long n;
    scanf("%lld",&n);
    long long s=5+6;
    if(n<=6)
        printf("1\n");
    else if(n<=11)
        printf("2\n");
    else
    {
        if(n%s==0)
            printf("%lld\n",(n/s)*2);
        else
        {
            long long temp=n%s;
            long long sum=n/s;
            if(temp>6)
                printf("%lld\n",sum*2+2);
            else
                printf("%lld\n",sum*2+1);
        }
    }
    return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<stdio.h>
#include<cstring>
#include<cmath>
#include<vector>
#include<set>
#include<map>
#include<algorithm>
#include<unordered_map>
#define ll long long 
#define dd double
using namespace std;

int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  
  int n;
  cin>>n;
  int a[n];
  int i;
  int count=0;
  for(i=1;i<=n;i++){
  	cin>>a[i];
  	if(i%2!=0&&a[i]%2!=0){
  	 count++;  		
	}
	
  }
  cout<<count<<endl;
  return 0;
}

Measured memory_bytes: 3600
// Author: getharshkumar

#include <bits/stdc++.h>
using namespace std;
#define ll int64_t
const ll N = 1e6 + 6, M = 1e9 + 7;
int main()
{
    ios::sync_with_stdio(false), cin.tie(nullptr);
    ll n, d;
    cin >> n >> d;
    cout << (n - 1) / (2 * d + 1) + 1;
    return 0;
}

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

  long a,b,ans;
  a = X / 500;
  b = X % 500;
  b = b / 5;

  ans = a * 1000 + b * 5;

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


Measured memory_bytes: 256
;;; Utils

(defmacro read-numbers-to-list ()
  `(read-from-string
    (concatenate 'string "(" (read-line) ")")))


(defmacro read-line-to-array (dimension)
  (if (< dimension 0)
      (error "invalid arguments for dimension.")
      `(make-array ,dimension :initial-contents (read-numbers-to-list))))

(defmacro read-line-to--char-list ()
  `(concatenate 'list (read-line)))

(defmethod make-cumlative-sum ((sequence list))
  (labels ((inner (sequence &optional (acc '(0)))
             (if (null sequence)
                 (reverse acc)
                 (inner (rest sequence) (cons (+ (first sequence)
                                                 (first acc))
                                              acc)))))
    (inner sequence)))





(defmethod princ-for-each-line ((sequence list))
  (labels ((inner (sequence)
             (if (null sequence)
                 nil
                 (progn
                   (fresh-line)
                   (princ (first sequence))
                   (inner (rest sequence))))))
    (inner sequence)))

(defmethod princ-for-each-line ((sequence array))
  (dotimes (i (length sequence))
    (fresh-line)
    (princ (aref sequence i))))



;;; Write code here

(defun solve (n x weights)
  (let ((min-weight (reduce #'min weights))
        (counter n)
        (weight-rest (- x (reduce #'+ weights))))
    (assert (>= weight-rest 0))
    (+ counter
       (floor weight-rest min-weight))))


(defun main ()
  (let* ((n (read))
         (x (read))
         (weights (coerce (loop repeat n collect (read)) 'vector)))
    (assert (and
             (every #'numberp weights)))
    (format t "~a~%" (solve n x weights))))

(main)


Measured memory_bytes: 25152
n,a,b,s,i,m;
main(c){
	while((c=getchar())>47)n=n*10+c-48;
	while((c=getchar())>47)a=a*10+c-48;
	while((c=getchar())>47)b=b*10+c-48;
	for(;i++<n;){
		m++;
		if(i%10000==0)m=1;
		else if(i%1000==0)m-=27;
		else if(i%100==0)m-=18;
		else if(i%10==0)m-=9;
		if(a<=m&&m<=b)s+=i;
	}
	printf("%d",s);
}

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

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

typedef long long int int64;

const long long INF = (long long) 1e18;

const int N = 105;
long long dpl[N][N];
long long dpr[N][N];

void sadd(long long &a, long long b)
{
	a += b;
	if (a >= INF) a = INF;
}

long long count(vector <int> &lh, vector <int> &rh)
{
/*	for (int x : lh)
		eprintf("%d ", x);
	eprintf("\n");
	for (int x : rh)
		eprintf("%d ", x);
	eprintf("\n");
*/	memset(dpl, 0, sizeof dpl);
	memset(dpr, 0, sizeof dpr);
	dpl[0][0] = 1;
	for (int i = 0; i <= (int) lh.size(); i++)
		for (int j = 0; j <= (int) rh.size(); j++)
		{
//			eprintf("%d, %d : %lld\n", i, j, dp[i][j] );
			sadd(dpr[i][j], dpl[i][j] );
			if (i != (int) lh.size() ) sadd(dpl[i + 1][j], dpl[i][j] );
			if (j != (int) rh.size() ) sadd(dpr[i][j + 1], dpr[i][j] );
			if (i != (int) lh.size() && j != (int) rh.size() && lh[i] == rh[j] ) 
				sadd(dpl[i + 1][j + 1], dpr[i][j] );
		}
//	eprintf("\n\n");
	return dpr[(int) lh.size()][(int) rh.size() ] - 1;
}


vector <int> lh, rh;

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

	long long X;
	scanf("%lld", &X);

	int cur = 1;
	while (count(lh, rh) != X)
	{
		lh.insert(lh.begin(), cur);
		for (int i = 0; i <= (int) rh.size(); i++)
		{
			vector <int> nrh = rh;
			nrh.insert(nrh.begin() + i, cur);

			if (count(lh, nrh) <= X)
			{
				rh = nrh;
				break;
			}
		}
		cur++;
	}

	printf("%d\n", (int) lh.size() + (int) rh.size() );
	for (int x : lh)
		printf("%d ", x);
	for (int x : rh)
		printf("%d ", x);

	return 0;
}



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

using namespace std;
typedef long long LL;
int _max(int x, int y) {return x > y ? x : y;}
int _min(int x, int y) {return x < y ? x : y;}
const int mod = 998244353;
const int N = 3001;
int read() {
	int s = 0, f = 1; char ch = getchar();
	while(ch < '0' || ch > '9') {if(ch == '-') f = -1; ch = getchar();}
	while(ch >= '0' && ch <= '9') s = s * 10 + ch - '0', ch = getchar();
	return s * f;
}
void put(int x) {
	if(x >= 10) put(x / 10);
	putchar(x % 10 + '0');
}

int C[N][N];

int add(int x, int y) {
	x += y;
	return x >= mod ? x - mod : x;
}

int F(int n, int X) {
	int ans = 0;
	if((X & 1) || 2 * n < X) ans = 1;
	for(int i = n; i < 2 * n; i++) {
		if(i < X) ans = add(ans, C[n][i - n]);
		else {
			if(!((i - X) & 1)) continue;
			int c = (i - X + 1) / 2;
			if(4 * c > i) continue;
			int m = n - 2 * c;
			ans = add(ans, C[m][i - 4 * c - m]);
		}
	} return ans;
}

int main() {
	int n = read(), X = read();
	C[0][0] = 1;
	for(int i = 1; i <= n; i++) {
		C[i][0] = 1;
		for(int j = 1; j <= i; j++) {
			C[i][j] = add(C[i - 1][j - 1], C[i - 1][j]);
		}
	} int ans = 0;
	for(int i = 0; i <= n; i++) ans = add(ans, (LL)F(n - i, X) * C[n][i] % mod);
	printf("%d\n", ans);
	return 0;
}


Measured memory_bytes: 34176
N, A, B = list(map(int, input().split()))

if (A + B) % 2 == 0:
    print((B - A)//2)
else:
    if (N - B) > (A - 1):
        print((B - A - 1)//2 + A)
    else:
        print((B - 1 - A)//2 + N - B + 1)


Measured memory_bytes: 2940
// atcoder/abc154/D/main.cpp
// author: @___Johniel
// github: https://github.com/johniel/

#include <bits/stdc++.h>

#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))

using namespace std;

template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << "," << p.second << ")"; return os; }
template<typename P, typename Q> istream& operator >> (istream& is, pair<P, Q>& p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; for (auto& i: v) os << i << ","; os << ")"; return os; }
template<typename T> istream& operator >> (istream& is, vector<T>& v) { for (auto& i: v) is >> i; return is; }
template<typename T> ostream& operator << (ostream& os, set<T> s) { os << "#{"; for (auto& i: s) os << i << ","; os << "}"; return os; }
template<typename K, typename V> ostream& operator << (ostream& os, map<K, V> m) { os << "{"; for (auto& i: m) os << i << ","; os << "}"; return os; }

template<typename T> inline T setmax(T& a, T b) { return a = std::max(a, b); }
template<typename T> inline T setmin(T& a, T b) { return a = std::min(a, b); }
template<typename P, typename Q> inline pair<Q, P> reverse(pair<P, Q> p) { return make_pair(p.second, p.first); }

using lli = long long int;
using ull = unsigned long long;
using point = complex<double>;
using str = string;
template<typename T> using vec = vector<T>;

constexpr lli mod = 1e9 + 7;

int main(int argc, char *argv[])
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);

  const int N = 1000 + 5;
  double e[N];
  fill(e, e + N, 0);
  for (int i = 1; i < N; ++i) {
    for (int j = 1; j <= i; ++j) {
      e[i] += j * (1.0 / i);
    }
  }

  int n, k;
  while (cin >> n >> k) {
    vector<int> a(n);
    cin >> a;
    vector<double> b;
    each (i, a) b.push_back(e[i]);
    // cout << b << endl;

    double mx = 0;

    queue<double> q;
    double sum = 0;
    each (i, b) {
      sum += i;
      q.push(i);
      if (k < q.size()) {
        sum -= q.front();
        q.pop();
      }
      if (q.size() == k) {
        setmax(mx, sum);
      }
    }

    printf("%.10lf\n", mx);
  }


  return 0;
}


Measured memory_bytes: 4208
#include <cstdio>

#define R register
#define maxn 200010
bool v1[maxn], v2[maxn];
int main()
{
	R int n, m; scanf("%d%d", &n, &m);
	for (R int i = 1; i <= m; ++i)
	{
		R int a, b;
		scanf("%d%d", &a, &b);
		if (a == 1 || b == 1) v1[a ^ b ^ 1] = 1;
		if (a == n || b == n) v2[a ^ b ^ n] = 1;
	}
	R bool flag = 0;
	for (R int i = 2; i < n; ++i) if (v1[i] && v2[i]) flag = 1;
	puts(flag ? "POSSIBLE" : "IMPOSSIBLE");
	return 0;
}

Measured memory_bytes: 512
use std::io;

fn main() {
    let mut buf = String::new();
    io::stdin().read_line(&mut buf).ok();
    let S = buf.trim();

    let ans = match S {
        "Sunny" => "Cloudy",
        "Cloudy" => "Rainy",
        "Rainy" => "Sunny",
        _ => "",
    };

    println!("{}", ans);
}


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

int main()
{
    char t[15];
    scanf("%s",t);
    int cnt=0;
    int maxn=0;
    for(int i=0; i<strlen(t);i++)
    {
        if(t[i]=='A'||t[i]=='G'||t[i]=='C'||t[i]=='T')
            cnt++;
        else
            cnt=0;
        if(cnt>maxn)
            maxn=cnt;
    }
    cout<<maxn;
    return 0;
}


Measured memory_bytes: 256
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int num = Integer.parseInt(sc.next());
    int[] kagamiMochi = new int[num];
    int count = 1;
    for (int i = 0; i<num; i++){
      kagamiMochi[i] = Integer.parseInt(sc.next());
    }
    Arrays.sort(kagamiMochi);
    for(int j = num-2; j>=0; j--){
      if (kagamiMochi[j] != kagamiMochi[j+1]){
        count++;
      }
    }
    System.out.println(count);
  }
}


Measured memory_bytes: 21840
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <utility>
#include <climits>
#include <vector>
using namespace std;

#define ll long long int

const int MOD = 1000000007;

int main() {

	int N, M;
	char A[55][55], B[55][55];
	bool check = true;

	cin >> N >> M;
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < N; j++) {

			cin >> A[i][j];

		}
	}
	for (int i = 0; i < M; i++) {
		for (int j = 0; j < M; j++) {

			cin >> B[i][j];

		}
	}

	for (int i = 0; i < N - M + 1; i++) {
		for (int j = 0; j < N - M + 1; j++) {

			check = true;
			for (int k = 0; k < M; k++) {
				for (int l = 0; l < M; l++) {

					if (A[i + k][j + l] != B[k][l])check = false;

				}
			}
			if (check) {

				cout << "Yes" << endl;
				goto qwe;

			}

		}
	}

	cout << "No" << endl;

	qwe:

	return 0;
}

Measured memory_bytes: 256
a=int(input())
b=[]
c=""
for i in range(a):
    b.append(str(input()))
for j in range(a-1):
    if b[j][-1]==b[j+1][0]:
        if len(set(b))==a:
            c="Yes"
        else:
            c="No"
            break
    else:
        c="No"
        break
print(c)

Measured memory_bytes: 3060
from collections import deque
N, M = map(int, input().split())

node = [[] for i in range(N)]
for _ in range(M):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    node[a].append(b)
    node[b].append(a)

q = deque([0])
ans = [-1] * N
while(len(q) > 0):
    now = q.popleft()

    for i in node[now]:
        if ans[i] == -1:
            q.append(i)
            ans[i] = now


print("Yes")
for i in range(1, N):
    print(ans[i] + 1)



Measured memory_bytes: 94396
#include <map>
#include <set>
#include <cmath>
#include <ctime>
#include <queue>
#include <stack>
#include <vector>
#include <bitset>
#include <cstdio>
#include <cctype>
#include <string>
#include <cstring>
#include <cassert>
#include <climits>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <functional>
using namespace std ;

#define rep(i, a, b) for (int (i)=(a);(i)<=(b);(i)++)
#define Rep(i, a, b) for (int (i)=(a)-1;(i)<(b);(i)++)
#define REP(i, a, b) for (int (i)=(a);(i)>=(b);(i)--)
#define reg(i, x) for (int (i)=head[x];(i);i=e[i].next)
#define clr(a) memset(a,0,sizeof(a))
#define Sort(a, len) sort(a + 1, a + len + 1)
#define Sort2(a, len, cmp) sort(a + 1, a + len + 1, cmp)
#define ass(a, sum) memset(a, sum, sizeof(a))

#define ull unsigned long long
#define ll long long
#define ls ((rt) << 1)
#define rs ((rt) << 1 | 1)
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define endl '\n'
#define Pii pair<int, int>

const int N = 100010 ;
const int iinf = INT_MAX/2 ;
const ll linf = LLONG_MAX/2 ;
const int MOD = 1e9+7 ;

inline int read(){
    int X = 0,w = 0 ;
	char ch = 0;
    while(!isdigit(ch)) {w |= ch == '-';ch = getchar();}
    while(isdigit(ch)) X = (X<<3) + (X<<1) + (ch ^ 48),ch = getchar();
    return w ? -X : X;
}

void write(int x){
     if(x < 0) putchar('-'),x = -x;
     if(x > 9) write(x / 10);
     putchar(x%10 + '0');
}

void output(double x){
	 printf("%lf\n", x + 0.0000000001) ;
}
int n;
int main(){
	scanf("%d", &n) ;
	if (n == 1) cout << "Hello World" ;
	else {
		int a, b ;
		scanf("%d%d", &a, &b) ;
		cout << a + b << endl ;
	}
}

/*
写代码时请注意：
	1.是否要开Long Long？数组边界处理好了么？
	2.特殊情况处理好了么？
	3.做一些总比不做好。
	4.最大值和最小值问题可不可以用二分答案？
	5.有没有贪心策略？否则能不能dp？
	6.实数精度有没有处理？
*/


Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
	"strings"
)

var sc = bufio.NewReaderSize(os.Stdin, 1024*1024*10)

func main() {
	list := getStdinArr()
	A, _ := strconv.Atoi(list[0])
	B, _ := strconv.ParseFloat(list[1], 64)
	a := A
	b := int(math.Round(B * 100))
	fmt.Printf("%d\n", (a*b)/100)
}

func getStdin() string {
	return readLine()
}
func getStdinInt() int {
	str := getStdin()
	rtn, _ := strconv.Atoi(str)
	return rtn
}
func getStdinInt64() int64 {
	str := getStdin()
	rtn, _ := strconv.ParseInt(str, 10, 64)
	return rtn
}
func getStdinIntArr() []int {
	str := getStdin()
	list := strings.Split(str, " ")
	rtn := make([]int, len(list))
	for idx, val := range list {
		rtn[idx], _ = strconv.Atoi(val)
	}
	return rtn
}

func getStdinArr() []string {
	str := getStdin()
	list := strings.Split(str, " ")
	return list
}

func getStdinIntArr64() []int64 {
	str := getStdin()
	list := strings.Split(str, " ")
	rtn := make([]int64, len(list))
	for idx, val := range list {
		rtn[idx], _ = strconv.ParseInt(val, 10, 64)
	}
	return rtn
}

func readLine() string {
	buf := make([]byte, 0, 0)
	for {
		l, p, e := sc.ReadLine()
		if e != nil {
			panic(e)
		}
		buf = append(buf, l...)
		if !p {
			break
		}
	}
	return string(buf)
}


Measured memory_bytes: 2164
#include <bits/stdc++.h>
using namespace std;
 
#define sws ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define INFINITO 1000000000
#define ll long long
#define vi vector<int>
#define pb push_back
#define pii pair<int, int>
#define mp make_pair
#define ff first
#define ss second
#define all(x) x.begin(), x.end()
#define fo(i, n) for( int i = 0; i < n; i++ )


int main() {

    int n, d;

    cin >> n >> d;
    int x[10][10];

    fo(i, n) {
        fo(j, d) cin >> x[i][j];
    }

    int ans = 0;
    fo(i, n - 1) {
        for ( int j = i + 1; j < n; j++ ) {
            int cont = 0;
            fo(k, d) cont += (x[i][k] - x[j][k]) * (x[i][k] - x[j][k]);
            // cout << cont << endl;
            if ( sqrt(cont) == floor(sqrt(cont)) ) ans++;
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

const int MAX_N = 2e3 + 5;

int dp [MAX_N][MAX_N];
int smax [MAX_N][MAX_N]; // smax[i][j] = max dp[k][j], k >= i
int smin [MAX_N][MAX_N]; // smin[i][j] = min dp[i][k], k >= j
int arr [MAX_N];

int main () {
  ios::sync_with_stdio(false);

  int n, z, w;
  cin >> n >> z >> w;

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

  for (int i = n; i >= 0; i--) {
    for (int j = n; j >= 0; j--) {
      if (i == n) {
        dp[i][j] = abs(arr[i] - (j == 0 ? w : arr[j]));
      } else if (j == n) {
        dp[i][j] = abs(arr[j] - (i == 0 ? z : arr[i]));
      } else if (i < j || (i == 0 && j == 0)) {
        dp[i][j] = smax[j + 1][j];
      } else if (j < i) {
        dp[i][j] = smin[i][i + 1];
      }

      if (i != n) {
        smax[i][j] = max(smax[i + 1][j], dp[i][j]);
      } else {
        smax[i][j] = dp[i][j];
      }

      if (j != n) {
        smin[i][j] = min(smin[i][j + 1], dp[i][j]);
      } else {
        smin[i][j] = dp[i][j];
      }
    }
  }

  cout << dp[0][0] << endl;
}


Measured memory_bytes: 47360
#include<bits/stdc++.h>
#define fi first
#define se second
#define ll long long
using namespace std;
const int N=2e5+10;
struct node{
    ll l,r;
    bool operator < (const node &x)const{
        if(l!=x.l)return l<x.l;
        return r<x.r;
    }
    node(ll a=0,ll b=0){l=a,r=b;}
};
map<ll,vector<node> >s;
ll n,x,d;
ll sum[N];
int main()
{
    //freopen("H:\\c++1\\in.txt","r",stdin);
    //freopen("H:\\c++1\\out.txt","w",stdout);
    for(int i=1;i<N;i++)sum[i]=sum[i-1]+i;
    scanf("%lld%lld%lld",&n,&x,&d);
    if(x==0&&d==0){
        puts("1");return 0;
    }
    if(x!=0&&d==0){
        printf("%lld\n",n+1);return 0;
    }
    if(d<0)d*=-1,x*=-1;
    ll L=0,R=0;
    for(ll i=0;i<=n;i++){
        ll t=i*x;
        L=sum[i-1];
        R=sum[n-1]-sum[max(0ll,n-i-1)];
        L+=t/d,R+=t/d;
        t%=d;
        if(t<0)t+=d,L--,R--;
        s[t].push_back(node(L,R));
    }
    ll ans=0;
    for(auto it:s){
        sort(it.se.begin(),it.se.end());
        L=it.se[0].l,R=it.se[0].r;
        for(node v:it.se){
            if(v.l>R){
                ans+=R-L+1;
                L=v.l,R=v.r;
            }
            else{
                R=max(v.r,R);
            }   
        }
        ans+=R-L+1;
    }
    printf("%lld\n",ans);
    return 0;
}

Measured memory_bytes: 23680
#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 ll long long int
#define ordered_set tree < ll ,  null_type ,  less<ll> ,  rb_tree_tag ,  tree_order_statistics_node_update >
//added two more functions to set
//(1)*(set.find_by_order(k))[kth element in the sorted set] 
//(2)set.order_of_key(k)[count of elements strictly less than k]
typedef vector< int > vi;
typedef vector< ll > lvi;
typedef vector< vi > vvi;
typedef vector< lvi > lvvi;
typedef pair< int,int > ii;
typedef pair< ll,ll > lii;
#define sz(a) int((a).size())
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define tr(c,i) for(auto i = (c).begin(); i != (c).end(); i++)//remember i is an iterator
#define present(c,x) ((c).find(x) != (c).end())//for sets,maps,multimaps
#define cpresent(c,x) (find(all(c),x) != (c).end())//for vectors
#define tc(t) int (t); cin>>(t);while((t)--)
#define ff first
#define ss second
#define mp make_pair
#define ld long double
#define ull unsigned long long int
#define mod 1000000007
int main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);	
	string s1,s2="#";
	cin>>s1;
	s2+=s1;
	int ch=0,n=s1.length(),flag=0;
	for(int i=1;i<=n/2;i++)
	{
		if(s2[i]!=s2[n+1-i])
		{
			flag=1;
			break;
		}
	}
	if(flag==0) ch++;
	flag=0;
	int len=(n-1)/2;
	for(int i=1;i<=len/2;i++)
	{
		if(s2[i]!=s2[len+1-i])
		{
			flag=1;
			break;
		}
	}
	if(flag==0) ch++;
	flag=0;
	len=n;
	for(int i=(n+3)/2,j=len;i<j;i++,j--)
	{
		if(s2[i]!=s2[j])
		{
			flag=1;
			break;
		}
	}
	if(flag==0) ch++;
	if(ch==3)
	{
		cout<<"Yes\n";
	}
	else cout<<"No\n";
	return 0;
}

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

int main()
{
  int a[30]={};
  int b;
  for(int i=0;i<28;i++){
    cin >> b;
    a[b-1]=1;
  }
  for(int i=0;i<30;i++)
    if(a[i]==0) cout << i+1 << endl;
  return 0;
}


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

int main() {
    ll H;
    cin >> H;
    ll ans = 0;
    ll num = 0;
    while (H) {
        H /= 2;
        num++;
    }
    rep(i, num) {
        ans += 1LL << i;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define MOD 1e9 + 7
#define PI 3.141592653589793238
#define pb push_back
#define ALL(V) (V).begin(), (V).end()
#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long long int lint;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef vector<int> VI;
ll gcd(ll a, ll b) { return (a % b == 0 ? b : gcd(b, a % b)); }
ll lcm(ll a, ll b) { return a * b / gcd(a, b); }
ll char_to_ll(char c) { return (int)(c - '0'); }
ll string_to_ll(string s) { return char_to_ll(atoi(s.c_str())); }

int main(){
    ll A, B, K;
    cin >> A >> B >> K;

    A -= K;
    if(A < 0){
        B -= abs(A);
        A = 0;
    }

    if(B < 0) B = 0;

    cout << A << " " << B << 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>;


int main() {
    int D, T, S;
    cin >> D >> T >> S;

    if (S * T >= D) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

}


Measured memory_bytes: 3632
/*
https://www.luogu.org/problem/AT2168
Author: Yu-343
*/

#include <cstdio>

int h, w, cnt = 0;
char ch;

int main (void) {
	scanf ("%d %d", &h, &w);
	for (int i = 1; i <= h; ++i) {
		getchar ();
		for (int j = 1; j <= w; ++j) {
			scanf ("%c", &ch);
			if (ch == '#') ++cnt;
		}
	}
	puts ((cnt == h + w - 1) ? "Possible" : "Impossible");
	return 0;
}

Measured memory_bytes: 128
#include<iostream>

using namespace std;

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


Measured memory_bytes: 3088
n = int(input())
list_CSF = [ list(map(int,input().split(" "))) for i in range(n-1)]
ans = []
for i in range(0, n-1):
    t = 0
    for j in range(i, n-1):
        l = list_CSF[j]
        if t <= l[1]:
            t = l[1]+l[0]
        else:
            if (t - l[1]) % l[2] == 0:
                t += l[0]
            else:
                t += l[0] + l[2] - ((t - l[1]) % l[2])
    ans.append(t)
ans.append(0)
for s in ans:
    print(s)


Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin>>N;
  int a,b,c,d;
  a=N/1000;
  b=N/100%10;
  c=(N-1000*a-100*b)/10;
  d=N%10;
  if(b==c){
    if(a==b || c==d)
      cout<<"Yes";
    else cout<<"No";
  }
  else cout<<"No";
  
}

Measured memory_bytes: 256
from itertools import accumulate
N, K = map(int, input().split())
mod = 10 ** 9 + 7
sqrt = int(N**(1/2))
count = [N//i - N//(i+1) for i in range(1, N//sqrt)] + [1] * sqrt
ansList = count
for _ in range(K):
    ansList = [(i * j) % mod for i, j in zip(accumulate(reversed(ansList)), count)]

print(ansList[-1])

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

template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

//INSERT ABOVE HERE
signed main(){
  Int n,q;
  string s;
  cin>>n>>q>>s;
  vector<Int> v(n);
  for(Int i=0;i<n;i++) v[i]=i+1;
  for(Int i=0;i<q;i++){
    Int l,r;
    cin>>l>>r;
    l--;
    chmax(v[l],r);
  }
  for(Int i=1;i<n;i++) chmax(v[i],v[i-1]);
  vector<Int> c(n+1,0);
  for(Int i=0;i<n;i++) c[i+1]=c[i]+(s[i]=='1');

  const Int MOD = 1e9+7;
  vector<Int> dp(n+1,0);
  dp[0]=1;
  for(Int i=0;i<n;i++){
    vector<Int> nx(n+1,0);
    for(Int j=0;j<=n;j++){
      //cout<<i<<" "<<j<<":"<<dp[j]<<endl;
      if(j<c[v[i]]) nx[j+1]+=dp[j];
      if(i-j<v[i]-c[v[i]]) nx[j]+=dp[j];
      nx[j]%=MOD;
    }
    swap(dp,nx);
  }
  cout<<dp[c[n]]<<endl;
  return 0;
}


Measured memory_bytes: 512
#define _CRT_SECURE_NO_WARNINGS
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <locale>
#include <iostream>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

using namespace std;

int main() {

	int n;
	cin >> n;

	vector<vector<int>> a(2, vector<int>(n, 0));
	for (int i = 0; i < 2; ++i)
		for (int j = 0; j < n; ++j)
			cin >> a[i][j];

	queue<pair<int, int>> q;
	q.emplace(0, 0);

	vector<vector<int>> counts(2, vector<int>(n, -1));
	counts[0][0] = a[0][0];

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

	while (!q.empty())
	{
		int y = q.front().first;
		int x = q.front().second;
		q.pop();

		for (int i = 0; i < 2; ++i)
		{
			int yy = y + dy[i];
			int xx = x + dx[i];
			if (xx >= n || yy >= 2) continue;
			counts[yy][xx] = max(counts[yy][xx], counts[y][x] + a[yy][xx]);
			q.emplace(yy, xx);
		}
	}

	cout << counts[1][n - 1] << endl;

	return 0;
}

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

int main(){
  
  int a,b;
  cin >> a >> b;
  
  if( a%b == 0 ){
    
  cout << 0 << endl;
    
  }
  
  else{
    
  cout << 1 << endl;
    
  }
  
}


Measured memory_bytes: 256
#include<iostream>
#include<set>
#include<queue>
#include<algorithm>
#include<vector>

using namespace std;

vector<int> dp(100000);

int main(){

    int N,W;
    int v[2000];
    int w[2000];
    cin >> N >> W;
    for(int i=0;i<N;i++){
	cin >> v[i] >> w[i];
    }
    for(int i=0;i<=W;i++){
	for(int j=0;j<N;j++){
	    if(i-w[j] > -1 ) {
		dp[i] = max(dp[i],dp[i-w[j]] + v[j]);
	    }
	}
    }
    int res = 0;
    for(int i=0;i<=W;i++){
	res = max(res,dp[i]);
    }
    cout << res << endl;
    dp.clear();


    return 0;
}

Measured memory_bytes: 1540
while True:
    n, x = map(int, input().split())
    if n == 0 and x == 0:
        break
    ans = 0
    for i in range(1,n+1):
        for j in range(i+1, n+1):
            for k in range(j+1, n+1):
                if i + j+ k == x:
                    ans += 1
    print(ans)


Measured memory_bytes: 5596