akhauriyash/Code-Regression huggingface dataset:
import std.functional,
       std.algorithm,
       std.bigint,
       std.string,
       std.traits,
       std.array,
       std.range,
       std.stdio,
       std.conv;

void main() {
  int N = readln.chomp.to!int;
  int[][] CSF = (N-1).iota.map!(_ => readln.chomp.split.to!(int[])).array;
  int[] C, S, F;

  foreach (csf; CSF) {
    C ~= csf[0];
    S ~= csf[1];
    F ~= csf[2];
  }

  foreach (i; 0..N) {
    int x;
    for (ulong j = i; j < N - 1; j++) {
      if (x < S[j]) {
        x = S[j];
      }

      if (x % F[j] != 0) {
        x = x+F[j] - x%F[j];
      }

      x += C[j];
    }

    writeln(x);
  }
}


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

using namespace std;

typedef vector < vector <long long> > vvi;
typedef vector <long long> vi;

vvi combi(long long prev, long long m, long long l) {
    vvi res;
    if (l == 0) {
        vi empty;
        res.push_back(empty);
        return res;
    }
    for (long long i = prev; i <= m; ++i) {
        vvi combis = combi(i, m, l - 1);
        for (auto itr = combis.begin(); itr != combis.end(); ++itr) {
            vi s = *itr;
            s.push_back(i);
            res.push_back(s);
        }
    }
    return res;
}

bool eval(vi rev, long long a, long long b, long long c) {
    long long n = rev.size();
    long long ia, ib;
    ia = n - a;
    ib = n - b;
    return (rev[ib] - rev[ia] == c);
}

int main(void) {
    long long n, m, q;
    cin >> n >> m >> q;
    vi a, b, c, d;
    for (long long i = 0; i < q; i++) {
        long long ai, bi, ci, di;
        cin >> ai >> bi >> ci >> di;
        a.push_back(ai);
        b.push_back(bi);
        c.push_back(ci);
        d.push_back(di);
    }
    vvi com = combi(1, m, n);
    long long res = 0;
    for (auto itr = com.begin(); itr != com.end(); ++itr) {
        vi s = *itr;
        long long pnt = 0;
        for (long long i = 0; i < q; i++) {
            if (eval(s, a[i], b[i], c[i])) pnt += d[i];
        }
        res = max(res, pnt);
    }
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 15272
#include<bits/stdc++.h>
#include <math.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define lper(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9;
const ll INF=4e18;
const ll dy[4]={1,0,-1,0};
const ll dx[4]={0,-1,0,1};
int main() {
  
  int A;
  int B;
  int K;
  cin >>A>>B>>K; 
  int count=0;
  for(int i=A; i>0;i--) {
    if (((A%i==0) &&(B%i==0)) &&(count<K)) {
count++;
      
      
        //cout << count << endl;
    }
    //cout << count << endl;
if (count==K) {
cout << i<< endl;
  break;
}
  }

//cout << count << endl;

}

Measured memory_bytes: 256
import fileinput

for line in fileinput.input():
    xa, ya, xb, yb, xc, yc, xd, yd = map(float, line.split(','))
    xab, yab, xbc, ybc, xcd, ycd, xda, yda = xb - xa, yb - ya, xc - xb, yc - yb, xd - xc, yd - yc, xa - xd, ya - yd
    ab = xab * ybc - xbc * yab
    bc = xbc * ycd - xcd * ybc
    cd = xcd * yda - xda * ycd
    da = xda * yab - xab * yda
    print('YES' if ab * bc > 0 and ab * cd > 0 and ab * da > 0 else 'NO')

Measured memory_bytes: 7352
// 解説PDFの通り実装
// 白→黒に入れ替わる回数を数える
// もし開始セルが黒なら+1

#include <algorithm>
#include <array>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
#define REP(i,n) for(int i = 0; i < (int)(n); ++i)
#define FOR(i,a,b) for(int i = (a); i < (int)(b); ++i)
#define ALL(c) (c).begin(), (c).end()
#define SIZE(v) ((int)v.size())
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;
}
#define pb push_back
#define mp make_pair
#define mt make_tuple

int main(void)
{
    cin.sync_with_stdio(false);
    int H, W;
    cin >> H >> W;
    vector<string> cells(H);
    REP(h, H) cin >> cells[h];

    vector<vector<int>> dp(H, vector<int>(W, 1e9));
    dp[0][0] = 0;
    REP(h, H) {
        REP(w, W) {
            if (w != 0) {
                chmin(dp[h][w],
                      dp[h][w - 1]
                      + (cells[h][w - 1] == '.' && cells[h][w] == '#'));
            }
            if (h != 0) {
                chmin(dp[h][w],
                      dp[h - 1][w]
                      + (cells[h - 1][w] == '.' && cells[h][w] == '#'));
            }
        }
    }

    // REP(h, H) {
    //     REP(w, W) {
    //         cout << dp[h][w] << " ";
    //     }
    //     cout << endl;
    // }

    auto ans = dp[H-1][W-1];
    ans += (cells[0][0] == '#');
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 384
#include <stdio.h>
#include <stdlib.h>

void main(void)
{
  int sum=0,a,i,b,c[200000]={0};
  scanf("%d",&a);
  for(i=1;i<a;i++){
    scanf("%d",&b);
    c[b-1]+=1;
  }
  for(i=0;i<a;i++){
    printf("%d\n",c[i]);
  }
}

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

using namespace std;
long digsum(long n, long b){
	if(n<b) return n;	
	return digsum(floor(n/b),b)+n%b;
}
int main(int argc, char *argv[]) {
	long n;
	long s;
	cin>>n;
	cin>>s;
	for(long i=2;i<=sqrt(n);i++)
	if(digsum(n,i)==s) return cout<<i<<endl,0;
	long res = n+2;
	for(long i =1;i<=sqrt(n-s);i++)
	if((n-s)%i==0){
		if(digsum(n,i+1)==s) res= min(res,i+1);
		if(digsum(n,(n-s)/i+1)==s) res= min(res,(n-s)/i+1);
		
	}
	if(n==s) res = min(res,n+1);
	if(res!=n+2) cout<<res; else cout<<-1;
}


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

using namespace std;

int main()
{
	string s;
	cin >> s;
	vector <char> v;
	string r = "";
	for (int i = 0; i < s.length(); i++) {
		v.push_back(s[i]);
	}
	for (int i = 0; i < v.size(); i++) {
		if (v[i] == '1' || v[i] == '0') {
			r = r + v[i];
		}
		else {
			r = r.substr(0, r.length() - 1);
		}
	}
	cout << r;

}


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

typedef pair<double,double> dd;


double len(dd a, dd b){
  return sqrt(pow(a.first-b.first , 2)+pow(a.second-b.second,2));
}


int main(){

  vector < dd > dat(0);
  double x,y;
  double s=0,z;

  while(scanf("%lf,%lf",&x,&y)!=EOF){
    dat.push_back(dd(x,y));
  }

  for(int i=2; i<(int)dat.size(); i++){ 
    z = (len(dat[0],dat[i])+len(dat[i],dat[i-1])+len(dat[i-1],dat[0]) )/2.0;
    s += sqrt(z*(z-len(dat[0],dat[i]))*(z-len(dat[i],dat[i-1]))*(z-len(dat[i-1],dat[0])));
  }

  cout << s << endl;

  return 0;
}

Measured memory_bytes: 1288
#include<iostream>
#include<cstdio>
using namespace std;
int n,m;
int s[1<<17],a;
main()
{
	scanf("%d%d",&n,&m);
	for(;n--;)
	{
		int A,B;scanf("%d%d",&A,&B);
		int M=1;
		for(;M*M<=B;M++)
		{
			if((A+M-1)/M<=B/M)
			{
				s[M]++;
				s[M+1]--;
			}
		}
		int B1=M;
		int k=B/M;
		for(;k>=1;k--)
		{
			int B2=B/k;
			int L=(A+k-1)/k;
			if(L<B1)L=B1;
			s[L]++;
			s[B2+1]--;
			B1=B2+1;
		}
	}
	for(int i=1;i<=m;i++)printf("%d\n",a+=s[i]);
}

Measured memory_bytes: 1280
#include <bits/stdc++.h>
using namespace std;
int main () {
	long long a, b, c;
	cin >> a >> b >> c;
	long long RHS = (c - a - b);
	if (RHS < 0) {
		printf("No\n");
		return 0;
	}
	RHS *= RHS;
	long long LHS = 4 * a * b;
	if (LHS < RHS) printf("Yes\n");
	else printf("No\n");
	return 0;
}


Measured memory_bytes: 256
import sys
from collections import deque

queue = deque()
n = int(input())
for _ in range(n):
    op = sys.stdin.readline().strip().split()
    if op[0] == 'deleteFirst':
        queue.popleft()
    elif op[0] == 'deleteLast':
        queue.pop()
    elif op[0] == 'insert':
        queue.appendleft(int(op[1]))
    elif op[0] == 'delete':
        try:
            queue.remove(int(op[1]))
        except ValueError:
            pass

print(' '.join(map(str, queue)))



Measured memory_bytes: 45944
package main

import (
  "fmt"
)

func gcd(a, b int) int {
  if b == 0 {
      return a
  }
  return gcd(b, a%b)
}

func main() {
  var a,b,c int
  for _, err := fmt.Scan(&a, &b); err == nil; _, err = fmt.Scan(&a, &b) {
    c = gcd(a,b)
    fmt.Println(c, a*b/c)
  }
}


Measured memory_bytes: 1124
num = int(input())
travels = []
for _ in range(num):
    travels.append(list(map(int, input().split())))


beforTime = 0
beforX = 0
beforY = 0
resultFrag = True
for travel in travels:
    move = abs(beforX - travel[1]) + abs(beforY - travel[2])
    canMoveTime = travel[0] - beforTime
    if move <= canMoveTime and (move + canMoveTime) % 2 == 0:
        beforTime = travel[0]
        beforX = travel[1]
        beforY =  travel[2]
        continue
    resultFrag = False
    break

print("Yes" if resultFrag else "No")

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

using namespace std;

#define debug(n) cerr << #n << ':' << n << endl;
#define dline    cerr << __LINE__ << endl;

using ll = long long;
template<class T, class U> using P = pair<T,U>;
template<class T> using Heap = priority_queue<T>;
template<class T> using heaP = priority_queue<T,vector<T>,greater<T>>;
template<class T,class U> using umap = unordered_map<T,U>;
template<class T> using uset = unordered_set<T>;

template<class T>
bool ChangeMax(T&a,const T&b){
  if(a >= b) return false;
  a = b;    return true;
}

template<class T>
bool ChangeMin(T&a,const T&b){
  if(a <= b) return false;
  a = b;    return true;  
}

template<class T, size_t N, class U>
void Fill(T (&a)[N], const U&v){
    fill((U*)a,(U*)(a+N),v);
}

template<class T>
istream& operator >> (istream&is, vector<T>&v){
  for(auto&e:v)is >> e;
  return is;
}

int A=-1,B=-1,C=-1;

void Rec(int x,int y,int a,int b,int c){
  static set<P<int,int>> st;
  if(st.find({x,y}) != st.end())return;
  st.emplace(x,y);
  if(x * 10000 < y)return;
  if(A != -1)return;
  if(x == 0 && y == 0){
    tie(A,B,C) = tie(a,b,c);
    return;
  }
  if(y <= 0 || x <= 0)return;
  Rec(x-1,y-10000,a+1,b,c);
  Rec(x-1,y-5000,a,b+1,c);
  Rec(x-1,y-1000,a,b,c+1);
}

int main(){
  int x,y; cin >> x >> y;
  Rec(x,y,0,0,0);
  cout << A << ' ' << B << ' ' << C << endl;
  return 0;
}


Measured memory_bytes: 88848
#include<bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define repk(i,k,n) for (ll i = k; i < (ll)(n); ++i)
#define MAX 500000001000000000
#define MOD 1000000007
typedef long long  ll;

using namespace std;

int ans, cnt;

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

	double A,B;
	cin >> A >> B;

	rep(i, 10e5) {
		double a = 0.08 * i;
		double b = 0.1 * i;

		if (a >= A && a < A + 1 && b >= B && b < B + 1) {
			ans = i;
			break;
		}
		if (i == 10e5 - 1) ans = -1;
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
	static long dist[][];
	static int ans_len;
	static long r[];
	static String str[];
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int M = sc.nextInt();
		int R = sc.nextInt();
		r = new long[R];
		
		int t = 1;
		for(int i = 0; i < R; i++) {
			r[i] = sc.nextInt() - 1;
			t *= (i + 1);
		}
		str = new String[t];
		
		int A[] = new int[M];
		int B[] = new int[M];
		int C[] = new int[M];
		dist = new long[N][N];
		for(int i = 0; i < N; i++) {
			Arrays.fill(dist[i], Long.MAX_VALUE / 2);
		}
		for(int i = 0; i < M; i++) {
			A[i] = sc.nextInt() - 1;
			B[i] = sc.nextInt() - 1;
			C[i] = sc.nextInt();
			dist[A[i]][B[i]] = C[i];
			dist[B[i]][A[i]] = C[i];
		}
		
		int perm[] = new int[R];
		boolean flag[] = new boolean[R];
		makePerm(0, perm, flag);
		String[][] str2 = new String[ans_len][R];
		for(int i = 0; i < ans_len; i++) {
			str2[i] = str[i].split(",", 0);
		}
		WarshallFloyd(N);
		long temp[] = new long[ans_len];
		Arrays.fill(temp, 0);
		long ans = Long.MAX_VALUE / 2;
		for(int a = 0; a < ans_len; a++) {
			for(int i = 0; i < R - 1; i++) {
				temp[a] += dist[Integer.parseInt(str2[a][i])][Integer.parseInt(str2[a][i + 1])];
			}
			ans = Math.min(ans, temp[a]);
		}
		System.out.println(ans);
	}
	
	static void WarshallFloyd(int N) {
		for(int k = 0; k < N; k++) {
			for(int i = 0; i < N; i++) {
				for(int j = 0; j < N; j++) {
					dist[i][j] = Math.min(dist[i][j], dist[i][k] + dist[k][j]);
				}
			}
		}
	}
	
	static void makePerm(int n, int perm[], boolean flag[]) {
		if(n == perm.length) {
			str[ans_len] = "";
			for(int i = 0; i < perm.length; i++) {
				str[ans_len] = str[ans_len] + r[perm[i]] + ",";
			}
			ans_len++;
		} else {
			for(int i = 0; i < perm.length; i++) {
				if(flag[i]) {
					continue;
				} else {
					perm[n] = i;
					flag[i] = true;
					makePerm(n + 1, perm, flag);
					flag[i] = false;
				}
			}
		}
	}
}


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

using namespace std;

int n, ans;

int main()
{
	int a, i, p1, p2;
	
	scanf("%d", &n);
	
	p1 = p2 = -1;
	
	for(i=0; i<n; i++){
		scanf("%d", &a);
		if(p2 == -1) ans ++;
		else if(p1 != -1){
			if((p1 < p2 && p2 > a) || (p1 > p2 && p2 < a)){
				ans ++;
				p1 = -1, p2 = a;
			}
		}
		
		if(p2 != a) p1 = p2; p2 = a;
	}
	
	printf("%d\n",ans);
	
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
using ll    = long long;
using ull   = unsigned long long;
using veci  = vector<int>;
using vecll = vector<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(int i= 0;i<(int)(n);++i)
#define pb push_back
 
int gcb(int a,int b){return ((b == 0)? a : gcb(b,a%b));}
int gcd(int a,int b){return (a*b) / gcb(a,b);}
 
int main(){
    int n,ans = 0;
    ll x;
    vecll a;
    cin >> n >> x;
    rep(i,n){
        ll tmp;
        cin >> tmp;
        a.pb(tmp);
    }
    sort(a.begin(),a.end());
    bool breaks = true;
    int index = 0;
    rep(i,n){
        if(x >= a[i]){
            x -= a[i];
            ans++;
            index++;
        }else{
            breaks = false;
            break;
        }
    }
    if(breaks){
        if(x-a[index] > 0){
            ans--;
        }
    }
    cout << ans << endl;
    return 0;
}

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

#ifdef LOCAL
#define debug(var) cerr << (#var) << " = " << (var) << endl;
#else
#define debug(var)
#endif

void init() {
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
}

const int N = 123;
const int inf = 1e9;

struct Point {
    int x, y;
    int id;
    bool color;
} p[2*N];

void solve() {
    int n; scanf("%d", &n);
    for (int i = 0; i < 2*n; ++i) {
        scanf("%d%d", &p[i].x, &p[i].y);
        p[i].id = i;
        p[i].color = i >= n;
    }
    sort(p, p+2*n, [](const Point &a, const Point &b){
        return a.x < b.x;
    });
    set<int> s;
    int ans = 0;
    for (int i = 0; i < 2*n; ++i) {
        if (p[i].color) {
            if (s.size() == 0) continue;
            int sel, q = -1;
            for (const auto &e: s) {
                if (p[e].y < p[i].y && p[e].y > q) {
                    q = p[e].y;
                    sel = e;
                }
            }
            if (q == -1) continue;
            s.erase(sel);
            ++ans;
        } else {
            s.insert(i);
        }
    }
    printf("%d", ans);
}

int main() {
    init();
    int t = 1; //scanf("%d", &t);
    while (t--) {
        solve();
    }
    return 0;
}

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

long long int n, k;

void solve() {
	cin >> n >> k;
	int x, y, c = 0;
	int a[n + 1] {};
	while (k--) {
		cin >> x;
		for (int i = 0; i < x; i++) {
			cin >> y;
			a[y]++;
		}
	}
	for (int i = 1; i <= n; ++i)
	{
		if (a[i] > 0)
			c++;
	}
	cout << n - c;
}

int main()
{
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	solve();

	return 0;
}

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

int main() {
  int i, N, for4 = 0;
  string S[100];
  
  cin >> N;
  
  for (i = 0; i < N; i++) {
    cin >> S[i];
    if (S[i] == "Y")
      for4++;
  }
  if (for4 > 0)
    cout << "Four" << endl;
  else 
    cout << "Three" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long int lint;

#define PI acos(-1)
#define INF64 1LL << 60
#define INF32 1 << 29
#define all(a) (a).begin(), (a).end()
#define INV ((long long int)1000000007)

using namespace std;

void execute()
{
	int N;
	cin >> N;

	cout << (N <= 999 ? "ABC" : "ABD") << endl;
	return;
}

int main()
{
	cin.tie(0);
	ios_base::sync_with_stdio(false);
	std::cout << std::fixed << std::setprecision(15);
	execute();

	int stop;
	cin >> stop;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <new>
#include <utility>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <tuple>
#include <iomanip>

typedef long long ll;
typedef long double ld;

using namespace std;
using Graph = vector<vector<ll>>;

#define rep(i, N) for (ll i = 0; i < (ll)(N); ++i)
#define ALL(a) (a).begin(),(a).end()

const ll inf = 1e18+7;
const ll mod = 1e9+7;

ll GetDigit(ll num){
    unsigned digit=0;
    while(num!=0){
        num /= 10;
        digit++;
    }
    return digit;
}

int main(){
    ll k,flag=0;
    vector<ll> C(5,0);
    rep(i,5) cin >> C[i];
    cin >> k;
    for(ll i=0;i<5;i++){
        for(ll j=i+1;j<5;j++){
            if(abs(C[i]-C[j])>k){
                flag=1;
            }
        }
    }
    if(flag){
        cout <<":("<<endl;
    }else{
        cout << "Yay!"<< endl;
    }
    return 0;
}


Measured memory_bytes: 256
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

A, B ,C = MAP()

if C-(A-B) >= 0:
	print(C-(A-B))
else:
	print(0)

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

struct info{
    ll x, y, z;
};

int main(){
    int n, m;
    cin >> n >> m;
    info v[n];
    for(int i = 0; i < n; i++) cin >> v[i].x >> v[i].y >> v[i].z;
    ll ans = -10000000001 * n;
    for(int i = 0; i < 8; i++){
        vector<ll> s;
        for(int j = 0; j < n; j++){
            ll tmp = 0;
            tmp = i >> 0 & 1 ? tmp + v[j].x : tmp - v[j].x;
            tmp = i >> 1 & 1 ? tmp + v[j].y : tmp - v[j].y; 
            tmp = i >> 2 & 1 ? tmp + v[j].z : tmp - v[j].z;
            s.push_back(tmp);  
        }
        sort(s.begin(), s.end(), greater<ll>());
        ll sum = 0;
        for(int j = 0; j < m; j++) sum += s[j];
        ans = max(ans, sum);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()

prod=True
N=5
ANS="BRRBBRBRBR"

def ask(A): # A:list-like
    print("? {}".format(' '.join(map(str,A))))
    sys.stdout.flush()
    if(prod): return input()
    else:
        cnt=0
        for a in A:
            cnt+=ANS[a-1]=='R'
        return "Red" if(cnt>(N-cnt)) else "Blue"

def resolve():        
    n=int(input()) if(prod) else N

    # 二分法でRとBの境目を一つ見つける
    l=1; r=n+1
    lcol=ask(range(1,1+n))
    rcol="Red" if(lcol=="Blue") else "Blue"
    while(r-l>1):
        h=(l+r)//2
        hcol=ask(range(h,h+n))
        if(lcol==hcol): l=h
        else: r=h

    res=[None]*(2*n+1) # 1-indexed
    idx=l
    res[idx]=lcol[0]
    res[idx+n]=rcol[0]

    for i in range(1,idx):
        A=[i]+list(range(idx+1,idx+n))
        res[i]=ask(A)[0]
    for i in range(idx+n+1,2*n+1):
        A=list(range(idx+1,idx+n))+[i]
        res[i]=ask(A)[0]
    for i in range(idx+1,idx+n):
        A=list(range(1,idx))+[i]+list(range(idx+n+1,2*n+1))
        res[i]=ask(A)[0]
    print("! {}".format(''.join(res[1:])))
resolve()

Measured memory_bytes: 39108
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
using namespace std;
int main()
{
    string a,b; cin>>a>>b; ll c=0;
    for(ll i=0;i<a.size();i++)
    {
        if(a[i]!=b[i]) c++;
    }
    cout<<c;
}


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

int main() {
    int h,w;
	scanf("%d%d",&h,&w);
	int arr[h][w],temp;
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			scanf("%d",&arr[i][j]);
		}
	}
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			scanf("%d",&temp);
			arr[i][j]=abs(arr[i][j]-temp);
		}
	}
	bool dp[2][85][25605];
	for(int i=0;i<85;i++){
		for(int j=0;j<25605;j++){
			dp[0][i][j]=0;
			dp[1][i][j]=0;
		}
	}
	//12802 is 0
	dp[0][0][12802-arr[0][0]]=1;
	dp[0][0][12802+arr[0][0]]=1;
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			for(int k=0;k<25605;k++){
				if(i>0){
					if(dp[1^(i&1)][j][k]){
						if(k-arr[i][j]>=0){
							dp[i&1][j][k-arr[i][j]]=1;
						}
						if(k+arr[i][j]<25605){
							dp[i&1][j][k+arr[i][j]]=1;
						}
					}
				}
				if(j>0){
					if(dp[i&1][j-1][k]){
						if(k-arr[i][j]>=0){
							dp[i&1][j][k-arr[i][j]]=1;
						}
						if(k+arr[i][j]<25605){
							dp[i&1][j][k+arr[i][j]]=1;
						}
					}
				}
			}
			/*
			for(int k=12795;k<=12815;k++){
				if(dp[i&1][j][k])printf("1");
				else printf("0");
			}
			printf("\n");
			*/
		}
		for(int j=0;j<w;j++){
			for(int k=0;k<25605;k++){
				dp[1^(i&1)][j][k]=0;
			}
		}
		//printf("\n");
	}
	for(int i=0;i<25605;i++){
		if(12802-i>=0){
			if(dp[(h-1)&1][(w-1)][12802-i]){
				printf("%d",i);return 0;
			}
		}
		if(12802+i<25605){
			if(dp[(h-1)&1][(w-1)][12802+i]){
				printf("%d",i);return 0;
			}
		}
	}
}


Measured memory_bytes: 4480
#include <iostream>
#include <string>
#define MAX 80

using namespace std;

int main()
{
	int n;
	cin >> n;
	for (int counter = 0; counter < n; counter++){
		string a, b;
		cin >> a >> b;
		if (a.length() > MAX || b.length() > MAX){
			cout << "overflow" << endl;
			continue;
		}
		if (a.length() == 1 && b.length() == 1 && a[0] == '0' && b[0] == '0'){
			cout << 0 << endl;
			continue;
		}
		int inta[MAX + 2], intb[MAX + 2], sum[MAX + 2];
		fill(inta, inta + MAX + 2, 0);
		fill(intb, intb + MAX + 2, 0);
		fill(sum, sum + MAX + 2, 0);
		for (int i = 0; i < (signed)a.length(); i++){
			inta[i] = a[a.length() - i - 1] - '0';
		}
		for (int i = 0; i < (signed)b.length(); i++){
			intb[i] = b[b.length() - i - 1] - '0';
		}

		int over = 0;
		for (int i = 0; i < MAX + 2; i++){
			sum[i] = inta[i] + intb[i] + over;
			if (sum[i] >= 10){
				sum[i] %= 10;
				over = 1;
			}
			else{
				over = 0;
			}
		}

		for (int i = MAX + 1;; i--){
			if (sum[i] != 0){
				if (i >= MAX){
					cout << "overflow" << endl;
					break;
				}
				for (int j = i; j >= 0; j--){
					cout << sum[j];
				}
				cout << endl;
				break;
			}
		}
	}
	return 0;
}

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

using namespace std;
using nagai = long long;
#define sz(x) int((x).size())

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n;cin>>n;
	string s;
	cin>>s;
	int a=0;
	for(char ch:s)
		if(ch=='R')++a;else--a;
	if(a>0)cout<<"Yes\n";
	else cout<<"No\n";

	return 0;
}



Measured memory_bytes: 256
import java.io.*;
import java.util.Scanner;
 
class Main {
  public static void main(String args[]) {
	Scanner scanner = new Scanner(System.in);
    int input1 = scanner.nextInt();
    int input2 = scanner.nextInt();
    int num1 = input1 * input2;
    System.out.println(num1);
  };
};

Measured memory_bytes: 35808
#include <bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<(n);++i)
#define sayyes cout<<"Yes"<<endl;
#define sayno cout<<"No"<<endl;
using namespace std;
typedef long long ll;
typedef pair<int,int>P;
const int mod =1e9+7;


ll BinarySearch(vector<ll> vec, ll key) {
	// key: 検索対象の値
	ll left = -1, right = vec.size(), mid;

	while(right-left>1)
	{
		mid=(right+left)/2;
		if(vec[mid]<key)
		{
			left=mid;
		}
		else
		{
			right=mid;
		}


	}
	// key が配列の中に見つからない場合
	return left;
}
int main()
{
	int n,m;
	cin>>n>>m;
	priority_queue<P> z;
	rep(i,n)
	{
		ll a;
		cin>>a;
		z.push(P(a,1));
	}
	rep(i,m)
	{
		ll b,c;
		cin>>b>>c;
		z.push(P(c,b));
	}
	ll ans=0;
	ll num=0;
	while(num!=n)
	{
		P t=z.top();
		z.pop();
		num++;
		if(t.second>1)
		{
			t.second--;
			z.push(t);
		}
		ans+=t.first;
	}
	cout<<ans;
}

Measured memory_bytes: 2420
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
 
 		while(true){
 			int numnum = sc.nextInt();
 			int goalsum = sc.nextInt();

 			if(numnum == 0 && goalsum == 0){break;}

	 		int answer = 0;
 			boolean[] check = new boolean[10]; 
 			for (int i = 0; i < 1024; i++) {
 				int count = 0;
 				int sum = 0;
 				int binary = i;
 				for (int j = 0; j < 10; j++) {
 					if(binary % 2 == 0){
 						check[j] = true;
 					}else{
 						check[j] = false;
 					}
 					binary /= 2;
 				}

 				for (int j = 0; j < 10; j++) {
 					if(check[j]){
 						count++;
 						sum += j;
 					}
 				}
 				if(count == numnum && sum == goalsum){
 					answer++;
 				}
 			}
	  		System.out.println(answer);
 		}
	}
}

Measured memory_bytes: 19756
using System;

namespace Count_Balls
{
    class Program
    {
        static void Main(string[] args)
        {
            String input = Console.ReadLine();
            String[] splitted = input.Split(' ');
            long N = long.Parse(splitted[0]);
            long A = long.Parse(splitted[1]);
            long B = long.Parse(splitted[2]);

            long answer = ((N / (A + B)) * A) + Math.Min((N % (A + B)),A);
            Console.WriteLine(answer);
        }
    }
}


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


template <typename T>
std::ostream &operator<<(std::ostream &out, const std::vector<T> &v){
    if(!v.empty()) {
        out << '[';
        std::copy(v.begin(), v.end(), std::ostream_iterator<T>(out, ", "));
        out << "\b\b]";
    }
    return out;
}

template <typename T1, typename T2>
std::ostream &operator<<(std::ostream &out, const std::pair<T1, T2> &p) {
    out << "[" << p.first << ", " << p.second << "]";
    return out;
}
//---------

const int MAX_V = 500003;
struct edge{
    int from, to, cost;
    bool operator<(const edge x)const{return cost<x.cost;}
};

vector<edge> G[MAX_V]; //???????????´

void AddEdge(int s,int g,int c){
    G[s].push_back((edge){s, g, c});
}

int vv = MAX_V; //????????°
ll dd[MAX_V];//??????????????¢
void dijkstra(int s){
    fill(dd, dd+vv, 1e11);
    dd[s] = 0;
    priority_queue<P ,vector<P> ,greater<P> > que;
    que.push(pair<int, int>(0, s));

    while(que.size()){
        P p = que.top();que.pop();
        int u = p.second;
        if(dd[u] < p.first) continue;
        for(int i = 0; i < G[u].size(); i++){
            edge e = G[u][i];
            if(dd[e.to] > dd[u] + e.cost){
                dd[e.to] = dd[u] + e.cost;
                que.push(P(dd[e.to], e.to));
            }
        }
    }
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int v, e, r;
    cin >> v >> e >> r;
    rep(i, 0, e){
        int s, t, d;
        cin >> s >> t >> d;
        AddEdge(s, t, d);
    }
    dijkstra(r);
    rep(i, 0, v) {
        if(dd[i] == 1e11) cout << "INF" << endl;
        else cout << dd[i] << endl;

    }
}

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

int main()
{
    ll N,M;
    cin >> N >> M;
    ll sum = 0;

    for(ll i = 0; i < M; i++)
    {
        ll tmp;
        cin >> tmp;
        sum += tmp;
    }

    if(sum > N)cout << -1 << endl;
    else cout << N - sum << endl;
    return 0;
}

Measured memory_bytes: 3636
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <deque>

long long modpow(long long a, long long n, long long p)
{
    long long out = 1;
    while (n)
    {
        if (n & 1)
            out = out * a % p;
        a = a * a % p;
        n >>= 1;
    }
    return out;
}

long long modinv(long long a, long long p)
{
    long long b = p, u = 1, v = 0;
    while (b)
    {
        long long t = a / b;
        a -= t * b;
        std::swap(a, b);
        u -= t * v;
        std::swap(u, v);
    }
    u %= p;
    if (u < 0)
        u += p;
    return u;
}

long long modncr(long long n, long long r, long long p)
{
    long long out = 1;

    while (r)
    {
        out = out * n % p;
        out = out * modinv(r, p) % p;
        n--;
        r--;
    }
    return out;
}

int main()
{

    long long n, a, b;

    long long mod = 1000000007ll;

    scanf("%lld", &n);
    scanf("%lld", &a);
    scanf("%lld", &b);

    long long ans = modpow(2, n, mod) - 1;

    ans = (ans - modncr(n, a, mod)) % mod;
    ans = (ans - modncr(n, b, mod)) % mod;

    if (ans < 0)
        ans += mod;

    printf("%lld", ans);

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define show(x) for(auto i: x){cout << i << " ";}
typedef long long ll;


int main()
{
    string s;
    string  day[7] = { "SUN","MON","TUE","WED","THU","FRI","SAT"};


    cin >> s;
    int ans = 0;
    rep(i, 7){
        if (s == day[i]){
            ans = 7 - i;
        }
    }
    cout << ans << endl;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <math.h>
#define _GLIBCXX_DEBUG
#define _LIBCPP_DEBUG 0

using namespace std;
#define ll long long
#define rep(i,n) for (int i = 0; i < n; i++)
#define MOD (1000000007)
#define vi vector<int>
#define vl vector<ll>
#define vvi vector<vi>
#define pii pair<int, int>
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

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

const ll INF = 1LL << 60;

const int dh[4] = {1,0,-1,0};
const int dw[4] = {0,1,0,-1};


int main(){
  int n; string s1,s2;
  cin >> n >> s1 >> s2;

  ll dp[n] = {};
  if(s1[0] == s2[0]) dp[0] = 3;
  else dp[0] = 6;
  for (int i = 1; i < n; i++) {
    if(s1[i] == s2[i]){
      if(s1[i-1] == s2[i-1]) dp[i] = dp[i-1]*2;
      else dp[i] = dp[i-1];
    }
    else{
      if(s1[i] == s1[i-1]) dp[i] = dp[i-1];
      else if(s1[i-1] == s2[i-1]) dp[i] = dp[i-1]*2;
      else if(s1[i-1] != s2[i-1]) dp[i] = dp[i-1]*3;
    }
    dp[i] %= MOD;
  }

  std::cout << dp[n-1] << '\n';
}


Measured memory_bytes: 256
'use strict'

const main = input => {
	const args = input.split('\n').map(arg => arg.split(' '))
	const N = parseInt(args[0][0], 10)
	const d = args[1].map(arg => parseInt(arg, 10))
	let ans = 0

	for (let i = 0; i < N; i++) {
		for (let j = i; j < N; j++) {
			if (i === j) continue
			ans += d[i] * d[j]
		}
	}

	console.log(ans)
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'))


Measured memory_bytes: 7372
#include <iostream>
#include <sstream>
#include <vector>
#include <cassert>
#include <string>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <utility>
#include <tuple>
#include <regex>
#include <map>

using namespace std;
using ull = unsigned long long;

int main() {
	int N = 0;
	cin >> N;

	struct Otoshidama {
		double amount;
		string unit;
	};
	vector<double> vec;

	for (size_t i = 0; i < N; i++) {
		double x;
		string u;
		cin >> x >> u;
		if (u == "BTC") x *= 380000.0;
		vec.push_back(x);
	}

	const double total = accumulate(cbegin(vec), cend(vec), 0.0);
	cout << total << endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main( )
{
    int n;
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++)
        cin>>a[i];
    int max=0;
    for(int i=0;i<n;i++)
        if(a[i]>max)
            max=a[i];
    int sum=0;
    for(int i=0;i<n;i++)
        sum+=a[i];
    sum-=max;
    if(sum>max)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,ini,n) for(int i=ini;i<n;i++)
#define _rep(i,ini,n) for(int i=ini;i>=n;i--)
#define ToEnd(a) a.begin(),a.end()
uint64_t MOD=1000000007;

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

    int64_t step=0,i=0;
    while(step<X){
        i++;
        step+=i;
    }

    cout<<i<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define SZ(x) ((int) (x).size())
using namespace std;

int main() {
    #ifdef LOCAL_RUN
    freopen("task.in", "r", stdin);
    freopen("task.out", "w", stdout);
    //freopen("task.err", "w", stderr);
    #endif // ONLINE_JUDGE
    ios::sync_with_stdio(false);
    cin.tie(0);

    int a, b, c, d, e, f;
    cin >> a >> b >> c >> d >> e >> f;

    vector<int> dpWater(f + 1, 0);
    dpWater[0] = 1;
    for (int i = 1; i <= f; ++i) {
        if (i - 100 * a >= 0) {
            dpWater[i] |= dpWater[i - 100 * a];
        }
        if (i - 100 * b >= 0) {
            dpWater[i] |= dpWater[i - 100 * b];
        }
    }
    vector<int> dpSugar(f + 1, 0);
    dpSugar[0] = 1;
    set<int> s;
    s.insert(0);
    for (int i = 1; i <= f; ++i) {
        if (i - c >= 0) {
            dpSugar[i] |= dpSugar[i - c];
        }
        if (i - d >= 0) {
            dpSugar[i] |= dpSugar[i - d];
        }
        if (dpSugar[i]) {
            s.insert(i);
        }
    }
    int answ = -1, anss = -1;
    for (int i = 1; i <= f; ++i) {
        if (dpWater[i]) {
            int maxs = min(i / 100 * e, f - i);
            auto it = s.upper_bound(maxs);
            if (it != s.begin()) {
                --it;
                int water = i, sugar = *it;
                if (answ == -1 || (100LL * sugar * (answ + anss) > 100LL * anss * (water + sugar))) {
                    answ = water;
                    anss = sugar;
                }
            }
        }
    }
    cout << answ + anss << ' ' << anss << '\n';
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define print(x) cout << x << endl;
using namespace std;
typedef long long ll;

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

    if (a >= 3200) cout << s << endl;
    else print("red");

    return 0;
}

Measured memory_bytes: 256
n,m=gets.split.map(&:to_i)
first=n.times.map{gets.split.map(&:to_i)}
last=m.times.map{gets.split.map(&:to_i)}

for i in 0..first.length-1
    v=1000000000000000000000000
    vv=0
    for j in 0..last.length-1
        a=(first[i][0]-last[j][0]).abs
         b=(first[i][1]-last[j][1]).abs
         if a+b<v
        v=a+b
        vv=j+1
         end
    end
    puts vv
end

Measured memory_bytes: 3836
#include<bits/stdc++.h>
using namespace std;
const int maxn = 200005;
typedef long long LL;

int n;
LL a[maxn], x, y, ans = 1000000000000000000LL;

int main(){
	cin>>n;
	for (int i = 0; i < n; i ++){
		cin >> a[i];
		y += a[i];
	}
	for(int i = 0; i < n - 1; i ++){
		x += a[i];
		y -= a[i];
		ans = min(ans, abs(y - x));
	}
	cout << ans <<endl;
	return 0;
}

Measured memory_bytes: 1792
#include <stdlib.h>
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
using ll=long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
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);}
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;
}
const long long INF=1LL << 60;
long long a,b;
long long dp[100200][110];
long long w[110],v[110];

int main() {
   int a,b;
   cin>>a>>b;
   if(a==1){
       a=15;
   }
   if(b==1){
       b=15;
   }
   if(a>b){
       cout<<"Alice"<<endl;
   }
   if(a<b){
       cout<<"Bob"<<endl;
   }
   if(a==b){
       cout<<"Draw"<<endl;
   }
}


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

int main(){
  int vec[3][3];
  for(int i = 0; i < 3; i++){
    for(int j = 0; j < 3; j++){
      cin >> vec[i][j];
    }
  }
  int x[3];
  int y[3];
  
  bool ok = true;
  x[0] = 0;
  for(int i = 0; i < 3; i++){
    y[i] = vec[0][i] - x[0];
  }
  for(int i = 0; i < 3; i++){
    x[i] = vec[i][0] - y[0];
  }
  for(int i = 0; i < 3; i++){
    for(int j = 0; j < 3; j++){
      if(x[i] + y[j] != vec[i][j]){
        ok = false;
      }
    }
  }
  if(ok){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner (System.in);
		
		int n = sc.nextInt();
		long d = sc.nextInt();
		int cnt=0;
		
		for(int i=0;i<n;i++) {
			long x = sc.nextInt();
			long y = sc.nextInt();
			if(d*d >=x*x + y*y) {
				cnt++;
			}
		}
		System.out.println(cnt);
	}
}

Measured memory_bytes: 61052
import java.util.Scanner;

public class Main{
    public static void main(String[]args){
        Scanner sc = new Scanner (System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        if(a<b){
            System.out.println("a < b");
        }else if(a==b){
            System.out.println("a == b");
        }else if(a>b){
            System.out.println("a > b");
        }
    }
}


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

#define ll long long
#define ull unsigned long long
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define debug(x) cerr<<#x<<": "<<x<<'\n'
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

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

template<class T=int>
T in(){T x;cin>>x;return (x);}
template<class T>
void print(T& x){cout<<x<<'\n';}

const int MOD =(int)1e9+7;
const int MAX =510000;

ll fac[MAX],finv[MAX],inv[MAX];
void COMint(){
    fac[0]=fac[1]=1;
    finv[0]=finv[1]=1;
    inv[1]=1;
    for(int i=2;i<MAX;i++){
        fac[i]=fac[i-1]*i%MOD;
        inv[i]=MOD-inv[MOD%i]*(MOD/i)%MOD;
        finv[i]=finv[i-1]*inv[i]%MOD;
    }
}
ll COM(int n,int k){
    if(n<k) return 0;
    if(n<0||k<0)return 0;
    return fac[n]*(finv[k]*finv[n-k]%MOD)%MOD;
}

ll gcd(ll a,ll b){
    if(b==0)return a;
    if(a>b){
        swap(a,b);
    }
    return gcd(a,b%a);
}
ll lcm(ll a,ll b){
    ll g;g=gcd(a,b);
    return a*b/g;
}
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll S=in<ll>();
    
    ll x1;ll x2;ll y1;ll y2;
    ll S_sqrt;S_sqrt=sqrtl(S);
    if(S_sqrt*S_sqrt!=S){
        S_sqrt++;
        x1=S_sqrt;
        y1=x1*x1-S;
        x2=1;
        y2=S_sqrt;
    }else{
        x1=S_sqrt;
        y1=0;
        x2=0;
        y2=S_sqrt;
    }
        cout<<0<<" "<<0<<" "<<x1<<" "<<y1<<" "<<x2<<" "<<y2<<endl;
        return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
 
using namespace __gnu_pbds;
using namespace std;
 
typedef long long int ll;
typedef unsigned long long int sll;
typedef  double ld;
#define A 1000000007ll
#define D 100000000000000ll
#define B 998244353ll
#define C 1000000000000000000ll
#define FAST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define oset tree<ll, null_type,less_equal<ll>, rb_tree_tag,tree_order_statistics_node_update> 
#define pb push_back
#define pf push_front
#define pob pop_back
#define pof pop_front
#define mxe(v) *max_element(v.begin(),v.end())
#define mne(v) *min_element(v.begin(),v.end())
#define bs binary_search
#define lb lower_bound
#define ub upper_bound
#define ve vector
#define br break
#define PI acos(-1)
#define subt cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n" 

int main() 
{
    FAST;
    ve<string> vec[10];
    ve<ll> dis[10];
    vec[0].pb("a");
    dis[0].pb(1);
    for(int i=1;i<10;i++)
    {
        for(int j=0;j<10;j++)
        {
            for(int k=0;k<vec[i-1].size();k++)
            {
                string te=vec[i-1][k];
                ll x=dis[i-1][k];
                if(x>=j)
                {
                    te.pb(j+'a');
                    if(x==j)
                        x++;
                    vec[i].pb(te);
                    dis[i].pb(x);
                }
            }
        }
    }
    ll k;
    cin>>k;
    sort(vec[k-1].begin(),vec[k-1].end());
    for(int i=0;i<vec[k-1].size();i++)
        cout<<vec[k-1][i]<<'\n';
    subt;
    return 0;
}

Measured memory_bytes: 10728
import java.util.Scanner;
     
     public class Main{
    	public static int Square(int a){
    		int ans = (int) Math.pow(a,2);
    		return ans;	
    		}
    	
    	public static void main(String[] args) {
    		
    		Scanner scan = new Scanner(System.in);
    		int a = scan.nextInt();
    		System.out.println(Square(a));
    		}
    	
    	}

Measured memory_bytes: 21844
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <queue>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vi2;
typedef vector<vi2> vi3;
typedef pair<int, int> pii;
typedef vector<pii> vii;
typedef vector<ll> vll;
typedef vector<vll> vll2;
typedef vector<vll2> vll3;
typedef vector<bool> vb;

#define el '\n'
#define rep(i, a, b) for (int i = a; i < b; i++)
#define repi(i, a, b) for (int i = a; i >= b; i--)
#define umap unordered_map
#define uset unordered_set
#define vec vector
#define loop(a) for (auto &x : a)
#define all(a) a.begin(), a.end()
#define mp make_pair

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

    int a, b, h, m;
    cin >> a >> b >> h >> m;
    const double PI = 3.14159265358979323846264338327950288;
    double alpha = m * 2 * PI / 60;
    double beta = (h + m / 60.0) * 2 * PI / 12;
    double theta = abs(alpha - beta);
    double c = sqrt(a * a + b * b - 2 * a * b * cos(theta));
    cout << setprecision(20);
    cout << c << el;
}


Measured memory_bytes: 3544
N,q=map(int,input().split())
a=input()
n=0
b=[0]
for i in range(1,N):
  if a[i-1]=="A" and a[i]=="C":
    n+=1
  b.append(n)
for _ in range(q):
  l,r=map(int,input().split())
  if l!=1:
    print(b[r-1]-b[l-1])
  else:
    print(b[r-1])

Measured memory_bytes: 6100
#include<iostream>
#include<string>
#include<vector>
#include<queue>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<cmath>
using namespace std;
typedef long long ll;
typedef pair<int,int> p;
const int inf=100000000;
#define rep(i,a,n)	for(int i=a;i<n;i++)
#define rrep(i,a,n) for(int i=(a-1);i>=n;i--)
	
int main(){
	string s;
	cin>>s;
	int x=0;
	if(s[0]=='A')x++;
	int y=0;
	int z=0;
	rep(i,2,s.size()-1){
		if(s[i]=='C')y++;
	}
	rep(i,1,s.size()){
		if('a'<=s[i]&&s[i]<='z')z++;
	}
	if(x+y+z==s.size()&&y==1)cout<<"AC"<<endl;
	else cout<<"WA"<<endl;
	
	
}

Measured memory_bytes: 256
object Main extends App {
	val pw = new java.io.PrintWriter(System.out)

	@scala.annotation.tailrec
	def loop(start: Int, end: Int)(f: Int => Unit): Unit =
		if (start < end) {
			f(start)
			loop(start + 1, end)(f)
		}

	val k, a, b = Scanner.nextInt

	pw.println( if ((a to b filter (_ % k == 0)).nonEmpty) "OK" else "NG" )
	pw.flush()
}

object Scanner {
	private val buf = new Array[Byte](1024); private var ptr = 0; private var len = 0

	@inline private def isPrintableChar(c: Int): Boolean = 33 <= c && c <= 126
	@inline private def hasNextByte(): Boolean = if (ptr >= len) { ptr = 0; len = System.in.read(buf); len > 0 } else true
	@inline private def hasNext(): Boolean = {
		while (hasNextByte() && !isPrintableChar(buf(ptr))) ptr += 1
		hasNextByte()
	}
	@inline private def readByte(): Byte = if (hasNextByte()) { val res = buf(ptr); ptr += 1; res } else -1

	def next(): String = {
		if(!hasNext()) ???
		val sb = new StringBuilder; var b = readByte()
		while (isPrintableChar(b)) { sb.append(b.toChar); b = readByte() }
		sb.toString
	}

	def nextInt(): Int = {
		val n = nextLong()
		if (n < Int.MinValue || Int.MaxValue < n) ???
		n.toInt
	}

	def nextLong(): Long = {
		if(!hasNext()) ???
		var minus = false; var b = readByte()
		if (b == '-') { minus = true; b = readByte() }

		@scala.annotation.tailrec
		def go (b: Byte, n: Long = 0): Long = if ('0' <= b && b <= '9') go(readByte(), n * 10 + b - '0') else if (minus) -n else n

		go(b)
	}

	def nextDouble(): Double = next().toDouble
}


Measured memory_bytes: 54696
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)*}
    };
}

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

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!{
        a: i32,
        b: i32,
    }
    if a > b {
        println!("a > b");
    } else if a < b {
        println!("a < b");
    } else {
        println!("a == b");
    }
}


Measured memory_bytes: 5028