akhauriyash/Code-Regression huggingface dataset:
#include"bits/stdc++.h"
using namespace std;
typedef long long ll;

int main() {

     ll n;
     cin>>n;
     ll s = 0;
     for(int i=0; i<=n; i++) {
        if(i%3 !=0 && i%5 != 0) s += i;
     }
     cout<<s;
}


Measured memory_bytes: 3652
#include <bits/stdc++.h>
#define dbug(x) cout<<#x<<"="<<x<<endl
using namespace std;
template <typename T> void read(T &t) {
	t=0; char ch=getchar(); int f=1;
	while ('0'>ch||ch>'9') { if (ch=='-') f=-1; ch=getchar(); }
	do {(t*=10)+=ch-'0';ch=getchar();} while ('0'<=ch&&ch<='9'); t*=f;
}
int a;
int main() {
	//freopen("1.txt","r",stdin);
	read(a);
	printf("%d\n",3*a*a);
	return 0;
}

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

int main()
{
  int N;
  cin >> N;
  vector<int> L(N);
  rep(i, N)
  {
    cin >> L[i];
  }
  int max_len;
  int sum = 0;
  string ans = "No";
  sort(L.rbegin(), L.rend());
  max_len = L[0];
  rep(i, N - 1)
  {
    sum += L[i + 1];
  }
  if (max_len < sum)
    ans = "Yes";

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

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		String a =scanner.nextLine();
		String b = a+a;
		String c = scanner.nextLine();
		if(b.contains(c))
			System.out.println("Yes");
		else
			System.out.println("No");
		
	}
}

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

using namespace std;

int main(int argc, const char *argv[]) {
  //
  int h, w, m;
  cin >> h >> w >> m;

  vector<pair<int, int>> tgts(m);
  vector<int> cnt_row(h, 0), cnt_col(w, 0);
  for (int i = 0; i < m; ++i) {
    cin >> tgts[i].first >> tgts[i].second;
    tgts[i].first--;
    tgts[i].second--;
    cnt_row[tgts[i].first]++;
    cnt_col[tgts[i].second]++;
  }

  sort(tgts.begin(), tgts.end());

  int max_col = *max_element(cnt_col.begin(), cnt_col.end());
  int max_row = *max_element(cnt_row.begin(), cnt_row.end());

  int cnt1 = 0, cnt2 = 0;
  vector<int> vr, vc;
  for (int i = 0; i < cnt_row.size(); i++) {
    if (cnt_row[i] == max_row) {
      vr.push_back(i);
    }
  }

  for (int i = 0; i < cnt_col.size(); i++) {
    if (cnt_col[i] == max_col) {
      vc.push_back(i);
    }
  }

  for (auto r : vr) {
    for (auto c : vc) {
      auto p = make_pair(r, c);
      if (!binary_search(tgts.begin(), tgts.end(), p)) {
        cout << max_col + max_row << '\n';
        return 0;
      }
    }
  }

  cout << max_col + max_row - 1 << '\n';

  return 0;
}

Measured memory_bytes: 12056
//#define _DEBUG
#include "bits/stdc++.h"
#define CHOOSE(a) CHOOSE2 a
#define CHOOSE2(a0,a1,a2,a3,a4,x,...) x
#define debug_1(x1) cout<<#x1<<": "<<x1<<endl
#define debug_2(x1,x2) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<endl
#define debug_3(x1,x2,x3) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<", "#x3<<": "<<x3<<endl
#define debug_4(x1,x2,x3,x4) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<", "#x3<<": "<<x3<<", "#x4<<": "<<x4<<endl
#define debug_5(x1,x2,x3,x4,x5) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<", "#x3<<": "<<x3<<", "#x4<<": "<<x4<<", "#x5<<": "<<x5<<endl
#ifdef _DEBUG
#define debug(...) CHOOSE((__VA_ARGS__,debug_5,debug_4,debug_3,debug_2,debug_1,~))(__VA_ARGS__)
#else
#define debug(...)
#endif
#define rep(index,num) for(int index=0;index<(int)num;index++)
#define rep1(index,num) for(int index=1;index<=(int)num;index++)
#define brep(index,num) for(int index=(int)num-1;index>=0;index--)
#define brep1(index,num) for(int index=(int)num;index>0;index--)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-7
#define mp(a1,a2) make_pair(a1,a2)
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
typedef long long ll;
typedef long double ld;
using namespace std;
typedef pair<ll,ll> pll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
typedef vector<pll> vpll;
ll INFl=(ll)1e+18+1;
int INF=1e+9+1;
int main(){
	int H,W;
	char s[103][103];
	int mind[103][103];
	scan(H>>W);
	fill(mind[0],mind[103],INF);
	rep(i,H){
		scan(s[i]);
	}
	if(s[0][0]=='.') mind[0][0]=0;
	else mind[0][0]=1;
	rep(k,H+W-2){
		rep(j,W){
			int i=k-j;
			if(0<=j&&j<W&&0<=i&&i<H){
				if(i<H-1){
					if(s[i][j]=='.'&&s[i+1][j]=='#') mind[i+1][j]=min(mind[i+1][j],mind[i][j]+1);
					else mind[i+1][j]=min(mind[i+1][j],mind[i][j]);
				}
				if(j<W-1){
					if(s[i][j]=='.'&&s[i][j+1]=='#') mind[i][j+1]=min(mind[i][j+1],mind[i][j]+1);
					else mind[i][j+1]=min(mind[i][j+1],mind[i][j]);
				}
			}
		}
	}
	prin(mind[H-1][W-1]);
	return 0;
}


Measured memory_bytes: 256
import std.algorithm, std.container, std.conv, std.math, std.range, std.typecons, std.stdio, std.string;

auto rdsp(){return readln.splitter;}
void pick(R,T)(ref R r,ref T t){t=r.front.to!T;r.popFront;}
void readV(T...)(ref T t){auto r=rdsp;foreach(ref v;t)pick(r,v);}
void readC(T...)(size_t n,ref T t){foreach(ref v;t)v=new typeof(v)(n);foreach(i;0..n){auto r=rdsp;foreach(ref v;t)pick(r,v[i]);}}

void main()
{
  int n, m; readV(n, m);
  int[] p, q, c; readC(m, p, q, c); p[] -= 1; q[] -= 1;
 
  alias SC = Tuple!(int, int);
  SC[] sc;
  foreach (i; 0..m) {
    sc ~= SC(p[i], c[i]);
    sc ~= SC(q[i], c[i]);
  }
  int[SC] h;
  foreach (i, sci; sc.sort().uniq.enumerate) h[sci] = i.to!int+n;
  auto nh = h.length.to!int;
 
  auto g = GraphW!int(n+nh);
  foreach (i; 0..m) g.addEdgeB(h[SC(p[i], c[i])], h[SC(q[i], c[i])], 0);
  foreach (sci, v; h) g.addEdgeB(sci[0], v, 1);
 
  auto d = g.dijkstra(0);
  writeln(d[n-1] >= g.inf ? -1 : d[n-1]/2);
}

struct GraphW(N = int, W = int, W i = 10^^9)
{
  alias Node = N, Wt = W, inf = i;
  struct Edge { Node src, dst; Wt wt; alias cap = wt; }
  Node n;
  Edge[][] g;
  alias g this;
  this(Node n) { this.n = n; g = new Edge[][](n); }
  void addEdge(Node u, Node v, Wt w) { g[u] ~= Edge(u, v, w); }
  void addEdgeB(Node u, Node v, Wt w) { g[u] ~= Edge(u, v, w); g[v] ~= Edge(v, u, w); }
}

template Dijkstra(Graph)
{
  import std.array, std.container, std.traits;
  alias Node = TemplateArgsOf!Graph[0], Wt = TemplateArgsOf!Graph[1];
  alias Edge = Graph.Edge;

  void dijkstra(ref Graph g, Node s, out Wt[] dist, out Node[] prev)
  {
    auto n = g.n, sent = n;

    dist = new Wt[](n);
    dist[] = g.inf;
    dist[s] = 0;

    prev = new Node[](n);
    prev[] = sent;

    auto q = heapify!("a.wt > b.wt")(Array!Edge(Edge(sent, s, 0)));
    while (!q.empty) {
      auto e = q.front; q.removeFront();
      if (prev[e.dst] != sent) continue;
      prev[e.dst] = e.src;
      foreach (f; g[e.dst]) {
        auto w = e.wt + f.wt;
        if (dist[f.dst] > w) {
          dist[f.dst] = w;
          q.insert(Edge(f.src, f.dst, w));
        }
      }
    }
  }

  auto dijkstra(ref Graph g, Node s)
  {
    Wt[] dist;
    Node[] prev;
    dijkstra(g, s, dist, prev);
    return dist;
  }
}
auto dijkstra(G, N)(G g, N s) { return Dijkstra!G.dijkstra(g, s); }


Measured memory_bytes: 72060
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
 //最大の数と、その数の半分に最も近い数
   ll n;
  cin >> n;
  vector<ll> a(n);
  for(int i = 0;i<n;i++){
    cin >> a[i];
  }
  sort(a.begin(),a.end());
  reverse(a.begin(),a.end());
  int ans1 = a[0];
  int ans2 = a[n-1];
  int k = (a[0]+2-1)/2;
  for(int i = 0;i<n;i++){
   if(a[i] <=k){
     if(a[i-1]-k < k-a[i]){
       ans2 = a[i-1];
       break;
     }
     else{
       ans2 =a[i];
       break;
     }
   }
  }

  cout << ans1 << " " << ans2 << endl;
}

Measured memory_bytes: 1024
const input=require('fs').readFileSync('/dev/stdin','utf8').split(/[\s]/);let input_i=-1;const tn=():number=>{input_i++;return Number(input[input_i])};const tnn=(n:number):number[]=>{const a=[];for(let i=0;i<n;i++){a.push(tn())}return a};const ts=():string=>{input_i++;return String(input[input_i])};const tss=(n:number):string[]=>{const a=[];for(let i=0;i<n;i++){a.push(ts())}return a};const to=(...arg)=>{console.log(...arg)};const abs=(a)=>{return Math.abs(a)};const min=(...a)=>{return Math.min(...a)};const max=(...a)=>{return Math.max(...a)};const floor=(a)=>{return Math.floor(a)};const ceil=(a)=>{return Math.ceil(a)};const asc=(ar:number[])=>{const t=[...ar];return ar.sort((a,b)=>{return a-b})};const desc=(ar:number[])=>{const t=[...ar];return t.sort((a,b)=>{return b-a})};const sw=(a,arr:any[],op:'=='|'>='|'>'|'<='|'<'='==')=>{for(let i=0;i<arr.length-1;i+=2){if(eval(a+op+arr[i])){return arr[i+1]}}return arr[arr.length-1]};const near=(n:number,arr:number[]):number=>{let ne=arr[0],ni=0;for(let i=1;i<arr.length;i++){if(Math.abs(n-ne)>Math.abs(n-arr[i])){ne=arr[i];ni=i}}return ni};const deduplicate=(a:any[]):any[]=>{return Array.from(new Set(a))};const gcd=(x,y)=>{while(y){[x,y]=[y,x%y]}return x};const sum=(arr)=>{return arr.reduce((a,b)=>a+b);};
const main=()=>{
  let s=ts(),a=new Array(s.length+1)
  a.fill(0)
  for(let i=0;i<s.length;i++){
    if(s[i]=='<'){
      a[i+1]=a[i]+1
    }
  }
  for(let i=s.length-1;i>=0;i--){
    if(s[i]=='>'){
      a[i]=max(a[i+1]+1,a[i])
    }
  }
  to(a.reduce((a,b)=>a+b))
}
main()


Measured memory_bytes: 14656
import math

ans = 0
'''
K = int(input())
for i in range(1, K+1):
    for j in range(1, K+1):
        for k in range(1, K+1):
            temp = math.gcd(i, j)
            ans += math.gcd(temp, k)
print(ans)

'''

K = int(input())
box = []
for i in range(1, K+1):
    for j in range(1, K+1):
        box.append(math.gcd(i, j))

for k in range(1, K+1):
    for b in box:
        ans += math.gcd(k, b)

print(ans)

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

using int32 = int_fast32_t;
using int64 = int_fast64_t;

const int32 INF = 1e9;
const int32 MOD = 1e9+7;
const int64 LLINF = 1e18;

#define YES(n) cout << ((n) ? "YES\n" : "NO\n"  )
#define Yes(n) cout << ((n) ? "Yes\n" : "No\n"  )
#define POSSIBLE cout << ((n) ? "POSSIBLE\n" : "IMPOSSIBLE\n"  )
#define ANS(n) cout << (n) << "\n"
#define REP(i,n) for(int64 i=0;i<(n);++i)
#define FOR(i,a,b) for(int64 i=(a);i<(b);i++)
#define FORR(i,a,b) for(int64 i=(a);i>=(b);i--)
#define ALL(obj) (obj).begin(),(obj).end()
#define pii pair<int32,int32>
#define pll pair<int64,int64>
#define pb(a) push_back(a)

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int32 n;
  cin >> n;
  map<int32,int64> cnt1,cnt2;
  int64 ans = 0;
  REP(i,n){
    int32 a;
    cin >> a;
    ans += cnt1[-a+i];
    ans += cnt2[a+i];
    cnt1[a+i]++;
    cnt2[-a+i]++;
  }
  ANS(ans);
  return 0;
}

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

void printArray(int A[], int N){
    for(int i = 0; i < N; i++){
        if(i == 0){
            cout << A[i];
        }else{
            cout << " " << A[i];
        }
    }
    
    cout << endl;
}
void selectionSort(int A[], int N){
    int change = 0; //交換回数
    int minj;
    
    for(int i = 0; i < N; i++){
        minj = i;
        for(int j = i; j < N; j++){
            if(A[j] < A[minj]){
                minj = j;
            }
        }
        
        if(i != minj) change++;
            int tmp = A[i];
            A[i] = A[minj];
            A[minj] = tmp;
    }
    
    printArray(A,N);
    cout << change << endl;
    
}

int main(void){
    int N;
    cin >> N;
    
    int A[N];
    
    for(int i = 0; i < N; i++){
        cin >> A[i];
    }
    
    selectionSort(A, N);
    
}


Measured memory_bytes: 3128
import java.io.*;
import java.util.*;
import static java.lang.System.out;

public class Main{
    static MyReader in = new MyReader();

    public static void main(String[] args){
        String[] s = in.ss();
        int[] A = in.ii();
        String U = in.s();
        if(U.equals(s[0])){
            A[0]--;
        } else {
            A[1]--;
        }
        out.println(A[0]+" "+A[1]);
    }

    static class MyReader extends BufferedReader{
        MyReader(){
            super(new InputStreamReader(System.in));
        }

        String s(){
            try{return readLine();}catch(IOException e){return "";}
        }

        String[] ss(){
            return s().split(" ");
        }

        int i(){
            return Integer.parseInt(s());
        }

        int[] ii(){
            String[] ss = ss();
            int[] ii = new int[ss.length];
            for(int j = 0; j < ss.length; j++) ii[j] = Integer.parseInt(ss[j]);
            return ii;
        }

        ArrayList<Integer> li(){
            String[] ss = ss();
            ArrayList<Integer> li = new ArrayList<>();
            for(int j = 0; j < ss.length; j++) li.add(Integer.parseInt(ss[j]));
            return li;
        }

        long l(){
            return Long.parseLong(s());
        }

        long[] ll(){
            String[] ss = ss();
            long[] ll = new long[ss.length];
            for(int j = 0; j < ss.length; j++) ll[j] = Long.parseLong(ss[j]);
            return ll;
        }
    }
}


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

int main()
{
  int n;
  string str;
  string label = "ABC";
  cin >> n >> str;
  int i = 0;
  int count = 0;
  
  while (i < n - 2) {
    string value = str.substr(i, 3);
    if (value == label) {
    	count ++;
      	i += 3;
    } else {
    	i++;
    }
  }
  cout << count << endl;
}


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

using namespace std;

#define ll long long
#define vi  vector<int>
#define vvi vector<vi>
#define pi  pair<int,int>
#define mp  make_pair
#define pb  push_back
#define MOD 1e9 + 7
#define PAI  3.1415
#define all(x) (x).begin(),(x).end()
#define chmax(x,y) x = max(x,y)
#define chmin(x,y) x = min(x,y)
#define pr(x) cout << x << endl
#define Endl endl
#define rep(i,n) for(int i = 0 ; i < n; i++)

const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
const int ddx[8] = {-1,0,1,-1,1,-1,0,1};
const int ddy[8] = {-1,-1,-1,0,0,1,1,1};
const int inf = 99999999;
const ll linf = 1LL << 62;

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

ll lcm(ll a,ll b){
  if(a < b)swap(a , b);
  return (a/gcd(a , b))*b;
}

int main(){

  int n;
  string s;
  cin >> n >>s;

  vi v(3*100010,0);

  //累積和
  rep(i,n)
    if(s[i] == 'W')v[i] = 1;
  rep(i,n)
    if(i != 0)v[i] += v[i-1];

  int ans = inf;

  rep(i,n){
    if(i == 0) chmin(ans , n - 1 - (v[n - 1] - v[i]));
    else if(i == n - 1) chmin(ans , v[i - 1]);
    else chmin(ans , v[i-1] + (n - 1 - i) - (v[n-1] - v[i]));
  }
  cout << ans << endl;

  return 0;

}


Measured memory_bytes: 1796
h,w=map(int,input().split())
s=[input() for _ in range(h)]
dx=[1,0,-1,0,1,-1,-1,1]
dy=[0,1,0,-1,1,1,-1,-1]
for i in range(h):
    for j in range(w):
        if s[i][j]=="#":
            continue

        num=0
        for d in range(8):
            ni=i+dy[d]
            nj=j+dx[d]

            if ni<0 or h<=ni:
                continue
            if nj<0 or w <=nj:
                continue
            if s[ni][nj]=="#":
                num+=1

        list1=list(s[i])
        list1[j]=str(num)
        s[i]="".join(list1)
for i in range(h):
    print(s[i])

Measured memory_bytes: 40176
#include <bits/stdc++.h>
#define pb push_back
#define FOR(i,a,b) for(int i = a; i < b ; i++)
using namespace std;

struct Node{
	string first;
	int second,in;

};

bool comp(Node a,Node b)
{
	int x = strcmp((a.first).c_str(),(b.first).c_str());
	if( x== 0)
		return (a.second > b.second);
	if(x > 0)
		return false;
	return true;

}

int main()
{
	int n;
	cin>>n;
	vector<Node> a(n);
	for(int i = 0 ; i < n ; i++)
	{
			cin>>a[i].first>>a[i].second;
		a[i].in = i + 1;
	}
	sort(a.begin(),a.end(),comp);
	for(int i = 0 ; i < n ; i++)
		cout<<a[i].in<<endl;
}


Measured memory_bytes: 256
local read = setmetatable({}, {__index = function(t, k) local a = {} for i=1,#k do table.insert(a, '*'..string.sub(k, i, i)) end local r = io.read local u = table.unpack or unpack return function() return r(u(a)) end end})
read.N = function(N) local t={} for i=1,N do t[i]=read.n() end return t end
--
local N, L = read.nn()
local A = read.N(N)

local max = 0
local max_i = 0
for i=1,N-1 do
    local cur = A[i] + A[i+1]
    if cur > max then
        max = cur
        max_i = i
    end
end
if max < L then
    print("Impossible")
    return
else
    print("Possible")
    for i=1,max_i-1 do
        print(i)
    end
    for i=N-1,max_i,-1 do
        print(i)
    end
end

Measured memory_bytes: 12792
import sys
input = sys.stdin.readline
def main():
  L=list()
  R=list()
  a,b=map(int,input().split())
  for i in range(b):
    c,d=input().split()
    c=int(c)
    if d=="AC":
      L.append(c)
    elif d=="WA":
      if c not in L:
        R.append(c)
  L=set(L)
  t=len(L)
  P=[1 for i in R if i in L]
  s=sum(P)
  print(t,s)
main()

Measured memory_bytes: 13204
#include <iostream>
#include <string>
#include <algorithm>
#include <set>
#include <vector>
#include <stdio.h>
#include <cmath>
#include <functional>
#include <limits>
#include <map>
using namespace std;

typedef long long ll;
#define rep1(i, n) for(ll i = 1; i <=(ll)(n); i++)
#define rep0(i, n) for(ll i = 0; i <=(ll)(n); i++)

ll powel(ll a, ll b){
    ll p = 1;
    rep1(i,b) p*=a;
    return p;
}

ll out(ll start, ll end, ll gap, ll fromstart){
    ll cnt = 1;
    ll a = start + powel(26,gap);
    while(a < end){
        if(fromstart < a) break;
        cnt++;
        a += powel(26,gap);
    }
    printf("%c", 96 + cnt);
    return cnt;
}

int main(){
    ll n;
    cin >> n;
    ll a = 26;
    ll cnt = 1;
    while(a <= (ll)(1e15+1)){
        if(n <= a) break;
        cnt++;
        a += powel(26,cnt);
    }
    ll d = cnt;
    ll start = (powel(26, d) - 1)/25;
    ll end = start + powel(26,d);
    rep1(i,cnt){
        ll ret = out(start, end, d-1, n);
        d--;
        start = start + (ret-1)*powel(26,d);
        end = start + powel(26,d);
    }
    printf("\n");
    return 0;
}

Measured memory_bytes: 3128
#!/usr/bin/env python3
import sys


def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

def solve(N: int):
    factors = factorization(N)
    if N == 1:
        print(0)
        return
    result = 0
    for _, n in factors:
        cnt = 0
        while True:
            s = cnt * (cnt + 1) // 2
            if s > n:
                cnt -= 1
                break
            cnt += 1
        result += cnt
    print(result)


    return


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    solve(N)

if __name__ == '__main__':
    main()


Measured memory_bytes: 9520
#include <bits/stdc++.h>
using namespace std;
#define rep(i, a) for (int i = 0; i < (a); i++)
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
typedef long long ll;
template<typename T>istream& operator>>(istream&i,vector<T>&v){rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const vector<T>&v){stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>ostream& operator<<(ostream&o,const vector<T>&v){if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>istream& operator>>(istream&i,pair<T1,T2>&v){return i>>v.first>>v.second;}
template<typename T1,typename T2>ostream& operator<<(ostream&o,const pair<T1,T2>&v){return o<<v.first<<","<<v.second;}
template<typename T>bool mins(T& x,const T&y){if(x>y){x=y;return true;}else return false;}
template<typename T>bool maxs(T& x,const T&y){if(x<y){x=y;return true;}else return false;}
template<typename T>ll suma(const vector<T>&a){ll res(0);for(auto&&x:a)res+=x;return res;}

#ifdef _DEBUG
inline void dump() { cerr << endl; }
template<typename Head> void dump(Head&& head) { cerr << head; dump(); }
template<typename Head, typename... Tail> void dump(Head&& head, Tail&&... tail) { cerr << head << ", "; dump(forward<Tail>(tail)...); }
#define debug(...) do {cerr << __LINE__ << ":	" << #__VA_ARGS__ << " = "; dump(__VA_ARGS__); } while (false)
#else
#define dump(...)
#define debug(...)
#endif

template <typename T> struct edge {
  int src, to;
  T cost;
  edge(int to, T cost) : src(-1), to(to), cost(cost) {}
  edge(int src, int to, T cost) : src(src), to(to), cost(cost) {}
  edge &operator=(const int &x) {
    to = x;
    return *this;
  }
  operator int() const { return to; }
};
template <typename T> using Edges = vector<edge<T>>;
template <typename T> using WeightedGraph = vector<Edges<T>>;
using UnWeightedGraph = vector<vector<int>>;
template <typename T> using Matrix = vector<vector<T>>;

const ll LINF = 1LL << 60;
const int INF = 1001001001;

/////////////////////////////////////////////////////////////////////

int main() {
  ll n,k; cin>>n>>k;
  cout << n-k+1 << endl;

  return 0;
}


Measured memory_bytes: 3544
/**Lucky Boy**/
#include <bits/stdc++.h>
#define FOR(i, a, b) for (long long i = (a); i <= (b); ++i)
#define FORD(i, a, b) for (long long i = (a); i >= (b); --i)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define maxc 1000000007
#define maxn 1003
#define maxm 500005
#define pii pair <int,int>
#define Task ""
template <typename T> inline void read(T &x){char c;bool nega=0;while((!isdigit(c=getchar()))&&(c!='-'));if(c=='-'){nega=1;c=getchar();}x=c-48;while(isdigit(c=getchar())) x=x*10+c-48;if(nega) x=-x;}
template <typename T> inline void writep(T x){if(x>9) writep(x/10);putchar(x%10+48);}
template <typename T> inline void write(T x){if(x<0){putchar('-');x=-x;}writep(x);putchar(' ');}
template <typename T> inline void writeln(T x){write(x);putchar('\n');}
using namespace std;
int n,x,y,cnt[105];
int main()
{
    ios_base::sync_with_stdio(NULL);cin.tie(NULL);cout.tie(NULL);
    //freopen(Task".inp", "r",stdin);
    //freopen(Task".out", "w",stdout);
    cin >> n;
    if (n == 3 || n == 5 || n == 7) cout << "YES";
    else cout << "NO";
    return 0;
}


Measured memory_bytes: 256
#include <vector>
#include <iostream>
#include <utility>
#include <algorithm>
#include <string>
#include <deque>
#include <queue>
#include <tuple>
#include <queue>
#include <functional>
#include <cmath>
#include <iomanip>
#include <map>
#include <set>
#include <numeric>
#include <unordered_map>
#include <unordered_set>
#include <complex>
#include <iterator>
#include <array>
#include <memory>
#include <stack>
using ll = long long;
//#define int ll
#define ld long double
#define INF 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define all(in) in.begin(), in.end()
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
#define MAX 9999999
using namespace std;
typedef pair<int, int> pii;
typedef pair<double,double>pdd;
signed main(){
    int n,x; cin >> n >> x;
    vector<int>v(n);
    rep(i,n) cin >> v[i];
    int ans = 0;
    rep(i,n){
        x-= v[i];
        ans++;
    }
    sort(all(v));
    ans += x/v.front();
    cout << ans << endl;
}


Measured memory_bytes: 888
import math
a,b,c,d = map(int,input().split())
min_c = (a-1)//c
max_c = b//c
min_d = (a-1)//d
max_d = b//d
tmp = (c * d) // math.gcd(c, d)
min_cd = (a-1)//tmp
max_cd = b//tmp

#print(a,b,c,d)
#print(min_c,max_c)
#print(min_d,max_d)
#print(min_cd,max_cd)
print(b-(a-1)-(max_c-min_c)-(max_d-min_d)+(max_cd-min_cd))

Measured memory_bytes: 9004
#include<stdio.h>
int main()
{
	int i,s,a,b,m;
	scanf("%d%d",&i,&s);
	for(m=s;i>0;i--)
	{
		scanf("%d%d",&a,&b);
		s+=a-b;
		if(s<0)
		{
			m=0;
			break;
		}
		if(s>m)
			m=s;
	}
	printf("%d\n",m);
	return 0;
}

Measured memory_bytes: 596
#include<iostream>
#include<cstdio>
#include<stack>
#include<queue>
#include<algorithm>
#include<string>
#include<set>
#include<map>
#include<vector>
#include<math.h>
#include<tuple>
#include<string.h>
#include <numeric> 
using namespace std; 
#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 << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define pp(...) "\033[94m [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "]\033[0m"
#define dg1(x) debug() << pp(x)
#define dg2(x,y) debug() << pp(x) pp(y)
#define dg3(x,y,z) debug() << pp(x) pp(y) pp(z)
#define dg4(w,x,y,z) debug() << pp(w) pp(x) pp(y) pp(z)
#define print(x) cerr <<"\033[1;33m" << x << "\033[0m" << '\n'
#define int long long
#define LL __int128_t
const int xx = 2e5;
const int MOD = 1e9 + 7;

void subset(vector<int>&a , vector<int>&p){
  int N = a.size();
  int mask = 1 << N;

  for(int i=0;i<mask;i++){
    int sum = 0;
    for(int j=0;j<N;j++) {
      if(i & (1 << j)){
        sum += a[j];
      }
    }
    p.push_back(sum);
  }
}
signed main(){
  ios::sync_with_stdio(false);cin.tie(0);

  string s;
  cin >> s;
  for(int i=0;i<s.size();i++){
    cout <<'x';
  }
  cout << '\n';

}

Measured memory_bytes: 256
<?php
$input = STDIN;

list($a, $b, $C) = array_map("floatval", explode(' ', trim(fgets($input))));

$C_rad = deg2rad($C);
$sin_C = sin($C_rad);

$S = 0.5 * $a * $b * $sin_C;

$c = sqrt($a ** 2 + $b ** 2 - 2 * $a * $b * cos($C_rad));
$L = $a + $b + $c;

$h = $S * 2 / $a;

print "{$S}\n{$L}\n{$h}\n";


Measured memory_bytes: 9304
#include <bits/stdc++.h>
#define int int64_t
#define REP(i, n) for (int i = 0; (i) < (int)(n); ++ (i))
#define REP3(i, m, n) for (int i = (m); (i) < (int)(n); ++ (i))
#define REP_R(i, n) for (int i = (int)(n) - 1; (i) >= 0; -- (i))
#define REP3R(i, m, n) for (int i = (int)(n) - 1; (i) >= (int)(m); -- (i))
#define REPP(i, n) for (int i = 1; (i) < (int)(n+1); ++ (i))
#define REPR(i, n) for (int i = (int)(n) - 1; (i) >= 0; -- (i))
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define FORR(i, m, n) for(int i=(m)-1; i>=(n); i--)
#define ALL(v) v.begin(), v.end()
#define SZ(a) int((a).size())
#define SORT(c) sort((c).begin(),(c).end())
#define SORTR(c) sort((c).begin(),(c).end(),greater<int>());
#define BIT(n) (1LL<<(n))
#define PCNT(x) __builtin_popcountll(x)
#define GCD(x,y) __gcd(x,y)
#define LCM(x,y) x/__gcd(x,y)*y
#define PB push_back
#define MP make_pair
#define endl "\n"
#define yes cout << "Yes" << endl
#define no cout << "No" << endl
using namespace std;
using Graph = vector<vector<int> >;
using WeightedGraph = vector<vector<pair<int, int> > >;
typedef long double LD;
typedef vector<int> VI;
typedef vector<vector<int> > VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef vector<PII> VPII;
const int INF = 2000000000;
const long double PI = acosl(-1);
const int MOD = 1000000007;
void print() {cout << endl;}
template <class Head, class... Tail> void print(Head&& head, Tail&&... tail) {cout << head; if (sizeof...(tail) != 0) cout << " ";print(forward<Tail>(tail)...);}
template <class T> void print(vector<T> &vec) {for (auto& a : vec) {cout << a; if (&a != &vec.back()) cout << " ";} cout << endl;}
template <class T> void print(vector<vector<T>> &df) { for (auto& vec : df) { print(vec);}}

    int N;

int si (vector<char> &c, int i) {
    while (i < N+1 && c[i] != 'W') {
        i++;
    }
    return i;
}

int sj (vector<char> &c, int j) {
    while (j > -2 && c[j] != 'R') {
        j--;
    }
    return j;
}


signed main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    cout << fixed << setprecision(10);
    int ans = 0;
    

    cin >> N;
    vector<char> c(N);
    REP (i, N) {
        cin >> c[i];
    }

    vector<char> d = c;

    SORT(d);
    REP(i,N) {
        ans += c[i]!=d[i];
    }
    cout << ans/2 << endl;

    /*

    int i = 0, j = N-1;
    while (i < j) {
        j = sj(c,j);
        if (j == -1) {
            break;
        }
        i = si(c,i);
        if (i == N) {
            break;
        }
        swap (c[i],c[j]);
        ans++;
    }

    cout << ans-1 << endl;

    */


    
    
    
    return 0;
}

/*
cd ~/Desktop/Programming/AtCoder/contest/abc174/abc174_d && sh shellscripts/test_cpp.sh
cd ~/Desktop/Programming/AtCoder/contest/abc174/abc174_d && sh shellscripts/etest_cpp.sh
cd ~/Desktop/Programming/AtCoder/contest/abc174/abc174_d && sh shellscripts/submit_cpp.sh
*/


Measured memory_bytes: 3732
import java.util.*;
class Main{
	public static void main(String[] args){
      Scanner sc = new Scanner(System.in);
      int min = sc.nextInt();
      sc.nextInt();sc.nextInt();sc.nextInt();
      int max = sc.nextInt();
      int limit = sc.nextInt();
      if(max-min<=limit)
        System.out.println("Yay!");
      else
        System.out.println(":(");
      return;
    }
}

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

int main(){
  int N,K,count=0;
  cin >> N >> K;
  vector<int> num(N);
  for(int i=0;i<K;i++){
    int D;
    cin >> D;
    for(int i=0;i<D;i++){
      int A;
      cin >> A;
      num.at(A-1)++;
    }
  }
  for(int i=0;i<N;i++){
    if(num.at(i)==0){
      count++;
    }
  }
  cout << count << endl;
}
  
  

Measured memory_bytes: 3580
#include <bits/stdc++.h>
#include <iostream>
#include <queue>
#include <stack>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <random>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define repp(i,n,m) for (int i = m; i < (n); ++i)
#define repl(i,n) for (long long i = 0; i < (n); ++i)
#define reppl(i,n,m) for (long long i = m; i < (n); ++i)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using PL = pair<long long, long long>;
using Pxy = pair<double, double>;
using T = tuple<int, int, bool>;
const int INF = 1001001007;
const int mod = 1000000007;
const int MOD = 998244353;
const ll inf = 1e18;
template <typename AT>
void printvec(vector<AT> &ar){
    rep(i,ar.size()-1) cout << ar[i] << " ";
    cout << ar[ar.size()-1] << endl;
}
template <typename Q>
void printvvec(vector<vector<Q>> &ar){
    rep(i,ar.size()){
        rep(j,ar[0].size()-1) cout << ar[i][j] << " ";
        cout << ar[i][ar[0].size()-1] << endl;
    }
}
template <typename S>
bool range(S a, S b, S x){
    return (a <= x && x < b);
}

void yes(){
    cout << "Yes" << endl;
}

void no (){
    cout << "No" << endl;
}

ll cel (ll a, ll b){
    if (a % b == 0) return a / b;
    else return a / b + 1;
}

ll gcds(ll a, ll b){
    ll c = a % b;
    while (c != 0){
        a = b;
        b = c;
        c = a % b;
    }
    return b;
}

int main() {
    int n, x, t; cin >> n >> x >> t;
    cout << cel(n,x) * t << endl;
}

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

int main()
{
    string s1,s2;
    cin>>s1>>s2;
        int cnt=0;
    for(int i=0;i<s1.length();i++){
     if(s1[i]!=s2[i])
        cnt++;
    }

    cout<<cnt<<endl;
    return 0;
}


Measured memory_bytes: 3916
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <string>
#include <queue>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll mod = 1000000007;
const ll INF = 1000000000000000;
ll X, Y;

double x[10], y[10], sum;

ll pow(ll x, ll y)
{
	if (y == 0) return 1;
	if (y % 2)
	{
		return pow(x, y - 1) * x % mod;
	}
	else
	{
		ll yyy = pow(x, y / 2);
		return yyy * yyy % mod;
	}
}

ll pow_ll(ll x, ll y)
{
	if (y == 0) return 1;
	return x * pow_ll(x, y - 1);
}

ll div(ll x)
{
	return pow(x, mod - 2);
}



int main(void)
{
	cin >> X >> Y;

	ll a = (X + Y) / 3;
	ll b = X - a, ans = 1;

	if ((X + Y) % 3 != 0 || a < 0 || a < b || b < 0)
	{
		cout << 0 << endl;
		return 0;
	}

	for (ll i = a - b + 1; i <= a; i++)
	{
		(ans *= i) %= mod;
	}

	for (int i = 1; i <= b; i++)
	{
		(ans *= div(i)) %= mod;
	}

	cout << ans << endl;

	int xxx;
	cin >> xxx;
}


Measured memory_bytes: 256
n, m = map(int, input().split())
k = []
for i in range(n):
	temp = list(map(int, input().split()))
	temp.pop(0)
	k.append(temp)

Count = 0
for i in range(len(k[0])):
	count = 0
	for j in range(1, len(k)):
		if k[0][i] in k[j]:
			count += 1
			continue
		else:
			break
	if count == n - 1:
		Count += 1
print(Count)


Measured memory_bytes: 3064
import java.util.*;class Main{public static void main(String[]z){Scanner s=new Scanner(System.in);String o,e="";for(int t=s.nextInt(),i,j,p,q,d,h,w;t-->0;){char[]m=new char[(h=s.nextInt())*(w=s.nextInt()+2)],x,a={60,62,94,118},b={76,82,85,68};int[]r={-1,1,-w,w};for(i=p=0;i<h;++i)for(j=0,x=s.next().toCharArray();j<w-2;++j)for(q=0;q<4;++q)if(a[q]==(m[i*w+j+1]=x[j]))p=i*w+j+1;s.next();o=s.next();for(char c:o.toCharArray())if(c==83){for(i=0;a[i]!=m[p];++i);d=r[i];for(q=p+d;0<q&&q<h*w&&(m[q]==45||m[q]==46);q+=d);if(0<q&&q<h*w&&m[q]==42)m[q]=46;}else for(i=4;i-->0;)if(c==b[i]){d=r[i];q=p+d;if(!(0<q&&q<h*w&&m[q]==46))q-=d;m[p]=46;m[p=q]=a[i];}for(i=0;i<h;++i,e+="\n")for(j=1;j<w-1;++j)e+=m[i*w+j];e+="\n";}System.out.println(e.replaceAll("\n$",""));}}

Measured memory_bytes: 16000
import java.io.PrintWriter;
import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.next());
        sc.close();

        boolean f = false;
        for (int i=1; i<10; i++) {
            if (N % i==0) {
                if (N / i < 10) {
                    f = true;
                    break;
                }
            }
        }

        if (f) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }

    }
}

Measured memory_bytes: 25172
h,w,m = map(int,input().split())
a = [0 for _ in range(h)]
b = [0 for _ in range(w)]
raw = []
for _ in range(m):
  x,y = map(int,input().split())
  raw.append([x-1,y-1])
  a[x-1] += 1
  b[y-1] += 1
#print(a,b)
#print(max(a),max(b))
ma = max(a)
mb = max(b)
A = set()
B = set()
for i in range(h):
  if a[i] == ma:
    A.add(i)
for j in range(w):
  if b[j] == mb:
    B.add(j)
la = len(A)
lb = len(B)
#print(A,B)
#print(la,lb)
cnt = la * lb
#print(cnt)
for xy in raw:
  x,y = xy
  if x in A and y in B:
    cnt -= 1
#print(cnt)
if cnt:
  print(ma+mb)
else:
  print(ma+mb-1)

Measured memory_bytes: 216428
def rm_s(h):
	seth = set(h)
	for hai in seth:
		if set([hai,hai+1,hai+2]) <= seth:
			if len(h) == 3: return 1
			h1 = h[:]
			for i in range(3): h1.remove(hai+i)
			return is_hora(h1)
	else: return 0
		
def rm_k(h):
	for hai in set(h):
		if h.count(hai) >= 3:
			if len(h) == 3: return 1
			h1 = h[:]
			for i in range(3): h1.remove(hai)
			return is_hora(h1)
	else: return 0
	
def is_hora(h):
	return rm_k(h) or rm_s(h)
	
while True:
	try:
		h = map(int, raw_input())
		ans = []
		for add in range(1,10):
			if h.count(add) <= 3:
				h1 = h[:]+[add]
				for d in set(h1):
					if 2 <= h1.count(d):
						h1 = h[:]+[add]
						h1.remove(d);h1.remove(d)
						if is_hora(h1):
							ans.append(add)
							break
		print " ".join(map(str, sorted(ans))) if len(ans) > 0 else 0
	except:
		break

Measured memory_bytes: 4276
#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <vector>
#include <cstdio>
#include <bits/stdc++.h>
#include <set>
#include <map>
#include <stdio.h>
#include <stack>
#include <queue>
#include <deque>
#include <numeric>
#define MAX 100000007
using namespace std;
using ll = long long;
map <int ,int> mpa,mpb;
typedef pair<ll, ll> P;
priority_queue<P, vector<P>, greater<P>> pque;

ll ans=0;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  int N;
  cin >> N;
  if(N<105){
    cout << 0 << endl;
    return 0;
  }
  int count =0;
  ans=0;
  for(int i=105;i<=N;i+=2){
    for(int j=1;j<=N;j+=2){
      if(i%j==0){
        count++;
      }
    }
    if(count==8){
      ans++;
    }
    count=0;
  }
  cout << ans << endl;
}

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


using namespace std;

int main(void){
    
    vector<int> vec;
    int i=0,a,b;
    while(true){
        
        cin>>a>>b;
        if((a==0)&&(b==0)) break;
        i++;
        vec.push_back(a);
        vec.push_back(b);
    }
    
    for(int j=0;j<i;j++){
        for(int u=0;u<vec.at(j*2);u++){
            for(int v=0;v<vec.at(j*2+1);v++){
                cout<<"#";
            }
            cout<<endl;
        }
        cout<<endl;
    }
    
    return 0;
}



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

int main(int argc, char* argv[]){
    std::vector<int> inputs = {};
    int input;
    while(true){
        scanf("%d", &input);
        if (input == 0){
            break;
        }
        inputs.push_back(input);
    }
    for(int i = 0; i < inputs.size(); i++){
        printf("Case %d: %d\n", i+1, inputs[i]);
    }

}


Measured memory_bytes: 2856
/* written by : vipin kumar */
#include<iostream>
#include<set>
#include<map>
#include<unordered_set>
#include<cmath>
#include<algorithm>
using namespace std;
#include<vector>
#define int long long int
#define mod 1000000007
int32_t main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int l,r,d;
	cin>>l>>r>>d;
	int answer=0;
	int j;
	for(j=l;j<=r;j++)
	{
		if(j%d==0)
		{
			answer++;
		}
	}
	cout<<answer<<endl;
}



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

using namespace std;

typedef int in;
#define int long long

in main()
{
    int n,k;
    cin >> n >> k;
	double ans = 0;
	for(int i = 1 ; i <= n ; i ++){
		int y = i;
		double q = 1.0 / n;
		while(y < k){
			y *= 2;
			q /= 2;
		}
		ans += q;
	}
	printf("%.10f\n",ans);
    return 0;
}


Measured memory_bytes: 256
n=int(input())
a=[0]*n
b=[0]*n
import math
ans=0
for i in range(n):
  a[i],b[i]=map(int,input().split())
for i in range(n-1,-1,-1):
  ans+=b[i]*(math.ceil((ans+a[i])/b[i]))-a[i]-ans
print(ans)

Measured memory_bytes: 10868
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <climits>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <string>

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

bool dfs(vector<vector<int>>& adj, vector<int>& visited, int now, int vc)
{
	visited[now] = vc;
	for (int nxt : adj[now]) {
		if (visited[nxt] == vc) return true;
		if (visited[nxt] == -1) {
			if (dfs(adj, visited, nxt, vc)) return true;
		}
	}
	visited[now] = -2;
	return false;
}

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

	int n;
	cin >> n;
	vector<vector<int>> v(n, vector<int>(n));
	int cnt = 0;
	for (int i = 0; i < n; i++) for (int j = i + 1; j < n; j++) v[i][j] = v[j][i] = cnt++;
	vector<vector<int>> adj(cnt);
	vector<int> ind(cnt);
	for (int i = 0; i < n; i++) {
		int prv;
		cin >> prv;
		prv = v[i][prv - 1];
		for (int j = 0; j < n - 2; j++) {
			int now;
			cin >> now;
			now = v[i][now - 1];
			adj[prv].push_back(now);
			ind[now] += 1;
			prv = now;
		}
	}
	vector<int> visited(cnt, -1);
	int vc = 0;
	for (int i = 0; i < cnt; i++) {
		if (visited[i] == -1) {
			if (dfs(adj, visited, i, vc)) {
				cout << -1;
				return 0;
			}
		}
	}

	int answer = 0;
	queue<pii> q;
	for (int i = 0; i < cnt; i++) if (ind[i] == 0) q.push({ i,1 });
	while (!q.empty()) {
		auto now = q.front();
		q.pop();
		answer = now.second;
		for (int nxt : adj[now.first]) {
			ind[nxt] -= 1;
			if (ind[nxt] == 0) {
				q.push({ nxt,now.second + 1 });
			}
		}
	}
	cout << answer;

	return 0;
}


Measured memory_bytes: 35584
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define mp make_pair
#define deb(x) cout<< #x << " " << x << "\n";
#define MAX 9223372036854775807
#define MIN -9223372036854775807
#define PI 3.141592653589
#define setbits(n) __builtin_popcountll(n)
const ll mod=1e9+7;


int main() {
    
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll T=clock();
    
    ll d,t,s;
    cin>>d>>t>>s;
    if(s>=(d+t-1)/t)
        cout<<"Yes";
    else
        cout<<"No";

    cerr<<"\n\nTIME: "<<(double)(clock()-T)/CLOCKS_PER_SEC<<" sec\n";
    T = clock();
    return 0;
}

Measured memory_bytes: 3804
W, H, x, y, r = map(int, input().split())

a = 'Yes'
# up
if H < y + r:
    a = 'No'

# bottom
if y - r < 0:
    a = 'No'

# left
if x - r < 0:
    a = 'No'

# right
if W < x + r:
    a = 'No'

print(a)


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

#define endl '\n'
#define ALL(a)  (a).begin(),(a).end()
#define ALLR(a)  (a).rbegin(),(a).rend()
#define spa << " " <<
#define test cout<<"test"<<endl;
#define fi first
#define se second
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define rep(i,n,m) for(ll i = n; i < (ll)(m); i++)
#define rrep(i,n,m) for(ll i = m - 1; i >= (ll)(n); i--)
using ll = long long;
using ld = long double;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const ll INF = 1e18;
using P = pair<ll, ll>;
template<typename T>
void chmin(T &a,T b){if(a>b)a=b;}
template<typename T>
void chmax(T &a,T b){if(a<b)a=b;}
void pmod(ll &a,ll b){a=(a+b)%MOD;}
void pmod(ll &a,ll b,ll c){a=(b+c)%MOD;}
void qmod(ll &a,ll b){a=(a*b)%MOD;}
void qmod(ll &a,ll b,ll c){a=(b*c)%MOD;}
ll median(ll a,ll b, ll c){return a+b+c-max({a,b,c})-min({a,b,c});}
void ans1(bool x){if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}
void ans2(bool x){if(x) cout<<"YES"<<endl;else cout<<"NO"<<endl;}
void ans3(bool x){if(x) cout<<"Yay!"<<endl;else cout<<":("<<endl;}
template<typename T1,typename T2>
void ans(bool x,T1 y,T2 z){if(x)cout<<y<<endl;else cout<<z<<endl;}  
template<typename T>
void debug(vector<vector<T>>&v,ll h,ll w){for(ll i=0;i<h;i++)
{cout<<v[i][0];for(ll j=1;j<w;j++)cout spa v[i][j];cout<<endl;}};
void debug(vector<string>&v,ll h,ll w){for(ll i=0;i<h;i++)
{for(ll j=0;j<w;j++)cout<<v[i][j];cout<<endl;}};
template<typename T>
void debug(vector<T>&v,ll n){if(n!=0)cout<<v[0];
for(ll i=1;i<n;i++)cout spa v[i];cout<<endl;};
template<typename T>
vector<vector<T>>vec(ll x, ll y, T w){
  vector<vector<T>>v(x,vector<T>(y,w));return v;}
ll gcd(ll x,ll y){ll r;while(y!=0&&(r=x%y)!=0){x=y;y=r;}return y==0?x:y;}
vector<ll>dx={1,0,-1,0,1,1,-1,-1};
vector<ll>dy={0,1,0,-1,1,-1,1,-1};
template<typename T>
vector<T> make_v(size_t a,T b){return vector<T>(a,b);}
template<typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v(ts...))>(a,make_v(ts...));
}

int main(){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  //cout<<fixed<<setprecision(10);
  ll res=0,buf=0;
  bool judge = true;
  string s;cin>>s;
  ll n=s.size();
  string t;
  rep(i,0,n)if(s[i]!='x')t.PB(s[i]);
  ll m=t.size();
  rep(i,0,m){
    if(t[i]!=t[m-i-1])judge=false;
  }
  ll l=0,r=n-1;
  if(judge){
  rep(i,0,(m+1)/2){
    ll bufl=l,bufr=r;
    while(s[l]!=t[i])l++;
    while(s[r]!=t[i])r--;
    res+=abs((l-bufl)-(bufr-r));
    l++;r--;
  }}
  ans(judge,res,-1);
  return 0;
}

Measured memory_bytes: 592
#include<bits/stdc++.h>
#define cs const
#define pb push_back
using namespace std;
typedef long long ll;
cs int N = 45;
int n; bool e[N][N];
ll f[N][N][N], g[N][N][N];
int main(){
	#ifdef FSYolanda
	freopen("1.in","r",stdin);
	#endif
	scanf("%d",&n); n <<= 1;
	for(int i = 1; i <= n; i++){
		char S[N]; scanf("%s", S + 1);
		for(int j = 1; j <= n; j++)
		e[i][j] = S[j] - '0';
	} 
	for(int i = 1; i < n; i++){
		f[i][i][i] = 1;
		for(int j = i + 1; j < n; j++)
		g[i][i][j] = e[i][j];
	} 
	for(int len = 3; len < n; len += 2)
	for(int l = 1, r; l <= n - len; l++){
		r = l + len - 1;
		for(int p = l; p < r; p += 2)
		for(int q = r; q > p; q -= 2){
			ll c = 0;
			for(int k = q; k <= r; k++)
			c += g[l][p][k] * f[q][r][k];
			for(int k = p + 1; k < q; k++)
			f[l][r][k] += c * f[p + 1][q - 1][k];
		}
		for(int k = l; k <= r; k++)
		for(int z = r + 1; z < n; z++)
		g[l][r][z] += f[l][r][k] * e[k][z];
	} ll ans = 0;
	for(int i = 1; i < n; i++) ans += f[1][n - 1][i] * e[n][i];
	cout << ans; return 0;
}

Measured memory_bytes: 4616
#include <cstdio>
#include <cmath>
#include <map>
#include <vector>
#include <algorithm>
using namespace std;
int main(void){
    unsigned long long a, b;
    scanf("%lld %lld\n", &a, &b);
    int x[40];
    for (int j = 0; j < 40; j++) {
        x[j] = 0;
    }
    // aより大きく一番近い4の倍数の値を探す
    unsigned long long near_a = ((a + 3) >> 2) << 2;
    for(unsigned long long i=a; i<near_a; i++) {
        for (int j = 0; j < 40; j++) {
            x[j] += (i >> j) % 2;
        }
    }
    // bより小さく一番近い4の倍数の値を探す
    unsigned long long near_b = (b >> 2) << 2;
    for(unsigned long long i=near_b; i<=b; i++) {
        for (int j = 0; j < 40; j++) {
            x[j] += (i >> j) % 2;
        }
        
    }
    long long ans = 0;
    for (int j = 0; j < 40; j++) {
        //printf("%d\n", x[j]);
        ans += pow(2, j) * (x[j] % 2);
    }
    printf("%lld\n", ans);
    return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main()
{
  int n,k,ans,temp,len;
    string s,out;
  cin>>k;
    cin>>s;
    len=s.size();
    if(len<=k)
        cout<<s<<endl;
    else
    {
        for(int i=0;i<k;i++)
            cout<<s.at(i);
        cout<<"..."<<endl;
    }
return 0;
}


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

int main() {
    int a, b;
    scanf("%d %d", &a, &b);
    printf("%d\n", abs(a-b));
}


Measured memory_bytes: 3208
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;

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

const int inf = 999999999;
const int mod = 1e9 + 7;
const long double pi = 3.141592653589793238462643383279502884197;
const long double eps = 1e-7;

int main() {
	cin.tie(0);
	int N, K;
	cin >> N >> K;

	int ans = 1;
	REP(i, N) {
		if (ans <= K) {
			ans *= 2;
		}
		else {
			ans += K;
		}
	}
	cout << ans;
	system("pause");
	return 0;
}

Measured memory_bytes: 504
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef vector<vector<int> > Graph;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

    ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
    ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}
const ll INF = 1e16;

int main(){
    int n;
    cin >> n;
    int temp=n;
    vector<ll>x(n);
    vector<ll>y(n);
    rep(i,n){
        cin >> x[i];
        y[i]=x[i];
    }
    sort(x.begin(),x.end());
    n/=2;
    ll a=x[n-1];
    ll b=x[n];
    rep(i,temp){
        if(y[i]<=a){
            cout << b << endl;
        }
        else{
            cout << a << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 5376