akhauriyash/Code-Regression huggingface dataset:
#pragma GCC optimze("Ofast")
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define mod 1000000007
#define md 998244353
#define trace(...)
#define ll long long int
#define ld long double
#define fi first
#define se second
#define fr(i,a,b) for(ll i=a;i<=b;i++)
#define frr(i,b,a) for(ll i=b;i>=a;i--)
#define mem(a) memset(a, 0, sizeof(a))
#define vpi std::vector<pair<int,int>>
#define pii pair<int,int>
#define pb push_back
#define sall(v) sort(v.begin(),v.end())
#define all(v) (v.begin(),v.end())
#define minf -10000000
const ll infl=0x3f3f3f3f3f3f3f3fLL;
const int infi=0x3f3f3f3f;
typedef tree<pii, null_type, less<pii>, rb_tree_tag, tree_order_statistics_node_update> oset;
auto clk=clock();
mt19937_64 rang(chrono::high_resolution_clock::now().time_since_epoch().count());
int rng(int lim) {
    uniform_int_distribution<int> uid(0,lim-1);
    return uid(rang);
}
ll power(ll x, ll y,ll p) { 
    ll res = 1;      // Initialize result 
    x = x % p;  // Update x if it is more than or equal to p 
    while (y > 0) {  
        if (y & 1) // If y is odd, multiply x with result
            res = (res*x) % p;  
        y = y>>1; // y = y/2 // y must be even now
        x = (x*x) % p;   
    } 
    return res; 
}
ll power(ll x, ll y) { 
    ll res = 1;      // Initialize result 
    while (y > 0) {    
        if (y & 1)// If y is odd, multiply x with result 
            res = (res*x) ;  
        y = y>>1; // y = y/2 // y must be even now 
        x = (x*x);   
    } 
    return res; 
}
 
ll max3(ll a,ll b,ll c){
    return max(a,max(b,c));
}
ll min3(ll a,ll b,ll c){
    return min(a,min(b,c));
}
bool isPrime(ll n) { // Corner cases 
    if (n <= 1) 
        return false; 
    if (n <= 3) 
        return true; 
    if (n % 2 == 0 || n % 3 == 0) 
        return false; 
    for (ll i = 5; i * i <= n; i = i + 6) 
        if (n % i == 0 || n % (i + 2) == 0) 
            return false; 
    return true; 
}
bool pall(string s){
    int n =s.length();
    int i=0,j=n-1;
    while(i<=j){
        if(s[i]!=s[j])return false;
        i++;j--;
    }
    return true;
}
void solve() {
    string s;cin>>s;
    int n=s.length();
    string s1="",s2="";
    fr(i,0,(n-1)/2-1)s1+=s[i];
    fr(i,(n+3)/2-1,n-1)s2+=s[i];
    if(pall(s)&&pall(s1)&&pall(s2))cout<<"Yes\n";
    else cout<<"No\n";
    return ;
}

int main(){
    ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
    
    int t;
    // cin>>t;
    t=1;
    while(t--){
        solve();
    }
    
    return 0;
}

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, s, e) for (int i = (int)(s); i < (int)(e); i++)
#define _rep(i, n) for (int i = (int)(n - 1); i >= 0; i--)
#define _REP(i, e, s) for (int i = (int)(e - 1); i >= (int)(s); i--)

#define yes cout << "yes" << endl;
#define Yes cout << "Yes" << endl;
#define YES cout << "YES" << endl;

#define no cout << "no" << endl;
#define No cout << "No" << endl;
#define NO cout << "NO" << endl;

#define AC cout << "AC" << endl;
#define WA cout << "WA" << endl;

#define out(s) cout << s << endl;

#define ll long long
#define ull unsigned long long
#define vi vector<int>

const double PI = 3.14159265358979323846;

int main() {
    int H, W;
    cin >> H >> W;
    vector<string> a(H);
    for (int i = 0; i < H; i++) {
        cin >> a[i];
    }

    vector<bool> row(H, false);
    vector<bool> col(W, false);
    rep(i, H) {
        rep(j, W) {
            if (a[i][j] == '#') {
                row[i] = true;
                col[j] = true;
            }
        }
    }

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

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

#define rep(i, s, n) for(int i=(s);i<(int)n;i++)
int INF=1e9+7;

int main() {
  int K, A, B;
  cin >> K >> A >> B;
  int x=A/K;
  if(K*x==A||K*(x+1)<=B) cout << "OK" << endl;
  else cout << "NG" << endl;
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n;
	cin>>n;
	int a[n];
	for (int i=0; i<n; i++){
		cin>>a[i];
	}
	sort(a,a+n);
	int ans=0;
	for (int i=n-1; i>0; i--){
		ans+=a[i]-a[i-1];
	}
	cout<<ans;
	return 0;
}

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

int main()
{
char a;
char b;
cin>>a>>b;

if(a=='H')
cout<<b<<endl;

if(a=='D')
{
 if(b=='D')
	 cout<<'H'<<endl;
 if(b=='H')
	 cout<<'D'<<endl;
}
return 0;
}//main

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

d = [0]*N
tmp = input().split()
for n in range(N):
    d[n]= int(tmp[n])

d.sort()

dm = d[N//2-1]
dM = d[N//2]

if dm == dM:
    print(0)
else:
    print(dM-dm)

Measured memory_bytes: 14556
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cstdint>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cmath>
#include <cstdlib>
#include <sstream>
#include <functional>
#include <bitset>
#include <queue>

#include <boost/range/irange.hpp>
using boost::irange;

#include <boost/utility/string_ref.hpp>
using string_view = boost::string_ref;

#include <boost/function_output_iterator.hpp>

using namespace std;

int count(string s)
{
    int c = 0;
    for(size_t i = 1; i < s.size(); ++i)
    {
        if(s[i-1] == s[i])
        {
            c++;
            s[i] = (s[i-1] == '0' ? '1' : '0');
        }
    }
    return c;
}

string reverse(string x)
{
    reverse(begin(x), end(x));
    return x;
}

int main()
{
    string s;
    cin >> s;
    cout << min(count(s), count(reverse(s))) << '\n';
    return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <cmath>
#include <vector>
#include <bitset>
#include <string>
#include <utility>
#include <iomanip>
#include <queue>
#include <algorithm>
#include<set>
#include<unordered_set>
using namespace std;
int root(int a);
bool is_same_set(int a,int b);
void unite(int a,int b);
long long int mpown(long long int m,long long int n);
int P[100001];
int main()
{
    long long int m;
    long long int k;
    cin >> m >> k;
    long long int pown = (1<<m);
    // cout << pown << endl;
    if(pown <= k){cout << -1 << endl;return 0;}
    
    if(m==0){
        if(k==0)cout << "0 0" << endl;
        else cout << -1 << endl;
        return 0;
    }
    else if(m==1){
        if(k==0)cout << "0 1 1 0" << endl;
        if(k==1)cout << -1 << endl;
    }
    else{
        for(long long int i=0;i<pown;i++){
            if(i==k)continue;
            cout << i << " ";
        }
        cout << k << " ";
        for(long long int i=pown-1;i>=0;i--){
            if(i==k)continue;
            cout << i << " ";
        }
        cout << k << endl;
    }
    return 0;

}
int root(int a){
    if(P[a]==a)return a;
    return (P[a]=root(P[a]));
}
bool is_same_set(int a,int b){
    return root(a)==root(b);
}
void unite(int a,int b){
    if(!is_same_set(a,b)) P[root(a)]=root(b);
}
long long int mpown(long long int m,long long int n){
    if(n==0)return 1;
    if(n==1)return m;
    long long int temp=mpown(m,n/2);
    return temp*temp*(n&1?m:1);
}

Measured memory_bytes: 3148
#include <bits/stdc++.h>
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define FORR(i,a,b) for (int i=(a);i>=(b);i--)
#define pb push_back
#define pcnt __builtin_popcount
#define show(x) cout<<#x<<" = "<<x<<endl;
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define fi first
#define se second
#define rng(a) (a.begin()),(a.end())
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define sz(x) (int)(x).size()
#define mp make_pair

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
typedef set<int> si;
typedef pair<ll,ll> pll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<pll> vpll;
typedef set<ll> sl;
typedef __int128_t lll;
typedef pair<lll,lll> plll;
typedef vector<lll> vlll;
template<typename T>string join(vector<T>&v)
{stringstream s;FOR(i,0,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename A, size_t N, typename T>void Fill(A (&array)[N], const T&v)
{fill((T*)array,(T*)(array+N),v);}
ll gcd(ll a,ll b){if(a>b)swap(a,b);for(;a>0;b%=a,swap(a,b));return b;}
int modpow(ll a,ll n,int m){if(a==0)return a;ll p=1;for(;n>0;n/=2,a=a*a%m)if(n&1)p=p*a%m;return(int)p;}
void dout(double d){printf("%.12f\n",d);}

const int iinf = 1e9;
const ll linf = 1e18;
const int mod = 1e9+7;
const double pi = acos(-1);
const double eps = 1e-10;
int h, w, x, y;
main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> h >> w >> x >> y;
  if(h%x){
    cout << "Yes\n";
    int d = h/x;
    FOR(i, 0, h){
      FOR(j, 0, w){
        if((j+1)%y==0){
          if(i%x==0){
            cout << d+1;
          }else if((i+1)%x==0){
            cout << -(d+2);
          }else{
            cout << 0;
          }
        }else{
          cout << 0;
        }
        if(j < w-1)cout << " ";
      }
      cout << "\n";
    }
  }else if(w%y){
    cout << "Yes\n";
    int d = w/y;
    FOR(i, 0, h){
      FOR(j, 0, w){
        if((i+1)%x==0){
          if(j%y==0){
            cout << d+1;
          }else if((j+1)%y==0){
            cout << -(d+2);
          }else{
            cout << 0;
          }
        }else{
          cout << 0;
        }
        if(j < w-1)cout << " ";
      }
      cout << "\n";
    }
  }else{
    cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 1408
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < s.length(); i++) {
            sb.append("x");
        }
        System.out.println(sb.toString());
    }
}


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

using namespace std;

#define REP(i,n) for(int i=0; i<int(n); i++)
#define FOR(i,m,n) for(int i=int(m); i<int(n); i++)
#define ALL(obj) (obj).begin(),(obj).end()
#define VI vector<int>
#define VLL vector<long long>
#define VVI vector<vector<int>>
#define VVLL vector<vector<long long>>
#define VC vector<char>
#define VS vector<string>
#define VVS vector<vector<string>>
#define VVC vector<vector<char>>
#define fore(i,a) for(auto &i:a)
typedef long long ll;
typedef pair <int, int> P;
const int  INF = 2147483647;
const ll INFL = 9223372036854775807;
const ll mod = 1000000007;

using namespace std;



int main() {
	string s;
	cin >> s;
	int a, b, c;
	a = b = c = 0;
	REP(i, s.size()) {
		if (s[i] == 'a')a++;
		else if (s[i] == 'b')b++;
		else c++;
	}
	if (max({ a,b,c }) - min({ a,b,c }) <= 1)cout << "YES" << endl;
	else cout << "NO" << endl;
	return 0;
}

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

typedef long long ll;
const int maxn = 100005;
typedef pair<int, int>par;
const ll mod = 1e9+7;

int main()
{
    cin.tie(0);
    ios_base::sync_with_stdio(0);
    #ifdef acm
    freopen("a.in", "r",stdin);
    #endif // acm


    ll x;
    cin >> x;

    ll val = 100;

    ll cont = 0;
    while( val < x ){
        cont ++;
        val += val / 100;
    }

    cout << cont << "\n";
    return 0;
}


Measured memory_bytes: 3620
#include <stdio.h>
#include <iostream>
#include <vector>
#include <string>
#include <bitset>

using namespace std;
#define bitmax 1000

string revstr( string s ) {
	string ret;
	for(int i = s.length() - 1; i >= 0; i--) {
		ret += s[i];
	}
	return ret;
}

int main(void){

	vector< char > ans;
	for(int i = 0; i < 10; i++)
		ans.push_back( '0' + i );
	for(int i = 0; i < 26; i++)
		ans.push_back( 'A' + i );

	while(1) {
		int N, M, Q;
		vector< bitset< bitmax > > S;
		vector< bitset< bitmax > > B;
		vector< bitset< bitmax > > P;

		cin >> N >> M >> Q;
		if( N == 0 && M == 0 && Q == 0 ) break;

		for(int i = 0; i < M; i++) {
			bitset< bitmax > P_i;
			P_i.reset();
			for(int j = 0; j < N; j++)
				P_i.set(j);
			P.push_back( P_i );
		}

		//データ取得
		for(int i = 0; i < Q; i++) {
			string S_i, B_i;
			cin >> S_i >> B_i;
			bitset< bitmax > Si( S_i );
			bitset< bitmax > Bi( B_i );
			S.push_back( Si );
			B.push_back( Bi );
			if( i > 0 ) S[i] ^= S[i-1]; 	//現在点灯しているスイッチ
			for(int j = 0; j < M; j++) {
				if( B[i][j] )//電球が点灯した場合
					P[j] &= S[i];
				else
					P[j] &= ~S[i];
			}
		}

		string str;
		for(int i = 0; i < P.size(); i++) {
			if( P[i].count() == 1 ) {
				for(int j = 0; j < N; j++)
					if( P[i][j] ) str += ans[N - 1 - j];
			} else
				str += '?';
		}
		cout << revstr(str) << endl;
		
	}

    return 0;
}

Measured memory_bytes: 1620
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define FOR(i, s, n) for (int i = (s); i < (n); i++)
#define RFOR(i, s, n) for (int i = (n) - 1; i >= (s); i--)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) RFOR(i, 0, n)
#define ALL(a) a.begin(), a.end()
#define IN(a, x, b) (a <= x && x < b)
const long long MOD = 1e9+7, INF = 1e18;
template<class T>inline bool CHMAX(T&a,T b){if(a<b){a=b;return true;}return false;}
template<class T>inline bool CHMIN(T&a,T b){if(a>b){a=b;return true;}return false;}



signed main(){
	int N;
	cin>>N;
	vector<int>a(N);
	REP(i,N)cin>>a[i];
	int sum = 0;
	REP(i,N){
		if(i%2)sum-=a[i];
		else sum += a[i];
	}
	vector<int>ret(N);
	ret[0] = sum;
	a[0] -= ret[0]/2;
	FOR(i,1,N){
		int ame = a[i-1];
		ret[i] = ame * 2;
		a[i] -= ame;
	}
	REP(i,N){
		if(i)cout<<" ";
		cout<<ret[i];
	}
	cout<<endl;
}

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

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

int main(){
	int K;
	cin >> K;
	int a[]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
	cout << a[K-1] << endl;

	return 0;
}

Measured memory_bytes: 256
import sys
from collections import defaultdict
readline = sys.stdin.buffer.readline
# sys.setrecursionlimit(10**8)


def geta(fn=lambda s: s.decode()):
    return map(fn, readline().split())


def gete(fn=lambda s: s.decode()):
    return fn(readline().rstrip())


def main():
    n = gete(int)
    a = list(geta(int))

    s = 0
    for ai in a:
        s ^= ai

    print(*[s ^ ai for ai in a], sep=" ")


if __name__ == "__main__":
    main()


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

const int maxn = 808;
int n, m, k, sx, sy, ans = maxn,  bio[maxn][maxn];
char c[maxn][maxn];
int dx[] = {-1, 0, 1, 0}, dy[] = {0, 1, 0, -1};

void solve(int x, int y){
	bio[x][y] = true;

	if(abs(x - sx) + abs(y - sy) > k){
		return;
	}

	for(int i = 0; i < 4; i++){
		int nx = x + dx[i], ny = y + dy[i];

		if(x >= 1 && x <= n && y >= 1 && y <= m && !bio[nx][ny] && c[nx][ny] == '.'){
			solve(nx, ny);
		}
	}

	int d = min(min(x - 1, n - x), min(y - 1, m - y));
	int tmp = d / k + bool(d % k);

	ans = min(ans, tmp);
}

int main(){
	ios_base::sync_with_stdio(false);

	cin >> n >> m >> k;

	for(int i = 1; i <= n; i++){
		for(int j = 1; j <= m; j++){
			cin >> c[i][j];

			if(c[i][j] == 'S'){
				sx = i, sy = j;
			}
		}
	}

	solve(sx, sy);

	cout << ans + 1 << endl;

	return 0;
}


Measured memory_bytes: 31232
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, from, to) for (int i = from; i < (to); ++i)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define pb push_back
using ll = long long;
using vin=vector<int>;
using vll=vector<ll>;
using vst=vector<string>;
using P = pair<ll,ll>;
const int inf=1e9+7;
const ll INF=9e18;
template <typename T> bool chmin(T &a, const T& b){if(a > b){a = b;return true;}return false;}
template <typename T> bool chmax(T &a, const T& b){if(a < b){a = b;return true;}return false;}
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };

int main(){cout<<fixed<<setprecision(20);
		   string s;
           cin>>s;
           int n=s.size();
           string c="";
           rep(i,0,n){
             if(s[i]!='x'){
              c+=s[i]; 
             }
           }
           string rev_c=c;
           reverse(all(rev_c));
           if(c!=rev_c){
            cout<<-1<<endl;
            return 0;
           }
           int l=0,r=n-1;
           int ans=0;
           while(l<=r){
             int cntl=0,cntr=0;
             while(s[l]=='x'){
              l++;
               cntl++;
             }
             while(s[r]=='x'){
              r--;
               cntr++; 
             }
             ans+=abs(cntr-cntl);
             l++;
             r--;
           }
           cout<<ans<<endl;
}

Measured memory_bytes: 3792
s = input()
t = input()
count_list = []

for i in range(len(s) - len(t) + 1):
    count = 0
    x = s[i:i+len(t)]
    # print(x)
    if x == t:
        print(0)
        exit()
    else:
        for j in range(len(x)):
            if x[j] != t[j]:
                count += 1
        count_list.append(count)

# print(count_list)
print(min(count_list))

Measured memory_bytes: 67976
#include<iostream>
#include<cstdio>
#include<vector>
#include<map>
#include<string>
#include<sstream>
#include<cmath>
#include<climits>
#include<algorithm>
#include<bitset>
#include<set>
#include<stack>
#include<queue>
#include<iomanip>
#include<memory.h>
#include<complex>
using namespace std;  
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
#define rep(i,n) for(ll i=0;i<(n);i++)  
#define pb push_back  
#define ALL(a) (a).begin(),(a).end()
#define FST first
#define SEC second  
const int INF = (INT_MAX/2);
const ll LLINF = (LLONG_MAX/2);
const double eps = 1e-5;
const double PI = M_PI;  
#define DEB cerr<<"!"<<endl
#define SHOW(a,b) cerr<<(a)<<" "<<(b)<<endl
#define SHOWARRAY(ar,i,j) REP(a,i)REP(b,j)cerr<<ar[a][b]<<((b==j-1)?((a==i-1)?("\n\n"):("\n")):(" "))
#define DIV int(1e9+7)
inline ll pow(ll x,ll n,ll m){ll r=1;while(n>0){if((n&1)==1)r=r*x%m;x=x*x%m;n>>=1;}return r%m;}

int main(){
  string a,b,c; cin >> a >> b >> c;
  cout << a[0] << b[0] << c[0] << endl;
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"log"
	"os"
	"strconv"
	"strings"
)

func countDiff(s, t string) int {
	diff := 0
	for i := 0; i < len(s); i++ {
		if s[i] != t[len(s)-1-i] {
			diff++
		}
	}
	return diff
}

func main() {
	scanner := makeWordScanner()
	s := eGetLine(scanner)
	count := 0
	if len(s)%2 == 1 {
		count = countDiff(s[0:len(s)/2], s[len(s)/2+1:])
	} else {
		count = countDiff(s[0:len(s)/2], s[len(s)/2:])
	}
	fmt.Println(count)
}

////////////////////////////////////////////////////////////////////////////////
// ライブラリ
////////////////////////////////////////////////////////////////////////////////
func makeScanner(maxByte int) *bufio.Scanner {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Buffer(make([]uint8, 0, 8192), maxByte)
	return scanner
}
func makeCharScanner() *bufio.Scanner {
	scanner := makeScanner(8192)
	scanner.Split(bufio.ScanRunes)
	return scanner
}
func makeWordScanner() *bufio.Scanner {
	scanner := makeScanner(8192)
	scanner.Split(bufio.ScanWords)
	return scanner
}
func eGetLine(r *bufio.Scanner) string {
	if r.Scan() {
		return r.Text()
	}
	err := r.Err()
	if err != nil {
		log.Fatal(err)
	}
	// EOF
	return ""
}
func eGetInt(r *bufio.Scanner) int {
	line := eGetLine(r)
	return eAtoi(line)
}
func eGetInt64(r *bufio.Scanner) int64 {
	line := eGetLine(r)
	return eAtoInt64(line)
}
func eGetFields(r *bufio.Scanner) []string {
	line := eGetLine(r)
	return strings.Fields(line)
}
func eGetInts(r *bufio.Scanner) []int {
	fields := eGetFields(r)
	ints := make([]int, len(fields))
	for i := 0; i < len(ints); i++ {
		ints[i] = eAtoi(fields[i])
	}
	return ints
}
func eGetInt64s(r *bufio.Scanner) []int64 {
	fields := eGetFields(r)
	ints := make([]int64, len(fields))
	for i := 0; i < len(ints); i++ {
		ints[i] = eAtoInt64(fields[i])
	}
	return ints
}
func eGetChars(r *bufio.Scanner) []string {
	line := eGetLine(r)
	return strings.Split(line, "")
}
func eAtoi(s string) int {
	n, err := strconv.Atoi(s)
	if err != nil {
		log.Fatal(err)
	}
	return n
}
func eAtoInt64(s string) int64 {
	n, err := strconv.ParseInt(s, 10, 64)
	if err != nil {
		log.Fatal(err)
	}
	return n
}


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

using namespace std;

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

	int i = 0, j = str.size() -1;
	int cnt = 0;
	bool flag = true;
	while( i <= j){
		if(str[i] == str[j]){
			i++;
			j--;
		}
		else{
			if(str[i] == 'x'){
				i++;
				cnt++;
			}
			else if(str[j] == 'x'){
				j--;
				cnt++;
			}
			else{
				flag = false;
				break;
			}
		}
	}
	if(!flag){
		cout << -1 << endl;
	}
	else{
		cout << cnt << endl;
	}


	return 0;
}



Measured memory_bytes: 512
#include<iostream>
#include<iomanip>
#include<vector>
#include<map>
#include<stack>
#include<queue>
#include<string>
#include<utility>
#include<algorithm>
#include<cmath>
#include<climits>
using namespace std;

using ll = long long;

void read();
template<typename First, typename... Rest> void read(First& first, Rest&... rest);
void write();
template<typename First, typename... Rest> void write(First first, Rest... rest);
template<typename T> void write_vec(vector<T>& v, char divider);

int main(){
    int A, B, C, D;
    read(A, B, C, D);
    while(true){
        C -= B;
        if(C <= 0) {
            write("Yes");
            break;
        }
        A -= D;
        if(A <= 0) {
            write("No");
            break;
        }
    }
    return 0;
}

//配列以外の入力を受け取る
void read(){

}
template<typename First, typename... Rest>
void read(First& first, Rest&... rest){
    cin >> first;
    read(rest...);
}
//
//配列以外を出力する
void write(){

}
template<typename First, typename... Rest>
void write(First first, Rest... rest){
    cout << first << " ";
    write(rest...);
}
//
//配列を区切って出力する
template<typename T>
void write_vec(vector<T>& v, char divider){
    for(size_t i = 0; i < v.size(); i++){
        cout << v[i] << divider;
    }
}
//

Measured memory_bytes: 3648
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <iomanip>
#include <stack>
#include <queue>
#include <numeric>
#include <map>
#include <unordered_map>
#include <set>
#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()
#define pb push_back
#define mod 1000000007
using ll = long long;
using namespace std;

int main(){
  string a,b,c;
  cin >> a >> b >> c;
  cout << a[0] << b[1] << c[2] << endl;
  return 0;
}


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

const int MAX_N = 201;
const int DX[] = {-1,0,1,0};
const int DY[] = {0,1,0,-1};
int N;
int X[MAX_N], Y[MAX_N];

int main() {
  X[0] = Y[0] = 0;
  while(cin >> N && N) {
    int sx,sy,ex,ey;
    sx = sy = 0;
    ex = ey = 1;
    vector<pair<pair<int,int>,int> > Q;
    for(int i = 1; i < N; ++i) {
      int n, d;
      cin >> n >> d;
      Q.push_back(make_pair(make_pair(n,d),i));
    }
    sort(Q.begin(), Q.end());
    for(int i = 0; i < Q.size(); ++i) {
      int p = Q[i].second;
      int t = Q[i].first.first;
      int d = Q[i].first.second;
      X[p] = X[t] + DX[d];
      Y[p] = Y[t] + DY[d];
      sx = min(sx,X[p]);
      sy = min(sy,Y[p]);
      ex = max(ex,X[p]+1);
      ey = max(ey,Y[p]+1);
    }
    cout << ex-sx << " " << ey-sy << endl;
  }
  return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>
#include <numeric>
#include <sstream>
#include <set>
#include <map>
#define LLMAX 9223372036854775807

using namespace std;
using ll = long long;

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

	vector<ll> argA(argN);
	for (ll i = 0; i < argN; ++i) {
		cin >> argA.at(i);
	}

	ll counter = 0;
	for (ll i = 0; i < argN; ++i) {
		if (argA.at(i) % 2 != 0) {
			counter++;
		}
	}

	if (counter % 2 == 0) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}
}

Measured memory_bytes: 1656
import java.util.*;
class Main{
    public static void main(String[] args){
	Scanner read = new Scanner(System.in);
	int[] fibo = new int[50];
	//make fibo
	fibo[0]=1;
	fibo[1]=1;
	for(int i=2; i<50; i++)fibo[i]=fibo[i-1]+fibo[i-2];

	while(read.hasNext()){
	    System.out.println(fibo[read.nextInt()]);
	}

    }
}

Measured memory_bytes: 12000
s = input()
n = len(s)


def dfs(i, f):
    if i == n - 1:
        return sum(list(map(int, f.split('+'))))

    return dfs(i + 1, f + s[i + 1]) + dfs(i+1, f + '+' + s[i+1])


print(dfs(0, s[0]))


Measured memory_bytes: 3060
#include<stdio.h>
int main()
{
    int i,j,n[10],k;
    for(i=0;i<10;i++)
    {
        scanf("%d",&n[i]);
    }
     for(i=0;i<10;i++)
        for(j=i+1;j<10;j++)
        {
            if(n[j]>n[i])
            {
                k=n[j];
                n[j]=n[i];
                n[i]=k;
            }
        }
        for(i=0;i<3;i++)
        printf("%d\n",n[i]);
        return 0;
}

Measured memory_bytes: 600
#include<iostream>
#include<string>
#include<map>
#include<algorithm>
using namespace std;
int main(){
   int x;
   cin>>x;
   pair<int,int>y[x];
   for(int i=0;i<x;i++){
       cin>>y[i].first>>y[i].second;
   }

   sort(y,y+x);

   for(int i=0;i<x;i++){
       cout<<y[i].first<<" "<<y[i].second<<endl;
   }
    return 0;
}


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

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, K;
    cin >> N >> K;
    vector<int> input(N);
    for (int i = 0; i < N; ++i) {
        cin >> input[i];
    }
    sort(input.begin(), input.end());
    if (input[input.size() - 1] < K) {
        cout << "IMPOSSIBLE" << endl;
    } else {
        int allGCD = input[0];
        for (int i = 1; i < input.size(); ++i) {
            allGCD = __gcd(allGCD, input[i]);
        }
        if (K % allGCD == 0) {
            cout << "POSSIBLE" << endl;
        } else {
            cout << "IMPOSSIBLE" << endl;
        }
    }
}


Measured memory_bytes: 640
#include <iostream>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <vector>
#include <set>
#include <map>
#include <stack>

using namespace std;

typedef long long ll;

const int k = 18;
const int N = 200100;
const int ZERO = int(1e9)+7;

ll t[N][k+1];
ll a[N], n;
int lg[N];
int L[N], R[N];

inline ll get(int l, int r) {
	int sz = lg[r - l];
	return min(t[l][sz], t[r - (1 << sz) + 1][sz]);
}

int main(){
	//freopen(".in", "r", stdin);
	//freopen(".out", "w", stdout);
	ios_base::sync_with_stdio(0);
	cin.tie(NULL);
	cin >> n;
	for (int i = 2; i < N; ++i)
		lg[i] = lg[i / 2] + 1;
	for(int i = 0; i < n; i++) cin >> a[i];
	for(int i = 0; i < n; i++) t[i][0] = a[i];
	for(int j = 1; j <= k; j++){
		for(int i = 0; i <= n - (1<<j); i++){
			t[i][j] = min(t[i][j-1], t[i+(1<<(j-1))][j-1]);
		}
	}

	// for (int i = 0; i < n; ++i)
	// 	for (int j = i; j < n; ++j)
	// 		cerr << i << " " << j << " " << get(i, j) << "\n";
	// cerr << endl;
	
	ll res = 0;
	for(int i = 0; i < n; i++){
		ll ans = ZERO;
		int l = i;
		int r = n - 1;
		while (r - l > 1) {
			int m = (l + r) / 2;
			if (get(i, m) < a[i])
				r = m;
			else
				l = m;
		}
		if (get(i, r) >= a[i])
			R[i] = r;
		else
			R[i] = l;
		
		l = 0;
		r = i;
		while (r - l > 1) {
			int m = (l + r) / 2;
			if (get(m, i) < a[i])
				l = m;
			else
				r = m;
		}
		if (get(l, i) >= a[i])
			L[i] = l;
		else
			L[i] = r;

		//cerr << L[i] << " " << R[i] << " " << a[i] << endl;
	}
	for (int i = 0; i < n; ++i) {
		int x = abs(L[i] - i) + 1;
		int y = abs(R[i] - i) + 1;
		res += a[i] * 1ll * x * y;
	}
	cout << res << endl;
}

Measured memory_bytes: 33920
import math
def per(n,r):
    return math.factorial(n)//math.factorial(n-r)

n,k=map(int,input().split())

if k%2==0:
    #偶数の時
    amari1=n//k
    amari2=n//(k-k//2)-amari1
    ans=amari1**3+amari2**3
else:
    amari=n//k
    ans=amari**3
print(ans)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define modulo 998244353
#define mod(mod_x) ((((long long)mod_x+modulo))%modulo)
#define Inf 100000000


int main(){
	
	int N;
	cin>>N;
	string S;
	cin>>S;
	
	int cnt = 0;
	int now = 0;
	for(int i=0;i<N;i++){
		if(S[i]=='(')now++;
		else now--;
		
		if(now<0){
			now=0;
			cnt++;
		}
	}

	S = string(cnt,'(') + S;
	
	now=0;
	for(int i=0;i<S.size();i++){
		if(S[i]=='(')now++;
		else now--;
	}
	
	cout<<S + string(now,')')<<endl;
	
    return 0;
}



Measured memory_bytes: 256
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner console = new Scanner(System.in);
        int fruitTypeNum = console.nextInt();
        int buyFruitNum = console.nextInt();
        console.nextLine();

        ArrayList<Integer> minPrices = new ArrayList<Integer>(fruitTypeNum);
        for(int i = 0; i < fruitTypeNum; i++){
            minPrices.add(console.nextInt());
        }
        Collections.sort(minPrices);

        int total = 0;
        for(int i = 0; i < buyFruitNum; i++){
            total += minPrices.get(i);
        }
        System.out.println(total);
    }
}


Measured memory_bytes: 39024
#include <cstdio>

int n;
int a[101];

int main(){
	scanf("%d", &n);
	for(int i=0; i<n; ++i){
		scanf("%d", &a[i]);
	}
	
	for(int i=n-1; i>0; --i){
		printf("%d ", a[i]);
	}
	printf("%d\n", a[0]);
}


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

int main() {

    int N;
    cin >> N;
    vector<int> v(N);
    for (int i=0;i<N;i++){
        cin >> v.at(i);
    }
    // sort, reverse
    sort(v.begin(), v.end());
    double ans_value = v.at(0);
    for(int i=1;i<N;i++){
        ans_value = (ans_value + v.at(i)) / 2.0;
    }
    cout << ans_value << endl;
}

Measured memory_bytes: 256
## coding: UTF-8
from decimal import *
from itertools import permutations, combinations,combinations_with_replacement,product
s = input().split()
t = [int(p) for p in s]

N = t[0]
K = t[1]

#p = int(N/K)
#a = N - p * K
a = Decimal(N % K)
b = Decimal(K - a)
#print('N:{}, K:{}, p:{}, a:{}, b:{}'.format(N,K,p,a,b))
print(min(a,b))
# 1000000000000000000

Measured memory_bytes: 5460
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define dup(x,y) (((x)+(y)-1)/(y))
#define ALL(x) (x).begin(), (x).end()
typedef long long ll;
typedef pair<int, int> pii;
const double EPS = 1e-10;
const int INF = 1e9;
const ll LINF = 1e15;
const int MOD = 1e9+7;
const double PI = acos(-1);
int dx[4] = {0,1,0,-1};
int dy[4] = {1,0,-1,0};
typedef pair<ll, ll> pll;
long long n, k;
long long a[200005];

bool check(int x){
  int cnt = 0;
  for (int i=0; i<n; i++){
    cnt += (a[i] - 1) / x;
  }
  if(cnt <= k) return true;
  else return false;
}

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

  long long left = 0;
  long long right = INF;

  while(right - left > 1){
    
    long long mid = (left + right) / 2;
    
    if(check(mid))right = mid;
    else left = mid;
    // cout << left << " " << right << endl;
  }
  cout << right << endl;
}


Measured memory_bytes: 5128
#include<stdio.h>
int main(void)
{
	int a;
	scanf("%d",&a);
	
	if(a==0){
		printf("0\n");
	}
	else if(a==100){
		printf("1\n");
	}
	else if(a==10){
		printf("1\n");
	}
	else if(a==1){
		printf("1\n");
	}
	else if(a==110){
		printf("2\n");
	}
	else if(a==11){
		printf("2\n");
	}
	else if(a==101){
		printf("2\n");
	}
	else if(a==111){
		printf("3\n");
	}
	
	return 0;
}

Measured memory_bytes: 128
#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"; }
}
const ll MAX = MOD;

void solve(){
  int N; cin>>N;
  cout << !N << "\n";
}

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

Measured memory_bytes: 3636
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<sstream>
#include<set>
#include<map>
#include<numeric>
#include<limits>
#include <cstdint>
using namespace std;
#define rep(N) for(int i=0;i<N;i++)
#define rep2(N1,N2) for(int i=0;i<N1;i++)for(int j=0;j<N2;j++)
#define rep3(N1,N2,N3)for(int i=0;i<N1;i++)for(int j=0;j<N2;j++)for(int k=0;k<N3;k++)
#define For(i,N) for(int i=0;i<N;i++)
#define ll long long int
void yn(bool b) {
	if (b)printf("yes\n");
	else printf("no\n");
}

void Yn(bool b) {
	if (b)printf("Yes\n");
	else printf("No\n");
}

void YN(bool b) {
	if (b)printf("YES\n");
	else printf("NO\n");
}

int ctoi(char c) {
	return c - '0';
}

ll kai(ll x) {
	ll a = 1;
	if (x <= 0)
		return 1;
	else {
		for(ll i=0;i<x;i++)
			a = a * (i + 1);
		return a;
	}
}

ll rui(ll x, ll y) {
	ll a = 1;
	for (ll i = 0; i < y; i++)
		a = a * x;
	return a;
}
const int nmax = 150;
int cccc[nmax][nmax];
ll comb(ll n, ll k) {
	if (n < k) {
		cout << "error n<k"<<endl;
		return -1;
	}
	if (cccc[n][k] > 0)return cccc[n][k];
	if (k == 0 || n == k)return 1;
	return cccc[n][k] = comb(n - 1, k - 1) + comb(n - 1, k);
}

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

ll lcm(ll a, ll b)
{
	return a * b / gcd(a, b);
}
int main() {
	//cout.precision(20);
	string S;
	cin >> S;
	if (S == "SUN")
		cout << 7;
	else if (S == "MON")
		cout << 6;
	else if (S == "TUE")
		cout << 5;
	else if (S == "WED")
		cout << 4;
	else if (S == "THU")
		cout << 3;
	else if (S == "FRI")
		cout << 2;
	else if (S == "SAT")
		cout << 1;
}

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

int main()
{
  int N, X, min=1000;
  cin >> N >> X;
  vector<int> m(N);
  rep(i, N){
    cin >> m.at(i);
    X-=m.at(i);
    if(m.at(i)<min) min=m.at(i);
  }
  cout << N+X/min << endl;
}

Measured memory_bytes: 256
#define REP(i, n) for(int i = 0; i < (int)(n); i++)

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

int main() {
	int P, Q, R;
	cin >> P >> Q >> R;

	if (P >= Q && P >= R) {
		cout << Q + R << endl;
	} 
	else if (Q >= P && Q >= R) {
		cout << P + R << endl;
	}
	else {
		cout << P + Q << endl;
	}

	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<cstring>
#include<functional>
#include<stack>
#include<queue>
#include <iomanip>
#include<map>
#include<limits>
#include<cmath>
#include<algorithm>
#include<bitset>
#include<utility>
#include<complex>
#include<cstdlib>
#include<set>
#include<cctype>

#define DBG cerr << '!' << endl;
#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define rep(i,s,g) for(ll (i) = (s);(i) < (g);++i)
#define rrep(i,s,g) for(ll (i) = (s);i >= (g);--(i))
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {for(int W = 0;W < (n);W++)cerr << v[W] << ' ';cerr << endl << endl;}
#define SHOW2d(v,i,j) {for(int aaa = 0;aaa < i;aaa++){for(int bbb = 0;bbb < j;bbb++)cerr << v[aaa][bbb] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(10)

using namespace std;

typedef long long ll;
typedef vector<int> iv;
typedef vector<iv> iiv;
typedef vector<string> sv;

char dp[100010];
int n;
string str;

bool check()
{
	for(int i = 2;i <= n+1;i++)
	{
		if(dp[i-2] == 'S')
		{
			if(dp[i-1] == 'S')
			{
				if(str[i-1] == 'o')dp[i] = 'S';
				else dp[i] = 'W';
			}
			else
			{
				if(str[i-1] == 'o')dp[i] = 'W';
				else dp[i] = 'S';
			}
		}
		else
		{
			if(dp[i-1] == 'S')
			{
				if(str[i-1] == 'o')dp[i] = 'W';
				else dp[i] = 'S';
			}
			else
			{
				if(str[i-1] == 'o')dp[i] = 'S';
				else dp[i] = 'W';
			}
		}
	}
	if(dp[0]==dp[n]&&dp[1]==dp[n+1])
	{
		return true;
	}
	else
	{
		return false;
	}
}

int main()
{
	cin >> n;
	cin >> str;
	str += str[0];
	str += str[1];
	
	dp[0] = 'S';dp[1] = 'S';
	if(check()){REP(i,n)cout << dp[i];cout << endl;return 0;}
	dp[0] = 'S';dp[1] = 'W';
	if(check()){REP(i,n)cout << dp[i];cout << endl;return 0;}
	dp[0] = 'W';dp[1] = 'S';
	if(check()){REP(i,n)cout << dp[i];cout << endl;return 0;}
	dp[0] = 'W';dp[1] = 'W';
	if(check()){REP(i,n)cout << dp[i];cout << endl;return 0;}
	
	cout << -1 << endl;
	
	return 0;
}

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

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

    int t = 0;
    for (int i = 0; i < 3; i++) t += s[i] == 'o';

    cout << 700 + 100 * t << endl;

    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
#include<vector>
#include<math.h>
#include<queue>
#include<map>
#include<algorithm>
#include<string.h>
#include<functional>
#include<limits.h>
#include<stdlib.h>
#include<cmath>
#include<cstring>
#include<set>
#include<climits>
#include<deque>
#include <iomanip>
#include<utility>
using namespace std;

#define intmax INT_MAX
#define lmax LONG_MAX
#define uintmax UINT_MAX
#define ulmax ULONG_MAX
#define llmax LLONG_MAX
#define ll long long
#define rep(i,a,N) for((i)=(a);(i)<(N);(i)++)
#define rrp(i,N,a) for((i)=(N)-1;(i)>=(a);(i)--)
#define llfor ll i,j
#define sc(a) cin>>a
#define pr(a) cout<<a<<endl
#define pY puts("YES")
#define pN puts("NO")
#define py puts("Yes")
#define pn puts("No")
#define pnn printf("\n")
#define all(a) a.begin(),a.end()
#define push(a,b) (a).push_back(b)
#define llvec vector<vector<ll>>
#define charvec vector<vector<char>>
#define size(a,b) (a,vector<ll>(b))
#define llpvec vector<pair<ll,ll>>
llfor;ll mod=1000000007;
/*pi*/double pi=acos(-1);
/*繰り上げ除算*/ll cei(ll x,ll y){ll ans=x/y;if(x%y!=0)ans++;return ans;}
/*最大公約数*/ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}
/*最小公倍数*/ll lcm(ll x,ll y){return x/gcd(x,y)*y;}
/*n乗*/ll llpow(ll x,ll n){ll ans=1;rep(i,0,n){ans*=x;ans%=mod;}return ans;}
/*階乗*/ll fact(ll x){ll ans=1;rep(i,0,x)ans*=(x-i);return ans;}
/*nCr*/ll ncr(ll n,ll r){return fact(n)*fact(n-r)/fact(r);}
/*nPr*/ll npr(ll n,ll r){return fact(n)/fact(n-r);}
/*primejudge*/bool prime(ll a){if(a<=1)return false;for(i=2;i*i<=a;i++){if(a%i==0)return false;}return true;}
/*Fibonacci数列*/ll fib(ll x){ll fibo[x+10];fibo[0]=1;fibo[1]=1;fibo[2]=1;rep(i,3,x+1)fibo[i]=fibo[i-1]+fibo[i-2];return fibo[x];}
/*桁数*/ll dig(ll n){ll d=1,tmp=n;while(tmp/10>0){tmp/=10;d++;}return d;}
ll ans=0;
////////////////////////////////////////////////////////////
int main(){
 string s,t;
 cin>>s;
 cin>>t;
 ll n=s.length();
 map<char,char>a,b;
 rep(i,0,26){
  a['a'+i]='0';
  b['a'+i]='0';
 }
 rep(i,0,n){
  //cout<<i<<" "<<a[s[i]]<<" "<<t[i]<<endl;
  if(a[s[i]]!=t[i]&&a[s[i]]!='0'){
   pn;return 0;
  }
  if(b[t[i]]!=s[i]&&b[t[i]]!='0'){
   pn;return 0;
  }
  a[s[i]]=t[i];
  b[t[i]]=s[i];
 }
 py;
return 0;}

Measured memory_bytes: 3888
#include<iostream>
#include<string>
#include<vector>

using namespace std;
#define ll long long
int F[105][11];
int P[105][11];

int main(){
    int N,A,B;
    int ans = -1e9;
    cin >> N;
    for(int i = 0; i < N; i++){
        for(int j = 0; j < 10; j++){
            cin >> F[i][j];
        }
    }
    for(int i = 0; i < N; i++){
        for(int j = 0; j < 11; j++){
            cin >> P[i][j];
        }
    }

    for(int bit = 1; bit < 1 << (10); bit++){
        // ある種類のbit探索のたびに初期化
        int sum = 0;
		for(int j = 0; j < N; j++){
            int cnt = 0;
            for(int k = 0; k < 10; k++){
			    if (bit & (1 << k) && F[j][k]) cnt++;
            }
            sum += P[j][cnt];
		}
        ans = max(ans, sum);
    }
    
    cout << ans << endl;
}

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

using namespace std;

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

int main(){
	IOS;
	int n,a,b;
	while(cin>>n>>a>>b){
		int ans;
		ans=min(a*n,b);
		cout<<ans<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
	int N, M;
	int A[100];
	int B[100][100];
	int score[100] = {0};
	int i, j;
	if (scanf("%d", &N) != 1) return 1;
	if (scanf("%d", &M) != 1) return 1;
	for (i = 0; i < M; i++) {
		if (scanf("%d", &A[i]) != 1) return 1;
	}
	for (i = 0; i < M; i++) {
		for (j = 0; j < N; j++) {
			if (scanf("%d", &B[i][j]) != 1) return 1;
		}
	}
	for (i = 0; i < M; i++) {
		int hazure = 0;
		for (j = 0; j < N; j++) {
			if (A[i] == B[i][j]) {
				score[j]++;
			} else {
				hazure++;
			}
		}
		score[A[i] - 1] += hazure;
	}
	for (i = 0; i < N; i++) printf("%d\n", score[i]);
	return 0;
}

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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define eb emplace_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second

using vint=vector<int>;
using pint=pair<int,int>;
using vpint=vector<pint>;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

template<class A,class B>
ostream& operator<<(ostream& ost,const pair<A,B>&p){
    ost<<"{"<<p.first<<","<<p.second<<"}";
    return ost;
}

template<class T>
ostream& operator<<(ostream& ost,const vector<T>&v){
    ost<<"{";
    for(int i=0;i<v.size();i++){
        if(i)ost<<",";
        ost<<v[i];
    }
    ost<<"}";
    return ost;
}

inline int topbit(unsigned long long x){
    return x?63-__builtin_clzll(x):-1;
}

inline int popcount(unsigned long long x){
    return __builtin_popcountll(x);
}

inline int parity(unsigned long long x){
    return __builtin_parity(x);
}
vector<string>lis={"AC","WA","TLE","RE"};
int N;
vector<string>S;
signed main(){
	cin>>N;
	S.resize(N);
	rep(i,N)cin>>S[i];

	for(auto s:lis){
		int cnt=count(all(S),s);
		cout<<s<<" x "<<cnt<<endl;
	}
    return 0;
}



Measured memory_bytes: 6428
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,s,n) for (int i = (s); i < (n); ++i)
#define rrep(i,n,g) for (int i = (n)-1; i >= (g); --i)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define len(x) (int)(x).size()
#define dup(x,y) (((x)+(y)-1)/(y))
#define pb push_back
#define Field(T) vector<vector<T>>
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main(){
  int x;
  cin >> x;
  if (x == 0) cout << 1 << endl;
  else cout << 0 << endl;
   return 0;
}

Measured memory_bytes: 3616
dic = {}
n = int(input())
S = [input() for _ in range(n)]

for t in S[0]:
    for tt in t:
        if tt in dic:
            dic[tt] += 1
        else:
            dic[tt] = 1
    
for s in S[1:]:
    temp = {}
    for ss  in s:
        if ss in temp:
            temp[ss] += 1
        else:
            temp[ss] = 1
    for d in dic:
        if d in temp:
            dic[d] = min(dic[d],temp[d])
        else:
            dic[d] = 0
ans = []
for k,n in zip(dic.keys(),dic.values()):
    for j in range(n):
        ans.append(k)
ans.sort()
print("".join(ans))

Measured memory_bytes: 3064
#
# abc055 a
#
import sys
from io import StringIO
import unittest


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """20"""
        output = """15800"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """60"""
        output = """47200"""
        self.assertIO(input, output)


def resolve():
    N = int(input())

    x = N*800
    y = N//15*200
    print(x-y)


if __name__ == "__main__":
    # unittest.main()
    resolve()


Measured memory_bytes: 15956
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		Main main = new Main();
		int ans=0;
		for (int i = A; i <= B; i++) {
			String s = Integer.toString(i);
			if (main.chkPalindrome(s)) {
				ans++;
			}
		}
		System.out.println(ans);

	}

	public boolean chkPalindrome(String string) {
		int len = string.length();
		int right = len - 1;
		int left = 0;
		while (true) {
			if (len % 2 == 0 && right < left) {
				break;
			} else if (len % 2 == 1 && right == left) {
				break;
			}
			if (string.charAt(left) != string.charAt(right)) {
				return false;
			}
			left++;
			right--;
		}
		return true;
	}

}


Measured memory_bytes: 40672
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <vector>
#include <string>
#include <algorithm>
#include <functional>
using namespace std;
#pragma warning (disable: 4996)

int N; string S, T;

int main() {
	cin >> N >> S;
	T = S;
	sort(T.begin(), T.end());

	int cnt = 0;
	for (int i = 0; i < S.size(); i++) {
		if (S[i] != T[i]) cnt++;
	}
	cout << (cnt + 1) / 2 << endl;
	return 0;
}

Measured memory_bytes: 3876
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
#include <bitset>
#include <set>
#include <cmath>
#include <cassert>
using namespace std;
#define MOD 1000000007

int func(long long n){
    string s = to_string(n);
    int ret = 0;
    for(char c : s)
        ret += c - '0';
    return ret;
}

int main(){
    vector<long long> cand;
    long long fac = 1;
    for(int d=0; d<15; d++){
        for(int i=1; i<10000; i++){
            long long n = fac * i + fac - 1;
            cand.push_back(n);
        }
        fac *= 10;
    }
    sort(cand.begin(), cand.end());
    cand.erase(unique(cand.begin(), cand.end()), cand.end());

    int K;
    cin >> K;
    int i = 0;
    vector<long long> ans;
    vector<double> hoge(cand.size());
    for(int i=0; i<cand.size(); i++){
        long long x = cand[i];
        hoge[i] = 1.0*x/func(x);
    }
    while(K > 0){
        long long x = cand[i];
        assert(i < cand.size());
        bool snuke = true;
        for(int j=i+1; j<cand.size(); j++){
            if(hoge[i] > hoge[j]){
                snuke = false;
                break;
            }
        }
        if(snuke){
            K--;
            ans.push_back(x);
        }
        i++;
    }
    for(auto x : ans)
        cout << x << endl;

    return 0;
}


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

int main() {
  int N;
  string S;
  cin >> N;
  cin >> S;
  vector<int> d(N,0);
  string divide[N];
  for(int i=0;i<N;i++){
    divide[i]=S.substr(0, i+1);
  }
  int p=0,s=0;
  for(int i=0;i<N;i++){
    if(S[i]=='(') p++;
    if(S[i]==')') s++;
  }
  int sum = p-s;
  //cout << sum << endl;
  //cout <<divide[1]<< endl;
   p=0;
   s=0;
  for(int i=0;i<N;i++){
    //cout <<divide[i]<< endl;
    for(int j=0;j<i+1;j++){
      if(divide[i][j]=='(') p++;
      if(divide[i][j]==')') s++;
    }
    d[i]= p-s;
    //cout << p<<s << endl;
    p=0;
    s=0;
  }
  sort(d.begin(),d.end());

  int m= d[0];
  //cout << m << endl;
  m = min(0,m);
  for(int i=0;i<-m;i++){
    S = '('+S;
  }
  sum += -m;
  //cout << m << endl;
  for(int i=0;i<sum;i++){
    S = S+')';

  }
  cout << S << endl;
}


Measured memory_bytes: 256