akhauriyash/Code-Regression huggingface dataset:
#include <string>
#include <iostream>
using namespace std;
int n, p; string s;
string w = "0123456789ABCDEFGHIJJKMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
int main() {
	cin >> n;
	int ret = 0;
	while (n--) {
		cin >> p >> s;
		long long t = 0;
		for (int i = 0; i < s.size(); i++) {
			t *= p;
			for (int j = 0; j < p; j++) {
				if (s[i] == w[j]) t += j;
			}
		}
		int cnt = 0;
		while (t > 0) t >>= 1, cnt++;
		ret ^= cnt;
	}
	cout << (ret ? "win" : "lose") << endl;
	return 0;
}

Measured memory_bytes: 3160
#include <algorithm>
#include <iostream>
#include <iterator>
#include <numeric>
#include <vector>
using namespace std;

int main() {
  int n, m;
  cin >> n >> m;
  vector<int> denomination_collection;
  denomination_collection.reserve(m);
  copy(istream_iterator<int>(cin), istream_iterator<int>(),
       back_inserter(denomination_collection));

  vector<int> coin_cnt(n + 1, numeric_limits<int>::max());
  coin_cnt[0] = 0;
  for (int curr = 1; curr <= n; ++curr) {
    for (int denomination : denomination_collection) {
      if (curr >= denomination) {
        coin_cnt[curr] = min(coin_cnt[curr], coin_cnt[curr - denomination] + 1);
      }
    }
  }

  cout << coin_cnt[n] << endl;
}



Measured memory_bytes: 3168
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using pint = pair<int,int>;
ll mod = 1000000007,mod2 = 998244353;

void chmin(long long &a, long long b) { if (a > b) a = b; }
void chmax(long long &a, long long b) { if (a < b) a = b; }
const long long INF = 1LL<<60;
ll gcd(ll a,ll b){
    if(b == 0) return a;
    else return gcd(b,a%b);
}

//重みある時
using Edge = pair<int,int>;
using Graph = vector<vector<Edge> >;

int main() {
    int n;
    cin >> n;
    vector<ll> a(n);
    ll ans = 0;
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }
    for (int bit = 0; bit < 60; ++bit) {
        ll cnt0 = 0,cnt1 = 0;
        ll tmp = (1LL<<bit)%mod;
        for (int i = 0; i < n; ++i) {
            if(a[i] & 1LL<<bit) cnt1++;
            else cnt0++;
        }
        tmp = (tmp*cnt0)%mod;
        tmp = (tmp*cnt1)%mod;
        ans = (ans+tmp)%mod;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 2560
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
ll solve (vector<vector<ll> > &v, ll &n, ll i, ll k, vector<vector<ll> > &dp)
{
    if (i == n + 1)
    {
        //cout<<"hii"<<endl;
        return 0;
    }

    if (dp[i][k] != -1)
    {
        return dp[i][k];
    }

    ll temp = INT_MIN;
    ll ans = INT_MIN;

    for (ll j = 1; j <= 3; j++)
    {
       // cout<<"in for"<<endl;
        if (j == k)
        {
            //cout<<"yoo"<<endl;
            continue;
        }

        temp = v[i][j] + solve (v, n, i + 1, j, dp);
        ans = max (temp, ans);
        //cout<<ans<<endl;
    }

    return dp[i][k] = ans;
}
int main()
{
    ll n;
    cin >> n;
    //create a 2d array
    vector<vector<ll> > v (n + 1, vector<ll> (4) );

    for (int i = 1; i <= n; i++)
    {
        for (int j = 1; j <= 3; j++)
        {
            cin >> v[i][j];
        }

    }
    //cout<<"hello"<<endl;
    vector<vector<ll> > dp (n + 1, vector<ll> (4,-1) );
    cout << solve (v, n, 1, 0, dp) << endl;


    return 0;
}


Measured memory_bytes: 26672
import java.util.*;

public class Main{
	public static void main(String[] args) {
		Scanner sc= new Scanner(System.in);
		int a = Integer.parseInt(sc.next());

		if(a<1200){
			System.out.println("ABC");
		}else if(a<2800){
			System.out.println("ARC");
		}else {
			System.out.println("AGC");


		}
	}
}

Measured memory_bytes: 22868
#include <stdio.h>

int main()
{
	int a,b,c,d,e; scanf("%d %d %d %d %d",&a,&b,&c,&d,&e);
	int array[5]={a,b,c,d,e};
	int time10[5]={a%10,b%10,c%10,d%10,e%10};
	for (int i = 4; i >= 1 ; --i)
	{
		for (int j = 0; j < i; ++j)
		{
			if(time10[j]>time10[j+1]){
				int tmp=time10[j];
				time10[j]=time10[j+1];
				time10[j+1]=tmp;
			}
		}
	}

	int min=0;
	for (int i = 0; i < 5; ++i)
	{
		if(time10[i]!=0){
			min=time10[i]-10;
			break;
		}
	}

	int ans=0;
	for (int i = 0; i < 5; ++i)
	{
		if(array[i]%10!=0) array[i]=(array[i]/10+1)*10;
		ans+=array[i];
	}
	printf("%d",ans+min);
	return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <string.h>
#include <vector>
#include <deque>
#include <bitset>
#include <string>
#include <limits.h>
#include <stdint.h>
#include <algorithm>
#include <tuple>
#include <iomanip>
#include <set>
#include <assert.h>
using namespace std;

int main(int argc, char* argv[])
{
	if (argc >= 2) {
		FILE* fp = freopen(argv[1], "r", stdin);
	}

	int N;
	cin >> N;
	vector<int> v;
	int64_t sum = 0;
	for (int i = 0; i < N; i++) {
		int a;
		cin >> a;
		v.push_back(a);
		sum += a;
	}
	int64_t tmp = 0;
	int64_t ret = INT64_MAX;
	for (int i = 0; i < N - 1; i++) {
		tmp += v[i];
		int64_t x = abs(sum - tmp * 2);
		if (x < ret) ret = x;
	}
	cout << ret;
	
	return 0;
}


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

int main() {
  int N;
  cin >> N;
  
  int t = N;
  int c = 0;
  
  for (int i = 0; t > 0; i++) {
  //while(t > 0) {
    c += t % 10;
    t = t / 10;
  }
  
  if (N % c == 0)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#define len(X) ((int)(X).size())

#ifdef __LOCAL
#define DBG(X) cout << #X << "=" << (X) << '\n';
#define SAY(X) cout << (X) << '\n';
#else
#define DBG(X)
#define SAY(X)
#endif

using namespace std;

using ll = long long int;
using ull = unsigned long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

const int INT_INF = (int)(2e9);
const ll  LL_INF = (ll)(2e18);

const int NIL = -1;
static mt19937 _g(time(nullptr));

std::string pad(int num)
{
    char buffer[4];
    std::snprintf(buffer, sizeof(buffer), "%03d", num);
    return buffer;
}

inline ll randint(ll a, ll b) { ll w = (_g() << 31LL) ^ _g(); return a + w % (b - a + 1); }
inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T> inline T sign(T x) { return T(x > 0) - T(x < 0); }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline T fetch() { T ret; cin >> ret; return ret; }
template<typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for (auto& elem : ret) cin >> elem; return ret; }

#ifdef _MSC_VER
#  include <intrin.h>
#  define __builtin_popcount __popcnt
#endif

int solve()
{
    int K, N;

    std::cin >> K >> N;

    vector<int> a = fetch_vec<int>(N);

    int maxDistance = a[0] + K - a.back();

    for (int i = 1; i < N; ++i) {
        maxDistance = max(maxDistance, a[i] - a[i-1]);
    }

    return K - maxDistance;
}

int main()
{
    std::cout << solve() << std::endl;
//    solve();

    return 0;
}

Measured memory_bytes: 1024
x,y,a,b,c = map(int,input().split())
p = sorted(list(map(int,input().split())),reverse=True)
q = sorted(list(map(int,input().split())),reverse=True)
r = sorted(list(map(int,input().split())),reverse=True)
result = sum(p[0:x]) + sum(q[0:y])
red = x-1
green = y-1
colorless = 0
#print(p,q,r)
while colorless < c:
	#print(red,green,colorless)
	if red >= 0 and green >= 0:
		if p[red] < q[green]:
			if r[colorless] > p[red]:
				result -= p[red]
				result += r[colorless]
				colorless += 1
				red -= 1
			else:
				break
		else:
			if r[colorless] > q[green]:
				result -= q[green]
				result += r[colorless]
				colorless += 1
				green -= 1
			else:
				break
	elif red >= 0:
		if r[colorless] > p[red]:
			result -= p[red]
			result += r[colorless]
			colorless += 1
			red -= 1
		else:
			break
	elif green >= 0:
		if r[colorless] > q[green]:
			result -= q[green]
			result += r[colorless]
			colorless += 1
			green -= 1
		else:
			break
print(result)

Measured memory_bytes: 24096
import java.util.*;
public class Main{
    public static void main(String[] aargs){
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        Integer[] A = new Integer[N];
        for(int i=0;i<N;i++){
            A[i] = sc.nextInt();
        }
        Integer B[] = A.clone();
        Arrays.sort(A,Collections.reverseOrder());
        for(int i=0;i<N;i++){
            if(B[i]!=A[0]){
                System.out.println(A[0]);
            }
            else{
                System.out.println(A[1]);
            }
        }
    }
}

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

const long long MOD = 2;

int solve(long long N, std::vector<long long> A)
{
    long long cnt = 0;
    while (true)
    {
        for (int i = 0; i < N; i++)
        {
            if (A[i] % 2 == 1 || A[i] == 0)
            {
                cout << cnt << endl;
                return 0;
            }
            A[i] = A[i] / 2;
        }
        cnt++;
    }
    //cout << cnt << endl;
    return 0;
}
// Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main()
{
    long long N;
    scanf("%lld", &N);
    std::vector<long long> A(N);
    for (int i = 0; i < N; i++)
    {
        scanf("%lld", &A[i]);
    }
    solve(N, std::move(A));
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-8;
const ll mod=1e9+7;
const int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

int a,b,c;

int main(){
	cin>>a>>b>>c;
	cout<<a+b+c-max({a,b,c})<<endl;
}

Measured memory_bytes: 256
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main(){
	ios_base::sync_with_stdio(0);cin.tie(0);
	ll X; cin >> X;
	ll now = 101;
	int day = 0;
	while(now < X){
		day++;
		now = now+(now/100);
	}
	cout << day+1 << '\n';
}

Measured memory_bytes: 3652
#include <bits/stdc++.h> 
using namespace std; 
  
// Return the maximum volume. 
double maxvolume(double s) 
{ 
    // finding length 
    double length = s / 3.0; 
  
    s -= length; 
  
    // finding breadth 
    double breadth = s / 2.0; 
  
    // finding height 
    double height = s - breadth; 
  
    return length * breadth * height; 
} 
  
// Driven Program 
int main() 
{ 
    double s;
    cin>>s;
    cout << setprecision(16)<< maxvolume(s) << endl; 
    return 0; 
} 

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
// #include <numeric>

#define FAST ios_base::sync_with_stdio(false); cin.tie(0)
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
typedef long long int ll;
#define iceil(a,b) (x+y-1)/y
#define min(x,y)(x<y?x:y)
 
using namespace std;
typedef pair<int, int> P;


int main() {
	FAST;

	int n, ans;
	cin >> n;

	if (n%2 ==0) ans = n;
	else ans = 2*n;

	cout << ans << "\n";

	return 0;
}


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

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n, m; cin >> n >> m;
    vector<vector<int>> e(n);
    for (int i = 0; i < m; i++) {
        int a, b; cin >> a >> b;
        a--, b--;
        e[a].emplace_back(b);
        e[b].emplace_back(a);
    }
    int q; cin >> q;
    using Paint = array<int, 4>;
    vector<Paint> arr;
    for (int i = 0; i < q; i++) {
        int v, d, c; cin >> v >> d >> c;
        arr.push_back({d, --v, c, i});
    }
    sort(arr.begin(), arr.end());
    vector<Paint> v(n, {-1, 0, 0, 0});
    queue<Paint> que;
    vector<array<int, 2>> color(n, {0, -1});
    auto add = [&](int curr) {
        while (!arr.empty()) {
            auto x = arr.back();
            if (x[0] != curr) break;
            if (v[x[1]][0] != curr) v[x[1]] = x;
            else {
                if (v[x[1]][3] < x[3]) v[x[1]] = x;
            }
            arr.pop_back();
        } 
        for (int i = 0; i < n; i++) {
            if (v[i][0] == curr) que.push(v[i]);
        }
    };
    auto spread = [&](int curr) {
        while (!que.empty()) {
            auto x = que.front(); que.pop();
            if (color[x[1]][1] < x[3]) color[x[1]] = {x[2], x[3]};
            if (x[0] == 0) continue;
            x[0]--;
            for (auto &to: e[x[1]]) {
                if (v[to][0] != x[0]) {
                    v[to] = x; v[to][1] = to;
                } else {
                    if (v[to][3] < x[3]) {
                        v[to] = x; v[to][1] = to;
                    }
                }
            }
        }
    };
    for (int curr = 10; curr >= 0; curr--) {
        add(curr); spread(curr);
    }
    for (int i = 0; i < n; i++) cout << color[i][0] << "\n";
    return 0;
}

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

int main() {
  int h,w;
  cin>>h>>w;
  vector<vector<char>> vec(h,vector<char>(w));
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      cin>>vec[i][j];
    }
  }
   for(int i=0;i<w+2;i++){
     cout<<'#';
   }
  cout<<endl;
   for(int i=0;i<h;i++){
     cout<<'#';
    for(int j=0;j<w;j++){
      cout<<vec[i][j];
    }
     cout<<"#"<<endl;
   }
   for(int i=0;i<w+2;i++){
     cout<<'#';
   }
  cout<<endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

int main(){
  int A,B;

  scanf("%d %d",&A,&B);

  if(A%2==1 && B%2==1){
    printf("Yes\n");
  }else{
    printf("No\n");
  }

  return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<cassert>
#define PB push_back
#define MP make_pair
#define sz(v) (in((v).size()))
#define forn(i,n) for(in i=0;i<(n);++i)
#define forv(i,v) forn(i,sz(v))
#define fors(i,s) for(auto i=(s).begin();i!=(s).end();++i)
#define all(v) (v).begin(),(v).end()
using namespace std;
typedef int in;
typedef vector<in> VI;
typedef vector<VI> VVI;
void imp(){
  cout<<"No"<<endl;
  exit(0);
}
VVI mar;
struct fenw{
  VI fw;
  in n;
  void ini(in pn){
    n=pn;
    fw.clear();
    fw.resize(n,0);
  }
  void ad(in l, in x){
    while(l<n){
      fw[l]+=x;
      l|=(l+1);
    }
  }
  in sm(in l){
    in r=0;
    while(l>=0){
      r+=fw[l];
      l&=(l+1);
      --l;
    }
    return r;
  }
};
VI posof;
VI flipof;
fenw tf[2];
set<in> act[2];
VI sat;
set<pair<VI,VI> > rcb;
queue<VI> qa,qb;
int main(){
  ios::sync_with_stdio(0);
  cin.tie(0);
  in n;
  cin>>n;
  forn(z,2)
    tf[z].ini(n+3);
  forn(i,n){
    act[i%2].insert(i);
    tf[i%2].ad(i,1);
  }
  sat.resize(n);
  mar.resize(3,VI(n));
  forn(i,3){
    forn(j,n)
      cin>>mar[i][j];
  }
  in a,b;
  posof.resize(n);
  flipof.resize(n);
  forn(i,n){
    a=mar[0][i]-mar[1][i];
    b=mar[2][i]-mar[1][i];
    sat[i]=(mar[1][i]-2)/3;
    posof[(mar[1][i]-2)/3]=i;
    flipof[(mar[1][i]-2)/3]=(a==1);
    if(a>b)
      swap(a,b);
    if(a!=-1 || b!=1)
      imp();
  }
  set<in>::iterator it;
  forn(i,n-5){
    a=tf[i%2].sm(posof[i]-1);
    a%=2;
    if(a){
      flipof[sat[*act[i%2].begin()]]^=1;
      flipof[sat[*act[!(i%2)].begin()]]^=1;
    }
    a^=flipof[i];
    act[i%2].erase(posof[i]);
    if(a){
      flipof[sat[*act[i%2].begin()]]^=1;
      it=act[!(i%2)].begin();
      flipof[sat[*it]]^=1;
      ++it;
      flipof[sat[*it]]^=1;
    }
    tf[i%2].ad(posof[i],-1);
  }
  VI cpr(5);
  it=act[(n-5)%2].begin();
  forn(z,3){
    cpr[2*z]=sat[*it];
    ++it;
  }
  it=act[(n-4)%2].begin();
  forn(z,2){
    cpr[2*z+1]=sat[*it];
    ++it;
  }
  VI fp(5);
  forn(z,5)
    fp[z]=flipof[cpr[z]];
  forv(i,cpr)
    cpr[i]-=n-5;
  rcb.insert(MP(cpr,fp));
  qa.push(cpr);
  qb.push(fp);
  VI tcpr,tfp;
  VI gl(5);
  forn(i,5)
    gl[i]=i;
  VI gfp(5,0);
  while(!qa.empty()){
    cpr=qa.front();
    qa.pop();
    fp=qb.front();
    qb.pop();
    for(in i=1;i<=3;++i){
      tcpr=cpr;
      tfp=fp;
      swap(tcpr[i-1],tcpr[i+1]);
      swap(tfp[i-1],tfp[i+1]);
      for(in j=i-1;j<=i+1;++j)
	tfp[j]^=1;
      if(rcb.find(MP(tcpr,tfp))==rcb.end()){
	rcb.insert(MP(tcpr,tfp));
	qa.push(tcpr);
	qb.push(tfp);
      }
    }
  }
  if(rcb.find(MP(gl,gfp))==rcb.end())
    imp();
  cout<<"Yes"<<endl;
  return 0;
}


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

#define all(a) a.begin(),a.end()
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define REP(i,k,n) for(int i=k;i<(int)(n);i++)
template<class T> void out(T a){cout<<a<<'\n';}
template<class T> void outv(T v){rep(i,v.size()){if(i)cout<<' ';cout<<v[i];}cout<<'\n';}

int main(){
  int n,m; cin>>n>>m;
  scc_graph sg(n);
  rep(i,m){
    int a,b; cin>>a>>b;
    sg.add_edge(a,b);
  }
  auto v=sg.scc();
  out(v.size());
  rep(i,v.size()){
    cout<<v[i].size()<<" ";
    outv(v[i]);
  }
}


Measured memory_bytes: 40084
Scanf.scanf "%d" (fun n ->
    let a = Array.init n (fun _ -> Scanf.scanf " %d" (fun a -> a)) in
    let calc t =
        let rec loop i acc =
            if i mod 2 = 0 then loop (i lsr 1) (acc + 1) else acc
        in
        loop t 0
    in
    Array.fold_left (fun acc v -> acc + calc v) 0 a |> Printf.printf "%d\n"
)

Measured memory_bytes: 2688
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main(void) {
	int num, i = 0, c, ans = 0;
	cin >> num;
	vector<int> d(num);
	for (; i < num; i++)
		scanf("%d", &d[i]);
	sort(d.begin(), d.end());
	for (i = 0; i < num - 1; i++) {
		c = 0;
		while (i < num - 1 && d[i] == d[i + 1]) {
			c++;
			i++;
		}
		if ((c & 1) == 0)
			ans++;
	}
	if (d[num - 2] != d[num - 1])
		ans++;
	cout << ans << "\n";
	return 0;
}

Measured memory_bytes: 640
# -*- coding: utf-8 -*-
 
## Library
 
import sys
from fractions import gcd
import math
from math import ceil,floor
import collections
from collections import Counter
import itertools
import copy
 
## input
 
# N=int(input())
# A,B,C,D=map(int, input().split())
# S = input()
# yoko = list(map(int, input().split()))
# tate = [int(input()) for _ in range(N)]
# N, M = map(int,input().split()) 
#    P = [list(map(int,input().split())) for i in range(M)]
#    S = []
#    for _ in range(N):
#        S.append(list(input()))
 
N=int(input())

for i in range(1,N+1):
    if floor(i*1.08)==N:
        print(i)
        sys.exit()
print(":(")

Measured memory_bytes: 77828
#include <iostream>

using namespace std;


#define PRIMENUM 200100

//その数は素数かどうか判定する変数
int isPrime[PRIMENUM];

void makePrimeNumber(){

	isPrime[2]=1;
	isPrime[3]=1;

	for(int i=4;i<PRIMENUM;i++){
		int flag=0;
		for(int j=2;j*j<=i;j++){
			if(i%j==0){
				flag=1;
				break;
			}
		}
		if(flag==0){
			isPrime[i]=1;
			//cout<<i<<endl;
		}	
	}

}

//素数列、上の関数を使ってから発動する。
int primeLine[PRIMENUM];

void makePrimeLine(){

	int pos=0;

	for(int i=0;i<PRIMENUM;i++){
		if(isPrime[i]==1){
			primeLine[pos]=i;
			pos++;
		}
	}
}

int main(){

	makePrimeNumber();
	makePrimeLine();

	int m,a,b;

	while(cin>>m>>a>>b){
		if(m==0 && a==0&&b==0)break;

		int maxP=0,maxQ=0;
		for(int i=0;primeLine[i]<=m;i++){
			int nextNum = m/primeLine[i];
			//cout<<"p="<<primeLine[i];
			for(int j=nextNum;j>=0;j--){
				int flag=0;
				if(primeLine[i]>j)break;
				if(isPrime[j]==1){
				//	cout<<"q="<<j<<endl;
					if(j*primeLine[i]<=m && maxP*maxQ <= j*primeLine[i] && j>=primeLine[i] && a*j<=primeLine[i]*b){
						maxP = primeLine[i];
						maxQ = j;
						//cout<<"unko"<<endl;
						flag=1;
					}
				}
				if(flag==1)break;
			}
		}
	//	cout<<endl;

		cout<<maxP<<" "<<maxQ<<endl;
	}

	return 0;
}

Measured memory_bytes: 2016
#include <stdio.h>

int main(void)
{
	int t, n, s, f, tts;
	int i;

	while (1) {
		scanf("%d", &t);
		if (t == 0)
			break;
		tts = 0;
		scanf("%d", &n);
		for (i = 0; i < n; i++) {
			scanf("%d%d", &s, &f);
			tts += f - s;
		}
		if (tts < t)
			printf("%d\n", t - tts);
		else
			puts("OK");
	}
	return 0;
}

Measured memory_bytes: 612
"use strict";
const Main = (input) => {
	let xs = input.trim().split(',').toString();
    let A = Number(xs[0] + xs[1]);
    let B = Number(xs[2] + xs[3]);
    
    if (1 <= A && A <= 12 && 1 <= B && B <= 12) {
    	console.log("AMBIGUOUS");
    } else if (1 <= A && A <= 12 && (B > 12 || B === 0)) {
    	console.log("MMYY");
    } else if ((A > 12 || A === 0) && 1 <= B && B <= 12) {
    	console.log("YYMM");
    } else {
    	console.log("NA");
    }
}
Main(require('fs').readFileSync('/dev/stdin','utf8'));

Measured memory_bytes: 7372
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <tuple>
#include <numeric>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;
const double pi = acos(-1);

int main() {
    ll n, k;
    cin >> n >> k;

    vl v(n);
    rep(i, n) {
        cin >> v[i];
    }

    ll ans = -INF;
    exrep(L, 0, n) {
        exrep(R, 0, n-L) {
            if(L+R > k) {
                continue;
            }
            vl w;
            rep(i, L) {
                w.pb(v[i]);
            }
            for(ll i = n-1; i >= n-R; i--) {
                w.pb(v[i]);
            }
            sort(all(w));
            ll now = 0;
            rep(i, w.size()) {
                if(i < k - (L+R) && w[i] < 0) {
                    continue;
                }
                now += w[i];
            }
            chmax(ans, now);
        }
    }

    out(ans);
    re0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <iterator>
#include <vector>

int main()
{
    int N, K, C;
    std::vector<bool> S;

    std::cin >> N >> K >> C;
    S.reserve(N);
    std::generate_n(std::back_inserter(S), N,
        [] {
            char c;
            std::cin >> c;
            return c == 'o';
        });


    // x日目からで、最大何日働けるのか
    // max_from.at(x)
    std::vector<int> max_from(N + 1);
    max_from.at(N) = 0;


    {
        auto count = 0;
        auto cannot_work_limit = N;

        for (auto date = N - 1; date >= 0; date--) {
            if (date < cannot_work_limit && S.at(date)) {
                count++;
                cannot_work_limit = date - C;
            }

            max_from.at(date) = count;
        }
    }


    {
        auto count = 0;
        auto cannot_work_limit = -1;

        for (auto date = 0; date < N; date++) {
            // std::cout << "without day." << date + 1 << ", can work " << count << " + " << max_from.at(date + 1) << " = " << count + max_from.at(date + 1) << "days" << std::endl;

            if (S.at(date)) {
                if (count + max_from.at(date + 1) < K) {
                    std::cout << date + 1 << std::endl;
                }

                if (cannot_work_limit < date) {
                    count++;
                    cannot_work_limit = date + C;
                }
            }
        }
    }

    return 0;
}


Measured memory_bytes: 2304
use proconio::marker::Chars;
use proconio::{fastout, input};
// use std::cmp::{max, min};

#[fastout]
fn main() {
    input! {
        n: Chars
    };

    for &i in n.iter() {
        if i == '1' {
            print!("9")
        } else {
            print!("1")
        }
    }
}


Measured memory_bytes: 2160
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
#include <cstring>
#include <deque>
#include <iomanip>
#include <limits>
using namespace std;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define CLR(mat) memset(mat, 0, sizeof(mat))
typedef long long ll;
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  string name = "MARCH";
  int N; cin >> N;
  ll cnt[5];
  CLR(cnt);
  FOR(i,0,N) {
    string s; cin >> s;
    FOR(j,0,5) {
      if(name[j] == s[0]) cnt[j]++;
    }
  }
  ll ans = 0;
  FOR(i,0,5) {
    FOR(j,i+1,5) {
      FOR(k,j+1,5) {
        ans += cnt[i] * cnt[j] * cnt[k];
      }
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <algorithm>
#include <numeric>
#include <fstream>
#include <iomanip>

typedef long double ld;
typedef long long ll;
const ll INF = (ll)1e18 + 1;
const ll MOD = 1e9 + 7;

// Split
namespace util {

std::vector< std::string > split(std::string s, char delimiter)
{
  std::vector< std::string > vs;
  std::string sub;
  for (auto c : s) {
    if (c == delimiter) vs.push_back(sub), sub.clear();
    else sub += c;
  }
  vs.push_back(sub);
  return vs;
}

} // namespace util

// Minimum, Maximum
template<class T> T minimum(T head, T tail) { return std::min(head, tail); }
template<class H, class... T> H minimum(H head, T... tail) { return std::min(head, minimum(tail...)); }
template<class T> T maximum(T head, T tail) { return std::max(head, tail); }
template<class H, class... T> H maximum(H head, T... tail) { return std::max(head, maximum(tail...)); }

// Output
template<class T> std::ostream& operator << (std::ostream& os, std::vector< T > v)
{
  for (ll i = 0; i < (ll)v.size(); i++){ os << " [" << i << "]" << v[i]; if (i % 10 == 9) os << std::endl; }
  return os;
}

template<class T, class S> std::ostream& operator << (std::ostream& os, std::vector< std::pair<T, S> > vp)
{
  ll i = 0;
  for (auto p : vp){os << " [" << i++ << "]" << p.first << " " << p.second; if (i % 10 == 0) os << std::endl;}
  return os;
}

void print(){ std::cout << std::endl; }
template<typename H> void print(H head) { std::cout << head << std::endl; }
template<typename H, typename... T> void print(H head, T... tail){ std::cout << head << " ", print(tail...); }

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

  ll N;
  std::cin >> N;

  std::vector<ll> va(N+1, 0LL);
  va[0] = 2;
  va[1] = 1;
  for (ll i = 2; i <= N; i++) {
    va[i] = va[i-1] + va[i-2];
  }
  print(va[N]);

  return 0;
}


Measured memory_bytes: 256
/** 
 *  Author : Parth Prajapati
 * 	Institute : Pandit Deendayal Petroleum University
**/
#include<bits/stdc++.h>

using namespace std; 

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n, i, cnt = 0;
    cin>>n;
    vector<int> a(n);
    for(i=0;i<n;++i)    cin>>a[i];
    for(i=1;i<n-1;++i)
    {
        if((a[i] > a[i-1] && a[i] < a[i+1]) || (a[i] > a[i+1] && a[i] < a[i-1]))    ++cnt;
    }
    cout<<cnt;
    return 0;
}

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

int solve(int next, vector<queue<int>> &q) {
    if (q[next].empty()) return next;
    int nextnext = q[next].front();
    q[next].pop();
    solve(nextnext, q);
}

int main() {
    vector<string> vs(3);
    cin >> vs[0] >> vs[1] >> vs[2];
    vector<queue<int>> q(3);
    rep(i,3) {
        rep(j,vs[i].size()) {
            q[i].push(vs[i][j] - 97);
        }
    }
    char ans = solve(0, q) + 65;
    cout << ans << endl;
}

Measured memory_bytes: 256
import sys, math

readline = sys.stdin.readline

L, R = map(int, readline().split())

P = 2019
L_ = (L // P) * P

if R < L_ + P:
    m = 100000
    for i in range(L, R):
        for j in range(i + 1, R + 1):
            m = min(m, (i * j) % P)
    print(m)
else:
    print(0)

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

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

using ll = long long;
using P = pair<ll,ll>;
using grid = vector<vector<int>>;

const int dx[2] = {1, 0};
const int dy[2] = {0, 1};
const int INF = 1<<30;
const ll mod = 998244353LL;

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

int main() {
    ll N,K;
    cin>>N>>K;
    vector<P> v(N);
    rep(i,N) cin>>v[i].first>>v[i].second;
    sort(v.begin(),v.end());
    ll p = 0;
    rep(i,N){
        if(p+v[i].second>=K) {
            cout<<v[i].first<<endl;
            break;
        } 
        p += v[i].second;
    }
}

Measured memory_bytes: 4820
#include<stdio.h>

int euc(int a,int b){
  if(a<b){
    return euc(b,a);
  }
  else{
    int n=a%b;
    if(n==0){
      return b;
    }
    else{
      return euc(n,b);
    }
  }
}

void dvsr(int i,int n){
  if(i<=n){
    if(n%i==0){
      printf("%d\n",i);
    }
    dvsr(i+1,n);
  }
}

void doit(){
  int n;
  int a,b;
  scanf("%d",&n);
  if(n==2){
    scanf("%d %d",&a,&b);
    dvsr(1,euc(a,b));
  }
  else{
    int c;
    scanf("%d %d %d",&a,&b,&c);
    {
      int t=euc(a,b);
      dvsr(1,euc(t,c));
    }
  }
}

int main(){
  doit();
  return 0;
}

Measured memory_bytes: 596
// Author: HarshKumar

#include <bits/stdc++.h>
using namespace std;
#define ll int64_t
const ll N = 1e6 + 6, M = 1e9 + 7;
int main()
{
    ios::sync_with_stdio(false), cin.tie(nullptr);
    ll n, a, s = 0, m = 0;
    cin >> n;
    while (n--)
        cin >> a, s += a, m = max(a, m);
    cout << s - m / 2;
    return 0;
}

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

int main(){
    long long a, b, k;cin>>a>>b>>k;
    for (int i=0;i<k;i++){
        if (i % 2 == 0){
            if (a % 2 == 1){
                a -= 1;
            }
            a /= 2;
            b += a;
        } else {
            if (b % 2 == 1){
                b -= 1;
            }
            b /= 2;
            a += b;

        }
    }
    cout << a << " " << b <<endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
int main(void)
{
	char str1[300], str2[200], str3[300];
	
	
	scanf("%s", str1);
	scanf("%s", str2);
	
	strcpy(str3,str1);
	
	strcat(str1, str3);
	
	if ( strstr(str1, str2) == NULL ) printf("No\n");
	else printf("Yes\n");
	
	return 0;
}


Measured memory_bytes: 2108
#include <bits/stdc++.h>
using namespace std;
#define fr(i,k,n) for(int i=k;i<n;i++)
#define read(x) cin>>x
#define ll long long int
#define mod 1000000007 
#define print(x) cout<<x<<endl
#define pb(x) push_back(x)
#define fastIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int main() { 
    fastIO;
     int t=1,n;
     //cin>>t;
     while(t--){
       int a,b,c,d;
       cin>>a>>b>>c>>d;
       int ans_of_taka=c%b==0?c/b:(c/b)+1;
        int ans_of_akio=a%d==0?a/d:(a/d)+1;
       if(ans_of_taka<=ans_of_akio)
         cout<<"Yes"<<endl;
       else
         cout<<"No"<<endl;
         
         
     }
	 
	return 0;
}


Measured memory_bytes: 3652
#include <bits/stdc++.h>
// #include <boost/multiprecision/cpp_int.hpp>
// using i128 = boost::multiprecision::int128_t;
#define _GLIBCXX_DEBUG
using namespace std;
using ll = long long;
using ld = long double;
using V = vector<int>;
using Vll = vector<ll>;
using Vld = vector<ld>;
using Vbo = vector<bool>;
using VV = vector<V>;
using VVll = vector<Vll>;
using VVld = vector<Vld>;
using VVbo = vector<Vbo>;
using VVV = vector<VV>;
using VVVll = vector<VVll>;
using P = pair<int, int>;
using Pll = pair<ll, ll>;
using Pld = pair<ld, ld>;
#define rep2(i, m, n) for(ll i=int(m); i<int(n); ++i)
#define drep2(i, m, n) for(ll i=int(m)-1; i>=int(n); --i)
#define rep(i, n) rep2(i, 0, n)
#define drep(i, n) drep2(i, n, 0)
#define all(a) a.begin(), a.end()
struct fast_ios { fast_ios(){ cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
template<typename T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }
template<typename T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }
template<typename T1, typename T2> istream &operator>>(istream &is, pair<T1, T2> &p) { is >> p.first >> p.second; return is; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
template<typename T> istream &operator>>(istream &is, vector<T> &v) { for (auto &e : v) is >> e; return is; }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &v) { for (auto &e : v) os << e << " "; return os; }
template<typename T> inline int count_between(vector<T> &a, T l, T r) { return lower_bound(all(a), r) - lower_bound(all(a), l); } // [l, r)
inline int Log2(ll x) { int k; for (k = 0; x > 0; ++k) x >>= 1; return k; } // number of binary digits
const int INF  = 1<<30;
const ll INFll = 1ll<<62;
const ld EPS   = 1e-10;
const ld PI    = acos(-1.0);
const int MOD  = int(1e9)+7;
// const int MOD  = 998244353;


int main() {
  int n; cin >> n;
  V a(3*n); cin >> a;
  sort(all(a), greater<int>());

  ll ans = 0;
  rep(i, n) ans += a[2*i+1];
  cout << ans << "\n";
  return 0;
}


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

#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
#define LL long long
#define pii pair <int,int>
#define fi first
#define se second
#define pb push_back
#define mpr make_pair

using namespace std;

const LL MOD=1e9+7;

int n,m,dist[110][110];
string s[110];
vector <pii> v;

bool cmp(pii x,pii y)
{
	return x.fi+x.se<y.fi+y.se;
}

int main()
{
	cin>>n>>m;
	rep(i,n) cin>>s[i];
	rep(i,n) rep(j,m) if(i>0||j>0) v.pb(mpr(i,j));
	sort(v.begin(),v.end(),cmp);
	dist[0][0]=(s[0][0]=='#');
	rep(i,v.size())
	{
		dist[v[i].fi][v[i].se]=1e9;
		if(v[i].fi>0) dist[v[i].fi][v[i].se]=min(dist[v[i].fi][v[i].se],
		dist[v[i].fi-1][v[i].se]+(s[v[i].fi-1][v[i].se]=='.'&&s[v[i].fi][v[i].se]=='#'));
		if(v[i].se>0) dist[v[i].fi][v[i].se]=min(dist[v[i].fi][v[i].se],
		dist[v[i].fi][v[i].se-1]+(s[v[i].fi][v[i].se-1]=='.'&&s[v[i].fi][v[i].se]=='#'));
	}
	cout<<dist[n-1][m-1]<<endl;
	return 0;
}

Measured memory_bytes: 512
from collections import Counter
n=int(input())
a=list(map(int,input().split()))
a.sort(reverse=True)
c=Counter(a)
ans=0
for i in a:
  if c[i]==0:
    continue
  pt=2**len(format(i,'b'))
  c[i]-=1
  if c[pt-i]>=1:
    ans+=1
    c[pt-i]-=1
print(ans)


Measured memory_bytes: 33288
import qualified Data.Text as T
import qualified Data.Text.IO as T
import qualified Data.Text.Read as T

main :: IO ()
main = do
  (n : k : _) <- map unsafeSignedDecimal . T.words <$> T.getLine :: IO [Int]
  print (n - k + 1)

unsafeSignedDecimal :: T.Text -> Int
unsafeSignedDecimal s = case T.signed T.decimal s of
  Right (n, _) -> n


Measured memory_bytes: 508
def main():
    N, Y = map(int, input().split())
    r, s, t = (-1, -1, -1)
    for R in range(Y//10**4 + 1):
        temp = Y - 9000 * R - 1000 * N
        if temp % 4000 == 0 and temp >= 0 and N - R - temp // 4000 >= 0:
            r = R
            s = temp // 4000
            t = N - s - r
    print(r, s, t)

if __name__ == "__main__":
    main()

Measured memory_bytes: 3064
n = int(input())
road = [list(input().split()) for i in range(2)]
max_ame = 0

for i in range(n):
    ue = 0
    sita = 0
    for k in range(0,i+1):
        ue += int(road[0][k])
    for k in range(i,n):
        sita += int(road[1][k])
    ame = ue + sita
    if ame > max_ame:
        max_ame = ame

print(max_ame)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
// #define debug(a) cout << "["; rep(i,a.size()) cout << a[i] << ", "; cout<<"]"<< endl;

const ll mod = 1000000007;

int main() {
    int x,y,z;
    cin >> x >> y >> z;
    cout << z << " " << x << " " << y << endl;
    return 0;
}

Measured memory_bytes: 3648
#include <stdio.h>
int cal (int [100], int b[100], int m);

int main () {
    int n, m;
    int a[100][100];
    int b[100];
    int d;
    scanf("%d %d", &n, &m);
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            scanf("%d", &d);
            a[i][j] = d;
        }
    }
    for (int i = 0; i < m; i++) {
        scanf("%d", &d);
        b[i] = d;
    }
    
    for (int i = 0; i < n; i++) {
        printf("%d\n",cal(a[i],b,m));
    }
    return 0;
}

int cal (int a[100], int b[100], int m) {
    int sum = 0;
    for (int j = 0; j < m; j++) {
        sum += a[j] * b[j];
    }
    return sum;
}



Measured memory_bytes: 2112
#include <iostream>
#include <cstdlib>
 
using namespace std;
// https://qiita.com/Clpsplug/items/81fe12400d4093a8fb5a
 
int main() {
    int N;
    cin >> N;

    for (int i = 1; i < 10; i++) {
        if (N / i < 10 && N % i == 0) {
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
}

Measured memory_bytes: 3132
#include <stdio.h>
#include <string.h> //strcmpに使用

int main(void){
  char str[3];
  scanf("%s", str);
  if(strcmp(str, "SUN") == 0){
    printf("7");
  }else if(strcmp(str, "MON") == 0){
    printf("6");
  }else if(strcmp(str, "TUE") == 0){
    printf("5");
  }else if(strcmp(str, "WED") == 0){
    printf("4");
  }else if(strcmp(str, "THU") == 0){
    printf("3");
  }else if(strcmp(str, "FRI") == 0){
    printf("2");
  }else if(strcmp(str, "SAT") == 0){
    printf("1");
  }
  return 0;
}


Measured memory_bytes: 128
import java.util.*;

public class Main {
    public static void main(String[] args){
    
    Scanner sc = new Scanner(System.in);
	int A = sc.nextInt();
 	int B = sc.nextInt();  
	int C = sc.nextInt();
      if(A==B && A==C){
      System.out.println("No");
    }else if(A!=B && B!=C && C!=A){
		System.out.println("No");
    }else{
		System.out.println("Yes");
    }
}
}

Measured memory_bytes: 22612
import java.util.Scanner;
import java.util.TreeMap;

public class Main {
	public static void main(String[] args){
		int i, q, order;
		String key;
		TreeMap<String, Integer> tm = new TreeMap<String, Integer>();
		try (Scanner sc = new Scanner(System.in)) {
			q = sc.nextInt();
			for(i = 0; i < q; i++) {
				order = sc.nextInt();
				key = sc.next();
				if(order == 0) {
					tm.put(key, sc.nextInt());
				}else if(order == 1) {
					if(tm.get(key) == null) {
						System.out.println(0);
					}else {
						System.out.println(tm.get(key));
					}
				}else {
					tm.remove(key);
				}
			}
		}
	}
}



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

int N, K, ans=1234567890;
int A[101010];

int main(){
    scanf("%d %d", &N, &K);
    for (int i=1; i<=N; i++) scanf("%d", &A[i]);
    sort(A+1, A+N+1);
    for (int i=1; i+K-1<=N; i++) ans = min(ans, A[i+K-1] - A[i]);
    printf("%d\n", ans);
    return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <queue>
#include <map>
#include <algorithm>
#include <vector>
#include <cmath>
#include <numeric>
#include <cstdlib>
#include <cstdio>
#include <ctime>
#include <random>

using namespace std;

int main()
{
    string s;

    cin >> s;

    if(s.length() == 2)
    {
        cout << s << endl;
    }
    else
    {
        reverse(s.begin(), s.end());
        cout << s << endl;
    }

    return 0;
}

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

/* clang-format off */
#define int long long
// #define double long double
struct Fast {Fast() {cin.tie(0); ios::sync_with_stdio(false);}} fast;

template <typename T> inline size_t maxElement(T beginIt, T endIt) { return max_element(beginIt, endIt); }
template <typename T> inline size_t minElement(T beginIt, T endIt) { return min_element(beginIt, endIt); }
template <typename T> inline size_t maxIndex(T beginIt, T endIt) { return distance(beginIt, *max_element(beginIt, endIt)); }
template <typename T> inline size_t minIndex(T beginIt, T endIt) { return distance(beginIt, *min_element(beginIt, endIt)); }
template <typename T> inline int sum(T beginIt, T endIt) { return accumulate(beginIt, endIt, 0); }
template <typename T> inline int mean(T beginIt, T endIt) { return sum(beginIt, endIt) / distance(beginIt, endIt); }
template <typename T> inline void debug(T x) { cerr << x << " " << "(L:" << __LINE__ << ")" << endl; }
/* clang-format on */

signed main(void) {
  /* */
  int num; // num
  num = 0; // count, result
  // num = numeric_limits<int>::min(); // max
  // num = numeric_limits<int>::max(); // min
  // double num; // num
  // num = 0; // count, result
  // num = numeric_limits<double>::min(); // max
  // num = numeric_limits<double>::max(); // min
  int N, M;
  // array<int, 100000> A;
  // array<int, 100000> B;
  string S;
  /* */

  array<pair<int, int>, 100000> A;
  vector<int> B; // Bridge
  cin >> N >> M;
  for (int i = 0; i < M; ++i) {
    int a, b;
    cin >> a >> b;
    A[i] = make_pair(a, b);
  }

  sort(A.begin(), A.begin() + M);

  for (int i = 0; i < M; ++i) {
    int Ai1, Ai2, b;
    Ai1 = A[i].first;
    Ai2 = A[i].second;
    if (Ai1 == Ai2) {
        continue;
    }
    b = Ai1;
    for (int j = i + 1; j < M; ++j) {
      int Aj1, Aj2;
      Aj1 = A[j].first;
      Aj2 = A[j].second;
      if (Aj1 == Aj2) {
        continue;
      }
      // cout << "[" << Aj1 << "," << Aj2 << ")" << endl;
      if (Aj1 <= Ai1 && Ai2 < Aj2) {
        A[j] = make_pair(0,0);
      } else if (Ai1 <= Aj2 && Aj1 < Ai2 && Ai2 <= Aj2) {
        Ai1 = Aj1;
        A[j] = make_pair(0,0);
      } else if (Aj1 <= Ai1 && Ai1 < Aj2 && Aj2 <= Ai2) {
        Ai2 = Aj2;
        A[j] = make_pair(0,0);
      } else if (Ai1 <= Aj1 && Aj1 < Ai2 && Aj2 <= Ai2) {
        Ai1 = Aj1;
        Ai2 = Aj2;
        A[j] = make_pair(0,0);
      }
      // cout << i << "[" << Ai1 << "," << Ai2 << ")" << endl;
    }
    // cout << i << "[" << Ai1 << "," << Ai2 << ")" << endl;
    
    A[i] = make_pair(0,0);
    num += 1;
  }
  
  cout << num << endl;
  // cout << fixed << setprecision(10) << num << endl;
  return 0;
}


Measured memory_bytes: 1792
#include <stdio.h>

#define RESULT_MAX 1000000

char is_sosuu[RESULT_MAX];

void make_sosuu_list(void) {
	int i,j;
	for(i=0;i<RESULT_MAX;i++)is_sosuu[i]=1;
	is_sosuu[0]=is_sosuu[1]=0;
	for(i=2;i<RESULT_MAX;i++) {
		if(is_sosuu[i]) {
			for(j=i+i;j<RESULT_MAX;j+=i)is_sosuu[j]=0;
		}
	}
}

int main(void) {
	int a,d,n;
	int count,now;
	make_sosuu_list();
	while(1) {
		scanf("%d%d%d",&a,&d,&n);
		if(a==0 && d==0 && n==0)break;
		for(count=0,now=a;count<n;now+=d) {
			if(is_sosuu[now])count++;
		}
		printf("%d\n",now-d);
	}
	return 0;
}

Measured memory_bytes: 0
#include <cstdio>
typedef long long lint;
lint max1(lint a, lint b){
return a>b?a:b;}
lint a, b, c;
int main()
{
    scanf("%lld %lld %lld", &a, &b, &c);
    if(a%2ll==0ll||b%2ll==0ll||c%2ll==0ll)
    {
        puts("0");
        return 0;
    }
    else
    {
        lint d = max1(a, max1(b, c));
        if(d==a)printf("%lld\n", b*c);
        else if(d==b)printf("%lld\n", a*c);
        else printf("%lld\n", a*b);
        return 0;
    }
    return 0;
}


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

int main(){
	int a,b;
	while(	cin >> a >> b ){
		int s = a+b;
		int ans = 0;
		while(s){
			ans++;
			s /= 10;
		}
		if( a+b == 0 ) cout << 1 << endl;
		else cout << ans << endl;
	}
}

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define All(V) V.begin(), V.end()
typedef long long int ll;
typedef pair<int, int> P;
const ll MOD = 1e9+7, INF = 1e9;

int main()
{
  ll k, a, b; cin >> k >> a >> b;
  if(b-a <= 2 || a >= k){
    cout << k+1 << endl;
  }
  else{
    ll t = (k-a+1)/2;
    cout << b+(b-a)*(t-1)+(k-a-1) % 2 << endl;
  }
  system("pause");
}

Measured memory_bytes: 504
def sumint(n,num):
    if num==2:
        if n>18: return 0
        else:
            c=0
            for i in range(10):
                if 0<=n-i<10:c+=1
            return c
    ret=0
    for i in range(10):
        ret=ret+sumint(n-i,num-1)
    return ret
while True:
    try:n=int(input())
    except:break
    if n>36:print(0)
    else:
        print(sumint(n,4))

Measured memory_bytes: 7668
import queue
K = int(input())
q = queue.Queue()
count = 0
for i in range(1,10):
  q.put(str(i))
while count < K:
  tmp = q.get()
  count += 1
  if count == K:
    print(tmp)
    break
  if tmp[-1] == '0':
    for k in ['0', '1']:
      q.put(tmp + k)
  elif tmp[-1] == '9':
    for t in ['8', '9']:
      q.put(tmp + t)
  else:
    for c in [str(int(tmp[-1]) - 1),tmp[-1], str(int(tmp[-1]) + 1)]:
      q.put(tmp + c)

    


Measured memory_bytes: 17520
#include <iostream>
#include <cmath>
using namespace std;
typedef long long ll;
int main() {
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  ll A;
  int n = 0;
  int m = 0;
  ll d = 1LL << 60;
  ll ans = 0;
  for (int i=0; i<N; i++) {
    cin >> A;
    if (A > 0) {
      ans += A;
      d = min(d, A);
    } else if (A == 0) {
      m++;
    } else {
      n++;
      A = -A;
      ans += A;
      d = min(d, A);
    }
  }
  if (m > 0 || n % 2 == 0) cout << ans;
  else cout << ans - 2*d << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
     
    using namespace std;
     
    int main (){
      string s;
      cin >> s;
      if(s=="SAT"){
        cout << 1 << endl;
      }
      else if(s=="MON"){
        cout << 6 << endl;
      }
      else if(s=="TUE"){
        cout << 5 << endl;
      }
      else if(s=="WED"){
        cout << 4 << endl;
      }
      else if(s=="THU"){
        cout << 3 << endl;
      }
      else if(s=="FRI"){
        cout << 2 << endl;
      }
      else{
       	cout << 7 << endl; 
      }
      return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<climits>
#include<numeric>
#include<cmath>
#include<cstring>
#include<deque>
#include<map>

#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 FORR(i, m, n) for(int i = m;i >= n;i--)
#define VSORT(v) sort(v.begin(), v.end());
#define VE vector<int>
#define VEP vector<pair<int,int>>
#define llong long long
#define pb(a) push_back(a)
using namespace std;
long long GCD(long long a, long long b) {
	if (b == 0) return a;
	else return GCD(b, a % b);
}

int main() {
	int goods, ticket;
	cin >> goods >> ticket;
	VE price(goods);
	REP(i, goods) {
		cin >> price[i];
	}
	sort(price.begin(), price.end());
	REP(i, ticket) {
		int tmp_price = price[goods - 1] / 2;
		auto itr = lower_bound(price.begin(), price.end(),tmp_price);
		price.insert(itr, tmp_price);
		price.pop_back();
	}
	cout << accumulate(price.begin(), price.end(), static_cast<llong>(0)) << endl;
	return 0;
}


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

int main() {
    int N,M;
    cin >> N >> M  ;
    int A,B,C,D;
    A=1;
    B=100000;
    
    for(int i=1;i<M+1;i++){
        cin>>C>>D;
        A=max(A,C);
        B=min(B,D);
        
    }
    if(B-A>=0){
        cout<<B-A+1<<endl;
    }else{
        cout<<0<<endl;
    }
    
     
    return 0;
}

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

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

using namespace std;

int main(){
	int n,y; scanf("%d%d",&n,&y);

	rep(i,n+1) rep(j,n-i+1) {
		int x=i*1000+j*5000;
		if(x<=y && (y-x)%10000==0 && (y-x)/10000==n-i-j){
			printf("%d %d %d\n",n-i-j,j,i);
			return 0;
		}
	}
	puts("-1 -1 -1");

	return 0;
}


Measured memory_bytes: 256