akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
// statics
using namespace std;
using int64 = int_fast64_t;
using PAIR = pair<int64, int64>;
constexpr int INF = 1 << 30;
constexpr int64 LINF = 1LL << 60;
constexpr int MOD = 1e9 + 7;
constexpr int MAX_N = 3e5 + 1;

// init/input
#define int int64
#define INIT ios::sync_with_stdio(false);cin.tie(0);
#define VAR(type, ...) type __VA_ARGS__;MACRO_VAR_Scan(__VA_ARGS__);
template<typename T> void MACRO_VAR_Scan(T &t) {cin>>t;}
template<typename First, typename...Rest> void MACRO_VAR_Scan(First &first, Rest&...rest) {cin>>first;MACRO_VAR_Scan(rest...);}
#define VEC(type, c, n) vector<type> c(n);for(auto &&i:c)cin>>i;

// out
#define OUT(dist) cout<<(dist);
#define FOUT(n, dist) cout<<fixed<<setprecision(n)<<(dist);
#define SP cout<<" ";
#define BR cout<<endl;
#define zero(n) cout<<setfill('0')<<right<<setw(n)
#define debug(x) cerr<<#x<<":"<< (x);BR;

// utility
#define ALL(a) (a).begin(), (a).end()
#define EACH(i, a) for(auto &&i:(a))
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define RFOR(i, a, b) for(int i=(b)-1;i>=0;--i)
#define REP(i, n) for(int i=0;i<(n);++i)
#define RREP(i, n) for(int i=(n)-1;i>=0;--i)

signed main() {
  INIT;
	VAR(int,a,b,q);
	VEC(int,s,a);
	VEC(int,t,b);
	sort(ALL(s));
	sort(ALL(t));
	
	while(q--){
		VAR(int,x);

		int si = (lower_bound(ALL(s), x) - s.begin());
		int ti = (lower_bound(ALL(t), x) - t.begin());

		int ans=LINF;
		FOR(sj,-1,2){
			FOR(tj,-1,2){
				int sk = INF, tk=INF;
				if(0<=si+sj && si+sj<s.size()) sk=(s[si+sj]-x);
				if(0<=ti+tj && ti+tj<t.size()) tk=(t[ti+tj]-x);
				if(sk==INF || tk==INF) continue;
				if((0<= sk && 0<= tk) ||  (0 >= sk && 0 >= tk)) ans = min(ans,max(abs(sk),abs(tk)));
				if((sk<0 && tk<0) || (sk>=0 && tk>=0)) ans = min(ans,abs(sk)+abs(tk));
				else ans=min(ans,abs(sk)+abs(tk)+min(abs(sk),abs(tk)));
				// debug(sk);
				// debug(tk);
				// debug(ans);
			}
		}
		OUT(ans)BR;
	}
  
  return 0;
}


Measured memory_bytes: 2944
#include <bits/stdc++.h>
#include <cassert>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
struct Edge
{
  int to;
  int weight;
  Edge(int t, int w) : to(t), weight(w) {}
};
// using Graph = vector<vector<Edge>>;
using Graph = vector<vector<int>>;

const long long INF = 1LL << 60;
const int INT_INF = 1000000000;

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

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  ll N, M;
  cin >> N >> M;
  vector<ll> v[100001];
  for (int i = 0; i < N; i++)
  {
    ll a, b;
    cin >> a >> b;
    v[a].push_back(b);
  }
  priority_queue<ll> que;
  ll ans = 0;
  for (int i = 1; i <= M; i++)
  {
    for (auto it : v[i])
    {
      que.push(it);
    }
    if (!que.empty())
    {
      ans += que.top();
      que.pop();
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 5632
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<limits>
#include<iomanip>
#include<cmath>
#include<climits>

using namespace std;

typedef long long ll;
typedef pair<int,int> P;

const int mod=1e9+7;

int main(){
    string s;
    cin >> s;
    int s1=0,s2=0;
    s1+=s[1]-'0'+10*(s[0]-'0');
    s2+=s[3]-'0'+10*(s[2]-'0');
    //cout << s1 << " " << s2 << endl;
    if(1<=s1&&s1<=12){
        if(1<=s2&&s2<=12){
            cout << "AMBIGUOUS" << endl;
        }else{
            cout << "MMYY" << endl;
        }
    }else{
        if(1<=s2&&s2<=12){
            cout << "YYMM" << endl;
        }else{
            cout << "NA" << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
long L,R,ans=2020;
main() {
	cin >> L >> R;
	for(long l=L; l<L+2020; l++) {
        for(long r=R; r>R-2020; r--) {
		    if (l<r) {
                ans = min(ans, l%2019*r%2019);
            }
	    }
    }
	cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <climits>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <string>
#include <deque>
#define INF_INT (INT_MAX / 2)
#define INF_LONG (LONG_MAX / 2)
//#define DEBUG true
#define DEBUG false
using namespace std;

const int MAX = 100001;
const int MOD = 1000000007;

typedef long long ll;
typedef pair< int, int > pii;
typedef pair< ll, ll > pll;
typedef pair< ll, int > pli;
typedef pair< int, ll > pil;

int ceil(int x, int y){
  return (x % y == 0) ? x / y : x / y + 1;
}

int gcd(int x, int y){
  return y ? gcd(y, x % y) : x;
}

int lcm(int x, int y){
  return x / gcd(x, y) * y;
}

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

  int n;
  cin >> n;
  string a, b, c;
  cin >> a >> b >> c;

  int count = 0;
  for(int i = 0; i < n; i++){
    if(a[i] == b[i] && b[i] == c[i]) continue;
    else if(a[i] == b[i] || b[i] == c[i] || a[i] == c[i]) ++count;
    else count += 2;
  }

  cout << count << endl;

  return 0;
}

Measured memory_bytes: 256
#pragma once
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <deque>
#include <numeric>
#include <iomanip>
#define M_PI acos(-1)
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int INF = 1000000007;
const int MAX_V = 201;
int now = 0;

const int MAX = 200000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
	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;
	}
}

// 二項係数計算
long long 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;
}
struct edge {
	int t;
	ll cost;
	edge(int _t, ll _cost) : t(_t)
		, cost(_cost) {
	}
};
bool isPrime(int n) {

	if (n == 1) return false;
	for (ll i = 2; i * i <= n; i++)
	{
		if (n % i == 0) return false;
	}
	return true;
}
void Solve() {
	
	int n;
	cin >> n;
	ll a[100010];
	for (size_t i = 0; i < n; i++)
	{
		cin >> a[i];
	}
	ll res = 0;
	for (size_t i = 0; i < n - 1; i++)
	{
		res += a[i] / 2;
		if (a[i] % 2) {
			if (a[i + 1] > 0) {
				a[i + 1]--;
				res++;
			}
		}
	}
	res += a[n - 1] / 2;
	cout << res << endl;
}
int main() {
	Solve();
	return 0;
}



Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;++i)
#include<string>
using namespace std;
typedef long long ll;
int gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	while (b) {
		int r = a % b;
		a = b;
		b = r;
	}
	return a;
}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }

int main() {
	int r;
	cin >> r;
	cout << r * r << endl;
}

Measured memory_bytes: 256
import itertools

N = int(input())
P_n = tuple(map(int, input().split(' ')))
Q_n = tuple(map(int, input().split(' ')))

a = list(itertools.permutations(range(1, N+1))).index(P_n)
b = list(itertools.permutations(range(1, N+1))).index(Q_n)
print(abs(a-b))


Measured memory_bytes: 13848
#include<stdio.h>

int main() {
	int n = 1;
	scanf("%d",&n);
	int a[n];
	int a1[n];
	for(int i = 0;i<n;i++) {
		scanf("%d",&a[i]);
		a1[a[i]-1]=i+1;
	}
	
	printf("%d",a1[0]);
	for(int i = 1;i<n;i++) {
		printf(" %d",a1[i]);
	}
	return 0;
} 

Measured memory_bytes: 1536
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<double,int> pdi;
typedef pair<double,double> pdd;
typedef pair<double,ll> pdl;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef vector<vl> vvl;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<pdd> vdd;
typedef vector<pdi> vdi;
typedef vector<pdl> vdl;
typedef vector<string> vs;
#define fi first
#define se second
const ll INFLL=LLONG_MAX;
const int INF=INT_MAX;
const ll MAXLL=0x3f3f3f3f3f3f3f3f;
const int MAX=0x3f3f3f3f;
const ll MOD=1000000007;
const ll mod=998244353;
#define eb emplace_back
#define emp emplace
#define mp(a,b) make_pair(a,b)
template<class T> using min_heap=priority_queue<T,vector<T>,greater<T> >;
template<class T>
void sort(vector<T>& v){
	sort(v.begin(),v.end());
}
template <class T, class U>
void sort(vector<T>& v,U func){
	sort(v.begin(),v.end(),func);
}
template<class T>
void rsort(vector<T>& v){
	sort(v.rbegin(),v.rend());
}
template <class T>
int lb_index(vector<T>& v,T k){
	return lower_bound(v.begin(),v.end(),k)-v.begin();
}
template <class T>
int ub_index(vector<T>& v,T k){
	return upper_bound(v.begin(),v.end(),k)-v.begin();
}
template<class T>
bool is_sorted(vector<T>& v){
	return is_sorted(v.begin(),v.end());
}
template<class T>
bool sorted(vector<T>& v){
	return is_sorted(v);
}
void precompute(){

	return;
}
void solve(){
	int n;
	cin>>n;
	for(int i=1;i<10;i++){
		if(n%i==0&&(n/i)<10){
			cout<<"Yes\n";
			return;
		}
	}
	cout<<"No\n";
}

int main(){
	ios::sync_with_stdio(0);
	int numberofsubtestcases=1;
//	cin>>numberofsubtestcases;
	precompute();
	for(int looping=1;looping<=numberofsubtestcases;looping++){
//		cout<<"Case #"<<looping<<": ";
		solve();
	}
	return 0;
}

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

int sumsum(int n)
{
  int sum = 0;
  while (n>0)
  {
    sum += n %10;
    n /= 10;
  }
  
  return (sum);
}

int main()
{
  int n,a,b; cin >>n>>a>>b;
  
  int sum = 0;
  for (int i = 0; i <= n; i++)
  {
    if (sumsum(i) >=a && sumsum(i) <= b)
      sum += i;
  }
  cout << sum << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using Int = long long int;
template<typename T> void swap(T *t1, T *t2){ T* tmp=t1; t1=t2; t2=tmp;}
Int tmpi = 0;
double tmpd = 0.0;


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

    Int n, x;
    Int l[1000];
    cin >> n >> x;
    for(Int i=0; i<n; i++){
        cin >> l[i];
    }

    Int cnt = 0;
    Int d = 0;
    for(Int i=0; i<n; i++){
        if(d>x){
            break;
        }
        cnt++;
        d += l[i];
    }
    if(d<=x){
        cnt++;
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 256
N, M = gets.split.map &:to_i
G = Array.new(N){Array.new}
M.times do
  x, y, z = gets.split.map &:to_i
  x -= 1
  y -= 1
  G[x] << y
  G[y] << x
end

res = 0
used = Array.new(N)
N.times do |r|
  next if used[r]
  used[r] = true
  res += 1
  q = [r]
  until q.empty?
    u = q.shift
    G[u].each do |v|
      next if used[v]
      used[v] = true
      q << v
    end
  end
end
p res


Measured memory_bytes: 12540
#include <bits/stdc++.h>
#define ALL(obj) begin(obj), end(obj)
#define debug(x) cerr << #x << ": " << x << '\n'
using namespace std;
template <class T>
vector<T> make_vec(size_t a) {
    return vector<T>(a);
}
template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
template <class T>
bool chmax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}

using ll = long long;
using ull = unsigned long long;
const int INF = 1e9;
// const int MOD = 1e9 + 7;

int main() {
    ll N;
    cin >> N;
    vector<ll> A(N);
    for (int i = 0; i < N; i++) {
        cin >> A.at(i);
    }

    map<ll, ll> m;
    ll ans = 0;
    for (int i = 0; i < N; i++) {
        ans += m[i - A[i]];
        m[A[i] + i]++;
    }
    cout << ans << endl;
}


Measured memory_bytes: 27548
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
        int B = sc.nextInt();
        int K = sc.nextInt();
      
		ArrayList<Integer> al = new ArrayList<>();
      
      	Integer min = A;
      	if(A>B){
          min = B;
        }
      	for(int i = 1; i < min+1; i++){
          	if((A%i==0)&&(B%i==0)){
              al.add(i);
            }
        }
		System.out.println(al.get(al.size()-K));
	}
}

Measured memory_bytes: 21716
#include<bits/stdc++.h>
using namespace std;
int main ()
  {
    long long int n,i,j,k,l,sum=0;
    char s[200005];
    cin>>s;
    l=strlen (s);
    for(i=0; i<l; i++)
      {
        k=s[i]-'0';
        sum+=k;
      }
    if(sum%9==0)
      {
        cout<<"Yes"<<endl;
      }
   else{
        cout<<"No"<<endl;
       }
     return 0;
  }

Measured memory_bytes: 3772
#include <iostream>
#include <math.h>
#include <vector>
#include <algorithm>


using namespace std;

int main(){
  int  D,N;
  cin>>D>>N;
  if(N==100)cout<<int(101*pow(100,D))<<endl;
  else cout<<int(N*pow(100,D))<<endl;
  return 0;
}


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

int main() {
  int a,b;
  cin >> a >> b;
  vector<vector<char>> u(100,vector<char>(100));
  for (int i=0;i<50;i++){
      for (int j=0;j<100;j++){
          u.at(j).at(i)='.';
      }
  }
  for (int i=0;i<50;i++){
      for (int j=0;j<100;j++){
          u.at(j).at(i+50)='#';
      }
  }
  for (int i=0;i<b-1;i++){
      u.at((i%50)*2).at((i/50)*2)='#';
  }
  for (int i=0;i<a-1;i++){
      u.at((i%50)*2).at(99-(i/50)*2)='.';
  }
  cout << 100 << " " << 100 << endl;
  vector<string> s(100);
  for (int i=0;i<100;i++){
      for (int j=0;j<100;j++){
          s.at(i).push_back(u.at(j).at(i));
      }
      cout << s.at(i) << endl;
  }
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <functional>
#include <utility>
#include <tuple>
#include <cctype>
#include <bitset>
#include <complex>
#include <cmath>
#include <array>
using namespace std;
#define INF 0x3f3f3f3f
#define INFLL 0x3f3f3f3f3f3f3f3fLL
#define MOD 1000000007
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pint;
typedef pair<ll,ll> pll;
typedef tuple<int,int,int> tint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
int dx[8]={0,0,-1,1,1,1,-1,-1};
int dy[8]={-1,1,0,0,1,-1,1,-1};
const int SIZE=200050;
//ここまでテンプレ
int main(){
	int A,B;
	cin>>A>>B;
	cout<<(A-1)*(B-1)<<endl;
	return 0;
}

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

Measured memory_bytes: 128
n = gets.to_i
a = gets.split.map(&:to_i)

normals = a.select {|x| x < 3200}
experts = a.select {|x| x >= 3200}

colors = normals.map {|x| x / 400}.uniq.size

puts [
    [1, colors].max,
    colors + experts.size,
].join(' ')

Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vi2 = vector<vector<int>>;
using vb = vector<bool>;
using vb2 = vector<vector<bool>>;
using vc = vector<char>;
using vc2 = vector<vector<char>>;
using vs = vector<string>;
using si = set<int>;
using vs2 = vector<vector<string>>;
using pii = pair<int, int>;
using mii = map<int, int>;
const int INF = 1e9;
const ll LINF = 1e18;
#define MP(a,b) make_pair((a),(b))
#define MT(...) make_tuple(__VA_ARGS__)
#define sz(x) (int)(x).size()
 
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define REPS(i,x) for(int i=1;i<=(int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREPS(i,x) for(int i=((int)(x));i>0;i--)
 
#define ALL(x) (x).begin(),(x).end()
#define SORT(v) sort(ALL(v));
#define IN(type,a) type a;cin >> a;
#define VIN(type,a,n) vector<type> a(n);cin >> a;
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl;
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl;
#define COUT(x) cout << (x) << endl;
#define DCOUT(x,n) cout << fixed << setprecision(n) << (x) << endl;
#define ENDL cout << endl;
#define DB(s,x) cout << (s) << " : " << x << endl;

#define HOGE COUT("HOGE")

template<typename T>inline istream& operator>>(istream&i,vector<T>&v)
{REP(j,sz(v))i>>v[j];return i;}

template<typename T> bool chmax(T& a, const T& b){if(a<b){a=b;return true;}return false;}
template<typename T> bool chmin(T& a, const T& b){if(a>b){a=b;return true;}return false;}
int main() {
    IN(int, k);
    IN(string, s);
    if (s.length()<=k) {
        COUT(s);
    }else{
        cout << s.substr(0,k) << "..." << endl;
    }
}


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

using namespace std;

#define _int64 long long

int a[110000];
_int64 d[110000][32];

int main()
{
  _int64 ans;
  int i,j,n,pre,b1,tmp1,tmp2,tmp3,tmp4,mi,c0,c1,tmp;
  scanf("%d",&n);
  for (i=0;i<n;i++)
    scanf("%d",&a[i]);
  memset(d,-1,sizeof(d));
  d[0][0]=0;
  for (i=0;i<n;i++)
  {
    tmp=a[i];
    c0=0;c1=0;
    while (tmp!=1)
    {
      c0++;
      if (tmp%2==1) c1=1;
      tmp=(tmp+1)/2;
    }
    if ((c0>0)&&(c1==1))
    {
      c0--;
    }
    //cout<<"c:"<<c0<<" "<<c1<<endl;
    for (j=0;j<32;j++)
      if (d[i][j]!=-1)
      {
        tmp=d[i][j];
        tmp1=j;
        tmp2=c0;
        tmp3=c1;
        tmp4=0;
        if (tmp2>=tmp1)
        {
          tmp4=c0+c1;
        }
        else if (tmp2+tmp3>=tmp1)
        {
          tmp+=(tmp1-tmp2);
          tmp4=tmp2+tmp3-(tmp1-tmp2);
        }
        else
        {
          tmp4=tmp2;
          tmp+=tmp1-tmp2;
        }
        if ((d[i+1][tmp4]==-1)||(tmp<d[i+1][tmp4]))
          d[i+1][tmp4]=tmp;
        //cout<<"4: "<<tmp4<<" "<<tmp<<endl;
      }
  }
  ans=2000000000;
  for (i=0;i<32;i++)
    if (d[n][i]!=-1)
    {
      if (d[n][i]+i<ans) ans=d[n][i]+i;
    }
  printf("%lld\n",ans);
  return 0;
}

Measured memory_bytes: 28160
#include<stdio.h>
#include<string.h>

int main(){
	char a[105],b[105];
	scanf("%s %s",a,b);
	int lena = strlen(a);
	int lenb = strlen(b);
	if(lena > lenb) printf("GREATER");
	else if(lena < lenb) printf("LESS");
	else{
		int sum = 0;
		for(int i = 0; i < lena; i++){
			if(a[i] > b[i]){
				printf("GREATER");
				break;
			}
			if(a[i] < b[i]){
				printf("LESS");
				break;
			}
			if(a[i] == b[i]) sum++;
		}
		if(sum == lena) printf("EQUAL");
	}
}

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

int main()
{
  string ttt;
  cin >> ttt;
  string ans = "99999999999";
  int a = 0;
  for(int i = 0; i < ttt.size(); i++) {
    switch(ttt.at(i)) {
      case '0':
        ans.at(a) = '0';
        a++;
        break;
      case '1':
        ans.at(a) = '1';
        a++;
        break;
      case 'B':
        if(a > 0)
          a--;
          ans.at(a) = '9';
        break;
    }
  }
  int i = 0;
  while(ans.at(i) != '9') {
    cout << ans.at(i);
    i++;
  }
  cout << endl;
  
  return 0;
}

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

using i64 = int64_t;

using Weight = int;

struct Edge{
    int from, to;
    Weight weight;
};

using Graph = vector<vector<Edge>>;

constexpr Weight INF = 1e9;

Graph chu_liu_edmonds(const Graph &graph, const int root) {
    const int n = graph.size();

    // 頂点vに入る重み最小の辺でグラフを構築
    vector<Weight> min_weight(n, INF), prev(n, -1);
    for(int v=0;v<n;v++) {
        for(auto &e: graph[v]) {
            if(e.weight < min_weight[e.to]) {
                min_weight[e.to] = e.weight;
                prev[e.to] = v;
            }
        }
    }

    // 閉路の検出
    int cycle = -1;
    vector<int> groups(n), used(n, -1);
    iota(groups.begin(), groups.end(), 0);
    for(int v=0;v<n;v++) {
        if(used[v] != -1 || prev[v] == -1 || v == root) continue;

        int cur = v;
        do{
            used[cur] = v;
            cur = prev[cur];
        }while(cur != root && cur != -1 && used[cur] == -1);

        if(used[cur] != v)continue;
        cycle = cur;
        groups[cur] = cur;
        for(int u=prev[cur];u!=cur;u=prev[u])groups[u] = cur;
        break;
    }

    Graph res(n);
    if(cycle == -1) { // 閉路なし
        for(int v=0;v<n;v++) {
            if(prev[v] == -1 || v == root)continue;
            res[prev[v]].push_back({prev[v], v, min_weight[v]});
        }
    }else{ // 閉路あり
        Graph g(n);
        using E = tuple<int, int, Weight>;
        map<E, Edge> mp;
        for(int v=0;v<n;v++) {
            for(auto e: graph[v]) {
                int from = groups[v], to = groups[e.to], w = e.weight;
                if(from == to)continue;
                if(to == cycle)w -= min_weight[e.to];
                g[from].push_back({from, to, w});
                mp[E{from, to, w}] = {v, e.to, e.weight};
            }
        }

        Graph tree = chu_liu_edmonds(g, groups[root]);

        int u;
        for(int v=0;v<n;v++) {
            for(auto e: tree[v]) {
                Edge origin = mp[E{e.from, e.to, e.weight}];
                if(e.to == cycle)u = origin.to;
                res[origin.from].push_back(origin);
            }
        }

        for(int v=0;v<n;v++) {
            if(groups[v] != cycle || v == u)continue;
            res[v].push_back({prev[v], v, min_weight[v]});
        }
    }

    return res;
}

int main(){
    int v, e, r;
    cin >> v >> e >> r;
    Graph graph(v, vector<Edge>());
    for(int i=0;i<e;++i){
        int s, t, w;
        cin >> s >> t >> w;
        graph[s].push_back({s, t, w});
    }
    auto res = chu_liu_edmonds(graph, r);

    int ans = 0;
    for(int i=0;i<v;++i){
        for(auto edge: res[i]){
            ans += edge.weight;
        }
    }

    cout << ans << endl;

    return 0;
}



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

using namespace std;
using ll = long long;

int main(){
    int n; cin >> n;
    if(n%2==0) cout << 0.5 << endl;
    else{
        cout << (double)(((n-1)/2)+1)/n << endl;
    }

    return 0;
}

Measured memory_bytes: 256
import math
a,b,h,m = map(int,input().split())


def c(theta):
    return math.sqrt(a**2 + b**2 - 2*a*b*math.cos(theta))

M = h*60 + m
theta = abs(math.pi*M/360 - math.pi*M/30)
theta = min(360-theta,theta)

print(c(theta))

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

int main(){
    int N, R;
    cin >> N >> R;
    int Rating = 0;
    if (N < 10){
        Rating = R + (100 * (10 - N));
    }
    else{
        Rating = R;
    }
    cout << Rating << endl;
}

Measured memory_bytes: 256
#pragma comment(linker, "/stack:20000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx")
#include <stdio.h>
#include <bits/stdc++.h>

using namespace std;

#include <x86intrin.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
template <typename T> using ordered_set = tree<T, null_type, std::less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define all(x) x.begin(), x.end()

#define mp make_pair
#define in insert
#define er erase
#define con continue
#define pb push_back
#define sc scanf
#define pr printf
#define ub upper_bound
#define lb lower_bound
#define s second
#define f first
#define int long long

const long long infl = 1e18; 
const int N = 3e5 + 300, N2 = 2e3, inf = 1e9 + 200;

set <int> S;
vector <int> g;
int n, m, k;
int a[N];
string ss;

int ch(int l, int r){
//	cout << l << " " << r << endl;
	string x, y;
	for (; l <= r; l++){
		x += ss[l];
	}
	y = x;
	reverse(all(y));
	return (x == y);
}

main (){
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin >> ss;
	int size = ss.size();
	if (ch(0, size - 1) && ch(0, size / 2 - 1) && ch(size / 2 + 1, size - 1)){
		cout << "Yes";
	}
	else{
		cout << "No";
	}
	
	return 0;
}











Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main() {
	int N;

	cin >> N;

	if (N == 1) {
		cout << "Hello World" << endl;
	}
	else if (N == 2) {
		int A, B;
		cin >> A >> B;
		cout << A + B << endl;
	}

	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int getGCD( int a, int b );
int getLCM( int a, int b );

int main( void )
{
	unsigned int GCD;
	unsigned int LCM;
	
	int a;
	int b;
	
	while( scanf( "%d %d", &a, &b ) != EOF )
	{
		if( a >= b )
		{
			GCD = getGCD( a, b );
			LCM = getLCM( a, b );
		}
		else
		{
			GCD = getGCD( b, a );
			LCM = getLCM( b, a );
		}
		
		printf( "%d %d\n", GCD, LCM * GCD );
	}
	
	return (0);
}

int getLCM( int a, int b )
{
	int GCD = getGCD( a, b );
	return ( ( a / GCD )* ( b / GCD ) );
}

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

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

using namespace std;

long long x, ans;

int main () {
    cin >> x;
    if (x >= 500) {
        ans += x / 500 * 1000;
        x %= 500;
    }
    if (x >= 5) {
        ans += x - x % 5;
    }
    cout << ans;
}

Measured memory_bytes: 256
import java.util.*;
import java.lang.*;
 
public class Main {
    public static void main(String[] args) {

        Scanner sc  = new Scanner(System.in);

        String a = sc.next();
        String b = sc.next();
        String c = sc.next();
        
        String str1 = a.toUpperCase();
        String str2 = b.toUpperCase();
        String str3 = c.toUpperCase();

        System.out.print( str1.substring(0, 1) );
        System.out.print( str2.substring(0, 1) );
        System.out.print( str3.substring(0, 1) );


        System.out.println();
    }

}

Measured memory_bytes: 21844
#include <stdio.h>

int isprime(int x){
  int i;
  if(x<2)return 0;
  else if(x==2)return 1;
  if(x%2==0)return 0;
  for(i=3;i*i<=x;i+=2){
    if(x%i==0)return 0;
  }
  return 1;
}

int main(){
  int n,x,i;
  int cnt =0;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&x);
    if(isprime(x))cnt++;
  }
  printf("%d\n",cnt);
  return 0;
}

Measured memory_bytes: 2692
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
using ll=long long;
using ld=long double;
using Graph=vector<vector<int>>;
const int mod=1e9+7;
const int mxN=2e6+3;
vector<int> x_vec={-1,1,0,0};
vector<int> y_vec={0,0,-1,1};

int main(){
    int n,ans=0;
    cin>>n;
    for(int i=1;i<n;i++){
        if(n%i==0)ans+=n/i-1;
        else ans+=n/i;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
struct star{
    int star_x[1000];
    int star_y[1000];
};
int main()
{
    int n,m;
    while(cin>>n,n){
        struct star serch,picture;
        for(int i=0;i<n;i++)cin>>serch.star_x[i]>>serch.star_y[i];
        cin>>m;
        for(int i=0;i<m;i++)cin>>picture.star_x[i]>>picture.star_y[i];
        for(int i=0;i<m;i++){
            int difference_x=picture.star_x[i]-serch.star_x[0];
            int difference_y=picture.star_y[i]-serch.star_y[0];
            bool now=0;
            for(int j=0;j<n&&!now;j++){
                bool place=0;
                for(int k=0;k<m&&!place;k++)if(difference_x==picture.star_x[k]-serch.star_x[j]&&difference_y==picture.star_y[k]-serch.star_y[j])place=1;
                if(!place)now=1;
            }
            if(!now){
                cout<<difference_x<<" "<<difference_y<<endl;
                break;
            }
        }
    }
}

Measured memory_bytes: 3108
N, D = map(int, input().split())

# 条件を満たす最小値→Nを2Dで割り整数に＋１した数
if N % (2 * D + 1) == 0:
    ans = (N // (2 * D + 1))
else:
    ans = (N // (2 * D + 1))+1
print(ans)

Measured memory_bytes: 2940
N = int(input())
last = N
for num in range(1, N+1):
  if num**2 > N:
    print(len(str(last)))
    break
  elif num**2 == N:
    print(len(str(num)))
    break
  else:
    if N%num == 0:
      last = N//num
    


Measured memory_bytes: 2940
N, T = map(int, input().split())
c, t = [0]*N, [0]*N
for i in range(N):
    c[i], t[i] = map(int, input().split())

answer = float('inf')
ct = zip(c,t)
for i,j in ct:
    if j<=T:
        answer = min(answer, i)

if answer == float('inf'):
    print('TLE')
else:
    print(answer)

Measured memory_bytes: 3064
/*------------------------------------
........Bismillahir Rahmanir Rahim....
..........created by Abdul Aziz.......
------------------------------------*/
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <cstring>
#include <unordered_map>
#include <queue>
#define   mod  998244353
#define   int  long long 
#define   ld   long double
#define   pb   push_back
#define   vi  vector<int> 
#define   dbg(x)  cerr << #x << " = " << x << '\n'
#define   sz(x)  (int)x.size()
#define   all(a) (a.begin(),a.end())
#define   ff   first
#define   ss   second
#define   pii  pair<int,int> 
#define   lcm(a,b) (a*b)/__gcd(a,b) 
using namespace std;

int fun(int a,int b){
    if (a<=0 and b<=0) return abs(a);
    if (a>=0 and b>=0) return b;
    int mn=min(abs(a),b);
    return (mn*2+max(abs(a),b));
}

inline void solve(){ 
    int  n , k ; 
    cin >> n >> k ; 
    vi a(n); k--;
    for (int i=0;i<n;i++) cin>>a[i]; 
    int ans=10000000000005; 
    for (int j=k;j<n;j++) {
        ans = min(ans,fun(a[j-k],a[j])); 
    }
    cout << ans << endl; 
} 

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


Measured memory_bytes: 4012
#include <bits/stdc++.h>
#define int long long
#define rep(i, a, n) for(int i = (int)(a);(i) < (int)(n);++(i))
#define repe(i, a, n) for(int i = (int)(a);(i) <= (int)(n);++(i))
#define repif(i, a, x) for(int i = (int)(a);(x);++(i))
#define repr(i, a, n) for(int i = ((int)(a)-1);(i) >= (int)(n);--(i))
#define reper(i, a, n) for(int i = (int)(a);(i) >= (int)(n);--(i))
#define SZ(x) ((int)(x).size())
#define ALL(x) begin(x), end(x)
#define RNG(x, a, n) &((x)[a]), &((x)[n])
#define ADD(a, b) (((a%MOD+MOD)%MOD+(b%MOD+MOD)%MOD)%MOD)
#define MUL(a, b) ((((a%MOD+MOD)%MOD)*((b%MOD+MOD)%MOD))%MOD)
#define CHADD(a, b) (a = ADD(a, b))
#define CHMUL(a, b) (a = MUL(a, b))
#define CEIL(x) ((int)ceil(((double)x)))
#define POW(x, y) ((int)pow(x, y))
#define UNIQUE(x) (x).erase(unique(ALL((x))), (x).end())
#define YES cout << "YES" << endl
#define NO cout << "NO" << endl
#define Yes cout << "Yes" << endl
#define No cout << "No" << endl
#define yes cout << "yes" << endl
#define no cout << "no" << endl
#define fcout cout << fixed << setprecision(10)
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define PI (acos(-1))
#define EPS (1e-10)
#define INF LLONG_MAX
#define MOD 1000000007LL
using namespace std;
using VI = vector<int>;
using PII = pair<int, int>;
using VPII = vector<PII>;
using Complex = complex<double>;
template<typename T, template<typename> typename C> using PQ = priority_queue<T, vector<T>, C<T>>;
template<typename T> bool chmax(T& a, const T& b){ if(a<b){ a=b; return true; } return false; }
template<typename T> bool chmin(T& a, const T& b){ if(a>b){ a=b; return true; } return false; }
template<typename I> int ACC(I f, I l, int i){ return accumulate(f, l, i); }


int H, W, D;
PII A[900010];
int Q;
int d[90010];


signed main(){
    cin >> H >> W >> D;
    rep(i, 0, H) rep(j, 0, W){
        int a;
        cin >> a;
        a--;
        A[a] = { i, j };
    }

    rep(i, D, H*W) d[i] += d[i-D]+abs(A[i].first-A[i-D].first)+abs(A[i].second-A[i-D].second);

    cin >> Q;
    rep(i, 0, Q){
        int L, R;
        cin >> L >> R;
        L--, R--;
        cout << d[R]-d[L] << endl;
    }

    return 0;
}

Measured memory_bytes: 5248
#include <iostream>
#include <sstream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <utility>
#include <map>
#include <list>
#include <climits>
#include <set>
#include <deque>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <bitset>

// #define cerr if(false)cerr
#define watch(x) cerr << "> " << #x << ": " << x << "\n";

using namespace std;

template <typename T>
std::ostream &operator <<(std::ostream &out, vector<T> &v) {
	for (typename vector<T>::size_type i = 0; i < v.size(); ++i)
		out << v[i] << " ";
	out << "\n";
    return out;
}
template <typename T, typename N>
std::ostream &operator <<(std::ostream &out, vector<pair<T, N> > &v) {
	for (size_t i = 0; i < v.size(); ++i)
		out << "(" << v[i].first << ", " << v[i].second << ") ";
	out << "\n";
    return out;
}
template <typename T>
std::ostream &operator <<(std::ostream &out, vector<vector<T> > &v) {
	for (size_t i = 0; i < v.size(); ++i) {
		for (size_t j = 0; j < v[i].size(); ++j) {
			out << v[i][j] << " ";
		}
		out << "\n";
	}
   	return out;
}

int main() {

	std::ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

	long long a, b, c, k;
	cin >> a >> b >> c >> k;

	if (k & 1) {
		cout << b - a << "\n";
	} else {
		cout << a - b << "\n";
	}

	return 0;

}

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

int main() {
  int a,b;string op;cin>>a>>op>>b;
  int ans = op=="+"?(a+b):(a-b);
  cout << ans << endl;
}


Measured memory_bytes: 256
h, w, a, b = gets.chomp.split(" ").map(&:to_i)

MOD = 10**9 + 7

@fac = []
@faci = []
@inv = []

@fac[0] = @fac[1] = 1
@faci[0] = @faci[1] = 1
@inv[1] = 1

2.upto(h + w - 2) do |i|
  @fac[i] = @fac[i - 1] * i % MOD
  @inv[i] = MOD - @inv[MOD % i] * (MOD / i) % MOD
  @faci[i] = @faci[i - 1] * @inv[i] % MOD
end

def comb(n, k)
  return 0 if n < k
  return 0 if n < 0 || k < 0
  return @fac[n] * (@faci[k] * @faci[n - k] % MOD) % MOD
end

ans = 0

b.upto(w - 1) do |i|
  ans += comb(h - a - 1 + i, i) * comb(a + w - i - 2, w - i - 1)
  ans %= MOD
end
p ans % MOD



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

int main() {
    int p, q, r;
    cin >> p >> q >> r;

    if (p >= q && p >= r) cout << q + r << endl;
    else if (q >= p && q >= r) cout << p + r << endl;
    else if (r >= q && r >= q) cout << p + q << endl;

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
//#include <math.h>
#include <algorithm>
#include <vector>
#pragma warning(disable:4996)

typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define MOD 1000000007
using namespace std;

char str[300005];
long s[300005];

int main(int argc, char* argv[])
{
    long n;
    scanf("%ld", &n);
    scanf("%s", str);

    s[0]=0;
    long i;
    for(i=0; i<n; i++) {
        if(str[i]=='E') {
            s[i+1]=s[i]+1;
        }
        else {
            s[i+1]=s[i];
        }
    }

    long min=n;
    for(i=0; i<n; i++) {
        long tmp = (i-s[i])+(s[n]-s[i+1]);
        min = MIN(min,tmp);
    }
    
    printf("%ld\n", min);
    return 0;
}


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

typedef long long ll;
typedef pair<ll,ll> pi;
typedef vector <ll> vi;
typedef vector <pi> vpi;
#define f first
#define s second
#define FOR(i,s,e) for(ll i=s;i<=ll(e);++i)
#define DEC(i,s,e) for(ll i=s;i>=ll(e);--i)
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define lbd(x, y) lower_bound(all(x), y)
#define ubd(x, y) upper_bound(all(x), y)
#define aFOR(i,x) for (auto i: x)
#define mem(x,i) memset(x,i,sizeof x)
#define fast ios_base::sync_with_stdio(false),cin.tie(0)
#define int ll
#define INF (ll)1e9
int K,N;
int A[1000001];
int32_t main(){
	fast;
	
	cin>>K>>N;
	
	FOR(i,0,N-1) cin>>A[i];
	
	int ans = -1;
	FOR(i,0,N-2){
		ans = max(ans,abs(A[i + 1] - A[i]));
	}
	
	ans = max(ans,abs(K + A[0] - A[N-1]));
	
	cout<<K - ans;

	
		
			
		
	
}



Measured memory_bytes: 1792
#include <bits/stdc++.h>
////////////////////////////////////////////////////////////
#define all(x) (x).begin(), (x).end()
const int inf = 1e9;
const long long INF=1e15;
#define endl '\n'
#define rep(i, n) for(int i=0;i<(n);++i)
#define repp(i, a, b) for(int i=(a);i<=(b);++i)
#define pb push_back
#define eb emplace_back
#define fastio ios::sync_with_stdio(false);cin.tie(0); //cout.tie(0);

using namespace std;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

typedef long long ll;
typedef pair<int,int> ii;
typedef pair<ll,ll> llll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<ii> vii;


void solve() {
	int a, b, c;cin>>a>>b>>c;
	//abc bac cab
	cout << c << " " << a << " " << b;
}
int main() {
	fastio;
	solve();
}

Measured memory_bytes: 256
n, k = gets.to_s.split.map{|e|e.to_i}
a = [0] + gets.to_s.split.map{|e|e.to_i}
 
t = Array.new(n+1){ -1 } 
 
cur = 1
t[1] = i = 0

loop do
  
  cur = a[cur]
  i += 1
  if i == k
    puts cur
    exit
  end
  
  t[cur] >= 0 ? break : t[cur] = i
end

dist = t[cur]
puts t.index((k - dist) % (i - dist) + dist)
# cycle = i - dist
# idx = (k - dist) % (i - dist) + dist

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

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

using namespace std;

/*long C(long n, long r){
    if(n < r) return 0;
    long p[n+1][n+1];
    p[0][0] = 1;
    for(int i = 1; i <= n; i++){
        p[i][0] = 1;
        p[i][i] = 1;
        for(int j = 1; j <= i-1; j++){
            p[i][j] = p[i-1][j] + p[i-1][j-1];
        }
    }
    return p[n][r];
}*/

 
void solve() {
    int H, W, N;
    cin >> H >> W >> N;
    int a[N];
    REP(i, N) cin >> a[i];
    int ans[H][W];
    int k = 0;
    REP(i, N){
        REP(j, a[i]){
            int h = k / W;
            int w = k % W;
            if(h % 2 == 0){
                ans[h][w] = i+1;
            }
            else{
                ans[h][W-1-w] = i+1;
            }
            k++;
        }
    }
    REP(i, H){
        REP(j, W) cout << ans[i][j] << " ";
        cout << "\n";
    }
}
 
int main() {
    solve();
    return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1e18,MOD = 1e9 + 7;
const int INT_INF = 1e9,INT_MOD=1e9+7;
#define rep(i, N) for(int i = 0; i < N; i++)
typedef pair<int, int> Pi;
typedef pair<double, double> P;
signed main(){
    int n,m;cin>>n>>m;
    int ac=0,wa=0,pe[n],ju[n];
    rep(i,n){
        pe[i]=0;
        ju[i]=-1;
    }
    rep(i,m){
        int ans;
        string ch;
        cin>>ans>>ch;
        if(ch=="AC" and ju[ans-1]<0){
            ju[ans-1]++;
            ac++;
        }else if(ch=="WA" and ju[ans-1]<0){
            pe[ans-1]++;
            wa++;
        }
    }
    rep(i,n){
        if(ju[i]<0) wa-=pe[i];
    }
    cout<<ac<<" "<<wa<<endl;
    return 0;
}

Measured memory_bytes: 1024
#include <iostream>
using namespace std;
int a, s,d,f;
  
 main()
{
  cin >> a >> s >> d >> f;
  if(max(a-d,d-a)<=f)
    cout << "Yes" << endl;
    else if(max(a-s,s-a)<=f&&max(s-d,d-s)<=f)
      cout << "Yes" << endl;
      else
        cout << "No" << endl;

}


Measured memory_bytes: 256
// https://atcoder.jp/contests/abcXXX/tasks/abcXXX_x

#include <iostream>
#include <vector>

using namespace std;
using ll = long long;
using ull = unsigned long long;
using pll = pair<ll, ll>;

struct C1 {
    ll N_{};
    ll K_{};
    vector<ll> v_{};
    vector<ll> num_tenchi_{};
    vector<ll> num_larger_{};
    explicit C1(ll K, vector<ll> v) : N_(v.size()), K_(K), v_(move(v)){
        num_larger_.resize(N_, 0);
        num_tenchi_.resize(N_, 0);
        for(ll i=0; i < N_; ++i) {
            for(ll j=0; j < i; ++j) {
                if (v_[i] < v_[j]) {
                    num_tenchi_[i]++;
                }
            }
        }
        for(ll i=0; i < N_; ++i) {
            for(ll j=0; j < N_; ++j) {
                if (i != j && v_[i] < v_[j]) {
                    num_larger_[i]++;
                }
            }
        }
    }
    ll resolve() {
        const ll MOD = 1000000007;
        ll sum = 0;
        for (ll i = 0; i < N_; ++i) {
            sum += num_tenchi_[i] * K_ % MOD + num_larger_[i] * (K_ * (K_ -1) / 2 % MOD);
            sum = sum % MOD;
        }
        return sum;
    }
};

int main() {
    ll N, K;
    cin >>  N >> K;
    vector<ll> v{};
    for (int i=0; i < N; ++i) {
        ll x;
        cin >> x;
        v.emplace_back(x);
    }
    C1 c{K, move(v)};
    cout << c.resolve() << endl;
    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <queue>
using namespace std;

int weight[] = {1, 2, 4, 8, 16, 32, 64, 128, 256, 512};

int main(void)
{
    int sum;
    priority_queue < int, vector<int>, greater<int> > ans;
    
    while (scanf("%d", &sum) != EOF) {
        for (int i = 9; 0 <= i; i--){
            if (sum <= 1){
                if (sum == 1){
                    ans.push(sum);
                    break;
                }
            }
            else if (weight[i] <= sum){
                sum -= weight[i];
                ans.push(weight[i]);
            }
        }
        while (!ans.empty()){
            printf("%d", ans.top());
            ans.pop();
            if (ans.empty()) printf("\n");
            else printf(" ");
        }
    }
    
    return (0);
}

Measured memory_bytes: 0
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		
		for(int i = -1000000;i <= 1000000;i++){
			if(b-a<i && i < b + a){
				System.out.print(i + " ");
			}
		}
	}

}

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

using namespace std;

int main() {
    int ans = 0;
    string str;
    cin >> str;
    int len = str.length();
    for (int i = 0; i < len / 2; ++i) {
        if (str[i] != str[len - 1 - i]) {
            ans++;
        }
    }

    cout << ans << endl;
}


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

using namespace std;

int main()
{
    string s1 ,s2,s3;
    cin >>s1 >>s2 >>s3;
   s1.at(0)=toupper( s1.at(0));
    s2.at(0)=toupper( s2.at(0));
    s3.at(0)=toupper( s3.at(0));
    cout <<s1.at(0);
    cout <<s2.at(0);
    cout <<s3.at(0);



    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <string>
#include <iostream>
#include <vector>
#include <queue>
#include <unordered_map>
#include <random>
#include <stack>
#include <set>
#include <unordered_set>

#define bug(x) cout<<"zdongdebug1: "<<x<<endl;
#define bug2(x, y) cout<<"zdongdebug2: "<<x<<" "<<y<<endl;
#define bug3(x, y, z) cout<<"zdongdebug3: "<<x<<" "<<y<<" "<<z<<endl;
using namespace std;
typedef long long ll;
const int maxn = 100005;
const int mod = 1000000007;

int f[maxn];
int pd(int x){
  if(x!=f[x])f[x] = pd(f[x]);
  return f[x];
}
int ans[maxn],c[maxn];

int main() {
#ifdef suiyuan2009
  freopen("/Users/suiyuan2009/CLionProjects/icpc/input.txt", "r", stdin);
  //freopen("/Users/suiyuan2009/CLionProjects/icpc/output.txt", "w", stdout);
#endif
  int n,m, K;
  cin>>n>>m>>K;
  for(int i=1;i<=n;i++)f[i] = i;
  for(int i=0;i<m;i++){
    int x,y;
    cin>>x>>y;
    ans[x]--;
    ans[y]--;
    int px = pd(x);
    int py = pd(y);
    if(px != py){
      f[px] = py;
    }
  }
  for(int i=0;i<K;i++){
    int x,y;
    cin>>x>>y;
    int px = pd(x);
    int py = pd(y);
    if(px==py){
      ans[x]--;
      ans[y]--;
    }
  }
  for(int i=1;i<=n;i++){
    int x = pd(i);
    c[x]++;
  }
  for(int i=1;i<=n;i++){
    int x = pd(i);
    ans[i]+=c[x];
  }
  for(int i=1;i<n;i++)cout<<ans[i]-1<<" ";
  cout<<ans[n]-1<<endl;
 return 0;
}

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

typedef long long ll;

#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--)

#define ALL(x) (x).begin(),(x).end()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))

#define INF 1000000000000 //10^12

int main() {
    ll N, M, A, B;
    ll* H;
    set<ll> ans;

    cin >> N >> M;
    
    H = new ll[N + 1];
    FOR(i, 1, N) {
        cin >> H[i];
        ans.insert(i);
    }
    
    REP(i, M) {
        cin >> A >> B;

        if (H[A] <= H[B]) ans.erase(A);
        if (H[B] <= H[A]) ans.erase(B);
    }

    cout << SIZE(ans) << endl;

    return 0;
}

Measured memory_bytes: 9068
#include<bits/stdc++.h>
#include<unordered_set>
#include<unordered_map>
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define all(v)(v).begin(),(v).end()
#define rall(v)(v).rbegin(),(v).rend()
#define F first
#define S second
#define pb push_back
#define pu push
#define COUT(x) cout<<(x)<<endl
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,vector<ll>,greater<ll>>
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define mp make_pair
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define sz(x) (ll)(x).size()
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll MOD = 1000000007LL;
const ll INF = 1LL << 60;
using vll = vector<ll>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pll = pair<ll, ll>;
using vc = vector<char>;
using vvc = vector<vc>;
ll dx[4]={0,1,0,-1};
ll dy[4]={1,0,-1,0};
int main(){
  ll n;
  cin>>n;
  vvll t(n,vll(0));
  vector<pll> pp(n-1);
  rep(i,n-1){
    ll a,b;
    cin>>a>>b;
    a--;
    b--;
    t[a].pb(b);
    t[b].pb(a);
    pp[i]=mp(a,b);
  }
  map<pll,ll> m;
  queue<ll> que;
  vll used(n);
  used[0]=1;
  vll cs(n,0);
  que.pu(0);
  ll k=0;
  while(sz(que)){
    ll v=que.front();
    que.pop();
    k=max(sz(t[v]),k);
    ll cu=1;
    for(ll p:t[v]){
      if(used[p])continue;
      if(cs[v]==cu) cu++;
      cs[p]=m[pll(v,p)]=m[pll(p,v)]=cu;
      cu++;
      que.pu(p);
      used[p]=1;
    }
  }
  COUT(k);
  rep(i,n-1){
    COUT(m[pp[i]]);
  }
}


Measured memory_bytes: 22144
S = input()
a = (len(S) - 1) // 2
b = (len(S) + 3) // 2 - 1
if S == S[::-1] and S[:a] == S[:a][::-1] and S[b:] == S[b:][::-1]:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 2940
N,T = map(int,input().split())
A = list(map(int,input().split()))

B = [0]*N
C = [0]*N

h = A[0]
B[0] = h
for i in range(1,N):
    h = min(A[i],h)
    B[i] = h

h = A[-1]
C[-1] = h
for i in range(N-2,-1,-1):
    h = max(A[i],h)
    C[i] = h

B = B[:-1]
C = C[1:]
D = list(map(lambda x:C[x]-B[x],range(N-1)))
t = max(D)

s = 0
D.append(0)
for i in range(N-1):
    if D[i] == t and D[i] > D[i+1]:
        s += 1

print(s)


Measured memory_bytes: 15060
#include <bits/stdc++.h>
using namespace std;
int n,P=1000000007;
int dp[3000000];
long long match(long long mask,int i,int *a){
	if(mask==0)
		return 1;
	if(dp[mask]==-1){
		long long sum=0;
		for(int j=0;j<n;j++){
			if(a[i*n+j]==1 and mask&(1<<j))
				sum=(sum+match(mask^(1<<j),i+1,&a[0]))%P;
		}
		dp[mask]=sum;
	}
	return dp[mask];
}
int main(){
	cin >> n;
	int a[n][n];
	memset(dp,-1,sizeof(dp));
	for(int i=0;i<n;i++)
		for(int j=0;j<n;j++)
			cin >> a[i][j];
	cout << match((1<<n)-1,0,&a[0][0]) << endl;
}

Measured memory_bytes: 12032
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		String input = sc.next();
		boolean odd = true;
		boolean res = true;
		for (int i = 0; i < input.length(); i++) {
			if (odd) {
				if (input.charAt(i) == 'L') {
					res = false;
					break;
				}
				odd = !odd;
			} else {
				if (input.charAt(i) == 'R') {
					res = false;
					break;
				}
				odd = !odd;
			}
		}
		if (res) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
}


Measured memory_bytes: 35580