akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;

void solve() {
    int n;
    string s;
    cin >> n >> s;

    vector<int> r, w;
    rep(i, n) {
        if (s[i] == 'R') {
            r.push_back(i);
        } else {
            w.push_back(i);
        }
    }

    if (r.size() == 0 || r.size() == n) {
        cout << 0 << endl;
        return;
    }

    int ans = 0;
    int ri = r.size() - 1, wi = 0;
    while (ri >= 0 && wi < w.size() && w[wi] < r[ri]) {
        ans++;
        ri--;
        wi++;
    }
    cout << ans << endl;
}

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


Measured memory_bytes: 4656
import sys
import math
from copy import deepcopy
from collections import deque, defaultdict
from operator import mul
from functools import reduce
sys.setrecursionlimit(20000000)

# input = sys.stdin.readline


def main():
    N = int(input())
    S = input()

    pre = ''
    ans = 0

    for s in S:
        if s != pre:
            ans += 1

        pre = s

    print(ans)


if __name__ == '__main__':
    main()
    

Measured memory_bytes: 3956
s=input()
a=l=0
r=len(s)-1
while l<r:
  if s[l]=="x":
    if s[r]=="x":
      l+=1
      r-=1
    else:
      a+=1
      l+=1
  else:
    if s[r]=="x":
      a+=1
      r-=1
    else:
      if s[l]==s[r]:
        l+=1
        r-=1
      else:
        print(-1)
        exit()
print(a)

Measured memory_bytes: 3316
import java.util.Scanner;
import static java.lang.System.out;

class Collision {
    public static boolean isOutCircleFromRect( int w, int h, int cx, int cy, int cr ) {
        return !(((cx - cr) >= 0) && ((cx + cr) <= w) &&
            ((cy - cr) >= 0) && ((cy + cr) <= h));
    }
}

public class Main {
    public static void main( String... args ) {
        // scan
        Scanner scan = new Scanner( System.in);

        int w = scan.nextInt();
        int h = scan.nextInt();
        int x = scan.nextInt();
        int y = scan.nextInt();
        int r = scan.nextInt();

        out.println(Collision.isOutCircleFromRect(w, h, x, y, r) ? "No" : "Yes");

    }
}

Measured memory_bytes: 26220
def main():
  N, Y = map(int, input().split())
  for i in range(max(Y // 10000, N)+1):
    for j in range(max((Y - 10000 * i) // 5000, N-i)+1):
      if Y - 10000 * i - 5000 * j == 1000 * (N - i - j):
        return i, j, N-i-j
  return -1, -1, -1

L = main()
print(L[0], L[1], L[2])

Measured memory_bytes: 3188
//
/*==========================================================*/
/*    Template ver 2017-0720    |    Created by JollyBee    */
/* DOMINUS pascit me, et nihil mihi deerit (Psalmorum 23:1) */
/*==========================================================*/
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vii;
const double EPS=(double)1e-9;
const double PI=(double)acos(-1.0);
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define pob pop_back
#define pf push_front
#define pof pop_front
#define FOR(i,n) for(int i=0;i<n;i++)
#define REPP(i,l,r,c) for(int i=l;i<=r;i+=c)
#define REP(i,l,r) REPP(i,l,r,1)
#define FORD(i,n) for(int i=n-1;i>=0;i--)
#define REVV(i,l,r,c) for(int i=l;i>=r;i-=c)
#define REV(i,l,r) REVV(i,l,r,1)
//random
int irand(int lo, int hi){
    return (((double)rand())/(RAND_MAX+1.0)) * (hi-lo+1) + lo;
}
//ll to string
string toString(ll x) {
    stringstream ss;
    ss << x;
    return ss.str();
}
//string to ll
ll toNumber(string S) {
    ll ret;
    sscanf(S.c_str(),"%lld",&ret);
    return ret;
}
// std::fill(start, end, value);
// for(auto it: DS){}

const int INF=(int)2e9;
const ll MOD=(ll)1e9+7;
/*==========================================================*/
/*                     END OF TEMPLATE                      */
/* DOMINUS pascit me, et nihil mihi deerit (Psalmorum 23:1) */
/*==========================================================*/

char s[15];

int main(){
    scanf("%s", s);
    //
    string res = "";
    for(int i=0; s[i]; i++) {
        if(s[i] == 'B'){
            if(!res.empty()) res.pob();
        } else {
            res += s[i];
        }
    }
    puts(res.c_str());
    return 0;
}


Measured memory_bytes: 256
n = int(input())
a_lst = list(map(int, input().split()))
a_lst.sort()

if a_lst[0] == 0:
    answer = 0
else:
    answer = 1
    for i in range(n):
        a = a_lst[i]
        answer *= a

        if answer > 10 ** 18:
            answer = -1
            break

print(answer)

Measured memory_bytes: 21452
#include<bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define int long long int 
int dp[100100][3];
vector<vector<int>> g;
int solve(int u,int col,int parent)
{  if(dp[u][col]!=-1)
    {return dp[u][col];}

    int var=1;

for(int i=1;i<g[u].size();i++)
    { int v=g[u][i];
        if(v!=parent)
        {  int temp=0;
              if(col==1)
            { temp+=(solve(v,1,u)%mod);
            temp=temp%mod;
                temp+=(solve(v,2,u)%mod);
                 temp=temp%mod;
            }
            else
            {
                 temp+=(solve(v,1,u)%mod);
                  temp=temp%mod;
            }
            var=var%mod;
            var=var*temp;
            var=var%mod;
        }
    }


    dp[u][col]=var;
    return var;
}

signed main()
{ int n;
  cin>>n;
  vector<int> g1;
  g1.push_back(-1);
  for(int i=0;i<=n;i++)
    {g.push_back(g1);}

    int u,v;
  for(int i=1;i<n;i++)
    { cin>>u>>v;
        g[u].push_back(v);
        g[v].push_back(u);
    }
    memset(dp,-1,sizeof(dp));
    int ans=0;

    ans+=solve(1,1,-1);
    ans=ans%mod;
   // memset(dp,-1,sizeof(dp));
    ans+=solve(1,2,-1);
    ans=ans%mod;

    cout<<ans;
}


Measured memory_bytes: 21936
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define fi first
#define se second
#define pb push_back
#define pr pair<int,int>
#define mod 1000000007
#define endl "\n"

int power(int a,int b,int m=mod)
{
	if(b==0)	return 1;
	if(b==1)	return a;
	int res=power(a,b/2,m);
	res=(res*res)%m;
	if(b&1)	res=(res*a)%m;
	return res;
}

int modinv(int a){ return power(a,mod-2);}

void solve()
{
	int n,i;
	cin>>n;
	string s[n];
	set<string> s1;
	for(i=0;i<n;i++)
	{
		cin>>s[i];
		s1.insert(s[i]);
	}
	cout<<s1.size()<<endl;
}

int32_t main()
{
	ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
	int t=1;//cin>>t;
	while(t--)	solve();
	return 0;
}

Measured memory_bytes: 25496
#include <iostream>
#include <vector>
using namespace std;
int main(){
  int n,m;
  cin >> n >> m;
  vector<pair<int,int>> boxes(n);
  boxes[0] = make_pair(1,1);
  for(int i=1;i<n;i++){
    boxes[i] = make_pair(0,1);
  }

  for(int i=0;i<m;i++){
    int x,y;
    cin >> x >> y;
    x--;
    y--;

    if(boxes[x].first == 1){
      boxes[y].first = 1;
    }
    if(boxes[x].second > 0){
      boxes[y].second++;
      boxes[x].second--;
    }
    if(boxes[x].second == 0){
      boxes[x].first = 0;
    }
  }

  int cnt = 0;
  for(int i=0;i<n;i++){
    cnt += boxes[i].first;
  }

  cout << cnt << endl;
}


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

int N, K;
int D[110];
int A[110][110];
int sunuke[110] = { 0 };
int res = 0;

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

  for(int i = 1; i <= K; i++){
    cin >> D[i];
    for(int j = 1; j <= D[i]; j++){ cin >> A[i][j]; sunuke[A[i][j]] += 1; }
  }

  for(int i = 1; i <= N; i++){ if(sunuke[i] == 0) ++res; }

  cout << res << endl;
  return 0;
}

Measured memory_bytes: 3676
#include<bits/stdc++.h>
#define rep(i,n) for(int (i) = 0;(i) < (n);(i)++)
#define SORT(c) sort((c).begin(),(c).end())
#define INF 1000000007
//S.size()

using namespace std;


typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<char> VC;
typedef vector<bool> VB;
typedef unsigned long long ll;



int main(void){
  int N;
  string S; cin>>N>>S;

  int ans = 0,cnt = 0;

  for(int i = 0;i <= N - 2;i++){
    cnt = 0;
    for(int c = 'a' ;c <= 'z';c++){
      bool left = false,right = false;

      for(int j = 0;j <= i;j++){
        if(S[j] == c)left = true;
      }
      for(int k = i + 1;k <= N - 1;k++){
        if(S[k] == c)right = true;
      }
      if(left && right)cnt++;
    }
    if(cnt >= ans)ans = cnt;


  }
  cout<<ans;
}


Measured memory_bytes: 256
a={}
h,w,n=map(int,input().split())
for i in range(n):
  y,x=map(int,input().split())
  for j in range(max(2,x-1),min(w-1,x+1)+1):
    for k in range(max(2,y-1),min(h-1,y+1)+1):
      if j*(10**10)+k in a:
        a[j*(10**10)+k]+=1
      else:
        a[j*(10**10)+k]=1
ans=[0]*10
ans[0]=(h-2)*(w-2)
for key in a:
  ans[0]-=1
  ans[a[key]]+=1
for i in ans:
  print(i)

Measured memory_bytes: 138484
#include <algorithm>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
#define U(v) cerr << #v << ": " << (v) << endl

int main() {
    string s;
    cin >> s;
    for (int i = 0; i < 16; ++i) {
        string t = ((i >> 0) & 1 ? "A" : "") + string("KIH") +
            ((i >> 1) & 1 ? "A" : "") + "B" +
            ((i >> 2) & 1 ? "A" : "") + "R" +
            ((i >> 3) & 1 ? "A" : "");
        if (s == t) {
            cout << "YES" << endl;
            return 0;
        }
    }
    cout << "NO" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <queue>
#include <iostream>
#include <string>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <bitset>
#include <stack>
using namespace std;

#define REP(i,n) for ( int i=1; i<=int(n); i++ )  
#define MP make_pair
#define PB push_back
#define SZ(x) (int((x).size()))
#define ALL(x) (x).begin(), (x).end()
#define X first
#define Y second
template<typename T> inline bool chkmin(T &a, const T &b) { return a > b ? a = b, 1 : 0; }
template<typename T> inline bool chkmax(T &a, const T &b) { return a < b ? a = b, 1 : 0; }

typedef long long LL;
typedef pair<LL, int> pii;
typedef long double LD;
const int INF = 0x3f3f3f3f;

const int N = 1e6 + 100;
vector<int> from[N], res;
int val[N];
queue<int> que;
int deg[N], ans[N];

void updatewin(int u) {
	for(auto v : from[u]) {
		if(ans[v] != -1) continue;
		if(val[v] > val[u]) {
			deg[v] --;
			if(deg[v] == 0) que.push(v);
		}
	}
}

void updatefail(int u) {
	for(auto v : from[u]) {
		if(ans[v] != -1) continue;
		if(val[v] > val[u]) {
			ans[v] = 1; 
			updatewin(v);	
		}
	}
}

int main() {
	memset(ans, -1, sizeof(ans));
	int n;
	cin >> n;
	for(int i = 1; i <= n; i ++) scanf("%d", &val[i]);	
	for(int i = 1; i < n; i ++) {
		int u, v;
		scanf("%d %d", &u, &v);
		if(val[u] < val[v]) {
			from[u].push_back(v);
		    deg[v] ++;
        }
		if(val[u] > val[v]) {
			from[v].push_back(u);
            deg[u] ++;
		}	
	}
	for(int u = 1; u <= n; u ++) {
		if(deg[u] == 0) que.push(u);
    }
	while(! que.empty() ) {
		int u = que.front();
		que.pop();
		ans[u] = 0;
		updatefail(u);
	}

	for(int i = 1; i <= n; i ++) 
		if(ans[i] == 1) res.push_back(i);
	for(int i = 0; i < SZ(res); i ++) 
		printf("%d%c", res[i], i == SZ(res) - 1 ? '\n' : ' ');

}


Measured memory_bytes: 31360
#include<math.h>
#include<limits.h>
#include<iostream>
#include<string>
#include<vector>
#include<stdio.h>
#include<sstream>
#include<list>
#include<queue>
#include<algorithm>
#include<functional>
#include<map>
#include<set>
#include<utility>
#include<initializer_list>
#include<tuple>
#include<regex>
using namespace std;
#define ull unsigned long long
#define ll long long
#define rep(i, n) for(int i=0;i<(int)(n);i++)
#define all(t) t.begin(), t.end()
#define mat(type, row, col, init) vector<vector<type>>(row, vector<type>(col, init));

int main() {
	int n, m;
	cin >> n >> m;
	int lim = 200001;
	vector<bool>one(200001, 0), enu(200001, 0);
	rep(i, m) {
		int a, b;
		cin >> a >> b;
		if (a > b)swap(a, b);
		if (a == 1) one[b] = 1;
		else if (b == n)enu[a] = 1;
	}
	rep(i, lim) {
		if (one[i] && enu[i]) {
			cout << "POSSIBLE";
			return 0;
		}
	}
	cout << "IMPOSSIBLE";



	return 0;
}





Measured memory_bytes: 256
import java.io.PrintWriter;
import java.util.Scanner;

public class Main {

    static String br = System.getProperty("line.separator");
    static Scanner sc = new Scanner(System.in);
    static PrintWriter out = new PrintWriter(System.out);

    public static void main(String[] args) {
        int N = nextInt();
        int[] A = new int[N];

        int[] Answer = new int[N];

        for(int i=0; i<N; i++){
            A[i] = nextInt();
        }

        int num = 0;

        for (int i=0; i<N; i++) {
        	num = A[i];
        	Answer[num - 1] = i + 1;
        }

        for (int i = 0; i<N; i++) {
        	println(Answer[i] + " ");
        }
    }

    static int nextInt() {
        return Integer.parseInt(next());
    }

    static Long nextLong() {
        return Long.parseLong(next());
    }

    static String next() {
        return sc.next();
    }

    static String nextLine(){
        return sc.nextLine();
    }

    static void println(Object o) {
        out.println(o);
        out.flush();
    }

    static void print(Object o) {
        PrintWriter out = new PrintWriter(System.out);
        out.print(o);
        out.flush();
    }
}

Measured memory_bytes: 51964
#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll N,S,t;
inline long long read()
{
    long long s=0,f=1; char ch; for(;ch<'0'||ch>'9';ch=getchar()) if(ch=='-') f=-1;
    for(;ch>='0'&&ch<='9';ch=getchar()) s=(s<<3)+(s<<1)+ch-'0'; return s*f;
}
void Input()
{
    N=read(),S=read(); t=sqrt(N);
    if(N==S) {printf("%lld\n",N+1);exit(0);}
}
ll f(ll b,ll n){return (n<b)?n:(ll)(f(b,n/b)+n%b);}
void Solution()
{
    Input();
    // 2<=b<=sqrt(n)
    for(ll B=2;B<=t;++B)
    {
        if(f(B*1LL,N)==S)
        {
            printf("%lld\n",B); exit(0);
        }
    }
    ll ans=LONG_LONG_MAX;
    for(ll p=1;p<=sqrt(N-S);++p)
    {
        if((N-S)%p==0)
        {
            ll B=(N-S)/p+1;
            if(f(B,N)==S) ans=min(ans,B);
        }
    }
    printf("%lld\n",(ans==LONG_LONG_MAX)?-1:ans); exit(0);
}
int main()
{
    Solution();
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define x first
#define y second
using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll MAX=5005;
const ll INF=0x3f3f3f3f3f3f3f;
const ll MOD=1000000007;
int a,b,n,ans[MAX];
struct inc{
    int x,cnt;
    bitset<MAX> el;
};
deque<inc> range;
deque<inc> range2;
inc ult;
int scan(){
    char tmp;
    if(range.size()==0) return 0;
    if(range.size()==1){
        if(ult.x>=0) range2.push_back(ult);
        ult=range.front();
        range.pop_front();
        return 0;
    }
    inc t1,t2;
    t1=range.front(),range.pop_front(),t2=range.front();
    if(t1.cnt<t2.cnt){
        if(ult.x>=0) range2.push_back(ult);
        ult=t1; return 1;
    }
    range.pop_front();
    printf("? %d %d\n",t1.x,t2.x);
    fflush(stdout);
    scanf(" %c",&tmp);
    if(tmp=='Y'){
        printf("? %d %d\n",t2.x,t1.x);
        fflush(stdout);
        scanf(" %c",&tmp);
        if(tmp=='Y') {
            t1.cnt+=t2.cnt,t1.el=t1.el|t2.el;
            range.push_back(t1);
        }
        else{
            range.push_front(t2);
        }
    }
    else{
        range2.push_back(t1),range2.push_back(t2);
    }
}
int deter(){
    char tmp;
    if(range2.size()==0) return 0;
    inc t1=range2.front();
    range2.pop_front();
    printf("? %d %d\n",ult.x,t1.x);
    fflush(stdout);
    scanf(" %c",&tmp);
    if(tmp=='Y'){
        for(int i=0;i<n;i++) if(t1.el[i]) ans[i]=1;
    }
    return 1;
}
int main(){
    ult.x=-1;
    scanf("%d%d",&a,&b);
    if(a<=b){
        printf("Impossible\n");
        return 0;
    }
    n=a+b;
    for(int i=0;i<n;i++) {
        inc tmp;
        tmp.el.reset();
        tmp.el[i]=1,tmp.x=i,tmp.cnt=1;
        range.push_back(tmp);
    }
    while(scan());
    for(int i=0;i<n;i++) if(ult.el[i]) ans[i]=1;
    while(deter());
    printf("! ");
    for(int i=0;i<n;i++) printf("%d",ans[i]);
    printf("\n");
    fflush(stdout);
    return 0;
}


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

int main(){
    int x;
  cin>>x;
  vector<int> v;
  for(int i=2; i<35; i++){
    int k=i*i;
    while(k<=1200){
      v.push_back(k);
      k *=i;
    }
  }
  v.push_back(1);
  sort(v.begin(), v.end());
  int ans=v[0];
  for(int i=0;;i++){
    if(v[i]>x) break;
    ans=v[i];
  }
cout<<ans<<endl;
}

Measured memory_bytes: 3616
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using pint = pair<int,  int>;
using pll = pair<ll, ll>;
using edge = pair<int, ll>;
using Graph = vector<vector<int>>; 
using WeightedGraph = vector<vector<edge>>;
const ll INF = 1LL << 60;
const int INF32 = 1 << 29;
const ll MOD = 1000000007;

int main(){
string a,x,c;
cin >> a >> x>> c;
cout << a[0] << x[0]  << c[0]<< endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(final String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int a = n / 500;
		int b = n % 500 / 5;
		long r = a * 1000 + b * 5;
		System.out.println(r);
	}
}


Measured memory_bytes: 22612
#include<bits/stdc++.h>
#define maxn 200001
using namespace std;
int main()
{
	int n;
	int num=0,flag=0;
	cin>>n;
	for (int i=1;i<=n;i++)
	{
		int x,y;
		cin>>x>>y;
		if (x==y) num++;
		else num=0;
		if (num>=3) flag=1;
	}
	if (flag) cout<<"Yes"<<endl; else cout<<"No"<<endl;
}

Measured memory_bytes: 3588
#include <bits/stdc++.h>
#include <iostream>
#include <queue>
#include <stack>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <random>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define repp(i,n,m) for (int i = m; i < (n); ++i)
#define repl(i,n) for (long long i = 0; i < (n); ++i)
#define reppl(i,n,m) for (long long i = m; i < (n); ++i)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using PL = pair<long long, long long>;
using Pxy = pair<double, double>;
using T = tuple<int, int, bool>;
const int INF = 1001001007;
const int mod = 1000000007;
const int MOD = 998244353;
const ll inf = 1e18;
template <typename AT>
void printvec(vector<AT> &ar){
    rep(i,ar.size()-1) cout << ar[i] << " ";
    cout << ar[ar.size()-1] << endl;
}
template <typename Q>
void printvvec(vector<vector<Q>> &ar){
    rep(i,ar.size()){
        rep(j,ar[0].size()-1) cout << ar[i][j] << " ";
        cout << ar[i][ar[0].size()-1] << endl;
    }
}
template <typename S>
bool range(S a, S b, S x){
    return (a <= x && x < b);
}

struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};

mint f(int n) {
  if (n == 0) return 1;
  mint x = f(n/2);
  x *= x;
  if (n%2 == 1) x *= 2;
  return x;
}

mint choose(int n, int a) {
  mint x = 1, y = 1;
  rep(i,a) {
    x *= n-i;
    y *= i+1;
  }
  return x / y;
}

ll gcd (ll a, ll b){
    ll k = a % b;
    while (k > 0){
        a = b;
        b = k;
        k = a % b;
    }
    return b;
}

int main() {
    int d; cin >> d;
    vector<int> ar(26);
    rep(i,26) cin >> ar[i];
    vector<int> ans(d);
    rep(i,d){
        int ma = -1;
        int as = 0;
        rep(j,26){
            int a; cin >> a;
            if (ma < a){
                ma = a;
                as = j+1;
            }
        }
        ans[i] = as;
    }
    rep(i,d) cout << ans[i] << endl;
}

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

#define rep(i,n) for(long long i = 0; i < (long long)(n); i++)
#define repi(i,a,b) for(long long i = (long long)(a); i < (long long)(b); i++)
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define fi first
#define se second
#define mt make_tuple
#define mp make_pair
template<class T1, class T2> bool chmin(T1 &a, T2 b) { return b < a && (a = b, true); }
template<class T1, class T2> bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }

using ll = long long; using vll = vector<ll>; using vvll = vector<vll>; using P = pair<ll, ll>;
using ld = long double;  using vld = vector<ld>; 

int main(void) {
	/*
    string s(9, ' ');
	rep(i,9)  cin >>s[i];
	
	cout<<s[0]<<s[4]<<s[8]<<endl;
	*/
	string s;
	rep(i, 9) {
		char c; cin >> c;
		s += c;
	}
	cout<<s[0]<<s[4]<<s[8]<<endl;
	
	
    return 0;
}

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

#define MAX 200002
int n;

vector<pair<int, int> > vv;

vector<int> ar;
vector<int> im;

vector<pair<int, int> > rng;
#define MOD 1000000007



long long int seg[MAX * 4];

long long int lazy[MAX * 4];
void update(int b){
	seg[b] *= lazy[b];
	if (seg[b] >= MOD){
		seg[b] %= MOD;
	}
	if (b * 2 + 2 < MAX * 4){
		lazy[b * 2 + 1] *= lazy[b];
		lazy[b * 2 + 2] *= lazy[b];
		if (lazy[b * 2 + 1] >= MOD){
			lazy[b * 2 + 1] %= MOD;
		}
		if (lazy[b * 2 + 2] >= MOD){
			lazy[b * 2 + 2] %= MOD;
		}
	}
	lazy[b] = 1;
}
inline void mul(int b, int l, int r, int ll, int rr){
	if (ll >= rr)return;
	update(b);
	if (r <= ll || rr <= l){
		return;
	}
	if (ll <= l&&r <= rr){
		lazy[b] *= 2LL;
		if (lazy[b] >= MOD)lazy[b] %= MOD;
		update(b);
		return;
	}
	mul(b * 2 + 1, l, (l + r) >> 1, ll, rr);
	mul(b * 2 + 2, (l + r) >> 1, r, ll, rr);
	seg[b] = seg[b * 2 + 1] + seg[b * 2 + 2];
}
inline long long int query(int b, int l, int r, int ll, int rr){
	if (ll >= rr)return 0;
	update(b);
	if (r <= ll || rr <= l){
		return 0;
	}
	if (ll <= l&&r <= rr){
		return seg[b];
	}
	return query(b * 2 + 1, l, (l + r) >> 1, ll, rr) + query(b * 2 + 2, (l + r) >> 1, r, ll, rr);
}
inline void add(int b, int l, int r, int ll,long long int x){
	update(b);
	if (l <= ll&&ll < r){
		if (l + 1 == r){
			seg[b] += x;
			if (seg[b] >= MOD)seg[b] %= MOD;
			return;
		}
		add(b * 2 + 1, l, (l + r) >> 1, ll, x);
		add(b * 2 + 2, (l + r) >> 1, r, ll, x);
		seg[b] = seg[b * 2 + 1] + seg[b * 2 + 2];
	}
}
vector<int> vvv;
int main(){
	fill(lazy, lazy + MAX * 4, 1);
	cin >> n;
	for (int i = 0; i < n; i++){
		int x, v;
		scanf("%d%d", &x, &v);
		vv.push_back(make_pair(x, v));
		vvv.push_back(v);
	}
	sort(vvv.begin(), vvv.end());
	vvv.erase(unique(vvv.begin(), vvv.end()), vvv.end());
	sort(vv.begin(), vv.end());
	int mx = -1;
	for (int i = 0; i < vv.size(); i++){
		vv[i].second = lower_bound(vvv.begin(), vvv.end(), vv[i].second) - vvv.begin();
		ar.push_back(vv[i].second);
		mx = max(mx, vv[i].second);
		im.push_back(mx);
	}
	for (int i = (int)(ar.size()) - 2; i >= 0; i--){
		ar[i] = min(ar[i], ar[i + 1]);
	}
	for (int i = 0; i < vv.size(); i++){
		rng.push_back(make_pair(ar[i], im[i]));
	}
	sort(rng.begin(), rng.end());
	add(0, 0, n + 1, 0, 1);
	for (int i = 0; i < rng.size(); i++){
		long long int way = query(0, 0, n+1, rng[i].first, rng[i].second+1);
		mul(0, 0, n+1, rng[i].second + 1, n+1);
		add(0, 0, n+1, rng[i].second+1, way);
	}
	long long int ans = query(0, 0, n+1, vvv.size(), vvv.size() + 1);
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 19568
//#define _CRT_SECURE_NO_WARNINGS
#include "bits/stdc++.h"

#define rep(i,n) for(ll (i)=0;(i)<(ll)(n);(i)++)
#define all(x) (x).begin(),(x).end()
#define MOD 1000000007LL
#define INF (1LL<<60LL)
#define int long long
#define MAX_N (100001)
typedef long long ll;

using namespace std;


signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int h, w; cin >> h >> w;
	vector<string> s(h);
	rep(i, h)cin >> s[i];
	vector<vector<int>> v(h, vector<int>(w, 0));
	rep(r, h + w - 1) {
		for (int i = 0; i <= r; i++) {
			bool up = true;
			int j = r - i;
			if (h <= i || w <= j) continue;
			if (i == 0 && j == 0) v[i][j] = 0;
			else if (i == 0) {
				v[i][j] = v[i][j - 1];
				if (s[i][j - 1] == '#')  up=false;
			}
			else if (j == 0) {
				v[i][j] = v[i - 1][j];
				if (s[i - 1][j] == '#')  up=false;
			}
			else {
				v[i][j] = min(v[i - 1][j], v[i][j - 1]);
				if (v[i - 1][j] == v[i][j - 1]) {
					if (s[i - 1][j] == '#' || s[i][j - 1] == '#') up=false;
				}
				if (v[i - 1][j] < v[i][j - 1])
					if (s[i - 1][j] == '#')  up = false;
				if (v[i - 1][j] > v[i][j - 1])
					if (s[i][j - 1] == '#')  up = false;
			}
			if (s[i][j] == '#' && up) v[i][j]++;
			//cout << i << " " << j << " " << v[i][j] << endl;
		}
	}
	cout << v[h - 1][w - 1] << endl;
}

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

int main(){
	int H,N,sum=0;
    cin>>H>>N;
    vector<int> A(N);
    for (int i=0;i<N;i++){
    	cin>>A.at(i);
        sum+=A.at(i);
    }
  if(sum>=H){
  cout<<"Yes"<<endl;
  }else{
  cout<<"No"<<endl;
  }
  
}

Measured memory_bytes: 3736
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (n); ++i)
template <class T>
inline bool chmin(T &a, T b)
{
    if (a > b)
    {
        a = b;
        return true;
    }
    return false;
}
template <class T>
inline bool chmax(T &a, T b)
{
    if (a < b)
    {
        a = b;
        return true;
    }
    return false;
}
using namespace std;
using ll = long long;
using P = pair<int, int>;
using Pl = pair<long long, long long>;
using veci = vector<int>;
using vecl = vector<long>;
using vecveci = vector<vector<int>>;
using vecvecl = vector<vector<long long>>;

int main() {
    int T,K;
    cin >> K >> T;
    veci A(T);
    REP(i,T) cin >> A[i];
    sort(A.begin(),A.end());
    int max = A[T-1];
    int sum = 0;
    REP(i,T-1) sum += A[i];
    if(max-1 >= sum) cout << max-1-sum << endl;
    else cout << 0 << endl;
} 


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

using namespace std;
using ll = long long;
using ld = long double;

const int mod = 1000000007;
//const int mod = 998244353;

struct mint {
    ll x; // typedef long long ll;
    mint(ll x=0):x((x%mod+mod)%mod){}
    mint operator-() const { return mint(-x);}
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod-a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
    mint operator+(const mint a) const { return mint(*this) += a;}
    mint operator-(const mint a) const { return mint(*this) -= a;}
    mint operator*(const mint a) const { return mint(*this) *= a;}
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }

    // for prime mod
    mint inv() const { return pow(mod-2);}
    mint& operator/=(const mint a) { return *this *= a.inv();}
    mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

struct combination {
    vector<mint> fact, ifact;
    combination(int n):fact(n+1),ifact(n+1) {
        assert(n < mod);
        fact[0] = 1;
        for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
        ifact[n] = fact[n].inv();
        for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
    }
    mint operator()(int n, int k) {
        if (k < 0 || k > n) return 0;
        return fact[n]*ifact[k]*ifact[n-k];
    }
} comb(200005);

//#define int long long
//signed main(){
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n;
    cin >> n;
    vector<int> a(n);
    vector<mint> ma(n);
    for(int i = 0; i < n; i++) {
        cin >> a[i];
        ma[i]=a[i];
    }

    map<int,int> ap;
    for(int i = 0; i < n; i++) {
        int ref=a[i];
        int div=2;
        map<int,int> tap;
        while(div*div<=ref) {
            if(ref%div) div++;
            else{
                ref/=div;
                tap[div]++;
            }
        }
        tap[ref]++;
        for(auto itr = tap.begin(); itr != tap.end(); itr++) {
            int f=itr->first;
            int s=itr->second;
            ap[f]=max(ap[f],s);
        }
    }

    mint l=1;
    for(auto itr = ap.begin(); itr != ap.end(); itr++) {
        mint f=itr->first;
        int s=itr->second;
        for(int i = 0; i < s; i++) l*=f;
    }

    mint ans=0;
    for(int i = 0; i < n; i++) ans+=(l/ma[i]);
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 6832
#!/home/matsumotokazuho/.pyenv/shims/pypy
# import math
# from copy import deepcopy
# from operator import itemgetter
# from collections import defaultdict
# from collections import Counter
# from collections import deque
# import pprint
import itertools
import sys
sys.setrecursionlimit(10**6)
input = sys.stdin.readline

H, W = map(int, input().split())
Board = [list(input().rstrip()) for _ in range(H)]

# q = deque()
q = []
# for i, j in itertools.product(range(H), range(W)):
for i in range(H):
    for j in range(W):
        if Board[i][j] == '#':
            # Board[i][j] = 0
            q.append((i, j))

ans = 0
# while q:
for i in itertools.count():
    qq = []
    ans += 1
    for yx in q:
        for d in [(1, 0), (-1, 0), (0, 1), (0, -1)]:
            y = yx[0] + d[0]
            x = yx[1] + d[1]
            # y, x = [i+j for i, j in zip(yx, d)]
            if y < 0 or H - 1 < y or x < 0 or W - 1 < x:
                pass
            elif Board[y][x] == '.':
                # Board[y][x] = Board[q[0][0]][q[0][1]] + 1
                Board[y][x] = '#'
                qq.append((y, x))
    q = qq
    if not q:
        break

# ans = max(list(itertools.chain.from_iterable(Board)))
# ans = max(itertools.chain.from_iterable(Board))
# pprint.pprint(Board)
print(ans-1)


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

using namespace std;

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

    int cnt1 = 0, cnt2 = 0, cnt3 = 0;
    for (int i = 0; i < N; ++i) {
        int a;
        cin >> a;

        if (a <= A) {
            cnt1++;
        } else if (a <= B) {
            cnt2++;
        } else {
            cnt3++;
        }
    }

    cout << min({cnt1, cnt2, cnt3}) << endl;
    return 0;
}



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

int main(){
	int a,b;
	char op;
	while(true){
	cin >> a >> op >> b;
	if(op=='+'){
		cout << a+b << endl;
	}else if(op=='-'){
		cout << a-b << endl;
	}else if(op=='*'){
		cout << a*b << endl;
	}else if(op=='/'){
		cout << a/b << endl;
	}else if(op=='?'){
		break;
	}
	}
	return 0;
}

Measured memory_bytes: 3068
#include<bits/stdc++.h>
#define ll long long
#define eps 1e-8
#define INF 0x3f3f3f3f
#define pb push_back
#define endl '\n'
using namespace std;
const ll maxn = 1e6 + 5;
ll n,w[maxn],a,b,LIS[maxn],len;
ll ans[maxn];
vector<int> G[maxn];
void dfs(int x,int f){
    int idx = lower_bound(LIS + 1,LIS + n + 1,w[x]) - LIS;
    int tmp = LIS[idx];
    LIS[idx] = w[x];
    ans[x] = max(ans[f],(ll)idx);
    for(int i = 0;i < G[x].size(); i++){
        int endd = G[x][i];
        if(endd != f)
            dfs(endd,x);
    }
    LIS[idx] = tmp;
}
int main()
{
    cin >> n;
    int a,b;
    for(int i = 1;i <= n; i++) cin >> w[i],LIS[i] = INF;;
    for(int i = 1; i < n; i++)
        cin >> a >> b,G[a].pb(b),G[b].pb(a);
    dfs(1,0);
    for(int i = 1; i <= n; i++)
        cout << ans[i] << endl;
    return 0;
}



Measured memory_bytes: 52316
#include <bits/stdc++.h>
#define itn int
#define REP(i, n) for (int i = 0; i < n; i++)
#define IREP(i, n) for (int i = n - 1; i >= 0; i--)
#define FOR(a, b) for (int i = a; i < b + 1; i++)
#define all(v) v.begin(), v.end()
#define SENTINEL 2000000000
#define NIL -1
using namespace std;
typedef long long ll;

const ll INF = 1LL << 60;
const ll MOD = 1000000007;
template <class T>inline bool chmin(T &a, T b){if(a>b){a=b;return true;}return false;}
template <class T>inline bool chmax(T &a, T b){if(a<b){a=b;return true;}return false;}


int main()
{
    int n,m;
    cin >> n >> m;
    vector<int> a(n);
    double sum=0;
    REP(i,n){
        cin >> a[i];
        sum+=a[i];
    }
    sum/=4*m;
    sort(all(a),greater<int>());
    REP(i,m){
        double b=a[i];
        if(a[i]<sum){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
}


Measured memory_bytes: 256
a,b,c=map(int,input().split())
k=int(input())

i = 0
while(1):
    if b>a: break
    b*=2
    i+=1
    if i>k: break

while(1):
    if c>b: break
    c*=2
    i+=1
    if i>k: break

if i>k:
    print('No')
else:
    print('Yes')


Measured memory_bytes: 9104
#include <bits/stdc++.h>
#define rep(i,n) for (ll i = 0; i < (n); ++i)
#define All(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()   //reverse
#define strall(v) (v).cbegin(),(v).cend() //const_itterator
#define IN(a, b, x) (a<=x&&x<b)
using namespace std;
using ll = long long;
using Pair = pair<int,int>;
using Graph = vector<vector<ll>>;
template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
template<typename t, typename u, typename Comp=less<>>
bool chmax(t& xmax, const u& x, Comp comp={}) { if(comp(xmax, x)) { xmax = x; return true; } return false;}
template<typename t, typename u, typename Comp=less<>>
bool chmin(t& xmin, const u& x, Comp comp={}) { if(comp(x, xmin)) { xmin = x; return true;} return false;}
const int INF = 1e9;
const ll infl = ll(1e18)+5;

/*
*ios::sync_with_stdio(false);
*cin.tie(0);
*/

int main(){
  int N;
  cin >> N;
  int ans = 1000 - N%1000;
  if(ans == 1000) ans = 0;
  cout << ans << endl;

}

Measured memory_bytes: 3624
#include<bits/stdc++.h>
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long
#define pii std::pair<int,int>
#define pli std::pair<ll,int>
#define pil std::pair<int,ll>
#define psi std::pair<string,int>
#define pll std::pair<ll,ll>
#define pci std::pair<char,int>
#define sll(x) scanf("%lld",&x)
#define prll(x) printf("%lld ",x)
#define pri(x) printf("%d ",x)
#define si(x) scanf("%d",&x)
#define pb push_back
#define vll std::vector<ll>
#define vpi std::vector<std::pair<int,int>>
#define vi std::vector<int>
#define vvi std::vector<std::vector<int>>
#define vvpil std::vector<std::vector<std::pair<int,ll>>>
#define vlpii std::vector<std::list<pii>>
#define vlpil std::vector<std::list<pil>>
#define li std::list<int>
#define lpil std::list<pil>
#define Endl printf("\n")
#define vli vector<list<int>>
#define vvll vector<vector<ll>>
#define mp make_pair
#define x first
#define y second
#define ull uint64_t
#define ma 100000000
#define imie(...) "[" << #__VA_ARGS__": " << (__VA_ARGS__) << "] "
const ll  INF=10000000000000;
const ll mod =  1e9 + 7;
using namespace std;
void computeLPSArray(string pat, int M, int* lps); 
void add(ll& a , ll b){
	a += b;
	if(a >= mod) a -= mod;
}
ll mul(ll a , ll b){
	return (a * b) % mod;
}
ll Pow(ll a , ll b){
	if(b == 0) return 1 ;
	ll c = Pow(a , b / 2) ;
	if(b % 2) return (a * ((c * c)% mod )) % mod ;
	return (c * c) % mod ;
}
vector<int> KMPSearch(string pat, string txt) 
{ 
	int M = pat.length(); 
	int N = txt.length(); 
	vector<int> ans ;
	// create lps[] that will hold the longest prefix suffix 
	// values for pattern 
	int lps[M]; 

	// Preprocess the pattern (calculate lps[] array) 
	computeLPSArray(pat, M, lps); 

	int i = 0; // index for txt[] 
	int j = 0; // index for pat[] 
	while (i < N) { 
		if (pat[j] == txt[i]) { 
			j++; 
			i++; 
		} 

		if (j == M) { 
			ans.push_back(i - j) ;
			j = lps[j - 1]; 
		} 

		// mismatch after j matches 
		else if (i < N && pat[j] != txt[i]) { 
			// Do not match lps[0..lps[j-1]] characters, 
			// they will match anyway 
			if (j != 0) 
				j = lps[j - 1]; 
			else
				i = i + 1; 
		} 
	} 
	return ans ;
} 

// Fills lps[] for given patttern pat[0..M-1] 
void computeLPSArray(string pat, int M, int* lps) 
{ 
	// length of the previous longest prefix suffix 
	int len = 0; 

	lps[0] = 0; // lps[0] is always 0 

	// the loop calculates lps[i] for i = 1 to M-1 
	int i = 1; 
	while (i < M) { 
		if (pat[i] == pat[len]) { 
			len++; 
			lps[i] = len; 
			i++; 
		} 
		else // (pat[i] != pat[len]) 
		{ 
			// This is tricky. Consider the example. 
			// AAACAAAA and i = 7. The idea is similar 
			// to search step. 
			if (len != 0) { 
				len = lps[len - 1]; 

				// Also, note that we do not increment 
				// i here 
			} 
			else // if (len == 0) 
			{ 
				lps[i] = 0; 
				i++; 
			} 
		} 
	} 
} 
//check modulo
int main(){
	IOS;
	cout.precision(30) ;
	int n ; cin >> n;vll h(n);for(int i = 0 ; i  < n ; i++) cin >> h[i] ;
	ll nb = 1 ;
	ll ans = 1 ;
	for(int i = 1 ; i < n ; i++){
		if(h[i] <= h[i - 1]) nb++ ;
		else{
			ans = max(ans , nb) ;
			nb = 1 ;
		}
	}
	cout << max(nb , ans) - 1 << endl ;
				
			
	return 0;
}


Measured memory_bytes: 1024
n, k = map(int, input().strip().split())
s = input().strip()

cnts = []
# denote whether the first block is 0 or 1
tmp, cnt = s[0], 0
flag = int(s[0])

for i in range(n):
    if s[i] == tmp:
        cnt += 1
    else: # here tmp should be cleared
        cnts.append(cnt)
        cnt = 1
    tmp = s[i]
cnts.append(cnt)
# print(cnts)

n_zero = (len(cnts) + 1) // 2 if flag == 0 else len(cnts) // 2
if n_zero <= k:
     ans = sum(cnts)

else:
    ans = 0
    cumsum = [0]
    for i in range(len(cnts)):
        cumsum.append(cumsum[-1] + cnts[i])

    for inx in range(flag, len(cnts), 2):
        start = max(0, inx - 1)
        end = min(inx + 2 * k , len(cnts))
        tmp = cumsum[end] - cumsum[start]
        ans = max(tmp, ans)

print(ans)

Measured memory_bytes: 7932
#include <bits/stdc++.h>
using namespace std;
int main(){
    string s,t;
    cin >> s >> t;
    int tmp = t.length();
    t.erase(tmp-1);
    // cout << s << endl;
    // cout << t << endl;
    if(s.compare(t)==0){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 3628
//Bismillahir Rahmanir Rahim
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//using namespace __gnu_pbds;
using namespace std;
 
#define ff              first
#define ss              second
#define int             long long
#define endl            "\n"
#define pb              push_back
#define ppb              pop_back
#define mp              make_pair
#define pii             pair<int, int>
#define vi              vector<int>
#define all(x)          (x).begin(), (x).end()
#define mii             map<int, int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int, vi, greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed << setprecision(y) << x
#define mk(arr,n,type)  type *arr = new type[n];
#define w(x)            int x; cin >> x; while(x--)
#define FIO             ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());
 
//typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
 
inline int ceili(int x, int y) { return (x + y - 1) / y; }
 
void solve()
{
    string s, t; cin >> s >> t;
    int mn = INT_MAX, cnt;

    for(int i = 0; i < s.size() - t.size() + 1; ++i) {
        cnt = 0;
        for(int j = 0; j < t.size(); ++j) {
            if(s[i + j] != t[j]) ++cnt;
        }
        mn = min(cnt, mn);
    }
    cout << mn << endl;
}
 
int32_t main()
{
    FIO;
 
    solve();
 
    return 0;
}

Measured memory_bytes: 3668
import math
A,B=map(int,input().split())
Amin=A/0.08
Amax=(A+1)/0.08
Bmin=B/0.1
Bmax=(B+1)/0.1


if Amax<=Bmin or Bmax<=Amin:
    print(-1)
else:
  a=math.ceil(Amin)
  b=math.ceil(Bmin)
  if a<Bmax or b<Amax:
    print(max(a,b))
  else:
    print(-1)




Measured memory_bytes: 38576
N, M, X, Y = map(int, input().split())
x = [int(i) for i in input().split()]
y = [int(i) for i in input().split()]

for i in range(0,N):
    if X < x[i]:
        X = x[i]

for j in range(0,M):
    if Y > y[j]:
        Y = y[j]

if Y-X > 0:
    print("No War")
else:
    print("War")

Measured memory_bytes: 38512
#include <iostream>

using namespace std;

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

  int count = 0;
  for(int i = 0; i < 3; i++) {
    if(s[i] == t[i]) {
      count++;
    }
  }

  cout << count << endl;
  return 0;
}

Measured memory_bytes: 256
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//イテレータあるけど順序保持しないmap
#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列

// vectorの重複削除
// std::sort(test.begin(), test.end()); 昇順
// test.erase(std::unique(test.begin(), test.end()), test.end());

using namespace std;
using ll = long long;
using P = pair<int, int>; // vector<P> ba(n); みたいな感じですぐ使える ba[i] = P(a, b); make_pairをしなくてもいい
// typedef vector<int> v;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v){o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}
#define debug(v) {cerr<<"\033[1;36m[debug]\033[m "<<#v<<" : "<<v<<endl;}
#define rep(i, c) for(int i = 0; i < int(c); i++)
#define ALL(x) (x).begin(), (x).end() //sort(ALL(obj))みたいな
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x)) //最大値
#define pb push_back //
// const int MOD = 1000000007;
// string alpha="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
// printf("%.20f\n", ans); あれ
// const double PI = 3.141592653589793238462643383;



int main() {
  int a,b,c,x; cin>>a>>b>>c>>x;
  int ans;
  int cnt = 0;
  for (int i=0; i<=a; i++) {
    for (int j=0; j<=b; j++) {
      for (int k=0; k<=c; k++) {
        ans = 500*i + 100*j + 50*k;
        if (ans == x) cnt++;
      }
    }
  }
  cout << cnt << endl;
}


Measured memory_bytes: 3140
a, b, c, d = map(int, input().split())
count1 = 0
count2 = 0
while c > 0:
    c -= b
    count1 += 1
while a > 0:
    a -= d
    count2 += 1
if count1 <= count2:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 9180
#include<iostream>
#include<queue>
#include<stack>
#include<vector>
#include<set>
#include<map>
#include<algorithm>
#include<cstring>
#include<string>
#include<cassert>
#include<cmath>
#include<climits>
#include<iomanip>
#include<bitset>
#include<unordered_map>

using namespace std;

#define rep(i,m,n) for(int (i)=(int)(m);(i)<(int)(n);(i)++)
#define rep2(i,m,n) for(int (i)=(int)(n)-1;(i)>=(int)(m);(i)--)
#define REP(i,n) rep(i,0,n)
#define REP2(i,n) rep2(i,0,n)
#define FOR(i,c) for(decltype((c).begin())i=(c).begin();i!=(c).end();++i)
#define ll long long
#define ull unsigned long long
#define all(hoge) (hoge).begin(),(hoge).end()
#define en '\n'
typedef pair<ll, ll> P;
constexpr long long INF = 1LL << 60;
constexpr int INF_INT = 1 << 25;
constexpr long long MOD = (ll)1e9+7;
typedef vector<ll> Array;
typedef vector<Array> Matrix;
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;


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

struct Edge {
	int to, cap, rev;
	Edge(int _to, int _cap, int _rev) {
		to = _to; cap = _cap; rev = _rev;
	}
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;

void add_edge(Graph& G, int from, int to, int cap, bool revFlag, int revCap) {
	G[from].push_back(Edge(to, cap, G[to].size()));
	if (revFlag)G[to].push_back(Edge(from, revCap, G[from].size() - 1));
}

void solve() {
	long double l;
	cin >> l;
	cout <<fixed<<setprecision(10)<< l * l * l/27.0L<<en;
}

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

	solve();
	//int t; cin >> t; REP(i, t) solve();

	return 0;
}


Measured memory_bytes: 256
#include <iomanip>
#include <cmath>
#include <sstream>
#include <unordered_map>
#include <unordered_set>
#include <deque>
#include <vector>
#include <bitset>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include<iostream>
#include<map>
#include<algorithm>

using namespace std;

int main() {
	int n; cin >> n;
	int a[100];
	for (int i = 0; i < n; i++) { cin >> a[i]; }
	sort(a, a + n);
	int min = 10000000;

	for (int i = -100; i <= 100; i++) {
		int sum = 0;
		for (int j = 0; j < n; j++) {
			sum += pow(abs(a[j] - i), 2);
		}
		if (min > sum) {
			min = sum;
		}
	}

	cout << min << endl;

	return 0;
}

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

int main(){
    int N,M;
    cin >> N >> M;
    vector<int> ID(N+10);
    int L,R;
    rep(i,M){
        cin >> L >> R;
        ID.at(L)++;
        ID.at(R+1)--;
    }
    int cnt = 0;
    rep(i,N+1){
        ID.at(i+1) += ID.at(i);
        if(ID.at(i) == M) cnt++;
    }
    cout << cnt << endl;
}   

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

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> P;
typedef tuple<int,int,int> tpl;

#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) reverse((c).begin(),(c).end())
#define LB(a,x) lower_bound((a).begin(), (a).end(), x) - (a).begin()
#define UB(a,x) upper_bound((a).begin(), (a).end(), x) - (a).begin()

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

#define en "\n"

const double EPS = 1e-9;
const double PI  = acos(-1.0);
const int INT_INF = 2147483647;
const long long LL_INF = 1LL<<60;
const long long MOD = 1000000007; // 998244353

#define CLR(a) memset((a), 0, sizeof(a))

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

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

int main(void){
    ll K; cin >> K;
    vector<ll> A(K); REP(i,K) cin >> A[i];
    ll mn=2, mx=2;
    RREP(i,K){
        ll mink = (mn+A[i]-1)/A[i];
        ll maxk = mx/A[i];
        if(A[i]*mink<mn || mx<A[i]*mink || A[i]*maxk<mn || mx<A[i]*maxk){
            cout << -1 << en;
            return 0;
        }
        mn = A[i]*mink;
        mx = A[i]*(maxk+1)-1;
    }
    cout << mn << " " << mx << en;
    return 0;
}

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

using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define ll long long int
#define INF 1000000007
// cin.eof() 入力個数の問題
int main() {
   char c;
   cin>>c;
   if('A'<=c&&c<='Z'){
       cout<<'A'<<endl;
   }else
   {
       cout<<'a'<<endl;
   }
   

    return 0;
}


Measured memory_bytes: 3632