akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<queue>
#include<cmath>
#include<ctime>
#include<cstdlib>
#define inf 99999999
#define dl double
#define ll long long
#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) ((a)<(b)?(a):(b))
#define abs(a) ((a)>0?(a):-(a))
#define re register
#define FOR(i,a,b) for(re int i=(a) ; i<=(b) ; ++i)
#define AFOR(i,a,b) for(re int i=(a) ; i>=(b) ; --i)
#define REP(i,u) for(re int i=head[u],v=edge[i].to;i!=-1;i=edge[i].nxt,v=edge[i].to)
//#define gc (fs==ft&&(ft=(fs=buf)+fread(buf,1,1<<18,stdin),fs==ft))?0:*fs++
#define gc getchar()
using namespace std;
const int N=3e5+10;
const ll mod=998244353;
char buf[1<<18],*fs,*ft;
inline ll read() {
	ll w=0,p=0;
	char ch=gc;
	while(!isdigit(ch)) w=ch=='-'?1:0,ch=gc;
	while(isdigit(ch)) p=p*10+ch-'0',ch=gc;
	return w?-p:p;
}
inline void write(ll x) {
	if(x<0) putchar('-'),x=-x;
	if(x>9) write(x/10);
	putchar(x%10+'0');
	return ;
}
int n,limit;
ll S,f[N],b[N],g[N];
inline ll mul(ll x,ll y){
	ll as=1;
	while(y){
		if(y&1) as=as*x%mod;
		x=x*x%mod,y>>=1;
	}
	return as;
}
inline void FWT(ll a[],int limit,int type){
	ll x,y,inv=mul(2,mod-2);
	for(re int i=1 ; i<limit ; i*=2 )
		for(re int j=0 ; j<limit ; j+=2*i) 
			for(re int k=j ; k<i+j ; ++k)
				x=a[k],y=a[k+i],a[k]=(x+y+mod)%mod*(type==-1?inv:1)%mod,a[k+i]=(x-y+mod)%mod*(type==-1?inv:1)%mod;
}
int main(){
	ll inv=0;
	n=read();
	limit=1<<n;
	FOR(i,0,limit-1) b[i]=read(),g[i]=mod-1,S=(S+b[i])%mod;
	inv=mul(S,mod-2);
	FOR(i,0,limit-1) b[i]=(b[i]*inv)%mod;
	--b[0],g[0]+=limit;
	FWT(b,limit,1),FWT(g,limit,1);
	FOR(i,0,limit-1) f[i]=g[i]*mul(b[i],mod-2)%mod;
	FWT(f,limit,-1);
	FOR(i,0,limit-1) write((f[i]-f[0]+mod)%mod),putchar('\n');
	return 0;
}

Measured memory_bytes: 9544
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for(int i = 0; i < n; ++i) cin >> a[i];
  int q;
  cin >> q;
  while(q--) {
    int b, m, e;
    cin >> b >> m >> e;
    rotate(a.begin()+b, a.begin()+m, a.begin()+e);
  }
  for(int i = 0; i < n; ++i) cout << a[i] << " \n"[i==n-1];

  return 0;
}



Measured memory_bytes: 3132
from collections import*
N,W=map(int,input().split())
d=defaultdict(int)
d[0]=0
for i in range(N):
    v,w=map(int,input().split())
    for p,q in d.copy().items():
        if p+w<=W:
            d[p+w]=max(d[p+w],v+q)
#    print(d)
print(max(d.values()))


Measured memory_bytes: 7324
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = s; i < (int)(n); i++)
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

using namespace std;
using ll = long long;
using pii = pair<int, int>;

//const ll INF = 1e18L + 5;
//const int INF = 1e9 + 5;
//const double pi = 3.14159265358979323846;

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

	int n, m, c;
	cin >> n >> m >> c;

	vector<int> b(m);
	rep(i, m) cin >> b[i];
	int ans = 0;
	while (n--) {
		int source = 0;
		rep(i, m) {
			int a;
			cin >> a;
			source += a * b[i];
		}
		if (source + c > 0) ans++;
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
import java.io.IOException;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws IOException{
	Scanner sc	= new Scanner(System.in);
	
	String[] x = sc.next().split("");
	if(x[0].equals(x[2])){
		System.out.println("Yes");
	}else {
		System.out.println("No");
	}
	}
}


Measured memory_bytes: 23124
#include<stdio.h>
#include<algorithm>
using namespace std;
int c[60][60];
int v[60];
int dp[60][60];
int rev[60][60];
int main(){
	int a,b;
	scanf("%d%d",&a,&b);
	for(int i=0;i<a;i++)for(int j=0;j<b;j++)
		scanf("%d",&c[i][j]);
	for(int i=0;i<b;i++)v[i]=99999;
	for(int i=0;i<a;i++)for(int j=0;j<b;j++)
		v[j]=min(v[j],c[i][j]);
	for(int i=0;i<a;i++)
		for(int j=0;j<b;j++)dp[i][j]=9999999;
	for(int i=0;i<a;i++){
		if(v[b-1]==c[i][b-1]){
			dp[i][b-1]=0;
		}
	}
	for(int i=b-1;i>0;i--){
		for(int j=0;j<a;j++){
			if(dp[j][i]>99999)continue;
			for(int k=0;k<a;k++){
				if(c[k][i-1]==v[i-1]){
					int tmp=dp[j][i];
					if(j!=k)tmp++;
					if(dp[k][i-1]>tmp){
						dp[k][i-1]=tmp;
						rev[k][i-1]=j;
					}
				}
			}
		}
	}
	int ret=99999;
	int at=0;
	for(int i=0;i<a;i++){
		if(ret>dp[i][0]){
			at=i;ret=dp[i][0];
		}
	}
	int val=0;
	for(int i=0;i<b;i++)val+=v[i];
	printf("%d %d\n",val,ret);
	for(int i=0;i<b;i++){
		printf("%d\n",at+1);
		if(i<b-1)at=rev[at][i];
	}
}

Measured memory_bytes: 1068
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i, n) FOR(i, 0, (n))
#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define LAR(a, b) ((a)=max((a),(b)))
#define SML(a, b) ((a)=min((a),(b)))
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pair<int, int>> vpii;
typedef pair<int, int> pii;
#define PB push_back
#define EB emplace_back
#ifdef LOCAL_DEBUG
#define DEBUG(...) printf(__VA_ARGS__)
#else
#define DEBUG(...)
#endif

#define N 112345
int x[N], y[N];
set<int> xy[N], yx[N];
queue<int> que;
set<int> xs, ys;

int main(){
	int n; scanf("%d", &n);
	REP(i, n){
	 	scanf("%d%d", x+i, y+i);
		xy[x[i]].emplace(i);
		yx[y[i]].emplace(i);
	}
	ll ans = 0;
	REP(i, n){
		if(xy[x[i]].find(i) == xy[x[i]].end()) continue;
		DEBUG("(%d, %d)\n", x[i], y[i]);
		xy[x[i]].erase(xy[x[i]].find(i));
		yx[y[i]].erase(yx[y[i]].find(i));
		que.push(i);
		while(que.size()){
			int j = que.front(); que.pop();
			DEBUG(" (%d, %d)\n", x[j], y[j]);
			xs.insert(x[j]);
			ys.insert(y[j]);
			for(int k : xy[x[j]]){
				que.push(k);
				yx[y[k]].erase(yx[y[k]].find(k));
			}
			xy[x[j]].clear();
			for(int k : yx[y[j]]){
				que.push(k);
				xy[x[k]].erase(xy[x[k]].find(k));
			}
			yx[y[j]].clear();
		}
		ans += ((ll) xs.size()) * ys.size();
		xs.clear();
		ys.clear();
	}
	printf("%lld\n", ans - n);
}


Measured memory_bytes: 21120
object Main extends App {
  val sc = new FastScanner(System.in)
  val n = sc.nextInt()
  val a, b = Array.fill(n)(sc.nextInt() - 1)
  val count = Array.fill(n)(0)
  val idxa = Array.fill(n)(List[Int]())
  val idxb = Array.fill(n)(List[Int]())
  var aKeys = a.toSet
  var bKeys = b.toSet

  for (i <- 0 until n) {
    count(a(i)) += 1
    count(b(i)) += 1
    idxa(a(i)) ::= i
    idxb(b(i)) ::= i
  }

  if (count.max > n) {
    println("No")
  } else {
    val x = Array.fill(n+1)(Set[Int]())
    for (i <- 0 until n) {
      x(count(i)) += i
    }

    val ans = Array.fill(n)(-1)

    def update(p: Int, q: Int): Unit = {
      val idxap = idxa(p)
      val idxbq = idxb(q)
      ans(idxap.head) = q + 1

      if (idxap.tail.isEmpty) {
        aKeys -= p
      } else {
        idxa(p) = idxap.tail
      }

      if (idxbq.tail.isEmpty) {
        bKeys -= q
      } else {
        idxb(q) = idxbq.tail
      }

      val cp = count(p)
      val cq = count(q)
      count(p) -= 1
      count(q) -= 1

      x(cp) -= p
      x(cq) -= q
      x(cp - 1) += p
      x(cq - 1) += q
    }

    def getAny(s: Set[Int], except: Int): Int = {
      s.find(_ != except).get
    }

    for (i <- n until 0 by -1) {
      var p = -1
      var q = -1
      x(i).toList match {
        case Nil =>
          p = getAny(aKeys, -1)
          q = getAny(bKeys, p)
        case x1 :: Nil =>
          if (aKeys.contains(x1)) {
            p = x1
            q = getAny(bKeys, p)
          } else {
            q = x1
            p = getAny(aKeys, q)
          }
        case x1 :: x2 :: Nil =>
          if (aKeys.contains(x1)) {
            p = x1
            q = x2
          } else {
            p = x2
            q = x1
          }
      }
      update(p, q)
    }

    println("Yes")
    println(ans.mkString(" "))
  }
}

class FastScanner(source: java.io.InputStream) {
  val buf = new Array[Byte](1024)
  var now, end = 0

  def isPrintable(b: Byte): Boolean = 33 <= b && b <= 126
  def isNum(b: Byte): Boolean = 48 <= b && b <= 57

  def hasNextByte: Boolean = {
    if (now < end) {
      true
    } else {
      now = 0
      end = source.read(buf)
      end > 0
    }
  }

  def nextByte(): Byte = {
    if (hasNextByte) {
      val b = buf(now)
      now += 1
      b
    } else {
      -1
    }
  }

  def hasNext: Boolean = {
    while (hasNextByte && !isPrintable(buf(now))) {
      now += 1
    }
    hasNextByte
  }

  def next(): String = {
    if (hasNext) {
      val sb = new StringBuilder()
      var b = nextByte()
      while (isPrintable(b)) {
        sb += b.toChar
        b = nextByte()
      }
      sb.toString
    } else {
      throw new NoSuchElementException()
    }
  }

  def nextInt(): Int = {
    nextLong().toInt
  }

  def nextLong(): Long = {
    if (hasNext) {
      var b = nextByte()
      var sign = 1
      var n = 0L
      if (b == '-') {
        sign = -1
        b = nextByte()
      }
      while (isNum(b)) {
        n = n * 10 + (b - 48)
        b = nextByte()
      }
      sign * n
    } else {
      throw new NoSuchElementException()
    }
  }

  def nextDouble(): Double = next().toDouble
}


Measured memory_bytes: 145944
//  cout << char(i+48) << endl;//なぜかaは47と得る時がある。+48で出力もaにできる。
//  cout << char(97) << endl;//アスキーコードでaを出力
// sort(b.begin(), b.end());//bという配列を小さい方からソート
// reverse(b.begin(), b.end());//bという配列をリターン
// 10桁でdouble出力するパターン１ 
// printf("%.10f\n", ma);
// 10桁でdouble出力するパターン２
//cout << fixed << setprecision(10);
//  cout << ma << endl;

/*01 02 03 12 13 23　と６回見ていくパターン 
for(int i=0;i<n-1;i++){
  for(int j=i+1;j<n;j++){
    }
  }
*///vector<vector<int>> data(3, vector<int>(4));//int型の2次元配列(3×4要素の)の宣言
//int64_t a;
//10のi乗pow(10, i);
/*string s; stringでの文字列を数字型に変える方法
  cin >> s;
  rep(i,s.size()-2) {
  int a= (s.at(i)-'0')*100 + (s.at(i+1)-'0')*10+ s.at(i+2) -'0';
    */
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int keisan(int n){
  int wa = 0;
  while(n>0){
    wa += n%10;
    n /=10;
  }
  return wa;
}

int main() {
  int n;
  cin >> n;
  int a = keisan(n);
  if(n%a==0) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}


Measured memory_bytes: 256
/**
 * CODE
 * BY
 * VIKAS VERMA
 * 
 * $$Always Check for Constraints
*/
#include <bits/stdc++.h>
using namespace std;
#define fo(i, n) for (int i = 0; i < n; i++)
#define Fo(i, n) for (int i = 1; k <= n; i++)
#define f_range(l, r) for (int i = l; i < r; i++)
#define jaldi ios_base::sync_with_stdio(0), cin.tie(NULL), cout.tie(NULL);
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define PI 3.1415926535897932384626
#define endl "\n"
#define F first
#define S second
#define PB push_back
#define MP make_pair
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpii;
typedef vector<vi> vvi;
typedef long long ll;
//=======================
const int MOD = 1'000'000'007;
const int N = 2e6 + 13;
//=======================
vi g[N];
int a[N];
//=======================

void solve()
{
  int n, x, t;
  cin >> n >> x >> t;
  int count = 0;
  while (n > 0)
  {
    n = n - x;
    count += t;
  }
  cout << count << endl;
}

int main()
{
  jaldi
      // #ifndef ONLINE_JUDGE
      //       freopen("input.txt", "r", stdin);
      //   freopen("output.txt", "w", stdout);
      // #endif
      int t = 1;

  // cin >> t;

  while (t--)
  {
    solve();
  }

  return 0;
}

Measured memory_bytes: 50516
#include<bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i) 
#define rrep(i, a, b) for (int i = (a); i < (b); ++i)
#define PI acos(-1)
#define pcnt __builtin_popcountll
#define rng(a) a.begin(), a.end()
#define rrng(a) a.rbegin(), a.rend()
#define sz(x) (int)(x).size()
#define v(T) vector<T>
#define vv(T) v(v(T))
#define fi first
#define se second

using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using LP = pair<ll, ll>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using tl = tuple<ll, ll, ll>;

template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
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; }

ll INF = 1001001001;
ll LINF = 1001001001001001001ll;

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

    ll n, m; cin>>n>>m;
    map<ll, ll> mp;
    rep(i, n) {
        ll a; cin>>a;
        mp[a]++;
    }

    map<ll, LP> cnt;
    for (auto v : mp) {
        cnt[v.fi % m].fi += v.se;
        cnt[v.fi % m].se += v.se / 2;
    }

    ll ans = 0;
    rep(i, m) {
        if (i == 0 || i * 2 == m) {
            ans += cnt[i].fi / 2;
            continue;
        }

        if (i > m - i) break;

        LP a = cnt[i];
        LP b = cnt[m - i];
        if (a.fi < b.fi) swap(a, b);
        ans += min(a.se, (a.fi - b.fi) / 2);
        ans += b.fi;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 12800
#include <bits/stdc++.h>
using namespace std;
using pint = pair<int,int>;


const long long INFLL = 1LL << 60;
const int INFI = 1000000000;


int main(){
    int n;cin>>n;
    vector<long long> a(n);
    for(int i=0;i<n;i++) cin >> a[i];
    for(int i=n-1; i>=0; i-=2){
        cout << a[i] << ' ';
    }
    if(n%2==0){
        for(int i=0; i<n; i+=2) cout << a[i] << ' ';
    }else{
        for(int i=1; i<n; i+=2) cout << a[i] << ' ';
    }
}


Measured memory_bytes: 3712
x, y, a, b, c = map(int, input().split())
p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))

p.sort(reverse=True)
q.sort(reverse=True)
r.sort(reverse=True)

x_2 = 0
y_2 = 0

for i in range(c):
  minimum = r[x_2 + y_2]
  if x > x_2:
    minimum = min(minimum, p[x - x_2 - 1])
  if y > y_2:
    minimum = min(minimum, q[y - y_2 - 1])
  
  if x > x_2 and minimum == p[x - x_2 - 1]:
    x_2 += 1
  elif y > y_2 and minimum == q[y - y_2 - 1]:
    y_2 += 1

print(sum(p[:(x - x_2)]) + sum(q[:(y - y_2)]) + sum(r[:(x_2 + y_2)]))

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

int main(){
	int n;
	cin >> n;
	unordered_map<string,long long> s(n);
	long long count=0;
	for (int i = 0;i < n;i++) {
		string strInput;
		cin >> strInput;
		sort(strInput.begin(), strInput.end());
		if (s.count(strInput)) {
			count += (++s[strInput]);
		}
		else {
			s.insert({ strInput, 0 });
		}
	}
	
	cout <<count<< endl;

	return 0;
}


Measured memory_bytes: 10496
N = int(input())
A = list(map(int, input().split()))
ans = A[0]
if A.count(0) != 0:
    ans = 0
else:
    for i in range(1,N):
        ans = ans * A[i]
        if ans > 10 ** 18:
            ans = -1
            break
print(ans)

Measured memory_bytes: 21644
x,y,z,k = map(int,input().split())
lisa = list(map(int,input().split()))
lisb = list(map(int,input().split()))
lisc = list(map(int,input().split()))
lisa.sort(reverse=True)
lisb.sort(reverse=True)
lisc.sort(reverse=True)
an = []
ans = []
for i in range(x):
    for j in range(y):
        an.append(lisa[i]+lisb[j])
an.sort(reverse=True)
an = an[:min(3001,x*y*z+1)]
for num in lisc:
    for nu in an:
        ans.append(num+nu)
ans.sort(reverse=True)
for i in range(k):
    print(ans[i])

Measured memory_bytes: 161776
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <numeric>
#include <iomanip>
#include <map>
#include <set>
#include <deque>
#include <utility>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repk(i, k, n) for (int i = k; i < n; i++)
#define MOD 1e9 + 7
#define INF 1e9
#define SENTINEL 2e9
#define PIE 3.14159265358979323

template <class T>
inline bool chmin(T &a, T b) {if (a > b) {a = b; return true;} return false;}
template <class T>
inline bool chmax(T &a, T b) {if (a < b) {a = b; return true;} return false;}
template <class T>
T GCD(T a, T b) {if (b == 0) return a; else return GCD(b, a % b);}
template <class T>
inline T LCM(T a, T b) { return (a * b) / GCD(a, b);}

void maxheapify(vector<int> &v, int i, int h){
    int left = i * 2;
    int right = left + 1;
    int largest;
    if (left <= h + 1 && v[left] > v[i])
        largest = left;
    else
        largest = i;
    if (right <= h + 1 && v[right] > v[largest])
        largest = right;
    if (largest != i){
        swap(v[i], v[largest]);
        maxheapify(v, largest, h);
    }
}

void buildheap(vector<int> &v, int h){
    for (int i = (h + 1) / 2; i != 0; i--){
        maxheapify(v, i, h);
    }
}

int main(){
    int h;
    cin >> h;
    vector<int> v(h + 1, 0);
    v[0] = 0;
    for (int i = 0; i < h; i++)
        cin >> v[i + 1];
    buildheap(v, h);
    for (int i = 0; i < h; i++)
        cout << ' ' << v[i + 1];
    cout << endl;
    return 0;
}


Measured memory_bytes: 4580
A, B, C, X, Y = map(int, input().split())

COMMON = min(X, Y)
P1 = (A * X) + (B * Y)
P2 = (COMMON * (C * 2) + (X - COMMON) * A + (Y - COMMON) * B)
P3 = (COMMON * (C * 2) + (X - COMMON) * (C*2) + (Y - COMMON) * B)
P4 = (COMMON * (C * 2) + (X - COMMON) * A + (Y - COMMON) * (C*2))
print(min(P1, P2, P3, P4))

Measured memory_bytes: 3064
#[macro_export]
macro_rules !read_value {($iter :expr ,($($t :tt ) ,*) ) =>{($(read_value !($iter ,$t ) ) ,*) } ;($iter :expr ,[$t :tt ;$len :expr ] ) =>{(0 ..$len ) .map (|_ |read_value !($iter ,$t ) ) .collect ::<Vec <_ >>() } ;($iter :expr ,{$t :tt =>$f :expr } ) =>{$f (read_value !($iter ,$t ) ) } ;($iter :expr ,chars ) =>{read_value !($iter ,String ) .chars () .collect ::<Vec <char >>() } ;($iter :expr ,usize1 ) =>{read_value !($iter ,usize ) -1 } ;($iter :expr ,$t :ty ) =>{$iter .next () .unwrap () .parse ::<$t >() .unwrap () } ;}
#[macro_export]
macro_rules !input_inner {($iter :expr ) =>{} ;($iter :expr ,) =>{} ;($iter :expr ,mut $var :ident :$t :tt $($r :tt ) *) =>{let mut $var =read_value !($iter ,$t ) ;input_inner !{$iter $($r ) *} } ;($iter :expr ,mut $var :ident $($r :tt ) *) =>{input_inner !{$iter ,mut $var :usize $($r ) *} } ;($iter :expr ,$var :ident :$t :tt $($r :tt ) *) =>{let $var =read_value !($iter ,$t ) ;input_inner !{$iter $($r ) *} } ;($iter :expr ,$var :ident $($r :tt ) *) =>{input_inner !{$iter ,$var :usize $($r ) *} } ;}
#[macro_export]
macro_rules !input {(source =$s :expr ,$($r :tt ) *) =>{let mut iter =$s .split_whitespace () ;input_inner !{iter ,$($r ) *} } ;(iter =$iter :ident ,$($r :tt ) *) =>{let s ={use std ::io ::Read ;let mut s =String ::new () ;std ::io ::stdin () .read_to_string (&mut s ) .unwrap () ;s } ;let mut $iter =s .split_whitespace () ;input_inner !{$iter ,$($r ) *} } ;($($r :tt ) *) =>{let s ={use std ::io ::Read ;let mut s =String ::new () ;std ::io ::stdin () .read_to_string (&mut s ) .unwrap () ;s } ;let mut iter =s .split_whitespace () ;input_inner !{iter ,$($r ) *} } ;}
fn main() {
    #[allow(unused_imports)]
    use std::io::Write as _;
    let __out = std::io::stdout();
    #[allow(unused_mut, unused_variables)]
    let mut __out = std::io::BufWriter::new(__out.lock());
    #[allow(unused_macros)]
    macro_rules !print {($($arg :tt ) *) =>(::std ::write !(__out ,$($arg ) *) .unwrap () ) }
    #[allow(unused_macros)]
    macro_rules !println {($($arg :tt ) *) =>(::std ::writeln !(__out ,$($arg ) *) .unwrap () ) }
    #[allow(unused_macros)]
    macro_rules! echo {
        ($iter :expr ) => {
            echo!($iter, "\n")
        };
        ($iter :expr ,$sep :expr ) => {
            let mut iter = $iter;
            if let Some(item) = iter.next() {
                print!("{}", item);
            }
            for item in iter {
                print!("{}{}", $sep, item);
            }
            println!();
        };
    }
    input!(n, a: [usize; n], q, bc: [(usize, usize); q]);
    let mut mp = std::collections::HashMap::new();
    let mut ans = 0usize;
    for &a in a.iter() {
        ans += a;
        *mp.entry(a).or_insert(0) += 1;
    }
    for &(b, c) in bc.iter() {
        let x = mp.entry(b).or_insert(0);
        let y = *x;
        *x = 0;
        ans -= b * y;
        ans += c * y;
        *mp.entry(c).or_insert(0) += y;
        println!("{}", ans);
    }
}


Measured memory_bytes: 9564
import sys
while 1:
	H, W = map(int, raw_input().split())
	if H == 0 and W == 0:
		break
	else:
		for h in range(0, H):
			for w in range(0, W):
				if h == 0 or h == H - 1 or w == 0 or w == W -1:
					sys.stdout.write("#")
				else:
					sys.stdout.write(".")
			print ""
		print ""

Measured memory_bytes: 4212
n = int(input())
v = []
for i in range(n):
    v_i = list(map(int,input().split()))[2:]
    v.append(v_i)
    
d = [-1]*n
d[0]=0
queue = [1]
dis = 1
while len(queue)!=0:
    queue2 = []
    for i in queue:
        for nex in v[i-1]:
            if d[nex-1]==-1:
                d[nex-1]=dis
                queue2.append(nex)
    dis +=1
    queue = queue2

for i in range(n):
    print(i+1,d[i])


Measured memory_bytes: 5620
/*
    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 = 110;
const int MAXM = 1000;
const int MAXK = 16;
const int MAXQ = 200010;

string a;
int K;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(nullptr);
    cin >> a >> K;
    int n = SZ(a);
    int res = 0;
    FOR(len,K,n) {
        if (len < n) {
            if (K == 1) {
                res += 9;
            }
            else if (K == 2) {
                FOR(j,2,len) res += 9 * 9;
            }
            else {
                FOR(j,2,len)
                    FOR(k,j+1,len) res += 9 * 9 * 9;
            }
        }
        else {
            if (K == 1) {
                res += a[0] - '0' - 1;
            }
            else if (K == 2) {
                FOR(j,2,len) res += (a[0] - '0' - 1) * 9;
            }
            else {
                FOR(j,2,len)
                    FOR(k,j+1,len) res += (a[0] - '0' - 1) * 9 * 9;
            }
            
            if (K == 1) res++;

            if (K == 2) {
                bool hasBigger = false;
                FOR(j,2,len) {
                    if (hasBigger) res += 9;
                    else {
                        if (a[j-1] > '0') {
                            res += a[j-1] - '0';
                            hasBigger = true;
                        }
                    }
                }
            }

            if (K == 3) {
                bool hasBigger = false;
                FOR(j,2,len) {
                    if (hasBigger) {
                        FOR(k,j+1,len) res += 9 * 9;
                    }
                    else {
                        if (a[j-1] > '0') {
                            bool hasBigger2 = false;
                            FOR(k,j+1,len) {
                                if (hasBigger2) res += (a[j-1] - '0') * 9;
                                else {
                                    if (a[k-1] > '0') {
                                        res += (a[j-1] - '0' - 1) * 9 + (a[k-1] - '0');
                                        hasBigger2 = true;
                                    }
                                }
                            }
                            hasBigger = true;
                        }
                    }
                }
            }
        }
    }
    cout << res;
    return 0;
}


Measured memory_bytes: 256
import java.util.*;

class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
        double a = sc.nextDouble();
        double b = sc.nextDouble();
        int h = sc.nextInt();
        int m = sc.nextInt();
        int time = h*60 + m;
        
        double len = 0;
        double rad = 0;
        double hh = 0;
        double mm = 0;

        for(int i=0; i<time; i++) {
            hh += 0.5;
            mm += 6;
        }
        hh = hh % 360;
        mm = mm % 360;
        //System.out.println(hh);
        //System.out.println(mm);
        rad = Math.abs(hh - mm);


        len = Math.sqrt(Math.pow(a,2)+Math.pow(b,2) - 2*a*b* Math.cos(Math.toRadians(rad)));
        System.out.println(len);
    }
}

Measured memory_bytes: 37460
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define invrepr(i,a,b) for(int i=b-1;i>=a;i--)
#define invrep(i,n) invrepr(i,0,n)
#define repitr(itr,a) for(auto itr=a.begin();itr!=a.end();++itr)
#define P pair<int,int>
const int MOD=1e9+7;
const ll INF=2e18;
const double PI=acos(-1);


int main() {
    ios_base::sync_with_stdio(false); 

    ll n,k;
    cin >> n >> k;
    ll ans=0;
    repr(i,1,n+1) {
        ll p=(n+1)/i;
        ll r=(n+1)%i;
        ll c=(i-k>0)?i-k:0;
        ll d=(r-k>0)?r-k:0;
        ans+=p*c+d;
        if (k==0) --ans;
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3656
#include <bits/stdc++.h>
#define pb push_back
using namespace std;
const int INF=0x3f3f3f3f;
const int maxn=105;

struct edge{int to,cap,cost,rev;};

int n,m,k;
int d[maxn];
int a[maxn];
int p1[maxn];
int p2[maxn];
bool inq[maxn];
vector<edge>G[maxn];

void add_edge(int u,int v,int c,int w) {
	G[u].pb(edge{v,c,w,int(G[v].size())});
	G[v].pb(edge{u,0,-w,int(G[u].size()-1)});
}

int mcmf(int s,int t) {
	int flow=0 , cost=0;
	while (1) {
		memset(d,0x3f,sizeof(d));
		d[s]=0; a[s]=max(0,k-flow);
		int qh=0,qt=0,q[maxn];
		q[qt++]=s; inq[s]=1;
		while (qh!=qt) {
			int u=q[qh++]; if (qh>=maxn) qh=0;
			inq[u]=0;
			for (int i=0;i<G[u].size();i++) {
				edge e=G[u][i];
				if (d[e.to]>d[u]+e.cost && e.cap) {
					d[e.to]=d[u]+e.cost;
					a[e.to]=min(a[u],e.cap);
					p1[e.to]=u;
					p2[e.to]=i;
					if (!inq[e.to]) {
						q[qt++]=e.to; if (qt>=maxn) qt=0;
						inq[e.to]=1;
					}
				}
			}
		}
		if (d[t]==INF || !a[t]) break;
		flow+=a[t];
		cost+=a[t]*d[t];
		for (int u=t;u!=s;u=p1[u]) {
			edge& e=G[p1[u]][p2[u]];
			e.cap-=a[t];
			G[e.to][e.rev].cap+=a[t];
		}
	}
	if (flow<k) return -1;
	else return cost;
}

int main() {
	cin>>n>>m>>k;
	for (int i=0;i<m;i++) {
		int u,v,c,w; cin>>u>>v>>c>>w;
		add_edge(u,v,c,w);
	}
	cout<<mcmf(0,n-1)<<'\n';
}



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

using namespace std;

#define pb push_back
#define endl '\n'
#define all(x) (x).begin(),(x).end()
#define ff first
#define ss second
#define sz(x) (int)(x).size()
#define f(n) for(int i=0;i<n;++i)
#define f2(n) for(int j=0;j<n;++j)
#define f3(n) for(int k=0;k<n;++k)
#define F(i,x,n,y) for(i=x;i<n;i+=1)
#define fi(i) for(i=0;i<n;++i)
#define fa(x,y) for(auto x:y)

//Warsaw debug template
#define LOCAL
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
    enable_if<sizeof dud<c>(0) x 1,debug&>::type operator<<(c i){
sim > struct rge {c b,e;};
sim > rge<c> range(c i, c j) {return rge<c>{i,j};}
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug{
#ifdef LOCAL
~debug() {cerr<<endl; }
eni(!=) cerr<< boolalpha << i; ris;}
eni(==) ris <<range(begin(i),end(i)); }
sim, class b dor(pair<b,c> d){
ris<<"("<<d.first<<","<<d.second<<")";
}
sim dor(rge<c> d){
    *this << "[";
    for(auto it=d.b;it!=d.e;++it)
        *this <<"," +(it==d.b)<< *it;
    ris<<"]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) "["<<#__VA_ARGS__":"<<(__VA_ARGS__)<<"]"
//End of debug template        
    

typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef long long ll;


int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n,k;
    cin>>n>>k;
    f(n){
        int x;
        cin>>x;
    }
    int ans=1;
    if(n>k){
        n-=k;
        ans+=n/(k-1);
        if(n%(k-1)!=0) ++ans;
    }
    cout<<ans<<endl;

    return 0;
}


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

int main() {
  int ans = 0;
  int n, a, b;
  cin >> n >> a >> b;

  rep (i, n+1) {
    int k1 = i / 10000;
    int k2 = (i - k1*10000) / 1000;
    int k3 = (i - k1*10000 - k2*1000) / 100;
    int k4 = (i - k1*10000 - k2*1000 -k3*100) / 10;
    int k5 = (i - k1*10000 - k2*1000 -k3*100 - k4*10);

    // cout << k1 << ", " << k2 << ", " << k3 << ", " << k4 << ", " << k5 << endl;
    int sum = k1 + k2 + k3 + k4 + k5;
    if (a <= sum && sum <= b) {
      // cout << i << endl;
      ans += i;
    }
  }

  cout << ans << endl;
  return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <climits>
#include <cmath>
#include <algorithm>
#include <utility>
#include <vector>
#include <string>
#include <stack>
#include <set>
using namespace std;
#define MAX 
int main() {
	string a, b, c,r;
	bool flg = true;
	cin >> a >> b >> c;
	char ch;
	ch = a[0];
	a = a.substr(1, a.size());
	while (flg) {
		switch (ch) {
		case 'a':
			if (a.size() == 0) {
				r = 'A';
				flg = false;
				break;
			}
			ch = a[0];
			a = a.substr(1, a.size());
			break;
		case 'b':
			if (b.size() == 0) {
				r = 'B';
				flg = false;
				break;
			}
			ch = b[0];
			b = b.substr(1, b.size());
			break;
		case 'c':
			if (c.size() == 0) {
				r = 'C';
				flg = false;
				break;
			}
			ch = c[0];
			c = c.substr(1, c.size());
			break;
		}

	}
	cout << r << endl;
	return 0;
}

Measured memory_bytes: 384
import sys

input = sys.stdin.readline


def main():
    N, D = map(int, input().split())
    X = [0] * N
    Y = [0] * N
    for i in range(N):
        X[i], Y[i] = map(int, input().split())

    D_2 = D ** 2
    ans = 0
    for x, y in zip(X, Y):
        dist = x ** 2 + y ** 2
        if dist <= D_2:
            ans += 1

    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 24700
#include <stdio.h>

int main(){
	int inp;
	scanf("%d", &inp);
	int a=inp/100, b=inp%100/10, c=inp%100%10;
	if(a==7 || b==7 || c==7){
		printf("Yes");
	}else{
		printf("No");
	}
	
	
	return 0;
}

Measured memory_bytes: 1708
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String line = "";
        while (!(line = br.readLine()).equals("-")) {
            int n = Integer.parseInt(br.readLine());
            for (int i = 0; i < n; i++) {
                int m = Integer.parseInt(br.readLine());
                line = line.substring(m) + line.substring(0, m);
            }
            System.out.println(line);
        }
    }
}

Measured memory_bytes: 24376
#include <iostream>
#include<vector>
#include<algorithm>
#include<map>
#include<queue>
using namespace std;
typedef long long ll;

const ll MOD_CONST = 1000000007;



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

	vector<int> prime;
	prime.emplace_back(2);
	for (int i = 3; i <= 55555; i++) {
		bool isPrime = true;
		for (int p : prime) {
			if (i % p == 0) {
				isPrime = false;
				break;
			}
		}

		if (isPrime) {
			prime.emplace_back(i);
		}
	}

	vector<int> p1;
	for (int p : prime) {
		//cout << p << endl;
		if (p % 5 == 1) {
			p1.emplace_back(p);
		}
	}
	
	if (p1.size() >= n) {
		for (int i = 0; i < n; i++) {
			cout << p1[i] << " ";
		}
	}
}  



Measured memory_bytes: 384
#include<iostream>
#include<set>
#include<algorithm>

using namespace std;


int main(){

    int m;
    cin>> m;
    string s[m];
    for(int i=0; i<m; i++) cin>> s[i];

    for(int i=0; i<m; i++){
        set<string> S;
        for(int j=0; j<s[i].size(); j++){
            string t=s[i].substr(0, j);
            string u=s[i].substr(j);
            S.insert(t+u); S.insert(u+t);
            reverse(t.begin(), t.end());
            S.insert(t+u); S.insert(u+t);
            reverse(u.begin(), u.end());
            S.insert(t+u); S.insert(u+t);
            reverse(t.begin(), t.end());
            S.insert(t+u); S.insert(u+t);
        }
        cout<< S.size()<< endl;
    }

    return 0;
}

Measured memory_bytes: 3168
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define sz(x) (int)(x).size()
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define EPS (1e-10)
#define equals(a, b) (fabs((a)-(b)) < EPS)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef set<int> S;
typedef queue<int> Q;
typedef queue<P> QP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
const int MOD = 1000000007;

 
int main() {
  int N,K;
  cin >> N >> K;
  vi A(N);
  rep(i,N) {
    cin >> A[i];
  }
  rep(ki,K) {
    vi imos(N+1,0);
    rep(i,N) {
      int d = A[i];
      int l = max(0,i-d);
      int r = min(N-1,i+d);
      imos[l]++;
      imos[r+1]--;
    }
    bool comp=true;
    rep(i,N) {
      imos[i+1] += imos[i];
      if(imos[i]<N) {
        comp=false;
      }
    }
    if(comp) {
      rep(i,N) {
        cout << imos[i] << " ";
      }
      cout << endl;
      return 0;
    }
    rep(i,N) {
      A[i] = imos[i];
    }
  }
  rep(i,N) {
    cout << A[i] << " ";
  }
  cout << endl;
  return 0;
}

Measured memory_bytes: 4844
#include <bits/stdc++.h>
using namespace std;
long long a[200010];
int main(){
	int n;
	cin>>n;
	long long sum=0;
	long long ans=0;
	for(int i=0;i<n;i++){
		cin>>a[i];
		ans+=1LL*sum*a[i];
		sum+=a[i];
		ans%=(1000000000+7);
		sum%=(1000000000+7);
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 5196
N,M,X = map(int, input().split())
C = []
for i in range(N):
    C.append(list(map(int,input().split())))


import itertools
L = [0, 1] #生成する数字
num = N #生成するビット数
bl = list(itertools.product([0, 1], repeat=num))

acost = 10**9

for i in range(len(bl)):
    tcost = 0
    tskill = [0]*M
    t = bl[i]
    for j in range(N):
        if t[j] == 1:
            tcost += C[j][0]
            for k in range(M):
                tskill[k] += C[j][k+1]
    if min(tskill) >= X:
        if acost > tcost:
            acost = tcost
            
if acost == 10**9:
    print(-1)
else:
    print(acost)

Measured memory_bytes: 9656
#include <cstdio>
#include <cstring>
#include <string>

using namespace std;

int main()
{
	string bs[10]={
		"",".,!? ","abc","def","ghi","jkl","mno","pqrs","tuv","wxyz",
	};
	
	int tc; scanf("%d",&tc);
	while(tc--){
		char s[1025]; scanf("%s",s);
		int n=strlen(s);
		for(int i=0,j;i<n;i=j+1){
			string& b=bs[s[i]-'0'];
			for(j=i;j<n && s[j]>'0';j++);
			if(j==i) continue;
			putchar(b[(j-1-i)%b.size()]);
		}
		puts("");
	}
	
	return 0;
}

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

int main() {
    int H, W;
    cin >> H >> W;
    vector<vector<char>> S(H + 2, vector<char>(W + 2, '_'));
    for (int i = 1; i <= H; i++) {
        for (int j = 1; j <= W; j++) {
            cin >> S[i][j];
        }
    }

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

    for (int i = 1; i <= H; i++) {
        for (int j = 1; j <= W; j++) {
            if (S[i][j] == '#') continue;
            int cnt = 0;
            for (int k = 0; k < 8; k++) {
                int nx = j + dx[k];
                int ny = i + dy[k];
                if (S[ny][nx] == '#') cnt++;
            }
            S[i][j] = ('0' + cnt);
        }
    }

    for (int i = 1; i <= H; i++) {
        for (int j = 1; j <= W; j++) {
            cout << S[i][j];
        }
        cout << endl;
    }
    return 0;
}

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

using ll = long long;
#define debug(x) cerr << #x << ": " << x << endl;
#define line() cerr << "---------------" << endl;

int main() {
   int n;
   cin >> n;
   int even = 0;
   int all = 1;
   for (int i = 0; i < n; i++) {
      int a;
      cin >> a;
      if (a % 2 == 0) {
         even++;
      }
      all *= 3;
   }

   cout << all - (1 << even) << endl;

   return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define endl '\n'
#define mod 1000000007
#define ll long long
#define trace(x) cerr << #x << " = " << x << endl
using namespace std;

/*#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
  
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
*/
int main()
{
   /*
    #ifndef ONLINE_JUDGE
      freopen("input.txt","r",stdin);
      freopen("ouput.txt","w",stdout);
    #endif 
   */

    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int t = 1;
    while(t--){
          int n;
	  cin>>n;
	  vector<ll> v(n);
	  for(auto &it : v) cin>>it;
	  ll stool = 0;
	  ll diff;
	  for(int i = 1; i < n; i++){
		  diff = abs(v[i] - v[i-1]);
		  if(v[i] > v[i-1]){
			  //stool += diff;
			  continue;
		  }
		  else{
			 stool += diff; 
		         v[i] += diff;
		  }
	  }
	  cout<<stool<<endl;

    }
    return 0;
} 


Measured memory_bytes: 4752
n,k,q = gets.split.map(&:to_i)
ary = [0] * (n + 1)
q.times do
  i = gets.to_i
  ary[i] += 1
end

(1..n).each do |i|
  if (k - q + ary[i]) > 0
    puts 'Yes'
  else
    puts 'No'
  end
end




Measured memory_bytes: 3196
N = int(input())

prime_list = [0 for i in range(N+1)]
for i in range(2, N+1):
    cur = i
    for j in range(2, i+1):
        while cur % j == 0:
            prime_list[j] += 1
            cur //= j
            
def num(m):
    return len(list(filter(lambda x: x >= m-1, prime_list)))

print(num(75) + num(25) * (num(3) - 1) + num(15) * (num(5) - 1)
    + num(5) * (num(5) - 1) * (num(3) - 2) // 2)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<int(N);++i)
#define rep1(i,N) for(int i=1;i<int(N);++i)
#define all(a) (a).begin(),(a).end()
#define print(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<_<<", "; cerr<<"]"<<endl; }
#define printpair(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<"{"<<_.first<<","<<_.second<<"}"<<", "; cerr<<"]"<<endl; }

typedef long long ll;

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

const int INF = 1e9;
const ll INFLL = 1e18;
const ll MOD = 1e9+7;
const double PI = acos(-1.0);

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

/*------------------------------------/
for library*/

/*------------------------------------*/

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    int M,D;
    int N,E;
    cin>>M>>D>>N>>E;
    if(M!=N){
        cout<<1<<endl;
    }else{
        cout<<0<<endl;
    }
}

Measured memory_bytes: 256
count = [Hash.new(0), Hash.new(0)]

while gets
    $_.split.map(&:to_f).each.with_index do |e, i|
        g = case e
            when 0 ... 0.2;   ?D
            when 0.2 ... 0.6; ?C
            when 0.6 ... 1.1; ?B
            else;             ?A
        end
        count[i][g] += 1
    end
end

%w(A B C D).each do |g|
    puts [count[0][g], count[1][g]] * ' '
end

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

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

	if (A >= 13) {
		C = B;
	}
	else if (A >= 6) {
		C = B / 2;
	}
	else C = 0;
	cout << C << endl; //print
}

Measured memory_bytes: 256
/*BY-ADITYA OJHA
  LEARN DSA SINCERELY*/
#include <bits/stdc++.h>
#define ll long long int
#define forin for(int i=0;i<n;i++)
#define forjn for(int j=0;j<n;j++)
#define pb push_back
#define vx vector<ll> x
#define fas1  ios_base::sync_with_stdio(false)
#define fas2   cin.tie(NULL)
using namespace std;


int main()
{
     fas1;
     fas2;
    ll a,b;
    cin>>a>>b;
    if(a>=b)
    {
        for(int i=0;i<a;i++)cout<<b;
    }else
     for(int i=0;i<b;i++)cout<<a;



    return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); ++i)
#define all(x) x.begin(),x.end()
#define ln '\n'
const long long MOD = 1000000007LL;
//const long long MOD = 998244353LL;
typedef long long ll;
typedef unsigned long long ull; 
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
template<class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true;} return false; }
template<class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true;} return false; }
///////////////////////////////////////////////////////////////////////////////////////////////////

vector<vector<int>> G;

int dfs(int v, int pv) {
    int ret = 0;
    for (auto nv: G[v]) {
        if (pv==nv) continue;
        ret ^= dfs(nv,v);
    }
    return v ? ret+1 : ret;
}
int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    int N; cin >> N;
    G.resize(N);
    rep(i,N-1) {
        int u,v; cin >> u >> v;
        --u; --v;
        G[u].emplace_back(v);
        G[v].emplace_back(u);
    }

    cout << (dfs(0,-1) ? "Alice" : "Bob") << ln;
}

Measured memory_bytes: 8448
//#pragma GCC optimize("03,unroll-loops")
//#pragma GCC target("avx,avx2,fma")

#include<bits/stdc++.h>
typedef long long ll;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ordered_set tree<int, null_type,less_equal<int>, rb_tree_tag,tree_order_statistics_node_update>
#define pb           push_back
#define ff           first
#define ss           second
#define gcd(a, b)    __gcd(a, b)
#define lcm(a, b)    ((a)*((b)/gcd(a,b)))
#define all(v)       v.begin(),v.end()
#define lllim        2147483648
#define Pi           2*acos(0.0)
#define sci(n)	     scanf("%d",&n)
#define scii(n,m)    scanf("%d%d",&n,&m)
#define scl(n)       scanf("%lld",&n)
#define scll(n,m)    scanf("%lld%lld",&n,&m)
#define pii          pair<int,int>
#define pll 	     pair<ll,ll>
#define mem(a,b)     memset(a, b, sizeof(a))
#define fill_(a,b)   fill(a,a+n,b);
#define MOD          1000000007
#define fast_cin     ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define filein       freopen("input.txt","r", stdin)
#define watch(x)     cerr << __LINE__ << ": " << #x << " = " << (x) << '\n'
#define case		 int t,cas=1;cin>>t;while(t--)
#define forn(i,a,n)  for(int i=a;a==0?i<n:i<=n;i++)



/*------------------------------Graph Moves----------------------------*/
//const int fx[]= {+1,-1,+0,+0};
//const int fy[]= {+0,+0,+1,-1};
//const int fx[]= {+0,+0,+1,-1,-1,+1,-1,+1};  // Kings Move
//const int fy[]= {-1,+1,+0,+0,+1,+1,-1,-1}; // Kings Move
//const int fx[]={-2, -2, -1, -1,  1,  1,  2,  2};  // Knights Move
//const int fy[]={-1,  1, -2,  2, -2,  2, -1,  1}; // Knights Move
/*---------------------------------------------------------------------*/

using namespace std;
using namespace __gnu_pbds;

const int maxn=1e5+5;


void solve()
{
	int n=5;
	int ans=1;
	forn(i,1,n)
	{int a;
		cin>>a;
		if(a==0)
		{
			ans=i;
		}
	}
	
	cout<<ans<<endl;
   


}


int main()
{
    fast_cin;
    //case
    {
        //cout<<""<<cas++<<""<<endl;
        solve();
    }

    return 0;
}


Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define mp(a,b) make_pair((a),(b))
#define pb(a) push_back((a))
#define all(x) (x).begin(),(x).end()
#define uniq(x) sort(all(x)),(x).erase(unique(all(x)),end(x))
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

#define INF 2147483600

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

  long diff=0;
  int res=1;
  repl(i,1,n){
    long ndiff = vec[i]-vec[i-1];
    if(ndiff*diff==0){
      if(ndiff!=0) diff = ndiff;
    }
    else if(ndiff*diff>0) diff=ndiff;
    else {
      res++;
      diff=0;
    }
  }

  cout << res << endl;

  return 0;
}


Measured memory_bytes: 764
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vin=vector<int>;
using vll=vector<long long>;
using vvin=vector<vector<int>>;
using vvll=vector<vector<long long>>;
using vstr=vector<string>;
using vvstr=vector<vector<string>>;
using vch=vector<char>;
using vvch=vector<vector<char>>;
using vbo=vector<bool>;
using vvbo=vector<vector<bool>>;
using vpii=vector<pair<int,int>>;
using pqsin=priority_queue<int,vector<int>,greater<int>>;
#define mp make_pair
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep2(i,s,n) for(int i=(s);i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define decp(n) cout<<fixed<<setprecision((int)n)
#define _GLIBCXX_DEBUG
const int inf=1e9+7;

int main(){
    int n,k,q;cin>>n>>k>>q;
    vin a(q);
    rep(i,q)cin>>a[i];
    vin s(n);
    rep(i,q)s[a[i]-1]++;
    rep(i,n){
        if(k-q+s[i]>0)cout<<"Yes"<<endl;
        else cout<<"No"<<endl;
    }
}

Measured memory_bytes: 1408
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
 
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
 
using namespace std;
using namespace __gnu_pbds;
 
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;
 
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
 
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;
 
template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;
 
#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); 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 sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 1000001; //check the limits, dummy

pi demap(int X) {
	int A = X % 1000;
	int B = X / 1000;
	return {B, A};
}

int mapTo(pi X) {
	return min(X.f, X.s) * 1000 + max(X.f, X.s);
}
 
int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);    
	
	int N; cin >> N;
	
	vector<vi> graph(MX);
	
	int ind[MX]; F0R(i, MX) ind[i] = 0;
	
	F0R(i, N) {
		int lst; cin >> lst; lst--;
		F0R(j, N-2) {
			int cur; cin >> cur; cur--;
			
			int ear = mapTo({i, lst});
			int lat = mapTo({i, cur});
			graph[ear].pb(lat);
			ind[lat]++;
			lst = cur;
		}
		
	}
	
	vi tbr;
	F0R(i, MX) if (ind[i] == 0) tbr.pb(i);
	
	int proc = 0;
	
	int day = 0;
	
	while (sz(tbr) != 0) {
		day++;
		proc += sz(tbr);
		
		vi nxtTbr;
		
		F0R(x, sz(tbr)) {
			//if (demap(tbr[x]).f < 4 && demap(tbr[x]).s < 4) cout << "on day " << day << " processed " << demap(tbr[x]).f << " " << demap(tbr[x]).s << endl;
			int i = tbr[x];
			F0R(y, sz(graph[i])) {
				int nxt = graph[i][y];
				ind[nxt]--;
				if (ind[nxt] == 0) nxtTbr.pb(nxt);
			}
			
		}
		
		tbr = nxtTbr;
	}
	
	if (proc != MX) {
		cout << -1 << endl;
	} else {
		cout << day << endl;
	}
	
	return 0;
}
 
// read the question correctly (ll vs int)
// template by bqi343


Measured memory_bytes: 45432