akhauriyash/Code-Regression huggingface dataset:
// I'm a f*cking looser
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define fasino ios_base::sync_with_stdio(false); cin.tie(0);
#define asc(A) sort(A.begin(),A.end())
#define dsc(A) sort(A.begin(),A.end(),greater<ll>())
#define input(A,N) for(ll i=0;i<N;i++) cin>>A[i];
int main()
{
    fasino
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin); 
    #endif
    ll n;
    cin>>n;
    set<string> A;
    for(int i=0;i<n;i++)
    {
        string a;
        cin>>a;
        A.insert(a);
    }
    cout<<A.size();
    return 0;
}

Measured memory_bytes: 19248
#include <cctype>
#include <cstdio>
#include <cstring>
#include <algorithm>
#define rep(i,x,y) for (int i=x; i<=y; ++i)
#define repd(i,x,y) for (int i=x; i>=y; --i)
 
int get()
{
    char c;
    while (!isdigit(c=getchar()));
    int k=c-'0';
    for (; isdigit(c=getchar()); k=k*10+c-'0');
    return k;
}
 
using namespace std;
const int N=1e5+10,mod=1e9+7;
char s[N];
int n,m,ans,fac[N],ifac[N],l[N],r[N],f[2][N],a[N];

int inv(int x)
{
    return x>1? 1ll*(mod-mod/x)*inv(mod%x)%mod:1;
}

int c(int n,int m)
{
    return 1ll*fac[n]*ifac[m]%mod*ifac[n-m]%mod;
}
 
int main()
{
    n=get(),m=get();
    fac[0]=1;
    rep(i,1,n)
        fac[i]=1ll*fac[i-1]*i%mod;
    ifac[n]=inv(fac[n]);
    repd(i,n,1)
        ifac[i-1]=1ll*ifac[i]*i%mod;
    scanf("%s",s+1);
    rep(i,1,n)
        a[i]=a[i-1]+s[i]-48;
    int t=0;
    rep(i,1,m)
    {
        int x=get(),y=get();
        if (x==l[t])
            r[t]=max(r[t],y);
        else if (y>r[t])
            ++t,l[t]=x,r[t]=y;
    }
    m=t,l[m+1]=n+1,f[0][0]=1;
    rep(i,1,m)
    {
        int w=a[r[i]]-a[max(l[i]-1,r[i-1])];
        int s=min(r[i],l[i+1]-1)-l[i]+1;
        int mx=r[i]-l[i]+1-s;
        memset(f[i&1],0,sizeof(f[i&1]));
        rep(j,0,s)
            rep(k,max(0,w-j),mx)
                f[i&1][k]=(f[i&1][k]+1ll*f[(i&1)^1][j+k-w]*c(s,j))%mod;
    }
    rep(i,0,n)
        ans=(ans+f[m&1][i])%mod;
    printf("%d",ans);
    return 0;
}

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

using namespace std;

int main()
{
    int n;
    scanf("%d",&n);
    int a=0;
    int now=0;
    int res=0;
    for(int i=0;i<n;i++)
    {
        int t;
        scanf("%d",&t);
        if(t>a) now=1;
        else now++;
        a=t;
        res=max(res,now);
    }
    printf("%d\n",res-1);
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <stdio.h>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <utility>
#include <tuple>
#include <math.h>
#include <set>
#include <map>
using namespace std ;
using ll = long long ;
using ld = long double ;
using vll = vector<ll> ;
using vvll = vector<vll> ;
using vc = vector<char> ;
using vvc = vector<vc> ;
using vb = vector<bool> ;
using vvb = vector<vb> ;
using pll = pair<ll,ll> ;
#define all(v) v.begin(),v.end() 
const ll INF = 1e18 ;
const ll mod = 1e9+7 ;
const double pie = acos(-1); 
vll dx4 = {-1,0,1,0} ;
vll dy4 = {0,-1,0,1} ;
vll dx8 = {-1,0,1,1,1,0,-1,-1} ;
vll dy8 = {-1,-1,-1,0,1,1,1,0} ; 

void fix_cout(){cout << fixed << setprecision(20) ; }
ll gcd(ll a,ll b){if(b==0) return a ; return gcd(b,a%b) ; }
ll lcm(ll a,ll b){return a/gcd(a,b)*b ; }
void chmax(ll &a,ll b){if(a<b) a = b ; }
void chmin(ll &a,ll b){if(a>b) a = b ; }

int main(){
	ll m ; cin >> m ;
	ll d=0,s=0 ;
	while(m--){
		ll a,b ;
		cin >> b >> a ;
		d += a ;
		s += a*b ;
	}
	cout << (d-1)+(s-1)/9 << endl ;
}

Measured memory_bytes: 256
import java.util.*;
import java.math.*;
public class Main {
	static int x;
	static int ans;
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.next());
		System.out.println(n <= 999? "ABC" : "ABD");
	}
} 

Measured memory_bytes: 23892
#include <bits/stdc++.h>
using namespace std;
#include <cmath>
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007

int main() {
	ll n,k;
	cin>>n>>k;
	vector<ll>a;
	vector<ll>f;
	for(ll i=0;i<n;i++){
		ll now;
		cin>>now;
		a.push_back(now);
	}
	for(ll j=0;j<n;j++){
		ll now;
		cin>>now;
		f.push_back(now);
	}
	sort(a.begin(),a.end());
	reverse(a.begin(),a.end());
	sort(f.begin(),f.end());
    ll left = -1; //「index = 0」が条件を満たすこともあるので、初期値は -1
    ll right =1000000000002; // 「index = a.size()-1」が条件を満たさないこともあるので、初期値は a.size()

    /* どんな二分探索でもここの書き方を変えずにできる！ */
    while (right - left > 1) {
        ll mid = left + (right - left) / 2;
        ll cnt=0;
        for(ll i=0;i<n;i++){
        	ll now=mid/f[i];
        	cnt+=max(ll(0),a[i]-now);
        }
        if (cnt<=k) right = mid;
        else left = mid;
    }

    /* left は条件を満たさない最大の値、right は条件を満たす最小の値になっている */
    cout << right;	
	// your code goes here
	return 0;
}

Measured memory_bytes: 7992
#include<iostream>
#include<fstream>
using namespace std;
#include<math.h>
#include<string.h>
#include<queue>
int main()
{
	//ifstream in("1.txt",ios::in);
	int a,b;
	cin>>a>>b;
	cout<<a*b<<endl;
	//in.close();
	return 0;
}


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

int main() {
    int sx, sy, tx, ty;
    cin >> sx >> sy >> tx >> ty;

    string output = "";

    for (int i = 0; i < ty - sy; i++) {
        output += 'U';
    }
    for (int i = 0; i < tx - sx; i++) {
        output += 'R';
    }
    for (int i = 0; i < ty - sy; i++) {
        output += 'D';
    }
    for (int i = 0; i < tx - sx; i++) {
        output += 'L';
    }

    output += 'L';
    for (int i = 0; i < ty - sy + 1; i++) {
        output += 'U';
    }
    for (int i = 0; i < tx - sx + 1; i++) {
        output += 'R';
    }
    output += 'D';
    output += 'R';
    for (int i = 0; i < ty - sy + 1; i++) {
        output += 'D';
    }
    for (int i = 0; i < tx - sx + 1; i++) {
        output += 'L';
    }
    output += 'U';

    cout << output << endl;

    return 0;
}


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

int main(){
    int room[4][3][10]={};//4(x)棟3(y)階10(z)番目にroom[x][y][z]人
    int n,bld,flr,num,psn;//building(x),floor(y),number(z),person(人)
    
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>bld>>flr>>num>>psn;
        room[bld-1][flr-1][num-1]+=psn;
    }
    
    for(int x=0;x<4;x++){
        for(int y=0;y<3;y++){
            for(int z=0;z<10;z++){
                cout<<" "<<room[x][y][z];
            }
            cout<<endl;
        }
        if(x==3)break;
        cout<<"####################\n";
    }
    
    return 0;
}



Measured memory_bytes: 3136
import java.util.Scanner;

/**
 * Created by ??\??? on 2016/12/2.
 */
public class Main {
    static int gcd(int a,int b)
    {
        while(b!=0)
        {
            int ans = a%b;
            a = b;
            if(ans!=0)
            {
                b = ans;
            }
            else
            {
                return a;
            }
        }
        return -1;
    }
    static int run(String[] args)
    {
        Scanner scan = new Scanner(System.in);
        while(scan.hasNext())
        {
            String[] lines = scan.nextLine().split(" ");
            int a = Integer.parseInt(lines[0]);
            int b = Integer.parseInt(lines[1]);
            System.out.println(gcd(a,b));
        }
        return 0;
    }
    public static void main(String[] args)
    {
        run(args);
    }
}

Measured memory_bytes: 26164
//#pragma GCC optimize ("O3")
//#pragma GCC target ("avx")
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

int N, M, Q;
int b[51], c[51], d[51];
int he[11], ne[51];
int are[11][21];
int kotae, goukei;
void keisan(int n, int mae) {
	if (n == N) {
		chmax(kotae, goukei);
		return;
	}
	for (int to = he[n]; to; to = ne[to]) {
		are[b[to]][mae + c[to]] += d[to];
	}
	goukei += are[n][mae];
	keisan(n + 1, mae);
	goukei -= are[n][mae];
	for (int to = he[n]; to; to = ne[to]) {
		are[b[to]][mae + c[to]] -= d[to];
	}

	for (int i = mae + 1; i <= M; i++) {
		if (are[n][i]) {
			for (int to = he[n]; to; to = ne[to]) {
				are[b[to]][i + c[to]] += d[to];
			}
			goukei += are[n][i];
			keisan(n + 1, i);
			goukei -= are[n][i];
			for (int to = he[n]; to; to = ne[to]) {
				are[b[to]][i + c[to]] -= d[to];
			}
		}
	}
}

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


	cin >> N >> M >> Q;
	rep1(i, Q) {
		int a;
		cin >> a >> b[i] >> c[i] >> d[i];
		a--;
		b[i]--;
		ne[i] = he[a];
		he[a] = i;
	}

	keisan(0, 1);

	co(kotae);

	Would you please return 0;
}

Measured memory_bytes: 3604
n = int(input())
a = list(map(lambda x: min(8, int(x)//400), input().split()))

cnt = 0
for i in a:
    if i >= 8:
        cnt += 1
c = len(set(a)) - (1 if cnt != 0 else 0)

print(max(1, c), c+cnt)


Measured memory_bytes: 9084
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = (n); i >= 0; i--)
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define ALL(obj) begin(obj), end(obj)
using namespace std;
using ll = long long;
using ull = unsigned long long;

const int INF = 2100100100;
const int MOD = 1e9 + 7;

// 多次元 vector 生成
template <class T> vector<T> make_vec(size_t a) { return vector<T>(a); }
template <class T, class... Ts> auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
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;
}

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

    int L;
    cin >> L;

    int N = 0;
    int pow = 1;
    while (pow <= L) {
        pow *= 2;
        N++;
    }

    vector<int> bits(N);
    int M = 0;
    FOR(i, 0, N - 1) {
        int mask = 1 << i;
        if (mask & L) {
            bits[i] = 1;
            M++;
        } else {
            bits[i] = 0;
        }
    }

    cout << N << " " << M + 2 * (N - 1) << endl;

    pow = 1;
    FOR(i, 1, N) {
        cout << i << " " << i + 1 << " " << 0 << endl;
        cout << i << " " << i + 1 << " " << pow << endl;
        pow *= 2;
    }
    int tmp = pow;
    for (int i = N - 1; i > 0; i--) {
        if (bits[i - 1]) {
            cout << i << " " << N << " " << tmp << endl;
            tmp += 1 << (i - 1);
        }
    }

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  int one = N / 1000;
  int two = N / 100 - 10 * one;
  int three = N / 10 - 100 * one -  10 * two;
  int four = N - 1000 * one - 100 * two - 10 * three;

  if (one == two && two == three){
    cout << "Yes" << endl;
  }
  else if(two == three && three == four){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define mod 1000000007
#define upperlimit 1000100
#define INF 1000000100
#define INFL 1000000000000000100
#define eps 1e-8
#define endl '\n'
#define sd(n) scanf("%d",&n)
#define slld(n) scanf("%lld",&n)
#define pd(n) printf("%d",n)
#define plld(n) printf("%lld",n)
#define pds(n) printf("%d ",n)
#define pllds(n) printf("%lld ",n)
#define pdn(n) printf("%d\n",n)
#define plldn(n) printf("%lld\n",n)
#define REP(i,a,b) for(i=a;i<=b;i++)
#define mp make_pair
#define pb push_back
#define pcc pair<char,char>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vi vector<int>
#define vl vector<ll>
#define vii vector<pii>
#define vll vector<pll>
#define tr(container,it) for(typeof(container.begin()) it=container.begin();it!=container.end();it++)
#define F first
#define S second
#define clr(a) memset(a,0,sizeof(a))
using namespace std;
 
ll gcd(ll n1,ll n2){
    if(!n1)return n2;
    if(!n2)return n1;
    if(n1%n2==0)return n2;
    return gcd(n2,n1%n2);
}
ll powmod(ll base,ll exponent){
    base%=mod;
    ll ans=1;
    while(exponent){
        if(exponent&1)ans=(ans*base)%mod;
        base=(base*base)%mod;
        exponent/=2;
    }
    ans%=mod;
    return ans;
}
int main()
{
    int n,a,b,r;
    
    cin>>n;
    a=n;
    r=0;
    for(int i=0;i<10;i++){
         b=a%10; 
          a=a/10;
          r=r+b;
          if (a==0)break;
    }
       if(n%r==0){
         cout<<"Yes"<<endl;
    }
    else{ 
         cout<<"No"<<endl;
    }
    
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<queue>
using namespace std;
typedef pair<int,int> P;
#define INF (1<<24)
#define MAX_V 100

int V,E,a,b,c,d,R;

vector< vector<P> > t;
vector< vector<P> > u;

void init();
int dijkstra(int,int,vector< vector<P> >&);

int main(){
  while(cin>>E>>V){
    if(V==0&&E==0)break;
    init();
    for(int i=0;i<E;i++){
      cin>>a>>b>>c>>d;
      b--;a--; 
      t[a].push_back(P(b,c));
      t[b].push_back(P(a,c));
      u[a].push_back(P(b,d));
      u[b].push_back(P(a,d));
    }
    cin>>R;
    for(int i=0;i<R;i++){
      cin>>a>>b>>c;
      a--;b--;
      cout<<dijkstra(a,b,(c?u:t))<<endl;
    }
  }
  return 0;
}


int dijkstra(int si,int ti,vector< vector<P> > &G){
  int d[MAX_V];
  fill(d,d+MAX_V,INF);
  d[si]=0;
  priority_queue< P , vector<P> , greater<P> > Q;
  Q.push(P(0,si));
  while(!Q.empty()){
    P p=Q.top();Q.pop();
    int pos=p.second,cost=p.first;
    if(d[pos]<cost)continue;
    for(int i=0;i<(int)G[pos].size();i++){
      int v=G[pos][i].first;
      int w=G[pos][i].second;
      if(cost+w>=d[v])continue;
      d[v]=cost+w;
      Q.push(P(d[v],v));
    }
  }
  return d[ti];
}

void init(){
  t.clear();
  u.clear();
  t.resize(V);
  u.resize(V);
}

Measured memory_bytes: 1336
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <deque>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <iomanip>
#include <bitset>
#include <set>
#include <map>
#include <stdio.h>
#include <numeric>
#include <cstring>

#define rep(i,n) for (int i = 0; i < (n); i++)
#define rep1(i,n) for (int i = 1; i < (n); i++)
#define FOR(i,a,b) for (int i=(a); i < (b); i++)
#define MOD 1000000007 //10^9+7
#define ALL(a)  (a).begin(),(a).end()
using namespace std;
using ll = long long;
using PII = pair<int, int>;
using PLL = pair<long long, long long>;
const int INF = numeric_limits<int>::max();
constexpr ll TEN(int n) { return (n==0) ? 1 : 10*TEN(n-1); }

// 負の数にも対応した % 演算
long long mod(long long val, long long m) {
    long long res = val % m;
    if (res < 0) res += m;
    return res;
}

//greatest common divisor
long long gcd(ll a, ll b) 
{
    if (a % b == 0) {
        return b;
    } else {
        return gcd(b, a % b);
    }
}

//least common multiple
long long lcm(ll a, ll b)
{
    return a / gcd(a, b) * b ;
}

bool is_prime(ll n) {
    for (ll i = 2; i * i <= n; i++) {
        if (n % i == 0) return false;
    }
    return n != 1;
}

int main()
{
    ll n, D; cin >> n >> D;
    ll ans = 0;
    rep(i,n) {
        ll x, y; cin >> x >> y;
        long double d = sqrt(x * x + y * y);
        if (d <= D)
            ans++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3676
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <random>
#include <chrono>
#include <queue>
#include <ctime>
#include <cassert>
using namespace std;
typedef long long ll;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
#define fs first
#define sc second
#define INF 1000000000
#define MOD 1000000007
#define EPS 0.00000001

int N, K;
vector<int> D;

int solve(){
    for(int i=N; i<1000000; i++){
        int c = i;
        bool f = true;
        while(c){
            for(int j=0; j<(int)D.size(); j++){
                if(c%10==D[j]) f = false;
            }
            c /= 10;
        }
        if(f) return i;
        
    }
    return 0;
}



int main() {
    cin >> N >> K;
    D.resize(K);
    for(int &d:D) cin >> d;
    
    cout << solve() << endl;
    return 0;
    
}





Measured memory_bytes: 256
n = int(input())
dict = set()
tmp = set()
for _ in range(n):
  data = list(map(str,input().split()))
  if(data[0][0] == "i"):
    dict.add(data[1])
  elif(data[0][0] == "f"):
    tmp.add(data[1])
    print("yes" if len(dict&tmp) != 0 else "no")
    tmp.clear()



Measured memory_bytes: 30992
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <memory>
#include <complex>
#include <numeric>
#include <cstdio>
#include <iomanip>

#define REP(i,m,n) for(int i=int(m);i<int(n);i++)
#define RREP(i,m,n) for(int i=int(n)-1;i>=int(m);--i)
#define EACH(i,c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())

#ifdef LOCAL
#define DEBUG(s) cout << (s) << endl
#define dump(x)  cerr << #x << " = " << (x) << endl
#define BR cout << endl;
#else
#define DEBUG(s) do{}while(0)
#define dump(x) do{}while(0)
#define BR 
#endif
using namespace std;

using UI = unsigned int;
using UL = unsigned long;
using LL = long long int;
using ULL = unsigned long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VS = vector<string>;
using PII = pair<int,int>;
using VP = vector<PII>;

//struct edge {int from, to, cost;};

constexpr double EPS = 1e-10;
//constexpr double PI  = acos(-1.0);
//constexpr int INF = INT_MAX;
constexpr int MOD = 1'000'000'007;

template<class T> inline T sqr(T x) {return x*x;}

LL len[51] = {};
vector<map<LL,LL>> memo(51);

LL calcp(int n, LL x) {
    if (memo[n].count(x) == 1) return memo[n][x];
    //dump(n);
    //dump(x);
    if (n == 1) {
        if (x == 0) return memo[n][x] = 0;
        if (x == 4) return memo[n][x] = 3;
        else return memo[n][x] = x;
    }
    if (x == 0) return 0;
    if (x == len[n] - 1) return memo[n][x] = 0LL + 1 + 2 * calcp(n-1,len[n-1]-1);
    if (x == len[n] / 2) return memo[n][x] = 0LL + 1 + calcp(n-1,len[n-1]-1);
    if (x < len[n] / 2) return memo[n][x] = 0LL + calcp(n-1,x-1);
    if (x > len[n] / 2) return memo[n][x] = 0LL + 1 + calcp(n-1,len[n-1]-1) + calcp(n-1,x - 2 - len[n-1]);
}

void solve() {
    LL n,x;
    cin >> n >> x;
    len[0] = 1;
    REP(i,1,n+1) len[i] = 3 + 2 * len[i-1];
    --x;
    cout << calcp(n,x) << endl;
}

int main() {
    solve();
    
    return 0;
}

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


int main()
{
	string s;
	cin >>s ;
	int len=s.size();
	for(int i=0;i<len;i++){
		if(i%2)	continue;
		cout<<s[i];
	}
	cout<<'\n';
	return 0;
} 

Measured memory_bytes: 512
/* -> Written by <-
   -----------
  |K_A_Z_A_M_A|
  |___________|
  |    ___    |
  |   (^_^)   |
  |  /( | )\  |
  |____|_|____|
    H O A N G
*/

#define Task ""

#include <bits/stdc++.h>

#define pb push_back
#define F first
#define S second
#define YES cout << "YES\n"
#define NO cout << "NO\n"

using namespace std;

typedef long long ll;

void Solve()
{
    int n;
    cin >> n;
    int x = n / 1000;
    if (n % 1000 != 0) x ++;
    cout << x * 1000 - n;
}

int main()
{
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
    if(fopen(Task".inp", "r"))
    {
        freopen(Task".inp","r",stdin);
        freopen(Task".out","w",stdout);
    }

    int test_case = 1;
//    cin >> test_case;
    while (test_case --)
        Solve();
    return 0;
}



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

using namespace std;

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


    int x=(B/k)*k;

    if(A<=x)
    {    //x++;
        cout<< "OK"<<endl;
    }
   else{

    cout<<"NG"<<endl;
    }

return 0;
}



Measured memory_bytes: 3584
#include<bits/stdc++.h>
using namespace std;
int n,l[111],ans;
int main()
{
	cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>l[i];
	}
	sort(l,l+n);
	for(int i=0;i<n;i++)
	{
		for(int j=i+1;j<n;j++)
		{
			for(int k=j+1;k<n;k++)
			{
				if(l[i]==l[j] || l[i]==l[k] || l[j]==l[k])
				{
					continue;
				}
				if(l[i]+l[j]>l[k])
				{
					ans++;
				}
			}
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
int h,w,cnt=0;
int main(){
	ios::sync_with_stdio(false);
    cin>>h>>w;
    for (int i=1;i<=h*w;i++){
        char data;
		cin>>data;
        if (data=='#')
                cnt++;
	}
    if (cnt==h+w-1)
        cout<<"Possible";
    else
        cout<<"Impossible";
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    int N;
    int ans[1000]={0};
    int anss;
    int A1[1000];
    int A2[1000];
    cin >> N;
    for(int i=0;i<N;i++){
        cin >> A1[i];
    }
    for(int j=0;j<N;j++){
        cin >> A2[j];
    }
    for(int k=0;k<N;k++){//sitaheikutenn
        for(int l=0;l<=k;l++){
            ans[k]+=A1[l];
        }
        for(int m=k;m<N;m++){
            ans[k]+=A2[m];
        }
    }
    anss=ans[0];
    for(int n=0;n<100;n++){
        if(anss<ans[n]){
            anss=ans[n];
        }
    }
    cout<< anss;
    return 0;
}

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

using std::cin;
using std::cout;
using std::endl;
using std::string;
using std::vector;
using std::bitset;

#define rep(i,n)    for(int i=0; i<(int)(n); i++)
#define reps(i,s,e) for(int i=s; i<(int)(e); i++)
#define coutd(i) cout << std::fixed << std::setprecision(i)
typedef long double ld;
typedef long long ll;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef std::pair<int, int> pii;
typedef std::pair<ll, ll> pll;

template<class T>
using Set = std::set<T>;
template<class T, class U>
using Map = std::map<T, U>;

template<class T>
using Graph = vector<vector<T>>;

const int INT_BIG = 1<<28;

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

    if (str.find("RRR") != string::npos) {
        cout << 3 << endl;
    } else if (str.find("RR") != string::npos) {
        cout << 2 << endl;
    } else if (str.find("R") != string::npos) {
        cout << 1 << endl;
    } else {
        cout << 0 << endl;
    }
}

Measured memory_bytes: 3620
/*
START BY THE NAME OF ALMIGHTY ALLAH
THIS WONT BE ACCEPTED
STOP_GIVING_UP

██╗███████╗████████╗██╗ █████╗ ██╗  ██╗
██║██╔════╝╚══██╔══╝██║██╔══██╗██║ ██╔╝
██║███████╗   ██║   ██║███████║█████╔╝
██║╚════██║   ██║   ██║██╔══██║██╔═██╗
██║███████║   ██║   ██║██║  ██║██║  ██╗
╚═╝╚══════╝   ╚═╝   ╚═╝╚═╝  ╚═╝╚═╝  ╚═╝




*/
#include<bits/stdc++.h>
#define l(i,a,n)for(int i=a;i<n;i++)
#define pb push_back
#define in insert
#define mp make_pair
#define lw(v) sort(v.begin(),v.end());
#define hi(v) sort(v.begin(),v.end(),greater<long long>());
#define all(v) v.begin(),v.end()
#define filein freopen ("input.txt", "r", stdin)
#define fileout freopen ("output.txt", "w", stdout)
using namespace std;
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    long long t,r=1,r1=0,r2=0,k=0,a,b,c=1,m,d=0,n,e,f,x=0,g,p=0,q=0,y=0,z=0;
    vector<long long>v;
    vector<long long>u;
    set<long long>s;
    std::vector<int>::iterator it;
    string  s1,s2,s3,s4;
    cin>>n>>m;
    if(n<=m)
    {
        cout<<1<<endl;
    }
    else{
            if(n%m==0)
            {
                cout<<n/m<<endl;
            }
            else{cout<<(n/m)+1<<endl;

            }



    }
}


Measured memory_bytes: 3632
package main

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

var sc = bufio.NewScanner(os.Stdin)

func scanInt() int {
	sc.Scan()
	iv, _ := strconv.Atoi(sc.Text())
	return iv
}

func init() {
	sc.Split(bufio.ScanWords)
}

func main() {
	_, m := scanInt(), scanInt()
	xm := make(map[int]int)
	for i := 0; i < m; i++ {
		a, b := scanInt(), scanInt()
		xm[a]++
		xm[b]++
	}

	for _, v := range xm {
		if v%2 == 1 {
			fmt.Println("NO")
			return
		}
	}
	fmt.Println("YES")
}


Measured memory_bytes: 6912
#include <bits/stdc++.h>
using namespace std;
int n,k,fa[100005],size[100005];
pair<int,int> a[100005];
int z(int x){
	if (x == fa[x]) return x;
	fa[x] = z(fa[x]);
	return fa[x];
}
void bin(int x,int y){
	x = z(x);
	y = z(y);
	fa[x] = y;
	size[y] += size[x];
}
int main(){
	scanf("%d",&n);
	scanf("%d",&k);
	for (int i = 0; i < n; i++)
		fa[i] = i;
	for (int i = 0; i < n; i++)
		size[i] = 1;
	long long ans = 0;
	for (int i = 0; i < n; i++){
		scanf("%d",&a[i].first);
		ans += a[i].first;
	}
	for (int i = 0; i < n; i++)
		a[i].second = i;
	sort(a, a + n);
	for (int i = 1; i <= k; i++){
		int x,y;
		scanf("%d%d",&x,&y);
		bin(x,y);
	}
	if (n - k == 1){
		printf("0\n");
		return 0;
	}
	int s = n - (n - k - 1) * 2;
	if (s < 0){
		printf("Impossible\n");
		return 0;
	}
	for (int i = n - 1; (i >= 0) && (s > 0); i--)
		if (size[z(a[i].second)] > 1){
			size[z(a[i].second)]--;
			s--;
			ans -= a[i].first;
		}
	printf("%lld\n",ans);
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
typedef long long int ll;
using namespace std;
int main()
{
  int n;
  cin>>n;
  map<int,int> m;
  ll sum=0;
  for(int i=0;i<n;i++)
  {
    int x;
    cin>>x;
    sum+=x;
    m[x]++;
  }
  int q;
  cin>>q;
  while(q--)
  {
    int b,c;
    cin>>b>>c;
    sum=sum-(m[b]*(b-c));
    m[c]=m[c]+m[b];
    m[b]=0;
    cout<<sum<<"\n";
  }
    
}

Measured memory_bytes: 7968
#define _LIBCPP_DEBUG 0
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll MOD = 1e9+7;

int main(void) {

    int N; cin>>N;
    ll L[86+1];
    L[0]=2,L[1]=1;
    for (int i = 2; i <= N; ++i) {
        L[i] = L[i-1]+L[i-2];
    }

    cout<<L[N]<<endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i, n) for(int i = 0; i < n; i++)
#define all(a) a.begin(), a.end()
#define P pair<int, int>
#define F first
#define S second
#define mod 1000000007
#define MOD 998244353
#define INF 40000000000000000
int dx8[8] = {-1, 0, 1, 1, 1, 0, -1, -1};
int dy8[8] = {1, 1, 1, 0, -1, -1, -1, 0};
int dx4[4] = {-1, 0, 1, 0};
int dy4[4] = {0, -1, 0, 1};
signed main(void) {
    int V[32] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    int k;
    cin >> k;
    cout << V[k - 1] << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<math.h>
using namespace std;

int main(){
  long long n;
  long long a[5];
  cin >> n >> a[0] >> a[1] >> a[2] >> a[3] >> a[4];

  long long s = n;
  long long u = 0;

  for(int i = 0; i < 5; i++){
    if(s > a[i]){
      s = a[i];
    }
  }
  u = 4 + floor(n/s) + (n%s != 0);

  cout << u << endl;
}


Measured memory_bytes: 256
// +build ignore
package main

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

func solve(sc *scanner, wr *bufio.Writer) int {
	N := sc.i()
	M := sc.i()
	G := make(map[int][]int, 0)
	for i := 0; i < M; i++ {
		A := sc.i()
		B := sc.i()
		if _, ok := G[A]; !ok {
			G[A] = make([]int, 0)
		}
		if _, ok := G[B]; !ok {
			G[B] = make([]int, 0)
		}
		G[A] = append(G[A], B)
		G[B] = append(G[B], A)
	}

	q := []int{1}
	prev := map[int]int{}

	for len(q) != 0 {
		v := q[0]
		q = q[1:]
		for _, g := range G[v] {
			if _, ok := prev[g]; ok {
				continue
			}
			prev[g] = v
			q = append(q, g)
		}
	}

	fmt.Println("Yes")
	for i := 2; i <= N; i++ {
		fmt.Println(prev[i])
	}

	return 0
}

func main() {
	sc := newScanner(os.Stdin)
	wr := bufio.NewWriter(os.Stdout)
	ret := solve(sc, wr)
	wr.Flush()
	os.Exit(ret)
}

// I/O
type scanner struct {
	sc *bufio.Scanner
}

func newScanner(input io.Reader) *scanner {
	sc := bufio.NewScanner(input)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), int(1e+9))
	return &scanner{sc}
}

func (s *scanner) s() string {
	s.sc.Scan()
	return s.sc.Text()
}

func (s *scanner) i() int {
	i, e := strconv.Atoi(s.s())
	if e != nil {
		panic(e)
	}
	return i
}

func (s *scanner) f() float64 {
	f, e := strconv.ParseFloat(s.s(), 64)
	if e != nil {
		panic(e)
	}
	return f
}

func (s *scanner) bs() []byte {
	return []byte(s.s())
}

func (s *scanner) is(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = s.i()
	}
	return res
}

func (s *scanner) fs(n int) []float64 {
	res := make([]float64, n)
	for i := 0; i < n; i++ {
		res[i] = s.f()
	}
	return res
}


Measured memory_bytes: 26568
#include <bits/stdc++.h>
using namespace std;
int main(){
  string s;
  cin>>s;
  if(s[5]=='0' && (s[6]=='4' || s[6]=='3' || s[6]=='2' || s[6]=='1')){
    cout<<"Heisei"<<endl;
  }
  else{
    cout<<"TBD"<<endl;
  }
  
}



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

int main() {
ll n;
string s;
cin >> n >> s;
ll ans = 0;
for (ll i = 0; i < 1000; i++) {
    ll hito = i % 10;
    ll huta = (i % 100 - hito) / 10;
    ll mitu = (i - 10 * huta - hito) / 100;
    char a = hito + '0';
    char b = huta + '0';
    char c = mitu + '0';
    auto itr = find(s.begin(), s.end(), a);
    if (itr == s.end()) continue;
    auto itr2 = find(itr+1, s.end(), b);
    if (itr2 == s.end()) continue;
    auto itr3 = find(itr2+1, s.end(), c);
    if (itr3 == s.end()) continue;
    ans++;
}
cout << ans << endl;
}


Measured memory_bytes: 256
import java.util.*;
import java.util.stream.*;
class Main {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int n,m,l;
        n = input.nextInt();
        m = input.nextInt();
        l = input.nextInt();
        int[][] A = new int[n][m];
        int[][] B = new int[m][l];
        for (int i = 0; i < n; i++){
            for (int j = 0; j < m; j++){
                A[i][j] = input.nextInt();
            }
        }
        for (int i = 0; i < m; i++){
            for (int j = 0; j < l; j++){
                B[i][j] = input.nextInt();
            }
        }
        long[][] grid = new long[n][l];
        for (int i = 0; i < n; i++){
            for (int j = 0; j < l; j++){
                for (int k = 0; k < m; k++){
                    grid[i][j] += A[i][k]*B[k][j];
                }
            }
        }
        for (int i = 0; i < n; i++){
            for (int j = 0; j < l; j++){
                if (j == l-1){
                    System.out.println(grid[i][j]);
                } else {
                    System.out.printf("%d ",grid[i][j]);
                }
            }
        }
    }
}


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

#define MOD (1000000007)

using namespace std;

typedef long long int Int;

constexpr Int TEN(int n) { return n == 0 ? 1 : 10 * TEN(n-1); }

int main(void) {
    double sum = 0;
    int N;
    cin>>N;
    for(int i = 0;i < N;i++) {
        double a;
        cin>>a;
        sum += 1/a;
    }

    cout<<1/sum<<endl;

    return 0;
}





Measured memory_bytes: 888
#include<iostream>
#include<vector>
#include<string>
#include<stdlib.h>
using namespace std;
int main(){
    int N,L;
    int sum=0;
    int min=1000;
    cin>>N>>L;
    vector <int> apple(N);
   
    for(int i=0;i<N;i++){
        apple.at(i)=L+i;
        sum+=apple.at(i);
        
        if(apple.at(i)<0){
            if(apple.at(i)*(-1)<abs(min))
                min=apple.at(i);
        }
        if(apple.at(i)>0){
           if(apple.at(i)<abs(min)){
            min=apple.at(i);
           }
        }
        if(apple.at(i)==0){
            min=apple.at(i);
    }
    }
          cout<<sum-min<<endl;


}


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

using namespace std;

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

const double pi = 3.14159265358979323846;

// #define fio() cin.tie(0); ios::sync_with_stdio(false);
// 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 (a>b) { a = b; return 1; } return 0; }
#define MOD 1000000007LL
#define PS(p) cout << setprecision(15) << fixed << p << endl;
#define UNIQUE(v) v.erase(std::unique(v.begin(), v.end()), v.end());
#define ALL(c) c.begin(), c.end()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define MT make_tuple
#define TG0 get< 0 >
#define TG1 get< 1 >
#define TG2 get< 2 >
#define F first
#define S second
#define VL vector< ll >

// to_string(123)
// atoi("123"); atoi(s.c_str());
// "abc".size()
// s.find('+') == string::npos
// 1e18

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

  string S, T;
  cin >> S >> T;

  if (S.length() + 1 == T.length()) {
    for (ll i = 0; i < S.length(); i++) {
      if (S[i] != T[i]) {
        cout << "No" << endl;
        return 0;
      }
    }
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }

  return 0;
}


Measured memory_bytes: 3640
import java.util.*;

class Main{
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		int r = sc.nextInt();
		int d = sc.nextInt();
		int x = sc.nextInt();
		for(int i = 1; i < 11; i++){
			x = r*x-d;
			System.out.println(x);
		}
	}
}


Measured memory_bytes: 23124
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
 
public class Main {
    public static void main(String[] args) {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        try {
            String str = reader.readLine();
	    String s[]=str.split(" ");
	    int i1=Integer.parseInt(s[0]);
	    int i2=Integer.parseInt(s[1]);
	    int i3=Integer.parseInt(s[2]);
	    
            System.out.println(i1+i2+i3);
            reader.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}



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

using i32 = int32_t;
using i64 = int64_t;
using u32 = uint32_t;
using u64 = uint64_t;

using f64 = double;
using f128 = long double;

template <typename T> using Vec = vector<T>;
template <typename K, typename V> using HashMap = unordered_map<K, V>;
template <typename T> using HashSet = unordered_set<T>;

using StrView = string_view;

auto solve(i64 const N, i64 const K, Vec<i64> const A) -> void {
  HashMap<i64, i64> m(N);

  i64 next = A[0];
  for (i64 i = 1; i < K; ++i) {
    auto iter = m.find(next);
    if (iter != m.end()) {
      i64 loop = i - iter->second;
      i64 n = (K - 1 - i) / loop;
      i += n * loop;
      next = A[next - 1];
      continue;
    }

    m.emplace(next, i);
    next = A[next - 1];
  }

  cout << next << "\n";
}

auto main() -> int {
  i64 N;
  scanf("%" SCNd64, &N);
  i64 K;
  scanf("%" SCNd64, &K);
  Vec<i64> A(N);
  for (int i = 0; i < N; ++i) {
    scanf("%" SCNd64, &A[i]);
  }
  solve(N, K, std::move(A));
  return 0;
}


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

int main(){
    int n,m;
    cin >> n >> m;
    vector<string> a(n),b(m);
    for (int i = 0; i < n; i++){
        cin >> a[i];
    }
    for (int j = 0; j < m; j++){
        cin >> b [j];
    }

    int x = a.at(0).size() - b.at(0).size();
    bool ans;
    for (int i = 0; i <= n-m; i++){
        ans = true;
        for (int j = 0; j <= x; j++){
            ans = true;
            for (int k = 0; k < m; k++){
                for (int l = 0; l < m; l++){
                    if (a[i+k][j+l] != b[k][l]){
                        ans = false;
                    }
                }
            }
            if (ans){
                    cout << "Yes" << endl;
                    return 0;
            }
        }
    }
    cout << "No" << endl;
}

Measured memory_bytes: 256
using System;

namespace ConsoleApp2
{
	class Program
	{
		static void Main(string[] args)
		{
			var nd = Console.ReadLine().Split();
			var n = int.Parse(nd[0]);
			var d = long.Parse(nd[1]);

			var ans = 0;
			for (int i = 0; i < n; i++)
			{
				var xy = Console.ReadLine().Split();
				var x = long.Parse(xy[0]);
				var y = long.Parse(xy[1]);

				var q = Math.Sqrt(x * x + y * y);

				if (q <= d) ans++;
			}

			Console.WriteLine(ans);
		}
	}
}


Measured memory_bytes: 45880
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define mkp make_pair
#define SZ(x) ((int)(x).size())
#define MEM(x,a) memset(x,a,sizeof(x))
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
typedef long long ll;
typedef pair<int,int> PII;
typedef pair<ll,ll> PLL;
typedef vector<int> VI;
typedef vector<ll> VL;
const ll mod=1000000007,N=1e5+5,M=1e5+5,INF=0x3f3f3f3f;
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
//head

int main(void){
    double n;
    cin>>n;
    printf("%f",pow(n/3,3.0));
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
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; }
typedef long long int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define MOD (1000000007)
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

int n;

void input(){
    cin >> n;
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    input();
    string ans;
    if(n < 1000) ans = "ABC";
    else ans = "ABD";
    cout << ans << endl;
    return 0; 
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>
#include <functional>

using namespace std;

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 29;
const int MOD = 1e9 + 7;

char s[2000];
int main() {
  scanf("%s", s);
  set<char> A;
  for (int i = 0; s[i]; ++i) {
    A.insert(s[i]);
  }
  if ((A.count('E') && !A.count('W')) ||
      (A.count('W') && !A.count('E')) ||
      (A.count('N') && !A.count('S')) ||
      (A.count('S') && !A.count('N'))) {
    puts("No");
  } else {
    puts("Yes");
  }
  return 0;
}


Measured memory_bytes: 256
// 前から解くバージョン
#include <bits/stdc++.h>
 
typedef long long ll;
using namespace std;
 
int main() {
    int n;
    cin >> n;
 
    // 先頭から見ていくバージョン
    int counter = 0, result = 0;
    int formerHeight;
    for (int i = 0; i < n; i++) {
        int currentHeight;
        cin >> currentHeight;
        if (i > 0 && formerHeight >= currentHeight) {
            ++counter;
        } else {
            counter = 0;
        }
        result = max(result, counter);
        formerHeight = currentHeight;
    }
 
    cout << result << endl;
}
 


Measured memory_bytes: 256
/*
 * ID: ITP1_8_D
 * Problem: matching the string with the ringed string.
 */

#include <stdio.h>

int main(void)
{
    char s[100];
    char p[100];

    int i;
    for (i = 0; i <= 100; i++) {
        char c;
        if ((c = getchar()) == '\n')
            break;
        s[i] = c;
    }
    int s_length = i;

    for (i = 0; i <= 100; i++) {
        char c;
        if ((c = getchar()) == '\n')
            break;
        p[i] = c;
    }
    int p_length = i;

    int j;

    for (i = 0; i < s_length; i++) {
        int f = 1;
        for (j = 0; j < p_length; j++) {
            if (s[(i + j) % s_length] != p[j]) {
                f = 0;
                break;
            }
        }
        if (f) {
            printf("Yes\n");
            return 0;
        }
    }
    printf("No\n");

    return 0;
}



Measured memory_bytes: 2108
#![allow(unused_imports)]
use itertools::Itertools;
use proconio::{input, marker::*};
use std::cmp::*;
use std::collections::*;
use superslice::*;
use text_io::read;

fn main() {
    input! {
        a1: u64,
        a2: u64,
        a3: u64,
    }

    if a1 + a2 + a3 >= 22 {
        println!("bust");
    } else {
        println!("win");
    }
}


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

using namespace std;

int main(){
    
    long long int i,j,k,n,m;
    cin>>n;
    int a[n],b[n],c[n];
    for(i=0;i<n;i++){
        cin>>a[i]>>b[i]>>c[i];
    }
    int dp[n][3];
    for(i=0;i<n;i++)
    {
        for(j=0;j<3;j++){
            dp[i][j]=-100;
        }
    }
    dp[0][0]=a[0];
    dp[0][1]=b[0];
    dp[0][2]=c[0];
    for(i=0;i<n-1;i++){
        for(j=0;j<3;j++){
            if(j==0){
                dp[i+1][j+1]=max(dp[i+1][j+1],dp[i][j]+b[i+1]);
                dp[i+1][j+2]=max(dp[i+1][j+2],dp[i][j]+c[i+1]);
            }
            if(j==1){
                dp[i+1][j-1]=max(dp[i+1][j-1],dp[i][j]+a[i+1]);
                dp[i+1][j+1]=max(dp[i+1][j+1],dp[i][j]+c[i+1]);
            }
             if(j==2){
                dp[i+1][j-1]=max(dp[i+1][j-1],dp[i][j]+b[i+1]);
                dp[i+1][j-2]=max(dp[i+1][j-2],dp[i][j]+a[i+1]);
            }
        }
    }
    cout<<max(dp[n-1][0],max(dp[n-1][1],dp[n-1][2]));
    return 0;
}

Measured memory_bytes: 2560
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
     Scanner scan = new Scanner(System.in);
     int[] x = new int[3];
     x[0] = scan.nextInt();
     x[1] = scan.nextInt();
     x[2] = scan.nextInt();
     int y;
     for(int i=0 ; i<2 ; i++){
		if(x[0] > x[1]) {
			y = x[0];
			x[0] = x[1];
			x[1] = y;
		}
		if(x[1] > x[2]) {
			y = x[1];
			x[1] = x[2];
			x[2] = y;
		}
	}
     System.out.println(x[0]+" "+x[1]+" "+x[2]);
    }
}


Measured memory_bytes: 26084
import sys

N = int(input())

def inread():
    a = sys.stdin.readline()
    if a[0] == "-":
        return 0/0
    return a[0]


ans = [" "] * (2*N)

def nibu(R,B):
    if abs(R-B)==1:
        return min(R,B),max(R,B)+N-1
    c = (R+B)//2
    print("?",*range(c+1,c+N+1),flush=True)
    a = inread()
    if a == 'R':
        return nibu(c,B)
    else:
        return nibu(R,c)

print("?",*range(1,N+1),flush=True)
if inread() == "R":
    R,B = nibu(0,N)
else:
    R,B = nibu(N,0)

neutral1 = " ".join([str(i) for i in range(R+2,B+1)])
neutral2 =  " ".join([str(i) for i in range(1,R+1)]) + " " + " ".join([str(i)for i in range(B+2,2*N+1)])
for i in range(R+1):
    print("? "+neutral1+" "+str(i+1),flush=True)
    ans[i] = inread()
for i in range(R+2,B+1):
    print("? " + neutral2 +" " + str(i),flush=True)
    ans[i-1] = inread()
for i in range(B+1,2*N+1):
    print("? "+ neutral1+" "+str(i),flush=True)
    ans[i-1] = inread()

print("! "+"".join(ans))

Measured memory_bytes: 3532
#include <bits/stdc++.h>
#define ll long long
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n) for (int i = 1; i <= n; i++)
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll lcm(ll a, ll b) { return (a * b) / gcd(a,b); }
using P = pair <int, int>;
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; }

ll MOD = 1000000007;
ll INF =1<<30;

int main(){
    int d,t,s;
    cin >>d>>t>>s;
    if(s*t>=d) cout <<"Yes" <<endl;
    else cout << "No" <<endl;
}

Measured memory_bytes: 3656
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
using ld = long double;
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define rep3(i, n) for (int i = 1; i < (int)(n+1); i++)
#define rep4(i, s, n) for (int i = (s); i < (int)(n+1); i++)
#define repr(i,n) for (int i = (n-1); i>=0;i--)
#define repr3(i,n) for(int i = (n);i>0;i--)
#define stlen(s) ll s.size()-1
#define all(v) v.begin(), v.end()
#define cout(n) cout<<std::fixed<<std::setprecision(n)
using Graph = vector<vector<int>>;
#define INF  1001001001;
#define PI  3.14159265358979323846;

int main(){
int A,B,C,D;
cin>>A>>B>>C>>D;
if((A+B)>(C+D)){
    cout<<"Left"<<endl;

}
else if((A+B)<(C+D)){
    cout<<"Right"<<endl;

}
else{
    cout<<"Balanced"<<endl;
}
return 0;
}

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

int main()
{
  int N;
  std::cin >> N;
  std::string S;  
  std::cin >> S;
  int sum_w[N] = {0};
  int sum_e[N] = {0};
  if ( S[0] == 'W' ) sum_w[1] = 1;
  if ( S[N-1] =='E' ) sum_e[N-2] = 1;

  for ( int i = N-3; i >= 0; i-- ) {
    if ( S[i+1] == 'E' ) {
      sum_e[i] = sum_e[i+1] + 1; 
    } else {
      sum_e[i] = sum_e[i+1];
    }
  }
  for ( int i = 2; i < N; i++ ) {
    if ( S[i-1] == 'W' ) {
      sum_w[i] = sum_w[i-1] + 1; 
    } else {
      sum_w[i] = sum_w[i-1];
    }
  }
  // for ( int i = 0; i < N; i++ ) {
  //   std::cerr << "sum_w[" << i << "]: " << sum_w[i];
  // }
  // std::cerr << std::endl;
  // for ( int i = 0; i < N; i++ ) {
  //   std::cerr << "sum_e[" << i << "]: " << sum_e[i];
  // }
  // std::cerr << std::endl;

  int min = 10 * 10 * 10 * 10 * 10 * 10;
  for ( int i = 0; i < N; i++ ){
    int tmp = sum_w[i] + sum_e[i];
    // std::cerr << "tmp: " << tmp << std::endl;
    if ( min > tmp ) {
      // std::cerr << "min: " << min << std::endl;
      min = tmp;
    }
  }
  std::cout << min << std::endl;
  return 0;
}


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

typedef long long int ll;
using ii= pair<ll,ll>;
#define all(o) (o).begin(),(o).end()
#define F first
#define S second
#define MP make_pair
#define PB push_back
#define ld long double
#define eps 0.00000000001

class prioritize{
    public: bool operator() (ii &p1,ii &p2){
        return p1.F<p2.F;
    }
};

int main()
{
    
    #ifndef ONLINE_JUDGE
        freopen("input1.txt","r", stdin);
        freopen("output1.txt","w",stdout);
    #endif

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    
    ll n;
    cin>>n;

    string s;
    cin>>s;
   
    ll count=0;

   
   

 
    ll i=0;
    ll j=n-1;

   

    while(i<j&&i<n&&j>=0){
    	
    	while(s[i]=='R'&&i<n){
    		i++;
    	}
    	while(s[j]=='W'&&j>0){
    		j--;
    	}


        if(i<n&&j>=0&&i<j){
        	s[i]='R';
    	    s[j]='W';
    	    count++;
    	    
        }
    	
    }


    if(count==0) cout<<0<<"\n";
    else{
    	for(ll j=0;j<n-1;j++){
    	    if(s[j]=='W'&&s[j+1]=='R'){
    	    	s[j]='R';
    	    	count++;
    	    }
        }
        cout<<count<<"\n";
    } 
    	
  
}

Measured memory_bytes: 3696
import java.util.*;
import java.util.stream.Collectors;

class Main {
    final Scanner sc = new Scanner(System.in);
    private int n;
    private int m;
    private int q;
    Row[] rows;

    public static void main(String[] args) {
        new Main().run();
    }

    private void run() {
        n = sc.nextInt();
        m = sc.nextInt();
        q = sc.nextInt();

        rows = new Row[q];
        for (int i = 0; i < q; i++) {
            rows[i] = new Row(sc.nextInt(), sc.nextInt(), sc.nextInt(), sc.nextInt());
        }

        int[] A = new int[n+1];
        System.out.println(dfs(1, A));
    }

    private int dfs(int i, int[] A) {
        if (i == n+1) {
            int score = 0;
            for (int j = 0; j < q; j++) {
                if (A[rows[j].b] - A[rows[j].a] == rows[j].c) score += rows[j].d;
            }
            return score;
        }

        int max = 0;
        int start = i == 1 ? 1 : A[i-1];
        for (int j = start; j <= m; j++) {
            A[i] = j;
            int now = dfs(i+1, A);
            max = Math.max(now, max);
        }
        return max;
    }

    class Row {
        int a;
        int b;
        int c;
        int d;

        public Row(int a, int b, int c, int d) {
            this.a = a;
            this.b = b;
            this.c = c;
            this.d = d;
        }
    }
}


Measured memory_bytes: 37980