akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<algorithm>
using namespace std;

int a(int baggages[],int baggageAmount, int trackAmount, long maxWeight) {
	int i = 0;
	for (int j = 0; j < trackAmount; j++) {
		int weight = 0;
		while (baggages[i] + weight <= maxWeight) {
			weight += baggages[i];
			i++;
			if (i == baggageAmount) return maxWeight;
		}
	}
	return 0;
}

int main(void) {
	int baggageAmount, trackAmount, tracks[100001],baggages[100001];

	cin >> baggageAmount >> trackAmount;
	for (int i = 0; i < baggageAmount; i++) {
		cin >> baggages[i];
	}

	long long low = 0, high = 100000 * 10000;
	while(high - low > 1) {
		long weight = (low + high) / 2;
		if (a(baggages, baggageAmount, trackAmount, weight) >= weight) {
			high = weight;
		} else {
			low = weight;
		}
	}
	cout << high << endl;
	return 0;
}

Measured memory_bytes: 1548
#include <bits/stdc++.h>
using namespace std;
#define  rep(i, n) for(int i = 0; i < n; i++) 
#define  all(x) (x).begin(),(x).end()     // 昇順ソート
#define  rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define  INF 1LL << 60
typedef long long int LL;
typedef long long int ll;
#define pll pair<ll, ll>
#define F first
#define S second
const int MOD = 1000000007;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return true; } return false; }
//sort(all(x))とするとソートできるよ
// 10^x は pow(10,(x)) 
// 任意のlogは　対数の底の変換を使う    log(N) / log(任意の底)

int main(){
    LL N;cin >> N;
    vector<LL> A(N);
    rep(i,N){
        cin >> A[i];
        A[i] *= 2;
    }

    vector<LL> rui(N+1);
    rui[0] = 0;
    rep(i,N+1){
        if(i == 0)continue;
        rui[i] = rui[i-1] + A[i-1];
    }


    LL half = rui[N]/2;
    int ind = 0;
    rep(i,N+1){
        if(rui[i] >= half){
            ind = i;
            break;
        }
    }

   /* rep(i,N+1)cout << rui[i] << " ";
    cout << endl;
    cout << half << endl;
    cout << ind << endl;
*/
    LL ans = 0;
    if(abs(rui[ind] - half) != 0){
        LL K = rui[ind] - half;
        LL M = half - rui[ind-1];
        ans = min(K,M);
    }


    cout << ans << endl;
}



Measured memory_bytes: 3328
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<utility>
#include<set>
#include<stack>
#include<list>
#include<deque>
#include<bitset>
#include<iomanip>
#include<cstring>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<climits>
#include<cmath>
#include<cctype>


#define pb push_back
#define mp make_pair
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define ren(i,a,b) for(int i=a;i>=b;i--)
#define ff first
#define ss second
#define pll pair<long long int,long long int>
#define pii pair<int,int>
#define vll vector<long long int>
#define vii vector<int>
#define gi(n) scanf("%d",&n)
#define gll(n) scanf("%lld",&n)
#define gstr(n) scanf("%s",n)
#define gl(n) cin >> n
#define oi(n) printf("%d",n)
#define oll(n) printf("%lld",n)
#define ostr(n) printf("%s",n)
#define ol(n) cout << n
#define os cout<<" "
#define on cout<<"\n"
#define o2(a,b) cout<<a<<" "<<b
#define all(n) n.begin(),n.end()
#define present(s,x) (s.find(x) != s.end())
#define cpresent(s,x) (find(all(s),x) != s.end())
#define tr(container, it) for(__typeof(container.begin()) it = container.begin(); it != container.end(); it++)
using namespace std;

typedef unsigned long long int ull;
typedef long long int ll;
typedef long double ld;
typedef vector<vector<ll> > mat;


int main()
{ios_base::sync_with_stdio(false);
string s;
cin>>s;
int n=s.length();
rep(i,0,n-1)ol("x");
return 0;
}



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

int main()
{
	int n;
	cin >> n;
	int maxv = -1000000000;
	int minv;
	int R[200000];
	for (int t = 0; t < n; t++) {
		cin >> R[t];
	}
	minv = R[0];

	for (int j = 1; j < n; j++) {
		maxv = max(maxv, R[j] - minv);
		minv = min(minv, R[j]);
	}
	cout << maxv << endl;
	return 0;
}


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

int main(){
    int A, B, C, K;
    cin >> A >> B >> C >> K;
    int ans = 0;
    if(A >= K){
        ans = K;
    }else if(B > K - A){
        ans = A;
    }else{
        ans = A - (K - A - B);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define rep(i,n) for (int i = (0); i < (n); ++i)
#define rng(x) (x).begin(),(x).end()
#define rrng(x) (x).rbegin(),(x).rend()
#define show(x) cout << #x << " = " << (x) << endl;
#define show2(x,y) cout << #x << " = " << (x) << ", " << #y << " = " << (y) << endl;
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define uni(x) x.erase(unique(rng(x)),x.end())
#define SP << " " <<
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
const int mod = 1000000007;
const double EPS = 1e-9;
const int INF = 1<<30;
const ll INFLL = 1LL<<60;
//cout << fixed << setprecision(10);

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

int main () {
  int a, b;
  cin >> a >> b;
  cout << 6-(a+b) << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define PI 3.1415926535897932
#define _GLIBCXX_DEBUG
#define MOD 1000000007;
using namespace std;
long long GCD(long long A,long long B){
  if(B==0){
    return A;
  }
  else{
    return GCD(B,A%B);
  }
}
int main() {
  
  long long A,B,C,D;
  cin>>A>>B>>C>>D;
  
  long long all=B-A+1;
  
  long long sum_C=B/C-(A-1)/C;
  
  long long sum_D=B/D-(A-1)/D;
  
  long long x=C*D/GCD(C,D);
  
  long long sum_CD=B/x-(A-1)/x;
  
  cout<<all-sum_C-sum_D+sum_CD<<endl;
}

Measured memory_bytes: 3604
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <stack>
#include<algorithm>
#include<sstream>
#include<iomanip>
#include<deque>
#include<list>


using namespace std;

typedef long long ll;

typedef pair<int, int> pii;

const ll MOD_CONST = 1000000007;
const ll BIG_NUM = 1000000000000000000;
const int BIG_INT = 1000000000;



int main() {
	int h, w;
	cin >> h >> w;
	vector<string> a(h+2);
	a[0] = string(w + 2, ',');
	for (int i = 1;i <=h;i++) {
		string s;
		cin >> s;
		a[i] = ".";
		a[i] += s;
		a[i] += '.';
	}
	a[h + 1] = string(w + 2, ',');

	bool canConsist = true;
	for (int i = 1; i <=h;i++) {
		for (int j = 1; j <=w;j++) {
			
			if (a[i][j] == '#') {
				
				int cnt = 0;
				if (a[i][j + 1] == '#') {
					cnt++;
				}

				if (a[i][j - 1] == '#') {
					cnt++;
				}
				if (a[i + 1][j] == '#') {
					cnt++;
				}
				if (a[i - 1][j] == '#') {
					cnt++;
				}

				if (cnt > 2) {
					canConsist = false;
					break;
				}
				if (i == 1 && j == 1 && cnt >= 2) {
					canConsist = false;

					break;
				}
				

				if (i == h && j == w) {
					if (cnt >= 2) {
						canConsist = false;
					}
					break;
				}

				if (a[i + 1][j] != '#' && a[i][j + 1] != '#') {
					canConsist = false;
					break;
				}
				
				
			}
			
		}

		if (!canConsist) {
			break;
		}
		
	}


	cout << (canConsist ? "Possible" : "Impossible") << endl;
}



Measured memory_bytes: 256
def main
  w, a, b = gets.split(" ").map{|v| v.to_i}
  distance1 = b - (a+w)
  distance2 = a - (b+w)
  if distance1 * distance2 >= 0 then
    puts 0
  else
    puts ((distance1 >= 0) ? distance1 : distance2)
  end
end

main


Measured memory_bytes: 1788
#include <bits/stdc++.h>
#define all(X) (X).begin(),(X).end()
#define rall(X) (X).rbegin(),(X).rend()
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define ff first
#define ss second
#define P 1000000007
#define in(x, a, b) (a <= x && x < b)

using namespace std;
using ll = long long;
typedef pair<int, int> ii;
typedef vector<ii> vii; 
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
const ll inf = 1000000001, INF = (ll)1e18 + 1;

const int maxn = 1e5 + 10;

ll fact[maxn], fact_inv[maxn];

ll power(ll a, ll b) {
	ll result = 1;
	while(b) {
		if(b % 2) result = (result * a) % P;
		a = (a * a) % P;
		b /= 2;
	}
	
	return result;
}

ll divide(ll a, ll b) {
	return a * power(b, P - 2) % P;
}

ll C(ll n, ll k) {
	if(n < k) return 0;
	return ((fact[n] * fact_inv[k]) % P * fact_inv[n - k] % P);
}

void init() {
	fact[0] = 1;
	for(int i = 1; i < maxn; i++) fact[i] = (fact[i - 1] * i) % P;
	
	fact_inv[maxn - 1] = divide(1, fact[maxn - 1]);
	for(int i = maxn - 2; i >= 0; i--) fact_inv[i] = (fact_inv[i + 1] * (i + 1)) % P;
}

void solve() {
	int n;
	cin >> n;
	
	vi a(n + 1);
	for(int i = 0; i < n + 1; i++) cin >> a[i];
	
	int cnt;
	vi seen(n + 1, -1);
	for(int i = 0; i < n + 1; i++) {
		if(seen[a[i]] != -1) {
			cnt = seen[a[i]] + n - i;
			break;
		} else seen[a[i]] = i;
	} 
	
	cout << n << endl;
	for(int k = 2; k <= n + 1; k++) {
		ll ans = 0;
		ans += C(n - 1, k);
		ans %= P;
		ans += C(n - 1, k - 2);
		ans %= P;
		ans += (2 * C(n - 1, k - 1)) % P;
		ans %= P;
		ans = (ans - C(cnt, k - 1) + P) % P;
		
		cout << ans << endl;
	}
}

int main() {
	ios_base::sync_with_stdio(false);
	init();
	solve();
    return 0;
}	

Measured memory_bytes: 5464
#include <bits/stdc++.h>
#define For(i, a, b) for(int (i)=(a); (i)<(b); ++(i))
#define rFor(i, a, b) for(int (i)=(a)-1; (i)>=(b); --(i))
#define rep(i, n) For((i), 0, (n))
#define rrep(i, n) rFor((i), (n), 0)
#define fi first
#define se second
using namespace std;
typedef long long lint;
typedef pair<int, int> pii;
typedef pair<lint, int> pli;
typedef complex<double> xy_t;

const lint mod = 1e9 + 7;

int n, m;
int a[1010], b[1010], c[1010];
int dp[1010][1<<12];
const int INF = mod;

int main(){
    scanf("%d%d", &n, &m);
    rep(i, m){
        scanf("%d%d", &a[i], &b[i]);
        c[i] = 0;
        rep(j, b[i]){
            int t;
            scanf("%d", &t);
            --t;
            c[i] |= (1 << t);
        }
    }

    rep(i, m+1)rep(j, 1<<n) dp[i][j] = INF;
    dp[0][0] = 0;
    rep(i, m)rep(j, 1<<n)if(dp[i][j] < INF){
        dp[i+1][j] = min(dp[i+1][j], dp[i][j]);
        dp[i+1][j | c[i]] = min(dp[i+1][j | c[i]], dp[i][j] + a[i]);
    }

    printf("%d\n", dp[m][(1<<n)-1] < INF ? dp[m][(1<<n)-1] : -1);
    /*rep(i, m+1){
        rep(j, 1<<n) (dp[i][j] < INF ? printf("%d ", dp[i][j]) : printf("inf "));
        printf("\n");
    }*/
}

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

const double pi  = 2 * acos(0.0);
const double eps = 1e-8;

#define REP(i,a,b) for(int i=(a); i<(b);++i)
#define rep(i,n) REP(i,0,n)
#define INF (1<<29)
#define INFLL (1LL<<62)

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

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

struct Dst {
  int id;
  int cost;

  Dst(int id, int cost)
    : id(id), cost(cost) {}
};

struct Node {
  int id;
  vector<Dst> dsts;
};

double p;
int N;

double dfs(int now, int prev, double np, double Te, vector<Node> &G) {
  double e = 0.0;

  for (int i = 0; i < G[now].dsts.size(); i++) {
    if (G[now].dsts[i].id == prev)
      continue;
    e += (G[now].dsts[i].cost + Te) * np;
    e += dfs(G[now].dsts[i].id, now, np * p, Te, G);
  }

  return e;
}

int main(void) {
  ios_base::sync_with_stdio(false); cin.tie(0);
  cin >> p >> N;
  vector<Node> G(N);

  rep(i, N - 1) {
    int x, y, c;
    cin >> x >> y >> c;
    x--;
    y--;
    G[x].dsts.push_back(Dst(y, c));
    G[y].dsts.push_back(Dst(x, c));
  }

  double Te = dfs(0, -1, p, 0.0, G);
  double ans = dfs(0, -1, p, Te, G) + Te;

  cout << fixed << setprecision(10) << ans << endl;
  return 0; 
}

Measured memory_bytes: 18452
package main

import "fmt"

func areOK(s, t string) (r bool){
  var u, v rune
  for i, r := range s {
    if i == len(s)-1{
      u = r
    }
  }
  for i, r:= range t {
    if i == 0 {
      v = r
    }
  }
  if u == v {
    r = true
  }else{
    r = false
  }
  return
}

func main() {
  var a, b, c string
  fmt.Scan(&a, &b, &c)
  if areOK(a,b) && areOK(b,c) {
    fmt.Println("YES")
  }else{
    fmt.Println("NO")
  }
}


Measured memory_bytes: 512
#include <iostream>
#include<algorithm>
#include<math.h>
#include<vector>
#include<queue>
using namespace std; queue<string> p;
queue<int> q;
int main()
{
    int n, r; cin >> n >> r; int sum = 0;
    for (int i = 0; i < n; i++) {
        string s; cin >> s;
        p.push(s);
        int y; cin >> y;
        q.push(y);
    }
    while (!q.empty()) {
        int f = q.front() - r;
        if (f <= 0) {
            f = r - q.front();
            cout << p.front() << " " << sum + q.front() << endl;
            sum += q.front();
            q.pop();
            p.pop();
        }
        else {
            q.push(f);
            p.push(p.front());
            p.pop(); q.pop();
            sum += r;
        }
    }
}


Measured memory_bytes: 5680
#include <stdio.h>

int main()
{
  int input_n, input_m;
  int input_a[1000];
  int cost_sum, max_cost = 0;
  int counter_i, counter_j;

  for( ; ; max_cost = 0)
  {
    scanf("%d %d", &input_n, &input_m);
    if(input_n == 0 && input_m == 0)
      break;

    for(counter_i = 0 ; counter_i < input_n ; counter_i++)
      scanf("%d", &input_a[counter_i]);

    for(counter_i = 0 ; counter_i < input_n ; counter_i++)
    {
      if(input_a[counter_i] >= input_m)
        continue;

      for(counter_j = counter_i + 1 ; counter_j < input_n ; counter_j++)
      {
        if(input_a[counter_j] >= input_m)
          continue;

        cost_sum = input_a[counter_i] + input_a[counter_j];

        if(cost_sum > max_cost && cost_sum <= input_m)
          max_cost = cost_sum;
      }
    }

    if(max_cost == 0)
      printf("NONE\n");
    else
      printf("%d\n", max_cost);
  }
  return 0;
}



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


int main() {
int n,m;
cin >> n >>m;
 
int count = 0;
if(n  > 1 && n%2 == 0){
  count += (n/2*(n-1));
}
else if(n  > 1 && n%2 == 1){
  count += (n*(n-1)/2);
}

if(m  > 1 && m%2 == 0){
  count += (m/2*(m-1));
}
else if(m  > 1 && m%2 == 1){
  count += (m*(m-1)/2);
}



cout << count << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <iterator>
#pragma warning(disable:4996)
 
typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223000000000000000
#define INF 2147000000
#define MOD 1000000007
using namespace std;

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

int main(int argc, char* argv[])
{
    long n;
    scanf("%ld", &n);

    vector<long> a(n);
    long i;
    ll ans=0;
    for(i=0; i<n; i++) {
        scanf("%ld", &a[i]);
        if(i==0) ans=a[i];
        else ans = gcd(ans, a[i]);
    }
    printf("%lld\n", ans);

    return 0;
}


Measured memory_bytes: 1024
class _Node {
  constructor(id, parentId, leftId, rightId) {
    this.id = id;
    this.parentId = parentId;
    this.leftId = leftId;
    this.rightId = rightId;
  }
}

class BinaryTree {
  constructor() {
    this.nodes = [];
  }

  static get Node() {return _Node;}

  get root() { return this.nodes.find(n => n.parentId === -1); }

  add(id, leftId, rightId) { this.nodes[id] = new BinaryTree.Node(id, -1, leftId, rightId); }

  find(id) { return this.nodes[id]; }

  connect() {
    this.nodes.forEach(n => {
      if (n.leftId !== -1) this.nodes[n.leftId].parentId = n.id;
      if (n.rightId !== -1) this.nodes[n.rightId].parentId = n.id;
    });
  }

  preorder(id = this.root.id) {
    if (id === -1) return;
    let n = this.find(id);
    process.stdout.write(` ${id}`);
    this.preorder(n.leftId);
    this.preorder(n.rightId);
  }

  inorder(id = this.root.id) {
    if (id === -1) return;
    let n = this.find(id);
    this.inorder(n.leftId);
    process.stdout.write(` ${id}`);
    this.inorder(n.rightId);
  }

  postorder(id = this.root.id) {
    if (id === -1) return;
    let n = this.find(id);
    this.postorder(n.leftId);
    this.postorder(n.rightId);
    process.stdout.write(` ${id}`);
  }
}

(function main(){
  const lines = require('fs').readFileSync('/dev/stdin', 'utf8').trim().split('\n');
  const n = Number(lines.shift());
  let tree = new BinaryTree();
  lines.map(l => l.split(' ').map(Number)).forEach(line => tree.add(...line));
  tree.connect();
  console.log('Preorder');
  tree.preorder();
  console.log('\nInorder');
  tree.inorder();
  console.log('\nPostorder');
  tree.postorder();
  console.log();
})();



Measured memory_bytes: 16144
#include<iostream>
#include<cstdlib>
#include<queue>
#include<cstdio>
using namespace std;
int v[4][2]={0,1,1,0,0,-1,-1,0};
bool ok[810][810];
int n,m,k;
int nx,ny;
bool vis[810][810];
int ans=1e9;
void bfs()
{
	queue<pair< pair<int,int > ,int > >q;
	q.push(make_pair(make_pair(nx,ny),0));
	vis[nx][ny]=true;
	while(!q.empty())
	{
		int x=q.front().first.first,y=q.front().first.second,w=q.front().second;
		q.pop();
		int res=x-1;
		res=min(res,n-x);
		res=min(res,y-1);
		res=min(res,m-y);
		if((res+k-1)/k+1<ans)ans=(res+k-1)/k+1;
		if(w==k)continue;
		for(int i=0;i<4;i++)
		{
			int xx=x+v[i][0],yy=y+v[i][1];
			if(xx>0 && xx<=n && yy>0 && yy<=m && ok[xx][yy] && !vis[xx][yy])
			{
				vis[xx][yy]=true;
				q.push(make_pair(make_pair(xx,yy),w+1));
			}
		}
	}
}
int main()
{
	scanf("%d%d%d",&n,&m,&k);
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=m;j++)
		{
			char x;
			cin>>x;
			if(x=='.' || x=='S')ok[i][j]=true;
			if(x=='S')
			{
				nx=i;ny=j;
			} 
		}
	}
	bfs();
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 1664
N, T = [int(x) for x in input().split(" ")]
min_t = "TLE"
for _ in range(N):
    c, st = [int(x) for x in input().split(" ")]
    if st > T:
        continue
    if min_t == "TLE" or min_t > c:
        min_t = c
print(min_t)


Measured memory_bytes: 2940
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <tuple>
#include <cassert>

using namespace std;

#define all(c) (c).begin(), (c).end()
#define iter(c) __typeof((c).begin())
#define cpresent(c, e) (find(all(c), (e)) != (c).end())
#define tr(c, i) for (iter(c) i = (c).begin(); i != (c).end(); ++i)
#define pb(e) push_back(e)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define mp(a,b) make_pair((a), (b))
#define mt(a,b,c) make_tuple((a),(b),(c))

typedef long long ll;

long long int gcd(long long int x,long long int y){
    long long int r;
    if(x == 0 || y == 0)  return 0;
    while((r = x % y) != 0) 
    {
         x = y;
        y = r;
    }
    return y;
}

int main(){
    int t; cin >> t;
    rep(i,t){
        ll a,b,c,d; cin >> a >> b >> c >> d;
        if(a < b || d < b){cout << "No" << endl; continue;}
        if(b <= c){cout << "Yes" << endl; continue;}
        if(b == 1){cout << "Yes" << endl; continue;}
      	if(d % b == 0 && a % b > c){cout << "No" << endl; continue;}
        else if(d % b == 0){cout << "Yes" << endl; continue;}
        d = d % b;
        ll gc = gcd(b , d);
        if(b-c-1 >= gc){cout << "No" << endl; continue;}
        if((c%gc) < a%gc){cout << "No" << endl; continue;}
      
		cout << "Yes" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int inf = 1e9 + 7;
const ll longinf = 1LL << 60;
const ll mod = 1e9 + 7;

int main() {
    string S;
    cin >> S;
    if(S[0] == S[1] && S[1] == S[2])
        cout << "No";
    else
        cout << "Yes";
    return 0;
}


Measured memory_bytes: 256
N=int(input())
s=list(input())
t=[list(input()) for i in range(N-1)]
u=[]
for i in s:
    for k in range(N-1):
        if i not in t[k]:
            break
    else:
        for j in range(N-1):
            t[j].remove(i)
        u.append(i)    
print("".join(sorted(u)))    

Measured memory_bytes: 3444
#include <iostream>
#include <iomanip>
#include <string>
#include <cmath>
#include <numeric>
#include <climits>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <functional>
#include <utility>
////////////////////////////////////////////////
#define REP(i, n) for (int i = 0; i < (int)n; i++)
#define FOR(i, m, n) for (int i = (int)m; i < (int)n; i++)
#define REPvec(itr, mp) for (auto itr = mp.begin(); itr != mp.end(); itr++)
#define REPe(e, mp) for (auto& e : mp)
#define all(x) x.begin(), x.end()
////////////////////////////////////////////////
using namespace std;
using ll = long long int;
using vecint = vector<int>;
using vecll = vector<ll>;
using vec2int = vector<vector<int>>;
using P = pair<int, int>;
const ll MOD = 1000000007;  // 1e9+7
////////////////////////////////////////////////
////////////////////////////////////////////////
int main() {
  ////////////////////////////////////////////////
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  ////////////////////////////////////////////////
  int n;
  cin >> n;
  vecint a(n * n, 0);
  REPe(e, a) {
    cin >> e;
    --e;
  }
  vec2int cost(n, vecint(n, 0));
  vec2int exist(n, vecint(n, 1));
  REP(i, n) {
    REP(j, n) { cost[i][j] = min({i, j, n - i - 1, n - j - 1}); }
  }
  const int dx[4] = {+1, -1, 0, 0};
  const int dy[4] = {0, 0, +1, -1};
  auto isin = [&](int i, int j) -> bool {
    return (0 < i && i < n && 0 < j && j < n);
  };
  int ans = 0;
  REPe(e, a) {
    int i = e / n;
    int j = e % n;
    ans += cost[i][j];
    exist[i][j] = 0;
    queue<P> q;
    q.push({i, j});
    while (!q.empty()) {
      P p = q.front();
      q.pop();
      if (exist[p.first][p.second] == 0) {
        REP(k, 4) {
          int x = p.first + dx[k];
          int y = p.second + dy[k];
          if (!isin(x, y)) continue;
          if (cost[x][y] > cost[p.first][p.second]) {
            cost[x][y] = cost[p.first][p.second];
            q.push({x, y});
          }
          // if (cost[p.first][p.second] > cost[x][y]) {
          //   cost[p.first][p.second] = cost[x][y];
          //   q.push(p);
          // }
        }
      } else {
        REP(k, 4) {
          int x = p.first + dx[k];
          int y = p.second + dy[k];
          if (!isin(x, y)) continue;
          if (cost[p.first][p.second] + 2 <= cost[x][y]) {
            cost[x][y] = cost[p.first][p.second] + 1;
            q.push({x, y});
          }
        }
      }
    }
    // REP(i, n) {
    //   REP(j, n) { cout << cost[i][j] << " "; }
    //   cout << ": ";
    //   REP(j, n) { cout << exist[i][j] << " "; }
    //   cout << endl;
    // }
    // cout << endl;
  }
  cout << ans << endl;
}
//////////////////////////////////////////////


Measured memory_bytes: 6080
import math
N,K = map(int,input().split())
A = list(map(int,input().split()))
mod = 10**9+7

count_inner = 0
for i in range(N):
    for j in range(i,N):
        if A[i] > A[j]:
            count_inner += 1
count_outer = 0
for i in range(N):
    for j in range(N):
        if A[i] > A[j]:
            count_outer += 1
def fact(n):
    if n>1:
        return n*fact(n-1)%mod
    else:
        return 1

answer = (count_inner*K + count_outer*K*(K-1)//2)%mod

print(answer)

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

int main()
{
	string s;
	cin >> s;
	sort(s.begin(), s.end());
	puts(s[0] == s[1] && s[1] != s[2] && s[2] == s[3] ? "Yes" : "No");
	return 0;
}


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

using namespace std;

int main(void)
{
    int x;
    cin >> x;
    int a, b;
    int ok = false;
    for(int i = 120; i >= -119 ; i--){
        for(int j = i - 1; j >= -120; j--){
            if(pow(i, 5) - pow(j, 5) == x){
                a = i, b = j;
                ok = true;
                break;
            }
            if(pow(i, 5) - pow(j, 5) > 1000000000)  break;
        }
        if(ok)  break;
    }
    cout << a << " " << b << endl;
    return 0;
}

Measured memory_bytes: 4048
A, B, C, D = [int(v) for v in input().split()]


def gcd(x, y):
    if x > y:
        x, y = y, x
    if x == 0:
        return y
    return gcd(y % x, x)


def calc(l, r, x):
    tmp = r // x - l // x
    if l % x == 0:
        tmp += 1
    return tmp


ccnt = calc(A, B, C)
dcnt = calc(A, B, D)
g = gcd(C, D)
cdcnt = calc(A, B, (C // g) * (D // g) * g)
print(B - A + 1 - (ccnt + dcnt - cdcnt))


Measured memory_bytes: 3064
#include<stdio.h>  
#include <iostream>
#include<stdlib.h>

using namespace std;

int main(){
    string s;
    cin >> s;
    for(char c: s) {
        if(c == '9') {
            cout << '1';
        }
        else if(c == '1') {
            cout << '9';
        }
        else cout << c;
    }    
}


Measured memory_bytes: 256
//** aman**/
#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define pii         pair<ll,ll>
#define vi          vector<ll>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define dl          double
#define hell        1000000007
#define endl        '\n'
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define lb lower_bound
#define ub upper_bound
#define bs          binary_search
#define ios         ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
using namespace std;
int main(){
	ios;
	cout<<fixed<<setprecision(10);
	int n;cin>>n;
	dl dp[n+1][n+1],a[n+1];
	for(int i=1;i<=n;i++)cin>>a[i];
	dp[1][0]=(1.0-a[1]);
	dp[1][1]=a[1];
	for(int i=2;i<=n;i++){
		for(int j=0;j<=i;j++){
			if(j==0)dp[i][0]=dp[i-1][0]*(1.0-a[i]);
			else{
				dp[i][j]=dp[i-1][j-1]*a[i]+dp[i-1][j]*(1.0-a[i]);
			}
		}
	}
	int nn=n/2;
	dl ans=0.0;
	for(int i=nn+1;i<=n;i++){
		ans=ans+dp[n][i];
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 70272
a = input()
b = input()
c = input()
d = int()
e = int()

if int(a) > int(b):
  d = int(a)
else:
  d = int(b)

e = int(c) // d
  
if int(c) % d != 0:
  e = e+1

print(e)

  

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

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

  int sum=0;

  for(int i=0; i<N; i++){
    int start,end;
    cin>>start>>end;

    sum += end-start+1;
  }

  cout<<sum<<endl;

  return 0;
}    

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
using namespace std;
#define int long long
#define all(arr) arr.begin(),arr.end()
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define vi vector<int>
#define vstr vector<string>
#define vbool vector<bool>
#define vvi vector<vector<int> >
#define mii map<int,int>
#define pb push_back
#define pii pair<int,int>
#define vpair vector<pii > 
#define mkp make_pair
#define scan(a,n) for(int i =0 ; i<n ; i++) cin>>a[i]
#define print(a,n) for(int i = 0 ; i < n ; i++) {cout<<a[i]<<' ';}cout<<'\n'
#define mem(a,v) memset(a,v,sizeof(a))
#define loop(i,a,b) for (int i = a; i < b; i++)
#define loope(i,a,b) for (int i = a; i <= b; i++)
#define FastIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define PRECISION std::cout.unsetf ( std::ios::fixed );std::cout.precision(9)
#define PI 3.14159265
#define S second
#define F first
#define CHECK cout<<"CHEDEDWB"<<endl
#define br '\n'
/*int mod = 1e9+7;
int inf = 1e18;
int m_inf = INT_MIN;
int MOD = 100001;*/

void solve()
{
	int n;
	cin>>n;
	vi arr(n);
	scan(arr,n);
	int p = arr[0];
	loop(i,1,n)
		p = p^arr[i];
	loop(i,0,n)
	{
		int q = arr[i]^p;
		cout<<q<<" ";
	}
	cout<<endl;
}

int32_t main()
{
	FastIO; PRECISION;
	int t = 1;
	//cin>>t;
	while(t--)
		solve();
	return 0;
}

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

int main() {
  double r;
  double circumference, area;

  cin >> r;

  circumference = r * r * M_PI;
  area = 2 * M_PI * r;

  printf("%lf %lf\n", circumference, area);
}

Measured memory_bytes: 1236
#include <bits/stdc++.h>
#define rep(i, to) for (int i = 0; i < (to); ++i)
#define repf(i, from, to) for (int i = (from); i < (to); ++i)
#define unless(cond) if (!(cond))
using namespace std;
using ll = long long;
template <typename T>
using V = vector<T>;
template <typename T, typename U>
using P = pair<T, U>;

int main() {
  int n;
  string s;

  cin >> n >> s;

  int west_reverse_count = 0;
  int east_reverse_count = 0;
  rep(i, s.size()) {
    if(s[i] != 'W') {
      east_reverse_count++;
    }
  }

  int min_reverse_count = n;
  rep(i, s.size()) {
    if(s[i] != 'W') {
      east_reverse_count--;
    }
    min_reverse_count = min(min_reverse_count, west_reverse_count + east_reverse_count);
    if(s[i] != 'E') {
      west_reverse_count++;
    }
  }

  cout << min_reverse_count << endl;
}


Measured memory_bytes: 3900
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
#include <iomanip>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<long double> VD;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<VD> VVD;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

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

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }
#define INF 1LL<<60

int N, K;
int xwin(int a) {
    if(a >= K) return 0;
    int ans = ceil(log2(double(K) / a));
    return ans;
}

int main() {
    cin >> N >> K;
    double ans = 0;
    FOR(a, 1, N) {
        int x = xwin(a);
        ans += (1.0 / N) * pow(0.5, x);
    }
    printf("%.16f\n", ans);
    return 0;
}

Measured memory_bytes: 4048
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include<set>
#include<map>
using namespace std;


int main() {
    string a;
    cin >> a;
    if(a[0] == '9' or a[1] == '9'){
        cout << "Yes";
    }
    else{
        cout << "No";
    }   
    cout << endl;
}


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

using namespace std;

#define INF 1000000007
#define LINF (1LL << 62)
#define PI 3.14159265358979

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

inline i64 mod(i64 a, i64 m) { return (a % m + m) % m; }

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



int a,b,c, k;
void solve(){
	cin >> a >> b >> c >> k;
	
	while(a>=b){
		b*=2;
		k--;
	}
	while(b>=c){
		c*=2;
		k--;
	}
	if(k >= 0) cout << "Yes" << endl;
	else cout << "No" << endl;
}

int main(){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	int t = 1;
	//cin >> t;
	while(t--){
		solve();
	}
	
	return 0;
}

Measured memory_bytes: 3648
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <deque>
#include <queue>
#include <array>
#include <set>
#include <map>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <cassert>
#include <utility>
#include <functional>
#include <bitset>
#include <cstdint>

using namespace std;
using i64 = int64_t;
using i32 = int32_t;
template<class T, class U> void init_n(vector<T>& v, size_t n, U x) 
{ v = vector<T>(n, x); }
template<class T> void init_n(vector<T>& v, size_t n) { init_n(v, n, T()); }
template<class T> void read_n(vector<T>& v, size_t n, size_t o = 0) 
{ v = vector<T>(n+o); for (size_t i=o; i<n+o; ++i) cin >> v[i]; }
template<class T> void read_n(T a[], size_t n, size_t o = 0)
{ for (size_t i=o; i<n+o; ++i) cin >> a[i]; }
template<class T> T gabs(const T& x) { return max(x, -x); }
#define abs gabs

i64 n;
vector<i64> l;
int main() {
  cin >> n;
  read_n(l, 2 * n);
  sort(begin(l), end(l));
  i64 ans = 0;
  for (i64 i = 0; i < n; ++i) ans += l[2 * i];
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 256
from collections import deque
import sys
from collections import defaultdict
input = sys.stdin.readline



H, W = map(int, input().split())
C = [list(input()) for i in range(H)]
INF = 10 ** 9
go = [[1, 0], [0, 1], [-1, 0], [0, -1]]
que = deque()
ans  = -1
for sx in range(W):
    for sy in range(H): # スタート地点のループ
        if C[sy][sx]  == "#":
            continue
        dist = [[-1 for _ in range(W)] for _ in range(H)]
        que.append((sy,sx))
        dist[sy][sx] = 0
        while que:
            y,x = que.popleft()
            for temp in go:
                gx,gy = temp
                nx = x + gx
                ny = y + gy
                if 0<= nx < W and 0<= ny < H and C[ny][nx] != "#":
                    if dist[ny][nx] == -1: # ここの更新にminはいらない(幅優先なので自明に最短距離を進む)
                        dist[ny][nx] = dist[y][x] + 1
                        que.append( (ny,nx))
        for temp in dist:
            cand = max(temp)
            ans = max(ans,cand)
print(ans)





Measured memory_bytes: 3316
#include <stdio.h>



int check(int);


int main(){
  int N,i,a;
  int count=0;
  scanf("%d",&N);
  
  for(i=0;i<N;i++){
    scanf("%d",&a);
    if(check(a))count++;
  }
  
  printf("%d\n",count);
  
  return 0;
}

int check (int x){
  int i;
  
  if(x<=1)return 0;
  
  for(i=2;i*i<=x;i++){
    if(x%i==0)return 0;
  }
  return 1;
}

Measured memory_bytes: 596
n = int(input())
dList = list(map(int,input().split()))

sD = sum(dList)/n
ig = int(sD)
po = sD-int(sD)

ad = 0
if abs(po) >= 0.5:
  if sD >= 0:
    ad = ig + 1
  else:
    ad = ig -1
else:
  ad = ig

result = 0
for i in range(len(dList)):
  result += (dList[i]-ad)**2

print(result)


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

using namespace std;
const int maxn = 1e5+10;

int n, x;
int niz[maxn];

int main() {
    scanf("%d%d", &n, &x);
    for (int i = 0; i < n; i++)
        scanf("%d", niz+i);
    sort(niz, niz+n);

    int kol = 0;
    for (int i = 0; i < n; i++) {
        if (niz[i] <= x) kol++, x -= niz[i];
    }

    if (kol == n && x > 0) kol--;
    printf("%d\n", kol);
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<queue>
#include<map>
using namespace std;
const int N=2e6+6;
int n,m,cnt,nod;
map<int,int>head[N/10];
bool vis[N],vss[N];
struct Edge{
    int to,nxt,id,c;
}e[N];
namespace graph{
    struct edge{
        int to,nxt;
    }e[N];
    int head[N],cnt,dep[N];
    queue<int>q;
    inline void addedge(int u,int v){
        e[++cnt]=(edge){v,head[u]},head[u]=cnt;
        e[++cnt]=(edge){u,head[v]},head[v]=cnt;
    }
    int work(){
        dep[1]=1;
        for(q.push(1);!q.empty();){
            int u=q.front();q.pop();
            for(int i=head[u];i;i=e[i].nxt)
            if(!dep[e[i].to]){
                dep[e[i].to]=dep[u]+1;
                q.push(e[i].to);
            }
        }
        return dep[n]?dep[n]/2:-1;
    }
    void clear(int u){
        for(int i=head[u];i;i=e[i].nxt)vss[e[i].to]=0;
    }
}
void dfs(int now,int c){
    vss[now]=1;
    graph::addedge(nod,now);
    for(int i=head[now][c];i;i=e[i].nxt)if(!vis[e[i].id]){
        vis[e[i].id]=1;
        if(!vss[e[i].to])dfs(e[i].to,c);
    }
}
int main(){
    ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
    cin>>n>>m;nod=n;
    for(int i=1;i<=m;++i){
        int u,v,c;
        cin>>u>>v>>c;
        e[++cnt]=(Edge){v,head[u][c],i,c},head[u][c]=cnt;
        e[++cnt]=(Edge){u,head[v][c],i,c},head[v][c]=cnt;
    }
    for(int i=1;i<=cnt;i+=2)if(!vis[e[i].id]){
        ++nod;
        dfs(e[i].to,e[i].c);
        graph::clear(nod);
    }
    cout<<graph::work()<<'\n';
    return 0;
}

Measured memory_bytes: 47152
N = int(input())
ans = [0] * N
for i in range(1, N + 1):
    c = 0  # 割れた回数
    q = i  # 割る元の数
    while q % 2 == 0:  # 2で割り切れなくなるまでループ
        q = q // 2
        c += 1
    ans[i - 1] = c

print(ans.index(max(ans)) + 1)

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

using namespace std;

int main(){
	int n;
	cin >> n;
	for(int i=1;i<=n;i++){
		int x=i;
		if( x%3==0){
			cout << " " << i;
			continue;
		}
		while(x){
			if(x%10==3){
				cout << " " << i;
				break;
			}
			x/=10;
		}
	}
	cout << endl;

	return 0;
}

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

#define STR_HIT ("HIT")
#define STR_OUT ("OUT")
#define STR_HR  ("HOMERUN")
#define STR_NUM (3)

typedef struct {
	char *str_p;
	int  cmd_id;
} CMD_T;

typedef struct {
	int		str_num;
	CMD_T	n[STR_NUM];
}TAG_T;

TAG_T recd={STR_NUM,
                    STR_HIT,1,
					STR_OUT,2,
					STR_HR ,3};


typedef struct {
	int rui[3];
	int score;
	int out;
}SCORE_T;

SCORE_T score;


int main()
{
	int i,n,cmd,j,k,sum,p;
	char inp[96];

	/**--init --**/
	/**--inpot--**/
	gets(inp);
	sscanf(inp,"%d",&n);

for (i=0 ; i<n ; i++) {
	memset(&score,'\0',sizeof(score));
	for (j=0 ;; j++) {
		gets(inp);

		for (cmd=0,k=0 ; k<recd.str_num ; k++){
			if (strcmp(inp,recd.n[k].str_p)==0) {
				cmd = recd.n[k].cmd_id;
				break;
			}
		}
		if (cmd == 0){
			printf("ERROR\n");
			break;
		}

		/**-- CALC --**/
		switch(cmd) {
		case 1: //HIT
			if (score.rui[2]!=0) { //3????????°??????????????´???
				score.rui[2]=0;
				score.score++;
			}
			if (score.rui[1]!=0) { //2????????°??????????????´???
				score.rui[1]=0;
				score.rui[2]=1;
			}
			if (score.rui[0]!=0) { //1????????°??????????????´???
				score.rui[0]=0;
				score.rui[1]=1;
			}
			score.rui[0]=1;
			break;
		case 2: //OUT
			score.out++;
			break;
		case 3: //HOME_RUN
			for (sum=p=0 ; p<3 ; p++) {
				sum += score.rui[p];
				score.rui[p] = 0;
			}
			score.score += sum + 1;
			break;
		default:
			printf("ERROR2\n");
		}
		if (score.out >= 3) {
				break;
		}

	}
	printf("%d\n",score.score);
}
return 0;
}

Measured memory_bytes: 604
#include<iostream>
#include<string>
#include<sstream>
#include<cmath>
using namespace std;
int main(){
  string b;
  int sum=0,num=0,s=0;
  while(cin >> b){
    for(int i=0;i<b.size();i++) if(b[i]==',') b[i]=' ';
    stringstream ss(b);
    int a,c;
    ss >> a >> c;
    sum+=a*c;num+=c;s++;
  }
  cout << sum << endl;
  cout << round((double) num/s) << endl;
}

Measured memory_bytes: 1300
#!/usr/bin/env python

# -*- coding: utf-8 -*-



s = input()

if len(s) % 2 == 0:
    number = s[len(s) // 2]
    other = s[len(s) // 2 - 1]
    p = len(s) // 2
    cnt = 0
    if number == other:
        cnt += 1
        for i in range(1, p):
            if s[p + i] == s[p - 1 - i] == number:
                cnt += 1
            else:
                break
    print(p + cnt)


else:
    number = s[len(s) // 2]
    cnt = 0
    p = len(s) // 2

    for i in range(1, len(s) // 2 + 1):
        if s[p - i] == s[p + i] == number:
            cnt += 1
        else:
            break
    print(p + 1 + cnt)


Measured memory_bytes: 3188
N=int(input())
A=list(map(int,input().split()))


dict_A={}
B=list(set(A))
sum=0


for a in A:
    if a not in dict_A.keys():
        dict_A[a]=1
    else:
        dict_A[a]+=1
for b in B:
    sum+=dict_A[b]*(dict_A[b]-1)//2

for a in A:
    print(sum-dict_A[a]+1)

        

Measured memory_bytes: 28604
#include<stdio.h>

int main()
{
	int i,n=0;
	char str[4];
	scanf("%s",str);
	for(i=0;i<4;i++)
	{
		if(str[i]=='+')n++;
		if(str[i]=='-')n--;
	}
	
	printf("%d",n);
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define FOR0(i,n) for(ll i=0;i<n;i++)
#define FOR1(i,n) for(ll i=1;i<=n;i++)
#define FORl(i,l,n) for(ll i=l;i<n;i++)
using namespace std;
#define pi pair<ll,ll>
#define pb push_back
#define ll long long
#define ld long double
#define ff first
#define ss second
#define mp make_pair
#define mst0(x) memset(x,0,sizeof(x));
#define vi vector<ll>
#define sync ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl '\n'
#define sp <<" "<<
#define intmax 1e14
ll power(ll num,ll g,ll mod){
  if(g==0)return 1;
  if(g%2==1)return (num*power((num*num)%mod,g/2,mod))%mod;
  return power((num*num)%mod,g/2,mod);
}
int const N = 1e5 + 2;
ll dp[N], mx = -1;
vector<int> vec[N];

ll dfs(ll node){
	if(dp[node]) 
		return dp[node];
	for(auto x : vec[node]) dp[node] = max(dp[node], 1 + dfs(x));
	return dp[node];
}

int main(){
	sync
	ll n, m;
	cin>>n>>m;
	FOR0(i, m){
		ll u,v; cin>>u>>v;
		vec[u].push_back(v);
	}
	FOR1(i, n+1) mx = max(mx, dfs(i));
	cout<<mx<<"\n";
	return 0;
}

Measured memory_bytes: 7936
#include<stdio.h>
int main()
{
	long long n,m,a[200009],b[200009],c[300000],i;
	scanf("%lld%lld",&n,&m);
	    for(i=1;i<=m;i++)
	    {
	      scanf("%lld%lld",&a[i],&b[i]);
	        if(a[i]==1&&b[i]!=n)
			c[b[i]]=1;
	    }	
				    for(i=1;i<=m;i++)
					
	     	         {
				        if(b[i]==n&&c[a[i]]==1)
				          {
						  printf("POSSIBLE\n");
	     	              return 0;
						   }
				     }
				 
	printf("IMPOSSIBLE\n");
	return 0;
}

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

int main() {
    int H, W;
    int h, w;
    cin >> H >> W >> h >> w;
    int black = h * W + w * H - h * w;
    cout << H * W - black << endl;
}

Measured memory_bytes: 256
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */

#include <bits/stdc++.h>
#define all(v) (v).begin(),(v).end()
using namespace std;

class DStringFormation {
 public:
  void solveOne(std::istream &in, std::ostream &out) {
    bool back = true;
    deque<char> q;
    string s;
    in >> s;
    for (char c : s)q.push_back(c);
    int Q;

    in >> Q;
    for (int i = 0; i < Q; ++i) {
      int x, y;
      char t;
      in >> x;
      if (x == 1) {
        back = !back;
      } else {
        in >> y >> t;

        if (y == 1) {

          if (!back)q.push_back(t);
          else q.push_front(t);
        } else {
          if (back)q.push_back(t);
          else q.push_front(t);
        }

      }
    }

    vector<char> v(all(q));
    if (!back)reverse(all(v));
    for (char c : v)out << c;
    out << endl;

  }
  void solve(std::istream &in, std::ostream &out) {
    int nt = 1;
    for (int i = 0; i < nt; ++i)
      solveOne(in, out);
  }
};

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  DStringFormation solver;
  std::istream &in(std::cin);
  std::ostream &out(std::cout);
  solver.solve(in, out);
  return 0;
}

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

using namespace std;
#define all(a)a.begin(),a.end()
using ll=long long;
const int INF = 1<<30;
const ll INFll =1LL<<62;
const int mod= int(1e9)+7;
using P = pair<ll,ll>;
using ld=long double;

int main(){
   int n;cin >>n;
   ll ans=1;
    for (int i = 0; i < n; ++i) {
        ans*=(i+1);
        ans%=mod;
    }
    cout <<ans <<endl;
}


Measured memory_bytes: 3528
#include<bits/stdc++.h>
using namespace std;
#define int int64_t
#define pii pair<int,int>
#define rep(i,n) for(int i = 0;i < (n);++i)
#define reps(i,n) for(int i = 1;i <= (n);++i)
#define all(x) (x).begin(),(x).end()
#define Fixed fixed << setprecision(10)
constexpr int INF = 0x3f3f3f3f;
constexpr long long LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr long long mod = 1000000007;
 
template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    int red = 0,blue = 0;
    rep(i,s.size()){
        red += (s[i] == '0');
        blue += (s[i] == '1');
    }
    cout << min(red,blue) * 2 << '\n';
    return 0;
}

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

int main()
{
  i64 n, m;
  cin >> n >> m;
  queue<i64> que[10];
  for (i64 _ = 0; _ < m; _++)
  {
    i64 s;
    cin >> s;
    if (s == 0)
    {
      i64 lane;
      cin >> lane;
      cout << que[lane - 1].front() << endl;
      que[lane - 1].pop();
    }
    else
    {
      i64 car;
      cin >> car;
      i64 p = 0, c = 1e9;
      for (i64 i = 0; i < n; i++)
        if (que[i].size() < c)
        {
          p = i;
          c = que[i].size();
        }
      que[p].push(car);
    }
  }
  return 0;
}



Measured memory_bytes: 3232
x = int(input())
result = 0

if x <= 599:
    result = 8
elif x <= 799:
    result = 7
elif x <= 999:
    result = 6
elif x <= 1199:
    result = 5
elif x <= 1399:
    result = 4
elif x <= 1599:
    result = 3
elif x <= 1799:
    result = 2
else:
    result = 1

print(result)

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

using ll = long long;
using ld  = long double;
using pint = pair<int, int>;
using pll = pair<ll, ll>;
using pld = pair<ld, ld>;
const int INF=1e9+7;
const ll LINF=9223372036854775807;
const ll MOD=1e9+7;
const ld PI=acos(-1);
const ld EPS = 1e-10; //微調整用（EPSより小さいと0と判定など）

int ii() { int x; if (scanf("%d", &x)==1) return x; else return 0; }
long long il() { long long x; if (scanf("%lld", &x)==1) return x; else return 0; }
string is() { string x; cin >> x; return x; }
char ic() { char x; cin >> x; return x; }
void oi(int x) { printf("%d ", x); }
void ol(long long x) { printf("%lld ", x); }
void od_nosp(double x) { printf("%.15f", x); } // 古い問題用
void od(double x) { printf("%.15f ", x); }
// long doubleで受け取り、fをLfなどに変えて出力すると、変な数値が出る
// それをなんとかするには独自の出力を作らなければならなそう
void os(const string &s) { printf("%s ", s.c_str()); }
void oc(const char &c) { printf("%c ", c); }
#define o_map(v){cerr << #v << endl; for(const auto& xxx: v){cout << xxx.first << " " << xxx.second << "\n";}} //動作未確認
void br() { putchar('\n'); }

// #define gcd __gcd //llは受け取らない C++17~のgcdと違うので注意
// int lcm(int a, int b){return a / gcd(a, b) * b;}
#define begin_end(a) a.begin(),a.end() //sort(begin_end(vec));
#define REP(i,m,n) for(ll i=(ll)(m) ; i < (ll) (n) ; i++ )
#define rep(i,n) REP(i,0,n)
#define m_p(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define p_b push_back
#define SZ(x) ((int)(x).size) //size()がunsignedなのでエラー避けに


// coutによるpairの出力（空白区切り）
template<typename T1, typename T2> ostream& operator<<(ostream& s, const pair<T1, T2>& p) {return s << "(" << p.first << " " << p.second << ")";}
// coutによるvectorの出力（空白区切り）
template<typename T> ostream& operator<<(ostream& s, const vector<T>& v) {
  int len = v.size();
  for (int i = 0; i < len; ++i) {
    s << v[i]; if (i < len - 1) s << " "; //"\t"に変えるとTabで見やすく区切る
  }
  return s;
}
// coutによる多次元vectorの出力（空白区切り）
template<typename T> ostream& operator<<(ostream& s, const vector< vector<T> >& vv) {
  int len = vv.size();
  for (int i = 0; i < len; ++i) {
    s << vv[i] << endl;
  }
  return s;
}

//最大値、最小値の更新。更新したor等しければtrueを返す
template<typename T>
bool chmax(T& a, T b){return (a = max(a, b)) == b;}
template<typename T>
bool chmin(T& a, T b){return (a = min(a, b)) == b;}

//4近傍（上下左右） rep(i, 2) にすると右・下だけに進む
vector<int> dx_4 = {1, 0, -1, 0};
vector<int> dy_4 = {0, 1, 0, -1};

// -------- template end - //


// - library ------------- //



// --------- library end - //


int main(){

  ll N = il();

  cout << (N % 1000 == 0 ? 0 : 1000 - N % 1000 )<< endl;


}

Measured memory_bytes: 3676
#include<bits/stdc++.h>
#define F first
#define S second
#define ll long long
#define MOD 1000000007

#define fast ios_base::sync_with_stdio(false)
#define itt cin.tie(0)
#define now cout.tie(0)

using namespace std;

ll n;
set <string> s;
string s1;

int main()
{
	cin>>n;
	s.clear();
	for(ll i=0;i<n;i++)
	{
		cin>>s1;
		s.insert(s1);
	}
	cout<<s.size()<<endl;
	return 0;
}


Measured memory_bytes: 19224