akhauriyash/Code-Regression huggingface dataset:
import java.util.*;

import static java.lang.System.*;

class Main {
    public static Scanner sc = new Scanner(in);
    public static Random rand=new Random();

    public void run() {
        while(true){
            int N=sc.nextInt(),M=sc.nextInt();
            if(N==0)break;
            int r=sc.nextInt();

            short[][] imos=new short[M][1400];
            for(int i=0;i<r;i++){
                int t=sc.nextInt(),n=sc.nextInt(),m=sc.nextInt()-1,s=sc.nextInt();

                if(s==1){
                    imos[m][t]++;
                }else{
                    imos[m][t]--;
                }
            }

            int q=sc.nextInt();
            for(int i=0;i<q;i++){
                int ts=sc.nextInt(),te=sc.nextInt(),m=sc.nextInt()-1;
                int time=0,l=0;

                for(int t=0;t<ts;t++){
                    l+=imos[m][t];
                }
                for(int t=ts;t<te;t++){
                    l+=imos[m][t];
                    if(l>0)time++;
                }
                ln(time);
            }
        }
    }
    public static void main(String[] args) {
        new Main().run();
    }

    public int[] nextIntArray(int n){
        int[] res=new int[n];
        for(int i=0;i<n;i++){
            res[i]=sc.nextInt();
        }
        return res;
    }
    public static void pr(Object o) {
        out.print(o);
    }
    public static void ln(Object o) {
        out.println(o);
    }
    public static void ln() {
        out.println();
    }
}

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

int main()
{
    string S;
    long long int N;
    
    cin >> S;
    N = S.size();
    
    vector<long long int> left(N+1);
    vector<long long int> right(N+1);
    
    left[0] = 0;
    right[N] = 0;
    long long int left_count = 0;
    long long int right_count = 0;
    
    for(long long int i=0; i<N; i++){
        if(S[i] == '<') left_count++;
        else left_count = 0;
        left[i+1] = left_count;
    }
    
    for(long long int i=N-1; i>=0; i--){
        if(S[i] == '>') right_count++;
        else right_count = 0;
        right[i] = right_count;
    }
    
    long long int ans = 0;
    for(long long int i=0; i<=N; i++){
        long long int temp;
        temp = max(left[i], right[i]);
        ans += temp;
//        cout << "left:" << left[i] << endl;
//        cout << "right:" << right[i] << endl;
//        cout << "temp:" << temp << endl;
    }
    
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 8708
#include <iostream>
using namespace std;
int main(void){
    int a, b, c;
    cin >> a;
    cin >> b;
    cin >> c;
    
    if (c >= a && c <= b) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
    
    return 0;
}


Measured memory_bytes: 764
#include <bits/stdc++.h>
using namespace std;
const int N=1e5+10;
int  a[N];
int main()
{
	cin.tie(0);cout.tie(0);ios::sync_with_stdio(0);
	int h,n;
	cin>>h>>n;
	int damage=0;
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
		damage+=a[i];
	}
	if(damage>=h)cout<<"Yes";
	else cout<<"No";
	return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <math.h>
#include <iomanip>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define int long long
#define pie 3.141592653589793238462643383279
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x / gcd(x, y)*y;
}

int n, a[100000], ta[100010], mu = 0;

signed main() {
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		ta[a[i] - 1]++;
		ta[a[i]]++;
		ta[a[i] + 1]++;
	}
	sort(ta, ta + 100011);
	cout << ta[100010] << endl;
	getchar(); getchar();
	return 0;
}

Measured memory_bytes: 1792
#include<iostream>
#include<iomanip>
#include<stdio.h>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<set>
#include<map>
#include<string>
#include<algorithm>
#include<functional>
#include<math.h>
#include<unordered_set>
#include <regex>
using namespace std;

const int MAX = 100000;
const int INF = 1000000;

int main() {
	int N;
	int num[] = { 6,9 };
	int dp[MAX];

	cin >> N;

	for (int i = 0; i <= N; i++)dp[i] = INF;
	dp[0] = 0;

	for (int i = 0; i < N; i++) {
		dp[i + 1] = min(dp[i + 1], dp[i] + 1);

		for (int j = 0; j < 2; j++) {
			int n = num[j];

			while (i + n <= N) {
				dp[i + n] = min(dp[i + n], dp[i] + 1);
				n *= num[j];
			}
		}
	}

	cout << dp[N] << endl;

	return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
char a[1000];
int b[1000],l;
int main(){
	gets(a);
	for(int i=0;i<strlen(a);i++){
		if(a[i]=='0'){
			b[l]=0;
			l+=1;
		}
		if(a[i]=='1'){
			b[l]=1;
			l+=1;
		}
		if(a[i]=='B'){
			if(l>0) 
			l-=1;
		}
	}
	for(int i=0;i<l;i++)
		cout<<b[i];
	return 0;
} 

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

#define    ll     long long int

int main( )
{
    int n, i, j, k, mx = -1;
    map<int, int> mp;
    vector<int> v;
    cin >> n;
    for (i = 1; i <= n; i++) {
        cin >> j;
        mp[j]++;
        if (mp[j] == 2) {
            v.push_back(j);
            mp[j] = 0;
        }
    }
    sort(v.begin(), v.end());
    k = (int) v.size();
    if (k < 2) {
        cout << "0\n";
    }
    else {
        cout << ( (ll) v[k - 1] * v[k - 2]) << '\n';
    }
    return 0;
}

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

using namespace std;

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

long gcd_mul(long * a, int N){
    long g = a[0];
    for (int i=0; i<N; i++){
        g = gcd(g, a[i]);
    }
    return g;
}

int main(){
    int N, X;
    cin >> N >> X;
    long a[N];
    for(int i=0; i<N; i++){
        int temp;
        cin >> temp;
        a[i] = abs(temp - X);
    }
    long ans = gcd_mul(a, N);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1024
import sys
sys.setrecursionlimit(10**7)
def input(): return sys.stdin.readline().rstrip()


def main():
    _ = int(input())
    nums = tuple(map(int, input().split()))
    mod = 10 ** 9 + 7

    num_sum = sum(nums)
    part_sum = sum(map(lambda x: x**2, nums)) # naname

    print((num_sum**2 - part_sum) // 2 % mod)


if __name__ == '__main__':
    main()

Measured memory_bytes: 104944
#include <bits/stdc++.h>
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
const int MOD = 1000000007;
const int INF = numeric_limits<int>::max() / 2;
typedef pair<int,int> P;

int N, A, B, C;
int H[10];

int dfs(int W, int a, int b, int c){
  if(W == N){
    if(min({a,b,c}) == 0) return INF;
    return abs(A-a) + abs(B-b) + abs(C-c);
  }
  int X = dfs(W+1, a+H[W], b, c) + 10;
  int Y = dfs(W+1, a, b+H[W], c) + 10;
  int Z = dfs(W+1, a, b, c+H[W]) + 10;
  int G = dfs(W+1, a, b, c);
  return min({X, Y, Z, G});
}

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

  cin >> N >> A >> B >> C;
  rep(i,N) cin >> H[i];
  cout << dfs(0, 0, 0, 0) - 30 << endl;
}


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

int main(void){
    int N;
    cin >> N;
    if (N % 10 == 2 || N % 10 == 4 || N % 10 == 5 || N % 10 == 7 || N % 10 == 9){
        cout << "hon" << endl;
    }
    else if (N % 10 == 0 ||N % 10 == 1 || N % 10 == 6 ||N % 10 == 8){
        cout << "pon" << endl;
    }
    else if (N % 10 == 3){
        cout << "bon" << endl;
    }
}

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

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

const int MOD=1e9+7;
const int INF=1<<29;

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

//-------------------< start here >-------------------------//
void find(int n,int l){
  	int mn=1e10;
  	int sum=0;
  	for(int i=0;i<n;i++){
	  sum+=l+i;
	  if(abs(mn)>abs(l+i))mn=l+i;	
	}
	int ret=sum-mn;
	cout<<ret<<endl;
}
void solve(){
    int n,l;
    cin>>n>>l;
    find(n,l); 
}
//-----------------------------
//comment from here for TOPCODER 
int32_t main(){
   IOS;
   solve();
   #ifdef LOCAL_DEFINE
   cerr<<"time elapsed "<<(double)clock()/CLOCKS_PER_SEC<<endl;
   #endif
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define all(c) (c).begin(),(c).end()
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define iter(c) __typeof((c).begin())
#define tr(it,c) for(iter(c) it=(c).begin(); it!=(c).end(); it++)
#define pb(a) push_back(a)
#define mp(a,b) make_pair(a,b)
#define pr(a) cout << (a) << endl
typedef long long ll;
typedef pair<int,int> P;
const int MAX=1000000000;
int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

int a[2001]={},b[4001]={};
int main() {
  rep(i,1001) {
    rep(j,1001) a[i+j]++;
  }
  rep(i,2001) {
    rep(j,2001) b[i+j]+=a[i]*a[j];
  }
  int n;
  while(cin >> n) pr(b[n]);
  return 0;
}


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

int main(){
    vector<bool> exist(26,false);
    string s; cin >> s;
    for(int i = 0; i < s.size(); i++){
        exist[s[i]-'a'] = true;
    }
    for(int i = 0; i < 26; i++){
        if(exist[i] == false){
            cout << (char)(i + 'a') << endl;//cast
            return 0;
        }
    }
    cout << "None" << endl;
    return 0;
}

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

int main(){
  int a,b,c,d,n,x,y;
  cin>>n>>a>>b>>c>>d;
  for(int i=0;i<n;){
    i+=a;
    if(i>=n){x=b*i/a;}
  }

  for(int i=0;i<n;){
    i+=c;
    if(i>=n){y=d*i/c;}
  }

  if(x>y){cout<<y<<endl;}
  else{cout<<x<<endl;}
  
  return 0;
}



Measured memory_bytes: 3096
def polish(s):
    stack = []
    for x in s:
        if x == "+":
            tmp = stack[-2] + stack[-1]
            stack.pop()
            stack.pop()
            stack.append(tmp)
        elif x == "-":
            tmp = stack[-2] - stack[-1]
            stack.pop()
            stack.pop()
            stack.append(tmp)
        elif x == "*":
            tmp = stack[-2] * stack[-1]
            stack.pop()
            stack.pop()
            stack.append(tmp)
        else:
            stack.append(int(x))
    return stack[0]


s = input().split()

print(polish(s))


Measured memory_bytes: 5600
S = input()
N = len(S)

X = set()
ans = 'None'

for i in range(N):
    X.add(S[i])

for alph in ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j',\
    'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v',\
         'w', 'x', 'y', 'z']:
         if alph not in X:
             ans = alph
             break

print(ans)

Measured memory_bytes: 9120
#include<bits/stdc++.h>
#define M 1000000007
#define pi ld(acos(-1.0))
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define Rep(i,n) for(int i=1;i<(int)(n);i++)
#define repp(i,a,b)  for(int i=a;i<=(int)(b);i++)
#define Repp(i,a,b)  for(int i=a;i>=(int)(b);i--)
#define cs ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define fi first
#define se second
#define ii pair<int,int>
#define bye(x) {cout<<x;return 0;}
typedef long long ll;
typedef long double ld;
using namespace std;
int f(int x) {
    int j=1,t=0;
    while(x>=j) {
        x-=j;j++;t++;
    }
    return t;
}
int main() {
    cs
    ll n,ans=0;cin>>n;
    for(ll i=2;i*i<=n;i++) {
        if(n%i==0) {
            int t=0;
            while(n%i==0) {t++;n/=i;}
            ans+=f(t);
        }
    }
    if(n>1) ans++;
    cout<<ans;
}

Measured memory_bytes: 3652
#include<iostream>
#include<algorithm>
#include<queue>
#include<cstring>
#include<cstdio>
#include<cmath>
#include<set>
#include<map>

using namespace std;
const int maxn = 2e5 + 7;
const int inf = 0x3f3f3f3f;
const int mod = 1e9 + 7;
typedef long long ll;

int n, m;
int a[110];
int main(){
	int cnt = 0, sum = 0;
	cin >> n >> m;
	for(int i = 1; i <= n; i++){
		cin >> a[i];
		cnt += a[i];
	}
	for(int i = 1; i <= n; i++){
		if(4 * m * a[i] >= cnt) sum++;
	}
	if(sum >= m) puts("Yes");
	else puts("No");
}



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

#define rep(i,N) for(int i=0;i<int(N);++i)
#define rep1(i,N) for(int i=1;i<int(N);++i)

int main() {
	int A,B;
	cin>>A>>B;
	string ans="Yay!";
	if(max(A,B)>8)ans=":(";
	cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(s,i, n) for (int i = (int)s; i < (int)(n); i++)
#define pb push_back
typedef long long ll;
ll gcd(ll a, ll b)
{
   if (a%b == 0)
   {
       return(b);
   }
   else
   {
       return(gcd(b, a%b));
   }
}

ll lcm(ll a, ll b)
{
   return a * b / gcd(a, b);
}
  
int main(){
    ll a,b,c,d;
    cin>>a>>b>>c>>d;
    ll ba=b-(a-1);
    ll x=ba-(b/c-(a-1)/c)-(b/d-(a-1)/d)+(b/lcm(c,d)-(a-1)/lcm(c,d));
    cout<<x<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define eb emplace_back
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
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;}


int const INF = 1001001001;


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

string s;
cin >> s;
int n = s.size();

vector<char> a = {};

rep(i,n){
     if(s[i] == '0') a.push_back('0');
     if(s[i] == '1') a.push_back('1');
     if(s[i] == 'B' && a.size() != 0) a.pop_back();

}
rep(i,a.size()) cout << a[i] ;

return 0;
}

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

using namespace std;

#define    fastio        ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define    f             first
#define    s             second
#define    ub            upper_bound
#define    lb            lower_bound
#define    pb            push_back
#define    mset(x,val)   memset(x,val,sizeof(x))
#define    all(x)        (x).begin(),(x).end()
#define    foo(i,a,b)    for(long long i=(a);i<=(b);i++)
#define    rep(i,a,b)    for(long long i=(a);i>=(b);i--)
#define    FOR(i,v)      for(auto &(i):(v))

using  ll    =   long long;
using  ld    =   long double;
using  vl    =   vector<ll>;
using  pll   =   pair<ll, ll>;
using  vll   =   vector<pll>;
using  MAP   =   map<ll, ll>;
using  sl    =   set<ll>;
using  sll   =   set<pll>;
using  MAPs  =   map<ll, sl>;
using  MAPv  =   map<ll, vl>;


const ll inf = LLONG_MAX;
const ll mod = 1e9 + 7;
const ll N   = 2e5 + 5;//change it if u have to

int dx8[] = {0, 1, 1, 1, 0, -1, -1, -1}, dy8[] = {1, 1, 0, -1, -1, -1, 0, 1};
int dx4[] = {0, 1, 0, -1}, dy4[] = {1, 0, -1, 0};

/*********************************************************************************************************/
/***************************************** VARIABLE DECLARATIONS *****************************************/
ll n; string s;

/***************************************** FUNCTION IMPLEMENTATIONS **************************************/


/***************************************** START OF MAIN FUNCTION ****************************************/
void MAIN() {
    cin >> n >> s;

    ll ct = count(all(s), 'R'), cnt = 0;

    foo(i, 0, ct - 1) {
        if (s[i] == 'W') cnt++;
    }

    cout << cnt << "\n";
}

int main() {
    fastio;
    int t = 1;

    // cin>>t;
    while (t -- > 0) {
        MAIN();
    }

#ifndef ONLINE_JUDGE
    cout << "\nTime Elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " sec\n";
#endif

}


Measured memory_bytes: 3772
#include <algorithm>
#include <iostream>
#include <map>
#include <tuple>
#include <vector>

#define rep(i, n) for (int i = 0; (i) < (n); (i)++)
using namespace std;
using ll = long long;
int testimony[15][15];

int main(void) {
    rep(i, 15)
        rep(j, 15)
            testimony[i][j] = -1;

    int N; cin >> N;

    rep(i, N) {
        int A; cin >> A;
        rep(j, A) {
            int x, y;
            cin >> x >> y;
            testimony[i][x-1] = y;
        }
    }

    int ret = 0;
    for(int bit=0; bit < (1 << N); ++bit) {
        // bit=1: Honest
        // bit=0: Unkind
        int num = 0;
        bool ok = true;
        rep(i, N) {
            if (((1 << i) & bit) == 0) {
                // we do not respect unkind person
                continue;
            }

            // check if he says truth
            rep(j, N) {
                if(testimony[i][j] == -1) {
                    continue;
                }
                auto b = ((1 << j) & bit) != 0;
                if(testimony[i][j] != b) {
                    ok = false;
                    break;
                }
            }
            if(!ok) {
                break;
            }
        }
        if(ok) {
//            cout << "ok:" << bit << endl;
            ret = max(ret, __builtin_popcount(bit));
        }
//        cout << "bit=" << bit << ", num=" << num << endl;
    }
    cout << ret << endl;

#if 0
    rep(i, N) {
        rep(j, N) {
            cout << testimony[i][j] << ", ";
        }
        cout << endl;
    }
#endif
    return 0;
}


Measured memory_bytes: 3616
#include <iostream>
#include <vector>
#include <stack>
#include <queue>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <numeric>
#include <map>

using namespace std;

#define rep(i, n) for(int i = 0; i < n; i++)
#define repi(i, start, end) for(int i = start; i < end; i++)
#define all(x) (x).begin(), (x).end()
#define debug(x) cout << (x) << endl;
typedef long long ll;
const int MAX = 999999999;

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

    map<int, int> num_cnt;
    rep(i, n){
        int inp;
        cin >> inp;
        num_cnt[inp] ++;
    }

    vector<int> num_cnt_vec;
    for(auto itr = num_cnt.begin(); itr != num_cnt.end(); itr++){
        num_cnt_vec.push_back(itr->second);
    }

    sort(all(num_cnt_vec));

    int out = 0;
    for(int i = 0; i < max(0, (int)num_cnt_vec.size()-k); i++) out += num_cnt_vec[i];

    cout << out << endl;
}

Measured memory_bytes: 10748
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <vector>
#include <queue>
using namespace std;

#define X first
#define Y second
typedef pair<int, int> pii;

const int N = 550;
pii pos[N];
int a[N];
int ans[N * N];
queue<int> qx, qy;

void add(queue<int> &que, int c, int num) {
	while(c) que.push(num), c --;
}
int main() {
	int n;
	cin >> n;
	for(int i = 1; i <= n; i ++) {
		scanf("%d", &pos[i].X), pos[i].Y = i;
		a[pos[i].Y] = pos[i].X;
	}
	sort(pos + 1, pos + n + 1);
	int top = 1, head = 1;
	add(qx, pos[head].Y - 1, pos[head].Y);
	for(int i = 1; i <= n * n; i ++){
		while(qx.empty() && ++head <= n) 
			add(qx, pos[head].Y - 1, pos[head].Y);
		if(top <= n && i == pos[top].X) {
			ans[i] = pos[top].Y;
			if(qx.empty() == false && a[qx.front()] == i) 
				return puts("No") * 0;
			add(qy, n - pos[top].Y, pos[top].Y);
			top ++;
		} else {
			if(qx.empty() == false) ans[i] = qx.front(), qx.pop();
			else if(qy.empty() == false) ans[i] = qy.front(), qy.pop();
			else return puts("No") * 0;
		}
	}
	puts("Yes");
	for(int i = 1; i <= n * n; i ++) 
		printf("%d%c", ans[i], i == n * n ? '\n' : ' ');
	
}


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

int i,j,k;
int n,tim[61];
long long int ans;

int main(){

	while(scanf("%d",&n)*n){
		ans=0;
		for(i=0;i<61;i++)tim[i]=0;
		for(i=0;i<n;i++){
			scanf("%d",&k);
			tim[k]++;
		}
		for(i=0;i<61 && n>1;i++){
			for(;tim[i]>0 && n>1;tim[i]--){
				n--;
				ans+=i*n;
			}
		}
		printf("%lld\n",ans);
	}
	return 0;
}

Measured memory_bytes: 600
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            Scanner cin = new Scanner();
            int N = cin.nextInt();
            
            HashSet<int> list = new HashSet<int>();
            for(int i = 0; i < N; i++)
            {
                int A = cin.nextInt();
                if (list.Contains(A)) list.Remove(A);
                else list.Add(A);
            }

            Console.WriteLine(list.Count());
            Console.ReadLine();
        }

        static int BinarySearch<T>(T[] array, T target) where T : IComparable<T> //2分探索
        {
            int min = 0;
            int max = array.Length - 1;

            while (true)
            {
                // 範囲内に見つからなかった
                if (max < min) return -1;
                // 範囲内の中央値と比較する
                int mid = min + (max - min) / 2;
                switch (target.CompareTo(array[mid]))
                {
                    case -1:    // 中央値より小さい
                        max = mid - 1;
                        break;
                    case 1:     // 中央値より大きい
                        min = mid + 1;
                        break;
                    case 0:     // 見つかった
                        return mid;
                }
            }
        }

        static void Swap<T>(ref T a, ref T b)
        {
            T tmp = a;
            a = b;
            b = tmp;
        }
    }

    class Scanner //標準入力
    {
        string[] s;
        int i;

        char[] cs = new char[] { ' ' };

        public Scanner()
        {
            s = new string[0];
            i = 0;
        }

        public string next()
        {
            if (i < s.Length) return s[i++];
            string st = Console.ReadLine();
            while (st == "") st = Console.ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            if (s.Length == 0) return next();
            i = 0;
            return s[i++];
        }

        public int nextInt()
        {
            return int.Parse(next());
        }
        public int[] ArrayInt(int N, int add = 0)
        {
            int[] Array = new int[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextInt() + add;
            }
            return Array;
        }

        public long nextLong()
        {
            return long.Parse(next());
        }

        public long[] ArrayLong(int N, long add = 0)
        {
            long[] Array = new long[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextLong() + add;
            }
            return Array;
        }

        public double nextDouble()
        {
            return double.Parse(next());
        }


        public double[] ArrayDouble(int N, double add = 0)
        {
            double[] Array = new double[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextDouble() + add;
            }
            return Array;
        }
    }
}


Measured memory_bytes: 19412
# include <bits/stdc++.h>
# define INF 1e9
using namespace std;

int main(){

  int N;
  cin >> N;
  int A[2][N];
  for(int i=0; i<2; ++i){
    for(int j=0; j<N; ++j){
      cin >> A[i][j];
    }
  }

  int dp[3][N+1];
  fill((int*)dp, (int*)(dp+3), 0);
  for(int i=0; i<2; ++i){
    for(int j=0; j<N; ++j){
      dp[i+1][j+1] = max(dp[i][j+1], dp[i+1][j]) + A[i][j];
    }
  }
  cout << dp[2][N] << endl;

}


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

using namespace std;

int main() {
  int n, m;
  cin >> n >> m;
  vector<int> a(m), b(m);
  vector<vector<int>> bucket(n);
  for (int i = 0; i < m; i++) {
    cin >> a[i] >> b[i];
    a[i]--;
    b[i]--;
    bucket[a[i]].push_back(i);
  }
  int ans = 0;
  priority_queue<int, vector<int>, greater<int>> q;
  for (int i = 0; i < n; i++) {
    if (!q.empty() && q.top() == i) {
      ans++;
      while (!q.empty()) q.pop();
    }
    for (int j : bucket[i]) {
      q.push(b[j]);
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 6912
#![allow(unused_imports)]
use std::collections::HashMap;
use std::collections::HashSet;
use std::collections::VecDeque;

#[allow(unused_macros)]
macro_rules! read {
    ([$t:ty] ; $n:expr) =>
        ((0..$n).map(|_| read!([$t])).collect::<Vec<_>>());
    ($($t:ty),+ ; $n:expr) =>
        ((0..$n).map(|_| read!($($t),+)).collect::<Vec<_>>());
    ([$t:ty]) =>
        (rl().split_whitespace().map(|w| w.parse().unwrap()).collect::<Vec<$t>>());
    ($t:ty) =>
        (rl().parse::<$t>().unwrap());
    ($($t:ty),*) => {{
        let buf = rl();
        let mut w = buf.split_whitespace();
        ($(w.next().unwrap().parse::<$t>().unwrap()),*)
    }};
}

#[allow(dead_code)]
fn rl() -> String {
    let mut buf = String::new();
    std::io::stdin().read_line(&mut buf).unwrap();
    buf.trim_end().to_owned()
}

trait IteratorExt: Iterator + Sized {
    fn vec(self) -> Vec<Self::Item> {
        self.collect()
    }
}
impl<T: Iterator> IteratorExt for T {}


fn main() {
    let (x, _) = read!(isize, isize);
    let p = read!([isize]);
    let dif = p.into_iter().map(|e| e - x).vec();

    for i in 0.. {
        if !dif.contains(&-i) {
            println!("{}", -i + x);
            return;
        } else if !dif.contains(&i) {
            println!("{}", i + x);
            return;
        }
    }
}

Measured memory_bytes: 2156
#include<bits/stdc++.h>
using namespace std;
typedef double db;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
#define dd(x) cout << #x << " = " << x << ", "
#define de(x) cout << #x << " = " << x << endl
#define rep(i,a,b) for(int i=(a);i<(b);++i)
#define per(i,a,b) for(int i=(b)-1;i>=(a);--i)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define fi first
#define se second
//INF = 1 061 109 567 ; INF + INF = 2 122 219 134 ;
//LINF = 4 557 430 888 798 830 399 ; LINF + LINF = 9 114 861 777 597 660 798 ;
const int INF = 0x3f3f3f3f;     // -INF: 0xc0   abs(-INF) = INF + 1
const ll LINF = 0x3f3f3f3f3f3f3f3f;
/*}}}*/                         // zr, zm
const int MOD = (int)1e9+7;     // when MOD = 1e9+7, inv2 = 500000004
const int N = (int)1e6+7;
const int M = (int)-1;

int v[N];
int main()
{
	int n;scanf("%d",&n);
	rep(i,1,n+1) scanf("%d",&v[i]);
	priority_queue<double> q;
	rep(i,1,n+1) q.push(-v[i]);
	rep(i,1,n) {
		double x = q.top();q.pop();
		double y = q.top();q.pop();
		q.push((x+y)/2);
	}
	printf("%.7f\n",-q.top());
	return 0;
}


Measured memory_bytes: 256
n = int(input())
s = [input() for _ in range(n)]
count  = [0, 0, 0, 0]
for i in s:
    if i == 'AC':count[0] += 1
    elif i == 'WA':count[1] += 1
    elif i == 'TLE':count[2] += 1
    else:count[-1] += 1

string = ['AC', 'WA', 'TLE', 'RE']
for i,j in zip(string, count):
    print(i, 'x', j)

Measured memory_bytes: 16320
#include<iostream>
int main() {

  int n,i,j,c;
  while(std::cin>>n){
    c=0;
    int list[n-1];
    for(i=2;i<n+1;i++)list[i-2]=i;
    for(j=2;j*j<n+2;j++)
      if(list[j-2]!=0)
	for(i=1;j-2+list[j-2]*i<n;i++)
	  list[j-2+list[j-2]*i]=0;
    for(i=0; i<n-1; i++)
      if(list[i]!=0)c++;

    std::cout<<c<<"\n";
  }
}

Measured memory_bytes: 4768
#include <bits/stdc++.h>
#define fi first
#define se second
#define pii pair<int,int>
#define mp make_pair
#define pb push_back
#define space putchar(' ')
#define enter putchar('\n')
#define eps 1e-10
#define MAXN 100005
//#define ivorysi
using namespace std;
typedef long long int64;
typedef unsigned int u32;
typedef double db;
template<class T>
void read(T &res) {
    res = 0;T f = 1;char c = getchar();
    while(c < '0' || c > '9') {
    	if(c == '-') f = -1;
    	c = getchar();
    }
    while(c >= '0' && c <= '9') {
    	res = res * 10 +c - '0';
    	c = getchar();
    }
    res *= f;
}
template<class T>
void out(T x) {
    if(x < 0) {x = -x;putchar('-');}
    if(x >= 10) {
	out(x / 10);
    }
    putchar('0' + x % 10);
}
int N;
int64 X[MAXN],A,B;
void Solve() {
    read(N);read(A);read(B);
    for(int i = 1 ; i <= N ; ++i) read(X[i]);
    int64 ans = 0;
    for(int i = 2 ; i <= N ; ++i) {
        ans += min(B,(X[i] - X[i - 1]) * A);
    }
    out(ans);enter;
}
int main() {
#ifdef ivorysi
    freopen("f1.in","r",stdin);
#endif
    Solve();
    return 0;
}


Measured memory_bytes: 1024
w, h, n = map(int, input().split())
x_left = 0
x_right = w
y_down = 0
y_up = h
for i in range(n):
  x, y, a = map(int, input().split())
  if a == 1:
    x_left = max(x_left, x)
  if a == 2:
    x_right = min(x_right, x)
  if a == 3:
    y_down = max(y_down, y)
  if a == 4:
    y_up = min(y_up, y)
print(max(x_right - x_left, 0) * max(y_up - y_down,0))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define ll long long
#define _GLIBCXX_DEBUG
const ll MOD = 1000000007;
const int MAX = 510000;

int main() {
  int N, M;
  cin >> N >> M;
  vector<int> p(M);
  vector<string> S(M);
  for (int i=0; i<M; i++) cin >> p[i] >> S[i];
  // 各問題ですでにACが出たか，各問題のWAの回数
  vector<bool> AC(N, false);
  vector<int> WA(N, 0);
  int correct = 0, penalty = 0; // 正解数とペナルティ数
  for (int i=0; i<M; i++) {
    if (S[i]=="WA") WA[p[i]-1]++;
    else if (AC[p[i]-1]) continue;
    else {
      AC[p[i]-1] = true;
      correct++;
      penalty += WA[p[i]-1];
    }
  }
  cout << correct << " " << penalty << endl;
}

Measured memory_bytes: 6528
#include <vector>
#include <cstdio>
#include <cstring>
#include <queue>
#include <cctype>
#include <cmath>
#include <algorithm>
#include <iostream>
#include <bitset>
#include <map>
#include <complex>
#include <ctime>
#include <numeric>
#include <set>
 
using namespace std;
 
typedef long long ll;
 
typedef struct node{
    int s, e, val, pos;
    bool operator<(const node& n) const{
        if(e != n.e) return e < n.e;
        return val > n.val;
    }
    node(){};
    node(int ss, int ee, int v, int p){
        s = ss, e = ee, val = v, pos = p;
    }
}node;
 
int occs[(int)1e6 + 5], tree[2000000], n, ans[2000000];
 
void update(int x, int val){
    while(x <= n){
        tree[x] += val;
        x += x & -x;
    }
}
 
int query(int x){
    int ret = 0;
    while(x > 0){
        ret += tree[x];
        x -= x & -x;
    }
    return ret;
}
 
int main()
{
// #ifndef ONLINE_JUDGE
//     freopen("in.in", "r", stdin);
// #endif
 
    int q, s, e;
    vector<node> v;
    scanf("%d", &n);
    scanf("%d", &q);
    for(int i = 1; i <= n; i++){
        scanf("%d", &s);
        v.push_back(node(i, i, s, -1));
    }
    
    for(int i = 0; i < q; i++){
        scanf("%d %d", &s, &e);
        v.push_back(node(s, e, 0, i));
    }
 
    sort(v.begin(), v.end());
 
    for(int i = 0;i < v.size(); i++){
        if(v[i].val == 0){
            ans[v[i].pos] = query(v[i].e) - query(v[i].s - 1);
        }else{
            if(occs[v[i].val] != 0) update(occs[v[i].val], -1);
            update(v[i].s, 1);
            occs[v[i].val] = v[i].s;
        }
    }
 
    for(int i = 0; i < q; i++){
        printf("%d\n", ans[i]);
    }
 
    return 0;
}

Measured memory_bytes: 25408
N = int(input())
num = 1
c = 0
t = 0
for i in range(N,-1,-1):
    j = i
    c = 0
    while 1 < j:
        if j % 2 == 0:
            c += 1
        j //= 2
    if t < c:
        t = c
        num = i
print(num)

Measured memory_bytes: 3060
"""

https://atcoder.jp/contests/cf16-final/tasks/codefestival_2016_final_e

部分点を考えてみる
dp[i] = i枚を焼くのにかかる最小の時間　としてみる
初期値は, dp[i] = i
dp[i] <- dp[j] + A*j + (i+j-1)//j
これだと部分点も取れない

Aって結構でかそうだよな…
dp[i+1] <= dp[i] + 1
である。つまり、差は0か1
これは、少なくとも1秒待てば焼けることから証明できる

推移先は、 dp[j] + A*j 以上なのは確定


そして掛け算であるということは順番を入れ替えることができる
(((1×4秒)×5秒)×3秒)=60枚(編集済)
順番を入れ替えても
(((1×3秒)×4秒)×5秒)=60枚
by werug

積がx以上となる数列aで、
a1+a2+a3+…+an + A×(n-1)
が最小となるものを見つけなさい
n <= 40　くらい

n個の数列で、積がX以上になるうち
和が最小のものを求めなさい → これを 1<=n<=40 に対して計算すればいい

和を最小化するには、できるだけ同じ数字で分散させるのが最適…？(編集済)
12の時、 1x12 , 2x6 , 3x4 だと 3x4が一番輪が小さい
整数以外も可能なら, X^(-n) づつが最適
整数だとceil (X^(-n)) と、floor(X^(-n)) を一定個数づつ混ぜるのが最適のはず(編集済)
→全探索できる

"""

from sys import stdin
N,A = map(int,stdin.readline().split())

ans = N
for s in range(1,45): #sは数列の長さ

    if 2**s >= N:
        ans = min( ans , 2*s + A*(s-1) )
        continue

    nm = int(N**(1/s))
    #print (s,nm)
    for t in range(s+1):
        if pow(nm,t) * pow(nm+1,s-t) >= N:
            ans = min(ans , nm*t+(nm+1)*(s-t) + A*(s-1) )

print (ans)

#実験
"""
dp = [i for i in range(N+1)]

for i in range(N+1):
    for j in range(1,i):
        dp[i] = min(dp[i] , dp[j] + A + (i+j-1)//j )

print (dp)
"""


Measured memory_bytes: 63492
use proconio::input;

fn main() {
    input! {
        n: usize,
        x: [i32; n],
    }

    let mut sort = x.clone();
    sort.sort();
    let mid = (n - 1) / 2;

    for i in 0..n {
        let m = if x[i] <= sort[mid] { mid + 1 } else { mid };
        println!("{}", sort[m]);
    }
}

Measured memory_bytes: 5932
# ITP1_7_A: Grading

def absent?(score)
  score == -1
end

def eof?(*scores)
  scores.all? { |s| absent? s }
end

def grade(mids, ends, rexs)
  return 'F' if absent?(mids) || absent?(ends)
  case mids + ends
  when 80..100 then 'A'
  when 65...80 then 'B'
  when 50...65 then 'C'
  when 30...50 then rexs < 50 ? 'D' : 'C'
  when 0...30  then 'F'
  end
end

while true
  scores = gets.split.map &:to_i
  break if eof? *scores
  puts grade(*scores)
end

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

using namespace std;

int main()
{
    int n, MIN = 1e9+7;
    int ans = 0;
    cin >> n;
    for (int i = 1; i <= n; ++i)
    {
        int a;
        cin >> a;
        MIN = min(MIN, a);
        ans += (a <= MIN);
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 384
S = input()
K = int(input())
cnt = 0
head = 0
for s in S:
  if s != S[0]:
    break
  head += 1
tail = 0
for s in S[::-1]:
  if s != S[-1]:
    break
  tail += 1
same = 0
for i in range(head, len(S) - tail):
  if S[i] != S[i + 1]:
    cnt += -(-same // 2)
    same = 0
    continue
  same += 1
cnt *= K
if head == len(S):
  cnt = len(S) * K // 2
elif S[0] == S[-1]:
  cnt += head // 2 + (head + tail) // 2 * (K - 1) + tail // 2
else:
  cnt += (head // 2 + tail // 2) * K
print(cnt)

Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <set>
#include <algorithm>
#include <array>
#include <complex>
#include <string>
#include <utility>
#include <map>
#include <queue>
#include <list>
#include <functional>
#include <numeric>
#include <stack>
#include <tuple>

using namespace std;
int dx[4] = { -1,0,1,0 };
int dy[4] = { 0,1,0,-1 };
const int INF = 100000000;
const long long LINF = 1000000000000000000;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-6;
using pii = std::pair<int, int>;
using ll=long long;  
using pLL = std::pair<ll, ll>;

#define SORT(v) std::sort(v.begin(), v.end())
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N,A,B,Acount=0,ABcount=0,Bcount=0;
    cin >> N >> A>> B;
    vector<int> p(N),Amin(N),bet(N),Bmax(N);
    for(int i=0;i<N;++i){
        cin >> p[i];
        if(A>=p[i]){
            Acount++;
        }else if(B+1<=p[i]){
            Bcount++;
        }else{
            ABcount++;
        }
    }
    int ans=INF;
    ans=min(Acount,min(ABcount,Bcount));
    cout << ans <<endl;
    return 0;
}

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

int main(void)
{
    long int k;
    int n;
    cin >> k >> n;
    long int max_a = 0;
    long int last_a = 0;
    long int first_a = 0;

    cin >> first_a;    
    last_a = first_a;
    for(int i = 1; i < n; ++i) {
        long int atmp;
        cin >> atmp;
        max_a = max(max_a, atmp - last_a);
        last_a = atmp;
    }
    max_a = max(max_a, ((k - last_a) + first_a));

    cout << k - max_a << endl;    

    return 0;
}



Measured memory_bytes: 256
import java.util.*;

public class Main {

	public static boolean judge(char o[], char t){
		for(int i = 0; i < 3; ++i){
			if(o[i] == t)return true;
		}
		return false;
	}

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String ans[] = {"Yes", "No"};
		char odd[] = {'R', 'U', 'D'};
		char equal[] = {'L', 'U', 'D'};
		sc.close();
		int an = 0;
		int n = s.length();
		for(int i = 0; i < n; ++i){
			char t = s.charAt(i);
			if(i % 2 == 0){
				if(!judge(odd, t))an = 1;
			}
			else{
				if(!judge(equal, t)) an = 1;
			}
		}

		System.out.println(ans[an]);
	}
}


Measured memory_bytes: 22996
#include<bits/stdc++.h>
using namespace std;
int a[200001],b[200001];
int n,m;
int main(){
	cin>>n>>m;
	for(int i=1;i<=n;++i)cin>>a[i];
	for(int i=1;i<=m;++i){
      int x,y;
		cin>>x>>y;
		b[x]=max(b[x],a[y]);
		b[y]=max(b[y],a[x]);
	}
  int s=0;
	for(int i=1;i<=n;++i)
		if(a[i]>b[i])
          s++;
	cout<<s;
} 


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

using namespace std;

int main()
{
  long long int a,b,n;
  cin>>a>>b>>n;
  int maxx=0;
  
  long long int i=min(b-1,n);
  
  cout<<(a*i)/b-a*(i/b)<<"\n";
  
  return 0;
}


Measured memory_bytes: 3576
#include <iostream>
#include <algorithm>
#include <math.h>
#include <vector>
#include <queue>
#include <time.h>
using namespace std;
typedef long long ll;

int main(void) {
    ll l, r;
    cin >> l >> r;

    ll ans = 2019;
    for (ll i = l; i <= min(r, l + 2020); i++) {
        for (ll j = i + 1; j <= min(r, l + 2020); j++) {
            ans = min(ans, i * j % 2019);
        }
    }

    cout << ans << endl;

}
/*
g++ -std=c++14 _main.cpp
 */


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<set>
#include<unordered_map>
#include<cmath>
#include<iterator>
using namespace std;
 
int main()
{
    int N, A, B, C, ans=0;
    cin>>N;
    for(A=1;A<=N;A+=1)
    {
        if(A>=N)
        {
            break;
        }
        for(B=1;B<=N;B+=1)
        {
            if(A*B>=N)
            {
                break;
            }
            if(A*B<N)
            {
                ans+=1;   
            }
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3624
#include <stdio.h>
int main(void){
long N;
long K;
long a,b;
scanf("%ld",&N);
scanf("%ld",&K);
a=N%K;
b=K-a;
if(a<=b){
	printf("%ld",a);
}
if(a>=b){
	printf("%ld",b);
}

return 0;
}

Measured memory_bytes: 1704
#include<bits/stdc++.h>
typedef long long int   LL;
typedef long double     LD;
#define OR              ||
#define AND             &&
#define nl              '\n'
#define S               string
#define inf             INT_MAX
#define SQR(a)          (a) * (a)
#define GCD(a, b)       __gcd(a, b)
#define pi              2.0*acos(0.0)
#define LCM(a, b)       (a * b) / GCD(a, b)
#define mem(a,b)        memset(a,b,sizeof(a))
#define srtv(v)         sort(v.begin(),v.end())
#define T               int t; cin>>t; while(t--)
#define boost		    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define inout           freopen("input.txt","r",stdin);freopen("output.txt","w",stdout)
using namespace std;

int main()
{

    int n,m;
    cin>>n>>m;

    LL ans=(n*(n-1)/2)+(m*(m-1)/2);

    cout<<ans;



    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <tuple>
#include <vector>

using namespace std;

#define rep(i, n) for (int64_t i = 0; i < (int64_t)(n); i++)
#define irep(i, n) for (int64_t i = 0; i <= (int64_t)(n); i++)
#define rrep(i, n) for (int64_t i = (n)-1; i >= 0; i--)
#define rirep(i, n) for (int64_t i = n; i >= 0; i--)

#define chmax(a, b) (a) = max(a, b)
#define chmin(a, b) (a) = min(a, b)

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

  int ac = 0, wa = 0, tle = 0, re = 0;
  rep(i, N) {
    string s;
    cin >> s;
    if (s[0] == 'A') {
      ac++;
    } else if (s[0] == 'W') {
      wa++;
    } else if (s[0] == 'T') {
      tle++;
    } else {
      re++;
    }
  }

  cout << "AC x " << ac << endl
       << "WA x " << wa << endl
       << "TLE x " << tle << endl
       << "RE x " << re << endl;
  return 0;
}

Measured memory_bytes: 3628
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <set>
#include <map>
#include <numeric>
#include <regex>
#include <tuple>
#include<iomanip>
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
#define MOD 1000000007 // 10^9 + 7
#define INF 1000000000 // 10^9
#define LLINF 1LL<<60


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

	int X; cin >> X;

	bool flag = false;
	for (int i = 0; i <= 1000 && !flag; i++) {
		if (100 * i <= X && X <= 105 * i) flag = true;
	}
	if (flag) cout << 1 << endl;
	else cout << 0 << endl;

	return 0;
}

Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef map<int, int> mii;
typedef map<char,int> mci;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<pair<int,int>> vii;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define in insert
#define sz(v) v.size()
#define mina(a,b) (a)=min((a),(b));
#define maxa(a,b) (a)=max((a),(b));
const int INF = 1e9 + 5;

void solve(){
    int n; cin>>n;
    vi v(n);
    for(int i = 0; i < n; i++) cin>>v[i];
    for(int i = 1; i < n; i++){
        if(v[i]>v[i-1]) v[i]--;
    }
    vi c=v;
    sort(all(v));
    if(v==c) cout<<"Yes";
    else cout<<"No";
    
}
int main(){
    int T=1;        //! COMMENT IF THERE IS NO TEST CASES
    //cin>>T;             
    for(int i = 0; i < T; i++) solve(); 
}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
 
vector<int> v;
int main( ) {
	int n;
	cin>>n;
	int i;
	for(i=1;i<=n;i++) {
		int x;
		cin>>x;
		v.push_back(x);
	}
	sort(v.begin(), v.end());
	cout<<v[n/2] - v[n/2 -1]<<"\n";
	return 0;
}

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

int transformation(int n)
{
    return n/100*60+n%100;
}

int main()
{
    for(int n,p,q;cin>>n>>p>>q,n|p|q;)
    {
        vector<int> bla(24*60+10,0);
        p = transformation(p);
        q = transformation(q);
        for(int c=0;c<n;c++)
        {
            int t;
            cin>>t;
            while(t--)
            {
                int first,second;
                cin>>first>>second;
                first = transformation(first);
                second = transformation(second);
                for(int c2=first;c2<second;c2++) bla[c2]++;
            }
        }
        int act = 0;
        int res = 0;
        for(int c=p;c<q;c++)
        {
            if(bla[c]==n) act=0;
            else act++;
            res=max(res,act);
        }
        cout<<res<<endl;

    }
    return 0;
}

Measured memory_bytes: 1200
#include <bits/stdc++.h>
#define int long long

using namespace std;

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, m;
  cin >> n >> m;
  map<int, int> cnt;
  ++cnt[0];
  int sum = 0, ans = 0;
  for (int i = 0; i < n; ++i) {
    int a;
    cin >> a;
    sum = (sum + a) % m;
    ans += cnt[sum];
    ++cnt[sum];
  } 
  cout << ans << '\n';
  return 0;
}

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

int tentou(int i, vector<int> data){
    int keta=0;
    int on=0;
    while(i){
        on+=(i%2)*data.at(keta);
        keta++;
        i=i/2;
    }
    return on;
}
long n,m,ans=0;
int main(){
    cin>>n>>m;
    vector<vector<int>> data(m,vector<int>(n));
    For(i,m){
        int k;
        cin>>k;
        For(j,k){
            int s;
            cin>>s;
            data.at(i).at(s-1) ++;
        }
    }
    vector<int> p(m);
    For(i,m){
        cin>>p.at(i);
    }
    For(i,pow(2,n)){
        int t=0;
        For(j,m){
            if(tentou(i,data.at(j))%2==p.at(j)){
                t++;
            }
        }
        if(t==m){
            ans++;
        }
    }
    cout<<ans<<endl;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#define fint register int
#define h 5001
#define p 1654378
#define int long long
using namespace std;
int a[p],s[p];
const int mods=1e9+7;
signed main()
{
	int n;
	cin>>n;
	for(fint i=1;i<=n;i++)
	cin>>a[i],s[i]=s[i-1]+a[i];
	int ans=0;
	for(fint i=1;i<n;i++)
	ans=(ans+(s[n]-s[i])%mods*(s[i]-s[i-1]))%mods;
	cout<<ans%mods;
	return 0;
}

Measured memory_bytes: 6700
#include<iostream>
#include<vector>
#include<cstdio>
#include<string>
#include<algorithm>

using namespace std;

int main()
{
    int N, T;
    cin >> N >> T;

    vector<int> c(N);
    vector<int> t(N);

    
    for(int i = 0; i < N; i++)
    {
        cin >> c[i] >> t[i];
    }

    int MAX = 1 << 30;
    int ans = MAX;
    for(int i = 0; i < N; i++)
    {
        if(t[i] <=T)
        {
            // if(MIN > c[i]) MIN = c[i];
            ans = min(ans, c[i]);
        }
    }

    if(ans<MAX){
        cout << ans << endl;
    }else{
        cout << "TLE" << endl;
    }
}

Measured memory_bytes: 256
{-# LANGUAGE BangPatterns #-}

module Main where

import Data.Char
import Data.List
import Control.Monad
import Control.Monad.ST
import Data.Array.ST
import Data.Array.Unboxed
import Control.Applicative
import Text.Printf


readInt :: IO Int
readInt = read <$> (input `seq` input)
    where input = do
            !c <- getChar
            if isDigit c || c == '-'
                then (c :) <$> input
                else return []

prints :: Show a => [a] -> IO ()
prints as = putStrLn $ concat $ intersperse " " $ map show as

f c | isUpper c = toLower c
    | isLower c = toUpper c
    | otherwise = c

main = do
    c <- getChar
    if c == '\n'
        then putStrLn ""
        else putStr (f c : []) >> main


Measured memory_bytes: 3924
from collections import deque

H,W=map(int,input().split())

S=[]
for i in range(H):
    S.append([c=='#' for c in input()]) # 黒をTrueとする
# print(S)

a=[[[] for j in range(W)] for i in range(H)]
for i in range(H):
    for j in range(W):
        if 0<i and (S[i][j] ^ S[i-1][j]):
            a[i][j].append((i-1,j))
        if i<H-1 and (S[i][j] ^ S[i+1][j]):
            a[i][j].append((i+1,j))
        if 0<j and (S[i][j] ^ S[i][j-1]):
            a[i][j].append((i,j-1))
        if j<W-1 and (S[i][j] ^ S[i][j+1]):
            a[i][j].append((i,j+1))
'''
for ai in a:
    print(ai)
'''
ans=0
q=deque()
r=[[False for j in range(W)] for i in range(H)]
for i in range(H):
    for j in range(W):
        if not r[i][j]:
            b,w=0,0
            q.append((i,j));r[i][j]=True
            if S[i][j]:
                b+=1
            else:
                w+=1
            while q:
                ui,uj=q.popleft()
                for v in a[ui][uj]:
                    vi,vj=v
                    if not r[vi][vj]:
                        q.append((vi,vj));r[vi][vj]=True
                        if S[vi][vj]:
                            b+=1
                        else:
                            w+=1
            ans+=b*w
print(ans)

Measured memory_bytes: 84312
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int k;
  cin >> k;
  int a, b;
  cin >> a >> b;
  for(int i=a; i<=b; i++){
    if(i%k==0){
      cout << "OK" << endl;
      return 0;
    }
  }
  cout << "NG" << endl;
  return 0;
}


Measured memory_bytes: 3552