akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <string>
#include <functional>
#include <utility>
#include <queue>
#include <vector>
#include <string>
#include <stack>
#include <random>
#define rep(i,n) for(ll i=0;i<n;i++)
using namespace std;
typedef long long int ll;
const ll  MOD = 1000000007;
typedef pair<ll,ll> P;
const ll INF = 100100100100100100;

ll N;
ll a[100100];
int main(){
  cin >> N;
  rep(i,N){
    cin >> a[i];
  }
  sort(a,a+N);
  ll prev = -1;
  ll ans = 0;
  rep(i,N){
    if(a[i] != prev){
      prev = a[i];
      ll j = i;
      while(a[j] <= prev + 2){
        j++;
        if(j >= N){
          break;
        }
      }
      ans = max(ans,j-i);
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 1024
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner scn = new Scanner(System.in);
        while(true) {
            int a = scn.nextInt();
            String op = scn.next();
            int b = scn.nextInt();
            if(op.equals("+")) {
                System.out.println(a + b);
            } else if(op.equals("-")) {
                System.out.println(a - b);
            } else if(op.equals("*")) {
                System.out.println(a * b);
            } else if(op.equals("/")) {
                System.out.println(a / b);
            } else {
                break;
            }
        }
    }
}

Measured memory_bytes: 17188
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <limits>
#include <sstream>
#include <fstream>
#include <climits>
#include <map>
#include <numeric>
#include <functional>

typedef signed char        int8;
typedef short              int16;
typedef int                int32;
typedef long long          int64;
typedef unsigned char      uint8;
typedef unsigned short     uint16;
typedef unsigned int       uint32;
typedef unsigned long long uint64;

int main(void) {
  int a, b;
  std::cin >> a >> b;

  std::stringstream sstr1;
  for (int i = 0; i < b; i++) {
    sstr1 << a;
  }
  std::stringstream sstr2;
  for (int i = 0; i < a; i++) {
    sstr2 << b;
  }

  std::string sm = sstr1.str() < sstr2.str() ? sstr1.str() : sstr2.str();

  std::cout << sm << std::endl;

  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main() {
  char ch;
  int alpha[26] = {0}, count;

  while((ch=getchar()) != EOF) {
    if('a' <= ch && 'z' >= ch) {
      alpha[ch-'a']++;
    } else if('A' <= ch && 'Z' >= ch) {
      alpha[ch-'A']++;
    }
  }

  for(count=0; count<26; count++) {
    printf("%c : %d\n", 'a'+count, alpha[count]);
  }

  return 0;
}

Measured memory_bytes: 524
#include<iostream>
using namespace std;
int main()
{
  long long int i,n,m,sum=0;
  cin>>n>>m;
  long long int a[m];
  for(i=0;i<m;i++)
  {
    cin>>a[i];
    sum=sum+a[i];
  }
  if(n-sum>=0)
    cout<<n-sum;
  else
    cout<<"-1";
  return 0;
}
  

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

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

using namespace std;

class mint{
	static const int MOD=1e9+7;
	int x;
public:
	mint():x(0){}
	mint(long long y){ x=y%MOD; if(x<0) x+=MOD; }

	mint& operator+=(const mint& m){ x+=m.x; if(x>=MOD) x-=MOD; return *this; }
	mint& operator-=(const mint& m){ x-=m.x; if(x<   0) x+=MOD; return *this; }
	mint& operator*=(const mint& m){ x=1LL*x*m.x%MOD; return *this; }
	mint& operator/=(const mint& m){ return *this*=inverse(m); }
	mint operator+(const mint& m)const{ return mint(*this)+=m; }
	mint operator-(const mint& m)const{ return mint(*this)-=m; }
	mint operator*(const mint& m)const{ return mint(*this)*=m; }
	mint operator/(const mint& m)const{ return mint(*this)/=m; }

	friend mint inverse(const mint& m){
		int a=m.x,b=MOD,u=1,v=0;
		while(b>0){ int t=a/b; a-=t*b; swap(a,b); u-=t*v; swap(u,v); }
		return u;
	}

	friend istream& operator>>(istream& is,mint& m){ long long t; is>>t; m=mint(t); return is; }
	friend ostream& operator<<(ostream& os,const mint& m){ return os<<m.x; }
	int to_int()const{ return x; }
};

mint pow(mint m,long long k){
	mint res=1;
	for(;k>0;k>>=1,m*=m) if(k&1) res*=m;
	return res;
}

class linear_sieve{
	vector<int> lpf,p;
public:
	linear_sieve(int n):lpf(n+1){
		for(int i=2;i<=n;i++){
			if(lpf[i]==0){
				lpf[i]=i;
				p.emplace_back(i);
			}
			for(int j=0;j<p.size()&&p[j]<=lpf[i]&&i*p[j]<=n;j++) lpf[i*p[j]]=p[j];
		}
	}

	const vector<int>& primes()const{ return p; }

	bool is_prime(int a)const{
		assert(a<=(int)lpf.size()-1);
		return a>0 && lpf[a]==a;
	}

	map<int,int> prime_factorize(int a)const{
		assert(a<=(int)lpf.size()-1);
		map<int,int> pf;
		for(;a>1;a/=lpf[a]) ++pf[lpf[a]];
		return pf;
	}
};

int main(){
	linear_sieve S(1e6);

	int n; scanf("%d",&n);
	vector<int> a(n);
	rep(i,n) scanf("%d",&a[i]);

	map<int,int> pf;
	rep(i,n){
		for(auto q:S.prime_factorize(a[i])){
			pf[q.first]=max(pf[q.first],q.second);
		}
	}

	mint L=1;
	for(auto q:pf) L*=pow(mint(q.first),q.second);

	mint ans=0;
	rep(i,n) ans+=L/a[i];
	cout<<ans<<'\n';

	return 0;
}


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

int main(){
    int N;
    std::cin >> N;
    std::vector< int > A(N);
    for(int i=0; i<N; i++){
        std::cin >> A[i];
    }
    
    std::sort(A.begin(), A.end());
    
    long long ans = 0;
    int an = N / 2;
    int bn = N / 2 - (N % 2 == 0);
    for(int i=0; i<an; i++){
        ans = ans + A[N - i - 1];
    }
    for(int i=0; i<bn; i++){
        ans = ans + A[N - i - 2];
    }
    
    //std::cout << an << " " << bn << std::endl;
    std::cout << ans << std::endl;
    
    return 0;
}



Measured memory_bytes: 4004
from fractions import gcd

def lcm(a, b):
    return a * b // gcd(a, b)

A, B, C, D = [int(i) for i in input().split()]

c = (B // C) - ((A - 1) // C)
d = (B // D) - ((A - 1) // D)
cd = (B // (lcm(C, D))) - (A - 1) // (lcm(C, D))

N = B - A + 1

print(N - c - d + cd)


Measured memory_bytes: 5076
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i,n) for (int i = 0; i < (n); ++i)
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; }
const ll INF=1LL<<60;
const int inf=(1<<30)-1;
const int mod=1e9+7;
int dx[8]={1,0,-1,0,-1,-1,1,1};
int dy[8]={0,1,0,-1,-1,1,-1,1};
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll a,v,b,w,t;cin >> a >> v >> b >> w >> t;
    if(w>=v){
        cout << "NO" << endl;
        return 0;
    }
    if(abs(b-a)<=abs(w-v)*t){
        cout << "YES" << endl;
    }
    else{
        cout << "NO" << endl;
    }
}

Measured memory_bytes: 3652
while 1:
	try:
		h=[input() for i in [1]*5]
		l=set(h)
		if 1 in l and 2 in l:w=1
		elif 1 in l and 3 in l:w=3
		else:w=2
		if len(l)!=2:
			for i in h:print 3
		else:
			for i in h:print 1 if i==w else 2
	except:break

Measured memory_bytes: 4212
#include <bits/stdc++.h>
using namespace std;
#define show(x) cout << #x << " : " << x << endl
int n, i, h[100001], dp[100001];
int main ()
{
    cin >> n;
    for(i = 1; i <= n; i++) cin >> h[i];
    dp[2] = abs(h[2]-h[1]);
    for(i = 3; i <= n; i++) dp[i] = min(abs(h[i]-h[i-1])+dp[i-1], abs(h[i]-h[i-2])+dp[i-2]);
    cout << dp[n] << endl;
}


Measured memory_bytes: 1024
#!/usr/bin/env python3
import itertools
import math
n = int(input())
s = [list(map(int, input().split())) for i in range(n)]
a = 0
for j in itertools.permutations(range(n)):
    for k in range(n-1):
        a += ((s[j[k]][0] - s[j[k+1]][0])**2 + (s[j[k]][1] - s[j[k+1]][1])**2)**0.5
print(a/math.factorial(n))

Measured memory_bytes: 3064
def examD():
    N = I()
    St = S()
    cur = 0
    left = 0; right = 0
    for s in St:
        if s=="(":
            cur +=1
        if s==")":
            if cur>0:
                cur -=1
            else:
                left +=1
    right = cur
    ans = "("*left + St + ")"*right
    print(ans)

import sys
import copy
import bisect
import heapq
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')

examD()


Measured memory_bytes: 38384
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.IO.Compression;
using System.Linq;
using System.Numerics;
using System.Runtime.CompilerServices;
using System.Text;
using System.Text.RegularExpressions;
using Console = System.Console;

namespace Atcoder
{
    
    class Program
    {
        private const long COMDIV = 1000000007;

        static void Main(string[] args)
        {
            var N = int.Parse(Console.ReadLine());
            var As = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int ret = 0;
            for (int i = 0; i < N; i++)
            {
                if((i+1) % 2 == 0) continue;
                if (As[i] % 2 != 0) ret++;
            }

            Console.WriteLine(ret);
        }
    }
}

Measured memory_bytes: 27648
#include <iostream>
#include <map>

#define N 37

using namespace std;

map<string, int> suit_order = {
    { "S", 1 },
    { "H", 2 },
    { "C", 3 },
    { "D", 4 },
};

void dump(int n, string a[]) {
    for (int i=0; i<n; i++) {
        if (i>0) { cout<<" "; }
        cout<<a[i];
    }
    cout<<endl;
}

int cmp(string a, string b) {
    if (a[1] < b[1]) {
        return -1;
    } else if (a[1] > b[1]) {
        return 1;
    } else {
        if (a[1] < b[1]) {
            return -1;
        } else {
            return 1;
        }
    }
}

void bubble_sort(int n, string a[]) {
    for (int i=0; i<n; i++) {
        for (int j=n-1; j>i; --j) {
            if (cmp(a[j], a[j-1]) < 0) {
                string tmp = a[j];
                a[j] = a[j-1];
                a[j-1] = tmp;
            }
        }
    }
}

void selection_sort(int n, string a[]) {
    for (int i=0; i<n; i++) {
        int mini = i;
        for (int j=i; j<n; ++j) {
            if (cmp(a[j], a[mini]) < 0) {
                mini = j;
            }
        }
        string tmp = a[mini];
        a[mini] = a[i];
        a[i] = tmp;
    }
}

int main() {
    int n;
    string a[N];
    string b[N];
    cin>>n;
    for (int i=0; i<n; i++) {
        cin>>a[i];
        b[i] = a[i];
    }
    int count = 0;
    bubble_sort(n, a);
    selection_sort(n, b);

    dump(n, a);
    cout<<"Stable"<<endl;
    dump(n, b);
    int stable = 1;
    for (int i=0; i<n; ++i) {
        if (a[i] != b[i]) {
            stable = 0;
            break;
        }
    }
    if (stable) {
        cout<<"Stable"<<endl;
    } else {
        cout<<"Not stable"<<endl;
    }
    return 0;
}



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

long long int *vala,*valb,*valc;



void run_case(){
    long int n;
    cin>>n;
    vala= new long long int [n];
    valb= new long long int [n];
    valc= new long long int [n];
    vector<int> a,b,c;
    int z;
    cin>>z;
    a.push_back(z);
    cin>>z;
    b.push_back(z);
    cin>>z;
    c.push_back(z);
    vala[0]=a[0];
    valb[0]=b[0];
    valc[0]=c[0];

    for(long int i=1;i<n;i++){
        cin>>z;
        a.push_back(z);
        cin>>z;
        b.push_back(z);
        cin>>z;
        c.push_back(z);
        vala[i]=a[i]+max(valb[i-1],valc[i-1]);
        valb[i]=b[i]+max(vala[i-1],valc[i-1]);
        valc[i]=c[i]+max(vala[i-1],valb[i-1]);
    }    
    long long int f=max(vala[n-1],valb[n-1]);
    f=max(f,valc[n-1]);
    cout<<f;
   
}
int main(){
	ios_base::sync_with_stdio(false),cin.tie(nullptr);
    int t=1;
    while(t--){
        run_case();

    }
}



Measured memory_bytes: 6832
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define m0(x) memset(x, 0, sizeof(x))

int main() {
  int k, x;
  scanf("%d %d", &k, &x);
  for (int i = x - k + 1; i < x + k; i++) {
    printf("%d ", i);
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void){
    
    //*
    int a, b, c;
    cin >> a >> b >> c ;
    //*/
    
    a -= b;
    a -= c * (a / c);
    
    /*
    vector<int> vec(4);
    cin >> vec.at(0) >> vec.at(1) >> vec.at(2) ;
    
    sort(vec.begin(), vec.end());
    */
    
    /*
    if(a * b % 2 == 0){
        cout << "Even" << endl;
    } else {
        cout << "Odd" << endl;
    }
    */
    
    cout << a << endl;

    return 0; 
}


Measured memory_bytes: 3600
class UnionFind:
    def __init__(self,n):
        self.table = [i for i in range(n)]
        self.size = [1] * n
        self.rank = [0] * n

    def find(self,x):
        if self.table[x] == x:
            return x
        else:
            self.table[x] = self.find(self.table[x])
            return self.table[x]
    
    def unite(self,x,y):
        x = self.find(x)
        y = self.find(y)
        if x == y:
            return
        if self.rank[x] < self.rank[y]:
            self.table[x] = y
            self.size[y] += self.size[x]
        else:
            self.table[y] = x
            self.size[x] += self.size[y]
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1
    
    def same(self,x,y):
        return self.find(x) == self.find(y)
    
    def count(self,x):
        return self.size[self.find(x)]


n,m = map(int,input().split())
edge = []
for _ in range(m):
    a,b = map(int,input().split())
    edge.append([a-1,b-1])

uf = UnionFind(n)
ans = [n*(n-1)//2]

for i in range(m-1,0,-1):
    x,y = edge[i]
    px,py = uf.find(x), uf.find(y)
    if uf.same(x,y):
        ans.append(ans[-1])
    else:
        ans.append(ans[-1] - uf.count(x)*uf.count(y))
    uf.unite(px,py)

print(*ans[::-1],sep='\n')

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

string s="";
getline(cin,s);
int x=s.length();
//cout<<s[0];
putchar(toupper(s[0]));
for(int i=0;i<x;i++){
    if(s[i]==' '){
       // cout<<s[i+1];
       putchar (toupper(s[i+1]));
    }
}
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string.h>
#include <iomanip>
#include <math.h>
#include <string>

typedef long long int ll;

#define FOR(i,n,m) for(ll i=(ll)(m);i<(ll)(n);++i)
#define REP(i,n) FOR(i,n,0)
#define IREP(i,n) for(ll i=(ll)(n);i>=0;--i)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;

using namespace std;

int main()
{
	int N;
	cin >> N;
	string init;
	cout << 0 << endl;
	cin >> init;
	if (init == "Vacant")
	{
		return 0;
	}
	int under = 0;
	int top = N;
	while (true)
	{
		int m = (top + under) / 2;
		cout << m << endl;
		string s;
		cin >> s;
		if (s == "Vacant")
		{
			break;
		}
		if (m % 2 == 0)
		{
			if (s == init)
			{
				under = m;
			}
			else
			{
				top = m;
			}
		}
		else
		{
			if (s == init)
			{
				top = m;
			}
			else
			{
				under = m;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 852
import numpy

from decimal import *
getcontext().prec = 20
S = int(input())
if S <= 10 ** 9:
    print(0,0,S,0,0,1)
elif S == 10**18:
  print(0,0,10**9,0,0,10**9)
else:
	T = int(numpy.sqrt(Decimal(S)))
	if S >= T*(T+1):
		R = T+1
	else:
		R = T
	U = (T+1)*R - S
	print(0,0,T+1,1,U,R)

Measured memory_bytes: 22512
a, b, k = map(int, input().split())

if (abs(a-b) + 1) / 2 <= k:
  for i in range(a, b+1):
    print(i)
  exit()

for i in range(k):
  print(a+i)

for i in sorted([b - i for i in range(k)]):
  print(i)

Measured memory_bytes: 3060
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
b = sum(B)
for i in range(N):
    m = min(A[i], B[i])
    A[i] -= m
    B[i] -= m
    m = min(A[i + 1], B[i])
    A[i + 1] -= m
    B[i] -= m
print(b - sum(B))


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

int main() {
  int n;
  cin >> n;
  int a[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i]; 
  }
  cout << a[n - 1];
  for (int i = n - 2; i >= 0; i--) {
    cout << " " << a[i];
  }
  cout << endl;
}

Measured memory_bytes: 1160
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;

class Program
{
    static void Main(string[] args)
    {
        var n = int.Parse(Console.ReadLine());

        var array = new int[10001];

        for (var x = 1; x <= 100; x++)
        {
            for(var y = 1; y <= 100; y++)
            {
                for (var z = 1; z <= 100; z++)
                {
                    var calc = x * x + y * y + z * z + x * y + y * z + z * x;
                    if (calc <= 10000)
                    {
                        array[calc]++;
                    }
                }
            }
        }

        for(var i = 1; i<= n; i++)
        {
            Console.WriteLine(array[i]);
        }

        Console.ReadLine();
    }
}



Measured memory_bytes: 17860
#include<stdio.h>

#define MAX 1001000
#define SOSUMAX 500000

int main(){
  int n,i,j;
  int number[MAX];
  int prime[SOSUMAX];
  int primenum=0;
  int ans;

  for(i=1;i<MAX;i++){
    number[i]=i;
  }

  for(i=2;i<MAX;i++){
    if(number[i]!=0){
      prime[primenum]=i;
      primenum++;
    for(j=i+i;j<MAX;j+=i){
      number[j]=0;
    }
  }
  }


  while(scanf("%d",&n)!=EOF){
    ans=0;
    for(i=0;i<n;i++){
      if(prime[i]>n){
        break;
      }
      ans++;
    }
    printf("%d\n",ans);
  }

  return 0;
}

Measured memory_bytes: 6324
#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b;
  cin >> a >> b;
  int c;
  c = a * b;
  c %= 2;
  if (c == 1) {
    cout << "Odd" << endl;
  }
  else {
    cout << "Even"<< endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define dump(x) cout << #x << " : " << x << endl;
using namespace std;

int constexpr N = 100009;
int n, k, seg[N];
char s[N];

bool ok(int x) {
    for(int i = 1, j = x; j <= n; ++i, ++j) {
        int nseg = seg[j] - seg[i] + (s[i] == '0');
        if(nseg <= k)
            return true;
    }
    return false;
}

int main() {
    ios::sync_with_stdio(0); cin.tie(0);
    cin >> n >> k;
    char p = '1';
    for(int i = 1; i <= n; ++i) {
        cin >> s[i];

        seg[i] = seg[i - 1];
        if(p == '1' && s[i] == '0')
            seg[i] += 1;
        p = s[i];
    }

    int l = 0, r = n;
    while(r - l > 1) {
        int mid = l + r >> 1;
        if(ok(mid))
            l = mid;
        else
            r = mid - 1;
    }
    if(ok(r))
        cout << r << endl;
    else
        cout << l << endl;
}

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

int n,total=0;

int main()
{
	string s;
	cin>>n>>s;
	for (int i=0;i<=s.size()-3;i++)
	{
		if (s[i]=='A'&&s[i+1]=='B'&&s[i+2]=='C')  total++;
	}
	cout<<total<<endl;
	return 0; 
}

Measured memory_bytes: 256
i=[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
n=int(input())
print(i[n-1])

Measured memory_bytes: 2940
//#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#define black_tree tree<ll,null_type,less_equal<ll>,rb_tree_tag,tree_order_statistics_node_update>
#define pair_black_tree tree<pair<ll,ll>,null_type,less<pair<ll,ll> >,rb_tree_tag,tree_order_statistics_node_update>
#define gp __gnu_pbds
#define INF 1000000000
#define MOD 1000000007
#define MAX 1000001
#define endl '\n'
#define ll long long
#define ld long double
#define lli long long int
#define ull unsigned long long
#define ulli unsigned long long int
#define pb push_back
#define pf push_front
#define ook order_of_key
#define fbo find_by_order
#define np next_permutation
#define mp make_pair
#define eb emplace_back
#define mae max_element
#define mie min_element
#define lb lower_bound 
#define ub upper_bound
#define bs binary_search
#define ff first
#define ss second
using namespace std;
using namespace gp;
ll n,x,y,f,ans;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin>>n;
    for(int i=1;i<=n;i++){
    	cin>>x>>y;
    	if(x==y){
    		ans++;
		}
		else{
			if(ans>=3){
				f=1;
			}
			ans=0;
		}
	}
	if(f || ans>=3){
		cout<<"Yes";
	}
	else{
		cout<<"No";
	}
}

Measured memory_bytes: 3620
import java.util.*;

/**
 * Created by Santa on 2016/10/16.
 */
public class Main {

    static int N;
    static int A;
    static long B;
    static long C;
    static int[] map = new int[1000000];
    static int min = 9994999;




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

//        int N = scanner.nextInt();

        int A = scanner.nextInt();
        int B = scanner.nextInt();

        if(A < 9 && B < 9){
            System.out.println("Yay!");
        }else{
            System.out.println(":(");
        }

        System.out.println();

    }

}



Measured memory_bytes: 25940
import heapq
N, M = map(int, input().split())
a_list = list(map(int, input().split()))
a_list = sorted(a_list)
sousas = []
for _ in range(M):
    b, c = map(int, input().split())
    sousa = (-c, b)
    heapq.heappush(sousas, sousa)

sum = 0

sousa = list(heapq.heappop(sousas))

for index in range(len(a_list)):
    if sousa[1] == 0:
        if len(sousas) == 0:
            break
        sousa = list(heapq.heappop(sousas))

    if a_list[index] < -sousa[0]:
        a_list[index] = -sousa[0]
        sousa[1] -= 1
    else:
        break

sum = 0
for a in a_list:
    sum += a
print(sum)

Measured memory_bytes: 21120
#include<bits/stdc++.h>
#define MOD 1000000007
#define IO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
using namespace std;

main()
{
	IO;
	int h,w;
	cin>>h>>w;
	
	string s[h];
	
	for(int i=0;i<h;i++)
	cin>>s[i];
	
	long long dp[h+1][w+1];
	memset(dp,0,sizeof(dp));
	dp[1][1]=1;
	
	for(int i=0;i<h;i++)
	{
		for(int j=0;j<w;j++)
		{
			if(s[i][j]=='#')
			dp[i+1][j+1]=0;
			else if(i>0 || j>0)
			{
				dp[i+1][j+1]=(dp[i][j+1]+dp[i+1][j])%MOD;
			}
		}
	}
	
	cout<<dp[h][w];
}

Measured memory_bytes: 9088
import sys

n = int(input())
xs = list(map(int, input().split(' ')))
xs.sort()
x_min = xs[0]
x_max = xs[-1]
min_power = sys.maxsize

for i in range(x_min, x_max + 1):
    power = sum([(x - i) ** 2 for x in xs])
    min_power = min(min_power, power)

print(min_power)


Measured memory_bytes: 9160
package main

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

var sc = bufio.NewScanner(os.Stdin)

func main() {
	scanInit()

	n := nextInt()
	k := nextInt()
	xlist := make([]int, n)

	for i := 0; i < n; i++ {
		xlist[i] = nextInt()
	}

	run := 0
	for i := 0; i < n; i++ {
		x := xlist[i]

		// 近い線判定
		if x <= k/2 {
			run += 2 * x
		} else {
			run += 2 * (k - x)
		}
	}

	fmt.Println(run)

}

// ---- readfunc
func scanInit() {
	const cap = 64 * 1024
	var buf = make([]byte, cap)
	sc.Buffer(buf, cap)
	sc.Split(bufio.ScanWords)
	return
}
func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}
func nextStr() string {
	sc.Scan()
	return sc.Text()
}


Measured memory_bytes: 1780
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<char> vchar;
typedef vector<vector<char>> vvchar;
typedef vector<int> vint;
typedef vector<vector<int>> vvint;
typedef vector<long long> vll;
typedef vector<vector<long long>> vvll;
typedef priority_queue<long long> prque;
#define ain(i,n,a) for(long long i=0;i<(long long)(n);i++){cin>>a[i];}
#define aout(i,n,a) for(long long i=0;i<(long long)(n);i++){if(i){cout<<" ";}cout<<a[i];if(i==n-1){cout<<endl;}}
#define rep(i,n) for(long long i=0;i<(long long)(n);i++)
#define vsort(v) sort((v).begin(),(v).end())
#define vrsort(v) sort((v).rbegin(),(v).rend())
#define vreverse(v) reverse((v).begin(),(v).end())
#define pf(a) push_front(a)
#define pb(a) push_back(a)
#define INF 1998021900
#define MOD 1000000007
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  //input
  ll n,i,j;cin>>n;vll a(n+1);
  for(i=1;i<n+1;i++){cin>>a[i];}
  //caricurate
  vll b(n+1,0),v(0);
  for(i=n;i>0;i--){
    ll q=0;
    for(j=i;j<n+1;j+=i){
     q^=b[j];
    }
    if(q!=a[i])b[i]=1;
    if(b[i]){v.pb(i);}
  }
  ll s=0;
  for(i=1;i<n+1;i++){if(b[i]){s++;}}
  cout<<s<<endl;
  aout(i,v.size(),v);
  cout<<endl;
}


Measured memory_bytes: 5108
fun main(args: Array<String>) {
    val (n, m) = readLine()!!.split(' ').map(String::toLong)
    val data = mutableListOf<Triple<Long, Long, Long>>()
    (1..m).forEach {
        val (p, y) = readLine()!!.split(' ').map(String::toLong)
        data.add(Triple(it, p, y))
    }
    data.sortBy { it.third }
    data.sortBy { it.second }
    val result = mutableMapOf<Long, String>()
    var countP = 1
    var currentP = data[0].second
    result[data[0].first] = data[0].second.toString().padStart(6, '0') + countP.toString().padStart(6, '0')
    for (i in 1 until m.toInt()) {
        if (currentP != data[i].second) {
            currentP = data[i].second
            countP = 1
        } else {
            countP++
        }
        result[data[i].first] = data[i].second.toString().padStart(6, '0') + countP.toString().padStart(6, '0')
    }
    (1..m).forEach { println(result[it]) }
}


Measured memory_bytes: 132744
#include <algorithm>
#include <iostream> //入出力
#include <stdio.h>
#include <map>
#include <set>
#include <string>
#include <math.h> //算術演算子
#include <vector>
#include <cstdlib>
#include <queue>
#include <stack>
#include <list>
#include <iomanip> //小数点以下を表示させる(setprecision())
//#include <bits/stdc++.h>
using namespace std;
typedef long long ll; //64bit型

#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(a) (a).begin(), (a).end()
#define debug(x) cerr << x << " " \
                      << "(L:" << __LINE__ << ")" << '\n'
#define PRINT(V)                                   \
        {                                          \
                for (int i = 0; i < V.size(); i++) \
                {                                  \
                        cout << V[i] << " ";       \
                }                                  \
                cout << endl;                      \
        }

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

int main()
{
        //input->compute->output//

        string N, M;
        cin >> N;

        int cnt = 0;
        for (int i = 2; i < N.size() - 1; i++)
        {
                if (N[i] == 'C')
                {
                        cnt++;
                }
        }

        int num = 0;
        for (int i = 1; i < N.size(); i++)
        {
                if ('a' <= N[i] && N[i] <= 'z')
                {
                        num++;
                }
        }

        if (cnt != 1 || N[0] != 'A' || num != N.size() - 2)
        {
                cout << "WA" << endl;
                return 0;
        }
        cout << "AC" << endl;
        return 0;
}


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

struct dice{
  int pips[6];
  int p(int p){
    return p - 1;
  }
  int tmp;
  void copyPip(int before, int after){
    pips[p(after)] = pips[p(before)];
  }
  int pipOf(int i){
    return pips[p(i)];
  }
  void roll(char cmd){
    if(cmd == 'N'){
      tmp = pips[p(1)];
      copyPip(2, 1);
      copyPip(6, 2);
      copyPip(5, 6);
      pips[p(5)] = tmp;
    }else if(cmd == 'E'){
      tmp = pips[p(1)];
      copyPip(4, 1);
      copyPip(6, 4);
      copyPip(3, 6);
      pips[p(3)] = tmp;
    }else if(cmd == 'W'){
      tmp = pips[p(1)];
      copyPip(3, 1);
      copyPip(6, 3);
      copyPip(4, 6);
      pips[p(4)] = tmp;
    }else{  //cmd == 'S'
      tmp = pips[p(1)];
      copyPip(5, 1);
      copyPip(6, 5);
      copyPip(2, 6);
      pips[p(2)] = tmp;
    }
  }
};

int main(void){
  dice d;
  string cmd;
  for(int i = 0; i < 6; i++){
    cin >> d.pips[i];
  }
  cin >> cmd;
  for(int i = 0; i < cmd.size(); i++){
    d.roll(cmd[i]);
  }
  cout << d.pipOf(1) << endl;
  return 0;
}



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

int main() {
    int N;
    cin>>N;
    int X[N];
    for(int i=0;i<N;++i){
        cin>>X[i];
    }
    int ans = 0;
    int ans2, ans3;
    for(int i=0;i<N;++i){
        ans += X[i];
    }
    if(ans%N==0){
        ans2 = ans/N;
        ans3 = ans/N;
    }
    else {
        ans2 = ans/N;
        ans3 = ans/N+1;
    }
    int ans1 = 0;
    int ans4 = 0;
    for(int i=0;i<N;++i){
        ans1 += (X[i] - ans2) * (X[i] - ans2);
    }
    for(int i=0;i<N;++i){
        ans4 += (X[i] - ans3) * (X[i] - ans3);
    }
    if(ans1<ans4){
        cout<<ans1<<endl;
    }
    else {
        cout<<ans4<<endl;
    }
}


Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**6)

n = int(input())
a = [0]
a += list(map(int, input().split()))

b = [0]*(n+1)

for i in range(n,0,-1):
    sum = 0
    for j in range(2*i, n+1, i):
        sum ^= b[j]
    b[i] = sum^a[i]
    
ans = []
for i in range(1,n+1):
    if b[i]: ans.append(i)

print(len(ans))
print(*ans)

Measured memory_bytes: 14124
#include <iostream>
#include <vector>
#include <string>
#include <utility>
#include <queue>
#include <algorithm>
#include <map>
#include <cmath>
using namespace std;

#define ll long long
#define pb push_back

int main() {
	
	ll K,T,sum=0;
	vector<int> A;

	cin>>K>>T;
	for(int i=0;i<T;i++){
		int a;
		cin>>a;
		A.pb(a);
		sum+=a;
	}
	sort(A.begin(),A.end());
	sum-=A[A.size()-1];
	cout<<((sum<A[A.size()-1]-1)?A[A.size()-1]-1-sum:0)<<endl;
	
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n)for(int i=0;i<(n);i++)
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
using ll = long long;
using P = pair<int, int>;
using Graph = vector<vector<int>>;


int main(){
    int n, q; cin >> n >> q;
    vector<ll> a(n);
    rep(i,n) cin >> a[i];
    rep(i,q){
        ll x; cin >> x;
        ll ans = 0;
        int right = 0;
        ll sum = 0;
        for(int left = 0; left < n; ++left){
            while(right < n && sum + a[right] <= x){
                sum += a[right];
                right++;
            }
            ans += right - left;
            if(right == left) right++;
            else sum -= a[left];
        }
        cout << ans << endl;
    }
    return 0;
}


Measured memory_bytes: 3552
#![allow(unused_imports)]
use itertools::Itertools;
use num::integer::gcd;
use proconio::{input, marker::*};
use std::cmp::*;
use std::collections::*;
use superslice::*;

fn main() {
    input! {
        k: u32,
    }

    let mut ans = 0;

    for a in 1..=k {
        for b in 1..=k {
            for c in 1..=k {
                ans += gcd(gcd(a, b), c);
            }
        }
    }

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


Measured memory_bytes: 2152
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.HashMap;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.TreeSet;
import java.util.StringTokenizer;
import java.util.Map;
import java.util.Map.Entry;
import java.io.BufferedReader;
import java.io.InputStream;

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

    static class CPoll {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            HashMap<String, Integer> map = new HashMap<String, Integer>();
            int max = 0;
            for (int i = 0; i < n; i++) {
                String s = in.next();
                map.put(s, map.getOrDefault(s, 0) + 1);
                max = Math.max(max, map.get(s));
            }
            TreeSet<String> h = new TreeSet<String>();
            for (Map.Entry<String, Integer> e : map.entrySet()) {
                if (e.getValue() == max) {
                    h.add(e.getKey());
                }
            }
            while (!h.isEmpty()) {
                out.println(h.pollFirst());
            }

        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

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

    }
}



Measured memory_bytes: 64372
N, M = map(int, input().split())
AB = [[] for _ in range(10**5+1)]
for _ in range(N):
    a, b = map(int, input().split())
    AB[a].append(b)

import heapq
h = []
heapq.heapify(h)

ans = 0
for a in range(1,M+1):
    for b in AB[a]:
        heapq.heappush(h, -b)
    heapq.heappush(h, 0)
    ans -= heapq.heappop(h)
    
print(ans)

Measured memory_bytes: 91884
#include <bits/stdc++.h>
using namespace std;
typedef pair <int, int> pii;
typedef long long int LL;
const int MAXN = 100005;

int n, m, val[MAXN], f[MAXN], tmp[MAXN], tot, cnt;
pii minv[MAXN]; bool removed[MAXN];

int find(int x){return f[x] ? f[x] = find(f[x]) : x;}
void merge(int u, int v){
	u = find(u), v = find(v);
	f[v] = u, minv[u] = min(minv[v], minv[u]);
}
int main(){
	int i, u, v; LL sum = 0LL;
	scanf("%d%d", &n, &m);
	for(i = 1; i <= n; ++ i){
		scanf("%d", &val[i]);
		minv[i] = pii(val[i], i);
	}
	for(i = 1; i <= m; ++ i){
		scanf("%d%d", &u, &v);
		merge(u + 1, v + 1);
	}
	tot = (n - m - 1) * 2;
	if(n < tot){
		printf("Impossible\n");
		return 0;
	}
	if(tot == 0){
		printf("0\n");
		return 0;
	}
	for(i = 1; i <= n; ++ i)
		if(find(i) == i){
			sum += minv[i].first;
			removed[minv[i].second] = true;
			-- tot;
		}
	for(i = 1; i <= n; ++ i)
		if(!removed[i])
			tmp[++ cnt] = val[i];
	sort(tmp + 1, tmp + 1 + cnt);
	for(i = 1; i <= tot; ++ i)
		sum += tmp[i];
	cout << sum << endl;
	return 0;
}

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

	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
        
        while(true){
        	int H=sc.nextInt();
        	int W=sc.nextInt();
            if(H==0&&W==0)
                break;
        
        	for(int i=0;i<H;i++){
        		for(int j=0;j<W;j++){
                    System.out.print("#");
            	}
           	 System.out.println();
            }
            System.out.println();
        }
	}
}



Measured memory_bytes: 35672
S = input()
C = ["0","1"] 
count1=count2=0

for i in range(len(S)):
  # case 1
  if S[i] == C[i%2]:
    count1+=1
  # case 2
  if S[i] == C[(i+1)%2]:
    count2+=1

print(min([count1, count2]))


Measured memory_bytes: 3188
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		String s = in.next();

		int len = 1;
		int lenMax = 0;
		// st:調べる文字列の先頭
		for ( int st = 0; st + len - 1 < n; st++ ) {
			// 切り出す
			String temp = s.substring(st, st + len);
			// 自分以降に2個目がある限りlenを増やす
			while ( s.indexOf(temp, st + len) > st ) {
				len++;
				temp = s.substring(st, st + len);
			}
			// Maxを記憶（lenは行き過ぎてるので -1）
			lenMax = Math.max(lenMax, len - 1);
		}
		
		System.out.println(lenMax);
		in.close();
	}
}

Measured memory_bytes: 40528
#include <bits/stdc++.h>
using namespace std;
int main(){
int a,b,c;
cin>>a>>b>>c;
int zb=0;
int za=0;
for(int i=1;i<=b;i++){
if(c%i==0){
zb++;
}
}
for(int i=1;i<a;i++){
if(c%i==0){
za++;
}
}
cout<<zb-za<<endl;
}


Measured memory_bytes: 3100
X,Y = [int(i) for i in input().split()]
M = max(X,Y)
m = min(X,Y)
X = M
Y = m
p = 10 ** 9 + 7
fact = [1, 1]
factinv = [1, 1]
inv = [0, 1]
def cmb(n, r, mod):
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    return fact[n] * factinv[r] * factinv[n-r] % p
if (X+Y) % 3 != 0:
    print(0)
    exit()
else :
    N = (X+Y)//3
    for i in range(2, N + 1):
        fact.append((fact[-1] * i) % p)
        inv.append((-inv[p % i] * (p // i)) % p)
        factinv.append((factinv[-1] * inv[-1]) % p)
    d = X - N
    print(cmb(N,d,p))
    exit()

Measured memory_bytes: 118892
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define rep1(i,n) for(int i=1;i<=(int)n;i++)
#define sp(n) cout << fixed << setprecision(n)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
typedef long long ll;
using namespace std;
int main(void){
    string s;cin>>s;
    ll res=0;
    vector<ll> a(s.size()+1,0);
    rep(i,s.size()){
        if(s[i]=='<') chmax(a[i+1],a[i]+1);
    }
    reverse(s.begin(),s.end());
    reverse(a.begin(),a.end());
    rep(i,s.size()){
        if(s[i]=='>') chmax(a[i+1],a[i]+1);
    }
    rep(i,s.size()+1){
        res+=a[i];
    }
    cout<<res<<endl;
}

Measured memory_bytes: 4740
S = input()
num = len(S) - 1
sum = 0

for i in range(2**num):
  op = [''] * (num+1)
  formula = ''
  for j in range(num):
    if ((i >> j) & 1):
      op[j] = '+'
  for a,b in zip(S,op):
    formula += a + b
  sum += eval(formula)

print(sum)

Measured memory_bytes: 3064
n=int(input())
a=list(map(int,input().split()))


import math

ans = a[0]
for i in range(1, n):
    ans = ans * a[i] // math.gcd(ans, a[i])



s = 0

for i in range(n):
    s += (ans-1)%a[i]

print(s)

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

int main(){
  int s,k=0;
  cin >> s;
  vector<int> t(10000000);
  t.at(0) = s;
  for(int i=1;i<10000000;i++){
    if(t.at(i-1)%2 == 0) t.at(i) = t.at(i-1)/2;
    else t.at(i) = 3*t.at(i-1) +1;
    
    for(int j=0;j<i;j++){
      if(t.at(j) == t.at(i)){
        k = -1;
        break;
      }
    }
    if(k == -1){
      cout << i+1 << endl;
      break;
    }
  }
  
  return 0;
}


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

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

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

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

    for(int i=0;i<n;i++){
        cout << cnt[i] << "\n";
    }
}

Measured memory_bytes: 5164
N=int(input())
F=[list(map(int, input().split())) for i in range(N)]
P=[list(map(int, input().split())) for i in range(N)]

def naiseki(a, b):
  na=len(a)
  nb=len(b)
  if na==nb:
    return sum([a[i]*b[i] for i in range(na)])
  else:
    return None

cand=[]
for i in range(1, 2**10):
  temp=list(map(int, list(format(i, '010b'))))
  rieki=0
  for j in range(N):
    c=naiseki(temp, F[j])
    rieki+=P[j][c]
  cand.append(rieki)
  
print(max(cand))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define GET_ARRAY_SIZE(a)   (sizeof(a)/sizeof(a[0]))
#define LL long long
int main(){
    LL r,r_num,r_1,ans;
    r_1 = 1;
    cin >> r;
    r_num = r * r;
    ans = r_num / r_1;
    cout << ans << endl;

    return 0;
}

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

namespace AtCoder
{
    class Program
    {
        static void Main()
        {
            var s = Console.ReadLine();
            for (char c = 'a'; c <= 'z'; c++)
            {
                if (!s.Contains(c))
                {
                    Console.WriteLine(c);
                    break;
                }
                if (c == 'z') Console.WriteLine("None");
            }
        }
    }
}

Measured memory_bytes: 11488
//        VIVEK UPADHYAY
//        MANIT, BHOPAL(M.P)


//                         JAB-TAK TODEGA NHI,
//                         TAB -TAK CHODEGA NHI :D
#include<iostream>
#include<algorithm>
#include<vector>
#include<list>
#include<cstdlib>
#include<unistd.h>
#include<string>
#include<cstring>
#include<stack>
#include<queue>
#include<utility>
#include<cmath>
#include<set>
#include<unordered_map>
#include<cstdio>
#include<map>
#include<numeric>
using namespace std;
#define F first
#define S second
#define mk(x,y) make_pair(x,y)
#define pb(x) push_back(x)
#define LINE cout<<endl
#define ok cout<<"ok\n" ;
typedef long long ll;
const int MAXN = 1e5 + 10 ;
const int MAX = 1e7 ;
double pi = 3.1415926535897932384626433832795;
const ll inf=1e18+ 10 ;

int main() {
    
    int N ;
    cin >> N ;
    for(int i=0;i<=N;i++) if((N-4*i)%7==0 && N>=4*i){
        cout<<"Yes\n" ;
        return 0;
    }
    cout<<"No\n";
    return 0 ;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>
#include <cmath>
using namespace std;

// 点クラス
struct P{
	int x, y;
	P(int x_, int y_){
		x = x_;
		y = y_;
	}
};
bool operator<(const P& a, const P& b){
	if( a.x < b.x ) return true;
	else if( a.x > b.x ) return false;
	return a.y < b.y;
}

// s[y][x] := 座標圧縮後の(x,y)にある点の個数
int s[5001][5001] = {0};
// f[y][x] := (x,y) - (w,h) の領域の総和
int f[5001][5001] = {0};

// [x1,x2] && [y1,y2] の領域の総和を計算する.
int sum(int x1, int y1, int x2, int y2){
	return f[y1][x1] - f[y1][x2+1] - f[y2+1][x1] + f[y2+1][x2+1];
}

int main(){
	// memo[P(x,y)] := (x,y) の個数
	map<P,int> memo;
	// vp[i] := i 番目の位置座標(x_i, y_i)
	vector<P> vp;
	// vx, vy 座標圧縮用にx座標とy座標の保持
	vector<int> vx, vy;
	int n, m;
	
	cin >> n >> m;
	for(int i=0 ; i < n ; i++ ){
		int x,y;
		cin >> x >> y;
		// 同じ位置座標のものはまとめる.
		if( memo.count(P(x,y)) ){
			memo[P(x,y)]++;
		}else{
			memo[P(x,y)] = 1;
			vp.push_back( P(x,y) );
			vx.push_back( x );
			vy.push_back( y );
		}
	}
	
	// ソートして重複する座標は取り除いておく
	sort( vx.begin() , vx.end() );
	sort( vy.begin() , vy.end() );
	vx.erase( unique( vx.begin() , vx.end()) , vx.end() );
	vy.erase( unique( vy.begin() , vy.end()) , vy.end() );
	// ax[i] := i 番目に小さな x 座標の値
	// ay[i] := i 番目に小さな y 座標の値
	// bx[i] := ax[i]-1, by[i] := ay[i]-1
	vector<int> ax, ay, bx, by;
	// cx[x] := x について座標圧縮後の数値
	// cy[y] := y について座標圧縮後の数値
	map<int,int> cx, cy;
	for(int i=0 ; i < vx.size() ; i++ ){
		ax.push_back( vx[i] );
		bx.push_back( vx[i]-1 );
		cx[vx[i]] = i;
	}
	for(int i=0 ; i < vy.size() ; i++ ){
		ay.push_back( vy[i] );
		by.push_back( vy[i]-1 );
		cy[vy[i]] = i;
	}
	
	// s[y][x] := 座標圧縮後の(x,y)にある点の個数
	for(int i=0 ; i < vp.size() ; i++ ){
		// x, y は座標圧縮後の座標
		int x = cx[ vp[i].x ];
		int y = cy[ vp[i].y ];
		
		s[y][x] = memo[P(vp[i].x,vp[i].y)];
	}
	// 累積和で領域(x1,y1)-(x2,y2)が指定されたらO(1)で値を返すように前計算
	for(int y = 0 ; y < ay.size() ; y++ ){
		for(int x = 0 ; x < ax.size() ; x++ ){
			f[y][x] = s[y][x];
		}
	}
	for(int y = 0 ; y < ay.size() ; y++ ){
		for(int x = ax.size()-1 ; x >= 0 ; x-- ){
			f[y][x] += f[y][x+1];
		}
	}
	for(int y = ay.size()-1 ; y >= 0 ; y-- ){
		for(int x = 0 ; x < ax.size() ; x++ ){
			f[y][x] += f[y+1][x];
		}
	}
	
	/*for(int y = 0 ; y < ay.size() ; y++ ){
		for(int x = 0 ; x < ax.size() ; x++ ){
			cout << s[y][x];
		}
		cout << endl;
	}
	cout << endl;*/
	
	// 領域の入力
	for(int i=0 ; i < m ; i++ ){
		int x1, y1, x2, y2;
		cin >> x1 >> y1 >> x2 >> y2;
		// 二分探索で座標圧縮後の(x1,y1) - (x2,y2) を求める
		// O(log n)
		x1 = lower_bound( ax.begin(), ax.end(), x1 ) - ax.begin();
		x2 = lower_bound( bx.begin(), bx.end(), x2 ) - bx.begin() - 1;
		y1 = lower_bound( ay.begin(), ay.end(), y1 ) - ay.begin();
		y2 = lower_bound( by.begin(), by.end(), y2 ) - by.begin() - 1;
		
		// cout << "(" << x1 << "," << y1 << ") - (" << x2 << "," << y2 << ")" << endl;
		// 累積和を計算しておいたのでO(1)で領域の総和が計算できる.
		int ans = 0;
		if( x1 <= x2 && y1 <= y2 ){
			ans = sum(x1, y1, x2, y2);
		}
		cout << ans << endl;
	}
}

Measured memory_bytes: 196840
n=int(input())

l=list(map(int, input().split()))
l=sorted(l)
s=0
for i in range(n-2):
  for j in range(i+1,n-1):
    for k in range(j+1,n):
      if l[j]+l[i]>l[k] and l[i]!=l[j] and l[j]!=l[k]:
        s+=1
print(s)

Measured memory_bytes: 9192
//#include <bits/stdc++.h>
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <stdio.h>
#include <queue>
#include <deque>
#include <set>
#include <stack>
#include <time.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;

#define fi first
#define se second
#define mp make_pair
 
const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll MOD3 = 1812447359;
const ll INF = 1ll << 62;
const double PI = 2 * asin(1);

void yes() {printf("yes\n");}
void no() {printf("no\n");}
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}

int N, S, A[3005];
ll DP[3005][3005];

int main(){
  scanf("%d%d", &N, &S);
  for (int i = 1; i <= N; i++) scanf("%d", A + i);

  DP[0][0] = 1;
  for (int i = 1; i <= N; i++){
    for (int j = 0; j <= S; j++){
      DP[i][j] = DP[i - 1][j] * 2;
      DP[i][j] %= MOD2;
    }
    for (int j = 0; j + A[i] <= S; j++){
      DP[i][j + A[i]] += DP[i - 1][j];
      DP[i][j + A[i]] %= MOD2;
    }
  }
  printf("%lld\n", DP[N][S]);

  return 0;
}


Measured memory_bytes: 74240
i = list(map(int, input().split()))
n = i[0]
k = i[1]
a_set = set()
for i in range(k):
    d = int(input())
    a_list = list(map(int, input().split()))
    a_set |= set(a_list)
    
print(n-len(list(a_set)))

Measured memory_bytes: 9212
package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scan(&n)

	countMax := 0
	answer := 1
	for i := 1; i <= n; i++ {
		x := i
		count := 0
		for x%2 == 0 {
			x /= 2
			count++
		}
		if count > countMax {
			countMax = count
			answer = i
		}
	}
	fmt.Println(answer)
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n;
  cin>>n;
  long long int ar[n];
  for(int i=0;i<n;i++)
     cin>>ar[i];
  sort(ar,ar+n);
  int flag=1;
  for(int i=1;i<n;i++)
  {
     if(ar[i]==ar[i-1])
     {
       flag=0;
       break;
     }
  }
  if(flag)
    cout<<"YES";
  else
    cout<<"NO";
  return 0;
}

Measured memory_bytes: 1920
N = int(input())
a = []
for _ in range(N):
    a.append(list(input().split()))
yen = 0
coin = 0.0
for i in range(N):
    if a[i][1] == 'JPY':
        yen += int(a[i][0])
    else:
        coin += float(a[i][0])
print(yen+coin*380000.0)


Measured memory_bytes: 38256
#include <cstdio>
#include <algorithm>
#define N 200006
#define mo 1000000007
using namespace std;
int n,ans,a[N],b[N],c[4006][4006],d[2006][2006],fac[8006],inv[8006];
int ksm(int x,int y)
{
	if(y==0)return 1;if(y==1)return x;int p=ksm(x,y>>1);
	if(y&1)return 1LL*p*p%mo*x%mo;return 1LL*p*p%mo;
}
int C(int a,int b)
{
	return 1LL*fac[a]*inv[b]%mo*inv[a-b]%mo;
}
int main()
{
	scanf("%d",&n);fac[0]=inv[0]=1;
	for(int i=1;i<=8000;i++)fac[i]=1LL*fac[i-1]*i%mo;
	inv[8000]=ksm(fac[8000],mo-2);
	for(int i=7999;i>=1;i--)inv[i]=1LL*inv[i+1]*(i+1)%mo;
	for(int i=1;i<=n;i++){
		scanf("%d%d",&a[i],&b[i]);
		c[2001+a[i]][2001+b[i]]++;
		c[2001-a[i]][2001-b[i]]++;
		d[a[i]][b[i]]++;
	}
	for(int i=1;i<=4001;i++)
		for(int j=1;j<=4001;j++)c[i][j]=(c[i][j]+c[i-1][j]+c[i][j-1])%mo;
	for(int i=1;i<=2000;i++)
		for(int j=1;j<=2000;j++)d[i][j]=(d[i][j]+d[i-1][j]+d[i][j-1])%mo;
	for(int i=1;i<=n;i++){
		int tmp=(c[2001+a[i]][2001+b[i]]-d[a[i]][b[i]]+mo)%mo;
		tmp=(tmp-C(2*a[i]+2*b[i],2*a[i])+mo)%mo;ans=(ans+tmp)%mo;
	}
	printf("%lld\n",1LL*ans*ksm(2,mo-2)%mo);
}

Measured memory_bytes: 80128