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

#define deb(x) cout << #x << " " << x << endl;
#define fo(i,n) for(int i=0;i<n;i++)
#define Fo(i,k,n) for(int i=k;i<n;i++)
#define vi vector<int>
#define ii pair<int,int>
#define vii vector<ii>
#define ll long long
#define pb push_back
#define endl "\n"
#define mp map<int,int>
#define F first
#define S second
#define sz(v) (int)v.size()
#define mod 1000000007

void c_p_c()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
// #ifndef ONLINE_JUDGE
// 	freopen("input.txt", "r", stdin);
// 	freopen("output.txt", "w", stdout);
// #endif
}

int main(){
	c_p_c();

	int a,b; cin >> a >> b;

	for(int i=1;i<=1009;i++){
		if((int)((float)i*0.08)==a && (int)((float)i*0.1)==b){
			cout << i << endl;
			return 0;
		}

	}

	cout << -1 << endl;


	return 0;
}

Measured memory_bytes: 256
Module Program
  Sub Main
    Dim s=GetInts()
    Dim a=s(0),b=s(1)
    Dim ans=If(a*b Mod 2=0,"Even","Odd")
    Console.WriteLine(ans)
  End Sub
  
  '/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
  Function Gets() As String()
    Gets = Console.ReadLine().Split(" "c)
  End Function
  Function GetInts() As Integer()
    Dim s = Gets(), r(UBound(s)) As Integer
    For i As Integer=0 To UBound(s): r(i)=s(i): Next i
    GetInts = r
  End Function
End Module

Measured memory_bytes: 22352
#include<iostream>
using namespace std;
int main()
{
    int n,i,a,c=0,b;
    cin>>n;
    for(i=1;i<=9;i++)
    {
        a=n/i;
        b=n%i;
        if(a<=9 && b==0 )
        {
            c=c+1;
            cout<<"Yes";
            return 0;
        }
    }
    if(c==0)
    {
        cout<<"No";
    }
    return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;
 
public class Main {
	public static void main(String[] args) {
		FastReader sc = new FastReader();
		int n = sc.nextInt();
		int[] colors = new int[8];
		int upper3200 = 0;
		int currColors = 0;
		
		for (int i = 0; i < n; i++) {
			int rate = sc.nextInt();
			
			if ((rate >= 1) && (rate < 400)) {
				colors[0]++;
			} else if ((rate >= 400) && (rate < 800)) {
				colors[1]++;
			} else if ((rate >= 800) && (rate < 1200)) {
				colors[2]++;
			} else if ((rate >= 1200) && (rate < 1600)) {
				colors[3]++;
			} else if ((rate >= 1600) && (rate < 2000)) {
				colors[4]++;
			} else if ((rate >= 2000) && (rate < 2400)) {
				colors[5]++;
			} else if ((rate >= 2400) && (rate < 2800)) {
				colors[6]++;
			} else if ((rate >= 2800) && (rate < 3200)) {
				colors[7]++;
			} else {
				upper3200++;
			}
		}
		
		for (int i = 0; i < 8; i++) {
			if (colors[i] == 0) { currColors++; }
		}
		
		int resMin = Math.max(8 - currColors, 1);
		int resMax = 8 - currColors + upper3200;
		
		
		System.out.println(resMin + " " + resMax);
	}
  
    static class FastReader {
	    BufferedReader br;
	    StringTokenizer st;
	
	    public FastReader() {
	      br = new BufferedReader(new InputStreamReader(System.in));
	    }
	  
	    String next() { 
	      while (st == null || !st.hasMoreElements()) {
	        try {
	          st = new StringTokenizer(br.readLine());
	        } catch (IOException  e) {
	          e.printStackTrace();
	        }
	      }
	      return st.nextToken();
	    }
	
	    int nextInt() {
	      return Integer.parseInt(next());
	    }
	
	    long nextLong() {
	      return Long.parseLong(next());
	    }
	
	    double nextDouble() { 
	      return Double.parseDouble(next());
	    }
	
	    String nextLine() {
	      String str = "";
	        try{
	            str = br.readLine();
	        } catch (IOException e) {
	            e.printStackTrace();
	        }
	        return str;
	      }
	  }
}

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

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

	bool is_coffe = false;

	if (s[2] == s[3]) {
		if (s[4] == s[5]) {
			is_coffe = true;
		}
	}

	if (is_coffe) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	
	return 0;
}

Measured memory_bytes: 256
//#include <cstdio>
#include <iostream>

#include <cstring>

#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
//#include <queue>
//#include <stack>
#include <cassert>

using namespace std;

#define SZ(a) int((a).size())
#define REP(i,n) for(int i=0,_n=(n);i<_n;++i)
#define FOR(i,a,b) for(int i=(a),_b=(b);i<=_b;++i)

typedef long long llong;
typedef vector<int> VI;
typedef vector<VI> VVI;

int R, C;
char B[1004][1004];

const int MOD = 1e9 + 7;
int DP[1004][1004];

int main(int argc, char* argv[]) {
   ios_base::sync_with_stdio(false); 
   cin.tie(nullptr);

   cin >> R >> C;
   REP(r, R)
      cin >> B[r];

   DP[0][0] = 1;
   REP(r, R) REP(c, C) {
      if (B[r][c] == '#') continue;
      if (r > 0) {
         DP[r][c] += DP[r-1][c];
         if (DP[r][c] >= MOD)
            DP[r][c] -= MOD;
      }
      if (c > 0) {
         DP[r][c] += DP[r][c-1];
         if (DP[r][c] >= MOD)
            DP[r][c] -= MOD;
      }
   }

   cout << DP[R-1][C-1] << '\n';

   return 0;
}


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

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

int main() {
	int H, W;
	cin >> H >> W;

	string bar = "";
	for (int i = 0; i < W+2; ++i) {
		bar += '#';
	}

	vector<string> ans(H+2);
	for (int i = 0; i < H+2; ++i) {
		if (i == 0 || i == H + 1) {
			ans[i] = bar;
			continue;
		}

		string a;
		cin >> a;

		string tmp = '#' + a + '#';
		ans[i] = tmp;
	}

	for (int i = 0; i < ans.size(); ++i) {
		cout << ans[i] << endl;
	}
	return 0;
}


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

int main() {
    int n, c = 0;
    cin >> n;
    if(n<3)
    {
        cout << c << "\n";
        return 0;
    }
    ll a[n];
    for(int i = 0; i < n; i++)
    {
        cin >> a[i];
    }
    sort(a, a+n);
    for(int i = 0; i < n; i++)
    {
        for(int j = i+1; j < n; j++)
        {
            if(a[i] < a[j])
            {
                for(int k = j+1; k < n; k++)
                {
                    if(a[j] < a[k] && a[i] + a[j] > a[k])
                        c++;
                }
            }
        }
    }
    cout << c << "\n";
	return 0;
}

Measured memory_bytes: 3636
#include <iostream>
#include <vector>
#include <climits>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#include <string>
#include <bitset>
#include <utility>
#include <numeric>
#include <queue>
#include <stack>

using ll = long long;
using namespace std;

constexpr int MOD = 1e9 + 7;
constexpr ll MOD_LL = ll(1e9 + 7);

int main(void) {
	string s;
	cin >> s;
	
	int n = (int)s.size();
	ll ans = 0, cnt = 0;
	for(int i = 0; i < n; ++i) {
		if( s[i] == 'B' ) cnt++;
		else ans += cnt;
	}
	
	cout << ans << endl;

	return 0;
}


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

#include <iostream>
#include <fstream>

#include<bits/stdc++.h>
using namespace std;

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

template<class T> bool chmin(T& a,T b){
    if(a > b){ a = b; return true; }else return false;
}
template<class T> bool chmax(T& a,T b){
    if(a < b){ a = b; return true; }else return false;
}


class AMultiplication1 {
public:
	void solve(std::istream& cin, std::ostream& cout) {
        cin.tie(0);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(20);
        int64_t a,b;cin >> a >> b;
        cout << a*b << '\n';
	}
	void main2(istream& cin,ostream& cout){

	}
};


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


Measured memory_bytes: 3648
fun main(args: Array<String>) {
    val N = readLine()!!.toInt()
    val S = readLine()!!

    var res = 0
    for (k in 1 until N) {
        var p = 0
        for (i in 0 until (N - k)) {
            if (S[i] != S[k + i]) {
                p = i + 1
            } else {
                if (i >= k + p) {
                    p++
                }
                res = Math.max(res, i - p + 1)
            }
        }
    }

    println(res)
}


Measured memory_bytes: 33884
#include<bits/stdc++.h>
using namespace std;
#define REP(i,m,n) for(int i=(m);i<(n);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define mp make_pair
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define double long double
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll inf=1e9+7;
const ll mod=1e9+7;
int arr[1000010];
void Eratosthenes(int N){
	for(int i = 0; i < N; i++){
		arr[i] = 1;
	}
	for(int i = 2; i < sqrt(N); i++){
		if(arr[i]){
			for(int j = 0; i * (j + 2) < N; j++){
				arr[i *(j + 2)] = 0;
			}
		}
	}
}
ll gcd(ll a,ll b){
    if(max(a,b)%min(a,b)==0)return min(a,b);
    else return gcd(max(a,b)%min(a,b),min(a,b));
}
int main(){
    Eratosthenes(1000010);
    ll a,b;cin>>a>>b;
    ll k=gcd(a,b);
    ll cnt=0;
    REP(i,2,1000010){
        if(arr[i]){
            if(k%i==0)cnt++;
            while(k%i==0){
                k/=i;
            }
        }
    }
    if(k!=1)cnt++;
    cout<<cnt+1<<endl;
}

Measured memory_bytes: 4096
def calc(x,y):
    n = len(x)
    m = len(y)
    dp1 = [0]*(m+1)
    for i in range(n):
        s = x[i]
        dp2 = dp1[:]
        for j in range(m):
            if s == y[j]:
                dp1[j+1] = dp2[j]+1
            elif dp1[j+1] < dp1[j]:
                dp1[j+1] = dp1[j]
    return dp1[-1]

q = int(input().rstrip())
ans = []
for i in range(q):
    x = input()
    y = input()
    ans.append(calc(x,y))
print(*ans, sep="\n")


Measured memory_bytes: 5632
#include <cassert>

#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#define rep(i,j,k) for(int i=(int)j;i<(int)k;i++)
#define ll long long
//#define all(v) ((v).begin(),(v).end())
#define Sort(v) sort(all(v))
#define INF 1000000000
#define END return 0
#define pb push_back
#define se second
#define fi first
#define pb push_back
#define all(v) (v).begin() , (v).end()
#define MP make_pair
#define MOD 1000000007LL;
using namespace std;
int day[12]={31,28,31,30,31,30,31,31,30,31,30,31};

int main(){
    int n;
    cin>>n;
    n*=2;
    cout<<n/60<<" "<<n%60<<endl;


    return 0;
}



Measured memory_bytes: 3100
class Test{
	static void Main(string[] args) {
      int antenna1 = int.Parse(System.Console.ReadLine());
      int antenna2 = int.Parse(System.Console.ReadLine());
      int antenna3 = int.Parse(System.Console.ReadLine());
      int antenna4 = int.Parse(System.Console.ReadLine());
      int antenna5 = int.Parse(System.Console.ReadLine());
      int ableDist = int.Parse(System.Console.ReadLine());
      
      bool isTrans = true;
      if (antenna5 - antenna1 > ableDist) isTrans = false;
      if (antenna4 - antenna1 > ableDist) isTrans = false;
      if (antenna3 - antenna1 > ableDist) isTrans = false;
      if (antenna2 - antenna1 > ableDist) isTrans = false;
      
      if (isTrans) {
        System.Console.WriteLine("Yay!");
      } else {
        System.Console.WriteLine(":(");
      }
    }
}


Measured memory_bytes: 11092
#include <iostream>
#include <cstdio>
#include <cassert>
#include <cstring>
#include <vector>
#include <valarray>
#include <array>
#include <queue>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <cmath>
#include <complex>
#include <random>

using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
template<class T = ll> constexpr T TEN(int n) {return (n==0)?1:10*TEN<T>(n-1);}

const int MN = 52;
int main() {
    int n, a;
    cin >> n >> a;
    int x[n];
    for (int i = 0; i < n; i++) {
        cin >> x[i];
    }
    ll dp[MN][MN*MN] = {};
    dp[0][0] = 1;
    for (int i = 0; i < n; i++) {
        for (int j = n; j >= 0; j--) {
            for (int k = x[i]; k < MN*MN; k++) {
                dp[j][k] += dp[j-1][k-x[i]];
            }
        }
    }
    ll ans = 0;
    for (int j = 1; j <= n; j++) {
        ans += dp[j][a*j];
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1280
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner scan = new java.util.Scanner(System.in);
        int n = scan.nextInt();
        boolean b = false;
        if(n == 1 || (n % 2 == 0 && n <= 18) || (n % 3 == 0 && n <= 27) || (n % 4 == 0 && n <= 36) || (n % 5 == 0 && n <= 45) || (n % 6 == 0 && n <= 54) || (n % 7 == 0 && n <= 63) || (n % 8 == 0 && n <= 72) || (n % 9 == 0 && n <= 81)){
            b = true;
        }
        if(b){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
}

Measured memory_bytes: 23892
#include <iostream>

using namespace std;

int main()
{
	int n, x;
	
	while (1)
	{
		cin >> n >> x;
		if (n == 0 && x == 0)
			break;
		
		int s = 0;
		for (int i = 1; i <= n; i++)
			for (int j = 1; j <= n; j++)
				for (int k = 1; k <= n; k++)
					if (i + j + k == x && i != j && i != k && j != k && (i < j && j < k))
						s++;
		
		cout << s << endl;
	}


	return 0;
}

Measured memory_bytes: 1160
import numpy as np

line = input().rstrip().split()
N = int(line[0])
D = int(line[1])

count = 0
for i in range(N):
  line = input().rstrip().split()
  x = int(line[0])
  y = int(line[1])
  d = np.sqrt(x**2 + y**2)
  
  if d <= D:
    count += 1
    
print(count)

Measured memory_bytes: 27056
#include<bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define bg begin()
#define ed end()
#define all(x) x.bg,x.ed
#define pb push_back
#define eb emplace_back
using namespace std;
typedef long long ll;
template<class t,class u> void chmax(t&a,u b){if(a<b)a=b;}
template<class t,class u> void chmin(t&a,u b){if(b<a)a=b;}
template<class t> using vc=vector<t>;
template<class t> using vvc=vc<vc<t>>;
using pi=pair<int,int>;
using vi=vc<int>;
void yes(){ cout << "Yes" << endl; }
void no(){ cout << "No" << endl; }
int SIZE(string s){ return (int)s.size(); }

int main(){
    cout << fixed << setprecision(20);
    int s; cin >> s;
    int f,l; f = s/100; l = s%100;
    if(1 <= f && f <= 12){
        if(1 <= l && l <= 12){
            cout << "AMBIGUOUS" << endl;
        } else {
            cout << "MMYY" << endl;
        }
    } else if(1 <= l && l <= 12){
        cout << "YYMM" << endl;
    } else cout << "NA" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>

int main() {
    int k;
    std::cin >> k;
    int sum = 0;

    for(int i = 2; i <= k; i++) {
        for(int j = 1; j < i; j++) {
            if((i + j) % 2 == 1) {
                sum++;
            }
        }
    }

    std::cout << sum << std::endl;
}


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

#define REP(i, n) for (int i = 0; i < (int)(n); ++i)
#define FOR(i, a, b) for (int i = (a); i < (int)(b); ++i)
#define FOREQ(i, a, b) for (int i = (a); i <= (int)(b); ++i)

int dy[] = {-1, -1, -1, 0, 0, 1, 1, 1};
int dx[] = {-1, 0, 1, -1, 1, -1, 0, 1};
char colors[] = {'o', 'x'};
char field[10][10];

int put(int y, int x, int turn, bool dryrun) {
  int ret = 0;
  REP(dir, 8) {
    int yy = y + dy[dir], xx = x + dx[dir];
    while (field[yy][xx] == colors[!turn]) {
      yy += dy[dir]; xx += dx[dir];
    }
    if (field[yy][xx] == colors[turn]) {
      for (;;) {
        yy -= dy[dir]; xx -= dx[dir];
        if (!dryrun) { field[yy][xx] = colors[turn]; }
        if (yy == y && xx == x) { break; }
        ++ret;
      }
    }
  }
  return ret;
}

int main() {
  memset(field, '.', sizeof(field));
  FOREQ(y, 1, 8) FOREQ(x, 1, 8) {
    scanf(" %c", &field[y][x]);
  }

  for (int turn = 0, pass = 0; pass < 2; turn = !turn) {
    int max_count = 0, arg_max_y = -1, arg_max_x = -1;
    FOREQ(y, 1, 8) FOREQ(x, 1, 8) {
      if (field[y][x] != '.') { continue; }
      int count = put(y, x, turn, true);
      if (count > max_count || (count == max_count && turn == 1)) {
        max_count = count;
        arg_max_y = y;
        arg_max_x = x;
      }
    }
    if (max_count == 0) {
      ++pass;
    } else {
      pass = 0;
      put(arg_max_y, arg_max_x, turn, false);
    }
  }

  FOREQ(y, 1, 8) {
    FOREQ(x, 1, 8) {
      printf("%c", field[y][x]);
    }
    puts("");
  }
}

Measured memory_bytes: 0
#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 Would
#define you
#define please


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


	ll L, A, B, M;
	cin >> L >> A >> B >> M;

	ll D[18] = {};
	ll keta[19];
	rep(i, 19) keta[i] = pow(10, i);
	ll goukei = 0;
	rep(i, 18) {
		ll k1 = keta[i] - A - B - 1;
		if (k1 < 0) k1 = -1;
		else k1 /= B;
		ll k2 = keta[i + 1] - A - B - 1;
		if (k2 < 0) k2 = -1;
		else k2 /= B;
		ll k3 = k2 - k1;
		if (k3 + goukei > L - 1) k3 = L - 1 - goukei;
		D[i] = k3;
		goukei += k3;
		ce(D[i]);
	}

	ll Mat[18][3][3][60] = {};
	rep(i, 18) {
		ll kari = 1;
		rep(j, i + 1) kari = kari * 10 % M;
		Mat[i][0][0][0] = kari;
		Mat[i][0][1][0] = B % M;
		Mat[i][0][2][0] = A % M;
		Mat[i][1][0][0] = 0;
		Mat[i][1][1][0] = 1;
		Mat[i][1][2][0] = 1;
		Mat[i][2][0][0] = 0;
		Mat[i][2][1][0] = 0;
		Mat[i][2][2][0] = 1;
		rep(j, 59) {
			rep(x, 3) rep(y, 3) {
				rep(z, 3) Mat[i][x][y][j + 1] += Mat[i][x][z][j] * Mat[i][z][y][j] % M;
				Mat[i][x][y][j + 1] %= M;
			}
		}
	}

	ll V1 = A % M;
	ll V2 = 1;
	ll V3 = 1;
	rep(i, 18) {
		rep(j, 60) {
			if (D[i] >> j & 1) {
				ll V4, V5, V6;
				V4 = (Mat[i][0][0][j] * V1 + Mat[i][0][1][j] * V2 + Mat[i][0][2][j] * V3) % M;
				V5 = (Mat[i][1][0][j] * V1 + Mat[i][1][1][j] * V2 + Mat[i][1][2][j] * V3) % M;
				V6 = (Mat[i][2][0][j] * V1 + Mat[i][2][1][j] * V2 + Mat[i][2][2][j] * V3) % M;
				V1 = V4;
				V2 = V5;
				V3 = V6;
				ce(V1);
			}
		}
	}

	co(V1);

	Would you please return 0;
}

Measured memory_bytes: 384
s = input()
k = int(input())

if k == 1 or len(s) == 1:
    ans = list(s)[0]
else:
    ans = None
    for i, j in enumerate(list(s)):
        if i < k-1:
            if j != '1':
                ans = j
                break
        elif i == k-1:
            ans = j           
            break
        else:
            continue
print(ans)

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

int main() {
	int n;
	cin >> n;
	string ans = "No";
	
	while(n) {
		if(n % 10 == 7) ans = "Yes";
		n/=10; 
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
#define INF 2147483647
#define INFF 9223372036854775807
#define ll long long
#define REP(i,n) for(long long i=0;i<n;i++)
#define REPP(i,m,n) for(long long i=m;i<n;i++)
#define rep(i,n) for(long long i = n-1;i>=0;i--)
#define repp(i,m,n) for(long long i = n-1; i >= m; i--)
#define ALL(N) (N.begin(),N.end())
#define de cout << "line : " << __LINE__ << " debug" << endl;
#define pb push_back
#define pq priority_queue
#define Dcout(N) cout << setprecision(20) << N << endl
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main() {
    cin.tie(0);
	ios::sync_with_stdio(false);
    int H,W;
    cin >> H >> W;
    char a[H][W];
    int dp[H][W] ={};
    REP(i,H) REP(j,W){
        cin >> a[i][j];
        if(a[i][j] == '#') dp[i][j] = -1;
    }
    bool flag = 0;
    REP(i,H){
        if(a[i][0] == '#') flag = 1;
        if(!flag) dp[i][0] = 1;
        else dp[i][0] = 0;
    }
    flag = 0;
    REP(i,W){
        if(a[0][i] == '#') flag = 1;
        if(!flag) dp[0][i] = 1;
        else dp[0][i] = 0;
    }
    REPP(i,1,H){
        REPP(j,1,W){
            if(dp[i][j] == -1) continue;
            if(dp[i-1][j] > 0) dp[i][j] += dp[i-1][j];
            if(dp[i][j-1] > 0) dp[i][j] += dp[i][j-1];
            dp[i][j] %= 1000000007;
        }
    }
    cout << dp[H-1][W-1] << endl;
}

Measured memory_bytes: 5120
count = []

while True:
    sub_count = 0
    n,x = map(int,raw_input().split())
    if n == x == 0:
        break
    
    for i in range(n):
       for j in range(n):
           for k in range(n):
               if ((i + j + k + 3) == x) and ((i != j != k != i) == True):
                   sub_count += 1
    count.append((sub_count / 6))


for i in range(len(count)):
    print count[i]

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

int sum(int n){
    int sum = 0;
    while(n!=0){
        sum +=n%10;
        n/=10;
    }
    return sum;
}

int main(){
    // 制約見て！！！デカかったらlong longにすること！
    int n,a,b;
    cin>>n>>a>>b;
    int ans= 0;
    for(int i =1;i<=n;i++){
        int s = sum(i);
        if(s>= a && s<=b)ans+=i;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3564
#include<bits/stdc++.h>
#include<cmath>
#define pb push_back
#define ld long double
#define mp make_pair
#define vl vector<ll> 
#define vd vector<double>
#define vld vector<long double>
#define ll long long int
#define pl pair<ll, ll>
#define all(a) a.begin(), a.end()
#define forr(i, n) for(ll i=0; i<n; i++) 
#define forr1(i, n) for(ll i=1; i<=n; i++)
using namespace std;
const ld PI =3.1415926535897923846;
const ll MOD = 1e9+7;
void solve()
{
    ll n, k;
    cin>>n>>k;
    map<ll, ll> mp1;
    forr1(i, n)
    mp1[i]++;
    for(ll i=0; i<k; i++)
    {
        ll d;
        cin>>d;
        for(ll j=0; j<d; j++)
        {
            ll num;
            cin>>num;
            if(mp1.find(num)==mp1.end())
            continue;
            else
            mp1.erase(num);
        }
    }
    cout<<mp1.size();
}
int main()
{
    ll test=1;
    //cin>>test;
    while(test--)
        solve();
}

Measured memory_bytes: 3632
#include<iostream>
#include<map>
#include<string>
#include<cmath>
#include<cstdlib>
#include<vector>
using namespace std;

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

long int prime(long int n){
    long int a=2;
    while(n>=a*a){
        if(n%a==0){
            printf("%d * ",a);
            n/=a;
        }else{
            a++;
        }
    }
    printf("%d\n",n);
}

int num(int n){
    int res=1;
    while(n/=10)res++;
    return res;
}

void ans(long int n){
    long int t=sqrt(n);
    while(t){
        if(n%t==0){
            printf("%d\n",max(num(t),num(n/t)));
            return;
        }
        t--;
    }
}
            
int main(){
    long int n;
    cin>>n;
    //prime(n);    
    ans(n);
}

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

int main(){
  int s;
  cin >> s;
  int x = s / 100;
  int y = s % 100;
  
  if(1 <= x && x <= 12){
    if(1 <= y && y <= 12)cout << "AMBIGUOUS" << endl;
    else cout << "MMYY" << endl;
  }else {
    if(1 <= y && y <= 12)cout << "YYMM" << endl;
    else cout << "NA" << endl;
  }
}

   
   
  

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,m,n) for(int i=m;i<n;i++)
#define fix(n) cout<<fixed<<setprecision(n)
#define co(n) cout<<n<<endl
#define all(n) (n).begin(),(n).end()
using namespace std;
typedef long long ll;
const ll mod=1000000007;
double pi=3.1415926535;

int main(){
  int n,k;
  string s;
  cin>>n>>s>>k;
  char c;
  c=s[k-1];
  rep(i,0,n){
    if(s[i]==c) cout<<c;
    else cout<<'*';
  }
  cout<<endl;
  
  return 0;
}

Measured memory_bytes: 256
import math
n = int(input())
la = [int(i) for i in input().split()]
la.sort(reverse=True)
ans = 1

if la[-1] == 0:
    print(0)
    exit()

for a in la:
    if a > 1000000000000000000:
        print(-1)
        exit()
    ans *= a
    if ans > 1000000000000000000:
        print(-1)
        exit()
print(ans)

Measured memory_bytes: 84828
import sys
from sys import exit
from collections import deque
from bisect import bisect_left, bisect_right, insort_left, insort_right #func(リスト,値)
from heapq import heapify, heappop, heappush
from itertools import product, permutations, combinations, combinations_with_replacement
from functools import reduce
from math import sin, cos, tan, asin, acos, atan, degrees, radians

sys.setrecursionlimit(10**6)
INF = 10**20
eps = 1.0e-20
MOD = 10**9+7

def lcm(x,y):
    return x*y//gcd(x,y)
def lgcd(l):
    return reduce(gcd,l)
def llcm(l):
    return reduce(lcm,l)
def powmod(n,i,mod):
    return pow(n,mod-1+i,mod) if i<0 else pow(n,i,mod)
def div2(x):
    return x.bit_length()
def div10(x):
    return len(str(x))-(x==0)
def perm(n,mod=None):
    ans = 1
    for i in range(1,n+1):
        ans *= i
        if mod!=None:
            ans %= mod
    return ans
def intput():
    return int(input())
def mint():
    return map(int,input().split())
def lint():
    return list(map(int,input().split()))
def ilint():
    return int(input()), list(map(int,input().split()))
def judge(x, l=['Yes', 'No']):
    print(l[0] if x else l[1])
def lprint(l, sep='\n'):
    for x in l:
        print(x, end=sep)
def ston(c, c0='a'):
    return ord(c)-ord(c0)
def ntos(x, c0='a'):
    return chr(x+ord(c0))
class counter(dict):
    def __init__(self, *args):
        super().__init__(args)
    def add(self,x,d=1):
        self.setdefault(x,0)
        self[x] += d
class comb():
    def __init__(self, n, mod=None):
        self.l = [1]
        self.n = n
        self.mod = mod
    def get(self,k):
        l,n,mod = self.l, self.n, self.mod
        k = n-k if k>n//2 else k
        while len(l)<=k:
            i = len(l)
            l.append(l[i-1]*(n+1-i)//i if mod==None else (l[i-1]*(n+1-i)*powmod(i,-1,mod))%mod)
        return l[k]

N,M=mint()
A=lint()
C=counter()
for a in A:
    C.add(a)
for _ in range(M):
    b,c=mint()
    C.add(c,b)
L=[(k,C[k]) for k in C]
L.sort(reverse=True)
ans = 0
for l in L:
    k = min(N,l[1])
    ans += l[0]*k
    N -= k
    if N==0:
        break
print(ans)

Measured memory_bytes: 120616
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define INF 100000000000000009
typedef long long ll;
#define REP(i,n) for(int i=0;i<(n);++i)
#define OREP(i,n) for(int i=1;i<=(n);++i)
#define ZREP(i,n) for(int i=1;i<(n);++i)
#define YES(s) s?cout << "YES" << endl:cout << "NO" << endl
#define Yes(s) s?cout << "Yes" << endl:cout << "No" << endl
#define out(s,t,u) s?cout << t << endl:cout << u << endl
#define int ll
#define Endl endl
 
 
signed main(){
    int N,K;
    string S;
    cin >> N >> K;
    cin >> S;
    
    int l=0,r=0;
    int now=0;
    int Ans=0;
    
    int A[114514]={};
    if(S[0]=='0')A[0]=1;
    REP(i,N-1){
        if(S[i]=='1' && S[i+1]=='0'){
            A[i+1]=1;
        }
        if(S[i]=='0' && S[i+1]=='1'){
            A[i+1]=-1;
        }
        
    }
    
    //REP(i,N){cout << A[i] << " ";}cout << endl;
    
    if(A[0])now=1;
    
    while(l<=N-1){
        
        if(now<=K){
            Ans=max(Ans,r-l+1);
        }
        
        if(now<=K && r<N-1){
            r++;
            if(A[r]==1)now++;
        }else{
            l++;
            if(A[l]==-1)now--;
        }
        
        //cout << l << " " << r << " " << now << endl;
    }
    cout << Ans << endl;
    return 0;
}


Measured memory_bytes: 1408
#include <bits/stdc++.h>
#define PI 3.14159265358979323846
#define MAXINF (1e18L)
#define INF (1e9L)
#define EPS (1e-9)
#define MOD ((ll)(1e9+7))
#define REP(i, n) for(int i=0;i<int(n);++i)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define ALL(v) v.begin(),v.end()
#define FIND(v,x) (binary_search(ALL(v),(x)))
#define SORT(v) sort(ALL(v))
#define RSORT(v) sort(ALL(v));reverse(ALL(v))
#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl
#define Yes(n) cout<<((n)?"Yes":"No")<<endl
#define YES(n) cout<<((n)?"YES":"NO")<<endl
#define pb push_back
#define fi first
#define se second
using namespace std;
template<class A>void pr(A a){cout << (a) << endl;}
template<class A,class B>void pr(A a,B b){cout << a << " "  ;pr(b);}
template<class A,class B,class C>void pr(A a,B b,C c){cout << a << " " ;pr(b,c);}
template<class A,class B,class C,class D>void pr(A a,B b,C c,D d){cout << a << " " ;pr(b,c,d);}
template<class T> inline bool chmin(T& a, T b){return a>b ? a=b, true : false;}
template<class T> inline bool chmax(T& a, T b){return a<b ? a=b, true : false;}
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll,ll> pll;

int main(void)
{
    ll a,b,c;
    cin >> a >> b >> c;
    int n = 0;
    while(n <= 100000000){
        if((a&1) || (b&1) || (c&1)){
            pr(n);
            return 0;
        }
        ll ta = a;
        ll tb = b;
        ll tc = c;
        a = tb/2 + tc/2;
        b = ta/2 + tc/2;
        c = tb/2 + ta/2;

        n++;
    }
    pr(-1);
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
//#include <atcoder/all>
#define rep(i, n) for (int i=0; i < (n); i++)
using namespace std;
//using namespace atcoder;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int, int> P;
const int INF = 1 << 30;
const ll LINF = 1LL << 61;
const int NIL = -1;
const int MAX = 10000;
const int MOD = 1000000007;
const double pi = 3.141592653589;

int main() {
    string s;
    cin >> s;
    bool flag = true;
    rep(i, 3){
        if (s[i]==s[i+1])
            flag = false;
    }
    if (flag) cout << "Good" << endl;
    else cout << "Bad" << endl;
    return 0;
}

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


int descending_compare(const void *a, const void *b){
    if (*(int*)a > *(int*)b){
        return -1;
    }else if (*(int*)a == *(int*)b){
        return 0;
    }else{
        return 1;
    }
}

int ascending_compare(const void *a, const void *b){
    if (*(int*)a < *(int*)b){
        return -1;
    }else if (*(int*)a == *(int*)b){
        return 0;
    }else{
        return 1;
    }
}


int lower_bound(int *a, int n, int key){
    int left, mid, right;
    left = 0, right = n;
    mid = (left + right)/2;
    while ((left+1 != mid || mid+1 != right) && mid != left){
        if (key > a[mid]){
            left = mid;
        }else{
            right = mid+1;
        }
        mid = (left + right)/2;
    }
    if (a[left] >= key)return left;
    if (a[mid] >= key)return mid;
    if (a[right] >= key)return right;
    return n;
}

//greatest common divisor
unsigned long  gcd(unsigned long x, unsigned long y){
    if (y == 0){ 
        return x;
    }else if (x > y){
        return gcd(y, x % y);
    }else{
        return gcd(x, y % x);
    }
}



long long factorial(int x){
    long long rtn = 1;
    int i;
    for (i = x; i > 1; i--){
        rtn = (rtn*i);
    }
    return rtn;
}

int pic[100][100];
int tmp[100][100];
int n, m;

int check(int x, int y){
    int flag = 1;
    for (int i = 0; i < m; i++){
        for (int j = 0; j < m; j++){
            if (tmp[i][j] != pic[x+i][y+j]){
                flag = 0;
            }
        }
    }
    return flag;
}

int main(void){
    scanf("%d %d", &n, &m);
    for (int i = 0; i < n; i++){
        for (int j = 0; j < n; j++){
            scanf(" %c", &pic[i][j]);
        }
    }
    for (int i = 0; i < m; i++){
        for (int j = 0; j < m; j++){
            scanf(" %c", &tmp[i][j]);
        }
    }
    for (int i = 0; i < n; i++){
        for (int j = 0; j < n; j++){
            if (check(i, j)){
                printf("Yes\n");
                return 0;
            }
        }
    }
    printf("No\n");
    return 0;

    
}



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

int main() {
    int64_t H, W, K;
    cin >> H >> W >> K;
    vector<string> c(H);
    for (string& e : c) {
        cin >> e;
    }

    int64_t ans = 0;
    for (int64_t i = 0; i < (1 << H); i++) {
        for (int64_t j = 0; j < (1 << W); j++) {
            int64_t black_num = 0;
            for (int64_t k = 0; k < H; k++) {
                for (int64_t l = 0; l < W; l++) {
                    if (i & (1 << k) || j & (1 << l) || c[k][l] == '.') {
                        continue;
                    }
                    black_num++;
                }
            }

            if (black_num == K) {
                ans++;
            }
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 3628
<?php
fscanf(STDIN, '%d %d', $K, $S);

$count = 0;
for($i=0;$i<$K+1;$i++){
    for($j=0;$j<$K+1;$j++){
        $z=$S-$i-$j;
        if(0<=$z&&$z<=$K) $count++;
    }
}

echo $count;

Measured memory_bytes: 4604
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
#include<bits/stdc++.h>
#include<cstdio>
#include<algorithm>
#include<vector>
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


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


	int N, K;
	cin >> N >> K;
	
	const ll mod = 1e9 + 7;
	ll dp[2][100001];
	dp[0][0] = 1;
	dp[1][0] = 1;

	rep(i, N) {
		int a;
		cin >> a;

		auto mae = dp[i & 1];
		auto tugi = dp[!(i & 1)];
		rep1(j, a) {
			tugi[j] = (tugi[j - 1] + mae[j]) % mod;
		}
		auto are = mae - a - 1;
		for (int j = a + 1; j <= K; j++) {
			tugi[j] = (tugi[j - 1] + mae[j] - are[j]) % mod;
		}
	}

	co((dp[N & 1][K] + mod) % mod);

	Would you please return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <fstream>
#include<cstdio>
#include<iomanip>

#define REP(i, n) for(int i=0;i<n;i++)
#define REP_1(i, n) for(int i=1;i<n+1;i++)
using namespace std;
typedef long long ll;
typedef unsigned long ul;
typedef long double ld;


int main() {
    int L, R;
    cin >> L >> R;
    int r = L / 2019;
    L -= r * 2019;
    R -= r * 2019;
    if (R - L >= 2019) {
        R = L + 2019;
    }
    int min_mod = 2019;
    for (int i = L; i < R; i++) {
        for (int j = i + 1; j <= R; j++) {
            int mod = (i * j) % 2019;
            min_mod = min(min_mod, mod);
        }
    }
//    int ans = min_mod(L, R);

    cout << min_mod << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) REP(i,0,n)
#define REP(i,l,r) for(int i=l;i<r;++i)
#define int long long
#ifdef DEBUG
#define dout cout
#else
std::stringstream dout;
#endif
using namespace std;
typedef pair<int,int> P;
//other libs

signed main(int argc, char * argv[]) {
	int m,d;
	cin>>m>>d;
	int ans=0;
	REP(i,1,m+1){
		REP(j,1,d+1){
			int d1=j%10;
			int d2=j/10;
			if(d1>=2&&d2>=2&&d1*d2==i)ans++;
		}
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 256
def resolve():
    n, m = list(map(int, input().split()))
    a = list(map(int, input().split()))
    bc = list(list(map(int, input().split())) for _ in range(m))
    pairs = [(ai, 1) for ai in a]
    for b, c in bc:
        pairs.append((c, b))
    pairs.sort(key=lambda x: x[0], reverse=True)
    c = 0
    ans = 0
    for v, num in pairs:
        if c + num <= n:
            ans += v * num
            c += num
        else:
            ans += v * (n - c)
            break
    print(ans)


if __name__ == "__main__":
    resolve()


Measured memory_bytes: 50732
#include<iostream>
#include<vector>
#include<string>
#include<stdlib.h>
#include<algorithm>
#include<math.h>
#include<queue>
#include <forward_list>
#include <numeric>

#define mod 1000000007

using namespace std;


int main() {
	string S;

	cin >> S;

	for (int i = 0; i < 4; i++) {
		int count = 0;
		for (int j = 0; j < 4; j++) {
			if (S[i] == S[j])
				count++;
		}
		if (count == 2)
			;
		else
			break;

		if (i == 3) {
			cout << "Yes" << endl;
			return 0;
		}
	}

	cout << "No";

}




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;
typedef pair<int,int> P;
template<class T> inline bool chmax(T& a, T b) {
  if (a < b) { a = b; return 1; }
  return 0; }
template<class T> inline bool chmin(T& a, T b) {
  if (a > b) { a = b; return 1; }
  return 0; }

int main(void){
  int n; cin >> n;
  if(n%10 == 2 || n%10 == 4 || n%10 == 5 || n%10 == 7 || n%10 == 9){
    cout <<"hon" << endl;
  }
  else if(n%10 == 0 || n%10 == 1 || n%10 == 6 || n%10 == 8){
    cout << "pon" << endl;
  }
  else cout << "bon" << endl;
  return 0;
}


Measured memory_bytes: 3628
N = int(input())
A = list(map(int, input().split()))

ans = 0

for i in range(N-1):
    if A[i] < A[i+1]:
        pass
    else:
        ans = ans + (A[i] - A[i+1])
        A[i+1] = A[i+1] + (A[i] - A[i+1])

print(ans)


Measured memory_bytes: 32276
#include<stdio.h>
#include<stdlib.h>
#define H 500000
int A[H];

void maxHeapify (int i, int m){
  int l, r, larg, n;

  l = i*2;
  r = i*2+1;

  if(l <= m && A[l] > A[i])larg = l;
  else larg = i;

  if(r <= m && A[r] > A[larg]){
    larg = r;
  
  }
  
  if(larg != i){
    n = A[i]; 
    A[i] = A[larg];
    A[larg] = n;
    maxHeapify(larg, m);
    }
}


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

  for(i=1 ; i<=n ; i++){
    scanf("%d",&A[i]);
    //printf("%d",A[i]);
  }

 
  for(i = n/2 ; i>0 ;i--)maxHeapify(i,n);
 
  
  for(i=1 ; i<=n ; i++){

    printf(" %d",A[i]);
    
  }
  printf("\n");
  
  
  return 0;
}



Measured memory_bytes: 3648
#include <algorithm>
#include <cassert>
#include <cstdio>
#include <iostream>
#include <vector>
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define fi first
#define se second
using namespace std;
inline char nc()
{
	return getchar();
	static char buf[100000],*l=buf,*r=buf;
	return l==r&&(r=(l=buf)+fread(buf,1,100000,stdin),l==r)?EOF:*l++; 
}
template<class T> void read(T &x)
{
	x=0; int f=1,ch=nc();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=nc();}
	while(ch>='0'&&ch<='9'){x=x*10-'0'+ch;ch=nc();}
	x*=f;
}
typedef long long ll;
typedef pair<int,int> pii; 
const int maxn=2e5+50;
const int maxp=maxn*25;
int n,L;
vector<pii> num;
struct node
{
	int l,r,L,R;
	node(int l=0,int r=0,int L=0,int R=0):l(l),r(r),L(L),R(R){}
	inline bool operator <(const node &other) const
	{
		return l<other.l;
	}
};
vector<node> rec[2];
int main()
{
//	freopen("1.in","r",stdin);
//	freopen("1.out","w",stdout); 
	read(n), read(L);
	for(int i=1;i<=n;++i)
	{
		int x; read(x);
		num.push_back(make_pair(x,i));
	}
	sort(num.begin(),num.end());
	ll an=n;
	int cur=0,now=0,pt=0;
	while(true)
	{
		cur^=1; rec[cur^1].clear();
		if(rec[cur].size()==0)
		{
			if(pt<num.size()) now=num[pt].fi;
			else break;
		}
		else ++now;
		while(pt<num.size()&&num[pt].fi==now) rec[cur].push_back(node(num[pt].se,num[pt].se,1,1)),++pt;
		sort(rec[cur].begin(),rec[cur].end());
		for(int l=0,r;l<rec[cur].size();l=r+1)
		{
			static node tmp[maxn]; 
			r=l; while(r+1<rec[cur].size()&&rec[cur][r+1].l==rec[cur][r].r+1) ++r;
			if(r-l+1<L) continue;
			for(int j=r,sum=0;j>=l+L-1;--j) 
			{
				sum+=rec[cur][j].R;
				an+=(ll)rec[cur][j-L+1].L*sum;
			}
			int k=(r-l+1)/L; tmp[0].l=rec[cur][l].l-1;
			for(int j=1;j<=k;++j)
			{
				tmp[j].l=tmp[j].r=tmp[j-1].l+1;
				tmp[j].L=tmp[j].R=0;
			}
			tmp[k].r=rec[cur][r].r;
			for(int j=l;j<=r;++j)
			{
				int x=j-l+1,y=r-j+1;
				if(x>=L) tmp[x/L].R+=rec[cur][j].R;
				if(y>=L) tmp[k-y/L+1].L+=rec[cur][j].L;
			}
			for(int j=k,sum=0;j>=L;--j)
			{
				sum+=tmp[j].R;
				an-=(ll)tmp[j-L+1].L*sum;
			}
			for(int j=1;j<=k;++j) rec[cur^1].push_back(tmp[j]);
		}
	}
	printf("%lld\n",an);
	return 0;
}

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

int main()
{
    int n;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
    }

    double ans = 0;
    for (int i = 0; i < n; i++)
    {
        ans += 1.0 / a[i];
    }
    cout << 1.0 / ans << endl;
}


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

using namespace std;

#define LOG(...) fprintf(stderr,__VA_ARGS__)
//#define LOG(...)
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort(ALL(c))
#define RSORT(c) sort(RALL(c))

typedef long long ll;
typedef unsigned long long ull;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vb> vvb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

const char trump_chars[] = {'S', 'H', 'D', 'C'};

int main() {
    char trump;
    while (cin >> trump, trump != '#') {
        int tr = find(trump_chars, trump_chars+4, trump) - trump_chars;
        // num, (??????????????????2, ?????????????????????1, ??????0), trump, player
        vector<vector<tuple<int, int, int, int>>> cards(13, vector<tuple<int, int, int, int>>(4));
        vi score(4);
        REP(j, 4) {
            REP(i, 13) {
                char c, card;
                cin >> c >> card;
                int num = 0;
                switch (c) {
                case 'T':
                    num = 10;
                    break;
                case 'J':
                    num = 11;
                    break;
                case 'Q':
                    num = 12;
                    break;
                case 'K':
                    num = 13;
                    break;
                case 'A':
                    num = 14;
                    break;
                default:
                    num = c - '0';
                }
                int tt = find(trump_chars, trump_chars+4, card) - trump_chars;
                cards[i][j] = make_tuple(tt == tr ? 2 : 0, num, tt, j);
            }
        }

        int p = 0;
        REP(turn, 13) {
            int m = get<2>(cards[turn][p]);
            REP(i, 4) {
                if (get<2>(cards[turn][i]) == m) {
                    get<0>(cards[turn][i]) = 1;
                }
            }
            RSORT(cards[turn]);
//            LOG("%d %d %d %d\n", get<0>(cards[turn][0]), get<1>(cards[turn][0]), get<2>(cards[turn][0]), get<3>(cards[turn][0]));
            score[get<3>(cards[turn][0])]++;
            p = get<3>(cards[turn][0]);
        }
        if (score[0] + score[2] > score[1] + score[3]) {
            cout << "NS ";
            cout << (score[0] + score[2]) % 6 << endl;
        } else {
            cout << "EW ";
            cout << (score[1] + score[3]) % 6 << endl;
        }
    }
}

Measured memory_bytes: 3032
#include<bits/stdc++.h>
#include<iomanip>
using namespace std;
typedef long long ll;
typedef long  l;
typedef pair<int,int> P;
#define rep(i,n) for(int i=0;i<n;i++)
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
const int INF=1000000001;
const double PI=3.141592653589;


int main(){
  int n; cin>>n;
  set<int> s;
  rep(i,n){
    int d; cin>>d;
    s.insert(d);
  }
  cout<<s.size()<<endl;


  return 0;
}


Measured memory_bytes: 256
height, width = map(int, input().split())

matrix = []
for h in range(height):
    matrix.append(input())

for h in range(height):
    for w in range(width):
        
        able = False
        if matrix[h][w] == "#":
            try:
                if matrix[h+1][w] == "#":
                    able = True
            except:
                pass
            
            try:
                if matrix[h-1][w] == "#":
                    able = True
            except:
                pass
            
            try:
                if matrix[h][w+1] == "#":
                    able = True
            except:
                pass
            
            try:
                if matrix[h][w-1] == "#":
                    able = True
            except:
                pass
        
            if able is False:
                print("No")
                exit(0)

print("Yes")

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

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

int main() {
	long H, W;
	cin >> H >> W;
	if ((H - 1) * (W - 1) == 0) cout << 1 << endl;
	else if ((H % 2) * (W % 2) == 0) cout << H * W / 2 << endl;
	else cout << (H * W + 1) / 2 << endl;
}

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

using namespace std;
using ll = long long;
constexpr ll MOD = 1000000007;

ll modexp(ll b, ll e) {
	if (e == 0) return 1;
	else return (e & 1 ? b : 1) * modexp(b * b % MOD, e/2) % MOD;
}

int main() {
	int n, k; scanf("%d %d", &n, &k);
	vector<ll> seqPos(k + 1);
	for (int i = 1; i <= k; ++i) seqPos[i] = modexp(k/i, n);
	for (int i = k; i > 0; --i) {
		for (int j = 2 * i; j <= k; j += i) {
			seqPos[i] = (seqPos[i] - seqPos[j] + MOD) % MOD;
		}
	}
	ll ans = 0;
	for (int i = 1; i <= k; ++i) ans = (ans + seqPos[i] * i % MOD) % MOD;
	printf("%lld\n", ans);
	return 0;
}


Measured memory_bytes: 4072
#pragma region Macros
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i, n) for(int i=(n); i>=0; --i)
#define FOR(i, n, m) for(int i=(m), i##_len=(n); i<i##_len; ++i)
#define EACH(i, v) for(const auto& i : v)
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
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<class Value>using vec = vector< Value >;
using ll = long long;
using P = pair< long long, long long >;
#define fi first
#define se second
#define el endl
#pragma endregion

void Main();

int main(){
    std::cin.tie(nullptr);
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}

void Main(){
    int x1, x2, y1, y2;
    cin >> x1 >> y1 >> x2 >> y2;
    int m1 = x2-x1, m2 = y2-y1;
    cout << x2-m2 << " " << y2+m1 << " " << x1-m2 << " " << y1+m1 << el;
}



Measured memory_bytes: 256
N,K=map(int,input().split())
*A,=map(int,input().split())

def C(x):
  return sum([(A[i]+x-1)//x-1 for i in range(N)]) <= K
  
def binary_search2(func, n_min, n_max):
    left,right=n_min,n_max
    while right-left>1:
        middle = (left+right)//2
        y_middle = func(middle)
        if y_middle: right=middle
        else: left=middle

    return right
  
print(binary_search2(C, 0, max(A)+1))

Measured memory_bytes: 30640