akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
int main(){
  int h,w,n;cin>>h>>w>>n;
  vector<int> v[h+1];
  for(int i=0;i<n;i++){
    int x,y;cin>>x>>y;
    v[x].push_back(y);
  }
  if(h==1){
    cout<<1<<endl;
    return 0;
  }
  for(int i=1;i<=h;i++)sort(v[i].begin(),v[i].end());
  int now=1;
  //int u=lower_bound(v[2].begin(),v[2].end(),1)-v[2].begin();
 // cout<<u;return 0;
  if(v[2].size()!=0&&v[2][0]==1){
    cout<<1<<endl;
    return 0;
  }
  for(int i=2;i<=h;i++){
    //cout<<i<<endl;
    if(i==h){
      cout<<h<<endl;
      return 0;
    }
    if(v[i].size()==0){
      now++;
    }
    else if(v[i][0]!=now+1){
      now++;
    }
    if(v[i+1].size()==0){
      continue;
    }
    //cout<<now<<c<<endl;
    if(v[i+1][0]<=now){
      cout<<i<<endl;
      return 0;
    }
  }
}

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

const int MAX_N = 1000;
map<string, int> h;
map<int,string> h_inv;
vector<int> G[MAX_N];
bool used[MAX_N];
int n, ans, id;

void init(){
	h.clear();
	h_inv.clear();
	for(int i = 0; i < MAX_N; i++){
		G[i].clear();
	}
	fill(used, used + MAX_N, false);
	
	ans = 0;
	id = 0;
}

void split(const string& s, string& start, int k){
	string str;
	int from, pos, to;
	
	for(int i = 0; i < s.size(); i++){
		if(s[i] == ':'){
			pos = i;
			break;
		}
		str.push_back(s[i]);
	}
	
	if(k == 0) start = str;
	if(h.count(str)){
		from = h[str];
	}
	else{
		h_inv[id] = str;
		h[str] = id++;
		from = h[str];
	}
	
	str.clear();
	
	for(int i = pos + 1; i < s.size(); i++){
		if(s[i] == '.' || s[i] == ','){
			if(h.count(str)){
				to = h[str];
				str.clear();
				G[from].push_back(to);
			}else{
				h_inv[id] = str;
				h[str] = id++;
				to = h[str];
				str.clear();
				G[from].push_back( to );			
			}
		}
		else{
			str.push_back(s[i]);
		}
	}
}


void solve(int v){
	if(used[v]) return;
	
	used[v] = true;
	
	if(G[v].size() == 0){
		//cout << h_inv[v] << endl;
		ans++;
	}
	else{
		for(int i = 0; i < G[v].size(); i++){
			solve( G[v][i] );
		}
	}
}

int main(){
	while(cin >> n, n){
		init();
		
		string start;
		for(int i = 0; i < n; i++){
			string s;
			cin >> s;
			split(s, start, i);
		}
		
		solve(h[start]);
		cout << ans << endl;
	}
}

Measured memory_bytes: 1464
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int K,A,B;
  cin >> K >> A >> B;
  int X=A;
  bool a=false;
  for(int i=0;i<B-X+1;i++){
    if(A%K==0){
      a=true;
      break;
    }
    A++;
  }
  if(a){
    cout << "OK" << endl;
  }
  else{
    cout << "NG" << endl;
  }
}


Measured memory_bytes: 3632
#include<bits/stdc++.h>
#define REP(i,n) for (int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
int main() {
    int a, b, c;
    cin >> a >> b >> c;
    if (a+b == c || a+c == b || b+c == a){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}

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

int main()
{
  string s;
  cin >> s;
  if (s == "SUN")
    cout << "7\n";
   else if (s == "MON") 
    cout << "6\n";
   else if (s == "TUE") 
    cout << "5\n";
   else if (s == "WED") 
    cout << "4\n";
   else if (s == "THU") 
    cout << "3\n";
   else if (s == "FRI") 
    cout << "2\n";
   else if (s == "SAT") 
    cout << "1\n";
}


Measured memory_bytes: 256
#include <cstdio>

void insert(int *heap, int n, int k){
    heap[n] = k;
    int i = n;
    int tmp;
    while(i>1){
        if(heap[i]<heap[i/2]){
            break;
        }
        tmp = heap[i];
        heap[i] = heap[i/2];
        heap[i/2] = tmp;
        i = i/2;
    }
    return;
}

void extract(int *heap, int n){
    heap[1] = heap[n+1];
    int i, l, r, largest, tmp;
    i = 1;
    largest = 1;
    while(i<=n/2){
        l = 2*i;
        if(l<=n && heap[i]<heap[l])largest = l;
        r = 2*i + 1;
        if(r<=n && heap[largest]<heap[r])largest = r;
        if(i==largest)break;
        tmp = heap[i];
        heap[i] = heap[largest];
        heap[largest] = tmp;
        i = largest;
    }
    return;
}

int main(){
    char s[8];
    int k;
    int n = 0;
    int heap[2000000];
    while(true){
        scanf("%s",s);
        switch(s[2]){
        case 's'://insert
            n++;
            scanf("%d",&k);
            insert(heap,n,k);
            break;
        case 't'://extract
            n--;
            printf("%d\n",heap[1]);
            extract(heap,n);
            break;
        case 'd'://end
            return 0;
            break;
        default:
            perror("error\n");
            return 1;
            break;
        }
    }
    return 0;
}



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


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

Measured memory_bytes: 256
//
//  main.cpp
//  Study
//
//  Created by 佐々木勇星 on 2020/03/12.
//  Copyright © 2020 佐々木勇星. All rights reserved.
//

#include <iostream>
#include <vector>
#include <cmath>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <map>

using namespace std;


int main(int argc, const char * argv[]) {

    int a, b;
    
    cin >> a >> b;
    
    if (a >= 10 || b >= 10)
    {
        cout << -1 << endl;
        return 0;
    } else {
        cout << a * b << endl;
    }
    
    return 0;
}


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

int main()
{
	string s;
	cin>>s;
	vector<int> v(26, 0);
	for(char ch: s) {
		v[ch-'a']++;
	}
	for(int x: v) {
		if(x%2 == 1) {cout<<"No"; return 0;}
	}
	cout<<"Yes";
}


Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
int main() {
  int target, n;
  cin >> target >> n;
  
  if(n == 0) {
    cout << target << endl;
    return 0;
  }
  
  vector<int> ex(n);
  
  for(int i=0;i<n;i++) {
    cin >> ex.at(i);
  }
  
  vector<int> dx(202);
  
  for(int i=0;i<n;i++) {
    dx.at(ex.at(i)) = 1;
  }
  
  for(int i=0;i<101;i++) {
    if(dx.at(target - i) == 0) {
      cout << target - i << endl;
      break;
    }
    if(dx.at(target + i) == 0) {
      cout << target + i << endl;
      break;
    }
  }
  return 0;
}
  

Measured memory_bytes: 3536
import java.util.Scanner;
import java.io.*;

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

        String str;
        str = scan.nextLine();
        char[] charA;
        charA = str.toCharArray();   //char????????????
        
        
        for (int count = 0; count < charA.length; count++){
        	if( Character.isUpperCase(charA[count])){
        		charA[count] = Character.toLowerCase(charA[count]);
        	}
        	else if(Character.isLowerCase(charA[count])){
        		charA[count] = Character.toUpperCase(charA[count]);
            }
        }
        System.out.println(charA);
    }
}     

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

namespace ABC042_B
{
    class Program
    {
        static void Main(string[] args)
        {
            var a = scan();
            string[] z = new string[a[0]];
            for (int i = 0; i <a[0]; i++)
            {
                z[i] = Console.ReadLine();
            }
            Array.Sort(z);
            for (int i = 0; i < a[0]; i++)
            {
                Console.Write(z[i]);
            }
            Console.WriteLine();
        }
        public static string[] getsplit()
        {
            string[] x = Console.ReadLine().Split(' ');
            return x;
        }
        public static int getint()
        {
            int x = int.Parse(Console.ReadLine());
            return x;
        }
        static int[] scan()
        {
            return Array.ConvertAll
                (Console.ReadLine().Split(' '), int.Parse);
        }
    }
}


Measured memory_bytes: 3160
#include <bits/stdc++.h> 
using namespace std;
typedef long long ll;
//typedef pair<int,int> P;
//priority_queue<int> pque;
//priority_queue<int, vector<int>, greater<int>> pque;
ll INFL = 1000000000000000010;//10^18 = 2^60
int INF = 2000000000;//10^9
ll MOD  = 1000000007;


int main(void){
    int N,K;
    cin >> N >> K;
    vector<int> a(N);
    for(int i = 0; i < N; i++){
        cin >> a.at(i);
    }
    int m = a.at(0);
    
    bool Win[K+1];
    for(int i = 0; i < m; i++){
        Win[i] = false;
    }
    for(int i = m; i <= K; i++){
        Win[i] = false;
        for(int j = 0; j < N; j++){
            if(i-a.at(j) >= 0 && Win[i-a.at(j)] == false){
                Win[i] = true;
            }
        }
    }
    if(Win[K]){
        cout << "First" << endl;
    }else{
        cout << "Second" << endl;
    }
    
    
    
}


Measured memory_bytes: 384
import java.util.Scanner;
import java.util.ArrayList;
import java.util.Collections;

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

    while (in.hasNext()) {
      int N = in.nextInt();
      int X = in.nextInt();
      ArrayList<Integer> x = new ArrayList<Integer>();

      while ( N-- > 0) {
        x.add(in.nextInt());
      }
      
      Collections.sort(x);
      int insPoint = Collections.binarySearch(x, X);

      if (insPoint < 0) {
        insPoint = -(insPoint + 1);
        x.add(insPoint, X);
      }
      
      int gcdX = x.get(1) - x.get(0);
      for (int i = 2; i < x.size(); ++i) {
        gcdX = gcd(gcdX, x.get(i) - x.get(i - 1));
      }

      System.out.println(gcdX);
    }
  }

  private static int gcd (int a, int b) {
    return a % b == 0 ? b : gcd(b, a % b);
  }
}

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

#define REP(i, n) for(int (i) = 0; (i) < (n); ++(i))
#define REPR(i, n) for(int (i) = (n); (i) >= 0; --(i))
#define FOR(i, n, m) for(int (i) = (n); (i) < (m); ++(i))

constexpr int INF = 1e9;
//constexpr ll INF = 1LL<<61;
constexpr ll mod = 1e9+7;


int main(){
  int N;
  cin >> N;
  vector<int> A(N);
  REP(i, N){
    cin >> A[i];
  }
  ll ans = 0;
  int sum = 0, right = 0;
  REP(left, N){
    while(right < N && ((sum ^ A[right]) == sum+A[right])){
      sum += A[right];
      right++;
    }
    ans += (right - left);
    if(right == left) ++ right;
    else sum -= A[left];
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1024
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<string>
#include<math.h>
#include<vector>
#include<iomanip>
using namespace std;

int main(void)
{
	string s;
	cin >> s;
	if (s[0] == s[1] || s[1] == s[2] || s[2] == s[3]) { cout << "Bad" << endl; }
	else { cout << "Good" << endl; }
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
//#include<iostream>
//#include<cstdio>
//#include<stdlib.h>
//#include<string.h>
//#include<algorithm>
using namespace std;
#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define READ freopen("in.txt","r",stdin)
#define WRITE freopen("out.txt","w",stdout);
#define pb push_back
#define mem(arr,val) memset(arr,val,sizeof(arr))
#define sf(x) scanf("%d",&x)
#define sf2(x,y) scanf("%d %d",&x,&y)
#define sf3(x,y,z) scanf("%d %d %d",&x,&y,&z)
#define sl(x) scanf("%lld",&x)
#define sl2(x,y) scanf("%lld %lld",&x,&y)

#define sl3(x,y,z) scanf("%lld %lld %lld",&x,&y,&z)
#define sd(x) scanf("%lf",&x);
#define pLL pair<long long,long long>
#define pDB pair<double,double>
#define ff first
#define sn second
#define PRINT_CASE  printf("Case %d: ",tc++)
#define PRINT_CASENL  printf("Case %d:\n",tc++)
//#define mx 100005
#define lnd tree[ind<<1]
#define rnd tree[(ind<<1)+1]
#define cnd tree[ind]
#define lndp b,(b+e)>>1,(ind<<1)
#define rndp ((b+e)>>1)+1,e,(ind<<1)+1
#define IN(a,x,y) (a>=x && a<=y)
#define popcountL __builtin_popcountll
#define popcount __builtin_popcount
/// int other=mask^((1<<n)-1);
typedef long long ll;
typedef long long int lln;
typedef pair<int,int> pii;
ll INF=1<<28;
//typedef long long lld;
const double PI=acos(-1.0);
//int fx[]={1,-1,0,0}; //direction array
//int fy[]={0,0,1,-1};
int dir[4][2]={1,0,-1,0,0,-1,0,1};
int knight[8][2]={1,2,1,-2,2,1,2,-1,-1,2,-1,-2,-2,1,-2,-1};
const long double EPS=1e-7;
//#define INF 10000

struct compare
{
  bool operator()(const pair<int,pii>& l, const pair<int,pii>& r)
  {
      if(l.ff==r.ff)
      {
          return l.sn.ff>r.sn.ff;
      }
      return l.ff<r.ff;
  }
};
// bool operator<(pair<int,pii> l, pair<int,pii> r)
//  {
//      if(l.ff==r.ff)
//      {
//          cout<<"ok "<<endl;
//          return l.sn.ff<r.sn.ff;
//      }
//      return l.ff>r.ff;
//  }

/////////////////////////////////////template sesh/////////////////////////////////////////////////////

///code goes from here
const int mx=500150;
///
int mod=1000000007;

ll arr[mx];
int main()
{
//    SPEED;

    int t,tc=1;
//    sf(t);
    t=1;
    while(t--)
    {
        int n;
        sf(n);
        int l=1800;
        for(int i=1;i<=8;i++)
        {
            int r=l+199;
            if(n>=l && n<=r)
            {
                cout<<i<<endl;
                break;
            }
            l-=200;
        }
    }

    return 0;
}



Measured memory_bytes: 3756
let n, ans = read_int (), ref min_int
let h m = Array.(init n @@ fun _ -> init m @@ fun _ -> Scanf.scanf " %d" (+) 0)
let fs = h 10
let ps = h 11
let f b = Array.(fold_left (fun (s, i) f -> s + ps.(i).(fst @@ fold_left (fun (c, j) o -> c + (o + (b lsr j) land 1) / 2, j + 1) (0, 0) f), i + 1) (0, 0) fs) |> fst
let _ = for i = 1 to 1023 do ans := max !ans @@ f i done; Printf.printf "%d\n" !ans

Measured memory_bytes: 2560
#include<iostream>
#include<vector>
#include<string>

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

int main(){
	ll D, T, S;
	std::cin >> D >> T >> S;
	if(S*T >= D){
		std::cout << "Yes" << std::endl;
	}else{
		std::cout << "No" << std::endl;
	}
	
	return 0;
}

Measured memory_bytes: 3584
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repr(i, a, b) for(int i = a; i >= b; i--)
#define int long long
#define all(a) a.begin(), a.end()
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e15;

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i, 0, n) cin >> a[i];
    a.push_back(INF);
    int now = a[0], cnt = 1, ans = 0;
    rep(i, 1, a.size()){
        if(now == a[i]){
            cnt++;
        }else{
            ans += cnt / 2;
            now = a[i];
            cnt = 1;
        }
    }
    cout << ans << endl;
}

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

const int maxn = 1e5 + 5;
int a[maxn],n,k,minn,pos,ans;

int main()
{
    scanf("%d%d",&n,&k);
    minn = 1e9;
    for(int i = 1; i <= n; i++)
    {
        scanf("%d",&a[i]);
        if(minn > a[i])
        {
            minn = a[i];
            pos = i;
        }
    }
    ans = (n - 1) / (k - 1);
    if((n - 1) % (k - 1) != 0) ans++;

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

    return 0;
}



Measured memory_bytes: 640
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
#define ll long long int
#define ld long double
#define fast ios::sync_with_stdio(false);cin.tie(0); cout.tie(0)
#define clock_start       clock_t begin = clock();
#define clock_end         clock_t end = clock(); double time_spent = (double)(end - begin) / CLOCKS_PER_SEC; cout << time_spent << endl;
#define PI 3.14159265358979323846264338327950288419716939937510
using namespace std;
ll x , y;
int main(){
    cin >> x >> y;
    if(x > 8 || y  > 8) cout << ":(" << endl;
    else cout << "Yay!" << endl;
    return 0;
}


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

using namespace std;

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

    long n;
    cin >> n;
    char s[n];
    // string s;
    // scanf("%s", &s);
    cin >> s;
    long right_e = 0;
    for (long i = 1; i < n; i++) right_e += (s[i] == 'E');
    // for (long i = 1; i < n; i++) if (s[i] == 'E') right_e++;
    long min_count = right_e;
    long left_w = 0;
    for (long i = 1; i < n; i++) {
    // for (long i = 1; i < n; i++) {
        if (!min_count) break;
        // right_e -= s[i] == 'E';
        // left_w += s[i - 1] == 'W';
        if (s[i ] == 'E') right_e--;
        if (s[i -1] == 'W') left_w++;
        min_count = min(min_count, right_e + left_w);
    }
    cout << min_count << '\n';
    
    return 0;
}

Measured memory_bytes: 512
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd, floor
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7
#import numpy as np
from decimal import *

def MAP(): return map(str, input().split())
a, b = MAP()
print(int(Decimal(a)*Decimal(b)))

Measured memory_bytes: 10712
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPS(i, x) for (int i = 1; i <= (int)(x); i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define FORS(i, m, n) for (int i = m; i <= n; i++)
#define INF 2e9
#define MOD (1000000007)
#define EPS 1e-9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef long long int lli;
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    vector<lli> a(N);
    lli mSum = 0, mVal = 1e9 + 10;
    lli sum = 0;
    REP(i, N)
    {
        cin >> a[i];
        if (a[i] < 0)
        {
            mSum++;
            a[i] *= -1;
        }
        if (mVal > a[i])
        {
            mVal = a[i];
        }
        sum += a[i];
    }
    //cout << mVal << "\n";
    cout << (mSum % 2 == 1 ? (sum - 2 * mVal) : sum) << "\n";
}

Measured memory_bytes: 1024
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using System.Diagnostics;

class Myon
{
    public Myon() { }
    public static int Main()
    {
        new Myon().calc();
        return 0;
    }

    Scanner cin;
    Scanner cin2;


    void calc()
    {
        cin = new Scanner();
        cin2 = new Scanner();
        string S=cin.next();
        int N = S.Length;
        int count1010=0;
        int count0101=0;
       
        for(int i=0;i<N;i++)
        {
            if(i%2==1)
            {
                if(S[i]=='1')count1010++;
                if(S[i]!='1')count0101++;
            }
            else
            {
                if(S[i]=='0')count1010++;
                if(S[i]!='0')count0101++;
            }
        }
        Console.WriteLine(Math.Min(count1010,count0101));
    }


}



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: 13664
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <queue>
#include <stack>
#include <iomanip>
#include <numeric>
#include <bitset>

using namespace std;

int main () {
  int a, b;

  cin >> a >> b;
  cout << ((a*b) & 1 ? "Odd" : "Even") << endl;

  return 0;
}

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

int main() {
	int a;
	cin >> a;
	for (int b = 0; b < a; b++) {
		string c;
		cin >> c;
		string s = "";
		string p = "";
		for (char d : c) {
			if (d == '0') {
				if (p.length()) {
					if (p[0] == '1') {
						switch (p.length()%5) {
						case 1:s += '.'; break;
						case 2:s += ','; break;
						case 3:s += '!'; break;
						case 4:s += '?'; break;
						case 0:s += ' '; break;
						}
					}
					else if (p[0] == '9') {
						switch (p.length() % 4) {
						case 0:s += 'z'; break;
						case 1:s += 'w'; break;
						case 2:s += 'x'; break;
						case 3:s += 'y'; break;
						}
					}
					else if (p[0] == '7') {
						switch (p.length() % 4) {
						case 0:s += 's'; break;
						case 1:s += 'p'; break;
						case 2:s += 'q'; break;
						case 3:s += 'r'; break;
						}
					}
					else if (p[0] == '8') {
						switch (p.length() % 3) {
						case 0:s += 'v'; break;
						case 1:s += 't'; break;
						case 2:s += 'u'; break;
						}
					}
					else {
						int u=((p[0] - 48) * 3 + p.length()%3 + 90);
						if (p.length() % 3 == 0)u += 3;
						s += u;
					}
				}
				p = "";
			}
			else p += d;
		}
		cout << s << endl;
	}
}

Measured memory_bytes: 3160
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define ll long long
#define MAXN 2000005
using namespace std;
using namespace __gnu_pbds;  

int h,w,k,minn=INT_MAX;
string s;
int arr[15][1005],sum[15][1005],sum1[15][1005];

void solve()
{
	cin>>h>>w>>k;
	for(int i=0;i<h;i++)
	{
		cin>>s;
		for(int j=0;j<s.size();j++) arr[i][j] = s[j]-'0';
	}
	for(int i=0;i<pow(2,h-1);i++)
	{
		int flag=0,cnt=0;
		for(int j=0;j<h;j++)
		{
			for(int l=0;l<w;l++) sum[j][l] = arr[j][l];
		}
		for(int j=0;j<h;j++)
		{
			int p = i&(1<<(j-1));
			// cout<<j<<" "<<p<<endl;
			if(j>0 && !p)
			{
				for(int l=0;l<w;l++) sum[j][l]+=sum[j-1][l];	
			}
		}
		for(int j=0;j<h;j++)
		{
			if(i&(1<<j)) cnt++;
			for(int l=0;l<w;l++)
			{	
				if(sum[j][l]>k)
				{
					flag=1;
					break;
				} 
			}
			if(flag==1) break;
		}
		if(flag==0)
		{
			for(int j=0;j<h;j++)
			{
				for(int l=0;l<w;l++)
				{ 
					sum1[j][l] = sum[j][l];
					// cout<<sum[j][l]<<" ";
				}
				// cout<<endl;
			}
			// cout<<endl;
			// cout<<"first "<<i<<" "<<cnt<<endl;
			for(int j=0;j<w;j++)
			{
				int flag1=0;
				for(int l=0;l<h;l++)
				{
					if(i&(1<<l) || l==h-1)
					{
						// cout<<"l "<<l<<endl;
						if(j>0) sum1[l][j]+=sum1[l][j-1];
						// cout<<sum1[l][j]<<" ";
						if(sum1[l][j]>k)
						{
							cnt++;
							// cout<<j<<endl;
							flag1=1;
							break;
						}
					}
				}
				// cout<<endl;
				if(flag1==1)
				{
					for(int l=0;l<h;l++) sum1[l][j] = sum[l][j];
				}
			}
			// cout<<"second "<<i<<" "<<cnt<<endl;
			// cout<<endl;
		}
		if(flag==0) minn=min(minn,cnt);
	}
	cout<<minn<<endl;
}

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


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

typedef long long LL;
const int N = 200005;

int n;
bool vis[N];
LL A, B, ans;
std::pair<int, int> a[N];

int main() {
	std::ios::sync_with_stdio(0), std::cin.tie(0);
	std::cin >> n;
	for (int i = 0, x, y; i < n; ++i)
		std::cin >> x >> y, a[i] = {x, i}, a[i + n] = {y, i}, A += x, B += y;
	ans = std::min(A, B), std::sort(a, a + n + n);
	for (int i = 0; i < n; ++i) vis[a[i].second] = 1;
	LL sum = 0;
	for (int i = 0; i < n; ++i) sum += a[i].first;
	for (int i = 0; i < n; ++i) if (!vis[i])
		return std::cout << std::min(ans, sum) << '\n', 0;
	if (a[n - 1].second != a[n].second)
		std::cout << std::min(ans, sum - a[n - 1].first + a[n].first) << '\n';
	else
		std::cout << std::min(ans, sum + std::min(a[n].first - a[n - 2].first, a[n + 1].first - a[n - 1].first)) << '\n';
	return 0;
}

Measured memory_bytes: 1920
n, k = [int(i) for i in input().split()]
h = [int(i) for i in input().split()]
dp = [float('inf')] * n
dp[0] = 0

for i in range(1, n):
    for j in range(max(i - k, 0), i):
        dp[i] = min(dp[i], dp[j] + abs(h[i] - h[j]))

print(dp[n - 1])


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

#define range 100005
#define mod 1000000007
#define eps 1e-9
#define PI 3.14159265358979323846
#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second
#define ALL(V) V.begin(), V.end()
#define _ <<" "<<
#define int long long 
using namespace std;

//typedef long long ll;
typedef vector <int> vi;
typedef vector<vi> vvi;
typedef pair <int, int> ii;
typedef pair<int, pair<int,int> > iii;
typedef vector<ii> vii;
typedef vector<iii> viii;


signed main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	//freopen("test.txt","r",stdin);
	int n;
	cin>>n;
	int a[n+1];
	for(int i=0;i<=n;i++)
	{
		cin>>a[i];
	}
	int b[n];
	for(int i=0;i<n;i++)
	{
		cin>>b[i];
	}
	int output = 0;
	for(int i=0;i<n;i++)
	{
		if(b[i]<=a[i])
		{
			output+=b[i];
			a[i]-=b[i];
			b[i]=0;
			continue;
		}
		else
		{
			output+=a[i];
			b[i]-=a[i];
			a[i]=0;
			if(b[i]>=a[i+1])
			{
				b[i]-=a[i+1];
				output+=a[i+1];
				a[i+1]=0;
			}
			else
			{
				output+=b[i];
				a[i+1]-=b[i];
				b[i]=0;
			}
		}
	}
	cout<<output;
	return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define mod 1000000007
#define max_char 128
#define pb push_back
#define ff first
#define ss second
#define mp make_pair
#define lbd lower_bound
#define ubd upper_bound
#define PI 3.141592653589793238
#define pf push_front
#define all(x) x.begin(),x.end()
#define input(arr,n) for(ll c1=0;c1<n;c1++)cin>>arr[c1];
#define rep(i,a,n) for( ll i=a ; i<n ; i++)
#define mems(x, y) memset(x, y, sizeof(x))
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
//cout<<"Case #"<<v1+1<<": ";
 
ll power(ll base,ll pow, ll mo)
{
   ll res=1;
   while(pow)
   {     
        if (pow%2!=0)  res=(res*base)%mo;
        base=(base*base)%mo;
        pow/=2;
   }
   return res;
}
 
 
int main()
{
    fastio
	
	ll t,i,j,x;
	
	ll n,k,d;
	cin>>n>>k;
	
	vector<ll>v(k);
	int h[n+1]={};
	for(i=0;i<k;i++)
	{
	    cin>>d;
	    for(j=0;j<d;j++)
	    {
	        cin>>x;
	        h[x]=1;
	    }
	}
	ll ans=0;
	for(i=1;i<=n;i++)
	{
	    if(h[i]==0)
	    ++ans;
	}
	cout<<ans<<"\n";
    return 0;
}

Measured memory_bytes: 3660
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
// memo  fixed  setprecision(20);
using vvll = vector<vector<ll>>;
ll mod =1e9+7;
/*"itob" int to "N"base */           template<typename TypeInt> string itob(const TypeInt v, int base){static const char table[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";string ret;static numeric_limits<TypeInt> t;TypeInt n = v;if (t.is_signed) {if (v < 0) n *= -1;}while (n >= base) {ret += table[n%base];n /= base;}ret += table[n];if (t.is_signed) {if (v < 0 && base == 10) ret += '-';}reverse(ret.begin(), ret.end());return ret;}
/*"chmin" a = MAX*/                  template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
/*"chmax" a = MIN*/                  template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
/*"ctoi"  char to int*/              int ctoi(char c) {return c-'0';}
/*"gcd"   MAX Euclidean */           ll gcd(ll a,ll b){if(b==0)return a; return gcd(b,a%b);}
    /*"lcm"   MIN*/                      ll lcm(ll a,ll b){ll g = gcd(a,b);return a/g*b;}
/*"primecheck"If prime,return true.*/bool primecheck(ll n){if(n < 2) return false;else{for(int i = 2; i * i <= n; i++){if(n % i == 0) return false;}return true;}}
string  reverserange(string s,ll a,ll b){reverse(s.begin()+a-1,s.begin()+b); return s;}
ll modpow(ll a,ll n, ll mod){ll res = 1;while(n>0){if (n%2==1){res = res * a % mod;}a = a * a % mod;n/=2;}return res;}
int main() {
    ll a;
    string b;
    cin >> a>>b;
    string nb;
    bool zero =false;
    for(int i=0;i<b.size();i++){
        if(b.at(i)!='.'){
            nb.push_back(b.at(i));
        }
    }
    ll che = stoi(nb);
    a*=che;
    a/=100;
    cout<<a<<endl;
}
    



Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i,n) for(ll i = n;i >= 0;--i)
#define FOR(i,m,n) for(ll i = m, i##_len=(n);i <i##_len; ++i)
#define all(x) (x).begin(),(x).end()
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; }
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
const int INF = 1e9;
const ll LLINF = 1e16;
 
ll modinv(ll a, ll m) {
    ll b = m, u = 1, v = 0;
    while (b) {
        ll t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

int main(void)
{
    ll n, W;
    cin >> n >> W;
    vector<ll> w(n);
    vector<ll> v(n);
    REP(i,n){
        cin >> w[i];
        cin >> v[i];
    }

    vector<vector<ll>> dp(n + 1, vector<ll>(1e5+1, LLINF));
    REP(i,n){
        dp[i][0] = 0;
    }

    REP(i,n){
        REP(j,dp[i].size()){
            if(j - v[i] >= 0){
                dp[i + 1][j] = min(dp[i][j], dp[i][j - v[i]] + w[i]);
            }
            else{
                dp[i + 1][j] = dp[i][j];
            }
        }
    }

    ll ans = 0;
    REPR(i, dp[n].size()-1)
    {
        if(dp[n][i] <= W){
            ans = i;
            break;
        }
    }

    cout << ans << endl;

    return 0;
}

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

typedef long long ll;
typedef pair<int,int> pii;

long long MOD = 1000000000 + 7;

int main(){
  cout << setprecision(10);
  string S,T;
  cin >> S;
  cin >> T;
  int S_size = S.size();

  S = S + S;


  map<char,vector<int>>  pos;
  for(int i = 0; i < S.size(); i++){
    pos[S[i]].push_back(i);
  }

  int ans = 0;
  int now_pos = 0;
  for(int i = 0; i < T.size(); i++){
    if(pos.count(T[i]) == 0){
      cout << -1 << endl;
      return 0;
    }
    if(i == 0){
      now_pos = pos[T[i]].at(0);
    } else { 
      // T[i]のリストの中で、now_posより大きいものを選ぶ
      int tmp_index = upper_bound(pos[T[i]].begin(), pos[T[i]].end(), now_pos) - pos[T[i]].begin(); 
      int tmp_pos = pos[T[i]].at(tmp_index);
      if(tmp_pos >= S_size){
        ans++;
        now_pos = pos[T[i]].at(0);
      } else { 
        now_pos = tmp_pos;
      }
    }
  }

  ll ret = (ll)(ans) * (ll)(S_size);
  ret += ll(now_pos) + 1;

  cout << ret << endl;


}


Measured memory_bytes: 1784
#include <bits/stdc++.h>
using namespace std;
#define Rep(i,N) for(int i = 0; i < N; i++)
int main()
{
  string s, t;
  while(cin >> s >> t) {
    vector<vector<int> > dp(2,vector<int>(4005,0));
    int ss = s.size(), ts = t.size();
    int maxv = 0;
    Rep(i,ts) {
      Rep(j,ss) {
	if(s[j] == t[i]) {
	  dp[1][j + 1] = dp[0][j] + 1;
	  maxv = max(maxv,dp[1][j + 1]);
	}else {
	  dp[1][j + 1] = 0;
	}
      }
      dp[0] = dp[1];
    }
    cout << maxv << endl;
  }
  return 0;
}

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

int main() {
    stack<int> st;
    string s; cin >> s;
    vector<pair<int, int>> puddles;
    for (int i = 0; i < s.length(); i++) {
        if (s[i] == '\\') {
            st.push(i);
        } else if (s[i] == '/') {
            if (st.empty()) continue;
            int j = st.top(); st.pop();
            puddles.emplace_back(j, i);
        }
    }
    sort(puddles.begin(), puddles.end());
    vector<int> res;
    int end = -1, sum = 0, total = 0;
    for (auto it = puddles.begin(); it != puddles.end(); it++) {
        if (end < it->first) {
            res.push_back(sum); total += sum;
            end = it->second;
            sum = it->second - it->first;
        } else {
            sum += it->second - it->first;
        }
    }
    res.push_back(sum); total += sum;
    cout << total << endl;
    cout << res.size() - 1;
    for (auto it = res.begin() + 1; it != res.end(); it++) {
        cout << " " << *it;
    }
    cout << endl;
    return 0;
}


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

int main()
{
	int a, b, d, r;
	double f;
	
	cin >> a >> b;
	d = a / b;
	r = a % b;
	f = (double)a / b;
	
	printf("%d %d %f\n", d, r, f);
	
	return 0;
}

Measured memory_bytes: 1184
# -*- coding: utf-8 -*-
import numpy as np
import sys
from collections import deque
from collections import defaultdict
import heapq
import collections
import itertools
import bisect
from scipy.special import comb
import copy
sys.setrecursionlimit(10**6)


def zz():
    return list(map(int, sys.stdin.readline().split()))


def z():
    return int(sys.stdin.readline())


def S():
    return sys.stdin.readline()[:-1]


def C(line):
    return [sys.stdin.readline() for _ in range(line)]


N, H = zz()
A, B = [0] * N, [0] * N

for i in range(N):
    A[i], B[i] = zz()
normal_atack = max(A)

# 投げるだけで倒せるかどうか
sorted_B = sorted(B, reverse=True)
sum_B = [0]*N
sum_B[0] = sorted_B[0]
damege = 0
atack_num = 0
throw_damage = 0
ans = (-(-H // normal_atack))
# print("===========-")
for i in range(0, N):
    throw_damage += sorted_B[i]
    rest_H = H - throw_damage
    if (rest_H <= 0):
        ans = min(i+1, ans)
    else:
        ans = min(-(-rest_H // normal_atack)+i+1, ans)
    # print(ans, throw_damage)
    if (throw_damage >= H):
        break
print(ans)


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

int main() {
  int N,S=0;
  cin>>N;

  for(int i=1;i<N+1;i*=10){
    S+=(N%(i*10)-N%i)/i;
  }
  if(N%S==0){
    cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define pb push_back
#define mp make_pair
#define ll long long int
#define vi vector<int>
#define vl vector<ll>
#define ppi pair<int,int>
#define ppl pair<ll,ll>
#define all(x) x.begin(),x.end()
#define ii int,int 
#define ff first    
#define ss second
#define forn(i,a,b) for(int i=a;i<b;i++)
#define forr(i,a,b) for(int i=a;i>=b;i--)
#define forv(i,m) for(auto i : m)
#define imx INT_MAX
#define imn INT_MIN
#define inf LONG_MAX
#define minf LONG_MIN
#define endl "\n"
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
#define sze size()
#define rvs reverse 
#define itr iterator 
#define pre cout<<fixed<<setprecision(10);
#define umap unordered_map
#define uset unordered_set

/*
#define MODM(a,b,md) ((a%md)*(b%md))%md
#define MODA(a,b,md) ((a%md)+(b%md))%md
#define ull unsigned long long int
#define si short int
*/

/*
bool compare(int a,int b) {return a > b;}
bool compare1(ppi a,ppi b) {return a.ff > b.ff;}
bool compare2(ppi a,ppi b) {return a.ss < b.ss;}
ll Npower(ll a,ll b) {ll product = 1; while(b){if(b&1){product = product*a;}a = a*a;b = b>>1;} return product;}
ll power(ll a,ll b,ll md) {ll product = 1; while(b){if(b&1){product = MODM(product,a,md);}a = MODM(a,a,md);b = b>>1;} return product%md;}
ll GCD(ll a,ll b) {return b==0 ? a:GCD(b,a%b);}
ll LCM(ll a,ll b) {return (a/GCD(a,b))*b; }
*/


int main()
{
	fast

	string s,t;
	cin>>s>>t;

	umap<char,vi> m;


	forn(i,0,s.sze)
	{
		m[s[i]].pb(i+1);
	}


	ll count = 0;
	ll idx = 0;

	forn(i,0,t.sze)
	{
		if(m[t[i]].sze == 0)
		{
			cout<<-1;
			return 0;
		}
		if(idx < m[t[i]][m[t[i]].sze-1])
		{
			idx = m[t[i]][upper_bound(m[t[i]].begin(),m[t[i]].end(),idx)-m[t[i]].begin()];
		}
		else
		{
			count++;
			idx = m[t[i]][0];
		}
	}

	cout<<(count*s.sze+idx);



	return 0;
}

Measured memory_bytes: 1228
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>
 
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
 
ull X,Y,Z,K;
vector<ull> A,B,C;
vector<ull> v1;
vector<ull> v2;
 
constexpr int d1 = 1000;
constexpr int d2 = 3000;
bool visited1[d1][d1];
bool visited2[d2][d1];
 
void dfs1(ull i, ull j){
  if(i<X&&j<Y&&!visited1[i][j]){
    v1.push_back(A[i]+B[j]);
    visited1[i][j] = 1;
    dfs1(i+1, j);
    dfs1(i, j+1);
  }
}
void dfs2(ull i, ull j){
  if(i<d2&&i<K&&i<X*Y&&j<Z&&!visited2[i][j]){
    v2.push_back(v1[i]+C[j]);
    visited2[i][j] = 1;
    dfs2(i+1, j);
    dfs2(i, j+1);
  }
}
 
int main(){
  cin>>X>>Y>>Z>>K;
  for(int i=0;i<X;i++){ ull a; cin>>a; A.push_back(a); }
  for(int i=0;i<Y;i++){ ull a; cin>>a; B.push_back(a); }
  for(int i=0;i<Z;i++){ ull a; cin>>a; C.push_back(a); }
  sort(A.begin(), A.end(), greater<ull>()); sort(B.begin(), B.end(), greater<ull>()); sort(C.begin(), C.end(), greater<ull>());
  
  dfs1(0,0);
  sort(v1.begin(),v1.end(),greater<ull>());
  if(v1.begin()+K<v1.end()){
  	v1.erase(v1.begin()+K,v1.end());
  }
  dfs2(0,0);
  sort(v2.begin(),v2.end(),greater<ull>());
  for(int i=0;i<K;i++){
    cout<<v2[i]<<endl;
  }
  return 0;
}

Measured memory_bytes: 47480
/*Author SHUBH AGRAWAL  */

#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define pu push  //  adds the value to the last of the queue 
#define lld long long int
#define ins insert /// used in set to insert the values 
#define adv advance  /// used to increment the iterator
#define mp make_pair
#define fi first
#define se second
#define all(c) c.begin(),c.end()
#define PI 3.1415926
#define INF (lld)1e18
#define vl  vector<long long int >
#define vpl vector< pair<lld ,lld> >
#define vvl vector<vector<lld> > 
#define pll pair <lld,lld>
long long int modp(lld a,lld p,lld n)
{
    int d[100];
    int i,j,k,l;
    if(n==0) return 1;
    for(i=0;n>=1;i++)
    {
        d[i]=n%2;
        n/=2;
    }
    l=i;
    long long int e=1;
    if(d[0]==1) e*=(a%p);
    for(i=1;i<l;i++)
    {
        a*=a;
        a=a%p;
        if(d[i]==1) 
        {
            e*=a;
            e=e%p;
        }
    }
    return e%p;
}
lld modInverse(lld n, lld p) 
{ 
    return modp(n, p, p-2); 
}

long long int nCrModPFermat(lld n, lld r,lld p) 
{ 
   // Base case 
   if (r==0) 
      return 1; 
    
    // Fill factorial array so that we 
    // can find all factorial of r, n 
    // and n-r 
    
    lld fac[n+1]; 
    fac[0] = 1; 
    for (lld i=1 ; i<=n; i++) 
    fac[i] = fac[i-1]*i%p; 
     
    return (fac[n]* modInverse(fac[r], p) % p * 
            modInverse(fac[n-r], p) % p) % p; 
}


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

lld p1=1000000007,p2=998244353;
lld l,r,mid,ans;
lld n,m,i,j,k;
lld x,y,n1,n2,h,z;
lld w,u;

lld d,p=1000000000;
bool chkpalin(string s)
{
    lld l=s.size();
    for(int i=0;i<l;i++)
    {
        if(s[i]!=s[l-1-i])
        {
            return false;
        }
    }
    return true;
}

void solve()
{
    lld a[200001],b[200001];
    cin>>n;
    for(i=1;i<=n;i++) a[i]=0;
    for(i=0;i<n;i++)
    {
        cin>>x;
        b[i]=x;
        a[x]+=1;
    }
    ans=0;
    for(i=1;i<=n;i++)
    {
        ans+=(a[i]*(a[i]-1))/2;
    }
    for(i=0;i<n;i++)
    {
        if(a[b[i]]<=1) cout<<ans;
        else cout<<ans-a[b[i]]+1;
        cout<<"\n";
    }
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    lld t=1;
   //cin>>t;
   for(int i=0;i<t;i++)
    {
     //   cout<<"Case #"<<i+1<<": ";
        solve();
    //    cout<<"\n";
    }
    return 0;
}

Measured memory_bytes: 5760
#include <stdio.h>

int
main(int argc, char *argv[])
{
    int i, j;
    for (i = 1; i <= 9; i++) {
        for (j = 1; j <= 9; j++) {
            printf("%dx%d=%d\n", i, j, i*j);
        }
    }

    return 0;
}

Measured memory_bytes: 524
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int k = scanner.nextInt();
        int n = scanner.nextInt();

        int[] a = new int[k];
        for (int i = 0; i < n; i++) {
            a[i] =scanner.nextInt();
        }

        int maxDistance = 0;
        for (int i = 1; i < n; i++) {
            maxDistance = Math.max(maxDistance, a[i]-a[i-1]);
        }
        maxDistance = Math.max(maxDistance, a[0]+k-a[n-1]);

        System.out.println(k-maxDistance);


    }
}


Measured memory_bytes: 93428
X = int(input().strip())

if X <= 599:
    ans = 8
elif X <= 799:
    ans = 7
elif X <= 999:
    ans = 6
elif X <= 1199:
    ans = 5
elif X <= 1399:
    ans = 4
elif X <= 1599:
    ans = 3
elif X <= 1799:
    ans = 2
elif X <= 1999:
    ans = 1

print(ans)


Measured memory_bytes: 9176
import sys
x,n = list(map(int,input().split()))
if n != 0:
  p = list(map(int,input().split()))
  
if n==0:
  print(x)
  
elif x not in p:
  print(x)

else:
  a = b = x
  for i in range(100):
    a -= 1
    b += 1
    if a not in p :
      print(a)
      break
    elif b not in p:
      print(b)
      break

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

#define int long long

signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  int N;
  cin >> N;

  vector<int> A(N+1), B(N);
  for ( int i = 0; i < N+1; i++ ) {
    cin >> A[i];
  }

  int ans = 0;
  for ( int i = 0; i < N; i++ ) {
    cin >> B[i];
    if ( A[i] ) {
      if ( A[i] <= B[i] ) {
	ans += A[i];
	B[i] -= A[i];
      } else {
	ans += B[i];
	B[i] = 0;
      }
    }
    if ( A[i+1] ) {
      if ( A[i+1] <= B[i] ) {
	ans += A[i+1];
	A[i+1] = 0;
	B[i] -= A[i+1];
      } else {
	ans += B[i];
	A[i+1] -= B[i];	
	B[i] = 0;
      }
    }
  }

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


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

#define loop(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) for(int i=0;i<(n);++i)
#define rrep(i,n) for(int i=(n);i>=0;--i)
#define in(v) cin>>v;
#define out(v) cout<<v<<"\n"
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }

int dp[101][101][301] = {0}; // dp[i][w]=i番目(1-index)までj個選んで重さwにしたときの最大の価値
int main() {
  cin.tie(0); ios::sync_with_stdio(false);
  int N, W; in(N); in(W);

  int w[N], v[N];
  rep(i, N) {
    in(w[i]); in(v[i]);
  }
  int w1 = w[0];
  rep(i, N)
    w[i] -= w1;

  rep(i, N) {
    loop(j, 1, N+1) {
      rep(k, 301) {
        if (k >= w[i])
          dp[i+1][j][k] = max(dp[i][j][k], dp[i][j-1][k-w[i]] + v[i]);
        else
          dp[i+1][j][k] = dp[i][j][k];
      }
    }
  }

  int ans = 0;
  int p = W / w1;
  rrep(j, p) {
    rep(x, min(300, W - j*w1)+1) {
      chmax(ans, dp[N][j][x]);
    }
  }
  out(ans);

  return 0;
}


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

typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)

// cout<<fixed<<setprecision(10);
template <class T> inline bool chmin(T &a, T b) {if (a > b){a = b;return true;}return false;}
template <class T> inline bool chmax(T &a, T b) {if (a < b){a = b;return true;}return false;}

const int NM = 1e5+1;

int main(){
    int h, n; cin >> h >> n;
    ll sum = 0;
    rep(i, n){
        int x; cin>>x;
        sum += x;
    }
    if(sum >= h){
        cout << "Yes" << endl;
        return 0;
    }else{
        cout << "No" << endl;
        return 0;
    }
}



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

int main() {

    int N, K;
    cin >> N >> K;

    int ans = 1;
    while (N >= K) {
        N /= K;
        ans++;
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
import java.util.*;
public class Main {
        static Scanner sc = new Scanner(System.in);
        static void myout(Object t){System.out.println(t);}//standard output
        static void myerr(Object t){System.err.println(t);}//standard error
        static String getStr(){return sc.next();}
        static int getInt(){return Integer.parseInt(getStr());}
        static Long getLong(){return Long.parseLong(getStr());}
        static boolean isNext(){return sc.hasNext();}
        static char[] splitSingle(String str){return str.toCharArray();}
        public static void main(String[] args){
          int N = getInt();
          int A = getInt();
          int B = getInt();
          if(A == B){
            myout(1);
            return;
          }else if(A > B){
            myout(0);
            return;
          }
          if(N == 1){
            myout(0);
            return;
          }
            if(N == 2){
              myout(1);
              return;
            }
            myout((long)(B-A) * (N-2) + 1);
        }
        //便利メソッド追加枠ここから

        //便利メソッド追加枠ここまで
}


Measured memory_bytes: 23892
#include<bits/stdc++.h>
using namespace std;
#define INIT  ios_base :: sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define mp make_pair
#define pb push_back
#define ft first
#define sc second
#define ll long long
#define pii pair<int, int>
#define count_bits __builtin_popcount
#define int ll

int t, n, m, k, a[300010], q, l, r;
bool v[1000010];

int32_t main(){
INIT
cin>>k;

int x=0;
for(int i=1; i<=(1000000); i++){
    x*=10; x%=k; x+=7; x%=k;
    if((x==0)){
        cout<<i; return 0;
    }
    if(v[x]==true){
        cout<<"-1"; return 0;
    }
    v[x]=true;
}



return 0;
}





Measured memory_bytes: 4568