akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

using namespace std;

typedef long long ll;

#define sz size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(c) (c).begin(), (c).end()
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define per(i,a,b) for(ll i=b-1LL;i>=(a);--i)
#define clr(a, b) memset((a), (b) ,sizeof(a))
#define ctos(c) string(1,c)
#define print(x) cout<<#x<<" = "<<x<<endl;

#define MOD 1000000007

int main(){
  ll n,k;
  cin>>n>>k;
  vector<ll> v;
  ll sum = 0;
  rep(i,0,n){
  	ll a;
  	cin>>a;
  	v.pb(a);
  	sum += a;
  }
  vector<ll> v1;
  for(ll i = 1; i*i <= sum; i++){
  	if(sum%i==0){
  		v1.pb(i);
  		if(i!=sum/i){
  			v1.pb(sum/i);
  		}
  	}
  }
  ll ans = 1;
  sort(all(v1));
  rep(i,0,v1.sz){
  	ll a = v1[i];
  	vector<ll> v2;
  	rep(j,0,v.sz){
  		v2.pb(v[j]%a);
  	}
  	sort(all(v2));
  	ll index1 = 0;
  	ll index2 = v2.sz-1;
  	ll count = 0;
  	while(index1<index2){
  		ll b = v2[index1];
  		count+=b;
  		while(b>0){
  			ll c = min(a-v2[index2],b);
  			v2[index2]+=c;
  			b -= c;
  			if(v2[index2]%a==0){
  				index2--;
  				if(index2<=index1)break;
  			}
  		}
  		index1++;
  	}
  	if(count<=k){
  		ans = max(ans,a);
  	}
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, a, b) for (int i = a; i < (b); i++)
#define FOR(i, n) for (int i = n; i >= 0; i--)
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <cstring>
#include <vector>
#define ll long long
#define SIZE 100001
#define MOD 1000000007
#define INF 100000000
using namespace std;

int main()
{
    int X,t;
    cin >> X >> t;

    if(X >= t){
        cout << X - t << endl;
    }
    else cout << 0 << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <string>
#include <algorithm>
#include <utility>
#include <vector>
#include <stack>
#include <queue>
using namespace std;

int main()
{
    int n, x;
    int a[100]={};
    cin >> n >> x;
    for(int i = 0; i<=n-1; i++)
    {
        cin >> a[i];
    }

    sort(a, a+n);



    int i = 0, count = 0;
    while(x > 0 && i<=n-1)
    {
        // cout << "x = " << x << endl;
        x-=a[i];
        i++;
        if(x >= 0)
        {
            count++;
        };
    }
    if(x > 0)
    {
        count--;
    }
    // cout << "x = " << x << endl;;
    
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 888
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cstring>
#include <complex>
#include <stack>
#include <queue>
#include <unordered_map>
#include <map>
#define rep(i, a) for (int i = 0; i < (a); i++)
using namespace std;
int main() {
    int n, m;
    cin >> n >> m;

    int graph[n][n];

    int i, j;
    for(i = 0; i < n; i++){
        for(j = 0; j < n; j++){
            graph[i][j] = 0;
        }
    }

    int a, b;
    for(i = 0; i < m; i++){
        cin >> a >> b;
        graph[a-1][b-1] += 1;
        graph[b-1][a-1] += 1;
    }

    int count;
    for(i = 0; i < n; i++){
        count = 0;
        for(j = 0; j < n; j++){
            count += graph[i][j];
        }
        cout << count << endl;
    }


}


Measured memory_bytes: 256
// WeirdBugsButOkay

#include <bits/stdc++.h>

#define ll long long
#define ld long double
#define pii pair <int, int>
#define pll pair <ll, ll>
#define pb push_back
#define ff first
#define ss second
#define endl '\n'
#define _dbg(x) cout << #x << " is " << (x) << endl;
#define dbg(v, x) cout << #v << ": "; for(int i = 0; i < (x); i++)  cout << (v)[i] << " "; cout << endl;

using namespace std;

void solve()
{
    ll a, b, n;
    cin >> a >> b >> n;
    ll ansv = min(b - 1, n);
    ll ans = floor(1.0 * a * ansv / b) - a * floor(1.0 * ansv / b);
    cout << ans << endl;
}

int main()
{
    ios_base :: sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int q = 1;
    //cin >> q;
    for(int i = 0; i < q; i++)
    {
        solve();
    }
    return 0;
}


Measured memory_bytes: 3600
using System;
using System.Diagnostics;
using System.IO;
using System.Text;
using System.Linq;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using System.Security.Cryptography;

class Program
{
    const string Yes = "Yes";
    const string No = "No";
    const char White = '.';
    const char Black = '#';
    const long Mod = 1000000007;

    static void Main(string[] args) {
#if DEBUG
        MyDebugger.Test(process, "../TextFile1.txt");
#else
        object ret = process(new StreamReader(Console.OpenStandardInput()));
        Console.WriteLine(ret);
#endif
    }

    static object process(TextReader input) {
        var s = input.ReadLine();
        var k = int.Parse(input.ReadLine());
        var n = s.Length;

        var first = 0;
        for(first=0; first < n && s[first] == s[0]; first++);

        var last = 0;
        for (last = 0; last < n && s[n-last-1] == s[n-1]; last++) ;

        if (n == last) {
            return (long)n * k / 2;
        }

        if (s[0] != s[n - 1]) {
            return count(s)*k;
        } else {
            long sum = 0;
            sum += count(s.Substring(0, n-last));
            var ss = s.Substring(n-last, last) + s.Substring(0, n - last);
            sum += count(ss) * (k-1);
            sum += count(s.Substring(n - last, last));

            return sum;
        }
       
    }

    static long count(string s) {
        long co = 0;
        for (int i = 1; i < s.Length; i++) {
            if (s[i - 1] == s[i]) {
                co++;
                i++;
            }
        }
        return co;
    }

    static long[] ToIntArray(string strs, int n) {
        var ret = new long[n];
        var spl = strs.Split(' ');
        for (int i = 0; i < n; i++)
            ret[i] = long.Parse(spl[i]);
        return ret;
    }
}

Measured memory_bytes: 11092
import java.util.*;

class Main {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int result = 0;
        for (int i = a; i <= b; i++) {
            String s = String.valueOf(i);
            String before = s.substring(0, 2);
            String after = s.substring(4, 5) + s.substring(3, 4);
            if (before.equals(after)) {
                result++;
            }
        }
        System.out.println(result);
    }
}

Measured memory_bytes: 38228
#include<iostream>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
using namespace std;

int main(){
	char a,b;
	int ans;
	cin>>a>>b;
	if(b=='H')ans=1;
	else ans=-1;
	if(a=='D')ans*=-1;
	cout<<((ans>0)?'H':'D')<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
string S;
int main(){
  cin >> S;
  for(int i=S.size()-2;i>0;i-=2){
    string s=S;
    s.resize(i);
    string l=s;
    l.resize(i/2);
    string r= s.substr(i/2);
  //  cout << s << " " << l << " " << r<< endl;
    if(r==l){
      cout << i << endl;
      return 0;
    }
  }
}


Measured memory_bytes: 256
def solve(L, A, B, M):
    ret, digits = 0, 0
    for d in range(18, 0, -1):
        lo = 10 ** (d - 1)
        hi = 10 ** d - 1
        if hi < A or A + B * (L - 1) < lo:
            continue
        imin = 0 if lo <= A else (lo - A + B - 1) // B
        init = A + B * imin
        if init > hi:
            continue
        imax = L - 1 if A + B * (L - 1) <= hi else imin + (hi - init) // B
        n = imax - imin + 1
        p = 10 ** d % M
        a = matpow([[1, 0, 1, 0], [0, 1, 0, 1], [0, 0, p, p], [0, 0, 0, p]], n, M)
        # a[0][3] = sum p^i for i in [0, n-1]
        # a[1][3] = sum i * p^i for i in [0, n-1]
        # sum (A + B * (imax - i)) * p^i for i in [0, n-1]
        sub = (A + B * imax) % M * a[1][3] % M + M - (B * a[0][3] % M)
        ret += sub % M * pow10(digits, M) % M
        digits += d * (imax - imin + 1)
    return ret % M


def pow10(p, mod):
    if p % 2 == 1:
        return 10 * pow10(p - 1, mod) % mod
    elif p > 0:
        sub = pow10(p // 2, mod)
        return sub * sub % mod
    else:
        return 1


def matpow(a, p, mod):
    if p % 2 == 1:
        return matmul(a, matpow(a, p - 1, mod), mod)
    elif p > 0:
        b = matpow(a, p // 2, mod)
        return matmul(b, b, mod)
    else:
        n = len(a)
        return [[1 if i == j else 0 for j in range(n)] for i in range(n)]


def matmul(a, b, mod):
    n = len(a)
    ret = [[0 for j in range(n)] for i in range(n)]
    for i in range(n):
        for k in range(n):
            for j in range(n):
                ret[i][j] += a[i][k] * b[k][j]
        for j in range(n):
            ret[i][j] %= mod
    return ret


L, A, B, M = map(int, input().split())
print(solve(L, A, B, M))


Measured memory_bytes: 3192
//y17-5
#include <iostream>
#include <fstream>
#include <stdio.h>
#include <math.h>
#include <time.h>
#include <string>
#include <vector>
#include <map>
#include <list>
#include <set>
#include <stack>
#include <queue>
#include <cstdlib>
#include <algorithm>
#include <random>
#include <cassert>
using namespace std;
#define LL long long
#undef INT_MIN
#undef INT_MAX
#define INT_MIN -2147483648
#define INT_MAX 2147483647
#define LL_MIN -9223372036854775808
#define LL_MAX 9223372036854775807
#define segment_size 65536
#define ROOP() while(true)

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

int main(){
    int x,y;
    cin >> x >> y;
    cout << x + y - gcd(x,y) + 1 << endl;
}




Measured memory_bytes: 3092
#!/usr/bin/env python3
import math
n,p = map(int,input().split())
ans = 1
if n == 1:
    print(p)
    exit()
for i in range(2,1+math.ceil(p**(1/2))):
    cnt = 0
    while p % i == 0:
        p = p//i
        cnt += 1
    beki = cnt // n
    ans *= pow(i,beki)
    #print(ans,i,cnt)
print(ans)


Measured memory_bytes: 40440
#include<bits/stdc++.h>
#define rep(i, n) for (int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
 
bool is_integer(double x ){
  return std::floor(x)==x;
}

int main(void){
    int n;
    cin>>n;
    rep(l, n){
        int now = 0;
        for(int i = 1;i*i<=n;i++){
            for(int j = 1;j*j<=n;j++){
                if(-3*i*i-3*j*j-2*i*j+4*(l+1)>=0){
                    double a = sqrt(double(-3*i*i-3*j*j-2*i*j+4*(l+1)));
                    if(is_integer(a)){
                        if(-i-j+(int)a>0&&(-i-j+(int)a)%2==0) now++;
                    }
                }
            }
        }
        cout<<now<<endl;
    }
    return 0;
}

Measured memory_bytes: 3624
// #pragma GCC optimize "trapv" Uncomment when dealing with huge numbers
/*<----------PBDS---------->

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
template <typename T>
using order_set = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;

order_set<datatype>oset;
Kth smallest : *oset.find_by_order(k-1); // 0 based index
No of elements less than k : oset.order_of_key(k);
Erase X : oset.erase(x)
<----------PBDS---------->*/
#include<iostream>
#include<bits/stdc++.h>
#define int long long
#define mod 1000000007
#define pb(x) push_back(x)
#define gcd(a,b) __gcd(a,b)
#define all(v) v.begin(),v.end()
#define lcm(a,b) (a*b)/gcd(a,b)
#define bits(x) __builtin_popcountll(x)
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
int32_t main()
{
	string s;
	cin >> s;
	if((s[2]==s[3]) && (s[4]==s[5])){
		cout <<"Yes";
		return 0;
	}
	cout <<"No";
}





Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
using namespace std;
int main(){
    vector<string> c(3);

    for(int i=0; i<3; i++){
        cin >> c[i];
    }
    cout << c[0][0] << c[1][1] << c[2][2] << endl;

    return 0;
}

Measured memory_bytes: 256
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd
from itertools import accumulate, permutations, combinations, product, groupby, combinations_with_replacement
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from heapq import heappush, heappop
from functools import reduce
import numpy as np
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N, M, Q = MAP()
LR = [LIST() for _ in range(M)]
pq = [LIST() for _ in range(Q)]

x = np.zeros((N+1, N+1), dtype=np.int64)
for L, R in LR:
    x[L, R] += 1
x = x.cumsum(axis=0).cumsum(axis=1)

for p, q in pq:
    print(x[q][q]-x[q][p-1]-x[p-1][q]+x[p-1][p-1])


Measured memory_bytes: 77948
#include <iostream>
#include <cstdio>
#include <queue>
#include <algorithm>
#include <stack>
#include <cmath>
#include <map>
#include <set>
#include <cstring>
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define PI acos(-1.0)
typedef long long ll;
const int INF=0x3f3f3f3f;
//const ll INF=1000000000000000000;
//priority_queue<int, vector<int>, greater<int> >p;
const int maxn=510;
int uN,vN,n;//u,v数目
int g[maxn][maxn];
int link[maxn];
bool used[maxn];
bool dfs(int u){//从左边开始找增广路径
    int v;
    for(v=0;v<vN;v++)//这个顶点编号从0开始，若要从1开始需要修改
      if(g[u][v]&&!used[v])
      {
          used[v]=true;
          if(link[v]==-1||dfs(link[v]))
          {//找增广路，反向
              link[v]=u;
              return true;
          }
      }
    return false;
}

int hungary(){
    int res=0;
    int u;
    memset(link,-1,sizeof(link));
    for(u=0;u<uN;u++)
    {
        memset(used,0,sizeof(used));
        if(dfs(u)) res++;
    }
    return res;
}
int main()
{
    int a[105][3],b[105][3];
    scanf("%d",&n);
    uN=vN=n;
    for(int i=0;i<n;i++)
        scanf("%d%d",&a[i][1],&a[i][2]);
    for(int i=0;i<n;i++)
        scanf("%d%d",&b[i][1],&b[i][2]);
    for(int i=0;i<n;i++)
        for(int j=0;j<n;j++)
            if(a[i][1]<b[j][1]&&a[i][2]<b[j][2])g[i][j]=1;
    printf("%d\n",hungary());
    return 0;
}


Measured memory_bytes: 512
S = input()
N = len(S)

def palindrome(string):
  return True if string==string[::-1] and string[0]==string[-1] else False

if not palindrome(S):
  print('No')
  exit(0)

left = S[0:int((N-1)//2)]
right = S[int((N+3)//2)-1:N]

if not palindrome(left):
  print('No')
  exit(0)
if not palindrome(right):
  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##_len=(n); i<i##_len; ++i)
#define REP1(i,n) for(int i=1, i##_len=(n); i<i##_len; ++i)
#define ll long long
static const int MAX = 10000;
static const ll INFTY = 1e12;

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; }


const ll MRINF = 5000000000000000;
int main() {
    string S;
    cin >> S;

    if(S[0]!='A'){
        cout << "WA" << endl;
        return 0;
    }
    S[0] = 'a';
    int ans = 0;
    for(int i = 2; i <= S.length()-2; i++){
        if(S[i]=='C'){
            ans++;
            S[i] = 'c';
        }
    }
    if(ans != 1){
        cout << "WA" << endl;
        return 0;        
    }
    // cout << int('A') << " " << int('a') << endl;
    REP(i, S.length()){
        if(S[i] - 'a' < 0){
          cout << "WA" << endl;
          return 0;           
        }
    }
          cout << "AC" << endl;
          return 0;  
}
/*
                   _ooOoo_
                  o8888888o
                  88" . "88
                  (| -_- |)
                  O\  =  /O
               ____/`---'\____
             .'  \\|     |//  `.
            /  \\|||  :  |||//  \
           /  _||||| -:- |||||-  \
           |   | \\\  -  /// |   |
           | \_|  ''\---/''  |   |
           \  .-\__  `-`  ___/-. /
         ___`. .'  /--.--\  `. . __
      ."" '<  `.___\_<|>_/___.'  >'"".
     | | :  `- \`.;`\ _ /`;.`/ - ` : | |
     \  \ `-.   \_ __\ /__ _/   .-` /  /
======`-.____`-.___\_____/___.-`____.-'======
                   `=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
         pass System Test!
*/

Measured memory_bytes: 3632
require 'set'

class Entry
  attr_reader :spell, :nodes

  def initialize(spell, nodes)
    @spell = spell
    @nodes = nodes
  end
end
 
class Arrow
  attr_reader :source, :sink, :label

  def initialize(source, sink, label)
    @source = source
    @sink = sink
    @label = label
  end
end

def push(queue, spell)
  size = queue.size
  index = queue.index{|entry| entry.spell >= spell} || size
  return queue[index].nodes if index < size && queue[index].spell == spell

  return nil if index > 0 && !spell.start_with?(queue[index - 1].spell)
  queue.slice!(index..-1) if index < size && !queue[index].spell.start_with?(spell)

  nodes = {}
  queue.insert(index, Entry.new(spell, nodes))
  nodes
end

def calc(n, arrows, start, goal)
  ins = Array.new(n){[]}
  arrows.each do |arrow|
    ins[arrow.sink] << arrow.source
  end

  reachable_from = {}
  stack = [goal]
  until stack.empty?
    node = stack.pop
    reachable_from[node] = true
    ins[node].each do |source|
      stack << source unless reachable_from[source]
    end
  end

  return nil unless reachable_from[start]
  arrows.select!{|arrow| reachable_from[arrow.sink]}

  outs = Array.new(n){[]}
  arrows.each do |arrow|
    outs[arrow.source] << arrow
  end

  limit = n * arrows.map{|arrow| arrow.label.size}.max

  queue = [Entry.new('', {start => true})]
  until queue.empty?
    entry = queue.shift
    spell = entry.spell
    nodes = entry.nodes
    return spell if nodes[goal]
    return nil if spell.size > limit

    nodes.each do |node, _|
      outs[node].each do |arrow|
        new_nodes = push(queue, spell + arrow.label)
        new_nodes[arrow.sink] = true if new_nodes
      end
    end
  end
  nil
end

loop do
  n, a, s, g = gets.split.map(&:to_i)
  break if n == 0

  arrows = (0...a).map do |i|
    x, y, lab = gets.split
    Arrow.new(x.to_i, y.to_i, lab)
  end

  puts calc(n, arrows, s, g) || 'NO'
end

Measured memory_bytes: 10656
#include <iostream>
#include <string>


using namespace std;

int main(int argc, char const *argv[])
{
    string s;
    cin >> s;
    char cur;
    bool tf = true;
    cur = s[0];
    for (int i = 1; i < 4 && tf; ++i) {
        if (s[i]==cur) tf = false;
        else cur = s[i];
    }

    if (tf) cout << "Good" << endl;
    else cout << "Bad" << endl;
    return 0;
}

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

using ll=long long;



void solve(){
    int a,b;
    cin>>a>>b;
    if(a<=8&&b<=8){
        cout<<"Yay!"<<endl;
    }else{
        cout<<":("<<endl;
    }
}

signed main(){
    //while(1)
    solve();
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
    #include <math.h>
 
    using namespace std;
    typedef long long ll;
    typedef unsigned long long ull;
    # define M_PI  3.14159265358979323846
 
 
    const int M=1e9+7;
    long long mod(long long x){
        return ((x%M + M)%M);
    }
    long long add(long long a, long long b){
        return mod(mod(a)+mod(b));
    }
    long long mul(long long a, long long b){
        return mod(mod(a)*mod(b));
    }
 
    ll modPow(ll a, ll b){
        if(b==0)
            return 1LL;
        if(b==1)
            return a%M;
        ll res=1;
        while(b){
            if(b%2==1)
                res=mul(res,a);
            a=mul(a,a);
            b=b/2;
        }
        return res;
    }

    void solve (){
        int n;
        cin>>n;
        vector<vector<ll>>d(4,vector<ll>(n));
        for(int i=0;i<n;i++){
            ll x,y;
            cin>>x>>y;
            d[0][i]=x+y;
            d[1][i]=x-y;
            d[2][i]=-x+y;
            d[3][i]=x-y;
        }
        for(int i=0;i<4;i++){
            sort(d[i].begin(),d[i].end());
        }
        ll ans=-1e18;
        for(int i=0;i<4;i++){
            ans=max(ans,d[i][n-1]-d[i][0]);
        }
        cout<<ans;
    }
    int main(){
        ios::sync_with_stdio(0);
        cin.tie(0);
        cout.tie(0);
        cout<<fixed;
        cout<<setprecision(10);
//        freopen("timber_input.txt", "r", stdin);
//        freopen("timber_output.txt", "w", stdout);
        int t=1;
        // cin>>t;
        for(int i=1;i<=t;i++){
//            cout<<"Case #"<<i<<": ";
            solve();
        }
        return 0;
    }

Measured memory_bytes: 10996
#![allow(unused_imports)]

use proconio::{input, fastout};
use proconio::marker::*;
use im_rc::HashSet;

#[fastout]
fn main() {
    input! {
    n: usize,
    w: [Chars; n]
    }
    let mut e  = w[0][0];
    let mut is_used = HashSet::new();
    for i in 0..n {
        let s = w[i].iter().collect::<String>();
        if w[i][0] != e || is_used.contains(&s) {
            print!("No");
            return
        }
        e = *w[i].last().unwrap();
        is_used.insert(s);
    }
    println!("Yes");
}


Measured memory_bytes: 2112
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i ++)
#define irep(i,n) for (int i = (int)(n) - 1;i >= 0;--i)
using namespace std;
using ll = long long;
using PL = pair<ll,ll>;
using P = pair<int,int>;
constexpr int INF = 1000000000;
constexpr long long HINF = 1000000000000000;
constexpr long long MOD = 1000000007;// = 998244353;
constexpr double EPS = 1e-4;
constexpr double PI = 3.14159265358979;

struct StronglyConnectedComponents {
    int N,cnt;
    vector<vector<int>> G,rG;
    vector<int> group,order;

    StronglyConnectedComponents(int _N): N(_N) {
        G.resize(N); rG.resize(N); group.assign(N,1);
    }
    
    void add_edge(int a,int b) {
        G[a].push_back(b);
        rG[b].push_back(a);
    }

    void dfs(int v) {
        group[v] = -1;
        for (int e: G[v]) {
            if (group[e] > 0) dfs(e);
        }
        order.push_back(v);
    }

    void rdfs(int v,int cnt) {
        group[v] = cnt;
        for (int e: rG[v]) {
            if (group[e] < 0) rdfs(e,cnt);
        }
    }

    void build() {
        for (int i = 0;i < N;i ++) {
            if (group[i] > 0) dfs(i);
        }
        reverse(begin(order),end(order));
        cnt = 0;
        for (int v: order) {
            if (group[v] < 0) rdfs(v,cnt),cnt++;
        }
    }

    int operator[](int i) {
        return group[i];
    }
};

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

    int N,M; cin >> N >> M;
    StronglyConnectedComponents scc(N);
    set<P> before;
    rep(i,M) {
        int a,b; cin >> a >> b;
        if (a == b) continue;
        if (before.count(P{a,b})) continue;
        before.insert(P{a,b});
        scc.add_edge(a,b);
    }
    scc.build();
    int x = scc.cnt;
    vector<vector<int>> ans(x);
    rep(i,N) ans[scc[i]].push_back(i);
    cout << x << '\n';
    rep(i,x) {
        cout << ans[i].size() << ' ';
        rep(j,ans[i].size()) cout << ans[i][j] << ' ';
        cout << '\n';
    }
    return 0;
}

Measured memory_bytes: 103472
#include<stdio.h>
int main()
{
	int N,k,i,j,A[100],M,o=0;
	scanf("%d %d",&N,&M);
	for(i=0;i<N;i++){
		scanf("%d",&A[i]);
	}
	for(k=2;k<=M;k++){
		for(i=0;i<N-1;i++){
			if(A[i]%k>A[i+1]%k){
			o=A[i];
			A[i]=A[i+1];
			A[i+1]=o;
			}
		}
	}
	for(i=0;i<N;i++){
		printf("%d\n",A[i]);
	}





}

Measured memory_bytes: 2696
def dfs_recursive(u):
    global time
    color[u] = 'gray'
    arrive[u] = time
    time += 1
    for v in range(n):
        if adjMat[u][v] == 1 and color[v] == 'white':
            dfs_recursive(v)
    color[u] = 'black'
    finish[u] = time
    time += 1


n = int(input())

adjMat = [[0] * n for _ in range(n)]
color = ['white'] * n
arrive = [0] * n
finish = [0] * n
time = 1

for _ in range(n):
    adj = list(map(int, input().split()))
    i = adj[0]
    v = adj[2:]
    for j in v:
        adjMat[i - 1][j - 1] = 1

for root in range(n):
    if color[root] == 'white':
        dfs_recursive(root)


for i in range(n):
    out = ''
    out += '{} {} {}'.format(i + 1, arrive[i], finish[i])
    print(out)

Measured memory_bytes: 7784
#include<iostream>
#include<algorithm>
#include<math.h>

using namespace std;

int compare(const void *a, const void *b)
{
    return *(int*)a - *(int*)b;
}

int main(){
    int n;
    cin >> n;
    for (int i = 0; i < n; i++){
        int arr[3];
        cin >> arr[0] >> arr[1] >> arr[2];
        sort(arr, arr + 3);

        if (pow(arr[0], 2) + pow(arr[1], 2) == pow(arr[2], 2))
        {
            cout << "YES" << endl;
        }
        else
        {
            cout << "NO" << endl;
        }

    }


    return 0;
}

Measured memory_bytes: 1168
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
using llu=unsigned long long;
#define mod 1000000007
#define mode 998244353
#define PI 3.14159265358979323846
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define mms(x,y) memset(x,y,sizeof(x))
#define pqm priority_queue<ll,vector<ll>,greater<ll>>
#define pb push_back
#define um unordered_map
#define pr pair
#define mm multimap
#define ms multiset
#define mp make_pair
#define vr vector
#define pq priority_queue
#define lb lower_bound
#define ub upper_bound
#define inf INT_MAX
#define ninf INT_MIN
#define ff first
#define ss second
#define gcd __gcd
ll dp[405][405];
int main()
{
    fast;
    ll t,n,m,i,j,k;
    cin>>n;
    ll a[n];
    for(i=0;i<n;i++)cin>>a[i];
    ll s[n+1];
    s[0]=0;
    for(i=1;i<=n;i++)s[i]=s[i-1]+a[i-1];
    for(i=2;i<=n;i++)
    {
        for(j=1;j+i-1<=n;j++)
        {
            ll ans=1e18;
            for(k=j+i-2;k>=j;k--)
            {
                ans=min(ans,dp[j][k]+dp[k+1][j+i-1]+s[j+i-1]-s[j-1]);
            }
            dp[j][j+i-1]=ans;
        }
    }
    cout<<dp[1][n];
}


Measured memory_bytes: 1536
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n ;
    cin >> n;
    if(n < 82){
        for(int i = 9 ; i >= 2 ; --i){
            if( n % i == 0){
                if( n /i <= 9)
                    cout << "Yes" << endl;
                else
                    cout << "No" << endl;
                
                goto here;
            }    
        }
        if(n == 1)
            cout << "Yes" << endl;
        else
            cout << "No" << endl;
    }
    else
        cout << "No" << endl;

    here : ;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
	int n;
	scanf("%d",&n);
	int m;
	scanf("%d",&m);
	int in,out;
	int i;
	int max=m;
	for(i=0;i<n;i++){
		scanf("%d %d",&in,&out);
		m+=in-out;
		if(m<0){
			printf("0\n");
			return 0;
		}
		if(m>max){
			max=m;
		}
	}
	printf("%d\n",max);
	return 0;
}

Measured memory_bytes: 596
#include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>
#include<string>
#include<queue>
#include<set>
#include<map>
using namespace std;
typedef long long int ll;
typedef vector<pair<ll,ll> > Q;
typedef pair<int,int> P;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
const ll inf=1e9+7;
ll gcd(ll a, ll b) { return (b ? gcd(b, a % b) : a); }
ll lcm(ll a, ll b) { return a / (gcd(a, b)) * b; }

int n,h;
int main(){
  cin>>n>>h;
  vector<pair<ll,ll> > a(n);
  priority_queue<ll> que;
  rep(i,n){
    cin>>a[i].first>>a[i].second;
    que.push(a[i].second);
  }

  sort(a.begin(),a.end());
  ll tmp=a[n-1].first,cnt=0;
    while(h>0 && !que.empty()){
      if(que.top()>tmp){
        h-=que.top();
        que.pop();
        cnt++;
      }
      else break;
    }

  if(h>0){
      if(h%tmp) cnt+=(h/tmp)+1;
      else cnt+=h/tmp;
  }

  cout<<cnt<<endl;

}

Measured memory_bytes: 2936
def main():
    n = int(input())
    m = [[0 for j in range(n+1)] for i in range(n+1)]

    for i in range(n):
        d = list(map(int, input().split()))
        for j in range(2, len(d)):
            m[d[0]][d[j]] = 1

    for i in range(1, n+1):
        print(" ".join([str(m[i][j]) for j in range(1, len(m[i]))]))


if __name__ == '__main__':
    main()



Measured memory_bytes: 5680
N, M, C = map(int, input().split())
B = list(map(int, input().split()))
A = [list(map(int, input().split())) for i in range(N)]

count = 0

for i in range(N):
  value = 0
  for j in range(M):
    value += A[i][j] * B[j]
  value += C
  if value > 0:
    count += 1
print(count)

Measured memory_bytes: 38256
#include <iostream>
#include <string>
#include <algorithm>
#include <ctime>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cassert>
#include <bitset>
#include <list>
#include <cstdio>
#include <stdio.h>
#include <string.h>
#include <limits.h>
#include <math.h>
#include <cmath>
#define rep(i,m,n) for(int i=m; i<(n); i++)
#define rrep(i,n,m) for(ll i=n;i>=m;i--)
typedef long long ll;
using namespace std;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    if(s[0]!=s[1] && s[1]!=s[2] && s[2]!=s[3]) cout << "Good";
    else cout << "Bad";
}


Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func main() {
	sc := newScanner()
	N := sc.nextInt()
	K := sc.nextUint64()
	masks := make([]uint64, 0)
	masks = append(masks, K)

	var i uint
	for i = 30; i >= 0; i-- {
		if (1<<i)&K != 0 {
			mask := K &^ (1 << i)
			mask = mask | (1<<i - 1)
			masks = append(masks, mask)
		}
		if i == 0 {
			break
		}
	}
	// for _, m := range masks {
	// 	fmt.Printf("%b \n", m)
	// }
	anss := make([]uint64, len(masks))
	for i := 0; i < N; i++ {
		// fmt.Scan(&a, &b)
		a := sc.nextUint64()
		b := sc.nextUint64()
		for idx, m := range masks {
			if m|a == m {
				anss[idx] += b
			}
		}
	}
	var ans uint64
	for _, a := range anss {
		if a > ans {
			ans = a
		}
	}
	fmt.Println(ans)
}

type scanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func newScanner() *scanner {
	rdr := bufio.NewReaderSize(os.Stdin, 10000)
	return &scanner{r: rdr}
}
func (s *scanner) next() string {
	s.pre()
	start := s.p
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			break
		}
	}
	result := string(s.buf[start:s.p])
	s.p++
	return result
}
func (s *scanner) nextLine() string {
	s.pre()
	start := s.p
	s.p = len(s.buf)
	return string(s.buf[start:])
}
func (s *scanner) nextInt() int {
	v, _ := strconv.Atoi(s.next())
	return v
}
func (s *scanner) nextUint64() uint64 {
	v, _ := strconv.ParseUint(s.next(), 10, 64)
	return v
}
func (s *scanner) pre() {
	if s.p >= len(s.buf) {
		s.readLine()
		s.p = 0
	}
}
func (s *scanner) readLine() {
	s.buf = make([]byte, 0)
	for {
		l, p, e := s.r.ReadLine()
		if e != nil {
			panic(e)
		}
		s.buf = append(s.buf, l...)
		if !p {
			break
		}
	}
}


Measured memory_bytes: 6528
#include<iostream>
#include<string>
#include<cstdlib>
#define MAX 100000
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;

class Queue{
private:
  int inf[MAX];
  int head,tail;

public:

  Queue(){
    syokika();
  }

  void syokika(){
    head = 0;
    tail = 0;
  }

  void push(int x){
    inf[tail]=x;
    if(MAX == tail+1)tail = 0;
    else tail++;
  }

  void pop(){
    if(MAX == head+1)head=0;
    else head++;
  }

  int front(){
    return inf[head];
  }

  bool empty(){
    if(tail - head == 0)return true;
    else return false;
  }

  int size(){
    return tail - head;
  }

};


int main()
{
  Queue que;
  int n,q,a;
  string s[MAX];
  int st[MAX];

  cin >> n >> q;

  rep(i,n)st[i]=0;

  rep(i,n)
    {
      cin >> s[i] >> a;    
      que.push(a);
    }
  int index = 0,flag = n,nowval,val=0;
  bool finished[n],end=true;
  rep(i,n)finished[i]=false;

  while(true){
    rep(i,n){
      if(!finished[i])
	{
	  end = false;
	  break;
	}
    }
    if(end)break;
    end = true;

    if(index == n)index = 0;    

    if(finished[index])
      {
	index++;
	continue;
      }

    nowval = que.front();      
    

    if(nowval-q<=0)
      {
	que.pop();
	val+=nowval;
	st[index]=val;
	flag--;
	finished[index]=true;
	cout  <<  s[index] << " " << st[index] << endl;
      }
    else
      {
	que.pop();  
	que.push(nowval-q);
	val+=q;
	st[index]=val;
      }

    
    index++;
  }



}

Measured memory_bytes: 0
#include<iostream>
#include<algorithm>
#include<numeric>
#include<string>
using namespace std;

int pn[1000000] = { 1, 1, 0 };

int main(){
	for (int i = 2; i < 1000000; i++){
		if (pn[i] == 1) continue;
		for (int j = i * 2; j < 1000000; j += i){
			pn[j] = 1;
		}
	}
	
	int n;

	while (cin >> n){
		int c = 0; 
		for (int i = 0; i <= n; i++){
			if (pn[i] == 0)
				c++;
		}
		cout << c << endl;
	}
	return 0;
}

Measured memory_bytes: 5064
import java.util.Arrays;
import java.util.LinkedList;
import java.util.Queue;
import java.util.Scanner;

public class Main {
	static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {
		int N = sc.nextInt();
		int M = sc.nextInt();
		int[][] g = new int[N * 2 + 1][N * 2 + 1];
		for (int i = 0; i < N; ++i) {
			g[i + N][i] = 1;
		}
		MaxFlow mf = new MaxFlow(N * 2 + 1);
		for (int i = 0; i < M; ++i) {
			int A = sc.nextInt() - 1;
			int B = sc.nextInt() - 1;
			g[A][N * 2] = g[B][N * 2] = 1;
			mf.set(g);
			System.out.println(mf.calc(0, N * 2) >= 2 ? "Yes" : "No");
			g[A][N * 2] = g[B][N * 2] = 0;
			g[A][B + N] = g[B][A + N] = 1;
		}
	}

	static class MaxFlow {

		int[][] g;
		int[][] res;

		MaxFlow(int size) {
			g = new int[size][size];
			res = new int[size][size];
		}

		void set(int[][] g) {
			for (int i = 0; i < g.length; ++i) {
				for (int j = 0; j < g.length; ++j) {
					g[i][j] = res[i][j] = g[i][j];
				}
			}
		}

		MaxFlow(int[][] g) {
			this.g = g;
			this.res = new int[g.length][];
			for (int i = 0; i < g.length; ++i) {
				this.res[i] = g[i].clone();
			}
		}

		int calc(int src, int sink) {
			int result = 0;
			int[] prev = new int[g.length];
			while (true) {
				Arrays.fill(prev, -1);
				boolean[] visited = new boolean[g.length];
				Queue<Integer> q = new LinkedList<Integer>();
				q.add(src);
				visited[src] = true;
				OUT: while (!q.isEmpty()) {
					int cur = q.poll();
					for (int i = 0; i < g.length; ++i) {
						if (!visited[i] && res[cur][i] > 0) {
							prev[i] = cur;
							visited[i] = true;
							if (i == sink) {
								break OUT;
							}
							q.add(i);
						}
					}
				}
				if (!visited[sink]) {
					break;
				}
				int pos = sink;
				int pathCap = Integer.MAX_VALUE;
				while (pos != src) {
					int p = prev[pos];
					pathCap = Math.min(pathCap, res[p][pos]);
					pos = p;
				}
				pos = sink;
				while (pos != src) {
					int p = prev[pos];
					res[p][pos] -= pathCap;
					res[pos][p] += pathCap;
					pos = p;
				}
				result += pathCap;
			}
			return result;
		}
	}

}

Measured memory_bytes: 60444
A,B,m=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
ans=min(a)+min(b)
for i in range(m):
  x,y,c=map(int,input().split())
  ans=min(ans,a[x-1]+b[y-1]-c)
print(ans)

Measured memory_bytes: 70892
#include<bits/stdc++.h>
#define pb push_back
using namespace std;

int main(){
 int q;
 cin >> q;
 int a,b;
 vector<int> v;
 while(q--){
    cin >> a >> b;
    v.pb(a-b);
 }
 int cnt = 0;
 bool f = 0;
 for(int i=0;i<v.size();i++){
    if(v[i]==0)
        cnt++;
    else
        cnt = 0;

    if(cnt >= 3){
        f = 1;
        break;
    }
 }
 f == 1? cout << "Yes" : cout << "No";
 return 0;
}


Measured memory_bytes: 3604
#include <iostream>
using namespace std;
int main(void){
    for (int h = 0; h < 10000; h++){
        int n, x;
        cin >> n >> x;
        if (n == 0 && x ==0)
            break;
        int an = 0;
        for (int i = 1; i <=  n - 2; i++){
            for (int j = i + 1; j <= n -1; j++){
                for (int k = j + 1; k <= n; k++){
                    if (i + j + k == x)
                        an++;
                }
            }
        }
        cout << an <<endl;
    }
}



Measured memory_bytes: 3076
#include <bits/stdc++.h>
using namespace std;
#define int long long int
#define endl "\n"
const int MOD=1e9+7;
#ifndef HOME
#define cerr if(0)cerr
#endif

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin>>n;
    vector<pair<int,int>>v;
    for(int i=0;i<n;i++){
        int a,b;
        cin>>a>>b;
        v.push_back({b,a});
    }
    int time = 0;
    sort(v.begin(),v.end());
    for(int i=0;i<n;i++){
        if(time+v[i].second>v[i].first){
            cout<<"No"<<endl;
            return 0;
        }
        time = time+v[i].second;
    }
    cout<<"Yes"<<endl;
    return 0;
    
}


Measured memory_bytes: 6512
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include<numeric>
#include<cmath>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll,ll> pll;
const ll inf = 1LL << 60;
const int upper = 100000;

bool is_prime(int N){ //Nは奇数
bool flag = true; //false: 素数じゃない
    for(int k = 3; k*k <= N; k+=2){
        if(N % k == 0){
            flag = false; break;
        }
    }
    return flag;
}

int main(){
    cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	//cout << fixed << setprecision(15);
    vector<bool> like(upper+1,false);
    like[3] = true;
    like[5] = true;
    vector<int> ruiseki(upper+1);
    for(int k = 1; 4*k + 1 < upper; k++){
        if(is_prime(4*k+1) && is_prime(2*k+1)){
            like[4*k+1] = true;
        }
    }
    int now = 0;
    REP(i,upper+1){
        if(like[i])now++;
        ruiseki[i] = now;
    }
    vector<int> ans;
    int Q; cin>>Q;
    REP(i,Q){
        int l,r;
        cin>>l>>r;
        ans.push_back(ruiseki[r] - ruiseki[l-1]);
    }
    REP(i,ans.size()){
        cout << ans[i] << endl;
    }
}

Measured memory_bytes: 1528
#ifdef LOCAL
#include <cstdio>
#include <vector>
#include <algorithm>
#include <iostream>
#include <cstring>
#else
#include <bits/stdc++.h>
#endif
using namespace std ;

typedef long long ll ;
#define rep(i , n ) for ( int i =0; i < n ; i++)
#define _sort(arg) sort(begin(arg), end(arg))
#define MOD 1000000007
#define pb push_back
#define DEBUG(x) cout << #x << ": " << x << endl;

/*
__attribute__((constructor))
void initial()
{
	cin.tie(NULL);
	ios::sync_with_stdio(false);
}
*/

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

	ll N;
	
	cin >> N;

	ll a[N];
	ll sum[N];

	memset(sum, 0, sizeof(sum));

	rep(i, N)
	{
		cin >> a[i];
		if (i > 0)
		{
			sum[i] = sum[i - 1] + a[i]; 
		}
		else
		{
			sum[i] = a[0];
		}
		
	}

	ll min = INT_MAX;

	rep(i, N-1)
	{
		ll tmp = abs(sum[i] - (sum[N-1] - sum[i]));
		if (tmp < min)
		{
			min = tmp;
		}
	}

	cout << min << endl;

	
	return 0;
}


Measured memory_bytes: 3328
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <utility>
#define FR first
#define SE second

using namespace std;

typedef pair<int,int> pr;

struct Edge {
  int t,next;
  Edge() {}
  Edge(int a,int b):t(a),next(b) {} 
};

Edge e[200005];
int head[100005];

pr can[100005];

inline pr merge(pr x,pr y) {
  return pr(max(x.FR,y.FR),min(x.SE,y.SE));
}

inline bool in(int x,pr y) {
  return x>=y.FR&&x<=y.SE&&(x%2==y.FR%2);
}

bool fir[100005];
int ans[100005];

void print(int x,int fa) {
  if (in(ans[fa]-1,can[x])) ans[x]=ans[fa]-1; else ans[x]=ans[fa]+1;
  for(int i=head[x];i;i=e[i].next)
    if (e[i].t!=fa&&!fir[e[i].t]) print(e[i].t,x);
}

bool dfs(int x,int fa) {
  if (fir[x]) {
  	can[x]=pr(ans[x],ans[x]);
  	for(int i=head[x];i;i=e[i].next)
  	  if (e[i].t!=fa) {
  	  	  int u=e[i].t;
  	  	  if (fir[u]) {
  	  	  	  if (abs(ans[x]-ans[u])!=1) return 0;
  	  	  	  if (!dfs(u,x)) return 0;
		    }
		  else {
  	  	      can[u]=pr(ans[x]-1,ans[x]+1);
  	  	      if (!dfs(u,x)) return 0;
  	  	      print(u,x);
  	  	  }
		}
	return 1;
  }
  else {
  	for(int i=head[x];i;i=e[i].next)
  	  if (e[i].t!=fa) {
  	  	  int u=e[i].t;
  	  	  if (fir[u]) {
  	  	  	    can[x]=merge(pr(ans[u]-1,ans[u]+1),can[x]);
  	  	  	    if (!dfs(u,x)) return 0;
			  }
		  else {
		  	  can[u]=pr(can[x].FR-1,can[x].SE+1);
  	  	      if (!dfs(u,x)) return 0;
  	  	      can[x]=merge(pr(can[u].FR-1,can[u].SE+1),can[x]);
  	  	  }
		}
	return can[x].FR<=can[x].SE;
  }
}

int main() {
  int n;
  scanf("%d",&n);
  for(int i=1;i<n;i++) {
  	int x,y;
  	scanf("%d%d",&x,&y);
  	e[2*i-1]=Edge(y,head[x]);
  	head[x]=2*i-1;
  	e[2*i]=Edge(x,head[y]);
  	head[y]=2*i;
  }
  int m;
  scanf("%d",&m);
  int rt=0;
  for(int i=1;i<=m;i++) {
  	int x;
  	scanf("%d%d",&rt,&x);
  	fir[rt]=1;ans[rt]=x;
  }
  if (dfs(rt,0)) {
  	puts("Yes");
  	for(int i=1;i<=n;i++) printf("%d\n",ans[i]);
  }
  else puts("No");
  return 0;
}

Measured memory_bytes: 10368
#include <iostream>
using namespace std;
 
int main() {
  long int a, b, k;
  
  cin >> a >> b >> k;

if (a>=k){cout << a-k <<" " << b << endl;}
else if (a+b>=k){cout << 0 <<" " << a+b-k << endl;}
 else cout << 0 <<" " << 0 <<endl;}

Measured memory_bytes: 256
// #define DEBUGGING
#include <bits/stdc++.h>
#define endl '\n'
#define ALL(V) (V).begin(), (V).end()
#define ALLR(V) (V).rbegin(), (V).rend()
using ll = std::int64_t;
using ull = std::uint64_t;
using PLL = std::pair<ll, ll>;
using TLL = std::tuple<ll, ll, ll>;
template <typename T> using V = std::vector<T>;
template <typename T> using VV = V<V<T>>;
template <typename T> const T& var_min(const T &t) { return t; }
template <typename T> const T& var_max(const T &t) { return t; }
template <typename T, typename... Tail> const T& var_min(const T &t, const Tail&... tail) { return std::min(t, var_min(tail...)); }
template <typename T, typename... Tail> const T& var_max(const T &t, const Tail&... tail) { return std::max(t, var_max(tail...)); }
template <typename T, typename... Tail> void chmin(T &t, const Tail&... tail) { t = var_min(t, tail...); }
template <typename T, typename... Tail> void chmax(T &t, const Tail&... tail) { t = var_max(t, tail...); }
template <typename T> const T& clamp(const T &t, const T &low, const T &high) { return std::max(low, std::min(high, t)); }
template <typename T> void chclamp(T &t, const T &low, const T &high) { return t = clamp(t, low, high); }
namespace init__ { struct InitIO { InitIO() { std::cin.tie(nullptr); std::ios_base::sync_with_stdio(false); std::cout << std::fixed << std::setprecision(30); } } init_io; }
#define mv_rec make_v(init, tail...)
template <typename T> T make_v(T init) { return init; }
template <typename T, typename... Tail> auto make_v(T init, size_t s, Tail... tail) { return V<decltype(mv_rec)>(s, mv_rec); }
#undef mv_rec
using namespace std;

#ifdef DEBUGGING
#include "../../debug/debug.cpp"
#else
#define DEBUG(...) 0
#define DEBUG_SEPARATOR_LINE 0
#endif

template <ll MOD>
class Combination {
    ll N;
    V<ll> factv, ifactv;

public:
    Combination<MOD>(ll N) : N(N), factv(N + 1, 1), ifactv(N + 1) {
        for(ll i = 1; i <= N; i++) factv[i] = factv[i - 1] * i % MOD;
        ifactv.back() = inv(factv.back());
        for(ll i = N - 1; 0 <= i; i--) ifactv[i] = (i + 1) * ifactv[i + 1] % MOD;
    }

    ll fact(ll n) { return factv[n]; }

    ll ifact(ll n) { return ifactv[n]; }

    ll pow(ll a, ll b) { return b ? (b & 1 ? a : 1) * pow(a * a % MOD, b / 2) % MOD : 1; }

    ll inv(ll a) { return pow(a, MOD - 2); }

    ll comb(ll n, ll k) { 
        if (n < k) return 0;
        return factv[n] * ifactv[n - k] % MOD * ifactv[k] % MOD; 
    }
};

const ll mod = 1e9 + 7;
Combination<mod> C(1e6 + 10);

ll solve() {
    ll N;
    cin >> N;

    if (N == 2) return 1;
    if (N == 3) return 4;
    if (N == 4) return 16;
    ll ans = 0;
    ll psum = 0;
    for (ll i = 3; i < N; i++) {
        ll rest = N - 1 - i;
        ll perm = C.fact(i) * C.fact(rest) % mod;
        perm = perm * C.comb(i - 1, rest) % mod;
        ans += i * (perm - psum + mod) % mod;
        psum = perm;
    }

    return ans % mod;
}

int main() {
    cout << solve() << endl;
    return 0;
}


Measured memory_bytes: 15872
N,K=map(int,input().split())
A=set(map(int,input().split()))
NO='IMPOSSIBLE'
YES='POSSIBLE'

max_A=max(A)
if K>max_A:
    print(NO)
    exit()

if K in A:
    print(YES)
    exit()

def gcd(a,b):
    r=a%b
    while r:
        a=b
        b=r
        r=a%b
    return b

GCD=0
for n in A:
    GCD=gcd(GCD,n)

if GCD==1 or K%GCD==0:
    print(YES)
else:
    print(NO)

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

#define rep(i, n) for(int i=0; i<n; ++i)
#define repit(it, li) for(auto it=li.begin(); it!=li.end(); it++)
#define ll long long int

int main(){
    int n, k;
    cin>>n>>k;
    ll tot=0;
    for(int i=k; i<=n+1; i++){
        ll m=(ll)(n+1-i)*i+1;
        tot+=m;
        tot=tot%1000000007;
    }
    cout << tot << endl;
    return 0;
}


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

int main(){
    int n;
    cin >> n;
    double t, a, mi = 1e9;
    cin >> t >> a;
    int ans = 0;
    for(int i = 0; i < n; i++){
        double h;
        cin >> h;
        double tmp = fabs(a - (t - h * 0.006));
        if(tmp < mi){
            mi = tmp;
            ans = i;
        }
    }
    cout << ans + 1 << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>                                          
#include <cstdio>                                            
#include <cmath>                                             
#define MATH_USE_DEFINES                                     
using namespace std;                                         
                                                             
int main() {                                                 
  double r;                                                  
  cin >> r;                                                  
  double S = M_PI*pow(r,2);                                  
  double R = 2*M_PI*r;                                       
  printf("%.6f %.6f\n", S, R);                               
  return 0;                                                  
}                                                            
                                                             
                  

Measured memory_bytes: 3208
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<iomanip>
#include<set>
#include<queue>

using namespace std;

int main()
{
	int a;
	string s;
	cin >> a >> s;
	cout << (a>=3200 ? s:"red") << endl;




}

Measured memory_bytes: 256
#include <bits/stdc++.h>
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; }

using ll = long long;
using P = pair<ll,ll>;
using graph = vector<vector<int>>;

const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const ll INF = 1LL<<60;
const ll mod = 998244353LL;

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

int main() {
  char c;
  cin>>c;
  if(c-'a'<26&&c-'a'>=0) cout<<'a'<<endl;
  else cout<<'A'<<endl;
}

Measured memory_bytes: 3604