akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
#include "math.h"
 
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<int> vin;
typedef vector<pair<ll,ll> > vp;
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
const int MOD = 1000000007;
const int MAX = 510000;

int main(){
  ll s,w;cin>>s>>w;
  if(s>w){cout<<"safe"<<endl;}
  else{cout<<"unsafe"<<endl;}
}



Measured memory_bytes: 3632
use proconio::{input, marker::Usize1};

fn main() {
    input!(n: usize, friendship: [(Usize1, Usize1)]);

    let friendship = {
        let mut adj = vec![vec![]; n];
        for (a, b) in friendship {
            adj[a].push(b);
            adj[b].push(a);
        }
        adj
    };
    let mut gr = Graph {
        adj: &friendship,
        visited: &mut vec![false; n],
    };
    let ans = (0..n).filter_map(|v| dfs(&mut gr, v)).max().unwrap();

    println!("{}", ans);
}

fn dfs(g: &mut Graph, v: usize) -> Option<usize> {
    if g.visited[v] {
        return None;
    }
    g.visited[v] = true;
    let adj: usize = g.adj[v].iter().filter_map(|&w| dfs(g, w)).sum();
    Some(adj + 1)
}

struct Graph<'a> {
    adj: &'a Vec<Vec<usize>>,
    visited: &'a mut Vec<bool>,
}


Measured memory_bytes: 28136
import sys
input = sys.stdin.readline
n = int(input())
b = [list(map(str,input().split())) for p in [0]*n]
for i in range(n):
  b[i][1] = int(b[i][1])
  b[i].append(i+1)
b.sort(key=lambda q:(q[0],-q[1]))
for k in range(n):
  print(b[k][2])

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#include <fstream>
#include <stdlib.h>
#include <ctime>
typedef long long ll;
typedef long double ld;

using namespace std;
int inf=1e9;
ll p=998244353;
int ans[300000][2];
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << setprecision(100);
   // freopen("input.txt","r",stdin);
    int n;
    string s;
    cin>>s;
    n=s.size();
    if(n==1){
        cout<<"1";
        return 0;
    }
    ans[0][0]=1;
    ans[1][1]=1;
    if(s[0]==s[1]){
        ans[1][0]=0;
    }
    else ans[1][0]=2;
    for(int i=2;i<n;i++){
        if(s[i]!=s[i-1]){
            ans[i][0]=max(ans[i][0],ans[i-1][0]+1);
        }
        ans[i][0]=max(ans[i][0],ans[i-1][1]+1);
        if(i>2 && (s[i]!=s[i-2] || s[i-1]!=s[i-3])) ans[i][1]= ans[i-2][1]+1;
        ans[i][1]=max(ans[i-2][0]+1,ans[i][1]);
    }
    cout<<max(ans[n-1][0],ans[n-1][1]);
    return 0;
}


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

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

//#define _USE_MATH_DEFINES
//#include <math.h>

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

#include <algorithm>
#include <functional>
#include <bitset>
#include <functional>
#include <chrono>
#include <random>
#define sqr(x) (x) * (x)

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

using namespace std;
using namespace std::chrono;

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

const double eps = 1e-8;

const i64 MAXN = 4 * 1'000'000 + 6;

i64 T;

i64 n, m;
i64 a[MAXN];

int main(int argc, char* argv[]) {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cout.precision(15); cout.setf(ios::fixed);

    cin >> n >> m;
    n %= m;

    i64 R = min(n, m - n);
    cout << R << endl;


    return 0;
}

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

// ConvexHullTrick in case of monotonic adding query
// monotonic adding query: isMinimum -> a1 >= a2 >= a3 ...
// isMonotonicQuery(x) ? O(N+Q) : O((N+Q)logN)
template<class Numeric> struct ConvexHullTrick {
	struct Line { // f: y=ax+b
		Numeric a; Numeric b;
		Line(Numeric _a, Numeric _b) : a(_a), b(_b) {}
		bool operator< (Line &l) {
			if (a != l.a) return a < l.a;
			else return b < l.b;
		}
	};

	private:
		vector<Line> lines;
		bool isMinimumQuery;
		bool isMonotonicQuery;
		bool compare(Numeric a, Numeric b, bool equal = true) {
			if (equal) {
				if (isMinimumQuery) return b <= a;
				else return a <= b;
			} else {
				if (isMinimumQuery) return b < a;
				else return a < b;
			}
		}

	public:
		// constructor
		ConvexHullTrick(bool monotonic, bool minimum = true) :
			isMinimumQuery(minimum), isMonotonicQuery(monotonic) {}
		// check the necessity of line2
		bool check(Line l1, Line l2, Line l3) {
			if (l1 < l3) swap(l3, l1);
			return compare((l3.b-l2.b)*(l2.a-l1.a), (l2.b-l1.b)*(l3.a-l2.a));
		}
		// add the line: y=ax+b
		void add(Numeric a, Numeric b) {
			Line line(a, b);
			int size = (int) lines.size();
			if (size >= 1 && lines[size-1].a == line.a){
				if (!compare(lines[size-1].b, line.b)) return;
			}
			while (size >= 2 && check(lines[size-2], lines[size-1], line)){
				lines.pop_back(); --size;
			}
			lines.emplace_back(line);
		}
		// get the value of line(x)
		Numeric f(Line line, Numeric x) {
			return line.a * x + line.b;
		}
		// solve
		Numeric solve(Numeric x) {
			if (isMonotonicQuery) {
				static int head = 0;

				// headで参照していた直線がaddしたときに消えたらheadを戻す
				if (head >= (int) lines.size()) head = lines.size()-1;
				while (head > 0 && compare(f(lines[head], x), f(lines[head-1], x), false)) --head;

				while (lines.size() - head >= 2 && compare(f(lines[head], x), f(lines[head+1], x))) ++head;
				return f(lines[head], x);
			}
			else {
				int low = -1; int high = lines.size()-1;
				while (high - low > 1) {
					int mid = (high+low)/2;
					if (compare(f(lines[mid], x), f(lines[mid+1], x))) low = mid;
					else high = mid;
				}
				return f(lines[high], x);
			}
		}

};


int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n; cin >> n;
	long long c; cin >> c;
    vector<long long> h(n+1);
	for (int i = 0; i < n; i++) cin >> h[i+1];
	ConvexHullTrick<long long> convexhulltrick(true);
	vector<long long> dp(n+1, 0);
	for (int i = n; i > 0; i--) {
		convexhulltrick.add(2*h[i], dp[i]+h[i]*h[i]+c);
		dp[i-1] = convexhulltrick.solve(-h[i-1]) + h[i-1] * h[i-1];
	}
	cout << dp[1] << endl;
	return 0;
}

Measured memory_bytes: 9584
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder_solve
{
    class Program
    {
        public const ulong mod = 1000000007;

        static void Main(string[] args)

        {
            var ab = Input3();
            var ans = 1;
            var sct = ab[0];

            while (sct < ab[1])
            {
                sct += ab[0] - 1;
                ans++;
            }

            if (ab[1] == 1) ans = 0;
            Console.WriteLine(ans);
                
                





        }

       
        static public long Input()
        {
            return long.Parse(Console.ReadLine());
        }

        static public string[] Input2()
        {
            return Console.ReadLine().Split();
        }

        static public long[] Input3()
        {
            string[] data = Console.ReadLine().Split();
            long[] res = new long[data.LongLength];
            for(long i = 0; i < data.LongLength; i++)
            {
                res[i] = long.Parse(data[i]);
            }
            return res;
        }
        public static long Choose(long n, long a)
        {
            long x = 1;
            long y = 1;
            for (long i = 0; i < a; i++)
            {
                x *= n - i;
                y *= i + 1;
            }
            return x / y;
        }

        public static long Gcd(long a, long b)
        {
            long x = Math.Max(a, b);
            long y = Math.Min(a, b);
            if (x % y == 0) return y;
            else return Gcd(y, x % y);
        }

        
       
    }
}


Measured memory_bytes: 11092
import java.util.*;
public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String t = sc.next();
        int n = s.length();
        int m = t.length();
        char[] sChar = s.toCharArray();
        char[] tChar = t.toCharArray();
        Arrays.sort(sChar);
        Arrays.sort(tChar);
        reverse(tChar, 0, tChar.length - 1);
        System.out.println(String.valueOf(sChar).compareTo(String.valueOf(tChar)) < 0 ? "Yes" : "No");

    }
    public static void reverse(char[] arr, int l, int r) {
        if (l >= r) return;
        char temp = arr[l];
        arr[l] = arr[r];
        arr[r] = temp;
        reverse(arr, l + 1, r - 1);
    }
}


Measured memory_bytes: 23764
N = int(input())
A = [int(i) for i in input().split()]

ans = 0
sum = 0
right = 0
for left in range(N):
    while right < N and sum ^ A[right] == sum+A[right]:
        sum += A[right]
        right += 1
    ans += right-left
    if right == left:
        right += 1
        # sum = A[left]
    else:
        sum -= A[left]
print(ans)


Measured memory_bytes: 23560
#include<stdio.h>
int main(){
  int i,j,h,w,n;
  n=1;
  while(n=1){
    scanf("%d",&h);
    scanf("%d",&w);
    if(h==0 && w==0) break;
    for(i=0;i<w;i++) printf("#");
    printf("\n");
    for(i=0;i<h-2;i++){
      printf("#");
      for(j=0;j<w-2;j++) printf(".");
      printf("#\n");
    }
    for(i=0;i<w;i++) printf("#");
    printf("\n");
    printf("\n");

  }
  return 0;
}



Measured memory_bytes: 1912
#include <iostream>
#include <algorithm>
#include <cctype>
#include <list>
using namespace std;

template <typename T_char>
T_char ToLower(T_char cX) { return tolower(cX); }

int stricmp(string lhs, string rhs) {
	transform(lhs.begin(), lhs.end(), lhs.begin(), ToLower<char>);
	transform(rhs.begin(), rhs.end(), rhs.begin(), ToLower<char>);

	return (lhs.compare(rhs)==0)?true:false;
}

int main(int argc, char** argv) {
	string target_word;
	list<string> sentence;
	cin >> target_word;

	string tmp;
	while(tmp != "END_OF_TEXT") {
		cin >> tmp;
		sentence.push_back(tmp);
	}

	int cnt = 0;
	for(list<string>::iterator it = sentence.begin();
			it != sentence.end();
			++it) {
		if(stricmp(*it, target_word)) {
			cnt++;
		}
	}
	cout << cnt << endl;

	return 0;
}

Measured memory_bytes: 1212
#include <bits/stdc++.h>
using namespace std;
#define rep(i, s, e) for (int i = s; i < e; ++i)
#define sort_(a) stable_sort(a.begin(), a.end())
#define rsort(a) stable_sort(a.rbegin(), a.rend())
#define sum(a) accumulate(a.begin(), a.end(), 0LL)
#define join(a, d) accumulate(a.begin() + 1, a.end(), a[0], [](string s, string t) { return s + d + t; })
#define all(a) a.begin(), a.end()
#define degrees(a) a * 180.0 / M_PI;
#define radians(a) (a * M_PI) / 180.0;
// #define __lcm(a, b) std::__detail::__lcm(a, b)
typedef long long ll;
const long mod = 1e9 + 7;

int main(void) {
#ifdef DEBUG
  freopen("input.txt", "r", stdin);
#endif

  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(15);

  int N;
  cin >> N;
  vector<int> D(N, 0);
  rep(i, 0, N) cin >> D[i];
  rsort(D);

  int prev = 0;
  int ans = 1;
  for (auto d : D) {
    if (d < prev) {
      ++ans;
    }
    prev = d;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
void quick_sort(int a[], int left, int right)
{
    int pl,pr,pivot;
 
    if(left>=right) return; 		
    pivot = a[(left + right)/2];
    pl=left;					
    pr=right;					
    while(pl<=pr){
        while(a[pl] < pivot) pl++;	
        while(a[pr] > pivot) pr--;	
        if(pl<=pr){					
			int s=a[pl];
			a[pl]=a[pr];
			a[pr]=s;
            pl++;
            pr--;
        }
    }
    quick_sort(a,left,pr);		
    quick_sort(a,pl,right);	
}
 
int main(void)
{
	int n,k;
	scanf("%d%d",&n,&k);
	int *h;
	h=(int*)malloc(sizeof(int)*n);
	int i;
	for(i=0;i<n;i++) scanf("%d",&h[i]);
	int A=INT_MAX;
	quick_sort(h, 0, n-1);
	for(i=0;i<=n-k;i++){
		if(abs(h[i]-h[i+k-1])<=A) A = abs(h[i]-h[i+k-1]);
	}
	printf("%d\n",A);
	free(h);
	return 0;
}


Measured memory_bytes: 640
H, W = map(int, input().split())
A = list()
for i in range(H):
	A.append(input())
for i in range(H):
	okrow = False
	for k in range(W):
		if A[i][k] == '#':
			okrow = True
	if okrow:
		for j in range(W):
			okcol = False
			for k in range(H):
				if A[k][j] == '#':
					okcol = True
			if okcol:
				print(A[i][j], end = '')
		print()

Measured memory_bytes: 4468
#include <bits/stdc++.h>
typedef long long ll;

using namespace std;


struct edge { ll to, cost; };
typedef pair<ll, ll> P;

template <typename T>
void dijkstra(ll s, T& g, vector<ll>& d){
	priority_queue<P, vector<P>, greater<P> > que;
	d[s] = 0;
	que.push(P(0, s));

	while (!que.empty()){
		P p = que.top();
		que.pop();
		int v = p.second;
		if (d[v] < p.first) continue;

		for (int i = 0; i < g[v].size(); i++){
			edge e = g[v][i];
			if (d[e.to] > d[v] + e.cost){
				d[e.to] = d[v] + e.cost;
				que.push(P(d[e.to], e.to));
			}
		}
	}
}

int main() {
	const ll INF = 1e18;
	ll n, m, s, t;
	cin >> n >> m >> s >> t;
	vector<vector<edge>> ga(n + 1);
	vector<vector<edge>> gb(n + 1);
	for (int i = 0; i < m; i++) {
		ll u, v, a, b;
		cin >> u >> v >> a >> b;
		ga[u].push_back({v, a});
		ga[v].push_back({u, a});
		gb[u].push_back({v, b});
		gb[v].push_back({u, b});
	}

	vector<ll> da(n + 1, INF);
	dijkstra(s, ga, da);
	vector<ll> db(n + 1, INF);
	dijkstra(t, gb, db);

	vector<ll> cost(n + 1, INF);
	for (int i = n; i > 0; i--) {
		ll sub_cost = da[i] + db[i];
		if (i == n) cost[i] = sub_cost;
		else cost[i] = min(cost[i + 1], sub_cost);
	}

	ll money = 1e15;
	for (int i = 1; i <= n; i++) {
		ll res = money - cost[i];
		cout << res << endl;
	}
	return 0;
}


Measured memory_bytes: 19012
import sys
read = sys.stdin.buffer.read
input = sys.stdin.readline
#input = sys.stdin.buffer.readline


#sys.setrecursionlimit(10**9)
#from functools import lru_cache

def RD(): return sys.stdin.read()
def II(): return int(input())
def MI(): return map(int,input().split())
def MF(): return map(float,input().split())
def LI(): return list(map(int,input().split()))
def LF(): return list(map(float,input().split()))
def TI(): return tuple(map(int,input().split()))
# rstrip().decode('utf-8')

from collections import deque

def main():
	h,w,k=MI()
	x1,y1,x2,y2=MI()
	G=["@"]*(w+2)
	for _ in range(h):
		G.append("@")
		G+=(list(map(str,input().rstrip())))
		G.append("@")
	G+=["@"]*(w+2)
	#print(G)


	G[x1*(w+2)+y1]=0
	#print(G)

	Q=deque()
	Q.append((x1*(w+2)+y1,0))

	while Q:
		#print(Q)
		now,d=Q.popleft()
		#print(Q)
		for i in range(1,k+1):
			if G[now+i]==d or G[now+i]=="@":
				break
			elif G[now+i]==".":
				G[now+i]=d+1
				Q.append([now+i,d+1])
			elif G[now+i]==d+1:
				continue
			else:
				break


		for i in range(1,k+1):
			if G[now-i]==d or G[now-i]=="@":
				break
			elif G[now-i]==".":
				G[now-i]=d+1
				Q.append([now-i,d+1])
			elif G[now-i]==d+1:
				continue
			else:
				break

		for i in range(1,k+1):
			if G[now+(w+2)*i]==d or G[now+(w+2)*i]=="@":
				break
			elif G[now+(w+2)*i]==".":
				G[now+(w+2)*i]=d+1
				Q.append([now+(w+2)*i,d+1])
			elif G[now+(w+2)*i]==d+1:
				continue
			else:
				break


		for i in range(1,k+1):
			if G[now-(w+2)*i]==d or G[now-(w+2)*i]=="@":
				break
			elif G[now-(w+2)*i]==".":
				G[now-(w+2)*i]=d+1
				Q.append([now-(w+2)*i,d+1])
			elif G[now-(w+2)*i]==d+1:
				continue
			else:
				break
		#print(Q)
	#print(G)

	if G[x2*(w+2)+y2]==".":
		print(-1)
	else:
		print(G[x2*(w+2)+y2])


if __name__ == "__main__":
	main()


Measured memory_bytes: 281504
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; 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 rrng(a) a.rbegin(),a.rend()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define print(x)cout<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;

int main() {
  int s,w;
  cin>>s>>w;
  if(w>=s)cout<<"unsafe"<<endl;
  else cout<<"safe"<<endl;
  return 0;
}


Measured memory_bytes: 3636
n = int(input())
l = sorted(list(map(int, input().split())))

if n == 1 and l ==[0, 0]:
    print(1)
    exit()
else:
    a = []
    for i in range(1, n):
        if n % 2 == 1: # odd
            if i < n and i % 2 == 0:
                a += [i] * 2
        else:
            if i < n and i % 2 == 1:
                a += [i] * 2
    else:
        if n % 2 == 1:
            a.insert(0, 0)
    
if l != a:
    print(0)
else:
    print((2 ** (n // 2)) % (10**9 + 7))

Measured memory_bytes: 13880
N = int(input())
words = {}

for _ in range(N):
    s = input()
    if s in words:
        words[s] += 1
    else:
        words[s] = 1

M = int(input())

for _ in range(M):
    t = input()
    if t in words:
        words[t] -= 1

val = sorted(words.values())

if val:
    if val[-1] < 0:
        print(0)
    else:
        print(val[-1])
else:
    print(0)

Measured memory_bytes: 9172
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <map>
#include <set>
#define ull unsigned long long
#define ll long long
using namespace std;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    int n;
    cin >> s >> n;
    for(int i=0;i<s.size();i+=n){
        cout << s[i];
    }
    cout << endl;

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<string.h>
#include<map>
#include<set> 
#include<vector>
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue> 
using namespace std; 
int main() 
{long long b,x1=0,x2=0;
 string a;
 cin>>a>>b;
 for (int i=0;i<a.size();i++)
{if (a[i]=='1')
{x1++;}
 else
{if (a[i]=='1')x2=1;if (a[i]=='2')x2=2;
 if (a[i]=='3')x2=3;
 if (a[i]=='4')x2=4;if (a[i]=='5')x2=5;if (a[i]=='6')x2=6;
 if (a[i]=='7')x2=7;if (a[i]=='8')x2=8;if (a[i]=='9')x2=9;
 break;}}
 if (x1>=b){
 cout<<1;
 system("pause");
 return 0; }
 else
{cout<<x2;
 system("pause");
 return 0; } 
 

 
 system("pause");
 return 0; 
 }

Measured memory_bytes: 504
#include <bits/stdc++.h>
#define rep(i,m,n) for(int i=m; i<n; i++)
#define co(n) cout << n << endl
using namespace std;
int main(){
  int a, b, c;
  cin >> a >> b >> c;
  
  co((a-b+1)*(a-c+1));
  
  
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
auto speedup = [](){
    std::ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    return nullptr;
}();

int main()
{
 int s , w;
    cin>>s>>w;
    if(s>w)
        cout<<"safe"<<endl;
    else
    {
        cout<<"unsafe"<<endl;
    }
    
}

Measured memory_bytes: 3640
def main():
    import math
    import numpy as np
    A, B, H, M = [int(x) for x in input().split()]

    omegaA = 2*math.pi / (60*12)
    omegaB = 2*math.pi / 60
    t = H*60 + M
    thetaA = omegaA*t
    thetaB = omegaB*t

    pA = np.array([np.cos(thetaA), np.sin(thetaA)]) * A
    pB = np.array([np.cos(thetaB), np.sin(thetaB)]) * B

    ans = np.linalg.norm(pA-pB)
    print(float(ans))
 
 
if __name__ == '__main__':
    import sys
    sys.setrecursionlimit(10000)
    main()

Measured memory_bytes: 27276
#pragma GCC optimize("O3")
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("unroll-loops")

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds; 

#define int long long
#define pb push_back
#define pf push_front
#define eb emplace_back
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define f first
#define s second
#define sz(x) (int)x.size()
#define endl "\n"
#define forn(i,n) for(int i=0;i<n;++i)
#define fore(i,l,r) for(int i=int(l);i<=int(r);++i)
#define rep(i,begin,end) for(__typeof(end) i=(begin);i!=(end);i++)
#define fill(a,value) memset(a,value,sizeof(a));
#define gcd(a,b) __gcd((a),(b))
#define watch1(x) cout<<(x)<<endl
#define watch2(x,y) cout<<(x)<<" "<<(y)<<endl
#define watch3(x,y,z) cout<<(x)<<" "<<(y)<<" "<<(z)<<endl
#define fastio ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);

typedef long long ll;
typedef long double ld; 
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> oset;

const int INF = 9e18;
const int mod = 1e9 + 7;
const int N = 1005;

int i,n;

void solve()
{
    cin>>n;
    if(n>=30)
        cout<<"Yes";
    else
        cout<<"No";
}

signed main()
{
    fastio;
    int t;
    //cin>>t;
    t=1;
    while(t--)
    {
        solve();
    }
    return 0;
}

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

#define endl '\n'
typedef long long ll;
typedef unsigned long long llu;

int main()
{

    ios_base::sync_with_stdio(0);
    cin.tie(0);

    string s,s1;
    cin >> s >> s1;
    int l=0,c=0;
    for(int i=0;i<s.size();i++)
    {
        if(s[i]!=s1[l++])c++;
    }
    cout << c << endl;
    c=0;
    return 0;
}



Measured memory_bytes: 3776
#include<iostream>
using namespace std;
int main()
{
    int x,n,k;
    cin>>n>>k;
    long long int count=0;
    int a=n/k;
    count=pow(a,3);
    if(k%2==0)
    {
    int x=k/2;
    int b=n/x;
    b=b-a;
    count+=pow(b,3);	
    }
    cout<<count;
    return 0;
}

Measured memory_bytes: 3556
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const string ln = "\n";
constexpr int INF = 1001001001;
constexpr int MOD = 1000000007;

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

  ll n;
  cin >> n;

  bool ok = false;
  string s = to_string(n);
  for (int i = 0; i < s.size(); i++) {
    if (s[i] == '7') {
      ok = true;
    }
  }

  cout << (ok ? "Yes" : "No") << ln;

  return 0;
}

Measured memory_bytes: 3708
import collections

N = int(input())
D = collections.Counter(list(map(int,input().split())))
M = int(input())
T = list(map(int,input().split()))

if M > N :
    print("NO")
    exit()

# print(D)
for i in range(M):
    # print(D[T[i]])
    if D[T[i]] == 0:
        print("NO")
        exit()
    D[T[i]] -= 1
    # print(D[T[i]])
    
print("YES")

Measured memory_bytes: 45784
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define LLINF 9223372036854775807
#define MOD ll(1e9+7)


int main(){
    ll n;
    cin >> n;
    vector<ll> a(n);
    vector<ll> b(n);
    for(int i = 0; i < n; i++){
        cin >> a[i];
        b[i] = a[i];
    }
    sort(a.begin(),a.end());
    sort(b.begin(),b.end());
    reverse(a.begin(),a.end());
    map<ll,ll> rem;
    for(int i = 0; i < n; i++){
        rem[a[i]]++;
    }
    vector<ll> pow2;
    ll p2 = 2;
    while(p2<2*1e9){
        pow2.push_back(p2);
        p2 *= 2;
    }
    reverse(pow2.begin(),pow2.end());
    int ptr = 0;
    int ans = 0;
    for(int i = 0; i < n; i++){
        if(rem[a[i]]==0){
            continue;
        }
        while(a[i]*2<pow2[ptr]){
            ptr++;
        }
        ll target = pow2[ptr] - a[i];
        if(binary_search(b.begin(),b.end(),target)){
            if( (a[i] != target && rem[target]>0) || (a[i] == target && rem[target]>1) ){
                ans++;
                rem[target]--;
                rem[a[i]]--;
            }
        }
    }


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


Measured memory_bytes: 15872
#include<iostream>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#define lli long long int
#define uli unsigned long long int
#define inf 999999999999999999
#define rep(i,n,m) for(lli i=(lli)(n);i<(lli)(m);++i)
#define reep(i,n,m) for(int i=(int)(n);i<=(int)(m);++i)
#define per(i,m,n) for(lli i=(int)(m)-1;i>=(int)(n);--i)
#define st(n) sort(n.begin(), n.end())
#define rev(n) reverse(n.begin(),n.end())
#define ou(S) cout << S << endl
using namespace std;
int main(){
  int n,k;
  cin>>n>>k;
  if(n%k==0)
    ou(n%k);
  else {
    ou(1);
  }
}

Measured memory_bytes: 256
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author cherrypi59
 */

#pragma GCC optimize ("O2")
#pragma GCC optimize ("tree-vectorize")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define FFOR(i, a, b) FOR(i, a, b+1)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) FOR(i, 1, n+1)
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define LEN(x) (int)(x).size()
#define DUMP(x) cerr<<__LINE__<<' '<<#x<<"="<<(x)<<endl;
#define pb push_back
#define eb emplace_back
#define mp make_pair

using namespace std;
using lint = long long;
using pii =  pair<int, int>;
using pll =  pair<lint, lint>;
template <typename T> using vc = vector<T>;
template <typename T> using vvc = vector<vector<T>>;
template <typename T> inline bool chmax(T &a, T b){if(a<b){a = b; return true;} return false;}
template <typename T> inline bool chmin(T &a, T b){if(a>b){a = b; return true;} return false;}

constexpr lint ten(int n) {return n==0 ? 1 : ten(n-1)*10;}

class FLaminate {
public:
    void solve(std::istream& in, std::ostream& out){
        ios_base::sync_with_stdio(false);
        in.tie(nullptr), out.tie(nullptr);
        const lint INF = ten(18);
        int N, K;
        in>>N>>K;
        vc<int> H(N+2, 0), F = {0};
        RREP(i, N) in>>H[i], F.pb(H[i]);
        sort(ALL(F));
        F.erase(unique(ALL(F)), F.end());
        int M = LEN(F);
        vector<vvc<lint>> dp(N+1, vvc<lint>(K+1, vc<lint>(M, INF)));
        dp[0][0][0] = 0;
        REP(i, N) REP(j, K+1) REP(k, M){
            if(dp[i][j][k]==INF) continue;
            if(j<K){
                chmin(dp[i+1][j+1][k], dp[i][j][k]);
            }
            int h = lower_bound(ALL(F), H[i+1]) - F.begin();
            chmin(dp[i+1][j][h], dp[i][j][k]+max(0, F[h]-F[k]));
        }
        lint ans = INF;
        REP(j, K+1) REP(k, M) chmin(ans, dp[N][j][k]);
        out<<ans<<'\n';
    }
};


int main() {
	FLaminate solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 219920
#include<iostream>
#include<algorithm>
using namespace std;
int a[100005];
int main(){
	int n,c,m;
	int i,j,k;
	int s=0;
	cin>>n>>c>>m;
	for(i=0;i<n;i++){
		cin>>a[i];
	}
	sort(a,a+n);
	for(i=0;i<n;){
		k=a[i]+m;
		for(j=0,s++;j<c;j++,i++){
			if(i==n)break;
			if(a[i]>k)break;
		}
	}
	cout<<s<<endl;
	return 0;
}


Measured memory_bytes: 640
#include <cstdio>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>

using namespace std;

long long int const INF = 1000000007;

long long int pow_10_9_5(long long int num){
	long long int pow_num = 1000000005;
	long long int mod_num = 1000000007;
	long long int pow_cur = num;
	long long int ret = 1;
	while(pow_num > 0){
		if(pow_num % 2 == 1){
			ret *= pow_cur;
			ret %= mod_num;
		}
		pow_cur *= pow_cur;
		pow_cur %= mod_num;
		pow_num /= 2;
	}
	return ret;
}

int main(){
	
	long long int H, W, A, B;

	cin >> H >> W >> A >> B;

	long long int c1, c2;
	c1 = 1;
	c2 = 1;

	for(int i = 1; i <= (H - A) - 1 + B; i++){
		c1 *= i;
		c1 %= INF;
	}

	for(int i = 1; i <= (H - A) - 1; i++){
		c1 *= pow_10_9_5(i);
		c1 %= INF;
	}

	for(int i = 1; i <= B; i++){
		c1 *= pow_10_9_5(i);
		c1 %= INF;
	}

	for(int i = 1; i <= (W - B) - 1 + A - 1; i++){
		c2 *= i;
		c2 %= INF;
	}

	for(int i = 1; i <= (W - B) - 1; i++){
		c2 *= pow_10_9_5(i);
		c2 %= INF;
	}

	for(int i = 1; i <= A - 1; i++){
		c2 *= pow_10_9_5(i);
		c2 %= INF;
	}

	long long int num1 = (H - A) + B;
	long long int num2 = B + 1;
	long long int num3 = (W - B) + A - 2;
	long long int num4 = (W - B) - 1;
	long long int ans = 0;

	for(int i = 0; i < W - B; i++){
		//cout << c1 << " " << c2 << endl;
		ans += (c1 * c2) % INF;
		ans %= INF;
		c1 *= num1;
		c1 %= INF;
		c1 *= pow_10_9_5(num2);
		c1 %= INF;
		c2 *= pow_10_9_5(num3);
		c2 %= INF;
		c2 *= num4;
		c2 %= INF;
		num1++;
		num2++;
		num3--;
		num4--;
	}

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



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

using ll = long long;

//constant
const ll MOD = 1e+9 + 7;
const double EPS = 1e-10;

#define REP(i, n) for (ll i = 0; i < n; i++)
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(), (x).rend()

//debug
#define DUMP(x)  cerr << #x << " = " << (x) << endl;
#define DEBUG(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl;

// view vector
template<typename T> void view(T e) { std::cout << e << std::endl; }
template<typename T> void view(const std::vector<T>& v) { for (const auto& e : v) { std::cout << e << " "; } std::cout << std::endl; }
template<typename T> void view(const std::vector<std::vector<T> >& vv) { for (const auto& v : vv) { view(v); } }


// ***************************************

vector<int> ans;


int main(void){

    int N, W;
    cin >> N >> W;
    
    int w, v;
    vector<pair<ll, ll>> items;
    REP(i, N) {
        cin >> w >> v;
        items.push_back({ w, v });
    }

    vector<vector<ll>> dp(W + 1, vector<ll>(N + 1, 0));

	REP(j, N){
        w = items[j].first;
        v = items[j].second;
		REP(i, W+1) {
            dp[i][j+1] = max(dp[i][j+1], dp[i][j]);	
			if (i - w >= 0){ 
            	dp[i][j + 1] = max(dp[i - w][j] + v, dp[i][j + 1]);
            }
        }
    }

    ll ans = 0;
    
    cout << dp[W][N] << endl;


    return 0;
}

Measured memory_bytes: 82304
#include <bits/stdc++.h>
#define M_PI           3.14159265358979323846  /* pi */
using namespace std;
using  ll = long long;

vector<string>A = { "dream", "dreamer", "erase", "eraser" };

int main() {
	string s;
	cin >> s;

	reverse(s.begin(), s.end());

	for (int i = 0; i < 4; i++) {
		reverse(A.at(i).begin(), A.at(i).end());
	}

	bool result = true;

	for (int i = 0; i < s.size(); i++) {
		bool divide = false;
		for (int j = 0; j < 4; j++) {
			string X = A.at(j);

			if (s.substr(i, X.size()) == X) {
				divide = true;
				i += X.size() - 1;
			}
		}
		if (divide == false) {
			result = false;
			break;
		}
	}

	if (result == true) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}
}

Measured memory_bytes: 3752
import java.io.*;
import java.util.*;
public class Main {
	static final int N=10005;
	static int a[]=new int[N];
    static int map[][]=new int[105][105];
	static int h,w,x,y;
    static int dfs(int cnt,int id,int dir) {
    	int pre=dir,first=1,s;
    	for(int i=x;i<h;i++) {
    		if(first==1) {
    			s=y;first=0;
    		}else{
    			if(pre==0) s=0;
    			else s=w-1;
    		}
    		if(pre==0) {
    			for(int j=s;j<w;j++) {
    			if(cnt==0) {
    				x=i;y=j;
    				return pre;
    			}
    			map[i][j]=id;
    			cnt--;
    			}
    			pre=1-pre;
    		}
    		else {
    			for(int j=s;j>=0;j--) {
        			if(cnt==0) {
        				x=i;y=j;
        				return pre;
        			}
        			map[i][j]=id;
        			cnt--;
        			
        		}
    			pre=1-pre;
    		}
    	}
    	return 0;
    }
	public static void main(String[] args){
		InputReader in = new InputReader(System.in);
	    PrintWriter out = new PrintWriter(System.out);
	    h=in.nextInt();w=in.nextInt();
	    int n=in.nextInt();
	    x=0;y=0;int pre=0;
	    for(int i=0;i<n;i++) {
	    	int tmp=in.nextInt();
	        pre=dfs(tmp,i+1,pre);
	     //   out.println(x+" wadwa "+y+" "+pre);
	    }
	    for(int i=0;i<h;i++) {
	    	for(int j=0;j<w;j++) {
                       if(j>0) out.print(" ");
	    		out.print(map[i][j]);
	    	}
	    	out.println();
	    }
	    out.flush();
	}
	static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;
        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }
        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }
        public int nextInt() {
            return Integer.parseInt(next());
        }
    }
}

Measured memory_bytes: 21716
x1, y1, x2, y2 = map(int, input().split())
dx = x2 - x1
dy = y2 - y1
x3 = x2 - dy
y3 = y2 + dx
x4 = x1 - dy
y4 = y1 + dx
print(x3, y3, x4, y4)


Measured memory_bytes: 9104
s = input()
flag = False
for i in range(len(s)):
    if i % 2 == 0 and s[i] == "L":
        flag = True
    elif i % 2 != 0 and s[i] == "R":
        flag = True
if flag == False:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 2940
from collections import deque
from itertools import permutations
from itertools import combinations

puz = [0,1,2,3,4,5,6,7]
puzper = list(permutations(puz))
dic = {}

for i in range(40320):
    dic[puzper[i]] = -1

queue = deque([(0,1,2,3,4,5,6,7)])

dic[(0,1,2,3,4,5,6,7)] = 0
while queue:
    a = queue.popleft()
    poszero = a.index(0)
    yy = (poszero) // 4
    xx = (poszero) % 4
    dydx = [[1,0],[-1,0],[0,1],[0,-1]]
    for j,k in dydx:
        newy,newx = yy+j,xx+k
        if (0 <= newy <2) and (0 <= newx < 4):
            newp = newy*4 + newx
            lisa = list(a)
            lisa[poszero],lisa[newp] = lisa[newp],lisa[poszero]
            newper = tuple(lisa)
            if (dic[newper] == -1):
                dic[newper] = dic[a] + 1
                queue.append(newper)

while True:
    try:
        inp = list(map(int, input().split()))
        print(dic[tuple(inp)])
    except:
        break


Measured memory_bytes: 12472
// {{{ by unolight
#include <bits/stdc++.h>
#include <unistd.h>
#pragma GCC diagnostic ignored "-Wunused-result"
#pragma GCC diagnostic ignored "-Wunused-function"
#define SZ(x) ((int)(x).size())
#define ALL(x) begin(x),end(x)
#define RALL(x) rbegin(x),rend(x)
#define REP(i,n) for ( int i=0; i<int(n); i++ )
#define REP1(i,a,b) for ( int i=(a); i<=int(b); i++ )
#define MP make_pair
#define PB push_back
using namespace std;
typedef int64_t LL;
typedef pair<int,int> PII;
typedef vector<int> VI;

namespace { namespace unolight {
// Read Input
template<class T> void _R( T &x ) { cin>>x; }
void _R( int &x ) { scanf("%d",&x); }
void _R( int64_t &x ) { scanf("%" PRId64,&x); }
void _R( double &x ) { scanf("%lf",&x); }
void _R( char &x ) { scanf(" %c",&x); }
void _R( char *x ) { scanf("%s",x); }
void R() {}
template<class T, class... U> void R( T& head, U&... tail ) { _R(head); R(tail...); }
// Write Output
template<class T> void _W( const T &x ) { cout<<x; }
void _W( const int &x ) { printf("%d",x); }
void _W( const int64_t &x ) { printf("%" PRId64,x); }
void _W( const double &x ) { printf("%.16f\n",x); }
void _W( const char &x ) { putchar(x); }
void _W( const char *x ) { printf("%s",x); }
template<class T> void _W( const vector<T> &x ) { for (auto i = x.begin(); i != x.end(); _W(*i++)) if (i != x.cbegin()) putchar(' '); }
void W() {}
template<class T, class... U> void W( const T& head, const U&... tail ) { _W(head); putchar(sizeof...(tail)?' ':'\n'); W(tail...); }

#ifdef UNOLIGHT
#include "dump.hpp"
#else
#define dump(...)
#endif

template<class T> inline bool chmax( T &a, const T &b ) { return b>a ? a=b,true : false; }
template<class T> inline bool chmin( T &a, const T &b ) { return b<a ? a=b,true : false; }
template<class T> using MaxHeap = priority_queue<T>;
template<class T> using MinHeap = priority_queue<T, vector<T>, greater<T>>;
template<class T, class F=less<T>> void sort_uniq( vector<T> &v, F f=F() ) {
    sort(begin(v),end(v),f);
    v.resize(unique(begin(v),end(v))-begin(v));
}
// }}}


void main() {
    string s;
    cin >> s;
    int x=0;
    REP(i,SZ(s)) {
        x+=(s[i]-'0');
        x%=9;        
    }
    if ( x ) W("No");
    else W("Yes");
}

}} // {{{ main
int main() { unolight::main(); return 0; }
// }}}

Measured memory_bytes: 3848
N = int(input())
A = list(map(int, input().split()))
MOD = 1000000007
hat = [0,0,0]
ans = 1
#red blue green
for i in range(N):
  if A[i] == hat[0]:   
    hat[0] += 1
    if A[i] == hat[1]:
      if A[i] == hat[2]:
        ans *= 3
      else:
        ans *= 2
  elif A[i] == hat[1]:
    hat[1] += 1
    if A[i] == hat[2]:
      ans *= 2
  elif A[i] == hat[2]:
    hat[2] += 1
    ans *= 1
  else:
    #print(hat, i)
    ans = 0
    print(ans)
    quit()
  #print(ans)
print(ans % MOD)

Measured memory_bytes: 14092
import java.util.*;
import java.io.*;
public class Main {
	static long findSumofProduct(int[] arr, int n){ 
		long mod=1000000007;
		long suffix_sum = (long)arr[n - 1]; 
		long res = 0; 
		for (int i = n - 2; i >= 0; i--) { 
			res = (res+(suffix_sum * (long)arr[i])%mod)%mod; 
			suffix_sum = (suffix_sum+(long)arr[i])%mod; 
		} 
		return res%mod; 
	} 
	public static void main(String args[]) {
		FastScanner in = new FastScanner();
		int n=in.nextInt();
		int a[]=in.readArray(n);
		System.out.println(findSumofProduct(a, n)%1000000007);
	}

	///////////////////////////
	static class FastScanner {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer("");

		String next() {
			while (!st.hasMoreTokens())
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		}

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

		int[] readArray(int n) {
			int[] a = new int[n];
			for (int i = 0; i < n; i++)
				a[i] = nextInt();
			return a;
		}

		long nextLong() {
			return Long.parseLong(next());
		}
	}
}


Measured memory_bytes: 55072
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(ll i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(ll i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(ll i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((ll)(x).size())
#define len(x) ((ll)(x).length())

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    // ifstream in("input.txt");
    // cin.rdbuf(in.rdbuf());
    string s;
    cin >> s;
    if ((s[2] == s[3]) && (s[4] == s[5])) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
    return 0;
}


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


bool Find(int A, int B, int C, int K)
{
    if(A<B && B<C)
    {
        return(true);
    }
    if(K==0)
    {
        return(false);
    }
    return(Find(2*A, B, C, K-1) || Find(A, 2*B, C, K-1) || Find(A, B, 2*C, K-1));
}

int main()
{
    int A, B, C, K;
    cin>>A>>B>>C>>K;
    bool temp = Find(A, B, C, K);
    if(temp==true)
    {
        cout<<"Yes"<<endl;
    }
    else
    {
        cout<<"No"<<endl;
    }
}


Measured memory_bytes: 3604
object Main extends App {
  val in = scala.io.Source.stdin.getLines.toSeq
  val ls = in.head.split(' ').map(_.toInt)
  val R = ls(0)
  val G = ls(1)
  val B = ls(2)
  val N = ls(3)
  val s = Seq(R,G,B).sorted.reverse
  //println(s)
  val r = s(0)
  val g = s(1)
  val b = s(2)
  var ret = 0
  (0 to N by r).map{ i =>
    (0 to N by g).map{ j =>
      if((N - i - j)>=0 && (N - i - j) % b == 0){
        //println(i, j, (N-i-j)/b )
        ret += 1
      }
    }
  }
  println(ret)
}


Measured memory_bytes: 114224
#include<map>
#include<iostream>
#include<string>
#include<set>
#include<algorithm>

using namespace std;

int main(){
    set<string> A[5 * 100000+5];
    int N;
    string s;
    cin >> N;
    map<string, int> m;
    int maxv = 0;
    for (int i = 0; i < N; i++)
    {
        cin >> s;
        m[s]++;
        maxv = (m[s] < maxv) ? maxv : m[s];
        A[m[s]].insert(s);
    }
    for (auto itr = A[maxv].begin(); itr != A[maxv].end(); itr++)
    {
        cout << *itr << endl;
    }
    return 0;
}

Measured memory_bytes: 57984
from collections import defaultdict
from collections import deque
from string import ascii_uppercase
import sys, bisect, math, heapq

stdin = sys.stdin
read_int = lambda : list(map(int,stdin.readline().split()))
read_str = lambda : stdin.readline().rstrip()

a, b, c, d = read_int()

def solve():
    ans = 'Yes'
    ta = c // b + min(c % b, 1)
    ao = a // d + min(a % d, 1)
    if ta > ao:
        ans = 'No'
    return ans

if __name__ == "__main__":
    print(solve())

Measured memory_bytes: 9980
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b;
    cin>>a>>b;
    int ans=0;
    int out=1;
    while(out<b)
    {
        out--;
        out+=a;
        ans++;
    }
    cout<<ans<<"\n";
}

Measured memory_bytes: 3640
#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()
typedef long long ll;
const int MOD = (int)1e9 + 7;

int main(){
  int n;
  cin >> n;
  int ans = 0;
  rep(i,n){
    int num = n-i;
    int digit = 0;
    while(num != 0){
      digit++;
      num /= 10;
    }
    if(digit % 2 == 1) ans++;
  }
  cout << ans << endl;
}



Measured memory_bytes: 256
from collections import deque
import sys
sys.setrecursionlimit(10**6)

readline = sys.stdin.readline
H, W = map(int, input().split())
Ch, Cw = map(lambda x: int(x) - 1, input().split())
Dh, Dw = map(lambda x: int(x) - 1, input().split())
S = [readline().rstrip() for _ in range(H)]

visited = [[False] * W for _ in range(H)]
dq = deque([(0, Ch, Cw)])

while dq:
    d, i, j = dq.popleft()
    if (i, j) == (Dh, Dw):
        print(d)
        exit()
    if visited[i][j]:
        continue
    visited[i][j] = True
    for di, dj in [(1, 0), (0, 1), (-1, 0), (0, -1)]:
        ni, nj = i + di, j + dj
        if 0 <= ni < H and 0 <= nj < W and S[ni][nj] == '.':
            dq.appendleft((d, ni, nj))
    for di in range(-2, 3):
        for dj in range(-2, 3):
            if di == dj == 0:
                continue
            ni, nj = i + di, j + dj
            if 0 <= ni < H and 0 <= nj < W and S[ni][nj] == '.' and not visited[ni][nj]:
                dq.append((d + 1, ni, nj))
print(-1)


Measured memory_bytes: 193292
#define _USE_MATH_DEFINES
     
#include <list>
#include <map>
#include <unordered_map>
#include <set>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <memory.h>
#include <ctime>
#include <bitset>
#include <vector>
#include <string>
#include <queue>

using namespace std;

int K[1000050];

void solution() {
    int n;
    cin >> n;
    vector <int> a(n);
    for (int i = 0; i < n; i++) {
        scanf("%d", &a[i]);
        K[a[i]]++;
    }
    int ans = 0;
    for (auto x : a) {
        bool good = true;
        if (K[x] > 1) {
            good = false;
        }

        if (K[1] > 0 && x != 1) {
            good = false;
        }

        int j;
        for (j = 2; j * j < x; j++) {
            if (x % j == 0) {
                int a = x / j;
                if (K[a] + K[j] > 0) {
                    good = false;
                }
            }
        }

        if (j * j == x && j != 1 && K[j]) {
            good = false;
        }

        if (good) {
            ans++;
        }
    }
    cout << ans << endl;
}

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

int main()
{
#ifdef Files
    freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    /*Test*/
    //freopen("input.txt", "w", stdout);
           
    double OcZ2X = clock();
#else
    //freopen("joke.in", "r", stdin);
    //freopen("joke.out", "w", stdout);
#endif

/*
　　     　 　          ∧_,,∧　　　
    　            ♪　  (・ω・)　♪
               ＿＿＿＿○＿＿つヾ＿＿＿＿＿
             /δ⊆・⊇ 。/†: :† /δ ⊆・⊇｡ /|
            |￣￣￣￣￣￣￣￣￣￣￣￣￣ | |
            |　　　*/solution();/* 　　| |
            |　　　　　　　　　　　　　 |
*/

#ifdef Time
double P2HxQ = clock();
printf("\n*** Total time = %.3f sec ***\n", (P2HxQ - OcZ2X) / CLOCKS_PER_SEC);
#endif
}

Measured memory_bytes: 7984
#define _CRT_SECURE_NO_WARNINGS
#include"bits/stdc++.h"
#define INF         1e9
#define EPS         1e-9
#define REP(i,n)    for(ll i=0,i##_len=(n);i<i##_len;++i)
#define REP1(i,n)   for(ll i=1,i##_len=(n);i<=i##_len;++i)
#define REPR(i,n)   for(ll i=(n)-1;i>=0;--i)
#define REPR1(i,n)  for(ll i=(n);i>0;--i)
#define REPC(i,obj) for(auto i:obj)
#define R_UP(a,b)   (((a)+(b)-1)/(b))
#define ALL(obj)    (obj).begin(),(obj).end()
#define SETP        cout << fixed << setprecision(8)
using namespace std;
using ll = long long;
template<typename T = ll>inline T in() { T x; cin >> x; return x; }

signed main()
{
	int n = in(), m = in();
	REPR1(i, m/n) {
		if (m % i == 0 && i * n <= m) {
			cout << i << endl;
			return 0;
		}
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ADD(a, b) a = (a + ll(b)) % mod
#define MUL(a, b) a = (a * ll(b)) % mod
#define MAX(a, b) a = max(a, b)
#define MIN(a, b) a = min(a, b)
#define rep(i, a, b) for(int i = int(a); i < int(b); i++)
#define rer(i, a, b) for(int i = int(a) - 1; i >= int(b); i--)
#define all(a) (a).begin(), (a).end()
#define sz(v) (int)(v).size()
#define pb push_back
#define sec second
#define fst first
#define debug(fmt, ...) Debug(__LINE__, ":", fmt, ##__VA_ARGS__)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<int, pi> ppi;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> mat;
typedef complex<double> comp;
void Debug() {cout << '\n'; }
template<class FIRST, class... REST>void Debug(FIRST arg, REST... rest){
	cout<<arg<<" ";Debug(rest...);}
template<class T>ostream& operator<<(ostream& out,const vector<T>& v) {
	out<<"[";if(!v.empty()){rep(i,0,sz(v)-1)out<<v[i]<<", ";out<<v.back();}out<<"]";return out;}
template<class S, class T>ostream& operator<<(ostream& out,const pair<S, T>& v){
	out<<"("<<v.first<<", "<<v.second<<")";return out;}
const int MAX_N = 200010;
const int MAX_V = 100010;
const double eps = 1e-6;
const ll mod = 1000000007;
const int inf = 1 << 29;
const ll linf = 1LL << 60;
const double PI = 3.14159265358979323846;
///////////////////////////////////////////////////////////////////////////////////////////////////

int N;
ll A[MAX_N];
pl B[MAX_N];
ll ans[MAX_N];

void solve() {
	cin >> N;
	rep(i, 0, N) {
		cin >> A[i];
		B[i] = pl(A[i], i);
	}
	sort(B, B + N);
	ll m1 = B[N / 2 - 1].fst, m2 = B[N / 2].fst;
	rep(i, 0, N) {
		if(i < N / 2) {
			ans[B[i].sec] = m2;
		}
		else ans[B[i].sec] = m1;
	}
	rep(i, 0, N) {
		cout << ans[i] << "\n";
	}
}

int main() {
#ifndef LOCAL
	ios::sync_with_stdio(false);
    cin.tie(0);
#endif
    cout << fixed;
	cout.precision(20);
	srand((unsigned int)time(NULL));
#ifdef LOCAL
	//freopen("in.txt", "wt", stdout); //for tester
    freopen("in.txt", "rt", stdin);
#endif	
	solve();
#ifdef LOCAL
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
	return 0;
}



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

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  ll a, b;
  cin >> a >> b;
  cout << max(0ll, a - b * 2) << "\n";
}


Measured memory_bytes: 3624