akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
 
#define rep(i,n) for(ll i=0;i<n;++i)
#define all_map(itr,mp) for(auto itr=mp.begin();itr!=mp.end();itr++)
#define ALL(a) (a).begin(),(a).end()

using namespace std;
using ll  = long long;
using pll = pair<ll, ll>;

const ll MOD  = 1e9 + 7;
const ll LINF = 1LL << 62;
const int INF = 1e9 + 7;

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

    ll ans = 0;
    for(ll i = 1; i <= n; ++i){
        ll a;
        cin >> a;
        if(a&1)if(i&1)ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3616
#include <iostream>
#include <vector>

using namespace std;

int main()
{
    int h, w;
    cin >> h >> w;

    vector<vector<char>> s(55, vector<char>(55)); //　ボードの上下左右に余白を用意
    for (int i = 1; i <= h; ++i) {
        for (int j = 1; j <= w; ++j) {
            cin >> s[i][j];
        }
    }
    vector<vector<int>> s2(55, vector<int>(55));
    for (int i = 1; i <= h; ++i) {
        for (int j = 1; j <= w; ++j) {
            if (s[i][j] == '#') {
                s2[i][j] = -10;
                for (int k = i-1; k <= i+1; ++k) {
                    for (int l = j-1; l <= j+1; ++l) {
                        if (k == i && l == j) continue;
                        ++s2[k][l];
                    }
                }
            }
        }
    }
    for (int i = 1; i <= h; ++i) {
        for (int j = 1; j <= w; ++j) {
            if (s2[i][j] < 0) cout << '#';
            else cout << s2[i][j];
        }
        cout << '\n';
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define pb(x) push_back(x)
#define faster ios::sync_with_stdio(false)
#define ll long long int
#define sz 200005
#define mp(x,y) make_pair(x,y) 
#define pii pair<long long int,long long int>
#define tor ::iterator
#define letsgo long long  int i,j,k,q=0,t,tmp,n,flg=0,cntr=0,maxxer = 0
#define fi first
#define se second
#define be begin()
#define en end()
#define mod 1000000007
#define debug(x) cout<<" "<<x<<endl

ll dp[105][100005] ;
ll knapsack(ll i,ll w,ll wt[],ll v[],ll n){
	// cout<<i<<"   "<<w<<"   "<<endl;
	if(i==n)
		return 0;
	if(dp[i][w]!=-1)
		return dp[i][w];
	if( wt[i]<= w){
		dp[i][w] = max(knapsack(i+1,w,wt,v,n)
			,knapsack(i+1,w-wt[i],wt,v,n)+v[i]);
	}
	else 
		dp[i][w] = knapsack(i+1,w,wt,v,n);
	return dp[i][w];
}
int main(){
	faster;
	letsgo; 
	ll w;
	ll m;
	cin>>n>>m;
	map <ll,ll> mp;
	for(i=0;i<n;i++){
		cin>>tmp;
		mp[tmp]++;
	}
	for(i=0;i<m;i++){
		cin>>k>>q;
		mp[q] += k;
	}
	ll ans=0;
	for(auto it=mp.rbegin();it!=mp.rend();it++){
		if(n >=it->se){
			ans+=it->se*it->fi;
			n-=it->se;
			// cout<<ans<<"  "<<it->fi<<endl;

		}
		else if(n>0){
			ans+=it->fi*n;
			n=0;
						// cout<<ans<<"  "<<it->fi<<endl;

		}
	}
	cout<<ans;
}

Measured memory_bytes: 12800
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <tuple>
#include <vector>

using namespace std;
typedef long long ll;

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define reps(i, f, n) for (ll i = (f); i < (n); i++)
#define repr(i, n) for (ll i = n; i >= 0; i--)
#define repv(v) for (auto it = (v).begin(); it != (v).end(); it++)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define pb push_back
#define INIT    \
    cin.tie(0); \
    ios::sync_with_stdio(false);

template <class T>
inline bool chmax(T& a, T b) {
    return a = (a < b) ? b : a;
}
template <class T>
inline bool chmin(T& a, T b) {
    return a = (a > b) ? b : a;
}

ll const INF = 1LL << 60;
ll const MOD = 1000000007;

int main() {
    INIT;
    ll L, R, d;
    cin >> L >> R >> d;

    ll ans = 0;
    reps(i, L, R+1) {
        if (i % d == 0) ans++;
    }

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

Measured memory_bytes: 3608
object Main {
  def main(args: Array[String]): Unit = {
    val lines = io.Source.stdin.getLines().toList
    println(solve(lines.head))
  }
  /**
    * """
    * 問題文
    * AtCoder 星には四種類の塩基 A, C, G, T が存在し、A と T、C と G がそれぞれ対になります。
    * 文字 b が入力されます。これは A, C, G, T のいずれかです。塩基
    * b と対になる塩基を表す文字を出力するプログラムを書いてください。
    * 制約 b は文字 A, C, G, T のいずれかである。
    *
    * @param src
    * @return
    */
  def solve(src: String) = {
    val helixPairs = Map(
      "A" -> "T",
      "T" -> "A",
      "C" -> "G",
      "G" -> "C"
    )
    helixPairs(src)
  }
}

Measured memory_bytes: 25544
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int a = sc.nextInt();
		// スペース区切りの整数の入力
		int b = sc.nextInt();
		int t = sc.nextInt();
      
      	int divNum = t/a;
		// 出力
		System.out.println(b*divNum);
	}
}

Measured memory_bytes: 22740
N = int(input())
P = [int(input()) for _ in range(N)]
Index = [None] * N
Used = set()
Chain = [1] * N

for i in range(N):
    p = P[i]
    Index[p-1] = i
    Used |= {p}
    if p-1 in Used:
        Chain[i] = Chain[Index[p-2]] + 1

print(N - max(Chain))

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

using namespace std;

int a[200001];

int main() {
    int n;
    cin >> n;
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }
    long answer = n;
    int sum = sum = a[0];
    for (int l = 0, r = 0; l < n; ++l) {
        while (r + 1 < n && sum + a[r + 1] == (sum ^ a[r + 1])) {
            sum ^= a[++r];
        }
        answer += r - l;
        sum ^= a[l];
    }
    cout << answer << endl;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std; 
typedef long long int ll;
typedef unsigned long long int ull;
typedef pair <int,int> PII;
typedef pair <ll, ll> PLL;
typedef pair <int,string> PIS;
typedef vector <int> vec;
typedef priority_queue<int> PQ;
#define endl '\n'
#define pi 3.141592653589793
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define fori(z,n)  for(int i=z;i<n;i++)
#define fork(z,n)  for(int k=z;k<n;k++)
#define forii(z,n) for(int i=z;i<=n;i++)
#define forkk(z,n) for(int k=z;k<=n;k++)
int maxElement(int arr[],int n)
{
    int maxi=arr[0];
    for(int i=1;i<n;i++)
    {
        if(arr[i]>maxi)
            maxi=arr[i];
    }
    return maxi;
}
int minElement(int arr[],int n)
{
    int mini=arr[0];
    for(int i=1;i<n;i++)
    {
        if(arr[i]<mini)
            mini=arr[i];
    }
    return mini;
}
string trim(const string& str)
{
    size_t first = str.find_first_not_of(' ');
    if (string::npos == first)
    {
        return str;
    }
    int last = str.find_last_not_of(' ');
    return str.substr(first, (last - first + 1));
}
const int MAX = 200005;
ll tree[MAX*4];
void updateQuery(int v, int tl, int tr, int index, ll value)
{
    if(tl==tr)
        tree[v] = value;
    else
    {
        int mid = tl + (tr-tl)/2;
        if(index<=mid)
            updateQuery(v*2+1,tl,mid,index,value);
        else
            updateQuery(v*2+2,mid+1,tr,index,value);
        tree[v] = max(tree[v*2+2],tree[v*2+1]);
    }
}
ll checkQuery(int v, int tl, int tr, int l, int r)
{
    if(l<=tl && r>=tr)
        return tree[v];
    if(l>tr || r<tl)
        return 0;
    int mid = tl + (tr-tl)/2;
    ll b1 = checkQuery(v*2+1,tl,mid,l,r);
    ll b2 = checkQuery(v*2+2,mid+1,tr,l,r);
    return max(b1,b2);
}
int main() 
{ 
    std::ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    memset(tree,0,sizeof(tree));
    int n;cin>>n;
    int h[n],b[n];
    int maxi=INT_MIN;
    fori(0,n)
    {
        cin>>h[i];
        maxi = max(maxi,h[i]);
    }
    fori(0,n) cin>>b[i];
    ll dp[n];
    dp[0]=b[0];
    ll ans=dp[0];
    updateQuery(0,0,maxi,h[0],b[0]);
    fori(1,n)
    {
        ll c1 = checkQuery(0,0,maxi,0,h[i]-1);
        dp[i] = (ll)b[i] + c1;
        updateQuery(0,0,maxi,h[i],dp[i]);
        ans = max(ans,dp[i]);
    }
    cout<<ans<<endl;
    cerr<<"Time elapsed"<<1.0*clock()/CLOCKS_PER_SEC<<"s\n";
    return 0;
}


Measured memory_bytes: 9600
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0; i<n; i++)
#define eb(t) emplace_back(t)
typedef long long ll;
typedef long long unsigned int llu;
typedef long double ld;
ll INF = 1000000009;
ll MOD = 1000000007;

ll a[200010];
ll b[200010];

ll gcd( ll a, ll b )
{
    ll temp;

    if( a < b ) { temp = a; a = b; b = temp; }
    if( b < 1 ) return -1;

    if( a % b == 0 ) return b;
    return gcd( b, a % b );
}


ll l[35];

ll power(ll m, ll n){

    l[0]=m;
    for(ll i=1; i<35; i++){
        l[i] = (l[i-1]*l[i-1]) % MOD;
    }

    ll tmp = n;
    ll ans = 1;
    rep(i,35){
        if(tmp%2==1){
            ans = (ans*l[i]) % MOD;
        }
        tmp /= 2;
    }
    return ans%MOD;

}


map<pair<ll,ll>, ll> mp;
set<pair<ll,ll>> st;

void solve(){

    ll n;
    cin >> n;

    ll c0 = 0;

    rep(i,n){
        cin >> a[i] >> b[i];
        if(a[i]<0&&b[i]<0){
            a[i]=-a[i];
            b[i]=-b[i];
        }
        else if(a[i]>0&&b[i]<0){
            a[i]=-a[i];
            b[i]=-b[i];
        }

        if(a[i]==0&&b[i]==0){
            c0++;
            continue;
        }
        else if(a[i]==0){
            st.insert(make_pair(0,1));
            mp[make_pair(0,1)]++;
            continue;
        }
        else if(b[i]==0){
            st.insert(make_pair(1,0));
            mp[make_pair(1,0)]++;
            continue;
        }

        else{
            ll x,y;
            x=abs(a[i]);
            y=abs(b[i]);
            ll g = gcd(x,y);
            x=a[i]/g;
            y=b[i]/g;
            mp[make_pair(x,y)]++;
            st.insert(make_pair(x,y));
        }
    }

    

    //mod忘れずに
    ll ans = 1;
    for(auto itr = st.begin(); itr != st.end(); ++itr){
        ll p,q;
        p = mp[*itr];
        ll x,y;
        x=(*itr).first;
        y=(*itr).second;

        pair<ll,ll> q_;
        
        if(x>0&&y>0) q_ = make_pair(-y,x);
        else if(x<0&&y>0) q_ = make_pair(y,-x);
        else if(x==0) q_ = make_pair(1,0);
        else q_ = make_pair(0,1);
        q=mp[q_];
        ll tmp = power(2,p)+power(2,q)-1;
        //cout << x << " " << y << " " << p << " " << q << " " << tmp << endl;
        ans = (ans * tmp)%MOD;
        mp[make_pair(x,y)]=0;
        mp[q_]=0;
    }

    ans = (ans + MOD - 1)%MOD;
    ans = (ans + c0)%MOD;

    cout << ans << endl;

}

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


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

const int MAX_N = 200000;
vector<vector<int>> g(MAX_N);
vector<int> cnt(MAX_N, 0);
vector<int> ans(MAX_N, 0);
vector<bool> visited(MAX_N, false);

void dfs(int x) {
	visited[x] = true;
	ans[x] += cnt[x];
	for (int ind : g[x]) {
		if (!visited[ind]) {
			cnt[ind] += cnt[x];
			dfs(ind);
		}
	}
}

int main() {
	int N, Q;
	cin >> N >> Q;
	for (int i=0;i<N-1;i++) {
		int a, b;
		cin >> a >> b;
		g[a-1].push_back(b-1);
		g[b-1].push_back(a-1);
	}

	for (int i=0;i<Q;i++) {
		int p, x;
		cin >> p >> x;
		cnt[p-1] += x;
	}

	dfs(0);

	for (int i=0;i<N;i++) {
		cout << ans[i];
		if (i != N-1) cout << " ";
		else cout << endl;
	}
}

Measured memory_bytes: 25152
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=300010;
ll x,y,a,b,c,idx; 
struct node
{
	ll x,c;
}e[N];
bool cmp(node a,node b)
{
	return a.x>b.x;
}
int main()
{
	cin>>x>>y>>a>>b>>c;
	for(int i=1;i<=a;i++) cin>>e[idx].x,e[idx++].c=1;
	for(int i=1;i<=b;i++) cin>>e[idx].x,e[idx++].c=2;
	for(int i=1;i<=c;i++) cin>>e[idx].x,e[idx++].c=3;
	sort(e,e+idx,cmp);
	int res1=0,res2=0,res3=0;
	ll sum=0;
	for(int i=0;i<idx;i++)
	{
		if(res1<x&&e[i].c==1)
		{
			res1++;
			sum+=e[i].x;
		}
		if(res2<y&&e[i].c==2)
		{
			res2++;
			sum+=e[i].x;
		}
		if(e[i].c==3) sum+=e[i].x,res3++;
		if(res1+res2+res3==x+y) break;
	}
	
	cout<<sum;
	return 0; 
}

Measured memory_bytes: 4992
#include <iostream>
#include <vector>

int main(void) {
    unsigned int k;
    unsigned int n;
    unsigned int start = 0;
    unsigned int distance = 0;
    unsigned int max_distance = 0;
    std::vector<unsigned int> a;

    std::cin >> k >> n;
    a.resize(n);
    for(unsigned int i = 0; i < n; i++) {
        std::cin >> a[i];
    }

    max_distance = k - a.back() + a.front();
    for(unsigned int i = 1; i < n; i++) {
        distance = a[i] - a[i-1];
        if(max_distance < distance) {
            max_distance = distance;
            start = i;
        }
    }

    distance = 0;

    for(unsigned int i = (start+1)%n; i != start; i = (i+1)%n) {
        if(a[(i+n-1)%n] == a.back()) {
            distance += a[i] - (a.back() - k);
        } else {
            distance += a[i]-a[(i+n-1)%n];
        }
    }

    std::cout << distance << std::endl;

    return 0;
}


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

int main()
{
    char a,b;

    while(cin>>a>>b)
    {
        if(a=='H')
            cout<<b<<endl;
        else{
            if(b=='D')
                cout<<"H"<<endl;
                else if(b=='H')
                    cout<<"D"<<endl;
        }
    }
}


Measured memory_bytes: 256
S = input()


x = "keyence"

if S[:7] == x:
    print("YES")
    exit()

for i in range(0,len(x)):
    if S[:i]== x[:i] and S[-(7-i):] == x[i:] :
        print("YES")
        exit()
    # tr:
    #     index1 = S.index(x[:i])
    #     index2 = S.rindex(x[i:])
    #     print(index1,index2)
    #     if index1==0 and index2+i == len(S) and index1<index2:
    #         print(index1,index2)
    #         print("YES")
    #         exit()
    # except ValueError:
    #     continue
print("NO")

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

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

    ll n,p;
    cin >> n >> p;
    
    ll cnt = 0;
    
    for(int i = 0; i < n; i++){
        int a;
        cin >> a;
        if(a%2 == 0) cnt++;
    }
    
    ll ans = 0;
    
    if(cnt == n){
        if(p == 0) ans = pow(2, n);
        else ans = 0;
    } else {
        ans = pow(2,n - 1);
    }
    
    cout << ans << endl;

}


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

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

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<tuple>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define Per(i,sta,n) for(int i=n-1;i>=sta;i--)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;
int dx[4]={1,-1,0,0};
int dy[4]={0,0,1,-1};

string s;
int dp1[200010],dp2[200010];

void solve(){
    int n,k,c;
    cin >> n >> k >> c;
    cin >> s;
    rep(i,n){
        dp1[i+1]=dp1[i];
        if(i-c>=0){
            dp1[i+1]=max(dp1[i+1],dp1[i-c]+(s[i]=='o'));
        }
        else{
            dp1[i+1]=max(dp1[i+1],(int)(s[i]=='o'));
        }
    }
    per(i,n){
        dp2[i+1]=dp2[i+2];
        if(i+c+2<=n+1){
            dp2[i+1]=max(dp2[i+1],dp2[i+c+2]+(s[i]=='o'));
        }
        else{
            dp2[i+1]=max(dp2[i+1],(int)(s[i]=='o'));
        }
    }
    // rep(i,n+2){
    //     cout << i << " " << dp1[i] << " " << dp2[i] << endl;
    // }
    multiset<P> se={P(mod,0)};
    Rep(i,-c+1,n+1){
        //cout << i << " " << i+c << " " <<  dp1[max(0,i-1)]+dp2[min(i+max(1,c),n+1)] << endl;
        if(dp1[max(0,i-1)]+dp2[min(i+max(1,c),n+1)]>=k){
            se.insert(P(i,0));
            se.insert(P(i+max(1,c),1));
        }
    }
    int a=0;
    rep(i,n){
        //cout << i << endl;
        while((*se.begin()).first<=i+1){
            //cout << (*se.begin()).first << " " << (*se.begin()).second << " " << endl;
            if((*se.begin()).second==0){
                a+=1;
            }
            else{
                a-=1;
            }
            se.erase(se.begin());
        }
        //cout << i+1 << " " << a << endl;
        if(a==0){
            cout << i+1 << endl;
        }
    }
}

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

Measured memory_bytes: 20756
#include <iostream> 
#include <vector> 
#include <algorithm> 
#include <bits/stdc++.h> 
#include <stdlib.h> 
#include <stdio.h> 
#include <functional> 
#include<math.h> 
#include<cstring>
using namespace std;
typedef long long ll;
int N,M;
vector<pair<int,int>> bridge(50);
vector<bool> mark(50);
int p;
void search(int x){
    if(mark.at(x) == true){
        return;
    }
    else{
        mark.at(x) = true;
        for(int i = 0; i < 50; i++){
            if(bridge.at(i).first == x){
                search(bridge.at(i).second);
            }
            if(bridge.at(i).second == x){
                search(bridge.at(i).first);
            }
        }
    }
}

int main(void){
    // Your code here
    cin >> N >> M;
    for(int i = 0; i < M; i++){
        cin >> bridge.at(i).first >> bridge.at(i).second;
        bridge.at(i).first--;
        bridge.at(i).second--;
    }
    
    vector<pair<int,int>> bridge_copy(50);
    bridge_copy = bridge;
    vector<bool> mark_copy(50);
    for(int i = 0; i < N; i++){
        mark_copy.at(i) = false;
    }
    for(int i = N; i < 50; i++){
        mark_copy.at(i) = true;
    }
    
    int cnt = 0;
    for(int  i = 0; i < M; i++){
        mark = mark_copy;
        bridge.at(i).first = -1;
        bridge.at(i).second = -1;
        search(0);
        int h = 0;
        for(int j = 0; j < 50; j++){
            if(mark.at(j) == false){
                h = 1;
            }
        }
        if(h == 1){
            cnt++;
        }
        bridge = bridge_copy;
        mark = mark_copy;
    }
    cout << cnt;
}
    
    

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>

using namespace std;

struct Crop {
  string name;
  int profit;
  int period;
  bool operator <(const Crop& o) const {
    if(profit * o.period > period * o.profit)
      return true;
    if(profit * o.period < period * o.profit)
      return false;
    return name < o.name;
    }
};

int main(){
  string l;
  int n,p,a,b,c,d,e,f,s,m;
  Crop cr;
  while(cin>>n){
    if(!n)break;
    vector<Crop> crops;
    for(int i=0;i<n;i++){
      cin>>l>>p>>a>>b>>c>>d>>e>>f>>s>>m;
      cr.name = l;
      cr.profit = s*f*m-p;
      cr.period = a+b+c+(d+e)*m;
      crops.push_back(cr);
    }
    sort(crops.begin(),crops.end());
        for(int i=0;i<crops.size();i++){
      cout<<crops[i].name<<endl;
    }
    cout<<"#"<<endl;
  }
  return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <algorithm>
#include <set>
#define F first
#define S second
using namespace std;
int n, ans;
pair<int, int> a[205];
set<int> st;
int main() {
	int i;
	set<int>::iterator it;
	cin>>n;
	for(i=0; i<2*n; i++) {
		cin>>a[i].F>>a[i].S;
		a[i].F = a[i].F*10 + (i<n);
	}
	sort(a, a+2*n);
	for(i=0; i<2*n; i++) {
		if(a[i].F%2) st.insert(a[i].S);
		else {
			it = st.lower_bound(a[i].S);
			if(it!=st.begin()) {
				st.erase(--it);
				ans++;
			}
		}
	}
	cout<<ans;
	return 0;
}

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

using namespace std;
typedef long long int ll;

ll calc(ll n)
{
	ll sum = 7, st = 10;
	for(int i = 0; i < 1000000; i++)
	{
		if(sum % n == 0)
			return i + 1;
		sum = sum * 10;
		sum %= n;
		sum += 7;
		sum %= n;
	}
	return -1;
}

void solve()
{
	ll n;
	cin >> n;
	cout << calc(n);
}

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

Measured memory_bytes: 3644
#include<bits/stdc++.h>
 
using namespace std;
#define int         long long
#define double      long double
#define endl        '\n'
 
#define pb          push_back
#define pf          push_front
#define lb(v,n)     lower_bound(all((v)),(n))
#define ub(v,n)     upper_bound(all((v)),(n))
 
#define vi          vector<int>
#define vii         vector<pii>
#define viiii       vector<pair<pii,pii>>
 
#define mi          map<int,int>
#define mii         map<pii,int>
 
#define pii         pair<int,int>
#define piii        pair<int,pair<int,int> >
#define piiii       pair<pii,pii>
#define fi          first
#define se          second
#define mp          make_pair
#define all(a)      (a).begin(),(a).end()
#define rall(a)     (a).rbegin(),(a).rend()
 
#define rep(X,Y) for (int (X) = 0;(X) < (Y);++(X))
#define reps(X,S,Y) for (int (X) = S;(X) < (Y);++(X))
#define rrep(X,Y) for (int (X) = (Y)-1;(X) >=0;--(X))
#define rreps(X,S,Y) for (int (X) = (Y)-1;(X) >= (S);--(X))
#define repe(X,Y) for ((X) = 0;(X) < (Y);++(X))
#define toit ios::sync_with_stdio(0);cin.tie(0);
 
 
 
int gcd(int a, int b) {  if (b == 0)  return a; return gcd(b , a % b); }
bool mod(double a,double b) {return a/b - floor(a/b);}
 
int occurs(vi v,int n){
auto it=lb(v,n);auto it1=ub(v,n);int x=it1-it;return x;}
 
double max(double a,double b){
    return a<b ? b:a;
}



signed main()
{toit
    int n;cin>>n;
    int m=0;
    int a[n];
    rep(i, n){
        cin>>a[i];
        m+=a[i];
    }
    
        m /= n;
        int ans=0;
        rep(i,n){
            ans += (a[i]-m)*(a[i]-m);
        }
        m++;
        int ans1=0;
        rep(i,n){
            ans1 += (a[i]-m)*(a[i]-m);
        }
        cout<<min(ans,ans1);
    
    
    return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<string>

using namespace std;

int main() {
    string s;
    int N[3];
    cin >> s;
    for(int i = 0; i < 3; i++) {
        N[i] = (int)(s[i] - '0');
    }

    int cnt = 0;
    for(int i = 0; i < 3; i++) {
        if(N[i] == 1) { cnt++; }
    }
    cout << cnt << endl;
}


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

typedef long long ll;
typedef int keytype;

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

void quicksort(keytype a[], int first, int last)
{
    int i, j;
    keytype x, t;

    x = a[(first + last) / 2];
    i = first;  j = last;
    for ( ; ; ) {
        while (a[i] < x) i++;
        while (x < a[j]) j--;
        if (i >= j) break;
        t = a[i];  a[i] = a[j];  a[j] = t;
        i++;  j--;
    }
    if (first  < i - 1) quicksort(a, first , i - 1);
    if (j + 1 < last) quicksort(a, j + 1, last);
}

int is_prime(int x){
    if(x <= 1) return 0;
    for(int i = 2; i * i <= x; i++){
        if(x % i == 0) return 0;
    }
    return 1;
}

int is_substr(char s[], char t[], int i){
    int flag = 1;

    if(s[i] == '\0') flag = 0;

    for(int j = 0; j < strlen(t); ++j, ++i){
        if(s[i] != t[j]){
            flag = 0;
            break;
        }
    }
    return flag;
}

// factor list, number of factors, natural number
void factorize(int ftr[], int *num, int n){
    int a = 2, cnt = 0;

    while(n >= a){
        if(n % a == 0){
            n = n / a;
            ftr[cnt++] = a;
        }else{
            a++;
        }
    }
    *num = cnt;
}

void comb(int size1, int size2, int v[size1][size2]){
  for(int i = 0; i < size1; i++){
    v[i][0] = 1;
    v[i][i] = 1;
  }
  for(int k = 1; k < size1; k++){
    for(int j = 1; j < k; j++){
      v[k][j] = (v[k-1][j-1] + v[k-1][j]);
    }
  }
}

int abs_val(int a, int b){
    if(a > b) return a - b;
    else return b - a;
}

int main(){
    int x1, y1, x2, y2;
    int x3, y3, x4, y4;

    scanf("%d %d %d %d", &x1, &y1, &x2, &y2);

    x3 = x2 - (y2 - y1);
    y3 = y2 + (x2 - x1);
    x4 = x1 - (y2 - y1);
    y4 = y1 + (x2 - x1);

    printf("%d %d %d %d\n", x3, y3, x4, y4);

    return 0;
}


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

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vint;
typedef vector<double> vd;
typedef vector<ll> vll;
typedef vector<string> vstr;
typedef vector<vector<int>> vvint;
typedef vector<pair<int, int>> vpii;
typedef vector<pair<ll, ll>> vpll;
typedef priority_queue<int, vector<int>, greater<int>> spqint; //小さい順に取り出し
typedef priority_queue<ll, vector<ll>, greater<ll>> spqll;     //小さい順に取り出し
typedef priority_queue<int, vector<int>, less<int>> bpqint;    //大きい順に取り出し
typedef priority_queue<ll, vector<ll>, less<ll>> bpqll;        //大きい順に取り出し

#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define FOR(i, a, b) for (ll i = (ll)a; i < (ll)b; i++)
#define IREP(i, v) for (auto i = (v).begin(); i != (v).end(); i++)
#define FI first
#define SE second
#define MP make_pair
#define MT make_tuple
#define PB push_back
#define PF push_front
#define TS to_string
#define BS binary_search
#define LB lower_bound
#define UB upper_bound
#define NP next_permutation
#define ALL(v) (v).begin(), (v).end()
#define SZ(x) (ll) x.size()
#define SP(x) setprecision((ll)x)


int INF = 1e9;
int NIL = -1;
ll MOD = 1000000007;
ll LINF = 1e18;
double EPS = 1e-9;
double PI = M_PI;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; } //最大公約数
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }     //最小公倍数

void yes(){ cout << "Yes" << endl;}
void no(){ cout << "No" << endl;}
//-----------------------------------------

//-----------------------------------------
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    std::chrono::system_clock::time_point start,end;
    start = std::chrono::system_clock::now();

    ll n ;
    cin >> n ;
    vint seen(n,0) ;
    vint color(n) ;
    vector<vpll> graph(n,vpll()) ;
    queue<ll> que ; 
    REP(i,n-1){
        ll u, v, w ;
        cin >> u >> v >> w ;
        graph[u-1].PB(MP(v-1,w)) ;
        graph[v-1].PB(MP(u-1,w)) ;
    }

    que.push(0) ;
    seen[0] = 1 ;
    color[0] = 0 ;

    while(!que.empty()){
        ll k = que.front() ;
        que.pop() ;
        REP(i,SZ(graph[k])){
            if(seen[graph[k][i].FI]==0){
                que.push(graph[k][i].FI) ;
                seen[graph[k][i].FI] = 1 ;
                if(graph[k][i].SE%2==0){
                    color[graph[k][i].FI] = color[k] ;
                }
                else{
                    color[graph[k][i].FI] = (color[k] + 1) %2 ;
                }
            }
        }
    }

    REP(i,n){
        cout << color[i] <<endl;
    }


    end = std::chrono::system_clock::now();
    auto elapsed = std::chrono::duration_cast< std::chrono::milliseconds >(end - start).count();
    //std::cout << elapsed <<"ms"<< std::endl;

    

    return 0;
}



Measured memory_bytes: 11332
using System;
using System.Linq;

class C
{
	static void Main()
	{
		Console.ReadLine();
		var s = Console.ReadLine();

		int m = s.Skip(1).Count(c => c == 'E'), t = m;
		for (int i = 1; i < s.Length; i++)
		{
			if (s[i - 1] == 'W') t++;
			if (s[i] == 'E') t--;
			m = Math.Min(m, t);
		}
		Console.WriteLine(m);
	}
}


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

int main() {
	//cout<<"GfG!";
	int n;
	string s;
	cin>>n;
	cin>>s;
	if(n%2==1)
	{
	    cout<<"No"<<endl;
	}
	else
	{
	   for(int i=0;i<n/2;i++)
	   {
	       if(s[i]!=s[n/2+i])
	       {
	           cout<<"No"<<endl;
	           return 0;
	       }
	   }
	   cout<<"Yes"<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<(n); i++)
int main()
{
    int a, n;
    cin >> n >> a;
  	
  	int x = n % 500;
  	if(x <= a)
    	cout << "Yes" << endl;
  	else
    	cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
int main(void){
    int n, m, i, j, x;
    scanf("%d %d", &n, &m);
    
    int a[100][100]={{0}}, b[100]={0}, c[100]={0};
    for(i=0; i<n; i++){
        for(j=0; j<m; j++){
            scanf("%d ", &x);
            a[i][j] = x;
        }
    }
    
    for(i=0; i<m; i++){
        scanf("%d\n", &x);
        b[i] = x;
    }
    
    for(i=0; i<n; i++){
        for(j=0; j<m; j++){
            c[i] = c[i] + a[i][j]*b[j];
        }
    }
    for(i=0; i<n; i++){
        printf("%d\n", c[i]);
    }
    return 0;
}


Measured memory_bytes: 2144
x,y=gets.chomp.split.map(&:to_i)
ans = Float::INFINITY
if y-x>0
    ans=y-x if y-x < ans
end
if y+x>=0
    ans = y+x+1 if y+x+1 < ans
end
if x-y>0
    ans = x-y+2 if x-y+2 < ans
end
if -y-x>0
    ans = -y-x+1 if -y-x+1< ans
end
puts ans

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

typedef pair<int,int> P;
const int INF = 500000000;

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

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

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

using namespace std;

typedef long double ld;
const ld INF = 1e+8;

int main() {
  int n;
  cin>>n;
  vector<int> a(n);
  REP(i,n)cin>>a[n-i-1];
  vector<ld> dp(200000,INF);
  REP(i,200000) {
    if(!i) continue;
    dp[i] = abs((ld)(i-a[0]))/a[0];
  }
  REP(i,n-1) {
    vector<ld> tmp(200000,INF);
    REP(j,200000) {
      if(!j) continue;
      for(int k=j; k < 200000; k += j) {
        tmp[j] = min(tmp[j], max(abs((ld)(j-a[i+1]))/a[i+1], dp[k]));
      }
    }
    swap(tmp,dp);
  }
  cout << setprecision(10) << fixed << *min_element(begin(dp),end(dp)) << endl;
  return 0;
}

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

int64_t Pow(int64_t a) { return a * a * a * a * a; }

int main() {
    int X; cin >> X;
    for(int A = -1000; A <= 1000; ++A) {
        for(int B = -1000; B <= 1000; ++B) {
            if(Pow(A) - Pow(B) == X) {
                cout << A << " " << B << '\n';
                return 0;
            }
        }
    }
    return 0;
}


Measured memory_bytes: 3648
import fractions
N = int(input())
tokei = [int(input()) for _ in range(N)]
if N == 1:
    print(tokei[0])
    exit()
def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)
ans = lcm(tokei[0],tokei[1])
for i in range(2,N):
    ans = lcm(ans,tokei[i])
print(ans)

Measured memory_bytes: 5048
#include <bits/stdc++.h>
using namespace std;
struct Fast {
    Fast() {
        cin.tie(0);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(20);
    }
} fast;
template <typename A, size_t N, typename T> void Fill(A (&array)[N], const T& val) {
    std::fill((T*)array, (T*)(array + N), val);
}
// long long mod = 998244353;
#define REP(i, n) for (long long i = 0; i < (n); i++)
#define rep(i, a, n) for (long long i = a; i < (n); i++)
typedef long long ll;
typedef pair<ll, ll> P;
long long mod = 1000000007;
long long modpow(long long m, long long n, long long modvalue) {
    if (n == 0) return 1;
    if (n % 2 == 0) {
        long long t = modpow(m, n / 2, modvalue);
        return t * t % modvalue;
    } else {
        return modpow(m, n - 1, modvalue) * m % modvalue;
    }
}

long long moddiv(long long a, long long b, ll modvalue) { return (a * modpow(b, mod - 2, modvalue)) % modvalue; }

const ll INF = 1LL << 60;

string change_binary(long long a) {
    string ret;
    for (int i = 31; i >= 0; i--) {
        ret += (a >> i & 1) + '0';
    }
    return ret;
}

ll nCkmod(ll n, ll k, ll modvalue) {
    ll numera = 1;
    for (int i = n; i > n - k; i--) {
        numera *= i;
        numera %= modvalue;
    }
    ll denomi = 1;
    REP(i, k) {
        denomi *= (i + 1);
        denomi %= modvalue;
    }
    return moddiv(numera, denomi, modvalue);
}
signed main() {
    ll n;
    cin >> n;
    cout << 8 - (n - 400) / 200 << endl;
}

Measured memory_bytes: 3640
#include <iostream>
//#include <iomanip>
//#include <algorithm>
//#include <numeric>
//#include <queue>
//#include <math.h>
#include <vector>
//#include <string>
typedef long long LL;
using namespace std;
 
int main(){
    int n;
    vector<LL> a;
    vector<LL> m;
    LL tmp_a;
    LL a_sum_e=0;
    LL a_sum_o=0;
    LL ans;

    cin >> n;
    for(int i=0; i<n; i++){
        cin >> tmp_a;
        a.push_back(tmp_a);
        m.push_back(0);
    }
    for(int i=0; i<n; i++){
        if(i%2==0){
            a_sum_e+=a[i];
        }else{
            a_sum_o+=a[i];
        }
    }
    ans = a_sum_e - a_sum_o;
    for(int i=0; i<n; i++){
        if(i==0){
            cout << ans << " ";
        }else{
            ans = (-1)*(ans - 2*a[i-1]);
            cout << ans << " ";
        }
    }
    cout << endl;
}

Measured memory_bytes: 3052
#include<bits/stdc++.h>
#define fo(i,a,b) for(int i=a;i<=b;i++)
#define fd(i,a,b) for(int i=a;i>=b;i--)
#define N 25
#define mo 1000000007
using namespace std;
int n,m,h,a[N][N],f[N][1048577],e[N],nxt[1048577][N],ans=0;
int main() {
	scanf("%d%d%d",&n,&m,&h);
	fo(i,1,h) { int x,y,z;scanf("%d%d%d",&x,&y,&z); a[x][y]=z+1; }
	e[0]=1;fo(i,1,n) e[i]=e[i-1]*2;
	fo(s,0,e[n]-1) { int y=-1; fd(j,n,1) { nxt[s][j]=y; if(s&e[j-1]) y=j; } }
	f[n][0]=1;
	fo(i,1,m){
		fo(s,0,e[n]-1) f[1][s]=f[n][s]; fo(j,2,n) fo(s,0,e[n]-1) f[j][s]=0;
		fo(j,1,n-1){
			fo(s,0,e[n]-1)
				if(f[j][s]){
					if(s&e[j-1]){ if(a[i][j]!=1) (f[j+1][s]+=f[j][s])%=mo; }
					else{
						if(a[i][j]!=2) (f[j+1][s]+=f[j][s])%=mo;
						if(a[i][j]!=1){ int s1=s; if(nxt[s][j]!=-1) s1-=e[nxt[s][j]-1]; s1+=e[j-1]; (f[j+1][s1]+=f[j][s])%=mo; }
					}
				}
		}
	}
	fo(s,0,e[n]-1) (ans+=f[n][s])%=mo;
	printf("%d\n",ans);
	return 0;
}

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


#define li          long long int
#define rep(i,to)   for(li i=0;i<((li)(to));i++)
#define repp(i,start,to)    for(li i=(li)(start);i<((li)(to));i++)
#define pb          push_back
#define sz(v)       ((li)(v).size())
#define bgn(v)      ((v).begin())
#define eend(v)     ((v).end())
#define allof(v)    (v).begin(), (v).end()
#define dodp(v,n)       memset(v,(li)n,sizeof(v))
#define bit(n)      (1ll<<(li)(n))
#define mp(a,b)     make_pair(a,b)
#define rin rep(i,n)
#define EPS 1e-12
#define ETOL 1e-8
#define MOD 1000000007
typedef pair<li, li> PI;

#define INF bit(60)

#define DBGP 1


#define idp if(DBGP)
#define F first
#define S second
#define p2(a,b)     idp cout<<a<<"\t"<<b<<endl
#define p3(a,b,c)       idp cout<<a<<"\t"<<b<<"\t"<<c<<endl
#define p4(a,b,c,d)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<endl
#define p5(a,b,c,d,e)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<endl
#define p6(a,b,c,d,e,f)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<endl
#define p7(a,b,c,d,e,f,g)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<endl
#define p8(a,b,c,d,e,f,g,h)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<endl
#define p9(a,b,c,d,e,f,g,h,i)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<endl
#define p10(a,b,c,d,e,f,g,h,i,j)        idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<"\t"<<j<<endl
#define foreach(it,v)   for(__typeof((v).begin()) it=(v).begin(); it!=(v).end(); ++it)
#define p2p(x)      idp p2((x).F, (x).S)
#define dump(x,n)   idp{rep(i,n){cout<<x[i]<<" ";}puts("");}
#define dump2(x,n)  idp{rep(i,n){cout<<"["<<x[i].F<<" , "<<x[i].S<<"] ";}puts("");}
#define dumpi(x)    idp{foreach(it, x){cout<<(*it)<<" ";}puts("");}
#define dumpi2(x)   idp{foreach(it, x){cout<<"["<<(it)->F<<" , "<<(it)->S<<"] ";}puts("");}

#define read2d(a,w,h)   rep(i,h)rep(j,w)cin>>a[i][j]
#define dump2d(a,w,h)   rep(i,h){rep(j,w)cout<<a[i][j]<<" ";puts("");}

typedef pair<li, li> PI;

int main() {
    string s;
    cin >> s;
    for (auto& c : s) {
        if (c == '?') {
            c = 'D';
        }
    }
    cout << s << endl;
    return 0;
}

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

int main() {
	int n,m,i,j;
	cin>>n>>m;
	int red[n]={0};
	int box[n];
	fill(box,box+n,1);
	red[0]=1;
	int x,y;
	for(i=0;i<m;i++){
		cin>>x>>y;
		box[x-1]--;
		box[y-1]++;
		if(red[x-1]==1){
			red[y-1]=1;
			if(box[x-1]<=0) red[x-1]=0;
		}
	}
	int ans=0;
	for(i=0;i<n;i++){
		if(red[i]==1) ans++;
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define int long long
using namespace std;

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;
}

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

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


signed main(){
    int x,y;
    cin>>x>>y;
    
    if(y%2==0 && y>=x*2 && y<=x*4)
        cout<<"Yes\n";
    else
        cout<<"No\n";
        
    return 0;
}

Measured memory_bytes: 3636
/* Life is all about calculated risks.
    But man am I bad at math. */

#include <iostream>
#include<vector>
#include <algorithm>
#define ll long long int
#define INF 1000000000000
#define MOD 1000000007

#define DEBUG(x) cerr<<"> "<< #x << ':' <<x<<endl;

using namespace std;

ll f(ll stone);

ll n,k;
ll h[100100];

vector<ll> dp(100100,-1);

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

    cin>>n>>k;
    for(ll i=1; i<=n; i++)
    {
        cin>>h[i];
    }

    cout<<f(n)<<endl;

    return 0;
}

ll f(ll stone)
{
    if(dp[stone] != -1)
    {
        return dp[stone];
    }
    if(stone == 1)
    {
        return dp[stone] = 0;
    }

    ll min_sum = INF;
    for(ll i=1; (i<=k) && (stone-i > 0); i++)
    {
        if(f(stone-i) + abs(h[stone] - h[stone-i]) < min_sum)
        {
            min_sum = f(stone-i) + abs(h[stone] - h[stone-i]);
        }
    }   

    return dp[stone] = min_sum;
}

Measured memory_bytes: 6528
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String s = scan.nextLine();
		String firstPart = s.substring(0, 4);
		String secondPart = s.substring(4, 12);
		System.out.println(firstPart + " " + secondPart);
		scan.close();
	}

}


Measured memory_bytes: 10192
#include<iostream>
#include<algorithm>
#include<string>
#include<cstdlib>
#include<map>
#include<iomanip>
#include<sstream>
#include<vector>
#include<stack>
#include<math.h>
#include<queue>
#include<complex>
#include<random>
#include<ctime>
#include<set>
using namespace std;


const long long int mod=1000000007;
const long long int INF=99999999999999999;

long long int H,A;
int main() {
	cout << fixed << setprecision(18);
	cin>>H>>A;
	cout<<(H+A-1)/A;
	
} 

Measured memory_bytes: 256
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        _n: usize,
        ass: [usize; _n],
    }
    let mut ass = ass;
    ass.sort();
    println!("{}", ass.last().unwrap() - ass.first().unwrap());
}


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

using ll = long long;
using ull = unsigned long long;
using st = string;
using db = double;
using vll = vector<long long>;
using vvll = vector<vll>;
using vst = vector<st>;
using vchar = vector<char>;
using pll = pair<ll, ll>;
using vpll = vector<pll>;
using vvpll = vector<vpll>;
#define rep(i, m, n) for (int i = (int)(m); i < (int)(n); i++)
#define vrep(i, vec) for(auto& i : vec)
#define vin(vec) for(auto& i : vec) cin >> i
#define all(v) v.begin(), v.end()
ll mod = 1000000007;

int main(){
  ll n;
  cin >> n;
  vst s(n);
  vin(s);
  map<st, ll> cnt;
  vrep(i, s){
    if(cnt.count(i)) cnt[i]++;
    else cnt[i] = 1;
  }

  priority_queue<st, vst, greater<st>> ans;
  ll max = 0;
  vrep(i, cnt){
    if(max < i.second){
      max = i.second;
      while(ans.size()) ans.pop();
      ans.push(i.first);
    }
    else if(max == i.second){
      ans.push(i.first);
    }
  }
  while(ans.size()){
    st a = ans.top();
    ans.pop();
    cout << a << endl;
  }
}

Measured memory_bytes: 28528
# coding: utf-8
# Your code here!

n = open(0)
n = n.read()
l1 = "abcdefghijklmnopqrstuvwxyz"
l2 = [0]*26

for i in n:
   for j in range(len(l1)):
      if i == l1[j] or i == l1[j].upper():
         l2[j] += 1

for i in range(len(l1)):
   print(l1[i], ":", l2[i])



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


int main(){
int A[5];
int B[5];
int C[5];
for(int i=0;i<5;i++){
    cin>>A[i];
    B[i]=A[i]%10;
    if(B[i]==0){
        C[i]=A[i];
        B[i]=10;
    }
    
    else{
    C[i]=A[i]-B[i]+10;
    }
}

sort(B,B+5);
int ans =0;
for(int i=0;i<5;i++){
    ans += C[i];
}
ans -=10;
ans+=B[0];
cout<<ans;

}

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


int main()
{
	int n, taro=0, hanako=0;
	cin >> n;

	for (int i = 0;i < n;i++) {
		string a1, a2;
		cin >> a1 >> a2;

		if (a1 == a2) {
			taro++;
			hanako++;
		}
		else if (a1 > a2) {
			taro += 3;
		}
		else
		{
			hanako += 3;
		}
	}

	cout << taro << " " << hanako << endl;
    return 0;
}



Measured memory_bytes: 3176
#include <iostream>
#include <cmath>//abs()

using namespace std;

int main() {
	int n;
	cin >> n;
	int t, a;
	cin >> t>> a;
	float answer = 999999;
	int output;
	for (int i = 0; i < n; i++)
	{
		int input = 0;//入力を受け取る
		cin >> input;
		float f;
		f = t - input * 0.006;
		if (abs(f - a) < answer)
		{{
			answer = abs(f -a);
			output = i + 1;
		}
	}
	}
	cout << output;
}

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

// 総数を1000000007（素数）で割った余り
const long long mod = 1e9 + 7;

using ll = long long;
using pii  = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

ull gcd(ull a, ull b) { return b ? gcd(b, a % b) : a; }
ull lcm(ull a, ull b) { return a / gcd(a, b) * b; }

vi graphf[100005], graphb[100005];
vi label(100005, -1);
vi sz;

int main(){
    int n, m, k;
    cin >> n >> m >> k;
    rep(i, m) {
        int a, b;
        cin >> a >> b;
        a--; b--;
        graphf[a].push_back(b);
        graphf[b].push_back(a);
    }
    rep(i, k) {
        int a, b;
        cin >> a >> b;
        a--; b--;
        graphb[a].push_back(b);
        graphb[b].push_back(a);
    }
    int num = 0;
    rep(i, n) {
        if (label[i] >= 0) continue;
        label[i] = num;
        sz.push_back(1);
        int p;
        queue<int> todo;
        todo.push(i);
        while (!todo.empty()) {
            p = todo.front();
            todo.pop();
            for (int j : graphf[p]) {
                if (label[j] >= 0) continue;
                label[j] = num;
                todo.push(j);
                sz[num]++;
            }
        }
        num++;
    }
    rep(i, n) {
        int ans;
        ans = sz[label[i]] - 1 - graphf[i].size();
        for (int j : graphb[i]) {
            if (label[j] == label[i]) ans--;
        }
        printf("%d%c", ans, i==n-1?'\n':' ');
    }
    return 0;
}


Measured memory_bytes: 12664
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>

using namespace std;

#define FOR(i,a,b) for(long long int i=(a);i<(b);i++)
#define REP(i,N) for(long long int i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()

#define PI 3.14159265358479

typedef long long ll;

int n, a, b, c;
double l[10], d[10], m[10];

int main(){
while (cin >> n){
		if (!n)break;
		REP(i, n){
			scanf("%d%*c%d%d", &a, &b, &c);
			if (c < b)c += 60;
			if (a >= 11 && a <= 14){
				l[0]++;
				if (c - b <= 8){
					l[1]++;
				}
			}
			if (a >= 18 && a <= 20){
				d[0]++;
				if (c - b <= 8){
					d[1]++;
				}
			}
			if (a >= 21 || a <= 1){
				m[0]++;
				if (c - b <= 8){
					m[1]++;
				}
			}
		}
		cout << "lunch ";
		if (!l[0]){
			cout << "no guest\n";
		}
		else{
			cout << (int)(l[1] / l[0] * 100) << endl;
		}
		cout << "dinner ";
		if (!d[0]){
			cout << "no guest\n";
		}
		else{
			cout << (int)(d[1] / d[0] * 100) << endl;
		}
		cout << "midnight ";
		if (!m[0]){
			cout << "no guest\n";
		}
		else{
			cout << (int)(m[1] / m[0] * 100) << endl;
		}
		REP(i, 2){
			l[i] = 0;
			d[i] = 0;
			m[i] = 0;
		}
	}
}

Measured memory_bytes: 1244
#include <iostream>
#include <stdlib.h>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
using namespace std;
int main(int argc,char** argv){
  int a,b;
  cin >> a >> b;
  if(a > 12){ cout << b << endl;}
  else if(a > 5){ cout << b /2 << endl;}
  else {cout << 0 << endl;}

  return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <map>
#include <set>

#define MIN_INT -2147483648
#define MAX_INT 2147483647
#define MIN_LONG -9223372036854775808L
#define MAX_LONG 9223372036854775807L
#define PI 3.141592653589793238462643383279502884L

#define long long long int

using std::vector;
using std::map;
using std::set;
using std::string;
using std::pair;
using std::cin;
using std::cout;
using std::cerr;

// @author: pashka

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

    int n, k;
    cin >> n >> k;
    cout << (n - 1 + k - 2) / (k - 1);
    return 0;
}

Measured memory_bytes: 256
#include<algorithm>
#include<iostream>
#include<string>
#include<vector>

//======================

using namespace std;

//======================

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

//======================

int gcd(int a, int b) {
	if (a % b == 0) {
		return b;
	}
	else {
		return gcd(b, a % b);
	}
}

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

//======================

int main() {
	string s;
	cin >> s;
	if (s == "SSS") {
		cout << 0 << endl;
	}
	if (s == "RSS") {
		cout << 1 << endl;
	}
	if (s == "SRS") {
		cout << 1 << endl;
	}
	if (s == "SSR") {
		cout << 1 << endl;
	}
	if (s == "SRR") {
		cout << 2 << endl;
	}
	if (s == "RSR") {
		cout << 1 << endl;
	}
	if (s == "RRS") {
		cout << 2 << endl;
	}
	if (s == "RRR") {
		cout << 3 << endl;
	}
}

Measured memory_bytes: 3632