akhauriyash/Code-Regression huggingface dataset:
#include<cstdio>
#include<cstring>
#include<vector>
using namespace std;
typedef long long ll;
const int N=55,M=220,P=1000000007;
int i,j,k,n,m,K,En,x,y,tm,dn,nm,ans,pn;
int h[N],A[N],B[N],d[M],z[N],fg[N],phi[N],pr[N],tmk[N],Jc[M],Jc_[M],Ans[N];
vector<int> have[M];
struct edge { int s,n;} E[M];
void E_add(int x,int y) {
	E[++En].s=y;E[En].n=h[x];h[x]=En;
	E[++En].s=x;E[En].n=h[y];h[y]=En;
}
int ksm(int x,int y) {
	int z=1;
	for (;y;y>>=1,x=(ll) x*x%P) if (y&1) z=(ll) z*x%P;
	return z;
}
void pre(int n) {
	int i;
	Jc[0]=Jc_[0]=1;
	for (i=1;i<=n;i++) Jc[i]=(ll) Jc[i-1]*i%P;
	Jc_[n]=ksm(Jc[n],P-2);
	for (i=n-1;i;i--) Jc_[i]=(ll) Jc_[i+1]*(i+1)%P;
}
void get_phi(int n) {
	int i,j;
	tmk[0]=1;
	for (i=1;i<=n;i++) tmk[i]=(ll) tmk[i-1]*K%P;
	phi[1]=1;
	for (i=2;i<=n;i++) {
		if (!fg[i]) pr[++pn]=i,phi[i]=i-1;
		for (j=1;j<=pn;j++) {
			if (i*pr[j]>n) break;
			fg[i*pr[j]]=1;
			if (i%pr[j]==0) {
				phi[i*pr[j]]=phi[i]*pr[j];
				break;
			}
			phi[i*pr[j]]=phi[i]*(pr[j]-1);
		}
	}
}
void work(int x) {
	int now=0;nm++;
	while (now!=x) {
		now=d[dn--];
		have[nm].push_back(now);
	}
}
void Tj(int x,int F) {
	A[x]=B[x]=++tm;
	for (int k=h[x];k;k=E[k].n) if ((k>>1)!=F) {
		if (!A[E[k].s]) {
			d[++dn]=k;
			Tj(E[k].s,k>>1);
			if (B[E[k].s]<B[x]) B[x]=B[E[k].s];
			if (A[x]<=B[E[k].s]) work(k);
		}
		else {
			if (A[E[k].s]<B[x]) B[x]=A[E[k].s];
			if (A[E[k].s]<A[x]) d[++dn]=k;
		}
	}
}
int C(int n,int m) {
	if (n<m) return 0;
	return (ll) Jc[n]*Jc_[m]%P*Jc_[n-m]%P;
}
int Js(int n) {
	if (Ans[n]!=-1) return Ans[n];
	int &ans=Ans[n];
	ans=0;
	int i,d;
	for (i=1;i*i<=n;i++) if (n%i==0) {
		d=i;
		ans=((ll) phi[n/d]*tmk[d]+ans)%P;
		if (d*d<n) ans=((ll) phi[d]*tmk[n/d]+ans)%P;
	}
	ans=(ll) ans*Jc[n-1]%P*Jc_[n]%P;
	return ans;
}
int main() {
	memset(Ans,-1,sizeof Ans);
	scanf("%d%d%d",&n,&m,&K);
	pre(m+K);
	get_phi(n);
	En=1;ans=1;
	for (i=1;i<=m;i++) {
		scanf("%d%d",&x,&y);
		E_add(x,y);
	}
	for (i=1;i<=n;i++) if (!A[i]) {
		Tj(i,-1);
	}
	for (i=1;i<=nm;i++) {
		if (have[i].size()==1) ans=(ll) ans*K%P;
		else {
			memset(z,0,sizeof z);
			for (j=0;j<have[i].size();j++) {
				int t=have[i][j];
				z[E[t].s]++;
				z[E[t^1].s]++;
			}
			for (j=1;j<=n;j++) if (z[j]!=0 && z[j]!=2) break;
			if (j<=n) ans=(ll) ans*C(have[i].size()+K-1,K-1)%P;
			else ans=(ll) ans*Js(have[i].size())%P; 
		}
	}
	printf("%d\n",ans);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0;i<(int)(n);i++)
#define all(x)    (x).begin(),(x).end()
typedef long long ll;
const int MOD = (int)1e9 + 7;

int main(){
  int n;
  cin >> n;
  vector<int> odd(n/2), even(n/2);
  rep(i,n){
    if(i % 2 == 0) cin >> even[i/2];
    if(i % 2 != 0) cin >> odd[(i-1)/2];
  }
  vector<pair<int,int> > odd_count, even_count;
  sort(all(odd));
  sort(all(even));
  int now = odd[0];
  int count = 0;
  for(n:odd){
    if(now == n) count++;
    else{
      odd_count.push_back(make_pair(count,now));
      now = n;
      count = 1;
    }
  }
  odd_count.push_back(make_pair(count,now));
  now = even[0];
  count = 0;
  for(n:even){
    if(now == n) count++;
    else{
      even_count.push_back(make_pair(count,now));
      now = n;
      count = 1;
    }
  }
  even_count.push_back(make_pair(count,now));
  sort(all(odd_count));
  sort(all(even_count));
  reverse(all(odd_count));
  reverse(all(even_count));
  int ofn = odd_count[0].second;
  int efn = even_count[0].second;
  int least;
  if(odd_count.size() == 1 && even_count.size() == 1){
    if(ofn == efn) least = n/2;
    else least = n;
  }
  else if(odd_count.size() > 1 && even_count.size() == 1){
    if(ofn != efn) least = n/2 + odd_count[0].first;
    else least = n/2 + odd_count[1].first;
  }
  else if(odd_count.size() == 1 && even_count.size() > 1){
    if(ofn != efn) least = n/2 + even_count[0].first;
    else least = n/2 + even_count[1].first;
  }
  else{
    if(ofn != efn) least = odd_count[0].first + even_count[0].first;
    else least = max(odd_count[0].first + even_count[1].first,
                     odd_count[1].first + even_count[0].first);
  }
  cout << n - least << endl;
}



Measured memory_bytes: 1784
import java.util.*;
public class Main{
	public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
      int n = sc.nextInt();
      int m = sc.nextInt();
      long x = (long)Math.pow(2,m);
      System.out.println((1900*m+100*(n-m))*x);
    }
}


Measured memory_bytes: 23764
#include <bits/stdc++.h>
#define N 100
#define INF 1e9 + 5
#define LINF 1e18 + 5

using namespace std;
using ll = long long;
int n,m;
vector<vector<int>> path;
vector<int> dp;
int solve(int idx){
    if(dp[idx]!=-1) return dp[idx];//이미 방문했다면 리턴
    int& res = dp[idx];
    res = 0;// 방문 했다.
    for(auto k:path[idx]){
        res = max(res, solve(k) + 1);
    }
    return res;
}

int main()
{
    cin>>n>>m;
    path.resize(n+1);
    dp.resize(n+1,-1);
    int x,y;
    while(m--){
        cin>>x>>y;
        path[x].push_back(y);
    }
    int ans = 0;
    for(int i=1;i<=n;i++){
        ans = max(ans,solve(i));
    }
    cout<<ans;



    
    return 0;
}

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


def main():
    
    def knapsack_price(single=True):
        """
        重さが小さい時のナップサックDP
        :param single: True = 重複なし
        """
        """ dp[price <= V] = 価値を固定した時の最小重量 """
        V = sum(price_list)
        dp_max = W + 1
        dp = [dp_max] * (V + 1)
        dp[0] = 0  # 境界条件：　価値0 の時は重さは0

        for item in range(N):
            if single:
                S = reversed(range(price_list[item], V + 1))
            else:
                S = range(price_list[item], V + 1)
            for price in S:
                dp[price] = min2(dp[price], dp[price - price_list[item]] + weight_list[item])
        return max(price for price in range(V + 1) if dp[price] <= W)

    #######################################################################################################


    def max2(x, y):
        """ pythonの組み込み関数 max は2変数に対しては遅い！！ """
        if x > y:
            return x
        else:
            return y

    def min2(x, y):
        """ pythonの組み込み関数 min は2変数に対しては遅い！！ """
        if x < y:
            return x
        else:
            return y

    N, W = map(int, input().split())  # N: 品物の種類 W: 重量制限

    price_list = []
    weight_list = []
    for _ in range(N):
        """ price と weight が逆転して入力されている場合有り """
        weight, price = map(int, input().split())
        price_list.append(price)
        weight_list.append(weight)

    print(knapsack_price(single=True))

if __name__ == '__main__':
    main()

Measured memory_bytes: 74568
import java.util.Scanner;
     
     
    public class Main {
        

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

           if (a<b){
             for (int i=0;i<b;i++){
               System.out.print(a);
            }
            
           }else if(b<a){
             for (int i=0;i<a;i++){
                 System.out.print(b);
            }
           
           }else if(a==b){
             for (int i=0;i<a;i++){
                  System.out.print(a);
            }
            
           }
            
           } 
       }
        
    


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

#define int long long
#define vvi vector<vector<int>>
#define vec vector
#define pq priority_queue
#define all(v) (v).begin(), (v).end()
#define uniqueV(x) sort(x.begin(), x.end()); x.erase(unique(x.begin(), x.end()), x.end());
#define rep(i, n) for (int (i) = (0); (i) < (n); ++(i))
#define repp(i, m, n) for (int (i) = (m); (i) < (n); ++(i))
#define dbg(x) cerr << #x << ": " << x << endl;
#define dbg2(x, y) cerr<<"("<<#x<<", "<<#y<<") = "<<"("<<x<<", "<<y<<")"<<endl;
#define dbg3(x, y, z) cerr<<"("<<#x<<", "<<#y<<", "<<#z<<") = "<<"("<<x<<", "<<y<<", "<<z<<")"<<endl;
#define dbgB(value, size) cerr<<#value<<": "<<bitset<size>(value) << endl;
#define line() cerr << "---------------" << endl;

const int dx[] = {1, -1, 0, 0};
const int dy[] = {0, 0, -1, 1};
const double PI = 3.14159265358979323846;

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }

template<typename T>
void print1(T begin, T end) {
	while (begin != end) {
		cerr << (*begin) << " ";
		*begin++;
	}
	cerr << endl;
}

template<typename T>
void print2(T Array, int height, int width) {
	for (int i = 0; i < height; i++) {
		for (int j = 0; j < width; j++) {
			cerr << " " << Array[i][j];
		}
		cerr << endl;
	}
}

void print() { std::cerr << endl; }
template <class Head, class... Tail>
void print(Head&& head, Tail&&... tail) {
	std::cerr << head << " ";
	print(std::forward<Tail>(tail)...);
}

template<class T>
void Add(T &a, const T &b, const T &mod=1000000007) {
	int val = ((a % mod) + (b % mod)) % mod;
	if (val < 0) { val += mod; }
	a = val;
}

template <typename X, typename T> auto vectors(X x, T a) { return vector<T>(x, a); }
template <typename X, typename Y, typename Z, typename... Zs> auto vectors(X x, Y y, Z z, Zs... zs) { auto cont = vectors(y, z, zs...); return vector<decltype(cont)>(x, cont); }

// ------------------------------------------------------------------------------------------

const int mod = 1e9+7;

int dp[111111][2];

signed main() {
	string L;
	cin >> L;
	int n = L.size();

	dp[0][1] = 2;
	dp[0][0] = 1;
	rep (i, n-1) {
		rep (j, 2) {
			if (L[i+1] == '0') {
				if (j == 0) {
					dp[i+1][0] += dp[i][0] * 3;
					dp[i+1][0] %= mod;
				} else {
					dp[i+1][1] += dp[i][1];
					dp[i+1][1] %= mod;
				}
			} else {
				dp[i+1][j] += dp[i][j] * 2;
				dp[i+1][j] %= mod;
				dp[i+1][0] += dp[i][j];
				dp[i+1][0] %= mod;
			}
		}
	}

	int ans = dp[n-1][0] + dp[n-1][1];
	ans %= mod;

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 2048
#include<algorithm>
#include<iostream>
#include<cstring>
#include<fstream>
#include<bitset>
#include<cstdio>
#include<string>
#include<vector>
#include<cmath>
#include<queue>
#include<stack>
#include<map>
#include<set>
#define INF 0X3F3F3F3F
#define N 80010
#define M 2000100
#define LL long long
#define FF(i,a,b) for(int i=a;i<=b;++i)
#define RR(i,a,b) for(int i=a;i>=b;--i)
#define FJ(i,a,b) for(int i=a;i<b;++i)
#define SC(x) scanf("%d",&x)
#define SCC(x,y) scanf("%d%d",&x,&y)
#define SCCC(x,y,z) scanf("%d%d%d",&x,&y,&z)
#define SS(x) scanf("%s",x)
#define PR(x) printf("%d\n",x)
#define CL(a,b) memset(a,b,sizeof(a))
#define FD T&q=fd[rt],&ql=fd[rt<<1],&qr=fd[rt<<1|1]
#define MID int mid=((l+r)>>1)
#define lson rt<<1,l,mid
#define rson rt<<1|1,mid+1,r
#define zero(x) (((x)>0?(x):-(x))<EPS)
#define PB push_back
#define SZ size
#define PII pair<int,int>
#define PLL pair<long long,long long>
#define MP make_pair
#define IN freopen("in.txt","r",stdin)
#define OUT freopen("out.txt","w",stdout)
using namespace std;
const int MOD=1000000007;
const double PI=acos(-1.0);
const double EPS=1e-8;
inline int II(){int n=0,ch=getchar();if(ch==-1)return 0;
for(;ch<'0'||ch>'9';ch=getchar());//if(ch=='-')t=1;
for(;ch>='0'&&ch<='9';n=n*10+ch-'0',ch=getchar());
return n;}
struct edge{int v,nx;}E[N*40];int head[N],EN;
void init_edge(int cnt){EN=0;fill(head,head+cnt,-1);}
void add_edge(int u,int v){
    E[EN]=(edge){v,head[u]};head[u]=EN++;
}
int n,xy[N>>2],mp[N>>2],id[N>>2];
int sz,lc[N],rc[N];
void build(int l,int r){
	int o=sz++;
	if (l==r){
		lc[o]=rc[o]=0;add_edge(o,mp[id[l]^1]);
		return ;
	}
	int mid=(l+r)/2;
	lc[o]=sz;build(l,mid);
	rc[o]=sz;build(mid+1,r);
	add_edge(o,lc[o]);add_edge(o,rc[o]);
}
void work(int o,int l,int r,int ql,int qr,int p){
	if (ql<=l&&r<=qr){
		add_edge(p,o);return ;
	}
	int mid=(l+r)/2;
	if(ql<=mid)work(lc[o],l,mid,ql,qr,p);
	if(qr>mid)work(rc[o],mid+1,r,ql,qr,p);
}
int dfs_clock,scc_cnt,sccid[N],dfn[N],low[N];
stack<int>S;
void dfs(int u){
    int v;
	dfn[u]=low[u]=++dfs_clock;
	S.push(u);
	for(int k=head[u];~k;k=E[k].nx){
		v=E[k].v;
		if (!dfn[v]){dfs(v);low[u]=min(low[u],low[v]);}
		else if(!sccid[v])low[u]=min(low[u],dfn[v]);
	}
	if(low[u]==dfn[u]){
		scc_cnt++;
		do{v=S.top();S.pop();
		sccid[v]=scc_cnt;
		}while(v!=u);
	}
}
void tarjan(int n){
	dfs_clock=scc_cnt=0;
	fill(sccid,sccid+n*2,0);
	fill(dfn,dfn+n*2,0);
	for(int i=0;i<n;i++)if(!dfn[i])dfs(i);
}
bool check(int mid){
	init_edge(n<<3);
	sz=n<<1;
	build(0,n*2-1);
	FJ(i,0,n<<1){
		int l=lower_bound(xy,xy+2*n,xy[i]-mid+1)-xy;
		int r=upper_bound(xy,xy+2*n,xy[i]+mid-1)-xy-1;
		if(l<i)work(2*n,0,2*n-1,l,i-1,i);
		if(i<r)work(2*n,0,2*n-1,i+1,r,i);
	}
	tarjan(sz);
	FJ(i,0,n<<1)
	if(sccid[i]==sccid[mp[id[i]^1]])return 0;
	return 1;
}
int main(){
  //  IN;
    n=II();
    FJ(i,0,n<<1){
        xy[i]=II();
        id[i]=i;
	}
	sort(id,id+2*n,[](int a,int b){return xy[a]<xy[b];});
	sort(xy,xy+2*n);
	FJ(i,0,n<<1)mp[id[i]]=i;
	int l=1,r=1e9;
	while(l<=r){
		int mid=(l+r)/2;
		if(check(mid))l=mid+1;
        else r=mid-1;
	}
	PR(r);
    return 0;
}


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

int main(){

  double x1, x2, x3, y1, y2, y3, k12, k23, p, q, r;
  int n;
  
  cin >> n;
  
  for(int i=0; i<n; i++){
  	cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
  	
  	if(y1 != y2){
  		k12 = - (x1 - x2) / (y1 - y2);
  	}
  	else {
  		p = (x1 + x2) / 2.0;
  		q = - (x2 - x3) / (y2 - y3) * (p - (x2 + x3) / 2.0) + (y2 + y3) / 2.0;
  		r = sqrt(pow(p - x1, 2) + pow(q - y1, 2));
  		
  		printf("%.3lf %.3lf %.3lf\n", p, q, r);
  		continue;
  	}
  	
  	if(y2 != y3){
  		k23 = - (x2 - x3) / (y2 - y3);
  	}
  	else {
  		p = (x2 + x3) / 2.0;
  		q = - (x1 - x2) / (y1 - y2) * (p - (x1 + x2) / 2.0) + (y1 + y2) / 2.0;
  		r = sqrt(pow(p - x1, 2) + pow(q - y1, 2));
  		
  		printf("%.3lf %.3lf %.3lf\n", p, q, r);
  		continue;
  	}
  	
  	p = (k12 * ((x1 + x2) / 2.0) - (y1 + y2) / 2.0 - k23 * ((x2 + x3) / 2.0) + (y2 + y3) / 2.0) / (k12 - k23);
  	q = - (x1 - x2) / (y1 - y2) * (p - (x1 + x2) / 2.0) + (y1 + y2) / 2.0;
  	r = sqrt(pow(p - x1, 2) + pow(q - y1, 2));
  	
  	printf("%.3lf %.3lf %.3lf\n", p, q, r);
	}  

  return 0;
}

Measured memory_bytes: 1240
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>

int		main(){
	char S[200001];
	// char *S;
	// S = (char *)calloc(30000, sizeof(char));
	scanf("%s\n", S);
	// S[strlen(S)] = '\0';
	char prev = ' ';
	int cnt = 0;
	int flag = 0;
	for (int i  = 0; i < strlen(S); i++){
		// printf("%s\n", prev);
		if (flag == 1 || S[i] != prev)
			flag = 0;
		else if (i == strlen(S) - 1) cnt--;
		else {
			flag = 1;
			i++;
		}
		prev = S[i];
		cnt++;
	}
	printf("%d\n", cnt);
	return (0);
}

// int		main(){
// 	char S[10001];
// 	scanf("%s\n", S);
// 	S[strlen(S)] = '\0';
// 	char prev[10001];
// 	// printf("%s\n", S);
// 	int cnt = 0;
// 	for (int i  = 0; i < strlen(S); i++){
// 		// printf("%s\n", prev);
// 		cnt++;
// 		prev[0] = S[i];
// 		if (strlen(prev) > 1 || S[i] != prev[0])
// 			prev[1] = '\0';
// 		else if (i != strlen(S) - 1){
// 			prev[1] = S[++i];
// 			prev[2] = '\0';
// 		}
// 	}
// 	printf("%d\n", cnt);
// 	return (0);
// }

// if (strlen(prev) > 1 || S[i] != prev[0]){
// 			cnt++;
// 			prev[0] = S[i];
// 			prev[1] = '\0';
// 		}
// 		else if (i == strlen(S) - 1) break ;
// 		else {
// 			cnt++;
// 			prev[0] = S[i];
// 			prev[1] = S[++i];
// 			prev[2] = '\0';
// 		}
// 	}

Measured memory_bytes: 384
#[allow(unused_macros)]
macro_rules ! input { ( source = $ s : expr , $ ( $ r : tt ) * ) => { let mut iter = $ s . split_whitespace ( ) ; let mut next = || { iter . next ( ) . unwrap ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; ( $ ( $ r : tt ) * ) => { let stdin = std :: io :: stdin ( ) ; let mut bytes = std :: io :: Read :: bytes ( std :: io :: BufReader :: new ( stdin . lock ( ) ) ) ; let mut next = move || -> String { bytes . by_ref ( ) . map ( | r | r . unwrap ( ) as char ) . skip_while ( | c | c . is_whitespace ( ) ) . take_while ( | c |! c . is_whitespace ( ) ) . collect ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; }
#[allow(unused_macros)]
macro_rules ! input_inner { ( $ next : expr ) => { } ; ( $ next : expr , ) => { } ; ( $ next : expr , $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let $ var = read_value ! ( $ next , $ t ) ; input_inner ! { $ next $ ( $ r ) * } } ; }
#[allow(unused_macros)]
macro_rules ! read_value { ( $ next : expr , ( $ ( $ t : tt ) ,* ) ) => { ( $ ( read_value ! ( $ next , $ t ) ) ,* ) } ; ( $ next : expr , [ $ t : tt ; $ len : expr ] ) => { ( 0 ..$ len ) . map ( | _ | read_value ! ( $ next , $ t ) ) . collect ::< Vec < _ >> ( ) } ; ( $ next : expr , chars ) => { read_value ! ( $ next , String ) . chars ( ) . collect ::< Vec < char >> ( ) } ; ( $ next : expr , usize1 ) => { read_value ! ( $ next , usize ) - 1 } ; ( $ next : expr , $ t : ty ) => { $ next ( ) . parse ::<$ t > ( ) . expect ( "Parse error" ) } ; }

fn main() {
    input! {
        a: u64, b: u64
    }

    let mut ret = 0;
    for i in a..b+1 {
        if is_symmetry(i) {
            ret += 1;
        }
    }
    println!("{}", ret);
}

fn is_symmetry(num: u64) -> bool {
    let s = format!("{}", num).chars() .collect::<Vec<_>>();
    let n = s.len();
    for i in 0..n/2 {
        if s[i] != s[n-1-i] {
            return false;
        }
    }
    true
}


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

const int MOD=1000000007;
const int INF=0x3f3f3f3f;
const ll INFL=0x3f3f3f3f3f3f3f3f;

int main() {
  ll n,h,w ; 
  cin >> n >> h >> w ;
  ll sum=0;
  rep(i,n){
   ll a, b; cin>>a>>b;
   if(a>=h && b>=w) sum++;
  }
  cout<<sum<<endl;
}



Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS 1 //scanfの調整
#include"stdio.h"

int main(){
	int i, j;
	int num[10][7] = {
		{ 0, 1, 1, 1, 1, 1, 1 },
		{ 0, 0, 0, 0, 1, 1, 0 },
		{ 1, 0, 1, 1, 0, 1, 1 },
		{ 1, 0, 0, 1, 1, 1, 1 },
		{ 1, 1, 0, 0, 1, 1, 0 },
		{ 1, 1, 0, 1, 1, 0, 1 },
		{ 1, 1, 1, 1, 1, 0, 1 },
		{ 0, 1, 0, 0, 1, 1, 1 },
		{ 1, 1, 1, 1, 1, 1, 1 },
		{ 1, 1, 0, 1, 1, 1, 1 }
	};
	int a;
	int st[7] = { 0, 0, 0, 0, 0, 0, 0 };
	int n;
	while (scanf("%d", &n) != -1){
		if (n == -1) break;
		for (i = 0; i < 7; i++) st[i] = 0;
		for (i = 0; i < n; i++){
			scanf("%d", &a);
			for (j = 0; j < 7; j++){
				if (num[a][j] != st[j]){
					printf("1");
					st[j] = num[a][j];
				}
				else printf("0");
			}
			printf("\n");
		}
	}
	return 0;
}

Measured memory_bytes: 572
A, B, N = map(int, input().split())
if B == 1:
    result = 0
elif N >= B - 1:
    result = int(A*(B-1)/B) - A*int((B-1)/B)
else:
    result = int(A*N/B) - A*int(N/B)
    
print(result)

Measured memory_bytes: 9116
#include<bits/stdc++.h>
// Begin Header {{{
#define all(x) (x).begin(), (x).end()
#define lli long long int
#define rep(i,n) for(lli i=0; i<n; i++)
#define loop(i, j, n) for(lli i=j; i<n; i++)
#define Max(a, b) ((a) > (b) ? (a) : (b))
#define Min(a, b) ((a) < (b) ? (a) : (b))
constexpr int INF  = 0x3f3f3f3f;
const long long mod=1e9+7;
const double PI = acos(-1);
//Function
lli combi(lli n, lli r)
{
	if(r==0 || r==n) return 1;
	else return combi(n-1,r) + combi(n-1,r-1);
}
lli sigma1(lli n){return n*(n+1)/2;}
lli sigma2(lli s, lli n){return sigma1(n) - sigma1(s -1);}
using namespace std;
// }}} End Header

int main()
{
	double a, b, h, m;
	cin >> a >> b >> h >> m;
	double gosa  = (m/60.0)*30.0;
	double kakudo = (double)abs(30*h+gosa - 6*m);
	double sita = (kakudo / 180.000)*PI;
	double ans = powl(a*a+b*b-2*a*b*cos(sita), 0.5);
	cout << fixed << setprecision(15) << ans << endl;
	return 0;
}


Measured memory_bytes: 4260
#include <stdio.h>
#include <stdlib.h>

int main(int argc, char *argv[]) {
  int M, D;
  scanf("%d %d", &M, &D);
  int i, j, cnt = 0, a;
  for(i=2; i<=M; i++) {
    for(j=22; j<=D; j++) {
      a = j%10;
      if(j%10 >= 2) {
        if(a*(j/10) == i){
          cnt++;
        }
      }
    }
  }
  printf("%d\n", cnt);
  return 0;
}


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

using namespace std;

#define DUMP(x) std::cout << (#x) << " = " << (x) << "\n"
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define REP(i, k, n) for (int i = (k); i < (int)(n); ++ i)
#define ALL(r) r.begin(), r.end()
#define YES puts("YES")
#define Yes puts("Yes")
#define NO puts("NO")
#define No puts("No")
#define IMP puts("IMPOSSIBLE")
#define Imp puts("Impossible")
#define pb push_back

template<typename T> T DUP(T x, T y) { return (x + y - 1) / y; };
template <typename A, size_t N, typename T>
void arrayFill(A(&array)[N], const T& val) {
    std::fill((T*)array, (T*)(array + N), val);
}
using ll = int64_t;
using vint = vector<int32_t>;
using vvint = vector<vint>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pint = pair<int32_t, int32_t>;
using setint = unordered_set<int32_t>;
using setstr = unordered_set<string>;
using qint = queue<int32_t>;

constexpr std::int32_t INF = 1001001001;
constexpr std::int64_t LINF = 1001001001001001001;

void Main() {
    int n, k;
    cin >> n >> k;
    vint x(n);
    rep(i, n) {
        cin >> x[i];
    }

    ll cost = LINF;

    for (int i = 0; i < n - k + 1; ++i) {
        ll left = x[i];
        ll right = x[i + k - 1];
        if ((left >= 0 && right >= 0) || (left <= 0 && right <= 0)) {
            cost = min(cost, max(abs(left), abs(right)));
        }
        else {
            cost = min(cost, min(abs(left), abs(right)) * 2 + max(abs(left), abs(right)));
        }
    }

    cout << cost << endl;
}

int main() {
    std::cin.tie(nullptr);
    std::ios_base::sync_with_stdio(false);
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 640
#include <iostream>
using namespace std;
int main()
{
  int R;
  string str;
  cin >> R;
  if(1200 > R)
  {
    str = "ABC";
  }else if(2800 > R)
  {
    str = "ARC";
  }else
  {
    str = "AGC";
  }
  cout << str << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <vector>
#include <queue> 
using namespace std;
int main(void){
    int data[3];
    cin>>data[0]>>data[1]>>data[2];
    sort(data,data+3);
    cout<<data[0]+data[1]<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>

int main(void){
  char str[512],stack[512];
  int i,j,sp,l;
  //puts(emp);
  fgets(str,sizeof(str),stdin);
  l=strlen(str);
  //printf("%d\n",l);
  //puts(str);
  if(str[0]!='m') puts("Rabbit");
  else{
    sp=0;
    for(i=0;i<l-1;i++){
      stack[sp]=str[i];
      if(i>=2&&stack[sp-2]=='m'&&stack[sp-1]=='e'&&stack[sp]=='w'){
	for(j=sp;j>=sp-2;j--) stack[j]=' ';
	sp-=2;
	//printf("%d %d\n",sp,i);
	//puts(stack);
	if(i!=l-2&&sp==0){
	  //puts("out");
	  break;
	}
      }else sp++;
    }
    //printf("%d\n",i);
    if(sp==0&&i==l-1) puts("Cat");
    else puts("Rabbit");
  }   
  return 0;
}

Measured memory_bytes: 524
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))
def getArray(intn):
    return [int(input()) for i in range(intn)]
def input():
    return sys.stdin.readline().rstrip()
def rand_N(ran1, ran2):
    return random.randint(ran1, ran2)
def rand_List(ran1, ran2, rantime):
    return [random.randint(ran1, ran2) for i in range(rantime)]
def rand_ints_nodup(ran1, ran2, rantime):
  ns = []
  while len(ns) < rantime:
    n = random.randint(ran1, ran2)
    if not n in ns:
      ns.append(n)
  return sorted(ns)

def rand_query(ran1, ran2, rantime):
  r_query = []
  while len(r_query) < rantime:
    n_q = rand_ints_nodup(ran1, ran2, 2)
    if not n_q in r_query:
      r_query.append(n_q)
  return sorted(r_query)

from collections import defaultdict, deque, Counter
from sys import exit
from decimal import *
from heapq import heapify, heappop, heappush
import math
import random
import string
from copy import deepcopy
from itertools import combinations, permutations, product
from operator import mul, itemgetter
from functools import reduce
from bisect import bisect_left, bisect_right

import sys
sys.setrecursionlimit(1000000000)
mod = 10 ** 9 + 7

#############
# Main Code #
#############

S = input()
N = len(S)
cnt_wb = 0 # 白黒
cnt_bw = 0 # 黒白
for i in range(N):
    if (S[i] == '0') ^ (i % 2 == 0):
        cnt_wb += 1
    else:
        cnt_bw += 1
print(min(cnt_wb, cnt_bw))

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

void show(int a, int b, int c) { cout << a << " " << b << " " << c << endl; }
int main() {
  int in[3];
  int tmp;
  cin >> in[0] >> in[1] >> in[2];
  if (in[0] > in[1]) {
    tmp = in[0];
    in[0] = in[1];
    in[1] = tmp;
  }
  if (in[1] > in[2]) {
    tmp = in[1];
    in[1] = in[2];
    in[2] = tmp;
  }
  if (in[0] > in[1]) {
    tmp = in[0];
    in[0] = in[1];
    in[1] = tmp;
  }

  show(in[0], in[1], in[2]);
}


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

using namespace std;

typedef long long ll;

const int N = 2e5 + 5;

int n;
ll cnt[N], a[N];

int main() {
    scanf("%d", &n);
    for (int i = 1; i <= n; i++) {
        scanf("%lld", &a[i]);
        cnt[a[i]]++;
    }
    ll ans = 0;
    for (int i = 1; i <= n; i++) ans += cnt[i] * (cnt[i] - 1) / 2;
    for (int i = 1; i <= n; i++) printf("%lld\n", ans - cnt[a[i]] + 1);
    return 0;
}

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

int main() {
  string s;
  cin >> s;
  s.pop_back();
  while (!s.empty()) {
    int len = s.length();
    if (s.substr(0, len/2) == s.substr(len/2, len) &&
	len % 2 == 0) {
      break;
    }
    s.pop_back();
  }
  cout << s.length() << endl;
}

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

ll min(ll a, ll b)
{
    if (a>b)
    {
        return b;
    }
    return a;
}

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    ll n,m;
    cin>>n>>m;
    if (n==1||m==1)
    {
        cout<<1;
        return 0;
    }
    cout<<(n*m)/2+min(n%2,m%2);
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long ll;
const int N=2e5+5;
int n,X,x[N],i,j;
ll ans=1ll<<60,su[N];
int main(){
	scanf("%d%d",&n,&X);
	for(i=1;i<=n;++i)scanf("%d",x+i),su[i]=su[i-1]+x[i];
	for(i=1;i<=n;++i){
		ll z=1ll*i*X+5*(su[n]-su[n-i]);
		for(j=2;n>(j-1)*i && z<ans;++j)z+=(j<<1|1)*(su[n-(j-1)*i]-su[std::max(0,n-j*i)]);
		ans=std::min(ans,z);
	}
	printf("%lld\n",ans+1ll*n*X);
	return 0;
}


Measured memory_bytes: 2560
import java.util.Scanner;
class Main
{
	static class Stack
	{
		int A[], head;
		Stack( int size )
		{
			A = new int[size+1];
			head = 0;
		}
		void show()
		{
			for( int i = 1 ; i < A.length ; i++ )
				if( i==A.length-1 )System.out.println(A[i]);
				else System.out.print(A[i]+" ");
		}
		boolean isEmpty(){return head==0;}
		boolean isFull( ){return head==A.length-1;}
		void push( int key )
		{
			if( isFull() )return;
			A[++head] = key;
		}
		int pop()
		{
			if( isEmpty() )return 0;
			return A[head--];
		}
	}
	public static void main( String[] args )
	{
		Scanner sc = new Scanner( System.in );
		String com;
		Stack stack = new Stack(100);
		while( sc.hasNext() )
		{
			com = sc.next();
			
			if( com.equals("+") )
				stack.push( stack.pop()+stack.pop() );
			else if( com.equals("-") )
				stack.push( -1*stack.pop()+stack.pop() );
			else if( com.equals("*") )
				stack.push( stack.pop()*stack.pop() );
			else
				stack.push(Integer.parseInt(com));
		}
		System.out.println( stack.pop() );
	}
}

Measured memory_bytes: 25964
n , k , q = map(int , input().split())
a = [0] * (n + 1)
b = list(map ( int , input().split()))
for i in range(1 , n + 1):
	a[i] = b[i - 1];
def check( l , r):
	cnt = 0;
	ln = 0;
	res = 0;
	for i in range(1 , n + 1):
		if a[i] < l:
			res += min(cnt , max(0 , ln - k + 1))
			ln = 0;
			cnt = 0;
		else :
			ln += 1;
			if a[i] <= r:
				cnt += 1;
	res += min(cnt , max(0 , ln - k + 1))
	if(res >= q):
		return True;
	return False;						

l = 0;
r = 1000000000;
res = 1000000000;
while(l <= r):
	m = (l + r) // 2;
	ok = 0;
	for i in range(1 , n + 1):
		ok |= check(a[i] - m , a[i]);
	if ok == 1:
		r = m - 1;
		res = m;
	else :
		l = m + 1;
print(res)

Measured memory_bytes: 53248
using System;
using System.Linq;
using System.Collections.Generic;
using System.IO;
using static System.Console;

namespace atcorder2
{
    class Program
    {
        public static long Read()
        {
            return long.Parse(ReadLine());
        }

        public static long[] Reads()
        {
            return ReadLine().Split().Select(long.Parse).ToArray();
        }


        public static long gcd(long x,long y)
        {
            if (y < x) gcd(y, x);
            while (y != 0)
            {
                var z = x % y;
                x = y;
                y = z;
            }
            return x;
        }

        public static long C(long n,long k)
        {
            long x=1;
            for (long i = 1; i <=k; i++)
            {
                x *= n - i + 1;
                x /= i;
            }
            return x;
        }
        static void Main(string[] args)
        {
            var sw = new StreamWriter(OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

            var q = Reads();
           
            
            var n = q[0];
            var k = q[1];
            var s = q[2];

            if (s != 1000000000)
            {
                for (int i = 0; i < k; i++)
                {
                    Write(s);
                    Write(" ");
                }
                for (long i = k; i < n; i++)
                {
                    Write(s + 1);
                    Write(" ");
                }
                WriteLine();
            }
            else
            {
                for (int i = 0; i < k; i++)
                {
                    Write(s);
                    Write(" ");
                }
                for (long i = k; i < n; i++)
                {
                    Write(1);
                    Write(" ");
                }
                WriteLine();
            }

            Console.Out.Flush();
        }
    }
}


Measured memory_bytes: 22972
#include <bits/stdc++.h>
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ll long long
using namespace std;

const ll P = 1000000007;
int gcd(int a, int b) { return b != 0 ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }

int main()
{
  cout << fixed << setprecision(10);
  int N;
  cin >> N;
  if(N%2==0)
  {
    cout << 0.5 << endl;
  }
  else
  {
    double M = N;
    double n = (M/2+0.5)/M;
    cout << n << endl;
  }
  return 0;
}


Measured memory_bytes: 3708
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<set>
#include<map>

#define INF 1000000007
#define LINF 1000000000000000007

using namespace std;

typedef long long Int;
typedef pair<Int, Int> P;

Int gcd(Int x, Int y){
	if(y == 0)
		return x;
	return gcd(y, x % y);
}

Int lcm(Int x, Int y){
	return x * y / gcd(x, y);
}

bool sosuu(int x){
	bool b = 1;
	if(x == 1) b = 0;
	for(int i = 2; i * i <= x; i++){
		if(x % i == 0) {
			b = 0;
			break;
		}
	}
	return b;
}

int a, b;

int main(){
	cin >> a >> b;
	if(a % 2 && b % 2)
		cout << "Odd" << endl;
	else{
		cout << "Even" << endl;
	}
	
	return 0;
}

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

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int a, b, c;
    a = b = c = -1;
    int n = sc.nextInt();
    int y = sc.nextInt();
    for (int i = 0; i <= n; i++) {
      for (int j = 0; j <= (n - i); j++) {
        int tmpA = i;
        int tmpB = j;
        int tmpC = n - i - j;
        if (10000 * tmpA + 5000 * tmpB + 1000 * tmpC == y) {
          a = tmpA;
          b = tmpB;
          c = tmpC;
        }
      }
    }

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

Measured memory_bytes: 39384
#include "bits/stdc++.h"
using namespace std;
///////////////////////////////////////////
const long long int INF = 1LL<<60;
const long long int Mod = 1000000007;
using ll = long long int; using ci = const int;
using vi = vector<int>;  using Vi = vector<long long int>;
using P = pair<int, int>;  using PLL = pair<ll, ll>;
using matrix = vector<vector<ll>>;
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define rep(i,N) for(ll i = 0; i < (ll)N; i++)
#define repi(i,a,b) for(ll i = ll(a); i < ll(b); ++i)
template<class T>bool chmax(T &former, const T &b) { if (former<b) { former=b; return true; } return false; }
template<class T>bool chmin(T &former, const T &b) { if (b<former) { former=b; return true; } return false; }
template<class T>T sqar(T x){ return x*x; }//sqrt(x)は平方根;
#define Sort(v) std::sort(v.begin(), v.end(), std::greater<decltype(v[0])>()) //降順でVをソート
#define p_queue(v) priority_queue<v, vector<v>, greater<v> >
template<class T> inline void princ(T x){cout<<x<<" ";}; 
template<class T> inline void print(T x){cout<<x<<"\n";};
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
///////////////////////////////////////////////////////////////////////////////////

ll n;
Vi a;
Vi sum;
int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    std::cout<<std::fixed<<std::setprecision(30);
    cin>>n;
    a.resize(n);
    rep(i,n){
        cin>>a[i];
    }
    for(ll i = n;i>=1;i--){
        ll tp = 0;
        for(ll j=i*2;j<=n;j+=i){
            if(a[j-1])tp++;
        }
        a[i-1] += tp;
        a[i-1] %= 2;
    }
    ll m = 0;
    rep(i,n){
        m += a[i];
    }
    print(m);
    rep(i,n){
        if(a[i])princ(i+1);
    }
    if(m!=0)print("");
    return 0;
}

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

typedef long long ll;
const int maxn=1e6+7;
const int inf=INT_MAX;
const ll inff=1e18;
const ll mod=1e9+7;
#define pii pair<int,int>
#define mkp make_pair
#define F first
#define S second
#define pb push_back
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(),(v).end()
//#define int ll

#ifdef HNO2
#define IOS
#else
#define endl '\n'
#define IOS ios::sync_with_stdio(0); cin.tie(0);
#endif // HNO2

int32_t main()
{
    IOS
    int n,k;
    cin>>n>>k;
    int cnt=0;
    while (n)
    {
        n/=k;
        cnt++;
    }
    cout<<cnt<<endl;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
	
	ll n; cin>>n;
	ll b[n-1];
	for(int i = 0; i < n-1; i++) cin>>b[i];
	ll a[n];
	for(int i = 0; i < n; i++){
		a[i] = 0;
	}
	a[0] = b[0]; 
	for(int i = 0; i < n-1; i++){
		if(a[i] > b[i] ) a[i] = b[i];
		a[i+1] = b[i];
	}
	
	ll sum = 0;
	for(int i = 0; i < n; i++) sum += a[i];
	cout<<sum<<"\n";
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
#define ff              first
#define ss              second
#define ll              long long
#define dd				double
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define vll				vector<long long>
#define vpii			vector<pair<int,int>>
#define vpll			vector<pair<long long,long long>>
#define vvi				vector<vector<int>>
#define vvl				vector<vector<long long>>
#define mii             map<int,int>
#define mll  			map<long long,long long>
#define umii			unordered_map<int,int>
#define umll			unordered_map<long long,long long>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define rep(i,n)		for(int i=0;i<n;i++)
#define rep2(i,a,b)		for(int i=a;i<b;i++)
#define rev(i,n)		for(int i=n;i>=0;i--)
#define rev2(i,a,b)		for(int i=a;i>=b;i--)
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define inf             9e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define fio				ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl			'\n'
#define all(x)			x.begin(),x.end()
#define d0(x)			cout <<x<<" "
#define d1(x)			cout <<x<<endl
#define d2(x,y)			cout <<x<<" "<<y<<endl
#define d3(x,y,z)		cout <<x<<" "<<y<<" "<<z<<endl
#define d4(x,y,z,w)		cout <<x<<" "<<y<<" "<<z<<" "<<w<<endl
const ll mod=1e9+7;
const dd pi=M_PI;
const ll MOD=998244353;
void i_o()
{
	#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
	#endif
} 
int main()
{
	fio
   	i_o();
	int a,b,c,d;
	cin>>a>>b>>c>>d;
	while(1>0){
	if(c-b<=0){
	 cout<<"Yes"<<endl;
	 break;
	}
	else{
		c=c-b;
		if(a-d<=0){
			cout <<"No"<<endl;
			break;
		}
		a=a-d;
	}
}


    
	return 0;
}



Measured memory_bytes: 3652
import numpy as np


def solve(*args: str) -> str:
    h, w, k = map(int, args[0].split())
    white = np.array([[n for n in map(int, S)] for S in args[1:]])

    ret = h*w
    for b in range(2**(h-1)):
        h_cuts = list(i+1 for i in range(h-1) if (b >> i) & 1 == 1)
        count = len(h_cuts)
        if ret < count:
            continue

        A = np.array(list(x.sum(axis=0) for x in np.vsplit(white, h_cuts)))
        if (k < A).any():
            continue

        S = np.zeros((1, len(A)), dtype=int)
        for x in range(w):
            S += A[:, x]
            if (k < S).any():
                S = A[:, x]
                count += 1
                if ret < count:
                    break

        ret = min(ret, count)

    return str(ret)


if __name__ == "__main__":
    print(solve(*(open(0).read().splitlines())))


Measured memory_bytes: 14520
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <algorithm>
#include <cmath>
using namespace std;
typedef long long ll;

int main()
{
    int A, B;
    string S;
    cin >> A >> B >> S;

    bool flag = true;
    if (S.at(A) == '-')
    {
        for (int i = 0; i < A; i++)
        {
            if (!isdigit(S.at(i)))
            {
                flag = false;
                break;
            }
        }

        for (int i = A + 1; i < A + B + 1; i++)
        {
            if (!isdigit(S.at(i)))
            {
                flag = false;
                break;
            }
        }
    }
    else
    {
        flag = false;
    }

    if (flag)
        cout << "Yes";
    else
        cout << "No";
}

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

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

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

int main() {
  int N, l, r, i, num = 0;
  cin >> N;
  for (i = 1 ; i <= N ; i++) {
    cin >> l >> r;
    num += r - l + 1;
  }
  cout << num << endl;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

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

    int a;
    int count = 0;
    for(int i = 0; i < n; i++){
        if(p[i] != i + 1){
            count++;
        }
    }

    if(count <= 2){
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }


    return 0;
}

Measured memory_bytes: 256
import sys
read = sys.stdin.buffer.read
from fractions import gcd
from functools import reduce

n, m, *alst = list(map(int, read().split()))
mm = 2 * m


def lcm(x, y):
    g = gcd(x, y)
    if x // g % 2 == 0 or y // g % 2 == 0:
        print(0)
        quit()
    g = x * y // g
    if g > mm:
        print(0)
        quit()
    return g


g = reduce(lcm, alst)
res = (mm // g)
print(res // 2 + res % 2)

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

typedef priority_queue<int> maxHeap;
typedef priority_queue<int, vector<int>, greater<int>> minHeap;
#define endl "\n"
#define int long long
#define MOD 1000000007
#define PI 3.1415926535897932384626433832795
#define max(x, y) ((x > y) ? x : y)
#define min(x, y) ((x < y) ? x : y)
#define mid(s, e) ((s + (e - s) / 2))

bool test_cases;

void init(bool k) {
    test_cases = k;
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
}

struct precompute {
    void compute() {
    }
};

double dp[3000][3000];

struct test_cases {
    double aagekiProb(double a[], int n, int i, int tailsReq, int curHeads, int curTails) {
        if (i == n) {
            return 1;
        }
        if (dp[curHeads][curTails] != 2.000) {
            return dp[curHeads][curTails];
        }
        if (curTails == tailsReq) {
            double k2 = a[i] * aagekiProb(a, n, i + 1, tailsReq, curHeads + 1, curTails);
            double k3 = 0;
            // dp[curHeads + 1][curTails] = k2;
            return dp[curHeads][curTails] = k3 + k2;
        } else {
            double k2 = a[i] * aagekiProb(a, n, i + 1, tailsReq, curHeads + 1, curTails);
            double k3 = (1 - a[i]) * aagekiProb(a, n, i + 1, tailsReq, curHeads, curTails + 1);
            // dp[curHeads][curTails + 1] = k3;
            // dp[curHeads + 1][curTails] = k2;
            return dp[curHeads][curTails] = k3 + k2;
        }
    }

    void test_case() {
        int n;
        cin >> n;
        for (int i = 0; i < 3000; i++) {
            for (int j = 0; j < 3000; j++) {
                dp[i][j] = 2.000;
            }
        }
        double a[n];
        for (int i = 0; i < n; i++) cin >> a[i];

        cout << fixed << setprecision(10) << aagekiProb(a, n, 0, n / 2, 0, 0) << endl;
    }
};

int32_t main() {
    init(false);
    int tc;
    if (test_cases) {
        cin >> tc;
    } else {
        tc = 1;
    }
    struct precompute l;
    l.compute();
    for (int i = 0; i < tc; i++) {
        struct test_cases o;
        o.test_case();
    }
    return 0;
};

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

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef string str;
using P = pair<int, int>;
const ll inf =1e9;
const ll mod = 1e9+7;

struct edge{
    int to;
    int cost;
};
using graph = vector<vector<edge>>;

int main(){
    str s, t; cin >> s >> t;
    int a, b; cin >> a >> b;
    str tmp; cin >> tmp;
    if(tmp == s){
        cout << a-1 << " " << b;
    }else{
        cout << a << " " << b-1;
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
const long long INF = 1e9 + 7;
using namespace std;
map<int, int> mp;
int main()
{
	int dmin = 100;
	int n;
	cin >> n;
	vector<int> a(n);
	for (int i = 0; i < n; i++) cin >> a[i];
	for (int i = 0; i < n; i++) {
		int d = 0;
		while (a[i] % 2 == 0) {
			a[i] /= 2;
			d++;
		}
		dmin = min(dmin, d);
	}
	cout << dmin << endl;
	return 0;
}

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

int main()
{
  long N, M;
  cin >> N >> M;

  long ans;
  
  if (N >= M / 2)
  {
    ans = M / 2;
  }
  else // N < M / 2
  {
    ans = N;
    long remaining_c = M - N * 2;
    ans += remaining_c / 4;
  }

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

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

  for (int i = 1; i <= N; i++) {
    char S;
    cin >> S;

    if (S == 'Y') {
      cout << "Four" << endl;
      break;
    }
    else if (i == N){
      cout << "Three" << endl;
    }
    else 
      continue;

  }
}


Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<bits/stdc++.h>
#include<string.h>
using namespace std;
typedef long long int ll;
const ll maxn=1e6+8;
int x,m;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n,x,t;
    cin>>n>>x>>t;
    if(n%x==0)
        cout<<t*(n/x);
    else
    {
        ll r=n%x;
        n=n+(x-r);
        cout<<t*(n/x);
    }
    cerr<<"\nTime elapsed:"<< 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
    return 0;
}


Measured memory_bytes: 3608
#include<vector>
class mod_int{
private:
    unsigned long long num;
public:
    static constexpr auto mod=static_cast<unsigned long long>(1e9+7);
    static mod_int pow(mod_int x,unsigned long long y)
    {
        return y==0?1:y%2==0?pow(x*x,y/2):x*pow(x,y-1);
    }
    mod_int()=default;
    mod_int(unsigned long long n):num(n%mod)
    {
    }
    explicit operator unsigned long long()const
    {
        return num;
    }
    bool operator==(const mod_int&mi)const
    {
        return num==mi.num;
    }
    bool operator!=(const mod_int&mi)const
    {
        return !operator==(mi);
    }
    mod_int operator~()const
    {
        return pow(*this,mod-2);
    }
    mod_int operator+(const mod_int&mi)const
    {
        return num+mi.num;
    }
    mod_int operator-(const mod_int&mi)const
    {
        return num+mod-mi.num;
    }
    mod_int operator*(const mod_int&mi)const
    {
        return num*mi.num;
    }
    mod_int operator/(const mod_int&mi)const
    {
        return num*(~mi).num;
    }
    mod_int&operator+=(const mod_int&mi)
    {
        return*this=operator+(mi);
    }
    mod_int&operator-=(const mod_int&mi)
    {
        return*this=operator-(mi);
    }
    mod_int&operator*=(const mod_int&mi)
    {
        return*this=operator*(mi);
    }
    mod_int&operator/=(const mod_int&mi)
    {
        return*this=operator/(mi);
    }
};
class combination_modulo:mod_int{
private:
    std::vector<mod_int>factorial_mod;
public:
    combination_modulo(unsigned long long max_n):factorial_mod(max_n+1)
    {
        factorial_mod[0]=1;
        for(unsigned long long i=1;i<=max_n;++i)factorial_mod[i]=factorial_mod[i-1]*i;
    }
    mod_int operator()(unsigned long long n,unsigned long long r)
    {
        return n<r?0:factorial_mod[n]/(factorial_mod[r]*factorial_mod[n-r]);
    }
};

#include"bits/stdc++.h"
using namespace std;
using ll=long long;
constexpr auto inf=static_cast<ll>(1e18);
template<typename T=ll>inline T in(istream&is=cin){T ret;is>>ret;return ret;}
template<typename T=ll>inline auto vec2(typename vector<T>::size_type h,typename vector<T>::size_type w,T v=T()){return vector<vector<T>>(h,vector<T>(w,v));}
int main()
{
    ll x=in(),y=in();
    if((2*y-x)%3!=0||(2*x-y)%3!=0){
        cout<<0<<endl;
    }else{
        ll a=(2*y-x)/3,b=(2*x-y)/3;
        if(a<0||b<0){
            cout<<0<<endl;
        }else{
            combination_modulo cm(a+b);
            cout<<(unsigned long long)cm(a+b,a)<<endl;
        }
    }
}


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

#define all(x) (x).begin(),(x).end()

#define MOD 1000000007

#define pi 3.14159265358979323846

using namespace std;

int main(){
	int a, b;	cin >> a >> b;
	double h, m;	cin >> h >> m;
	double angle[3];
	double ans;

	angle[0] = pi / 6 * h + pi / 360 * m;
	angle[1] = pi / 30 * m;
	angle[2] = abs( angle[0] - angle[1] );
	if( angle[2] > pi )	angle[2] = 2 * pi - angle[2];

	ans = (a * a) + (b * b) - (2 * a * b * cos( angle[2] ));
	ans = pow( ans, 0.5 );

	printf( "%.20lf", ans );

	return 0;
}


Measured memory_bytes: 4356
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i) = 0; (i) < (n); ++(i))
#define rrep(i,n) for(int (i) = (n) - 1; (i) >= 0; --(i)) //Reversi rep
#define nfor(i,a,b) for(int (i) = (a); (i) < (b); ++(i)) //Natural for
#define rfor(i,a,b) for(int (i) = (b); (i) >= (a); --(i)) //Reversi for
#define mod (1000000007)
#define YES cout << "YES" << endl;
#define Yes cout << "Yes" << endl;
#define NO cout << "NO" << endl;
#define No cout << "No" << endl;

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)) {
        Yes;
    }else{
        No;
    }
    return 0;
}

Measured memory_bytes: 256