akhauriyash/Code-Regression huggingface dataset:
import sys
def input():
	return sys.stdin.readline().strip()

H, W, N = list(map(int, input().split()))
sr, sc = list(map(int, input().split()))
S = input()
T = input()

left = 0
right = W
up = 0
down = H

for times in range(N - 1, -1, -1):
	#print(left, right, up, down)
	direct = T[times]
	if direct == 'L':
		right = min(W, right + 1)
	elif direct == 'R':
		left = max(0, left - 1)
	elif direct == 'U':
		down = min(H, down + 1)
	elif direct == 'D':
		up = max(0, up - 1)
	direct = S[times]
	if direct == 'L':
		left = min(W, left + 1)
	elif direct == 'R':
		right = max(0, right - 1)
	elif direct == 'U':
		up = min(H, up + 1)
	elif direct == 'D':
		down = max(0, down - 1)
	if up >= down or left >= right:
		print("NO")
		exit()


if sc - 1 < right and left <= sc - 1 and sr - 1 >= up and down > sr - 1:
	print("YES")
else:
	print("NO")

Measured memory_bytes: 50508
#include<iostream>
#include <cmath>
using namespace std;
int beishu(int cifang,int shu)
{
	long long int sum=1;
	for (int i=1;i<=cifang;i++)
		sum*=shu;
	return sum;
}
int weishu(int x)
{
	int num=0;
	while (x)
	{
		num++;
		x/=10;
	}
	return num;
}
int main()
{
    int a,b;
    cin>>a>>b;
    long long int s;
    s=a*beishu(weishu(b),10);
    s+=b;
    int g=sqrt(s);
    if (g*g==s)
    	cout<<"Yes\n";
    else
    	cout<<"No\n";
    return 0;
} 

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

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef vector<pii> vpii;

#define mp          make_pair
#define pb          push_back
#define F           first
#define S           second
#define all(a)      (a).begin(),(a).end()
#define rep(i,n)    for(int i=0;i<n;i++)
/*
inline bool cmp (const pii &a, const pii &b)
{
    if (a.first != b.first)
        return a.first > b.first;

    return a.second < b.second;
}
*/
/*
srand(time(0));
int a = (rand() % 100) + 1;
*/
void solve(){
   string s;cin>>s;
   if(s[0]=='R' && s[1]=='R' && s[2]=='R')
    cout<<3<<endl;
   else if((s[0]=='R' && s[1]=='R' )|| (s[1]=='R' && s[2]=='R'))
    cout<<2<<endl;
   else if(s[0]=='R' || s[1]=='R' || s[2]=='R')
    cout<<1<<endl;
   else cout<<0<<endl;
}
int main(){
   // int t;cin>>t;while(t--)
    solve();

    return 0;
}


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

using namespace std;

int main(void)
{
	int a, b;
	cin >> a >> b;
	if (a == 1) a = 14;
	if (b == 1) b = 14;
	if (a > b) {
		cout << "Alice" << endl;
	} else if (a == b) cout << "Draw" << endl;
	else cout << "Bob" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;++i)
#define REPR(i, n) for(int i = n-1;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 SORT(v, n) sort(v, v+n)
#define VSORT(v) sort(begin(v), end(v))
#define REV(v) reverse(begin(v), end(v))
#define VI vector<int>
#define PB(x) push_back(x)
#define SZ(x) end(x) - begin(x)
#define DEBUG(x) cerr << __LINE__ << ":" << #x << ": " << x << "\n";
//#define int long long
using namespace std;
using lint = long long;
struct Fast{Fast(){cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20);};} fast;
const int INF = INT_MAX;
const lint LINF = LLONG_MAX;
const int MOD = 1e9 + 7;
const double EPS = 1e-9;
inline void CO(auto &a) {REP(i, SZ(a)) cout << i << ": " << a[i] << "\n";}
//if (IO > 1e5){lint a;	scanf(%lld, &a);	printf("%lld\n", a);}

signed main(){
	int a,b,c;
	cin >> a >> b >> c;
	if (a>b){
		if (a>c and c>b){
			cout << "Yes" << endl;
			return 0;
		}
	}else{
		if (b>c and c>a){
			cout << "Yes" << endl;
			return 0;
		}
	}
	
	cout << "No" << endl;
return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define erep(i, n) for (ll i = 0; i <= (ll)(n); ++i)
#define FOR(i,a,b) for (ll i = (a); i < (ll)(b); ++i)
#define EFOR(i,a,b) for (ll i = (a); i <= (ll)(b); ++i)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } }

#include <iostream>
#include <vector>
#include <queue>
using namespace std;
using Graph = vector<vector<int>>;

int main() {
    string s; cin >> s;
    if(s[0] == s[1] && s[1] == s[2]) {
        cout << "No" << endl;
    } else {
        cout << "Yes" << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
using namespace std;
typedef long long ll;
#define For(i,n,k) for(int i=(n);i<(k);i++)
#define ALL(a)  (a).begin(),(a).end()
ll ans=0;
vector<vector<int>> dp(2,vector<int> (2020,0));
const int m = 2019;
int S;
void Main(){
    string s;cin>>s;
    int n=s.size();
    For(i,0,n){
        S=s[i]-'0';
        ans+=dp[i%2][0];
        For(j,0,m){
            dp[(i+1)%2][(j*10+S)%m]=dp[i%2][j];
        }
        dp[(i+1)%2][S]+=1;
    }
    ans+=dp[n%2][0];
    cout<<ans<<endl;
}
int main(){
    Main();
    /*
    東方風神録は神が出てくるので当然神ゲー
    */
    return 0;
}


Measured memory_bytes: 3756
#include<bits/stdc++.h>
/*#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>*/
 
using namespace std;
//using namespace __gnu_pbds;
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define int long long 
#define rep(i,n) for(int i=0;i<n;i++)
#define repa(i,arr,n) for(int i=arr;i<=n;i++)
#define repd(i,arr,n) for(int i=arr;i>=n;i--)
#define trav(arr,x) for(auto& arr:x)
#define all(c) c.begin(), c.end()
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define sz(arr) arr.size()
#define pi 3.14159265358979323846
#define MAX 500003
#define vi vector<int>
#define pii pair<int,int>
#define pqueue priority_queue<int>
#define pdqueue priority_queue<int,vi,greater<int> >
//#define endl "\n"
 
//typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
 
const int mod=998244353;
int power(int a,int b)
{
    int ans=1;
    while(b)
    {
        if(b&1)
        {
            ans=(ans*a);
        }
        a=(a*a);
        b>>=1;
    }
    return ans;
}

int32_t main()
{
    fast;
    
    int t;
    t=1;
    while(t--)
    {
        int n;
        cin>>n;

        vector<char> v;

        while(n)
        {
            int val=n%26;
            if(val==0) val=26;
            v.pb('a'+val-1);
            n-=val;
            n/=26;
        }

        repd(i,sz(v)-1,0) cout<<v[i];
    }
}


Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define rep2(i,n) for(int i=0;i<=n;i++)
#define repr(i,a,n) for(int i=a;i<n;i++)
#define all(a) a.begin(),a.end()
#define P pair<long long,long long>
#define double long double
#define INF 1e10
#define MOD 1e9+7
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using Graph = vector<vector<int>>;
int fg(int k){
    int sum = 1;
    for (int i = 1; i <= k; ++i)
    {
        sum *= i;
    }
    return sum;
}
signed main(){
 int a,b,c;
  int k;
  int sum=0;
  cin>>a>>b>>c>>k;
  rep(i,7){
    if(a>=b){
      b=b*2;
      sum++;
    }
  }
  rep(j,7){
    if(b>=c){
      c=c*2;
      sum++;
    }
  }
  if(sum<=k){
    cout<<"Yes";
  }
  else{
    cout<<"No";
  }
}   

Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define drep(i,cc,n) for(int i=(cc);i<=(n);++i)
#define rep(i,n) drep(i,0,(n)-1)
#define drrep(i,cc,n) for(int i=(cc);i>=(n);--i)
#define rrep(i,n) drrep(i,0,(n)-1)
#define sz(s) (int)(s.size())
#define vecprint(v) rep(i,v.size())if(i==0)cout << v[i];else cout << " " << v[i]; cout << endl;
#define arrprint(v,n) rep(i,n)if(i==0)cout << v[i];else cout << " " << v[i]; cout << endl;
#define matprint(v,n,m) rep(i,n){rep(j,m){cout << v[i][j] << " ";}cout << endl;}
#define SORT(v) sort(v.begin(), v.end())
#define REV(v) reverse(v.begin(), v.end())
using namespace std;
const int mod=1000000007;
const int INF=1001001001;
using ll = long long;
using P = pair<int,int>;
template<typename T>
using priority_queue_rev = priority_queue<T, vector<T>, greater<T>>; //小さいものから取り出す

int main(){
    int n,k;
    cin >> n >> k;
    vector<int> a(n);
    rep(i,n)cin >> a[i];
    int maxa = 0;
    rep(i,n)maxa = max(maxa,a[i]);

    ll l=0,r = maxa+1;
    while((r-l) > 1){
        ll c = (l+r)/2;
        ll cnt = 0;
        // vector<int> b = a;
        rep(i,n){
            ll cc = 1;
            int b = a[i];
            // while(b > c){
            //     b /= 2;
            //     cnt += cc;
            //     cc *= 2;
            // }
            if(b%c == 0)cnt--;
            cnt += b / c;
        }
        if(cnt <= k)r = c;
        else l = c;
    }

    ll ans = r;

    cout << ans << endl;
//  printf("%.10f\n",ans);

    return 0;
}

Measured memory_bytes: 3980
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
int main(){
  int n;
  scanf("%d",&n);
  char s[n][111], t[111];
  int u[n], nyaa = 0;
  for(int i=0;i<n;i++){
    scanf("%s%d",s[i], &u[i]);
    nyaa += u[i];
  }
  scanf("%s",t);
  for(int i=0;i<n;i++){
    nyaa -= u[i];
    if(!strcmp(s[i], t))break;
  }
  printf("%d\n",nyaa);
  return 0;
}

Measured memory_bytes: 128
#include <algorithm>
#include <cmath>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;
typedef long long i64;
typedef long double ld;
typedef pair<i64, i64> P;
#define rep(i, s, e) for (int i = (s); i <= (e); i++)

int n, m;
vector<pair<int, bool>> edges[101010];

i64 w[101010];

int ord[101010];
int low[101010];


int main() {
  cin >> n >> m;
  rep(i, 1, n) cin >> w[i];
  rep(i, 1, m) {
    int a, b;
    cin >> a >> b;
    edges[a].emplace_back(b, false);
    edges[b].emplace_back(a, false);
  }

  int cou;

  vector<i64> dp(n + 1,0);

  function<void(int)> dfs = [&](int v){
    ord[v] = cou++;
    low[v] = ord[v];

    dp[v] = w[v];
    for(auto & to : edges[v])
    {
      if(ord[to.first] == 0)
      {
        to.second = true;
        dfs(to.first);
        low[v] = min(low[to.first],low[v]);

        dp[v] += dp[to.first];
      }
      else if(!to.second)
      {
        low[v] = min(low[v],ord[to.first]);
      }
    }
  };
  for(int i = 1;i <= n;i++)
  {
    if(ord[i] == 0)
    {
      cou = 1;
      dfs(i);
    }
  }
  i64 sum = 0;
  for(int i = 1;i <= n;i++) sum += w[i];


  for(int i = 1;i <= n;i++)
  {
    i64 ans = 0;
    if(ord[i] == 1)
    {
      for(auto & to : edges[i])
      {
        ans = max(ans,dp[to.first]);
      }
    }
    else
    {
      i64 MAX = 0;
      ans = sum - dp[i];
      for(auto& to : edges[i])
      {
        if(!to.second) continue;
        if(ord[i] <= low[to.first])
        {
          MAX = max(MAX,dp[to.first]);
        }
        else
        {
          ans += dp[to.first];
        }
      }
      ans = max(ans,MAX);
    }

    cout << ans << endl;
  }
}



Measured memory_bytes: 11656
import sys
from collections import deque

X = list(sys.stdin.readline().strip())

s = []
q = deque(X)
while q:
    char = q.popleft()
    if len(s) == 0:
        s.append(char)
        continue
        
    if char == "T" and s[-1] == "S":
        s.pop()

    else:
        s.append(char)

print(len(s))

Measured memory_bytes: 96348
#include <bits/stdc++.h>
#include <string>
#include <cstring>
#include <algorithm>
#include <math.h>
#include <map>
#include <bitset>
#include <cmath>
#include <set>
#include <utility>

#define INF 1000000000000
#define MOD 1000000007 //10^9+7:合同式の法

using namespace std;
typedef long long ll;

//マクロ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)

int main(){
    int N,sum=0;
    cin >> N;
    vector<int> H(N);

    for(int i = 0;i < N;i++)
        cin >> H.at(i);
    
    sort(H.begin(),H.end());

    for(int i = 0;i < N -1;i++)
        sum += H.at(i);
    
    if(H.at(N-1) < sum)
        cout << "Yes" << endl;
    else
    {
        cout << "No" << endl;
    }
    
    
}

Measured memory_bytes: 3612
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <vector>
using namespace std;
typedef long long LL;
int N;
struct P{
	LL x,y;
	P(){};
	P(LL x,LL y):x(x),y(y){}
	P operator +(P p){
		return P(x+p.x,y+p.y);
	}
	P operator -(P p){
		return P(x-p.x,y-p.y);
	}
	LL dot(P p){
		return x*p.x+y*p.y;
	}
	LL det(P p){
		return x*p.y-y*p.x;
	}
	bool operator ==(P p){
		return x==p.x&&y==p.y;
	}
	double len(){
		return sqrt(x*x+y*y);
	}
};
P ps[105];
P po[105];
double pro[105];

bool cmp_x(const P &p,const P &q){
	if(p.x!=q.x) return p.x<q.x;
	return p.y<q.y;
}
vector<P> convex_hull(P *ps,int n){
	sort(ps,ps+n,cmp_x);
	int k=0;
	vector<P> qs(n*2);
	for(int i=0;i<n;i++){
		while(k>1&&(qs[k-1]-qs[k-2]).det(ps[i]-qs[k-1])<=0) k--;
		qs[k++]=ps[i];
	}
	for(int i=n-2,t=k;i>=0;i--){
		while(k>t && (qs[k-1]-qs[k-2]).det(ps[i]-qs[k-1])<=0) k--;
		qs[k++]=ps[i];
	}
	qs.resize(k-1);
	return qs;
}
void calcPro(int i,P a,P b){	
//	printf("#%d\n",a.dot(b));
//	printf("#a=(%d,%d) b=(%d,%d)\n",a.x,a.y,b.x,b.y);
//	printf("#%f\n",a.len()*b.len());
//	printf("#%f\n",a.dot(b)/a.len()/b.len());
//	printf("#%f\n",acos(a.dot(b)/a.len()/b.len()));
	double x=a.dot(b)/a.len()/b.len();
	if(x<=-1+1e-10) pro[i]=0.5;
	else if(x>=1-1e-10) pro[i]=0.0;
	else pro[i]=acos(x)/(2*3.14159265358979);
//	printf("#pro=%f\n",pro[i]);
}
int main(){
	scanf("%d",&N);
	int x,y;
	for(int i=0;i<N;i++){
		scanf("%d%d",&x,&y);
		po[i].x=ps[i].x=x;
		po[i].y=ps[i].y=y;
	}
	if(N==1){
		printf("1\n");
		return 0;
	}
	if(N==2){
		printf("0.50000000000000000000\n0.5000000000000000000\n");
		return 0;
	}
	vector<P> qs=convex_hull(ps,N);
	int n=qs.size();
	calcPro(0,qs[0]-qs[n-1],qs[1]-qs[0]);
	for(int i=1;i<n-1;i++){
		calcPro(i,qs[i]-qs[i-1],qs[i+1]-qs[i]);
	}
	calcPro(n-1,qs[n-1]-qs[n-2],qs[0]-qs[n-1]);
	//print
	bool isok=false;
	for(int i=0;i<N;i++){
		isok=false;
		for(int j=0;j<n;j++){
			if(po[i]==qs[j]){
				printf("%.20f\n",pro[j]);
				isok=true;
			}
		}
		if(!isok) printf("0.00000000000000000000000000\n");
	}
	return 0;
}





Measured memory_bytes: 256
//
//  ROIGold.cpp
//  Main calisma
//
//  Created by Rakhman on 05/02/2019.
//  Copyright © 2019 Rakhman. All rights reserved.
//

#include <cstring>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <queue>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cassert>
#include <iterator>

#define ios ios_base::sync_with_stdio(0), cout.tie(0), cin.tie(0);
#define S second
#define F first
#define pb push_back
#define nl '\n'
#define NL cout << '\n';
#define EX exit(0)
#define all(s) s.begin(), s.end()
#define FOR(i, start, finish, k) for(int i = start; i <= finish; i += k)

const int MXN = 1e5 + 200;
const long long MNN = 2e3 + 200;
const long long MOD = 1e9 + 7;
const long long INF = 1e18;
const int OO = 1e9 + 500;

typedef long long llong;
typedef unsigned long long ullong;

using namespace std;

llong n, cnt1, cnt2, ans;
vector<int> q[MXN * 2 + 1];
bool used[MXN * 2 + 1];

void dfs(int x){
    if(used[x] == 0){
        used[x] = 1;
        if(x < MXN){
            cnt1++;
        }else{
            cnt2++;
        }
        for(int i = 0; i < q[x].size(); i++){
            dfs(q[x][i]);
        }
    }
}

int main () {
    ios;
    cin >> n;
    for(int i = 1; i <= n; i++){
        llong x, y;
        cin >> x >> y;
        q[x].pb(y + MXN);
        q[y + MXN].pb(x);
    }
    for(int i = 1; i < MXN; i++){
        if(used[i] == 0){
            cnt1 = cnt2 = 0;
            dfs(i);
            ans += cnt1 * cnt2;
        }
    }
    ans -= n;
    cout << ans;
    return 0;
}


Measured memory_bytes: 10240
import sys

S = {}
S["a"] = list(sys.stdin.readline().strip())[::-1]
S["b"] = list(sys.stdin.readline().strip())[::-1]
S["c"] = list(sys.stdin.readline().strip())[::-1]

target = "a"
while True:
    if len(S[target]) == 0:
        break
    next_target = S[target].pop()
    # print(next_target)
    target = next_target

print(target.upper())

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

pair<long long, long long> x[555333], st[555333];

int main() {

    long long n,d,a;
    scanf("%lld%lld%lld", &n, &d, &a);
    for(int i=0; i<n; i++) {
        long long t,h;
        scanf("%lld%lld", &t, &h);
        x[i] = make_pair(t,h);
    }
    sort(x,x+n);

    long long r = 0;
    long long curr = 0;
    int br = 0;
    int tbr = 0;
    for(int i=0; i<n; i++) {

        while(tbr < br && x[i].first > st[tbr].first) {
            curr -= a * st[tbr].second;
            tbr++;
        }

        if (curr > x[i].second) continue;

        long long t = x[i].second - curr;
        long long p = t / a + (t % a >0);

        r += p;

        curr += p*a;
        st[br++] = make_pair(x[i].first + 2*d, p);
    }

    printf("%lld\n", r);

    return 0;
}

Measured memory_bytes: 8448
#include <stdio.h>
int main(){
    int a,b;
    char t;
    for(;;){
        scanf("%d %c %d",&a,&t,&b);
        if(t=='?') break;
        if(t=='+') a+=b;
        if(t=='-') a-=b;
        if(t=='*') a*=b;
        if(t=='/') a/=b;
        printf("%d\n",a);
    }
    return 0;
}


Measured memory_bytes: 2044
#include <stdio.h>

int main (){
    int a,b,c, temp = 0;


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

    temp = b;
    b = a;
    a = c ;
    c = temp;

    printf("%d %d %d\n",a,b,c);

    return 0 ;
}

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

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

  vector<char> a = {'K', 'I', 'H', 'B', 'R'};
  int t = 0, c = 0;
  bool check = true;
  for (int i = 0; i < s.size(); i ++) {
    if (t < 5 && s[i] == a[t]) {
      t ++, c = 0;
      continue;
    }
    if (s[i] == 'A') {
      if (c >= 1 || t == 1 || t == 2) {
        check = false;
        break;
      } else {
        c ++;
      }
    } else {
      check = false;
      break;
    }
  }

  if (check && t == 5) cout << "YES" << endl;
  else cout << "NO" << endl;
}

Measured memory_bytes: 256
import java.io.*;
import java.util.*;
public class Main{
    public static void main(String[] args) throws IOException{
        MyReader r = new MyReader(); 
        long A, B;
        {long[] a = r.ll(); A = a[0]; B = a[1];}
        println((A+B)%2 == 0 ? (A+B)/2 : "IMPOSSIBLE");
    }
    static void print(Object o){
        System.out.print(o.toString());
    }
    static void println(Object o){
        System.out.println(o.toString());
    }
    static int Int(String s){
        return Integer.parseInt(s);
    }
    static long Long(String s){
        return Long.parseLong(s);
    }
    static class MyReader extends BufferedReader{
        MyReader(){
            super(new InputStreamReader(System.in));
        }
        String s() throws IOException{
            return readLine();
        }
        String[] ss() throws IOException{
            return s().split(" ");
        }
        int i() throws IOException{
            return Int(s());
        }
        int[] ii() throws IOException{
            String[] ss = ss();
            int size = ss.length;
            int[] ii = new int[size];
            for(int j = 0; j < size; j++) ii[j] = Integer.parseInt(ss[j]);
            return ii;
        }
        long l() throws IOException{
            return Long(s());
        }
        long[] ll() throws IOException{
            String[] ss = ss();
            int size = ss.length;
            long[] ll = new long[size];
            for(int j = 0; j < size; j++) ll[j] = Long.parseLong(ss[j]);            
            return ll;
        }
    }
}

Measured memory_bytes: 21332
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod = 1e9+7;
const long long INF = 1e15;

int main(){
    int n;
    cin >> n;
    string s;
    cin >> s;
    int cnt = 0;
    for(int i = 0; i < n; i++){
        if(s[i] == 'R') cnt++;
    }
    int rcnt = 0;
    for(int i = 0; i < cnt; i++){
        if(s[i] != 'R') rcnt++;
    }
    cout << rcnt << endl;
    return 0;
}

Measured memory_bytes: 3720
from collections import deque
def MI(): return map(int, input().split())
def bfs():
  dist=[[INF] * (W+1) for _ in range(H+1)]
  dist[sx][sy]=0
  que=deque([])
  que.append((sx,sy))
  di=(-1,0,1,0)
  dj=(0,-1,0,1)
  while que:
    (x,y)=que.popleft()
    if x==gx and y==gy:
      break
    for k in range(4):
      ni=x+di[k]
      nj=y+dj[k]
      if 0<=ni<H and 0<=nj<W:
        if Map[ni][nj]!='#':
          if dist[ni][nj]==INF:
            dist[ni][nj]=dist[x][y]+1
            que.append((ni,nj))
  return dist[gx][gy]
H,W=MI()
Map=[list(input()) for _ in range(H)]
#Map2=[[input()] for _ in range(H)]
INF=float('inf')
(sx,sy)=(0,0)
(gx,gy)=(H-1,W-1)
res=bfs()
white=0
for i in range(H):
  for j in range(W):
    if Map[i][j]=='.':
      white+=1
if 0<res<INF:
  ans=white-res-1
  print(ans)
else:
  print(-1)

Measured memory_bytes: 9424
N, A, B, C = map(int, input().split())
l = [int(input()) for i in range(N)]
 
INF = float('inf')
ans = INF
 
def dfs(a, b, c, n, cost):
    global ans
    if n == N:
        cost += abs(A - a) + abs(B - b) + abs(C - c) - 30 if min(a, b, c) > 0 else INF
        ans = min(ans, cost)
        return
    dfs(a, b, c, n+1, cost)
    dfs(a+l[n], b, c, n+1, cost+10)
    dfs(a, b+l[n], c, n+1, cost+10)
    dfs(a, b, c+l[n], n+1, cost+10)
 
dfs(0, 0, 0, 0, 0)
print(ans)


Measured memory_bytes: 9232
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<sstream>
using namespace std;
typedef  long long int lint;
typedef pair<int, int> P;
typedef pair<lint, lint> LLP;
typedef pair<char, char>CP;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define sort(v) sort((v).begin(), (v).end())
#define reverse(v) reverse((v).begin(), (v).end())
#define upper(v,hoge) upper_bound(v.begin(),v.end(),hoge)
#define lower(v,hoge) lower_bound(v.begin(),v.end(),hoge)
#define llower(v,hoge) *lower_bound(v.begin(), v.end(), hoge)
#define lupper(v,hoge) *upper_bound(v.begin(), v.end(), hoge)
/*
vector<char>al(26);
al = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
vector<char>AL(26);
AL = {'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
vector<char>NUM(10);
	NUM = { '0','1','2' ,'3' ,'4' ,'5' ,'6' ,'7' ,'8' ,'9' };
*/



int main() {
	string S;
	cin >> S;
	int Z = S.size();
	int cnt = 0;
	for (int i = Z / 2-2; i >= 0; i--) {
		for (int j = 0; j <= i; j++) {
			if (S[j] == S[j + i+1]) {
				cnt++;
			}
		}
		if (cnt == i + 1) {
			cout <<  (i+1)*2 << endl;
			return 0;
		}
		cnt = 0;
	}
}

Measured memory_bytes: 256
import java.util.*;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        String op = sc.next();
        int b = sc.nextInt();

        if(op.charAt(0)=='+'){
            System.out.println(a+b);
        }else{
            System.out.println(a-b);
        }
    }
}


Measured memory_bytes: 21716
#include<bits/stdc++.h>
#include<cmath>
using namespace std;
int main()
{
		ios_base::sync_with_stdio(false);
	cin.tie(NULL);
int n;
cin>>n;
int a[200001];
for(int i=1;i<=n;i++)
cin>>a[i];
int max=0;
int pos=0;
for(int i=1;i<=n;i++)
{
if(a[i]>max)
{
max=a[i];
pos=i;
}
}
for(int i=1;i<=n;i++)
{
if(i==pos)
{
if(i==1)
{
	int p=0;
for(int j=i+1;j<=n;j++)
{
	if(p<a[j])
	p=a[j];
	}
	cout<<p<<endl;	
}
else
{
	int p=0;
	for(int j=1;j<i;j++)
	{
	if(a[j]>p)
	p=a[j];	
	}
	for(int j=i+1;j<=n;j++)
	{
		if(a[j]>p)
		p=a[j];
	}
	cout<<p<<endl;
}
	}
	else	
	cout<<max<<endl;
}

}



Measured memory_bytes: 2432
#include <iostream>
#include <algorithm>
#include <string>
#include <cstdio>
#include <cmath>
#include <stack>
#include <cstring>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <numeric>
#include <iomanip>


int main()
{
	long long n;

	std::cin >> n;

	long long ans = 1;
	for (size_t i = 1; i <= n; i++) {
		ans = (ans * i) % 1000000007;
	}

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

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

#define ll long long
using namespace std;
long long power(ll  x, ll n){
    if(n==0)return 1;
    ll temp=power(x,n/2);
    if(n%2==0)return temp*temp;
    else return x*temp*temp;

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

}

ll max(ll a,ll b,ll c){
    return max(max(a,b),c);
}
ll min(ll x,ll  y){
    return x+y-max(x,y);
}
ll min(ll x,ll y,ll z){
    return min(min(x,y),z);

}



void swap(int* a, int* b)
{
    int t = *a;
    *a = *b;
    *b = t;
}

bool f(ll x,ll y){
    return x>y;

}


int main(){
string s;
  cin>>s;
  ll f=0;
  for(ll i=0;i<s.size();i++){
   if(s[i]=='7')f=1;
    
  }
if(f)cout<<"Yes";
  else cout<<"No";
    return 0;
}






































Measured memory_bytes: 3624
import sys
def input():
	return sys.stdin.readline()[:-1]

n, m = map(int, input().split())
t = [list(map(int, input().split())) for _ in range(n)]
t.sort(key=lambda x:(x[1]*x[0] + x[2]*(m-x[0])), reverse=True)
full = [x[1]*x[0] + x[2]*(m-x[0]) for x in t]
cum = [0]
for i in range(n):
	cum.append(cum[-1] + full[i])
aoki = sum([p[0]*p[1] for p in t])
ans = n*m
for i in range(n):
	ok, ng = n*m, -1
	while ok-ng > 1:
		x = (ok+ng) // 2
		res = cum[x//m]
		if (x//m)-1 >= i:
			res -= full[i]
			res += full[x//m]
		res += t[i][1] * min(t[i][0], x%m) + t[i][2] * max(0, (x%m) - t[i][0])
		if res >= aoki:
			ok = x
		else:
			ng = x
	ans = min(ans, ok)
print(ans)

Measured memory_bytes: 70620
#include<bits/stdc++.h> 
using namespace std; 
  
int main()
{
    long long n,a,b;
    cin>>n>>a>>b;
    
    long long ans1= n/(a+b);
    long long ans2= ans1*(a);
    long long final= ans2 + min(n%(a+b),a);
    
    cout<<final<<endl;
}

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

typedef long long ll;

ll N;
const ll L = 20;
typedef pair<ll, ll> Data;
vector<vector<Data>> Min;
typedef tuple<Data, ll, ll> Entry;
priority_queue<Entry, vector<Entry>, greater<Entry>> Que;

Data min_range(ll i, ll j) {
  assert(i < j);
  assert((j - i) % 2 == 0);
  ll l = 0;
  while ((1 << l) * 2 * 2 < j - i) ++l;
  ll j2 = j - (1 << l) * 2;
  assert(i <= j2);
  return min(Min[l][i], Min[l][j2]);
}
void push(ll i, ll j) {
  if (i < j) Que.push(Entry(min_range(i, j), i, j));
}
int main() {
  cin >> N;
  Min.resize(L);
  for (auto &min : Min) min.resize(N + 2);
  for (ll i = 0; i < N; ++i) {
    ll p;
    cin >> p;
    Min[0][i] = Data(p, i);
  }
  Min[0][N] = Min[0][N + 1] = Data(1ll << 60, -1);
  for (ll l = 1; l < L; ++l)
    for (ll i = 0; i < N + 2; ++i) {
      Min[l][i] = min(Min[l - 1][i],
                      Min[l - 1][i + min(1ll << l, (N + 1 - i) / 2 * 2)]);
    }
  push(0, N);
  bool first = true;
  while (!Que.empty()) {
    Data pk;
    ll i, j, p, k;
    tie(pk, i, j) = Que.top();
    tie(p, k) = pk;
    Que.pop();
    ll q, l;
    tie(q, l) = min_range(k + 1, j + 1);
    cout << (first ? "" : " ") << p << " " << q;
    first = false;
    push(k + 1, l);
    push(i, k);
    push(l + 1, j);
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 65520
#include <iostream>

using namespace std;

int main(){
  int N;
  cin >> N;
  int s = N, ans = 0;
  for (int i = 0; i < N; i++){
    int tmp;
    cin >> tmp;
    if (s >= tmp){
      s = tmp;
      ans++;
    }
  }

  printf("%d\n", ans);
  
}


Measured memory_bytes: 3728
// inputに入力データ全体が入る
 
function Main(input) {
	// 1行目がinput[0]
	input = input.split(" ");
	//文字列から10進数に変換するときはparseIntを使います
	var a = parseInt(input[0], 10);
	var b = parseInt(input[1], 10);
 　 var c = parseInt(input[2], 10);
  　var d = parseInt(input[3], 10);
    while (c>0 && a>0) {
        c=c-b;
      if (c<=0){
        break;
      }else{
        a=a-d
      }
    }
  if(a>0){
  console.log('Yes');
  }
  else {
  console.log('No');
  }
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 29516
# D - All Your Paths are Different Lengths

L = int(input())

N = 2
while 2**N-1 <= L-1:
    N += 1

edge = []
for i in range(1,N):
    edge.append([i,i+1,0])
    edge.append([i,i+1,2**(i-1)])

for i in reversed(range(1,N)):
    if L - 2**(i-1) > 2**(N-1) - 1:
        edge.append([i,N,L-2**(i-1)])
        L = L-2**(i-1)

print(N, len(edge))
for x in edge:
    print(*x)

Measured memory_bytes: 3064
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios::sync_with_stdio(false); cin.tie(0);
  int n;
  cin >> n;
  vector<int> d(n);
  for (int i = 0; i < n; i++) {
    cin >> d[i];
  }
  int m;
  cin >> m;
  map<int, int> mp;
  for (int i = 0; i < m; i++) {
    int x;
    cin >> x;
    mp[x]++;
  }
  for (int i = 0; i < n; i++) {
    mp[d[i]]--;
  }
  bool ok = true;
  for (auto i : mp) {
    ok &= i.second <= 0;
  }
  cout << (ok ? "YES" : "NO") << endl;
  return 0;	
}

Measured memory_bytes: 10368
#include <cstdio>
#include <utility>
using namespace std;

#define gcu getchar_unlocked
int in(int c){int n=0;bool m=false;if(c=='-')m=true,c=gcu();
	do{n=10*n+(c-'0'),c=gcu();}while(c>='0');return m?-n:n;}
int in() {return in(gcu());}
bool scan(int &n){int c=gcu();return c==EOF?false:(n=in(c),true);}
bool scan(char &c){c=gcu();gcu();return c!=EOF;}
//bool scan(string &s){int c;s="";
//	for(;;){c=gcu();if(c=='\n'||c==' ')return true;else if(c==EOF)return false;s+=c;}}
#define pcu putchar_unlocked
#define vo inline void out
template <typename T>
vo(T n){static char buf[20];char *p=buf;
	if(n<0)pcu('-'),n*=-1;if(!n)*p++='0';else while(n)*p++=n%10+'0',n/=10;
	while (p!=buf)pcu(*--p);}
vo(const char *s){while(*s)pcu(*s++);}
vo(char c){pcu(c);}
//vo(string &s){for (char c: s) pcu(c);}
template <typename head, typename... tail> vo(head&& h, tail&&... t){out(h);out(move(t)...);}
//template <typename T> vo(vector<T> &v){for(T &x:v)out(&x == &v[0]?"":" "),out(x);out('\n');}
#undef vo

int main() {
	for (int N, M, P; N = in(), M = in(), P = in(), N || M || P;) {
		int s = 0, x = 0, t;
		for (int i = 1; i <= N; i++) {
			s += t = in();
			if (i == M)
				x = t;
		}
		out(x ? s * (100 - P) / x : 0, '\n');
	}
}


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

int main()
{
	int ss;
	cin >> ss;
	string n;
	cin >> n;
	int sb = 1;
	if(n.size() & 1){
		cout << "No";
		return 0;
	}
	else{
		int sn = (n.size() >> 1);
		for(int i = 0; i < sn; i++){
			if(n[i] != n[sn + i]){
				sb = 0;
			}
		}
	}
	if(sb){
		cout << "Yes\n";
	}else{
		cout << "No\n";
	}
	
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> p2;
ll hell=pow(10,9)+7;
void solve(){
    ll n,m;
    cin>>n>>m;
    ll arr[n];
    for(ll i=0;i<n;i++)
    arr[i]=(-1);
    vector<p2> v;
    if(n==1&&m==0){
        cout<<0;
        return;
    }
    for(ll i=0;i<m;i++){
        ll x,y;
        cin>>x>>y;
        if(x>n){
            cout<<"-1";
            return;
        }
        arr[x-1]=y;
        v.push_back({x,y});
    }
    for(ll i=0;i<m;i++)
    if(arr[v[i].first-1]!=v[i].second){
        cout<<"-1";
        return;
    }
    if(n>1&&arr[0]==0){
        cout<<"-1";
        return;
    }
    if(arr[0]==(-1))
    arr[0]=1;
    for(ll i=0;i<n;i++)
    if(arr[i]==(-1))
    arr[i]=0;
    for(ll i=0;i<n;i++)
    cout<<arr[i];
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll t=1;
    for(ll qc=0;qc<t;qc++)
    solve();
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define _ ios_base::sync_with_stdio(0);cin.tie(0);
#define REP(i,n) for(int i=0;i<(int)(n);i++)

using namespace std;
typedef long double ld;
int main(){ _;
  ld n;cin>>n;
  for(int i=0;;i++){
    if(n<=1){
      cout<<i<<endl;
      break;
    }
    n/=3;
  }
}

Measured memory_bytes: 1224
#include<iostream>
#include<cstdio>
#define inf 0x3f3f3f3f
#define min(a,b) (a<b?a:b)
#define max(a,b) (a>b?a:b)
using namespace std;

//public
int n;
int mins=inf;
int mid;
long long ans=0;

//edge
struct edge{
	int to;
	int wi;
	int ne;
}e[200060];
int h[100001],cnt=0;
void add(int a,int b,int c) {
	e[++cnt]=(edge){b,c,h[a]};
	h[a]=cnt;
	return ;
}

//dfs
int dfs_time=0;
int in[100050],out[100050],son[100050],zhong[100050];
void dfs(int x,int fa,int w){
	in[x]=++dfs_time;
	int maxi=0;
	for(int i=h[x];i;i=e[i].ne) {
		int v=e[i].to;
		if(v==fa) continue;
		dfs(v,x,e[i].wi);
		son[x]+=son[v]+1;
		maxi=max(maxi,son[v]+1);
	}
	out[x]=dfs_time;
	int mini=min(out[x]-in[x]+1,n-out[x]+in[x]-1);
	ans+=(long long) mini*w*2;
	maxi=max(maxi,n-1-son[x]);
	zhong[x]=maxi;
	if(maxi<mins){
		mins=maxi;
		mid=x;
	}
	return ;
}

//main
int main(){
	int a,b,c;
	scanf("%d",&n);
	for(int i=1;i<n;++i) {
		scanf("%d%d%d",&a,&b,&c);
		add(a,b,c);
		add(b,a,c);
	}
	dfs(1,0,0);
	int lowe=0x3f3f3f3f;
	for(int i=h[mid];i;i=e[i].ne){
		int v=e[i].to;
		lowe=min(lowe,e[i].wi);
		if(zhong[v]==zhong[mid]){
			ans-=e[i].wi;
			printf("%lld\n",ans);
			return 0;
		}
	}
	printf("%lld\n",ans-lowe);
	return 0;
}

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

int main() {
  int h, w;
  cin >> h >> w;
  char cloud[h][w];
  int i, j;
  for (i = 0; i < h; i++) {
    for (j = 0; j < w; j++) {
      cin >> cloud[i][j];
    }
  }
  int result[h][w];
  for (i = 0; i < h; i++) {
    int index = -1;
    for (j = 0; j < w; j++) {
      if (cloud[i][j] == 'c') {
        index = j;
      }
      if (index == -1) {
        result[i][j] = -1;
      } else  {
        result[i][j] = j - index;
      }
    }
  }
  for (i = 0; i < h; i++) {
    for (j = 0; j < w; j++) {
      cout << result[i][j];
      if (j != w - 1) {
        cout << ' ';
      }
    }
    cout << endl;
  }
  return 0;
}



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

using namespace std;
#define ll long long
int main()
{		
	map< int, int > mp;
	int n;
	cin >> n;
	int cnt=0;
	int arr[n+1];
	for(int i=1; i<=n; i++){
		cin >> arr[i];
		mp[i] = arr[i];
	}
	for(int i=1; i<=n; i++) {
	 	if(mp[arr[i]]==i) cnt++;	
	}
	cout << cnt/2 << endl;
	return 0;
}

Measured memory_bytes: 8708
#include <iostream>
using namespace std;
int main(){
  int N,l;
  int i = 0;
  int a[100];
  cin >> N;
  
  int currentmax = 0;
  int ct = 0;
  
  while(cin>>l){
    a[i] = l;
    if (currentmax <= l){
      ct+=1;
      currentmax = l;
    }
    i++;
  }
  printf("%d",ct);
  return 0;
  
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long

const int N = 2e5 + 5;

int n, k, c;
char a[N];
int storeL[N], idxL[N];
int storeR[N], idxR[N];

int32_t main()
{
	IOS;
	cin >> n >> k >> c;
	for(int i = 1; i <= n; i++)
		cin >> a[i];
	int prv = -1e9, val = 0;
	for(int i = 1; i <= n; i++)
	{
		idxL[i] = prv;
		if(a[i] == 'x')
		{
			storeL[i] = val;
			continue;
		}
		if(i - prv > c)
		{
			val++;
			prv = i;
			storeL[i] = val;
		}
	}	
	prv = 1e9, val = 0;
	for(int i = n; i >= 1; i--)
	{
		idxR[i] = prv;
		if(a[i] == 'x')
		{
			storeR[i] = val;
			continue;
		}
		if(prv - i > c)
		{
			val++;
			prv = i;
			storeR[i] = val;
		}
	}
	vector<int> ans;
	for(int i = 1; i <= n; i++)
	{
		int l = idxL[i];
		int r = idxR[i];
		if(l == -1e9 && r == 1e9)
			ans.push_back(i);
		else if(l == -1e9)
		{
			if(storeR[r] < k)
				ans.push_back(i);
		}
		else if(r == 1e9)
		{
			if(storeL[l] < k)
				ans.push_back(i);
		}
		else
		{
			if(abs(r - l) > c)
			{
				if(storeL[l] + storeR[r] < k)
					ans.push_back(i);
			}
			else
			{
				if(storeL[l] + storeR[r] - 1 < k)
					ans.push_back(i);
			}
		}
	}
	for(auto &it:ans)
		cout << it << endl;
	return 0;
}

Measured memory_bytes: 9712
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); ++i)
#define fi first
#define se second
#define INF 1000000009
#define lINF 1000000000000000009
using ll = long long;

int main(){
  double l;
  cin>>l;
  double a=l/3;
  printf("%.10f\n",a*a*a);
  return(0);
}


Measured memory_bytes: 256
r,c = map(int,input().split())

hyo = [list(map(int,input().split())) for _ in range(r)]

for i in range(r):
    hyo[i].append(sum(hyo[i]))

l = []
x = 0
for j in range(c):
    x = 0
    for k in range(r) :
        x += hyo[k][j]
    l.append(x)
l.append(sum(l))

for i in range(r):
    print(*hyo[i])
print(*l)



Measured memory_bytes: 6232
#include <cmath>
#include <cstdio>
#include <cstring>
#include <vector>
typedef long long lld;
const int MAXN = 5e5+5;
std::vector<int> runs;
char S[MAXN];
int N;

void flush(int& cnt) {
    runs.push_back(cnt);
    cnt = 0;
}

lld sum(int x) {
    return 1LL * x * (x + 1) / 2;
}

int main() {
    scanf("%s", S);
    N = strlen(S);
    if (S[0] == '>') {
        runs.push_back(0);
    }
    int cnt = 1;
    for (int i = 1; i < N; ++i) {
        if (S[i] != S[i-1]) {
            flush(cnt);
        }
        ++cnt;
    }
    flush(cnt);
    if (S[N-1] == '<') {
        runs.push_back(0);
    }
    int R = runs.size();
    lld ret = 0LL;
    for (int i = 1; i < R; i += 2) {
        int a = runs[i-1];
        int b = runs[i];
        ret += sum(a) + sum(b) - std::min(a, b);
    }
    printf("%lld\n", ret);
    return 0;
}

Measured memory_bytes: 1912
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
// Welcome to my source code!

int main() {
    ll n, k;
    cin >> n >> k;
    ll ans = 0;
    if (k & 1) {
        ll t = n / k;
        t = pow(t, 3);
        ans = t;
    } else {
        ll t = n / k;
        ll t2 = n / (k / 2);
        t2 = (t2 + 1) / 2;
        ans = pow(t, 3) + pow(t2, 3);
    }
    cout << ans << endl;
}

Measured memory_bytes: 384
N=int(input())

A=[]
test = []
for i in range(N):
    A_i= int(input())
    A.append(A_i)
    testimony_i=[]
    for j in range(A_i):
        x,y= map(int,input().split())

        testimony_i.append([x,y])
    
    test.append(testimony_i)
    
total=0
for i in range(2**N):

    member = format(i,'0{}b'.format(N))

    flg = 0

    for j in range(N):
        if member[j]== '1':

            syogen = test[j]

            for s in syogen:
                if member[s[0]-1]==str(s[1]):
                    continue
                else:
                    flg+=1

    if flg ==0:
        total = max(total , member.count('1')) 

print(total)

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

int main(){
  string s,t; cin >> s >> t;
  ll a, b; cin >> a >> b;
  string u; cin >> u;
  if(u==s) a--;
  if(u==t) b--;
  cout << a << ' ' << b;
}

Measured memory_bytes: 256
#include<cstdio>
int abs(int x) { return x > 0 ? x : -x; }
int main() {
	int a, b, n;
	scanf("%d%d%d", &n, &a, &b);
	int r = abs(a - b);
	if (r % 2 == 0) printf("Alice\n");
	if (r % 2 == 1) printf("Borys\n");
	return 0;
}

Measured memory_bytes: 128
//104
#include <iostream>
#include <bits/stdc++.h>
#include <string>
#include <math.h>
#include <vector>
#include <algorithm>
using namespace std;
//a
int main(){
    int r; cin>>r;
    if(r<1200) cout<<"ABC"<<endl;
    else if(r<2800) cout<<"ARC"<<endl;
    else cout<<"AGC"<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main (){
	int a,b,c,d;
	int hasil;
	scanf ("%d %d %d %d",&a,&b,&c,&d);
	
	if ((a+b)>(c+d)){
		printf ("Left\n");
	}
	else if ((a+b)<(c+d)){
		printf ("Right\n");
	}else if ((a+b)==(c+d)){
		printf ("Balanced\n");
	}
}

Measured memory_bytes: 128
#include<iostream>
#include<cstdio>
#define ll long long
using namespace std;
int main()
{
    ll x;
    cin>>x;
    ll q = x / 500;
    ll r = x % 500;
    ll Q = r /5;
    ll ans = (q * 1000) + (Q * 5);
    printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 256
/*
このコード、と～おれ!
Be accepted!
∧＿∧　
（｡･ω･｡)つ━☆・*。
⊂　　 ノ 　　　・゜+.
　しーＪ　　　°。+ *´¨)
 　　　　　　　　　.· ´¸.·*´¨) ¸.·*¨)
		  　　　　　　　　　　(¸.·´ (¸.·'* ☆
					*/

#include <stdio.h>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstring>
#include <vector>
#include <numeric>
#include <iostream>
#include <random>
#include <map>
#include <unordered_map>
#include <queue>
#include <regex>
#include <functional>
#include <complex>
#include <list>
/*多倍長整数/cpp_intで宣言
#include <boost/multiprecision/cpp_int.hpp>

using namespace boost::multiprecision;
*/

//#pragma GCC target ("avx2")
//#pragma GCC optimization ("O3")
//#pragma GCC optimization ("unroll-loops")
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define rep1(i, n) for(int i = 1; i <= (n); ++i)
#define rep2(i, n) for(int i = 2; i < (n); ++i)
#define repr(i, n) for(int i = n; i >= 0; --i)
#define reprm(i, n) for(int i = n - 1; i >= 0; --i)
#define printynl(a) printf(a ? "yes\n" : "no\n")
#define printyn(a) printf(a ? "Yes\n" : "No\n")
#define printYN(a) printf(a ? "YES\n" : "NO\n")
#define printin(a) printf(a ? "possible\n" : "inposible\n")
#define printdb(a) printf("%.50lf\n", a)//少数出力
#define printdbd(a) printf("%.16lf\n", a)//少数出力(桁少なめ)
#define prints(s) printf("%s\n", s.c_str())//string出力
#define all(x) (x).begin(), (x).end()
#define allsum(a, b, c) ((a + b) * c / 2)//等差数列の和、初項,末項,項数
#define pb push_back
#define priq priority_queue
#define rpriq priq<int, vector<int>, greater<int>>
#define deg_to_rad(deg) (((deg)/360.0)*2.0*PI)
#define rad_to_deg(rad) (((rad)/2.0/PI)*360.0)
#define Please return
#define AC 0
#define addf(T) [](T a, T b){return (a + b);}
#define minf(T) [](T a, T b){return min(a, b);}
#define maxf(T) [](T a, T b){return max(a, b);}


using ll = long long;

constexpr int INF = 1073741823;
constexpr int MINF = -1073741823;
constexpr ll LINF = ll(4661686018427387903);
constexpr ll MOD = 1000000007;
const long double PI = acos(-1.0L);

using namespace std;

void scans(string& str) {
	char c;
	str = "";
	scanf("%c", &c);
	if (c == '\n')scanf("%c", &c);//最初の改行対策
	while (c != '\n' && c != -1) {
		str += c;
		scanf("%c", &c);
	}
}

void scanc(char& str) {
	char c;
	scanf("%c", &c);
	if (c == -1)return;
	while (c == '\n') {
		scanf("%c", &c);
	}
	str = c;
}

double acot(double x) {
	return PI / 2 - atan(x);
}

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

ll lcm(ll number1, ll number2) {//lcmを求める
	return number1 / gcd(number1, number2) * number2;
}

ll LSB(ll n) { return (n & (-n)); }

/*-----------------------------------------ここからコード-----------------------------------------*/



int main() {

	int n, m;
	scanf("%d", &n);
	scanf("%d", &m);
	printyn(n == m);

	Please AC;
}


Measured memory_bytes: 888
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        n: usize,
        k: usize,
        h: [isize; n],
    }
    let mut h = h;
    h.sort();
    h.reverse();
    let ans: isize = h.iter().skip(k).sum();
    println!("{}", ans);
}


Measured memory_bytes: 9464
#include <string>
#include <stack>
#include <iostream>
#include <cstdlib>
using namespace std;
int main() 
{
    string word;
    stack<int> S;
    while (cin >> word) 
    { 
        if (word == "+") 
        {
            int a,b;
            a=S.top();
            S.pop();
            b=S.top();
            S.pop();
            S.push(a+b);
        }
        else if (word == "-") 
        {
            int a,b;
            a=S.top();
            S.pop();
            b=S.top();
            S.pop();
            S.push(b-a);
        }
        else if (word == "*") 
        {
            int a,b;
            a=S.top();
            S.pop();
            b=S.top();
            S.pop();
            S.push(a*b);
        }
        else
        {
            S.push(atoi(word.c_str()));
        }
    }
    cout<<S.top()<<endl;
}

Measured memory_bytes: 3184
n = int(input())
l = list(map(int, input().split()))
#print(n,l)
x = 0
for i in range(0,n-1):
    for j in range(i,n):
        #print(abs(l[i] - l[j]))
        x = max(abs(l[i] - l[j]), x)
print(x)





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

using namespace std;

int main()
{
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    if(abs(a-c)<=d||(abs(a-b)<=d&&abs(b-c)<=d))
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;
    return 0;
}


Measured memory_bytes: 256