akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
 
#define int long long
 
#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;
 
template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}
 
 
signed main(){
    string S;cin>>S;
    rep(i,S.size()){
        if(i%2==0&&S[i]=='L'||i%2==1&&S[i]=='R'){
            cout<<"No"<<endl;
            return 0;
        }
    }
    cout<<"Yes"<<endl;
    return 0;
}

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

int main() {
    string N;
    cin >> N;
    
    string ans = "No";
    for(int i = 0; i < 2; ++i){
        if(N[i] == N[i+1]
        && N[i+1] == N[i+2]){
            ans = "Yes";
            break;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(v) v.begin(), v.end()

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

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

int main() {
  
  int n,d;
  cin>>n>>d;
  
  cout << (n+2*d)/(2*d+1) <<endl;
  
  return 0;
}

Measured memory_bytes: 256
#include <cstdio>

int main(){
    int n,x;
    scanf("%d %d",&n,&x);
    int m[n];
    for(int i = 0; i < n; i++){
        scanf("%d",&m[i]);
    }
    for(int i = 0; i < n; i++){
        x -= m[i];
    }
    int min = m[0];
    for(int i = 0; i < n; i++){
        if(m[i] < min){
            min = m[i];
        }
    }
    printf("%d\n",n + x / min);

    return 0;
}

Measured memory_bytes: 128
import java.io.*;

class Main{
	static public void main (String args[]) throws IOException{
		BufferedReader buf = new BufferedReader(new InputStreamReader(System.in));
		//StringBuilder sb = new StringBuilder();

		while(true){
			String[] s;
			s = buf.readLine().split(" ");	
			int a = Integer.parseInt(s[0]);
			int b = Integer.parseInt(s[2]);

			if(s[1].equals("+"))
				System.out.println(a+b);
			else if(s[1].equals("-"))
				System.out.println(a-b);
			else if(s[1].equals("*"))
				System.out.println(a*b);
			else if(s[1].equals("/"))
				System.out.println(a/b);
			else 
				break;
		}
		

	}
}

Measured memory_bytes: 23980
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
using namespace std;
typedef long long ll;
int INF = (1LL << 30) - 1;
int MOD = 1e9+7;    
const int size = 1000000;
int arr[size+1] = {};
main(){
    
    arr[1] = 1;
    for(int i = 2;i * i <= size;i++){
        if(arr[i])continue;
        for(int j = i * 2;j <= size;j += i){
            arr[j] = 1;
        }
    }
    set<int> prime;
    rep(i,1,size+1)if(!arr[i])prime.insert(i);

    //rep(i,1,30)if(prime.count(i))cout << i << endl;

    int A,D,N;
    cin >> A >> D >> N;
    while(A){
        int cnt = 0,num = A - D;
        while(cnt < N){
            num += D;
            if(prime.count(num))cnt++;
        }
        cout << num << endl;
        cin >> A >> D >> N;
    }
}


Measured memory_bytes: 10612
#include <cstdio>
#include <queue>

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

using namespace std;

int main(){
	int n; scanf("%d",&n);
	static int a[1000][999];
	rep(u,n) rep(i,n-1) scanf("%d",a[u]+i), a[u][i]--;

	int idx[1000]={};
	static bool match[1000][1000]={};

	queue<pair<int,int>> Q;
	rep(u,n){
		int v=a[u][0];
		if(a[v][0]==u && u<v) Q.emplace(u,v);
	}

	int ans=0,cnt=0;
	while(cnt<n){
		vector<int> U; // updated players
		while(!Q.empty()){
			int u=Q.front().first;
			int v=Q.front().second;
			Q.pop();
			match[u][v]=match[v][u]=true;
			U.emplace_back(u);
			U.emplace_back(v);
		}

		if(U.empty()){ puts("-1"); return 0; }

		for(int u:U) if(idx[u]<n-1) {
			while(1){
				idx[u]++;
				if(idx[u]==n-1) break;
				int w=a[u][idx[u]];
				if(!match[u][w]) break;
			}
			if(idx[u]==n-1){
				cnt++;
			}
			else{
				int w=a[u][idx[u]];
				if(a[w][idx[w]]==u) Q.emplace(u,w);
			}
		}

		ans++;
	}

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

	return 0;
}


Measured memory_bytes: 5120
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds;   
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define ld long double
#define dd double
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define sz(a) (ll)(a.size())
typedef long long ll;
typedef unsigned long long ull;
typedef pair <ll, ll> pll;
typedef pair <int, int> pii;
typedef vector<pll> vplll;
ll mod = 1e9+7;
const ld PI = 2 * acos(0.0);
const vector<ll> dx = {1, -1, 0, 0};
const vector<ll> dy = {0, 0, 1, -1};
#define round(x, y) ((x + y - 1) / y)
#define ce(x, y) ((x + y - 1) / y)
#define amax(x, y) \
    if (y > x)     \
        x = y;
#define amin(x, y) \
    if (y < x)     \
        x = y;
#define lcm(x, y) ((x) * (y) / __gcd(x, y))
#define len(x) (ll) x.length()
#define sq(x) ((x) * (x))
#define cb(x) ((x) * (x) * (x))
ll dp[2001][2001];
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll a,b,c,t,n,m,k,q; 
    t = 1;
    // cin>>t;
    while(t--)
    {
        cin>>n;
        vector <pll> v;
        v.pb(mp(1e18,-1));
        for(int i=0;i<n;i++)
        {
            cin>>a;
            v.pb(mp(a,i+1));
        }
        sort(rbegin(v), rend(v));
        for(int i=1;i<=n;i++)
        {
            for(int j=0;j<i;j++)
            {
                ll x = n-(i-j-1);
                x = v[i].ff*(abs(v[i].ss-x));
                dp[i][j] = max(dp[i][j], dp[i-1][j] + x);
                x = v[i].ff*(abs(v[i].ss-j-1));
                dp[i][j+1] = max(dp[i-1][j]+x,dp[i][j+1]);
            }
        }
        m = 0;
        for(int i=1;i<=n;i++)
            m = max(m,dp[n][i]);
        cout<<m<<endl;
    }
    return 0;
}

Measured memory_bytes: 26344
#include<bits/stdc++.h> 
using namespace std;
int n;
long long f[87]; 
int main()
{
    cin>>n;
    f[0]=2; 
    f[1]=1;
    for(int i=2;i<=n;i++)
        f[i]=f[i-1]+f[i-2]; 
    cout<<f[n]; 
}

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

using namespace std;

#define SZ(x) (int)(x.size())

using ll = long long;
using ld = long double;
using P = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
const double eps = 1e-10;
const ll MOD = 1000000007;
const int INF = 1000000000;
const ll LINF = 1ll<<50;

template<typename T>
void printv(const vector<T>& s) {
  for(int i=0;i<(int)(s.size());++i) {
    cout << s[i];
    if(i == (int)(s.size())-1) cout << endl;
    else cout << " ";
  }
}

template<typename T1, typename T2>
ostream& operator<<(ostream &os, const pair<T1, T2> p) {
  os << p.first << ":" << p.second;
  return os;
}

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

  int n, k; cin >> n >> k;
  int cnt = 0;
  while(n > 0) {
    cnt++;
    n /= k;
  }
  cout << cnt << endl;

}


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

#define rep(i, a) for (int i = 0; i < (a); ++i)
#define REP(i, a, b) for (int i = (a); i < (b); ++i)

#define CHOOSE(a) CHOOSE2 a
#define CHOOSE2(a0, a1, a2, a3, a4, x, ...) x
#define debug_1(x1) cerr << #x1 << ": " << x1 << endl
#define debug_2(x1, x2) cerr << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << endl
#define debug_3(x1, x2, x3) cerr << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " << x3 << endl
#define debug_4(x1, x2, x3, x4) cerr << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " << x3 << ", " #x4 << ": " << x4 << endl
#define debug_5(x1, x2, x3, x4, x5) cerr << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " << x3 << ", " #x4 << ": " << x4 << ", " #x5 << ": " << x5 << endl
#define debug(...) CHOOSE((__VA_ARGS__, debug_5, debug_4, debug_3, debug_2, debug_1, ~)) (__VA_ARGS__)

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

void Main() {
  int s;
  cin >> s;
  map<int, int> a;
  REP(i, 1, 1000000) {
    if (a[s]) {
      cout << i << endl;
      return;
    } else {
      a[s] = i;
    }
    if (s & 1) s = 3*s + 1;
    else s /= 2;
  }
}

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


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

int main() {
    long  N;
    cin >> N;
    long t[5];
    long ans;

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

    sort(t, t+5);

    if (N % t[0]) {
      ans = (N / t[0]) + 5;
    } else {
      ans = (N / t[0]) + 4;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define mod 1000000007
#define MAXN 1010
#define F first
#define S second

using namespace std;

char ground[MAXN][MAXN];
int w, h, dp[MAXN][MAXN], x, y, nf[]={1, 0}, nc[]={0, 1};
bool mk[MAXN][MAXN];
queue<pair<int, int> >q;

void bfs(int x, int y){
    q.push({x, y});
    dp[x][y]=1;
    while(!q.empty()){
        x=q.front().F; y=q.front().S;
        q.pop();
        if(mk[x][y]) continue;
        mk[x][y]=true;
        for(int i=0; i<2; i++){
            if(x+nf[i]>w||y+nc[i]>h||ground[x+nf[i]][y+nc[i]]=='#') continue;
            dp[x+nf[i]][y+nc[i]]=((dp[x+nf[i]][y+nc[i]]%mod)+(dp[x][y]%mod))%mod;
            q.push({x+nf[i], y+nc[i]});
        }
    }
}

int main(){

    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    cin>>w>>h;

    for(int i=1; i<=w; i++){
        for(int j=1; j<=h; j++){
            cin>>ground[i][j];
        }
    }

    bfs(1, 1);

    cout<<dp[w][h];

return 0;
}


Measured memory_bytes: 6272
# coding: utf-8
# Your code here!

inp = input()

input_list = inp.split()

a = int(input_list[0])
b = int(input_list[1])

count = 0

for i in range(2):
    if a < b:
        count += b
        b -= 1
    else:
        count += a
        a -= 1

print(count)



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

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


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

int main() {
    int N;
    long long t, a, T, A;
    scanf("%d", &N);
    T = A = 1;
    for (int i = 0; i < N; i++) {
        scanf("%lld %lld", &t, &a);
        long long j = max((T - 1) / t, (A - 1) / a);
        j++;
        T = j * t;
        A = j * a;
    }
    printf("%lld\n", T + A);
    return 0;
}

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

typedef long long ll;
//const int INF = 2e9;
//const ll INF = 9e18;


int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    double A, B, H, M;
    cin >> A >> B >> H >> M;
    double hx = A*sin(acos(-1)/6.0 * (H + M/60.0));
    double hy = A*cos(acos(-1)/6.0 * (H + M/60.0));
    double mx = B*sin(acos(-1)/30.0 * M);
    double my = B*cos(acos(-1)/30.0 * M);
    double ans = sqrt((hx-mx)*(hx-mx)+(hy-my)*(hy-my));
    cout << fixed << setprecision(9) << ans << "\n";
}

Measured memory_bytes: 4144
#include<stdio.h>
int main(){
  int w,h,n,x,y,a,i,j,s[111]={},t[111]={};
  scanf("%d%d%d",&w,&h,&n);
  for(i=0;i<n;i++){
    scanf("%d%d%d",&x,&y,&a);
    switch (a) {
      case 1:
        for(j=1;j<=x;j++)s[j]=1;
        break;
      case 2: 
        for(j=x+1;j<=w;j++)s[j]=1;
        break;
      case 3:
        for(j=1;j<=y;j++)t[j]=1;
        break;
      case 4:
        for(j=y+1;j<=h;j++)t[j]=1;
        break;
    }
  }
  x=0;
  y=0;
  for(i=1;i<=w;i++){
    if(s[i]==0){
      x++;
    }
  }
  for(i=1;i<=h;i++){
    if(t[i]==0){
      y++;
    }
  }
  printf("%d",x*y);
}

Measured memory_bytes: 128
const Main = (input) => {
  // 入力値の整形
  const TARGET_ARRAY = [7, 5, 3];

  if (TARGET_ARRAY.indexOf(Number(input)) >= 0) {
    console.log('YES');
  } else {
    console.log('NO');
  }
};

//* この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require('fs').readFileSync('/dev/stdin', 'utf8'));


Measured memory_bytes: 21064
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define RREP(i,n) for(int i=n;i>=0;i--)
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
using namespace std;
typedef long long ll;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
const ll INF = 1LL << 60;

#define MAXW 100000

int main(void){
    int N,W;
    cin >> N >> W;
    ll w[N],v[N];
    REP(i,N) cin >> w[i] >> v[i];
    ll dp[N+1][MAXW]={0};
    for(int i=0;i<N;i++){
        for(int sum_w=0;sum_w<=W;sum_w++){
            if(sum_w-w[i]>=0){
                chmax(dp[i+1][sum_w],dp[i][sum_w-w[i]]+v[i]);
            }
            chmax(dp[i+1][sum_w],dp[i][sum_w]);
        }
    }
    cout << dp[N][W] << endl;
    return 0;
}

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

const int MAX_N = 105;
int h[MAX_N];
bool A[MAX_N][MAX_N];

int main()
{
	for (int i = 0; i < MAX_N; ++i)
	{
		for (int j = 0; j < MAX_N; ++j)
		{
			A[i][j] = false;
		}
	}

	int n;

	cin >> n;

	for (int i = 0; i < n; ++i)
	{
	 	int a;
	 	cin >> a;
	 	for (int j = 0; j < a; ++j)
	 	{
	 		A[j][i] = true;
	 	}
	}

	int ans = 0;

	for (int i = 0; i < MAX_N; ++i)
	{
		for (int j = 0; j < MAX_N-1; ++j)
		{
			if (A[i][j] == true && A[i][j-1] == false)
			{
				ans++;
			}
		}
	}

	cout << ans << endl;
	return 0;
}

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

#define forn(i, n) for (int i = 0; i < int(n); ++i)
#define for1(i, n) for (int i = 1; i <= int(n); ++i)
#define fore(i, l, r) for (int i = int(l); i <= int(r); ++i)
#define ford(i, n) for (int i = int(n)-1; i >= 0; --i)
#define pb push_back
#define eb emplace_back
#define ms(a, x) memset(a, x, sizeof(a))
#define F first
#define S second
#define endl '\n'
#define all(x) (x).begin(),(x).end()

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int INF = 0x3f3f3f3f;
mt19937 gen(chrono::high_resolution_clock::now().time_since_epoch().count());

vector<ll> a;
void dfs(int len,ll x){
    if(len>10) return;
    a.pb(x);
    int a=x%10;
    if(a>0) dfs(len+1,x*10+a-1);
    dfs(len+1,x*10+a);
    if(a<9) dfs(len+1,x*10+a+1);
}
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
	int K;
    cin>>K;
    for1(i,9) dfs(1,i);
    sort(all(a));
    cout<<a[K-1];
    return 0;
}



Measured memory_bytes: 2420
#include<bits/stdc++.h>
#define INF 0x3f3f3f3f
#define eps 1e-9
#define LL long long
using namespace std;

#define int int
inline int Max(int a,int b) {return a>b?a:b;}
inline int Min(int a,int b) {return a<b?a:b;}
inline int Sqr(int a) {return a*a;}
inline int Abs(int a) {return a>0?a:-a;}
#undef int

LL n,a,b;

int main() {
	scanf("%d%d%d",&n,&a,&b);
	
	if(a>b||a!=b&&n<2) puts("0");
	else if(a==b) puts("1");
	else cout<<(b-a)*(n-2)+1<<endl;
	return 0;
	
}


Measured memory_bytes: 256
from math import sqrt

N = int(input())
M = N
p=2
ans=0

while p <= sqrt(M):
  z = p
  while N % z == 0:
    N //= z
    z *= p
    ans += 1
  while N % p == 0:
    N //= p
  p+=1
if N > 1:
  ans+=1
print(ans)

Measured memory_bytes: 63720
n = int(input())
rst = 0
for i in range(1, n + 1) :
    if i % 2 == 0 : continue
    count = 0
    for k in range(1 , i + 1) : 
        if i % k == 0 : count += 1
    if count == 8 : 
        rst += 1
    
print(rst)

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

int main() {
    string S;
    cin >> S;

    reverse(S.begin(), S.end());
    int ans = S.size(), z=0;
    bool flag=false;
    rep(i, S.size()) {
        if (!flag && S[i] == 'Z') { flag=true; z = i+1; }
        else if (flag && S[i] == 'A') ans = (i+1) - z + 1;
    }

    cout << ans << endl;
}


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

typedef long long int ll;

typedef pair<int,int> P;
typedef pair<ll,ll> Pll;
typedef pair<string,string> Pstring;
typedef pair<double,double> Pdouble;

#define REP(i,n) for(ll i=0;i<n;i++)
#define REP1(i,n) for(ll i=1;i<=n;i++)
#define Precision(i) cout << fixed << setprecision(i)

const double PI=3.14159265358979323846;
const int MAX = 510000;
const int MOD = 1000000007;

vector<long long> divisor(long long n) {
  vector<long long> ret;
  for (long long i = 1; i <= n; i++) {
      if (n % i == 0) {
          ret.push_back(n / i);
      }
  }
  return ret;
}

int main() {

  ll n;
  cin >> n;

  ll count=0;

  for(int i=1; i<=n; i+=2){
    vector<ll> a = divisor(i);
    if(a.size()==8){
      count++;
    }
  }

  cout << count << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
using namespace std;
typedef long long ll;

int main(void){
    int n;
    string s[10010];
    cin >> n;
    
    int a = 0, b = 0, ab = 0, ans = 0;
    for (int i = 0; i < n; i++) {
        cin >> s[i];
        for (int j = 0; j < s[i].size() - 1; j++) {
            string tmp;
            tmp += s[i][j];
            tmp += s[i][j + 1];
            if (tmp == "AB") ans++;
        }
        if (char(s[i][0]) == 'B') {
            if (char(s[i][s[i].size() - 1]) == 'A') ab++;
            else b++;
        }
        else {
            if (char(s[i][s[i].size() - 1]) == 'A') a++;
        }
    }
    
    int k = min(a, b), l = max(a, b), m, p;
    m = l - k;
    p = ab - l;
    
    //cout << a << " " << b <<" " << ab << " " << ans  << endl;
    
    //min(a + ab, b + ab);
    if (l == 0 && ab == 0) cout << ans + min(a + ab, b + ab) << endl;
    else if (l == 0) cout << ans + min(a + ab, b + ab) -1  << endl;
    else cout << ans + min(a + ab, b + ab) << endl;
    
}


Measured memory_bytes: 768
#include<bits/stdc++.h>
#define rep(i, n) for(int i=0;i<n;i++)
#define repb(i, a, b) for(int i=a;i<b;i++)

using namespace std;
typedef pair<int, int> P;
typedef long long int ll;

const int INF = 1<<30;

int main(){
  ll n;cin>>n;
  ll ans=0LL;
  if(n%2==0){
    ll num=ll(2*5);
  	while(num<=n){ans+=n/num;num*=5;}
  }else{
  	ans=0LL;
  }
  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;
typedef long long ll;
typedef pair<int,int> P;
typedef vector<vector<int> > Graph;
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; }

// auto mod int
const int mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

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


// Sieve of Eratosthenes
// 素因数分解のライブラリ
// https://youtu.be/UTVg7wzMWQc?t=2774
struct Sieve {
  int n;
  vector<int> f, primes;
  Sieve(int n=1):n(n), f(n+1) {
    f[0] = f[1] = -1;
    for (ll i = 2; i <= n; ++i) {
      if (f[i]) continue;
      primes.push_back(i);
      f[i] = i;
      for (ll j = i*i; j <= n; j += i) {
        if (!f[j]) f[j] = i;
      }
    }
  }
  bool isPrime(int x) { return f[x] == x;}
  vector<int> factorList(int x) {
    vector<int> res;
    while (x != 1) {
      res.push_back(f[x]);
      x /= f[x];
    }
    return res;
  }
  vector<P> factor(int x) {
    vector<int> fl = factorList(x);
    if (fl.size() == 0) return {};
    vector<P> res(1, P(fl[0], 0));
    for (int p : fl) {
      if (res.back().first == p) {
        res.back().second++;
      } else {
        res.emplace_back(p, 1);
      }
    }
    return res;
  }
};

int main(){
    Sieve sieve(1e6);
    int n;
    cin >> n;
    vector<int>a(n);
    rep(i,n){
        cin >> a[i];
    }
    map<int,int> mp;
    rep(i,n){
        auto f = sieve.factor(a[i]);
        for(auto p:f){
            mp[p.first]=max(mp[p.first],p.second);
        }
    }
    mint lcm=1;
    for(auto p:mp){
        rep(j,p.second){
            lcm*=p.first;
        }
    }
    mint ans;
    rep(i,n){
        mint b=lcm/a[i];
        ans += b;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 7656
{-# LANGUAGE RecordWildCards #-}
import Data.ByteString.Char8 as BC (getLine, words, readInt)
import Prelude hiding (getLine, words)
import Data.List hiding (words)
import Data.Function (on)
import qualified Data.Map.Strict as M
import Data.Maybe (fromJust)
import Control.Monad
import Control.Arrow

main = do
    n <- readLn
    xs <- map (fst . fromJust . readInt) . words <$> getLine
    mapM_ print . fill n . solve . groupMnts $ xs
    where
        fill n xs = let filler = M.fromAscList . zip [1..n] $ repeat 0
                        filled = (M.fromAscList xs) `M.union` filler
                        in M.elems filled

type Stones = Int
type Index = Int

sample = [1,2,1,3,2,4,2,5,8,1] :: [Stones]
sample2 = [1,2]

data Group = Group { _leftMost :: Index, _stones :: Stones, _mnts :: Int }
           deriving (Show)

groupMnts :: [Stones] -> [Group]
groupMnts = joinMountains . groupByStones . attachIndex
    where
        attachIndex = flip zip [1..]
        groupByStones
            = groupBy ((==) `on` fst) . sortBy (compare `on` first negate)
        joinMountains
            = map (\ xs@((s,i):_)  -> Group i s (length xs))

mergeGroups :: Group -> Group -> Group
mergeGroups (Group i s m) (Group i' s' m')
    = if s == s'
         then Group (min i i') s (m+m')
         else error "cannot merge and I was too lazy to use Maybe"

solve :: [Group] -> [(Int,Int)]
solve = join . consume
    -- fixme
    where
        join = foldl' f []
        f [] n = [n]
        f acc@((i,n):r) x@(i',n') = if i == i' then (i,n+n'):r else x:acc
        consume [] = []
        consume [Group{..}] = [ (_leftMost, _stones * _mnts) ]
        consume (g0:g1:rest) =
            (_leftMost g0, (_stones g0 - _stones g1)* _mnts g0)
                : consume (mergeGroups g0{_stones=_stones g1} g1:rest)

Measured memory_bytes: 72572
#include <bits/stdc++.h>
#pragma GCC optimize("O3")

#define fi first
#define se second
#define em emplace
#define eb emplace_back
#define mp make_pair
#define pi pair<int,int>
#define vi vector<int>
#define vpi vector<pair<int,int>>
#define vll vector<ll>
#define vpll vector<pair<ll,ll>>
#define endl '\n'

#define si(v) int((v).size())
#define all(v) (v).begin(), (v).end()
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i) 
#define rep2(i, n, m) for (ll i = n; i <= (ll)(m); ++i)
#define rep3(i, n, m) for (ll i = n; i >= (ll)(m); --i)

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

using ll = long long;
using ld = long double;
using namespace std;

constexpr ll MOD = 1000000007;

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

  int n; cin >> n;
  set<int> s;

  rep(i, n) {
    int a; cin >> a;
    s.em(a);
  }

  cout << si(s) << endl;

  return (0);
}


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

const int MAX_N = 105;

int N;
int val[MAX_N];
bool pos[MAX_N*MAX_N];

int main() {
  scanf("%d",&N);

  pos[0] = true;
  for (int i=0;i<N;i++) {
    scanf("%d",&val[i]);
    for (int j=100*100;j>=val[i];j--) {
      if (pos[j-val[i]]) {
        pos[j] = true;
      }
    }
  }

  for (int i=100*100;i>=0;i--) {
    if (i % 10 == 0) continue;
    if (pos[i]) {
      printf("%d\n",i);
      return 0;
    }
  }
  printf("0\n");
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <map>
#include <vector>
#include <set>
#include <cstdlib>
#include <deque>
#include <stack>

using namespace std;
const long long P = 1000000007;

int main() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  int ans = 0;
  set<char> words;
  set<char>::iterator itr;
  for(int i = 0; i < n-1; i++) {
    int count = 0;
    string x = s.substr(0,i);
    string y = s.substr(i,s.size()-x.size());
    for(int j = 0; j < x.size(); j++) {
      itr = words.find(x[j]);
      if(y.find(x[j]) != string::npos && itr == words.end()) {
        count++;
        words.insert(x[j]);
      }
    }
    words.clear();
    ans = max(ans,count);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <math.h>
#define _GLIBCXX_DEBUG
#define _LIBCPP_DEBUG 0

using namespace std;
#define ll long long
#define rep(i,n) for (int i = 0; i < n; i++)
#define rrep(i,n) for (int i = n-1; i >= 0; i--)
#define MOD (1000000007)
#define vi vector<int>
#define vl vector<ll>
#define vb vector<bool>
#define vvi vector<vi>
#define vvl vector<vl>
#define pii pair<int, int>
#define pli pair<ll, int>a
#define pb push_back
#define sz(x) int(x.size())

#define mp make_pair
#define all(a) (a).begin(),(a).end()

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; }

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

ll keta(ll n){
  string s = to_string(n);
  ll num = s.size();
  return num;
}

const ll INF = 1LL << 60;

const int dh[4] = {1,0,-1,0};
const int dw[4] = {0,1,0,-1};

struct Edge{
  int to;
  int weight;
  Edge(int t, int w) : to(t), weight(w){}
};
using Graph = vector<vector<Edge>>;
using P = pair<ll, int>;

class UnionFind{
public:
  vi Parent;
  UnionFind(int n){
    Parent = vi(n,-1);
  }

  int root(int a){
    if(Parent[a] < 0) return a;
    else return Parent[a] = root(Parent[a]);
  }

  int size(int a){
    return -Parent[root(a)];
  }

  bool merge(int a, int b){
    a = root(a);
    b = root(b);
    if(a == b) return false;

    if(size(a) < size(b)) swap(a,b);
    Parent[a] += Parent[b];
    Parent[b] = a;

    return true;
  }
};

class Factrial{
public:
  vl Fac;
  Factrial(int MAX){
    Fac = vl(MAX+1);
    rep(i,MAX) {
      if(i == 0) Fac[i+1] = 1;
      else Fac[i+1] = ((i+1)*Fac[i])%MOD;
    }
  }
};

int main(){
  int n;
  cin >> n;
  vi p(n);
  rep(i, n) cin >> p[i];
  vi q(n);
  rep(i, n) cin >> q[i];

  int a = 0, b = 0;
  vi v(n);
  rep(i, n) v[i] = i + 1;

  do{
    if(v <= p) a++;
  } while (next_permutation(all(v)));
  
  do{
    if(v <= q) b++;
  } while (next_permutation(all(v)));
  

  cout << abs(a-b) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); ++i)
#define MOD 1000000007

using namespace std;
using ll = long long;

int main() {
	ll n, ans = 0;
	rep(i,5) {
		cin >> n;
		if(n == 0) ans = i + 1;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3412
#include<stdio.h>
int main()
{
	int a,b;
	char op;
	while(scanf("%d %c %d",&a,&op,&b))
	{
		if(op=='?')
		{
			break;
		}
		if(op=='+')
		{
			printf("%d\n",a+b);
		}
		if(op=='-')
		{
			printf("%d\n",a-b);
		}
			if(op=='*')
		{
			printf("%d\n",a*b);
		}
			if(op=='/')
		{
			printf("%d\n",a/b);
		}
	}
	return 0;
} 


Measured memory_bytes: 2036
N = int(input())
A = list(map(int, input().split()))

two = 0
four = 0
for a in A:
    cnt = 0
    while a % 2 == 0:
        a //= 2
        cnt += 1
    if cnt == 1:
        two += 1
    elif cnt > 1:
        four += 1

rest = N - four - two
two_merge = 1 if two > 0 else 0
rest += two_merge


if rest - 1 <= four:
    print("Yes")
else:
    print("No")


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

int main(){
  string s;cin >> s;
  int ans;
  if(s.at(0)=='R' && s.at(1)=='R' && s.at(2)=='R'){
    ans=3;
  }else if((s.at(0)=='R'&&s.at(1)=='S')||(s.at(1)=='R'&&s.at(0)=='S'&&s.at(2)=='S')||(s.at(2)=='R'&&s.at(1)=='S')){
    ans=1;
  }else if(s.at(0)=='S' && s.at(1)=='S' && s.at(0)=='S'){
    ans=0;
  }else{
  ans=2;
  }
  cout << ans << endl;
}

Measured memory_bytes: 3596
#include<stdio.h>
 int main(void)
 {
     int N,A[100];
     int i,j,tmp,S1=0,S2=0;

     scanf("%d",&N);

     for(i=0;i<N;i++)
       scanf("%d",&A[i]);

     for(i=0;i<N;i++){
       for(j=i+1;j<N;j++){
         if(A[i]>A[j]){
           tmp=A[i];
           A[i]=A[j];
           A[j]=tmp;
         }
       }
     }

     for(i=0;i<=N/2;i++){
       if((N-1)-(i*2+1)>=0) S1+=A[(N-1)-(i*2+1)];
       if((N-1)-(i*2)>=0) S2+=A[(N-1)-(i*2)]; 
       if(((N-1)-(i*2+1)<0)&&((N-1)-(i*2)>=0)) break;
     }

     printf("%d\n",S2-S1);



     return 0;
 }


Measured memory_bytes: 128
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
const int N=100005;
int n,k,s;
int main()
{
	scanf("%d%d%d",&n,&k,&s);
	for(int i=1;i<=k;i++)
		printf("%d ",s);
	for(int i=1;i<=n-k;i++)
		printf("%d ",s==1000000000?1000000000-1:1000000000); 
	return 0;
}

Measured memory_bytes: 3816
#include<bits/stdc++.h>
using namespace std;
#define endl '\n'
#define pb push_back
#define all(x) x.begin(), x.end()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define reps(i, m, n) for (int i = m; i <= n; ++i)
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fLL;

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

  int a, b, c;
  cin >> a >> b >> c;

  reps(i, 1, b) {
    if( (a * i) % b == c ) {
      cout << "YES" << endl;
      return 0;
    }
  }

  cout << "NO" << endl;

  return 0;
}

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

def main():
    input = sys.stdin.readline
    n = int(input())
    mod = 10 ** 9 + 7
    if n == 1:
        print(0)
    elif n == 2:
        print(2)
    else:
        print((pow(10, n, mod) - pow(9, n, mod) * 2 + pow(8, n, mod)) % mod)


if __name__ == '__main__':
    main()


Measured memory_bytes: 61704
#include <stdio.h>
#include <string.h>

int main(void)
{
    char str_num[1001];
    int res;

    while ( 1 ) {
        
        memset(str_num, '\0', sizeof(str_num));
        res = 0;
        
        scanf("%s", &str_num[0]);
        
        if ( str_num[0] == '0' ) {
            break;
        }
        
        for ( int i = 0; i < strlen(str_num); i++ ) {
            res += str_num[i] - '0';
        }
        printf("%d\n", res);
    }
    
    return 0;
}


Measured memory_bytes: 2048
N=int(input())
S=input()

#文字列をリストに変換
s=[]
for i in range(len(S)):
    s.append(S[i])


#アルファベットを26で割ったあまりの数で対応させるためのリスト
alphabet=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"]
#置き換え後の文字列の番号のリスト
number=[]
for i in s:
    number.append(alphabet.index(i)+N)

#番号から文字を特定し一つずつ表示
for i in number:
    ans=alphabet[i%26]
    print(ans,end="")
    


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

int main()
{
	int n, f=0;
	cin >> n;
	int d[n+1], d1[n+1];
	for (int i=1; i<=n; i++)
	{
		if (f==3)
		{
			cout << "Yes" << endl;
			return 0;
		}
		cin >> d[i] >> d1[i];
		if (d[i]==d1[i])
		{
			f++;
		}
		else
		{
			f=0;
		}
	}if (f==3)
		{
			cout << "Yes" << endl;
			return 0;
		}
	cout << "No" << endl;
	return 0; 
}


Measured memory_bytes: 3620
#include <stdio.h>
int main(void)
{
	int a,b,c,d;
	scanf("%d%d%d%d",&a,&b,&c,&d);
	if(a*b>=c*d){
		printf("%d\n",a*b);
	}else{
		printf("%d\n",c*d);
	}
	return 0;
}

Measured memory_bytes: 128
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;

/**
 * Built using CHelper plug-in Actual solution is at the top
 */

public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		Task solver = new Task();
		solver.solve(1, in, out);
		out.close();
	}

	static class Task {
		public void solve(int testNumber, InputReader in, PrintWriter out) {
			String X = in.next();
			String Y = in.next();
			String ans;
			if(X.compareTo(Y) > 0) {
				ans = ">";
			}else if(X.compareTo(Y) < 0) {
				ans = "<";
			}else {
				ans = "=";
			}
			out.println(ans);
		}
	}
	
	static class InputReader {
		public BufferedReader reader;
		public StringTokenizer tokenizer;

		public InputReader(InputStream stream) {
			reader = new BufferedReader(new InputStreamReader(stream), 32768);
			tokenizer = null;
		}

		public String next() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}

		public int nextInt() {
			return Integer.parseInt(next());
		}

	}
}


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

int make_digits(long long int S, vector<int>& digits)
{
	int count = 0;
	while (S > 0) {
		count++;
		int tmp = S % 10;
		digits.push_back(tmp);
		S /= 10;
	}
	return count;
}

int main(void)
{
	long long int S; cin >> S;
	vector<int> digits;
	int count = make_digits(S, digits);
	int ans = 753;

	for (int i = 0; i < count - 2; i++) {
		int tmp = 100 * digits[i + 2] + 10 * digits[i + 1] + digits[i];
		int diff = (tmp > 753) ? tmp - 753 : 753 - tmp;
		ans = min(diff, ans);
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
n=int(input())
a=list(map(int,input().split()))
c=0
mx=0
for i in range(n-1):
  if a[i]>=a[i+1]:
    c+=1
    if mx<c:
        mx=c
  if a[i]<a[i+1]:
    c=0
print(mx)

Measured memory_bytes: 14252
public class Hello{
    public static void Main(){
        
        var line = System.Console.ReadLine();
        string[] array = line.Split(' ');
        int n = int.Parse(array[0]);
        int m = int.Parse(array[1]);
        
        var line2 = System.Console.ReadLine();
        string[] array2 = line2.Split(' ');
        
        int sum = 0;
        for(int i = 0; i < n; i++)
        {
            sum += int.Parse(array2[i]);
        }
        
//        int border = 0;
//        border = sum / (4 * m);
        
        int count = 0;
        for(int j = 0; j < n; j++)
        {
            int buf = int.Parse(array2[j]);
            if(buf * 4 * m >= sum)
            {
                count++;
            }
        }
        
        if(count >= m)
        {
            System.Console.WriteLine("Yes");
        }
        else
        {
            System.Console.WriteLine("No");
        }
    }
}


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

unsigned dp[1<<26];

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    memset(dp, 2, sizeof(dp));
    dp[0] = 0;
    string s; cin >> s;
    int curr = 0;
    for (int i = 0; i < s.size(); i++) {
        curr ^= (1 << (s[i] - 'a'));
        for (int j = 0; j < 26; j++) {
            dp[curr] = min(dp[curr], dp[curr ^ (1 << j)] + 1);
        }
    }
    if (curr == 0) dp[curr]++;
    cout << dp[curr] << "\n";
    return 0;
}

Measured memory_bytes: 262992
import sys
N, L, T = [int(x) for x in input().strip().split(" ")]

xys = []
candidates = []
for line in sys.stdin:
    x, y = line.strip().split(" ")
    x, y = int(x), int(y)
    xys.append((x,y))
    candidates.append((x + (1 if y == 1 else -1) * T)%L)

x0, y0 = xys[0]

dxs = []
pr_x = None
counter = 0
for x, y in xys[1:]:
    if y != y0:
        if pr_x == None:
            if y0 == 1:
                a = (x - x0)
        else:
            dxs.append(x - pr_x)
        pr_x = x
        counter += 1

if pr_x == None:
    for x in candidates:
        print(x)
    sys.exit()
if y0 == 2:
    a = (L - pr_x) + x0

ree = (2*T)%L
num_round = (2*T)//L
ree = ree - a
if ree <= 0:
    max_i = 0
else:
    for i, dx in enumerate(dxs if y0 == 1 else dxs[::-1]):
        ree = ree - dx
        if ree <= 0:
            max_i = i + 1
            break
    else:
        max_i = counter

if ree == 0 and y0 == 2:
    max_i += 1

c_n = num_round * counter + max_i

rep = ( 
        ((1 if y0 == 1 else -1) * (c_n % N) % N),
        ((x0 + (1 if y0 == 1 else -1) * (T % L)) % L)
        )


candidates = sorted(candidates)

for i, c in enumerate(candidates):
    if c == rep[1]:
        start = i - rep[0]
        break

for j in range(N):
    print(candidates[(start + j) % N])


Measured memory_bytes: 59484
#include <stdlib.h>
#include <cmath>
#include <cstdio>
#include <cstdint>
#include <string>
#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
using namespace std;
using ll = long long;

int main(){
  int N;
  cin >> N;
  vector<double> v(N);
  for(int i=0;i<N;i++) cin >> v.at(i);
  sort(v.begin(),v.end());
  double ans=(v.at(0)+v.at(1))/2;
  int i=2;
  while(i<N){
    ans=(ans+v.at(i))/2;
    ++i;
  }
  
  cout << ans << endl;
  
  return 0;
}


Measured memory_bytes: 256
N, A = map(int, raw_input().split())
a = sorted(map(lambda x:int(x)-A, raw_input().split()))
mem = {}

def rec(p, acm):
    if (p, acm) in mem:
        return mem[(p, acm)]
    if p >= N:
        return 0
    if a[p] > 0 and acm > 0:
        return 0
    mem[(p, acm)] = rec(p+1, acm+a[p]) + rec(p+1, acm)
    if acm+a[p] == 0:
        mem[(p, acm)] += 1
    return mem[(p, acm)]

print rec(0, 0)


Measured memory_bytes: 8256
#include<bits/stdc++.h>
// Begin Header {{{
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i,n) for(ll i=0; i<n; i++)
#define loop(i, j, n) for(ll i=j; i<n; i++)
#define all(x) (x).begin(), (x).end()
constexpr int INF  = 0x3f3f3f3f;
const long long mod=1e9+7;
const long double PI = acos(-1);
// }}} End Header
int main() {
	ll sum=0;
	string n;
	cin >> n;
	rep(i, n.length()){
		sum+=n[i]-'0';
	}
	if(sum%9 == 0) puts("Yes");
	else puts("No");
	return 0;
}


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

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

	if (a[a.size() - 1] == b[0] && b[b.size() - 1] == c[0]) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}
	
	return 0;
}

Measured memory_bytes: 256
/*;

THE BEST IS YET TO COME

*/
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define r(i, s, l) for (int i = s; i < l; i++)
#define rr(i,s,l) for(int i=s;i>=l;i--)
#define mod 1000000007
#define INT_BITS 32
#define ld long double
#define pp pair<int,int>
#define ss second
#define ff first
#define INF 1e18
#define N 2000005
#define all(a) a.begin(), a.end()
#define pb push_back
#define vi vector<int>
#define vip vector<pair<int,int> >
#define endl "\n"
#define ln length()
#define sz size()
using namespace std;
void fast()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
}
signed main()
{

    char x;
    cin>>x;
    if(tolower(x) == x)
    cout<<"a";
    else
    cout<<"A";

	return 0;
}




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

int main(){
  int A;
  int B;
  cin>>A>>B;
  int C=B-A+1;
  int i=0;
  int sum=0;
  
  while (i<C) {
    int D=A+i;
    int E=D/10000;
    int F=D/1000-E*10;
    int G=D/10-D/100*10;
    int H=D-D/10*10;
    
    if(E==H && F==G) {
      sum+=1;
    }
    i++;
  }
  
  cout<<sum<<endl;
}

Measured memory_bytes: 256
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=tf-8
#

"""
"""

from collections import defaultdict
import bisect

import sys
input = sys.stdin.readline

modulo = (10**9)+7

P = 10**9 + 7
N = 5000
fact = [1]+[1]
for i in range(2,N):
    ff = fact[-1]*i%P
    fact.append(ff)

cut = 10**9+7


# a*s0+b*t0 = r0 = gcd(a,b)
def extendedGCD(a, b, divmod=divmod):
    r0, r1, s0, s1, t0, t1 = a, b, 1, 0, 0, 1
    while r1 != 0:
        q, rtmp = divmod(r0, r1)
        stmp, ttmp = s0-q*s1, t0-q*t1
        r0, s0, t0 = r1, s1, t1
        r1, s1, t1 = rtmp, stmp, ttmp
    return r0, s0, t0

# a*s0+b*t0 = r0 = gcd(a,b), k is the number of the steps
def extendedGCDcount(a, b, divmod=divmod):
    r0, r1, s0, s1, t0, t1 = a, b, 1, 0, 0, 1
    k = 0
    while r1 != 0:
        q, rtmp = divmod(r0, r1)
        stmp, ttmp = s0-q*s1, t0-q*t1
        r0, s0, t0 = r1, s1, t1
        r1, s1, t1 = rtmp, stmp, ttmp
        k += 1
    return r0, s0, t0, k


# the inverse of a in F_b when b is a prime
def modInverse(a, b, divmod=divmod):
    r0, r1, s0, s1 = a, b, 1, 0
    while r1 != 0:
        q, rtmp = divmod(r0, r1)
        stmp = s0-q*s1
        r0, s0 = r1, s1
        r1, s1 = rtmp, stmp
    return s0 % b

def solve(s):
    ans = 0
    for i in range(1,s//3+1):
        s2 = s-i*3 
        tmp = fact[s2+i-1]*modInverse(fact[s2],P)%P
        tmp = tmp*modInverse(fact[i-1],P)%P
        ans = (ans+tmp)%P
    print(ans)
            

def main():
    s = int(input())
    solve(s)


if __name__ == "__main__":
    main()

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

#define int long long
#define EB emplace_back

using namespace std;

int32_t main()
{



	int tt=1;
	//	 cin>>tt
	 while(tt--)
	 {
	 set<int> s;
	 int a,b,c; cin>>a>>b>>c;
	 s.insert(a);	 	
	 s.insert(b);
	 s.insert(c);
	 if(s.size()==2) cout<<"Yes";
	 else cout<<"No";
	 }
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String args[]) {
		Scanner scan = new Scanner(System.in);

		for(int i=1; ; i++) {
			int x = scan.nextInt();

			if(x == 0)
				break;

			System.out.println(String.format("Case %d: %d", i, x));
		}
	}
}



Measured memory_bytes: 61464
#include <bits/stdc++.h>
using namespace std;
const int MAXN=110;
int N,A[MAXN];
int cal(int P)
{
	int sum=0;
	for (int i=1;i<=N;++i) sum+=(A[i]-P)*(A[i]-P);
	return sum;
}
int main()
{
	cin>>N;
	for (int i=1;i<=N;++i) cin>>A[i];
	int Ans=cal(1);
	for (int i=1;i<=100;++i) Ans=min(Ans,cal(i));
	cout<<Ans<<endl;
	return 0;
}

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

using namespace std;

typedef long long ll;
#define int ll
typedef long double ld;

typedef pair<int,int> pii;
#define x first
#define y second

const int N=1e5+100;

pii s[3*N];

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

    int x,y,a,b,c;
    cin>>x>>y>>a>>b>>c;
    for(int i=1;i<=a;i++)
        cin>>s[i].x,
        s[i].y=1;
    for(int i=a+1;i<=a+b;i++)
        cin>>s[i].x,
        s[i].y=2;
    for(int i=a+b+1;i<=a+b+c;i++)
        cin>>s[i].x,
        s[i].y=3;
    int n=a+b+c;
    sort(s+1,s+n+1,greater<pii>());
    int z=0,ans=0;
    for(int i=1;i<=n;i++)
    {
        int p=s[i].x,q=s[i].y;
        if(q==1&&x)
            ans+=p,x--;
        else if(q==2&&y)
            ans+=p,y--;
        else if(q==3)
            ans+=p,z++;
        if(z==x+y)
            break;
    }
    cout<<ans;
}


Measured memory_bytes: 4992
#include <algorithm>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <iostream>
#include <iterator>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

#define FOR(i,k,n) for(int(i)=(k);(i)<(n);++(i))
#define rep(i,n) FOR(i,0,n)
#define all(v) begin(v),end(v)
#define debug(x) std::cerr<<#x<<": "<<x<<"\n"
#define debug2(x,y) std::cerr<<#x<<": "<<x<<", "<<#y<<": "<<y<<"\n"
#define debug3(x,y,z) std::cerr<<#x<<": "<<x<<", "<<#y<<": "<<y<<", "<<#z<<": "<<z<<"\n"

using ll=long long;
using vi=std::vector<int>;
using vvi=std::vector<vi>;
using vll=std::vector<ll>;
using vvll=std::vector<vll>;
template<typename T> using vvec=std::vector<std::vector<T>>;
template<typename T>
auto make_v(size_t sz){return std::vector<T>(sz);}
template<typename T,typename... Ts>
auto make_v(size_t sz,Ts...ts){return std::vector<decltype(make_v<T>(ts...))>(sz,make_v<T>(ts...));}
template<typename T>
void fill_v(T&var,const T&x){var=x;}
template<typename V,typename T>
void fill_v(V&v,const T&x){for(auto&& w:v){fill_v(w,x);}}

template<typename T> std::ostream& operator<<(std::ostream&s,const std::vector<T>&v){
  int sz=v.size();s<<"\n";rep(i,sz){s<<v[i];if(i<sz-1){s<<"\t";}}s<<"\n";return s;}
template<typename T> std::ostream& operator<<(std::ostream&s,const std::vector<std::vector<T>>&v){
  for(auto&& w:v){s<<w;}return s;}
template<typename T> std::ostream& operator<<(std::ostream&s,const std::deque<T>&v){
  int sz=v.size();s<<"\n";rep(i,sz){s<<v[i];if(i<sz-1){s<<"\t";}}s<<"\n";return s;}
template<typename T> std::ostream& operator<<(std::ostream&s,const std::deque<std::deque<T>>&v){
  for(auto&& w:v){s<<w;}return s;}
template<typename T> std::ostream& operator<<(std::ostream&s, const std::set<T>&v){
  s<<"\n";for(auto&& elm:v){s<<elm<<"\t";}s<<"\n";return s;}

inline void scan(int&a){scanf("%d",&a);}
inline void scan(ll&a){scanf("%lld",&a);}
inline void scan(char&a){scanf(" %c",&a);}
inline void scan(double&a){scanf("%lf",&a);}
template<typename T>
inline void scan(std::vector<T>&v){for(auto&& sv:v){scan(sv);}}
template<typename First,typename...Args>
inline void scan(First&f,Args&...args){scan(f);scan(args...);}
inline void scan(std::string&s){char BUF[3000000];scanf(" %s",BUF);s=std::string(BUF);}
inline void print(int a){printf("%d\n",a);}
inline void print(ll a){printf("%lld\n",a);}
inline void print(double a){printf("%.12f\n",a);}
inline void print(std::string s){std::cout<<s<<"\n";}

using namespace std;

int main() {
  int h, w, n;
  scan(h, w, n);
  int m = max(h, w);
  int ans = (n + m - 1) / m;
  print(ans);
  return 0;
}


Measured memory_bytes: 760
#include <stdio.h>

int main(){
    int D[10];
    char cmd[100];
    int cp;
    int n,O,S;
    scanf("%d %d %d %d %d %d",&D[1],&D[2],&D[3],&D[4],&D[5],&D[6]);
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        scanf("%d %d",&O,&S);

        if((D[1]==O&&D[2]==S)||(D[2]==O&&D[6]==S)||(D[6]==O&&D[5]==S)||(D[5]==O&&D[1]==S)){
            printf("%d\n",D[3]);
        }
        if((D[1]==O&&D[4]==S)||(D[4]==O&&D[6]==S)||(D[6]==O&&D[3]==S)||(D[3]==O&&D[1]==S)){
            printf("%d\n",D[2]);
        }
        if((D[1]==O&&D[5]==S)||(D[5]==O&&D[6]==S)||(D[6]==O&&D[2]==S)||(D[2]==O&&D[1]==S)){
            printf("%d\n",D[4]);
        }
        if((D[1]==O&&D[3]==S)||(D[3]==O&&D[6]==S)||(D[6]==O&&D[4]==S)||(D[4]==O&&D[1]==S)){
            printf("%d\n",D[5]);
        }
        if((D[4]==O&&D[2]==S)||(D[2]==O&&D[3]==S)||(D[3]==O&&D[5]==S)||(D[5]==O&&D[4]==S)){
            printf("%d\n",D[1]);
        }
        if((D[4]==O&&D[5]==S)||(D[5]==O&&D[3]==S)||(D[3]==O&&D[2]==S)||(D[2]==O&&D[4]==S)){
            printf("%d\n",D[6]);
        }

    }
}



Measured memory_bytes: 2040