akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const ll MOD=1000000007;
const long double PI=3.14159265358979;

int main() {
  ll N,K;
  cin>>N>>K;
  set<ll> can;
  for(int i=0;i<K;i++){
    ll d;
    cin>>d;
    for(int j=0;j<d;j++){
      ll a;
      cin>>a;
      a--;
      can.insert(a);
    }
  }
  ll ans=0;
  for(int i=0;i<N;i++){
    if(!can.count(i)){
      ans++;
    }
  }
  cout<<ans;
}


Measured memory_bytes: 3636
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_DEPRECATE

#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <ctime>
#include <cassert>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>
#include <list>
#include <iomanip>
#include <fstream>
#include <iterator>
#include <bitset>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> Pii;
typedef pair<ll, ll> Pll;

#define FOR(i,n) for(int i = 0; i < (n); i++)
#define sz(c) ((int)(c).size())
#define ten(x) ((int)1e##x)
#define tenll(x) ((ll)1e##x)
template<class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }

typedef pair<double, double> P;
typedef pair<P, double> Q;

int check(P& a, P& b){
	if (b.second < a.first || a.second < b.first) return 0;
	if (a.first <= b.first && b.second <= a.second) return 2;
	return 1;
}

int main(){
	int k; cin >> k;
	vector<Q> v;
	double r, l; cin >> r >> l;
	v.push_back(Q(P(r, l),1.0));

	double p, e, t; cin >> p >> e >> t;
	P a(t - e, t + e);

	double ans = 0;
	FOR(i, k){
		vector<Q> nxt;
		for (auto abc : v) {
			auto lr = abc.first;
			double md = (lr.first + lr.second) / 2;
			P p1(lr.first, md), p2(md, lr.second);
			double p1p = (md >= t) ? 1 - p : p;
			p1p *= abc.second;
			double p2p = abc.second - p1p;

			int p1check = check(a, p1);
			if (p1check == 1) nxt.emplace_back(p1, p1p);
			else if (p1check == 2)
				ans += p1p;

			int p2check = check(a, p2);
			if (p2check == 1) nxt.emplace_back(p2, p2p);
			else if (p2check == 2)
				ans += p2p;
		}
		v = nxt;
	}
	for (auto abc : v) {
		double md = (abc.first.first + abc.first.second) / 2;
		if (a.first <= md && md <= a.second) ans += abc.second;
	}

	printf("%.10lf\n",ans);
}

Measured memory_bytes: 1244
N, M = map(int, input().split())
A = list(map(int, input().split()))
ans = 0
total = 0
 
for i in range(len(A)):
    total += A[i]
A = sorted(A, reverse=True)
for i in range(M):
    if(A[i] >= total/(4*M)):
        ans += 1
    else:
        ans += 0
if(M == ans):
    print("Yes")
else:
    print("No")

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

using namespace std;

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

typedef long long ll;

const int Inf = 1e9;
const double EPS = 1e-9;
const int Mod = 1e9 + 7;

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

int lcm(int a, int b) {
    return a * b / gcd(a, b);
}

int bitCount(long bits) {
    bits = (bits & 0x55555555) + (bits >> 1 & 0x55555555);
    bits = (bits & 0x33333333) + (bits >> 2 & 0x33333333);
    bits = (bits & 0x0f0f0f0f) + (bits >> 4 & 0x0f0f0f0f);
    bits = (bits & 0x00ff00ff) + (bits >> 8 & 0x00ff00ff);
    return (bits & 0x0000ffff) + (bits >>16 & 0x0000ffff);
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    vector<string> s(2);
    ll ans = 1;
    int n;
    cin >> n;
    cin >> s[0] >> s[1];
    bool pre_hor = false;
    rep (j, n) {
        bool hor = false;
        if (s[0][j] == s[0][j + 1]) hor = true;
        if (j == 0) {
            if (hor) {
                ans *= 6;
                pre_hor = true;
                j++;
            } else ans *= 3;
            continue;
        }
        if (hor) {
            if (pre_hor) ans *= 3;
            else ans *= 2;
            pre_hor = true;
            j++;
        } else {
            if (!pre_hor) ans *= 2;
            pre_hor = false; 
        }
        ans = ans % Mod;
    }
    cout << ans << endl;
    
    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <cstring>
#include <cstdlib>
#include <queue>
#include <cmath>
#include <stack>
#include <iterator>
#include <bitset>
#include <iomanip>
#include <sstream>
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(x) x.begin(), x.end()
#define read freopen("input.txt","r",stdin);
#define write freopen("out.txt","w",stdout);
#define showtime cout << 1000.0 * clock() / CLOCKS_PER_SEC << " ms" << endl; 
#define pfi(a) printf("%d\n", a)
#define pfl(a) printf("%lld\n", a)
#define pfc(a) printf("%c\n", a)
#define pi acos(-1.0)
#define pf printf
#define sc scanf
#define new "\n"
using namespace std;
typedef pair<int, int> poii;
typedef pair<string , int> posi;
typedef map<int, int> moii;
typedef map<string, int> mosi;
typedef long long ll;
typedef unsigned long long ull;
typedef set<int>soi;
typedef set<string>sos;
typedef set<char> soc;
typedef vector<string> vos;
typedef vector <int> voi;

int main() 
{
    // fast;
    string s;
    int cnt = 0;
    cin >> s;
    for(int i = 0, j = s.size() - 1; j >= 0; ++i, --j) {
        if(s[i] != s[j]) ++cnt;
    }
    pf("%d\n", (cnt >> 1));
    // showtime;                    
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cmath>
#include <numeric>

using namespace std;

#define int long long
typedef long double ld;
#define pii pair<int, int>
#define vi vector<int>
#define vii vector<vi>
#define viii vector<vii>
#define vpii vector<pii>
#define vb vector<bool>
#define vbb vector<vb>
#define vs vector<string>
#define pb push_back
#define ff first
#define ss second
#define all(a) a.begin(), a.end()
#define in(a) for (int i = 0; i < (a).size(); ++i) cin >> (a)[i]
#define out(a) for (auto qwe : a) cout << qwe << " "

const int INF = 1e9;
const int INF64 = 1e18;
const int MOD = 1e9 + 7;
const int MOD9 = 1e9 + 9;
const int MOD3 = 998244353;
const int P = 37;

const int mxn = 300;

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

    int n;
    cin >> n;

    vi a(n);
    in(a);

    vi dp(n, 0);
    dp[0] = 0;

    for (int j = 1; j < n; ++j) {
        dp[j] = min(dp[j - 1] + abs(a[j - 1] - a[j]), (j > 1 ? dp[j - 2] + abs(a[j - 2] - a[j]) : INF));
    }

    cout << dp[n - 1];
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;

int main() {
  vector<bool> p(1000000, true);
  p[0] = false;
  p[1] = false;
  for (int i = 2; i <= 1000; i++) {
    if (p[i]) {
      for (int j = i * 2; j < 1000000; j += i) {
        p[j] = false;
      }
    }
  }

  int n;
  while (cin >> n) {
    int res = 0;
    for (int j = 0; j <= n; j++)
      if (p[j]) res++;
    cout << res << endl;
  }
}



Measured memory_bytes: 3124
import java.util.*;
import java.lang.Integer;

class Main {
    public static void main(String[] args) {
      Scanner sc = new Scanner(System.in);
      //LとRの範囲
      int N = sc.nextInt();
      //L,Rの組数
      int M = sc.nextInt();
      
      //Lの最大値格納
      int maxL = 0;
      //Rの最小値格納
      int minR = N;
      
      for(int i = 0; i < M; i++){
        //今回のLR格納
        int L = sc.nextInt();
        int R = sc.nextInt();
        //最大最小チェック
        if(maxL < L){
          maxL = L;
        }
        if(minR > R){
          minR = R;
        }
      }
      if( minR - maxL < 0){
        System.out.println(0);
      }
      else{
        System.out.println(minR-maxL+1);
      }
    }
}

Measured memory_bytes: 62768
#include <bits/stdc++.h>
#define write(x) printf("%d\n", x)
using namespace std;
typedef long long ll;
template <typename T>
void read(T &x)
{
	x = 0;
	char c;
	while (!isdigit(c = getchar()));
	do
	{
		x = (x << 1) + (x << 3) + (c ^ 48);
	}while (isdigit(c = getchar()));
}
int n;
ll D, A;
struct Monster
{
	ll x;
	ll h;
}M[200005];
bool operator <(Monster A, Monster B)
{
	return A.x < B.x;
}
struct SegmentTree
{
	int l, r;
	ll dat, add;
}t[800050];
ll X[200005];
ll H[200005];
void build(int p, int l, int r)
{
	t[p].l = l;t[p].r = r;
	if (l == r)
	{
		t[p].dat = H[l];
		return ;
	}
	int mid = (l + r) >> 1;
	build((p << 1), l, mid);
	build((p << 1) + 1, mid + 1, r);
	t[p].dat = t[(p << 1)].dat + t[(p << 1) + 1].dat;
}
void spread(int p)
{
	if (t[p].add)
	{
		t[(p << 1)].dat += t[p].add * (t[(p << 1)].r - t[(p << 1)].l + 1);
		t[(p << 1) + 1].dat += t[p].add * (t[(p << 1) + 1].r - t[(p << 1) + 1].l + 1);
		t[(p << 1)].add += t[p].add;
		t[(p << 1) + 1].add += t[p].add;
		t[p].add = 0;
	}
}
void change(int p, int v, int l, int r)
{
	if (l <= t[p].l && t[p].r <= r)
	{
		t[p].add += (ll)v;
		t[p].dat += (ll)v * (t[p].r - t[p].l + 1);
		return ;
	}
	spread(p);
	int mid = (t[p].l + t[p].r) >> 1;
	if (l <= mid) change(p << 1, v, l, r);
	if (r > mid) change((p << 1) + 1, v, l, r);
	t[p].dat = t[(p << 1)].dat + t[(p << 1) + 1].dat;
}
ll ask(int p, int l, int r)
{
	if (l <= t[p].l && t[p].r <= r)
		return t[p].dat;
	spread(p);
	int mid = (t[p].l + t[p].r) >> 1;
	ll val = 0;
	if (l <= mid) val += ask(p << 1, l, r);
	if (r > mid) val += ask((p << 1) + 1, l, r);
	return val;
}
ll cnt;
int main()
{
	read(n);read(D);read(A);
	for (int i = 0;i < n;++i)
		read(M[i].x), read(M[i].h), M[i].h = (M[i].h + A - 1) / A;
	sort(M, M + n);
	for (int i = 0;i < n;++i)
	{
		X[i] = M[i].x;
		H[i] = M[i].h;
	}
	build(1, 0, n - 1);
	for (int i = 0;i < n;++i)
	{
		ll temp = ask(1, i, i);
		if (temp > 0)
		{
			int j = upper_bound(X, X + n, X[i] + 2 * D) - X - 1;
			cnt += temp;
			change(1, -temp, i, j);
		}
	}
	cout << cnt << endl;
	return 0;
}



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

#define int long long
#define fi first
#define se second
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()
#define yn(x) ((x) ? "Yes" : "No")

typedef pair <int, int> ii;
typedef pair <int, ii> iii;

const int siz = 1e2 + 10;
const int SIZ = 1e6 + 10;
const int mod = 1e9 + 7;
const int maxx = 2e9;
const int MAXX = 1e18;
const string file = "3";

bool check[siz];

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

//    freopen ((file + ".inp").c_str(), "r", stdin);
//    freopen ((file + ".out").c_str(), "w", stdout);

    int x, n;
    cin >> x >> n;

    for (int i = 1; i <= n; i++) {
        int a;
        cin >> a;

        check[a] = true;
    }

    int mn = maxx, ans = 0;
    for (int i = 0; i < siz; i++) {
        if (!check[i] && mn > abs(x - i)) {
            ans = i;
            mn = abs(x - i);
        }
    }

    cout << ans << "\n";

//    cerr << "Time: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";

    return 0;
}


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

int main(){
	int a=0,b=0;
	int num;
	for(int i=0;i<3;i++){
		cin >> num;
		if(num == 5)
			a++;
		if(num==7)
			b++;
	}
	cout << ((a==2 && b==1)?"YES":"NO") << endl;
}

Measured memory_bytes: 256
n=int(input())
a=list(map(int, input().split()))
ans=0
ruiseki=0
for i in range(n):
    idx = n-1-i
    ans += ruiseki * a[idx]
    ruiseki += a[idx]
    if ans >= 10**9+7:
        ans%=10**9+7

print(ans)


Measured memory_bytes: 31760
#include <iostream>
using namespace std;
#include <string>
int main() {
    int s;
    cin>>s;
    string a[s];
    for (int i = 0; i <s ; ++i) {
        cin>>a[i];
    }int z=0,x=0,n=0,m=0;
    for (int i = 0; i <s ; ++i) {
        if(a[i]=="AC")
            z++;
        else if(a[i]=="TLE")
            x++;
        else if(a[i]=="RE")
            n++;
        else 
            m++;
    }
    cout<<"AC x "<<z<<"\n";
    cout<<"WA x "<<m<<"\n";
    cout<<"TLE x "<<x<<"\n";
    cout<<"RE x "<<n;

}

Measured memory_bytes: 6668
#include <bits/stdc++.h>
#define ll long long

using namespace std;

int n;
ll slime[410];
ll dp[410][410][2]; //0 cena    1 vrednost
bool mark[410][410];

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

    cin>>n;

    for(int i=0;i<=n;i++)
        for(int j=0;j<=n;j++)
            dp[i][j][0]=LLONG_MAX;

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


    int levi,desni;
    for(int d=1;d<=n-1;d++)
    {
        levi=0;
        desni=levi+d;
        while(desni<n)
        {
            for(int j=0;j<d;j++)
            {
                ll tek=dp[levi][levi+j][0]+dp[levi+j+1][desni][0]+dp[levi][levi+j][1]+dp[levi+j+1][desni][1];
                if(tek<dp[levi][desni][0])
                {
                    dp[levi][desni][0]=tek;
                    dp[levi][desni][1]=dp[levi][levi+j][1]+dp[levi+j+1][desni][1];
                }
            }
            levi++;
            desni++;
        }
    }
   /* for(int i=0;i<n;i++)
        cout<<dp[i][i][0]<<endl;*/
    cout<<dp[0][n-1][0];

	return 0;
}


Measured memory_bytes: 2816
#include <stdio.h>
#define abs(a) ((a)<0 ? -(a) : (a))
int main(){
  int n, m;  scanf("%d%d", &n, &m);
  int student[55][2], check[55][2];
  int ans[55][2];
  for(int i=0; i<n; i++){
    scanf("%d%d", &student[i][0], &student[i][1]);
    ans[i][0] = 400000003;
  }
  for(int j=0; j<m; j++){
    scanf("%d%d", &check[j][0], &check[j][1]);
    for(int i=0; i<n; i++){
      if(abs(student[i][0]-check[j][0])+abs(student[i][1]-check[j][1])<ans[i][0]){
	ans[i][0] = abs(student[i][0]-check[j][0])+abs(student[i][1]-check[j][1]);
	ans[i][1] = j+1;
      }
    }
  }
  for(int i=0; i<n; i++)
    printf("%d\n", ans[i][1]);
  return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;

int main(){
	int N;
	cin >> N;
	int a[N], b[N];
	for(int i=0; i<N; i++){
		cin >> a[i];
	}
	for(int i=0; i<N; i++){
		cin >> b[i];
	}
	vector<pair<int , int>> P;
	for(int i=0; i<2*N; i++){
		if(i < N){
			P.push_back({a[i], 0});
		}else{
			P.push_back({b[i-N], 1});
		}
	}
	sort(P.begin(), P.end());
	long long ans = 1;
	int cnt = 0, c;
	for(int i=2*N-1; i>=0; i--){
		if(cnt == 0){
			c = P[i].second;
		}
		if(P[i].second != c){
			ans = (ans * cnt) % mod;
			cnt--;
		}else{
			cnt++;
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3188
#include <iostream>
using namespace std;
using ll = long long;
int checkNum(ll i)
{
	if( i == 2 || i == 4 || i == 7 || i == 9 || i == 5)
		return 0;
	else if( i == 3)
		return 1;
	else
		return -1;
}
int main() {
	ll n;
	cin>>n;
	if(checkNum(n%10) == 0)
		cout<<"hon";
	else if( checkNum(n % 10) == -1)
		cout<<"pon";
	else
		cout<<"bon";
	// your code goes here
	return 0;
}

Measured memory_bytes: 3624
import java.util.*;

public class Main{
    public static void main(String[]args){
	Scanner sc = new Scanner(System.in);
	int x =sc.nextInt();
	int y =sc.nextInt();
	int m =0;
	if(x==1 && y==1){
	    m=+700000;
	}else if(x==1){
	    m+=300000;
	}else if(x==2){
	    m+=200000;
	}else if(x==3){
	    m+=100000;
	}else{
	}

	if(y==1){
	    m+=300000;
	}else if(y==2){
	    m+=200000;
	}else if(y==3){
	    m+=100000;
	}else{
	}
	System.out.println(m);
    }
}


Measured memory_bytes: 21844
import java.util.Scanner;
//import java.io.*;
//import java.util.Arrays;
public class Main {
	public static void main(String[] args) throws java.io.IOException {
		Scanner scan = new Scanner(System.in);
		//InputStreamReader is = new InputStreamReader(System.in);
		//BufferedReader br = new BufferedReader(is);
		while(scan.hasNext()){
			int num1 = scan.nextInt();
			int num2 = scan.nextInt();
			while(true){
				if(num1 % num2 != 0){
					int amari = num1 % num2;
					num1 = num2;
					num2 = amari;
				}else{
					System.out.println(num2);
					break;
				}
			}
		}
	}
}

Measured memory_bytes: 26184
#include <iostream>

using namespace std;

int main()
{
    int a,b,c,d,q,w,e;
    cin >> a >> b >> c >> d;
    q=a-c;
    w=a-b;
    e=b-c;
    if(q<0)
        q=-q;
    if(w<0)
        w=-w;
    if(e<0)
        e=-e;
    if((a>=1 && a<=100) && (b>=1 && b<=100) && (c>=1 && c<=100) && (d>=1 && d<=100))
    {


    if(q<=d)

        cout << "Yes";

        else if(w<=d && e<=d)
            cout << "Yes";
            else
               cout << "No";

    }
    return 0;
}


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

#define debug(x) cerr<<#x<<'='<<x<<endl
#define set0(x) memset(x,0,sizeof(x))
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pii;
template<typename T> void read(T &x){
	x = 0;char ch = getchar();ll f = 1;
	while(!isdigit(ch)){if(ch == '-')f*=-1;ch=getchar();}
	while(isdigit(ch)){x = x*10+ch-48;ch=getchar();}x*=f;
}

int n,m;
char s[200020];
int u,v,rem[200020],cnt[200020][2];
vector<int> G[200020];

int main() {
	read(n);read(m);
	cin>>(s+1);
	for(int i=0;i<m;i++){
		read(u);read(v);
		G[u].push_back(v);
		G[v].push_back(u);
	}
	int cr = n;
	queue<int> Q;
	for(int i=1;i<=n;i++){
		rem[i] = 1;
		for(auto ct:G[i]) cnt[i][s[ct]-'A']+=1;
		if(!cnt[i][0] || !cnt[i][1]){
			Q.push(i);
			rem[i] = 0;
		}
	}
	while(!Q.empty()){
		int cc = Q.front();Q.pop();
		cr-=1;
		for(auto ct:G[cc]){
			if(!rem[ct])continue;
			cnt[ct][s[cc]-'A']-=1;
			if(!cnt[ct][0] || !cnt[ct][1]){
				Q.push(ct);
				rem[ct] = 0;
			}
		}
	}
	if(cr){
		cout<<"Yes"<<endl;
	}else{
		cout<<"No"<<endl;
	}
	return 0;
}


Measured memory_bytes: 13184
#include <iostream>
#include <cstdio>
#include <cstring>

using namespace std;

int main()
{
    int n, q;
    scanf("%d %d", &n, &q);
    char s[100005];
    scanf("%s", s);
    int ans[100005] = {0};
    int slen = strlen(s);
    int sum = 0;
    for(int i = 1; i < slen; ++i)
    {
        if(s[i] == 'C' && s[i-1] == 'A')
        {
            ans[i] = sum + 1;
            sum = ans[i];
        }
        else
            ans[i] = sum;
    }
    for(int i = 0; i < q; ++i)
    {
        int l, r;
        scanf("%d %d", &l, &r);
        printf("%d\n", ans[r-1] - ans[l-1]);
    }
    return 0;
}


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

using namespace std;

typedef long long ll;
int main()
{
    int n;
    cin >> n;
    long long int sum = 0;
    unordered_map<ll, ll> m;
    ll x;

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

    int q;
    cin >> q;

    int i = 0;
    while (i < q)
    {
        long long b, c;
        cin >> b >> c;

        int count = m[b];
        sum -= count * b;
        sum += count * c;
        m[c] += count;
        m[b] -= count;
        if (i == q - 1)
            cout << sum;
        else
            cout << sum << '\n';
        i++;
    }
    return 0;
}


Measured memory_bytes: 7056
import scala.io.StdIn.readLine

object Main {

  def main(args: Array[String]) = {
      val n = readLine().split(" ").map(_.toInt)
      val (a,b,c) = (n(0),n(1),n(2))
      println( if(a<b && b<c) "Yes" else "No")
  }
}

Measured memory_bytes: 43632
#include <cstdio>
#include <cstring>
#include <string>
#include <iostream>
#include <set>
using namespace std;

int n,m;
int main(void){
	set<string> id;
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		string str;
		cin >> str;
		id.insert(str);
	}
	scanf("%d",&m);
	bool flag=false;
	for(int i=0;i<m;i++){
		string str;
		cin >> str;
		if(id.find(str)!=id.end()){
			if(!flag)cout << "Opened";
			else cout << "Closed";
			cout << " by " << str << endl;
			flag=!flag;
		}else{
			cout << "Unknown " << str << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 1260
//============================================================================
// Name        : ku.cpp
// Author      : 
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================
#include<iostream>
using namespace std;
#include<cstdio>
int main(){
	int a,b,x,y;
	double z;
	cin>>a>>b;
	x=a/b;
	y=a%b;
	z=1.00000000*a/b;
	cout<<x<<" "<<y<<" ";
	printf("%.8f\n",z);

}

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

#define N 26

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

	vector<bool> used(N, false);
	for (int i = 0;i < s.size();i++) {
		used[s[i] - 'a'] = true;
	}

	if (s.size() < N) {
		cout << s;
		for (int i = 0;i < N;i++) {
			if (!used[i]) {
				char c = 'a' + i;
				cout << c << endl;
				break;
			}
		}
	}
	else if (s == "zyxwvutsrqponmlkjihgfedcba") {
		cout << -1 << endl;
	}
	else {
		for (int i = s.size() - 1;i >= 0;i--) {
			for (int j = s[i] - 'a' + 1;j < N;j++) {
				if (!used[j]) {
					char c = 'a' + j;
					cout << s.substr(0, i) << c << endl;
					return 0;
				}
			}
			used[s[i] - 'a'] = false;
		}
	}

	return 0;
}

Measured memory_bytes: 256
N = int(input())
a = [int(i) for i in input().split()]
check = [0] * 9
maxx = 0
minn = 0

for i in a:
    if 1 <= i <= 399:
        check[0] += 1
    elif 400 <= i <=799:
        check[1] += 1
    elif 800 <= i <= 1199:
        check[2] += 1
    elif 1200 <= i <= 1599:
        check[3] += 1
    elif 1600 <= i <= 1999:
        check[4] += 1
    elif 2000 <= i <= 2399:
        check[5] += 1
    elif 2400 <= i <= 2799:
        check[6] += 1
    elif 2800 <= i <= 3199:
        check[7] += 1
    elif i >= 3200:
        check[8] += 1

for i in range(9):
    if i <= 7 and check[i] >= 1:
        maxx += 1
        minn += 1
    if i == 8:
        maxx += check[8]
        if minn == 0 and check[8] >= 1:
            minn = 1

print(minn, maxx)

Measured memory_bytes: 9184
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        int S = scanner.nextInt();
        int W = scanner.nextInt();

        if (S <= W) {
            System.out.println("unsafe");
        } else {
            System.out.println("safe");
        }
    }
}


Measured memory_bytes: 35604
import java.util.*;
class Main {
    public static void main(String[] args) {
	Scanner sc = new Scanner(System.in);
	int first = sc.nextInt();
	int second = sc.nextInt();
	String str = sc.next();
	if(str.length()!=(first+second+1)) {
	    System.out.println("No");
	    return;
	}
	for(int i = 0; i<str.length(); i++) {
	    char c = str.charAt(i);
	    if(i==first) {
		if(c!='-') {
		    System.out.println("No");
		    return;
		}
	    }else {
		if(c=='-') {
		    System.out.println("No");
		    return;
		}
	    }
	}
	System.out.println("Yes");
    }
}

Measured memory_bytes: 23508
#include<iostream>
#include<cstdio>
#define N 23000000
#define mod 1000000007
#define ll long long
using namespace std;
int num[N+5];
ll n;
ll ans;
void insert(){
	scanf("%d",&n);
	for(int i=1;i<=N;i++){
		num[i]=num[i/10]+1;
	}
}
void add_ans(ll x){
	ans=(ans+x)%mod;
}
void digit_8down(){
	int j=1;
	int sum=0;
	for(int i=1;i<1e7;i++){
		while(sum<n&&j<=N){
			sum+=num[j];
			j++;
		}
		if(sum==n)add_ans(1);
		sum-=num[i];
	}
}
ll summod(ll digit){ 
	ll sum=1;
	ll i=10;
	while(digit!=0){
		if(digit&1)sum=(sum*i)%mod;
		i=(i*i)%mod;
		digit>>=1;
	}
	return sum;
}
void digit_8up(){
	for(ll i=1;i<=n/8;i++){
		if(n%i==0){
			add_ans(((summod(n/i)-summod(n/i-1)-i+1)%mod+mod)%mod);//100-1000-->(3--4)-->900 
		}
		else{
			add_ans(1);
		}
	}
}
int main(){
	insert();
	digit_8down();
	digit_8up();
	cout<<ans;
}

Measured memory_bytes: 90112
#include <stdio.h>

int main(void)
{
    int n;
    int array[25];
    int i;
    int remain;
    
    while (1){
        scanf("%d", &n);
        
        if (n == 0){
            break;
        }
        
        for (i = 0; i < n; i++){
            scanf("%d", &array[i]);
        }
        
        remain = 32;
        i = 0;
        while (remain > 0){
            remain -= ((remain - 1) % 5);
            printf("%d\n", remain);
            remain -= array[(i++) % n];
            printf("%d\n", remain < 0 ? 0 : remain);
        }
    }
    
    return (0);
}

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

int main() {
	int A1;
	int A2;
	int A3;
	cin>>A1>>A2>>A3;
	int sum=A1+A2+A3;
	if(sum>=22){
		cout<<"bust"<<endl;
	}
	else
	cout<<"win"<<endl;
	return 0;
}

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

#define REP(i,n) for(auto i=0;i<n;++i)
#define REPR(i,n) for(auto i=n;i>=0;--i)
#define REPI(itr,v) for(auto itr=v.begin();itr!=v.end();++itr)
#define REPIR(itr,v) for(auto itr=v.rbegin();itr!=v.rend();++itr)
#define FOR(i,a,b) for(auto i=a;i<b;++i)
#define SORT(v,n) sort(v, v+n)
#define SORTV(v) sort(v.begin(), v.end())
#define ALL(v) v.begin(),v.end()
#define llong long long
#define ll long long
#define INF 999999999
#define MOD 1000000007
#define pb push_back
#define pf push_front
#define MP make_pair
#define SV(n,v) {int tmp;for(int i=0;i<n;++i){scanf("%d",&tmp);v.push_back(tmp);}}

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

using namespace std;

typedef pair<int,int> pii;

int h, w;
int light[2000][2000][4];
string s[2000];

int solve(int x, int y, int dir){
  //cout << x << " " << y << " " << dir << endl;
  if(s[y][x] == '#'){
    return 0;
  }

  int nx = x + dx[dir], ny = y + dy[dir];
  if(nx < 0 || nx >= w || ny < 0 || ny >= h){
    light[y][x][dir] = 1;
    return 1;
  }

  if(light[ny][nx][dir] != 0){
    light[y][x][dir] = light[ny][nx][dir] + 1;
  }else
    light[y][x][dir] = solve(nx, ny, dir) + 1;

  return light[y][x][dir];
}

signed main(){

  cin >> h >> w;
  REP(i,h){
    cin >> s[i];
  }

  REP(i,h){
    REP(j,w){
      REP(k,4){
        light[i][j][k] = 0;
      }
    }
  }

  REP(i,h){
    REP(j,w){
      if(s[i][j] == '.'){
        REP(k,4){
          solve(j, i, k);
        }
      }
    }
  }

  int ans = 0;
  REP(i,h){
    REP(j,w){
      if(s[i][j] == '.'){
        int num = 1;
        REP(k,4){
          int nx = j + dx[k], ny = i + dy[k];
          if(nx >= 0 && nx < w && ny >= 0 && ny < h && light[ny][nx][k] != 0){
            num += light[ny][nx][k];
          }
        }
        ans = max(ans, num);
      }
    }
  }
/*
  REP(i,h){
    REP(j,w){
      cout << light[i][j][0];
    }
    cout << endl;
  }
*/
  cout << ans << endl;
  return 0;
}



Measured memory_bytes: 66944
#include<bits/stdc++.h>
#define FOR0(i,n) for(int i=0;i<n;i++)
#define FOR1(i,n) for(int i=1;i<=n;i++)
#define FORl(i,l,n) for(int i=l;i<n;i++)
using namespace std;
#define pi pair<int,int>
#define pb push_back
#define ll long long
#define ld long double
#define ff first
#define ss second
#define mp make_pair
#define mst0(x) memset(x,0,sizeof(x));
#define vi vector<int>
#define sync ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl '\n'
#define sp <<" "<<
#define intmax 1e14
ll mod = 1e9+7;
ll power(ll num,ll g,ll mod)
{
  if(g==0)return 1;
  if(g%2==1)return (num*power((num*num)%mod,g/2,mod))%mod;
  return power((num*num)%mod,g/2,mod);
}
double dist(double x1, double y1, double x2, double y2){
	return sqrt((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2));
}
  
int main() { 
	int n;
	cin >> n;
	int arr[n];
	double x[n], y[n];
	for (int i = 0; i < n; i++) arr[i] = i;
	FOR0(i,n) cin >> x[i] >> y[i];		
	double ans = 0;
	double cnt = 0;
	do{
		double temp = 0;
		// for (int i = 0; i < n; i++) cout << arr[i] << " ";
		// cout << endl;
		for (int i = 0; i < n-1; i++){
			temp+=dist(x[arr[i]], y[arr[i]], x[arr[i+1]], y[arr[i+1]]);
		}
		// temp/=n;
		// cout << temp << endl;
		ans += temp;
		cnt++;
	}while(next_permutation(arr, arr+n));
	// ans/=n;
	// cout << cnt << endl;
	ans/=cnt;
	cout << fixed << setprecision(8) << ans;
} 

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

using namespace std;
#define ll long long
#define ull unsigned long long
#define i128 __int128
#define mp make_pair
#define ld long double
typedef pair<int, int> pii;
typedef priority_queue<int, vector<int>, greater<int> > small_heap;
typedef priority_queue<int> big_heap;
const int N = 1e6 + 100;
int T;
int a, b, m;
int aa[N], bb[N];
pair<pii, int> c[N];

int main() {
    ios::sync_with_stdio(false);
    cin >> a >> b >> m;
    for (int i = 1; i <= a; i++)cin >> aa[i];
    for (int i = 1; i <= b; i++)cin >> bb[i];
    for (int i = 1; i <= m; i++)cin >> c[i].first.first >> c[i].first.second >> c[i].second;
    int ans = *min_element(aa + 1, aa + a + 1) + *min_element(bb + 1, bb + b + 1);
    for (int i = 1; i <= m; i++) {
        ans = min(ans, aa[c[i].first.first] + bb[c[i].first.second] - c[i].second);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 5584
h, w, a, b = (int(x) for x in input().split())
S = [[""] * w for _ in range(h)]
for i in range(h):
    for j in range(w):
        if (0 <= i < b and 0 <= j < a) or (b <= i < h and a <= j < w):
            S[i][j] = '1'
        else:
            S[i][j] = '0'

for ans in S:
    print("".join(ans))


Measured memory_bytes: 81692
#include <iostream>
#define ll long long int 
#define INF 999999999999999
using namespace std;

ll largest(ll a, ll b, ll c) {
	if(a > b && a > c) return a;
	else if (b > c) return b;
	else return c;
}

ll smallest(ll a, ll b, ll c) {
	if(a < b && a < c) return a;
	else if (b < c) return b;
	else return c;
}

int main() {
	ll H, W; cin >> H >> W;
	if(H == 2 && W == 2) {
		cout << 1 << endl;
	} else if (H % 3 == 0 || W%3 == 0) {
		cout << 0 << endl;
	} else {
		ll minimum = smallest(W, H, INF);
		for(int i = 0; i <= H; i++) {
			ll area_1 = i*W;
			ll area_2 = (H-i)*(W/2);
			ll area_3 = (H-i)*(W-W/2);
			ll this_case = largest(area_1, area_2, area_3) - smallest(area_1, area_2, area_3);
			if(this_case < minimum) minimum = this_case;
		}
		for(int i = 0; i <= W; i++) {
			ll area_1 = i*H;
			ll area_2 = (W-i)*(H/2);
			ll area_3 = (W-i)*(H-H/2);
			ll this_case = largest(area_1, area_2, area_3) - smallest(area_1, area_2, area_3);
			if(this_case < minimum) minimum = this_case;
		}
		cout << minimum << endl;
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,c) for(int i=0;i<(int)c;++i)
int main(){
  string s;
  cin >> s;
  rep(i,s.size()){
    if(s[2]==s[3]&&s[4]==s[5]){
      cout <<"Yes" << endl;
      return 0;
    }else{
      cout << "No" << endl;
      return 0;
    }
  }
  return 0;
}

Measured memory_bytes: 256
def dp():
    n, W = map(int, input().split())
    wv = (map(int, input().split()) for _ in range(n))
    dp = [0] * (W+1)

    for w, v in wv:
        for j in range(W, w-1, -1):
            DP = dp[j-w] + v
            if dp[j] < DP:
                dp[j] = DP
    return max(dp)
print(dp())

Measured memory_bytes: 7668
/* C++14 (Clang 3.8.0) for AtCoder */

#include <iostream>
#include <vector>
#include <string>
// #include <cmath>
// #include <math.h>
// #include <map>
// #include <algorithm>

namespace AtCoder {
	using Str = std::vector<std::string>;
	using Num = std::vector<int>;
	using BigNum = std::vector<double>;

	class Ans {
	public:
		void showResult(void);
		void increment(void);
		void increment(double);
		void decrement(void);
		void decrement(double);
		double getResult(void);
	private:
		double result;
	};
	void Ans::showResult(void) {
		printf("%.0lf\n", this->result);
	}
	void AtCoder::Ans::increment(void) {
		this->result++;
	}
	void AtCoder::Ans::increment(double value) {
		this->result += value;
	}
	void AtCoder::Ans::decrement(void) {
		this->result--;
	}
	void AtCoder::Ans::decrement(double value) {
		this->result -= value;
	}
	double AtCoder::Ans::getResult(void) {
		return this->result;
	}

	void input(Str* str) {
		str->clear();
		std::string buf = "", row = "";
		std::getline(std::cin, buf);
		for (unsigned int i = 0; i < buf.size(); i++) {
			if (' ' == buf[i]) {
				str->push_back(row);
				row = "";
			} else {
				row += buf[i];
			}
		}
		str->push_back(row);
	}
	void input(Num* num) {
		num->clear();
		std::string buf = "", row = "";
		std::getline(std::cin, buf);
		for (unsigned int i = 0; i < buf.size(); i++) {
			if (' ' == buf[i]) {
				num->push_back(std::atoi(row.c_str()));
				row = "";
			} else {
				row += buf[i];
			}
		}
		num->push_back(std::atoi(row.c_str()));
	}
	void input(BigNum* num) {
		num->clear();
		std::string buf = "", row = "";
		std::getline(std::cin, buf);
		for (unsigned int i = 0; i < buf.size(); i++) {
			if (' ' == buf[i]) {
				num->push_back(std::atof(row.c_str()));
				row = "";
			} else {
				row += buf[i];
			}
		}
		num->push_back(std::atof(row.c_str()));
	}
	void exp(std::string* str,  Str* newStr) {
		std::string pre = *str;
		newStr->clear();
		for (unsigned int i = 0; i < pre.length(); i++) {
			newStr->push_back(pre.substr(i, 1));
		}
	}
}

int main(void) {

	AtCoder::Num s;
	AtCoder::input(&s);

	AtCoder::Ans* ans = new AtCoder::Ans();

	int buf = 0;
	for (int num : s) {
		buf += num;
	}
	if (21 < buf) {
		printf("bust\n");
	} else {
		printf("win\n");
	}

	// ans->showResult();

	delete(ans);

	return 0;
}


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

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

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int N, M;
    cin >> N >> M;
    vector<int> W(N), V(N);
    for(int i=0; i<N; i++) cin >> W[i] >> V[i];

    int w0 = W[0];
    for(int i=0; i<N; i++)
    {
        W[i] -= w0;
    }

    const int INF = 1<<30;
    const int MAX_W = 300;
    vector<vector<vector<int>>> dp(N+1, vector<vector<int>>(N+1, vector<int>(MAX_W+5, -INF))); // 何番目, いくつ採用した？, sum_W
    dp[0][0][0] = 0;
    for(int i=0; i<N; i++)
    {
        for(int j=0; j<N; j++)
        {
            for(int k=0; k<MAX_W; k++)
            {
                chmax(dp[i+1][j][k], dp[i][j][k]);
                chmax(dp[i+1][j+1][k+W[i]], dp[i][j][k] + V[i]);
            }
        }
    }
    // for(auto vecc : dp)
    // {
    //     for(auto vec : vecc)
    //     {
    //         for(auto num : vec)
    //         {
    //             if(num < 0) cout << "0 ";
    //             else cout << num << ' ';
    //         }
    //         cout << '\n';
    //     }
    //     cout << '\n';
    // }
    int ans = 0;
    for(int i=0; i<=N; i++)
    {
        for(int j=0; j<=MAX_W-5; j++)
        {
            if(M >= 1LL * i*w0 + j) chmax(ans, dp[N][i][j]);
        }
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 16044
k=int(input())
if k%2 == 0 or k%5 == 0:
  print(-1)
  exit()
s = 0

for i in range(1000000):
  s = s*10+7
  s %= k
  if s == 0:
    print(i+1)
    exit()
#nの素数判定
def is_prime(n):
    if n == 1:
        return False
    for i in range(2,int(n**0.5)+1):
        if n % i == 0:
            return False
    return True
if k%7 == 0:
  k//=7
if is_prime(k):
  print(k-1)
  exit()
print(-1)
  

Measured memory_bytes: 9180
#include<bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int) n; i++)
using ll = long long;
template <class T>
using vt = std::vector<T>;
using vvi = std::vector<vt<int>>;

int main(){
  int n;
  std::cin >> n;
  vt<int> a(n);
  rep(i,n)
    std::cin >> a[i];

  ll total = 1;
  ll odd = 1;
  rep(i,n) {
    total *= 3;
    if(a[i]%2==0)
      odd *= 2;
  }

  std::cout << total - odd << '\n';  
  return 0;
}


Measured memory_bytes: 256
X, Y, Z, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)

ABC = []
for i in range(X):
    for j in range(Y):
        if (i + 1) * (j + 1) > K:
            break
        for k in range(Z):
            if (i + 1) * (j + 1) * (k + 1) > K:
                break
            ABC.append(A[i] + B[j] + C[k])

ABC.sort(reverse=True)
for i in range(K):
    print(ABC[i])


Measured memory_bytes: 46192
#include <iostream>
#include <cstdio>
#include <vector>
#include <complex>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <string>
#include <cstring>
#include <stack>
#include <cmath>
#include <iomanip>
#include <sstream>
#include <cassert>
 
using namespace std;
 
typedef long long ll;
typedef ll li;
typedef pair<int,int> PI;
#define EPS (1e-10L)
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define F first
#define S second
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define SZ(a) (int)((a).size())
#define ALL(a) a.begin(),a.end()
#define FOR(it,a) for(__typeof(a.begin())it=a.begin();it!=a.end();++it)
void pkuassert(bool t){t=1/t;};
 
int dx[]={0,1,0,-1,1,1,-1,-1};
int dy[]={1,0,-1,0,-1,1,1,-1};
 
int main(int argc, char *argv[])
{
  string ri("qwertasdfgzxcvb");
  string in;
  while(cin >> in && in!="#"){
    int ans = 0;
    bool ini=
      ri.find(in[0]) == string::npos;
    rep(i,SZ(in)-1){
      bool np=
        ri.find(in[i+1]) == string::npos;
      if(np!=ini) ++ ans;
      ini=np;
    }
    cout << ans << endl;
  }
  return 0;
}

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

int main()
{
    string s, rs;
    cin >> s;
    int n = s.length();
    int h = n/2;
    rs = s;
    reverse(rs.begin(), rs.end());

    if(s==rs && s.substr(0, h) == s.substr(h+1, h)) printf("Yes\n");
    else printf("No\n");
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline

def main():
    a, b = map(int, input().split())
    ans = 0
    for n in range(a, b+1):
        if list(str(n)) == list(reversed(str(n))):
            ans += 1
    print(ans)

if __name__ == '__main__':
    main()

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
signed main() {
  int n;cin >> n ;
  vector<int>a(n);
  for(int &x:a)cin >> x ;
  vector<int>dp(n) ;
  dp[0]=0;
  dp[1]=abs(a[1]-a[0] ) ;
  for(int i=2;i<n;i++)
    dp[i]=min(dp[i-1]+abs(a[i]-a[i-1]),dp[i-2]+abs(a[i-2]-a[i])) ;
  cout << dp[n-1] ;
}


Measured memory_bytes: 3952
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#pragma warning(disable:4996)
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <functional>
#include <stack>
#include <queue>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <list>
#include <set>
#include <ctime>
using namespace std;
typedef long long ll;

const int INF = 100000000;
const int MAX_N = 100000;


int main(int argc, char *args[]) {
	string pre, real;
	cin >> pre;
	cin >> real;
	int counter = 0;
	for (int i = 0; i < 3; i++) {
		if (pre[i] == real[i]) {
			counter++;
		}
	}
	cout << counter << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void){
	int i,p=0,n,m,d[200100],t[200100];
	bool flag=true;
	cin >> n;
	for(i=0; i<n; i++){
		cin >> d[i];
	}
	sort(d,d+n);
	cin >> m;
	for(i=0; i<m; i++){
		cin >> t[i];
	}
	sort(t,t+m);
	for(i=0; i<m; i++){
		while(t[i]>d[p]){
			p++;
		}
		if(t[i]<d[p]){
			flag = false;
			cout << "NO" << endl;
			break;
		}else{
			p++;
		}
	}
	if(flag){
		cout << "YES" << endl;
	}
	return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#include <boost/range/irange.hpp>

using namespace std;
using namespace boost;

using ll = long long;

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

  ll m = 0;
  for (auto && i: irange(0LL, N)){
  	string X = S.substr(0, i);
    string Y = S.substr(i);
    sort(X.begin(), X.end());
    sort(Y.begin(), Y.end());
    set<char> s{};
    set_intersection(X.begin(), X.end(), Y.begin(), Y.end(), inserter(s, s.end()));
    m = max(m, (ll)s.size());
  }
  cout << m << endl;
  return 0;
}

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

int main(){
	int a[100005];
	long int n,m,tp;
	cin>>n;
	m=0;
	while(n--){
		cin>>tp;
		if(a[tp]!=666){
			a[tp]=666;
			m++;
		}
	}
	if(m%2==0){
		cout<<m-1;
	}
	else cout<<m;
    return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <functional>
#include <algorithm>
using namespace std;

int main()
{
    int N, ABC[3];
    cin>>N>>ABC[0]>>ABC[1]>>ABC[2];
    vector<string> s(N);
    for (string &t: s)
        cin>>t;

    string ans;
    function<char(int, int)> f = [&](int d, int md) -> char
    {
        if (ABC[0]<0 || ABC[1]<0 || ABC[2]<0)
            return 'X';
        if (d>=md)
            return 'O';

        ABC[s[d][0]-'A']--;
        ABC[s[d][1]-'A']++;
        char c = f(d+1, md);
        ABC[s[d][0]-'A']++;
        ABC[s[d][1]-'A']--;
        if (c!='X')
            return s[d][1];

        ABC[s[d][1]-'A']--;
        ABC[s[d][0]-'A']++;
        c = f(d+1, md);
        ABC[s[d][1]-'A']++;
        ABC[s[d][0]-'A']--;
        if (c!='X')
            return s[d][0];

        return 'X';
    };

    for (int i=0; i<N; i++)
    {
        char c = f(i, min(i+2, N));
        if (c=='X')
        {
            cout<<"No"<<endl;
            return 0;
        }
        for (int j=0; j<2; j++)
            if (s[i][j]==c)
                ABC[s[i][j]-'A']++;
            else
                ABC[s[i][j]-'A']--;
        ans += c;
    }

    cout<<"Yes"<<endl;
    for (char c: ans)
        cout<<c<<endl;
}


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

constexpr int inf = 1e9;
constexpr ll linf = 1e18;
template <typename T>
class SegTree
{
public:
    SegTree(const int n, const T &unity) : _unity(unity)
    {
        _n = 1 << __lg(2 * n - 1);
        _data.resize(2 * _n, unity);
    }

    SegTree(const vector<T> &v, const T &unity) : _unity(unity)
    {
        int n = v.size();
        _n = 1 << __lg(2 * n - 1);
        _data.resize(2 * _n, unity);

        // 最下段に要素をセット
        for (int i = 0; i < n; i++) this->set(i, v[i]);
        // セグメント木を構築
        this->build();
    }

    // k 番目の要素を最下段にセット
    void set(int k, const T &x) { _data[k + _n] = x; }

    // セグメント木を構築
    void build(void) {
        for (int i = _n - 1; i > 0; i--) _data[i] = f(_data[2 * i], _data[2 * i + 1]);
    }

    // k番目の値をxに更新する
    void update(int k, const T &x)
    {
        k += _n; // 葉の節点に変換
        _data[k] = x;
        while (k >>= 1) _data[k] = f(_data[2 * k], _data[2 * k + 1]);
    }

    // 区間[a, b)に対してクエリ処理した結果を返す
    T query(int a, int b)
    {
        T left = _unity, right = _unity;
        a += _n, b += _n; // 葉の節点に変換
        for (; a < b; a >>= 1, b >>= 1) {
            if (a & 1) left  = f(left, _data[a++]);
            if (b & 1) right = f(_data[--b], right);
        }
        return f(left, right);
    }

    const T &operator[](size_t i) const { return _data[i + _n]; }
    T &operator[](size_t i) { return _data[i + _n]; }

private:
    int _n;          // 要素数
    vector<T> _data; // データを格納する配列
    T _unity;        // 単位元

    // クエリ処理用の関数
    T f(const T &a, const T &b) { return a | b; }
};

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

    int n; cin >> n;
    string s; cin >> s;

    SegTree<int> st(n, 0);
    for (int i = 0; i < n; i++) st.set(i, 1 << (s[i] - 'a'));
    st.build();

    int q; cin >> q;
    while (q--) {
        int k; cin >> k;
        if (k == 1) {
            int i; cin >> i; i--;
            char c; cin >> c;
            st.update(i, 1 << (c - 'a'));
        } else {
            int l, r; cin >> l >> r; l--;
            int ans = __builtin_popcount(st.query(l, r));
            cout << ans << endl;
        }
    }
    return 0;
}

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

int N;

int main(){
	cin >> N;
	for(int x=0;x<=N/4;x++){	
		for(int y=0;y<=N/7;y++){
			if(N==4*x+7*y) {
				cout << "Yes" << endl;
				return 0;
			}
		}
	}
	cout << "No" << endl;
	return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int a = scan.nextInt();
        int b = scan.nextInt();
        int h = scan.nextInt();
        int m = scan.nextInt();
        double da = Math.abs(h * 30 + m * 0.5 - m * 6);
        double d = Math.min(360 - da, da);
        double c = Math.sqrt(a * a + b * b - 2 * a * b * Math.cos(Math.toRadians(d)));
        System.out.println(c);
        scan.close();
    }
}

Measured memory_bytes: 27196
#include<iostream>

using namespace std;

int main(){
  int N,M;
  cin >> N >> M;
  int counter=0;
  //ぐぐ
  counter=counter+N*(N-1)/2;
  //きき
  counter=counter+M*(M-1)/2;

  cout << counter;
  return 0;
}


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

const int mod = 1e9 + 7;
double arr[3005];
double dp[3005][3005];
int n;

double kil(int idx, int heads)
{
  if(idx == n)
  {
    if(heads > n - heads)
      return 1;
    return 0;
  }

  if(dp[idx][heads] != -1)
    return dp[idx][heads];

  dp[idx][heads] = 0;
  dp[idx][heads] += arr[idx] * kil(idx+1, heads+1);
  dp[idx][heads] += (1-arr[idx]) * kil(idx+1, heads);

  return dp[idx][heads];
}

int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);




  cin>>n;
  for(int i=0;i<n;i++)
    cin>>arr[i];

  for(int i=0;i<=n;i++)
      for(int j=0;j<=n;j++)
        dp[i][j] = -1;

  cout<<setprecision(10);
  cout<<kil(0, 0)<<endl;

  return 0;
}


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

int main(void){
  int N;
  cin >> N;
  vector<int>A(N);
  for(int i=0; i < N;  i++) cin >> A[i];
  bool flg = true;
  int ans = 0;
  while(flg){
    flg = 0;
    for(int i = N-1; i >= 1; i--){
      if(A[i] < A[i-1]){
        swap(A[i], A[i-1]);
        flg = 1;
        ans++;
      }
    }
  }
  for(int i=0; i < N; i++){
    cout << A[i];
    if(i != N-1) cout << " ";
  }
  cout << endl << ans << endl;
  return 0;
}

Measured memory_bytes: 1196
H, W = map(int, input().split())
row_list = []
[row_list.append(input()) for h in range(H)]

col_list = []
for w in range(W):
    col = ''
    for h in range(H):
        col += row_list[h][w]
    col_list.append(col)


romit_index_list = [rindex for rindex, r in enumerate(row_list) if r == '.' * W]
comit_index_list = [cindex for cindex, c in enumerate(col_list) if c == '.' * H]

matrix = ''
for h in range(H):
    if h in romit_index_list:
        pass
    else:
        for w in range(W):
            if w in comit_index_list:
                pass
            else:
                matrix += row_list[h][w]


result = [matrix[n: n + W - len(comit_index_list)]
          for n in range(0, len(matrix), W - len(comit_index_list))]


ans = '\n'.join(result)
print(ans)


Measured memory_bytes: 3064
#include <stdio.h>
#include <stdbool.h>

typedef struct {
    int x;
    int y;
} Pos;

typedef struct {
    Pos lu;
    Pos lt;
    Pos ru;
    Pos rt;
} RectAngle;

typedef struct {
    Pos center;
    int r;
} Circle;

void setPos(Pos *pos, int x, int y) {
    pos->x = x;
    pos->y = y;
}   

void convertCircleToRectAngle(RectAngle *rect, Circle *cir) {
    setPos(&rect->lt, cir->center.x - cir->r, cir->center.y + cir->r);
    setPos(&rect->lu, cir->center.x - cir->r, cir->center.y - cir->r);
    setPos(&rect->rt, cir->center.x + cir->r, cir->center.y + cir->r);
    setPos(&rect->ru, cir->center.x + cir->r, cir->center.y - cir->r);
}

bool isContainCircleInRectAngle(Circle *cir, RectAngle *rect) {
    RectAngle cirRange;
    convertCircleToRectAngle(&cirRange, cir);

    if(cirRange.lu.x < rect->lu.x)     return false;
    if(cirRange.lu.y < rect->lu.y)     return false;
    if(cirRange.lt.x < rect->lt.x)     return false;
    if(cirRange.lt.y > rect->lt.y)     return false;
    if(cirRange.rt.x > rect->rt.x)     return false;
    if(cirRange.rt.y > rect->rt.y)     return false;
    if(cirRange.ru.x > rect->ru.x)     return false;
    if(cirRange.ru.y < rect->ru.y)     return false;

    return true;
}

int main(void) {
    RectAngle rect;
    Circle cir;

    scanf("%d %d %d %d %d", &rect.rt.x, &rect.rt.y, &cir.center.x, &cir.center.y, &cir.r);

    setPos(&rect.lu, 0, 0);
    setPos(&rect.lt, 0, rect.rt.y);
    setPos(&rect.ru, rect.rt.x, 0);

    puts(isContainCircleInRectAngle(&cir, &rect) ? "Yes" : "No");

    return 0;
}


Measured memory_bytes: 2112
//AtCoderCrackers.java
import java.util.Scanner;
class Main
{
	public static void main(String args[])
	{
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
        int k=sc.nextInt();

        if(n%k==0){
            System.out.println('0');
        }
        else{
            System.out.println('1');
        }
        sc.close();
    }
}

Measured memory_bytes: 21972