akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
int main(){
    int a,b;
    cin>>a>>b;
    if(a%3 == 0 || b%3 == 0 || (a+b)%3==0)
        cout<< "Possible" <<endl;
    else cout<< "Impossible" <<endl;    
}




Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define len(v) ll(v.size())
#define fi first
#define se second

template <class T>
void cout_vec(const vector<T> &vec){
  for(auto itr:vec) cout<<itr<<' ';
  cout<<endl;
}

typedef pair<ll,ll> P;
const ll mod=1e9+7;
const ll inf=1e15;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int a,b;
  cin>>a>>b;
  int ans=0;
  int now=1;
  while(now<b){
    now--;
    now+=a;
    ans++;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
from collections import deque

n,qtime = list(map(int,input().split()))

Q = deque()

class Info:
    def __init__(self,arg_name,arg_rest_time):
        self.name = arg_name
        self.rest_time = arg_rest_time

for _ in range(n):
    tmp = input().split()
    Q.append(Info(tmp[0],int(tmp[1])))

current_time = 0

while len(Q)>0:
    info = Q.popleft()
    if info.rest_time > qtime:
        info.rest_time = info.rest_time - qtime
        current_time += qtime
        Q.append(info)
    else:
        current_time += info.rest_time
        print("%s %d"%(info.name,current_time))


Measured memory_bytes: 17544
#include <bits/stdc++.h>
#define rep(i,s,n) for (int i = s; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main() {
  int x;
  cin >> x;
  int ans = 1;
  do {
    ans++;
  } while((ans*x) % 360 != 0);
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3632
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
using namespace std;
typedef long long ll;
int main(int argc, char* argv[] ){
  int H, W;
  cin >> H >> W;
  if( H*W==1 ){ cout << "No" << endl; return 0; }
  vector<int> prev(W,0);
  vector<int> curr(W+1,0);
  for( int i=0; i<H; ++i ){
    string buf;
    cin >> buf;
    // 0:".", 1:"#" solved, 2:"#" unsolved
    for( int j=1; j<=W; ++j ){
      if( buf[j-1]=='#' ){
        if( curr[j-1]==0 && prev[j-1]==0 ){ curr[j]=2; continue; }
        if( curr[j-1]>0 ){ curr[j]=1; curr[j-1]=1; }
        if( prev[j-1]>0 ){ curr[j]=1; prev[j-1]=1; }
      } else { // buf[j]=="."
        curr[j]=0;
      }
    }
    //for( int j=0; j<W; ++j ){ cerr << prev[j]; }
    //for( int j=0; j<W; ++j ){ cerr << curr[j+1]; } cerr << endl;
    if( *max_element(prev.begin(), prev.end()) == 2 ){
      cout << "No" << endl;
      return 0;
    }
    copy(curr.begin()+1, curr.end(), prev.begin());
  }
  if( *max_element(prev.begin(), prev.end()) == 2 ){
    cout << "No" << endl;
    return 0;
  }
  cout << "Yes" << endl;
  return 0;
}

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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>s;
	if(s[0]==s[2]) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n';
	FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	solve(); return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<iomanip>
using namespace std;
#define pi 3.141592653589793283462
int main(){
    int n;
    int i=1;
    while (1)
    {
        cin>>n;
        if(n==0)
            break;
        cout<<"Case "<<i<<": "<<n<<endl;
        i++;
    }
    return 0;
}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
using namespace std;
int main()
{
	set<int>a;
	int n,b;
	cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>b;
		a.insert(b);
	}
	set<int>::iterator pr;
	int sum=0;
	for(pr=a.begin();pr!=a.end();pr++)
	{
		sum++;
	}
	cout<<sum;
	return 0;
}

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

//#define int long long
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<n;++i)
#define exrep(i, a, b) for(ll i = a; i < b; i++)
#define out(x) cout << x << endl
#define EPS (1e-7)
#define gearup ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<bool> > vvb;
typedef vector<vector<double> > vvd;
typedef vector<vector<string> > vvs;
typedef vector<ll> vl;
typedef vector<vector<ll> > vvl;
typedef vector<vector<vector<ll> > > vvvl;
ll MOD = 1000000007;
const long long L_INF = 1LL << 60;
const int INF = 2147483647; // 2^31-1
const double PI = acos(-1);
//cout<<fixed<<setprecision(10);

template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
template<class T> void debug(T v){rep(i,v.size()) cout<<v[i]<<" ";cout<<endl;}
const ll dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll dy[8] = {0, 1, 1, 1, 0, -1, -1, -1};

signed main()
{
  gearup;
  int h,w; cin >> h >> w;
  vvc a(h,vc(w));
  rep(i,h)rep(j,w)cin>>a[i][j];
  vb vert(h),hori(w);
  //縦探索
  rep(i,h){
    bool is_res = true;
    rep(j,w){
      if(a[i][j] != '.')is_res = false;
    }
    if(is_res)vert[i] = true;
  }
  //横探索
  rep(j,w){
    bool is_res = true;
    rep(i,h){
      if(a[i][j] != '.')is_res = false;
    }
    if(is_res)hori[j] = true;
  }

  rep(i,h){
    if(vert[i])continue;
    rep(j,w){
      if(hori[j])continue;
      cout << a[i][j];
    }
    cout << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep2(i, a, b) for(int i = (a); i < (b); i++)
typedef long long ll;

int main() {
   int n;
   cin >> n;
   
   cout << "ABC" << n << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main ()
{
	char a,b;
	scanf ("%c %c",&a,&b);
	if (a == 'H')
	{
		if (b == 'H')
		{
			printf ("H");
		}
		else if (b=='D')
		{
			printf("D");
		}
	}
	else if (a == 'D')
	{
		if (b == 'H')
		{
			printf("D");
		}
		else if (b == 'D')
		{
			printf("H");
		}
	}
	
}

Measured memory_bytes: 128
naive_solver::Int->Int->Int->Bool
naive_solver n m k = not ([] == (dropWhile (\x->x/=k) [(n*j+i*m-2*i*j)|i<-[0..n],j<-[0..m]]))

main::IO()
main=do
  dat<-getLine
  let m:n:k:[]=map read (words dat)
  putStr (if naive_solver n m k then "Yes" else "No")
  putStr "\n"

Measured memory_bytes: 1020
import java.util.Scanner;

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 K = sc.nextInt();
        int sum_A = Math.min(A, K);
        int sum_B = Math.min(K - sum_A, B);
        int sum_C = Math.min(K - sum_A - sum_B, C);
        System.out.println(sum_A - sum_C);
        sc.close();
    }
}

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

int main(){
	string s;
	cin >> s;
	if(s=="Sunny"){
		cout << "Cloudy" << endl;
	}
	else if(s=="Rainy"){
		cout << "Sunny" << endl;
	}
	else{
		cout <<"Rainy" << endl;
	}
}

Measured memory_bytes: 256
import java.io.PrintStream;
import java.util.PriorityQueue;
import java.util.Scanner;

public class Main {
	static final PrintStream out = System.out;
	static final Scanner sc = new Scanner(System.in);
	static final long Mod = 1000_000_007L;
	public static void main(String[] args) {
		Main main = new Main();
		main.solve();
		System.exit(0);
	}

	void solve() {
		int N = nextInt();
		int M = nextInt();
		long[] A = nextLongArray(N);
		int[] B = new int[N]; // 割引券使用枚数

		PriorityQueue<Integer> pq = new PriorityQueue <Integer>((a1,a2)->MyComparator(A[a1],A[a2],B[a1],B[a2])); // a1,a2 = A[] index
		for(int i=0;i<N;i++) {
			pq.add(i);
		}

		for(int i=0;i<M;i++) {
			int ti = pq.poll();
			B[ti]++;
			pq.add(ti);
		}

		long res = 0;
		for(int i=0;i<N;i++) {
			int ti = pq.poll();
			int b = B[ti];
			res += A[ti]/Math.pow(2,b);
		}

		out.println(res);
	}

	private int MyComparator(long A1, long A2, int B1, int B2) {
		double a1,a2;
		a1 = A1/Math.pow(2,B1);
		a2 = A2/Math.pow(2,B2);

		if(a1 < a2) return 1;
		else if(a1 > a2) return -1;
		else if(a1 == a2){
			if(A1 < A2)return 1;
			if(A1 > A2)return -1;
		}
		return 0;
	}

	public int[] nextIntArray(int n) {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)a[i] = nextInt();
		return a;
	}
	public long[] nextLongArray(int n) {
		long[] a = new long[n];
		for (int i = 0; i < n; i++)a[i] = nextLong();
		return a;
	}
	public int nextInt() {
		return Integer.parseInt(next());
	}
	public long nextLong() {
		return Long.parseLong(next());
	}
	public String next() {
		return sc.next();
	}

}

Measured memory_bytes: 48584
void main(){
	int a, b, c;
	readf("%d %d %d\n", &a, &b, &c);
	min(a+b,b+c,a+c).writeln();
}
     
import std.stdio, std.conv, std.algorithm, std.numeric, std.string, std.math, std.range;
const long mod = 10^^9+7;      
// 1要素のみの入力
T inelm(T= int)(){
	return to!(T)( readln().chomp() );
}
     
// 1行に同一型の複数入力
T[] inln(T = int)(){
	T[] ln;
	foreach(string elm; readln().chomp().split())ln ~= elm.to!T();
	return ln;
}


Measured memory_bytes: 2796
def main():
    cnt_march = [0] * 5
    N = int(input())
    for _ in range(N):
        S = input()
        if S[0] == 'M':
            cnt_march[0] += 1
        elif S[0] == 'A':
            cnt_march[1] += 1
        elif S[0] == 'R':
            cnt_march[2] += 1
        elif S[0] == 'C':
            cnt_march[3] += 1
        elif S[0] == 'H':
            cnt_march[4] += 1

    ans = 0
    from itertools import combinations
    for i, j, k in combinations(range(5), 3):
        ans += cnt_march[i] * cnt_march[j] * cnt_march[k]

    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 45160
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
using ll = int64_t;
using ld = long double;
using ull = uint64_t;
using namespace std;
using namespace __gnu_pbds;

const int MAXN = 4228;
vector<pair<int,int>> e[MAXN];

bool dfsPath(int v, int p, int u, vector<int>& path) {
    if (v == u) {
        return true;
    }

    for (auto ed : e[v]) {
        int ver = ed.first;
        if (ver != p) {
            path.push_back(ed.second);
            if (dfsPath(ver, v, u, path)) {
                return true;
            }

            path.pop_back();
        }
    }

    return false;
}

vector<int> findPath(int v, int u) {
    vector<int> path;
    dfsPath(v, v, u, path);
    return path;
}


int n, m, k;
vector<int> edgePath[MAXN];
int u[MAXN];
int v[MAXN];
bool happy[MAXN];
bool oriented[MAXN];
vector<int> inPath[MAXN];
int cnt[MAXN];

void require(int pid, int eid) {
    assert(!oriented[pid]);
    oriented[pid] = true;

    if (find(edgePath[pid].begin(), edgePath[pid].end(), eid) == edgePath[pid].end()) {
        reverse(edgePath[pid].begin(), edgePath[pid].end());
        swap(u[pid], v[pid]);
        for (int& ed : edgePath[pid]) {
            ed ^= 1;
        }
    }

    for (int ed : edgePath[pid]) {
        happy[ed] = true;
        --cnt[ed / 2];
    }
}

void require(int eid) {
    auto& inp = inPath[eid / 2];
    while (oriented[inp.back()]) {
        inp.pop_back();
    }

    require(inp.back(), eid);
}


int main() {
#ifdef BZ
    freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
#endif
    ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); cout.setf(ios::fixed); cout.precision(20);
    cin >> n >> m;
    k = n - 1;

    for (int i = 0; i < k; ++i) {
        int a, b;
        cin >> a >> b;
        e[a].emplace_back(b, 2 * i);
        e[b].emplace_back(a, 2 * i + 1);
    }

    for (int i = 0; i < m; ++i) {
        cin >> u[i] >> v[i];
        edgePath[i] = findPath(u[i], v[i]);
        for (int id : edgePath[i]) {
            ++cnt[id / 2];
            inPath[id / 2].push_back(i);
        }
    }

    int bestAns = 0;
    for (int i = 0; i < k; ++i) {
        bestAns += min(2, cnt[i]);
    }

    for (;;) {
        int bestId = -1, bestCnt = m + 1;
        for (int i = 0; i < k; ++i) {
            int v = i * 2, u = i * 2 + 1;
            if (happy[v] != happy[u] && cnt[i] && cnt[i] < bestCnt) {
                bestId = (happy[v] ? u : v);
                bestCnt = cnt[i];
            }
        }

        if (bestId == -1) {
            for (int i = 0; i < k; ++i) {
                if (cnt[i]) {
                    bestId = i * 2;
                }
            }
        }

        if (bestId == -1) {
            break;
        }

        require(bestId);
    }

    int ans = 0;
    for (int i = 0; i < 2 * k; ++i) {
        ans += happy[i];
    }

    assert(ans == bestAns);
    cout << ans << "\n";
    for (int i = 0; i < m; ++i) {
        cout << u[i] << " " << v[i] << "\n";
    }
}

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

template <typename InputIterator>
typename InputIterator::value_type summation(InputIterator first,
                                             InputIterator last) {
  return std::accumulate(first, last, typename InputIterator::value_type());
}
template <typename T>
std::istream &operator>>(std::istream &stream, std::vector<T> &v);
template <typename T1, typename T2>
std::istream &operator>>(std::istream &stream, std::pair<T1, T2> &p);
template <typename T>
std::istream &operator>>(std::istream &stream, std::vector<T> &v) {
  for (auto &i : v) {
    stream >> i;
  }
  return stream;
}
template <typename T1, typename T2>
std::istream &operator>>(std::istream &stream, std::pair<T1, T2> &p) {
  stream >> p.first >> p.second;
  return stream;
}

int main() {
  int64_t q;
  std::cin >> q;
  std::set<std::pair<int64_t, int64_t>> a;
  int64_t b = 0;
  int64_t cost = 0;

  {
    int64_t n, ai, bi;
    std::cin >> n >> ai >> bi;
    a.insert({ai, 0});
    b += bi;
  }
  auto itr = a.cbegin();

  for (int64_t i = 1; i < q; i++) {
    int64_t n;
    std::cin >> n;
    if (n == 1) {
      int64_t ai, bi;
      std::cin >> ai >> bi;
      b += bi;
      a.insert({ai, i});
      if (itr->first < ai) {
        if (a.size() % 2 == 0) {
          cost += std::abs(ai - itr->first);
        } else {
          itr++;
          cost += std::abs(ai - itr->first);
        }
      } else if (itr->first == ai) {
        if (a.size() % 2 == 1) {
          itr++;
        }
      } else {
        if (a.size() % 2 == 0) {
          const auto before = itr->first;
          itr--;
          cost += std::abs(before - itr->first);
          cost += std::abs(ai - itr->first);
        } else {
          cost += std::abs(ai - itr->first);
        }
      }
    } else {
      std::cout << itr->first << " " << cost + b << std::endl;
    }
  }

  return 0;
}

Measured memory_bytes: 12800
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cassert>
#include <string>
#include <algorithm>
#include <vector>
#include <valarray>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <iomanip>
#include <map>
#include <set>
#include <list>
#include <limits>
#include <numeric>
#include <utility>
#include <deque>
#include <unordered_set>
#include <unordered_map>
#include <regex>
#include <array>
#include <bitset>
#include <complex>
#include <tuple>
#include <random>

using namespace std;
using ll = long long;
const int INF = 1e9;
const ll MOD = 1e9 + 7;

vector<int> g[100010];
int seen[100010];

void bfs(int x)
{
  queue<int> q;
  q.push(x);
  while (!q.empty())
  {
    int p = q.front();
    q.pop();
    for (int i = 0; i < g[p].size(); ++i)
    {
      if (seen[g[p][i]] == -1)
      {
        seen[g[p][i]] = p;
        q.push(g[p][i]);
      }
    }
  }
}

int main()
{
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < m; ++i)
  {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  for (int i = 0; i < n; ++i)
    seen[i] = -1;
  seen[0] = 0;
  bfs(0);
  cout << "Yes" << endl;
  for (int i = 1; i < n; ++i)
  {
    cout << seen[i] + 1 << endl;
  }

  return 0;
}


Measured memory_bytes: 10092
#include<bits/stdc++.h>
using namespace std;
int x,y,t=0,n=0;
string s;
int main()
{
	cin>>s;
	n=s.size();
	for(int i=0;i<n;i++)
	{
		if(s[i]=='A')
		{
			x=i;
			break;
		}
	}
	for(int i=n-1;i>=0;i--)
	{
		if(s[i]=='Z')
		{
			y=i;
			break;
		}
	}
	t=y-x+1;
	cout<<t<<endl;
    return 0;
}

Measured memory_bytes: 640
inf = float("inf")

class edge():
    def __init__(self, start, target, cost):
        self.start = start
        self.target = target
        self.cost = cost

def bellman_ford(s):
    d = [inf] * V
    d[s] = 0
    cnt = 0
    updateflag = True
    while True:
        updateflag = False
        for i in es:
            if d[i.start] != inf and d[i.target] > d[i.start] + i.cost:
                d[i.target] = d[i.start] + i.cost
                updateflag = True
        if cnt == V-1: return False
        if not updateflag: break
        cnt += 1
    return d

V,E,r = map(int, input().split())
if E == 0: print(0)
else:
 es = [None] * E
 for i in range(E):
     s,t,cost = map(int, input().split())
     es[i] = edge(s, t, cost)
 ans = bellman_ford(r)
 if ans:
     for i in ans:
         if i == inf: print("INF")
         else: print(i)
 else:
    print("NEGATIVE CYCLE")

Measured memory_bytes: 8152
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define COUT(x) cout<<(x)<<endl
#define dump(x)  cout << #x << " = " << (x) << endl;
using ll = long long;
using P = pair<int,int>;
using Graph = vector<vector<int>>;
using M = map<int,int>;
using PQ = priority_queue<int>;
using PQG = priority_queue<int, vector<int>, greater<int>>;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

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


Measured memory_bytes: 256
s = input()

if 0 < int(s[0:2]) <= 12 and 0 < int(s[2:4]) <= 12 :
  print("AMBIGUOUS")
elif (12 < int(s[0:2]) or int(s[0:2]) == 0) and  0 < int(s[2:4]) <= 12:
  print("YYMM")
elif 0 < int(s[0:2]) <= 12 and (12 < int(s[2:4]) or int(s[2:4]) == 0):
  print("MMYY")
else:
  print("NA")

Measured memory_bytes: 3064
import numpy as np

A, B, C, K = map(int, input().split(" "))
vec = np.array([[A], [B], [C]])
mat = np.array([[0, 1, 1], [1, 0, 1], [1, 1, 0]])
mat = np.linalg.matrix_power(mat, K)
ans = mat.dot(vec)

if abs(ans[0] - ans[1]) <= 10e18:
    print(int(ans[0] - ans[1]))
else:
    print('Unfair')


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

int main() {
	while(1){
		int a,b,c,x,y;
		cin>>a>>b>>c;
			if(a==0){
				return 0;
			}
		int map[17][17]={};
		for(int i=0;i<c;i++){
			cin>>x>>y;
			map[x][y]=1;
		}	
		int dp[17][17]={};
		dp[0][1]=1;
				for(int i=1;i<=a;i++){
					for(int j=1;j<=b;j++){
						if(map[i][j] == 1){
							continue;
						}
					dp[i][j] = dp[i][j-1]+dp[i-1][j];
					}
				}
		cout<<dp[a][b]<<endl;
	}
	return 0;
}

Measured memory_bytes: 1164
import sys

s = list(input())

for i in range(len(s)):
  if i % 2 == 1:
    if s[i] == "L" or s[i] == "U"or s[i] == "D":
      continue
    else:
      print("No")
      sys.exit()
  else:
    if s[i] == "R" or s[i] == "U"or s[i] == "D":
      continue
    else:
      print("No")
      sys.exit()

print("Yes")

Measured memory_bytes: 3060
/* Bismillahirrahmanirrahim */
/* Author : Jehian Norman Saviero (@Reiva5) */
#include <bits/stdc++.h>

// MACROS SAMPAH
#define Jehian using
#define Norman namespace
#define Saviero std

Jehian Norman Saviero;

// MACROS TYPE
typedef long l;
typedef long long ll;
typedef unsigned long ul;
typedef unsigned long long ull;
typedef double ld;
typedef pair<int,int> pi;
typedef pair<l,l> pl;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<l> vl;
typedef vector<ll> vll;

// MACROS FOR PRINT
#define nl printf("\n")
#define sp printf(" ")

// MACROS FOR ATTRIBUTE
#define fi first
#define se second

// MACROS FOR FUNCTION AND METHOD
#define eb emplace_back
#define mp make_pair
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define ALL(x) (x).begin(), (x).end()
#define ALLN(x,n) (x), (x)+(n)
#define CUBE(x) (SQR(x)*(x))
#define SET(x,y) for (int _qwe = sizeof(x)/sizeof(x[0]); _qwe; ) x[--_qwe] = (y)
#define SQR(x) ((x)*(x))
#define SSORT(x,sz) sort(ALLN(x,sz))
#define RESET(x) memset((x), 0, sizeof(x))
#define VSORT(x) sort(ALL(x))

// MACROS READ INPUT
#define sci(x) scanf("%d", &x)
#define scl(x) scanf("%ld", &x)
#define scll(x) scanf("%lld", &x)
#define scul(x) scl(x)
#define scull(x) scll(x)

int main() {
	int N, K;
	sci(N), sci(K);
	++N;
	N /= 2;
	puts(N >= K ? "YES" : "NO");
	return 0;
}

Measured memory_bytes: 256
# Bingo
A = []
for _ in range(3):
    A += list(map(int, input().split()))
N = int(input())
for _ in range(N):
    b = int(input())
    if b in A:
        A[A.index(b)] = -1
        
# check
diag = (sum(A[0::4]) == -3) | (sum(A[2:8:2]) == -3)
rows = (sum(A[:3]) == -3) | (sum(A[3:6]) == -3) | (sum(A[6:]) == -3)
cols = (sum(A[:7:3]) == -3) | (sum(A[1:8:3]) == -3) | (sum(A[2::3]) == -3)
ans = diag | rows | cols
print(['No', 'Yes'][ans])

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

int main() {
	// your code goes here
	string s;
	cin>>s;
	int flag=0;
	for(int i=0;i<s.length()-1;i++){
	    if(s[i]==s[i+1]){
	        flag=1;
	        break;
	    }
	}
	if(flag)
	    cout<<"Bad";
	  else
	    cout<<"Good";
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <string>
#include <cstdio>
using namespace std;
typedef long long ll;

ll gcd(ll m, ll n);
ll lcm(ll m, ll n);

int main() {
	ll N;
	scanf("%lld", &N);
	vector<ll> t(N);
	ll _gcm;
	scanf("%lld" ,&_gcm);
	for (ll i = 1; i < N; i++)
	{
		ll temp;
		scanf("%lld", &temp);
		_gcm = lcm(_gcm, temp);
	}

	cout << _gcm << endl;
}

ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a%b);
}

ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}

Measured memory_bytes: 256
#include<iostream>
#include <string>

using namespace std;



int main(){
  int i, T, t, a = 0;
  string S;

  cin >> S;

  T = S.length();
  t = T / 2;
  for (size_t i = 0; i < t; i++) {
    if (S[i] != S[T-1-i]) {
      a += 1;
    }
  }

  cout << a << endl;

  return 0;
}


Measured memory_bytes: 256
#include <sstream>
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <set>
#include <tuple>
#include <functional>
#include <map>
#include <unordered_map>
#include <queue>
#include <tuple>
#include <random>
#include <stack>

using namespace std;

#define endl '\n'

//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

using lld = long double;
using ull = unsigned long int;
using ll = long long;

void solve() {
  int n; cin >> n;
  ll K; cin >> K;

  using matrix = vector<vector<ll>>;
  const ll mod = 1e9 + 7;

  auto mult_in =
    [](matrix& a, const matrix& b) -> void {
      matrix c(a.size(), vector<ll>(a.size()));
      for (int i = 0; i < (int)a.size(); ++i) {
        for (int j = 0; j < (int)a.size(); ++j) {
          c[i][j] = 0;
          for (int k = 0; k < (int)a.size(); ++k) c[i][j] = (c[i][j] + a[i][k] * b[k][j]) % mod;
        }
      }
      swap(a, c);
    };

  matrix b(n, vector<ll>(n));
  for (auto& v : b) for (auto& i : v) cin >> i;

  matrix a(n, vector<ll>(n));
  for (int i = 0; i < n; ++i) a[i][i] = 1;

  while (K) {
    if (K & 1) {
      mult_in(a, b);
    }
    mult_in(b, b);
    K /= 2;
  }


  ll ans = 0;
  for (auto& v : a) for (auto i : v) ans = (ans + i) % mod;

  cout << ans << endl;
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  const int precision = 13;
  cout.precision(precision);
  cout.setf(ios_base::fixed);


  solve();

  return 0;
}


Measured memory_bytes: 384
#include<stdio.h>

#define INFTY (1<<21)
#define MAX 100
#define WHITE 0
#define GRAY 1
#define BLACK 2

int n, M[MAX][MAX];

int prim(){
  int u, minv;
  int d[MAX], p[MAX], color[MAX];

  for(int i=0;i<n;i++){
    d[i] = INFTY;
    p[i] = -1;
    color[i] = WHITE;
  }

  d[0] = 0;

  while(1){
    minv = INFTY;
    u = -1;
    for(int i = 0; i < n; i++){
      if(minv > d[i] && color[i] != BLACK){
	u = i;
	minv = d[i];
      }
    }
    if(u == -1)break;
    color[u] = BLACK;
    for(int v = 0; v < n; v++){
       if(color[v] != BLACK && M[u][v] != INFTY){
	 if (d[v] > M[u][v]){
	   d[v] = M[u][v];
	   p[v] = u;
	   color[v] = GRAY;
	 }
       }
    }
  }
  int sum = 0;
  for(int i = 0; i < n; i++){
    if(p[i] != -1)sum += M[i][p[i]];
  }

  return sum;
}

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

  for(int i = 0; i < n; i++){
    for(int j = 0; j < n; j++){
      int e;
      scanf("%d",&e);
      M[i][j] = (e == -1) ? INFTY : e;
    }
  }

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

  return 0;
}



Measured memory_bytes: 2720
N,C=gets.split.map(&:to_i)

sushis=N.times.map{ gets.split.map(&:to_i)}

sushis.sort_by!{|s| s}

cal=0
cal_max=0
bcal=0
bcal_max=0
fforward_max=Array.new(N+1)
fforward_max[0]=0
fback_max=Array.new(N+1)
fback_max[0]=0

pos=0
sushis.each_with_index do |s,i|
  x,v=s
  cal+=v-(x-pos)
  pos=x
  bcal=cal-pos
  cal_max=cal if cal_max<cal
  bcal_max=bcal if bcal_max<bcal
  fforward_max[i+1]=cal_max
  fback_max[i+1]=bcal_max
end


cal=0
cal_max=0
bcal=0
bcal_max=0
pos=C
bforward_max=Array.new(N+1)
bforward_max[0]=0
bback_max=Array.new(N+1)
bback_max[0]=0
sushis.reverse_each.each_with_index do |s,i|
  x,v=s
  cal+=v-(pos-x)
  pos=x
  bcal=cal-(C-pos)
  cal_max=cal if cal_max<cal
  bcal_max=bcal if bcal_max<bcal
  bforward_max[i+1]=cal_max
  bback_max[i+1]=bcal_max
end



ret=0
(N+1).times do |i|
  temp=fforward_max[i]+bback_max[N-i]
  temp2=bforward_max[i]+fback_max[N-i]
  ret=temp if temp>ret
  ret=temp2 if temp2>ret
end

p ret


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





signed main() {
   
  
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  
  int count;
  cin>>count;
  vector<int>all;
  for(int i=0;i<count;i++)
  {
    int temp;
    cin>>temp;
    all.push_back(temp);
  }


  int count1=0;
  //cout<<count<<endl;
  for(int i=0;i<count;i++)
  {
    for(int j=i+1;j<count;j++)
    {
      for(int k=j+1;k<count;k++)
      {
        if(all[i]!=all[j] && all[j]!=all[k] && all[i]!=all[k] && all[i]+all[j]>all[k] && all[j]+all[k]>all[i] && all[k]+all[i]>all[j])
          count1++;
      }
    }
  }


cout<<count1<<endl;
  return 0;
  }

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

map<string, int> M;
string s;

int main(void)
{
	int n;

	cin >> n;

	while (n--)
	{
		cin >> s;
		M[s]++;
	}

	cout << "AC x " << M["AC"] << endl;
	cout << "WA x " << M["WA"] << endl;
	cout << "TLE x " << M["TLE"] << endl;
	cout << "RE x " << M["RE"] << endl;
	return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define get(a, n)    for(ll it = 0; it < n; it++)    cin>>a[it];
#define mod 1000000007LL

/*	Author: 🆉🅴🅽🅾🅻🆄🆂	*/

// i, k => (i-1) (k, k-1, k-2, ..., k-ai)
// i, k-1 => (i-1) (k-1, k-2, ..., k-ai, k-ai-1)
// (i, k) = (i, k-1) - dp[i-1][k-ai-1] + dp[i-1][k]

int main(){
	ll n, k;	cin>>n>>k;
	ll a[n];	get(a, n);
	ll dp[2][k+1];	dp[0][0] = 1;
	for(ll i = 1; i <= k; i++)	dp[0][i] = 0;
	for(ll i = 1; i <= n; i++){
		dp[i&1][0] = 1;
		for(ll j = 1; j <= k; j++){
			dp[i&1][j] = (dp[i&1][j-1] + dp[!(i&1)][j])%mod;
			if(j >= a[i-1] + 1)
				dp[i&1][j] = (dp[i&1][j] + mod - dp[!(i&1)][j-a[i-1]-1])%mod;
		}
	}
	cout<<dp[n&1][k];
}

// Time: O(N*K)
// Space: O(K)

Measured memory_bytes: 5180
#include <iostream>
#include <vector>
#include <algorithm>

int main() {
  int N, K, temp;
  std::cin >> N >> K;
  
  std::vector<int> h;
  while (std::cin >> temp) {
    h.push_back(temp);
  }
  std::sort(h.begin(), h.end());
  
  auto itr = std::lower_bound(h.begin(), h.end(), K);
  
  std::cout << std::distance(itr, h.end()) << std::endl;
}

Measured memory_bytes: 892
# include "bits/stdc++.h"
using namespace std;
using LL = long long;
using ULL = unsigned long long;
const double PI = acos(-1);
template<class T>constexpr T INF() { return ::std::numeric_limits<T>::max(); }
template<class T>constexpr T HINF() { return INF<T>() / 2; }
template <typename T_char>T_char TL(T_char cX) { return tolower(cX); };
template <typename T_char>T_char TU(T_char cX) { return toupper(cX); };
const int vy[] = { -1, -1, -1, 0, 1, 1, 1, 0 }, vx[] = { -1, 0, 1, 1, 1, 0, -1, -1 };
const int dx[4] = { 0,1,0,-1 }, dy[4] = { 1,0,-1,0 };
int popcnt(unsigned long long n) { int cnt = 0; for (int i = 0; i < 64; i++)if ((n >> i) & 1)cnt++; return cnt; }
int d_sum(LL n) { int ret = 0; while (n > 0) { ret += n % 10; n /= 10; }return ret; }
int d_cnt(LL n) { int ret = 0; while (n > 0) { ret++; n /= 10; }return ret; }
LL gcd(LL a, LL b) { if (b == 0)return a; return gcd(b, a%b); };
LL lcm(LL a, LL b) { LL g = gcd(a, b); return a / g*b; };
# define ALL(qpqpq)           (qpqpq).begin(),(qpqpq).end()
# define UNIQUE(wpwpw)        sort(ALL((wpwpw)));(wpwpw).erase(unique(ALL((wpwpw))),(wpwpw).end())
# define LOWER(epepe)         transform(ALL((epepe)),(epepe).begin(),TL<char>)
# define UPPER(rprpr)         transform(ALL((rprpr)),(rprpr).begin(),TU<char>)
# define FOR(i,tptpt,ypypy)   for(LL i=(tptpt);i<(ypypy);i++)
# define REP(i,upupu)         FOR(i,0,upupu)
# define INIT                 std::ios::sync_with_stdio(false);std::cin.tie(0)

int n;
vector<int> s[303030];
int m, c;

int main(){
	cin >> n;
	REP(i, n){
		cin >> m;
		REP(j, m){
			cin >> c;
			s[i].emplace_back(c);
		}
		sort(ALL(s[i]));
		reverse(ALL(s[i]));
	}
	priority_queue<pair<int, pair<int, int>>> pq;
	LL ans = 0;
	for(int i = n - 1;i >= 0;i--){
		pq.push(make_pair(s[i][0], make_pair(i, 0)));
		pair<int, pair<int, int>> p = pq.top();
		pq.pop();
		ans += p.first;
		if(p.second.second + 1< (int)s[p.second.first].size()){
			pq.push(make_pair(s[p.second.first][p.second.second + 1], make_pair(p.second.first, p.second.second + 1)));
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 19556
#include<bits/stdc++.h>
#define rg register
#define file(x) freopen(x".in","r",stdin);freopen(x".out","w",stdout);
using namespace std;
int read() {
    int x=0,f=1;
    char c=getchar();
    while(c<'0'||c>'9') f=(c=='-')?-1:1,c=getchar();
    while(c>='0'&&c<='9') x=x*10+c-48,c=getchar();
    return f*x;
}
char c[10001];
int a[100001];
main(){
    scanf("%s",c);
    int n=strlen(c),tot=0,js=0,ans=0,bj=0,p=0;
    for(int i=0;i<n;i++){
	if(c[i]=='A'||c[i]=='C'||c[i]=='G'||c[i]=='T')
	    js++;
	else{
	    if(js>=ans)
		ans=js;
	    js=0;
	}
    }
    cout<<max(js,ans);
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<vector>
#include<map>
#include<unordered_map>
#include<set>
#include<string>
#include<algorithm>
#include<math.h>
#include<numeric>
#include<iomanip>
#include<queue>
#include<functional>
#include<iso646.h>
#include<bitset>

using namespace std;

typedef vector<int> vi;
typedef pair<int, int> pii;
typedef long long ll;
typedef vector<long long> vll;
typedef pair<long long, long long> pll;

const ll INF = 1e10;
//const ll MOD = 1e9 + 7;
const ll MOD = 998244353;


int main(){
	ll N;
	vll A;
	cin >> N;
	ll i, j;
	for (i = 0; i < N; i++){
		ll a;
		cin >> a;
		A.push_back(a - i);
	}
	sort(A.begin(), A.end());
	ll mid;
	if (N % 2 == 0){
		mid = A[N / 2 - 1];
	}
	else{
		mid = A[(N - 1) / 2];
	}
	ll ans = 0;
	for (i = 0; i < N; i++){
		ans += abs(A[i] - mid);
	}
	cout << ans << endl;
}

Measured memory_bytes: 2420
#include<stdio.h>
#define N 500002

int left(int i){return i*2;}
int right(int i){return  i*2+1;}

void maxheapify(int i, int *a, int n){
  int l,r,largest,tmp;

  l=left(i);
  r=right(i);

  if(l<=n && a[l]>a[i]) largest=l;
  else largest=i;

  if(r<=n && a[r]>a[largest]) largest=r;

  if(largest!=i){
    tmp=a[i];
    a[i]=a[largest];
    a[largest]=tmp;
    maxheapify(largest,a,n);
  }
}

void print(int *a, int n){
  int i;

  for(i=1;i<=n;i++) printf(" %d",a[i]);
  printf("\n");

}

int main(){
  int i,a[N],n;

  scanf("%d",&n);
  for(i=1;i<=n;i++) scanf("%d",&a[i]);

  for(i=n/2;i>0;i--) maxheapify(i,a,n);
  print(a,n);

  return 0;
}


Measured memory_bytes: 3644
#include <algorithm>
#include <iostream>
#include <set>
#include <vector>

using namespace std;

int n, k;
set<int> D;
vector<int> A;

signed main() {
    cin >> n >> k;
    for (; k; --k) {
        int d; cin >> d;
        D.insert(d);
    }

    for (int i = n; ; i++) {
        int j = i, f = 1;
        while (f && j) {
            int d = j % 10;
            j /= 10;
            if (D.count(d)) f = 0;
        }
        if (f) {
            cout << i << endl;
            return 0;
        }
    }
}

Measured memory_bytes: 3572
#include<stdio.h>


int main()
{
	int N, i = 0, j = 0;
	float l1, l2, l3, l4, X[4],Y[4];

	scanf("%d", &N);
	while (j < N)
	{
		for (i = 0; i < 4; i++)
		{
			scanf("%f%f", &X[i],&Y[i]);
		}

        l1 = X[1] - X[0];
		l2 = Y[1] - Y[0];
		l3 = X[3] - X[2];
		l4 = Y[3] - Y[2];
		if (l1*l4 == l2*l3)
		{
			printf("YES\n");
		}
		else
		{
			printf("NO\n");
		}
		++j;
	}

	return 0;
}


Measured memory_bytes: 612
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,m,temp,tempa,c,i;
	while(1){
		cin >> n >> m;
		if(n==m && n==0) break;
		int a[n],b[m],suma=0,sumb=0,d=0;
		for(i=0;i<n;i++){
			cin >> a[i];
			suma+=a[i];
		}
		for(i=0;i<m;i++){
			cin >> b[i];
			sumb+=b[i];
		}
		
		for(i=0;i<n-1;i++){
			for(int j=i+1;j<n;j++){
				if(a[i]>a[j]){
					temp=a[i];
					a[i]=a[j];
					a[j]=temp;
				}
			}
		}
		for(i=0;i<m-1;i++){
			for(int j=i+1;j<m;j++){
				if(b[i]>b[j]){
					temp=b[i];
					b[i]=b[j];
					b[j]=temp;
				}
			}
		}
		if(suma>sumb){
			c=suma-sumb;
			if(c%2==1){
				cout << -1 << endl;
			}else{
				c=c/2;
				for(i=0;i<n;i++){
					for(int j=0;j<m;j++){
						if(c==a[i]-b[j]){
							cout << a[i] << ' ' << b[j] << endl;
							d=1;
							break;
						}
					}
		
					if(d==1){
						break;
					}
				}
				if(i==n){
					cout << -1 << endl;
				}
			}
		}else{
			c=sumb-suma;
			if(c%2==1){
				cout << -1 << endl;
			}else{
				c=c/2;
				for(i=0;i<m;i++){
					for(int j=0;j<n;j++){
						if(c==b[i]-a[j]){
							cout << a[j] << ' ' << b[i] << endl;
							d=1;
							break;
						}
					}
					if(d==1){
						break;
					}
				}
				if(i==m){
					cout << -1 << endl;
				}
			}
		}
	}
}


Measured memory_bytes: 2928
#include <bits/stdc++.h>
#define rep(begin, end) for (i=begin;i<end;i++)
#define repj(begin, end) for (j=begin;j<end;j++)
#define init(arr, end, val) for (i=0;i<end;i++) arr[i] = val;
#define printint(i0, i1) printf("%d %d\n", i0, i1)

using namespace std;
typedef long long int ll;
const int inf = 1000000000;
const int mod = 1000000007;
const int nil = -1;
ll i, n, m;
ll x, k, d, ans;

int main() {
    scanf(" %lld %lld %lld", &x, &k, &d);
    if (x == 0) {
        if (k%2 == 0) ans = 0;
        else ans = d;
    } else  {
        x = abs(x);
        i = floor(x / d);
        if ((double)x /(double)d >= (double)k) ans = abs(x - k * d);
        else {
            if ((k-i)%2 == 0) ans = abs(x - i*d);
            else ans = abs(x - (i+1)*d);
        }
    } 
    printf("%lld\n", ans);
}

Measured memory_bytes: 3784
import sys

n,m,x,y = (int(_) for _ in input().split())
xl = [int(_) for _ in input().split()]
yl = [int(_) for _ in input().split()]

xl.append(x)
yl.append(y)

xl.sort()
yl.sort()

print('War') if (xl[-1] >= yl[0]) else print('No War')

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  long long N;
  long long cnt =0;
  cin >> N;
  for (long long i=1; i<=N; i++) {
    long long y = (long long)N/i;
    cnt += y*(y+1)*i/2;
  }
  cout << cnt << endl;
}

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

UL N;
LL C[100001][2]={};
LL ans=0;

int main(){
 scanf("%u",&N);
 rep(i,N+N){
  int x,y; scanf("%d%d",&x,&y);
  if(x<1){ ans += 1-x; x=1; }
  if(x>N){ ans += x-N; x=N; }
  if(y<1){ ans += 1-y; y=1; }
  if(y>2){ ans += y-2; y=2; }
  C[x-1][y-1]++;
 }
 rep(x,N){
  C[x][0]--; C[x][1]--;
  if(C[x][0]<0 && C[x][1]>0){
   LL c=min(-C[x][0],C[x][1]);
   ans+=c;
   C[x][0]+=c; C[x][1]-=c;
  }
  if(C[x][0]>0 && C[x][1]<0){
   LL c=min(C[x][0],-C[x][1]);
   ans+=c;
   C[x][0]-=c; C[x][1]+=c;
  }
  rep(y,2){
   if(C[x][y]>0){
    LL c=C[x][y];
    ans+=c;
    C[x+1][y]+=c; C[x][y]-=c;
   }
   if(C[x][y]<0){
    LL c=-C[x][y];
    ans+=c;
    C[x+1][y]-=c; C[x][y]+=c;
   }
  }
 }
 printf("%lld\n",ans);
 return 0;
}



Measured memory_bytes: 4776
input = STDIN.read.split("\n")

s = input[0]
target = input[1]


def loop_string(s)
  s.slice(-1) + s.slice(0..-2)
end

def check(s, target)
  initial_s = s
  while true
    s = loop_string(s)
    return 'Yes' if target == s
    break if s == initial_s
  end
  return 'No'
end

print check(s, target)

Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
#define INF 1000000000000000000
#define all(x) x.begin(), x.end()
#define PI 3.141592653589793

int main() {
    int n;
    cin >> n;
    map<int, int> cnt0;
    map<int, int> cnt1;
    rep(i, n) {
        int a;
        cin >> a;
        if (i % 2 == 0)
            cnt0[a]++;
        else
            cnt1[a]++;
    }

    int max0 = 0;
    int key = 0;
    for (auto p : cnt0) {
        if (p.second > max0) {
            key = p.first;
            max0 = p.second;
        }
    }

    int max1 = 0;
    for (auto p : cnt1) {
        if (p.second > max1 && p.first != key) {
            max1 = p.second;
        }
    }

    int ans0 = n - (max0 + max1);

    max1 = 0, max0 = 0, key = 0;
    for (auto p : cnt1) {
        if (p.second > max1) {
            key = p.first;
            max1 = p.second;
        }
    }

    for (auto p : cnt0) {
        if (p.second > max0 && p.first != key) {
            max0 = p.second;
        }
    }

    int ans1 = n - (max0 + max1);

    int res = min(ans0, ans1);
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 4992
n = int(raw_input())
T = 0
H = 0

for i in range(n):
    t, h = raw_input().split()
    if t > h:
        T += 3
    elif t < h:
        H += 3
    else:
        T += 1
        H += 1

print("%d %d" % (T, H))

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

using namespace std;

int main()
{
    string x,y;
    cin>>x>>y;
    int a,b;
    a=x[0];//cout<<a;
    b=y[0];

    if(a==b)
    {
        puts("=");
        //cout<<a-55<<"="<<b-55<<"."<<endl;
    }
    else if(a>b)
    {
       puts(">");
        //cout<<a-55<<">"<<b-55<<"."<<endl;
    }
    else if(a<b)
    {
        puts("<");
        //cout<<a-55<<"<"<<b-55<<"."<<endl;
    }

    return 0;
}


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

int main() {
    int P, Q, R;
    cin >> P >> Q >> R;

    int ABC, ACB, BAC;
    ABC = P + Q;
    ACB = R + Q;
    BAC = P + R;

    if (ABC < ACB) {
        if (ABC < BAC) {
            cout << ABC << endl;
        }
        else {
            cout << BAC << endl;
        }
    }
    else {
        if (ACB < BAC) {
            cout << ACB << endl;
        }
        else {
            cout << BAC << endl;
        }
    }
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {

    public static void main(String[] args) throws Exception {

        InputStreamReader is = new InputStreamReader(System.in);
        BufferedReader reader = new BufferedReader(is);

        String s = reader.readLine();

        switch (s) {
            case "Sunny":
                System.out.println("Cloudy");
                break;
            case "Cloudy":
                System.out.println("Rainy");
                break;
            default:
                System.out.println("Sunny");
                break;
        }
    }

}


Measured memory_bytes: 22612
#include<bits/stdc++.h>
#define INF 1<<29
using namespace std;

int main(){
	int a,b;
	scanf("%d%d",&a,&b);
	int c=0;
	for(int e=0;e<a;e++){
		int d=0;
		for(int f=0;f<b;f++){
			int g;
			cin>>g;
			if(g)d++;
		}
		c=max(c,d);
	}
	printf("%d\n",c);
}

Measured memory_bytes: 3200
import math
tax = input().split(" ")
tax_8 = int(tax[0])
tax_10 = int(tax[1])

price_8 = [math.ceil(tax_8*(100/8)), math.ceil((tax_8+1)*(100/8))-1]
price_10 = [math.ceil(tax_10*(10)), math.ceil((tax_10+1)*(10))-1]
if(min(price_8[1], price_10[1]) < max(price_8[0], price_10[0])):
    print(-1)
else:
    print(max(price_8[0], price_10[0]))


Measured memory_bytes: 3064
import java.util.*;
import java.io.*;
import java.math.BigInteger;
 
public class Main {
	
	
	public static void main(String[] args) {
	Scanner s = new Scanner(System.in);
	int N = s.nextInt();
	long D = s.nextLong();
	long[] X = new long[N];
	long[] Y = new long[N];
	for(int i = 0; i < N; i++){
		X[i] = s.nextLong();
		Y[i] = s.nextLong();
	}

	int count = 0;
	for(int i = 0; i < N; i++){
		if(D*D >= X[i]*X[i] + Y[i]*Y[i]){
			count++;
		}
	}
	System.out.println(count);
	
    
  }
}

Measured memory_bytes: 63832
#include<stdio.h>
#include<stdbool.h>
#define N 8
#define free -1
#define nfree 1

int dps[2*N-1], dng[2*N-1], row[N], col[N];

bool X[N][N];

void initialize(){
  int i;
  for(i=0; i<N; i++){
    row[i] = free;
    col[i] = free;
  }
  for(i=0; i<2*N-1; i++){
    dps[i] = free;
    dng[i] = free;
  }
}

void PrintBoard(){
  int i, j;
  for(i=0; i<N; i++){
    for(j=0; j<N; j++){
      if(X[i][j]){
        if(row[i] != j)   return;
      }
    }
  }

  for(i=0; i<N; i++){
    for(j=0; j<N; j++){
      if(row[i] == j)            printf("Q" );
      else printf(".");
    }

    printf("\n" );
  }
}

void recursive(int i){

  if(i==N){
    PrintBoard();
    return;
  }

  for(int j =0; j<N; j++){

    if(nfree == col[j] ||
       nfree == dps[i+j] ||
       nfree == dng[i-j+N-1])        continue;
       row[i] = j;
       col[j] = dps[i+j] = dng[i - j + N -1] = nfree;
       recursive(i+1);
       col[j] = dps[i+j] = dng[i - j + N -1] = free;
   }
}


int main(){
  initialize();

  for(int i = 0; i<N; i++){
    for(int j = 0;j < N;j++){
      X[i][j] = false;
    }
  }

  int s, t, u;
  scanf("%d", &s);

  for(int i; i<s; i++){
    scanf("%d%d", &t, &u);
    X[t][u] = true;
  }
  recursive(0);

  return 0;
}



Measured memory_bytes: 2112
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
using static System.Console;
using static System.Math;

namespace CP
{
    class Atria
    {
        static void Main(string[] args)
        {
            int n = int.Parse(ReadLine());
            long[] a = ReadLine().Split(' ').Select(long.Parse).ToArray();
            long[] b = ReadLine().Split(' ').Select(long.Parse).ToArray();
            long[] c = ReadLine().Split(' ').Select(long.Parse).ToArray();
            Array.Sort(a);
            Array.Sort(b);
            Array.Sort(c);
            long ans = 0;
            for (int i = 0; i < n; i++)
            {
                long target = b[i];
                long aCnt = LowerBound(a, target);
                long cCnt = c.Count() - (UpperBound(c, target));
                if(aCnt * cCnt > 0) ans += aCnt * cCnt;
            }
            WriteLine(ans);
        }
        /// <summary>
        /// 二分探索を用いて
        /// 指定された要素以上の値が現れる最初のindexを取得する関数
        /// 計算量はO(logn)
        /// </summary>
        /// <param name="a">昇順ソート済みの配列</param>
        /// <param name="target">探索対象</param>
        /// <returns></returns>
        static long LowerBound(long[] a, long target)
        {
            var left = 0;
            var right = a.Length - 1;
            while (left <= right)
            {
                var mid = left + (right - left) / 2;
                if (a[mid] < target) left = mid + 1;
                else right = mid - 1;
            }
            return left;
        }

        /// <summary>
        /// 二分探索を用いて
        /// 指定された要素より大きい値が現れる最小のindexを取得する関数
        /// 計算量はO(logn)
        /// </summary>
        /// <param name="a">昇順ソート済みの配列</param>
        /// <param name="target">探索対象</param>
        /// <returns></returns>
        static long UpperBound(long[] a, long target)
        {
            var left = 0;
            var right = a.Length - 1;
            while (left <= right)
            {
                var mid = left + (right - left) / 2;
                if (a[mid] <= target) left = mid + 1;
                else right = mid - 1;
            }
            return left;
        }
    }
}


Measured memory_bytes: 45680
#include <bits/stdc++.h>
#define INF 1000000000
#define MOD 1000000007
#define MAXN 100005
#define lint long long
using namespace std;

struct ii {
	int a, b;
	bool operator < (ii o) const {
		return tie(a, b) < tie(o.a, o.b);
	}
};

int TC, N, M, K, Q, x, y, z, ans;

int mod(lint n) { return (n%MOD + MOD)%MOD; }

int main() {
	#ifdef FAIRUZI10
	freopen("/home/fairuzi/Documents/CP/input.in", "r", stdin);
	#endif
	ios::sync_with_stdio(0);
	
	cin>>N>>M;
	ans = 0;
	for (int i = 0; i <= N; i++) {
		for (int j = 0; j <= N; j++) {
			if (0 <= M-i-j && M-i-j <= N) ans++;
		}
	}
	cout<<ans<<'\n';
	
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long int
const ll mod=1e9+7;
const int maxn=2e5+50;
using namespace std;
int main()
//int found; found=chaine.find(cara); if (found!=std::string::npos) how to verify if a caracter exists in a chaine
// toupper(caractere) ==> return the majuscule of a caractere
//floor(x) Returns the largest integer smaller than x
//ceil(x) returns  Returns the smallest integer greater
{


    int n,k;
    cin>>n>>k;
    int tab[n];
    ll dp[n];
    for(int i=0;i<n;i++)
    {
    	cin>>tab[i];
    	dp[i]=0;
	}
	if(k<=n)
	{
	
		for(int i=1;i<=k;i++)
		{
		   dp[i]=abs(tab[0]-tab[i]);	
		}
		for(int i=k+1;i<n;i++)
		{
			ll s=1e9;
			for(int j=1;j<=k;j++)
			{
				s=min(s,dp[i-j]+abs(tab[i-j]-tab[i]));
			}
			dp[i]=s;
		}
	    cout<<dp[n-1];
   }
   else
   {
   	  cout<<abs(tab[n-1]-tab[0]);
   }
}



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

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

  vector<int> a(n);
  for (int i = 0; i < n; i++) cin >> a[i];

  sort(a.begin(), a.end());
  reverse(a.begin(), a.end());
  
  int alice = 0;
  for (int i = 0; i < n; i++) {
    if (i % 2 == 0) alice += a[i];
    else alice -= a[i];
  }

  cout << alice << endl;
}


Measured memory_bytes: 256
# Python3 (3.4.3)
import sys
input = sys.stdin.readline

# -------------------------------------------------------------
# function
# -------------------------------------------------------------


# -------------------------------------------------------------
# main
# -------------------------------------------------------------
N,M = map(int,input().split())
AB = [tuple(map(int,input().split())) for _ in range(N)]


AB.sort(reverse=True)

import heapq
hq = []
ans = 0
for i in range(1,M+1):
    # n日 (n : 1-M) 後に受け取れる仕事を優先度つきキューに入れる
    # 高いものを優先的に出したいので負にしておく
    while AB and AB[-1][0] <= i:
        a,b = AB.pop()
        heapq.heappush(hq, -b)
    # 可能な仕事があれば, 一番高い仕事を行う
    #  - 値が負なので減算する
    if hq:
        ans -= heapq.heappop(hq)

print(ans)

Measured memory_bytes: 17268
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long A = sc.nextLong();
        long B = sc.nextLong();
        for(long tmp=0; tmp<=1010; tmp++) {
            if(A != tmp * 8 / 100) continue;
            if(B != tmp * 10 / 100) continue;
            System.out.println(tmp);
            return;
        }
        System.out.println(-1);
    }
}

Measured memory_bytes: 25044