akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
#define pb push_back
using namespace std;
typedef long long ll;

int main(){
  int n,c;
  cin>>n>>c;
  vector<vector<int>> d(c,vector<int>(200005));
  rep(i,n){
    int s,t,c;
    cin>>s>>t>>c;
    c--;
    d[c][s*2-1]=1;
    d[c][t*2]=-1;
  }
  rep(i,c)rep(j,200004) d[i][j+1]+=d[i][j];
  
  int ans=0;
  rep(i,200005){
    int res=0;
    rep(j,c){
      if(d[j][i]!=0) res++;
    }
    ans=max(ans,res);
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 27560
#include <iostream>

int main(void)
{
	int a, b, c, num = 0;
	std::cin >> a >> b >> c;
	for (int i = a; i <= b; i++) {
		if (c % i == 0) {
			num++;
		}
	}
	std::cout << num << std::endl;
	return 0;
}

Measured memory_bytes: 1164
#include <iostream>
#include <string>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
using namespace std;

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

int main(){
    string S;
    cin >> S;
    S = " " + S;
    ll N = (int)S.size();
    int g[N];
    g[0] = 0, g[1] = 1;
    if(S.at(1) == S.at(2)) g[2] = 1;
    else g[2] = 2;
    for(int i = 3; i < N; i++){
        if(S.at(i) != S.at(i-1)){
            g[i] = g[i-1] + 1;
        }else{
            g[i] = g[i-3] + 2;
        }
    }
    cout << g[N-1] << endl;
    return 0;
}

Measured memory_bytes: 1336
#include <iostream>
#include <cmath>  
using namespace std;
 
int main() {
  int N;
  int t[110000], x[110000], y[110000];
  cin >> N;
  t[0] = x[0] = y[0] = 0;  // 初期状態
  for(int i=0;i<N;++i) cin >> t[i+1]>>x[i+1]>>y[i+1];
  
  bool can = true;
  for(int i =0; i <N ; ++i){
    int dt = t[i+1]-t[i];
    int dist = abs(x[i+1]-x[i]) + abs(y[i+1]-y[i]);
    if(dt < dist) can =false;
    if (dist % 2 != dt % 2) can = false; 
  }
  
  if(can) cout << "Yes" << endl;
  else cout << "No" << endl;
}

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

    return 0;
}



Measured memory_bytes: 2044
import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		Scanner as = new Scanner(System.in);
		long n=as.nextLong();
		long l=0;
		if(n%11==0){
			l+=(n/11)*2;
		}else if(n%11>6){
			l+=(n/11)*2+2;
		}else{
			l+=(n/11)*2+1;
		}
		System.out.println(l);
	}
}

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

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

  string s;
  cin >> s;

  string ans = (s[2] == s[3] && s[4] == s[5]) ? "Yes" : "No";
  cout << ans << endl;
  return 0;
  
}

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

class Program
{
    static void Main(string[] args)
    {
        var A = sc.ReadInt();
        var B = sc.ReadInt();
        var C = sc.ReadInt();
        var ok = C >= A && C <= B;
        Console.WriteLine(ok ? "Yes" : "No");
    }
    static int MOD = (int)1e9 + 7;
    static int INF = (int)1e7 + 1;
    static long LINF = (long)1e13 + 1;
    static Scanner sc = new Scanner();
}

class Scanner
{
    string[] S = new string[0];
    int Index = 0;
    char[] Separators = new char[] { ' ' };

    public string Next()
    {
        if (this.Index < this.S.Length) return this.S[this.Index++];
        var line = "";
        while (line == "") line = Console.ReadLine();
        this.S = line.Split(this.Separators, StringSplitOptions.RemoveEmptyEntries);
        if (this.S.Length == 0) return this.Next();
        this.Index = 0;
        return this.S[this.Index++];
    }
    public string ReadStr()
    {
        return this.Next();
    }
    public char ReadChar()
    {
        return this.Next()[0];
    }
    public int ReadInt()
    {
        return int.Parse(this.Next());
    }
    public uint ReadUInt()
    {
        return uint.Parse(this.Next());
    }
    public long ReadLong()
    {
        return long.Parse(this.Next());
    }
    public double ReadDouble()
    {
        return double.Parse(this.Next());
    }
    public int[] ReadIntArray(int n)
    {
        var array = new int[n];
        for (int i = 0; i < array.Length; i++)
        {
            array[i] = this.ReadInt();
        }
        return array;
    }
    public long[] ReadLongArray(int n)
    {
        var array = new long[n];
        for (int i = 0; i < array.Length; i++)
        {
            array[i] = this.ReadLong();
        }
        return array;
    }
    public double[] ReadDoubleArray(int n)
    {
        var array = new double[n];
        for (int i = 0; i < array.Length; i++)
        {
            array[i] = this.ReadDouble();
        }
        return array;
    }
    public char[] ReadCharArray(int n)
    {
        var array = new char[n];
        for (int i = 0; i < array.Length; i++)
        {
            array[i] = this.ReadChar();
        }
        return array;
    }
    public string[] ReadStrArray(int n)
    {
        var array = new string[n];
        for (int i = 0; i < array.Length; i++)
        {
            array[i] = this.ReadStr();
        }
        return array;
    }
}



Measured memory_bytes: 11092
def itoa(i):
    if i==0:
        return "a"
    elif i==1:
        return "b"
    elif i==2:
        return "c"
    elif i==3:
        return "d"
    elif i==4:
        return "e"
    elif i==5:
        return "f"
    elif i==6:
        return "g"
    elif i==7:
        return "h"
    elif i==8:
        return "i"
    elif i==9:
        return "j"
    elif i==10:
        return "k"
    elif i==11:
        return "l"
    elif i==12:
        return "m"
    elif i==13:
        return "n"
    elif i==14:
        return "o"
    elif i==15:
        return "p"
    elif i==16:
        return "q"
    elif i==17:
        return "r"
    elif i==18:
        return "s"
    elif i==19:
        return "t"
    elif i==20:
        return "u"
    elif i==21:
        return "v"
    elif i==22:
        return "w"
    elif i==23:
        return "x"
    elif i==24:
        return "y"
    elif i==25:
        return "z"


H,W = list(map(int,input().split()))
S = []
for i in range(H):
    S.append(input().split())

for i in range(H):
    for j in range(W):
        if S[i][j]=="snuke":
            print(itoa(j).upper()+str(i+1))
        

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef double D;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int,int> PII;
typedef pair<ll,ll> PLL;
typedef long double ld;

#define rd(x) scanf("%d",&x)
#define rd2(x,y) scanf("%d %d",&x,&y)
#define rd3(x,y,z) scanf("%d %d %d",&x,&y,&z)
#define rl(x) scanf("%lld",&x)
#define rl2(x,y) scanf("%lld %lld",&x,&y)
#define rl3(x,y,z) scanf("%lld %lld %lld",&x,&y,&z)
#define wd(x) printf("%d" ,x)
#define wd2(x,y) printf("%d %d",x,y)
#define wl(x) printf("%lld",x)
#define wl2(x,y) printf("%lld %lld",x,y)
#define PC(x) putchar(x)
#define GC() getchar()
#define NL printf("\n")
#define SP printf(" ")
 
#define SZ(a) (int)a.size()
#define ALL(a) a.begin(), a.end()
#define ITER(it,a) for (__typeof(a.begin()) it = a.begin(); it != a.end(); it++)
#define FILL(a,value) memset(a, value, sizeof(a))

#define F first
#define S second
#define MP make_pair
#define PB push_back


#define L_B lower_bound
#define U_B upper_bound

#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL)
#define fr(i,s,e) for(int i=s;i<e;i++)
#define frl(i,s,e) for(ll i=s;i<e;i++)
#define frr(i,s,e) for(int i=s-1;i>=e;i--)
#define frv(i,a) for(int i = 0;i<(int)a.size();i++)
#define frvr(i,a) for(int i = a.size()-1;i>=0;i--)
#define tr(i,a) for(typeof(a.begin()) i = a.begin(); i != a.end();i++)

#define inf (1000*1000*1000+5)
#define mod 1000000007
#define maxn 100009
#define maxr 100009

void solve()
{
	ll x,y;
	rl2(x,y);
	if(x<y)
		cout<<0<<endl;
	else
		cout<<10<<endl;
	return;
}
int main(){
	//sstd::ios::sync_with_stdio(false); cin.tie(NULL);
	solve();
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<algorithm>

using namespace std;
int main(void)
{
	

	long long int n,a,min=0,max=0,sum=0;
	
	cin>>n;

	for(int i=0;i<n;i++)
	{
		
		cin>>a;
		sum=sum+a;
		if(a>max||i==0)
		{
			max=a;
		}
		if(a<min||i==0)
		{
			min=a;
		}

	

	

	}
	cout<<min<<" "<<max<<" "<<sum<<endl;
	return 0;
}



Measured memory_bytes: 3116
#include <iostream>
#include <string>


int main() {

	std::string s;
	std::cin >> s;

	int l = s.length();

	for (int i = 0; i < (l - 1) / 2; i++) {
		if (s[i] != s[(l - 1) / 2 - 1 -i]) {
			std::cout << "No";
			return 0;
		}

		if (s[i] != s[l - i - 1]) {
			std::cout << "No";
			return 0;
		}
	}

	std::cout << "Yes";
	return 0;

}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
using namespace std;

int main()
{
    int n;
    cin >> n;
    vector<int> p(n);
    for(int i=0; i<n; ++i){
        cin >> p[i];
        -- p[i];
    }

    vector<int> a(n+1), b(n+1);
    for(int i=0; i<n; ++i){
        a[i] = 1;
        b[i] = -1;
    }
    b[0] = n;
    
    for(int i=0; i<n; ++i){
        int x = p[n-1-i];
        a[x+1] += i + 1;
        a[n]   -= i + 1;
        b[0]   += i + 1;
        b[x]   -= i + 1;
    }

    for(int i=0; i<n; ++i){
        a[i+1] += a[i];
        b[i+1] += b[i];
    }

    cout << a[0];
    for(int i=1; i<n; ++i)
        cout << ' ' << a[i];
    cout << endl << b[0];
    for(int i=1; i<n; ++i)
        cout << ' ' << b[i];
    cout << endl;

    return 0;
}

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

#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()

typedef long long ll;

const char nl = '\n' ;
const ll MOD = 1e9 + 7;

bool check(string s)
{
   int k = s.size()/2;
   for(int i = 0; i <k; i++)
   {
      if(s[i] != s[i+k])
         return false;
   }
   return true;
}
int main()
{
   ios_base::sync_with_stdio(0); cin.tie(0);
   string s; cin >> s;
   int a[300] = {};
   for(int i = 0; i < s.size(); i++)
      a[s[i]]++;
   for(int i = 'a' ; i <= 'z'; i++)
   {
      if(!a[i])
      {
         cout << char(i) << nl;
         return 0;
      }

   }
   cout << "None" << nl;
   return 0;
}


Measured memory_bytes: 3684
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef string str;
const long long INF = INT64_MAX;

#define REP(i, n) for(ll i=0;i<n;i++)
#define WHOLE(v) (v).begin(), (v).end()
#define ASC(v) sort((v).begin(), (v).end())
#define DESC(v) sort((v).rbegin(), (v).rend())
#define INV(v) reverse((v).rbegin(), (v).rend())
#define FOLDL(src, dst, lambda) partial_sum((src).begin(), (src).end(), (dst).begin(), lambda)
#define FOLDR(src, dst, lambda) INV(src);partial_sum((src).begin(), (src).end(), (dst).begin(), lambda);INV(dst)
#define CUMSUML(src, dst) FOLDL(src, dst, [](auto a, auto b) {return a+b;})
#define CUMSUMR(src, dst) FOLDR(src, dst, [](auto a, auto b) {return a+b;})
#define ACCUM(v, d0, lambda) accumulate((v).begin(), (v).end(), d0, lambda)
#define SUM(v, d0) ACCUM(v, d0, [](auto a, auto b) {return a+b;})
#define DESC(v) sort((v).rbegin(), (v).rend())
#define ERASE(v, i) v.erase(v.begin() + i)
#define UNIQ(v) ASC(v);erase(unique(v.begin(), v.end()), v.end())
#define FIO ios_base::sync_with_stdio(false);cin.tie(NULL);

ll gcd(ll a, ll b)
{
	if (a < b)
	{
		a ^= b;
		b ^= a;
		a ^= b;
	}
	return b ? gcd(b, a % b) : a;
}

void solve() {
    ll N, K;
    cin >> N >> K;
    vll A(N);
    for(auto &a:A) cin >> a;
    ll g = ACCUM(A, 0, [](ll a, ll b) {return gcd(a, b);});
    ll mx = ACCUM(A, 0, [](ll a, ll b) {return max(a, b);});
    if(K % g == 0 && mx >= K) {
        cout << "POSSIBLE" << endl;
    }else {
        cout << "IMPOSSIBLE" << endl;
    }
}

int main() {
    FIO;
    solve();
    return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
set<int>st;
int main()
{ 
  int n,k;
  cin>>n>>k;
  for (int i=0;i<k;++i)
  {
    int x;
    cin>>x;
    st.insert(x);
  }
  for (int i=n;i<=n*10;++i)
  {
    int z=i;
    bool is=true;
    if (!i)
    {if (st.count(i%10)) is=false;}
    while(z>0)
    { 
      if (st.count(z%10)) {is=false;break;}
      z/=10;
    }
    if (is) return cout<<i<<"\n",0;
  }
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <set>
#include <queue>
#define ll long long
using namespace std;

multimap<ll, ll> items; // first = weight, second = value
int n, w;
ll maxVal[100005]; // max value which can be obtained with total weight of i

int main() {
    cin >> n >> w;

    for (int i = 1; i <= n; ++i) {
        ll x, y;
        cin >> x >> y;
        items.emplace(make_pair(x, y));
    }

    ll maxSum = 0;
    set<ll> possible;
    for (pair<ll, ll> item : items) {
        queue<pair<ll, ll>> toAdd;
        toAdd.emplace(make_pair(item.first, item.second));

        auto it = possible.begin();
        while (it != possible.end() && (item.first + *it) <= w) {
            ll weight = *it + item.first;
            ll val = maxVal[*it] + item.second;
            toAdd.emplace(make_pair(weight, val));

            if (val > maxSum)
                maxSum = val;
            ++it;
        }

        while (!toAdd.empty()) {
            pair<ll, ll> item = toAdd.front();
            toAdd.pop();

            possible.emplace(item.first);
            maxVal[item.first] = max(maxVal[item.first], item.second);

            if (maxVal[item.first] > maxSum)
                maxSum = maxVal[item.first];
        }
    }

    cout << maxSum;
    return 0;
}


Measured memory_bytes: 10148
n=[input() for _ in range(int(input()))];m,a,r,c,h=0,0,0,0,0
for i in n:
  if i[0]=='M': m+=1
  elif i[0]=='A': a+=1
  elif i[0]=='R': r+=1
  elif i[0]=='C': c+=1
  elif i[0]=='H': h+=1
r=[m,a,r,c,h]
print(sum([sum([sum([r[i]*r[j]*r[k] for k in range(j+1,5)]) for j in range(i+1,5)]) for i in range(5)]))

Measured memory_bytes: 16264
"use strict";
const Main = (input) =>{
   let xs = input.trim().split('\n');
   let x = xs[0].split('');
   let y = xs[1].split('');
   let z = [];
   let count = 0;
   for(let i =y.length-1; i>=0; i--){
       z.push(y[i]);
   }
   for(let i=0; i<x.length; i++){
     if(x[i]==z[i]){
       count++
     }else{
       break;
     }
   }
   if(count==x.length){
     console.log('YES');
   }else{
     console.log('NO');
   }
}
Main(require('fs').readFileSync('/dev/stdin','utf8'));




Measured memory_bytes: 9420
import java.util.*;
import java.io.*;
public class Main {
	static int num = 998244353;
	public static void main(String[] args) throws Exception{
		

		// TODO Auto-generated method stub
 		BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
 		PrintWriter out = new PrintWriter(System.out);
 		StringTokenizer st = new StringTokenizer(bf.readLine());
 		int n = Integer.parseInt(st.nextToken());
 		int s = Integer.parseInt(st.nextToken());
 		long mult = power(2, num-2, num);
 		int[] array = new int[n];
 		StringTokenizer st1 = new StringTokenizer(bf.readLine());
 		for(int i = 0;i<n;i++){
 			array[i] = Integer.parseInt(st1.nextToken());
 		}
 		long[][] dp = new long[n+1][s+1];
 		dp[0][0] = power(2, n, num)%num;
 		for(int i = 1;i<=s;i++)
 			dp[0][i] = (long)(0);
 		for(int i = 0;i<n;i++){
 			for(int j = 0;j<=s;j++){
 				dp[i+1][j]+= dp[i][j];
 				dp[i+1][j]%= num;
 				if (j+array[i] <=s){
 					dp[i+1][j+array[i]] += dp[i][j]*mult;
 					dp[i+1][j+array[i]]%= num;
 				}
 			}
 			
 		}
 		out.println(dp[n][s]);
 		out.close();
 		
	}
	public static long power(long x, long y, long mod){
		long ans = 1;
		while(y>0){
			if (y%2==1)
				ans = (ans*x)%mod;
			x = (x*x)%mod;
			y/=2;
		}
		return ans%num;
	}

}
 	
 
//StringJoiner sj = new StringJoiner(" "); 
//sj.add(strings)
//sj.toString() gives string of those stuff w spaces or whatever that sequence is

 		
 		
 		
 		
	




Measured memory_bytes: 96964
a, b = map(int, input().split())
flag = True
for i in range(1010):
    t1 = i*1.08
    t2 = i*1.10
    if int(t1-i) == a and int(t2-i) == b:
        print(i)
        flag = False
        break
if flag:
    print(-1)

Measured memory_bytes: 38384
#include<iostream>
#include<stdio.h>
using namespace std;

int main(){
	int a;
	cin >> a;
	long long int sum=0;
	//fizzbuzzの総和を返す
	for(int i = 1; i <= a; i++){
		if(i%3 == 0 || i % 5 == 0){
			continue;
		}else{
			sum += i;
		}
	}
	cout << sum << endl;
	return 0;
}

Measured memory_bytes: 3632
#include<iostream>
#include<vector>
#include<algorithm>
#include<iomanip>

#define PI 3.141592653589793238
#define INF 1050000000

using namespace std;



//cout << fixed << setprecision(15) << << endl;
//cout << << endl;

int main() {

	string a;

	cin >> a ;

	a[5] = ' ';
	a[13] = ' ';

	cout << a << endl;



	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
static const int MAX = 200000;


int main()
{
	int R[MAX], n;

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

	int maxv = -2000000000;
	int minv = R[0];

	for (int i = 1; i < n; i++) {
		maxv = max(maxv, R[i] - minv);
		minv = min(minv, R[i]);
	}

	cout << maxv << endl;





    return 0;
}


Measured memory_bytes: 3888
#include<set>  
#include<map>  
#include<cstdio>  
#include<cmath>  
#include<queue>
#include<vector>  
#include<cstring>  
#include<climits>  
#include<iostream>  
#include<algorithm>  
using namespace std; 
#define eps 1
#define MAXN 100000
int read(){  
	int f=1,x=0;  
    char c=getchar();  
    while(c<'0'||'9'<c){if(c=='-')f=-1;c=getchar();}  
    while('0'<=c&&c<='9') x=x*10+c-'0',c=getchar();  
    return f*x;  
}
bool top[30];
int main(){
	top[getchar()-'a']=1;
    top[getchar()-'a']=1;
	top[getchar()-'a']=1;
	getchar();
	if(top['a'-'a']&&top['b'-'a']&&top['c'-'a'])printf("Yes\n");
	else printf("No\n");
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iomanip>
#define ll long long
using namespace std;
 
int main() {
  string S;
  cin >> S;
  if((S.at(0) == '7') || (S.at(1) == '7') || (S.at(2) == '7')) cout << "Yes" << endl;
  else cout << "No" << endl;
}

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

using namespace std;
typedef long long ll;

//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(ll i=0;i<ll(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=ll(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=ll(b);i--)
//xにはvectorなどのコンテナ
#define ALL(x) x.begin(),x.end() //sortなどの引数を省略したい
#define SIZE(x) ll(x.size()) //sizeをsize_tからllに直しておく
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素
#define Umap unordered_map
#define Uset unordered_set

int main(){
    ll n;
    cin >> n;
    vector<double> a(n);
    REP(i, n) cin >> a[i];
    double ans = 0;
    REP(i, n){
        ans += 1 / a[i];
    }
    cout << 1 / ans;
    return 0;
}

Measured memory_bytes: 3804
import java.util.ArrayDeque;
import java.util.Deque;
import java.util.Scanner;

/**
 * 接收消息，然后对字符串做处理
 * @author Boqi Gao
 */
public class Main {
    static Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        String s = sc.next();
        int numOfOper = sc.nextInt();
        Deque<Character> dq = new ArrayDeque<>();
        
        for(int i = 0; i < s.length(); i++) {
            dq.addLast(s.charAt(i));
        }

        //此处定义一个逆序flag
        boolean rev = false;

        for(int i = 0; i <numOfOper; i++){
            int oper = sc.nextInt(); //此处接收操作命令
            if (oper == 1){
                rev = !rev; //如果操作命令为1，那么将逆序flag置反
            }else {
                int f = sc.nextInt();//此处接收添加命令。
                                     //如果添加命令为1就在头添加，如果添加命令为2就在末尾添加
                String cs = sc.next();
                Character c = cs.charAt(0);
                //这里是核心，如果添加命令为在头添加
                // 在头部添加的情况：本身在头部添加，或者是到转后在尾部添加
                // 他这样写的原因是因为本身rev他定义的是false
                if((f == 1 && !rev) || (f == 2 && rev)){
                    dq.addFirst(c);
                }else {
                    dq.addLast(c);
                }

            }
        }
        
        StringBuilder sb = new StringBuilder();

        while (!dq.isEmpty()){
            sb.append(dq.pollFirst());
        }
        System.out.println(rev==false?sb:sb.reverse());
    }
}


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

#define int long long 
#define EB emplace_back
#define N 100005

using namespace std;

const string yy = "Yes";
const string nn = "No";

int arr[N];


int32_t main()
{



	int tt = 1;
	//cin>>tt;
	while(tt--)
	{
		int n; cin>>n;
		
		for (int i = 0; i < n; ++i)
		{
			cin>>arr[i];
		}
		int ans = LLONG_MAX;

		for(int i=1;i<=101;i++)
		{
			int a = 0;
			for(int j=0;j<n;j++)
			{
				 a += (arr[j]-i)*(arr[j]-i);
			}
			ans = min(ans,a);
		}
		cout<<ans<<endl;
		
	}
	
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define all(x) (x).begin(),(x).end()
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; }
typedef long long ll;
const long long INF = 1LL << 60;
typedef pair<int, int> P;
int main()
{
    ll N;
    cin >> N;

    string ans = "";
    while (N != 0) {
        int a = N % 26;
        if (a == 0) a = 25;
        else a--;
        ans += ('a' + a);
        N /= 26;
        if (a == 25) N--;
    }

    reverse(all(ans));

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


Measured memory_bytes: 3632
import java.util.*;
import java.io.PrintWriter;
import static java.lang.Integer.*;
import static java.lang.Long.*;
import static java.lang.Math.*;
import static java.lang.System.*;

public class Main {
	public static int N = 201;
	public static int[][] gcdarr = new int[N][N];
	public static void main(String[] args) {
		int i,j,l;
		Scanner sc = new Scanner(in);
		int k = parseInt(sc.next());
		sc.close();
		long sum=0;
		for (i = 1; i <= k; i++) {
			for (j = 1; j <= k; j++) {
				for (l = 1; l <= k; l++) {
					sum+=gcm(gcm(i, j), l);
				}
			}
		}
		out.println(sum);
	}
	public static int gcm(int a, int b) {
//		out.printf("a,b=%d,%d%n", a, b);
		if(gcdarr[a][b]!=0) return gcdarr[a][b];
		int c=a;
		int d=b;
		int tmp;
		while((tmp=a%b)!=0) {
			a=b;
			b=tmp;
		}
		gcdarr[c][d] = gcdarr[d][c] = b; 
		return b;
	}
}


Measured memory_bytes: 27736
use std::cmp;

fn main(){
  let n: usize = read();
  let m: usize = read();

  let mut dm: Vec<Vec<u32>> = vec![vec![std::u32::MAX / 4;n];n];
  
  for _ in 0 .. m {
    let abcd: Vec<u32> = read_vec();
    let a = (abcd[0] - 1) as usize;
    let b = (abcd[1] - 1) as usize;
    let c = abcd[2];
    let d = abcd[3];
    dm[a][b] = c;
    dm[b][a] = d;
  }

  let sgvp: Vec<u32> = read_vec();
  let s = (sgvp[0] - 1) as usize;
  let g = (sgvp[1] - 1) as usize;
  let v = sgvp[2];
  let p = sgvp[3];
  
  for k in 0 .. n {
    for i in 0 .. n {
      for j in 0 .. n {
        dm[i][j] = cmp::min(dm[i][j], dm[i][k] + dm[k][j]);
      }
    }
  }

  let ans: u32 = v - p - dm[s][g] - dm[g][s];
  
  println!("{}", ans);
}

fn read<T>() -> T
  where T: std::str::FromStr,
        T::Err: std::fmt::Debug
{
  let mut buf = String::new();
  std::io::stdin().read_line(&mut buf).expect("failed to read");
  buf.trim().parse().unwrap()
}

fn read_vec<T>() -> Vec<T>
  where T: std::str::FromStr,
        T::Err: std::fmt::Debug
{
  let mut buf = String::new();
  std::io::stdin().read_line(&mut buf).expect("failed to read");
  buf.trim().split(',').map(|e| e.parse().unwrap()).collect()
}



Measured memory_bytes: 5036
#include<stdio.h>
#include<math.h>

#define Pi 3.1415926535

int main(void){

  double x=0, y=0;
  int step, turn; 
  double theta=90.0;

  while(1){
    scanf("%d,%d", &step, &turn);
    if(step==0 && turn==0) break;
   
    x += (step*cos(theta/180.0 * Pi));
    y += (step*sin(theta/180.0 * Pi));
    theta -= turn;
  
  }

  printf("%d\n%d\n", (int)x, (int)y);

  return(0);
}



Measured memory_bytes: 2028
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define pf push_front
#define popb pop_back
#define popf pop_front
#define F first
#define S second
#define mp make_pair
#define PII pair<int,int>
#define PLL pair<long long,long long>
#define pq priority_queue
#define M map
#define UM unordered_map
#define graph unordered_map<int,vector<int>>
#define graphw unordered_map<int,vector<pair<int,int>>>
#define V vector
#define mod 1000000007
#define inf 3000000000000000007ll
#define P pair
#define Fast ios_base::sync_with_stdio(false);cin.tie();cout.tie();
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(), a.rend()
#define sz(a) signed(a.size())
#define FIXED cout << fixed << setprecision(12)
#define L list
#define D deque
#define ld long double
#define FILE_READ_IN freopen("input.txt","r",stdin);
#define FILE_READ_OUT freopen("output.txt","w",stdout);
#define deb(x) cout<<#x<<" "<<x<<endl;
using namespace std;
// pair operation
template<class T, class U>istream& operator>>(istream& in, pair<T, U> &rhs) {in >> rhs.first; in >> rhs.second; return in;}
template<class T, class U>ostream& operator<<(ostream& out, const pair<T, U> &rhs) {out << rhs.first; out << " "; out << rhs.second; return out;}
template<class T, class U>pair<T, U> operator+(pair<T, U> &a, pair<T, U> &b) {return pair<T, U>(a.first + b.first, a.second + b.second);}
template<class T, class U>pair<T, U> operator-(pair<T, U> &a, pair<T, U> &b) {return pair<T, U>(a.first - b.first, a.second - b.second);}
// Linear STL
// VECTOR
template<class T>istream& operator>>(istream& in, vector<T> &a) {for (auto &i : a)cin >> i; return in;}
template<class T>ostream& operator<<(ostream& out, const vector<T> &a) {for (auto &i : a)cout << i << " "; return out;}
// SET
template<class T>ostream& operator<<(ostream& out, const set<T> &a) {for (auto &i : a)cout << i << " "; return out;}
template<class T>ostream& operator<<(ostream& out, const unordered_set<T> &a) {for (auto &i : a)cout << i << " "; return out;}
template<class T>ostream& operator<<(ostream& out, const multiset<T> &a) {for (auto &i : a)cout << i << " "; return out;}
// MAP
template<class T, class U>ostream& operator<<(ostream& out, const map<T, U> &a) {for (auto &i : a)cout << "(" << i.first << ", " << i.second << "(\n"; return out;}
template<class T, class U>ostream& operator<<(ostream& out, const unordered_map<T, U> &a) {for (auto &i : a)cout << "(" << i.first << ", " << i.second << "(\n"; return out;}
struct custom_hash {
	static uint64_t splitmix64(uint64_t x) {
		// http://xorshift.di.unimi.it/splitmix64.c
		x += 0x9e3779b97f4a7c15;
		x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
		x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
		return x ^ (x >> 31);
	}

	size_t operator()(uint64_t x) const {
		static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
		return splitmix64(x + FIXED_RANDOM);
	}
};


void judge() {
#ifndef ONLINE_JUDGE
	FILE_READ_IN
	FILE_READ_OUT
#endif
}

int main() {
	Fast;
	int t = 1;
	judge();
	// cin >> t;
	while (t--) {
		string s;
		cin >> s;
		if (s[1] == 'R') {
			cout << "ABC";
		}
		else {
			cout << "ARC";
		}
	}
}


Measured memory_bytes: 3580
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int A=sc.nextInt(),B=sc.nextInt();
		int C=Math.max(A+B, A-B);
		int ans=Math.max(C, A*B);
		System.out.println(ans);
		
		
	}
}


Measured memory_bytes: 21844
// A Way to Invite Friends(友だちの誘い方)
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=2331&lang=ja
package main

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

const N_MAX = 1000001

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)

	n := nextInt(sc)
	allow_list := make([]int, N_MAX+100)
	nMax := 0

	for i := 0; i < n; i++ {
		a, b := nextInt(sc), nextInt(sc)
		allow_list[a] += 1
		allow_list[b+1] += -1
		nMax = int(math.Max(float64(nMax), float64(b)))
	}

	for i := 2; i <= N_MAX; i++ {
		allow_list[i] += allow_list[i-1]
	}

	res := 0
	for i := 2; i <= nMax; i++ {
		if i-1 <= allow_list[i] { // i人誘う時に行きたい人の人数を超えないか(自分を含めて)
			res = i - 1 // 自分は除く
		}
	}

	fmt.Println(res)
}

func nextInt(sc *bufio.Scanner) int {
	sc.Scan()
	i, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return i
}



Measured memory_bytes: 10768
#include<stdio.h>
int main(void)
{
	int x,i;
	char a[8][4]={"fri","sat","sun","mon","tue","wed","thu"};
	scanf("%d",&x);
	if(x%7!=0) printf("%s\n",a[x%7-1]);
	else printf("thu\n");
}	


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

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

  int tmp, r;
  if(a < b){
    tmp = a;
    a = b;
    b = tmp;
  }

  r = a%b;
  while(r!=0){
    a = b;
    b = r;
    r = a%b;
  }

  return b;
}

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

  vector<int>a(n+2,0);
  for(int i=1; i<=n; i++){
    cin >>a[i];
  }

  vector<int>b(n+2,0);
  b[1]=a[1];
  for(int j=2; j<=n; j++){
    b[j]=gcd(b[j-1],a[j]);
  }

  vector<int>c(n+2,0);
  c[n]=a[n];
  for(int k=n-1; k>0; k--){
    c[k]=gcd(c[k+1],a[k]);
  }

  int ans=0;
  for(int m=1; m<=n; m++){
    if(gcd(b[m-1],c[m+1])>ans){
      ans=gcd(b[m-1],c[m+1]);
    }
  }
  cout <<ans <<endl;
}



Measured memory_bytes: 1408
N = int(input())
H = list(map(int, input().split()))

dp = [None] * N

idx = 0
idx_max = 0
dp[0] = H[0]

for h in H[1:]:
    if h <= dp[idx]:
        dp[idx + 1] = h
        idx = idx + 1
        if idx > idx_max:
            idx_max = idx
    else:
        idx = 0
        dp[0] = h

print(idx_max)

# dp list 必要?


Measured memory_bytes: 14252
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>

#define MAX_N 100000
#define INF 1000000

using namespace std;

typedef pair<int, int> P;

long d[2][MAX_N];
int N; 
void dijkstra(vector<P> G[], int k, int i) { //Gは隣接行列 G[i][j].firstが距離, secondが向かう頂点名, kはスタートする頂点
    fill(d[i], d[i]+N, INF); d[i][k] = 0;
    priority_queue< P, vector<P>, greater<P> > que;
    que.push(P(0, k));
    while (!que.empty()) {
        P p = que.top(); que.pop();
        int now = p.second;
        if (d[i][now] < p.first) continue;
        for (size_t j=0; j<G[now].size(); j++) {
            int to = G[now][j].second; long newd = G[now][j].first + d[i][now];
            if (d[i][to] > newd) {
                d[i][to] = newd;
                que.push(P(d[i][to], to));
            }
        }
    }
}

int main() {
    cin >> N;
    vector<P> G[N];
    for (int i=0; i<N-1; i++) {
        int a, b;
        cin >> a >> b;
        a--; b--;
        G[a].push_back({1, b});
        G[b].push_back({1, a});
    }
    dijkstra(G, 0, 0);
    dijkstra(G, N-1, 1);
    int fencnt=0;
    for (int i=0; i<N; i++)
        if (d[0][i] <= d[1][i]) 
            fencnt++;
    // cerr << "DEBUG" << '\n';
    // for (int i=0; i<N; i++) cerr << d[0][i] << ' ' << d[1][i] << '\n';
    // cerr << fencnt << '\n';
    cout << (fencnt > N - fencnt ? "Fennec" : "Snuke") << '\n';
    return 0;
}

Measured memory_bytes: 8048
#include <iostream>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <list>
#include <vector>
#include <complex>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <bitset>
#include <ctime>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cassert>
#include <cstddef>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <sstream>
#include <fstream>

using namespace std;
#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define FOR(i, a, b) for (int (i) = (a); (i) < (b); (i)++)
#define RREP(i, a) for(int (i) = (a) - 1; (i) >= 0; (i)--)
#define FORR(i, a, b) for(int (i) = (a) - 1; (i) >= (b); (i)--)
#define DEBUG(C) cerr << #C << " = " << C << endl;
using LL = long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VL = vector<LL>;
using VVL = vector<VL>;
using VD = vector<double>;
using VVD = vector<VD>;
using PII = pair<int, int>;
using PDD = pair<double, double>;
using PLL = pair<LL, LL>;
using VPII = vector<PII>;
#define ALL(a) begin((a)), end((a))
#define RALL(a) rbegin((a)), rend((a))
#define SORT(a) sort(ALL((a)))
#define RSORT(a) sort(RALL((a)))
#define REVERSE(a) reverse(ALL((a)))
#define MP make_pair
#define FORE(a, b) for (auto &&a : (b))
#define FIND(s, e) ((s).find(e) != (s).end())
#define EB emplace_back

const int INF = 1e9;
const int MOD = INF + 7;
const LL LLINF = 1e18;

vector<string> C;
vector<vector<bool>> used;
int MH, MW;
#define H first
#define W second
bool inside(int h, int w) {
    return 0 <= h && h < MH && 0 <= w && w < MW;
}
bool inside(PII p){return inside(p.H, p.W);}
int dh[] = {-1, 0, 0, 1};
int dw[] = {0, -1, 1, 0};
int dfs(PII now) {
    int res = 1;
    if (used[now.H][now.W]) return 0;
    used[now.H][now.W] = true;
    REP(i, 4) {
        auto buf = MP(now.H + dh[i], now.W + dw[i]);
        if (!inside(buf)) continue;
        if (C[buf.H][buf.W] == '.') res += dfs(buf);
    }
    return res;
}
void solve(int w, int h) {
    MH = h; MW = w;
    C.resize(h);
    used.resize(h, vector<bool>(w, false));
    PII start;
    REP(i, h) {
        cin >> C[i];
        REP(j, w) {
            if (C[i][j] == '@') start = MP(i, j);
        }
    }
    //cout << start.H << " " << start.W << endl;
    cout << dfs(start) << endl;
    used.clear();
    return;
}

int main(void) {
    int n, p, m, w, h;
    string s;
    int a, b, c;
    while (cin >> w >> h) {
        if (w == 0 && h == 0) return 0;
        solve(w, h);
        //return 0;
    }
}

Measured memory_bytes: 3216
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
const double PI = 3.14159265358979323846;

int main() {
  int a, b, k;
  cin >> a >> b >> k;
  queue<int> d;
  for(int i = min(a, b); i >= 1; i--) {
    if(a % i == 0 && b % i == 0) {
      d.push(i);
    }
  }
  for(int i = 0; i < k - 1; i++) {
    d.pop();
  }
  cout << d.front() << endl;
}

Measured memory_bytes: 3604
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,n) for (int i=1;i<=n;i++)
#define REP(i,a,b) for (int i=a;i<=b;i++)
 
#define pb push_back
#define fi first
#define se second
#define pi pair<int,int>
#define mp make_pair
#define sz(x) ((int)(x).size())
 
typedef long long ll;

const int inf=0x3f3f3f3f;
const ll linf=1e18;
const int N=200000+10;
const double eps=1e-5;
const int mo=1e9+7;

int n;
vector<int> v[N];
int fa[N];
ll D[N];
int sz[N];
struct node {
	int id;
	ll v;
} a[N];
bool used[N];
bool cmp(node x,node y) {
	return x.v<y.v;
}
int F(int x) {
	return (fa[x]==x)?x:(fa[x]=F(fa[x]));
}
int find(ll x) {
	int l=1,r=n;
	int mid;
	while (l<=r) {
		mid=(l+r)>>1;
		if (a[mid].v<x) {
			l=mid+1;
		} else if (a[mid].v>x) {
			r=mid-1;
		} else return a[mid].id;
	}
	return 0;
}
void dfs(int x,int s,int d,int f) {
	D[s]+=d;
	int t;
	for (int i=0;i<(int)v[x].size();i++) {
		t=v[x][i];
		if (t!=f) {
			dfs(t,s,d+1,x);
		}
	}
}
bool check() {
	dfs(a[1].id,a[1].id,0,0);
	if (D[a[1].id]!=a[1].v) return 0;
	return 1;
}
int main() {
 
    std::ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);
	scanf("%d",&n);
	int x,y;
	FOR(i,n) {
		scanf("%lld",&a[i].v);
		a[i].id=i;
	}
	sort(a+1,a+1+n,cmp);
	FOR(i,n) sz[i]=1,fa[i]=i;
	ll t;
	for (int i=n;i>=2;i--) {
		x=a[i].id;
		t=a[i].v-n+2*sz[x];
		//cout<<x<<" "<<t<<endl;
		y=find(t);
		if (F(x)==F(y)||used[y]||y==0) {
			cout<<-1<<endl;
			return 0;
		}
		v[x].pb(y);
		v[y].pb(x);
		sz[y]+=sz[x];
		fa[F(x)]=F(y);
		used[x]=1;
		// used[x]=1表示x的所有儿子都已经找到了，之后如果还有点想插入x当儿子就是无解的 
	}
	if (!check()) {
		cout<<-1<<endl;
		return 0;
	}
	FOR(i,n) {
		for (int j=0;j<(int)v[i].size();j++) {
			y=v[i][j];
			if (i<y) {
				printf("%d %d\n",i,y);
			}
		}
	}
	return 0;
}

Measured memory_bytes: 19200
N = int(input())
d = {}
for a in list(map(int, input().split())):
    if not a in d.keys():
        d[a] = 0
    d[a] += 1

w = 0
h = 0
for k in sorted(d.keys()):
    if d[k] >= 2:
        h = w
        w = k
    if d[k] >= 4:
        h = w

print(h*w)

Measured memory_bytes: 17936
#include <stdio.h>

#define SWAP(A,B) \
  { \
    int tmp = (A); \
    (A) = (B); \
    (B) = tmp; \
  }

static const char * oprs = "+-*";

static int
eval (
  char  op,
  int   lt,
  int   rt
  )
{
  int res = lt;

  switch ( op )
  {
    case '+': res += rt; break ;
    case '-': res -= rt; break ;
    case '*': res *= rt; break ;
  }

  return ( res );
}

/** Application main entry point. */
int
main (
  int     argc,
  char  * argv[ ]
  )
{
  int I, J, K, L;
  int i, j, k;

  for ( ; ; )
  {
    int d[ 4 ];

    scanf ( "%d%d%d%d", d, d + 1, d + 2, d + 3 );
    if ( !( d[ 0 ] | d[ 1 ] | d[ 2 ] | d[ 3 ] ) ) break ;

    for ( L = 0; L < 2; ++L )
    {
      for ( K = 0; K < 2; ++K )
      {
        for ( J = 0; J < 2; ++J )
        {
          for ( I = 0; I < 2; ++I )
          {
            for ( k = 0; k < 3; ++k )
            for ( j = 0; j < 3; ++j )
            for ( i = 0; i < 3; ++i )
            {
#define E(OP,LT,RT) \
  eval ( oprs[ OP ], LT, RT )
#define P(FMT) \
  printf ( FMT \
    , d[ 0 ], oprs[ i ], d[ 1 ], oprs[ j ], d[ 2 ], oprs[ k ], d[ 3 ] );
            if ( E( k, E( j, E( i, d[ 0 ], d[ 1 ] ), d[ 2 ] ), d[ 3 ] ) == 10 )
              { P( "(((%d %c %d) %c %d) %c %d)\n" ); goto ESC; }
            if ( E( k, E( i, d[ 0 ], E( j, d[ 1 ], d[ 2 ] ) ), d[ 3 ] ) == 10 )
              { P( "((%d %c (%d %c %d)) %c %d)\n" ); goto ESC; }
            if ( E( j, E( i, d[ 0 ], d[ 1 ] ), E( k, d[ 2 ], d[ 3 ] ) ) == 10 )
              { P( "((%d %c %d) %c (%d %c %d))\n" ); goto ESC; }
            if ( E( i, d[ 0 ], E( j, d[ 1 ], E( k, d[ 2 ], d[ 3 ] ) ) ) == 10 )
              { P( "(%d %c (%d %c (%d %c %d)))\n" ); goto ESC; }
            if ( E( i, d[ 0 ], E( k, E( j, d[ 1 ], d[ 2 ] ), d[ 3 ] ) ) == 10 )
              { P( "(%d %c ((%d %c %d) %c %d))\n" ); goto ESC; }
#undef P
#undef E
            }
            SWAP( d[ 0 ], d[ 1 ] );
          }
          SWAP( d[ 1 ], d[ 2 ] );
        }
        SWAP( d[ 2 ], d[ 3 ] );
      }
      SWAP( d[ 3 ], d[ 0 ] );
    }
  puts ( "0" );

ESC: ;
  }

  return ( 0 );
}

Measured memory_bytes: 0
#include <iostream>
#include <iomanip>
#include<math.h>
#include<list>
#include <algorithm>
#include<set>
#include<vector>
#include<math.h>
#include<map>
#include<string>
#include <numeric>
#include <queue>
#include <sstream>

using namespace std;
using ll = long long;
using vll = vector<long long>;
using sll = set<long long>;

template<typename T>
T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template<typename T>
T lcm(T a, T b) { return a / gcd(a, b) * b; }

template<typename T>
map<T, T> primeFactor(T n) {
	map<T, T> res;
	for (T i = 2; i * i <= n; ++i) {
		while (n % i == 0) {
			res[i] ++;
			n /= i;
		}
	}
	if (n != 1) res[n] = 1;
	return res;
}

template<typename T>
bool IsPrimeNumber(T num)
{
	if (num <= 2) return true;
	else if (num % 2 == 0) return false;

	double sqrtNum = sqrt(num);
	for (int i = 3; i <= sqrtNum; i += 2)
	{
		if (num % i == 0)
		{
			return false;
		}
	}

	return true;
}


#define in(x) cin >> x
#define out(x) cout << x
#define outn(x) cout << x << '\n'
#define outs(x) cout << x << ' '
#define rep(i,s,e) for(ll i=s;i<e;i++)
#define repeq(i,s,e) for(ll i=s;i<=e;i++)





int main() {
	ll r;
	in(r);
	outn(3 * r * r);

	return 0;

}


Measured memory_bytes: 256
// Best practice

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file 
#include <ext/pb_ds/tree_policy.hpp> 
#include <ext/pb_ds/detail/standard_policies.hpp>
#include <functional> // for less 

#define int         long long
#define pb          emplace_back
#define pf          emplace_front
#define all(a)      (a).begin(),(a).end()
#define rall(a)     (a).rbegin(),(a).rend()
#define x           first
#define y           second
#define endl        '\n'
#define tezz        ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
using namespace std;
using namespace __gnu_pbds; 
 
typedef tree<pair<int,int>, null_type, less<pair<int,int>>, rb_tree_tag, tree_order_statistics_node_update> pbds; 

#define fbo find_by_order
#define ook order_of_key

signed main() {
   tezz
   
   int h,a;
   cin >> h >> a;
   cout << ((h/a) + (h%a!=0));
  
   return 0;
}




Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    long long int n,num[120]={0},ans=0,k;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>num[i];
    }
    long long int dp[200][200]={0};
    dp[0][num[0]]=1;
    for(int i=1;i<n-1;i++){
        for(int j=0;j<=20;j++){
            if(dp[i-1][j]>0){
                int sum=j+num[i];
                if(sum<=20)dp[i][sum]+=dp[i-1][j];
                sum=j-num[i];
                if(sum>=0)dp[i][sum]+=dp[i-1][j];
            }
        }
    }
    cout<<dp[n-2][num[n-1]]<<endl;
    return 0;
}

Measured memory_bytes: 3408
#include<cstdio>
#include<string.h>
#include<algorithm>
#include<iostream>
#include<vector>
#include<queue>
#include<cmath>
#define ll long long
using namespace std;
char s[1000001];
int main()
{
   //freopen("data.in","r",stdin);
   //freopen("data.out,"w",stdout);
   cin>>s;
   int flag=0;
   for(int i=0;i<strlen(s);i++)
   if(s[i]=='9')
   flag=1;
   if(flag)
   cout<<"Yes"<<endl;
   else
   cout<<"No"<<endl;
   return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
  
using namespace std;
  
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define repr(i, n) REPR(i, n, 0)
#define REPR(i, s, e) for(int i=(int)(s-1); i>=(int)(e); i--)
#define pb push_back
#define all(r) r.begin(),r.end()
#define rall(r) r.rbegin(),r.rend()
#define fi first
#define se second
  
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
const int INF = 1e9;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;

int main(){
    int n;
    cin >> n;
    vi a(n);
    rep(i, n) cin >> a[i];
    int sum = 0LL;
    rep(i, n) sum += a[i];
    int m = 0;
    rep(i, n) {
        if(abs(a[i]*n-sum) < abs(a[m]*n-sum)) m = i;
    }
    cout << m << endl;
    return 0;
}

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

public class Main {

	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		PrintWriter out = new PrintWriter(System.out);
		int n = sc.nextInt();
		int m = sc.nextInt();
		int cnt = 0;
		int left = -1, right = Integer.MAX_VALUE / 10;
		for(int i = 0; i < m; i++) {
			int L = sc.nextInt();
			int R = sc.nextInt();
			if (L > left) left = L;
			if (R < right) right = R;
		}
		int ans = right - left + 1;
		if (ans < 0) ans = 0;
		
		out.println(ans);

		out.close();
	}

static class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
    private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
    public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    public long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true){
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return minus ? -n : n;
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
        return (int) nl;
    }
    public double nextDouble() { return Double.parseDouble(next());}
}
}

Measured memory_bytes: 22996
#include<stdio.h>
#include<string.h>
char map[102][104];

void flaging(int y,int x,char kind){
  int i,dir[][2]={{1,0},{-1,0},{0,1},{0,-1}};
  map[y][x]='F';
  for(i=0;i<4;i++){
    if(map[y+dir[i][0]][x+dir[i][1]]==kind){
      flaging(y+dir[i][0],x+dir[i][1],kind);
    }
  }
}
int main(){
  int i,j,h,w,count;
  char *ind;
  do{
    fgets(map[0],100,stdin);
    ind=strchr(map[0],' ');
    *ind='\0';
    h=atoi(map[0]);
    w=atoi(ind+1);
    if(!h&&!w) break;
    h++; w++;
    for(i=1;i<h;i++) fgets(map[i]+1,103,stdin);
    for(i=1,count=0;i<h;i++){
      for(j=1;j<w;j++){
	if(map[i][j]!='F'){	  
	  flaging(i,j,map[i][j]);
	  count++;
	}
      }
    }
    printf("%d\n",count);
  }while(1);
  return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define int int64_t
#define rep(i, N) for(int i=0; i<N; i++)
using namespace std;
using pair = pair<int, int>;
using tup  = tuple<int, int, int>;
using vec  = vector<int>;
using vvec = vector<vec>;
// " ", ' '
// std::string str;
// str = std::to_string(int i);

// プロトタイプ宣言
// int myfunc(int, vvec);

// グローバル変数
// int N, M;
// vvec data(N, vec(M));

// 関数：

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	int N; cin >> N;
	vec B(N+1, 0);
	rep(i, N-1) cin >> B.at(i);

	int ans = B.at(0)+B.at(N-2);
	for(int i=1; i<N-1; i++) {
		ans += min(B.at(i-1), B.at(i));
	}

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


Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;
import java.util.function.Consumer;
import java.util.stream.IntStream;

import static java.util.stream.Collectors.toList;

public class Main {
    private static final Scanner scanner = new Scanner(System.in);
    private static final Consumer<List<String>> consumer = solve();

    public static void main(String[] args) {
        consumer.accept(readInput());
    }

    private static List<String> readInput() {
        final List<String> lineList = new ArrayList<>();
        while (scanner.hasNextLine()) {
            lineList.add(scanner.nextLine());
        }
        return lineList;
    }

    private static Consumer<List<String>> solve() {
        return args -> {
            final List<Integer> numList = Arrays.stream(args.get(1).split(" ")).map(Integer::valueOf).collect(toList());
            final Long dividedBy2ButNot4 = numList.stream().filter(x -> x % 2 == 0 && x % 4 != 0).mapToInt(Integer::intValue).count();
            final Long dividedBy4 = numList.stream().filter(x -> x % 4 == 0).mapToInt(Integer::intValue).count();
            final Long numListSizeIgnoringMultiple2 = numList.size() - (dividedBy2ButNot4 > 0 ? dividedBy2ButNot4 - 1 : 0);
            System.out.println(numListSizeIgnoringMultiple2 - dividedBy4 - 1 <= dividedBy4 ? "Yes" : "No");
        };
    }

}


Measured memory_bytes: 47856