akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

  int main(){
    int N,M;
    cin >> N >> M;
    string A;
    string B;
    string S;
    for (int i=0;i<N;i++){
      cin >> S;
      A+=S;
    }
    for (int i=0;i<M;i++){
      cin >> S;
      B+=S;
    }
    for (int x=0;x<=N-M;x++){
      for (int y=0;y<=N-M;y++){
        int f=0;
        for (int z=0;z<M;z++){
          if (A.substr(x+N*(y+z),M)!=B.substr(z*M,M)){
            break;
          }
          f+=1;
          if (f==M){
            cout << "Yes" << endl;
            return 0;
          }
        }
      }
    }
    cout << "No" <<endl;
      return 0;
  }

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include<math.h>
#define ll long long
#define fi first
#define se second
#define ld long double
#define mod 1000000007
using namespace std;
ll n,m;
vector<ll>vis(100005,-1),adj[100005],dis(100005,0);
void dfs(ll i)
{
    vis[i]=1;
    ll j;
    for(j=0;j<adj[i].size();j++)
    {
        if(vis[adj[i][j]]==-1)
        {
                        dfs(adj[i][j]);

         }
               dis[i]=max(dis[i],dis[adj[i][j]]+1);
     }
}
int main()
{
     ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
cin>>n>>m;
ll a,b,i,j;
while(m--)
{
    cin>>a>>b;
    adj[a].push_back(b);
}
for(i=1;i<=n;i++)
{
    if(vis[i]==-1)
        dfs(i);
}
ll m=0;
for(i=1;i<=n;i++)
{
    if(dis[i]>m)
        m=dis[i];
}
cout<<m;
}



Measured memory_bytes: 9344
#include <stdio.h>

int main() {
    int a,b,c,k,j;
    scanf("%d %d %d",&a,&b,&c);
    k = a;
    a = b;
    b = k;
    j = c;
    c = a;
    a = j;
    printf("%d %d %d",a,b,c);
    return 0;
}

Measured memory_bytes: 2096
#include<bits/stdc++.h>
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
#define pb push_back
int dy[]={0, 0, 1, -1, 1, 1, -1, -1};
int dx[]={1, -1, 0, 0, 1, -1, -1, 1};

#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define mp make_pair
#define fi first
#define sc second
char s[3][100];
int main(){
	cin >> s[0];
	cin >> s[1];
	cin >> s[2];

	char x = 'a' - 'A';

	printf("%c%c%c\n",s[0][0]-x,s[1][0]-x,s[2][0]-x);
	return 0;
}


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

int N, ans;
long long A[200];
  
int iwa() {
  bool B = true;
  for (int i = 0; i < N; i++) {
    if (A[i] % 2 != 0) {
      B = false;
    }
  }
  if (B) {
    for (int i = 0; i < N; i++) {
      A[i] /= 2;
    }
    ans++;
    iwa();
  }
  else {
    return ans;
  }
}

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

Measured memory_bytes: 256
N = int(input())
a = list(map(int, input().split()))
min_val = None
stacks = 0

for i in range(-100, 101):
    cost_stack = 0
    for j in range(len(a)):
        cost_stack += (a[j] - i) ** 2
        
    if min_val == None:
        min_val = cost_stack
    elif cost_stack < min_val:
        min_val = cost_stack

print(min_val)


Measured memory_bytes: 9188
#include<iostream>
#include<string>
#include<math.h>
#include<algorithm>
using namespace std;
int main(){
    int n,m,a[200000],b[200000],C[1000][1000];
    cin>>n>>m;
    for(int i=0;i<n;i++) cin>>a[i];
    for(int j=0;j<m;j++) cin>>b[j];
    long long ans=1,INF=1000000007;
    long long x=0,y=0;
    sort(a,a+n,greater<int>());
    sort(b,b+m,greater<int>());
    if(a[0]!=n*m||b[0]!=n*m) ans=0;
    for(int i=0;i<n-1;i++) if(a[i]==a[i+1]) ans=0;
    for(int i=0;i<m-1;i++) if(b[i]==b[i+1]) ans=0; // here
    for(int i=n*m;i>0;i--){
        if(x+1 < n && i==a[x+1]) x=x+1; // warn
        if(y+1 < m && i==b[y+1]) y=y+1; // warn
        if(i==a[x]&&i==b[y]) ans=ans;
        else if(i==a[x]) ans=(ans*(y+1))%INF;
        else if(i==b[y]) ans=(ans*(x+1))%INF;
        else ans=(ans*((x+1)*(y+1)-(n*m-i)))%INF;
    }
    cout<<ans;
}


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

using namespace std;
int n;
string s;
int dp[4005][3];
//0r 1g 2b
int main() {
	cin>>n>>s;
	for(int i=s.size()-1; i>=0; i--) {
		for(int j=0; j<3; j++)
			dp[i][j]=dp[i+1][j];
		if(s[i]=='R') dp[i][0]++;
		if(s[i]=='G') dp[i][1]++;
		if(s[i]=='B') dp[i][2]++;
	}
	long long ans=0;
	for(int i=0; i<n; i++)
		for(int j=i+1; j<n; j++) {
			if(s[i]=='R'&&s[j]=='G') {
				ans+=dp[j+1][2];
				if(j+j-i>=n) continue;
				if(s[j+(j-i)]=='B')
					ans--;
			}
			if(s[i]=='R'&&s[j]=='B') {
				ans+=dp[j+1][1];
				if(j+j-i>=n) continue;
				if(s[j+(j-i)]=='G')
					ans--;
			}
			if(s[i]=='B'&&s[j]=='R') {
				ans+=dp[j+1][1];
				if(j+j-i>=n) continue;
				if(s[j+(j-i)]=='G')
					ans--;
			}
			if(s[i]=='B'&&s[j]=='G') {
				ans+=dp[j+1][0];
				if(j+j-i>=n) continue;
				if(s[j+(j-i)]=='R')
					ans--;
			}
			if(s[i]=='G'&&s[j]=='B') {
				ans+=dp[j+1][0];
				if(j+j-i>=n) continue;
				if(s[j+(j-i)]=='R')
					ans--;
			}
			if(s[i]=='G'&&s[j]=='R') {
				ans+=dp[j+1][2];
				if(j+j-i>=n) continue;
				if(s[j+(j-i)]=='B')
					ans--;
			}
		}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 3668
#include<bits/stdc++.h>
using namespace std;
#define sc(a) scanf("%d", &a)
#define sc2(a,b) scanf("%d%d", &a, &b)
#define sc3(a,b,c) scanf("%d%d%d", &a, &b, &c)
#define scs(s) scanf("%s", s)
#define pri(x) printf("%d\n", x)
#define mp make_pair
#define pb push_back
#define BUFF ios::sync_with_stdio(false);
#define imprime(v) for(int X=0;X<v.size();X++) cout<<v[X]<<" "; cout<<endl;
#define grid(v) for(int X=0;X<v.size();X++){for(int Y=0;Y<v[X].size();Y++) cout<<v[X][Y]<<" ";cout<<endl;}
#define endl "\n"
const int INF= 0x3f3f3f3f;
const long double pi= acos(-1);
typedef long long int ll;
typedef long double ld;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector< vector< int > > vvi;
typedef vector< vector< ii > > vvii;
const int MOD=1e9+7;
const ll LINF = 0x3f3f3f3f3f3f3f3f;

int main()
{
    BUFF;
    string s;
    cin>>s;
    set<char> st;
    for(int i=0;i<s.size();i++) st.insert(s[i]);
    bool pau=false;
    if(st.find('N')!=st.end() and st.find('S')==st.end()) pau=true;
    if(st.find('S')!=st.end() and st.find('N')==st.end()) pau=true;
    if(st.find('E')!=st.end() and st.find('W')==st.end()) pau=true;
    if(st.find('W')!=st.end() and st.find('E')==st.end()) pau=true;
    if(pau)
    {
        cout<<"No"<<endl;
    }
    else cout<<"Yes"<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long int
using namespace __gnu_pbds;
typedef tree<pair<ll,pair<ll,ll> >, null_type, less<pair<ll,pair<ll,ll> > >, rb_tree_tag, tree_order_statistics_node_update>ordered_set;
#define me BOSS
#define bug() cout<<"AIkahne aise"<<endl
#define PI acos(-1)
/* Precode Start Here *\
     Sieve
void sieve()
{
    for(ll i=3; i<=2000; i+=2)
    {
        for(ll j=i*i; j<=4000000; j+=i)
            A[j]=1;
    }
    v.push_back(2);
    for(ll i=3; i<=4000000; i+=2)
        if(A[i]==0)
            v.push_back(i);
}

     Power Function Modulo P

ll modPow(ll a, ll x, ll p) {
    //calculates a^x mod p in logarithmic time.
    long res = 1;
    while(x > 0) {
        if( x % 2 != 0) {
            res = (res * a) % p;
        }
        a = (a * a) % p;
        x /= 2;
    }
    return res;
}


   factorial

ll fact(ll n)
{
    ll ans=1;
    for(ll i=1;i<=n;i++)
    {
        ans=(ans*i)%mod;
    }
    return ans;
}
     Calculating nCr using Fermats law Theorem

ll modInverse(ll a, ll p) {
    //calculates the modular multiplicative of a mod m.
    //(assuming p is prime).
    return modPow(a, p-2, p);
}


ll modBinomial(ll n, ll k, ll p) {
// calculates C(n,k) mod p (assuming p is prime).

    ll numerator = 1; // n * (n-1) * ... * (n-k+1)
    for (ll i=0; i<k; i++) {
        numerator = (numerator * (n-i) ) % p;
    }

    ll denominator = 1; // k!
    for (ll i=1; i<=k; i++) {
        denominator = (denominator * i) % p;
    }

    // numerator / denominator mod p.
    return ( numerator* modInverse(denominator,p) ) % p;
}
     num of divisor and euler totient

ll phi[1000001],mark[1000001],divi[1000001];;
void divisorPhi(ll n)
{
    for(int i=1;i<=n;i++)
        phi[i]=i;
    for(int i=2;i<=n;i++)
    {
        if(!mark[i])
        {
            for(int j=i;j<=n;j+=i)
            {
                mark[j]=1;
                phi[j]*=(1-1/(double)i);
            }
        }
    }
    for(ll i=1;i<=n;i++)
    {
        for(ll j=i;j<=n;j+=i)
            divi[j]++;
    }
}
/* Precode Ends */
#define mod 1000000007
ll A[5000001],B[5000001];
vector<ll>v;
map<ll,ll>myMap;
set<ll>mySet;
vector<pair<ll,ll> >vp;
priority_queue<ll> pq;
priority_queue<ll, vector<ll>, std::greater<ll> > first;
ll po(ll a,ll n)
{
  ll ans=1;
  for(int i=1;i<=n;i++)
       ans*=a;
    return ans;
}

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

 ll n,k;
 cin>>n>>k;
 for(int i=0;i<n;i++)
 {
     cin>>A[i];
 }
 ll l=0,r=n-1,f=0,ans=1;
 sort(A,A+n);
 if(k%2)
 {
     ans=A[r];
     r--;
     k--;
     if(ans<0)
        f=1;
 }
 while(k!=0)
 {
     ll one=A[r]*A[r-1];
     ll two=A[l]*A[l+1];
     if(f)
     {
             ans=one%mod*ans%mod;
             r-=2;
     }
     else
     {
         if(one>=two)
         {
             ans=one%mod*ans%mod;
             r-=2;
         }
         else
         {
             ans=two%mod*ans%mod;
             l+=2;
         }
     }
     k-=2;
 }
 cout<<(ans+mod)%mod<<endl;
 return 0;
}



Measured memory_bytes: 5188
#include<bits/stdc++.h>
#define MOD 998244353
using namespace std;
#define ll long long int
#define gc getchar_unlocked
#define pc putchar_unlocked
const long long int size=1000003;
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#ifdef _WIN32
// no getchar_unlocked on Windows so call _getchar_nolock
inline int gc() { return getchar(); }
inline int pc(ll n) { return putchar(n);}
#endif
// //ll f[size];
// vector<bool>isPrime(size,1);
// //bool isPrime[size];
// ll p[size];
// void fact()
// {f[0] = 1;ll i = 1;while(i<size){f[i] = f[i-1]*i;f[i] = f[i]%MOD;i++;}}
// //use when mod is prime no
// ll fast_pow(ll a,ll n)
// {ll result = 1;while(n>0){if(n&1){result = result*a;result = result%MOD;}a = (a*a)   %MOD;n/= 2;}return result;}
// ll inv(ll x)
// {return fast_pow(x,MOD-2);}
// void sieve()
// {//for(ll i = 0; i <= size;++i) {isPrime[i] = true;}
// isPrime[0] = false;isPrime[1] = false;
// for(ll i = 2; i * i <= size; ++i) {if(isPrime[i] == true) {
// for(ll j = i * i; j <= size ;j += i)isPrime[j] = false;}}

//  p[1]=0;p[0]=0;
//     for(ll i=2;i<=size-1;i++)
//     {
//         if(isPrime[i])
//         p[i]=i+p[i-1];
//         else
//         p[i]=p[i-1];
//     }
// }
// vector<ll> factorize(ll n) {vector<ll> res;
// for (ll i = 2; i * i <= n; ++i) {while (n % i == 0) {res.push_back(i);n /= i;}}
// if (n != 1) {res.push_back(n);}return res;}
ll phi(ll n)
{
	ll result = n;
	for (ll p = 2; p * p <= n; ++p) {
		if (n % p == 0) {
			while (n % p == 0)
				n /= p;
			result -= result / p;
		}
	}
	if (n > 1)
		result -= result / n;
	return result;
}
inline void in(ll &x)
{
	register char c = gc();
	while(c<'0' || c>'9')
		c = gc();

	x=0;
	while(c>='0' && c<='9')
	{
		x = 10 * x + c - 48;
		c = gc();
	}

}
inline void out( ll &b)
{
	char snum[40];
	ll i=0;
	do
	{
		snum[i++]=b%10+'0';
		b=b/10;
	}while(b);
	i=i-1;

	while (i>=0)
	{
		pc(snum[i--]);
	}
   pc('\n');
}
int main()
{
    ll n,k;in(n);in(k);
    ll arr[k+1];
    vector<ll>v;
    ll sum=0;
    in(arr[1]);
    for(ll i=2;i<=k;i++)
    {
        in(arr[i]);
       v.push_back(abs(arr[i-1]-arr[i]));
    }
    v.push_back(abs(n-arr[k]+arr[1]));
    sort(v.begin(),v.end());
    ll ans=0;
    for(ll i=0;i<k-1;i++)
    {
       ans+=v[i];
     // cout<<v[i]<<" ";
    }
 cout<<ans<<endl;

}


Measured memory_bytes: 3444
#include<iostream>
#include<cstdio>
using namespace std;
int n,m;
int dp[1<<16][16];
int sum[1<<16];
int dis[16][16];
int all;
int main()
{
	scanf("%d%d",&n,&m);
	for(int i=1;i<=m;i++)
	{
		int x,y,z;
		scanf("%d%d%d",&x,&y,&z);
		x--;y--;
		dis[x][y]=dis[y][x]=z;
		all+=z;
	}
	for(int i=1;i<(1<<n);i++)
	{
		for(int j=0;j<n;j++)
		{
			if(i>>j&1)
			{
				for(int k=j+1;k<n;k++)
				{
					if(i>>k&1)
					{
						sum[i]+=dis[j][k];
					}
				}
			}
		}
	}
	for(int i=0;i<(1<<n);i++)
	{
		for(int j=0;j<n;j++)dp[i][j]=-1;
	}
	dp[1][0]=0;
	for(int i=1;i<(1<<n);i++)
	{
		for(int j=0;j<n;j++)
		{
			if(dp[i][j]==-1)continue;
			int st=((1<<n)-1)^i;
			if(dis[j][n-1])
			{
				dp[(1<<n)-1][n-1]=max(dp[(1<<n)-1][n-1],dp[i][j]+sum[st]+dis[j][n-1]);
			}
			for(int k=(st-1)&st;k;k=(k-1)&st)
			{
				if(k>>(n-1)&1)continue;
				dp[i|k][j]=max(dp[i|k][j],dp[i][j]+sum[(1<<j)|k]);
			}
			for(int k=0;k<n;k++)
			{
				if(k!=n-1 && !(i>>k&1) && dis[j][k])
				{
					dp[i|(1<<k)][k]=max(dp[i|(1<<k)][k],dp[i][j]+dis[j][k]);
				}
			}
		}
	}
	printf("%d",all-dp[(1<<n)-1][n-1]);
	return 0;
} 

Measured memory_bytes: 4224
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A,B,T;
  cin >> A >> B >> T;
  int bis = 0;
  
  T -= A;
  while(T + 0.5 >= 0){
    T -= A;
    bis += B;
  }
  cout << bis << endl;
}

Measured memory_bytes: 256
/*
  Contest 112
  B - Time Limit Exceeded
  Rakesh Kumar --> 27/09/2020
 */

#include <bits/stdc++.h>

int main() {
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(0); std::cout.tie(0);

    int n = 0, t = 0;
    std::cin >> n >> t;
    int min = 1e+8;
    while (n--) {
        int paisa = 0, samay = 0;
        std::cin >> paisa >> samay;
        if (samay <= t)
            min = std::min(min, paisa);
    }
    if (min == 1e+8)
        std::cout << "TLE" << std::endl;
    else
        std::cout << min << std::endl;

    return 0;
}


Measured memory_bytes: 3608
#include <bits/stdc++.h>
#include <iostream>
#include <string>
#include <string.h>
#include <ctype.h>
#include <algorithm>

using namespace std;

int main() {
  string s,t;
  cin >> s >> t;
  int c = 0;
  for(int i = 0; i < s.size(); i++)
    if(s[i] != t[i]) c++;
  
  cout << c << endl;
}

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

struct Fast {Fast(){std::cin.tie(0);ios::sync_with_stdio(false);}} fast;

typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef queue<int> qi;
typedef stack<int> si;
typedef deque<int> dqi;

#define reps(i, a, b) for (int i = a; i < b; ++i)
#define rep(i, n) reps(i, 0, n)
#define REPS(i, a, b) reps(i, a, b)
#define REP(i, n) rep(i, n)
#define deps(i, a, b) for (int i = a; i >= b; --i)
#define dep(i, n) deps(i, n, 0)
#define DEPS(i, a, b) deps(i, a, b)
#define DEP(i, n) dep(i, n)

#define pf push_front
#define pb push_back
#define mp make_pair
#define fst first
#define FST fst
#define sec second
#define SEC sec
#define sz(obj) ((int)(obj).size())
#define all(v) (v).begin(), (v).end()
#define ALL(v) all(v)

const int INF = 999999999;
const int MOD = 1e9 + 7;
const int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};

inline bool inside(int y, int x, int H, int W) {return y >= 0 && x >= 0 && y < H && x < W;}
inline int in() {int x; std::cin >> x; return x;}
template <typename T>
void print(std::vector<T>& v, char c = ' ') {
  REP(i, v.size()) {
    if (i != 0) std::cout << c;
    std::cout << v[i];
  }
  std::cout << endl;
}
template <typename T> void print(T x) { std::cout << x << '\n'; }

long long int l[100005];
signed main()
{
  int n;
  long long k, cnt = 0;
  cin >> n >> k;
  rep(i, n) {
    int a, b;
    cin >> a >> b;
    l[a] += b;
  }
  int s;
  for (s = 0; s < 100001; s++) {
    cnt += l[s];
    if (k <= cnt) break;
  }
  print(s);

  return (0);
}

Measured memory_bytes: 1024
import java.util.*;

class Main{
  public static void main(String args[]){
    Scanner scan = new Scanner(System.in);
    int h = scan.nextInt();
    int w = scan.nextInt();
    int a[][] = new int[h][w];
    int ks = 0;
    int[] x = new int[h*w];
    int[] y = new int[h*w];
    int[] x1 = new int[h*w];
    int[] y1 = new int[h*w];
    for(int i = 0;i < h;i++){
      for(int j = 0; j < w;j++){
        a[i][j] = scan.nextInt();
      }
    }
    for(int i = 0;i < h;i++){
      for(int j = 0;j < w;j++){
        if(a[i][j]%2 == 1&& a[i][j] != 0){
          if(j != w-1 ){
            if(a[i][j+1]%2 == 1){
            a[i][j] -=1;
            a[i][j+1] += 1;
            x[ks] = j;
            y[ks] = i;
            x1[ks] = j+1;
            y1[ks] = i;
            ks++;
            continue;
          }
          }
          if(i != h-1 ){
            if(a[i+1][j]%2 == 1){
            a[i][j] -=1;
            a[i+1][j] += 1;
            x[ks] = j;
            y[ks] = i;
            x1[ks] = j;
            y1[ks] = i+1;
            ks++;
            continue;
          }
          }
          if(j != w-1){
          a[i][j] -=1;
          a[i][j+1] += 1;
          x[ks] = j;
          y[ks] = i;
          x1[ks] = j+1;
          y1[ks] = i;
          ks++;
          continue;
        }
        if(i != h-1 ){
          a[i][j] -=1;
          a[i+1][j] += 1;
          x[ks] = j;
          y[ks] = i;
          x1[ks] = j;
          y1[ks] = i+1;
          ks++;
          continue;
        }
      }
      }
    }
    System.out.println(ks);
    for(int i =0 ;i <ks ;i++){
      System.out.println((y[i]+1)+" "+(x[i]+1)+" "+(y1[i]+1)+" "+(x1[i]+1));
    }
  }
}

Measured memory_bytes: 112092
#include<cstdio>
#include<cmath>
#include<algorithm>
#define MAX 25
#define NIL -1
using namespace std;

typedef struct{
	int parent, left, right;
} Node;

Node T[MAX];

int findRoot(void){
	int u = 0;
	while(T[u].parent != NIL)
		u = T[u].parent;
	return u;
}

void preParse(int u){
	if(u == NIL)
		return;
	printf(" %d", u);
	preParse(T[u].left);
	preParse(T[u].right);
}

void inParse(int u){
	if(u == NIL)
		return;
	inParse(T[u].left);
	printf(" %d", u);
	inParse(T[u].right);
}

void postParse(int u){
	if(u == NIL)
		return;
	postParse(T[u].left);
	postParse(T[u].right);
	printf(" %d", u);
}

int main(void){
	int n, i, id, left, right, root;
	scanf("%d", &n);
	for(i=0;i<n;i++)
		T[i].parent = NIL;
	for(i = 0;i < n;i++){
		scanf("%d %d %d", &id, &left, &right);
		T[id].left = left;
		T[id].right = right;
		if(left != NIL)
			T[left].parent = id;
		if(right != NIL)
			T[right].parent = id;
	}
	root = findRoot();
	printf("Preorder\n");
	preParse(root);
	printf("\nInorder\n");
	inParse(root);
	printf("\nPostorder\n");
	postParse(root);
	printf("\n");
	return 0;
}

Measured memory_bytes: 2660
#include<iostream>

using namespace std;


int main() {
	int N, Y;
	cin >> N >> Y;

	for (int x = 0; x <= N; x++) {
		for (int y = 0; y <= N - x; y++) {
			//x, y, zを合わせるとNとなる
			int z = N - x - y;
			int total = 10000 * x + 5000 * y + 1000 * z;
			if (total == Y) {
				printf("%d %d %d\n", x, y, z);
				return 0;
			}
		}
	}
	printf("-1 -1 -1\n");

	return 0;
}

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

int h, w = 5;
int t[10][5];

int checkAndDelete(int x, int y){
  int tx = x;
  while(tx < w && t[y][tx] == t[y][x]) tx++;
  if(tx - x < 3) return 0;

  int res = 0;
  for(int j = x; j < tx; j++){
    res += t[y][j];
    t[y][j] = 0;
  }
  return res;
}

void burokkuOtosu(){
  for(int i = h - 1; i >= 0; i--){
    for(int j = 0; j < w; j++){
      if(t[i][j] == 0) continue;

      int ti;
      for(ti = i + 1; ti < h; ti++){
        if(t[ti][j] != 0) break;
      }
      ti--;
      if(i != ti){
        t[ti][j] = t[i][j];
        t[i][j] = 0;
      }
    }
  }
}

void solve(){
  int res = 0;

  while(true){
    bool changeFlg = false;

    for(int i = h - 1; i >= 0; i--){
      for(int j = 0; j < 3; j++){
        if(t[i][j] == 0) continue;

        int tmp = checkAndDelete(j, i);
        res += tmp;
        if(tmp){
          changeFlg = true;
          break;
        }
      }
    }

    burokkuOtosu();

    if(!changeFlg) break;
  }

  cout << res << endl;
}

int main(){
  while(cin >> h, h){
    for(int i = 0; i < h; i++){
      for(int j = 0; j < w; j++){
        cin >> t[i][j];
      }
    }
    solve();
  }
}

Measured memory_bytes: 1160
n, k = map(int, input().split())
d = set(map(str, input().split()))
amt = list(str(n))
if not len(d & set(amt)):
    print(n)
else:
    n1 = n
    while True:
        n1 += 1
        if len(set(list(str(n1))) & d) == 0:
            print(n1)
            break


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

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

    vector<int> c(n - 1), s(n - 1), f(n - 1);
    rep(i, n - 1)
    {
        cin >> c[i] >> s[i] >> f[i];
    }

    rep(i, n - 1)
    {
        int t = 0;
        for (int j = i; j < n - 1; j++)
        {
            if (t <= s[j])
                t = s[j];
            else
                t = ((t - s[j] + f[j] - 1) / f[j]) * f[j] + s[j];
            t += c[j];
        }
        cout << t << endl;
    }
    cout << 0 << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
const double eps = 1e-10;
const int MOD = 1000000007;
const int INF = 1000000000;
const ll LINF = 1ll<<50;
template<typename T>
void printv(const vector<T>& s) {
  for(int i=0;i<(int)(s.size());++i) {
    cout << s[i];
    if(i == (int)(s.size())-1) cout << endl;
    else cout << " ";
  }
}
int main() {
  cin.tie(0);
  cout << fixed << setprecision(10);
  int n; cin >> n;
  vector<int> a(n+1);
  for(int i=1;i<=n;++i) {
    cin >> a[i];
  }
  vector<int> b(n+1, 0);
  vector<int> ans;
  for(int i=n;i>0;--i) {
    int cnt = 0;
    for(int j=i+i;j<=n;j += i) {
      cnt += b[j];
    }
    if(a[i] != cnt % 2) {
      b[i] = 1;
      ans.push_back(i);
    }
  }
  cout << (int)(ans.size()) << endl;
  printv(ans);
}


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define maxn 200005

ll fastpower (ll b , ll p){
    ll k= p%2 ? b : 1 ;
    return p==0 ? 1 : k*(fastpower(b*b,p/2));
}

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    ll t=1;
    //cin>>t;
    while(t--){
        ll n;
        cin>>n;
        ll a[n];
        for(int i=0;i<n;i++){
            cin>>a[i];
        }
        ll mx=a[0],sum=0;
        for(int i=1;i<n;i++){
            mx=max(mx,a[i]);
            sum+=(mx-a[i]);
        }
        cout<<sum;
    }
}

Measured memory_bytes: 5172
#include<bits/stdc++.h>
using namespace std;
const int maxn=1e6+5;
inline int read(){
	char c=getchar();int t=0,f=1;
	while((!isdigit(c))&&(c!=EOF)){if(c=='-')f=-1;c=getchar();}
	while((isdigit(c))&&(c!=EOF)){t=(t<<3)+(t<<1)+(c^48);c=getchar();}
	return t*f;
}
char c[maxn],s[maxn];
int n,m,l[maxn],r[maxn],ton[3];
int mp[3];
void change(int a,int b){
	swap(mp[a],mp[b]);
	for(int i=1;i<=n;i++){
		if(s[i]==a)s[i]=b;
		else if(s[i]==b)s[i]=a;
	}
	swap(ton[a],ton[b]);
}
inline void del(int i){
	r[l[i]]=r[i];
	l[r[i]]=l[i];
	ton[s[i]]--;
}
signed main(){
	mp[1]=1;mp[2]=2;
	scanf("%s",c+1);
	m=strlen(c+1);
	for(int i=1;i<=m;i++){
		if(c[i]!=c[i-1]){
			s[++n]=c[i]-'A';
		}
	}
	s[0]=-1;s[n+1]=-2;
	for(int i=1;i<=n;i++)l[i]=i-1,r[i]=i+1;
	r[0]=1;
	l[n+1]=n;
	for(int i=1;i<=n;i++)ton[s[i]]++;
	int mn=0;
	if(ton[0]>ton[1])mn=1;
	if(ton[mn]>ton[2])mn=2;
	if(mn){
		change(0,mn);
	}
	if(ton[1]<ton[2]){
		change(1,2);
	}
	int t=ton[1]-ton[2];
	for(int i=1;i<=n&&t;i=r[i]){
		if((s[i]==1)&&(s[l[i]]!=s[r[i]])){
			del(i);t--;
		}
	}
	for(int i=r[0];i<=n&&t;i=r[i]){
		if((s[i]==1)&&(s[l[i]]==0)&&(s[r[i]]==0)){
			del(r[i]),del(i),t--;
		}
	}
	t=ton[2]-ton[0];
	for(int i=r[0];i<=n&&t;i=r[i]){
		if((s[i]!=0)&&(s[r[i]]!=0)&&(s[l[i]]!=s[r[r[i]]])){
			del(r[i]);del(i);t--;
		}
	}
	for(int i=r[0];i<=n;i=r[i]){
		putchar('A'+mp[s[i]]);
	}
	return 0;
}


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

using namespace std;

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

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

    int ans = 0;
    for (int d = 1; d <= 9; d++) {
        ll x = d;
        if (x > N)continue;

        int sum = d;
        while (x * 10 + 9 <= N) {
            x = x * 10 + 9;
            sum += 9;
        }
        ans = max(ans, sum);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll int64_t
#define ALL(a)  (a).begin(),(a).end()
 
const ll mod = 1000000007;
const ll LINF = 1e13;
const ll LLINF = 1e18;
const ll ALPHABET = 26;
 
template <class T>
void Swap(T& r, T& l) {
  T tmp = r;
  r = l;
  l = tmp;
}
 
template<typename T>
istream& operator >> (istream& is, vector<T>& vec) {
  for (T& x : vec) is >> x; //for(int i=0; i<vec.size(); i++) is >> x[i]; とかでもいい
  return is;
}


int main(){
    // ll N,S,K;
    ll a,b,c;
    cin >> a ;

    double ans;
    double a1 = (double)(a/2);
    double a2 = (double)(a/2) + (double)(a%2);



    ans = a2/a;
    cout << fixed << setprecision(10) << ans <<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)

int main() {
    int n;
    cin >> n;
    double v[n],max1 = 0,ans=0;
    rep(i,n) cin >> v[i];
    sort(v,v+n);
    ans = (v[0] + v[1]) / pow(2.0, n - 1);
    for (int i = 2; i < n; i++) {
    ans += v[i] / pow(2.0, n - i);
  }
  cout << ans << endl;
   


}






Measured memory_bytes: 256
import sys
def input(): return sys.stdin.readline().strip()

def main():
    n,m=map(int,input().split())
    kk=[]
    sss=[]
    for _ in range(m):
        k,*ss=map(int,input().split())
        kk.append(k)
        sss.append(ss)
    pp=list(map(int,input().split()))
    c=0
    for i in range(2**n):
        if all(sum((i >> (s-1))&1 for s in ss)&1==p for p,ss in zip(pp,sss)):
            c += 1
    print(c)

main()

Measured memory_bytes: 3188
#include <iostream>
using namespace std;
int main(int argc, char* argv[])
{
	int N;
	cin>>N;
	int i;
	int Sum=0;
	int Max=0;
	int p;
	for (i=0;i<N;i++){
		cin>>p;
		if (Max<p){
			Max=p;
		}
		Sum+=p;
	}
	cout<<Sum-Max/2<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <cmath>
#include <iostream>

template <typename T>
struct Vector2D {        // Literal Class
    T x, y;
    explicit constexpr Vector2D() : x(0), y(0) {}
    explicit constexpr Vector2D(T _x, T _y) : x(_x), y(_y) {}
    const Vector2D operator + (const Vector2D& p) const { return Vector2D(x + p.x, y + p.y);}
    const Vector2D operator - (const Vector2D& p) const { return Vector2D(x - p.x, y - p.y);}
    Vector2D& operator *= (const T& p) { x *= p, y *= p; return *this;}
    Vector2D& operator += (const T& p) { x += p, y += p; return *this;}
    Vector2D& operator -= (const T& p) { x -= p, y -= p; return *this;}
    Vector2D& operator /= (const T& p) { x /= p; y /= p; return *this;}
    Vector2D& operator += (const Vector2D& p) { x += p.x, y += p.y; return *this;}
    Vector2D& operator -= (const Vector2D& p) { x -= p.x, y -= p.y; return *this;}
    const T dot(const Vector2D& q) { return x * q.x + y * q.y;}
    const T norm() { return sqrt(x * x + y * y);}
    friend std::ostream& operator<<(std::ostream& os, const Vector2D& p) { os << "(" << p.x << ", " << p.y << ")"; return os;}
};

#include <vector>
#include <iomanip>
#include <functional>
#include <tuple>
#include <algorithm>
using namespace std;
using Pt = Vector2D<double>;
const double INF = 1e18;
const double EPS = 1.0e-11;
bool eq(double a, double b) { return fabs(a - b) <= EPS;}
int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n_;
    cin >> n_;
    vector<Pt> points(n_); // Points are 1 indexed
    for(auto& p : points)
        cin >> p.x >> p.y;
    // x??§?¨???§?????????
    sort(points.begin(), points.end(), [](const Pt& l, const Pt& r) {
            return eq(l.x, r.x) ? l.y < r.y : l.x < r.x;
        });
    function<tuple<double, int, int>(int, int)> closest = [&](int id, int n) {
        if(n <= 1) return make_tuple(INF, 0, 0);
        int m = n / 2;
        double boundX = points[id + m].x;
        tuple<double, int, int> res = min(closest(id, m), closest(id + m, n - m));
        auto fit = points.begin() + id;
        inplace_merge(fit, fit + m, fit + n, [](const Pt& l, const Pt& r) {
                return  eq(l.y, r.y) ? l.x < r.x : l.y < r.y;
            });
        vector<int> memo;
        for(int i = id; i < id + n; ++i) {
            if(fabs(boundX - points[i].x) >= get<0>(res)) continue;
            for(int j = -1 + memo.size(); j >= 0; --j) {
                Pt p = points[i] - points[memo[j]];
                if(p.y >= get<0>(res)) break;
                res = min(res, make_tuple(p.norm(), i, memo[j]));
            }
            memo.emplace_back(i);
        }
        return res;
    };
    cout << fixed << setprecision(10) << get<0>(closest(0, n_)) << endl;
    return 0;
}

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

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

using namespace std;

template<class T>
vector<T> make_vec(size_t a){
    return vector<T>(a);
}
template<class T, class... Ts>
auto make_vec(size_t a, Ts... ts){
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}

int main(){
    int n; cin >> n;
    vector<ll> a(n);
    vector<ll> b(n);
    vector<ll> c(n);
    rep(i, n) {
        cin >> a[i];
    }
    rep(i, n) {
        cin >> b[i];
    }
    rep(i, n) {
        cin >> c[i];
    }
    ll ans = 0;

    sort(a.begin(), a.end());
    sort(b.begin(), b.end());
    sort(c.begin(), c.end());

    for(int i = 0 ; i < n; i++) {
        auto it = upper_bound(c.begin(), c.end(), b[i]);
        ll cnum = c.end() - it;
        auto it2 = lower_bound(a.begin(), a.end(), b[i]);
        ll anum = it2 - a.begin();
        if(cnum > 0 && anum > 0){
            // cout << cnum << " " << anum << endl;
            ans += cnum*anum;
            // cout << ans << endl;
        }
    }

    cout << ans << endl;
}


Measured memory_bytes: 2560
#include<iostream>
#include <algorithm>
#include <cmath>
#include <set>
#include<map>
#include<cstring>
#include<iomanip>
#include <string>
#include <vector>	
#include<unordered_map>
#include<unordered_set>
using namespace std;


typedef long long unsigned llu;
typedef long double ld;
#define ll long long
#define PI 3.14159265358979323846
#define For(i, a, b) for (int i = a, sz = (int)b; i < sz; i++)
#define rFor(i, a, b, c) for (int i = (a); i >= (b); i -= (c))
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define fill(a, b) memset(a, b, sizeof(a))
#define IO ios_base::sync_with_stdio(false), cin.tie(0),cout.tie(0)
const int mod = 1000000007;
const ll inf = 1000000000009;
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b) { return a*b/gcd(a,b);}

//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdoutn

int main()
{
	IO;
	map<string,int>m;
	int n;
	cin>>n;
	while(n--)
	{
		string s;
		cin>>s;
		m[s]++;
	}
	cout<<"AC "<<"x "<<m["AC"]<<'\n'<<"WA "<<"x "<<m["WA"]<<'\n'<<"TLE "<<"x "<<m["TLE"]<<'\n'<<"RE "<<"x "<<m["RE"]<<'\n';
	//system("pause");
	return 0;
}

Measured memory_bytes: 3652
import sys

num=input()
L=len(num)
count=0

if L == 1 :
    print(0)
    sys.exit()

for i in range(L):
    flg=False
    if num[i] == num[i+1]:
        count+=1
        flg=True

    if i+1 == L-1 :
        break
    
    if flg == True:
        if num[i] == '0':
            num_CHG = num[:i+1] + '1'+ num[i+2:]
            num = num_CHG
        else:
            num_CHG = num[:i+1] + '0'+ num[i+2:]
            num = num_CHG
print(count)


Measured memory_bytes: 3456
open System

// prelude
let readStr () = stdin.ReadLine()

let read f () = readStr() |> f
let reads f () = readStr().Split() |> Array.map f

let pair = function
| [|a; b|] -> (a, b)
| _ -> failwith "owatta"

let triple = function
| [|a; b; c|] -> (a, b, c)
| _ -> failwith "owatta"

let readPair f g () =
  let (a,b) = readStr().Split() |> pair
  (f a, g b)

let readTriple f g h () =
  let (a,b,c) = readStr().Split() |> triple
  (f a, g b, h c)

let inc n = n + 1
let dec n = n - 1

let inline flip f a b = f b a
let rec fix f = fun x -> (f (fix f)) x

module Option =
  let getOr defaultValue = function
  | Some x -> x
  | None -> defaultValue

module Array =
  let modify (arr: _ []) i f =
    arr.[i] <- f arr.[i]

module Array2D =
  let modify (arr: _ [,]) i j f =
    arr.[i, j] <- f arr.[i, j]

// start
let K = read int ()
let S = read string ()

if S.Length <= K then S else S.[0..K-1] + "..."
|> printfn "%s"

Measured memory_bytes: 29696
class Main{public static void main(String[]g)throws Exception{double y=1e5;int n=0,i;for(;(i=System.in.read())>32;n=n*10+i-48);for(i=1000;n-->0;y+=y%i>0?i-y%i:0)y*=1.05;System.out.println((int)y);}}


Measured memory_bytes: 23916
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<cctype>
#include<climits>
#include<string>
#include<bitset>
#include<cfloat>
#include<iomanip>
#include<numeric>

using namespace std;
using ll =  long long;
using pint =  pair<int,int>;
using vint = vector<int>;
using vvint = vector<vint>;
using vpint = vector<pint>;
#define repi(i,start,end) for(int (i)=(start),TemPNuM=(int)(end);(i)<TemPNuM;++(i))
#define rep(i,end) repi((i),0,(end))
#define rfor(x,v) for(auto& (x) : (v))
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define fsort(v,lambda) sort(all((v)),(lambda))
#define vin(v) rep(i,(v).size())cin >> (v)[i];
#define vpin(v) rep(i,(v).size())cin>>v[i].first>>v[i].second
//#define int long long
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template<class T>void println(T a){if(cout.precision()!=12)cout<<setprecision(12);cout<<a<<endl;}
//lambda: [](int x, int y){return x<y;}

signed main(void) {
    int n; cin >> n;
    vvint csf(n - 1, vint(3, 0));
    rep(i, n - 1) {
        rep(j, 3) {
            cin >> csf[i][j];
        }
    }
    rep(i, n - 1) {
        int t = csf[i][1];
        repi(j, i + 1, n - 1) {
            t += csf[j - 1][0];
            if(t < csf[j][1]) t = csf[j][1];
            else {
                int time = csf[j][1];
                while(time < t) time += csf[j][2];
                t = time;
            }
        }
        t += csf.back()[0];
        cout << t << endl;
    }
    cout << 0 << endl;

    return 0;
}


Measured memory_bytes: 256
fun main(args: Array<String>) {
    val s = readLine()!!.toString()
    val a = arrayOf<Char>('A','C','G','T')
    var result = 0
    for(i in s.indices){
        var len = 0
        for(j in i until s.length){
            if(!a.contains(s[j]))break
            len++
        }
        if(result < len) result = len
    }
    println(result)
}


Measured memory_bytes: 36132
// inputに入力データ全体が入る
function Main(input) {

  var inp = input.split(" ");
  var N = parseInt(inp[0]);
  var A = parseInt(inp[1]);
  var B = parseInt(inp[2]);

  var ans = 0;
  for (var i = 1; i <= N; i++) {
    var sum = 0;
    var j = String(i);
    var k = 0;
    var l = 0;
    var m = 0;
    var n = 0;

    k = parseInt(j.substr(0, 1));

    if (i >= 10) {
      l = parseInt(j.substr(1, 1));
    }

    if (i >= 100) {
      m = parseInt(j.substr(2, 1));
    }

    if (i >= 1000) {
      n = parseInt(j.substr(3, 1));
    }
    
    sum = k + l + m + n;
    if (sum >= A && sum <= B) {
      ans += i;
    }
  }

  console.log('%d', ans);

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



Measured memory_bytes: 8612
import java.util.*;public class Main {public static void main(String[]h){Scanner s=new Scanner(System.in);while(s.hasNext()){int n=s.nextInt();if(n==0){break;}int[] a=new int[n];for(int i=0;i<n;i++){a[i]=s.nextInt();}Arrays.sort(a);int o=0;for(int i=1;i<n-1;i++){o+=a[i];}System.out.println(o/(n-2));}}}

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

using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i,n) for(int i=n; i>-1; --i)
#define ALL(a) (a).begin(),(a).end()
#define FILL(a,n,x); REP(i,(n)){ (a)[i]=(x); }
#define CINA(a,n); REP(i,(n)){ cin >> (a)[i]; }
#define FILL2(a,n,m,x); REP(i,(n)){ REP(j,(m)){(a)[i][j]=(x);} }
#define CINA2(a,n,m); REP(i,(n)){ REP(j,(m)){cin >> (a)[i][j];} }
#define Liny "Yes\n"
#define Linn "No\n"
#define LINY "YES\n"
#define LINN "NO\n"

//cout << setfill('0') << right << setw(4) << 12; // "0012"
int keta(ll x){ if(x<10){return 1;} else{return keta(x/10) + 1;}}
int keta_wa(ll x){ if(x<10){return x;} else{return keta_wa(x/10) + x%10;} }
int ctoi(char c){ return ( (c>='0' && c<='9')? c - '0': 0 );}
int __stoi(string s){ return atoi(s.c_str()); }
ll sum(ll a[],ll N){ return accumulate(a,a+N,0LL);}
ll gcd(ll a,ll b){if(a<b)swap(a,b); return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){if(a<b){swap(a,b);} return a/gcd(a,b)*b;}
template<class T> void chmax(T& a, T b){ if(a<b){a=b;} }
template<class T> void chmin(T& a, T b){ if(a>b){a=b;} }
template<class T> bool isIn(T a,vector<T> v){ for(T x:v){ if(a==x){return true;}} return false;}
string strReplace(string s,string target, string replacement){
    if (!target.empty()) {
      std::string::size_type pos = 0;
      while ((pos = s.find(target, pos)) != std::string::npos) {
        s.replace(pos, target.length(), replacement);
        pos += replacement.length();
      }
    }
    return s;
}
const ll MOD = 1e9+7;
#define pii pair<int,int>
#define pll pair<ll,ll>
#define MP make_pair

bool DEBUG = 0;
template<class T> void dprint(T s){
  if(DEBUG){ cout << s << "\n"; }
}

int main(int argc, char *argv[]){
  if(argc>1 && argv[1][0]=='D'){ DEBUG = 1;}

  ll X,K,D; cin>>X>>K>>D;
  X = abs(X);
  ll need = X/D;
  ll ans;
  if(need>=K){
    ans = X-D*K;
  }else{
    X -= need*D;
    ll amari = K-need;
    if(amari%2==0){
      ans = abs(X);
    }else{
      ans = abs(D-X);
    }
  }
  cout << ans << "\n";
}

Measured memory_bytes: 3636
#include<stdio.h>
signed main(){
  int a,b;
  scanf("%d %d",&a,&b);
  if(a>=13){
    printf("%d\n",b);
  }
  if(a>=6 && a<13){
    printf("%d\n",b/2);
  }
  if(a<=5){
    printf("%d\n",0);
  }
  return(0);
}

Measured memory_bytes: 128
a, b, c = map(int, input().split())
t = 0

if a == b == c:
  if a % 2 == 1:
    print(t)
  else:
    print(-1)

else:
  while (a % 2 + b % 2 + c % 2) == 0:
    a, b, c = (b + c) / 2, (a + c) / 2, (a + b) / 2
    t += 1

  print(t)

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

int main(){
  vector<int> s(5);
  for(int i=0;i<5;i++){
    cin >> s[i];
  }
  int min=10;
  int ans=0;
  for(int i=0;i<5;i++){
    
    if(s[i]%10!=0){
      if(min>s[i]%10){
      min = s[i]%10;
    }
      s[i] = (s[i]/10+1)*10;
    }
    ans+=s[i];
  }
  cout << ans + min -10 << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main () {
  long N, M;
  string S, T;
  cin >> N >> M >> S >> T;
  long L = (N * M) / __gcd(N, M);
  long npl = 0, mpl = 0, flag = 1;
  while(npl != N && mpl != M){
    if(npl * L / N == mpl * L / M){
      if(S.at(npl) != T.at(mpl)){
        flag = 0;
        break;
      }
      npl++;
      mpl++;
    } else if(npl * L / N > mpl * L / M){
      mpl++;
    } else {
      npl++;
    }
  }
  cout << (flag?L:-1) << endl;
  return 0;
}

Measured memory_bytes: 512
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<string>
#include<cstring>
#include<cmath>
#include<ctime>
#include<algorithm>
#include<utility>
#include<stack>
#include<queue>
#include<vector>
#include<set>
#include<map>
#define EPS 1e-9
#define PI acos(-1.0)
#define INF 0x3f3f3f3f
#define LL long long
const int MOD = 1E9+7;
const int N = 100000+5;
const int dx[] = {0,0,-1,1,-1,-1,1,1};
const int dy[] = {-1,1,0,0,-1,1,-1,1};
using namespace std;
char str[N];
int bucket[27];
int main() {
    scanf("%s",str);
    int len=strlen(str);

    int num=len-2;
    if(str[0]!=str[len-1]){
        if(num%2)
            printf("First\n");
        else
            printf("Second\n");
    }
    else{
        if(num%2)
            printf("Second\n");
        else
            printf("First\n");
    }

    return 0;
}


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

constexpr int inf = 0x3f3f3f3f;
constexpr ll linf = 0x3f3f3f3f3f3f3f3fLL;

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

    string s; cin >> s;
    if (s[0] == s[1] && s[1] == s[2]) cout << "No" << endl;
    else cout << "Yes" << endl;
    return 0;
}

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

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

  int c = 1;
  string ans = "NG";
  while (k * c <= b) {
    if (a <= k * c) {
      ans = "OK";
      break;
    }
    else
    {
      c += 1;
    }
  }

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


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

int main(){
  string s, t;
  cin >> s >> t;
  int ls = s.length(), lt = t.length();
  vector<vector<int>> cs(ls+1,vector<int>(2,0));
  vector<vector<int>> ct(lt+1,vector<int>(2,0));
  rep(i,ls) {
    if(s[i] == 'A') {
      cs[i+1][0] = cs[i][0] + 1;
      cs[i+1][1] = cs[i][1];
    } else {
      cs[i+1][0] = cs[i][0];
      cs[i+1][1] = cs[i][1] + 1;
    }
  }
  rep(i,lt) {
    if(t[i] == 'A') {
      ct[i+1][0] = ct[i][0] + 1;
      ct[i+1][1] = ct[i][1];
    } else {
      ct[i+1][0] = ct[i][0];
      ct[i+1][1] = ct[i][1] + 1;
    }
  }    
  int q;
  cin >> q;
  vector<bool> ans(q,true);
  rep(i,q) {
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    int x = cs[b][0] - cs[a-1][0] + (cs[b][1] - cs[a-1][1])*2;
    int y = ct[d][0] - ct[c-1][0] + (ct[d][1] - ct[c-1][1])*2;
    if((x-y) % 3) ans[i] = false;
  }
  for(auto x: ans) cout << (x ? "YES" : "NO") << endl;
  return 0;
}

Measured memory_bytes: 11776
#include<iostream>
using namespace std;
int tf[7][7]={
	{},
	{0,0,3,5,2,4,0},
	{0,4,0,1,6,0,3},
	{0,2,6,0,0,1,5},
	{0,5,1,0,0,6,2},
	{0,3,0,6,1,0,4},
	{0,0,4,2,5,3,0}
};
int h[222][222],top[222][222];
int n;
main()
{
	while(cin>>n,n)
	{
		for(int i=0;i<222;i++)for(int j=0;j<222;j++)h[i][j]=top[i][j]=0;
		for(;n--;)
		{
			int t,f;cin>>t>>f;
			int x=100,y=100;
			bool flag=1;
			while(flag)
			{
				flag=0;
				int idx=-1,idy=-1,ma=3,nt,nf;
				if(h[x+1][y]<h[x][y]&&ma<f)
				{
					ma=f;
					idx=x+1;
					idy=y;
					nt=7-f;
					nf=t;
				}
				if(h[x][y+1]<h[x][y]&&ma<tf[t][f])
				{
					ma=tf[t][f];
					idx=x;
					idy=y+1;
					nt=7-tf[t][f];
					nf=f;
				}
				if(h[x-1][y]<h[x][y]&&ma<7-f)
				{
					ma=7-f;
					idx=x-1;
					idy=y;
					nt=f;
					nf=7-t;
				}
				if(h[x][y-1]<h[x][y]&&ma<7-tf[t][f])
				{
					ma=7-tf[t][f];
					idx=x;
					idy=y-1;
					nt=tf[t][f];
					nf=f;
				}
				flag=idx>=0&&idy>=0;
				if(flag)
				{
					x=idx;
					y=idy;
					t=nt;
					f=nf;
				}
			}
			h[x][y]++;
			top[x][y]=t;
		}
		int c[7]={};
		for(int i=0;i<222;i++)for(int j=0;j<222;j++)c[top[i][j]]++;
		for(int i=1;i<7;i++)cout<<c[i]<<(i==6?"\n":" ");
	}
}



Measured memory_bytes: 3468
# -*- coding: utf-8 -*-
import sys 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N, K = map(int, readline().split())
A = list(map(int,readline().split()))
for i in range(N-K):
    if A[i] >= A[i+K]:
        print('No')
    else:
        print('Yes')

Measured memory_bytes: 29280
using System;
using System.Linq;
using System.Text.RegularExpressions;
using System.Collections.Generic;
using static program.Input;
using static program.MyMath;
using static System.Console;

namespace program {
  class Program {
    static string alp = "abcdefghijklmnopqrstuvwxyz";
    static string Alp = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
    static void Main()
    {
      var a = ScanIntArray();
      WriteLine(a[0]==a[1] ? "Yes" : "No");
    }
  }
  
  static class Input {
    static public int ScanInt() { return int.Parse(Console.ReadLine()); }
    static public uint ScanUint() { return uint.Parse(Console.ReadLine()); }
    static public double ScanDouble() { return double.Parse(Console.ReadLine()); }
    static public long ScanLong() { return long.Parse(Console.ReadLine()); }
    static public ulong ScanUlong() { return ulong.Parse(Console.ReadLine()); }
    static public int[] ScanIntArray() { return Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray(); }
    static public uint[] ScanUintArray() { return Console.ReadLine().Split().Select(x => uint.Parse(x)).ToArray(); }
    static public double[] ScanDoubleArray() { return Console.ReadLine().Split().Select(x => double.Parse(x)).ToArray(); }
    static public long[] ScanLongArray() { return Console.ReadLine().Split().Select(x => long.Parse(x)).ToArray(); }
    static public ulong[] ScanUlongArray() { return Console.ReadLine().Split().Select(x => ulong.Parse(x)).ToArray(); }

    static public string ScanStr() { return Console.ReadLine(); }
    static public string[] ScanStrArray() { return ScanStr().Split(); }
    static public string RegaxReplace(this string arg1, string pattern, string replacement)
    {
      return Regex.Replace(arg1, pattern, replacement);
    }
  }
  
  static class MyMath {
    public static bool isPrime(this int p){
      if(p<=1) return false;
      for(int i=2; i*i<=p; i++)
        if(p%i==0) return false;
      return true;
    }
    public static bool isPrime(this long p){
      if(p<=1) return false;
      for(long i=2; i*i<=p; i++)
        if(p%i==0) return false;
      return true;
    }
    public static int GCD(int a, int b) {
        Func<int, int, int> gcd = null;
        gcd = (x, y) => y == 0 ? x : gcd(y, x % y);
        return a > b ? gcd(a, b) : gcd(b, a);
    }
    public static long GCD(long a, long b) {
        Func<long, long, long> gcd = null;
        gcd = (x, y) => y == 0 ? x : gcd(y, x % y);
        return a > b ? gcd(a, b) : gcd(b, a);
    }
    public static ulong extGCD(ulong a, ulong b, ref ulong x, ref ulong y) {
      if(b==0) {
        x=1; 
        y=0;
        return a;
      }
      var d = extGCD(b, a%b, ref y, ref x);
      y -= a/b *x;
      return d;
    }
    public static int LCM(int a, int b) { return a * b / GCD(a, b); }
    public static long LCM(long a, long b) { return a * b / GCD(a, b); }
  }
}


Measured memory_bytes: 13396
#include<iostream>

using namespace std;

int main()
{
 int N,X,T;
  cin>>N>>X>>T;
  
  int quotient = N/X;
  int time;
  if(N%X==0)
  {
    time=quotient*T;
  }
  else
  {
    time=(quotient+1)*T;
  }
  cout<<time<<endl;
  return 0;
  
  
}

Measured memory_bytes: 3628
n = int(input())
ans = []
now = n
cou = 1
if n == 0:
    print(0)
    exit()
while True:
    if now == 0:
        break
    if now % (2**cou) == 2**(cou-1):
        ans.append(1)
        now -= (-2)**(cou-1)
    elif now % (2**cou) == 0:
        ans.append(0)
    cou += 1

for i in reversed(range(len(ans))):
    print(ans[i],end="")
print()

Measured memory_bytes: 3064
import java.util.Arrays;
import java.util.Scanner;


class Main {

	public static void main(String[] a){
		
		int inputCount = 5;
		
		Scanner in = new Scanner(System.in);
		String input = in.nextLine();
		String[] numArray = input.split(" ");
		
		
		int[] temp = new int [inputCount];
		for (int i=0; i<inputCount; i++){
			temp[i] = Integer.parseInt(numArray[i]);
		}

		Arrays.sort(temp);
		
		/*for (int i=(inputCount-1); i>-1; i--){
			System.out.print(temp[i]);
			if (i != 0){
				System.out.print(" ");
			}
		}*/
		
		System.out.println(temp[4] + " " +
						   temp[3] + " " +
						   temp[2] + " " +
						   temp[1] + " " +
						   temp[0]);
	}
}

Measured memory_bytes: 26040