akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <math.h>
#include <complex>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <bitset>
#include <functional>
#include <assert.h>
#define int long
#define ll long long
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define eb emplace_back
#define all(x) x.begin(),x.end()
#define SZ(x) x.size()
#define fi first
#define se second
const int INF = 1e9;
using namespace std;

template<class t> using vc=vector<t>;
template<class t> using vvc=vc<vc<t>>;

using pi=pair<int,int>;
using vi=vc<int>;

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

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

    int a,b; cin >> a >> b;
    string S,T;
    rep(i,b){
        S+=(char)('0'+a);
    }
    rep(i,a){
        T+=(char)('0'+b);
    }
    if(S<T) cout << S << endl;
    else cout << T << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define oo 0x3f3f3f3f

int main()
{
    ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int n;
    cin>>n;
    vector<int>A(n);
    for(int&x:A)cin>>x;

    int r = 0;

    for(int i=0; i<n; i++)
    for(int j=i+1; j<n; j++)
    for(int k=j+1; k<n; k++)
        if(A[i]!=A[j] && A[j]!=A[k] && A[i]!=A[k] && A[i]+A[j]+A[k]-max({A[i],A[j],A[k]}) > max({A[i],A[j],A[k]})){
            r++;
        }

    cout<<r;
}


Measured memory_bytes: 3648
#include<iostream>
#include<algorithm>
#include<functional>
#include<cmath>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<deque>
using namespace std;
#define ll long long
const int mod = 1000000007;
const ll INF = 1000000000000000000;

ll R[200010];
ll sum[200010];
int main()
{
	int N, K;
	cin >> N >> K;
	for (int i = 0; i < N + 1; i++) R[i] = i;
	for (int i = 1; i < N + 1; i++) {
		sum[i] = sum[i - 1] + R[i];
	}
	ll ans = 0;
	for (int i = K; i <= N + 1; i++) {
		ll num1 = sum[i - 1] - sum[0];
		ll num2 = sum[N] - sum[N - i];
		ans = (ans + num2 - num1 + 1) % mod;
		//cout << num1 << " " << num2 << endl;
	}
	cout << ans << endl;
}


Measured memory_bytes: 6572
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
const int INF=1e9,MOD=1e9+7,ohara=1e6+10;
const ll LINF=1e18;
using namespace std;
    
#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(int i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout<<(x)<<endl
#define doublecout(a) cout<<fixed<<setprecision(15)<<a<<endl;
#define Cerr(x) cerr<<(x)<<endl
#define fi first
#define se second
#define P pair<ll,ll> 
#define m_p make_pair
#define V vector<ll> 
#define U_MAP unordered_map<ll,ll>
#define pq priority_queue<ll>
#define rpq priority_queue<ll,vector<ll>,greater<ll>>
    
ll n,cnt,ans,a,b,c,d,tmp,tmpp,m,h,w,x,y,sum,pos,k;
ld doua;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
//int dy[]={-1,0,1,-1,1,-1,0,1};
//int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"),s;
bool fl;
struct edge{int to,cost;};
map<char,ll> mp;
    
//-------------------------↓↓↓↓↓↓------------------------
    
//------ 自分を天才だと信じる ------
    
int main(void){
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    
    cin>>s;
    rep(i,Size(s))mp[s[i]]++;
    for (char i = 'a'; i <= 'z'; i++)
    {
        if(mp[i]==0){
            Cout(i);
            return 0;
        }
    }
    Cout("None");
    
    return 0;
}

Measured memory_bytes: 512
import java.util.Scanner;

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

        if (0 <= second && second < 86400) {

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

            System.out.println(h + ":" + m + ":" + s);
        }
    }
}



Measured memory_bytes: 26240
#include <cstring>
#include <map>
#include <unordered_map>
#include <string>
#include <list>
#include <functional>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <cstdio>
#include <iostream>
#include <set>
#include <unordered_set>
using namespace std;

#define MAX(a,b) (a>b?a:b)
#define MIN(a,b) (a<b?a:b)
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef pair<int, int> pii;

int gi() {
    int a;
    scanf("%d", &a);
    return a;
}

ll gli() {
    ll a;
    scanf("%lld", &a);
    return a;
}

int a[100000];

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n = gi();
    int m = gi();
    int v = n-gi();
    int p = gi();
    for (int i = 0; i < n; i++)
        a[i] = gi();
    sort(a, a+n, greater<int>());

    int res = p;
    ll s = 0;
    for (int i = p; i < n && a[i]+m >= a[p-1]; i++) {
        s += a[i-1];
        if (v < i-p+1 && ll(v)*ll(m) < s-a[i]*ll(i-p+1))
            break;
        res++;
    }

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

    return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
#define rep(i,k,n) for(int i=k;i<=n;i++)
using namespace std;
const int N=1e5+7;
typedef long long ll;
ll ans=0x7f7f7f7f7f7f7f7full;
int a[N];
int main(){
	int n;scanf("%d",&n);
	rep(i,1,n)scanf("%d",&a[i]);
	ll res=0,now=0;
	rep(i,1,n){
		now+=a[i];
		if(i&1){
			if(now >= 0)res+=now+1,now=-1;
		}else{
			if(now <= 0)res+=-now +1,now=1;
		}
	}
	ans=min(ans,res);
	
	res=now=0;
	rep(i,1,n){
		now+=a[i];
		if(!(i&1)){
			if(now >= 0)res+=now+1,now=-1;
		}else{
			if(now <= 0)res+=-now +1,now=1;
		}
	}
	ans=min(ans,res);
	cout<<ans;
} 

Measured memory_bytes: 640
#include<iostream>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
int main()
{
    int k,a,b;
    cin>>k>>a>>b;
    for (int i = a; i <= b; i++)
    {
        if(i%k==0)
        {
            cout<<"OK"<<endl;
            return 0;
        }
    }
    cout<<"NG"<<endl;

    return 0;
}

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

int n, m;
bool adjMat[8][8];
int dp[256][8];

int main() {
	for(int i = 0; i < 8; i++) for(int j = 0; j < 8; j++) adjMat[i][j] = false;
	for(int i = 0; i < 256; i++) for(int j = 0; j < 8; j++) dp[i][j] = 0;
	cin >> n >> m;
	int a, b;
	for(int i = 0; i < m; i++) {
		cin >> a >> b; a--; b--;
		adjMat[a][b] = adjMat[b][a] = true;
	}

	for(int i = 0; i < 8; i++) dp[(1 << n) - 1][i] = 1;
	for(int i = ((1 << n) - 2); i >= 1; i--) {
		for(int j = 0; j < 8; j++) {
			if((i&(1 << j)) == 0) continue;
			for(int k = 0; k < 8; k++) {
				if((i&(1 << k)) == 0 && adjMat[j][k]) dp[i][j] += dp[i + (1 << k)][k];
			}
		}
	}
	cout << dp[1][0] << endl;

	return 0;
}

Measured memory_bytes: 256
n=int(input())
s = input()
l = list(s)
L = []

for i in l:
    m = ord(i)
    if m + n <= 90:
        i = chr(m + n)
        L += i
    if m + n > 90:
        i = chr(m+n -26)
        L += i

print(''.join(L))

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

#define ll long long int
#define f(i,n) for(ll i = 0; i < n ; i++)
#define fn(i,n) for(ll i = 1; i < n ; i++)
#define F first 
#define pb push_back
#define S second
using namespace std;
ll dp[100005];
ll k;
ll mn = INT_MAX;
void solve(ll a[], ll n)
{
   
  
  f(i,n)
  dp[i] = INT_MAX; 
  dp[0] = 0;
   
  for(ll i = 1; i < n ; i++)
  {

    for(ll j = i-k; j < i; j++)
    {
      if(j < 0) j = 0;
      dp[i] = min(dp[i], dp[j] + abs(a[i]-a[j]));
       
    }
  }
  //f(i,n)
  cout<<dp[n-1]<<endl;
          
  
  
}


 
int main()
{

     #ifndef ONLINE_JUDGE
     freopen("input.txt","r",stdin);
     freopen("output.txt","w",stdout);
     #endif
     
         ll n ;
         cin>>n>>k;
         ll a[n];
 
         f(i,n)
         {
            cin>>a[i];
         }
         //f(i,10) dp[i] = 100;

         solve(a,n);
         
        
         
   return 0;
}


Measured memory_bytes: 5132
def f(n):
    if n%2 == 0:
        return int(n/2)
    else :
        return int(3*n + 1)

s = int(input())
a = [s]
i = 0
while True:
    next_insert = f(a[i])
    #print(a)
    if (next_insert in a) == True:
        break
    a.append(next_insert)
    i +=1
print(i+2)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
int v[55];
int temp[55];
int main(){
	int n,k;
	scanf("%d%d",&n,&k);
	for(int i=1;i<=n;i++)
		scanf("%d",&v[i]);
	int ans=0;
	for(int l=0;l<=n;l++){
		for(int r=n+1;r>l;r--){
			int cnt=0,sum=0;
			for(int i=1;i<=l;i++)
				temp[++cnt]=v[i];
			for(int i=n;i>=r;i--)
				temp[++cnt]=v[i];
			if(k<cnt)	
				continue;
			sort(temp+1,temp+cnt+1);
			for(int i=cnt;i>=0;i--){
				if(i<=k-cnt)
					sum+=max(temp[i],0);
				else sum+=temp[i];
			}
			ans=max(ans,sum);
		}
	}
	printf("%d\n",ans);
}

Measured memory_bytes: 3764
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define _GLIBCXX_DEBUG

int main() {
	int H, W;
	cin >> H >> W;

	vector<vector<char>> a(H, vector<char>(W));

	rep(i, H) {
		rep(j, W) {
			cin >> a.at(i).at(j);
		}		
	}

	vector<bool> row(H, false);
	vector<bool> col(W, false);

	rep(i, H) {
		rep(j, W) {
			if (a.at(i).at(j) == '#') {
				row.at(i) = true;
				col.at(j) = true;
			}
		}
	}

	rep(i, H) {
		if (row.at(i)) {
			rep(j, W) {
				if (col.at(j)) {
					cout << a.at(i).at(j);
				}
			}
			cout << endl;
		}
	}
	cout << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
		public static void main(String[] args) {
			Scanner sc = new Scanner(System.in);
			int a = sc.nextInt();
			int b = sc.nextInt();
			int c = sc.nextInt();
			if (a <= b && b <= c)
				System.out.printf("%d %d %d\n", a, b, c);
			else if (a <= c && c <= b)
				System.out.printf("%d %d %d\n", a, c, b);
			else if (b <= a && a <= c)
				System.out.printf("%d %d %d\n", b, a, c);
			else if (b <= c && c <= a)
				System.out.printf("%d %d %d\n", b, c, a);
			else if (c <= a && a <= b)
				System.out.printf("%d %d %d\n", c, a, b);
			else if (c <= b && b <= a)
				System.out.printf("%d %d %d\n", c, b, a);
		}
}

Measured memory_bytes: 26340
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(x) (x).begin(),(x).end()
const int mod=1000000007,MAX=1<<20,INF=1<<30;

int n,dat[2*MAX-1],lazy[2*MAX-1];
bool done[2*MAX-1];//0なら評価済み

void init(int n_){
    n=1;
    while(n<n_) n*=2;
    for(int i=0;i<2*n-1;i++){
        dat[i]=INF;
        lazy[i]=INF;
    }
}

void eval(int k,int l,int r){
    if(done[k]==0) return;
    
    if(lazy[k]!=INF){
        dat[k]=min(dat[k],lazy[k]);
        
        if(r-l>1){
            lazy[k*2+1]=min(lazy[k*2+1],lazy[k]);
            lazy[k*2+2]=min(lazy[k*2+2],lazy[k]);
            done[k*2+1]=done[k*2+2]=1;
        }
        
        done[k]=0;
    }
}

void update(int a,int b,int x,int k,int l,int r){
    eval(k,l,r);
    
    if(r<=a||b<=l) return;
    
    if(a<=l&&r<=b){
        lazy[k]=min(lazy[k],x);
        done[k]=1;
        eval(k,l,r);
    }
    
    else{
        update(a,b,x,2*k+1,l,(l+r)/2);
        update(a,b,x,2*k+2,(l+r)/2,r);
        dat[k]=min(dat[2*k+1],dat[2*k+2]);
    }
}

int query(int a,int b,int k,int l,int r){
    
    eval(k,l,r);
    
    if(r<=a||b<=l) return INF;
    if(a<=l&&r<=b) return dat[k];
    
    int vl=query(a,b,2*k+1,l,(l+r)/2);
    int vr=query(a,b,2*k+2,(l+r)/2,r);
    return min(vl,vr);
}


bool compare(pair<int,int> a,pair<int,int> b){
    if(a.second==b.second) return a.first<b.first;
    return a.second<b.second;
}

int main(){
    
    int N,Q;cin>>N>>Q;
    vector<int> S(N),T(N),X(N);
    for(int i=0;i<N;i++){
        cin>>S[i]>>T[i]>>X[i];
    }
    vector<int> D(Q);
    for(int i=0;i<Q;i++){
        cin>>D[i];
    }
    vector<pair<int,int>> A(2*N+Q);//座圧する用
    vector<int> B(2*N+Q);
    for(int i=0;i<N;i++){
        A[2*i]=make_pair(max(S[i]-X[i],0),2*i);
        A[2*i+1]=make_pair(max(T[i]-X[i]-1,0),2*i+1);
    }
    for(int i=0;i<Q;i++){
        A[2*N+i]=make_pair(D[i],2*N+i);
    }
    
    sort(all(A));
    
    B[0]=1;
    for(int i=1;i<2*N+Q;i++){
        if(A[i].first==A[i-1].first) B[i]=B[i-1];
        else B[i]=B[i-1]+1;
    }
    
    for(int i=0;i<2*N+Q;i++){
        A[i].first=B[i];
    }
    
    sort(all(A),compare);
    
    init(2*N+Q+1);
    
    for(int i=0;i<N;i++){
        update(A[2*i].first,A[2*i+1].first+1,X[i],0,0,n);
    }
    
    for(int i=0;i<Q;i++){
        int a=query(A[2*N+i].first,A[2*N+i].first+1,0,0,n);
        if(a==INF) cout<<-1<<endl;
        else cout<<a<<endl;
    }
    
}


Measured memory_bytes: 29440
#include <algorithm>
#include <cassert>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>

#include <limits.h>

using namespace std;

typedef long long ll;

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 = INT_MAX / 2;

vector<int> dp;

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

    dp.resize(N + 1, INF);
    dp[0] = 0;
    for (int i = 0; i < N; i++) {
        if (dp[i] == INF) {
            continue;
        }
        for (ll x = 6; i + x <= N; x *= 6) {
            chmin(dp[i + x], dp[i] + 1);
        }
        for (ll x = 9; i + x <= N; x *= 9) {
            chmin(dp[i + x], dp[i] + 1);
        }
    }

    int ans = 0;
    for (int i = N; i > 0; i--) {
        if (dp[i] != INF) {
            ans += dp[i];
            break;
        }
        ans++;
    }

    cout << ans << endl;

    // for (int i = 0; i <= N; i++) {
    //     cout << dp[i] << " ";
    // }
    // cout << endl;

    return 0;
}


Measured memory_bytes: 640
import java.util.Scanner;

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

        String b = sc.next();
        String result;

        switch(b) {
            case "A":
                result = "T";
                break;
            case "T":
                result = "A";
                break;
            case "C":
                result = "G";
                break;
            case "G":
                result = "C";
                break;
            default:
                result = "";
                break;
        }

        System.out.println(result);
    }
}

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

int main(){
    int a, b;
    cin >> a >> b;
    cout << a * b << endl;

}

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

constexpr int MOD = 1e9+7;

using ll = long long;

int main() {
    string A, B, C;
    while(cin >> A, A != "0") {
        cin >> B >> C;
        reverse(A.begin(), A.end());
        reverse(B.begin(), B.end());
        reverse(C.begin(), C.end());

        vector<vector<ll>> dp(2, vector<ll>(A.size()+1, 0));
        dp[0][0] = 1;
        for(int i=0; i<A.size(); ++i) {
            char a = A[i], b = B[i], c = C[i]; 
            int an = A[i]-'0', bn = B[i]-'0', cn = C[i]-'0';
            int check = 0;
            int l = (i == A.size()-1 ? 1 : 0);
            for(int j=0; j<2; ++j) {
                if(dp[j][i] == 0) {
                    continue;
                }
                if(a != '?' && b != '?') {
                    if(c != '?' && (a-'0' + b-'0' + j)%10 != c-'0') {
                        continue;
                    } else {
                        (dp[(an+bn+j)/10][i+1] += dp[j][i]) %= MOD;
                    }
                } else if(a != '?' || b != '?') {
                    int num = (a != '?' ? an : bn);
                    if(c != '?') {
                        for(int k=l; k<10; ++k) {
                            if(cn == (num + k + j)%10) {
                                (dp[(num+k+j)/10][i+1] += dp[j][i]) %= MOD;
                                break;
                            }
                        }
                    } else {
                        for(int k=l; k<10; ++k) {
                            (dp[(num+k+j)/10][i+1] += dp[j][i]) %= MOD;
                        }
                    }
                } else {
                    if(c != '?') {
                        for(int k=l; k<10; ++k) {
                            for(int m=l; m<10; ++m) {
                                if(cn == (k+m+j)%10) {
                                    (dp[(k+m+j)/10][i+1] += dp[j][i]) %= MOD;
                                }
                            }
                        }
                    } else {
                        for(int k=l; k<10; ++k) {
                            for(int m=l; m<10; ++m) {
                                (dp[(k+m+j)/10][i+1] += dp[j][i]) %= MOD;
                            }
                        }
                    }
                }
            }
        }
        cout << dp[0][A.size()] << endl;
    }
}


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

using namespace std;

bool solve(string ss){
    int l = ss.size();
    if(l%2) return false;
    for(int i = 0;i < l/2-1;i++){
        if(ss[i] != ss[i+l/2]) return false;
    }
    return true;
}

int main(){
    string str;
    while(cin>>str){
        int l = str.size();
        string strr = "";
        for(int i = l-2;i >= 0;i--){
            strr = "";
            for(int j = 0;j <= i;j++)
                strr+=str[j];
            if(solve(strr)) {cout<<i+1<<endl;break;}
        }
    }
    return 0;
}


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

int main(){
  int a[10];
  int tmp;
  int n = 0;

  while(n<10){
    cin >> a[n];
    n++;
  }

  int i,j;

  for(i = 0;i < 10;i++){
    for(j = i+1;j < 10;j++){
      if(a[i] < a[j]){
	tmp = a[i];
	a[i] = a[j];
	a[j] = tmp;
      }
    }
  }

  for(i = 0;i < 3;i++){
    cout << a[i] << endl;
  }
    return 0;
}

  



Measured memory_bytes: 3116
#include <iostream>
#include <cstdio>
#include <vector>
#include <cstring>
#include <map>
#include <cstdlib>
#include <cmath>
#include <string>
#include <algorithm>
#include <set>
#include <stack>
#include <queue>
#include <utility>
#include <bitset>
#define fi first
#define se second
#define pb push_back
#define mkp make_pair
#define rep(i,a,b) for (int i=(a);i<(b);i++)
#define per(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,a,b) for (int i=(a);i<=(b);i++)
#define PER(i,a,b) for (int i=(b);i>=(a);i--)
#define de(x) cout<<">> "<<#x<<" = "<<x<<endl;
using namespace std;
typedef long long LL;

const int INF = 0x3f3f3f3f;
const int MAXN = 1000005; // 1e6;
string p;
int a[4];
int main()
{
	// freopen("in.txt","r",stdin);
	cin>>p;
	rep(i,0,4) a[i]=p[i]-'0';
	rep(i,0,8)
	{
		int sum = a[0];
		// de(i)
		rep(j,0,3)
		{
			if (i >> j & 1) sum+=a[j+1];
			else sum -= a[j+1];
			// de(sum)
		}
		// de(sum)
		if (sum == 7)
		{
			printf("%d%c%d%c%d%c%d=7\n",a[0],(i>>0&1)?'+':'-',a[1],(i>>1&1)?'+':'-',a[2],(i>>2&1)?'+':'-',a[3]);
			return 0;
		}
	}
	return 0;
}



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

typedef long long ll;

main()
{
    int a, b, c, k, x = 0;
    cin >> a >> b >> c >> k;
    while(1){
        if(a < b && b < c){
            break;
        }
        else{
            if(a >= b){
                b = b * 2;
                x++;
                if(x == k){
                    break;
                }
            }
            if(b >= c){
                c = c * 2;
                x++;
                if(x == k){
                    break;
                }
            }
        }
    }
    if(a < b && b < c){
        cout << "Yes";
    }
    else{
        cout << "No";
    }


}





///promy_pompom
//hello world


Measured memory_bytes: 3600
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define int long long
using namespace __gnu_pbds;
using namespace std;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;


signed main()
{
     ios_base::sync_with_stdio(false);
     cin.tie(NULL);  
//  #ifndef ONLINE_JUDGE
//     freopen ("INPUT.txt" , "r" , stdin);
//     freopen ("OUTPUT.txt" , "w" , stdout);
//  #endif

// -------------------------------------Code starts here---------------------------------------------------------------------     

   int n,m;
   cin>>n>>m;
   int a[n];
   set<int>s;
   for(int i=0;i<n;i++)
   {
      cin>>a[i];
      a[i]/=2;
      int z=a[i];
      int cnt=0;
      while(z%2==0)
      {
            cnt++;
         z/=2;
      }
      // cout<<cnt<<"\n";
      s.insert(cnt);
   }
   if(s.size()>1)
   {
      cout<<0;
      return 0;
   }
   int lcm=a[0];
   for(int i=1;i<n;i++)
   {
      int g=__gcd(a[i],lcm);
      lcm=(lcm*a[i])/g;
      if(lcm>m)
      {
         cout<<0;
         return 0;
      }
   }
   int cnt=m/lcm;
   cnt=(cnt+1)/2;
   cout<<cnt;

// -------------------------------------Code ends here------------------------------------------------------------------
     clock_t clk;
 	clk = clock();
 
    clk = clock() - clk;
 	cerr << fixed << setprecision(6) << "Time: " << ((double)clk)/CLOCKS_PER_SEC << "\n";
 	return 0;
 }

Measured memory_bytes: 1024
#include <cstdio>
#include <algorithm>
using namespace std;
int main() {
	int N, u, v;
	scanf("%d", &N);
	long long ans = 0;
	for (int i = 1; i < N; ++i) {
		scanf("%d %d", &u, &v);
		if (u > v) swap(u, v);
		ans -= (long long) u * (long long) (N + 1 - v);
	}
	for (int i = 1; i <= N; ++i) ans += (long long) i * (long long) (N + 1 - i);
	printf("%lld", ans);
	return 0;
}


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

using namespace std;

int main(){
  
  int n, W;
  cin>>n>>W;
  long long wt[n], value[n];
  for(int i=0;i<n;i++){cin>>wt[i];cin>>value[i];}
  
  vector<vector<long long>>dp(n+1,vector<long long>(W+1));
  
  for(int i=0;i<=n;i++){
  	for(int w=0;w<=W;w++){
    	if(i==0||w==0) dp[i][w] =0;
      
      	else if(wt[i-1]<=w){
        	dp[i][w] = max(value[i-1]+dp[i-1][w-wt[i-1]], dp[i-1][w]);
        }else{
        	dp[i][w] = dp[i-1][w];
        
        }
      	
    }
  }
	cout<<dp[n][W];  

}

Measured memory_bytes: 80256
#include <bits/stdc++.h>
// #include <atcoder/all>
#define ll long long int
#define ld long double
#define yorn(f) cout<<((f)?"Yes":"No")<<endl;
#define YORN(f) cout<<((f)?"YES":"NO")<<endl;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define repi(i, n) for (ll i = 1; i < (ll)(n); i++)
#define all(x) (x).begin(), (x).end()
#define put(x) cout << x << endl;
#define println(x) cout << x << endl;
using namespace std;
// using namespace atcoder;
void Main()
{
    ll n, K;
    cin >> n >> K;

    vector<ll> p(n);
    rep(i, n) cin >> p[i];
    
    ll v = 0;
    rep(i, K) {
        v += p[i];
    }

    ll res = v;
    for (ll i = K; i < n; i++) {
        v = v - p[i - K] + p[i];
        res = max(res, v);
    }

    printf("%.12Lf\n", ((ld)res + K) / 2);

}
signed main(){ Main();return 0;}

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

int main(){
    int A;
    long long B, N, x, ans;
    cin >> A >> B >> N;

    if(N >= B - 1){
        x = B - 1;
    }else{
        x = N;
    }
    ans = A * (x % B) / B;
    cout << ans << endl;
}

Measured memory_bytes: 3608
n, k = map(int,input().split())
h =[int(input()) for i in range(n)]
h.sort()
ans = 1000000000000

for i in range(len(h)-k+1):
    if h[i+k-1] - h[i] < ans:
        ans = h[i+k-1] - h[i]
        if ans == 0:
            break

print(ans)

Measured memory_bytes: 7384
#include<cstdio>
#include<algorithm>
#include<iostream>
#include<cstring>
#include<cmath>
using namespace std;
int main()
{
	int x,y,z;
	scanf("%d %d %d",&x,&y,&z);
	printf("%d\n",(x-z)/(y+z));
	return 0;
}

Measured memory_bytes: 256
def main():
    N = int(input())
    #N = int(a)*int(b)
    a = [1,2,3,4,5,6,7,8,9]
    b = [1,2,3,4,5,6,7,8,9]
    for s in a:
        #print(s)
        for w in b:
        # print("s={},w={}".format(s,w))
            
            if N == s * w:
                print('Yes')
                return
    print('No')
               
        
if __name__ == "__main__":
    main()

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;

//const int dx[] = {1, 0, -1, 0, 1, -1, -1, 1};
//const int dy[] = {0, 1, 0, -1, 1, 1, -1, -1};

int main()
{
	string s;
	cin >> s;
	REP(i, (int)s.size()){
		if (s[i] == '1') cout << 9;
		else cout << 1;
	}

	cout << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cstring>
#include <algorithm> // sort

#define REP(i, n) for (long long i = 0; i < (n); i++) 
typedef long long ll;
static const ll MOD = 1000000007;
static const ll INF = 1000000000000000000LL;
using namespace std;


ll x[8] = {-1, -1, -1,  0,  0,  1,  1,  1};
ll y[8] = {-1,  0,  1, -1,  1, -1,  0,  1};
//マインスイーパ
int main(){
  ll H,W;
  cin >> H >> W;

  vector <string> S(H+2,"");
  vector <string> res(H+2,"");

  //端のための空きマス作成
  REP(i,W+2)
  {
    S[0] += ".";
  }

  S[H+1] = S[0];

  string tmp;

  for(ll i = 1; i <= H; ++i)
  {
    cin >> tmp;
    S[i] = "." + tmp + ".";
  }

  for(ll i = 1; i <= H; ++i)
  {
    for(ll j = 1; j <= W; ++j)
    {
      //8方を確認
      //S[j][i]
      if(S[i][j] == '#')
      {
        cout << '#';
        continue;
      }

      int cnt = 0;
      for(ll k = 0; k < 8; ++k)
      {
        if(S[i + x[k]][j + y[k]] == '#')++cnt;
      }
      cout << cnt;
    }
    cout << endl;
  }

  return 0;
}

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

class Program
{
  static void Main(string[] args) {
      string s = Console.ReadLine();
      Console.WriteLine(solve(s) ? "YES" : "NO");
  }
  static bool solve(string s) {
    int n = s.Length;
    char[] a = s.ToCharArray();
    Array.Reverse(a);
    s = new String(a);
    bool ans = true;
    string tmp;
    for(int i = 0;i < n; i ++) {
      tmp = s.Substring(i,5);
      if(tmp == "esare" || tmp == "maerd") {
        i += 4;
        continue;
      }
      tmp = s.Substring(i,6);
      if(tmp == "resare") {
        i += 5;
        continue;
      }
      tmp = s.Substring(i,7);
      if(tmp == "remaerd") {
        i += 6;
        continue;
      }
      ans = false;
      break;
    }
    return ans;
  }
}

Measured memory_bytes: 13108
/*  -*- coding: utf-8 -*-
 *
 * 3039.cc: 
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

/* typedef */

/* global variables */

/* subroutines */

/* main */

int main() {
  int p;
  scanf("%d", &p);
  printf("%d\n", p / 500 * 500);
  return 0;
}



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

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

    Graph G(n);
    rep(i,n)
    {
        if(i>0)
        {
            G.at(i).push_back(i-1);
            G.at(i-1).push_back(i);
        }
    }
    G.at(x-1).push_back(y-1);
    G.at(y-1).push_back(x-1);
    
    vector<int> dk(n,0);

    rep(i,n)
    {
        vector<int> dist(n, -1);
        queue<int> que;
        
        dist.at(i) = 0;
        que.push(i);

        while (!que.empty())
        {
            int v = que.front();
            que.pop();
            
            for (int nv : G.at(v))
            {
                if (dist[nv] != -1)
                    continue;

                dist.at(nv) = dist.at(v) + 1;
                if(i<nv){
                    dk.at(dist.at(nv))++;
                }
                que.push(nv);
            }
        }
    }

    for(int i=1;i<n;i++)
        cout << dk.at(i) << endl;

    return 0;
}


Measured memory_bytes: 384
#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;

class Point {
public:
    int x, y;
    Point(int a = 0, int b = 0)
    {
        int x = a;
        int y = b;
    };
    bool operator <(const Point& p) const {
        return y < p.y || (y == p.y && x < p.x);
    }
};

inline bool direct(Point& base, Point& a, Point& b) {
    return (a.x - base.x)*(b.y - base.y) - (a.y - base.y)*(b.x - base.x) < 0;
}


int main() {
    int n, i;
    int k = 2;
    Point* P;
    Point* H;
    scanf("%d", &n);
    P = new Point[n];
    for (i = 1; i <= n; ++i) {
        scanf("%d%d",&P[i - 1].x, &P[i - 1].y);
#if 0
        Point point = P[i - 1];
        int j;
        for (j = i; j >= 2 && point < P[j - 2]; j--) {
            P[j - 1] = P[j - 2];
        }
        P[j - 1] = point;
#endif
    }
    sort(P, P + n);
    H = new Point[2*n];
    H[0] = P[0];
    H[1] = P[1];
    for (i = 0; i < n - 2; ++i) {
        while (k >= 2 && direct(H[k - 2],H[k - 1],P[i + 2])) k--;
        H[k++] = P[i + 2];
    }
    H[k++] = P[n - 2];
    for (i = n; i > 2; i--) {
        while (k >= 2 && direct(H[k - 2],H[k - 1],P[i - 3])) k--;
        H[k++] = P[i - 3];
    }
    printf("%d\n", k - 1);
    for (i = 0; i < k - 1; ++i) {
        printf("%d %d\n", H[i].x, H[i].y);
    }
    return 0;
}

Measured memory_bytes: 3828
#include<bits/stdc++.h>
using namespace std;
map<pair<long long,long long>,long long>M;
vector<pair<long long,long long>>vec,vec2;
long long H,W,n,a,b;
long long cnt1[10];
bool valid(int x,int y){if(x<0 || x>=H-2 || y<0 || y>=W-2){return false;}return true;}
int main(){
	cin>>H>>W>>n;
	for(int i=0;i<n;i++){
		cin>>a>>b;a--;b--;M[make_pair(a,b)]=1;
		for(int j=-2;j<=0;j++){for(int k=-2;k<=0;k++)vec.push_back(make_pair(a+j,b+k));}
	}
	if(n>=1){
		sort(vec.begin(),vec.end());
		if(valid(vec[0].first,vec[0].second)==true)vec2.push_back(vec[0]);
		for(int i=1;i<vec.size();i++){
			if(vec[i-1]!=vec[i]){
				if(valid(vec[i].first,vec[i].second)==true)vec2.push_back(vec[i]);
			}
		}
		for(int i=0;i<vec2.size();i++){
			int cnts=0;
			for(int j=0;j<3;j++){for(int k=0;k<3;k++)cnts+=M[make_pair(vec2[i].first+j,vec2[i].second+k)];}
			cnt1[cnts]++;
		}
	}
	long long sums=0;for(int i=1;i<=9;i++){sums+=cnt1[i];}
	cnt1[0]=1LL*(H-2)*(W-2)-sums;
	for(int i=0;i<=9;i++)cout<<cnt1[i]<<endl;
	return 0;
}

Measured memory_bytes: 184676
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000
#define int long long

signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N; cin >> N;
    int a[200010];
    rep(i, N) cin >> a[i];
    int x = 0, y = 0;
    rep(i, N) {
        y += a[i];
    }
    int ans = INF2;
    rep(i, N - 1) {
        x += a[i];
        y -= a[i];
        ans = min(ans, abs(x - y));
    }
    cout << ans << endl;

    return 0;
}


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

int main() {
    int n, m, k;
    cin >> n >> m >> k;
    for (int i = 0; i <= n; ++i) {
        for (int j = 0; j <= m; ++j) {
            if (j * n + i * m - 2 * i * j == k) {
                cout << "Yes\n";
                return 0;
            }
        }
    }
    cout << "No\n";
    return 0;
}

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

using namespace std;

#define FastIO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

#define nl "\n"
#define sp " "
#define int long long
#define PI 3.141592653589793
#define scanstr(s) cin>>ws; getline(cin,s);

void solve()
{
	string a,b;
	cin>>a>>b;
	int ch=0;
	for(int i=0;i<a.size();i++)
	{
		if(a[i]!=b[i]) ch++;
	}
	cout<<ch<<nl;
	return ;
}

int32_t main()
{
	FastIO;
	solve();
	return 0;
}


Measured memory_bytes: 3848
H, W, A, B = gets.split.map(&:to_i)

grid = Array.new(H) { Array.new(W, 0) }

B.times do |y|
  A.times do |x|
    grid[y][x] = 1
  end
end

B.upto(H - 1) do |y|
  A.upto(W - 1) do |x|
    grid[y][x] = 1
  end
end

puts grid.map(&:join)


Measured memory_bytes: 15996
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 100000000;
const ll half_inf = 0x3f3f3f3f;
const ll inf = 0x7fffffff;
const ll mod = 998244353;
const ll maxn = 2000005;
string s; 
int main(){  
	cin.tie(0);
    ios::sync_with_stdio(false);
	/*int n,k;
	scanf("%d%d",&n,&k);*/
	cin>>s;
	for(int i=0;i<s.size();i++){
		if(s[i]=='7'){
			printf("Yes");
			return 0;
		}
	}
	printf("No");


    return 0;
}




Measured memory_bytes: 3780
fun main(args: Array<String>) {
    abc148e()
}

fun abc148e() {
    val n = readLine()!!.toLong()

    if (n % 2 != 0L) return println(0)

    val answer = (1..50).map { n / 2 / Math.pow(5.0, it.toDouble()).toLong() }.sum()

    println(answer)
}


Measured memory_bytes: 33636
#include <iostream>
#include <vector>
#include <map>
using namespace std;
typedef long long ll;

map<ll, int> GetPrimes(ll N) {
    map<ll, int> primes;
    ll p = 2;
    while (p * p <= N) {  // check this cond is correct
        while (N % p == 0) {
            primes[p]++;
            N /= p;
        }
        ++p;
    }
    if (N != 1) {
        primes[N]++;
    }
    return primes;
}

int main()
{
    ll N;
    cin >> N;
    map<ll, int> primes = GetPrimes(N);
    
    int ans = 0;
    for (auto x : primes) {
        int count = x.second;
        int i = 1;
        while (i <= count) {
            ++ans;
            count -= i;
            ++i;
        }
    }
    
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3196
#include <iostream>
using namespace std;
int main(){
    int card[4][13] = {0}, n;
    int sum_of_S = 0, sum_of_H = 0, sum_of_D = 0, sum_of_C = 0;
    int sum_cards,num;
    cin >> n;
    char  pic;
    for (int i = 0; i < n; i++){
        cin >> pic >> num;
        if (pic == 'S') {
            card[0][num - 1] = 1;
            }
        if (pic == 'H'){
             card[1][num - 1] = 1;
        }
        if (pic == 'C'){
             card[2][num - 1] = 1;
        }
        if (pic == 'D'){
             card[3][num - 1] = 1;
        }
    }

    for (int i = 0; i < 4; i++ ){
        for (int k = 0; k < 13; k ++){
            if (card[i][k] == 1)continue;
            if (i == 0){
                cout << "S" << " " << k + 1 << endl;
             }
            if (i == 1){
                cout << "H" << " " <<  k + 1 << endl;
            }
            if (i == 2){
                cout << "C" << " " << k + 1 << endl;
                }
            if (i == 3){
                cout << "D" << " " << k + 1 << endl;
                }
                }
            }
        }
        


Measured memory_bytes: 3092
#include <bits/stdc++.h>
using namespace std;
#define N_PRIME 1000000007
#define ll int64_t


int main(void){
    while(true){
        int N;
        bool b[32][32] = {false};
        cin >> N;
        if( N==0 )return 0;
        
        for(int i = 0 ; i < N ;i ++ ){
            int x,y;
            cin >> x >> y;
            b[x][y] = true;
        }
        //cout << "A" << endl;
        
        int x = 10,y = 10;
        int count = 0;
        int M;
        cin >> M;
        
        if( b[10][10] ){
            count++;
            b[10][10] = false;
        }
        for(int i = 0 ; i < M ; i++ ){
            string s;
            int L;
            cin >> s;
            cin >> L;
            int dx,dy;
            
            switch(s[0]){
                case 'N':
                    dy = 1;dx =0;
                    break;
                case 'E':
                    dy = 0;dx = 1;
                    break;
                case 'S':
                    dy = -1;dx =0;
                    break;
                case 'W':
                    dy = 0;dx = -1;
                    break;
            }
            
            for(int j = 0 ; j < L ;j++ ){
                x += dx;
                y += dy;
                if( b[x][y] ){
                    count++;
                    b[x][y] = false;
                }
            }
        } 
        cout << (N==count?"Yes":"No") << endl;
    }
    return 0;
}

Measured memory_bytes: 2976
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <queue>
#include <sstream>

using namespace std;

int h1[2000000];
int w1[2000000];

int main(){
	
	while(true){
		
		int N, M;
		
		cin >> N >> M;
		if(N == 0 && M == 0){
			break;
		}
		
		int h[2000];
		int w[2000];
		
		for(int i = 0; i < 2000000; i++){
			h1[i] = 0;
			w1[i] = 0;
		}
		
		
		for(int i = 0; i < N; i++){
			cin >> h[i];
		}
		
		for(int i = 0; i < M; i++){
			cin >> w[i];
		}
		
		for(int i = 0; i < N; i++){
			int sum = 0;
			for(int j = i; j < N; j++){
				sum += h[j];
				h1[sum]++;
			}
		}
		
		for(int i = 0; i < M; i++){
			int sum = 0;
			for(int j = i; j < M; j++){
				sum += w[j];
				w1[sum]++;
			}
		}
		
		int ans = 0;
		
		for(int i = 0; i < 2000000; i++){
			ans += h1[i] * w1[i];
		}
		
		cout << ans << endl;
	}
	
	return 0;
}

Measured memory_bytes: 18712
#include "iostream"
#include "vector"
#include "string"
#include "algorithm"
#include "math.h"
using namespace std;

int main()
{
  int a, b;
  cin >> a >> b;
  if (a + b < 10)
  {
    cout << a + b << "\n";
  }
  else
  {
    cout << "error" << "\n";
  }
}

Measured memory_bytes: 256
code = r"""
# distutils: language=c++
# distutils: include_dirs=[/home/contestant/.local/lib/python3.8/site-packages/numpy/core/include, /opt/atcoder-stl]
# cython: language_level=3
# cython: boundscheck=False
# cython: wraparound=False
from libcpp cimport bool
from libcpp.vector cimport vector
cdef extern from "<atcoder/segtree>" namespace "atcoder":
    cdef cppclass segtree[S, OP, E]:
        segtree(vector[S] v)
        void set(int p, S x)
        S get(int p)
        S prod(int l, int r)
        S all_prod()
        int max_right[F](int l)
        int min_left[F](int r)
ctypedef long seg_t
cdef extern from *:
    ctypedef int op "myop"
    ctypedef int e "mye"
    ctypedef int f "myf"
    cdef seg_t myop(seg_t a, seg_t b) nogil
    cdef seg_t mye() nogil
    cdef bool myf(seg_t k) nogil
cdef seg_t myop(seg_t a, seg_t b) nogil:
    if a > b:
        return a
    else:
        return b
cdef seg_t mye() nogil:
    return -1000000000
cdef seg_t v
cdef bool myf(seg_t k) nogil:
    return k < v
from libc.stdio cimport scanf, printf
cdef main():
    cdef int n, q, i, t, u
    scanf('%d%d', &n, &q)
    cdef vector[seg_t] a = vector[seg_t](n)
    for i in range(n): scanf('%ld', &a[i])
    cdef segtree[seg_t, op, e] *seg = new segtree[seg_t, op, e](a)
    for i in range(q):
        scanf('%d%d%d', &t, &u, &v)
        if t == 1:
            seg.set(u - 1, v)
        elif t == 2:
            printf('%ld\n', seg.prod(u - 1, v))
        else:
            printf('%ld\n', seg.max_right[f](u - 1) + 1)
main()
"""
import os, sys
if sys.argv[-1] == 'ONLINE_JUDGE':
    open('solve.pyx', 'w').write(code)
    os.system('cythonize -i -3 -b solve.pyx')
import solve

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

int main(){
  int a,b;cin >> a >> b;
  if(a+b == 15)cout << "+" << endl;
  else if(a*b == 15)cout << "*" << endl;
  else cout << "x" << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
    int n;
    cin>>n;
    ll a[n];
    for(int i=0;i<n;i++)
    cin>>a[i];
    sort(a,a+n);
    int count=0;
    for(int i=0;i<n-2;i++)
    {
        int k=i+2;
        for(int j=i+1;j<n;j++)
        {
         while(k<n && a[i]+a[j]>a[k])
         {
             k++;
         }
         count+=(k-j-1);
        }
    }
    cout<<count;
}

Measured memory_bytes: 256
/* 
chirag11032000
Chirag Thakur
*/

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

using ll = long long;
using db = double;
using pii = pair < int, int >;
using pll = pair < ll, ll >;

template < typename T > using OrderedSet = tree < T, null_type, less < T >, rb_tree_tag, tree_order_statistics_node_update >;
template < typename T > using MinPriorityQueue = priority_queue < T, vector < T >, greater < T > >;

#ifndef ONLINE_JUDGE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template < typename Arg1 >
void __f(const char* name, Arg1&& arg1) {
	cerr << name << " : " << arg1 << std::endl;
}
template < typename Arg1, typename... Args >
void __f(const char* names, Arg1&& arg1, Args&&... args) {
	const char* comma = strchr(names + 1, ',');
	cerr.write(names, comma - names) << " : " << arg1 << " | ";
	__f(comma + 1, args...);
}
#else
#define trace(...)
#endif

#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define unique_sort(x) sort(all(x)), x.resize(distance(x.begin(), unique(all(x))))

const db PI = acos(-1);
const ll LINF = LLONG_MAX;
const int INF = INT_MAX, MOD = 1e9 + 7, N = 1e5 + 10;

void test_case();

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	test_case();
	cerr << "Time taken: " << int((clock() * 1000.) / CLOCKS_PER_SEC) << "ms\n";
	return 0;
}

void test_case() {
	int n;
	cin >> n;
	db ans = 0;
	while (n--)	{
		db x;
		string u;
		cin >> x >> u;
		if (u == "BTC") {
			x *= 380000.0;
		}
		ans += x;
	}
	cout << fixed << setprecision(10) << ans << "\n";
}

Measured memory_bytes: 384
#include <algorithm>
#include <iomanip>
#include <iostream>
#include <queue>
#include <map>

#define p(a, b) pair<a, b>

using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n,m;
    cin >> n >> m;
    uint64_t a = 1900 * m;
    uint64_t b = 100 * (n-m);
    int res = a + b;
    uint64_t c = (1 << m);
    cout << res * c;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#define MAX 1100
using namespace std;


int main(){
    char s[5];
    cin>>s[1]>>s[2]>>s[3];
    int num=700;
    for(int i=1;i<=3;i++){
        if(s[i]=='o') num+=100;
    }
    printf("%d\n",num);
    return 0;
}


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

int main() {
  int A, B;
  cin >> A >> B;

  for(int i = 0; i <= 1010; i++){
    if((int)((float)i * 0.08) == A && (int)((float)i * 0.1) == B){
      cout << i << endl;
      return 0;
    }
  }
  cout << -1 << endl;  
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
 

public class Main{
          
     
     public static void main(String args[]){
         BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
         
         try{ String line;
             while((line=br.readLine())!=null){if(line.isEmpty())break;
             String spl[] = line.split(" ");
             int a= Integer.parseInt(spl[0]);
             int b= Integer.parseInt(spl[1]);
             int c= Integer.parseInt(spl[2]); if(a==-1&&b==-1&&c==-1)break;
             int all = 120*60;
             int tukatta = a*60*60+b*60+c;
             
             int nokori = all-tukatta;
             for(int i=0; i<2;i++){
                 if(i==1){nokori=nokori*3;}
             int nokoriFun = nokori/60; int nokoriByou=nokori%60;
             String top= (nokoriFun/60==0)? "00": "0"+(nokoriFun/60);
             nokoriFun=nokoriFun%60;
             String mid = (nokoriFun==0)? "00" :( nokoriFun/10==0)? "0"+nokoriFun: nokoriFun+"";
             String las = (nokoriByou/10==0)? "0"+nokoriByou : nokoriByou+"";
                 System.out.println(top+":"+mid+":"+las);
             }
                 
                 
             } br.close();
         }catch(Exception e){e.printStackTrace();}         
     }  
    
     
}
 

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

int main () {
	int N;
	cin >> N;
	string w[110];
	for (int i = 0; i < N; ++i) cin >> w[i];

	bool exist_same = false;
	bool not_shiritori = false;

	for (int i = 0; i < N; ++i) {
		for (int j = i + 1; j < N; ++j) {
			if (w[i] == w[j]) exist_same = true;
		}
	}

	for (int i = 0; i < N - 1; ++i) {
		if (w[i][w[i].size() - 1] != w[i + 1][0]) {
			not_shiritori = true;
		}
	}

	if (exist_same || not_shiritori) cout << "No" << endl;
	else cout << "Yes" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) begin(v),end(v)
#define fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
using ll = long long;
using pii = pair<int, int>;
constexpr ll INF = 1ll<<30;
constexpr ll longINF = 1ll<<60;
constexpr ll MOD = 1000000007;
constexpr bool debug = 0;
//---------------------------------//

int main() {
	int K;
	string S;
	cin >> K >> S;
	if (S.size() <= K) cout << S << endl;
	else {
		string ans = S.substr(0, K);
		ans += "...";
		cout << ans << endl;
	}
	return 0;
}


Measured memory_bytes: 3632
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cctype>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define MOD 1000000007
#define rep(i,n) for(i=0;i<(n);i++)
#define loop(i,a,n) for(i=a;i<(n);i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
#define int ll
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;

signed main(void) {
  int i,j,k;
  int n;
  cin>>n;
  vs s(n);
  rep(i,n)cin>>s[i];

  string str="MARCH";

  vi num(5,0);

  rep(i,n)rep(j,5)if(s[i][0]==str[j])num[j]++;

  int ans=0;

  rep(i,5)loop(j,i+1,5)loop(k,j+1,5)

    if(num[i]>0 && num[j]>0 && num[k]>0){
      ans+=num[i]*num[j]*num[k];
    }

  cout<<ans<<endl;

}


Measured memory_bytes: 6144
#include<stdio.h>
int f(int l[],int r[],int n)
{
	int c=0,s=0,h=0;
	int *p[2]={l,r};
	int d[2][111]={0};
	for(;;)
	{
		while(p[s][h]==1&&p[s][h+1]==1)++h;
		while(p[s][h]==2)--h;
		if(h+1>=n) return c;
		h+=2;
		s=!s;
		++c;
		if(d[s][h])return 999;
		d[s][h]=c;
	}
}
int main()
{
	int n,a[111],b[111],i,x,y;
	while(scanf("%d",&n),n)
	{
		for(i=1;i<=n;++i)scanf("%d",&a[i]);
		for(i=1;i<=n;++i)scanf("%d",&b[i]);
		a[0]=b[0]=a[n+1]=b[n+1]=-1;
		x=f(a+1,b+1,n);
		y=f(b+1,a+1,n);
		if(x==999&&y==999)puts("NA");
		else printf("%d\n",x<y?x:y);
	}
	return 0;
}

Measured memory_bytes: 0
using System;
using System.Collections.Generic;
class Program
{
	static void Main(string[] args)
	{
		string[] str = Console.ReadLine().Split();
		int N = int.Parse(str[0]);
		int S = int.Parse(str[1]);
		int[]A = new int[N];
		string[] str2 = Console.ReadLine().Split();
		for(var i=0;i<N;i++){
			A[i] = int.Parse(str2[i]);
		}
		long[,]D = new long[N+1,S+1];
		long mod = 998244353;
		D[0,0] = 1;
		for(var i=0;i<N;i++){
          	D[0,0] *= 2;
          	D[0,0] %= mod;
        }
		for(var i=1;i<=N;i++){
			for(var j=0;j<=S;j++){
				D[i,j] += D[i-1,j];
				D[i,j] %= mod;
				if(j+A[i-1]<=S){
					D[i,j+A[i-1]] += D[i-1,j] * (mod+1)/2;
					D[i,j+A[i-1]] %= mod;
				}
			}
		}
      	//for(var i=0;i<=N;i++){
        //  	for(var j=0;j<=S;j++){
        //      	Console.Error.Write(D[i,j]+" ");
        //    }
        //  	Console.Error.WriteLine();
        //}
		Console.WriteLine(D[N,S]);
	}
}

Measured memory_bytes: 88324