akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <deque>

#define Inf             987654321
using namespace std;

typedef long long int   ll;
typedef pair<ll, ll>    pii;
typedef vector<ll>      vi;
typedef vector<vi>      vii;
/*************************************************/

bool isPrime(int num)
{
    if (num < 2) return false;
    for (int i = 2; i * i <= num; i++)
    {
        if (num % i == 0) return false;
    }
    return true;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(); cout.tie();
    int X;
    cin >> X;

    while (!isPrime(X++)) {

    }
    cout << X - 1 << '\n';

    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#include <string>
#include <stack>
#include <queue>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <bitset>
#include <complex>
#include <unistd.h>
#include <cassert>
#include <cctype>
#include <random>
#include <time.h>
#include <functional>
#define _USE_MATH_DEFINES
#define _GLIBCXX_DEBUG
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> plglg;
typedef pair<double, ll> pdlg;
typedef tuple<int, int, int> tiii;
typedef tuple<ll, ll, ll> tlglglg;
typedef tuple<ll, ll, ll, ll> tlglglglg;
typedef tuple<double, double, double> tddd;
typedef complex<double> xy_t;
typedef vector<ll> vll;
typedef vector< vector<ll> > matrix;
typedef unsigned int uint;
typedef unsigned long long ull;
template <class T> using V = vector<T>;
template <class T> using VV = V<V<T>>;
template <class T> using VVV = V<VV<T>>;
#define REP(i, x, y) for(ll i = (ll)x; i < (ll)y; i++)
#define DREP(i, x, y, d) for(ll i = (ll)x; i < (ll)y; i += (ll)d)
#define PER(i, x, y) for(ll i = (ll)x; i > (ll)y; i--)
#define DPER(i, x, y, d) for(ll i = (ll)x; i > (ll)y; i -= (ll)d)
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
double pi = 3.141592653589793;
ll mod = 1000000007;
int intmax = 2147483647;
int intmin = -2147483648;
ll llmax = 9223372036854775807;
ll llmin = -9223372036854775807;
int iinf = intmax / 8;
ll inf = llmax / 8;
double eps = 1e-12;
void yesno(bool ok, string yes = "Yes", string no = "No") {
    if (ok) {
        cout << yes << endl;
    } else {
        cout << no << endl;
    }
}

ll disX[1 << 16][16];
ll disY[1 << 16][16];

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N;
    cin >> N;
    ll X[N], Y[N], P[N];
    REP(i, 0, N) {
        cin >> X[i] >> Y[i] >> P[i];
    }
    REP(i, 0, 1 << N) {
        REP(j, 0, N) {
            disX[i][j] = abs(X[j]);
            disY[i][j] = abs(Y[j]);
            REP(k, 0, N) {
                if (i & (1LL << k)) {
                    disX[i][j] = min(disX[i][j], abs(X[j] - X[k]));
                    disY[i][j] = min(disY[i][j], abs(Y[j] - Y[k]));
                }
            }
        }
    }
    ll ans[N + 1];
    fill(ans, ans + N + 1, inf);
    REP(bit, 0, 1 << N) {
        ll bitnum = 0;
        REP(j, 0, N) {
            if (bit & (1LL << j)) {
                bitnum++;
            }
        }
        for (ll i = bit; i >= 0; i--) {
            i &= bit;
            ll tmp = 0;
            REP(j, 0, N) {
                if (!(i & (1LL << j))) {
                    tmp += min(disX[i][j], disY[bit - i][j]) * P[j];
                }
            }
            ans[bitnum] = min(ans[bitnum], tmp);
        }
    }
    REP(i, 0, N + 1) {
        cout << ans[i] << endl;
    }
}


Measured memory_bytes: 11844
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; i++)
#define repr(i, s, e) for(int i=s; i>=e; i--)
#define reps(i, s, e) for(int i=s; i<e; i++)
#define inf 1e18
#define vsort(v) sort(v.begin(), v.end())
#define vsortr(v) sort(v.begin(), v.end(), greater<ll>())
#define sz(x) x.size()
#define ceil(a, b) (a+b-1)/b
#define ok cout << "ok" << endl;
using namespace std;
using ll = long long;
template<typename T> inline bool chmax(T &a, T b){ if(a<b){ a=b; return true; } return false; }
template<typename T> inline bool chmin(T &a, T b){ if(b<a){ a=b; return true; } return false; }
template<typename T> T gcd(T a, T b){ if(b==0) return a; return gcd(b, a%b); }
template<typename T> T lcm(T a, T b){ return a*b/gcd(a, b); }
template<typename T> void vdebug(vector<T> v){ for(auto vv : v){ cout << vv << " "; } cout << endl; }
template<typename T> void adebug(T arr[], int n){ rep(i, n){ cout << arr[i] << " "; } cout << endl; }
void ans(bool b){ if(b) cout << "Yes" << endl; else cout << "No" << endl; }
void ans2(bool b){ if(b) cout << "YES" << endl; else cout << "NO" << endl; }
int keta(ll num){ int k=0; while(num>0){ num/=10; k++; } return k; }
int dx[] = {1, -1, 0, 0, 1, -1, 1, -1};
int dy[] = {0, 0, 1, -1, 1, -1, -1, 1};


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

    int n;
    string s;
    cin >> n >> s;

    int res = n;
    rep(i, n){
        if(s[i] == s[i+1]){
            res--;
        }
    }

    cout << res << endl;

    return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <typeinfo>
#include <cstdlib>

using namespace std;

int main() {
    string s;
    cin >> s;
    int y = atoi(s.substr(0, 4).c_str());
    int m = atoi(s.substr(5,2).c_str());
    int d = atoi(s.substr(8,2).c_str());
    if (y<=2018) {
        goto heisei;
    }
    if (y== 2019 && m<=4) {
        goto heisei;
    }
    cout << "TBD" << endl;
    return 0;
    heisei:
    cout<< "Heisei" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
	int n, k, q;
	cin>>n>>k>>q;
	vector<int> v(q), count(n+1, 0);
	for(int i = 0; i < q; i++)
	{
		cin>>v[i];
		count[v[i]]++;
	}
	for(int i = 0; i < n; i++)
	{
		if((k-(q-count[i+1])) > 0)
			cout<<"Yes"<<endl;
		else cout<<"No"<<endl;
	}
	// for(int i = 0; i < )
	
}

Measured memory_bytes: 1408
#include<bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
using namespace std;
typedef long long ll;
ll gcd(ll a,ll b){return b!=0?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

int main(){
    ll n,a;
    cin>>n;
    ll cnt[(ll)1e5+2]={};
    rep(i,n){
        cin>>a;
        cnt[a]++; cnt[a-1]++; cnt[a+1]++;
    }
    ll mx=0;
    for(ll i=1;i<=1e5;i++) mx=max(mx,cnt[i]);
    cout<<mx<<endl;
    return 0;
}

Measured memory_bytes: 1024
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */

#include <iostream>
#include <fstream>

#include <iostream>
#include "bits/stdc++.h"

using namespace std;

typedef unsigned long long ll;
typedef int                     integer;
#define int                     long long
#define ii                      pair<int,int>
#define vii                     vector<pair<int,int>>
#define vi                      vector<int>
#define vvi                     vector<vector<int>>
#define f(a,b,c)                for(int a=b;a<c;a++)
#define s(x)                    in>>x
#define s2(x,y)                 in>>x>>y
#define s3(x,y,z)               in>>x>>y>>z
#define s4(x,y,z,w)             in>>x>>y>>z>>w
#define p(x)                    out<<x<<endl
#define p2(x,y)                 out<<x<<" "<<y<<endl
#define pl(x)                   out<<x
#define p2l(x,y)                out<<x<<" "<<y
#define p1d(a,n)                for(int ix=0;ix<n;ix++) out<<a[ix]<<" "; out<<endl
#define p2d(a,n,m)              for(int ix=0;ix<n;ix++){ for(int jx=0;jx<m;jx++) out<<a[ix][jx]<<" "; out<<endl;}
#define range(v)                v.begin(),v.end()
#define w(x)                    while(x--)
#define rst(x)                  memset(x, -1, sizeof(x))
#define UNVISITED               -1
#define VISITED                 0
#define EXPLORED                2

void ssolve(std::istream& in, std::ostream& out){
        int x;
        s(x);
        out<<(((x/500)*1000 + ((x%500)/5)*5))<<endl;
}

class BGoldenCoins {
public:
	void solve(std::istream& in, std::ostream& out) {
        ios_base::sync_with_stdio(false);
        in.tie(0);out.tie(0);
        int t;
        int READ = 0;
        if(READ) s(t);
        else t = 1;
        while(t--){
            ssolve(in, out);
        }
	}
};


integer main() {
	BGoldenCoins solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
}


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

typedef long long ll;
const ll INF = 1010000000000000017LL;
const ll MOD = 1000000007LL;

#define REP(i, n) for(ll i = 0 ; i < n; i++)

//#define DEBUG(fmt, ...)
#define DEBUG(fmt, ...) fprintf(stderr, fmt "\n", ##__VA_ARGS__)

int main(){
    std::cout<<std::fixed<<std::setprecision(10);

    ll K, X;
    cin >> K >> X;

    for( int i = X-K+1; i <= X+K-1; i++ ){
        cout << i << " ";
    }
    cout << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
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; }

const int mod = 1e9 + 7;


int main() {
    string s;
    cin >> s;
    int n = s.size();
    vector<vector<ll>> dp(n+1, vector<ll>(13, 0));
    dp[0][0] = 1;
    for(int i = 0; i < n; i++){
        for(int j = 0; j < 13; j++){
            if(s[i] == '?'){
                for(int x = 0; x < 10; ++x){
                    (dp[i+1][(j*10+x)%13] += dp[i][j]) %= mod;
                }
            }
            else{
                (dp[i+1][(j*10+s[i]-'0')%13] += dp[i][j]) %= mod;
            }
        }
    }
    cout << dp[n][5] << endl;
}


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

using namespace std;

const int N = 52;

int n, p;
int a[N];

long long dp[N][2];

int main() {
  scanf("%d%d", &n, &p);
  for (int i = 1; i <= n; ++i) {
    scanf("%d", a + i);
  }
  dp[0][0] = 1;
  for (int i = 1; i <= n; ++i) {
    for (int j = 0; j < 2; ++j) {
      dp[i][j] = dp[i - 1][j] + (a[i] % 2 == 1 ? dp[i - 1][!j] : dp[i - 1][j]);
    }
  }
  printf("%lld\n", dp[n][p]);
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define debug(x)        cout<<#x<<" :"<<x<<endl;
#define ff              first
#define ar              array
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define f(i,n)          for(int i=0;i<n;i++)
#define MOD             1000000007
#define pi              3.14159265
#define umii            unordered_map<int,int>
#define umci            unordered_map<char,int>
#define umsi            unordered_map<string,int>

void k_007()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

#ifndef ONLINE_JUDGE
	freopen("ip1.txt", "r", stdin);
	freopen("op1.txt", "w", stdout);
#endif
}
bool sortbysec(const pair<int, int> &a,
               const pair<int, int> &b);
int gcd(int a, int b) ;
int prime(int n);
int power(int x, int y);
int lcm(int a, int b);
bool compare(pii p1, pii p2)
{
	return p1.ff < p2.ff;
}
int32_t main()
{
	k_007();
	int n, m;
	cin >> n >> m;
	if (n <= 9 && m <= 9)
	{
		cout << n*m << endl;
	}
	else
		cout << -1 << endl;

}

bool sortbysec(const pair<int, int> &a, const pair<int, int> &b)
{
	return (a.second < b.second);
}
int gcd(int a, int b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}
int prime(int n) {
	int flag = 1;
	for (int i = 2; i <= sqrt(n); i++) {
		if (n % i == 0) {flag = 0; break;}
	}
	return flag;
}
int power(int x, int y)
{
	if (y == 0)
		return 1;
	else if (y % 2 == 0)
		return ((power(x, y / 2) % MOD) * ( power(x, y / 2) % MOD)) % MOD;
	else
		return ((x % MOD) * (power(x, y / 2) % MOD) * (power(x, y / 2) % MOD)) % MOD;
}
int lcm(int a, int b)
{
	return (a * b) / gcd(a, b);
}

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

using namespace std;

#define rep(i,n) for(int i=0;i<(n);i++)
#define repa(i,a,n) for(int i=(a);i<(n);i++)
#define rrep(i,n) for(int i=n;i>=0;i--)
#define rrepa(i,a,n) for(int i=n;i>=(a);i--)
#define all(a) (a).begin(),(a).end()
#define MOD 1000000007
#define cmax(a,b) a=max(a,b)
#define cmin(a,b) a=min(a,b)
#define vc vector

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<int,int> pi;
typedef pair<ll,ll> pl;

int main(){

    int n,m;
    cin>>n>>m;
    vvi to(n);
    rep(i,m){
        int a,b;
        cin>>a>>b;
        to[a-1].push_back(b-1);
        to[b-1].push_back(a-1);
    }

    vi ans(n,-1);
    int cnt=n-1;

    queue<int> que;
    que.push(0);
    vi checked(n);

    while(!que.empty()){
        int num=que.front();
        que.pop();
        if(checked[num])continue;
        rep(i,to[num].size()){
            if(ans[to[num][i]]==-1){
                ans[to[num][i]]=num+1;
                cnt--;
                que.push(to[num][i]);
            }
        }
    }

    if(cnt){
        cout<<"Yes\n";
        repa(i,1,n)cout<<ans[i]<<"\n";
    }else{
        cout<<"No\n";
    }

    return 0;

}

Measured memory_bytes: 10512
#include <iostream>
#include <vector>

using namespace std;

long long add(string str, int bit){
	long long res = 0;
	long long tmp = 0;
	
	for(int i = 0;i < str.size();i++){
		tmp = 10*tmp + (str[i]-'0');
		if(bit&(1<<i)){
			res += tmp;
			tmp = 0;
		}
	}
	res += tmp;
	
	return res;
}

int main(){
	string str;
	cin >> str;
	
	int dig = str.size();
	long long res = 0;
	
	for(int i = 0;i < (1<<(dig-1));i++){
		res += add(str, i);
	}
	
	cout << res << endl;
	
	return 0;
}

Measured memory_bytes: 256
n = int(input())
f = [list(map(int, input().split())) for _ in range(n)]
p = [list(map(int, input().split())) for _ in range(n)]

ans = -float('inf')
for bit in range(1, 2 ** 10):
    # 1店舗ずつを処理
    score = 0
    for i in range(len(f)):
        # 曜日・時刻ごとのスコアを計算
        cnt = 0
        for j in range(10):
            # ある店舗のi番目の時刻と、bitが合致するかチェック
            if f[i][j] & (bit >> j):
                cnt += 1
        score += p[i][cnt]
    ans = max(score, ans)
print(ans)

Measured memory_bytes: 3188
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define All(v) (v).begin(),(v).end()

int d[110];
int f[110];
vector<int> edge[110];
int t=0;
void dfs(int now){
    sort(All(edge[now]));
    if(edge[now].size()==0){
        t++;
        f[now]=t;
    }else{
        for(int i=0;i<edge[now].size();i++){       
            if(d[edge[now][i]]==-1){
                t++;
                d[edge[now][i]]=t;
                dfs(edge[now][i]);
            }
            if(i==edge[now].size()-1){
                t++;
                f[now]=t;
            }
        }
    }
}
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    fill(d,d+110,-1);
    fill(f,f+110,-1);
    int n;
    cin>>n;
    for(int i=0;i<n;i++){
        int u,k;
        cin>>u>>k;
        for(int j=0;j<k;j++){
            int x;
            cin>>x;
            edge[u].push_back(x);
        }
    }
    for(int i=1;i<=n;i++){
        if(d[i]==-1){
            t++;
            d[i]=t;
            dfs(i);
        }
    }
    for(int i=1;i<=n;i++){
        cout<<i<<' '<<d[i]<<' '<<f[i]<<endl; 
    }

}


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

const long long mod = 1e9+7;

int main(){
	long long a,b,sum=1;
	cin >> a >> b;
	if(a>b&&a>b+1 || a<b&&a+1<b){
		cout << 0 << endl;
		return 0;
	}
	
	for(long long i=2;i<=a;i++){
		sum*=i;
		sum%=mod;
	}
	for(long long i=2;i<=b;i++){
		sum*=i;
		sum%=mod;
	}
	if(a==b) sum=(sum*2)%mod;
	cout << sum << endl;
	return 0;
}

Measured memory_bytes: 256
N,M=map(int,input().split())
A=list(map(lambda x: -int(x),input().split()))
import heapq
heapq.heapify(A)
for _ in range(M):
  a = heapq.heappop(A)
  a /= 2
  heapq.heappush(A,a)
ans = 0
for a in A:
  ans += int((-1)*a)
print(ans)
  

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

int main()
{
  int n;
  scanf("%d",&n);
  static int a[100000];
  for(int i=0;i<n;i++){
    scanf("%d",a+i);
  }
  int M=a[0],X=a[0];
  for(int i=0;i<n;i++){
    M=min(M,a[i]);
    X=max(X,a[i]);
  }
  bool F;
  if(M<X-1){
    F=0;
  }
  else if(M==X-1){
    int Y=0;
    for(int i=0;i<n;i++){
      if(a[i]==M){
	Y++;
      }
    }
    F=(Y<X&&2*(X-Y)<=n-Y);
  }
  else{
    F=(2*X<=n||X==n-1);
  }
  puts(F?"Yes":"No");
  return 0;
}


Measured memory_bytes: 640
#include<stdio.h>

int main(void)
{
 	int n,  i, count = 0;
 	scanf("%d", &n);
  	for(i = 1; i <= n; i++){
      if (i % 2 != 0) count++;
    }
  	printf("%f", (float)count/(i-1));
  	return (0);
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double dd;
const int N = 2e5+5;
const double eps = 1e-8;

int n,k;
double p[N],ans;

int main(){
  ios::sync_with_stdio(false);
  // freopen("input.txt","r",stdin);
  cin>>n>>k;
  for(int i = 1;i <= n;i++){
    cin>>p[i];
    p[i] = (1.0+p[i])/2.0;
    p[i] += p[i-1];
  }
  for(int i = k;i <= n;i++) ans = max(ans,p[i]-p[i-k]);
  printf("%.8f\n",ans);
  return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <unordered_map>

using namespace std;
 
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL)
#define ll long long
#define pii pair<int, int>
#define PB push_back
#define MP make_pair
#define MT make_tuple
#define tiii tuple<ll, ll, ll>
#define INF 1e18
#define MOD 1000000007


int main(){
	fast;

	int N, M, maxBooks = 0, currBooks = 0;
	ll K, currSum = 0;

	cin >> N >> M >> K;
	vector<ll> A(N), B(M);

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

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

	int ptr1 = 0, ptr2 = 0;
	while (ptr1 < N) {
		if (currSum + A[ptr1] <= K) {
			currSum += A[ptr1++];
			currBooks++;
			maxBooks = max(currBooks, maxBooks);
		} else {
			break;
		}
	}
	ptr1--;
	while (true) {
		// cout << ptr1 << " " << ptr2 << "\n";
		if (ptr2 < M and currSum + B[ptr2] <= K) {
			currSum += B[ptr2++];
			currBooks++;
			maxBooks = max(currBooks, maxBooks);
		} else if (ptr1 >= 0) {
			currSum -= A[ptr1--];
			currBooks--;
		} else {
			break;
		}
	}
	cout << maxBooks << "\n";


	return 0;
}

Measured memory_bytes: 6368
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin>>N;
  if(N==100000){
    cout<<90909<<endl;
  }
  else if(N<=99999&&N>=10000){
    cout<<909+N-9999<<endl;
  }
  else if(N>=1000&&N<=9999){
    cout<<909<<endl;
  }
  else if(N>=100&&N<=999){
    cout<<9+N-99<<endl;
  }
  else if(N>=10&&N<=99){
    cout<<9<<endl;
  }
  else{
    cout<<N<<endl;
  }
}
  


Measured memory_bytes: 256
s = int(input())

p = {s: 0}

count = 1
n = s
while True:
	count += 1
	if n%2 == 0:
		n = n/2
	else:
		n = (3*n) + 1

	if n in p:
		print(count)
		break
	else:
		p[n] = count

Measured memory_bytes: 3188
#include <bits/stdc++.h>
#include <cmath>
using namespace std;
 
#define coutv(v) for (int i = 0; i < (v).size(); ++i) cout << v[i] << ' '; cout << endl;
#define coutvv(v) for (int i = 0; i < (v).size(); ++i) {for (int j = 0; j < (v[i]).size(); ++j) cout << v[i][j] << ' '; cout << endl;}
#define debugv(v) {for (int i = 0; i < (v).size(); ++i) cerr << v[i] << ' '; cerr << endl;}
#define debugvv(v) {for (int i = 0; i < (v).size(); ++i) {for (int j = 0; j < (v[i]).size(); ++j) cerr << v[i][j] << ' '; cerr << endl;}}
#define TC int TESTCASE; cin >> TESTCASE; while (TESTCASE--)
typedef long long ll;






int main() {
	int n;
	cin >> n;
	int cnt = 0;
	int t;
	for (int i = 0; i < n; ++i)
	{
		cin >> t;
		if (i % 2 == 0) {
			if (t % 2 == 1) {
				cnt += 1;
			}
		}
	}
	cout << cnt;
}
 


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

using std::cin;
using std::cout;
using std::endl;
using std::max;
using std::min;
using std::sort;
using std::string;
using std::vector;

using ll = long long int;

int main()
{
	ll N,M;
	cin >> N >> M;

if(N == M)cout <<  "Yes" << endl;
else cout <<  "No" << endl;
	

	return 0;
}


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

int main() {

  int a;
  int b;

  double x;
  double x1;
  double x2;
  
  int x3;
  
  cin >> a;
  cin >> b;

  x = (a + b) / 2.0;
  x1 = x * 10;
  x2 = x1 + 9;  
  x3 = x2;
  
  cout << x3 / 10 << endl;
  
}

Measured memory_bytes: 256
// Enter Source:
#include <bits/stdc++.h>
#define MOD (1000000000+7)

typedef long long int lli;

using namespace std;

lli GCD(lli X, lli Y)
{
	if(X%Y == 0) return Y;
	else return GCD(Y,X%Y);
}

int main()
{
//	lli N;
//	cin >> N;
//	vector<lli> vec, ans;
//	for(lli i = 0; i < N; i++)
//	{
//		lli temp;
//		cin >> temp;
//		vec.push_back(temp);
//	}
//	
//	lli m = vec[1];
//	for(lli j = 1; j < N; j++) m = GCD(max(m,vec[j]),min(m,vec[j])); 
//	for(lli i = 1; i < N; i++)
//	{
//		lli gcd = vec[0];
//		for(int j = 0; j < N; j++)
//		{
//			if(i != j) gcd = GCD(max(gcd,vec[j]),min(gcd,vec[j]));
//			if(gcd < m) break;
//		}
//		if(gcd > m) m= gcd;
//	}
//	cout << m << endl;
	lli N, sum = 0;
	cin >> N;

	for(lli i = 0; i < N; i++)
	{
		lli temp;
		cin >> temp;
		sum += temp;
	}
	cout << sum -N << endl;
	return 0;
}



Measured memory_bytes: 256
import sys

def input():
    return sys.stdin.readline().rstrip()

if __name__ == "__main__":
    a, b = map(int, input().split())

    count = 0
    for i in range(a, b+1):
        if str(i)[0] == str(i)[-1] and str(i)[1] == str(i)[-2]:
            count += 1

    print(count)


Measured memory_bytes: 2940
#include <iostream>
#include <cstring>
#include <vector>
#include <set>
#include <list>
#include <map>
#include <deque>
#include <algorithm>
#include <utility>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<vector<vector<ll>>> vvvll;
#define for1(i,n) for (ll i=0;i<(n);i++)
#define for2(i,m,n) for (ll i=(m);i<(n);i++)
#define for3(i,m,n,d) for (ll i=(m);i<(n);i+=(d))
#define DEBUG 0

struct Item {
    ll a,b,c;
};
void solve()
{
    ll N;
    cin >> N;
    vector<Item> task;
    for1(i,N) {
        Item t;
        cin >> t.a >> t.b;
        t.c = t.b - t.a;
        task.push_back(t);
    }
    sort(task.begin(),task.end(), [](const Item& a, const Item& b) {
        return a.b < b.b;
    });
    //cout << "---" << endl;
    ll tm = 0;
    for (auto i:task) {
        tm += i.a;
        //cout << i.a << " " << i.b << " " << i.c << " " << tm << endl;
        if (tm > i.b) {
            cout << "No" << endl;
            return;
        }
    }
    cout << "Yes" << endl;
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    do {
        solve();
    } while (DEBUG);
}


Measured memory_bytes: 8432
from collections import Counter
s=input()
l=len(s)-2
if l==0:
    if s[0]==s[1]:
        print(1,2)
    else:
        print(-1,-1)
else:
    for i in range(l):
        c=Counter(s[i:i+3]).values()
        if 2 in c or 3 in c:
            print(i+1,i+3)
            break
    else:
        print(-1,-1)

Measured memory_bytes: 3444
#include<bitset>
#include<iostream>
using namespace std;
int a[2009];
int main(){
  ios::sync_with_stdio(0);cin.tie(0);
  int n;cin>>n;
  int sum=0;
  for(int i=1;i<=n;++i){cin>>a[i];sum+=a[i];}
  //now do that bitset  thing
  bitset<4000004>dp={};
  dp.reset();
  dp[0]=1;
    //for(int i=0;i<=sum;++i)cout<<dp[i]<<" &&\n";
  for(int i=1;i<=n;++i){
    dp=dp|(dp<<a[i]);
    // for(int j=sum;j>=a[i];--j){
    //   if(dp[j-a[i]]==1)dp[j]=1;
    // }
  }
  //now find the smallest one greater than sum/2
//  for(int i=0;i<=sum;++i)cout<<dp[i]<<" **\n";
  for(int j=(sum+1)/2;j<=sum;++j)if(dp[j]==1){cout<<j<<"\n";return 0;}
  return 0;
}


Measured memory_bytes: 2304
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

int main(){
  int al = 0, bb = 0, n, a[100];
  
  cin >> n;

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

  sort(a, a + n, greater<int>());

  for(int i = 0; i < n; i++){
    if(i % 2 == 0){
      bb += a[i];
    } else {
      al += a[i];
    }
  }
  cout << bb - al << endl;
}


Measured memory_bytes: 256
#include <stdlib.h>
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
using ll=long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
inline constexpr ll gcd(ll a,ll b){if(!a||!b)return 0;while(b){ll c=b;b=a%b;a=c;}return a;}
inline constexpr ll lcm(ll a,ll b){if(!a||!b)return 0;return a*b/gcd(a,b);}
int main() {
   long long a,b,c;
   cin>>a>>b>>c;
   bool flag = false;
   rep(i,100000000){
      if((b*i+c)%a==0){
         flag=true;
      }
   }
   if(flag){
      cout<<"YES"<<endl;
   }
   else{
      cout<<"NO"<<endl;
   }
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define fs first
#define sc second
#define all(x) (x).begin(), (x).end()
#define sz(x) (int)x.size()
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pii;
typedef vector<pii> vpii;

const int N=110000;
int x[N];

int main() {
    int i, n, ans=0;
    scanf("%d", &n);
    for(int i=0; i<n; i++) scanf("%d", &x[i]);
    for(i=0; i<n; i++) {
        ans++;
        while(i+1<n && x[i+1]==x[i]) i++;
        if(i+1==n) break;
        if(x[i+1]>x[i])
            while(i+1<n && x[i+1]>=x[i]) i++;
        else
            while(i+1<n && x[i+1]<=x[i]) i++;
    }
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <tuple>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <numeric>
#include <string.h>
#define rep(i, x) for (int i = 0; i < (int)(x); i++)
#define repn(i, x) for (int i = 1; i <= (int)(x); i++)
#define repr(i, x) for (int i = ((int)(x) - 1); i >= 0; i--)
#define reprn(i, x) for (int i = ((int)(x)); i > 0; i--)
#define all(x) (x).begin(),(x).end()
typedef long long int64;
using namespace std;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = 1<<29;
const long long INFL = 1e18;
const int MOD = 1000000007;
const int MAX = 210000;
typedef pair<int, int> P;
int di[] = {-1, 0, 1, 0};
int dj[] = {0, -1, 0, 1};

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

//逆元を求める関数
long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++) {
      fac[i] = fac[i-1] * i % MOD;
      inv[i] = MOD - inv[MOD%i] * (MOD/i) % MOD;
      finv[i] = finv[i-1] * inv[i] % MOD;
    }
}
//組み合わせ
long long COM (int n, int k) {
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n-k] % MOD) % MOD;
}

void solve() {
		int h, w; cin >> h >> w;
		vector<string> s(h);
		rep (i, h) {
			cin >> s[i];
		}
		int ans = 0;
		rep (si, h) {
			rep (sj, w) {
				if (s[si][sj] == '#') continue;
				queue<P> q;
				vector<vector<int>> dist(h, vector<int>(w, INF));
				auto update = [&](int i, int j, int x) {
				if (dist[i][j] != INF) return;
					dist[i][j] = x;
					q.push(P(i, j));
				};
				update(si, sj, 0);
				while(!q.empty()) {
					int i = q.front().first;
					int j = q.front().second; q.pop();
					rep (dir, 4) {
						int ni = i + di[dir];
						int nj = j + dj[dir];
						if (ni < 0 || ni >= h || nj < 0 || nj >= w) continue;
						if (s[ni][nj] == '#') continue;
						update(ni, nj, dist[i][j] + 1);
					}
				}
				rep (i, h) {
					rep (j, w) {
						if (dist[i][j] != INF) ans = max(ans, dist[i][j]);
					}
				}
			}
		}
		cout << ans << endl;
    return;
}

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



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

namespace AOJ
{
  class Program
  {
    public static void Main()
    {
      var builder = new System.Text.StringBuilder();
      foreach (var n in Console.ReadLine().Split(' ').Select(s => int.Parse(s)).OrderByDescending(i => i))
        builder.Append(" " + n);
      Console.WriteLine(builder.ToString().Trim());
    }
  }
}

Measured memory_bytes: 20752
N = int(input())
A = list(map(int, input().split()))
B = [0 for i in range(N)]

out = []
for i in range(N, 0, -1):
    a = A[i - 1]
    q = N // i
    count = 0
    
    for j in range(2, q+1):
        if B[i * j - 1] == 1:
            count += 1
    
    r = count % 2
    
    if a == 0:
        if r == 1:
            B[i - 1] = 1
            out.append(i)
        else:
            B[i - 1] = 0
    else:
        if r == 1:
            B[i - 1] = 0
        else:
            B[i - 1] = 1
            out.append(i)
g = sum(B)
print(g)
    
if g != 0:
    print(*out)

Measured memory_bytes: 14120
#include<bits/stdc++.h>
using namespace std;
int m,n;
int a,b;
map<int,int> mp;
int main(){
	
    cin>>m>>n;
    for(int i=1;i<=n;i++)
      {
      	 cin>>a>>b;
      	 mp[a]++,mp[b]++;
      }
    for(int i=1;i<=m;i++)
       cout<<mp[i]<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
const long long INF = numeric_limits<long long>::max();
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    string a,b;
    cin>>a>>b;
    string convb="";
    for(int i=0; i<b.length(); i++){
        if(b[i]!='.'){
            convb+=b[i];
        }
    }
    long long conva= stoll(a);
    long long newb=stoll(convb);
    cout<<conva*newb/100<<endl;
    return 0;
}

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


def solve(S: str, T: str, A: int, B: int, U: str):
    if S == U:
        A -= 1
    if T == U:
        B -= 1
    print(A,B)
    return


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

if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
#include <iostream>

using namespace std;

int main()
{
    int n;
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    int re=0;
    for(int i=0;i<n;i++){
        int m=0;
        for(int i2=i+1;i2<n;i2++){
            if(a[i2-1]>=a[i2]){
                m++;
            }else{
                break;
            }
            i=i2-1;
        }
        re=max(re,m);
    }
    cout<<re<<endl;
    return 0;
}


Measured memory_bytes: 640
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
)

func main() {
	sc := bufio.NewScanner(os.Stdin)
	data := []int64{}
	for sc.Scan() {
		i, _ := strconv.ParseInt(sc.Text(), 10, 64)
		data = append(data, i)
	}
	n := data[0]
	transport := data[1:]

	// データの中で一番小さいものを選ぶ
	smallest := transport[0]
	for i := 1; i < len(transport); i++ {
		if transport[i] < smallest {
			smallest = transport[i]
		}
	}

	total := int64(math.Ceil(float64(n)/float64(smallest))) + int64(len(transport)-1)
	fmt.Println(total)
}


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

using namespace std;

int n, m;
int d[1000];
int c[1000];

int memo[1000][1000];

int rec(int day, int now)
{
	if (now == n) return 0;

	if (day == m) return 1 << 30;

	if (memo[day][now] >= 0) return memo[day][now];

	return memo[day][now] = min(rec(day + 1, now), rec(day + 1, now + 1) + d[now] * c[day]);
}

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

	for (int i = 0; i < n; ++i) cin >> d[i];

	for (int i = 0; i < m; ++i) cin >> c[i];

	memset(memo, -1, sizeof(memo));

	printf("%d\n", rec(0, 0));
}

Measured memory_bytes: 5108
n = int(input())
a = list(map(int, input().split()))

cnt = {}
for i in range(n):
    if a[i] not in cnt:
        cnt[a[i]] = 1
    else:
        cnt[a[i]] += 1

max_a = max(a)
min_ = 10000000000
diameter = max_a + 1
for i in range(diameter):
    tmp = max(max_a - i, i)
    min_ = min(min_, tmp)
    if tmp not in cnt:
        print("Impossible")
        exit()
    if cnt[tmp] == 0:
        print("Impossible")
        exit()
    cnt[tmp] -= 1

for i in cnt:
    if cnt[i] > 0 and i <= min_:
        print("Impossible")
        exit()
print("Possible")

Measured memory_bytes: 3064
<?php
    $num_a = intval(trim(fgets(STDIN)));
    $num = array_map('intval',explode(" ",trim(fgets(STDIN))));
    sort($num);
    $answer =1;
    for($i=0;$i<$num_a;$i++){
        
        $answer = $answer * $num[$i];
        if($answer>pow(10,18)){
            echo "-1";
            exit;
        }
    }
    echo $answer;
?>

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

int i, n, m;
ll j, c, ans, M = 1000000007;
ll inv[10000000], fac[10000000], fiv[10000000];
ll combination(ll k) {
    return fac[n+k-1] * fiv[k] % M * fiv[n-1] % M;
}

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

    inv[1]=fac[1]=fiv[1]=inv[0]=fac[0]=fiv[0]=1;
    for (ll j = 2; j < 10000000; j++) {
        fac[j] = fac[j-1] * j % M; // n!
        inv[j] = inv[M%j] * (M-M/j) % M; // n^-1
        fiv[j] = fiv[j-1] * inv[j] % M; // (n!)^-1
    }

    i = 2;
    ans = 1LL;
    while (m > 1) {
        if (m % i == 0) {
            c = 0LL;
            while (m % i == 0) {
                c++; m /= i;
            }
            ans = ans * combination(c) % M;
        } else {
            i++;
        }
    }

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

Measured memory_bytes: 234752
#include<iostream>
#include<algorithm>
#define ll long long
using namespace std;
ll codx[200000+5],cody[200000+5];
int main(){
    int n;
    cin>>n;
    for(int i=1;i<=n;i++)
        cin>>codx[i]>>cody[i];
    ll min1=0x7f7f7f7f;
    ll min2=0x7f7f7f7f;
    ll max1=-0x7f7f7f7f;
    ll max2=-0x7f7f7f7f;
    for(int i=1;i<=n;i++){
        max1=max(max1,codx[i]+cody[i]);
        max2=max(max2,codx[i]-cody[i]);
        min1=min(min1,codx[i]+cody[i]);
        min2=min(min2,codx[i]-cody[i]);
    }
    cout<<max(max1-min1,max2-min2)<<endl;
    return 0;
}

Measured memory_bytes: 6740
n=gets.chomp.split("").map(&:to_i)
plus_minus=Array.new(n.length-1,"+")

for i in 1..(2**plus_minus.length)
  v=Array.new(n.length-1,"+")
  result=n[0]
  
    for j in 0..v.length-1
       
       
        if i&(1<<j)!=0
            v[j]="-"
       
        end
            
    end

    for k in 0..v.length-1
        if v[k]=='+'
            result+=n[k+1]
        else
           result-=n[k+1]
        end
    end
  
 

 
    if result==7
      puts "#{n[0]}#{v[0]}#{n[1]}#{v[1]}#{n[2]}#{v[2]}#{n[3]}=7"
   exit
 end
 
end

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

using namespace std;

int main(){

  vector<int> p;

  p.push_back(2);

	for(int i=3;i<=1000000;i+=2){
	  int k=0;
	  for(int j=3;j<=sqrt(i);j+=2)
		{
		  if(i%j==0)
			{
			  k=1;
			  break;
			}
		}
	  
	  if(k==0)
		p.push_back(i);
	}
	
  while(1){

	int n;

	cin >> n;

	if(n == 0)
	  break;

	int sum = 0;
	
	for(int i=0;i<n;++i)
	  sum += p[i];

	cout << sum << endl;
	
  }
	
}



Measured memory_bytes: 3256
import * as fs from "fs";

let lines = fs.readFileSync("/dev/stdin", "utf8").trim().split("\n");
let N = Number(lines[0]);

enum Color {
    RED = "red",
    BLUE = "blue"
}

interface Point {
    color: Color;
    x: number;
    y: number;
}

let points: Point[] = new Array();

for(let i=0; i<2*N; i++) {
    let [x, y] = lines[i+1].split(" ").map(Number);
    if (i < N) {
        points.push({color: Color.RED, x: x, y: y});
    } else {
        points.push({color: Color.BLUE, x: x, y: y});
    }
}

points.sort((a, b) => a.x-b.x);

let reds: Point[] = [];
let pairs: number = 0;

for(let point of points) {
    if (point.color == Color.RED) {
        reds.push(point);
    } else {
        let tallestIndex: number | null = null;
        for(let i=0; i<reds.length; i++) {
            if (reds[i].y < point.y) {
                if (tallestIndex == null) {
                    tallestIndex = i;
                } else if (reds[tallestIndex].y < reds[i].y) {
                    tallestIndex = i;
                }
            }
        }
        if (tallestIndex != null) {
            reds.splice(tallestIndex, 1);
            pairs += 1;
        }
    }
}

console.log(pairs);


Measured memory_bytes: 29744
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long h = sc.nextLong();
        long k = sc.nextLong();
        long num = h / k;
        h -= k * num;
        while (true) {
            if (k / 2 < h) {
                h = Math.abs(h - k);
            } else {
                System.out.println(h);
                System.exit(0);
            }
        }
    }
}

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

int main(){
  int n,count=0;
  cin >> n;
  string s,t;
  cin >> s >>t;
  r(i,n){
    if(s.substr(i,n-i)==t.substr(0,n-i)){
      count=n-i;
      break;
    }
  }
  cout << n+n-count<<endl;
}

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

void sort(vector<long> &data){
    for(int i=0; i<3; i++){
        for(int j=2; j>i; j--){
            if(data.at(j) < data.at(j-1)){
                long buf = data.at(j-1);
                data.at(j-1) = data.at(j);
                data.at(j) = buf;
            }
        }
    }
}


int main(){
    vector<long> data(3);
    for(int i=0; i<3; i++){
        cin >> data.at(i);
    }
    sort(data);
    for(int i=0; i<3; i++){
        if(i != 0) cout << " ";
        cout << data.at(i);
    }
    cout << endl;
}


Measured memory_bytes: 3084
#include<bits//stdc++.h>
using namespace std;
int main()
{
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    if(a+b==c+d)
    cout<<"Balanced"<<endl;
    else if(a+b>c+d)
    cout<<"Left"<<endl;
    else cout<<"Right"<<endl;
}


Measured memory_bytes: 3624
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Scanner;

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

	LinkedHashMap<String, Integer> map = new LinkedHashMap<String, Integer>(
	  16, 0.75f, true);
	while (in.hasNext()) {
	 String str = in.next();
	 if (map.containsKey(str)) {
		map.put(str, map.get(str) + 1);
	 } else {
		map.put(str, 1);
	 }
	}
	String longest = "";
	String maxCount = "";
	Integer countInt = Integer.valueOf(0);
	for (Map.Entry<String, Integer> entry : map.entrySet()) {
	 String key = entry.getKey();
	 Integer value = entry.getValue();
	 if (key.length() > longest.length()) {
		longest = key;
	 }
	 if (value.compareTo(countInt) > 0) {
		maxCount = key;
		countInt = value;
	 }
	}
	String result = new StringBuilder()
	  .append(maxCount)
	  .append(' ')
	  .append(longest)
	  .toString();
	System.out.println(result);
 }
}

Measured memory_bytes: 12000
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>

#define ll long long
#define pb push_back
#define sz(x) (int)(x).size()
#define mp make_pair
#define f first
#define s second
#define all(x) x.begin(), x.end()

using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;

template<class T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>; ///find_by_order(),order_of_key()
template<class T1, class T2> ostream& operator<<(ostream& os, const pair<T1,T2>& a) { os << '{' << a.f << ", " << a.s << '}'; return os; }
template<class T> ostream& operator<<(ostream& os, const vector<T>& a) {
	os << '{';
	for(int i=0;i<sz(a);i++)
	{
		if(i>0&&i<sz(a)-1)
			os << ", ";
		os << a[i];
	}
	os << '}';
    return os;
}
const int mod=1e9+7;
int add(int a,int b)
{
    a+=b;
    if(a>=mod)
        a-=mod;
    return a;
}
int mul(int a,int b)
{
    return ((ll)a*b)%mod;
}
struct Matrix{
    int n;
    vector<vector<int> > mat;
    Matrix(int nn)
    {
        n=nn;
        mat.resize(n,vector<int>(n));
    }
    void make_one()
    {
        for(int i=0;i<n;i++)
            for(int j=0;j<n;j++)
                mat[i][j]=(i==j);
    }
};
Matrix mul(Matrix a,Matrix b)
{
    int n=a.n;
    Matrix sol(n);
    for(int i=0; i<n; i++)
    {
        for(int j=0; j<n; j++)
        {
            int ans=0;
            for(int k=0;k<n;k++)
            {
                ans=add(ans,mul(a.mat[i][k],b.mat[k][j]));
            }
            sol.mat[i][j]=ans;
        }
    }
    return sol;
}
Matrix pwrmod(Matrix x,ll k)
{
    Matrix ans(x.n);
    ans.make_one();
    for(;k;k>>=1,x=mul(x,x))
        if(k&1)
            ans=mul(ans,x);
    return ans;
}
int main()
{
    int n;
    ll k;
    scanf("%i %lld",&n,&k);
    Matrix m(n);
    for(int i=0;i<n;i++)
        for(int j=0;j<n;j++)
            scanf("%i",&m.mat[i][j]);
    m=pwrmod(m,k);
    int ans=0;
    for(int i=0;i<n;i++)
        for(int j=0;j<n;j++)
            ans=add(ans,m.mat[i][j]);
    printf("%i\n",ans);
    return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		String T = sc.next();
		sc.close();
		char[] ch1 = S.toCharArray();
		char[] ch2 = T.toCharArray();
		List<Character> list1 = new ArrayList<>();
		List<Character> list2 = new ArrayList<>();
		for(int i = 0;i < ch1.length;i++) {
			list1.add(ch1[i]);
		}
		for(int i = 0;i < ch2.length;i++) {
			list2.add(ch2[i]);
		}
		Collections.sort(list1);
		Collections.sort(list2,Comparator.reverseOrder());
		String S2 = "";
		String T2 = "";
		for(int i = 0;i < list1.size();i++) {
			S2 += list1.get(i);
		}
		for(int i = 0;i < list2.size();i++) {
			T2 += list2.get(i);
		}
		if(S2.compareTo(T2) < 0) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
	}
}

Measured memory_bytes: 23124
from sys import stdin


def main():
    A = [int(x) for x in stdin.readline().rstrip().split()]
    spam = [(0, 1, 2), (0, 2, 1), (1, 0, 2), (1, 2, 0), (2, 0, 1), (2, 1, 0)]
    result = []
    for x in spam:
        f, s, t = x
        result.append(abs(A[s] - A[f]) + abs(A[t] - A[s]))
    print(min(result))


if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
#include<iostream>
#include <algorithm>

using namespace std;

string S[100];

int main() {

	int N,L;

	//入力
	cin >> N >> L;

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

	//並べ替え
	sort(S, S + N);

	//出力
	for (int i = 0; i < N; i++) {
		cout << S[i];
	}

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=1;i<=n;i++)
#define drep(i,n) for(int i=n;i>=0;i--)
#define MAX 100000
#define ll long long
#define dmp make_pair
#define dpb push_back
#define P pair<int,int>
#define fi first
#define se second
using namespace std;
//__gcd(a,b), __builtin_popcount(a);
const int INF = 2147483647;
#define B 100

int bucket[MAX/B][B];
int udata[MAX/B], data[MAX/B];
void update(int a, int b, int x){
	int f1 = 1, f2 = 1;
	while(a <= b && a%B != 0){
		if(f1 && udata[a/B] != -1){
			for(int i = 0;i < B;i++)bucket[a/B][i] = udata[a/B];
			f1 = 0;udata[a/B] = -1;
		}
		bucket[a/B][a%B] = x;
		a++;
	}
	while(a <= b && b%B != B-1){
		if(f2 && udata[b/B] != -1){
			for(int i = 0;i < B;i++)bucket[b/B][i] = udata[b/B];
			f2 = 0;udata[b/B] = -1;
		}
		bucket[b/B][b%B] = x;
		b--;
	}
	while(a < b){
		udata[a/B] = x;
		a += B;
	}
}

int find(int x){
	if(udata[x/B] != -1){
		for(int i = 0;i < B;i++)bucket[x/B][i] = udata[x/B];
		udata[x/B] = -1;
	}
	return bucket[x/B][x%B];
}

int main(){
	int n, q, c, s, t, x, ans;
	scanf("%d%d", &n, &q);
	fill(udata, udata+MAX/B, -1);
	fill(data, data+MAX/B, INF);
	fill((int*)bucket, (int*)(bucket+MAX/B), INF);
	while(q--){
		scanf("%d", &c);
		if(!c){
			scanf("%d%d%d", &s, &t, &x);
			update(s, t, x);
		}else{
			scanf("%d", &x);
			ans = find(x);
			printf("%d\n", ans);
		}
	}
	//rep(i,n)printf("%d ", bucket[0][i]);
	return 0;
}

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

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"

using namespace std;
using ll = long long;

const ll MOD = 1000000007LL; // = 10^9 + 7
const double PI = 3.14159265358979;

void solve()
{
  int d;
  cin >> d;
  string ans;
  if (d == 25) ans = "Christmas";
  if (d == 24) ans = "Christmas Eve";
  if (d == 23) ans = "Christmas Eve Eve";
  if (d == 22) ans = "Christmas Eve Eve Eve";
  cout << ans;
}

int main()
{
  fastio;
  solve();

  return 0;
}

Measured memory_bytes: 3592
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mod 1000000007
int main(){
  int a[3];
  
    cin >> a[0] >> a[1] >> a[2];
  sort(a, a+3);

  cout << a[2]*10+a[1]+a[0] << endl;
}


Measured memory_bytes: 256
def count_sum_digit(i)
  sum = 0

  while i > 0
    sum += i % 10
    i /= 10
  end
  sum
end

(n,a,b) = gets.chomp.split(' ').map(&:to_i)
sum = 0

(1..n).each do |i|
  c = count_sum_digit(i)
  if a <= c && c <= b
    sum += i
  end
end

puts sum


Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int h,w;
  cin >> h >> w;
  vector<string> S(h);
  for(int i=0;i<h;i++){
    cin >> S.at(i);
  }
  for(int i= 0;i<h;i++){
    cout << S.at(i)<<endl;
    cout << S.at(i)<<endl;
  }
}


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

using namespace std;

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

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int A, B; cin >> A >> B;

	if ((A * B) % 2 == 0){
		cout << "No" << endl;
	}else{
		cout << "Yes" << endl;
	} // end if
 
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int a[100005],b[100005],aa[100005],bb[100005];
int A,B,m;
int ans;
int main(){
	cin>>A>>B>>m;
	for(int i=1;i<=A;++i){
		cin>>a[i];
		aa[i]=a[i];
	}
	sort(aa+1,aa+A+1);
	for(int i=1;i<=B;++i){
		cin>>b[i];
		bb[i]=b[i];
	}
	sort(bb+1,bb+B+1);
	ans=aa[1]+bb[1];
	for(int i=1;i<=m;++i){
		int x,y,c;
		cin>>x>>y>>c;
		ans=min(ans,a[x]+b[y]-c);
	}
	cout<<ans<<'\n';
	return 0;
}

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

int INF = 100100101;
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int a,b,h,m;
  cin >> a >> b >> h >> m;
  ld kakudo = M_PI * 2 *(
  	(ld)h / 12.0 + ((ld)m / 60.0) / 12.0 - (ld)m/60.0);
  ld ans = (ld)(a*a+b*b)-(ld)(2*a*b) * (cos(kakudo));
  cout << fixed << setprecision(20) <<  sqrt(ans) << endl;
  return 0;
}

Measured memory_bytes: 4180
def calc(a, b, c)
  if a + b == c then
    return (2 * b) + a
  elsif a + b < c then
    return (2 * b) + (a + 1)
  else # a + b > c
    return b + c
  end
end

def main(argv)
  (a, b, c) = gets.chomp.split(' ').map(&:to_i)
  
  puts calc(a, b, c).to_s
end

if self.to_s == 'main' then
  main(ARGV)
end

Measured memory_bytes: 1788