akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
#include<string.h>
int main(){
  int l,c=0;
  char s[100];
  scanf("%s",s);
  l=strlen(s);
  if(s[0]=='A' && s[l-1]>='a' && s[l-1]<='z' && s[1]>='a' && s[1]<='z'){
    for(int i=2;i<=l-2;i++){
      if(s[i]=='C') c++;
    }
    if(c==1) puts("AC");
    else puts("WA");
  }
    else puts("WA");
    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define IOS {ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);}
#define endl "\n"
#define int long long int
#define f(i, a, b) for(int i=a; i<b; i++)
#define fb(i, a, b) for(int i=a; i>=b; i--)
#define pb push_back
#define fi first
#define se second
#define vi vector <int>
#define pi pair <int, int>
#define S(x) (int) x.size()
#define LB lower_bound
#define UB upper_bound
#define fp(x, y) fixed<<setprecision(y)<<x
#define M 100005
#define mod 1000000007
#define PI 3.141592653589793238462643383279502884
using namespace std;

void solve()
{
	int x;
	cin>>x;
	f(i, 1, 361)
	{
		if((x*i)%360 == 0)
		{
			cout<<i;
			return;
		}
	}
}

int32_t main()
{
    IOS
    int t = 1;
    // cin>>t;
    f(tno, 1, t+1)
    {
        solve();
    }
    return 0;
}

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

int main() {
  int n, d;
  int ans = 0;
  int num = 0;
  cin >> n >> d;
  int X[n][d];
  rep(i ,n){
    rep(j, d) {
      cin >> X[i][j];
    }
  }
  rep(i ,n - 1){
    for (int j = i + 1; j < n; j++) {
      rep(k, d) {
        num += pow(X[j][k] - X[i][k], 2);
      }
      for (int m = 1; m <= sqrt(num); m++){
        if(pow(m,2) == num) {
          ans++;
        }
      }
        num = 0;
    }
  }
  cout << ans << endl;
}

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

template<class T> void vin(vector<T>& v, int n) {
    v.resize(n);
    for (int i = 0; i < n; ++i) {
        cin >> v[i];
    }
}

ll sum[101010];
ll sum2[101010];

int main() {
    int N, K;
    cin >> N >> K;
    vector<int> a(N+1);
    rep(i, N) cin >> a[i+1];
    for (int i=1; i<=N; ++i) {
        sum[i] = sum[i-1]+a[i];
        sum2[i] = sum2[i-1]+max(0, a[i]);
    }
    ll ans = 0;
    rep(i, N-K+1) {
        ll tmp1 = max(0LL, sum[i+K]-sum[i]);
        ll tmpl = sum2[i] - sum2[0];
        ll tmpr = sum2[N] - sum2[i+K];
        ans = max(ans, tmp1+tmpl+tmpr);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 2176
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main()
{
  int d,n;
  scanf("%d%d",&d,&n);
  if(n==100) n++;
  if(d==0) printf("%d\n",n);
  else if(d==1) printf("%d\n", n*100);
  else printf("%d\n", n*10000);
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS


#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<string>
#include<climits>
#include<vector>
#include<cstring>
#include<queue>



using std::cout;
using std::endl;
using std::cin;
using std::sort;
using std::strcmp;
using std::vector;
using std::queue;

#define SIZE 200
#define MINE -1
int map[SIZE][SIZE];



int main(int argc, char** argv)
{

	if (argc == 2 && strcmp(argv[1], "-debug") == 0)
	{
		freopen("in.txt", "r", stdin);
		freopen("out.txt", "w", stdout);
	}

	int n;
	cin >> n;
	int t, x, y;
	int t1 = 0, x1 = 0, y1 = 0;//上一步的数据
	int dt;
	int step = 0;
	bool success = true;
	while (n--)
	{
		cin >> t >> x >> y;
		dt = t - t1;
		step = std::abs(x - x1) + std::abs(y - y1);

		if (step > dt || (dt - step) % 2 == 1)
		{
			success = false;
			break;
		}

		t1 = t;
		x1 = x;
		y1 = y;
	}

	if (success)
		cout << "Yes";
	else
		cout << "No";


	return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <map>
#include <set>
#include <list>
#include <unordered_set>
#include <unordered_map>
#include <iomanip>
#include <limits>

using namespace std;

using i64 = int64_t;
using P = pair<i64, i64>;

struct edge {
    i64 from, to, cost;
    edge(i64 from, i64 to) : from(from), to(to), cost(1) {}
    edge(i64 from, i64 to, i64 cost) : from(from), to(to), cost(cost) {}
};
using Graph = vector<vector<edge>>;

constexpr i64 INF = std::numeric_limits<i64>::max();
constexpr i64 SINF = std::numeric_limits<i64>::max() / 10;
const i64 MOD = 1000000007;
const i64 dx[4] = { 0,1,0,-1 }, dy[4] = { -1,0,1,0 };
//const i64 dx[5] = {-1,0,0,0,1}, dy[5] = {0,-1,0,1,0};
//const i64 dx[8] = {-1,0,1,1,1,0,-1,-1}, dy[8] = {1,1,1,0,-1,-1,-1,0};
//const i64 dx[9] = {-1,0,1,1,1,0,-1,-1,0}, dy[9] = {1,1,1,0,-1,-1,-1,0,0};

// http://beet-aizu.hatenablog.com/entry/2018/04/08/145516
template<typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }

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

template<typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T& t, const V& v) { t = v; }

template<typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T& t, const V& v) {
    for (auto& e : t) fill_v(e, v);
}

struct IoSetup {
    IoSetup() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(10);
        cerr << fixed << setprecision(10);
    }
} iosetup;

int main() {
    i64 n, k;
    cin >> n >> k;
    vector<i64> v(n);
    for(int i = 0; i < n; ++i) cin >> v[i];
    vector<i64> x;
    i64 ans = 0;
    for (int l = -1; l < n; ++l) {
        if(l >= 0) x.push_back(v[l]);
        vector<i64> tmp = x;
        for (int r = n; r > l; --r) {
            if(n - r + l + 1 > k) continue;
            if(r != n) tmp.push_back(v[r]);
            sort(tmp.begin(), tmp.end(), greater<i64>());
            i64 sum = 0;
            for(i64 i = 0; i < tmp.size(); ++i) sum += tmp[i];
            if (tmp.size() != 0) {
                for (i64 i = tmp.size() - 1; i >= 0; --i) {
                    if (tmp.size() - i - 1 >= k - (n - r + l + 1)) continue;
                    if (tmp[i] < 0) sum -= tmp[i];
                }
            }
            ans = max(ans, sum);
        }
    }
    cout << ans << endl;
}

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

c=0
ne=0
for i in range(n):
  c+=max((b[i]-a[i])//2,0)
  ne+=max(a[i]-b[i],0)

print("Yes" if c>=ne else "No")

Measured memory_bytes: 73880
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <set>
#include <queue>
#include <map>
#include <numeric>
#include <functional>
#include <math.h>

using namespace std;

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

#define INF ((int)1e9)
#define INFLL ((ll)1e18)
#define MOD (1000000007LL)

int main(int argc, const char * argv[]) {
    ios_base::sync_with_stdio(false);
    string S;
    cin >> S;
    int F = 10 * (S[0]-'0') + S[1]-'0';
    int B = 10 * (S[2]-'0') + S[3]-'0';
    bool bF = (F>=1 && F<=12);
    bool bB = (B>=1 && B<=12);
    if (bF && bB) {
        cout << "AMBIGUOUS" << endl;
    } else if (bF) {
        cout << "MMYY" << endl;
    } else if (bB) {
        cout << "YYMM" << endl;
    } else {
        cout << "NA" << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
using namespace std;
ll n,k;
const ll mod=1e9+7;
ll c[2001][2001];
void init()
{
    c[0][0] = 1;
    for (int i = 1; i <= 2000; ++i)
    {
        c[i][0] = 1;
        for (int j = 1; j <=2000; ++j)
        {
            c[i][j] = (c[i-1][j-1]+c[i-1][j])%mod;
        }
    }
}
int main()
{
    scanf("%lld%lld",&n,&k);
    int s=n-k;
    init();
    for(int i=1; i<=k; i++)
    {
        ll ans=0;
        if(s==0&&i==1)ans=1;
        if(n-k-1>=i-2&&i>=2)
            ans+=c[k-1][i-1]*c[n-k-1][i-2]%mod;
        if(n-k-1>=i-1)
        {
            ans=(ans+((c[k-1][i-1]*c[n-k-1][i-1]%mod)*2%mod))%mod;
        }
        if(n-k-1>=i)
            ans=(ans+c[k-1][i-1]*c[n-k-1][i]%mod)%mod;
        printf("%lld\n",ans);
    }
    return 0;
}


Measured memory_bytes: 31488
#include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
#define chmax(x,y) x = max(x,y)
#define chmin(x,y) x = min(x,y)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef tuple<ll,ll,ll> T;
const long long INF = 1LL<<60;
const int MOD = 1000000000+7;
#define rev(s) (string((s).rbegin(), (s).rend()))
template < typename T > inline string toString( const T &a ) { ostringstream oss; oss << a; return oss.str(); };
// cout << fixed << setprecision(10) << ans << endl;
// *min_element(c + l, c + r) *max_element(c + l, c + r)
// int dx[8]={1,1,0,-1,-1,-1,0,1};
// int dy[8]={0,1,1,1,0,-1,-1,-1};
// int dx[4]={1,0,-1,0};
// int dy[4]={0,1,0,-1};
// struct Edge {
//   int to, id;
//   Edge(int to, int id): to(to), id(id) {}
// };

int main() {
  int N,W;cin>>N>>W;
  vector<ll> w(N), v(N);
  rep(i,N) cin >> w[i] >> v[i];
  vector<vector<ll>> dp(N + 1, vector<ll>(W + 1, 0));
  rep(i, N) {
    rep(j, W + 1) {
      if(j + w[i] <= W) chmax(dp[i + 1][j + w[i]], dp[i][j] + v[i]);
      chmax(dp[i + 1][j], dp[i][j]);
    }
  }
  ll ans = 0;
  rep(i, W + 1) {
    chmax(ans, dp[N][i]);
  }
  cout << ans << endl;
}


Measured memory_bytes: 83032
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    n = int(input())
    a = list(map(int, readline().split()))

    from collections import Counter

    counter = Counter(a)
    ans = 0

    for num, cnt in counter.items():
        if cnt > num:
            ans += (cnt-num)
        if cnt < num:
            ans += cnt

    print(ans)

if __name__ == '__main__':
    main()


Measured memory_bytes: 64424
N, M = list(map(int, input().split()))
a = list(map(int, input().split()))
a.sort(reverse=True)

rate = sum(a) * (1 / (4 * M))

count = 0

for num in list(range(M)):
    if a[num] >= rate:
        count += 1

if count >= M:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 3060
H,W=map(int,input().split())
INF=float('inf')
cost=[[INF]*10 for _ in range(10)]
for i in range(10):
  tmp=list(map(int,input().split()))
  for j in range(10):
    cost[i][j]=tmp[j]
def warshal_floyd(cost):
  for k in range(10):
    for i in range(10):
      for j in range(10):
        cost[i][j]=min(cost[i][j],cost[i][k]+cost[k][j])
  return cost
ans=0
min_cost=warshal_floyd(cost)
for i in range(H):
  tmp=list(map(int,input().split()))
  for j in range(W):
    if tmp[j]==-1 or tmp[j]==1:
      pass
    else:
      ans+=min_cost[tmp[j]][1]                 
print(ans)

Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < (n); i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define ALL(x) (x).begin(), (x).end()
#define OUT(x) std::cout << (x) << std::endl
typedef long long ll;

int main() {
    int n, m;
    cin >> n >> m;
    int p[m];
    string s[m];
    map<int, bool> ac;
    map<int, int> pena;
    REP(i, m) {
        cin >> p[i] >> s[i];
        ac[p[i]] = false;
        pena[p[i]] = 0;
    }
    REP(i, m) {
        if (s[i] == "AC") {
            ac[p[i]] = true;
        } else {
            if (!ac[p[i]]) {
                pena[p[i]]++;
            }
        }
    }
    int cntAC = 0, cntPEN = 0;
    for (auto p : ac) {
        if (p.second) {
            cntAC++;
            cntPEN += pena[p.first];
        }
    }
    cout << cntAC << " " << cntPEN << endl;
}

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

using namespace std;

int main(void) {
	int A, B, C, D;
	cin >> A >> B >> C >> D;
	int s = A * B;
	int t = C * D;
	int ans = max(s,t);
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<string>
int lcs(std::string s, std::string t) {
    const int M = s.size(), N = t.size();
    int dp[M+1][N+1] = {};
    for(int i=0; i<M; ++i)
        for(int j=0; j<N; ++j)
            if(s[i] == t[j]) dp[i+1][j+1] = dp[i][j] + 1;
            else dp[i+1][j+1] = std::max(dp[i+1][j], dp[i][j+1]);
    return dp[M][N];
}
#include<iostream>
using namespace std;
int main(){
    int n;
    cin>>n;
    for(int i=0;i<n;++i){
        string s,t;
        cin>>s>>t;
        cout<<lcs(s,t)<<endl;
    }
}

Measured memory_bytes: 7072
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <map>
#include <cstdio>
#include <math.h>
#include <utility>
#include <list>
#include <functional>
#include <queue>
using namespace std;

#define ll long long
#define vecint vector<int>
#define Pii pair<int, int>

#define REP(i,x,n) for(int i=x;i<n;i++)
#define rep(i,n) REP(i,0,n)
#define print(a) cout << a << endl

#define MOD 1000000007
#define NIL -1

int A,B,C;

void solve(){
    int fst=A%B;
    int i=0;
    while(1){
        if(i==1){
            i++;
            continue;
        }
        if((i*A)%B==C){
            print("YES");
            break;
        }else if((i*A)%B==fst){
            print("NO");
            break;
        }
        i++;
    }
    return;
}



int main(){
    cin>>A>>B>>C;
    solve();
    return 0;
}


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

int main()
{
	int n;
	double x,ans;
	string u;
	ans = 0;
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		cin >> x >> u;
		if (u == "JPY")
			ans += x;
		else
			ans += x*380000.0;
	}
	cout << ans;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-


import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

S = input()

def check(S):
    for i, s in enumerate(S):
        if i%2 == 0 and s == 'L':
            return False
        if i%2 == 1 and s == 'R':
            return False
    return True

if check(S):
    Yes()
else:
    No()


Measured memory_bytes: 3064
#include <iostream>
#include "bits/stdc++.h"
using namespace std;
#define print(x) cout<<x<<endl;
#define rep(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a) for(int i=0;i<a;i++)
#define debug int debug = 0;
#define RREP(i,a) for(int i=a-1;i>=0;i--)
#define rrep(i,a,b) for(int i=a-1;i>=b;i--)
#define printall(n,array) {for(int i=0;i<n;i++){cout<<array[i]<<" ";}cout<<endl;}
#define U() cout<<endl;
typedef long long ll;
typedef pair<int, int> PI;
typedef pair<int, PI> V;
typedef vector<int> VE;
const ll mod = 1000000007; //10^9+7

ll ncr[10010][10010];

//nCnまで計算
void nCr(int n){
    REP(i,n+1)REP(j,i+1){
            if(j==0)ncr[i][j]=1;
            else ncr[i][j]=ncr[i-1][j]+ncr[i-1][j-1];
        }
}

int main(){
    ll n;
    string s;
    cin >> n;
    nCr(6);
    ll cnt[5];
    REP(i, 5)cnt[i] = 0;
    REP(i, n){
        cin >> s;
        if(s[0] == 'M'){
            cnt[0]++;
        }else if(s[0] == 'A'){
            cnt[1]++;
        }else if(s[0] == 'R'){
            cnt[2]++;
        }else if(s[0] == 'C'){
            cnt[3]++;
        }else if(s[0] == 'H'){
            cnt[4]++;
        }
    }
    ll ans = 0;
//    REP(i, 5)cout << cnt[i] << " ";
//    print("");
    REP(i, 3){
        if(!cnt[i])continue;
        rep(j, i+ 1, 4){
            if(!cnt[j])continue;
            rep(k, j + 1, 5){
                if(!cnt[k])continue;
                ans += cnt[i] * cnt[j] * cnt[k];
            }
        }
    }
    print(ans);
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <queue>
#include <stack>
#include <complex>
#include <utility>
#include <set>
#include <cmath>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define pi acos(-1)
#define all(v) v.begin(),v.end()
#define EPS (1e-10)
#define EQ(a,b) (abs((a)-(b))<EPS)
#define EQV(a,b) (EQ((a).real(),(b).real()) && EQ((a).imag(),(b).imag()))
using namespace std;
typedef pair<int,int> point;
typedef complex<double> P;
typedef long long ll;

const double eps = 1e-8;
const double INF = 1e9;


double dot(P a,P b){
	return a.real()*b.real()+a.imag()*b.imag();
}
double cross(P a,P b){
	return a.real()*b.imag()-a.imag()*b.real();
}

bool is_orthogonal(P a1,P a2,P b1,P b2){
	return EQ(dot(a1-a2,b1-b2),0.0);
}
bool is_parallel(P a1,P a2,P b1,P b2){
	return EQ(cross(a1-a2,b1-b2),0.0);
}

bool is_point_on_line(P a,P b,P c){
	return EQ(cross(b-a,c-a),0.0);
}

bool is_point_on_linesegment3(P a,P b,P c){
	//|a-c| + |c-b|<=|a-b| ???????????????
	return (abs(a-c)+abs(c-b)<abs(a-b)+EPS);
}

double distance_l_p(P a,P b,P c){
	return abs(cross(b-a,c-a))/abs(b-a);
}


double distance_ls_p(P a,P b,P c){
	if(dot(b-a,c-a)<EPS)return abs(c-a);
	if(dot(a-b,c-b)<EPS)return abs(c-b);
	return abs(cross(b-a,c-a))/abs(b-a);
}

int money(int i,int j,int k,int l){
	return i*10+j*50+k*100+l*500;
}

int main(){
	int cnt=0;
	while(1){
		int bill,one,ten,fif,oha,num=INF;
		cin>>bill;
		if(bill==0)break;
		if(cnt>0)cout<<endl;
		cnt++;
		cin>>one>>ten>>fif>>oha;
		pair<point,point> ans,store;
		point alt1(one,ten),alt2(fif,oha);
		ans.first=alt1;
		ans.second=alt2;
		rep(i,one+1){
			rep(j,ten+1){
				rep(k,fif+1){
					rep(l,oha+1){
						int mai=one+ten+fif+oha;
						if(money(i,j,k,l)>bill){
							mai-=(i+j+k+l);
							int res=money(i,j,k,l)-bill;
							mai+=res/500;
							res%=500;
							mai+=res/100;
							res%=100;
							mai+=res/50;
							res%=50;
							mai+=res;
							if(num>mai){
								num=mai;
								alt1=point(i,j);
								alt2=point(k,l);
								ans=pair<point,point>(alt1,alt2);
							}
						}else if(money(i,j,k,l)==bill){
							if(num>(mai-(i+j+k+l))){
								num=mai-(i+j+k+l);
								alt1=point(i,j);
								alt2=point(k,l);
								ans=pair<point,point>(alt1,alt2);
							}
						}
					}
				}
			}
		}
		if(ans.first.first!=0)cout<<"10 "<<ans.first.first<<endl;
		if(ans.first.second!=0)cout<<"50 "<<ans.first.second<<endl;
		if(ans.second.first!=0)cout<<"100 "<<ans.second.first<<endl;
		if(ans.second.second!=0)cout<<"500 "<<ans.second.second<<endl;
	}
	return 0;
}

Measured memory_bytes: 1168
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include<bits/stdc++.h>
#define int long long
using namespace std;
bool dp[100][100][26005];

signed main()
{
     ios_base::sync_with_stdio(false);
     cin.tie(NULL);  
//  #ifndef ONLINE_JUDGE
//     freopen ("INPUT.txt" , "r" , stdin);
//     freopen ("OUTPUT.txt" , "w" , stdout);
//  #endif


// -------------------------------------Code starts here--------------------------------------------------------------------- 

	int n,m;
	cin>>n>>m;
	int a[n+1][m+1];
	int b[n+1][m+1];
	
	for(int i=1;i<=n;i++)
		for(int j=1;j<=m;j++)
			cin>>a[i][j];

	for(int i=1;i<=n;i++)
		for(int j=1;j<=m;j++)
			{
				cin>>b[i][j];
				a[i][j]=abs(a[i][j]-b[i][j]);
			}
	
	dp[1][1][13000-a[1][1]]=1;
	dp[1][1][13000+a[1][1]]=1;
	
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=m;j++)
		{
			for(int k=0;k<=26000;k++)
			{
			if(i>1)
			{
				if(k-a[i][j]>=0)
					if(dp[i-1][j][k-a[i][j]])
						dp[i][j][k]=1;
				if(k+a[i][j]<=26000)
					if(dp[i-1][j][k+a[i][j]])
						dp[i][j][k]=1;
			}
			if(j>1)
			{
				if(k-a[i][j]>=0)
					if(dp[i][j-1][k-a[i][j]])
						dp[i][j][k]=1;
				if(k+a[i][j]<=26000)
					if(dp[i][j-1][k+a[i][j]])
						dp[i][j][k]=1;
			}
			}
		}
	}
	int mn=1e9;
	for(int i=0;i<=26000;i++)
	{
		if(dp[n][m][i])
			mn=min(mn,abs(13000-i));
	}
	cout<<mn;
// -------------------------------------Code ends here------------------------------------------------------
     clock_t clk;
 	clk = clock();
 
     clk = clock() - clk;
 	cerr << fixed << setprecision(6) << "Time: " << ((double)clk)/CLOCKS_PER_SEC << "\n";
 	return 0;
 }

Measured memory_bytes: 205184
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define P pair<int,int>
#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 TO(x,t,f) ((x)?(t):(f))
#define SORT(x) (sort(x.begin(),x.end())) // 0 2 2 3 4 5 8 9
#define REV(x) (reverse(x.begin(),x.end())) //reverse
int gcd(int a,int b){if(a<b)swap(a,b);if(a%b==0)return b;return gcd(b,a%b);}
int lcm(int a,int b){int c=gcd(a,b);return ((a/c)*(b/c)*c);}//saisyo kobaisu
#define NEXTP(x) next_permutation(x.begin(),x.end())
const ll INF=1e18+7;
const ll MOD=1e9+7;
#define pri(a) cout << (a) << endl


int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin >> n;
	if(n==7||n==5||n==3){
		cout << "YES" << endl;
	}else{
		cout << "NO" << endl;
	}
}

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

using ll = long long;

const int INF = 1001001001;
const ll INF_LL = 1001001001001001001LL;

int main(void){
  int d,n; cin >> d >> n;

  int ans;
  if(n<=99) ans = pow(100,d)*n;
  else ans = pow(100,d)*101;

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


Measured memory_bytes: 3684
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("O3")
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define EPS (1e-9)
#define INF (1e17)
#define PI (acos(-1))
//const double PI = acos(-1);
//const double EPS = 1e-15;
//long long INF=(long long)1E17;
#define i_7 (long long)(1e9+7)
//#define i_7 998'244'353
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
long long po(long a, long b){
    if(b==0){
        return 1;
    }
    
    long long z = po(a,b/2);
    z = mod(z*z);
    if(b%2!=0){
        z = mod(a*z);
    }
    return z;
}

bool prime_(int n){
  if(n==1){
    return false;
  }else if(n==2){
    return true;
  }else{
    for(int i=2;i<=std::sqrt(n);i++){
      if(n%i==0){
        return false;
      }
    }
    return true;
  }
}

long long gcd_(long long a, long long b){
  if(a<b){
    std::swap(a,b);
  }
  if(a%b==0){
    return b;
  }else{
    return gcd_(b,a%b);
  }
}
 
long long lcm_(long long x, long long y){
  return (x/gcd_(x,y))*y;
}

//using namespace std;
//using namespace boost::multiprecision;
//using namespace __gnu_pbds;

int main(){
  using namespace std;
  int n;
  cin>>n;
  int p[n];
  REP(i,n){
    cin>>p[i];
  }
  priority_queue<int, vector<int>, greater<int>> q;
  int cnt = 0;
  REP(i,n){
    if(i == 0){
      cnt++;
      q.push(p[i]);
    }
    int temp = q.top();
    if(p[i] <= temp){
      cnt++;
    }
    q.push(p[i]);
  }
  cout<<cnt-1<<endl;
  return 0;
}

Measured memory_bytes: 2168
n,m,x = map(int,input().split())
rikai = []
ans = -1
for i in range(n):
    a = list(map(int,input().split()))
    rikai.append(a)
for i in range(2**n):
    money = 0
    now = [0]*m
    for j in range(n):
        if ((i >> j)&1):
            money += rikai[j][0]
            for k in range(m):
                now[k] += rikai[j][k+1]
    if min(now) >= x:
        if ans == -1:
            ans = money
        else:
            ans = min(ans,money)
print(ans)

Measured memory_bytes: 9160
fn main() {
    let n: i32 = read_line_as_value();
    let s: String = read_line_as_value();
    let mut prev: char = '\0';
    let mut ans = 0;
    for c in s.chars() {
        if prev != c {
            prev = c;
            ans += 1;
        }
    }
    println!("{}", ans);
}

fn read_line_as_value<T: std::str::FromStr>() -> T {
    let mut input = String::new();
    let res = std::io::stdin().read_line(&mut input);
    if let Err(error) = res {
        panic!("io error at stdin.read_line: {}", error);
    };
    match input.trim().parse() {
        Ok(val) => val,
        _ => panic!("error while parsing input: {}", input)
    }
}

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

using namespace std;

int main(){
  string S,T;
  cin>>S>>T;
  int count=0;
  for(int i=0;i<3;i++){
    if(S[i]==T[i])
      count++;
  }
  cout<<count<<endl;



  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <functional>
#include <utility>
#include <tuple>
#include <cctype>
#define INF 0x3f3f3f3f
#define MOD 1000000007
#define PI 4*atan(1.0)
typedef long long ll;
typedef long double ld;
using namespace std;
int dx[4]={0,0,-1,1};
int dy[4]={-1,1,0,0};
const int SIZE=1001;
//int arr[SIZE]={};
//ここまでテンプレ
//整数a,bの最大公約数を返す
//ユークリッドの互除法
long long gcd(long long a,long long b){
	if(b==0)
		return a;
	else
		return gcd(b,a%b);
}
int main(){
	int N;
	cin>>N;
	ll T[101]={};
	for(int i=0;i<N;i++){
		cin>>T[i];
	}
	ll g=gcd(T[0],T[1]);
	ll ans=T[0]/g*T[1];
	for(int i=1;i<N;i++){
		ll f=gcd(T[i],ans);
		ans=ans/f*T[i];
	}
	if(N==1)
		ans=T[0];
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <array>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <deque>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cctype>
#include <cstring>
#include <ctime>
#include <iterator>
#include <bitset>
#include <numeric>
#include <list>
#include <iomanip>
#include <tuple>
using namespace std;


typedef long long LL;
typedef pair<int,int> pii;
typedef pair<LL,LL> pll;

typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;

#define VV(T) vector<vector< T > >

template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
	v.assign(a, vector<T>(b, t));
}

template <class F, class T>
void convert(const F &f, T &t){
	stringstream ss;
	ss << f;
	ss >> t;
}

template <class T>
T clampMax(const T& a, const T& b) { return min(a, b); }

template <class T>
T clampMin(const T& a, const T& b) { return max(a, b); }

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

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

#define REP(i,n) for(int i=0;i<int(n);++i)
#define ALL(v) (v).begin(),(v).end()
#define RALL(v) (v).rbegin(),(v).rend()
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define PB push


#define MOD 1000000007LL
#define EPS 1e-10

const int MAX_N = 100010;
int N;
int h[4][MAX_N];
int dp[4][MAX_N];

int Solve(int day, int prevAction)
{
    if (dp[prevAction][day] >= 0) return dp[prevAction][day];
    if (day == N) return dp[prevAction][day] = 0;
    int res = 0;
    REP(i, 3)
    {
        if (i == prevAction) continue;
        updateMax(res, h[i][day] + Solve(day + 1, i));
    }
    return dp[prevAction][day] = res;
}

int main()
{
    cin >> N;
    REP(i, N) cin >> h[0][i] >> h[1][i] >> h[2][i];
    REP(i, 4) REP(j, MAX_N) dp[i][j] = -1;
    cout << Solve(0, 3) << endl;
    return 0;
}

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

int main()

{
    int x,y,k,b;
    cin>>x>>y>>k;
    if(x>y)
        b=y;
    else
        b=x;


    while(true){
        if(y%b==0&&x%b==0)
        {k--;

            if(k==0)
        {
            cout<<b;
            break;
        }}

        b--;
    }
    return 0;
}


Measured memory_bytes: 256
gets
c=0
puts$<.map{|s|a=0
[s.bytes.map{a+=81-_1*2}.min,a-61]}.sort_by{_2>0? -_1:2e9-_2+_1}.map{_2-_1+c-=_2}.max>0||c<0?:No: :Yes

Measured memory_bytes: 102860
#include<bits/stdc++.h>
using namespace std;
int main (void){
	vector<int> data(5);
	int ans;
	for(int i=0;i<5;i++){
		cin>>data.at(i);
	}
    for(int i=0;i<5;i++){
        if(data.at(i)==0)ans=i;
	}
	cout<<ans+1<<endl;

}

Measured memory_bytes: 3600
# include <cstdio>
# include <iostream>
# define R register int

using namespace std;

int n,k,x;

int main()
{
    scanf("%d",&k);
 	if(k==1) { printf("1\n1"); return 0; } 
    if(k%4==0) n=k/4;
    else n=k/4+1;
    n=2*n;
    printf("%d\n",n);
    for (R i=1;i<=n;++i)
    {
        for (R j=1;j<=n;++j)
        {
            if(i%2==0) x=(i+j-2+n)%n+n+1;
            else x=(i+j-2+n)%n+1;
            if(x>k) x-=n;
            printf("%d ",x);
        }
        printf("\n");
    }
    return 0;
}

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

Measured memory_bytes: 600
def get_max_length(grid, n)
  max_length = 0

  for y in 0...n
    length = 0
    for x in 0...n
      if grid[y][x] == 1
        length += 1
        max_length = length if length > max_length
      else
        length = 0
      end
    end
  end

  for x in 0...n
    length = 0
    for y in 0...n
      if grid[y][x] == 1
        length += 1
        max_length = length if length > max_length
      else
        length = 0
      end
    end
  end

  for i in 0..(n * 2 - 2)
    length = 0
    x = 0
    y = i - x
    while x < n && y >= 0
      if y < n && grid[y][x] == 1
        length += 1
        max_length = length if length > max_length
      else
        length = 0
      end
      x += 1
      y -= 1
    end
  end

  for i in 0..(n * 2 - 2)
    length = 0
    x = 0
    y = n - 1 - i - x
    while x < n && y < n
      if y >= 0 && grid[y][x] == 1
        length += 1
        max_length = length if length > max_length
      else
        length = 0
      end
      y += 1
      x += 1
    end
  end
#  for i in -(n - 1)..(n - 1)
#    length = 0
#    x = 0
#    y = i + x
#    while x < n && y < n
#      if y >= 0 && grid[y][x] == 1
#        length += 1
#        max_length = length if length > max_length
#      else
#        length = 0
#      end
#      x += 1
#      y += 1
#    end
#  end

  max_length
end

while line = gets
  n = line.chomp.to_i
  break if n == 0

  grid = []
  n.times do
    grid << gets.chomp.split('').map(&:to_i)
  end

  puts get_max_length(grid, n)
end

Measured memory_bytes: 10588
#include <iostream>
#include <iterator>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <numeric>
#include <iomanip>
#include <limits>
#include <set>
#include <map>
#include <type_traits>
#include <cstdint>

typedef long long ll;

using namespace std;

//素因数分解
void factoring(ll n, map<ll, ll>& mp) {
	for (ll i = 2; i * i <= n; i++) {
		while (n % i == 0) {
			mp[i]++;
			n /= i;
		}
	}
	if (n != 1) mp[n]++;
}

//絶対値
template<class T, class U = std::make_unsigned_t<T>>
U SafeAbs( T x ) {
    return x < 0 ? -static_cast<uintmax_t>(x) : x;
}

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

//xのn乗
ll mod_pow(ll x, ll n, ll mod) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * x % mod;
        x = x * x % mod;
        n >>= 1;
    }
    return res;
}
//xの逆元
ll mod_inv(ll x, ll mod) {//O(log(mod))
    return mod_pow(x, mod - 2, mod);
}

//nCr
ll ncr(ll n, ll r, ll mod){
	ll res=1;
	ll num=1,den=1;
	for(ll i=n;i>=n-r+1;i--){
		(den*=i)%=mod;
	}
	for(ll i=1;i<=r;i++){
		(num*=i)%=mod;
	}
	
	res=den*mod_inv(num,mod);

	return res%mod;
}


//二分探索
bool isOk(ll index, ll key,vector<ll> &a, bool g){
	if(g){
		if(a[index]<key){
			return true;
		}
	}
	else{
		if(a[index]>key){
			return true;
		}
	}
	return false;
}

ll bin_search(ll key, vector<ll> &a, bool g){
	
	ll l=-1;
	ll r=a.size();

	if(g){
		l=a.size();
		r=-1;
	}

	while(abs(r-l)>1){
		ll mid = (l+r)/2;
		if(isOk(mid, key, a, g)){
			r=mid;
		}
		else{
			l=mid;
		}
	}
	return r;
}

int main(){

	ll x;
	cin>>x;

	if(x==3 || x==5 || x==7){
		cout<<"YES"<<endl;
	}
	else{
		cout<<"NO"<<endl;
	}

	
	
    return 0;
}


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

int main() {
    int n, m;
    cin >> n >> m;
    int h[n];
    set<int> good;
    for (int i=0; i<n; i++) {
        int height;
        cin >> height;
        h[i] = height;
        good.insert(i);
    }
    for (int i=0; i<m; i++) {
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        if (h[a] < h[b]) {
            good.erase(a);
        }
        if (h[a] > h[b]) {
            good.erase(b);
        }
        if (h[a] == h[b]) {
            good.erase(a);
            good.erase(b);
        }
    }
    //for (int i: good) {
    //    cout << i << endl;
    //}
    cout << good.size() << endl;
}


Measured memory_bytes: 8676
#pragma comment(linker, "/STACK:10240000")
#include <map>
#include <set>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <stack>
#include <vector>
#include <cstdio>
#include <string>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>

using namespace std;

const int MAXN = 110;

char st[][MAXN] = {"KIHBR", "AKIHBR", "KIHABR", "KIHBAR", "KIHBRA", "AKIHABR", "AKIHBAR", "AKIHBRA", "KIHABAR", "KIHABRA", "KIHBARA", "AKIHABAR", "AKIHABRA", "AKIHBARA", "KIHABARA", "AKIHABARA"};
char s[MAXN];

int main ()
{
    scanf ("%s", &s);
    int len = strlen (s);
    bool flag = false;
    for (int i = 0; i < 16; i ++)
    {
        int k = strlen (st[i]);
        if (len == k)
        {
            bool now = true;
            for (int j = 0; j < k; j ++)
            {
                if (s[j] != st[i][j])
                {
                    now = false;
                    break;
                }
            }
            if (now)
            {
                flag = true;
                break;
            }
        }
    }
    if (flag)
    {
        printf ("YES\n");
    }
    else
    {
        printf ("NO\n");
    }
    return 0;
}

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

int n, A[20];

int solve(int i, int m) {
	if (m == 0) return 1;
	if (i >= n) return 0;
	int res = solve(i + 1, m) || solve(i + 1, m - A[i]);
	return res;
}

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

	int q, m;
	cin >> q;
	for (int i = 0; i < q; ++i) {
		cin >> m;

		cout << (solve(0, m) ? "yes" : "no") << endl;
	}
	return 0;
}

Measured memory_bytes: 1152
#include <iostream>
#include <queue>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <iomanip>
#include <cmath>
#include <cstdlib>
#include <math.h>
#include <stdlib.h>
#include <numeric>

bool mycompare( const std::tuple<std::string,int,int> &lhs, const std::tuple<std::string,int,int> &rhs )
{
    if (std::get<0>(lhs) != std::get<0>(rhs)) return std::get<0>(lhs) < std::get<0>(rhs);
    if (std::get<1>(lhs) != std::get<1>(rhs)) return std::get<1>(lhs) > std::get<1>(rhs);
    return std::get<2>(lhs) < std::get<2>(rhs);
}

int main(){
	int n, p;
	std::string s;
	std::cin >> n;
	std::vector<std::tuple<std::string,int,int>> vec(n);
	for(int i = 0; i < n; i++){
		std::cin >> s >> p;
		std::get<0>(vec[i]) = s;
		std::get<1>(vec[i]) = p;
		std::get<2>(vec[i]) = i;
	}
	std::sort(vec.begin(), vec.end(), mycompare);
	for(int i = 0; i < n; i++){
		std::cout << std::get<2>(vec[i]) + 1 << std::endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <stdlib.h>
#include <map>
#include <cmath>
#define MOD_P 1000000007
#define MOD_Q 998244353
#define PI 3.14159265358979
#define ll long long
using namespace std;

int Msquare_int(int x)
{
	return (ll)x * (ll)x % MOD_P;
}

int Mpower_int(int x, int e)
{
	if (e == 1) {
		return x;
	}
	if (e % 2) {
		return (int)((ll)(Msquare_int(Mpower_int(x, (e - 1) / 2))) * (ll)x % MOD_P);
	}
	return Msquare_int((Mpower_int(x, e / 2)) % MOD_P);
}

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

	int p10 = Mpower_int(10, n);
	int p9 = Mpower_int(9, n);
	ll p2 = (ll)p9 * 2LL;
	p2 %= MOD_P;
	int p8 = Mpower_int(8, n);
	p10 += p8;
	p10 %= MOD_P;
	p10 -= (int)p2;
	if (p10 < 0) {
		p10 += MOD_P;
	}

	printf("%d", p10);


	return 0;
}

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

#define FAST_IO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ll long long
#define FOR(i,l,r) for(long long i=l; i<r; i++)
#define FOR_REV(i,r,l) for(long long i=r; i>=l; i--)
#define pb push_back
#define mp make_pair

int main()
{
    long double circum;
    ll r;

    cin>>r;

    circum = (long double)(2*22*r)/(long double)7;

    cout<<setprecision(10)<<circum<<endl;
}


Measured memory_bytes: 3788
#include <iostream>
#include <vector>
#include <bits/stdc++.h>
 
using namespace std;
int main(){
int vec[3][3];
cin >> vec[0][0] >> vec[1][0] >> vec[2][0];
cin >> vec[0][1] >> vec[1][1] >> vec[2][1];
cin >> vec[0][2] >> vec[1][2] >> vec[2][2];
 
int a1, a2, a3, b1, b2, b3;
bool ans = false;
 
for(a1 = -100; a1 <= 100; a1++){
  b1 = vec[0][0] - a1;
  b2 = vec[1][0] - a1;
  b3 = vec[2][0] - a1;
  for(a2 = -100; a2 <= 100; a2++){
    if(vec[0][1] == a2 + b1 && vec[1][1] == a2 + b2 && vec[2][1] == a2 + b3){
      for(a3 = -100; a3 <= 100; a3++){
        if(vec[0][2] == a3 + b1 && vec[1][2] == a3 + b2 && vec[2][2] == a3 + b3) ans = true;
      }
    }
  }
 
}
  if(ans) cout << "Yes";
  else cout << "No";
}

Measured memory_bytes: 256
#include<iostream>
#include<time.h>
#include<stdlib.h>
#include<string>
#include<numeric>

using namespace std;

int main(){
    int n = 0; cin >> n;
    int a = 0; cin >> a;
    if(n * 500 >= a) cout << "Yes";
    else cout << "No";
    return 0;
}

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

#define mp make_pair
#define pb push_back

using namespace std;

char c[22];
int len;

bool ask(int q){
	printf("? ");
	for(int i = q; i > 0; --i) printf("%c",c[i]);
	puts("");fflush(stdout);
	char s[6];
	scanf("%s",&s);
	return s[0] == 'Y';
}

int main(){
//	freopen("input.inp", "r", stdin);
	int len = -1;
	for(int i = 1; i <= 10; ++i){
		c[i] = '1';
		if (!ask(i)){
			len = i - 1;
			break;
		}
		c[i] = '0';
	}
	if (len == -1){
		for(int i = 1; i <= 10; ++i){
			c[i] = '9';
			if (ask(i)){
				len = i;
				break;
			}
		}
	}
	for(int i = 1; i <= len + 1; ++i) c[i] = '9';
	for(int i = len + 1; i > 1; --i){
		int l = (len + 1) == i, r = 9;
		while (l <= r){
			int md = (l + r) >> 1;
			c[i] = char(md + '0');
			if (!ask(len + 1)) l = md + 1;
			else r = md - 1;
		}
		c[i] = char(l + '0');
	}
	printf("! ");
	for(int i = len + 1; i > 1; --i) printf("%c", c[i]);
	puts("");fflush(stdout);
	return 0;
}

Measured memory_bytes: 596
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
using namespace std;
using ll = long long;
using P = pair<int, int>;

ll COM[51][51];

void COMinit(int n){
    for(int i=0; i<=n; i++){
        for(int j=0; j<=n; j++){
            if(j == 0 || j == i) COM[i][j] = 1;
            else COM[i][j] = (COM[i-1][j-1] + COM[i-1][j]);
        }
    }
}


int main(){
    COMinit(50);
    int n, a, b;
    cin >> n >> a >> b;
    vector<double> v(n);
    rep(i, n) cin >> v[i];
    sort(rall(v));
    
    double max_ave = 0;
    rep(i, a) max_ave += v[i];
    max_ave /= (double)a;

    ll ans = 0;
    ll v0 = v[a-1];
    if(v0 != v[0]){
        int idx = 0;
        ll y = 0, x = 0;
        while(idx < n){
            x += (v0 == v[idx]);
            if(idx < a) y += (v0 == v[idx]);
            idx++;
        }
        ans += COM[x][y];
    }
    else if(v0 == v[0]){
        int idx = 0;
        ll x = 0;
        while(idx < n){
            x += (v0 == v[idx]);
            idx++;
        }
        for(int y = a; y <= b; y++) if(y <= x) ans += COM[x][y];
    }


    cout << fixed << setprecision(9) << max_ave << endl;
    cout << ans << endl;
}

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

long A, B, C, X, Y, ans;

int main(void) {

    cin >> A >> B >> C >> X >> Y;

    ans += min(A+B, C*2) * min(X, Y);

    long tmp = min(X,Y);
    X -= tmp; Y -= tmp;

    if (X > 0) {
        ans += min(A, C*2) * X;
    }

    if (Y > 0) {
        ans += min(B, C*2) * Y;
    }

    cout << ans << endl;

    return 0;

}

Measured memory_bytes: 3576
#include <bits/stdc++.h>
using namespace std;
int main () {
	int n;
	cin >> n;
	long long a[10000], b[10000];
	for (int i = 0; i < n; i++) cin >> a[i];
	for (int j = 0; j < n; j++) cin >> b[j];
	long long x = 0, y = 0;
	for (int i = 0; i < n; i++) {
		if (a[i] < b[i]) {
			if (b[i] - a[i] % 2 == 0) {
				y += (b[i] - a[i]) / 2;
				a[i] = b[i];
			}
			else {
				y += (b[i] - a[i]) / 2 + 1;
				a[i] = b[i] + 1;
			}
		}
	}
	for (int i = 0; i < n; i++) {
		if (a[i] > b[i]) {
			if (a[i] - b[i] > y) {
				puts("No");
				return 0;
			}
			else {
				y -= a[i] - b[i];
				b[i] = a[i];
			}
		}
	}
	puts("Yes");
}


Measured memory_bytes: 384
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner scn = new Scanner(System.in);
        String s = scn.nextLine();
        String c = "s";
        String d = "es";
        if(s.endsWith("s"))
        {
            s = s+d;
        }
        else
        {
            s = s+c;
        }
      System.out.println(s);
    }
}


Measured memory_bytes: 39432
// clang-format off
#include <bits/stdc++.h>
#define int long long
#define main signed main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define forever while (true)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
template<typename A> using V = std::vector<A>;
template<typename A> using F = std::function<A>;
template<typename A, typename B> using P = std::pair<A, B>;
using pii = P<int, int>;
using vi = V<int>;
using vd = V<double>;
using vs = V<std::string>;
using vpii = V<pii>;
using vvi = V<vi>;
using vvpii = V<vpii>;
constexpr int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
constexpr int MOD = 1000000007;
constexpr double PI = acos(-1);
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
template<typename T> std::istream &operator>>(std::istream &is, std::vector<T> &v) { for (T &x : v) is >> x; return is; }
using namespace std;
// clang-format on

main {
  int n;
  cin >> n;
  set<int> a;
  while (n--) { // O(n log n)
    int s;
    cin >> s;
    a.insert(s);
  }
  int q;
  cin >> q;
  int c = 0;
  while (q--) { // O(q log n)
    int t;
    cin >> t;
    c += a.count(t);
  }
  cout << c << endl;
}

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

#define FOR(i, s, e)   for(int i = (s); i < (e); i++)
#define FOR64(i, s, e) for(ll  i = (s); i < (e); i++)
#define ALL(x)         (x).begin(), (x).end()
#define SORT(b, e)     sort((b), (e))
#define REV(b, e)      reverse((b), (e))
#define VSORT(v)       sort((v).begin(), (v).end())
#define VREV(v)        reverse((v).begin(), (v).end())
#define pb(a)          push_back(a)
#define INF            999999999

typedef long long ll;

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

	int h = K / 2;

	if(K % 2 == 0)
		cout << h * h << endl;
	else
		cout << h * (h + 1) << endl;

	return 0;
}



Measured memory_bytes: 256
N = int(input())
A = input().split()
A_b = [e for e in A]
A_s = [e for e in A]


# bubble sort

flag = True
left = 0

while flag:
    flag = False
    for i in range(N-1, left, -1):
        if int(A_b[i][1]) < int(A_b[i-1][1]):
            A_b[i], A_b[i-1] = A_b[i-1], A_b[i]
            flag = True
    left += 1
print(" ".join(A_b))
print("Stable")


# selsection sort

for i in range(N):
    minj = i
    for j in range(i, N):
        if int(A_s[j][1]) < int(A_s[minj][1]):
            minj = j
    if minj != i:
        A_s[i], A_s[minj] = A_s[minj], A_s[i]
print(" ".join(A_s))

is_same = True
for i in range(N):
    if A_s[i] != A_b[i]:
        is_same = False
        break
if is_same:
    print("Stable")
else:
    print("Not stable")



Measured memory_bytes: 5612
#include<bits/stdc++.h>
#include<algorithm>
using namespace std;
typedef long long signed int ll;

ll maxl(ll x,ll y){
    if(x>y){
        return x;
    }else{
        return y;
    }
}

int main(){
    int n;
    cin>>n;
    int x[105],y[105];
    ll h[105];
    int a;
    for(int i=0;i<n;i++){
        cin>>x[i]>>y[i]>>h[i];
    }
    ll h0=h[0];
    int anscx,anscy;
    ll ansh;
    for(int i=0;i<101;i++){
        for(int j=0;j<101;j++){
            int cx=i,cy=j;
            for(int k=-200;k<201;k++){
                ll H=h0+k;
                bool ok=true;
                for(int l=0;l<n;l++){
                    if(h[l]!=maxl(0,H-abs(x[l]-cx)-abs(y[l]-cy))){
                        ok=false;
                    }
                }
                if(ok){
                    anscx=cx;
                    anscy=cy;
                    ansh=H;
                    cout<<anscx<<" "<<anscy<<" "<<ansh<<endl;
                    return 0;
                }
            }
        }
    }
    
    return 0;
}



Measured memory_bytes: 384
//Edit Distance (Levenshtein Distance)
#include<bits/stdc++.h>
using namespace std;

int dp[1001][1001];

int main(){
  string s1, s2;
  cin>>s1>>s2;
  for(int i=0; i<1001; i++){
    dp[i][0]=i;
    dp[0][i]=i;
  }
  for(int i=1; i<=s1.length(); i++)
    for(int j=1; j<=s2.length(); j++)
      if(s1[i-1]==s2[j-1])dp[i][j]=dp[i-1][j-1];
      else dp[i][j]=min(dp[i][j-1], min(dp[i-1][j], dp[i-1][j-1]))+1;

  cout<<dp[s1.length()][s2.length()]<<endl;
  return 0;
}

Measured memory_bytes: 5096
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<utility>
#include<set>
#include<stack>
#include<list>
#include<deque>
#include<bitset>
#include<iomanip>
#include<cstring>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<climits>
#include<cmath>
#include<cctype>


#define pb push_back
#define mp make_pair
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define ren(i,a,b) for(int i=a;i>=b;i--)
#define ff first
#define ss second
#define pll pair<long long int,long long int>
#define pii pair<int,int>
#define vll vector<long long int>
#define vii vector<int>
#define gi(n) scanf("%d",&n)
#define gll(n) scanf("%lld",&n)
#define gstr(n) scanf("%s",n)
#define gl(n) cin >> n
#define oi(n) printf("%d",n)
#define oll(n) printf("%lld",n)
#define ostr(n) printf("%s",n)
#define ol(n) cout << n
#define os cout<<" "
#define on cout<<"\n"
#define o2(a,b) cout<<a<<" "<<b
#define all(n) n.begin(),n.end()
#define present(s,x) (s.find(x) != s.end())
#define cpresent(s,x) (find(all(s),x) != s.end())
#define tr(container, it) for(__typeof(container.begin()) it = container.begin(); it != container.end(); it++)
using namespace std;

typedef unsigned long long int ull;
typedef long long int ll;
typedef long double ld;
typedef vector<vector<ll> > mat;


int main()
{ios_base::sync_with_stdio(false);
int a,b;
cin>>a>>b;
int c[4]={0};
c[a]=1;c[b]=1;
rep(i,1,3)
{
	if(c[i]==0)
	{
		ol(i);
		return 0;
	}
}
return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define inf 0x3f3f3f3f
using namespace std;
const ll maxn=1e9+7;
bool vis[8];
int main(){
    int n,x;
    cin>>n;
    for(int i=0;i<8;i++) vis[i]=0;
    int cnt=0;
    for(int i=0;i<n;i++){
        cin>>x;
        if(x>=3200) cnt++;
        else vis[x/400]=1;
    }
    int ans=0;
    for(int i=0;i<8;i++) ans+=vis[i];
    if(ans==0){
        ans=1;
        cnt--;
    }
    cout<<ans<<" "<<ans+cnt<<endl;
    return 0;
}

Measured memory_bytes: 3632