akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <set>
#include <utility>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <deque>
#include <unordered_map>
#include <map>
#include <bitset>
#include <string>
#include <cstring>

#define pb push_back
#define mp make_pair
#define l(x) x << 1
#define r(x) x << 1 | 1
#define scan(x) do {while((x=getchar())<'0') ; for(x-='0'; '0'<=(_=getchar()); x=(x<<3)+(x<<1)+_-'0') ; } while(0)
char _;
#define x first
#define y second

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<float, float> pff;
typedef pair<double, double> pdd;
typedef pair<ll, ll> pll;
typedef map<int, int> mii;
typedef unordered_map<int, int> umii;

int N, M;
set<int> adj[200005];

int main() {
    scanf("%d %d", &N, &M);
    for (int i = 0, a, b; i < M; i++) {
        scanf("%d %d", &a, &b);
        adj[a].insert(b);
        adj[b].insert(a);
    }
    for (int i = 2; i < N; i++) {
        if (adj[i].find(1) != adj[i].end() && adj[i].find(N) != adj[i].end()) {
            printf("POSSIBLE\n");
            return 0;
        }
    }
    printf("IMPOSSIBLE\n");
}


Measured memory_bytes: 28416
import java.io.*;
import java.util.*;
public class Main{
  
 public static void main(String[] args){
   
  	Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
   int M = sc.nextInt();
   System.out.println((N * (N -1)/ 2) + (M  *( M- 1 )/2));
 }
  
  
}

Measured memory_bytes: 21844
import java.util.Scanner;

class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    int c = sc.nextInt();
    boolean flag = true;
    
    if( a==b && b==c ){
      flag = false;
    }
    
    if( (a!=b && b!=c) && (a!=c) ){
      flag = false;
    }
    
    if( flag ){
      System.out.println("Yes");
    }else{
      System.out.println("No");
    }
    
  }
}


Measured memory_bytes: 23892
#include<stdio.h>

int main(void){
    int N,i,j,s = 0,d,dd,t;
    scanf("%d",&N);
    int W[N],S[N];
    for(i = 0;i < N;i++){
        scanf("%d",&W[i]);
        s += W[i];
        S[i] = s;
    }
    for(j = 0;j < N;j++){
        d = (s - S[j]) - S[j];
        if(d < 0){
            if(-d > dd){
                t = dd;
            }else{
                t = -d;
            }
            break;
        }
        dd = (s - S[j]) - S[j];
    }
    printf("%d",t);
    return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<limits.h>

using namespace std;

int main() {
    long n, m, M, c, d = LONG_MIN;
    cin >> n;
    for (long i = 0; i < n; i++) {
        cin >> c;
        if (i == 0) {
            m = M = c;
            continue;
        }
        if (c < m) {
            if (c - M > d) {
                d = c - M;
            }
            m = M = c;
            continue;
        }
        if (c > M) {
            M = c;
        }
        if (M - m > d) {
            d = M - m;
        }
    }
    cout << d << endl;
    return 0;
}

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

namespace MyProgram
{
    public class Program
    {	
        public static void Main(string[] args)
        {
            string[] str = Console.ReadLine().Split(' ');
            int a = int.Parse(str[0]);
            int b = int.Parse(str[1]);
            
            int[] tower = new int[1000];
            tower[0] = 1;
            for(int i = 1 ; i < 1000 ; i++)
            {
                tower[i] = tower[i-1] + i+1;
               
            }
            int ans = tower[b-a-1] - b;
            Console.WriteLine(ans);
            
        }
    }
}

Measured memory_bytes: 13140
#include<stdio.h>

void swap( int* a, int* b ) { int t = *a; *a = *b; *b = t; }

int main() {

    int y1, m1, d1, y2, m2, d2;
    scanf("%d %d %d %d %d %d", &y1, &m1, &d1, &y2, &m2, &d2 );

    if ( y1 > y2 || (y1 == y2 && (m1 > m2 || (m1 == m2 && d1 > d2))) ) {
	swap( &y1, &y2 );
	swap( &m1, &m2 );
	swap( &d1, &d2 );
    }
    
    if ( m1 < m2 || (m1 == m2 && d1 < d2 ) ) printf("%d\n", y2 - y1 + 1);
    else printf("%d\n", y2 - y1);
    
    return 0;
}



Measured memory_bytes: 2104
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define all(x) (x).begin(), (x).end()
#define MOD 1000000007
int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    for(size_t i = 0; i < n; i++) {
        cin >> a[i];
    }
    sort(all(a));
    if(a[n - 1] - a[0] > 1) {
        cout << "No" << endl;
        return 0;
    }
    int uniq = count(all(a), a[0]);
    int all = count(all(a), a[n - 1]);
    if(a[0] == a[n - 1]) {
        if(a[0] == n - 1 || 2 * a[0] <= n) {
            cout << "Yes" << endl;
        } else {
            cout << "No" << endl;
        }
    } else {
        if(uniq > a[n - 1]) {
            cout << "No" << endl;
        } else {
            if(2 * (a[n - 1] - uniq) <= all && a[n - 1] - uniq > 0) {
                cout << "Yes" << endl;
            } else {
                cout << "No" << endl;
            }
        }
    }
}


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

int main() {
  int n;
  cin >> n;
  vector<int> v(n);
  for (int i = 0; i < n; i++) {
    cin >> v[i];
  }
  int di = true;
  int count = 0;
  while (di) {
    for (int i = 0; i < n; i++) {
      if (v[i] % 2 == 0) {
        v[i] /= 2;
      } else {
        di = false;
        break;
      }
    }
    if (!di)
      break;
    count++;
  }
  cout << count << endl;
}


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

typedef long long ll;
#define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i)
#define ALL(v) (v).begin(),(v).end()
#define CLR(t,v) memset(t,(v),sizeof(t))
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>&a){return os<<"("<<a.first<<","<<a.second<< ")";}
template<class T>void pv(T a,T b){for(T i=a;i!=b;++i)cout<<(*i)<<" ";cout<<endl;}
template<class T>void chmin(T&a,const T&b){if(a>b)a=b;}
template<class T>void chmax(T&a,const T&b){if(a<b)a=b;}


int nextInt() { int x; scanf("%d", &x); return x;}

int main2() {
  int N = nextInt();
  int T = nextInt();

  const int INF = 1001001001;
  int ans = INF;
  REP(i, N) {
    int c = nextInt();
    int t = nextInt();
    if (t <= T) {
      chmin(ans, c);
    }
  }
  if (ans == INF) 
    cout << "TLE" << endl;
  else
    cout << ans << endl;
  return 0;
}

int main() {
  for (;!cin.eof();cin>>ws)
    main2();
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define INF 2147483647
#define INFF 9223372036854775807
#define ll long long
#define REP(i,n) for(long long i=0;i<n;i++)
#define REPP(i,m,n) for(long long i=m;i<n;i++)
#define ALL(N) (N.begin(),N.end())
#define de cout << "line : " << __LINE__ << " debug" << endl;
#define pb push_back
#define pq priority_queue
#define Dcout(N) cout << setprecision(20) << N << endl;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main() {
    cin.tie(0);    
	ios::sync_with_stdio(false);
    int N,T;
    cin >> N >> T;
    ll A[N];
    cin >> A[0];
    ll minv = A[0];
    ll maxv = -1;
    REPP(i,1,N){
        cin >> A[i];
        maxv = max(maxv,A[i]-minv);
        minv = min(minv,A[i]);
    }

    ll minv1 = A[0];
    ll maxv1 = -1;
    ll cnt = 0;
    REPP(i,1,N){
        maxv1 = max(maxv1,A[i]-minv1);
        if(maxv == A[i]-minv1) cnt++;
        minv1 = min(minv1,A[i]);
      //cout << A[i] << ' ' << minv1 << endl;
    }
    cout << cnt << endl;
}

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

using namespace std;
using ll = long long int;

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

    unordered_set<string> M;
    for (int i = 0; i < n; i++)
    {
        string s;
        cin >> s;
        M.insert(s);
    }

    cout << M.size() << endl;
}

Measured memory_bytes: 17792
#include <bits/stdc++.h>
#define MOD 1e9 + 7
#define PI 3.141592653589793238
#define pb push_back
#define ALL(V) (V).begin(), (V).end()
#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long long int lint;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef vector<int> VI;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
ll gcd(ll a, ll b) { return (a % b == 0 ? b : gcd(b, a % b)); }
ll lcm(ll a, ll b) { return a * b / gcd(a, b); }
ll char_to_ll(char c) { return (int)(c - '0'); }
ll string_to_ll(string s) { return char_to_ll(atoi(s.c_str())); }
bool is_prime(ll x){ if(x <= 1) return false; for(ll i = 2; sqrt(i) <= x; i++) if(x % i == 0) return false; return true; }

int main(){
    ll A, B;
    cin >> A >> B;
    ll m = min(A, B);
    string ans = "";
    for(ll i = 0; i < max(A, B); i++){
        ans += to_string(m);
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
using namespace std;
typedef long long ll;

int main(){
  int n, p; cin >> n >> p;
  string s; cin >> s;
  ll ans = 0;
  ll sum = 0;
  ll x = 1;
  vector<int> f(p);
  
  if(p == 2 || p == 5){
    for(int i = 0; i < n; i++){
      if((s[i]-'0') % p == 0) ans += 1LL * (i+1);
    }
  }
  else{
    for(int i = n-1; i >= 0; i--){
      sum = (sum + (s[i]-'0') * x) % p;
      x = x * 10 % p;
      f[sum]++;
    }
    ans = 1LL * f[0];
    for(int i = 0; i < p; i++){
      ans += 1LL * f[i] * (f[i] - 1) >> 1;
    }
  }
  
  cout << ans << endl;
  
  return 0;
}


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

using namespace std;

int main(){
	int n, k;
	cin >> n >> k;
	long long sum = 0;
	long long mod = 1e9 + 7;
	for(long long i = k; i <= n + 1; i++){
		long long maxi, mini;
		maxi = i * (n + n - i + 1)/2;
		mini = i * (i - 1)/2;
		sum += maxi - mini + 1;

	}
	cout << sum % mod <<  '\n';
}


Measured memory_bytes: 3640
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <deque>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
#include <sstream>
#include <complex>
using namespace std;

typedef long long ll;
typedef uint64_t ull;
typedef pair<int, int> P;
constexpr double PI = 3.1415926535897932;   // acos(-1)
constexpr double EPS = 1e-9;
constexpr int INF = 1001001001;
constexpr int mod = 1000000007;
// constexpr int mod = 998244353;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)

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

    int n, m, x;
    cin >> n >> m >> x;
    int leftsum = 0, rightsum = 0;
    for(int i = 0; i < m; ++i){
        int a;
        cin >> a;
        if(a < x)   ++leftsum;
        else    ++rightsum;
    }

    int ans = min(leftsum, rightsum);
    cout << ans << endl;
}

Measured memory_bytes: 256
//By TheOneYouWant
#pragma GCC optimize ("-O2")
#include <bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define memreset(a) memset(a,0,sizeof(a))
#define testcase(t) int t;cin>>t;while(t--)
#define forstl(i,v) for(auto &i: v)
#define forn(i,e) for(int i=0;i<e;++i)
#define forsn(i,s,e) for(int i=s;i<e;++i)
#define rforn(i,s) for(int i=s;i>=0;--i)
#define rforsn(i,s,e) for(int i=s;i>=e;--i)
#define bitcount(a) __builtin_popcount(a) // set bits (add ll)
#define ln '\n'
#define getcurrtime() cerr<<"Time = "<<((double)clock()/CLOCKS_PER_SEC)<<endl
#define dbgarr(v,s,e) cerr<<#v<<" = "; forsn(i,s,e) cerr<<v[i]<<", "; cerr<<endl
#define inputfile freopen("input.txt", "r", stdin)
#define outputfile freopen("output.txt", "w", stdout)
#define dbg(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); \
stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) { cerr<<endl; }
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << "\t"; err(++it, args...);
}
template<typename T1,typename T2>
ostream& operator <<(ostream& c,pair<T1,T2> &v){
	c<<"("<<v.fi<<","<<v.se<<")"; return c;
}
template <template <class...> class TT, class ...T>
ostream& operator<<(ostream& out,TT<T...>& c){
    out<<"{ ";
    forstl(x,c) out<<x<<" ";
    out<<"}"; return out;
}
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll,ll> p64;
typedef pair<int,int> p32;
typedef pair<int,p32> p96;
typedef vector<ll> v64;
typedef vector<int> v32; 
typedef vector<v32> vv32;
typedef vector<v64> vv64;
typedef vector<p32> vp32;
typedef vector<p64> vp64;
typedef vector<vp32> vvp32;
typedef map<int,int> m32;
const int LIM=1e5+5,MOD=1e9+7;
const ld EPS = 1e-9;

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

int main(){
	fastio;

	ll a, b;
	cin>>a>>b;

	if(a>0){
		cout<<"Positive"<<ln;
	}
	else{
		if(b>=0) cout<<"Zero"<<ln;
		else if(a%2 == b%2) cout<<"Negative"<<ln;
		else cout<<"Positive"<<ln;
	}

	return 0;
}

Measured memory_bytes: 3612
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin>>n;
    string s="No";
    for(int i=1;i<=9;i++){
        if(n%i==0&&(n/i)<10&&(n/i)>=1){
            s="Yes";
        }
    }
    cout<<s<<endl;
}

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

using namespace std;


int main(){


	int N,K;

	cin >> N >> K;

	vector<int> DP(N,0);
	vector<int> A(N,0);

	for(int i=0;i<N;i++){
		cin >> A[i];
	}

	DP[1] = abs(A[1]-A[0]);

	for(int i=2;i<N;i++){
		int best_jump = INT_MAX;
		for(int j=1;(j<=K)&&(j<=i);j++){
			best_jump = min(best_jump,abs(A[i]-A[i-j])+DP[i-j]);
		}
		DP[i] = best_jump;
	}

	cout << DP[N-1] << endl;

	system("pause");

	return 0;

}


Measured memory_bytes: 4060
#include<bits/stdc++.h>
typedef long long ll;
typedef long double ld;
#define FASTIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
  
using namespace std;

const ll inf = 1e17;
const ll N = 1e6+10;
const ll bits = 62;
const ll mod = 1e9+7;

int main(){

   ll n;
   cin>>n;

   string s;

   cin>>s;

   int low = 0,high=n;

   while(low!=high-1){
      ll mid = (high+low)/2;

      // cout<<low<<" "<<high<<"\n";

      unordered_map<string, vector<ll>>mp;

      for(int i=0;i+mid<=n;i++){
         mp[s.substr(i,mid)].push_back(i);
      }

      int done = false;

      for(auto i = mp.begin();i!=mp.end();i++){
         if(i->second[i->second.size()-1]-i->second[0]>=mid){
            done = true;
            break;
         }
      }

      if(done){
         low = mid;
      }else{
         high = mid;
      }
   }

   cout<<low<<"\n";
}

Measured memory_bytes: 6788
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef vector<ll> vl;
typedef pair<ll, ll> PP;
#define rep(i, n) for(ll i = 0; i < ll(n); i++)
#define all(v) v.begin(), v.end()
#define inputv(v, n)                                                           \
    vl v;                                                                      \
    rep(i, n) {                                                                \
        ll x;                                                                  \
        cin >> x;                                                              \
        v.push_back(x);                                                        \
    }
bool chmin(ll& a, ll& b) { if (b < a) { a = b; return 1; } return 0; }
bool chmax(ll& a, ll& b) { if (b > a) { a = b; return 1; } return 0; }
const ll INF = 999999999999999;
const ll MOD = 1000000007;
const ll MAX_N = 500010;
ll a, b, c, d, e, f, p, t, x, y, z, q, m, n, r, h, k, w, l, ans;
string S, T, U;
int main() {
    cin >> S >> T >> a >> b >> U;
    if (S != U)cout << a << " " << b - 1 << endl;
    else cout << a - 1 << " " << b << endl;
}

Measured memory_bytes: 256
if __name__=="__main__":
    n = input()
    sumA = 0
    sumB = 0
    s = input()
    for i in s:
        if i == 'R':
            sumA += 1
        else:
            sumB += 1
    if sumA > sumB:
        print('Yes')
    else:
        print('No')

Measured memory_bytes: 3060
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
using namespace std;
int main() {
    vector<unsigned long long int> v(3, 0);
    for (int i = 0; i < 3; i++) {
        cin >> v[i];
        if (v[i] % 2 == 0) {
            cout << 0 << endl; return 0;
        }
    }
    sort(v.begin(), v.end());
    cout << v[0] * v[1] << endl;
    return 0;
}


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

using namespace std;

#define pb push_back

const int maxi = 1e6+10;
int a[maxi];
int n, k, s;

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

    for (int i=1;i<=k;i++)
        a[i] = s;

    for (int i=k+1;i<=n;i++)
        if (s == 1e9) a[i] = s - 1; else a[i] = s+1;


    for (int i=1;i<=n;i++)
        printf("%d ",a[i]);
    printf("\n");
    return 0;
}


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

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

	string s,t;
	cin>>s>>t;
	int count=0;
	for(int i=0;i<s.length();++i)
	{
		if(s[i]==t[i])
			continue;
		else
			count++;
	}
	cout<<count<<"\n";
}

Measured memory_bytes: 3800
#include <bits/stdc++.h>
#define rep(i, a, b) for(int i = int(a); i < int(b); i++)
#define rer(i, a, b) for(int i = int(a) - 1; i >= int(b); i--)
#define sz(v) (int)(v).size()
#define pb push_back
#define sc second
#define fr first
#define sor(v) sort(v.begin(),v.end())
#define rev(s) reverse(s.begin(),s.end())
#define lb(vec,a) lower_bound(vec.begin(),vec.end(),a)
#define ub(vec,a) upper_bound(vec.begin(),vec.end(),a)
#define uniq(vec) vec.erase(unique(vec.begin(),vec.end()),vec.end())
using namespace std;
typedef long long int ll;
typedef pair <int, int> P;

const ll MOD=1000000007;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int N;
    cin>>N;
    ll X[N], Y[N];
    rep(i,0,N) cin >>X[i]>>Y[i];
    ll k=((X[0]+Y[0])%2+2)%2;
    rep(i,0,N){
        if(((X[i]+Y[i])%2+2)%2!=k){
            cout <<-1<<"\n";
            return 0;
        }
    }
    if(k){
        cout <<40<<"\n";
        rep(i,0,40){
            if(i==39) cout <<(ll(1)<<i)<<"\n";
            else cout <<(ll(1)<<i)<<" ";
        }
        vector<char> ans;
        rep(i,0,N){
            rer(j,40,0){
                if(Y[i]>=X[i]&&Y[i]>=-X[i]){
                    ans.pb('U');
                    Y[i]-=(ll(1)<<j);
                }
                else if(Y[i]>=X[i]&&Y[i]<=-X[i]){
                    ans.pb('L');
                    X[i]+=(ll(1)<<j);
                }
                else if(Y[i]<=X[i]&&Y[i]>=-X[i]){
                    ans.pb('R');
                    X[i]-=(ll(1)<<j);
                }
                else if(Y[i]<=X[i]&&Y[i]<=-X[i]){
                    ans.pb('D');
                    Y[i]+=(ll(1)<<j);
                }
            }
            rev(ans);
            rep(j,0,40){
                cout <<ans[j];
            }
            cout <<"\n";
        }
    }
    else{
        cout <<40<<"\n";
        cout <<1<<" ";
        rep(i,0,39){
            if(i==38) cout <<(ll(1)<<i)<<"\n";
            else cout <<(ll(1)<<i)<<" ";
        }
        vector<char> ans;
        rep(i,0,N){
            X[i]--;
            rer(j,39,0){
                if(Y[i]>=X[i]&&Y[i]>=-X[i]){
                    ans.pb('U');
                    Y[i]-=(ll(1)<<j);
                }
                else if(Y[i]>=X[i]&&Y[i]<=-X[i]){
                    ans.pb('L');
                    X[i]+=(ll(1)<<j);
                }
                else if(Y[i]<=X[i]&&Y[i]>=-X[i]){
                    ans.pb('R');
                    X[i]-=(ll(1)<<j);
                }
                else if(Y[i]<=X[i]&&Y[i]<=-X[i]){
                    ans.pb('D');
                    Y[i]+=(ll(1)<<j);
                }
            }
            ans.pb('R');
            rev(ans);
            rep(j,0,40){
                cout <<ans[j];
            }
            cout <<"\n";
        }
    }
}

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

int  main()
{
	int a, b; cin >> a >> b;

	int d = abs(a-b);
	int ans = d * (d + 1) / 2; 
	cout << ans - b << endl;
	return (0);
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;

using System.Collections;

class Program
{
    static void Main()
    {
        int[] AB = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();

        int A = AB[0];
        int B = AB[1];

        if (A == B)
        {
            Console.WriteLine(A + B);
        }
        else
        {
            var val = Math.Max(A, B);
            Console.WriteLine(2 * val - 1);
        }
    }
}


Measured memory_bytes: 13268
import sys
from pprint import pprint

def solve(a, b, k):
    delta = a - k
    if delta < 0:
        b = b + delta
    print(max(0, delta), max(0, b))


if __name__ == '__main__':
    a, b, k = map(int, sys.stdin.readline().strip().split(" "))
    solve(a, b, k)

Measured memory_bytes: 38384
#include <iostream>
#include <queue>


using namespace std;

const int N = 1000;

int main()
{
	priority_queue<int> Q[N];
	int n, q;
	cin >> n >> q;
	
	while (q--)
	{
		int d, t;
		cin >> d >> t;
		if (d == 0)
		{
			int x;
			cin >> x;
			Q[t].push(x);
		}
		else if (d == 1)
		{
			if (!Q[t].empty())
				cout << Q[t].top() << endl;
		}
		else
		{
			if (!Q[t].empty())
				Q[t].pop();
		}
	}
}


Measured memory_bytes: 4156
#include<bits/stdc++.h>
typedef long long ll;
#define pii pair<int,int>
#define ff first
#define ss second
using namespace std;
void fast()
{
ios::sync_with_stdio(false);
cin.tie(NULL); cout.tie(NULL);
}
int main()
{
    ll n,i,j;
    ll a[105],ans1=0,sum=0,temp,ans=100000000;
    cin>>n;
    for(i=0;i<n;i++)
    {
        cin>>a[i];
    }
    for(i=-100;i<=100;i++)
    {
        temp=0;
        for(j=0;j<n;j++)
        {
            temp+=(i-a[j])*(i-a[j]);
        }
        ans=min(ans,temp);
    }
    cout<<ans<<endl;

}


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

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

 
typedef pair<int,int> P;
typedef long long ll;
 
const int INF = 1001001001;
const int MOD = 1000000007;
const double PI=acos(-1);

int main(){
    int N;
    cin >> N;
    vector<ll> A;
    ll prev = 0;
    rep(i,N) {
        ll a;
        cin >> a;
        if (prev!=a) {
            A.push_back(a);
        }
        prev=a;
    }
    N = A.size();
    bool buy = true;

    ll m = 1000;
    ll p = 0;
    ll kai = INF;
    rep(i,N) {
        if (buy) {
            ll next_up = 0;
            for (int j=i+1; j<N;j++) {
                if (A[i]<A[j]) {
                    next_up = A[j];
                    break;
                }
            }
            ll next_min = INF;
            for (int j=i;j<N;j++){
                next_min = min(next_min,A[j]);
                if (A[j]==next_up) break;
            }
            if (next_up>A[i] && next_min==A[i]) {
                p = m/A[i];
                m = m%A[i];
                buy = false;
                kai = A[i];
            }
        }
        else {
            bool t = false;
            if (i==N-1) {
                if (A[i]>kai) {
                    t = true;
                }
            }
            else {
                if (A[i]>kai && A[i]>A[i+1]) {
                    t = true;
                }
            }
            if (t) {
                m += p*A[i];
                p = 0;
                buy = true;
                kai = INF;
            }
        }
    }
    cout << m << endl;
}


Measured memory_bytes: 3580
#include <bits/stdc++.h>
#define IO                       \
    ios::sync_with_stdio(false); \
    cin.tie(0);                  \
    cout.tie(0);
#define mem(a, x) memset(a, x, sizeof(a))
#define per(x, a, b) for (int x = a; x <= b; x++)
#define rep(x, a, b) for (int x = a; x >= b; x--)

using namespace std;
typedef long long LL;
typedef pair<int, int> P;
const int maxn = 2e5 + 10;
const int mod = 1e9 + 7;
const double eps = 1e-8;

int n;
LL c[maxn];
LL a[maxn];
LL dp[maxn];
LL dn[maxn];
void solve() {
    mem(dp, 0);
    mem(dn, 0);
    LL len = 1;
    a[len++] = c[0];
    for (int i = 1; i < n; i++) {
        if (c[i] == c[i - 1])
            continue;
        a[len++] = c[i];
    }
    dp[1] = dp[0] = 1;
    dn[a[1]] = 1;
    for (int i = 2; i < len; i++) {
        dp[i] = dp[i - 1];
        LL tmp = 0;
        tmp += dn[a[i]];
        tmp %= mod;
        dp[i] += tmp;
        dp[i] %= mod;
        dn[a[i]] += dp[i - 1];
        dn[a[i]] %= mod;
    }
    cout << dp[len - 1] << endl;
}
int main() {
#ifdef LOCAL_IM0QIANQIAN
    freopen("test.in", "r", stdin);
//    freopen("test.out", "w", stdout);
#else
    IO;
#endif // LOCAL_IM0QIANQIAN

    while (cin >> n) {
        for (int i = 0; i < n; i++) {
            cin >> c[i];
        }
        solve();
    }
    return 0;
}

Measured memory_bytes: 6528
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <cfloat>
#include <fstream>
#include <limits.h>
#include <list>
#include <math.h>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <utility>
#include <sstream>
// *テンプレート*
#define int long long
#define rep(i, n) for (int i = 0; i < (n); i++)
#define P pair<int, int>
// aよりbの方が小さかったら、aの値をbの値に置き換える。(swapではない！)
template<class T> inline bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}
// aよりbの方が大きかったら、aの値をbの値に置き換える。
template<class T> inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}

using namespace std;
typedef long long ll;
using Graph = vector<vector<int>>;
//最大公約数
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	return gcd(b, a % b);
}
//最小公倍数
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
// 素数かどうか判定
bool prime(int n) {
	for (int i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}

const long long MOD = 1000000007;
const long long INF = 1LL << 60;
// *テンプレートここまで*

// pair -> vector<pair<int,int>> 
//		   AandB.push_back(make_pair(a[i],b[i]))



signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int cnt1 = 0;
	int cnt2 = 0;
	int n; cin >> n;
	vector<int>a(n); rep(i, n)cin >> a[i];
	rep(i, n) {
		if (a[i] % 2 == 0) {
			if (a[i] % 4 == 0) {
				cnt1++;
			}
			else {
				cnt2++;
			}
		}
	}
	int tmp = n / 2;
	if (cnt1 >= tmp) {
		cout << "Yes" << endl;
	}
	else {
		n -= cnt1 * 2;
		if (n == cnt2) {
			cout << "Yes" << endl;
		}
		else {
			cout << "No" << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define INF 2147483647
#define SYOU(x) setprecision(x)
using namespace std;
int i[1111111];
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int a,b,c,d=0,e,f;
  cin >>a>>b>>c;
  d=a+b,e=b+c,f=a+c;
  cout <<min(d,min(e,f))<<'\n';
  return (0);
}


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

const int MAXN = 2e5+4;
int a[MAXN];

//random_02
int main() {    
    int k,n;
    cin>>k>>n;

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

    int maxx = 0;
    unsigned long long ans = 0;
    for (int i=1; i<=n; i++) {
        int t = a[i]-a[i-1];
        maxx = max(maxx, t);
        ans += t;
    }
    ans -= maxx;

    cout << ans << endl;

    return 0;
}

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

int main() {
  string s,t;
  cin>>s>>t;
  cout<<t+s;
}

Measured memory_bytes: 256
n, m = gets.split.map(&:to_i)
submits = []
aced = Array.new(n + 1, false)
m.times do
  tmp1, tmp2 = gets.split
  submits << [tmp1.to_i, tmp2]
end
count = 0

submits.each_with_index do |submit, index|
  problem, result = submit[0], submit[1]
  if result == "AC"
    aced[problem] = index if aced[problem] == false
  end
end

submits.each_with_index do |submit, index|
  problem, result = submit[0], submit[1]
  if result == "WA" && aced[problem] != false && aced[problem] > index
    count += 1
  end
end

aced_sum = aced.count { |i| i != false } 
puts "#{aced_sum} #{count}"


Measured memory_bytes: 15740
// https://atcoder.jp/contests/abc164/tasks/abc164_c

#include "algorithm"
#include "bitset"
#include "cmath"
#include "functional"
#include "iomanip"
#include "iostream"
#include "map"
#include "numeric"
#include "queue"
#include "set"
#include "string"
#include "vector"
#define rep(i, to) for (ll i = 0; i < (to); ++i)
#define rep1(i, to) for (ll i = 1; i <= (to); ++i)
#define repf(i, from, to) for (ll i = from; i < (to); ++i)
#define repr(i, from) for (ll i = from - 1; i >= 0; --i)
#define all(vec) vec.begin(), vec.end()
#define unless(cond) if (!(cond))
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef long double ld;
template <typename T>
using V = vector<T>;
using VL = V<ll>;
using VVL = V<VL>;
template <typename T, typename U>
using P = pair<T, U>;
using PL = P<ll, ll>;
using VPL = V<PL>;

template <typename T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}

template <typename T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}

struct exit_exception : public std::exception {
  const char* what() const throw() { return "Exited"; }
};

template <typename T>
void drop(T res) {
  cout << res << endl;
  throw exit_exception();
}

const ll INF = 1e18;

void solve();

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

  try {
    solve();
  } catch (exit_exception& e) {
  }

  return 0;
}
#endif

void solve() {
  ll N;
  cin >> N;

  set<string> s;

  rep(i, N) {
    string a;
    cin >> a;
    s.insert(a);
  }

  ll res = s.size();
  cout << res << "\n";
}


Measured memory_bytes: 19288
//#include <bits/stdc++.h>
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <stdio.h>
#include <queue>
#include <deque>
#include <set>
#include <stack>
#include <time.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;

#define fi first
#define se second

const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll MOD3 = 1812447359;
const ll INF = 1ll << 62;
const double PI = 2 * asin(1);

void yes() {printf("yes\n");}
void no() {printf("no\n");}
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}

ll N;
Pll P[int(1e5 + 5)];

int main(){
  scanf("%lld", &N);
  multiset <ll> mst = {0, 0, N+1, N+1};
  for (ll i = 0; i < N; i++){
    scanf("%lld", &P[i].fi);
    P[i].se = i + 1;
  }
  sort(P, P + N, greater<Pll>());

  ll ans = 0;
  for (int i = 0; i < N; i++){
    mst.insert(P[i].se);
    auto iter1 = mst.find(P[i].se);
    auto iter2 = iter1;

    iter1--; ll L1 = *iter1;
    iter1--; ll L2 = *iter1;

    iter2++; ll R1 = *iter2;
    iter2++; ll R2 = *iter2;

    ll cnt = (L1-L2) * (R1-P[i].se) + (P[i].se-L1) * (R2-R1);
    ans += cnt * P[i].fi;
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 9896
/*
 * Created by Dipta Das on 16-05-2019
 * Title: 
 * Problem Link: 
 * Editorial: 
 * Source Code: 
 * Comments: 
*/

#include <bits/stdc++.h>
#include <stdio.h>
#define fin freopen("input", "r", stdin)
#define whatis(x) cerr << #x << ": " << x << endl;

using namespace std;
using ll = long long;
string match = "ACGT";
bool matchs (char x) {
    for (char i : match) {
        if (i == x) return true;
    }
    return false;
}

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

    string s;
    cin >> s;
    int ans = 0;
    int cnt = 0;

    for (int i = 0; i < (int) s.length(); ++i) {
        if (matchs(s[i])) ++cnt;
        else {
            ans = max (cnt, ans);
            cnt = 0;
        }
    }
    ans = max (cnt, ans);

    cout << ans << endl;


    


    return 0;
}



Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
int main()
{
 int i,k,l,j;
 char ch[100];
 	while(gets(ch))
 	{
 		l=strlen(ch);
 	if(l<=1)
 	return 0;
 		for(i=0;i<l;i++)
 		{
 			if(ch[i]=='C')
 			{
 				for(j=i;j<l;j++)
 				{
 					if(ch[j]=='F')
					 {
					 	//printf("Yes\n");
						break;
					 	//return 0;
 				     }
 					
 				}
 				if(j>=l)
 				{
 						printf("No\n");
 						break;
 				}
 				else
 				{
 					printf("Yes\n");
 					break;
 				}
 			
 			}
 		}
 		if(i>=l)
 		{
 			printf("No\n");
 		}
 	}
	return 0;
}										
										
									

Measured memory_bytes: 128
/*
 * B.cpp
 *
 *  Created on: 2018/07/04
 *      Author: saca
 */


#include <iostream>
#include <string>

using namespace std;

int main()
{
	int n, i, min, max;

	cin >> n;

	int a;

	min = 1000000000;
	max = 1;

	for(i = 0; i < n; i++){

		cin >> a;
		if(min > a) min = a;
		if(max < a) max = a;
	}

	cout << max - min << endl;

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <math.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rrep(i, n) for(int i = (n-1); i >= 0; i--)
using namespace std;
typedef long long ll;
const int MOD = 1000000007;
const ll INF = 1LL<<60;
const int IINF = 1000000000;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main(){

    int N; cin >> N;
    ll K; cin >> K;
    vector<ll> A(N);
    rep(i,N) cin >> A[i];

    ll ng = 0;
    ll ok = 1e9;
    
    while(abs(ok-ng)>1){
        ll mid = (ok+ng) / 2;
        auto f = [&](ll mid){
            ll count = 0;
            rep(i,N){
                count += (A[i]+(mid-1))/mid-1;
            }
            return count <= K; 
        };
        if(f(mid)) ok = mid;
        else ng = mid;
    }

    cout << ok << endl;

}

Measured memory_bytes: 4752
n = int(input())
a = [int(x) for x in input().split()]
print(*a)
for i in range(1, n):
    k, j = a[i], i-1
    while j >= 0 and a[j] > k:
        a[j+1], j = a[j], j-1
    a[j+1] = k
    print(*a)

Measured memory_bytes: 8108
#include <iostream>
#include <stdio.h>
#include<math.h>
#include <vector>
#include <cctype>

using namespace std;


int main()
{
	

	long long A;
	string s;
	int ss;

	cin >> A>>s;
	
	ss = (s[0] - '0') * 100+(s[2]- '0')*10+(s[3]-'0');

	long long l = (A * ss)/100;

	cout << l << endl;

	return 0;

}


Measured memory_bytes: 3628
import java.util.*;

public class Main {

    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        int k = sc.nextInt();
        int x = sc.nextInt();

        for(int i = x-k+1;i < x+k;i++){
            System.out.print(i);
            if(i != x+k-1) {
                System.out.print(" ");
            }
        }
    }
}




Measured memory_bytes: 21332
import scala.io.StdIn._

object Main {
    def main(args: Array[String]): Unit = {
        readLine
        var a = 0
        var b = 0
        readLine.split(" ").map(_.toInt).sorted.zipWithIndex.foreach { (x) =>
            x._2 % 2 match {
                case 0 => a += x._1
                case 1 => b += x._1
            }
        }
        println(scala.math.abs(a - b))
    }
}

Measured memory_bytes: 25408
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  long n,k,ans;
  ans=0;
  cin>>n>>k;
  for(long i=k; i<=n+1; i++){
    ans=ans+1+(n+n-i+1)*i/2-i*(i-1)/2;
    ans=ans%1000000007;
  }
  cout<<ans;
}

Measured memory_bytes: 3636
#include<stdio.h>
#define INF 1000000
void warshall_floyd();
int min(int,int);
int graph[101][101],n,c,d;

int main(){
  int k,i,j,x,e,a,b;

  while(scanf("%d %d",&n,&k),n,k){

    for(i=0;i<=n;i++)
      for(j=0;j<=n;j++)
	graph[i][j]=i==j?0:INF;

    for(i=0;i<k;i++){

      if(scanf("%d",&x),x){
	scanf("%d %d %d",&c,&d,&e);

	if(graph[c][d]>e){
	graph[c][d]=graph[d][c]=e;
	warshall_floyd();
	}
      }else{
	scanf("%d %d",&a,&b);
	printf(graph[a][b]>=INF?"-1\n":"%d\n",graph[a][b]);
      }
    }
  }
  return 0;
}

void warshall_floyd(){
  int i,j;
  for(i=1;i<=n;i++)
    for(j=1;j<=n;j++)
      graph[i][j]=graph[j][i]=min(graph[i][j],graph[i][c]+graph[c][d]+graph[d][j]);
}

int min(int x,int y){
  return x<y?x:y;
}

Measured memory_bytes: 808
#include <bits/stdc++.h>
 
using namespace std;
 
#define ll long long
#define F(i,a,b) for(long long i=a;i<b;i++)
#define pb push_back
#define ff first
#define ss second
#define yes cout << "YES\n"
#define no cout << "NO\n"
 
 
ll gcdExtended(ll a, ll b){
    if (b == 0){
        return a;
    }
    else
        return gcdExtended(b,a%b);
}
vector<ll>v,dp;
ll func(ll x,ll n)
{
    if(dp[x]!=-1)
    {
        return dp[x];
    }
    if(x>=n-1)
    {
        return 0;
    }
    if(x==n-2)
    {
        return abs(v[n-1]-v[n-2]);
    }
    dp[x]=min(abs(v[x]-v[x+1])+func(x+1,n),abs(v[x]-v[x+2])+func(x+2,n));
    return dp[x];
}
float pi=3.1415926535;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    long long t=1;
   // cin>>t; 
    while(t--)
    {
        ll n;
        cin>>n;
        ll a[n];
        F(i,0,n)
        {
            cin>>a[i];
            v.pb(a[i]);
            dp.pb(-1);
        }
        ll ans=func(0,n);
        cout<<ans<<endl;
    }
    return 0;
}

Measured memory_bytes: 8716
#include<iostream>
#include <string>
using namespace std;
int main()
{
	int n, m, x;
	cin >> n >> m >> x;
	int a[m];
	int ans;
	int t;
	for (t = 0; t < m; t++){
		cin >> a[t];
	}
	for (t = 0; a[t] <= x;t++){
		ans++;
	}
	if (ans > m - ans){
		ans = m - ans;
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef int ll;
typedef long double ld;
const ll N = 100005;
char en = '\n';
ll inf = 1e16;
ll mod = 1e9 + 7;
ll power(ll x, ll n, ll mod) {
  ll res = 1;
  x %= mod;
  while (n) {
    if (n & 1)
      res = (res * x) % mod;
    x = (x * x) % mod;
    n >>= 1;
  }
  return res;
}

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

  ll n;
  cin >> n;
  ll arr[n + 5];
  for (ll i = 1; i <= n; i++) {
    cin >> arr[i];
  }
  ll dp[n + 5];
  arr[n + 1] = inf;

  for (ll i = n; i >= 1; i--) {
    if (arr[i] >= arr[i + 1])
      dp[i] = 1 + dp[i + 1];
    else
      dp[i] = 1;
  }

  cout << (*max_element(dp + 1, dp + n + 1)) - 1 << en;

  return 0;
}

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

int main()
{
    long long A,B,res=0;
  cin >> A >> B ;
    if(A%2==B%2)
    {
        res=(A+B)/2;
        cout << res<< endl;

    }
    else{
        cout << "IMPOSSIBLE"<<endl;
    }
    return 0;
}

Measured memory_bytes: 3632
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

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

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

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

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

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

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

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

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

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

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

fn main() {
    input! {
        a: String,
        b: String,
    }
    if a.len() > b.len() {
        println!("GREATER");
        return;
    }
    if b.len() > a.len() {
        println!("LESS");
        return;
    }
    for i in 0..a.len() {
        if a.chars().nth(i) > b.chars().nth(i) {
            println!("GREATER");
            return;
        }
        if b.chars().nth(i) > a.chars().nth(i) {
            println!("LESS");
            return;
        }
    }
    println!("EQUAL");
}


Measured memory_bytes: 4352
'use strict';

function main(input) {
  const inputs = input.split('\n').map((x) => x | 0);

  const N = inputs[0];
  const K = inputs[1];
  const X = inputs[2];
  const Y = inputs[3];

  let total = 0;
  for (let i = 1; i <= N; i++) {
    if (i <= K) {
      total += X;
    } else {
      total += Y;
    }
  }
  console.log(total);
}

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


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

int main() {
    int N,x=0;
    map<string, int> m;
    vector<string> r;
    string S;
    cin >> N;

    rep(i,N) {
        cin >> S;
        if(!m.count(S))
            m[S] = 1;
        else
            m.at(S)++;
        x = max(x, m.at(S));
    }

    for(auto p : m)
        if(p.second == x)
            r.push_back(p.first);
    sort(r.begin(), r.end());

    rep(i,r.size())
        cout << r.at(i) << endl;
}

Measured memory_bytes: 26868
#define _USE_MATH_DEFINES

#include<iostream>
#include<stdio.h>
#include<math.h>
#include<cmath>

using namespace std;

int main() {
	int d, a; double rad = 0; double x = 0, y = 0;
	while (true) {
		scanf("%d,%d", &d, &a);
		if (d == 0 && a == 0)break;
		y += d*cos(rad*M_PI/180);
		x += d*sin(rad*M_PI/180);
		rad =rad+a;
	}
	cout <<int(x) << endl <<int(y) << endl;
}

Measured memory_bytes: 3508
#include <iostream>
#include <bits/stdc++.h>
#define pb push_back
#define ob pop_back
#define xx first
#define yy second
#define dob double
#define int long long int
#define ss size()
using namespace std;
const int M=1e9+7,maxn=100011;
std::vector<int> adj[maxn];
std::vector<int> v1;
int ans,n,k,m,x,y,tt,q,par[maxn],h[maxn],mach[maxn],sk[maxn],dp[maxn],st[maxn],ft[maxn];
bool mark[maxn];




int dfs(int v){
    tt++;
    mark[v]=1;
    st[v]=tt;
    for(int i=0;i<adj[v].ss;i++){
        int u=adj[v][i];
        if(mark[u]==0){
            tt++;
            dfs(u);
        }
    }
    tt++;
    ft[v]=tt;
    v1.pb(v);
}
int32_t main(){
    cin>>n>>m;
    for(int i=0;i<m;i++){
        cin>>x>>y;
        adj[x].pb(y);
    }
    for(int i=1;i<=n;i++)
        if(mark[i]==0)
            dfs(i);
    reverse(v1.begin(),v1.end());
    for(int i=v1.ss-1;i>-1;i--){
        k=v1[i];
        dp[k]=0;
        for(int j=0;j<adj[k].ss;j++)
            dp[k]=max(dp[k],dp[adj[k][j]]+1);
    }
    for(int i=1;i<=n;i++)
        ans=max(ans,dp[i]);
    cout<<ans;
    return 0;

}


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

using namespace std;

int d[10][10];

void warshallFloyd(int n) {
  for (int k = 0; k < n; k++) {
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < n; j++) {
        d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
      }
    }
  }
}

int main(void) {
  int h, w;
  cin >> h >> w;

  for (int i = 0; i < 10; i++) {
    for (int j = 0; j < 10; j++) {
      cin >> d[i][j];
    }
  }
  warshallFloyd(10);

  int a[210][210], ans = 0;
  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      cin >> a[i][j];
      if (a[i][j] < 0 || a[i][j] == 1) continue;
      ans += d[a[i][j]][1];
    }
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 384
class Tree
    def initialize
        @children = []
    end

    def show(indent = 0)
        puts ?. * indent + name
        @children.each {|c| c.show(indent + 1)}
    end
    attr_accessor :children, :name
end

n = gets.to_i
a = (0..n).map{Tree.new}

(1..n).each do |i|
    a[gets.to_i].children << a[i]
    a[i].name = gets.chomp
end

a[1].show

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

int main(void)
{
	int n, a, q, k;
	cin >> n;
	vector<int> A;
	rep(i, n)
	{
	    cin >> a;
		A.push_back(a);
	}
    
    cin >> q;
	rep(i, q)
	{
	    cin >> k;
	    if (binary_search(A.begin(), A.end(), k))
	    {
            cout << 1 << endl;
        }
        else
        {
            cout << 0 << endl;
        }
	}
}


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

using namespace std;

const long long int INF = 1LL<<60;
const long long int mod = 1e9 + 7;

long long int rec(vector<vector<long long int>> &dp, int i, int j, vector<int> &a) {
  if(dp[i][j] != INF) return dp[i][j];

  int N = dp.size() - 1;

  int ops = N - (j - i + 1);
  if(ops%2 == 0) {
    dp[i][j] = max(a[i] + rec(dp, i+1, j, a), a[j] + rec(dp, i, j-1, a));
    return dp[i][j];
  } else {
    dp[i][j] = min(rec(dp, i+1, j, a) - a[i], rec(dp, i, j-1, a) - a[j]);
    return dp[i][j];
  }
}

int main() {
  int N;
  cin >> N;
  vector<int> a(N+1);
  for(int i=1; i<=N; i++) {
    cin >> a.at(i);
  }

  // x-y will be stored in dp
  vector<vector<long long int>> dp(N+1, vector<long long int>(N+1, INF));
  // initialize
  for(int i=1; i<=N; i++) {
    if(N%2 == 1) {
      dp[i][i] = a[i];
    } else {
      dp[i][i] = -a[i];
    }
  }

  long long int res = rec(dp, 1, N, a);

  cout << res << endl;
  return 0;
}

Measured memory_bytes: 71040
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <complex>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <stack> 
#include <bitset>
#include <queue>
#include <assert.h>
#include <unordered_map>
using namespace std;

int main()
{
	int n;
	cin >> n;
	cout << n + n * n + n * n * n << endl;
	return 0;
}


Measured memory_bytes: 3224