akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main()
{
  ll n;cin>>n;
  ll a[n];
  for(ll i=0;i<n;i++)cin>>a[i];
  sort(a,a+n);
  for(ll i=1;i<n;i++){
    if(a[i]==a[i-1]){
      cout<<"NO"<<endl;return 0;
    }
  }
  cout<<"YES"<<endl;
  return 0;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define PI pair<int,int>
#define ff first
#define ss second
#define MAX 111111
#define endl '\n'
#define boost ios_base::sync_with_stdio(0);cin.tie(0)
#define ONLINE_JUDGE freopen("input.txt","r",stdin);freopen("output.txt","w",stdout)
const int inf=1e15;

int32_t main()
{
	//ONLINE_JUDGE;
    boost;

   int n;
   cin>>n;
   int a[n+1];
   int pf[n+1]={0},sf[n+1]={0};
   for(int i=1;i<=n;i++)
   {
   	cin>>a[i];
   	pf[i]=pf[i-1]+a[i];
   }

   sf[n]=a[n];
   int ans=inf;
   for(int i=n-1;i>0;i--)
   {
   	sf[i]=sf[i+1]+a[i];
   	ans=min(ans,abs(pf[i]-sf[i+1]));	
   }
   cout<<ans<<endl;
}


Measured memory_bytes: 5120
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int t,head[50],w[50];

struct edges{
	int to,next;
}e[(50*50)<<1];

void add(int x,int y){
	e[++t] = (edges){y,head[x]};
	head[x] = t;
}

int n,m,ans=1000000,now;
int vis[50],step;
void dfs(int x){
	step++;
	//cout<<x<<' '<<step<<endl;
	if(x==n){
		for(int p=head[x]; p; p=e[p].next) if(!vis[e[p].to])
			now+=w[e[p].to]; 
		ans=min(ans,now);
		for(int p=head[x]; p; p=e[p].next) if(!vis[e[p].to])
			now-=w[e[p].to];
		step--;
		//printf("vis[2]=%d\n",vis[2]);
		return;
	}
	for(int p=head[x]; p; p=e[p].next) if(!vis[e[p].to]){
		vis[e[p].to]=step;
		now+=w[e[p].to];
	}
	for(int p=head[x]; p; p=e[p].next) if(vis[e[p].to]==step){
		
		dfs(e[p].to);
		//printf("**step=%d  next(%d)=%d  vis[]=%d\n",step,x,e[e[p].next].to,vis[e[e[p].next].to]);
	}
	for(int p=head[x]; p; p=e[p].next) if(vis[e[p].to]==step){
		vis[e[p].to]=0;
		now-=w[e[p].to];
	}
	step--;
	//cout<<step<<endl;
}
int main(){
	int x,y;
	cin>>n>>m;
	for(int i=1;i<=n;++i)scanf("%d",&w[i]);
	for(int i=1;i<=m;++i){
		scanf("%d%d",&x,&y);
		add(x,y);add(y,x);
	}
	now=w[1];
	vis[1]=1;
	dfs(1);
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3252
#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<string>
#include<cmath>
#include<vector>
#include<stack>
#include<queue>
#include<time.h>
#include<set>
#include<map>
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a,b) for(int i=a;i>b;i--)
#define vint vector<int> 
#define vvint vector<vint>
#define ct(a) cout<<a<<endl
#define tget(a,b) get<a>(b)
using namespace std;
typedef long long ll;
const ll INF = 1e17;
const int MOD = 1e9 + 7;

int r,g, b;

int main(void) {
	cin >>r>> g >> b;
	if ((2 * g + b) % 4 == 0)ct("YES");
	else ct("NO");
	return 0;
}

Measured memory_bytes: 256
class UnionFind:
    def __init__(self, n):
        self.par = list(range(n)) #親
        self.rank = [0] * n #根の深さ

    # xの属する根を求める
    def find(self, x):
        if self.par[x] == x:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]

    # 併合
    def unite(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x == y:
            # if they have the same parent, no need to union
            return
        if self.rank[x] < self.rank[y]:
            self.par[x] = y
        else:
            self.par[y] = x
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1

    # xとyが同じ集合に属するかを判定（同じ根に属するか）
    def same(self, x, y):
        return self.find(x) == self.find(y)


N, M = map(int, input().split())
uf = UnionFind(N)

for _ in range(M):
    a, b = map(int, input().split())
    uf.unite(a-1, b-1)

ans = -1
for i in range(N):
    if uf.par[i] == i:
        ans +=1
print(ans)

Measured memory_bytes: 13536
use std::io::stdin;
use std::str::FromStr;

fn read_line<T>() -> Vec<T>
where
    T: FromStr,
    <T as std::str::FromStr>::Err: std::fmt::Debug,
{
    let mut s = String::new();
    stdin().read_line(&mut s).ok();
    s.trim()
        .split_whitespace()
        .map(|x| x.parse().unwrap())
        .collect()
}

fn main() {
    let in_vec: Vec<usize> = read_line();
    let s = in_vec[0];
    let w = in_vec[1];

    if s <= w {
        println!("{}", "unsafe");
    } else {
        println!("{}", "safe");
    }
}


Measured memory_bytes: 2124
#include <algorithm>
#include <iostream>
#include <string>

using namespace std;

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

  int n    = 0;
  int cnt0 = 0;
  for (auto c : S) {
    if (c - '0' != n) cnt0++;
    n = !n;
  }
  n        = 1;
  int cnt1 = 0;
  for (auto c : S) {
    if (c - '0' != n) cnt1++;
    n = !n;
  }
  cout << min(cnt0, cnt1) << endl;
  return 0;
}


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

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

  auto convert = [&](string u) {
    char c = 'a';
    map<char, char> mp;
    rep(i, u.size()) {
      if (!mp[u[i]]) {
        mp[u[i]] = c;
        u[i] = c;
        c++;
      } else {
        u[i] = mp[u[i]];
      }
    }
    return u;
  };

  cout << (convert(s) == convert(t) ? "Yes" : "No") << endl;
  return 0;
}


Measured memory_bytes: 4064
using System;

class quiz
{
    public bool solve(int N, int[] L)
    {
        int sum = 0;

        Array.Sort(L);

        for (int i = 0; i < N - 1; i++)
        {
            sum += L[i];
        }

        if(sum > L[N-1])
        {
            return true;
        }

        return false;
    }

    public int[] ParseIntBySpace(string str)
    {
        int[] array = new int[str.Length];
        int lastloc = 0, spaceloc = -1;

        for (int i = 0; i < str.Length; i++)
        {
            if (str[i] == ' ')
            {
                array[lastloc++] = int.Parse(str.Substring(spaceloc + 1, i - spaceloc - 1));
                spaceloc = i;
            }
            else if (i == str.Length - 1)
            {
                array[lastloc++] = int.Parse(str.Substring(spaceloc + 1, i - spaceloc));
            }
        }

        Array.Resize(ref array, lastloc);

        return array;
    }
}

class Example
{
    static void Main()
    {
        quiz ex = new quiz();

        int N = int.Parse(Console.ReadLine());

        int[] L = ex.ParseIntBySpace(Console.ReadLine());

        if(ex.solve(N, L))
        {
            Console.WriteLine("Yes");
        }
        else
        {
            Console.WriteLine("No");
        }
    }
}

Measured memory_bytes: 13140
#include<bits/stdc++.h>
#define N 50
using namespace std;

int n,m,sy,sx,gy,gx,d,y,x,flag,anscnt;
bool used[N][N][N][N][4],ans[N][N];
string s[N];
int dy[4]={-1,0,1,0};
int dx[4]={0,1,0,-1};

int main(){
  cin>>n>>m;
  for(int i=0;i<n;i++)cin>>s[i];
  for(int i=0;i<n;i++){
    for(int j=0;j<m;j++){
      if(s[i][j]=='G')gy=i,gx=j,s[i][j]='.';
      if(s[i][j]=='^')sy=i,sx=j,d=0;
      if(s[i][j]=='>')sy=i,sx=j,d=1;
      if(s[i][j]=='v')sy=i,sx=j,d=2;
      if(s[i][j]=='<')sy=i,sx=j,d=3;
    }
  }
  used[sy][sx][sy][sx][d]=ans[sy][sx]=true;
  y=sy,x=sx;
  while(1){
    int uy=y+dy[d];
    int ux=x+dx[d];
    int ury=y+dy[d]+dy[(d+1)%4];
    int urx=x+dx[d]+dx[(d+1)%4];
    int ry=y+dy[(d+1)%4];
    int rx=x+dx[(d+1)%4];
    bool u=false,ur=false,r=false;
    if(uy<0||ux<0||n<=uy||m<=ux)u=true;
    else if(s[uy][ux]=='#')u=true;
    if(ury<0||urx<0||n<=ury||m<=urx)ur=true;
    else if(s[ury][urx]=='#')ur=true;
    if(ry<0||rx<0||n<=ry||m<=rx)r=true;
    else if(s[ry][rx]=='#')r=true;
    if(r&&!u&&!ur){
      if(used[y][x][uy][ux][d])flag=1;
      used[y][x][uy][ux][d]=ans[uy][ux]=true;
      if(uy==gy&&ux==gx)break;
      used[y][x][uy][ux][(d+1)%4]=true;
      if(used[y][x][ury][urx][(d+1)%4])flag=1;
      used[y][x][ury][urx][(d+1)%4]=ans[ury][urx]=true;
      if(ury==gy&&urx==gx)break;
      y=ury;
      x=urx;
      d=(d+1)%4;
    }
    else if(u){
      if(used[y][x][y][x][(d+3)%4])flag=1;
      used[y][x][y][x][(d+3)%4]=ans[y][x]=true;
      if(y==gy&&x==gx)break;
      d=(d+3)%4;
    }
    else{
      if(used[y][x][uy][ux][d])flag=1;
      used[y][x][uy][ux][d]=ans[uy][ux]=true;
      if(uy==gy&&ux==gx)break;
      y=uy;
      x=ux;
    }
    if(flag)break;
  }
  for(int i=0;i<n;i++)
    for(int j=0;j<m;j++)
      if(ans[i][j])anscnt++;
  if(!flag)cout<<anscnt<<endl;
  else cout<<-1<<endl;
  return 0;
}

Measured memory_bytes: 22668
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define MOD 1000000007
using namespace std;
int main()
{
    string w,t;
    cin >> w;
    for(int i = 0;i < w.size();i++)
    {
        if(w[i] >= 'a' && w[i] <= 'z')
        {
            w[i] = w[i] - 'a' + 'A';
        }
    }
    int ans = 0;
    while(cin >> t && t != "END_OF_TEXT")
    {
        for(int i = 0;i < t.size();i++)
        {
            if(t[i] >= 'a' && t[i] <= 'z')
            {
                t[i] = t[i] - 'a' + 'A';
            }
        }
        if(w == t)
        {
            ans++;
        }
    }
    cout << ans << "\n";

    return 0;
}


Measured memory_bytes: 3140
N = int(input())
red = [list(map(int, input().split())) for _ in range(N)]
blue = [list(map(int, input().split())) for _ in range(N)]

# 青をx座標で昇順ソート
blue.sort(key=lambda x: x[1])

# 赤をy座標で降順ソート
red.sort(key=lambda x: x[0], reverse=True)

red_list = [0] * N

for b in range(N):
    for r in range(N):
        if red_list[r] == 1:
            continue
        if red[r][0] < blue[b][0] and red[r][1] < blue[b][1]:
            red_list[r] = 1
            break

print(sum(red_list))


Measured memory_bytes: 67160
import sys

sys.setrecursionlimit(200000)


def dfs(i: int) -> None:
    global visited, edges, counter, finish_order
    visited[i] = True
    for edge in edges[i]:
        if visited[edge]:
            continue
        dfs(edge)
    finish_order[i] = (counter, i)
    counter += 1


if __name__ == "__main__":
    V, E = map(int, input().split())
    edges = [set() for _ in range(V)]  # type: ignore

    for _ in range(E):
        s, t = map(lambda x: int(x), input().split())
        edges[s].add(t)

    visited = [False] * V
    finish_order = [(0, 0)] * V
    counter = 0

    for i in range(V):
        if not visited[i]:
            dfs(i)

    for d, i in sorted(finish_order, reverse=True):  # type: ignore
        print(i)


Measured memory_bytes: 13796
while(1):
    try:
        a = float(input())
        b = []
        for i in range(10):
            if i == 0:
                b.append(a)
            else:
                if i%2 == 0:
                    a = a/3
                    b.append(a)
                else:
                    a = a*2
                    b.append(a)
        s = sum(b)
        print("{:.8f}".format(s))
    except EOFError:
        break


Measured memory_bytes: 5584
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
using namespace std;
int main(void){
    int n,k;
    cin>>n>>k;
    int ans=0;
    for(int i=0;i<n;i++){
        int a;
        cin>>a;
        ans+=min(a,abs(a-k));
    }
    cout<<ans*2<<endl;
    return 0;
}


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

using namespace std;
using ll = long long;

//container util
#define SORT(c) sort((c).begin(),(c).end())
#define all(a) (a).begin(), (a).end()

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

//print
#define pv(val) cerr << #val << '=' << (val) << endl

const int INF = 1e9;

int main(void){

	string s; cin >> s;

	string ans;

	REP(i,s.length()){
		if(s[i] == '0') ans += '0';
		else if(s[i] == '1') ans += '1';
		else{
			int N = ans.length();
			if(N == 0) continue;
			else{
				ans = ans.erase(N-1);
			}
		}

	}

	cout << ans << endl;

	return 0;

}


Measured memory_bytes: 3588
#include<stdio.h>
#include<cmath>
using namespace std;

int main(){
    double a,b,c;
    scanf("%lf %lf %lf", &a,&b,&c);
    printf("%.5f\n", (a*b*sin((M_PI*c)/180))/2);
    printf("%.5f\n", a+b+sqrt(pow(a,2)+pow(b,2)-2*a*b*cos((M_PI*c)/180)));
    printf("%.5f\n", b*sin((M_PI*c/180)));
}


Measured memory_bytes: 2932
#include <iostream>
#include <cstdlib>
#include <queue>
#include <set>
#include <vector>
#include <string>
#include <algorithm>
#include <stack>
#include <map>
#include <cstdio>
using namespace std;
#define rep(i, a) for (int i = 0; i < a; i++)
#define irep(i, a) for (int i = 1; i <= a; i++)
#define mp make_pair
#define pb push_back
#define P pair<int, int>
#define ll long long


ll n;
vector<ll>p;

int main()
{
  ll ans=0;
  cin>>n;
  for(ll i=1;i*i<=n;i++){
    if(n%i==0){
      ll h=i;
      ll m=n/h-1;
      if(m>0&&n/m==n%m)ans+=m;

      h=n/i;
      m=n/h-1;
      if(m>0&&n/m==n%m)ans+=m;
    }
  }

  cout<<ans<<endl;


  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#define ll long long int
#define pb push_back
#define mp make_pair

using namespace std;

int main(){

    int x,k;
    cin >> k >> x;
    for(int i=x-k+1;i<x+k;i++){
        cout << i << " ";
    }
    cout << endl;
    return 0;
}

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

#define rep(i,n) for(ll i=0;i<(n);++i)
using ll = int64_t;
using pll = pair<ll,ll>;
constexpr ll INF = 1LL<<60;
constexpr ll MOD = 1e9+7;
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(a>b){a=b;return 1;}return 0;}
#if loc||local
void dump(){cerr<<endl;}
template<class T,class... Ts> void dump(T&& h, Ts&&... t){cerr<<h<<", ";dump(forward<Ts>(t)...);}
#else
void dump(){}
template<class T,class... Ts> void dump(T&& h, Ts&&... t){}
#endif
template<class T> istream &operator>>(istream&is,vector<T>&v){for(auto &elemnt:v)is>>elemnt;return is;}
template<class T,class U> istream &operator>>(istream&is,pair<T,U>&p){is>>p.first>>p.second;return is;}
template<class T> ostream &operator<<(ostream& os,vector<T>const& v){for(auto const& vi:v)os<<vi<<" ";return os;}
template<class T,class U> ostream &operator<<(ostream& os,pair<T,U>const& p){os<<p.first<<","<<p.second;return os;}
template<class T>vector<T> vec(size_t a){return vector<T>(a);}
template<class T, class... Ts>auto vec(size_t a, Ts... ts){return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...));}

signed main(){

  ll n,m,q;
  cin>>n>>m>>q;
  vector<ll> a(q),b(q),c(q),d(q);
  rep(i,q)cin>>a[i]>>b[i]>>c[i]>>d[i],a[i]--,b[i]--;

  ll ans = 0;

  auto calc = [&](vector<ll>& ary){
    ll tmp = 0;
    rep(i,q){
      if(ary[b[i]]-ary[a[i]]==c[i])tmp+=d[i];
    }
    chmax(ans,tmp);
  };

  auto dfs = [&](auto&& dfs,vector<ll>& a,int id)->void{
    if(a.size()!=id)return;
    if(id==n){
      calc(a);
      return ;
    }
    int t = (a.size()?a.back():1);
    for(int i=t;i<=m;++i){
      a.emplace_back(i);
      dfs(dfs,a,id+1);
      a.pop_back();
    }
  };

  vector<ll> x;
  dfs(dfs,x,0);
  cout<<(ans)<<endl;

}

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

int main()
{
    string s;

    cin >> s;

    int count = 0;
    
    if (s[0] == 'R') {
        if (s[1] == 'R') {
            if (s[2] == 'R') {
                count = 3;
            }
            else {
                count = 2;
            }
        }
        else {
            count = 1;
        }
    }
    else if (s[1] == 'R') {
        if (s[2] == 'R') {
            count = 2;
        }
        else {
            count = 1;
        }
    }
    else if (s[2] == 'R') {
        count = 1;
    }
    else {
        count = 0;
    }

    cout << count;
}

Measured memory_bytes: 3188
h,w = (int(x) for x in input().split())
ab = []
counth = 0
for _ in range(h):
    a = input()
    a = list(a)
    if '#' not in a:
        counth += 1
        continue
    ab.append(a)
countw =[] 
for i in range(w):
    memo = 0
    #print(12121)
    for j in range(h-counth):
        if ab[j][i] == '.':
            memo += 1
            if memo == h-counth:
                countw.append(i)
countw.sort(reverse=True)
for j in countw:
    for i in range(h-counth):
        del ab[i][j]

for i in range(h-counth):
    print(''.join(ab[i]))

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

public class Main {

    private static Scanner in = new Scanner(System.in);
    private static PrintWriter out = new PrintWriter(System.out);

    private static final long MOD = (long) 1e9 + 7;

    public static void main(String[] args) {
        solve();
        out.flush();
    }

    private static void solve() {
        int n = in.nextInt();

        int ans = 0;
        for (int i=1; i <= n; i++) {
            if (String.valueOf(i).length() % 2 == 1)
                ans++;
        }
        out.println(ans);
    }

}


Measured memory_bytes: 28628
#include <iostream>
#include <valarray>

int main() {
    int N;
    std::cin >> N;

    std::valarray<int> A(N);
    for (int i = 0; i < N; i ++) {
        std::cin >> A[i];
    }
    std::cout << A.max() - A.min() << std::endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n) for (int i = n - 1; i >= 0; i--)
using namespace std;
using Graph = vector<vector<int>>;
#define MOD 1000000007
#define MOD2 998244353
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
#define EPS (1e-10)
typedef long long ll;
typedef pair<ll, ll> P;

int main(){
    string s;
    cin >> s;
    int cnt = 0;
    rep(i, 4) if (s[i] == '2') cnt++;
    cout << cnt << endl;
    return 0;
}

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

int main()
{
	char s[201], t[101], p[101];
	scanf("%s %s", s, p);
	strcpy(t, s);
	strcat(s, t);

	if (strstr(s, p) == NULL)printf("No\n");
	else printf("Yes\n");

    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <algorithm>

#include <cstdio>

using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, s, n) for (int i = (s); i <= (n); i++)
#define rrep(i, n) for (int i = (n) - 1; i >= 0; i--)
#define rrep1(i, s, n) for (int i = (s); i >= (n); i--)
#define print_array(ary, size) cout << ary[0]; rep1(i, 1, size - 1) cout << ' ' << ary[i]; cout << endl;
typedef long long ll;
typedef unsigned long long ull;

int a[45];

int main()
{
	int n;

	a[0] = 1;
	a[1] = 1;
	rep1(i, 2, 44) a[i] = a[i - 1] + a[i - 2];

	cin >> n;
	cout << a[n] << endl;

	return 0;
}


Measured memory_bytes: 3100
#include <algorithm>
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <string>
#include <sstream>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <queue>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using namespace std;


int main()
{
	int n,m;
	cin>>n>>m;
	int *x = new int[m];
	int *l = new int[m-1];
	rep(i,m){
		cin>>x[i];
	}
	sort(x,x+m);
	rep(i,m-1){
		l[i] = x[i+1] - x[i];
	}
	sort(l,l + (m-1),greater<int>());
	unsigned long long int sum = 0;
	if( n >= m){
		cout<<0<<endl;
	}else{
		for(int i = n-1; i < m-1; i++){
			sum += l[i];
		}
		cout<<sum<<endl;
	}
	return 0;
}



Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;
typedef long long unsigned int ll;
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define rep(i, n) for (int i = 0; i < (n); i++)
int main()
{
  int a, b;
  cin >> a >> b;
  cout << a * b << endl;
  return 0;
}

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

#define     F       first
#define     S       second
typedef pair<int, int>  pi;
typedef long long       ll;

const int MAX=2e5+9;




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

    string s;
    cin >> s;
    if (s[2]==s[3] && s[4]==s[5]) {
        cout << "Yes";
    }
    else {
        cout << "No";
    }

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define SORT(x) sort((x).begin(), (x).end())
#define ALL(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < n; i++)
#define reps(i, m, n) for (ll i = m; i < n; i++)
#define repr(i, m, n) for (ll i = m; i >= n; i--)
#define de(x) cout << #x << "=" << x << endl;
template <class T> bool maxi(T &a, const T &b) {
    if (a < b) { a = b; return 1;} return 0;}
template <class T> bool mini(T &a, const T &b) {
    if (b < a) { a = b; return 1;} return 0;}
#define dame {cout<< "-1" <<"\n"; return;}
#define INF2 1000000000000000037
#define INF  1000000007
#define MOD  1000000007
using namespace std;
using ll = long long;
using ld = long double;
using P  = pair<ll,ll>;
//--GLOBAL---------------------------------
struct edge{ll to;};
struct graph{
    ll N;
    vector<vector<edge> > G;
    vector<bool> used;
    vector<ll> grundy;

    graph(ll n): N(n), G(N), used(N,false), grundy(N) {}

    void add_edge(ll s, ll t){
        G[s].emplace_back((edge){t});
        G[t].emplace_back((edge){s}); //無向ならON
    }

    void dfs(ll v=0){
        used[v]=true;
        ll ans=0;
        for(auto E : G[v]){
            if(!used[E.to]){
                dfs(E.to);
                ans^=grundy[E.to]+1;
            }
        }
        grundy[v]=ans;
    }
};
//--MAIN-----------------------------------
void Main(){
    ll N; cin>>N;
    graph g(N);
    rep(i,N-1){
        ll x,y; cin>>x>>y; --x; --y;
        g.add_edge(x,y);
    }
    g.dfs();
    cout<< ( g.grundy[0]!=0 ? "Alice" : "Bob" )<<"\n";

}
//--START----------------------------------
int main() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
}
//-----------------------------------------


Measured memory_bytes: 10112
import java.io.*;
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

   String nyuA=sc.nextLine();
  // String nyuB=sc.nextLine();
 
      String[] S=sc.nextLine().split("");

//int n=Integer.parseInt(nyu);

int N=Integer.parseInt(nyuA);
//int S=Integer.parseInt(nyuB);


//long H=Long.parseLong(t[0]);
//long W=Long.parseLong(t[1]);
//long C=Long.parseLong(t[2]);

//boolean[][] data=new boolean[H][W];
int count=0;
int max=0;
for(int i=0;i<N;i++){
if(S[i].equals("I"))count++;
else count--;
if(max<count)max=count;
}

System.out.println(max);

	}
}

Measured memory_bytes: 20692
#include<stdio.h>
#include<math.h>

int main(void){
  int k,l,m,n;
  char fig[8];
  int digit[8][2]; //2?????????[]??????0?????¨???????°??????°???1?????¨????????§?????°?????¨???????????¨?????????
  int tmp;
  int min,max,differ;
  scanf("%d",&n);

  for(k=1;k<=n;k++){
    min=0,max=0;
    scanf("\n");
    for(l=1;l<=8;l++){
      scanf("%c",&fig[l-1]);
      digit[l-1][0] = fig[l-1] - '0';
      digit[l-1][1] = digit[l-1][0];
    }
    for(m=1;m<=6*5*4*3*2*1;m++){
      for(l=1;l<=7;l++){
        if(digit[l-1][0] > digit[l][0]){
          tmp = digit[l-1][0];
          digit[l-1][0] = digit[l][0];
          digit[l][0] = tmp;
        }
        if(digit[l-1][1] < digit[l][1]){
          tmp = digit[l-1][1];
          digit[l-1][1] = digit[l][1];
          digit[l][1] = tmp;
        }
      }
    }
    for(l=1;l<=8;l++){
      min += digit[l-1][0] * pow(10,8-l);
      max += digit[l-1][1] * pow(10,8-l);
    }
    differ = max - min;
    printf("%d\n",differ);
  }
  return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <complex>
#include <cmath>
using namespace std;
typedef complex<double> xy_t;
double cross_product(xy_t a, xy_t b) { return (conj(a)*b).imag(); }
 
double x[4], y[4];
int main() {
  while (true) {
    for (int i=0; i<4; ++i) cin >> x[i] >> y[i];
    if (!cin) break;
 
    xy_t a(x[0],y[0]), b(x[1],y[1]), c(x[2],y[2]), p(x[3],y[3]);
    bool tri1 = cross_product(a-p,b-p) > 0;
    bool tri2 = cross_product(b-p,c-p) > 0;
    bool tri3 = cross_product(c-p,a-p) > 0;
 
    bool tri4 = cross_product(a-p,b-p) < 0;
    bool tri5 = cross_product(b-p,c-p) < 0;
    bool tri6 = cross_product(c-p,a-p) < 0;
 
    bool ok = tri1*tri2*tri3;
    if (ok != 1) ok = tri4*tri5*tri6;
 
    cout << (ok ? "YES" : "NO") << endl;
  }
}


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

int main() {
#ifdef HOME
	freopen("agc84a.in", "r", stdin);
	freopen("agc84a.out", "w", stdout);
#endif
	ios::sync_with_stdio(false);
	cin.tie(0), cout.tie(0);
	int x;

	cin >> x;
	cout << 48 - x << endl;

	return 0; }


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

using namespace std;
int n,x;
string s, t, u;
int main(){
    cin>>s>>t;
    cin>>n>>x;
    cin>>u;
    if (s==u){
        n -= 1;
        cout<<n<<" "<<x<<endl;
    }else if (t==u){
        x-=1;
        cout<<n<<" "<<x<<endl;
    }else cout<<n<<" "<<x<<endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(ll i = 0; i < n; i++)
#define reps(i, n , m) for(ll i = n; i <= m; i++)
using namespace std;
using ll = long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vi = vector<int>;
using vl = vector<ll>;
const int mod = 1000000007; 
long long inv[200000],fact[200000],ifact[200000];
long long comb(ll n, ll k){
	if(n<k)return 0;
	else if (n<0||k<0) return 0;
	else return fact[n] * ifact[k] % mod * ifact[n-k] % mod;
}
typedef long long ll;template<typename Typell>Typell G_C_D(Typell a, Typell b){if (a < 0) a = -a;if (b < 0) b = -b;while (b != 0) {a %= b;if (a == 0) return b;b %= a;}return a;}template<typename Typell>
Typell G_C_D(const std::vector<Typell> &list){Typell a = list[0];for (size_t i = 1; i < list.size(); ++i) {a = G_C_D(a, list[i]);}return a;}template<typename Typell>Typell L_C_M(Typell a, Typell b) {if( a == 0 && b == 0)return 0;return a / G_C_D(a, b) * b;}
template<typename Typell>Typell L_C_M(const std::vector<Typell> &list){Typell a = list[0];for (size_t i = 1; i < list.size(); ++i) {a = L_C_M(a, list[i]);}return a;}
 
int main(){
	ios::sync_with_stdio(false);cin.tie(0);
	/*inv[1] = fact[0] = fact[1] = ifact[0] = ifact[1] = 1; for (int i=2;i<200000;i++){ inv[i] = (mod - mod / i) * inv[mod % i] % mod; fact[i] = fact[i-1] * i % mod;ifact[i] = ifact[i-1] * inv[i] % mod;
	}*/ //nCr
	int N;
	cin>>N;
	string S;
	cin>>S;
	int ans=1;
	int k=S.length();
	
	rep(i,k-1) {
		if(S.at(i)!=S.at(i+1)) ans++;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin>>n;
	int a[n+2];
	for(int i=1;i<=n;i++)
	{
		cin>>a[i];
	}
	a[n+1]=2100000000;
	int s=0,ans=0;
	for(int i=2;i<=n+1;i++)
	{
		if(a[i]<=a[i-1])
		{
			s++;
			ans=max(ans,s);
		}
		else
		{
			s=0;
			ans=max(ans,s);
		}
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 640
import java.io.IOException;
import java.util.NoSuchElementException;

import java.io.InputStream;

import java.io.PrintWriter;

@SuppressWarnings("unchecked")
public class Main {
    static final int MAX_A = 100000;
    public static void main(String[] args) throws IOException {
        PrintWriter out = new PrintWriter(System.out);

        final int N = nextInt();

        int[] a = new int[MAX_A + 2];

        for (int i = 0; i < N; i++) a[nextInt()]++;

        int ans = 0;

        for (int i = 1; i <= MAX_A; i++)
            ans = Math.max(ans, a[i - 1] + a[i] + a[i + 1]);

        out.println(ans);

        out.flush();
    }

    // FastScanner start
    static final InputStream in = System.in;
    static final byte[] buffer = new byte[1024];
    static int ptr = 0;
    static int buflen = 0;
    static boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        } else {
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    static int readByte() {
        if (hasNextByte()) return buffer[ptr++];
        else return -1;
    }
    static boolean isPrintableChar(int c) {
        return 33 <= c && c <= 126;
    }
    static boolean hasNext() {
        while (hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;
        return hasNextByte();
    }
    static String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while (isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    static long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while (true) {
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            } else if(b == -1 || !isPrintableChar(b)) {
                return minus ? -n : n;
            } else {
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    static int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
            throw new NumberFormatException();
        return (int) nl;
    }
    static double nextDouble() {
        return Double.parseDouble(next());
    }
    // FastScanner end
}


Measured memory_bytes: 21716
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n;
  cin>>n;
  map<string, int> mp;
  int max_freq = 0;
  while(n--){
  	string s;
    cin>>s;
    mp[s]++;
    max_freq = max(max_freq, mp[s]);
  }
  for(auto i : mp){
  	if(i.second == max_freq){
    	cout<<i.first<<endl;
    }
  }
}

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

int main() {
	int N;
	int A[110] = {0};

	cin >> N;
	for(int i=0;i<N;i++) {
		cin >> A[i];
	}
	sort(A,A+N,greater<int>());
	
	int alice = 0;
	int bob = 0;
	for(int i=0;i<N;i++) {
      	if(i%2==0) alice += A[i];
		else bob += A[i];
	}
	cout << alice - bob << endl;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import sys

N, = list(map(int, sys.stdin.readline().rstrip().split()))
As = list(map(int, sys.stdin.readline().rstrip().split()))


def solve_mini():
    def argmax():
        Amax = max(As)
        for j, value in enumerate(As):
            if Amax == value:
                return j

    for i in range(10 ** 20):
        if max(As) < N:
            break
        arg = argmax()
        for j in range(N):
            if j == arg:
                As[j] -= N
            else:
                As[j] += 1
    return i


i = 0
if sum(As) > N * N:
    over = sum(As) - N * N
    # print(over)
    for j in range(N):
        As[j] += over
    # print(As)
    real_i = 0
    for j in range(N):
        diff = (As[j] // (N+1) - 1)
        As[j] -= diff * (N+1)
        real_i += diff
    # print(real_i, over)
    # print(As)
    for j in range(N):
        As[j] += (real_i - over)
    # print(As)
    i += real_i

i += solve_mini()

print(i)


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

#define int long long

const int N = 1e5 + 5;
pair< int, int> p[N];


bool cmp(pair< int, int> &a, pair< int, int> &b) {
    if(a.first == b.first) return a.second < b.second;
    return a.first > b.first;
}

bool cmp2(pair< int, int> &a, pair< int, int> &b) {
    return a.second > b.second;
}

int32_t main() {
    int n, h;
    cin >> n >> h;
    for(int i = 0; i < n; ++i) scanf("%lld %lld", &p[i].first, &p[i].second);
    sort(p, p + n, cmp);
    sort(p + 1, p + n, cmp2);
    
    int res = 0;
    for(int i = 1; i < n; ++i) {
        if(p[0].second >= h) {
            res++;
            h = 0;
            break;
        }
        if(p[i].second >= p[0].first) {
            h -= p[i].second;
            res++;
        }
        if(h <= 0) break;
    }

    if(h > 0) {
        h -= p[0].second;
        res++;
        if(h > 0) res += (h + p[0].first - 1) / p[0].first;
    }

    printf("%lld\n", res);
}

Measured memory_bytes: 1792
import numpy as np
N=int(input())
# A=list(map(int,input().split()))
A=[int(i) for i in input().split()]
A=np.array(sorted(A))

while np.any(A[:-1]>0):
    try:
        m=sorted(list(A[A>0]))[0]
        A=list(A[1:]%m)
        A.append(m)
        A=np.array(A)

    except:
        continue
print(m)


Measured memory_bytes: 23112
# -*- coding: utf-8 -*-

N = int(input())
A = [0] + list(map(int, input().split()))

answer = 0
for i in range(1,N+1):
  if A[i-1] > A[i]:
    step = A[i-1] - A[i]
    A[i] += step
    answer += step

print(answer)

Measured memory_bytes: 32300
#include <bits/stdc++.h>
using namespace std;
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define reprrev(i,a,b) for(int i=b-1;i>=a;i--) // [a, b)
#define reprev(i,n) reprrev(i,0,n)
typedef long long ll;
typedef unsigned long long ull;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
    sizeは(int)とキャストしよう
    cin.tie(0);
    ios::sync_with_stdio(false);<- これら、printfとかと併用しない方が良さそう

*/

const ll mod = 1e9+7;

void chmod(ll &M){
    if(M >= mod) M %= mod;
    else if(M < 0){
        M += (abs(M)/mod + 1)*mod;
        M %= mod;
    }
}

ll modpow(ll x, ll n){
    if(n==0) return 1;
    ll res=modpow(x, n/2);

    if(n%2==0) return res*res%mod;
    else return res*res%mod*x%mod;
}

int getl(int i, int N) { return i==0? N-1:i-1; };
int getr(int i, int N) { return i==N-1? 0:i+1; };


// 線分 ab の偏角 返り値は[-π, π]
double argument(const pair<double, double> &a, const pair<double, double> &b){
    double ax=a.first, ay=a.second, bx=b.first, by=b.second;
    return atan2(by-ay, bx-ax);
}

/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */

long double a, b, x;
long double const pi = acos(-1);

void input() {
    cin >> a >> b >> x;
}

void solve() {
    long double S = a*a*b/2;
    
    if (x<=S) {
        long double ok = atan2(b, a); long double ng = acos(0.0);
        auto check = [&](long double mid) -> bool {
            long double vol = a*b*b/2/tan(mid);
            return x < vol;
        };
        rep(_, 1000) {
            long double mid = (ok+ng)/2;
            (check(mid)? ok:ng) = mid;
        }
        cout << fixed << setprecision(15) <<  ok*180/pi << endl;
    } else {
        long double ok = 0.0; long double ng = atan2(b, a);
        auto check = [&](long double mid) -> bool {
            long double vol = a*a*b - a*a*a*tan(mid)/2;
            return x < vol;
        };
        rep(_, 1000) {
            long double mid = (ok+ng)/2;
            (check(mid)? ok:ng) = mid;
        }
        cout << fixed << setprecision(15) << ok*180/pi << endl;
    }
}

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

    input();
    solve();
    
    return 0;
}

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

void tamesu(int n, char *str, char *p, char now, char prev) {
	int i;

	memset(p, '\0', sizeof(char)*(n+1));
	p[0] = now;
	p[n - 1] = prev;
	for (i = 0; i < n - 1; i++) {
		now = p[(i + n - 1) % n];
		if ((p[i] == 'S') == (str[i] == 'x')) {
			if (now == 'S') {
				now = 'W';
			} else {
				now = 'S';
			}
		}
		if (p[i + 1] != '\0' && p[i + 1] != now) {
			p[0] = '\0';
			return;
		} else {
			p[i + 1] = now;
		}
	}
	p[n] = '\0';

	if (p[n - 1] == 'S') {
		if (str[n - 1] == 'o') {
			if (p[n - 2] != p[0]) {
				p[0] = '\0';
			}
		} else {
			if (p[n - 2] == p[0]) {
				p[0] = '\0';
			}
		}
	} else {
		if (str[n - 1] == 'o') {
			if (p[n - 2] == p[0]) {
				p[0] = '\0';
			}
		}
		else {
			if (p[n - 2] != p[0]) {
				p[0] = '\0';
			}
		}
	}
}

int main(void) {
	int n;
	char str[100001], p[100001];

	scanf("%d %s", &n, str);

	tamesu(n, str, p, 'S', 'S');
	if (p[0] == '\0') {
		tamesu(n, str, p, 'W', 'S');
	}
	if (p[0] == '\0') {
		tamesu(n, str, p, 'S', 'W');
	}
	if (p[0] == '\0') {
		tamesu(n, str, p, 'W', 'W');
	}
	printf("%s\n", p[0] == '\0' ? "-1" : p);

	return 0;
}


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

int i,j;
int n=1,m=1,x;
typedef struct data{
	int z,num;
}DATA;
DATA a[105];

int comp(const void *p,const void *q){
	DATA *a=(DATA *)p,*b=(DATA *)q;
	if(b->z == a->z)return a->num - b->num;
	else return b->z - a->z;
}
int main(){
	scanf("%d %d",&n,&m);
	while(n!=0 && m!=0){
		for(i=0;i<m;i++)(a+i)->z=0,(a+i)->num=i+1;
		for(i=0;i<n;i++){
			for(j=0;j<m;j++){
				scanf("%d",&x);
				if(x==1) (a+j)->z += 1;
			}
		}
		qsort(a,m,sizeof(DATA),comp);
		for(i=0;i<m;i++)/*printf("%d ",(a+i)->num);*/printf("%d%c",(a+i)->num,i==m-1?'\n':' ');
		//printf("\n");
		scanf("%d %d",&n,&m);
	}
	return 0;
}

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

int main() {
  int N;
  string S;
  cin >> N;
  for (int i=0; i < N; i++) {
    cin >> S;
    if (S == "Y") {
      cout << "Four" << endl;
      break;
    }
    else if (i == N - 1) {
      cout << "Three" << endl;
    }
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a) for(int i = 0; i < (a); i++)
#define ALL(a) (a).begin(),(a).end()
typedef long long ll;
typedef pair<int, int> P;
const ll INF = 1e12;
const int MOD = 1e9 + 7;

#define MAX_N 200000

int n;
ll k;
ll a[MAX_N],f[MAX_N];

bool isOK(ll m){
    ll use = 0;
    REP(i,n){
        use += max((ll)0, a[i] - m / f[i]);
    }
    return use <= k;
}

signed main(){
    cin >> n >> k;
    REP(i,n){
        cin >> a[i];
    }
    REP(i,n){
        cin >> f[i];
    }
    sort(a, a + n);
    sort(f, f + n, greater<ll>());
    ll ng = -1, ok = INF + 1;
    while(abs(ok - ng) > 1){
        ll mid = (ok + ng) / 2;
        if(isOK(mid)){
            ok = mid;
        }else{
            ng = mid;
        }
    }
    cout << ok << endl;
    return 0;
}

Measured memory_bytes: 3328
N=int(input())
T,A=map(int,input().split())
H=list(map(int,input().split()))
P=float("inf")
X=B=0
for i in range(N) :
  X=abs(A-(T-H[i]*0.006))
  if X<P :
    B=i
    P=X
print(B+1)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double db;
typedef pair<int,int> pii;
typedef vector<int> vi;
#define de(x) cout << #x << "=" << x << endl
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define lb(x) (x&-(x))
const int N = 101010;

int main(){
	long long x,y;
	cin>>x>>y;
	int cnt=1;
	while(1)
	{
		x*=2;
		if(x<=y)
		cnt++;
		else{
			cout<<cnt<<endl;
			break;
		}
	}
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(void){
	int a,b;
	scanf("%d%d",&a,&b);
	// 両方が同じとき
	if(a==b){
		printf("Draw\n");
	}
	// 両方とも1でないとき
	else if((a!=1)&&(b!=1)){
		if(a<b){
			printf("Bob\n");
		}
		else if(a>b){
			printf("Alice\n");
		}
	}
	// 少なくとも一方が1のとき
	else{
		if(a==1){
			printf("Alice\n");
		}
		else{
			printf("Bob\n");
		}
	}
	return 0;
}

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

using namespace std;
int main(){
	int N, Sn = 0;
	cin >> N;
	string strN = to_string(N);

	int digit = strN.size();

	for (size_t i = 0; i < digit;i++){
		Sn += (int)strN[i] - 48;
	}

	if(N%Sn==0){
		cout << "Yes";
	}else{
		cout << "No";
	}

	return 0;
}

Measured memory_bytes: 256
n,w=map(int,input().split())
wv=[tuple(map(int,input().split())) for i in range(n)]
wv.sort(key=lambda x:-x[1])#reverse
wv.sort(key=lambda x:x[0])

w0=wv[0][0]
x=[[0],[0],[0],[0]]
for i in range(n):
    z=wv[i][0]-w0
    k=wv[i][1]+x[z][-1]
    l=len(x[z])
    if l*wv[i][0]<=w:
        x[z].append(k)
ma=0
l3=len(x[3])
l2=len(x[2])
l1=len(x[1])
l0=len(x[0])
for i in range(l3):
    for j in range(l2):
        d=w-i*(w0+3)-j*(w0+2)
        if d>=0:
            for k in range(l1):
                d=w-i*(w0+3)-j*(w0+2)-k*(w0+1)
                if d>=0:
                    ma=max(ma,x[3][i]+x[2][j]+x[1][k]+x[0][min(d//w0,l0-1)])
                else:
                    break
        else:
            break

print(ma)


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

using namespace std;

#define all(x) x.begin(), x.end()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define reps(i, m, n) for (int i = m; i <= n; ++i)

using i64 = long long;
using pii = pair<i64, i64>;

template<class A, class B>inline bool chmax(A &a, const B &b){return b > a ? a = b,1 : 0;}
template<class A, class B>inline bool chmin(A &a, const B &b){return b < a ? a = b,1 : 0;}

constexpr int INF = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int MOD = int(1e9) + 7;

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

  bool exist[128] = {};
  int cnt = 0;
  rep(i, 3) {
    int x;
    cin >> x;
    if (!exist[x]) ++cnt;
    exist[x] = true;
  }

  cout << cnt << "\n";

  return 0;
}

Measured memory_bytes: 256
#include <climits>
#include <cstdio>
#include <cstdint>
#include <cstring>

#include <algorithm>

using namespace std;

using i32 = int32_t;
using u32 = uint32_t;
using f32 = float;
using f64 = double;
using i64 = int64_t; 
using u64 = uint64_t; 

#define SELECTER(_1, _2, _3, _4, _5, _6, _7, _8, SELECT, ...) SELECT

#define _FC1(func, type, _1)      func(type, _1);
#define _FC2(func, type, _1, ...) func(type, _1); _FC1(func, type, __VA_ARGS__);
#define _FC3(func, type, _1, ...) func(type, _1); _FC2(func, type, __VA_ARGS__);
#define _FC4(func, type, _1, ...) func(type, _1); _FC3(func, type, __VA_ARGS__);
#define _FC5(func, type, _1, ...) func(type, _1); _FC4(func, type, __VA_ARGS__);
#define _FC6(func, type, _1, ...) func(type, _1); _FC5(func, type, __VA_ARGS__);
#define _FC7(func, type, _1, ...) func(type, _1); _FC6(func, type, __VA_ARGS__);
#define _FC8(func, type, _1, ...) func(type, _1); _FC7(func, type, __VA_ARGS__);

#define _FCN(func, type, ...) SELECTER(__VA_ARGS__, _FC8, _FC7, _FC6, _FC5, _FC4, _FC3, _FC2, _FC1)(func, type, __VA_ARGS__);

constexpr const char *type2fmt(const char *fmt) {
  if(strcmp(fmt, "i32")) return "%d";
  if(strcmp(fmt, "u32")) return "%u";
  if(strcmp(fmt, "f32")) return "%f";
  if(strcmp(fmt, "f64")) return "%lf";
  if(strcmp(fmt, "i64")) return "%lld";
  if(strcmp(fmt, "u64")) return "%llu";
  if(strcmp(fmt, "char*")) return "%s";
  return "";
}

#define _R(type, _1) type _1; { type _t; scanf(type2fmt(#type), &_t); _1 = _t; }
#define _P(type, _1) { const type _t = (_1); printf(type2fmt(#type), _t); putchar('\n'); }

#define RI(...)   _FCN(_R, i32, __VA_ARGS__);
#define RUI(...)  _FCN(_R, u32, __VA_ARGS__);
#define RF(...)   _FCN(_R, f32, __VA_ARGS__);
#define RD(...)   _FCN(_R, f64, __VA_ARGS__);
#define RLL(...)  _FCN(_R, i64, __VA_ARGS__);
#define RULL(...) _FCN(_R, u64, __VA_ARGS__);

#define PI(...)   _FCN(_P, i32, __VA_ARGS__);
#define PUI(...)  _FCN(_P, u32, __VA_ARGS__);
#define PF(...)   _FCN(_P, f32, __VA_ARGS__);
#define PD(...)   _FCN(_P, f64, __VA_ARGS__);
#define PLL(...)  _FCN(_P, i64, __VA_ARGS__);
#define PULL(...) _FCN(_P, u64, __VA_ARGS__);
#define PS(...)   _FCN(_P, char*, __VA_ARGS__);

#define REP(n) for (int _i = 0; _i < n; _i++)

const u64 mod = 1000000007;

int main() {
  RI(r, g, b);
  printf(((10 * g + b) % 4 == 0 ? "YES" : "NO"));
}


Measured memory_bytes: 128
#include<stdio.h>
int main(void){
   int w,n,a,b,i,j,x[100],work,k;
   char o;
   scanf("%d %d",&w,&n);
   for(i=0;i<w;i++){
      x[i]=i+1;
   }
   for(j=0;j<n;j++){
      scanf("%d%c%d",&a,&o,&b);
      work=x[a-1];
      x[a-1]=x[b-1];
      x[b-1]=work;
   }
   for(k=0;k<w;k++){
      printf("%d\n",x[k]);
   }



   return 0;
}

Measured memory_bytes: 596
#include <bits/stdc++.h>
#define MAXN 100100
#define pii pair<int, int>
#define pb push_back
typedef long long ll;

using namespace std;

int n, p[MAXN], dist;
set<int> g[MAXN];

void dfs(int x, int pa, int d){
	p[x] = pa;
	if(x == n) dist = d;
	for(auto i : g[x]){
		if(i == pa) continue;
		dfs(i, x, d + 1);
	}
}

int dfs1(int x, int pa){
	int s = 0;
	for(auto i : g[x]){
		if(i == pa) continue;
		s += dfs1(i, x);
	}
	return s + 1;
}

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
    cin >> n;
    for(int i = 1; i < n; i++){
  		int a, b;
  		cin >> a >> b;
  		g[a].insert(b);
  		g[b].insert(a);
    }
    dfs(1, -1, 0);
    //cout << dist << endl;
    int x = n;
    for(int i = 0; i < (dist - 1) / 2; i++){
    	x = p[x];
    }
    g[x].erase(p[x]);
    g[p[x]].erase(x);
    int a = dfs1(1, -1);
    int b = dfs1(n, -1);
    if(a > b) cout << "Fennec";
    else cout << "Snuke";
}

Measured memory_bytes: 19456
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef std::pair<int,int> pair2;
typedef std::pair<int,pair2> pair3;
const ll INF = 1LL<<60;
const  ll NUM=10e8+7;


int main(){
  ll N,X,M;
  cin>>N>>X>>M;
  
  ll ans=0;
  vector<ll> dist(M,-1);//カウント
 ll count;
  count=1;
while(1){
  //cout<<X;
  dist[X]=count;
  ans=ans+X;
  //cout<<"  "<<ans<<endl;
  if(count==N){cout<<ans<<endl;return 0;}
  X=(X*X)%M;
  //cout<<"  "<<X<<endl;
  count++;
  if(dist[X]!=-1){break;}
  }
//cout<<ans<<endl;
  ll cicle=count-dist[X];
  //cout<<cicle<<"."<<X<<endl;
  for(ll i=0;i<cicle;i++){
    ll num=(N-dist[X])/cicle;
    ans=ans+X*num;
    //cout<<X<<" "<<X*num<<endl;
    X=(X*X)%M;
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 4044
#include<bits/stdc++.h>
using namespace std;
int n,m;
int a[105];
int t[105];
 
void solve(int x){
  for(int i=1;i<=n-1;i++){
    if( a[i]%x > a[i+1]%x ){
      swap(a[i],a[i+1]);
    }
  }
}
 
int main(){
  cin>>n>>m;
  for(int i=1;i<=n;i++){
    cin>>a[i];
  }
  for(int i=1;i<=m;i++){
    solve(i);
  }
  for(int i=1;i<=n;i++){
    cout<<a[i]<<endl;
  }
  return 0;
}

Measured memory_bytes: 1164
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rrep(i,n) for(int (i)=((n)-1);(i)>=0;(i)--)
#define itn int
#define all(x) (x).begin(),(x).end()
#define F first
#define S second
const long long INF = 1LL << 60;
const int MOD = 1000000007;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
string s;
double n,a,b,c,d;
signed main(void){
    cin>>n;
    double odd = 0;
    for(int i=1;i<=n;i++){
        if(i%2 == 1){
            odd++;
        }
    }
    printf("%lf\n", odd/n);
    
}


Measured memory_bytes: 256