akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
// ----------------------R00TDADA------------------------------
#define rep(i, a, b) for (__typeof((b)) i = (a); i < (b); i++)
#define nrep(i, a, b) for (__typeof((b)) i = (a); i > (b); i--)
#define all(a) (a).begin(), (a).end()
#define ff first
#define ss second
#define ppi pair<int, int>
#define pppi pair<ppi, int>
#define vi vector<int>
#define vii vector<ppi>
#define viii vector<pppi>
#define vs vector<string>
#define pb push_back
#define mp make_pair
#define sz(x) (int)x.size()
#define M_PI 3.14159265358979323846
#define rootdada ios_base::sync_with_stdio(false)
#define int long long
#define M 1000000007
#define MAX 100005
int A[MAX], tree[4 * MAX];
int power(int x, int p)
{
    if (p == 0)
        return 1;
    int y = power(x, p / 2);
    y *= y;
    y %= M;
    if (p % 2 == 0)
        return y;
    y *= x;
    y %= M;
    return y;
}
void build(int node, int start, int end)
{
    if (start == end)
        //Leaf node will have a single element
        tree[node] = start;
    else
    {
        int mid = (start + end) / 2;
        //Recurse on the left child
        build(2 * node, start, mid);
        //Recurse on the right child
        build(2 * node + 1, mid + 1, end);
        // Internal node will have the sum of both of its children
        tree[node] = tree[2 * node] + tree[2 * node + 1];
    }
}
void update(int node, int start, int end, int idx, int val)
{
    if (start == end)
    {
        //Leaf Node
        A[idx] = val;
        tree[node] += val;
    }
    else
    {
        int mid = (start - end) / 2 + end;
        if (start <= idx && idx <= mid)
        {
            // If idx is in the left child, recurse on the left child
            update(2 * node, start, mid, idx, val);
        }
        else
        {
            // if idx is in the right child, recurse on the right child
            update(2 * node + 1, mid + 1, end, idx, val);
        }
        // Internal node will have the sum of both of its children
        tree[node] = tree[2 * node] + tree[2 * node + 1];
    }
}
int query(int node, int start, int end, int l, int r)
{
    if (r < start || l > end)
    {
        // range represented by a node is completely outside the given range
        return 0;
    }
    if (l <= start && end <= r)
    {
        // range represented by a node is completely inside the given range
        return tree[node];
    }
    // range represented by a node is partially inside and partially outside the given range
    int mid = (start + end) / 2;
    int p1 = query(2 * node, start, mid, l, r);
    int p2 = query(2 * node + 1, mid + 1, end, l, r);
    return p1 + p2;
}
void Baap_ko_mat_sikha()
{
    int a, b;
    cin >> a >> b;
    int l = (a * b) / __gcd(a, b);
    cout << l << endl;
}

signed main()
{

    rootdada;
    int t;
    t = 1;
    while (t--)
    {
        Baap_ko_mat_sikha();
    }
}

Measured memory_bytes: 256
#include<stdio.h>
#define MAX 101
void enqueue(int q);
int dequeue();
int size();
void bfs(int i);
 
int G[MAX][MAX];
int d[MAX];
int n;
int Que[1000];
int head=0, tail=0;
  
void enqueue(int q){
  Que[head]=q;
  head++;
}
  
int dequeue(){
  tail++;
  return Que[tail-1];
}
  
int size(){
  return head-tail;
}
  
void bfs(int i){
  int j;
  for(j=0;j<n;j++){
    if(G[i][j]==1 && d[j]==-1){
      d[j]=d[i]+1;
      enqueue(j);
    }
  }
}
  
int main(){
  int i,j,v,k,u;
  scanf("%d",&n);
  for(i=0;i<MAX;i++) d[i]=-1;
  for(i=0;i<n;i++){
    scanf("%d",&u);
    scanf("%d",&k);
    for(j=0;j<k;j++){
      scanf("%d",&v);
      G[u-1][v-1]=1;
    } 
  }
  d[0]=0;
  bfs(0);
  while(size()!=0) bfs(dequeue());
   
  for(i=0;i<n;i++) printf("%d %d\n",i+1,d[i]);
   
return 0;
}

Measured memory_bytes: 636
#include <iostream>
#include <iomanip>
#include <string>
#include <string.h>
#include <math.h>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <utility>
#include <deque>
#include <queue>

#define rep(i, n) for(int i = 0; i < n; ++i)
#define REP(i, m, n) for(int i = m; i < n; ++i)
#define rrep(i,n) for(int i = n; i >= 0; --i)
#define RREP(i, m, n) for(int i = n; i >= m; --i)

using ll = long long;
using ull = unsigned long long;
using pii = std::pair<int, int>;
using pll = std::pair<long long, long long>;

using namespace std;

const long long MOD = 1000000007;

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

	int h, a;
	cin >> h >> a;

	int ans = h / a;
	if (h%a > 0) ++ans;
	cout << ans << "\n";

	return 0;
}


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

using namespace std;

int main() {
  string s;
  cin >> s;
  
  int n = s.size();
  string pre, cur = "";
  int ans = 0;
  for (int i = 0; i < n; ++i) {
    cur += s[i];
    if (cur == pre) continue;
    pre = cur;
    cur = "";
    ans++;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 640
day = int(input())
costlist = input().split() #int型
costs = []
for cost in costlist:
    costs.append(int(cost))

satisfactions = []

for i in range(day):
    satisfactions.append(input().split())

for i in range(day):
    for j in range(26):
        satisfactions[i][j] = int(satisfactions[i][j])

type_output = []

last_date = [0 for x in range(26)]


for d in range(day):
    outtype = 1
    best_score = -99999999
    for i in range(26):
        tmp_last_date = last_date.copy()
        tmp_last_date[i] = d+1
        plus = satisfactions[d][i]
        minus = 0
        for j in range(26):
            minus += costs[j] * (d+1 - tmp_last_date[j])
        current_score = plus-minus
        if current_score >= best_score:
            best_score = current_score
            outtype = i+1
    last_date[outtype-1] = d+1
    type_output.append(outtype)


#print(type_output)

for i in range(day):
    print(type_output[i])


Measured memory_bytes: 10016
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int ans=0;
	int l,r;
	int n;
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		scanf("%d%d",&l,&r);
		ans+=r-l+1;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep( i, n ) for (ll i = 0; i < ( ll )(n); i++)

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair< int , int > P;
typedef tuple<int, int, int> T;



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

    if(x<=599){
        cout<<"8";
    }
    else if(x<=799){
        cout<<"7";
    }
    else if(x<=999){
        cout<<"6";
    }
    else if(x<=1199){
        cout<<"5";
    }
    else if(x<=1399){
        cout<<"4";
    }
    else if(x<=1599){
        cout<<"3";
    }
    else if(x<=1799){
        cout<<"2";
    }
    else if(x<=1999){
        cout<<"1";
    }
}

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

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


Measured memory_bytes: 3612
N, M = map(int, input().split())
if N > 2 and M > 2:
  print((N-2)*(M-2))
elif N == 1 and M > 2:
  print(M-2)
elif N > 2 and M == 1:
  print(N-2)
elif N == 1 and M == 1:
  print(1)
else:
  print(0)


Measured memory_bytes: 2940
n, m = map(int, input().split())
s = [0 for _ in range(n + 1)]
for i in range(n):
    s[i + 1] = int(input())
for k in range(2, m + 1):
    for i in range(1, n):
        if s[i] % k > s[i + 1] % k:
            s[i], s[i + 1] = s[i + 1], s[i]
for i in s[1:]:
    print(i)


Measured memory_bytes: 5612
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <cstdlib>
#include <numeric>
using namespace std;

int main() {
	int N, L;
	cin >> N >> L;
	
	vector<int> X(N);
	int count = 0, ans = 0;
	for (int i = 0; i < N; i++) {
		X[i] = i + L;
		if (X[i] < 0) {
			count++;
		}
	}

	if (L < 0 && N + L > 0) {
		ans = accumulate(X.begin(), X.end(), 0);
	}
	else if ( L < 0 && L + N <= 0) {
		ans = accumulate(X.begin(), X.end(), 0) - X[N - 1];
	}
	else {
		ans = accumulate(X.begin(), X.end(), 0) - X[0];
	}

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

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")

#include <bits/stdc++.h>
using namespace std;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define pop_b pop_back
#define pf push_front
#define pop_f pop_front
#define mt make_tuple
#define eb emplace_back
#define sf(x) sizeof(x)
#define len(x) x.length()
#define sz(x) x.size()
#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)

#define LB(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define UB(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
typedef long long ll;
typedef pair<ll,ll> ii;
typedef long double ld; 
typedef vector<int> vi;
typedef vector<set<ll>> vset;
typedef vector<ll> vl;
typedef vector<ld> vd;
typedef deque<ll> dql;
typedef deque<int> dqi;
typedef unsigned long long ull;
typedef tuple<int,int,int> State;

#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << endl;
	err(++it, args...);
}

#define vmax(type)   std::numeric_limits<type>::max()
#define vmin(type)   std::numeric_limits<type>::min()
#define each(a,x) for( auto &a:(x))
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define repr(i, n) for (ll i = (n) - 1; i >= 0; i--)
#define rep2(i, l, r) for (ll i = (l); i < (r); i++)
#define rep2r(i, l, r) for (ll i = (r) - 1; i >= (l); i--)
#define range(a) a.begin(), a.end()
#define deb(x) cout<<#x<<" "<<x<<endl;
#define cinai(a, n) vi a(n); rep(i, n) { cin>>a[i]; }
#define cinal(a, n) vl a(n); rep(i, n) { cin>>a[i]; }
#define coutai(a, n) rep(i, n) { cout<<a[i]<<" "; } ent;
#define coutal(a, n) rep(i, n) { cout<<a[i]<<" "; } ent;
#define ent cout<<endl;
#define resize_vec(a) a.resize(unique(a.begin(), a.end()) - a.begin());
#define ms(dp, x) memset(dp, x, sf(dp))
#define endl '\n'

ll powm(ll a, ll b, ll mod) {
	ll res=1;
	while(b) {
		if(b&1)
			res=(res*a)%mod;
		a=(a*a)%mod;
		b>>=1;
	}
	return res;
}

const ll mod = 10002667;
const ll mod1 = 10000000019;
const ll N = 1000005;
const ll inf = 1e9;

void solve()
{
	ll k;
	ll a = 7;
	cin>>k;
	rep(i, N){
		if(a % k == 0){
			cout<<i+1<<endl;
			return;
		}
		a *= 10;
		a += 7;
		a %= k;
	}
	cout<<-1<<endl;
}

// #define _DEBUG 
// #define testCases
signed main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0), cout.tie(0);
	cout << fixed << setprecision(15);
	
	int tc = 1;
#ifdef testCases
	cin>>tc;
#endif
	while(tc--)
	{
#ifdef _DEBUG
	int tt = clock();
#endif
		solve();
		
#ifdef _DEBUG
		cerr << "TIME = " << clock() - tt << endl;
		tt = clock();
#endif
	}
	return 0;
}



Measured memory_bytes: 3616
//AnkitCode99 (DP)....
//every ups and downs matter!

#include<bits/stdc++.h>
#define endl "\n"
#define fast ios_base::sync_with_stdio(0);cin.tie(nullptr);cout.tie(nullptr)
typedef long long int ll;

using namespace std;

const ll sz=1e5+5;

int main()
{
    fast;
   

   // clock_t startTime=clock();

    ll a,b,c,k;
    cin>>a>>b>>c>>k;
    if(k<=a)
        cout<<k<<endl;
    else if(k<=a+b)
        cout<<a<<endl;
    else
        cout<<a-(k-a-b)<<endl;

   // cerr << endl <<setprecision(20)<< double( clock() - startTime ) / (double)CLOCKS_PER_SEC<< " seconds." << endl;

}//Goodbye...

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

using namespace std;

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

  vector<int> cnt(100002);

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

  int ans = 0;
  for (int i = 1; i <= 100000; i++) {
    ans = max(ans, cnt[i - 1] + cnt[i] + cnt[i + 1]);
  }
  cout << ans << endl;
}


Measured memory_bytes: 640
using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using System.Linq.Expressions;

namespace Main
{
    class Program
    {
        static void Main(string[] args)
        {
            //ここから
            //int n=Readint();
            //string[] str = Console.ReadLine().Split(' ');

            long n = Readlong();
            long[] a = new long[n + 1];


            for(long i = 1; i <= n; i++)
            {
                for (long j = 1; j <= n; j++)
                {
                    if (i * j > n) break;
                    a[i * j]++;
                }
            }

            long sum = 0;
            for(long i = 1; i <= n; i++)
            {
                sum += i * a[i];
            }

            Cout(sum);

            //ここまで
        }

        static void Cout(string s)
        {
            Console.WriteLine(s);
            return;
        }

        static void Cout(int n)
        {
            Console.WriteLine(n);
            return;
        }

        static void Cout(long n)
        {
            Console.WriteLine(n);
            return;
        }

        static int Readint()
        {
            return int.Parse(Console.ReadLine());
        }

        static int[] ReadArray(int n)
        {
            string[] str = Console.ReadLine().Split(' ');
            int[] a = new int[n];
            for (int i=0; i < n; i++){ a[i] = int.Parse(str[i]); }
            return a;
        }
        static long[] ReadArray(long n)
        {
            string[] str = Console.ReadLine().Split(' ');
           long[] a = new long[n];
            for (long i = 0; i < n; i++) { a[i] = long.Parse(str[i]); }
            return a;
        }

        static long Readlong()
        {
            return long.Parse(Console.ReadLine());
        }

        static int Min(int a, int b)
        {
            if (a < b) return a;
            return b;
        }

        static int Max(int a, int b)
        {
            if (a > b) return a;
            return b;
        }


    }

}


Measured memory_bytes: 105676
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, n) for (int i=1; i < (int)(n); i++)
#define rrep(i, n) for (int i=((int)(n)-1); i>=0; i--)
#define rreps(i, n) for (int i=((int)(n)-1); i>0; i--)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
using namespace std;
using lint = long long;
using p = pair<int, int>;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
int N, D; 

double dis(int x[], int y[]) {
  double ret, sum = 0;
  rep (i, D) {
    sum += pow(x[i] - y[i], 2);
  }
  ret = sqrt(sum);
  return ret;
}

bool is_int(int x[], int y[]) {
  double d = dis(x, y);
  if ((int)d != d) 
    return false;
  else
    return true;
}
int main() {
  scanf("%d%d", &N, &D);
  int x[N][D];
  rep (i, N) rep (j, D) scanf("%d", &x[i][j]);

  int sum = 0;
  rep (i, N) {
    for (int j = i+1; j < N; j++) {
      if (is_int(x[i], x[j]))
        sum ++;
    }
  }

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


Measured memory_bytes: 256
X,N=map(int,input().split())
if N==0:
  print(X)
  exit()
P=list(map(int,input().split()))
count=0
while True:
  if X-count not in P:
    print(X-count)
    break
  if X+count not in P:
    print(X+count)
    break
  count+=1
    

Measured memory_bytes: 9108
#include<stdio.h>
int main(void){

int W,H,x,y,r;

scanf("%d %d %d %d %d",&W,&H,&x,&y,&r);

if(x+r <= W && y+r <= H && x-r >= 0 && y-r >= 0){
	printf("Yes\n");
	}
else{
	printf("No\n");
	}
return 0;
}



Measured memory_bytes: 1996
#include<bits/stdc++.h>
#define ll long long
#define pw (ll)pow 
#define MAX 1000005
using namespace std;

int main()	
{
	ll n;
	cin >> n;
	ll s=0,a[n];
	for(int i=0; i<n; i++)	{
		cin >> a[i];
		s=(s^a[i]);
	}
	for(int i=0; i<n; i++)	cout << (a[i]^s) << " ";
	cout << endl;
	return 0;
}

Measured memory_bytes: 5048
#include<stdio.h>
int main()
{
    int a[10],k,i,j,temp;
    for(k=0;k<10;k++)
    {
        scanf("%d",&a[k]);
    }
    for(i=10-2;i>=0;i--){
      for(j=0;j<=i;j++){
           if(a[j]>a[j+1]){
               temp=a[j];
              a[j]=a[j+1];
              a[j+1]=temp;
           }
      }
  }
  for(i=9;i>=7;i--)
      printf("%d\n",a[i]);
    return 0;
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
using namespace std;
#define dbg(x) #x "=" << x << " "
#define fore(i,a,b) for(int i=a,gon=b;i<gon;++i)
#define pb push_back
#define F first
#define S second
typedef double lf;
typedef long long ll;
typedef pair<int, int> pii;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    #ifdef LOCAL
        freopen("in.txt", "r", stdin);
        //freopen("out.txt", "w", stdout);
    #else
        #define endl '\n'
    #endif
    int n;
    cin >> n;
    int v[n];
    fore(i,0,n) cin >> v[i];
    int mn = 1e9;
    fore(x,-100,101) {
        int sum = 0;
        fore(i,0,n) {
            int d = v[i]-x;
            sum += d*d;
        }
        mn = min(mn, sum);
    }
    cout << mn << endl;
}


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

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

    int inn[n];
    int maxx=0;
    int ans=0;
    for(int i=0; i<n; ++i){
        cin >> inn[i];
        if(inn[i] >= maxx){
            maxx = inn[i];
            ans++;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
let printf = Printf.printf
let scanf = Scanf.scanf

let () =
  scanf "%s" (fun x ->
      let rec go acc i =
        if i = String.length x then acc else
          let ch = String.get x i in
          if ch == 'S' then
            go (ch :: acc) (i + 1)
          else
            match acc with
            | [] -> go (ch :: acc) (i + 1)
            | hd::tl ->
              if hd == 'S' then
                go tl (i + 1)
              else
                go (ch :: acc) (i + 1)
      in
      let result = go [] 0 in
      printf "%d" (List.length result))


Measured memory_bytes: 7424
#include<iostream>
#include<bits/stdc++.h>
#include<climits>

#define forn(x,n,s) for(int i = x; i < n; i += s )
#define forr(x,n,s) for(int i = x; i>=n; i -= s)

using namespace std;

void go(){
  ios_base::sync_with_stdio(0);
  cin.tie(0);

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

int main(){
    go();

    // code here
    string s;cin>>s;
    long long sum = 0;
    forn(0,s.length(),1) sum += s[i] - '0';
    if(sum%9) cout<<"No";
    else cout<<"Yes";

}






Measured memory_bytes: 3680
//Bismillahir Rahmanir Rahim
//In the name of Allah the Most Merciful
//Astagfirullahil laji Rabbi Minkulli Jamio
#include<bits/stdc++.h>
#include<math.h>
using namespace std;
#define int   long long  int
#define double  long double
#define rp(i,a,b)  for (int i = a; i <= b; i++)
#define hi ios_base :: sync_with_stdio(false); cin.tie(0);cout.tie(0);
int i,j,k;
main()
{
    hi

   int a,b;
   cin>>a>>b;
   cout<<a*b<<endl;
}


Measured memory_bytes: 3612
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <algorithm>
#include <numeric>
#include <cmath>

using namespace std;
typedef long long LL;
template <typename F, typename S> std::ostream& operator<<(ostream& os, const pair<F,S>& p) {
    os << "(" << p.first << "," << p.second << ")"; return os; }
template <typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
    os << "["; for(const T& a: v){ os << a << ", "; } os << "]"; return os; }
template <typename K, typename V> ostream& operator<<(ostream& os, const map<K,V>& m) {
    os << "{"; for(const auto& p: m){ os << p.first <<":"<< p.second << ", "; } os << "]"; return os; }


// import here

int main(){
    LL n, m;
    cin >> n >> m;
    LL ans = 0;
    if(n == 1 || m == 1){
        LL len = n*m;
        if(len == 1){
            ans = 1;
        }else{
            ans = len -2;
        }
    }else{
        ans = (n-2)*(m-2);
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <string>
#include <stack>
#include <queue>
#include <cmath>
#include <cstdio>
#include <istream>
#include <sstream>
#include <iomanip>
#include <iterator>
#include <climits>
using namespace std;

typedef ostringstream OSS;
typedef istringstream ISS;

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

typedef long long LL;

typedef pair<int, int> PII;
typedef vector<PII> VPII;

#define X first
#define Y second

vector<bool> Prime;
vector<int> PrimeStk;
void initPrime(long num) {
	Prime = vector<bool>(num + 1, true);
	Prime[1] = Prime[0] = false;
	long sq_num = sqrt((double)num);
	for (long i = 2; i < sq_num; i++) {
		if (Prime[i]) {
			for (long j = i + i; j <= num; j += i) {
				Prime[j] = false;
			}
		}
	}
}
void initPrimeStk(long begin) {
	PrimeStk.clear();
	for (long i = begin; i < (int)Prime.size(); i++) {
		if (Prime[i]) {
			PrimeStk.push_back(i);
		}
	}
}

int main(void) {
	initPrime(2000000);
	initPrimeStk(0);

	int N;
	while (cin >> N, N) {
		auto it = lower_bound(PrimeStk.begin(), PrimeStk.end(), N);

		if (*it == N) {
			cout << 0 << endl;
			continue;
		}

		cout << ((*it) - *(it - 1)) << endl;
	}

	return 0;
}

Measured memory_bytes: 2232
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
//#include<boost/multiprecision/cpp_int.hpp>
//#include<boost/multiprecision/cpp_dec_float.hpp>
//namespace mp=boost::multiprecision;
//#define mulint mp::cpp_int
//#define mulfloat mp::cpp_dec_float_100
using namespace std;
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
constexpr int MOD=1000000007;
//constexpr int MOD=998244353;
#define INF (1<<30)
#define LINF (lint)(1LL<<56)
#define endl "\n"
#define rep(i,n) for(lint (i)=0;(i)<(n);(i)++)
#define reprev(i,n) for(lint (i)=(n-1);(i)>=0;(i)--)
#define Flag(x) (1<<(x))
#define Flagcount(x) __builtin_popcount(x)
#define pint pair<int,int>
#define pdouble pair<double,double>
#define plint pair<lint,lint>
#define fi first
#define se second
typedef long long lint;
int dx[8]={1,1,0,-1,-1,-1,0,1};
int dy[8]={0,1,1,1,0,-1,-1,-1};
const int MAX_N=2e5+5;

int main(void){
    int N,K,C;
    cin >> N >> K >> C;
    string S;
    cin >> S;
    int A[N],B[N];
    int cnt=1;
    rep(i,N){
        if(S[i]!='x') A[i]=cnt,cnt++,i+=C;
        else A[i]=0;
    }
    cnt=K;
    reprev(i,N){
        if(S[i]!='x') B[i]=cnt,cnt--,i-=C;
    }
    rep(i,N) if(A[i] && B[i]) if(A[i]==B[i]) cout << i+1 << endl;
}

Measured memory_bytes: 5304
n=int(input())
a=list(map(int,input().split()))
l=[0]*(n+1)
l2=[0]*(n+1)
for i in a:
    l[i]+=1

for i in range(1,n+1):
    l2[i]=l[i]*(l[i]-1)//2
sum_l=sum(l2)
for i in range(1,n+1):
    print(sum_l-(l[a[i-1]]-1))


Measured memory_bytes: 32212
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Deque;
import java.util.List;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		List<Deque<Integer>> list = new ArrayList<>();
		int n = sc.nextInt();
		int q = sc.nextInt();
		for (int i = 0; i < n; i++) {
			list.add(new ArrayDeque<>());
		}
		for (int i = 0; i < q; i++) {
			switch (sc.nextInt()) {
			case 0:
				list.get(sc.nextInt()).addLast(sc.nextInt());
				break;
			case 1:
				int t = sc.nextInt();
				if (!list.get(t).isEmpty()) {
					System.out.println(list.get(t).peekFirst());
				}
				break;
			case 2:
				t = sc.nextInt();
				if (!list.get(t).isEmpty()) {
					list.get(t).removeFirst();
				}
				break;
			}
		}
		sc.close();
	}
}



Measured memory_bytes: 169696
#pragma target("avx")
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef unordered_map<ll, ll> U_MAP;
typedef priority_queue<ll> pq;
typedef priority_queue<ll, vector<ll>, greater<ll>> rpq;
const int INF = 1e9, MOD = 1e9 + 7, ohara = 1e6 + 10;
const ll LINF = 1e18;

#define rep(i, n) for (ll(i) = 0; (i) < (int)(n); (i)++)
#define rrep(i, a, b) for (ll i = (a); i < (b); i++)
#define rrrep(i, a, b) for (ll i = (a); i >= (b); i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout << (x) << endl
#define doublecout(a) cout << fixed << setprecision(15) << a << endl;
#define fi first
#define se second
#define m_p make_pair
#define p_b push_back

//------ Believe yourself as a genius!!!!!! ------

int dy[] = {1, 0, -1, 0};
int dx[] = {0, 1, 0, -1};
// int dy[]={-1,0,1,-1,1,-1,0,1};int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"), s;
ll n, cnt, ans, a, b, c, d, tmp, m, h, w, x, y, sum, k, q;

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

  cin >> a >> b >> c >> x >> y;
  ll ans2;
  ans2 = c * (max(x, y)) * 2;
  if ((a + b) > c * 2) {
    tmp = min(x, y);
    ans = c * tmp * 2;
    x -= tmp;
    y -= tmp;
  }
  ans += x * a;
  ans += y * b;
  Cout(min(ans, ans2));
  return 0;
}

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

int main(){
    int n; 
    cin >> n;
    bool flag = false;
    rep(i,n/7+1){
        rep(j,n/4+1){
            if(i*7 + j*4 == n){
                flag = true;
            }
        }
    }
    if(flag) cout << "Yes" << endl;
    else cout << "No" << endl;
}


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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	int N;
	cin>>N;
	cout<<(N-2)*180<<endl;
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}


Measured memory_bytes: 892
#include<bits/stdc++.h>
using namespace std;
#define con continue
#define bk break
#define LL long long
#define db double
#define pt cout<<'\n'
#define ms(a, b) memset((a), (b), sizeof(a))
#define mp make_pair
#define endl '\n'
int inf=2147483647;const long long ll =9223372036854775807,ninf=1000000000;const double eps = 1e-6; const long long nll =1000000000000000000;
#define sz size()
#define len(X) strlen(X)
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define ULL unsigned long long
#define de cout<<"test"<<endl;
#define st system("pause");
#define F first
#define S second
#define ac fstream cin("input.txt");ofstream cout("output.txt");
class ArcadeManao
{
    public:
int shortestLadder(vector <string> level, int coinRow, int coinColumn)
{

   }
};
int main()
{
  int a;
  while(cin>>a){
    LL ans=1;
    int mod=1000000007;
    string A,B;
        cin>>A>>B;
 int now=0;
 for(int i=0;i<A.sz;i++){
    if(A[i]==A[i+1]){
        if(!now){
            ans*=6;
        }
        else if(now==1){
            ans*=3;
        }
        else{
            ans*=2;
        }
        now=1;
        ans%=mod;
        i++;
    }
    else{
        if(!now){
            ans*=3;
        }
        else if(now==1){
            ans*=1;
        }
        else{
            ans*=2;
        }
        now=2;
        ans%=mod;
    }
 }
 cout<<ans<<endl;
  }
    return 0;
}


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

using namespace std;

int main()
{
	int deta;
	int deta2;
	int a, total;

	while (scanf ("%d %d", &deta, &deta2) != EOF){
		a = deta + deta2;
		total = 0;

		while (1){
			if (a < 10){
				total++;
				break;
			}
			else {
				a = a / 10;
				total++;
			}
		}
		printf("%d\n", total);
	}

	return 0;
}

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

#define get(a, i, j) *((*(a+i))+j)

typedef long long ll;

int N;
ll W, rec[101][2], mem[105][100005];

ll dp(int pos, ll cw); // cw = cumulative weight

int main()
{
    //freopen("input.txt", "r", stdin);
    memset(mem, -1, sizeof(mem));

    int i;
    scanf("%d%lld", &N, &W);

    for(i=0; i<N; ++i) scanf("%lld%lld", &get(rec, i, 0), &get(rec, i, 1));

    ll v1;
    v1 = dp(0, 0);
    //v2 = dp(0, 0);

    printf("%lld\n",v1);

    return 0;
}


ll dp(int pos, ll cw)
{
    //printf("Inside dp with pos = %d & cw = %lld\n", pos, cw);
    if(pos >= N || cw > W) {
        //printf("returning 0\n\n");
        return 0;
    }
    if(get(mem, pos, cw) > -1) {
        //printf("returning %lld from mem\n\n", get(mem, pos, cw));
        return get(mem, pos, cw);
    }

    ll w = get(rec, pos, 0);

    ll v1 = 0, v2 = 0;

    if((cw + w <= W ) ) {
        //printf("going to next pos including weight\n");
        v1 = get(rec, pos, 1);
        v1 += dp(pos+1, cw + w);
    }

    //printf("going to next pos excluding weight\n");
    v2 = dp(pos+1, cw);


    //printf("returning value either %lld or %lld\n\n", v1, v2);
    return get(mem, pos, cw) = (v1>v2)? v1:v2;
}



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

    long n,k,len;
    string s;
    cin>>k>>s;
    len=s.length();
    if(k>=len)
        cout<<s<<endl;
    else{
    for(int i=0;i<k;i++)
        cout<<s[i];
        cout<<"..."<<endl;

    }

    return 0;
}




Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll zero = 0;
const ll INF = 3000000000000000000; //3*10^18
const ll MOD = 1000000007; //10^9+7
const ll MOD2 = 998244353;
 
int main(){
    ll X,Y;
    cin >> X >> Y;
    if( (X+Y) % 3 != 0 ){
        printf("0\n");
        return 0;
    }
    ll d = (X + Y) / 3;
    ll a = (2*X - Y) / 3;
    a = min(a, d-a);
    if( a < 0 ){
        printf("0\n"); return 0;
    }
    ll ans = 1;
    vector<ll> inv(a+1);
    inv[1] = 1;
    for (ll i = 2; i < a+1; i++) {
        inv[i] = MOD - (MOD / i) * inv.at(MOD % i) % MOD;
    }
 
    for (ll i = 0; i < a; i++) {
        ans = ans * (d-i) % MOD;
        ans = ans * inv.at(i+1) % MOD;
    }
    printf("%lld\n", ans);
    return 0;
}

Measured memory_bytes: 2816
#include <stdio.h>

int main(void)
{
	int n = 0;

	scanf("%d", &n);

	if (100 <= n && n <= 999) {
		int up = 0;
		int dn = 0;
		up = n / 100;
		dn = n % 10;
		if (up == dn) {
			printf("Yes");
		} else {
			printf("No");
		}
	}

	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <map>
#include <algorithm>

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

using namespace std;

using P = pair<int, int>;

int n, k, l;
int p[200000];
int q[200000];

void init(int* p){
  rep(i, n){
    p[i] = i;
  }
}
int find(int* p, int i){
  return p[i] == i ? i : p[i] = find(p, p[i]);
}
void unite(int* p, int i, int j){
  int a = find(p, i);
  int b = find(p, j);
  p[a] = b;
}

int main(){
  cin >> n >> k >> l;
  init(p);
  rep(i, k){
    int a, b;
    cin >> a >> b;
    unite(p, a - 1, b - 1);
  }
  init(q);
  rep(i, l){
    int a, b;
    cin >> a >> b;
    unite(q, a - 1, b - 1);
  }
  map<P, int> x;
  rep(i, n){
    ++x[P(find(p, i), find(q, i))];
  }
  rep(i, n){
    cout << (i ? " " : "") << x[P(find(p, i), find(q, i))];
  }
  cout << endl;
  return 0;
}

Measured memory_bytes: 13568
let scan_words () = Scanf.scanf "%d %d\n" (fun a b -> (a, b))
module Is = Set.Make (struct type t = int let compare = compare end)
let h = Hashtbl.create 8
let n, m = scan_words ()

let rec solve now set =
  if Is.mem now set then 0
  else if Is.cardinal set = (n - 1) then 1
  else match Hashtbl.find_all h now with
    | [] -> 0
    | ls ->
      List.fold_left (fun acc pos -> acc + solve pos (Is.add now set)) 0 ls

let () =
  for i = 1 to m do
    let a, b = scan_words () in
    Hashtbl.add h a b ; Hashtbl.add h b a
  done ;
  Printf.printf "%d\n" (solve 1 Is.empty)

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

long long int modPow(long long int a, long long int n){//繰り返し自乗法(a^n mod p)。計算量 O(logN)
    long long int p = pow(10, 9) + 7;//任意のp(素数) modのやつで使える 
    if(n == 0){
        return 1;
    }
    if(n == 1){
        return a % p;
    }
    if (n % 2 == 1){ 
        return (a * modPow(a, n - 1)) % p;
    }      
    long long t = modPow(a, n / 2);
    return (t * t) % p;
}

int main(){
    int d, t, s;
    cin >> d >> t >> s;
    if(d <= s*t){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl; 
    }

}

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

bool isprime(int N){
    if(N == 2) return true;
    if(N % 2 == 0) return false;
    if(N == 1) return false;
    if(N == 3) return true;
    for(int i = 3; i <= sqrt(N); i+=2){
        if(N % i == 0) return false;
    }
    return true;
}

int main(int argc, char* argv[]){
    int Q;
    int l[1000001], r[100001];
    vector<int> prime;
    vector<int> v;
    cin >> Q;
    rep(i, Q){
        cin >> l[i] >> r[i];
    }
    for(int i = 2; i < 100000; i++){
        if(isprime(i)) prime.push_back(i);
    }
    for(auto n:prime){
        for(auto m:prime){
            if((n+1)/2 == m) v.push_back(n);
        }
    }
    rep(i, Q){
        int ans = 0;
        for(int n:v){
            if(l[i] <= n && n <= r[i]) ans++;
            if(r[i] < n) break;
        }
        cout << ans << endl;
    }
}


Measured memory_bytes: 3456
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
const ll mo = 1000000007;
const ll INF = 1LL << 59; //MAX 9223372036854775807
ll dp[51][51][2510]={};

int main()
{
ll n , k;
cin >> n >> k ;
if(k%2==1){
  cout << 0 << endl;
  return 0;
}
k/=2;
dp[0][0][0]=1;
rep(i,n)rep(j,n)rep(l,k+1){
  if(l-j<0)continue;
  dp[i+1][j][l]+=dp[i][j][l-j]*(1+2*j)+dp[i][j+1][l-j]*(j+1)*(j+1);
  if(j>0)dp[i+1][j][l]+=dp[i][j-1][l-j];
  dp[i+1][j][l]%=mo;
}

cout << dp[n][0][k] << endl;
return 0;
}


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

#define fi first
#define se second
#define show(x) cerr << #x << "=" << "\n"
typedef long long ll;
typedef unsigned long long ull;

using namespace std;
const ll llinf = LLONG_MAX;
const ull ullinf = ULLONG_MAX;

int n, m;
ll x[1001], y[1001], z[1001];
ll sum[1001];

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.precision(10);
  cout << fixed;
#ifdef LOCAL_DEFINE
  FILE *stream1;
  //FILE *stream2;
  stream1 = freopen("in.txt", "r", stdin);
  //stream2 = freopen("out.txt", "w", stdout);
  if (stream1 == NULL) return 0;
  //if (stream2 == NULL) return 0;:w
#endif
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    cin >> x[i] >> y[i] >> z[i];
  }
  for (int i = 0; i < n; i++) {
    sum[i] = x[i] + y[i] + z[i];
  }
  sort(sum, sum + n);
  ll ans = LLONG_MIN;
  ll now = 0;
  for (int i = 0; i < m; i++) {
    now += sum[n - 1 - i];
  }
  ans = max(ans, now);
  for (int i = 0; i < n; i++) {
    sum[i] = x[i] + y[i] - z[i];
  }
  sort(sum, sum + n);
  now = 0;
  for (int i = 0; i < m; i++) {
    now += sum[n - 1 - i];
  }
  ans = max(ans, now);
  for (int i = 0; i < n; i++) {
    sum[i] = x[i] - y[i] + z[i];
  }
  sort(sum, sum + n);
  now = 0;
  for (int i = 0; i < m; i++) {
    now += sum[n - 1 - i];
  }
  ans = max(ans, now);
  for (int i = 0; i < n; i++) {
    sum[i] = x[i] - y[i] - z[i];
  }
  sort(sum, sum + n);
  now = 0;
  for (int i = 0; i < m; i++) {
    now += sum[n - 1 - i];
  }
  ans = max(ans, now);
  for (int i = 0; i < n; i++) {
    sum[i] = -x[i] + y[i] + z[i];
  }
  sort(sum, sum + n);
  now = 0;
  for (int i = 0; i < m; i++) {
    now += sum[n - 1 - i];
  }
  ans = max(ans, now);
  for (int i = 0; i < n; i++) {
    sum[i] = -x[i] + y[i] - z[i];
  }
  sort(sum, sum + n);
  now = 0;
  for (int i = 0; i < m; i++) {
    now += sum[n - 1 - i];
  }
  ans = max(ans, now);
  for (int i = 0; i < n; i++) {
    sum[i] = -x[i] - y[i] + z[i];
  }
  sort(sum, sum + n);
  now = 0;
  for (int i = 0; i < m; i++) {
    now += sum[n - 1 - i];
  }
  ans = max(ans, now);
  for (int i = 0; i < n; i++) {
    sum[i] = -x[i] - y[i] - z[i];
  }
  sort(sum, sum + n);
  now = 0;
  for (int i = 0; i < m; i++) {
    now += sum[n - 1 - i];
  }
  ans = max(ans, now);
  cout << ans << endl;
#ifdef LOCAL_DEFINE
  cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << "s.\n";
  fclose(stream1);
  //fclose(stream2);
#endif
  return 0;
}


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

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

template<class T> inline T sqr(T x) {return x*x;}

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef unsigned long long ULL;

#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

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

const double EPS = 1e-10;
const double PI  = acos(-1.0);

#define CLR(a) memset((a), 0 ,sizeof(a))

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

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

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

  REP(i, n) {
    string s;
    cin >> s;
    int h = (s[0]-'0') * 10 + (s[1]-'0');
    int m = (s[3]-'0') * 10 + (s[4]-'0');

    double angleh = h*30 + (double)m/60 * 30;
    double anglem = m * 6; 

    int ans;
    if(angleh > anglem) ans = angleh - anglem;
    else ans = anglem - angleh;

    if(ans > 180) {
      if(angleh > anglem) ans = 360-angleh + anglem;
      else ans = 360-anglem + angleh;
    }

    if(0 <= ans && ans < 30) cout << "alert" << endl;
    else if(90 <= ans && ans <= 180) cout << "safe" << endl;
    else cout << "warning" << endl;
  }  
}

Measured memory_bytes: 1200
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
  long N = sc.nextLong();
  long a = sc.nextLong();
  long b = sc.nextLong();
  for (int i = 1; i < N; i++) {
    long c = sc.nextLong();
    long d = sc.nextLong();
    long p = Math.max(a / c, b / d);
    while (c * p < a || d * p < b)
      p++;
    a = c * p;
    b = d * p;
  }
  System.out.println(a+b);
}}

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


int main() {
    int n;
    cin >> n;
    vector<int> vec(n);
    for (int i = 0; i < n; i++) {
        cin >> vec.at(i);
    }

    int count = 0;
    for (int i = 1; i < n - 1; i++) {
        if ((vec.at(i-1) > vec.at(i) && vec.at(i) > vec.at(i+1)) || (vec.at(i-1) < vec.at(i) && vec.at(i) < vec.at(i+1))) count++;
    }
    cout << count << endl;
    return 0;
}


Measured memory_bytes: 256
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <functional>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>

using namespace std;

inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v;}
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str();}

typedef vector<int> vi;
typedef vector<vi>  vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;

#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EACH(t,i,c) for(t::iretator i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n) FOR(i,0,n-1)

const double EPS = 1e-10;

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

	REP(hoge, n) {
		int hit = 0, score = 0, out = 0;
		string command;
		
		while(out < 3) {
			cin >> command;

			if(command == "OUT") {
				out++;
			} else if(command == "HIT") {
				if(hit == 3) {
					score++;
				} else {
					hit++;
				}
			} else if(command == "HOMERUN") {
				score += (hit+1);
				hit = 0;
			}
		}

		cout << score << endl;
	}

	return 0;
}

Measured memory_bytes: 1212
#include <bits/stdc++.h>
#define ll long long
#define mk make_pair
using namespace std;
const int N = 2e5 + 5;
const int mod = 1e9 + 7;
int X, n, m, q, cnt;
int r[N], t[N], a[N], fa[N], ans[N];
struct op {
	int type, t, id;
	op() {}
	bool operator < (const op &a) const {
		return t < a.t;
	}
} Q[N];
vector< pair<int, int> > V;
set< pair<int, int> > S;
set< pair<int, int> > :: iterator it;
int find(int x) {
	if (x == fa[x]) return x;
	return fa[x] = find(fa[x]);
}
void work() {
	int pret = 0, T;
	int p = 1;
	ll delta = 0;
	pair<int, int> tmp;
	for (int i = 1; i <= cnt; i++) {
		V.clear();
		T = Q[i].t - pret;
		if (p) {
			while (S.size()) {
				it = S.begin();
				tmp = *it;
				if (tmp.first - delta > T) 
					break;
				V.push_back(tmp);
				S.erase(it);
			}
			delta += T;
			if (V.size()) {
				for (int j = 1; j < V.size(); j++) 
					fa[find(V[0].second)] = find(V[j].second);
				S.insert(mk(delta, find(V[0].second)));
				a[find(V[0].second)] = delta;
			}
		} else {
			while (S.size()) {
				it = S.end();
				--it;
				tmp = *it;
				if (X - (tmp.first - delta) > T) 
					break;
				V.push_back(tmp);
				S.erase(it);
			}
			delta -= T;
			if (V.size()) {
				for (int j = 1; j < V.size(); j++) 
					fa[find(V[0].second)] = find(V[j].second);
				S.insert(mk(X + delta, find(V[0].second)));
				a[find(V[0].second)] = X + delta;
			}
		}
		pret = Q[i].t;
		if (Q[i].type == 2) 
			ans[Q[i].id] = a[find(Q[i].id)] - delta;	
		else 
			p ^= 1;
		//cout << Q[i].t << ":\n";
		//cout << delta << endl;
		//for (it = S.begin(); it != S.end(); ++it)
		//	cout << (*it).first << "," << (*it).second << "/"; cout << endl;
	}
}
int main() {
	scanf("%d %d", &X, &n);
	for (int i = 1; i <= n; i++) {
		scanf("%d", r + i);
		Q[++cnt].t = r[i];
		Q[cnt].type = 1;
	}
	scanf("%d", &q);
	for (int i = 1; i <= q; i++) {
		scanf("%d %d", t + i, a + i);
		fa[i] = i;
		Q[++cnt].t = t[i];
		Q[cnt].type = 2;
		Q[cnt].id = i;
		S.insert(mk(a[i], i));
	}
	sort(Q + 1, Q + 1 + cnt);
	work();
	for (int i = 1; i <= q; i++)
		printf("%d\n", ans[i]);
}


Measured memory_bytes: 13556
/////////////////////////////////////////////////////////
//
//  c/temp.cpp file
//  Last Updated: 2018-10-23 ...Maybe
//
//    I hope you adding this code to the setting file
//    alias g++='g++ -std=c++1y -DDEBUG_LOCAL'
//
/////////////////////////////////////////////////////////

#include <bits/stdc++.h>

using namespace std;

#define fi first
#define se second
#define mp make_pair
#define pb push_back

//#define int long long

#define _overload3(_1,_2,_3,name,...) name
#define _REP(i,n) REAP(i,0,n)
#define REAP(i,a,b) for(int i=int(a);i<int(b);++i)
#define REP(...) _overload3(__VA_ARGS__,REAP,_REP,)(__VA_ARGS__)

#define _REPR(i,n) REAPR(i,n,0)
#define REAPR(i,a,b) for(int i=int(a-1);i>=int(b);--i)
#define REPR(...) _overload3(__VA_ARGS__,REAPR,_REPR,)(__VA_ARGS__)

#define ALL(a) a.begin(),a.end()
#define rALL(a) a.rbegin(),a.rend()

#define coutALL(a) {int loop_coutALL=0;for(auto e:a) cout<<(loop_coutALL++?" ":"")<<e; cout<<endl;}

#define coutYN(a) cout<<((a)?"YES":"NO")<<endl;
#define coutYn(a) cout<<((a)?"Yes":"No")<<endl;
#define coutyn(a) cout<<((a)?"yes":"no")<<endl;

#define pcnt __builtin_popcount
#define buli(x) __builtin_popcountll(x)

const int INF=1145141919;
//const long long INF=114514191911451419;
const int MOD=(int)1e9+7;
const double EPS=1e-12;
const int dx[]={1,0,-1,0},dy[]={0,1,0,-1};
//const int dx[]={-1,-1,-1,0,1,1,1,0},dy[]={-1,0,1,1,1,0,-1,-1};

using vi=vector<int>;
using vvi=vector<vi>;
using vs=vector<string>;

typedef pair<int,int> pii;
typedef pair<int,string> pis;
typedef pair<string,int> psi;
typedef pair<string,string> pss;

typedef long long ll;

template<typename T> istream &operator >> (istream &is, vector<T> &v){for(T &x:v) is>>x;return is;}
template<typename T> ostream &operator << (ostream &os, vector<T> &v){int i=0;for(T &x:v) os<<(i++?" ":"")<<x;return os;}

ll rev(ll n){ll x=0;for(;n>0;){x=x*10+n%10;n/=10;}return x;}

ll upper(ll n,ll m){return (n+m-1)/m;};
ll rounding(ll n){return (long double)n+0.5;};

bool inG(ll x,ll n){return 0<=x && x<n;}
bool outG(ll x,ll n){return x<0 || n<=x;}

inline int qp(int a,ll b){if(!b)return 1;int ans=1;do{if(b&1)ans=1ll*ans*a;a=1ll*a*a;}while(b>>=1);return ans;}
inline int qp(int a,ll b,int mo){if(!b)return 1;int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}

inline ll fac(ll k,ll n){ll a=1;for(int i=0;i<n;i++)a*=k--;return a;}
inline ll fac(ll k,ll n,int mo){ll a=1;for(int i=0;i<n;i++)a*=k--,a%=mo;return a;}

inline int dsum(ll n){int a=0;for(;n;n/=10)a+=n%10;return a;}

struct Arithmetic{Arithmetic(){cin.tie(0);ios::sync_with_stdio(0);cout<<fixed<<setprecision(20);}};

//#define DEBUG_LOCAL

#ifdef DEBUG_LOCAL
template<typename T> void deb(T a){cerr<<"deb: "<<a<<"です"<<endl;}
#define debl {cerr<<"debug: "<<__LINE__<<"行目だ"<<endl;}
void what_cr(){cout<<__GCC_ATOMIC_CHAR16_T_LOCK_FREE<<" ←？"<<endl;}
//ori_func S

//ori_func E
#else
template<typename T>void deb(T a){}
#define debl
void what_cr(){}void t_t(){}
#endif

signed main(){

  Arithmetic Exception;

  int n,x;
  cin>>n>>x;

  REP(i,x-n+1,x+n) cout<<i<<" ";

  return 0;

}


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

#define MAX 3
int main(void)
{
	int i,j;
	int in[MAX];
	int tmp;

	for (i=0; i<MAX; i++) {
		cin >> in[i];
	}

	for (i=0; i<MAX; i++) {
		for (j=(i+1); j<MAX; j++) {
			if (in[i] > in[j]) {
				tmp		= in[i];
				in[i]	= in[j];
				in[j]	= tmp;
			}
		}
	}

	for (i=0; i<MAX; i++) {
		if (i == (MAX-1)) {
			cout << in[i];
		}
		else {
			cout << in[i] << " ";
		}
	}
	cout << endl;

	return 0;
}



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

int H, W;
char field[53][53];

void serch(int x, int y) {
  int cnt = 0;

  if (field[x][y] == '.'){
    for(int dx = -1; dx <= 1; dx++){
      for(int dy = -1; dy <= 1; dy++){
        int nx = x + dx;
        int ny = y + dy;
         if(0 <= nx && nx < H && 0 <= ny && ny < W && field[nx][ny] == '#'){
           cnt++;
       }
      }
    }
  }

  if (cnt > 0){
    field[x][y] = '0' + cnt;
  }else{
    field[x][y] = '0';
  }

}

int main(){
  cin >> H >> W;
  for(int i = 0; i < H; i++){
    string str;
    cin >> str;
    for(int j = 0; j < W; j++){
      field[i][j] = str[j];
    }
  }

  for(int i = 0; i < H; i++){
    for(int j = 0; j < W; j++){
      if(field[i][j] == '.'){
        serch(i, j);
      }
    }
  }

  for(int i = 0; i < H; i++){
    for(int j = 0; j < W; j++){
      cout << field[i][j];
    }
    cout << endl;
  }

  return 0;

}


Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<utility>
#include<string>
#include<stack>
#include<queue>
#include<set>
#include<math.h>
#include <map>
using namespace std;
typedef long long int ll;
#define repi(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,a) repi(i,0,a)
#define all(u) u.begin(),u.end()
#define pl pair<ll,ll>
#define fi first
#define se second
#define inf 1000000007

ll N;
vector<pl>r;
vector<pl>b;
ll cnt[110];

int main() {
    cin >> N;
    rep(i,N) {
        ll x,y;
        cin >> x >> y;
        r.push_back(make_pair(x,y));
    }
    rep(i,N) {
        ll x,y;
        cin >> x >> y;
        b.push_back(make_pair(x,y));
    }
    sort(all(b));
    ll ans = 0;
    rep(i,N){
        ll m = -1;
        ll idx = -1;
        rep(j,N){
            if ((r[j].fi < b[i].fi && r[j].se < b[i].se) && cnt[j] == 0){
                if (r[j].se > m){
                    m = r[j].se;
                    idx = j;
                }
            }
        }
        if (m != -1){
            ans ++;
            cnt[idx] = 1;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256