akhauriyash/Code-Regression huggingface dataset:
//#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define enl printf("\n")
#define case(t) printf("Case #%d: ", (t))
#define ni(n) scanf("%d", &(n))
#define nl(n) scanf("%lld", &(n))
#define nai(a, n) for (int i = 0; i < (n); i++) ni(a[i])
#define nal(a, n) for (int i = 0; i < (n); i++) nl(a[i])
#define pri(n) printf("%d\n", (n))
#define prl(n) printf("%lld\n", (n))
#define pii pair<int, int>
#define pll pair<long long, long long>
#define vii vector<pii>
#define vi vector<int>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
using namespace __gnu_pbds;
using namespace std;
typedef long long ll;
typedef cc_hash_table<int,int,hash<int>> ht;
const double pi = acos(-1);
const int MOD = 1e9 + 7;
const int INF = 1e9 + 7;
const int MAXN = 1e6 + 5;
const double eps = 1e-9;
int dp[MAXN], h[MAXN];

int main()
{
    int n, k;
    ni(n), ni(k);
    nai(h, n);
    dp[0] = 0;
    for (int i = 1; i < n; i++) {
        dp[i] = INF;
        for (int j = i - 1; j >= max(0, i - k); j--) {
            dp[i] = min(dp[i], dp[j] + abs(h[i] - h[j]));
        }
    }
    pri(dp[n - 1]);
    return 0;
}


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

public class Main {
    public static void main(String[] args) {
        MyScanner sc = new MyScanner();
        PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));
        int d = sc.nextInt(); int t  = sc.nextInt(); int s = sc.nextInt();
        double time = (double) d / s;
        out.println(d <= s * t ? "Yes" : "No");
        out.close();
    }


    //-----------MyScanner class for faster input----------
    public static class MyScanner {
        BufferedReader br;
        StringTokenizer st;

        public MyScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

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

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

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }


    }

}

Measured memory_bytes: 32828
#include<cstdio>
#include<algorithm>
#include<cstring>
#define rep(i, s, t) for(i = s; i <= t; ++i)

using namespace std;

const int N = 110;
int n, ans;
struct D{int a, b;} a[N], b[N];
bool vis[N];

bool cmp(D a, D b) {return a.a < b.a;}

int main() {
	int i, j, t;
	scanf("%d", &n);
	rep(i, 1, n) scanf("%d%d", &a[i].a, &a[i].b);
	rep(i, 1, n) scanf("%d%d", &b[i].a, &b[i].b);
	sort(b+1, b+n+1, cmp);
	rep(i, 1, n) {
		t = 0;
		rep(j, 1, n)
		if(!vis[j] && a[j].a < b[i].a && a[j].b < b[i].b) {
			if(!t || a[j].b > a[t].b) t = j;
		}
		if(t) {
			vis[t] = 1;
			++ans;
		}
	}
	printf("%d\n", ans);
	return 0;
}

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

int main(){
  int N,K;
  cin>>N>>K;
  vector<int> l(N);
  for(int i=0; i<N; i++){
    cin>>l[i];
  }
  
  sort(l.begin(),l.end());
  reverse(l.begin(),l.end());
  int sum=0;
  for(int i=0; i<K; i++){
    sum+=l[i];
  }
  cout << sum << endl;
  return 0;
}

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

int main() {
  int N;
  string S;
  cin>>N>>S;
  bool first=0,second=0,third=0;
  int ans=0;
  for(int i=0;i<1000;i++){
      int a=i/100,b=(i/10)%10,c=i%10;
      first=0,second=0,third=0;
      for(int j=0;j<N;j++){
          if(S[j]-'0'==a&&first==0) first=1,j++;
          if(S[j]-'0'==b&&first==1&&second==0) second=1,j++;
          if(S[j]-'0'==c&&second==1) third=1;
      }
      if(third) ans++;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
  int n, l, r;
  scanf("%i %i %i", &n, &l, &r);
  
  unsigned long long a[n];
  for (int i = 0; i < n; i++) {
    scanf("%llu", &a[i]);
  }
  
  for (int i = 0; i < n ; i++) {
    int min_idx = i;
    for (int j = i + 1; j < n; j++) {
      if (a[min_idx] > a[j]) {
        min_idx = j;
      }
    }
    
    unsigned long long tmp = a[i];
    a[i] = a[min_idx];
    a[min_idx] = tmp;
  }
    
  unsigned long long f[51][51];
  for (int i = 0; i <= 50; i++) {
    f[i][0] = f[i][i] = 1;
    for (int j = 1; j < i; j++) {
      f[i][j] = f[i-1][j] + f[i-1][j-1];
    }
  }
  
  unsigned long long p = 0, q = 1;
  for (int j = l; j <= r; j++) {
    unsigned long long sum = 0;
    for (int i = n-j; i < n; i++) {
      sum += a[i];
    }
    if (sum * q > p * j) {
      p = sum;
      q = j;
    }
  }
  
  unsigned long long tot = 0;
  for (int j = l; j <= r; j++) {
    unsigned long long sum = 0;
    for (int i = n-j; i < n; i++) {
      sum += a[i];
    }
    
    if (sum * q == p * j) {
      int count = 0;
      for (int i = 0; i < n; i++) {
        if (a[n-j] == a[i]) {
          count++;
        }
      }
      
      int m = 1;
      for (int i = n-j+1; i < n && a[i] == a[i-1]; i++) {
        m++;
      }
      
      tot += f[count][m];
    }
  }
  
  printf("%.7f\n%llu\n", (double)p / q, tot);
  
  return 0;
}

Measured memory_bytes: 128
#coding utf-8
N,M=map(int,input().split())
ans=0
ba = [[0 for _ in range(2)] for _ in range(M)]

for i in range(M):
  a,b = map(int, input().split())
  ba[i][0]=b
  ba[i][1]=a
  
ba.sort()

br=0
for b,a in ba:
  if not(a<br<b):
    br=b-0.5
    ans +=1
  
print(ans)

Measured memory_bytes: 23412
#include<iostream>
#include<vector>
#include<algorithm>
#include <queue>
#include<string>
#include<utility>
#include<iterator>
#include<regex>
#include<math.h>
#include<numeric>

#define lli long long
#define all(i) i.begin(),i.end()
#define rall(i) i.rbegin(),i.rend()
#define rep0(i,j) for(lli i=0;i<j;i++)
#define rep1(i,j) for(lli i=1;i<=j;i++)
#define rep0d(i,j) for(lli i=j-1;i>=0;i--)
#define MAX 1000000007
typedef struct tree Tree;

using namespace std;

bool cmpf(pair<lli, lli> left, pair<lli, lli> right) {
	return left.first < right.first;
}
bool cmp(pair<lli, lli> left, pair<lli, lli> right) {
	if (left.first != right.first)return left.first < right.first;
	else return left.second < right.second;
}

int main() {
	string s;
	cin >> s;
	string ans[] = { "Sunny", "Cloudy", "Rainy" };
	rep0(i, 3) {
		if (ans[i] == s)cout << ans[(i + 1) % 3];;
	}

}

Measured memory_bytes: 256
def main():
    n = int(input())
    a = list(map(int, input().split()))
    b = list(map(int, input().split()))
    c = list(map(int, input().split()))
    cnt = 0
    for i in range(n):
        cnt += b[a[i] - 1]
        if i > 0 and a[i] == a[i-1] + 1:
            cnt += c[a[i-1] - 1]
    print(cnt)

if __name__ == '__main__':
    main()

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

int main()
{
  int h, n, cnt = 0;
  cin >> h >> n;
  
  do
  {
    int a;
    cin >> a;
    h -= a;
    cnt++;
  }while(h > 0 && cnt < n);
  cout << (h <= 0 ? "Yes" : "No") << endl;
  return 0;
}

Measured memory_bytes: 3532
N,x=map(int,input().split())
a=[int(i) for i in input().split()]
for i in range(N):
  a.append(a[i])
dp=[[float("inf")]*N for i in range(N)]
ans=float("inf")
for k in range(N):
  for i in range(N):
    if k==0:
      dp[k][i]=a[N+i]
    else:
      dp[k][i]=min(dp[k-1][i],a[N+i-k])
  ans=min(ans,k*x+sum(dp[k]))
    
print(ans)
    
  

Measured memory_bytes: 140892
#include<iostream>
using namespace std;
int main(){
	int x1,y1,x2,y2,x3,y3,x4,y4;
	cin>>x1>>y1>>x2>>y2;
	x3=x2+(y1-y2);
	y3=y2+(x2-x1);
	x4=x1+(y1-y2);
	y4=y1+(x2-x1);
	cout<<x3<<" "<<y3<<" "<<x4<<" "<<y4;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#define rep(i,n) for(int i=0;i<(lint)(n);i++)
#define REP(i,n) for(int i=1;i<=(lint)(n);i++)
#define all(V) V.begin(),V.end()
#define stackReplaceBegin(size)\
	void* p=malloc(size);\
	esp_new=(lint)p+size-1;\
	void * stack_extend_memory_ = malloc(size);\
	void * stack_extend_origin_memory_;\
	char * stack_extend_dummy_memory_ = (char*)alloca((1+(int)(((long long)stack_extend_memory_)&127))*16);\
	*stack_extend_dummy_memory_ = 0;\
	asm volatile("mov %%rsp, %%rbx\nmov %%rax, %%rsp":"=b"(stack_extend_origin_memory_):"a"((char*)stack_extend_memory_+(size)-1024));
typedef long long lint;
typedef unsigned long long ulint;
typedef std::pair<int, int> P;
constexpr int INF = INT_MAX/2;
constexpr lint LINF = LLONG_MAX/2;
constexpr double eps = DBL_EPSILON;
constexpr double PI = 3.141592653589793238462643383279;
lint esp_new;
template<class T>
class prique :public std::priority_queue<T, std::vector<T>, std::greater<T>> {};
template <class T, class U>
inline bool chmax(T& lhs, const U& rhs) {
	if (lhs < rhs) {
		lhs = rhs;
		return 1;
	}
	return 0;
}
template <class T, class U>
inline bool chmin(T& lhs, const U& rhs) {
	if (lhs > rhs) {
		lhs = rhs;
		return 1;
	}
	return 0;
}
inline lint gcd(lint a, lint b) {
	while (b) {
		lint c = a;
		a = b; b = c % b;
	}
	return a;
}
inline lint lcm(lint a, lint b) {
	return a / gcd(a, b) * b;
}
bool isprime(lint n) {
	if (n == 1)return false;
	for (int i = 2; i * i <= n; i++) {
		if (n % i == 0)return false;
	}
	return true;
}
template<typename T>
T mypow(T a, unsigned int b) {
	T res(1),now(a);
	while(b){
		if(b&1)res*=now;
		b>>=1;
		now*=now;
	}
	return res;
}
template<typename T>
void printArray(std::vector<T>& vec) {
	rep(i, (int)vec.size() - 1)std::cout << vec[i] << " ";
	if(!vec.empty())std::cout << vec.back() << std::endl;
}
template<typename T>
void printArray(T l, T r) {
	T rprev = r;
	rprev--;
	for (T i = l; i != rprev; i++) {
		std::cout << *i << " ";
	}
	std::cout << *rprev << std::endl;
}
int main(){
	int n,a,ans=0;
	std::cin>>n;
	rep(i,n){
		std::cin>>a;
		if(i%2==0&&a%2)ans++;
	}
	std::cout<<ans<<std::endl;
	return 0;
}

Measured memory_bytes: 3632
#include <cstdio>
#include <iostream>
#include <vector>
#include <set>
#include <string>
#include <algorithm>
#include <cmath>

using namespace std;

const int CMax = 100002;

string S;
int n, A[CMax], ats;

int main() {
    cin >> S;
    S[3] = '8';
    cout << S;
}



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

int a,b;
long long ans;
int z[100000];
int main(){
    cin>>a>>b;
    for(int i = 0; i<a; i++)
        cin>>z[i];
    for(int i = 1; i<a; i++){
        if(z[i]+z[i-1]>b){
            int d = z[i]+z[i-1]-b;
            ans+=d;
            if(z[i]>d)
                z[i]-=d;
            else{
                z[i-1]-=z[i];
                z[i] = 0;
            }


        }
    }
    cout<<ans;

}


Measured memory_bytes: 768
#include "bits/stdc++.h"
using namespace std;

//素数判定
bool prime(long long  n) {
	if (1 == n) {
		return false;
	}
	for (long long i = 2; i*i <= n; i++) {
		if (0 == n % i) {
			return false;
		}
	}
	return true;
}

int main() {
	int N;
	cin >> N;
	vector<int>P;
	int now = 1;
	while (N != P.size()) {
		if (prime(now)) {
			P.push_back(now);
		}
		now += 5;
	}
	for (int i = 0; i < N; ++i) {
		if (0 != i) {
			cout << " ";
		}
		cout << P[i];
	}
	return 0;
}


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

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

Measured memory_bytes: 3624
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
using namespace std;
int main(){
	long long x,y;
	cin>>x>>y;
	int c=0;
	while(true){
		x*=2;
		c++;
		if(x>y)break;
	}
	cout<<c<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
 
int main() {
  
  int A, B, P=1;
  cin >> A >> B;
  int ans = 0;
  while(P<B){
    P = P + A - 1;
    ans++;
  }  
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
using System;
using System.Linq;

namespace CSharpScript
{
	class Program
	{
		static void Main(string[] args)
		{
			// Test("test");
			var a = int.Parse(Console.ReadLine());
			var b = int.Parse(Console.ReadLine());

			if ((a == 1 && b == 2) || (b == 1 && a == 2))
			{
				System.Console.WriteLine(3);
			}
			else if ((a == 1 && b == 3) || b == 1 && a == 3)
			{
				System.Console.WriteLine(2);
			}
			else
			{
				System.Console.WriteLine(1);
			}
		}
	}
}

Measured memory_bytes: 11092
#include <stdio.h>

int main()
{   int w,h,n;
    scanf("%d%d%d",&w,&h,&n);
    int x[n],y[n],a[n];
    for(int i=0;i<n;i++){
        scanf("%d%d%d",&x[i],&y[i],&a[i]);
    }
    int S[h][w];
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            S[i][j]=0;
        }
    }
    for(int i=0;i<n;i++){
        if(a[i]==1){
            for(int j=0;j<h;j++){
                for(int k=0;k<x[i];k++){
                    S[j][k]=1;
                }
            }
        }
        if(a[i]==2){
            for(int j=0;j<h;j++){
                for(int k=x[i];k<w;k++){
                    S[j][k]=1;
                }
            }
        }
        if(a[i]==4){
            for(int j=y[i];j<h;j++){
                for(int k=0;k<w;k++){
                    S[j][k]=1;
                }
            }
        }
        if(a[i]==3){
            for(int j=0;j<y[i];j++){
                for(int k=0;k<w;k++){
                    S[j][k]=1;
                }
            }
        }
    }    
    int ans=0;
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            if(S[i][j]==0){
                ans++;
            }
        }
    }
    printf("%d",ans);

    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <queue>
#include <sstream>
#include <stack>
#include <time.h>
#include <vector>
#include <complex>
#include <map>
#include <set>
#include <iomanip>
#include <math.h>
#include <stdlib.h>
#include <list>
#include <utility>
#include <memory>
#include <cstring>
#include <fstream>
#include <numeric>
#include <assert.h>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll A,B,Q;
ll s[100004];
ll t[100004];
ll x,ans;
ll ls(ll xx,int y){
	if (y==0) return 1e17;
	return xx-s[y-1];
}
ll rs(ll xx,int y){
	if (y==A) return 1e17;
	return s[y]-xx;
}
ll lt(ll xx,int y){
	if (y==0) return 1e17;
	return x-t[y-1];
}
ll rt(ll xx,int y){
	if (y==B) return 1e17;
	return t[y]-xx;
}
int main(){
	cin>>A>>B>>Q;
	for (ll i=0;i<A;i++) cin>>s[i];
	for (ll i=0;i<B;i++) cin>>t[i];
	for (ll i=0;i<Q;i++){
		ans=1e17;
		cin>>x;
		ll m1=lower_bound(s,s+A,x)-s;
		ll m2=lower_bound(t,t+B,x)-t;
		ll sl=ls(x,m1),sr=rs(x,m1),tl=lt(x,m2),tr=rt(x,m2);
		ans=min(ans,max(sl,tl));
		ans=min(ans,max(sr,tr));
		ans=min(ans,min(sl,tr)*2ll+max(sl,tr));
		ans=min(ans,min(sr,tl)*2ll+max(sr,tl));
		cout<<ans<<"\n";
	}
}

Measured memory_bytes: 2816
#include<iostream>
#include<queue>
#include<cstring>
using namespace std;

const long long maxn = 1e3 + 10;
const int Move[4][2] = {-1,0,1,0,0,1,0,-1};
char mp[maxn][maxn];
int step[maxn][maxn];
bool vis[maxn][maxn];
int n,m;

bool check(int x,int y) {
    if(x < 0 || y < 0|| x >= n || y >= m || vis[x][y] || mp[x][y] == '#') return false;
    return true;
}

int BFS() {
    queue<pair<int ,int> > q;
    q.push(make_pair(0,0));
    step[0][0] = 1;
    vis[0][0] = true;
    while (!q.empty()) {
        pair<int ,int> t = q.front();
        q.pop();
        for(int i = 0;i < 4;i++) {
            int tox = t.first + Move[i][0];
            int toy = t.second + Move[i][1];
            if(tox == n - 1 && toy == m - 1) return step[t.first][t.second] + 1;
            if(check(tox,toy)) {
                vis[tox][toy] = true;
                step[tox][toy] = step[t.first][t.second] + 1;
                q.push(make_pair(tox,toy));
            }
        }
    }
    return -1;
}


int main(){ 
    cin>>n>>m;
    int cnt = 0;
    for(int i = 0;i < n;i++)
        for(int j = 0;j < m;j++) {
            cin>>mp[i][j];
            if(mp[i][j] == '#') cnt++;
        }
    int res = BFS();
    if(res == -1) {
        cout<<"-1"<<endl;
    } else {
        cout<<n*m - res - cnt<<endl;
    }
    return 0;
}

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

using namespace std;

typedef long long ll;

const ll MOD = 1000000007;

const ll inv2 = (MOD + 1) / 2;

ll dp[5001][5001];

int main() {
	
	int n;
	string s;
	cin >> n >> s;
	dp[0][0] = 1;

	for (int i = 1; i <= n; i++) {
		for (int j = 0; j <= n; j++) {
			if (j == 0)dp[i][j] += dp[i - 1][j];//Bを何もない状態で押す
			//任意の指定の長さの列を数え上げることにしてるので、
			if (j >= 1)dp[i][j] += dp[i - 1][j - 1] * 2;//(1, 0)のどれを出してもいいため、2倍
			if (j <= n - 1)dp[i][j] += dp[i - 1][j + 1];//Bで一文字消してるため、1通りの操作しかない
			dp[i][j] %= MOD;
		}
	}
	ll ans = dp[n][s.size()];
	for (int i = 0; i < s.size(); i++) {
		ans *= inv2;
		ans %= MOD;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 195584
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <string>
#include <cstring>
#include <vector>
#include <queue>

using namespace std;

void init(){

}

void solve(){
    int a, n;
    scanf("%d %d", &n, &a);
    if(n < a) printf("0\n");
    else printf("10\n");
}

const bool mtc = false;

int main(){
    int t;
    if(mtc){
        scanf("%d", &t);
        while(t--) solve();
    }
    else solve();
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define ll long long
#define ld long double
#define fi first
#define se second
#define mp make_pair
#define pb push_back
const ll mod = 1e9 + 7;
int main()
{
	SPEED
	string s;
	cin >> s;
	if (s=="ABC")
	{
		cout << "ARC";
	}
	else
	{
		cout << "ABC";
	}
	return 0;
}

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

#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define debug(x) cerr << #x << ": " << x << ", "
#define debugln(x) cerr << #x << ": " << x << '\n'

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

using namespace std;
using ll = long long;
using P = pair<ll, ll>;

//constexpr ll mod = 998244353;
constexpr ll mod = 1e9+7;
const double PI = acos(-1.0);
mt19937_64 engine(chrono::steady_clock::now().time_since_epoch().count());

vector<int> rotate(vector<int>& vec, int i) {
  vector<int> ret = {vec[(0+i)%4], vec[(1+i)%4], vec[(2+i)%4], vec[(3+i)%4]};
  return ret;
}

vector<int> getfirst(vector<int>& v) {
  vector<vector<int>> ret(4, vector<int>(4));
  rep(p, 4) {
    ret[p] = rotate(v, p);
  }
  sort(ret.begin(), ret.end());
  return ret[0];
}

int getdup(const vector<int>& vec) {
  if (vec[0] == vec[1] && vec[1] == vec[2] && vec[2] == vec[3]) {
    return 4;
  } else if (vec[0] == vec[2] && vec[1] == vec[3]) {
    return 2;
  } else {
    return 1;
  }
}

signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);

  int n; cin >> n;
  vector<vector<int>> tiles(n, vector<int>(4));
  map<vector<int>, int> mp;
  rep(i, n) {
    int a, b, c, d; cin >> a >> b >> c >> d;
    tiles[i] = {a, b, c, d};
    tiles[i] = getfirst(tiles[i]);
    mp[tiles[i]]++;
  }

  ll ans = 0;
  rep(i, n-5) {
    vector<int> ti = tiles[i];
    mp[ti]--;
    for(int j=i+1; j<n; j++) {
      mp[tiles[j]]--;
      rep(k, 4) {
        vector<int> tj = rotate(tiles[j], k);
        vector<vector<int>> dice(4, vector<int>(4));
        dice[0] = {ti[0], tj[1], tj[0], ti[1]};
        dice[1] = {ti[1], tj[0], tj[3], ti[2]};
        dice[2] = {ti[2], tj[3], tj[2], ti[3]};
        dice[3] = {ti[3], tj[2], tj[1], ti[0]};
        map<vector<int>, int> mp2;
        rep(l, 4) {
          mp2[getfirst(dice[l])]++;
        }
        ll now = 1;
        for(auto& e: mp2) {
          int cnt = mp[e.first];
          int num = e.second;
          int dup = getdup(e.first);
          for(int p=1; p<=num; p++) {
            now *= cnt*dup;
            cnt--;
          }
        }
        ans += now;
      }
      mp[tiles[j]]++;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 140032
N, W = map(int, input().split())
V = 10**5
weight = [[float("inf") for i in range(V + 1)] for j in range(N + 1)]
weight[0][0] = 0
for i in range(1, N + 1):
    w, v = map(int, input().split())

    for j in range(V + 1):
        if j - v >= 0:
            weight[i][j] = min(weight[i-1][j-v] + w, weight[i-1][j])
        else:
            weight[i][j] = weight[i-1][j]

ans = 0
for j in range(V + 1):
    if weight[N][j] <= W:
        ans = max(ans, j)

print(ans)

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

using namespace std;

typedef uint64_t u64;
typedef int64_t s64;
typedef uint32_t u32;
typedef int32_t s32;
typedef vector<s32> vs32;
typedef vector<u32> vu32;
typedef vector<s64> vs64;
typedef vector<u64> vu64;

const double PI=3.14159265358979323846;

#define MAX(x, y) ((x) < (y) ? (y) : (x))
#define MIN(x, y) ((x) > (y) ? (y) : (x))

#define rep(i, N) for(int i = 0; i < N; ++i)

#define CEIL(x, y) (((x) + (y) - 1) / (y))
#define MOD 1000000007ULL

#define IN(l, r, x) ((l) <= (x) && (x) < (r))


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

    int n, k;
    cin >> n >> k;
    vs64 s(n + 1);
    s[0] = 0;
    s64 a;
    rep (i, n)
    {
        cin >> a;
        s[i + 1] = s[i] + a;
    }

    rep (i, n + 1)
    {
        s[i] = (s[i] - i) % k;
    }

    s64 ans = 0;
    int r = 0;
    map<s64, int> m;
    rep (l, n)
    {
        while (r <= n && r - l < k)
        {
            ++m[s[r]];
            ++r;
        }
        ans += --m[s[l]];
    }

    cout << ans << "\n";
    return 0;
}



Measured memory_bytes: 14336
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    void run() {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();

        switch (s) {
            case "SUN":
                System.out.println(7);
                break;
            case "MON":
                System.out.println(6);
                break;
            case "TUE":
                System.out.println(5);
                break;
            case "WED":
                System.out.println(4);
                break;
            case "THU":
                System.out.println(3);
                break;
            case "FRI":
                System.out.println(2);
                break;
            case "SAT":
                System.out.println(1);
                break;
        }

    }

    void debug(Object... os) {
        System.err.println(Arrays.deepToString(os));
    }

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


Measured memory_bytes: 19796
using System;
class Example
{
    static void Main()
    {
        while(true)
        { 
        string[] n = Console.ReadLine().Split(' ');
            if (int.Parse(n[0]) == 0)
                break;
        double a = double.Parse(n[0]);
        double b = double.Parse(n[1]);
        double c = double.Parse(n[2]);
        double r = 0;
        if (a <= c && b <= c)
            r = Math.Sqrt(a * a + b * b) / 2;
        if (a <= b && c <= b)
            r = Math.Sqrt(a * a + c * c) / 2;
        if (b <= a && c <= a)
            r = Math.Sqrt(b * b + c * c) / 2;

        int size = int.Parse(Console.ReadLine());
            for (int i = 0; i < size; i++)
            {
                double door = double.Parse(Console.ReadLine());
                if (door > r)
                    Console.WriteLine("OK");
                else Console.WriteLine("NA");
            }
        }
    }
}

Measured memory_bytes: 9156
#include <iostream>

using namespace std;

int digit;

void solve() {
  int a = digit / 1000;
  int b = (digit / 100) % 10;
  int c = (digit / 10) % 10;
  int d = digit % 10;
  for (int i=0;i<2;i++) {
    int sum = a + ((i == 0) ? b : -b);
    for (int j=0;j<2;j++) {
      int sum2 = sum + ((j == 0) ? c : -c);
      for (int k=0;k<2;k++) {
        int sum3 = sum2 + ((k == 0) ? d : -d);
        if (sum3 == 7) {
          cout << a << ((i == 0) ? '+' : '-')
               << b << ((j == 0) ? '+' : '-')
               << c << ((k == 0) ? '+' : '-')
               << d << "=7" << endl;
          return;
        }
      }
    }
  }
}

int main() {
  cin >> digit;
  solve();
}


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

int main(){
  string S;
  cin >> S;
  if(S[0]!='A'){
    cout << "WA" << endl;
    return 0;
  }
  int countC=0;
  for(int i=1; i<S.size(); i++){
    if(i>=2 && i<=S.size()-2 && S[i]=='C'){
      countC++;
    }else{
      if('a'>S[i] || S[i]>'z'){
        cout << "WA" << endl;
        return 0;
      }
    }
  }
  if(countC==1){
    cout << "AC" << endl;
    return 0;
  }
  cout << "WA" << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define db double
#define pint pair<int,int>
#define mk(x,y) make_pair(x,y)
#define fir first
#define sec second
#define Rep(x,y,z) for(int x=y;x<=z;x++)
#define Red(x,y,z) for(int x=y;x>=z;x--)
using namespace std;
const int MAXN=2e5+5;
char buf[1<<12],*pp1=buf,*pp2=buf,nc;int ny;
inline char gc() {return pp1==pp2&&(pp2=(pp1=buf)+fread(buf,1,1<<12,stdin),pp1==pp2)?EOF:*pp1++;}
//inline char gc(){return getchar();}
inline int read(){
	int x=0;for(ny=1;nc=gc(),(nc<48||nc>57)&&nc!=EOF;)if(nc==45)ny=-1;if(nc<0)return nc;
	for(x=nc-48;nc=gc(),47<nc&&nc<58&&nc!=EOF;x=(x<<3)+(x<<1)+(nc^48));return x*ny;
}
int n,a[MAXN];
map<int,int>F[2];
inline void upd(map<int,int>&F,int x,int y){if(!F.count(y))F[y]=x;else F[y]=min(F[y],x);}
int main(){
//	freopen("std.in","r",stdin);
//	freopen("std.out","w",stdout);
	n=read();
	Rep(i,1,n)a[i]=read();
	int now=0;F[0][0]=a[1],F[0][1]=0;
	Rep(i,2,n){
		now^=1,F[now].clear();
		int v1=0,v2=a[i]-a[i-1];
		if(v1>v2)swap(v1,v2);
		for(auto o:F[now^1])if(o.fir<=(*F[now^1].begin()).fir+1){
			if(o.sec+v1>0)upd(F[now],0,o.fir+2);
			if(o.sec+v1<=a[i])upd(F[now],max(o.sec+v1,0),o.fir+1);
			if(o.sec+v2<=a[i])upd(F[now],max(o.sec+v2,0),o.fir);
		}
	}int ans=n;
	for(auto o:F[now])ans=min(ans,o.fir+(o.sec>0));
	cout<<ans<<"\n";
	return 0;
}




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

#define mod 1000000007

#define rep(i, n) for(int i=0; i<n; ++i)

using namespace std;
typedef long long ll;
const long long INF = 1LL << 60;
 
int main(void){
	
	double N;
	
	cin >> N;
	
	int n = N / 2;
	
	cout << 1 - n / N;
	
	return 0;
}

Measured memory_bytes: 384
import java.util.Scanner;

public class Main {

    private static long dividableNum(long n, long x) {
        if (n == -1) {
            return 0;
        }
        return n / x + 1;
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long a = sc.nextLong();
        long b = sc.nextLong();
        long x = sc.nextLong();

        long count = 0;
        count = dividableNum(b, x) - dividableNum(a - 1, x);
        System.out.println(count);
    }

}


Measured memory_bytes: 21844
//code by parshuram_84
#include <bits/stdc++.h>
#define floop(i,a,n) for (int i=a;i<n;i++)
#define pii pair<int,int>
#define pll pair<long long,long long>
#define IOS std::ios::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL);cout.precision(dbl::max_digits10);
#define pb push_back
#define mod 1000000007 //998244353
#define ll long long
#define vi vector<int>
#define vll vector<long long>
#define vvl vector<vector<long long> >
#define vp vector<pair<long long,long long>>
#define vpp vector<pair<pair<long long,long long>,long long>>
#define mp make_pair
#define all(c) c.begin(),c.end()
#define tr(container, it) \
for(typeof(container.begin()) it = container.begin();it != container.end(); it++)
typedef std::numeric_limits< double > dbl;
using namespace std;
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
ll ncr(ll n,ll r) { ll p=1,k=1; if(n-r<r) r=n-r; if(r!=0) {while(r!=0) {p*=n; k*=r; ll temp=gcd(p,k); p/=temp; k/=temp; n--; r--;} } else p=1; return p;}
ll pm(ll x,ll n) {ll result=1; while(n>0){if(n%2==1) result=((result%mod)*(x%mod))%mod; x=((x%mod)*(x%mod))%mod; n/=2;} return result;}
ll p(ll x,ll n) {ll result=1; while(n>0){if(n%2==1) result=result*x; x=x*x; n/=2;} return result;}
ll factorial[300000+1];
void fact(ll n) { factorial[0]=1; factorial[1]=1; floop(i,2,n+1) factorial[i] = (i * factorial[i-1]%mod) % mod; }

int32_t main() {
	IOS;
	ll t,i,j,k,n,x,y,z;
	string s;
	t=1;
	for(i=0;i<t;i++)
	{
		cin>>n;
		if(n==0) cout<<"1";
		else cout<<"0";
	}
	return 0;
}

Measured memory_bytes: 3648
import java.io.PrintWriter
import java.util.*
import kotlin.math.floor

val pw = PrintWriter(System.out)
val sc = Scanner(System.`in`)

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val n = next()
    abc000a(n)
}

fun abc000a(n:String) {
    if(n == "ABC")  println("ARC") else println("ABC")
}


fun next() = readLine()!!
fun nextInt() = next().toInt()
fun nextLong() = next().toLong()
fun nextDouble() = next().toDouble()
fun nextListOfString() = next().split(" ")
fun nextListOfInt() = nextListOfString().map { it.toInt() }
fun nextListOfLong() = nextListOfString().map { it.toLong() }
fun nextListOfDouble() = nextListOfString().map { it.toDouble() }



Measured memory_bytes: 36580
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i = (a); i <= (b); i++)
#define rng(a) a.begin(), a.end()
#define ina(n,a) cin >> n; for(int i = 1; i <= n; i++) cin >> a[i]
#define sz(x) (int)(x).size()
#define se second
#define fi first
#define prev            coyhhhhhhyoc    
#define next          sdNNNmNNNNNNNmds  
#define y0           hNNNNy_yNNNNNN_sNh
#define y1          mNNNNNdtdNNNNNNtsNNm
#define yn          mNNNNNNNNy___smNNNms
#define tm            oooooosyysooooot 
#define read               tyhyt        
#define rank              ytmNmo         
#define index              yyy
#define pb push_back
#define pcnt __builtin_popcountll
#define rrep(i,a,b) for(int i = (b); i >= (a); i--)
#define rall(x,a) for(auto x : a)
#define MOD 1000000007
#define endl "\n"
#define int long long
typedef long long ll;
using namespace std;

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int n, k;
    cin >> n >> k;
    n %= k;
    int ans = min(n, abs(n - k));
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
public static void main(String[] args){
Scanner scan=new Scanner(System.in);
String num=scan.next();
  
if(num.equals("a")){
    System.out.println("b");
}else if(num.equals("b")){
    System.out.println("c");
}else if(num.equals("c")){
    System.out.println("d");
}else if(num.equals("d")){
    System.out.println("e");
}else if(num.equals("e")){
    System.out.println("f");
}else if(num.equals("f")){
    System.out.println("g");
}else if(num.equals("g")){
    System.out.println("h");
}else if(num.equals("h")){
    System.out.println("i");
}else if(num.equals("i")){
    System.out.println("j");
}else if(num.equals("j")){
    System.out.println("k");
}else if(num.equals("k")){
    System.out.println("l");
}else if(num.equals("l")){
    System.out.println("m");
}else if(num.equals("m")){
    System.out.println("n");
}else if(num.equals("n")){
    System.out.println("o");
}else if(num.equals("o")){
    System.out.println("p");
}else if(num.equals("p")){
    System.out.println("q");
}else if(num.equals("q")){
    System.out.println("r");
}else if(num.equals("r")){
    System.out.println("s");
}else if(num.equals("s")){
    System.out.println("t");
}else if(num.equals("t")){
    System.out.println("u");
}else if(num.equals("u")){
    System.out.println("v");
}else if(num.equals("v")){
    System.out.println("w");
}else if(num.equals("w")){
    System.out.println("x");
}else if(num.equals("x")){
    System.out.println("y");
}else if(num.equals("y")){
    System.out.println("z");
}

}
}

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

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

    int ans = sum;
    int leftsum = 0;

    for(int j=0; j<n; j++){
        leftsum += w[j];
        ans = min(ans, abs(leftsum-(sum-leftsum)));
    }
    cout << ans ;
    return 0;
}

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

typedef complex<double> Point;
typedef pair<Point, Point> Line;
const double EPS = 1e-5;
#define LE(n,m) ((n) < (m) + EPS)

vector<Line> tangentLines(Point a, double ar, Point b, double br) {
  vector<Line> ls;
  double d = abs(b-a);
  rep (i,2) {
    double sin = (ar - (1-i*2)*br) / d;
    if (!LE(sin*sin, 1)) break;
    double cos = sqrt(max(1 - sin*sin, 0.0));
    rep (j,2) {
      Point n = (b-a) * Point(sin, (1-j*2)*cos) / d;
      ls.push_back(Line(a + ar*n, b + (1-i*2)*br*n));
      if (cos < EPS) break;  // ??????????????\?????????????????????????????????????????????????????????
    }
  }
  return ls;
}

int main(void){
    double c1x,c1y,c1r,c2x,c2y,c2r;
    cin>>c1x>>c1y>>c1r>>c2x>>c2y>>c2r;
    cout<<tangentLines(Point(c1x,c1y),c1r,Point(c2x,c2y),c2r).size()<<endl;
    return 0;
}

Measured memory_bytes: 3292
#include<bits/stdc++.h>
#define llu unsigned long long
#define ll long long
#define INF 0x3f3f3f3f
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"

using namespace std;

int main()
{
	fast
	ll t, sum=0;
	cin>>t;
	for(ll i=1; i<=t; i++)
	{
		if(i%3!=0 && i%5!=0)
		{
			//cout<<i;
			sum+=i;
		}
	}
	cout<<sum<<endl;
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using edge = struct {int to; ll cost;};

#define mod 1000000007
#define REP(i, n) for (int i = 0; i < n; i++)
#define INF (1 << 29)


void solve() {
    int x;
    cin >> x;
    vector<bool> primes(1000001, true);
    for(int i = 2; i <= 1000000; i++){
        if(!primes[i]) continue;
        if(primes[i]) {
            for(int j = 2; j*i <= 1000000; j++) primes[j*i] = false;
        }
    }
    for(int i = x; i <= 1000000; i++){
        if(primes[i]) {
            cout << i << "\n";
            return;
        }
    }
}

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

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

using namespace std;
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

typedef long long  ll;
#define endl '\n'


int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};


const int MOD = 1000000007;

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

int a, b;

void Input() {

    cin >> a >> b;
}

void Solve() {

    if(a < 10 && a > 0 && b < 10 && b > 0) {

        cout << a * b << endl;
    }
    else cout << -1 << endl;
}

int main() {

  cin.tie(0);
  ios::sync_with_stdio(false);
  Input();
  Solve();
  return 0;

}



Measured memory_bytes: 256
// ITP1_8_C Counting Characters
import java.io.*;

class Main {

   public static void main(String[] args) {
      BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
      try {
         String str;
         int[] alphabet = new int[26];
         while ((str = br.readLine()) != null) {
            if (str.equals(""))
               break;
            str = str.toLowerCase();
            char[] ch = str.toCharArray();
            for (char c: ch) {
               if ('a' <= c && c <= 'z'){
                  alphabet[c - 'a']++;
               }
            }
         }

         for (int i = 0; i < alphabet.length; i++) {
            System.out.println((char)('a' + i) + " : " + alphabet[i]);
         }
      }

      catch (Exception e) {
         System.err.println(e);
      }
   }
}

Measured memory_bytes: 16872
#include<cstdio>
#include<algorithm>
#include<iostream>
#include<cstring>
using namespace std;
int n,m;
struct qq
{
	int p,c;
}s[15];
bool ok[15];
int ans;
void check ()
{
	int lalal=0,now=0;
	for (int u=1;u<=n;u++)
	{
		if (ok[u])
		{
			lalal=lalal+s[u].p;
			now=now+u*s[u].p+s[u].c;
		}
	}
	if (now>=m)
	{
		ans=min(ans,lalal);
		return ;
	}
	for (int u=n;u>=1;u--)
	{
		if (ok[u]) continue;
		int t=(m-now);
		int need=t/u;
		if (t%u!=0) need++;
		if (s[u].p>=need)
		{
			lalal=lalal+need;
			ans=min(ans,lalal);
			return ;
		}
		else
		{
			lalal=lalal+s[u].p;
			now=now+u*s[u].p+s[u].c;
		}
		if (now>=m)
		{
			ans=min(ans,lalal);
			return ;
		}
	}
}
void dfs (int x)
{
	if (x>n)	
	{
		check();
		return ;
	}
	ok[x]=true;dfs(x+1);
	ok[x]=false;dfs(x+1);
}
int main()
{
	scanf("%d%d",&n,&m);m/=100;
	ans=(1<<28);
	for (int u=1;u<=n;u++)		
	{
		scanf("%d%d",&s[u].p,&s[u].c);
		s[u].c/=100;
	}
	dfs(1);
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;

namespace AtCoderABC113
{
    class Program
    {
        static int mod = 1000000007;
        public static void Main(string[] args)
        {
            int H, W, K;
            string[] s = Console.ReadLine().Split(' ');
            H = int.Parse(s[0]);
            W = int.Parse(s[1]);
            K = int.Parse(s[2]);
            List<List<int>> dp = new List<List<int>>();
            for (int i = 0; i < H + 1; i++)
            {
                List<int> newlist = new List<int>();
                for (int j = 0; j < W; j++) newlist.Add(0);
                dp.Add(newlist);
            }
            dp[0][0] = 1;

            for (int i = 0; i < H; i++)
            {
                for (int j = 0; j < W; j++)
                {
                    for (int k = 0; k < (1 << (W - 1)); k++)
                    {
                        bool flag = true;
                        for (int l = 0; l < W - 2; l++)
                        {
                            if ((((k >> l) & 1) == 1) && (((k >> (l + 1)) & 1) == 1))
                            {
                                flag = false;
                            }
                        }
                        if (flag)
                        {
                            if (j >= 1 && ((k >> (j - 1)) & 1) == 1)
                            {
                                dp[i + 1][j - 1] += dp[i][j];
                                dp[i + 1][j - 1] %= mod;
                            }
                            else if (j <= W - 2&& ((k >> j) & 1) == 1)
                            {
                                dp[i + 1][j + 1] += dp[i][j];
                                dp[i + 1][j + 1] %= mod;
                            }
                            else
                            {
                                dp[i + 1][j] += dp[i][j];
                                dp[i + 1][j] %= mod;
                            }
                        }
                    }
                }
            }
            Console.WriteLine(dp[H][K - 1]);
        }
    }
}

Measured memory_bytes: 11348
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 2e5+10 , OO = 0x3f3f3f3f;

#define clr(arr,val) memset(arr , val , sizeof (arr))
#define loop(i,n) for(int i = 0;i < int(n);i++)
#define rloop(i,n) for(int i = int(n)-1;i >= 0;i--)
#define range(i,a,b) for(int i = int(a);i <= int(b);i++)
#define ALL(v) ((v).begin()) , ((v).end())
#define SZ(v)  ((int)((v).size()))
typedef pair <int,int> pii ;
typedef vector < pii > vii ;
typedef vector < int > vi;
int dx[]={1,0,-1,0};int dy[]={0,1,0,-1}; //4 Direction
//int dx[]={1,1,0,-1,-1,-1,0,1};int dy[]={0,1,1,1,0,-1,-1,-1};//8 direction
//int dx[]={2,1,-1,-2,-2,-1,1,2};int dy[]={1,2,2,1,-1,-2,-2,-1};//Knight Direction
//int dx[6]={2,1,-1,-2,-1,1};int dy[6]={0,1,1,0,-1,-1}; //Hexagonal Direction
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);

int n ,a,b;


int main()
{   

      ios_base::sync_with_stdio(0);
      cin.tie(0);cout.tie(0);


      cin >> n >> a >> b;
      cout << min(n*a , b) << "\n";


      return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		int C = sc.nextInt();
		boolean ok = false;
		if(A == B && C != A)
			ok = true;
		else if(A == C && C != B)
			ok = true;
		else if(B == C && A != B)
			ok = true;
		System.out.println(ok ? "Yes" : "No");

	}

}

Measured memory_bytes: 24148
#include <stdio.h>
#include <vector>
#include <algorithm>

#define FOR(i, a, b) for(int (i) = (a); (i) < (b); ++(i))
#define REP(i, n) FOR(i, 0, n)

std::vector<uint> A, B, P, Q;

bool isBitUpAllXor(int n, int t){
    uint mask1 = 1U << t;
    uint mask2 = 1U << (t + 1); bool res = false;
    REP(i, n) P[i] = A[i] & (mask2 - 1), Q[i] = B[i] & (mask2 - 1);
    std::sort(Q.begin(), Q.end());
    REP(i, n){
        int x = P[i];
        uint u1 = (mask2 < x) ? 0 : mask2 - x,
             l1 = (mask1 < x) ? 0 : mask1 - x,
             u2 = ((mask2 << 1) < x) ? 0 : (mask2 << 1) - x,
             l2 = ((mask1 | mask2) < x) ? 0 : (mask1 | mask2) - x;
        auto uitr1 = std::lower_bound(Q.begin(), Q.end(), u1),
             litr1 = std::lower_bound(Q.begin(), Q.end(), l1),
             uitr2 = std::lower_bound(Q.begin(), Q.end(), u2),
             litr2 = std::lower_bound(Q.begin(), Q.end(), l2);
        uint s1 = std::distance(litr1, uitr1);
        uint s2 = std::distance(litr2, uitr2);
        if((s1 ^ s2) & 1) res = not res;
    }
    return res;
}

int main(void){
    int n; scanf("%d", &n);
    A.resize(n); REP(i, n) scanf("%u", &A[i]);
    B.resize(n); REP(i, n) scanf("%u", &B[i]);
    P.resize(n); Q.resize(n);
    uint res = 0;
    REP(i, 30) if(isBitUpAllXor(n, i)) res |= (1 << i);
    printf("%d\n", res);    
    return 0;
}

Measured memory_bytes: 3328
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;

#define repr(i, n) for(int i = n; i >= 0; i--)
#define reprl(i, n) for(ll i = n; i >= 0; i--)
#define all(v) v.begin(), v.end()

const ll mod=1000000007;

int countBits(int in){
  int res=0;
  for(int i=0;i<10;i++){
    int msk=1<<i;
    if((in&msk)!=0){
      res++;
    }
  }
  return res;
}

template<typename T>
void show2dVector(vector<vector<T>>& v){
  for(int i=0;i<v.size();i++){
    int m=v[i].size();
    cout<<i<<" : ";
    for(int j=0;i<m;i++){
      cout<<v[i][j]<<" ";
    }
    cout<<endl;
  }
}

void bfs(const vector<vector<int>>&g, int v, vector<bool>& seen){
  seen[v]=true;
  cout<<v<<" ";
  for(auto next: g[v]){
    if(seen[next]){
      continue;
    }
    bfs(g,next,seen);
  }
}

bool dfs(vector<vector<int>> &g,int start,int goal,vector<bool>&seen){
  bool res=false;
  seen[start]=true;
  if(start==goal){
    return true;
  }
  for(auto next: g[start]){
    if(seen[next]){
      continue;
    }
    res=dfs(g,next,goal,seen);
    if(res){
      break;
    }
  }
  return res;
}

ll gcd(ll a,ll b) {
  return b? gcd(b,a%b): a;  
}
ll lcm(ll a,ll b) {
  return a*b/gcd(a,b);
}
bool isLowerCase(char c){
  return (c>='a'&&c<='z');
}
const string outputYesNo(bool ans){
  return (ans?"Yes":"No");
}
int main() {
  int a,b,c,d;cin>>a>>b>>c>>d;
  int divT=c/b;if(c%b!=0)divT++;
  int divA=a/d;if(a%d!=0)divA++;
  cout<<outputYesNo(divT<=divA)<<endl;
  return 0;
}


Measured memory_bytes: 3632
n = int(input())
a = list(map(int, input().split()))
cnt = [0] * (10 ** 6 + 1)
a.sort()
ans = 0


for i in a:
    cnt[i] += 1

a = set(a)

for k in a:
    for l in range(k * 2, (10 ** 6 + 1), k):
        cnt[l] += 1

for m in a:
    if cnt[m] == 1:
        ans += 1
    


print(ans)

Measured memory_bytes: 128528
#include<iostream>
#include<iomanip>
#include<cmath>
using namespace std;

int main() {
	double n, x[1000], y[1000];
	cin >> n;
	for (int i = 0; i < n; i++) cin >> x[i];
	for (int i = 0; i < n; i++)	cin >> y[i];
	double a = 0;
	for (int i = 0; i < n; i++)	
		a += abs(x[i] - y[i]);
	cout << fixed << setprecision(5);
	cout << a << endl;
	double b = 0;
	for (int i = 0; i < n; i++){
		b += abs(x[i] - y[i]) * abs(x[i] - y[i]);
	} 
	cout << sqrt(b) << endl;
	double c = 0;
	for (int i = 0; i < n; i++){
		c += abs(x[i] - y[i]) * (x[i] - y[i]) * (x[i] - y[i]);
	}
	cout << pow(c, 1.0/ 3) << endl;
	double d = 0;
	double max = abs(x[0] - y[0]);
	for (int i = 0; i < n; i++){
		if (abs(x[i] - y[i]) > max)
			max = abs(x[i] - y[i]);
	}
	cout << max << endl;
	return 0;
}



Measured memory_bytes: 3440
import std.stdio;
import std.functional;
import std.math;
import std.algorithm;
import std.string;
import std.typecons;

struct P {
    int y, x;
}

int dist(P s, P t) {
    return abs(s.y - t.y) + abs(s.x - t.x);
}
int next(int c) {
    return (c + 1) % 5;
}
int prev(int c) {
    return (c + 5 - 1) % 5;
}

void main() {
    int X, Y; 
    string[] F;
    P s, g;
    P[][] cs;
    void init() {
        cs = new P[][5];
        foreach (i; 0 .. Y) {
            foreach (j; 0 .. X) {
                char c = F[i][j];
                if ('1' <= c && c <= '5') {
                    cs[c - '1'] ~= P(i, j);
                }
                if (c == 'S') {
                    s.y = i;
                    s.x = j;
                } 
                if (c == 'G') {
                    g.y = i;
                    g.x = j;
                }
            }
        }
    }
    int calc(int first) {
        //int[P][] dp = new int[P][5];
        int[][] dp = new int[][](5, 1001);
        foreach (i, c; cs[first.next]) {
            dp[first.next][i] = dist(s, c);
        }
        for (int i = first.next.next; i != first; i = i.next) {
            int p = i.prev;
            foreach (a, c; cs[i]) {
                dp[i][a] = int.max / 2;
                foreach (b, q; cs[p]) {
                    dp[i][a] = min(dp[i][a], dp[p][b] + dist(c, q));
                }
            }
        }
        int last = first.prev;
        int ans = int.max / 2;
        foreach (i, c; cs[last]) {
            ans = min(ans, dp[last][i] + dist(c, g));
        }
        return ans;
    }
    while (readf("%d %d\n", &X, &Y), X || Y) {
        F = new string[Y];
        foreach (ref L; F) L = readln.chomp;
        init;
        int ans = int.max / 2;
        int first = 0;
        foreach (i; 0 .. 5) {
            int cand = calc(i);
            if (ans > cand) {
                ans = cand;
                first = i + 1;
            }
        }
        if (ans == int.max / 2) {
            "NA".writeln;
        } else {
            first.writeln(" ", ans);
        }
    }
}

Measured memory_bytes: 4412