akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;

#define ll long long
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define sc(x) scanf("%lld",&x)
#define pr(x) printf("%lld\n",x)
#define clr(x) memset(x, 0, sizeof(x))
#define all(x) x.begin(), x.end()
typedef pair<ll, ll> pii;
typedef vector< ll > vl;
typedef vector< pii > vpii;

#define trace2(x, y)             cout <<#x<<": "<<x<<" | "<<#y<<": "<<y<< endl;
#define trace3(x, y, z)          cout <<#x<<": "<<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl;
#define trace4(a, b, c, d)       cout <<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl;
#define trace5(a, b, c, d, e)    cout <<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<<": "<<e<<endl;



//DONT WASTE YOUR TIME......i said don't waste -_- 
//prove yourself remember....fuck ps&&as hard....show them your are better then them
//Be confident.....dont lose hope.......You can do it.....
//dimaag  khoob h tere meh ....bas concentration ki kami h
//CONCENTRATE
//A,B,C dimaag nhi ...observation h .....zyaada mat sochna unme.....bas observe karna dhyaan se aur implement kar daal jitni jaldi ho sake

//capture it

// fortunately or unfortunately tu sabse badaah chodu h ....ek number ka chutiyaa -_-

const ll N= 1e6+55,mod = 1e9+7;
 
ll gg[N];
vl v;
set< pii >s;
set< pii> :: iterator it;
map<ll,ll>mm;
int main() {
 	//freopen("task.in","r",stdin);freopen("task.out","w",stdout);
	ll n,i,j,k,a,b,c,x,y,z;
	sc(n);
	for(i=1;i<=n;i++){
		sc(gg[i]);
		v.pb(gg[i]);
	}
	sort(gg+1,gg+n+1);
	a=gg[n/2];b=gg[(n/2)+1];
	for(i=1;i<=n;i++){
		s.insert(mp(gg[i],i));
	}
	for(i=1;i<=n;i++){
		pii p;
		it=s.lower_bound(mp(v[i-1],-1*mod));
		p=*it;
		j=p.ss;
		//cout<<p.ff<<" "<<p.ss<<" \n";
		if(j<=(n/2))pr(b);
		else pr(a);
		s.erase(it);
	}

}

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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << setprecision(20) << fixed;
  int N;
  long long ans = 0;
  cin >> N;
  vector<long long> A(N), B(N), sum;
  for(int i = 0; i < N; i++){
    cin >> A.at(i) >> B.at(i);
    sum.push_back(A.at(i) + B.at(i));
    ans -= B.at(i);
  }  
  sort(sum.begin(), sum.end(), greater<>());
  for(int i = 0; i < N; i++){
    if(i % 2 == 0) ans += sum.at(i);
  }
  cout << ans;
}

Measured memory_bytes: 2936
s=input()
ans=0
if len(s)%2==0:
    for i in range(len(s)//2):
        if s[i]!=s[-(i+1)]:
            ans+=1
else:
    for i in range(len(s)//2):
        if s[i]!=s[-(i+1)]:
            ans+=1
print(ans)

Measured memory_bytes: 8912
N = int(input())
red = [list(map(int, input().split())) for _ in range(N)]
blue = [list(map(int, input().split())) for _ in range(N)]
red.sort(reverse=True, key=lambda x: x[1])
blue.sort()
ans = 0
for b in blue:
    for r in red:
        if r[0] < b[0] and r[1] < b[1]:        
            red.remove(r)
            ans += 1
            break
print(ans)

Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <math.h>
#include <iomanip>
#include <stdio.h>
#include <algorithm>
#include <ctime>
#include <vector>
#include <set>
#include <queue>
using namespace std;
typedef long long ll;

#define PI 3.14159265358979323846264338327950L

ll res;

int f(ll A,ll B,ll x){
    return floor(A * x / B) - (A * floor(x / B));
}
int main()
{
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    ll A,B,N;
    cin >> A >> B >> N;
    res = f(A,B,min(B - 1, N));
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 3568
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <vector>
#include <queue>
#include <utility>
#define maxn 100005

using namespace std;
typedef long long ll;

int n,k,r,s,p;
string t;
bool win[maxn];
int main(){
  ios::sync_with_stdio(false);
  cin.tie(0); cout.tie(0);
  cin >> n >> k >> r >> s >> p >> t;
  for(int r = 0;r < k;r++){
    win[r] = true;
    for(int i = r + k;i < n;i += k){
      if(t[i] != t[i - k]) win[i] = true;
      else win[i] = !win[i - k];
    }
  }
  int ans = 0;
  for(int i = 0;i < n;i++){
    if(!win[i]) continue;
    if(t[i] == 'r') ans += p;
    else if(t[i] == 'p') ans += s;
    else ans += r;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 892
#include <bits/stdc++.h>
using namespace std;
using vec = vector<int>;

int main() {
	int N;
  cin >>N;
  vec a(N);
  for(int i=0;i<N;i++) cin >> a[i];
  sort(a.begin(),a.end());
  int bob =0;
  int alice =0;
  for(int i=0;i<N;i++){
   if(i%2 ==0) alice += a[i];
    else bob += a[i];
     
  }
  int ans = abs(bob-alice);
  printf("%d\n",ans);
  
}
  


Measured memory_bytes: 256
using System;

class Program{
	static void Main(){
	int N;
      int t,c=0;
		N = int.Parse(Console.ReadLine());
      t=N;
      while(t!=0){c+=t%10; t/=10; }
      if(N%c==0)Console.WriteLine("Yes\n");
      else{Console.WriteLine("No\n");}
	}
}

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

int main() {
  double l;
  cin >> l;
  cout << fixed << setprecision(10);
  cout << pow(l/3, 3) << endl;
  return 0;
}


Measured memory_bytes: 256
N = int(input())
S = list(input())
Q = int(input())
query = [input().split() for _ in range(Q)]

bit = [[0 for _ in range(26)] for _ in range(N + 1)]

def bit_add(i, s, j):
    ss = ord(s) - ord("a")
    while i <= N:
        bit[i][ss] += j
        i += i & - i
        
def bit_sum(i):
    s = [0] * 26
    while i:
        for j in range(26):
            s[j] += bit[i][j]
        i -= i & -i
    return s
for i in range(1, N + 1):
    s = S[i - 1]
    bit_add(i, s, 1)

for x, y, z in query:
    if x == "1":
        y = int(y)
        bit_add(y, S[y - 1], -1)
        bit_add(y, z, 1)
        S[y - 1] = z
    if x == "2":
        answer = 0
        y, z = int(y) - 1, int(z)
        sum_y = bit_sum(y)
        sum_z = bit_sum(z)
        for i in range(26):
            if sum_z[i] - sum_y[i] > 0:
                answer += 1
        print(answer)

Measured memory_bytes: 245916
# coding=utf-8

###
### for atcorder program
###

import sys
import math
import array

# math class
class mymath:
    ### pi
    pi = 3.14159265358979323846264338

    ### Prime Number
    def pnum_eratosthenes(self, n):
        ptable = [0 for i in range(n+1)]
        plist = []

        for i in range(2, n+1):
            if ptable[i]==0:
                plist.append(i)
                for j in range(i+i, n+1, i):
                    ptable[j] = 1
        return plist

    ### GCD
    def gcd(self, a, b):
        if b == 0:
            return a
        return self.gcd(b, a%b)

    ### LCM
    def lcm(self, a, b):
        return (a*b)//self.gcd(a,b)

    ### Mat Multiplication
    def mul(self, A, B):
        ans = []
        for a in A:
            c = 0
            for j, row in enumerate(a):
                c += row*B[j]
            ans.append(c)
        return ans

mymath = mymath()

### output class
class output:
    ### list
    def list(self, l):
        l = list(l)
        #print(" ", end="")
        for i, num in enumerate(l):
            print(num, end="")
            if i != len(l)-1:
                print(" ", end="")
        print()

output = output()

### input sample
#i = input()
#A, B, C = [x for x in input().split()]
#N, K = [int(x) for x in input().split()]
#inlist = [int(w) for w in input().split()]
#R = float(input())
#A = [int(x) for x in input().split()]
#for line in sys.stdin.readlines():
#    x, y = [int(temp) for temp in line.split()]

### output sample
#print("{0} {1} {2:.5f}".format(A//B, A%B, A/B))
#print("{0:.6f} {1:.6f}".format(R*R*math.pi,R*2*math.pi))
#print(" {}".format(i), end="")

def main():
    r, c = [int(x) for x in input().split()]

    A = []
    for i in range(r):
        A.append([int(x) for x in input().split()])

    for i in A:
        i.append(sum(i))
    
    a = []
    for i in range(c):
        temp = 0
        for j in range(r):
            temp += A[j][i]
        a.append(temp)
    a.append(sum(a))

    A.append(a)

    for i in A:
        output.list(i)

if __name__ == '__main__':
    main()


Measured memory_bytes: 6924
#include <stdio.h>
int main(void)
{
       
    int h,w,H,W;
    for(;;){
        scanf("%d %d",&H,&W);
    if(H==0 && W==0)break;
    for(h=0; h<H; h++){
        for(w=0; w<W; w++){
            if((h==0 || h==H-1)||(w==0 || w==W-1)){
                printf("#");
            }
            else{
                printf(".");
            }
        }
        printf("\n");
        
    }
    printf("\n");
    }
    return 0;  
 
    
}



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

#define INF 2147483647
#define LINF 9223372036854775807
#define MOD 1000000007
#define MOD2 998244353

template<class T,class U>bool chmax(T &a, const U &b){if(a<b){a=b;return 1;}return 0;}
template<class T,class U>bool chmin(T &a, const U &b){if(b<a){a=b;return 1;}return 0;}

#define rep(i,n) for(int i=0,_i=(n);i<_i;++i)
#define rep1(i,a,b) for(int a_=(a),b_=(b),i=a_;i<b_;++i)
#define repr(i,n) for(int _i=(n),i=_i;i>0;--i)

#define db(x) cerr<<#x<<" = "<<x<<" ";
#define db2(x,y) cerr<<"("<<#x<<", "<<#y<<") = ("<<x<<", "<<y<<") ";
#define db3(x,y,z) cerr<<"("<<#x<<", "<<#y<<", "<<#z<<") = ("<<x<<", "<<y<<", "<<z<<") ";
#define ln cout<<endl;

#define all(a)  (a).begin(),(a).end()
#define dig(n)  to_string(n).length()

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

typedef long long ll;
typedef long double ld;

typedef pair<int,int> P;
typedef pair<int,P> iP;
typedef pair<P,P> PP;

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

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





int main(){

    bool flag=false;
    ll ans=0,sum=0;

    int n,m;
    cin>>n;


    cout<<n + n*n + n*n*n<<endl;

    //cout <<fixed<<setprecision(16)<< << endl;

    //if(flag)cout << "Yes" <<endl;
    //else cout << "No" <<endl;

    return 0;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
  
using namespace std;
  
template<class T> void ckmin(T &a, T b) { a = min(a, b); }
template<class T> void ckmax(T &a, T b) { a = max(a, b); }
  
#define pb push_back
#define mp make_pair
#define cotu cout
#define itn int
#define Red ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define F first
#define S second
#define sz(x) (int)x.size()
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for(int i = 0; i < n; ++i)
#define repr(i,n) for(int i = n - 1; i >= 0; --i)
#define Rep(i, a, n) for(int i = (a); i <=(n); ++i)
#define repst(i, n) for(auto it = n.begin(); it != n.end(); ++it)
#define Repr(i, a, n) for(int i = (n); i >= (a); --i)
#define setp(x) fixed << setprecision(x)
#define ordered_set tree<int , null_type,less<int >, rb_tree_tag,tree_order_statistics_node_update> 
  
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
  
typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
  
const int inf = int(1e9);
const int mod = inf + 7;
const int N = 1e3 + 555; // TL MB
const double PI = acos(-1.0);
void mul(ll &x, ll y){
	x *= y;
	if(x >= mod) x %= mod;
}
 
void add(ll &x, ll y){
	x += y;
	if(x >= mod) x -= mod;
	if(x < 0) x += mod;
}
ll bp(ll a, ll n){
	ll r = 1;
	while(n){
		if(n & 1) mul(r, a);
		mul(a, a);
		n >>= 1;
	}
	return r;
 
}

void solve()
{
	int h, w, kk;
	cin >> h >> w >> kk;
	char c[h][w];
	rep(i, h){
		rep(j, w){
			cin >> c[i][j];
		}
	}
	char p[h][w];
	int res = 0;
	rep(i, 1 << h){
		rep(j, 1 << w){
			int cur = 0;
			rep(k, h) rep(t, w) p[k][t] = c[k][t];
			rep(k, h){
				rep(t, w){
					if(i & (1 << k) || j & (1 << t)) continue;
					cur += (c[k][t] == '#');
				}
			}
			res += (cur == kk);
			rep(k, h) rep(t, w) c[k][t] = p[k][t];

		}
	}
	cout << res;
}	

 
int main()
{
	// freopen("input.txt", "r", stdin);
	// freopen("output.txt", "w", stdout);
    Red;
  	int T = 1;
  	// cin >> T;
  	for(int i = 1; i <= T; ++i){
  		solve();
  	}
  	return 0;

}

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

int main()
{
  ll n,a[200005],k,b[200005],c[200005];
  cin>>n;
  for(int i=0;i<n;i++)
  {
    cin>>a[i]>>b[i]>>c[i];
  }
  ll dp[n][3]={0};
  dp[0][0]=a[0];
  dp[0][1]=b[0];
  dp[0][2]=c[0];
  for(int i=1;i<n;i++)
  {
    dp[i][0]=a[i]+max(dp[i-1][1],dp[i-1][2]);
    dp[i][1]=b[i]+max(dp[i-1][0],dp[i-1][2]);
    dp[i][2]=c[i]+max(dp[i-1][0],dp[i-1][1]);
  }
  ll ans=max(dp[n-1][0],dp[n-1][1]);
  ans=max(ans,dp[n-1][2]);
  cout<<ans<<"\n";
  return 0;
}

Measured memory_bytes: 8188
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rrep(i,n) for(int i=(int)(n-1);i>=0;i--)
#define FOR(i,n,m) for(int i=n;i<=(int)(m);i++)
#define RFOR(i,n,m) for(int i=(int)(n);i>=m;i--)
#define all(x) (x).begin(),(x).end()
#define sz(x) int(x.size())
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;
const double PI=3.14159265358979323846;
using namespace std;
vector<int> dx={1,0,-1,0};
vector<int> dy={0,1,0,-1};
template<class T>
vector<T> make_vec(size_t a){
    return vector<T>(a);
}
template<class T, class... Ts>
auto make_vec(size_t a, Ts... ts){
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}

int main() {
    string s;
    cin>>s;
    int n=sz(s);
    vector<ll> ans(n+1,0);
    ll cnt=0;
    rep(i,n) {
        if(s[i]=='<') {
            cnt++;
            ans[i+1]=max(ans[i+1],cnt);
        }
        else cnt=0;
    }
    rrep(i,n) {
        if(s[i]=='>') {
            cnt++;
            ans[i]=max(ans[i],cnt);
        }
        else cnt=0;
    }
    ll a=0;
    rep(i,n+1) a+=ans[i];
    cout<<a<<endl;
}


Measured memory_bytes: 4740
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

  public static void main(String[] args) throws IOException {
    
    try(BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {

      int n = Integer.parseInt(br.readLine());
      String[] line;
      MyList list = new MyList();

      for(int i=0; i<n; i++) {
        line = br.readLine().split(" ");
        switch( line[0] ) {
          case "insert" :
            list.insertFirst( Integer.parseInt(line[1]) );
            break;
          case "delete" :
            list.delete( Integer.parseInt(line[1]) );
            break;
          case "deleteFirst" :
            list.deleteFirst();
            break;
          case "deleteLast" :
            list.deleteLast();
            break;
          default :
            System.out.println("n:" + i + " is failed.");
        }
      }

      System.out.println ( list.getAllElements() );
    }
  }
}

class Node {
  Node next,prev;
  int key;

  public Node(int key) {
    this.key = key;
  }
}

class MyList {
  Node nil;
  Node current;
  int size;

  public MyList() {
    nil = new Node(0);
    nil.next = nil.prev = nil;
    size = 0;
  }

  public StringBuilder getAllElements() {
    StringBuilder buf = new StringBuilder(size*2);

    if(size > 0){
      current = nil.next;
      for(int i=0; i<size; i++){
        buf.append(current.key).append(" ");
        current = current.next;
      }
    }
    buf.setLength(buf.length()-1);

    return buf;
  }
  public void insertFirst(int x) {
    if(size == 0) {
      current = new Node(x);
      nil.next = current;
      nil.prev = current;
      current.prev = nil;
      current.next = nil;
      size++;
    }
    else {
      Node add = new Node(x);
      
      current.prev.next = add;
      add.prev = current.prev;

      add.next = current;
      current.prev = add;

      current = add;
      size++;
    }
  }
  public void deleteFirst() {
    current = nil.next;

    nil.next = current.next;
    current.next.prev = current.prev;

    current = current.next;
    size--;
  }
  public void deleteLast() {
    current = nil.prev;

    nil.prev = current.prev;
    current.prev.next = current.next;

    current = nil.next;
    size--;
  }
  public void delete(int x) {
    Node target = findFirst(x);

    if(target == nil) current = current.next;
    else if( target == nil.prev ) deleteLast();
    else {
      current.prev.next = target.next;
      current.next.prev = target.prev;
      current = nil.next;
      size--;
    }
  }
  private Node findFirst(int x) {
    while(current != nil) {
      if(current.key == x) break;
      current = current.next;
    }

    return current;
  }
}


Measured memory_bytes: 189688
def solve():
    N = int(input())
    
    counter = [[0] * 10 for _ in range(10)]
    for i in range(1, N+1):
        s = str(i)
        counter[int(s[0])][int(s[-1])] += 1
    
    ans = 0
    for i in range(10):
        for j in range(10):
            ans += counter[i][j] * counter[j][i]
    print(ans)


if __name__ == '__main__':
    solve()


Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define _ ios_base::sync_with_stdio(0);
#define endl "\n"
#define MAXN ((int)2e5+123)
#define MOD ((int)1e9+7)
#define ll long long
#define INF INT_MAX
#define pii pair<int,int>
#define vi vector<int>
#define vii vector<ii>
#define si set<int>
#define pb push_back
#define SZ(v) int(v.size())
#define ms(v,x) memset(v,x,sizeof v)
#define fore(i,m,n) for(int i=m;i<n;i++)
#define forn(i,n) fore(i,0,n)
#define foreach(i,v) for(auto i: v)
#define all(v) v.begin(), v.end()

template<typename T> T gcd(T a, T b) {return b? gcd(b,a%b): a;}
template<typename T> T lcm(T a, T b) {return a*b/gcd(a,b);}


using namespace std;

int n,t;
int m,x,k;

int main(){_
    cin >> n >> m;
    vi freq(n+1,0);

    while(m--){
        cin >> k;
        forn(i,k){
            cin >> x;
            if(!freq[x]) n--, freq[x]++; 
        }
    }
    cout << n << endl;
    return 0;
}

Measured memory_bytes: 3624
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<cstdlib>
using namespace std;
inline int read()
{
    int x=0,f=1;char ch=getchar();
    while(ch<'0' || ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0' && ch<='9')x=x*10+ch-'0',ch=getchar();
    return x*f;
}
inline void write(int x)
{
    if(x<0)putchar('-'),x=-x;
    if(x>9)write(x/10);
    putchar(x%10+'0');
}
inline void pr1(int x){write(x),putchar(' ');}
inline void pr2(int x){write(x),puts("");}
char ss[20];
int main()
{
    //freopen("a.in","r",stdin);
    //freopen("a.out","w",stdout);
    scanf("%s",ss+1);int len=strlen(ss+1);
    int sum=0;
    for(int i=1;i<=len;i++)if(ss[i]=='x')sum++;
    if(sum>7)puts("NO");
    else puts("YES");
   	return 0;
}

Measured memory_bytes: 128
/*
https://t.me/unstoppabIesoIvemachinechannel
*/
#pragma ARCENIY_KIRILLOV_POVELITEL_KROKODILOV
//#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("no-stack-protector")
//#pragma GCC push_options
//#pragma GCC optimize ("unroll-loops")
//#pragma GCC pop_options
//#pragma GCC target("popcnt")
//#pragma GCC target("sse4")
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define rng(a) a.begin(),a.end()
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define rep(i, n) for (int i = 0; i < n; i++)
#define per(i, n) for (int i = n - 1; i > -1; i--)
#define rer(i, x, n) for (int i = x; i < n; i++)
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef long double ld;















signed main(){
    int n;
    cin >> n;
    string s;
    cin >> s;
    char c = '9';
    int ans = 0;
    for (int i = 0; i < n; i++){
        if (s[i] != c){
            ans++;
            c = s[i];
        }
    }
    cout << ans;



}


Measured memory_bytes: 512
// https://atcoder.jp/contests/abc173/tasks/abc173_c

use proconio::input;

fn main() {
    input! {
        h: u32, w: u32, k: i32,
        ss: [String; h],
    }
    let mut ans = 0;
    for i in 0..2u32.pow(h) {
        for j in 0..2u32.pow(w) {
            let mut cnt = 0;
            let mut sss: Vec<Vec<char>> = Vec::new();
            for s in &ss {
                sss.push(s.chars().collect());
            }
            for r in 0..h {
                for c in 0..w {
                    if 2u32.pow(r) & i == 0 && 2u32.pow(c) & j == 0 && sss[r as usize][c as usize] == '#' {
                        cnt +=1;
                    }
                }
            }
            if cnt == k {
                ans += 1;
            }
        }
    }
    println!("{}", ans);
}


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

using lint = long long;
#define rep(i, n) for(int i = 0; i < int(n); i++)
#define repu(i, a, b, s) for(int i = int(a); i < int(b); i += int(s))
#define repd(i, a, b, s) for(int i = int(a); i > int(b); i += int(s))
#define endl "\n"
constexpr lint INF = 2e18;
constexpr lint MOD = 1e9 + 7;

void solve() {
    lint x, y;
    cin >> x >> y;
    cout << x + y / 2 << endl;
}

int main() {
    std::cin.tie(nullptr);
    std::ios_base::sync_with_stdio(false);
    std::cout << std::fixed << std::setprecision(15);
    solve();
}

Measured memory_bytes: 3584
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
const ll mod998 = 998244353;
const ll intmax = 2147483647;
const ll llmax = 9223372036854775807;
const char sp = ' ';

int N, M;
string S;
vector<int>v, res;


int main() {
	cin >> N >> M >> S;
	for (int i = 0; i <= N; i++) {
		if (S[i] == '0')v.push_back(i);
	}
	int p = N;
	while (p) {
		int t = *lower_bound(v.begin(), v.end(), p - M);
		if (t == p) {
			cout << -1 << endl;
			return 0;
		}
		res.push_back(p - t);
		p = t;
	}
	for (int i = res.size() - 1; i >= 0; i--) {
		cout << res[i];
		if (i)cout << sp;
	}
	cout << endl;
}

Measured memory_bytes: 1592
# -*- coding: utf-8 -*-

import sys
from bisect import bisect_right

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

N = INT()
P = [p-1 for p in LIST()]
X = LIST()

nodes = [[] for i in range(N)]
for i, p in enumerate(P):
    nodes[p].append(i+1)

# W[(i, j)] := (自分を根とした木の自分側の色の重み, 反対側の色の重み)
W = [None] * N
def calc(u):
    # 葉はどうするか最初から決まってる
    if not nodes[u]:
        return (X[u], 0)

    A = []
    total = 0
    for v in nodes[u]:
        A.append(W[v])
        total += W[v][0] + W[v][1]
    # 自分の子の色をどうするかは自由に決められるはずなので、
    # 部分和を列挙して、一番いい(親に戻す重みが少なくて済むような)値を使う
    n = len(A)
    dp = [set() for i in range(n+1)]
    dp[0].add(0)
    for i in range(n):
        a, b = A[i]
        for s in dp[i]:
            if s <= 5000:
                dp[i+1].add(s+a)
                dp[i+1].add(s+b)
    B = sorted(dp[n])
    idx = bisect_right(B, X[u]) - 1
    # 自分の予定量より大きい重みしかなければNG
    if idx == -1:
        print('IMPOSSIBLE')
        exit()
    a, b = X[u], total - B[idx]
    return (a, b)

def rec(u, prev):
    for v in nodes[u]:
        rec(v, u)
    # 末端から順番に処理していく
    W[u] = calc(u)
rec(0, -1)
# 最後まで行けばOK
print('POSSIBLE')


Measured memory_bytes: 111900
#include<bits/stdc++.h> 
//#define <- プログラムの文字列を置換する
//typedef <- 新しい型に名前を付けるためのキーワード

using namespace std;

#define MAX_N 100000

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

const long long MOD = 1e9 + 7;
const long long INF = 1e15;
const int INF_INT = 1e9;

template<class TYPE>
struct edge{
    TYPE to,cost; 
    edge(TYPE t,TYPE c){
        to = t;
        cost = c;
    }
};

int main(){
    int a,b,c;
    cin >> a >> b >> c;
    if(a == b) cout << c << endl;
    if(a == c) cout << b << endl;
    if(b == c) cout << a << endl;  
    return 0;
}


Measured memory_bytes: 256
h a=read a::Int
f=(<$>getLine)
main=do
 a<-f$map h.words
 f h>>=print.g a
c?d=min(c*2)d
g[t,u,v,w]n=div n 2*p?w+mod n 2*p where p=o?v;o=t?u

Measured memory_bytes: 508
def insert_sort(A):
    a = list(A)
    print(' '.join(map(str, a)))
    for move_index in range(1, len(a)):
        compare_index = move_index -1
        while compare_index >= 0 and a[compare_index] > a[move_index]:
            a[compare_index], a[move_index] = int(a[move_index]), int(a[compare_index])
            compare_index -= 1
            move_index -= 1
        print(' '.join(map(str, a)))
    return a

input()
A = list(map(int, input().split()))
insert_sort(A)


Measured memory_bytes: 5600
#include<bits/stdc++.h>
#define rep(i,N) for(int i=0;i<(N);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int inf = 1e9;
const int mod = 1e9+7;
typedef long long ll;
typedef pair<ll,int> P;
typedef set<int> S;
vector<pair<int,int>> to[100010];
vector<int> ans(100010,0);

void bfs(int now,int p,int col){
    int k = 1;
    for(auto u : to[now]){
        if(u.first==p) continue;
        if(k==col) k++;
        ans[u.second] = k;
        bfs(u.first,now,k);
        k++;
    }
}

int main(){
    int n;
    cin >> n;
    rep(i,n-1){
        int a,b;
        cin >> a >> b;
        a--;b--;
        to[a].push_back({b,i});
        to[b].push_back({a,i});
    }
    int max_size=0;
    rep(i,n) max_size = max(max_size,(int)to[i].size());
    bfs(0,-1,-1);
    cout<<max_size<<endl;
    rep(i,n-1){
        cout<<ans[i]<<endl;
    }
    return 0;
}

Measured memory_bytes: 9472
#include <bits/stdc++.h>
#define WHOLE(v) (v).begin(), (v).end()
#define REV_WHOLE(v) (v).rbegin(), (v).rend()
using i64 = int64_t;
using namespace std;
template<class F>auto recursive(F f){return[f](auto...a){return f(f,a...);};}
template<class T>using rev_priority_queue=priority_queue<T,vector<T>,greater<T>>;
template<class T>using vector2d=vector<vector<T>>;
struct fixprec{int p;fixprec(int p):p(p){}}; ostream&operator<<(ostream&o,fixprec f){return o<<fixed<<setprecision(f.p);}

/*!* [itertools] *!*/
/*+* イテレータの操作 *+*/
template<class I,class V=typename I::value_type>V sum_up(const I&l,const I&r){V v;for(I i=l;i!=r;i++)v=i==l?*i:v+*i;return v;}
template<class I,class T=iterator_traits<I>>I operator+(I it,int n){for(int i=0;i<n;i++)it++;return it;}
template<class I,class T=iterator_traits<I>>I operator-(I it,int n){for(int i=0;i<n;i++)it--;return it;}

int main() {
    i64 K, Q;
    cin >> K >> Q;
    vector<i64> D(K);
    for(i64 &d : D) cin >> d;
    for(int q = 0; q < Q; q++) {
        i64 n, x, m;
        cin >> n >> x >> m;
        i64 len = x % m;
        for(int j = 0; j < K; j++) {
            i64 d = D[j] % m;
            if(d == 0) d = m; // 距離0はmとみなす
            len += d * ((n - 1) / K);
            if(j < (n - 1) % K) {
                len += d;
            }
        }
        i64 ans = n - 1 - len / m;
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 3656
#import sys
#input = sys.stdin.readline
#template input
import bisect

def IT(): #整数1個
    return int(input())
def IL(): #整数複数
    return [int(_) for _ in input().split()]
def IS(): #文字列複数
    return [_ for _ in input().split()]
def ILS(n): #整数1つ　縦にズラーってなってるやつ
    return [int(input()) for _ in range(n)]
def SLS(n): #文字列　縦にズラーってなってるやつ
    return [input() for _ in range(n)]
def ILSS(n): #整数複数　縦にズラーってなってるやつ
    return [[int(_) for _ in input().split()] for j in range(n)]

#template technique
def bit_full_search(ss):
    n = len(ss)
    for i in range(1 << n):
        s = ""
        for j in range(n + 1):
            if ((1 & i >> j) == 1):
                s += ss[j]
        print(s)
def bit_full_search2(A):
    #https://blog.rossywhite.com/2018/08/06/bit-search/
    value = []
    for i in range(1 << len(A)):
        output = []

        for j in range(len(A)):
            if ((i >> j) & 1) == 1:
                #output.append(A[j])
                output.append(A[j])
        value.append([format(i, 'b').zfill(16), sum(output)])

    value.sort(key=lambda x:x[1])
    bin = [value[k][0] for k in range(len(value))]
    val = [value[k][1] for k in range(len(value))]
    return bin, val
def matching_bisect(list1_val, list2_val, n):
    #2分探索
    j = 0
    for i in range(len(list1_val)):
        j = bisect.bisect_left(list2_val, n - list1_val[i])
        if j < len(list2_val):
            if list1_val[i] + list2_val[j] == n:
                #ans = list2_bin[j] + list1_bin[i]
                break
    return j

"""ここからメインコード"""
def main():
    n, m = IL()
    x = IL()
    x.sort()

    dx = [x[i+1] - x[i] for i in range(m-1)]
    dx.sort()

    ans = 0
    for i in range(m-n):
        ans += dx[i]
    print(ans)


main()


Measured memory_bytes: 13960
x=int(input())
if 400<=x<=599:
  a=8
if 600<=x<=799:
  a=7
if 800<=x<=999:
  a=6
if 1000<=x<=1199:
  a=5
if 1200<=x<=1399:
  a=4
if 1400<=x<=1599:
  a=3
if 1600<=x<=1799:
  a=2
if 1800<=x<=1999:
  a=1
print(a)

Measured memory_bytes: 9180
#include<iostream>
    #include<stdio.h>
    //#include <bits/stdc++.h>
    #include<vector>
    #include<float.h>
    #include<iomanip>
    #include<algorithm>
    #include<string>
    #include<cstring>
    #include<math.h>
    #include<cmath>
    #include<sstream>
    #include<set>
    #include<map>
    #include<queue>
    #include <cassert>
    #include <cmath>

    #define INF 1e9
    #define rep(i,n)for(int i=0;(i)<(int)(n);i++)
    #define REP(i,a,b)for(int i=(int)(a);(i)<=(int)(b);i++)
    #define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;
    #define vec(type,n) vector<type>(n)
    #define vvec(m,n) vector<vector<int>> (int(m),vector<int>(n))

    using namespace std;
    using ll = long long;
    using Graph = vector<vector<int>>;
    using P = pair<int,int>;


    int main(){
      int n;cin>>n;
      auto x = vec(int,n);
      double sum = 0;
      rep(i,n){
          cin>>x[i];
          sum += x[i];
      }
      sum /= n;
      //cout<<sum;
      int s = sum;
      if(sum-s>=0.5)sum = s+1;
      else sum = s;
      int res = 0;
      rep(i,n){
          int a = sum-x[i];
          a = a*a;
          res += a;
      }
      cout<<res;
    }
    


Measured memory_bytes: 256
#include "bits/stdc++.h"
#include <iostream>
#include <string.h>
#include <stdio.h>
#include <map>
#include <vector>
#include <math.h>
#include <algorithm>
#include <queue>
#include <set>
#include <tuple>
using namespace std;

#define FOR(i,init,a) for(int i=init; i<a; i++)
#define rep(i,a) FOR(i,0,a)
#define rrep(i,a) for(int i=a; i>=0; i--)
#define rep1(i,a) for(int i=1; i<=a; i++)
#define cout1(a) cout << a << endl;
#define cout2(a,b) cout << a << " " << b << endl;
#define cout3(a,b,c) cout << a << " " << b << " " << c << endl;
#define cout4(a,b,c,d) cout << a << " " << b << " " << c << " " << d << endl;
#define mem(a,n) memset( a, n, sizeof(a))
#define all(a) a.begin(),a.end()
#define chmin(a,b) a=min(a,b);
#define chmax(a,b) a=max(a,b);

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> V;
typedef vector<V> VV;
typedef vector<VV> VVV;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LLINF = 1e18;
static const double pi = 3.141592653589793;

int N, mx=-INF, mn=INF;
map<int,int> dic;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    cin>>N;
    rep(i,N){
        int x; cin>>x;
        chmax(mx,x);
        chmin(mn,x);
        dic[x]++;
    }
    
    bool f=1;
    if(dic.size()>=3) f=0;
    if(mx-mn>1) f=0;
    if(mx>=N) f=0;
    if(mx<=0) f=0;
    if(f){
        if(mx==mn){
            if(mx!=N-1&&mx!=1&&mx*2>N) f=0;
        }else{
            int x=dic[mn];
            int y=dic[mx];
            if(!(x<mx&&2*(mx-x)<=y)) f=0;
        }
    }
    cout1((f?"Yes":"No"))
}


Measured memory_bytes: 4992
n, m = gets.split(" ").map(&:to_i)
ary = []
m.times do
  ary << gets.split(" ").map(&:to_i)
end
 
ary_one = []
ary_n = []
 
ary.each do |x|
  if x[0] == 1
    ary_one << x[1]
  elsif x[1] == n
    ary_n << x[0]
  end
end
 
if !(ary_one & ary_n).empty?
  puts "POSSIBLE"
else
  puts "IMPOSSIBLE"
end

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

int main() {
  string n;
  cin >> n;
  int a, b, c, d;
  a = n[0]-'0';
  b = n[1]-'0';
  c = n[2]-'0';
  d = n[3]-'0';

  if (a+b+c+d==7) { printf("%d+%d+%d+%d=7",a, b, c, d); }
  else if (a-b+c+d==7) { printf("%d-%d+%d+%d=7",a, b, c, d); }
  else if (a+b-c+d==7) { printf("%d+%d-%d+%d=7",a, b, c, d); }
  else if (a+b+c-d==7) { printf("%d+%d+%d-%d=7",a, b, c, d); }
  else if (a-b-c-d==7) { printf("%d-%d-%d-%d=7",a, b, c, d); }
  else if (a+b-c-d==7) { printf("%d+%d-%d-%d=7",a, b, c, d); }
  else if (a-b+c-d==7) { printf("%d-%d+%d-%d=7",a, b, c, d); }
  else if (a-b-c+d==7) { printf("%d-%d-%d+%d=7",a, b, c, d); }

  return 0;
}


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

using namespace std;

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin>>n;
    vector<int>v(n);
    for(int i=0;i<n;i++)
        cin>>v[i];
    unordered_map<int,int>mp;
    long long ttl=0ll;
    for(int i=1;i<n;i++){
        int dif=(i-v[i])-v[0];
        mp[dif]++;
        if(dif==0)
            ttl++;
    }

    for(int i=1;i<n;i++){
        int dif=(i-v[i])-v[0];
        mp[dif]--;
        ttl+=(long long)mp[i+v[i]-v[0]];
    }
    cout << ttl << endl;
    return 0;
}
/***
32
3 1 4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5

6
2 3 3 1 3 1
*/


Measured memory_bytes: 19188
#include <iostream>
#include <utility>
#include <algorithm>
#define MAX 22500
#define rep(i,p) for(int i=0;i<p;i++)
#define rep1(i,p) for(int i=1;i<=p;i++)
using namespace std;
int n,temp,a,b,size,ra,rb;
int A[MAX];
int B[MAX];
int W[MAX];
int V[MAX];
pair<int,int> edge[MAX];
int root (int child) {
  int a = child;
  while (V[a] != a) {
    a = V[a];
  }
  return a;
}
int main(){
  size = 0;
  cin >> n;
  rep(i,n) {
    rep(j,n) {
      cin >> W[size];
      if (i <= j && W[size] != -1) { 
        A[size] = i;
        B[size] = j;        
        edge[size].first = W[size];
        edge[size].second = size;
        size++;
      }
    }
  }
  // rep(i,size) {
  //   cout << A[edge[i].second] << " " << B[edge[i].second]
  //        << " " << edge[i].first << endl;;
  // }
  // sort by lenght of edge
  sort(edge, edge+size);
  
  int sum = 0;
  rep(i,n) V[i] = i;
  rep(i,size) {
    temp = edge[i].second;
    // a , b : vertex
    a = A[temp];
    b = B[temp];
    ra = root(a);
    rb = root(b);
    if (ra != rb) {
      // ?????????????????????
      sum += edge[i].first;
      V[ra] = rb;
    }
  }
  cout << sum << endl;
  return 0;
}

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

b=[]
sum=0
for i in range(n):
  sum += a[i]
  b.append(sum)

j=0
while b[j] <= (sum//2):
  j += 1

ans1=abs(sum - 2*b[j])
ans2=10**10
if j!=0:
  ans2=abs(sum -2*b[j-1])
  
ans = min(ans1,ans2)
print(ans)


Measured memory_bytes: 26764
#include <stdio.h>
int main(void){
    int a,b,c;
    scanf("%d %d %d\n",&a,&b,&c);
    if(a<=b && b<=c){
        printf("%d %d %d\n",a,b,c);
    }
    else if(a<=c && c<=b){
        printf("%d %d %d\n",a,c,b);
    }
   else if(b<=a && a<=c){
       printf("%d %d %d\n",b,a,c);
   }
    else if(b<=c && c<=a){
        printf("%d %d %d\n",b,c,a);
    }
    else if(c<=a && a<=b){
        printf("%d %d %d\n",c,a,b);
    }
    else if(c<=b && b<=a){
        printf("%d %d %d\n",c,b,a);
    }
        return 0;
    }

Measured memory_bytes: 600
#include <iostream>

using namespace std;

#define MAX 500000
#define SENTINEL 2000000000

int L[MAX / 2 + 2], R[MAX / 2 + 2];
int cnt;

void merge(int A[], int n, int left, int mid, int right) {
    int n1 = mid - left;
    int n2 = right - mid;
    for (int i = 0; i < n1; ++i) L[i] = A[left + i];
    for (int i = 0; i < n2; ++i) R[i] = A[mid + i];
    L[n1] = R[n2] = SENTINEL;
    int i = 0, j = 0;
    for (int k = left; k < right; ++k) {
        ++cnt;
        if (L[i] <= R[j]) {
            A[k] = L[i++];
        }
        else {
            A[k] = R[j++];
        }
    }
}

void mergeSort(int A[], int n, int left, int right) {
    if (left + 1 < right) {
        int mid = (left + right) / 2;
        mergeSort(A, n, left, mid);
        mergeSort(A, n, mid, right);
        merge(A, n, left, mid, right);
    }
}

int main()
{
    int A[MAX], n, i;
    cnt = 0;

    cin >> n;
    for (i = 0; i < n; ++i) cin >> A[i];

    mergeSort(A, n, 0, n);

    for (i = 0; i < n; ++i) {
        if (i) cout << " ";
        cout << A[i];
    }

    cout << endl;

    cout << cnt << endl;

    return 0;
}


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

#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
#define FOR(i, m, n) for(int i = (m); i < (int)(n); ++i)
#define ALL(x) (x).begin(), (x).end()
#define INF 2000000000

#ifdef LOCAL
  #define eprintf(...) fprintf(stdout, __VA_ARGS__)
#else
  #define eprintf(...) 0
#endif

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef unsigned int uint;

int ctoi(char c) {
  return c - '0';
}

template <class C>
void printContainer(C &container, const char *delim=",") {
  for(const auto &e : container) {
    std::cout << e << delim;
  }
  std::cout << "\n";
}

// Greatest common divisor
template<class T>
T gcd(T x, T y) {
  if(x < y) {
    std::swap(x, y);
  }
  T r = x % y;
  while(r != 0) {
    x = y;
    y = r;
    r = x % y;
  }
  return y;
}

// Least common multiple
template<class T>
T lcm(T x, T y) {
  return (x*y)/gcd(x,y);
}

int main() {
  string s;
  cin >> s;
  string ans = s[0] == s[2] ? "Yes" : "No";
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
function sumArray (array) {
	return array.reduce((a, c) => a + c);
}

// inputに入力データ全体が入る
function Main(input) {
	var S = input.split('').map(val => parseInt(val));
	var nums = [];
	for (var i = 0; i <= S.length - 3; i++) {
		nums.push(parseInt([S[i], S[i+1], S[i+2]].join('')));
	}
	console.log(Math.min(...nums.map(val => {
		return Math.abs(753 - val);
	})));
}

// ※この行以降は編集しない (標準入力から一度に読み込みMainを呼び出します)
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

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

#include <fstream>
using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << setprecision(20) << fixed;
  /*
  ifstream in("input.txt");
  cin.rdbuf(in.rdbuf());
  //*/
  int x1, y1, x2, y2;
  cin >> x1 >> y1 >> x2 >> y2;
  int xdif = x1 - x2, ydif = y1 - y2;
  cout << x2 + ydif << " " << y2 - xdif << " " << x1 + ydif << " " << y1 - xdif<<endl;
}

Measured memory_bytes: 3624
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Text;
using System.Text.RegularExpressions;
using System.Linq;
using System.IO;

class Program
{ 
    static void Main(string[]args)
    {
        Magatro alice = new Magatro();
        alice.Scan();
        alice.Solve();
    }
}

public class Scanner
{
    private StreamReader Sr;
    private string[] S;
    private int Index;
    private const char Separator = ' ';
    public Scanner()
    {
        Index = 0;
        S = new string[0];
        Sr = new StreamReader(Console.OpenStandardInput());
    }
    private string[] Line()
    {
        return Sr.ReadLine().Split(Separator);
    }
    public string Next()
    {
        string result;
        if (Index >= S.Length)
        {
            S = Line();
            Index = 0;
        }
        result = S[Index];
        Index++;
        return result;
    }
    public int NextInt()
    {
        return int.Parse(Next());
    }
    public double NextDouble()
    {
        return double.Parse(Next());
    }
    public long NextLong()
    {
        return long.Parse(Next());
    }
    public string[] StringArray(int index = 0)
    {
        Next();
        Index = S.Length;
        return S.Skip(index).ToArray();
    }
    public int[] IntArray(int index = 0)
    {
        return StringArray(index).Select(int.Parse).ToArray();
    }
    public long[] LongArray(int index = 0)
    {
        return StringArray(index).Select(long.Parse).ToArray();
    }
    public bool EndOfStream
    {
        get { return Sr.EndOfStream; }
    }
}

public class Magatro
{
    private int N;
    private int[] A;
    public void Scan()
    {
        Scanner sc = new Scanner();
        N = sc.NextInt();
        A = sc.IntArray();
    }

    public void Solve()
    {
        Array.Sort(A);
        HashSet<int> H = new HashSet<int>();
        foreach (int i in A)
        {
            H.Add(i);
        }
        int ans = H.Count;
        if (ans % 2 == 0)
        {
            ans--;
        }
        Console.WriteLine(ans);
    }
}

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

int main() {
  string s; cin >> s; int k; cin >> k;
  for (int i = 0; i < s.size(); ++i) {
    if (i == k - 1) {
      cout << s[i] << endl;
      return 0;
    }
    if (s[i] != '1') {
      cout << s[i] << endl;
      return 0;
    }      
  }
}

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

int main(){
    string a,b;
    cin >> a >> b;
    string ans="EQUAL";
    if(a.length()>b.length()) ans="GREATER";
    else if(a.length()<b.length()) ans="LESS";
    else if(a.length()==b.length()){
        int n=a.length();
        for(int i=0; i<n; i++){
            if(a.at(i)-'0'>b.at(i)-'0'){
                ans="GREATER";
                break;
            }
            else if(a.at(i)-'0'<b.at(i)-'0'){
                ans="LESS";
                break;
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3632
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <deque>
#include <fstream>
#include <functional>
#include <iostream>
#include <istream>
#include <iterator>
#include <sstream>
#include <list>
#include <map>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iomanip>
using namespace std;

#define BR "\n"
#define REP(i, n) for(int (i)=0;(i)<(n);++(i))
#define ALL(cont) begin(cont),end(cont)
#define AS_MOD(a, b) ((((a) % (b) ) + (b)) % (b))
#define MO(a) AS_MOD(a,mod)
#define FEACH(it, cont) for(auto (it) = begin(cont); it!=end(cont);++it)
#define FEACHR(it, cont) for(auto (it) = rbegin(cont); it!=rend(cont);++it)
#define pb push_back
#define pob pop_back
#define fi first
#define se second
#define getll() ([](){ll s;scanf("%lld", &s);return s;})()
#define getld() ([](){ld s;scanf("%Lf", &s);return s;})()
#define prl(P) printf("%lld", P)
#define prd(P) printf("%.10Lf", P)
#define pr(P) printf(P)
#define MAX(V, T) V=max(V,T)
#define MIN(V, T) V=min(V,T)

#define PrintArray(cont, from, to) for(int __i=from;__i<to;++__i) {cout<<"(" <<__i<<": " << cont[__i]<<")";} cout<<endl;
#define PrintPairs(cont, from, to) for(int __i=from;__i<to;++__i) {cout<<"(" <<__i<<": " << cont[__i].fi <<"," << cont[__i].se<<")";} cout<<endl;
#define Print(v) cout<<v<<endl;
#define PDBG() cout<<"Line:"<<__LINE__<<endl;
#define PrintArray2D(cont, fh, th, fw, tw) for(int __i=fh;__i<th;++__i){for(int __j=fw;__j<tw;++__j) {cout<<cont[__i][__j]<<" ";} cout<<endl;}cout<<endl;
#define Resize2D(cont,H,W,V) cont.resize(H);for(int i=0;i<H;++i)cont[i].resize(W,V);
#define Resize3D(cont,H,W,D,V) cont.resize(H);for(int i=0;i<H;++i)cont[i].resize(W);for(int i=0;i<H;++i)for(int j=0;j<W;++j)cont[i][j].resize(D,V);
/*
 * ***_bound(6)
 * 5 6 6 6 6 6 7 7 7
 *   ^lower    ^upper
 * void reverse(c.begin(), c.end())
 *
 * graph
 * seg tree
 * dp
 * brute force
 * priority_queue<int,vector<int>, greater<int>> Q;
 */
struct Comparator{
    int operator()(int l, int r) const {
        return r<l;
    }
};
/*
struct PairComp{
    int operator()(P l, P r) const {
        return l.fi==r.fi?l.se<r.se:l.fi<r.fi;
    }
};*/
struct Vec;
//set<int, Comparator> S;




// solution below
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<P,ll> PP;
int main() {
    cout.precision(15);
    cout << fixed;
    string S,T;
    cin >> S >>T;
    ll ans=0;
    REP(i,S.size()) {
        if (S[i]!=T[i])ans++;
    }
    cout<<ans<<endl;
}


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

int main() {
  int A, B;
  string op;
  int kekka;
  cin >> A >> op >> B;
  
  if(op == "+"){
    kekka = A + B;
  }
  else kekka = A - B;
  
  cout << kekka << endl;
}


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

#define M 1000001
#define L 14

char H[M][L]; /* Hash Table */

int getChar(char ch){
  if ( ch == 'A') return 1;
  else if ( ch == 'C') return 2;
  else if ( ch == 'G') return 3;
  else if ( ch == 'T') return 4;
  
  return 0;
}

/* convert a string into an integer value */
long long getKey(char str[]){
  long long sum = 0, p = 1, i;
  for ( i = 0; i < strlen(str); i++ ){
    sum += p*(getChar(str[i]));
    p *= 5;
  }
  return sum;
}

int h1(int key){ return key%M; }
int h2(int key){ return (1 + key%(M-1)); }

int find(char str[]){
    int key = getKey(str);
    
    for(int i = 0;; i++ ){
        int h = (h1(key) + i * h2(key)) % M;
        if(strcmp(str, H[h]) == 0) return 1;
        else if(strlen(H[h]) == 0) return 0;
    }
    
    return 0;
}

int insert(char str[]){
    int key = getKey(str);
    
    for(int i = 0;; i++ ){
        int h = (h1(key) + i * h2(key)) % M;
        if(strlen(H[h]) == 0){
            strcpy(H[h], str);
            return 1;
        }
    }
    
    return 0;
}

int main(){
    int i, n;
    char str[L], com[9];
    for (i = 0; i < M; i++ ) H[i][0] = '\0';
    
    scanf("%d", &n);
    
    for (i = 0; i < n; i++ ){
    	scanf("%s %s", com, str);
    	
    	if ( com[0] == 'i' ){
    	    insert(str);
    	} else {
    	    if (find(str)){
    		printf("yes\n");
    	    } else {
    		printf("no\n");
    	    }
    	}
    }

    return 0;
}


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

int main(void)
{
	string s;
	cin >> s;
	set<int> a;

	for(int i = 0; i < s.size(); i++)
		a.insert(s.at(i));
	if (a.size() != 2)
		cout << "No" << endl;
	else
		cout << "Yes" << endl;
	return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python3
n = int(input())
a = [ int(input()) for _ in range(2**n) ]
while len(a) != 1:
    b = []
    for i in range(0, len(a), 2):
        if a[i] == a[i+1]:
            b += [ a[i] ]
        else:
            b += [ abs(a[i] - a[i+1]) ]
    a = b
print(*a)


Measured memory_bytes: 18728
#include<iostream>
#include<vector>
#include<string>
#include<map>
#include <cstdio>

#include <algorithm>
#define mx 9*1000000000LL*1000000000

using namespace std;
    string s;
int main(){
    cin>>s;
    int n = s.size();
    int res=0;
    for(int i=0; i<n; i++){
	if(i%2){
	    if(s[i]=='g')res++;
	}else{
	    if(s[i]=='p')res--;
	}
    }
    cout<<res;
}

Measured memory_bytes: 512
import collections
i = int(input())
blue = [input() for b in range(i)]
l = int(input())
red = [input() for r in range(l)]
bluecount = collections.Counter(blue)
redcount = collections.Counter(red)

c = 0
for i, j in bluecount.items():
    c = max(j-redcount[i], c)
print(c)


Measured memory_bytes: 9448
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>

using namespace std;

int main() {
    int p[5],m = 100000;
    for(int i = 0;i < 5;i++) cin >>p[i];
    sort(p,p+5);
    do {
        int ct = 0;
        for(int i = 0;i < 5;i++) {
            ct += p[i];
            if(ct % 10 != 0 && i != 4) ct = ct - (ct % 10) + 10;
        }
        if(ct < m) m = ct;
    } while(next_permutation(p,p+5));
    cout << m << endl;
}

Measured memory_bytes: 256
#include  <bits/stdc++.h>
using namespace std;
static int fast_io = []() { std::ios::sync_with_stdio(false); cin.tie(nullptr); return 0; }();
int main(){
  string a,b,c;
  cin>>a>>b>>c;
  cout<<a[0]<<b[0]<<c[0]<<"\n";  
  
  return 0;
}

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

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    string s;
    int d = 0;
    cin >> s;
    for(int i = 0 ; i<(int)s.size() - 1; i++){	
		if(s[i] == s[i + 1]){	
			d++;
		}
	}
	if(d != 0){	
		cout << "Bad";
	}else{	
		cout << "Good";
	}
  
    return 0;
}


Measured memory_bytes: 256