akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <queue>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)n;++i)
typedef pair<int,int> pii;
typedef long long ll;

int di[100000];
int hi[100000];
ll damage[100001];

int main() {
  int N,H;
  scanf("%d%d",&N,&H);
  REP(i,N-1) scanf("%d%d",di+i,hi+i);
  priority_queue<pii> Q;
  ll ans = 0;
  ll totalHeal = 0;
  int maxid = 0;
  REP(i,N-1) {
    Q.push(pii(hi[i],i));
    damage[i+1] = damage[i] + di[i];
    ll now = H + totalHeal - damage[i+1];
    while(now <= 0) {
      pii p = Q.top(); Q.pop();
      int heal = p.first;
      int id = p.second;

      if (id < maxid) continue;
      maxid = id;
      ll tdamage = damage[id]-totalHeal;
      if (tdamage < heal) {
        Q.push(pii(tdamage,id));
        continue;
      }
      ll num = min((0-now)/heal+1, tdamage/heal);
      totalHeal += num*heal;
      now += num*heal;
      ans += num;
      Q.push(p);
    }
  }
  printf("%lld\n",ans);
}

Measured memory_bytes: 2852
#include <bits/stdc++.h>
//#include <atcoder/all>
using namespace std;
//using namespace atcoder;
using ll = long long;
using ld = long double;

#define fi first
#define se second
#define m_p make_pair
#define p_b push_back
#define e_b emplace_back
#define all(x) (x).begin(),(x).end()
#define uniq(x) ((x).erase(unique(all(x)),(x).end()))
#define sz(x) ((int)(x).size())

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

#ifdef LOCAL//compile with -DLOCAL
#define debug(x) cerr<<"LINE"<<__LINE__<<" : "<<#x<<" = "<<(x)<<endl
#define debug_vec(x) cerr<<"LINE"<<__LINE__<<" : "<<#x<<" = ";\
  rep(i,sz(x)){cerr<<x[i]<<" ";}cerr<<endl
#define debug_mat(x) cerr<<"LINE"<<__LINE__<<" : "<<#x<<" = "<<endl;\
  rep(i,sz(x)){rep(j,sz(x[i])){cerr<<x[i][j]<<" ";}cerr<<endl;}cerr<<endl
#else
#define debug(x) void(0)
#define debug_vec(x) void(0)
#define debug_mat(x) void(0)
#endif

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


int main(){
  ios_base::sync_with_stdio(false);cin.tie(0);
  ll N,X,M;
  cin >> N >> X >> M;

  vector<int> id(M,-1);
  vector<int> A;
  int len = 0;
  ll total = 0;
  while(id.at(X) == -1){
    A.p_b(X);
    id.at(X) = len;
    len++;
    total += X;
    X = X * X % M;
  }

  int cycle_size = len - id.at(X);
  ll cycle_sum = 0;
  for(int i = id.at(X); i < len; i++) cycle_sum += A.at(i);

  ll ans = 0;
  if(N <= len){
    rep(i,N)  ans += A.at(i);
  }
  else{
    ans += total;
    N -= len;
    ans += cycle_sum * (N/cycle_size);
    N %= cycle_size;
    rep(i,N)  ans += A.at(id.at(X)+i);
  }
  cout << ans << endl;

  return 0;
}

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

#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n - 1; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i <= n; i++)
#define FORR(i, m, n) for(int i = m; i >= n; i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define VSORTR(v) sort(v.rbegin(), v.rend());
#define ALL(v) (v).begin(),(v).end()

using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll, ll>;

const ll mod = 1e9+7;


ll dp[100010][13];
int main(){
	
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);


    string s;cin>>s;
    dp[0][0]=1;
    FOR(i,1,s.size()){
        if(s[i-1]=='?'){
            REP(j,10){
                REP(k,13){
                    dp[i][(k*10+j)%13]+=dp[i-1][k];
                    dp[i][(k*10+j)%13]%=mod;
                }
            }
        }
        else{
            int num=s[i-1]-'0';
            REP(j, 13){
                dp[i][(j*10+num)%13]+=dp[i-1][j];
                dp[i][(j*10+num)%13]%=mod;
            }
        }
    }
    cout<<dp[s.size()][5]<<endl;
    
    
    return 0;
}

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

int main(){
	string a,b;
	int c=0;
	cin>>a;
	for(int i=0;i<a.length();i++){
		if('A'<=a[i]&&a[i]<='Z')a[i]=a[i]-'A'+'a';
	}
	for(int j=0;;j++){
		cin>>b;
		if(b=="END_OF_TEXT")break;
		for(int k=0;k<b.length();k++){
			if('A'<=b[k]&&b[k]<='Z')b[k]=b[k]-'A'+'a';
		}
		if(a==b)c++;
	}
	cout << c<<endl;
	return 0;
}

Measured memory_bytes: 3164
#include<bits/stdc++.h>
using namespace std;
int main() {
  int a,b;
  string c;
  char d,e;
  cin >> a;
    cin >> c;
  cin >> b;
  d = c[b-1];
  for (int i=0; i<a; i++) {
    e = c[i];
    if (e != d) {
      c[i] = '*';
    }
  }
  cout << c << endl;
}
 
  


Measured memory_bytes: 256
import random

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

S = A[0]+A[1]
X = 0
for a in A[2:]:
  X ^= a

D = (S-X)>>1
if S!=X+(D<<1) or D>A[0] or (X&D)!=0:
  print(-1)
  exit(0)

a = 0
b = 2**64
while b>0:
  if (D&b)!=0:
    a |= b
  elif (X&b)!=0:
    if (a|b|D&(b-1))<=A[0]:
      a |= b
  b >>= 1
if a==0:
  print(-1)
  exit(0)
print(A[0]-a)


Measured memory_bytes: 9468
N = int(input())
As = [int(input()) for _ in range(N)]
sorted_As = sorted(As, reverse=True)

m = sorted_As[0]
l = sorted_As[1]

res = [m] * N
if l != m:
    ind = As.index(m)
    res[ind] = l

print(" ".join(list(map(str, res))))


Measured memory_bytes: 28944
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<iomanip>
using namespace std;

int main(){
    int a,b,k;
    cin>>a>>b>>k;
    if(a>b)swap(a,b);
    int cnt=0;
    int end=0;
    int ans;
    int n[100];
    for(int i=1;i<=a;i++){
        if(a%i==0&&b%i==0){
            cnt++;
            n[cnt]=i;
        }
    }
    cout<<n[cnt-k+1]<<endl;
    return 0;
}

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

#define ll long long
#define vl vector<ll>
#define vvl vector<vl >
#define pl pair<ll,ll>
#define vpl vector<pl >
#define vvpl vector<vp >
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define wt ll tc; cin>>tc; while(tc--)
#define ft ll tc,ti; cin>>tc; for(ti=1;ti<=tc;ti++)
#define fd(c,element) ((c).find(element)!=(c).end())
#define fdv(c,element) (find(all(c),element)!=(c).end())
#define fio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define pb push_back
#define mp make_pair

int main() {
    fio;
    ll i,j,a,b;
    cin>>a>>b;
    cout<<max(a+b,max(2*a-1,2*b-1));
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<climits>
#include<iostream>
#include<sstream>
#include<utility>
#include<map>
#include<vector>
#include<queue>
#include<algorithm>
#include<set>
#include<stack>
#include<functional>
using namespace std;
typedef long long ll;
typedef pair<int,int>P;
typedef tuple<ll,ll,ll>T;
vector<T>K;
tuple<ll,ll,ll>DP[100][100];
int N,M;
ll res=0;

ll ch(multimap<ll,T,greater<ll> > X)
{
	int c=0;
	ll x=0,y=0,z=0;
	for(auto i:X)
	{
		if(c>=M)break;
		x+=get<0>(i.second);
		y+=get<1>(i.second);
		z+=get<2>(i.second);
		c++;
	}
	return abs(x)+abs(y)+abs(z);
}


int main()
{
	multimap<ll,T,greater<ll> > X[8];
	ll x,y,z;
	cin>>N>>M;
	for(int i=0;i<N;i++)
	{
		cin>>x>>y>>z;
		K.push_back(make_tuple(x,y,z));
		X[0].insert(make_pair(x+y+z,make_tuple(x,y,z)));
		X[1].insert(make_pair(x+y-z,make_tuple(x,y,z)));
		X[2].insert(make_pair(x-y+z,make_tuple(x,y,z)));
		X[3].insert(make_pair(x-y-z,make_tuple(x,y,z)));
		X[4].insert(make_pair(-x+y+z,make_tuple(x,y,z)));
		X[5].insert(make_pair(-x+y-z,make_tuple(x,y,z)));
		X[6].insert(make_pair(-x-y+z,make_tuple(x,y,z)));
		X[7].insert(make_pair(-x-y-z,make_tuple(x,y,z)));
	}
	for(int i=0;i<8;i++)res=max(res,ch(X[i]));
	cout<<res<<endl;
}


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

int main(){
  int N;
  cin>>N;
 
  int64_t A[N];
  for(int i=0;i<N;i++){
    cin>>A[i];
  }
  
  int64_t ans=0;
  
  for(int i=0;i<N-1;i++){
    if(A[i]>A[i+1]){
      ans+=A[i]-A[i+1];
      A[i+1]+=A[i]-A[i+1];
    }
  }
  
  cout<<ans;
}

Measured memory_bytes: 5136
import sys
sys.setrecursionlimit(10**6)
from math import floor,ceil,sqrt,factorial,log
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from operator import itemgetter
from fractions import gcd
mod = 10 ** 9 + 7
inf = float('inf')
ninf = -float('inf')
 
#整数input
def ii(): return int(sys.stdin.readline().rstrip()) #int(input())
def mii(): return map(int,sys.stdin.readline().rstrip().split())
def limii(): return list(mii()) #list(map(int,input().split()))
def lin(n:int): return [ii() for _ in range(n)]
def llint(n: int): return [limii() for _ in range(n)]
#文字列input
def ss(): return sys.stdin.readline().rstrip() #input()
def mss(): return sys.stdin.readline().rstrip().split()
def limss(): return list(mss()) #list(input().split())
def lst(n:int): return [ss() for _ in range(n)]
def llstr(n: int): return [limss() for _ in range(n)]

#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？

h,w=mii()
n=ii()
arr=limii()

mat=[[0]*w for _ in range(h)]
temp=0
for i in range(h):

    if i%2==0:
        for j in range(w):
            mat[i][j]=temp+1
            arr[temp]-=1
            if arr[temp]==0:
                temp+=1
    if i%2==1:    
        for j in reversed(list(range(w))):
            mat[i][j]=temp+1
            arr[temp]-=1
            if arr[temp]==0:
                temp+=1

for i in range(h):
    print(*mat[i])


Measured memory_bytes: 67052
N = gets.to_i
as = N.times.map{gets.strip.codepoints.sort!}
h=Hash.new
cnt=0
for i in 0...N
  if h[as[i]].nil?
    h[as[i]]=0
  else
    h[as[i]]+=1
  end
  cnt+=h[as[i]]
end
puts cnt


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

int main() {
  int H, W;
  cin >> H >> W;
  vector<vector<char>> S(H, vector<char>(W));
  for (int i = 0; i < H; i++)
    for (int j = 0; j < W; j++) cin >> S.at(i).at(j);

  vector<vector<int>> dist(H, vector<int>(W, -1));
  dist.at(0).at(0) = 1;
  vector<int> mx(4), my(4);
  mx = {1, 0, -1, 0};
  my = {0, 1, 0, -1};
  queue<pair<int, int>> Q;
  Q.push({0, 0});
  while (Q.size()) {
    int x = Q.front().first;
    int y = Q.front().second;
    Q.pop();
    for (int i = 0; i < 4; i++) {
      int nx = x + mx.at(i);
      int ny = y + my.at(i);
      if (nx < 0 || nx >= H || ny < 0 || ny >= W) continue;
      if (S.at(nx).at(ny) == '#') continue;
      if (dist.at(nx).at(ny) == -1) {
        dist.at(nx).at(ny) = dist.at(x).at(y) + 1;
        Q.push({nx, ny});
      }
    }
  }
  
  if (dist.at(H - 1).at(W - 1) == -1) return cout << -1 << "\n", 0;

  int cnt = 0;
  for (int i = 0; i < H; i++)
    for (int j = 0; j < W; j++)
      if (S.at(i).at(j) == '.') cnt++;
  cout << cnt - dist.at(H - 1).at(W - 1) << "\n";
}

Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using Console = System.Console;

namespace Atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var R = int.Parse(Console.ReadLine());
            var G = int.Parse(Console.ReadLine());
            Console.WriteLine(2 * G - R);
        }
        
    }
}

Measured memory_bytes: 13140
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip> 
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <numeric>
#pragma warning(disable:4996)

using namespace std;



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

	long long n, k, s1, s2, ans, i, j, kk;;
	cin >> n >> kk;
	ans = 0;
	for (k = kk; k <= n + 1; k++) {
		s1 = (n + n - k + 1) * k / 2;
		s2 = k * (k - 1) / 2;
		ans = (ans + s1 + 1 - s2) % 1000000007;
	}
	cout << ans << "\n";

	return 0;
}


Measured memory_bytes: 3664
# include <bits/stdc++.h>
 
/*
// ordered_set 
# include <ext/pb_ds/assoc_container.hpp>
# include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
# define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
*/
 
using namespace std;
 
typedef long long                                        ll;
typedef long double                                      ld;
typedef pair <int, int>                                  pii;
typedef pair <pii, int>                                  ppi;
typedef pair <int, pii>                                  pip;
typedef pair <pii, pii>                                  ppp;
typedef pair <ll, ll>                                    pll;
 
# define A                                               first
# define B                                               second
# define endl                                            '\n'
# define sep                                             ' '
# define all(x)                                          x.begin(), x.end()
# define kill(x)                                         return cout << x << endl, 0
# define SZ(x)                                           int(x.size())
# define Sort(x)                                         sort(all(x))
# define InTheNameOfGod                                  ios::sync_with_stdio(0);cin.tie(0); cout.tie(0);
 
ll power(ll a, ll b, ll md) {return (!b ? 1 : (b & 1 ? a * power(a * a % md, b / 2, md) % md : power(a * a % md, b / 2, md) % md));}
 
const int xn = 5e3 + 10;
const int xm = - 20 + 10;
const int SQ = 320;
const int sq = 320 + 10;
const int inf = 1e9 + 10;
const ll INF = 1e18 + 10;
const int MOD = 1e9 + 7;
const int TM = 3;
const int BASE = 257;

int n, a[xn], part[xn], m, dp[xn][xn], res;
string s;

int main(){
    InTheNameOfGod;
    
	cin >> n >> m >> s;
	for (int i = 1; i <= n; ++ i) a[i] = i;
	while (m --){
		int l, r;
		cin >> l >> r;
		a[l] = max(a[l], r);
	}
	for (int i = 1; i <= n; ++ i) part[i] = part[i - 1] + (s[i - 1] - '0');
	dp[0][0] = 1;
	for (int i = 1; i <= n; ++ i){
		res = max(res, a[i]);
		for (int j = max(0, i - res + part[res]); j <= part[res]; ++ j){
			dp[i][j] = dp[i - 1][j];
			if (j) dp[i][j] = (dp[i][j] + dp[i - 1][j - 1]) % MOD;
		}
	}
	cout << dp[n][part[n]] << endl;

    return 0;
}


Measured memory_bytes: 15996
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<int,ll> pil;
typedef pair<ll,int> pli;
#define rep(i,n) for (int i=0;i<(n);++i)
#define REP(i,n) for (int i=1;i<=(n);++i)
#define all(x) x.begin(),x.end()
#define mp make_pair
#define pb push_back
#define F first
#define S second
#define read(x) scanf("%d",&x)
int n,m;
char s[105][105];
int a[105][105];
int dp[105][105][2];
const int INF=1e8;
int main(){
	ios::sync_with_stdio(false);
	cin>>n>>m;
	REP(i,n) cin>>s[i]+1;
	REP(i,n) REP(j,m) a[i][j]=(s[i][j]=='.');
	REP(i,n) REP(j,m) dp[i][j][0]=dp[i][j][1]=INF;
	dp[1][1][a[1][1]^1]=a[1][1]^1;
	REP(i,n) REP(j,m){
		int k=!a[i][j];
		if (a[i][j+1]^k) dp[i][j+1][k]=min(dp[i][j+1][k],dp[i][j][k]);
		else dp[i][j+1][k^1]=min(dp[i][j+1][k^1],dp[i][j][k]+(k^1));
		if (a[i+1][j]^k) dp[i+1][j][k]=min(dp[i+1][j][k],dp[i][j][k]);
		else dp[i+1][j][k^1]=min(dp[i+1][j][k^1],dp[i][j][k]+(k^1));
	}
	cout<<dp[n][m][a[n][m]^1];
	return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define Phuong_ ios_base::sync_with_stdio(0); cin.tie(0);
#define REP(i,a,b) for(int i=a; i<=b; ++i)

/// easy access -------------
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
typedef pair<int,int> pi;
typedef tuple<int, int, int> tp;
typedef vector<vector<int>> vv;
///-------------------------

int main()
{
    Phuong_; /// <3333
    string s;
    cin >> s;
    int sum=0;
    for(char c:s){
        sum+=(int) c-'0';
    }
    if(sum%9==0) cout << " Yes"; else cout << "No";
    return 0;
}


Measured memory_bytes: 3724
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1000000007;
int main()
{
    ll d,t,s;
    cin >> d >> t >> s;
    if(t * s >= d)
    {
        cout << "Yes\n";
    }
    else
    {
        cout << "No\n";
    }
    
    return 0;
}

Measured memory_bytes: 3560
import sys
n=int(input())
t=list(map(int,input().split()))
a=list(map(int,input().split()))
ans=1
mod=10**9+7
if n==1:
  if t[0]==a[0]:
    print(1)
  else:
    print(0)
  sys.exit()
for i in range(n):
  if i==0:
    if a[i]>a[i+1]:
      if a[i]==t[i]:
        ans*=1
      else:
        ans*=0
    else:
      ans*=1
  elif i==n-1:
    if t[i-1]<t[i]:
      if a[i]==t[i]:
        ans*=1
      else:
        ans*=0
    else:
      ans*=1
  else:
    if t[i-1]<t[i] and a[i]==a[i+1]:
      if a[i]>=t[i]:
        ans*=1
      else:
        ans*=0
    elif t[i-1]==t[i] and a[i]>a[i+1]:
      if a[i]<=t[i]:
        ans*=1
      else:
        ans*=0
    elif t[i-1]<t[i] and a[i]>a[i+1]:
      if a[i]==t[i]:
        ans*=1
      else:
        ans*=0
    else:
      ans*=min(a[i],t[i])
  ans%=mod
print(ans)

Measured memory_bytes: 18540
#include<bits/stdc++.h>
#define cs const
#define pb push_back
using namespace std;
cs int N = 5e3 + 50;
int Mod, n, dp[N];
void Add(int &a, int b){ a = a + b >= Mod ? a + b - Mod : a + b; }
int main(){
	scanf("%d%d",&n,&Mod);
	if(n == 1) return puts("1"), 0;
	if(n == 2) return puts("3"), 0;
	int t = n / 2 + 1; dp[0] = 1;
	for(int i=2, c; i<=n; i++){
		c = (i <= t) ? i - 1 : n - i + 2;
		for(int j=0; j+c<=n; j++)
		Add(dp[j+c], dp[j]);
	} int ans = 0;
	for(int i = 0; i <= n; i++)
	Add(ans, 1ll * (n-i) * dp[i] % Mod);
	cout << ans; 
}

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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

void Main() {
    vector<vector<int>> grid(3, vector<int>(3));
    rep(i, 3) {
        rep(j, 3) {
            cin >> grid[i][j];
        }
    }
    bool ans = false;
    rep(i, 101) {
        int a1 = i;
        vector<int> check;
        int b1 = grid[0][0] - a1;
        int b2 = grid[0][1] - a1;
        int b3 = grid[0][2] - a1;
        int a2 = grid[1][0] - b1;
        int a3 = grid[2][0] - b1;
        check.push_back(b1);
        check.push_back(b2);
        check.push_back(b3);
        check.push_back(a2);
        check.push_back(a3);
        bool ok = true;
        rep(i, 5) {
            if (0 <= check[i] && check[i] <= 100) continue;
            ok = false;
        }
        if (a2 + b2 != grid[1][1]) continue;
        if (a2 + b3 != grid[1][2]) continue;
        if (a3 + b2 != grid[2][1]) continue;
        if (a3 + b3 != grid[2][2]) continue;
        if (ok) ans = true;
    }
    cout << (ans ? "Yes" : "No") << '\n';
}

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


Measured memory_bytes: 256
#include<stdio.h>
//????????????????????£?¨?????§?
int days(int year,int day);
void whatday(int day);
//????????????????????£?¨???????

int main(void){
  int year,day,total;
  while(1){
    scanf("%d %d",&year,&day);
    if(year==0 && day==0) break;
    total = days(year,day);
    whatday(total);
  }
  return 0;
}
int days(int year,int day){
  int k,total=day;
  switch(year){
  case 12:
    total+=30;
  case 11:
    total+=31;
  case 10:
    total+=30;
  case 9:
    total+=31;
  case 8:
    total+=31;
  case 7:
    total+=30;
  case 6:
    total+=31;
  case 5:
    total+=30;
  case 4:
    total+=31;
  case 3:
    total+=29;
  case 2:
    total+=31;
  }
  return total;
}

void whatday(int day){
  switch(day%7){
  case 0:
    printf("Wednesday\n");
    break;
  case 1:
    printf("Thursday\n");
    break;
  case 2:
    printf("Friday\n");
    break;
  case 3:
    printf("Saturday\n");
    break;
  case 4:
    printf("Sunday\n");
    break;
  case 5:
    printf("Monday\n");
    break;
  case 6:
    printf("Tuesday\n");
    break;
  }
}

Measured memory_bytes: 584
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <unordered_map>
using namespace std;
using ll = long long;
struct Int2
{
	int x, y;
	Int2(int x, int y):x(x),y(y){}
	bool operator<(const Int2& other) const {
		if (x != other.x)
			return x < other.x;
		return y < other.y;
	}
	bool operator>(const Int2& other) const {
		if (x != other.x)
			return x > other.x;
		return y > other.y;
	}
};
int main() {
	int n, a;
	unordered_map<int, int> m;
	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		scanf("%d", &a);
		m[a]++;
	}
	vector<Int2> v;
	for (auto itr = m.begin(); itr != m.end(); ++itr) {
		if (itr->second < 2)
			continue;
		v.emplace_back(itr->first, itr->second);
	}

	if (v.size() == 0 || (v.size() == 1 && v.front().y < 4)) {
		printf("%d\n", 0);
		return 0;
	}
	sort(v.begin(), v.end());
	if (4 <= v.back().y)
		printf("%lld\n", ((ll)v.back().x) * ((ll)v.back().x));
	else
		printf("%lld\n", ((ll)v[v.size() - 1].x) * ((ll)v[v.size() - 2].x));
}


Measured memory_bytes: 4388
#include <iostream>
#include<queue>
#include<stack>
#include<vector>
#include<set>
#include<map>
#include<algorithm>
#include<cstring>
#include<string>
#include<cassert>
#include<cmath>
#include<climits>
#include<iomanip>
#include<bitset>
#include<unordered_map>

using namespace std;

#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define rep(i,j,n) for(ll (i)=(j);(i)<(n);(i)++)
#define FOR(i,c) for(decltype((c).begin())i=(c).begin();i!=(c).end();++i)
#define ll long long
#define ull unsigned long long
#define all(hoge) (hoge).begin(),(hoge).end()
typedef pair<ll, ll> P;
const long long INF = 1LL << 60;
const long long MOD = 1e9 + 7;
typedef vector<ll> Array;
typedef vector<Array> Matrix;


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

//グラフ関連
struct Edge {//グラフ
	ll to, cap, rev;
	Edge(ll _to, ll _cap, ll _rev) {
		to = _to; cap = _cap; rev = _rev;
	}
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;

void add_edge(Graph& G, ll from, ll to, ll cap, bool revFlag, ll revCap) {
	G[from].push_back(Edge(to, cap, (ll)G[to].size()));
	if (revFlag)G[to].push_back(Edge(from, revCap, (ll)G[from].size() - 1));
}

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

	string s;
	cin >> s;

	ll ans = 0;
	for (int i = 0; i < s.size() / 2;i++) {
		if (s[i] != s[s.size() - 1 - i]) ans++;
	}

	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))

flag = [-1]*n
t = 0
for i in range(n-1):
  if t == 0:
    if a[i] < a[i+1]:
      flag[i] = 0
      t = 1
  elif t == 1:
    if a[i+1] < a[i]:
      flag[i] = 1
      t = 0

if t == 1:
  for i in range(n-1, -1, -1):
    if flag[i] == 0:
      flag[i] == -1
      break
    if a[i] < a[i-1]: continue
    flag[i] = 1
    break
    
ans = 1000
s = 0
for i in range(n):
  if flag[i] == 0:
    s = ans//a[i]
    ans %= a[i]
  elif flag[i] == 1:
    ans += s*a[i]
    s = 0
print(ans)

Measured memory_bytes: 9108
a, b, c = (int(x) for x in input().split())
array = []
if 0 <= a and a <= 10000:
  array.append(a)
if 0 <= b and b <= 10000:
  array.append(b)
if 0 <= c and c <= 10000:
  array.append(c)

sorted_array = sorted(array)

print(str(sorted_array[0]), str(sorted_array[1]), str(sorted_array[2]))
    


Measured memory_bytes: 5604
import copy
S = list(input())
T = list(input())

ans_list = []

for i in range(len(S)-len(T)+1):
    flg = 0
    temp = copy.deepcopy(S)

    #S文字の先頭の文字i番目からT文字列を一致するか?
    for j in range(len(T)):
        if T[j]==S[i+j]:
            continue
        elif S[i+j]=="?":
            temp[i+j] = T[j]
            continue
        else:
            flg = 1
    if flg==0:
        for i in range(len(temp)):
            if temp[i]=="?":
                temp[i]="a"
        ans_list.append("".join(temp))

if ans_list==[]:
    print("UNRESTORABLE")
else:
    ans_list.sort()
    print(ans_list[0])

Measured memory_bytes: 3444
#include<iostream>
#include<vector>
#include<set>
#include<algorithm>

using namespace std;

struct Point{
  long long  xy;
  int num;
  bool operator==(const Point a) const {
    return xy == a.xy;
  }
  bool operator< (const Point& a) const {
    return xy < a.xy;
  }
};

int main(int argc, char* argv[]){
  long long h,w,n;
  cin >> h >> w >> n;
  set<Point> p;
  for(long long i = 0 ; i < n ; i++){
    long long a,b;
    cin >> a >> b;
    a--; b--;
    for(long long s = -1; s < 2; s++){
      for(long long t = -1; t < 2; t++){
        if(a+s<1 || a+s >= h-1 || b+t < 1 || b+t >= w-1) continue;
        long long x = a+s;
        long long y = b+t;
        auto it = p.find((Point){x*1000000007+y, 0});
        if(it != p.end()){
          int tmp = it->num;
          p.erase(it);
          p.insert({x*1000000007+y, tmp+1});
        }
        else{
          p.insert((Point){x*1000000007+y, 1});
          // cout << x << " " << y << endl;
        }
      }
    }
  }
  vector<long long> ans(10, 0);
  ans[0] = (h-2)*(w-2);
  for(auto v:p){
    ans[0]--;
    ans[v.num]++;
  }
  for(int i = 0; i < 10; i++){
    cout << ans[i] << endl;
  }
}


Measured memory_bytes: 56448
#include<iostream>
#include<algorithm>
#include<vector>
#include<cstdio>
#include<cmath>
#include<string>
#include<cstdlib>
#include<utility>

typedef long long ll;
#define INF 10e9

using namespace std;

ll dp[200005];

int main() {
	ll n, h, w;
	ll a[1001], b[1001];
	cin >> n >> h >> w;
	for (int i = 0; i < n; i++) cin >> a[i] >> b[i];
	ll ans = 0;
	for (int i = 0; i < n; i++) {
	    if (a[i] >= h && b[i] >= w)
			ans++;
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<cmath>
#pragma GCC optimize("Ofast")
using namespace std;
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
typedef long long ll;
const ll MOD = 1000000007;
#define rep(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define REP(i,num,n) for(ll i=num, i##_len=(n); i<i##_len; ++i)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template<class T> inline void add(T &a, T b){a = ((a+b) % MOD + MOD) % MOD;};
#define print(x) cout << (x) << endl;
#define pb push_back
#define mp make_pair
#define sz(x) int(x.size())
 
template<typename T>
T gcd(T a,T b){return b?gcd(b,a%b):a;}

const int INF = 1e9;
const ll LLINF = 1e16;
 
template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}
 
template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}
 
template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value!=0>::type
fill_v(U &u,const V... v){u=U(v...);}
 
template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value==0>::type
fill_v(U &u,const V... v){
  for(auto &e:u) fill_v<T>(e,v...);
}
 
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, -1, 1, -1};
 
template<typename T>
T lcm(T a, T b) {
    return a * b / gcd(a, b);
}

// 割り算の切り上げ処理
template<typename T>
T round_up(T a, T b) {
  return (a + b - 1) / b;
}

vector<pair<long long, long long> > prime_factorize(long long n) { //素因数分解、pairのfirstに底、secondに底の何乗
   vector<pair<long long, long long> > res;
   for (long long p = 2; p * p <= n; ++p) {
       if (n % p != 0) continue;
       int num = 0;
       while (n % p == 0) { ++num; n /= p; }
       res.push_back(make_pair(p, num));
   }
   if (n != 1) res.push_back(make_pair(n, 1));
   return res;
}

using pint = pair<int, int>;
using pll = pair<ll, ll>;

long myPow(long x, long n, long m){
  if(n == 0)
    return 1;
  if(n % 2 == 0)
    return myPow(x * x % m, n / 2, m);
  else
    return x * myPow(x, n - 1, m) % m;
}

int main(void)
{
    cout.tie(0);
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    ll h;
    cin >> h;
    ll ans = 0;
    ll tmp = h;
    ll pro = 1;
    while(tmp > 0){
      ans += pro;
      pro *= 2;
      tmp /= 2;
    }
    print(ans);
}


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

#define pb push_back
#define ff first
#define ss second
#define all(x) (x).begin(), (x).end()
#define ll long long
#define ii pair<int,int>
#define vi vector<int>
#define vll vector<ll>
#define vii vector<ii>

using namespace std;

ll maxn = 1e18;

int32_t main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	//#ifndef ONLINE_JUDGE
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	//#endif
	ll r,d,xi;
	cin>>r>>d>>xi;
	for(int i=0;i<10;++i){
		xi = r*xi-d;
		cout<<xi<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
import collections
N,K = map(int, input().split())
A = list(map(int, input().split()))
C = collections.Counter(A)
B = C.most_common()[::-1]
l =  len(B)
ans = 0
for i in range(N):
  if l > K:
    ans += B[i][1]
    l -= 1
  else:
    break
print(ans)

Measured memory_bytes: 39344
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<iostream>
#include<algorithm>
#include<queue>
#include<set>
#include<map>
#include<bitset>
using namespace std;
#define ll long long
#define re register
#define mp make_pair
typedef pair<int,int> pii;
inline int gi()
{
	int sum=0,f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){sum=(sum<<3)+(sum<<1)+ch-'0';ch=getchar();}
	return f*sum;
}
const int N=100010;
int n,a[N],k;
int main()
{
	n=gi();k=gi();for(int i=1;i<=n;i++)a[i]=gi();
	sort(a+1,a+n+1);int ans=1e9+10;
	for(int i=1;i+k-1<=n;i++)
		ans=min(ans,a[i+k-1]-a[i]);
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
using ll  = long long;
using vl  = vector<ll>;
using vi  = vector<int>;
#define _GLIBCXX_DEBUG
#define IO_STREAM cin.tie(0);ios::sync_with_stdio(false)
#define all(x) x.begin(),x.end()
#define rep(i,sta,end) for(int i=sta;i<end;++i)
#define lcm(a,b) (a)/__gcd((a),(b))*(b)
#define pb push_back
const ll INF = 1000000000000000;
const ll MOD = 1000000007;
const double PI = acos(-1);
//||
#define DBG(a,b,c,d) //cout<<a<<" "<<b<<" "<<c<<" "<<d<<" "<<endl
//DBG("","","","");

signed main(){
	IO_STREAM;
	int N,M;
	cin>>N>>M;
	if(N==M)	cout<<"Yes"<<endl;
	else		cout<<"No"<<endl;
	return 0;
}


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

int a[200010];

int main ()
{
    int n, t; cin>>n>>t;
    for(int i=0; i<n; i++) {
        cin>>a[i];
    }
    int ans=0; int cur=0;
    for(int i=0; i<n; i++) {
        if(i==0) {
            ans+=t;
            cur=a[0]+t;
        }
        else {
            if(cur<a[i]) {
                ans+=t;
                cur=a[i]+t;
                continue;
            }
            ans+=a[i]+t-cur;
            cur=a[i]+t;
        }
    }
    cout<<ans<<endl;
    return 0;
}


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

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

    set<int> S;
    vector<pair<int,int>> V0;
    rep(i,n) {
        int t, d;
        cin >> t >> d;
        V0.emplace_back(t,d);
    }
    sort(V0.rbegin(), V0.rend());

    vector<pair<int,int>> V;
    for (auto v : V0) {
        if (S.find(v.first) == S.end()) {
            S.insert(v.first);
            V.emplace_back(v.second, 1);
        } else {
            V.emplace_back(v.second, 0);
        }
    }
    sort(V.rbegin(), V.rend());

    ll x = 0;
    ll y = 0;
    auto f = [&](){return x + y*y;};
    rep(i,k) {
        x += V[i].first;
        if(V[i].second == 1) y++;
    }

    ll ans = f();
    vector<int> T;
    for(int i= k; i<n; i++) {
        if(V[i].second == 1) T.push_back(V[i].first);
    }
    sort(T.rbegin(), T.rend());
    vector<int> W;
    rep(i,k) {
        if (V[i].second == 0) W.push_back(V[i].first);
    }
    sort(W.begin(), W.end());

    rep(i, T.size()) {
        if (i == W.size()) break;
        y++;
        x += T[i];
        x -= W[i];
        ans = max(f(), ans);
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 6900
import java.util.Scanner;
public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
for(int i = 1; ;i++){
int x = sc.nextInt();
if(x == 0){
break;
}
System.out.printf("Case %d: %d\n", i, x);
}
}
}


Measured memory_bytes: 65804
import collections
N = int(input())
D = collections.Counter(list(map(int, input().split())))
M = int(input())
T = collections.deque(sorted(list(map(int, input().split()))))
ans = 'YES'
for i in range(M):
  prb = T.pop()
  #print(prb, D)
  if prb in D:
    if D[prb]:
      D[prb] -= 1
      if not D[prb]:
        del D[prb]
    else:
      ans = 'NO'
      break
  else:
    ans = 'NO'
    break
print(ans)


Measured memory_bytes: 124916
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
inline int gi()
{
	char c; int x=0,f=1;
	for(;c<'0'||c>'9';c=getchar())if(c=='-')f=-1;
	for(;c>='0'&&c<='9';c=getchar())x=(x<<1)+(x<<3)+c-'0';
	return x*f;
}
const int N=1e5+5,Mod=1e9+7;
bool unable[N];
int f[N];
int main()
{
	int n=gi(),m=gi();
	for(int i=1;i<=m;++i) unable[gi()]=true;
	f[0]=1,f[1]=!unable[1];
	for(int i=2;i<=n;++i)
		f[i]=(unable[i]?0:f[i-1]+f[i-2])%Mod;
	printf("%d",f[n]);
}


Measured memory_bytes: 768
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vb = vector<bool>;
using vl = vector<long>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvb = vector<vector<bool>>;
using vvc = vector<vector<char>>;
using vvl = vector<vector<long>>;
using pii = pair<int, int>;
using pil = pair<int, long>;
using pll = pair<long, long>;
#define fix20 cout << fixed << setprecision(20)
#define YES cout << "Yes" << endl
#define NO cout << "No" << endl
#define rep(i,n) for(int i=0; i<(int)(n);i++)
#define REP(i,s,t) for(int i=s; i<t; i++)
#define RNG(i,s,t,u) for(int i=s; i<t; i+=u)
#define MOD 1000000007
#define all(vec) vec.begin(), vec.end()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

int main(){
  int a;
  cin >> a;
  cout << a + a*a + a*a*a << endl;
}

Measured memory_bytes: 3620
import sys
from functools import reduce
import copy
import math
from pprint import pprint


sys.setrecursionlimit(4100000)


def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def int_inputs(num_of_input):
    ins = [int(input()) for i in range(num_of_input)]
    return ins


def solve(inputs):
    [A, B, C, x, y] = string_to_int(inputs[0])
    cost = 0
    if A + B > C * 2:
        while x >= 1 and y >= 1:
            cost += C * 2
            x -= 1
            y -= 1

    if A > C * 2:
        while x >= 1:
            cost += C * 2
            x -= 1
    else:
        while x >= 1:
            cost += A
            x -= 1

    if B > C * 2:
        while y >= 1:
            cost += C * 2
            y -= 1
    else:
        while y >= 1:
            cost += B
            y -= 1
    return cost


def string_to_int(string):
    return list(map(int, string.split()))


if __name__ == "__main__":
    ret = solve(inputs(1))
    print(ret)


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

int main(){
    int a, b, c, d, e, k;
    cin >> a >> b >> c >> d >> e >> k;
    if(e-a <= k){
        cout << "Yay!" << endl;
    }else{
        cout << ":(" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < (n); i++)
#define REPR(i, n) for (int i = (n); i >= 0; i--)
#define ALL(x) (x).begin(), (x).end()
#define OUT(x) std::cout << (x) << std::endl
typedef long long ll;

int main() {
    int n, k;
    cin >> n >> k;
    double acuP[n + 1];
    acuP[0] = 0.0;
    REP(i, n) {
        double tmp;
        cin >> tmp;
        tmp = (tmp + 1) / 2.0;
        acuP[i + 1] = acuP[i] + tmp;
    }
    double ans = 0;
    for (int i = 1; i < n + 1 - (k - 1); i++) {
        double tmp = acuP[i + k - 1] - acuP[i - 1];
        ans = max(ans, tmp);
    }
    cout << setprecision(12) << ans << endl;
}

Measured memory_bytes: 1792
#include <iostream>
#include <stack>
using namespace std;
int main(){
    stack<int>st;
    int n;
    cin>>n;
    st.push(n);
    while(cin>>n){
    	if(n==0){
    		cout<<st.top()<<endl;
    		st.pop();
    	}
    	else
    		st.push(n);
    }
    return 0;
}


Measured memory_bytes: 3088
#include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>
#include <iomanip>
using namespace std;
typedef long long ll;

int main(void){
    int n;
    cin >> n;
    
    vector<pair<double, double> > v[7];
    v[0].push_back(make_pair(0.0, 0.0));
    v[0].push_back(make_pair(100.0, 0.0));
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < v[i].size() - 1; j++) {
            double x1 = v[i][j].first, y1 = v[i][j].second;
            double x2 = v[i][j + 1].first, y2 = v[i][j + 1].second;
            double p = x2 - x1, d = (y2 - y1) / (x2 - x1);
            double l = sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1)) / 6.0;
            v[i + 1].push_back(make_pair(x1, y1));
            v[i + 1].push_back(make_pair(x1 + (x2 - x1) / 3.0, y1 + (y2 - y1) / 3.0));
            if (d == 0) v[i + 1].push_back(make_pair((x1 + x2) / 2.0, (y1 + y2) / 2.0 + sqrt(3) * (x2 - x1) / 6.0));
            else if (p == 0) {
                if (x1 < x2) v[i + 1].push_back(make_pair((x1 + x2) / 2.0 + sqrt(3) * (y2 - y1) / 6.0, (y1 + y2) / 2.0));
                else v[i + 1].push_back(make_pair((x1 + x2) / 2.0 - sqrt(3) * (y2 - y1) / 6.0, (y1 + y2) / 2.0));
            }
            else {
                if (d > 0 && x1 < x2) v[i + 1].push_back(make_pair((x1 + x2) / 2.0 - l * d * sqrt(3.0 / (d*d + 1)), (y1 + y2) / 2.0 + l * sqrt(3.0 / (d*d + 1))));
                else if (d > 0) v[i + 1].push_back(make_pair((x1 + x2) / 2.0 + l * d * sqrt(3.0 / (d*d + 1)), (y1 + y2) / 2.0 - l * sqrt(3.0 / (d*d + 1))));
                else if (x1 < x2) v[i + 1].push_back(make_pair((x1 + x2) / 2.0 - l * d * sqrt(3.0 / (d*d + 1)), (y1 + y2) / 2.0 + l * sqrt(3.0 / (d*d + 1))));
                else v[i + 1].push_back(make_pair((x1 + x2) / 2.0 + l * d * sqrt(3.0 / (d*d + 1)), (y1 + y2) / 2.0 - l * sqrt(3.0 / (d*d + 1))));
            }
            v[i + 1].push_back(make_pair(x1 + 2.0 * (x2 - x1) / 3.0, y1 + 2.0 * (y2 - y1) / 3.0));
            
        }
        v[i + 1].push_back(make_pair(100.0, 0.0));
    }
    
    for (int i = 0; i < v[n].size(); i++) {
        cout << setprecision(10) << v[n][i].first << " " << v[n][i].second << endl;
    }
    
}





Measured memory_bytes: 3316
unittest
{
	assert( [ "10 3 5" ].parse.expand.solve == "3 0" );
	assert( [ "10 7 5" ].parse.expand.solve == "5 2" );
	assert( [ "100 100 100" ].parse.expand.solve == "100 100" );
}



import std.algorithm;
import std.conv;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

void main()
{
	stdin.byLineCopy.parse.expand.solve.writeln;
}

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto nab = input.front.split.to!( long[] );
	return tuple( nab[ 0 ], nab[ 1 ], nab[ 2 ] );
}

auto solve( long n, long a, long b )
{
	return format( "%s %s", min( a, b ), max( 0, a + b - n ) );
}


Measured memory_bytes: 256
n = int(input())

ans = [0] * (n + 1)

for i in range(1, n + 1):
    ind = i
    while True:
        if ind >= n + 1:
            break
        ans[ind] += 1
        ind += i
res = 0
for i in range(n + 1):
    res += i * ans[i]
print(res)

Measured memory_bytes: 145760
h,w = map(int,input().split())
kouho = []

if h%3 == 0 or w%3 == 0:
    print(0)
else:
    kouho.append(min(h,w)*1)
    w_small = w//2
    w_large = w-w_small
    border1 = w_large*h//(w+w_large) #ギリギリ上の四角が小さい
    h_small = h//2
    h_large = h-h_small
    border2 = h_large*w//(h+h_large)


    A1 = w*border1
    B1 = w_small*(h-border1)
    C1 = w_large*(h-border1)

    if A1 > B1:
        kouho.append(C1-B1)
    else:
        kouho.append(C1-A1)
    border1+=1
    A1 = w*border1
    B1 = w_small*(h-border1)
    C1 = w_large*(h-border1)

    kouho.append(A1-B1)

    A2 = h*border2
    B2 = h_small*(w-border2)
    C2 = h_large*(w-border2)

    if A2>B2:
        kouho.append(C2-B2)
    else:
        kouho.append(C2-A2)

    border2+=1

    A2 = h * border2
    B2 = h_small * (w - border2)
    C2 = h_large * (w - border2)

    kouho.append(A2-B2)

    #print(border1,border2)
    #print(kouho)
    print(min(kouho))





Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#include <numeric> 
 
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
#define endl "\n"
#define int long long int
#define mod 1000000007
#define INT_BITS 16
#define test int t;cin>>t;while(t--)
#define INF 10000000
#define pi 3.141592
#define watch(x) cout<<(#x)<<"="<<(x)<<"\n" 
#define pb push_back
//#include "debug.cpp"
//__builtin_popcount

int32_t main()
{
    fast
    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    #endif
    
    double n,x,t;
    cin>>n>>x>>t;
     x=ceil(n/x);
     int y=x*t;
    cout<<y<<endl;
    
}


Measured memory_bytes: 3660
#include<bits/stdc++.h>
using namespace std;
namespace FAST_IO
{
	template<typename T> void read(T &a)
	{
		a=0;
		int f=1;
		char c=getchar();
		while(!isdigit(c))
		{
			if(c=='-')
			{
				f=-1;
			}
			c=getchar();
		}
		while(isdigit(c))
		{
			a=a*10+c-'0';
			c=getchar();
		}
		a=a*f;
	}
	template <typename T> void write(T a)
	{
		if(a<0)
		{
			a=-a;
			putchar('-');
		}
		if(a>9)
		{
			write(a/10);
		}
		putchar(a%10+'0');
	}
	template <typename T> void writeln(T a)
	{
		write(a);
		puts("");
	}
}
string q;
int ans;
int main()
{
	cin>>q;
	for(int i=0;i<q.size();i++)
	{
		if(q[i]=='+')
		{
			ans++;
		}
		else
		{
			ans--;
		}
	}
	cout<<ans;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (int)(n); ++i)
#define REP2(i, m, n) for (int i = (m); i < (int)(n); ++i)
#define REPR(i, n) for (int i = (n)-1; i >= 0; --i)
#define REPR2(i, m, n) for (int i = (n)-1; i >= (m); --i)
#define REPx(x, a) for(auto x : a)
#define ALL(a) a.begin(), a.end()
#define SORT(a) sort(ALL(a))
#define SORTR(a) sort(ALL(a), greater<int>())
#define REVERSE(a) reverse(ALL(a))
#define bit_search(bit, n) REP(bit, 1<<(n))
#define bit_check(bit, i) ((bit>>(i)) & 1)
#define setpre(n) fixed << setprecision((n))
#define UNIQUE(a) do {SORT(a); (a).erase(unique(ALL(a)), (a).end());} while(0)
#define MAX(a) *max_element(ALL(a))
#define MIN(a) *min_element(ALL(a))
#define bisect_left(a, x) lower_bound(ALL(a), (x)) - a.begin()
#define bisect_right(a, x) upper_bound(ALL(a), (x)) - a.begin()
#define INPUT(a) REP(i, a.size()) cin >> a[i];
#define INPUTP(a) REP(i, a.size()) cin >> a[i].first >> a[i].second;
#define OUTPUT_PERMUTATION(n) do{VI v(n); iota(ALL(v), 1); do{REPx(x, v) cout << x << " "; ENDL} while(next_permutation(ALL(v)));} while(0);
#define MAKE_PERMUTATION(n) do{VVI a(fact(n), VI(n)); int idx = 0; VI v(n); iota(ALL(v), 1); do{REP(i, n) a[idx][i] = v[i]; idx++; PER = a;} while(next_permutation(ALL(v)));} while(0); // int fact(), VVI PERを宣言しておく
#define ENDL cout << endl;
using namespace std;

int w, h;
vector<int> px = {0, 1, 0, -1, 1, 1, -1, -1}, py = {1, 0, -1, 0, 1, -1, 1, -1};

void dfs(vector<vector<char>> M, vector<vector<bool>>& reached, int x, int y)
{
  reached[y][x] = true;
  REP(i, 8)
  {
    int xx = x + px[i], yy = y + py[i];
    if (0 <= xx && xx < w && 0 <= yy && yy < h && M[yy][xx] == '1' && !reached[yy][xx]) dfs(M, reached, xx, yy);
  }
}

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  while(true)
  {
    int ans = 0;
    cin >> w >> h;
    if(w == 0 && h == 0) return 0;
    vector<vector<char>> M(h, vector<char>(w));
    REP(y, h) REP(x, w) cin >> M[y][x];
    vector<vector<bool>> reached(h, vector<bool>(w, false));
    REP(y, h) REP(x, w)
    {
      if (reached[y][x] || M[y][x] == '0') continue;
      ans++;
      dfs(M, reached, x, y);
    }
    cout << ans << endl;
  }

  return 0;
}



Measured memory_bytes: 13160
# input
S = input()
T = input()

s = len(S)
t = len(T)
ans = 'UNRESTORABLE'

if len(T) <= len(S):
    for i in range(s - t + 1): # iから|T|文字を見る
        for j in range(t):
            if S[i + j] != T[j] and S[i + j] != '?':
                break
            if j == t - 1:
                c = S[:i] + T + S[t + i:]
                ans = c.replace('?', 'a')

print(ans)



Measured memory_bytes: 3060
#include<stdio.h>

int main(void)
{
    int m, f, r;
    scanf("%d %d %d", &m, &f, &r);
    while(! (( m == -1 ) && ( f == -1 ) && ( r == -1))){
        if( ( m == -1) || ( f == -1)){
            printf("F\n");
        }else if( ( m + f ) >= 80 ){
            printf("A\n");
        }else if( ( m + f ) >= 65){
            printf("B\n");
        }else if( ( m + f ) >= 50){
            printf("C\n");
        }else if( ( m + f ) >= 30){
            if( r >= 50 ){
                printf("C\n");
            }else{
                printf("D\n");
            }
        }else{
            printf("F\n");
        }
        scanf("%d %d %d", &m, &f, &r);
    }
    return 0;
}

Measured memory_bytes: 1012
import sys
input = sys.stdin.readline
from heapq import heappush, heappop, heapify

def dijkstra(V, E, edge, r=0):
    dist = [float('inf')] * V
    dist[r] = 0
    visited = [False] * V
    visited[r] = True

    q = edge[r]
    heapify(q)
    count = V-1

    while count and q:
        c, v = heappop(q)

        if visited[v]: continue

        count -= 1
        visited[v] = True
        dist[v] = c

        for cc, u in edge[v]:
            if not visited[u]: heappush(q, (c+cc, u))
    
    return dist

def main():
    V, E, r = list(map(int, input().split()))

    edge = [[] for i in range(V)]

    for i in range(E):
        s, t, d = map(int, input().split())
        edge[s].append((d, t))
        
    dist = dijkstra(V, E, edge, r)

    for d in dist: 
        if d == float('inf'): print('INF')
        else: print(d)

if __name__ == '__main__':
    main()



Measured memory_bytes: 97004
# include <cstdio>

int main() {
  int k,a,b; scanf("%d\n%d %d",&k,&a,&b);
  for(int i = a;i <= b;i++) { if( i % k == 0) { printf("OK\n"); return 0; } }
  printf("NG\n"); return 0;
}

Measured memory_bytes: 1624
N = int(input())
A = [0] * (10**5 + 1)
for a in map(int, input().split()):
    A[a] += 1
Q = int(input())
acc = sum(i * a for i, a in enumerate(A))
for _ in range(Q):
    b, c = map(int, input().split())
    k = A[b]
    A[b] = 0
    A[c] += k
    acc += c * k - b * k
    print(acc)


Measured memory_bytes: 17780
import sys
sys.setrecursionlimit(10**7)

def dfs(v,color):
  colors[v]=color
  for u in g[v]:
    if colors[u]==color:
      return False
    if colors[u]==0 and not dfs(u,-color):
      return False
  return True

n,m=map(int,input().split())
g=[[] for _ in range(n+1)]
for _ in range(m):
  a,b=map(int,input().split())
  g[a].append(b)
  g[b].append(a)
ans=0
colors=[0]*(n+1)
is_bipartite=dfs(1,1)
if is_bipartite==True:
  ans=colors.count(1)*colors.count(-1)-m
else:
  ans=(n*(n-1))//2-m
print(ans)

Measured memory_bytes: 35356