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

typedef long long               ll;
typedef long double             ld;


#define racecar          ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define CLOCK			 cerr << "\nTime elapsed: " << 1000.0 * clock() / CLOCKS_PER_SEC << " ms\n";
#define si(a)            scanf("%d", &a)
#define si2(a,b)         scanf("%d %d", &a,&b)
#define sll(a)           scanf("%I64d",&a)
#define sll2(a,b)        scanf("%I64d %I64d",&a,&b)
#define pb               push_back
#define pi(a)            printf("%d",int(a))
#define pll(a)           printf("%I64d",ll(a))
#define all(x)           (x).begin(),(x).end()
#define rall(x)          (x).rbegin(),(x).rend()
#define ps               printf(" ")
#define nln              printf("\n")
#define ff               first
#define ss               second
#define vi               vector<int>
#define vll              vector<ll>
#define vstr             vector<string>
#define vc               vector<char>
#define PII              pair<int,int>
#define PLL              pair<ll,ll>
#define PI               acos(-1)
#define sq(x)            x*x
#define forr(i,a,b)      for(ll i=ll(a);i<ll(b);i++)
#define forn(i,a,b)      for(ll i=ll(a);i>ll(b);i--)
#define max3(a,b,c)      max(a,max(b,c))
#define max4(a,b,c,d)    max(max3(a,b,c),d)
#define min3(a,b,c)      min(a,min(b,c))
#define mod              1000000007
#define inf              9223372036854775807

///knight moves:
///int dx[] = {-2, -1, 1, 2, -2, -1, 1, 2};
///int dy[] = {-1, -2, -2, -1, 1, 2, 2, 1};


ll power(ll b,ll n)
{
    if(n==0) return 1;
    else if(n%2) return b*power(b,n/2)*power(b,n/2);
    else return power(b,n/2)*power(b,n/2);
}

ld root(ll n,ll r)
{
    ld dif=0.0001;
    ld guess=n/2.0;
    while(abs(pow(guess,r)-n)>=dif)
    {
        ld temp=pow(guess,r)-n;
        ld tmp=r*pow(guess,r-1);
        guess-=temp/tmp;
    }
    return guess;
}

void fileio()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif
}


int solve()
{
	string x;
	cin>>x;
	
	int tot=0,blc=0;

	forr(i,0,x.size())
	{
		if(i%2 && x[i]=='0') tot++;
		if(i%2 && x[i]=='1') blc++;
		if(i%2==0 && x[i]=='0') blc++;
		if(i%2==0 && x[i]=='1') tot++;
	}
	
	pi(min(tot,blc));
				
	
    return 0;
}


int main()
{
//    racecar;
//    cout<<fixed<<setprecision(6);
//    fileio();
    solve();
//	CLOCK;   
    return 0;
}



///    Before submission=>
///    ***check for integer overflow,array bounds
///    ***check for n


Measured memory_bytes: 512
#include <bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
using LL = long long;
const LL LINF = 1e18;
using namespace std;
#define COUT(v) cout<<(v)<<endl
#define CIN(n)  int(n);cin >> (n)
#define LCIN(n) LL(n);cin >> (n)
#define SCIN(n) string(n);cin >> (n)
#define YES(n) cout<<((n)? "YES" : "NO")<<endl
#define Yes(n) cout<<((n)? "Yes" : "No")<<endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) <<endl

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)

#define FOREACH(x,a) for(auto& (x) : (a) )

#define ALL(obj) (obj).begin(),(obj).end()

#define P pair<LL,LL>
#define I vector<int>
#define S set<int>
#define pb(v) push_back(v)
#define V vector
#define rt return
#define rmsame(a) sort(ALL(a)),a.erase(unique(ALL(a)), a.end())

typedef string::const_iterator State;
class PalseError {};
class Edge{
public:
    LL from,to,value;
    Edge(LL a,LL b,LL c){
        from = a;
        to = b;
        value = c;
    }
    Edge(LL a,LL b){
        from = a;
        to = b;
    }
};

int main(){
    CIN(A);CIN(B);
    if(A+B >= 10){
        COUT("error");
    }else{
        COUT(A+B);
    }
    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <climits>
using namespace std;
const int maxn=3e5+5;
int N, eSum[maxn], wSum[maxn], result = INT_MAX;
 
int main()
{
    scanf("%d ", &N);
    for(int i = 1; i <= N; i++)
    {
        char c;
        scanf("%c", &c);
        eSum[i] = eSum[i - 1];
        wSum[i] = wSum[i - 1];
        if(c == 'E')
        {
            eSum[i]++;
        }
        if(c == 'W')
        {
            wSum[i]++;
        }
    }
    for(int i = 1; i <= N; i++)
    {
        result = min(result, eSum[N] - eSum[i] + wSum[i - 1]);
    }
    printf("%d", result);
}

Measured memory_bytes: 2560
#include <stdio.h>
#define MAX 1000000001

int w[100001];

int main() {
  int n,k,i;
  scanf("%d %d",&n,&k);
  for(i=0; i<n; i++) scanf("%d",&w[i]);
  int l=0,r=MAX;
  int ans=MAX;
  while(l+1<r) {
    int mid=(l+r)/2;
    int sum=0,cnt=0,max=0;
    for(i=0; i<n; i++) {
      if(sum+w[i]>mid) {
	if(cnt<k-1) {
	  cnt++;
	  sum=0;
	}
      }
      sum+=w[i];
      if(max<sum) max=sum;
    }
    if(ans>max) ans=max;
    if(max<=mid) r=mid;
    else l=mid;
  }
  printf("%d\n",ans);
  return 0;
}


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

typedef long long ll;

int main()
{
    ll X;
    cin >> X;

    for (ll i = -150; i < 150; ++i)
    {
        for (ll j = -150; j < 150; ++j)
        {
            ll temp = i * i * i * i * i - j * j * j * j * j;
            if (temp == X)
            {
                cout << i << " " << j << endl;
                return 0;
            }
        }
    }
}


Measured memory_bytes: 3584
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		// 数値
		String n1 = sc.next();

		// 文字列
		if (n1.equals("hi") || n1.equals("hihi") || n1.equals("hihihi") || n1.equals("hihihihi")
				|| n1.equals("hihihihihi")) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}

	}
}


Measured memory_bytes: 22608
import sys
S=list(raw_input())
if len(S)>10:
	print "NO"
	sys.exit()

if "K" in S and "I" in S and "H" in S:
	pass
else:
	print "NO"
	sys.exit()
	
if S.index("K")+1!=S.index("I") or S.index("I")+1!=S.index("H"):
	print "NO"
	sys.exit()

for i in S:
	if i=="A":
		S.remove("A")


if ''.join(S)=="KIHBR":
	print "YES"
else:
	print "NO"


Measured memory_bytes: 2568
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int S = sc.nextInt();
		int h = S / 3600;
		int m = S % 3600 / 60;
		int s = S % 3600 % 60;
		System.out.println(h + ":" + m + ":" + s);
		sc.close();
	}
}


Measured memory_bytes: 26292
n = int(input())
l = [list(map(int,input().split())) for i in range(n)]
A = [l[i][0] for i in range(n)]
B = [l[i][1] for i in range(n)]
C = [l[i][2] for i in range(n)]
p = [0 for i in range(n)]

for i in range(n):
    if A.count(l[i][0]) < 2:
        p[i] += l[i][0]
    if B.count(l[i][1]) < 2:
        p[i] += l[i][1]
    if C.count(l[i][2]) < 2:
        p[i] += l[i][2]
    print(p[i])


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

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

    int N, X, Y;
    cin >> N >> X >> Y;
    vector<int> cnt(N);
    for (int i = 1; i < N; i++) {
        for (int j = i + 1; j <= N; j++) {
            int k = min(abs(i - j), min(abs(i - X) + abs(j - Y) + 1, abs(i - Y) + abs(j - X) + 1));
            cnt[k]++;
        }
    }
    for (int k = 1; k < N; k++) cout << cnt[k] << '\n';
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <math.h>
#define _GLIBCXX_DEBUG
#define _LIBCPP_DEBUG 0

using namespace std;
#define ll long long
#define rep(i,n) for (int i = 0; i < n; i++)
#define rrep(i,n) for (int i = n-1; i >= 0; i--)
#define MOD (1000000007)
#define vi vector<int>
#define vl vector<ll>
#define vvi vector<vi>
#define vvl vector<vl>
#define pii pair<int, int>
#define pb push_back

#define mp make_pair
#define all(a) (a).begin(),(a).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; }

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

const ll INF = 1LL << 60;

const int dh[4] = {1,0,-1,0};
const int dw[4] = {0,1,0,-1};

vi color;
int K;
map<pii,int> edge;// 頂点の二つの値を入れたら辺の番号を返すやつ

void dfs(int v, int p, int col, vvi &G){
  if(p != -1){
    int e = edge[mp(v,p)];
    color[e] = col+1;
  }
  
  for(auto nv : G[v]) {
    if(nv == p) continue;
    col = (col + 1)%K;
    dfs(nv, v, col, G);
  }
}

int main(){
  int n; cin >> n;
  vvi G(n);
  vi deg(n);
  
  rep(i,n-1) {
    int a,b; cin >> a >> b;
    a--; b--;
    G[a].pb(b); G[b].pb(a);
    deg[a]++; deg[b]++;
    edge[mp(a,b)] = i; edge[mp(b,a)] = i;
  }
  
  K = 0;
  rep(v,n) chmax(K,deg[v]);

  color.resize(n-1,-1);

  dfs(0,-1,0,G);

  cout << K << endl;
  rep(i,n-1) cout << color[i] << endl;
}


Measured memory_bytes: 19328
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vii = vector<vi>;
using vs = vector<string>;
using in6 = int64_t;
using ind = double;
using pii = pair<int,int>;
using psi = pair<string,int>;
using vpi = vector<pii>;
using vps = vector<psi>;
#define rep(i, n) for (in6 i = 0; i < (in6)(n); i++)
#define repa(i,a,n) for(in6 i = a; i < (in6)(n); i++)
#define repdown(i,n) for(in6 i = n; i > 0; i--)
#define kyun ios::sync_with_stdio(false)
#define hinata cout << "\n"
#define all(c) (c).begin(), (c).end()
#define pb push_back
#define inf 2147483647

int main() {
  kyun;
  int a,b;
  cin >> a >> b;
  bool check = 1;
  if(10 <= a) check = 0;
  if(10 <= b) check = 0;
  if(check) cout << a*b;
  else cout << -1;
  hinata;
}

Measured memory_bytes: 256
n,x=map(int,input().split())
a=list(map(int,input().split()))
a.sort()
cc=0
s=0
z=x
for i in range(n):
     s+=a[i]
     if(s>x):
         break
     cc+=1
if(sum(a)==x):
     print(n)
else:
     if(cc==n):
        print(n-1)
     else:
        print(cc)

Measured memory_bytes: 38256
import bisect
N=int(input())
L=list(map(int,input().split()))
L.sort()
ans=0
for i in range(N-2):
  for j in range(i+1,N-1):
    a=bisect.bisect_left(L,L[i]+L[j])
    ans+=(a-j-1)
print(ans)

Measured memory_bytes: 9208
#include<iostream>
#include<cmath>
#include<vector>
#include<map>
#include<string>
#include<algorithm>
using namespace std;
int main(){
  int K, X;
  cin >> K >> X;
  int i = max(-1000000, X-K+1);
  cout << i;
  for(i++; i<=min(1000000,X+K-1); i++) cout << " " << i;
  cout << endl;
  return 0;
}

Measured memory_bytes: 256
import std.stdio;
import std.string;
import std.conv;
import std.algorithm;
import std.range;
import std.traits;
import std.math;
import std.conv;

void main() {
	auto S = readln.chomp;
	S.check.writeln;
}

int check(string s) {
	if(s.length & 1) s.popBack();
	else { s.popBack; s.popBack; }
	while(true) {
		if(s[0..$ / 2] == s[$ / 2..$])
			return s.length.to!int;
		else { s.popBack; s.popBack; }
	}
}

// ===================================

T readAs(T)() if (isBasicType!T) {
	return readln.chomp.to!T;
}
T readAs(T)() if (isArray!T) {
	return readln.split.to!T;
}

T[][] readMatrix(T)(uint height, uint width) if (isBasicType!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		res[i] = readAs!(T[]);
	}
	return res;
}

int ri() {
	return readAs!int;
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(100000)

n, m = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(m)][::-1]

uf = [-1]*(n+1)
def find(i):
    if uf[i] < 0:
        return i
    else:
        uf[i] = find(uf[i])
        return uf[i]

ans = [n*(n-1)//2]
for i in range(m-1):
    a, b = ab[i]
    pa, pb = find(a), find(b)

    if pa != pb:
        pa, pb = (pb, pa) if uf[pb] < uf[pa] else (pa, pb) # swap (merge technique)
        ans.append(ans[i] - uf[pa]*uf[pb])
        uf[pa] += uf[pb]
        uf[pb] = pa
    else:
        ans.append(ans[i])
    # print(uf)

for ans_ in ans[::-1]:
    print(ans_)

Measured memory_bytes: 34664
import java.io.*;
import java.util.*;


public class Main {
	public static void main(String[] args) throws Exception {
		MScanner sc = new MScanner(System.in);
		PrintWriter pw = new PrintWriter(System.out);
		int n=sc.nextInt();
		long[]a=sc.takearrl(n);
		long []cnt0=new long[62];
		long []cnt1=new long[62];
		for(int i=0;i<n;i++) {
			for(int j=0;j<62;j++) {
				if(((1l<<j)&a[i])!=0) {
					cnt1[j]++;
				}
				else {
					cnt0[j]++;
				}
			}
		}
		long ans=0;
		int mod=(int)1e9+7;
		for(int i=0;i<62;i++) {
			long add=(((cnt0[i]*cnt1[i])%mod)*((1l<<i)%mod))%mod;
			//System.out.println(cnt0[i]+" "+cnt1[i]+" "+add+" "+i);
			ans=(ans+add)%mod;
		}
		pw.println(ans);
		pw.flush();
	}
	static class MScanner {
		StringTokenizer st;
		BufferedReader br;

		public MScanner(InputStream system) {
			br = new BufferedReader(new InputStreamReader(system));
		}

		public MScanner(String file) throws Exception {
			br = new BufferedReader(new FileReader(file));
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		public int[] takearr(int n) throws IOException {
			int[] in = new int[n];
			for (int i = 0; i < n; i++)
				in[i] = nextInt();
			return in;
		}

		public long[] takearrl(int n) throws IOException {
			long[] in = new long[n];
			for (int i = 0; i < n; i++)
				in[i] = nextLong();
			return in;
		}

		public Integer[] takearrobj(int n) throws IOException {
			Integer[] in = new Integer[n];
			for (int i = 0; i < n; i++)
				in[i] = nextInt();
			return in;
		}

		public Long[] takearrlobj(int n) throws IOException {
			Long[] in = new Long[n];
			for (int i = 0; i < n; i++)
				in[i] = nextLong();
			return in;
		}

		public String nextLine() throws IOException {
			return br.readLine();
		}

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

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

		public char nextChar() throws IOException {
			return next().charAt(0);
		}

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

		public boolean ready() throws IOException {
			return br.ready();
		}

		public void waitForInput() throws InterruptedException {
			Thread.sleep(3000);
		}
	}
}

Measured memory_bytes: 85984
// In the name of God

#include <iostream>
#include <algorithm>
#include <fstream>
#include <vector>
#include <deque>
#include <assert.h>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <stdio.h>
#include <string.h>
#include <utility>
#include <math.h>
#include <bitset>
#include <iomanip>

using namespace std;
#define double long double
const double eps = 1e-15;
const int N = (int) 1005, mod = (int) 0;
double d[N], adj[N][N];
double dist(int x, int y) { return sqrt(x * 1ll * x + y * 1ll * y); }
int mark[N], x[N], y[N], r[N];
int32_t main() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int xs, ys, xt, yt;
    cin >> xs >> ys >> xt >> yt;
    int n;
    cin >> n;
    int src = n, snk = n + 1;
    n += 2;
    x[src] = xs;
    y[src] = ys;
    x[snk] = xt;
    y[snk] = yt;
    for (int i = 0; i < n - 2; ++i) {
        cin >> x[i] >> y[i] >> r[i];
    }
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < n; ++j) if (i != j) {
            adj[i][j] = max((double) 0, dist(x[i] - x[j], y[i] - y[j]) - r[i] - r[j]);
        }
    }
    for (int i = 0; i < n; ++i) d[i] = 1e18;
    d[src] = 0;
    for (int rep = 0; rep < n; ++rep) {
        double mn = 1e18;
        int ind = 0;
        for (int j = 0; j < n; ++j) if (!mark[j]) {
            if (d[j] < mn) {
                mn = d[j];
                ind = j;
            }
        }
        mark[ind] = 1;
        for (int j = 0; j < n; ++j)
            if (!mark[j])
                d[j] = min(d[j], d[ind] + adj[ind][j]);
    }
    cout << setprecision(10) << fixed << d[snk] << endl;
}



Measured memory_bytes: 16000
#include <iostream>
#include <sstream>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <queue>
#include <deque>
#include <stack>
#include <iomanip>
#include <cmath>


using namespace std;


typedef long long ll;
typedef long double ld;


const ll MOD_CONST = 1000000007ll;


ll modSum(ll a, ll b, ll MOD = MOD_CONST) {
  return ((a % MOD) + (b % MOD)) % MOD;
}


ll modSubtract(ll a, ll b, ll MOD = MOD_CONST) {
  return (((a % MOD) - (b % MOD)) + MOD + MOD) % MOD;
}


ll modProd(ll a, ll b, ll MOD = MOD_CONST) {
  return ((a % MOD) * (b % MOD)) % MOD;
}


ll getPowMod(ll x, ll e, ll MOD = MOD_CONST) {
  if (e == 0) return 1;
  if (e % 2 == 0) {
    ll tmp = getPowMod(x, e/2, MOD);
    return modProd(tmp, tmp);
  } else {
    ll tmp = getPowMod(x, e-1, MOD);
    return modProd(tmp, x);
  }
}


ll getPow(ll x, ll e) {
  if (e == 0) return 1;
  if (e % 2 == 0) {
    ll tmp = getPow(x, e/2);
    return tmp * tmp;
  } else {
    ll tmp = getPow(x, e-1);
    return tmp * x;
  }
}


ll getInverse(ll x, ll MOD = MOD_CONST) {
  return getPowMod(x, MOD-2, MOD);
}


bool isEven(ll x) {
  ll tmp = ((x % 2) + 2) % 2;
  return tmp == 0;
}


ll getSumOfDigitsInBase(ll n, ll b) {
  ll ret = 0;
  while (n > 0) {
    ret += n % b;
    n /= b;
  }
  return ret;
}


vector<int> getKMP(string &s) {
  int len = (int)s.size();
  vector<int> ret (len, 0);
  for (int i = 1 ; i < len ; i++) {
    int at = ret[i-1];
    while (at > 0 && s[i] != s[at]) {
      at = ret[at-1];
    }
    if (s[i] == s[at]) {
      at++;
    }
    ret[i] = at;
  }
  return ret;
}


string getSubstring(string &s, int from, int to) {
  int l = to-from+1;
  if (l <= 0) {
    return "";
  }
  return s.substr(from, l);
}

ll gcd(ll a, ll b, ll & x, ll & y) {
    if (a == 0) {
        x = 0;
        y = 1;
        return b;
    }
    ll x1, y1;
    ll d = gcd(b % a, a, x1, y1);
    x = y1 - (b / a) * x1;
    y = x1;
    return d;
}


pair<ll, ll> getIntersectingRange(ll a1, ll b1, ll a2, ll b2) {
  ll s = max(a1, a2);
  ll e = min(b1, b2);

  return {s, e};
}


bool isNonEmptyIntersection(ll a1, ll b1, ll a2, ll b2) {
  auto p = getIntersectingRange(a1, b1, a2, b2);
  return p.first <= p.second;
}


double getPointDistance(double x1, double y1, double x2, double y2) {
  double dx = x1-x2;
  double dy = y1-y2;
  double d = (dx * dx) + (dy * dy);
  return sqrt(d);
}
















ll N;
map<ll, ll> memo;


ll DP(ll x) {
  if (x <= 1) {
    return x;
  }
  if (memo.count(x)) {
    return memo[x];
  }
  ll ret;
  if (x % 2 == 0) {
    ret = 2 * DP(x / 2) + DP(x / 2 - 1);
  } else {
    ret = 2 * DP(x / 2) + DP(x / 2 + 1);
  }
  ret %= MOD_CONST;
  return memo[x] = ret;
}


void input() {
  cin >> N;
}


void preprocess() {
}


void solve() {
  cout << DP(N+1);
}


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

  int T;
//  cin >> T;
  T = 1;

  for (int i = 0 ; i < T ; i++) {
    input();
    preprocess();
    solve();
  }

  return 0;
}


Measured memory_bytes: 256
def do(level,x):
    if x<=0: #1層も手を付けないとき
        return 0
    elif x>=whole[level]: #完食できるとき
        return patty[level]
    #それ以外、途中まで食べるときはlevel>=1の場合のみあり得る
    x-=1 #このとき1層目は必ずバンズ
    res=0 #食べたパティの総数を記録する
    if x>=whole[level-1]+1: #真ん中のパティまで到達できるとき
        x-=whole[level-1]+1
        res+=patty[level-1]+1
    return res+do(level-1,x)

n,x=map(int,input().split())
whole=[1]+[0]*50
patty=[1]+[0]*50
for i in range(1,n+1):
    whole[i]=whole[i-1]*2+3
    patty[i]=patty[i-1]*2+1
res=0
print(do(n,x))


Measured memory_bytes: 38384
#include <iostream>
#include <math.h>
#include <strings.h>
#include <queue>
using namespace std;

int main()
{
    int X;
    cin >> X;
    int M,m;
    M=X/500;
    m=(X-(M*500))/5;
    cout <<((M*1000)+(m*5));
    return 0;
}

Measured memory_bytes: 256
/**
 * Я слил Atcoder Beginner Contest 172, решив всего две задачи!
 * Я не могу апнуть синего!
 * Я постоянно сливаю раунды, либо не решив тупую задачу, либо набрав штрафа!
 * Я постоянно уступаю всем своим друзьям и знакомым в контестах и нахожу этому оправдания!
 * Я постоянно придумываю сложные неверные решения к простым задачам!
 * -------------------------------------------------------------
 * -Решать сложные задачи
 * -Участвовать в контестах
 * -Делать виртуальные соревнования
 * -------------------------------------------------------------
 * Не уберу это, пока не начну нормально решать задачи, а не заниматься ерундой!!!
**/
  
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
typedef long long  ll;
//typedef tree<ld,null_type,less<ld>,rb_tree_tag,tree_order_statistics_node_update> indexed_set
// this for long double
#define press_F_to_pay_respect ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define forn for(int i=0;i<n;i++) 
#define form for(int j=0;j<n;j++) 
#define fore(i,a,b) for(int i = a; i < (b); i++)
#define pb push_back 
#define pob pop_back()
#define mp make_pair 
#define sc second 
#define f first 
#define ld long double
#define kek cout<<endl; 
#define rep(i,a,b) for(int i=a;i<b;i++)
#define all(v) ((v).begin()), ((v).end()) 
#define pob pop_back() 
#define halt {cout<<"NO"; return 0;}
const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const int N = 1010;
const int INF = 1e8;
const ll LL_INF=1e10;
const ll MOD1=1073741824;
const long double pi=3.1415926535;
using namespace std;
using namespace __gnu_pbds;
typedef tree<ld,null_type,less<ld>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
string bin_rep(int n)
{
     string s="";
      for(int i=31;i>=0;i--)
   {
           if(n&(1<<i)) s+='1';
           else s+='0';
   }
   return s;
}
int main()
{
#if defined(_DEBUG)
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
 press_F_to_pay_respect;
 // cout << fixed << setprecision(12) << ans;
 // string al = "abcdefghijklmnopqrstuvwxyz";
 int n;
 cin>>n;
 map<string,int> m;
 string s;
 forn
 {
           cin>>s;
           m[s]++;
 }
 cout<<"AC x "<<m["AC"];
 kek;
 cout<<"WA x "<<m["WA"];
 kek;
 cout<<"TLE x "<<m["TLE"];
 kek;
 cout<<"RE x "<<m["RE"];
 kek;
 
 
 
 
 
 
 
 
 
  // cout <<"Runtime is:"<<clock() * 1.0 / CLOCKS_PER_SEC <<endl;
   return 0;
   
   
 
}

Measured memory_bytes: 3600
#include <bits/stdc++.h> 
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define size_of_array(array) (sizeof(array)/sizeof(array[0]))
#define MAX 100005
#define DEBUG 0 
#define LIMIT (LONG_MAX / 10)
#define POSITIVE_LAST_D (LONG_MAX % 10)
using ll =long long;
using namespace std;
using Graph=vector<vector<int>>;

int main(){
    int n,m;
    cin>>n>>m;

    if(n==m){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
ll mod=1e9;

int main(){
  int N,A[100];
  cin>>N;
  for (int i(0);i<N;i++) cin>>A[i];
  sort(A,A+N);
  cout << A[N-1] - A[0] << endl;
}


Measured memory_bytes: 256
N = int(input())
dct = {}
for i in range(N):
    S = input()
    if dct.get(S) == None:
        dct[S] = 1
    else:
        dct[S] += 1
sortedDct = sorted(dct.items(), key=lambda x: -x[1])
L = []
maxNum = 0
for k, v in sortedDct:
    if (maxNum <= v):
        L.append(k)
        maxNum = v
L.sort()
for l in L:
    print(l)

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

using namespace std;

template<class T> void vin(vector<T>& v, int n) {
    v.resize(n);
    for (int i = 0; i < n; ++i) {
        cin >> v[i];
    }
}

struct edge { int to, cost; edge(int t, int c) : to(t), cost(c) {} };
int V;
vector<edge> g[100001];
int d[100001];
const int inf = 1e8;

void dijkstra(int s) {
    priority_queue<pair<int, int>, vector<pair<int, int>>, greater<pair<int, int>>> que;
    fill(d, d+V, inf);
    d[s] = 0;
    que.push(make_pair(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 i=0; i<g[v].size(); ++i) {
            edge e = g[v][i];
            if (d[e.to] > d[v] + e.cost) {
                d[e.to] = d[v] + e.cost;
                que.push(make_pair(d[e.to], e.to));
            }
        }
    }
}

int main() {
    int k;
    cin >> k;
    V = k;
    rep(i, k) {
        edge e1((i+1)%k, 1);
        g[i].push_back(e1);
        edge e2((i*10)%k, 0);
        g[i].push_back(e2);
    }
    deque<int> que;
    dijkstra(1);
    // fill(d, d+k, inf);
    // que.push_front(1);
    // d[1] = 0;
    // while (que.size()) {
    //     int v = que.front(); que.pop_front();
    //     for (auto e : g[v]) {
    //         if (d[e.to] == inf) {
    //             d[e.to] = d[v] + e.cost;
    //             if (e.cost == 0) que.push_front(e.to);
    //             else que.push_back(e.to);
    //         }
    //     }
    // }
    cout << d[0]+1 << endl;
}


Measured memory_bytes: 6780
#include <bits/stdc++.h>
using namespace std;
#define EB emplace_back
#define G(i,x) get<i>(x)
#define F(i,s,n) for(int i = s; i < n; i++)

int N;
int K;
int a[100000][3];
int dp[100000][3];

int sol(int index, int type) {
	if (index == N) {
		return 0;
	}
	if (dp[index][type] != - 1) {
		return dp[index][type];
	}

	int bestOp = 0;
	int opt1;
	int opt2;
	switch(type) {
		case 0:
			bestOp = max(sol(index + 1, 1) + a[index][1], sol(index + 1, 2) + a[index][2]);
			break;
		case 1:
			bestOp = max(sol(index + 1, 0) + a[index][0], sol(index + 1, 2) + a[index][2]);
			break;
		case 2:
			bestOp = max(sol(index + 1, 0) + a[index][0], sol(index + 1, 1) + a[index][1]);
			break;

	}

	return dp[index][type] = bestOp;

}


int main() {
	cin>>N;

	F(i,0,N) {
		cin>>a[i][0]>>a[i][1]>>a[i][2];
		dp[i][0] = dp[i][1] = dp[i][2] = -1;
	}
	int opt1 = sol(0, 0);
	int opt2 = sol(0,1);
	int opt3 = sol(0,2);
	
	int result = max(opt1,opt2);
	result = max(result, opt3);
	cout<<result;
}

Measured memory_bytes: 7296
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
int main()
{
    ll t=1,i,j,k,n,m,x,y,z,a,b;
    // cin>>t;
    while(t--)
    {
       cin>>n>>k;
       vector<ll>v,u;
       for(i=0;i<n;i++)
       {
           cin>>x;
           v.push_back(x);
       }
       j=0;
       ll m;

       for(i=k;i<n;i++,j++)
       {
           m=v[j];
           if(v[i]>m)
           {
               cout<<"Yes"<<endl;
           }
           else
            cout<<"No"<<endl;

       }



    }
    return 0;
}


Measured memory_bytes: 5364
process.stdin.resume()
process.stdin.setEncoding('utf8')
process.stdin.on('data', function (chunk) {
  var input = chunk.split(' ').map(Number)
  var area = input[0] * input[1]
  var outer = input[0] * 2 +  input[1] * 2
  console.log(area + ' ' + outer)
})

Measured memory_bytes: 15536
//#define __USE_MINGW_ANSI_STDIO 0
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef pair<int, int> PII;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define IN(a, b, x) (a<=x&&x<b)
#define MP make_pair
#define PB push_back
#define MOD 1000000007
#define INF (1LL<<30)
#define LLINF (1LL<<60)
#define PI 3.14159265359
#define EPS 1e-12
//#define int ll

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

ll a[100010];
signed main(void)
{
  int n, k;
  cin >> n >> k;
  ll ma = 0;
  REP(i, n) {
    cin >> a[i];
    ma = max(ma, a[i]);
  }

  if(ma < k) {
    cout << "IMPOSSIBLE" << endl;
    return 0;
  }

  ll now = a[0];
  FOR(i, 1, n) {
    now = __gcd(now, a[i]);
  }

  if(k%now == 0) cout << "POSSIBLE" << endl;
  else cout << "IMPOSSIBLE" << endl;

  return 0;
}


Measured memory_bytes: 1024
import Data.Maybe
import Data.List

solve :: Int -> Int -> String -> String -> Int
solve n m s t = ans
  where
    g = gcd n m
    lcm = n * m `div` g
    s' = perc (n `div` g) s
    t' = perc (m `div` g) t
    ans | s' == t' = lcm
        | otherwise = -1

perc k "" = ""
perc k (c:str) = c : perc k (drop (k-1) str)


tmain :: String -> Int
tmain cont =
  let [sn, sm, s, t]  = words cont
      n = read sn
      m = read sm
  in solve n m s t

main = putStrLn . show . tmain =<< getContents


Measured memory_bytes: 6268
#include<iostream>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<utility>
#include<algorithm>
#include<cstdio>
#include<iomanip>
#include<queue>
#include<stack>

#define ll int64_t
#define Rep(i, n) for (ll i = 0; i < n; i++)

using namespace std;

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

    ll N, A, B;
    cin >> N >> A >> B;
    vector<ll> h(N);
    Rep (i, N) {
        cin >> h[i];
    }

    ll ng = 0, ok = 1e10;
    while (abs(ok - ng) > 1) {
        ll mid = (ok + ng) / 2;
        ll check = 0;
        Rep (i, N) {
            check += max((ll)0, (h[i]-B*mid+A-B-1)/(A-B));
        }
        if (check <= mid) ok = mid;
        else ng = mid; 
    }

    cout << ok << endl;

}

Measured memory_bytes: 1024
def judge(p1,p2,p3,p4):
    t1 = (p3[0] - p4[0]) * (p1[1] - p3[1]) + (p3[1] - p4[1]) * (p3[0] - p1[0])
    t2 = (p3[0] - p4[0]) * (p2[1] - p3[1]) + (p3[1] - p4[1]) * (p3[0] - p2[0])
    t3 = (p1[0] - p2[0]) * (p3[1] - p1[1]) + (p1[1] - p2[1]) * (p1[0] - p3[0])
    t4 = (p1[0] - p2[0]) * (p4[1] - p1[1]) + (p1[1] - p2[1]) * (p1[0] - p4[0])
    return t1*t2>0 and t3*t4>0 
while True:
	try:
		x1,y1,x2,y2,x3,y3,x4,y4=map(float, input().split(","))
		A=[x1,y1]
		B=[x2,y2]
		C=[x3,y3]
		D=[x4,y4]
		if judge(A,B,C,D)==False :
			print("NO")
		else:
			print("YES")
	except EOFError:
		break


Measured memory_bytes: 5588
#include<iostream>
using namespace std;
int a[100010];
int find(int u){
  if(a[u]==u)
    return u;
  return a[u]=find(a[u]);
}
void _union(int x,int y){
  int ta=find(x);
  int tb=find(y);
  a[ta]=tb;
}
int main(){
  int n,m;
  cin>>n>>m;
  for(int i=1;i<=n;++i)
    a[i]=i;
  while(m--){
    int x,y;
    cin>>x>>y;
    _union(x,y);
  }
  int tot=0;
  for(int i=1;i<=n;++i)
    tot+=a[i]==i;
  cout<<tot-1<<endl;
  return 0;
}

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

using namespace std;

#define rep(i, n) for (int i = 0; i < (n); ++i)

using ll = long long;
using pint = pair<int, int>;
using mint = map<int, int>;

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

const char sp = ' ';
const char cmm = ',';
const int MOD = 1e9+7;
const int INF = 1e9;
const ll LINF = 1e18;

ll mod(ll a, ll b){return (a%b+b)%b;}
ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b){return a*b/gcd(a,b);}
void Yes(){cout << "Yes" << endl;}
void No(){cout << "No" << endl;}
void Judge(bool b){b?Yes():No();}
void YES(){cout << "YES" << endl;}
void NO(){cout << "NO" << endl;}
void JUDGE(bool b){b?YES():NO();}
ll powMod(ll b, ll e, ll m){ll r=1;while(e>0){if(e&1)r=(r%m)*(b%m)%m;b=(b%m)*(b%m)%m;e>>=1;}return r;}
double distance(ll x1, ll y1, ll x2, ll y2){return sqrt((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2));}

template<typename T>
void ppp(T n){cout << n << endl;}
template<typename T1, typename T2> ostream& operator<<(ostream& s, const pair<T1, T2>& p) {return s << "(" << p.first << ", " << p.second << ")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& v) {
    int len = v.size();
    s << '[';
    for (int i = 0; i < len; ++i) {
        s << v[i]; if (i < len-1) s << ", ";
    }
    s << ']';
    return s;
}

int main(){

    cin.tie(0);
    ios::sync_with_stdio(false);

    int n;
    cin >> n;

    vector<pint> edge[100001];
    vector<int> color(n, -1);
    for(int i = 0; i < n-1; ++i){
        int u, v, w;
        cin >> u >> v >> w;
        --u; --v;
        edge[u].push_back({v, w%2});
        edge[v].push_back({u, w%2});
    }

    color[0] = 0;
    queue<int> q;
    q.push(0);
    while(!q.empty()){
        int v = q.front(); q.pop();
        for(auto e : edge[v]){
            // cerr << edge[v] << endl;
            if(color[e.first] != -1) continue;
            color[e.first] = (color[v]+e.second)%2;
            q.push(e.first);
        }
    }

    for(auto x : color){
        ppp(x);
    }

    return 0;
}


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

using namespace std;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<int,int> pi;
typedef pair<ll,ll> pll;
typedef vector<pi> vpi;
typedef vector<bool> vbool;

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define forall(it,s) for(auto it = s.begin(); it != s.end(); ++it)
#define F0(i,n) for(ll i = 0; i < n; i++)
#define F1(i,n) for(ll i = 1; i <= n; i++)
#define rep(i,a,b) for(int i = a; i <= b; i++)
#define per(i,a,b) for(int i = b-1; i >= a; i--)
#define FIN ios::sync_with_stdio(false);cin.tie(0);
#define db(x) cout<<#x<<" = "<<x<<"\n"
#define all(v) v.begin(),v.end()
#define modulo(a,b) ((a%b)+b)%b
#define F first
#define S second
#define INF 1000000010
#define INFLL 1000000000000000000
#define eps 0.000000000001
#define mod 1000000007
template<class C> void mini(C&a, C b){ a=min(a, b);}
template<class C> void maxi(C&a, C b){a=max(a,b);}
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}

//=======================//
const int maxn=300+2;
int n;
double dp[maxn][maxn][maxn], nd;

double esperanza(int a, int b, int c) {
	if (a<0||b<0||c<0) return 0;
	if (a==1&&b==0&&c==0)return n;
	if (dp[a][b][c] > -0.5) return dp[a][b][c];
	double e1 = esperanza(a-1,b,c), e2 = esperanza(a+1,b-1,c), e3 = esperanza(a,b+1,c-1);
	double ad = a, bd = b, cd = c;
	double p = ad + bd + cd; // cantidad de platos ocupados
	// Valor esperado de intentos que tengo que hacer hasta agarrar un plato con sushi:
	// Es una variable aleatoria geometrica con proba p/n, o sea que su esperanza es n/p.
	dp[a][b][c] = nd/p + ad/p * e1 + bd/p * e2 + cd/p * e3;
	return dp[a][b][c];
}

int main () {
	//FIN

	cin >> n;
	nd = n;
	int ones=0,twos=0,threes=0;
	F0(i,n) {
		int a;
		cin >> a;
		if (a==1) ones++;
		else if (a==2) twos++;
		else threes++;
	}
	F0(i,n+1) F0(j,n+1) F0(k,n+1) dp[i][j][k] = -1.0;
	cout << fixed << setprecision(12) << esperanza(ones,twos,threes) << "\n";


	return 0;
}










Measured memory_bytes: 218240
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define int long long
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e18;

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n, k;
    string s;
    cin >> n >> k >> s;
    int cnt = 0;
    rep(i, 0, n - 1){
        if(s[i] != s[i + 1]) cnt++;
    }
    if((cnt + 1) / 2 <= k) cout << n - 1 << endl;
    else cout << (n - 1 - cnt) + 2 * k << endl;
}

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

// 重みなしグラフ
class GraphWithoutWeight{
private:
    const int infinityInGWW = 2e9 + 334 + 810 + 893 + 114514; // 無限大
    const int Vsize; // グラフの頂点の数
    std::vector<std::vector<int>> EdgeFrom; // EdgeFrom[a] = b ; a -> b の矢印
    std::vector<int> NodeIn; // 頂点に入ってくる枝の数 (a-> b => NodeIn[b]++;)
    std::vector<int> Topological; // 順序
public:
    // コンストラクタ その①  : 長さを受け取る ; 枝はなしで初期化
    GraphWithoutWeight(int n): Vsize(n){ 
        EdgeFrom.resize(n, std::vector<int>(0));
        Topological.resize(n); NodeIn.resize(n, 0);
    }
    // コンストラクタ その②  : 枝の情報の配列を受け取る
    GraphWithoutWeight(std::vector<std::vector<int>>& E): Vsize(E.size()){
        EdgeFrom = E; Topological.resize(Vsize);
    }
    // from -> toへの枝を追加する関数
    void add(int from, int to){
        EdgeFrom.at(from).push_back(to);
        NodeIn.at(to)++;
    }
    // 順序を計算の実行をする関数 : 閉路検出 => trueを返す
    bool findLoop(){
        // 順序無限大で埋める : 初期設定
        std::fill(Topological.begin(), Topological.end(), infinityInGWW);
        std::vector<int> copyNodeIn = NodeIn; // 枝の数の配列のコピー
        std::queue<int> Que;
        int count_vertexes = 0; // 訪れた頂点を数える
 
        // 入ってくる枝の数が0の頂点を詰める
        for(int v = 0; v < Vsize; v++) if(copyNodeIn[v] == 0){
            Que.push(v); Topological[v] = 0; count_vertexes++;
        }
        while(not Que.empty()){ // 非再帰 bfs
            int v = Que.front(); Que.pop();
            for(int nv : EdgeFrom[v]){ // 次のノード
                // 無限大の場合
                if(Topological[nv] == infinityInGWW){
                    --copyNodeIn[nv];
                    if(copyNodeIn[nv] == 0){
                        Topological[nv] = Topological[v] + 1;
                        Que.push(nv); count_vertexes++;
                    }
                }
            }
        }
        return count_vertexes == Vsize;
    }
 
    void solve(void){
        std::vector<std::pair<int, int>> TPS(Vsize);
        REP(i, Vsize) TPS[i] = {Topological[i], i};
        std::sort(TPS.begin(), TPS.end());
        REP(i, Vsize) printf("%d\n", TPS[i].second);
    }
    // 順序(Topological)を表示する関数
    void showTopological(){
        puts("Topological");
        for(int v = 0; v < Vsize; v++){
            printf("  %d : %d\n", v, Topological[v]);
        }
    }
};
 
int main(void){
    int n, m; scanf("%d%d", &n, &m);
    GraphWithoutWeight GWW(n);
    REP(_, m){
        int a, b; 
        scanf("%d", &a);
        scanf("%d", &b);
        GWW.add(a, b);
    }
    GWW.findLoop();
    GWW.solve();
 
    return 0;
}



Measured memory_bytes: 3732
#include <vector>
#include <algorithm>
#include <iostream>
#include <cassert>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <cstdio>
#include <ctime>
#include <map>
#include <set>
#include <chrono>
#include <queue>
#include <string>
#include <cassert>
#include <bitset>
#include <stack> 

#define INFLL 2000000000000000000
#define INF 2000000000
#define MOD 998244353
#define BASE 77747
#define PI acos(-1.0)
#define MAXLEN 29

using namespace std;

typedef pair <int, int> pii;
typedef long long ll;
typedef vector <ll> vll;

int dp[100000];
int arr[100000];
int n, k;

int main() {
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	scanf("%d %d", &n, &k);
	for (int i = 0; i < n; i++) scanf("%d", arr + i);
	for (int i = 1; i < n; i++) {
		dp[i] = dp[i - 1] + abs(arr[i] - arr[i - 1]);
		for (int j = 2; j <= k && i - j >= 0; j++) {
			dp[i] = min(dp[i], dp[i - j] + abs(arr[i] - arr[i - j]));
		}
	}	
	printf("%d\n", dp[n - 1]);
	return 0;
}

Measured memory_bytes: 1024
#include <assert.h>
#include <bits/stdc++.h>
#include <math.h>
#include <string.h>
#include <algorithm>
#include <bitset>
#include <fstream>
#include <unordered_map>
#include <iostream>
#include <list>
#include <set>
#include <stack>
#include <string>
#include <vector>

 
using namespace std;
 
typedef string str;
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;
typedef long long ll;
typedef pair<int, int> pi;
typedef vector<int> vi;
typedef vector<long long> vl;

#define mp make_pair
#define pb push_back
#define sz(x) (int)x.size()
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define trav(a, x) for (auto &a : x)
#define F0R(i, a) for (int i = 0; i < (a); i++)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define FORd(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define F0Rd(i, a) for (int i = (a)-1; i >= 0; i--)
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define PRINT_ARRAY(a, N)        \
  F0R(z, N) cout << a[z] << " "; \
  cout << "\n"
 
const int MOD = 1000000007;  // 998244353
const ll INF = 1e18;
const ld PI = 4 * atan((ld)1);

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

		int residue = 0, n = s.size();

		for (int i = 0; i < n; ++i) {
				int num = s[i] - '0';
				residue = (residue + num) % 9;
		}

		if (residue == 0) {
				cout << "Yes" << endl;
		} else {
				cout << "No" << endl;
		}
}


Measured memory_bytes: 3780
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);

    int N = scanner.nextInt();
    int M = scanner.nextInt();
    int[][] edges = new int[M][3];

    int[][] dist = new int[N][N];
    int INF = 100_000_000;
    for (int i = 0; i < N; i++) for (int j = 0; j < N; j++) dist[i][j] = INF;
    for (int i = 0; i < M; i++) {
      int a = scanner.nextInt() - 1;
      int b = scanner.nextInt() - 1;
      int c = scanner.nextInt();
      edges[i][0] = a;
      edges[i][1] = b;
      edges[i][2] = c;
      dist[a][b] = dist[b][a] = c;
    }

    for (int k = 0; k < N; k++)
      for (int i = 0; i < N; i++)
          for (int j = 0; j < N; j++)
              if (dist[i][j] > dist[i][k] + dist[k][j]) dist[i][j] = dist[i][k] + dist[k][j];

    int num = 0;
    for (int i = 0; i < M; i++) {
      int a = edges[i][0];
      int b = edges[i][1];
      int c = edges[i][2];
      if (dist[a][b] == c) num++;
    }
    System.out.println(M - num);
  }
}


Measured memory_bytes: 26928
#include<bits/stdc++.h>
using namespace std;
#define ll long long int

int main(){
    ll n;
    cin>>n;
    map<ll,ll> ma;
    ll a[n];
    for(ll i=0;i<n;i++){
        cin>>a[i];
        ma[i+1-a[i]]++;
    }
    ll count=0;
    for(ll i=0;i<n;i++){
        count+=ma[i+1+a[i]];
        // sort(v[i].begin(),v[i].end());
        // reverse(v[i].begin(),v[i].end());
        // if(v[i].size()==0 || v[i][0]<a[i])  count++;
    }
    cout<<count<<endl;
    return 0; 
}


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

typedef long long ll;
#define mod 1000000007

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif

void solve() {
    int n, k;
    cin>>n>>k;
    vector<int> dp(k+1, 0);
    dp[0] = 0;
    vector<int> a(n);
    for(auto& e:a){
        cin>>e;
    }
    // debug(n, k, a);
    for(int i = 0; i < n; i++){
        dp[a[i]] = 1;
    }
    // debug("f");
    for(int i = 0; i <= k; i++){
        if(dp[i] == 1){
//            for(int j = 0; j < n; j++){
//                int ind = i+a[j];
//                if(ind <= k && dp[ind] != 1){
//                    dp[ind] = 0;
//                }
//            }
            continue;
        }
        else{
            for(int j = 0; j < n; j++){
                int ind = i+a[j];
                if(ind <= k){
                    dp[ind] = 1;
                }
            }
        }
    }
    if(dp[k])
        cout<<"First\n";
    else
        cout<<"Second\n";
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int t = 1;
    // cin >> t;
    // pre();
    while (t--)
        solve();

    return 0;
}

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

using namespace std;
using u64 = std::uint_fast64_t;

template <typename T>
class Primes {
 private:
  std::vector<int> prime;

 public:
  Primes(T n) : prime(n + 1) {
    std::iota(prime.begin(), prime.end(), 0);
    for (T i = 2; i * i < n + 1; i++) {
      if (prime[i] < i) continue;
      for (T j = i * i; j < n + 1; j += i) {
        if (prime[j] == j) prime[j] = i;
      }
    }
  }

  std::vector<T> factor(T x) const {
    std::vector<T> res;
    while (x > 1) {
      res.emplace_back(prime[x]);
      x /= prime[x];
    }
    return res;
  }

  bool isprime(T x) const { return prime[x] == x; }
};

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

  int X;
  cin >> X;
  Primes<int> prime = Primes<int>(1000000);

  for (u64 i = X;; i++) {
    if (prime.isprime(i)) {
      cout << i << '\n';
      return 0;
    }
  }
  return 0;
}


Measured memory_bytes: 4224
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cassert>
#include <climits>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <fstream>

using namespace std;
#define TOSTRING(x) #x
#define SZ(x) (int)(x).size()
#define REP(i, n) for (int i = 0; i < (n); i++)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REPR(i, n) for (int i = (n)-1; i >= 0; i--)
#define ALL(s) (s).begin(), (s).end()
#define so(V) sort(ALL(V))
#define rev(V) reverse(ALL(V))
#define uni(v) v.erase(unique(ALL(v)), v.end());

typedef long long unsigned int llu;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef vector<vb> vvb;
const double EPS = 1e-9;
const int MOD = 1e9 + 7;
const int INF = (1 << 28);
const ll LINF = 2e18;
const double PI = acos(-1);

int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N;
	cin >> N;
	double ans = 0.0;
	REP(i, N)
	{
		double x;
		string u;
		cin >> x >> u;
		if (u == "JPY")
		{
			ans += x;
		}
		else
		{
			ans += x * 380000.0;
		}
	}
	printf("%.7f", ans);
	return 0;
}


Measured memory_bytes: 256
N,M = map(int,input().split())
hList = list(map(int, input().strip().split()))
resultDict = {}
for n in range(1,N+1):
    resultDict[n] = {}
    resultDict[n]['n']=[]
    resultDict[n]['h'] = hList[n-1]
loadList = []
for j in range(1,M+1):
    ai,bi =map(int,input().split())
    resultDict[ai]['n'].append(bi)
    resultDict[bi]['n'].append(ai)
count = 0
for o in resultDict.keys():
    height = resultDict[o]['h']
    flag = True
    for num in resultDict[o]['n']:
        if resultDict[num]['h'] >= height:
            flag = False
            break
    if(flag):
        count = count + 1
print(count)

Measured memory_bytes: 61728
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <string>

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = (n) - 1; i >= 0; i--)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (a); i > (b); i--)
#define ALL(a) (a).begin(), (a).end()

int main() {
    int A, P;
    cin >> A >> P;
    cout << (A * 3 + P) / 2 << endl;
    return 0;
}

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

int main(){
	int n;
  	int ans = 0;
  	cin>>n;
  	map<string, int> m;
  	for(int i=0;i<n;i++){
    	string s;
    	cin>>s;
		if(m.find(s) != m.end()){
        	continue;
        }
      	else{
        	m[s] = 1;
          	ans++;
        }
    }
  	cout<<ans;
  	return 0;
}

Measured memory_bytes: 19152