akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

#define rep(i,x,y) for(int i=(x);i<(y);++i)
#define debug(x) #x << "=" << (x)

#ifdef DEBUG
#define _GLIBCXX_DEBUG
#define print(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define print(x)
#endif

const int inf=1e9;
const int64_t inf64=1e18;
const double eps=1e-9;

template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){
    os << "[";
    for (const auto &v : vec) {
    	os << v << ",";
    }
    os << "]";
    return os;
}

using i64=int64_t;

void solve(){
    int N;
    cin >> N;
    vector<set<int>> graph(N);
    vector<int> deg(N);
    rep(i,0,N-1){
        int a,b;
        cin >> a >> b;
        --a;
        --b;
        graph[a].insert(b);
        graph[b].insert(a);
    }
    queue<int> que;
    rep(i,0,N) if(graph[i].size()==1) que.push(i);
    while(!que.empty()){
        int u=que.front();
        que.pop();
        if(graph[u].empty()){
            cout << "First" << endl;
            return;
        }
        int v=*graph[u].begin();
        for(int w:graph[v]){
            graph[w].erase(v);
            if(graph[w].size()==1) que.push(w);
        }
    }
    cout << "Second" << endl;
}

int main(){
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(10);
    solve();
    return 0;
}


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

#define mod 1000000007

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

using namespace std;
typedef long long ll;
const long long INF = 1LL << 60;
 
int main(void){
	
	ll N, M, ans = 0;
	
	cin >> N >> M;
	
	vector<int> A(N);
	vector<pair<int, int>> bc(M);
	
	rep(i, N)
		cin >> A[i];
		
	rep(i, M)
		cin >> bc[i].second >> bc[i].first;
		
	sort(bc.begin(), bc.end());
	reverse(bc.begin(), bc.end());
	
	int i = 0, m = 0;
	
	while(i < N){
		for(int j=0; j<bc[m].second; j++){
			A.push_back(bc[m].first);
			i++;
			if(i == N)
				break;
		}
		m++;
		if(m == M) 
			break;
	}
	
	sort(A.begin(), A.end());
	reverse(A.begin(), A.end());
	
	rep(i, N)
		ans += A[i];
	
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 1792
#define rep(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define scan(n,v) v.resize(n); rep(i,n){ cin>>v[i];}
#define lim 1000000007ll
#define Yes(flag) cout<<((flag)? "Yes":"No");
#define YES(flag) cout<<((flag)? "YES":"NO");
#include<bits/stdc++.h>
using ll = long long;
using namespace std;
template<class T>T 
chmin(T& a,T b){if(a>b){a=b;return true;}return false;}
template<class T>T 
chmax(T& a,T b){if(a<b){a=b;return true;}return false;}
template <class T> T 
gcd(T a, T b){if (a < b) {a ^= b;b ^= a;a ^= b;} return b ? gcd(b, a % b) : a;}
template <class T> T 
lcm(T a, T b){return a * b / gcd(a, b);}

// header
ll a,b;
void input(){
    cin>>a>>b;
}
void src(){
    if(a>0){
        cout<<"Positive"; return;
    }
    if(a*b<=0){
        cout<<"Zero"; return;
    }
    if(b<0){
        if((b-a+1)%2==0){
            cout<<"Positive"; return;
        }else{
            cout<<"Negative"; return;
        }
    }
}   
int main(int argc,char* argv[]){
    ios::sync_with_stdio(false);
 //   ifstream in( argv[1] ); cin.rdbuf(in.rdbuf());
    input();
    src();    
    return 0;
}

Measured memory_bytes: 256
use std::io::*;
use std::str::FromStr;

pub fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

use std::cmp::max;

fn main() {
    let n: usize = read();
    let m: usize = read();

    if n == 1 && m == 1 {
        println!("1");
        return;
    }

    if n == 1 || m == 1 {
        println!("{}", max(max(n, m) as i64 - 2, 0));
        return;
    }

    if n == 2 || m == 2 {
        println!("{}", 0);
        return;
    }

    println!("{}", (n - 2) * (m - 2));
}


Measured memory_bytes: 4352
#include <cstring>
#include <cmath>
#include <algorithm>
#include <string>
#include <map>
#include <iostream>
#include <vector>
#include <queue>
#include <unordered_map>
#include <random>
#include <stack>
#include <set>
#include <unordered_set>

#define bug(x) cout<<"zdongdebug1: "<<x<<endl;
#define bug2(x, y) cout<<"zdongdebug2: "<<x<<" "<<y<<endl;
#define bug3(x, y, z) cout<<"zdongdebug3: "<<x<<" "<<y<<" "<<z<<endl;
using namespace std;
typedef long long ll;
const int maxn = 10005;
const int mod = 1000000007;

int c[maxn];

int main() {
#ifdef suiyuan2009
  freopen("/Users/suiyuan2009/CLionProjects/icpc/input.txt", "r", stdin);
  //freopen("/Users/suiyuan2009/CLionProjects/icpc/output.txt", "w", stdout);
#endif
  int n;
  cin>>n;
  for(int i=1;i<=100;i++)
    for(int j=1;j<=100;j++)
      for(int k=1;k<=100;k++){
        int tt = i*i+j*j+k*k+i*j+j*k+i*k;
        if(tt<maxn)c[tt]++;
      }
  for(int i=1;i<=n;i++)cout<<c[i]<<endl;
  return 0;
}

Measured memory_bytes: 3600
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1e9 + 7;
const ll INF = 1LL << 60;
#define rep(i, a, n) for (ll i = (a); i < (n); i++)
#define debug(x) cerr << #x << ": " << x << endl;
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;}

int main() {
    ll n, a, b;
    cin >> n >> a >> b;
    if ((b-a) % 2 == 1) cout << "Borys" << endl;
    else cout << "Alice" << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const int MOD = 1e9+7;

int main(){
  
  int n; cin>>n;
  int ansx{}, ansy{}, ansh{};
  vector<int> x(n),y(n),h(n);
  for(int i=0; i<n; i++){
    cin>>x.at(i)>>y.at(i)>>h.at(i);
  }
  for(int cx=0; cx<=100; cx++){
    for(int cy=0; cy<=100; cy++){
      bool flg{};
      int hight{-1};
      int hmax = 1e9;
      hmax *= 2;
      for(int i=0; i<n; i++){
        if(h.at(i)==0){
          hmax = min(hmax,abs(x.at(i)-cx)+abs(y.at(i)-cy));
        }
        else{
          int hi = h.at(i)+abs(x.at(i)-cx)+abs(y.at(i)-cy);
          if(hight<0){
            hight = hi;
          }
          else{
            if(hight!=hi){
              flg = 1;
              break;
            }
          }
        }
      }
      if(flg) continue;
      else {
        if(hight>hmax) continue;
        ansx = cx;
        ansy = cy;
        ansh = hight;
        
      }
    }
  }
  cout <<ansx<<' '<<ansy<<' '<<ansh<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N, M;
  cin >> N >> M;
  vector<int> A(N);
  long long sum = 0;
  for (int i = 0; i < N; i++){
    cin >> A[i];
    sum += A[i];
  }
  int count = 0;
  for (int i = 0; i < N; i++){
    if (4 * M * A[i] >= sum){
      count++;
    }
  }
  if (count >= M){
    cout << "Yes";
  } else {
    cout << "No";
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define rep(i,a,b) for(int i=a;i<=b;i++)

int main(){

	ios::sync_with_stdio(0);
	cin.tie(0);

	
	unordered_set<int> s;
	int n; cin >> n;
	rep(i,1,n){
		int a; cin >> a;
		s.insert(a);
	}
	if(s.size() == n) cout << "YES";
	else cout << "NO";

	return 0;
}

Measured memory_bytes: 8520
import java.util.Scanner;
public class Main {

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

		int n = sc.nextInt();
		int m = sc.nextInt();
		int x = sc.nextInt();
		int[] a = new int[m];
		
		for(int i = 0; i < n; ++i) {
			a[i] = sc.nextInt();
			
			if(x < a[i]) {
				if(i < m/2) {
					System.out.println(i);
					return;
				}else {
					System.out.print(m-i);
					return;
				}
			}
		}		
		sc.close();
	}
}

Measured memory_bytes: 21972
#include <bits/stdc++.h>
using namespace std;
constexpr long long MOD = 1000000007;
using ll = long long;
long long digitsum(long long n){
    long long result = 0;
    while(n > 0) {
        result += n % 10;
        n /= 10;
    }
    return result;
}
int main() {
    ll n, a, b;
    cin >> n >> a >> b;
    ll ans = 0;
    for (ll i = 1; i <= n; i++) {
        if (a <= digitsum(i) && digitsum(i) <= b) ans += i;
    }
    cout << ans << endl;
}


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

int main(){
	int n;
	int xmax=0,xmin=2000;
	cin>>n;
	for(int i=0; i < n;i++){
		int a;
		cin>>a;
		xmax = max(xmax,a);
		xmin = min(xmin,a);
	}
	cout<<(xmax-xmin+1)/2<<endl;
}


Measured memory_bytes: 3104
#include<iostream>
#include<string>
#include<vector>
#include<cmath>
#include<queue>
#include<stack>
#include<set>
#include<algorithm>
#include<utility>
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
const int INF = 1001001001;

ll pow_mod(ll x, ll y) {
	ll res = 1;
	for (ll i = 0; i < y; i++) res = res * x % mod;
	return res;
}

ll gcd(ll x, ll y) {
	if (y == 0) {
		return x;
	}
	return gcd(y, x % y);
}

int main() {
	vector<vector<int>> a(3, vector<int>(3));
	for (int i = 0; i < 3; i++) {
		for (int j = 0; j < 3; j++) {
			cin >> a[i][j];
		}
	}
	int n;
	cin >> n;
	for (int i = 0; i < n; i++) {
		int b;
		cin >> b;
		for (int i = 0; i < 3; i++) {
			for (int j = 0; j < 3; j++) {
				if (a[i][j] == b) a[i][j] = 0;
			}
		}
	}
	bool flag = false;
	for (int i = 0; i < 3; i++) {
		if (a[i][0] == 0 && a[i][1] == 0 && a[i][2] == 0) flag = true;
		if (a[0][i] == 0 && a[1][i] == 0 && a[2][i] == 0) flag = true;
	}
	if (a[0][0] == 0 && a[1][1] == 0 && a[2][2] == 0) flag = true;
	if (a[0][2] == 0 && a[1][1] == 0 && a[2][0] == 0) flag = true;
	if (flag) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 3616
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

int top, S[1000];

void push(int x){
    S[++top] = x;
}

int pop(){
    top--;
    return S[top+1];
}

int main(){
    int a, b;
    top = 0;
    char s[100];

    while( scanf("%s", s) != EOF) {
        if( s[0] == '+' ){
            a=pop();
            b=pop();
            push(a+b);
        }else if( s[0] == '-' ){
            b=pop();
            a=pop();
            push(a-b);
        }else if( s[0] == '*' ){
            a=pop();
            b=pop();
            push(a*b);
        }else{
            push(atoi(s));
        }
    }

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

    return 0;
}


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

int main() {
  int n, m;
  cin >> n >> m;
  
  vector<int> v(m*2);
  for (int i=0;i<v.size();i++) {
    cin >> v.at(i);
  }
  
  for (int i=0;i<n;i++) {
    int cnt = 0;
    for (int j=0;j<v.size();j++) {
      if (v.at(j) == i+1) { cnt++; }
    }
    cout << cnt << endl;
  }

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ll long long
#define ld long double
#define all(a) (a).begin(),(a).end()
#define mk make_pair
ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;


int main() {
 string a,b,c;
 cin >> a >> b >> c;
 if (a[a.size()-1]==b[0] && b[b.size()-1]==c[0]) cout << "YES" << endl;
 else cout << "NO" << endl;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define Would
#define you
#define all(n)  n.begin(),n.end()
#define rall(n) n.rbegin(),n.rend()
typedef long long ll;
const ll INF = 1e18;
const ll MOD = 1e9 + 7;
const double EPS = 1e-10;
const double pi = acos(-1);//3.1415926535897932384626433832795028...
const ll SIZE = 1 << 17;
int dx[] = { 1,0,-1,0 }, dy[] = { 0,1,0,-1 }, alp[30];
ll fac[200005], finv[200005], inv[200005];
vector<ll>dij;
struct edge { ll to, cost; };
vector<vector<edge> >G;

ll mod_pow(ll a, ll b) {
	ll res = 1, mul = a;
	for (int i = 0; i < 31; ++i) {
		if (b >> i & 1) {
			res *= mul;
			res %= MOD;
		}
		mul = (mul * mul) % MOD;
	}
	return res;
}

void addedge(int from, int to, int cost) {
	G[from].push_back({ to,cost });
	G[to].push_back({ from,cost });
}

template<typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }

template<typename T, typename... Ts>
auto make_v(size_t a, Ts... ts) {
	return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}

template<typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T & t, const V & v) { t = v; }

template<typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T & t, const V & v) {
	for (auto& e : t) fill_v(e, v);
}

template<typename T>
void outp(vector<T>v) {
	for (int i = 0; i < v.size(); ++i) {
		cout << v[i];
		if (i != v.size() - 1) { cout << " "; }
	}
}

double add(double a, double b) {
	if (abs(a + b) < EPS * (abs(a) + abs(b))) { return 0; }
	return a + b;
}


ll n, k[100005], ans;
int main() {
	cin >> n;
	for (int i = 0; i < n; ++i) { cin >> k[i]; }
	for (int i = 0; i < n; ++i) {
		for (int j = 0; j < n; ++j) {
			if (i != j) { ans += k[i] * k[j]; }
		}
	}
	cout << ans / 2 << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define RREP(i,n) for(int i=n;i>=0;i--)
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
using namespace std;
typedef long long ll;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
//const ll INF = 1LL << 60;
//const int INF = 1001001001;

int main(void){
    double h,a;
    cin >> h >> a;
    cout << ceil(h/a);

    return 0;
}

Measured memory_bytes: 3764
from itertools import product
n,m=map(int,input().split())#nはスイッチの数,mは電球の数
KS=[list(map(int,input().split())) for _ in range(m)]
P=list(map(int,input().split()))#m個の電球
kumiawase = list(product([0,1], repeat=n))#2^n通りのスイッチ on/off
cnt=0
flag=0
for i in range(2**n):
    flag=0#flagの初期化←これを忘れていた
    junban=kumiawase[i]#on/offパターン
    for j in range(m):#j+1個目の電球(j=[0,m-1])
        joutai=0      #初期化
        for k in range(KS[j][0]):
            joutai+=junban[KS[j][k+1]-1]#KSに入っている電球番号でjunbanでもonだったらjoutaiに+1
        if joutai%2==P[j]:#joutaiは電球onの数になっているはずなので2で割ってあまりをば
            flag+=0#すべてOKならカウントしたいのでこちらはflag+=0
        else:#逆に1回でもアウトならflag=1
            flag=1
    if flag==0:
        cnt+=1
print(cnt)

Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
int main(){
    string s1,s2;
    int mn=INT_MAX,curr=0;
    cin>>s1>>s2;
    for(int i=0;i<=s1.length()-s2.length();i++){
        curr=0;
        for(int j=i;j<i+s2.length();j++){
            if(s2[j-i]!=s1[j])
                curr++;
        }
        mn=min(mn,curr);
    }
    cout<<mn<<endl;
}

Measured memory_bytes: 3600
#include <bits/stdc++.h>
//#include <vector>
#define ALL(l)  (l).begin(),(l).end()
using namespace std;
typedef long long ll;
 

 
int main(){
    
    int n,m;
    cin>>n>>m;
    ll sum=0;
    vector<ll> a(n);
    for(int i=0;i<n;i++)cin>>a.at(i);
    
    priority_queue<ll> q;
    for(int i=0;i<n;i++)q.push(a.at(i));
    
    for(int i=0;i<m;i++){
        ll max_q=q.top();
        q.pop();
        
        max_q=max_q/2;
        q.push(max_q);
    }
  while(!q.empty()){
      sum+=q.top();
      q.pop();
  }
  cout<<sum<<endl;
    
}

Measured memory_bytes: 2168
s = gets.chomp.chars
i = 0
s.each do |t|
  if i == 0 and t == "L"
    print("No")
    i = 2
    break
  elsif i == 1 and t == "R"
    print("No")
    i = 2
    break
  end
  i = 1-i
end
unless i == 2
  print("Yes")
end

Measured memory_bytes: 1788
#include <bits/stdc++.h>
 
using namespace std;
typedef long long ll;
typedef pair<ll, ll> p_ll;
 
template<class T>
void debug(T itr1, T itr2) { auto now = itr1; while(now<itr2) { cout << *now << " "; now++; } cout << endl; }
#define repr(i,from,to) for (int i=(int)from; i<(int)to; i++)
#define rep(i,N) repr(i,0,N)
#define per(i,N) for (int i=(int)N-1; i>=0; i--)
 
const ll MOD = pow(10,9)+7;
const ll LLINF = pow(2,61)-1;
const int INF = pow(2,30)-1;
  

int main() {
    char C;
    cin >> C;

    C++;

    cout << C << endl;
    return 0;
}


Measured memory_bytes: 256
n,k=map(int,input().split())
arr=list(map(int,input().split()))
cand=[arr[0]]
for i in range(n-1):
  arr[i+1]+=arr[i]
  cand.append(arr[i+1])
for i in range(n):
  for j in range(i+1,n):
    cand.append(arr[j]-arr[i])
ans_b=''
for i in range(40,-1,-1):
  t=[]
  x=2**i
  for j in cand:
    if x&j==x:
      t.append(j)
  if len(t)>=k:
    cand=t
    ans_b+='1'
  else:
    ans_b+='0'
ans=0
for i in range(41):
  if ans_b[i]=='1':
    ans+=2**(40-i)
print(ans)

Measured memory_bytes: 23748
N, M = map(int, input().split())
L = []
R = []

for _ in range(M):
    l, r = map(int, input().split())
    L.append(l)
    R.append(r)

ml = max(L)
mr = min(R)

if ml > mr:
    print(0)
else:
    print(mr - ml + 1)




Measured memory_bytes: 55896
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
const ll mod = 998244353;

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

    int n, s;
    cin >> n >> s;
    vector<int> a(n);
    REP(i, n) cin >> a[i];

    vector<ll> dp(s + 1, 0);

    dp[0] = 1;

    REP(i, n) {
        vector<ll> tmp(s + 1, 0);
        swap(dp, tmp);
        REP(j, s + 1) {
            dp[j] += tmp[j] * 2;
            dp[j] %= mod;
            if (j + a[i] <= s) {
                dp[j + a[i]] += tmp[j];
                dp[j + a[i]] %= mod;
            }
        }
    }

    cout << dp[s] << '\n';
    return 0;
}


Measured memory_bytes: 3676
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<vector>
using namespace std;
typedef long long ll;
int main()
{
 ll n,m;
 cin>>n>>m;
 printf("%.10f",n*1.0/m*1.0);
}



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

#ifdef LOCAL
#define DEBUG(...) debug(#__VA_ARGS__, __VA_ARGS__);
#else
#define DEBUG(...) 6;
#endif

template<typename T, typename S> ostream& operator << (ostream &os, const pair<T, S> &p) {return os << "(" << p.first << ", " << p.second << ")";}
template<typename C, typename T = decay<decltype(*begin(declval<C>()))>, typename enable_if<!is_same<C, string>::value>::type* = nullptr>
ostream& operator << (ostream &os, const C &c) {bool f = true; os << "["; for (const auto &x : c) {if (!f) os << ", "; f = false; os << x;} return os << "]";}
template<typename T> void debug(string s, T x) {cerr << s << " = " << x << "\n";}
template<typename T, typename... Args> void debug(string s, T x, Args... args) {cerr << s.substr(0, s.find(',')) << " = " << x << " | "; debug(s.substr(s.find(',') + 2), args...);}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

    int k, x;
    cin >> k >> x;

    cout << (k * 500 >= x ? "Yes" : "No") << "\n";

    return 0;
}


Measured memory_bytes: 3600
#include<bits/stdc++.h>
const unsigned int M = 1000000007; 
#define all(v) (v).begin(), (v).end()
#define rall(v) v.rbegin(),v.rend()
#define  pb push_back
#define int  long long
#define N 998244353
#define endl "\n"
#define fr(i,n) for(int i=0;i<n;i++)
int power(int x,int y){int res=1;while(y>0){if(y&1)res=x*res; y=y>>1;x=x*x;}return res;}
int power(int x,int y,int mod){int res=1;while(y>0){if(y&1)res=x*res%mod; y=y>>1;x=x*x%mod;}return res;}

using namespace std;

void nik()
{
	ios_base::sync_with_stdio(false); cin.tie(NULL);

	#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
	#endif
}


#define F first
#define S second

#define PI 3.141592653589793238



 signed main()
{
//nik();

int test=1;
//cin>>test;

while(test--)
{	
int n;
cin>>n;
int ans=(n*(n+1))/2;
for(int i=3;i<=n;i+=3)ans-=i;
for(int i=5;i<=n;i+=5)if(i%3!=0)ans-=i;

cout<<ans<<endl;

}
 return 0;
}



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


#define FOR(i, start, end) for(uint64_t i=start; i<end; i++)
#define REP(i, n) FOR(i, 0, n)

// 最大公約数gcd
// 最小公倍数lcm=m*n/gcd
uint64_t gcd(uint64_t m, uint64_t n) {
  uint64_t temp;
  while (m % n != 0){
    temp = n;
    n = m % n;
    m = temp;
  }
  return n;
}

uint64_t lcm(uint64_t m, uint64_t n) {
  return (m*n)/gcd(m,n);
}

void comb(vector<vector <uint64_t> > &v){
  for(uint64_t i = 0;i <v.size(); i++){
    v[i][0]=1;
    v[i][i]=1;
  }
  for(uint64_t k = 1;k <v.size();k++){
    for(uint64_t j = 1;j<k;j++){
      v[k][j]=(v[k-1][j-1]+v[k-1][j]);
    }
  }
}

// 掛け算オーバーフロー判定
bool is_product_overflow(uint64_t a, uint64_t b) {

	uint64_t prod = a * b;
	
	return (prod / b != a);
}

//素因数分解
void primeFactorization(uint64_t a, list<uint64_t> &factors){ //素因数分解を出力するプログラム
  long i,sq;
  if(a%2==0){ //偶数の場合
    factors.push_back(2);
    primeFactorization(a/2,factors); //2で割った値で再帰
    return;
  }
  sq = sqrt(a);
  for(i=3;i<=sq;i+=2){ //3以上√a以下の奇数の場合
	if(a%i==0){
	  factors.push_back(i);
      primeFactorization(a/i,factors); //割れた値で再帰
      return;
	}
  }
  //偶数でも3以上√a以下の奇数の場合でも割り切れない場合
  if(a!=1){ //aが1でないなら、a自身は素数
    factors.push_back(a);
  }
}

// 円周率
// M_PI

// #include <iomanip> // setprecisionを使用するのに必要
// cout << std::fixed << std::setprecision(15) << y << endl;

// 昇順
// priority_queue<int, vector<int>, greater<int> > queue;

signed main() {
  int64_t n;
  cin >> n;
  map<string,int> items;
  string item;
  for(int64_t i=0;i<n;i++){
    cin >> item;
    items[item] = 1;
  }
  
  cout << items.size() << endl;
  return 0;
}

Measured memory_bytes: 19136
#include "iostream"
#include"string"
#include"algorithm"
using namespace std;
int c[1001][1001];
int lcs(string X,string Y) {
	int m = X.size();
	int n = Y.size();
	int maxl = 0;
	X = " " + X;
	Y = " " + Y;
	for (int i = 0; i <= m; i++)c[i][0] = 0;
	for (int j = 0; j <= n; j++)c[0][j] = 0;

	for (int i = 1; i <= m; i++) {
		for (int j = 1; j <= n; j++) {
			if (X[i] == Y[j]) {
				c[i][j] = c[i - 1][j - 1] + 1;
			}
			else {
				c[i][j] = max(c[i - 1][j],c[i][j - 1]);
			}
			maxl = max(maxl, c[i][j]);
		}
	}
	return maxl;

}
int main()
{
	string s1, s2;
	int n; cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> s1 >> s2;
		cout << lcs(s1, s2) << endl;
	}

    return 0;
}



Measured memory_bytes: 7092
#include<iostream>
#include<algorithm>
#include<vector>
#include<map>
#include<string>
#include <stack>
#include<queue>
#define rep(i,N) for(int i=0;i<N;i++)

long long  INF=1000000000000000000;
long long mod=1000000007;
using namespace std;


int block[110][110];


queue<int>color;

void paint(int nx,int ny,int H, int W){

if (nx<0 || nx >=W || ny<0 ||ny >= H || block[ny][nx] != -1) return;

block[ny][nx]=color.front();
color.pop();
if(color.empty())return;

paint(nx+1,ny,H,W);
paint(nx,ny+1,H,W);
paint(nx,ny-1,H,W);
paint(nx-1,ny,H,W);

return;
}


int main(){
int H,W;
cin>>H>>W;
int N;
cin>>N;

int a[N];

rep(i,N){
cin>>a[i];
    rep(k,a[i]){
    color.push(i+1);
    }
}
rep(i,H)rep(k,W)block[i][k]=-1;

paint(0,0,H,W);

    rep(i,H){
        rep(k,W){
            cout<<block[i][k]<<" ";
        }
        cout<<endl;
    }
 return 0 ;
}

/*
2 2
3
2 1 1

1 1
2 3

3 5
5
1 2 3 4 5


1 4 4 4 3
2 5 4 5 3
2 5 5 5 3

1 1
1
1

1
*/

Measured memory_bytes: 1152
#include<iostream>
#include<math.h>
#include<iomanip>
#include<vector>
#include<algorithm>
#include<queue>
#include<string>
#include<stdlib.h>
using namespace std;
#define PI 3.14159265358979
typedef  long long ll;
#define rep(i,n) for(int i=0;i<n;i++)
#include<set>
//---------------------------------------------
 

int main(void)
{
ll n;
cin>>n;
vector<ll> a(n+3);
vector<ll> m(n+3);
vector<ll> pat(n+3);
ll sum =0;
for(int i=1;i<=n;i++)
{
    cin>>a[i];
    m[a[i]] ++;
}

for(int i =1;i<=n;i++)
{
    pat[i] = m[i]*(m[i]-1)/2;
    sum += pat[i];
}

for(int i=1;i<=n;i++)
{
cout<<(sum -pat[a[i]]+(m[a[i]]-1)*(m[a[i]]-2)/2)<<endl;
}


}

Measured memory_bytes: 7296
#include<bits/stdc++.h>
using namespace std;
int s,a,b,c,d;
int main(){
  cin>>s;
  a=s/1000;
  b=(s/100)%10;
  c=(s/10)%10;
  d=s%10;
  if(a==b||b==c||c==d)cout<<"Bad"<<endl;
  else cout<<"Good"<<endl;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
 
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=(n)-1;i>=0;i--)
#define VSORT(v) sort(v.begin(), v.end())
#define SORT(v, n) sort(v, v+n)
#define VREV(v,n) reverse(v,v+n)
#define REV(v,n) reverse(v,v+n)
#define vi vector<int>
#define pf push_front
#define pb push_back
#define P pair<int,int>
#define Pll pair<ll,ll>

template<class T, size_t N> size_t countof(const T (&array)[N]) { return N; }
template <class T> void chmin(T&a,const T&b) { a = min(a,b); }
template <class T> void chmax(T&a,const T&b) { a = max(a,b); }
 
void print(){cout<<"\n";}
template <class Head, class... Tail>
void print(Head&& h,Tail&&... t){ 
	if(sizeof...(t)==0)
		cout<<h;
	else
		cout<<h<<' ';
	print(move(t)...);
}

void mprint(auto *matrix,auto N){
	REP(i,N) cout<<matrix[i]<<(i!=N-1?' ':'\n');
	return;
}

const double EPS =1e-9;
const int INF =2e+9;
const ll INFL =9e+18;
const long MOD =1e+9+7;
#define PI 3.14159265258979

#define iP pair<int,P>
int dy[]={0, 0, 1, -1, 1, 1, -1, -1};
int dx[]={1, -1, 0, 0, 1, -1, -1, 1};

inline int in(){int x; cin>>x; return x;}

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

	int A,B,X;
	cin>>A>>B>>X;
	if(A<=X && B>=(X-A)) print("YES");
	else print("NO");
	return 0;
}






Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long ll;

int main() {
    int a, b, c; cin >> a >> b >> c;
    if((c - (a-b)) < 0){
        cout << 0;
    }else{
        cout << c - (a-b);
    }


}

Measured memory_bytes: 256
n=int(input())
s = [0] * (n+1)

print(0)
a = input()
if a=='Vacant':
    exit()
s[0]=a
s[n]=a

l = 0
r = n
while True:
    m = (r+l)//2
    print(m)
    a = input()
    if a=='Vacant':
        exit()
    s[m]=a
    if s[l]==s[r]:
        if s[l]==s[m]:
            if (m-l)%2==1:
                r = m
            else:
                l = m
        else:
            if (m-l)%2==1:
                l = m
            else:
                r = m
    else:
        if s[l]==s[m]:
            if (m-l)%2==1:
                r = m
            else:
                l = m
        else:
            if (m-l)%2==1:
                l = m
            else:
                r = m


Measured memory_bytes: 40388
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<array>
#include<map>
#include<iomanip>
using namespace std;
typedef long long int llint;
typedef long double lldo;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase
//cout<<setprecision(20)
const llint mod=1000000007;
const llint big=2.19e15+1;
const long double pai=3.141592653589793238462643383279502884197;
const long double eps=1e-15;
template <class T,class U>void mineq(T& a,U b){if(a>b){a=b;}}
template <class T,class U>void maxeq(T& a,U b){if(a<b){a=b;}}
llint gcd(llint a,llint b){if(a%b==0){return b;}else return gcd(b,a%b);}
llint lcm(llint a,llint b){return a/gcd(a,b)*b;}
template<class T> void SO(T& ve){sort(ve.begin(),ve.end());}
template<class T> void REV(T& ve){reverse(ve.begin(),ve.end());}
int LBI(vector<llint>&ar,llint in){return lower_bound(ar.begin(),ar.end(),in)-ar.begin();}
int UBI(vector<llint>&ar,llint in){return upper_bound(ar.begin(),ar.end(),in)-ar.begin();}
int main(void){
	string a,b,c;cin>>a>>b>>c;
	cout<<a[0]<<b[1]<<c[2]<<endl;
}

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

int main(){

  int n,m;
  int a;
  int data[20001];

  while(true){
    cin >> n >> m;
    if(!n && !m) break;

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

    for(int i=n;i<n+m;i++){
      cin >> a;
      data[i] = a;
    }

    sort(data, data+n+m);

    int ans = data[0];
    for(int i=1;i<n+m;i++) ans = max(ans,data[i]-data[i-1]);

    cout << ans << endl;
  }

}

Measured memory_bytes: 1252
#include <iostream>
#include <math.h>
#include <string>
#define MEN 6
#include <iomanip>
using namespace std;


struct DICE
{
	int num;
};

int main()
{
	DICE A[MEN];
	string meirei;
	int i = 0;

	for (int i = 0; i < MEN; i++)
	{
		cin >> A[i].num;
	}

	cin >> meirei;

	while (1)
	{
		if (meirei[i] == '\0')
		{
			break;
		}

		if (meirei[i] == 'N')
		{
			int x = A[0].num;
			A[0].num = A[1].num;
			A[1].num = A[5].num;
			A[5].num = A[4].num;
			A[4].num = x;
		}
		else if (meirei[i] == 'E')
		{
			int x = A[0].num;
			A[0].num = A[3].num;
			A[3].num = A[5].num;
			A[5].num = A[2].num;
			A[2].num = x;
		}
		else if (meirei[i] == 'S')
		{
			int x = A[0].num;
			A[0].num = A[4].num;
			A[4].num = A[5].num;
			A[5].num = A[1].num;
			A[1].num = x;
		}
		else if (meirei[i] == 'W')
		{
			int x = A[0].num;
			A[0].num = A[2].num;
			A[2].num = A[5].num;
			A[5].num = A[3].num;
			A[3].num = x;
		}
		i++;
	}

	cout << A[0].num << endl;

	return 0;
}

Measured memory_bytes: 3188
{-# LANGUAGE TypeApplications #-}

import           Control.Monad
import           Control.Applicative
import           Data.List
import           Data.Char
import           Control.Arrow
import           Data.Bits

main = do
  n <- readLn @Int
  a <- map (read @Int) . words <$> getLine
  let snuke = foldl1 xor a
  mapM_ (print . xor snuke) a


Measured memory_bytes: 89812
from collections import deque
import numpy as np

H, W = map(int,input().split())
S = [list(input()) for _ in range(H)]

ans = 0
for i in range(H):
  for j in range(W):

    if S[i][j]=='#':
      continue
    
    # A[i][j]をスタート位置に設定
    # スタート以外は一旦無限数に設定
    inf = 10**5
    A = [[inf]*W for _ in range(H)]
    A[i][j]=0

    # スタート位置をキューに追加
    q = deque([[i, j]])

    # 全てのマスを探索するまでwhile
    while q:
      a = q.popleft()
      x=a[0]
      y=a[1]
      b = A[x][y]
      for h, w in [[x-1, y], [x+1, y], [x, y-1], [x, y+1]]:
        
        # マスが範囲外の場合
        if (h<0) or (h>H-1) or (w<0) or (w>W-1):
          continue
        # マスが障害物の場合
        if S[h][w]=='#':
          continue

        # すでに距離が確定しているマスに＋１を追加した数
        c = b+1

        # cが無限大（未探索）より大きい場合、continue
        if c>=A[h][w]:
          continue

        A[h][w]=c
        # 探索済みのマスをキューに追加
        q.append([h,w])
      
    A = np.array(A)

    # 未到達のマス以外で最も距離が長いマスの距離
    # 前回までのansと上記の数を比べて大きい方をansに代入
    ans = max(ans, max(A[A<10**5]))
    
print(ans)

Measured memory_bytes: 12448
n, k = map(int, input().split())
a = list(map(int, input().split()))
total = sum(a)
divisor = []
for i in range(int(total ** 0.5)):
    if total % (i + 1) == 0:
        divisor.append(i + 1)
        divisor.append(total // (i + 1))
divisor.sort(reverse = True)
i = 0
while True:
    num = divisor[i]
    a2 = [a[j] % num for j in range(n)]
    count = 0
    res = 0
    while a2:
        test = min(a2)
        a2.remove(test)
        count += test
        res += test
        while res:
            test2 = max(a2)
            if res >= num - test2:
                res -= num - test2
                a2.remove(test2)
            else:
                a2[a2.index(test2)] += res
                res = 0
    if count <= k:
        break
    else:
        i += 1
print(num)

Measured memory_bytes: 43484
N, M = map(int, input().split())
K = [set(list(map(int, input().split()))[1:]) for _ in range(M)]
P = list(map(int, input().split()))

ans = 0
for i in range(2**N):
    S = set([1+j for j in range(N) if 2**j & i])
    for j, k in enumerate(K):
        if len(S.intersection(k))%2 != P[j]:
            break
    else:
        ans += 1
print(ans)

Measured memory_bytes: 41436
#include <stdio.h>

int main()
{
	int a,b,c,i;
	int count = 0;
	
	scanf("%d %d %d",&a,&b,&c);
	
	for(i = a; i <= b; i++)
	{
		if(c % i == 0)
		{
			count++;
		}
	}
	printf("%d\n",count);
	
	return 0;
}

Measured memory_bytes: 596
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep_bit(n) for (int bit = 0; bit < (1<<n); ++bit)
#define all(x) (x).begin(),(x).end()
#define ll long long
#define ld long double
#define CYES cout<<"Yes"<<endl
#define CNO cout<<"No"<<endl
#define SP <<" "<<
#define CST(x) cout<<fixed<<setprecision(x)
using namespace std;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<bool> vb;
typedef vector<string> vs;
typedef vector<pair<int,int> > vpi;
typedef vector<pair<ll,ll> > vpl;
typedef vector<vi> Graph;

//条件式 ? 真の場合の文 : 偽の場合の文
//abs(x) = (x の絶対値)
//string S  S,at(i),S += T,S += c,S.size(),S.substr(l)l文字目から最後まで,
///S.substr(l, r)l文字目からl+r-1文字目 n文字目から0個で空列を返せる
//*min_element(all(x)) *max_element(all(x))
//vi x; x.back(),x.front(),x.push_back(),x.pop_back()
//swap(a, b)
//gcd(a, b)最大公約数
//sort(all(x)),reverse(all(x)),sort(x.begin()+l,a.begin()+r)lからrまで
//stack<int> a; a.push(x),a.pop(),a.top(),a.empty()bool
//queue<int> b; b.push(x),b.pop(),b.front(),b.empty()bool,b.size() 要素が小さい順
//priority_queue<int, vector<int>, greater<int>> c,c.top()
//map<int, int> M1; 変数[key] = value; 変数.erase(key); 変数.at(key); 変数.count(key)所属判定　変数.size()
//find(all(x), key)boolソート済みのベクトル
//*lower_bound(all(x),k)以上の最小の要素,*uppper_bound(all(x),k)より大きい最小の要素
//'0'+cnt 数字cntからcharへの変換


int main(){

    int n;
    cin >> n;
    vpl ichi(n);
    rep(i,n){
        cin >> ichi.at(i).first >> ichi.at(i).second;
    }
    ld sum = 0;
    rep(i,n-1) for(int j=i+1; j<n ;j++){
        sum += (ld)sqrt(pow(ichi.at(i).first-ichi.at(j).first,2)+pow(ichi.at(i).second-ichi.at(j).second,2));
    }
    ld ans;
    ans = (ld)2*sum/n;
    CST(8) << ans << endl;
    return 0;
}


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

int main(){
    int a,b,c;
  int d;
    cin>>a>>b>>c;
    bool flg=false;
    for (int i = 1; i < b; i++){
      d=a*i;
        if(d%b==c){
        flg=true;
          cout<<"YES";
        break;}
    }
    if (flg==false){cout<<"NO";}
    return 0;
}

Measured memory_bytes: 256
#-----------にゃんにゃん準備-----------#
def nyan(f=lambda x: x):
    return map(f,input().split())
def nyannyan(f=lambda x: x,i=0):
    if i==0: return list(map(f,input().split()))
    l = []
    for j in range(i):
        l.append(f(input()))
    return l
#------------にゃんにゃん------------#
n, = nyan(int)
h = nyannyan(int)
t, j = (0, 0)
for i in range(n):
    if(h[i]>=t):
        j+=1
        t=h[i]
print(j)
#---------にゃんにゃんおしまい---------#

Measured memory_bytes: 3064
#include<cstdio>
#include<vector>
#include<algorithm>
using namespace std;

struct edge{int from,to,cost;};
const int INF = 1000000000;
//0???????°?????????????int d[1000]
/*
fill(d,d+v,INF);
E[2].to>0+2
//?????????????????????
????????§??????????????????????????¢??????????????????????¶????????????£???????????¨????????????????????????
??°????????????????????????????????????????????????????????§???d[x]???????????£???????????????????????????
????????¨????????????????????????

????????????????????????????????????flag???true??§if???????????£???????????£?????????
NEGATIVE CYCLE??????

INF????????????????????????d[i]???INF??????????????§????????§?????????
????????§???????????°??????????????????
*/

int main(){
    int v,e,r;
    vector<edge> E;
    scanf("%d %d %d",&v,&e,&r);
    for(int i=0;i<e;i++){
        int s,t,d;
        scanf("%d %d %d",&s,&t,&d);
        edge e;
        e.from = s;
        e.to = t;
        e.cost = d;
        E.push_back(e);
    }
    int d[1000];
    fill(d,d+v,INF);
    d[r] = 0;
    for(int i=0;i<v;i++){
        bool flag = true;
        for(int j=0;j<e;j++){
            if(d[E[j].from]!=INF&&d[E[j].to]>d[E[j].from]+E[j].cost){
                d[E[j].to] = d[E[j].from] + E[j].cost;
                flag = false;
            }
        }
        if(flag) break;
        if(i==v-1){
            printf("NEGATIVE CYCLE\n");
            return 0;
        }
    }
    for(int i=0;i<v;i++){
        if(d[i]==INF) printf("INF\n");
        else printf("%d\n",d[i]);
    }
    return 0;
}

Measured memory_bytes: 2820
#include <bits/stdc++.h>
#define ADD(a, b) a = (a + ll(b)) % mod
#define MUL(a, b) a = (a * ll(b)) % mod
#define MAX(a, b) a = max(a, b)
#define MIN(a, b) a = min(a, b)
#define rep(i, a, b) for(int i = int(a); i < int(b); i++)
#define rer(i, a, b) for(int i = int(a) - 1; i >= int(b); i--)
#define all(a) (a).begin(), (a).end()
#define sz(v) (int)(v).size()
#define pb push_back
#define sec second
#define fst first
#define debug(fmt, ...) Debug(__LINE__, ":", fmt, ##__VA_ARGS__)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<int, pi> ppi;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> mat;
typedef complex<double> comp;
void Debug() {cout << '\n'; }
template<class FIRST, class... REST>void Debug(FIRST arg, REST... rest){
	cout<<arg<<" ";Debug(rest...);}
template<class T>ostream& operator<<(ostream& out,const vector<T>& v) {
	out<<"[";if(!v.empty()){rep(i,0,sz(v)-1)out<<v[i]<<", ";out<<v.back();}out<<"]";return out;}
template<class S, class T>ostream& operator<<(ostream& out,const pair<S, T>& v){
	out<<"("<<v.first<<", "<<v.second<<")";return out;}
const int MAX_N = 200010;
const int MAX_V = 100010;
const double eps = 1e-6;
const ll mod = 1000000007;
const int inf = 1 << 29;
const ll linf = 1LL << 60;
const double PI = 3.14159265358979323846;
///////////////////////////////////////////////////////////////////////////////////////////////////

int N;
char S[310][310];

void solve() {
	cin >> N;
	rep(i, 0, N) {
		rep(j, 0, N) {
			cin >> S[i][j];
		}
	}
	int ans = 0;
	for(int k = -(N - 1); k <= (N - 1); k++) {
		bool ok = true;
		rep(i, 0, N) {
			rep(j, 0, N) {
				if(S[i][j] != S[(j + k + N) % N][(i - k + N) % N]) {
					ok = false;
				}
			}
		}
		if(ok) {
			ans += N - abs(k);
		}
	}
	cout << ans << "\n";
}

int main() {
#ifndef LOCAL
	ios::sync_with_stdio(false);
    cin.tie(0);
#endif
    cout << fixed;
	cout.precision(20);
	srand((unsigned int)time(NULL));
#ifdef LOCAL
	//freopen("in.txt", "wt", stdout); //for tester
    freopen("in.txt", "rt", stdin);
#endif	
	solve();
#ifdef LOCAL
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
	return 0;
}



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

int main() {
	long long int a, b, x;
	cin >> a >> b >> x;
	long long int m = b - a;
	long long int r1 = m % x;
	long long int r2 = (b % x) + (x - a % x);
	if(a % x == 0){
		r2 -= x;
	}
	if(r1 >= r2){
		cout << m / x + 1 << endl;
	}
	else{
		cout << m / x << endl;
	}
}

Measured memory_bytes: 256
import sys
from collections import deque
input = sys.stdin.readline

def main():
    h, w, k = map(int, input().split())
    board = [input().strip() for i in range(h)]

    group = [[0 for i in range(w)] for j in range(h)]

    state = 0   # 0:not found, 1:one strawberry
    num = 1
    stock = 1
    pre = -1
    for i in range(h):
        if "#" not in board[i]:
            stock += 1
            continue
        for j in range(w):
            if board[i][j] == "#":
                if state == 0:
                    state = 1
                else:
                    num += 1
                group[i][j] = num
            else:
                group[i][j] = num
        for k in range(stock):
            for j in range(w):
                print(group[i][j], end=" ")
            print()
        num += 1
        state = 0
        stock = 1
        pre = i
    
    for k in range(h-pre-1):
        for j in range(w):
            print(group[pre][j], end=" ")
        print()


if __name__ == "__main__":
    main()

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

using namespace std;

int main(){
    int k,x;
    cin >> k >>x;
    int placeholder = 0;
    placeholder = x-k+1;
    int upto = k+k-1;
    for(int i=0;i<upto;i++){
        cout << placeholder << " ";
        placeholder+=1;
    }
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        sc.close();

        System.out.println(UnevenNumbers(N));
    }
    public static int UnevenNumbers(int N) {
        int ans = 0;
        if (10 <= N) {
            ans += 9;   // 1 - 9
        } else {
            return N;
        }
        if (N < 100) {
            return ans;
        }
        
        if (1000 <= N) {
            ans += 900; // 100 - 999
        } else {
            return ans + (N - 99);
        }
        if (N < 10000) {
            return ans;
        }
        if (99999 < N) {
            N = 99999;
        }
        return ans + (N - 9999);
    }
}


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

using namespace std;

void solve()
{
	int n, m;
	while(cin >> n >> m)
	{
		if(!n && !m)
		{
			break;
		}
		vector<int> Vec(n + m);
		int size = n + m;
		for(int i = 0; i < size; ++i)
		{
			cin >> Vec[i];
		}
		sort(Vec.begin(), Vec.end());
		int max = Vec[0];
		for(int i = 1; i < size; ++i)
		{

			if(max < Vec[i] - Vec[i - 1])
			{
				max = Vec[i] - Vec[i - 1];
			}
		}
		cout << max << endl;
	}
}

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

Measured memory_bytes: 0
import sys
import heapq

sys.setrecursionlimit(10**7)
input = sys.stdin.readline

n, m = map(int, input().split())
a = list(map(int, input().split()))
a = list(map(lambda x: x * (-1), a))

heapq.heapify(a)

for _ in range(m):
    tmp = heapq.heappop(a) * (-1)
    tmp //= 2
    heapq.heappush(a, tmp * (-1))

print(-sum(a))


Measured memory_bytes: 92436
function Main(input) {
	input = input.trim().split("\n").map(function(x) { return x.split(" ")});
	let N = parseInt(input[0][0], 10);
	let K = parseInt(input[0][1], 10);
	let v_A = input[1].map(e => parseInt(e, 10));
	let v_ans = [];
	for (let i = 0; i < N - K; i++){
		if (v_A[i] < v_A[i + K]) v_ans.push('Yes');
		else v_ans.push('No');
	}

	console.log(v_ans.join("\n"));

}


Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 59216
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.TreeMap;
import java.util.StringTokenizer;
import java.util.Map;
import java.io.IOException;
import java.util.InputMismatchException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author amotoma3
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskC solver = new TaskC();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskC {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            int[] a = in.nextIntArray(n);

            Map<Integer, Integer> map = new TreeMap<>();
            for (int x : a) {
                map.merge(x, 1, Integer::sum);
            }

            int ans = 0;
            for (int x : map.keySet()) {
                ans += map.get(x) >= x ? (map.get(x) - x) : map.get(x);
            }

            out.println(ans);
        }

    }

    static class InputReader {
        BufferedReader in;
        StringTokenizer tok;

        public String nextString() {
            while (!tok.hasMoreTokens()) {
                try {
                    tok = new StringTokenizer(in.readLine(), " ");
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
            }
            return tok.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(nextString());
        }

        public int[] nextIntArray(int n) {
            int[] res = new int[n];
            for (int i = 0; i < n; i++) {
                res[i] = nextInt();
            }
            return res;
        }

        public InputReader(InputStream inputStream) {
            in = new BufferedReader(new InputStreamReader(inputStream));
            tok = new StringTokenizer("");
        }

    }
}



Measured memory_bytes: 44740
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (n); i++)
using namespace std;

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

    string s;
    cin >> s;

    int cnt = 0;
    REP(i, s.size()) {
        if (i % 2 == 0 && s[i] == '1') cnt++;
        if (i % 2 == 1 && s[i] == '0') cnt++;
    }

    int cnt2 = 0;
    REP(i, s.size()) {
        if (i % 2 == 0 && s[i] == '0') cnt2++;
        if (i % 2 == 1 && s[i] == '1') cnt2++;
    }

    cout << min(cnt, cnt2) << '\n';
    return 0;
}


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

int main(){
        int n;
        cin >> n;
        int a, b;
        int flag = 0;
        cin >> a >> b;
        for(int i = a; i <= b; i++) {
                if(i % n == 0) {cout << "OK\n"; flag = 1; break;}
        }
        if(flag == 0) cout << "NG\n";
}


Measured memory_bytes: 3124
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
#define popCnt(x) (__builtin_popcountll(x))
typedef unsigned long long Long;

int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#ifdef Local
  freopen("test.in", "r", stdin);
#else
#define endl '\n'
#endif

  int n;
  cin >> n;

  vector<int> v(n);

  vector<int> res;

  for (int& x : v) {
    cin >> x;
    --x;
  }

  while (!v.empty()) {
    int nxt = -1;
    for (int i = 0; i < v.size(); ++i) {
      if (i == v[i]) {
        nxt = i;
      }
    }
    if (nxt == -1) {
      cout << -1 << endl;
      return 0;
    }
    res.push_back(nxt);
    v.erase(v.begin() + nxt);
  }

  reverse(res.begin(), res.end());
  for (int x : res) {
    cout << x + 1 << endl;
  }

}



Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
#define ll long long

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

  ll w,h,x,y; cin >> w >> h >> x >> y;
  double ans1 = 0.5*w*h;
  ll ans2 = 0; 
  if (w%2==0 && h%2==0 && x==w/2 && y==h/2) ans2 = 1;
  cout << ans1 << " " << ans2 << endl;
  return 0;
}

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

typedef long long ll;

int main() {
    ll x;
    cin >> x;
    bitset<32> bs;
    bs = x;
    
    cout << bitset<(32)>(x) << endl;
    bs.flip();
    cout << bs << endl;
    bs.flip();
    cout << (bs << 1) << endl;
    cout << (bs >> 1) << endl;
    
}



Measured memory_bytes: 3136
def main():
    H,A = list(map(int,input().split()))
    # H: 体力
    # A: 攻撃
    count = 0
    for _ in range(pow(10,4)):
        H -= A
        count += 1
        if (H <= 0):
            break
    print(count)

if __name__ == "__main__":
    main()

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,int> P;
int INF = 1e9+7;
int mod = 998244353;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
int dp[1005][1005] = {0};
int D[1005] = {0};
int C[1005] = {0};
signed main() {
    int N;
    cin >> N;
    vector<int>A(N);
    int cnt = 0;
    for(int i = 0; i < N; i++) {
        cin >> A[i];
        cnt+=A[i];
    }
    int ans = cnt;
    int sum = 0;
    for(int i = 0; i < N; i++) {
        sum+=A[i];
        ans = min(ans,abs(sum-(cnt-sum)));
    }
    cout << ans << endl;
}


Measured memory_bytes: 4820