akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <stdio.h>
#include <iomanip>
#include <limits>
#include <list>
#include <string>
#include <queue>
#include <deque>
#include <tuple>
#include <map>
#include <sstream>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define FOR(i,a,b) for(int i=a; i<(int)(b); i++)
#define ALL(x) (x).begin(),(x).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define SORT(c) sort(ALL(x))
#define CLR(a) memset((a), 0 ,sizeof(a))
#define PB push_back
#define MP make_pair
#define SP << " " <<
const int INF = 1001001001;
const ll LINF = 100100100100100100;
const double EPS = 1e-10;
const long double PI  = acos(-1.0L);
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
#define chmax(a,b) a = (((a)<(b))?(b):(a))
#define chmin(a,b) a = (((a)>(b))?(b):(a))

__attribute__((constructor))
void initial(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
}

signed main(){
  int n; cin>>n;
	int a[4];
	REP(i,4){
		a[i]=n%10; n/=10;
	}
	rep(i,1<<3){
		int ans = a[0];
		char op[3];
		int bit = i;
		rep(i,3){
			if(bit%2) ans+=a[i+1], op[i]='+';
			else ans-=a[i+1], op[i]='-';
			bit/=2;
		}
		if(ans==7){
			cout << a[0];
			rep(i,3){
				cout<<op[i];
				cout<<a[i+1];
			}
			cout<<"=7"<<endl;
			return 0;
		}
	}
  return 0;
}


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

#define int long long
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define all(v) (v).begin(),(v).end()
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
#define pb push_back
#define fi first
#define se second
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;}

int N,S;

signed main(){
    cin>>N>>S;
    for(int b=2;b*b<=N;b++){
        int sum=0;
        int n=N;
        while(n){
            sum+=n%b;
            n/=b;
        }
        if(sum==S){
            cout<<b<<endl;
            return 0;
        }
    }

    int mi=1001001001001001001ll;
    if(N==S){
        mi=N+1;
    }

    for(int i=1;i*i<=N;i++){
        int tmp=S-i;
        if(tmp<0)continue;
        if(N-tmp<0)continue;
        if((N-tmp)%i)continue;
        int b=(N-tmp)/i;
        if(b<2)continue;
        if(N/b!=i)continue;
        if(N%b!=tmp)continue;
        if(b<1000000000&&b*b<=N)continue;
        chmin(mi,b);
    }

    if(mi!=1001001001001001001ll)cout<<mi<<endl;
    else cout<<-1<<endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.*;

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

        String[] pat1 = { "keyence", "k",      "ke",    "key",  "keye", "keyen", "keyenc" };
        String[] pat2 = { "",        "eyence", "yence", "ence", "nce",  "ce",    "e"};

        boolean flg = true;

        for(int i = 0; i < 7; i++){
            if(pat1[i].equals(str.substring(0,pat1[i].length()))){
                if(pat2[i].equals(str.substring(str.length() - pat2[i].length(), str.length()))){
                    System.out.println("YES");
                    flg = false;
                    break;
                }
            }
        }
        if(flg){
            System.out.println("NO");
        }
    }
}


Measured memory_bytes: 24020
while True:

    m, f, r = map(int, input().split())

    if m == -1 and f == -1:
        break

    elif m == -1 or f == -1:
        print('F')

    elif m + f >= 80:
        print('A')

    elif m + f < 80 and m + f >= 65:
        print('B')

    elif m + f < 65 and m + f >=50 or r >= 50:
        print('C')

    elif m + f < 50 and m + f >= 30:
        print('D')

    elif m + f < 30:
        print('F')



Measured memory_bytes: 5592
#import <stdio.h>
int main() {
    int a,b;
    scanf("%d %d",&a,&b);
    if(a==b) {
        printf("Draw");
        return 0;
    }
    if(a==1) {
        printf("Alice");
        return 0;
    }
    if(b==1) {
        printf("Bob");
        return 0;
    }
    if(a>b) {
        printf("Alice");
        return 0;
    }
    printf("Bob");
}


Measured memory_bytes: 2164
#include<bits/stdc++.h>
using namespace std;
#define pb emplace_back
#define int long long
#define endl "\n"
#define pii pair<int,int> 
#define ff first
#define ss second
#define mii map<int,int>
#define si set<int>
#define sti stack<int>
#define qi queue<int>
#define vi vector<int>
#define pq priority_queue<int>
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
const int M=998244353;
 
int32_t main(){
	int n;
	cin>>n;
	pii p[n];
	for(int i=0;i<n;i++){
		int x,y;
		cin>>x>>y;
		p[i]={y,x};
	}
	sort(p,p+n);
	int sum=0;
	for(int i=0;i<n;i++){
		if(sum+p[i].ss>p[i].ff){
			cout<<"No";
			return 0;
		}
		sum+=p[i].ss;
	}
	cout<<"Yes";
}

Measured memory_bytes: 3328
#include<iostream>
#include<cstdio>
#include<string>
#include<cmath>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
using namespace std;
#define rep(i,ra,re) for((i)=ra;(i)<(re);(i)++)
#define _rep(i,ra,re) for((i)=ra;(i)>(re);(i)--)
#define rep_(i,ra,re) for((i)=ra;(i)<=(re);(i)++)
#define _rep_(i,ra,re) for((i)=ra;(i)>=(re);(i)--)
#define put(n) cout << n << " "; 
#define puts(n) cout << n << endl;
#define pu(n) cout << n;
#define mod 1000000007
int i,j,k,l;
static const int MAX_N=10e5;
int maxs=0,maxi,maxsec=0;
int main(void){
	int N;
		cin >> N;
	rep(i,0,N){
		int a;
			cin >> a;
		if(maxs<a){
			maxs=a;
			maxi=i;
		}else if(maxsec<a){
			maxsec=a;
		}
	}
	rep(i,0,N){
		puts((i==maxi?maxsec:maxs));
	}
	return 0;
}


Measured memory_bytes: 1664
#include <bits/stdc++.h>
using namespace std;
/* typedef */
typedef long long ll;
typedef pair<int, int> pii;
/* constant */
const int INF = 1 << 30;
const ll LINF = 1LL << 50;
const int NIL = -1;
const int MAX = 10000;
const int mod = 1000000007;
const double pi = 3.141592653589;
/* global variables */
/* function */
/* main */
int main(){
    string S;
    cin >> S;
    for (int i = 0; i < S.size(); i++) {
        if (i % 2 == 0) cout << S[i];
    }
    cout << '\n';
}


Measured memory_bytes: 512
#include<iostream>
#include<string>
#include<vector>
#include<math.h>
#define long long ll
using namespace std;
int main()
{
	int a, b, c;
	cin >> a >> b >> c;
	if (a == b)
	{
		if (a != c)
		{
			cout << "Yes";
			exit(0);
		}
		else cout << "No";
	}
	else if (a == c)
	{
		if (a != b)cout << "Yes";
		else cout << "No";
	}
	else if (b == c)
	{
		if (b != a)cout << "Yes";
		else cout << "No";
	}
	else cout << "No";
}



Measured memory_bytes: 3572
S = input()
ans = 0
for i in range(2 ** (len(S) - 1)):
	bit = bin(i)[2:].rjust(len(S) - 1, "0")
	# print("bit", bit)
	start = 0
	tmp = 0
	for j in range(len(bit)):
		if bit[j] == "1":
			tmp += int(S[start: j + 1])
			start = j + 1
			# print("now", j, tmp)
		if j == len(bit) - 1:
			tmp += int(S[start:])
	# print("tmp", tmp)
	ans += tmp
print(ans)


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

#define int long long
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<double, int> pdi;
typedef pair<ll, ll> pll;
 
# define S second
# define F first
# define kill(x) return(cout << x << endl, 0)
# define debug(x) cerr<< #x << " : " << x << endl
# define ddebug(x, y) cerr<< #x << " : " << x  << ", " << #y << " : " << y << endl
# define sz(s) (int)s.size()
# define sq(x) (x) * (x)
# define PB(x) push_back(x)
# define smax(x, y) (x) = max((x), (y))
# define smin(x, y) (x) = min((x), (y))
# define all(x) x.begin(), x.end()
# define SP fixed << setprecision(10)
# define UB upper_bound 

const int MAXN = 200 * 1000 + 10;
int ans[MAXN];

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

	int n, x;
	cin >> n >> x;
	if (x == 1 || x == 2 * n - 1)
		kill("No");
	cout << "Yes" << endl;
	ans[n - 1] = x;
	ans[n] = 1;
	ans[n - 2] = 2 * n - 1;

	int a = 2;
	for (int i = 0; i < 2 * n - 1; i ++)
	{
		if (a == x)
			a ++;
		if (i <= n && i >= n - 2)
			continue;
		ans[i] = a;
		a ++;
	}
	for (int i = 0; i < 2 * n - 1; i ++)
		cout << ans[i] << "\n";

	return 0;
}


Measured memory_bytes: 3072
package main

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

func solve() {
	n := getInt()

	ans := n
	for i := 1; i <= (n+1)/2; i++ {
		a, b := i, n-i
		x := calc(a) + calc(b)
		ans = min(ans, x)
	}

	fmt.Fprintln(wr, ans)
}

func calc(n int) int {
	ret := 0
	for n > 0 {
		ret += n % 10
		n /= 10
	}
	return ret
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

// -----------------------------------------

var (
	sc = bufio.NewScanner(os.Stdin)
	wr = bufio.NewWriter(os.Stdout)
)

func main() {
	// buf := 200001
	// sc.Buffer(make([]byte, buf), buf)
	sc.Split(bufio.ScanWords)
	solve()
	wr.Flush()
}

func getInt() int {
	sc.Scan()
	i, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return i
}

func getIntSlice(n int) []int {
	is := make([]int, n)
	for i := range is {
		is[i] = getInt()
	}
	return is
}

func getString() string {
	sc.Scan()
	s := sc.Text()
	return s
}

func getRunes() []rune {
	return []rune(getString())
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
int main() {
    int n,cnt=0,ans=0,sum=0,o=0;
    string s;
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    cout<<c+(b-d)<<" "<<d+(c-a)<<" "<<a+(b-d)<<" "<<b+(c-a)<<endl;
}


Measured memory_bytes: 256
/*
  自然数x, yの和と排他的論理和が一致する条件は、
  「xのi桁目とyのi桁目が両方1になってしまうようなiが存在しないこと」である。
  言い換えると、「xとyを足したときに一度も繰り上がりが起こらないこと」である。

  より一般に、自然数列Sの「総和」と「総排他的論理和」が一致する条件は、
  「S(i)のk桁目とS(j)のk桁目が両方1になってしまうようなi, j, kが存在しないこと」である。
  こちらもやはり、「Sの総和を計算したときに一度も繰り上がりが起こらないこと」と言い換えられる。

  従って、この問題を解くには尺取り法を使えばよい。
  いま「aの部分数列a'={a[b], a[b+1], ... ,a[e-1]}が上に書いた『条件』を満たしているが、
  a'にa[e]を追加すると『条件』を満たさなくなってしまう」という状況だとすると、
  a'が「a[b]から始まる部分数列で『条件』を満たす最長のもの」だとわかる。
  また、a'が『条件』を満たしているとき、a'の任意の部分数列もまた『条件』を満たすとわかる。
  このとき「a'の部分数列で、かつa[b]から始まるもの」の数はe-bである。
  よってこういった状況になるたびに、0で初期化された変数ansにe-bを加算してやれば、最終的に

  ans =
    「aのa[0]から始まる部分数列で『条件』を満たすものの個数」 +
    「aのa[1]から始まる部分数列で『条件』を満たすものの個数」 +
    ...
    「aのa[n-1]から始まる部分数列で『条件』を満たすものの個数」

  となり、答えが求まったことになる。
*/
#include <iostream>
#include <vector>
int main()
{
    /* 入力の受け取り */
    long long n;
    std::cin >> n;
    std::vector<long long> a(n);
    for (long long i = 0; i < n; ++i)
        std::cin >> a[i];

    /* 尺取り法で使う変数 */
    /* 見ている区間の始点と終点 */
    long long b = 0, e = 0;
    /* set[i] = trueのとき、a[b], a[b+1], ... , a[e-1] の中に(二進表記したときの)i桁目が1であるようなものが含まれている。*/
    /* 最初はb = e = 0、つまり考えているのは空区間なので全てfalseで初期化すればよい。 */
    /* なお、問題文の制約よりa[i] < 2^20なので要素数は20個あれば十分。*/
    const long long d = 20;
    std::vector<bool> set(d, false);
    /* 最終的な答え */
    long long ans = 0;

    while (b != n) {
        /* is_okは「a[e]を追加できるか否か」。*/
        /* e == nのときそもそもa[n]は追加できないので、その時点でfalseになる。 */
        bool is_ok = e != n;
        /* e != nだったとしても、(eのi桁目)=1かつset[i]=trueになってしまうようなiが存在する場合はやはり追加できない。*/
        if (is_ok)
            for (long long i = 0; i < d; ++i)
                is_ok &= !(((a[e] >> i) & 1) && (set[i]));

        /* 無事条件をクリアした場合はsetにa[e]の分を追加し、eをインクリメントする。 */
        if (is_ok) {
            for (long long i = 0; i < d; ++i)
                if ((a[e] >> i) & 1) set[i] = true;
            ++e;
        }
        /* できなかった場合はa[b]～a[e-1]が「a[b]から始まる部分列で条件を満たす最長のもの」なので、
           e-bをansに足し、a[b]の分を除外する。 */
        else {
            ans += e - b;
            for (long long i = 0; i < d; ++i)
                if ((a[b] >> i) & 1) set[i] = false;
            ++b;
        }
    }
    std::cout << ans << std::endl;
}


Measured memory_bytes: 4824
using System;
namespace 令和{
    class ABC{
        static void Main(){
            int s = int.Parse(Console.ReadLine());
            bool ym;
            bool my;
            ym = (0<s%100 && s%100<13);
            my = (0<s/100 && s/100<13);
            if(ym){
                if(my){
                    Console.WriteLine("AMBIGUOUS");
                }else{
Console.WriteLine("YYMM");
                }
            }else{
                if(my){
                    Console.WriteLine("MMYY");
                }else{
                    Console.WriteLine("NA");
                }
            }
        }
    }
}

Measured memory_bytes: 11092
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define ul unsigned long long int
#define ld long double
#define f(t) for(ll i =0;i<t;i++)
#define vi vector<int>
#define vl vector<ul>
#define pb push_back
#define ff first
#define ss second
#define MOD 1000000007
#define inf 4e18
#define EPS 1e-3
#define PI 3.1415926535897932385
#define display(v) f(v.size())cout << v[i]<<" "
const double h = 1e-6;
const int MAX_  = 200005;
#define all(v) v.begin(),v.end()

inline ll mul(ll a, ll b){ return (a * 1ll * b) % MOD; }
inline ll sub(ll a, ll b){ ll c = a - b; if(c < 0) c += MOD; return c; }
inline ll add(ll a, ll b){ ll c = a + b; if(c > MOD) c -= MOD; return c; }
ll sqr(ll x)
{
    return x*x;
}
 //////////////////////*********CODE***********/////////////////////
 //////////////////////////////////////////////////////////////////

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    cout << fixed;
    cout.precision(13);
    int r;  cin>>r;
    cout << 2 * PI * r;
    return 0;
}
    


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

using namespace std;
using ll = long long;
using P = pair<int,int>;
const ll mod = 1000000007;


int main()
{
    int n;
    cin >> n;
    vector<int> a(n);
    for(int i = 0; i < n; i++)cin >> a[i];
    int t = accumulate(a.begin(), a.end(), 0);
    if(t % 10){
        cout << t << endl;
        return 0;
    }else{
        sort(a.begin(), a.end());
        for(int i = 0; i < n; i++){
            if(a[i] % 10){
                cout << t - a[i] << endl;
                return 0;
            }
        }
    }
    cout << 0 << endl;
}

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

int main(){
	int n,m,l;
	cin >> n >> m >> l;
	
	long long int a[100][100], b[100][100];
	for(int i=0; i<n; i++){
		for(int j=0; j<m; j++){
			cin >> a[i][j];
		}
	}
	for(int i=0; i<m; i++){
		for(int j=0; j<l; j++){
			cin >> b[i][j];
		}
	}
	for(int i=0; i<n; i++){
		for(int j=0; j<l; j++){
			long long int elem=0;
			for(int k=0; k<m; k++){
				elem += a[i][k]*b[k][j];
			}
			if(j==0) cout << elem;
			else cout << " " << elem;
		}
		cout << endl;
	}
	return 0;
}

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

int main() {
    string S;
    cin >> S;
    int min = 753;
    for (int i=0; i<S.size()-2; i++) {
        int number = stoi(S.substr(i,3));
        if(min>abs(753-number)) min = abs(753-number);
    }
    cout << min << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int f=0;
  string s,t;cin>>s>>t;
  for(int i=0;i<3;++i)
  {
    if(s[i]==t[i])++f;
  }
  cout<<f;
}

Measured memory_bytes: 256
#include <stdio.h>
#define MODULO 1000000007

int main(void){
    int n;
    scanf("%d", &n);

    long long int power = 1;
    for(int i = 1; i <= n; i++){
        power = (power * i) % MODULO;
    }
    printf("%lld\n", power);
    return 0;
}

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

int main(){
	int n, ans;
	char s;
	cin >> n;
	ans = n;
	cin >> s;
	while(s != '='){
		cin >> n;
		if(s == '+') ans += n;
		else if(s == '-') ans -= n;
		else if(s == '*') ans *= n;
		else if(s == '/') ans /= n;
		cin >> s;
	}
	cout << ans << endl;
}

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

class uint_Trie {
	struct node {
		node *p, *l, *r;
		int cnt;
		node(node *p, node *l = nullptr, node *r = nullptr) : p(p), l(l), r(r), cnt(0) {}
	};
	node *root;
	int siz;
public:
	uint_Trie() : root(new node(nullptr)) {}
	int size() {
		return root->cnt;
	}
	void insert(unsigned val) {
		// if (find(val)) return; // multiset ???????¶????
		node *t = root;
		for (int i = 31; i >= 0; i--) {
			t->cnt++;
			if (val & (1 << i)) {
				if (t->r == nullptr) {
					t->r = new node(t);
				}
				t = t->r;
			}
			else {
				if (t->l == nullptr) {
					t->l = new node(t);
				}
				t = t->l;
			}
		}
		t->cnt++;
	}
	void erase(unsigned val) {
		node *t = root, *ne;
		for (int i = 31; i >= 0; i--) {
			t->cnt--;
			if (val & (1 << i)) {
				if (t->r == nullptr) return;
				t = t->r;
			}
			else {
				if (t->l == nullptr) return;
				t = t->l;
			}
		}
		t->cnt--;
		while (t != root && t->cnt == 0) {
			ne = t->p;
			(t == ne->l ? ne->l : ne->r) = nullptr;
			delete t;
			t = ne;
		}
	}
	bool find(unsigned val) {
		node *t = root;
		for (int i = 31; i >= 0; i--) {
			if (val & (1 << i)) {
				if (t->r == nullptr) return false;
				t = t->r;
			}
			else {
				if (t->l == nullptr) return false;
				t = t->l;
			}
		}
		return true;
	}
	unsigned max() {
		assert(root->cnt >= 1);
		node *t = root;
		unsigned res = 0;
		for (int i = 31; i >= 0; i--) {
			assert(t->l != nullptr || t->r != nullptr);
			if (t->r != nullptr) {
				res |= 1 << i;
				t = t->r;
			}
			else {
				t = t->l;
			}
		}
		return res;
	}
	unsigned min() {
		assert(root->cnt >= 1);
		node *t = root;
		unsigned res = 0;
		for (int i = 31; i >= 0; i--) {
			assert(t->l != nullptr || t->r != nullptr);
			if (t->l != nullptr) {
				t = t->l;
			}
			else {
				res |= 1 << i;
				t = t->r;
			}
		}
		return res;
	}
};

int main()
{
	cin.sync_with_stdio(false);
	uint_Trie ut;
	string com;
	int k;
	while (cin >> com, com != "end") {
		if (com == "insert") {
			cin >> k;
			ut.insert(k);
		}
		else {
			int res = ut.max();
			printf("%d\n", res);
			ut.erase(res);
		}
	}
	return 0;
}

Measured memory_bytes: 4104
# coding: utf-8
class Case04

  def initialize
  end

  def show
    p self.instance_variables
        .map{ |sym| [sym, self.instance_variable_get(sym)] }
        .to_h
  end
  
  # 実行する
  def execute
    read
    solve
    output
  end

  def read
    @n, @k = gets.chomp.split.map(&:to_i)
    @p = gets.chomp.split.map(&:to_f)
  end

  def solve
    e = 0.0
    0.upto(@k-1) do |j|
      e = e + (@p[j] + 1.0) / 2.0
    end
    @result = e

    1.upto(@n-@k) do |i|
      e = e - ((@p[i-1] + 1.0) / 2.0) + ((@p[i+@k-1] + 1.0) / 2.0)
      if @result < e then
        @result = e
      end
    end
  end
  
  def output
    puts @result
  end

end

Case04.new.execute if $0 == __FILE__


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

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

#define DEBUG(x) cout<<#x<<": "<<x<<'\n'
#define DEBUG_VEC(v) cout<<#v<<":";REP(i, v.size())cout<<' '<<v[i];cout<<'\n'
#define ALL(a) (a).begin(), (a).end()

#define CHMIN(a, b) a=min((a), (b))
#define CHMAX(a, b) a=max((a), (b))

const ll MOD=1000000007ll;
// const ll MOD=998244353ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

const double EPS=1e-11;
#define EQ0(x) (abs((x))<EPS)
#define EQ(a, b) (abs((a)-(b))<EPS)

int alf[30];

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	string s;
	cin>>s;
	int l=0, r=s.size()-1, ans=0;
	while(l<=r && l<s.size() && r>=0){
		if(s[l]==s[r]){
			++l;
			--r;
		}
		else if(s[l]=='x'){
			++l;
			++ans;
		}
		else if(s[r]=='x'){
			--r;
			++ans;
		}
		else{
			cout<<-1<<'\n';
			return 0;
		}
	}
	cout<<ans<<'\n';
	return 0;
}


Measured memory_bytes: 512
class UnionFind(object):
    def __init__(self, n=1):
        self.par = [i for i in range(n)]  # グループ番号
        self.rank = [0 for _ in range(n)]

    def find(self, x):
        """
        x が属するグループを探索
        """
        if self.par[x] == x:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]

    def union(self, x, y):
        """
        x と y のグループを結合
        """
        x = self.find(x)
        y = self.find(y)
        if x != y:
            if self.rank[x] < self.rank[y]:
                x, y = y, x
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1
            self.par[y] = x

    def is_same(self, x, y):
        """
        x と y が同じグループか否か
        """
        return self.find(x) == self.find(y)


A, B, C, D, E, F = map(int, input().split())
ma = F // (100 * A)
mb = F // (100 * B)
mc = F // C
md = F // D
a = 0
s = 0
d = 0
sw = 0
ss = 0
sd = 0
for i in range(ma + 1):
    if A * 100 * i > F:
        break
    for j in range(mb + 1):
        if A * 100 * i + B * 100 * j > F:
            break
        for k in range(mc + 1):
            if A * 100 * i + B * 100 * j + C * k > F:
                break
            for l in range(md + 1):
                if A * 100 * i + B * 100 * j + C * k + D * l > F:
                    break
                if i + j == 0:
                    break
                a = A * 100 * i + B * 100 * j + C * k + D * l
                s = C * k + D * l
                d = s / (A * i + B * j)
                # print(i, j, a, F, d, E)
                if a <= F and sd <= d <= E:
                    sd = d
                    sw = a
                    ss = s
                    # print(a, s, d, i, j)
print(sw, ss)


Measured memory_bytes: 3192
// sort(b.begin(), b.end());//bという配列を小さい方からソート
//reverse(b.begin(), b.end());//bという配列を逆にソート 
// 10桁でdouble出力するパターン１ 
// printf("%.10f\n", ma);
// 10桁でdouble出力するパターン２
//cout << fixed << setprecision(10);
//  cout << ma << endl;

/*01 02 03 12 13 23　と６回見ていくパターン 
for(int i=0;i<n-1;i++){
  for(int j=i+1;j<n;j++){
    }
  }
*///vector<vector<int>> data(3, vector<int>(4));//int型の2次元配列(3×4要素の)の宣言
//int64_t a;
//10のi乗pow(10, i);
/*string s; stringでの文字列を数字型に変える方法
  cin >> s;
  rep(i,s.size()-2) {
  int a= (s.at(i)-'0')*100 + (s.at(i+1)-'0')*10+ s.at(i+2) -'0';
*/
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
  int n;
  cin >> n;
  vector<string>s(n);
  vector<int>p(n);
  rep(i,n) cin >> s.at(i) >> p.at(i);
  vector<int>q(n);
  rep(i,n) q.at(i) = i+1; 
//  swap(s.at(0),s.at(2));
// rep(i,n) cout << s.at(i) << p.at(i)<<endl;
  for(int i=0;i<n-1;i++){
    for(int j=1+i;j<n;j++){
      if(s.at(i) > s.at(j) ){
        swap(q.at(i),q.at(j));
        swap(s.at(i),s.at(j));
        swap(p.at(i),p.at(j));
      }
    }
  }
  for(int i=0;i<n-1;i++){
    for(int j=1+i;j<n;j++){
      if(s.at(i) == s.at(j) ){
        if(p.at(i) < p.at(j)){
        swap(q.at(i),q.at(j));
        swap(p.at(i),p.at(j));
        }
      }
    }
  }
  
   rep(i,n) cout << q.at(i) <<endl; 
//   rep(i,n) cout << s.at(i) << p.at(i)<<endl;
  
            
  
  
/*  vector<int>q(n);
  if(s.at(0) > s.at(2) ){
    cout <<"Yes"<<endl;
  }
  else{
    cout <<"No"<<endl;
  }
  */   
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define range(i, l, r) for(long long int (i) = (l); (i) < (r); (i)++)
#define reversed_range(i, l, r) for (long long int (i) = (r) - 1; (i) >= l; (i)--)
using namespace std;
template <typename T>
using vec = vector<T>;
using lint = long long;
using ulint = unsigned long long;
using pint = pair<int, int>;
using plint = pair<lint, lint>;

template <typename S, typename T>
ostream& operator <<(ostream& os, pair<S, T> p) {
    os << "(";
    os << p.first << ", " << p.second;
    return os << ")";
}

template <typename T>
ostream& operator <<(ostream& os, vec<T> v) {
    os << "[";
    if (v.size() == 0) return os << "]";
    for (int i = 0; i < v.size() - 1; i++) {
        os << v.at(i) << ", ";
    }
    return os << v.at(v.size() - 1) << "]";
}

template <typename T>
ostream& operator <<(ostream& os, set<T>& s) {
    os << "{";
    if (s.begin() == s.end()) return os << "}";
    auto it_first_item = s.begin();
    os << *it_first_item;
    for (auto it = ++it_first_item; it != s.end(); it++) {
        os << ", " << *it;
    }
    return os << "}";
}

template <typename T>
ostream& operator <<(ostream& os, unordered_set<T>& s) {
    os << "{";
    if (s.begin() == s.end()) return os << "}";
    auto it_first_item = s.begin();
    os << *it_first_item;
    for (auto it = ++it_first_item; it != s.end(); it++) {
        os << ", " << *it;
    }
    return os << "}";
}

template <typename K, typename V>
ostream& operator <<(ostream& os, map<K, V> m) {
    os << "{";
    if (m.begin() == m.end()) return os << "}";
    auto it_first_item = m.begin();
    os << it_first_item->first << ": " << it_first_item->second;
    for (auto it = ++it_first_item; it != m.end(); it++) {
        os << ", " << it->first << ": " << it->second;
    }
    return os << "}";
}

template <typename K, typename V>
ostream& operator <<(ostream& os, unordered_map<K, V> m) {
    os << "{";
    if (m.begin() == m.end()) return os << "}";
    auto it_first_item = m.begin();
    os << it_first_item->first << ": " << it_first_item->second;
    for (auto it = ++it_first_item; it != m.end(); it++) {
        os << ", " << it->first << ": " << it->second;
    }
    return os << "}";
}

lint pow(lint num, lint e, lint MOD) {
    lint res = 1;
    lint cur_num = num;
    while (e) {
        if (e & 1) {
            res *= cur_num;
            res %= MOD;
        }
        cur_num *= cur_num;
        cur_num %= MOD;
        e >>= 1;
    }
    return res;
}

int main() {
    cin.tie(0); cout.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    string S; cin >> S;
    auto is_palindrome = [](const string& s) {
        range(i, 0, s.size() / 2) {
            if (s.at(i) != s.at(s.size() - 1 - i)) {
                return false;
            }
        }
        return true;
    };
    cout << (is_palindrome(S) 
        and is_palindrome(S.substr(0, (S.size() - 1) / 2)) 
        and is_palindrome(S.substr((S.size() + 3) / 2 - 1, (S.size() - 1 / 2))) 
        ? "Yes" : "No") << '\n';
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <cmath>
#include <ctype.h>
#include <string> 
#include <sstream>
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <queue>
#include <utility>
#include <vector>
#include <set>
#include <iomanip>
#include <stack>
  
using namespace std;

#define pi 3.141592653589793


//  + を -1　* を -11
int multiplication_first(string s)
{
	stack<int> calculation;
	int cnt = 0;
	while(cnt < s.length()){
		if(isdigit(s[cnt])){
			calculation.push(s[cnt] - '0');
		} else if(s[cnt] == '*'){
			int result = calculation.top() * (s[cnt + 1] - '0');
			calculation.pop();
			calculation.push(result);
			cnt++;
		}
		cnt++;
	}
	while(calculation.size() != 1){
		int top = calculation.top();
		calculation.pop();
		int second = calculation.top();
		calculation.pop();
		calculation.push(top + second);
	}
	return calculation.top();
}

int left_to_right(string s)
{
	int ans = s[0] - '0';
	int cnt = 1;
	while(cnt < s.length()){
		if(s[cnt] == '+'){
			ans += s[cnt + 1] - '0';
			cnt++;
		} else if(s[cnt] == '*'){
			ans = ans * (s[cnt + 1] - '0');
			cnt++;
		}
		cnt++;
	}
	return ans;	
}

int main()
{
	string s;
	int bobans;
	cin >> s >> bobans;
	int ans[2] ={};
	// ans[0]:multiplication_firstとあっているか　ans[1]:left_to_rightとあっているか　あってたら1
	if(bobans == multiplication_first(s)) ans[0]++;
	if(bobans == left_to_right(s)) ans[1]++;
	if(ans[0] && ans[1]) cout << 'U' << endl;
	else if(ans[0]) cout << 'M' << endl;
	else if(ans[1]) cout << 'L' << endl;
	else cout << 'I' << endl;
	return 0;
}

Measured memory_bytes: 1212
#include <bits/stdc++.h>
#define sz(v)   ((int)(v).size())
#define  all(v)    ((v).begin()),((v).end())
#define  allr(v)    ((v).rbegin()),((v).rend())
#define   pb         push_back
#define   mp         make_pair
#define    clr(v,d)      memset( v, d ,sizeof(v))
#define     PI                       acos(-1)
typedef  long long     ll ;
typedef  unsigned long long ull;
const double eps= (1e-9);
using namespace std;
int dcmp(long double a,long double b){   return fabsl(a-b)<=eps ? 0: (a>b)? 1:-1  ;}
int getBit(ll num, int idx) {return ((num >> idx) & 1ll) == 1;}
int setBit1(int num, int idx) {return num | (1<<idx);}
ll setBit0(ll num, int idx) {return num & ~(1ll<<idx);}
ll flipBit(ll num, int idx) {return num ^ (1ll<<idx);}
void GO(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);}
int countNumBit1(int mask) {int ret=0; while (mask) 	{mask &= (mask-1);++ret;	}return ret;}
const int N=200000+9,mod=1e9+7;
ll A[N],sum[N],vis[N];
ll rng(int a,int b){

 return sum[b]-(a?sum[a-1]:0);
}
int main(){
    GO();

    int T;
  //  cin>>T;
    T=1;
    while(T--){
       ll n,x,m;
       cin>>n>>x>>m;
       A[1]=x;
       sum[1]=x;
       vis[A[1]]=1;

       ll ans=x;
       for(int i=2;i<=n;i++){
         A[i]=(A[i-1]*A[i-1])%m;

         if(vis[A[i]]==0){
            sum[i]=sum[i-1]+A[i];
            ans+=A[i];
            vis[A[i]]=i;
            continue;
         }

         int F=vis[A[i]];
         int To= i-1;
         ll R= To-F+1;
         ll rem= n-i+1;
         ll FF= rem/R;
         ll MM= rem%R;

         ans+= rng(F,To)*FF;
         for(int j=F;j<F+MM;j++){
            ans+=A[j];
         }
         break;
       }
       cout<<ans<<"\n";
    }
}



















































































































































































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

YES = "Yes"  # type: str
NO = "No"  # type: str

def dist(a, b):
    dist = 0
    dist += abs(a[0] - b[0])
    dist += abs(a[1] - b[1])
    return dist

def solve(N: int, t: "List[int]", x: "List[int]", y: "List[int]"):
    txy = [[i, j, k] for i,j,k in zip(t, x, y)]
    txy = sorted(txy, key = lambda x: x[0])
    flag = 0
    coordinate_start = [0, 0]
    t_start = 0
    for t, x, y in txy:
        coordinate_goal = [x, y]
        time_to_travel = t - t_start
        distance = dist(coordinate_start, coordinate_goal)
        if distance > time_to_travel:
            flag = False
            break
        if distance <= time_to_travel:
            if (distance - time_to_travel) % 2 == 0:
                flag = True
            else:
                flag = False
                break
        t_start = t
        coordinate_start = [x, y]
    if flag == True:
        print(YES)
    else:
        print(NO)
    return


# Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    t = [int()] * (N)  # type: "List[int]"
    x = [int()] * (N)  # type: "List[int]"
    y = [int()] * (N)  # type: "List[int]"
    for i in range(N):
        t[i] = int(next(tokens))
        x[i] = int(next(tokens))
        y[i] = int(next(tokens))
    solve(N, t, x, y)

if __name__ == '__main__':
    main()


Measured memory_bytes: 23412
import java.util.*;

class Main {
    public static void main(String[] args) {
        final Scanner sc = new Scanner(System.in);
        final int N = Integer.parseInt(sc.next());
        final String S = sc.next();
        sc.close();

        StringBuilder sb = new StringBuilder(S);
        final String ABC = "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ";

        for (int i=0; i<sb.length(); i++) {
            for (int j=0; j<ABC.length()-1; j++) {
                if (sb.substring(i, i+1).equals(ABC.substring(j, j+1))) {
                    sb.replace(i, i+1, ABC.substring(j+N, j+N+1));
                    break;
                }
            }
        }
        System.out.println(sb);
    }
}

Measured memory_bytes: 35540
#include <iostream>
#include <cstring>
#include <cmath>
#include <cstdio>

using namespace std;

typedef long long ll;

int N, T, L, B;
int board[110];

void solve()
{
    double dp[T + 10][N + 10]; // dp[i][j]: iターン目にjにいる確率

    for (int i = 0; i < T + 10; ++i)
        for (int j = 0; j < N + 10; ++j)
            dp[i][j] = 0.0;
    dp[0][0] = 1.0;

    for (int i = 0; i < T; ++i) {
        for (int j = 0; j < N; ++j) {
            for (int d = 1; d <= 6; ++d) {
                int next_turn = i + 1, next_pos = j + d;

                if (next_pos > N)
                    next_pos = N - (next_pos % N);
                if (board[next_pos] == 1) // Lose
                    ++next_turn;
                else if (board[next_pos] == 2) // Back
                    next_pos = 0;

                dp[next_turn][next_pos] += dp[i][j] / 6.0;
            }
        }
    }

    double prob = 0.0;
    for (int i = 0; i <= T; ++i)
        prob += dp[i][N];

    printf("%.8f\n", prob);
}

int main()
{
    while (cin >> N >> T >> L >> B) {
        if (N + T + L + B == 0)
            break;

        memset(board, 0, sizeof(board));
        // 0: None 1: Lose 2: Back
        int t;
        for (int i = 0; i < L; ++i) {
            cin >> t;
            board[t] = 1;
        }
        for (int i = 0; i < B; ++i) {
            cin >> t;
            board[t] = 2;
        }

        solve();
    }

    return 0;
}

Measured memory_bytes: 1264
import math
N = int(input())
x = []
y = []
for i in range(N):
    tx,ty=map(int,input().split())
    x.append(tx)
    y.append(ty)
sumv = 0
for i in range(N):
    for k in range(N-i-1):
        dis = math.sqrt((y[i]-y[N-k-1])**2+(x[i]-x[N-k-1])**2)
        sumv += dis
print(2/N*sumv)

Measured memory_bytes: 3064
/*
 * aoj/dpl_5_e/main.cpp
 */

// C++ 14
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstring> // memset
#include <cassert>
using namespace std;
#define ll long long
#define loop(__x, __start, __end) for(int __x = __start; __x < __end; __x++)
template <class T> ostream & operator << (ostream & out, vector<T> const & v) {
  for (auto &&a: v) out << a << " "; out << endl; return out;
}
template <class T> void dump(T &a) { cout << a << endl; }
template <class T> bool chmin(T &a, T b) { if (a > b) {a = b; return true; } return false; }
template <class T> bool chmax(T &a, T b) { if (a < b) {a = b; return true; } return false; }
/* Mod */
#define MOD 1000000007
struct mint {
  ll x;
  mint():x(0){}
  mint(ll x):x((x%MOD+MOD)%MOD){}
  // mint(ll x):x(x){}
  mint& fix() { x = (x%MOD+MOD)%MOD; return *this;}
  mint operator-() const { return mint(0) - *this;}
  mint& operator+=(const mint& a){ if((x+=a.x)>=MOD) x-=MOD; return *this;}
  mint& operator-=(const mint& a){ if((x+=MOD-a.x)>=MOD) x-=MOD; return *this;}
  mint& operator*=(const mint& a){ (x*=a.x)%=MOD; return *this;}
  mint operator+(const mint& a)const{ return mint(*this) += a;}
  mint operator-(const mint& a)const{ return mint(*this) -= a;}
  mint operator*(const mint& a)const{ return mint(*this) *= a;}
  bool operator<(const mint& a)const{ return x < a.x;}
  bool operator==(const mint& a)const{ return x == a.x;}
};
ostream & operator << (ostream & out, mint const & v) {
  out << v.x;
  return out;
}

/* nCk */
template<class T> struct BiCoef {
    vector<T> fact_, inv_, finv_;
    constexpr BiCoef() {}
    constexpr BiCoef(int n) noexcept : fact_(n, 1), inv_(n, 1), finv_(n, 1) {
        init(n);
    }
    constexpr void init(int n) noexcept {
        fact_.assign(n, 1), inv_.assign(n, 1), finv_.assign(n, 1);
        for(int i = 2; i < n; i++){
            fact_[i] = fact_[i-1] * i;
            inv_[i] = -inv_[MOD%i] * (MOD/i);
            finv_[i] = finv_[i-1] * inv_[i];
        }
    }
    constexpr T com(int n, int k) const noexcept {
        if (n < k || n < 0 || k < 0) return 0;
        return fact_[n] * finv_[k] * finv_[n-k];
    }
    constexpr T fact(int n) const noexcept {
        if (n < 0) return 0;
        return fact_[n];
    }
    constexpr T inv(int n) const noexcept {
        if (n < 0) return 0;
        return inv_[n];
    }
    constexpr T finv(int n) const noexcept {
        if (n < 0) return 0;
        return finv_[n];
    }
};


// kCn
int N, K;
void solve() {
  cin >> N >> K;
  BiCoef<mint> bc;
  bc.init(1001);
  cout << bc.com(K, N) << endl;
}
int main() {
  // cout.precision(15); cout << fixed;

  solve();

  return 0;
}



Measured memory_bytes: 3136
#include <cstdio>
#include <algorithm>
#include <vector>
#include <set>
#include <iomanip>
#include <iostream>
#include <map>
#include <cmath>
#include <bitset>

using namespace std;

const int CMax = 100005;

int main()
{
    int n, A, B, C;

    scanf("%d", &n);
    bool tik = true;
    for (int i = 0; i < n; i++) {
        scanf("%d", &A);
        if (A % 2 == 0 && (A % 3 != 0 && A % 5 != 0)) tik = false;
    }

    if (tik) printf("APPROVED\n");
    else printf("DENIED\n");
}



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

using namespace std;

const long long NS = (long long)2e5 + 4;

long long N, k;
long long arr[NS], sum[NS];
long long nxt[NS];
long long last[NS];
long long ans[NS], ansN, ppos[NS];

int main(){
    scanf("%lld %lld", &N, &k);
    for(long long i = 1; i <= N; ++i){
        scanf("%lld", arr + i); ++sum[arr[i]];
    }
    for(long long i = N; i >= 1; --i){
        if(!nxt[i]) nxt[i] = last[arr[i]];
        last[arr[i]] = i % N + 1;
    }
    for(long long i = N; i >= 1; --i){
        if(!nxt[i]) nxt[i] = last[arr[i]];
        last[arr[i]] = i % N + 1;
    }
    long long cnt = 0, pos = 1;
    while(1){
        if(sum[arr[pos]] == 1) ++cnt;
        if(nxt[pos] <= pos){
            ++cnt; pos = nxt[pos];
        }
        else{
            pos = nxt[pos];
        }
        if(pos == 1){
            break;
        }
    }
    k %= cnt;
    if(!k) return 0;
    pos = 1;
    while(1){
        if(k == 1){
            while(pos <= N){
                if(ppos[arr[pos]]){
                    long long gap = ppos[arr[pos]] - 1;
                    for(long long i = ppos[arr[pos]]; i <= ansN; ++i) ppos[ans[i]] = 0;
                    ansN = gap;
                    ++pos;
                    continue;
                }
                ans[++ansN] = arr[pos];
                ppos[arr[pos]] = ansN;
                ++pos;
            }
            for(long long i = 1; i <= ansN; ++i){
                printf("%lld ", ans[i]);
            }
            return 0;
        }
        if(sum[arr[pos]] == 1) --k;
        if(nxt[pos] <= pos){
            --k; pos = nxt[pos];
        }
        else{
            pos = nxt[pos];
        }
    }
    return 0;
}


Measured memory_bytes: 10880
#include <iostream>
#include <algorithm>
#include <utility>
#include <fstream>
#include <unordered_map>
#include <map>
#include <unordered_set>
#include <set>
#include <vector>
#include <string>
#include <cmath>
#include <queue>

using namespace std;
using ll = long long;
using ull = unsigned long long;

//const double PI = acos(-1);



int main() {
    int n, ans = 0, x, max;
    cin >> n >> x;
    max = x;
    ans++;
    for (int i = 0; i < n - 1; i++) {
        cin >> x;
        if (x >= max) {
            ans++;
            max = x;
        }
    }
    cout << ans;
}



Measured memory_bytes: 256
#pragma GCC optimize ("Ofast")
#include "bits/stdc++.h"
	
#define PI 3.141592653589793
#define FAST ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	
// Use for file I/O;
#define FIN string _fname = ""; \
			string _is = _fname + ".in", _os = _fname + ".out"; \
			freopen(_is.c_str(), "r", stdin); \
			freopen(_os.c_str(), "w", stdout);
typedef long long ll;
typedef long double ld;
typedef unsigned int uint;
typedef unsigned long long ull;
 
using namespace std;
 
const ll INF = 1e9 + 10;
const ll INF2 = 1e18 + 10;
const int MOD = 1e9 + 7;
const ld EPS = 1e-4;
 
const int LOGN = 19;
const int MAXN = 2e5;
 
bool cmp(const pair<ll, ll> &a, const pair<ll, ll> &b) {
	return a.first + a.second < b.first + b.second;
}
 
int main() {
	FAST;
 
	int n;
	cin >> n;
 
	// weight, strength
	vector<pair<ll, ll>> a;
	for (int i = 0; i < n; i++) {
		ll x, y;
		cin >> x >> y;
		a.emplace_back(y, x);
	}
 
	sort(a.begin(), a.end(), cmp);
	
	vector<ll> dp(n + 1, INF2);
	dp[0] = 0;
	
	for (int i = 0; i < n; i++) {
		for (int j = n; j >= 0; j--) {
			if (dp[j] <= a[i].second) dp[j + 1] = min(dp[j + 1], dp[j] + a[i].first);
		}
	}
 
	ll ans = 0;
 
	for (int i = 0; i <= n; i++) {
		if (dp[i] < INF2) ans = i;
	}
 
	cout << ans;
}

Measured memory_bytes: 3736
N, X, Y = map(int, input().split())
K = [0]*(N-1)
for i in range(1,N+1):
	for j in range(i+1,N+1):
		K[min(min(abs(X-i)+1,abs(Y-i))+abs(j-Y),abs(i-j))-1]+=1
for i in range(N-1):
	print(K[i])

Measured memory_bytes: 3444
# coding: utf-8
import sys
input = sys.stdin.readline

N = int(input())
lst_blue = [input() for _ in range(N)]
set_blue = set(lst_blue)
M = int(input())
lst_red = [input() for _ in range(M)]

ans = 0
for word in set_blue:
    cnt_blue = lst_blue.count(word)
    cnt_red = lst_red.count(word)
    ans = max(ans, cnt_blue - cnt_red)
print(ans)

Measured memory_bytes: 3064
#include<iostream>
using namespace std;
int main(){
	int ans,w;
	while(cin>>w,w!=-1){
		ans=1150;
		if(w>30){
			ans+=160*(w-30);
			w=30;
		}
		if(w>20){
			ans+=140*(w-20);
			w=20;
		}
		if(w>10){
			ans+=125*(w-10);
		}
		cout<<4280-ans<<endl;
	}
}

Measured memory_bytes: 1160
import sys
input = sys.stdin.readline

n, y = map(int, input().split())
for i in range(n+1):
    for j in range(n+1):
        z = n-j-i
        if i+j+z == n and 10000*j+5000*i+1000*z == y:
            if z < 0:
                break
            print(j, i, z)
            sys.exit()
print(-1, -1, -1)

Measured memory_bytes: 3064
#include <stdio.h>
int main(void){
    // Your code here!
    int x,y,a,b;
    a = 0;
    scanf("%d %d\n", &x,&y);
    for(int i=0;i<y;i++){
        scanf("%d", &b);
        a+=b;
    }
    if(a>x){
    printf("-1");
}
else{
    printf("%d",x-a);
}
        
    }


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

int main()
{
  int N;
  int a[110000];
  string res;
  cin >> N;

  if(N>999) res = "ABD";
  else res = "ABC";

  cout << res << endl;
}

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

#define int long long
typedef pair<int, int> P;
#define mod 1000000007
#define INF (1LL<<60)
 
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define repi(itr, ds) for (auto itr = ds.begin(); itr != ds.end(); itr++)
#define YES puts("YES")
#define Yes puts("Yes")
#define NO  puts("NO")
#define No  puts("No")
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
 
const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };
 
 
#if 1
//-------------
// DUMPマクロ
// https://www.creativ.xyz/dump-cpp-652/
 
// vector
template <typename T>
istream& operator>>(istream& is, vector<T>& vec) {
    for (T& x : vec) is >> x;
    return is;
}
// pair
template <typename T, typename U>
ostream& operator<<(ostream& os, pair<T, U>& pair_var) {
    os << "(" << pair_var.first << ", " << pair_var.second << ")";
    return os;
}
// vector
template <typename T>
ostream& operator<<(ostream& os, const vector<T>& vec) {
    os << "{";
    for (int i = 0; i < vec.size(); i++) {
        os << vec[i] << (i + 1 == vec.size() ? "" : ", ");
    }
    os << "}";
    return os;
}
// map
template <typename T, typename U>
ostream& operator<<(ostream& os, map<T, U>& map_var) {
    os << "{";
    repi(itr, map_var) {
        os << *itr;
        itr++;
        if (itr != map_var.end()) os << ", ";
        itr--;
    }
    os << "}";
    return os;
}
// set
template <typename T>
ostream& operator<<(ostream& os, set<T>& set_var) {
    os << "{";
    repi(itr, set_var) {
        os << *itr;
        itr++;
        if (itr != set_var.end()) os << ", ";
        itr--;
    }
    os << "}";
    return os;
}
 
#define DUMPOUT cerr
 
void dump_func() {
    DUMPOUT << endl;
}
template <class Head, class... Tail>
void dump_func(Head&& head, Tail&& ... tail) {
    DUMPOUT << head;
    if (sizeof...(Tail) > 0) {
        DUMPOUT << ", ";
    }
    dump_func(std::move(tail)...);
}
#ifdef _DEBUG
#define DEB
#define dump(...)                                                              \
    DUMPOUT << "  " << string(#__VA_ARGS__) << ": "                            \
            << "[" << to_string(__LINE__) << ":" << __FUNCTION__ << "]"        \
            << endl                                                            \
            << "    ",                                                         \
        dump_func(__VA_ARGS__)
#else
#define DEB if (false)
#define dump(...)
#endif
#endif

signed main() {
    
    string s;
    cin >> s;
    if(s[0]==s[2]) Yes;
    else No;
    return 0;
}


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

int main(){
    int n;
    cin >> n;
    vector <int> a(n-1);
    vector <int> b(n-1);
    vector <int> c(n+1,0);
    vector <vector <int>> d;
    vector <vector <int>> hasi;
    rep(i,n+1) d.push_back(vector<int>());    
    rep(i,n+1) hasi.push_back(vector<int>());    
        

    rep(i,n-1){
        cin >> a[i] >> b[i];
        ++c[a[i]];
        ++c[b[i]];
        d[a[i]].push_back(b[i]);
        hasi[a[i]].push_back(i);
        d[b[i]].push_back(a[i]);
        hasi[b[i]].push_back(i);
    }

    int m;
    m=0;
    rep(i,n){
        m=max(m,c[i]);
    }
    queue <int> q;
    q.push(1);
    int l;
    vector <int> ans(n-1,-1);
    int k;


    while(q.size()!=0){
        int kaunt;
        kaunt=0;
        vector <int> nokori(m+1,1);
        k=q.front();
        q.pop();
        l=d[k].size();
        rep(i,l){
            if(ans[hasi[k][i]]!=-1){
                nokori[ans[hasi[k][i]]]=0;
            }
        }

        rep(i,l){
            if (ans[hasi[k][i]]==-1){
                q.push(d[k][i]);
                while(1==1){
                    if(nokori[kaunt]==1){
                        ans[hasi[k][i]]=kaunt;
                        nokori[kaunt]==0;
                        ++kaunt;
                        break;
                    }
                    ++kaunt;
                }
            }
        }




    }
    cout << m << endl;
    rep(i,n-1) cout << ans[i]+1 << endl;

    return 0;
}

Measured memory_bytes: 13680
#pragma once
#include <stdio.h>
#include <sstream>
#include <string>
#include <string.h>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <deque>
#include <limits>
#include <iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
#define bit(x,v) ((ll)x << v)

const ll INF = 1000000007;
const int MAX = 210000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

// 二項係数計算
long long COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}
int pr[100010];
void uini(int n) {
	for (size_t i = 0; i <= n; i++)
	{
		pr[i] = i;
	}
}

int parent(int x) {
	if (x == pr[x]) return x;
	return pr[x] = parent(pr[x]);
}

bool unit(int x, int y) {
	int px = parent(x);
	int py = parent(y);

	if (px == py) return false;
	if (px < py) {
		pr[py] = px;
	}
	else {
		pr[px] = py;
	}
	return true;
}

// res[i][c] := i 文字目以降で最初に文字 c が登場する index (存在しないときは n)
vector<vector<int> > calcNext(const string& S) {
	int n = (int)S.size();
	vector<vector<int> > res(n + 1, vector<int>(26, n));
	for (int i = n - 1; i >= 0; --i) {
		for (int j = 0; j < 26; ++j) res[i][j] = res[i + 1][j];
		res[i][S[i] - 'a'] = i;
	}
	return res;
}

void solv() {
	while (true)
	{
		int h, w;
		cin >> h >> w;
		if (h == 0 && w == 0) break;

		for (size_t i = 0; i < h; i++)
		{
			cout << string(w, '#') << endl;
		}
		cout << endl;
	}



}


int main() {
	//	COMinit();
	solv();

	return 0;
}



Measured memory_bytes: 3084