akhauriyash/Code-Regression huggingface dataset:
#include <array>
#include <cmath>
#include <iostream>
#include <vector>
using namespace std;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  int N, K, x;
  cin >> N >> K;
  int dist = 0;
  for (size_t i = 0; i < N; i++) {
      cin >> x; 
      if (K < x) {
          dist += (x - K); 
      } else {
        dist += (x > (K - x)) ? (K - x) :  x;
      }
  }

  cout << dist * 2;
}


Measured memory_bytes: 3596
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_set>
#include<bitset>
using namespace std;
//#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define ARDEB(i,X) cout<< #X <<"["<<i<<"]: "<<X[i]<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define ARDEB(i,X) {}
#define END {}
#endif
typedef long long int ll;
typedef pair<int,int> P;
struct edge{int to,cost;};
#define REP(i,n) for(int i=0;i<(n);i++)
const int INF=100000000;

int main(){
	int a,b,c,d;
	cin>>a>>b>>c>>d;
	cout<<min(a,b)+min(c,d)<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <queue>
#define MOD (1000000007l)
#define rep(i, n) for(long i = 0; i < n; i++)

using namespace std;

unordered_map<long, unordered_map<long, long>> neibors;
unordered_map<long, long> distances;
unordered_map<long, bool> used;

void calc_distance(long current) {
  long current_distance = distances[current];
  for (auto it: neibors[current]) {
    if (used[it.first]) continue;
    used[it.first] = true;
    distances[it.first] = current_distance + it.second;
    calc_distance(it.first);
  }
}

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

  rep(i, N - 1) {
    long a, b, c;
    cin >> a >> b >> c;
    neibors[a][b] = c;
    neibors[b][a] = c;
  }

  long Q, K;
  cin >> Q >> K;

  distances[K] = 0;
  used[K] = true;
  calc_distance(K);

  rep (i, Q) {
    // cerr << "-----------" << i << endl;
    long x, y;
    cin >> x >> y;
    cout << distances[x] + distances[y] << endl;
  }

  return 0;
}


Measured memory_bytes: 36004
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>

using namespace std;

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

Measured memory_bytes: 3560
#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
const ld eps = 1e-9;

//// < "d:\d_download\visual studio 2015\projects\programing_contest_c++\debug\a.txt" > "d:\d_download\visual studio 2015\projects\programing_contest_c++\debug\b.txt"


int main() {
	int N; cin >> N;
	vector<pair<int, int>>as, bs;
	bool ok = true;
	{
		int t = 0;
		for (int i = 0; i <= N; ++i) {
			int a; cin >> a;
			for (int j = 0; j < a; ++j) {
				as.emplace_back(i, t++);
			}
		}
		if (t != N)ok = false;
		t = 0;
		for (int i = 0; i <= N; ++i) {
			int b; cin >> b;
			for (int j = 0; j < b; ++j) {
				bs.emplace_back(i, t++);
			}
		}
		reverse(as.begin(), as.end());
		reverse(bs.begin(), bs.end());
		if (t != N)ok = false;
	}
	
	if (ok) {
		vector<vector<int>>edges(N, vector<int>(N));
		for (int i = 0; i < N; ++i) {
			sort(bs.begin(), bs.end(), greater<pair<int, int>>());
			int rest = as[i].first;
			for (int j = 0; j < N; ++j) {
				if (rest&&bs[j].first) {
					bs[j].first--;
					edges[as[i].second][bs[j].second] = 1;
					rest--;
				}
			}
			if (rest) {
				ok = false;
				break;
			}

		}

		if (any_of(bs.begin(), bs.end(), [](const pair<int, int>&p) {
			return p.first > 0;
		})) {
			ok = false;
		}
		if (ok) {
			cout << "YES" << endl;
			for (int i = 0; i < N; ++i) {
				for (int j = 0; j < N; ++j) {
					cout << edges[j][i];
					if (j == N - 1)cout << endl;
					else cout << " ";
				}
			}
		}
	}
	
	
	if(!ok){
		cout << "NO" << endl;
	}
	return 0;
}

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

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

int main(){
  int K;
  cin >> K;
  int sum = 0;
  for(int a=1;a<=K;a++)
    for(int b=1;b<=K;b++)
      for(int c=1;c<=K;c++)
        sum += gcd(a,gcd(b,c));
  cout << sum << endl;
}

Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
#define SPEED ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long
#define endl '\n'
#define vi vector<ll>
#define vb vector<bool>
#define mii map<ll, ll>
#define pii pair<ll, ll>
#define pb push_back
#define fi first
#define se second
#define mod 1000000007
// ll dp[][]
ll power(ll a, ll b){
    ll res = 1;
    while(b!=0){
        if(b&1){
            res *= a; 
        }
        a = (a * a);
        b = (b / 2);
    }
    return res;
}
int main(){
    SPEED;
    ll n, k, i, j;
    cin>>n>>k;
    vi v(n) ,dp;
    for(i=0;i<n;i++){
        cin>>v[i];
    }
    dp.pb(0);
    for(i=1;i<n;i++){
        ll x = mod, a = 0;
        for(j=max(a, i-k);j<i;j++){
            x = min(x, abs(v[i]-v[j]) + dp[j]);
        }
        dp.pb(x);
    }
    cout<<dp[n-1];
    return 0;
}

Measured memory_bytes: 2168
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define REPR(i,n) for (int i=(int)(n)-1;i>=0;--i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define valid(y,x,h,w) (0<=y&&y<h&&0<=x&&x<w)
#define tpl(...) make_tuple(__VA_ARGS__)
const int INF = 0x3f3f3f3f;
const double EPS = 1e-8;
const double PI = acos(-1);
const int dy[] = {-1,0,1,0};
const int dx[] = {0,1,0,-1};
typedef long long ll;
typedef pair<int,int> pii;
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; }
template<typename Ch,typename Tr,typename C,typename=decltype(begin(C()))>basic_ostream<Ch,Tr>& operator<<(basic_ostream<Ch,Tr>&os,
const C& c){os<<'[';for(auto i=begin(c);i!=end(c);++i)os<<(i==begin(c)?"":" ")<<*i;return os<<']';}
template<class S,class T>ostream&operator<<(ostream &o,const pair<S,T>&t){return o<<'('<<t.first<<','<<t.second<<')';}
template<int N,class Tp>void output(ostream&,const Tp&){}
template<int N,class Tp,class,class ...Ts>void output(ostream &o,const Tp&t){if(N)o<<',';o<<get<N>(t);output<N+1,Tp,Ts...>(o,t);}
template<class ...Ts>ostream&operator<<(ostream&o,const tuple<Ts...>&t){o<<'(';output<0,tuple<Ts...>,Ts...>(o,t);return o<<')';}
template<class T>void output(T t,char z=10){if(t<0)t=-t,putchar(45);int c[20];
int k=0;while(t)c[k++]=t%10,t/=10;for(k||(c[k++]=0);k;)putchar(c[--k]^48);putchar(z);}
template<class T>void outputs(T t){output(t);}
template<class S,class ...T>void outputs(S a,T...t){output(a,32);outputs(t...);}
template<class T>void output(T *a,int n){REP(i,n)cout<<a[i]<<(i!=n-1?',':'\n');}
template<class T>void output(T *a,int n,int m){REP(i,n)output(a[i],m);}
template<class T>bool input(T &t){int n=1,c;for(t=0;!isdigit(c=getchar())&&~c&&c-45;);
if(!~c)return 0;for(c-45&&(n=0,t=c^48);isdigit(c=getchar());)t=10*t+c-48;t=n?-t:t;return 1;}
template<class S,class ...T>bool input(S&a,T&...t){input(a);return input(t...);}
template<class T>bool inputs(T *a, int n) { REP(i,n) if(!input(a[i])) return 0; return 1;}

int ans[100010];
int main() {
  string s;
  while (cin >> s) {
    memset(ans,0,sizeof(ans));
    int n = s.size();
    int r = 0;
    REP(i,n-1) {
      if (s[i] == 'R') r++;
      if (s[i+1] == 'L') {
        int l = 0;
        int j = i;
        i++;
        while(i<n && s[i] == 'L') i++,l++;
        int a1 = (r+1)/2 + l/2;
        int a2 = r/2 + (l+1)/2;
        // cout << tpl(j,a1,a2) << endl;
        ans[j] = a1;
        ans[j+1] = a2;
        r = 0;
        i--;
      }
    }
    REP(i,n) printf("%d%c", ans[i], i!=n-1?' ':'\n');
  }
}


Measured memory_bytes: 1024
import java.util.*;

class Main{
    int n,a,b;
    int[] dp;
    int Max = 1000001;

    void solve(){
	Scanner sc = new Scanner(System.in);
	while(true){
	    n = sc.nextInt();
	    a = sc.nextInt();
	    b = sc.nextInt();
	    if(n==0 && a==0 && b==0) break;

	    dp = new int[Max];
	    for(int i=1; i<=n; i++){
		if(i%a==0)dp[i] = 1;
	    }
	    dp[b] = 1;
	    for(int i=1; i+b<=n; i++){
		if(dp[i]==1)dp[i+b] = 1;
	    }

	    int unableCount = 0;
	    for(int i=1; i<=n; i++){
		if(dp[i]==0)unableCount++;
	    }

	    System.out.println(unableCount);
	}
    }

    public static void main(String[] args){
	new Main().solve();
    }
}

Measured memory_bytes: 20000
import sys
def main():
    input = sys.stdin.readline
    N=int(input())
    *A,=map(int, input().split())

    B=[i-A[i] for i in range(N)]
    C=[i+A[i] for i in range(N)]
    from collections import Counter
    b=Counter(B)
    c=Counter(C)
    ans=0
    for k,v in b.items():
        ans+=v*c[k]
    print(ans)

if __name__ == '__main__':
    main()

Measured memory_bytes: 147228
#include <bits/stdc++.h>
#include <numeric>
using namespace std;
using ll = long long;

ll R, S, P;

ll RSP(char c) {
  ll n;
  if (c == 'r') {
    n = P;
  } else if (c == 's') {
    n = R;
  } else if (c == 'p') {
    n = S;
  }
  return n;
}

char change(char c) {
  char a;
  if (c == 'r') {
    a = 'p';
  } else if (c == 's') {
    a = 'r';
  } else if (c == 'p') {
    a = 's';
  }
  return a;
}

int main() {
  ll N, K;
  string T;
  cin >> N >> K >> R >> S >> P >> T;
  ll result = 0;
  string answer = "";
  for (int i = 0; i < N; ++i) {
    char c = T.at(i);
    ll n = RSP(c);
    char a = change(c);
    if (K <= i) {
      char ak = answer.at(i - K);
      if (a == ak) {
        answer += 'a';
      } else {
        answer += a;
        result += n;
      }
    } else {
      answer += a;
      result += n;
    }
  }
  cout << result << endl;
}

Measured memory_bytes: 640
import numpy as np
n,x = map(int, input().split())
l = list(map(int, input().split()))
pop = [0] * (n)
pre = 0
for idx,i in enumerate(l):
  pop[idx] = pre + i
  pre = pop[idx]

print(np.sum(np.array([0]+pop) <= x))

Measured memory_bytes: 20896
#include <bits/stdc++.h>
#define itn int
#define REP(i, n) for (ll i = 0; i < n; i++)
#define IREP(i, n) for (ll i = n - 1; i >= 0; i--)
#define FOR(a, b) for (ll i = a; i < b + 1; i++)
#define all(v) v.begin(), v.end()
#define SENTINEL 2000000000
#define NIL -1
using namespace std;
typedef long long ll;

const ll INF = 1LL << 60;
const ll MOD = 1000000007;
template <class T>inline bool chmin(T &a, T b){if(a>b){a=b;return true;}return false;}
template <class T>inline bool chmax(T &a, T b){if(a<b){a=b;return true;}return false;}
vector<ll> divisor(ll n)
{
    vector<ll> ret;
    for (ll i = 1; i * i <= n; i++)
    {
        if (n % i == 0)
        {
            ret.push_back(i);
            if (i * i != n)
                ret.push_back(n / i);
        }
    }
    sort(begin(ret), end(ret));
    return (ret);
}

int main()
{
    ll n;
    cin >> n;
    ll ans=0;
    vector<ll> v1=divisor(n);
    vector<ll> v2=divisor(n-1);
    REP(i,v1.size()){
        if(i==0)continue;
        ll tmp=n;
        while(tmp%v1[i]==0){
            tmp/=v1[i];
        }
        if(tmp%v1[i]==1){
            ans++;
        }
    }
    ans += (v2.size() - 1);
    cout << ans << endl;
}


Measured memory_bytes: 384
#include <stdio.h>
#include <string.h>
typedef struct{
	int face[7];
}cube;
int rotation(char direction,cube *C){
	int temp;
	//cube C;
	switch(direction){
		case 'N':
			temp=C->face[4];
			C->face[4]=C->face[0];
			C->face[0]=C->face[1];
			C->face[1]=C->face[5];
			C->face[5]=temp;
		break;
		case 'E':
			temp=C->face[3];
			C->face[3]=C->face[5];
			C->face[5]=C->face[2];
			C->face[2]=C->face[0];
			C->face[0]=temp;
		break;
		case 'S':
			temp=C->face[0];
			C->face[0]=C->face[4];
			C->face[4]=C->face[5];
			C->face[5]=C->face[1];	
			C->face[1]=temp;//printf("S\n");
		break;
		case 'W':
			temp=C->face[0];
			C->face[0]=C->face[2];
			C->face[2]=C->face[5];
			C->face[5]=C->face[3];
			C->face[3]=temp;
		break;
		case 'R':
			temp=C->face[3];
			C->face[3]=C->face[4];
			C->face[4]=C->face[2];
			C->face[2]=C->face[1];
			C->face[1]=temp;
		break;
		case 'L':
			temp=C->face[3];
			C->face[3]=C->face[1];
			C->face[1]=C->face[2];
			C->face[2]=C->face[4];
			C->face[4]=temp;
		default :
		break;
	}
	return 1;
}
int main(void) {
	int n;
	int same=1;
	scanf("%d",&n);
	cube C[105];
	for(int j=0;j<n;j++){
		for(int i=0;i<6;i++)scanf("%d",&C[j].face[i]);
	}
	for(int x=0;x<n;x++){
	for(int c=x+1;c<n;c++){
		for(int i=0;i<6;i++){
			for(int j=0;j<4;j++){//printf("\n");
				for(int k=0;k<6;k++){//for(int g=0;g<6;g++)//printf("%d ",C[c].face[g]);
					if(C[x].face[k] != C[c].face[k]){
						break;
					}else if(k==5){
						//same++;//printf("%d\n",same);
						printf("No\n");
						x=150;
						c=150;
						i=100;
						j=100;
					}
				}
				rotation('L',&C[c]);
			}
			rotation((i%2)?'R':'L',&C[c]);
			rotation('N',&C[c]);
		}
	}
	if(x+1==n){
		printf("Yes\n");
		x=150;
	}
	}
	return 0;
}



Measured memory_bytes: 2104
N , M ,X = map(int,input().split())
L = []
for _ in range(N):
    l = list(map(int,input().split()))
    L.append(l)
ans = []
for i in range(2 ** N):
    rikai = [0 for _ in range(M)]
    cost = 0
    for b in range(N):
        if i  & (1 <<  b):
            for x in range(1,M + 1):
                rikai[x-1] += L[b][x] 
            cost += L[b][0]
    for x in rikai:
        if x < X: break
    else:
        ans.append(cost)
try:
    print(min(ans))
except:
    print(-1)


Measured memory_bytes: 9232
#include <bits/stdc++.h>
using namespace std;
#define all(c) (c).begin(), (c).end()

int main() {
    int N, m; cin >> N >> m;
    vector<char> goback(N, 0);
    while (m--) {
        int c, d; cin >> c >> d;
        fill_n(goback.begin() + c, d - c, 1);
    }
    cout << count_if(all(goback), [&](char c) { return c == 1; }) * 2 + N + 1 << endl;
}

Measured memory_bytes: 3100
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <list>
#include <queue>
#include <tuple>
#include <deque>
#include <algorithm>
#include <numeric>
#include <iomanip>
#include <utility>
#include <complex>
#include <functional>
using namespace std;
const int MOD = 1000000007;
typedef long long ll;
typedef pair<ll, ll> p;
const int INF = (1 << 28);
const int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0};
const int Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1}, Dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
int h, w;
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> h >> w;
    char c[h][w];
    queue<p> black;
    int ans[h][w];
    for (int i = 0; i < h; i++)
    {
        for(int j=0;j<w;j++){
            cin>>c[i][j];
            if(c[i][j]=='#'){
                black.push(make_pair(i,j));
            }
            ans[i][j]=0;
        }
    }

    while(!black.empty()){
        int x=black.front().first;
        int y=black.front().second;
        black.pop();
        for(int i=0;i<4;i++){
            int xx=x+dx[i];
            int yy=y+dy[i];
            if(xx>=0&&yy>=0&&xx<h&&yy<w){
                if(c[xx][yy]=='.'){
                    c[xx][yy]='#';
                    black.push(make_pair(xx,yy));
                    ans[xx][yy]=ans[x][y]+1;
                }
            }
        }
    }
    int tans=0;
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            tans=max(tans,ans[i][j]);
        }
    }
    
    cout << tans << "\n";
}


Measured memory_bytes: 21556
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<string>
#include<iostream>
#include<cctype>
#include<cstdio>
#include<vector>
#include<stack>
#include<queue>
#include <algorithm>
#include<math.h>
#include<set>
#include<map>
#include <sstream>
#include<iomanip>
#include <ctype.h>

//#include<bits/stdc++.h>


using namespace std;




int main() {

	long long int a = 2, b = 1, c=2;
	int n;
	cin >> n;
	if (n == 0)cout << 2 << endl;
	else if (n == 1)cout << 1 << endl;
	else {
		for (int i = 0; i < n - 1; i++) {
			c = a + b;
			a = b;
			b = c;
		}
		cout << c << endl;
	}

		return 0;

}




Measured memory_bytes: 256
n,m,c = map(int,input().split())
b = list(map(int,input().split()))
ans = 0
for i in range(n):
    s = c
    a = list(map(int,input().split()))
    for j in range(m):
        s += b[j] * a[j]
    ans += s > 0
print(ans)


Measured memory_bytes: 9136
/* ---------- STL Libraries ---------- */

// IO library
#include <cstdio>
#include <fstream>
#include <iomanip>
#include <ios>
#include <iostream>

// algorithm library
#include <algorithm>
#include <cmath>
#include <numeric>
#include <random>

// container library
#include <array>
#include <bitset>
#include <deque>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <tuple>
#include <vector>

/* ---------- Namespace ---------- */

using namespace std;

/* ---------- Type Abbreviation ---------- */

template <typename T>
using PQ = priority_queue<T>;
template <typename T>
using GPQ = priority_queue<T, vector<T>, greater<T>>;

using ll = long long;

#define fst first
#define snd second
#define mp make_pair
#define mt make_tuple

#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)


/* ---------- conversion ---------- */

#define INT(c) static_cast<int>(c)
#define CHAR(n) static_cast<char>(n)
#define LL(n) static_cast<ll>(n)
#define DOUBLE(n) static_cast<double>(n)

/* ---------- container ---------- */

#define ALL(v) (v).begin(), (v).end()
#define SIZE(v) (LL((v).size()))
#define each(itr,v) for(auto (itr):(v))

#define FIND(v, k) (v).find(k) != (v).end()
#define VFIND(v, k) find(ALL(v), k) != (v).end()

#define gsort(b, e) sort(b, e, greater<decltype(*b)>())

/* ----------- debug ---------- */

template <class T>
ostream& operator<<(ostream& os, vector<T> v) {
	os << "[";
	for (auto vv : v)
		os << vv << ",";
	return os << "]";
}

template <class T>
ostream& operator<<(ostream& os, set<T> v) {
	os << "[";
	for (auto vv : v)
		os << vv << ",";
	return os << "]";
}

template <class L, class R>
ostream& operator<<(ostream& os, pair<L, R> p) {
	return os << "(" << p.fst << "," << p.snd << ")";
}

/* ---------- Constants ---------- */

// const ll MOD = 1e9 + 7;
// const int INF = 1 << 25;
// const ll INF = 1LL << 50;
// const double PI = acos(-1);
// const double EPS = 1e-10;
// mt19937 mert(LL(time(0)));

/* ---------- Short Functions ---------- */

template <typename T>
T sq(T a) {
	return a * a;
}

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

template <typename T, typename U>
T mypow(T b, U n) {
	if (n == 0) return 1;
	if (n == 1) return b /* % MOD */;
	if (n % 2 == 0) {
		return mypow(b * b /* % MOD */, n / 2);
	}
	else {
		return mypow(b, n - 1) * b /* % MOD */;
	}
}

ll pcnt(ll b) {
	return __builtin_popcountll(b);
}



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

/* v-v-v-v-v-v-v-v-v Main Part v-v-v-v-v-v-v-v-v */

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int sx, sy, tx, ty;
	cin >> sx >> sy >> tx >> ty;
	int W = tx - sx, H = ty - sy;
	REP(i, H) cout << "U";
	REP(i, W) cout << "R";
	REP(i, H) cout << "D";
	REP(i, W) cout << "L";
	REP(i, 1) cout << "L";
	REP(i, H + 1) cout << "U";
	REP(i, W + 1) cout << "R";
    cout<<"D";
    cout<<"R";
	REP(i, H + 1) cout << "D";
	REP(i, W+1) cout << "L";
	REP(i, 1) cout << "U";
   cout<<endl;
}

Measured memory_bytes: 256
#pragma GCC optimize ("Ofast")
#include<bits/stdc++.h>
using namespace std;
inline void rd(int &x){
  int k;
  int m=0;
  x=0;
  for(;;){
    k = getchar_unlocked();
    if(k=='-'){
      m=1;
      break;
    }
    if('0'<=k&&k<='9'){
      x=k-'0';
      break;
    }
  }
  for(;;){
    k = getchar_unlocked();
    if(k<'0'||k>'9'){
      break;
    }
    x=x*10+k-'0';
  }
  if(m){
    x=-x;
  }
}
inline void wt_L(char a){
  putchar_unlocked(a);
}
inline void wt_L(long long x){
  int s=0;
  int m=0;
  char f[20];
  if(x<0){
    m=1;
    x=-x;
  }
  while(x){
    f[s++]=x%10;
    x/=10;
  }
  if(!s){
    f[s++]=0;
  }
  if(m){
    putchar_unlocked('-');
  }
  while(s--){
    putchar_unlocked(f[s]+'0');
  }
}
int N;
int A[100000];
int B[100000];
int main(){
  int i;
  long long res = 0;
  rd(N);
  {
    int Lj4PdHRW;
    for(Lj4PdHRW=(0);Lj4PdHRW<(N);Lj4PdHRW++){
      rd(A[Lj4PdHRW]);
      rd(B[Lj4PdHRW]);
    }
  }
  for(i=(N)-1;i>=(0);i--){
    A[i] = (A[i] + res) % B[i];
    if(A[i]){
      res += B[i] - A[i];
    }
  }
  wt_L(res);
  wt_L('\n');
  return 0;
}
// cLay varsion 20191125-1

// --- original code ---
// int N, A[1d5], B[1d5];
// {
//   ll res = 0;
//   rd(N,(A,B)(N));
//   rrep(i,N){
//     A[i] = (A[i] + res) % B[i];
//     if(A[i]) res += B[i] - A[i];
//   }
//   wt(res);
// }


Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define MOD 1000000007
#define ll long long
#define mp make_pair
#define pb push_back 
using namespace std;
int main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	int n;
	cin >> n;
	set<int> df;
	for(int i = 0; i < n; i++){
		int x;
		cin >> x;
		df.insert(x);
	}
	if(df.size() == n)
		cout << "YES\n";
	else cout << "NO\n";

}

Measured memory_bytes: 9600
def main():
    num, x = map(int, input().split())
    data = list(map(int, input().split()))
    now = 0
    ans = 1
    for i in range(num):
        now += data[i]
        if now > x:
            break
        ans += 1

    print(ans)





if __name__ == '__main__':
    main()




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

using namespace std;

#define FOR(i,n) for(int i=0; i<n; ++i)
#define FORR(i,a,n) for(int i=a; i<n; ++i)
#define ALL(c) (c).begin(), (c).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))

const int INF = 0x3f3f3f3f;

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<string> VS;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
 
//int in() { int x; scanf("%d", &x); return x; }
//ll lin() { ll x; scanf("%lld", &x); return x; }
//void printfv(VI a){ int n = a.size(); FOR(i, n) cout << a[i] << " "; }

int main(void){
    int n;
    cin >> n;
    int a[n], b[n], c[n-1];

    FOR(i, n){
        cin >> a[i];
    }
    
    FOR(i, n){
        cin >>b[i];
    }

    FOR(i, n-1){
        cin >>c[i];
    }

    int ans = 0;
    FOR(i, n){
        ans += b[a[i] - 1];

        //cout << a[i-1] << " " << a[i]-1 << endl;
        if(i != 0 && (a[i]-1) == a[i - 1]){
            //cout << c[a[i-1]];
            ans += c[a[i-1]-1];
        }
    }

    cout << ans;
    return 0;
}



Measured memory_bytes: 256
from sys import stderr
from functools import reduce
from operator import add
def f(): return [int(i) for i in input().split()]
def debug(*x): stderr.write(reduce(add,repr(x)).strip("()\',")+'\n')

d,n = f()
if n != 100:
    print(n*(100**d))
else:
    print((n+1)*(100**d))

Measured memory_bytes: 3700
using System;

class Program
{
    static void Main()
    {
            int i, j,x;
            string inp = Console.ReadLine();
            string[] data = inp.Split(' ');
            int n = int.Parse(data[0]);
            int m = int.Parse(data[1]);
            int l = int.Parse(data[2]);
            long[,] mena = new long[n,m];
            long[,] menb = new long[m,l];
            long[,] menc = new long[n, l];
            for (i = 0; i < n; i++)
            {
                for (j = 0; j < l; j++)
                {
                    menc[i, j] = 0;
                }
            }
            for (i = 0; i < n; i++)
            {
                string inn = Console.ReadLine();
                string[] din = inn.Split(' ');
                for (j = 0; j < m; j++)
                {
                    mena[i, j] = int.Parse(din[j]);
                }
            }
            for (i = 0; i < m; i++)
            {
                string read = Console.ReadLine();
                string[] ing = read.Split(' ');
                for (j = 0; j < l; j++)
                {
                    menb[i, j] = int.Parse(ing[j]);
                }
            }
            for (i = 0; i < n; i++)
            {
                for (j = 0; j < l; j++)
                {
                    for (x = 0; x < m; x++)
                    {
                        menc[i, j] += mena[i, x] * menb[x, j];
                    }
                }
            }
            for (i = 0; i < n; i++)
            {
                for (j = 0; j < l; j++)
                {
                    if (j != 0)
                    {
                        Console.Write(" ");
                    }
                    Console.Write("{0}", menc[i, j]);
                }
                Console.Write("\n");
            }
    }
}


Measured memory_bytes: 9828
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n - 1; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i <= n; i++)
#define FORR(i, m, n) for(int i = m; i >= n; i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define VSORTR(v) sort(v.rbegin(), v.rend());
#define ALL(v) (v).begin(),(v).end()
 
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll, ll>;

const ll mod = 1e9 + 7;

int main(){
	cin.tie(0);
    ios::sync_with_stdio(false);
    
    ll n, m;
    cin >> n >> m;

    vll a(n);
    ll s = 0;
    REP(i, n) {
        cin >> a[i];
        s += a[i];
    }

    ll res = 0;
    REP(i, n) {
        if (4 * m * a[i] >= s) res++;
    }
    if (res >= m) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
# python3だとTLE,pypy3だとAC

def main():
    N = int(input())
    p = list(map(float, input().split()))
    dp = [[0.0] * (N + 1) for _ in range(N + 1)]
    dp[0][0] = 1.0
    for i in range(1, N+1):
        for j in range(0, N+1):
            dp[i][j] = dp[i - 1][j] * \
                (1 - p[i - 1]) + dp[i - 1][j - 1] * p[i - 1]
    print(sum(dp[N][N//2+1:]))


if __name__ == "__main__":
    main()


Measured memory_bytes: 111580
N = int(input())
P = list(map(int, input().split()))

ans = 0
for i in range(N - 1):
    if P[i] == i + 1:
        P[i], P[i + 1] = P[i + 1], P[i]
        ans += 1
if P[N - 1] == N:
    ans += 1
print(ans)


Measured memory_bytes: 14008
#include <bits/stdc++.h>
#define debug(x) cerr << #x << ": " << x << endl
#define debugArray(x, n)                           \
  for (long long hoge = 0; (hoge) < (n); ++(hoge)) \
  cerr << #x << "[" << hoge << "]: " << x[hoge] << endl
using namespace std;

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  int L[N];
  int ans = 0;
  for (int i = 0; i < N; i++) cin >> L[i];
  for (int i = 0; i < N; i++) {
    for (int j = i + 1; j < N; j++) {
      if (L[i] == L[j]) continue;
      for (int k = j + 1; k < N; k++) {
        if (L[i] == L[k] || L[j] == L[k]) continue;
        bool isok = true;
        isok &= L[i] + L[j] > L[k];
        isok &= L[j] + L[k] > L[i];
        isok &= L[k] + L[i] > L[j];
        if (isok) ans++;
      }
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3648
#include <stdio.h>
#include <math.h>
#include <stdlib.h>

double triangle(int p1x,int p1y,int p2x,int p2y, int p3x, int p3y);

int main(void){
  double area=0;
  int n;
  scanf("%d",&n);
  int x1,y1,x2,y2,x3,y3;
  scanf("%d %d",&x1,&y1);
  scanf("%d %d",&x2,&y2);
  for(int i=2;i<n;i++){
    scanf("%d %d",&x3,&y3);
    area+=triangle(x1,y1,x2,y2,x3,y3);
    x2=x3;
    y2=y3;
  }
  printf("%.1f\n",area);
  return 0;
}


double triangle(int p1x,int p1y,int p2x,int p2y, int p3x, int p3y){
  p2x-=p1x;
  p3x-=p1x;
  p2y-=p1y;
  p3y-=p1y;
  return ((double)(p2x*p3y-p3x*p2y))/2;
}



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

const int N = 1e3+3;
int A[N];
void solve() {
    int n;
    scanf("%d",&n);
    vector<int> pos[2];
    ll sum[2] = {0,0};
    bool allNegative = true;
    for(int i=1;i<=n;++i) {
        scanf("%d",&A[i]);
        int ind = i&1;
        if(A[i]>=0) {
            allNegative = false;
            sum[ind] += A[i];
            pos[ind].push_back(i);
        }
    }
    int ind = 0;
    if(allNegative) {
        int ind =1;
        for(int i=2;i<=n;++i) {
            if(A[ind]<A[i]) {
                ind = i;
            }
        }
        printf("%d\n", A[ind]);
        printf("%d\n", n-1);
        int pos = n;
        for(int i = n;i>ind;--i) {
            printf("%d\n", pos);
            --pos;
        }
        for(int i=1;i<ind;++i) {
            printf("%d\n", 1);
        }
        return;
    }
    if(sum[0]<sum[1] || (sum[0]==sum[1] && pos[0].size()<pos[1].size())){
        ind = 1;
    }
    printf("%lld\n", sum[ind]);
    vector<int> op;
    int l = pos[ind][0],r = pos[ind].back();
    int x = n;
    for(int i = n;i>r;--i) {
        op.push_back(x);
        --x;
    }
    for(int i=1;i<l;++i) {
        op.push_back(1);
    }
    int totalLen = r-l+1;
    int val = 0;
    for(int i=0;i<pos[ind].size()-1;++i) {
        int u = 1, v = pos[ind][i+1]- pos[ind][i]+1;
        while(u<v) {
            op.push_back( (v+u)/2);
            v-=2;
        }
    }
    printf("%d\n", (int)op.size());
    for(int i=0;i<op.size();++i) {
        printf("%d\n", op[i]);
    }
}

int main() {
   //freopen("input.txt","r",stdin);
   solve();
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  for(int i=0;i<(n);++i)
#define REPr(i,n) for(int i=(n)-1;i>=0; --i)
#define FORq(i, m, n) for(int i = (m);i <= (n);++i)
#define FORqr(i, m , n) for(int i = (n);i >=(m);--i)
#define SCD(n) scanf("%d",&n)
#define SCD2(m,n) scanf("%d%d",&m,&n)
#define SCD3(m,n,k) scanf("%d%d%d",&m,&n,&k)
#define SCLLD(n) scanf("%lld",&n)
#define SCLLD2(m,n) scanf("%lld%lld",&m,&n)
#define SCLLD3(m,n,k) scanf("%lld%lld%lld",&m,&n,&k)
#define PB push_back
#define MP make_pair
#define ARSCD(A,N) REP(i,N){SCD(A[i]);}
#define ARSCD1(A,N) FORq(i,1,N){SCD(A[i]);}
#define VSCD(v,N) REP(i,N){int (x); SCD(x); v.PB(x);}
#define VSCLLD(v,N) REP(i,N){long long (x); SCLLD(x); v.PB(x);}
#define PRINTD(n) printf("%d\n",n)
#define PRINTLLD(n) printf("%lld\n",n)
#define DEBUG printf("%s\n","debug")
#define fst first
#define snd second
#define SIN(x,S) (S.count(x) != 0)
#define M0(x) memset(x,0,sizeof(x))
#define FILL(x,y) memset(x,y,sizeof(x))
#define MM(x) memset(x,-1,sizeof(x))
#define ALL(x) (x).begin(),(x).end()
using namespace std;
typedef pair<int,int> PII;
typedef pair<long long,long long> PLL;
typedef vector<int> VI;
typedef vector < VI > VVI;
typedef vector<long long> VL;
typedef long long ll;
typedef long long integer;
///////////////////////////////////////////////
const ll MOD = 1000000007;
ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}
///////////////////////////////////////////////
int main(){
	string S;
	getline(cin,S);


	bool ans = false;;
	int N = S.length();

	REP(i,N){
		REP(j,N){
			if (i > j) continue;
			string s = "";
			REP(k,N){
				if ((i <= k) and (k <= j)) continue;
				s = s + S[k];
			}
			if (s == "keyence") ans = true;
		}
	}

	if (S == "keyence") ans = true;
	if (ans) printf("YES\n");
	else printf("NO\n");
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <unordered_map>
#define ll long long int
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define rep(i,n) for(ll i=0;i<n;i++)
#define all(c) (c).begin(),(c).end()
#define max3(a,b,c) max(max(a,b),c)
#define min3(a,b,c) min(min(a,b),c)
#define vi vector <int>
#define vs vector <string>
#define vc vector <char>
#define vl vector <ll>
# define INF 0x3f3f3f3f 
using namespace std;
ll power(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll modInverse(ll a){return power(a,mod-2);}
const int N=500023;
bool vis[N];
vector <int> adj[N];
ll gcd(ll a, ll b) { if (a == 0) return b; return gcd(b % a, a); } 
ll lcm(ll a, ll b){return a*b/gcd(a, b);}

// vl sum(500001);


void solve()
{
    ll x;
    cin>>x;
    if(x>=400&&x<600){
        cout<<"8";
    }
    if(x>=600&&x<800){
        cout<<"7";
    }
    if(x>=800&&x<1000){
        cout<<"6";
    }
    if(x>=1000&&x<1200){
        cout<<"5";
    }
    if(x>=1200&&x<1400){
        cout<<"4";
    }
    if(x>=1400&&x<1600){
        cout<<"3";
    }
    if(x>=1600&&x<1800){
        cout<<"2";
    }
    if(x>=1800&&x<2000){
        cout<<"1";
    }


    
    

}

int main()
{

    #ifndef ONLINE_JUDGE
        // for getting input from input.txt
        freopen("input.txt", "r", stdin);
        // for writing output to output.txt
        freopen("output.txt", "w", stdout);
    #endif

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    int T=1;
    // cin>>T;
    int t=0;
    while(t++<T)
    {
        // cout<<"Case #"<<t<<":"<<' ';
        solve();
        // cout<<'\n';
    }
    cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
}

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

void read(int &x) {
    x=0;int f=1;char ch=getchar();
    for(;!isdigit(ch);ch=getchar()) if(ch=='-') f=-f;
    for(;isdigit(ch);ch=getchar()) x=x*10+ch-'0';x*=f;
}

void print(int x) {
    if(x<0) putchar('-'),x=-x;
    if(!x) return ;print(x/10),putchar(x%10+48);
}
void write(int x) {if(!x) putchar('0');else print(x);putchar('\n');}

#define lf double
#define ll long long 

#define pii pair<int,int >
#define vec vector<int >

#define pb push_back
#define mp make_pair
#define fr first
#define sc second

#define data asd09123jdf02i3h

#define FOR(i,l,r) for(int i=l,i##_r=r;i<=i##_r;i++)

const int maxn = 1e6+10;
const int inf = 1e9;
const lf eps = 1e-8;
const int mod = 1e9+7;

int n,m;
char s[maxn],t[maxn];

int main() {
    read(n),read(m);
    scanf("%s%s",s+1,t+1);int r=__gcd(n,m);
    for(int i=1;i<=r;i++) if(s[(i-1)*(n/r)+1]!=t[(i-1)*(m/r)+1]) return puts("-1"),0;
    printf("%lld\n",1ll*n*m/r);
    return 0;
}


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

const int MAXN = 100005;

int N, M;
int cnt[MAXN];

int main() {
	scanf("%d%d", &N, &M);
	while (M--) {
		int a, b;
		scanf("%d%d", &a, &b);
		cnt[a]++;
		cnt[b]++;
	}
	for (int i = 1; i <= N; i++) 
		if (cnt[i] % 2) {
			puts("NO");
			return 0;
		}
	puts("YES");
	return 0;
}

Measured memory_bytes: 512
#include<iostream>
#include<bits/stdc++.h>
#include<iomanip>
#include<math.h>
#include<vector>
#include<cctype>
#include<string>
#include<set>
#include<map>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
std::string line;
typedef long long ll;

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

   int cnt = 0;
   rep(i,n-2){
      if(s[i]=='A' && s[i+1] == 'B' && s[i+2] == 'C') cnt++;
   }

   cout << cnt << endl;



   return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int x,a=0;
  cin >> x;
  int cx = x;
  for(int i=0;i<8;i++){
    a += x%10;
    x /= 10;
  }
  if(cx%a == 0){
    cout << "Yes";
  }else{
    cout << "No";
  }
}

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

const int maxn = 1e5 + 5;

int xfa[maxn] = { 0 }, yfa[maxn] = {0};
ll xsize[maxn] = { 0 }, ysize[maxn] = {0};
int vis[maxn] = { 0 };
struct point {
	int x;
	int y;
}p[maxn];
list<int>xcolumn[maxn];
list<int>yrow[maxn];

int xfindrt(int p)
{
	return (p == xfa[p] ? p :xfa[p]= xfindrt(xfa[p]));
}
int xmerge(int a, int b)
{
	int fa = xfindrt(a), fb = xfindrt(b);
	if (fa == fb)
		return 1;
	xfa[fb] = fa;
	xsize[fa] += xsize[fb];
	xsize[fb] = 0;
	return 0;
}
int yfindrt(int p)
{
	return (p == yfa[p] ? p : yfa[p] = yfindrt(yfa[p]));
}
int ymerge(int a, int b)
{
	int fa = yfindrt(a), fb = yfindrt(b);
	if (fa == fb)
		return 1;
	yfa[fa] = fb;
	ysize[fb] += ysize[fa];
	ysize[fa] = 0;
	return 0;
}

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

	for (int i = 0; i < n; i++)
	{
		int a, b;
		cin >> a >> b;
		p[i] = { a,b };
		xcolumn[a].push_back(b);
		yrow[b].push_back(a);

		xsize[a] = ysize[b] = 1;
		xfa[a] = a;
		yfa[b] = b;
	}
	for (int i = 1; i < maxn; i++)
	{
		if (xcolumn[i].size()<=1)
			continue;
		int t = xcolumn[i].front();
		for (int k : xcolumn[i])
		{
			ymerge(t, k);
		}
	}
	for (int i = 1; i <maxn; i++)
	{
		if (yrow[i].size()<=1)
			continue;
		int t = yrow[i].front();
		for (int k : yrow[i])
		{
			xmerge(t, k);
		}
	}
	ll ans = 0;
	for (int i = 0; i < n; i++)
	{
		int  a = xfindrt(p[i].x), b = yfindrt(p[i].y);
		if (vis[a] == 0)
		{
			ans += xsize[a] * ysize[b];
			vis[a] = 1;
		}
	}
	cout << ans - n;
}

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

using ll = long long;

class union_find {
public:
    union_find(int n) : par(n, -1) {}

    int root(int x) {
        return par[x] < 0 ? x : par[x] = root(par[x]);
    }
    void unite(int x, int y) {
        x = root(x), y = root(y);
        if(x == y) return;
        if(par[x] > par[y]) swap(x, y);
        par[x] += par[y];
        par[y] = x;
    }

    int size(int x) {
        return -par[root(x)];
    }

private:
    vector<int> par;
};

int main() {
    int n;
    while(cin >> n, n) {
        vector<string> word(n);
        for(auto& s : word) {
            cin >> s;
        }

        vector<int> in(26), out(26);
        union_find uf(26);
        for(auto& s : word) {
            const auto first = s[0] - 'a', last = s.back() - 'a';
            in[first]++;
            out[last]++;
            uf.unite(first, last);
        }

        bool ok = true;
        int comp_num = 0;
        for(int i = 0; i < 26; ++i) {
            comp_num += in[i] && uf.root(i) == i;
            ok &= in[i] == out[i];
        }
        ok &= comp_num == 1;

        cout << (ok ? "OK" : "NG") << endl;
    }
}



Measured memory_bytes: 3608
#include <iostream>
using namespace std;
long long const mod = 1000000007;
long long mod_pow(long long a, long long b){
    long long res = 1;
    a %= mod;
    while(b > 0){
        if(b%2 == 1) res = (res * a) % mod;
        a = (a * a) % mod;
        b /= 2;
    }
    return res;
}
int main(void){
    int n;
    long long ans = 1;
    cin >> n;
    for(int i=2;i<=n;i++){
        bool flg = true;
        for(int j=2;j*j<=i;j++){
            if(i%j == 0){
                flg = false;
                break;
            }
        }
        if(flg){
            long long w = 1;
            for(int j=i;j<=n;j*=i){
                w += n / j;
            }
            ans *= w;
            ans %= mod;
        }
        //cout << ans << endl;
    }
    cout << ans << endl;
    
}


Measured memory_bytes: 256
n=int(input())
v=[int(i) for i in input().split()]
c=[int(i) for i in input().split()]
ans=0
diff=[0]*n
for i in range(n):
    diff[i]=v[i]-c[i]
for i in range(n):
    if diff[i]>=0:
        ans+=diff[i]
print(ans)

Measured memory_bytes: 3064
#include <algorithm>
#include <bitset>
#include <cstdio>
#include <functional>
#include <initializer_list>
#include <iostream>
#include <limits.h>
#include <list>
#include <map>
#include <math.h>
#include <queue>
#include <regex>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
#define REP(i, a, n) for (int i = (a); i < (int)(n); ++i)
#define REPC(i, a, n) for (int i = (a); i <= (int)(n); ++i)
#define ALL(t) t.begin(), t.end()
#define RALL(t) t.rbegin(), t.rend()
#define Yes(cond) cout << (cond ? "Yes" : "No") << endl;
#define YES(cond) cout << (cond ? "YES" : "NO") << endl;
using namespace std;
using LL = long long;
using ULL = unsigned long long;
template <class T> using VEC = std::vector<T>;
template <class T> using MAT = std::vector<std::vector<T>>;
void DUMP() { cerr << endl; }
template <class Head, class... Tail> void DUMP(Head &&head, Tail &&... tail) {
  cerr << head << ", ";
  DUMP(std::move(tail)...);
}
template <typename T> ostream &operator<<(ostream &os, vector<T> &vec) {
  os << "{";
  for (auto v : vec)
    os << v << ",";
  os << "}";
  return os;
}

int main() {
  string a, b;
  cin >> a >> b;
  string g = "GREATER", l = "LESS", eq = "EQUAL";
  string ans;
  if (a.length() > b.length()) {
    ans = g;
  } else if (a.length() < b.length()) {
    ans = l;
  } else {
    ans = (a > b ? g : a < b ? l : eq);
  }
  cout << ans << endl;

  return 0;
}


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

#define int long long
#define ll long long
#define f1(i,a,b) for(i=a;i<b;i++)
#define f2(i,a,b) for(i=a;i>=b;i--)
#define endl '\n'
#define pb push_back
#define gp " "
#define ff first
#define ss second
#define mp make_pair

const int mod=1000000007;
int i,j;
ll temp;

int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    // #ifndef ONLINE_JUDGE
    // 	freopen("/home/akmittal/Desktop/Competitive Programming/in.txt","r",stdin);
    // 	freopen("/home/akmittal/Desktop/Competitive Programming/out.txt","w",stdout);
    // #endif
    int n;
    cin>>n;
    int a[n];
    f1(i,0,n)
    cin>>a[i];
    sort(a,a+n);
    long double ans=a[0];
    f1(i,0,n)
    {
    	ans=(ans+a[i])/2.0000;
    }
    cout<<fixed<<setprecision(10)<<ans;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
    
        using namespace std;
        #define ll long long
        #define ld long double
        #define vll vector<ll>
        #define mll map<ll,ll>
        #define pll pair<ll,ll>
        #define ff first
        #define ss second
        #define pb push_back
        #define deb(x) cout<<#x<<" : "<<x<<endl;
        #define deb2(x,y) cout<<#x<<" : "<<x<<"\t"<<#y<<" : "<<y<<endl;
        #define deb3(x,y,z) cout<<#x<<" : "<<x<<"\t"<<#y<<" : "<<y<<"\t"<<#z<<" : "<<z<<endl;
        #define deb4(w,x,y,z) cout<<#w<<" : "<<w<<"\t"<<#x<<" : "<<x<<"\t"<<#y<<" : "<<y<<"\t"<<#z<<" : "<<z<<endl;
        #define FAST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
        #define printv(a)  for(ll i=0;i<a.size();i++)  cout<<a[i]<<" ";
       
       
        const int mod=998244353;
        const int N=1e6+5; 
        const ll inf=1e18+5;
       
        bool sortbysec(const pair<pair<ll,ll>,ll> &a, 
                          const pair<pair<ll,ll>,ll> &b) 
            { 
                return (a.second > b.second); 
            } 
            ll powermod(ll x, ll y, ll p)
            {
                ll res = 1;
                x = x % p;
                while (y > 0)
                {
                    if (y & 1) res = (res*x) % p;
                    y = y>>1;
                    x = (x*x) % p;
                }
                return res;
            }
           
            bool isprime(int n) 
            { 
                if (n <= 1)  return false; 
                if (n <= 3)  return true; 
                if (n%2 == 0 || n%3 == 0) return false; 
                for (int i=5; i*i<=n; i=i+6) 
                    if (n%i == 0 || n%(i+2) == 0) 
                       return false; 
               return true; 
            }
           
            
        int main()
        {
            FAST;
            ll k,n;
            cin>>k>>n;
            vll a(n);
            for(ll i=0;i<n;i++)
            cin>>a[i];
            ll ans=0;
            for(ll i=0;i<n-1;i++)
            ans=max(ans,a[i+1]-a[i]);
            ans=max(ans,k+a[0]-a[n-1]);
            cout<<k-ans;
            return 0;
        }

Measured memory_bytes: 1792
#include<stdio.h>

struct Dice
{
	int mae;
	int ue;
	int migi;
	int hidari;
	int sita;
	int usiro;
};

struct Dice ROLL_E(struct Dice dice)
{
	
	int a = dice.ue;
	dice.ue = dice.hidari;
	dice.hidari = dice.sita;
	dice.sita = dice.migi;
	dice.migi = a;
	
	return dice;
}

struct Dice ROLL_N(struct Dice dice)
{
	int a = dice.ue;
	dice.ue = dice.mae;
	dice.mae = dice.sita;
	dice.sita = dice.usiro;
	dice.usiro = a;
	
	return dice;
}
struct Dice ROLL_S(struct Dice dice)
{
	int a = dice.ue;
	dice.ue = dice.usiro;
	dice.usiro = dice.sita;
	dice.sita = dice.mae;
	dice.mae = a;
	
	return dice;
}
struct Dice ROLL_W(struct Dice dice)
{
	int a = dice.ue;
	dice.ue = dice.migi;
	dice.migi = dice.sita;
	dice.sita =dice. hidari;
	dice.hidari = a;
	
	return dice;
}

struct Dice ROLL_TOP(struct Dice dice,int top)
{
	if(top == dice.mae){
		dice =  ROLL_N(dice);
	}else if(top == dice.migi){
		dice =  ROLL_W(dice);
	}else if(top == dice.hidari){
		dice =  ROLL_E(dice);
	}else if(top == dice.usiro){
		dice =  ROLL_S(dice);
	}else if(top == dice.sita){
		dice =  ROLL_W(dice);
		dice =  ROLL_W(dice);
	}
	return dice;
}

struct Dice ROLL_FRONT(struct Dice dice,int front)
{
	dice = ROLL_TOP(dice,front);
	dice = ROLL_S(dice);
	return dice;
}

struct Dice ROLL(struct Dice dice,int front,int top)
{
	dice = ROLL_FRONT(dice,front);
	dice = ROLL_TOP(dice,top);
	return dice;
}

struct Dice scan()
{
	struct Dice dice;
	
	scanf("%d",&dice.ue);
	scanf("%d",&dice.mae);
	scanf("%d",&dice.migi);
	scanf("%d",&dice.hidari);
	scanf("%d",&dice.usiro);
	scanf("%d",&dice.sita);
	
	return dice;
}

int JUDGE(struct Dice dice_a,struct Dice dice_b)
{
	if(dice_a.ue != dice_b.ue)return 0;
	if(dice_a.mae != dice_b.mae)return 0;
	if(dice_a.migi != dice_b.migi)return 0;
	if(dice_a.hidari != dice_b.hidari)return 0;
	if(dice_a.usiro != dice_b.usiro)return 0;
	if(dice_a.sita != dice_b.sita)return 0;
	return 1;
}
int main()
{
	int i,front,top,judge;
	struct Dice dice_a;
	struct Dice dice_b;
	
	dice_a = scan();
	dice_b = scan();
	
	front = dice_b.mae;
	top = dice_b.ue;
	dice_a = ROLL(dice_a,front,top);
	
	judge = JUDGE(dice_a,dice_b);
	
	if(judge == 1)printf("Yes\n");
	else printf("No\n");
	
	return 0;
}

Measured memory_bytes: 580
#include <bits/stdc++.h>
using namespace std;
#define  rep(i, n) for(int i = 0; i < n; i++) 
#define  all(x) (x).begin(),(x).end()     // 昇順ソート
#define  rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define  INF 1LL << 60
typedef long long int LL;
typedef long long int ll;
#define pll pair<ll, ll>
#define F first
#define S second
const int MOD = 1000000007;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return true; } return false; }
//sort(all(x))とするとソートできるよ
// 10^x は pow(10,(x)) 
// 任意のlogは　対数の底の変換を使う    log(N) / log(任意の底)

const int MAX = 2*1e5;     //  ここのサイズ選びめっちゃ注意。5*10^5とかにしてたら余裕でTLEこく。

LL 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;
    }
}
// 二項係数計算
LL COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
// nHm
int count_9(int n, int m){
    // 範囲外アクセスに注意して下さい
    // 前処理
    COMinit();
    return COM(n+m-1,m);
}


map<LL,int> prime_factor(LL n){
  map<LL,int> ret;
  for(LL i = 2; i * i <= n; i++){
    while(n % i == 0){
      ret[i]++;
      n /= i;
    }
  }
  if(n != 1) ret[n] = 1;
  return ret;
}

int main(){
    LL N,M;cin >> N >> M;
    map<LL,int> ct = prime_factor(M);
    vector<LL> num;
    for(auto a : ct)num.push_back(a.S);
    LL ans = 1;
    for(auto a : num)ans = ans * count_9(N,a) % MOD;
    ans %= MOD;

    cout << ans << endl;
}


Measured memory_bytes: 4992