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

using namespace std;

struct UnionFind {
  vector< int > data;

  UnionFind(int sz) {
    data.assign(sz, -1);
  }

  bool unite(int x, int y) {
    x = find(x), y = find(y);
    if(x == y) return (false);
    if(data[x] > data[y]) swap(x, y);
    data[x] += data[y];
    data[y] = x;
    return (true);
  }

  int find(int k) {
    if(data[k] < 0) return (k);
    return (data[k] = find(data[k]));
  }

  int size(int k) {
    return (-data[find(k)]);
  }
};


template< typename T >
T boruvka(int N, function< vector< pair< T, int > >(int, vector< int >) > f) {
  vector< int > rev(N), belong(N);
  UnionFind uf(N);
  T ret = T();
  while(uf.size(0) != N) {
    int ptr = 0;
    for(int i = 0; i < N; i++) {
      if(uf.find(i) == i) {
        belong[i] = ptr++;
        rev[belong[i]] = i;
      }
    }
    for(int i = 0; i < N; i++) {
      belong[i] = belong[uf.find(i)];
    }
    auto v = f(ptr, belong);
    assert(v.size() == ptr);
    bool update = false;
    for(int i = 0; i < ptr; i++) {
      if(~v[i].second && uf.unite(rev[i], rev[v[i].second])) {
        ret += v[i].first;
        update = true;
      }
    }
    if(!update) return -1; // notice!!
  }
  return ret;
}

template< typename T >
struct edge {
  int src, to;
  T cost;

  edge(int to, T cost) : src(-1), to(to), cost(cost) {}

  edge(int src, int to, T cost) : src(src), to(to), cost(cost) {}

  edge &operator=(const int &x) {
    to = x;
    return *this;
  }

  operator int() const { return to; }
};

template< typename T >
using Edges = vector< edge< T > >;
template< typename T >
using WeightedGraph = vector< Edges< T > >;
using UnWeightedGraph = vector< vector< int > >;
template< typename T >
using Matrix = vector< vector< T > >;

int main() {
  int V, E;
  cin >> V >> E;
  Edges< int > g;
  for(int i = 0; i < E; i++) {
    int x, y, z;
    cin >> x >> y >> z;
    g.emplace_back(x, y, z);
  }
  const int INF = 1 << 30;
  function< vector< pair< int, int > >(int, vector< int >) > f = [&](int sz, vector< int > belong) {
    vector< pair< int, int > > ret(sz, {INF, -1});
    for(auto &e : g) {
      if(belong[e.src] == belong[e.to]) continue;
      ret[belong[e.src]] = min(ret[belong[e.src]], make_pair(e.cost, belong[e.to]));
      ret[belong[e.to]] = min(ret[belong[e.to]], make_pair(e.cost, belong[e.src]));
    }
    return ret;
  };
  cout << boruvka(V, f) << endl;
}



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

typedef long lint;
typedef long long llint;
typedef pair<int, int> pint;
typedef pair<long long, long long> pllint;

// static const int MAX = 1e6;
// static const int NIL = -1;
// static const llint INF = 1<<21;
// static const llint MOD = 1e9 + 7;

bool compPair(const pint& arg1, const pint& arg2) { return arg1.first > arg2.first; }
template<class T> void chmax(T& a, T b) { if (a < b) { a = b; } }
template<class T> void chmin(T& a, T b) { if (a > b) { a = b; } }

int main(void) {
    int a, b ,c, d;
    cin >> a >> b >> c >> d;
    cout << max(a*b, c*d) << endl;
    return 0;
}


Measured memory_bytes: 3484
#include <bits/stdc++.h>
using namespace std;
#define eps 1e-7
#define PI acos(-1)
#define de(x) cout<<#x<<'='<<x<<" , "
#define dee(x) cout<<#x<<'='<<x<<endl
#define sz(x) x.size()
#define mp make_pair
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define mset(a,b) memset(a,b,sizeof(a))
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define pb push_back
typedef long long LL;
typedef pair<int,int> pii;
typedef vector<int> vi;

const int MAXN=333,INF=0x3f3f3f3f;
int G[MAXN][MAXN],ok[MAXN][MAXN],vis[MAXN];
vector<pair<int,pii> > dis;
    int diss[MAXN];
vector<pii> update;
int N;
LL ans;
struct Edge{
    int u,v,w,nx;
}e[MAXN*MAXN];
int Fi[MAXN],sz;
void add(int u,int v,int w){
    e[sz].v=v,e[sz].w=w,e[sz].nx=Fi[u];
    Fi[u]=sz++;
}




bool SPFA(int st,int ed){
    mset(diss,INF); mset(vis,0);
    queue<int> q; diss[st]=0; q.push(st);
    while(!q.empty()){
        int u=q.front(); q.pop();
        vis[u]=0;
        for(int i=Fi[u];i!=-1;i=e[i].nx){
            int v=e[i].v,w=e[i].w;
            if(diss[v]>diss[u]+w){
                diss[v]=diss[u]+w;
                if(!vis[v]){
                    vis[v]=1;
                    q.push(v);
                }
            }
        }

    }
    return diss[ed]==G[st][ed];
}

int main(){
    cin>>N;
    rep(i,1,N+1) rep(j,1,N+1) scanf("%d",&G[i][j]);
    for(int k=1;k<=N;++k) for(int i=1;i<=N;++i) for(int j=1;j<=N;++j)
        if(G[i][j]>G[i][k]+G[k][j]){
            cout<<-1<<endl;
            return 0;
        }
    for(int i=1;i<=N;++i) for(int j=i+1;j<=N;++j)
        dis.pb(make_pair( G[i][j],pii(i,j) ));
    sort(all(dis));
    mset(Fi,-1);sz=0;
    for(int i=0;i<sz(dis);++i){
        int x=dis[i].se.fi,y=dis[i].se.se;
        int dd=dis[i].fi;
        if(!SPFA(x,y)){
            ans+=G[x][y];
            add(x,y,G[x][y]),add(y,x,G[x][y]);
        }
    }
    cout<<ans<<endl;

}




Measured memory_bytes: 1532
N = int(input())
S = input()
tmpval = sum([1 if S[i]=='E' else 0 for i in range(1, N)])
tmpmin = tmpval
for i in range(1, N):
    if S[i-1] == 'W':
        tmpval += 1
    if S[i] == 'E':
        tmpval -= 1
    tmpmin = min(tmpmin, tmpval)
print(tmpmin)

Measured memory_bytes: 62556
#include <bits/stdc++.h>
using namespace std;
#define dump(x) cout << (x) << '\n';
#define fi first
#define se second
typedef int64_t Int;
Int mod = 1e9+7;
Int INF = 1e9+7;

vector<pair<Int, Int>> G[3000];
Int d[3000];
bool avalable[3000];

int main() {
    string s, t;
    cin >> s >> t;
    int res = 0;
    for (int i = 0; i < 3; i++) {
        if (s[i] == t[i]) res++;
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 384
class Node:

    def __init__(self, n):
        self.id = n
        self.left = None
        self.right = None

class BTree:

    def __init__(self, n):
        self.n = n
        self.nodes = [Node(i) for i in range(n + 1)]

    def make_tree(self, preorder, inorder):
        if preorder:
            root = preorder[0]
            i_root = inorder.index(root)
            inorder_left = inorder[:i_root]
            inorder_right = inorder[i_root + 1:]
            leftn = len(inorder_left)
            preorder_left = preorder[1:leftn + 1]
            preorder_right = preorder[leftn + 1:]

            self.nodes[root].left = self.make_tree(preorder_left, inorder_left)
            self.nodes[root].right = self.make_tree(preorder_right, inorder_right)

            return root

        else:
            return -1

    def disp_postorder(self, root, result):
        node = self.nodes[root]
        if node.left != -1:
            self.disp_postorder(node.left, result)
        if node.right != -1:
            self.disp_postorder(node.right, result)
        result.append(root)
        return result

if __name__ == '__main__':

    n = int(input())
    btree = BTree(n)

    preorder = [int(x) for x in input().split()]
    inorder = [int(x) for x in input().split()]

    btree.make_tree(preorder, inorder)

    result = btree.disp_postorder(preorder[0], [])
    print(" ".join([str(x) for x in result]))


Measured memory_bytes: 5628
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;

/**
 * ABC129、A問題の実装クラス
 */
public class Main {

    /**
     * 標準入力からの入力をもとに、最短の飛行時間を求める
     */
    public static void main(String... args) {

        String line = null;
        BufferedReader br = null;
        try {
            br = new BufferedReader(new InputStreamReader(System.in));
            line = br.readLine();
            
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            try {
                br.close();
            } catch (Exception e) {}
        }
        
      	// 読み取った文字列を空白スペースで分割。昇順でソート
        String[] times = line.trim().split(" ");
        Arrays.sort(times);

        System.out.println(Integer.parseInt(times[0]) + Integer.parseInt(times[1]));
    }
}

Measured memory_bytes: 21076
#include<bits/stdc++.h>
#define rep(i,n) for(int i = 0;i<n;i++)
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0;}

const int D = 60;
const int MAX_N = 200005;
int to[60][MAX_N];
int main() {
    ll n,k;
    cin >> n >> k;
    rep(i,n) {
        cin >> to[0][i];
        to[0][i]--;
    }
    rep(i,D-1) {
        rep(j,n) {
            to[i+1][j] = to[i][to[i][j]];
        }
    }
    int v = 0;
    for(int i = D-1;i>=0;i--) {
        ll l = 1LL << i;
        if(l<=k) {
            v = to[i][v];
            k -= l;
        }
    }
    cout << v + 1 << endl;
}
    




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

int main(){
	int i, n, m, total=0, num=0;
	for(i=0 ; scanf("%d,%d", &n, &m ) != EOF ; i++ ){
		total += n*m;
		num += m;
	}
	printf("%d\n%d\n", total , (int)( num/(double)i + 0.5 ) );
}

Measured memory_bytes: 0
import java.util.*;
import java.io.*;
import java.nio.charset.StandardCharsets;

public class Main {

	public static void main(String[] args) throws IOException {
		InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);
		BufferedReader in = new BufferedReader(reader);
		int N = Integer.parseInt(in.readLine());
		int[] A = new int[N];
		for (int i = 0; i < N; ++i) {
			A[i] = Integer.parseInt(in.readLine());
		}

		Map<Integer, Set<Integer>> map = new HashMap<>();
		for (int i = 0; i < N; ++i) {
			if (!map.containsKey(A[i])) {
				map.put(A[i], new HashSet<>());
			}
			map.get(A[i]).add(i);
		}
		int max = Integer.MIN_VALUE;
		int nextMax = Integer.MIN_VALUE;
		for (int i = 0; i < N; ++i) {
			int temp = -1;
			if (max < A[i]) {
				temp = max;
				max = A[i];
			}
			if (temp >= 0) {
				// 置換が実施された
				if (nextMax < temp) {
					nextMax = temp;
				}
			} else {
				if (max > A[i] && nextMax < A[i]) {
					nextMax = A[i];
				}
			}
		}

		for (int i = 0; i < N; ++i) {
			if (A[i] != max) {
				System.out.println(max);
			} else {
				if (map.get(A[i]).size() >= 2) {
					System.out.println(max);
				} else {
					System.out.println(nextMax);
				}
			}
		}
	}
}

Measured memory_bytes: 113476
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double db;
typedef pair<int,int> P;
#define pb push_back
#define ft first
#define sd second
#define mp make_pair
#define fr(i,n) for(int i=0;i<(n);i++)
#define Fr(i,n) for(int i=0;i++<(n);)
#define ifr(i,n) for(int i=(n)-1;i>=0;i--)
#define iFr(i,n) for(int i=(n);i>0;i--)

int main(){
    int n,k;
    cin>>n>>k;
    cout<<n-k+1<<endl;
}

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

from itertools import accumulate
from bisect import bisect, bisect_left
from collections import Counter, deque
from functools import reduce
from itertools import accumulate
from operator import itemgetter, xor
from string import ascii_lowercase as abc

from sys import setrecursionlimit
setrecursionlimit(10**9)
 
import sys
#input = sys.stdin.readline
from collections import Counter
def inpl(): return list(map(int, input().split()))

N = int(input())
C = Counter()

for i in range(N):
    S = Counter(input())
    K = [0]*26
    for i in range(26):
        K[i] = S[abc[i]]
    C[tuple(K)] += 1

def cal(x):
    return x*(x-1)//2

ans = 0
for v in C.values():
    ans += cal(v)

print(ans)

Measured memory_bytes: 125144
N, A, B, C, D = map(int, input().split())
S = input()
ans = True
if D > C:
    cnt = 0
    for i in range(A-1, D):
        if cnt == 2:
            ans = False
            break
        else: 
            if S[i] == '#':
                cnt +=1
            else:
                cnt = 0
    if ans:
        print('Yes')
    else:
        print('No')
else:
    cnt = 0
    cnt2 = 0
    flag = False
    for i in range(A-1, C):
        if B-2<=  i <= D:
            if cnt2 == 3:
                flag = True
                if cnt == 2:
                    ans = False
                    break
                else: 
                    if S[i] == '#':
                        cnt +=1
                        cnt2 = 0
                    else:
                        cnt = 0
                        cnt2 += 1
            else:
                if cnt == 2:
                    ans = False
                    break
                else: 
                    if S[i] == '#':
                        cnt +=1
                        cnt2 = 0
                    else:
                        cnt = 0
                        cnt2 += 1
        else:
            if cnt2 == 3:
                flag = True
                cnt2 = 0
            if cnt == 2:
                ans = False
                break
            else:
                if S[i] == '#':
                    cnt += 1
                else:
                    cnt = 0
    if ans and flag:
        print('Yes')
    else:
        print('No')

Measured memory_bytes: 3700
import java.util.*;
import java.io.*;

/*
   AtCoder contest code
   coder : yoichidon
 */
import java.util.*;
import java.lang.*;
import java.io.*;

class Pair<E extends Comparable<E>,F extends Comparable<F>> implements Comparable<Pair<E,F>>{
    E first;
    F second;
    public Pair(E first, F second){
        this.first=first;
        this.second=second;
    }
    public E getFirst(){return first;}
    public F getSecond(){return second;}
    public String toString(){
        return "<"+first.toString()+","+second.toString()+">";
    }
    public int hashCode(){
        return first.hashCode()*30011+second.hashCode()+2;
    }
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;
        if (getClass() != obj.getClass())
            return false;
        Pair another = (Pair) obj;
        return this.getFirst().equals(another.getFirst())&&this.getSecond().equals(another.getSecond());
    }

    public int compareTo(Pair<E,F> another){
        if(this.getFirst().equals(another.getFirst())){
            return this.getSecond().compareTo(another.getSecond());
        }
        return this.getFirst().compareTo(another.getFirst());
    }

}

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int H = sc.nextInt();
        int W = sc.nextInt();
        int D = sc.nextInt();

        Map<Integer, Pair<Integer,Integer>> map = new HashMap<>();
        for(int h=0; h<H; h++) for(int w=0; w<W; w++){
            map.put(sc.nextInt()-1, new Pair<>(h,w));
        }
        long[] fromStart = new long[H*W];
        for(int i=0; i<H*W; i++){
            if(i<D) fromStart[i]=0;
            else{
                Pair<Integer,Integer> prev = map.get(i-D);
                Pair<Integer,Integer> cur = map.get(i);
                fromStart[i] = fromStart[i-D] + Math.abs(prev.getFirst()-cur.getFirst()) + Math.abs(prev.getSecond()-cur.getSecond());
            }
        }
        
        int Q = sc.nextInt();
        for(int q=0; q<Q; q++){
            int L = sc.nextInt()-1;
            int R = sc.nextInt()-1;
            System.out.println(fromStart[R] - fromStart[L]);
        }



    }
}


Measured memory_bytes: 111488
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;

void func(string a, string b, vector<int>& offsets) {
    offsets.clear();
    int offMin = -4000;
    int offMax = 4000;
    for (int x = offMin; x <= offMax; x++) {
        bool failed = false;
        for (int y = 0; y < (int)b.length(); y++) {
            if (x+y < 0 || x+y >= (int)a.length()) continue;
            if (a[x+y] == '?') continue;
            if (b[y] == '?') continue;
            if (a[x+y] != b[y]) {
                failed = true;
                break;
            }
        }
        if (!failed) offsets.push_back(x);
    }

}

int main() {
    string a, b, c;
    cin >> a;
    cin >> b;
    cin >> c;
    
    vector<int> ab, bc, ac;
    func(a, b, ab);
    func(a, c, ac);
    func(b, c, bc);
    
    //for (auto x: ab) cerr << x << ",";
    //cerr << endl;
    //for (auto x: bc) cerr << x << ",";
    //cerr << endl;
    //for (auto x: ac) cerr << x << ",";
    //cerr << endl;

    vector<int> table(8001);
    for (int x : ac) table[x+4000] = 1;
    cerr << ab.size() << " " << bc.size() << " " << ac.size() << endl;

    int ans = -1;
    for (int x : ab) {
        for (int y : bc) {
            int z = x + y;
            if (table[z+4000]) {
                int left = min(min(0, x), (x+y));
                int right = max(max((int)a.length(), (x+(int)b.length())), (x+y+(int)c.length()));
                if (ans == -1 || ans > right - left) ans = right-left;
            }
        }
    }
    if (ans==-1) cerr << "What!?" << endl;
    else cerr << "ok" << endl;
    cout << ans << endl;
                
    return 0;
}



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

int main() {
    string S;
    cin >> S;

    if (S == "ABC") cout << "ARC" << endl;
    else cout << "ABC" << endl;
    
    return 0;
}

Measured memory_bytes: 3620
from collections import defaultdict as de

n = int(input())
x = de(int)
for i in range(n):
    s = input()
    x[s] += 1
x = sorted(x.items(), key=lambda x:x[1], reverse=True)
y = 0
z =[]
for i,j in x:
    if y > j:
        break
    z.append(i)
    y = j
z = sorted(z)
for i in z:
    print(i)

Measured memory_bytes: 43476
#include <iostream>
#include <algorithm>
#include <vector>
#include <string.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <sstream> // std::stringstream
#include <bitset>  // std::bitset<N>
using namespace std;

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

    if(A==B){
        cout << A;
    }else if(A%2==0){
        if((B-A+1)%4==0){
            cout << 0;
        }else if((B-A+1)%4==2){
            cout << 1;
        }else if((B-A+1)%4==1){
            cout << B;
        }else{
            cout<< B+1;
        }
    }else{
        if((B-A)%4==0){
            cout << A;
        }else if((B-A)%4==2){
            cout << A-1;
        }else if((B-A)%4==1){
            bitset<100> as(A);
            bitset<100> bs(B);
            bitset<100> ans = as ^ bs;
            string str = ans.to_string();
            long long i = stoll(str, 0, 2);
            std::cout << i << std::endl;
        }else{
            B++;
            bitset<100> as(A);
            bitset<100> bs(B);
            bitset<100> ans = as ^ bs;

            string str = ans.to_string();
            long long i = stoll(str, 0, 2);
            std::cout << i << std::endl;
        }
    }
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <cmath>
#include <iostream>
#include <queue>
#include <list>
#include <stack>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <string>
#include <vector>
using namespace std;
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
typedef long long ll;

int main(){
  ios::sync_with_stdio(false);
  string S;
  int K;
  cin >> S;
  cin >> K;

  rep(i,S.length()){
    if(S[i] != 'a'){
      int dist = 26 - (int)(S[i]-'a');
      if(dist <= K){
        S[i] = 'a';
        K -= dist;
      }
    }
  }
  K %= 26;
  rep(i,K){
    if(S[S.length()-1] == 'z') S[S.length()-1] = 'a';
    else S[S.length()-1] += 1;
  }

  cout << S << endl;
  return 0;
}



Measured memory_bytes: 592
N=int(input())
s=[''.join(sorted(input())) for i in range(N)]


dic={}
counter=0
for i in range(N):
  if (s[i] in dic.keys())==True:
    counter+=dic[s[i]]
    dic[s[i]]=dic[s[i]]+1
  else:
    dic[s[i]]=1

print(counter)

Measured memory_bytes: 19504
N = int(input())
Ns = []
for i in range(N):
    Ns.append(input())
#Ns = ["AC", "TLE"]

a = [0, 0, 0, 0]
for n in Ns:
    if n == "AC":
        a[0] += 1
    if n == "WA":
        a[1] += 1
    if n == "TLE":
        a[2] += 1
    if n == "RE":
        a[3] += 1

ss = ["AC", "WA", "TLE", "RE"]
for i in range(4):
    print("%s x %d" % (ss[i], a[i]))

Measured memory_bytes: 16096
package main

import "fmt"

func main() {
	var A, B, K int
	fmt.Scanf("%d %d %d", &A, &B, &K)

	if A >= K {
		A = A - K
	} else if B >= (K - A) {
		B = B - (K - A)
		A = 0
	} else {
		A = 0
		B = 0
	}

	fmt.Println(A, B)
}


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

class Program
{
    static void Main(string[] args)
    {
        int[] HA = Console.ReadLine().Split(' ').Select(o => int.Parse(o)).ToArray();
        int O = HA[0] % HA[1] == 0 ? HA[0] / HA[1] : HA[0] / HA[1] + 1;
        Console.WriteLine(O);
    }
}

Measured memory_bytes: 11220
N = int(input())
A = [int(i) for i in input().split()]

s = 0
for i in range(N) :
    s ^= A[i]
    
for i in range(N) :
    A[i] &= ~s

r = 0
for i in range(60, -1, -1) :
    for j in range(r, N) :
        if (A[j] >> i) & 1 :
            A[r], A[j] = A[j], A[r]
            break
    else :
        continue
    
    for j in range(N) :
        if j == r :
            continue
        if (A[j] >> i) & 1 :
            A[j] ^= A[r]
    
    r += 1
    
ret = 0
for i in range(r) :
    ret ^= A[i]
    
print(ret * 2 + s)

Measured memory_bytes: 76960
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <cstdio>
using namespace std;

inline int getint()
{
    int x = 0, c = getchar();
    while (c > 47 && c < 58)
    {
        x = x * 10 + c - 48;
        c = getchar();
    }
    return x;
}

constexpr int MAX = 300000;
long res[MAX * 4];

int main()
{
    int H = getint();
    int W = getint();
    int M = getint();

    int h, w, ans, x, y;
    int mxr = 0;
    int mxc = 0;
    int ctrow = 0;
    int ctcol = 0;
    for (int i = 0; i < M; ++i)
    {
        h = getint() - 1, w = getint() - 1;
        res[i + 2 * MAX] = h, res[i + 3 * MAX] = w;
        x = ++res[h], y = ++res[w + MAX];

        if (x == mxr)
            ++ctrow;
        else if (x > mxr)
            mxr = x, ctrow = 1;

        if (y == mxc)
            ++ctcol;
        else if (y > mxc)
            mxc = y, ctcol = 1;
    }
    ans = mxr + mxc;

    long ct = ctrow;
    ct *= ctcol;
    if (ct > M)
    {
        printf("%d\n", ans);
        return 0;
    }

    for (int i = 0; i < M; ++i)
        if (res[res[i + 2 * MAX]] == mxr && res[res[i + 3 * MAX] + MAX] == mxc)
            --ct;
    if (ct <= 0)
        --ans;
    printf("%d\n", ans);
    return 0;
}


Measured memory_bytes: 10968
#include <bits/stdc++.h>
using namespace std;
 
int main() {
	int a = 0;
	cin >> a;
	int a1 = a/100;
	a = a%100;
    int a2 = a/10;
	a = a%10;
    int a3 = a;
	cout << a1 + a2 + a3 << endl;
}

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

#define sz(a) (int)(a).size()
#define pb push_back
#define all(a) (a).begin(), (a).end()

using namespace std;

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

int main()
{

    //ifstream cin("input.txt");

    string s;
    int k;
    cin >> s >> k;

    for (int i = 0; i < sz(s) - 1; ++i) {
        for (char c = 'a'; c <= 'z'; ++c) {
            int d;
            if (c >= s[i]) {
                d = c - s[i];
            } else {
                d = 26 + c - s[i];
            }
            if (k >= d) {
                k -= d;
                s[i] = c;
                break;
            }
        }
    }
    k %= 26;
    while (k--) {
        if (s[sz(s) - 1] == 'z') {
            s[sz(s) - 1] = 'a';
        } else {
            ++s[sz(s) - 1];
        }
    }
    cout << s << "\n";

}


Measured memory_bytes: 512
function Main(input) {
  lines = input.split(/\r\n|\r|\n/);
  var A = parseInt(lines[0].split(" ")[0]);
  var B = parseInt(lines[0].split(" ")[1]);
  var temp = 0;

  temp = A + B;

  if(temp < A-B){
    temp = A - B;
  }
  if(temp < A*B){
    temp = A * B;
  }
  
  console.log(temp);

}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

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

#define FASTIO ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
using ll = long long;

int main() {
	FASTIO
	ll k;
	cin >> k;
	ll y = 7 % k ;
	ll z = 10 % k ;
	int c = 1;
	vector<bool> m( k + 1);
	while(y){
		y = y * z + 7;
//		clog << y << endl;
		y %= k;
		c++;
		if(m[y]){
			return cout << -1 << endl,0;
		}
		m[y] = 1;
	}
	cout << c << endl;

}


Measured memory_bytes: 3752
#include <bits/stdc++.h>
 
using namespace std;
 
#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl;
#define DEBUG_MAT(v) cerr<<#v<<endl;for(int i=0;i<v.size();i++){for(int j=0;j<v[i].size();j++) {cerr<<v[i][j]<<" ";}cerr<<endl;}
typedef long long ll;
#define int ll
 
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
template<class S, class T> pair<S, T> operator+(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first + t.first, s.second + t.second); }
template<class S, class T> pair<S, T> operator-(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first - t.first, s.second - t.second); }
template<class S, class T> ostream& operator<<(ostream& os, pair<S, T> p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
#define X first
#define Y second
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define rrep1(i,n) for(int i=(int)(n);i>0;i--)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define in(x, a, b) (a <= x && x < b)
#define all(c) c.begin(),c.end()
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a = b; return 1; } return 0; }
#define UNIQUE(v) v.erase(std::unique(v.begin(), v.end()), v.end());
const ll inf = 1000000001;
const ll INF = (ll)1e18 + 1;
const long double pi = 3.1415926535897932384626433832795028841971L;
#define Sp(p) cout<<setprecision(25)<< fixed<<p<<endl;
//int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
//int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };
vi dx = {1, 0, -1, 0}, dy = {0, 1, 0, -1};
vi dx2 = { 1,1,0,-1,-1,-1,0,1 }, dy2 = { 0,1,1,1,0,-1,-1,-1 };
#define fio() cin.tie(0); ios::sync_with_stdio(false);
// const ll MOD = 1000000007;
const ll MOD = 998244353;
// #define mp make_pair
//#define endl '\n'


signed main() {
    fio();
    int n;
    cin >> n;
    vi num(1000111);
    vi a(n);
    rep (i, n) {
        cin >> a[i];
        num[a[i]]++;
    }

    int ans = 0;
    rep (i, n) {
        if (num[a[i]] >= 2) continue;

        bool flag = true;
        for (int j = 1; j * j <= a[i]; j++) {
            if (a[i] % j == 0) {
                int x = j;
                int y = a[i] / j;
                int nn = num[x];
                if (x == a[i]) nn--;
                if (nn > 0) {
                    flag = false;
                    break;
                }
                nn = num[y];
                if (y == a[i]) nn--;
                if (nn > 0) {
                    flag = false;
                    break;
                }
            }
        }
        if (flag) {
            ans++;
            // DEBUG(a[i]);
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 12688
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, K, Q;
    cin >> N >> K >> Q;
    int A[2010];
    rep(i, N) cin >> A[i];
    int ans = INF;
    rep(i, N) {
        vector<int> v1, v2;
        rep(j, N) {
            if (A[j] >= A[i]) {
                v1.push_back(A[j]);
            } else {
                if (v1.size() >= K) {
                    sort(v1.begin(), v1.end());
                    rep(k, v1.size() - K + 1) {
                        v2.push_back(v1[k]);
                    }
                }
                v1.clear();
            }
        }
        if (v1.size() >= K) {
            sort(v1.begin(), v1.end());
            rep(k, v1.size() - K + 1) {
                v2.push_back(v1[k]);
            }
        }
        sort(v2.begin(), v2.end());
        if(v2.size() >= Q) {
            ans = min(ans, v2[Q - 1] - v2[0]);
        }
        
    }
    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 vll = vector<ll>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int x;
  cin >> x;
  if (x < 1200) cout << "ABC" << endl;
  else cout << "ARC" << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
    long long a, b;
    
    cin >> a >> b;
    
    if (a * b <= 0) {
        cout << "Zero" << endl;
    } else if (a > 0) {
        cout << "Positive" << endl;
    } else {
        if ((b - a) % 2 == 0) {
            cout << "Negative" << endl;
        } else {
            cout << "Positive" << endl;   
        }
    }
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
 
#define rep(i,n) for(ll i=0;i<n;++i)
#define ALL(a) (a).begin(),(a).end()

using namespace std;
using ll  = long long;
using pll = pair<ll, ll>;

const ll MOD  = 1e9 + 7;
const ll LINF = 1LL << 62;
const int INF = 1e9 + 7;

vector<vector<ll>> g(100010); 
vector<ll> dist(100010);

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

    ll x[n], y[n];
    rep(i, n)cin >> x[i] >> y[i];

    ll ans = LINF;

    rep(i, n)for(int j = i+1; j < n; ++j){
        rep(k, n)for(int l = k+1; l < n; ++l){
            ll x_max = max(x[i], x[j]);
            ll x_min = min(x[i], x[j]);
            ll y_max = max(y[k], y[l]);
            ll y_min = min(y[k], y[l]);

            ll cnt = 0;
            rep(p, n){
                if(x[p] <= x_max && x[p] >= x_min && y[p] <= y_max && y[p] >= y_min){
                    cnt++;
                }
            }

            if(cnt >= K){
                ans = min(ans, (x_max-x_min)*(y_max-y_min));
            }
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 3328
from collections import deque
def main():
    h,w = map(int,input().split())
    ch,cw = map(int,input().split())
    dh,dw = map(int,input().split())
    ch += 1
    cw += 1
    dh += 1
    dw += 1
    m = [[0]*(w+4)]
    m.append([0]*(w+4))
    for i in range(h):
        s = input()
        temp = [0,0]
        for j in s:
            if j == ".":
                temp.append(1)
            else:
                temp.append(0)
        temp.append(0)
        temp.append(0)
        m.append(temp)
    m.append([0]*(w+4))
    m.append([0]*(w+4))

    t = [[1000000]*(w+4) for _ in range(h+4)]


    queue = deque([(ch,cw,0)])
    t[ch][cw] = 0
    
    while(len(queue) > 0):
        q = queue.popleft()
        nh = q[0]
        nw = q[1]
        dir = [(1,0),(-1,0),(0,1),(0,-1)]
        
        for d in dir:
            if m[nh + d[0]][nw + d[1]] == 1 and t[nh + d[0]][nw + d[1]] > q[2]:
                queue.appendleft((nh + d[0] , nw + d[1], q[2]))
                t[nh + d[0]][nw + d[1]] = q[2]

        dir = [(1,1),(-1,1),(-1,-1),(1,-1),(-2,2),(-1,2),(0,2),(1,2),(2,2),(-2,1),(2,1),(-2,0),(2,0),(-2,-1),(2,-1),(-2,-2),(-1,-2),(0,-2),(1,-2),(2,-2)]

        for d in dir:
            if m[nh + d[0]][nw + d[1]] == 1 and t[nh + d[0]][nw + d[1]] > q[2]+1:
                queue.append((nh + d[0] , nw + d[1], q[2] + 1))
                t[nh + d[0]][nw + d[1]] = q[2]+1
        

    print(t[dh][dw] if t[dh][dw] != 1000000 else -1)



if __name__ == "__main__":
    main()

Measured memory_bytes: 112468
#include<bits/stdc++.h>
    using namespace std;
    int main()
    {
    int H,N,A;
      cin>>H>>N;
      for(int i=0;i<N;i++)
      {
    	cin>>A;
        H-=A;
      }
      if(H<=0)
      {
       cout<<"Yes"; 
      }
      else
        cout<<"No";
    	return 0;
    }

Measured memory_bytes: 256
#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 pb emplace_back
typedef long long ll;
typedef pair<int,int> pint;

priority_queue<int> pq;
int main(){
    string s;
    int x;
    while(1){
        cin>>s;
        if(s[2]=='d') break;
        else if(s[0]=='i'){
            cin>>x;
            pq.push(x);
        }
        else{
            cout<<pq.top()<<endl;
            pq.pop();
        }
    }
    return 0;
}


Measured memory_bytes: 6900
// Knapsack, Huge
// AOJ DPL 1H
#include    <bits/stdc++.h>
using   namespace   std;
typedef long long ll;

#define INF (1<<30)

#define Rep0(i, n)  for (int i=0; i<n; i++)
#define Rep1(i, n)  for (int i=1; i<=n; i++)

struct  Item {
    ll  v=0;
    ll  w=0;
};

void    Fun(int l, int r, vector<Item> &I, vector<vector<ll>> &V) {
    ll N=(1<<(r-l));
    for (ll i=0; i<N; i++) {
        ll v=0;
        ll w=0;
        ll II=i;
        for (int j=l; j<r; j++) {
            if (1==II%2) {
                v +=I.at(j).v;
                w +=I.at(j).w;
            }
            II/=2;
        }
        V.push_back({w, v});
    }
    return;
}

int main() {
    int N;
    ll W;
    cin >>N >>W;
    vector<Item> I(N);
    Rep0(i, N)
        cin >>I.at(i).v >>I.at(i).w;
    vector<vector<ll>> F;
    vector<vector<ll>> B;
    Fun(0, N/2, I, F);
    Fun(N/2, N, I, B);
    sort(F.begin(), F.end());
    sort(B.begin(), B.end());
    for (ll i=1; i<F.size(); i++)
        F.at(i).at(1)=max(F.at(i).at(1), F.at(i-1).at(1));
    for (ll i=1; i<B.size(); i++)
        B.at(i).at(1)=max(B.at(i).at(1), B.at(i-1).at(1));
    ll S=0;
    ll ixf=F.size()-1;
    ll ixb=0;
    for(;;) {
        if (W>=F.at(ixf).at(0)+B.at(ixb).at(0)) {
            S=max(S, F.at(ixf).at(1)+B.at(ixb).at(1));
            ixb++;
        } else
            ixf--;
        if (0>ixf)
            break;
        if (B.size()==ixb)
            break;
    }
    cout <<S <<endl;
    return 0;
}



Measured memory_bytes: 117448
import sys

def main():
    input = sys.stdin.readline
    N, K = map(int, input().split())

    ans = 0
    for i in range(1, N+1):
        cnt = 0
        while i * 2**cnt < K:
            cnt += 1

        ans += 1 / N * (0.5)**cnt

    return ans


if __name__ == '__main__':
    print(main())


Measured memory_bytes: 2940
#include <stdio.h>
#include <stdlib.h>

int main() {
    int n;
    scanf("%d", &n);

    int* a = malloc(sizeof(int)*n);
    double sum = 0.0;

    for(int i = 0; i < n; i++) {
        scanf("%d", &a[i]);
        sum += (float)1/(float)a[i];
    }
    printf("%f", 1.0/sum);
    return 0;
}

Measured memory_bytes: 128
/*  -*- coding: utf-8 -*-
 *
 * e.cc: E - NEQ
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int MAX_N = 500000;
const int MOD = 1000000007;

/* typedef */

typedef long long ll;

/* global variables */

int fs[MAX_N + 1], invfs[MAX_N + 1];

/* subroutines */

int powmod(int a, int n) {  // a^n % MOD
  int pm = 1;
  while (n > 0) {
    if (n & 1) pm = (ll)pm * a % MOD;
    a = (ll)a * a % MOD;
    n >>= 1;
  }
  return pm;
}

inline int npk(int n, int k) {  // nPk % MOD
  return (ll)fs[n] * invfs[n - k] % MOD;
}

inline int nck(int n, int k) {  // nCk % MOD
  return (ll)fs[n] * invfs[n - k] % MOD * invfs[k] % MOD;
}

void prepare_fracs(int n) {
  fs[0] = invfs[0] = 1;
  for (int i = 1; i <= n; i++) {
    fs[i] = (ll)fs[i - 1] * i % MOD;
    invfs[i] = powmod(fs[i], MOD - 2);
  }
}

/* main */

int main() {
  int n, m;
  scanf("%d%d", &n, &m);

  prepare_fracs(m);

  int sum = 0;
  for (int i = 0; i <= n; i++) {
    int d = (ll)nck(n, i) * npk(m - i, n - i) % MOD;
    if (i & 1) d = MOD - d;
    sum = (sum + d) % MOD;
  }

  printf("%lld\n", (ll)sum * npk(m, n) % MOD);
  return 0;
}


Measured memory_bytes: 7136
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>

using namespace std;
#define f(i, n) for(int i = 0; i < n; ++i)
#define pb push_back
#define T int t = 0; cin >> t; while(t--)
#define b_e(a) a.begin(), a.end()
typedef long long ll;
typedef long double lld;
const ll mod = 1000007;
const int mx = 2e5 + 1;
const int inf = 1e6;

void input(){
    string s;
    cin >> s;
    int len = s.size();
    if(len & 1){
        cout << "No" << endl;
    }else{
        int k = len / 2;
        string t("\0");
        while(k--){
            t += "hi";
        }
        if(t == s)cout << "Yes" << endl;
        else cout << "No" << endl;
    }
}
int main(){
    input();
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define ALL(x) x.begin(),x.end()
#define MOD (1000000000+7)
using namespace std;
#define PI 3.14159265359
#define tMOD 998244353
#define mkpr(x,y) make_pair(x,y)

int main(){
  ll N,M;
  cin>>N>>M;
  vector<ll> p(M);
  vector<string> S(M,"");
  vector<ll> ac(N,0);
  vector<ll> wa(N,0);
  for(ll i=0;i<M;i++){
    cin>>p[i]>>S[i];
  }

  for(ll i=0;i<M;i++){
   if(S[i]=="WA"){
     if(ac[p[i]-1]==0){
       wa[p[i]-1]++;
     }
   }

   if(S[i]=="AC"){
     ac[p[i]-1] = 1;
   }
  }
ll jjj=0;
  for(ll i=0;i<N;i++){
     if(ac[i]==1){
       jjj += wa[i];
     }
   }

cout<<(accumulate(ALL(ac),0LL))<<" "<<jjj<<endl;

  return 0;
}


Measured memory_bytes: 8064
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
using namespace std;
using Int = int64_t;
int main() {
    Int N;
    cin >> N;
    vector<Int> A(N), B(N);
    for (Int i = 0; i < N; i++) {
        cin >> A[i];
        B[i] = A[i] - i - 1;
    }
    sort(B.begin(), B.end());
    Int b = B[N / 2], t = 0;
    for (Int i = 1; i <= N; i++) t += abs(A[i - 1] - b - i);
    cout << t << endl;
}


Measured memory_bytes: 3328
/****************************
/////  Shubham Singhal
/////  LNMIIT
*****************************/
#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp> 
// #include <ext/pb_ds/tree_policy.hpp> 
// #include <functional> 
// using namespace __gnu_pbds;
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define ppb pop_back
#define pf push_front
#define ppf pop_front
#define eb emplace_back
#define lwr lower_bound
#define upr upper_bound
#define pq priority_queue
#define umap unordered_map
#define rep(i,n) for(i=0; i<n;i++)
#define repp(i,a,n) for(i=a; i<n;i++)
#define precise(x) cout<<fixed<<setprecision(x)
#define all(x) x.begin(),x.end()
#define lcm(a,b) (a*b)/__gcd(a,b)
#define prn(x) cout<<x<<"\n"
#define prn2(x, y) cout<<x<<" "<<y<<"\n"
#define prn3(x, y, z) cout<<x<<" "<<y<<" "<<z<<"\n"
#define prn4(x, y, z, a) cout<<x<<" "<<y<<" "<<z<<" "<<a<<"\n"
#define prnv(x) for(auto i:x) cout<<i<<" "; cout<<"\n"
#define MOD 1000000007
#define MaX 300005
using namespace std;

 
typedef unsigned long long ull;
typedef long long ll;
typedef double ld;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<int, ll> pil;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd; 
typedef vector<int> vi;
typedef vector<long> vl;
typedef vector<char> vc;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<pii> vpii;
typedef vector<pil> vpil;
typedef vector<pli> vpli;
typedef vector<pll> vpll;
const long long INF64 = 1e18;
clock_t time_p=clock();
void time()
{
    time_p=clock()-time_p;
    cerr<<"Time Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";
}
void doc()
{
   	freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
}
void fast()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
}
// typedef tree<int, null_type, less<int>, rb_tree_tag, 
//              tree_order_statistics_node_update> 
//     new_data_set; 
bool isprime(ll n) 
{ 
    if (n <= 1) 
        return false; 
    if (n <= 3) 
        return true; 
    if (n % 2 == 0 || n % 3 == 0) 
        return false; 
  
    for (ll i = 5; i * i <= n; i = i + 6) 
        if (n % i == 0 || n % (i + 2) == 0) 
            return false; 
    return true; 
}


int main()
{
	fast();
	int i,j,x,y;
	cin>>x>>y;
	for(i=0;i<=x;i++)
	{
		int a=i,b=x-i;
		if(2*a+4*b==y)
		{
			cout<<"Yes";
			exit(0);
		}
	}
	cout<<"No";
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
#define ll          long long
#define pb          push_back
#define INF         9223372036854775807
#define    endl        '\n'
#define pii         pair<ll int,ll int>
#define vi          vector<ll int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define hell        1000000007
#define rep(i,a,b)    for(ll int i=a;i<b;i++)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define lower(u)    transform(u.begin(), u.end(), u.begin(), ::tolower);//convert string u to lowercase;
#define upper(u)    transform(u.begin(), u.end(), u.begin(), ::toupper);
using namespace std;

using namespace __gnu_pbds; 
  
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
#define N  100005

void solve()
{
    ll n,W;
    cin>>n>>W;
    ll w[n+1];
    ll v[n+1];
    rep(i,1,n+1)
    {
        cin>>w[i]>>v[i];
    }
    ll dp[n+1][W+1];
    memset(dp,0,sizeof(dp));
    rep(i,1,n+1)
    {
        rep(j,1,W+1)
        {
            if(w[i]<=j)
            {
                dp[i][j]=max(v[i]+dp[i-1][j-w[i]],dp[i-1][j]);
            }
            else
            {
                dp[i][j]=dp[i-1][j];
            }
        }
    }
    cout<<dp[n][W]<<endl;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    int TESTS=1;
//    cin>>TESTS;
    while(TESTS--)
    {
        solve();
    }
    return 0;
}

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

int main(void){
    int W,H,N;
    cin>>W>>H>>N;
    int sx=0,sy=0;
    int gx=W,gy=H;
    bool flag=false;
    for (int i=0;i<N;i++){
        int x,y,a;
        cin>>x>>y>>a;
        switch(a){
            case 1: {
                if (x>sx) sx=x;
            };break;
            case 2: {
                if (x<gx) gx=x;
            };break;
            case 3: {
                if (y>sy) sy=y;
            };break;
            case 4: {
                if (y<gy) gy=y;
            }break;
            default : break;
        }
        if (sx>=gx||sy>=gy) flag=true;
    }
    int ans;
    if (flag) ans=0;
    else ans=(gx-sx)*(gy-sy);
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<vi> vvi;
typedef vector<ii> vii;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef set<int> si;
typedef map<string, int> msi;
typedef greater<int> gt;
typedef priority_queue<int, vector<int>, gt> minq;
typedef long long ll;
const ll INF = 1e18L + 1;

  
int main() {
  int N,K;
  cin>>N>>K;
  vector<double> P;
  rep(i,N) {
    double p; cin>>p;
    double prob = (p+1)/2;
    P.push_back(prob);
  }
  // sort(P.begin(), P.end(), [](double a, double  b) {return a>b;});
  double ans = 0;
  rep(i,K) ans+=P[i];
  double sum = ans;

  for (int i=0; i<N-K; i++) {
    sum-=P[i];
    sum+=P[K+i];
    ans = max(ans, sum);
  }
  printf("%.10f\n", ans);
  return 0;
}

Measured memory_bytes: 3444
#include <iostream>
#define REP(i, n) for (int i = 0; i < (n); i++)
using namespace std;

void solve(long long N, long long A, long long B){
    int ans = 0;
    REP(i, N + 1) {
        string tmp = to_string(i);
        int sum = 0;
        REP(j, tmp.size()) {
            sum += tmp[j] - '0';
        }
        if (sum >= A && sum <= B)
            ans += i;
    }
    cout << ans << '\n';
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    long long N;
    scanf("%lld",&N);
    long long A;
    scanf("%lld",&A);
    long long B;
    scanf("%lld",&B);
    solve(N, A, B);
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(void)
{
	int a,b,c,n,N=0;
	
	scanf("%d %d %d",&a,&b,&c);
	
	for(n=a;n<=b;n++){
		
		if(c%n==0){
			N=N+1;
		}
	}
	printf("%d\n",N);
	return 0;
}

Measured memory_bytes: 596
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define ESP 1e-5

int main(void){
    string str;
    cin >> str;
    int len = (int) str.size();
    int x = 0;
    for(int i = 0; i < len; i++){
	x += (str[i] - '0') % 9;
	x %= 9;
    }
    if(x == 0){
	cout << "Yes" << endl;
    }else{
	cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 3744
#include<bits/stdc++.h>
using namespace std;
int n;
int a[1000010];
int now;
int main(){
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>a[i];
		now^=a[i];
	}
	for(int i=1;i<=n;i++){
		cout<<(now^a[i])<<' ';
	}
	return 0;
}

Measured memory_bytes: 4416