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

#define rep(i,x,y) for(int i=(x);i<(y);++i)
#define debug(x) #x << "=" << (x)

#ifdef DEBUG
#define _GLIBCXX_DEBUG
#define print(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define print(x)
#endif

const int inf=1e9;
const int64_t inf64=1e18;
const double eps=1e-9;

template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){
    os << "[";
    for (const auto &v : vec) {
    	os << v << ",";
    }
    os << "]";
    return os;
}

using i64=int64_t;

class union_find{
	private:
	vector<int> parent,rank,gs;
    int size;
	public:
    int count_group;
    union_find()=default;
    union_find(int n){ init(n); }
    void init(int n){
		size=n;
		count_group=n;
		parent.resize(size);
		rank.assign(size,0);
        gs.assign(size,1);
		for(int i=0; i<size; ++i) parent[i]=i;
	}
	int find(int x){
		if(parent[x]==x) return x;
		else return parent[x]=find(parent[x]);
	}
	void unite(int x,int y){
		x=find(x);
		y=find(y);
		if(x==y) return;
		if(rank[x]<rank[y]){
			parent[x]=y;
            gs[y]+=gs[x];
		} else {
			parent[y]=x;
            gs[x]+=gs[y];
			if(rank[x]==rank[y]) ++rank[x];
		}
		--count_group;
	}
	bool is_same_group(int x,int y){
		return find(x)==find(y);
	}
    int group_size(int x){
        return gs[find(x)];
    };
};

void solve(){
    i64 n,m;
    cin >> n >> m;
    union_find uf(n);
    vector<vector<int>> graph(n);
    vector<int> color(n);
    rep(i,0,m){
        int a,b;
        cin >> a >> b;
        --a;
        --b;
        uf.unite(a,b);
        graph[a].push_back(b);
        graph[b].push_back(a);
    }

    function<bool(int ,int )> dfs=[&](int v,int c){
        color[v]=c;
        rep(i,0,graph[v].size()){
            if(color[graph[v][i]]==c) return false;
            if(color[graph[v][i]]==0 and !dfs(graph[v][i],-c)) return false;
        }
        return true;
    };

    i64 s1=0,s2=0,t=0;
    set<int> done;
    rep(i,0,n){
        if(color[i]!=0) continue;
        int x=uf.find(i);
        if(done.find(x)!=done.end()) continue;
        done.insert(x);
        if(uf.group_size(x)==1){
            ++t;
            continue;
        }
        if(dfs(i,1)) ++s1;
        else ++s2;
    }
    cout << 2*s1*s1+s2*s2+2*s1*s2+t*t+2*t*(n-t) << endl; 
}

int main(){
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(10);
    solve();
    return 0;
}


Measured memory_bytes: 10112
object Main extends App {
  override def main(args: Array[String]): Unit = {
    val lines = io.Source.stdin.getLines().toStream
    println(solve(lines))
  }

  def solve(lines: Seq[String]): Int = {
    val Array(a, b) = lines.head.split(" ").map(_.toInt)
    // debug(a, b)
    if (a >= 13) {
      b
    } else if (6 <= a && a <= 12 ) {
      b/2
    }  else {
      0
    }
  }

  private def debug(x: Any): Unit = {
    if (System.getenv("LOCAL_DEBUG") != null) println(x)
  }
}

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

#ifdef LOCAL
    #define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
        #define eprintf(...) 42
#endif

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define all(x) (x).begin(),(x).end()
#define foreach(u,v) for(auto (u) : (v))
#define pb push_back
#define mp make_pair
#define mt make_tuple

typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<ll, ll> pll;
typedef vector<ll> vl;

const int inf = 1e9;
const ll linf = 1LL<<60;
const ll mod = 1e9 + 7;
const double eps = 1e-9;

/*
*/

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

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

  vi a(n);
  rep(i, n){
    cin >> a[i];
  }

  int ans = a[n-1];
  rep(i, n-1){
    ans = gcd(ans, a[i]);
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 640
#include <cstdio>
#include <iostream>

int count(int x ) {
	if (0 == x) return 1;
	int re = 0;
	while (x > 0) {
		++re;
		x /= 10;
	}
	return re;
}

int main() {
	int a, b;
	while (2 == scanf("%d%d", &a, &b)) {
		printf("%d\n", count(a + b));
	}
	return 0;
}

Measured memory_bytes: 1188
s = str(input())
count = 0
lst = []

for i in range(3):
    if s[i] == 'R':
        count += 1
    else:
        lst.append(count)
        count = 0

    if i == 2:
        lst.append(count)

max_count = max(lst)
print(max_count)

Measured memory_bytes: 9040
#include <algorithm>
#include <iomanip>
#include <iostream>
#include <cstdlib>
#include <string>

using namespace std;

int main() {
  int l;
  scanf("%d", &l);

  double m = ((double) l) / 3.0;

  cout << fixed << setprecision(12) << (m * m * m)  << endl;
  return 0;
}


Measured memory_bytes: 256
import math


def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))


M, N = map(int, input().split())
if M <= 1 and N <= 1:
    print(0)
elif M <= 1:
    print(combinations_count(N, 2))
elif N <= 1:
    print(combinations_count(M, 2))
else:
    print(combinations_count(M, 2) + combinations_count(N, 2))

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

int main() {
	int N;
	cin >> N;
	unordered_map<int, bool> IsExist;
	for (int i = 0; i < N; i++) {
		int A;
		cin >> A;
		if (IsExist.find(A) == IsExist.end()) IsExist[A] = true;
		else IsExist[A] = !IsExist[A];
	}
	int ans = 0;
	for (auto b : IsExist) if (b.second) ans++;
	cout << ans;
}

Measured memory_bytes: 4388
/// However long the night,
///     The dawn will break
/// ICPC next year

#include<bits/stdc++.h>
using namespace std ;
const int N = 1e5+5 ;

int n ,a[N] ,b[N] ;
long long ans ;
int main(){
    scanf("%d",&n);
    for(int i=0;i<=n;++i) scanf("%d",a+i);
    for(int i=0;i<n;++i) scanf("%d",b+i);
    for(int i=0;i<n;++i){
        int x = min(a[i],b[i]);
        ans += x ;
        a[i] -= x ;
        b[i] -= x ;
        x = min(a[i+1],b[i]);
        ans += x ;
        a[i+1] -= x ;
        b[i] -= x ;
    }
    cout << ans ;
    return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
#include<cstdio>
#include<iostream>
#include<algorithm>
using namespace std;
#define ll long long
int main()
{
    int n,m;
    int vis[100005];
    while(scanf("%d %d",&n,&m)!=EOF)
    {
        memset(vis,0,sizeof(vis));
        for(int i=1;i<=n;i++)
        {
            int k;
            scanf("%d",&k);
            for(int j=0;j<k;j++)
            {
                int x;
                scanf("%d",&x);
                vis[x]++;
            }
        }
        int sum=0;
        for(int i=1;i<=m;i++)
        {
            if(vis[i]==n)
                sum++;
        }
        printf("%d\n",sum);
    }


    return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define INF 100000000000
#define MOD 1000000007
#define ll long long int
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()




using namespace std;



int main(){
  int N; cin>>N;
  set <string> S;

  REP(i,N){
    string s; cin>>s;
    S.insert(s);

  }

  int ans = 0;
  ans = S.size();
  cout<<ans<<endl;


  return 0;
}

Measured memory_bytes: 19228
n, m = map(int, input().split())

abes = [list(map(int, input().split())) for _ in range(n)]
cdes = [list(map(int, input().split())) for _ in range(m)]

for a, b in abes:
    mi = sorted(cdes, key=lambda x : abs(x[0]-a)+abs(x[1]-b))
    print(cdes.index(mi[0])+1)

Measured memory_bytes: 9044
package main

import (
	"fmt"
	"math"
)

func main() {
	var n int
	fmt.Scanf("%d", &n)

	a := make([]int, n)
	for i := 0; i < len(a); i++ {
		fmt.Scanf("%d", &a[i])
	}

	//fmt.Printf("%d %d %d\n", max(a), min(a), ave(a))
	ave := ave(a)
	ans := 0
	for i := 0; i < len(a); i++ {
		cost := (a[i] - ave) * (a[i] - ave)
		ans = ans + cost
	}
	fmt.Println(ans)
}

func max(a []int) (max int) {
	max = a[0]
	for i := 1; i < len(a); i++ {
		if max < a[i] {
			max = a[i]
		}
	}
	return
}

func min(a []int) (min int) {
	min = a[0]
	for i := 1; i < len(a); i++ {
		if min > a[i] {
			min = a[i]
		}
	}
	return
}

func ave(a []int) int {
	sum := 0
	for i := 0; i < len(a); i++ {
		sum = sum + a[i]
	}
	ave := float64(sum) / float64(len(a))
	return int(round(ave))
}

func round(f float64) float64 {
	if f > 0 {
		return math.Floor(f + .5)
	} else if f < 0 {
		return math.Ceil(f - .5)
	} else {
		return 0
	}
}


Measured memory_bytes: 512
from heapq import heappush, heappop

N, M = map(int, input().split())
tasks = []
for _ in range(N):
    A, B = map(int, input().split())
    tasks.append([A, B])

tasks.sort()

q = []
p = 0
ans = 0
for i in range(1, M+1):
    while p < N and tasks[p][0] <= i:
        heappush(q, -tasks[p][1])
        p += 1
    if len(q) == 0:
        continue
    ans -= heappop(q)

print(ans)

Measured memory_bytes: 71512
import sys
input = sys.stdin.readline


h, w = map(int, input().split())
inf = float('INF')
A = []
B = []

for i in range(h):
    line = list(map(int, input().split()))
    A.append(line)

for i in range(h):
    line = list(map(int, input().split()))
    B.append(line)

D = [[0]*w for i in range(h)]
for i in range(h):
    for j in range(w):
        D[i][j] = abs(A[i][j] - B[i][j])


def slide_down(y, x, possible):
    new = set()
    delta = D[y+1][x]
    limit = (h+w) * 80
    for num in possible:
        if num + delta <= limit - (y+x)*80:
            new.add(num+delta)
        if abs(num-delta) <= limit - (y+x)*80:
            new.add(abs(num-delta))
    return new


def slide_right(y, x, possible):
    new = set()
    delta = D[y][x+1]
    limit = (h+w) * 80
    for num in possible:
        if num + delta <= limit - (y+x)*80:
            new.add(num+delta)
        if abs(num-delta) <= limit - (y+x)*80:
            new.add(abs(num-delta))
    return new


DP = [[set() for j in range(w)] for i in range(h)]
DP[0][0] = {D[0][0]}
for row in range(h):
    for col in range(w):
        possible = DP[row][col]
        if col < w-1:
            new = slide_right(row, col, possible)
            DP[row][col+1] |= new
        if row < h-1:
            new = slide_down(row, col, possible)
            DP[row+1][col] |= new

ans = min(DP[h-1][w-1])
print(ans)


Measured memory_bytes: 774152
#include<cstdio>
#include<cmath>
#include<string>
#include<iostream>
#include<algorithm>
#include<utility>
#include<vector>
#include<map>
#include<set>
#include<limits>
#include<bitset>
#include<array>
#include<numeric>
#include<iomanip>
#include<functional>
#include<deque>

using namespace std;
typedef long long int ll;

#define C cout<<
#define E <<endl

ll n,m,a,b,c,x,y,z,aa[10010][10010];
bool r,ra,rb,rc;
string s,sa,sb,sc[100];
char ca,cb,cc,cd[1000][1000];
vector<ll> va,vb,vc;

int main(){
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>sc[i];
        for(int j=0;j<sc[i].size();j++){
            aa[i][sc[i][j]]++;
        }
    }
    for(int i=1;i<n;i++){
        for(int j=0;j<200;j++){
            aa[0][j]=min(aa[0][j],aa[i][j]);
        }
    }
    for(int i=70;i<200;i++){
        for(int j=0;j<aa[0][i];j++)C char(i);
    }
    cout<<endl;
    
}

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

int eat(int d, int a){
  int chocolate=0;
  for(int i=0;i<=d;i++){
    if(i*a+1>d) break;
    chocolate++;
  }
  return chocolate;
}
int main(){
  int n,d,x,a,ans=0;
  cin>>n>>d>>x;
  for(int i=0;i<n;i++){
    cin>>a;
    ans+=eat(d,a);
  }
  cout<<ans+x<<"\n";
}


Measured memory_bytes: 256
import java.util.*;

public class Main{
	public static void main(String args[]) {

		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int L = sc.nextInt();
		sc.close();
		
		int result = (N *(2 * L + N - 1))/2;
		result -= ((L >= 0)?L:Math.min(0, L + N - 1));
		
		System.out.println(result);
	}
}

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

string s;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cin >> s;
    cout << (s.find_last_of("Z")-s.find_first_of("A")+1) << endl;
    return 0;
}


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

typedef long long ll;
using namespace std;
int main(){
    string s;
    cin >> s;
    if(s=="SUN"){
        cout << 7 << "\n";
    } else if(s=="MON"){
        cout << 6 << "\n";
    } else if(s=="TUE"){
        cout << 5 << "\n";
    } else if(s=="WED"){
        cout << 4 << "\n";
    } else if(s=="THU"){
        cout << 3 << "\n";
    } else if(s=="FRI"){
        cout << 2 << "\n";
    } else if(s=="SAT"){
        cout << 1 << "\n";
    }
    return 0;
}

Measured memory_bytes: 256
def solve():
    N, W = map(int, input().split())
    A = [list(map(int, input().split())) for _ in range(N)]
    dp = [0]*(W+1)
    for w in range(1,W+1):
        for i in range(N):
            if A[i][1]<=w:
                dp[w] = max(dp[w],dp[w-A[i][1]]+A[i][0])
    ans = dp[-1]
    return ans
print(solve())


Measured memory_bytes: 5924
#define _CRT_SECURE_NO_WARNINGS
#define REL

#pragma GCC optimize("Ofast")

#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <deque>
#include <queue>
#include <iomanip>
#include <cstdio>
#include <unordered_map>
#include <unordered_set>
#include <map>
#include <string>
#include <set>
#include <bitset>
#include <cstdint>
#include <cstring>
#include <cassert>
#include <complex>
#include <stack> 

using namespace std;

typedef int64_t i64;
typedef long long LL;
typedef long long ll;
typedef long double LD;
typedef complex <LD> cld;
typedef unsigned int uint;
typedef complex <double> cd;
typedef unsigned long long ULL;

#define endl "\n"
#define dendl "\n\n"
#define mp make_pair
#define mt make_tuple
#define size(v) (int)v.size()
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()

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

template <typename T>
T sqr(T a) {
	return a * a;
}

template <typename T>
int sign(T a) {
	if (a == 0)
		return 0;
	return (a > 0 ? 1 : -1);
}

template <typename T1, typename T2>
T2 sum_mod(T1 x, T2 MOD) {
	if (x < 0)
		x += MOD;
	if (x >= MOD)
		x -= MOD;
	return x;
}

template <typename T1, typename T2>
T2 mul_mod(T1 x, T2 MOD) {
	if (x < 0)
		return (abs(x) % MOD == 0 ? 0 : MOD - abs(x) % MOD);
	return x % MOD;
}

template <typename T>
bool uax(T& a, const T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}

template <typename T>
bool uin(T& a, const T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}

template <typename T1, typename T2>
istream& operator >> (istream& in, pair<T1, T2>& p) {
	in >> p.first >> p.second;
	return in;
}

template <typename T1, typename T2>
ostream& operator << (ostream& out, pair<T1, T2>& p) {
	out << p.first << ' ' << p.second;
	return out;
}

const int LOG = 18;
const int N = (int)2e5 + 7;
const int MAXN = (int)2e3 + 7;
const int MOD = (int)1e9 + 7;
const int INF = (int)1e9 + 7;
const int CONST = 300;
const LL LINF = (i64)2e15;
const LD PI = 3.1415926535897932384626433832795;
const LD EPS = 1;

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

int n, c[N];

int bin_pow(int a, int p) {
	int res = 1;
	while (p) {
		if (p & 1)
			res = 1LL * res * a % MOD;
		a = 1LL * a * a % MOD;
		p >>= 1;
	}
	return res;
}

int add(int a, int b) {
	return (a + b) % MOD;
}

int mul(int a, int b) {
	return 1LL * a * b % MOD;
}

int main() {
	double start = clock();
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	cout << fixed << setprecision(20);
	cerr << fixed << setprecision(20);
#else
	cout << fixed << setprecision(20);
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
#endif

	cin >> n;
	for (int i = 1; i <= n; i++)
		cin >> c[i];
	sort(c + 1, c + n + 1);
	reverse(c + 1, c + n + 1);
	int ans = 0;
	for (int i = 1; i <= n; i++) {
		int val = mul(c[i], i + 1);
		ans = add(ans, val);
	}
	cout << mul(ans, bin_pow(2, 2 * n - 2));
	
#ifdef _DEBUG
	cout << endl << "Time is " << (clock() - start) / 1000.0;
#endif
}

Measured memory_bytes: 1024
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;

class Program
{
    static void Main(string[] args)
    {
        var HN = ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
        var (H, N) = (HN[0], HN[1]);
        var A = ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();

        var ASum = A.Sum();

        H -= ASum;

        if (H <= 0)
            WriteLine("Yes");
        else
            WriteLine("No");
    }
}


Measured memory_bytes: 35884
#include<iostream>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
using namespace std;
int main() {
    int n,q,r;
    cin >> n;
    vector<int> v(n);
    for (int i = 0; i < n; i++)
        cin >> v[i];
    cin >> q; bool w;
    bool y = true;
    for (int i = 0; i < q; i++) {
        cin >> r;
        w = binary_search(v.begin(), v.end(), r);
        if (!w) y = false;
    }
    if (y)
        cout << 1 << endl;
    else
        cout << 0 << endl;
}


Measured memory_bytes: 3616
import itertools
n,k=map(int,input().split())
a=list(map(int,input().split()))
for i in range(min(k,50)):
  imos=[0]*(n+1)
  for j in range(n):
    imos[max(j-a[j],0)]+=1
    imos[min(j+a[j]+1,n)]-=1
  a=list(itertools.accumulate(imos))
  if a[:n]==[n]*n:
    break
    
print(*a[:n]) 


Measured memory_bytes: 211432
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <chrono>
#include <stack>
#include <string>
#include <bitset>
#include <unordered_map>
#include <cstdio>
#include <limits>
#include <vector>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <fstream>
#include <numeric>
#include <unordered_set>
#include <sstream>
#include <cassert>
#include <tuple>
#include <iomanip>
#include <random>
#include <iostream>
#include <algorithm>
#include <stdio.h>

using namespace std;

#define all(x) (x).begin(),(x).end()
#define ll long long
#define sz(x) (int)(x.size())
#define pb push_back
#define rnd mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define endl "\n"
#define int long long


const int N = (int)(1e6) + 322;
const long long inf = (long long)(1e18) + 123;
const int mod = (int)(1e9);
const double EPS = 1e-9;

map <int, int> cnt, cntofcnt;

vector <int> counts, fs;

int pref[N];

signed main() {
    ios_base :: sync_with_stdio(0);
    cin.tie(0);
    int n; cin >> n;
    for(int i = 1; i <= n; ++i) {
        int x; cin >> x;
        cnt[x]++;
    }
    for(auto it : cnt) {
        counts.pb(it.second);
    }
    counts.pb(0);
    sort(all(counts));
    for(int i = 1; i < sz(counts); ++i) {
        pref[i] = pref[i - 1] + counts[i];
    }

    for(int i = 1; i <= n; ++i) {
        int pos = lower_bound(all(counts), i) - counts.begin();
        int curans = (sz(counts) - pos);
        //cout << curans << ' ' << i << endl;
        curans += (pref[pos - 1] / i);
        fs.pb(curans);
    }
    reverse(all(fs));
    //for(auto i : fs) cout << i << ' ';
    //cout << endl;
    for(int i = 1; i <= n; ++i) {
        int pos = lower_bound(all(fs), i) - fs.begin();
        if (pos == n) {
            cout << 0 << endl;
        }else {
            cout << n - pos << endl;
        }
    }
    return 0;
}



Measured memory_bytes: 31980
S = input()
l = len(S)
dp = [[0]*2 for _ in range(l+1)]
dp[1][0]=min(dp[0][1]+10-int(S[0])+1,dp[0][0]+int(S[0]))
dp[1][1]=min(dp[0][1]+10-int(S[0])-1+1,dp[0][0]+int(S[0])+1)
for i in range(1,l):
  dp[i+1][0]=min(dp[i][1]+10-int(S[i]),dp[i][0]+int(S[i]))
  dp[i+1][1]=min(dp[i][1]+10-int(S[i])-1,dp[i][0]+int(S[i])+1)
print(dp[-1][0])

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

int main(){
    int n;cin>>n;
    vector<int> h(n),m(n);
    for(auto&& w:h)cin>>w;
    m[0]=h[0];
    for(int i=1;i<n;i++)m[i]=max(m[i-1],h[i]);
    int cnt=0;
    for(int i=0;i<n;i++)if(m[i]<=h[i])cnt++;
    cout<<cnt<<endl;
    
}

Measured memory_bytes: 256
#include <iostream>
#include<string>
#include<cmath>
#include<ciso646>
#include<cstring>
#include<iomanip>
#include<vector>
using ll = long long;

using namespace std;




int main()
{/*六日目*/
//少数も使いたい割り算はしない方がいい
// 数値の大きさ
//for文で0代入する場所はforの一文下
//オーバーフローする一手手前を分解して作る・ 割り算で減らしていく
//for文いつも間違える/ i<nなら最後はa[n-1]
	
//関数使ってみるよ(五日目)
	int l;cin >> l;
	double sek;
	sek = static_cast <double>(1)*l*l * l / 27;
	cout <<fixed<<  sek;
	
	
	
	

}

Measured memory_bytes: 256
use std::io::{ stdin, stdout, BufRead, BufReader, Write };
use std::ops::{ Add, Sub, Mul };

const SP : u8 = b' ';
const LF : u8 = b'\n';

#[inline(always)]
fn atoui<T>(s: &[u8]) -> T
  where T: Add<Output=T> +
           Sub<Output=T> +
           Mul<Output=T> +
           Default +
           From<u8>
{
  let mut n = T::default();
  if s.len() == 0 {
    return n;
  }

  let mut i = 0;
  if s[i] == b'+' {
    i += 1;
  }

  for b in &s[i..] {
    n = (n * T::from(10)) + T::from(b - b'0');
  }

  n
}

fn main() {
  let stdin = stdin();
  let mut stdin = BufReader::new(stdin.lock());

  let mut buf = Vec::with_capacity(500 * 2);
  let len = stdin.read_until(SP, &mut buf).unwrap();
  buf.truncate(len - 1);
  let h = atoui::<usize>(&buf);

  buf.clear();
  let len = stdin.read_until(LF, &mut buf).unwrap();
  buf.truncate(len - 1);
  let w = atoui::<usize>(&buf);

  let mut ans = Vec::new();
  let mut n   = 0;

  let mut odd = 0;
  let mut x   = 0;
  let mut y   = 0;

  for i in 0..h {
    buf.clear();
    stdin.read_until(LF, &mut buf).unwrap();

    if i % 2 == 0 {
      for j in 0..w {
        if odd != 0 {
          writeln!(&mut ans, "{} {} {} {}", y + 1, x + 1, i + 1, j + 1).unwrap();
          n += 1;
        }
        odd ^= buf[j * 2] & 1;
        y = i;
        x = j;
      }
    } else {
      for mut j in 0..w {
        j = w - 1 - j;

        if odd != 0 {
          writeln!(&mut ans, "{} {} {} {}", y + 1, x + 1, i + 1, j + 1).unwrap();
          n += 1;
        }
        odd ^= buf[j * 2] & 1;
        y = i;
        x = j;
      }
    }
  }

  let stdout = stdout();
  let mut stdout = stdout.lock();
  writeln!(&mut stdout, "{}", n).unwrap();
  stdout.write(&ans).unwrap();
  stdout.flush().unwrap();
}


Measured memory_bytes: 8188
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
using namespace std;
int read()
{
	char aa=getchar();int pp=1,kk=0;
	if(aa<'0'||aa>'9') {if(aa=='-') pp=-1;aa=getchar();}
	while(aa>='0'&&aa<='9') {kk=kk*10+aa-'0';aa=getchar();}
	return kk*pp;
}
char s[500005];
int n,L,f[500005][27],g[500005][21];
void init()
{
	for(int i=1;i<=L+2;++i)
	for(int j=0;j<=26;++j)
	{
		f[i][j]=L+2;
		if(j<=20) g[i][j]=L+2;
	}
	for(int i=L;i>=1;i--)
	{
		f[i][s[i]-'a']=i+1;
		for(int j=s[i]-'a'+1;j<=26;++j) f[i][j]=f[f[i][j-1]][j-1];
		g[i][0]=f[i][26];
		for(int j=1;j<=20;++j) g[i][j]=g[g[i][j-1]][j-1];
		for(int j=0;j<=26;++j) if(f[i][j]==L+2) f[i][j]=f[g[i][0]][j];
	}
}
int ok(int aa,int bb)
{
	for(int i=20;i>=0;i--)
	{
		if(g[aa][i]==bb+1) return 1;
		if(g[aa][i]<=bb) aa=g[aa][i];
	}
	return 0;
}
int main()
{
	scanf("%s",s+1);
	n=read();
	L=strlen(s+1);
	init();
	for(int i=1;i<=n;++i)
	{
		int x=read(),y=read();
		if(ok(x,y)) puts("Yes");
		else puts("No");
	}
	return 0;
}

Measured memory_bytes: 94848
#include<iostream>
#include<cmath>
#include<string>
#include<cctype>
#include<vector>
using namespace std;
int main(){
        for(int i=1;i<10;i++){
                for(int j=1;j<10;j++){
                        printf("%dx%d=%d\n",i,j,i*j);
                }
        }
        return 0;
}

Measured memory_bytes: 1088
#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e18;

struct Edge {int to; long long cost;};
struct Bedge { int from, to; long long cost; };

template<class T>
vector<T> Bell(const vector<vector<Edge>> &G, int s, T def) {
    int N = (int)G.size();
    vector<T> dist(N, def);
    vector<bool> negative(N);
    vector<Bedge> edges;
    for(int from = 0; from < N; ++from) {
        for(auto &e : G[from]) edges.push_back({from, e.to, e.cost});
    }
    dist[s] = 0;
    for(int loop = 0; loop < N - 1; ++loop) {
        for(auto &e : edges) {
            if(dist[e.from] == INF) continue;
            if(dist[e.to] > dist[e.from] + e.cost) {
                dist[e.to] = dist[e.from] + e.cost;
            }
        }
    }
    for(int loop = 0; loop < N; ++loop) {
        for(auto &e : edges) {
            if(dist[e.from] == INF) continue;
            if(dist[e.to] > dist[e.from] + e.cost) {
                dist[e.to] = dist[e.from] + e.cost;
                negative[e.to] = true;
            }
            if(negative[e.from]) negative[e.to] = true;
        }
    }
    for(int i = 0; i < N; ++i) {
        if(negative[i]) dist[i] = -INF;
    }
    return dist;
}

void solve() {
    int N, M, P;
    cin >> N >> M >> P;
    vector<vector<Edge>> G(N);
    for(int i = 0; i < M; ++i) {
        int a, b, c;
        cin >> a >> b >> c;
        a--, b--;
        G[a].push_back({b, P - c});
    }
    auto dist = Bell(G, 0, INF);
    long long ans = -dist[N - 1];
    if(ans == INF) cout << -1 << '\n';
    else if(ans < 0) cout << 0 << '\n';
    else cout << ans << '\n';
}

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


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


using namespace std;

int main(){
  int a,b;
  cin >> a >> b;

  if(a < 10 && b < 10){
    if(0 < a && 0 < b){
      cout << a*b << endl;

      return 0;
    }
  }
  cout << -1 << endl;
  return 0;
}


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

int INF=INT_MAX;
char maze[25][25];
int di[]={0,1,0,-1};
int dj[]={1,0,-1,0};

int main(){
  int h,w; cin>>h>>w;
  rep(i,h)rep(j,w){
    cin>>maze[i][j];
  }
  int ans=0;
  rep(i,h)rep(j,w){
    if(maze[i][j]=='#') continue;
    vector<vector<int>> dis(h,vector<int>(w,INF));
    queue<P> q;
    q.push(make_pair(i,j));
    dis[i][j]=0;
    while(!q.empty()){
      int pi=q.front().first, pj=q.front().second;
      q.pop();
      rep(k,4){
        int ni=pi+di[k], nj=pj+dj[k];
        if(ni<0 || ni>=h || nj<0 || nj>=w) continue;
        if(maze[ni][nj]=='#') continue;
        if(dis[ni][nj]!=INF) continue;
        dis[ni][nj]=dis[pi][pj]+1;
        q.push(make_pair(ni,nj));
      }
    }
    rep(hi,h)rep(wi,w){
      if(dis[hi][wi]!=INF) ans=max(ans,dis[hi][wi]);
    }
  }
  cout<<ans<<endl;
}



Measured memory_bytes: 3608
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define endl '\n'
#define sz(v) (int)v.size() 
#define all(v) v.begin(), v.end()
void dbg_out() { cerr << "\b\b]\n"; }
template<typename Head, typename... Tail> void dbg_out(Head H, Tail... T){ cerr << H << ", "; dbg_out(T...);}
#define watch(...) cerr << "[" << #__VA_ARGS__ << "]: [", dbg_out(__VA_ARGS__)


/****************************** CODE IS HERE ***********************************/


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

    int n, k; cin >> n >> k;
    vector <int> A(n);
    for (int &i : A) cin >> i;

    vector <ll> dp(n, 1e18);
    dp[0] = 0;
    //push-dp
    for (int i = 0; i < n; ++i) {
        for (int j = 1; j <= k; ++j) {
            int jump = i + j;
            if (jump < n) dp[jump] = min(dp[jump], dp[i] + abs(A[i] - A[jump]));
        }
    }

    cout << dp[n-1];


    return 0;
}

//recurrence: pull-dp recurrence, for each i[1, n], dp[i] = min(dp[i], dp[i-k] + abs(A[i-k] - A[i])), such that (i - k > 0)  

Measured memory_bytes: 1408
#include<stdio.h>
int min(int x,int y){
  if(x<y)return x;
  else return y;
}
int main(void){
  int n;
  scanf("%d",&n);
  int a[n],b[n-1];
  for(int i=0;i<n-1;i++){
	scanf("%d",&b[i]);
  }
 int sum=0;
  sum+=b[0]+b[n-2];
  for(int i=1;i<n-1;i++){
	sum+=min(b[i-1],b[i]);
  }

	printf("%d",sum);
  return 0;
}


Measured memory_bytes: 128
#pragma region template
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using vld = vector<ld>;
using vvld = vector<vld>;
using vvvld = vector<vvld>;
using vs = vector<string>;
using pll = pair<ll, ll>;
using vp = vector<pll>;
template <typename T>
using pqrev = priority_queue<T, vector<T>, greater<T>>;
#define rep(i, n) for (ll i = 0, i##_end = (n); i < i##_end; i++)
#define repb(i, n) for (ll i = (n)-1; i >= 0; i--)
#define repr(i, a, b) for (ll i = (a), i##_end = (b); i < i##_end; i++)
#define reprb(i, a, b) for (ll i = (b)-1, i##_end = (a); i >= i##_end; i--)
#define ALL(a) (a).begin(), (a).end()
#define SZ(x) ((ll)(x).size())
/*
constexpr ll MOD = 1e9 + 7;
/*/
constexpr ll MOD = 998244353;
//*/
constexpr ll INF = 1e+18;
constexpr ld EPS = 1e-12L;
constexpr ld PI = 3.14159265358979323846L;
constexpr ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }
constexpr ll LCM(ll a, ll b) { return a / GCD(a, b) * b; }
template <typename S, typename T>
constexpr bool chmax(S &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <typename S, typename T>
constexpr bool chmin(S &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
#ifdef OJ_LOCAL
#include "dump.hpp"
#else
#define dump(...) ((void)0)
#endif
template <typename T>
bool print_(const T &a) {
  cout << a;
  return true;
}
template <typename T>
bool print_(const vector<T> &vec) {
  for (auto &a : vec) {
    cout << a;
    if (&a != &vec.back()) {
      cout << " ";
    }
  }
  return false;
}
template <typename T>
bool print_(const vector<vector<T>> &vv) {
  for (auto &v : vv) {
    for (auto &a : v) {
      cout << a;
      if (&a != &v.back()) {
        cout << " ";
      }
    }
    if (&v != &vv.back()) {
      cout << "\n";
    }
  }
  return false;
}
void print() { cout << "\n"; }
template <typename Head, typename... Tail>
void print(Head &&head, Tail &&... tail) {
  bool f = print_(head);
  if (sizeof...(tail) != 0) {
    cout << (f ? " " : "\n");
  }
  print(forward<Tail>(tail)...);
}
#pragma endregion

void Pr(bool f){
  cout << (f ? "Yes" : "No") << "\n";
  exit(0);
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(20);
  ll n, m;
  cin >> n >> m;
  vll a(n);
  rep(i, n){
    cin >> a[i];
  }
  vll b(m);
  rep(i, m){
    cin >> b[i];
  }
  auto c = convolution(a, b);
  print(c);
}


Measured memory_bytes: 27292
#割り算が計算に入るのでそれを排除しようと試行錯誤中
def f(e,a,b)
	if e-a<=0
		return 0
	else
		return (e-a)/b+((e-a)%b>0?1:0)
	end
end
 
def f2(d,m)
	r=10
	res=1
	while d>0 do
 		if d%2==1
 			res=(res*r)%m
 		end
		r=(r*r)%m
 		d/=2
	end
	return res
end
 
def f3(r0,p0,m)
	r1=0
	t1=1
	res=0
	r2=0
	while r0>0
		if r0%2==1
			res=(res+t1*f2(r2,m))%m
		end
		
		if r1==0
			r1=p0
		else
			r1=(r1+r1)
		end
		t1=(t1*(f2(r1,m)+1))%m
		if r0%2==1
			r2=(r2+r1)
		end
		
		r0/=2
	end
	return res
end
 
def f3b(r0,p0,m,base)
	r1=1
	res=0
	t1=1
	k=r0
	d=1
	r2=0
	r3=0
	while r0>0 do
		if r0%2==1
				k=k-r1
				res=(res+t1*f2(r3,m)+(k+base)*f3(r1,p0,m)*f2(r3,m))%m
		end
 
		if r2==0
			r2=p0
		else
			r2=(r2+r2)
		end
		if r0%2==1
			r3=(r3+r2)
		end
		
		t1=(t1*(1+f2(r2,m))+r1*f3(r1,p0,m))%m
		r1=r1*2
		r0/=2
	end
	return res%m
end
 
def f4(l,a,b,m)
 
ansA=-1
#str=""
#l.times{|i|
#	str=str + (a+b*i).to_s
#}
#ansA=((str.to_i)%m)
 
 
 
rs=(0..50).map{|e| 10**e}
ts=rs.map{|e| f(e,a,b)}.select{|e| e<=l}
ts<<l
ra=1
suma=0
suma2=0
suma3=0
sumb=0
sumb2=0
sumc2=0
mr2=1
rk=1
base=l
ts.size.times{|i|
	p1=ts.size-1-i
	p2=p1-1
	if(p2>=0 && ts[p1]>ts[p2])
		p3=rs[p1]
		t3=ts[p1]-ts[p2]-1
		t4=t3+1
		base=base-t4
	
			q0=f2(p1*(t4+1),m)
			q1=f2(p1*t4,m)
			q2=f2(p1,m)
			q3=(q2+(m-1))%m
			s10=f3(t4,p1,m)%m
			t10=f3b(t4,p1,m,base-1)%m
			t11=(s10*(ts[p2]-1))%m
			suma2=((suma2+mr2*s10))%m
			sumb2=((sumb2+mr2*t10))%m
			sumc2=(sumc2+(t4*p1))
			mr2=f2(sumc2,m)%m
	end
}
 
#p ((a*suma2+b*sumb2)%m)
ansB=((a*suma2+b*sumb2)%m)
if ansA==-1
	p ansB
elsif not (ansA==ansB)
  print m.to_s+"m "
end

end
 
ds=gets.split(" ").map{|e| e.to_i}
l=ds[0]
a=ds[1]
b=ds[2]
m=ds[3]
 
#(1..20).each{|e|
#		p ["ans",e,f3b(e,100,m*m*m,3)]
#}
 
f4(l,a,b,m)
 
#(10..13).each{|l2|
#  (13..14).each{|a2|
#		[13,18,25,57,89,433].each{|b2|
#			(2..30).each{|m2|
#				#p [l,a,b]
#				f4(l2,a2,b2,m2)
#			}
#		}
#	}
#}

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

using namespace std;

bool redsort(const pair<int, int>& ab, const pair<int, int>& cd) {
	if(ab.second>cd.second)return true;
	return false;
}

bool blusort(const pair<int, int>& ab, const pair<int, int>& cd) {
	if(ab.first<cd.first)return true;
	return false;
}

int main()
{
  int N;
  vector<pair<int,int>> red;
  vector<pair<int,int>> blu;
  cin>> N;
  for(int i=0;i<N;i++)
  {
    int a,b;
    cin>> a>> b;
    red.push_back(pair<int,int>(a,b));
  }
  for(int i=0;i<N;i++)
  {
    int c,d;
    cin>> c>> d;
    blu.push_back(pair<int,int>(c,d));
  }

  int ret=0;
  sort(begin(red),end(red),redsort);
  sort(begin(blu),end(blu),blusort);
  for(int i=0;i<N;i++)cerr<< ":"<< red[i].first<< " "<< red[i].second<< " "<< blu[i].first<< " "<< blu[i].second<< endl;
  for(int i=0;i<N;i++)
  {
    for(int j=0;j<red.size();j++)
    {
      if(blu[i].first>red[j].first&&blu[i].second>red[j].second)
      {
        red.erase(red.begin()+j);
        ret++;
        break;
      }
    }
  }
  cout<< ret<< endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
int main()
{
  int n; string s;
  cin >> n >> s;
  bool flag = false;
  if(n%2==0){
  string s1 = s.substr(0, n/2); 
  string s2 = s.substr(n/2, n/2);
  if(!s1.compare(s2))
  flag = true;
  }
  if(flag)
  cout << "Yes";
  else
  cout << "No";
}


Measured memory_bytes: 256
def insertionSort(table, g):
    global cnt
    for i in range(g, len(table)):
        v = table[i]
        j = i - g
        while j >= 0 and table[j] > v:
            table[j + g] = table[j]
            j = j - g
            cnt += 1
        table[j + g] = v


def shellSort(table):
    gap = [1]
    while gap[0] * 3 + 1 < len(table):
        gap.insert(0, (gap[0] * 3 + 1))
    for g in gap:
        insertionSort(table, g)
    return gap


n = int(input())
table = []
cnt =0
for i in range(n):
    table.append(int(input()))
gap = shellSort(table)
print(len(gap))
print(' '.join(map(str, gap)))
print(cnt)
print('\n'.join(map(str, table)))



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

int main () {
  int N;
  cin >> N;
  
  int count = 0;
  for (int i = 0; i < N; i++) {
    if ((i+1)%2 == 1) {
      count ++;
    }
  }
  cout << fixed << setprecision(10);
  double a = (double)count / (double)N;
  cout << a << endl;
}

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

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

    bool can = false;
    for (int i = 1; i <= B; i++)
    {
        if((A * i) % B == C) can = true;
    }

    if(can) cout << "YES" << endl;
    else cout << "NO" << endl;
}

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

using namespace std;

int main() {
    cin.tie(0);
    cout.tie(0);
    ios_base::sync_with_stdio(0);
    int a, b, c, d, ans1, ans2;
    cin >> a >> b >>c >>d;
    ans1 = (a + d -1)/d;
    ans2 = (c + b - 1)/b;
    if(ans1 >= ans2)
        cout << "Yes";
    else
        cout << "No";
}

Measured memory_bytes: 3652
#include<stdio.h>
int main(){
  int n,m,c,ans=0,i,j;
  scanf("%d%d%d",&n,&m,&c);
  int a[n+1][m+1],b[m+1];
  for(i=0;i<m;i++)
    scanf("%d",&b[i]);
  for(i=0;i<n;i++)
    for(j=0;j<m;j++)
      scanf("%d",&a[i][j]);
  for(i=0;i<n;i++){
    int check=c;
    for(j=0;j<m;j++)
      check+=a[i][j]*b[j];
    if(check>0)
      ans++;
  }
  printf("%d\n",ans);
  return 0;
}


Measured memory_bytes: 256
#akash mandal: jalpaiguri government engineering college
#take a look on special cases: test cases
import sys,math

def ii(): return int(input())
def mii(): return map(int,input().split())
def lmii(): return list(mii())

def decimalToBinary(n):  
    return bin(n).replace("0b", "")

def main():
    n=input()
    if n.count("7")>=1:
        print("Yes")
    else:
        print("No")
    
        
    
            

        
if __name__=="__main__":
    main() 

Measured memory_bytes: 9052
#include <iostream>
#include <complex>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <cmath>
#include <bitset>
#include <cassert>
#include <queue>
#include <stack>
#include <deque>
#include <random>
#include <iomanip>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef pair<ll,ll> P;
const ll MOD=1000000007;
const ll MAX_N=500010;
const ll INF=999999999999;

int main(){
    int x,n;
    cin>>x>>n;
    vector<int> p(n);
    vector<int> test(100);
    for(int i=0;i<100;i++){
        test[i]=i+1;
    }
    for(int i=0;i<n;i++){
        cin>>p[i];
        test[p[i]-1]=100000;
    }
    int ans=0;
    int dis=x;
    for(int i=0;i<100;i++){
        if(abs(x-test[i])<dis){
            dis=abs(x-test[i]);
            ans=i+1;
        }
    }
    if(abs(x-101)<dis){
        ans=101;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3604
#include <iostream>
using namespace std;
int main(){
    char a;
    cin>>a;
    int counter=0;
    if(a=='A'||a=='B'||a=='C'||a=='D'||a=='E'||a=='F'||a=='G'||a=='H'||a=='I'||a=='J'||a=='K'||a=='L'||a=='M'||a=='N'||a=='O'||a=='P'||a=='Q'||a=='R'||a=='S'||a=='T'||a=='U'||a=='V'||a=='W'||a=='X'||a=='Y'||a=='Z'){
        counter=1;
    }
    if(counter==0){
        cout<<"a"<<endl;
    }else{
        cout<<"A"<<endl;
    }
}


Measured memory_bytes: 3028
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using vl = vector<ll>;
int main(){
    ll N;
    cin >> N;
    ll sum = 0;
    vector<pair<ll, ll>> P(N);
    // first B, second A
    for(int i = 0; i < N; i++){
        cin >> P.at(i).second >> P.at(i).first;
    }
    bool ans = 1;
    sort(P.begin(), P.end());
    for(int i = 0; i < N; i++){
        sum += P.at(i).second;
        if(P.at(i).first < sum){
            ans = 0;
            break;
        }
    }
    if(ans){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 3328
#include<stdio.h>
int way[200];
int a,b;
int cou=0;
int main()
{
    while(scanf("%d%d",&a,&b)!=-1)
    {
        for(int i=0;i<200;i++)
        {
            way[i]=0;
        }
        cou=0;
        way[a]++;
        way[b]++;
        while(1)
        {
            scanf("%d%d",&a,&b);
            if(a==0&&b==0)break;
            way[a]++;
            way[b]++;
        }
        if(way[1]%2==1&&way[2]%2==1)
        {
            cou=0;
            for(int i=3;i<200;i++)
            {
                if(way[i]%2!=0)break;
                cou++;
            }
            if(cou==197)printf("OK\n");
            else printf("NG\n");
        }
        else printf("NG\n");
    }
    return 0;
}

Measured memory_bytes: 1012
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;

int main()
{
	vector<int> heights;
	for (int i = 0; i < 10; i++) {
		int height;
		cin >> height;
		heights.push_back(height);
	}
	sort(heights.rbegin(), heights.rend());
	for (int i = 0; i < 3; i++) {
		cout << heights[i] << endl;
	}
}

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

using namespace std;

#define _ ios_base::sync_with_stdio(0);cin.tie(0);
#define endl '\n'
#define f first
#define s second

typedef long long ll;

const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fll;

const int MOD = 1e9+7;

int memo[10010][110][2], n, d; // pos, sum, even

string k;

int dp(int pos, int sum, int even) {
	if(pos == n) return (sum ? 0 : 1);	
	int& p = memo[pos][sum][even];
	if(p != -1) return p;
	
	int ret = 0;
	if(even) {
		for(int i=0; i <= (k[pos] - '0'); i++) {
			if(i == k[pos]-'0') 
				ret = (ret + dp(pos+1, (sum + i) % d, 1)) % MOD;
			else 
				ret = (ret + dp(pos+1, (sum + i) % d, 0)) % MOD;
		}
	}
	else {
		for(int i=0; i<10; i++)
			ret = (ret + dp(pos+1, (sum + i) % d, 0)) % MOD;
	}

	return p = ret;
}

int main(){ _

	cin >> k >> d;

	n = k.size();

	memset(memo, -1, sizeof memo);

	cout << ((dp(0, 0, 1)-1) % MOD + MOD ) % MOD << endl;

	return 0;
}


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

int main() {
    int n;
    cin >> n;
    for (int i = 1; i <= n; i++) {
        if (i % 3 == 0) {
            cout << " " << i;
            continue;
        }
        
        for (int x = i; x > 0; x /= 10) {
            if (x % 10 == 3) {
                cout << " " << i;
                break;
            }
        }
    }

    cout << endl;
}

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

int main()
{
    string s;
    cin >> s;
    int count = 0;
    int maxz = 0;
    for (int i = 0; i <= s.size(); i++)
    {
        if (s[i] == 'A' || s[i] == 'T' || s[i] == 'G' || s[i] == 'C')
        {
            count++;
        }
        else
        {
            if (count >= maxz)
            {
                maxz = count;
            }
            count = 0;
        }
    }
    cout << maxz << endl;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import sys

def main():
	N = int(input())
	tmp = input()
	lines = list(tmp)
	
	nisi = [0 for _ in range(N)]
	higasi = [0 for _ in range(N)]
	for i, val in enumerate(lines):
		if val == "W":
			if i != 0:
				nisi[i] = nisi[i-1] + 1
			else:
				nisi[i] = 1
		else:
			if i != 0:
				nisi[i] = nisi[i-1]
			else:
				nisi[i] = 0
		
	for i in range(N-1, -1, -1):
		if lines[i] == "E":
			if i < N-1:
				higasi[i] = higasi[i+1] + 1
			else:
				higasi[i] = 1
		else:
			if i < N-1:
				higasi[i] = higasi[i+1]
			else:
				higasi[i] = 0
	
	ans_min = -1
	for i, val in enumerate(lines):
		ans = 0
		ans1 = 0
		ans2 = 0
		if i < (N - 1):
			ans1 = higasi[i+1]
		if i > 0:
			ans2 = nisi[i-1]
		ans = ans1 + ans2
			
		if -1 == ans_min:
			ans_min = ans
		if ans_min > ans:
			ans_min = ans
	
	print(ans_min)
		
if __name__ == "__main__":
	main()
	

Measured memory_bytes: 20508
#include <bits/stdc++.h>
#define all(x) begin(x), end(x)
#define dbg(x) cerr << #x << " = " << x << endl
#define _ << ' ' <<
using namespace std;
using ll = long long;
using vi = vector<int>;

int a[100000];

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, x;
    cin >> n >> x;
    ll sol = 0;
    for (int i = 0; i < n; ++i)
    {
        cin >> a[i];
        if (a[i] > x)
            sol += a[i] - x, a[i] = x;
    }
    for (int i = 1; i < n; ++i)
    {
        if (a[i] + a[i - 1] > x)
        {
            ll d = a[i] + a[i - 1] - x;
            sol += d;
            a[i] -= d;
        }
    }
    cout << sol;
}


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

using namespace std;

int main(){
	int n;
	cin >> n;
	vector<int> b;
	b.emplace_back(100000);
	for(int i=0;i<n-1;i++){
		int x;
		cin >> x;
		b.emplace_back(x);
	}
	b.emplace_back(100000);
	int ret = 0;
	for(int i=0;i<n;i++){
		ret += min(b[i],b[i+1]);
	}
	cout << ret << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
  int n,i,a,c,d;
  while(1){
    scanf("%d",&n);
    if(n<0)break;
    c=0;
    d=0;
  a=n%4;
  n=n-a; 
  if(n<4)printf("%d\n",a);
  else{
  for(i=262144;i>=4;i=i/4){
    if(n>=i){printf("%d",n/i);n=n%i;c++;d++;}
    else if(n%i==0){printf("0");n=n%i;c++;d++;}
    if(c!=0&&d==0)printf("0");
      d=0;
  }
  printf("%d\n",a);}
  }
  return 0;
}

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

int main() {
  int N;
  cin >> N;
  vector<string> s(N);
  for (int i = 0; i < N; ++i) {
    cin >> s[i];
  }
  int M;
  cin >> M;
  vector<string> t(M);
  for (int i = 0; i < M; ++i) {
    cin >> t[i];
  }
  int res = 0;
  for (int i = 0; i < N; ++i) {
    int tmp = 0;
    for (auto&& blue : s) {
      tmp += (s[i] == blue);
    }
    for (auto&& red : t) {
      tmp -= (s[i] == red);
    }
    if (res < tmp) {
      res = tmp;
    }
  }
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<(n);i++)
#define N 105
#define INF 1000000000
typedef long long ll;
#define ALL(v) (v).begin(),(v).end()
#define SZ(x) int(x.size())
#define IN(a) cin>>(a)
#define OUT(a) cout<<(a)<<endl
typedef pair<int,int> P;
const int MAX = 100005;
const int MOD = 1000000007;

int main(){
    int n,k;
    cin>>n>>k;
    vector<int>h(n);
    REP(i,n)IN(h[i]);
    sort(ALL(h));
    int ans=INF;
    REP(i,n-k+1){
        ans=min(ans,h[i+k-1]-h[i]);
    }
    OUT(ans);
    return 0;
}

Measured memory_bytes: 640
/*
CODED BY               
**************
DARSHAN JAIN
darshanjain31
**************
*/
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define mp make_pair
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL);
#define endl '\n'
#define MOD 1000000007
using namespace std;

int main()
{
	fast;
	ll t;
	cin>>t;
	double mid=(double)2*3.14159*t;
	cout << std::setprecision(5) <<mid<<endl;  
}


Measured memory_bytes: 3804
H,W=map(int,input().split())
cambas=[]
for i in range(H):
    cambas.append(input())

ans='Yes'
for i in range(1,H-1):
    for j in range(1,W-1):
        if cambas[i][j]=='#' and cambas[i][j+1]==cambas[i+1][j]==cambas[i-1][j]==cambas[i][j-1]=='.':
            ans='No'
            break
                
print(ans)
            

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define ll long long
#define pii pair<int, int>
#define pll pair<long long, long long>
#define ull unsigned long long
#define mp make_pair
#define F first
#define S second
#define mod 1000000007

ll h[int(2e5+5)], a[int(2e5+5)];
ll dp[int(2e5+5)];

int main()
{
    int n;
    scanf("%d" , &n );

    ll base = 1; 
    while(base <= n)
        base *= 2;
    
    vector<ll> stree(2*base);

    for(int i=0;i<n;i++)
        scanf("%lld", &h[i]);
    
    for(int i=0;i<n;i++)
        scanf("%lld", &a[i]);
    
    for(int flower = 0; flower<n; flower++)
    {
        ll x = h[flower] + base;
        ll best = 0;
        while(x > 1)
        {
            if(x%2)
            {
                best = max(best, stree[x-1]);
            }
            x /= 2;
        }
        dp[flower] = best + a[flower];

        for(int i = base + h[flower]; i >= 1; i/=2)
            stree[i] = max(stree[i], dp[flower]);

    }
    
    ll ans = 0;
    for(int i=0;i<=n;i++)
        ans = max(ans, dp[i]);

    printf("%lld\n", ans);

}


Measured memory_bytes: 9088
#include<set>
#include<map>
#include<queue>
#include<cmath>
#include<ctime>
#include<cstdio> 
#include<cstdlib>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
int n,m,ans; 
int a[105][105],b[105],book[105];
void dfs(int k)
{
	if(k==n+1)
	{
		for(int i=1;i<=m;++i)
		{
			int t=0;
			for(int j=1;j<=a[i][0];++j) 
				if(book[a[i][j]]==1) t++;
			if(t%2!=b[i]) return ;
		}
		ans++;
		return ;
	}
	book[k]=0;
	dfs(k+1);
	book[k]=1;
	dfs(k+1);
}
int main()
{
	scanf("%d%d",&n,&m);
	for(int i=1;i<=m;++i) 	
	{
		scanf("%d",&a[i][0]);
		for(int j=1;j<=a[i][0];++j) scanf("%d",&a[i][j]);
	}
	for(int i=1;i<=m;++i) scanf("%d",&b[i]);
	dfs(1);
	printf("%d",ans);
}

Measured memory_bytes: 256