akhauriyash/Code-Regression huggingface dataset:
#include <iostream> // cin, cout, cerr, clog
#include <algorithm> // minmax, sort, swap
#include <numeric> // iota, gcd, lcm 
#include <cstdio> // printf, scanf
#include <climits> // INT_MIN, LLONG_MIN
#include <cmath> // long, trig, pow
#include <vector> // vectors
#include <string> // string
#include <queue> // queue
#include <stack> // stack
#include <map> // key-value pairs sorted by keys
#include <unordered_map> // hashed by keys
#include <iomanip> //cout<<setprecision(n)
#define rep(i,n) for(int i = 0; i < n; i++)

typedef long long ll; // at least int64 > 9*10^18
typedef unsigned long long ull; // at least uint64

int main() {
  int r,d,x;
  std::cin >> r >> d >> x;
  rep(i,10) {
    x = r*x-d;
    std::cout << x << std::endl;
  }
  
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int solve(int n, int array[])
{
	if(n <= 0) return 0;
	
	int rot = array[0], tmp, min = n+1;
	if(rot == 0) return solve(n-1, array+1);
	
	for(int i = 1; i <= n; i++){
		for(int j = 0; j < i; j++) array[j] = (array[j] - rot + 10) % 10;
		tmp = solve(n-1, array+1);
		for(int j = 0; j < i; j++) array[j] = (array[j] + rot) % 10;
		
		if(tmp < min) min = tmp;
	}
	return min + 1;
}


int main(void)
{
	int n;
	int init[15], goal[15];
	char init_str[15], goal_str[15];
	
	while(1){
		scanf("%d", &n);
		if(n == 0) break;
		
		scanf("%s %s", init_str, goal_str);
		
		for(int i = 0; i < n; i++){
			init[i] = init_str[i] - '0';
			goal[i] = goal_str[i] - '0';
		}
		
		for(int i = 0; i < n; i++){
			goal[i] = (goal[i] - init[i] + 10) % 10;
		}
		
		int min = solve(n, goal);
		printf("%d\n", min);
	}
	
	return 0;
}

Measured memory_bytes: 2628
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ff first
#define ss second
#define pb push_back
#define mp makepair
#define deb(x) cout<<x<<"\n";
#define deB(x,y) cout<<x<<" "<<y<<"\n";
#define Deb(x,y,z) cout<<x<<" "<<y<<" "<<z<<"\n" 
#define YES cout<<"YES\n";
#define Yes cout<<"Yes\n";
#define NO cout<<"NO\n";
#define No cout<<"No\n";
#define all(v) (v).begin(),(v).end()
int main()
{
	ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
  //freopen("input.txt", "r", stdin);
  //freopen("output.txt", "w", stdout);
  ll k,a,b;
  cin>>k>>a>>b;
  if(b/k-(a-1)/k)
  	deb("OK")
  else
  	deb("NG");
}

Measured memory_bytes: 3632
n=int(input())
s=[input() for i in range(n)]
p,m=[],[]
res=0
for i in range(n):
    lr=0
    min_=0
    for c in s[i]:
        if c=='(':
            lr+=1
        else:
            lr-=1
        min_=min(min_,lr)
    if lr>=0:
        p.append([lr,min_])
    else:
        m.append([lr,min_])
    res+=lr
if res!=0:
    print('No')
    exit()
p.sort(key=lambda x:x[1],reverse=True)
m.sort(key=lambda x:(x[0]-x[1]),reverse=True)
cum=0
for x,y in p:
    if cum+y<0:
        print('No')
        exit()
    cum+=x
for x,y in m:
    if cum+y<0:
        print('No')
        exit()
    cum+=x
print('Yes')

Measured memory_bytes: 256352
//#define _CRT_SECURE_NO_WARNINGS
#include "bits/stdc++.h"

#define rep(i,n) for(ll (i)=0;(i)<(ll)(n);(i)++)
#define all(x) (x).begin(),(x).end()
#define MOD 1000000007LL
#define INF (1LL<<60LL)
//#define int long long
#define MAX_N (100001)
typedef long long ll;

using namespace std;



signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int a, b;
	cin >> a >> b;
	int ans = 0;
	rep(i, 10000) {
		ans = i;
		if ((int)(ans * 0.08) == a && (int)(ans * 0.1) == b) break;
	}
	if (ans == 10000 - 1) ans = -1;
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
int GCD(int a,int b){return b?GCD(b,a%b):a;}
int LCM(int a,int b){return (a*b)/GCD(a,b);}
int abs(int x){return x>0?x:-x;}
 
//const int dx[] = {1, 0, -1, 0, 1, -1, -1, 1};
//const int dy[] = {0, 1, 0, -1, 1, 1, -1, -1};

int main()
{
	string s;
	cin >> s;
	int r = 0, b = 0;

	REP(i, (int)s.size()){
		if (s[i] == '0') r++;
		if (s[i] == '1') b++;
	}
	cout << (r < b ? r*2 : b*2) << endl;

}


Measured memory_bytes: 512
#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 rep3(i, x, n) for(int i = x; i >= n; i--)
#define elif else if
#define sp(x) fixed << setprecision(x)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const int inf = (1<<30)-1;
const ll INF = (1LL<<60)-1;
const ld EPS = 1e-10;
template<typename T> bool chmax(T &x, const T &y) {return (x < y)? (x = y, true) : false;};
template<typename T> bool chmin(T &x, const T &y) {return (x > y)? (x = y, true) : false;};

int main(){
    int D;
    cin >> D;
    ll c[26];
    rep(i, 26) cin >> c[i];
    ll s[D][26];
    rep(i, D){
        rep(j, 26) cin >> s[i][j];
    }
    int pre[26];
    fill(pre, pre+26, -1);
    ll ans = 0;
    rep(i, D){
        int t; cin >> t; t--;
        ans += s[i][t];
        pre[t] = i;
        rep(j, 26){
            ans -= (i-pre[j])*c[j];
        }
        cout << ans << endl;
    }
}

Measured memory_bytes: 3636
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <deque>
#include <queue>
#include <array>
#include <set>
#include <map>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cstdint>
#include <cassert>
#include <random>

using namespace std;
using i64 = int64_t;
using i32 = int32_t;
template<class T, class U> void init_n(vector<T>& v, size_t n, U x) 
{ v = vector<T>(n, x); }
template<class T> void init_n(vector<T>& v, size_t n) { init_n(v, n, T()); }
template<class T> void read_n(vector<T>& v, size_t n, size_t o = 0) 
{ v = vector<T>(n+o); for (size_t i=o; i<n+o; ++i) cin >> v[i]; }
template<class T> void read_n(T a[], size_t n, size_t o = 0)
{ for (size_t i=o; i<n+o; ++i) cin >> a[i]; }
template<class T> T iabs(const T& x) { return max(x, -x); }
// #define abs gabs

i64 c[10][10];

int main() {
    int n;
    cin >> n;
    
    for (int k = 1; k <= n; ++k) {
        char cs[10] = {};
        sprintf(cs, "%d", k);
        string s(cs);
        c[s.front() - '0'][s.back() - '0']++;
    }

    i64 ans = 0;
    for (int i = 1; i <= 9; ++i) {
        for (int j = 1; j <= 9; ++j) {
            ans += c[i][j] * c[j][i];
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 888
#include <bits/stdc++.h>
using namespace std;
#define REP(i,x,n) for(int i=x;i<(int)n;i++)
#define rep(i,n) REP(i,0,n)
#define sp(p) cout<<setprecision(16)<<fixed<<p<<endl;
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define SORT(a) sort(all(a))
#define RSORT(a) sort(rall(a))
#define UNIQ(a) unique(all(a))
#define vout(v) for(int i=0;i<(int)v.size()-1;i++){cout<<v[i]<<" ";}cout<<v[v.size()-1]<<"\n";
#define vmin(v) *min_element(all(v))
#define vmax(v) *max_element(all(v))
#define vsum(v) accumulate(all(v), 0LL);
#define debg(a) cerr<<#a<<" "<<a<<endl;
#define show(a) for(cont &y:a){for(cont &x:y){cout<<x<<" ";}cout<<endl;}
template<class T>inline int out(const T &t){ print(t); putchar('\n'); return 0; }
template<class T>inline T gcd(T a,T b){if(b==0)return a; return(gcd(b,a%b));}
template<class T>inline T lcm(T a,T b){return a/gcd(a,b)*b;}
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef vector<ll> V;
// const long long MOD=1000000007;
const long long INF = 1e18;
#define EPS (1e-7)
#define PI (acos(-1))
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) { a = b; return true; }
    return false;
}
template<class T>
inline bool chmin(T &a, T b) {
    if(a > b) { a = b; return true; }
    return false;
}


void solve(long long K, long long S){
    ll cnt=0;
    for (ll i = 0; i <= K; i++) {
        for (ll j = 0; j <= K; j++) {
            ll tmp = S-(i+j);
            if(tmp<=K && tmp>=0) cnt++;
            // for (ll k = 0; k <= K; k++) {
            //     i+j+k==S ? cnt++ : 0;
            // }
        }
    }
    cout << cnt << "\n";
}

int main(){
    long long K;
    scanf("%lld",&K);
    long long S;
    scanf("%lld",&S);
    solve(K, S);
    return 0;
}


Measured memory_bytes: 256
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset

#include <math.h>
#include <stdlib.h>


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

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

//INT_MAX	2,147,483,647 = 2*1.0e9

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

  vector<int> h(N);
  rep(i, N) cin >> h[i];

  sort(h.begin(), h.end());

  int ans = 1000000000;
  for(int i = 0; i < N-K+1; i++){
    int dif = h[i+K-1] - h[i];
    if(dif < ans) ans = dif;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#include <iostream>
#include <string>
#include <stdio.h>
#include <math.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using ll = long long;
typedef long double lb;
using namespace std;
ll gcd(ll P, ll Q){
  return Q ? gcd(Q,P % Q):P;
}
ll lcm(ll P, ll Q){
  return P / gcd(P,Q) * Q;
}
string change_big(string str){
  transform(str.begin(), str.end(), str.begin(), ::toupper);
}
string change_small(string str){
  transform(str.begin(), str.end(), str.begin(), ::tolower);
}
bool is_prime(int x){
  if(x<=1) return false;
  for(int i=2;i*i<=x;i++)
    if(x%i==0) return false;
  return true;
}
int main(){
  ll N,M;
  cin >> N >> M;
  cout << gcd(N,M) << endl;
}



Measured memory_bytes: 3076
#include <bits/stdc++.h>
using namespace std;
 
using ll = long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
 
const ll MOD = 1e9+7;
const double PI  = 3.14159265358;
const double eps = 1e-8;
 
#define INF 2147483647
#define X first
#define Y second
#define SZ(a) ((int)a.size())
#define ALL(v) v.begin(),v.end()
#define RALL(v) v.rbegin(),v.rend()
#define FILL(v,n) memset(v,n,sizeof(v))
#define EB emplace_back
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define rep1n(i,n)	for(int i=1;i<n;i++)
#define IOS ios::sync_with_stdio(false);cin.tie();cout.tie();
 
#define MXN 1000000 //10^6

int main(){
	int n, ipt, k;
	int a[3];
	bool flag;
	long long ans;
	
	ans = 1;
	a[0] = a[1] = a[2] = 0;
	
	cin>>n;
	
	rep(i,n){
		k = 0;
		flag = false;
		cin>>ipt;
		rep(j, 3){
			if(a[j] == ipt){
				if(flag == false)
					a[j]++;
				k++;
				flag = true;
			}		
		}
		ans *= k;
		ans %= MOD;
	}
	
	cout<<ans;
	
	
}







Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n) ;i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define sz(x) ((int)(x).size())
using ll=long long;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define MOD  1000000007
const ll INF=1e18;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b){ a = b; return 1; } return 0; }



int main(int argc, char const *argv[]) {
  string s;
  cin >> s;
  int n=sz(s);
  bool f=true;
  rep(i,n){
    if((i+1)%2==0){
      if(s[i]!='L' && s[i]!='U' && s[i]!='D') f=false;
    }
    else {
      if(s[i]!='R' && s[i]!='U' && s[i]!='D') f=false;
    }
  }
  if(f) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <string>
#include <sstream>
using namespace std; using P=pair<int,int>; using ll=long long;

int main() {
  int n,m; cin>>n>>m;
  vector<P> v[n];
  for(int i=0;i<m;i++) {
    int p,y; cin>>p>>y;
    v[--p].push_back({y,i});
  }
  string s[m];
  for(int i=0;i<n;i++) {
    sort(v[i].begin(), v[i].end());
    for(int j=0;j<v[i].size();j++) {
      int id=v[i][j].second;
      ostringstream os;
      os<<setw(6)<<setfill('0')<<i+1;
      os<<setw(6)<<setfill('0')<<j+1;
      s[id]=os.str();
    }
  }
  for(int i=0;i<m;i++) {
    cout<<s[i]<<endl;
  }
}

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

int main(){
    int n,m,c;
    cin >> n >> m >> c;
    int ans = 0;
    vector<int>b(m);
    vector<vector<int>>a(n,vector<int>(m));
    for(int i=0;i < m;i++){
        cin >> b[i];
    }
    int count =0;
    for(int i=0;i < n;i++){
        for(int j=0;j < m;j++){
            cin >> a.at(i).at(j);
            ans += a.at(i).at(j) * b.at(j);
        }
        if (ans > -c){
            count++;
        }
        ans = 0;
    }
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
    int ans,a,b,c,d,e,f,n,k,x,y,z;
    cin>>a>>b>>c;
    int max=a;
    if(max<b)max=b;
    if(max<c)max=c;
    d=a+b+c-max;
    ans=max*10+d;
    cout<<ans<<endl;
}


Measured memory_bytes: 256
from math import factorial

N,M = map(int, input().split())

if N <= 1:
  a = 0
else:
  a = factorial(N) / 2 / factorial(N - 2)
  
if M <= 1:
  b = 0
else:
  b = factorial(M) / 2 / factorial(M - 2)
  
print(int(a+b))
  


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

#define int long long
#define double long double
#define ff first
#define ss second
#define endl '\n'
#define ii pair<int, int>
#define mp make_pair
#define mt make_tuple
#define DESYNC                      \
  ios_base::sync_with_stdio(false); \
  cin.tie(0);                       \
  cout.tie(0)
#define pb push_back
#define vi vector<int>
#define vii vector<ii>
#define all(x) x.begin(), x.end()
#define EPS 1e-9
#define INF 1e18
#define ROOT 1
#define M 1000000007
const double PI = acos(-1);

using namespace std;

inline int mod(int n, int m) {
  int ret = n % m;
  if (ret < 0) ret += m;
  return ret;
}

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

void calc(vector<int>& cur, vector<tuple<int, int, int, int>>& q, int n,
          int m) {
  int acc = 0;
  for (int i = 0; i < q.size(); i++) {
    int a, b, c, d;
    tie(d, a, b, c) = q[i];
    if (cur[b - 1] - cur[a - 1] == c) acc += d;
  }
  ans = max(acc, ans);
}
void brute_all(vector<int>& cur, vector<tuple<int, int, int, int>>& q, int n,
               int m) {
  if (cur.size() == n) {
    calc(cur, q, n, m);
    return;
  }
  // add more
  if (cur.size() == 0) {
    for (int i = 1; i <= m; i++) {
      cur.pb(i);
      brute_all(cur, q, n, m);
      cur.pop_back();
    }
  } else {
    for (int i = cur.back(); i <= m; i++) {
      cur.pb(i);
      brute_all(cur, q, n, m);
      cur.pop_back();
    }
  }
}
void solution() {
  int n, m, q;
  cin >> n >> m >> q;
  vector<tuple<int, int, int, int>> v(q);
  for (int i = 0; i < q; i++) {
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    v[i] = tie(d, a, b, c);
  }
  ans = 0;
  vector<int> start = vector<int>();
  brute_all(start, v, n, m);
  cout << ans << endl;
}

int32_t main() {
  DESYNC;
  solution();
}


Measured memory_bytes: 3660
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<map>
#include<cmath>
using namespace std;
#define REP(i, limit) for(int i=0; i< limit; ++i)
#define FOR(i, j, limit) for(int i=j; i< limit; ++i)
#define DUMP(a) REP(d,a.size()){cout<<a[d];if(d!=a.size()-1)cout<<" ";else cout<<endl;}
#define ECHO(x) cout<<x<<endl;
#define LL long long
int INF = 2147483647;
LL LINF = 9223372036854775807;
LL MOD = 1000000007;
typedef pair<int, int>P;
typedef pair<LL, LL>PL;
typedef vector<int> vi;
typedef vector<LL> vl;


int main(){
  string s;
  cin>>s;
  int n=s.size();

  if(n==1){
    cout<<0<<endl;
    return 0;
  }
  int evenw=0, oddw=0;
  REP(i, n){
    if(s[i]=='1') (i%2==1 ? oddw : evenw) += 1;
  }
  int ans = min(oddw + (n+1)/2-evenw, evenw + n/2-oddw);
  cout<<ans<<endl;



  return 0;
}


Measured memory_bytes: 512
def main():
    x = int(input())

    # i = 0
    # while True:
    #     if (i+1)**5 - i**5 > 10**9:
    #         break
    #     i+=1
    # print(i)

    for a in range(-119,120):
        for b in range(-119, 120):
            if a**5-b**5 == x:
                print(a, b)
                return

if __name__ == "__main__":
    main()

Measured memory_bytes: 9080
#include<bits/stdc++.h>
using namespace std;
long long gcd(long a,long b)
{
	if(a%b==0)
	{
		return b;	
	}
	else
	{
		return gcd(b,a%b);	
	}
}
long long lcm(long a,long b)
{
	return (long long)(a*b)/gcd(a,b);
}
int main()
{
	long a,b;
	scanf("%ld %ld",&a,&b);
	printf("%lld",lcm(a,b));
	return 0;
} 

Measured memory_bytes: 256
#include<stdio.h>
int na,nb,nc;
int i,j;
int n;
int a[1000],b[1000],c[1000],r[1000];
int st[300];

void judge(int x,int y,int z){
	if(st[x]==1&&st[y]==1)st[z]=0;
	else if(st[y]==1&&st[z]==1)st[x]=0;
	else if(st[x]==1&&st[z]==1)st[y]=0;
}
int main(){
	while(1){
		scanf("%d %d %d",&na,&nb,&nc);
		if(na==0&&nb==0&&nc==0)return 0;
		for(i=0;i<na+nb+nc;i++)st[i]=2;
		scanf("%d",&n);
		for(i=0;i<n;i++){
			scanf("%d %d %d %d",&a[i],&b[i],&c[i],&r[i]);
			if(r[i]==1){
				st[a[i]-1]=1;st[b[i]-1]=1;st[c[i]-1]=1;
			}
		}
		for(i=0;i<n;i++){
			if(r[i]==0)judge(a[i]-1,b[i]-1,c[i]-1);
		}
		for(i=0;i<na+nb+nc;i++)printf("%d\n",st[i]);
	}
}

Measured memory_bytes: 1044
#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <iomanip>
#include <algorithm>
#include <sstream>
#include <string>
#include <math.h>
#include <set>
using namespace std;
 
int main() {
	ios::sync_with_stdio(false);
	int n, k, d[10] = {};
	cin >> n >> k;
	int a;
	for (int i = 0 ; i < k ; i++ ) {
		cin >> a;
		d[a] = 1;
	}
	for (int i = n ; i < 100000 ; i++ ) {
		bool y=0;
		a=i;
      	while (a) {
          if (d[a%10]) y=1;
          a/=10;
        }
		if (!y) {
			cout << i;
			break;
		}
	}
}

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

//using namespace boost::multiprecision;
using namespace std;
typedef long long ll;
//typedef unsigned long long ll;
const double EPS = 1e-9;
#define rep(i, n) for (int i = 0; i < (n); ++i)
//#define rep(i, n) for (ll i = 0; i < (n); ++i)
//#define sz(x) ll(x.size())
//typedef pair<int, int> P;
//typedef pair<ll, int> P;
//typedef pair<ll, ll> P;
//const double INF = 1e10;
//const ll INF = LONG_LONG_MAX / 100;
//const ll INF = (1ll << 31) - 1;
//const ll INF = 1e15;
//const ll MINF = LONG_LONG_MIN;
//const int INF = INT_MAX / 10;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
//typedef pair<int, int> P;
//typedef pair<double, double> P;
#define ret() return 0;

bool contain(set<char> &s, char a) { return s.find(a) != s.end(); }

//ifstream myfile("C:\\Users\\riku\\Downloads\\0_00.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);
const int mod = 1000000007;
//const ll mod = 1e10;
typedef priority_queue<long long, vector<long long>, greater<long long> > PQ_ASK;

struct R {
    char c;
    int r;
};

int main() {

    string s;
    ll k;
    cin >> s >> k;

    vector<R> v;
    for (char c : s) {
        if (v.empty())v.push_back({c, 1});
        else if (v.back().c == c)v.back().r++;
        else v.push_back({c, 1});
    }

    if (v.front().r == s.size()) {
        cout << s.size() * k / 2 << endl;
        ret();
    }

    ll ans = 0;
    for (R r : v) ans += (r.r / 2);
    ans *= k;
    if (v.front().c == v.back().c) {
        int a = v.front().r;
        int b = v.back().r;

        int a2 = a / 2;
        int b2 = b / 2;
        int ab2 = (a + b) / 2;

        int d = a2 + b2 - ab2;
        ll j = (k - 1) * d;
        ans -= j;
    }
    cout << ans << endl;
}




Measured memory_bytes: 256
n = int(input())
list = input().split()
 
int_list = [ int(n) for n in list ]
int_list.sort()

isDist = True
 
for a in range(n-1):
  if int_list[a] == int_list[a+1]:
    print("NO")
    isDist = False
    break;
 
if isDist is True:
    print("YES")

Measured memory_bytes: 26580
#include <iostream>
#include <algorithm>
#include <string>
#include <math.h>
#include <numeric>
#include <set>
#include <unordered_set>
#include <queue>
#include <boost/math/constants/constants.hpp>
#include <boost/math/common_factor_rt.hpp>
 
using namespace std;
#define ll long long
#define rep(i, n) for(int i = 0;i < n;i++)
#define FOR(i, n, m) for(int i=n; i<m; ++i)
 
int main() {
  ll K, A, B;
  cin >> K >> A >> B;

  ll ans = 0;
  
  rep(i,1001){
    if((A<=K*i)&&(K*i<=B)){
      ans=1;
      break;
    }
  }
  if(ans==1){
	cout << "OK" << endl;
  }else{
    cout << "NG" << endl;
  }
  
}

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

// macro
#define rep(i,n) for(i=0;i<n;i++)
#define ll long long
#define all(v) v.begin(), v.end()

// code starts
int main()
{
	int h,w,k;cin>>h>>w>>k;
	vector<vector<char>> s(h,vector<char>(w));
	int i,j;
	rep(i,h)rep(j,w)cin>>s[i][j];
	vector<bool> found(h,false);
	rep(i,h)rep(j,w)if(s[i][j]=='#')found[i]=true;
	vector<vector<int>> ans(h,vector<int>(w,-1));
	int now=0;
	rep(i,h)
	{
		if(!found[i])continue;
		int fcome=-1;
		rep(j,w)
		{
			if(s[i][j]=='#')
			{
				if(fcome==-1)fcome=j;
				now++;
			}
			ans[i][j]=now;
		}
		rep(j,fcome)ans[i][j]=ans[i][fcome];
	}
	int first=0;
	rep(i,h)
	{
		if(found[i])
		{
			first=i;
			break;
		}
	}
	for(i=first-1;i>=0;i--)
	{
		rep(j,w)ans[i][j]=ans[i+1][j];
	}
	for(i=first+1;i<h;i++)
	{
		if(found[i])continue;
		rep(j,w)ans[i][j]=ans[i-1][j];
	}
	rep(i,h)
	{
		rep(j,w)
		{
			if(j==0)cout<<ans[i][j];
			else cout<<' '<<ans[i][j];
		}
		cout<<endl;
	}
}


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

int main() {
  int64_t a,b,k;
  cin >> a >>b >> k;
  if(a>=k) {
    cout << a-k << " " << b <<endl;
  }
  else if(a + b<=k) {
    cout << 0 << " " <<0<<endl;
  }
  else {
    cout << 0 <<" "<<a+b-k<<endl;
  }
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.nextLine();
		String[] st = s.split(" ");
		int[] ints = new int[3];
		for (int i = 0; i < 3; i++) {
			ints[i] = Integer.parseInt(st[i]);
		}
		if (ints[0] < ints[1] && ints[1] < ints[2]) {
			System.out.println("Yes");
		} else {
			System.out.println("No");

		}

	}

}

Measured memory_bytes: 25976
n = gets.chop.to_i 

base = ''

if n == 0
	puts '0'
else
	while n != 0
		c = (n/(-2)).to_i
		r = n%(-2)
		if r == -1
			c += 1
			r = 1
		end
		base = r.to_s + base
		n = c
	end
end

puts base

Measured memory_bytes: 1788
n = int(input())
lis = list(map(int, input().split()))

cnt = 1

flag = 0
for i in range(n-1):
    if lis[i+1] - lis[i] >0:
        if flag == 1:
            pass
        elif flag == -1:
            flag = 0
            cnt += 1
        elif flag == 0:
            flag = 1
    elif lis[i+1] - lis[i] < 0:
        if flag == 1:
            flag = 0
            cnt += 1
        elif flag == -1:
            pass
        elif flag == 0:
            flag = -1
    elif lis[i+1] - lis[i] == 0:
        pass
    

print(cnt)

Measured memory_bytes: 20040
N, K = map(int, input().split())
P = list(map(int, input().split()))

cml_sum = [(P[0]+1)/2.0]
for i in range(1, N):
    cml_sum.append(cml_sum[i-1] + (P[i]+1)/2.0)

ans = cml_sum[K-1]
for i in range(N-K):
    target = cml_sum[i+K] - cml_sum[i]
    if ans < target:
        ans = target

print(ans)


Measured memory_bytes: 25060
#!/usr/bin/env python3
n = int(input()) % 10
if n == 2 or n == 4 or n == 5 or n == 7 or n == 9:
    print("hon")
elif n == 0 or n == 1 or n == 6 or n == 8:
    print("pon")
else:
    print("bon")


Measured memory_bytes: 9168
lst = ['A', 'G', 'C', 'T']
s = input()

cnt = 0
mx = 0
for i in range(len(s)):
	if s[i] in lst:
		cnt += 1
	else:
		if mx < cnt:
			mx = cnt
		cnt = 0
if mx < cnt:
	mx = cnt
print(mx)


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep2(i, a, b) for (int i = (a); i < (b); ++i)
#define MAX 128
#define fst first
#define sec second
#define pb push_back
#define mp make_pair
#define ALL(x) (x).begin(), (x).end()
#define bit(n) (1LL << (n))
#define int long long
const double PI = 3.141593;
const ll MOD = 1e9 + 7;
const int INF = 100100100;
const double EPS = 1e-9;
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;}
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); }     //最小公倍数
ll combination(ll n, ll r){if (r * 2 > n)r = n - r;ll dividend = 1;ll divisor = 1;for (ll i = 1; i <= r; ++i){dividend *= (n - i + 1);divisor *= i;}return dividend / divisor;}


signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    string s, t,u;
    int a, b;
    cin >> s >> t >> a >> b >> u;
    if(s==u){
        a--;
    }
    else{
        b--;
    }
    cout << a << " " << b << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define PI (acos(-1))
#define ct cout<<
#define cn cin>>
#define spc <<" "<<
#define nl puts("")
#define _fl(x) puts("FLAG " #x);
#define  _(x)  cout<< #x <<" is "<< x <<endl;
#define fs first
#define sc second
#define pb push_back
#define all(v)  (v).begin(), (v).end()
#define _109 (1000000000)
#define _0(arr) memset(arr,0,sizeof ( arr ) )
#define _1(arr) memset(arr,-1,sizeof ( arr ) )
#define _ninp(n,arr) for(int i=0; i<n;i++)cin>>arr[i];
#define _nout(n,arr) for(int i=0; i<n;i++)cout<<arr[i]<<" \n"[i==n-1];
double _eps=1e-6;
long long gcd(long long a, long long b) {
    if (b == 0)
        return a;
    return gcd(b, a % b);
}

int main() {

    string s;
    cn s;

int cnt=0;
    for (int i = 0,j=s.size()-1; i<j; ++i,j--)
    {
    	if(s[i]!=s[j])cnt++;
    }

  ct cnt;
  nl;





    return 0;
}


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

int main()
{
    string s,t; cin >> s >> t;

    int cnt = 0;

    rep(i,s.size()) {
        if(t.at(i) == s.at(i)) {
            continue;
        } else {
            cnt++;
        }
    }

    cout << cnt << endl;
}

Measured memory_bytes: 3920
using System;
using System.Diagnostics;
using System.IO;
using System.Text;
using System.Linq;
using System.Collections.Generic;
using System.Text.RegularExpressions;

class Program
{
    const string Yes = "Yes";
    const string No = "No";
    const long Mod = 1000000007;

    static void Main(string[] args) {
#if DEBUG
        MyDebugger.Test(process, "../TextFile1.txt");
#else
        object ret = process(new StreamReader(Console.OpenStandardInput()));
        Console.WriteLine(ret);
#endif
    }

    static object process(TextReader input) {
        var s = input.ReadLine();
        var k = long.Parse(input.ReadLine());

        for(int i=0; i<k; i++) {
            if (s[i] != '1') return s[i] - '0';
        }
        return 1;
    }

    static int[] ToIntArray(string strs, int n) {
        var ret = new int[n];
        var spl = strs.Split(' ');
        for (int i = 0; i < n; i++)
            ret[i] = int.Parse(spl[i]);
        return ret;
    }
}


Measured memory_bytes: 11092
#include<iostream>
using namespace std;
int map[101][101];
int main()
{
	int h,w;
	cin>>h>>w;
	int n;
	int a[10001]={0};
	cin>>n;
	for(int i=1;i<=n;i++)
	scanf("%d",&a[i]);
	int ans=1;
	int dir=1;
	for(int i=1;i<=h;i++)
	{   
	    if(dir==1)
	    {
    		 for(int j=1;j<=w;j++)
			{   
			    if(a[ans]==0)
			    {
	    			ans++;	
	    		}			
				map[i][j]=ans;
	    			a[ans]--;
                	
			}
    	}
    	else
    	{
	    	for(int j=w;j>=1;j--)
			{   
			    if(a[ans]==0)
			    {
	    			ans++;
	    		}							
			    map[i][j]=ans;
    			a[ans]--;							
			}
	    }
	    dir=-dir;		
	}
	for(int i=1;i<=h;i++)
	{
		for(int j=1;j<w;j++)
		cout<<map[i][j]<<" ";
		cout<<map[i][w]<<endl; 
	} 
} 

Measured memory_bytes: 384
use std::str::FromStr;

fn get_one<T : FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    return s.trim().parse().ok().unwrap();
}

fn get_vec<T : FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    return s.trim().split_whitespace().map(|e| e.parse().ok().unwrap()).collect();
}

fn main() {
    let _n : usize = get_one();
    let v : Vec<i32> = get_vec();

    let mut d1 = 0;
    let mut d2 = 0;
    let mut d4 = 0;
    for x in v {
        if x % 4 == 0 {
            d4 += 1;
        } else if x % 2 == 0 {
            d2 += 1;
        } else {
            d1 += 1;
        }
    }
    if d2 == 0 && d4 >= d1-1 || d2 >= 1  && d4 >= d1{
        println!("{}", "Yes");
    }
    else {
        println!("{}", "No");
    }
}


Measured memory_bytes: 4352
import math

def main():
    N = int(input())
    time = [0] * 5
    for i in range(5):
        time[i] = int(input())

    min_time = min(time)
    ans = 5 + math.ceil((N - min_time) / min_time)

    print(ans)


if __name__ == '__main__':
    main()

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

int main() 
{
    long long n;
    stack<int> s;
    
    cin >> n;
    while(n>0){
        s.push(n%26);
        n = (n-1)/26;
    }
    
    while( !(s.empty()) ){
        if(s.top() == 0){
            cout << 'z';
        } else {
            cout << char(s.top() + 'a' - 1);
        }
            
        s.pop();
    }
    
    cout << endl;
    
    return (0);
}

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

N += 1
L = [0] * N 

for i in A:
  L[i] += 1

Ans = 0
for i in range(N):
  t = L[i]
  Ans += (t * (t - 1)) // 2

for i in A:
  t = L[i]
  k = (t * (t - 1)) // 2
  t -= 1
  k -= (t * (t - 1)) // 2
  print(Ans - k)

Measured memory_bytes: 24748
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <utility>
#include <iomanip>
using namespace std;
typedef long long ll;
const ll MOD = 1e9+7;
ll a[100000];
// int dp[101][101][101];
// int update(int a,int b,int c)
// {
// 	bool g[400];
// 	fill(g,g+400,false);
// 	if(a>0)
// 		g[dp[a-1][b][c]]=true;
// 	if(b>0)
// 		g[dp[a][b-1][c]]=true;
// 	if(c>0)
// 		g[dp[a][b][c-1]]=true;
// 	if(a>0 && b>0)
// 		g[dp[a-1][b-1][c]]=true;
// 	if(a>0 && c>0)
// 		g[dp[a-1][b][c-1]]=true;
// 	if(b>0 && c>0)
// 	g[dp[a][b-1][c-1]]=true;
// 	if(a>0 && b>0 && c>0)
// 	g[dp[a-1][b-1][c-1]]=true;
// 	for(int i=0;i<400;i++)
// 	{
// 		if(!g[i])
// 			return i;
// 	}
// 	return 399;
// }
int main()
{
	int n;
	cin>>n;
	for(int i=0;i<n;i++)
		cin>>a[i];
	// dp[0][0][0]=0;
	// for(int i=0;i<101;i++)
	// {
	// 	for(int j=0;j<101;j++)
	// 	{
	// 		for(int k=0;k<101;k++)
	// 		{
	// 			if(i==0 && j==0 && k==0)
	// 				continue;
	// 			dp[i][j][k]=update(i,j,k);
	// 		}
	// 	}
	// }
	// for(int i=0;i<101;i++)
	// {
	// 	for(int j=0;j<101;j++)
	// 	{
	// 		for(int k=0;k<101;k++)
	// 		{
	// 			if(dp[i][j][k]==0)
	// 				cout<<i<<" "<<j<<" "<<k<<endl;
	// 		}
	// 	}
	// }
	for(int i=0;i<n;i++)
	{
		if(a[i]&1LL)
		{
			cout<<"first"<<endl;
			return 0;
		}
	}
	cout<<"second"<<endl;
	return 0;
}

Measured memory_bytes: 1024
from collections import deque

h,w = (int(i) for i in input().split())
maze = [['#' for i in range(w+2)]]+[['#']+[x=='#' for x in input()]+['#'] for i in range(h)]+[['#' for i in range(w+2)]]
#print(maze)
f = 0
for i in range(1,h+1):
 for j in range(1,w+1):
  #　元から塗りつぶされている
  if maze[i][j]:f+=1
#print(f)
flag= 0
pos = deque([(1,1,0)])
while pos:
  x,y,c = pos.popleft()
  #ゴール
  if (x,y) == (h,w):
    print(h*w-f-c-1)
    exit()
  elif maze[x][y]:
    #行き止まり,探索済み
    continue
  #追加の4方向
  pos.append((x-1, y, c+1))
  pos.append((x+1, y, c+1))
  pos.append((x, y-1, c+1))
  pos.append((x, y+1, c+1))
  #print(pos)
  maze[x][y] = True
if flag == 0:
 print(-1)

Measured memory_bytes: 3316
#include "bits/stdc++.h"
using namespace std;
#define INF 1e9
#define rep(i, n) for(int i = 0; i < n; i++)
#define ALL(x) (x).begin(), (x).end()  //昇順
#define RALL(x) (x).rbegin(), (x).rend() // 降順
const long long mod = 1e9+7;
typedef priority_queue<int> PQ;
typedef vector<long long> VL;
typedef vector<int> VI;  // VI a(n);
typedef vector<string> VS;  
typedef vector<char> VC; 
typedef vector<VS> VSS;
typedef vector<VC> VCC;    
typedef vector<VI> VVI;   // VVI a(n,vector<int>(m)) n * m 
typedef vector<VL> VVL;
typedef pair<int, int> PII;
typedef map<int, int> MP;   //MP a;
typedef vector<pair<int, int> > PS;
typedef long long ll;  //ll とdoubleは違う
template <class T>  // chmax(max, a);
bool chmax(T &a, const T &b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T> //chmin(min,a)
bool chmin(T &a, const T &b)
{
    if (b < a)
    {
        a = b;
        return 1;
    }
    return 0;
}
template<typename T>   // operator << (cout,a);
ostream& operator << (ostream& os, vector<T>& v) {
    os << "{";
    rep(i, (int)v.size()) { os << v[i] << (i < v.size() - 1 ? ", " : ""); }
    os << "}";
    return os;
}

ll Max=-1000000000,Min=1e9+1;
       
int main(){
    int x=0,y=0,z=0,n,m,h,k=0,w,sum2=0,ans=0;
    string s,t;
    bool f=true;
    cin >> n >> m >> x >> y;
    rep(i,n){
        cin >> h;
        if(h>Max)
            Max = h;
    }
    if(Max < x){
        Max = x;
    }
    rep(i,m){
        cin >> h;
        if(h<Min)
            Min = h;
    }
    if(Min > y){
        Min = y;
    }

    if(Max>0 && Min>0 && Max < Min)
        cout << "No War" << endl;
    else if(Max<0 && Min<0 && Max < Min)
        cout << "No War" << endl;
    else if (Max<0 && Min>=0)
        cout << "No War" << endl;
    else
        cout << "War" << endl;
    return 0;
}



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


void solve(long long A, long long B){
    vector<string> left(25*100), right(25*100);
    auto cnt=B-1;
    for(int i=0; i<25*100; i++){
        if((i/25)%2==0 && cnt>0){
            left[i]="#.";
            cnt--;
        }
        else left[i] = "..";
    }
    cnt=A-1;
    for(int i=0; i<25*100; i++){
        if((i/25)%2==0 && cnt>0){
            right[i]="#.";
            cnt--;
        }
        else right[i] = "##";
    }
    cout << 100 << " " << 100 << endl;
    for(int h=0; h<100; h++){
        for(int w=0; w<50; w++){
            if(w<25){
                cout << left[25*h+w];
            }else{
                cout << right[25*h+(w%25)];
            }
        }
        cout << endl;
    }
}

int main(){
    long long A;
    scanf("%lld",&A);
    long long B;
    scanf("%lld",&B);
    solve(A, B);
    return 0;
}


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


int main()
{
	int n;
	cin >> n;
	int* numbers = new int[n];

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

	for (int i = (n - 1); i >= 0; --i)
	{
		cout << numbers[i];
		if (i != 0) cout << " ";
	}
	cout << endl;

	return 0;
}

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

int main() {
	char a;

	cin >> a;

	if (a == 'a' || a=='i' || a=='u' || a=='e' || a=='o') {
		cout << "vowel" << endl;
	}
	else {
		cout << "consonant" << endl;
	}

	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

// https://atcoder.jp/contests/abc086/tasks/abc086_a
public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		Scanner scanner = new Scanner(System.in);
		int a = scanner.nextInt();
		int b = scanner.nextInt();

		if(a*b%2==0) {
			System.out.println("Even");
		} else {
			System.out.println("Odd");
		}

		scanner.close();
	}

}

Measured memory_bytes: 22100
#include <bits/stdc++.h>
#include <string>
#include <algorithm>
#include <string.h>
#include <ctype.h>
#include <math.h>
#include <float.h>
#include <iomanip>
#include <iostream>
using namespace std;

int main(){
    
    int N,W[110]={},ans,A=0,B=0;

    cin >> N;

    for(int i=1;i<=N;i++){
        cin >> W[i];
        B+=W[i];
    }

    ans = abs(A-B);

    for(int i=1;i<=N;i++){
        A+=W[i];
        B-=W[i];

        if(abs(A-B)<ans){
            ans = abs(A-B);
        }

    }

    cout << ans <<endl;
    

    return 0;

}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
 
int main() {
	long long int m,n;
cin>>m>>n;
if(m>1&&n>1){
cout<<(m-2)*(n-2);
}
else if(m*n!=1){
cout<<m*n-2;
}
else{
cout<<1;
}
	return 0;
}

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

#define Fast ios_base::sync_with_stdio(0);cin.tie(0),cout.tie(0)
#define FO freopen("in.txt", "r", stdin)
#define FC freopen("out.txt", "w", stdout)
#define aise cout<<"aise"<<endl
#define pb push_back
#define mp make_pair
#define ll long long
#define all(x) x.begin(), x.end()
#define mset(v, a) memset(v, a, sizeof(v))
#define pll pair< ll, ll >
#define pdd pair< double, double >
#define ff first
#define ss second
#define pi acos(-1.0)
#define mxN 2010
#define inf 1e9
#define MOD 1000000007

int main()
{

    ll n, k;
    cin >> n >> k;
    vector<ll> v(n+1, 0);
    for(ll i = 1; i <= n; i++) cin >> v[i];
    ll ans = inf;
    sort(all(v));
    for(ll i = 1; (i+k-1)<= n; i++)
    {

        ll diff = v[i+k-1]-v[i];
        ans = min(ans, diff);
    }
    cout << ans;
}


Measured memory_bytes: 1024
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cmath>
#define int long long
#define mod 1000000007
#define for0(i, n) for(int i = 0; i < (n); i++)
#define for1(i, n) for(int i = 1; i <= (n);i++)
using namespace std;
int n, a[60];
signed main() {
	cin >> n; for1(i, n)cin >> a[i];
	sort(a, a + n + 1);
	if (a[1] == 0) { cout << "0\n"; return 0; }
	for (int i = 2; i <= n; i += 2)a[i] = 24 - a[i];
	sort(a, a + n + 1);
	int ans = 24;
	for1(i, n)ans = min(ans, a[i] - a[i - 1]);
	cout << ans << endl;
}

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

using namespace std ;
string s , t ;
int num ;
int main () {
	cin >> s >> t ;
	for(int i = 0 ; i < s.size() ; i ++) {
		if(s[i] == t[i]) num ++ ;
	}
	cout << num << endl ;
	return 0 ;
}	

Measured memory_bytes: 256
#include<stdio.h>

int main(void){
    int K,X;
    int scrd, bcrd;
    int i;

    scanf("%d %d", &K, &X);
    scrd = X-K+1;
    bcrd = X+K-1;

    for(i = scrd; i <= bcrd; i++){
        if(i == bcrd){
            printf("%d",i);
            break;
        }
        printf("%d ",i);
    }
    
    return 0;
}

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


#define fi first
#define se second
#define all(x) (x).begin() , (x).end()
#define rall(x) (x).rbegin() , (x).rend()
#define pb push_back
#define len(x) (int)(x).size()

using namespace std;
typedef pair<int,int> pii;
typedef long long ll;
typedef long double ld;


signed main(){
    int n , q, D;
    cin >> n >>  D;
    vector < int > d(n + 1);
    for(int i = 1; i <= n; ++i)
        cin >> d[i];
    vector < int > a(n + 1);
    a[0] = D;
    for(int i = 1; i <= n; ++i){
        a[i] = min(a[i-1] , abs(a[i-1]-d[i]));
    }
    vector < int > b(n + 2);
    b[n + 1] = 1;
    for(int i = n; i >= 1; --i){
        if(b[i+1]<=d[i]/2)
            b[i]=b[i+1];
        else b[i]=b[i+1]+d[i];
    }
    cin >> q;
    while(q--){
        int pos;cin >> pos;
        if(a[pos-1] >= b[pos+1])
            cout << "YES\n";
        else cout << "NO\n";
    }
    return 0;
}


Measured memory_bytes: 9024
#include<bits/stdc++.h>
using namespace std;
int main()
{
    char s[3];
    cin>>s;
    int count=0,i=0;
    while(s[i]!='\0')
    {
        if(s[i]=='R')
        {
            count++;
        }
        else if(s[i]=='S'&&s[i+1]=='R')
        {
            count=0;
        }
        i++;
    }

    cout<<count<<endl;

    return 0;
}


Measured memory_bytes: 3632
from itertools import permutations

N, M = map(int, input().split())

E = []
for i in range(M):
    E.append(tuple(map(int, input().split())))

P = []
for p in permutations(range(2, N+1)):
    tmp = [1]
    tmp.extend(list(p))
    P.append(tmp)

ans = 0
for p in P:
    for i in range(1, N):
        exist = False
        for e in E:
            if set(e) == {p[i-1], p[i]}:
                exist = True
                break
        if exist is False:
            break
    else:
        if exist is False:
            break
    if exist:
        ans += 1

print(ans)


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

#define ff first
#define ss second
#define pb push_back

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

const int N = 100005;

int main(){
	int k, x;
	scanf("%d %d", &k, &x);
	if(k * 500 >= x){
		printf("Yes\n");
	}
	else{
		printf("No\n");
	}
	return 0;
}


Measured memory_bytes: 256
s = str(input())
if s == "SUN":
  print(7)
elif s == "MON":
  print(6)
elif s =="TUE":
  print(5)
elif s == "WED":
  print(4)
elif s == "THU":
  print(3)
elif s == "FRI":
  print(2)
else:
  print(1)

Measured memory_bytes: 38256
# Begin Header {{{
from math import gcd
from collections import Counter, deque, defaultdict
from heapq import heappush, heappop, heappushpop, heapify, heapreplace, merge
from bisect import bisect_left, bisect_right, bisect, insort_left, insort_right, insort
from itertools import accumulate, product, permutations, combinations, combinations_with_replacement
# }}} End Header
# _________コーディングはここから！！___________
# ... 最小側の制約も確認した？
# ... オーバーフローしない？
a, b, c = map(int, input().split())
i = 1
ok = False
while i<=b:
    if (a*i-c)%b != 0: i+=1
    else:
        ok = True
        break
if ok: print("YES")
else: print("NO")

Measured memory_bytes: 9408
#include<bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n ; i++)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define whole(f, x, ...) ([&](decltype((x)) whole) { return (f)(begin(whole), end(whole), ## __VA_ARGS__); })(x) // decltypeで型取得、引数があればva_argsのところに入れる
using namespace std;
typedef long long ll; // long longをllでかけるようにした
const int INF = 1e9;

int main(void){
    int n, t; cin >> n >> t;
    ll res = 0, now = 0;
    vector<int> num(n);
    REP(i, n){
        cin >> num[i];
    }

    REP(i, n - 1){
        if(num[i + 1] - num[i] > t){
            res += t;
        }
        else{
            res += num[i + 1] - num[i];
        }
    }
    res += t;

    cout << res << endl;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
using LL = long long;
const LL LINF = 1e18;
using namespace std;
#define COUT(v) cout<<(v)<<endl
#define CIN(n)  int(n);cin >> (n)
#define SCIN(n) string(n);cin >> (n)
#define YES(n) cout<<((n)? "YES" : "NO")<<endl
#define Yes(n) cout<<((n)? "Yes" : "No")<<endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) <<endl

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)

#define FOREACH(x,a) for(auto& (x) : (a) )

#define ALL(obj) (obj).begin(),(obj).end()

#define P pair<int,int>
#define I vector<int>
#define S set<int>
#define pb(v) push_back(v)
#define V vector
#define rt return
#define rmsame(a) sort(ALL(a)),a.erase(unique(ALL(a)), a.end())
class Edge{
public:
    int from,to,value;
    Edge(int a,int b,int c){
        from = a;
        to = b;
        value = c;
    }
    Edge(int a,int b){
        from = a;
        to = b;
    }
};


int main(){
    int mass[]={0,1,0,3,0,3,0,0,3,0,3,0};
    CIN(A);   //1,2,3,4,5,6,7,8,9,10,11,12
    CIN(B);
    if(mass[A-1]==mass[B-1]){
        COUT("Yes");
    }else{
        COUT("No");
    }
    return 0;
}


Measured memory_bytes: 256
from math import sqrt, floor
N = int(input())

# 素因数分解

left = []
right = []
for i in range(1, floor(sqrt(N)) + 1):
    if (N % i == 0):
        left.append(i)
        right.append(N // i)
    else:
        continue

last_left = str(left[-1])
last_right = str(right[-1])

ans = []
for i in range(len(left) - 1, -1, -1):
    ans.append(max(len(str(left[i])), len(str(right[i]))))

print(min(ans))


Measured memory_bytes: 9204
while True:
  a,b= map(int,input().split())
  if a+b == 0:
    break
  c=0
  for i in range(1,a+1):
    for j in range(i+1,a+1):
      for k in range(j+1,a+1):
        if i+j+k ==b:
            c+=1
  print(c)



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

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)n; ++i)
#define REP(i, a, b) for (int i = (int)a; i < (int)b; ++i)
#define each(i,c) for(__typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define all(v) v.begin(), v.end()
#define mset(a, n) memset(a, n, sizeof(a))

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

const int INF = 1000000000;
const int MOD = 1000000007;
const double eps = 1e-9;

int main(int argc, char *argv[]) {
    // cin.tie(0);
    // ios::sync_with_stdio(false);
    int N;
    cin >> N;
    vector<int> A(N);
    rep(i, N) cin >> A[i];

    ll ans = 0, sum = 0;
    rep(i, N) {
        if (A[i] == 0) {
            ans += sum / 2;
            sum = 0;
        }
        sum += A[i];
    }
    ans += sum / 2;
    cout << ans << endl;
    return 0;
}

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

using namespace std;

#define ll long long
#define mod 1e9 + 7
#define mx 1000000000
#define endl '\n'

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n;
    cin>>n;
    pair<int,int> arr[n];
    ll sum = 0;
    for(int i = 0;i<n;i++){
        cin>>arr[i].second>>arr[i].first;
    }
    sort(arr,arr+n);
    for(int i = 0;i<n;i++){
        sum += arr[i].second;
        if(arr[i].first < sum){
            cout<<"No";
            return 0;
        }
    }
    cout<<"Yes";
    return 0;
}



Measured memory_bytes: 1792
using System;

namespace ABC078_B
{
    class Program
    {
        static void Main(string[] args)
        {
            var sss = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
            var x = sss[0];
            var y = sss[1];
            var z = sss[2];

            var one = x - z;
            Console.WriteLine(one / (y + z));
        }
    }
}


Measured memory_bytes: 13140
import java.util.*;
public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int n=sc.nextInt();
		int h[]=new int[n];
		int ans=0,count=0;
		for(int i=0;i<n;i++) {
			h[i]=sc.nextInt();
		}
		for(int i=1;i<n;i++) {
			if(h[i-1]>=h[i])count++;
			else count=0;
			ans=Math.max(ans, count);
		}
		System.out.println(ans);
	}

}

Measured memory_bytes: 50344
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<bitset>
#include<cstdio>
#include<cmath>
#include<map>
#include<numeric>
#include<set>
#include<sstream>
#include<string>
#include<utility>
#include<vector>

#define rep(i, a, n)  for(int i=a; i<n; ++i)
#define per(i, a, n)  for(int i=n-1; i>=a; --i)
#define fill0(n)  setfill('0') << right << setw(n)
#define all(x)  (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define INF 1000000007
using namespace std;
typedef long long ll;

int main(){
  int A, B, C;  cin >> A >> B >> C;
  if((A<C and C<B) or (C<A and B<C)){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 256