akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<int(N);++i)
#define rep1(i,N) for(int i=1;i<int(N);++i)
#define all(a) (a).begin(),(a).end()
#define print(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<_<<", "; cerr<<"]"<<endl; }
#define printpair(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<"{"<<_.first<<","<<_.second<<"}"<<", "; cerr<<"]"<<endl; }
#define dump(x) cerr<<#x<<": "<<x<<endl;
#define bit(k) (1LL<<(k))
#define Yes "Yes"
#define No "No"
#define YES "YES"
#define NO "NO"
typedef long long ll;
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;

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

const int INF = (ll)1e9;
const ll INFLL = (ll)1e18+1;
const ll MOD = (ll)1e9+7;
const double PI = acos(-1.0);
/*
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const string dir = "DRUL";
*/
int H, W, K;
vector<string> S;
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    cin >> H >> W >> K;
    S.resize(H);
    rep(i,H)cin >> S[i];
    vvec<int> cum(H+1, vec<int>(W,0));
    rep(j,W){
        rep(i,H){
            cum[i+1][j] += cum[i][j] + S[i][j] - '0';
        }
    }
    //rep(i,H+1)print(cum[i]);
    ll ans = INFLL;
    //境界の状態を全探索
    rep(k,bit(H-1)){
    //rep(k,1){                    // 2^9
        // l個目の境界が分かれているか
        vector<int> v;
        v.push_back(0); 
        ll cnt = 0; // 境界の本数
        rep(l, H-1){                    
            if(k & bit(l)){
                v.push_back(l+1);
                cnt++;
            }
        }
        v.push_back(H);
        //print(v);
        vector<int> counts(int(v.size()-1),0);
        bool ok = true;
        map<int, int> map;
        rep(j,W){                           // 1000
            map[j]++;
            if(!ok)break;
            vector<int> nxt((int)v.size()-1, 0);
            int maxx = 0; //区間の中のmax
            rep(m, v.size()-1){             // 10 m番目の区間
                int l = v[m];
                int r = v[m+1];
                //cerr << l << " "  <<  r <<endl;
                //[l,r)行ごとに分ける
                nxt[m] = counts[m];
                //j行目の、[l,r)の足し算
                
                for(int i = l;i < r;i++){
                    nxt[m] += S[i][j] - '0';
                }
                //nxt[m] +=  cum[r][j] - cum[l][j];
                chmax(maxx, nxt[m]);
            }
            //print(nxt);
            if(maxx <= K){
                swap(counts,nxt);
            }
            else{
                if(map[j] >= 2)ok = false;
                j--;
                counts.assign((int)v.size()-1,0);
                cnt++;
                continue;
            }
        }
        if(ok)chmin(ans, cnt);
    }
    cout << ans << endl;
}


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

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

#define FOR(i, n, m) for (ll(i) = (m); (i) < (n); ++(i))
#define REP(i, n) FOR(i, n, 0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll)1e15;

ll C[30];

int main()
{
    int N;
    cin >> N;
    string S;
    cin >> S;
    memset(C, 0, sizeof(C));
    REP(i, N)
    {
        C[S[i] - 'a']++;
    }
    ll ans = 1;
    REP(i, 26)
    {
        ans = (ans * (C[i] + 1)) % MOD;
    }
    ans = (MOD + ans - 1) % MOD;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstring>
#include <queue>
#define el '\n'
#define FAIO ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr)

using namespace std;

int N, M;

vector<int> v[200001];
queue<int> q;
bool visited[200001];

int main() {
    FAIO;

    cin >> N >> M;
    while (M--) {
        int ta, tb;
        cin >> ta >> tb;
        v[ta].push_back(tb);
        v[tb].push_back(ta);
    }

    int mx = 0;

    for (int i = 0; i < N; i++) {
        if (!visited[i]) {
            int cnt = 1;
            q.push(i);
            visited[i] = true;

            while (!q.empty()) {
                int tmp = q.front();
                q.pop();

                for (auto a : v[tmp]) {
                    if (!visited[a]) {
                        q.push(a);
                        visited[a] = true;
                        cnt++;
                    }
                }
            }

            if (cnt > mx) mx = cnt;
        }
    }
    cout << mx;
    return 0;
}

Measured memory_bytes: 15272
#include <stdio.h>

int ans;

int gcd(int a, int b, int kai)
{
	if (!b){
		ans = kai;
		return (a);
	}
	return (gcd(b, a % b, kai + 1));
}

int main(void)
{
	int a, b;
	
	while (1){
		scanf("%d%d", &a, &b);
		
		if (!(a + b)){
			break;
		}
		
		if (b > a){
			a ^= b;
			b ^= a;
			a ^= b;
		}
		ans = 0;
		printf("%d ", gcd(a, b, 0));
		printf("%d\n", ans);
	}
	
	return (0);
}

Measured memory_bytes: 0
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <tuple>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
using namespace std;

#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
#define rept(i,k,n) for(long long i = (k); i < (long long)(n); i++)
#define All(v) v.begin(), v.end()
#define Sort(v) sort(v.begin(),v.end())
#define Rsort(v) sort(v.begin(),v.end(),[](auto a, auto b) { return a > b; })
#define Reverse(v) reverse(v.begin(),v.end())
#define MAX 1000000007
typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<long long,long long> Pll;
typedef tuple<int,int,int> Tii;

template <typename T>
ostream& operator<<(ostream& s, const vector<T> &vec){
    for(int i=0;i<vec.size();i++){
        if(i) s << ',';
        else s << '{';
        s <<setw(2)<< vec[i];
    }
    s << '}' << endl;
    return s;
}
 
ll mod = 1e9+7;
int main(){
    int n;
    cin>>n;
    string s;
    cin>>s;
    vector<int> r(n+1,0),w(n+1,0);
    rep(i,n){
        r[i+1]=r[i];w[i+1]=w[i];
        if(s[i]=='R') r[i+1]++;
        else w[i+1]++;
    }
    int mi = n;
    rep(i,n+1){
        int j =i;
        mi = min(mi,max(w[j],r[n]-r[j]));
    }
    cout<<mi<<endl;
    return 0;
}

Measured memory_bytes: 5172
/**
 *      purpose : CODE FESTIVAL 2017 qual B
 *      author  : kyomukyomupurin
 *      created : 2018-11-16 16:49:31
**/

#include <bits/stdc++.h>
using namespace std;
typedef int64_t int64;
#define print(x) cout << (x) << '\n'

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

    print(s.substr(0, (int) s.size() - 8));
    
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long
struct itvl{
  int l,r;
};
signed main(){
  int n,res=0;
  cin>>n;
  vector<itvl> x(n);
  for(int i=0;i<n;++i){
    cin>>x[i].l>>x[i].r;
    x[i].l-=x[i].r;
    x[i].r=x[i].l+x[i].r*2-1;
  }
  sort(x.begin(),x.end(),[](itvl a,itvl b){return a.r<b.r;});
  int pos=0;
  for(int i=0;i<n;++i){
    if(i&&x[i].l<=pos)continue;
    pos=x[i].r;
    ++res;
  }
  cout<<res;
}

Measured memory_bytes: 1792
#include<stdio.h>

static const int MAX = 500;
static const int INFTY = (1<<21);

#define NIL -1

int p[100];

int key[100];

int n;


main(){
  int i, j, e, v, sum;
 
  int u;

  int M[100][100];

  int l[100];

  scanf("%d", &n);

  for ( i = 0; i< n; i++ ){
    for ( j = 0; j < n; j++ ){
      scanf("%d", &e);
      M[i][j] = (e==-1)?INFTY:e;
    }
  }



  for(u=0;u<n;u++){
    key[u] =100000000;

    p[u] =NIL;

    l[u]=NIL;
  }
  key[0] = 0;

  while(1){
    int u=NIL;
    int v = 100000000;


    for(i=0;i<n;i++){
     

      if(key[i]<v && l[i]==NIL){
	v = key[i];
	u=i;
      }
    }
	
      
    
    if(u==NIL){
      break;
    }

    for(v=0;v<n;v++){
      if(M[u][v] < key[v] && l[v]==NIL){
	key[v] = M[u][v];
	p[v]= u;
      }
    }
    l[u]=0;
  }


  sum = 0;

  for ( i = 0; i < n; i++ ){
    if ( p[i] != -1 ) sum += M[i][p[i]];
  }

  printf("%d\n", sum);

  return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define rep(i, n) for (ll(i) = 0; (i) < (n); (i)++)
#define all(x) (x).begin(), (x).end()
#define print(x) cout << (x) << endl;

typedef long long ll;
const ll INF = 99999999999999;
const ll MOD = 1000000007;

ll gcd(ll a, ll b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);
}
ll lcm(ll number1, ll number2)
{
    return number1 * number2 / gcd(number1, number2);
}
template <class T>
bool contain(const std::string &s, const T &v)
{
    // contain(to_string(N), '3')
    return s.find(v) != std::string::npos;
}

int ctoi(char c)
{
    if (c >= '0' && c <= '9')
        return c - '0';
    return 0;
}
using namespace std;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;

    cin >> n;
    vector<ll> b(n);
    ll ans = 0;
    rep(i, n - 1)
    {
        cin >> b[i];
    }
    b[n - 1] = MOD;
    rep(i, n)
    {
        if (i == 0)
        {
            ans += b[i];
        }
        else
        {
            ans += min(b[i], b[i - 1]);
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
s = str(input())
n = len(s)
s1 = s[:int((n-1)/2)]
s2 = s[int((n+3)/2)-1:]

if s == s[::-1] and s1 == s1[::-1] and s2 == s2[::-1]:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 2940
#include <bits/stdc++.h>  // ver2.2.3
#define int long long
#define endl "\n"
#define ALL(v) (v).begin(),(v).end()
#define Vi vector<int>
#define VVi vector<Vi>
#define Vs vector<string>
#define Pii pair<int,int>
#define VPii vector<Pii>
#define Tiii tuple<int,int,int>
#define PQi priority_queue<int>
#define PQir priority_queue<int,vector<int>,greater<int>>
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define itos to_string
#define stoi stoll
#define FI first
#define SE second
#define cYES cout<<"YES"<<endl
#define cNO cout<<"NO"<<endl
#define cYes cout<<"Yes"<<endl
#define cNo cout<<"No"<<endl
#define sortr(v) sort(v,greater<>())
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repeq(i,a,b) for(int i=a;i<=b;i++)
#define repreq(i,a,b) for(int i=a;i>=b;i--)
#define leng(n) (int)(log10(n)+1)
#define dem(a,b) ((a+b-1)/(b))
#define Vin(a) rep(iI,0,a.size())cin>>a[iI]
#define Vout(a) rep(lZ,0,a.size()-1)cout<<a[lZ]<<' ';cout<<a.back()<<endl
#define VVout(a) rep(lY,0,a.size()){Vout(a[lY]);}
#define VPout(a) rep(lX,0,a.size())cout<<a[lX].FI<<' '<<a[lX].SE<<endl
#define Verr(a) rep(iZ,0,a.size()-1)cerr<<a[iZ]<<' ';cerr<<a.back()<<endl
#define VVerr(a) rep(iY,0,a.size()){Verr(a[iY]);}
#define VPerr(a) rep(iX,0,a.size())cerr<<a[iX].FI<<' '<<a[iX].SE<<endl
#define INF 3000000000000000000  //  3.0*10^18(MAXの1/3くらい)
#define MAX LLONG_MAX
#define MOD 1000000007  //  10^9 + 7
using namespace std;

int gcd(int a,int b){return b?gcd(b,a%b):a;}  //  最大公約数gcd
int lcm(int a,int b){return a/gcd(a,b)*b;}  //  最小公倍数lcm
void press(auto &v){v.erase(unique(ALL(v)),v.end());}  //  圧縮
int mypow(int x, int n, int m){  //  累乗x^n(mod m)  O(log(n))
if(n==0)return 1;if(n%2==0)return mypow(x*x%m,n/2,m);else return x*mypow(x,n-1,m)%m;}

vector<pair<int,int>> fac(int n) {  //  素因数分解
 vector<Pii>r;for(int i=2;i*i<=n;++i){if(n%i)continue;r.emplace_back(i,0);while(n%i==0){
 n/=i;r.back().second++;}}if(n!=1)r.emplace_back(n,1);return r;}

int scomb(int n, int r){  //  nCr (小さい場合)
  int a=1;for(int i=n;i>n-r;--i){a=a*i;}for(int i=1;i<r+1;++i){a=a/i;}return a;}

signed main() {
  cin.tie(0);cout.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(12);
  int n;
  cin >> n;
  VPii a;
  map<int,int> kind;
  repeq(i,1,n){
    a = fac(i);
    rep(i,0,a.size()){
      kind[a[i].FI] += a[i].SE;
    }
  }
  
  int d2=0,d4=0,d24=0,d14=0,d74=0;
  
  for (auto p : kind ) {
    auto k = p.first;
    auto v = p.second;
    cerr << k << " => " << v << endl;
    if(v>=74) d74++;
    if(v>=24) d24++;
    if(v>=14) d14++;
    if(v>=4) d4++;
    if(v>=2) d2++;
 }
  int ans = d74;
  ans += (d14)*(d4-1);
  ans += (d24)*(d2-1);
  ans += max(0LL,(d4)*(d4-1)*(d2-2)/2);
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 256
n, x = map(int, input().split())
a = list(map(int, input().split()))
k = 0
cnt = 0

if a[1] + a[0] > x and x >= a[0] :
    k = x - a[0]
    cnt += a[1] + a[0] - x

elif a[1] + a[0] > x and x < a[0] :
    k = 0
    cnt += a[1] + a[0] - x

else :
    k = a[1]

for i in range(1, n - 1) :
    if k + a[i + 1] <= x :
        k = a[i + 1]     

    elif x >= k :
        cnt += k + a[i + 1] - x
        k = x - k

    else :
        cnt += k + a[i + 1] - x
        k = 0
    

print(cnt)

Measured memory_bytes: 19844
#include <cstdio>

int
main(void)
{
  int a, b, c;
  char op;

  while (std::scanf("%d %c %d", &a, &op, &b) != EOF) {
    if (op == '?') {
      break;
    }

    switch (op) {
      case '+':
        c = a + b;
        break;
      case '-':
        c = a - b;
        break;
      case '*':
        c = a * b;
        break;
      case '/':
        c = a / b;
        break;
    }

    printf("%d\n", c);
  }

  return 0;
}



Measured memory_bytes: 2728
#include <iostream>
using namespace std;
const int N_MAX = 20;
int main(){
  int N,A[N_MAX],B[N_MAX],C[N_MAX-1];
  cin >> N;
  for(int i=0;i<N;i++){cin >> A[i];A[i]--;}
  for(int i=0;i<N;i++) cin >> B[i];
  for(int i=0;i<N-1;i++)cin >> C[i];
  int hap=B[A[0]];
  for(int i=1;i<N;i++){
    hap+=B[A[i]];
    if(A[i]==A[i-1]+1)hap+=C[A[i-1]];
  }
  cout <<hap << 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;
using vi=vector<int>;
using vll=vector<ll>;
#define MOD 1e9+7

int main(){
    double a,b,x;
    double pi=3.14159265;
    cin >> a >> b >> x;
    x/=a;
    if(x*2<=a*b){
        //水が少ない
        cout << fixed << setprecision(8) << atan(b*b/(2*x))*180/pi << endl;
    }else{
        cout << fixed << setprecision(8) << abs(atan((x-a*b)*2/(a*a))*180/pi) << endl;
    }
}

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

typedef long long ll;

ll inf = 1e9+7;
ll fact[210] = {0};
ll inv[210] = {0};

ll mult(ll n, ll m){
	if(m==1) return n%inf;
	else if(m%2==0){
		ll t = mult(n,m/2);
		return (t*t)%inf;
	}else{
		ll t = mult(n,m-1);
		return (t*n)%inf;
	}
}

void factorial(ll N){
	for(ll i=0;i<=N;i++){
		if(i==0){
			fact[i] = 1;
			inv[i] = 1;
		}
		else{
			fact[i] = (i*fact[i-1])%inf;
			inv[i] = mult(fact[i],inf-2);
		}
	}
}

ll comb(ll n,ll k){
	if(n<k) return 0;
	if(n<0 || k<0) return 0;
	else return (((fact[n]*inv[k])%inf)*inv[n-k])%inf;
}

ll N,X;
ll dp[210][100010] = {};
ll S[210];
int main(){
    cin >> N >> X;
    factorial(N);
    ll ma = X;
    for(int i=1;i<=N;i++){
        cin >> S[i];
        ma = max(S[i],ma);
    }
    sort(S+1,S+N+1);
    ll ans = 0;
    for(int j=0;j<=ma;j++) dp[0][j] = j%S[1];
    for(ll i=1;i<=N;i++){//iまででjをもらったときの総和
        for(int j=0;j<=ma;j++){
            if(i!=1) dp[i][j] = (dp[i-1][j%S[i]]%inf+(dp[i-1][j]*(i-1)%inf))%inf;
            else dp[i][j] = j%S[i];
        }
        ll c = comb(N-1,N-i)*fact[N-i]%inf;
       // cerr << c << " " << dp[i-1][X%S[i]] << endl;
        (ans += dp[i-1][X%S[i]]*c)%=inf;
    }
    cout << ans << endl;
}

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

int main() {
	int aa, bb, mm;
	cin >> aa >> bb >> mm;
	vector<int> a(aa), b(bb);
	for (int i = 0; i < aa; i++) cin >> a[i];
	for (int i = 0; i < bb; i++) cin >> b[i];
	vector<array<int,3>> m(mm);
	for (int i = 0; i < mm; i++)
		cin >> m[i][0] >> m[i][1] >> m[i][2];

	int ans = INT_MAX;
	for (int i = 0; i < mm; i++) {
		int tmp = a[m[i][0]-1] + b[m[i][1]-1] - m[i][2];
		ans = min(ans, tmp);
	}

	sort(a.begin(), a.end());
	sort(b.begin(), b.end());
	ans = min(ans, a[0]+b[0]);
	ans = max(0, ans);

	cout << ans << endl;

}

Measured memory_bytes: 4984
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<algorithm>
#include<set>
#include<queue>
#define next Next
#define begin Begin
using namespace std;
typedef long long ll;
const int maxn=500000+10;
inline int read(){
	int x;
	char c;
	int f=1;
	while((c=getchar())!='-' && (c<'0' || c>'9'));
	if(c=='-') c=getchar(),f=-1;
	x=c^'0';
	while((c=getchar())>='0' && c<='9') x=(x<<1)+(x<<3)+(c^'0');
	return x*f;
}
priority_queue<int> q;
inline ll readll(){
	ll x;
	char c;
	ll f=1;
	while((c=getchar())!='-' && (c<'0' || c>'9'));
	if(c=='-') c=getchar(),f=-1;
	x=c^'0';
	while((c=getchar())>='0' && c<='9') x=(x<<1ll)+(x<<3ll)+(c^'0');
	return x*f;
}
int begin[maxn],next[maxn<<1],to[maxn<<1],e;
void add(int x,int y){
	to[++e]=y;
	next[e]=begin[x];
	begin[x]=e;
}
int d[maxn];
int p[maxn],a[maxn];
set<int> st1,st2;
int main(){
	int n=read(),k=read();
	for(int i=1;i<=n;i++){
		a[i]=read();
		p[a[i]]=i;
	}
	for(int i=1;i<k-1;i++) st1.insert(a[i]);
	for(int i=1;i<=n;i++){
		if(i+k-1<=n) st1.insert(a[i+k-1]);
		st1.erase(a[i-1]);
		st2.insert(a[i]);
		if(i>k) st2.erase(a[i-k]);
		set<int>::iterator it=st1.upper_bound(a[i]);
		if(it!=st1.end()) add(p[*it],i),d[i]++;
		it=st2.upper_bound(a[i]);
		if(it!=st2.end()) add(p[*it],i),d[i]++;
	}
	for(int i=1;i<=n;i++)
		if(!d[i])
			q.push(i);
	int ans=0;
	while(!q.empty()){
		int u=q.top();
		q.pop();
		a[u]=n-ans;
		ans++;
		for(int i=begin[u];i;i=next[i]){
			d[to[i]]--;
			if(!d[to[i]]) q.push(to[i]);
		}
	}
	for(int i=1;i<=n;i++)
		printf("%d\n",a[i]);
	return 0;
}

Measured memory_bytes: 42624
#include <stdio.h>
#include <math.h>
int min(int a, int b);
int main()
{
    int n, l; scanf("%d %d", &n, &l);
    int arr[500] ={0};
    for(int i=1; i<=n; i++)
        arr[i] = l+i-1;
    int diff[500] = {0};
    int sum = 0;
    for(int i=1; i<=n; i++)
        sum+=arr[i];
    int mn = 1000;
    int store;
    for(int i=1; i<=n; i++)
    {
        diff[i] = sum-arr[i];
        mn = min(mn, fabs(arr[i]));
        if(mn==fabs(arr[i]))
            store = diff[i];
    }
    printf("%d\n", store);
    return 0;
}

int min(int a, int b)
{
    if(a<=b)
        return a;
    else
        return b;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define rep1(i,n) for(int i=1;i<=(int)n;i++)
#define rep2(i,j,n) for(int j=i;j<n;j++)
#define rep3(i,j,n) for(int j=i;j<=n;j++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define sp(n) cout << fixed << setprecision(n)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
typedef long long ll;
using namespace std;
int main(void){
    string s,t;cin>>s>>t;
    sort(s.begin(),s.end());
    sort(t.rbegin(),t.rend());
    rep(i,s.size()){
        if(s[i]-'0'<t[i]-'0'){
            cout<<"Yes"<<endl;
            return 0;
        }else if(s[i]-'0'>t[i]-'0'){
            cout<<"No"<<endl;
            return 0;
        }
    }
    if(s.size()<t.size()){
        cout<<"Yes"<<endl;
        return 0;
    }else if(s.size()>t.size()){
        cout<<"No"<<endl;
        return 0;
    }
    cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdlib>
#include<cstdio>
#include<algorithm>
#include<string>
#include<iomanip>
#include<vector>
using namespace std;

int main(){
    int X, Y, Z;
    cin >> X >> Y >> Z;
    int tmp;

    tmp = X;
    X = Y;
    Y = tmp;

    tmp = X;
    X = Z;
    Z = tmp;

    cout << X << " " << Y << " " << Z;
    

}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<algorithm>
typedef long long ll;
#define base 2002
#define inv2 500000004ll
#define Mod 1000000007ll
#define N 200050
int n,a[N],b[N];
ll f[base*2][base*2];
ll fac[base*4],inv[base*4],ans;
inline ll qpow(ll b,ll p){
	ll res=1ll;
	while(p){
		if(p&1ll) (res*=b)%=Mod;
		(b*=b)%=Mod;
		p>>=1ll;
	}return res;
}
inline ll C(ll x,ll y){
	return fac[x]*inv[y]%Mod*inv[x-y]%Mod;
}
int main(){
	fac[0]=1;
	for(int i=1;i<=8000;++i)
		fac[i]=fac[i-1]*i%Mod;
	inv[8000]=qpow(fac[8000],Mod-2);
	for(int i=8000;i>=1;--i)
		inv[i-1]=inv[i]*i%Mod;
	scanf("%d",&n);
	for(int i=1;i<=n;++i){
		scanf("%d%d",&a[i],&b[i]);
		f[-a[i]+base][-b[i]+base]++;
	}
	for(int i=1;i<=4002;++i)
		for(int j=1;j<=4002;++j)
			f[i][j]=(f[i][j]+(f[i-1][j]+f[i][j-1])%Mod)%Mod;
	for(int i=1;i<=n;++i){
		ans=(ans+f[a[i]+base][b[i]+base])%Mod;
		ans=(ans-C(2ll*a[i]+2ll*b[i],2ll*a[i]))%Mod;
	}
	ans=(ans+Mod)%Mod;
	ans=(ans*inv2)%Mod;
	printf("%lld\n",ans);
	return 0;
}


Measured memory_bytes: 127104
#define _GLIBCXX_DEBUG
#include<algorithm>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<iostream>
#include<vector>
#include<queue>
#include<deque>
#include<stack>
#include<set>
#include<map>
#include<string>
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define rep2(i,s,n) for(int i=s;i< (int)n; i++)
#define ll long long 
#define all(v) v.begin(),v.end()
using namespace std;
int main(){
  ll n; cin >>n;
  vector<ll> t(n);
  rep(i,n) cin >> t[i];
  ll ans=t[0];
  rep(i,n-1){
    ans = ans/__gcd(ans,t[i+1])*t[i+1];
  }
  cout <<ans<<endl;
}

Measured memory_bytes: 3616
n = int(input())
s = list(input())
r_list = []
g_list = []
b_list = []

for i in range(n):
  if s[i] == "R":
    r_list.append(i)
  elif s[i] == "G":
    g_list.append(i)
  elif s[i] == "B":
    b_list.append(i)
    
judge = n%2
if judge == 1:
  lim = (n-3)//2 + 1
elif judge == 0:
  lim = (n-4)//2 + 1

pena = 0

for i in range(1,lim+1):
  for j in range(n-2*i):
    if (s[j] != s[j+i]) and (s[j] != s[j+2*i]) and (s[j+i] != s[j+2*i]):
      pena = pena + 1

print(len(r_list)*len(g_list)*len(b_list) - pena)

Measured memory_bytes: 9268
#include <bits/stdc++.h>
using namespace std;
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long
#define float long double 

int32_t main()
{
  IOS;
  int n;
  cin>>n;
  vector<int> v(n+1,0);
  for(int i=1; i<=n; i++)
  {
    for(int j=i; j<=n; j+=i)
    {
      v[j]++;
    }
  }
  
  int total = 0;
  for(int i=1; i<=n; i++)
  {
    total += i*v[i];
  }

  cout<<total<<endl;
  
  return 0;
}

Measured memory_bytes: 81348
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <algorithm>
#include <math.h>
typedef long long ll;
using namespace std;

int main()
{
	string s; cin >> s;
	char c = s[0];
	int n = atoi(&c);
	if (s[1] > s[0]) cout << n + 1 << n + 1 << n + 1;
	else if (s[1] < s[0]) cout << n << n << n;
	else
	{
		if (s[2] > s[1]) cout << n + 1 << n + 1 << n + 1;
		else if (s[2] < s[1]) cout << n << n << n;
		else cout << n << n << n;
	}
}	

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

namespace ABC149
{
    class B
    {
        static void Main(string[] args)
        {
            long[] input = Console.ReadLine().Split().Select(long.Parse).ToArray();
            long A = input[0];
            long B = input[1];
            long K = input[2];

            if (K <= A)
            {
                Console.WriteLine("{0} {1}", A - K, B);
            }
            else if (K - A <= B)
            {
                Console.WriteLine("{0} {1}", 0, B - (K - A));
            }
            else
            {
                Console.WriteLine("{0} {1}", 0, 0);
            }
        }
    }
}

Measured memory_bytes: 13396
#coding: utf-8
import math
import heapq
import bisect
#from scipy.misc import comb

MOD = 10**9+7

N,M = map(int, input().split())
A = []
for i in range(M):
    a = int(input())
    A.append(a)    

ans = [1,1]+[0]*(N-1)
for a in A:
    ans[a]=-1

for i in range(2,N+1):
    if ans[i]!=-1:
        if ans[i-2]!=-1:
            ans[i]=(ans[i]+ans[i-2])%MOD
        if ans[i-1]!=-1:
            ans[i]=(ans[i]+ans[i-1])%MOD

print(ans[N])


Measured memory_bytes: 8652
//標準関数をすべてインクルードする。
#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> P;

int main(){
    //cin coutを高速化
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	std::cout.tie(0);

    int h, a;
    int res = 0;

    cin >> h >> a;

    while(h > 0){
        h -= a;
        res++;
    }

    cout << res << endl;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std ;

int main( void ) {
   int S, h, m, s ;

   cin  >> S ;

   h =   S      /3600          ;
   m = ( S - ( h*3600 ) ) / 60 ;
   s =   S - h*3600 - m*60     ;

   cout << h << ":" << m << ":" << s << endl ;

   return 0 ;
}

Measured memory_bytes: 3116
#include <stdio.h>
#include <math.h>
#define PI 3.14159265358979323846264338327950L

int main(void){
    int A,B,H,M;
    long double rad,ans;
    scanf("%d %d %d %d",&A,&B,&H,&M);
    
    rad = ((((long double)H + ((long double)M/60))/12)-((long double)M/60))*2*PI;
   
    ans = sqrtl((long double)(A*A + B*B) -(long double)(2*A*B)*cosl(rad));
    printf("%20.20Lf\n",ans);

    return 0;
}

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

int main() {
  int N;
  string arare;

  cin >> N;

  for (int i = 0; i < N; i++) {
    string S;
    cin >> S;
    arare += S;
  }

  int P = 0, W = 0, G = 0, Y = 0;
  int arareNum = 0;
  
  if (arare.find("P") != string::npos) P = 1;
  if (arare.find("W") != string::npos) W = 1;
  if (arare.find("G") != string::npos) G = 1;
  if (arare.find("Y") != string::npos) Y = 1;

  arareNum = P + W + G + Y;
 
  if (arareNum == 3) cout << "Three" << endl;
  if (arareNum == 4) cout << "Four" << endl;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    
    public static void main(String[] args) {
        Main main = new Main();
        main.solv();
    }
    
    private void solv() {
        Scanner input = new Scanner(System.in);
        int N = input.nextInt();
        Card[] cards = new Card[N];
        for (int i = 0; i < N; i++) {
            cards[i] = Card.newInstance(input.next());
        }
        Card[] bs = bubbleSort(Arrays.copyOf(cards, N));
        print(bs);
        System.out.println("Stable");
        Card[] ss = selectionSort(Arrays.copyOf(cards, N));
        print(ss);
        System.out.println(compareCards(bs, ss) ? "Stable" : "Not stable");
    }
    
    private Card[] bubbleSort(Card[] cs) {
        for (int i = 0; i < cs.length; i++) {
            for (int j = cs.length - 1; i < j; j--) {
                if (cs[j].getNumber() < cs[j-1].getNumber()) {
                    Card c = cs[j];
                    cs[j] = cs[j-1];
                    cs[j-1] = c;
                }
            }
        }
        return cs;
    }
    
    private Card[] selectionSort(Card[] cs) {
        for (int i = 0; i < cs.length; i++) {
            int mini = i;
            for (int j = i; j < cs.length; j++) {
                if (cs[j].getNumber() < cs[mini].getNumber()) {
                    mini = j;
                }
            }
            Card c = cs[i];
            cs[i] = cs[mini];
            cs[mini] = c;
        }
        return cs;
    }
    
    private boolean compareCards(Card[] xs, Card[] ys) {
        if (xs.length != ys.length) return false;
        for (int i = 0; i < xs.length; i++) {
            if (xs[i].toString().equals(ys[i].toString()) == false) {
                return false;
            }
        }
        return true;
    }
    
    private void print(Object[] xs) {
        StringBuilder sb = new StringBuilder();
        for (Object x : xs) sb.append(x.toString()).append(' ');
        System.out.println(sb.toString().trim());
    }
    
    private static class Card {
        private String mark;
        private int number;
        
        private Card(String str) {
            mark = str.substring(0, 1);
            number = Integer.valueOf(str.substring(1));
        }
        
        public static Card newInstance(String str) {
            return new Card(str);
        }
        
        public int getNumber() {
            return number;
        }
        
        public String getMark() {
            return mark;
        }
        
        @Override
        public String toString() {
            return mark + number;
        }
    }
}

Measured memory_bytes: 17396
#include <algorithm>
#include <bits/stdc++.h>
#include <cstdint>
#include <iostream>
#include <iterator>
#include <vector>

// lib/util.hpp
#ifndef UTIL_HPP
#define UTIL_HPP


typedef ::std::int_fast64_t i64;
typedef ::std::uint_fast64_t u64;
typedef ::std::int_fast32_t i32;
typedef ::std::uint_fast32_t u32;

namespace tools {
  template <typename T>
  void read(::std::istream& is, ::std::vector<T>& vector, const typename ::std::vector<T>::size_type size) {
    vector.reserve(size);
    ::std::copy_n(::std::istream_iterator<T>(is), size, ::std::back_inserter(vector));
  }
  template <typename T>
  void read(::std::vector<T>& vector, const typename ::std::vector<T>::size_type size) {
    ::tools::read(::std::cin, vector, size);
  }

  template <typename T, ::std::size_t N>
  void read(::std::istream& is, ::std::array<T, N>& array) {
    ::std::copy_n(std::istream_iterator<T>(is), N, array.begin());
  }
  template <typename T, ::std::size_t N>
  void read(::std::array<T, N>& array) {
    ::tools::read(::std::cin, array);
  }
}

#endif

// main.cpp

int main() {
  i64 N, K;
  std::cin >> N >> K;
  std::vector<i64> h;
  tools::read(h, N);
  std::cout << std::count_if(h.begin(), h.end(), [&K](const i64& h_i) { return h_i >= K; }) << std::endl;
  return 0;
}

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

int main() {
	int a,b,c;
	cin >>a>>b>>c;
	if (a<b){
		if(b<c){
			cout<<"Yes"<<endl;
		}
		else{
			cout<<"No"<<endl;
		}
	}
	else{
		cout<<"No"<<endl;
	}
	return 0;
}

Measured memory_bytes: 3092
#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;

int main(){
    char a, b;
    cin >> a >> b;
    bool flag = false;
    if (a == 'H' && b == 'H'){
        flag = true;
    }
    if (a == 'D' && b == 'D'){
        flag = true;
    }
    if (flag){
        cout << 'H' << endl;
    }else{
        cout << 'D' << endl;
    }
    
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
const int INF=1e10;

int main(){
	ll a,b,c,d;
	vector<ll> ans(4,0);
	cin >> a >> b >> c >> d;
	ans[0] = a *c;
	ans[1] = a * d;
	ans[2] = b * c;
	ans[3] = b * d;
	sort(ans.rbegin(),ans.rend());
	cout << ans[0]<<endl;
}

Measured memory_bytes: 3628
num_list = sorted(list(map(int,input().split()))) #標準入力をして小さい順にしリストに入れる
num1 = num_list[0] + num_list[3] #リストの１番大きい数と１番小さい数を足す
num2 = num_list[1] + num_list[2] #リストの2番目と三番目を足す
print(max(num1,num2) - min(num1,num2)) #2つの数の大きい方から小さい方を引く


Measured memory_bytes: 5592
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int n;
    cin>>n;
    int x[n];
    int y[n];
    double ans=0;
    for(int i=0;i<n;++i){
        cin>>x[i]>>y[i];
    }
    for(int i=0;i<n;++i){
        for(int j=i;j<n;++j){
        ans+=sqrt((x[i]-x[j])*(x[i]-x[j])+(y[i]-y[j])*(y[i]-y[j]));   
    }
    }
    ans=ans/n*2;
    ans=ans/(n-1);
    ans=ans*(n-1);
    cout<<std::setprecision(14)<<ans<<endl;
    // Your code here!
    
}


Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <vector>
#include <algorithm>
#include <string>
#include <bitset>
#include <deque>
#include <queue>
#define SIZE 100
using namespace std;
using ll = long long int;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n, k;
    cin >> n >> k;
    deque<ll> dq;
    for (size_t _ = 0; _ < n; _++)
    {
        ll vi;
        cin >> vi;
        dq.push_back(vi);
    }

    ll ans = 0;
    for (size_t i = 0; i <= k; i++)
    {
        for (size_t j = 0; j <= i; j++)
        {
            // 宝石を取る
            deque<ll> d = dq;
            priority_queue<ll, vector<ll>, greater<ll>> pq;
            int a = j;
            int b = i - j;
            int n_cnt = k - i;

            // 左から取る
            for (size_t _ = 0; _ < a; _++)
            {
                if (!d.empty())
                {
                    ll v = d.front();
                    d.pop_front();
                    pq.push(v);
                }
            }
            // 右から取る
            for (size_t _ = 0; _ < b; _++)
            {
                if (!d.empty())
                {
                    ll v = d.back();
                    d.pop_back();
                    pq.push(v);
                }
            }

            for (size_t cnt = 0; cnt <= n_cnt; cnt++)
            {
                // 捨てる
                auto p = pq;
                for (size_t i = 0; i < cnt; i++)
                {
                    if (!p.empty())
                    {
                        p.pop();
                    }
                }
                // 合計を計算する
                ll sum = 0;
                while (!p.empty())
                {
                    sum += p.top();
                    p.pop();
                }
                ans = max(ans, sum);
            }
        }
    }
    cout << ans << endl;
}

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


int main(){
string s;
  cin>>s;
  if(s=="Sunny"s)cout<<"Cloudy"<<endl;
  if(s=="Cloudy"s)cout<<"Rainy"<<endl;
  if(s=="Rainy"s)cout<<"Sunny"<<endl; 
}
      


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
//using P = pair<int,int>;
using Graph = vector<vector<int>>;
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;

vector<int> Eratosthenes( const int N )
{
    std::vector<bool> is_prime( N + 1 );
    for( int i = 0; i <= N; i++ )
    {
        is_prime[ i ] = true;
    }
    std::vector<int> P;
    for( int i = 2; i <= N; i++ )
    {
        if( is_prime[ i ] )
        {
            for( int j = 2 * i; j <= N; j += i )
            {
                is_prime[ j ] = false;
            }
            P.emplace_back( i );
        }
    }
    return P;
}
int main()
{
    int N;
    cin >> N;
    int y=0, m=0;
    for( const auto &x: Eratosthenes( N ) )
    {
        ++m;
    }
    vector<int> a(m);
    for( const auto &x: Eratosthenes( N ) )
    {
        a[y]=x;
        ++y;
    }
    if(a[m-1]==N){
        cout << N << "\n";
        return 0;
    }
    while(1){
        int flag=0;
        for(auto i : a){
            if(N%i==0){
                ++N;
                flag=1;
                break;
            }
        }
        if(flag==0){
        cout << N << "\n";
        return 0;
        }
    }
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
#define fo(i,a,b) for(int i=a;i<=b;i++)
long long N,M,L,D,l,ans;
char s[110000],t[110000];
long long gcd(long long a,long long b){
	if (b==0) return a;
	return gcd(b,a%b);
}
inline void chec(long long d){
	if (d<=ans) return;
	l=L/d;
	long long pos,p,q,b1=l/N,b2=l/M,te=b1/gcd(b1,b2)*b2,num=l/te;//num=L/te!!!!
	fo(i,0,num-1){
		pos=te*i;
		p=pos/b1;q=pos/b2;
		if (s[p+1]!=t[q+1]) return;
	}
	ans=d;
}
int main(){
	scanf("%d%d%s%s",&N,&M,s+1,t+1);
	D=gcd(N,M);L=N*M;ans=-1;
	for(long long i=1;i*i<=D;i++){
		chec(i);
		if (i*i<D) chec(D/i);
	}
	if (ans>0) ans=L/ans;
	printf("%lld\n",ans);
	return 0;
} 

Measured memory_bytes: 384
#include <iostream>

using namespace std;

int main(){
int w,h,x,y,r;
cin>>w>>h>>x>>y>>r;
if(0<= x-r && x+r <= w&&0<= y-r&&y+r<=h)
cout<<"Yes"<<endl;
else
cout<<"No"<<endl;
        return 0;
}



Measured memory_bytes: 3116
#include<bits/stdc++.h>
using namespace std;
int h,w,n;
void solve(){
    scanf("%d%d%d",&h,&w,&n);
    h=max(h,w);
    printf("%.0lf\n",ceil(1.0*n/h));
}
int main(){
    solve();

    return 0;
}

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

const int N=2005;

int n,sum,ans;

bitset<N*N> bag;

void work()
{
	sum=0;bag.reset();bag[0]=1;
	for(int x,i=1;i<=n;i++) scanf("%d", &x),sum+=x,bag|=bag<<x;
	for(ans=(sum+1)/2;!bag[ans];ans++);
    printf("%d\n", ans);
}

int main()
{
    while(scanf("%d",&n)!=EOF) work(); 
    return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define EPS (1e-9)
#define INF (1e9)
#define PI (acos(-1))
//const double PI = acos(-1);
//const double EPS = 1e-15;
//long long INF=(long long)1E17;
#define i_7 (long long)(1e9+7)
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
using namespace std;

bool prime_(int n){
  if(n==1){
    return false;
  }else if(n==2){
    return true;
  }else{
    for(int i=2;i<=sqrt(n);i++){
      if(n%i==0){
        return false;
      }
    }
    return true;
  }
}

long long gcd_(long long a, long long b){
  if(a<b){
    swap(a,b);
  }
  if(a%b==0){
    return b;
  }else{
    return gcd_(b,a%b);
  }
}
 
long long lcm_(long long x, long long y){
  return (x/gcd_(x,y))*y;
}

int main(){
  
  int n;
  cin>>n;
  double ans;
  if(n%2==0){
    ans = 0.5;
  }else{
    ans = (double)((n+1)/2)/(double)n;
  }
  cout<<fixed<<setprecision(7)<<ans<<endl;
  
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
  int n;
  ll k;
  cin >> n >> k;
  vector<ll> cnt(100001);
  for(int i=0; i<n; i++){
    int a, b;
    cin >> a >> b;
    cnt[a] += b;
  }
  for(int i=1; i<100001; i++){
    if(k<=cnt[i]){
      cout << i << endl;
      break;
    }
    k -= cnt[i];
  }
  return 0;
}

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

using namespace std;

int main(){
    int n,k,sum=1;
    cin>>n>>k;
    for (int i=1; i<=n; i++) {
        if (sum+k>=2*sum) {
            sum = 2*sum;
        }else{
            sum += k;
        }
    }
    cout<<sum<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<queue>
#include<string>
#include<stack>
#include<cstdio>
#include<algorithm>

using namespace std;

int main(void)
{
  int i=0;
  int j=0;
  int n=0;
  int a[1000000]={};
  int sum=0;

  while(scanf("%d",&n)!=EOF)
    {
      for(i=0;i<1000000;i++)
        a[i]=1;
      sum=0;

      for(i=2;i<=n;i++)
        {
          if(a[i-1]==0)
            continue;
          for(j=2;j<=n/i;j++)
            a[i*j-1]=0;
        }

      for(i=1;i<n;i++)
        sum+=a[i];

      cout<<sum<<endl;

    }


  return 0;

}

Measured memory_bytes: 7040
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;cin>>n;
	int k=n%10;;
	if(k==3)
	cout<<"bon"<<endl;
	else if(k==0||k==1||k==6||k==8)
	cout<<"pon"<<endl;
	else
	cout<<"hon"<<endl;
	return 0;
 } 

Measured memory_bytes: 3596
#include <iostream>
#include <map>
#include <cmath>
#define ll long long
using namespace std;

int main()
{
    ll a,b,n;
    cin >> a >> b >> n;
    ll M;
    if((b-1)>=n){
        M=floor((a*(n))/b)- a*floor((n)/b);
    }
    else{
        M=floor((a*(b-1))/b)- a*floor((b-1)/b);
    }


    cout << M;
    return 0;
}


Measured memory_bytes: 3544
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int A[] = new int[N];
		long B[] = new long[2000000];
		for (int i=0;i<N;i++) {
			A[i]= sc.nextInt();
		}
		boolean b = true;
		for (int i=0;i<N&&b;i++) {
			int temp = A[i];
			for (int j=2;j*j<=temp&&b;j++) {
				boolean t= true;
				while (temp%j==0) {
					if (t==true) {
						B[j]++;
						if (B[j]>1) {
							b = false;
							break;
						}
						t = false;
					}
					temp = temp/j;
				}
			}
			B[temp]++;
			if (B[temp]>1&&temp>1) {
				b = false;
				break;
			}
		}
		if (b== true)  {
			System.out.println("pairwise coprime");
			return ;
		}
		int gcd = A[0];
		for (int i=1;i<N;i++) {
			gcd= Main.gcd(gcd, A[i]);
		}
		if (gcd==1) {
			System.out.println("setwise coprime");
			return ;
		}
		System.out.println("not coprime");
		return ;
	}

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

Measured memory_bytes: 80856
#include <bits/stdc++.h> 
using namespace std;
#define pb push_back
#define ll long long int
#define vi vector<int>
#define ii pair<int,int>
#define vli vector<ll>
#define graph vector<vector< int > >
#define vpi vector<pair<int ,int> >
#define vpli vector<pair<ll ,ll> >
#define mp make_pair
#define F first
#define S second
#define mod 37
#define INF (ll)1e18
#define wh(a) cout<<#a<<"  is  "<<a<<endl;
#define INI(a) memset(a,0,sizeof(a))
#define LIMIT 40000010

void solve(){
    int k;
    cin>>k;
    string s;
    cin>>s;
    int n=s.size();
    if(n<=k){
        cout<<s;
        return;
    }
    cout<<s.substr(0,k)+"...";
}

int main(){
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    // #ifndef ONLINE_JUDGE
    // freopen("input.txt", "r", stdin);
    // #endif
    int t=1;
    // cin>>t;
    while(t--){
        solve();
    }
    return 0;
}

Measured memory_bytes: 3656
#include <iostream>
#include <string>
#include <cstdlib>
#include <vector>
#include <array>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#define _USE_MATH_DEFINES
#include <cmath>
#include <climits>
#include <cstdio>
#include <iomanip>
#include <utility>
#include <unordered_map>

using namespace std;
typedef long long int ll;

#define SP(x) setprecision((int)x)
#define SW(x) setw(x)    // 桁数指定
#define SF(c) setfill(c) // 埋め文字指定('0')
#define ALL(v) v.begin(), v.end()

int main(int argc, char const *argv[])
{
    ll n, a, b;
    cin >> n >> a >> b;
    ll ans = 0;
    cout << n / (a + b) * a + min(a, n % (a + b)) << endl;
}


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

int main()
{
    int n,l;
    cin >> n >> l;
    int c[1000] = {}, t[1000] = {};
    int cmin = 99999;
    for(int i=0;i<n;i++)
    {
        cin >> c[i] >> t[i];
        if(t[i]<=l && c[i]<cmin)
            cmin = c[i];
    }
    if(cmin==99999)
        cout << "TLE";
    else
        cout << cmin;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{	int a;
	int count = 0;
	scanf("%d",&a);
	if(a % 2)
		count += 1;
	if(a - 10 == 0 || a - 10 == 1||a - 10 ==100 || a - 10 == 101)
		count += 1;
	if(a - 100 >= 0)
		count += 1;
	printf("%d\n",count);
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define int long long
#define pii pair<int,int>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(c) (c).begin(),(c).end()
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define MINF(a) memset(a,0x3f,sizeof(a))
#define POW(n) (1LL<<(n))
#define IN(i,a,b) (a <= i && i <= b)
using namespace std;
template <typename T> inline bool CHMIN(T& a,T b) { if(a>b) { a=b; return 1; } return 0; }
template <typename T> inline bool CHMAX(T& a,T b) { if(a<b) { a=b; return 1; } return 0; }
template <typename T> inline void SORT(T& a) { sort(ALL(a)); }
template <typename T> inline void REV(T& a) { reverse(ALL(a)); }
template <typename T> inline void UNI(T& a) { sort(ALL(a)); a.erase(unique(ALL(a)),a.end()); }
template <typename T> inline void LB(vector<T>& v, T& a) { return *lower_bound(ALL(v),a); }
template <typename T> inline void LBP(vector<T>& v, T& a) { return lower_bound(ALL(v),a) - v.begin(); }
template <typename T> inline void UB(vector<T>& v, T& a) { return *upper_bound(ALL(v),a); }
template <typename T> inline void UBP(vector<T>& v, T& a) { return upper_bound(ALL(v),a) - v.begin(); }
template <typename T1, typename T2> ostream& operator<< (ostream& os, const pair<T1,T2>& p) { os << p.first << " " << p.second; return os; }
template <typename T1, typename T2> istream& operator>> (istream& is, pair<T1,T2>& p) { is >> p.first >> p.second; return is; }
template <typename T> ostream& operator<< (ostream& os, const vector<T>& v) { REP(i,v.size()) { if (i) os << " "; os << v[i]; } return os; }
template <typename T> istream& operator>> (istream& is, vector<T>& v) { for(T& in : v) is >> in; return is; }
template <typename T = int> vector<T> make_v(size_t a) { return vector<T>(a); }
template <typename T, typename... Ts> auto make_v(size_t a, Ts... ts) { return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...)); }
template< typename T, typename V > typename enable_if< is_class< T >::value == 0 >::type fill_v(T &t, const V &v) { t = v; }
template< typename T, typename V > typename enable_if< is_class< T >::value != 0 >::type fill_v(T &t, const V &v) { for(auto &e : t) fill_v(e, v); }
const int MOD = 1000000007;
const int INF = 0x3f3f3f3f3f3f3f3f;
const double EPS = 1e-10;

int edit_distance(string s, string t) {
  int n = s.size(), m = t.size();
  vector<vector<int>> dp(n + 1, vector<int>(m + 1, n + m));
  dp[0][0] = 0;
  for (int i = 0; i <= n; i++) {
    for (int j = 0; j <= m; j++) {
      if (i < n) dp[i + 1][j] = min(dp[i + 1][j], dp[i][j] + 1);
      if (j < m) dp[i][j + 1] = min(dp[i][j + 1], dp[i][j] + 1);
      if (i < n && j < m) dp[i + 1][j + 1] = min(dp[i + 1][j + 1], dp[i][j] + (s[i] != t[j]));
    }
  }
  return dp[n][m];
}

signed main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);

  string s,t;
  cin >> s >> t;
  cout << edit_distance(s,t) << endl;

  return 0;
}


Measured memory_bytes: 10772
N,M=map(int, input().split())
#M*1900  (0.5)**M  (N-M)*100
ans=0
p=1
for i in range(10**5):
  ans+=(i+1)*(M*1900+(N-M)*100)* (p*((0.5)**M))
  p*=(1-(0.5)**M)
  #print(ans)
  
  #print(p)
  
print(round(ans))

Measured memory_bytes: 2940
S = input()
N = len(S)
flag = True
for i in range(N//2):
  if S[2*i] == 'L':
    flag = False
  if S[2*i+1] == 'R':
    flag = False
    
if N%2 == 1 and S[N-1] =='L':
    flag = False
    
if (flag):
  print("Yes")
else:
  print("No")

Measured memory_bytes: 3060
import sys
n,y=map(int,input().split())
if n*10000<y:
    print(-1,-1,-1)
    sys.exit()
for i in range(y//10000+1):
    rem1=y-i*10000
    for j in range(rem1//5000+1):
        rem2=rem1-j*5000
        if rem2//1000+i+j==n:
            print(i,j,rem2//1000)
            sys.exit()
print(-1,-1,-1)

Measured memory_bytes: 3064
S = input()

EVEN = 'L'
ODD = 'R'

L = list(S)
for i in range(len(L)):
    if L[i] in ['U', 'D']:
        continue
    if (i + 1) % 2 == 0:
        if L[i] != EVEN:
            print("No")
            exit()
    else:
        if L[i] != ODD:
            print("No")
            exit()
print("Yes")


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

int main() {
  int H, W;
  cin >> H >> W;
  
  vector<char> frame(W+2, '#');
  
  for (int i = 0; i < W+2; i++) {
    cout << frame.at(i);
  }
  
  cout << endl;
  
  for (int i = 0; i < H; i++) {
   vector<char> a(W+2, '#');
    
    for (int j = 1; j < W+1; j++) {
      cin >> a.at(j);
    }
    
    for (int j =0; j < W+2; j++) {
      cout << a.at(j);
    }
    
    cout << endl;  
    
  }
  
  for (int i = 0; i < W+2; i++) {
    cout << frame.at(i);
  }
  
  cout << endl;
  
}

Measured memory_bytes: 256