akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<algorithm>

using namespace std;
int main(){
int N;
int R,G,B;
cin >>R >>G>>B>>N;
int answer=0;
int a[3];
a[0]=R;
a[1]=G;
a[2]=B;
long  dp[4][3010];
dp[0][0]=1;
for(int i=0;i<3;++i){
    for(int j=0;j<=N;++j){
        dp[i+1][j]=dp[i][j];
        if(j>=a[i]){
            for(int l=1;l<=j/a[i];l++)
            dp[i+1][j]+=dp[i][j-a[i]*l];
        }
    }
}
cout <<dp[3][N]<<endl;


  return 0;
}


Measured memory_bytes: 384
#include<stdio.h>
int	main(void)
{
	int	a,b,i;
	for(i=0;i<4;i++){
		scanf("%d%d",&a,&b);
		if(a==1){printf("%d\n",6000*b);
			}else	if(a==2){printf("%d\n",4000*b);
				}else	if(a==3){printf("%d\n",3000*b);
					}else{printf("%d\n",2000*b);
				}
	}
			return	0;
}

Measured memory_bytes: 600
import java.util.Scanner;
class Main{
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        long A = scan.nextInt();
        long V = scan.nextInt();
        long B = scan.nextInt();
        long W = scan.nextInt();
        long T = scan.nextInt();
            if(Math.abs(A-B) <= ((V-W)*T)){
                System.out.println("YES");
            }else{
                System.out.println("NO");
            }
        }
    }

Measured memory_bytes: 35620
void main()
{
    long k = rdElem - 1;

    long[] a = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51];

    a[k].writeln;
}

enum long mod = 10^^9 + 7;
enum long inf = 1L << 60;

T rdElem(T = long)()
if (!is(T == struct))
{
    return readln.chomp.to!T;
}

alias rdStr = rdElem!string;
alias rdDchar = rdElem!(dchar[]);

T rdElem(T)()
if (is(T == struct))
{
    T result;
    string[] input = rdRow!string;
    assert(T.tupleof.length == input.length);
    foreach (i, ref x; result.tupleof)
    {
        x = input[i].to!(typeof(x));
    }
    return result;
}

T[] rdRow(T = long)()
{
    return readln.split.to!(T[]);
}

T[] rdCol(T = long)(long col)
{
    return iota(col).map!(x => rdElem!T).array;
}

T[][] rdMat(T = long)(long col)
{
    return iota(col).map!(x => rdRow!T).array;
}

void rdVals(T...)(ref T data)
{
    string[] input = rdRow!string;
    assert(data.length == input.length);
    foreach (i, ref x; data)
    {
        x = input[i].to!(typeof(x));
    }
}

void wrMat(T = long)(T[][] mat)
{
    foreach (row; mat)
    {
        foreach (j, compo; row)
        {
            compo.write;
            if (j == row.length - 1) writeln;
            else " ".write;
        }
    }
}

import std.stdio;
import std.string;
import std.array;
import std.conv;
import std.algorithm;
import std.range;
import std.math;
import std.numeric;
import std.traits;
import std.container;
import std.functional;
import std.typecons;
import std.ascii;
import std.uni;

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

#define ll long long
#define fw(p) for(int w=0;w<(p);w++)
#define fx(p) for(int x=0;x<(p);x++)
#define fy(p) for(int y=0;y<(p);y++)
#define fz(p) for(int z=0;z<(p);z++)
#define fyg(p,g) for(int y=(g);y<(p);y++)
#define fzg(p,g) for(int z=(g);z<(p);z++)
#define ce(d) cout<<d<<endl;
#define vecp(p) int aa;cin>>aa;(p).push_back(aa);
#define vecpl(p) long long aa;cin>>aa;(p).push_back(aa);
#define vecps(p) string aa;cin>>aa;(p).push_back(aa);
#define vecp2(p) cin>>aa;(p).push_back(aa);
#define vecpl2(p) long long a	b;cin>>ab;(p).push_back(ab);
#define vecps2(p) string ab;cin>>ab;(p).push_back(ab);
#define sorts(c) sort((c).begin(),(c).end());
#define reverses(c) reverse((c).begin(),(c).end());
#define vec(b) vector<int> (b);
#define vecl(b) vector<long long> (b);
#define vecs(b) vector<string> (b);
#define pb(b,a) (b).push_back((a));
#define doublece(a,b) cout<<(a)<<' '<<(b)<<endl;
#define pairs(s) vector<pair<int,int>> (s);
#define pairsp(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define MOD 1000000007
#define cey ce("Yes")
#define cen ce("No")
#define ceY ce("YES")
#define ceN ce("NO")

int main()
{
	int K;
	cin >> K;
	priority_queue<ll> Q;
	vecl(A);
	fyg(10,1) {
		Q.push(-y);
		pb(A,y)
	}
	while (A.size()<K) {
		ll q = Q.top(); Q.pop();
		q = -q;
		int p = q % 10;
		if (p-1>=0) {
			Q.push(-(q*10+p-1));
			pb(A, (q * 10 + p - 1))
		}
		if (p + 1 <= 9) {
			Q.push(-(q * 10 + p + 1));
			pb(A, (q * 10 + p + 1))
		}
		Q.push(-(q * 10 + p));
		pb(A, (q * 10 + p))
	}
	sorts(A);
	ce(A[K-1])

    return 0;
}



Measured memory_bytes: 2288
#include "stdio.h"
int A, B, C, D;

int main(int argc, char* argv[])
{
	int ans;

	scanf("%d%d%d%d", &A, &B, &C, &D);

	A<B ? ans=A : ans=B;

	C<D ? ans+=C : ans+=D;


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



Measured memory_bytes: 128
#include<bits/stdc++.h>
#define mod ((int)1e9+7)
using namespace std;
typedef long long int ll;
typedef pair<int,int> pi;

const int N = (int)1e5+5;

void solve() {
  int h,w,k;
  cin>>h>>w>>k;
  vector<string> input(h);
  for(int i=0;i<h;i++) {
    cin>>input[i];
  }
  int ans = 0;
  for(int k1=0;k1<(1<<h);k1++) {
    for(int k2=0;k2<(1<<w);k2++) {
      int cntBlack = 0;
      for(int i=0;i<h;i++) {
        for(int j=0;j<w;j++) {
          if(!((1<<i)&k1)&&!((1<<j)&k2)) {
            if(input[i][j]=='#') {
              cntBlack++;
            }
          }
        }
      }
      if(cntBlack==k) {
        ans++;
      }
    }
  }
  cout<<ans;
}

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

    int t=1;
    //cin>>t;
    for(int i=1;i<=t;i++) {
      //cout<<"Case #"<<i<<": ";
      solve();
      cout<<"\n";
    }
}


Measured memory_bytes: 3652
//
// Created by Hideaki Imamura on 2020-03-07.
//
# include <bits/stdc++.h>

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

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

# define EPS (1e-7)
# define INF (1e9)
# define PI (acos(-1))
//const ll mod = 1000000007;

string S, head="";
int Q, T, F;
char C;
bool l_to_r = true;

int main() {
    cin >> S >> Q;
    for (int i = 0; i < Q; ++i) {
        cin >> T;
        if (T == 1) {
            l_to_r = !l_to_r;
        } else {
            cin >> F >> C;
            if (F == 1) {
                if (l_to_r) {
                    head.push_back(C);
                } else {
                    S.push_back(C);
                }
            } else {
                if (l_to_r) {
                    S.push_back(C);
                } else {
                    head.push_back(C);
                }
            }
        }
    }
    reverse(head.begin(), head.end());
    S = head + S;
    if (!l_to_r) {
        reverse(S.begin(), S.end());
    }
    cout << S << endl;
}

Measured memory_bytes: 1116
package main

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

func main() {
	defer stdout.Flush()
	exps := make(map[int]bool)
	for i := 1; i <= 1000; i++ {
		for j := 2; j <= 10; j++ {
			x := i
			for k := 1; k < j; k++ {
				x *= i
			}
			if x > 1000 {
				break
			}
			exps[x] = true
		}
	}
	a := make([]int, 0, 1000)
	for k, _ := range exps {
		a = append(a, k)
	}
	sort.Ints(a)

	X := readInt()
	for i, e := range a {
		if e > X {
			println(a[i-1])
			return
		}
	}
	println(1000)
}

var (
	readString func() string
	stdout     *bufio.Writer
)

func init() {
	readString = newReadString(os.Stdin)
	stdout = bufio.NewWriter(os.Stdout)
}

func newReadString(ior io.Reader) func() string {
	r := bufio.NewScanner(ior)
	r.Split(bufio.ScanWords)

	return func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
}

func readInt() int {
	i, err := strconv.Atoi(readString())
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readIntSlice(n int) []int {
	b := make([]int, n)
	for i := 0; i < n; i++ {
		b[i] = readInt()
	}
	return b
}

func readLengthAndSlice() []int {
	n := readInt()
	return readIntSlice(n)
}

func printf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(stdout, f, args...)
}

func println(args ...interface{}) (int, error) {
	return fmt.Fprintln(stdout, args...)
}


Measured memory_bytes: 640
#include<iostream>
#include<vector>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)
using ll = long long;
using P = pair<int, int>;
#include<algorithm>
#include<math.h>
#include<map>
#include<queue>

int main(){
	ll n;
	string s;
	ll rc(0), gc(0), bc(0);
	cin >> n >> s;
	rep(i, n) {
		if (s[i] == 'R')++rc;
		if (s[i] == 'G')++gc;
		if (s[i] == 'B')++bc;
	}

	ll count;
	count = rc * gc * bc;
	rep(i, n) {
		for (int j = i + 1; j < n; ++j) {
			if (2*j - i < n) {
				if (s[i]!=s[j] && s[j]!=s[2*j-i] && s[i]!=s[2*j-i]){				
						count--;
				}
			}

		}
	}
	cout << count;
	return 0;
}

Measured memory_bytes: 3636
//package solution;

import java.io.*;
import java.util.*;
import java.math.*;
import java.text.*;
import java.awt.Point;

public final class Main {
    BufferedReader br;
    StringTokenizer stk;

    public static void main(String[] args) throws Exception {
        //new Thread(null, new Runnable() {
            //@Override
            //public void run() {
                //try {
                    new Main().run();
                //} catch(Exception ex) {ex.printStackTrace();}
            //}
        //}, "solution", 1<<26).start();
    }
    
    {
        stk = null;
        br = new BufferedReader(new InputStreamReader(System.in));
    }
    
    //long mod = 1000000007L;
    void run() throws Exception {
        int k = ni(), n = ni();
        int[] a = new int[n];
        for(int i=0; i<n; i++) a[i] = ni();
        
        int max = -1;
        for(int i=1; i<n; i++) {
            max = Math.max(max, a[i] - a[i-1]);
        }
        
        max = Math.max(max, (k - a[n-1]) + a[0]);
        
        pl(k - max);
    }
    
    //Reader & Writer
    String nextToken() throws Exception {
        if (stk == null || !stk.hasMoreTokens()) {
            stk = new StringTokenizer(br.readLine(), " ");
        }
        return stk.nextToken();
    }

    String nt() throws Exception {
        return nextToken();
    }

    String ns() throws Exception {
        return br.readLine();
    }

    int ni() throws Exception {
        return Integer.parseInt(nextToken());
    }

    long nl() throws Exception {
        return Long.parseLong(nextToken());
    }

    double nd() throws Exception {
        return Double.parseDouble(nextToken());
    }

    void p(Object o) {
        System.out.print(o);
    }

    void pl(Object o) {
        System.out.println(o);
    }
}

Measured memory_bytes: 47096
#include <bits/stdc++.h>
 
using namespace std;
 
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define Eunique(v) v.erase(unique(all(v)),v.end())
#define pvec(v) rep(i,v.size()){cout << v[i] << " ";};cout<<endl;
#define pb push_back
#define pf push_front
#define mod 1e9+7
 
typedef vector<int> vi;
typedef vector<string> vs;
typedef long long ll;
typedef vector<ll> vll;

const double pi = acos(-1.0);
 
ll gcd(ll x, ll y) { return (y == 0) ? x : gcd(y, x % y); }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }

int main()
{
	string s;
	cin >> s;
	rep(i,s.size()-1){
		if(s[i]=='A' && s[i+1]=='C'){
			cout << "Yes\n";
			return 0;
		}
	}
	cout << "No\n";
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define ll long long
#define pi 3.14
using namespace std;
typedef pair<int,int> pii;
typedef pair<long long,long long> pll;
typedef pair<long long,int> pli;
typedef pair<int,long long> pil;
const int INF=1000000007;
const int MOD=1000000007;
const int nmax=401234;

int n,k;
ll f[nmax],inv[nmax],res;

ll ksm(ll a,ll b){
    ll ans=1;
    while(b){
        if(b&1) ans=ans*a%MOD;
        a=a*a%MOD;
        b>>=1;
    }
    return ans;
}

ll C(int a,int b){
    return f[a]*inv[a-b]%MOD*inv[b]%MOD;
}

int main()
{
    scanf("%d%d",&n,&k);
    f[0]=1;
    for(int i=1;i<nmax;++i)
        f[i]=f[i-1]*i%MOD;
    inv[nmax-1]=ksm(f[nmax-1],MOD-2);
    for(int i=nmax-2;i>=0;--i)
        inv[i]=inv[i+1]*(i+1)%MOD;
    if(k>=n-1){
        res=C(2*n-1,n-1);
    }
    else{
        for(int i=0;i<=k;++i)
            res=(res+C(n-1,n-i-1)*C(n,i)%MOD)%MOD;
    }
    printf("%lld\n",res);
    return 0;
}


Measured memory_bytes: 6528
#include<bits/stdc++.h>
#include<boost/dynamic_bitset.hpp>
using namespace std;
using u64 = uint64_t;
using s64 = int64_t;

int main() {
	u64 N;
	cin >> N;

	vector<u64> A(N);
	u64 mod = pow(10, 9) + 7;

	for(u64 i=0; i<N; i++) {
		cin >> A[i];
	}
	
	u64 Asum = 0;
	u64 ans = 0;

	for(s64 i=N-2; i>=0; i--) {
		Asum = (Asum + A[i+1]) % mod;
		ans = (ans + (Asum * A[i]) % mod) % mod;
	}

	cout << ans << endl;

	return 0;	
}

Measured memory_bytes: 4840
#include<bits/stdc++.h>
#define int long long
#define P pair<int,int>
#define PP pair<int,P>
#define F first
#define S second
#define f(i,n) for(int i=0;i<(n);i++)
#define INF LLONG_MAX/3
#define eps LDBL_EPSILON
#define mod (int)(1000000007)
#define pie 3.141592653589793238462643383279
#define Bpri priority_queue
#define Spri priority_queue<P,vector<P>,greater<P>>
using namespace std;
signed main(){
	int a,b;
	cin>>a>>b;
	cout<<b*2-a<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(ll)n;i++)
#define rep1(i,n) for(int i=1;i<=(int)n;i++)
#define rep2(i,j,n) for(int j=i;j<n;j++)
#define rep3(i,j,n) for(int j=i;j<=n;j++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define sp(n) cout << fixed << setprecision(n)
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; }
typedef long long ll;
using namespace std;
int main(void){
    string s,t;cin>>s>>t;
    map<char,int> mp1,mp2;
    rep(i,s.size()){
        mp1[s[i]]++;
        mp2[t[i]]++;
    }
    map<int,int> mp3,mp4;
    for(auto&p:mp1){
        mp3[p.second]++;
    }
    for(auto&p:mp2){
        mp4[p.second]++;
    }
    for(auto&p:mp3){
        if(p.second!=mp4[p.first]){
            cout<<"No"<<endl;
            return 0;
        }
    }
    cout<<"Yes"<<endl;
    return 0;
}


Measured memory_bytes: 776
#include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <utility>
#include <functional>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <deque>
#include <ctime>

using namespace std;

#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define pb push_back
#define mp make_pair
#define all(r) (r).begin(),(r).end()
#define rall(r) (r).rbegin(),(r).rend()
#define fi first
#define se second
#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))


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

const int INF = 1e9;
const ll LINF = 1e18;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;
const double PI = acos(-1);

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

int edge[10][10];

//TODO: C問題 解けない.. 次に聞く

int main(){

    int n, m;
    cin >> n >> m;
    int a, b;
    vector<int> data;
    int cnt = 0;

    for(int i=0; i<m; i++){
        cin >> a >> b;
        edge[a][b] = 1;
        edge[b][a] = 1;
    }

    for(int j=1; j<=n; j++){
        data.push_back(j);
    }

    do{
        bool flag = true;
        for(int k=0; k<n-1; k++){
            if(data[0] != 1 || edge[data[k]][data[k+1]] != 1) flag = false;
        }
        if(flag) cnt++;

    }while(next_permutation(data.begin(), data.end()));

    cout << cnt << endl;

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define MAX 100000
#define pb push_back
#define mp make_pair
#define MOD 1000000007
typedef long long Int;
typedef pair<Int,Int> pii;
typedef vector<Int> vi;
typedef vector<pii> vii;
Int arr[MAX+5],cnt=0,N;
int main()
{
    cin>>N;
    for (Int i=1;i<=N;++i)
        cin>>arr[i];
    for (Int i=1;i<=N;++i)
    {
        if (arr[arr[i]]==i)
            ++cnt;
    }
    cout<<cnt/2;
    return 0;
}


Measured memory_bytes: 1024
#include<iostream>
#include<vector>
#include<cmath>
#include<algorithm>
#include<utility>
#include<string>
#include<utility>
#include<iomanip>
#include<bitset>
#include<math.h>
using namespace std;
 
 
int main(){
 
	long long n;
	cin >> n;
	
	vector<long long> m(n+1);
	for (int i = 0; i < n+1; i++)
	{
		cin >> m[i];
	}
	vector<long long> h(n);
	for (int i = 0; i < n; i++)
	{
		cin >> h[i];
	}

	long long cnt = 0;

	for (int i = 0; i < n; i++)
	{
		if(h[i] <= m[i] + m[i+1]){
			cnt += h[i];
			if(h[i] >= m[i]){
				h[i] -= m[i];
				m[i] = 0;
				m[i+1] -= h[i];
			}else{
				m[i] -= h[i];
			}
		}else{
			cnt += m[i] + m[i+1];
			m[i] = 0;
			m[i+1] = 0;
		}
	}
	
	cout << cnt << endl;

}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define INF 1e18
#define Rep(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) Rep(i, 0, n)
#define all(a) (a).begin(), (a).end()
#define MAX 1000
#define ll long long
#define P pair<int,int>
using namespace std;
const int mod = 1000000007;
//char c[MAX][MAX];
int step[MAX][MAX];
int H,W,N; 
int vy[4] ={1,-1,0,0}, vx[4] = {0,0,-1,1}; //up,down,left,right 

signed main(){
    int n,m; cin >> n >> m;
    int a[50],b[50];
    rep(i,m) cin >> a[i] >> b[i];
    vector<int> v;
    for(int i=1;i < n+1;i++) v.push_back(i);
    int ans=0;
    do{
        int cnt = 0;
        //rep(i,n) cout << v[i] << " ";
        //cout << endl;
        int cnt1 = 0;
        for(int i=0;i<n-1;i++){
            for(int k=0;k<m;k++){ 
                if(v[i] == a[k] && v[i+1] == b[k]){
                    cnt1=1;
                } else if(v[i] == b[k] && v[i+1] == a[k]){
                    cnt1=1;
                } 
            }
            if(cnt1) cnt++;
            cnt1 = 0;
        }
        if(cnt == n-1) ans++;
    } while(next_permutation(v.begin()+1,v.end()));

    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int A[200000] = {};
    int N,a;
    scanf("%d",&N);
    
    for(int i = 0; i < N-1; i++)
    {
        scanf("%d",&a);
        A[a-1]++;
    }
    
    for(int i = 0; i < N; i++)
    {
        printf("%d\n",A[i]);
    }
}


Measured memory_bytes: 4608
#!/usr/bin/env python3
import sys
INF = float("inf")


def solve(N: int, X: "List[int]", L: "List[int]"):

    # 区間に変換する
    segs = [(x-l, x+l) for x, l in zip(X, L)]
    segs.sort(key=lambda x: x[1])  # 尻でソート

    last = -INF
    count = 0
    for i in range(N):
        if last <= segs[i][0]:
            last = segs[i][1]
            count += 1
    print(count)

    return


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    X = [int()] * (N)  # type: "List[int]"
    L = [int()] * (N)  # type: "List[int]"
    for i in range(N):
        X[i] = int(next(tokens))
        L[i] = int(next(tokens))
    solve(N, X, L)


if __name__ == '__main__':
    main()


Measured memory_bytes: 52316
//ssenseeeeeeeeeeeeeeeeeeeeeeeeeeeee
#include<bits/stdc++.h>
using namespace std;
typedef long long  ll;
typedef unsigned long long ull;
#define MX 1000000000
#define endl '\n'
#define startt ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define fr first
#define sc second
#define MOD 1000000007

int main()
{
    ll n, d;
    cin >> n >> d;
    ll x, y;
    ll c = 0;
    for(int i = 0; i < n; i++)
    {
        cin >> x >> y;
        if(sqrt(x*x+y*y) <= d)
        {
            c++;
        }
    }
    cout << c << endl;
}


Measured memory_bytes: 3648
#include<bits/stdc++.h>
#define ll long long
#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
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 namespace std;

int main(){
    string S, T, K;
    cin >> S;
    cin >> T;
    int lt = T.size();
    int ls = S.size();
    string s = "zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz";

    bool flag = true;

    rep(i,  ls- lt+1){
        K = S;
        rep(j, lt){
            if (S[i+j] == '?') {
                K[i+j] = T[j];
            } else if (S[i+j] != T[j]){
                flag = false;
                break;
            }
        }

        if (flag){
          rep(k, ls){
              if(K[k] == '?') {
                  K[k] = 'a';
              }
          }
          if (s > K){
              s = K;
          }
//          cout << S << endl;
//          cout << K << endl;
//          cout << "test" << endl;

        }
        flag = true;

    }


    if (s == "zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz"){
        cout << "UNRESTORABLE" << endl;
    } else {
        cout << s << endl;

    }


}

Measured memory_bytes: 256
n = gets.to_i
c = Hash.new(0)
n.times do
    x, y, w = gets.split.map(&:to_i)
    c[[x,y]] = w
end
max = 0
c.each do |k,v|
    sum = v + c[[k[0]+1, k[1]]] + c[[k[0], k[1]+1]] + c[[k[0]+1, k[1]+1]]
    max = sum if sum > max
    sum = c[[k[0]-1,k[1]]] + c[[k[0], k[1]]] + c[[k[0]-1, k[1]+1]] + c[[k[0], k[1]+1]]
    max = sum if sum > max
    sum = c[[k[0],k[1]-1]] + c[[k[0]+1, k[1]-1]] + c[[k[0], k[1]]] + c[[k[0]+1, k[1]]]
    max = sum if sum > max
    sum = c[[k[0]-1,k[1]-1]] + c[[k[0], k[1]-1]] + c[[k[0]-1, k[1]]] + c[[k[0], k[1]]]
    max = sum if sum > max
end
puts "#{max} / 1"

Measured memory_bytes: 26788
a, b, c, d, e, f =map(int, input().split())

ans = 0
ans_ws = 0
ans_s = 0
for i in range(30//a+1):
    for j in range(30//b+1):
        w = 100*a*i+100*b*j
        s_max = f-w
        if s_max < 0:
            continue
        for k in range(s_max//c+1):
            temp = s_max - c*k
            if temp < 0:
                continue
            for l in range(temp//d+1):
                s = c*k + d*l
                if w+s == 0 or w+s > f:
                    continue
                else:
                    if 100*s > e*w:
                        continue
                    else:
                        x = (100*s)/(w+s)
                        if x >= ans:
                            ans = x
                            ans_ws = w+s
                            ans_s = s
print(ans_ws, ans_s)

Measured memory_bytes: 42988
#include <iostream>
#include <queue>

using namespace std;

static const int N=100;
static const int INF=1e+9;

int n,M[N][N];
int d[N];

void bfs(int s){
	queue<int> q;
	q.push(s);

	for(int i=0;i<n;i++){
		d[i]=INF;
	}
	d[s]=0;
	int u;

	while(!q.empty()){
		u=q.front();
		q.pop();


		for(int v=0;v<n;v++){
			if(M[u][v]==0)continue;
			if(d[v]!=INF)continue;

			d[v]=d[u]+1;
			q.push(v);
		}
	}

	for(int i=0;i<n;i++){
		if(d[i]==INF){
			cout<<i+1<<" "<<-1<<endl;
		}else{
			cout<<i+1<<" "<<d[i]<<endl;
		}
	}
}
int main(){

	int u,k,v;

	cin>>n;

	for(int i=0;i<n;i++){
		for(int j=0;j<n;j++){
			M[i][j]=0;
		}
	}

	for(int i=0;i<n;i++){
		cin>>u>>k;
		u--;

		for(int j=0;j<k;j++){
			cin>>v;
			v--;
		
			M[u][v]=1;
		}
	}

	bfs(0);
	return 0;

}

Measured memory_bytes: 3120
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) begin(v),end(v)
#define fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
using ll = long long;
using pii = pair<int, int>;
constexpr ll INF = 1ll<<30;
constexpr ll longINF = 1ll<<60;
constexpr ll MOD = 1000000007;
constexpr bool debug = 0;
//---------------------------------//

int main() {
	ll N;
	cin >> N;
	--N;
	
	ll sum = 0, cur = 1;
	int keta = 0;
	while (1) {
		cur *= 26;
		++keta;
		if (sum + cur > N) {
			ll dif = N - sum;
			string ans;
			for (int i = 0; i < keta; ++i, dif /= 26) ans += 'a' + dif % 26;
			reverse(ALL(ans));
			cout << ans << endl;
			return 0;
		}
		sum += cur;
	}
	
	return 0;
}


Measured memory_bytes: 3552
#include<iostream>
#include<cstdio>
#include<queue>
#include<algorithm>
#include<cmath>
using namespace std;

int n,m,t;
long s=0;
priority_queue<int> q;

int main(){
  scanf("%d%d",&n,&m);
  for(int i=0;i<n;i++){scanf("%d",&t);q.push(t);}
  for(int i=0;i<m;i++){t=q.top();q.pop();q.push(floor(t/2));}
  while(!q.empty()){s+=q.top();q.pop();}
  printf("%ld\n",s);
  return 0;
}

Measured memory_bytes: 892
#include "bits/stdc++.h"
using namespace std;

#define ll long long int
#define str string
#define sec .second

ll MOD = 1000000007, INFL = 1ll << 60, INF = 1 << 30;
ll A[1000000] = {}, B[1000000] = {}, weight[1000] = {}, value[1000] = {};
ll dp[100][10] = {};
int dy[] = { 0, 0, 1, -1 }, dx[] = { 1, -1, 0, 0 };
vector <ll> v;
ll a = 0, b = 0, aka = 0, kaijou = 1, e = 0, f = 0, n = 0, su = 0, ma = INF, mi = -1;
double ans;
str S;
pair<str, ll> Sp[1000];
bool an = true, bn = false;
long long mod = 1e9 + 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() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	//Code Line
	cin >> n >> a;
	if (n % (2 * a + 1) == 0)cout << n / (2 * a + 1) << endl;
	else cout << n / (2 * a + 1) + 1 << endl;
	
	return 0;
}


Measured memory_bytes: 256
/*  ex9_1
    Y_Aizaki  */

#include <stdio.h>
#include <stdlib.h>

#define SIZE 20

typedef struct string
{
    int size;
    int count;
    char date[SIZE];
    char *top;
}string;

void initialize_string(string *str); // stringの初期化
void print_string_queue(string *str); // 先頭から取り出す
void push(string *str, char unit); // stringへの追加
char pop(string *str); // stringからの削除・取り出し

int main(void){
    string str;
    string *str_p = &str;
    char input[SIZE+1];
    // 標準入力を受け取る
    char *point = input;
    // inputからstrへ移す際のポインター
    char garbage;
    // popで取り出されるcharを捨てる場所

    scanf("%[01B]", input);

    initialize_string(str_p);
    // strの初期化
    
    while (*point){
        // Bだったらpop
        if (*point == 'B'){
            if (str_p->count != 0)
            {
                garbage = pop(str_p);
            }
        }
        // 0か1だったらpush
        else{
            push(str_p, *point);
        }
        point++;
    }

    print_string_queue(str_p);

    return 0;
}

void initialize_string(string *str){
    str->count = 0;
    str->size = SIZE;
    str->top = &(str->date[SIZE]);
}

void print_string_queue(string *str){
    char *point;

    point = &(str->date[SIZE-1]);

    for (int i = 0; i < str->count; i++){
        printf("%c", *point--);
    }
    putchar('\n');
}

void push(string *str, char unit){
    if (str->count >= str->size){
       printf("Error stack overflow. (unit=%c)\n", unit);
       exit(1);
    }
    else{
        str->top--;
        *(str->top) = unit;
        str->count++;
    }
}

char pop(string *str){
    char latest = '\0';
    if (str->count <= 0){
        printf("Error stack underflow.\n");
    }
    else{
        latest = *(str->top);
        str->top++;
        str->count--;
    }

    return latest;
}

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

#define ll long long

int main(){

    ios::sync_with_stdio(false);
    cin.tie(0);
    
    map<string, int> memo;
    int n;
    cin >> n;
    for(int i=0; i<n; i++){
        string s;
        cin >> s;
        memo[s]++;
    }

    int maxv=0;
    for(auto it: memo){
        if(it.second>maxv) maxv=it.second;
    }

    for(auto x=memo.begin(); x!=memo.end(); x++){
        if(x->second==maxv) cout <<  x->first << "\n";
    }

    return 0;
}

Measured memory_bytes: 23808
#include <bits/stdc++.h>
 
using namespace std;
typedef long long ll;
typedef vector<int> VI;
ll mm=1000000000;ll MM=mm+7;
#define rep(i, n) for(int i=0;i<n;i++)
#define PI 3.141592653589793

int main(){
 char a,b;
 cin >> a >> b;
 char ans;
 if(a=='H' && b=='H')ans='H';
 if(a=='H' && b=='D')ans='D';
 if(a=='D' && b=='H')ans='D';
 if(a=='D' && b=='D')ans='H';
 cout << ans << endl;
}



Measured memory_bytes: 3596
# atcoder problemsからきました
# 全探索
n, m = map(int, input().split())
a, b = [], []
for _ in range(n):
    a.append(list(input()))
for _ in range(m):
    b.append(list(input()))

for i in range(n - m + 1):
    for j in range(n - m + 1):
        target = [["-" for _ in range(m)] for _ in range(m)]
        for y in range(m):
            for x in range(m):
                target[y][x] = a[i + y][j + x]
        if b == target:
            print("Yes")
            exit()
print("No")


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

int main(){
 int n;
 cin >> n;
  
 vector<int> a(n);
 rep(i,n) cin >> a[i];
 sort(a.begin(), a.end());
//15行目の解説 
//例えば{1,2,3,3,5,9,2}という数列をソートし終わって{1,2,2,3,3,5,9}となった数列を
//uniqueで{1,2,3,5,9}となってその数列の後に2文字分のゴミができるからそれを消すってこと
 a.erase(unique(a.begin(), a.end()), a.end());
 if(a.size() == n) cout << "YES" << endl;
 else cout << "NO" << endl;
}


Measured memory_bytes: 1024
using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    public static void Main()
    {
        string[] input = Console.ReadLine().Split();
        int N = int.Parse(input[0]);
        int R = int.Parse(input[1]);
        int ans = 0;
        if (N >= 10) { ans = R; }
        else { ans = R + 100 * (10 - N); }
        Console.WriteLine(ans);
    }
}

Measured memory_bytes: 11092
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
//#include <intrin.h>

#define fore(i,a,b) for(int i = a; i < (b); i++)
#define fr(i,a,b) for(int i = a - 1; i >= b; i--)
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define N 300005
#define inf (ll)2e18
#define EPS 1e-12
#define mod 1000000007LL
#define __builtin_popcount(x) __popcnt(x)

using namespace std;

typedef long long ll;

inline void solve()
{
	ll a, b, n;
	cin >> a >> b >> n;
	ll x = min(n, b - 1);
	if (b == 1) {
		cout << 0;
		return;
	}
	cout << ((a * x) / b) - (a * (x / b));
}

int main()
{
	fast;
#if defined(_DEBUG)
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	int q = 1;
	//cin >> q;
	fore(t, 0, q)
	{
		solve();
		cout << '\n';
	}
}

Measured memory_bytes: 3640
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include<math.h>
#include<iomanip>
#include<functional>
using namespace std;

#define ll long long
using vt = ll; //ここで数値の型を変えられる
#define rep(i, n) for (vt i = 0; i < (vt)(n); i++)
#define reps(i, s, n) for(vt i = (vt) (s); i < (vt) (n); i++) 
#define all(v) v.begin(), v.end()
#define P pair<int, int>
const ll  MOD = 1000000007;

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

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

#define M 1005
#define MOD 100000000
#define PI 3.14159265358979323846
#define ep emplace_back
#define mk make_pair
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()

typedef long long int lli;
typedef unsigned long long int ulli;
typedef pair<int,int> PII;
typedef pair<lli,lli> PLL;

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	// freopen("input.txt","r",stdin);
	// freopen("output.txt","w",stdout);

	int a,b;
	cin>>a>>b;
	cout<<a*b<<"\n";
		

}


Measured memory_bytes: 3648
#include <iostream>
#include <cmath>
#include <map>


using namespace std;


int main() {
	int N;
	cin >> N;
	map<int, int> cnt;
	for (int i = 0; i < N; i++) {
		int tmp;
		cin >> tmp;
		cnt[tmp]++;
		cnt[tmp - 1]++;
		cnt[tmp + 1]++;
	}

	int ans = 0;
	for (pair<int, int> p : cnt) ans = max(ans, p.second);

	cout << ans << endl;

	return 0;
}

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

#define fast() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define lli long long int
#define ll long int
#define FOR(i,n) for(i=0;i<n;i++)
#define FOR1(i,n) for(i=1;i<n;i++)
#define pb push_back

using namespace std;

int main() {
    
    fast()
    
    int n,i,j,k;
    ll days=0;
    int temp,temp1,temp2,cnt=0;
    bool finish=false;
    cin>>n;
    int arr[n][n-1];
    int head[n]={0};
    ll day[n]={0};
    int check[n]={0};
    memset(day,-1,sizeof(day));
    //set<int> remain;

    FOR(i,n)FOR(j,n-1)cin>>arr[i][j];
    //FOR(i,n)if(head[i]!=(n-1))remain.insert(i);
    //k=remain.size();
    while(!finish){
        finish=true;
        FOR(i,n-1){
            temp=i;
            if(head[temp]==(n-1)) continue;
            temp1=arr[temp][head[temp]]-1;
            temp2=arr[temp1][head[temp1]]-1;
            if(temp2==temp && temp1>temp && day[temp]!=days && day[temp1]!=days){
                head[temp]++;
                head[temp1]++;
                day[temp]=days;
                day[temp1]=days;
                //cout<<temp+1<<" "<<head[temp]<<" "<<temp1+1<<" "<<head[temp1]<<endl;
                finish=false;
            }
        }
        //remain.clear();
        //FOR(i,n)if(head[i]!=(n-1))remain.pb(i);
        
        //k=remain.size();
        days++;
        //if(remain.size()==0)break;
        
    }
    finish=false;
    FOR(i,n)if(head[i]!=n-1)finish=true;
    if(finish) cout<<-1;
    else
    cout<<days-1;
    
}

Measured memory_bytes: 4224
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
#define ALL(c) (c).begin(), (c).end()
#define SUM(x) std::accumulate(ALL(x), 0LL)
#define MIN(v) *std::min_element(v.begin(), v.end())
#define MAX(v) *std::max_element(v.begin(), v.end())
#define EXIST(v, x) (std::find(v.begin(), v.end(), x) != v.end())

using namespace std;
typedef long long ll;

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; }
const int INF = 1001001001;
const long long INFL = (1LL<<60);
const double eps = (1e-9);

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

  int n;
  cin >> n;

  vector<vector<int>> t(n);  // i 番目の人が正直者であるといっている人達
  vector<vector<int>> f(n);  // i 番目の人が不親切であるといっている人達

  rep(i, n) {
    int a;
    cin >> a;
    rep(j, a) {
      int x, y;
      cin >> x >> y;
      x--;
      if (y == 1) t[i].push_back(x);
      else f[i].push_back(x);
    }
  }
/*
  cerr << "t[0]: ";
  for (auto& a : t[0]) {
    cerr << a << " ";
  }
  cerr << endl;
*/
  int ans = 0;
  for (int bit = 0; bit < (1 << n); bit++) {
    vector<bool> tt(n, false);  // i 人目が正直者である
    vector<bool> ff(n, false);  // i 人目が不親切である
    int tmp = 0;

    rep(i, n) {
      if (bit & (1 << i)) {
//        cerr << bit << " " << i << endl;
        tmp++;
        for (auto& x : t[i]) {
          tt[x] = true;
        }
        for (auto& x : f[i]) {
          ff[x] = true;
        }
      }
    }
    bool ok = true;
    /*
    cerr << "tt: ";
    rep(i, n) {
      cerr << tt[i] << " ";
    }
    cerr << endl;
    cerr << "ff: ";
    rep(i, n) {
      cerr << ff[i] << " ";
    }
    cerr << endl;
    cerr << "tmp: " << tmp << endl;
    */
    rep(i, n) {
      if (tt[i] && !(bit & (1 << i))) ok = false;
      if (ff[i] && (bit & (1 << i))) ok = false;
      if (tt[i] && ff[i]) ok = false;
    }
    if (ok) chmax(ans, tmp);
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007

int main() {
	char s;
	cin>>s;
	ll now=s-'Z';
	if(now<=0){
		cout << 'A';
	}
	else{
		cout << 'a';
	}
	// your code goes here
	return 0;
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
const int N=2e5+9;
const int mod=1e9+7;

int main()
{
#ifndef ONLINE_JUDGE
    freopen("in.txt", "r", stdin);
#endif
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    ll n,x,c;
    cin>>n>>x>>c;
    ll ned=n/x;
    if(n%x!=0)ned++;
    cout<<ned*c;
    
    

}


    


Measured memory_bytes: 3644
#include<stdio.h>
#include<string.h>
int main()
{
  char O[50],E[50];
  
  scanf("%s\n%s",O,E);
  
  for(int i=0;i<strlen(O)+strlen(E);i++){
    if(i%2==0) printf("%c",O[i/2]);
    else printf("%c",E[i/2]);
  }
  
  return 0;
}

Measured memory_bytes: 128
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <deque>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cctype>
#include <cstring>
#include <ctime>
#include <iterator>
#include <bitset>
#include <numeric>
#include <list>
#include <iomanip>

#if __cplusplus >= 201103L
#include <array>
#include <tuple>
#include <initializer_list>
#include <unordered_set>
#include <unordered_map>
#include <forward_list>

#define cauto const auto&
#endif

using namespace std;


typedef long long LL;
typedef pair<int, int> pii;
typedef pair<LL, LL> pll;

typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;

#define VV(T) vector<vector< T > >

template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()) {
  v.assign(a, vector<T>(b, t));
}

template <class F, class T>
void convert(const F &f, T &t) {
  stringstream ss;
  ss << f;
  ss >> t;
}


#define rep(i,n) for(int i=0;i<int(n);++i)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define pb push_back


#define MOD 1000000007LL
#define EPS 1e-8


int main() {
  int H, W;
  cin >> H >> W;
  rep(i, H) {
    string s;
    cin >> s;
    cout << s << endl;
    cout << s << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cmath>
#include<algorithm>
using namespace std;
int a,n;
int main()
{
    scanf("%d%d",&n,&a);
    n%500>a?printf("No\n"):printf("Yes\n");
    return 0;
}

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

//FILE *fin = freopen("b.in", "r", stdin);

int n, m;
int frq[maxN];

int main()
{
    scanf("%d %d", &n, &m);
    for (int i = 1; i <= m; ++ i)
    {
        int x, y;
        scanf("%d %d", &x, &y);
        ++ frq[x];
        ++ frq[y];
    }
    for (int i = 1; i <= n; ++ i)
        if (frq[i] & 1)
        {
            printf("NO\n");
            exit(0);
        }
    printf("YES\n");

    return 0;
}


Measured memory_bytes: 640
# -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0555

"""
import sys
from sys import stdin
input = stdin.readline


def main(args):
    search_word = input().strip()
    N = int(input())

    found = 0
    for _ in range(N):
        data = input().strip()
        data = data + data
        data = data[:-1]
        if search_word in data:
            found += 1
    print(found)


if __name__ == '__main__':
    main(sys.argv[1:])

Measured memory_bytes: 7716
import Control.Applicative
import Data.Function
import Control.Monad
import Data.List
import Data.Char
import Control.Monad.State

j :: [String] -> [Int]
j [t,h] = case compare t h of
            GT -> [3,0]
            LT -> [0,3]
            EQ -> [1,1]

main :: IO ()
main = do
    n <- readLn
    cards <- replicateM n $ words <$> getLine
    putStrLn $ unwords . map show . foldr1 (\[x,y] [ax,ay] -> [x+ax,y+ay]) . map j $ cards


Measured memory_bytes: 4516
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define ll long long

using namespace __gnu_pbds;
using namespace std;

template <class T> using oset = tree <T, null_type, less <T>, rb_tree_tag, tree_order_statistics_node_update>;

void usaco(string name = "")
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    if(name.size())
    {
        freopen((name+".in").c_str(), "r", stdin);
        freopen((name+".out").c_str(), "w", stdout);
    }
}

int main()
{
    usaco();
    string s;
    cin >> s;
    cout << s << (s[s.size()-1] == 's' ? "es" : "s") << '\n';
}


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

const long long MOD=(long long)(1e9+7);
const int NAX=1005;
const int MAXN=1000005;
Int N,M,K;
Int W,H;
Int X,Y,Z;
vector<Int> A;
int spf[MAXN];
void sieve() 
{ 
    spf[1] = 1; 
    for (int i=2; i<MAXN; i++)
        spf[i] = i; 
    for (int i=4; i<MAXN; i+=2) 
        spf[i] = 2; 
  
    for (int i=3; i*i<MAXN; i++) 
    { 
        if (spf[i] == i) 
        { 
            for (int j=i*i; j<MAXN; j+=i) 
                if (spf[j]==j) 
                    spf[j] = i; 
        } 
    } 
} 


Int perform(Int x){
    return (x*(x+1))/2LL;
}

Int getFactors(int x){
    Int ans=1;
    Int temp=x;
    while(temp!=1){
        int iter=0;
        int prime=spf[temp];
        while(temp%prime==0){
            temp/=prime;
            ++iter;
        }
        ans*=(iter+1);
    }
    return ans;
}
int main()
{
    cin>>N;
    sieve();
    Int counter=0;
    for(int i=1;i<N;++i){
        counter+=getFactors(i);
    }
    cout<<counter<<"\n";
}

Measured memory_bytes: 7532
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define dump(x)  cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) << endl

#define rep(i, n) REP(i, 0, n)                              // 0, 1, ..., n-1
#define REP(i, x, n) for(int i = x; i < n; i++)             // x, x + 1, ..., n-1
#define FOREACH(x,a) for(auto& (x) : (a) )

#define ALL(v) (v).begin() , (v).end()
#define RALL(v) (v).rbegin(), (v).rend()

#define COUT(x) cout << (x) << 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; }

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

    int n; cin >> n;
    ll ansa = 1, ansb = 1;
    rep(i, n) {
        ll x, y; cin >> x >> y;
        ll n = max((ansa + x - 1) / x , (ansb + y - 1) / y);
        ansa = x * n;
        ansb = y * n;
    }
    COUT(ansa + ansb);
}

Measured memory_bytes: 256
import sys
from bisect import bisect_left
input = sys.stdin.readline

n, k = map(int, input().split())
p = [list(map(int, input().split())) for _ in range(n)]

x = [p[i][0] for i in range(n)]
x.sort()
y = [p[i][1] for i in range(n)]
y.sort()

coord = [[0] * n for i in range(n)]
for i in range(n):
    x_idx = bisect_left(x, p[i][0])
    y_idx = bisect_left(y, p[i][1])
    coord[x_idx][y_idx] += 1

coord_cs = [[0] * (n+1) for i in range(n+1)]
for i in range(n):
    for j in range(n):
        coord_cs[i+1][j+1] = coord[i][j]
for i in range(n):
    for j in range(n+1):
        coord_cs[i+1][j] += coord_cs[i][j]
for i in range(n+1):
    for j in range(n):
        coord_cs[i][j+1] += coord_cs[i][j]

# print(*coord, sep='\n')
# print(*coord_cs, sep='\n')

ans = (x[-1] - x[0]) * (y[-1] - y[0])
for xi in range(n):
    for xj in range(xi+1, n+1):
        for yi in range(n):
            for yj in range(yi+1, n+1):
                if coord_cs[xj][yj] - coord_cs[xi][yj] - coord_cs[xj][yi] + coord_cs[xi][yi] == k:
                    cand = (x[xj-1] - x[xi]) * (y[yj-1] - y[yi])
                    ans = min(ans, cand)

print(ans)


Measured memory_bytes: 3316
#pragma GCC optimize("Ofast")  
#pragma GCC target("avx,avx2,fma")
#include<bits/stdc++.h>
using namespace std;
#define IO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define int long long 
#define endl "\n"
#define all(x) (x).begin(),(x).end()
const int MOD = 1e9+7;
const int mxN = 2e5+3;

void solve(){
	int n,d;
	cin >> n >> d;
	d *= d;
	int cnt = 0;
	int xi, yi;
	for(int i = 0; i < n; ++i){
		cin >> xi >> yi;
		int x = xi * xi;
		int y = yi * yi;
		int z = x + y;
		if(z <= d)cnt++;
	}
	cout << cnt << endl;
}

int32_t main(){
	IO;
	
	int nT = 1;
	//cin >> nT;
	for(int i = 1; i <= nT; ++i)
		solve();
	return 0;
}


Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
const int MAXN = 1e6 + 10;




typedef long long LL;
vector<pair<int, int>> g[MAXN];
int ans[MAXN];
void dfs(int u, int cur = 0) {
  ans[u] = cur;
  for (pair<int, int> P : g[u]) {
    int v, w; tie(v, w) = P;
    if (ans[v] == -1) dfs(v, cur^w);
  }
}


int main() {
  ios_base::sync_with_stdio(false); cin.tie(0);
  int N; cin >> N;
  memset(ans, -1, sizeof(ans));
  for (int i = 0; i < N - 1; ++i) {
    int u, v, w; cin >> u >> v >> w;
    --u, --v;
    g[u].emplace_back(v, w % 2);
    g[v].emplace_back(u, w % 2);
  }
  dfs(0);
  for (int i = 0; i < N; ++i) cout << ans[i] << '\n';
}


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

using ll = long long;
using pp = pair<ll,ll>;
const ll amari = 1e9+7;
const char BC = 'A' - 'a';
#define ben(a) a.begin(),a.end()
#define pb(a,b) a.push_back(b)
//fixed << setprecision(20)

int main(){
	int n;
	cin >> n;
	vector<double> v;
	double d;
	for(int i = 0; i < n; i++){
		cin >> d;
		pb(v,d);
	}
	sort(ben(v));
	double ans = (v[0] + v[1]) / 2;
	for(int i = 2; i < n; ++i){
		ans = (ans + v[i]) / 2;
	}
	cout << fixed << setprecision(20) << ans << endl;
	return 0;
}
 

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


Measured memory_bytes: 128
//#include<bhaai.h>
#include<bits/stdc++.h>
using namespace std;
#define to int64_t
#define mo 1000000007
#define fr(a,e) for(int i=a;i<=e;i++)
#define yah_faster_baby ios_base::sync_with_stdio(0);cin.tie(0);

to ans,n,k,m,r[200005];
//vector <int> v;
//char s[200005];
//double d,x;
int main()
 {  yah_faster_baby
    to a,b=0,mid;
    cin>>n;
    cin>>k;
    fr(0,n-1)
    {cin>>r[i];b=max(b,r[i]);}
    a=1;
    while(a<b)
    {mid=a+(b-a)/2;
     m=0;
     fr(0,n-1)
     m+=ceil((double)r[i]/mid)-1;
     if(m<=k)
     b=mid;
     else
     a=mid+1;
    }
    cout<<a<<endl;
    return 0;
}



Measured memory_bytes: 5184
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int N = 2e5 + 10;
#define fi first
#define se second
#define pb push_back
int n,a[N],sta;
int main() {
    ios::sync_with_stdio(false);
    cin>>n;
    for(int i=1;i<=n;i++){
        int x;
        cin>>x;
        if(x%2==0){
            if(x%3!=0&&x%5!=0){
                sta=1;
            }
        }
    }
    if(sta)cout<<"DENIED\n";
    else cout<<"APPROVED\n";
    return 0;
}


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

int n, q, t, x ,y;

int op (int a, int b) { return max(a, b); }
int e () { return (int)-1e9; }
bool f (int a) { return a < y; }

int main(){
    cin >> n >> q;
    vector<int> a(n);
    for (int i = 0; i < n; i++) cin >> a[i];
    segtree<int, op, e> data(a);
    while (q--) {
        cin >> t >> x >> y;
        if (t == 1) data.set(x - 1, y);
        else if (t == 2) cout << data.prod(x - 1, y) << "\n";
        else cout << data.max_right<f>(x - 1) + 1 << "\n";
    }
    return 0;
}

Measured memory_bytes: 6168