akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<string>
#include<vector>
#include<math.h>
#include<algorithm>
#include<cstdio>
#include<stdio.h>
#include<stack>
#include<sstream>
#include<iomanip>
#include<map>
#include<unordered_map>
#include<list>
#include<numeric>
typedef long long ll;

#define pi 3.14159265358979323846
#define VI vector<int>
#define VLL vector<long long>
#define MAX max_element
#define MIN min_element
#define all(v) v.begin(), v.end()
const ll MOD = 1e9 + 7;
using namespace std;
template<typename T>
T gcd(T a, T b) {
	return b ? gcd(b, a % b) : a;
}
template<typename T>
T lcm(T a, T b) {
	return a * b / gcd(a, b);
}

template<typename T>
T finder(vector<T> vec, T number) {
	auto itr = find(vec.begin(), vec.end(), number);
	size_t index = distance(vec.begin(), itr);
	if (index != vec.size()) { // 発見できたとき
		return 1;
	}
	else { // 発見できなかったとき
		return 0;
	}
}
ll frac(ll n)
{
	if (n == 0) {
		return 1;
	}
	return (n * frac(n - 1)) % MOD;
}

/*char r[4];
int yaju[4];
char op[3];
int sum = 0;
scanf("%s", r);
for (int i = 0;i < 4;i++) {
	yaju[i] = r[i] - '0';
}
*/
int main() {
	ll N,K; cin >> N>>K;
	VLL A(N);
	for (int i = 0;i < N;i++) cin >> A[i];
	sort(all(A));
	ll lim = 0;
	ll ans = 0;
	for (int i = 1;i < N;i++) {
		if (A[i] != A[0]) lim++;
		if (lim == K-1) {
			ans++;
			lim = 0;
		}
	}
	if (lim > 0) ans++;
	cout << ans << endl;
}

Measured memory_bytes: 1024
from collections import Counter
 
N = int(input())
V = [i for i in input().split()]
 
odd = Counter(V[::2]).most_common(2)
even = Counter(V[1::2]).most_common(2)

if odd[0][0] != even[0][0]:
    print(N - odd[0][1] - even[0][1])
elif len(odd) == 1:
    print(N // 2)
else:
    o0e1 = N - odd[0][1] - even[1][1]
    o1e0 = N - odd[1][1] - even[0][1]
    print(min(o0e1, o1e0))

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

string = ""

for i in range(10**10):
    if n == 0:
        break
    if n % 2 == 1:
        string = "1" + string
        n -= (-1)**(i)
    else:
        string = "0" + string
    n = n // 2

print(string if string != "" else 0)


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

//#define int long long

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

    int t = 1;
    //std::cin >> t;

    while (t--)
    {
        int N;
        std::cin >> N;
        
        int query[3] = {0, 0, 0};
        for ( int i = 0; i < N; i++ )
        {
            int x;
            std::cin >> x;
            query[--x]++;
        }

        double dp[N+1][N+1][N+1];
        dp[0][0][1] = N;

        for ( int n = 2; n <= 3*query[2] + 2*query[1] + query[0]; n++ )
        {
            for ( int i = 0; 3*i <= n; i++ )
            {
                for ( int j = 0; 3*i + 2*j <= n && j <= N; j++ )
                {
                    int k = n - 3*i - 2*j;
                    if ( k > N )
                        continue;
                    double value = N;

                    value += k * dp[i][j][ (k > 0) ? k - 1 : 0];
                    value += j * dp[i][ (j > 0) ? j - 1 : 0][k + 1];
                    value += i * dp[ (i > 0) ? i - 1 : 0][j + 1][k];

                    value /= i + j + k;
                    dp[i][j][k] = value;
                    // std::cout << i << " " << j << " " << k << ": " << value << std::endl;
                }
            }
        }
        std::cout << std::setprecision(13) << dp[query[2]][query[1]][query[0]] << std::endl;
    }

    return 0;

}



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

int main() {
    int a, b; cin >> a >> b;
    if((a+b)%2==0) cout << (a+b)/2 << endl;
    else cout << "IMPOSSIBLE" << endl;
    return 0;
}



Measured memory_bytes: 3588
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long a;
    cin>>a;
    long long sum=0,p=0;

    while(a>0)
    {
        sum+=pow(2,p);
        p++;
        a=a/2;
    }
    cout<<sum<<endl;

}



Measured memory_bytes: 256
#define DREP(i, s, e) for(register int i = s; i >= e ;i--)
#define  REP(i, s, e) for(register int i = s; i <= e ;i++)

#include <algorithm>
#include <iostream>
#include <cstdlib>
#include <cstring>
#include <cstdio>
#include <bitset>
#include <vector>
#include <cmath>
#include <queue>
#include <map>

using namespace std;
const int maxn = 300010;

template <typename T> T read() {
	T ans(0), p(1);
	char c = getchar();
	while (!isdigit(c)) {
		if (c == '-') p = -1;
		c = getchar();
	}
	while (isdigit(c)) {
		ans = ans * 10 + c - 48;
		c = getchar();
	}
	return ans * p;
}
long long n, m, sb;

#define kan pair<long long, long long>
#define a first
#define b second

kan k[maxn];
inline bool cmp(kan a, kan b) {return a.a > b.a;}

int main() {
#ifdef CraZYali
	freopen("d.in", "r", stdin);
	freopen("d.out", "w", stdout);
#endif
	cin >> n >> m;
	REP(i, 1, n) {
		scanf("%lld%lld", &k[i].a, &k[i + n].a);
		k[i].b = 1;k[i + n].b = 0;
	}
	sort(k+1, k + 1 + 2 * n, cmp);
	n *= 2;
	register long long now = 0;
	REP(i, 1, n)
		if (k[i].b == 1) {
			cout << (m % k[i].a == 0 ? m / k[i].a : m / k[i].a + 1) + now;
			return 0;
		}
		else {
			m -= k[i].a;
			now++;
			if ( m <= 0 ) {cout << now << endl;return 0;}
		}
	return 0;
}


Measured memory_bytes: 4352
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cwchar>
#include <cwctype>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#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>
#include <array>
#include <atomic>
#include <chrono>
#include <codecvt>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define rep2(i, n) for(int i = 1; i <= (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#pragma GCC optimize("Ofast")
using namespace std;
typedef int64_t ll;
typedef long double ld;
const ll INF=(1LL<<60);
const ld pi=acosl(1);
const ll mod = 1000000007;
//const ll mod = 998244353;
const int dx[4]={0,1,0,-1};
const int dy[4]={1,0,-1,0};
const int ddx[8]={1,0,-1,-1,-1,0,1,1};
const int ddy[8]={1,1,1,0,-1,-1,-1,0};

void solve(){
  ll a,b;cin>>a>>b;
  cout<<a*b/2<<endl;
}

signed main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);cout<<fixed;
  cout<<setprecision(30);
  solve();
}


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

#define F first
#define S second

typedef double D;
typedef complex<D> P;
typedef pair<P, P> L;
typedef vector<P> VP;
const D EPS = 1e-7;
#define X real()
#define Y imag()
#define LE(n,m) ((n) < (m) + EPS)
#define GE(n,m) ((n) + EPS > (m))
#define EQ(n,m) (abs((n)-(m)) < EPS)
D dot(P a, P b) {return (conj(a)*b).X; }
D cross(P a, P b) {  return (conj(a)*b).Y;}

int ccw(P a, P b, P c) {
  b -= a;  c -= a;
  if (cross(b,c) >  EPS) return +1; //L
  if (cross(b,c) < -EPS) return -1; //R
  if (dot(b,c)   < -EPS) return +2;
  if (norm(b) < norm(c)) return -2;
  return 0;
}

P proj(P a1, P a2, P p) { return a1 + dot(a2-a1, p-a1)/norm(a2-a1) * (a2-a1); }

P crosspointLL(P a1, P a2, P b1, P b2) {
  D d1 = cross(b2-b1, b1-a1);
  D d2 = cross(b2-b1, a2-a1);
  if (EQ(d1, 0) && EQ(d2, 0)) return a1;
  if (EQ(d2, 0)) throw "HiGYAAAAA!!!!!";
  return a1 + d1/d2 * (a2-a1);
}

// p1を基準にpをa度回転
L rot(P p,double a,P p1){
  a=a*M_PI/180.0;  p-=p1;
  D x=p.X*cos(a)+p.Y*(-sin(a))+p1.X;
  D y=p.X*sin(a)+p.Y*cos(a)+p1.Y;
  return L(p1,P(x,y));
}

// segをpにぶつける
L segdon(P p,L seg){
  P a=seg.F , b=seg.S;
  P c=proj(a,b,p);
  P z=crosspointLL(a,b,p,c);
  p-=z; a+=p; b+=p;
  return L(a,b);
}

int n;
VP v;

// off L = 1,R = -1  : zu 回す向き  
bool check(L seg,int id,int off,int zu){
  L p=segdon(v[id],seg);
  return ccw(v[(id+zu+n)%n],p.F,p.S) == off;
}

double calc(L a,L b,L c){
  P x=crosspointLL(a.F,a.S,b.F,b.S);
  P y=crosspointLL(a.F,a.S,c.F,c.S);
  return abs(x-y);
}

signed main(){
  cin>>n;
  for(int i=0;i<n;i++){
    D x,y;
    scanf("%lf%lf",&x,&y);
    v.push_back(P(x,y));
  }
  L ls=rot(v[1],60,v[0]);
  L rs=rot(v[0],-60,v[1]);

  int l=0,r=1;
  while(check(ls,l,1,-1))  l=(l-1+n)%n;
  while(check(rs,r,-1,1)) r=(r+1+n)%n;

  double ans=calc(segdon(v[l],ls),segdon(v[r],rs),L(v[1],v[0]));

  for(int i=n-1;i>0;i--){
    int nex=(i+1)%n;
    ls=rot(v[nex],60,v[i]);
    rs=rot(v[i],-60,v[nex]);

    while(check(ls,l,1,-1))  l=(l-1+n)%n;
    while(check(rs,r,-1,-1)) r=(r-1+n)%n;

    ans=min(ans,calc(segdon(v[l],ls),segdon(v[r],rs),L(v[i],v[nex])));
  }
  printf("%.9f\n",ans);
}


Measured memory_bytes: 3588
from itertools import combinations_with_replacement as cwr
N,M,Q=map(int,input().split())
ABCD=[]
for _ in range(Q):
    ABCD.append(list(map(int,input().split())))
maxscore=0
for comb in cwr(range(1,M+1),N):
    score=0
    for row in ABCD:
        if comb[row[1]-1]-comb[row[0]-1]==row[2]:
            score+=row[3]
    maxscore=max(maxscore,score)
print(maxscore)

Measured memory_bytes: 9136
// AtCoder.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。
//

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;

int main()
{
	int a, p;
	cin >>a >> p;
	cout << (a * 3 +p)/ 2 << endl;
}


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


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

  ll n,c;
  cin >> n >> c;
  ll Diff[c][c];
  rep(i,c) rep(j,c){
    cin >> Diff[i][j];
  }
  int color[n][n];
  rep(i,n) rep(j,n){
    cin >> color[i][j];
    color[i][j]--;
  }

  ll sum[c][3];
  rep(i,c) rep(j,3) sum[i][j]=0;
  rep(l,c){
    rep(i,n) rep(j,n){
      int line=(i+j)%3;
      sum[l][line]+=Diff[color[i][j]][l];
    }
  }
  ll ans=1e15;
  rep(i,c)rep(j,c)rep(k,c){
    if(i==j || j==k || k==i) continue;
    ans=min(ans, sum[i][0]+sum[j][1]+sum[k][2]);
  }
  cout << ans << endl;
  
  return 0;
    

}


Measured memory_bytes: 1280
import std.stdio, std.string, std.conv, std.range;
import std.algorithm, std.array, std.typecons, std.container;
import std.math, std.numeric, std.random, core.bitop;

enum inf = 1_001_001_001;
enum infl = 1_001_001_001_001_001_001L;
enum mod = 1_000_000_007L;

void main() {
    int N, M;
    scan(N, M);
    auto ba = new int[][](M, 0);
    foreach (i ; 0 .. M) {
        ba[i] = readln.split.to!(int[])[1 .. $];
        ba[i][] -= 1;
    }
    auto p = readln.split.to!(int[]);

    int ans;

    foreach (s ; 0 .. 1 << N) {
        bool ok = true;
        foreach (i ; 0 .. M) {
            int tg;
            foreach (sj ; ba[i]) if (s & (1 << sj)) {
                tg ^= 1;
            }
            if (tg != p[i]) {
                ok = false;
                break;
            }
        }
        ans += ok;
    }

    writeln(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);
        }
    }
}

bool chmin(T, U...)(ref T x, U args) {
    bool isChanged;

    foreach (arg; args) {
        if (x > arg) {
            x = arg;
            isChanged = true;
        }
    }

    return isChanged;
}

bool chmax(T, U...)(ref T x, U args) {
    bool isChanged;

    foreach (arg; args) {
        if (x < arg) {
            x = arg;
            isChanged = true;
        }
    }

    return isChanged;
}


Measured memory_bytes: 256
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(10**7)
import bisect
import heapq
import itertools
import math
from collections import Counter, defaultdict, deque
from copy import deepcopy
from decimal import Decimal
from math import gcd
from operator import add, itemgetter, mul, xor
def cmb(n,r,mod):
  bunshi=1
  bunbo=1
  for i in range(r):
    bunbo = bunbo*(i+1)%mod
    bunshi = bunshi*(n-i)%mod
  return (bunshi*pow(bunbo,mod-2,mod))%mod
mod = 10**9+7
def I(): return int(input())
def LI(): return list(map(int,input().split()))
def MI(): return map(int,input().split())
def LLI(n): return [list(map(int, input().split())) for _ in range(n)]

#bisect.bisect_left(list,key)はlistのなかでkey未満の数字がいくつあるかを返す
#つまりlist[i] < x となる i の個数
#bisect.bisect_right(list, key)はlistのなかでkey以下の数字がいくつあるかを返す
#つまりlist[i] <= x となる i の個数
#これを応用することで
#len(list) - bisect.bisect_left(list,key)はlistのなかでkey以上の数字がいくつあるかを返す
#len(list) - bisect.bisect_right(list,key)はlistのなかでkeyより大きい数字がいくつあるかを返す
#これらを使うときはあらかじめlistをソートしておくこと！
n,k = MI()
ans = 0
for i in range(k,n+2):
    ans += i*(n-i+1)%mod + 1
print(ans%mod)


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

#define int long long
#define double long double

using namespace std;

#define REP(i, a, b) for (int(i) = (a); i < (b); (i)++)
#define rep(i, n) REP(i, 0, n)
#define PER(i, a, b) for (int(i) = (a - 1); i >= (b); (i)--)
#define per(i, n) PER(i, n, 0)
#define each(i, n) for (auto &i : n)
#define clr(a) memset((a), 0, sizeof(a))
#define mclr(a) memset((a), -1, sizeof(a))
#define all(a) (a).begin(), (a).end()
#define dum(val) cerr << #val " = " << val << " ";
#define dump(val) cerr << #val " = " << val << endl;
#define FILL(a, v) fill(a, a + sizeof(a) / sizeof(*a), v)

typedef pair<int, int> P;
typedef tuple<int, int, int> T;

const int mod = 1e9 + 7;
const int INF = 1e9;

signed main() {
    int n, h;
    cin >> n >> h;

    vector<P> c;

    rep(i, n) {
        int a, b;
        cin >> a >> b;
        c.push_back(P(a, b));
    }

    sort(all(c));

    rep(i, c.size()) {
        if (c.back().first == c[i].first) {
            if(c.back().second < c[i].second) {
                swap(c[c.size()-1], c[i]);
            }
        } 
    }

    int cb = c.back().first;
    int cs = c.back().second;
    if (c.back().first > c.back().second) {
        vector<int> p;
        rep(i, n-1) {
            if(c[i].second > c.back().first){
               p.push_back(c[i].second);
            }
        }
        sort(all(p));
        reverse(all(p));
        int count = 0;
        for(auto i : p) {
            h -= i;
            count++;
            if(h < 0) {
                cout << count << endl;
                return 0;
            }
        }
        cout << count + (h + cb - 1) / cb << endl;
    }else{
        vector<int> p;
        rep(i, n-1) {
            if(c[i].second > c.back().first){
               p.push_back(c[i].second);
            }
        }
        sort(all(p));
        reverse(all(p));
        int count = 0;
        for(auto i : p) {
            if(cs >= h) {
                cout << count + 1 << endl;
                return 0;
            }
            h -= i;
            count++;
            if(h < 0) {
                cout << count << endl;
                return 0;
            }
        }
        (h);
        (cs);
        (count);
        cout << count + 1 + (h - cs + cb - 1) / cb << endl;
    }

	return 0;
}


Measured memory_bytes: 3568
#include<iostream>
#include<string>
using namespace std;
int main(){
  string a;
  int cnt=0;
  cin>> a;
  if (a[0] == '1') ++cnt;
  if (a[1] == '1') ++cnt;
  if (a[2] == '1') ++cnt;
  cout << cnt << endl;
}

Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author MaxHeap
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastReader in = new FastReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB {
        public void solve(int testNumber, FastReader in, PrintWriter out) {
            int n = in.nextInt();
            out.println(Integer.highestOneBit(n));
        }

    }

    static class FastReader {
        BufferedReader reader;
        StringTokenizer st;

        public FastReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream));
            st = null;
        }

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

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

    }
}



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

int main(){
  	long n, max_w;
  	cin >> n >> max_w;
  	long *w = new long[n];
  	long *v = new long[n];
  	long **dp = new long*[n];
  	for(int i = 0; i < n; i++)
      	dp[i] = new long[max_w+1];
  	for(int i = 0; i < n; i++)
      for(int j = 0; j < max_w+1; j++)
        dp[i][j] = 0;
  	for(int i = 0; i < n; i++){
    	cin >> w[i] >> v[i];
    }
    for(int i = w[0]; i < max_w + 1; i++)
        dp[0][i] = v[0];
 	for(int i = 1; i < n; i++){
      for(int j = 0; j < max_w + 1; j++){
      	long t1, t2;
        t1 = 0;
        if(j >= w[i])
          t1 = dp[i-1][j-w[i]] + v[i];         
       	t2 = dp[i-1][j];
        dp[i][j] = max(t1, t2); 
      }
    }
  	cout << dp[n-1][max_w];
	return 0;
}


Measured memory_bytes: 78720
N,P = map(int,input().split())
*A, = map(lambda x:int(x)%2,input().split())

o = sum(A)
e = N-o

fac = [1]*(N+1)
for i in range(1,N+1): fac[i] = fac[i-1]*i

def comb(n,k): return fac[n]//fac[k]//fac[n-k]

ans = 0
for i in range(P,o+1,2):
  ans += comb(o,i)

ans *= 2**e
print(ans)

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

using ll=long long;
using P=pair<ll,ll>;
#define mod 1000000007

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

ll modpow(ll n,ll m=mod-2){
  ll r=1;
  while(m) r=r*((m%2)?n:1)%mod,n=n*n%mod,m>>=1;
  return r;
}

int main(){

  int n;
  cin >> n;

  map<P,P> mp;
  long long zero=0;
  ll sum = 1;

  for(int i=0;i<n;i++){
    ll a,b;
    cin >> a >> b;
    if(a==0 && b==0) zero++;
    else if(a==0){
      mp[make_pair(1,0)].first++;
    }else if(b==0){
      mp[make_pair(1,0)].second++;
    }else{
      ll g = gcd(a, b);
      a=a/g;
      b=b/g;
      if(mp[make_pair(b,-a)].first>0) mp[make_pair(b,-a)].second++;
      else if(mp[make_pair(-b,a)].first>0) mp[make_pair(-b,a)].second++;
      else mp[make_pair(a,b)].first++;
    }
  }

  for(auto p:mp){
    ll s = p.second.first%mod;
    ll t = p.second.second%mod;
    ll now = 1;
    now += modpow(2,s)-1;
    now += modpow(2,t)-1;
    sum *= now;
    sum = sum%mod;
  }

  cout << (sum+zero-1+mod)%mod << endl;

}

Measured memory_bytes: 50332
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,n) for(int i=0;i<n;i++)
#define why(n,x) int n;while(cin >>n,n!=x)
#define iFOR(i,x,n)for(int i=x;i<n;i++)
#define fin <<'\n'
#define __ <<" "<<
#define ___ <<" "
#define bash push_back
#define ALL(x) x.begin(),x.end()
#define SWAP(a,b) ((a != b) && (a += b,b = a - b,a -= b))
//#define int long long
typedef long long ll;
typedef pair < int , int >  pii;
typedef vector < int > vit;
typedef map < string , int > mstit;
typedef vector < pii > vpi ;
typedef greater < pii > gpi;
typedef priority_queue < pii , vpi , gpi > dijk ;
static const signed int INF = 0x3f3f3f3f;
static const signed long long LINF = 0x3f3f3f3f3f3f3f3fLL;
static const signed int SMOD = 1000000007;
static const signed int NMOD = 1000000009;
static const signed int dx[]={1,0,-1,0,1,1,-1,-1};
static const signed int dy[]={0,-1,0,1,-1,1,-1,1};

bool inside(int x,int y,int w,int h){return (x>=0 && y>=0 && x<w && y<h);}
template<class T>T abs(T &x){return x<0 ? -x : x;}
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 qp(int a,ll b,int mo){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
int gcd(int a,int b){return b?gcd(b,a%b):a;}

struct UnionFind
{
    vector<int> uni;
    UnionFind(int n): uni(n+5, -1) {}
    int  root(int x)        { return (uni[x] < 0)? x : uni[x] = root(uni[x]); }
    bool same(int x, int y) { return root(x) == root(y); }
    bool unite(int x, int y){
        if ( (x=root(x)) == (y=root(y)) )return false;
        if ( uni[y] < uni[x] ) swap(x,y);
        uni[x] += uni[y],  uni[y] = x;
        return true;
    }
    int size(int i)     { return (-uni[root(i)]); }
};


inline void solve(){
    int n, m;
    int x[100005],y[100005],z[100005];
    bool t[100005]={};
    cin >> n >> m;
    UnionFind uf(n);
    for(int i = 0; i < m; i++){
        cin >> x[i] >> y[i] >> z[i];
        uf.unite(x[i],y[i]);
    }
    int ans = n;
    for(int i = 1; i <= n; i++){
        if(!t[uf.root(i)]){
            ans -= uf.size(i)-1;
            t[uf.root(i)] = true;
        }
    }

    cout << ans << endl;


  

}
struct xyz{ xyz(){ cin.tie(0), ios::sync_with_stdio(false); cout <<fixed<<setprecision(12);};}xyzzy;signed main(){solve();return 0;}


Measured memory_bytes: 1920
n=int(input())
l=list(map(int,input().split()))
m=list(map(int,input().split()))
q=[]

j=0
while 0<=j and j<=n-1:
    p=0
    for k in range(j+1):
        p+=l[k]
    for o in range(n-j):
        p+=m[o+j]
    q.append(p)
    j+=1
print(max(q))

Measured memory_bytes: 38640
#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long a,b,i;
	cin >> a;
	long double arr[a];
	for(i=0;i<a;i++)
	cin >> arr[i];
	sort(arr,arr+a);
	for(i=0;i<a-1;i++)
	{
		arr[i+1]=(arr[i]+arr[i+1])/2;
	}
	cout << arr[i];
}

Measured memory_bytes: 256
// Problem : C - Repsept
// Contest : AtCoder - AtCoder Beginner Contest 174
// URL : https://atcoder.jp/contests/abc174/tasks/abc174_c
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

/*

WINNERS NEVER QUIT AND QUITTERS NEVER WIN!!

*/

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<long,long> pl;
typedef pair<ll,ll> pll;
typedef vector<long> vl;
typedef vector<bool> vb;
typedef vector<ll> vll;
typedef vector<vl> vvl;
typedef vector<vb> vvb;
typedef vector<vll> vvll;
typedef vector<pll> vpll;
typedef vector<string> vs;
typedef unordered_map<ll,ll> umll;

#define FOR(i,a,b) for(long long i=a;i<b;++i)
#define REV(i,a,b) for(long long i=a;i>=b;i--)
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define ub upper_bound
#define lb lower_bound
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define tc ll tests;cin>>tests;while(tests--)
#define io ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define coutv(v) for(auto it: (v))cout<<it<<" ";newl;
#define cout2d(v) for(auto it: (v)) {for(auto j:it) cout<<j<<" ";newl;}
#define cinv(v,n) vll (v)(n);FOR(i,0,(n)){cin>>v[i];}
#define cinvg(v,n) (v).resize(n);FOR(i,0,(n)){cin>>v[i];}
#define cin2d(v,n,m) vvll (v)(n,vll(m,0));FOR(i,0,n){FOR(j,0,m){cin>>v[i][j];}}
#define cin2dg(v,n,m) (v).resize(n,vll(m));FOR(i,0,n){FOR(j,0,m){cin>>v[i][j];}}
#define newl cout<<"\n"
#define mod 1000000007
#define INF LLONG_MAX/2

int main()
{
    io;
    ll k;
    cin>>k;
    ll m=7%k;
    FOR(i,1,1e7+1)
    {
    	if(m==0){cout<<i;return 0;}
    	m=(m%k*10%k+7%k)%k;
    }
    cout<<-1;
    return 0;
}



Measured memory_bytes: 3640
import Control.Arrow
import qualified Data.ByteString.Char8 as B
import qualified Data.Set as S
import Data.List
import Text.Printf

readInteger :: B.ByteString -> Integer
readInteger = maybe undefined fst . B.readInteger

readIntegerPair :: B.ByteString -> [(Integer, Integer)]
readIntegerPair = map (pair . map readInteger . B.words) . B.lines

pair :: [t] -> (t, t)
pair [x, y] = (x, y)
pair _ = undefined

main = do
  [x1,y1,x2,y2] <- map read . words <$> getLine
  _ <- getLine
  xys <- readIntegerPair <$> B.getContents
  printf "%.12f" (walk x1 y1 x2 y2 xys :: Double)

walk x1 y1 x2 y2 xys = 100*s - (20 - 5*pi)*p + (10*pi - 20)*q
  where
    [xmin,xmax] = sort [x1,x2]
    [ymin,ymax] = sort [y1,y2]
    cand = filter (\(x,y) -> xmin<=x && x<=xmax && ymin<=y && y<=ymax) xys
    s = fromIntegral $ abs (x2-x1) + abs (y2-y1)
    k = genericLength $ lis $ (if signum ((x2-x1) * (y2-y1)) == -1 then map negate else id) $ map snd $ sort cand
    (p, q) = (fromIntegral *** fromIntegral) $ if k < min (abs (x2-x1)) (abs (y2-y1)) + 1 then (k, 0) else (k - 1, 1)

lis :: Ord a => [a] -> [a]
lis = S.toList . snd . foldl go (S.empty, S.empty)
  where
    go (acc, acc0) x = case S.lookupGT x acc of
      Nothing -> let acc1 = S.insert x acc in (acc1, acc1)
      Just g -> (S.insert x (S.delete g acc), acc0)

Measured memory_bytes: 85372
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <tuple>
#include <utility>
#include <vector>
#define ll long long
#define itn int
#define endl '\n'
#define co(ans) cout<<ans<<endl
#define COYE cout<<"YES"<<endl
#define COYe cout<<"Yes"<<endl
#define COye cout<<"yes"<<endl
#define CONO cout<<"NO"<<endl
#define CONo cout<<"No"<<endl
#define COno cout<<"no"<<endl
#define FORE(i,a) for(auto &i:a)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n)  FFOR(i,1,n)
#define PB push_back
#define MP make_pair
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort((V).begin(),(V).end())
#define REVERSE(V) reverse((V).begin(),(V).end())
#define EACH(V,i) for(typeof((V).begin()) i=(V).begin();i!=(V).end();++i)
#define equals(a,b) (fabs((a)-(b))<EPS)
#define INF ((1LL<<62)-(1LL<<31))
#define EPS 1e-10
#define PI 3.141592653589793238
#define MOD 1000000007
#define MAX 5100000
using namespace std;
using Edge=pair<ll,ll>;
using Graph=vector<vector<Edge>>;
inline int toInt(string s){int v;istringstream sin(s);sin>>v;return v;}
template<class T>inline string toString(T x){ostringstream sout;sout<<x;return sout.str();}
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;}
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

int main(){
  ll N,M,now=0;
  string S;
  cin>>N>>M>>S;
  REVERSE(S);
  bool CANN=false;
  
  vector<ll> ANS;
  while(now<N){
    bool CAN=true;
    for(ll i=now+M; i>now; --i){
      if(S[i]=='0' && i<=N){
        ANS.PB(i-now);
        now=i;
        CAN=false;
        break;
      }
    }
    
    if(CAN){
      CANN=true;
      break;
    }
  }
  
  if(CANN) co(-1);
  else{
    REVERSE(ANS);
    REP(i,ANS.size()){
      cout<<ANS[i]<<" ";
    }
    cout<<endl;
  }
  return 0;
}

Measured memory_bytes: 4464
import java.util.*;

class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		boolean flag = true;
		int N = sc.nextInt();
		HashMap<Integer,Integer> hash = new HashMap<Integer, Integer>();
		int A[] = new int[N];
		for(int i=0; i<N; i++){
			A[i] = sc.nextInt();
			if(hash.get(A[i]) == null){
				hash.put(A[i],A[i]);
			} else {
				flag = false;
				break;
			}
		}


		if(flag) {
			System.out.println("YES");
		} else {
			System.out.println("NO");
		}
	}
}




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

#include <iostream>
#include <iomanip>
#include <sstream>
#include <stdint.h>
#include <string.h>

#define _USE_MATH_DEFINES
#include <math.h>

#include <vector>
#include <list>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <stack>
#include <deque>
#include <string>

#include <algorithm>
#include <functional>
#include <bitset>
#include <functional>
#include <chrono>
#include <random>

#define sqr(x) (x) * (x)

typedef unsigned int u32;
typedef int i32;
typedef unsigned long long int u64;
typedef long long int i64;
typedef uint16_t u16;
typedef int16_t i16;
typedef uint8_t u8;
typedef int8_t i8;

using namespace std;
using namespace std::chrono;

const i64 mod = 1000000007ll;
const i64 smod = 998244353ll;
const i64 inf = 10000000000000007ll;

const double eps = 1e-10;

const i64 MAXN = 15;

i64 n;
vector<pair<i64, bool>> q[MAXN];

bool check(i64 x) {
    bool f = true;
    for (i64 i = 0; i < n && f; i++) {
        if ((x & (1ll << i)) == 0) {
            continue;
        }
        for (auto t : q[i]) {
            bool z = x & (1ll << t.first);
            if (z != t.second) {
                f = false;
                break;
            }
        }
    }
    return f;
}

int main() {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cout.precision(15); cout.setf(ios::fixed);

    cin >> n;

    for (i64 i = 0; i < n; i++) {
        i64 t;
        cin >> t;
        for (i64 j = 0; j < t; j++) {
            i64 u;
            bool v;
            cin >> u >> v;
            q[i].push_back({ u - 1, v });
        }
    }

    i64 R = 0;
    for (i64 i = 0; i < (1ll << n); i++) {
        if (check(i)) {
            i64 j = i;
            i64 r = 0;
            while (j) {
                r += j & 1;
                j >>= 1;
            }
            R = max(R, r);
        }
    }

    cout << R << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;

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


int main() {
    int n;
    cin>>n;
   cout<<n/3<<endl;
}

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

using namespace std;
#define ll long long
int main()
{
   ll a,b,c,d;
   cin>>a>>b>>c>>d;
   vector<ll> v;
   v.push_back(a*c);
   v.push_back(a*d);
   v.push_back(b*c);
   v.push_back(b*d);
   sort(v.begin(),v.end());
   cout<<v[v.size()-1]<<endl;
   return 0;
}


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

int main() {
    int N, M; cin >> N >> M;
    vector<int> A(N, 0), B(N, 0);
    while(M--) {
        int p; string s;
        cin >> p >> s; --p;
        if(s == "AC") A[p] = 1;
        else if(A[p] == 0) B[p] += 1;
    }
    cout << accumulate(begin(A), end(A), 0) << ' ';
    int penalty = 0;
    for(int i=0; i<N; ++i) if(A[i]) penalty += B[i];
    cout << penalty << '\n';
}

Measured memory_bytes: 1024
#include<stdio.h>
#include<stdlib.h>
#include<stdint.h>
#include<inttypes.h>

typedef int32_t i32;
typedef int64_t i64;

#define MAX(a,b) ((a)>(b)?(a):(b))
#define ALLOC(size,type) ((type*)calloc((size),sizeof(type)))

void update (i64 *bit, i32 x, i64 v) {
  i32 n = bit[0];
  for (i32 i = x; i <= n && v > bit[i]; i += i & -i) {
    bit[i] = v;
  }
}

i64 get_max (i64 *bit, i32 x) {
  i64 res = 0;
  for (i32 i = x; i > 0; i -= i & -i) {
    res = MAX (res, bit[i]);
  }
  return res;
}

void run (void) {
  i32 n;
  scanf ("%" SCNi32, &n);
  i32 *h = ALLOC (n, i32);
  for (i32 i = 0; i < n; ++i) {
    scanf ("%" SCNi32, h + i);
  }
  i64 *bit = ALLOC (n + 1, i64);
  bit[0] = n;
  for (i32 i = 0; i < n; ++i) {
    i32 a;
    scanf ("%" SCNi32, &a);
    i64 v = get_max (bit, h[i] - 1) + a;
    update (bit, h[i], v);
  }
  i64 ans = get_max (bit, n);
  printf ("%" PRIi64 "\n", ans);
}

int main (void) {
  run();
  return 0;
}


Measured memory_bytes: 2560
N=int(input())
A=[int(i) for i in input().split()]
B=[int(i) for i in input().split()]
X=sum(A)
Y=sum(B)
if X<Y:
    print(-1)
    exit()
C=[A[i]-B[i] for i in range(N)]
L=[]
R=[]
for i in range(N):
    if C[i]<0:
        L.append(-C[i])
    else:
        R.append(C[i])
R.sort(reverse=True)
Z=sum(L)
K=0
M=len(R)
l=-1
for i in range(M):
    K+=R[i]
    if K>=Z:
        l=i+1
        break
if len(L)==0:
    print(0)
else:
    print(len(L)+l)

Measured memory_bytes: 20084
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>
#include <iostream>
#include <string>
#include <tuple>
#include <set>
#include <map>
#include <unordered_map>
#include <complex>
#include <iomanip>
#include <cmath>
using namespace std;
typedef long long ll;

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

    int a, b;
    cin >> a >> b;
    cout << (a - 1) * (b - 1) << endl;
}


Measured memory_bytes: 256
#include<cmath>
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<string.h>
using namespace std;
char a[1000000];
int main()
{
	cin>>a;
	int len=strlen(a);
	for(int i=0;i<len;i++)
		if((i%2==0&&a[i]=='L')||(i%2==1&&a[i]=='R'))
		{
			cout<<"No";
			return 0;
		}
	cout<<"Yes";
	return 0;	
} 

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

int int_len(int n) {
  int s=0;
  while(n!=0) s++, n/=10;
  return s;
}

int int_sum(int n) {
  int m=0,s=0,a=n;
  while(a!=0) s++, a/=10;
  for(int i=s-1;i>=0;i--) m+=n/((int)pow(10,i))-(n/((int)pow(10,i+1)))*10;
  return m;
}


int vec_sum(vector<int> v){
  int n=0;
  for(int i=0;i<v.size();i++) n+=v[i];
  return n;
}

int main() {
  vector<int> v(4);
  rep(i,4) cin>>v[i];
  sort(v.begin(),v.end());
  if(v[0]==1 && v[1]==4 && v[2]==7 && v[3]==9) cout<<"YES"<<endl;
  else cout<<"NO"<<endl;
}


Measured memory_bytes: 256
import java.util.Scanner;
class Main{
    public static void main(String[] args) {
        Scanner scn= new Scanner(System.in);
        int k = scn.nextInt();
        int x = scn.nextInt();
        int answer = x-k;
        scn.close();
        for(int i=0;i<2*(k-1)+1;i++){
            System.out.println(++answer);
        }
    }
}


Measured memory_bytes: 21840
#include <cstdio>
#include <cstdlib>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define repi(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,a) repi(i,0,a)
#define all(a) (a).begin(), (a).end()

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

using ll = long long;

ll N, K;
ll A[510], S;

std::vector<ll> divisors( ll x )
{
  std::vector<ll> ret;

  for( ll i = 1; i*i <= x; ++i ) if( x % i == 0 )
  {
    ret.emplace_back( i );

    if( i != x/i )
      ret.emplace_back( x/i );
  }

  return ret;
}

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

  rep( i, N )
    std::cin >> A[i], S += A[i];

  auto ds = divisors( S );

  std::sort( ds.rbegin(), ds.rend() );

  for( auto d : ds )
  {
    //printf( "[%lld]\n", d );

    ll sum = 0;
    std::vector<ll> vs;

    rep( i, N )
    {
      if( A[i] % d == 0 )
        continue;

      ll q = A[i]/d;
      ll ub = (q+1)*d, lb = q*d;
      ll a = (ub-A[i]), b = (A[i]-lb);

      sum += a;
      vs.emplace_back( a );
    }

    std::sort( vs.rbegin(), vs.rend() );

    if( sum % d )
      continue;

    ll x = sum/d;
    ll cnt = 0;

    rep( i, x )
      cnt += d-vs[i];
  
    if( cnt <= K )
    {
      std::cout << d << std::endl;

      return 0;
    }
  }

  return 0;
}

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


int main(){
  ll n,a,b,c;
  cin >> n ;
  a = n/500;
  b = n%500;
  ll sum = 0;
  sum += a*1000;
  c = b/5;
  sum += c*5;
  cout << sum << endl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main(){
    
    
    int a,b,c;
    
    cin>>a>>b>>c;
    
    int tmp;
    
    if(a>b){
        tmp=b;
        b=a;
        a=tmp;
        
    }
    if(b>c){
        tmp=c;
        c=b;
        b=tmp;
    }
    
    if(a>b){
         tmp=b;
        b=a;
        a=tmp;
    }
    
    cout<<a<<" "<<b<<" "<<c<<endl;
    
    return 0;
}


Measured memory_bytes: 3100
#include <cstring>
#include<cstdio>
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main()
{
	string s;
	cin>>s;
	int sum=s.length();
	for(int i=0;i<sum;i++)
	{
		if(s[i]=='C')
		{
			for(int j=i+1;j<sum;j++)
			{
				if(s[j]=='F')
				{
					cout<<"Yes"<<endl;
					return 0;
				}
			}
		}
	}
	cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 256
import sys
import math
from collections import defaultdict, deque, Counter
from copy import deepcopy
from bisect import bisect, bisect_right, bisect_left
from heapq import heapify, heappop, heappush
    
input = sys.stdin.readline
def RD(): return input().rstrip()
def F(): return float(input().rstrip())
def I(): return int(input().rstrip())
def MI(): return map(int, input().split())
def MF(): return map(float,input().split())
def LI(): return list(map(int, input().split()))
def TI(): return tuple(map(int, input().split()))
def LF(): return list(map(float,input().split()))
def Init(H, W, num): return [[num for i in range(W)] for j in range(H)]
    
    
def main():
    X, Y = MI()
    
    exist = False
    for x1 in range(0, X+1):
        y1 = Y - 2 * x1
        if x1 + 2 * y1 == X:
            exist = True
            break
    if not exist:
        print(0)
        sys.exit()

    def cmb(n, r, mod):
        if ( r<0 or r>n ):
            return 0
        r = min(r, n-r)
        return g1[n] * g2[r] * g2[n-r] % mod

    #出力の制限
    mod = 1000000007
    N = 10**6
    g1 = [1, 1] # 元テーブル
    g2 = [1, 1] #逆元テーブル
    inverse = [0, 1] #逆元テーブル計算用テーブル

    for i in range( 2, N + 1 ):
        g1.append( ( g1[-1] * i ) % mod )
        inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
        g2.append( (g2[-1] * inverse[-1]) % mod )

    a = cmb(x1+y1,y1,mod)
    print(a)
    
if __name__ == "__main__":
    main()

Measured memory_bytes: 218084
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		double a = sc.nextInt();
		double b = sc.nextInt();
		
		double avr = (a + b)/2;
		
		System.out.println((int)Math.ceil(avr));
		
		sc.close();
	}
}

Measured memory_bytes: 23892
#include <stdio.h>
int main()
{
    char s[4];
    int i,c=0;
    scanf("%s",&s);
    for(i=0;i<3;i++){
        if(s[i]==s[i+1]){
            c++;
            break;
        }
    }
    if(c>0){
        printf("Bad\n");
    }
    else{
        printf("Good\n");
    }
    return 0;
}


Measured memory_bytes: 128
import java.util.*; 

class Main{
public static void main(String[] args){
	Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
		int[] a=new int[n];
  		int[] b=new int[n-1];
		for(int c=0;c<n-1;c++){
    		b[c]=sc.nextInt();
    	}
  		a[0]=b[0];
  		a[1]=b[0];
    for(int d=0;d<n-2;d++){
 	if(b[d]<=b[d+1]){
    		a[d+2]=b[d+1];
    	}else{
     		a[d+1]=b[d+1];
      		a[d+2]=b[d+1];
   	 }
    }
  		int ans=0;
  		for(int e=0;e<n;e++){
         ans+=a[e];
        }
    	System.out.println(ans);
    }
}

Measured memory_bytes: 21844
# 2020/03/28
# AtCoder Beginner Contest 160 - C

# Input
k, n = map(int,input().split())
a = list(map(int,input().split()))

# Init
interhouse = [0] * n

# Calc
for i in range(n-1):
    interhouse[i] = a[i+1] - a[i]

interhouse[n-1] = k - a[n-1] + a[0]

ans = k - max(interhouse)

# Output
print(ans)


Measured memory_bytes: 25840
/*
    Author: Nguyen Tan Bao
    Status:
    Idea:
*/

#include <bits/stdc++.h>
#define FI first
#define SE second
#define EPS 1e-9
#define ALL(a) a.begin(),a.end()
#define SZ(a) int((a).size())
#define MS(s, n) memset(s, n, sizeof(s))
#define FOR(i,a,b) for (int i = (a); i <= (b); i++)
#define FORE(i,a,b) for (int i = (a); i >= (b); i--)
#define FORALL(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
//__builtin_ffs(x) return 1 + index of least significant 1-bit of x
//__builtin_clz(x) return number of leading zeros of x
//__builtin_ctz(x) return number of trailing zeros of x

using namespace std;
using ll = long long;
using ld = double;
typedef pair<int, int> II;
typedef pair<II, int> III;
typedef complex<ld> cd;
typedef vector<cd> vcd;

const ll MODBASE = 1000000007LL;
const int MAXN = 200010;
const int MAXM = 1000;
const int MAXK = 16;
const int MAXQ = 200010;

int n, k, a[MAXN];

int main() {
    ios::sync_with_stdio(0);
    cin.tie(nullptr);
    cin >> n >> k;
    FOR(i,1,n) cin >> a[i];
    FOR(i,k+1,n)
        if (a[i] > a[i-k]) cout << "Yes\n";
        else cout << "No\n";
    return 0;
}


Measured memory_bytes: 4432
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 1e9+7, N = 1e5+5;
struct City{
    int x,y,id;
    int dist(const City &t){
        return min(abs(x-t.x),abs(y-t.y));
    }
};
bool comp_x(const City &a, const City &b){
    return a.x < b.x;
}
bool comp_y(const City &a, const City &b){
    return a.y < b.y;
}
struct Edge{
    int a,b,c;
    bool operator<(const Edge &t)const{
        return c < t.c;
    }
};
int par[N];
int getpar(int u){
    if(par[par[u]] == par[u])
        return par[u];
    return par[u] = getpar(par[u]);
}
bool unite(int a, int b){
    a = getpar(a);
    b = getpar(b);
    if(a == b)
        return false;
    par[a] = b;
    return true;
}
int main(){
    iota(par,par+N,0);
    int n;
    cin >> n;
    vector<City> arr(n);
    for(int i = 0; i < n; ++i){
        cin >> arr[i].x >> arr[i].y;
        arr[i].id = i;
    }
    vector<Edge> edges;
    sort(arr.begin(),arr.end(),comp_x);
    for(int i = 0; i < n-1; ++i)
        edges.push_back({arr[i].id,arr[i+1].id,arr[i].dist(arr[i+1])});
    sort(arr.begin(),arr.end(),comp_y);
    for(int i = 0; i < n-1; ++i)
        edges.push_back({arr[i].id,arr[i+1].id,arr[i].dist(arr[i+1])});
    sort(edges.begin(),edges.end());
    int ans = 0;
    for(auto cur : edges)
        if(unite(cur.a,cur.b))
            ans += cur.c;
    cout << ans << '\n';
}


Measured memory_bytes: 6516
#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll read()
{
    char ch=getchar();
    ll x=0,f=1;
    while(ch<'0' || ch>'9')
    {
        if(ch=='-')
            f=-1;
        ch=getchar();
    }
    while(ch>='0' && ch<='9')
    {
        x=x*10+ch-'0';
        ch=getchar();
    }
    return x*f;
}
int main()
{
	int a[]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
	int n=read();
	cout<<a[n-1]<<endl;
    return 0;

}


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

const int mod = 1000000007;
ll dp[1001][1001];

int main() {
  int h, w;
  cin >> h >> w;
  vector<string> a(h);
  rep(i, h) cin >> a[i];

  dp[0][0] = 1;
  rep(i, h) {
    rep(j, w) {
      if (a[i][j] == '#') continue;
      if (i > 0 && a[i - 1][j] == '.') dp[i][j] += dp[i - 1][j];
      if (j > 0 && a[i][j - 1] == '.') dp[i][j] += dp[i][j - 1];
      dp[i][j] %= mod;
    }
  }
  cout << dp[h - 1][w - 1] << endl;
  return 0;
}

Measured memory_bytes: 9088
#include <iostream>

using namespace std;

int main() {
  int K, S;
  cin >> K >> S;
  int count = 0;
  int z = 0;
  for (int x = 0; x <= K; ++x) {
    for (int y = 0; y <= K; ++y) {
      z = S - x - y;
      if (0 <= z && z <= K) {
        count++;
      }
    }
  }
  cout << count << endl;
}

Measured memory_bytes: 3588
#include<stdio.h>

int main() {
	int n, nd[3], f = 0;
	scanf("%d", &n);
	for (int i = 0; i < 3; i++) {
		nd[i] = n % 10;
		n = n / 10;
	}
	for (int i = 0; i < 3; i++) {
		if (nd[i] == 7) {
			f = 1;
		}
	}
	if (f == 1) {
		printf("Yes");
	}
	else {
		printf("No");
	}
}

Measured memory_bytes: 1732
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
int main()
{
  ll n;
  cin>>n;
  ll a[n];
  for(ll i=0;i<n;i++)
  {
    cin>>a[i];
  }
  ll sum=0,cur=1000,i,j;
  for(i=0;i<n;)
  {
      for(j=i+1;j<n;j++)
      {
        //   cout<<i<<" "<<j<<endl;
          ll temp=a[j]-a[j-1];
            if(temp<0 )
            {
                
                sum+=(cur/a[i])*(a[j-1]-a[i]);
                cur=cur+(cur/a[i])*(a[j-1]-a[i]);
                // cout<<"sum="<<sum<<" "<<"cur="<<cur<<endl;
                break;     
            } 
            if( temp>=0 && j==n-1)
            {
                sum+=(cur/a[i])*(a[j]-a[i]);
                cur=cur+(cur/a[i])*(a[j]-a[i]);
                // cout<<"sum="<<sum<<" "<<"cur="<<cur<<endl;
                
            }
      }
      i=j;
  }
    
                         cout<<cur<<endl;
}

Measured memory_bytes: 3632