akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <vector>
#include <iostream>

#define rep(i,n) for (int i=0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;

struct UnionFind {
    //自身が親であれば、その集合に属する頂点数に-1を掛けたもの
    //そうでなければ親のid
    vector<int> r;
 
    UnionFind(int N) {
        r = vector<int>(N, -1);
    }
 
    int root(int x) {
        if (r[x] < 0) return x;
        return r[x] = root(r[x]);
    }
 
    bool unite(int x, int y) {
        x = root(x);
        y = root(y);
        if (x == y) return false;
        if (r[x] > r[y]) swap(x, y);
        r[x] += r[y];
        r[y] = x;
        return true;
    }
 
    int size(int x) {
        return -r[root(x)];
    }
};

int main(){
  int N, M;
    cin >> N >> M;
 
    //友達集合を作る
    UnionFind UF(N);
    for (int i = 0; i < M; i++)
    {
        int A, B;
        cin >> A >> B;
        A -= 1; B -= 1;
        UF.unite(A, B);
    }
 
    //最大の友達集合を求める
    int ans = 0;
    for (int i = 0; i < N; i++)
    {
        ans = max(ans, UF.size(i));
    }
 
    cout << ans << endl;

}


Measured memory_bytes: 4052
#include <iostream>
using namespace std;
typedef long long ll;

int main()
{
    ll h;
    cin >> h;
    ll p = 1;
    for(int i = 0; i < 50; i++){
        p *= 2;
        if(p > h) break;
    }
    cout << p - 1 << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int n,a[100005],sum[100005],temp[100005];
long long cnt,num;
void merge_sort(int l,int r)
{
	if(l>=r) return;
	int mid=(l+r)/2;
	merge_sort(l,mid);
	merge_sort(mid+1,r);
	int i=l,j=mid+1,k=l;
	while(i<=mid&&j<=r)
	{
		if(sum[i]<=sum[j]) temp[k++]=sum[i++];
		else cnt+=mid-i+1,temp[k++]=sum[j++];
	}
	while(i<=mid) temp[k++]=sum[i++];
	while(j<=r) temp[k++]=sum[j++];
	for(i=l;i<=r;i++) sum[i]=temp[i];
}
bool check(int x)
{
	sum[0]=cnt=0;
	for(int i=1;i<=n;i++) sum[i]=a[i]<=x?-1:1;
	for(int i=1;i<=n;i++) sum[i]+=sum[i-1];
	merge_sort(0,n);
	return cnt>=num/2+1;
}
int main()
{
	int l=INT_MAX,r=INT_MIN;
	scanf("%d",&n);
	for(int i=1;i<=n;i++) scanf("%d",&a[i]),l=min(l,a[i]),r=max(r,a[i]),num+=i;
	while(l<r)
	{
		int mid=(l+r)/2;
		if(check(mid)) r=mid;
		else l=mid+1;
	}
	cout<<r<<endl;
	return 0;
}

Measured memory_bytes: 1408
var
 i:longint;
 s:ansistring;
 j:char;
 a:array['a'..'z'] of longint;
begin
 readln(s);
 for i:=1 to length(s) do
  inc(a[s[i]]);
 for j:='a' to 'z' do
  if a[j]=0 then begin writeln(j); halt; end;
 writeln('None');
end.

Measured memory_bytes: 256
def Main(A,B,C):

  if A == B:
    if C!=A:
      print("Yes",end="")
    else:
      print("No",end="")
  elif A == C:
    if B!=A:
      print("Yes",end="")
    else :
      print("No",end="")
  elif B == C:
    if A!=B :
      print("Yes",end="")
    else:
      print("No",end="")
  else:
    print("No",end="")
A,B,C = [int(num) for num in input().split(' ')]
Main(A,B,C)


Measured memory_bytes: 3060
# coding:utf-8

import sys
import math
import time
#import numpy as np
import collections
from collections import deque
import queue
import copy
import bisect


def dfs(s, prev, pre):
  val[s] += Ope[s] + prev
  for i in G[s]:
    if(i == pre):
      continue
    dfs(i, val[s], s)

def bfs(sx, sy, n):
  que = deque([[sy,sx]])
  while que:
    y,x = que.popleft()
    for i,j in D:
      if(x+i<0 or y+j<0 or x+i>W-1 or y+j>H-1):
        continue
      dist = G[y+j][x+i]
      if(G[y+j][x+i] != "X"):
        if(type(G[y+j][x+i]) is str):
          G[y+j][x+i] = G[y][x]+1
          que.append([y+j,x+i])
        elif(dist>G[y][x]+1):
          G[y+j][x+i] = G[y][x]+1
          que.append([y+j,x+i])
        

#X = str(input()).split()
#a = [int(x) for x in input().split()]
#sys.setrecursionlimit(10**7)
#N, Q = map(int, input().split())
#G = [list(input()) for i in range(H)]

N, A, B = map(int, input().split())

temp = N%(A+B)
ans = 0

ans += math.floor(N/(A+B))*A
ans += min(A,temp)


print(int(ans))


Measured memory_bytes: 38636
#include <iostream>

using namespace std;

int main(void)
{
	int q,p,n;
	char c;
	long long l,r;
	int i1;

	cin>>q;
	l=0;
	r=0;
	for(i1=0;i1<q;i1++){
		cin>>p>>c>>n;
		if(c=='(') l+=n;
		else r+=n;

		if(l==r) cout<<"Yes"<<endl;
		else cout<<"No"<<endl;
	}
	return 0;
}

Measured memory_bytes: 1152
def B():
    cnt = 0
    N = int(input())
    for i in range(N):
        d1,d2 = map(int,input().split())
        if(d1 == d2):
            cnt += 1
        else:
            cnt = 0
        if(cnt >= 3):
            print('Yes')
            return
    print('No')
B()

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

using namespace std;

int n, x = 0, r = 0;

int main() {
	cin >> n;
	while (x < n) x = (x << 3) + (x << 1) + 7, r++;
	while (1) {
		x %= n;
		if (!x) break;
		x = (x << 3) + (x << 1) + 7;
		r++;
		if (r > n) {
			r = -1;
			break;
		}
	}
	cout << r << endl;
}

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

int main() {
  int N,A;
  cin >> N;
  cin >> A;
  if (N % 500 == 0 || N % 500 <= A) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 3616
#include<stdio.h>
#include<vector>
#include<algorithm>
using namespace std;
typedef long long ll;
ll solve(ll a, ll b)
{
	ll mini = 1000000000000000LL;
	if (a >= 3)mini = (a % 3 == 0) ? 0 : b;
	for (int i = 1; i <= a - 1; i++)
	{
		ll s = b*(a - i);
		ll t = i*(b / 2);
		ll u = i*((b + 1) / 2);
		mini = min(mini, max(s, max(t, u)) - min(s, min(t, u)));
	}
	return mini;
}
int main()
{
	ll a, b;
	scanf("%lld%lld", &a, &b);
	printf("%lld\n", min(solve(a, b), solve(b, a)));
}

Measured memory_bytes: 128
from operator import itemgetter
from collections import Counter
def main():
    va = []
    vb = []
    n = int(input())
    *v, = map(int, input().split())
    for i in range(len(v)):
        if i % 2 == 0:
            va.append(v[i])
        else:
            vb.append(v[i])
    a1 = Counter(va).most_common()
    a2 = Counter(vb).most_common()
    how_many_a1 = a1[0][1]
    how_many_a2 = a2[0][1]
    if a1[0][0] != a2[0][0]:
        print(n - how_many_a1 - how_many_a2)
    else:
        if len(a1) == 1 and len(a2) == 1:
            print(int(n/2))
        elif len(a1) == 1:
            print(len(vb) - a2[1][1])
        elif  len(a2) == 1:
            print(len(va) - how_many_a1)
        elif (len(va) - how_many_a1) + (len(vb) - a2[1][1])  > (len(vb) - how_many_a2) + (len(va) - a1[1][1]):
            print((len(vb) - how_many_a2) + (len(va) - a1[1][1]))
        else:
            print((len(va) - how_many_a1) + (len(vb) - a2[1][1]))
main()

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

int	main()
{
    string n;
    int sum = 0, i = 0;
    cin >> n;

    while(n[i])
    {
        sum += n[i] - '0';
        i++;
    }
    if (sum % 9 == 0)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}

Measured memory_bytes: 3728
import java.io.*;
import java.lang.*;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.IOException;
import java.util.StringTokenizer;
import java.math.BigInteger;

public class Main {
    static InputReader in = new InputReader(System.in);
    static PrintWriter out = new PrintWriter(System.out);

    public static void main(String[] args) {
        String s = in.next();
        char c = s.charAt(0);
        if(c-65>27){
            out.print('a');
        }
        else{
            out.print('A');
        }
        out.close();
    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

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

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

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

        public String nextLine() {
            try {
                return reader.readLine();
            } catch (Exception e) {
                e.printStackTrace();
            }
            return null;
        }

        public boolean hasNext() {
            String next = null;
            try {
                next = reader.readLine();
            } catch (Exception e) {
            }
            if (next == null) {
                return false;
            }
            tokenizer = new StringTokenizer(next);
            return true;
        }

        public BigInteger nextBigInteger() {
            return new BigInteger(next());
        }
    }
}



Measured memory_bytes: 32872
import sys
s = input()
t = input()

n = s.count(t[0])
for i in range(n):
  i = s.rfind(t[0])
  st = s[:i], s[i:]
  s = st[1] + st[0]
  if s == t:
    print('Yes')
    sys.exit()
print('No')

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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

const int ISPRIME_SIZE=11111111;
bool isprime[ISPRIME_SIZE];
struct isprime_exec{
    isprime_exec(){
        for(int i=0;i<ISPRIME_SIZE;i++)isprime[i]=true;
        isprime[0]=isprime[1]=false;
        for(int i=2;i<ISPRIME_SIZE;i++){
            if(!isprime[i])continue;
            for(int j=i+i;j<ISPRIME_SIZE;j+=i)isprime[j]=false;
        }
    }
}isprimeexec;

signed main(){
    int N;cin>>N;
    int ans=0;
    for(int i=3;i<=N;i++){
        if(!isprime[i])continue;
        if(isprime[i+2])ans++;
    }
    cout<<ans*2<<endl;
    return 0;
}



Measured memory_bytes: 13984
#include<bits/stdc++.h>
#define ll long long
#define rep(i, n) for(int i=0; i<n; i++)
#define REP(i, n) for(int i=0; i<=n; i++)
#define repr(i, n) for(int i=n; i>0; i--)
#define REPR(i, n) for(int i=n; i>=0; i--)
const ll INF = 1LL<<60;
const int INT_INF = 1e9;
const ll MOD = 1e9+7;
template<class T> void puts(T x) { std::cout << x << std::endl; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using namespace std;

ll N, T;
ll t[200010];

int main() {
    cin >> N >> T;
    rep(i, N) cin >> t[i];

    ll ans = T;
    for (int i = 1; i < N ; i++) {
        ans += min(t[i] - t[i-1], T);
    }
    cout << ans << endl;
}


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

int main(){
	cin.tie(0),ios::sync_with_stdio(false);
	int n; cin>>n;
	vector<int>a(n);
	for(int i=0;i<n;++i){
		cin>>a.at(i);
	}
	sort(a.begin(),a.end());
	int i=0,ans=0;
	while(i<n){
		int cnt=0,num=a.at(i);
		while(i<n&&a.at(i)==num)++i,++cnt;
		ans+=cnt%2;
	}
	cout<<ans<<"\n"s;
}

Measured memory_bytes: 640
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<cstring>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define mt make_tuple
#define pqueue priority_queue
const int inf=1e9+7;
const ll mod=1e9+7;
const ll mod1=998244353;
const ll big=1e18;
const double PI=2*asin(1);

int main() {
  int N;
  cin>>N;
  int P[N*N];
  for(int i=0;i<N*N;++i) {
    cin>>P[i];
    P[i]--;
  }
  int DP[N][N];
  for(int i=0;i<N;++i) {
    for(int j=0;j<N;++j) {
      DP[i][j] = min(i, min(j, min(N-1-i, N-1-j)));
    }
  }
  bool oru[N][N];
  for(int i=0;i<N;++i) {
    for(int j=0;j<N;++j) {
      oru[i][j] = true;
    }
  }
  int ans = 0;
  queue<pair<int, int> > que;
  int x, y, cost;
  pair<int, int> state;
  for(int i=0;i<N*N;++i) {
    ans += DP[P[i]/N][P[i]%N];
    oru[P[i]/N][P[i]%N] = false;
    que.push(mp(P[i], DP[P[i]/N][P[i]%N]));
    while(!que.empty()) {
      state = que.front();que.pop();
      x = state.fi/N;
      y = state.fi%N;
      cost = state.se;
      if(oru[x][y]) cost++;
      if(x>0 && DP[x-1][y]>cost) {
        DP[x-1][y] = cost;
        que.push(mp((x-1)*N+y, cost));
      }
      if(y>0 && DP[x][y-1]>cost) {
        DP[x][y-1] = cost;
        que.push(mp(x*N+(y-1), cost));
      }
      if(x+1<N && DP[x+1][y]>cost) {
        DP[x+1][y] = cost;
        que.push(mp((x+1)*N+y, cost));
      }
      if(y+1<N && DP[x][y+1]>cost) {
        DP[x][y+1] = cost;
        que.push(mp(x*N+(y+1), cost));
      }
    }
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 5816
from collections import Counter
n = int(input())
d = list(map(int, input().split()))
m = int(input())
t = list(map(int, input().split()))

count_d = Counter(d)
count_t = Counter(t)

for i in count_t.items():
  if i[0] not in count_d:
    print("NO")
    exit()
  if i[0] in count_d: count_d[i[0]] -= i[1]
else:
  for x in count_d.values():
    if x < 0:
      print("NO")
      exit()
  print("YES")
  

Measured memory_bytes: 57088
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <queue>
#include <vector>
#define N 300005
using namespace std;

typedef long long ll;
int n, m, s, cnt, a[N], ans[N];
vector<int> b;
priority_queue<int> qu;
int main()
{
	int i, j, t, g;
	cin >> n;
	for (i = 0; i < n; i++) {
		scanf ("%d", &a[i]);
	}
	sort(a, a + n);
	s = 1;
	for (i = 1; i < n; i++) {
		if (a[i] != a[i - 1]) {
			cnt++;
			qu.push(-s);
			s = 0;
		}
		s++;
	}
	if (s > 0) {
		qu.push(-s);
			cnt++;
	}
	for (i = 0; i < n - cnt; i++) qu.push(0);
	for (i =0; i <n - 1; i++) {
		t = qu.top(); qu.pop();
		t *= -1;
		ans[n - i - 1] = t;
		for (j = 0; j < t; j++) {
			g = qu.top(); qu.pop();
			qu.push(g - 1);
		}
	}
	ans[0] = n;
	for (i = 0; i < n; i++) printf("%d\n", ans[i]);
    return 0;
}


Measured memory_bytes: 4464
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (n); ++i)
const long long INF = 1LL << 60;
 
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;
}
 
int main(){
  int n;
  cin>>n;
  vector<ll> vec(n);
  vector<ll> dp(n);
  rep(i,n) cin>>vec[i];
  rep(i,n) dp[i]=INF;
  dp[0]=0;
  
 
  for(int i=1;i<n;i++){
    chmin(dp[i],dp[i-1]+abs(vec[i]-vec[i-1]));
          if(i>1)    chmin(dp[i],dp[i-2]+abs(vec[i]-vec[i-2]));
  }
    
        cout << dp[n-1] << endl;
}

Measured memory_bytes: 1792
n = gets.to_i

min = 0
max = n

puts(0)
$stdout.flush

min_g = gets.chomp
max_g = min_g

if min_g != "Vacant"

  loop do

    now = (max - min) / 2 + min
    puts(now % n)
    $stdout.flush
    now_g = gets.chomp

    if now_g == "Vacant"  # 終了
      break
    end

    if (max - min) % 2 != 0  # 幅が奇数
      if min_g == now_g  # 両端と中間が一致
        if (max - now) % 2 != 0
          min = now
          min_g = now_g
        else
          max = now
          max_g = now_g
        end
      else  # 両端と中間が不一致
        if (max - now) % 2 == 0
          min = now
          min_g = now_g
        else
          max = now
          max_g = now_g
        end
      end
    else  # 幅が偶数
      if (max - now) % 2 == 0
        if max_g != now_g
          min = now
          min_g = now_g
        else
          max = now
          max_g = now_g
        end
      else
        if max_g == now_g
          min = now
          min_g = now_g
        else
          max = now
          max_g = now_g
        end
      end
    end

  end

end

Measured memory_bytes: 2384
/*
*/
#include <iostream>
#include <algorithm>
#include <vector>
#include <deque>
#include <string>
#include <cmath>
#include <numeric>

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

    if (s[0] == s[1] || s[2] == s[1] || s[2] == s[3])
        std::cout << "Bad" << std::endl;
    else
        std::cout << "Good" << std::endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n - 1; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i <= n; i++)
#define FORR(i, m, n) for(int i = m; i >= n; i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define VSORTR(v) sort(v.rbegin(), v.rend());
#define ALL(v) (v).begin(),(v).end()
 
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll, ll>;

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

    ll a, b, k;
    cin >> a >> b >> k;

    ll na = max(a - k, 0LL), nb = max(b - (k - (a - na)), 0LL);
    cout << na << " " << nb << endl;
    return 0;
}

Measured memory_bytes: 256
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <chrono>
#include <stack>
#include <string>
#include <bitset>
#include <unordered_map>
#include <cstdio>
#include <limits>
#include <vector>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <fstream>
#include <numeric>
#include <sstream>
#include <cassert>
#include <tuple>
#include <iomanip>
#include <random>
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <fstream>
using namespace std;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define popb pop_back()
#define ll long long
#define sz size()
#define all(x) x.begin(), x.end()
#define forn(x) for(int i=1;i<=x;i++) 
#define sforn(x, y) for(int i=1;i<=x;i++)for(int j=1;j<=y;j++)
#define pii pair<int, int>
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

/*
    LOL KEK CHEBUREK
 
    PIHALITI
 
 */
vector<int> g[1100];
vector<int> gr[1100];
vector<int> g2[1100];
int used[1100];
int table[1100][1100];
int lvl[1100];
int pr[1100];
vector<int> tp;
vector<int> now;
void top(int v){
    used[v] = 1;
    for(auto to : g[v]){
        if(!used[to])top(to);
    }
    tp.pb(v);
}
void dfs(int v){
    now.pb(v);
    used[v] = 1;
    for(auto to : gr[v]){
        if(!used[to]) dfs(to);
    }
}
vector<int> ans;
bool cmp(int a, int b){
    return lvl[a] > lvl[b];
}
void dfs2(int v, int pred=-1){
    pr[v] = pred;
    used[v]=1;
    sort(all(g2[v]), cmp);
    for(auto to : g2[v]){
        if(!used[to]) {
            lvl[to] = lvl[v] + 1;
            dfs2(to, v);
        }
        else {
            int ver = v;
            ans.pb(to);
            while(ver!=to){
                ans.pb(ver);
                ver = pr[ver];
            }
            sort(all(ans));
            cout << ans.sz << endl;
            for(auto it : ans){
                cout << it << endl;
            }
            exit(0);
        }
    }
}
int main(){ speed;
    int n, m;
    cin >> n >> m;
    for(int i=1;i<=m;i++){
        int a, b;
        cin >> a >> b;
        g[a].pb(b);
        table[a][b] = 1;
        gr[b].pb(a);
    }
    for(int i=1;i<=n;i++){
        if(!used[i]) top(i);
    }
    forn(n)used[i]=0;
    reverse(all(tp));
    for(int i=0;i<tp.sz;i++){
        int to = tp[i];
        if(!used[to]){
            dfs(to);
            for(auto v : now){
                for(auto v2 : now){
                    if(table[v][v2]){
                        g2[v].pb(v2);
                    }
                }
            }
        }
        now.clear();
    }
    forn(n)used[i]=0;
    for(int i=1;i<=n;i++){
        if(!used[i]) dfs2(i);
    }
    cout << -1 << endl;
    return 0;
}

Measured memory_bytes: 4480
/**
class cfmaster {
 struct code {
   see the details down there
 };
};
**/
#include <bits/stdc++.h>

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  sort(a.begin(), a.end());
  for (int i = 1; i < n; i++) {
    if (a[i] == a[i - 1]) {
      cout << "NO" << '\n';
      return 0;
    }
  }
  cout << "YES" << '\n';
  return 0;
}

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

#define all(v) v.begin(), v.end()
#define V vector
#define P pair
typedef long long ll;
const int INT_INF = 1e9;
const ll INF = 1LL << 30;

V<int> ans;
int n, x, y, cnt;
int main() {
    cin >> n >> x >> y;

    // 2点間の距離の最小値をカウント
    ans.resize(n);
    for(int i = 1; i <= n; i++){
        for(int j = i + 1; j <= n; j++){
            if(i == j) continue;
            int a = abs(x - i) + abs(j - y) + 1;
            int d = min({abs(j - i), a});
            ans[d]++;
        }
    }
    for(int i = 1; i < n; i++){
        cout << ans[i] << endl;
    }
}


Measured memory_bytes: 256
from math import ceil,floor,comb,factorial,gcd,pow,sqrt,log2,cos,sin,tan,acos,asin,atan,degrees,radians,pi,inf
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from collections import deque,defaultdict,Counter
from bisect import bisect_left,bisect_right
from operator import itemgetter
from heapq import heapify,heappop,heappush
from copy import deepcopy
from time import time
import string
import sys
sys.setrecursionlimit(10 ** 7)
def input() : return sys.stdin.readline().strip()
def INT()   : return int(input())
def MAP()   : return map(int,input().split())
def LIST()  : return list(MAP())

s = input()

i = 0
j = len(s)-1
ans = 0
while i <= j:
    if s[i] == 'x' and s[j] != 'x':
        while i <= j and s[i] == 'x':
            ans += 1
            i += 1
    elif s[j] == 'x' and s[i] != 'x':
        while i <= j and s[j] == 'x':
            ans += 1
            j -= 1

    if i <= j:
        if s[i] != s[j]:
            print(-1)
            exit()
        i += 1
        j -= 1
    else:
        break

print(ans)

Measured memory_bytes: 10072
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <numeric>
#include <string>
#include <cstdio>
#include <cstring>
#include <queue>
#include <stack>
#include <set>
#include <cmath>
#include <bitset>

typedef long long ll;
typedef unsigned long long ull;
using namespace std;

#define FALSE printf("false\n");
#define TRUE printf("true\n");
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i = 0;i < ((int)(n));++i)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define test(a) cout<<"line:"<<__LINE__<<"["<<(#a)<<": "<<(a)<<"]"<<endl

const int INF = 1e9+7;
const ll INFL = 9*1e18;

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

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

#define SUM(vec) accumulate(all(vec),0LL) // 配列の中身を全部足す
template<typename T>void print(T&& x){cout<<x<<endl;}// 改行付き出力
ll inline digit(ll num){int tmp = 0;while(num){tmp++;num/=10;}return tmp;} // 桁数
template<typename T>inline T digitSum(T num){T sum = 0;while(num){sum+=num%10;num/=10;}return sum;} // 各桁の和
template<typename T>inline T gcd(T a,T b){if(b == 0)return a;return gcd(b,a%b);} // 最大公約数
template<typename T>inline T lcm(T a, T b){T g = gcd(a,b);return a/g*b;} // 最小公倍数
template<typename T>inline T power(T a,T b){T tmp=1;rep(i,b){tmp*=a;}return tmp;} // 累乗
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
int ctoi(char c){return ('0' <= c && c <= '9')?(c - '0'):-1;}


bool isPrime(ll n) {
  if(n == 1)return false;
	for (int i = 2; n >= i * i; ++i) {
		if(!(n % i))return false;
	}
  return true;
}
vector<ll> primes(ll n){
  vector<ll> v;
  for (ll i = 2; i*i <= n; ++i) {
    while(n%i==0){
      n/=i;
      v.pb(i);
    }
  }
  if(n != 1)v.pb(n);
  return v;
}


// TODO: write
int main() {
  int n;cin>>n;
  map<string,int> m;
  string old;cin>>old;
  m[old]++;
  rep(i,n-1){
    bool ok = true;
    string s;cin>>s;
    if(old[old.size()-1] != s[0])ok = false;
    if(m[s]++)ok = false;
    if(!ok){
      print("No");
      return 0;
    }
    old = s;
  }
  print("Yes");
  return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i , n) for (int i = 0; i < (int)(n); i++)
const int INF = 1<<29;
using namespace std;
using ll = long long;
int main(){
    int n , x , t;
    cin >> n >> x >> t;
    if(n % x == 0){
        cout << n / x * t << endl;
    }
    else{
        cout << (n / x + 1) * t << endl;
    }
}

Measured memory_bytes: 3632
#include <stdio.h>
#include <vector>
using namespace std;
#define MAX_N (10010)
#define INF (1000000100)
typedef struct {
    int to;
    int w;
} Edge;

vector<Edge> G[MAX_N];
int n;

int dist[MAX_N];
bool arrived[MAX_N];

void dijkstra(int s)
{
    for ( int i = 0; i < n; i++ ) {
	dist[i] = INF;
	arrived[i] = false;
    }

    dist[s] = 0;

    while ( true ) {
	int min_dist = INF;
	int index = -1;

	for ( int i = 0; i < n; i++ ) {
	    if ( !arrived[i] && (dist[i] < min_dist) ) {
		min_dist = dist[i];
		index = i;
	    }
	}
	
	if ( index == -1 ) break;
	
	arrived[index] = true;

	for ( int i = 0; i < G[index].size(); i++ ) {
	    Edge e = G[index][i];
	    if ( !arrived[e.to] && dist[e.to] > (dist[index] + e.w) ) {
		dist[e.to] = dist[index] + e.w;
	    }
	}
    }

}

int main()
{
    scanf("%d", &n);
    
    for ( int i = 0; i < n; i++ ) {
	int u, k;
	scanf("%d %d", &u, &k);

	for ( int j = 0; j < k; j++ ) {
	    int v, c;
	    Edge e;
	    scanf("%d %d", &v, &c);
	    e.to = v;
	    e.w = c;
	    G[u].push_back(e);
	}
    }

    dijkstra(0);

    for ( int i = 0; i < n; i++ ) {
	printf("%d %d\n", i, dist[i]);
    }

    return 0;
}

Measured memory_bytes: 6048
N,L= [int(i) for i in input().split()]
n=[]
for i in range(1,N+1):
    n.append(i)
taste=[]
for j in range(len(n)):
    taste.append(L+n[j]-1)
taste_a=[]
for x in range(len(taste)):
    taste_a.append(abs(taste[x]))
del taste[taste_a.index(min(taste_a))]
sum=0
for y in range(len(taste)):
    sum+=taste[y]
print(sum)

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

using namespace std;

typedef long long int ll;
typedef pair<ll, ll> pll;

#define FOR(i, n, m) for(ll (i)=(m);(i)<(n);++(i))
#define REP(i, n) FOR(i,n,0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll) 1e15;

int main() {
    ll N;
    cin >> N;
    if (N % 2 == 1)
        cout << 0 << endl;
    else {
        ll ans = 0;
        ll t = 10LL;
        while (true) {
            //! tの倍数がいくつある？
            ll m = N / t;
            if (m == 0)
                break;
            ans += m;
            t *= 5LL;
        }
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<map>
#include<cstring>
#include<cstdlib>
#include<cmath>
#include<algorithm>
#include<cstdio>
using namespace std;
typedef long long LL;;

int main() {
	int a, b, s;
	scanf("%d %d", &a, &b);
	if(b < 10) s = a * 10 + b;
	else if(b < 100) s = a * 100 + b;
	else s = a * 1000 + b; //100100
    for(int i = 1; i <= 400; i++) {
    	if(i * i == s) {
    		cout << "Yes" << endl;
    		return 0;
		}
	}
	cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.LinkedList;
import java.util.Queue;
import java.util.Scanner;
import java.util.Iterator;

class Graph {
	private int totalVertex;
	private LinkedList<LinkedList<Integer>> adjList;
	//adjacency list of edges
	public Graph() { totalVertex = 0; }
	public void loadAdjList() {
		Scanner in = new Scanner(System.in);
		totalVertex = in.nextInt();
		adjList = new LinkedList<LinkedList<Integer>>();
		for(int i = 0; i < totalVertex; i ++) {
			LinkedList<Integer> tmp = new LinkedList<Integer>();
			int idx1 = in.nextInt() - 1;
			int degree = in.nextInt();
			//System.out.println("mark idx1 = " + idx1 + " degree = " + degree);
			for(int j = 0; j < degree; j ++) {
				int idx2 = in.nextInt() - 1;
				tmp.add(idx2);
			}	
			adjList.add(tmp);
		}
		in.close();
	}

	public void BfsSP() {
		int[] distances = new int[totalVertex];
		boolean[] visited = new boolean[totalVertex];
		for (int i = 1; i < distances.length; i++) {
			distances[i] = -1;
		}

		Queue<Integer> unvisitedNodes = new LinkedList<>();
		unvisitedNodes.add(0);

		while (!unvisitedNodes.isEmpty()) {
			int currVertex = unvisitedNodes.poll();
			visited[currVertex] = true;
			LinkedList<Integer> neighborList = adjList.get(currVertex);
			for (Integer neighbor : neighborList) {
				if (!visited[neighbor]) {
					unvisitedNodes.add(neighbor);
					int newDistance = distances[currVertex] + 1;
					distances[neighbor] = distances[neighbor] == -1 ? newDistance : Math.min(distances[neighbor], newDistance);
				}
			}
		}

		for (int i = 0; i < distances.length; i++) {
			System.out.println((i + 1) + " " + distances[i]);
		}
	}
}

//change class name GraphRepresentation to Main() for submission to AIZU
public class Main {
	public static void main(String argv[]) {
		Graph g = new Graph();
		g.loadAdjList();
		g.BfsSP();
	}
}


Measured memory_bytes: 38712
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<(n); i++)
typedef long long ll;
const int mod = 1e9 + 7;
int main() {

    int n;
    cin >> n;
    vector<int> x(n+2);
    x[0] = 0;
    int distance = 0;
    rep(i, n){
        cin >> x[i+1];
        distance += abs(x[i+1]-x[i]);
    }
    x[n+1] = 0;
    distance += abs(x[n+1] - x[n]);

    int ans = 0;
    rep(i, n) {
        int tmp = distance;
        tmp -= (abs(x[i+1]-x[i]) + abs(x[i+2]-x[i+1]));
        tmp += abs(x[i+2]-x[i]);
        cout << tmp << endl;
    }

    return 0;
}

Measured memory_bytes: 1664
n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)

ans = 1

if a[-1] == 0:
  ans = 0
else:
  for i in a:
    ans *= i
    if ans > 1000000000000000000:
      print(-1)
      break
    else:
      continue

if ans <= 1000000000000000000:
  print(ans)

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

int main(int argc, char const *argv[]) {
    int A, B, C;
    cin >> A >> B >> C;

    if (A + B + C >= 22) {
        cout << "bust" << endl;
    } else {
        cout << "win" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
n = int(input())

a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))

total_value = sum(b)

for i in range(n-1):
    if a[i] +1 == a[i+1]:
        total_value+= c[a[i]-1]

print(total_value)


Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <cstring>
#include <utility>
#include <numeric>

using namespace std;

int main(){

    int N;
    cin >> N;
    string S;
    cin >> S;
    char before = '#';
    int ans = 0;
    for(int i = 0; i < N; i++){
        if(S[i] != before){
            ans++;
        }
        before = S[i];
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 512
//  RAKSHIT KADAM
 #include <bits/stdc++.h>
 
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
// #define ordered_set tree< int ,  null_type ,  less<int> ,  rb_tree_tag ,  tree_order_statistics_node_update>
 #warning !!!check the size of arrayss!!!
 
 #define ll long long
 #define int long long
 #define MOD  1000000007
 #define newMOD  998244353
 #define MAX 300006
            
 #define Need_for_speed(activated) ios_base :: sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
 #define satisfy ll t; cin>> t; while(t--)
 #define inp(n) int n;cin >> n
 #define mp make_pair
 #define pb push_back
 #define fore(i,a,b) for(ll i=a;i<b;i++)
 #define endl "\n"
 #define x first
 #define y second
 #define forci(i,n) for(ll i=0;i<n;i++)
 #define INF 1000000000000000005
 #define vi vector<ll>
#define pi 3.1415926535897932384626433832795
#define Endl endl
#define lb lower_bound
#define ub upper_bound
using namespace std;
ll gcd(ll a, ll b){if (b == 0)return a;return gcd(b, a % b);}
//int power(int x, unsigned int y, unsigned int m){ if (y == 0) return 1;int p = power(x, y/2, m) % m;  p = (p * p) % m;                                                  return (y%2 == 0)? p : (x * p) % m;}
 
//ll modInverse(int a, int m){int g = gcd(a, m); { return power(a, m-2, m);}}

void solve()
{
    ll n;cin>>n;
    map<ll,ll>m;set<ll>s;
    for(ll i=1;i*i<=n;i++)
    {
       if(n%i==0)
       {
           m[i]++;
           m[n/i]++;
       }
        else
        {
            if(n%i==1)s.insert(i);
        }
    }
    
    for(ll i=1;i*i<=n-1;i++)
    {
        if((n-1)%i==0)
        {
            s.insert(i);
            s.insert((n-1)/i);
        }
    }
    
    for(auto it:m)
    {
        ll p=n;
        if(it.first==1)
            continue;
        while(p%it.first==0)
        {
            p/=it.first;
        }
        
        if(p%it.first==1)s.insert(it.first);
    }
    s.erase(1);
   cout<<s.size()<<endl;
}
signed main()
{
 
   
    Need_for_speed(activated);
//satisfy
//    {
//   solve();
//    }

  solve();
    return 0;
    
}
 


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
ll GCD(ll a,ll b){return b?GCD(b,a%b):a;}
ll LCM(ll a,ll b){return (a*b)/GCD(a,b);}
int abs(int x){return x>0?x:-x;}
 
//const int dx[] = {1, 0, -1, 0, 1, -1, -1, 1};
//const int dy[] = {0, 1, 0, -1, 1, 1, -1, -1};

int main()
{
	int a[3];
	REP(i, 3) cin >> a[i];
	sort(a, a+3);
	int tmp = a[0] + a[1];
	if ((a[2]*2 - tmp) % 2){
		cout << (a[2]*2 - tmp) / 2 + 2 << endl;
	}
	else cout << (a[2]*2 - tmp) / 2 << endl;

}


Measured memory_bytes: 256
#include <stdio.h>
#include <string>
#include <stdlib.h>
#include<vector>
#include<iostream>
#include<set>
using namespace std;




int main() {
	int a,b;
	cin >> a >> b;
	
	if(a >= 13) cout << b << endl;
	else if(a>=6) cout << b/2 << endl;
	else cout << 0 <<endl;
	
    return 0;
}


Measured memory_bytes: 256
#include<cstring>
#include<iostream>
using namespace std;
string s,ss[4]={"dream","dreamer","erase","eraser"};
int l,z[4]={5,7,5,6};
int main()
{
	cin>>s;
	l=s.length();
	while(l>0)
	{
		if(s[l-5]=='d'&&s[l-4]=='r'&&s[l-3]=='e'&&s[l-2]=='a'&&s[l-1]=='m')
		{
			l-=5;
		}
		else if(s[l-5]=='e'&&s[l-4]=='r'&&s[l-3]=='a'&&s[l-2]=='s'&&s[l-1]=='e')
		{
			l-=5;
		}
		else if(s[l-6]=='e'&&s[l-5]=='r'&&s[l-4]=='a'&&s[l-3]=='s'&&s[l-2]=='e'&&s[l-1]=='r')
		{
			l-=6;
		}
		else if(s[l-7]=='d'&&s[l-6]=='r'&&s[l-5]=='e'&&s[l-4]=='a'&&s[l-3]=='m'&&s[l-2]=='e'&&s[l-1]=='r')
		{
			l-=7;
		}
		else
		{
			cout<<"NO"<<endl;
			return 0;
		}
	}
	cout<<"YES"<<endl;
	return 0;
}

Measured memory_bytes: 512
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#define rep(i, n) for (int i = 0; i < (n); i++)
typedef long long ll;

using namespace std;

static string ac = "AC";

// n 問題数, m 提出回数
int n, m;
// ans 正答数, p ペナルティ数
long ans, penalty;

map<int, bool> pass;
map<int, int> penalties;

void sub() {
  int i;
  string r;
  cin >> i >> r;
  if (pass.count(i)) {
    return;
  }
  if (r == ac) {
    pass.insert(make_pair(i, true));
    ans++;
    if (penalties.count(i)) {
      penalty += penalties.at(i);
    }
  } else {
    if (penalties.count(i)) {
      penalties.at(i) = penalties.at(i) + 1;
    } else {
      penalties.insert(make_pair(i, 1));
    }
  }
}

int main() {
  cin >> n >> m;
  ans = 0;
  penalty = 0;
  rep(i, m) {
    sub();
  }
  cout << ans << " " << penalty << endl;
}


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

#define LL long long
#define COIN const int
#define ite iterator
#define PII pair<int,int>
#define PSI pair<string,int>
#define PIS pair<int,string>

#define REP(i,n) for((i)=0;(i)<(int)(n);(i)++)
#define REPD(i,n) for((i)=(n)-1;(i)>=0;(i)--)

#define ALL(c) (c).begin(), (c).end()
#define LEN(s) (s).size()
#define CLEAR(x) memset(x,0,sizeof x);

#define MP make_pair
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define X first
#define Y second

#define VI vector<int>
#define VS vector<string>
#define VII vector<PII>
#define VVI vector<VI>

#define PIII 3.1415926
#define PI 3.14
/*****************************************************************************/

using namespace std;

int n,r;

int main()
{
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	cin >>n >>r;
	if(n>=10)
		cout <<r;
	else
		cout <<r+100*(10-n);
	return 0;
}
/******************************************************************************
******************************************************************************/


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define pb push_back
#define sz(x) (int)(x).size()
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;

const int mod = 1000000007;

struct mint{
    ll x;
    mint(ll x=0):x((x%mod+mod)%mod){};
    mint operator-() const{
        return mint(-x);
    }
    mint& operator+=(const mint a){
        if((x+=a.x) >= mod) x -= mod;
        return *this;
    } 
    mint& operator-=(const mint a){
        if((x+= mod - a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a){
        (x *= a.x) %= mod;
        return *this;
    }
    mint operator+(const mint a) const{
        mint res(*this);
        return res += a;
    }
    mint operator-(const mint a) const{
        mint res(*this);
        return res -= a;
    }
    mint operator*(const mint a) const{
        mint res(*this);
        return res *= a;
    }
    mint pow(ll t) const{
        if(!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if(1&t) a *= *this;
        return a;
    }

    mint inv() const{
        return pow(mod-2);
    }
    mint& operator/=(const mint a){
        return (*this) *= a.inv();
    }
    mint operator/(const mint a) const{
        mint res(*this);
        return res /= a;
    }
};

struct combination{
    vector<mint> fact, ifact;
    combination(int n):fact(n+1), ifact(n+1){
        assert(n < mod);
        fact[0] = 1;
        for(int i=1; i<=n; i++) fact[i] = fact[i-1]*i;
        ifact[n] = fact[n].inv();
        for(int i=n; i>=1; i--) ifact[i-1] = ifact[i]*i;
    }
    mint operator()(int n, int k){
        if(k<0 || k>n) return 0;
        return fact[n]*ifact[k]*ifact[n-k];
    }
};

int main(){
    int n;
    int a, b;
    cin >> n;
    cin >> a >> b;
    //combination c(n);
    mint ans=2;
    
    ans = ans.pow(n);
    //cout << ans.x << endl;

    mint a_bo=1;
    mint a_shi=1;
    for(int i=1;i<=a;i++){
        a_bo *= i;
        a_shi *= n-i+1;
    }
    ans -= (a_shi/a_bo);

    mint b_bo=1;
    mint b_shi=1;
    for(int i=1;i<=b;i++){
        b_bo *= i;
        b_shi *= n-i+1;
    }
    ans -= (b_shi/b_bo);

    ans -= 1;

    
    //ans -= c(n, 0);
    //ans -= c(n, a);
    //ans -= c(n, b);

    cout << ans.x << endl;

    return 0;
}

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

const int N=1005;

int n,m,res=N;
char s[N],t[N];

int main()
{
    scanf("%s\n%s",s,t);
    n=strlen(s),m=strlen(t);
    for(int i=0;i+m<=n;i++)
    {
        int v=0;
        for(int j=0;j<m;j++)
            if(s[i+j]!=t[j])
                v++;
        if(v<res)res=v;
    }
    printf("%d\n",res);
    return 0;
}

Measured memory_bytes: 1704
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(), (x).end()
#define allr(x) (x).rbegin(), (x).rend()
#define pb push_back
#define ff first
#define ss second
#define ll long long
#define ld long double
typedef pair<ll,ll> pll;
typedef pair<pll,pll> ppll;
typedef vector <ll> vi;
#define out(x) return cout<<x,0;
#define precision(x,d) cout<<fixed<<setprecision(d)<<x
#define lc(n) 2*n+1
#define rc(n) 2*n+2
#define fill(a,b) memset((a),(b),sizeof((a)))
#define FAST ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);srand(time(NULL)); 
const ll M = 1e9 + 7;

int main() {
    FAST;
    ll n, x = 0, y = 0, k, i, t, ans = 0, j, c = 0, z = 0, m;
    string s, s1, s2;
    cin >> s;
    n = s.size();
    for ( i = 0 ; i < n ; i ++ ) cout << "x";

}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <queue>
#include <stack>
#include <cstdlib>
#include <map>
#include <iomanip>
#include <set>
#include <stdio.h>
#include <ctype.h>
#include <random>
#include <string.h>
#include <cmath>
#include <unordered_map>
#include <cstdio>
using namespace std;
#define pie 3.141592653589793238462643383279
#define mod 998244353
#define int long long
#define P pair<int,int>
#define all(vec) vec.begin(),vec.end()

int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x / gcd(x, y)*y;
}
int kai(int x, int y) {
	int res = 1;
	for (int i = x - y + 1; i <= x; i++) {
		res *= i; res %= mod;
	}
	return res;
}
int mod_pow(int x, int y, int m) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}

int comb(int x, int y) {
	if (y > x)return 0;
	return kai(x, y) * mod_pow(kai(y, y), mod - 2, mod) % mod;
}

int n, s, a[3010];
int d[3010][3010];

signed main() {
	cin >> n >> s;
	for (int i = 1; i <= n; i++)cin >> a[i];
	d[0][0] = mod_pow(2, n, mod);
	for (int i = 1; i <= n; i++) {
		for (int j = 0; j <= s; j++)d[i][j] = d[i - 1][j];
		for (int j = 0; j <= s - a[i]; j++)d[i][j + a[i]] = (d[i][j + a[i]] + d[i - 1][j] * mod_pow(2, mod - 2, mod) % mod) % mod;
	}
	cout << d[n][s] << endl;
}

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

#define NDEBUG
#ifdef DEBUG
#include "../cout11.h"
#undef NDEBUG
#endif
#include <cassert>

typedef long long ll;
typedef long double Double;
typedef unsigned long long ull;
typedef pair<int,int> ii;
typedef pair<ll,ll> llll;
typedef pair<double,double> dd;

typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<ii> vii;
typedef vector<vector<ii>> vvii;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<long double> vD;

#define sz(a)  int((a).size())
#define pb  push_back
#define FOR(var,from,to) for(int var=(from);var<=(to);++var)
#define rep(var,n)  for(int var=0;var<(n);++var)
#define rep1(var,n)  for(int var=1;var<=(n);++var)
#define repC2(vari,varj,n)  for(int vari=0;vari<(n)-1;++vari)for(int varj=vari+1;varj<(n);++varj)
#define ALL(c)  (c).begin(),(c).end()
#define RALL(c)  (c).rbegin(),(c).rend()
#define tr(i,c)  for(auto i=(c).begin(); i!=(c).end(); ++i)
#define found(s,e)  ((s).find(e)!=(s).end())
#define mset(arr,val)  memset(arr,val,sizeof(arr))
#define mid(x,y) ((x)+((y)-(x))/2)
#define IN(x,a,b) ((a)<=(x)&&(x)<=(b))

#define INFTY 9999

int solve(int N,int M,vi& a,vi& b,vi& c) {
    vvi d(N, vi(N, INFTY));
    rep(i,N) d[i][i] = 0;
    rep(i,M){
        int x=a[i], y=b[i];
        d[x][y] = d[y][x] = c[i];
    }
    rep(k,N) rep(i,N) rep(j,N) d[i][j] = min(d[i][j], d[i][k]+d[k][j]);
    int ans = 0;
    rep(i,M){
        int x=a[i], y=b[i];
        if (c[i] > d[x][y]) ++ans;
    }
    return ans;
}

int main() {
    int N,M; cin >> N >> M;
    vi a(M),b(M),c(M);
    rep(i,M){
        cin >> a[i] >> b[i] >> c[i];
        --a[i]; --b[i];
    }
    cout << solve(N,M,a,b,c) << endl;
    return 0;
}


Measured memory_bytes: 256
//به نامش
//how we code is who we are :))
#include <bits/stdc++.h>

using namespace std;

#define pb push_back
#define ff first
#define ss second

typedef long long ll;
const ll MAXN = 2e6 + 10, inf = 1e18, mod = 1e9 + 7;

struct pair_hash {
	template <class T1, class T2>
		std::size_t operator () (const std::pair<T1,T2> &p) const {
			auto h1 = std::hash<T1>{}(p.first);
			auto h2 = std::hash<T2>{}(p.second);

			return h1 ^ h2;  
		}
};

ll pw(ll te, ll tee) {
	if (tee == 0)	return 1;
	ll res = pw(te, tee / 2);
	return (tee % 2 ? te * res * res : res * res);
}

ll a, b, q;
vector <ll> s, t;

void Read_input() {
	cin >> a >> b >> q;
	ll tmp;
	for (ll i = 1; i <= a; i++)	cin >> tmp,	s.pb(tmp);
	for (ll i = 1; i <= b; i++)	cin >> tmp,	t.pb(tmp);
}

void Solve() {
	cerr << endl;
	while (q--) {
		ll x;
		cin >> x;
		auto it1 = lower_bound(s.begin(), s.end(), x), it2 = lower_bound(t.begin(), t.end(), x);
		ll p =  (s.end() - it1 <= 0 ? inf : *it1), pp = (t.end() - it2 <= 0 ? inf : *it2);
		it1--;
		it2--;
		ll q = (it1 - s.begin() < 0 ? -inf : *it1), qq = (it2 - t.begin() < 0 ? -inf : *it2);
		ll ans = min(2 * (p - x) + x - qq, 2 * (pp - x) + x - q);
		//cerr << "# " << ans << endl;
		ans = min(ans, min(2 * (x - qq) + p - x, 2 * (x - q) + pp - x));
		//cerr << "! " << 2 * (pp - x) + x - q << endl;
		ans = min(ans, min(max(p, pp) - x, x - min(q, qq)));
		cout << ans << endl;
	}
}


int main() {

	ios_base::sync_with_stdio(false);	cin.tie(0);	cout.tie(0);
	//freopen("input.txt", "r", stdin),	freopen("output.txt", "w", stdout);

	Read_input(),	Solve();
	return 0;
}


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

int main(){
    int n; cin >> n;
    int h[n], i; for(i = 0; i < n; i++) cin >> h[i];
    int a = 0, b = abs(h[1] - h[0]), c = b; i = 2;
    while(i < n){
        c = min(abs(h[i] - h[i-1]) + b, abs(h[i] - h[i-2]) + a);
        a = b;
        b = c;
        i++;
    }
    // if(n == 2)  cout << b << endl;
    cout << c << endl;
    return 0;
}


Measured memory_bytes: 640
using System;

namespace rensyuu1
{
    class Program
    {
        static void Main(string[] args)
        {
            int S = int.Parse(Console.ReadLine());
            int h = S / 3600;
            int M = S - 3600 * h;
            int m = M / 60;
            int s = M - 60 * m;
            Console.WriteLine(h + ":" + m + ":" + s);
        }
    }
}


Measured memory_bytes: 17948
#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 int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int N;
string S;

char BorW[200010];

int cntBandW[200010] = {};
int cnt = 0;


int sumW = 0, sumB = 0;

int ans = INF;

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

	if (S[0] == '#')
	{
		//黒のとき
		//数足す
		cntBandW[cnt]++;
		BorW[cnt] = 'B';
	}
	else
	{
		cntBandW[cnt]++;
		sumW++;
		BorW[cnt] = 'W';
	}

	//ここまでで1つめの

	for (int i = 1; i < N; i++)
	{
		//分ける
		if (S[i] == '#')
		{
			//黒のとき
			if (S[i - 1] == '.')
			{
				cnt++;
				BorW[cnt] = 'B';
			}
			cntBandW[cnt]++;
		}
		else
		{
			sumW++;

			if (S[i - 1] == '#')
			{
				cnt++;
				BorW[cnt] = 'W';
			}
			cntBandW[cnt]++;
		}
	}

	ans = sumB + sumW;

	for (int i = 0; i <= cnt; i++)
	{
		if (BorW[i] == 'B')
		{
			sumB += cntBandW[i];
		}
		else
		{
			sumW -= cntBandW[i];
		}
		ans = min(ans, sumB + sumW);
	}


	cout << ans << endl;
}

Measured memory_bytes: 1540
def return_Lucas(num1, num2):
  return num1 + num2

n = int(input())

n1 = 2
n2 = 1
if n == 0:
  print(n1)
elif n == 1:
  print(n2)
else:  
  for i in range(2, n+1):
    n1, n2 = n2, return_Lucas(n1,n2)
    if i == n:
      print(n2)
      

Measured memory_bytes: 38256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define endl '\n'

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	long double a, b, c;
	cin>>a>>b>>c;
	long double eps = 1.0E-14;
	cout<<(sqrt(a) + sqrt(b) + eps < sqrt(c) ? "Yes": "No")<<endl;
	return 0;
}



Measured memory_bytes: 256