akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <unordered_map>
#include <unordered_set>
#include <cstring>
#include <map>
#include <algorithm>
#include <math.h>
#include <iostream>     // std::cout, std::fixed
#include <iomanip>
#include<queue>
#include <cmath>
#include <stack>
#include <queue>
#include <set>
#include <iostream>
#include <sstream>
#include <time.h>
using namespace std;
typedef long long ll;

int main () {
    ios_base::sync_with_stdio(false);
    ll x,y;
    cin>>x>>y;
    if(x%y==0)
    {
        cout<<-1;
        return 0;
    }
    cout<<x;
    
    return 0;
}


Measured memory_bytes: 256
H, W = map(int, input().split())
S = ['' for i in range(H)]
for i in range(H):
  S[i] = input()
R = [[[i, j] for j in range(W)] for i in range(H)]
U = [[1 for j in range(W)] for i in range(H)]
def root(A):
  if R[A[0]][A[1]] == A:
    return A
  else:
    R[A[0]][A[1]] = root(R[A[0]][A[1]])
    return R[A[0]][A[1]]
def union(A, B):
  rA = root(A)
  rB = root(B)
  if rA[0] < rB[0]:
    R[rB[0]][rB[1]] = rA
    U[rA[0]][rA[1]] += U[rB[0]][rB[1]]
  elif rB[0] < rA[0]:
    R[rA[0]][rA[1]] = rB
    U[rB[0]][rB[1]] += U[rA[0]][rA[1]]
  elif rA[1] < rB[1]:
    R[rB[0]][rB[1]] = rA
    U[rA[0]][rA[1]] += U[rB[0]][rB[1]]
  elif rB[1] < rA[1]:
    R[rA[0]][rA[1]] = rB
    U[rB[0]][rB[1]] += U[rA[0]][rA[1]]
for i in range(H):
  for j in range(W):
    if S[i][j] == ".":
      if i > 0 and S[i - 1][j] == "#":
        if j > 0 and S[i - 1][j - 1] == ".":
          union([i, j], [i - 1, j - 1])
        if i > 1 and S[i - 2][j] == ".":
          union([i, j], [i - 2, j])
        if j < W - 1 and S[i - 1][j + 1] == ".":
          union([i, j], [i - 1, j + 1])
      if j > 0 and S[i][j - 1] == "#":
        if i > 0 and S[i - 1][j - 1] == ".":
          union([i, j], [i - 1, j - 1])
        if j > 1 and S[i][j - 2] == ".":
          union([i, j], [i, j - 2])
        if i < H - 1 and S[i + 1][j - 1] == ".":
          union([i, j], [i + 1, j - 1])
      if j < W - 1 and S[i][j + 1] == "#":
        if i > 0 and S[i - 1][j + 1] == ".":
          union([i, j], [i - 1, j + 1])
for i in range(H):
  for j in range(W):
    root([i, j])
cnt = 0
for i in range(H):
  for j in range(W):
    if S[i][j] == "#":
      if i > 0 and S[i - 1][j] == ".":
        r = R[i - 1][j]
        cnt += U[r[0]][r[1]]
      elif i < H - 1 and S[i + 1][j] == ".":
        r = R[i + 1][j]
        cnt += U[r[0]][r[1]]
      elif j > 0 and S[i][j - 1] == ".":
        r = R[i][j - 1]
        cnt += U[r[0]][r[1]]
      elif j < W - 1 and S[i][j + 1] == ".":
        r = R[i][j + 1]
        cnt += U[r[0]][r[1]]
print(cnt)

Measured memory_bytes: 22792
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i=0;i<(n);++i)

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	string s;cin >> s;
	string t=s;
	reverse(t.begin(),t.end());
	rep(i,t.size()){
		if(t.at(i)=='b') t.at(i)='d';
		else if(t.at(i)=='d') t.at(i)='b';
		else if(t.at(i)=='p') t.at(i)='q';
		else if(t.at(i)=='q') t.at(i)='p';
	}
	if(s==t) cout << "Yes" << endl;
	else cout << "No" << endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
using namespace std;
using namespace __gnu_pbds;
typedef long long int ll;
 
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

 
 
const ll N = 515;
const ll mod = 998244353;
const long long int inf = 1e10+5;
#define pp pair<ll,ll>
 
typedef long double ld;
typedef vector<pp> vpl;
#define MP make_pair
#define endl "\n"
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep1(i,n) for(ll i=1;i<n;i++)
#define rrep(i,n) for(ll i=n-1;i>=0;i--)
#define repb(i,n) for(ll i=1;i<n-1;i++) 
#define trace(i,a) for(auto i=a.begin();i!=a.end();i++) 
#define mtrace(i,a) for(auto i=a.begin();i!=a.end();i++)  cout<<i->first<<" "<<i->second<<endl;   
void fastIO(void);
 
void decimal(int);
ll modmulti(ll, ll);
ll modadd(ll, ll);
ll modpower(ll, ll);
ll gcd(ll, ll );
ll modinv(ll);





int main(){
   // fastIO();
  
  ll n,m;
  cin>>n>>m;
  ll p[m+1];
  string s[m+1];
  string cr = "AC", wr = "WA";
  ll solved[n+1];
  rep1(i,n+1) solved[i] = 0;
  rep1(i,m+1){
      cin>>p[i]>>s[i];
  }
  ll pel = 0;
  ll wa[n+1];
  rep1(i,n+1) wa[i] = 0;
  rep1(i,m+1){
      if(solved[p[i]]==1) continue;
      if(s[i][0]=='A') solved[p[i]] = 1;
      else wa[p[i]]++;
  }
  ll urr = 0;
  rep1(i,n+1){
      if(solved[i]){ urr++;
      pel = pel+wa[i];}
  }
  cout<<urr<<" "<<pel<<endl;

  






   

}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
void fastIO(void)
{  ios_base::sync_with_stdio(false);
   cin.tie(0);
   cout.tie(0);
}
 
void decimal(int n){
   cout<<fixed;
   cout<<setprecision(n);
}
ll modmulti(ll a, ll b){
   return ((a%mod)*1ll*(b%mod))%mod;
}
ll modadd(ll a, ll b){
   ll asdfgh =  ((a%mod)+(b%mod)+mod+mod)%mod;
   asdfgh = (asdfgh+mod)%mod;
   return asdfgh;
}
ll modpower(ll a, ll n){
   if(n==0) return 1;
   if(n==1) return a%mod;
   ll b = modpower(a,n/2);
   b = modmulti(b,b);
   if(n%2==0) return b;
   return modmulti(a,b);
}
ll gcd(ll a, ll b){
   if(b==0)
      return a;
   return gcd(b,a%b);
}
ll modinv(ll a){
   return modpower(a,mod-2);
}
 

Measured memory_bytes: 8064
import std.stdio, std.string, std.conv;
import std.range, std.algorithm, std.array, std.math;


void main() {
    int n, x;
    scan(n, x);

    if (x == 1 || x == 2*n - 1) {
        writeln("No");
        return;
    }

    writeln("Yes");

    auto ans = new int[](2*n - 1);
    ans[] = -1;

    if (n == 2) {
        ans = iota(1, 4).array;
    }
    else {
        auto used = new bool[](2*n - 1 + 1);

        if (x != 2*n - 2) {
            ans[n - 1] = x;
            ans[n - 2] = 1;
            ans[n - 3] = 2*n - 1;
            ans[n] = 2*n - 2;
            used[x] = used[1] = used[2*n - 1] = used[2*n - 2] = 1;
        }
        else {
            ans[n - 1] = x;
            ans[n - 2] = 2*n - 1;
            ans[n - 3] = 1;
            ans[n] = 2;
            used[x] = used[1] = used[2*n - 1] = used[2] = 1;
        }

        int num = 1;

        foreach (i ; 0 .. 2*n - 1) {
            if (ans[i] != -1) continue;
            while (used[num]) num++;
            ans[i] = num++;
        }
    }

    writefln("%(%s\n%)", ans);
}



void scan(T...)(ref T args) {
    import std.stdio : readln;
    import std.algorithm : splitter;
    import std.conv : to;
    import std.range.primitives;

    auto line = readln().splitter();
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}



void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}


Measured memory_bytes: 4348
using System;
using CompLib.Util;

public class Program
{

    public void Solve()
    {
        var sc = new Scanner();
        string s = sc.Next();
        int ans = 0;
        foreach (var c in s)
        {
            if (c == '+') ans++;
            else ans--;
        }

        Console.WriteLine(ans);
    }

    public static void Main(string[] args) => new Program().Solve();
}

namespace CompLib.Util
{
    using System;
    using System.Linq;

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

        public Scanner()
        {
            _line = new string[0];
            _index = 0;
        }

        public string Next()
        {
            while (_index >= _line.Length)
            {
                _line = Console.ReadLine().Split(Separator);
                _index = 0;
            }

            return _line[_index++];
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            _line = Console.ReadLine().Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}

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

int main( void ) {
    ios::sync_with_stdio( false );
    cin.tie(); cout.tie();
    
    long long n, a, b;
    cin >> n >> a >> b;
    
    if( a > b || ( n == 1 && a != b ) )
        cout << 0;
    else
    if( ( n == 1 && a == b ) || n == 2 )
        cout << 1;
    else
        cout << b * (n - 1) + a - ( a * (n - 1) + b ) + 1;

    return 0;
}


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

#include <vector>
#include <algorithm>

using namespace std;

int main(void)
{
	int w, n;

	cin >> w;
	cin >> n;

	vector<pair<int, int>> intersection(n);

	for(int i = 0; i < n; i++){
		scanf("%d,%d", &intersection[i].first, &intersection[i].second);
	}

	for(int i = 1; i <= w; i++){
		int r = i;
		for_each(intersection.rbegin(), intersection.rend(),
				[&r](const pair<int, int>& x){
					if(x.first == r){
						r = x.second;
					}else if(x.second == r){
						r = x.first;
					}
				}
		);
		cout << r << endl;
	}

	return 0;
}

Measured memory_bytes: 1236
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

string s;
bool same;

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin >> s;
    sort(s.begin(), s.end());
    char cur = s[0];
    for(int i=1; i<s.length(); i++) {
        if(cur!=s[i]) cur = s[i];
        else same = true;
    }
    if(!same)cout<<"yes";
    else cout<<"no";

    return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const long long maxn=200010LL;
long long n,d,a,xx,yy,res=0LL,pre[maxn];
pair<long long,long long> v[maxn];
long long num(long long x)
{
	long long ans=x/a;
	if(x%a) ++ans;
	return ans;
}
int main()
{
	cin>>n>>d>>a;
	for(long long i=1LL;i<=n;i++) cin>>v[i].first>>v[i].second;
	sort(v+1LL,v+1LL+n);
	v[n+1]=make_pair(1e18,1e18);
	for(long long i=1LL;i<=n;i++)
	{
		pre[i]+=pre[i-1];
		long long di=v[i].second-pre[i];
		if(di<=0LL) continue;
		long long tmp=v[i].first+2*d; 
		long long ind=upper_bound(v+1LL,v+2LL+n,make_pair(tmp+1,0LL))-v-1;
		long long tim=num(di);
		res+=tim;
		long long att=tim*a;
		pre[i]+=att;
		pre[ind+1]-=att;
	}
	cout<<res<<endl;
	return 0;
}

Measured memory_bytes: 4992
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <numeric>
#include <map>
#include <utility>
using namespace std;
#define ll long long
#define rep(i,l,r) for(ll i=(l);i<(r);i++)
int main(void){
#define int long long
    int n,a,b;
    cin>>n>>a>>b;
    if(a>b){
        cout<<0;
        return 0;
    }
    if(n==1&&a-b){
        cout<<0;
        return 0;
    }
    cout<<((n-1)*b+a-(n-1)*a-b+1)<<endl;
    return 0;
}

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

int main(){
  int N,K;
  cin >> N >> K;
  string S;
  cin >> S;
  if(S.at(K-1) == 'A'){
    S.at(K-1) = 'a';
  }
  else if(S.at(K-1) == 'B'){
    S.at(K-1) = 'b';
  }
  else{
    S.at(K-1) = 'c';
  }
  cout << S << endl;
}

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

int main() {
  int n;
  cin >> n;
  vector<int> a(n - 1);
  rep(i, n - 1) cin >> a[i];

  vector<int> ans(n, 0);
  rep(i, n - 1) {
    ans[a[i] - 1] += 1;
  }

  rep(i, n) cout << ans[i] << endl;

  return 0;
}


Measured memory_bytes: 4776
#include <iostream>
#include <array>
#include <algorithm>
#include <vector>
#include <bitset>
#include <set>
#include <unordered_set>
#include <cmath>
#include <complex>
#include <deque>
#include <iterator>
#include <numeric>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <limits>
#include <iomanip>
#include <functional>
#include <cassert>
using namespace std;

using ll=long long;
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
#define ALL(v) v.begin(),v.end()
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; }
#define DEBUG_VLL(vec) for(int sz=0;sz<int(vec.size());sz++) std::cerr<<vec[sz]<<(sz==vec.size()-1?'\n':' ');

const long long MOD = 1000000007;
const long long HIGHINF = (long long)1e18;
const int INF = (int)1e9;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s; cin >> s;
    int ds = 0;
    for (int i = 0; i < int(s.size()); i++) ds += int(s[i] - '0');
    if (ds % 9 == 0) cout << "Yes\n";
    else cout << "No\n";
    return 0;
}


Measured memory_bytes: 3796
#include <cstdio>
#include <cstring>
#include <string>
#include <cmath>
#include <cassert>
#include <iostream>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <bitset>
#include <fstream>
using namespace std;

#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
typedef long long ll;

#define INF 1000000000
#define ST 540

//int t[10000][1000];

int main(){
    int n,m;
    while(cin>>n>>m, n|m){
        vector<vector<int> > t(m, vector<int>(750, 0));
//        fill(t[0], t[10000], 0);
        int r;
        cin>>r;
        rep(i,r){
            int ti,a,b,s;
            scanf("%d %d %d %d\n", &ti, &a, &b, &s);
            if(s==0) t[b-1][ti-ST] += -1;
            else t[b-1][ti-ST] += 1;
        }

        // imosu
        rep(i, m){
            rep(j,725){
                t[i][j+1] += t[i][j];
            }
        }

        int q;
        cin>>q;
        rep(i,q){
            int s,e,a;
            scanf("%d%d%d",&s,&e,&a);
            s-=ST; e-=ST;
            int res=0;
            for(int j=s; j<e; j++){
                if(t[a-1][j]>0) res++;
            }
            cout<<res<<endl;
        }
    }
    return 0;
}

Measured memory_bytes: 29888
#include <stdio.h>

void f(int n) {
	int x;
	if(n<1) return;
	scanf("%d", &x);
	f(n-1);
	printf("%d ", x);
}

int main() {
	int n, x;
	scanf("%d\n%d", &n, &x);
	f(n-1);
    printf("%d\n", x);
}


Measured memory_bytes: 2688
#include <bits/stdc++.h>
#define PB push_back
#define MP make_pair
#define REP(i,n) for (int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define ALL(a) (a).begin(),(a).end()
#define MOD 10000
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
const ull B=100000007;
const int INF=1e9;
int main(){
      int n,a,ans=0;
      cin>>n;
      REP(i,n){
            cin>>a;
            bool f=false;
            for(int x=1;x*x<a;x++)if((a+x+1)%(2*x+1)==0){
                  f=true;break;
            }
            if(!f)ans++;
      }
      cout<<ans<<endl;
}

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

#define ll long long int
#define tenseventh 10000000
ll table[tenseventh+100];
ll N;
int main(){
    cin>>N;
    for(ll i=1;i<=tenseventh;i++){
        for(ll j=0;j<=tenseventh;j+=i){
            table[j]++;
        }
    }
    ll res=0;
    for(ll i=1;i<=N;i++){
        res+=i*table[i];
    }
    cout<<res<<endl;
}

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

import io
import sys
import math

def format_multi_line_answer(lst):
    ans = ""
    ans += f"{len(lst)}\n"  # Line count
    for y in lst:
        ans += f"{y}\n"
    return ans

def solve(n,k_set):
    # implement process
    for i in range(n, sys.maxsize):
        s = set(str(i))
        # 交差をチェックする
        if s & k_set == set():
            return i

def main():
    # input
    n,k = map(int, input().split())
    # k_lst = set(map(int, input().split()))
    k_set = set(input().split())

    # process
    ans = str( solve(n,k_set) )
    
    # output
    print(ans)
    return ans
        
### DEBUG I/O ###
_DEB = 0   # 1:ON / 0:OFF

_INPUT = """\
1000 8
1 3 4 5 6 7 8 9
"""
_EXPECTED = """\
2000

"""

def logd(str):
    """usage:
    if _DEB: logd(f"{str}")
    """
    if _DEB: print(f"[deb] {str}")

### MAIN ###
if __name__ == "__main__":
    if _DEB:
        sys.stdin = io.StringIO(_INPUT)
        print("!! Debug Mode !!")

    ans = main()

    if _DEB:
        print()
        if _EXPECTED.strip() == ans.strip(): print("!! Success !!")
        else: print(f"!! Failed... !!\nANSWER:   {ans}\nExpected: {_EXPECTED}")

Measured memory_bytes: 9128
import java.util.Scanner;

public class Main{
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    char[] ramen = s.toCharArray();
    int cost = 700;

    if (ramen[0]=='o'){
      cost += 100;
    }
    if (ramen[1]=='o'){
      cost += 100;
    }
    if (ramen[2]=='o'){
      cost += 100;
    }
    System.out.println(cost);
  }
}


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

using namespace std;

#define EACH(i,a) for (auto& i : a)
#define FOR(i,a,b) for(int i=(int)a;i<(int)b;++i)
#define RFOR(i,a,b) for(int i=(int)b-1;i>=(int)a;--i)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(a) (a).begin(),(a).end()
#define debug(x) cerr << #x << ":" << x << endl;
#define OK(ok) cout << (ok ? "1" : "0") << endl;
typedef long long ll;

void CINT(){}
template <class Head,class... Tail>
void CINT(Head&& head,Tail&&... tail) {
  cin >> head; CINT(move(tail)...);
}
#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)
#define LCIN(...) ll __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)

const int INF = 1e9 + 1;
const int MOD = 1e9 + 7;
const int MAX_N = 1e5 + 1;

struct UnionFind {
  vector< int > par;
  UnionFind(int n = 1) {
    init(n);
  }

  void init(int n) {
    par.resize(n);
    for(int i = 0; i < n; i++)
      par[i] = -1;
  }
  
  int root(int n) {
    if (par[n] < 0) return n;
    return par[n] = root(par[n]);
  }

  bool unite(int x, int y) {
    x = root(x); y = root(y);
    if (x == y) return false;
    if (par[x] > par[y]) swap(x, y);
    par[x] += par[y];
    par[y] = x;

    return true;
  }
};

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

  CIN(N, Q);
  UnionFind uf(N + 1);
  REP(qi, Q) {
    CIN(c, x, y);
    if (c == 0) {
      uf.unite(x, y);
    } else {
      // judge
      OK(uf.root(x) == uf.root(y));
    }
  }
  

  return 0;
}




Measured memory_bytes: 3276
#include <algorithm>
#include <cmath>
#include <iostream>

using namespace std;

int main() {

	int c[3];

	while(cin >> c[0] >> c[1] >> c[2]) {
		if(!c[0]&&!c[1]&&!c[2]) {
			break;
		}
		sort(c, c+3);
		double R=sqrt(pow((double)c[0], 2)+pow((double)c[1], 2));

		int n;
		cin >> n;
		while(n) {
			int r;
			cin >> r;
			cout << (2*r>R ? "OK" : "NA") << endl;
			n--;
		}
	}

	return 0;

}

Measured memory_bytes: 0
#include<iostream>
#include<cstdio>
#include<cmath>
#include<string>
#include<deque>
#include<algorithm>
using namespace std;
//#define int long long

signed main(){
        deque<int> primes{2};

        for(int i=3;i<1000000;i+=2){
                for(unsigned int j=0;j<primes.size();j++){
                        if(primes[j]*primes[j]>i){
                                primes.push_back(i);
                                break;
                        }
                        if(i%primes[j]==0){
                                break;
                        }
                }
        }

        int a;
        while( scanf("%d", &a) != EOF ){
                cout<<distance(primes.begin(), upper_bound(primes.begin(),primes.end(),a))<<endl;
        }

        //int n;
        //scanf("%lld",&n);
        //for(int i=0;i<n;i++){}

        return 0;
}

Measured memory_bytes: 3404
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
	/*#ifndef ONLINE_JUDGE
	freopen("input.txt","r", stdin);
	freopen("output.txt","w", stdout);
	freopen("error.txt","w", stderr);
	#endif*/
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	
	int n;
	cin>>n;
	int dig = 0;
	while(n > 0)
	{
		dig = n%10;
		if(dig == 7) {
			cout<<"Yes\n";
			return 0;
		}
		n = n/10;
	}
	cout<<"No\n";
	return 0;
}

Measured memory_bytes: 3640
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define sqr(x) ((x)*(x))
#define mp make_pair
#define uint unsigned
inline char gc(){
    static char buf[100000],*p1=buf,*p2=buf;
    return p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;
}
#define gc getchar
inline int read(){
	int x = 0; char ch = gc(); bool positive = 1;
	for (; !isdigit(ch); ch = gc())	if (ch == '-')	positive = 0;
	for (; isdigit(ch); ch = gc())	x = x * 10 + ch - '0';
	return positive ? x : -x;
}
inline void write(int a){
    if(a>=10)write(a/10);
    putchar('0'+a%10);
}
inline void writeln(int a){
    if(a<0){
    	a=-a; putchar('-');
	}
	write(a); puts("");
}
const int N=15;
int n,m,sum,in[1<<N],e[N][N];
int dp[1<<N][N];
int main(){
	n=read(); m=read();
	for(int i=1;i<=m;i++){
		int x=read()-1,y=read()-1,z=read();
		e[x][y]=z; e[y][x]=z;
		sum+=z;
	}
	for(int i=0;i<(1<<n);i++){
		for(int j=0;j<n;j++)if(i>>j&1){
			for(int k=j+1;k<n;k++)if(i>>k&1)in[i]+=e[j][k];
		}
	}
	for(int i=0;i<(1<<n);i++)for(int j=0;j<n;j++)dp[i][j]=-1e9;
	for(int i=0;i<(1<<n);i++){
		if(i&1)dp[i][0]=in[i];
		for(int j=1;j<n;j++){
			for(int k=(i-1)&i;k;k=(k-1)&i){
				int kk=i^k; 
				if((kk>>j&1))for(int l=0;l<n;l++)if((k>>l&1)&&e[j][l]){
					//if(dp[k][l]+e[l][j]+in[kk]==sum-91274&&j==14)cout<<k<<" "<<l<<" "<<j<<endl;
					dp[i][j]=max(dp[i][j],dp[k][l]+e[l][j]+in[kk]);
				}
			}
		}
	}
	cout<<sum-dp[(1<<n)-1][n-1]<<endl;
}

Measured memory_bytes: 2304
#include <bits/stdc++.h>
using namespace std;
string N;
int main() {
    cin >> N;
    int slen = N.length();
    long long n = stoll(N);
    long long sum = 0;
    for(int i = 0; i < slen; ++i) {
        sum += N.at(i) - '0';
    }
    if(n % sum == 0) {
        cout << "Yes" << endl;
    }else {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
def main():
	n = int(input())
	lst = {}
	for _ in range(n):
		temp = input()
		if temp in lst:
			lst[temp] = lst[temp]+1
		else:
			lst[temp] = 1
	m = int(input())
	for _ in range(m):
		temp = input()
		if temp in lst:
			lst[temp] = lst[temp] - 1
	ans = 0
	for i in lst:
		ans = max(lst[i], ans)
	print(ans)

main()

Measured memory_bytes: 3060
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
char s[6666],s2[6666];

int main(){
	int l,i,top=0;
	
	cin>>s;
	
	l=strlen(s);
	
	for (i=0; i<l; i++){
		if (s[i]=='B'){
			if (top>0) top--;
		}
		else {
			s2[++top]=s[i];
		}
	}
	for (i=1; i<=top; i++){
		cout<<s2[i];
	}
	
	cout<<endl;
	
	return 0;
}

Measured memory_bytes: 256
#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 <cassert>
#include <sstream>
#include <fstream>

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

using namespace std;
typedef long long unsigned int ll;

int main() {
  int N, A, B;
  cin >> N >> A >> B;

  cout << min(A, B) << " " << max(0, A + B - N) << endl;
  return 0;
}

Measured memory_bytes: 256
//omajinai c++
#include <iostream>
#include<cmath>
#include<vector>
#include <algorithm>
#include <limits>
#include <numeric>
#include <type_traits>
#include <map>
#include <string>
#include <iomanip>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define itn int
using ll = long long;
constexpr auto mod = 1000000007;
using namespace std;
int main() {
string s;
  cin>>s;
  int i;
 for( i=0;i<s.size();i++){
   if(i%2==0&&s[i]!='h'){
   //  cout<<'a';
     break;
   }
   else if(i%2==1&&s[i]!='i'){
  // cout<<'b';
     break;
   }
 }
 // cout<<i<<endl;
  if(i==s.size()&&s.size()%2==0){
    cout<<"Yes";
  }
  else{
    cout<<"No";
  }
}


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

int h, w;
vector <vector <int>> a;

int main() {
    cin >> h >> w;
    a = vector <vector <int>> (h,vector <int> (w));

    map <pair <int, int>, int> kisu;
    int cntkisu = 0;
    rep (i, h) rep (j, w) {
        cin >> a[i][j];
        if (a[i][j] % 2 == 1) kisu[make_pair(i, j)] = 1, cntkisu++;
    }
    cntkisu -= (cntkisu % 2 == 1);

    vector <vector <int>> ope;

    int cnt = 0;
    bool ido = false;
    bool flag = false;
    rep (i, h) {
        int j  = (i % 2 == 0 ? 0 : w - 1),
            op = (i % 2 == 0 ? 1 : -1);
        for (; 0 <= j && j < w; j += op) {
            if (ido) {
                ope.back().push_back(i);
                ope.back().push_back(j);
                ido = false;
                if (kisu.count(make_pair(i, j))) {
                    flag = false;
                    continue;
                }
            }
            if (flag == false) {
                if (cnt >= cntkisu) continue;
                if (kisu.count(make_pair(i, j))) {
                    cnt += 2;
                    flag = true;
                    ope.push_back(vector <int>());
                    ope.back().push_back(i);
                    ope.back().push_back(j);
                    ido = true;
                }
            }
            else {
                ope.push_back(vector <int> ());
                ope.back().push_back(i);
                ope.back().push_back(j);
                ido = true;
            }
        }
    }

    cout << ope.size() << endl;
    for (auto i : ope) cout << i[0] + 1<< " "
                            << i[1] + 1<< " "
                            << i[2] + 1<< " "
                            << i[3] + 1<< endl;


    return 0;
}

Measured memory_bytes: 25520
//#pragma GCC optimize ("O3")
//#pragma GCC target ("avx")
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

constexpr int bm = 2500;
ll BIT[50][bm];
int zero[50];
void add(int A, int gin, ll co) {
	co = 4e12 - co;
	while (gin > 0) {
		if (BIT[A][gin] >= co) break;
		BIT[A][gin] = co;
		gin -= gin & -gin;
	}
}
ll query(int A, int gin) {
	ll kotae = 0;
	while (gin < bm) {
		kotae = max(BIT[A][gin], kotae);
		gin += gin & -gin;
	}
	return 4e12 - kotae;
}

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


	int N, M, S;
	cin >> N >> M >> S;
	if (S >= 2460) S = 2460;

	vector<ll> E[50];
	rep(i, M) {
		int u, v, a;
		ll b;
		cin >> u >> v >> a >> b;
		u--;
		v--;
		b = a << 8 | b << 16;
		E[u].pb(v | b);
		E[v].pb(u | b);
	}
	int C[50], D[50];
	rep(i, N) {
		cin >> C[i] >> D[i];
	}

	add(0, S + 1, 0);
	priority_queue<ll, vector<ll>, greater<ll> > PQ;
	PQ.push(S + 1);
	ll zenbu = 0;
	ll owari = (1ll << N) - 1;

	while (PQ.size()) {
		auto p = PQ.top();
		PQ.pop();
		ll ti = p >> 18;
		int i = p >> 12 & 63;
		int gin = p & 4095;

		if (ti > query(i, gin)) continue;

		ll ti2 = ti + D[i];
		int gin2 = gin + C[i];
		if (gin2 > 2460) gin2 = 2460;
		if (ti2 < query(i, gin2)) {
			add(i, gin2, ti2);
			PQ.push(ti2 << 18 | i << 12 | gin2);
		}

		for (auto pp : E[i]) {
			int to = pp & 255;
			ti2 = ti + (pp >> 16);
			gin2 = gin - (pp >> 8 & 255);
			if (gin2 > 0) {
				if (ti2 < query(to, gin2)) {
					add(to, gin2, ti2);
					PQ.push(ti2 << 18 | to << 12 | gin2);
				}
			}
		}
		zenbu |= 1ll << i;
		if (zenbu == owari) break;
	}

	for (int i = 1; i < N; i++) {
		co(query(i, 1));
	}



	Would you please return 0;
}

Measured memory_bytes: 4668
#include <iostream>

int main(void){
  int n;
  int o[100];

  std::cin>>n;
  for(int i=0;i<n;i++){
    std::cin >> o[i];
  }

  int s=0;

  for(int i=0;i<n-1;i++){
    for(int j=i+1;j<n;j++){
      s += o[i]*o[j];
    }
  }

  std::cout << s;
  
  return 0;
}


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

int main() {
    std::string s1,s2;
    int n = 0;
    std::cin >> s1;
        
    while(std::cin >> s2){
        if(s2 == "END_OF_TEXT")
            break;
        std::transform(s1.begin(), s1.end(), s1.begin(), ::toupper);
        std::transform(s2.begin(), s2.end(), s2.begin(), ::toupper);
        if(s1 == s2)
            n++;
    }
    std::cout << n << std::endl;
      
    return 0;
}

Measured memory_bytes: 3216
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
using ll = long long;
constexpr ll mod = 1e9 + 7;
constexpr ll INF = 1LL << 60;

#define REP(i, init, n) for(int i = (int)(init); i < (int)(n); i++)

#define vi vector<int>
#define vl vector<long>
#define vvi vector<vector<int>>
#define vvl vector<vector<long>>
#define pint pair<int, int>
#define plong pair<long, long>

int main() {
    int t;
    cin >> t;
    REP(i, 0, t){
        ll n, m, a, b;
        cin >> n >> m >> a >> b;
        cout << floor_sum(n, m, a, b) << endl;
    }
}

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

using namespace std;

#define ll 			long long
#define db			double
#define up(i,j,n)		for (int i = j; i <= n; i++)
#define down(i,j,n)	for (int i = j; i >= n; i--)
#define cadd(a,b)		a = add (a, b)
#define cpop(a,b)		a = pop (a, b)
#define cmul(a,b)		a = mul (a, b)
#define pr			pair<int, int>
#define fi			first
#define se			second
#define SZ(x)		(int)x.size()
#define bin(i)		(1 << (i))
#define Auto(i,node)	for (int i = LINK[node]; i; i = e[i].next)

template<typename T> inline bool cmax(T & x, T y){return y > x ? x = y, true : false;}
template<typename T> inline bool cmin(T & x, T y){return y < x ? x = y, true : false;}

const int MAXN = 2e5 + 5;

int N, K, a[MAXN], num[MAXN], top = 0, c[MAXN], ord[MAXN];

bool cmp(int x, int y){return c[x] < c[y];}

int main(){
	scanf("%d%d", &N, &K);
	up (i, 1, N) {
		scanf("%d", &a[i]);
		num[++top] = a[i];
	}
	sort(num + 1, num + top + 1);
	top = unique(num + 1, num + top + 1) - (num + 1);
	up (i, 1, N) a[i] = lower_bound(num + 1, num + top + 1, a[i]) - num;
	up (i, 1, N) c[a[i]]++;
	up (i, 1, top) ord[i] = i;
	sort(ord + 1, ord + top + 1, cmp);
	int ans = 0;
	up (i, 1, top - K) ans += c[ord[i]];
	printf("%d\n", ans);
	return 0;
}


Measured memory_bytes: 3328
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int y = sc.nextInt();
		if (x < y) {
			System.out.println("a < b");
		}else if(x > y){
			System.out.println("a > b");
		}else {
				System.out.println("a == b");
			}
		}
	}

Measured memory_bytes: 17160
using System;
using System.Linq;//リストの使用
using System.Collections.Generic;
using System.Text;//テキストの高速出力に必要
class Program
{
	static void Main()
	{
		string[] input = Console.ReadLine().Split(' ');//Splitで区切り文字を指定して複数個受け取る。
		long n = long.Parse(input[0]);
		long h = long.Parse(input[1]);
    long[] attacks = new long[n];
    long maxAttack = 0;
    long answer = 0;
    for(long i = 0; i < n; i++)
    {
      long[] nums = Array.ConvertAll(Console.ReadLine().Split(' '),long.Parse);
      maxAttack = Math.Max(nums[0],maxAttack);
      attacks[i] = nums[1];
    }

    Array.Sort(attacks);
    Array.Reverse(attacks);

    for(int i = 0; i < n; i++)
    {
      if(attacks[i] > maxAttack)
      {
        h -= attacks[i];
        answer++;
        if(h <= 0) break;
      }else break;
    }

    if(h > 0)
    {
      answer += (h+maxAttack-1)/maxAttack;
    }
    
		Console.WriteLine(answer);
	}
}

Measured memory_bytes: 16056
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <queue>
#include <set>
#include <stack>
#include <map>
#include <unordered_map>
#include <cmath>
#include <utility> // pair make_pair
#include <algorithm>
#include <functional>
#include <iomanip>
#include <numeric>
#include <climits> // LLONG_MAX, LLONG_MIN, INT_MIN, INT_MAX
#include <assert.h>

#define m0(x) memset(x,0,sizeof(x))
#define m1(x) memset(x,63,sizeof(x))
#define fill(x,y) memset(x,y,sizeof(x))
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define chmin(x, y) x = min(x, y)
#define ll long long
#define ld long double
#define int ll
#define INF INT_MAX/10
#define MOD 1000000007

using namespace std;
using Pi = pair<int, int>;
using Graph = vector<vector<int> >;
using WeightGraph = vector<vector<Pi> >;

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

vector<string> field;

/* if bfs

   queue<pair<int, int> > que
   que.push(start x, start y);

   int dist[x][y];
   memset(dist, -1, sizeof(dist));
   dist[start x][start y] = 0;
*/


// int N; cin >> N;
// field.resize(N);
const int MAX = 670000;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for (int i = 2; i < MAX; i++){
    fac[i] = fac[i - 1] * i % MOD;
    inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
    finv[i] = finv[i - 1] * inv[i] % MOD;
  }
}

// 二項係数計算
long long COM(int n, int k){
  if (n < k) return 0;
  if (n < 0 || k < 0) return 0;
  return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

// int main() {
//   // 前処理
//   COMinit();

//   // 計算例
//   cout << COM(100000, 50000) << endl;
// }
signed main() {
  int X, Y; cin >> X >> Y;
  int N = (X+Y) / 3;

  int C = 2 * N - X;

  COMinit();
  if ((X+Y) % 3 != 0) {
    cout << 0 << endl;
  } else {
    cout << COM(N, C) << endl;
  }
  
  // int ans = 0;
  // queue<pair<int,int >> que;
  // map<pair<int,int >, int> T;
  // que.push(make_pair(0, 0));
  // T[make_pair(0, 0)] = 1;
  // while (!que.empty()) {
  //   Pi top = que.front(); que.pop();
  //   int x1 = top.first + 2;
  //   int y1 = top.second + 1;
  //   T[make_pair(x1, y1)] += T[top] % MOD;
  //   T[make_pair(x1, y1)] %= MOD;
  //   int x2 = top.first + 1;
  //   int y2 = top.second + 2;
  //   T[make_pair(x2, y2)] += T[top] % MOD;
  //   T[make_pair(x2, y2)] %= MOD;
  //   if (x1 <= X && y1 <= Y)     que.push(make_pair(x1, y1));
  //   if (x2 <= X && y2 <= Y)     que.push(make_pair(x2, y2));
  // }
  // cout << T[make_pair(X, Y)] << endl;
}


Measured memory_bytes: 16000
#include<iostream>
#include<vector>
#include<cstdio>
#include<queue>
#include<map>
using namespace std;
struct edge{
  int to,cost;
};
int d[100];
vector<vector<struct edge> >E(100);
void dijkstra(int s){
  priority_queue<pair<int,int>,vector<pair<int,int> >,greater<pair<int,int> > >que;
  for(int i=0;i<100;i++)
    d[i]=1000000000;
  d[s] = 0;
  que.push(pair<int,int>(0,s));
  while(!que.empty()){
    pair<int,int> p=que.top();que.pop();
    int v = p.second;
    if(d[v]<p.first)continue;
    for(int j=0;j<E[v].size();j++){
      edge t = E[v][j];
      if(d[t.to]>d[v]+t.cost){
	d[t.to]=d[v]+t.cost;
	que.push(pair<int,int>(d[t.to],t.to));
      }
    }
  }
}

int main(){
  int n,m;cin>>n>>m;
  for(int i=0;i<m;i++){
    int a,b,c,d;scanf("%d,%d,%d,%d",&a,&b,&c,&d);
    struct edge A,B;
    A.to=b;A.cost=c;B.to=a;B.cost=d;
    E[a].push_back(A);E[b].push_back(B);
  }
  int s,g,V,P;
  scanf("%d,%d,%d,%d",&s,&g,&V,&P);
  int ans=V-P;
  dijkstra(s);
  ans-=d[g];
  //cout<<d[g]<<endl;
  dijkstra(g);
  ans-=d[s];
  // cout<<d[s]<<endl;
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 3216
fn read<T: std::str::FromStr>() -> T {
  let mut s = String::new();
  std::io::stdin().read_line(&mut s).ok();
  s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
  read::<String>().split_whitespace()
    .map(|e| e.parse().ok().unwrap()).collect()
}

fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
  (0..n).map(|_| read_vec()).collect()
}

fn main() {
  let a: i8 = read();
  let b: i8 = read();

  let num: Vec<i8> = [1, 2, 3].to_vec();

  let mut ans: i8 = 0;
  for n in num {
    if (a != n && b != n) {
      ans = n;
      break;
    }
  }
  println!("{}", ans);
}

Measured memory_bytes: 4352
#include <algorithm>
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <string>
#include <sstream>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cmath>
#include <bitset>
 
using namespace std;
bool hasSearched[100][100000];
int dp[100][100000];
int v[100] = {0};
int w[100] = {0};
int N;

void init(){
	for(int i = 0; i < 100; i++){
		for(int j = 0; j < 100000; j++){
			hasSearched[i][j] = false;
		}
	}
}

int solve(int i,int U){
	if(i == N){
		return 0;
	}else if(U < w[i]){
		return solve(i+1,U);
	}
	if(hasSearched[i][U] == true) return dp[i][U];
	int res1,res2;
	res1 = solve(i+1,U-w[i]) + v[i];
	res2 = solve(i+1,U);
	dp[i][U] = max(res1,res2);
	hasSearched[i][U] = true;
	return max(res1,res2);
}

int main()
{
	init();
	int W;
	cin>>N>>W;
	for(int i = 0; i < N; i++){
		cin>>v[i]>>w[i];
	}
	cout<<solve(0,W)<<endl;
	return 0;
}


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

#define fst(t) std::get<0>(t)
#define snd(t) std::get<1>(t)
#define thd(t) std::get<2>(t)
#define unless(p) if(!(p))
#define until(p) while(!(p))

using ll = std::int64_t;
using P = std::tuple<int,int>;

int D;

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

    std::cin >> D;

    std::cout << "Christmas";

    int t = 25 - D;
    for(int i=0;i<t;++i){
        std::cout << " Eve";
    }

    std::cout << std::endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <math.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rrep(i, n) for(int i = (n-1); i >= 0; i--)
using namespace std;
typedef long long ll;
const int MOD = 1000000007;
const ll INF = 1LL<<60;
const int IINF = 1000000000;
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; }

struct UnionFind {
	vector<int> d;

	UnionFind(int N=0) : d(N, -1){} 

	int find(int x) {
		if (d[x] < 0) return x;
		return d[x] = find(d[x]);
	}

	bool unite(int x, int y) {
		x = find(x); 
		y = find(y); 
		if (x == y) return false;
		if (d[x] > d[y]) swap(x,y);
		d[x] += d[y];
		d[y] = x; 
		return true;
	}

	bool same(int x, int y) {
		return find(x) == find(y);
	}

	int size(int x){
		return -d[find(x)];
	}
};

int main(){
	int N, M, K; cin >> N >> M >> K;
	UnionFind uf(N);
	vector<vector<int>> AB(N);
	rep(i,M){
		int a, b; cin >> a >> b;
		a--;b--;
		AB[a].push_back(b);
		AB[b].push_back(a);

		uf.unite(a,b);
	}

	vector<vector<int>> CD(N);
	rep(i,K){
		int c,d; cin >> c >> d;
		c--;
		d--;
		CD[c].push_back(d);
		CD[d].push_back(c);
	}

	rep(i,N){
		int ans = uf.size(i) - 1 - AB[i].size();
		for(auto cd : CD[i]){
			if (uf.same(i,cd)) ans--;
		}
		printf("%d%c", ans, i==N-1?'\n':' ');
	}
}

Measured memory_bytes: 14676
import java.util.Scanner;

public class Main {

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

		System.out.println((int)Math.ceil((double)(a + b) / 2));


		sc.close();

	}

}


Measured memory_bytes: 35660
#include <bits/stdc++.h>
using namespace std;
#define ll long long
template <typename T>
bool PN(T x){ if (x <= 1) return false; if (x == 2) return true; for (int i = 2; i < sqrt(x) + 1; i++) if (x % i == 0) return false; return true;}
const ll MOD = 1e9+7;
long long Comb(int n, int i){long long ans = 1; if(i == 0 || i == n) return 1; else {for(int j = 1; j <= i; ++j){
      ans *=(n+1-j);
      ans /= j;
      ans %= MOD;} }return ans;}

void solve()
{
  int x, a, b; cin >> x >> a >> b;
  if(b-a <= 0) cout << "delicious" << endl;
  else if(b-a <= x) cout << "safe" << endl;
  else cout << "dangerous" << endl;
}

int main()
{
  solve();
  return 0;
}


Measured memory_bytes: 3600
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define fi first
#define se second
typedef pair<ll,ll> P;
using VP = vector<P>; using VVP = vector<VP>;
using VI = vector<ll>; using VVI = vector<VI>; using VVVI = vector<VVI>;
const int inf=1e9+7;
const ll INF=1LL<<61;
const ll mod=998244353;

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


vector<ll> inv,fact,invfact;
void Mod_build(int n=201010){
	fact.resize(n+1);
	inv.resize(n+1);
	invfact.resize(n+1);
	fact[0]=inv[0]=invfact[0]=1;
	inv[1]=1;
	for(ll i=0;i<n;i++){
		fact[i+1]=fact[i]*(i+1)%mod;
		if(i>0)inv[i+1]=mod-inv[mod%(i+1)]*(mod/(i+1))%mod;
		invfact[i+1]=invfact[i]*inv[i+1]%mod;
	}
}
ll perm(int n,int k){
	if(n<0||k<0||k>n)return 0;
	return fact[n]*invfact[n-k]%mod;
}
ll comb(int n,int k){
	if(n<0||k<0||k>n)return 0;
	return (fact[n]*invfact[n-k]%mod)*invfact[k]%mod;
}
ll powmod(ll n,ll k){
	k%=mod-1;
	if(k<0)k+=mod-1;
	ll ret=1;
	while(k){
		if(k&1)ret=ret*n%mod;
		n=n*n%mod;
		k>>=1;
	}
	return ret;
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int i,j;
    Mod_build();
    ll ans=0;
    ll n,m,k;
    cin>>n>>m>>k;
    for(i=0;i<=k;i++){
        ans += ((comb(n-1,i)*m)%mod)*powmod(m-1,n-i-1)%mod;
        ans %= mod;
    }
    cout<<ans<<endl;

}

Measured memory_bytes: 7928
#include<iostream>
#include <cmath>

int main(void)
{
  int N,K;
  std::cin >> N;
  std::cin >> K;

  int i=1;
  for(i=1;;i++)
  {
	  if(std::pow(K,i)>N)
      {
        break;
      }
  }
  std::cout << i;
    
  return 0;
}

Measured memory_bytes: 256
# Python3 (3.4.3)
import sys
input = sys.stdin.readline

# -------------------------------------------------------------
# function
# -------------------------------------------------------------


# -------------------------------------------------------------
# main
# -------------------------------------------------------------
N = int(input())
A = list(map(int,input().split()))

A.sort(reverse=True)

alice = 0
bob = 0
for i in range(N):
    if i%2==0:
        alice += A[i]
    else:
        bob += A[i]

print(alice - bob)

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

int main() {
	string s, t;
	cin >> s >> t;
	vector<int> sa(26);	// how many each alphabets s has
	vector<int> ta(26);	// how many each alphabets t has
	for (int i = 0; i < 26; i++) {
		sa[i] = 0;
		ta[i] = 0;
	}
	int a = 0;
	for (int i = 0; i < s.length(); i++) {
		a = s[i] - 'a';
		sa[a]++;
		a = t[i] - 'a';
		ta[a]++;
	}
	sort(sa.begin(), sa.end());
	sort(ta.begin(), ta.end());
	bool ok = true;
	for (int i = 0; i < 26; i++) {
		if (sa[i] != ta[i]) ok = false;
	}
	string ans = "Yes";
	if (!ok) ans = "No";

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 776
/*
  AtCoder Beginner Contest 092
  A - Traveling Budget
*/

#include<iostream>
using namespace std;

int A, B, C, D;

int main() {
  scanf("%d%d%d%d", &A, &B, &C, &D);

  int amount = 0;
  amount += A < B ? A : B;
  amount += C < D ? C : D;

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

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<queue>
#include<cstdlib>
#include<map>
#include<set>
#include<string>
#include<cctype>
#include<cmath>
#include<algorithm>
#define LL long long
#define ULL unsigned long long
#define debug(x) cerr << #x << " = " << x << endl
#define MAXN 3000010
using namespace std;
int read(){
	int x = 0, f = 1; char ch = getchar(); for(; !isdigit(ch); ch = getchar()) if(ch == '-') f = -1;
	for(; isdigit(ch); ch = getchar()) x = x * 10 + ch - '0'; return x * f;
}

int n;

int main(){
	n = read();
	printf("ABC%d\n", n);
	return 0;
}

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

int r[2010][2010]={};
int l[2010][2010]={};
int u[2010][2010]={};
int d[2010][2010]={};
int main(int argc, char const *argv[])
{
    int h,w;cin>>h>>w;
    vector<string> s(h);
    for(int i=0;i<h;++i)cin>>s[i];

    for(int i=0;i<h;++i){
        for(int j=0;j<w;++j){
            int ii = h-1-i;
            int jj = w-1-j;
            if(s[i][j]=='#'){
                l[i][j]=0;
                u[i][j]=0;
            }
            else
            {
                if(j==0)l[i][0]=1;
                else{
                    l[i][j]=l[i][j-1]+1;
                }
                if(i==0)u[0][j]=1;
                else{
                    u[i][j]=u[i-1][j]+1;
                }
            }
            if(s[ii][jj]=='#'){
                r[ii][jj]=0;
                d[ii][jj]=0;
            }
            else{
                if(ii==h-1)d[h-1][jj]=1;
                else{
                    d[ii][jj]=d[ii+1][jj]+1;
                }
                if(jj==w-1)r[ii][w-1]=1;
                else{
                    r[ii][jj]=r[ii][jj+1]+1;
                }
            }
        }
    }
    int max_val=0;
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            max_val = max(max_val, l[i][j]+r[i][j]+u[i][j]+d[i][j]-3);
        }
    }
    cout << max_val << endl;
    return 0;
}


Measured memory_bytes: 67456
#include<stdio.h>
// #include<math.h>
// #include<stdlib.h>
// #include<string.h>
// #include<stdbool.h>

// #define MOD 998244353

// #define MIN(a,b) ((a)<(b)?(a):(b));
// #define MAX(a,b) ((a)>(b)?(a):(b));

// typedef long long int64;

int main(void){
    int H,W;
    scanf("%d %d",&H,&W);
    int h,w;
    scanf("%d %d",&h,&w);

    printf("%d",(H-h)*(W-w));
    
    
    return 0;
}

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

#define int long long

using namespace std;

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

int dist (pair <int, int> p1, pair <int, int> p2) {
    return min(abs(p1.first - p2.first), abs(p1.second - p2.second));
}

int p[100005];

void init (int n) {
    for (int i = 1; i<=n; i++) {
        p[i] = i;
    }
}

int up (int x) {
    return (p[x] == x ? x : p[x] = up(p[x]));
}

bool isSame(int x, int y) {
    return (up(x) == up(y));
}

void unionSet (int x, int y) {
    if (isSame(x, y)) return;

    p[up(y)] = up(x);
}

signed main(){
    int n;
    scanf("%lld", &n);
    pair <pair <int, int>, int> a[n + 1];

    for (int i = 1; i<=n; i++) {
        int x, y;
        scanf("%lld %lld", &a[i].first.first, &a[i].first.second);
        a[i].second = i;
    }

    init(n + 1);

    sort(a + 1, a + n + 1);

    priority_queue <iii, vector <iii>, greater <iii> > pq;
    for (int i = 2; i<=n; i++) pq.push(make_pair(dist(a[i].first, a[i - 1].first), make_pair(a[i].second, a[i - 1].second)));
    for (int i = 1; i<=n; i++) swap(a[i].first.first, a[i].first.second);

    sort(a + 1, a + n + 1);
    for (int i = 2; i<=n; i++) pq.push(make_pair(dist(a[i].first, a[i - 1].first), make_pair(a[i].second, a[i - 1].second)));

    int cur = n - 1;
    int ans = 0;
    while (cur > 0 && pq.size() > 0) {
        iii u = pq.top(); pq.pop();

        if (isSame(u.second.first, u.second.second)) continue;

        unionSet(u.second.first, u.second.second);
        cur--;
        ans += u.first;
    }

    printf("%lld", ans);
    return 0;
}


Measured memory_bytes: 11632