akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;

namespace MyProject
{
    class Program
    {
        static void Main(string[] args)
        {
#if Local
            var sw = new Stopwatch();
            sw.Start();
            Console.SetIn(new StreamReader("input.in"));
#endif

            var solver = new Solver();
            solver.Solve();
#if Local
            Console.WriteLine($"{sw.ElapsedMilliseconds}ms");
#endif
        }
    }

    class Solver
    {
        public void Solve()
        {
            var A = Console.ReadLine();
            Console.WriteLine(char.IsUpper(A[0]) ? "A" : "a");
        }
    }
}


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

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

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

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

#define P pair<int,int>
#define I vector<int>
#define S set<int>
#define pb(v) push_back(v)
#define V vector
LL mou(LL a){
    string str = to_string(a);
    return str.size();
}
int main(){
   LL N;cin >> N;
    LL ma = 1000000;
    FOR(a,1,N+1){
        if(a > N/a)break;
        if(N%a==0){
        ma = min(ma,max(mou(a),mou(N/a)));
        }
    }
    COUT(ma);
    return 0;
}


Measured memory_bytes: 256
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
using namespace std;

int main(){
    string s;
    cin >> s;
    int n=0;
    rep(i,s.size()){
        n+=(s[i]-'0');
    }
    if(n%9){
        cout << "No"<<endl;
    }else{
        cout << "Yes"<<endl;
    }
}

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

int main() {
  int a, b, c, d, e;
  cin >> a >> b >> c >> d >> e;
  int a1 = a%10;
  int b1 = b%10;
  int c1 = c%10;
  int d1 = d%10;
  int e1 = e%10;
  int sum = 0;
  if (a1 != 0) sum += a - a1 + 10;
  else sum += a;
  if (b1 != 0) sum += b - b1 + 10;
  else sum += b;
  if (c1 != 0) sum += c - c1 + 10;
  else sum += c;
  if (d1 != 0) sum += d - d1 + 10;
  else sum += d;
  if (e1 != 0) sum += e - e1 + 10;
  else sum += e;
  
  int min = 10;
  if (a1 != 0 & a1 < min) min = a1;
  if (b1 != 0 & b1 < min) min = b1;
  if (c1 != 0 & c1 < min) min = c1;
  if (d1 != 0 & d1 < min) min = d1;
  if (e1 != 0 & e1 < min) min = e1;
  
  cout << sum - 10 + min << endl;
  
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(v) v.begin(), v.end()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using ll = long long;
const ll MOD = 1e9+7; ll LLINF = 1LL << 60; int INF = INT_MAX;

//

ll modpow(ll a, ll n, ll mod) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
 
// a^{-1} mod を計算する
ll modinv(ll a, ll mod) {
    return modpow(a, mod - 2, mod);
}
 
const int MAX = 3000000;
 
ll 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;
    }
}
 
// 二項係数計算
ll 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;
}

int main(){
    COMinit();
    ll x,y; cin>>x>>y;
    if((2*x-y)%3!=0){
        cout<<0<<endl;
        return 0;
    }else{
        ll k=(2*x-y)/3;
        cout<<COM(x-k,k)<<endl;
    }
    return 0;
}

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

stack<char> S;
string s,temp="";

int main(){
  cin >> s;
  for (int i=0;i< s.size();i++){
    if (s[i] == '1' or s[i] == '0'){
      S.push(s[i]);
    }
    else{
      if (S.empty() == false){
        S.pop();
      }
    }
  }
  
  while (S.empty() == false) {
    temp = S.top() + temp;
    S.pop();
  }
  cout << temp;
}





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

int n, m;
string a[60], b[60];
int main() {
	int i, j, k;
	cin >> n >> m;
	for (i = 0; i < n; i++) cin >> a[i];
	for (i = 0; i < m; i++) cin >> b[i];
	for (i = 0; i <= n - m; i++) {
		for (j = 0; j <= n - m; j++) {
			for (k = 0; k < m; k++) {
				if (a[i + k].substr(j, m) != b[k]) break;
			}
			if (k == m) {
				cout << "Yes"; return 0;
			}
		}
	}
	cout << "No";
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define mp make_pair
#define pb push_back
#define ip pair<ll,ll>
#define ff first
#define ss second
#define MAX 100005
const ll MOD = 1000000007;

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

	string s,t;
	cin>>s>>t;
	int n = s.length();
	int ans = 0;
	for(int i=0;i<n;i++){
		if(s[i] != t[i])
			++ans;
	}

	cout<<ans<<endl;
}

Measured memory_bytes: 3756
#include<bits/stdc++.h>
using namespace std;
#define IOS ios_base::sync_with_stdio(false) ; cin.tie(NULL) ; cout.tie(NULL);
#define int long long
#define pi pair<int,int>
#define ff first
#define ss second
#define pb push_back
#define mod 1000000007

int32_t main(){
    IOS;

string s,t;
cin>>s>>t;
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(i==0 || j==0)
        dp[i][j] = 0;
           
        else if(s[i-1] == t[j-1])
        dp[i][j] = dp[i-1][j-1] + 1;

        else
        {
            dp[i][j] = max(dp[i-1][j] , dp[i][j-1]);
        }   

    }
}

string res;

int i=m,j=n;
while(i!=0 && j!=0)
{
    if(s[i-1] == t[j-1])
    {
        res.pb(s[i-1]);
        i--;
        j--;
    }
    else if(dp[i-1][j] >= dp[i][j-1])
    i--;
    else
    {
        j--;
    }
    
}
reverse(res.begin() , res.end());
cout<<res<<endl;


}


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


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

    if ((a % k == 0) || (b % k == 0)) {
        cout << "OK" << endl;
        return 0;
    }

    int s = a / k;


    if (s * k + k <= b) {
        cout << "OK" << endl;
        return 0;
    }

    cout << "NG" << endl;
    return 0;
}


Measured memory_bytes: 3596
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt(),i,x=0,m=0;
		String s=sc.next();
		for(i=0;i<n;i++){
			if(s.charAt(i)=='I')x++;
			else if(s.charAt(i)=='D')x--;
			if(m<x)m=x;
		}
		System.out.println(m);
	}
}

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

class Dice{
public:
  vector<int> side;

  Dice(vector<int> _side){
    side = _side;
  }
  void rotate(char c){
    vector<int> t;
    if(c == 'N') t = {1, 5, 2, 3, 0, 4};
    else if (c == 'S') t = {4, 0, 2, 3, 5, 1};
    else if (c == 'E') t = {3, 1, 0, 5, 4, 2};
    else if (c == 'W') t = {2, 1, 5, 0, 4, 3};
    else if (c == 'L') t = {0, 3, 1, 4, 2, 5};
    else if (c == 'R') t = {0, 2, 4, 1, 3, 5};
    vector<int> new_side(6);
    for(int i = 0; i < 6; i++) new_side[i] = side[t[i]];
    side = new_side;
  }
};

int main(){
  vector<int> _side(6);
  for(int i = 0; i < 6; i++) cin >> _side[i];
  Dice d(_side);
  int q; cin >> q;
  for(int i = 0; i < q; i++){
    int top, front; cin >> top >> front;
    for(int k = 0; k < 4; k++){
      if(d.side[0] == top) break;
      d.rotate('N');
    }
    for(int k = 0; k < 4; k++){
      if(d.side[0] == top) break;
      d.rotate('E');
    }
    for(int k = 0; k < 4; k++){
      if(d.side[1] == front) break;
      d.rotate('L');
    }
    cout << d.side[2] << endl;
  }
}



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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcountll

#define INF 1e16
#define mod 1000000007

ll n;
ll a[200010];
ll dp[200010][3];
ll suf[200010];

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

  cin>>n;
  rep(i,n)cin>>a[i];

  rep(i,n+1)rep(j,3)dp[i][j]=INF;
  ll sum=0;
  rep(i,n+1){
    dp[i][0]=sum;
    sum+=a[i];
  }
  for(ll i=n;i>=1;i--){
    suf[i-1]=suf[i]+a[i-1];
  }
  ll res=INF;
  rep(i,n)rep(j,3){
    if(dp[i][j]==INF)continue;
    if((a[i]%2)==1){
      if(j==0){
        minch(dp[i+1][1],dp[i][j]);
        minch(dp[i+1][0],dp[i][j]+1);
      }else if(j==1){
        minch(dp[i+1][1],dp[i][j]);
        minch(dp[i+1][2],dp[i][j]+1);
      }else if(j==2){
        minch(dp[i+1][2],dp[i][j]+1);
      }
    }else{
      if(j==0){
        if(a[i]>0) minch(dp[i+1][0],dp[i][j]);
        else minch(dp[i+1][0],dp[i][j]+2);
        minch(dp[i+1][1],dp[i][j]+1);
      }else if(j==1){
        minch(dp[i+1][1],dp[i][j]+1);
        if(a[i]>0) minch(dp[i+1][2],dp[i][j]);
        else minch(dp[i+1][2],dp[i][j]+2);
      }else if(j==2){
        if(a[i]>0) minch(dp[i+1][2],dp[i][j]);
        else minch(dp[i+1][2],dp[i][j]+2);
      }
    }
    minch(res,dp[i][j]+suf[i]);
  }
  rep(j,3)minch(res,dp[n][j]+suf[n]);

  cout<<res<<endl;

  return 0;
}


Measured memory_bytes: 8064
h,w=map(int, input().split())
l=[list(input()) for i in range(h)]

for i in reversed(range(h)):
  if all(j=="." for j in l[i]):
    l.pop(i)
for i in reversed(range(w)):
  if all(j[i]=="." for j in l):
    for j in l:
      j.pop(i)
for i in l:
  print(''.join(i))
  

Measured memory_bytes: 39536
#include <iostream>
#include <algorithm>
#define MAX_INT  100005
using namespace std;

//入力
long X, Y;

int main() {

  ios::sync_with_stdio(false);

  cin >> X >> Y;
  int a = 0, b = 0;

  // 絶対値を一致させる
  while( abs(X) != abs(Y) ) {
    if( abs( abs(X + 1) - abs(Y) ) < abs( abs(X) - abs(Y) ) ) {
      // +1 で絶対値の差が縮むまで +1
      int diff = abs( abs(X) - abs(Y) );
      a += diff;
      X += diff;
    } else {
      b++;
      X = -X;
    }
  }

  // 符号を一致させる
  if (X != Y) {
    b++;
  }

  cout << a + b << "\n";
}


Measured memory_bytes: 256
// D - Coloring Edges on Tree
#include <bits/stdc++.h>
using namespace std;
#define NMAX 100000

int K = 1;
vector<vector<int>> tree(NMAX);
int colors[NMAX], visited[NMAX];

void dfs(int p, int p_color){
	int color = 1;
	for(int c:tree[p]){
		if(visited[c]) continue;
		visited[c] = true;
		colors[c] = color==p_color? ++color: color;
		K = max(K, color);
		dfs(c, color++);
	}
}

int main(){
	int N; cin>>N;
	int C[N-1];
	for(int i=0; i<N-1; ++i){
		int p; scanf("%d%d", &p, C+i); p--,C[i]--;
		tree[p].push_back(C[i]);
		tree[C[i]].push_back(p);
	}
	visited[0] = true;
	dfs(0, -1);
	printf("%d\n", K);
	for(int c:C) printf("%d\n", colors[c]);
}

Measured memory_bytes: 7936
#include <iostream>
using namespace std;
int main(){
	int a[3]={1,2,3};
	int n,i,temp,out;
	char b[6];
	while(cin>>n){
		if(n==0){break;}
		a[0]=1,a[1]=2,a[2]=3;
		out=1;
		for(i=0;i<n;i++){
			cin>>b;
			if(b[0]=='N'){
				temp=a[0];
				a[0]=a[1];
				a[1]=7-temp;
				out+=a[0];
			}else if(b[0]=='E'){
				temp=a[2];
				a[2]=a[0];
				a[0]=7-temp;
				out+=a[0];
			}else if(b[0]=='W'){
				temp=a[0];
				a[0]=a[2];
				a[2]=7-temp;
				out+=a[0];
			}else if(b[0]=='S'){
				temp=a[1];
				a[1]=a[0];
				a[0]=7-temp;
				out+=a[0];
			}else if(b[0]=='R'){
				temp=a[1];
				a[1]=a[2];
				a[2]=7-temp;
				out+=a[0];
			}else if(b[0]=='L'){
				temp=a[2];
				a[2]=a[1];
				a[1]=7-temp;
				out+=a[0];
			}
		}
		cout<<out<<endl;
	}
	return 0;
}

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

using namespace std;

#define int long long
#define endl '\n'
#define MOD 1000000007
#define maxn 21

int g[maxn][maxn];
int v, e;
int start;
int dp[100010][21];

int solve(int visited, int cur) {
    if (dp[visited][cur] != -1)
        return dp[visited][cur];
    if (__builtin_popcount(visited) == v) {
        if (g[cur][start] != -1)
            return dp[visited][cur] = g[cur][start];
        return dp[visited][cur] = 1e14;
    }

    int ans = 1e14;
    for (int i = 0; i < v; i++) {
        if (g[cur][i] != -1 and !(visited & (1 << i)))
            ans = min(ans, g[cur][i] + solve(visited | (1 << i), i));
    }
    return dp[visited][cur] = ans;
}

void solve() {
    cin >> v >> e;

    memset(dp, -1, sizeof dp);
    memset(g, -1, sizeof g);

    for (int i = 0; i < e; i++) {
        int a, b, d;
        cin >> a >> b >> d;

        g[a][b] = d;
    }
    int ans = solve(1 << 0, 0);
    if (ans >= 1e14)
        ans = -1;
    cout << ans << endl;
}

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

    int t = 1;
//    cin >> t;

    while (t--)
        solve();
    return 0;
}


Measured memory_bytes: 19596
#pragma region Macros
#include <bits/stdc++.h>
using namespace std;
//#include <boost/multiprecision/cpp_int.hpp>
//using multiInt = boost::multiprecision::cpp_int;

using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pld = pair<ld, ld>;
template <typename Q_type>
using smaller_queue = priority_queue<Q_type, vector<Q_type>, greater<Q_type>>;

constexpr int MOD_TYPE = 2;
constexpr ll MOD = (MOD_TYPE == 1 ? (ll)(1e9 + 7) : 998244353);
constexpr int INF = (int)1e9;
constexpr ll LINF = (ll)4e18;
constexpr ld PI = acos(-1.0);
constexpr ld EPS = 1e-11;
constexpr int Dx[] = {0, 0, -1, 1, -1, 1, -1, 1, 0};
constexpr int Dy[] = {1, -1, 0, 0, -1, -1, 1, 1, 0};

#define REP(i, m, n) for (ll i = m; i < (ll)(n); ++i)
#define rep(i, n) REP(i, 0, n)
#define MP make_pair
#define MT make_tuple
#define YES(n) cout << ((n) ? "YES" : "NO") << "\n"
#define Yes(n) cout << ((n) ? "Yes" : "No") << "\n"
#define possible(n) cout << ((n) ? "possible" : "impossible") << "\n"
#define Possible(n) cout << ((n) ? "Possible" : "Impossible") << "\n"
#define Yay(n) cout << ((n) ? "Yay!" : ":(") << "\n"
#define all(v) v.begin(), v.end()
#define NP(v) next_permutation(all(v))
#define dbg(x) cerr << #x << ":" << x << "\n";

#pragma endregion

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << setprecision(30) << setiosflags(ios::fixed);

  ll n, m;
  cin >> n >> m;
  ll a[1000010];
  rep(i, m) cin >> a[i];
  ll sum = accumulate(a, a + m, 0LL);
  if (sum > n)
    cout << -1 << endl;
  else
    cout << n - sum << endl;
  return 0;
}


Measured memory_bytes: 3724
#include <bits/stdc++.h>
using namespace std;
 
 
#define rp(i, k, n) for (int i = k; i < n; i++)
typedef long long ll;
typedef double ld;
 
ll mod = 1e9 + 7ll;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const ll inf = 1ll << 60;
int n;
vector<vector<int>> tree(200010);
vector<int> gp(200010);
vector<int> parent(200010);
vector<set<int>> ntree(200010);
vector<int> color(200010);
void DFS(int s, int p, int g){
    //現時点はs
    //pはsの親
    //gはsの祖母

    for(auto x: tree.at(s)){
        if(x!=p){
            parent.at(x) = s;
            gp.at(x) = p;  // xの祖母はp
            if(g!=0){
                ntree.at(x).insert(g);
                ntree.at(g).insert(x);
            }
            DFS(x, s, p);
        }
    }
    
}

void paint(int s){

    for(auto x: ntree.at(s)){
        if(color.at(x) == 0){
            color.at(x) = color.at(s)*(-1);
            paint(x);
        }
    }

}

int main(){
    int n, k;
    cin >> n >> k;
    string s;
    cin >> s;

    int ch = 0;
    char now = s.at(0);
    rp(i, 1, n){
        if(now != s.at(i)){
            ch++;
            now = s.at(i);
        }
    }

    if(k*2 >= ch) cout << n-1 << endl;
    else cout << n-ch-1+k*2 << endl;
    return 0;

}


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

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

 int main() {
   int N;
   int ans = 1;
   cin >> N;
   vector<int> P(N);

   rep(i, N) cin >> P.at(i);

   int min_tmp = P.at(0);
   rep(i, N - 1) {
     if (P.at(i + 1) <= min_tmp) ans++;
     min_tmp = min(min_tmp, P.at(i + 1));
   }
   cout << ans << endl;
 }


Measured memory_bytes: 1024
x = input().split()

y = input()
y2 = y[int(x[1])-1]

if int(x[1]) == 1:
  word1 = y2.lower()
  word2 = y[1:]
  print(word1+word2)
elif int(x[1]) == int(x[0]):
  word1 = y2.lower()
  word2 = y[:(int(x[1])-1)]
  print(word2+word1)
else:
  word1 = y2.lower()
  word2 = y[:(int(x[1])-1)]
  word3 = y[(int(x[1])):]
  print(word2+word1+word3)

Measured memory_bytes: 3064
from heapq import heappush, heappop
import sys
sdin = sys.stdin.readline

def dijkstra(graph:list, node:int, start:int) -> list:
    # 未探索のノードは距離INF
    INF = float("inf")
    dist = [INF]*node
    
    # 始点ノードの距離を0とし、dfsのためのpriority queを作成
    dist[start] = 0
    heap = [(0,start)]
    
    # 未探索のノードをpriority queueに入れる
    while heap:
        cost, cur_node = heappop(heap)
        
        for nex_cost, nex_node in graph[cur_node]:
            dist_cand = dist[cur_node] + nex_cost
            if dist_cand < dist[nex_node]:
                dist[nex_node] = dist_cand
                heappush(heap, (dist[nex_node], nex_node))
    
    return dist


n,m = map(int, sdin().split())
adj_list = [[] for _ in range(n)]
for _ in range(m):
    a,b,c = map(int, sdin().split())
    a -= 1
    b -= 1
    adj_list[a].append((c,b))
    adj_list[b].append((c,a))

    
shortest = []
for st in range(n):
    shortest.append(dijkstra(adj_list, n, st))

    
# チェック
ans = 0
for st in range(n):
    for cost, ds in adj_list[st]:
        if cost > shortest[st][ds]:
            ans += 1

print(ans//2)

Measured memory_bytes: 3572
#include <bits/stdc++.h>
#define ALL(A) (A).begin(), (A).end()
#define ll long long
#define rep(i, n) for (int i = 0; i < (n); i++)

const ll mod = 1e9 + 7;
const ll INF = -1 * ((1LL << 63) + 1);
const int inf = -1 * ((1 << 31) + 1);

using namespace std;

int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    int h,a;
    cin >> h >> a;
    int ans = 0;
    while(h>0){
        h-=a;
        ans++;
    }   
    cout << ans << endl;
}

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

int main(){
  string s,t;
  cin >> s >> t;
  if(s[0]==t[2] && s[1]==t[1] && s[2]==t[0]){
    cout << "YES" << endl;
  }else{
    cout << "NO" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    
    char c = sc.next().charAt(0);
    
    if(c >= 'A' && c <= 'Z'){
      System.out.println("A");
    }else{
      System.out.println("a");
    }
  }
}

Measured memory_bytes: 35548
S = int(input())
ans = 0
c = [1]
d = [0 for i in range(S)]
d = c+d
while S>=3:
    b = S-2
    S -= 3
    for i in range(1,b):
        d[i] = d[i-1] + d[i]
    ans += d[b-1]
    ans %= 10**9+7
print(ans)

Measured memory_bytes: 9196
#include <bits/stdc++.h>
using namespace std;
#define all(c) (c).begin(),(c).end()
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define iter(c) __typeof((c).begin())
#define tr(it,c) for(iter(c) it=(c).begin(); it!=(c).end(); it++)
#define pb(a) push_back(a)
#define mp(a,b) make_pair(a,b)
#define pr(a) cout << (a) << endl
typedef long long ll;
typedef pair<int,int> P;
const int MAX=1000000000;
int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};
map<string,int> m;

bool comp(string a, string b) {
  if(a.size()==b.size()) return a<b;
  else return a.size()<b.size();
}

int main() {
  m.clear();
  int n;
  cin >> n;
  while(n--) {
    string s;
    int a;
    cin >> s >> a;
    m[s]+=a;
  }
  vector<string> v;
  tr(it,m) v.pb(it->first);
  sort(all(v),comp);
  rep(i,v.size()) cout << v[i] << " " << m[v[i]] << endl;
  return 0;
}


Measured memory_bytes: 1232
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String x = br.readLine();
		String[] cut = x.split(" ");
		int a = Integer.parseInt(cut[0]);
		int b = Integer.parseInt(cut[1]);

		int[] n = { 0, 1, 3, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1 };

		System.out.println(n[a] == n[b] ? "Yes" : "No");
	}
}

Measured memory_bytes: 21204
package main

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

type Item struct {
	W float64
	V float64
}

type Items []Item

func (is Items) Len() int { return len(is) }

func (is Items) Swap(i,j int) { is[i], is[j] = is[j], is[i]}

func (is Items) Less (i,j int) bool {
	return is[i].V / is[i].W > is[j].V / is[j].W
}

func main() {
	var n int
	fmt.Scan(&n)
	var w float64
	fmt.Scan(&w)
	var items Items = make([]Item, n)

	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	for i := 0; i < n; i++ {
		sc.Scan()
		items[i].V, _ = strconv.ParseFloat(sc.Text(), 64)
		sc.Scan()
		items[i].W, _ = strconv.ParseFloat(sc.Text(), 64)
	}
	sort.Sort(items)

	val := 0.0
	for i := 0; i < n; i++ {
		if items[i].W >= w {
			val += items[i].V * w / items[i].W
			break
		}
		val += items[i].V
		w -= items[i].W
	}
	fmt.Printf("%f\n", val)
}


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

const double EPS = 1e-10;

ll K;
double R, L, P, E, T;

double dfs(ll k, double l, double r) {
  double h = (r + l) / 2;

  if(k == K) {
    return abs(h - T) < E + EPS ? 1 : 0;
  }

  double ret = 0;
  if(h > T - EPS) {
    ret += P * dfs(k + 1, h, r);
    ret += (1 - P) * dfs(k + 1, l, h);
  } else {
    ret += P * dfs(k + 1, l, h);
    ret += (1 - P) * dfs(k + 1, h, r);
  }
  return ret;
}

int main(void) {
  cin >> K >> L >> R >> P >> E >> T;
  printf("%.15lf\n", dfs(0, L, R));
}


Measured memory_bytes: 3276
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int,int> pint;

int a[100000];
int main(){
    int n,ai;
    cin>>n;
    rep(i,n){
        cin>>ai;
        ++a[ai];
    }
    int ans=0;
    rep(i,100000-2){
        ans=max(ans,a[i]+a[i+1]+a[i+2]);
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 640
#include <iostream>

using namespace std;

int main()
{
    int a, b;
    cin >> a >> b;
    if(a > b)
    cout << "a > b";
    else if(a < b) cout << "a < b";
    else if(a == b) cout << "a == b";
    cout << "\n";
    return 0;
}



Measured memory_bytes: 3096
#include<stdio.h>
#include<algorithm>
using namespace std;
pair<int ,int> t[25];
int main(){
	int a;
	while(scanf("%d",&a),a){
		for(int i=0;i<a;i++){
			scanf("%d%d",&t[i].second,&t[i].first);
		}
		std::sort(t,t+a);
		int now=0;
		bool ok=true;
		for(int i=0;i<a;i++){
			now+=t[i].second;
			if(now>t[i].first)ok=false;
		}
		printf(ok?"Yes\n":"No\n");
	}
}

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

int main() {
  int N, K;
  long long res;
  cin >> N >> K;
  
  if(K%2==0) {
    res = pow((N/K),3);
    res += pow((N+K/2)/K,3);
  } else {
    res = pow(N/K,3);
  }
  
  cout << res << endl;
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void){
	
	int a,b,d=0,r=0;
	double z,x,f=0;
	
	scanf("%d %d",&a,&b);
	
	z = a;
	x = b;
	
	d = a / b;
	r = a % b;
	f = z / x;
	
	printf("%d %d %f\n",d,r,f);
	
	return 0;
}


Measured memory_bytes: 2104
<?php
list($N,$X)=explode(" ",trim(fgets(STDIN)));
$L=explode(" ",trim(fgets(STDIN)));
$ans=1;
$sum=0;
for($i=0;$i<$N;$i++){
$sum+=$L[$i];
if($sum>$X){
echo $ans;
exit;
}else{
++$ans;
}
}
echo $ans;

Measured memory_bytes: 4856
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>

using namespace std;

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

  priority_queue<pair<int,int>> q;

  for(int i = 0; i < N; i++){
    int A;
    cin >> A;

    q.push(make_pair(A,1));
  }

  for(int i = 0; i < M; i++){
    int B, C;
    cin >> B >> C;

    q.push(make_pair(C,B));
  }

  long long sum = 0;
  for(int i = 0; i < N; i++){
    auto p = q.top();
    q.pop();
    sum += p.first;

    if(p.second > 1){
      p.second--;
      q.push(p);
    }
  }

  cout << sum;

  return 0;
}


Measured memory_bytes: 2420
#include<bits/stdc++.h>
using namespace std;
bool Isvalid(vector<pair<int,int>>out,int x){
    int sum=0;
    for(auto it:out)sum+=it.first;
    return sum>=x;
}
bool Valid(int arr[][13],vector<pair<int,int>>v,int x,int m){
    for(int i=2;i<m;i++){
        int sum=0;
        for(auto it:v){
            sum+=arr[it.second][i];
        }
        if(sum<x)return false;
    }
    return true;
}
void Allsubset(vector<int>v,int arr[][13],vector<pair<int,int>>out,int x,int i,int n,int m,int &ans){
    if(i==n){
        if(Isvalid(out,x)){
            if(Valid(arr,out,x,m)){
                int sum=0;
                for(auto it:out){
                   sum+=arr[it.second][0];
                }
                ans=min(ans,sum);
            }
        }
        return;
    }
    out.push_back(make_pair(v[i],i));
    Allsubset(v,arr,out,x,i+1,n,m,ans);
    out.pop_back();
    Allsubset(v,arr,out,x,i+1,n,m,ans);
    return;
}
int main(){
    int n,m,x;
    cin>>n>>m>>x;
    int arr[12][13];
    for(int i=0;i<n;i++){
        for(int j=0;j<m+1;j++)cin>>arr[i][j];
    }
    vector<int>v;
    for(int i=0;i<n;i++)v.push_back(arr[i][1]);
    vector<pair<int,int>>out;
    int ans=INT_MAX;
    Allsubset(v,arr,out,x,0,n,m+1,ans);
    if(ans==INT_MAX)cout<<-1;
    else cout<<ans;
    return 0;
}



Measured memory_bytes: 3648
#include <iostream>
#include <string>
using namespace std;
int main(){
    string S;
    cin >> S;
    int t=0;
    for(int i=0; i<3; i++){
        if(S[i]=='o'){
            t+=100;
        }
    }
    cout << 700+t << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int x = sc.nextInt();
    int y = sc.nextInt();
    int k[] = new int[n+1];
    int normal = 0;
    int special = 0;
    int min = 0;
    for(int i = 1;i<=n-1;i++){
      for(int j = i + 1;j<=n;j++){
        normal = j - i;
        special = Math.abs(x - i) + Math.abs(y - j) + 1;
        if(normal < special){
          min = normal;
        }else{
          min = special;
        }
        k[min]++;
      }
    }
    for(int i = 1;i<n;i++){
      System.out.println(k[i]);
    }
  }
}


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

max = max(a)
a1 = a[:]
del a1[a.index(max)]
b = [abs( max/2 - a1[i]) for i in range(n-1)]

minb = min(b)
index = b.index(minb)

print(max, end = ' ')
print(a1[index])

Measured memory_bytes: 14052
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner stdIn = new Scanner(System.in);
		int D = stdIn.nextInt();
		int T = stdIn.nextInt();
		int S = stdIn.nextInt();
	    double ans = 0;
	    ans = (double)D / (double)S;
	    if(T >= ans){
	    	System.out.println("Yes");
	    }
	    else{
	    	System.out.println("No");
	    }


		stdIn.close();
	}
}

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

#define fst(t) std::get<0>(t)
#define snd(t) std::get<1>(t)
#define thd(t) std::get<2>(t)
#define unless(p) if(!(p))
#define until(p) while(!(p))

using ll = std::int64_t;
using P = std::tuple<ll,ll>;

constexpr ll INF = 1'000'000'000'000'000'100;
int N;
ll D, X[40], Y[40];

ll diff(int s, int t, int n, int offset, ll (&X)[40]){
    ll d = 0;

    for(int i=0;i<n;++i){
        if(s >> i & 1){
            if(t >> i & 1){
                d += X[i + offset];
            }else{
                d -= X[i + offset];
            }
        }
    }

    return d;
}

std::vector<P> f(int n, int offset){
    std::vector<P> v;

    for(int i=0;i<(1<<n);++i){
        int j = i;
        while(true){
            v.emplace_back(diff(i, j, n, offset, X), diff(i, j, n, offset, Y));

            if(j == 0){
                break;
            }

            j = (j - 1) & i;
        }
    }

    return v;
}

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

    std::cin >> N >> D;

    for(int i=0;i<N;++i){
        std::cin >> X[i] >> Y[i];
    }

    int n = N / 2, m = N - n;

    std::vector<P> v1 = std::move(f(n, 0)), v2 = std::move(f(m, n));

    std::sort(v1.begin(), v1.end());
    std::sort(v2.rbegin(), v2.rend());

    std::deque<int> deq;

    int cur = 0;
    ll mx = -INF;
    for(auto &p : v2){
        ll dX, dY;
        std::tie(dX, dY) = p;

        while(!deq.empty() && fst(v1[deq.front()]) < - D - dX){
            deq.pop_front();
        }

        while(cur < v1.size() && fst(v1[cur]) < - D - dX){
            cur += 1;
        }

        while(cur < v1.size() && fst(v1[cur]) <= + D - dX){
            while(!deq.empty() && snd(v1[deq.back()]) <= snd(v1[cur])){
                deq.pop_back();
            }

            deq.push_back(cur);

            cur += 1;
        }

        unless(deq.empty()){
            mx = std::max(mx, dY + snd(v1[deq.front()]));
        }
    }

    std::cout << mx << std::endl;
}



Measured memory_bytes: 489112
#include <bits/stdc++.h>
 
using namespace std;
 
vector<int> vi;
#define _for(i,j,N) for(int i = (j); i < (N);i++)
 
int main()
{
    vi.emplace_back(0);
    int N;
    scanf("%d",&N);
    _for(i,0,N){
        int a;scanf("%d",&a);
        vi.emplace_back(a);
    }
    vi.emplace_back(0);
    int sum = 0;
    _for(i,1,vi.size()){
        sum += abs(vi[i]-vi[i-1]);
    }
    _for(i,1,vi.size()-1){
        int bef = abs(vi[i]-vi[i-1]) + abs(vi[i+1] - vi[i]);
        int after = abs(vi[i+1] - vi[i-1]);
        printf("%d\n",sum-bef+after);
    }
 
    return 0;
}

Measured memory_bytes: 1784
N,M = map(int, input().split())
# スペース区切りの整数の入力
LR=[]
for i in range(M):
    LR.append(list(map(int, input().split())))
left=[]
right=[N]
for i in range(M):
    left.append(LR[i][0])
    right.append(LR[i][1])
ans=min(right)-max(left)+1
if ans<0:
    print(0)
else:
    print(ans)

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

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std ;
int main () {
int A,B,K ; cin >> A >> B >> K ;
for ( int i = min (A , B ); i >= 1; --i ) {
if ( A % i == 0 && B % i == 0) {
--K ;
if ( K == 0) {
cout << i << endl ;
}
}
}
return 0;
}


Measured memory_bytes: 384
let h, w = Scanf.scanf "%d %d\n" (fun x y -> x, y)

let rec read_char acc = function
  | 0 -> acc
  | k -> read_char (Scanf.scanf " %c" (fun x -> if x = '#' then (acc + 1) else acc)) (k-1)

let () = print_string (if (read_char 0 (h*w)) = h+w-1 then "Possible" else "Impossible")

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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N; cin >> N;
    ll ans=0;
    for (int i=1;i<=N;++i){
        if (i%3!=0&&i%5!=0) ans+=i;
    }
    cout << ans << '\n';
}

Measured memory_bytes: 3652
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <queue>
#include <algorithm>
#include <utility>
#include <cmath>
#include <map>
#include <set>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>

#define INF_LL 1e18
#define INF 1e9

#define REP(i, n) for(int i = 0;i < (n);i++)
#define FOR(i, a, b) for(int i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()

#define fst first
#define snd second

using namespace std;

using ll = long long;
using PII = pair<int, int>;

class Union_find{
private:
	vector<int> par;
	vector<int> rank;
	int n;

public:
	Union_find(int a){
		n = a;
		for(int i = 0;i < n;i++){
			par.push_back(i);
			rank.push_back(0);
		}
	}

	int find(int x){
		if(par[x] == x){
			return x;
		}else{
			return par[x] = find(par[x]);
		}
	}

	void unite(int x, int y){
		x = find(x);
		y = find(y);
		if(x == y) return;

		if(rank[x] < rank[y]){
			par[x] = y;
		}else{
			par[y] = x;
			if(rank[x] == rank[y]) rank[x]++;
		}
	}

	bool same(int x, int y){
		return find(x) == find(y);
	}
};

int dp[2][2020][3030] = {};
int main(void){
	int N, M, S;
	while(cin >> N >> M >> S && N && M && S){
		memset(dp, 0, sizeof dp);
		FOR(i, 1, M+1){
			dp[1][i][i] = dp[1][i-1][i] + 1;
		}
		FOR(i, 2, N*N+1){
			memset(dp[i%2], 0, sizeof dp[i%2]);
			FOR(j, i, M+1){
				FOR(k, 1, S+1){
					dp[(i+1)%2][j-1][k] += dp[(i+1)%2][j-2][k];
					if(k >= j){
						dp[i%2][j][k] += dp[(i+1)%2][min(k, j-1)][k-j];
						dp[i%2][j][k] = dp[i%2][j][k] % 100000;
					}
				}
			}
		}
		ll res = 0;
		REP(i, M+1){
			res += dp[(N*N)%2][i][S];
			res = res % 100000;
		}
		cout << res << endl;
	}
}

Measured memory_bytes: 50808
/*#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")*/
#include<bits/stdc++.h>
#define ll long long
#define N 500005
#define inf 1000000005
#define mod 1000000007
#define put putchar('\n')
#define F(i,a,b) for (int i=(a);i<=(b);i++)
#define D(i,a,b) for (int i=(a);i>=(b);i--)
#define go(i,t) for (int i=head[t];i;i=Next[i])
#define sqr(x) ((x)*(x))
#define re register
#define mp make_pair
#define fi first
#define se second
#define int ll
#define pa pair<int,int>
#define pb push_back
#define be begin()
#define en end()
using namespace std;
inline char gc(){
    static char buf[100000],*p1=buf,*p2=buf;
    return p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;
}
#define gc getchar
inline int read(){char c=getchar();int tot=1;while ((c<'0'|| c>'9')&&c!='-') c=getchar();if (c=='-'){tot=-1;c=getchar();}
int sum=0;while (c>='0'&&c<='9'){sum=sum*10+c-'0';c=getchar();}return sum*tot;}
inline void wr(int x){if (x<0) {putchar('-');wr(-x);return;}if(x>=10)wr(x/10);putchar(x%10+'0');}
inline void wrn(int x){wr(x);put;}inline void wri(int x){wr(x);putchar(' ');}
inline void wrn(int x,int y){wri(x);wrn(y);}inline void wrn(int a,int b,int c){wri(a);wrn(b,c);}
int n,m,f[N],g[N],a,b,s[N],ans;
signed main(){
	n=read();a=read();b=read();f[0]=g[0]=1;
	if (a>b) swap(a,b);F(i,1,n) s[i]=read();
	F(i,3,n) if (s[i]-s[i-2]<a) return puts("0"),0;
	int l=0,r=0;
	F(i,1,n){
		while (r<i&&s[i]-s[r+1]>=b) r++;
		if (l<=r) f[i]=(g[r]-(l?g[l-1]:0)+mod)%mod;
		g[i]=(g[i-1]+f[i])%mod;
		if (i>1&&s[i]-s[i-1]<a) l=i-1;
	}
	D(i,n,0){
		ans=(ans+f[i])%mod;
		if (s[i+1]-s[i]<a&&i<n) break;
	}
	wrn(ans);
	return 0;
}

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

typedef long long lint;
typedef long double louble;

template<typename T1,typename T2> inline T1 max(T1 a,T2 b){return a<b?b:a;}
template<typename T1,typename T2> inline T1 min(T1 a,T2 b){return a<b?a:b;}

namespace ae86
{
	const int bufl = 1<<15;
	
	char buf[bufl],*s=buf,*t=buf;
	
	inline int fetch()
	{
		if(s==t){t=(s=buf)+fread(buf,1,bufl,stdin);if(s==t)return EOF;}
		return *s++;
	}
	
	inline int ty()
	{
		int a=0,b=1,c=fetch();
		while(!isdigit(c))b^=c=='-',c=fetch();
		while(isdigit(c))a=a*10+c-48,c=fetch();
		return b?a:-a;
	}
}
using ae86::ty;

const int _ = 2500007 , mo = 998244353;

inline lint powa(lint a,lint t)
{
	lint b=1;
	while(t){if(t&1)b=b*a%mo;a=a*a%mo,t>>=1;}
	return b;
}

inline lint inva(lint a){return powa(a,mo-2);}

lint jc[_],rjc[_];

inline void fuck(int n=_-1)
{
	jc[0]=jc[1]=rjc[0]=1;
	for(int i=2;i<=n;i++)jc[i]=jc[i-1]*i%mo;
	rjc[n]=inva(jc[n]);
	for(int i=n-1;i>=1;i--)rjc[i]=rjc[i+1]*(1ll+i)%mo;
}

inline lint C(int n,int m)
{
	if(n<m || n<0 || m<0)return 0;
	return jc[n]*rjc[m]%mo*rjc[n-m]%mo;
}

int n,m;

int main()
{
	fuck();

	n=ty(),m=ty();
	lint ans=C(n-1+m+m+m,n-1);
	for(int i=0;i<m;i++)ans=(ans-C(i+n-2,n-2)*n%mo+mo)%mo;
	for(int i=m+1;i<=n;i++)if((m+m+m-i)%2==0)ans=(ans-C(n,i)*C((m+m+m-i)/2+n-1,n-1)%mo+mo)%mo;
	printf("%lld\n",ans);

	return 0;
}


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

int main() {
  int N;
  cin >> N;
  auto a = vector<int>(N);
  auto b = vector<int>(N);
  auto c = vector<int>(N);
  for(auto i=0; i<N; ++i) {
    cin >> a[i] >> b[i] >> c[i];
  }
  auto v = vector<int>(N*3);
  v[0] = a[0];
  v[1] = b[0];
  v[2] = c[0];
  for(auto day=1; day<N; ++day) {
    v[day*3+0] = a[day] + max(v[(day-1)*3+1], v[(day-1)*3+2]);
    v[day*3+1] = b[day] + max(v[(day-1)*3+0], v[(day-1)*3+2]);
    v[day*3+2] = c[day] + max(v[(day-1)*3+0], v[(day-1)*3+1]);
  }
  cout << max(max(v[(N-1)*3+0], v[(N-1)*3+1]), v[(N-1)*3+2]) << endl;
  return 0;
}


Measured memory_bytes: 2560
#include<bits/stdc++.h>
using namespace std;
#define FAST ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define mod 1000000007
#define ll long long int
#define pi 3.141592653589793238
const int N = 1e5 + 10;
int main(){
    FAST;
    ll t=1;
    // cin>>t;
    while(t--)
    {
        string s;
        cin>>s;
        int n=s.length()-1;
        if(s[n]=='s')
            cout<<s<<"es";
        else
            cout<<s<<"s";
    }
    return 0;
}


Measured memory_bytes: 3616
#include <stdio.h>

int calc(){
	int W,H,x,y,r;

	scanf("%d %d %d %d %d",&W,&H,&x,&y,&r);

	if((y-r) >= 0){
		if((x-r) >= 0){

		}else{
			return -1;
		}
	}else{
		return -1;
	}

	if((x+r) <= W){
		if((y+r) <= H){

		}else{
			return -1;
		}
	}else{
		return -1;
	}

	return 1;
}

int main(){
 
	if(calc() == 1){
		printf("Yes\n");
	}else{
		printf("No\n");
	}

 return 0;
}


Measured memory_bytes: 2112
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <cstring>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <fstream>
#include <complex>
#include <stack>
#include <queue>

using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
static const double EPS = 1e-5;

#define FOR(i,k,n) for (int i=(k); i<(int)(n); ++i)
#define REP(i,n) FOR(i,0,n)

int main(void){
  int N,M;
  while(cin>>N>>M){
    if(N==0) break;
    vector<PII> times;
    REP(i,N){
      int D,P;
      cin>>D>>P;
      times.push_back(PII(P,D));
    }
    sort(times.begin(),times.end());
    reverse(times.begin(),times.end());
    int ans=0;
    REP(i,N){
      if(M>0){
        ans += max(0,times[i].second-M) * times[i].first;
        M-=times[i].second;
      }else{
        ans += times[i].second*times[i].first;
      }
    }
    cout<<ans<<endl;
  }
  return 0;
}

Measured memory_bytes: 1036
#![allow(dead_code)]
use std::io;

fn main() {
    solve_c();
}

fn solve_d() {
    let mut n = String::new();
    io::stdin().read_line(&mut n).unwrap();
    let n = n.trim().parse::<u32>().unwrap();

    let mut i = 1;
    while i <= n {
        let mut x = i;
        if (x % 3) == 0 {
            print!(" {}", i);
            i += 1;
            continue;
        }

        loop {
            if (x % 10) == 3 {
                print!(" {}", i);
                break;
            }
            x /= 10;
            if x == 0 {
                break;
            }
        }
        i += 1;
    }
    print!("\n");
}

fn solve_c() {
    let mut n = String::new();
    io::stdin().read_line(&mut n).unwrap();
    let n = n.trim().parse::<usize>().unwrap();

    let mut v = vec![0; 4 * 3 * 10];
    for _i in 0..n {
        let mut line = String::new();
        io::stdin().read_line(&mut line).unwrap();

        let line: Vec<_> = line.trim()
            .split(' ')
            .map(|s| s.parse::<i32>().unwrap())
            .collect();
        let b = line[0] as usize;
        let f = line[1] as usize;
        let r = line[2] as usize;
        let p = line[3];

        let index: usize = (b - 1) * 30 + (f - 1) * 10 + r - 1;
        v[index] += p;
    }

    for i in 0..v.len() {
        if i % 10 == 9 {
            print!(" {}\n", v[i]);
        } else {
            print!(" {}", v[i]);
        }
        if (i % 10) == 9 && (i / 10) % 3 == 2 && i != v.len() - 1 {
            println!("####################");
        }
    }
}



Measured memory_bytes: 5024
#include <iostream>
#include <algorithm>
#include <cstdio>

using namespace std;

#define reep(i,n,m) for(int i=n;i<m;i++)
#define rep(i,n) reep(i,0,n)

int main(){
    int A,B,C;
    cin >> A >> B >> C;

    int n=0;
    while(1){
        int x4 = n-A-C;
        int x3 = n-B-C;
        int x6 = n-A-B;
        int x5 = n-x4-x6;
        int x2 = n-x3-x4;
        int x1 = n-A-x2;
        /*if(x1<0 || x2<0 || x3<0 || x4<0 || x5<0){
            n++;
            continue;
        }*/
        if(x4+x5+x6 == n && x2+x3+x4 == n && A+x1+x2==n && x1+C+x5==n && x2+C+x6==n){
            printf("%d %d %d \n",A,B,x6);
            printf("%d %d %d \n",x1,C,x5);
            printf("%d %d %d \n",x2,x3,x4);
            break;
        }
        n++;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define printInt(a) printf("%d\n", a)
#define printll(a) printf("%lld\n", a)
#define printYes() printf("Yes\n")
#define printNo() printf("No\n")
#define scanll(a) scanf("%lld", &a)
#define scanInt(a) scanf("%d", &a)
#define scan2Int(a, b) scanf("%d %d", &a, &b)
#define scan3Int(a, b, c) scanf("%d %d %d", &a, &b, &c)
#define scan4Int(a, b, c, d) scanf("%d %d %d %d", &a, &b, &c, &d)
typedef long long ll;
const int INF = 1001001001;
using namespace std;
 
int main() {
    int n;
    scanInt(n);
    char s[n+1], t[n+1];
    scanf("%s %s", s, t);
    rep(i, n) {
        printf("%c", s[i]);
        printf("%c", t[i]);
    }
    printf("\n");
    return 0;
}

Measured memory_bytes: 3772
#include<bits/stdc++.h>
using namespace std;
using Graph=vector<vector<int>>;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
typedef long long ll;
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
int main(){
    int N;
    int K;
    cin>>N>>K;
    vector<int>A(N);
    rep(i,N){
        cin>>A[i];
    }
    sort(A.begin(),A.end());
    int ans=0;
    rep(i,K){
        ans+=A[i];
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3624
import sys
sys.setrecursionlimit(10**7)

class Node:
    def __init__(self,parent,left,right):
        self.parent = parent
        self.left = left
        self.right = right

def insert(T:dict,z:int):
    global root
    y = -1
    x = root
    while x != -1:
        y = x
        if z < x:
            x = T[x].left
        else:
            x = T[x].right
    T[z] = Node(y,-1,-1)
    
    if y == -1:
        root= z
    elif z < y:
        T[y].left = z
    else:
        T[y].right = z

def find(T:dict,x:int,k:int):
    while x != -1 and k != x:
        if k < x:
            x = T[x].left
        else:
            x = T[x].right
    return x

def inorder(u:int):
    if u == -1:
        return 
    inorder(T[u].left)
    print(" "+str(u),end="")
    inorder(T[u].right)

def preorder(u:int):
    if u == -1:
        return 
    print(" "+str(u),end="")
    preorder(T[u].left)
    preorder(T[u].right)

n = int(input())
root = -1
T = {}
for _ in range(n):
    scan = input().split()
    if len(scan) == 1:
        inorder(root)
        print()
        preorder(root)
        print()
    else:
        k = int(scan[-1])
        if scan[0] == "insert":
            insert(T,k)
        else:
            print("yes" if find(T,root,k) != -1 else "no")


Measured memory_bytes: 105728
#include <iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<math.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;

int main() {
	int n, m;
	cin >> n >> m;
	vector<int>a(n);
	int sum = 0;
	rep(i, n) {
		cin >> a[i];
		sum += a[i];
	}
	if (sum % 4 * m == 0) {
		sum = sum / (4 * m);
	}
	else {
		sum = sum / (4 * m) + 1;
	}
	sort(a.begin(), a.end(),greater<int>());
	if (a[m - 1] < sum) {
		cout << "No" << endl;
	}
	else {
		cout << "Yes" << endl;
	}
	return 0;
}


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

typedef long long ll;
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n,k;
    vector<int>v;
    cin>>n>>k;
    while(n--)
    {
        int a;
        cin>>a;
        v.push_back(a);
    }
    sort(v.begin(),v.end());
    reverse(v.begin(),v.end());
    int sum=0;
    for(int i=0;i<k;i++)
    {
        sum+=v[i];
    }
    cout<<sum<<endl;
    return 0;
}

Measured memory_bytes: 256
//abc155_a.cpp
//Sat Apr  4 20:42:14 2020

#include <iostream>
#include <string>
#include <queue>
#include <map>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <math.h>
#include <set>
#define INTINF 2147483647
#define LLINF 9223372036854775807
#define MOD 1000000007

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

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

	if (a==b && a!=c){
		cout << "Yes" << endl;
	}else if (a==c && a!=b){
		cout << "Yes" << endl;
	}else if (b==c && a!=b){
		cout << "Yes" << endl;
	}else {
		cout << "No" << endl;
	}
//	printf("%.4f\n",ans);
}

Measured memory_bytes: 768
def solve(a,b,c,x):
    count = 0
    for i in range(a+1):
        for j in range(b+1):
            for k in range(c+1):
                if 500*i+100*j+50*k == x:
                    count += 1
    return count

A = int(input())
B = int(input())
C = int(input())
X = int(input())

print(solve(A,B,C,X))

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

using namespace std;

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	string s="";
	int n=0,k=0;
	
	cin >> n >> k >> s;
	
	for(int i=0; i<s.length(); i++){
		if(i==(k-1)) s[k-1] = (s[i] + 32);
	}
	
	cout << s;

	return 0;
}


Measured memory_bytes: 256
#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 FOR(i, m, n) for(int i = (m); i < (n); ++i)

using ll = long long;
#define INF 1e9

long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}


int main(){
  ll N, K;
  cin >> N >> K;
  vector<ll> A(N), tento(N, 0),tento2(N,0);
  REP(i, N){
    cin >> A[i];
  }
  REP(i, N){
    REP(j, i){
      if(A[j] > A[i]){
        tento[j]++;
      }
    }
  }
  REP(i, N){
    REP(j, N){
      if(A[i] > A[j]){
        tento2[i]++;
      }
    }
  }
  // REP(i, N){
  //   cout << tento[i] << " " << tento2[i] << endl;
  // }
  ll ans = 0, mod = 1e9+7;
  ll inv = modinv(2, mod);
  REP(i, N){
    //ll cnt = K*((2*tento[i]+(K-1)*tento2[i]))/2;
    ll cnt = (2*tento[i]+(K-1)*tento2[i]);
    ll cnt2 = K;
    if(cnt2 % 2 == 0){
      cnt2/=2;
    }
    else{
      cnt/=2;
    }
    cnt %=mod, cnt2%=mod;
    ans +=(cnt*cnt2)%mod;
    ans %= mod;

  }
  cout << ans << endl;

  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, k, q;
    cin >> n >> k >> q;
    vector<int> p(n);
    rep(i, q) {
        int a;
        cin >> a;
        p[a - 1] = p[a - 1] + 1;
    }
    // cout << k - (q - p[i]);
    rep(i, n) {
        if(p[i] + k - q > 0) {
            cout << "Yes" << endl;
        } else {
            cout << "No" << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 3732