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

#define REP(i, x, n) for (int i = x; i < (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x.size())
#define popcount(x) __builtin_popcount(x)
#define popcountll(x) __builtin_popcountll(x)
#define uniq(x) x.erase(unique(x.begin(), x.end()), x.end())
#define F first
#define S second
#define mp make_pair
#define eb emplace_back
#define pii pair<int, int>
#define pll pair<ll, ll>

using namespace std;

typedef long long ll;

/* --- INFの値が適切か確認する --- */
// const int INF = 1 << 30;
// const ll INF = 1LL << 60;
// const int MOD = 1000000007;

int main() {
  int a, b;
  cin >> a >> b;
  int ans = 0;
  int cnt = 1;
  while (cnt < b) {
    cnt = cnt - 1 + a;
    ans++;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
using System;
class ProgramB
    {
        static void Main(string[] args)
        {
            
            //入力
            string s = Console.ReadLine();
            int count = 0;

            for(int i = 0;i < s.Length/2;i++)
            {
                if(s[i] != s[s.Length - 1 - i])
                    count++;
            }

            Console.WriteLine(count);
            
                
        }
    }

Measured memory_bytes: 13140
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define whole(x) (x).begin(),(x).end()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
using ll = long long;
using P = pair<int, int>;
#define debug(var) cout << "[" << #var << "] " << var << endl
const ll mod = 1000000007;


int main(){
    int n;
    cin >> n;
    vector<int> p(n);
    vector<int> pos(n);
    rep(i, n) {
        cin >> p[i];
        pos[p[i]-1] = i;
    }
    
    set<int> s;
    ll ans = 0;

    for (int i=n-1; i>=0; i--) {
        int x = pos[i];
        if (s.size()==0) {
            s.insert(x);
            continue;
        }
        auto it = s.upper_bound(x);
        ll l1, l2, r1, r2;
        if (it!=s.end()) {
            r1 = *it;
            it++;
            if (it!=s.end()) {
                r2 = *it;
            }
            else {
                r2 = n;
            }
            it--;
        }
        else {
            r1 = n;
            r2 = n;
        }
        if (it!=s.begin()) {
            it--;
            l2 = *it;
            if (it!=s.begin()) {
                it--;
                l1 = *it;
            }
            else {
                l1 = -1;
            }
        }
        else {
            l1 = -1;
            l2 = -1;
        }
        ans += (l2-l1) * (r1-x) * (i+1);
        ans += (r2-r1) * (x-l2) * (i+1);
        s.insert(x);
        //debug(ans);
    }
     
    
    
    
    
    cout << ans << endl;
    return 0;
}


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

int main() {
  ll h, n;
  cin >> h >> n;

  ll a;
  ll total = 0;
  for (ll i = 0; i < n; i++) {
    cin >> a;
    total += a;
  }

  if (total >= h) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<iostream>
#include<map>
#include<vector>
#include <bitset>
#include<math.h>
#include<queue>
using namespace std;
#define MAX 300000
#define INF 3000
typedef long long ll;
typedef pair<int,int> P;




int main(){
  int N,a,b;
  cin>>N;
  P A[200],B[200];
  for(int i=0;i<N;i++){
    cin>>a>>b;
    A[i]=make_pair(a,b);
  }
  for(int i=0;i<N;i++){
    cin>>a>>b;
    B[i]=make_pair(a,b);
  }

  sort(B,B+N);

  int temp=-1,num,ans=0;

  for(int i=0;i<N;i++,temp=-1){
    for(int j=0;j<N;j++){
      if(B[i].first>A[j].first && temp<A[j].second && B[i].second>A[j].second){
        temp=A[j].second;
        num=j;
      }
    }
    if(temp!=-1){
      ans++;
      A[num].first=1000;
    }
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10 ** 6)
import sys
def input():
    return sys.stdin.readline()[:-1]
N , Q = map(int,input().split())
graph = [[] for _ in range(N)]
point = [0] * N
for _ in range(N - 1):
    a , b = map(int,input().split())
    graph[a - 1].append(b - 1)
    graph[b - 1].append(a - 1)
#print(graph)
for _ in range(Q):
    a , b = map(int,input().split())
    a = a - 1
    point[a] += b
# dfsを用いて累積和を計算する
# 初期状態だと前の値がないためデフォルト引数に-1を代入
def dfs(now , prev = -1):
    for next in graph[now]:
        # 次のノードが前に参照した値の時はcontinue
        if next == prev:
            continue
        # 現在の値を次のポイントに加算することで累積和をとる
        point[next] += point[now]
        # 次のノードと現在のノードを引数にdfsを継続する
        dfs(next , now)

dfs(0)
print(*point)

Measured memory_bytes: 268432
#include <bits/stdc++.h>
#define REP(i, a, n) for(ll i=a; i<n; i++)
#define RREP(i, a, n) for(ll i=n-1; i>=a; i--)
typedef long long ll;
const ll mod =1e9+7;
const ll inf =1e18;
using namespace std;

ll a, b, c;
int main() {
    cin>>a>>b>>c;

    if(a*a+b*b==c*c){
        cout<<a*b/2<<endl;
    }
    else if(a*a==c*c+b*b){
        cout<<b*c/2<<endl;
    }
    else{
        cout<<c*a/2<<endl;
    }
    return 0;
}

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

#define crap ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define db1(x) cout<<#x<<"="<<x<<'\n'
#define db2(x,y) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<'\n'
#define db3(x,y,z) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<","<<#z<<"="<<z<<'\n'
#define rep(i,n) for(int i=0;i<(n);++i)
#define repA(i,a,n) for(int i=a;i<=(n);++i)
#define repD(i,a,n) for(int i=a;i>=(n);--i)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define CN cout<<"No\n"
#define CY cout<<"Yes\n"

using namespace std;
using ll = long long;
void solve()
{
    ll n; cin>>n;
    vector<ll>v(n);
    rep(i,n)cin>>v[i];
    ll ans=0;
    ll ma=0;
    for(int i=0;i<n;i++)
    {
        if(ma<v[i]) ma=v[i];
        else ans+=(ma-v[i]);
    }
    cout<<ans<<"\n";
}
int main()
{
    crap;
    #ifndef ONLINE_JUDGE
        freopen("input.txt","r", stdin) ;
        freopen("output.txt","w", stdout) ;
        freopen("error.txt","w", stderr) ;
    #endif
    int t;t=1;
 //  cin>>t;
    while(t--)
        {solve();}
    return 0;
}

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

const int mod = 1000000007;
struct mint {
    long long x;
    mint(long long x=0):x((x%mod+mod)%mod){}
    mint operator-() const { return mint(-x);}
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod-a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
    mint operator+(const mint a) const { return mint(*this) += a;}
    mint operator-(const mint a) const { return mint(*this) -= a;}
    mint operator*(const mint a) const { return mint(*this) *= a;}
    mint pow(long long t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }
    mint inv() const { return pow(mod-2);}
    mint& operator/=(const mint a) { return *this *= a.inv();}
    mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

struct combination {
    vector<mint> fact, ifact;
    combination(int n):fact(n+1),ifact(n+1) {
        assert(n < mod);
        fact[0] = 1;
        for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
        ifact[n] = fact[n].inv();
        for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
    }
    mint operator()(int n, int k) {
        if (k < 0 || k > n) return 0;
        return fact[n]*ifact[k]*ifact[n-k];
    }
};

vector<mint> dp;
vector<int> re;

mint f(int n)
{
    if(n < 3) return 0;
    if(re[n]) return dp[n];
    mint ret = 1;
    for (int i = 3; i < n; i++)
    {
        ret += f(n-i);
    }
    dp[n] = ret;
    re[n] = 1;
    return ret;
}

void Main()
{
    int s;
    cin >> s;
    dp.resize(s+1);
    re.resize(s+1);
    mint ans = f(s);

    cout << ans << endl;
}

int main(int argc, char **argv)
{
    ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    Main();
    return 0;
}


Measured memory_bytes: 3580
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();

		int fiveNum = (a == 5 ? 1 : 0) + (b == 5 ? 1 : 0) + (c == 5 ? 1 : 0);
		int sevenNum = (a == 7 ? 1 : 0) + (b == 7 ? 1 : 0) + (c == 7 ? 1 : 0);
		System.out.println((fiveNum == 2 && sevenNum == 1) ? "YES" : "NO");
	}
}

Measured memory_bytes: 8788
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
int main(){
  ll ans=0;
  string s;
  cin>>s;
  ll count=0;
  for(int i=0;i<s.size();i++){
    if(s[i]=='W'){
      ans+=i-count;
      count++;
    }
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 3724
import java.util.*;

public class Main {
    static Scanner scanner = new Scanner(System.in);

    public static void main(String[]$) {
        long s = scanner.nextLong();
        long diff = Integer.MAX_VALUE;
        for (long i = 1; i <= s; i *= 10) {
            diff = Math.min(diff, Math.abs(753 - s / i % 1000));
        }
        System.out.println(diff);
    }
}

Measured memory_bytes: 21716
package main

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

var sc *bufio.Scanner

const BufferSize = 1024

func nextString() string {
	if !sc.Scan() {
		panic(nil)
	}
	return sc.Text()
}

func nextInt() int {
	if !sc.Scan() {
		panic(nil)
	}
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

var production bool

func debugf(format string, v ...interface{}) {
	if !production {
		fmt.Printf(format, v...)
	}
}

func answer(reader io.Reader, writer io.Writer) {
	sc = bufio.NewScanner(reader)
	buf := make([]byte, BufferSize)
	sc.Buffer(buf, 1e+6)
	sc.Split(bufio.ScanWords)
	n := nextInt()
	s := map[string]int{}

	max := 0
	for i := 0; i < n; i++ {
		st := nextString()
		s[st]++
		if max < s[st] {
			max = s[st]
		}
	}

	a := make([]string, 0)

	for i := range s {
		if s[i] == max {
			a = append(a, i)
		}
	}

	sort.Strings(a)
	for i := range a {
		_, _ = fmt.Fprintf(writer, "%s\n", a[i])
	}
}

func main() {
	production = true
	answer(os.Stdin, os.Stdout)
}


Measured memory_bytes: 32656
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <math.h>
#include <map>
#include <queue>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int iINF = 1001001001;
const long long llINF = 1LL << 60;
int main()
{
	// ABC166-E, 1007, 
	int n;
	cin >> n;
	ll ans = 0;
	vector<int> a(n);
	map<int, int> mp;
	rep(i, n) {
		cin >> a[i];
		int b = i + a[i];
		mp[b]++;
	}
	rep(i, n) {
		ans += mp[i - a[i]];
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 21024
#include <stdio.h>
#include <iostream>
#include <string.h>

using namespace std;

int main(){
	int A, B, K;
	cin >> A >> B >> K;

	for (int i = 0; i < K; i++){
		if (i % 2 == 0){
			if (A % 2 == 1){
				A--;
			}
			B = B +  A / 2;
			A = A /2;
		}
		else {
			if (B % 2 == 1){
				B--;
			}
			A = A + B / 2;
			B = B / 2;
		}
	}
	cout << A << " " << B << endl;
}


Measured memory_bytes: 256
k=int(input())
s=input()

mod=10**9+7

import sys
sys.setrecursionlimit(10**9)

def cmb(n, r, p):
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    return fact[n] * factinv[r] * factinv[n-r] % p
p = mod #割る数
N = 2*(10 ** 6)  # N は必要分だけ用意する
fact = [1, 1]  # fact[n] = (n! mod p)
factinv = [1, 1]  # factinv[n] = ((n!)^(-1) mod p)
inv = [0, 1]  # factinv 計算用
for i in range(2, N + 1):
    fact.append((fact[-1] * i) % p)
    inv.append((-inv[p % i] * (p // i)) % p)
    factinv.append((factinv[-1] * inv[-1]) % p)

ans=0

for i in range(k+1):
    ans = (ans+cmb(i+len(s)-1,i,mod)*pow(26,k-i,mod)*pow(25,i,mod)) % mod

    #print(end,len(s)+k-end,ans,cmb(end,len(s),mod),pow(25,end-len(s),mod),pow(26,len(s)+k-end,mod))

print(ans%mod)





Measured memory_bytes: 181668
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i=0; i<(int)(n); i++)
#define all(x) x.begin(), x.end()
#define mod 1000000007
typedef long long ll;

int main() {
    string str;
    cin >> str;
    set<char> st;
    for(int i=0; i<str.length(); i++){
        st.insert(str[i]);
    }
    if(st.size() == 1) cout << "No" << endl;
    else cout << "Yes" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n) for (int i=0; i<(int)(n); ++i)
#define FOR(i,n,m) for (int i=n; i<(int)(m); ++i)
#define ALL(x) x.begin(), x.end()
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define in(i, n) (0 <= (i) && (i) < (n))
#define on(bit, i) (((bit >> i) & 1) == 1)

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef long double ld;
const int INF = 1e9+7;

int K, T;
int a[100];

int main(void) {
  cin >> K >> T;
  REP(i, T) cin >> a[i];
  sort(a, a + T);
  reverse(a, a + T);
  int ma = a[0] - 1, sum = 0;
  FOR(i, 1, T) sum += a[i];
  cout << max(0, ma - sum) << endl;
  return 0;
}


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


int main() {
    string s;
    cin >> s;
    int res = 700;
    for(int i = 0; i < 3; i++){
        if(s[i] == 'o'){
            res += 100;
        }
    }
    cout << res;
    cout << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
    long long n,m,q,t,x;
    cin>>n>>m;
    queue <long long> a[n];
    for(long long i=0;i<m;i++){
        cin>>q>>t;
        if(q==0){
            cin>>x;
            a[t].push(x);
        }
        else if(q==1){
            if(!a[t].empty()){
                cout<<a[t].front()<<endl;
            }
        }
        else{
            if(!a[t].empty()){
                a[t].pop();
            }
        }
    }
    
    return 0;
}


Measured memory_bytes: 5188
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.PrintWriter;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) throws Exception {
        try (BufferedInputStream in = new BufferedInputStream(System.in);
             PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out))) {

            Scanner sc = new Scanner(in);

            // 10:34-

            long l = sc.nextLong();
            long r = sc.nextLong();
            long x = 2019;

            if (l == 0 || r / x - (l - 1) / x > 0) {
                out.println(0);
            } else {
                long min = Long.MAX_VALUE;
                for (long i = l; i < r + 1; i++) {
                    for (long j = i + 1; j < r + 1; j++) {
                        min = Math.min(min, (i * j) % x);
                    }
                }
                out.println(min);
            }
        }
    }

}


Measured memory_bytes: 23252
import java.util.*;
import java.io.*;
 
public class Main{
    
	public static void main(String[] $){
		Scanner s = new Scanner(System.in);
		int N = s.nextInt();
		long sum = 0;
		long[] S = new long[100000+1];
		for(int i = 0; i < N; i++){
			int A = s.nextInt();
			sum += A;
			S[A]++;
		}

		int Q = s.nextInt();
		StringBuilder sb = new StringBuilder();
		for(int i = 0; i < Q; i++){
			int B = s.nextInt();
			int C = s.nextInt();
			int result = C - B;
			sum = sum + S[B]*result;
			S[C] = S[C] + S[B];
			S[B] = 0;
			sb.append(sum + "\n");
		}
		System.out.print(sb.toString());
		
		
			
	}
} 

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

#define MAX 100

int N;
int a[MAX];

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

	double ave = 0;
	for( int i = 0; i < N; i++ ) {
		ave += a[i];
	}
	ave /= N;
	double mi = 100 * 2;
	for( int i = 0; i < N; i++ ) {
		if( mi > abs((double)a[i] - ave) ) {
			mi = abs((double)a[i] - ave);
		}
	}
	int ans = 0;
	for( int i = 0; i < N; i++ ) {
		if( abs((double)a[i] - ave) == mi ) {
			ans = i;
			break;
		}
	}

	cout << ans << endl;

	return 0;
}


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

using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;

// #define MOD 1000000007
#define rp(i,n) for(int i=0;i<(n);i++)
#define up(i,s,e,d) for(int i=(s);i<(e);i+=(d))
// #define ot(x) cout<<(x)
#define ote(x) cout<<(x)<<endl

int main(){
	int H,W,h,w;
	cin>>H>>W>>h>>w;

	int ans = H*W-(h*W+w*H-h*w);
	ote(ans);
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main() {
	int point[100] = { 0 }, n, grade[100] = { 0 };
	int ta, tb, pa, pb;
	cin >> n;
	for (int h = 1; h <= n; h++) {
		grade[h] = n+1;
	}
	for (int i = 0; i < n*(n - 1) / 2; i++) {
		cin >> ta >> tb >> pa >> pb;
		if (pa > pb) point[ta] = point[ta] + 3;
		if (pa < pb) point[tb] = point[tb] + 3;
		if (pa == pb) {
			point[ta] = point[ta] + 1;
			point[tb] = point[tb] + 1;
		}
	}
	for (int k = 1; k <= n; k++) {
		for (int j = 1; j <= n; j++) {
			if (point[k] >= point[j]) grade[k]--;
		}
	}
	for (int g = 1; g <= n; g++) {
		cout << grade[g] << endl;
	}
}

Measured memory_bytes: 3080
void main() {
	auto ip = readAs!(int[]), r = ip[0], D = ip[1], x = ip[2];
	foreach(i; 0..10) {
		x = x * r - D;
		x.writeln;
	}
}
// =======================111=1===========

import std.stdio;
import std.string;
import std.functional;
import std.algorithm;
import std.range;
import std.traits;
import std.math;
import std.container;
import std.bigint;
import std.numeric;
import std.conv;
import std.typecons;
import std.ascii : toLower;
import std.bitmanip;
import core.bitop;

T readAs(T)() if (isBasicType!T) {
	return readln.chomp.to!T;
}

T readAs(T)() if (isArray!T) {
	return readln.split.to!T;
}

T[][] readMatrix(T)(uint height, uint width) if (!isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		res[i] = readAs!(T[]);
	}
	return res;
}

T[][] readMatrix(T)(uint height, uint width) if (isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		auto s = rs;
		foreach(j; 0..width) res[i][j] = s[j].to!T;
	}
	return res;
}

int ri() {
	return readAs!int;
}

double rd() {
	return readAs!double;
}

string rs() {
	return readln.chomp;
}


Measured memory_bytes: 256
#include <iostream>
#include <map>
using namespace std;
using ll = long long;

int main()
{
    string s;
    map<char, int> mp;
    while (cin >> s)
    {
        for (int i = 0; i < s.size(); i++)
        {
            if ('A' <= s[i] && s[i] <= 'Z')
                s[i] = (char)(s[i] + 'a' - 'A');
            mp[s[i]]++;
        }
    }
    for (char i = 'a'; i <= 'z'; i++)
    {
        cout << i << " : " << mp[i] << endl;
    }
}


Measured memory_bytes: 3220
//AUTHOR: RAVAN_2070
//PUNE INSTITUTE OF COMPUTER TECHNOLOGY
/*                                                    
      I ♥ CLARICE STARLING...                                                               
        EXPLAINATION BELOW->
*/
#include<bits/stdc++.h>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vi;
typedef vector<pair<ll,ll>> vii;
typedef pair<ll,ll> pii;
typedef map<ll,ll> mii;
#define MOD7 1000000007
#define MOD9 1000000009
#define pi 3.1415926535
#define Test_cases ll TC;cin>>TC;while(TC--)
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(), x.rend()
#define sp(x) fixed<<setprecision(x)
#define sz(x) (ll)(x.size())
#define fo(i,a,b) for(i=a;i<b;i++)
#define foe(i,a,b) for(i=a;i<=b;i++)
const ll INF = (ll)2e18 + 77;
void solve()
{
    string X;cin>>X;
    int sum=0;
    for(auto c:X)sum=sum+(c-'0');
    if(sum%9)cout<<"No\n";
    else cout<<"Yes\n";
}
int main()
{
   fastio
   //Test_cases
   solve();
  return 0;
}
//**always check if you are not killing input in between
//map<ll,ll,greater<int>> to sort in descending order ,in iterator declaration no greater<int>
//if you want to apply lowerbound on set use s.lower_bound(key),not the one used for vector
// Syntax to create a min heap for priority queue priority_queue <int, vector<int>, greater<int>>; 
//for modinverse use modularexponention(x,M-2,M);
//for "each" subtraction from ans(ans-k) if(ans<0) do ans+=MOD,ans%=MOD
//vector<vector<int>>dp(201,vector<int>(n+1)); A way to initialize vector of vector
//string2=string1.substr(pos,length);if len no specified then till end
//void fill (ForwardIterator first, ForwardIterator last, const T& val);
//The range filled is [first,last), which contains all the elements between first and last, including the element pointed by first but not the element pointed by last.


//If wrong on pretest 2 means logically wrong
/* TIPS FOR DEBUGGING
 * Check if values are not overflowing (use long long where required)
 * Check if ranges are inclusive or not.
 * Check properly if greedy will work or not before using it.
 * Check EDGE CASES!! Seriously, even in 2B, saving 8 points by being
 * 2 minutes faster will bite you in the ass if you don't make sure
 * it works on edge cases.
 * Keep adding to this list.
*/


Measured memory_bytes: 3768
use std::io;
use std::cmp;
use io_ext::Reader;

fn main() {
    let stdin = io::stdin();
    let mut r = Reader::new(io::BufReader::new(stdin.lock()));
    let s: Vec<i32> = r.read_line().split_whitespace().map(|s| s.parse().unwrap()).collect();

    let a = s[0];
    let b = s[1];

    let c = cmp::max(0, a - 2 * b);

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

/// Extension of io module.
pub mod io_ext {
    use std::io::BufRead;

    pub struct Reader<R> {
        buf: String,
        inner: R,
    }

    impl<R> Reader<R> {
        #[inline]
        pub fn new(inner: R) -> Self {
            Reader { buf: String::new(), inner: inner }
        }

        #[inline]
        pub fn into_inner(self) -> R {
            self.inner
        }
    }

    impl<R: BufRead> Reader<R> {
        #[allow(deprecated)]
        #[inline]
        pub fn read_line(&mut self) -> &str {
            self.buf.clear();
            self.inner.read_line(&mut self.buf).unwrap_or_else(|e| panic!("{}", e));
            self.buf.trim_right()
        }
    }
}

/// Module supporting to parse strings.
pub mod parse {
    use std::str::FromStr;
    use std::borrow::Borrow;

    pub trait ParseNext: Iterator {
        fn parse_next<F: FromStr>(&mut self) -> F;
    }

    impl<'a, S: Borrow<str>, I: Iterator<Item=S>> ParseNext for I {
        fn parse_next<F: FromStr>(&mut self) -> F {
            if let Some(s) = self.next() {
                match s.borrow().parse() {
                    Ok(x) => x,
                    Err(_) => panic!("provided string cannot be parsed")
                }
            } else {
                panic!("iterator has no next element")
            }
        }
    }
}


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

const int N = 1e5 + 10;
int n, m, b, c, a[N];
long long sm;
vector<pair<int, int> > v;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
	
	cin >> n >> m;
	
	for (int i = 0; i < n; i++){
		cin >> a[i];
		sm += a[i];
	}
	
	sort(a, a + n);

	for (int i = 0; i < m; i++){
		cin >> b >> c;
		v.push_back({c, b});
	}	
	int j = 0;
	
	sort(v.begin(), v.end());
	reverse(v.begin(), v.end());
	
	for (auto p : v){
		b = p.second, c = p.first;
		
		for (; j < n && b > 0; j++, b--){
			if(a[j] >= c)
				return cout << sm, 0;
			sm -= a[j];
			sm += c;
		}
		
		if(j == n)
			return cout << sm, 0;
	}
	
	cout << sm;
}



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

int main()
{
  string S;
  cin>>S;
  int tf=0;
  string T=S;
  long N,length;
  cin>>N;
  length=S.size();
  sort(T.begin(),T.end());
  if(T[0]==T[length-1]) tf=1;
  int A[1000]={0};
  for(int i=0;i<length;i++){
    if(i==0){
      if(S[0]==S[1])A[0]+=1;
    }
    else if(i==length-1){
      if(S[length-1]==S[length-2])A[length-1]+=1;
    }
    else{
      if(S[i]==S[i-1])A[i]+=1;
      if(S[i]==S[i+1])A[i]+=1;
    }
  }
  int count=0;
  for(int i=0;i<length;i++){
    if(A[i]==2){
      A[i]=0;
      count+=1;
      A[i-1]-=1;
      A[i+1]-=1;
    }
  }
  for(int i=0;i<length;i++){
    if(A[i]==1){
      A[i]=0;
      count+=1;
      if(i==0){
        A[1]=0;
      }
      else if(i==length-1){
        A[i-1]=0;
      }
      else{
        A[i-1]=0;
        A[i+1]=0;
      }
    }
  }
  S+=S;
  long acount=count;
  length=2*length;
  A[1000]={0};
  for(int i=0;i<length;i++){
    if(i==0){
      if(S[0]==S[1])A[0]+=1;
    }
    else if(i==length-1){
      if(S[length-1]==S[length-2])A[length-1]+=1;
    }
    else{
      if(S[i]==S[i-1])A[i]+=1;
      if(S[i]==S[i+1])A[i]+=1;
    }
  }
  count=0;
  for(int i=0;i<length;i++){
    if(A[i]==2){
      A[i]=0;
      count+=1;
      A[i-1]-=1;
      A[i+1]-=1;
    }
  }
  for(int i=0;i<length;i++){
    if(A[i]==1){
      A[i]=0;
      count+=1;
      if(i==0){
        A[1]=0;
      }
      else if(i==length-1){
        A[i-1]=0;
      }
      else{
        A[i-1]=0;
        A[i+1]=0;
      }
    }
  }
  long differ=count-acount;
  if(tf==1) cout<<length*N/4<<endl;
  else cout<<acount+N*differ-differ<<endl;
}


Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
#include <set>
#define MAX(a,b) ((a)>(b))?(a):(b)
using namespace std;


int main() {
	int n,p,q,r,max=-1,w;
	int i,j;
	int c;
	int *sum;
	set<int> under;
	set<int> over;
	bool flag=false;
	scanf("%d%d",&n,&q);
	sum=(int *)malloc(sizeof(int)*n);
	scanf("%d",&w);
	max=sum[0]=w;
	for(i=1; i<n; ++i) {
		scanf("%d",&w);
		max=MAX(w,max);
		sum[i]=sum[i-1]+w;
	}
	if(q==1) {
		printf("%d\n",sum[n-1]);
		return 0;
	}
	p=max;
	while(1) {
		i=0;
		for(c=0; c<q-1; ++c) {
			for(j=0; i+j<n; ++j) {
				if(i==0) {
					if(sum[j]>p) {
						i=j;
						j=0;
						break;
					}
				} else {
					if(sum[i+j]-sum[i-1]>p) {
						i+=j;
						j=0;
						break;
					}
				}
			}
			if(i+j==n-1 && c<q-2) {
				if(p==max || flag) {
					printf("%d\n",p);
					return 0;
				}
				over.insert(p);
				if(flag) {
					++p;
				} else if(!under.empty()) {
					p=((*over.begin())+(*(--under.end())))/2;
				} else {
					p=(max+p)/2;
				}
			}
		}
		r=sum[n-1]-sum[i-1];
		if(r==p) {
			printf("%d\n",p);
			return 0;
		} else if (!flag) {
			if(r<p) {
				over.insert(p);
				if(!under.empty()) {
					p=((*(over.begin()))+(*(--under.end())))/2;
				} else {
					p=r+(p-r)/2;
				}
			} else if(r>p) {
				if((!over.empty() && !under.empty() && (*(over.begin()))-(*(--under.end()))<=10) || r-p<=10 ) {
					flag=true;
					under.insert(p);
					++p;
				} else {
					under.insert(p);
					if(!over.empty()) {
						p=((*(over.begin()))+(*(--under.end())))/2;
					} else {
						p=p+(r-p)/2;
					}
				}
			}
		} else {
			if(r>p) {
				++p;
			} else {
				printf("%d\n",p);
				return 0;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 3180
import java.util.Scanner;
 
public class Main {
	static Scanner sc = new Scanner(System.in);
    public static void main(String[] args) {
    	Main app=new Main();
        
       
        app.move();
        
       
    }
    static int count;
    void move(){
    	 while(true) {
    		 int n = sc.nextInt();
    		 if(n==0) break;
             long temp=1;
             int count=0;
             for(int i=n; i>1; i--) {
                 temp *= i;
                 if(temp > 1000000000) temp %= 1000000000;
                 while(temp%10 == 0) {
                     count++;
                     temp /= 10;
                 }
             }
             System.out.println(count);
         }
    	
    	
    }
}

Measured memory_bytes: 18508
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.Scanner;
import java.util.AbstractMap.SimpleEntry;
import java.util.HashSet;
import java.util.Iterator;

class Main {

    static final int MOD = 1000000007;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        
        long[] ironbar = new long[N+1];
        long[] iron = new long[N+1];
        for (int i = 0; i < N; i++) {
            long num = sc.nextInt();
            ironbar[i+1] = num;
            iron[i+1] = iron[i] + num;
        }
        // System.out.println(Arrays.toString(iron));
        // System.out.println(Arrays.toString(iron));
        long sum =  iron[N];
        long half = sum/2+sum%2;
        int mid = N;
        for (int i = 0; i <= N; i++) {
            if(half <= iron[i]){
                mid=i;
                break;
            }
        }
        if(Math.abs(iron[mid-1]-half) < Math.abs(iron[mid]-half) ){
            mid=mid-1;
        }
        if(mid==0)mid++;
        if(mid==N)mid--;
        // System.out.println(iron[mid]);        
        long left = iron[mid];
        long right = iron[N]-iron[mid];
        // System.out.println(left);        
        // System.out.println(right);
        System.out.println(Math.abs(left-right));
    }
}

Measured memory_bytes: 92676
#include<iostream>
#include<string>
#include<algorithm>
#include<functional>
#include<bitset>
#include<iomanip>
#include<vector>
#include<set>
#include<map>
#include<list>
#include<stack>
#include<queue>
#include<deque>
#include<cstdio>
#include<cstdlib>
#include<cmath>
using namespace std;

int main(){
    double sx, sy, ex, ey;
    cin >> sx >> sy >> ex >> ey;
    double ans = sqrt(pow(sx-ex,2) + pow(sy-ey,2));
    cout << setprecision(10) << ans << endl;
    return 0;
}


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

int main(void) {
	int A,B,C,D;
	cin >> A >> B >> C >> D;

if((A+B) > (C+D)) {
	cout << "Left" << endl;
}else if((A+B) < (C+D)) {
	cout << "Right" << endl;
}else{
	cout << "Balanced" << endl;
}
return 0;
}

Measured memory_bytes: 256
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())
MIN = min([a,b,c,d,e])
MAX = max([a,b,c,d,e])
if MAX - MIN <= k:
  print('Yay!')
else:
  print(':(')

Measured memory_bytes: 3064
package main
 
import (
	"bufio"
	"fmt"
	"log"
	"os"
	"strconv"
	"math"
)
 
func run() {
	n := nextFloat()
	
	Println(math.Pow(n, 3))
}
 
// --- template ---
// Thanks https://gist.github.com/halllllll/853ab587fd82ee3ffe6f7fb7fb499695
 
var sc = bufio.NewScanner(os.Stdin)
var out = bufio.NewWriter(os.Stdout)
 
// Caution: You will get unexpected result if a single token is larger than this size.
const BufferSize = 64 * 1024 * 1024
 
func Print(a ...interface{}) (n int, err error) {
	return fmt.Fprint(out, a...)
}
 
func Printf(format string, a ...interface{}) (n int, err error) {
	return fmt.Fprintf(out, format, a...)
}
 
func Println(a ...interface{}) (n int, err error) {
	return fmt.Fprintln(out, a...)
}
 
func next() string {
	sc.Scan()
	return sc.Text()
}
 
func nextInt() int {
	a, err := strconv.Atoi(next())
	if err != nil {
		log.Fatal(err)
	}
	return a
}
 
func nextFloat() float64 {
	a, err := strconv.ParseFloat(next(), 64)
	if err != nil {
		log.Fatal(err)
	}
	return a
}
 
func main() {
	sc.Buffer(make([]byte, 0, BufferSize), BufferSize)
	sc.Split(bufio.ScanWords)
	run()
	out.Flush()
}

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

#define MOD 1000000007
#define ll long long int
#define vi vector<int>
#define vii vector< vector<int> >
#define PI 3.1415926535897932384626433832795
#define INF 9223372036854775807LL


int main() {
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	int n,c;
	cin >> n >> c;
	vector<vector<pair<int,int> > > rec(c+1,vector<pair<int,int> >());
	for(int i = 0; i < n; i++) {
		int s,t,ch;
		cin >> s >> t >> ch;
		rec[ch].push_back({s,t});
	}
	vector<pair<int,int> > all;
	for(int i = 1; i <= c; i++) {
		if(!rec[i].empty()) {
			sort(rec[i].begin(),rec[i].end());
			int from = rec[i][0].first;
			int to = rec[i][0].second;
			for(int j = 1; j < rec[i].size(); j++) {
				if(rec[i][j].first != to) {
					all.push_back({from,to});
					from = rec[i][j].first;
				}
				to = rec[i][j].second;
			}
			all.push_back({from,to});
		}
	}
	sort(all.begin(),all.end());
	int ans = 0;
	int curr = 0;
	int currpos = 0;
	multiset<int> ends;
	for(int tim = 0; tim <= 100000; tim++) {
		curr-= ends.count(tim);
		while(currpos < all.size() && all[currpos].first == tim) {
			curr++;
			ends.insert(all[currpos].second+1);
			currpos++;
		}
		ans = max(ans,curr);
	}
	cout << ans;
	return 0;
}



Measured memory_bytes: 6900
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
typedef vector<int> VI;
typedef pair<int, int> pii;
typedef priority_queue<int> PQ;
#define fore(i,a) for(auto &i:a)
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
//vector<vector<int> > dp;
//vector<vector<vector<int> > > vvvi;
//dp=vector<vector<int> >(N, vector<int>(M,0));
//vector<pair<int,int> > v;
//v.push_back(make_pair(x,y));
//priority_queue<int,vector<int>, greater<int> > q2;



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

	int N;
	cin >> N;
	vector<pair<double,double> >V(N);
	REP(i, N)cin >> V[i].first >> V[i].second;
	SORT(V);
	sort(V.begin(), V.end(), [](const auto &p1, const auto &p2) {
		return atan2l(p1.second, p1.first) < atan2l(p2.second, p2.first);
	});
	double ans = 0;

	REP(l, N) {
		int r = l;
		pair<double, double> now;
		now.first = now.second = 0;
		REP(j, N) {
			now.first += V[r].first;
			now.second += V[r].second;
			double x = now.first, y = now.second;
			ans = max(ans, pow(x*x + y * y, 0.5));
			r = (r + 1) % N;
		}
	}

	
	printf("%.12f\n", ans);

	return 0;
}



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

int main(){
string a,b;
cin>>a;
  b="CODEFESTIVAL2016";
int ans;
ans=16;
  for(long long i=0;i<16;i++){
    if(a[i]==b[i]){
     ans--;
    }
  }
  cout<<ans<<endl;
}


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

namespace ConsoleApplication1
{
	class Program
	{
		static void Main(string[] args)
		{
			int a, b, c;
			var word = Console.ReadLine().Split(' ');

			a = int.Parse(word[0]);
			b = int.Parse(word[1]);
			c = int.Parse(word[2]);

			if (c >= a && c <= b)
				Console.WriteLine("Yes");
			else
				Console.WriteLine("No");

				Console.ReadKey();

		}
	}
}

Measured memory_bytes: 13140
#include <bits/stdc++.h>
#define l_ength size
const int inf = (1<<30);
const int mod = 998244353;
using ll = long long;
using namespace std;

ll dp[200100];
ll sum[200100];
vector<pair<int, int>> vspan;

int main(){
	int n, k; cin >> n >> k;
	for( int i = 0; i < k; ++i ){
		int x, y; cin >> x >> y;
		vspan.emplace_back(x, y);
	}
	dp[0] = 1;
	sum[1] = 1;
	for( int i = 0; i < n; ++i ){
		for( int s = 0; s < k; ++s ){
			int l = vspan[s].first;
			int r = vspan[s].second;
			dp[i+1] += ( mod + sum[max(0, i+2-l)]-sum[max(0, i+2-r-1)] );
			dp[i+1] %= mod;
		}
		sum[i+2] = sum[i+1] + dp[i+1];
		sum[i+2] %= mod;
	}
	cout << dp[n-1] % mod << endl;
}

Measured memory_bytes: 6688
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n,m,t;
	while(cin>>n>>m,n){
		pair<int,int> v[m];
		for(int i=0;i<m;i++)v[i]=make_pair(n,i+1);
		for(int i=0;i<n;i++)for(int j=0;j<m;j++)cin>>t,v[j].first-=t;
		sort(v,v+m);
		for(int i=0;i<m-1;i++)cout<<v[i].second<<' ';cout<<v[m-1].second<<endl;
	}
}

Measured memory_bytes: 3076
#include <iostream>
using namespace std;
int N,memo[101][4][4][4];
int mod=1000000007;
int check(int len,int a,int b,int c){
  if(len==N)return 1;
  if(memo[len][a][b][c]>0)return memo[len][a][b][c];
  int ret = 0;
  for(int d=0;d<4;d++){
    if(b==0&&c==1&&d==2)continue;
    if(b==1&&c==0&&d==2)continue;
    if(b==0&&c==2&&d==1)continue;
    if(a==0&&c==1&&d==2)continue;
    if(a==0&&b==1&&d==2)continue;
    ret += check(len+1,b,c,d);
    ret %= mod;
  }
  memo[len][a][b][c] = ret;
  return ret;
}
int main() {
  cin>>N;
  cout<<check(0,3,3,3);
  return 0;
}


Measured memory_bytes: 256
// A - ι⊥l
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
#define MOD 1000000007
#define rp(i,n) for(int i=0;i<(n);i++)
#define irp(i,n) for(int i=(n);i>=0;i--)
#define up(i,s,e,d) for(int i=(s);i<(e);i+=(d))
#define dw(i,s,e,d) for(int i=(s);i>(e);i-=(d))
#define ot(x) cout<<(x)
#define ote(x) cout<<(x)<<endl
#define otreal(n,p) cout<<fixed<<setprecision(p)<<(n)
void vprn(vector<int> &v){ for(int i=0;i<v.size();i++) cout<<v[i]<<(i<v.size()-1?",\t":"\n"); }
void vvprn(vector<vector<int>> &vv){ for(auto v:vv) vprn(v); }

int main(){
	int a,b,c;
	cin>>a>>b>>c;
	cout<< (b-a==c-b?"YES":"NO") <<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#define REP(i,n) for(int i = 0;i < (n);i++)
#define pb push_back
using namespace std;
const int INF = 1e9;
typedef long long ll;

int main(){
  ll n,a,b;
  cin >> n >> a >> b;
  cout << (n-a)%b << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
	int x,y,z,d;
	cin>>x>>y>>z>>d;
	if(x+y == z+d){
		cout<<"Balanced"<<endl;
	}
	else if(x+y>z+d){
		cout<<"Left"<<endl;
	}
	else{
		cout<<"Right"<<endl;
	}
}

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

const int MAX = 1000000;
const int MOD = 1000000007;

signed main() {
 int n;
 cin>>n;
int a,b,t,ans=n;
    for(int i=1;i*2<=n;i++){
        a=i;b=n-i;t=0;
        while(a){
            t+=a%10;a/=10;
        }
        while(b){
            t+=b%10;b/=10;
        }
        ans=min(ans,t);
    }
    cout<<ans;
return 0;
}


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

int main() {
  int n;
  cin >> n;
  int a[2][n];
  for (int i = 0; i < 2; ++i) {
    for (int j = 0; j < n; ++j) {
      cin >> a[i][j];
    }
  }
  int max = 0;
  for (int j = 0; j < n; ++j) {
    int num = 0;
    for (int k = 0; k <= j; ++k) {
      num += a[0][k];
    }
    for (int k = j; k < n; ++k) {
      num += a[1][k];
    }
    if (num > max) {
      max = num;
    }
  }
  cout << max << endl;
}

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

typedef long long ll;

using namespace std;

int main(){
	string S;
	cin >> S;
	bool ym = 0, my = 0;
	if((S[2] == '0' and S[3] < '9' and S[3] >= '1')|| (S[2] == '1' and S[3] < '3')){
		ym = 1;
	}
	if((S[0] == '0' and S[1] < '9' and S[1] >= '1') || (S[0] == '1' and S[1] < '3')){
		my = 1;
	}
	if(ym and !my){
		cout << "YYMM";
	}else if(my and !ym){
		cout << "MMYY";
	}else if(ym and my){
		cout << "AMBIGUOUS";
	}else{
		cout << "NA";
	}
	return 0;
}

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

int main(int argc, char *argv[]) {
  ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);

  int a,b;cin>>a>>b;
  cout<<(a+b)%24<<endl;

  return 0;
}


Measured memory_bytes: 256
*A,=map(int,input().split())
A=A+list(map(int,input().split()))
A=A+list(map(int,input().split()))
N=int(input())
i=0
B=[0]*N
while i<=N-1:
    B[i]=int(input())
    i+=1

for x in B:
    if x in A:
        A[A.index(x)]=0

if A[0]+A[1]+A[2]==0:
    print('Yes')
elif A[3]+A[4]+A[5]==0:
    print('Yes')
elif A[6]+A[7]+A[8]==0:
    print('Yes')
elif A[0]+A[3]+A[6]==0:
    print('Yes')
elif A[1]+A[4]+A[7]==0:
    print('Yes')
elif A[2]+A[5]+A[8]==0:
    print('Yes')
elif A[0]+A[4]+A[8]==0:
    print('Yes')
elif A[2]+A[4]+A[6]==0:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3064
n, m=gets.split.map{|e|e.to_i}
ss=([0]*n).map{gets.split.map{|e|e.to_i}}
ps=([0]*m).map{gets.split.map{|e|e.to_i}}

ss.each do |s|
  puts ps.index(ps.min_by{|p|
    (s[0] - p[0]).abs + (s[1] - p[1]).abs
  }) + 1
end

Measured memory_bytes: 3836
#include<bits/stdc++.h>
#define ll long long int
#define mp make_pair
#define pb push_back
#define ff first 
#define ss second
#define mod 1000000007
#define lim 100005
#define nfs_mw ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;

int n;
ll base[1<<16] = {}, dp[1<<16] = {}, c[16][16] = {};

int main()
{
	int i,j,mask,l; ll v;
	cin>>n;
	
	for(i=0; i<n; i++)
		for(j=0; j<n; j++)
			cin>>c[i][j];

	
	for(mask = 0; mask<(1<<n); mask++)
	{
		int last = 31-__builtin_clz(mask&(-mask)), rmask = mask&(mask-1);
		base[mask] = base[rmask];		
		while(rmask){
			int oth = 31-__builtin_clz(rmask&(-rmask));
			rmask = rmask&(rmask-1);
			base[mask] = base[mask] + c[last][oth];
		}
	}

	for (mask = 0; mask < (1<<n); mask++){
		dp[mask] = base[mask];
	    for(int i = mask; i > 0; i = (i-1) & mask)
	    	dp[mask] = max(dp[i]+dp[(~i)&mask], dp[mask]);
	}
	cout<<dp[(1<<n)-1];
}

Measured memory_bytes: 1280
//Author rahuliitkgp

/*A thing of beauty is a joy forever,
Its loveliness increases,
it will never pass into nothingness.*/
//Men at Work :)

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
typedef long long int ll;

#define setbits(x)      __builtin_popcountll(x)
#define mod             1000000007
#define ps(x,y)         fixed<<setprecision(y)<<x
#define w(x)            int x; cin>>x; while(x--)
mt19937_64 mt(chrono::steady_clock::now().time_since_epoch().count());

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;

void cpp(){
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
}

int main(){
    cpp();
    ll n;
    cin>>n;
    ll x = ((n+1000-1)/1000);
    cout<<(x*1000-n)<<endl;
    return 0;
}





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

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    
    vector<int> cnt(26, 50);
    int n;
    for (cin >> n; n--;)
    {
        string s;
        cin >> s;
        vector<int> count(26);
        for (char c : s)
            count[c - 'a']++;
        
        for (int i = 0; i != 26; ++i)
            cnt[i] = min(cnt[i], count[i]);
    }
    
    for (int i = 0; i != 26; ++i)
        for (int j = 0; j != cnt[i]; ++j)
            cout << (char) ('a' + i);
    
    return 0;
}


Measured memory_bytes: 256
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author hamaron
 */

#include <iostream>
#include <fstream>

#include <iostream>

using namespace std;

class AFrog1 {
public:
	void solve(std::istream& in, std::ostream& out) {
        int N;
        in >> N;

        int h[N+1];
        for (int i = 1; i < N+1; i++) {
            in >> h[i];
        }

        int dp[N+1];
        for (int j = 1; j < N+1; j++) {
            if (j == 1) {
                dp[j] = 0;
                continue;
            }

            if (j == 2) {
                dp[j] = abs(h[1] - h[2]);
                continue;
            }

            dp[j] = min(dp[j-1] + abs(h[j-1] - h[j]), dp[j-2]  + abs(h[j-2] - h[j]));
        }

        out << dp[N];
	}
};


int main() {
	AFrog1 solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 1024
#![allow(unused_imports)]
#![allow(non_snake_case)]
use std::cmp::*;
use std::collections::*;
use std::io::Write;

#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), std::io::stderr());
            writeln!(err, "{} = {:?}", e, $e).unwrap()
        })*
    };
}

fn main() {
    let v = read_vec::<usize>();
    let mut ans = 0;
    for i in v[0]..v[1] + 1 {
        let s = format!("{}", i).chars().collect::<Vec<_>>();
        if s[0] == s[4] && s[1] == s[3] {
            ans += 1;
        }
    }
    println!("{}", ans);
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}


Measured memory_bytes: 4352
#include <iostream>
#include <algorithm>
#include <string>
#include <math.h>
#include <numeric>
#include <set>
#include <unordered_set>
#include <queue>
#include <boost/math/constants/constants.hpp>
#include <boost/math/common_factor_rt.hpp>

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

int main() {
  ll N, M;
  cin >> N >> M;
  ll p[100010];
  string S[100010];
  rep(i, M) cin >> p[i] >> S[i];
  
  ll F[100010]={};
  ll AC[100010]={};
  ll PENA[100010]={};
        
  ll pena=0;
  ll ac=0;
  
  rep(i, M){
    if(F[p[i]]==0){
      if(S[i]=="AC"){
        AC[p[i]]++;
        F[p[i]]++;
      }else{
        PENA[p[i]]++;
      }
    }
  }

  rep(i, 100010){
    if(F[i]==1){
      ac+=AC[i];
      pena+=PENA[i];
    }
  }
  
  cout << ac << " " << pena << endl;
}

Measured memory_bytes: 8832
#include <bits/stdc++.h>
#define REP(i, n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i, a, b) for(ll i = (a); i < (ll)b; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF (1ll << 60)
#define sz(x) int(x.size())
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;
typedef pair<ll, ll> p;
constexpr int MOD = 1000000007;
using ll = long long;
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;
}

void print(const std::vector<int> &v) {
    std::for_each(v.begin(), v.end(), [](int x) { std::cout << x << " "; });
    std::cout << std::endl;
}

// http://ronly.hatenablog.com/entry/2017/10/12/182048
// https://scrapbox.io/pocala-kyopro/D_-_Alice&Brown
int main() {
    ll X, Y;
    cin >> X >> Y;
    if(abs(X - Y) <= 1) {
        cout << "Brown" << endl;
    } else {
        cout << "Alice" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <cstring>

using namespace std;
// ascending order
#define vsort(v) sort(v.begin(), v.end())
// descending order
#define vsort_r(v) sort(v.begin(), v.end(), greater<long long>())
#define vunique(v) unique(v.begin(), v.end())
#define mp make_pair
#define ts(x) to_string(x)
#define rep(i, a, b) for(int i = (int)a; i < (int)b; i++)
#define repm(i, a, b) for(int i = (int)a; i > (int)b; i--)
#define bit(a) bitset<8>(a)
#define des_priority_queue priority_queue<int, vector<int>, greater<int> >
#define all(v) (v).begin(), (v).end()
typedef long long ll;
typedef pair<int, int> P;
const ll INF = 1e18;

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

    int N, M;
    cin >> N >> M;
    ll input[N][3];

    rep(i, 0, N) rep(j, 0, 3) cin >> input[i][j];

    ll rsl = 0;
    for(int mask = 0; mask < 1 << 3; mask++) {
        ll a[N];
        memset(a, 0, sizeof(a));
        rep(j, 0, N) {
            rep(i, 0, 3) {
                if(mask & 1 << i) {
                    a[j] += input[j][i];
                } else {
                    a[j] -= input[j][i];
                }
            }
        }
        ll tmp = 0;
        sort(a, a + N);
        reverse(a, a + N);
        rep(j, 0, M) tmp += a[j];
        rsl = max(rsl, tmp);
    }

    cout << rsl << endl;

}


Measured memory_bytes: 256