akhauriyash/Code-Regression huggingface dataset:
import java.io.FileNotFoundException;
import java.util.Arrays;
import java.util.PriorityQueue;
import java.util.Scanner;
import java.util.concurrent.SynchronousQueue;

public class Main {
	public static void main(String[] args) throws FileNotFoundException {
		new Main().run();
	}

	int n, m;
	int[] l, r, x;
	long MODULO = 1_000_000_000 + 7;

	void run() throws FileNotFoundException {
		Scanner sc = new Scanner(System.in);
		n = sc.nextInt();
		m = sc.nextInt();
		l = new int[m];
		r = new int[m];
		x = new int[m];
		for (int i = 0; i < m; ++i) {
			l[i] = sc.nextInt();
			r[i] = sc.nextInt();
			x[i] = sc.nextInt();
		}

		int[][][] dp = new int[n + 1][n + 1][n + 1];
		dp[0][0][0] = 1;
		for (int i = 1; i <= n; ++i) {
			if (i != 1) {
				for (int a = 0; a < i - 1; ++a) {
					for (int b = 0; b < i - 1; ++b) {
						dp[i][a][b] = add(dp[i][a][b], dp[i - 1][a][b]);
						dp[i - 1][i][b] = add(dp[i - 1][i][b], dp[i - 1][a][b]);
						dp[i - 1][a][i] = add(dp[i - 1][a][i], dp[i - 1][a][b]);
						dp[i][i - 1][b] = add(dp[i][i - 1][b], dp[a][i - 1][b]);
						dp[a][i][b] = add(dp[a][i][b], dp[i - 1][a][b]);
						dp[a][i - 1][i] = add(dp[a][i - 1][i], dp[a][i - 1][b]);
						dp[i][b][i - 1] = add(dp[i][b][i - 1], dp[a][b][i - 1]);
						dp[a][i][i - 1] = add(dp[a][i][i - 1], dp[a][b][i - 1]);
						dp[a][b][i] = add(dp[a][b][i], dp[a][b][i - 1]);
					}
				}
			} else {
				dp[1][0][0] += dp[0][0][0];
				dp[0][1][0] += dp[0][0][0];
				dp[0][0][1] += dp[0][0][0];
			}
			for (int j = 0; j < m; ++j) {
				if (r[j] != i)
					continue;
				for (int a = 0; a < i; ++a) {
					for (int b = 0; b < i; ++b) {
						int cnt = 1;
						if (a >= l[j])
							++cnt;
						if (b >= l[j])
							++cnt;
						if (cnt != x[j]) {
							dp[i][a][b] = 0;
							dp[a][i][b] = 0;
							dp[a][b][i] = 0;
						}
					}
				}
			}
		}
		long ans = 0;
		for (int a = 0; a < n; ++a) {
			for (int b = 0; b < n; ++b) {
				ans += dp[n][a][b];
				ans += dp[a][n][b];
				ans += dp[a][b][n];
				while (ans >= MODULO)
					ans -= MODULO;
			}
		}
		System.out.println(ans);
	}

	int add(int a, int b) {
		int ret = a + b;
		while (ret >= MODULO) {
			ret -= MODULO;
		}
		return ret;
	}

	private static void tr(Object... o) {
		System.out.println(Arrays.deepToString(o));
	}
}


Measured memory_bytes: 170356
c=[list(map(int,input().split())) for i in range(3)]
a = [0]*3
b = [0]*3

a = [c[0][i] for i in range(3)]
b = [c[i][0]-a[0] for i in range(3)]

for i in range(3):
    for j in range(3):
        if a[j] + b[i] != c[i][j]:
            print("No")
            exit()

print("Yes")


Measured memory_bytes: 3064
import java.util.Scanner;

public class Main {

	@SuppressWarnings("resource")
	public static void main(String args[]) {
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		int a = scanner.nextInt();
		int b = scanner.nextInt();

		System.out.println(Math.min(n * a, b));

	}
}

Measured memory_bytes: 22612
#include <bits/stdc++.h>
using namespace std;
using pint = pair<int, int>;
using ll = long long;
using pll = pair<ll, ll>;
#define FOR(i, begin, end) for (int i = (begin), i##_end_ = (end); i < i##_end_; i++)
#define IFOR(i, begin, end) for (int i = (end)-1, i##_begin_ = (begin); i >= i##_begin_; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)
#define VREP(s, ite) for (auto ite = s.begin(); ite != s.end(); ++ite)
#define FI first
#define SE second
//#define endl "\n"
#define ciosup  \
    cin.tie(0); \
    ios::sync_with_stdio(false);
#define eb emplace_back
#define vint vector<int>
constexpr ll INF = 1e9 + 7;
constexpr ll MOD = 1e9 + 7;

int main()
{
    ciosup;
    int n,a,b;
    cin >> n >> a >> b;
    int ans;
    ans = min(n * a, b);
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
using namespace std;
 
signed main(){
	vector<int>a(45);
	a[0]=a[1]=1;
	for(int b=2;b<45;b++)a[b]=a[b-1]+a[b-2];
	int c;
	cin>>c;
	cout<<a[c]<<endl;
}

Measured memory_bytes: 3056
#define _CRT_SECURE_NO_WARNINGS
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for(int i=0; i<(n); ++i)
#define FOR(i, m, n) for(int i=(m); i<(n); ++i)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define mp make_pair
#define pb push_back
#define Cout(x) cout << (x) << endl
#define Cout2(x, y) cout << (x) << " " << (y) << endl
#define dump(x) cerr << #x << " = " << (x) << endl;
typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef vector<vector<int>> VVI;
typedef pair<int, int> PII;
const int inf = 1e9;
const double pi = acos(-1.0);

bool Check(string s, string t) {
	bool flag = true;
	rep(i, sz(s)) {
		if (s[i] != '?'&&s[i] != t[i])flag = false;
	}
	return flag;
}

string Chenge(string s, string t, int n) {
	rep(ti, sz(t)) {
		int si = ti + n;
		s[si] = t[ti];
	}
	for (auto &c : s) {
		if (c == '?')c = 'a';
	}
	return s;
}

int main() {
	string s, t; cin >> s >> t;
	int S = sz(s), T = sz(t);

	VS can;
	rep(i, S - T + 1) {
		if (Check(s.substr(i, T), t)) {
			can.pb(Chenge(s, t, i));
		}
	}
	if (can.empty())puts("UNRESTORABLE");
	else Cout(*min_element(all(can)));
}

Measured memory_bytes: 256
import math
import copy
N = int(input())
A = [0] * N
for i in range(N):
    A[i] = int(input())
#修正ver
max_item = max(A)
count = 0
second_item = 0
for i in range(N):
    if A[i] == max_item:
        count += 1
    elif second_item < A[i]:
        second_item = A[i]
    if count > 1:
        break
X = [0] * N
judge = False
for i in range(N):
    if count > 1:
        judge = True
        break
    if A[i] == max_item:
        X[i] = second_item
    else:
        X[i] = max_item

if judge:
    for i in range(N):
        X[i] = max_item
for i in range(N):
    print(X[i])

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

using namespace std;

const int N = 100010;



int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int n, m;
    cin >> n >> m;
    int l = 1, r = n;
    for (int i = 1; i <= m; i++) {
        int u, v;
        cin >> u >> v;
        l = max(l, u);
        r = min(r, v);
    }
    cout << max(0, r - l + 1) << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;
import java.util.Set;
import java.util.TreeSet;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		int n = s.length();
		if(n == 26) {
			for(int i = n - 1 ; i >= 1 ; i--) {
				if(s.charAt(i - 1) < s.charAt(i)){
					String fix = s.substring(0, i - 1);
					char[] change = s.substring(i - 1).toCharArray();
					Arrays.sort(change);
					for(int j = 0 ; j < change.length ; j++) {
						if(s.charAt(i - 1) < change[j]) {
							System.out.println(fix + change[j]);
							return;
						}
					}
				}
			}
			System.out.println(-1);
		} else {
			Set<Character> set = new TreeSet<>();
			for(char c = 'a' ; c <= 'z' ; c++) set.add(c);
			for(int i = 0 ; i < n ; i++) set.remove(s.charAt(i));
			for(char key : set) {
				System.out.println(s + key);
				return;
			}
		}
	}
}


Measured memory_bytes: 22100
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
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 (b<a) {a=b; return 1;} return 0;}


int main(){
    ll H;
    cin >> H;
    ll ans = 0;
    ll cnt = 1;
    while (H > 0) {
        H /= 2;
        ans += cnt;
        cnt *= 2;
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cmath>
#define ll long long
using namespace std;
ll n,l,t,x,w,ans[100005];
int main(){
    scanf("%lld%lld%lld",&n,&l,&t);
    ll p=1;
    for (int i=1; i<=n; i++)
	{
        scanf("%lld%lld",&x,&w);
        if (w==1)
		{
            ans[i]=(x+t)%l;
            p+=(x+t)/l;
        }
		else
		{
            ans[i]=(x-t)%l;
            p+=(x-t)/l;
            if(ans[i]<0)ans[i]+=l,p--;
        }
    }
    sort(ans+1,ans+n+1);
    p=(p%n+n)%n;
    if (p==0) p=n;
    for (int i=p; i<=n; i++)
        printf("%lld\n",ans[i]);
    for (int i=1; i<=p-1; i++)
        printf("%lld\n",ans[i]);
    return 0;
}

Measured memory_bytes: 4604
#include <iostream>
#include <vector>
#include <deque>
#include <math.h>
#include <set>
#include <iomanip>
#include <time.h>
#include <list>
#include <stdio.h>
#include <queue>
#include <map>
#include <algorithm>
#include <assert.h>
#include <memory.h>

#define mk make_pair
#define sc second
#define fr first
#define pb emplace_back
#define all(s) s.begin(), s.end()
#define sz(s) ( (int)s.size() )

using namespace std;

const int N = 1e5 + 5;

int n, ar[N], mp[N], ans;

main ()
{
    cin >> n;
    for (int i = 1; i <= n; i++)
    {
        scanf("%d", &ar[i]);
        ar[i]++;
        mp[ ar[i] ] ++;
        mp[ ar[i] - 1 ] ++;
        mp[ ar[i] + 1 ] ++;
    }

    for (int i = 0; i <= 1e5; i++) ans = max(ans, mp[i]);

    cout << ans << endl;
}


Measured memory_bytes: 1024
object Main {
  import java.util.Scanner

  def readStrings(n: Int)(implicit sc: Scanner): Array[String] = Array.fill(n) { sc.next() }
  def readInts(n: Int)(implicit sc: Scanner): Array[Int] = Array.fill(n) { sc.nextInt() }
  def readLongs(n: Int)(implicit sc: Scanner): Array[Long] = Array.fill(n) { sc.nextLong() }
  def readLineStrings(implicit sc: Scanner): Array[String] = sc.nextLine().split(' ')
  def readLineInts(implicit sc: Scanner): Array[Int] = readLineStrings.map(_.toInt)
  def readLineLongs(implicit sc: Scanner): Array[Long] = readLineStrings.map(_.toLong)

  def main(args: Array[String]): Unit = solve(new Scanner(System.in))

  def solve(implicit sc: Scanner): Unit = {
    val N = readInts(1)(sc)(0)
    val Ws = Array.fill(N)(readStrings(1)(sc)(0))
    if (Ws.zip(Ws.drop(1)).forall { case (s1, s2) => s1.last == s2.charAt(0) } && Ws.forall(w => Ws.count(_ == w) == 1)) {
      println("Yes")
    } else {
      println("No")
    }
  }
}


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

using namespace std;
using ll = long long;

ll powmod(ll a, ll x, ll m) {
  ll res = 1;
  while (x > 0) {
    if (x % 2 != 0) {
      res = (res * a) % m;
    }
    a = (a * a) % m;
    x /= 2;
  }
  return res;
}

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

  int n;
  string x;
  cin >> n >> x;

  int b = 0;
  for (int i = 0; i < n; i++) {
    if (x[i] == '1') {
      b++;
    }
  }

  ll p1 = 0;
  ll p2 = 0;
  for (int i = 0; i < n; i++) {
    if (x[i] == '1' && b != 1) {
      p1 += powmod(2, n - i - 1, b + 1);
      p2 += powmod(2, n - i - 1, b - 1);
    }
  }

  for (int i = 0; i < n; i++) {
    ll y;
    if (x[i] == '0') {
      y = p1 + powmod(2, n - i - 1, b + 1);
      y %= b + 1;
    } else {
      if (b == 1) {
        cout << 0 << endl;
        continue;
      }
      y = p2 - powmod(2, n - i - 1, b - 1);
      y %= b - 1;
      if (y < 0)
        y += b - 1;
    }
    int ans = 1;
    while (y > 0) {
      y %= __builtin_popcount(y);
      ans++;
    }
    cout << ans << endl;
  }

  return 0;
}


Measured memory_bytes: 3740
import std.stdio;
import std.string;
import std.conv;
import std.typecons;
import std.algorithm;
import std.functional;
import std.bigint;
import std.numeric;
import std.array;
import std.math;
import std.range;
import std.container;

void main() {
    int N, M;
    readf("%d", &N);
    int[] h = new int[N];
    int[] m = new int[N];
    foreach(i; 0..N) {
        readf(" %d %d", &h[i], &m[i]);
    }
    readf("\n%d", &M);
    int[] k = new int[M];
    int[] g = new int[M];
    foreach(i; 0..M) {
        readf(" %d %d", &k[i], &g[i]);
    }
    (zip(h, m).array~zip(k, g).array).sort!((a, b) => a[0]==b[0] ? a[1]<b[1] : a[0]<b[0]).uniq.map!(a => a[0].to!string~":"~("0"~a[1].to!string)[$-2..$]).join(" ").writeln;
}

Measured memory_bytes: 2588
#include<iostream>
#include<string>
#include<cstring>
#include<algorithm>
#include<vector>
#include<map>
#include<cmath>
#include<string>
#include<bitset>
#include <sstream>
#include<queue>
#include<set>
#define rep(i,n) for(ll i=0;i<(n);++i)
using namespace std;
typedef long long ll;
typedef pair<int,ll>P;

int main()
{
    int k,x;
    cin>>k>>x;
  
        rep(i,2*k-1)
        {
            cout<<x-k+1+i<<" ";
        }
   
    
}

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


def solve(a, begin, end, queue, cnt):
    #print(begin, end)
    if begin >= end:
        return
    maxx = sorted(list(map(abs, a[begin:end + 1])), reverse=True)[0]
    # print(maxx)
    if maxx in a[begin:end + 1]:
        m = a[begin:end + 1].index(maxx) + begin
    else:
        m = a[begin:end + 1].index(-1 * maxx) + begin
        maxx = -1 * maxx
    #print(m, maxx)
    if maxx == 0:
        return []
    if maxx > 0:
        solve(a, begin, m - 1, queue, cnt + 1)
        for i in range(max(0, m - 1), end):
            if a[i + 1] >= a[i]:
                continue
            else:
                a[i + 1] += a[i]
                queue.append((i, i + 1))
                if a[i + 1] < a[i]:
                    a[i + 1] += a[i]
                    queue.append((i, i + 1))
        return queue
    if maxx < 0:
        solve(a, m + 1, end, queue, cnt + 1)
        for i in reversed(range(begin, min(len(a) - 1, m + 1))):
            if a[i] <= a[i + 1]:
                continue
            else:
                a[i] += a[i + 1]
                queue.append((i + 1, i))
                if a[i] > a[i + 1]:
                    a[i] += a[i + 1]
                    queue.append((i + 1, i))
        return queue


if __name__ == '__main__':
    n = int(input())
    a = list(map(int, input().split()))
    queue = solve(a, 0, len(a) - 1, [], 0)
    print(len(queue))
    for i in range(len(queue)):
        print(queue[i][0] + 1, queue[i][1] + 1)


Measured memory_bytes: 3188
// Author: HarshKumar

#include <bits/stdc++.h>
using namespace std;
#define ll int64_t
const ll N = 1e6 + 6, M = 1e9 + 7;
int main()
{
    ios::sync_with_stdio(false), cin.tie(nullptr);
    ll k, s = 0;
    cin >> k;
    for (ll a = 1; a <= k; a++)
        for (ll b = a; b <= k; b++)
            for (ll c = b; c <= k; c++)
            {
                ll g = gcd(a, gcd(b, c));
                if (a != b && b != c)
                    g *= 6;
                else if (a != c)
                    g *= 3;
                s += g;
            }
    cout << s;
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int a,b;
	long long cnt=0;
	cin>>a>>b;
	if (a==1||b==1)
	{
		cout<<1;
		return 0;
	}
	for (int i=0;i<a;i++)
		if (i%2)
			cnt=cnt+b/2;
		else
			cnt=cnt+(b+1)/2;
	cout<<cnt;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repI(i, d, n) for (int i = (d); i < (n); ++i)
#define reps1(i, n) for (int i = 1; i < (n); ++i)
using namespace std;
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; }

using ll = long long;
using P = pair<int, int>;
using Pl = pair<ll, ll>;
using M = map<int, int>;
using Ml = map<ll, ll>;
ll const INF = 1ll<<61;
double pi = 3.141592653589793238;

int main() {
  string s;
  cin >> s;
  ll ans = 1000;

  rep(i, s.size()-2) {
    ll tmp = abs(753 - stoi(s.substr(i,3)));
    if (tmp < ans)
      ans = tmp;
  }

  cout << ans << endl;


  return 0;
}


Measured memory_bytes: 256
div = 0
mod = 0

h = int(input())
w = int(input())
n = int(input())

if h > w:
  div = n // h
  mod = n % h
else:
  div = n // w
  mod = n % w

if mod > 0:
  print(div+1)
else:
  print(div)

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

struct temp
{
  ll power, cost;
};
bool comp( temp a, temp b)
{
  return a.power < b.power;
}
int main()
{
  ll h,n;
  cin>>h>>n;
  vector<struct temp>s(n);
  for(ll i=0;i<n;i++) cin>>s[i].power>>s[i].cost;
  sort(s.begin(),s.end(),comp);
  vector< ll >dp(h+1,LONG_LONG_MAX);
  dp[0]=0;
  for(ll i=0;i<n;i++)
  {
    for(ll j=1;j<=h;j++)
    {
      if(j>=s[i].power)
      {
        dp[j] = min(dp[j-s[i].power] + s[i].cost, dp[j]);
      }
      else
        dp[j] = min(dp[j], s[i].cost);
      //cout<<dp[j]<<" ";
    }
    //cout<<"\n";
  }
  cout<<dp[h];
  return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define Mp make_pair
#define pb push_back

using ll = long long;
using db = double;
using pii = pair<int, int>;
using vi = vector<int>;
mt19937 mrand(time(0));
ll get(ll r) { return ((ll)mrand() * mrand() % r + r) % r; }
ll get(ll l, ll r) { return get(r - l + 1) + l; }

signed main() {
    string s; cin >> s;
    int ans = 0;
    for(int i = 0, j; i < s.size(); i = j + 1) {
        j = i; while(j + 1 < s.size() && s[j + 1] == s[i]) j++;
        if(s[i] == 'R') ans = max(ans, j - i + 1);
    }
    cout << ans << endl;
    fprintf(stderr, "time=%.4f\n", (db)clock()/CLOCKS_PER_SEC);
    return 0;
    /* 取模直接除，爆零两行泪
     * 不开ll见祖宗
     */
}

Measured memory_bytes: 3792
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
typedef long long ll;
#define rep(i,n) for (int i = 0; i < (n); i++)
#define repe(i,n) for (int i = 0; i <= (n); ++i)
#define repe1(i,n) for (int i = 0; i <= (n); ++i)
#define all(x) (x).begin(),(x).end()
#define pb(x) push_back(x)
#define eb(k,v) emplace_back(k,v)
#define ct(res) cout << res << "\n";
#define vi vector<int>
#define vl vector<ll>
using namespace std;
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; }
const int INF = 1e9;
const ll MOD = 1000000007;
using Graph = vector<vector<int>>;
ll gcd(ll a, ll b) {return (a%b) ? gcd(b, a%b) : b;}


int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll a,b,n; cin>>a>>b>>n;
    ll ans = 0;
    ll x = min(n,b-1);
    ans = floor(a*x/b)-a*(floor(x/b));
    ct(ans);

}


Measured memory_bytes: 3592
#include <cstring>
#include <sstream>
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <iomanip>
#include <map>
#include <unordered_map>
#include <cmath>
#include <queue>
#include <set>
#include <numeric>
#include <stack>

using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for(ll i = n - 1; i >= 0; i--)
#define repone(i, n) for(ll i = 1; i <= (ll)(n); i++)
#define each(i, mp) for(auto i:mp)
#define eb emplace_back
#define F first
#define S second
#define all(obj) (obj).begin(), (obj).end()
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const ll mod = 1000000007;
const ll inf = ll(1e9);
const ll half_inf = ll(1e5);
const ll ll_inf = ll(1e9) * ll(1e9);
typedef unordered_map<ll, ll> mpll;
typedef unordered_map<char, ll> mpcl;
typedef unordered_map<string, ll> mpsl;
typedef pair<ll, ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
template<typename T> using PQ = priority_queue<T>;
template<typename T> using minPQ = priority_queue<T, vector<T>, greater<T>>;

ll inl() {
    ll x;
    cin >> x;
    return (x);
}

string ins() {
    string x;
    cin >> x;
    return (x);
}

int main() {
#ifdef MY_DEBUG
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wmissing-noreturn"
    while (true) {
#pragma clang diagnostic pop
#endif
        string s = ins();
        rep(i, s.size() - 1) {
            if (s[i] == s[i + 1]) {
                printf("%lli %lli\n", i + 1, i + 2);
                return 0;
            }
            if (i != s.size() - 2 && s[i] == s[i + 2]) {
                printf("%lli %lli\n", i + 1, i + 3);
                return 0;
            }
        }
        printf("%i %i\n", -1, -1);

#ifdef MY_DEBUG
    }
#endif
    return 0;
}

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

using namespace std;

using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
constexpr ld EPS = 1e-12;
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr int MOD = 1e9 + 7;

template <typename T>
void printv(const vector<T> &v)
{
    int sz = v.size();
    for (int i = 0; i < sz; i++)
    {
        cout << v[i] << " \n"[i == sz - 1];
    }
}

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

    int n, q;
    cin >> n >> q;
    string s;
    cin >> s;
    s = "$" + s;
    s += "$";
    vector<int> sum(n + 1, 0);
    for (int i = 1; i < n; i++)
    {
        if (s.substr(i, 2) == "AC")
            sum[i + 1]++;
    }
    for (int i = 1; i <= n; i++)
        sum[i] += sum[i - 1];
    while (q--)
    {
        int l, r;
        cin >> l >> r;
        int ret = sum[r] - sum[l - 1];
        if (s.substr(l - 1, 2) == "AC")
            ret--;
        cout << ret << endl;
    }
}


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

typedef long long int ll;
typedef pair<int,int> pii;

int main(){
    int a,b,c,d;
    scanf("%d %d %d %d",&a,&b,&c,&d);
    int x = (a+d-1)/d;
    int y = (b+c-1)/b;
    if(x>=y) printf("Yes\n");
    else printf("No\n");
    return 0;
}


Measured memory_bytes: 3760
import numpy as np
n = int(input())

ansList = []
for i in range(1,n+1):
  cnt = 0
  for j in range(10):
    if i %2 ==0:
      i/=2
      cnt +=1
    else:
      ansList.append(cnt)
      break
print(np.argmax(ansList)+1)#ansListは０から始まる

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

int main() {
    ll n,k;
    cin >> n >> k;
    vector<ll> vec(n);
    rep(i,n) cin >> vec[i];
    ll ok=10000000000,ng=0;
    while(ok-ng>1){
        int cnt=0;
        int a=(ok+ng)/2;
        if(a<=0){
            cout << 1 << endl;
            return 0;
        }
        rep(i,n){
            int x=vec[i];
            cnt+=x/a;
            if(x%a==0) cnt--;
        }
        if(cnt<=k){
            ok=a;
        }
        else ng=a;
    }
    cout << ok << endl;
}

Measured memory_bytes: 4832
#include <bits/stdc++.h>
using namespace std;
using lint     = long long;
const lint inf = 1LL << 60;
const lint mod = 998244353;

struct mint {
    lint v;
    lint _mod;
    mint() : v(0) {}
    mint(signed v, lint _mod = mod) : v(v), _mod(_mod) {}
    mint(lint t, lint _mod = mod) : _mod(_mod) {
        v = t % _mod;
        if (v < 0)
            v += _mod;
    }

    mint pow(lint k) {
        mint res(1), tmp(v);
        while (k) {
            if (k & 1)
                res *= tmp;
            tmp *= tmp;
            k >>= 1;
        }
        return res;
    }
    static mint add_identity() { return mint(0); }
    static mint mul_identity() { return mint(1); }
    mint inv() { return pow(_mod - 2); }

    mint &operator+=(mint a) {
        v += a.v;
        if (v >= _mod)
            v -= _mod;
        return *this;
    }
    mint &operator-=(mint a) {
        v += _mod - a.v;
        if (v >= _mod)
            v -= _mod;
        return *this;
    }
    mint &operator*=(mint a) {
        v = v * a.v % _mod;
        return *this;
    }
    mint &operator/=(mint a) { return (*this) *= a.inv(); }

    mint operator+(mint a) const { return mint(v) += a; };
    mint operator-(mint a) const { return mint(v) -= a; };
    mint operator*(mint a) const { return mint(v) *= a; };
    mint operator/(mint a) const { return mint(v) /= a; };

    mint operator-() const { return v ? mint(_mod - v) : mint(v); }

    bool operator==(const mint a) const { return v == a.v; }
    bool operator!=(const mint a) const { return v != a.v; }
    bool operator<(const mint a) const { return v < a.v; }
};
ostream &operator<<(ostream &os, mint m) { return os << m.v; }

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    lint n, s;
    cin >> n >> s;
    vector<lint> a(n);
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }
    vector<vector<mint>> dp(n + 1, vector<mint>(3001, 0));
    dp[0][0] = 1;
    for (int i = 1; i <= n; ++i) {
        for (int j = 0; j <= 3000; ++j) {
            dp[i][j] += dp[i - 1][j] * 2;
            if (j - a[i - 1] >= 0)
                dp[i][j] += dp[i - 1][j - a[i - 1]];
        }
    }
    cout << dp[n][s] << "\n";
    return 0;
}

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

int main() {
  string S, T;
  cin >> S >> T;
  int N = S.size();
  int M = T.size();
  int ans = INT_MAX;
  for (int i = 0; i + M - 1 < N; i++) {
    int tmp = 0;
    for (int j = 0; j < M; j++) {
      if (S.at(i + j) != T.at(j)) tmp++;
    }
    ans = min(ans, tmp);
  }
  cout << ((ans == INT_MAX) ? M : ans) << "\n";
}

Measured memory_bytes: 3632
n = int(input())
a = list(map(int, input().split()))
q = int(input())
bc = [list(map(int,input().split())) for i in range(q)]
x = [0]*10**5
for i in a:
    x[i-1] += 1
ans = sum(a)
for i in range(q):
    b = bc[i][0]
    c = bc[i][1]
    x[c-1] += x[b-1]
    cnt = x[b-1]
    dif = c - b
    ans += dif * cnt
    x[b-1] = 0
    print(ans)

Measured memory_bytes: 32320
import numpy as np
#from numba import njit

#(N, K) = map(int, input().split())
#A = np.array(list(map(int, input().split())))
N = int(input())

#@njit
def solve(N,K,d):
    a = K*26
    if (N <= a):
        s = ""
        s = chr((N-1)%26+97) + s
        N = int((N-1)/26)
        while (N > 0):
            s = chr((N)%26+97) + s
            N = int((N)/26)
        return ("{:a>" +str(d)+"}").format(s)
    else:
        return solve(N-a,a,d+1)

print(solve(N,1,1))

Measured memory_bytes: 27168
N = int(input())
aa = [int(a) for a in input().rstrip().split()]

n_even = len(list(filter(lambda a: a % 2 == 0, aa)))
n_odd = len(list(filter(lambda a: a % 2 == 1, aa)))

x = n_odd // 2
n_odd -= x*2
n_even += x

if n_even > 1:
    n_even = 1

if n_even == 0 or n_odd == 0:
    print('YES')
else:
    print('NO')


Measured memory_bytes: 14112
#![allow(unused_imports)]
#![allow(dead_code)]

use proconio::input;
use std::collections::*;

fn main() {
    input! {
        x:i32,
        y:i32,
    }
    let det = (0..=x)
        .map(|crane| {
            let turtle = x - crane;
            crane * 2 + turtle * 4
        })
        .find(|&num| num == y);
    let ans = match det {
        Some(_) => "Yes",
        None => "No",
    };
    println!("{}", ans);
}

Measured memory_bytes: 2128
import numpy as np
from collections import Counter, defaultdict

N = int(input())
A = list(map(int, input().split()))

C = Counter(A)
Normal = defaultdict(int)
Banned = defaultdict(int)

for i in A:
    Normal[i] = C[i] * (C[i]-1) // 2
    Banned[i] = (C[i]-1) * (C[i]-2) // 2
    
Normal_sum = sum(Normal.values())
for i in A:
    print(Normal_sum - (Normal[i] - Banned[i]))

Measured memory_bytes: 47184
class Point
  attr_accessor :x, :y
  def initialize(i = 0, j = 0)
    @y = i
    @x = j
  end
  def ==(p)
    @y == p.y && @x == p.x
  end
  def +(add)
    Point.new(@y + add.y, @x + add.x)
  end
  def -(sub)
    Point.new(@y - sub.y, @x - sub.x)
  end
  def distance(p)
    (@y - p.y)**2 + (@x - p.x)**2
  end
end

def check(tile, p1, p2)
  add = Point.new
  add.y = ((p1.y < p2.y) ? 1 : -1) if p1.x == p2.x
  add.x = ((p1.x < p2.x) ? 1 : -1) if p1.y == p2.y
  now = p1.dup + add
  return false if now == p2
  while now != p2 do
    return false if tile[now.y][now.x] != "."
    now += add
  end
  return true
end

def delete!(tile, p1, p2)
  if p1.x == p2.x || p1.y == p2.y
    if check(tile, p1, p2)
      tile[p1.y][p1.x] = tile[p2.y][p2.x] = "."
      return true
    end
    return false
  end

  2.times do
    p1, p2 = p2, p1
    q = Point.new(p1.y, p2.x)
    next if tile[q.y][q.x] != "."
    next if q.distance(p1) != 1 && !check(tile, q, p1)
    next if q.distance(p2) != 1 && !check(tile, q, p2)
    tile[p1.y][p1.x] = tile[p2.y][p2.x] = "."
    return true
  end
  return false
end

H, W = gets.split.map(&:to_i)
tile = Array.new
H.times do
  tile.push(gets.chop.chars)
end

point = Hash.new {|h, k| h[k] = Array.new}
for i in 0...H do
  for j in 0...W do
    next if tile[i][j] == "."
    point[tile[i][j]].push(Point.new(i,j))
  end
end

answer = 0
26.times do
  point.each do |key, p|
    if delete!(tile, p[0], p[1])
      answer += 2
      point.delete(key)
    end
  end
end
p answer

Measured memory_bytes: 32476
#include <stdio.h>

main()
{
int x[3];
int i,j,temp;

scanf("%d %d %d",&x[0], &x[1], &x[2]);

for(i=0;i<3;i++)
 {
 for(j=2;j>i;j--)
  {
   if(x[j-1]>x[j])
    {
     temp=x[j-1];x[j-1]=x[j];x[j]=temp;
    }
  }
 }

printf("%d %d %d\n",x[0],x[1],x[2]);
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define ll long long int
#define ull unsigned long long int
#define ld long double
#define f first
#define s second
#define pb push_back
#define eb emplace_back
#define mk make_pair
#define mt make_tuple
#define MOD 1000000007
#define fo(i,a,b) for(i=a;i<b;i++)
#define foe(i,a,b) for(i=a;i<=b;i++)
#define all(x) x.begin(), x.end()
#define vi vector<int>
#define vl vector <long long int>
#define pii pair <int,int>
#define pll pair <long long int, long long int>
#define vpii vector< pair<int,int> >
#define vpll vector <long long int, long long int> 
#define boost ios::sync_with_stdio(false); cin.tie(0)
using namespace std;

ll add(ll x, ll y) {ll res=x+y; return(res>=MOD?res-MOD:res);}
ll mul(ll x, ll y) {ll res=x*y; return(res>=MOD?res%MOD:res);}
ll sub(ll x, ll y) {ll res=x-y; return(res<0?res+MOD:res);}
ll lcm(ll x, ll y) {ll res=(x*y)/__gcd(x,y); return res;}
ll power(ll x, ll y) {ll res=1; x%=MOD; while(y){if(y&1)res=mul(res,x); y>>=1; x=mul(x,x);} return res;}
const int inf = 1e9 + 5;
const ll inf64 = 1e18 + 5;

int main()
{
	boost;
	ll n, i, j, x, l;
	cin >> n;
	if(n == 0){
		cout << 0;
		return 0;
	}
	vector <pair <ll, ll> > v;
	fo(i, 0, n){
		cin >> x >> l;
		v.pb({x + l, x - l});
	}
	sort(all(v));
	ll ans = 1, curr = v[0].f;
	fo(i, 1, v.size()){
		if(curr <= v[i].s){
			ans++;
			curr = v[i].f;
		}
	}
	cout << ans;
}


Measured memory_bytes: 2420
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1e18;
const ll mod = 1000000007;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
  double a, b, h, m;
  cin >> a >> b >> h >> m;
  h = (h/12.0)*2.0 + (m/60.0)*(2.0/12.0);
  m = (m/60.0)*2.0;
  double res = a*a + b*b - 2.0*a*b*cos(abs(h-m)*M_PI);
  cout << fixed << setprecision(16);
  cout << pow(res, 0.5) << endl;
}

Measured memory_bytes: 4356
let readString() = stdin.ReadLine()
let readStringN() = stdin.ReadLine().Split(' ');
let readInt() = readString() |> int
let readIntArray() = readStringN() |> Array.map (fun x -> int x)

let a, b = readStringN() |> fun x -> (x.[0], x.[1])

match a, b with 
| x, y when x = "H" && y = "H" -> "H"
| x, y when x = "H" && y = "D" -> "D"
| x, y when x = "D" && y = "H" -> "D"
| x, y when x = "D" && y = "D" -> "H"
| _ -> ""
|> printfn "%s"

Measured memory_bytes: 11868
import sys
import itertools
import math

# import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

alphabet = [chr(ord('a') + i) for i in range(26)]
S = readline().decode('utf8').rstrip()
S += S
T = readline().decode('utf8').rstrip()
print('Yes' if T in S else 'No')



Measured memory_bytes: 5648
#include <iostream>
#include <vector>
#include <string>
class dice
{
private:
	std::vector<int> faces;
public:
	dice(int *surface){
		for(int i = 0 ; i < 6 ; i ++){
			faces.push_back(surface[i]);
		}
	};
	dice(){};
	int getSurface(){
		return faces[0];
	};
	int getRight(){
		return faces[2];
	};
	int *getFaces(){
		return faces.data();
	}
	void print(){
		for(int f : faces){
			std::cout << f << " " ;
		}
		std::cout << std::endl;
	}
	dice roll(char d)
	{
		int *s = new int[6];
		switch(d){
			case 'S':
			s[0] = faces[4]; s[1] = faces[0]; s[2] = faces[2];
			s[3] = faces[3]; s[4] = faces[5]; s[5] = faces[1];
			break;
			case 'N':
			s[0] = faces[1]; s[1] = faces[5]; s[2] = faces[2];
			s[3] = faces[3]; s[4] = faces[0]; s[5] = faces[4];
			break;
			case 'E':
			s[0] = faces[3]; s[1] = faces[1]; s[2] = faces[0];
			s[3] = faces[5]; s[4] = faces[4]; s[5] = faces[2];
 			break;
			case 'W':
			s[0] = faces[2]; s[1] = faces[1]; s[2] = faces[5];
			s[3] = faces[0]; s[4] = faces[4]; s[5] = faces[3];
			break;
		}
		dice newdice(s);
		delete[] s;
		return newdice;
	};
	bool isAnswer(int top,int front)
	{
		if(faces[0] == top && faces[1] == front){
			return true;
		}else{
			return false;
		}
	};
	int answerQuestion(int top,int front)
	{
		std::vector<std::string> patterns = {
			"","E","EE","W",
			"S","SE","SEE","SW",
			"SS","SSE","SSEE","SSW",
			"N","NE","NEE","NW",
			"ES","ESE","ESEE","ESW",
			"WS","WSE","WSEE","WSW"};
		std::vector<dice> canditates;
		for(std::string pattern : patterns){
			dice d = (*this);
			for(char op : pattern){
				d = d.roll(op);
			}
			canditates.push_back(d);
		}
		for(dice canditate : canditates){
			if(canditate.isAnswer(top,front)){
				return canditate.getRight();
			}
		}
		return -3;
	};
	bool isTheSame(dice &target)
	{
		int *f = target.getFaces();
		for(int i = 0 ; i < 6 ; i ++){
			if(f[i] != faces[i]) return false;
		}
		return true;
	}
	bool answertheSame(dice &target)
	{
		std::vector<std::string> patterns = {
			"","E","EE","W",
			"S","SE","SEE","SW",
			"SS","SSE","SSEE","SSW",
			"N","NE","NEE","NW",
			"ES","ESE","ESEE","ESW",
			"WS","WSE","WSEE","WSW"};
		std::vector<dice> canditates;
		for(std::string pattern : patterns){
			dice d = (*this);
			for(char op : pattern){
				d = d.roll(op);
			}
			canditates.push_back(d);
		}
		for(dice canditate : canditates){
			if(target.isTheSame(canditate)){
				return true;
			}
		}
		return false;
	};
};

int main(int argc, char const *argv[])
{
	int *dice1 = new int[6];
	int *dice2 = new int[6];
	for(int i = 0 ; i < 6 ; i++){
		std::cin >> dice1[i];
	}
	for(int i = 0 ; i < 6 ; i ++){
		std::cin >> dice2[i];
	}
	dice a(dice1);
	dice b(dice2);
	delete [] dice1;
	delete [] dice2;
	if(a.answertheSame(b)){
		std::cout << "Yes" << std::endl;
	}else{
		std::cout << "No" << std::endl;
	}
	return 0;
}

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

typedef long long ll;

int main() {	
	int n, m;
	cin >> n >> m;
	vector<string> s(n);
	for (int i = 0; i < n; ++i) {
		cin >> s[i];
	}
	int inf = 1e9 + 7;
	int ans = 0;
	//vector<vector<int>> chd(n,vector<int> (m));
	//for (int ii = 0; ii < n; ++ii) {
		//for (int jj = 0; jj < m; ++jj) {
			//if (ii + 1 < n && s[ii +  1][jj] == '.') {
				//chd[ii][jj]++;
			//}
			//if (ii - 1 >= 0 && s[ii - 1][jj] == '.') {
				//chd[ii][jj]++;
			//}
			//if (jj + 1 < m && s[ii][jj + 1] == '.') {
				//chd[ii][jj]++;
			//}
			//if (jj - 1 >= 0 && s[ii][jj - 1] == '.') {
				//chd[ii][jj]++;
			//}
			//cout << chd[ii][jj] << " "; 
		//}
		//cout << endl;
	//}

	//vector<vector<int>> dp(n,vector<int> (m,inf));
	for (int i = 0; i < n; ++i) {
		for (int j = 0; j < m; ++j) {
			if (s[i][j] == '.') {
				vector<vector<int>> dp(n,vector<int> (m,inf));
				queue<vector<int>> q;
				q.push({i,j,1});
				vector<vector<int>> ch(n,vector<int> (m,1));
				//ch = chd;
				ch[i][j] = 0;
				while (!q.empty()) {
					vector<int>  top = q.front();
					int x = top[0];
					int y = top[1];
					if (x + 1 < n && s[x + 1][y] == '.' && ch[x + 1][y]) {
						dp[x + 1][y] = min(dp[x + 1][y],top[2]);
						q.push({x + 1, y,top[2] + 1});
						ch[x + 1][y] = 0;
					}
					if (x - 1 >= 0 && s[x - 1][y] == '.' && ch[x - 1][y]) {
						dp[x - 1][y] = min(dp[x - 1][y],top[2]);
						q.push({x - 1, y,top[2] +1 });
						ch[x - 1][y] = 0;
					}
					if (y + 1 < m && s[x][y + 1] == '.' && ch[x][y + 1]) {
						dp[x][y + 1] = min(dp[x][y + 1],top[2]);
						q.push({x, y + 1,top[2] + 1});
						ch[x][y + 1] = 0;
					}
					if (y - 1 >= 0 && s[x][y - 1] == '.' && ch[x][y - 1]) {
						dp[x][y - 1] = min(dp[x][y - 1],top[2]);
						q.push({x, y - 1,top[2] + 1});
						ch[x][y - 1] = 0;
					}
					//p++;
					q.pop();
				}
				for (int ii = 0; ii < n; ++ii) {
					for (int jj = 0; jj < m; ++jj) {
						//cout << dp[ii][jj] << " ";
						if (dp[ii][jj] < inf) {
							ans = max(ans,dp[ii][jj]);
						}
					}
					//9cout << endl;
				}
				//if (i == 2 && j == 0) {
					//for (int ii = 0; ii < n; ++ii) {
						//for (int jj = 0; jj < m; ++jj) {
							//cout << dp[ii][jj] << " ";
							//if (dp[ii][jj] < inf) {
								//ans = max(ans,dp[ii][jj]);
							//}
						//}
						//cout << endl;
					//}
				//}
				//cout << "i is : " << i << " j is : "  << j << endl; 
			}
		}
	}
	cout << ans;
}










Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
typedef vector<ll> vl;
typedef vector<int> vi;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> vvl;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvec;
typedef vector<vector<bool>> vveb;
typedef vector<vector<string>> vves;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define fs first
#define sc second
#define pb push_back
#define pp pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
typedef long long int64;
#define dame { puts("-1"); return 0;}
#define YES { cout << "YES" << endl; return 0; }
#define NO { cout << "NO" << endl; return 0; }
#define Yes { cout << "Yes" << endl; return 0; }
#define No { cout << "No" << endl; return 0; }
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 (a > b) { a = b; return 1; } return 0; }
int dx[] = { 0, 0, -1, 1 };
int dy[] = { 1, -1, 0, 0 };

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

	int N, M;
	cin >> N >> M;

	cout << (N * (N - 1) + M * (M - 1)) / 2;

	return 0;
}

Measured memory_bytes: 256
module Point = struct

  type t = { x : float; y : float }

  let make x y = { x; y }

  let equal a b = abs_float (a.x -. b.x) < 1e-10 && abs_float (a.y -. b.y) < 1e-10

  let sum a b = { x = a.x +. b.x; y = a.y +. b.y }

  let diff a b = { x = a.x -. b.x; y = a.y -. b.y }

  let multi p k = { x = p.x *. k; y = p.y *. k }

  let div p k = { x = p.x /. k; y = p.y /. k }

  let norm p = p.x *. p.x +. p.y *. p.y

  let abs p = norm p |> sqrt

  let dot a b = a.x *. b.x +. a.y *. b.y

  let cross a b = a.x *. b.y -. a.y *. b.x

  let project p1 p2 p =
    let base = diff p2 p1 in
    dot (diff p p1) base /. norm base
    |> multi base
    |> sum p1

end

module IO = struct

  (* @since 4.04.0 *)
  let split_on_char sep s =
    let open String in
    let r = ref [] in
    let j = ref (length s) in
    for i = length s - 1 downto 0 do
      if get s i = sep then begin
        r := sub s (i + 1) (!j - i - 1) :: !r;
        j := i
      end
    done;
    sub s 0 !j :: !r

  let read_ns () = read_line () |> split_on_char ' ' |> List.map float_of_string

end

open Point

let () =
  match IO.read_ns () with
  | xp1 :: yp1 :: xp2 :: yp2 :: _ ->
    begin
      let p1 = make xp1 yp1 in
      let p2 = make xp2 yp2 in
      let q = read_int () in
      for _ = 0 to q - 1 do
        match IO.read_ns () with
        | x :: y :: _ ->
          let p = make x y |> project p1 p2 in
          Printf.printf "%.10f %.10f\n" p.x p.y
        | _ -> assert false
      done
    end
  | _ -> assert false

Measured memory_bytes: 3204
def main():
    n = int(input())
    d,x = map(int,input().split())
    a_s = []
    answer = 0
    dp = [[0]*d]*n
    #n人×d日のテーブルを作る
    #作るな
    answer = 0
    for i in range(n):
        a_s.append(int(input()))
    for i in range(n):
        for j in range(d):
            answer += 1 if (j%a_s[i]==0) else 0
    print(answer+x)

main()

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#include<math.h>
#include<algorithm> 
#define rep(i,n) for (int i = 0; i < (n) ; ++i)
using namespace std;
using ll = long long ;
using P = pair<int, int> ;
#define PI 3.14159265358979323846264338327950
#define INF 1e18
#define mod 1000000007

int main() {
    int a, b, t ;
    cin >> a >> b >> t ;
    cout << b * (t  / a) << endl;  
} 

Measured memory_bytes: 3552
import sys
sys.setrecursionlimit(10 ** 6)
# input = sys.stdin.readline    ####
int1 = lambda x: int(x) - 1
def II(): return int(input())

def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())

def LI(): return list(map(int, input().split()))
def LI1(): return list(map(int1, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]

def printlist(lst, k='\n'): print(k.join(list(map(str, lst))))
INF = float('inf')
from collections import deque
def solve():
    n, m = MI()
    ans = [-1] * n
    to = [[] for _ in range(n)]
    for i in range(m):
        a, b = MI1()
        to[a].append(b)
        to[b].append(a)
    # print(to)
    q = deque([0])
    used = [0] * n
    used[0] = 1
    while len(q) > 0:
        current = q.popleft()
        for next in to[current]:
            if used[next]: continue
            if ans[next] == -1:
                q.append(next)
                ans[next] = current + 1
                used[next] = 1
        # print(q)
    if sum(used) == n:
        print('Yes')
        printlist(ans[1:])
    else:
        print('No')

if __name__ == '__main__':
    solve()


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

int n1, n2;
int a[100][100];
int b[100];

int main() {
    cin >> n1 >> n2;
    for (int i=0; i<n1; i++) {
        for (int j=0; j<n2; j++) {
            cin >> a[i][j];
        }
    }
    for (int i=0; i<n2; i++) {
        cin >> b[i];
    }


    for (int i=0; i<n1; i++) {
        int sum = 0;

        for (int j=0; j<n2; j++) {
            sum += a[i][j]*b[j];
        }
        cout << sum << endl;
    }
}



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

#define F first
#define S second
#define int long long
#define pb push_back
#define endl '\n'

using namespace std;

const int maxn = 1e+5 + 5;
int deg[maxn] , visited[maxn] , dis[maxn] ;
vector < int > g[maxn] ; 

void dfs(int s){
	visited[s] = 1; 
	for(auto i : g[s]){
		dis[i] = max(dis[i] , dis[s] + 1) ; 
		--deg[i] ; 
		if(!deg[i]){
			dfs(i) ; 
		}
	}
}
 
int32_t main()
{
	ios_base :: sync_with_stdio(false) ;
	cin.tie(0); cout.tie(0) ;
	int n , m ;
	cin >> n >> m ;
	for(int i = 0 , a , b ; i < m ; i++){
		cin >> a >> b ;
		g[a].pb(b) ; 
		deg[b]++ ; 
	}
	
	for(int i = 1 ; i <= n ; i++){
		if(!visited[i] and !deg[i]){
			dfs(i) ; 
		}
	}
	int ans = 0 ; 
	for(int i = 1 ; i <= n ; i++){
		ans = max(ans , dis[i]) ; 
	}
	
	cout << ans << endl ; 
	return 0 ; 
}



Measured memory_bytes: 11136
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define sz size
#define re return
#define gl getline
#define ll long long
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rept(i,a,b) for(int i=a;i<=b;i++) 
#define all(a) (a).begin(),(a).end()
#define inf 1<<30
int n;
int main(){
	ios::sync_with_stdio(false),cin.tie(0);
	long long ans=0;
    cin>>n;
    vector<long long>v(n);
    for(int i=0;i<n;i++)cin>>v[i];
    sort(all(v));
    reverse(all(v));
    ans+=v[0];
    for(int i=2;i<n;i++)ans+=v[i/2];
    cout<<ans<<endl;
    return 0;
} 

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

using namespace std;

using ll = long long;
template<class T> using v = vector<T>;

int main()
{
    ll N;
    cin >> N;
    v<ll> a(N);
    for(auto& v : a){ cin >> v; }
    
    int ans = 0;
    int search = 1;
    for(auto v : a){
        if(v == search){ ++search; }
        else{ ans++; }
    }
    if(search == 1){ cout << -1 << endl; }
    else{ cout << ans << endl; }
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll N=1e5+5,mod=1e9+7;
ll fct[N],prfx[N],a[N],n,ans;
ll power(ll n,ll p){
    ll val=1;
    while(p){
        if(p&1)val=(val*n)%mod;
        p>>=1;
        n=(n*n)%mod;
    }
    return val;
}
int main(){
    ios_base:: sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    cin>>n;fct[0]=1;
    for(ll i=1;i<=n;i++)cin>>a[i],prfx[i]=(prfx[i-1]+a[i])%mod,fct[i]=(fct[i-1]*i)%mod;
    for(ll x=0;x<=n-1;x++){
        ll val = fct[n]*power(x+1,mod-2);
        val%=mod;
        val*=prfx[n-x];
        val%=mod;
        ans+=val;
        ans%=mod;
    }
    reverse(a+1,a+n+1);
    for(ll i=1;i<=n;i++)prfx[i]=(prfx[i-1]+a[i])%mod;
    for(ll x=1;x<=n-1;x++){
        ll val = fct[n]*power(x+1,mod-2);
        val%=mod;
        val*=prfx[n-x];
        val%=mod;
        ans+=val;
        ans%=mod;
    }
    cout<<ans;
}

Measured memory_bytes: 2560
#include <iostream>
using namespace std;
double abs(double x){return  x > 0 ? x : -x;}

int main(){
	int N, T, A;
	cin >> N;
	cin >> T >> A;
	int H[N+1];
	for(int i = 1; i <= N; i++) cin >> H[i];
	double dif;
	double min_dif = 200001;
	int argmin;
	for(int i = 1; i <= N; i++){
		dif = abs(A - (T - H[i] * 0.006));
		if(dif < min_dif){
			min_dif = dif;
			argmin = i;
		}
	}
	cout << argmin << endl;

}




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

#define ll long long
#define ull unsigned ll

#define vi vector <int>
#define ii pair <int, int>
#define vii vector <ii>
#define vll vector <ll>
#define vull vector <ull>
#define INFL 9e18
#define INF 2e9
#define EPS 1e-9
#define pb push_back
#define emp emplace_back
#define PI acos(-1.0)
#define endl "\n"
#define mp make_pair
#define DEBUG 0

int main ()

{
    

    double r;
    cin >> r;
    
    cout << 2*PI*r << endl;
    
    return 0;
}

Measured memory_bytes: 3784
from itertools import permutations
from math import ceil

times = [int(input()) for _ in range(5)]
orders = list(permutations(times))
minimum = sum(ceil(time/10)*10 for time in times)

for order in orders:
    total = order[0]
    for i in range(1, 5):
        total += ceil(order[i]/10)*10
    minimum = min(minimum, total)
print(minimum)



Measured memory_bytes: 9172
#include <stdio.h>

int main(void){

  int a,b;
  scanf("%d %d", &a, &b);
  if (a%3 == 0 || b%3 == 0 || (a+b)%3 == 0) {
    printf("Possible\n");
  } else {
    printf("Impossible\n");
  }

  return 0;
}

Measured memory_bytes: 128
import java.util.ArrayList;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        int A = sc.nextInt();
        int B = sc.nextInt();
        int K = sc.nextInt();
        ArrayList<Integer> commonDivisors = new ArrayList<>();
        int idx = Math.min(A, B);

        for (int i = idx; i > 0; i--) {
            if (A % i == 0 && B % i == 0) {
                commonDivisors.add(i);
                if (commonDivisors.size() == K) {
                    break;
                }
            }
        }

        System.out.println(commonDivisors.get(K - 1));
    }

}





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

char c, ans;

int main() {
    cin >> c;

    if (c == 'A') ans = 'T';
    if (c == 'T') ans = 'A';
    if (c == 'G') ans = 'C';
    if (c == 'C') ans = 'G';

    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <sstream>
#include <string>
#include <algorithm>
#include <vector>
using namespace std;

int main ()
{
    string str;
    vector<vector<int> > v;
    while (getline(cin, str)) {
        v.push_back(vector<int>(1));
        for (int i = 0; i < str.size(); i++)
            if (str[i] == ',') str[i] = ' ';
        int n;
        stringstream ss;
        ss << str;
        while (ss >> n) {
            v[v.size()-1].push_back(n);
        }
        v[v.size()-1].push_back(0);
    }

    int i = 1;
    while (i <= ((int)v.size() / 2)) {
        for (int j = 1; j < v[i].size()-1; j++) {
            v[i][j] += max(v[i-1][j], v[i-1][j-1]);
        }
        i++;
    }
    while (i < v.size()) {
        for (int j = 1; j < v[i].size() - 1; j++) {
            v[i][j] += max(v[i-1][j], v[i-1][j+1]);
        }
        i++;
    }
    cout << v[v.size()-1][1] << endl;

    return 0;
}

Measured memory_bytes: 1264