akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>

int main(void) {
  int h, w;
  int i, j;
  int d = 1;

  while(1) {
    scanf("%d %d", &h, &w);
    if (h == 0 && w == 0)
      break;
    for (i = 0; i < h; i++) {
      for (j = 0; j < w; j++) {
	putchar('#');
      }
      printf("\n");
    }
    printf("\n");
  }

  return 0;
}


Measured memory_bytes: 1928
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <cstdio>
#include <string>
#include <cmath>
#include <queue>
#include <tuple>
//#include <bits/stdc++.h>
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repr(i, n) for (int i = (n) - 1; i >= 0; i--)
#define FOR(i,i0,n) for(int (i)=(i0);(i)<(n);(i)++)
#define FORR(i,i0,n) for(int (i)=(n)-1; (i)>=(i0);(i)--)
#define SORT(x) sort(x.begin(),x.end())
#define SORTR(x) sort(x.begin(),x.end(),greater<int>())
#define rn return
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#include <time.h>
typedef std::pair<int,int> P;
using namespace std;
using ll = long long;



int main(){
    int n,m;
    cin >> n >> m;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    int total = 0;
    rep(i,n) total+=a[i];
    double thr = 1.0/(4.0*m)*total;
    int c = 0;
    rep(i,n){
        if(a[i]>=thr) c++;
    }
    if(c >= m)cout << "Yes";
    else cout << "No";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(x) x.begin(), x.end()
using ll = long long;
using namespace std;

int main(){
  string s;
  cin >> s;
  vector<string> sv = {"Sunny", "Cloudy", "Rainy"};
  rep(i, 3){
    if(sv.at(i) == s){
      int nx = (i+1) % 3;
      cout << sv.at(nx) << endl;
      return 0;
    }
  }
  return 0;
}

Measured memory_bytes: 256
// finish date: 2018/01/11
#include <iostream>
#include <cmath>
#include <vector>
#include <bitset>
#include <algorithm>
#include <stack>
#include <map>
#include <climits>

using namespace std;

#define FOR(i, a, b) for(int i=a;i<b;i++)
#define rep(i, n)  FOR(i,0,n)
#define ll long long

bool isExist(char c, string str) {
    rep(i, str.length()) {
        if (c == str[i]) return true;
    }
    return false;
}

int fact(int n) {
    int ans = 1;
    FOR(i, 1, n + 1) {
        ans *= i;
    }
    return ans;
}

int main() {
    int x;
    cin >> x;
    if (x >= 1200) cout << "ARC" << endl;
    else cout << "ABC" << endl;

    return 0;
}

Measured memory_bytes: 256
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <queue>
#include <string>
#define REP(i,n) for(ll i = 0; i < (ll)n; i++)
using namespace std;
typedef long long ll;

int main(){
  ll n;
  cin >> n;
  vector<ll> vals;
  ll sum = 0;
  REP(i,n){
    ll s;
    cin >> s;
    if(s%10!=0) vals.push_back(s);
    sum += s;
  }
  ll ans;
  if(sum%10!=0) ans = sum;
  else if(vals.empty()) ans = 0;
  else{
    sort(vals.begin(),vals.end());
    ans = sum - vals[0];
  }
  cout << ans << endl;
  return 0;
}


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

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

typedef long long ll;
const ll MOD = 1e9 + 7;

std::set<ll> prime_factors(ll n) {
  std::set<ll> ret;

  ll tmp = n;
  for(ll i = 2; i * i <= n; ++i) {
    if(tmp % i == 0) {
      ret.insert(i);
    }
    while(tmp % i == 0) {
      tmp /= i;
    }
  }

  if(tmp > 1) ret.insert(tmp);
  return ret;
}

int main() {
  ll A, B;
  std::cin >> A >> B;

  auto ps1 = prime_factors(A);
  auto ps2 = prime_factors(B);

  ll cnt = 0;
  for(auto n : ps1) {
    if(ps2.find(n) != ps2.end()) ++cnt;
  }

  std::cout << cnt + 1 << '\n';
}


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

int main(){
  int n,m;
  cin >> n >> m;
  vector<int> height(n);
  vector<int> cond(n,1);
  rep(i,n) cin >> height.at(i);

  rep(i,m){
    int a,b;
    cin >> a >> b;
    if (height.at(a-1) >= height.at(b-1)) cond.at(b-1) = 0;
    if (height.at(b-1) >= height.at(a-1)) cond.at(a-1) = 0;
  }

  int answer = 0;
  rep(i,n) answer += cond.at(i);

  cout << answer << endl;

}


Measured memory_bytes: 4056
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>

int main(){
    char s[11];
    scanf("%s",s);
    char t[12];
    scanf("%s",t);
    
    int i,c=0;
    int l = strlen(s); 
    for(i=0;i<l;i++){
        if(s[i]==t[i]){
            c +=1;
        }
    }
    if(l==c){
        printf("Yes");
    }
    else{
        printf("No");
    }

    return 0;
}


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

int main(void) {
  vector<int> a(3);
  cin >> a[0] >> a[1] >> a[2];

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

  cout << a[2]-a[0] << endl;
  
  return 0;
}


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



int main()
{
    int A,B;
    string S,T,U;
    cin >> S >> T;
    cin >> A >> B;
    cin >> U;

    if(S==U){
            A = A-1;

    } else if(T==U){
       B = B-1;

    }
    cout << A << " " << B << endl;

    return 0;
}


Measured memory_bytes: 888
#include <bits/stdc++.h>
using namespace std;
// tala
const int N = 1e5 + 10;

int main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int n;
	cin >> n;
	for (int i = 1; i <= n; i++)
	{
		if(n % i == 0)
		{
			if(i < 10 && (n / i) < 10)
			{
				cout << "Yes\n";
				return 0;
			}
		}
	}
	cout << "No\n";
}

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

int main() {
  
  string s;
  cin >> s;
  
  bool ans = true;
  REP(i,s.size()) {
    REP(j,s.size()-i) {
      if (s[i] == s[i+j+1]) ans = false;
    }
  }
  
  cout << (ans ? "yes" : "no") << endl;
  
}

Measured memory_bytes: 3576
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

#define INF 1LL << 60
#define MOD 1000000007
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPP(i, b, e) for (int i = b; i <= e; i++)
#define PRINT(x) cout << x << endl

const int nMax = 200005;

int N;
string s;

int w[nMax];
int b[nMax];

int solve() {
    int n = s.size();
    w[0] = 0;
    b[0] = 0;
    for (int i = 0; i < n; i++) {
        if (s[i] == '#') {
            w[i + 1] = w[i];
            b[i + 1] = b[i] + 1;
        } else {
            w[i + 1] = w[i] + 1;
            b[i + 1] = b[i];
        }
    }
    char target = s[0];
    int m = nMax;
    for (int i = 0; i < n; i++) {
        if (i == 0 || i == n-1 || s[i] != target) {
            m = min(m, b[i] + (w[n] - w[i+1]));
            target = s[i];
        }
    }
    return m;
}

int main() {
    cin >> N >> s;
    cout << solve() << endl;
    return 0;
}

Measured memory_bytes: 2180
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define inf 1001001001001001001
#define mod 1000000007
#define mod2 998244353
#define pi acos(-1)
#define all(v) v.begin(),v.end()

int main(){
    int N,R;cin>>N>>R;
    if(N>=10){
        cout<<R<<endl;
        return 0;
    }else{
        cout<<R+(100*(10-N))<<endl;
        return 0;
    }
}

Measured memory_bytes: 3528
#include <iostream>
#include <stdio.h>
#include <vector>
#include <math.h>

using namespace std;
int n, m, k;
double ans;

void DFS(vector<int> v)
{
	if(v.size() == n)
	{
		int sum = 0;
		for(int i = 0; i < n; ++i)
		{
			sum += v[i];
		}
		ans += 1.0 * max(1, sum - k) / pow(1.0 * m, n);
		return;
	}
	for(int i = 1; i <= m; ++i)
	{
		v.push_back(i);
		DFS(v);
		v.pop_back();
	}
	return;
}

void solve()
{
	while(cin >> n >> m >> k, n || m || k)
	{
		ans = 0;
		vector<int> v;
		DFS(v);
		printf("%.8f\n", ans);
	}
}

int main()
{
	solve();
	return(0);
}

Measured memory_bytes: 1296
import java.util.*;
import java.io.PrintWriter;
public class Main{
	static long mod=998244353;
	static long[] fact;
	static long[] inv;
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		int m=sc.nextInt();
		int k=sc.nextInt();
		fact=new long[n+1];
		fact[0]=1;
		fact[1]=1;
		for(int i=2; i<=n; i++){
			fact[i]=(fact[i-1]*i)%mod;
		}
		inv=new long[n+1];
		inv[n]=pow1(fact[n],mod-2);
		for(int i=n-1; i>=0; i--){
			inv[i]=(inv[i+1]*(i+1))%mod;
		}
		long[] pow=new long[n+1];
		pow[1]=m;
		for(int i=2; i<=n; i++){
			pow[i]=(pow[i-1]*(m-1))%mod;
		}
		long ans=0;
		for(int i=0; i<=k; i++){
			ans+=(pow[n-i]*C(n-1,i))%mod;
			ans%=mod;
		}
		System.out.println(ans);
	}
	static long C(int t,int y){
		long re=1;
		re*=fact[t];
		re*=inv[y];
		re%=mod;
		re*=inv[t-y];
		return re%mod;
	}
	static long pow1(long p,long q){
		long res=1;
		while(q>0){
			if((q & 1)==1){
				res*=p;
				res%=mod;
			}
			q>>=1;
			p*=p;
			p%=mod;
		}
		return res;
	}
}


Measured memory_bytes: 40260
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

import numpy as np

MOD = 10 ** 9 + 7

N = int(readline())
m = map(int,read().split())
AB = zip(m,m)

D = 2000

def cumprod(arr,MOD):
    L = len(arr); Lsq = int(L**.5+1)
    arr = np.resize(arr,Lsq**2).reshape(Lsq,Lsq)
    for n in range(1,Lsq):
        arr[:,n] *= arr[:,n-1]; arr[:,n] %= MOD
    for n in range(1,Lsq):
        arr[n] *= arr[n-1,-1]; arr[n] %= MOD
    return arr.ravel()[:L]

def make_fact(U,MOD):
    x = np.arange(U,dtype=np.int64); x[0] = 1
    fact = cumprod(x,MOD)
    x = np.arange(U,0,-1,dtype=np.int64); x[0] = pow(int(fact[-1]),MOD-2,MOD)
    fact_inv = cumprod(x,MOD)[::-1]
    return fact,fact_inv

fact,fact_inv = make_fact(10 ** 4,MOD)
fact = fact.tolist()
fact_inv = fact_inv.tolist()

C_to_A = [[] for _ in range(D+D+1)]
remove = 0
for a,b in AB:
    c = a+b
    C_to_A[c].append(D-a)
    remove += fact[c+c] * fact_inv[a+a] * fact_inv[b+b]
remove %= MOD

dp = np.zeros(D+D+1,np.int64)
for A in C_to_A[::-1]:
    dp[:0:-1] += dp[-2::-1]
    np.add.at(dp,A,1)
    dp %= MOD

x = (dp * dp[::-1] % MOD).sum() % MOD
x -= remove
if x&1:
    x += MOD
x //= 2
x %= MOD

print(x)


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

const int INF = 2000000;
int m,n,a[110];

int check(int b){
  int cnt = 1, rem = b;

  for(int i=0;i<n;i++){
    if(b<a[i])return INF;
    if(rem<a[i]){
      cnt++; rem = b - a[i];
    }else{
      rem -= a[i];
    }
  }
  return cnt;
}

int main(){
  while(scanf("%d%d",&m,&n),m){
    for(int i=0;i<n;i++)scanf("%d",a+i);
    
    int l = 0, r = INF;
    while(r-l>1){
      int mid = (l+r)/2;
      if(check(mid)<=m)r = mid;
      else l = mid;
    }
    printf("%d\n",r);
  }
}

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

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

using namespace std;
//#inculude <bits/stdc++.h>
//#define int long long

signed main() {
    int n, q;
    cin >> n >> q;
    vector<queue<int>> que(n);
    int k, t, x;
    rep(i, q) {
        cin >> k >> t;
        if (k == 0) {
            cin >> x;
            que[t].push(x);
        }
        else if (k == 1) {
            if (!que[t].empty())
                cout << que[t].front() << endl;
        }
        else {
            if (!que[t].empty())
                que[t].pop();
        }
    }
}


Measured memory_bytes: 4316
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class Program
{
    static void Main(string[] args)
    {
        int n = Read.Int();

        for(int i = 0; i < n; i++)
        {
            int[] a = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int ans = a[0]*a[2]+a[1]*a[3];
            if (a[2] >= 5 && a[3] >= 2) { ans = ans * 4 / 5; }
            else if (a[2] < 5 && a[3] >= 2)
            {
                if (ans > (a[0] * 5 + a[1] * a[3]) * 4 / 5)
                {
                    ans = (a[0] * 5 + a[1] * a[3]) * 4 / 5;
                }
            }
            else if (a[2] >= 5 && a[3] < 2)
            {
                if (ans > (a[0] * a[2] + a[1] *2) * 4 / 5)
                {
                    ans = (a[0] * a[2] + a[1] * 2) * 4 / 5;
                }
            }
            else if (a[2] < 5 && a[3] < 2)
            {
                if (ans > (a[0] * 5 + a[1] * 2) * 4 / 5)
                {
                    ans = (a[0] * a[5] + a[1] * 2) * 4 / 5;
                }
            }
            Console.WriteLine(ans);






        }
    }

    public static long gcd(long a, long b)
    {
        while (true)
        {
            if (a == 0) { return b; }
            if (b == 0) { return a; }
            if (a > b) { a -= b; }
            else { b -= a; }
        }
    }
    public static long lcm(long a, long b)
    {
        return a / gcd(a, b) * b;
    }
    public static bool IsPrime(long n)
    {
        if (n < 2) return false;
        if (n == 2) return true;

        for (long i = 2; i < n; i++)
        {
            if (n % i == 0) return false;
        }
        return true;
    }

}
public static class Read
{
    public static void outl(string n = "") { Console.WriteLine(n); return; }
    public static long Long()
    {
        return long.Parse(Console.ReadLine());
    }
    public static long[] longs()
    {
        return Console.ReadLine().Split().Select(long.Parse).ToArray();
    }
    public static int Int()
    {
        return int.Parse(Console.ReadLine());
    }
    public static int[] ints()
    {
        return Console.ReadLine().Split().Select(int.Parse).ToArray();
    }
    public static string Str() { return Console.ReadLine(); }
    public static string[] Strs() { return Console.ReadLine().Split(); }
}

Measured memory_bytes: 9736
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Threading.Tasks;
using static System.Console;
using static System.Math;
class Z { static void Main() => new K(); }
class K
{
	int F => int.Parse(Str);
	long FL => long.Parse(Str);
	int[] G => Strs.Select(int.Parse).ToArray();
	long[] GL => Strs.Select(long.Parse).ToArray();
	string Str => ReadLine();
	string[] Strs => Str.Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
	const int MOD = 1000000007;
	public K()
	{
		SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
		Solve();
		Out.Flush();
	}
	void Solve()
	{
		var N = F;
		var c = new int[N - 1];
		var s = new int[N - 1];
		var f = new int[N - 1];
		for (var i = 0; i < N - 1; i++)
		{
			var I = G;
			c[i] = I[0];
			s[i] = I[1];
			f[i] = I[2];
		}
		for (var i = 0; i < N; i++)
		{
			var pos = i;
			var t = 0;
			while (pos < N - 1)
			{
				if (t < s[pos]) t = s[pos];
				else t = (t + f[pos] - 1) / f[pos] * f[pos];
				t += c[pos];
				pos++;
			}
			WriteLine(t);
		}
	}
}


Measured memory_bytes: 13268
#include <bits/stdc++.h>
using namespace std;
#define rep(i,ini,n) for(int i=ini;i<n;i++)
#define _rep(i,ini,n) for(int i=ini;i>=n;i--)
#define ToEnd(a) a.begin(),a.end()
uint64_t MOD=1000000007;

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

    bitset<26> b(0);
    for(auto _w:w) b.flip(_w-'a');

    if(b.count()) cout<<"No"<<endl;
    else cout<<"Yes"<<endl;
}

Measured memory_bytes: 256
#include <cmath>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <map>
#include <list>
#include <time.h>
#include <math.h>
#include <random>
#include <deque>
#include <queue>
#include <cassert>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <bitset>
#include <sstream>

using namespace std;

typedef long long ll;

mt19937 rnd(228);

int main()
{
#ifdef ONPC
    freopen("a.in", "r", stdin);
#endif
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n;
    cin >> n;
    vector <int> a(n);
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
    }
    map <ll, int> cnt;
    ll pref = 0;
    cnt[pref] = 1;
    ll ans = 0;
    for (int i = 0; i < n; i++)
    {
        pref += a[i];
        ans += cnt[pref];
        cnt[pref]++;
    }
    cout << ans << '\n';
}


Measured memory_bytes: 13568
module Main where
import Control.Monad
import Control.Applicative
import Data.Maybe
import Data.List
import qualified Text.Printf
import qualified Data.ByteString.Char8 as BC
import qualified Data.ByteString as BC

------------------------------------------

lucas x = f 2 1 x
  where
    f a b 0 = a
    f a b x = f b (a+b) (x-1)

main :: IO ()
main = do
  n <- readInt
  print $ lucas n

------------------------------------------

{- Int input -}

parseInt :: BC.ByteString -> Int
parseInt = fst . fromJust . BC.readInt

parseInts :: BC.ByteString -> [Int]
parseInts = map parseInt <$> BC.words

readInt :: IO Int
readInt = parseInt <$> BC.getLine

readInts :: IO [Int]
readInts = parseInts <$> BC.getLine

{- Double Formatting -}

doubleFmt :: Double -> String
doubleFmt = Text.Printf.printf "%.12f"


Measured memory_bytes: 508
#include <iostream>

using namespace std;

int main() {
    long long n, m;   cin >> n >> m;
    long long ans = 1;
    for (int i = 0; i < m; i++)
        ans *= 2;

    cout <<  ans * (100 * n + 1800 * m) << 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 rep2(i, x, n) for (int i = x; i < (n); i++)
#define all(n) begin(n), end(n)
struct cww
{
    cww()
    {
        ios::sync_with_stdio(false);
        cin.tie(0);
    }
} star;
const long long INF = numeric_limits<long long>::max();
typedef long long ll;
typedef vector<int> vint;
typedef vector<char> vchar;
typedef vector<vector<int>> vvint;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef unsigned long long ull;
template <class T>
bool chmax(T &a, const T &b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b)
{
    if (b < a)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }

template <typename T, typename... Ts>
auto make_v(size_t a, Ts... ts)
{
    return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}
template <typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T &t, const V &v) { t = v; }

template <typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T &t, const V &v)
{
    for (auto &e : t)
        fill_v(e, v);
}
ll A, B, N;
ll f(ll x)
{
    return (A * x) / B;
}
int main()
{

    cin >> A >> B >> N;
    ll ans = f(min(N, B - 1));

    cout << ans;
    return 0;
}

Measured memory_bytes: 3652
import java.io.PrintWriter;
import java.util.Scanner;

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

        new Solver().solve(in, out);

        in.close();
        out.flush();
    }

    private static class Solver {
        public void solve(Scanner in, PrintWriter out) {
            int months = in.nextInt();
            int days = in.nextInt();
            int counter = 0;
            for (int day = 20; day <= days; day++) {
                int lower = day % 10;
                int upper = day / 10;
                if (lower < 2) continue;
                int mul = lower * upper;
                for (int month = 1; month <= months; month++) {
                    if (month != mul) continue;
                    counter++;
                }
            }
            out.println(counter);
        }
    }
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
#define int long long
#define rep(i, a, n) for(int i = (int)(a);(i) < (int)(n);++(i))
#define repe(i, a, n) for(int i = (int)(a);(i) <= (int)(n);++(i))
#define repif(i, a, x) for(int i = (int)(a);(x);++(i))
#define repr(i, a, n) for(int i = ((int)(a)-1);(i) >= (int)(n);--(i))
#define reper(i, a, n) for(int i = (int)(a);(i) >= (int)(n);--(i))
#define SZ(x) ((int)(x).size())
#define ALL(x) begin(x), end(x)
#define RNG(x, a, n) &((x)[a]), &((x)[n])
#define ADD(a, b) (((a%MOD+MOD)%MOD+(b%MOD+MOD)%MOD)%MOD)
#define SUB(a, b) (((a%MOD+MOD)%MOD-(b%MOD+MOD)%MOD+MOD)%MOD)
#define MUL(a, b) ((((a%MOD+MOD)%MOD)*((b%MOD+MOD)%MOD))%MOD)
#define CHADD(a, b) (a = ADD(a, b))
#define CHMUL(a, b) (a = MUL(a, b))
#define CEIL(x) ((int)ceil(((double)x)))
#define POW(x, y) ((int)pow(x, y))
#define UNIQUE(x) (x).erase(unique(ALL((x))), (x).end())
#define gcd(x, y) __gcd(x, y)
#define lcm(x, y) (x/gcd(x,y)*y)
#define YES cout << "YES" << endl
#define NO cout << "NO" << endl
#define Yes cout << "Yes" << endl
#define No cout << "No" << endl
#define yes cout << "yes" << endl
#define no cout << "no" << endl
#define fcout cout << fixed << setprecision(10)
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define PI (acos(-1))
#define EPS (1e-10)
#define INF LLONG_MAX
#define MOD 1000000007LL
using namespace std;
using VI = vector<int>;
using PII = pair<int, int>;
using VPII = vector<PII>;
using Complex = complex<double>;
template<typename T, template<typename> typename C = less> using PQ = priority_queue<T, vector<T>, C<T>>;
template<typename T> bool chmax(T& a, const T& b){ if(a<b){ a=b; return true; } return false; }
template<typename T> bool chmin(T& a, const T& b){ if(a>b){ a=b; return true; } return false; }
template<typename I> int ACC(I f, I l, int i){ return accumulate(f, l, i); }
 

int N;
int A[100010];
int l[100010];


signed main(){
    cin >> N;
    rep(i, 0, N) cin >> A[i];

    fill(RNG(l, 0, N), -1);

    int ans = 1;
    rep(i, 0, N){
        int p = lb(RNG(l, 0, ans), A[i], [](int a, int b){ return a >= b; })-&l[0];
        l[p] = A[i];
        if(p == ans) ans++;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1792
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    a,b=INTM()
    if b%a==0:
        print(a+b)
    else:
        print(b-a)
if __name__ == '__main__':
    do()

Measured memory_bytes: 3064
#include"bits/stdc++.h"
using namespace std;
#define LL long long
#define PB push_back
#define MP make_pair
#define MOD (LL)(1e9+7)

int main(){
	LL S;
	cin >> S;
	//abs(x1y2-x2y1) == S
	//0 <= x,y <= 10^9
	LL tmp = ceil(sqrt(S));
	S = tmp*tmp-S;
	cout << tmp << " " << 1 << " " << S << " " << tmp << " ";
	cout << 0 << " " << 0 << endl;
}

Measured memory_bytes: 768
#include <bits/stdc++.h>
using namespace std;
int main () {
    long long T1, T2, A1, A2, B1, B2;
    cin >> T1 >> T2 >> A1 >> A2 >> B1 >> B2;
    long long a1 = A1*T1, a2 = A2*T2, b1 = B1*T1, b2 = B2*T2;
    if (a1+a2 == b1+b2) {
        puts("infinity");
        return 0;
    }
    if (a1 < b1) {
        swap(a1, b1);
        swap(a2, b2);
    }
    // a1 > b1
    if (a1+a2 > b1+b2) {
        puts("0");
        return 0;
    }
    // a1+a2 < b1+b2
    long long c = (b1+b2)-(a1+a2);
    long long ans = 1;
    ans += ((a1-b1) / c) * 2;
    if ((a1-b1) % c == 0) {
        ans--;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>

// namespace
using namespace std;

// using P = pair<int, int>;
typedef pair<int, int> P;
struct edge { int from, to, cost; };
int prim(int num_vertex, map<int, vector<edge> > &edges) {
    vector<bool> included(num_vertex, false);
    priority_queue<P, vector<P>, greater<P> > q;
    q.push(P{0, 0});
    int total_cost = 0;
    while(!q.empty()) {
        P p = q.top(); q.pop();
        int cost = p.first; int v = p.second;
        if (included[v]) continue;
        included[v] = true;
        total_cost += cost;
        // for (const auto &e: edges[v]) q.push(P{e.cost, e.to});
        for (int i = 0; i < edges[v].size(); ++i) {
            edge e = edges[v][i];
            q.push(P{e.cost, e.to});
        }
    }
    return total_cost;
}

int main() {
    int v, e, from, to, cost;
    map<int, vector<edge> > edges;
    cin >> v >> e;
    for (int i = 0; i < e; ++i) {
        cin >> from >> to >> cost;
        edges[from].push_back(edge{from, to, cost});
        edges[to].push_back(edge{to, from, cost});
    }
    int total_cost = prim(v, edges);
    cout << total_cost << endl;
    return 0;
}



Measured memory_bytes: 10196
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Console;
using static System.Math;

namespace AtTest.ABC_126
{
    class A
    {
        static void Main(string[] args)
        {
            Method(args);
        }

        static void Method(string[] args)
        {
            int[] nk = ReadInts();
            int n = nk[0];
            int k = nk[1];
            string s = Read();
            for(int i = 0; i < n; i++)
            {
                if (i == k - 1)
                {
                    switch (s[i])
                    {
                        case 'A':
                            Write('a');
                            break;
                        case 'B':
                            Write('b');
                            break;
                        case 'C':
                            Write('c');
                            break;
                    }
                }
                else Write(s[i]);
            }
            WriteLine();
        }

        private static string Read() { return ReadLine(); }
        private static char[] ReadChars() { return Array.ConvertAll(Read().Split(), a => a[0]); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
    }
}


Measured memory_bytes: 13140
import java.util.*; import java.io.*; import java.math.*;
public class Main{
	static void solve(){//Here is the main function
		boolean isA = false;
		boolean isB = false;
		ArrayList<String> s = nextCharArray();
		for(int i = 0; i < s.size(); i++){
			if(s.get(i).equals("A")){
				isA = true;
			}
			if(s.get(i).equals("B")){
				isB = true;
			}
		}
		if(isA && isB){
			myout("Yes");
		}else{
			myout("No");
		}
	}
	//Method addition frame start



	//Method addition frame end

	//Don't have to see. start------------------------------------------
	static class InputIterator{
		ArrayList<String> inputLine = new ArrayList<String>(1024);
		int index = 0; int max; String read;
		InputIterator(){
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			try{
				while((read = br.readLine()) != null){
					inputLine.add(read);
				}
			}catch(IOException e){}
			max = inputLine.size();
		}
		boolean hasNext(){return (index < max);}
		String next(){
			if(hasNext()){
				return inputLine.get(index++);
			}else{
				throw new IndexOutOfBoundsException("There is no more input");
			}
		}
	}
	static HashMap<Integer, String> CONVSTR = new HashMap<Integer, String>();
	static InputIterator ii = new InputIterator();//This class cannot be used in reactive problem.
	static PrintWriter out = new PrintWriter(System.out);
	static void flush(){out.flush();}
	static void myout(Object t){out.println(t);}
	static void myerr(Object t){System.err.print("debug:");System.err.println(t);}
	static String next(){return ii.next();}
	static boolean hasNext(){return ii.hasNext();}
	static int nextInt(){return Integer.parseInt(next());}
	static long nextLong(){return Long.parseLong(next());}
	static double nextDouble(){return Double.parseDouble(next());}
	static ArrayList<String> nextStrArray(){return myconv(next(), 8);}
	static ArrayList<String> nextCharArray(){return myconv(next(), 0);}
	static ArrayList<Integer> nextIntArray(){
		ArrayList<String> input = nextStrArray(); ArrayList<Integer> ret = new ArrayList<Integer>(input.size());
		for(int i = 0; i < input.size(); i++){
			ret.add(Integer.parseInt(input.get(i)));
		}
		return ret;
	}
	static ArrayList<Long> nextLongArray(){
		ArrayList<String> input = nextStrArray(); ArrayList<Long> ret = new ArrayList<Long>(input.size());
		for(int i = 0; i < input.size(); i++){
			ret.add(Long.parseLong(input.get(i)));
		}
		return ret;
	}
	@SuppressWarnings("unchecked")
	static String myconv(Object list, int no){//only join
		String joinString = CONVSTR.get(no);
		if(list instanceof String[]){
			return String.join(joinString, (String[])list);
		}else if(list instanceof ArrayList){
			return String.join(joinString, (ArrayList)list);
		}else{
			throw new ClassCastException("Don't join");
		}
	}
	static ArrayList<String> myconv(String str, int no){//only split
		String splitString = CONVSTR.get(no);
		return new ArrayList<String>(Arrays.asList(str.split(splitString)));
	}
	public static void main(String[] args){
		CONVSTR.put(8, " "); CONVSTR.put(9, "\n"); CONVSTR.put(0, "");
		solve();flush();
	}
	//Don't have to see. end------------------------------------------
}


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

#define tm tm228
#define hash hash228
#define matr vector < vector < int > >
#define int long long
#define pii pair < int, int >
#define tri pair < pair < int, int >, int >
#define all(v) v.begin(), v.end()
#define endl "\n"

using namespace std;

void solve(){
    int n;
    cin >> n;
    vector < int > a(n);
    map < int, int > mp;
    for (int i = 0; i < n; ++i)
    {
        cin >> a[i];
        mp[a[i]]++;
    }
    int sum = 0;
    for (auto j : mp)
    {
        sum += (j.second - 1) * j.second / 2;
    }
    for (auto i : a)
    {
        int ans = sum;
        ans -= mp[i] - 1;
        cout << ans << endl;
    }
}

signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int m = 1;
    //cin >> m;
    while (m--)
    {
        solve();
        cout << endl;
    }
    return 0;
}


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

int main(){
	int x1,y1,x2,y2;
	cin >> x1 >> y1 >> x2 >> y2;
	int x3,y3,x4,y4;
	x3 = x2 + (y1-y2);
	y3 = y2 + (x2-x1);
	x4 = x1 + (y1-y2);
	y4 = y1 + (x2-x1);
	cout << x3 << " " << y3 << " " << x4 << " " << y4 << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
long long int a[100002];
int main() {
	long long N;
	scanf("%lld", &N);
	long long int t;
	long long int ans = 1;
	for (long long int i = 2; i <= N; i++)
	{
		t = i;
		for (long long int j = 2; j <= i; j++)
		{
			while (t%j == 0) {
				a[j]++;
				t = t / j;
			}
		}
	}
	for (long long int i = 2; i <= N; i++)
	{
		if (a[i] != 0)
		{
			ans = ans * (a[i] + 1);
			ans = ans % 1000000007;
		}
	}
	printf("%lld\n", ans);
	return 0;
}

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

#define ll long long
#define N (ll)(4*1e6)
#define EPS (double)(1e-12)
#define M (ll)(1e9+7)

using namespace std;

const ll maxN = 2010;
 
ll pascal[maxN][maxN];

void monta() {
    pascal[0][0] = 1;
    pascal[1][0] = 1;
    pascal[1][1] = 1;

    for(ll i = 2; i < maxN; i++) {
        pascal[i][0] = 1;
        for(ll j = 1; j < maxN; j++) {
            pascal[i][j] = (pascal[i-1][j] + pascal[i-1][j-1])%M;
        }
    }
}

int main() {
    // 189 algorithm design manual
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    
    monta();
    
    ll n, k;

    cin >> n >> k;

    ll b = k;
    ll r = n - k;

    for(ll i = 1; i <= k; i++) {
        ll quantidades = (pascal[r+1][i]%M)*(pascal[b-1][i-1]%M)%M;
        cout << quantidades << endl;
    }
 

    return 0;
}

Measured memory_bytes: 31744
#include<bits/stdc++.h>
#include<math.h>
#include <stdio.h>
#include<vector>
#include <iostream>
//#include <algorithm>
#include <limits>
#include<string>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
typedef long long ll;
using namespace std;
#define llMAX numeric_limits<long long>::max()
#define intMAX numeric_limits<int>::max()
#define ll long long
ll XOR(ll a,ll b){
  ll result=0;
  while(1){
    if(a%2==b%2){
      result+=0;
    }else{
      result+=1;
    }
    a/=2;
    b/=2;
    if(a==0&&b==0){
      return result;;
    }
    result*=2;
  }
}
string printbinary(ll num){
  string result = "";
  while(num!=0){
    if(num%2==0){
      result =result + "0";
    }else{
      result =result + "1";
    }
    num/=2;
  }
  return result;
}
ll p(int n){
  return (ll)pow(2,n+1)-1;
}
ll x(int n){
  return (ll)pow(2,n+2)-3;
}
ll search(int n,ll num){//再帰
  if(n==0){
    return 1;
  }else if(num==1){
    return 0;
  }
  if(num==x(n)){
    return p(n);
  }
  if(num<=(x(n)-1)/2){//左側
    return search(n-1,num-1);//一番左のバンに注意
  }else if(num==(x(n)+1)/2){
    return (p(n)-1)/2 +1;
  }else{
    return ((p(n)+1)/2) + search(n-1,num-(x(n)+1)/2);
  }
}
int main(void){
	int N;
	cin >> N;
  ll X;
  cin >> X;
  //x_n = 2^(n+2) -3
  //p_n=2^(n+1) -1
  cout << search(N,X);
	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <map>
#include <queue>
#include <stack>
#include <string>
#include <utility>
#include <vector>

using namespace std;


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

    cout << T / A * B << endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define endl '\n'
using namespace std;
typedef long long ll;
const int N = 1e6 + 5;
const ll mod = 998244353;
const int DEG = 30;
const double pi = acos(-1.0);
const double eps = 1e-8;
const int inf = 0x3f3f3f3f;
static auto faster_iostream = []() {
    std::ios::sync_with_stdio(false);  // turn off sync
    std::cin.tie(nullptr);             // untie in/out streams
    return 0;
}();
struct node{
	int l, r;
}a[N];
int main(){
	int n, m;
	while(cin >> n >> m){
		ll ansl = 0, ansr = 1e18;
		for(int i = 1; i <= m; i++){
			cin >> a[i].l >> a[i].r;
			ansl = max(1LL * a[i].l, ansl);
			ansr = min(1LL * a[i].r, ansr);
		}
		if(ansl <= ansr){
			cout << ansr - ansl + 1 << endl;
		}
		else cout << 0 << endl;

	}
	return 0;
} 

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

class Program
{
    public static void Main()
    {
        var n = ReadLine().Split();
        var a = int.Parse(n[0]);
        var op = n[1][0];
        var b = int.Parse(n[2]);
        if(op == '+')
            WriteLine(a + b);
        else
            WriteLine(a - b);
    }
}


Measured memory_bytes: 17784
#include <bits/stdc++.h>
using namespace std;
#define REP(i, s, n) for (int i = s; i < n; ++i)
#define rep(i, n) REP(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define IINF INT_MAX
#define LLINF LLONG_MAX
#define DEBUG true
// sort(a.begin(), a.end(), std::greater<int>());

/*
std::vector<std::string> split(const std::string &input, char delimiter)
{
    std::istringstream stream(input);

    std::string field;
    std::vector<std::string> result;
    while (std::getline(stream, field, delimiter))
    {
        result.push_back(field);
    }
    return result;
}
*/
/*
int dfs(int foo, int timer)
{
    //foo is node number
    if (finds[foo].first != -1)
        return timer;
    finds[foo].first = ++timer;
    int result = timer;
    if (data[foo].size() != 0)
    {
        rep(i, data[foo].size())
        {
            result = dfs(data[foo][i], result);
        }
    }
    finds[foo].second = ++result;
    return result;
}
*/
int main()
{
    int k, s;
    long long int ans = 0;
    cin >> k >> s;
    k=k+1;
    rep(i, k)
    {
        rep(j, k)
        {
            int foo = i + j;
            if ( 0<=s-foo&&s - foo < k){
                //cout<<i<<j<<s-foo<<endl;
                ans++;
            }
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
Public Class Program
  Shared Sub Main()
    Dim s As String = Console.ReadLine()
    Dim ans As Integer = 0
    Select Case s
      Case "SUN": ans = 7
      Case "MON": ans = 6
      Case "TUE": ans = 5
      Case "WED": ans = 4
      Case "THU": ans = 3
      Case "FRI": ans = 2
      Case "SAT": ans = 1
    End Select
    Console.WriteLine(ans.ToString())
  End Sub
End Class

Measured memory_bytes: 20432
#include<stdio.h>
#include<stdlib.h>
#define N 20
#define P 200

int A[2001],n;

int are(int i ,int l){
  int re;
  if(l == 0)return 1;
  if(i >= n)return 0;
  re = are(i+1,l) || are(i+1,l-A[i]);
  return re;
}

 int main(){
  int i,q,l;

  scanf("%d",&n);
  for(i=0; i<n; i++){
    scanf("%d",&A[i]);
  }
  scanf("%d",&q);
  for(i=0; i<q; i++){
    scanf("%d",&l);
    if( are(0,l) )printf("yes\n");
    else printf("no\n");
  }
  return 0;
}



Measured memory_bytes: 2104
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
typedef long long ll;
using namespace std;


bool compare_by_a(pair<ll, ll> a, pair<ll, ll> b) {
    return a.first<b.first;
}

int main() {
    ll n, m, a, b;
    cin >> n >> m;
    vector<pair<ll, ll>> pa;
    for(ll i=0; i<n; i++) {
        cin >> a >> b;
        pa.push_back(make_pair(a, b));
    }
    sort(pa.begin(), pa.end(), compare_by_a);

    ll total=0, cost=0, i=0;
    while(total+pa[i].second<=m) {
        total += pa[i].second;
        cost += pa[i].first * pa[i].second;
        i++;
    }
    cost += (m-total) * pa[i].first;
    cout << cost << endl;
    return 0;
}


Measured memory_bytes: 2420
import heapq
N,M=map(int,input().split())
AB=[[]for i in range(10**5+1)]
for i in range(N):
    a,b=map(int,input().split())
    AB[a].append(-b)
q=[]
heapq.heapify(q)
ans=0
for i in range(1,M+1):
    for b in AB[i]:
        heapq.heappush(q,b)
    if len(q)>0:
        ans+=-heapq.heappop(q)
print(ans)

Measured memory_bytes: 22316
from collections import deque
N, M = map(int, input().split())

h = [[]*N for _ in range(N)]
AB = []

for _ in range(M):
    a, b = list(map(int, input().split()))
    a -= 1
    b -= 1
    h[a].append(b)
    h[b].append(a)
    AB.append([a, b])

ans = 0

for i in range(M):
    a, b = AB[i]
    h[a].remove(b)
    h[b].remove(a)
    
    fl = [False]*N

    q = deque([0])
    while q:
        t = q.popleft()
        if fl[t]:
            continue
        fl[t] = True
        for tt in h[t]:
            q.append(tt)
    
    if not all(fl):
        ans += 1

    h[a].append(b)
    h[b].append(a)

print(ans)

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

int main() {
	int M, N;
    cin >> M >> N;//都市、道路の数入力
    vector<int> vec (M);
    int n;
  	for (n = 0; n < N; n++) {//道路ごとのfor
    int a, b, i, j;
    cin >> a >> b; //ある道路nについてa,bを入力
    for (j = 0; j < M; j++) {
    if (a == j + 1)
    vec.at(j)++;
    if (b == j + 1)
      vec.at(j)++;
    }//それぞれの都市について加算処理
    }//加算処理終了

    int k;
    for (k = 0; k < M; k++)//出力処理
    cout << vec.at(k) << endl;
}

Measured memory_bytes: 256
#include<algorithm>
#include<bitset>
#include<cmath>
#include<complex>
#include<cstdlib>
#include<iomanip>
#include<iostream>
#include<map>
#include<queue>
#include<set>
#include<string>
#include<utility>
#include<vector>

using namespace std;

#define ll long long
#define pal pair<ll,ll>
#define pad pair<double,double>
#define PB push_back
#define MP make_pair
#define F first
#define S second

const ll MOD = 1e9+7;
const ll INF = 1e18;
const double EPS = 1e-8;

long long MODPOW(long long x, long long n) {
    long long ret = 1;
    while (n > 0) {
        if (n & 1) ret = ret * x % MOD;
        x = x * x % MOD;
        n >>= 1;
    }
    return ret;
}

template<typename T,typename U>
bool chmax(T& max, const U& x){
	if(max<x){
		max = x;
		return true;
	}
	return false;
}

template<typename T,typename U>
bool chmin(T& min, const U& x){
	if(min>x){
		min = x;
		return true;
	}
	return false;
}


int main(){
	ll l,r,d,ans=0;
    cin >> l >> r >> d;
    for(ll i=l;i<=r;i++){
        if(i%d==0) ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3572
#include <bits/stdc++.h>
using namespace std;
#define int long long
int MAX=1000000007;



signed main() {
    int n,l;
    cin>>n>>l;
    if(l>0)cout<<(n-1)*l+ n*(n-1)/2;
    else if(l+n-1<0){
        cout<<(n-1)*l +(n-1)*(n-2)/2;
    }else{
        cout<<n*l + n*(n-1)/2;
    }
   

      return 0;

}


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

int main() {
  using namespace std;
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  using namespace chrono_literals;
  chrono::high_resolution_clock clock;
  auto be = clock.now();
  int D;
  cin >> D;
  array<int, 26> c;
  for (auto& e : c) cin >> e;
  vector<array<int, 26>> d(D);
  for (auto& r : d)
    for (auto& e : r) cin >> e;
  auto eval = [&](vector<int> t) {
    int S = 0;
    array<int, 26> last = {};
    for (int i = 0; i < D; ++i) {
      S += d[i][t[i]];
      last[t[i]] = i + 1;
      for (int j = 0; j < 26; ++j) S -= c[j] * (i + 1 - last[j]);
    }
    return S;
  };
  mt19937 mt(random_device{}());
  uniform_int_distribution<int> dist_type(0, 25), dist_day(0, D - 1);
  uniform_real_distribution<> dist(0, 1);
  double eps = 0.1;
  vector<int> t(D);
  for (int i = 0; i < D; ++i) t[i] = i % 26;
  int S = eval(t);
  int cnt = 0;
  while (clock.now() - be < 1950ms) {
    bool f = dist(mt) < eps / (cnt / 100);
    int day1 = dist_day(mt);
    int day2 = dist_day(mt);
    int prv = 0;
    if (f) {
      prv = t[day1];
      t[day1] = dist_type(mt);
    } else
      swap(t[day1], t[day2]);
    int score = eval(t);
    if (score > S) {
      S = score;
      continue;
    }
    if (f)
      t[day1] = prv;
    else
      swap(t[day1], t[day2]);
  }
  for (const auto& e : t) cout << (e + 1) << '\n';
}


Measured memory_bytes: 3668
def cin():  return list(map(int,input().split()))

a, b, c = cin()
res1 = 4 * a * b
res2 = (c - a - b) ** 2
if c - a - b <= 0:  print("No")
else:
    if res1 < res2:  print("Yes")
    else:  print("No")

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

int main()
{
	int n;cin>>n;
	vector<vector<int> > p;
	for(int i=0;i<n;i++)
	{
		int x,y,z;
		vector<int> temp(3,0);
		cin>>x>>y>>z;
		temp[0]=x;temp[1]=y;temp[2]=z;
		p.push_back(temp);
	}
	vector<vector<int> > gain(n,vector<int> (3,0));
	for(int i=0;i<n;i++)
	{
		if(i==0)
		{
			gain[i][0]=p[i][0];
			gain[i][1]=p[i][1];
			gain[i][2]=p[i][2];
		}
		else
		{
			gain[i][0]=p[i][0]+max(gain[i-1][1],gain[i-1][2]);
			gain[i][1]=p[i][1]+max(gain[i-1][0],gain[i-1][2]);
			gain[i][2]=p[i][2]+max(gain[i-1][1],gain[i-1][0]);
		}
	}
	int ans=max(gain[n-1][0],max(gain[n-1][1],gain[n-1][2]));
	cout<<ans;
	return 0;
}

Measured memory_bytes: 11696
#include <iostream>
#include <vector>
using namespace std;
int main(){
  int n,k,d[10]={},tmp;
  vector <int> dl;
  cin>>n>>k;
  for(int i=0;i<k&&cin>>tmp;dl.push_back(tmp));
  for(;;n++){
    for(int a=n;a;a/=10) for(int i=0;i<dl.size();i++) if(dl[i]==a%10) goto end;
    cout<<n<<endl;
    return 0;
  end:;
  }
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std ;
int main(){
	const long long int INF=1e9+7;
	int n;
	cin>>n;
	int k;
	cin>>k;
	long long int h[n];
	for(int i=0;i<n;i++){
		cin>>h[i];
	}
	long long int dp[n];
	std::fill_n(dp,n,INF);
	dp[0]=0;
	for(int i=0;i<n;i++){
		for(int j=i+1;j<=i+k;j++){
			if(j<n){
				dp[j]=min(dp[j],abs(h[i]-h[j])+dp[i]);
			}
		}
	}
	cout<<dp[n-1]<<endl;
	return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <numeric>
#include <map>
#include <vector>
#include <string>
#include <vector>
#include <cassert>
#include <cmath>
#include <cctype>
#include <queue>
#include <algorithm>
#include <memory>
#include <memory.h>

using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<int, P> PP;
typedef pair<P,P> P2;
const int INF = 1 << 30;
const double EPS = 1E-9;

size_t cur;
string s;

void fc(){
	if(cur < s.size() - 1){
		char ch = s[cur];
		s[cur] = s[cur+1];
		s[cur+1] = ch;
		cur++;
	}
}

void fw(){
	if(cur < s.size() - 1){
		int j = cur+1;
		while(j < s.size() && s[j] == ' ') j++;
		if(j < s.size()){
			while(j < s.size() && s[j] != ' ') j++;
		}
		for(int i = cur; i < j-1; i++){
			s[i] = s[i+1];
		}
		s[j-1] = '^';
		cur = j-1;
	}
}

void bc(){
	if(cur > 0){
		char ch = s[cur];
		s[cur] = s[cur-1];
		s[cur-1] = ch;
		cur--;
	}
}

void bw(){
	if(cur != 0){
		int j = cur - 1;
		while(j >= 0 && s[j] == ' ') j--;
		while(j >= 0 && s[j] != ' ') j--;
		for(int i = cur; i > j + 1; i--){
			s[i] = s[i-1];
		}
		s[j+1] = '^';
		cur = j+1;
	}
}

void ins(string s2){
	s.insert(cur, s2);
	cur += s2.size();
}

void dc(){
	if(cur < s.size()-1){
		s.erase(cur+1,1);
	}
}

void dw(){
	if(cur < s.size()){
		int j = cur + 1;
		while(j < s.size() && s[j] == ' ') j++;
		if(j == s.size() ) return;
		while(j < s.size() && s[j] != ' ') j++;
		string a = s.substr(0, cur+1);
		string b = s.substr(j, s.size() - j);
		s = a + b;
	}
}

int main(){
	int n;
	cin >> n;
	getline(cin, s);
	for(int i = 0; i < n; i++){
		int m;
		string s2;
		getline(cin, s2);
		cin >> m;
		getline(cin, s);
		s = "^" + s2;
		cur = 0;
		for(int j = 0; j < m; j++){
			string a;
			getline(cin, a);
			if(a == "forward char"){
				fc();
			}else if(a == "forward word"){
				fw();
			}else if(a == "backward char"){
				bc();
			}else if(a == "backward word"){
				bw();
			}else if(a[0] == 'i'){
				string c(a.begin()+8, a.end()-1);
				ins(c);
			}else if(a == "delete char"){
				dc();
			}else{
				dw();
			}
		}
		cout << s << endl;
	}
	return 0;
}

Measured memory_bytes: 0
#pragma GCC optimize ("O2")
#pragma GCC target ("avx2")
#include<bits/stdc++.h>

using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

const ll AS = 10200;
ll dat[2 * AS];
ll query(int l, int r) {
	ll ret = -2e18;
	for (l += AS, r += AS; l < r; l >>= 1, r >>= 1) {
		if (l & 1) chmax(ret, dat[l++]);
		if (r & 1) chmax(ret, dat[--r]);
	}
	return ret;
}

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


	int N, K;
	cin >> N >> K;
	int P[5000], C[5000];
	rep(i, N) {
		cin >> P[i];
		P[i]--;
	}
	rep(i, N) {
		cin >> C[i];
	}

	ll kotae = -2e18;
	int yatta[5000] = {};
	rep(i, N) if (!yatta[i]) {
		int L = 0;
		auto kari = dat + AS;
		kari[0] = 0;
		int j = i;
		while (!yatta[j]) {
			yatta[j] = 1;
			kari[L + 1] = kari[L] + C[j];
			L++;
			j = P[j];
		}
		ll hue = kari[L];
		for (int j = L + 1; j <= L + L; j++) {
			kari[j] = kari[j - L] + hue;
		}
		for (int j = AS - 1; j > 0; j--) {
			dat[j] = max(dat[j << 1], dat[j << 1 | 1]);
		}
		ll amari = K % L;
		ll wari = K / L;

		if (hue > 0) {
			rep1(j, L) {
				ll hajimari = kari[j - 1];
				chmax(kotae, hue * wari + query(j, j + amari) - hajimari);
			}
			if (wari > 0) {
				rep1(j, L) {
					ll hajimari = kari[j - 1];
					chmax(kotae, hue * (wari - 1) + query(j + amari, j + L) - hajimari);
				}
			}
		}
		else {
			rep1(j, L) {
				ll hajimari = kari[j - 1];
				chmax(kotae, query(j, j + min(K, L)) - hajimari);
			}
		}
	}

	co(kotae);


	Would you please return 0;
}

Measured memory_bytes: 3828