akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int maxn = 100100;
ll prefgcd[maxn], suffgcd[maxn];
ll arr[maxn], n;

ll gcd(ll x, ll y) {
    if(x < y) swap(x, y);
    while(y > 0) {
        ll temp = x % y;
        x = y;
        y = temp;
        if(x < y) swap(x, y);
    }
    return x;
}

int main() {
    cin>>n;
    for(int i=1;i<=n;i++) {
        cin>>arr[i];
    }

    prefgcd[1] = arr[1];
    suffgcd[n] = arr[n];
    for(int i=2;i<=n;i++) {
        prefgcd[i] = gcd(arr[i], prefgcd[i-1]);
    }
    for(int i=n-1;i>=1;i--) {
        suffgcd[i] = gcd(suffgcd[i+1], arr[i]);
    }

    ll result = 1LL;
    for(int i=1;i<=n;i++) {
        if(i == 1) {
            // consider only suffix
            result = max(result, suffgcd[2]);
        }
        else if(i == n){
            result = max(result, prefgcd[n-1]);
        }
        else {
            result = max(result, gcd(prefgcd[i-1], suffgcd[i+1]));
        }
    }
    cout<<result<<"\n";
    return 0;
}

Measured memory_bytes: 2560
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define yesno(flg) if(flg){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define MAX_N 1002
#define i197 1000000007

using namespace std;

typedef long long ll;
typedef pair<ll,ll> P1;
typedef pair<int,int> Pi;
typedef pair<double,Pi> Pdi;
typedef pair<ll,int>Pli;
typedef pair<P1,ll> P2;
const ll INF=100000000000000001;
struct edge{int to,cost;};
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
struct Road{double cost;int a,b;};


int main() {

	int n,m,x;
	int a[101];
	int t=0,u=0;

	cin>>n>>m>>x;

	rep(i,m){
		cin>>a[i];
		if(a[i]<x){
			t++;
		}
		if(a[i]>x&&a[i]<n){
			u++;
		}
	}

	if(t>u){
		cout<<u<<endl;
	}else{
		cout<<t<<endl;
	}


	return 0;
}


Measured memory_bytes: 256
n,m = list(map(int,input().split()))
l = [1]*(n)
h = list(map(int,input().split()))
for i in range(m) :
    a,b = list(map(int,input().split()))
    if h[a-1] > h[b-1] :
        l[b-1] = 0
    elif h[a-1] < h[b-1] :
        l[a-1] = 0
    else :
        l[a-1] = 0
        l[b-1] = 0
print(len(list(filter(lambda x:x == 1,l))))        


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

#include<bits/stdc++.h>

using namespace std;

void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

#define SPEED ios_base::sync_with_stdio(false);cin.tie(nullptr)
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define all(v) v.begin(), v.end()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

using ll = long long;
using P = pair<ll, ll>;

constexpr long double PI = 3.14159265358979323846264338327950288L;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

class BIMissYou {
public:
    void solve(istream& cin, ostream& cout) {
      SPEED;
      string s; cin >> s;
      int n = s.size();
      rep(i, n) {
        cout << 'x';
      }
      cout << endl;
    }
};

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

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<stdio.h>
#include<stdlib.h>
#include<string>
#include<vector>
#include<math.h>
#include<stack>
#include<queue>
#include<map>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
const long long mod = 1e9 + 7;
typedef long long ll;

int main(){
  int n;
  cin >> n;
  int w[n];
  int ans = 0, cnt = 0;
  rep(i,n) cin >> w[i];
  for(int i = 1; i < n; i++){
     if(w[i] <= w[i-1])cnt++;
     else{
        if(cnt >= ans) ans = cnt;
        cnt = 0;
     }
     if(i == n - 1) if(cnt >= ans) ans = cnt;
     
  }
  cout << ans << endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n) for (int i = n - 1; i >= 0; i--)
using namespace std;
using Graph = vector<vector<int>>;
#define MOD 1000000007
#define MOD2 998244353
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
#define EPS (1e-10)
typedef long long ll;
typedef pair<ll, ll> P;


int a[110], b[110];

int main(){
    int n;
    cin >> n;
    rep(i, n) cin >> a[i+1];    
    rep(i, n) cin >> b[i+1];

    rep(i, n) a[i+1] += a[i];
    rep(i, n) b[i+1] += b[i];

    int ans = 0;

    rep(i, n+1){
        // cout << a[i] + b[n] - b[i-1] << endl;
        ans = max(ans, a[i] + b[n] - b[i-1]);
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
fun main(args: Array<String>) {
    val pw = java.io.PrintWriter(System.out)
    Problem.solve(java.util.Scanner(System.`in`), pw)
    pw.flush()
}

data class ModInt(var value: Long) {
    operator fun timesAssign(b: Long) {
        this.value *= b
        this.value %= MOD
    }

    companion object {
        const val MOD = 1000000007L
    }
}

fun <A> countList(a: List<A>): Map<A, Long> {
    val result = mutableMapOf<A, Long>()
    a.forEach {
        result[it] = (result[it] ?: 0L) + 1L
    }
    return result
}

object Problem {
    lateinit var dfs: (Int, Int) -> Unit

    fun solve(sc: java.util.Scanner, pw: java.io.PrintWriter) {
        val N = sc.next()
        val S = sc.next()

        val ans = ModInt(1L)
        countList(S.toList()).forEach { ent ->
            ans *= (ent.value + 1)
        }
        pw.println(ans.value - 1)
    }
}


Measured memory_bytes: 35132
#include <bits/stdc++.h>
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

using namespace std;

#define rep(i, a, b) for (int i = a; i < b; i++)
#define rrep(i, a, b) for (int i = a; i <= b; i++)
#define all(a)  begin((a)),end((a))
#define uniq(c) (c).erase(unique(all((c))), end((c)))

#define TRUE 1
#define FALSE 0
#define NIL -1

int counter(int x) {
    if(x == 0) return 0;
    return counter(x >> 1) + (x & 1);
}

int main() {
    int N;
    int A[20];
    int x[20][20];
    int y[20][20];

    cin >> N;
    for (int i = 0; i < N; i++) {
        cin >> A[i];
        for(int j = 0; j < A[i]; j++) {
            cin >> x[i][j] >> y[i][j];
        }
    }

    int ans = 0;
    for (int bits = 0; bits < (1 << N); bits++) {
        bool ok = true;
        // i: 1 ~ N
        for (int i = 0; i <= N; i++) {
            //
            if (!(bits & (1 << i))) continue;
            for (int j = 0; j < A[i]; j++) {
                if (((bits >> (x[i][j]-1)) & 1) ^ y[i][j]) ok = false;
            }
        }
        if (ok) ans = max(ans, counter(bits));
    }
    cout << ans << endl;
}

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

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cout<<setprecision(32);

	int h, w;
	cin>>h>>w;
	vector<string> a(h);
	for(auto &x : a){
		cin>>x;
	}
	vector<int> dx({1, -1, 0, 0});
	vector<int> dy({0, 0, 1, -1});
	for(int i = 0; i < h; i++){
		for(int j = 0; j < w; j++){
			if(a[i][j] != '#')continue;
			bool flg = false;
			for(int k = 0; k < 4; k++){
				int nx = i + dx[k];
				int ny = j + dy[k];
				if(nx >= 0 && nx < h && ny >= 0 && ny < w && a[nx][ny] == '#')flg = true;
			}
			if(!flg){
				cout<<"No"<<endl;
				exit(0);
			}
		}
	}
	cout<<"Yes"<<endl;

	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <string>
#include <iostream>
#include <math.h>
#include <array>
#include <vector>
#include <queue>
#include <stack>
#include <numeric>
#include <list>
#include <deque>
#include <map>
#include <set>

using namespace std;

typedef long long LL;
typedef pair<int, int>PII;

#define FOR(i,a,b) for(int i = (a); i < (b); ++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), rend()
#define PB pushback
#define SORT(c) sort((c).begin(),(c).end())

const LL INF = 1LL << 60;

//priority_queue<int> p;

int i, j, k, tmp, ans, cnt, N, gu,ki;
string s;

//scanf("%d",&N);

//printf("%d", ans);

//cout <<  << endl;


int main(void) {
	bool flag;
	cin >> s;
	REP(i, s.size()) {
		tmp = s.at(i) - '0';
		if (tmp == 1) {
			ki++;
		}
		else {
			gu++;
		}
	}
	
	

	printf("%d", min(ki, gu) * 2);
	return 0;
}

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

int main(){
  int n;
  while(1){
    cin >> n;
    if(n == 0) break;
    int cou=0;
    while(n != 1){
      if(n%2 == 0) n = n / 2;
      else n = n * 3 + 1;
      cou++;
    }
    cout << cou << endl;
  }
}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
using namespace std;
vector<int>v[3],g[2],l[200003]; 
int n,ans[200003];bool used[200003];
void dfs(int x,bool a,int p){
	g[a].push_back(x);
	for(int i=0;i<l[x].size();i++)
		if(l[x][i]!=p)
			dfs(l[x][i],a^1,x);
}
int main(){
	scanf("%d",&n);
	for(int i=1;i<n;i++){int x,y;scanf("%d%d",&x,&y);x--;y--;l[x].push_back(y);l[y].push_back(x);}
	dfs(0,0,-1);
	for(int i=1;i<=n;i++)v[i%3].push_back(i);
	if(g[1].size()<g[0].size())swap(g[0],g[1]);
	if(g[0].size()<=v[0].size())
	{
		for(int i=0;i<g[0].size();i++)
			ans[g[0][i]]=v[0][i],
			used[v[0][i]]=1;
		for(int i=1;i<=n;i++)
			if(!used[i])
				ans[g[1].back()]=i,
				g[1].pop_back();
	}else{
		for(int i=0;i<v[1].size();i++)
			ans[g[0].back()]=v[1][i],
			g[0].pop_back();
		for(int i=0;i<v[2].size();i++)
			ans[g[1].back()]=v[2][i],
			g[1].pop_back();
		for(int i=0;i<g[0].size();i++)
			ans[g[0][i]]=v[0].back(),
			v[0].pop_back();
		for(int i=0;i<g[1].size();i++)
			ans[g[1][i]]=v[0].back(),
			v[0].pop_back();
	}
	for(int i=0;i<n;i++)printf("%d ",ans[i]);
}

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

int main(){
  int n, x;
  cin >> n >> x;
  
  int m[n];
  int i = 0;
  for(; i < n; i++){
    cin >> m[i];
    x -= m[i];
  }
  
  sort(m, m+n);
  for(; x >= m[0]; i++){
    x -= m[0];
  }
  cout << i << endl;
    
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define eps 1e-9
#define maxp 99940000
#define mod 1000000007
#define pi 3.141592653589793238
#define sin(s) scanf("%lld",&s);
#define sout(s) printf("%lld\n",s);
#define in(s) cin>>s
#define in2(a,b) cin>>a>>b
#define in3(a,b,c) cin>>a>>b>>c
#define vll vector<ll>
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define endl '\n'
#define sp ' '
#define gear_change ios_base::sync_with_stdio(false),cin.tie(0)
#define nfl(i,n) for(i=0;i<n;i++)
#define sfl(i,s,e) for(i=s;i<e;i++)
#define ufl(i,n) for(i=n-1;i>=0;i--)
ll power(ll x,ll y){
    ll ret=1;
    while(y>0){
        if(y&1)
            ret=(ret*x);
        y/=2;
        x=(x*x);
    }
    return ret;
}
string rot(string s){
	string ret="";
	ll i;
	for(i=1;s[i];i++){
		ret+=s[i];
	}
	ret+=s[0];
	return ret;
}
void solve(){
	ll n,i;
	cin>>n;
	vll vec(n);
	map<ll,ll>mp;
	nfl(i,n-1){
		cin>>vec[i];
		mp[vec[i]]++;
	}
	sfl(i,1,n+1){
		cout<<mp[i]<<endl;
	}
}	
int main(){
	gear_change;
	ll test=1;
	// in(test);/
	while(test--){
		solve();
	}
}	


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

using namespace std;
#define FOR(i,bg,ed) for(int i=bg;i<ed;i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) v.begin(),v.end()


typedef long long LL;
typedef double D;

namespace _DSU{
    int cnt = 0;
    int mem[2][212345];
    int *get(){
        return mem[cnt++];
    }
}
struct UF{
    int *par,*rank;
    int find(int x){
        if(par[x]==x)return x;
        else return par[x]=find(par[x]);
    }
    UF(int n){
        par  = _DSU::get();
        rank  = _DSU::get();
        REP(i,n){
            par[i]=i;
            rank[i]=0;
        }
    }
    bool unite(int x,int y){
        x=find(x);
        y=find(y);
        if(x==y)return false;
        if(rank[x]<rank[y])par[x]=y;
        else{
            par[y]=x;
            if(rank[x]==rank[y])rank[x]++;
        }
        return true;
    }
    bool same(int x,int y){
        return find(x)==find(y);
    }
};

typedef vector<int> V;
typedef vector<V> VV;
int a[51234];
int b[51234];
int c[51234];
int f(int v,VV &g,V &used,V &cnt,V& depth,int pe=-1){
    int ret=0;
    used[v]=1;

    for(auto &e:g[v]){
        if(e==pe)continue;
        int u=v^a[e]^b[e];
        if(used[u]){
            if(depth[u]<depth[v]){
                cnt[v]++;
                cnt[u]--;
            }
        }
        else {
            depth[u]=depth[v]+1;
            ret+=f(u,g,used,cnt,depth,e);
            cnt[v]+=cnt[u];
        }
    }
    if(cnt[v]==0) ret++;
    return ret;
}

LL count(VV g){
    int N=g.size();
    V used(N,0);
    V cnt(N,0);
    V depth(N,0);
    int ans=0;
    REP(i,N)if(!used[i]){
        ans+=f(i,g,used,cnt,depth)-1;
    }
    return ans;
}
#define fi first
#define se second
#define pb push_back
#define P pair
int main(){
    int n,m;
    cin>>n>>m;
    vector<P<int,int>> edge(m);
    REP(i,m){
        cin>>a[i]>>b[i]>>c[i];
        a[i]--;
        b[i]--;
        edge[i]={c[i],i};
    }
    sort(ALL(edge));
    UF uf(n);
    LL r1=0;
    LL r2=0;
    REP(i,m){
        int bg=i;
        int ed=i;
        while(ed+1<=m&&c[edge[bg].se]==c[edge[ed+1].se])
            ed++;
        VV g(n);
        FOR(j,bg,ed+1){
            int e = edge[j].se;
            a[e]=uf.find(a[e]);
            b[e]=uf.find(b[e]);

            int s=a[e];
            int t=b[e];

            if(!uf.same(s,t)){
                g[uf.find(s)].pb(e);
                g[t].pb(e);
            }
        }
        LL k = count(g);
        r1+=k;
        r2+=c[edge[bg].se]*k;
        FOR(j,bg,ed+1){
            int e = edge[j].se;
            uf.unite(a[e],b[e]);
        }
        i=ed;
    }
    cout<<r1<<" "<<r2<<endl;
    return 0;
}

Measured memory_bytes: 4904
using System;
class p
{
  static void Main()
  {
    string O = Console.ReadLine();
    string E = Console.ReadLine();
    for (int i = 0; i < E.Length; i++) {
      O = O.Insert(2 * (i + 1) - 1, E[i].ToString());
    }
    Console.WriteLine(O);
  }
}

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

using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define MIN(a,b) ((a)>(b)? (b): (a))
#define MAX(a,b) ((a)<(b)? (b): (a))

const long long INF = 1LL << 60;

typedef unsigned long long ll;

const long long MOD = 1000000000 + 7;

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;
}

int main(){
    ll x;
    cin >> x;
    ll cnt = 0;
    ll stock = 100;
    while(true){
        cnt += 1;
        stock *= 1.01;
        if(stock >= x){
            cout << cnt << endl;
            return 0;
        }
    }
    return 0;
}


Measured memory_bytes: 3632
package main

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

var sc = bufio.NewScanner(os.Stdin)
var out = bufio.NewWriter(os.Stdout)

func main() {
	sc.Buffer(make([]byte, 0), 1e6) // maxTokenSize
	sc.Split(bufio.ScanWords)
	defer out.Flush()
	/* --- code --- */
	a := nextInt()
	fmt.Println(a + a*a + a*a*a)
}

// -*-*-*-*-*-*-*-*-
// * I/O utilities *
// -*-*-*-*-*-*-*-*-

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	a, _ := strconv.Atoi(next())
	return a
}

func nextInt64() int64 {
	a, _ := strconv.ParseInt(next(), 10, 64)
	return a
}

func nextFloat64() float64 {
	a, _ := strconv.ParseFloat(next(), 64)
	return a
}

func nextInts(n int) []int {
	ret := make([]int, n)
	for i := 0; i < n; i++ {
		ret[i] = nextInt()
	}
	return ret
}
func nextFloats(n int) []float64 {
	ret := make([]float64, n)
	for i := 0; i < n; i++ {
		ret[i] = nextFloat64()
	}
	return ret
}
func nextStrings(n int) []string {
	ret := make([]string, n)
	for i := 0; i < n; i++ {
		ret[i] = next()
	}
	return ret
}

func split(s string) []string {
	ret := make([]string, len([]rune(s)))
	for i, v := range []rune(s) {
		ret[i] = string(v)
	}
	return ret
}

// -*-*-*-*-*-*-*-*-
// * tool snippets *
// -*-*-*-*-*-*-*-*-
func duplicate2Int(base [][]int) (ret [][]int) {
	ret = make([][]int, len(base))
	for i, v := range base {
		ret[i] = append([]int{}, v...)
	}
	return
}

func max(a, b int) int {
	return int(max64(int64(a), int64(b)))
}

func max64(a int64, b int64) int64 {
	if a < b {
		return b
	}
	return a
}

func min(a, b int) int {
	return int(min64(int64(a), int64(b)))
}

func min64(a int64, b int64) int64 {
	if a < b {
		return a
	}
	return b
}

// *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
// * math flavor typical theories *
// *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
func gcd(a, b int) int {
	if a > b {
		return gcd(b, a)
	}
	for a != 0 {
		a, b = b%a, a
	}
	return b
}

func pow(a, b int) (ret int) {
	ret = a
	for i := 0; i < b-1; i++ {
		ret *= a
	}
	return
}

func powMod(n, m, mod int) (ret int) {
	ret = 1
	for m > 0 {
		if m&1 == 1 {
			ret *= n
			ret %= mod
		}
		n *= n
		n %= mod
		m >>= 1
	}
	return ret
}


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

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


Measured memory_bytes: 3092
#include<stdio.h>
#include <iostream>
#include <math.h>
#include <numeric>
#include <vector>
#include <map>
#include <functional>
#include <stdio.h>
#include <array>
#include <algorithm>
#include <string>
#include <string.h>
#include <assert.h>
#include <stdio.h>
#include <queue>
#include<iomanip>
#include<bitset>
#include<stack>
#include<set>
#include<limits>
#include <complex>
#include<cstdlib>
using namespace std;

bool isso(long long int a) {
	if (a == 1||a==0)return false;
	for (long long int i = 2; i*i <= a; ++i) {
		if ((a%i)) {
		}
		else {
			return false;
		}
	}
	return true;
}



long long int powint(long long int a, long long int b) {
	assert(b >= 0);
	if (b == 0)return 1;
	if (b == 1)return a;
	long long int ans = 1;
	long long int aa = powint(a, b / 2);
	ans *= aa*aa;
	if (b % 2)ans *= a;
	return ans;
}

struct edge {
	int from;
	int to;
	int cost;
};

struct aa {
	int now;
	int fuel;
	int cost;
};

class Compare {
public:
	//keiroが昇順に並ぶ
	bool operator()(const aa&l, const aa&r) {
		return l.cost> r.cost;
	}
};


int main() {
	while (1) {


		int N, M; cin >> N >> M;
		if (!N)break;
		vector<int>nums;
		for (int i = 0; i <N; ++i) {
			int s; cin >> s;
			nums.push_back(s);
		}
		int sum1 = accumulate(nums.begin(), nums.end(),0);
		vector<int>nums2;
		for (int i = 0; i <M; ++i) {
			int s; cin >> s;
			nums2.push_back(s);
		}
		int sum2 = accumulate(nums2.begin(), nums2.end(), 0);
		int amin[2];
		amin[0] = 9999;
		amin[1] = 9999;
		for (int i = 0; i < N; ++i) {
			for (int j = 0; j < M; ++j) {
				sum1 += nums2[j] - nums[i];
				sum2 += nums[i] - nums2[j];
				if (sum1 == sum2) {
					amin[0] = min(amin[0], nums[i]);
					amin[1] = min(amin[1], nums2[j]);
				}
				sum1 -= nums2[j] - nums[i];
				sum2 -= nums[i] - nums2[j];
			}
		}
		if (amin[0] == 9999) {
			cout << -1 << endl;
		}
		else {
			cout << amin[0] << " " << amin[1] << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 3052
A,B,m = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))

norm=min(a)+min(b)

for i in range(m):
    x,y,c=map(int,input().split())
    x-=1
    y-=1
    norm=min(norm,a[x]+b[y]-c)
print(norm)

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

int main() {
	int N, M;
	cin >> N >> M;
	vector<int> Lovers(M+1);
	for (int i = 0; i < N; i++) {
		int K;
		cin >> K;
		for (int j = 0; j < K; j++) {
			int A;
			cin >> A;
			Lovers[A]++;
		}
	}
	int ans = 0;
	for (int i = 1; i <= M; i++) if (Lovers[i] == N) ans++;
	cout << ans << endl;
}

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

using namespace std;


void solve() {
    int a[3];
    cin >> a[0] >> a[1] >> a[2];
    sort(a, a+3);
    cout << a[0]*a[1]/2;
}

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


Measured memory_bytes: 256
n = int(input())
rl = []
for i in range(n):
    x,l = map(int,input().split())
    rl.append([x+l,x-l])
rl.sort()
ans = 1
migihasi = rl[0][0]
hasikouho = []
for i in range(1,n):
    right = rl[i][0]
    left = rl[i][1]
    if left < migihasi:continue
    migihasi = right
    ans += 1

    
        
 
print(ans)

    
    


Measured memory_bytes: 20104
#include<bits/stdc++.h>
typedef long long ll;
typedef long double ld;
#define FASTIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define PRECISION std::cout << std::fixed << std::setprecision(20);
  
using namespace std;
 
const ll inf = 2e9;
const ll N = 1e5+100;
const ll bits = 20;
const ll mod = 1e9+7;
const ld pi = 3.14159265358979323846;

struct item{
	string s;
	int cnt;
};

int main(){
    FASTIO;
    PRECISION;

	string s;
	int n;
	cin>>n;
	
	map<string, int>mp;
	
	int ma = 0;
	
	for(int i=0;i<n;i++){
		cin>>s;
		mp[s]++;
		
		ma = max(ma,mp[s]);
	}
	
	vector<string>arr;
	for(auto x: mp){
		if(x.second==ma){
		    arr.push_back(x.first);
		}
	}
	
	
	sort(arr.begin(),arr.end());
	
	for(auto x: arr){
		cout<<x<<"\n";
	}
	
	
}

Measured memory_bytes: 25584
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<n; i++)
#define REP(i, n) for(int i=0; i<=n; i++)
#define repr(i, n) for(int i=n; i>0; i--)
#define REPR(i, n) for(int i=n; i>=0; i--)
#define FOR(i, a, b) for(int i=a; i<b; i++)
#define ALL(v) v.begin(),v.end()
#define pb push_back
#define eb emplace_back
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<int, ll> pil;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LLINF = 1e18;
const ll MOD = 1e9+7;
template<class T> void puts(T x) { std::cout << x << std::endl; }
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 MAX = 1005;
ll nck[MAX][MAX];

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

    for (int i = 0; i <= N; i++) nck[i][0] = 1;
    for (int i = 0; i <= N; i++) nck[i][i] = 1;

    for (int n = 2; n <= N; n++) {
        for (int k = 1; k < n; k++) {
            nck[n][k] = nck[n-1][k-1] + nck[n-1][k];
            nck[n][k] %= MOD;
        }
    }

    cout << nck[N-1][K-1] << endl;
}



Measured memory_bytes: 10016
#include <bits/stdc++.h>
#define ll long long int
#define endl "\n"
#define mod 1000000007
#define mem(a,val) memset(a,val,sizeof(a))
#define ps(x,noOfDecimal) fixed<<setprecision(noOfDecimal)<<x
	
using namespace std;
int main()
{
	
	
	
		int n;
		cin>>n;
		// bool arr[1000001];

		vector<bool> arr(n+1,false);
		for(int i=3;i<=n;i+=3){
			arr[i]=true;
		}
		for(int i=5;i<=n;i+=5){
			arr[i]=true;
		}
		ll ans=0;
		for(int i=1;i<=n;i++){
			if(arr[i]==false){
				ans+=i;
			}
		}
		cout<<ans;

	return 0;
}

Measured memory_bytes: 3744
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
using pint = pair<int, int>;
using vi = vector<int>;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()

const int MOD = 1000000007;
const int INF = 1 << 30;

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


Measured memory_bytes: 256
/*
*          Name : chaitanya
*
*     Institute : ANITS,Visakhapatnam
*
*/
#include<cstdio>
#include<iostream>
#include<sstream>
#include<fstream>
#include<iomanip>
#include<algorithm>
#include<cmath>
#include<complex>
#include<cstring>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<bitset>
#include<numeric>
#include<limits>
#include<climits>
#include<cfloat>
#include<functional>
#include<iterator>
#include <random>
#define inf  1000000000
#define all(x) begin(x),end(x)
#define ll long long int
#define ff first
#define ss second
#define pb push_back
const ll mod = 1000000007;
#pragma GCC optimization ("O3")
const int N = 100005;
using namespace std;

int main()
{
 
  // freopen("input.txt","r",stdin);
  // freopen("output.txt","w",stdout);
  //ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
  int n,p,q;
  cin >> n >> p >> q;
  vector <int> s(n+1);
  map<int,int>m;
  for (int i = 1; i <= n ; ++i)
  {
    s[i] = p;
  }
  for (int i = 0; i < q; ++i)
  {
    int a;
    cin >> a;
    m[a]++;
  }
  for (int i = 1; i <=n; ++i)
  {
    s[i] = p - (q-m[i]);
  }
  for (int i = 1; i <= n; ++i)
  {
    if (s[i] > 0)
    {
      cout << "Yes\n";
    }
    else
    {
      cout << "No\n";
    }
  }
  return 0;
}


Measured memory_bytes: 5760
def vacation(mat):
    temp = [0] * 3
    dp = mat[0]
    for i in range(1, len(mat)):
        temp[0] = mat[i][0] + max(dp[1], dp[2])
        temp[1] = mat[i][1] + max(dp[0], dp[2])
        temp[2] = mat[i][2] + max(dp[0], dp[1])
        dp = temp[:]
    return max(dp)


if __name__ == '__main__':
    n = int(input())
    mat = [[0] * 3 for _ in range(n)]
    for i in range(n):
        mat[i] = list(map(int, input().split()))

    print(vacation(mat))


Measured memory_bytes: 67180
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		
		int a = scan.nextInt();
		int b = scan.nextInt();
		int c = scan.nextInt();
		
		if((a==b&&a==c)||(a!=b&&a!=c&&b!=c)) {
			System.out.println("No");
		}else {
			System.out.println("Yes");
		}
		
		
	}
	
}

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

using namespace std;

int main()
{
    long N, M;
    long A;
    long B, C;
    set<long> s;
    vector<pair<long, long>> vec;
    map<long, long> m;
    long sum = 0;

    cin >> N >> M;
    for (long i=0; i < N; i++) {
        cin >> A;
        m[A]++;
        s.insert(A);
    }


    for (long i = 0; i < M; i++) {
         cin >> B >> C;
         vec.push_back(make_pair(C, B));
    }
    //cout << 1 << endl;
    sort(vec.begin(), vec.end(), greater<pair<long, long>>());
    //cout << 2 << endl;
    //cout << vec[0].first;
    for (long i=0; i < M; i++) {
        long count = 0;
       for(auto itr = s.begin(); itr != s.end() && !s.empty() && count < vec[i].second; count++) {
           auto tmp = vec[i].first;
           //cout << *itr << endl;
           if (tmp < *itr) {
               if (itr == s.begin()) {
                    for (auto itr = m.begin(); itr != m.end(); ++itr) {
                        sum += itr->first*itr->second;
                    }
                    cout << sum << endl;
                    return 0;
               }
               break;
           } else {
               //s.insert(tmp);
               m[*itr]--;
               if (m[*itr] == 0) {
                    itr = s.erase(itr);
               }
               m[tmp]++;
           }
           //cout << "count: "  << count << endl;
       }
      
    }
    //cout << 3 << endl;
    for (auto itr = m.begin(); itr != m.end(); ++itr) {
            sum += itr->first*itr->second;
    }
    cout << sum << endl;

  return 0;
}

Measured memory_bytes: 16244
/*  -*- coding: utf-8 -*-
 *
 * b.cc: B - An Odd Problem
 */

#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 */

/* typedef */

/* global variables */

/* subroutines */

/* main */

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

  int c = 0;
  for (int i = 1; i <= n; i++) {
    int ai;
    scanf("%d", &ai);
    if ((i * ai) & 1) c++;
  }

  printf("%d\n", c);
  return 0;
}


Measured memory_bytes: 3084
package main
 
import (
	"fmt"
	"strings"
)

func replace(wk string) string {
	var res = ""
 
	wk = reverse(wk)
	wk = strings.Replace(wk, "resare", "", -1)
	wk = strings.Replace(wk, "esare", "", -1)
	wk = strings.Replace(wk, "remaerd", "", -1)
	wk = strings.Replace(wk, "maerd", "", -1)

	if len(wk) == 0 {
		res = "YES"
	} else {
		res = "NO"
	}
	return res
}
 
//reverse stringreverse
func reverse(s string) string {
	runes := []rune(s)
	for i, j := 0, len(runes)-1; i < j; i, j = i+1, j-1 {
		runes[i], runes[j] = runes[j], runes[i]
	}
	return string(runes)
 
}
 
func main() {
	var wk string
	fmt.Scan(&wk)
	var res = replace(wk)
	fmt.Println(res)
}
 

Measured memory_bytes: 2176
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Random;
import java.util.StringTokenizer;

public class Main {

    public static void main(String[] args) {
        final FastScanner fs = new FastScanner();
        int n = fs.nextInt();
        int window = fs.nextInt()-1;
        int[] arr = fs.nextIntArray(n);
        Arrays.sort(arr);
        int res = (int) (1e9 + 5);
        int j =0;
        for (int i = 0; i < n; i++, window--) {
            if(window == 0) {
                res= Math.min(res, arr[i] - arr[j++]);
                window++;
            }
        }
        System.out.println(res);
    }

    static final class Util {
        public static void shuffleSort(int[] x) {
            shuffle(x);
            Arrays.sort(x);
        }

        public static void shuffleSort(long[] x) {
            shuffle(x);
            Arrays.sort(x);
        }

        public static void shuffle(int[] x) {
            final Random r = new Random();

            for (int i = 0; i <= x.length - 2; i++) {
                final int j = i + r.nextInt(x.length - i);
                swap(x, i, j);
            }
        }

        public static void shuffle(long[] x) {
            final Random r = new Random();

            for (int i = 0; i <= x.length - 2; i++) {
                final int j = i + r.nextInt(x.length - i);
                swap(x, i, j);
            }
        }

        public static void swap(int[] x, int i, int j) {
            final int t = x[i];
            x[i] = x[j];
            x[j] = t;
        }

        public static void swap(long[] x, int i, int j) {
            final long t = x[i];
            x[i] = x[j];
            x[j] = t;
        }

        private Util() {}
    }

    static class FastScanner {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer("");

        private String next() {
            while (!st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    //noinspection CallToPrintStackTrace
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        int[] nextIntArray(int n) {
            final int[] a = new int[n];
            for (int i = 0; i < n; i++) { a[i] = nextInt(); }
            return a;
        }

        long[] nextLongArray(int n) {
            final long[] a = new long[n];
            for (int i = 0; i < n; i++) { a[i] = nextLong(); }
            return a;
        }
    }
}


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

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

using namespace std;
using lint=long long;

const lint INF=LLONG_MAX;

int main(){
	int n,K; cin>>n>>K;
	int x[50],y[50];
	rep(i,n) cin>>x[i]>>y[i];

	vector<int> X(x,x+n),Y(y,y+n);
	sort(X.begin(),X.end());
	sort(Y.begin(),Y.end());
	X.erase(unique(X.begin(),X.end()),X.end());
	Y.erase(unique(Y.begin(),Y.end()),Y.end());
	rep(i,n){
		x[i]=lower_bound(X.begin(),X.end(),x[i])-X.begin();
		y[i]=lower_bound(Y.begin(),Y.end(),y[i])-Y.begin();
	}

	int sum[51][51]={};
	rep(i,n) sum[y[i]+1][x[i]+1]++;
	rep(i,50) rep(j,50) sum[i+1][j+1]+=sum[i+1][j]+sum[i][j+1]-sum[i][j];

	lint ans=INF;
	rep(j,Y.size()) rep(i,j) rep(l,X.size()) rep(k,l) {
		int cnt=sum[j+1][l+1]-sum[j+1][k]-sum[i][l+1]+sum[i][k];
		if(cnt>=K) ans=min(ans,1LL*(X[l]-X[k])*(Y[j]-Y[i]));
	}
	cout<<ans<<endl;

	return 0;
}


Measured memory_bytes: 256
//   _/                _/                 _/_/_/   _/
//_/_/_/_/   _/_/   _/_/_/_/   _/_/    _/       _/_/
// _/     _/    _/   _/     _/    _/  _/_/_/     _/
//_/     _/    _/   _/     _/    _/  _/    _/   _/
// _/_/   _/_/       _/_/   _/_/      _/_/     _/
#include<iostream>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<set>
#include<map>
#include<queue>
#include<vector>
using namespace std;
typedef long long ll;
const int MOD=1e9+7;
const double pi=acos(-1);
int main() {
  cin.tie(0),cout.tie(0);
  ios::sync_with_stdio(false);
  ll n,a[100005]={},c[3]={},ans=1;
  cin >> n;
  for(int i=0; i<n; i++) {
    cin >> a[i];
  }
  for(int i=0; i<n; i++) {
    ll cnt=0;
    for(int j=0; j<3; j++) {
      if(a[i]==c[j]) {
        cnt++;
      }
    }
    if(cnt==0) {
      cout << 0 << endl;
      return 0;
    }
    ans*=cnt;
    ans%=MOD;
    if(a[i]==c[0]) {
      c[0]++;
    }
    else if(a[i]==c[1]) {
      c[1]++;
    }
    else if(a[i]==c[2]) {
      c[2]++;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 1024
from math import ceil, floor
h, w = map(int, input().split())

def solve(H, W):
    ans = float('inf')
    for h in range(1, H):
        a = h * W
        b = (H-h) * floor(W/2)
        c = H * W - (a + b)
        d1 = max(a,b,c) - min(a,b,c)
        b = W * floor((H-h)/2)
        c = H * W - (a + b)
        d2 = max(a,b,c) - min(a,b,c)
        ans = min(d1,d2,ans)
    return ans

print(min(solve(h,w), solve(w,h)))

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

#define min3(a,b,c) min(a,min(b,c))
#define max3(a,b,c) max(a,max(b,c))
#define min4(a,b,c,d) min(min(a,b),min(c,d))
#define max4(a,b,c,d) max(max(a,b),max(c,d))
#define count_one(a) __builtin_popcount(a)  // Returns the number of set bits(1) in a number(a). In long long use __builtin_popcountll(a)
#define parity(i)   __builtin_parity(i)  //even parity 0 and odd parity 1
#define blz(a)   __builtin_clz(a) //Returns the number of leading zeroes in a number(a)
#define btz(a)   __builtin_ctz(a) //Returns the number of trailing zeroes in a number(a)
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*(b/gcd(a,b)))
#define ll long long
#define pb push_back
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
int main()
{
     IOS
     string s;
     cin>>s;
     if(s[2]==s[3]&&s[4]==s[5])
     {
          cout<<"Yes\n";
     }
     else
          cout<<"No\n";
     return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int 
#define pii pair<int,int> 
#define pb push_back
#define INF INT_MAX 
#define mod 1000000007ll
#define fi first
#define se second
#define f(i,p,q) for(int i=p;i<q;i++)
#define si(a) scanf("%d",&a)
#define sii(a,b) scanf("%d %d",&a,&b)
#define siii(a,b,c) scanf("%d %d %d",&a,&b,&c)
#define pi(a) printf("%d\n",a)
#define psi(a) printf(" %d",a)
#define poi(a) printf("%d",a)
#define sl(a) scanf("%lld",&a)
#define pl(a) printf("%lld\n",a)
#define Nline() printf("\n")
#define sstr(str) scanf("%s",str)
#define pstr(str) printf("%s\n",str)
#define SET(a) memset(a,-1,sizeof(a))
#define CLR(a) memset(a,0,sizeof(a))
#define vi vector<int>
#define vvi vector<vi>
#define all(v) (v).begin(),(v).end()
#define SORT(v) sort(all(v))
#define RSORT(v) sort(all(v), greater<int>())
#define ios ios::sync_with_stdio(false); cin.tie(0);cout.tie(NULL);
int main() {
    ios;
   string s;cin>>s;
   if(s[2]==s[3]&&s[4]==s[5])cout<<"Yes";
   else cout<<"No";
 
    
}

Measured memory_bytes: 256
import java.util.Scanner;
import java.util.HashMap;
public class Main {
  public static void main(String[] args) {
    Scanner s = new Scanner(System.in);
    StringBuilder lines = new StringBuilder();
    String line;
    while (s.hasNextLine()) {
        line = s.nextLine();
        if (line.isEmpty())
            break;
        lines.append(line);
    }
    s.close();
    String sent = lines.toString();
    sent = sent.toLowerCase();
    HashMap<Character, Integer> map = new HashMap<Character, Integer>();
    for (char i = 'a'; i <= 'z'; i++) {
      map.put(i, 0);
    }
    for (int i = 0; i < sent.length(); i++) {
      Character c = sent.charAt(i);
      if (Character.isLetter(c)) {
        int prev = map.get(c);
        map.put(c, prev+1);
      }
    }
    for (char i = 'a'; i <= 'z'; i++) {
      int count = map.get(i);
      System.out.println(i + " : " + count);
    }
  }
}



Measured memory_bytes: 26008
N=int(input())

data=[]

for _ in range(N):
    x,y,h=map(int,input().split())
    data.append([x,y,h])
 
def test():
    for cx in range(101):
        for cy in range(101):
            
            for i in range(N):
                if data[i][2]:
                    temph=data[i][2]+abs(data[i][0]-cx)+abs(data[i][1]-cy)
                    flag=True
                    break
            
            for d in data:
                if d[2] != max(temph-abs(d[0]-cx)-abs(d[1]-cy),0):
                    flag=False
                    break
                
            if flag:
                print(cx,cy,temph)
                return
            
test()

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

class D
{
	static int[] Read() => Console.ReadLine().Split().Select(int.Parse).ToArray();
	static void Main()
	{
		var h = Read();
		int n = h[0], x = h[1];
		var s = Read().OrderBy(v => -v).ToArray();

		var dp = new MInt[x + 1];
		dp[x] = 1;

		for (int i = 1; i <= n; i++)
		{
			var t = new MInt[x + 1];
			for (int j = 0; j <= x; j++)
			{
				if (dp[j].V == 0) continue;
				t[j % s[i - 1]] += dp[j];
				t[j] += dp[j] * (n - i);
			}
			dp = t;
		}
		Console.WriteLine(Enumerable.Range(0, x + 1).Aggregate((MInt)0, (v, j) => v + j * dp[j]));
	}
}

struct MInt
{
	const int M = 1000000007;
	public long V;
	public MInt(long v) { V = (v %= M) < 0 ? v + M : v; }
	public override string ToString() => $"{V}";

	public static implicit operator MInt(long v) => new MInt(v);
	public static MInt operator +(MInt x, MInt y) => x.V + y.V;
	public static MInt operator *(MInt x, MInt y) => x.V * y.V;
}


Measured memory_bytes: 51652
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define LLINF 9223372036854775807
#define MOD ll(1e9+7)

int main(){
    ll h, w, k;
    cin >> h >> w >> k;

    ll dp[105][10] = {0,};
    dp[0][1] = 1;

    ll fib[12] = {1,1,2,3,5,8,13,21,34,55,89,144};
    for(int i = 0; i <= h; i++){
        for(int j = 1; j <= w; j++){
            dp[i+1][j-1] += dp[i][j]*fib[(j-2)-1+1]*fib[w-(j+1)+1]%MOD;
            dp[i+1][j] += dp[i][j]*fib[(j-1)-1+1]*fib[w-(j+1)+1]%MOD;
            dp[i+1][j+1] += dp[i][j]*fib[(j-1)-1+1]*fib[w-(j+2)+1]%MOD;
            dp[i+1][j-1] %= MOD;
            dp[i+1][j] %= MOD;
            dp[i+1][j+1] %= MOD;
        }
    }
  
    cout << dp[h][k] << endl;


    return 0;

}


Measured memory_bytes: 256
//Bismillahir rahmanir rahim
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int n;
int arr[100005][4];
int dp[100005][4];
int solve(int pos,int prev)
{
    if(pos==n+1) return 0;
    int &ret=dp[pos][prev];
    if(ret!=-1) return ret;
    ret=0;

    for(int i=1;i<=3;i++){
        if(i==prev) continue;
        ret=max(ret,solve(pos+1,i)+arr[pos][i]);
    }
    return ret;
}
int main()
{
    scanf("%d",&n);
    for(int i=1;i<=n;i++){
        scanf("%d %d %d",&arr[i][1],&arr[i][2],&arr[i][3]);
    }
    memset(dp,-1,sizeof(dp));
    int ans=solve(1,0);
    printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 11136
import Data.List
import Control.Monad
solver::[(Integer,Integer)]->Integer
solver ls = let l = (zip [1..] (sortBy (\ (a,b) -> \ (c,d)-> compare (c+d) (a+b)) ls)) in ((sum.(map (fst.snd)).(filter (\(i,_)->mod i 2 == 1))) l) - ((sum.(map (snd.snd)).(filter (\(i,_)-> mod i 2 == 0))) l)

main::IO()
main=do
  n<-(return.read)=<<getLine
  dat<-forM [1..n] (\_->return.(\(a:b:_)->(a,b)).(map read).words=<<getLine)
  print (solver dat)

Measured memory_bytes: 118908
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define ll long long
#define _GLIBCXX_DEBUG
const ll MOD = 1000000007;

int main() {
  int A, B, C;
  cin >> A >> B >> C;
  if (A==7&&B==5&&C==5) cout << "YES" << endl;
  else if (A==5&&B==7&&C==5) cout << "YES" << endl;
  else if (A==5&&B==5&&C==7) cout << "YES" << endl;
  else cout << "NO" << endl;
}

Measured memory_bytes: 256
//============================================================================
// Name        : template.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include <algorithm>
#include <set>
#include <map>
#include <set>
#include <vector>
#include <string.h> // for memset in CF judge.
using namespace std;
#define _CRT_SECURE_NO_DEPRECATE // suppress some compilation warning messages (for VC++ users)
// Shortcuts for "common" data types in contests
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef set<int> si;
typedef map<string, int> msi;
// To simplify repetitions/loops, Note: define your loop style and stick with it!
#define x first
#define y second
#define pb push_back
#define mp make_pair
#define REP(i, a, b) \
for (int i = int(a); i <= int(b); i++) // a to b, and variable i is local!
#define forn(i,n) \
for (int i =0; i<(n); i++)
#define TRvi(c, it) \
for (vi::iterator it = (c).begin(); it != (c).end(); it++)
#define TRvii(c, it) \
for (vii::iterator it = (c).begin(); it != (c).end(); it++)
#define TRmsi(c, it) \
for (msi::iterator it = (c).begin(); it != (c).end(); it++)
#define INF 2000000000 // 2 billion
// If you need to recall how to use memset:
#define MEMSET_INF 127 // about 2B
#define MEMSET_HALF_INF 63 // about 1B
//memset(dist, MEMSET_INF, sizeof dist); // useful to initialize shortest path distances
//memset(dp_memo, -1, sizeof dp_memo); // useful to initialize DP memoization table
//memset(arr, 0, sizeof arr); // useful to clear array of integers

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	ll a, b, c, k; cin >> a >> b >> c >>  k;
	if (k <= a) cout << k << endl;
	else if (k <= a + b) cout <<  a << endl;
	else {
		ll nds = (k - (a + b));

		cout <<  (-1 * nds) + a << endl;
	}
	return 0;
}


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

namespace Greedy_Takahashi
{
    class Program
    {
        static void Main(string[] args)
        {
            var inputs = Console.ReadLine().Split().Select(x => long.Parse(x)).ToArray();
            var _A = inputs[0];
            var _B = inputs[1];
            var _K = inputs[2];

            if(_A >= _K)
            {
                Console.WriteLine((_A - _K).ToString() + " " + _B.ToString());
            }
            else if(_A + _B >= _K)
            {
                Console.WriteLine("0 " + (_A + _B - _K).ToString());
            }
            else
            {
                Console.WriteLine("0 0");
            }
        }
    }
}


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

int main() {
     string s;
     cin >> s;
     int counter = 0;
     if(s[0]=='o') ++counter;
     if(s[1]=='o') ++counter;
     if(s[2]=='o') ++counter;
     int money = 700 + counter*100;
     cout << money << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std ;
int main() {
    int n,a,b;
    cin>>n>>a>>b ;long h=0;
    for(int i=1;i<=n;i++) {
        int k=0,o=i;
        while(o>=1)
        {
            k+=o%10;
            o/=10;
        }
            if(k>=a&&k<=b)
                h+=i;
    }

    cout<<h<<endl;return 0;
}


Measured memory_bytes: 256
import java.util.*;
import java.lang.*;


public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int p[] = new int[n];
        for (int i = 0; i < n; i++) {
            p[i] = sc.nextInt();
        }
        Arrays.sort(p);
        int sum = 0;
        sum += p[n - 1] / 2;
        for (int i = 0; i < n - 1; i++) {
            sum += p[i];
        }
        System.out.println(sum);
    }
}

Measured memory_bytes: 21716
#include <iostream>
#include <cmath>

using namespace std;

int main() {
    double x[4], y[4];
    while (1) {
        for (int i = 0; i < 4; i++) {
            if (!(cin >> x[i] >> y[i])) {
                return 0;
            }
        }
        if (abs((x[1] - x[0]) * (x[3] - x[2]) + (y[1] - y[0]) * (y[3] - y[2])) < 1e-10) {
            cout << "YES" << endl;
        }
        else {
            cout << "NO" << endl;
        }
    }

    return 0;
}

Measured memory_bytes: 1220
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <stack>
#include <cmath>
#include <functional>
#include <set>
#include <map>
#define SIZE 1005

using namespace std;
typedef long long int ll;
typedef pair <int,int> P;

vector <int> vec[SIZE];
char str[SIZE];
int dp[SIZE];
int to[SIZE];
int md[SIZE];
int id[SIZE];
int back[SIZE];
int tp[SIZE];
P pos[SIZE];
int sz;

int get(int L,int R)
{
	int now=sz;
	pos[sz++]=P(L,R);
	if(str[L]=='_'||str[L]=='^')
	{
		tp[now]=str[L]=='_'?0:1;
		vec[now].push_back(sz);
		back[sz]=now;
		get(L+2,md[L+1]-1);
		vec[now].push_back(sz);
		back[sz]=now;
		get(md[L+1]+1,R-1);
		if(str[L]=='_') dp[now]=min(dp[vec[now][0]],dp[vec[now][1]]);
		else dp[now]=max(dp[vec[now][0]],dp[vec[now][1]]);
		id[R]=now;
	}
	else
	{
		dp[now]=str[L]-'0';
		if(L<R)
		{
			dp[now]*=10;
			dp[now]+=str[R]-'0';
		}
		id[L]=id[L+1]=now;
	}
}
bool check(int i)
{
	vector <int> vt;
	if((str[i]!=')'&&str[i]!=','&&(i==0||str[i-1]==','||str[i-1]=='('))&&str[i]!='0')
	{
		vt.push_back(str[i]-'0');
		for(int j=0;j<10;j++) vt.push_back((str[i]-'0')*10+j);
	}
	else
	{
		vt.push_back(dp[id[i]]);
	}
	int now=id[i];
	while(now>0)
	{
		int p=back[now];
		vector <int> nxt;
		if(now==vec[p][1])
		{
			if(tp[p]==0)
			{
				for(int j=0;j<vt.size();j++)
				{
					nxt.push_back(min(vt[j],dp[vec[p][0]]));
				}
			}
			else
			{
				for(int j=0;j<vt.size();j++)
				{
					nxt.push_back(max(vt[j],dp[vec[p][0]]));
				}
			}
		}
		else
		{
			if(tp[p]==0)
			{
				int mx=0;
				for(int j=0;j<vt.size();j++) mx=max(mx,vt[j]);
				for(int j=0;j<=mx;j++) nxt.push_back(j);
			}
			else
			{
				int mn=100;
				for(int j=0;j<vt.size();j++) mn=min(mn,vt[j]);
				for(int j=mn;j<100;j++) nxt.push_back(j);
			}
		}
		now=p;
		vt=nxt;
	}
	sort(vt.begin(),vt.end());
	vt.erase(unique(vt.begin(),vt.end()),vt.end());
	return vt.size()==1;
}
int main()
{
	int T;
	scanf("%d",&T);
	while(T--)
	{
		for(int i=0;i<sz;i++) vec[i].clear();
		sz=0;
		scanf("%s",&str);
		int n=strlen(str);
		vector <int> now;
		for(int i=0;i<n;i++)
		{
			if(str[i]=='(') now.push_back(i);
			else if(str[i]==',')
			{
				md[now[now.size()-1]]=i;
			}
			else if(str[i]==')')
			{
				to[now[now.size()-1]]=i;
				now.pop_back();
			}
		}
		memset(id,-1,sizeof(id));
		get(0,n-2);
		printf("%d ",dp[0]);
		vector <int> zan;
		for(int i=0;i<n;i++) if(id[i]!=-1) zan.push_back(i);
		//for(int i=0;i<zan.size();i++) printf("%d ",zan[i]);puts("");
		int l=-1,r=zan.size();
		while(r-l>1)
		{
			int m=(l+r)/2;
			if(check(zan[m])) r=m;
			else l=m;
			//printf("%d %d\n",zan[l],zan[r]);
		}
		int ret=n-1;
		if(r<zan.size()) ret=zan[r];
		printf("%d\n",ret+1);
	}
	return 0;
}


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

void boost(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
}

int main(){
    boost();
    string s1,s2;
    cin >> s1 >> s2;
    
    ll n=s1.length(),m=s2.length();
    ll i,j;
    vector<ll>v;
    for(i=0;i<=n-m;i++){
        ll count=0,k=0;
        for(j=i;j<i+m;j++){
            if(s1[j]!=s2[k])
            count++;
            k++;
        }
        //cout << j << endl;
        //cout << s1[i] << endl;
        v.push_back(count);
    }
    sort(v.begin(),v.end());
    cout << v[0] << endl;
}

Measured memory_bytes: 3636