akhauriyash/Code-Regression huggingface dataset:
N, T = map(int, input().split())

ans = 1001
tmp = 1001

for i in range(N):
    ansT, tmpT = map(int, input().split())
    if T >= tmpT:
        ans = min(ans, ansT)

if ans == 1001:
    print('TLE')
else:
    print(ans)

Measured memory_bytes: 3060
def read_input():
	N = int(raw_input())
	B = map(int, raw_input().split())
	return B


#################### main ####################

#t0 = time.clock()
B = read_input()
s = B[0] + sum(min(b1, b2) for b1, b2 in zip(B, B[1:])) + B[-1]
print s


Measured memory_bytes: 28012
#include<bits/stdc++.h>
#define ull unsigned long long
#define ll long long
#define F first
#define S second
#define pss pair<string,string>
#define pcc pair<char,char>
#define pll pair<ll,ll>
#define pii pair<int,int>
#define piii pair<int,pii>
#define vi vector<int>
#define vii vector<pii>
#define pb push_back
#define vs vector<string>
#define vl vector<ll>
#define vs vector<string>
#define vll vector<pll>
#define vss vector<pss>
#define vcc vector<pcc>
#define MP make_pair
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=n-1;i>=0;i--)
#define Very_fast std::ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
const int N = 1e5+5;
const int mod=1e9+7;
const int INF=0x3f3f3f3f;
inline ll gcd(ll a,ll b){if(b==0)return a;else return gcd(b,a%b);}
inline ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
inline ll lowbit(ll x){return (x&-x);}
inline ll kissme(ll x,ll y)
{
	ll res=1;
	if(x==0)return 1;
	if(x==1)return y;
	res=kissme(x/2,y);
	res=res*res%mod;
	if(x%2==1)res=res*y%mod;
	return res;
}
int n,cnt[N],k,m;
signed main()
{
	Very_fast;
	cin>>n>>k;
	for(int i=0;i<k;i++)
	{
		cin>>m;
		while(m--)
		{
			int x;
			cin>>x;
			cnt[x]++;
		}
	}
	int ans=0;
	for(int i=1;i<=n;i++)
	{
		if(!cnt[i])
			ans++;
	}
	cout<<ans<<"\n";
	return 0;
}

Measured memory_bytes: 3620
#include<iostream>
#include<algorithm>
using namespace std;
const int INF=100000;
int main(){
    int N;
    int M;
    cin >> N >> M;

    int c[22];
    for(int i=0;i<M;i++){
        cin >> c[i];
    }

    int dp[55555];
    for(int i=0;i<N+1;i++){
        dp[i]=INF;
    }
    dp[0]=0;
    
    for(int i=1;i<=N;i++){
        for(int j=0;j<M;j++){
            if(c[j]<=i){
                dp[i]=min(dp[i],dp[i-c[j]]+1);
            }
        }
    }

    cout << dp[N] << endl;
    return 0;
}


Measured memory_bytes: 3324
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <math.h>
#include <cassert>
#define rep(i,n) for(int i = 0; i < n; ++i )
using namespace std;
using ll = long long;
using P = pair<int,int>;

const int MAX = 2505;
ll dp[55][MAX];
int main() {
  int n,a;
  cin >> n >> a;
  dp[0][0] = 1;
  rep(i,n){
    int x;
    cin >> x;
    rep(ik,i+1){
      int k = i-ik;
      rep(v,MAX-x) dp[k+1][x+v] += dp[k][v];
    }
  }
  ll ans = 0;
  rep(i,n) ans += dp[i+1][(i+1)*a];
  cout << ans << endl;
}


Measured memory_bytes: 4520
#include<bits/stdc++.h>
using namespace std;
    int main()
    {
    	cin.tie(0);
        ios::sync_with_stdio(0);
    	int s,w;
    	cin>>s>>w;
    	if(w>=s)cout<<"unsafe";
    	else
    		cout<<"safe";
    	return 0;
    }
    


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

int main(){
  int A,B,H,M;
  static const double pi = 3.141592653589793;
  double Akaku,Bkaku,lkaku,skaku,radian,ans;
  cin>>A>>B>>H>>M;
  
  Bkaku=M*6;
  Akaku=H*30+0.5*M;
  lkaku=max(Bkaku,Akaku);
  skaku=min(Bkaku,Akaku);
  radian=lkaku-skaku;
  if(radian==180){
    cout<<A+B<<endl;
    return 0;
  }
  if(radian==0){
    if(B-A<0)
      ans=A-B;
    else
      ans=B-A;
    cout<<ans<<endl;
    return 0;
  }
  if(radian>180)
    radian=360-radian;
  

  ans=A*A+B*B-2*A*B*cos(radian*M_PI/180);
 
  ans=pow(ans,0.5);
  cout << fixed << setprecision(20);
  cout<<ans<<endl;


}

Measured memory_bytes: 4320
import sys

input = sys.stdin.readline


def main():
    N = int(input())
    S = input().rstrip()

    if N % 2 == 1:
        ans = "No"
    else:
        if S[:N // 2] == S[N // 2:]:
            ans = "Yes"
        else:
            ans = "No"

    print(ans)


if __name__ == "__main__":
    main()


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

vector<long long> divList(long long n) {
    vector<long long> res;
    for(long long i = 1; i * i <= n; ++i) {
        if(n % i == 0) {
            res.push_back(i);
            if(i * i != n) res.push_back(n / i);
        }
    }
    sort(res.begin(), res.end());
    return res;
}

int main() {
    long long A, B;
    cin >> A >> B;
    vector<long long> a = divList(A);
    vector<long long> b = divList(B);
    set<long long> st;
    for(auto &u : a) st.insert(u);
    vector<long long> c;
    for(auto &u : b) {
        if(st.count(u) == 1) c.push_back(u);
    }
    int N = c.size();
    vector<int> ok(N, 1);
    int ans = 1;
    rep(i, 1, N) {
        if(ok[i]) {
            ans++;
            rep(j, i, N) {
                if(ok[j] && c[j] % c[i] == 0) {
                    ok[j] = 0;
                }
            }
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 768
#include <stdio.h>
int main(void)
{
  int i,j,k=0,l,m,n;
  scanf("%d",&i);
  for(j=1;j<=i;j++){
    if(j%3==0){
      printf(" %d",j);
      k=1;
    }
    n=j;
    for(l=0;l<4;l++){
      m=n%10;
      if(m==3&&k==0){
        printf(" %d",j);
        k++;
      }
      n=n-m;
      n=n/10;
    }
    k=0; 
  }
  printf("\n");
  return 0;
}

Measured memory_bytes: 600
#include <cstdio>
#include <cstring>
using namespace std;

int main() {
  char s[100];
  while (fgets(s, sizeof(s), stdin)) {
    while (1) {
      for (int i = 0; s[i] != '\0'; i++) {
        if (s[i] >= 'a' && s[i] < 'z') s[i]++;
        else if (s[i] == 'z') s[i] = 'a';
        else if (s[i] == '\n') s[i] = '\0';
      }
      if (strstr(s, "the") || strstr(s, "this") || strstr(s, "that")) break;
    }
    puts(s);
  }
}


Measured memory_bytes: 2448
import collections

N=int(input())
a=list(map(int,input().split()))
a.sort()

cnt=0

c=collections.Counter(a)
#print(c)

for item in c:
  t=c[item]
  if t>item:
    cnt+=t-item
  elif t==item:
    pass
  else:
    cnt+=t

#while len(a)>0:
#  item=a[0]
#  t=(item)
#  #print(item,t,a)
#  if t>item:
#    cnt+=t-item
#  elif t==item:
#    pass
#  else:
#    cnt+=t
#  del a[0:t]
#  #print("after",a)
  
print(cnt)

Measured memory_bytes: 68904
/*
 * 縦横に無限に広がるマス目があり、そのうちの連続する N 行 M 列の領域のすべてのマスに表裏の区別できるカードが置かれています。 最初はすべてのカードが表を向いています。
 * 
 * 以下の操作を、カードが置かれている全てのマスについて 1 度ずつ行います。
 * 
 *     そのマスと辺または点で接する 8 つのマスと、そのマスの合計 9 マスについて、カードが存在するなら裏返す。
 * 
 * すべての操作を行った後の各カードの状態は操作を行う順番に依らないことが証明できます。 すべての操作を行った後、裏を向いているカードの枚数を求めてください。
 */

import java.util.*;
	public class Main{
        public static void main(String[] args){
            Scanner sc = new Scanner(System.in);
            //入力
            long n = Integer.parseInt(sc.next());
            long m = Integer.parseInt(sc.next());
            long ret = 0;
            
            // 
            if(n>1 && m>1){
            	// どの辺も長さが2以上なら内側の部分が裏になる
            	ret = (n-2) * (m-2);
            }else if(n==1 && m==1){
            	// 1マスのときはそれは裏になる
            	ret = 1;
            }else{
            	// マス1列のときは両端以外が裏になる
            	ret = Math.max(n, m) - 2;
            }
            
            //出力
            System.out.println(ret);
            sc.close();
        }
    }
	

Measured memory_bytes: 23124
#include <iostream>
#include <utility>
#include <vector>
#include <algorithm>

int main(void)
{
    std::vector<std::pair<int, int>> AB;
    int N, M;
    std::cin >> N >> M;

    int a, b;
    for (int i = 0; i < M; ++i)
    {
        std::cin >> a >> b;
        AB.push_back(std::make_pair(a, b));
    }

    std::sort(AB.begin(), AB.end());
    int min_b = AB[0].second;
    int cnt = 1;
    for (int i = 0; i < M; ++i)
    {
        if (min_b <= AB[i].first)
        {
            ++cnt;
            min_b = AB[i].second;
        }
        else
        {
            min_b = std::min(min_b, AB[i].second);
        }
    }

    std::cout << cnt << std::endl;
    return 0;
}


Measured memory_bytes: 1400
/* Never Say Die */
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <ctime>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <bitset>
using namespace std;
typedef long long LL;
typedef double D;
typedef pair<int, int> pii;
#define mp(a, b) make_pair(a, b)
#define fir first
#define sec second
inline int min(int a, int b) {return a < b ? a : b;}
inline int max(int a, int b) {return a > b ? a : b;}
int ch = 0;
template <class T> inline void read(T &a) {
	bool f = 0; a = 0;
	while (ch < '0' || ch > '9') {if (ch == '-') f = 1; ch = getchar();}
	while (ch >= '0' && ch <= '9') {a = a * 10 + ch - '0'; ch = getchar();}
	if (f) a = -a;
}

int n, ans = 0X3f3f3f3f;
string s;
int a[105][105];

int work(char x) {
	for (int i = 1; i <= n; i++) a[n][i] = s[i - 1] == x;
	for (int i = n; i; i--) {
		bool flag = 1;
		for (int j = 1; j <= i; j++) {
			if (!a[i][j]) flag = 0;
		}
		if (flag) return n - i;
		for (int j = 1; j < i; j++) a[i - 1][j] = max(a[i][j], a[i][j + 1]);
	}
	return ans;
}

int main() {
	cin >> s;
	n = (int)s.size();
	for (char i = 0; i < n; i++) ans = min(ans, work(s[i]));
	printf("%d\n", ans);
	return 0;
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
//#define DEBUG_MODE
#define endl '\n'
#ifdef DEBUG_MODE
#define DEBUG(X) debug_func(X, #X)
#define DEBUG_ENDL endl
#define DEBUG_SEPARATOR_LINE cout<<"=================\n"
#else
#define DEBUG(X) 0
#define DEBUG_ENDL 0
#define DEBUG_SEPARATOR_LINE 0
#endif
#define ALL(V) (V).begin(), (V).end()
#define ALLR(V) (V).rbegin(), (V).rend()
#define DEBUG_ENDL_S(S) ((S).size() ? "\n" : "")
template <typename T> using V = vector<T>;
template <typename T> using VV = V<V<T>>;
template <typename T, typename U> using P = pair<T, U>;
using ll = int64_t;
using PLL = P<ll, ll>;
template <typename T> const T& var_min(const T &t) { return t; }
template <typename T> const T& var_max(const T &t) { return t; }
template <typename Head, typename... Tail> const Head& var_min(const Head &head, const Tail&... tail) { return min(head, var_min(tail...)); }
template <typename Head, typename... Tail> const Head& var_max(const Head &head, const Tail&... tail) { return max(head, var_max(tail...)); }
template <typename T, typename... Tail> void chmin(T &t, const Tail&... tail) { t = var_min(t, tail...); }
template <typename T, typename... Tail> void chmax(T &t, const Tail&... tail) { t = var_max(t, tail...); }
void debug_func_preffix(const string &s) { if(s.size()) cout << s << " = "; }
template <typename T>
void debug_func(const T &t, const string &s = "") {
    debug_func_preffix(s);
    cout << t << DEBUG_ENDL_S(s);
}
template <typename T, typename U>
void debug_func(const P<T, U> &p, const string &s = "") {
    debug_func_preffix(s);
    cout << "(";
    debug_func(p.first);
    cout << ", ";
    debug_func(p.second);
    cout << ")" << DEBUG_ENDL_S(s);
}
template <typename T>
void debug_func(const V<T> &v, const string &s = "") {
    for(ll i = 0; i < v.size(); i++) {
        string t = s + "[" + to_string(i) + "]";
        debug_func(v[i], t);
    }
}

int main() {
    ll N, Q;
    string S;
    cin >> N >> S >> Q;
    for(ll QQ = 0; QQ < Q; QQ++) {
        ll K;
        cin >> K;
        ll cnt[3] = {};
        ll ans = 0;
        for(ll i = 0; i < N; i++) {
            ll rm = i - K;
            if(rm >= 0) {
                if(S[rm] == 'D') {
                    cnt[0]--;
                    cnt[2] -= cnt[1];
                }
                if(S[rm] == 'M') {
                    cnt[1]--;
                }
            }
            if(S[i] == 'D') cnt[0]++;
            if(S[i] == 'M') {
                cnt[1]++;
                cnt[2] += cnt[0];
            }
            if(S[i] == 'C') ans += cnt[2];
            DEBUG(ans);
        }
        cout << ans << endl;
        DEBUG_SEPARATOR_LINE;
    }
    return 0;
}


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

#define rep(i, a, b) for (int i = (a); i < (int)(b); i++)
#define rrep(i, a, b) for (int i = (a); i >= (int)(b); i--)
#define all(x) (x).begin(), (x).end()
using i32 = int32_t;
using i64 = int64_t;
using f32 = float;
using f64 = double;
using P   = pair<int, int>;

template <class T>
bool chmin(T &a, T b) {
    if (a > b) {
        a = b;
        return true;
    } else {
        return false;
    }
}
template <class T>
bool chmax(T &a, T b) {
    if (a < b) {
        a = b;
        return true;
    } else {
        return false;
    }
}

template <class T>
void dump_vector(const vector<T> &v) {
    auto len = v.size();
    rep(i, 0, len) {
        cout << v[i] << (i == len - 1 ? "\n" : " ");
    }
}

struct Setup {
    Setup() {
        cin.tie(0);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(20);
    }
} SETUP;

//---------------------------------------------------------------------------------------------------

//---------------------------------------------------------------------------------------------------

signed main() {
    int N;
    cin >> N;
    vector<i64> A(N);
    rep(i, 0, N) {
        cin >> A[i];
    }
    auto nax = numeric_limits<i64>::min();
    auto nin = A[0];
    rep(i, 1, N) {
        chmin(nin, A[i - 1]);
        chmax(nax, A[i] - nin);
    }
    cout << nax << "\n";
}



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

// 総数を1000000007で割った余り
const long long mod = 1e9 + 7;

using ll  = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; --i)
#define rep1r(i, n) for (int i = ((int)(n)); i > 0; --i)

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

ull gcd(ull a, ull b) { return b ? gcd(b, a % b) : a; }
ull lcm(ull a, ull b) { return a / gcd(a, b) * b; }

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(0);

    double a, b, c;
    cin >> a >> b;
    ll x = a, y = b, z = 0;

    c = (a * a - b * b) / (2 * (a - b));
    z = (x * x - y * y) / (2 * (x - y));

    if (c == z) {
        cout << c << endl;
    } else {
        cout << "IMPOSSIBLE" << endl;
    }

    return 0;
}


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

const int N = 1e5 + 5;

int n, k, ans, a[N];
vector<int> g[N];

int dfs(int u, int fa) {
	int r = 1;
	for(auto v : g[u]) {
		if(v == fa) continue;
		r = max(1 + dfs(v, u), r);
	}
	if(r == k && fa)
		return ans += a[u] != 1, 0;
	return r;
}

int main() {
	scanf("%d%d", &n, &k);
	for(int i = 1; i <= n; ++i) {
		scanf("%d", a + i);
		if(i == 1) continue;
		g[a[i]].push_back(i);
		g[i].push_back(a[i]);
	}
	dfs(1, 0);
	if(a[1] != 1) ++ans;
	cout << ans << '\n';
	return 0;
}


Measured memory_bytes: 12416
#include <iostream>
#include <string>
#include<vector>
#include<algorithm>
#include<utility>
#include<queue>
#include<math.h>
#include<stack>
#include<set>
#include<map>
#define INF 1000000007
#define rep(i,n,m) for(int i=n;i<m;i++)

using namespace std;


int main()
{
	long int n;
	cin >> n;
	
	long long int ans = 0;
	rep(i, 1, n+1) {
		long long int x = (n - n % i) / i;
		ans += i * x * (x + 1) / 2;
	}
	cout << ans << endl;
}



Measured memory_bytes: 3620
#include <iostream>
#include <iomanip>
#include <string>
#include <stack>
#include <vector>
#include <complex>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <iterator>
#include <map>
#include <set>
#include <queue>
#include <list>
#include <regex>
#include <limits>
#include <time.h>
#include <cstdint>
using namespace std;
using pii  = pair<int,int>;
using ll=long long;
using ld=long double;
#define pb push_back
#define mp make_pair
#define sc second
#define fr first
#define stpr setprecision
#define cYES cout<<"YES"<<endl
#define cNO cout<<"NO"<<endl
#define cYes cout<<"Yes"<<endl
#define cNo cout<<"No"<<endl
#define rep(i,n) for(ll i=0;i<(n);++i)
#define Rep(i,a,b) for(ll i=(a);i<(b);++i)
#define rrep(i,n) for(ll i=n-1;i>=0;i--)
#define rRep(i,a,b) for(ll i=a;i>=b;i--)
#define crep(i) for(char i='a';i<='z';++i)
#define psortsecond(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.second<b.second;});
#define ALL(x) (x).begin(),(x).end()
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl;
#define endl '\n'
int ctoi(const char c){
  if('0' <= c && c <= '9') return (c-'0');
  return -1;
}
ll gcd(ll a,ll b){return (b == 0 ? a : gcd(b, a%b));}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}
constexpr ll MOD=1000000007;
constexpr ll INF=1000000011;
constexpr ll MOD2=998244353;
constexpr ll LINF = 1001002003004005006ll;
constexpr ld EPS=10e-8;
template <class T, class U> inline bool chmax(T& lhs, const U& rhs) { if (lhs < rhs) { lhs = rhs; return 1; } return 0; }
template <class T, class U> inline bool chmin(T& lhs, const U& rhs) { if (lhs > rhs) { lhs = rhs; return 1; } return 0; }
template<typename T> istream& operator>>(istream& is,vector<T>& v){for(auto&& x:v)is >> x;return is;}
template<typename T,typename U> istream& operator>>(istream& is, pair<T,U>& p){ is >> p.first; is >> p.second; return is;}
template<typename T,typename U> ostream& operator>>(ostream& os, const pair<T,U>& p){ os << p.first << ' ' << p.second; return os;}
template<class T> ostream& operator<<(ostream& os, vector<T>& v){
  for(auto i=begin(v); i != end(v); ++i){
    if(i !=begin(v)) os << ' ';
    os << *i;
  }
  return os;
}

ll N,A[200007];

bool isprime(ll N){
  if(N==1){
    return 0;
  }
  if(N==2){
    return 1;
  }
  Rep(i,2,sqrt(N)+1){
    if(N%i==0){
      return 0;
    }
  }
  return 1;
}

vector<ll> Prime_Array(ll Left, ll Right){ //Left以上Right以下の素数の配列
  vector<ll> RE_Prime_Array;
  Rep(i,Left,Right+1){
    if(isprime(i)){
      RE_Prime_Array.pb(i);
    }
  }
  return RE_Prime_Array;
}

vector<ll> N1,N2,N3,N4;

int main(){
  cin >> N;
  ll k=0;
  vector<ll> V=Prime_Array(12,55555);
  rep(i,V.size()){
    if(V[i]%5==1){
      k++;
      cout << V[i];
      if(k!=N){
        cout << " ";
      }
    }
    if(k==N){
      break;
    }
  }
  cout << endl;
}


Measured memory_bytes: 3724
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <cmath>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <cstring>
#include <vector>
#include <stack>
#include <deque>
#include <queue>
#include <cstdlib>
#include <iomanip>
#include <unordered_map>
#include <unordered_set>
typedef long long int ll;
#define forn for(int i=1;i<=n;i++) 
#define form for(int i=0;i<m;i++) 
#define pb push_back 
#define mp make_pair 
#define sc second 
#define f first 
#define kek cout<<"\n" 
#define all(v) ((v).begin()), ((v).end()) 
#define pob pop_back() 
const ll MOD = 1e9 + 7;
const int N = 1005;
const ll INF = 1e9;
using namespace std;
int main()
{
#if defined(_DEBUG)
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
    int h,n;
    cin>>h>>n;
    int arr[n];
    ll sum=0;
    forn
    {
              cin>>arr[i];
              sum+=arr[i];
    }
    if(sum>=h) cout<<"Yes";
    else cout<<"No";
    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define _overload3(_1,_2,_3,_4,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,n) (int i=a;i<n;i++)
#define per(i,a,n,s) (int i=n-1;i>=a;i--)
#define range(...) _overload3(__VA_ARGS__,per,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define vecin(x) for(auto&youso_: (x) ) cin >>  youso_
#define vecout(x) for(auto&youso_: (x) ) cout << youso_ << " " ; cout << endl
template<class T>inline bool chmax(T &a, const T b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>inline bool chmin(T &a, const T b) { if (b<a) { a=b; return 1; } return 0; }
const int inf = 1e9+10;
const int mod = 1e9+7;
const long long llinf = 1e18;
#define _GLIBCXX_DEBUG
// head

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

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

int main(void) {
  int N, ans;
  cin >> N;

  int A[N];

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

  int dp[N];
  int now;

  if (A[0]==1) { 
    dp[0] = 1;
    now=2;
  }
  else {
    dp[0] = 0;
    now=1;
  }


  for(int i=1;i<N;i++) {
    if(A[i]==now) {
      dp[i] = dp[i-1]+1;
      now++;
    }
    else dp[i] = dp[i-1];
  }

  if(dp[N-1]==0) ans = -1;
  else ans = N-dp[N-1];

  cout << ans << endl;

  return (0);
}


Measured memory_bytes: 1792
n, k = gets.split.map(&:to_i)
r,s,p = gets.split.map(&:to_i)
T = gets.chomp
point = 0
actual_hands = []

def win_battle(r,s,p,hand)
  if hand == 'r'
    return p
  elsif hand == 's'
    return r
  else
    return s
  end
end

def win_hand(hand)
  if hand == 'r'
    return 'p'
  elsif hand == 's'
    return 'r'
  else
    return 's'
  end
end

n.times do |i|
  com_hand = T[i]
  if i <= k - 1
    point += win_battle(r,s,p,com_hand)
    actual_hands.push(win_hand(com_hand))
  else
    if actual_hands[i-k] != win_hand(com_hand)
      point += win_battle(r,s,p,com_hand)
      actual_hands.push(win_hand(com_hand))
    else
      actual_hands.push('')
    end
  end
end

puts point


Measured memory_bytes: 11772
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
#include<stdio.h>
#include <cstdint>
#include <stdlib.h> 
#include <time.h>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define rrep(i,n) REP(i,1,n+1)
#define all(a) a.begin(), a.end()
#define fi first
#define se second
#define RNG(x, a, n) &((x)[a]), &((x)[n])
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
typedef long long ll;
typedef pair<ll, ll> Pll;
typedef pair<int, int> PII;
typedef vector<ll> Vl;
typedef vector<int> VI;
typedef tuple<int, int, int> TT;
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
#define rall(v) v.rbegin(), v.rend()
#define dmp(x,y) make_pair(x,y)
#define dmt(x, y, z) make_tuple(x, y, z)
#define pb(x) push_back(x)
#define pf(x) push_front(x)
const int MAX = 510000;
const int inf = 1e9 + 7;
const int mod = 1e9 + 7;
const ll longinf = 1LL << 60;
const long double PI = (acos(-1));
const long double EPS = 0.0000000001;


int n, m, cnt, ans;
int a[10005];

int main() {

	cin >> n >> m;
	rep(i, n) {
		cin >> a[i];
		cnt += a[i];
	}

	rep(i, n) {
		if (a[i] * 4 * m >= cnt)ans++;
	}

	if (ans >= m)cout << "Yes" << endl;
	else cout << "No" << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0; i<(n);++i)
const int INF =1001001001;
using ll=long long;
using P = pair<ll,ll>;
using Graph =vector<string>;
Graph field;
queue<P> q;

int main() {
  int a,b;
  cin>>a>>b;
  rep(i,a+1){
    if(i*2+(a-i)*4==b){
      cout << "Yes"<<endl;
      return 0;
    }
  }
  cout <<"No"<<endl;
}


Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
const int INF = 2e9;
int a[50],b[50],c[50];
int main(){
  int n,A,B;
  cin >> n >> A >> B;
  for(int i=0;i<n;i++) cin >> a[i] >> b[i] >> c[i];
  vector<vector<vector<int>>> dp(n+1,vector<vector<int>> (401,vector<int> (401,INF)));
  for(int i=0;i<n+1;i++) dp[i][0][0]=0;
  for(int i=0;i<n;i++){
    for(int j=0;j<401;j++){
      for(int k=0;k<401;k++){
        if(j>=a[i] && k>=b[i]) {
          dp[i+1][j][k] = min(dp[i][j][k],dp[i][j-a[i]][k-b[i]]+c[i]);
        }
        else dp[i+1][j][k] = dp[i][j][k];
        //if(dp[i+1][j][k]<INF) cout << i << " " << j << " " << k << " " << dp[i+1][j][k] << endl;
      }
    }
  }
  int ans=INF;
  for(int i=1;;i++){
    if(i*A>400 || i*B>400) break;
    else{
      ans = min(ans,dp[n][i*A][i*B]);
    }
  }
  if(ans<INF)cout << ans << endl;
  else cout << -1 << endl;
}

Measured memory_bytes: 27280
#include <algorithm>
#include <bitset>
#include <deque>
#include <iostream>
#include <iterator>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#define lli long long int
#define pii pair<int,int>
#define ppi pair<pii,pii>
#define forn(i, n) for(int i=0;i<n;i++)
#define vi vector<int>
#define vvi vector<vi>
#define pb push_back
#define fi first
#define se second
#define endl '\n'

using namespace std;

const int MAXN = 1000001;

int gcd(int a, int b) { return b ? gcd(b, a%b) : a; }

int grado[MAXN];

int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);
	int a,b;
	forn(i, 3) {
		cin>>a>>b;
		a--,b--;
		grado[a]++, grado[b]++;
	}

	int uno = 0, dos = 0;
	forn(i, 4)
		if(grado[i] == 1) uno++;
		else if(grado[i] == 2) dos++;
	
	if(uno == 2 && dos == 2) cout<<"YES"<<endl;
	else cout<<"NO"<<endl;
	return 0;
}


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

int main(){
    int a, b;
    cin >> a >> b;

    

    cout << max(a+b, max(a-b, a*b)) << endl;
    // printf("%d\n", N);
    return 0;
}

Measured memory_bytes: 256
from operator import itemgetter
import sys
n = int(input())
ab = [list(map(int, input().split())) for _ in range(n)]
sum = 0

sort_by_b = sorted(ab, key=itemgetter(1))
for i in range(n):
  sum += sort_by_b[i][0]
  if sum > sort_by_b[i][1]:
    print("No")
    sys.exit(0)
print("Yes")

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

void Main()
{
  int n; cin >> n;
  vector<int> a(n);
  rep(i,n) cin >> a[i];
  int s = a[0];
  for(int i = 1; i < n; i++) s ^= a[i];
  int ans;
  rep(i,n) {
    ans = s ^ a[i];
    cout << ans << " ";
  }
  cout << endl;
}

int main()
{
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(20);
  Main();
  return 0;
}


Measured memory_bytes: 3984
using System;
using System.Linq;

namespace arc095_b
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int[] x = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int max = x.Max(); int ret = 0; int nearest = int.MaxValue;
            for (int i = 0; i < n; i++)
            {
                if (x[i] != max && nearest > Math.Abs(max - (x[i] * 2)))
                {
                    nearest = Math.Abs(max - (x[i] * 2));
                    ret = x[i];
                }
            }
            Console.WriteLine(max + " " + ret);
        }
    }
}

Measured memory_bytes: 22880
from collections import defaultdict
vis = [0 for i in range(0 , 2000)]
lt = [0 for i in range(0 , 2000)]
dis = [0 for i in range(0 , 2000)]
adj = defaultdict(list)
time = 0
ans = 0
def dfs(u , p):
	global time , ans
	time = time+1
	lt[u]= dis[u]=time
	vis[u]=1
	for v in adj[u]:
		if v==p:
			continue
		if vis[v]==0:
			dfs(v , u)
			lt[u]=min(lt[u] , lt[v])# if back edge through child v
			if lt[v]>dis[u]:
				ans = ans+1
		else:
			lt[u]=min(lt[u] , dis[v])# if there is a back edge to a child v
def main():
	n , m = map(int , input().split())
	for i in range(0 , m):
		u, v= map(int , input().split())
		adj[u].append((v))
		adj[v].append((u))
	dfs(1, 0)
	print(ans)
if __name__=="__main__":
	main()

Measured memory_bytes: 67548
/*
 * URL 		: https://atcoder.jp/contests/dp/tasks/dp_d
 * DATE		: 27th Jan, 2019
 */

//___________________________________________________________________________________________________________
#include<bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;

#define rep(i,a,b)  for(int i=a; i<b; i++)
#define req(i,a,b)  for(int i=b-1; i>=a; i--)
#define trv(it,s)   for(auto it=s.begin(); it!=s.end(); it++)
#define trs(it,s)   for(auto &it : s)

#define endl        '\n'
#define pb          push_back
#define F           first
#define S           second
#define ll          long long
#define pii         pair<int,int>
#define vpii        vector<pii>
#define vi          vector<ll>
#define vii         vector<vi>
#define mi          map<int,int>
#define umap        unordered_map
#define uset        unordered_set
#define all(a)      (a).begin(),(a).end()
#define sz(x)       (int)x.size()
#define fill(a,x)   memset(a,x,sizeof(a))
#define num1(x)     __builtin_popcount(x)

#define db(a)       cout<<"---DEBUG : "<<a<<"\n"
#define wa(x)       cout << (#x) << " -------- " << (x) << endl
#define line1	    printf("---------------------------------------\n")
#define line2	    printf("_______________________________________\n")

#define MOD         1000000007 
#define PI          2 * acos(0.0)

//#define int 		long long
//#define printf      //

//___________________________________________________________________________________________________________
void pmap(auto l){
	trv(itt,l) printf("%d %d\n", itt->fi, itt->se);
	line1;
}

void pvi(vector<ll> pvec, string name="") {
	if(name != "") cout<<"Output of "<<name<<" : ";
	for(int i=0;i<pvec.size();i++) cout<<pvec[i]<<"\t";
	cout<<endl;
}

int gcd(int n,int m) {return m==0?n:gcd(m,n%m);}

int o(ll a) {return a%MOD;}

ll mpow(ll base, ll power){
	if(power==0) return 1;
	if(power==1) return base;
	ll exp = mpow(base,power/2);
	exp = exp*exp;
	if(power%2==1) exp = exp * base;
	return exp;
}
//___________________________________________________________________________________________________________

void solve();

int32_t main() {

//	ios_base::sync_with_stdio(false); cin.tie(NULL);

	int notc = 1; 
//	cin>>notc;

	while(notc--) {
		solve();
		//printf("========================================================\n");
	}
}
//___________________________________________________________________________________________________________

int n,w;
vpii v;
vii dp;

void pr(){
	line1;
	rep(i,0,n){
		pvi(dp[i]);
	}
	line1;
}


void solve() {

	cin>>n>>w;
	n++;
	w++;

	rep(i,0,n){
		int a,b;
		cin>>a>>b;
		v.pb({a,b});
	}

	rep(i,0,n){
		vi r(w,-1);
		dp.pb(r);
	}

	// pr();

	dp[0][0] = 0;
	rep(i,1,w) dp[0][i] = -1e9;

	// pr();

	rep(i,1,n){

		rep(j,0,w){
			dp[i][j] = dp[i-1][j];

			if( j >= v[i-1].F){
				ll a = dp[i-1][j-v[i-1].F] + v[i-1].S;
				dp[i][j] = max(dp[i][j], a);
			}
		}
	}

	// pr();

	ll mx = 0;
	rep(i,0,w){
		mx = max(mx,(ll)dp[n-1][i]);
	}

	cout << mx << endl;



}

Measured memory_bytes: 79984
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
 
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
 
typedef long long ll;
typedef vector<int> vi;
typedef unsigned long ul;
typedef vector<ll> vl;
typedef pair<int,int> pi;
typedef vector<pi> vpi;
typedef set<int> si;
typedef multiset<int> mi;
 
const ll INF = 1e18;
const int MOD = 1e9+7;
 
int main() {
	
	cin.tie(NULL);
	ios_base::sync_with_stdio(false);
	
	//ofstream cout ("fileName.txt");
	//ifstream cin ("fileName.txt");
	
	int N,K;
	cin>>N>>K;
	vi v(N);
	for(int&n : v) cin>>n;
	sort(v.begin(),v.end());
	
	ll sum=0;
	for(int i=0; i<K; ++i) sum+=v[i];
	
	cout<<sum<<"\n";
 	
 	
	return 0;
}


Measured memory_bytes: 3648
use std::error::Error;
use std::io;

fn main() {
    if let Err(e) = run() {
        println!("{}", e);
    }
}

fn run() -> Result<(), Box<Error>> {
    io::stdin().read_line(&mut String::new())?;
    let mut a = String::new();
    io::stdin().read_line(&mut a)?;
    let a: Vec<u64> = a.trim().split(" ").map(|e| e.parse().expect("")).collect();
    let mut n4 = 0;
    let mut n2 = 0;
    let mut ne = 0;
    for e in a {
        if e % 4 == 0 {
            n4 += 1;
        } else if e % 2 == 0 {
            n2 += 1;
        } else {
            ne += 1;
        }
    }
    if n2 > 0 {
        if ne <= n4 {
            println!("Yes");
        } else {
            println!("No");
        }
    } else {
        if ne <= n4 + 1 {
            println!("Yes");
        } else {
            println!("No");
        }
    }
    Ok(())
}


Measured memory_bytes: 6396
local K, S = io.read("*n", "*n")

---x >= y >= z
local x, y, z = 0, 0, 0
if K >= S then
	x = S
elseif 2*K >= S then
	x, y = K, S - K
else
	x, y, z = K, K, S - 2*K
end

local count = 0
local sub_x, sub_y, sub_z = x, y, z
while sub_y >= sub_z do
	while y >= z do
		if x == y and y == z then
			count = count + 1
		elseif x == y or y == z then
			count = count + 3
		else
			count = count + 6
		end
		y, z = y - 1, z + 1
	end

	if sub_x == sub_y + 1 then
		sub_x, sub_z = sub_x - 1, sub_z + 1
	elseif x == sub_y then
		sub_x, sub_y, sub_z = sub_x - 1, sub_y - 1, sub_z + 2
	else
		sub_x, sub_y = sub_x - 1, sub_y + 1
	end
	x, y, z = sub_x, sub_y, sub_z
end

print(count)

Measured memory_bytes: 256
#include<stdio.h>

void swap(int *a,int *b)
{
 int temp;
 temp=*a;
 *a=*b;
 *b=temp;
}

int main()
{
 int a,b,c;
 int temp;
 scanf("%d %d %d",&a,&b,&c);
 if(a>b)swap(&a,&b);
 if(a>c)swap(&a,&c);
 if(b>c)swap(&b,&c);

 printf("%d %d %d\n",a,b,c);
 
 return 0;
}

Measured memory_bytes: 596
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll a[1005];
ll sum[2]={0};
vector<int> v[2];

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

    ll max0=-1e18,maxnum=0;
    for(int i=1;i<=n;i++)
    {
        ll c;
        cin>>c;
        a[i]=c;
        if(c>max0) maxnum=i;
        max0=max(max0,c);
        if(c>0)
        {
            sum[i%2]+=c;
            v[i%2].push_back(i);

        }
    }

    if(sum[1]==0&&sum[0]==0)
    {
        cout<<max0<<'\n';
        cout<<n-1<<'\n';
        for(int i=1;i<maxnum;i++)
            cout<<"1\n";
        for(int i=n;i>maxnum;i--)
            cout<<i-maxnum+1<<"\n";
        return 0;
    }

    cout<<max(sum[0],sum[1])<<'\n';
    bool b=(sum[1]>sum[0]);
    int t=v[b].size();
    int cnt=n-(v[b][t-1]-v[b][0])/2-1;
    cout<<cnt<<'\n';
    //cout<<"V"<<v[b][0]<<'\n';
    for(int i=1;i<v[b][0];i++)
        cout<<"1\n";
    for(int i=0;i<v[b].size()-1;i++)
    {

        for(int j=2;j<v[b][i+1]-v[b][i];j+=2)
            cout<<"3\n";
        cout<<"2\n";
    }

    for(int i=n;i>v[b][t-1];i--)
        cout<<i-v[b][t-1]+1<<"\n";
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
int main (){
  int a,b,i;
  cin>>a>>b;
  i=b-a+1;
  if(a>0){
    cout<<"Positive"<<endl;
  }else if(b>=0){
    cout<<"Zero"<<endl;
  }else if(a==0){
    cout<<"Zero"<<endl;
  }else if(i%2==1){
    cout<<"Negative"<<endl;
  }else{
    cout<<"Positive"<<endl;
  }
  return 0;
}


Measured memory_bytes: 256
//<--sbhmsh-- Shubham Jaiswal>//

#include <bits/stdc++.h>
#include <iostream>
#define FASTIO std::ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
#define lli long long int
#define endl '\n'
#define deb cout<<"sab_badhiya"<<endl;
// const long long INF = 1000 * 1000 * 1000 * 1ll * 1000 * 1000 * 1000;
const long INF = 1000 * 1000 * 1000;
const long long int mod = 1000000007;

int main(){
  FASTIO
  long long int n, a, b,ans = 1e18, c;
  cin >> n;
  for(int i=1; i<sqrt(n)+1; i++){
    if(n%i==0) {
      a = i;
      b = n/i;
      ans = min(ans, a+b-2);

    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n,m;
    while(cin>>n>>m)
    {
        ll tot=0;
        ll arr[105];
        for(int i=0;i<n;i++)
        {
            ll x;
            cin>>x;
            arr[i]=x;
            tot += x;
        }
        ll req=ceil((1.0/(4.0*(double)m))*tot);
        int cnt=0;
        for(int i=0;i<n;i++)
        {
            if(arr[i]>=req)
            {
                cnt++;
            }
        }
        if(cnt>=m) 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<(int)(n);i++)
using namespace std;

using ll = long long;

const int INF = 1001001001;
const ll INF_LL = 1001001001001001001LL;

int main(void){
  int a,b; cin >> a >> b;
  if(a%2==0 || b%2==0) cout << "No" << endl;
  else cout << "Yes" << endl;
  
  return 0;
}


Measured memory_bytes: 3624
n,m = map(int,input().split())
stu = [list(map(int,input().split())) for _ in range(n)]
che = [list(map(int,input().split())) for _ in range(m)]
ans = []

for i in range(n):
    x = 10**9
    for j in range(m):
        man = abs(stu[i][0] - che[j][0]) + abs(stu[i][1] - che[j][1])
        if man < x:
            c_num = j + 1
            x = man
    ans.append(c_num)
for k in ans:
    print(k)

Measured memory_bytes: 3064
N=int(input())
s=0
BA=0
XA=0
BX=0
for i in range(N):
    st=input()
    s+=st.count("AB")
    f1=0
    f2=0

    
    if(st[0]=="B"):f1=1
    if(st[-1]=="A"):f2=1

    if(f1 and f2):
        BA+=1
    elif(f1):
        BX+=1
    elif(f2):
        XA+=1
if(XA==0 and BX==0 and BA<2):
    print(s)
elif(XA==0 and BX==0):
    print(s+BA-1)
else:
    print(s+min(XA+BA,BX+BA))

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

int main() {
  long long a,v,b,w,t;
  cin>>a>>v>>b>>w>>t;
  long long distance=abs(a-b);
  if((v-w)*t>=distance)
    cout<<"YES"<<endl;
  else
    cout<<"NO"<<endl;
}


Measured memory_bytes: 3636
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin, log, log10
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
def debug(*args):
    if debugmode:
        print(*args)
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def FLOAT(): return float(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7
dx = [0, 0, 1, -1, 1, -1, -1, 1]
dy = [1, -1, 0, 0, 1, -1, 1, -1]
debugmode = False

arr = LIST()
arr.sort()
if arr == [5, 5, 7]:
    print('YES')
else:
    print('NO')

Measured memory_bytes: 59500
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin>>N;
  int H[N];
  for(int i=0;i<N;i++) {
    cin>>H[i];
  }
  int ma=H[0];
  int ans=1;
  for(int i=1;i<N;i++) {
    if(ma<=H[i]) {
      ans++;
      ma=H[i];
    }
  }
    cout<<ans<<endl;
}

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

int main () 
{
    int num_ant, length;
    
    while (1)
    {
        std::cin >> num_ant >> length;
        
        if (num_ant == 0 && length == 0) break;
        
        int direction[num_ant];
        int position[num_ant];
        char temp;
        int  tag;
        
        // input
        for (int i = 0; i < num_ant; i++)
        {
            std::cin >> temp >> position[i];
            if (temp == 'R') direction[i] = 1;
            else direction[i] = -1;
        }
        
        // simulate
        bool goal[110] = {0};
        bool flag = false;
        int t = 0;
        
        while (!flag)
        {
            t++;
            int conflict[110] = {0};
            int point[110] = {0};
            flag = true;
            
            for (int j = 0; j < num_ant; j++) 
            {
                if (goal[j] == false)
                {
                    position[j] += direction[j];
                    
                    if (conflict[position[j]] != 0)
                    {
                        direction[j] *= -1;
                        direction[point[position[j]]] *= -1;
                    }
                    else
                    {
                        conflict[position[j]]++;
                        point[position[j]] = j;
                    }
                    
                    if (position[j] == 0 || position[j] == length)
                    {
                        goal[j] = true;
                        if (position[j] == 0 )
                        {
                            tag = j;
                        }
                        else if (position[j] == length && conflict[0] == 0)
                        {
                            tag = j;
                        }
                    }
                }
            }
            
            // confirming
            for (int k = 0; k < num_ant; k++) 
            {
                if (goal[k] != true) flag = false;
            }
            
        }
        
        std::cout << t << " " << tag + 1 << std::endl;
    }
    
    return 0;
}


Measured memory_bytes: 3000
import java.util.Scanner;

class Main{

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int A = scan.nextInt();
		int B = scan.nextInt();
		if(A == 0){
			if(B == 100){
				System.out.println((B+1));

			}else{
				System.out.println(B);
			}
		}else{
			int x = 1;
			for(int i = 0;i<A;i++){
				x *= 100;
			}
			if(B == 100){
				System.out.println(x*(B+1));

			}else{
				System.out.println(x*B);
			}
		}

	}





}

Measured memory_bytes: 23764
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

class Main {
    public static void main(String[] args) throws IOException {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    
    while(true) {
    	String strArr[] = br.readLine().split(" ");
      	int x = Integer.parseInt(strArr[0]);
      	int y = Integer.parseInt(strArr[1]);
      	if(x == 0 && y == 0) {
        	break;
        }
      	int i, j, k;
        int count = 0;
        for (i = 1; i <= x - 2; i++) {
        	for (j = i + 1; j <= x - 1; j++) {
            	for (k = j + 1; k <= x; k++) {
                  	if(i + j + k == y) {
                    	count++;
                    }
                }
            }
          
        }
      System.out.println(count);
    }    
        
    
        
    }
}


Measured memory_bytes: 25064
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
 
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;
 
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
 
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;
 
#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
#define trav(a,x) for (auto& a : x)
 
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define ins insert

template<class T> bool ckmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; }
template<class T> bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
const int MOD = 1000000007;
const char nl = '\n';
const int MX = 100001; //check the limits, dummy
 
int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);    
	
    int N, X, T;
    cin >> N >> X >> T;
    int ansN = 0, ansT = 0;
    while (ansN < N) {
		ansN += X;
		ansT += T;
	}
	cout << ansT << '\n';
	
	return 0;
}
 
// read the question correctly (ll vs int)
// template by bqi343



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

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

using namespace std;

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

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

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

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

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

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

	string s, t;
	int N;
	cin >> N;
	cin >> s >> t;

	int ans = 0;
	int pp = -1;
	rep(i, 0, SZ(s))
	{
		if (i == SZ(s) - 1 || s[i] != s[i + 1])
		{
			if (ans == 0)
			{
				ans = 3;
			}
			else
			{
				if (pp == 0)
				{
					ans *= 2;
				}
				else
				{
					ans *= 1;
				}
			}
			pp = 0;
		}
		else
		{
			if (ans == 0)
			{
				ans = 6;
			}
			else
			{
				if (pp == 0)
				{
					ans *= 2;
				}
				else
				{
					ans *= 3;
				}
			}
			pp = 1;
			i++;
		}
		ans %= MOD;
	}

	cout << ans << endl;

	return 0;
}

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

int main() {
    int H, N;
    cin >> H >> N;
    vector<int> A(N);
    rep(i, N) { cin >> A[i]; }
    int sum = 0;
    rep(i, N) { sum += A[i]; }

    if(sum >= H) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 3736