akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
using namespace std;
int N, D1, D2, D[2];
bool Matrix[605][605];
bool Choosed[605][605];
vector <pair <int, int> > V[2];
vector <pair <int, int> > G[2][605][605];
int cnt;
int Color[2][605][605];
int Nb[4][4];
void precalcV(int ind)
{
    for(int i = 0; i< N * 2; i++)
        for(int j = 0; j < N * 2; j++)
        {
            if(i * i + j * j == D[ind])
            {
                //Matrix[i][j] = 1;
                V[ind].push_back(make_pair(i, j));
            }
        }
}
void buildG(int ind)
{
    for(int i = 0; i < N * 2; i++)
    {
        for(int j = 0; j < N * 2; j++)
        {
            for(int k = 0; k < V[ind].size(); k++)
            {
                int newi = i + V[ind][k].first, newj=  j + V[ind][k].second;
                if(newi >= 0 && newj >= 0 && newi < 2 * N && newj < 2 * N)
                {
                    G[ind][i][j].push_back(make_pair(newi, newj));
                }
                newi = i - V[ind][k].first;
                if(newi >= 0 && newj >= 0 && newi < 2 * N && newj < 2 * N)
                {
                    G[ind][i][j].push_back(make_pair(newi, newj));
                }
                newj = j - V[ind][k].second;
                if(newi >= 0 && newj >= 0 && newi < 2 * N && newj < 2 * N)
                {
                    G[ind][i][j].push_back(make_pair(newi, newj));
                }
                newi = i + V[ind][k].first;
                if(newi >= 0 && newj >= 0 && newi < 2 * N && newj < 2 * N)
                {
                    G[ind][i][j].push_back(make_pair(newi, newj));
                }
            }
        }
    }
}

void precalcColor(int ind, int x, int y, int color)
{
    Color[ind][x][y] = color;
    for(int i = 0; i < G[ind][x][y].size(); i++)
    {
        int xn = G[ind][x][y][i].first, yn = G[ind][x][y][i].second;
        if(Color[ind][xn][yn] == 0)
            precalcColor(ind, xn, yn, 3 - color);
    }
}
int main()
{
    cin >> N >> D[0] >> D[1];
    precalcV(0);
    precalcV(1);
    buildG(0);
    buildG(1);
    for(int i = 0; i < N * 2; i++)
        for(int j = 0; j < N * 2; j++)
        {
            if(Color[0][i][j] == 0)
                precalcColor(0, i, j, 1);
            if(Color[1][i][j] == 0)
                precalcColor(1, i, j, 1);
            Nb[Color[0][i][j]][Color[1][i][j]]++;
        }
    int cnt = 0;
    for(int i = 1; i <= 2; i++)
        for(int j = 1; j <= 2; j++)
            if(Nb[i][j] >= N * N)
            {
                for(int k = 0; k < N * 2; k++)
                    for(int l = 0; l < N * 2; l++)
                    {
                        if(Color[0][k][l] == i && Color[1][k][l] == j && cnt < N * N)
                        {
                            ++cnt;
                            cout << k << " " << l << "\n";
                        }
                    }
                break;
            }
    return 0;
}


Measured memory_bytes: 184704
#include"bits/stdc++.h"
using namespace std;

#define ll long long int
#define f(i,x,n)  for(int i=x;i<n;i++)
#define FASTIO cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(false);
#define sz(a) int((a).size())
#define mod 1000000007
#define inf LLONG_MAX
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
template <typename T>
inline T gcd(T a, T b) { while (b != 0) swap(b, a %= b); return a; }

template <typename T>
inline void seethis(vector<T>vect)
{
    for(T x:vect)
        cout<<x<<" ";
    cout<<"\n";
}

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cerr << *it << " = " << a << endl;
    err(++it, args...);
}
//LCM
int lcm(int a, int b) {  return a * (b / gcd(a, b)); }

//For sort by second
bool cmp(const pair<int,int> &a)
{ return a.first<a.second; }

//Tree
/* const int MAXN = 1e5 + 5;
vector<ll> adj[MAXN];*/

//ModPower
ll modpower(ll a,ll b,ll c)
{
    ll res=1;
    while(b)
    {
        if(b&1LL)
            res=(res*a)%c;
        a=(a*a)%c;
        b>>=1;
    }
    return res;
}

int main()
{
    FASTIO;
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    ll n;
     cin>>n;
     
     ll ans=modpower(10ll,n,mod);
     ll temp2=modpower(8ll,n,mod);
     ll temp3=modpower(9ll,n,mod);

     ll res= (ans%mod + temp2%mod)%mod;

     res= (res-2*temp3%mod + mod)%mod;

     cout<<res<<"\n";


    
    return 0;
}

Measured memory_bytes: 3648
import java.util.Scanner;

public class Main {
	private static Scanner sc=new Scanner(System.in);
	public static void main(String args[]){
		while(true){
			int n=sc.nextInt();
			int x=sc.nextInt();
			if(n==0&&x==0) break;
			System.out.println(challenge(n,x));
		}
	}
	private static int challenge(int n,int x){
		int ways=0;
		for(int i=1;i<=n;i++){
			for(int j=i+1;j<=n;j++){
				for(int k=j+1;k<=n;k++){
					if(x==i+j+k) ways++;
				}
			}
		}
		return ways;
	}
}

Measured memory_bytes: 26552
/*
ID: rajiv
TASK: test
LANG: C++14
*/
#include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<unordered_map>
#include<unordered_set>
#include<string>
#include<queue>
#include<stack>
#include<iomanip>
#include<sstream>
#include<iterator>
#include<random>
#include<chrono>

#define fast_io ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define ONLINE_JUDGE

using namespace std;

#define deb(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) { cout << '\n';}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cout << '[' << *it << " = " << a << "]  ";
    err(++it, args...);
}
mt19937 rng((unsigned int) chrono::steady_clock::now().time_since_epoch().count());
int rnd(int a, int b){ // including a and b
	return a+(rng()%(b-a+1));
}
#define fcout cout<<fixed<<setprecision(15)
#define repp(i,j,k) for(int i=j; i<k; ++i)
#define rep(i,j) repp(i,0,j)
#define rrep(i,j,k) for(int i=j; i>=k; --i)
#define all(x) (x).begin(), (x).end()
#define sortr(x) sort(x.begin(), x.end())
#define lb(x,val) lower_bound(x.begin(), x.end(), val)
#define ub(x,val) upper_bound(x.begin(), x.end(), val)
#define pb push_back
#define endl '\n'

typedef long long int lli;
typedef pair<int,int> pii;
typedef pair<lli,lli> pll;
typedef vector<int> vi;
typedef vector<lli> vl;
typedef tuple<lli, lli> tii;
typedef tuple<lli, lli, lli> tiii;

//const lli M=998244353ll;
const lli M=1000000007ll;
const double D=1.0;

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

void solve(){
	char c; cin>>c;
	if(c<='z' and c>='a') cout<<'a';
	else cout<<'A';
	cout<<endl;	
}

int main(){
	fast_io
	#ifndef ONLINE_JUDGE
	freopen("test.in", "r", stdin);
	freopen("test.out", "w", stdout);
	#endif 
	int tc=1;
	//cin>>tc;
	while(tc--){solve();}
	return 0;
}

Measured memory_bytes: 3644
from collections import defaultdict as dd
N, K = map(int, input().split())
a = list(map(int, input().split()))
b = [val-1 for val in a]
c = [0]*(N+1)
for i,val in enumerate(a):
    c[i+1] = (c[i] + val-1)%K

dic = dd(int)
K2 = min(N,K-1)
right = K2
for k,val in enumerate(c[1:K2+1]):
    dic[val] += 1
res = 0
# 左端を動かしていく
prev = 0
for val in c[1:]:
    tgt = prev
    res += dic[tgt]
    if right!=N:
        right += 1
        dic[c[right]] += 1
    dic[val] = max(0,dic[val]-1)
    prev = val
print(res)

Measured memory_bytes: 50536
/**
 *   author: malviyanshiv
 *   created: 01 February 2019  11:39:26
**/

#include <bits/stdc++.h>

using namespace std;

#define REP(i, a, b) for(int i = a; i < b; i++)
#define RREP(i, a, b) for(int i = a-1; i >= b; i--)

#define FORE(a) for(auto ele : a )
#define PB push_back
#define MP make_pair
#define MOD 1000000007
#define INF 0x7fffffff
#define F first
#define S second
#define TC int t; cin >> t; while(t--)
#define ALL(a) begin(a), end(a)

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


void optimizeIO(){
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL);
}

int main(){
    optimizeIO();

    ll n, w, v;
    vector<ll> dp(100005, 0);
    vector<ll> vi(105), wi(105);
    cin >> n >> w;
    REP(i, 0, n)
        cin >> wi[i] >> vi[i];
    REP(i, 0, n){
        RREP(j, w+1, 0){
            if( wi[i] <= j )
                dp[j] = max(dp[j], dp[j-wi[i]] + vi[i]);
            else
                break;
        }
    }
    cout << dp[w] << endl;
    
    return 0;
}

Measured memory_bytes: 1024
//auto 関数名 = [(&:ラムダ外の引数をとる時))](引数の型1 引数名1, 引数の型2, 引数名2, ...) { 関数の処理 }; //inside main() define function. take care of };
// for (int tmp = 0; tmp < (1 << ビット数); tmp++) {
//   bitset<ビット数> s(tmp);
//   // (ビット列sに対する処理)
// }
// sort(配列変数.begin(), 配列変数.end());
// do {
//   // 順列に対する処理
// } while (next_permutation(配列変数.begin(), 配列変数.end()));
//const double PI = acos(-1); M_PI
// cout << fixed << setprecision(10);
// set<int>st{ 3,1,4,1,5,9,2,6,5,3,5 };
//     for (auto itr = st.begin(); itr != st.end(); ++itr) {
//         cout << *itr;
//     }
#include <bits/stdc++.h>
#include <regex>
using namespace std;
using ll = long long;
using P = pair<int,int>;
#define _GLIBCXX_DEBUG 
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end() //sort(all(vec)); ,reverse(all(vec));etc
int main(){
    int n;
    cin>>n;
    vector<int>a(n);
    int min=1000000000;
    int max=0;
    rep(i,n){
        cin>>a.at(i);
        if(min>a.at(i)){
            min=a.at(i);
        }
        if(max<a.at(i)){
            max=a.at(i);
        }
    }
    cout<<max-min<<endl;
}

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

    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int m = sc.nextInt();

    int area = 0;

    if (n == m) {
      area = (n - 1) * (n - 1);
    } else if (n < m){
      area = ((n - 1) * (n - 1)) + ((m - n) * (n - 1));
      System.out.println();
    } else {
      area = ((m - 1) * (m - 1)) + ((n - m) * (m - 1));
    }

    System.out.println(area);

  }
}

Measured memory_bytes: 21844
(stdin => {
  // Define Function
  // Declare Variable
  const inputs = stdin.toString().trim().split(' ')
  const a = parseInt(inputs[0], 10)
  const b = parseInt(inputs[1], 10)
  const Comp = function (a, b) {
    if (a < b) {
      return 'a < b'
    } else if (a > b) {
      return 'a > b'
    } else {
      return 'a == b'
    }
  }
  console.log(Comp(a, b))
})(require('fs').readFileSync('/dev/stdin', 'utf8'))


Measured memory_bytes: 15104
a = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(a[int(input()) - 1])


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

typedef long long int ll;

#define endl '\n'

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

    ll n,k;
    cin>>n>>k;

    if(k==1){
        cout<<0<<endl;return 0;
    }

    cout<<abs(n-k)<<endl;

}


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

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

	vector<int> a( N );
	for( auto& v: a ) { cin >> v; }

	int cost_min = INT_MAX;

	for( int i = -100; i <= 100; ++i ) {
		int c = 0;

		for( int j = 0; j < N; ++j ) {
			int x = abs( a.at( j ) - i );
			c += x*x;
		}

		cost_min = min( cost_min, c );
	}

	cout << cost_min << endl;
}


Measured memory_bytes: 256
ww = [0, 48.0, 51.0, 54.0, 57.0, 60.0, 64.0, 69.0, 75.0, 81.0, 91.0, 200.0]
c = ["light fly", "fly", "bantam", "feather", "light", "light welter", "welter", "light middle", "middle", "light heavy", "heavy"]

while True:
  try:
    w = float(input())
  except:
    break
  for i in range(12):
    if w <= ww[i]:
      break
  i -= 1
  print(c[i])


Measured memory_bytes: 5576
/*{{{*/
#include <bits/stdc++.h>
#ifdef DBG
int c_;
#define cout (c_?cerr:cout)
#define dbg(...) {if(!c_)cerr<<"\033[96;1m";++c_;\
__VA_ARGS__;--c_;if(!c_)cerr<<"\033[96;1m";}
#else
#define dbg(...)
#endif
#define st first
#define nd second
#define dprt(...) dbg(prt(__VA_ARGS__))
#define dmp(...) dprt(#__VA_ARGS__, __VA_ARGS__)
#define drprt(...) dbg(rprt(__VA_ARGS__))
#define all(...) (__VA_ARGS__).begin(), (__VA_ARGS__).end()
#define rdmp(...) dbg(cerr<<#__VA_ARGS__<<": ";rprt(__VA_ARGS__))
using namespace std; using ll = long long;
template< typename t > using V = vector< t >;
template< typename t > void prt(const t& a){cout<<a<<'\n';}
template< typename t, typename... v > void prt(const t& a, v&&... b)
{cout<<a<<' ';prt(b...);}
template< typename t > void rprt(t a, const t& b){while(a!=b)cout<<(*a++)<<' ';cout << '\n';}
/*}}}*/



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

    V< ll > tb(3);
    for (ll& i : tb) cin >> i;

    sort(all(tb));

    ll res = LLONG_MAX;
    do
    {
        res = min(res, (tb[0] % 2? tb[1] * tb[2] : 0));
    } while (next_permutation(all(tb)));

    prt(res);
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){
  int A, B, C;
  int max;
  int buf;

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

  max = 10*A + B + C;

  buf = A + 10*B + C;
  if(buf > max){
    max = buf;
  }

  buf = A + B + 10*C;
  if(buf > max){
    max = buf;
  }

  printf("%d\n", max);
  return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define INF 1e9
#define PI 3.14159265359
#define MOD 1000000007
#define ALL(v) v.begin(),v.end()
#define ALLR(v) v.rbegin(),v.rend()
typedef long long ll;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
//isPrime
//modpow modinv
//getDigit
int main() {
  cout << fixed << setprecision(10);
  int n,l;
  cin >> n >> l;
  vector<string> s(n);
  rep(i,n) cin >> s.at(i);
  sort(ALL(s));
  rep(i,n) cout << s.at(i);
  cout << endl;
}


Measured memory_bytes: 256
using System;

namespace AOJ
{
    class Program
    {
        static void Main(string[] args)
        {

            while(true)
            {
                var read = Console.ReadLine();
                var temp_string = read.Split(' ');
                int a = int.Parse(temp_string[0]), b = int.Parse(temp_string[1]);
                
                if(a==0&&b==0)
                {
                    break;
                }

                if (a > b)
                {
                    int temp = a;
                    a = b;
                    b = temp;
                }
                Console.WriteLine(a+" "+b);
            }
        }
    }
}

Measured memory_bytes: 9276
#include<bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
typedef long long ll;
#define pb push_back
#define fi first
#define se second
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
template <class T, class U> ostream &operator<<(ostream &os, const pair<T, U> &p){os<<"("<<p.first<<","<< p.second<<")";return os;}
template <class T> ostream &operator<<(ostream &os, const vector<T> &v){os<<"{";REP(i,(int)v.size()){if(i)os<<",";os<<v[i];}os<<"}";return os;}
template <typename T, size_t S> void printArray(const T (&array)[S]){for(auto val : array)std::cout << val << ", ";std::cout << "\n";}
void Yes() {cout << "Yes" << endl;}
void No() {cout << "No" << endl;}
void YES() {cout << "YES" << endl;}
void NO() {cout << "NO" << endl;}
const double PI=acos(-1);
const ll MOD = 1000000007;
using Graph = vector<vector<int>>;
//const int dx[4] = {1, 0, -1, 0};
//const int dy[4] = {0, 1, 0, -1};
//const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
//const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

void solve(){
    ll n; cin >> n;
    vector<ll> a(3*n);
    REP(i, 3*n) cin >> a[i];
    sort(RALL(a));
    ll res = 0;
    ll cnt = 0;
    for(int i=0; i<3*n; i++){
        if(i%2 != 0){
            res += a[i];
            cnt++;
        }
        if(cnt == n) break;
    }
    cout << res << endl;
}

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

Measured memory_bytes: 2560
#include<algorithm>
#include<iostream>
#include<functional>
#include<cmath>
#include<iomanip>
using namespace std;
int main(){
  int n,x=0,ans,bb=0;
  string aa;
  cin>>n>>aa;
  for(int i=0;i<n;i++){
    if(aa[i]=='D')
      x--;
    else{
      x++;
    }
    ans=max(x,bb);
    if(x>bb)
      bb=x;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
// abc165_b
#include <bits/stdc++.h>
#ifdef LOCAL
#include "../cxx-prettyprint/prettyprint.hpp"
#endif
using namespace std;

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

#define REP(i, n) for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define REPN(i, m, n) for (int (i) = m ; (i) < (int)(n) ; ++(i))
#define REP_REV(i, n) for (int (i) = (int)(n) - 1 ; (i) >= 0 ; --(i))
#define REPN_REV(i, m, n) for (int (i) = (int)(n) - 1 ; (i) >= m ; --(i))
#define ALL(x) x.begin(), x.end()

#define INF ((1 << 29)-1)
#define MOD (1000000007)

#define print2D(h, w, arr) REP(i, h) { REP(j, w) cout << arr[i][j] << " "; cout << endl; }
#define print_line(vec, n) {for(int i=0;i<(n-1);i++) cout << (vec)[i] << " "; cout << (vec)[(n)-1] << endl;}
template<class T> void print(const T& x){cout << x << endl;}
template<class T, class... A> void print(const T& first, const A&... rest) { cout << first << " "; print(rest...); }
struct PreMain {PreMain(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(20);}} premain;

int main() {
#ifdef LOCAL
    ifstream in("../arg.txt"); cin.rdbuf(in.rdbuf());
#endif

    long double X;
    cin >> X;

    int cnt = 0;
    ll x = 100;
    while ((ll)(x * 1.01) < X){
        x = (ll)(x * 1.01);
        cnt++;
    }

    print(cnt+1);

    return 0;
}


Measured memory_bytes: 3740
#include<cstdio>
#include<cstring>
#include<algorithm>

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

using namespace std;

int main(){
	int T; scanf("%d",&T);
	while(T--){
		char s[1024],t[1024]; scanf("%s%s",s,t);
		int m=strlen(s),n=strlen(t);

		int a[1024]={},b[1024]={};
		rep(i,m) a[i]=s[m-i-1]-'0';
		rep(i,n) b[i]=t[n-i-1]-'0';

		m=max(m,n);
		int c[1024]={};
		rep(i,m){
			int tmp=a[i]+b[i]+c[i];
			c[i]=tmp%10;
			c[i+1]+=tmp/10;
		}
		if(c[m]!=0) m++;

		if(m>80) puts("overflow");
		else{
			rep(i,m) putchar(c[m-i-1]+'0');
			puts("");
		}
	}

	return 0;
}

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

template<typename T> T gcd(T a, T b) {
    if(!b) return a;
    return gcd(b, a % b);
}
template<typename T> T lcm(T a, T b) {
    return a * b / gcd(a, b);
}

template<typename T> void chmin(T& a, T b) { a = (a > b) ? b : a; }
template<typename T> void chmax(T& a, T b) { a = (a < b) ? b : a; }
int in() { int x; scanf("%d", &x); return x; }

using namespace std;

typedef long long Int;
typedef unsigned long long uInt;
typedef unsigned uint;

const int MAXN = 100005;

int N;
int P[MAXN];

int main(void) {
    cin >> N;

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

    int ans = 0;
    
    for (int i = 1; i <= N; i++) {
        if (P[P[i]] == i) {
            ans += 1;
        }
    }
    
    cout << ans / 2 << endl;
    return 0;
}


Measured memory_bytes: 640
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ld long double
#define al(a) (a).begin(),(a).end()
#define mk make_pair
#define check cout<<"?"<<endl;

ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;

int main() {
    ll n,m; cin>>n>>m;
    vector<vector<ll>> a(8,vector<ll>(n,0));
    rep(i,n){
        vector<ll> xyz(3,0);
        rep(j,3) cin>>xyz[j];
        rep(j,8){
            rep(k,3){
                if(j&(1<<k)) a[j][i]+=xyz[k];
                else a[j][i]-=xyz[k];
            }
        }
    }
    rep(i,8){
        sort(al(a[i])); reverse(al(a[i]));
    }
    ll ans=0;
    rep(i,8){
        ll cnt=0;
        rep(j,m){
            cnt+=a[i][j];
        }
        ans=max(ans,cnt);
    }
    cout<<ans<<endl;
}

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

#define pb push_back
#define all(c) c.begin(),c.end()
#define allr(c) c.rbegin(),c.rend()
#define MOD 1000000007
#define PI 3.14159265
#define endl '\n'
#define MAX 501

using namespace std;

void quick ()
{
    cin.tie(0);
    cout.tie(0);
    ios_base::sync_with_stdio(0);/*//*/
}

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

int diva (int n)
{
    int counter = 0;
    for (int i = 1 ; i <= n ; i++)
    {
        if (n%i==0)
            counter++;
    }
    return counter;
}

void readFromText()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
#endif // ONLINE_JUDGE
}

int main()
{
    quick();
//    readFromText();
    string s;  cin >> s;
	for (int i = 0;i < s.size()-1;i++) {
		if (s[i] == s[i + 1]) {
			cout << i + 1 << " " << i + 2 << endl;
			return 0;
		}
	}
	for (int i = 0; i < s.size()-2;i++) {
		if (s[i] == s[i + 2]) {
			cout << i + 1 << " " << i + 3 << endl;
			return 0;
		}
	}
	cout << -1 << " " << -1 << endl;
    return 0;
}


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

int main(void){
    ll x, y, a, b, c;
    cin>>x>>y>>a>>b>>c;
    vector<ll> p(a);
    vector<ll> q(b);
    vector<ll> r(c);
    rep(i, a) cin>>p[i];
    rep(i, b) cin>>q[i];
    rep(i, c) cin>>r[i];
    sort(p.begin(), p.end(), greater<ll>());
    sort(q.begin(), q.end(), greater<ll>());
    sort(r.begin(), r.end(), greater<ll>());
    priority_queue <ll, vector<ll>, greater<ll> > que;
    ll ans=0;
    rep(i, x) {
        que.push(p[i]);
        ans+=p[i];
    }

    rep(i, y) {
        que.push(q[i]);
        ans+=q[i];
    }
    rep(i, c){
        ll s=que.top();
        if(r[i]>=s){
            que.pop();
            que.push(r[i]);
            ans=max(ans, ans+r[i]-s);
        }
        else break;
    }
    cout<<ans<<endl;
    return 0;
}

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

int main(){
	int n, m;
	cin >> n >> m;
	vector<int> a(n);
	int sum = 0;
	rep(i, n){
		cin >> a.at(i);
		sum += a.at(i);
	}

	int cnt = 0;
	rep(i, n){
		if(sum <= a.at(i)*4*m) cnt++;
	}

	if(m <= cnt) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

//1/4*m * sum < a.at(i)


Measured memory_bytes: 3612
//I AM THE CREED
/* //I AM THE CREED
/* package codechef; // don't place package name! */
import java.io.BufferedReader; 
import java.io.IOException; 
import java.io.InputStreamReader; 
import java.util.StringTokenizer; 
import java.util.*;
import java.awt.Point;
public class Main{
    //#include <bits/stdc++. h> 
    public static void main(String[] args) throws IOException 
    { 
  
        Scanner input = new Scanner(System.in);
        while(input.hasNext()){
            int n=input.nextInt();
            long[] l=new long[n];
            for(int i=0;i<n;i++){
                l[i]=input.nextLong();
            }
            long[][] dp=new long[n][n];
            long[] sum=new long[n];
            for(int i=0;i<n;i++){
                if(i==0){
                    sum[i]=l[i];
                    continue;
                }
                sum[i]=sum[i-1]+l[i];
            }
            for(int i=n-1;i>=0;i--){
                for(int j=i;j<n;j++){
                    if(i==j){
                        continue;
                    }
                    if(j==i+1){
                        dp[i][j]=l[i]+l[j];
                        continue;
                    }
                    long min=Long.MAX_VALUE;
                    for(int k=i;k<j;k++){
                        min=Math.min(min, dp[i][k]+dp[k+1][j]+sum[j]-(i==0?0:sum[i-1]));
                    }
                    dp[i][j]=min;
                }
            }
            System.out.println(dp[0][n-1]);
        }
        
    }
    

}

Measured memory_bytes: 39200
import itertools
S=input()
SS=int(S)
N=len(S)
K=int(input())
def base9(n):
    res=""
    while(n>0):
        res=str((n%9)+1)+res
        n=n//9
    return "1"*(K-len(res))+res
ans=0
for seq in itertools.combinations(range(N),K):
    #print(seq,ans)
    low=0
    high=-1+9**K
    tmp=sum([9*10**(seq[i]) for i in range(K)])
    #print(tmp,SS)
    if tmp<=SS:
        ans+=9**K
        continue
    if tmp//9>SS:
        continue
    while(high-low>1):
        mid=(high+low)//2
        tmp2=base9(mid)
        tmp=sum([int(tmp2[i])*10**(seq[-i-1]) for i in range(K)])
        #print(tmp,tmp2,SS,low,mid,high)
        if tmp<=SS:
            low=mid
        else:
            high=mid
    ans+=low+1
print(ans)


Measured memory_bytes: 3064
#include <iostream>

using namespace std;

typedef long long ll;

ll dp[3001][3001][3];

int main() {
	ll n, s, * a,m= 998244353;
	cin >> n >> s;
	a = new ll[n];
	for (int i = 0; i < n; i++)cin >> a[i];
	dp[0][0][0] = 1;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j <= s; j++) {
			dp[i + 1][j][0] += dp[i][j][0];
			dp[i + 1][j][1] += dp[i][j][0] + dp[i][j][1];
			if(j+a[i]<=s)dp[i + 1][j + a[i]][1] += dp[i][j][0] + dp[i][j][1];
			dp[i + 1][j][2] += dp[i][j][0] + dp[i][j][1] + dp[i][j][2];
			if(j+a[i]<=s)dp[i + 1][j + a[i]][2] += dp[i][j][0] + dp[i][j][1];
			dp[i + 1][j][0] %= m;
			dp[i + 1][j][1] %= m;
			dp[i + 1][j][2] %= m;

		}
	}
	cout << dp[n][s][2] << endl;
}


Measured memory_bytes: 211328
#include <bits/stdc++.h>
using namespace std;
#define oo 0x3f3f3f3f
#define ooLL 0x3f3f3f3f3f3f3f3f
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define fastio() ios_base::sync_with_stdio(false); cin.tie(NULL)
const int mod = 1e9+7;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<pair<int,int>> vii;
typedef pair<int,int> pii;

int main(){
    ll x;
    ll A, B;
    scanf("%lld", &x);
    bool neg = false;
    for(A = 0LL; A < 1000 ; ++A){
        bool ok = false;
        for(B = 0LL; B < 1000 ; ++B){
            if(pow(A,5)-pow(B,5LL) == x){
                ok = true;
                break;
            }
            if(pow(A,5LL)- pow(-B,5LL) == x){
                ok = true;
                B = -B;
                break;
            }

        }
        if(ok) break;
    }

    printf("%lld %lld\n", max(A,B), min(A,B));
    return 0;
}

Measured memory_bytes: 4220
import copy

res_list = []
n = int(input())
for i in range(n):
    name, score = input().split()
    score = int(score)

    res_list.append([name,score,i+1])

res_list.sort(key=lambda x: x[1],reverse=True)
res_list.sort(key=lambda x: x[0],reverse=False)

for i in res_list:
    print(i[2])



Measured memory_bytes: 3444
#include<cstdio>
#include<vector>
#include<algorithm>
#include<queue>
#include<string>
using namespace std;

struct edge{
    int t,from,to;
    edge(int t,int from,int to):
        t(t),from(from),to(to){}
    edge(){}
    bool operator<(const edge &e)const{
        return t<e.t;
    }
};

int N,M;
vector<edge>es;

void solve(){
    bool flag[20000];
    fill_n(flag,N,false);
    flag[0]=true;
    sort(es.begin(),es.end());

    for(int i=0;i<M;i++){
        edge &e=es[i];
        flag[e.to]|=flag[e.from];
    }

    int ans=0;
    for(int i=0;i<N;i++)if(flag[i])ans++;

    printf("%d\n",ans);
}
int main(){
    while(scanf("%d%d",&N,&M),N||M){
        es.clear();
        for(int i=0;i<M;i++){
            int t,from,to;
            scanf("%d%d%d",&t,&from,&to);
            es.push_back(edge(t,from-1,to-1));
        }

        solve();
    }
    return 0;
}

Measured memory_bytes: 1516
#include <stdio.h>          // printf(), fprintf(), scanf()
#include <stdlib.h>         // exit(), free(), strtol()
#include <stdbool.h>
#include <errno.h>          // errno
#ifdef linux
 #include <error.h>         // error()
#endif

#define MAX_N 2000000
#define MAX_V 10001

const char NUL = '\0';
int lineno;
char* linebuff = NULL;
size_t linebuffsize = 0;

int a[MAX_N];
int c[MAX_V] = { 0 };

void
cleanup(int ecode)
{
	if (linebuff)
	{
		free(linebuff);
		linebuff = NULL;
		linebuffsize = 0;
	}

	exit(ecode);
}

bool
readline()
{
	errno = 0;
	if(getline(&linebuff, &linebuffsize, stdin) == -1) // read line
	{
		if(errno == 0)  // EOF?
			return false;

#ifdef linux
		error(0, errno, "Can't read line");
#else
		fprintf(stderr, "Can't read line\n");
#endif
		cleanup(1);
	}

	return true;
}

void
skip_sp(const char** p)
{
	while (**p == ' ')
		(*p)++;
}

int
main(int argc, char** argv)
{
	char* nextp = NULL;
	int t;
	int n;
	int i, j;

	readline();
	lineno = 1;
	const char* s = linebuff;
	n = strtol(s, &nextp, 10);
	s = nextp;

	readline();
	s = linebuff;
	lineno++;

	int max = 0;
	for (i = 0; i < n; ++i)
	{
		skip_sp(&s);
		if (*s == NUL)
			cleanup(0);

		if (*s == '\n')
		{
			if (!readline())
				cleanup(0);

			lineno++;
			s = linebuff;
		}

		t = strtol(s, &nextp, 10);
		s = nextp;

		a[i] = t;
		c[t]++;
		if (t > max)
			max = t;
	}

	const char* sep = "";
	for (i = 0; i <= max; ++i)
	{
		for (j = 0; j < c[i]; ++j)
		{
			printf("%s%d", sep, i);
			sep = " ";
		}
	}

	printf("\n");
	cleanup(0);
	return 0;
}

Measured memory_bytes: 17940
t = [int(input()) for i in range(5)]
import itertools
p = list(itertools.permutations(t))
ans = float('inf')
for d in p:
    time = d[0]
    for i in d[1:]:
        time = -(-time//10)*10
        time += i
    ans = min(ans,time)
print(ans)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define rep(i,a,b) for(ll i=ll(a);i<ll(b);i++)
#define irep(i,a,b) for(ll i=ll(a);i>=ll(b);i--)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
#define pb push_back
#define mp make_pair
#define F .first
#define S .second 
using ll=long long;
using ld=long double;
const ll INF = 1LL<<60;
const ll mod=1e9+7;
using namespace std;
ll GCD(ll a, ll b) { return b ? GCD(b, a%b) : a; }

stack<char> p;
ll s[210000],t[210000];
int main(){
    ll ans=0;
    string x;
    cin>>x;
    rep(i,0,x.size()){
        if(x[i]=='S')p.push('S');
        else{
            if(p.size()==0||p.top()=='T')p.push('T');
            else p.pop();
        }
    }
    cout<<p.size();

}


Measured memory_bytes: 644
a,b = map(int,input().split())
c = [2,3,4,5,6,7,8,9,10,11,12,13,1]
aa = c.index(a)
bb = c.index(b)
if aa > bb:
    print('Alice')
elif aa < bb:
    print('Bob')
else:
    print('Draw')


Measured memory_bytes: 3060
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;

typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;

template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define shandom_ruffle random_shuffle

const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001; //check the limits, dummy

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

    int A, B, C;
    cin >> A >> B >> C;
    int endA = min(A, B+C);
    int trans = endA - B;
    cout << C-trans << endl;

    return 0;
}

// read the question correctly (ll vs int)
// template by bqi343
// license: https://github.com/bqi343/USACO/blob/master/LICENSE

Measured memory_bytes: 256
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <algorithm>
#include <fstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <cstring>
using namespace std;
#define inf 2147480000
string s;
int change(int a)
{
    if(a==1 || a==4 || a==7)
      return 1;
    else if(a==2 || a==8)
      return 2;
    else return 3;
}
int dp[100001][2];
int chan(char a)
{return int(a)-'0';}
int main(int argc, char *argv[])
{
    while(cin>>s)
    {
       if(s=="#") break;
       int front=change(chan(s[0]));
       dp[0][0]=0;dp[0][1]=0;
       for(int i=1;i<s.size();i++)
       {
           int a=chan(s[i]);
           a=change(a);
           if(a>front)
           {
              dp[i][0]=dp[i-1][0]+1;
              dp[i][1]=min(dp[i-1][0],dp[i-1][1]+1);
           }
           else if(a<front)
           {
              dp[i][0]=min(dp[i-1][1],dp[i-1][0]+1);
              dp[i][1]=dp[i-1][1]+1;
           }
           else
           {
              dp[i][0]=min(dp[i-1][1],dp[i-1][0]+1);
              dp[i][1]=min(dp[i-1][0],dp[i-1][1]+1);
           }
           front=a;
       }
       cout<<min(dp[s.size()-1][0],dp[s.size()-1][1])<<endl;
    }
    return 0;
}

Measured memory_bytes: 2092
#include <iostream>
#include <stdio.h>
using namespace std;

int main()
{
   int a,b;
   scanf("%d%d",&a,&b);
   int c1=a+b;
   int c2=a-b;
   int c3=a*b;
   c1=max(c1,c2);
   c1=max(c1,c3);
   printf("%d\n",c1);
    return 0;
}


Measured memory_bytes: 256
/**
*    author:  yuya1234
*    created: 13.07.2020 14:10:26
**/

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define FORV(i,v) for(auto i=v.begin(); i!=v.end();i++)

#define SORT(s) sort((s).begin(),(s).end())
#define SORTD(s) sort((s).rbegin(),(s).rend())
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

#define SZ(x) ((int)(x).size())
#define MEMSET(v, h) memset((v), h, sizeof(v))

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; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  //std::cout << std::fixed << std::setprecision(15);

  int n,c,k;
  cin>>n>>c>>k;

  int t[n];
  REP(i,n)cin>>t[i];
  sort(t,t+n);

  int ans=0,cnt;
  REP(i,n){
    int tt=t[i];
    cnt=0;
    ans++;
    while(cnt!=c-1){
      if(t[i+1]<=tt+k){
        cnt++;
        i++;
      }
      else break; 
    }
  }

  cout<<ans<<endl;

  return 0;
}

Measured memory_bytes: 4044
#include<bits/stdc++.h>
using namespace std;
///Welcome to Nasif's Code
#define bug printf("bug\n");
#define bug2(var) cout<<#var<<" "<<var<<endl;
#define co(q) cout<<q<<endl;
#define all(q) (q).begin(),(q).end()
typedef long long int ll;
typedef unsigned long long int ull;
const int MOD = (int)1e9+7;
const int MAX = 1e6;
#define pi acos(-1)
#define inf 1000000000000000LL
#define FastRead    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
ll fact[MAX];
int main()
{
    FastRead
    //freopen("output.txt", "w", stdout);
    int a,b;
    cin>>a>>b;
    fact[0]=1;
    for(ll i=1; i<MAX; i++)
        fact[i]=(fact[i-1]*i)%MOD;
    if(abs(a-b)>1)
        cout<<"0"<<endl;
    else
    {
        ll ans=(fact[a]*fact[b])%MOD;
        if(a==b)
            ans=(ans*2ll)%MOD;
        cout<<ans<<endl;
    }


    return 0;
}


Measured memory_bytes: 11392
#include<bits/stdc++.h>
using namespace std;
#define gc getchar_unlocked
#define fo(i,n) for(i=0;i<n;i++)
#define foo(i,k,n) for(i=k;k<n?i<n:i>n;k<n?i+=1:i-=1)
#define ll long long
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define PI 3.1415926535897932384626
#define min3(a,b,c)         min(a,min(b,c))
#define max3(a,b,c)         max(a,max(b,c))
#define min4(a,b,c,d)       min(a,min(b,min(c,d)))
#define max4(a,b,c,d)       max(a,max(b,max(c,d)))
#define max5(a,b,c,d,e)     max(max3(a,b,c),max(d,e))
#define min5(a,b,c,d,e)     min(min3(a,b,c),min(d,e))
typedef pair<int, int>  pii;
typedef pair<ll, ll>  pl;
typedef vector<int>   vi;
typedef vector<ll>    vl;
typedef vector<pii>   vpii;
typedef vector<pl>    vpl;
typedef vector<vi>    vvi;
typedef vector<vl>    vvl;
int mpow(int base, int exp); 
void ipgraph(int m);
void DFS(int n);
bool isprime(ll n);
int gcd(int a,int b);
void rstgraph(int n);

const int mod = pow(10,9)+7;
const int N = 3e5, M = N;

//=======================================================================================
vi g[N];
int vis[N];
int nodes=0;

void iluzn() {
int n;
cin>>n;
string s,t;
cin>>s>>t;
int i;
fo(i,n)
  cout<<s[i]<<t[i];

}

 
int main() {
  #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
  #endif
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    int t=1,i;
    // cin>>t;
     while(t--) iluzn();
    return 0;
}
int mpow(int base, int exp) {
  base %= mod;
  int result = 1;
  while (exp > 0) {
    if (exp & 1) result = ((ll)result * base) % mod;
    base = ((ll)base * base) % mod;
    exp >>= 1;
  }
  return result;
}
bool isprime(ll n){
    if(n<=1)
        return false;
    if(n==2)
        return true;
    if(n%2==0)
        return false;
    ll rt = sqrt(n);
    for(ll i=3;i<rt;i+=2){
        if(n%i==0)
            return false;
    }
    return true;
}
int gcd(int a, int b) 
{ 
    if (a == 0) 
        return b; 
    return gcd(b % a, a); 
} 
void ipgraph(int m){
  int u, v;
  while(m--){
    cin>>u>>v;
    g[u].pb(v);
    // g[v].pb(u);
  }
}

void DFS(int n)
{  ++nodes;
    vis[n] = 1;
    for(vector<int>::iterator i = g[n].begin(); i != g[n].end() ; i++)
    {
        if(!vis[*i])
            DFS(*i);
    }
}
void rstgraph(int n){
  int i;
  fo(i,n+1){
    g[i].clear();
    vis[i]=0;
  }
  nodes=0;
}

Measured memory_bytes: 10700
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define fast ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
int main(){
	fast;
	string s; cin>>s;
	if(s[1]=='B') s[1]='R';
	else s[1]='B'; cout<<s<<endl;
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
#include <cassert>
typedef long long int ll;
using namespace std;


bool solve() {
  int N; cin >> N;
  string S; cin >> S;
  if (N % 2 == 1) return false;
  int t = N / 2;
  for (int i = 0; i < t; i++) {
    if (S.at(i) != S.at(t + i)) return false;
  }
  return true;
}

int main(int argc, char *argv[]) {
  // C-style stdio functions should not be used.
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout << setprecision(20);

  cout << (solve() ? "Yes" : "No") << endl;

  return 0;
}



Measured memory_bytes: 256
//https://atcoder.jp/contests/dp/tasks/dp_i

/* UserName - ankit_S
  author -Ankit kumar
*/

#include <bits/stdc++.h>
#include <iostream>
using namespace std;
#define FAST ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ll long long 
const ll int MOD=1e9+7;

int main()
{
    FAST
    int n;
    cin>> n;
    vector<double> p(n);
    for(int i=0;i<n;i++){
    	cin>> p[i];
   	}
    vector<double>dp(n+1,0.0);
    dp[0]=1;
    for(int j=0;j<n;j++){
        for(int i=j+1;i>=0;i--){
            dp[i]=(i==0 ? 0:dp[i-1])*p[j] + dp[i]*(1- p[j]);
            //cout<<dp[i]<<" ";
        }
        
    }
   
    
    double ans=0;
    for(int i=(n+1)/2;i<=n;i++){
        ans+=dp[i];
    }
    cout<<fixed <<setprecision(10)<<ans<<endl;

        
 
    return 0;
}


Measured memory_bytes: 3776
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cmath>
using namespace std;

int main(){
	char s[101],t[101];
	scanf("%s%s",s,t);
	for(int i=0;s[i]!='\0';i++){
		for(int j=0;t[j]!='\0';j++){
			if(s[i]<t[j]){if(i!=j){printf("Yes\n");
			return 0;}
		}
	}
	}
	int y=0;
	for(int p=0;s[p]!='\0'&&t[p]!='\0';p++)
	{
		if(s[p]!=t[p])y=1;
	}
	if(!y){if(strlen(s)<strlen(t))printf("Yes\n");
	else printf("No\n");
	}
	else
	printf("No\n");

	
}



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

#define MAX (123456*2)

int main(){
  bool p[MAX+1];
  memset(p,true,sizeof(p));
  p[0] = p[1] = false;
  for(int i=0;i*i<=MAX;i++){
    if(p[i]){
      for(int j=i+i;j<=MAX;j+=i){
        p[j] = false;
      }
    }
  }

  int n;
  while(cin>>n,n){
    int ans = 0;
    for(int i=n+1;i<=2*n;i++){
      ans += p[i];
    }
    cout<<ans<<endl;
  }
}

Measured memory_bytes: 0
#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <cstring>
#define NILL 2000000010
using namespace std;
struct node{
  node *p, *l,*r;
  int key;
};
node *root;
 
node * mk_node(int key,node *l,node *r,node *p){
  node *n=(node *)malloc(sizeof(node));
  n->key=key;
  n->r=r;
  n->l=l;
  n->p=p;
  return n;
}
 
void insert(node *z){
  node *y=mk_node(NILL,NULL,NULL,NULL);
  node *x=root;
  while(x!=NULL){
    y=x;
    if((z->key)<(x->key)) x=x->l;
    else x=x->r;
  }
  z->p = y;
  if(y->key==NILL)root = z;
  else if(z->key < y->key) y->l=z;
  else y->r=z;
}

void print(node *pos, int flg){
  if(flg)cout <<" "<<pos->key;
  if(pos->l!=NULL)print(pos->l,flg);
  if(!flg)cout <<" "<<pos->key;
  if(pos->r!=NULL)print(pos->r,flg);
}

node * find(node *pos,int key){
  if(pos==NULL)return pos;
  if(pos->key>key) return find(pos->l,key);
  if(pos->key<key) return find(pos->r,key);
  return pos;
} 

node *treeMinimum(node *x){
  while(x->l!=NULL) x=x->l;
  return x;
}

node * treeSuccessor(node *x){
  if(x->r!=NULL) return treeMinimum(x->r);
  
  node *y=x->p;
  while(y!=NULL&&x==y->r)x=y,y=y->p;
  return y; 
}

void del(node *z){
  node *y;
  if(z->l==NULL||z->r==NULL) y = z;
  else y=treeSuccessor(z);

  node *x;
  if(y->l!=NULL) x=y->l;
  else x=y->r;
  
  if(x!=NULL) x->p=y->p;
  if(y->p==NULL) root=x;
  else if (y==y->p->l) y->p->l=x;
  else y->p->r=x;
  if( y!=z) z->key=y->key;
}
 
char str[1000];
int main(){
  root=mk_node(NILL,NULL,NULL,NULL);
  int n;
  cin>>n;

  while(n--){
    node *x=mk_node(NILL,NULL,NULL,NULL);
    int a;
    scanf("%s",str);
    if(str[0]=='i'){
      scanf("%d",&x->key);
      insert(x);
    }
    else if(str[0]=='p'){
      print(root,0);cout <<endl;
      print(root,1);cout <<endl;
    }
    else if(str[0]=='f'){
      cin>>a;
      cout <<(find(root,a)!=NULL? "yes":"no")<<endl;
    }
    else if(str[0]=='d'){
      cin>>a;
      del(find(root,a));
    }
  }
  return 0;
}

Measured memory_bytes: 43436
#include <stdio.h>
 
int main(){
    int h, w, i, j, k, cnt;
    char s[51][51];
    int p[8] = {-1, 0, 1,-1, 1,-1, 0, 1};
    int q[8] = {-1,-1,-1, 0, 0, 1, 1, 1};
 
    scanf("%d %d", &h, &w);
 
    for(i=0; i<h; i++){
        scanf("%s", s[i]);
    }
 
    for(i=0; i<h; i++){
        for(j=0; j<w; j++){
            if(s[i][j] == '#')
                printf("#");
            else{
                cnt=0;
                for(k=0; k<8; k++){
                    if(s[i+q[k]][j+p[k]] == '#')
                        cnt++;
                }
                printf("%d", cnt);
            }
        }
 
        printf("\n");
    }
 
    return 0;
}

Measured memory_bytes: 128
#include <cstdio>
#include <cmath>
#include <iostream>
#include <vector>
using namespace std;

const double EPS = 1.0e-8;

int n;
double xs[311];
double ys[311];

void solve() {
    int maxval = 1;
    for (int i = 0; i < n; i++) {
        for (int j = i + 1; j < n; j++) {
            double dx = xs[i] - xs[j];
            double dy = ys[i] - ys[j];
            if (dx * dx + dy * dy >= 4.0 - EPS) continue;

            double mx = 0.5 * (xs[i] + xs[j]);
            double my = 0.5 * (ys[i] + ys[j]);
            double nx = -(ys[i] - ys[j]);
            double ny = xs[i] - xs[j];
            double nl = sqrt(nx * nx + ny * ny);
            double cl = sqrt(1.0 - 0.25 * nl * nl);
            nx = cl * nx / nl;
            ny = cl * ny / nl;


            int cnt;
            double cx, cy;

            cx = mx + nx;
            cy = my + ny;
            cnt = 0;
            for (int k = 0; k < n; k++) {
                dx = cx - xs[k];
                dy = cy - ys[k];
                if (dx * dx + dy * dy <= 1.0 + EPS) cnt++;
            }
            maxval = max(maxval, cnt);

            cx = mx - nx;
            cy = my - ny;
            cnt = 0;
            for (int k = 0; k < n; k++) {
                dx = cx - xs[k];
                dy = cy - ys[k];
                if (dx * dx + dy * dy <= 1.0 + EPS) cnt++;
            }
            maxval = max(maxval, cnt);
        }
    }
    printf("%d\n", maxval);
}

int main(int argc, char** argv) {
    while (cin >> n) {
        if (n == 0) break;
        for (int i = 0; i < n; i++) {
            cin >> xs[i] >> ys[i];
        }
        solve();
    }
}

Measured memory_bytes: 1220
package main

import (
	"fmt"
	"math"
)

var N int

func main() {
	fmt.Scan(&N)
	m := make(map[string]int, 10)

	for i := 0; i < N; i++ {
		var t int
		fmt.Scan(&t)

		if 1 <= t && t <= 399 {
			m["灰色"]++
		} else if 400 <= t && t <= 799 {
			m["茶色"]++
		} else if 800 <= t && t <= 1199 {
			m["緑色"]++
		} else if 120 <= t && t <= 1599 {
			m["水色"]++
		} else if 1600 <= t && t <= 1999 {
			m["青色"]++
		} else if 2000 <= t && t <= 2399 {
			m["黄色"]++
		} else if 2400 <= t && t <= 2799 {
			m["橙色"]++
		} else if 2800 <= t && t <= 3199 {
			m["赤色"]++
		} else {
			m["王冠"]++
		}
	}

	if m["王冠"] == 0 {
		fmt.Println(len(m), len(m))
	} else {
		if len(m) == 1 && m["王冠"] != 0 {
			fmt.Println(1, m["王冠"])
		} else {
			fmt.Println(len(m)-1, len(m)-1+m["王冠"])
		}
	}
}

/*  ----------------------------------------  */

func gcd(x, y uint64) uint64 {
	if x%y == 0 {
		return y
	} else {
		r := x % y
		return gcd(y, r)
	}
}

func combination(x, y int) int {
	return permutation(x, y) / permutation(y, y)
}

func permutation(x, y int) int {
	var ans int = 1
	for i := x - y; 0 < i; i-- {
		ans *= i
	}
	return ans
}

func max(x ...int) int {
	var res int = x[0]
	for i := 1; i < len(x); i++ {
		res = int(math.Max(float64(x[i]), float64(res)))
	}
	return res
}

func min(x ...int) int {
	var res int = x[0]
	for i := 1; i < len(x); i++ {
		res = int(math.Min(float64(x[i]), float64(res)))
	}
	return res
}

func pow(x, y int) uint64 { return uint64(math.Pow(float64(x), float64(y))) }
func abs(x int) int       { return int(math.Abs(float64(x))) }
func floor(x int) int     { return int(math.Floor(float64(x))) }

type XY struct {
	x int
	y int
}

type SortBy [][]int

func (a SortBy) Len() int      { return len(a) }
func (a SortBy) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
func (a SortBy) Less(i, j int) bool {
	if a[i][0] == a[j][0] {
		return a[i][1] > a[j][1]
	}
	return a[i][0] > a[j][0]
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for (int i=0;i<(n);i++)
//#define int long long  
int main(){
    string s,a,c;
    cin >>a >> s >> c;
    cout << "A" << s[0] << "C" << endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define _ ios_base::sync_with_stdio(0);cin.tie(0);
#define REP(i,n) for(int i=0;i<(int)(n);i++)

using namespace std;
int n,k,s;

int dfs(int nRest,int kRest,int sRest){
  if(kRest==1) return nRest>=sRest?1:0;
  int result=0;
  for(int i=min(nRest,sRest-1);i>1;i--){
    result+=dfs(i-1,kRest-1,sRest-i);
  }
  return result;
}

void solve(){
  cout<<dfs(n,k,s)<<endl;
}

int main(){ _;
  while(cin>>n>>k>>s,(n|k|s)!=0){
    solve();
  }
}

Measured memory_bytes: 1188
import java.util.*;
/*このプログラムには、ひとつがもうひとつを含むような
２つのループ構造があります。まずは goto 文によるループ構造を 
for 文あるいは while 文に置き換えてみましょう。
call は与えられた整数 n について、1 から n
までの数の中で、3 の倍数と 3 が含まれる数を標準出力に出力します。 */
public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        

        int n = sc.nextInt();

        int i;
//      int j;
//３で割り切れる、あるいは１桁が３の数
//３０、３００、３０００ 代の数字             

        for ( i = 1; i <= n; i++ ){
            if (i % 3 == 0 || Integer.toString(i).contains("3")) {            
                 System.out.print(" " + i);
            }
        }System.out.println();
    }
}


Measured memory_bytes: 29176