akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;
 
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        for(int i=1;i<=x;i++){
            int num=i;
            if(num%3==0){
                System.out.print(" "+i);
            }else{
                while(true){
                    if(num%10==3){
                        System.out.print(" "+i);
                        break;
                    }
                    num=num/10;
                    if(num<3)
                        break;
                }
            }
        }
        System.out.println();
    }
}


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

using namespace std;
int main(){
    int m;
    cin >> m;
    int ans = 8;
  m-=400;
    for(;;)
    {
        if(m<200)
        {
            break;
        }
      m-=200;
        ans--;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3624
#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <vector>
#include <cstdio>
#include <bits/stdc++.h>
#include <set>
#include <map>
#include <stdio.h>
#include <stack>
#include <queue>
#include <deque>
#include <numeric>
#include <bits/stdc++.h>
#include <utility>
#include <iomanip>

#define ALL(obj) (obj).begin(), (obj).end()
#define FOR(i,a,b) for(int i = (a); i < (b); i++)
#define RFOR(i,a,b) for(int i = (a); (b) <= i; i--)
#define REP(i,n) for(int i = 0; i < (n); i++)
#define RREP(i,n) for(int i = n; n <= i; i--)
#define ABS(a) ((a < 0) ? ((-1)*(a)) : (a))
#define elif else if
#define MOD 1000000007
#define INF (1<<29)

using namespace std;

#define ld long double
#define ll long long

map <int ,int> mpa,mpb;
typedef pair<ll, ll> P;
priority_queue<P, vector<P>, greater<P>> pque;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  double T,X;
  cin >> T >>X;
  double ans=0;
  cout << fixed << setprecision(10) << T/X << endl;
  return 0;
}


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

int main() {
  int N,W;
  vector<int> w(102,0),v(102,0);
  vector< vector<int64_t> > dp(101,vector<int64_t>(100001,0));
  
  cin >> N >> W;
  for (int i=0;i<N;++i ) {
    cin >> w[i] >> v[i];
  }
  dp[0][w[0]] = v[0];
  // 配るDP
  for (int i=0;i<N-1;++i){
    for (int j=0;j<W;++j){
      dp[i+1][j] = max( dp[i+1][j], dp[i][j] );
      if ( j+w[i+1] <= W ) {
        dp[i+1][j+w[i+1]] = max( dp[i+1][j], dp[i][j]+v[i+1] );
      }
    }
  }
  int64_t maxv = 0;
  for ( int i=0;i<W+1;++i) {
   maxv = max( maxv, dp[N-1][i] );
  }
  cout << maxv << endl;
}


Measured memory_bytes: 80256
import java.util.*;

public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int a[] = new int[5];
    for(int i=0;i<5;i++)  a[i] = sc.nextInt();
    int W = a[0];
    int H = a[1];
    int x = a[2];
    int y = a[3];
    int r = a[4];

    if((x-r)>=0 && (y-r)>=0 && (y+r)<=H && (x+r)<=W){
      System.out.println("Yes");
    }else{
      System.out.println("No");
    }
  }
}



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

int main() {
    string str;
    cin >> str;
    if(str.at(5) == '1'){
        cout << "TBD" << endl;
    } else if(str.at(6) == '0' || str.at(6) == '1' || str.at(6) == '2' || str.at(6) == '3' || str.at(6) == '4'){
        cout << "Heisei" << endl;
    } else {
        cout << "TBD" << endl;
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstdlib>
using namespace std;

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

ll n[3];
int main(){
  ll a, b, c, d, e, f;
  while(cin >> a >> b >> c >> d >> e >> f&&(a || b|| c|| d || e || f)){
    n[0] = a + d;
    n[1] = b + e;
    n[2] = c + f;
    ll l = min(n[0], min(n[1], n[2]));
    ll res = 0;
    rep(i, min(l + 1, 100LL)){
      ll c = i;
      rep(j, 3){
	c  += (n[j] - i) / 3;
      }
      //cout << c << endl;
      res = max(res, c);
    }
    cout << res << endl;
  }
  return 0;
}

Measured memory_bytes: 0
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    k = int(readline())
    a = [0] * 50

    for i in range(50):
        a[i] = i + (k//50) - (k % 50)
        if i < k % 50:
            a[i] += 51
    print(50)
    print(*a)


if __name__ == '__main__':
    main()


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

#define _USE_MATH_DEFINES
#include<cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iterator>

using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

#define int ll
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

//typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pdd;
typedef vector< vector<int> > mat;

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 (b < a) { a = b; return true; } return false; }

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;

int S[100010], T[100010];

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

	int A, B, Q,q;
	cin >> A >> B >> Q;
	rep(i, 0, A)
	{
		cin >> S[i+1];
	}
	rep(i, 0, B)
	{
		cin >> T[i+1];
	}
	A += 2;
	B += 2;
	S[0] = -INF;
	S[A - 1] = INF;
	T[0] = -INF;
	T[B - 1] = INF;

	rep(k, 0, Q)
	{
		cin >> q;
		int s[2], t[2];
		s[0] = lower_bound(S, S + A, q) - S;
		t[0] = lower_bound(T, T + B, q) - T;
		s[1] = s[0] - 1;
		t[1] = t[0] - 1;
		int ans = INF;
		rep(i, 0, 2)rep(j, 0, 2)
		{
			if (S[s[i]] == -INF || S[s[i]] == INF || T[t[j]] == -INF || T[t[j]] == INF)continue;
			chmin(ans, min(abs(S[s[i]] - q) + abs(S[s[i]] - T[t[j]]), abs(T[t[j]] - q) + abs(S[s[i]] - T[t[j]])));
		}
		cout << ans << endl;
	}

	return 0;
}

Measured memory_bytes: 2944
import math as mt 
  
MAXN = 1000001
  
# stores smallest prime factor for 
# every number 
spf = [0 for i in range(MAXN)] 
  
# Calculating SPF (Smallest Prime Factor)  
# for every number till MAXN. 
# Time Complexity : O(nloglogn) 
def sieve(): 
    spf[1] = 1
    for i in range(2, MAXN): 
          
        # marking smallest prime factor  
        # for every number to be itself. 
        spf[i] = i 
  
    # separately marking spf for  
    # every even number as 2 
    for i in range(4, MAXN, 2): 
        spf[i] = 2
  
    for i in range(3, int(mt.ceil(mt.sqrt(MAXN)))): 
          
        # checking if i is prime 
        if (spf[i] == i): 
              
            # marking SPF for all numbers 
            # divisible by i 
            for j in range(i * i, MAXN, i):  
                  
                # marking spf[j] if it is  
                # not previously marked 
                if (spf[j] == j): 
                    spf[j] = i 
  
# A O(log n) function returning prime  
# factorization by dividing by smallest  
# prime factor at every step 
def getFactorization(x): 
    d1={}
    while (x != 1): 
        d1[spf[x]]=0
        x = x // spf[x] 
  
    return d1.keys()
def gcd(a,b):
    while b:
        a,b=b,a%b
    return a
# Driver code 
  
# precalculating Smallest Prime Factor 
sieve()
n=int(input())
d={}
flag=1;val=-1
a=[int(i) for i in raw_input().split()]
for i in range(n):
    x=a[i]
    if val==-1:
        val=x
    val=gcd(val,x)
    ret=getFactorization(x)
    for j in ret:
        d[j]=d.get(j,0)+1
for i in d.keys():
    if i!=1 and d[i]>1:
        flag=0
if val!=1:
    print("not coprime")
elif flag:
    print("pairwise coprime")
else:
    print("setwise coprime")
        


Measured memory_bytes: 174972
import java.util.HashSet;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int list[][] = new int[3][3]; // 3*3の二次元配列
        // 二次元配列に値を格納
        for (int i = 0; i < 3; i++) {
            for (int j = 0; j < 3; j++) {
                list[i][j] = Integer.parseInt(sc.next());
            }
        }
        int n = Integer.parseInt(sc.next());
        for (int i = 0, num = 0; i < n; i++) {
            // bの値
            num = Integer.parseInt(sc.next());
            for (int j = 0; j < 3; j++) {
                for (int k = 0; k < 3; k++) {
                    // bと一致する値が二次元配列に存在する場合
                    if (list[j][k] == num) {
                        // 該当箇所を0に更新(当たりとして扱う)
                        list[j][k] = 0;
                    }
                }
            }
        }
        // 縦横斜め列のいずれか一列の要素が全て0の場合、ビンゴ達成
        if (checkBingoVertical(list) ||
                checkBingoParallel(list) ||
                checkBingoLeftUpToRightDown(list) ||
                checkBingoRightUpToLeftDown(list)) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
        sc.close();
    }

    private static HashSet<Integer> hs = new HashSet<>();

    // ビンゴの縦列
    private static boolean checkBingoVertical(int[][] plist) {
        int verticalsize = plist.length;
        int parallelsize = plist[0].length;
        //HashSet<Integer> hs = new HashSet<>();
        for (int i = 0; i < verticalsize; i++) {
            hs.clear();
            hs.add(plist[0][i]);
            for (int j = 0; j < parallelsize; j++) {
                hs.add(plist[j][i]);
            }
            if (hs.size() == 1) {
                return true;
            }
        }
        return false;
    }

    // ビンゴの横列
    private static boolean checkBingoParallel(int[][] plist) {
        int verticalsize = plist.length;
        int parallelsize = plist[0].length;
        //HashSet<Integer> hs = new HashSet<>();
        for (int i = 0; i < verticalsize; i++) {
            hs.clear();
            hs.add(plist[i][0]);
            for (int j = 0; j < parallelsize; j++) {
                hs.add(plist[i][j]);
            }
            if (hs.size() == 1) {
                return true;
            }
        }
        return false;
    }

    // ビンゴの斜め列(＼：左上から右下)
    private static boolean checkBingoLeftUpToRightDown(int[][] plist) {
        //HashSet<Integer> hs = new HashSet<>();
        hs.clear();
        for (int i = 0, size = plist.length; i < size; i++) {
            hs.add(plist[i][i]);
        }
        // 1列全て0ならば、HashSetの要素は0のみ格納される
        if (hs.size() == 1) {
            return true;
        }
        return false;
    }

    // ビンゴの斜め列(／：右上から左下)
    private static boolean checkBingoRightUpToLeftDown(int[][] plist) {
        //HashSet<Integer> hs = new HashSet<>();
        hs.clear();
        for (int i = 0, size = plist.length; i < size; i++) {
            hs.add(plist[i][size - 1 - i]);
        }
        if (hs.size() == 1) {
            return true;
        }
        return false;
    }

}


Measured memory_bytes: 35548
#include <iostream>
#include <cmath>
#include <utility>

using namespace std;

typedef pair<int,int> pii;
typedef long long ll;
#define mp make_pair
#define x first
#define y second

const int mod=1e9+7;

ll dp[100003];
ll k,n;
ll bp(ll x){
	ll s=x;
	ll t=1ll;
	for(int i=0;i<20;i++){
		if(n&(1<<i)) t=(t*s)%mod;
		s=(s*s)%mod;
	}
	return t;
}

int main () {
	cin>>n>>k;
	ll sol=0ll;
	for(ll i=k;i>0;i--){
		ll bz=k/i;
		dp[i]=bp(k/i);
		for(ll j=2*i;j<=k;j+=i){
			dp[i]=(dp[i]-dp[j]+mod)%mod;
		}
		sol=(sol+dp[i]*i)%mod;
	}
	cout<<sol<<endl;
	



return 0;
}



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

string w;

int main () {
  cin >> w;
  
  if (w.size() % 2 == 1){
    cout << "No" << endl;
    return 0;
  }
  
  sort(w.begin(), w.end());
  for(int i = 0; i < (w.size()/2); i++){
    if(w[2*i] != w[2*i + 1]){
      cout << "No" <<endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
 
int main(){
  int n,i,j=0,k;
  unsigned long long int sum=0,a[5]={};
  char name[10];
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%s",name);
    if(name[0]=='M') a[0]++;
    if(name[0]=='A') a[1]++;
    if(name[0]=='R') a[2]++;
    if(name[0]=='C') a[3]++;
    if(name[0]=='H') a[4]++;
  }
  for(i=0;i<3;i++){
    for(j=i+1;j<4;j++){
      for(k=j+1;k<5;k++){
        sum+=a[i]*a[j]*a[k];
      }
    }
  }
  printf("%llu\n",sum);
}


Measured memory_bytes: 128
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int cc = 0;
		int n = sc.nextInt();
		int[] array = new int[n];
		for(int i = 0; i < n; i++) {
			array[i] = sc.nextInt();
		}
		cc = bubble_sort(array);
		showArray(array);
		System.out.println(cc);
		sc.close();
	}

	// バブルソート(昇順)して、要素の交換回数を返す
	public static int bubble_sort(int[] a) {
		int cc = 0;
		for(int i = 0; i < a.length - 1; i++) {
			for(int j = a.length - 1; j > i; j--) {
				if(a[j] < a[j - 1]) {
					int tmp = a[j];
					a[j] = a[j - 1];
					a[j - 1] = tmp;
					cc++;
				}
			}
		}
		return cc;
	}

	public static void showArray(int[] a) {
		System.out.print(a[0]);
		for(int i = 1; i < a.length; i++) {
			System.out.print(" " + a[i]);
		}
		System.out.println();
	}
}


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

int main() {
	int n;
  	int isSeven = 0;
  	cin >> n;
  	
  	if ((n - (n / 10 * 10)) == 7) isSeven = 1;
  	if (((n - (n / 100 * 100)) / 10) == 7) isSeven  = 1;
  	if (n / 100 == 7) isSeven = 1;
  
    if (isSeven == 1)  cout << "Yes" << endl;
  	else cout << "No" << endl;
}

Measured memory_bytes: 3636
/* ****GT_18**** */

#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define	endl		'\n'
#define pii         pair<ll int,ll int>
#define vi          vector<ll int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define hell        1000000007
#define rep(i,a,b)	for(ll int i=a;i<b;i++)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
using namespace std;

#define N  100005
long long int calc(ll x,ll n,ll *pati,ll * len)
{
	//cout<<x<<n<<endl;
	if(n==0 && x==1)
		return 1;
	if(x<2 || n<0)
		return 0;
	if(x<=(len[n]-1)/2)
		return calc(x-1,n-1,pati,len);
	else if(x==len[n])
		return pati[n];
		return pati[n-1]+1+calc(x-(len[n]+1)/2,n-1,pati,len);

}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int TESTS=1;
//	cin>>TESTS;
	while(TESTS--)
	{
		long long int n,x,i,pati[55],len[55];
		pati[0]=1;
		len[0]=1;

		cin>>n>>x;
		for(i=1;i<=n;i++)
		{
			pati[i]=2*pati[i-1]+1;
			len[i]=2*len[i-1]+3;
		}
		
		//cout<<len[50]<<endl;
		//cout<<pati[50]<<endl;
		cout<<calc(x,n,pati,len)<<endl;;

	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(ll i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

int main() {
  ll n, a, b;
  cin >> n >> a >> b;
  ll ca = 0, cb = 0, cb1 = 0;
  rep(i, n) {
    ll p;
    cin >> p;
    if(p <= a)
      ca++;
    else if(p <= b)
      cb++;
    else
      cb1++;
  }
  cout << min(ca, min(cb, cb1)) << endl;
}

Measured memory_bytes: 3596
n, m = map(int, input().split())
ks = [list(map(int, input().split())) for i in range(m)]
p = [int(i) for i in input().split()]
c = 0

for bit in range(2 ** n):
	ans = []
	for i in range(n):
		if (bit >> i) & 1:
			ans.append(1)
		else:
			ans.append(0)
	
	f = [0] * m
	for j in range(len(ks)):
		b = 0
		for i in ks[j][1:]:
			if ans[i-1] == 1:
				b += 1

		if b % 2 == p[j]:
			f[j] = 1

	if f.count(1) == len(ks):
		c += 1
	
print(c)


Measured memory_bytes: 3064
package main

import (
	"fmt"
	"sort"
)

func main() {
	var a, b int
	fmt.Scan(&a, &b)
	m := []int{}
	m = append(m, a+b)
	m = append(m, a-b)
	m = append(m, a*b)
	sort.Sort(sort.Reverse(sort.IntSlice(m)))
	fmt.Println(m[0])
}


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

using namespace std;

#define REP(i,m) for(int i=0; i<m; i++)
#define FOR(i,n,m) for(int i=n; i<m; i++)
#define INF 1000000007
#define INFL (1LL << 60)
#define MOD 998244353
#define ALL(v) v.begin(),v.end()
#define pb push_back
#define ll long long int
#define P pair<ll, ll>

int main(){
  ll n, x;
  cin >> n >> x;
  if(n == 1){
    cout << x << endl;
    return 0;
  }
  int primes[100010] = { };
  primes[1] = -1;
  int p = 0;
  FOR(i, 2, 100010){
    if(primes[i] == 0){
      p++;
      primes[i] = 1;
      int j = 2;
      while(i*j < 100010){
        primes[i*j] = -1;
        j++;
      }
    }
  }
  ll prime[p], e[p] = { };
  int c = 0;
  REP(i, 100010){
    if(primes[i] == 1){
      prime[c] = i;
      while(x%prime[c]==0){
        e[c]++;
        x /= prime[c];
      }
      c++;
    }
  }
  REP(i, p) e[i] /= n;
  ll ans = 1;
  REP(i, p){
    while(e[i]!=0){
      ans *= prime[i];
      e[i]--;
    }
  }
  cout << ans << endl;
}

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

#define rep(i,n) for(ll i = 0; i < n; i++)
#define Rep(i,n) for(ll i = 0; i <= n; i++)
#define REp(i,n) for(ll i = 1; i < n; i++)
#define REP(i,n) for(ll i = 1; i <= n; i++)
#define sz(x) int(x.size())
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define YesorNo(a) printf(a ? "Yes\n" : "No\n")
#define endl '\n'
#define fi first
#define se second
using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
template<class T> using V = vector<T>;
const int dx[] = {0,1,0,-1,1,1,-1,-1};
const int dy[] = {1,0,-1,0,1,-1,-1,1};
const int inf = (1<<30)-1;
const ll infll = (1LL<<62)-1;
ll ceil(const ll &a, const ll &b){return ((a)+(b)-1)/b;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }



int main(){
  int n;
  cin >> n;
  V<int> a(n);
  rep(i,n) cin >> a[i];
  ll ans = infll;
  for(int ci = 0; ci <= 2; ci += 2) {
    ll sum = 0;
    int d = -1 + ci;
    ll tmp = 0;
    rep(i,n) {
      if(d == -1) {
        if(sum + a[i] > -1) {
          tmp += abs(a[i] + 1 + sum);
          sum = -1;
        }
        else sum += a[i];
      }
      else {
        if(sum + a[i] < 1) {
          tmp += abs(sum + a[i]) + 1;
          sum = 1;
        }
        else sum += a[i];
      }
      d *= -1;
    }
    if(sum == 0) tmp++;
    chmin(ans, tmp);
  }
  cout << ans << endl;
}

Measured memory_bytes: 3780
x = int(input())

ansl = []
for i in range(-1000, 1000):
    ansl.append(i**5)

for i in range(2000):
    for j in range(i+1, 2000):
        if ansl[j] - ansl[i] == x:
            print(j-1000, i-1000)
            exit()

Measured memory_bytes: 65532
#pragma GCC optimize(2)
// Happy TLE and WA every day!
// by: zxb the vegetable chicken
#include<bits/stdc++.h>
#define mp				make_pair
#define rep(i,n)		for(int i = 0; i < n; i++)
#define foreach(i,c)	for(VAR(i, (c).begin()); i != (c).end(); ++i)
#define BINF			0x7fffffff
#define INF				0x3f3f3f3f
#define LINF			3223372036854775807
#define END(s)			{cout<<s; return 0;}
#define CON(s)			{cout<<s; continue;}
#define BRE(s)			{cout<<s; break;}
#define pb				push_back
//#define int				long long
#define All(a)			a.begin(), a.end()  //with A in CAPITAL!!!
#define sz(a)			(int)a.size()
#define F				first
#define S				second
//#define usingFiles
using namespace std;

const int rp = 666666;
const bool debug = 1;
const bool I_good_vegetable_a = 1;

struct city{
	int year;
	int pref;
	int numb;
};

int cnt[100100];
int n, m;
city a[100100];
string ID[100100];

bool cmp(const city &x, const city &y){
	return x.year < y.year;
}

string Itoa(int w){
	string ans = "";
	while(w){
		ans = (char)(w%10 + '0') + ans;
		w /= 10;
	}
	return ans;
}

signed main(){
	ios::sync_with_stdio(false);
	#ifdef usingFiles
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	#endif
	cin >> n >> m;
	rep(i, m){
		cin >> a[i].pref >> a[i].year;
		a[i].numb = i;
	}
	sort(a, a + m, cmp);
	rep(i, m){
		string a1 = Itoa(a[i].pref);
		string a2 = Itoa(++cnt[a[i].pref]);
		int now1 = a1.size(), now2 = a2.size();
		rep(j, 6 - now1) a1 = '0' + a1;
		rep(j, 6 - now2) a2 = '0' + a2;
		ID[a[i].numb] = a1 + a2;
	}
	rep(i, m) cout << ID[i] << endl;
	return 0;
}

Measured memory_bytes: 8576
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        ArrayList<Integer> number = new ArrayList<>();
        for (int i=0;i<n;i++){
            number.add(scanner.nextInt());
        }
        int count = 1;
        int instance = 0;
        int max = 0;
        Collections.sort(number);
        boolean b = true;
        for (int i=1;i<number.size();i++){
            if (!number.get(i).equals(number.get(i - 1))){
                b = true;
            }else {
                b = !b;
            }
            if (b){
                count++;
            }else {
                count--;
            }
        }
        System.out.println(count);

    }

}

Measured memory_bytes: 56824
class UnionFind:
    def __init__(self, nodes):
        self.sets = [None] * len(nodes)
        self.sizes = [1] * len(nodes)

    def find(self, a):
        curr = a
        path = []
        while self.sets[curr] is not None:
            path.append(curr)
            curr = self.sets[curr]

        for node in path:
            self.sets[node] = curr
        return curr

    def connected(self, a, b):
        return self.find(a) == self.find(b)

    def union(self, a, b):
        rootA = self.find(a)
        rootB = self.find(b)

        if rootA != rootB:
            self.sets[rootB] = rootA
            self.sizes[rootA] += self.sizes[rootB]

    def size(self, a):
        root = self.find(a)
        return self.sizes[root]


if __name__ == '__main__':
    n, m, k = tuple([int(s) for s in input().split()])
    users = [None] * n
    uf = UnionFind(users)

    friendships = [0 for i in range(n)]
    blockships = [0 for i in range(n)]

    for i in range(m):
        a, b = tuple([int(s) for s in input().split()])
        a -= 1
        b -= 1
        friendships[a] += 1
        friendships[b] += 1
        uf.union(a, b)
        uf.find(a)
        uf.find(b)
    for i in range(k):
        a, b = tuple([int(s) for s in input().split()])
        a -= 1
        b -= 1
        if uf.connected(a, b):
            blockships[a] += 1
            blockships[b] += 1

    res = [0] * n
    for i in range(n):
        all_connections = uf.size(i)
        existing = friendships[i]
        blocked = blockships[i]
        res[i] = all_connections - 1 - existing - blocked

    print(" ".join([str(u) for u in res]))


Measured memory_bytes: 19744
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int N=100005;
int read(){
	int x=0;
	char ch=getchar();
	while (!isdigit(ch))
		ch=getchar();
	while (isdigit(ch))
		x=(x<<1)+(x<<3)+(ch^48),ch=getchar();
	return x;
}
int n,m;
vector <int> e[N];
namespace Tree{
	LL ans=0;
	int v[N],c[N];
	void solveT(int x,int pre,int d){
		c[x]=v[x]=d;
		for (auto y : e[x])
			if (y!=pre)
				solveT(y,x,-d),v[x]+=v[y];
		ans+=abs(v[x]);
	}
	void solve(){
		solveT(1,0,1);
		printf("%lld\n",v[1]==0?ans:-1);
	}
}
int c[N],vis[N];
int vx,vy,tag[N];
void dfs(int x,int pre,int d){
	vis[x]=1,c[x]=d;
	for (auto y : e[x])
		if (y!=pre&&!(tag[x]&&tag[y]))
			if (vis[y])
				vx=x,vy=y,tag[x]=tag[y]=1;
			else
				dfs(y,x,-d);
	vis[x]=0;
}
	void RE(){
		int k=-1;
		while (1)
			k-=84,c[k]++;
	}
namespace Odd{
	int v[N];
	LL ans=0;
	void dfs(int x,int pre,int d){
		v[x]=(c[x]+=d);
		for (auto y : e[x])
			if (y!=pre&&!(tag[x]&&tag[y])){
				dfs(y,x,-d);
				v[x]+=v[y];
			}
		ans+=abs(v[x]);
	}
	void solve(){
		memset(c,0,sizeof c);
		dfs(1,0,1);
		int V=v[1];
		if (V%2!=0)
			return (void)puts("-1");
		memset(c,0,sizeof c);
		ans=abs(c[vx]=c[vy]=-V/2);
		dfs(1,0,1);
		printf("%lld",ans);
	}
}
namespace Even{
	int v[N],k[N];
	void dfs(int x,int pre,int d){
		v[x]=c[x]=d;
		for (auto y : e[x])
			if (y!=pre&&!(tag[x]&&tag[y])){
				dfs(y,x,-d);
				v[x]+=v[y];
				k[x]+=k[y];
			}
	}
	vector <int> a;
	LL ans=0;
	void solve(){
		memset(c,0,sizeof c);
		memset(k,0,sizeof k);
		k[vx]=1,k[vy]=-1;
		dfs(1,0,1);
		if (v[1]!=0)
			return (void)puts("-1");
		a.clear();
		a.push_back(0);
		for (int i=1;i<=n;i++)
			if (k[i]==0)
				ans+=abs(v[i]);
			else
				a.push_back(-k[i]*v[i]);
		sort(a.begin(),a.end());
		int s=((int)a.size()+1)/2;
		int M=a[s-1];
		for (int i=0;i<a.size();i++)
			ans+=abs(a[i]-M);
		printf("%lld",ans);
	}
}
int main(){
	n=read(),m=read();
	for (int i=1;i<=n;i++)
		e[i].clear();
	for (int i=1;i<=m;i++){
		int a=read(),b=read();
		e[a].push_back(b);
		e[b].push_back(a);
	}
	if (m==n-1)
		return (Tree :: solve()),0;
	memset(vis,0,sizeof vis);
	dfs(1,0,1);
	if (c[vx]==c[vy])
		Odd :: solve();
	else
		Even :: solve();
	return 0;
}

Measured memory_bytes: 16508
from sys import stdin
def main():
  from itertools import repeat
  from builtins import range
  readline = stdin.readline
  h, w = map(int, readline().split())
  s = [readline().rstrip('\r\n') + '#' for _ in range(h)]
  s.append('#' * w)
  yoko = [[0] * w for _ in range(h)]
  for i in range(h):
    start = -1
    si = s[i]
    yokoi = yoko[i]
    for j in range(w + 1):
      if si[j] == '#':
        if start != -1:
          t = j - start
          yokoi[start:j] = repeat(t, t)
          start = -1
      else:
        if start == -1:
          start = j
  result = 0
  for i in range(w):
    start = -1
    for j in range(h + 1):
      if s[j][i] == '#':
        if start != -1:
          t = yoko_max + j - start - 1
          if t > result:
            result = t
          start = -1
      else:
        yji = yoko[j][i]
        if start == -1:
          start = j
          yoko_max = yji
        else:
          if yji > yoko_max:
            yoko_max = yji
  print(result)
main()

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

#define fst(t) std::get<0>(t)
#define snd(t) std::get<1>(t)
#define thd(t) std::get<2>(t)
#define unless(p) if(!(p))
#define until(p) while(!(p))

using ll = std::int64_t;
using P = std::tuple<int,int>;

int N, M;
int ss[20], ps[20];

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

    std::cin >> N >> M;

    for(int i=0;i<M;++i){
        int k;
        std::cin >> k;

        for(int j=0;j<k;++j){
            int s;
            std::cin >> s;

            s -= 1;

            ss[i] |= 1 << s;
        }
    }

    for(int i=0;i<M;++i){
        std::cin >> ps[i];
    }

    int res = 0;

    for(int i=0;i<(1<<N);++i){
        bool ok = true;

        for(int j=0;j<M;++j){
            if(__builtin_popcount(i & ss[j]) % 2 != ps[j]){
                ok = false;
                break;
            }
        }

        if(ok){
            res += 1;
        }
    }

    std::cout << res << std::endl;
}


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

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

const long long INF = 1LL << 60;
int N;
long long h[100010];
long long dp[100010];

int main(int argc, char const *argv[]){


	int N; cin >> N;
    for (int i = 0; i < N; ++i) cin >> h[i];

    // 初期化 (最小化問題なので INF に初期化)
    for (int i = 0; i < 100010; ++i) dp[i] = INF;

    // 初期条件
    dp[0] = 0;

    // ループ
    for (int i = 1; i < N; ++i) {
        chmin(dp[i], dp[i - 1] + abs(h[i] - h[i - 1]));
        if (i > 1) chmin(dp[i], dp[i - 2] + abs(h[i] - h[i - 2]));
    }

    // 答え
    cout << dp[N-1] << endl;
	return 0;
}

Measured memory_bytes: 1792
n = int(input())
c = input()

#右端から見ていって初めのRが出たらWとRをカウントする
cnt = 0
R = 0
W = 0

for i in range(n):
    if c[i] == "R":R += 1
    else:W += 1

for i in range(R):
    if c[i] == "W":cnt += 1
print(cnt)

Measured memory_bytes: 9340
from collections import deque
from itertools import product

H, W = map(int, input().split(' '))
maze = [input() for _ in range(H)]

points = [(y, x) for y, x in product(range(H), range(W)) if maze[y][x] == '.']

ans = 0
for sy, sx in points:
    costs = {}
    queue = deque()
    queue.append((sy, sx, 0))
    while queue:
        y, x, cost = queue.popleft()
        if (y, x) in costs:
            continue
        else:
            costs[(y, x)] = cost

        for ny, nx in ((y + 1, x), (y - 1, x), (y, x + 1), (y, x - 1)):
            if not 0 <= ny < H:
                continue
            if not 0 <= nx < W:
                continue
            if (ny, nx) in costs:
                continue
            if maze[ny][nx] == '#':
                continue
            queue.append((ny, nx, cost + 1))

    ans = max(ans, max(costs.values()))

print(ans)


Measured memory_bytes: 9420
from fractions import gcd


def lcm(x, y):
    return (x * y) // gcd(x, y)


if __name__ == "__main__":
    n = int(input())
    t = list()
    for i in range(n):
        t.append(int(input()))

    ans = 1
    for i in range(n):
        ans = lcm(ans, t[i])

    print(ans)


Measured memory_bytes: 5344
/* include c++ libraries */
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <unordered_map>
#include <map>
#include <queue>
#include <set>

/* include c-lang libraries */
#include <climits>
#include <cmath>

/* include my libraries */
//#include <show_vec.hh>

using namespace std;

#define LINE DEBUG{ printf("LINE : %d\n", __LINE__); }
#define DEBUG if(false)

using ll = long long;
template<class T> using vec = vector<T>;

const int MOD = 1000000007;

int main(){
  int A, B, C, D;
  cin >> A >> B >> C >> D;

  int T_attack = C / B;
  if( (C%B) != 0 ) T_attack++;
  int A_attack = A / D;
  if( (A%D) != 0 ) A_attack++;
  if(T_attack <= A_attack){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
  return 0;
}


Measured memory_bytes: 3580
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ld long double
#define ll long long
#define P pair<int,int>
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<n;i++)
#define all(v) v.begin(),v.end()
#define pb push_back
#define eb emplace_back
template<class T>void chmax(T &a,T b){if(a<b)a=b;}
template<class T>void chmin(T &a,T b){if(a>b)a=b;}
constexpr int INF=1000000000000000000;
constexpr int mod=1000000007;
constexpr double eps=1e-8;
const double pi=acos(-1);
int dx[]={0,1,0,-1},dy[]={1,0,-1,0};
int Random(int mi,int ma){
    random_device rnd;
    mt19937 mt(rnd());//32bit
    //[mi,ma]
    uniform_int_distribution<int>engine(mi,ma);
    return engine(mt);
}
int gcd(int a,int b){
    if(b==0)return a;
    return gcd(b,a%b);
}
int lcm(int a,int b){
    return a/gcd(a,b)*b;
}
bool prime(int a){
    if(a==1)return false;
    for(int i=2;i*i<=a;i++){
        if(a%i==0)return false;
    }
    return true;
}
int modpow(int a,int b){
    if(b==0)return 1;
    if(b%2)return modpow(a,b-1)*a%mod;
    int memo=modpow(a,b/2);
    return memo*memo%mod;
}
vector<int>kaijo,invkaijo;
void init_fact(int n){
    kaijo.resize(n+1);
    invkaijo.resize(n+1);
    kaijo[0]=1;
    for(int i=1;i<=n;i++){
        kaijo[i]=kaijo[i-1]*i;
        kaijo[i]%=mod;
    }
    rep(i,n+1)invkaijo[i]=modpow(kaijo[i],mod-2);
}
int comb(int a,int b){
    if(a<b)return 0;
    if(a<0||b<0)return 0;
    return kaijo[a]*invkaijo[a-b]%mod*invkaijo[b]%mod;
}
int inv(int x){
    x=modpow(x,mod-2);
    return x;
}

int h,w;
int ch,cw,dh,dw;
char s[3010][3010];
int d[3010][3010];
void bfs(){
    rep(i,h)rep(j,w)d[i][j]=INF;
    d[ch][cw]=0;
    vector<P>v;
    v.pb({ch,cw});
    rep(dist,INF){
        vector<P>u;
        queue<P>q;
        for(P p:v)q.push(p);
        while(!q.empty()){
            P p=q.front();
            q.pop();
            u.pb(p);
            int x=p.fi,y=p.se;
            rep(i,4){
                int X=p.fi+dx[i],Y=p.se+dy[i];
                if(0<=X&&X<h&&0<=Y&&y<w&&s[X][Y]=='.'){
                    if(d[X][Y]>d[x][y]){
                        d[X][Y]=d[x][y];
                        q.push({X,Y});
                    }
                }
            }
        }
        v.clear();
        for(P p:u){
            int x=p.fi,y=p.se;
            for(int i=-2;i<=2;i++){
                for(int j=-2;j<=2;j++){
                    int X=x+i,Y=y+j;
                    if(0<=X&&X<h&&0<=Y&&y<w&&s[X][Y]=='.'){
                        if(d[X][Y]>d[x][y]+1){
                            d[X][Y]=d[x][y]+1;
                            v.pb({X,Y});
                        }
                    }
                }
            }
        }
        if(v.empty())break;
    }
}
signed main(){
    cin.tie(0);ios::sync_with_stdio(false);
    cin>>h>>w>>ch>>cw>>dh>>dw;
    ch--,cw--,dh--,dw--;
    rep(i,h){
        rep(j,w){
            cin>>s[i][j];
        }
    }
    bfs();
    int ans=d[dh][dw];
    if(ans==INF)cout<<-1<<endl;
    else cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 18672
import Data.List
import qualified Data.ByteString.Char8 as B
import Data.Ord 

main :: IO ()
main = breads >>= main' . last
    where
        main' k = breads >>= print . solve k

solve :: Int -> [Int] -> Int 
solve k = condf . sortBy (comparing length) . group . sort
    where
        condf xs
            | n > k = foldl' ff 0 $ take (n - k) xs
            | otherwise = 0
            where
                n = length xs
                ff acc x = acc + length x

breads :: IO [Int]
breads = unfoldr uff <$> B.getLine
    where
        uff b = check <$> B.readInt b
        check (a, b)
            | B.null b = (a, b)
            | otherwise = (a, B.tail b)

Measured memory_bytes: 43388
#include <bits/stdc++.h>
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

using namespace std;

#define rep(i, a, b) for (int i = a; i < b; i++)
#define rrep(i, a, b) for (int i = a; i <= b; i++)
#define all(a)  begin((a)),end((a))
#define uniq(c) (c).erase(unique(all((c))), end((c)))

#define TRUE 1
#define FALSE 0
#define NIL -1

int counter(int x) {
    if(x == 0) return 0;
    return counter(x >> 1) + (x & 1);
}

int main() {
    int N;
    int A[20];
    int x[20][20];
    int y[20][20];

    cin >> N;
    for (int i = 1; i <= N; i++) {
        cin >> A[i];
        for(int j = 1; j <= A[i]; j++) {
            cin >> x[i][j] >> y[i][j];
        }
    }

    int ans = 0;
    for (int bits = 0; bits < (1 << N); bits++) {
        bool ok = true;
        for (int i = 1; i <= N; i++) {
            if (!(bits & (1 << (i-1)))) continue;
            for (int j = 1; j <= A[i]; j++) {
                if (((bits >> (x[i][j]-1)) & 1) ^ y[i][j]) ok = false;
            }
        }
        if (ok) ans = max(ans, counter(bits));
    }
    cout << ans << endl;
}

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

using namespace std;

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()
{
	long long n;
	cin >> n;
	cout << (n - 1) * n / 2 << endl;
}

Measured memory_bytes: 256
import numpy as np

N, L, T = map(int, input().split())

X0 = np.zeros(N, dtype=np.int)
W = np.zeros(N, dtype=np.int)
for i in range(N):
    X0[i], W[i] = map(np.int, input().split())

X = X0 + T * (3 - 2*W) #(2*(1.5 - W))
count = np.sum(X // L)	#x=0を超えた蟻の数。0の蟻がどこまでズレたかがわかる。
#print(count)
count %= N

X %= L
X.sort()

for x in X[count:]:
    print(x)
for x in X[:count]:
    print(x)


Measured memory_bytes: 16536
#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>

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

using namespace std;
#define int long long
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repr(i,n) for(ll i=n;i>=0;i--)
#define P pair<ll, ll>
#define sz(x) (ll)x.size()
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define VE vector<ll>
#define COUT(x) cout<<(x)<<endl
#define MA map<ll,ll>
#define SE set<ll>
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,VE,greater<ll>>
#define COUT(x) cout<<(x)<<endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define EPS (1e-10)


const long long MOD = 1000000007;
//const long long MOD = 998244353;
const long long INF = 1LL << 60;


long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	unsigned r;
	while ((r = a % b)) {
		a = b;
		b = r;
	}
	return b;
}
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a * g / b;
}
bool prime(ll n) {
	for (ll i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}




const long double PI = 3.14159265359;
const int MAX_N = 100010;



signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n; cin >> n;
	VE a(n); rep(i, n)cin >> a[i];
	int nowsum = 0;
	int ans = 0;
	rep(i, n) {
		nowsum += a[i];
		if (i % 2 == 1) {
			if (nowsum <= 0) {
				ans += 1 - nowsum; nowsum = 1;
			}
		}
		else {
			if (nowsum >= 0) {
				ans += 1 + nowsum; nowsum = -1;
			}
		}
	}
	nowsum = 0;
	int ans2 = 0;
	rep(i, n) {
		nowsum += a[i];
		if (i % 2 == 0) {
			if (nowsum <= 0) {
				ans2 += 1 - nowsum; nowsum = 1;
			}
		}
		else {
			if (nowsum >= 0) {
				ans2 += 1 + nowsum; nowsum = -1;
			}
		}
	}
	cout << min(ans, ans2) << endl;
	return 0;
}

Measured memory_bytes: 1024
using System;
using System.Collections.Generic;

namespace B
{
    class Program
    {
        static public int INF = (int)Math.Pow(10, 6);
        static void Main(string[] args)
        {
            string[] In = Console.ReadLine().Split(' ');
            int k = int.Parse(In[0]);
            int x = int.Parse(In[1]);
            var L = new List<int>();
            for(int i=x-k+1; i <= x + k - 1; i++)
            {
                L.Add(i);
            }
            foreach(var l in L)
            {
                if((-1)*INF<=l && l<=INF)Console.WriteLine(l);
            }
        }
    }
}


Measured memory_bytes: 28164
using System;
using System.Text;
using System.Linq;

public static class Program
{
    public static int Main(string[] args)
    {
        
        int[] n = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
        
        var area = n[0] * n[1];
        var length = n[0] * 2 + n[1] * 2 ;
        Console.WriteLine(area.ToString() + " " + length.ToString());
        
        return 0;
    }
    
}


Measured memory_bytes: 16372
import numpy as np
data = [int(x) for x in input().split(" ")]

a1 = data[0] * data[2]
a2 = data[0] * data[3]
a3 = data[1] * data[2]
a4 = data[1] * data[3]

print(np.array([a1, a2, a3, a4]).max())

Measured memory_bytes: 27244
#pragma GCC optimize("O3") //コンパイラ最適化用

#define _GLIBCXX_DEBUG //配列に[]でアクセス時のエラー表示
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
// forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
// Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはメントされる
#define REP(i, n) for (ll i = 0; i < ll(n); i++)
#define REPD(i, n) for (ll i = n - 1; i >= 0; i--) //ループ変数は1ずつデクリ
#define FOR(i, a, b) for (ll i = a; i <= ll(b); i++)
#define FORD(i, a, b) for (ll i = a; i >= ll(b); i--) //ループ変数は1ずつデクリ
// xにはvectorなどのコンテナ
#define ALL(x) x.begin(), x.end() // sortなどの引数を省略したい
#define SIZE(x) ll(x.size())      // sizeをsize_tからllに直しておく
//定数
#define INF 1000000000000 // 10^12:極めて大きい値,∞
#define MOD 1000000007    // 10^9+7:合同式の法
#define MAXR 100000 // 10^5:配列の最大のrange(素数列挙などで使用)
//略記
#define PB push_back // vectorヘの挿入
#define MP make_pair // pairのコンストラクタ
#define F first      // pairの一つ目の要素
#define S second     // pairの二つ目の要素
#define Umap unordered_map
#define Uset unordered_set
const unsigned int BIT_FLAG_0 = (1 << 0); // 0000 0000 0000 0001
const unsigned int BIT_FLAG_1 = (1 << 1); // 0000 0000 0000 0010
const unsigned int BIT_FLAG_2 = (1 << 2); // 0000 0000 0000 0100
const unsigned int BIT_FLAG_3 = (1 << 3); // 0000 0000 0000 1000
const unsigned int BIT_FLAG_4 = (1 << 4); // 0000 0000 0001 0000
const unsigned int BIT_FLAG_5 = (1 << 5); // 0000 0000 0010 0000
const unsigned int BIT_FLAG_6 = (1 << 6); // 0000 0000 0100 0000
const unsigned int BIT_FLAG_7 = (1 << 7); // 0000 0000 1000 0000

int main() {
    ll a, b;
    cin >> a >> b;
    (a * b % 2 == 0) ? cout << "Even" << endl : cout << "Odd" << endl;
}


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

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

int mod = 1000000007;

int main(void){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int X; cin >> X;
    int ans = 1;
    for(int i = 2; i <= X; i++){
        int st = i;
        while(st*i <= X) st*=i;
        if(st != i) ans = max(ans, st);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <unordered_map>

using namespace std;
using ll = long long;
constexpr int MOD = 1e9+7;

void _cin(){} template <class Head, class... Tail> void _cin(Head&& head, Tail&&... tail){ cin >> head; _cin(forward<Tail>(tail)...); }
void _cout(){ cout << "\n"; } template <class Head, class... Tail> void _cout(Head&& head, Tail&&... tail){ cout << head; _cout(forward<Tail>(tail)...); }
int gcd(int a, int b){ return (b == 0) ? a : gcd(b, a % b); }

#define For(i, n) for(int i = 0; i < (n); i ++)
#define Rep(n) For(_, n)
#define Range(c) c.begin(), c.end()
#define RevRange(c) c.rbegin(), c.rend()
#define Contains(c, x) (find(Range(c), x) != c.end())
#define Search(rb, re, x) distance(rb, find(rb, re, x))
#define Sort(a) sort(Range(a))
#define DeSort(a) sort(RevRange(a))
#define Reverse(c) reverse(Range(c))
#define Vec2(T, n, m, xs) vector<vector<T>> xs(n, vector<T>(m))
#define Sum(a) accumulate(Range(a), 0)
#define Cusum(T, xs, sxs) vector<T> sxs(xs.size()+1); For(i, (int)xs.size()) sxs[i+1] = sxs[i] + xs[i]
#define Cin(T, ...) T __VA_ARGS__; _cin(__VA_ARGS__)
#define Cins(T, n, xs) vector<T> xs(n); For(i, n) cin >> xs[i]
#define Cins2(T, n, xs, ys) vector<T> xs(n), ys(n); For(i, n) cin >> xs[i] >> ys[i]
#define Cins3(T, n, xs, ys, zs) vector<T> xs(n), ys(n), zs(n); For(i, n) cin >> xs[i] >> ys[i] >> zs[i]
#define Cinss(T, n, m, xs) Vec2(T, n, m, xs); For(i, n) For(j, m) cin >> xs[i][j]
#define Cinm(T, n, map) unordered_map<T, int> map; Rep(n){ Cin(T, x); map[x] ++; }
#define Cout(...) _cout(__VA_ARGS__)
#define Couts(xs) for(const auto &e : xs) cout << e << " "; cout << "\n"
#define Coutyn(cond) Cout((cond) ? "yes" : "no")
#define CoutYn(cond) Cout((cond) ? "Yes" : "No")
#define CoutYN(cond) Cout((cond) ? "YES" : "NO")

int main(void){
    Cin(int, h, w, a, b);
    Cout((h-a)*(w-b));
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
typedef long long           ll;
typedef vector<int>         vi;
typedef vector<ll>          vll;
 
#define ff                  first
#define sf                  scanf
#define pf                  printf
#define ss                  second
#define ppb                 pop_back
#define pb                  push_back
#define MP                  make_pair
#define MAXN                10000
#define MOD                 100000007
#define inf                 0x3f3f3f3f
#define PI                  (2.0*acos(0.0))
#define INF                 0x3f3f3f3f3f3f3f3f
#define rev(v)              reverse(all(v))
#define all(v)              v.begin(), v.end()
#define __lcm(x, y)         (x * y) / __gcd(x, y)
#define FOR(i, x, y)        for(int i = x; i < y; i++)
#define RFOR(i, x, y)       for(int i = x; i >= y; i--)
#define MEM(arr, val)       memset(arr, val, sizeof(arr));
#define unq(v)              (v).resize(unique(all(v)) - v.begin())
#define READ()              freopen("input.txt", "r", stdin)
#define WRITE()             freopen("output.txt", "w", stdout)
#define si(n)               scanf("%d", &n)
#define sl(n)               scanf("%lld", &n)
#define sii(a, b)           scanf("%d %d", &a, &b)
#define sll(a, b)           scanf("%lld %lld", &a, &b)
#define siii(a, b, c)       scanf("%d %d %d", &a, &b, &c)
#define slll(a, b, c)       scanf("%lld %lld %lld", &a, &b, &c)
#define siiii(a, b, c, d)   scanf("%d %d %d %d", &a, &b, &c, &d)
#define sllll(a, b, c, d)   scanf("%lld %lld %lld %lld", &a, &b, &c, &d)
#define vout(v)             for(int i = 0; i < v.size(); i++) {cout << v[i]; if(i < v.size() - 1) cout << ' '; else cout << endl;}
 
vll v(100);
ll n, a, tot;
ll dp[99][99][3000];
 
ll call(ll pos, ll cnt, ll sum){
    if(pos >= n) return 0;
    if(dp[pos][cnt][sum] != -1) return dp[pos][cnt][sum];
    
    ll val1 = 0, val2 = 0, val3 = 0;
    double totSum = v[pos] + sum;
    if((totSum / (cnt + 1.0)) == (double)a){
        val1 = 1 + call(pos + 1, cnt + 1, sum + v[pos]);
    } else {
        val2 = call(pos + 1, cnt + 1, sum + v[pos]);
    }
    val3 = call(pos + 1, cnt, sum);
    return dp[pos][cnt][sum] = val1 + val2 + val3;
}
 
int main(){
        sll(n, a);
        v.resize(n);
 
        FOR(i, 0, n) sl(v[i]);
        MEM(dp, -1);
        cout << call(0, 0, 0) << endl;
 
    return 0;
}

Measured memory_bytes: 233444
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <fstream>
#include <complex>
#include <math.h>
using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<long, long> PLL;
typedef long long LL;
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(long i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

const long double EPS = 1e-12;
const double INF = 1e12;

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

int main(){
	string str;
	while(cin>>str){
		reverse(ALL(str));
		cout<<str<<endl;
	}
	return 0;
}

Measured memory_bytes: 1176