akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

#define MOD (1000000000+7)
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define all(x) x.begin(), x.end()
#define print(vec,l,r) for(int i = l; i <= r; i++) cout << vec[i] <<" "; cout << endl;
#define forf(i,a,b) for(int i = (a); i < (b); i++)
#define forr(i,a,b) for(int i = (a); i > (b); i--)
#define input(vec,N) for(int i = 0; i < (N); i++) cin >> vec[i];

// template starts
typedef long long int ll;

// template ends here

void solve(){
	// code starts from here
	ll N;
	cin >> N;
	cout << (1000-N%1000)%1000 << endl;
}

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

	int T;
	T = 1;
	while(T--){
		solve();
	}

	return 0;
}


Measured memory_bytes: 3648
N, M = [int(i) for i in input().strip().split(' ')]

a = {}
for i in range(M):
  X, Y, _ = [int(i) for i in input().strip().split(' ')]
  if X not in a: a[X] = set()
  if Y not in a: a[Y] = set()
  a[X].add(Y)
  a[Y].add(X)

len_a = len(a)


def test(key_set):
  tmp = set()
  for key in key_set:
    if key in a:
      tmp = tmp.union(a[key])
      del a[key]

  #print('key_set = {}, tmp = {}'.format(key_set, tmp))
  return tmp


counter = 0
# print(b)

while len(a) > 0:
  #print('---')
  #print('a = {}'.format(a))
  key, key_set = a.popitem()
  #print('key = {}, key_set = {}'.format(key, key_set))
  tmp = test(key_set)
  while len(tmp) > 0:
    tmp = test(tmp)
  #print('a = {}'.format(a))
  counter += 1

print(counter + N - len_a)

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

#define M_PI       3.14159265358979323846   // pi

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> VI;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> t3;
typedef tuple<ll, ll, ll, ll> t4;

#define rep(a,n) for(ll a = 0;a < n;a++)
#define repi(a,b,n) for(ll a = b;a < n;a++)

#include <bits/stdc++.h>
using namespace std;

static const ll INF = 1e15;

static const ll mod = 1e9 + 7;

class Primes {
private:
	vector<int> Prime_Number;
	vector<bool> is_prime_;
public:
	Primes(int N) {
		is_prime_.resize(N + 1, true);
		is_prime_[0] = is_prime_[1] = false;
		for (int i = 0; i < N + 1; i++) {
			if (is_prime_[i]) {
				Prime_Number.push_back(i);
				for (int j = 2 * i; j <= N; j += i) is_prime_[j] = false;
			}
		}
	}
	int operator[](int i) { return Prime_Number[i]; }
	int size() { return Prime_Number.size(); }
	int back() { return Prime_Number.back(); }
	bool isPrime(int q) { return is_prime_[q]; }
};

int main() {
	ll n;
	cin >> n;
	map<ll, ll> vs;
	rep(i, n) {
		int a;
		cin >> a;
		vs[a]++;
	}
	vector<bool> has(1e6+ 10, false);
	ll sum = 0;
	for (auto p : vs) {
		if (p.second > 1) {
			has[p.first] = true;
			continue;
		}
		auto v = p.first;
		bool ok = true;
		for (ll i = 1; i * i <= v; i++) {
			if (v % i == 0) {
				if (has[i] || has[v / i]) {
					ok = false;
					break;
				}
			}
		}
		if (ok) sum++;
		has[v] = true;
	}
	cout << sum << endl;
	return 0;
}
	

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

using namespace std;

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

	if (N % 111 == 0) {
		cout << N << endl;
	}
	else {
		int next = N;
		while (next % 111 != 0) {
			next++;
		}
		cout << next << endl;
	}


	
}


Measured memory_bytes: 3548
#include <iostream>
#include <string>
#include <cstring>
#include <fstream>
#include <random>
#include <cmath>
#include <iomanip>
#include <climits>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <map>
#include <deque>
#include <map>
#include <set>
#include <unordered_set>
#include <queue>
#include <stack>
#include <list>
#include <unordered_map>
#include <bitset>
#include <sstream>
#include <new>
#include <typeinfo>
#include <iterator>

typedef long long ll;
typedef unsigned long long ull;
constexpr ll mop = 1000000007;
constexpr ll mop2 = 998244353;

using namespace std;
template<typename T>
T fastPow(T a, T b, T mod = 0) {
	if (a == 0 and b == 0) {
		return -1;
	}
	if (a == 0) {
		return 0;
	}
	if (b == 0) {
		return 1;
	}
	long long tmp = fastPow(a, b / 2, mod);
	if (mod != 0) {
		if (b % 2 == 0) {
			return (tmp * tmp) % mod;
		}
		else {
			return ((tmp*tmp) % mod * (a % mod)) % mod;
		}
	}
	else {
		if (b % 2 == 0) {
			return (tmp*tmp);
		}
		else {
			return tmp * tmp * a;
		}
	}
}
template <typename T>
T extGCD(T a, T b, T &x, T &y) {
	if (b == 0) {
		x = 1;
		y = 0;
		return a;
	}
	T d = extGCD(b, a%b, y, x); // 再帰的に解く
	y -= a / b * x;
	return d;
}

// 負の数にも対応した mod 
template <typename T>
T modG(T a, T m) {
	return (a % m + m) % m;
}

// 逆元計算 
template <typename T>
T modinv(T a, T m) {
	T x, y;
	extGCD(a, m, x, y);
	return modG(x, m);
}


//typedef unsigned long long ll;
template <typename T>
T nCr(T n, T r, T mod = 0) {
	T ans = 1;
	if (mod == 0) {
		for (T i = 1; i <= r; ++i) {
			ans = ans * (n - i + 1) / i;
		}
	}
	else {
		for (T i = 1; i <= r; i++) {
			ans = modG(ans * (n - i + 1), mod) * modinv(i, mod);
			ans = modG(ans, mod);
			// mod(i, mod)を定義しておくこと
			// modinv(i, mod)を定義しておくこと
		}
	}
	return ans;
}

ll calc(ll i) {
	ll rev = 26 * (i + 1) - i;
	return rev;
}
int main() {
	ll k;
	string s;
	cin >> k >> s;
	ll n = s.length();
	vector<ll> combinations(k + n, 0);
	
	for (ll x = 0; x <= k; x++) {
		if (x == 0) {
			combinations[k - x + n - 1] = nCr(k - x + n - 1, n - 1, mop);
		}
		else {
			combinations[k - x + n - 1] = combinations[k - x + n] * modinv(k - x + n, mop);
			combinations[k - x + n - 1] = modG(combinations[k - x + n - 1], mop);
			combinations[k - x + n - 1] *= (k - x + n) - (n - 1);
			combinations[k - x + n - 1] = modG(combinations[k - x + n - 1], mop);
		}
		//cout << k - x + n - 1 << "C" << n - 1 << " = " << combinations[k - x + n - 1] << endl;
	}


	ll ans = 0;
	for (ll x = 0; x <= k; x++) {
		ll tmp = modG(fastPow(25LL, k - x, mop) * fastPow(26LL, x, mop), mop);
		tmp *= combinations[k - x + n - 1];
		tmp = modG(tmp, mop);
		ans += tmp;
		ans = modG(ans, mop);
		//cout << ans << endl;
	}
	cout << ans << endl;
	
}


Measured memory_bytes: 20008
N, L = map(int, input().split())
S = 0
if (L > 0):
  print(N * (2 * L + N -1) // 2 - L)
elif (L + N - 1 < 0):
  print(N * (2 * L + N -1) // 2 - L - N + 1)
else:
  print(N * (2 * L + N -1) // 2)

Measured memory_bytes: 3060
//{
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double lf;
typedef pair<ll,ll> ii;
#define REP(i,n) for(ll i=0;i<n;i++)
#define REP1(i,n) for(ll i=1;i<=n;i++)
#define FILL(i,n) memset(i,n,sizeof i)
#define X first
#define Y second
#define SZ(_a) (int)_a.size()
#define ALL(_a) _a.begin(),_a.end()
#define pb push_back
#ifdef brian
#define debug(...) do{\
    fprintf(stderr,"%s - %d (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
    _do(__VA_ARGS__);\
}while(0)
template<typename T>void _do(T &&_x){cerr<<_x<<endl;}
template<typename T,typename ...S> void _do(T &&_x,S &&..._t){cerr<<_x<<" ,";_do(_t...);}
template<typename _a,typename _b> ostream& operator << (ostream &_s,const pair<_a,_b> &_p){return _s<<"("<<_p.X<<","<<_p.Y<<")";}
template<typename It> ostream& _OUTC(ostream &_s,It _ita,It _itb)
{
    _s<<"{";
    for(It _it=_ita;_it!=_itb;_it++)
    {
        _s<<(_it==_ita?"":",")<<*_it;
    }
    _s<<"}";
    return _s;
}
template<typename _a> ostream &operator << (ostream &_s,vector<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a> ostream &operator << (ostream &_s,set<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a,typename _b> ostream &operator << (ostream &_s,map<_a,_b> &_c){return _OUTC(_s,ALL(_c));}
template<typename _t> void pary(_t _a,_t _b){_OUTC(cerr,_a,_b);cerr<<endl;}
#define IOS()
#else
#define debug(...)
#define pary(...)
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0);
#endif // brian
//}


const ll MAXn=1e5+5,MAXlg=__lg(MAXn)+2;
const ll MOD=1000000007;
const ll INF=ll(1e15);

ll d[MAXn];

vector<vector<ll> > v;

int main()
{
    IOS();
    for(int i = 2;i * (i-1) / 2 <= 100000;i++)d[i * (i-1) / 2] = i;
    ll N;
    cin>>N;
    if(!d[N])
    {
        cout<<"No"<<endl;
        return 0;
    }
    cout<<"Yes"<<endl;
    ll n = d[N];
    ll it = 1;
    cout<<n<<endl;
    REP(i,n)
    {
        vector<ll> tmp;
        for(auto &vv:v)tmp.pb(vv[i-1]);
        while(SZ(tmp) < n-1)tmp.pb(it),it++;
        v.pb(tmp);
        cout<<SZ(tmp);
        for(ll x:tmp)cout<<" "<<x;
        cout<<endl;
    }
}


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

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

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

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

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

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

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

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

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}
use std::cmp::min;
fn main() {
    input! {
        n:usize,
        x:i64,
        mut an:[i64;n],
    }
    let mut ans = 0;
    for j in 0..n - 1 {
        let sum = an[j] + an[j + 1];
        if sum > x {
            let diff = sum - x;
            an[j + 1] -= min(diff, an[j + 1]);
            an[j] -= diff - min(diff, an[j + 1]);
            ans += diff;
        }
    }
    println!("{}", ans);
}

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

typedef unsigned uint;
typedef long long INT;
typedef unsigned long long UINT;
const int INF = 1001001001;
const INT INFLL = 1001001001001001001LL;

 int in() { int x; scanf("%d", &x); return x; }
double fin() { double x; scanf("%lf", &x); return x; }
INT lin() { INT x; scanf("%lld", &x); return x; }
UINT luin() { UINT x; scanf("%llu", &x); return x;}


int main(){
    int a, b, c;
    double fa, fb, fc;
    char S[128], sa[128], sb[128], sc[128];
    // int N = in();
    // int K = in();
    // scanf("%s", S);

   // int N = in();

    int aa[5];

    for (int i = 0; i < 5; ++i) {
        aa[i] = in();
        if (aa[i] == 0) {
            printf("%d", i+ 1);
            return 0;
        }
    }



    return 0;
}







Measured memory_bytes: 3716
(let ((n (read))
      (m (read))
      (x (read))
      (ans1 0)
      (ans2 0 )
      temp)
  (loop repeat m do
        (setf temp (read))
        (cond ((< temp x) (incf ans1))
              (t (incf ans2))))
  (princ (min ans1 ans2)))


Measured memory_bytes: 13160
#include <iostream>
#include <map>
#include <set>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <fstream>
#include <bitset>
#include <queue>
#include <stack>
#include <deque>
#include <complex>
#include <iomanip>
#include <stdio.h>
#include <string.h>
#include <random>
#include <functional>

using std::cin;
using std::cout;
using std::cerr;
using std::endl;

using std::map;
using std::set;
using std::bitset;
using std::vector;
using std::string;
using std::multimap;
using std::multiset;
using std::deque;
using std::queue;
using std::stack;
using std::pair;
using std::iterator;

using std::sort;
using std::stable_sort;
using std::reverse;
using std::max_element;
using std::min_element;
using std::unique;
using std::ios_base;
using std::swap;
using std::fill;

using std::setprecision;
using std::fixed;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<long long> vl;
typedef string S;

ll min(ll a, ll b) {return a < b ? a : b;}
ll min(int a, ll b) {return a < b ? a : b;}
ll min(ll a, int b) {return a < b ? a : b;}
ll min(int a, int b) {return a < b ? a : b;}

ll max(ll a, ll b) {return a > b ? a : b;}
ll max(int a, ll b) {return a > b ? a : b;}
ll max(ll a, int b) {return a > b ? a : b;}
ll max(int a, int b) {return a > b ? a : b;}

namespace MySpace{

};

#define F(i, n) for (int (i) = 0; (i) != (n); (i)++)
#define fi first
#define se second
#define re return
#define all(x) (x).begin(), (x).end()
#define int long long

const int N = 325501;
const int MOD = 1e9 + 7;

int n;
long long a[N];

void pt(int x)
{
    if (x) cout << "First";
    else cout << "Second";
    exit(0);
}

void solve(int k)
{
    long long s = 0, cnt = 0, kek = 0;
    for (int i = 0; i < n; i++)
    {
        s += (a[i] - 1);
        cnt += a[i] % 2;
        kek += a[i] == 1;
    }
    //cout << s << endl;
    if (s % 2 == 1)
    {
        pt(k);
    }
    if (cnt > 1)
    {
        pt(1 ^ k);
    }
    if (cnt == 0)
        exit(75);
    if (cnt == 1 && kek == 1) pt(1 ^ k);
    int g = 0;
    for (int i = 0; i < n; i++)
    {
    	if (a[i] % 2) a[i]--;
    	g = std::__gcd(g, a[i]);
    }
    for (int i = 0; i < n; i++) a[i] /= g;
    k ^= 1;
    solve(k);
}

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin >> n;
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
    }
    solve(1);
}


Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <cstdio>
#include <string>
#include <algorithm>
#include <map>
#include <numeric>
using namespace std;

typedef struct MoveList_t {
    int y;
    int x;
    int y_d;
    int x_d;
} MoveList_t;

int main()
{
    int h, w;
    cin >> h >> w;
    vector<MoveList_t> moveList;
    int a[501][501];
    for (int i = 1; i <= h; i++) {
        for (int j = 1; j <= w; j++) {
            cin >> a[i][j];
        }
    }

    for (int i = 1; i <= h; i++) {
        for (int j = 1; j <= w; j++) {
            if (a[i][j] % 2 == 1) {
                a[i][j]--;
                MoveList_t tmp;
                tmp.y = i;
                tmp.x = j;
                tmp.y_d = i;
                tmp.x_d = j;
                if (i == h && j == w) { // 右下の角まで到達したら終了する
                    break;
                }
                if (i == h) {// 一番下まで到達した場合
                    a[i][j+1]++;
                    tmp.x_d++;
                } else {
                    a[i+1][j]++;
                    tmp.y_d++;
                }
                moveList.push_back(tmp);
            }
        }
    }

    cout << moveList.size() << endl;
    for (int i = 0; i < moveList.size(); i++) {
        MoveList_t t = moveList[i];
        printf("%d %d %d %d\n", t.y, t.x, t.y_d, t.x_d);
    }
}


Measured memory_bytes: 5104
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <cmath>
#include <numeric>
#include <utility>
#include <iomanip>

using namespace std;
using int64 = long long;

struct aaa{aaa(){cin.tie(nullptr); ios::sync_with_stdio(false); cout<<fixed<<setprecision(20);};}aaa;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v){o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}
#define debug(v) {cerr<<"\033[1;36m[debug]\033[m "<<#v<<" : "<<v<<endl;}

int main() {
    int64 mod = 1000000007;
    int s;
    cin >> s;
    vector dp(s+1, 0); 
    dp[0] = 1;

    for (int i=0; i<=s; i++) {
        if (i-3 < 0) continue;
        dp[i] = (dp[i-1] + dp[i-3]) % mod;
    }

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


Measured memory_bytes: 3172
# -*- coding: utf-8 -*-
import sys
from heapq import heappush,heappop,heapify
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

T=int(input())
for _ in range(T):
    N=int(input())
    ans=0
    left=[]
    right=[]
    for i in range(N):
        K,L,R=map(int,input().split())
        ans+=min(L,R)
        if L>=R:
            left.append((K,L-R))
        else:
            right.append((N-K,R-L))
    left.sort(key=lambda t:t[0])
    right.sort(key=lambda t:t[0])
    for l in [left,right]:
        h=[]
        for k,p in l:
            if len(h)<k:
                heappush(h,p)
            else:
                if h:
                    heappush(h,max(heappop(h),p))
        ans+=sum(h)
    print(ans)

Measured memory_bytes: 103372
n, A, B, C = map(int, input().split())
l = [int(input()) for _ in range(n)]
inf = 10 ** 10
def dfs(k, a, b, c):
    if k == n:
        if 0 in (a,b,c):
            return inf
        return abs(A - a) + abs(B - b) + abs(C - c) - 30
    ret = [0] * 4
    ret[0] = dfs(k+1, a + l[k], b, c) + 10
    ret[1] = dfs(k+1, a, b + l[k], c) + 10
    ret[2] = dfs(k+1, a, b, c + l[k]) + 10
    ret[3] = dfs(k+1, a, b, c)
    return min(ret)
print(dfs(0, 0, 0, 0))


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int (i)=0;i<(n);i++)
#define REP(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define INF LLONG_MAX
#define MOD 1000000007
#define fcout cout << fixed << setprecision(15)
#define int long long
#define yorn(f) puts((f)?"Yes":"No")
#define YORN(f) puts((f)?"YES":"NO")
#define lower_bound lowb
#define upper_bound upb
typedef long long ll;
typedef pair<int, int> P;
typedef priority_queue<int> pque;
int gcd(int a,int b){return b?gcd(b,a%b):a;};
int lcm(int a,int b){return a*b/gcd(a,b);};
int mod(int a,int b){return (a+b-1)/b;};
int month[12] = {31,28,31,30,31,30,31,31,30,31,30,31};
template<typename A, size_t N, typename T>
void Fill(A(&array)[N],const T &val){std::fill((T*)array,(T*)(array+N),val);}
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;};



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

	string s, t;
	cin >> s >> t;
	int res = 0;
	rep(i, s.size()) {
		if(s[i] == t[i]) res++;
	}
	cout << res << endl;
	return 0;
}


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

using namespace std;

using ll = long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vi = vector<int>;
using vl = vector<ll>;

using _loop_int = int;
#define REP(i,n) for(_loop_int i=0; i<(_loop_int)(n); i++)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a); i<(_loop_int)(b); i++)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1; i>=(_loop_int)(a); i--)

#define CHMIN(a,b) (a)=min((a),(b))
#define CHMAX(a,b) (a)=max((a),(b))
#define ALL(v) (v).begin(),(v).end()

#define DEBUG(x) cerr<<#x<<": "<<(x)<<endl
#define DEBUG_VEC(v) cerr<<#v<<": ";REP(__i,(v).size())cerr<<((v)[__i])<<", ";cerr<<endl

const ll MOD = 1000000007ll;

int n,m;
int imo[125252];

int main(){
    scanf("%d%d",&n,&m);
    REP(i,m){
        int l,r;
        scanf("%d%d",&l,&r);
        imo[l-1]++;
        imo[r]--;
    }
    REP(i,n+1)imo[i+1] += imo[i];
    int ans = count(imo, imo+n, m);
    printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 640
class dice():
    def __init__(self,a,b,c,d,e,f):
        self.l=[a,b,c,d,e,f]
    def move(self,direc):
        if direc=="N":
            self.l=[self.l[1],self.l[5],self.l[2],self.l[3],self.l[0],self.l[4]]
        elif direc=="S":
            self.l=[self.l[4],self.l[0],self.l[2],self.l[3],self.l[5],self.l[1]]
        if direc=="E":
            self.l=[self.l[3],self.l[1],self.l[0],self.l[5],self.l[4],self.l[2]]
        if direc=="W":
            self.l=[self.l[2],self.l[1],self.l[5],self.l[0],self.l[4],self.l[3]]
A,B,C,D,E,F=map(int,input().split())
dice_=dice(A,B,C,D,E,F)
s=input()
for i in s:
    dice_.move(i)
print(dice_.l[0])


Measured memory_bytes: 5608
#include <iostream>
#include <functional>

struct Closed_Section {
    bool valid;
    int64_t begin;
    int64_t end;
    Closed_Section(bool _valid, int64_t _begin, int64_t _end) {
        valid = _valid; begin = _begin; end = _end;
    }
    Closed_Section() {
        valid = false, begin = 0; end = -1; //配列を定義するためにデフォルトコンストラクタが必要。
    }
    int64_t size() { return valid ? end - begin + 1 : 0; }
    void dump() { std::cout << "valid:" << valid << " begin:" << begin << " end:" << end << std::endl; }
};

Closed_Section binary_search(const int64_t L, const int64_t R, std::function<bool(int64_t)> func) {
    if (R < L) { return Closed_Section(false, L, R); }
    const bool res_L = func(L);
    const bool res_R = func(R);
    if (res_L && res_R) {
        return Closed_Section(true, L, R);
    } else if (!res_L && !res_R) {
        return Closed_Section(false, 0, -1);
    } else {
        int64_t lb = L;
        int64_t ub = R;
        while (lb + 1 < ub) {
            int64_t mid = (lb + ub) / 2;
            if (res_L == func(mid)) {
                lb = mid;
            } else {
                ub = mid;
            }
        }
        return res_L ? Closed_Section(true, L, lb) : Closed_Section(true, ub, R);
    }
}

Closed_Section binary_search(const Closed_Section& cs, std::function<bool(int64_t)> func) {
    return cs.valid ? binary_search(cs.begin, cs.end, func) : cs;
}

// end of template

int64_t K;
const int64_t MAX_K = 1e5 + 10;
int64_t A[MAX_K] = {};
const int64_t INF = 1e15;

int64_t calc(int64_t N) {
    for (int i = 1; i <= K; i++) {
        N -= N%A[i];
    }
    return N;
}

int main(int argc, char **argv) {
    std::cin >> K;
    for (int i = 1; i <= K; i++) {
        std::cin >> A[i];
    }
    auto cs = binary_search(2, INF, [&](int64_t n){
        return calc(n) <= 2;
    });
    cs = binary_search(cs, [&](int64_t n){
        return 2 <= calc(n);
    });
    if (cs.valid) {
        std::cout << cs.begin << " " << cs.end << std::endl;
    } else {
        std::cout << -1 << std::endl;
    }
}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>
using namespace std;
int bubble(vector<int>, vector<int>&);

int main() {
  do {
    int n;
    cin >> n;
    if(n == 0) break;
    vector<int> nums;
    for(int i = 0; i < n; ++i) {
      int buff;
      cin >> buff;
      nums.push_back(buff);
    }
    int count = 0;
    for(int i = 0; i < n - 1; ++i) {
      vector<int> result;
      count += bubble(nums, result);
      nums = result;
    }
    cout << count << endl;
  } while(true);
  return 0;
}

int bubble(vector<int> nums, vector<int> &result) {
  int size = nums.size();
  int buff = nums[0];
  int count = 0;
  for(int i = 0; i < size - 1; ++i) {
    if(buff > nums[i + 1]) ++count;
    result.push_back(min(buff, nums[i + 1]));
    buff = max(buff, nums[i + 1]);
  }
  result.push_back(buff);
  return count;
}

Measured memory_bytes: 1220
#include<iostream>
#include<string>
using namespace std;
bool isleft(char a)
{
    return(
         a=='q'|| a=='w'|| a=='e'|| a=='r'|| a=='t'||
         a=='a'|| a=='s'|| a=='d'|| a=='f'|| a=='g'||
         a=='z'|| a=='x'|| a=='c'|| a=='v'|| a=='b');
}


int main()
{
    string s;
    while(cin >>s &&s!="#")
    {
        int j=0;
        for(int i=0;i<s.size()-1;i++)
        { j+= isleft(s[i]) ^ isleft(s[i+1]);}
        cout << j << endl;


    }
    return 0;
}

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

int main(){
  int i,j,k;
  int cnt=0;
  int tmp;
  cin >> i >> j >> k;
  tmp = i;
  do{
    if(k % tmp == 0){
      cnt++;
    }
    tmp++;
  }while(tmp <= j);
  cout << cnt << endl;
  return 0;
}

Measured memory_bytes: 3112
import java.util.*;
public class Main {
	
	static int MOD = 1_000_000_007;
	static int MAX = 1000_000;
	static long[] fac = new long[MAX+1];
	static long[] finv = new long[MAX+1];
	static long[] inv = new long[MAX+1];
	
	static void COMinit() {
		fac[0] = fac[1] = 1;
		finv[0] = finv[1] = 1;
		inv[1] = 1;
		for(int i = 2; i <= MAX; i++) {
			fac[i] = fac[i-1] * i % MOD;
			inv[i] = MOD - inv[MOD%i] * (MOD/i) % MOD;
			finv[i] = finv[i-1] * inv[i] % MOD;
		}
	}
	
	static long cmb(int n, int k){
		if(n < k || k < 0) return 0;
		return fac[n] * (finv[k] * finv[n-k] % MOD) % MOD;
	}

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int M = sc.nextInt();
		COMinit();
		Map<Integer, Integer> fact = new HashMap<>();
		for(int i = 2; i <= Math.sqrt(M); i ++) {
			if(M % i == 0) {
				int n = 0;
				while(M % i == 0) {
					M /= i;
					n++;
				}
				fact.put(i, n);
			}
		}
		if(M > 1)
			fact.put(M, 1);
		long ans = 1;
		for(int i: fact.values())
			ans = ans * cmb(i+N-1, i) % MOD;
		System.out.println(ans);

	}

}

Measured memory_bytes: 47700
#include<stdio.h>
#include<string.h>
#define rep(i,N) for(int i=0;i<(int)N;i++)
static inline char GET(void)
{
  static char buf[1<<15],*ptr=buf,*end=buf;
  if(ptr==end){ptr=buf,end=buf+fread(buf,1,1<<15,stdin);}return *ptr++;
}
static inline void PUT(char c)
{
  static char buf[1<<15],*ptr=buf;
  if(ptr==buf+strlen(buf)||c==0){fwrite(buf,1,ptr-buf,stdout),ptr=buf;}*ptr++=c;
}
static inline int IN(void)
{
  long x=0,f=0;char c=GET();while(c<48||c>57){f^=c==45,c=GET();}
  while(c>47&&c<58){x=x*10+c-48,c=GET();}return f?-x:x;
}
static inline void OUT(long a)
{
  if(a<0)PUT('-'),a=-a;
  int d[40],i=0;do{d[i++]=a%10;}while(a/=10);
  while(i--){PUT(d[i]+48);}PUT('\n');
}
static inline int max(const int x,const int y){return x>y?x:y;}
int main(void)
{
  int ten[20][20]={{0}},N=IN();long count=0;
  rep(i,N)
  {
    long A=0;char c=GET();int digit=1e9,even=0,five=0;
    while(c<'0'||c>'9'){c=GET();}while(c>'/'&&c<':'){A=A*10+c-'0',c=GET();}A*=digit;
    if(c=='.'){c=GET();}while(c>'/'&&c<':'){digit/=10;A+=digit*(c-'0');c=GET();}
    while(!(A&1)&&even<=18){A/=2,even++;}while(A%5==0&&five<=18){A/=5,five++;}
    for(int j=max(0,18-even);j<20;j++)for(int k=max(0,18-five);k<20;k++){count+=ten[j][k];}
    ten[even][five]++;
  }
  return OUT(count),0;
}

Measured memory_bytes: 1528
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] a = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = sc.nextInt();
		}
		Main main = new Main();
		int ans = main.selectionSort(a, n);
		for (int i = 0; i < n; i++) {
			if (i != n - 1) {
				System.out.print(a[i] + " ");
			} else {
				System.out.println(a[i]);
			}
		}
		System.out.println(ans);

	}

	// 選択ソート
	private int selectionSort(int[] a, int n) {
		int cnt = 0;// 入れ替えた回数

		for (int i = 0; i < n - 1; i++) {
			int minj = i;// 最小の要素を持つ位置

			for (int j = i; j < n; j++) {
				if (a[j] < a[minj]) {
					minj = j;
				}
			}

			if (i != minj) {
				int tmp = a[minj];
				a[minj] = a[i];
				a[i] = tmp;
				cnt++;
			}

		}
		return cnt;
	}

}



Measured memory_bytes: 26460
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A,B;
  cin>>A>>B;
  if(A>12){
    cout<<B<<endl;
  }
  else if(A<6){
    cout<<0<<endl;
  }
  else{
    cout<<B/2<<endl;
  }
}

Measured memory_bytes: 3624
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
typedef long long ll;

const int MOD = 1000000007;

int N, M;
int as[1000+10];
int bs[1000+10];
int xs[1000000+10][2];

int main(void) {
  scanf("%d%d", &N, &M);
  REP(i, N) {
    scanf("%d", &as[i]);
  }
  REP(i, M) {
    scanf("%d", &bs[i]);
  }
  memset(xs, -1, sizeof xs);
  REP(i, N) {
    xs[as[i]][0] = i;
  }
  REP(i, M) {
    xs[bs[i]][1] = i;
  }
  ll res = 1;
  ll usedRow = 0;
  ll usedCol = 0;
  ll usedBoth = 0;
  for(int i = N*M; i >= 1; --i) {
    // cerr << "> " << i << " " << res << endl;
    if(xs[i][0] < 0 && xs[i][1] < 0) {
      res = res * usedBoth % MOD;
      usedBoth--;
    } else if(xs[i][0] < 0 && xs[i][1] >= 0) {
      res = res * usedRow % MOD;
      usedCol++;
      usedBoth += usedRow-1;
    } else if(xs[i][0] >= 0 && xs[i][1] < 0) {
      res = res * usedCol % MOD;
      usedRow++;
      usedBoth += usedCol-1;
    } else {
      usedBoth += usedCol + usedRow;
      usedRow++;
      usedCol++;
    }
  }
  cout << res << endl;
  
  return 0;
}


Measured memory_bytes: 8192
import scala.io.StdIn.readLine

object Main {

  def main(args:Array[String]) = {
    for(i<-1 to 9) {
      val s = readLine.split(" ")
      println(s(0) + " " + (s(1).toInt + s(2).toInt) + " " + (s(1).toInt*200 + s(2).toInt*300))
    }
  }
}

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

int main(){
	int n;
	cin>>n;
	vector<int> c(n,0),s(n,0),f(n,0);
	for(int i=0;i<n-1;i++){
		cin>>c[i]>>s[i]>>f[i];
	}
	for(int st=0;st<n;st++){
		int t=0;
		for(int cur=st;cur<n-1;cur++){
			t=s[cur]+ max(0,f[cur]* (int)ceil((double)(t-s[cur])/f[cur]))+c[cur];
		}
		cout<<t<<endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<utility>
#include<string>
#include<cmath>
#include<cstring>
#include<queue>
#include<map>
#include<climits>
#include<set>

#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 SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
using namespace std;
typedef pair<int, int> pii;
typedef long long int ll;
typedef pair<ll,ll> pll;
int dx[4] = {1,0,0,-1};
int dy[4] = {0,1,-1,0};
#define MOD 1000000007
#define ARRAY_MAX 100005

const int INF = 1e9+7;


int main(){

    int n;
    cin >> n;
    string s;
    int sum[n][26];

    for(int i = 0;i < n;i++){
        for(int j = 0;j < 26;j++){
            sum[i][j] = 0;
        }
    }

    for(int i = 0;i < 3;i++){
        cin >> s;
        for(int j = 0;j < s.length();j++){
            sum[j][s[j]-'a']++;
        }
    }

    int ans = 0;
    for(int i = 0;i < n;i++){
        int maxi = -1;
        for(int j = 0;j < 26;j++){
            maxi = max(maxi,sum[i][j]);
        }
        //cout << maxi << endl;
        ans += (3-maxi);
    }

    cout << ans << endl;





    return 0;
}

Measured memory_bytes: 256
// https://beta.atcoder.jp/contests/abc106

#define SUBMIT

#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cstring>
#include <cmath>
#include <unordered_map>
#include <map>

using namespace std;
using ui64 = unsigned long long;
using i64 = long long;

int main() {
    int A, B;
    cin >> A >> B;
    cout << (A - 1) * (B - 1) << endl;
    return 0;
}

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

int asc(const void *a, const void *b) {
  return *(int *)a - *(int *)b;
}

int main(void) {
  int N;
  int i,j,k;
  int *l;
  scanf("%d\n", &N);
  l = (int *)calloc(N,sizeof(int));
  for(i=0;i<N;i++)
  {
  	scanf("%d", &l[i]);
  }
  //read
  //printf("%d\n",N);
  //printf("%d %d",l[0],l[1]);
  
  qsort(l, N, sizeof(int), asc);

  int flag =0;
  for(i=0;i<N-2;i++)
  {
  	for(j=i+1;j<N-1;j++)
  	{
      	for(k=j+1;k<N;k++)
        {
          if(l[k]>=l[i]+l[j])
          {
            flag += k-1-j;
            break;
          }else if(k==N-1)
          {
          	flag += k-j;
          }
          
        }
      	//printf("%d %d %d\n",i,j,flag);
  	}
  }
  printf("%d",flag);
}

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

const ll MAX = 1000000;
const ll MOD = 1000000007;

ll fac[MAX];

// テーブルを作る前処理
/*
void COMinit() {
    fac[0] = fac[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
    }
}
*/

ll pow_kai(ll a,ll n){//aのn乗を計算します。
  ll x = 1;
  while(n > 0){//全てのbitが捨てられるまで。
    if(n&1){//1番右のbitが1のとき。
      x = x*a%MOD;
    }
    a = a*a%MOD;
    n >>= 1;//bit全体を右に1つシフトして一番右を捨てる。
  }
  return x;
}

// 二項係数計算
ll COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    ll tmp=1;
    for(ll i=n;i>=n-k+1;i--) tmp = (tmp*i)%MOD;

    return (tmp * pow_kai(fac[k],MOD-2)) % MOD;
}

int grcd(int a,int b) {
  if(a < b) return grcd(b, a);
  int r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}


int main()
{
    ll K,ans=0;

    cin >> K;

    for(int i=1;i<=K;i++){
        for(int j=1;j<=K;j++){
            for(int k=1;k<=K;k++){
                ans += grcd(i,grcd(j,k));
            }           
        }
    }

/*
ans=grcd(2,grcd(4,100));
*/
   cout << ans << endl;

 
    return 0;

}

Measured memory_bytes: 3620
#pragma GCC target ("avx2")
#pragma GCC optimize ("unroll-loops")
#pragma GCC optimize ("O3")
#include "bits/stdc++.h"
#include <unordered_set>
#include <unordered_map>
#include <random>
using namespace std;
typedef long long ll;
const ll MOD = 1'000'000'007LL; /*998'244'353LL;*/
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for(int (i)=0; (i)<(n); (i)++)
const int dx[4]={ 1,0,-1,0 };
const int dy[4]={ 0,1,0,-1 };

string S;

signed main(){
    cin >> S;
    int cnt = 0;
    int ans = 0;
    rep(i, S.size()){
        if(S[i] == 'R') cnt++;
        else{
            ans = max(ans, cnt);
            cnt = 0;
        }
    }
    ans = max(ans, cnt);
    cout << ans << endl;
}

Measured memory_bytes: 3580
#include <bits/stdc++.h>
#define eps 1e-9

using namespace std;

typedef complex<double> point;
struct circle {
    point c; double r;
    circle(point c, double r):c(c),r(r){}
    circle(){}
};

double cross(const point &a, const point &b) {
    return imag(conj(a)*b);
}

double dot(const point &a, const point &b) {
    return real(conj(a)*b);
}

bool get_circle(point p1, point p2, point p3, point &center, double &r) {
    double g = 2*imag(conj(p2-p1)*(p3-p2));
    if (abs(g) < eps) return false;
    center = p1*(norm(p3)-norm(p2));
    center += p2*(norm(p1)-norm(p3));
    center += p3*(norm(p2)-norm(p1));
    center /= point(0, g); r = abs(p1-center);
    return true;
}

int n;
vector<point> pt;

double dist(point a, point b) {
    return hypot(a.real() - b.real(), a.imag() - b.imag());
}

bool isInside(double R, double r) {
    return R - r <= eps;
}

bool Check(point c, double r)
{
    for (int i = 0; i < n; i++)
        if (!isInside(dist(c, pt[i]), r))
            return false;
    return true;
}

int main()
{
    cin >> n;
    for (int i = 0; i < n; i++) {
        int x, y;   cin >> x >> y;
        pt.push_back(point(x, y));
    }

    double Ans = 1e9;
    for (int i = 0; i < n; i++)
        for (int j = i + 1; j < n; j++)
            for (int k = j + 1; k < n; k++)
            {
                point cur; double rad;
                if (!get_circle(pt[i], pt[j], pt[k], cur, rad))
                    continue;

                if (Check(cur, rad))
                    Ans = min(Ans, rad);
            }

    for (int i = 0; i < n; i++)
        for (int j = i + 1; j < n; j++) {
            point cur = 0.5 * (pt[i] + pt[j]);
            double rad = 0.5 * dist(pt[i], pt[j]);
        
            if (Check(cur, rad))
                Ans = min(Ans, rad);
        }

    cout << fixed << setprecision(6) << Ans << '\n';

    return 0;
}


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

int main(){
  int i,n,k;
  cin >> n;
  while (n != 0) {
    int nLessCnt = 0;
    int nZeroCnt = 0;
    i = n;
    while (i--) {
      cin >> k;
      if (k <= 1){
        nLessCnt += 1;
      }//NA??§??????????????§??????
      if (k == 0){
        nZeroCnt += 1; //????????°0????????????????????????
      }
    }
      if (n == nLessCnt){
        cout << "NA" << endl;
      }else{
        cout << n - nZeroCnt + 1 << endl;
      }
    cin >> n;
  }
}

Measured memory_bytes: 1164
# -*- coding: utf-8 -*-
n,a,b,c = list(map(int,input().split()))
l = [int(input()) for i in range(n)]

#a,b,cに使うベースの竹を選ぶ
from itertools import permutations,product
inf=float("inf")
min_mp = inf
for k in product(range(4),repeat=n):
    if 2 not in k or 1 not in k or 0 not in k:
        continue
    len_abc = [0,0,0]
    mp = - 30
    for i,v in enumerate(k):
        if v == 3:
            pass
        else:
            len_abc[v]+=l[i]
            mp += 10
    mp += (abs(a-len_abc[0])+abs(b-len_abc[1])+abs(c-len_abc[2]))
    min_mp = min(min_mp,mp)
print(min_mp)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
string b;
int main(){
    int q=0;
    cin>>b;
    for(int i=0;i<b.size();i++){
        if(b[i]=='C')
    q++;
    if(q!=0&&b[i]=='F')
    q-=10000000000;
    }
    if(q<0)
    cout<<"Yes";
    else
    cout<<"No";
    return 0;
}

Measured memory_bytes: 256
import java.util.*;

class Main{

  public static boolean checker(int a,int[] List){
    for(int i=0;i<List.length;i++){
     if(List[i]==a) return false; 
    }
    return true;
  }
  
  public static void main(String args[]){

    Scanner s=new Scanner(System.in);
	int X=s.nextInt();
    int N=s.nextInt();
    int[] List=new int[N];
    for(int i=0;i<N;i++) List[i]=s.nextInt();
    
    int cnt=0;
    int num=X+cnt;
    do{
      if(checker(num,List)){
        System.out.println(num);
        break;
      }
      cnt+=1;
      if(num-X<0) num+=cnt;
      else num-=cnt;
    }while(true);
    
  }  
}

Measured memory_bytes: 35764
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <cstring>
#include <iomanip>
#include <bitset>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <list>
#include <map>

using namespace std;

const int N = 200005;
const long long inf = (long long) 1e18;

int n, m;
long long st[4 * N];
long long lazy[4 * N];
vector < pair <int, int> > op[N], cl[N];

int left(int x) {
  return (x << 1);
}

int right(int x) {
  return (x << 1) + 1;
}

void update(int p, int L, int R, int i, int j, long long val) {
  if (lazy[p]) {
    st[p] += lazy[p];
    if (L != R) {
      lazy[left(p)] += lazy[p];
      lazy[right(p)] += lazy[p];
    }
    lazy[p] = 0;
  }
  if (L > j || R < i) return;
  if (i <= L && R <= j) {
    st[p] += val;
    if (L != R) {
      lazy[left(p)] += val;
      lazy[right(p)] += val;
    }
    return;
  }
  int mid = (L + R) >> 1;
  update(left(p), L, mid, i, j, val);
  update(right(p), mid + 1, R, i, j, val);
  st[p] = max(st[left(p)], st[right(p)]);
}

long long query(int p, int L, int R, int i, int j) {
  if (i > j) return 0;
  if (lazy[p]) {
    st[p] += lazy[p];
    if (L != R) {
      lazy[left(p)] += lazy[p];
      lazy[right(p)] += lazy[p];
    }
    lazy[p] = 0;
  }
  if (L > j || R < i) return -inf;
  if (i <= L && R <= j) {
    return st[p];
  }
  int mid = (L + R) >> 1;
  return max(query(left(p), L, mid, i, j), query(right(p), mid + 1, R, i, j));
}

int main() {
  cin >> n >> m;
  for (int i = 0; i < m; i++) {
    int x, y, a;
    cin >> x >> y >> a;
    op[x].push_back({x - 1, a});
    cl[y].push_back({x - 1, -a});
  }
  long long ans = 0;
  for (int i = 1; i <= n; i++) {
    for (auto it : op[i]) {
      update(1, 0, n, 0, it.first, it.second);
    }
    long long x = query(1, 0, n, 0, i - 1);
    ans = max(ans, x);
    update(1, 0, n, i, i, x);
    for (auto it : cl[i]) {
      update(1, 0, n, 0, it.first, it.second);
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 33280
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define P pair<int,int>
using ll=int64_t;
using namespace std;
#define ketasuu(n) fixed<<setprecision(n)
#define btoe(p) p.begin(),p.end()
#define etob(p) p.rbegin(),p.rend()

int ketasu(int a){
    int cnt=0;
    while(a!=0){
        cnt++;
        a/=10;
    }
    return cnt;
}

int main(){
    int n;
    cin>>n;
    int che=100;
    int ans=0;
    while(che<=n){
        int keta=ketasu(che), kari=che;
        deque<int> now;
        rep(i,keta){
            now.push_front(kari%10);
            kari/=10;
        }
        bool ok=true;
        rep(i,keta){
            if(now[i]!=3 && now[i]!=5 && now[i]!=7){
                ok=false;
                che+=pow(10,keta-1-i);
                break;
            }
        }
        if(ok){
            map<int,int> mp;
            int now=che;
            rep(i,keta){
                mp[now%10]++;
                now/=10;
            }
            int a=0;
            for(auto& v: mp) a++;
            if(a==3) ans++;
            che++;
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define all(x) (x).begin(), (x).end()
using ll = long long;
using namespace std;
template <typename T> using vec = std::vector<T>;

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

    ll ans = 0;
    for(int i=1;i<=N;++i)for(int j=1;j<=N;++j){
        if(i*j>=N) break;
        if(i*j<N)++ans;
    }
    cout << ans << '\n';
}


Measured memory_bytes: 3672
#!/usr/bin/env python3
MOD = 10 ** 9 + 7
def choose(n, r):
    num = 1
    den = 1
    for i in range(r):
        num *= n - i
        num %= MOD
    for i in range(r):
        den *= i + 1
        den %= MOD
    return num * pow(den, MOD - 2, MOD) % MOD
def solve(x, y):
    if (x + y) % 3 != 0:
        return 0
    k = (x + y) // 3
    if x < k or y < k:
        return 0
    return choose(k, min(y - k, x - k))
print(solve(*map(int, input().split())))


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

int main() {
    // insert code here...
    int a,b,c;
    string sentence, replacement,command,copy;
    cin>>sentence;
    cin>>a;
    for (int i=0; i<a; i++) {
        cin>>command;
        if(command=="print"){
            cin>>b>>c;
            for(int l=0;l<c-b+1;l++){
                cout<<sentence[b+l];
            }
            cout<<endl;
            
        }else if(command=="reverse"){
            cin>>b>>c;
            for (int l=0; l<c-b+1; l++) {
                copy[l]=sentence[b+l];
                
            }
            for (int l=0; l<c-b+1; l++) {
                sentence[b+l]=copy[c-b-l];
                
            }
            
            
        }else if (command=="replace"){
            cin>>b>>c>>replacement;
            for (int l=0; l<c-b+1; l++) {
                sentence[b+l]=replacement[l];
                
            }
            
        }
    }
    
    return 0;
}


Measured memory_bytes: 3200
while True:
    a,op,b = input().split()
    if op == "?":
        break
    a = int(a)
    b = int(b)
    
    if op == "+":
        print(a+b)
    elif op == "-":
        print(a-b)
    elif op == "*":
        print(a*b)
    elif op == "/":
        print(a//b)


Measured memory_bytes: 5592
import std.stdio;
import std.conv;
import std.string;
import std.typecons;
import std.algorithm;
import std.array;
import std.range;
import std.math;
import std.regex : regex;
import std.container;
import std.bigint;


void main()
{
  auto s = readln.chomp;
  int[char] cnt;
  foreach (e; s) {
    cnt[e]++;
  }

  if (s.length == cnt.keys.length) {
    writeln("yes");
  } else {
    writeln("no");
  }
}


Measured memory_bytes: 256
#include<stdio.h>

int main(){
    int a[9];
	int i,j,h1,h2,h3;
    for(i=0;i<10;i++) {
	  scanf("%d", &a[i]);
    }
	h1 = 0;
	h2 = 0;
	h3 = 0;
	for(i=0;i<10;i++) {
		if(h3<=a[i] && a[i]<=h2) {
			h3=a[i];
		}
		if(h2<=a[i] && a[i]<=h1) {
			h3 = h2;
			h2=a[i];
		}
		if(h1<=a[i]) {
			h3=h2;
			h2=h1;
			h1=a[i];
			
		}
	}
	printf("%d\n", h1);
	printf("%d\n", h2);
	printf("%d\n", h3);
    return 0;
}

Measured memory_bytes: 600
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;

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

  int res = 0;
  int a = -1;
  int b = -1;
  int c = -1;
  for (int i = 0; i <= n; i++) {
    for (int j = 0; j <= n - i; j++) {
      if (10000*i + 5000*j + 1000*(n-i-j) == y) {
        a = i;
        b = j;
        c = n-i-j;
      }
    }
  }
  cout << a << " " << b << " " << c << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
char s[1000007];
int n,m,L,R;
int a[1000007],K;
void cal(int kth){
	if(!a[L]){
		a[L]=1;
		a[L+1]^=1;
	}else{
		++L;
		a[R++]=kth>=K;
	}
}
int f[2][2][2];
int main(){
	scanf("%d%d%s",&n,&m,s);
	f[0][0][1]=3;
	f[0][1][1]=3;
	f[1][0][1]=2;
	f[1][1][1]=3;
	a[0]=s[0]=='B';
	for(int i=1;i<n;++i)a[i]=s[i]!=s[i-1];
	L=0,R=n;
	K=f[s[0]-'A'][s[1]-'A'][s[n-1]-'A'];
	if(m>500000)m=500000+m%2;
	for(int i=1;i<=m;++i)cal(i);
	s[0]=a[L]+'A';
	for(int i=L+1;i<R;++i)s[i-L]=(s[i-L-1]-1^a[i])+1;
	puts(s);
	return 0;
}

Measured memory_bytes: 4480
#include <bits/stdc++.h>
#define boost_io ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define int long long
#define num(a) a-'0'
#define charr(a) (a - 'A' + 1)
#define rep(i,a,b) for(int i=a;i<b;i++)
#define maxs(a,b) if(b>a)a=b
#define mins(a,b) if(b<a)a=b
#define debug(x) cerr<<"["<<#x<<":"<<x<<"] "
#define debug2(a,b) debug(a);debug(b)
#define debug3(a,b,c) debug2(a,b);debug(c)
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*b)/(__gcd(a,b))
#define print(arr) for(auto it = arr.begin();it < arr.end();it ++){cout << *it << " ";}cout << ln;
#define all(a) (a).begin(), (a).end()
#define vi vector<long long>
#define v vector
#define p pair
#define pb push_back
#define mk make_pair
#define f first
#define s second
#define ln "\n"
typedef long double ld;
typedef double d;
using namespace std;
int modF=1e9+7;
int INF=1e11;

void solve(){
	int n;
	cin>>n;
	// int ans=0;
	v<vi> h(n);
	int ans=1;
	for(int i=2;i<n;i++){
		if(h[i].size()==0){
			for(int j=2*i;j<n;j+=i){
				int nc=j;
				int acc=0;
				while(nc%i==0){
					acc++;
					nc/=i;
				}
				h[j].pb(acc);
			}
			ans+=2;
		}
		else{
			int acc=1;
			for(int e:h[i]){
				acc*=(e+1);
			}
			ans+=acc;
		}
	}
	// for(int i=1;i<n;i++){
	// 	for(int j=1;j*j<=n-i;j++){
	// 		if((n-i)%j==0){
	// 			if((j*j)!=(n-i))
	// 				ans+=2;
	// 			else
	// 				ans++;
	// 		}
	// 	}
	// }
	cout<<ans<<ln;
}

signed main(){
	boost_io;
	solve();
	return 0;
}

Measured memory_bytes: 72892
import Data.List

main = do
  n <- read <$> getLine :: IO Int
  as <- map read . words <$> getLine :: IO [Int]
  putStrLn $ unwords $ map show $ solve $ sortBy (flip compare) as

solve :: [Int] -> [Int]
solve (a:as) =
  [a,r]
  where
    r = minimumBy (\x y-> compare (abs $ x - div a 2) (abs $ y - div a 2)) as


Measured memory_bytes: 48508
#include <iostream>
#include <vector>
#include <string>

std::vector<int64_t> calc_seq(std::vector<int64_t> & xs) {
    auto seq = std::vector<int64_t>{};
    auto count = 1;
    for (size_t i = 0; i < xs.size() - 1; i++) {
        if (xs[i] == xs[i+1]) {
            count++;
        } else {
            seq.push_back(count);
            count = 1;
        }
    }
    seq.push_back(count);
    return seq;
}

std::vector<int64_t> form_seq(std::vector<int64_t> & xs) {
    auto seq = calc_seq(xs);
    if (xs[0] == 0) {
        seq.insert(begin(seq), 0);
    }
    if (seq.size() % 2 == 0) {
        seq.push_back(0);
    }
    return seq;
}

int64_t sum(std::vector<int64_t> & xs, int64_t i0, int64_t i1) {
    auto val = 0LL;
    for (auto i = i0; i <= i1; i++) {
        val += xs[i];
    }
    return val;
}

void calc(int64_t n, int64_t k, std::vector<int64_t> & xs) {
    auto seq = form_seq(xs);
    auto m = seq.size();
    auto i = 1LL;
    if (i + 2*k > m) {
        std::cout << n;
        return;
    }
    auto val = sum(seq, i-1, i-1 + 2*k);
    auto biggest = val;
    i += 2;
    while (i + 2*k <= m) {
        val += seq[i-1+2*k-1] + seq[i-1+2*k] - seq[i-1-2] - seq[i-1-1];
        if (biggest < val) {
            biggest = val;
        }
        i += 2;
    }
    std::cout << biggest;
}

int main() {
    std::string s1, s2;
    std::cin >> s1 >> s2;
    auto n = stoi(s1);
    auto k = stoi(s2);

    std::string s3;
    std::cin >> s3;
    std::vector<int64_t> xs(n);
    for (size_t i = 0; i < n; i++) {
        xs[i] = stoi(s3.substr(i, 1));
    }
    calc(n, k, xs);
}

Measured memory_bytes: 2360
//#include "stdafx.h"
#include<bits/stdc++.h> 
#include<iostream>
#include<queue>
#include<string>
#include<algorithm>
using namespace std;
char x,y;
int main()
{
	cin>>x>>y;
	if(x<y)
		cout<<"<\n";
	else if(x>y)
		cout<<">\n";
	else 
		cout<<"=\n";

	return 0;
}



Measured memory_bytes: 3616