akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace atcoder_081B
{
    class Program
    {
        static void Main(string[] args)
        {
            
            int n =int.Parse( Console.ReadLine());
            string[] array = new string[n];
            string s = Console.ReadLine();
            array = s.Split();
           
            int[] data = new int[n];
            for(int i = 0;i<array.Length;i++)
            {
                data[i] = int.Parse(array[i]);
            }
            int sum = 0;
            while (true)
            {
                bool a = false;
                for (int i = 0; i < array.Length; i++)
                {
                    if(data[i]%2 != 0)
                    {
                        a = true;
                        break;
                    }
                }
                if(a == true)
                {
                    break;
                }
                else
                {
                    sum++;
                }
               
                for (int i = 0; i < array.Length; i++)
                {
                    data[i] = data[i] / 2;
                }

            }

            Console.WriteLine(sum);

            Console.ReadLine();

        }
    }
}


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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;

#define F first
#define S second
#define PB push_back
#define MK make_pair
#define REP(i, a, b) for (int i=a; i < b; i++)


bool sort_by(pi c, pi d){
	return c.S < d.S;
}

int main() {
	ll n;
	cin >> n;
	ll t[n];
	ll ans = 0, tmp, a;
	REP(i, 0, n){
		cin >> tmp;
		ans += tmp;
		t[i] = ans;
	}
	
	REP(i, 0, n-1){
		if( i == 0) a = abs(t[i] - (ans - t[i]));
		else a = min(a, abs(t[i] - (ans - t[i])));
	}
	cout << a;

}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define mod 1000000007
#define pb push_back
#define ff first 
#define ss second  
typedef pair<int,int> pp;
bool com(pp x,pp y){
    return x.ff<y.ff;
} 
int N=1e5+9;
int main() {
	// your code goes here
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0); 
	int n;
	cin>>n;
	ll a[n],ans=0;
	for(int i=0;i<n;i++) cin>>a[i];
	for(int i=1;i<n;i++){
	    if(a[i]<a[i-1]){
	        ans+=abs(a[i-1]-a[i]);
	        a[i]+=abs(a[i]-a[i-1]);
	    }
	}
	cout<<ans;
	return 0; 
	
}


Measured memory_bytes: 5184
#include <stdio.h>
int main(void){
	int i,j,t,n,c=0,a[100],f,m;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d",&a[i]);
	}
	for(i=0;i<n-1;i++){
		f=0;
		m=i;
		for(j=i+1;j<n;j++){
			if(a[m]>a[j]){
				m=j;
				f=1;
			}
		}
		t=a[i];
		a[i]=a[m];
		a[m]=t;
		if(f) c++;
	}
	for(i=0;i<n;i++){
		if(i!=0) printf(" ");
		printf("%d",a[i]);
	}
	printf("\n%d\n",c);
			
    return 0;
}


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

int main() {
  int K,N;
  cin>>K>>N;
  vector<int> p(N);
for (int i = 0; i < N; i++) {
  cin >> p.at(i);
}
  int L=p.at(N-1)-p.at(0);
  for (int i = 0; i < N-1; i++){
    L=min(L,K-p.at(i+1)+p.at(i));
  }
  cout<<L<<endl;
    
}



Measured memory_bytes: 1024
#include <stdio.h>
#include <math.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <queue>
#include <map>
#include <utility>
#include <iomanip>

using namespace std;

#define ll long long

void solve()
{
    ll N, K, S;
    cin >> N >> K >> S;

    ll notS;
    if (S == pow(10, 9))
    {
        notS = pow(10, 9) - 1;
    }
    else
    {
        notS = S + 1;
    }

    for (ll i = 0; i < N - K; i++)
    {
        cout << " " << notS;
    }
    for (ll i = 0; i < K; i++)
    {
        cout << " " << S;
    }

    cout << endl;

    return;
}

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


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

/**
 * Copyright (c)
 * author        :   Sujeet Kumar 
 * question name :   
 * link          :   
 */

#define ll long long
#define ull unsigned long long
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define rep(i,a,n) for (ll i=a;i<n;i++)
#define repA(i,v) for(auto i:v)
#define per(i,a,n) for (ll i=n-1;i>=a;i--)
#define vi vector<int>
#define vll vector<ll>
#define vi2(n,m) vector<vector<int> > v(n,vector<int>(m));

void solve(){
	float d,t,s;cin>>d>>t>>s;
	float ans = (d/s);
	// cout<<ans;
	cout<<((d/s)<=t?"Yes":"No")<<endl;
	return ;
}

int main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL),cout.tie(NULL);
    clock_t start=clock();

	ll test = 1;
	// cin>>test;
	while(test--)	solve();

	clock_t end=clock();
	cerr<<fixed<<setprecision(15)<<((double)(end-start))/CLOCKS_PER_SEC<<endl;
	return 0;
}
/**
 * Test Cases:-
 */


Measured memory_bytes: 3828
import java.util.Scanner;
class Main {

    
    public static void main(String[] args) {
        Scanner x = new Scanner(System.in);
        int a = x.nextInt() , b = x.nextInt();
        int c = a*b;
        int d = 2*a + 2*b;
        System.out.println(c + " " + d);
    }
    
}

Measured memory_bytes: 26120
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
// Welcome to my source code!

int main() {
    int n, k;
    cin >> n >> k;
    int a[n];
    for (int i = 0; i < n; i++) cin >> a[i];
    ll ans = 1e11;
    for (int bit = 0; bit < (1 << n); bit++) {
        if (__builtin_popcount(bit) < k) continue;
        int maxh = 0, cnt = 0;
        ll sum = 0;
        for (int i = 0; i < n; i++) {
            if (bit & (1 << i)) {
                if (a[i] <= maxh) {
                    sum += maxh - a[i] + 1;
                    maxh++;
                } else cnt++;
            }
            maxh = max(maxh, a[i]);
        }
        ans = min(ans, sum);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define vpair(d) vector<pair<d, d> >

using namespace std;


int main()
{
	int n;
	cin >> n;
	
	vector<string> words;
	map<string, int> w;
	string s;
	for(int i = 0; i < n; i ++){
		cin >> s;
		words.push_back(s);
	}

	bool flag = true;
	for(int i =1; i< n; i ++){
		if(words[i][0] != words[i-1][words[i-1].length()-1]){
			flag = false;
		}
		for(int j = 0; j < i; j ++){
			if(words[i] == words[j])
				flag = false;
		}
		if(!flag)
			break;
	}
	
	if(flag){
		cout << "Yes" << endl;
	}else{
		cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n) for (int i = n - 1; i >= 0; i--)
using namespace std;
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
#define EPS (1e-10)
typedef long long ll;
typedef pair<ll, ll> P;
const int MOD = 1000000007;
const int MOD2 = 998244353;


//ref : https://atcoder.jp/contests/abc116/submissions/4327163

int main(){
    ll n, k;
    cin >> n >> k;
    vector<P> sushi(n);
    rep(i, n){
        ll t, d;
        cin >> t >> d;
        t--;
        sushi[i] = {d, t};
    }
    sort(sushi.begin(), sushi.end());
    reverse(sushi.begin(), sushi.end());

    ll ans = 0;
    vector<ll> used(n,0);
    stack<ll> sta;
    ll res = 0;
    ll kind = 0;
    rep(i, k){
        res += sushi[i].first;
        if(used[sushi[i].second]++==0) kind++;
        else sta.push(sushi[i].first);
    }
    ans = res + kind * kind;
    for(int i = k; i < n && sta.size(); i++){
        if(used[sushi[i].second]++)continue;
        ll a = sta.top();
        sta.pop();
        res -= a;
        res += sushi[i].first;
        kind++;
        ans = max(ans, res + kind * kind);
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 5856
//大文字->小文字 tolower(),逆はtoupper()
//int a = stoi(c); 文字列をintへ
//途中の出力をそのまま残さない
//数値計算 個数以外はdouble
//map<キー,値> p は辞書。p[キー] = 値
//map 全探索
//auto begin = p.begin(), end = p.end();
//for (auto it = begin; it != end; it++) {}
//mapのキー：it->first mapのバリュー：it->second
//絶対値 abs()
//入力は空白で切れる
//大文字判定 isupper(文字) 小文字判定 islower(文字)
//do{}while(next_permutation(ALL(配列)))
//while(N)で回すとき、Nはコピーを作っておく
//小文字に対応する文字コード：S[i] - 'a'
//文字コード→小文字：(char)(数字+'a')
//グラフの距離:隣接行列で扱う
//等価なものに変換する思考
//bool型　初期値はTrue
//島渡りの問題：中間ノードに着目
//配列はvector<>を使う：意味わからないエラーがなくなる。
//背反な事象にちゃんとわける
#include <bits/stdc++.h>
#define rep(i,N) for(int i = 0; i < N;i++)
#define ALL(a) (a).begin(),(a).end()
#define ll long long int
using namespace std;

// K進数でのNの桁数
ll dig(ll N, ll K) {
	ll dig = 0;
	while (N) {
		dig++;
		N /= K;
	}
	return dig;
}
// a,bの最大公約数
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a%b);
}

ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}

//nC2の計算
ll C(ll N) {
	return N * (N - 1) / 2;
}

//円周率
const double PI = 3.14159265358979323846;

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

	ll a[7] = { 1,3,5,7,8,10,12 };
	ll b[4] = { 4,6,9,11 };

	for (int i = 0; i < 7; i++) {
		for (int j = 0; j < 7; j++) {
			if (x == a[i] && y == a[j]) {
				cout << "Yes" << endl;
				return 0;
			}
		}
	}

	for (int i = 0; i < 4; i++) {
		for (int j = 0; j < 4; j++) {
			if (x == b[i] && y == b[j]) {
				cout << "Yes" << endl;
				return 0;
			}
		}
	}

	cout << "No" << endl;
}

Measured memory_bytes: 256
#include <boost/multiprecision/cpp_int.hpp>
namespace mp = boost::multiprecision;
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using INT=mp::cpp_int;
using namespace std;
using ll=long long;
using vec=vector<ll>;
using vect=vector<double>;
using Graph = vector<vector<ll>>;
#define loop(i,n) for(ll i=0;i<n;i++)
#define Loop(i, m, n) for(ll i = m;i < n;i++)
#define pool(i,n) for(ll i=n;i>=0;i--)
#define Pool(i, m, n) for(ll i=n;i>=m;i--)
#define MAX 99999999999ll
#define MIN -99999999999ll
#define setbit bitset<8>
#define flagcount __builtin_popcount
#define flag(x) (1<<x)
#define flagadd(bit,x) bit|=flag(x)
#define flagpop(bit,x) bit&=~flag(x) 
#define flagon(bit,i) bit&flag(i)
#define flagoff(bit,i) !(bit & (1<<i))
#define all(v) v.begin(),v.end()
#define low2way(v,x) lower_bound(all(v),x)
#define high2way(v,x) upper_bound(all(v),x)
#define count2way(v,x) high2way(v,x)-low2way(v,x)
#define lower(v,x) low2way(v,x)-v.begin() //1番左が0、もし見つから無いならｎを出力
#define higher(v,x) high2way(v,x)-v.begin()-1 //1番左が0、もし見つからないならn-1を出力（注意）
#define putout(a) cout<<a<<endl
#define putout2(a,b) putout(a);putout(b)
#define putout3(a,b,c) putout(a);putout(b);putout(c)
#define putout4(a,b,c,d) putout(a);putout(b);putout(c);putout(d)
#define putout5(a,b,c,d,e) putout(a);putout(b);putout(c);putout(d);putout(e)
#define Gput(a,b) G[a].push_back(b)
#define cin1(a) cin>>a
#define cin2(a,b) cin>>a>>b
#define cin3(a,b,c) cin>>a>>b>>c
#define cin4(a,b,c,d) cin>>a>>b>>c>>d
#define cin5(a,b,c,d,e) cin>>a>>b>>c>>d>>e
#define sum(v) accumulate(all(v), 0ll)
#define gcd(x,y) __gcd(x,y)
ll ctoi(char c){
	if(c>='0'&&c<='9'){
		return c-'0';
	}
	return 0;
}
ll lcm(ll x,ll y){
  ll z=gcd(x,y);
  return x*y/z;
}
INT LCM(INT x,INT y){
  INT z=gcd(x,y);
  return x*y/z;
}
ll primejudge(ll n){
  if(n<2)return 0;
  else if(n==2)return 1;
  else if(n%2==0)return 0;
  double sqrtn=sqrt(n);
  Loop(i,3,sqrtn+1){
     if(n%i==0){
        return 0;
     }
     i++;
  }
  return 1;
}
INT modinv(INT a, INT m) {
    INT b = m, u = 1, v = 0;
    while (b) {
        INT t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}
int main() {
  cout << fixed << setprecision(30);
  ll n,p;
  cin>>n>>p;
  if(n==1)putout(p);
  else{
  bool check=true;
  queue<ll> prime;
  Loop(i,1,100001)if(primejudge(i))prime.push(i);
  ll primenum=prime.size();
  ll ans=1;
  loop(i,primenum){
    check=true;
    ll count=0;
    ll nowprime=prime.front();
    prime.pop();
    while(check){
      if(p%nowprime!=0)break;
      count++;
      p/=nowprime;
    }
    ans*=pow(nowprime,(count/n));
  }
    
    putout(ans);
  }
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
//#define int long long

using namespace std;
using LL = long long;
using P = pair<int, int>;

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

#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()

const int INF = (int)1e9;
const LL INFL = (LL)1e19;
const int MOD = 1e9 + 7;

signed main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int n, m;
    cin >> n >> m;
    vector<int> a(m), b(m), c(m);
    REP(i, m) cin >> a[i] >> b[i] >> c[i];
    REP(i, m) a[i]--, b[i]--;

    vector<vector<int>> graph(n, vector<int>(n, INF));
    REP(i, m)
    {
        graph[a[i]][b[i]] = c[i];
        graph[b[i]][a[i]] = c[i];
    }

    REP(i, n) graph[i][i] = 0;

    REP(k, n) REP(i, n) REP(j, n)
    {
        graph[i][j] = min(graph[i][j], graph[i][k] + graph[k][j]);
    }

    int ans = 0;
    REP(s, m)
    {
        bool flag = true;
        REP(i, n) REP(j, n) if(graph[i][a[s]] + graph[b[s]][j] + c[s] == graph[i][j]) flag = false;
        if(flag) ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 384
def resolve():
    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]
    k = int(input())
    print(a[k-1])
resolve()

Measured memory_bytes: 3060
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static MyUtil;

class MyUtil
{
    public static void Swap<T>(ref T a, ref T b)
    {
	var t = a;
	a = b;
	b = t;
    }

    public static int[] ReadIntArray()
    {
	return ReadLine().Split().Select(x => int.Parse(x)).ToArray();
    }

    public static long[] ReadLongArray()
    {
	return ReadLine().Split().Select(x => long.Parse(x)).ToArray();
    }
}

class Program
{
    public static void Main()
    {
	var t = ReadIntArray();
	int a = t[0], b = t[1];

	if ((b%a) == 0)
	{
	    WriteLine(a+b);
	}
	else
	{
	    WriteLine(b-a);
	}
    }
}


Measured memory_bytes: 13268
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>

#include <cmath>
#include <cstdlib>
#include <climits>

//#include <stdio.h>
//#include <stdlib.h>



using namespace std;

#define debug false

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

  int N;
  cin >> N;
  vector<vector<int>> A(2), B(2);
  A[0].resize(N, 0);
  A[1].resize(N, 0);
  B[0].resize(N, 0);
  B[1].resize(N, 0);

  for(int i = 0; i < N; i++){
    cin >> A[0][i];
  }
  for(int i = 0; i < N; i++){
    cin >> A[1][i];
  }
  B[0][0] = A[0][0];
  for(int i = 1; i < N; i++){
    B[0][i] = B[0][i-1] + A[0][i];
  }

  B[1][0] = A[1][0] + A[0][0];
  for(int i = 1; i < N; i++){
    B[1][i] = ((B[1][i-1] < B[0][i])?B[0][i]:B[1][i-1]) + A[1][i];
  }

  printf("%d\n", B[1][N-1]);

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <list>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <map>
#include <chrono>
#include <math.h>
using namespace std;

using lli = long long int;
using Vint = std::vector<int>;
using Vlli = std::vector<lli>;
using Wint = std::vector<Vint>;
using Wlli = std::vector<Vlli>;
using Vbool = std::vector<bool>;
using pii = std::pair<int, int>;
using pll = std::pair<lli, lli>;
template <class T>
using Vec = std::vector<T>;

constexpr int MOD = 1e9 + 7;
constexpr int INFi = 2e9 + 1;
constexpr lli INFl = (lli)(9e18) + 1;
const vector<pii> DXDY = {std::make_pair(1, 0), std::make_pair(-1, 0), std::make_pair(0, 1), std::make_pair(0, -1)};
constexpr char BR = '\n';

#define FOR(i, a, b) for(int (i) = (a); (i) < (b); (i)++)
#define FOReq(i, a, b) for(int (i) = (a); (i) <= (b); (i)++)
#define rFOR(i, a, b) for(int (i) = (b); (i) >= (a); i--)
#define FORstep(i, a, b, step) for(int (i) = (a); i < (b); i += (step))
#define REP(i, n) FOR(i, 0, n)
#define rREP(i, n) rFOR(i, 0, (n-1))
#define vREP(ele, vec) for(auto &(ele) : (vec))
#define vREPcopy(ele, vec) for(auto (ele) : (vec))
#define SORT(A) std::sort((A).begin(), (A).end())
// 座標圧縮 (for vector) : ソートしてから使うのが一般的 ; SORT(A) => COORDINATE_COMPRESSION(A)
#define COORDINATE_COMPRESSION(A) (A).erase(unique((A).begin(),(A).end()),(A).end())



template <class T> inline int argmin(std::vector<T> vec){return min_element(vec.begin(), vec.end()) - vec.begin();}
template <class T> inline int argmax(std::vector<T> vec){return max_element(vec.begin(), vec.end()) - vec.begin();}
template <class T> inline void chmax(T &a, T b){a = max(a, b);}
template <class T> inline void chmin(T &a, T b){a = min(a, b);}
inline int BitI(int k){return 1 << k;}
inline lli BitL(int k){return 1L << k;}
inline int toInt(string &s){int res = 0; for(char a : s) res = 10 * res + (a - '0'); return res;}
inline int toInt(const string s){int res = 0; for(char a : s) res = 10 * res + (a - '0'); return res;}
inline long long int toLong(string &s){lli res = 0; for(char a : s) res = 10 * res + (a - '0'); return res;}
inline long long int toLong(const string s){lli res = 0; for(char a : s) res = 10 * res + (a - '0'); return res;}
template <class T> inline std::string toString(T n){
  if(n == 0) return "0";
  std::string res = "";
  if(n < 0){n = -n;while(n != 0){res += (char)(n % 10 + '0'); n /= 10;}
  std::reverse(res.begin(), res.end()); return '-' + res;}
  while(n != 0){res += (char)(n % 10 + '0'); n /= 10;} std::reverse(res.begin(), res.end()); return res;
}

// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~




int main(void){
  int n, c, k; scanf("%d%d%d", &n, &c, &k);
  Vint T(n); REP(i, n) scanf("%d", &T[i]); SORT(T);
  int cnt = 0, i = 0;
  while(i < n){
    int edge = std::min(i + c, n), departure = T[i] + k;
    for(; i < edge; i++){
      if(T[i] > departure) break;
    }
    cnt++;
  }
  printf("%d\n", cnt);
  return 0;
}

Measured memory_bytes: 640
#include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>
#include<string>
#include<queue>
#include<set>
#include<map>
using namespace std;
typedef long long int ll;
typedef vector<pair<ll,ll> > Q;
typedef pair<int,int> P;
#define rep(i,n) for(int i=0;i<(int)(n);i++)

ll det(ll a,ll b)
{
  if(a-b<0) return b-a;
  else return a-b;
}

ll mixi(ll a,ll b)
{
  if(a>b) return b;
  else return a;
}

int main()
{
  int n;
  cin>>n;
  ll sum[n+1],a[n];
  sum[0]=0;
  rep(i,n)
  {
    cin>>a[i];
    sum[i+1]=sum[i]+a[i];
  }

  ll min=1000000000000000000;
  rep(i,n-1)
  {
    ll sunuke=sum[n]-sum[i+1];
    ll kuma=sum[i+1];
    min=mixi(min,det(sunuke,kuma));
  }
  cout<<min<<endl;

}

Measured memory_bytes: 3328
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef vector<int> vi;

#define all(v) (v).begin(),(v).end()
#define sp(k) cout<<setprecision(k)<<fixed;
#define rep(i,a) for(int i=0;i<a;i++)
#define rep1(i,a,b) for(int i=(a);i<=(b);++i)
#define irep(i,b,a) for(int i=(b);i>=(a);--i)
#define minv(v) *min_element(all(v))
#define maxv(v) *max_element(all(v))
#define unq(v) sort(all(v)),(v).erase(unique(all(v)),(v).end())
#define _ ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define endl "\n"


int main(){

        int x,n; cin >> x>>n;
        vi a(n);
        rep(i,n)cin >> a[i];
        sort(all(a));
        int ans = 100000000;
        int ind = 0;
        rep1(i,-200,200){
            bool f = binary_search(all(a),i);
            if(f)continue;
            int p = abs(x-i);
            if(p<ans){
                ind = i;
                ans = p;
            }
        }
        cout<<ind<<endl;


return 0;
}




Measured memory_bytes: 3624
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) {
		try {
			BufferedReader br = new BufferedReader(new InputStreamReader(
					System.in));

			int val = Integer.parseInt(br.readLine());
			int x = 0;

			for (int i = 1; i <= val; i++) {
				if (i % 3 == 0) {
					System.out.print(" " + i);
				} else if (i % 10 == 3) {
					System.out.print(" " + i);
				} else {
					x = i / 10;
					while (x != 0) {
						if (x % 10 == 3) {
							System.out.print(" " + i);
							break;
						}
						x /= 10;
					}
				}
			}
			System.out.println();
			br.close();
		} catch (Exception e) {
			System.err.println(e);
		}
	}
}

Measured memory_bytes: 22016
#include <bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;++i)
#define all(a) a.begin(),a.end()
#define P pair<long long,long long>
#define double long double
using namespace std;
signed main(){
  int a,b,e=0;
  cin>>a>>b;
  int c[550][550];
  rep(i,a){
    rep(j,b){
      cin>>c[i][j];
      c[i][j]%=2;
    }
  }
   int d[300000][4];
  rep(i,a){
    rep(j,b-1){
      if(c[i][j]%2==1){
      c[i][j]=0;c[i][j+1]+=1;
      d[e][0]=i;
       d[e][1]=j;
        d[e][2]=i;
        d[e][3]=j+1;
        e++;
      }
    }
  }
  
  rep(i,a-1){
    if(c[i][b-1]%2==1){
      c[i][b-1]=0;c[i+1][b-1]+=1;
      d[e][0]=i;
       d[e][1]=b-1;
        d[e][2]=i+1;
        d[e][3]=b-1;
      e++;
    }
  }
  cout<<e<<endl;
  rep(i,e){
    rep(j,4){
      cout<<d[i][j]+1;
      if(j==3)
        cout<<endl;
      else
      cout<<' ';
    }
  }
    //  rep(
      /*  rep(k,a){
        rep(l,b){
          if(c[i][j]==c[k][l]&&k==i&&l==j){
            c[i][j]-=1;c[k][l]+=1;
            int m=i,n=j;
            rep(q<<n<<m<<n-1;
                nm<<n<<m<<n+1;
                n++;
              }
              if(m=k){
                cout<<m<<n<<m+1<<n;
                m++;
              }
                if(m==k&&n==l)
                  continue;
            }
          } 
        }
      }  */
}


Measured memory_bytes: 10368
r, c = map(int, input().split())
l = []
sum = [0]*c
for i in range(r):
    l.append(list(map(int, input().split())))
for i in range(r):
    count = 0
    for ii in range(c):
        sum[ii] += l[i][ii]
        count += l[i][ii]
    l[i].append(count)
    print(" ".join(map(str, l[i])))
count = 0
for i in range(c):
    count += sum[i]
sum.append(count)
print(" ".join(map(str, sum)))


Measured memory_bytes: 5704
#include <functional>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <random>
#include <bitset>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;
const ll MOD = 1000000007LL;

int main() {
    cin.sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    int n, k, q;
    cin >> n >> k >> q;

    vector <bool> live(n, true);
    vector <int> count(n, k);

    for (int i = 0; i < q; i++) {
        int a;
        cin >> a;
        a--;

        if (live[a]) {
            if (count[a] - i > 0) {
                count[a]++;
            } else {
                live[a] = false;
            }
        }
    }

    for (int i = 0; i < n; i++) {
        if (live[i] && count[i] > q) {
            cout << "Yes\n";
        } else {
            cout << "No\n";
        }
    }

    return 0;
}

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

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] ab = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            int ans = ab[0] + ab[1];
            ans = Math.Max(ans, ab[0] - ab[1]);
            ans = Math.Max(ans, ab[0] * ab[1]);
            Console.WriteLine(ans);
        }
    }
}


Measured memory_bytes: 13396
n,t = gets.split.map(&:to_i)
a = gets.split.map(&:to_i)

pre = 0
num = 0
mini = 10**10

a.each do |v|
  now = v - mini
  if pre < now
    pre = now
    num = 1
  elsif pre == now
    num += 1
  end

  if v < mini
    mini = v
  end
end

puts num


Measured memory_bytes: 8452
#include <climits>
#include <iostream>

using namespace std;
void _main();
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  _main();
}
typedef long long ll;
const int inf = INT_MAX / 2;
const ll infl = 1LL << 60;

ll N, A, B;
//---------------------------------------------------------------------------------------------------
void _main() {
        std::cin >> N >> A >> B;

        ll len = A + B;
        ll ans = (N / len) * A + min(A, N % len);

        std::cout << ans << std::endl;
}






Measured memory_bytes: 256
#include<iostream>
#include<bits/stdc++.h>
#define Size 100005
using namespace std;
int dp[Size];
int util(int k,vector<int>&vec)
{
  if(dp[k]>0)
  return dp[k];
  for(auto v:vec)
  {
    if(k>=v&&util(k-v,vec)==2)
    {
      dp[k]=1;
      return dp[k];
    }
  }
  dp[k]=2;
  return dp[k];
}
int main()
{
  int n,k;
  cin>>n>>k;
  vector<int> vec;
  for(int i=0;i<n;i++)
  {
    int temp;
    cin>>temp;
    vec.push_back(temp);
  }
  for(int i=0;i<=k;i++)
  dp[i]=-1;
  dp[0]=2;
  int ans=util(k,vec);
  if(ans==1)
  cout<<"First"<<endl;
  else
  cout<<"Second"<<endl;
  return 0;
}


Measured memory_bytes: 5376
#include <iostream>
#include <cstdio>
#include <cstring>

using namespace std;

const int mod = 1e9 + 7;
int f[405][405], a[405][405], l[405], r[405], n, c, b[405][405], ans;

inline int read()
{
	char ch; int res;
	while (ch = getchar(), ch < '0' || ch > '9');
	res = ch - 48;
	while (ch = getchar(), ch >= '0' && ch <= '9')
	res = res * 10 + ch - 48;
	return res;
}

int main()
{
//	freopen("candy.in", "r", stdin);
//	freopen("candy.out", "w", stdout);
	int i, j, k;
	n = read(); c = read();
	for (i = 1; i <= n; i++) l[i] = read();
	for (i = 1; i <= n; i++) r[i] = read();
	for (i = 1; i <= n; i++)
	for (int x = l[i]; x <= r[i]; x++)
	{
		int y = 1;
		for (j = 0; j <= c; j++)
		{
			a[i][j] = (a[i][j] + y) % mod;
			y = 1ll * y * x % mod;
		}
	}
	f[0][0] = 1;
	for (i = 1; i <= n; i++)
	for (j = 0; j <= c; j++)
	for (k = 0; k <= j; k++)
	f[i][j] = (f[i][j] + 1ll * f[i - 1][k] * a[i][j - k]) % mod;
	cout << f[n][c] << endl;
	fclose(stdin);
	fclose(stdout);
	return 0;
}

Measured memory_bytes: 1536
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MOD 1000000007
#define INF 1e9
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()

int main(){
    string s;
    cin>>s;
    stack<char> st;
    int n=s.size();
    rep(i,n){
        if(s[i]=='S') st.push(s[i]);
        else{
            if(!st.empty()) st.pop();
        }
    }
    cout<<2*st.size()<<endl;
}

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

int main() {
  int c[9];
  for(int i = 0; i < sizeof(c); i++) cin >> c[i];
  cout << (c[0]+c[4]+c[8] == c[1]+c[5]+c[6] && c[0]+c[4]+c[8] == c[2]+c[3]+c[7] ? "Yes" : "No") <<endl;
}


Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
	// write your code here

        Scanner scan = new Scanner(System.in);
String         N = scan.next();
int p=0;
for(int i=0;i<N.length();i++){
    p=p+Integer.parseInt(N.substring(i,i+1));
}
p=p%9;
if(p==0){System.out.println("Yes");}
else{System.out.println("No");}
    }
}


Measured memory_bytes: 40532
#include<stdio.h>

int main(){
	long int a, b;
	char op;
	for(int i=0; ; i++){
		scanf("%ld %c %ld", &a, &op, &b);
		if(op == '+') printf("%ld\n", a+b);
		else if(op == '-') printf("%ld\n", a-b);
		else if(op == '*') printf("%ld\n", a*b);
		else if(op == '/' && b!=0) printf("%ld\n", a/b);
		else if(op == '?') break;
	}
}


Measured memory_bytes: 2704
function Main(input) {
	input = input.trim();
  var list = "abcdefghijklmnopqrstuvwxyz".split("");
  for(var i = 0; i < input.length; i++){
    var tmp = input.slice(i , i + 1);
    if(list.indexOf(tmp) != -1){
       list.splice(list.indexOf(tmp), 1);
       }else{
         console.log("no");
         return;
       }
  }
  console.log("yes");
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));


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

#define ll long long
#define vecint vector<int>
#define listint list<int>

#define REP(i,x,n) for(int i=x;i<n;i++)
#define rep(i,n) REP(i,0,n)
#define print(a) cout << a << endl

#define MOD 1000000007;


int main(){
  int H,W;
  cin>>H>>W;
  char def[H][W];
  rep(i,H){
    cin>>def[i];
  }
  char ans[2*H][W];
  rep(i,H)rep(j,W){
    ans[2*i][j]=def[i][j];
    ans[2*i+1][j]=def[i][j];
  }
  rep(i,2*H){
    rep(j,W){
      cout<<ans[i][j];
    }
    cout<<endl;
  }
  return 0;
}


Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var h, w, a, b int
	fmt.Scan(&h, &w, &a, &b)

	for i := 0; i < h; i++ {
		for j := 0; j < a; j++ {
			if i < b {
				fmt.Print(0)
			} else {
				fmt.Print(1)
			}
		}
		for j := a; j < w; j++ {
			if i < b {
				fmt.Print(1)
			} else {
				fmt.Print(0)
			}
		}
		fmt.Println()
	}
}


Measured memory_bytes: 8452
#include <stdio.h>
#include <stdlib.h>
struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};
typedef struct node * Node;

Node root;

void insert(int);
void inorder(Node);
void preorder(Node);
Node treeSearch(Node,int);

int main(){
  int i,m,*s,x,n;
  char com[20];
  scanf("%d",&n);
  
  for(i=0;i<n;i++){
      scanf("%s", com);
      if( com[0] == 'i' ){
      scanf("%d", &x);
      insert(x);
      }
      else if ( com[0] == 'p' ){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    }
    else if ( com[0] == 'f' ){
      scanf("%d", &x);
      Node t = treeSearch(root, x);
      if ( t != NULL ) printf("yes\n");
      else printf("no\n");
    }
  }
  return 0;
}

void insert(int k){
    Node y=NULL;
    Node x=root;
    Node z;
    z=malloc(sizeof(struct node));
    z->key=k;
    z->left=NULL;
    z->right=NULL;
    while(x!=NULL){
        y=x;
        if(z->key < x->key) x=x->left;
        else x=x->right;
    }
    z->parent=y;
    if(y==NULL) root=z;
    else if(z->key < y->key) y->left=z;
    else y->right=z;
}

void inorder(Node u){
    if(u!=NULL){
        inorder(u->left);
        printf(" %d",u->key);
        inorder(u->right);
    }
}

void preorder(Node u){
    if(u!=NULL){
        printf(" %d",u->key);
        preorder(u->left);
        preorder(u->right);
    }
}

Node treeSearch(Node u,int k){
    while(u!=NULL && k!=u->key){
        if(k<u->key) u=u->left;
        else u=u->right;
    }
    return u;
}


Measured memory_bytes: 20516
#!/usr/bin/env python3
import sys

def next_lunlun(x):
    K = len(x)
    if len(x) == 1:
        return str(int(x) + 1)
    elif x[-1] == '9':
        next =  next_lunlun(x[:-1])
        if int(next[-1]) - 1 >= 0:
            return next + str(int(next[-1]) - 1)
        else:
            return next + '0'
    elif x[-2] >= x[-1]:
        return x[:-1] + str(int(x[-1]) + 1)
    elif x[-2] < x[-1]:
        next = next_lunlun(x[:-1])
        if int(next[-1]) - 1 >= 0:
            return next + str(int(next[-1]) - 1)
        else:
            return next + '0'


def solve(K: int):
    x = '0'
    for k in range(K):
        x = next_lunlun(x)
    print(x)
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    K = int(next(tokens))  # type: int
    solve(K)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
#include<iostream>
#include<cstdio>
using namespace std;
int ans,s;
void dfs(int n, int b,int sum);
int main(){
  int n;
  while(1){
    scanf("%d %d",&n,&s);
    ans = 0;
    if(n == 0 && s == 0)break;
    for(int i = 0; i <= 9; i++){
      dfs(n,i,i);
    }
    printf("%d\n",ans);
  }
}
void dfs(int n, int b,int sum){
  if(sum == s && n == 1){
    ans++;
  }
  for(int i = b + 1; i <= 9; i++){
    dfs(n-1,i,sum + i);
  }
}

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

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

    std::vector<int> h(n);

    for ( int i = 0; i < n; i++ ) {
        cin >> h[i];
    }

    sort(h.begin(), h.end());

    int cnt = 0;
    for ( int i = 0; i < n; i++ ) {
        if ( h[i] >= k ) {
            cnt++;
        }
    }

    cout << cnt << endl;

    return 0;
}

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

int main() {
  int n, k;
  cin >> n >> k;
  vector<int> a(n), s(n + 1);
  for (int i = 0; i < n; i++) {
    cin >> a.at(i);
    a.at(i)--;
  }
  for (int i = 0; i < n; i++) {
    s.at(i + 1) = (s.at(i) + a.at(i)) % k;
  }
  long long ans = 0;
  map<int, int> mp;
  queue<int> q;
  for (int i = 0; i < n + 1; i++) {
    ans += mp[s.at(i)];
    mp[s.at(i)]++;

    q.push(s.at(i));
    if (q.size() == k) {
      mp[q.front()]--;
      q.pop();
    }
  }
  cout << ans;
  return 0;
}

Measured memory_bytes: 12032
#include <algorithm>
#include<stdio.h>
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <string>
#include <algorithm>
#include <vector>
#include <math.h>
#include<stack>
#include <queue>
#include<map>
#include <set>
#include<math.h>
#include<fstream>
using namespace std;
#define int long long
#define ll long long
#define rep(i,n) for(ll i=0;i<n;++i)
#define loop(i,m,n) for(ll i=m;i<n;++i)
#define ggr getchar(); getchar();return 0;
#define pie 3.141592653589793238462643383279
#define elif else if
#define P pair<ll,ll>
const int inf = 1000000007;
int bin(int bina) {
	int ans = 0;
	for (int i = 0; bina > 0; i++)
	{
		ans = ans + (bina % 2) * pow(10, i);
		bina = bina / 2;
	}
	return ans;
}
bool prime(int n) {
	for (ll i = 2; i <= sqrt(n); i++) {
		if (n % i == 0)return false;
	}
	return n != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x * y / gcd(x, y);
}
int kai(int x) {
	if (x == 0)return 1;
	return kai(x - 1) * x % inf;
}
int mod_pow(int x, int y, int mod) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % mod;
		}
		x = x * x % mod;
		y >>= 1;
	}
	return res;
}
int comb(int x, int y) {
	return kai(x)* mod_pow(kai(x - y), inf - 2, inf) % inf * mod_pow(kai(y), inf - 2, inf) % inf;
}
struct union_find {
	int par[200010], size_[200010];
	void init(int x) {
		rep(i, x) { par[i] = i; size_[i] = 1; }
	}
	int find(int x) {
		if (par[x] == x)return x;
		return par[x] = find(par[x]);
	}
	void unite(int x, int y) {
		x = find(x); y = find(y);
		if (x == y)return;
		if (size_[x] < size_[y]) {
			par[x] = y;
			size_[y] += size_[x];
		}
		else {
			par[y] = x;
			size_[x] += size_[y];
		}
	}
};
struct edge { int to, cost; };
int a[100010], b[100010];
signed main() {
	int n;
	cin >> n;
	rep(i, n + 1) {
		cin >> a[i];
	}
	rep(i, n) {
		cin >> b[i];
	}
	int sum = 0;
	rep(i, n) {
		if (b[i] < a[i]) {
			sum += b[i];
		}
		else {
			if (a[i] + a[i + 1] >= b[i]) {
				sum += b[i];
				a[i + 1] = a[i + 1] - b[i] + a[i];
			}
			else {
				sum += a[i] + a[i + 1];
				a[i + 1] = 0;
			}
			a[i] = 0;
		}
	}
	cout << sum << endl;
}



Measured memory_bytes: 1792
void main() {
	auto R = ri;
	auto G = ri;
	writeln((G - R)*2 + R);
}

// ===================================

import std.stdio;
import std.string;
import std.functional;
import std.conv;
import std.algorithm;
import std.range;
import std.traits;
import std.math;
import std.container;
import std.bigint;
import std.numeric;
import std.conv;
import std.typecons;
import std.uni;
import std.ascii;
import std.bitmanip;
import core.bitop;

T readAs(T)() if (isBasicType!T) {
	return readln.chomp.to!T;
}
T readAs(T)() if (isArray!T) {
	return readln.split.to!T;
}

T[][] readMatrix(T)(uint height, uint width) if (!isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		res[i] = readAs!(T[]);
	}
	return res;
}

T[][] readMatrix(T)(uint height, uint width) if (isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		auto s = rs;
		foreach(j; 0..width) res[i][j] = s[j].to!T;
	}
	return res;
}

int ri() {
	return readAs!int;
}

double rd() {
	return readAs!double;
}

string rs() {
	return readln.chomp;
}

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

#define REP(i, n) for(int (i)=0;(i)<(n);++(i))
#define REPV(iter, v) for(auto (iter)=(v).begin(); (iter)!=(v).end();++(iter))
#define ALL(v) (v).begin(),(v).end()

#define MOD 1000000007

using namespace std;

typedef long long ll;

int main()
{
    ll N;
    cin >> N;
    vector<double> v(N);
    REP(i, N) cin >> v[i];
    sort(ALL(v));
    double ans = v[0];
    REP(i, N - 1)
    {
        ans += v[i + 1];
        ans /= 2;
    }

    cout << ans << endl;
}


Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
using namespace std;
template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }
typedef long long ll;
typedef vector<int> vint;
typedef pair<int, int> pint;
typedef vector<long long> vlong;
typedef vector<string> vstring;
#define vpush(a,x) a.push_back(x);
#define rep(i, n) REP(i, 0, n)
#define all(v) v.begin(), v.end()
#define REP(i, x, n) for(int i = x; i < n; i++)
const int INF = 1 << 30;
const int dx[] = {1,0,-1,0,1,1,-1,-1};
const int dy[] = {0,-1,0,1,1,-1,-1,1};
#define stp(x)  setprecision(x)
const long double PI=3.14159265358979323846264338327950;
int main(){
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  deque<long long> dq;
  int q;
  cin>>q;
  rep(i,q){
    int tmp;
    cin>>tmp;
    if(tmp==0){
      long long d,x;
      cin>>d>>x;
      if(d==0){
        dq.push_front(x);
      }
      else{
        dq.push_back(x);
      }
    }
    else if(tmp==1){
      long long p;
      cin>>p;
      cout<<dq[p]<<'\n';
    }
    else{
      long long d;
      cin>>d;
      if(d==0){
        dq.pop_front();
      }
      else{
        dq.pop_back();
      }
    }
  }

  return(0);
}


Measured memory_bytes: 6288
import java.util.Scanner;


public class Main {

	public static void main(String [] args) {
		
		Scanner sc = new Scanner(System.in);
		
		while(true) {
			
			long m = sc.nextInt();
			long f = sc.nextInt();
			long r = sc.nextInt();
			
			if(m == -1 && f == -1 && r == -1) break;
				
			String point = new String();
			
			if(m == -1 || f == -1) {
				point = "F";
				
			}else if(m + f >= 80) {
				point = "A";
				
			}else if(m + f >= 65) {
				point = "B";
				
			}else if(m + f >= 50) {
				point = "C";
				
			}else if(m + f >= 30) {
				if(r >= 50) {
					point = "C";
				}else {
					point = "D";
					
				}
				
			}else if(m + f >= 0) {
				point = "F";
				
			}
			
			System.out.println(point);
			
			
		}
			
		}

		

}


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

// #undef DEBUG  // Uncomment this line to forcefully disable debug print.
#if DEBUG
template <typename T>
void debug(T value) {
  std::cerr << value;
}
template <typename T, typename... Ts>
void debug(T value, Ts... args) {
  std::cerr << value << ", ";
  debug(args...);
}
#define dbg(...)                              \
  do {                                        \
    cerr << #__VA_ARGS__ << ": ";             \
    debug(__VA_ARGS__);                       \
    cerr << " (L" << __LINE__ << ")" << endl; \
  } while (0)
#else
#define dbg(...)
#endif

void read_from_cin() {}
template <typename T, typename... Ts>
void read_from_cin(T& value, Ts&... args) {
  std::cin >> value;
  read_from_cin(args...);
}
#define in(type, ...) \
  type __VA_ARGS__;   \
  read_from_cin(__VA_ARGS__);

template <typename T>
void write_to_cout(const T& value) {
  std::cout << value << std::endl;
}
template <typename T, typename... Ts>
void write_to_cout(const T& value, const Ts&... args) {
  std::cout << value << ' ';
  write_to_cout(args...);
}
#define out(...) write_to_cout(__VA_ARGS__);

#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)

using ll = long long;

using namespace std;

int main() {
  in(int, n);
  map<string, int> m;
  rep(i, n) {
    in(string, s);
    m[s]++;
  }
  for (auto k : {"AC", "WA", "TLE", "RE"}) {
    out(k, 'x', m[k]);
  }
}


Measured memory_bytes: 3628
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//イテレータあるけど順序保持しないmap
#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列

// vectorの重複削除
// std::sort(test.begin(), test.end());
// test.erase(std::unique(test.begin(), test.end()), test.end());

using namespace std;
using ll = long long;
using P = pair<int, int>; // vector<P> ba(n); みたいな感じですぐ使える ba[i] = P(a, b); make_pairをしなくてもいい
// typedef vector<int> v;
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;}
#define rep(i, c) for(int i = 0; i < int(c); i++)
#define ALL(x) (x).begin(), (x).end() //sort(ALL(obj))みたいな
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x)) //最大値
#define pb push_back //
// const int MOD = 1000000007;


int main() {
  string n;
  cin >> n;
  if (n == "ABC") cout << "ARC" << endl;
  else cout << "ABC" << endl;
}


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

//D
int main()
{
    int N;
    cin >> N;
    string s;
    cin >> s;
    
    long ans = 0;
    for(int i = 0;i<N;i++)
    {
        int x=0;
        int y = 0;
        if(s[i] == 'R')
        {
            
            for(int j=i+1;j<N;j++)
            {
                if(s[j] == 'G')
                {
                    x++;
                }
                else if(s[j] == 'B')
                {
                    y++;
                }
            }
        }
        else if(s[i] == 'G')
        {
            
            for(int j=i+1;j<N;j++)
            {
                if(s[j] == 'R')
                {
                    x++;
                }
                else if(s[j] == 'B')
                {
                    y++;
                }
            }
        }
        else
        {
            
            for(int j=i+1;j<N;j++)
            {
                if(s[j] == 'G')
                {
                    x++;
                }
                else if(s[j] == 'R')
                {
                    y++;
                }
            }
        }
        
        ans += x*y;
    }
    
    for(int i = 0;i<N;i++)
    {
        for(int j= 1;2*j<N-i;j++)
        {
            if(s[i] != s[i+j] && s[i] != s[i+2*j] && s[i+j] != s[i+2*j])
            {
                ans--;
            }
        }
    }
    
    cout <<ans << endl;
    
    return 0;
}

Measured memory_bytes: 3628
def main():
    import sys
    input = sys.stdin.readline
    A, V = map(int, input().split())
    B, W = map(int, input().split())
    T = int(input())
    if W >= V:
        print("NO")
        sys.exit()
    x = abs(A-B)
    v = V-W
    if x > T*v:
        print("NO")
    else:
        print("YES")

if __name__ == '__main__':
    main()

Measured memory_bytes: 9196
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,m,n) for(int i=(m);i<(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
using ll = long long;
template <typename T> using posteriority_queue = priority_queue<T, vector<T>, greater<T> >;
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-8;
const int MOD = 1000000007;
// const int MOD = 998244353;
const int dy[] = {1, 0, -1, 0}, dx[] = {0, -1, 0, 1};
// const int dy[] = {1, 1, 0, -1, -1, -1, 0, 1}, dx[] = {0, -1, -1, -1, 0, 1, 1, 1};
template <typename T, typename U> inline bool chmax(T &a, U b) { return a < b ? (a = b, true) : false; }
template <typename T, typename U> inline bool chmin(T &a, U b) { return a > b ? (a = b, true) : false; }
template <typename T> void unique(vector<T> &a) { a.erase(unique(ALL(a)), a.end()); }
struct IOSetup {
  IOSetup() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);
  }
} iosetup;

int main() {
  int k, x; cin >> k >> x;
  cout << (500 * k >= x ? "Yes\n" : "No\n");
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
		long long n,k;
		cin>>n>>k;
		long long p[n];
		for(long long i=0;i<n;i++){
			cin>>p[i];
		
		}
		long long sum=0;
        sort(p,p+n);
        for(int i=0;i<k;i++){
        	sum+=p[i];
		}
		cout<<sum<<endl;
return 0;
}

Measured memory_bytes: 3596
N=int(input())
L=[[0,0,0]]
for i in range(N):
  L.append(list(map(int,input().split())))

s=0
for i in range(1,N+1):
  x=abs(L[i][1]-L[i-1][1])
  y=abs(L[i][2]-L[i-1][2])
  t=L[i][0]-L[i-1][0]
  if x+y>t or (t-x-y)%2==1:
    s=1
    break

print("Yes" if s==0 else "No")

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

using namespace std;
using ll = long long;

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define debug(x) cout << #x << ": " << x << endl;
#define popcnt __builtin_popcount

const ll INF = (ll) 1e15;

int main() {
    int N;
    cin >> N;
    vector<ll> a(N), cum(N + 1, 0LL);
    for (int i = 0; i < N; ++i) {
        cin >> a[i];
        cum[i + 1] = cum[i] + a[i];
    }

    ll res = INF;
    for (int mid = 2; mid <= N - 1; ++mid) {
        int left_idx = distance(cum.cbegin(), lower_bound(cum.cbegin(), cum.cend(), cum[mid] / 2));
        int right_idx = distance(cum.cbegin(),
                                 lower_bound(cum.cbegin(), cum.cend(), cum[mid] + (cum[N] - cum[mid]) / 2));
        ll left_mn = max(cum[left_idx - 1], cum[mid] - cum[left_idx]), left_mx = cum[mid] - left_mn;
        ll right_mn = max(cum[right_idx - 1] - cum[mid], cum[N] - cum[right_idx]), right_mx =
                (cum[N] - cum[mid]) - right_mn;
        res = min(res, max(left_mx, right_mx) - min(left_mn, right_mn));
    }
    cout << res << endl;

    return 0;
}

Measured memory_bytes: 3456
# 45
import sys


def input(): return sys.stdin.readline().strip()
def I(): return int(input())
def LI(): return list(map(int, input().split()))
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def S(): return input()
def LS(): return input().split()


INF = float('inf')


n, c, k = LI()
t = IR(n)
t.sort()
t_limit = list(map(lambda x: x+k, t))
ans = 0
i = 0
bus = 0
limit = 0
while i < n:
    # print(f'{(i, bus, limit, ans)=}')
    if bus == 0:
        # print('新しいバス')
        limit = t_limit[i]
        bus += 1
    elif bus < c:  # バスに空きがある
        # print('バスに空きがある')
        # print(f'{(i, t[i])=}')
        if t[i] <= limit:  # 間に合う
            # print('間に合う')
            bus += 1
        else:  # 新しいバスに乗る
            # print('間に合わない')
            ans += 1
            bus = 1
            limit = t_limit[i]
    else:  # バスが満杯
        ans += 1
        bus = 1
        limit = t_limit[i]
    i += 1
print(ans + 1)


Measured memory_bytes: 17544
#include<iostream>
#include<iomanip>
#include<vector>
#include<algorithm>
#include<cstdlib>
template<typename T>
void fin(T const& t){ std::cout << t << std::endl; exit(0); }

int const MAXN = 600;
double const INF = 1e30;

std::vector<int> G[MAXN];
double ex[MAXN];
int h;

double calc(int v) {
  if(ex[v] < INF) return ex[v];
  double res = 1;
  double num = 0, mx = 0, sum = 0;
  for(auto c: G[v]) {
    ++num;
    double e = calc(c);
    sum += e;
    mx = std::max(mx, e);
  }
  if(v == h) {
    sum -= mx;
    --num;
  }
  res += sum/num;
  return ex[v] = res;
}

int main() {
  std::cout << std::setprecision(10) << std::fixed;
  int N, M; std::cin >> N >> M;
  for(int i = 0; i < M; ++i) {
    int s, t; std::cin >> s >> t; --s; --t;
    G[s].push_back(t);
  }
  h = -1;
  std::fill_n(ex, N, INF);
  ex[N-1] = 0e0;
  double ans = calc(0);
  for(h = 0; h < N-1; ++h) if(G[h].size() > 1) {
    std::fill_n(ex, N, INF);
    ex[N-1] = 0e0;
    ans = std::min(ans, calc(0));
  }
  fin(ans);
  return 0;
}


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

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  int vals[n];
  for (int i = 0; i < n; i++) cin >> vals[i];
  int res = 10000000;
  for (int i = 1; i <= 100; i++) {
    int aux = 0;
    for (int j = 0; j < n; j++) {
      aux += pow(vals[j] - i, 2);
    }
    res = min(res, aux);
  }
  cout << res << '\n';
  return 0;
} 

Measured memory_bytes: 256