akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define rep(i,m) for(long long i=0; i<m; i++)
#define per(i,m) for(long long i=m-1; i>=0; i--)
#define FOR(i,n,m) for(long long i=n; i<m; i++)
#define ROF(i,n,m) for(long long i=n-1; i>=m; i--)
#define SORT(v,n) do{sort(v,v+n);reverse(v,v+n);}while(0)
#define all(x) (x).begin(),(x).end()
#define EPS (1e-7)
#define INF (1e18)
#define PI (acos(-1))
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
using namespace std;
typedef long long ll;
const ll MOD = 1000000007;
typedef pair<ll, ll> LP;

ll POW(ll x,ll n){
  if(n==0)return 1;
  if(n%2==0)return POW(x*x,n/2);
  return x*POW(x,n-1);
}

ll gcd(ll u, ll v) {
  ll r;
  while (0 != v) {
    r = u % v; u = v; v = r;
  }
  return u;
}
 
ll KAI(ll m)
{
  if(m<0) return 0;
  if(m==0) return 1;
  return m*KAI(m-1)%MOD;
}
 
ll extGCD(ll a, ll b, ll &x, ll &y) {
    if (b == 0) {
        x = 1;
        y = 0;
        return a;
    }
    ll d = extGCD(b, a%b, y, x);
    y -= a / b * x;
    return d;
}
 
inline ll mod(ll a, ll m) {
    return (a % m + m) % m;
}
 
ll modinv(ll a) {
    ll x, y;
    extGCD(a, MOD, x, y);
    return mod(x, MOD);
}
 
ll COM(ll m,ll n)
{
  if(m<n) return 0;
  if(n<0) return 0;
  if(n==0) return 1;
  if(m==n) return 1;
  return KAI(m)%MOD*modinv(KAI(n)%MOD*KAI(m-n)%MOD)%MOD;
}

ll DEC(ll x,ll m,ll n)
{
  return x%POW(m,n+1)/POW(m,n);
}

ll keta(ll x,ll n)
{
  if(x==0)return 0;
  return keta(x/n,n)+1;
}

ll DIV(ll x,ll n)
{
  if(x==0)return 0;
  return x/n+DIV(x/n,n);
}

ll ORD(ll x,ll n)
{
  if(x==0)return INF;
  if(x%n!=0)return 0;
  return 1+ORD(x/n,n);
}

int main()
{
  ll a,b,ans;
  ans=0;
  cin >> a >> b;
  if((a%4==0&&b%4==1)||(a%4==0&&b%4==2)||(a%4==1&&b%4==1)||(a%4==1&&b%4==2)||(a%4==2&&b%4==3)||(a%4==2&&b%4==0)||(a%4==3&&b%4==3)||(a%4==3&&b%4==0))ans++;
  FOR(i,1,50){
    if(a%POW(2,i+1)>=POW(2,i)&&b%POW(2,i+1)>=POW(2,i)){
      if(a%POW(2,i+1)%2==b%POW(2,i+1)%2)ans+=POW(2,i);
    }
    else if(a%POW(2,i+1)<POW(2,i)&&b%POW(2,i+1)<POW(2,i)){
      ans=ans;
    }
    else if(a%POW(2,i+1)<POW(2,i)){
      if(b%2==0)ans+=POW(2,i);
    }
    else{
      if(a%2==1)ans+=POW(2,i);
    }
  }
  printf("%lld",ans);
}

Measured memory_bytes: 256
import sys
from heapq import heappush, heappop


N, H = map(int, input().split())
S = [tuple(map(int, s.split())) for s in sys.stdin.readlines()]
q = []
a, b = 0, 0
for na, nb in S:
    if na <= a:
        heappush(q, (-nb, na))
    else:
        heappush(q, (-b, a))
        a, b = na, nb


cnt = 0
while H > 0:
    if H <= b:
        cnt += 1
        break

    if a < -1 * q[0][0]:
        nb, na = heappop(q)
        H -= -nb
        cnt += 1
    else:
        hit = (H - b + a - 1) // a
        cnt += hit
        H -= a * hit

print(cnt)


Measured memory_bytes: 82268
import java.util.*;

public class Main{

	public static void main(String[] args) {
		Scanner scanf =new Scanner (System.in);
		
		int n=scanf.nextInt() , i,S=100000;
		
		for (i=0;i<n;i++)
		{S*=1.05; 
		if(S%1000!=0) S=S+1000-S%1000; }
		System.out.println(S);

	}
}

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

int main () {
  int N;
  cin >> N;
  
  for (int i = 0; i < N; i++){
    string s;
    cin >> s;
     if (s == "Y"){
       cout << "Four" << endl;
       break;
     }
    if (s != "Y"){}
    if (s != "Y" && i + 1 == N){
      cout << "Three" << endl;
      break;
    }
 
  }
  
  
}

Measured memory_bytes: 3596
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <vector>
#include <map>
#include <cmath>
 
#define rep(i,n) for(int i = 0;i < (n);i++)
#define all(x) (x).begin(),(x).end()
#define pb(x) push_back(x)
#define mp(a,b) make_pair(a,b)

using namespace std;

typedef long long int ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<pair<int, int> > vpi;
typedef vector<pair<ll, ll> > vpl;

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	string s;
  cin >> s;
  int len = s.size();
  cout << ((len%2==0)^(s[0]==s[len-1])?"Second":"First") << endl;
	return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
long long f[100001][20], n;
string s;
int main () {
    ios_base :: sync_with_stdio (0);
    cin.tie (nullptr);
    cout.tie (nullptr);
    cin >> s;
    n = s.size();
    s = '@' + s;
    f[0][0] = 1;
    for (int i = 1; i <= n; ++ i) {
        for (int j = 0; j < 13; ++ j) {
            if (s[i] != '?') {
                int tmp = s[i] - '0';
                for (int k = 0; k < 13; ++ k) {
                    if ((10 * k + tmp) % 13 == j) {
                            //cout << "hah" << k <<" " << j << "\n";
                        f[i][j] += f[i - 1][k];//if (i == 1)cout << k << " "  << j << " " << f[i][j] << "\n";
                        f[i][j] %= MOD;
                    }
                }
            }
            else {
                for (int tmp = 0; tmp <= 9; ++ tmp) {
                    for (int k = 0; k < 13; ++ k) {
                        if ((10 * k + tmp) % 13 == j) {
                                //if (j == 5 && i == 3) cout << k << "\n";
                            //if (j == 5) cout << k << " " << tmp << " " << j << "\n";
                            f[i][j] += f[i - 1][k];
                            f[i][j] %= MOD;
                        }
                    }
                }
            }
        }
    }
    cout << f[n][5];
}


Measured memory_bytes: 15980
#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 FORR(i, m, n) for (int i = (m); i >= (n); --i)
#define equals(a, b) (fabs((a) - (b)) < EPS)
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
const ll mod2 = 998244353;
const ll INF = 1e18;
const long double EPS = 1e-10;

int main() {
  int h, w, n;
  cin >> h >> w >> n;
  vector<pair<int, int>> p(n);
  rep(i, n) cin >> p[i].first >> p[i].second;

  vector<ll> ans(10, 0);
  ans[0] = (ll)(h - 2) * (w - 2);

  map<pair<int, int>, int> m;
  rep(i, n) {
    FOR(j, -1, 2) {
      if (p[i].first + j <= 1) continue;
      if (p[i].first + j >= h) continue;
      FOR(k, -1, 2) {
        if (p[i].second + k <= 1) continue;
        if (p[i].second + k >= w) continue;
        ans[m[{p[i].first + j, p[i].second + k}]]--;
        m[{p[i].first + j, p[i].second + k}]++;
        ans[m[{p[i].first + j, p[i].second + k}]]++;
      }
    }
  }

  rep(i, 10) cout << ans[i] << endl;






  
  return 0;
}

Measured memory_bytes: 57216
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
using namespace std;

#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 1000000007;
const ll MAX = 1000001;

ll max(ll a, ll b) {
	if (a > b) { return a; }
	return b;
}

ll min(ll a, ll b) {
	if (a > b) { return b; }
	return a;
}

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

ll lcm(ll a, ll b) {
	return a / gcd(a, b) *b;
}

struct edge {
	ll ind;
	ll to;
	ll d;
};


///////////////////////////




int main() {

	ll N;
	cin >> N;

	vector<ll> a(N + 1);
	repn(i, N) cin >> a[i];

	sort(++a.begin(), a.end());

	cout << a[N] - a[1] << endl;


	system("PAUSE");
}


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

using namespace std;

int main(){
    int team,score[10000]={0},r;
    cin >>team;
    r=team*(team-1)/2;
    for(int i=0;i<r;i++){
        int a,b,c,d;
        cin >>a>>b>>c>>d;
        if(c>d)score[a]+=3;
        else if(c<d)score[b]+=3;
        else {
            score[a]++;
            score[b]++;
        }
    }
    int hi[10000]={0};
    for(int i=0;i<r;i++){
        hi[i]=score[i];
    }
    sort(hi+1, hi+r, greater<int>());
    for(int i=1;i<=team;i++){
        for(int j=0;j<r;j++){
            if(score[i]==hi[j]){
                cout<<j<<endl;
                score[i]=-1;
            }
        }
    }
    return 0;
}

Measured memory_bytes: 1260
x1, y1, x2, y2 = map(int, input().split())

dx = x2 -x1
dy = y2 -y1

x3 = -dy + x2
y3 = dx + y2

dx = x3 -x2
dy = y3 -y2

x4 = -dy + x3
y4 = dx + y3

print(x3, y3, x4, y4)

Measured memory_bytes: 9132
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T> V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> > Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T> mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }

/*
 <url:>
 問題文============================================================
 =================================================================
 解説=============================================================
 ================================================================
 */

void solveA(){
    ll N,K; cin >> N >> K;
    if(N%K == 0) cout << 0 << endl;
    else cout << 1 << endl;
}
void solveB(){
    ll N; cin >> N;
    vector<int> dp(1000);
    dp[0] = true;
    for(int i = 0; i < 100;i++){
        for(int j = 0; j < 500;j++){
            if(dp[j]){
                dp[j+4] = true;
                dp[j+7] = true;
            }
        }
    }
    if(dp[N]) cout << "Yes" << endl;
    else cout << "No" << endl;
}
void solveC(){
    
}
void solveD(){
    
}
int main(void) {
    cin.tie(0); ios_base::sync_with_stdio(false);
//    solveA();
    solveB();
//    solveC();
//    solveD();
    return 0;
}


Measured memory_bytes: 256
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>
#include <numeric>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <functional>
#define _USE_MATH_DEFINES
#include <cmath>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cfloat>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <cassert>
using namespace std;

#define EPS 1e-12
#define ull unsigned long long
#define ll long long
#define VI vector<ll>
#define PII pair<ll, ll> 
#define VVI vector<vector<ll> >
#define REP(i,n) for(int i=0,_n=(n);(i)<(int)_n;++i)
#define RANGE(i,a,b) for(int i=(int)a,_b=(int)(b);(i)<_b;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define ALLR(c) (c).rbegin(), (c).rend()
#define PB push_back
#define MP(a, b) make_pair(a, b)
#define POPCOUNT __builtin_popcount
#define POPCOUNTLL __builtin_popcountll
#define CLEAR(table, v) memset(table, v, sizeof(table));
#define PRINT1(table, D0) REP(d0, D0) cout<<table[d0]<<" "; cout<<"\n";
#define PRINT2(table, D0, D1) REP(d0, D0) { REP(d1, D1) cout<<table[d0][d1]<<" "; cout<<"\n"; }
#define PRINT3(table, D0, D1, D2) REP(d0, D0) { REP(d1, D1) { REP(d2, D2) cout<<table[d0][d1][d2]<<" "; cout<<"\n"; } cout<<"\n"; }
#define UNIFORM_DOUBLE(a, b) (((b-a)*(double)rand()/RAND_MAX)+a) // [a, b) 
#define UNIFORM_LL(a, b) (ll)UNIFORM_DOUBLE(a, b) // [a, b) 
#define IN(v, lo, hi) ((lo)<=(v) && (v)<(hi))
#define DD(v) cout<<#v<<": "<<v<<endl
template <typename T0, typename T1> std::ostream& operator<<(std::ostream& os, const map<T0, T1>& v) { for( typename map<T0, T1>::const_iterator p = v.begin(); p!=v.end(); p++ ){os << p->first << ": " << p->second << " ";} return os; }
template <typename T0, typename T1> std::ostream& operator<<(std::ostream& os, const pair<T0, T1>& v) { os << v.first << ": " << v.second << " "; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const vector<T>& v) { for( int i = 0; i < (int)v.size(); i++ ) { os << v[i] << " "; } return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const vector<vector<T> >& v) { for( int i = 0; i < (int)v.size(); i++ ) { os << v[i] << endl; } return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const set<T>& v) { vector<T> tmp(v.begin(), v.end()); os << tmp; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const deque<T>& v) { vector<T> tmp(v.begin(), v.end()); os << tmp; return os; }

#define MOD 1000000007LL
#define INF (1LL<<60)

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll N,A,B;
	while(cin>>N>>A>>B) {
		VI w(3);
		REP(i, N) {
			ll p;
			cin>>p;
			if(p<=A) w[0]++;
			else if(p<=B) w[1]++;
			else w[2]++;
		}
		
		cout<<min(w[0], min(w[1], w[2]))<<endl;
	}
	
	return 0;
}


Measured memory_bytes: 256
n, m = map(int, input().split())

lamp = []
# 一つのランプがどのスイッチにつながっているかをビットで表す
for i in range(m):
    k, *tmp = map(int, input().split())
    mask = 0
    for j in tmp:
        mask += 1 << (j-1)
    lamp.append(mask)

# １つのランプ毎に活性するときのスイッチON数の偶奇の取得
p = list(map(int, input().split()))

# スイッチの活性／非活性ケースごとに全ランプがＯＮになっているかチェック
# スイッチの活性／非活性ケースごと
ans = 0
for i in range(1<<n):
    all_on = True
    # ランプごと
    for j in range(len(lamp)):
        if not bin(i & lamp[j]).count('1') % 2 == p[j]:
            all_on = False
            break
    if all_on:
        ans+=1

print(ans)

Measured memory_bytes: 3064
def add_digit(n, d, x):
    """
    nのd桁目にxを挿入する
    357, 1 -> 357x
    357, 2 -> 35x7
    357, 3 -> 3x57
    357, 4 -> x357
    """
    d1 = (10**(d - 1))
    r = n % d1
    h = n // d1
    return h * d1 * 10 + x * d1 + r


def submit():
    n = int(input())
    satisfied = {357, 375, 537, 573, 735, 753}

    stop = False
    curr_d = 3
    ans = 0
    while True:
        for s in satisfied:
            if s <= n:
                ans += 1
            else:
                stop = True
        
        if stop:
            break

        new_satisfied = []
        for s in satisfied:
            for i in range(1, curr_d + 2):
                new_satisfied.append(add_digit(s, i, 3))
                new_satisfied.append(add_digit(s, i, 5))
                new_satisfied.append(add_digit(s, i, 7))
        satisfied = set(new_satisfied)

    print(ans)


if __name__ == "__main__":
    submit()


Measured memory_bytes: 19012
#pragma GCC optimize("O3")

# include <ext/pb_ds/assoc_container.hpp>
# include <ext/pb_ds/tree_policy.hpp>

# include <stdio.h>
# include <bits/stdc++.h>


#define _USE_MATH_DEFINES_
#define ll long long
#define ld long double
#define Accepted 0
#define pb push_back
#define mp make_pair
#define sz(x) (int)(x.size())
#define every(x) x.begin(),x.end()
#define F first
#define S second
#define For(i,x,y)  for (ll i = x; i <= y; i ++) 
#define FOr(i,x,y)  for (ll i = x; i >= y; i --)
#define SpeedForce ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
// ROAD to...                                                                                                                                                                                                                Red

using namespace __gnu_pbds;
using namespace std;
 
typedef
tree<pair<int,int>,null_type,less<pair<int,int>>,rb_tree_tag, tree_order_statistics_node_update> ordered_set;

inline bool isvowel (char c) {
	c = tolower(c);
    if (c == 'a' || c == 'e' || c == 'i' || c == 'y' || c == 'o' || c == 'u') return 1;
    return 0;
}

const double eps = 0.000001;
const ld pi = acos(-1);
const int maxn = 1e7 + 9;
const int mod = 1e9 + 7;
const ll MOD = 1e18 + 9;
const ll INF = 1e18 + 123;
const int inf = 2e9 + 11;
const int mxn = 1e6 + 9;
const int N = 6e5 + 123;                                          
const int M = 22;
const int pri = 997;
const int Magic = 2101;

const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, -1, 0, 1};
 
int n, m, k;
int cnt[N];
string s;
int a[N];
vector < int > g[N];
int u[N];
int ans, res;
int cur;

int main () {
	SpeedForce;
	cin >> n;
	ld r = 0.0;
	int gg = 0;
	For(i, 1, n) {
		cin >> a[i];
		gg = __gcd(gg, a[i]);
	}
	ld lcm = 1;

	For (i, 1, n) {
		lcm *= a[i];
		lcm /= gg;
	}

	For (i, 1, n) {
		r += lcm / a[i];
	}
	
	cout<< lcm / r;

	return Accepted;
}

// B...a

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

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  vl a(n + 1);
  vl b(n);
  for (int i = 0; i < n + 1; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < n; i++) {
    cin >> b[i];
  }

  ll ans = 0;
  for (int i = 0; i < n; i++) {
    int m = min(a[i], b[i]);
    ans += m;
    a[i] -= m;
    b[i] -= m;

    m = min(a[i + 1], b[i]);
    ans += m;
    a[i + 1] -= m;
    b[i] -= m;
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define SORT(x) sort((x).begin(), (x).end())
#define ALL(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < n; i++)
#define reps(i, m, n) for (ll i = m; i < n; i++)
#define repr(i, m, n) for (ll i = m; i >= n; i--)
#define de(x) cout << #x << "=" << x << endl;
template <class T> bool maxi(T &a, const T &b) {
    if (a < b) { a = b; return 1;} return 0;}
template <class T> bool mini(T &a, const T &b) {
    if (b < a) { a = b; return 1;} return 0;}
#define dame {cout<< "-1" <<"\n"; return;}
#define INF2 1000000000000000037
#define INF  1000000007
#define MOD  1000000007
using namespace std;
using ll = long long;
using ld = long double;
using P  = pair<ll,ll>;
//--GLOBAL---------------------------------
ll tugi[20][101010];
//--MAIN-----------------------------------
void Main(){
    ll N; cin>>N;
    vector<ll> x(N);
    rep(i,N) cin>>x[i];
    ll L; cin>>L;
    ll Q; cin>>Q;
    rep(i,N){
        ll tu=upper_bound(ALL(x),x[i]+L)-x.begin();
        tu--;
        tugi[0][i]=tu;
    }
    rep(i,19){
        rep(j,N){
            tugi[i+1][j]=tugi[i][tugi[i][j]];
        }
    }
    while(Q--){
        ll a,b; cin>>a>>b; --a,--b;
        if(a>b) swap(a,b);
        ll ans=0;
        repr(i,19,0){
            if(tugi[i][a]<b) {ans+=(1LL<<i); a=tugi[i][a];}
        }
        ++ans;
        cout<< ans <<"\n";
    }
}
//--START----------------------------------
int main() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
}
//-----------------------------------------


Measured memory_bytes: 17408
#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
#include <queue>
#include <functional>
#include <climits>
#include <string>

using namespace std;

int main()
{
	int N; cin >> N;
	vector<int>a(N+1);
	for( int n = 1; n <= N; n++ )
	{
		cin >> a[n];
	}
	sort(a.begin(), a.end());

	int k = 0, ans = 0;
	for( int i = 1; i <= N; i++ )
	{
		if( a[i] == a[i - 1] )
		{
			k++;
			if( k > a[i] )ans++;
		}
		else
		{
			if( k < a[i - 1] )
				ans += k;
			k = 1;
		}
	}
	if( k < a[N] )
		ans += k;

	cout << ans << endl;
}

Measured memory_bytes: 640
import java.util.*;
import java.io.*;

class Mod{
    static final int MOD = 1000_000_007;
    static final long[] fact = makeFactorialArray(1000000);
    static final long[] factInv = makeInversedArray(fact);

    public static long add(long a, long b){
        long tmp = (a+b)%MOD;
        return tmp>=0 ? tmp : tmp+MOD;
    }
    public static long sub(long a, long b){
        return add(a,-b);
    }
    public static long mult(long a, long b){
        long tmp = (a*b)%MOD;
        return tmp>=0 ? tmp : tmp+MOD;
    }
    public static long power(long a, long x){ //calculate a^x
        if(x<0)return 0;
        if(x==0)return 1;
        if(x%2==0) {
            long half = power(a,x/2);
            return mult(half,half);
        }
        return (a*power(a,x-1)) % MOD;
    }
    public static long inverse(long a){
        return power(a,MOD-2);
    }
    public static long div(long a, long b){
        return mult(a, inverse(b));
    }
    public static long[] makeFactorialArray(int size){
        long[] array = new long[size];
        array[0]=1;
        for(int i=1;i<size;i++){
            array[i]=mult(array[i-1],i);
        }
        return array;
    }
    public static long[] makeInversedArray(long[] original){
        long[] array = new long[original.length];
        for(int i=0;i<original.length;i++){
            array[i] = inverse(original[i]);
        }
        return array;
    }
    public static long combination(int n, int r){
        if(n<0 || r<0 || n<r) return 0;
        return mult(fact[n], mult(factInv[r],factInv[n-r]));
    }
    public static long gcd(long a, long b){
        if(a<b) return gcd(b,a);
        if(b==0) return a;
        if(a%b==0) return b;
        return gcd(b,a%b);
    }
    public static long lcm(long a, long b){
        return (a/gcd(a,b))*b;
    }

}

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

        int[] charCount = new int[26];
        for(int n=0; n<N; n++) charCount[S.charAt(n)-'a']++;

        long ans = 1;
        for(int i=0; i<26; i++) ans = Mod.mult(ans, 1+charCount[i]);
        System.out.println(Mod.sub(ans, 1));
    }
}

Measured memory_bytes: 42300
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#include <math.h>
#include <string.h>
#include <map>
#include <numeric>

using namespace std;

int main()
{
  int A,B,C;
  cin>>A>>B>>C;
  int ans;
  if (A+B>=C) {
    ans=B+C;
  }else{
    ans=2*B+A+1;
  }
  cout<< ans <<endl;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef long double ld;
#define MOD 1000000007
#define INF (1<<30)

int main(void){
	int n,c[550],s[550],f[550],a[550],dep,i,j;
	cin >> n;
	for(i=1; i<n; i++){
		cin >> c[i] >> s[i] >> f[i];
	}
	for(i=1; i<n; i++){
		a[i] = 0;
		for(j=i; j<n; j++){
			if(a[j]<=s[j]){
				dep = s[j];
			}else{
				dep = s[j] + ((a[j]-s[j]+f[j]-1)/f[j])*f[j];
			}
			a[j+1] = dep + c[j];
		}
		cout << a[n] << endl;
	}
	cout << 0 << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
#define MAX 101
 
int H, W, sx, sy, gx, gy;
int color, dir, field[MAX][MAX];
 
struct P {
    int x, y;
    P(int x, int y) : x(x), y(y) {}
};
 
const int dx[] = {-1, 0, 0, 1};
const int dy[] = {0, -1, 1, 0};
 
bool check(int y, int x)
{
    if (0 <= y && y < H && 0 <= x && x < W) {
	return true;
    }
    return false;
}
 
void paint(int y, int x)
{
    if (!dir) {
	for (int i = 0; i < 2; i++) {
	    for (int j = 0; j < 4; j++) {
		field[y+i][x+j] = color;
	    }
	}
    } else {
	for (int i = 0; i < 4; i++) {
	    for (int j = 0; j < 2; j++) {
		field[y+i][x+j] = color;
	    }
	}
    }
}
 
bool bfs()
{
    bool used[MAX][MAX];
    memset(used, false, sizeof(used));
    used[sy][sx] = true;
 
    queue<P> Q;
    Q.push(P(sx, sy));
 
    while (!Q.empty()) {
	P p = Q.front(); Q.pop();
 
	if (field[p.y][p.x] == -1) continue;
 
	for (int i = 0; i < 4; i++) {
	    int nx = p.x + dx[i];
	    int ny = p.y + dy[i];
 
	    if (!check(ny, nx) || used[ny][nx] || 
	       field[p.y][p.x] != field[ny][nx]) continue;
 
	    used[ny][nx] = true;
	    Q.push(P(nx, ny));     
	}
    }
    return used[gy][gx];
}
 
int main()
{
    int n, x, y;
    while (cin >> W >> H, (W | H)) {
	memset(field, -1, sizeof(field));
 
	cin >> sx >> sy >> gx >> gy >> n;
	sy--, sx--, gy--, gx--;
 
	for (int i = 0; i < n; i++) {
	    cin >> color >> dir >> x >> y;
	    y--, x--;
	    paint(y, x);
	}
	cout << (bfs() ? "OK" : "NG") << endl;
    }
    return 0;
}

Measured memory_bytes: 3044
#include <bits/stdc++.h>
using namespace std;
int main() {
	int n; cin >> n;
	int m[101][101];
	for(int i=0;i<n;i++){
		for(int j=0;j<n;j++){
			m[i][j] = 0;
		}
	}
	for(int i=0;i<n;i++){
		int u, k; cin >> u >> k;
		for(int j=0;j<k;j++){
			int v; cin >> v;
			m[u-1][v-1] = 1;
		}
	}
	for(int i=0;i<n;i++){
		for(int j=0;j<n-1;j++){
			cout  << m[i][j] << ' ';
		}
		cout << m[i][n-1] << endl;
	}
	return 0;
}


Measured memory_bytes: 3128
package main

import (
	"fmt"
	"strings"
)

func input() string {
	var s string
	fmt.Scan(&s)
	return s
}

func isUpperCase(alphabet string) string {
	var upAlphabet string = strings.ToUpper(alphabet)
	if alphabet == upAlphabet {
		return "A"
	} else {
		return "a"
	}
}

func main() {
	alphabet := input()
	isUpperStr := isUpperCase(alphabet)
	fmt.Println(isUpperStr)
}


Measured memory_bytes: 1844
#include<bits/stdc++.h>
using namespace std;
int n,ans;
set<int> a;
void dfs(string s){
	int x=0;
	stringstream ss;
	ss<<s;
	ss>>x;
	if(x>n) return ;
	set<int> b;
	while(x>0){
		b.insert(x%10);
		x/=10;
	}
	if(b==a) ans++;
	dfs(s+"3");
	dfs(s+"5");
	dfs(s+"7");
}
int main(){
	a.insert(3);
	a.insert(5);
	a.insert(7);
	cin>>n;
	dfs("");
	cout<<ans;
	return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.UncheckedIOException;
import java.util.StringTokenizer;

class Main{
	public static void main(String[] args) {
		SC sc=new SC(System.in);
		int N=sc.nextInt();
		int[] mizu=new int[N];
		int min=888;
		for(int i=0; i<N; i++) {
			mizu[i]=sc.nextInt();
			min=Math.min(mizu[i], min);
		}
		int ans=min;
		for(int i=0; i<N; i++) {
			mizu[i]-=min;
		}

		while(ok(mizu)) {
			int kaisi=0;
			int owari=0;
			boolean mi=false;
			for(int i=0; i<N; i++) {
				if(!mi) {		//まだ水やりの場所を確定させていない
					if(mizu[i]>0) {
						kaisi=i;
						owari=i;
						mi=true;
					}
				}
				else {
					if(mizu[i]>0) {
						owari=i;
					}
					else if(mizu[i]==0) {
						break;
					}
				}
			}
			min=888;
			for(int unko=kaisi; unko<=owari; unko++) {
				min=Math.min(min, mizu[unko]);
			}
			for(int unko=kaisi; unko<=owari; unko++) {
				mizu[unko]-=min;
			}
			ans+=min;
		}
		pl(ans);
	}

 	public static boolean ok(int[] a) {
 		for(int i=0; i<a.length; i++) {
 			if(a[i]!=0) {
 				return true;
 			}
 		}
 		return false;
 	}
	public static void pl(Object o) {
		System.out.println(o);
	}
	public static void pl() {
		System.out.println();
	}
	public static void p(Object o) {
		System.out.print(o);
	}
	static class SC {
		private BufferedReader reader = null;
		private StringTokenizer tokenizer = null;
		public SC(InputStream in) {
			reader = new BufferedReader(new InputStreamReader(in));
		}
		public String next() {
			if (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new UncheckedIOException(e);
				}
			}
			return tokenizer.nextToken();
		}
		public int nextInt() {
			return Integer.parseInt(next());
		}
		public long nextLong() {
			return Long.parseLong(next());
		}
		public double nextDouble() {
			return Double.parseDouble(next());
		}
		public String nextLine() {
			try {
				return reader.readLine();
			} catch (IOException e) {
				throw new UncheckedIOException(e);
			}
		}
	}
}

Measured memory_bytes: 22228
#include<iostream>
using namespace std;
int main(){
  cin.tie(NULL);
  cout.tie(NULL);
  string a,b;
  cin>>a;
  cin>>b;
  int i=0;
  bool flag=false;
  while(a[i]!='\0')
  {
    if(a[i]!=b[i])
    {flag=true;
    break;}
    i++;
  }
  if(flag)
    cout<<"No"<<"\n";
  else
      cout<<"Yes"<<"\n";}



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

int main(){
  int a,b;
  cin >> a >> b;
  bool flg=false;
  if(a<=8 && b<=8){
    flg=true;
  }
  if(flg){
    cout << "Yay!" << endl;
  }else{
    cout << ":(" << endl;
  }
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#include <iostream>
#include <string.h>
#include <stdio.h>
#include <map>
#include <vector>
#include <math.h>
#include <algorithm>
#include <queue>
#include <set>
#include <tuple>
using namespace std;

#define FOR(i,init,a) for(int i=init; i<a; i++)
#define rep(i,a) FOR(i,0,a)
#define rrep(i,a) for(int i=a; i>=0; i--)
#define rep1(i,a) for(int i=1; i<=a; i++)
#define cout1(a) cout << a << endl;
#define cout2(a,b) cout << a << " " << b << endl;
#define cout3(a,b,c) cout << a << " " << b << " " << c << endl;
#define cout4(a,b,c,d) cout << a << " " << b << " " << c << " " << d << endl;
#define mem(a,n) memset( a, n, sizeof(a))
#define all(a) a.begin(),a.end()
#define chmin(a,b) a=min(a,b);
#define chmax(a,b) a=max(a,b);

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> V;
typedef vector<V> VV;
typedef vector<VV> VVV;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LLINF = 1e18;
static const double pi = 3.141592653589793;

int N;
int A[10009],B[10009];

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    cin>>N;
    rep(i,N) cin>>A[i];
    rep(i,N) cin>>B[i];
    
    ll a=0,b=0;
    rep(i,N){
        if(A[i]==B[i]) continue;
        if(A[i]<B[i]){
            ll d=B[i]-A[i];
            a+=d/2;
            if(d%2)a++,b++;
        }else{
            b+=A[i]-B[i];
        }
    }
    if(a>=b){
        cout1("Yes")
    }else{
        cout1("No")
    }
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using PII = pair<ll, ll>;
#define FOR(i, a, n) for(ll i=(ll)a; i<(ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
template<typename T> void chmin(T &a, const T &b) { a = min(a, b); }
template<typename T> void chmax(T &a, const T &b) { a = max(a, b); }
struct FastIO {FastIO() { cin.tie(0); ios::sync_with_stdio(0); }}fastiofastio;
#ifdef DEBUG
#include "../program_contest_library/memo/dump.hpp"
#else
#define dump(...)
#endif
constexpr ll INF = 1LL<<60;

int main() {
    ll n;
    cin >> n;
    vector<ll> cnt(n);
    REP(i, n-1) {
        ll a;
        cin >> a;
        a--;
        cnt[a]++;
    }

    REP(i, n) cout << cnt[i] << "\n";

    return 0;
}


Measured memory_bytes: 4784
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
using lint=boost::multiprecision::cpp_int;
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    string s;
    cin>>s;
    lint n(s);
    if(n%9==0)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

Measured memory_bytes: 3760
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
typedef long long ll;
#define debug(x) cout << #x << " = " << x << '\n'
#define debug_arr(a , n) for(int i = 0 ; i < n ; i++)cout << a[i] << " "
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define vi vector<int>
#define vll vector<ll> 
#define inf 1000000000
#define mod 1000000007

const int max_n = 1e5 + 9;

typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
ll power(ll a , ll b)
{
    ll prod = 1;
    while(b)
    {
        if(b&1)
        prod = (prod*a)%mod;
        a = (a*a)%mod;
        b >>= 1;
    }
    return prod;
}
int main()
{
    int s,  w;
    cin >> s>> w;
    if(w >= s){
        cout << "unsafe\n";
    }
    else cout << "safe\n";
    return 0;
}

Measured memory_bytes: 3628
/**
 ____ ____ ____ ____ ____
||a |||t |||o |||d |||o ||
||__|||__|||__|||__|||__||
|/__\|/__\|/__\|/__\|/__\|

**/

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

const int N_MAX = 100002;

int n;

int v[N_MAX * 3];

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin >> n;
    for(int i = 1; i <= n * 3; i++)
        cin >> v[i];
    sort(v + 1, v + n * 3 + 1);
    ll ans = 0;
    for(int i = n + 1; i <= n * 3; i += 2)
        ans += v[i];
    cout << ans << "\n";
    return 0;
}


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

int main() {
  while (1) {
    int n,x; cin>>n>>x;
    if (n==0&&x==0) break;
    int res=0;
    for (int i=1; i<=n; i++) {
      for (int j=i+1; j<=n; j++) {
        for (int k=j+1; k<=n; k++) {
          if (i+j+k==x) res++;
        }
      }
    }
    cout<<res<<endl;
  }
}



Measured memory_bytes: 3084
sx, sy, tx, ty = map(int, input().split())

w = tx - sx
h = ty - sy

s = ''
s += 'U'
s += 'U' * (h - 1)
s += 'R' * w
s += 'D'
s += 'D' * (h - 1)
s += 'L' * w
s += 'L'
s += 'U' * (h + 1)
s += 'R' * (w + 1)
s += 'D'
s += 'R'
s += 'D' * (h + 1)
s += 'L' * (w + 1)
s += 'U'

print(s)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n) for (int i = n - 1; i >= 0; i--)
using namespace std;
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
#define EPS (1e-10)
typedef long long ll;
typedef pair<ll, ll> P;
const int MOD = 1000000007;
const int MOD2 = 998244353;

int l[11], r[11];
ll dp[200010];

int main(){
    int n, k;
    cin >> n >> k;
    rep(i, k){
        cin >> l[i] >> r[i];
        r[i]++;
    }
    dp[0] = 1;
    dp[1] = -1;

    rep(i, n){ // i : 今いる座標
        if (i > 0) dp[i] += dp[i - 1];
        rep(j, k){
            if (i + l[j] < n) {
                dp[i+l[j]] += dp[i];
                dp[i+l[j]] %= MOD2;
            }
            if (i + r[j] < n) {
                dp[i+r[j]] += MOD2 - dp[i];
                dp[i+r[j]] %= MOD2;
            }
            dp[i] %= MOD2;
        }
    }

    cout << dp[n - 1] % MOD2 << endl;

    return 0;
}


Measured memory_bytes: 5148
sub f{my($x,$b,$w)=($_,1,1);$_-"@_"and($w*=f($x))%=$==1e9+7,$b=$b*$c%$=for@$x;($b+=$c=$w)%$=}$_+=<>;map{push@$_,$_[--$|]for@_=glob}<>;print f

Measured memory_bytes: 152064
import sys
sys.setrecursionlimit(2000000)
N,K = map(int,input().split())
A = list(map(int,input().split()))
def gcd(a,b):
    return a if b==0 else gcd(b,a%b)
if N ==1:
    g = A[0]
else:
    g = gcd(A[0],A[1])
    if N > 2:
        for i in range(2,N):
            g = gcd(g,A[i])
if K <= max(A) and K%g==0:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")

Measured memory_bytes: 62576
#include<bits/stdc++.h>
 
#define rep(i,n) for(ll i = 0;i < n;++i)
#define all(v) v.begin(),v.end()
using namespace std;
using ll = long long;
typedef pair<int,int> P;
 
const int INF = 1001001001;
const long double PI = (acos(-1));
const int mod = 1e9+7;
const int vx[4] = {0,1,0,-1};
const int vy[4] = {1,0,-1,0};

vector<vector<ll>> dp(3500,vector<ll> (3500,0));
bool flag[3500][3500];
ll n;
vector<ll> a(3300);
ll dfs(ll l,ll r){
    if(l==r) {
        flag[l][r] = 1;
        return dp[l][r] = 0;
    }
    if(flag[l][r] == 1) return dp[l][r];
    flag[l][r] = 1;
    if((n-r+l)%2==0) dp[l][r] = max(dfs(l+1,r) + a[l],dfs(l,r-1) + a[r-1]);
    else dp[l][r] = min(dfs(l+1,r) - a[l],dfs(l,r-1) - a[r-1]);
    return dp[l][r];
    
}


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

    cin >> n;
    rep(i,n){
        cin >> a[i];
    }
    ll ans = dfs(0,n);
    cout << ans << endl;
    
    cout << endl;
    return 0;
}


Measured memory_bytes: 106624
#include<iostream>
#include<string>

bool check_upper(char c);

int main()
{
    char c;
    std::cin >> c;

    if( check_upper(c) )
    {
        std::cout << "A";
        return 0;
    }
    std::cout << "a";
    return 0;
}

bool check_upper(char c)
{
    if( 65 <= (int)c && (int)c <=90 )
    {
        return true;
    }
    return false;
}

Measured memory_bytes: 3632
#include<stdio.h>
int main(void)
{
	char str[256] = {"abcdefghijklmnopqrstuvwxyz"};
	char *p1;
	p1 = str;
	char q;

	scanf("%c", &q);
	
	while (*p1 != '\0') {
		if (*p1 == q) {
			break;
		}
		p1++;
	}
	p1++;

	printf("%c\n", *p1);
	return 0;
}

Measured memory_bytes: 128
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

using namespace std;

int n, k;
vector<int> a;
vector<vector<int>> edges;

int ans;

int dfs(int x) {
    // cout << x << ' ' << cnt << endl;

    int h = 0;

    for (int to : edges[x]) {
        if (to == 0) continue;
        h = max(h, dfs(to));
    }

    if (a[x] == 0) return 0;
    if (h == k - 1 && a[x] != 0) {
        ans++;
        return 0;
    } else {
        return h + 1;
    }
}
int main() {
    cin >> n >> k;
    a.resize(n);
    edges.resize(n);
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
        a[i]--;
        edges[a[i]].push_back(i);
    }

    if (a[0] != 0) {
        ans++;
        a[0] = 0;
    }

    dfs(0);
    cout << ans << endl;
}

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

//#define int long long
#define X first
#define Y second
#define pb push_back
#define sz(v) (int) v.size()

using namespace std;

typedef long long ll;
typedef long double ld;

main() {
#ifdef LOCAL
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
#endif // LOCAL
    ios_base::sync_with_stdio(0);
    cin.tie(0);

    int n;
    cin >> n;
    cout << (n - 1) / 2 << "\n";

    return 0;
}


Measured memory_bytes: 256
from itertools import permutations
def test():
    a,b,c,d=map(int,input().split())
    if (a,b,c,d)==(0,0,0,0):
        return True
    operators="+-*"
    expressions=[
        '((({0} {1} {2}) {3} {4}) {5} {6})',
        '(({0} {1} ({2} {3} {4})) {5} {6})',
        '(({0} {1} {2}) {3} ({4} {5} {6}))',
        '({0} {1} ({2} {3} ({4} {5} {6})))',
        '({0} {1} (({2} {3} {4}) {5} {6}))',
    ]
    for s in operators:
        for t in operators:
            for u in operators:
                for x in expressions:
                    for p in permutations([a,b,c,d]):
                        a,b,c,d=p
                        f=x.format(a,s,b,t,c,u,d)
                        if eval(f)==10:
                            print(f)
                            return False
    print(0)
    return False
while not test():
    pass



Measured memory_bytes: 5640
#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
  int n,a[10000000],sum=0;
  map<int,int> date;
  vector<int> b;
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>a[i];
    date[a[i]]++;
    if(date[a[i]]==1) b.push_back(a[i]);
  }
  for(int i=0;i<b.size();i++){
    sum+=(((date[b[i]]-1)*(date[b[i]])/2));
  }
  int save;
  for(int i=0;i<n;i++){
    save=sum;
    save-=(((date[a[i]]-1)*(date[a[i]])/2));
    save+=(((date[a[i]]-2)*(date[a[i]]-1)/2));
    cout<<save<<"\n";
  }
}
          
    


Measured memory_bytes: 13684
#include <iostream>
#include <vector>

using namespace std;

int main()
{
	int n, m, c;
	cin >> n >> m >> c;

	int ans = 0;

	vector<int> b(m);
	for (int i = 0; i < m; i++)
	{
		cin >> b[i];
	}

	for (int i = 0; i < n; i++)
	{
	 	int sum =  0;
		for (int j = 0; j < m; j++)
		{
			int a;
			cin >> a;

			sum += (b[j] * a);
		}

		if (sum + c > 0)
		{
			ans++;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
# coding: utf-8


def solve(*args: str) -> str:
    n, k, q = map(int, args[0].split())
    A = sorted(map(int, args[1:]))
    S = [k-q for _ in range(n)]
    ret = ''

    for a in A:
        S[a-1] += 1

    for s in S:
        ret += ('Yes' if 0 < s else 'No') + '\n'

    return ret.rstrip('\n')


if __name__ == "__main__":
    nkq = input()
    _, _, q = map(int, nkq.split())
    print(solve(*([nkq]+[input() for _ in range(q)])))


Measured memory_bytes: 19596
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>//sort,reverse
#include<utility>//pair
#include<queue>//queue,priority_queue
#include<deque>//double_ended queue
using namespace std;
typedef pair<int,int> P;//Pでpair<-,->を表す。
typedef long long LL; 

int main()
{ 
    int n;
    cin>>n;
    string s,t;
    cin>>s>>t;
    string ans;
    for(int i=0;i<n;i++){
        ans=ans+s.substr(i,1);
        ans=ans+t.substr(i,1);
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <fstream>
#include <algorithm>
#include <map>
#include <set>
#include <unordered_map>
#include <iomanip>
#include <math.h>
#include <queue>
#include <stack>
using namespace std;
 
#define pb push_back
#define f first
#define s second
#define endl '\n'
#define EPS 1e-9
#define PI acos(-1)
 
using ll = unsigned long long;
using pll = pair<ll,ll>;
using ii = pair<int,int>;
using iii = pair<pair<int,int>,int>;
using viii = vector<iii>;
using vi = vector<int>;
using vii = vector<ii>;
using vll = vector<ll>;
using ui = unsigned int;
 
 
 
 
int main() {
    ofstream out("output.txt");
    ios_base::sync_with_stdio(false);
    
	string s,t;
	cin>>s>>t;
	cout<<t<<s<<endl;
 
    return 0;
}   


Measured memory_bytes: 256
using System;

namespace ABC147A
{
    class Program
    {
        static void Main(string[] args)
        {
            // スペース区切りの整数の入力
            string[] input = Console.ReadLine().Split(' ');
            int a = int.Parse(input[0]);
            int b = int.Parse(input[1]);
            int c = int.Parse(input[2]);

            var sum = a + b + c;

            if (sum >= 22)
            {
                //出力
                Console.WriteLine("bust");
            }
            else
            {
                Console.WriteLine("win");
            }
        }
    }
}

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

int main(){
  //a animals
  int a,b,d=0;
  cin >> a >> b;
  rep(i,a+1){
    if ((2*i+4*(a-i))==b){
      cout << "Yes" << endl;
      d=1;
      break;
    }
  }
  if (d==0){
      cout << "No" << endl;

  }
  

}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, K;
  cin >> N >> K;
  vector<int> length(N);
  for(int i = 0; i < N; i++) cin >> length.at(i);
  
  sort(length.begin(), length.end(), greater<int>());
  int sum = 0;
  for(int i = 0; i < K; i++){
    sum += length.at(i);
  }
  
  cout << sum << endl;

  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<cctype>
#include<utility>
#include<string>

#define REP(n) for(int i = 0;i < n;i++)
#define LLREP(n) for(long long int  i = 0;i < n;i++)
typedef long long int ll;
using namespace std;
#define MAX_A 1000000007

int main(){

    int n,m;
    cin >> n >> m;

    char a[50][50];
    char b[50][50];
    bool exist = false;

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

    for(int i = 0;i < m;i++){
        for(int j = 0;j < m;j++){
            cin >> b[i][j];
        }
    }

    for(int i = 0;i < n-m+1;i++){
        for(int j = 0;j < n-m+1;j++){

            if(a[i][j] == b[0][0]){
                bool match = true;            
                for(int l = 0;l < m;l++){
                    for(int k = 0;k < m;k++){
                        if(a[i+l][j+k] != b[0+l][0+k]){
                            //cout << "b" << endl;
                            match = false;
                        }
                    }
                }
                if(match){
                    //cout << "a" << endl;
                    exist = true;
                }
            }
        }
    }

    if(exist){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }



    

    


    return 0;
}

Measured memory_bytes: 256
dance = input()
judge = True

for i in range(len(dance)):
    if i % 2 == 1 and dance[i] == "R":
        judge = False
        break
    if i % 2 == 0 and dance[i] == "L":
        judge = False
        break

if judge:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 2940
#include <stdio.h>

int main(void){

  int a, b, c;
  int i;
  int count = 0;

  scanf("%d %d %d", &a, &b, &c);

  for(i = a; i < b + 1; i++){

    if(c % i == 0){count = count + 1;}

    }

  printf("%d\n", count);

  return 0;
}

Measured memory_bytes: 596
#include<iostream>
#include<cmath>
#include<algorithm>
#include<vector>
#include<functional>
#include<string>
#include<iomanip>
#include<map>
#include<utility>
#include<string>
#include<unordered_map>
#include <queue>

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; }

using namespace std;

#define min_3(a, b, c) min(a, min(b, c))
#define max_3(a, b, c) max(a, max(b, c))
typedef long long ll;

int main(){
    int n, m, ans;
    cin >> n >> m;
    ans = pow(2,m) * (1900*m + 100*(n-m));
    cout << ans << endl;
    return 0;
}


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

using namespace std;

int mod = 1e9 + 7;

int f2(int x, int y)
{
    if (y == 0)
    {
        return 1;
    }
    if (y % 2 == 0)
    {
        return f2(x * x % mod, y / 2) % mod;
    }
    return (x * f2(x, y - 1)) % mod;
}

signed main()
{
    int x, y;
    cin >> x >> y;
    if (2 * x - y < 0 || (2 * x - y) % 3 != 0)
    {
        cout << 0 << '\n';
        exit(0);
    }
    if (2 * y - x < 0 || (2 * y - x) % 3 != 0)
    {
        cout << 0 << '\n';
        exit(0);
    }
    int a = (2 * x - y) / 3, b = (2 * y - x) / 3;
    vector<int> f(1, 1);
    for (int i = 1; i < 1e6; i++)
    {
        f.push_back(f[i - 1] * i % mod);
    }
    cout << f[a + b] * (f2(f[a], mod - 2) % mod) % mod * (f2(f[b], mod - 2) % mod) % mod;
}


Measured memory_bytes: 10476
#include <iostream>

using namespace std;

int main() {
    int seq = 0, maior = 0;
    char dia;
    for(int i=0;i<3;i++){
        cin >> dia;
        if(dia=='R') seq++;
        else seq=0;
        
        if(seq>maior) maior=seq;
    }
    cout << maior << endl;
    
    return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int max_n = 1e5;

vector<vector<ll> > G;
vector<ll> cnt;
const int INF = 1e9;
ll dist[max_n];
ll mod = 1e9 + 7;
int unip[max_n], unir[max_n];
int main(){
  int n;
  cin >> n;
  int a[n][3];
  for(int i=0 ; i<n ; i++){
    cin >> a[i][0] >> a[i][1] >> a[i][2];
  }
  int dp[n][3];
  for(int i=0 ; i<n ; i++){
    for(int j=0 ; j<3 ; j++){
      dp[i][j] = 0;
    }
  }
  for(int i=0 ; i<3 ; i++){
    dp[0][i] = a[0][i];
  }
  for(int i=1 ; i<n ; i++){
    for(int k=0 ; k<3 ; k++){
      for(int j=0 ; j<3 ; j++){
        if(j!=k){
          dp[i][k] = max(dp[i-1][j]+a[i][k], dp[i][k]);
        }
      }
    }
  }
  cout << max(dp[n-1][0], max(dp[n-1][1], dp[n-1][2])) << endl;
  return 0;
}


Measured memory_bytes: 2560
n,m=gets.split.map(&:to_i)
d=n.times.map{[100000]*n}
n.times{|i|d[i][i]=0}
path=$<.map{|s|
  a,b,c=s.split.map(&:to_i)
  a-=1
  b-=1
  d[a][b]=c
  d[b][a]=c
  [a,b,c]
}
n.times{|i|
  n.times{|j|
    n.times{|k|
      d[j][k]=[d[j][k],d[j][i]+d[i][k]].min
    }
  }
}
p path.count{|(a,b,c)|c>d[a][b]}

Measured memory_bytes: 2172
s = input()

gu = ""
ki = ""
for n, i in enumerate(s):
    if n % 2 == 0:
        gu = gu + i
    else:
        ki = ki + i

#gu
for i in gu:
    if i not in ["R", "U", "D"]:
        print("No")
        exit()
#ki
for i in ki:
    if i not in ["L", "U", "D"]:
        print("No")
        exit()

print("Yes")

Measured memory_bytes: 3064
#include<cstdio>
#include<bitset>
using namespace std;

bitset<50001> pt;

void MakeTable(int n){
  pt.reset();
  pt.set(2);
  
  int i;
  for(i=3;i<=n;i+=2)pt.set(i);
  
  i = 3;
  while(i*i<=n){
    for(int j=3*i;j<=n;j+=i)pt.reset(j);
    while(!pt[++i]);
  }
}

int main(){
  int n,ans;
  MakeTable(50000);

  while(scanf("%d",&n) && n){
    if(n&1)pt[n-2]?printf("1\n"):printf("0\n");
    else{
      ans = 0;
      for(int i=0;i<=n/2;i++)
	if(pt[i] && pt[n-i])ans++;
      printf("%d\n",ans);
    }
  }
}
	

Measured memory_bytes: 764