akhauriyash/Code-Regression huggingface dataset:
#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream>
#include <random>
#include<map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include<fstream>
#include <unordered_map>
#include <cstdlib>
#include <complex>
using namespace std;
#define Ma_PI 3.141592653589793
#define eps 0.00000001
#define LONG_INF 3000000000000000000
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007
#define MOD 998244353
#define REP(i,n) for(long long i = 0;i < n;++i)    
#define seg_size 524288
double dot(complex<double> a, complex<double> b) {
	return a.real() * b.real() + a.imag() * b.imag();
}
double gyaku_dot(complex<double> a, complex<double> b) {
	return a.real() * b.imag() - a.imag() * b.real();
}
double leng(complex<double> a) {
	return sqrt(a.real() * a.real() + a.imag() * a.imag());
}
double angles(complex<double> a, complex<double> b) {
	double cosine = dot(a, b) / (leng(a) * leng(b));
	double sine = gyaku_dot(a, b) / (leng(a) * leng(b));
	double kaku = acos(cosine);
	if (sine <= 0) {
		kaku = 2 * Ma_PI - kaku;
	}
	return kaku;
}
vector<int> convex_hull(vector<complex<double>> a) {
	vector<int> ans;
	double now_minnest = a[0].real();
	int now_itr = 0;
	REP(i, a.size()) {
		if (now_minnest > a[i].real()) {
			now_minnest = a[i].real();
			now_itr = i;
		}
	}
	ans.push_back(now_itr);
	complex<double> ba(0, 1);
	while (true) {
		int now_go = 0;
		double now_min = 0;
		int starter = ans[ans.size() - 1];
		for (int i = 0; i < a.size(); ++i) {
			if (i != starter) {
				double goa = angles(ba, a[i] - a[starter]);
				if (goa > now_min) {
					now_min = goa;
					now_go = i;
				}
			}
		}
		if (now_go == ans[0]) break;
		ans.push_back(now_go);
		ba = complex<double>(a[now_go] - a[starter]);
	}
	return ans;
}
long long gcd(long long a, long long b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}
int main(){
	int x, a;
	cin >> x >> a;
	if (x < a) {
		cout << 0 << endl;
	}
	else {
		cout << 10 << endl;
	}
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using i64 = int64_t;
using vi = vector<i64>;
using vvi = vector<vi>;

class BIT {
    int n, N;
    vi data;

    i64 sum(int i) {
        i64 s = 0;
        while (i > 0) {
            s += data[i];
            i -= i & -i;
        }
        return s;
    }

    // assuming elements are all positive
    int lower_bound(i64 w) {
        if (w <= 0) return -1;
        int x = 0;
        for (int k = N; k > 0; k >>= 1) {
            if (x + k <= n && data[x + k] < w) {
                w -= data[x + k];
                x += k;
            }
        }
        return x;
    }

    int upper_bound(i64 w) {
        if (w <= 0) return -1;
        int x = 0;
        for (int k = N; k > 0; k >>= 1) {
            if (x + k <= n && data[x + k] <= w) {
                w -= data[x + k];
                x += k;
            }
        }
        return x;
    }

public:
    BIT(int n) : n(n) {
        data = vi(n + 1);
        N = 1;
        while (N <= n) N <<= 1;
        N >>= 1;
    }

    void add(int i, i64 x) {
        i++;
        while (i <= n) {
            data[i] += x;
            i += i & -i;
        }
    }

    // [l, r)
    i64 sum(int l, int r) {
        return sum(r) - sum(l);
    }

    // sum([a, k]) >= xとなる最小のk
    int lower_bound(int a, i64 x) {
        return max(a, lower_bound(x + sum(0, a)));
    }

    // sum([a, k]) > xとなる最小のk
    int upper_bound(int a, i64 x) {
        return max(a, upper_bound(x + sum(0, a)));
    }
};

int main() {
    int n, q;
    cin >> n >> q;
    BIT bit(n + 1);
    for (int i = 0; i < n; i++) {
        int a;
        cin >> a;
        bit.add(i, a);
    }
    bit.add(n, 1e17);
    while (q--) {
        i64 x;
        cin >> x;
        i64 ret = 0;
        for (int i = 0; i < n; i++) {
            ret += bit.upper_bound(i, x) - i;
        }
        cout << ret << endl;
    }
}


Measured memory_bytes: 3604
#include<iostream>
#include<algorithm>
#include<string>
#include<map>
#include<stdio.h>
using namespace std;
 
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define INF 1<<25
 
int main()
{
	int n;
	int a;
	int b;
	int c;
	cin >> n;
	a = n / 2;
	b = n % 2;
	if (b == 0)
		c = a * a;
	else
		c = a * a + a;
	cout << c << endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

public class Main {

    public static void main(String[] args){

        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();

        int[] a = new int[n];

        for(int i=0; i<n; i++) {
            a[i] = sc.nextInt();
        }

        Arrays.sort(a);

        int b = a[n/2];
        int c = a[n/2-1];

        System.out.println(b-c);

    }

}


Measured memory_bytes: 50828
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int M=55;
int n,p,x,ans;
ll dp[M][2],c[M];
int main(){
	scanf("%d %d",&n,&p);
	
	for(int i=1;i<=n;i++)scanf("%d",&x),c[i]=x%2;
	
	for(int i=1;i<=n;i++)dp[i][c[i]]=1;
	
	dp[0][0]=1;
	
	for(int i=1;i<=n;i++)
		for(int b=0;b<2;b++){
			for(int j=i-1;j>=0;j--){
				if(!c[i])dp[i][b]+=dp[j][b];
				else dp[i][b]+=dp[j][!b];
			}
		}	
	
	printf("%lld\n",dp[n][p]);
	return 0;
}

Measured memory_bytes: 256
N = int(input())
S = input()
list_S = list(S)
list_ans = []

alphabet_number = {'A':1, 'B':2, 'C':3, 'D':4, 'E':5, 'F':6, 'G':7, 'H':8, 'I':9, 'J':10, 'K':11, 'L':12, 'M':13,
            'N':14, 'O':15, 'P':16, 'Q':17, 'R':18, 'S':19, 'T':20, 'U':21, 'V':22, 'W':23, 'X':24, 'Y':25, 'Z':26}

number_alphabet = {1:'A', 2:'B', 3:'C', 4:'D', 5:'E', 6:'F', 7:'G', 8:'H', 9:'I', 10:'J', 11:'K', 12:'L', 13:'M',
                   14:'N', 15:'O', 16:'P', 17:'Q', 18:'R', 19:'S', 20:'T', 21:'U', 22:'V', 23:'W', 24:'X', 25:'Y', 26:'Z'}

for i in range(len(list_S)):
    A = alphabet_number[list_S[i]]
    
    if A + N <= 26:
        B = A + N
    else:
        B = (A+N) - 26
        
    C = number_alphabet[B]
    list_ans.append(C)

print(''.join(list_ans))

Measured memory_bytes: 3316
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Practice
{
    class Program
    {
        private static int ReadAndParseInt()
        {
            return int.Parse(Console.ReadLine());
        }
        private static int[] ReadAndParseIntArr()
        {
            return Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
        }
        private static long ReadAndParseLong()
        {
            return long.Parse(Console.ReadLine());
        }
        private static long[] ReadAndParseLongArr()
        {
            return Array.ConvertAll(Console.ReadLine().Split(' '), long.Parse);
        }
        static void Main(string[] args)
        {
            SolveA(args);
            //SolveB(args);
            //SolveC(args);
            //SolveD(args);


        }
        private const long MOD = 1000000007;
        static void SolveA(string[] args)
        {
            int n = ReadAndParseInt();
            string[] s = (Console.ReadLine().Split(' '));
            var hash = new HashSet<string>();
            foreach(var tmp in s)
            {
                if(! hash.Contains(tmp))
                {
                    hash.Add(tmp);
                }
            }
            if( hash.Count == 3)
            {
                Console.WriteLine("Three");
            }
            else
            {
                Console.WriteLine("Four");
            }
        }
    }
}

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

using namespace std;

int l;
void read()
{
    cin >> l;
}

void solve()
{
    double p = l / 3.0;

    cout << fixed;
    cout << setprecision(10) << p * p * p << endl;
}

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

    read();
    solve();
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <deque>
#include <queue>
#include <list>
#include <stack>
#include <string>
#include <functional>
#include <numeric>
#define _USE_MATH_DEFINES
#include <math.h>
#include <iomanip>
#include <map>
#include <set>
#include <cstdlib>
#include <bitset>
using namespace std;
#define INT_MAX 2147483647
#define INT_MIN (-2147483647 - 1)
#define INF 100000000
#define _INF -100000000
#define INFLL (long long)1e14
#define _INFLL (long long)-1e14
#define Loop(i, n) for(int i = 0; i < (int)n; i++)
#define Loop1(i, n) for(int i = 1; i <= (int)n; i++)
#define Loopr(i, n) for(int i = (int)n - 1; i >= 0; i--)
#define Loopr1(i, n) for(int i = (int)n; i >= 1; i--)
#define bitmanip(m,val) static_cast<bitset<(int)m>>(val)
typedef long long int ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<char> vc;
typedef vector<vector<char>> vvc;
typedef pair<int, int> P;

struct node {
	bool done;
	vi to;
	int id, from;
	int pre, low;
};

class lowlink {
	int ord;
public:
	vector<node> nodes;
	set<P> bridges;
	set<int> arts; //articulation point
	lowlink(vector<node> A) {
		ord = 0;
		nodes = A;
	}
	void dfs(int a, int root) {
		nodes[a].done = 1;
		nodes[a].pre = nodes[a].low = ord;
		ord++;
		int cnt = 0;
		Loop(i, nodes[a].to.size()) {
			int b = nodes[a].to[i];
			if (b == nodes[a].from) continue;
			if (!nodes[b].done) {
				nodes[b].from = a;
				dfs(b, root);
				nodes[a].low = min(nodes[a].low, nodes[b].low);
				if (nodes[a].pre <= nodes[b].low) cnt++;
				if (nodes[a].pre < nodes[b].low) {
					int s = min(a, b), t = max(a, b);
					bridges.insert({ s,t });
				}
			}
			else {
				nodes[a].low = min(nodes[a].low, nodes[b].pre);
			}
		}
		if (cnt > (a == root ? 1 : 0)) arts.insert(a);
		return;
	}
	void find_bridges_and_arts() {
		Loop(i, nodes.size()) {
			if (!nodes[i].done) dfs(i, i);
		}
	}
};

int main() {
	int v, e; cin >> v >> e;
	vector<node> nodes(v);
	Loop(i, v) nodes[i] = { 0,{}, i,-1,-1,-1 };
	Loop(i, e) {
		int s, t;
		cin >> s >> t;
		nodes[s].to.push_back(t);
		nodes[t].to.push_back(s);
	}
	lowlink lk(nodes);
	lk.find_bridges_and_arts();
	/*
	auto itr = lk.arts.begin();
	Loop(i, lk.arts.size()) {
		cout << *itr << endl;
		itr++;
	}*/
	auto itr = lk.bridges.begin();
	Loop(i, lk.bridges.size()) {
		cout << (*itr).first << " " << (*itr).second << endl;
		itr++;
	}
	return 0;
}

Measured memory_bytes: 5848
import sys
INPUT = lambda: sys.stdin.readline().rstrip()
INT = lambda: int(INPUT())
LIST = lambda: list(map(int, INPUT().split()))
sys.setrecursionlimit(10 ** 9)


def main():
    N = INT()
    H = LIST()

    D = [0]
    idx = 0
    for i in range(N-1):
        if H[i] >= H[i+1]: D[idx] += 1
        else:
            idx += 1
            D.append(0)

    print(max(D))


if __name__ == '__main__':
    main()


Measured memory_bytes: 63856
open Batteries
open Printf
open Scanf

let (++) = Int64.add
let (--) = Int64.sub
let ( ** ) = Int64.mul
let (//) = Int64.div
let (%%) = Int64.rem

let read_int _ = scanf " %d " (fun x -> x)
let read_long _ = scanf " %Ld " (fun x -> x)

let inf = 0x003f3f3f3f3f3f3fL

let dist x s =
  match Array.bsearch Int64.ord s x with
  | `At i -> (0L,0L)
  | `All_lower -> (x -- s.(Array.length s - 1), inf)
  | `All_bigger -> (inf, s.(0) -- x)
  | `Just_after i -> (x -- s.(i), (s.(i+1) -- x))
  | `Empty -> (inf,inf)

let () =
  let a,b,q = scanf " %d %d %d " (fun x y z -> (x,y,z)) in
  let s = Array.init a read_long in
  let t = Array.init b read_long in
  let x = Array.init q read_long in
  Array.iter (fun x ->
      let (ls,rs) = dist x s in
      let (lt,rt) = dist x t in
      let ans = List.min [
          max ls lt; 2L**(ls++rt)--(max ls rt); max rs rt; 2L**(rs++lt)--(max rs lt)
        ] in
      printf "%Ld\n" ans
    ) x


Measured memory_bytes: 14672
n,k = map(int,input().split())
a = list(map(int,input().split()))
s = sum(a)
x = [0]*n
t = 0
for i in range(n):
    y = int(a[i]/s * k)
    x[i] = [i, a[i], y, a[i]/(y+1)]
    t += y
x.sort(key= lambda val : val[3],reverse=True)
for i in range(k-t):
    x[i][2] += 1
ans = 0
for i in range(n):
    ans = max(ans, x[i][1]/(x[i][2]+1))
print(int(-(-ans//1)))

Measured memory_bytes: 59344
using System;
using System.Collections.Generic;
using System.Collections;
using System.Collections.Specialized;
using System.Linq;
using System.Text;
using System.IO;
using System.Reflection;
using static System.Math;
using System.Numerics;
static class Program{
	const int mod=(int)1e9+7;
	const double eps=1e-11;
	static void Main(){
		Sc sc=new Sc();
		var n=sc.L;
		if(n==2){
			Console.WriteLine(1);
			return;
		}
		int q=(int)Sqrt(n),ans=2;
		for(int i = 2;i<=q;i++) {
			if((n-1)%i==0){
				if(i==q){ans++;}
				else{ans+=2;}
			}
			else if((i<10||n%i==0)&&Fu(i,n)){
				ans++;
			}
		}
		Console.WriteLine(ans);
	}
	static bool Fu(long i,long n){
		long p=n;
		while(p>1){
			if(p%i==0){p/=i;}
			else if(p>i){p%=i;}
			else{p-=i;}
		}
		return p==1;
	}
}
public class Sc{
	public int I{get{return int.Parse(Console.ReadLine());}}
	public long L{get{return long.Parse(Console.ReadLine());}}
	public double D{get{return double.Parse(Console.ReadLine());}}
	public string S{get{return Console.ReadLine();}}
	public int[] Ia{get{return Array.ConvertAll(Console.ReadLine().Split(),int.Parse);}}
	public long[] La{get{return Array.ConvertAll(Console.ReadLine().Split(),long.Parse);}}
	public double[] Da{get{return Array.ConvertAll(Console.ReadLine().Split(),double.Parse);}}
	public string[] Sa{get{return Console.ReadLine().Split();}}
	public object[] Oa{get{return Console.ReadLine().Split();}}
	public int[] Ia2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),int.Parse);}}
	public int[] Ia3(int a){return Array.ConvertAll((a.ToString()+" "+Console.ReadLine()).Split(),int.Parse);}
	public int[] Ia3(bool a,int b,bool c,int d){return Array.ConvertAll(((a?b.ToString()+" ":"")+Console.ReadLine()+(c?" "+d.ToString():"")).Split(),int.Parse);}
	public long[] La2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),long.Parse);}}
	public long[] La3(int a){return Array.ConvertAll((a.ToString()+" "+Console.ReadLine()).Split(),long.Parse);}
	public long[] La3(bool a,int b,bool c,int d){return Array.ConvertAll(((a?b.ToString()+" ":"")+Console.ReadLine()+(c?" "+d.ToString():"")).Split(),long.Parse);}
	public double[] Da2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),double.Parse);}}
	public double[] Da3(int a){return Array.ConvertAll((a.ToString()+" "+Console.ReadLine()).Split(),double.Parse);}
	public double[] Da3(bool a,int b,bool c,int d){return Array.ConvertAll(((a?b.ToString()+" ":"")+Console.ReadLine()+(c?" "+d.ToString():"")).Split(),double.Parse);}
	public T[] Arr<T>(int n,Func<T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f();}return a;}
	public T[] Arr<T>(int n,Func<int,T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i);}return a;}
	public T[] Arr<T>(int n,Func<string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(Console.ReadLine().Split());}return a;}
	public T[] Arr<T>(int n,Func<int,string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i,Console.ReadLine().Split());}return a;}
}

Measured memory_bytes: 13140
def get_num(n, x):
    ans = 0
    for n3 in xrange(min(n, x), (x + 2) / 3, -1):
        for n2 in xrange(min(n3 - 1, x - n3), (x - n3 + 1) / 2 - 1, -1):
            for n1 in xrange(min(n2 - 1, x - n3 - n2), 0, -1):
                if n1 + n2 + n3 == x:
                    ans += 1
                    break
    return ans


# data = []
while True:
    [n, x] = [int(m) for m in raw_input().split()]
    if [n, x] == [0, 0]:
        break
    if x < 3:
        print(0)
    else:
        print(get_num(n, x))

Measured memory_bytes: 6368
// template.cpp

// Defines.
//#define DEBUG
#define NUMBER_OF_DIGITS 6

// Includes.
#include <bits/stdc++.h>

#ifdef DEBUG
#include <chrono>
#endif

// Usings.
using namespace std;

// Main function.
int main()
{
#ifdef DEBUG
	chrono::system_clock::time_point start, end;
	
	start = chrono::system_clock::now();
#endif
	
	// settings.
	ios::sync_with_stdio(false);
	
	//cout << fixed;
	//cout << setprecision(NUMBER_OF_DIGITS);
	
	// logic.
	int n;
	cin >> n;
	
	int total = 0;
	for (int i = 1; i <= n; i += 2)
	{
		int counter = 0;
		for (int j = 1; j <= i; j++)
		{
			if ((i % j) == 0)
			{
				counter++;
			}
		}
		
		if (counter == 8)
		{
			total++;
		}
	}
	
	cout << total << endl;

#ifdef DEBUG
	end = chrono::system_clock::now();
	
	double elapsed = chrono::duration_cast<std::chrono::milliseconds>(end-start).count();
	cout << elapsed << "[ms]" << endl;
#endif
	
	return 0;
}


Measured memory_bytes: 3628
#include<iostream>
#include<algorithm>
#include<functional>
#include<cmath>
#include<numeric>
#include<queue>
#include<string>
#include<vector>
#include <stdio.h>
#define ll long long
#include<cstring>
#define rep(i,n) for(int i=0;i<n;i++)
ll mod = 1000000007;
using namespace std;
priority_queue<ll int>QUE;//きゅー

int length(char* str) {
	int len = strlen(str);
	return len;
}

int main(void)
{
	int A, B;
	cin >> A >> B;
	int ans = A - B + 1;
	cout << ans;
	return 0;
	
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <cassert>
#include <memory>
#include <stack>
#include <set>

#define MAX_SIZE 100000000
typedef unsigned long long ull;
using namespace std;

int main() {
  int a,b,c; cin >> a >> b >> c;
  int k; cin >> k;
  for(int i = 0; i < k; i++) {
    if(a > max(b,c)) {
      a *= 2;
    } else if(b > max(a,c)) {
      b *= 2;
    } else {
      c *= 2;
    }
  }
  const int ans = a + b + c;
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n,m,k;
    cin >> n >> m >> k;
    for(int i=0;i<=n;i++){
        for(int j=0;j<=m;j++){
            if(i*j+(n-i)*(m-j)==k){
                cout << "Yes" << endl;
                return 0;
            }
        }
    }
    cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdio>

using namespace std;

int main()
{
    if (fopen("Test.INP", "r"))
        freopen("Test.INP", "r", stdin);

    int n, k;
    cin >> n >> k;

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

    int dp[n];
    memset(dp, 0, sizeof(dp));
    dp[0] = 0;
    for (int i = 1; i < n; ++i)
    {
        dp[i] = dp[i - 1] + abs(a[i] - a[i - 1]);
        for (int j = 2; j <= k; ++j)
            if (i >= j)
                dp[i] = min(dp[i], dp[i - j] + abs(a[i] - a[i - j]));
    }

    cout << dp[n - 1];
    return 0;
}


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

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

using namespace std;
using ll = long long;
int mod = 1000000007;

void solve();

int main(void){
    ll X, Y, Z, K; cin >> X >> Y >> Z >> K;
    ll A[X], B[Y], C[Z];
    rep(i, X) cin >> A[i];
    rep(i, Y) cin >> B[i];
    rep(i, Z) cin >> C[i];
    int XY = X*Y;
    vector<ll> AB(XY);
    int idx = 0;
    rep(i, X){
        rep(j, Y){
            AB[idx] = A[i]+B[j];
            idx++;
        }
    }
    sort(AB.begin(), AB.end(), greater<ll>());
    sort(C, C+Z, greater<ll>());

    int KZ = K*Z;
    vector<ll> ABC(KZ, 0);
    idx = 0;
    int loop = K;
    if(AB.size() < K) loop = AB.size();
    rep(i, loop){
        rep(j, Z){
            ABC[idx] = AB[i]+C[j];
            idx++;
        }
    }
    sort(ABC.begin(), ABC.end(), greater<ll>());

    rep(i, K){
        cout << ABC[i] << endl;
    }


    return 0;
}

void solve(){}

Measured memory_bytes: 31616
#include <iostream>
#include <string>
#include <cstdlib>

using namespace std;

int main(void){
  int h,w;
  string str;
  
  cin >> h >> w;
  
  for(int i = 0 ; i < h ; i++){
    for(int j = 0 ; j < w ; j++){
      cin >> str;
      if(str == "snuke"){
        cout << char('A' + j) << i+1 << endl;
      }
    }
  }
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
using ll = long long;
const long long INF = 1LL << 60;
const int MOD = 1e9 + 7;

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

/* ACL */
#ifndef ATCODER_DSU_HPP
#define ATCODER_DSU_HPP 1

#include <algorithm>
#include <cassert>
#include <vector>

namespace atcoder {

// Implement (union by size) + (path compression)
// Reference:
// Zvi Galil and Giuseppe F. Italiano,
// Data structures and algorithms for disjoint set union problems
struct dsu {
  public:
    dsu() : _n(0) {}
    dsu(int n) : _n(n), parent_or_size(n, -1) {}

    int merge(int a, int b) {
        assert(0 <= a && a < _n);
        assert(0 <= b && b < _n);
        int x = leader(a), y = leader(b);
        if (x == y) return x;
        if (-parent_or_size[x] < -parent_or_size[y]) std::swap(x, y);
        parent_or_size[x] += parent_or_size[y];
        parent_or_size[y] = x;
        return x;
    }

    bool same(int a, int b) {
        assert(0 <= a && a < _n);
        assert(0 <= b && b < _n);
        return leader(a) == leader(b);
    }

    int leader(int a) {
        assert(0 <= a && a < _n);
        if (parent_or_size[a] < 0) return a;
        return parent_or_size[a] = leader(parent_or_size[a]);
    }

    int size(int a) {
        assert(0 <= a && a < _n);
        return -parent_or_size[leader(a)];
    }

    std::vector<std::vector<int>> groups() {
        std::vector<int> leader_buf(_n), group_size(_n);
        for (int i = 0; i < _n; i++) {
            leader_buf[i] = leader(i);
            group_size[leader_buf[i]]++;
        }
        std::vector<std::vector<int>> result(_n);
        for (int i = 0; i < _n; i++) {
            result[i].reserve(group_size[i]);
        }
        for (int i = 0; i < _n; i++) {
            result[leader_buf[i]].push_back(i);
        }
        result.erase(
            std::remove_if(result.begin(), result.end(),
                           [&](const std::vector<int>& v) { return v.empty(); }),
            result.end());
        return result;
    }

  private:
    int _n;
    // root node: -1 * component size
    // otherwise: parent
    std::vector<int> parent_or_size;
};

}  // namespace atcoder

#endif  // ATCODER_DSU_HPP

using namespace atcoder;

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

    dsu d(N);
    rep(i,M){
        int a,b;
        cin >> a >> b;
        d.merge(a-1,b-1);
    }

    vector<vector<int>> dg = d.groups();

    int mmax = 0;
    int sz;
    rep(i,dg.size()){
        sz = dg.at(i).size();
        chmax(mmax,sz);
    }
    cout << mmax << endl;


    return 0;
}

Measured memory_bytes: 16328
#include <bits/stdc++.h>
using namespace std;
int main() {
 string a;
  cin >> a;
  if(a.at(0)=='S') cout << "Cloudy" << endl;
  else if(a.at(0)=='R') cout << "Sunny" << endl;
  else cout << "Rainy" << endl;
}


Measured memory_bytes: 3572
import java.util.*;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		long x = sc.nextLong();
		long a=0;
		long b=0;
		for(int i=-1000;i<=1000;i++){
			long a1 = x+(long)Math.pow(i,5);
			for(int j=-1000;j<=1000;j++){
				long h = (long)Math.pow(j,5);
				if(a1==h){
					a=j;
					b=i;
					break;
				}
			}
            // long a2 = floorRoot5(a1);
            // if(Math.pow(a2,5)==a1){
            // 	a=a2;
            // 	b=i;
            // 	break;
            // }
		}
		System.out.println(a+" "+b);
	}
	 static long floorRoot5(long n) 
    { 
          
        // Base cases 
        if (n == 0 || n == 1) 
        return n; 
        // Do Binary Search for  
        // floor of 5th square root 
        long low = 1, high = n, ans = 0; 
        while (low <= high) 
        { 
            // Find the middle point 
            // and its power 5 
            long mid = (low + high) / 2; 
            long mid5 = mid * mid * mid *  
                            mid * mid; 
            // If mid is the required root 
            if (mid5 == n) 
                return mid;       
            // Since we need floor,  
            // we update answer when 
            // mid5 is smaller than n,  
            // and move closer to 
            // 5'th root 
            if (mid5 < n) 
            { 
                low = mid + 1; 
                ans = mid; 
            } 
            // If mid^5 is greater 
            // than n 
            else
                high = mid - 1; 
        } 
        return ans; 
    } 
}

Measured memory_bytes: 38968
sx, sy, tx, ty = map(int,input().split())
height = ty - sy
width = tx - sx 
# path1
path1 = ['U' for _ in range(height) ]
path1.extend([ 'R' for _ in range(width)])
# path2
path2 = ['D' for _ in range(height)]
path2.extend([ 'L' for _ in range(width)])
# path3
path3 = ['U' for _ in range(height+1)]
path3.extend([ 'R' for _ in range(width+1)])
path3.insert(0,'L')
path3.extend(['D'])
# path4
path4 = ['D' for _ in range(height+1)]
path4.extend([ 'L' for _ in range(width+1) ])
path4.insert(0,'R')
path4.extend(['U'])

path = path1
path.extend(path2)
path.extend(path3)
path.extend(path4)

print(''.join(path))

Measured memory_bytes: 3316
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n;
	cin>>n;
	int a[n][3];
	for(int i=0;i<n;i++)
		for(int j=0;j<3;j++)
			cin>>a[i][j];
	for(int i=1;i<n;i++)
		for(int j=0;j<3;j++)
			a[i][j] = a[i][j]+max(a[i-1][(j+1)%3],a[i-1][(j+2)%3]);
	int maxi = INT_MIN;
	for(int i = 0;i<3;i++)
		maxi = max(maxi,a[n-1][i]);
	cout<<maxi<<endl;
	return 0;
}


Measured memory_bytes: 4776
#include<iostream>
#include<cstdio>
#include<cmath>
#define pi acos(-1)
using namespace std;
int n,L;
double T[101010],sumx,sumy;
void add(double x,int k)
{
	sumx+=cos(x)*k;
	sumy+=sin(x)*k;
}
int main()
{
	scanf("%d%d",&n,&L);
	for(int i=1;i<=n;i++)
	scanf("%lf",&T[i]),T[i]=T[i]/L*2.0*pi;
	for(int i=1;i<=n;i++)
		for(int j=i+1;j<=n;j++)
		{
			double rad=(T[i]+T[j])/2.0;
			add(rad,n-j+i-1);
			add(rad+pi,j-i-1);
		}
	double num=1.0*n*(n-1)*(n-2)/6.0;
	printf("%.11lf %.11lf\n",sumx/num,sumy/num);
}	
		

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int N;
    cin >> N;
    vector<int> V(N), C(N);
    for (int i = 0; i < N; i++)
    {
        cin >> V[i];
    }
    for (int i = 0; i < N; i++)
    {
        cin >> C[i];
    }
    int ans = 0;
    for (int i = 0; i < N; i++)
    {
        if (V[i] - C[i] > 0)
        {
            ans += V[i] - C[i];
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
      int A = sc.nextInt();
      int B = sc.nextInt();
      int C = A + B;
      int D = A - B;
      int E = A * B;
      if(C>=D && C>=E){
        System.out.println(C);
      }else if(D>=C && D>=E){
        System.out.println(D);
      }else if(E>=C && E>=D){
        System.out.println(E);
      }
    }
}

Measured memory_bytes: 35640
#include<stdio.h>
signed main(){
    char S[200001], T[200001];

    int i, count=0;

    scanf("%s %s", S, T);

    for(i=0; S[i] != '\0' ; i++){
        if(S[i] != T[i]){
            count++;
        }
    }

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

 return 0;
    
}

Measured memory_bytes: 2024
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define db(x) cerr<<__LINE__<<": "<<#x<<" = "<<(x)<<'\n'
const int N = 1e6;
double pi = acos(-1.0);

int main() {
    ios_base::sync_with_stdio(0);
    int a,b,r,T,cas=0;
    cin>>r;
    cout<<fixed<<setprecision(8)<<pi*r*2;
    return 0;
}

Measured memory_bytes: 3792
Option Strict On
Imports System.Console
Imports System.Collections.Generic

Module Program
    Sub Main()
        Dim N As Integer = NextInt()
        Dim L As Integer = NextInt()
        Dim S As String() = New String() {}

        For i As Integer = 0 To N - 1
            ReDim Preserve S(UBound(S) + 1)
            S(UBound(S)) = ReadLine()
        Next

        Array.Sort(S)
        WriteLine(String.Join("", S))
    End Sub

    Function NextInt() As Integer
        Return CInt(NextString())
    End Function

    Function NextString() As String
        Dim result As New List(Of String)
        Do
            Dim tmp As Integer = Read()
            If tmp < 0 Then Exit Do
            Dim nextChar As Char = Chr(tmp)

            If Not Char.IsWhiteSpace(nextChar) Then
                result.Add(nextChar)
            ElseIf nextChar <> vbCr Then
                Exit Do
            End If
        Loop
        Return String.Join("", result)
    End Function

End Module


Measured memory_bytes: 20444
x, y = map(int, input().split())

ans = 0
if x == 1:
    ans += 300000
elif x == 2:
    ans += 200000
elif x == 3:
    ans += 100000
if y == 1:
    ans += 300000
elif y == 2:
    ans += 200000
elif y == 3:
    ans += 100000
if x == y == 1:
    ans += 400000

print(ans)


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

int n, q, ti[100000], nt, ansn[100000], anst[100000], ansc;
string na[100000];
queue<int> qu;

int main() {
	nt = 0;
	ansc = 0;
	cin >> n >> q;
	for ( int i = 0; i < n; i++ ) {
		cin >> na[i] >> ti[i];
		qu.push( i );
	}
	int k = 0;
	int f;
	while ( ! qu.empty() ) {
		f = qu.front();
		if ( ti[f] > q ) {
			nt += q;
			ti[f] -= q;
			qu.push( f );
		} else {
			nt += ti[f];
			ti[f] = 0;
			ansn[ansc] = f;
			anst[ansc] = nt;
			ansc++;
		}
		qu.pop();
	}
	for ( int i = 0; i < n; i++ )
		cout << na[ansn[i]] << " " << anst[i] << endl;
}

Measured memory_bytes: 5168
#[allow(unused_imports)]


#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}



fn main() {
    input! {
        n: usize,
        h: [i64; n],
    }
    let mut v = 0;
    for i in &h {
        v += i.clone();
    }
    let mut e = 0;
    for i in 1..h.len() {
        e += std::cmp::min(h[i-1], h[i]);
    }
    println!("{}", v - e);
}

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

 int main(){

  int x;
  cin>>x;

  //
  //
  int h=x / 3600;
  int m=(x / 60) % 60;
  int s=x % 60;
  cout<<h<<":"<<m<<":"<<s<<endl;

  return 0;
  }


Measured memory_bytes: 3096
#include<stdio.h>
int stack[10000];
int top=0;
int pop(){
  return stack[top--];
}
void push(int x){
  stack[++top]=x;
}
int main(void){
  int i;
  int a,b;
  char c[10000];
  for(i=0;;i++){
    scanf("%c",&c[i]);
    if(c[i]=='\n') break;
  }
  for(i=0;;i++){
    if(c[i]=='\n') break;
    if(c[i]=='+'||c[i]=='-'||c[i]=='*'||c[i]=='/'){
      b=pop();
      a=pop();
      switch(c[i]){
      case '+':
        push(a+b);
        break;
      case '-':
        push(a-b);
        break;
      case '*':
        push(a*b);
        break;
      case '/':
        push(a/b);
        break;
      }
    }
    else if(c[i]>='0'&&c[i]<='9'){
      a=0;
      for(;c[i]!=' ';i++){
        a=10*a+(c[i]-'0');
      }
      push(a);
    }
  }
  printf("%d\n",pop());
  return 0;
}


Measured memory_bytes: 2052
#include <cmath>
#include <iostream>
#include <cstdio>
#include <ctype.h>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <iomanip>
#include <set>
#include <stack>
#include <queue>
#include <vector>
#include <sstream>


using namespace std;


string reverse(string str)
{
	string ret = "";
	
	for (int i=str.length()-1; i>=0; i--)
	{
		ret += str[i];
	}
	
	return ret;
}


/*
指定したインデックスの文字を数値に直して返す関数。
インデックスが不正な場合は数値0を返す。
*/
int new_at(string str, int index)
{
	stringstream ss;
	int ret;
	
	if (index >= str.length())
	{
		return 0;
	} else {
		ss << str[index];
		ss >> ret;
		
		return ret;
	}
}


int main()
{
	int n;
	int ia, ib;
	int flag = 0;	//繰り上がりのフラグ(繰り上がる場合は1)
	int num = 0;	//各桁の和
	
	string sa, sb;	//入力値
	string ra, rb;	//反転した入力値
	
	string sum = "";
	stringstream ss;
	int cnt;	//長いほうの文字数
	
	
	cin >> n;
	for (int i=0; i<n; i++)
	{
		cin >> sa >> sb;
		ra = reverse(sa);
		rb = reverse(sb);
		//cout << "ra = " << ra << " : rb = " << rb << endl;
		
		cnt = (ra.length() > rb.length()) ? ra.length() : sb.length();
		//cout << "cnt = " << cnt << endl;
		
		for (int j=0; j<cnt; j++)
		{
			num += new_at(ra, j) + new_at(rb, j);
			if (flag) num++;
			//cout << "(j=" << j << ") : num = " << num << endl;
			
			if (num >= 10)
			{
				num = num - 10;
				ss << num;
				sum += ss.str();
				num = 0;
				flag = 1;
			} else {
				ss << num;
				sum += ss.str();
				num = 0;
				flag = 0;
			}
			
			ss.str("");
			
			//cout << "(j=" << j << ") : sum = " << sum << endl;
		}
		
		if (flag)
		{
			sum += "1";
			flag = 0;
		}
		
		if (sum.length() > 80)
		{
			cout << "overflow" << endl;
		} else {
			//cout << "sum = " << reverse(sum) << endl;
			cout << reverse(sum) << endl;
		}
		
		sum = "";
		num = 0;
		//cout << "new_at = " << new_at(sa, 3) << endl;
		//cout << "sa = " << reverse(sa) << " : sb = " << reverse(sb) << endl;
		//cout << "sa[0] = " << sa[0] << " : sb[0] = " << sb[0] << endl;
	}
	
	return 0;
}

Measured memory_bytes: 1248
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<math.h>
using namespace std;
int main() {
	int N;	cin >> N;
	vector<long long> l(N + 1);
	l[0] = 2;
	l[1] = 1;
	for (int i = 2; i <= N; ++i) {
		l[i] = l[i - 1] + l[i - 2];
	}
	cout << l[N] << endl;
	cin >> N;
	return 0;
}

Measured memory_bytes: 256
n=int(input())
t=[int(input())for i in range(n)]
def gcd(a,b):
    while b!=0:
        a,b=b,a%b
    return a
def lcm(a,b):
    return a*b//gcd(a,b)
ans=1
for i in range(n):
    ans=lcm(ans,t[i])
print(int(ans))



Measured memory_bytes: 3060
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long a = sc.nextLong();
		String b = sc.next();
		sc.close();
		int bInt = Integer.valueOf(b.replace(".", ""));
		System.out.println(a*bInt/100);

	}

}

Measured memory_bytes: 35700
#include <bits/stdc++.h>
#define rep(i,a,b) for(auto i=(a);i<(b);i++)
#define per(i,a,b) for(auto i=(a);i>=(b);i--)
#define Min(a,b) ((a) < (b) ? (a) : (b))
#define Max(a,b) ((a) > (b) ? (a) : (b))
#define int_inf 0x3f3f3f3f
#define int_max 2147483647
#define ll_max 9223372036854775807
#define ull_max 18446744073709551615
#define ll_inf 0x7f7f7f7f7f7f7f7f
#define lowbit(x) (x)&(-x)
#define mp make_pair
#define fi first
#define se second
#define pb push_back
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
const ll mod=1e9+7;
template<class T>
inline T read()
{
	T x=0,f=1;char s=getchar();
	while(s<'0'||s>'9') {if(s=='-')f=-1;s=getchar();};
	while(s>='0'&&s<='9'){x=(x<<3)+(x<<1)+s-48;s=getchar();};
	return x*f;
}
template<typename T>
inline void wri(T x)
{
	if(x<0){x=-x;putchar('-');};
	if(x/10) wri(x/10);
	putchar(x%10+48);
}
template<typename T>
inline void print(T x,char s)
{
	wri(x);
	putchar(s);
}
template<typename T>
T gcd(T a,T b)
{
	return b==0?a:gcd(b,a%b);
}
//关闭流同步就不能手写读入优化啦
int n,k;
int vis[110]; 
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0),cout.tie(0);
    cin>>n>>k;
    rep(i,1,k+1){
    	int x;
    	cin>>x;
    	while(x--){
    		int y;
    		cin>>y;
    		vis[y]=1;
		}
	}
	int cnt=0;
	rep(i,1,n+1){
		if(!vis[i])cnt++;
	}
	cout<<cnt;
    return 0;
}


Measured memory_bytes: 3644
S = input()
if S[0] != 'A':
    print("WA")
elif ord(S[1]) < 97:
    print('WA')
elif ord(S[-1]) < 97:
    print("WA")
else:
    cnt = 0
    for i in range(1, len(S)-1):
        if S[i] == 'C':
            cnt += 1
    if cnt == 1:
        print("AC")
    else:
        print("WA")

Measured memory_bytes: 3060
#include <iostream>
using namespace std;
int main(){
  int Q, N;
  cin >> Q;
  while(Q--){
    cin >> N;

    int count = 0;
    while(N >= 10){
      count++;
      int best = 0;
      int p = 1;
      while(p < N){
        best = max(best, (N % p) * (N / p));
        p *= 10;
      }
      N = best;
    }
    cout << count << endl;
  }
}

Measured memory_bytes: 1160
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);

    int N = scanner.nextInt();
    int M = scanner.nextInt();
    Node[] nodes = new Node[N];
    for (int i = 0; i < N; i++) nodes[i] = new Node();

    for (int i = 0; i < M; i++) {
      int x = scanner.nextInt() - 1;
      int y = scanner.nextInt() - 1;
      int z = scanner.nextInt();
      nodes[x].neighbors.add(nodes[y]);
      nodes[y].neighbors.add(nodes[x]);
    }

    int cost = 0;
    for (int i = 0; i < N; i++) {
      if (!nodes[i].visited) {
        dfs(nodes[i]);
        cost++;
      }
    }
    System.out.println(cost);
  }

  private static void dfs(Node node) {
    node.visited = true;
    for (Node n : node.neighbors) {
      if (!n.visited) dfs(n);
    }
  }

  private static class Node {
    List<Node> neighbors = new ArrayList<>();
    boolean visited;
  }
}


Measured memory_bytes: 111276
#include <algorithm>
#include <cassert>
#include <iostream>
#include <vector>
using namespace std;

const char ANIMALS[2] = {'S', 'W'};

int N;
string S;

bool consistent(char claim, char first, char middle, char second) {
    if (claim == 'o' ^ middle == ANIMALS[0])
        return first != second;
    else
        return first == second;
}

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

    cin >> N >> S;
    string answer(N, '.');

    for (int first = 0; first < 2; first++)
        for (int second = 0; second < 2; second++) {
            answer[0] = ANIMALS[first];
            answer[1] = ANIMALS[second];

            for (int i = 1; i < N - 1; i++) {
                bool different = (answer[i] == ANIMALS[0]) ^ (S[i] == 'o');
                answer[i + 1] = different ? ANIMALS[0] + ANIMALS[1] - answer[i - 1] : answer[i - 1];
            }

            if (consistent(S[0], answer[N - 1], answer[0], answer[1]) && consistent(S[N - 1], answer[N - 2], answer[N - 1], answer[0])) {
                cout << answer << '\n';
                return 0;
            }
        }

    cout << -1 << '\n';
}


Measured memory_bytes: 640
#include<iostream>
#include<vector>
#include<stack>
#include<algorithm>
#include<string>
#include<set>
#include<numeric>
#include<functional>
#include<unordered_map>
#include<cmath>
#include<cstdlib>

std::string solve(std::string s1, std::string s2, std::string s3) {
	std::string ans = "";
	ans += s1[0];
	ans += s2[0];
	ans += s3[0];
	std::transform(ans.begin(), ans.end(), ans.begin(), toupper);
	return ans;
}

int main()
{
	std::string s1, s2, s3;
	std::cin >> s1 >> s2 >> s3;
	std::cout << solve(s1, s2, s3) << std::endl;
	int wait; std::cin >> wait;
}


Measured memory_bytes: 256
a = []

def dfs(n):
    if n > 3234566667:
        return

    a.append(n)
    for i in range(10):
        if abs(n%10 - i) <= 1:
            dfs(n*10+i)

for i in range(1, 10):
    dfs(i)

k = int(input())
a = sorted(a)
print(a[k-1])


Measured memory_bytes: 8512
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
using namespace std;

int main() {
	int a[5];
	int b[5];
	while (cin >> a[1] >> a[2] >> a[3] >> a[4] >> b[1] >> b[2] >> b[3] >> b[4]) {
		int hit = 0, blow = 0;
		for (int i = 1; i <= 4; i++) {
			if (a[i] == b[i]) {
				hit++;
			}
		}
		for (int i = 1; i <= 4; i++) {
			for (int j = 1; j <= 4; j++) {
				if (a[i] == b[j] && i != j) {
					blow++;
				}
			}
		}
		cout << hit << " " << blow << endl;
	}
}

Measured memory_bytes: 3056
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll mod = 1000000007;

ll r(ll x, ll y) {
  if (y == 0) return 1;
  else if (y % 2 == 0) return r(x, y/2) * r(x, y/2) % mod;
  else return x * r(x, (y-1)/2) % mod * r(x, (y-1)/2) % mod;
}

int n, m, q;
ll ans;
vector<int> a, b, c, d;
void dfs(vector<int> A) {
  if (A.size() == n+1) {
    ll sum = 0;
    for (int i = 0; i < q; i++) {
      if (A[b[i]] - A[a[i]] == c[i]) sum += d[i];
    }
    ans = max(ans, sum);
    return;
  }
  
  A.push_back(A.back());
  while (A.back() <= m) {
    dfs(A);
    A.back()++;
  }
}


int main() {
  cin >> n >> m >> q;
  a = b = c = d = vector<int>(q);
  for (int i = 0; i < q; i++) {
    cin >> a[i] >> b[i] >> c[i] >> d[i];
  }
  dfs(vector<int> (1, 1));
  cout << ans <<endl;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
#define int long long
// Big two primes
#define X 1001100011100001111ll
#define ll long long
#define all(a) a.begin(),a.end()
#define sortall(a) sort(all(a))
#define fo(i, n) for (int i = 0; i < n; i++)
#define fo1(i, n) for (int i = 1; i <= n; i++)
#define loop(i,a,b) for (int i = a; i < b; i++)
#define nloop(i,a,b) for (int i = a ; i>=b;i--)
#define tc(t) int t; cin >> t; while (t--)
#define arrip(n)  int a[n]; fo(i, n) cin >> a[i];
#define arrop(n)  fo(i,n) cout<<a[i]<<" ";
#define pb push_back
#define mp make_pair
#define itr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define PI 3.1415926535897932384626

#define fio ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL)
#define rr return 0
#define prec(n) fixed<<setprecision(n)
#define maxpq priority_queue<int>
#define minpq priority_queue<int, vector<int>, greater<int> >
#define inf (int)(1e18)
#define ini(a, i) memset(a, i, sizeof(a))
#define vi vector<int>
#define fi first
#define se second
#define endl "\n"
#define pi pair<int, int>
#define vpi vector<pi>
#define sz(s) s.size()
#define bits(n) __builtin_popcount(n)//Count set bits

const int MAXN = (int)((1e5) + 100);
int gcd(int a, int b) { if (a == 0) return b; return gcd(b % a, a);}
int max(int a, int b) {if (a > b) return a; else return b;}
int min(int a, int b) {if (a < b) return a; else return b;}





int32_t main()
{
#ifndef ONLINE_JUDGE
	freopen("atcoderi.txt", "r", stdin);
	freopen("atcodero.txt", "w", stdout);
#endif
	fio;


	int a, b;
	cin >> a >> b;
	int res = -1;
	for (int i = 1; i < 3000; i++)
	{
		//cout << i << endl;
		double s1 = floor(i * 0.08);
		//cout << s1 << endl;
		double s2 = floor(i * 0.1);
		//cout << s2 << endl;
		if (s1 == a && s2 == b) {
			res = i;
			break;
		}
	}
	cout << res << endl;
}

Measured memory_bytes: 3656
// #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define REP(i, n) for (int i = 0; i < n; ++i)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x) cout << #x << ' ' << '=' << ' ' << (x) << endl;
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
typedef long long ll;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> T;
typedef vector<ll> vec;
typedef vector<P> pvec;
typedef vector<vector<ll>> vvec;
typedef vector<vector<P>> pvvec;
typedef priority_queue<ll> PQI;
typedef priority_queue<P> PQP;
typedef priority_queue<ll,vector<ll>,greater<ll>> PQIG;
typedef priority_queue<P,vector<P>,greater<P>> PQPG;
const vector<int> dx = {0, -1, 0, 1, 1, 1, -1, -1};
const vector<int> dy = {1, 0, -1, 0, 1, -1, 1, -1};
const int MOD = (1000000007);
// const int MOD = (998244353);
// const int INF = (1 << 30);
const int INF = (1LL << 60);
const double EPS = (1 >> 30);
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return 1;} return 0;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return 1;} return 0;}
template< typename T1, typename T2 > istream &operator>>(istream &is, pair< T1, T2 > &p) { is >> p.first >> p.second; return is; }
template< typename T > istream &operator>>(istream &is, vector< T > &v) { for(T &in : v) is >> in; return is; }



signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(15);
    //---------------------------------------------
    
    int w,h,n;
    cin>>w>>h>>n;
    vector<T> t(n);
    // cin>>t;
    rep(i,n){
        int g,h,j;
        cin>>g>>h>>j;
        t[i]=T(g,h,j);
    }
    int hu=h,hd=0;
    int wl=0,wr=w;
    rep(i,n){
        int x,y,a;
        tie(x,y,a)=t[i];
        if(a==2){
            chmin(wr,x);
        }
        else if(a==1){
            chmax(wl,x);
        }
        else if(a==4){
            chmin(hu,y);
        }
        else{
            chmax(hd,y);
        }
    }
    // cout<<wr<<wl<<hu<<hd<<endl;
    cout<<max(0LL,wr-wl)*max(0LL,hu-hd)<<endl;
    
}

Measured memory_bytes: 256
n = gets.chomp.to_i
a = gets.chomp.split(" ").map(&:to_i)#aは配列
result = a.map do |i|
  count = 0
  while i % 2 == 0 do
    i = i /2
    count += 1
  end
  count
end
#resultには[3,2,3]
puts(result.min)

Measured memory_bytes: 1788
#include <stdio.h>

int judge(char snake[256]){
  int count1, count2, i;
  if(snake[0] == '>' && snake[1] == '\''){
    count1 = count2 = 0;
    for(i = 2; snake[i] == '='; ++i) count1++;
    if(snake[i++] == '#'){
      for(; snake[i] == '='; ++i) count2++;
      if(snake[i] == '~' && count1 == count2 && count1 && count2) return 0;
    }
  }
  if(snake[0] == '>' && snake[1] == '^'){
    count1 = 0;
    for(i = 2; snake[i] == 'Q' && snake[i + 1] == '='; i += 2) count1++;
    if(count1 && snake[i] == '~' && snake[i + 1] == '~') return 1;
  }

  return 2;
}

int main(){
  int n, res;
  char in[258];

  scanf("%d", &n);
  while(n--){
    scanf("%s", in);
    res = judge(in);
    switch(res){
    case 0: puts("A"); break;
    case 1: puts("B"); break;
    case 2: puts("NA"); break;
    }
  }
  return 0;
}

Measured memory_bytes: 584
use std::io::Read;

fn run() {
    let mut s = String::new();
    std::io::stdin().read_to_string(&mut s).unwrap();
    let mut it = s.trim().split_whitespace();
    let n: usize = it.next().unwrap().parse().unwrap();
    let w: u32 = it.next().unwrap().parse().unwrap();
    let m = 1000 * n;
    let mut dp = vec![w + 1; m + 1];
    dp[0] = 0;
    for _ in 0..n {
        let w: u32 = it.next().unwrap().parse().unwrap();
        let v: usize = it.next().unwrap().parse().unwrap();
        for i in (v..(m + 1)).rev() {
            dp[i] = std::cmp::min(dp[i], dp[i - v] + w);
        }
    }
    let ans = dp.iter().rposition(|p| *p <= w).unwrap();
    println!("{}", ans);
}

fn main() {
    run();
}

Measured memory_bytes: 4352
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <limits.h>

int main(void)
{
	int k, n, min = INT_MAX;
	int arr[200000] = {
		0,
	};
	scanf("%d %d", &k, &n);

	for (int i = 0; i < n; i++)
	{
		scanf("%d", &arr[i]);
	}

	for (int i = 0; i < n - 1; i++)
	{
		int dist = arr[i + 1] - arr[i];
		min = (k - dist < min) ? k - dist : min;
	}

	min = (arr[n - 1] - arr[0] < min) ? arr[n - 1] - arr[0] : min;

	printf("%d", min);
	return 0;
}


Measured memory_bytes: 896