akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
#include <stack>
#include <set>
#include <bitset>
#include <functional>
#include <cassert>
using namespace std;
#define fast_io ios_base::sync_with_stdio (false) ; cin.tie(0) ; cout.tie(0) ;
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define MOD (long long int)(1e9+7)
#define INF (int)(1e9)
#define LINF (long long int)(1e18)
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
#define all(v) v.begin(), v.end()
typedef pair<int, int> Pii;
typedef pair<ll, ll> Pll;

ll mpow(ll a, ll b){
  if(b==0) return 1;
  else if(b%2==0){ll memo = mpow(a,b/2); return memo*memo%MOD;}
  else return mpow(a,b-1) * a % MOD;
}
ll lpow(ll a, ll b){
  if(b==0) return 1;
  else if(b%2==0){ll memo = lpow(a,b/2); return memo*memo;}
  else return lpow(a,b-1) * a;
}
ll gcd(ll a, ll b){
  if(b==0) return a;
  else return gcd(b, a%b);
}
vector<ll> kaijo_memo;
ll kaijo(ll n){
  if(kaijo_memo.size() > n) return kaijo_memo[n];
  if(kaijo_memo.size() == 0) kaijo_memo.push_back(1);
  while(kaijo_memo.size() <= n) kaijo_memo.push_back(kaijo_memo[kaijo_memo.size()-1] * kaijo_memo.size() % MOD);
  return kaijo_memo[n];
}
vector<ll> gyaku_kaijo_memo;
ll gyaku_kaijo(ll n){
  if(gyaku_kaijo_memo.size() > n) return gyaku_kaijo_memo[n];
  if(gyaku_kaijo_memo.size() == 0) gyaku_kaijo_memo.push_back(1);
  while(gyaku_kaijo_memo.size() <= n) gyaku_kaijo_memo.push_back(gyaku_kaijo_memo[gyaku_kaijo_memo.size()-1] * mpow(gyaku_kaijo_memo.size(), MOD-2) % MOD);
  return gyaku_kaijo_memo[n];
}

ll nCr(ll n, ll r){
  if(n == r) return 1;//0個の丸と-1個の棒みたいな時に時に効く？不安.
  if(n < r || r < 0) return 0;
  ll ret = 1;
  if(n <= 1e7){
    ret *= kaijo(n); ret %= MOD;
    ret *= gyaku_kaijo(r); ret %= MOD;
    ret *= gyaku_kaijo(n-r); ret %= MOD;
  }else{
    rep(i,r){
      ret *= n-i; ret %= MOD;
      ret *= mpow(r-i, MOD-2); ret %= MOD;
    }
  }
  return ret;
}

int main(void){
  fast_io
  cout<<fixed<<setprecision(15);

  int n;cin>>n;
  vector<ll> A(n),B(n);
  rep(i,n){
    cin>>A[i]>>B[i];
  }

  sort(all(A));
  sort(all(B));
  ll l = (n%2 == 1 ? A[n/2] : (A[n/2 - 1] + A[n/2]));
  ll r = (n%2 == 1 ? B[n/2] : (B[n/2 - 1] + B[n/2]));
  if(n%2 == 1){
    cout << (ll)r - (ll)l + 1 << endl;
  }else{
    cout << (r - l) + 1 << endl;
  }
  return 0;
}

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

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

	int n; cin >> n;
	string str; cin >> str;
	int red = 0;
	for (char e : str) {
		if (e == 'R')red++;
	}
	if (red > (n - red))cout << "Yes";
	else cout << "No";

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define MAXNUM 555555
#define MAXM 2111111
const int inf=1e9+7;
#define rep(i,start,end) for(int i=start;i<end;i++)
int first[MAXNUM];
struct edge{int next,ver,w;};
edge e[MAXM];
int nodenum,startnode, endnode,edgenum=2;
int q[MAXNUM], top, front;
int d[MAXNUM];
int cur[MAXNUM], isused[MAXNUM];
void addedge(int a,int b,int w)
{
    e[edgenum].ver=b,e[edgenum].next=first[a],e[edgenum].w=w;
    first[a]=edgenum++;
    e[edgenum].ver=a,e[edgenum].next=first[b],e[edgenum].w=0;
    first[b]=edgenum++;
}
bool bfs()
{
    memset(isused, 0, (nodenum+3)*sizeof(int));
    top = front = 0;
    q[top++] = startnode;
    d[startnode] = 0;
    isused[startnode] = 1;
    while (top != front)
    {
        int x = q[front++];
        for (int i = first[x]; i; i = e[i].next)
        {
            int k = e[i].ver;
            if (!isused[k] && e[i].w)
            {
                isused[k] = 1;
                d[k] = d[x] + 1;
                q[top++] = k;
            }
        }
    }
    return isused[endnode];
}
int dfs(int x, int a)
{
    if (x == endnode || a == 0)
        return a;
    int flow = 0, r;
    for (int &i = cur[x]; i; i = e[i].next)
    {
        int k = e[i].ver;
        if (d[x] + 1 == d[k] && (r = dfs(k, min(a, e[i].w))) > 0)
        {
            e[i].w -= r, e[i ^ 1].w += r;
            flow += r, a -= r;
            if (a == 0)
                break;
        }
    }
    return flow;
}
int dinic()
{
    int flow = 0;
    while (bfs())
    {
        rep(i, 1, nodenum + 1)
            cur[i] = first[i];
        flow += dfs(startnode, inf);
    }
    return flow;
}
int pp[MAXNUM],qq[MAXNUM],isused1[MAXNUM],isused2[MAXNUM];
int main()
{
    int n;scanf("%d",&n);
    rep(i,1,n+1)scanf("%d",&pp[i]),pp[i]++;
    rep(i,1,n+1)scanf("%d",&qq[i]),qq[i]++;
    nodenum=n*2;
    rep(i,1,n+1)if(!isused1[i])
    {
        int now=i;nodenum++;
        do{
            addedge(now,nodenum,inf),addedge(nodenum,now,inf),isused1[now]=1;
            now=pp[now];
        }while(now!=i);
    }
    rep(i,1,n+1)if(!isused2[i])
        {
            int now=i;nodenum++;
            do{
                addedge(now+n,nodenum,inf),addedge(nodenum,now+n,inf),isused2[now]=1;
                now=qq[now];
            }while(now!=i);
        }
    nodenum+=2,startnode=nodenum,endnode=nodenum-1;
    int sum=n;
    rep(i,1,n+1)
    {
        if(pp[i]==i&&qq[i]==i)
            sum--;
        else if(pp[i]==i)
            addedge(i+n,endnode,1);
        else if(qq[i]==i)
            addedge(startnode,i,1);
        else {
            if (pp[i] != qq[i])
                addedge(i+n, i, 1);
            else addedge(i, i + n, 1), addedge(i + n, i, 1);
        }
    }
    printf("%d\n",sum-dinic());
}

Measured memory_bytes: 37760
// SeeAlso: https://atcoder.jp/contests/abc144/tasks/abc144_d

#include <bits/stdc++.h>

using namespace std;

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

#define MAX 100000
#define NIL -1
#define MOD 1000000007

typedef int _loop_int;
#define rep(i,n) for(ll i = 1; i <= n; i++)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define debug(x) cout<<#x<<": "<<x<<endl
#define debig_vec(v) cout<<#v<<":";rep(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

// 最大公約数
inline constexpr ll gcd(ll a,ll b){if(!a||!b)return 0;while(b){ll c=b;b=a%b;a=c;}return a;}
// 最小公倍数
inline constexpr ll lcm(ll a,ll b){if(!a||!b)return 0;return a*b/gcd(a,b);}

#define print2D(h, w, arr) rep(i, h) { rep(j, w) cout << arr[i][j] << " "; cout << endl; }
template<class T> void print(const T& x){cout << setprecision(12) << x << endl;}
template<class T, class... A> void print(const T& first, const A&... rest) { cout << first << " "; print(rest...); }

const long double PI = acos(-1);

int main() {
    double a, b;
    double x, rad;
    cin >> a >> b >> x;

    double s = x / a;

    if(s>a*b/2) {
        double h = ((a * b - s) * 2) / a;
        rad = atan2(h, a);
    } else {
        double w = (2 * s) / b;
        rad = atan2(b, w);
    }
    double ans = rad/(2*PI)*360;
    print(ans);
    return 0;
}


Measured memory_bytes: 384
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner();
		int t = sc.nextInt();
		int x= sc.nextInt();
		
		System.out.println(t / (double)x);
	}
}

class Scanner {
	private static final int SPACE = (int)' ';
	private static final int LINE_END_0 = 13;
	private static final int LINE_END_1 = 10;
	private static final int BEFORE = -1;
	private BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	
	public String next(){
		StringBuilder sb = new StringBuilder();
		
		int length = BEFORE;
		readLoop: while(true) {
			try {
				int value = br.read();
				switch(value) {
				case LINE_END_1:
					if(length == BEFORE)
						break;
					
					if((int)sb.charAt(length) == LINE_END_0)
						sb.deleteCharAt(length);
				case SPACE:
					break readLoop;
				}
				sb.append((char)value);
				length++;

			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
		return sb.toString();
	}
	
	public String[] nextArray(int length) {
		String[] array = new String[length];
		for(int i = 0; i < length; i++)
			array[i] = next();
		return array;
	}
	
	public double nextDouble() {
		return Double.parseDouble(next());
	}
	
	public double[] nextDoubleArray(int length) {
		double[] array = new double[length];
		for(int i = 0; i < length; i++)
			array[i] = nextDouble();
		return array;
	}
	
	public int nextInt() {
		return Integer.parseInt(next());
	}
	
	public int[] nextIntArray(int length) {
		int[] array = new int[length];
		for(int i = 0; i < length; i++)
			array[i] = nextInt();
		return array;
	}
	
	public long nextLong() {
		return Long.parseLong(next());
	}
	
	public long[] nextLongArray(int length) {
		long[] array = new long[length];
		for(int i = 0; i < length; i++)
			array[i] = nextLong();
		return array;
	}
	
	public boolean ready() {
		try {
			return br.ready();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return false;
	}
}


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

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

int main() {

    int h, w;

    for ( ;; ) {

        std::cin >> h >> w;

        if ( h == 0 && w == 0 ) break;

        REP(i, h) {

            REP(j, w) {

                ( i + j ) % 2 == 0
                ? std::cout << "#"
                : std::cout << "." ;
            }

            std::cout << std::endl;
        }

        std::cout << std::endl;

    }

    return 0;

}



Measured memory_bytes: 3088
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <queue>
#include <stack>
#include <set>
#include <algorithm>
#include <cmath>
#include <iterator>
#include <numeric>
#include <iomanip>
#define FI first
#define SE second
#define EB emplace_back
#define MP make_pair
#define REP(i, n) for (ll i = 0; i < n; i++)
#define INF 1100000000
#define LLINF 1100000000000000000LL
#define Decimal fixed << setprecision(20)
#define ALL(c) c.begin(),c.end()
#define SHOWVEC(v, sz) for(int i = 0; i < sz; i++) cerr << v[i] << ' '; cerr << endl;
#define SHOWX(x) cerr << #x << ": " << x << endl;
#define SHOWP(p) cerr << "[" << p.first << ',' << p.second << "]";

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

struct Segment {
  ll start;
  ll end;
  Segment(ll x, ll y): start(x), end(y) { }
};

int main()
{
  int N;
  cin >> N;
  vector<Segment> v;
  for (int i = 0; i < N; i++) {
    ll X, L;
    cin >> X >> L;
    v.push_back(Segment(X - L, X + L));
  }

  // Interval Scheduling
  sort(v.begin(), v.end(), [](Segment a, Segment b) {
    return a.end < b.end;
  });
  int ans = 0;
  ll t = -LLINF;
  for (int i = 0; i < N; i++) {
    if (v[i].start < t) continue;
    ans++;
    t = v[i].end;
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 2420
import math
from collections import deque
def main():
    n = int(input())
    a = [int(t)for t in input().split()]
    a_rev = a[::-1]

    cusum = [a[0]]
    rcusum = [a_rev[0]]

    for i in range(1,n):
        cusum.append(cusum[i-1]+a[i])
        rcusum.append(rcusum[i-1]+a_rev[i])
    
    rcusum = rcusum[::-1]

    result = []

    for i in range(1,n):
        result.append(abs(cusum[i-1]-rcusum[i]))

    print(min(result))

if __name__ == "__main__":
    main()

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

int main() {
  string S, T;
  cin >> S >> T;
  bool Flag = false;
  if (S.size() + 1 == T.size()) {
    for (int i = 0; i < S.size(); i++) {
       if (S.at(i) == T.at(i)) {
         if (i == S.size()-1) Flag = true;
         continue;
       }
       else {
         break;
       }
    }
  }
  
  Flag ? cout << "Yes" << endl : cout << "No" << endl;
}

Measured memory_bytes: 3600
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define uli unsigned long long int
#define INF 999999999999999999
#define rep(i,m,n) for(lli i = m;i < n;i++)
#define rrep(i,m,n) for(lli i=m-1;i>=n;i--)
#define pb(n) push_back(n)
#define UE(N) N.erase(unique(N.begin(),N.end()),N.end());
#define Sort(n) sort(n.begin(), n.end())
#define Rev(n) reverse(n.begin(),n.end())
#define Out(S) cout << S << endl
#define NeOut(S) cout << S
#define HpOut(S) cout << setprecision(25) << S << endl
#define Vec(K,L,N,S) vector<L> K(N,S)
#define DV(K,L,N,M,S) vector<vector<L>> K(N,vector<L>(M,S))
#define TV(K,L,N,M,R,S) vector<vector<vector<L>>> K(N,vector<vector<L>>(M,vector<L>(R,S)))
#define pint pair<lli,lli>
#define paf(L,R) pair<L,R>
#define mod 1000000007
#define MAX 5100000
#define ALL(a)  a.begin(),a.end()
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  lli A,B,C,D,E,F,N,M,K,L,R,X,Y,Z,H,W,sum=0,num=0,flag=0;string S,T;
  while(1){
    cin >> N >> X;
    if(N==0&&X==0)break;
    sum=0;
    rep(i,1,N+1)rep(j,i+1,N+1)rep(k,j+1,N+1)if(i+j+k==X)sum++;
    Out(sum);
  }
}


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

using namespace std;
const static int INT_INF = 2147483647;
const static int MOD_NUM = 1000000007;
static int ans_vec[100010] = { 0 };
int vec[100010] = { 0 };

int main()
{
	int n, m;
	cin >> n >> m;
	for (size_t i = 0; i < m; i++)
	{
		cin >> vec[i];
	}

	bool reachable = true;
	for (size_t i = 0; i < m - 1; i++)
	{
		if (m == 0) break;
		if (vec[i + 1] - vec[i] == 1) reachable = false;
	}

	if (reachable) {
		int index = 0;
		ans_vec[0] = 1;
		if (vec[0] == 1) {
			index++;
			ans_vec[1] = 0;
		}
		else {
			ans_vec[1] = 1;
		}


		for (size_t i = 2; i <= n; i++)
		{
			if (vec[index] == i) {
				index = index + 1;
				if (index > 100010 - 1) index = 100010 - 1;
				ans_vec[i] = 0;
			}
			else {
				ans_vec[i] = ans_vec[i - 1] + ans_vec[i - 2];
				if (ans_vec[i] > MOD_NUM) ans_vec[i] %= MOD_NUM;
			}
		}
		cout << ans_vec[n] << endl;
	}
	else {
		cout << 0 << endl;
	}
	return 0;
}

Measured memory_bytes: 768
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0;i<(n);++i)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define all(x) (x).begin(), (x).end()
#define PI 3.14159265358979323846264338327950L
using namespace std;
typedef long long ll;
typedef long double ld;
int main() {
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    while(1){
        c-=b;
        if(c<=0){
            cout<<"Yes"<<endl;
            return 0;
        }
        a-=d;
        if(a<=0){
            cout<<"No"<<endl;
            return 0;
        }
    }
}

Measured memory_bytes: 3608
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();
      if(a % b == 0) {
        System.out.println(0);
      } else {
        System.out.println(1);
      }
    }
}

Measured memory_bytes: 21716
import java.util.*;

class Main {
    public static void main(String[] args) {
        final Scanner sc = new Scanner(System.in);
        final int X = Integer.parseInt(sc.next());
        sc.close();

        boolean f = false;
        if (X<100) {
            System.out.println("0");
        } else {
            outside : for (int i=0; i<=100000/100; i++) {
                if (X<i*100)
                    break;
            for (int j=0; j<=100000/101; j++) {
                if (X<i*100+j*101)
                    break;
            for (int k=0; k<=100000/102; k++) {
                if (X<i*100+j*101+k*102)
                    break;
            for (int l=0; l<=100000/103; l++) {
                if (X<i*100+j*101+k*102+l*103)
                    break;
            for (int m=0; m<=100000/104; m++) {
                if (X<i*100+j*101+k*102+l*103+m*104)
                    break;
            for (int n=0; n<=100000/105; n++) {
                int Y = i*100+j*101+k*102+l*103+m*104+n*105;
                if (X==Y) {
                    f=true;
                    break outside;
                } else if (X<Y) {
                    break;
                }
            }}}}}}
            if (f) {
                System.out.println("1");
            } else {
                System.out.println("0");
            }
        }
    }
}


Measured memory_bytes: 21844
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define MAX 500000
struct Node{
  int key;
  struct Node *parent;
  struct Node *left;
  struct Node *right;
};
struct Node *root, *NIL;
void inorder(struct Node *);
void preorder(struct Node *);
void insert(int );
int main(){
  int i,j,n,notes;
  char com[10];

  scanf("%d",&n);
  for(i=0;i<n;i++){
      scanf("%s",com);
      if(strcmp(com,"insert")==0){
      scanf("%d",&notes);
      insert(notes);
    }
      else if(strcmp(com,"print")==0){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    }
  }
  return 0;
}

void inorder(struct Node *u){
  if(u==NIL) return;
  inorder(u->left);
  printf(" %d", u->key);
  inorder(u->right);
}

void preorder(struct Node *u){
  if(u==NIL) return;
  printf(" %d", u->key);
  preorder(u->left);
  preorder(u->right);
}
  
void insert(int k){
  //printf("insert ok!\n");
  struct Node *y=NIL;
  struct Node *x=root;
  struct Node *z;
  z=(struct Node *)malloc(sizeof(struct Node));
  z->key=k;
  z->left=NIL;
  z->right=NIL;
  
  while(x!=NIL){
    y=x;
    if(z->key<x->key){
      x=x->left;
    }
    else{
      x=x->right;
    }
  }
  z->parent=y;
  if(y==NIL){
    root=z;
  }
  else if(z->key<y->key){
    y->left=z;
  }
  else{
    y->right=z;
  }
}



Measured memory_bytes: 25204
import java.io.PrintWriter
val pw = PrintWriter(System.out)

fun main(args : Array<String>) {
    func()
    pw.flush()
}

fun func() {
    val (n, m) = listOfInt()
    val ppl = mutableListOf<Pair<Int, Int>>()
    val ppt = mutableListOf<Pair<Int, Int>>()
    val ans = mutableListOf<Int>()

    repeat(n) {
        val (a, b) = listOfInt()
        ppl.add(Pair(a, b))
    }

    repeat(m) {
        val (c, d) = listOfInt()
        ppt.add(Pair(c, d))
    }

    for (i in 0 until n) {
        var min = Int.MAX_VALUE
        ans.add(-1)
        for (j in 0 until m) {
            val dis = Math.abs(ppl[i].first - ppt[j].first) + Math.abs(ppl[i].second - ppt[j].second)
            if (dis < min) {
                min = dis
                ans[i] = j + 1
            }
        }
    }

    ans.forEach(::println)
}

fun next() = readLine()!!
fun listOfString() = next().split(" ")
fun listOfInt() = listOfString().map { it.toInt() }

fun println(value : Any) {
    pw.println(value)
}

Measured memory_bytes: 37832
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<algorithm>
#include<functional>
typedef long long ll;
int main() {
	ll n = 0,ans = 0;
	ll charf[5] = {};
	std::map<std::string, ll> m;
	std::string s,s_head;
	//10通りのそれぞれの場合
	int P[10] = { 0,0,0,0,0,0,1,1,1,2 }; 
	int Q[10] = { 1,1,1,2,2,3,2,2,3,3 }; 
	int R[10] = { 2,3,4,3,4,4,3,4,4,4 };
	std::cin >> n;
	for (int i = 0; i < n; i++) {
		std::cin >> s;
		s_head = s.front();
		m[s_head]++;
	}
	//ここでcharfに数をコピーしておく
	charf[0] = m["M"];
	charf[1] = m["A"];
	charf[2] = m["R"];
	charf[3] = m["C"];
	charf[4] = m["H"];
	for (int i = 0; i < 10; i++) {
		ans += charf[P[i]] * charf[Q[i]] * charf[R[i]];
	}
	std::cout << ans << std::endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <math.h>
#include <queue>

using namespace std;

int main(){

	int a_1_h,a_1_m,a_1_s,a_2_h,a_2_m,a_2_s,b_1_h,b_1_m,b_1_s,b_2_h,b_2_m,b_2_s,c_1_h,c_1_m,c_1_s,c_2_h,c_2_m,c_2_s;
	int A,B,C;

	scanf("%d %d %d %d %d %d",&a_1_h,&a_1_m,&a_1_s,&a_2_h,&a_2_m,&a_2_s);
	scanf("%d %d %d %d %d %d",&b_1_h,&b_1_m,&b_1_s,&b_2_h,&b_2_m,&b_2_s);
	scanf("%d %d %d %d %d %d",&c_1_h,&c_1_m,&c_1_s,&c_2_h,&c_2_m,&c_2_s);

	A = (3600*a_2_h+60*a_2_m+a_2_s) - (3600*a_1_h+60*a_1_m+a_1_s);
	B = (3600*b_2_h+60*b_2_m+b_2_s) - (3600*b_1_h+60*b_1_m+b_1_s);
	C = (3600*c_2_h+60*c_2_m+c_2_s) - (3600*c_1_h+60*c_1_m+c_1_s);

	printf("%d %d %d\n",A/3600,(A%3600)/60,A%60);
	printf("%d %d %d\n",B/3600,(B%3600)/60,B%60);
	printf("%d %d %d\n",C/3600,(C%3600)/60,C%60);

    return 0;
}

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

using namespace std;

int main() {
    int n;
    cin >> n;
    vector<long long> a(n + 1);
    for (int i = 0; i <= n; ++i)
        cin >> a[i];
    vector<long long> b = a;
    for (int i = n - 1; i >= 0; --i) {
        b[i] += b[i + 1];
    }
    if (a[0] > 1 || b[0] == 0) {
        cout << "-1\n";
        return 0;
    }
    b[0] = 1;
    bool fail = false;
    for (int i = 1; i <= n; ++i) {
        b[i] = min(2 * (b[i - 1] - a[i - 1]), b[i]);
        if (b[i] < a[i]) {
            fail = true;
            break;
        }
    }
    if (fail) {
        cout << "-1\n";
    } else {
        cout << accumulate(b.begin(), b.end(), 0LL) << "\n";
    }
    return 0;
}


Measured memory_bytes: 4844
#include<cstdio>

static const int tMax = 510;

int C[tMax], F[tMax];
long int S[tMax];
int N;

long int TimeUntilDestination(int station_id, long int time){
	if(station_id == N)
		return time;
	if(time <= S[station_id])
		return TimeUntilDestination(station_id + 1, S[station_id] + C[station_id]);
	return time % F[station_id] ? TimeUntilDestination(station_id + 1, F[station_id] * (time / F[station_id] + 1) + C[station_id]) : TimeUntilDestination(station_id + 1, time + C[station_id]);
}

int main(){
	scanf("%d", &N);
	for (int i = 1; i < N; ++i)
		scanf("%d %ld %d", &C[i], &S[i], &F[i]);
	for (int i = 1; i <= N; ++i)
		printf("%ld\n", TimeUntilDestination(i, 0));
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i = 0; i < (N); i++)
#define repo(i,N) for(int i = 1; i < (N); i++)
//#define int long long
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
//#define num 1000000007
#define pi acos(-1.0)
//cout << fixed << setprecision (10);   小数点以下１０桁まで
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//'大文字'+=32;    で小文字に
//string s = to_string(int数);
//int n = stoi(string文字列);

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

  int ans=0;
  
  rep(i,4) {
    if(a[i]=='2') ans++;
  }
  
  cout << ans <<endl;
  
}

Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <vector>
#include <cmath>
#include <string>
#include <cstring>
#include <algorithm>
#include <climits>
#include <stack>
#include <queue>
#include <set>
#include <cctype>
#include <bitset>
#include <type_traits>

#include <list>
using namespace std;

#define REP(i, n) for (int i = 0; i < (n); ++i)
#define rep(i, a, b) for (int i = a; i < (b); ++i)
#define YES(j) cout << (j ? "YES" : "NO") << endl;
#define Yes(j) std::cout << (j ? "Yes" : "No") << endl;

int n;
string s;
set<int> st[26];

int main(void)
{
    cin >> n;
    cin >> s;
    REP(i, s.length())
    {
        int num = s[i] - 'a';
        st[num].insert(i + 1);
    }

    int q;
    cin >> q;
    REP(i, q)
    {
        int qry;
        cin >> qry;
        if (qry == 1)
        {
            int pos;
            char chr;
            cin >> pos >> chr;
            int ref = chr - 'a';
            int prev;

            st[s[pos - 1] - 'a'].erase(pos);
            s[pos - 1] = chr;
            st[chr - 'a'].insert(pos);
            /*
            if (st[ref].find(pos) == st[ref].end())
            {
                REP(i, 26)
                {
                    if (st[i].find(pos) != st[i].end())
                    {
                        st[i].erase(pos);
                        break;
                    }
                }
                st[ref].insert(pos);
            }
            */
        }
        else
        {
            int l, r;
            cin >> l >> r;
            int cnt = 0;
            REP(i, 26)
            {
                if (st[i].lower_bound(l) != st[i].end())
                {
                    int pos = *st[i].lower_bound(l);
                    if (l <= pos && pos <= r)
                    {
                        cnt++;
                    }
                }
                /*
                auto itr = lower_bound(st[i].begin(), st[i].end(), l);
                if (itr != st[i].end())
                {
                    int pos = *itr;
                    if (l <= pos && pos <= r)
                    {
                        cnt++;
                    }
                }
                */
            }
            cout << cnt << endl;
        }
    }
}

Measured memory_bytes: 24196
import numpy as np
from math import ceil, floor
 
n = int(input())
l = [int(x) for x in input().split()]
 
c = ceil(np.array(l).mean())
f = floor(np.array(l).mean())

print(min(sum([(x-c)**2 for x in l]), sum([(x-f)**2 for x in l])))

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

#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
using namespace std;

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


Measured memory_bytes: 3640
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>

using namespace std;

int main(){
	
	int n;
	
	int a, b;
	
	cin >> n;
	
	for(int loop = 0; loop < n; loop++){
		cin >> a >> b;
		if(a == b){
			printf("%d\n", b);
		}else if(a < b){
			for(int i = a; i < b; i++){
				printf("%d ", i);
			}
			printf("%d\n", b);
		}else if(a <= 5){
			for(int i = a; i > b; i--){
				printf("%d ", i);
			}
			printf("%d\n", b);
		}else if(b <= 5){
			for(int i = a; i <= 9; i++){
				printf("%d ", i);
			}
			for(int i = 5; i > b; i--){
				printf("%d ", i);
			}
			printf("%d\n", b);
		}else{
			for(int i = a; i <= 9; i++){
				printf("%d ", i);
			}
			printf("5 4 3 2 1 0 1 2 3 4 5 ");
			for(int i = 6; i < b; i++){
				printf("%d ", i);
			}
			printf("%d\n", b);
		}
	}
	
	return 0;
}

Measured memory_bytes: 1148
// Problem : B - String Palindrome
// Contest : AtCoder Beginner Contest 159
// URL : https://atcoder.jp/contests/abc159/tasks/abc159_b
// Memory Limit : 1024 MB
// Time Limit : 2000 ms

#include<bits/stdc++.h>
using namespace std ;

#define int         long long int
#define all(a)      (a).begin(),(a).end()
#define f           first
#define s           second
#define endl        '\n'
#define MOD         1000000007

bool isPalin(string s)
{
	int n = s.length() ;
	for(int i = 0 ; i < n/2 ; i++)
	{
		if(s[i] != s[n - i - 1])
			return false ;
	}
	return true ;
}
void solve()
{
	string s ;
	cin >> s ;
	if(isPalin(s))
	{
		int n = s.length() ;
		int one = (n-1)/2, other = (n + 3)/2 ;
		string sone, soth ;
		for(int i = 0 ; i < one ; i++)
			sone += s[i] ;
		for(int i = other - 1 ; i < n ; i++)
			soth += s[i] ;
		if(isPalin(sone) and isPalin(soth))
		{
			cout << "Yes" ;
			return ;
		}
	}
	cout << "No" ;
}

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

    int t = 1 ;
    //cin >> t ;
    while(t--)
    {
        solve() ;
    }
    return 0 ;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     @hamayanhamayan0
　　　　／　　　＼　 　  |　|
　　　 /　　 /￣￣￣￣/　　|
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿
　 　　　＼/＿＿＿＿/　（u　⊃
---------------------------------------------------------------------------------------------------*/














int N; ll A[2010];
ll dp[2020][2020];
//---------------------------------------------------------------------------------------------------
void _main() {
	cin >> N;
	rep(i, 0, N) cin >> A[i];

	vector<int> ord;
	rep(i, 0, N) ord.push_back(i);
	sort(all(ord), [&](int a, int b) { return A[a] > A[b]; });

	rep(tot, 0, N + 1) rep(lft, 0, N + 1) dp[tot][lft] = -inf;
	dp[0][0] = 0;

	rep(tot, 0, N) rep(lft, 0, tot + 1) if(0 <= dp[tot][lft]) {
		int i = ord[tot];

		if (0 <= i - lft) chmax(dp[tot + 1][lft + 1], dp[tot][lft] + A[i] * (i - lft));
		if (0 <= (N - 1 - (tot - lft) - i)) chmax(dp[tot + 1][lft], dp[tot][lft] + A[i] * (N - 1 - (tot - lft) - i));
	}

	ll ans = 0;
	rep(lft, 0, N + 1) chmax(ans, dp[N][lft]);
	cout << ans << endl;
}







Measured memory_bytes: 35216
#include <bits/stdc++.h>
using namespace std;
int n, m;

int main() {
	while(scanf("%d %d", &n, &m) != EOF) {
		int ans = 0;
		if(m % n == 0) ans = m / n;
		else {
			int t = m / n;
			for(int i = 1; i <= t; i++) {
				if(m / i >= n && m % i == 0) ans = max(ans, i);
			}
		}
		printf("%d\n", ans);
	}
}

Measured memory_bytes: 256
a,b=gets.split(" ").map(&:to_i)
x1=a+b
x2=a-b
x3=a*b
if(x1>=x2)
	if(x1>=x3)
		puts x1
	else
		puts(x3)
	end
else
	if(x2>=x3)
		puts x2
	else
		puts(x3)
	end
end

Measured memory_bytes: 1788
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int n,arr[105];
ll cal(int pos) {
	ll ret = 0;
	for(int i=1;i<=n;i++)
		ret += (ll)(arr[i] - pos) * (arr[i] - pos);
	return ret;
}
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cin >> n;
	for(int i=1;i<=n;i++)
		cin >> arr[i];
	ll ans = 1234567891234567ll;
	for(int i=1;i<=n;i++) {
		ans = min(ans,cal(arr[i]));
		if(i < n) {
			int mid = (arr[i] + arr[i+1]) / 2;
			ans = min(ans,cal(mid));
			ans = min(ans,cal(mid+1));
		}
	}
	cout << ans << endl;
	return 0;
}


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

namespace _0206
{
    class Program
    {
        static void Main(string[] args)
        {
            while (true)
            {
                int L = int.Parse(Console.ReadLine());
                if (L == 0)
                {
                    break;
                }
                int a = 0;
                bool flag = true;
                for (int i = 0; i < 12; i++)
                {
                    int[] x = Console.ReadLine().Split().Select(int.Parse).ToArray();
                    a += x[0] - x[1];
                    if (L <= a && flag)
                    {
                        Console.WriteLine((i + 1));
                        flag = false;
                    }
                }
                if (flag)
                {
                    Console.WriteLine("NA");
                }
            }
        }
    }
}

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

typedef long long ll;
typedef unsigned long long ull;

ll fast_exp(ll base,ll e){
    ll r=1;
    while(e>0){
        if(e%2)r=(r*base);
        base=base*base;
        e/=2;
    }
    return r;
}
ll gcd(ll a,ll b){
    if(b==0)return a;
    return gcd(b,a%b);
}
ll lcm(ll a,ll b){
	return (a*b)/gcd(a,b);
}

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	int k;cin>>k;
	string s;cin>>s;
	if((int)s.size()<=k)cout<<s;
	else{
		for(int i=0;i<k;i++)cout<<s[i];
		cout<<"...";
	}
}

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

int main(){
    int n;
    int d[2][101];
    cin >> n;
    for (int i = 0; i < n; i++){
        cin >> d[0][i] >> d[1][i];
    }
    for (int i = 0; i < n; i++){
        if (d[0][i] == d[1][i] && d[0][i+1] == d[1][i+1] && d[0][i+2] == d[1][i+2]){
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 3644
D=int(input())
c=list(map(int, input().split()))
s=[list(map(int, input().split()))  for i in range(D)]

d=[-1]*(26)
v=[0]*(D+1)


for i in range(D):
    t=s[i].index(max(s[i]))
    v[i]=s[i][t]
    d[t]=0
    if i>0: 
        sb=0      
        for j in range(26):
            if d[j]!=-1:
                d[j]+=1
                sb+=d[j]*c[j]            
        v[i]+=v[i-1]-sb
    print(t+1)

Measured memory_bytes: 9320
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()

int main() {
    string s;
    int cnt=0;
    cin>>s;
    for(int i=0;i<s.size();i++){
        if(s[i]=='1')
            cnt++;
    }
    cout<<cnt<<"\n";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
        using namespace std;
   #define int long long
const int MAX = 510000;
const int MOD = 1000000007;


     signed main(){
 int n,m,x;
 cin>>n>>m;
 vector<int> v[m];
 for(int i=0;i<n;i++){
      cin>>x;
      v[x%m].push_back(x);
 }
 int ans=0;
 for(int i=0;2*i<=m;i++){
      if(2*i%m==0){
           ans+=v[i].size()/2;
           continue;
      }
        int k=0;
      if(v[i].size()>v[m-i].size()){
         
           sort(v[i].begin(),v[i].end());
           for(int j=1;j<v[i].size();j++){
                if(v[i][j]==v[i][j-1]){
                     k++;
                     v[i][j]=-1;
                }
           }
           ans+=v[m-i].size()+min(signed(v[i].size()-v[m-i].size())/2,signed(k));
      }
       if(v[i].size()<v[m-i].size()){
         
           sort(v[m-i].begin(),v[m-i].end());
           for(int j=1;j<v[m-i].size();j++){
                if(v[m-i][j]==v[m-i][j-1]){
                     k++;
                     v[m-i][j]=-1;
                }
           }
           ans+=v[i].size()+min(signed(v[m-i].size()-v[i].size())/2,signed(k));
      }
       if(v[i].size()==v[m-i].size())ans+=v[i].size();

 }
 cout<<ans<<endl;


 }






    





      

        


Measured memory_bytes: 5760
#include <bits/stdc++.h>
#define int long long
#define double long double
using namespace std;
const int MOD = 1000000007;
const int INF = 1e14;
using Graph = vector<vector<int>>;

//既に同じ行でi個拾った状態でj行k列にいるときの最大値
int dp[4][3100][3100];

signed main(){
  int R, C, K;
  cin >> R >> C >> K;

  vector<vector<int>> L(R+10, vector<int>(C+10, 0));
  vector<int> v(K);
  for( int i = 0; i < K; i++ ){
    int r, c, v;
    cin >> r >> c >> v;
    L[r][c] = v;
  }

  dp[0][0][0] = 0;

  for( int h = 1; h <= R; h++ ){
    for( int w = 1; w <= C; w++ ){
        for( int i = 3; i >= 0; i-- ){
            if(i != 3)dp[i+1][h][w] = max(dp[i+1][h][w], dp[i][h][w]+L[h][w]);
        }
        for( int i = 0; i <= 3; i++ ){
        dp[0][h+1][w] = max(dp[0][h+1][w], dp[i][h][w]);
        dp[i][h][w+1] = max(dp[i][h][w+1], dp[i][h][w]);
      }
    }
  }

  int ans = 0;
  for( int i = 0; i <= 3; i++ ){
    ans = max(ans, dp[i][R][C]);
  }
  cout << ans << endl;


}


Measured memory_bytes: 366444
#include<stdio.h>
int main(){
	int a,n,m,k[1001],d,d2;
	scanf("%d %d",&n,&m);
	for(a=0;a<m;a++){
		scanf("%d %d",&d,&d2);
		k[a]=n-d;
		if(k[a]<0){
			k[a]=0;
		}
	}
	for(d=0;d<m;d++){
		for(d2=d+1;d2<m;d2++){
			if(k[d]>k[d2]){
				a=k[d];
				k[d]=k[d2];
				k[d2]=a;
			}
		}
	}
	a=0;
	for(d=0;d<m-1;d++){
		a+=k[d];
	}
	printf("%d\n",a);
	return 0;
}

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

int n;
double dp[3010][3010],a[3010];

signed main()
{
	ios::sync_with_stdio(false);
	cin>>n;
	for(int i=1;i<=n;i++) cin>>a[i];
	dp[1][0]=a[1];
	dp[0][1]=1.0-a[1];
	for(int i=2;i<=n;i++){
		for(int j=0;j<=i;j++){
			if(j==0) dp[j][i-j]=dp[j][i-j-1]*(1.0-a[i]);
			else if(i-j==0) dp[j][i-j]=dp[j-1][i-j]*a[i];
			else dp[j][i-j]=dp[j-1][i-j]*a[i]+dp[j][i-j-1]*(1.0-a[i]);
		}
	}
	double ans=0;
	for(int i=n/2+1;i<=n;i++) ans+=dp[i][n-i];
	cout<<fixed<<setprecision(15)<<ans<<endl;
	return 0;
}

Measured memory_bytes: 70016
//#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define int long long
#define x first
#define y second
#define pb push_back
#define inf 1000000000000000000
#define N 1000000007
#define mp make_pair
#define speed ios_base::sync_with_stdio(0);cin.tie(0);
using namespace std;
template<class L,class R> ostream& operator<<(ostream& cout,pair<L, R> P)
{return cout<<'('<<P.x<<','<< P.y<<')';}
template<class T> ostream& operator<<(ostream& cout,vector<T> V)
{cout<<"[ ";for(auto v:V)cout<<v<<' ';return cout<<']';}
signed main(){
	int r, g, b;cin>>r>>g>>b;
  	int k,ans=0;cin>>k;
  	while(g<=r){g*=2;++ans;}
  	while(b<=g){b*=2;++ans;}
  	//cout<<r<<" "<<g<<' '<<b<<"\n";
  	if(ans<=k){cout<<"Yes\n";}
  	else{cout<<"No\n";}
}

Measured memory_bytes: 3632
m, d = map(int, input().split())
a = 0
if d >= 22 and d <= 29:
    for i in range((int(str(d)[1]) - 1)):
        if 2 * (i + 2) <= m:
            a += 1
elif d >= 30:
    for i in range((int(str(d)[0]) - 2)):
        for j in range(8):
            if (i + 2) * (j + 2) <= m:
                a += 1
    for i in range((int(str(d)[1]) - 1)):
        if int(str(d)[0]) * (i + 2) <= m:
            a += 1
print(a)

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

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

    vector<int> P(101);
    for (int i = 0; i < 101; ++i) {
        P[i] = i + 1;
    }

    for (int i = 0; i < N; ++i) {
        int n;
        cin >> n;
        P[n - 1] = -1;
    }

    int x = 0;
    int d = X;
    for (auto p : P) {
        if (p == -1) {
            continue;
        }

        if (abs(p - X) < d) {
            d = abs(p - X);
            x = p;
        }
    }

    cout << x << endl;
}

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

int calcDigit(long long x)
{
    int ret = 0;
    while (x)
    {
        ret++;
        x /= 10;
    }
    return ret;
}

int F(long long A, long long B)
{
    return max(calcDigit(A), calcDigit(B));
}

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

    long long A, B;
    for (long long i = 1; i * i <= N; i++)
    {
        if (N % i == 0)
        {
            A = i;
            B = N / i;
        }
    }

    cout << F(A, B) << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define mp make_pair
#define pb(x) push_back(x)
#define vi vector<int>
#define vs vector<string>
#define vll vector<long long>
#define vc vector<char>
#define vs vector<string>
#define pii pair<int, int>
#define pll pair<long long, long long>
#define pil pair<int, long long>
#define pli pair<long long, int>
#define pcc pair<char, char>
#define pdd pair<double, double>
#define mll map<long long, long long>
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(), (v).end()
#define flsh fflush(stdout)
#define gcd __gcd
#define clr(x) memset(x, 0, sizeof(x))
#define mod 1000000007LL
#define mod2 998244353LL
#define INF 1000000000007
 

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> o_tree;


void solve()
{
    ll n;
    cin>>n;
    ll i,j;
    ll x;
    ll res=0;
    for(i=0;i<n;i++)
    {
        cin>>x;
        if(i%2==0)
        {
            if(x%2==1)
            {
                res++;
            }
        }

    }
    cout<<res<<"\n";

}


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


if (fopen("input.txt","r" ))
  {
     freopen("input.txt", "r", stdin);
     freopen("output.txt", "w", stdout);
  }
cout<<setprecision(20);


ll t=1;


// cin>>t;


while(t--)
{
solve();
} 


return 0;
}

Measured memory_bytes: 3588
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <list>
#include <queue>
using namespace std;

int inf = (1 << 30);
int mod = 1e9 + 7;
int64_t inf64 = (1LL << 60);

template <typename T>
T gcd(T a, T b) {
    if(b == 0) return a;
    else return gcd(b, a % b);
}

template <typename T>
T lcm(T a, T b) {
    T g = gcd(a, b);
    return a / g * b;
}

bool check(vector<int> a, int index, int key){
    if(a[index] >= key) return true;
    else return false;
}

int lower_bound(vector<int> a, int key){
    int left = -1, right = a.size();
    while(right - left > 1){
        int mid = left + (left + right) / 2;
        if(check(a, mid, key)) right = mid;
        else left = mid;
    }
    return right;
}

int main(){

    string A, B;
    cin >> A;
    cin >> B;

    string ans = "EQUAL";
    if(A.length() > B.length()){
        ans = "GREATER";
    }else if(A.length() < B.length()){
        ans = "LESS";
    }else{
        for(int i = 0; i < A.length(); i++){
            if(A[i] > B[i]){
                ans = "GREATER";
                break;
            }else if(A[i] < B[i]){
                ans = "LESS";
                break;
            }
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#define MAX 2000001
#define VMAX 10000

int main(){
	unsigned short *A, *B;
	
	int C[VMAX + 1];
	int n, i, j;
	scanf("%d", &n);
	
	A = malloc(sizeof(short) *n + 1);
	B = malloc(sizeof(short) *n + 1);
	
	for(i = 0; i <= VMAX; i++){
		C[i] = 0;
	}
	
	for(i = 0; i < n; i++){
		scanf("%hu", &A[i + 1]);
		C[A[i + 1]]++;
	}
	
	for(i = 1; i <=VMAX; i++){
		C[i] += C[i - 1];
	}
	
	for(j = 1; j <=n; j++){
		B[C[A[j]]] = A[j];
		C[A[j]]--;
	}
	
	for(i = 1; i <=n; i++){
		if(i > 1){
			printf(" ");
		}
		printf("%d", B[i]);
	}
	printf("\n");
	
	return 0;
}


Measured memory_bytes: 9560
#include <bits/stdc++.h>
//---------------------------
using namespace std;
//---------------------------
#define REP(i,n) for(int i = 0; i < (n); i++)
#define P(x) cout << (x) << "\n"

#define MOD 1000000007 // 1e9+7
#define PI 3.1415926525
#define ll long long int // 10^18
#define INF 1000000001 // 1e9+1

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

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

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

  int a,b,c,d,e,f;cin>>a>>b>>c>>d>>e>>f;
  float maxn=0;
  float post_maxn=0;
  int memo_sugar_water=100*a, memo_sugar=0;
  REP(ia, 31){
    REP(ib, 31){
      REP(ic, 101){
        REP(id, 101){
          int water=100*a*ia+100*b*ib;
          int sugar=c*ic+d*id;
          if(water+sugar > f)continue;
          if((water/100)*e < sugar)continue;
          maxn=max(maxn, (float)sugar/(sugar+water));
          if(maxn!=post_maxn){
            memo_sugar=sugar;
            memo_sugar_water=sugar+water;
          }
          post_maxn=maxn;
        }
      }
    }
  }
  cout<<memo_sugar_water<<" "<<memo_sugar<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include<queue>
#include<stack>
#include<vector>
#include<set>
#include<map>
#include<algorithm>
#include<cstring>
#include<string>
#include<cassert>
#include<cmath>
#include<climits>
#include<iomanip>
#include<bitset>
#include<unordered_map>

using namespace std;

#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define rep(i,j,n) for(ll (i)=(j);(i)<(n);(i)++)
#define FOR(i,c) for(decltype((c).begin())i=(c).begin();i!=(c).end();++i)
#define ll long long
#define ull unsigned long long
#define all(hoge) (hoge).begin(),(hoge).end()
typedef pair<ll, ll> P;
const long long INF = 1LL << 60;
const long long MOD = 1e9 + 7;
typedef vector<ll> Array;
typedef vector<Array> Matrix;


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

//グラフ関連
struct Edge {//グラフ
	ll to, cap, rev;
	Edge(ll _to, ll _cap, ll _rev) {
		to = _to; cap = _cap; rev = _rev;
	}
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;

void add_edge(Graph& G, ll from, ll to, ll cap, bool revFlag, ll revCap) {
	G[from].push_back(Edge(to, cap, (ll)G[to].size()));
	if (revFlag)G[to].push_back(Edge(from, revCap, (ll)G[from].size() - 1));
}

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

	ll n;
	cin >> n;

	ll n1, n2;
	cin >> n1 >> n2;
	n--;
	while (n--) {
		ll r1, r2;
		cin >> r1 >> r2;
		
		if (n1 % r1 != 0) {
			n1 += r1-(n1 % r1);
		}
		if (n2 % r2 != 0) {
			n2 += r2 - (n2 % r2);
		}

		if (n1 / r1 * r2 > n2) {
			n2 = n1 / r1 * r2;
		}
		else if (n1 / r1 * r2 < n2) {
			n1 = n2 / r2 * r1;
		}
		//cout << n1 << " " << n2<<endl;
	}

	cout << n1 + n2<<endl;

	return 0;
}

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


int main(void)
{
	long int i, j;
	long int n, k;
	long int sum;
	long int max;
	long int count;
	long int heit;
	long int h[100000];
	
	scanf("%ld", &n);
	
	for(i = 0; i < n; i++) {
		scanf("%ld", &h[i]);
	}
	
	max = 0;
	
	heit = h[0];
	count = 0;
	for(i = 1; i < n; i++) {
		if(heit >= h[i]) {
			count++;
			heit = h[i];
		} else {
			if(max < count) {
				max = count;
			}
			count = 0;
			heit = h[i];
		}
	}
	
	if(max < count) {
		max = count;
	}
	
	printf("%ld\n", max);
	
	return 0;
}


Measured memory_bytes: 896
#include<iostream>
#include<stdio.h>
using namespace std;
char a[100][100],b[100][100];
int n,m;
int main()
{
    cin>>n>>m;
    for(int i=0;i<n;i++)
    {
        scanf("%s",a[i]);
    }
    for(int i=0;i<m;i++)
    {
        scanf("%s",b[i]);
    }
    int flag=1;
    for(int i=0;i<n;i++)
    {
        for(int j=0;j<n;j++)
        {

            if(a[i][j]==b[0][0])
            {
                flag=0;
                for(int x=0;x<m;x++)
                {
                    for(int y=0;y<m;y++)
                    {
                        if(a[i+x][j+y]!=b[x][y])
                        {
                            flag=1;
                            break;
                        }
                    }
                }
            }
            if(flag==0)
            {
                cout<<"Yes";
                return 0;
            }
        }
    }
    cout<<"No";
    return 0;
}

Measured memory_bytes: 888