akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <iostream>
#include <string>
using namespace std;
int main(void){
  int N;
  cin >> N;
  string S;
  cin >> S;
  int i;
  bool flug = true;
  if(N%2 == 1) cout << "No" << endl;
  else {
   for(i=0;i<N/2;i++){
     if(S[i] != S[i+N/2]) flug = false;
   }
    if(flug == true) cout << "Yes" << endl;
    else cout << "No" << endl;
    
  }
return 0;
}

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

int main() {
    long long N=0;
    cin >> N;

    long long a=2;
    long long b=1;
    long long tmp = 0;

    if(N == 0){
        cout << a << endl;
        return 0;
    }

    for(long long i=0; i<N; i++){
        tmp = b;
        b = a + tmp;
        a = tmp;
    }

    cout << a << endl;
}


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

using namespace std;
#define ll long long

const int N = 10005, P = 1000000007;
int n, ans, a[N], f[1000005];
int Pow(ll x, int y=P-2){
	int ans=1;
	for(; y; y>>=1, x=x*x%P) if(y&1) ans=ans*x%P;
	return ans;
}
int main() {
	scanf("%d", &n);
	for(int i=1; i<=n; ++i){
		scanf("%d", a+i);
		int x=a[i];
		for(int j=2; j*j<=x; ++j) if(x%j==0){
			int cnt=1;
			while((x/=j)%j==0) ++cnt;
			f[j]=max(f[j], cnt);
		}
		if(x>1) f[x]=max(f[x], 1);
	}
	int s=1;
	for(int i=1; i<=1000000; ++i) while(f[i]--) s=(ll)s*i%P;
	for(int i=1; i<=n; ++i) ans=(ans+(ll)s*Pow(a[i]))%P;
	printf("%d\n", ans);
	return 0;
}


Measured memory_bytes: 4224
#include <bits/stdc++.h>
#include <math.h>
#define ALL(a)    a.begin(), a.end() 
#define rep(i, K, N)  for(long long int i = K; i < N; i++)
#define ll long long int
using namespace std;

int main() {
ll N;
cin >> N;
cout << (N*(N - 1))/2;
}

Measured memory_bytes: 3628
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <cstdlib>
const int MaxN = 200;
typedef long long LL;
using namespace std;

LL f[MaxN + 5][MaxN + 5];
int a[MaxN + 5], b[MaxN + 5];
int n, m, R;
bool vis[10];
void Init()
{
	for(int i = 1;i <= R;i++) scanf("%d", &a[i]);
	for(int i = 1;i <= n;i++) {
		for(int j = 1;j <= n;j++){
			f[i][j] = 1 << 30;
		}
		f[i][i] = 0;
	}
	for(int i = 1; i <= m; i++){
		int u, v, w;
		scanf("%d%d%d", &u, &v, &w);
		f[u][v] = f[v][u] = w;
	}
	for (int k = 1; k <= n; k++){
		for (int i = 1; i <= n; i++){
			for (int j = 1; j <= n; j++){
				f[i][j] = min(f[i][j], f[i][k] + f[k][j]);
			}
		}
	}
}

LL Get(){
	LL res = 0;
	for(int i = 2;i <= R;i++){
		res += f[b[i - 1]][b[i]];
	}
	return res;
}
void Dfs(int cur, LL &w){
	if(cur >= R + 1) {
		w = min(w, Get());
	}
	for(int i = 1;i <= R;i++){
		if(!vis[i]){
			vis[i] = true;
			b[cur] = a[i];
			Dfs(cur + 1, w);
			vis[i] = false;
		}
	}
}
void Solve()
{
	memset(vis, 0, sizeof(vis));
	LL ans = 1 << 30;
	Dfs(1, ans);
	printf("%lld\n", ans);
}

int main()
{
	while(~scanf("%d%d%d", &n, &m, &R)){
		Init();
		Solve();
	}
}

Measured memory_bytes: 512
#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,m,i;
	cin>>n>>m;
	int a[n],sum=0;
	for(i=0;i<m;i++){
		cin>>a[i];sum+=a[i];}
	if(sum>n)
		cout<<"-1";
	else
		cout<<n-sum<<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: 3736
import sys
sys.setrecursionlimit(2147483647)
INF=10**9
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
def resolve():
    n=int(input())
    X=[[INF,-INF] for _ in range(3)]
    Y=[[INF,-INF] for _ in range(3)]
    for _ in range(n):
        x,y,d=input().split()
        x=int(x); y=int(y)
        if(d=='R'):
            X[2][0]=min(X[2][0],x)
            X[2][1]=max(X[2][1],x)
            Y[1][0]=min(Y[1][0],y)
            Y[1][1]=max(Y[1][1],y)
        elif(d=='L'):
            X[0][0]=min(X[0][0],x)
            X[0][1]=max(X[0][1],x)
            Y[1][0]=min(Y[1][0],y)
            Y[1][1]=max(Y[1][1],y)
        elif(d=='U'):
            X[1][0]=min(X[1][0],x)
            X[1][1]=max(X[1][1],x)
            Y[2][0]=min(Y[2][0],y)
            Y[2][1]=max(Y[2][1],y)
        elif(d=='D'):
            X[1][0]=min(X[1][0],x)
            X[1][1]=max(X[1][1],x)
            Y[0][0]=min(Y[0][0],y)
            Y[0][1]=max(Y[0][1],y)

    T=[0]
    for i in range(3):
        for j in range(i): # i>j
            t=-(X[i][0]-X[j][0])/(i-j)
            if(t>0): T.append(t)
            t=-(X[i][1]-X[j][1])/(i-j)
            if(t>0): T.append(t)
            t=-(Y[i][0]-Y[j][0])/(i-j)
            if(t>0): T.append(t)
            t=-(Y[i][1]-Y[j][1])/(i-j)
            if(t>0): T.append(t)

    def f(t):
        x_min=min(X[0][0],X[1][0]+t,X[2][0]+2*t)
        x_max=max(X[0][1],X[1][1]+t,X[2][1]+2*t)
        y_min=min(Y[0][0],Y[1][0]+t,Y[2][0]+2*t)
        y_max=max(Y[0][1],Y[1][1]+t,Y[2][1]+2*t)
        return (x_max-x_min)*(y_max-y_min)

    ans=float("inf")
    for t in T:
        ans=min(ans,f(t))
    print(ans)
resolve()

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

using namespace std;
const int MAX_N = 2010;
long long N,X;
long long dp[MAX_N][MAX_N];
vector<long long> slimes;
long long ans;

int main(){
  ans = 1LL << 60;
  cin >> N >> X;
  slimes.resize(N);
  for (auto &val : slimes){
    cin >> val;
  }
  for (int i = 0; i < MAX_N; i++){
    for (int j = 0; j < MAX_N; j++){
      dp[i][j] = 1LL << 60;
    }
  }
  for (int i = 0; i < N; i++){
    dp[i][0] = slimes[i];
  }
  for (int i = 0; i < N; i++){
    for (int j = 1; j < N; j++){
      int pre_node = (i - j + N) % N;
      dp[i][j] = min(dp[i][j - 1], slimes[pre_node]);
    }
  }

  
  for (int K = 0; K < N; K++){
    long long tmp = 0;
    for (int i = 0; i < N; i++){
      tmp += dp[i][K];
    }
    ans = min(ans, tmp + K * X);
  }
  cout << ans << endl;
}


Measured memory_bytes: 31872
import logging

logging.basicConfig(level=logging.INFO, format="%(message)s")
#logging.disable(logging.CRITICAL)

def main():
    S = input()
    logging.info("Hello!")

    S_len = len(S)
    counter = 0
    for i in range(S_len // 2):
        if S[i] != S[S_len - 1 - i]:
            counter += 1

    print(counter)
    
    
if __name__ == "__main__":
    main()


Measured memory_bytes: 4212
import java.io.*;
import java.math.*;
import java.util.*;

public class Main {
    private static boolean debug = false;
    private static boolean elapsed = false;

    private static PrintWriter _out = new PrintWriter(System.out);
    private static PrintWriter _err = new PrintWriter(System.err);

    private void solve(Scanner sc) {
        int a = sc.nextInt();
        int b = sc.nextInt();

        if (a == b) {
            _out.println("Draw");
        } else if (a == 1) {
            _out.println("Alice");
        } else if (b == 1) {
            _out.println("Bob");
        } else {
            _out.println((a > b ? "Alice" : "Bob"));
        }
    }
    private static BigInteger C(long n, long r) {
        BigInteger res = BigInteger.ONE;
        for (long i = n; i > n - r; --i) {
            res = res.multiply(BigInteger.valueOf(i));
        }
        for (long i = r; i > 1; --i) {
            res = res.divide(BigInteger.valueOf(i));
        }
        return res;
    }
    private static BigInteger P(long n, long r) {
        BigInteger res = BigInteger.ONE;
        for (long i = n; i > n - r; --i) {
            res = res.multiply(BigInteger.valueOf(i));
        }
        return res;
    }
    /*
     * 10^10 > Integer.MAX_VALUE = 2147483647 > 10^9
     * 10^19 > Long.MAX_VALUE = 9223372036854775807L > 10^18
     */
    public static void main(String[] args) {
        long S = System.currentTimeMillis();

        Scanner sc = new Scanner(System.in);
        new Main().solve(sc);
        _out.flush();

        long G = System.currentTimeMillis();
        if (elapsed) {
            _err.println((G - S) + "ms");
        }
        _err.flush();
    }
}

Measured memory_bytes: 23252
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> mp;
ll inf =  1e9;


int main(){
    string s;
    cin>>s;
    for( int i=0;i<s.size();i++)cout<<'x';
    cout<<endl;
    return 0;
}


Measured memory_bytes: 256
S = int(input())
s, r = divmod(S, 3)

P = 10 ** 9 + 7


def combination(n, r):
    x = 1
    y = 1
    for i in range(n - r + 1, n + 1):
        x = (x * i % P)
    for i in range(1, r + 1):
        y = (y * i % P)
    y_inv = _power(y, P - 2)
    return (x * y_inv) % P


def _power(x, n):
    ans = 1
    while n > 0:
        if bin(n & 1) == bin(1):
            ans = (ans * x) % P
        x = (x * x) % P
        n = n >> 1
    return ans


ans = 0
for i in range(s):
    ball = S - 3 * (i + 1)
    ans = (ans + combination(ball + i, i))%P
print(ans)


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


int main(){

    int A, B, M;
    cin >> A >> B >> M;

    vector<int> a(A);
    vector<int> b(B);
    for (int i=0; i<A; i++) cin >> a.at(i);
    for (int i=0; i<B; i++) cin >> b.at(i);

    int min_a = 1e6;
    int min_b = 1e6;

    for (int i=0; i<A; i++){
        min_a = min(min_a, a.at(i));
    }
    for (int i=0; i<B; i++){
        min_b = min(min_b, b.at(i));
    }

    int min_price = min_a + min_b;

    int x, y, c, min_buf = 1e6;
    for (int i=0; i<M; i++){
        cin >> x >> y >> c;
        min_buf = a.at(x-1) + b.at(y-1) - c;
        min_price = min(min_buf, min_price);
    }

    cout << min_price << endl;
    return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>
#include <bits/stdc++.h>
#include <algorithm>
#include <iomanip>
#include <cstring>
#include <cmath>
//#include <minmax.h>
#define DETERMINATION main
#define lldin(a) scanf("%lld",&a)
#define din(a) scanf("%d",&a)
#define reset(a,b) memset(a,b,sizeof(a))
const int INF=0x3f3f3f3f;
const int LIM=1e5+75;
using namespace std;
typedef long long ll;
/**you can feel the pulse of your destiny...
The nervous feeling fills you with determination.**/
int n;
int a[LIM];
struct nu
{
   int value,mx;
}hhhhhh[LIM],qqqqqq[LIM];
bool cmp(nu a,nu b)
{
    return a.mx>b.mx;
}
int DETERMINATION()
{
    cin>>n;
    for(int i=1; i<=n; i++)
        cin>>a[i];
    for(int i=1; i<=n; i+=2)//找出奇数位上出现次数最多的数字
        {
          hhhhhh[a[i]].mx++;
          hhhhhh[a[i]].value=a[i];
        }
    for(int i=2; i<=n; i+=2)//找出偶数位上出现次数最多的数字
        {
          qqqqqq[a[i]].mx++;
          qqqqqq[a[i]].value=a[i];
        }
    ll ans=0;
    sort(qqqqqq+1,qqqqqq+LIM+1,cmp);//通过排序找出最大值，由于只有1e5个元素，排序不会造成什么时间上的浪费。
    sort(hhhhhh+1,hhhhhh+LIM+1,cmp);
    //cout<<qqqqqq[1].value<<" "<<hhhhhh[1].value<<endl;
    if(qqqqqq[1].value==hhhhhh[1].value)//如果奇数位和偶数位都是同一个数字出现次数最多。
    {
       ans=min((n-hhhhhh[2].mx-qqqqqq[1].mx),(n-hhhhhh[1].mx-qqqqqq[2].mx));
       //那么枚举两种情况来求最小值。
    }
    else
      ans=n-hhhhhh[1].mx-qqqqqq[1].mx;//不然照常计算即可。
    cout<<ans<<endl;
    return 0;
}

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

using namespace std;
#define ll long long

#define rep(i, a) for (int (i) = 0; (i) < (int) (a); (i)++)
#define reps(i, a, b) for (int (i) = (int) (a); (i) < (int) (b); (i)++)
#define rrep(i, a) for (int (i) = (int) a-1; (i) >= 0; (i)--)
#define rreps(i, a, b) for (int (i) = (int) (a)-1; (i) >= (int) (b); (i)--)
#define MP(a, b) make_pair((a), (b))
#define PB(a) push_back((a))
#define all(v) (v).begin(), (v).end()
#define PRINT(f) if((f)){cout << (TRUE__) << endl;}else{cout << FALSE__ << endl;}
#define TRUE__ "Yes"
#define FALSE__ "No"
#define PERM(v) next_permutation(all(v))
#define UNIQUE(v) sort(all(v));(v).erase(unique(all(v)), v.end())
#define CIN(type, x) type x;cin >> x

#ifdef LOCAL
#define lcout(a) cout << a;
#define lcoutln(a) cout << a << endl;
#define lcerr(a) cerr << a;
#define lcerrln(a) cerr << a << endl;
#else
#define lcout(a) 
#define lcoutln(a) 
#define lcerr(a) 
#define lcerrln(a) 
#endif

vector<pair<int, int> > v;

int main()
{
	int n;
	cin >> n;
	int next[2] = {-1, 1};
	int diff[2] = {-1, 1};
	int pos = 1 - n % 2;
	next[pos] = 0;
	rep(i, n) {
		CIN(int, a);
		v.PB(MP(next[pos], a));
		next[pos] += diff[pos];
		pos = 1 - pos;
	}
	sort(all(v));
	int l = v.size();
	for (int i = 0; i < l; i++) {
		cout << v[i].second << " \n"[i==l-1];
	}
}


Measured memory_bytes: 3824
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,x) for(int i=0;i<x;i++)
#define put(ans)    cout << ans << endl;
#define reverse(s) reverse(s.begin(),s.end())

int main(){
    int n;
    cin >> n;
    ll sum(0);
    map<int,int> a;
    rep(i,n){
        int x;  cin >> x;
        sum += x;
        a[x]++;
    }
    
    int q;  cin >> q;
    int b[q],c[q];
    rep(i,q)    cin >> b[i] >> c[i];

    rep(i,q){
        int dif = c[i]-b[i];
        sum += a[b[i]]*dif;
        a[c[i]] += a[b[i]];   a[b[i]] = 0;
        cout << sum << endl;
    }

    return 0;
}

Measured memory_bytes: 8740
#include <iostream>
#include <vector>
#include <queue>
#include <tuple>
#include <algorithm>

using namespace std;

typedef pair<int, int> P;

const long MOD = 998244353;

vector<int> qr, qg, qb;
vector<int> v1, v2, v3;

long fac = 1;

int main(){
    int N;
    cin >> N;
    string S;
    cin >> S;
    for(int i = 1; i <= N; i++){
        fac*=i;
        fac%=MOD;
    }
    long ans = fac;
    for(int i = 0; i < 3*N; i++){
        if(S[i] == 'R') qr.push_back(i);
        if(S[i] == 'G') qg.push_back(i);
        if(S[i] == 'B') qb.push_back(i);
    }
    for(int i = 0; i < N; i++){
        int r = qr[i];
        int g = qg[i];
        int b = qb[i];
        if(r > g && g > b){
            v1.push_back(r);
            v2.push_back(g);
            v3.push_back(b);
        }
        if(r > b && b > g){
            v1.push_back(r);
            v2.push_back(b);
            v3.push_back(g);
        }
        if(b > r && r > g){
            v1.push_back(b);
            v2.push_back(r);
            v3.push_back(g);
        }
        if(b > g && g > r){
            v1.push_back(b);
            v2.push_back(g);
            v3.push_back(r);
        }
        if(g > r && r > b){
            v1.push_back(g);
            v2.push_back(r);
            v3.push_back(b);
        }
        if(g > b && b > r){
            v1.push_back(g);
            v2.push_back(b);
            v3.push_back(r);
        }
    }
    
    for(int j = 0; j < N; j++){
        auto ptr = upper_bound(v1.begin(), v1.end(), v2[j]);
        long n = v1.end()-ptr;
        //cout << (n-(N-j)+1) << ' ';
        ans *= (n-(N-j)+1);
        ans %= MOD;
    }
    for(int j = 0; j < N; j++){
        auto ptr = upper_bound(v3.begin(), v3.end(), v2[j]);
        long n = ptr-v3.begin();
        //cout << (n-j) << ' ';
        ans *= (n-j);
        ans %= MOD;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3320
#include <stdio.h>

int main()
{
	int a, b, k;
	int i;
	scanf("%d%d%d", &a, &b, &k);

	for (i = 0; i < k; i++) {
		switch (i % 2)
		{
		case 0: 
			if (a % 2 == 1)
				a = a - 1;
			a = a / 2;
			b = b + a;
			break;
		case 1:
			if (b % 2 == 1) {
				b = b - 1;
			}
			b = b / 2;
			a = a + b;
			break;
		default:
			break;
		}
	}

	printf("%d %d\n", a, b);
	
	return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<vector>
#include<algorithm>
#define lli long long int
using namespace std;
lli ans(lli h)
{
	if(h==1)
	return 1;
	else{
		return 1+2*ans(h/2);
	}
}
int main()
{   
lli h;
cin>>h;
cout<<ans(h);
	
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define sz(a) int(a.size())

int main(){
	vector<int> a(3);
	for(int i = 0; i < 3; i++){
		cin>>a[i];
	}
	sort(a.begin(), a.end());
	cout<<a[1] - a[0] + a[2] - a[1]<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=1;i<=n;i++)
#define drep(i,n) for(int i=n;i>=0;i--)
#define dpb push_back
#define fi first
#define se second
typedef pair<int, int> P;
const int inf = 1e9;

int a[10001], b[10001];
signed main(){
	int n, t1 = 0, t2 = 0;
	scanf("%lld", &n);
	rep(i,n)scanf("%lld", &a[i]);
	rep(i,n)scanf("%lld", &b[i]);
	
	
	for(int i = 0;i < n;i++){
		int t = max((int)0, (b[i]-a[i]+1)/2);
		t1 += max((int)0, a[i]+2*t-b[i]);
		t2 += t;
	}
	
	if(t1 <= t2)printf("Yes\n");
	else printf("No\n");
	return 0;
}

Measured memory_bytes: 384
#include <stdio.h>

int main(void)
{
	int n = 1, x = 1, a, b, c = 0, flag, flag_2;

	while ((n != 0) || (x != 0))
	{
		scanf("%d %d", &n, &x);

		if((n == 0) && (x == 0))
			break;

		for (a = 1, c = 0;(a < (n - 1)) && (flag = 1); a++)
		{
			for (b = (a + 1), flag_2 = 0; (b + 1 <= n) && (flag_2 != 1); b++)
			{
				if ((((x - a) - b) > b) && ((x - a) - b) <= n)
				{
					c++;
				}

				if (((3 * a) + 3) > 0)
				{
					flag = 1;
				}
			}
		}

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


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


using namespace std;

using ll   = long long;
using ii   = pair   < int , int >;
using i3   = pair   < int , ii  >;
using li   = pair   < ll  , int >;
using lii  = pair   < ll  , ii  >;
using pll  = pair   < ll  , ll  >;
using vi   = vector < int       >;
using vl   = vector < ll        >;
using vii  = vector < ii        >;
using vli  = vector < li        >;
using vpll = vector < pll       >;
using vi3  = vector < i3        >;
using vlii = vector < lii       >;


const int N = 2e5 + 5;
const ll INF = 1e17 + 7;
const double eps = 1e-9 , PI = acos(-1);



int n , m;


void solve(int testCase){

    double d , t , s;
    scanf("%lf %lf %lf" , &d , &t , &s);

    if(s * t >= d) {
            printf("Yes\n");
    }
    else {
            printf("No\n");
    }
}

main(){

    int t = 1;
    // scanf("%d" , &t);

    for(int testCase = 1 ; testCase <= t ; testCase ++){
            solve(testCase);
    }

    return 0;
}


Measured memory_bytes: 3840
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cstdlib>
#include <cmath>

using namespace std;

int main(int argc, char const *argv[])
{
    string s,res_s;
    cin >> s;

    for (int i = 0; i < s.size(); ++i)
    {
        if (i%2==0)
        {
            res_s.push_back(s[i]);
        }
    }

    cout << res_s << endl;

    return 0;
}

Measured memory_bytes: 512
import java.util.*;

public class Main {

    long INF = Long.MAX_VALUE;

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

    void solve() {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        long x = sc.nextLong();
        long[] a = new long[N];
        long ans = 0;
        long sum = 0;
        for (int i = 0; i < N; i++) {
            a[i] = sc.nextLong();
            sum += a[i];
        }
        if (a[0] > x) {
            a[0] = x;
        }
        for (int i = 1; i < N; i++) {
            if (a[i - 1] + a[i] > x) {
                a[i] = x - a[i - 1];
            }
        }
        for (int i = 0; i < N; i++) {
            ans += a[i];
        }
        System.out.println(sum-ans);
    }
}

Measured memory_bytes: 51052
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <string>
#include <limits>
#include <map>
#include <cmath>
#include <unordered_map>
#include <unordered_set>
#include <deque>
#include <stack>
#include <cstring>

typedef long long li;
using namespace std;

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

li max(li a, li b, li c) {
    return max(a, max(b, c));
}

li max(li a, li b, li c, li d) {
    return max(a, max(b, max(c, d)));
}

li max(li a, li b, li c, li d, li e) {
    return max(a, max(b, max(c, max(d, e))));
}


li pow_mod(li n, li e, li mod)
{
    li r = 1;
    
    while(e > 0)
    {
        if(e & 1)
            r *= n;
            r %= mod;
        
        n *= n;
        n %= mod;
        e >>= 1;
    }
    
    return r;
}
int main() {
    // ifstream fin("read.txt");
    li n, m, num;
    vector<li> v;
    cin >> n >> m;
    
    for (int i = 0; i < n; i++) {
        cin >> num;
        v.push_back(num);
    }
    
    li twos = 0, lcm = v[0];
    
    num = v[0];
    
    while(num > 0 && num % 2 == 0) {
        num /= 2;
        twos++;
    }
    
    for (int i = 1; i < v.size(); i++) {
        num = v[i];
        int t = 0;
        
        while(num > 0 && num % 2 ==0) {
            num /= 2;
            t++;
        }
        
        if (t != twos) {
            cout << 0 << endl;
            return 0;
        }
        
        lcm = lcm * v[i] / __gcd(lcm, v[i]);
    }
    
    lcm /= 2;
    
    li ans = m / lcm;
    ans = ans % 2 + ans / 2;
    
    cout << ans << endl;
    
    
    return 0;
}







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

typedef long long ll;
typedef unsigned long long ull;
typedef unsigned __int128 HASH;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef pair<ull, ull> pullull;
typedef pair<ll,int> plli;
typedef pair<double, int> pdbi;
typedef pair<int,pii> pipii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<pii> vpii;

#define rep(i,n) for (int i=0;i<(n);i++)
#define rep2(i,a,b) for (int i=(a);i<(b);i++)
#define rrep(i,n) for (int i=(n);i>0;i--)
#define rrep2(i,a,b) for (int i=(a);i>b;i--)
#define pb push_back
#define fi first
#define se second
#define all(a) (a).begin(),(a).end()

const ll mod = 1000000000 + 7;
const ll hmod1 = 999999937;
const ll hmod2 = 1000000000 + 9;
const ll INF = 1<<30;
const int dx4[4] = {1, 0, -1, 0};
const int dy4[4] = {0, 1, 0, -1};
const int dx8[8] = {1, 1, 1, 0, 0, -1, -1, -1};
const int dy8[8] = {0, 1, -1, 1, -1, 0, 1, -1};
const double pi = 3.141592653589793;

int n, l, q;
vector<int> x(100000 + 5, 1e10);
vector<vector<int>> step(100000+ 5, vector<int>(25, 1e10));

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n;
    rep(i, n) cin >> x[i];
    cin >> l;
    rep(i, n - 1) {
        int nx = lower_bound(all(x), x[i] + l + 1) -1 - x.begin();
        step[i][0] = nx;
    }
    rep(j, 20)rep(i, n) {
        step[i][j + 1] = step[min(n - 1, step[i][j])][j];
    }
    cin >> q;
    rep(i, q) {
        int a, b;
        cin >> a >> b;
        a--; b--;
        if (a > b) swap(a, b);
        int ans = 0;
        int now = a;
        rrep2(j, 20, -1) {
            if (step[now][j] <= b) {
                ans += 1<<j;
                now = step[now][j];
            }
        }
        if (now != b) ans++;
        cout << ans << endl;
    }
}


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

using namespace std;
typedef long long LL;

int a[100010];
int dp[100010];

int main() {
    int n;
    cin>>n;
    for (int i=0;i<n;i++) scanf("%d", &a[i]);
    memset(dp,-1,sizeof(dp));
    dp[n-1]=0;
    for (int i=n-1;i>=0;i--) {
        for (int j=1;j<=2;j++) {
            if (i-j>=0 && (dp[i-j]==-1 || dp[i-j]>dp[i]+abs(a[i]-a[i-j]))) dp[i-j]=dp[i]+abs(a[i]-a[i-j]);
        }
    }
    cout<<dp[0]<<endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
 
int main(){
    int N;
    cin >> N;

    int p = 0;
    for(int i=0;i<=25;i++){
        for(int j=0;j<=7;j++){
            p = 4*i + 7*j;
            if(p == N){
                cout << "Yes" << endl;
                return 0;
            }
        }
    }

    cout << "No" << endl;

}

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

int main(){

    int a[3][3], N, b[N];

    cin >> a[0][0] >> a[0][1] >> a[0][2];
    cin >> a[1][0] >> a[1][1] >> a[1][2];
    cin >> a[2][0] >> a[2][1] >> a[2][2];
    cin >> N;

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


    for(int i = 0; i < N; i++){
        for(int j = 0; j < 3; j++){
            for(int k = 0; k < 3; k++){
                if(b[i] == a[j][k]){
                    a[j][k] = 0;
                }
            }
        }
    }

    if(a[0][0] == 0 && a[0][1] == 0 && a[0][2] == 0) cout << "Yes" << "\n";
    else if(a[1][0] == 0 && a[1][1] == 0 && a[1][2] == 0) cout << "Yes" << "\n";
    else if(a[2][0] == 0 && a[2][1] == 0 && a[2][2] == 0) cout << "Yes" << "\n";
    else if(a[0][0] == 0 && a[1][0] == 0 && a[2][0] == 0) cout << "Yes" << "\n";
    else if(a[0][1] == 0 && a[1][1] == 0 && a[2][1] == 0) cout << "Yes" << "\n";
    else if(a[0][2] == 0 && a[1][2] == 0 && a[2][2] == 0) cout << "Yes" << "\n";
    else if(a[0][0] == 0 && a[1][1] == 0 && a[2][2] == 0) cout << "Yes" << "\n";
    else if(a[0][2] == 0 && a[1][1] == 0 && a[2][0] == 0) cout << "Yes" << "\n";
    else cout << "No" << "\n";

    
}

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

int main() {

  string s ;
  int c = 0 ;
  
  cin >> s ;
  
  if(s.at(0) == '1'){
    c++ ;
  }
  
  if(s.at(1) == '1'){
    c++ ;
  }
  
  if(s.at(2) == '1'){
    c++ ;
  }
  
  cout << c << endl;
  
}

Measured memory_bytes: 256
#include<stdio.h>

int main(){
  int i,minj,j,N,count,b,s;
  scanf("%d",&N);
  int A[N];
  for(i=0;i<=N-1;i++){
    scanf("%d",&A[i]);
  }
  count=0;
  for(i=0;i<=N-1;i++){
    minj = i;
    for(j=i;j<=N-1;j++){
      if(A[j]<A[minj]){
	minj = j;
      }
    }
    if(i!=minj)
      count++;
    b=A[i];
    A[i]=A[minj];
    A[minj]=b;
  }
  for(s=0;s<=N-1;s++){
    if(s<N-1)
      printf("%d ",A[s]);
    else printf("%d\n",A[s]);
  }
  printf("%d\n",count);
  
  return 0;
}
  



Measured memory_bytes: 2124
fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val sList = mutableListOf<Int>()

    for(i in 1..n){
        sList.add(readLine()!!.toInt())
    }
    sList.sort()
    val sum = sList.sum()
    if(sum % 10 != 0){
        println(sum)
        return
    }
    for(i in 0 until n){
        val result = sum - sList[i]
        if(result % 10 != 0){
            println(result)
            return
        }
    }
    println(0)
}

Measured memory_bytes: 33532
a, b = gets.chomp.split(" ").map(&:to_i)
(1..100000).each do |i|
    hachi = i * 8 / 100
    zyuu = i *10 / 100
    if hachi.floor == a && zyuu.floor == b
        puts i
        exit
    end
end
puts "-1"

Measured memory_bytes: 14396
#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
using namespace std;
const int MAX=1e2+5; 
//显示数组 
void showArray(int a[],int n){
	for(int i=0;i<n;i++){
		if(i>0){
			printf(" ");
		}
		printf("%d",a[i]);
	}
	printf("\n");
}
//插入排序 
void insertSort(int is[],int n){
	for(int i=1;i<n;i++){
		showArray(is,n);
		int t=is[i]; 
		int j;
		for(j=i-1;j>=0;j--){
			if(t<is[j]){
				is[j+1]=is[j];
				continue;
			}
			break;
		}
		is[j+1]=t;
	}
	showArray(is,n);
}

int main(){
	int n;
	int num[MAX];
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		scanf("%d",&num[i]);
	}
	insertSort(num,n);
	return 0;
}


Measured memory_bytes: 3232
def ini(): return int(input())
def inli(): return list(map(int, input().split()))
def inf(): return float(input())
def inlf(): return list(map(float, input().split()))
def inl(): return list(input())
def pli(): return "".join(list(map(str, ans)))
x = inli()
x = list(set(x))
print(len(x))

Measured memory_bytes: 3064
/*----------------by syr----------------*/
/*

         iii                  ii
     rBQBBBBBBE       BBR iBBBBQBBL     XBBBBBBQBBBBB
   iBBQJ    7BBB      BBsSBBr   BBQ      i      cBBB
  rBBU       iBBw     BBBQi     HBBi           KBBi
  BBH         BB5    iBBB       isL          wBB5
 GBB         iBBi    6BB                   iBBB
 BBQ         BQB     BBD                  QBBi
 BBB        BQB     iQBi                1BBv
 sBBg     wBBB      QBB               iBBB
  7BBBBBBBBBi       BBR              wBBBBBBBBBBBBB
     irvi           ii               ii    i i iii
                i5U
               BBB
               BB7
              1BB
      iPBBBBBKBBR    JBR1       rQBO   BR  UBQP  iBBQi
    7BBBGs7sXBBBi     QBBr     gBBE   rBB BB2BB7HBZQBB
   QBBi      sBQ       BBB   iBBB     SQBBR  BBBB  cBQ
  gBQ        BBg        BBB KBBi      MBBH   BBB   BBs
 iBBv       iBBi         QBBBL        BBR   pBB   iBB
 pBB        BBB         iBBBB        iBB    BBL   KBB
 MBB       BBBR        BBB JBBi      DBR   iBQ    BBL
 GBB     7BBBB2      PBBH   BBBi     BQr   DBB   iBB
  BQBXwgBBP BB7    1BBB      BBQ7   1BB    BBc   BBB
   2BBBBw   BB    EBBS        QBBi  HBa   iBB    BB7
*/
#include<bits/stdc++.h>

using namespace std;

#define PH push
#define MP make_pair
#define PB push_back
#define fst first
#define snd second
#define FOR(i, x, y) for(int i = (x); i < (y); ++i)
#define REP(i, x, y) for(int i = (x); i <= (y); ++i)
#define x0 x0123456789
#define y0 y0123456789
#define x1 x1234567890
#define y1 y1234567890
#define x2 x2345678901
#define y2 y2345678901
typedef double db;
typedef long long ll;
typedef long double ldb;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int INF = 1e9 + 7;

int n, ans = INF;

int sum(int x){
	int ret = 0;
	for(; x; x /= 10)
		ret += x % 10;
	return ret;
}

int main(){
	scanf("%d", &n);
	REP(i, 1, n - 1)
		ans = min(sum(i) + sum(n - i), ans);
	printf("%d\n", ans);
	return 0;
}



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

using namespace std;
using int64 = long long;

constexpr int DEBUG = 0;

constexpr int64 INF = 1E9;

struct FlowEdge {
  const int from, to;
  const int64 cap;  // Capacity
  FlowEdge(int from, int to, int64 cap) : from(from), to(to), cap(cap) {}
};

int64 MaxFlow(int n, const vector<FlowEdge>& edges, int s, int t) {
  int m = edges.size();
  
  vector<vector<tuple<FlowEdge, int>>> graph(n);
  vector<int64> res_caps(2 * m);  // Edge ID to residual capacity
  vector<int> to_reverse(2 * m, -1);  // Edge ID to the reverse edge ID
  for (int i = 0; i < m; i++) {
    const auto& edge = edges[i];
    graph[edge.from].push_back(make_tuple(edge, i));
    graph[edge.to].push_back(
        make_tuple(FlowEdge(edge.to, edge.from, 0), m + i));
    res_caps[i] = edge.cap;
    to_reverse[i] = m + i;
    to_reverse[m + i] = i;
  }

  int64 total = 0;
  while (true) {
    queue<int> q;
    vector<int> prevs(n, -1);
    vector<int> used_edges(n, -1);
    q.push(s);
    while (!q.empty()) {
      int v = q.front();
      q.pop();
      for (const auto& edge_tuple : graph[v]) {
        FlowEdge edge = get<0>(edge_tuple);
        int edge_id = get<1>(edge_tuple);
        if (res_caps[edge_id] == 0 || prevs[edge.to] >= 0) continue;
        prevs[edge.to] = v;
        used_edges[edge.to] = edge_id;
        q.push(edge.to);
      }
    }

    if (prevs[t] == -1) return total;

    int cur = t;
    vector<int> path;
    while (cur != s) {
      path.push_back(used_edges[cur]);
      cur = prevs[cur];
    }

    int64 inc = INT64_MAX;
    for (int edge_id : path) {
      inc = min(inc, res_caps[edge_id]);
    }

    total += inc;

    for (int edge_id : path) {
      res_caps[edge_id] -= inc;
      res_caps[to_reverse[edge_id]] += inc;
    }
  }
}

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

  int h, w;
  cin >> h >> w;
  vector<string> board(h);
  for (int y = 0; y < h; y++) {
    cin >> board[y];
  }

  auto c_id_fn = [&h](int x) {
    return h + x;
  };
  int s_id = h + w;
  int t_id = h + w + 1;

  int sx = -1, sy = -1, tx = -1, ty = -1;
  vector<FlowEdge> edges;
  for (int y = 0; y < h; y++) {
    for (int x = 0; x < w; x++) {
      char c = board[y][x];
      if (c == 'S') {
        sx = x;
        sy = y;
        edges.push_back(FlowEdge(s_id, y, INF));
        edges.push_back(FlowEdge(s_id, c_id_fn(x), INF));
      } else if (c == 'T') {
        tx = x;
        ty = y;
        edges.push_back(FlowEdge(y, t_id, INF));
        edges.push_back(FlowEdge(c_id_fn(x), t_id, INF));
      } else if (c == 'o') {
        edges.push_back(FlowEdge(y, c_id_fn(x), 1));
        edges.push_back(FlowEdge(c_id_fn(x), y, 1));
      }
    }
  }

  if (sx == tx || sy == ty) {
    cout << -1 << endl;
    return 0;
  }

  int64 max_flow = MaxFlow(h + w + 2, edges, s_id, t_id);
  cout << max_flow << endl;
}

Measured memory_bytes: 2300
#include <iostream>
#include <vector>
#include <algorithm>
#include <tuple>
using namespace std;
int64_t s[100001];
int64_t t[100001];
int64_t S[100001];

typedef tuple<int64_t,int64_t,int64_t> Tu;
vector<Tu> V;

int main(){
    int64_t T;
    int N;
    cin>>T>>N;
    int64_t sum=0;
    for(int i=0;i<N;i++){
        cin>>s[i]>>t[i];
        V.emplace_back(s[i],sum,t[i]);
        S[i]=sum;
        sum+=t[i]-s[i];
    }
    s[N]=t[N]=1000000000000001;
    S[N]=sum;
    int64_t ans=0;
    for(int i=0;i<N;i++){
        int up=upper_bound(s,s+N+1,s[i]+T)-s-1;
        int64_t length=S[up]-S[i];
        length+=min(s[i]+T,t[up])-s[up];
        ans=max(ans,length);
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 7760
#include <iostream>
#include <map>
#include <vector>

using namespace std;
struct node {
    node() {};
    node(int i, int n, int* xs) : id {i}, ns {vector<int>(xs, xs+n)} {
        delete xs;
    };
    int id;
    vector<int> ns;
    int in_time;
    int out_time;
};

int dfs(map<int, node*> graph, int time, int id){
    node* n = graph[id];
    if(n->in_time > 0){
        return time;
    }
    n->in_time = ++time;
    vector<int> ns = n->ns;
    for(auto it = ns.begin(); it != ns.end(); ++it){
        time = dfs(graph, time, *it);
    }
    n->out_time = ++time;
    return time;
}

int main(){
    int n;
    cin >> n;
    map<int, node*> graph {};
    int st = 1000000000;
    for(int i = 0; i < n; ++i){
        int id;
        cin >> id;
        st = min(st, id);
        int k;
        cin >> k;
        int* ns = new int[k];
        for(int j = 0; j < k; ++j){
            cin >> ns[j];
        }
        graph[id] = new node(id, k, ns);
    }
    int time = 0;
    for(auto it = graph.begin(); it != graph.end(); ++it){
        pair<int, node*> p = *it;
        if(p.second->in_time){
            continue;
        }
        time = dfs(graph, time, p.first);
    }
    for(auto it = graph.begin(); it != graph.end(); ++it){
        pair<int, node*> p = *it;
        cout << p.first << ' ' << p.second->in_time << ' ' << p.second->out_time << endl;
    }
}

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

int32_t main()
{
	int n,k;
	cin>>n>>k;
	int a[n];
	for(int i=0; i<n; i++)
	{
		cin>>a[i];
	}
	sort(a,a+n);
	int sum=0;
	for(int i=0; i<k; i++)
	{
		sum=sum+a[i];
	}
	cout<<sum<<endl;
}

Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long
#define fx(p) for(int x=0;x<(p);x++)
#define fy(p) for(int y=0;y<(p);y++)
#define fz(p) for(int z=0;z<(p);z++)
#define fzg(p,g) for(int z=(g);z<(p);z++)
#define ce(d) cout<<d<<endl;

int main() {
  int N;
cin >> N;
fx(100000){
if((x+1)*(x+1)>N){
ce(x*x);
break;
}
}
}

Measured memory_bytes: 384
using System;
using System.Linq;
using System.Text;

namespace ITP1_5_B
{
    class Program
    {
        static void Main(string[] args)
        {
            var sb = new StringBuilder();
            while (true)
            {
                var input = Console.ReadLine().Split(' ');
                if (input.All(s => s == "0"))
                    break;
                var H = int.Parse(input[0]);
                var W = int.Parse(input[1]);
                var p1 = new string('#', W);
                var p2 = string.Format("#{0}#", new string('.', W - 2));
                sb.AppendLine(p1);
                for (int i = 2; i < H; i++)
                    sb.AppendLine(p2);
                sb.AppendLine(p1);
                sb.AppendLine();
            }
            Console.Write(sb);
        }
    }
}

Measured memory_bytes: 9496
a,b,c,d = gets.chomp.split('').map(&:to_i)

['+','-'].product(['+','-'],['+','-']).each do |item|
  str = "#{a.to_s}#{item[0]}#{b.to_s}#{item[1]}#{c.to_s}#{item[2]}#{d.to_s}"
  if eval(str) == 7
    puts str+'=7'
    break
  end
end

Measured memory_bytes: 2044
while True:
    n = int(input())
    if n == 0:
        break
    scores = [int(x) for x in input().split()]
    ave = sum(scores)/n
    resi = 0
    for s in scores:
        resi += (s-ave)**2
    sd = (resi/n)**0.5
    print('{:.6f}'.format(sd))



Measured memory_bytes: 5680
#include<bits/stdc++.h>
using namespace std;
char maps[7][7];
int a[7],b[7];
int main()
{
	int sum=0,ans=0;
	int n,m,k;
	cin>>n>>m>>k;
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<m;j++)
		{
			cin>>maps[i][j];
			if(maps[i][j]=='#')
			{
				sum++;
				a[i]++;
				b[j]++;
			}
		}
	}
	for(int i=0;i<(1<<n);i++)
	{
		for(int x=0;x<(1<<m);x++)
		{
			int t=sum;
			for(int j=0;j<n;j++)
			{
				if(i&(1<<j))
					t-=a[j];
			}
			for(int y=0;y<m;y++)
			{
				if(x&(1<<y))
					t-=b[y];
			}
			for(int j=0;j<n;j++)
			{
				for(int y=0;y<m;y++)
				{
					if(i&(1<<j)&&x&(1<<y))
					{
						if(maps[j][y]=='#')
							t++;
					}
				}
			}
			if(t==k)
				ans++;
		}
	}
	printf("%d",ans);
 } 

Measured memory_bytes: 3760
#include <bits/stdc++.h>
#define rep(i,n)for(long long i=0;i<(n);i++)
using namespace std;
typedef long long ll;
const int MOD=1e9+7;
const int MAX = 1000000;
const ll INF = (1LL << 31) - 1;
const double pi=acos(-1);

ll n,x[101],y[101],h[101]; 
vector<tuple<ll,ll,ll>>vec;

int main(){
  cin >> n;
  tuple<ll,ll,ll>G;
  rep(i,n){
    cin >> x[i] >> y[i] >> h[i];
    if(h[i])G=make_tuple(x[i],y[i],h[i]);
  }
  rep(i,101){
    rep(j,101){
      ll v = get<2>(G)+abs(get<0>(G)-i)+abs(get<1>(G)-j); 
      bool flag = true;
      rep(k,n){
        ll H=v-abs(x[k]-i)-abs(y[k]-j);
        H=max(H,0ll);
        if(H!=h[k]) flag=false;
      }
      if(flag)vec.push_back(make_tuple(i,j,v));
    }
  }
  cout << get<0>(vec[0]) << " " << get<1>(vec[0]) << " " << get<2>(vec[0]) << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>

#define N 100000
#define REP(i, n) for(int i=0; i<n; ++i)
#define FORL(i, a, b) for(int i=a; i<b; ++i)
#define FORR(i, a, b) for(int i=a; i>b; --i)

using ll = long long;

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

int main() {
    int n;
    ll  a[N];
    ll  left[N], right[N];
    ll  ans = 0LL;
    std::cin >> n;
    REP(i, n) std::cin >> a[i];

    left[0] = a[0];
    FORL(i, 1, n) left[i] = gcd( left[i-1], a[i] );
    right[n-1] = a[n-1];
    FORR(i, n-2, -1) right[i] = gcd( right[i+1], a[i] );

    ans = std::max( left[n-2], right[1] );
    FORL(i, 1, n-1) ans = std::max(ans, gcd( left[i-1], right[i+1] ));

    std::cout << ans << std::endl;

    return 0;
}



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

int64_t mod = 1000000007;
int64_t large = 9223372036854775807;
double PI = 3.141592653589793;

int main()
{
    int A, B, K;
    cin >> A >> B >> K;
    for (int i = A; i < A + K; i++)
        if (i <= B)
            cout << i << endl;
    
    
    for (int i = B - K + 1; i <= B; i++)
        if (i > A + K - 1)
            cout << i << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<string>
using namespace std;
 int q,p,w[1000001],u[1000001],o;
 string a;
 int main()
 {
     cin>>a; 
     for (int i=0;i<a.size();i++) 
     {
         if (a[i]=='C') 
         {
             p++;
             u[p]=i+1;
         } 
         else if (a[i]=='F')
         {
            q++;
             w[q]=i+1;
         }
     } 
     if (q>=1 && p>=1)
     {
     for (int i=1;i<=p;i++)
     {
         for (int j=1;j<=q;j++)
         {
             if (u[i]<w[j])
             {
                 o=1;
             }
         }
     } 
     if (o==1) cout<<"Yes"<<endl; 
     else cout<<"No"<<endl;   
     }
     else cout<<"No"<<endl; 
     
 }  

Measured memory_bytes: 2304
// ReversingNumbers.cc
// 与えられた数列を逆順に出力するプログラムを作成して下さい。
// 【入力】
// 入力は以下の形式で与えられます：
//   n
//   a1 a2 . . . an
// n は数列の長さを示し、ai は i 番目の数を表します。
// 【出力】
// 逆順の数列を１行に出力して下さい。数列の要素の間に１つの空白を入れて下さい
// （最後の数の後に空白は入らないことに注意して下さい）。
// 【制約】
// ・n ≤ 100
// ・0 ≤ ai < 1000
// 【例】
// 入力：
// 5
// 1 2 3 4 5
// 出力：
// 5 4 3 2 1
//
// 入力：
// 8
// 3 3 4 4 5 8 7 9
// 出力：
// 9 7 8 5 4 4 3 3
#include<iostream>
using namespace std;

int main( void) {
  int n;
  int a[100];

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

  for ( int i = 0; i < n; i++) {
    cout << a[ n - i -1];
    if ( i != n-1) cout << " ";
  }
  cout << endl;

  return 0;
}


Measured memory_bytes: 3096
from bisect import bisect_right


def main():
    n = int(input())
    a = sorted(list(map(int, input().split())))
    b = sorted(list(map(int, input().split())))
    c = sorted(list(map(int, input().split())))
    l = [0] * n
    for index, i in enumerate(b):
        l[index] = n - bisect_right(c, i)
    s = [l[-1]] * n
    for i in range(n - 2, -1, -1):
        s[i] = s[i + 1] + l[i]
    ans = 0
    for i in a:
        j = bisect_right(b, i)
        if j < n:
            ans += s[j]
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 24484
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  double  x[n];
  string  y[n];
  for(int i=0; i<n; i++){
    cin >> x[i] >> y[i];
  }
  double sum = 0;
  for(int i=0; i<n; i++){
    if(y[i] == "JPY"){
      sum += x[i];
    }
    else{
      sum += 380000.0 * x[i];
    }
  }
  cout << sum << endl;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES

#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <functional>
#include <climits>
#include <cmath>
#include <utility>
#include <iomanip>

using namespace std;


int main(int argc, char *argv[])
{
	//input
	int n;
	cin >> n;

	vector<int> a;
	for (int i = 0; i < n; i++){
		int ai;
		cin >> ai;

		a.push_back(ai);
	}



	//calc
	string ans = "APPROVED";
	for (int i = 0; i < n; i++){
		if (a[i] % 2 == 0){
			if ((a[i] % 3 == 0) || a[i] % 5 == 0){
				continue;
			}
			else{
				ans = "DENIED";
				break;
			}
		}
	}


	//ans
	cout << ans << endl;



	return 0;
}


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

#define ll long long
#define fw(p) for(int w=0;w<(p);w++)
#define fx(p) for(int x=0;x<(p);x++)
#define fy(p) for(int y=0;y<(p);y++)
#define fz(p) for(int z=0;z<(p);z++)
#define fyg(p,g) for(int y=(g);y<(p);y++)
#define fzg(p,g) for(int z=(g);z<(p);z++)
#define ce(d) cout<<d<<endl;
#define vecp(p) int aa;cin>>aa;(p).push_back(aa);
#define vecpl(p) long long aa;cin>>aa;(p).push_back(aa);
#define vecps(p) string aa;cin>>aa;(p).push_back(aa);
#define vecp2(p) cin>>aa;(p).push_back(aa);
#define vecpl2(p) long long a	b;cin>>ab;(p).push_back(ab);
#define vecps2(p) string ab;cin>>ab;(p).push_back(ab);
#define sorts(c) sort((c).begin(),(c).end());
#define reverses(c) reverse((c).begin(),(c).end());
#define vec(b) vector<int> (b);
#define vecl(b) vector<long long> (b);
#define vecs(b) vector<string> (b);
#define pb(b,a) (b).push_back((a));
#define doublece(a,b) cout<<(a)<<' '<<(b)<<endl;
#define pairs(s) vector<pair<int,int>> (s);
#define pairsp(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define MOD 1000000007
#define cey ce("Yes")
#define cen ce("No")
#define ceY ce("YES")
#define ceN ce("NO")

int par1[100001];
int par2[100001];
int treesize[100001];
int treesize2[100001];
int group = 100000;

int find1(int x) {           //親探し
	if (par1[x] == x) {
		return x;
	}
	else {
		int z = find1(par1[x]);
		par1[x] = z;
		return z;
	}
}

int find2(int x) {           //親探し
	if (par2[x] == x) {
		return x;
	}
	else {
		int z = find2(par2[x]);
		par2[x] = z;
		return z;
	}
}

bool  unit1(int x, int y) {

	int xpar = find1(x);
	int ypar = find1(y);

	if (xpar == ypar) { return false; }   //すでに結合済み
	group--;
	par1[ypar] = xpar;
	treesize[xpar] += treesize[ypar];
	return true;
}

bool  unit2(int x, int y ) {

	int xpar = find2(x);
	int ypar = find2(y);

	if (xpar == ypar) { return false; }   //すでに結合済み
	group--;
	par2[ypar] = xpar;
	treesize2[xpar] += treesize2[ypar];
	return true;
}


int main()
{
	int N, M, K;
	cin >> N >> M >> K;
	
	fx(N) {
		par1[x + 1] = x + 1;
		treesize[x + 1] = 1;
	}
	vector<vector<int>> C(N+1);
	vector<vector<int>> D(N + 1);
	fx(M) {
		int a, b;
		cin >> a >> b;
		unit1(a,b);
		pb(C[a], b);
		pb(C[b], a);
	}

	fx(K) {
		int c, d;
		cin >> c >> d;
		pb(D[c], d);
		pb(D[d], c);
	}

	fx(N) {
		int count = 0;
		int sizeX = find1(x + 1);
		fy(D[x+1].size()) {
			if (sizeX ==find1(D[x+1][y])) {
				count++;
			}
		}

		fz(C[x + 1].size()) {
			if (sizeX == find1(C[x + 1][z])) {
				count++;
			}
		}

		cout <<max( treesize[sizeX] -1 -count,0) << "\n "[x != N - 1];
	}
    return 0;
}



Measured memory_bytes: 13176
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>

using namespace std;

typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vb> vbb;
typedef pair<int, int> pii;
typedef long long ll;
typedef unsigned long long ull;

#define all(a)  (a).begin(),(a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define pb push_back
#define mp make_pair

#define loop(i,a,b) for(int i=(a);i<ull(b);++i)
#define rep(i,n) loop(i,0,n)

const double eps = 1e-10;
const double pi  = acos(-1.0);
const double inf = (int)1e8;

int main(){
    int n;
    while(cin >> n, n){
        vi v(n);
        ll ans = 0;
        rep(i, n) cin >> v[i];
        sort(all(v));
        for(int i=0; i < n-1; i++){
            v[i+1] += v[i];
        }
        rep(i, n-1) ans += v[i];
        cout << ans << endl;
    }
}

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

public class Main {


		public static void main(String[] args) {
			BufferedReader input = new BufferedReader(new InputStreamReader(System.in));


			  try{
				  
				  String ab = input.readLine();
				  String[] strAry = ab.split(" ");

				 
				  int a = Integer.parseInt(strAry[0]);
				  
				  int b = Integer.parseInt(strAry[1]);
				  int c = Integer.parseInt(strAry[2]);
				  int num =0;
			
				  if(a>b){
					num=a;
					a=b;
					b=num;
				  }
				      if(b>c){
					     num=b;
					     b=c;
					     c=num;
				      }
				              if(a>b){
					           num=a;
					           a=b;
					           b=num;

				              }




				System.out.println(a+" "+b+" "+c);

			    }catch(IOException e) {   System.out.println("Exception : " + e);
			    }

		}
}

Measured memory_bytes: 24204
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n;
  cin >> n;
  
  vector<int> a(n);
  for(int i=0; i<n; i++){
    cin >> a[i];
  }
 
  vector<double> b(n);
  for(int j=0; j<n; j++){
    b[j] = 1.0 / a[j];
  }
  
  double sum=0.0;
  for(int k=0; k<n; k++){
    sum += b[k];
  }
  
  cout << fixed << setprecision(15);
  
  cout << 1/sum << endl;
  
}


Measured memory_bytes: 3716
#include<iostream>
#include<vector>
#include<string>
#include<map>

#define REP(i,j,k) for( int i=j; i<k; i++ )
#define rep(i,j) REP(i,0,j)

using namespace std;

typedef long int LI;

int main(){
	
	int n,h[100];
	
	cin >> n;
	rep(i,n) cin >> h[i];
	
	int cnt = 1;
	
	REP(i,1,n){
		bool flg = true;
		rep(j,i){
			if(h[j]>h[i]){
				flg = false;
				break;
			}
		}
		if(flg) cnt++;
	}
	
	cout << cnt << endl;
	
	return 0;
	
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <algorithm>
#include <iostream>
#include <string>
using namespace std;
#define rep(i,n) for (int i=0;i<(n);i++)
typedef long long ll;
bool aaa[11111111];
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
ll gcd(ll a, ll b) {
  if(a < b) return gcd(b, a);
  unsigned r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}
 
 
int main() {
  int n,c,aan,m,Q,memo=0,sx=0,sy=1,ans=0,gx,gy;
  string ka,ss;
  bool flag=true,flag1=false;
  cin>>ka;
  cin>>ss;
  rep(i,ka.size()){if(ka[i]!=ss[i])memo++;}
	  
  cout<<memo<<endl;
}

Measured memory_bytes: 3916