akhauriyash/Code-Regression huggingface dataset:
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <vector>
using namespace std;
#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
#define FOR(i, c) for(__typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
typedef long long ll;

int main(void) {
  int n, T;
  cin >> n >> T;
  const int INF = 10000000;
  int res = INF;
  REP(i, n) {
    int c, t;
    cin >> c >> t;
    if(t <= T) {
      res = min(res, c);
    }
  }
  if(res == INF) {
    cout << "TLE" << endl;
  } else {
    cout << res << endl;
  }
  return 0;
}


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

int main()
{
  int n;
  cin >> n;
  ll a[n];
  ll m = 0;
  rep(i, n) {
    cin >> a[i];
    m += a[i];
  }
  cout << m - n << endl;
    

  return 0;
}


Measured memory_bytes: 3668
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int N,M;cin>>N>>M;
    vector<pair<int,int>>pair(N);
    for(int i = 0; i < N; i++)
    {
        cin>>pair[i].first>>pair[i].second;
    }
    sort(pair.begin(),pair.end());
    int count=0;
    long long ans=0;
    bool key=false;
    for(int i = 0; i <N; i++)
    { 
        for(int j = 0; j <pair[i].second; j++)
        {
          ans+=pair[i].first;
          count++;
          if (count==M) {
              key=true;
              break;
          }
          

        }

        if (key) {
            break;
        }
        
        
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 1024
#include<iostream>
#include<vector>
using namespace std;
int main(){
  int n;
  cin>>n;
  vector<int64_t> a(n);
  for(int i=0;i<n;++i){
    cin>>a[i];
    if(a[i]%2==1){
      cout<<0<<endl;
      return 0;
    }
  }
  for(int j=0;;++j){
    int ok=0;
    for(int i=0;i<n;++i){
      if(a[i]%2==1){
        cout<<j<<endl;
        return 0;
      }
    }
    for(int i=0;i<n;++i)
      a[i]/=2;
  }
}

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

typedef long lint;
typedef long long llint;

static const int MAX = 1e5;
// static const int NIL = -1;
// static const ll INF = 1<<21;
// static const ll MOD = 1e9 + 7;

bool compPair(const pair<int, int>& arg1, const pair<int, int>& arg2) { return arg1.second > arg2.second; }
template<class T> void chmax(T& a, T b) { if (a < b) { a = b; } }
template<class T> void chmin(T& a, T b) { if (a > b) { a = b; } }


int main(void) {
    int n;
    cin >> n;

    vector<pair<int,int>> vodd(MAX+1);
    vector<pair<int,int>> veven(MAX+1);
    int vtmp;
    for(int in=0;in<n;in++) {
        cin >> vtmp;
        if(in%2==0) { 
            vodd.at(vtmp).first = vtmp;
            vodd.at(vtmp).second++;
        }
        else { 
            veven.at(vtmp).first = vtmp;
            veven.at(vtmp).second++;
        }
    }
    vodd.at(0).first = 0;
    vodd.at(0).second = -1;
    veven.at(0).first = 0;
    veven.at(0).second = -1;

    sort(vodd.begin(), vodd.end(), compPair);
    sort(veven.begin(), veven.end(), compPair);

    int o1=vodd.at(0).second, o2=vodd.at(1).second;
    int e1=veven.at(0).second, e2=veven.at(1).second;
    int o1num=vodd.at(0).first, o2num=vodd.at(1).first;
    int e1num=veven.at(0).first, e2num=veven.at(1).first;

    int ans;
    if(o1num!=e1num) ans = n - e1 - o1;
    else ans = min(n-e1-o2, n-e2-o1);

    cout << ans << endl;

    // cout << o1num << endl;
    // cout << e1num << endl;
    // cout << o2num << endl;
    // cout << e2num << endl;
    // cout << o1 << endl;
    // cout << e1 << endl;
    // cout << o2 << endl;
    // cout << e2 << endl;

    return 0;
}


Measured memory_bytes: 1792
import numpy as np

n,s = map(int,input().split())
a = list(map(int,input().split()))
ans = 0
mod = 998244353

#係数を記録するための配列
f = np.zeros(s+1,int)

for i in a:
    f[0] += 1
    f[i:] += f[:-i].copy()
    f %= mod
    ans += f[s]

print(ans%mod)

Measured memory_bytes: 12420
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <climits>
#include <cstring>

#define rep(i, m, n) for(int i=int(m);i<int(n);i++)
#define all(c) begin(c),end(c)

template<typename T1, typename T2>
inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }

template<typename T1, typename T2>
inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }

//改造
typedef long long int ll;
using namespace std;
#define INF (1 << 30) - 1
#define INFl (ll)5e15
#define DEBUG 0 //デバッグする時1にしてね
#define dump(x)  cerr << #x << " = " << (x) << endl
#define MOD 1000000007


//ここから編集する
class Solve {
public:
    void input() {

    }

    void solve() {
        input();
        string s;

        cin >> s;
        string tapu;
        tapu += s[5];
        tapu += s[6];
        int tapi = stoi(tapu);

        if (tapi >= 5) {
            cout << "TBD" << endl;
        } else {
            cout << "Heisei" << endl;
        }

    }
};


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);

    Solve().solve();


    return 0;
}


Measured memory_bytes: 888
# -*- coding: utf-8 -*-

import sys
from itertools import accumulate

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

N=INT()
A=[INT() for i in range(N)]

A2=[0]+list(accumulate(A, max))+[0]
# A3=[0]+list(accumulate(A[::-1], max))[::-1]+[0]
A3=[0]*N
A3[-1]=A[-1]
for i in range(N-2, -1, -1):
    A3[i]=max(A3[i+1], A[i])
A3=[0]+A3+[0]

for i in range(1, N+1):
    print(max(A2[i-1], A3[i+1]))


Measured memory_bytes: 18624
#include <cstdio>
#include <iostream>
#include <math.h>
#include <vector>
#include <algorithm>
#include <set>
#include <map>

#define ll unsigned long long
#define pb push_back
using namespace std;
const int N = 100005;
int a[N], d[N];
int main () {
	int n;
	cin >> n;
	for (int i=0; i<n; i++) cin >> a[i];
	d[0]=0;
	d[1]=abs(a[0]-a[1]);
	for (int i=2; i<n; i++){
		d[i]=min(d[i-1]+abs(a[i]-a[i-1]),d[i-2]+abs(a[i]-a[i-2]));
	}
	cout << d[n-1];
	return 0;
}


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

#define UN unsigned
#define ll long long
#define mod 1000000007
#define pii pair<int, int>
#define pb push_back
//~ #define x first
//~ #define y second
const int N = 500000;

int main(void) {
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	cerr.tie(nullptr);
	
	ll a = 0;
	double b = 0;
	cin >> a >> b;
	ll tmp = b*100 + 0.5;
	ll c = tmp * a;
	c /= 100;
	cout << fixed << c << endl;
	return 0;
}

Measured memory_bytes: 3704
#include<iostream>
#include<vector>
using namespace std;
int main()
{
  int a,b;
  cin>>a>>b;
  if((a+b)%2==0)
  {
    cout << (a+b)/2 << endl;
  }
  else
  {
    cout << "IMPOSSIBLE" << endl;
  }
}

Measured memory_bytes: 256
def warshall_floyd(d):
    #d[i][j]: iからjへの最短距離
    for k in range(v):
        for i in range(v):
            for j in range(v):
                if d[i][k]!=float('inf') and d[k][j]!=float('inf'):
                    d[i][j] = min(d[i][j],d[i][k] + d[k][j])
    return d

v,e = map(int,input().split())
d = [[float('inf')]*v for i in range(v)] 
for i in range(e):
    x,y,z = map(int,input().split())
    d[x][y] = z
for i in range(v):
    d[i][i] = 0 #自身のところに行くコストは０
d=warshall_floyd(d)
for i in range(v):
    if d[i][i]<0:
        print('NEGATIVE CYCLE')
        exit()
ans=[['']*v for _ in range(v)]
for i in range(v):
    for j in range(v):
        if d[i][j]==float('inf'):
            ans[i][j]='INF'
        else:
            ans[i][j]=str(d[i][j])
for i in range(v):
    print(*ans[i],sep=' ')


Measured memory_bytes: 6820
/*Author: Gautam*/
 
 
#include<bits/stdc++.h>
#define FastIO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
#define MOD 1000000007
#define ull unsigned long long int
#define newline cout<<endl
 
 
/* TYPE DEFINITIONS */
typedef     long long int        ll;
typedef     vector<ll>     vi;
typedef     pair<ll,ll>   pi;
 
 
 
/* MATH */
bool isPrime(ull n) 
{ 
    if (n <= 1)  return false; 
    if (n <= 3)  return true; 
    if (n%2 == 0 || n%3 == 0) return false; 
  
    for (ull i=5; i*i<=n; i=i+6) 
        if (n%i == 0 || n%(i+2) == 0) 
           return false; 
  
    return true; 
} 
 
ll pow(ll a,ll b,ll m)
{
    ll res=1;
    while(b>0)
    {
        if(b&1)res=(res*a)%m;
        a=(a*a)%m;
        b>>=1;
    }
    return res;
}
 
  
//
/* MACROS */
 
#define  all(A)         (A).begin() , (A).end()
#define  arrall(A,n)    (A),((A)+(n))
#define  rall(A)        (A).rbegin() , (A).rend()
#define  sz(A)          (int)(A).size()
#define  pb             push_back
#define  ppb            pop_back
#define  mp             make_pair
#define  ln(X)          (int)(X).length()
#define  square(X)      ((X)*(X))
#define  cube(X)        ((X)*(X)*(X))
#define  forn(i, n)  for (int i = 0; i < int(n); i++)
#define  forr(i, n)  for (int i = int(n - 1); i >= 0; i--)
#define  fora(i, a, b)  for (int i = int(a); i <= int(b); i++)
#define  forb(i, a, b)  for (int i = int(a); i >= int(b); i--)
#define  fore(it, a)    for(__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++) 

void solve()
{
	int n,m;
	cin>>n>>m;
	string s;
	cin>>s;
	s[m-1]=tolower(s[m-1]);
	cout<<s<<endl;
}
 
int main()
{
    FastIO;
    ll t=1;
    //cin>>t;
    while(t--)
    {
        solve();
    }
}

Measured memory_bytes: 256
N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=list(map(int,input().split()))

hap=0
for i in range(N):
    hap+=B[A[i]-1]
    #print(hap)
    if i>0 and A[i]==A[i-1]+1:
        hap+=C[A[i-1]-1]
    else:
        continue

print(hap)

Measured memory_bytes: 3064
#include <stdio.h>
#include <string.h>


int main(){
    int K,A,B;
    int a1,a2,b1,b2,i;

    scanf("%d", &K);
    scanf("%d %d", &A, &B);

    a1 = A / K;
    b1 = B / K;

    for(i = a1; i <= b1; i++){
        if ((A <= (i * K) && (i * K) <= B))
        {
            printf("OK");
            return 0;
        }
    }
    printf("NG");

    return 0;
}


Measured memory_bytes: 1732
def binarySearch(N, S, T):
	cnt = 0  # 一致した数
	left = 0  # 左端
	#	right = N - 1  # 右端
	right = N # 右端
	mid = (left + right) // 2
	while left < right:
#		print('{0} {1} {2} {3}'.format(T, left, right, mid))
		if S[mid] == T:
			cnt = cnt + 1
			return cnt
			# 両隣が一致するかのチェック
			# まずは左
#			temp = 1
#			while mid - temp >= left:
#				if S[mid - temp] == T:
#					cnt = cnt + 1
#				else:
#					break
#				temp = temp + 1
#			# つぎは右
#			temp = 1
#			while mid + temp <= right - 1:
#				if S[mid + temp] == T:
#					cnt = cnt + 1
#				else:
#					break
#				temp = temp + 1
#			return cnt
		elif S[mid] > T:
			left = left
			right = mid
			mid =  (left + right) // 2
		elif S[mid] < T:
			left = mid + 1
			right = right
			mid =  (left + right) // 2
	#		if left == right - 1:
	#			break

	return cnt


n = int(input())  # 8
s = list(map(int, input().split()))  # 1 2 3 4 5 6 7 8
q = int(input())  # 5
t = list(map(int, input().split()))  # 1 2 3 4 5
sum = 0

for i in t:
	sum = sum + binarySearch(n, s, i)
	#	print(n)
	#	print(s)
#	print(' {0} {1}'.format(i, binarySearch(n, s, i)))
print(sum)



Measured memory_bytes: 16708
#include<iostream>

using namespace std;

int main(){
	int N, S[100];
	int all = 0, min = 1000;
	cin >> N;
	for(int i = 0; i < N; i++){
		cin >> S[i];
		all += S[i];
		if(S[i] % 10 == 0){
			S[i] = 0;
		}
		if(S[i] < min && S[i] > 0){
			min = S[i];
		}
	}
	if(all % 10 == 0){
		if(min % 10 == 0){
			cout << 0 << endl;
		}else{
			cout << all - min << endl;
		}
	}else{
		cout << all << endl;
	}
	return 0;
}

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

ll l, r, cnt;

int main()
{
	//freopen("D:\\test\\in.txt", "r+", stdin);
	ios::sync_with_stdio(false);
	cin >> l >> r;
	while (l <= r && l > 0) {
		cnt++;
		l *= 2;
	}
	cout << cnt << endl;
	return 0;
}

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

using namespace std;
using LL = long long;
using P = pair<int, int>;

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

#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()

const int INF = (int)1e9;
const LL INFL = (LL)1e18;
const int MOD = 1e9 + 7;

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

    int n;
    cin >> n;

    vector<LL> ryuka(87, 0);
    ryuka[0] = 2, ryuka[1] = 1;
    FOR(i, 2, n+1) ryuka[i] = ryuka[i-2] + ryuka[i-1];
    cout << ryuka[n] << endl;
}


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

int read(){
	int x=0; char c=getchar(); int flag=1;
	while(!isdigit(c)) { if(c=='-') flag=-1; c=getchar(); }
	while(isdigit(c)) { x=((x+(x<<2))<<1)+(c^48); c=getchar(); }
	return x*flag;
}

const int N=1e5+50;

int n,k;

struct Edge{
    int to,next;
}edge[N<<1];
int head[N];
int tmp=0;
void add(int x,int y){
    ++tmp;
    edge[tmp].to=y; edge[tmp].next=head[x];
    head[x]=tmp;
}

int a[N];
int ans;

int dfs(int nod,int dep){
    int ret=dep;
    for(int i=head[nod];i!=-1;i=edge[i].next){
	    ret=max(ret,dfs(edge[i].to,dep+1));
	}
	if(a[nod]!=1&&ret-dep==k-1) { ++ans; return 0; }
	return ret; 
}

signed main(){
	memset(head,-1,sizeof(head));
	
    n=read(),k=read();
    for(int i=1;i<=n;i++) a[i]=read();
    
    if(a[1]!=1) ans=1,a[1]=1;
    
    for(int i=2;i<=n;i++) add(a[i],i);
    
    dfs(1,0); 
    
    printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 6528
#include<iostream>
#include<iomanip>
#include<string>
#include<vector>
#include<stack>
#include<set>
#include<map>
#include<utility>
#include<tuple>
#include<algorithm>
#include<cmath>
#include<climits>
using namespace std;

typedef long long ll;
const int mod=1e9+7;

int main(){
	int x, a;
	cin >> x >> a;
	if(x<a)
		cout << 0 << endl;
	else
		cout << 10 << endl;
}


Measured memory_bytes: 256
def main():
    s=input()
    x,y=map(int,input().split())

    lf = [0]
    tf = 0
    for i in range(len(s)):
        if s[i] =="F":
            lf[tf] += 1
        else:
            lf.append(0)
            tf += 1

    lx = [lf[i] for i in range(len(lf)) if i % 2 == 0]
    ly = [lf[i] for i in range(len(lf)) if i % 2 == 1]
    dpxcenter = sum(lx)
    if abs(x)>dpxcenter: return "No"
    dpxedge = dpxcenter*2+20
    dpx = [[False for _ in range(dpxedge)] for _ in range(len(lx)+1)]
    dpx[1][dpxcenter+lx[0]+10] = True
    for i in range(1,len(lx)):
        for j in range(dpxedge):
            if j-lx[i] >= 0:
                dpx[i+1][j] = dpx[i][j-lx[i]]
            if j+lx[i] < dpxedge:
                dpx[i+1][j] = dpx[i+1][j] or dpx[i][j+lx[i]]

    dpycenter = sum(ly)
    if abs(y)>dpycenter: return "No"
    dpyedge = dpycenter*2+20
    dpy = [[False for _ in range(dpyedge)] for _ in range(len(ly)+1)]
    dpy[0][dpycenter+10] = True
    for i in range(len(ly)):
        for j in range(dpyedge):
            if j-ly[i] >= 0:
                dpy[i+1][j] = dpy[i][j-ly[i]]
            if j+ly[i] < dpyedge:
                dpy[i+1][j] = dpy[i+1][j] or dpy[i][j+ly[i]]

    if dpx[-1][x+dpxcenter+10] and dpy[-1][y+dpycenter+10]:return "Yes"
    else:return "No"

print(main())

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

using namespace std;

const int MAX = 1299709;
int prime[MAX + 1] = {0}; //0::prime 1::NOTprime;

void hurui()
{
    prime[1] = 1;
    for (int i = 1; i * i <= MAX; i++)
    {
        for (int j = 2; j <= MAX / i; j++)
        {
            if (prime[i] == 0)
                prime[i * j] = 1;
        }
    }
}

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

    std::vector<int> v;
    for (int i = 1; i <= MAX; i++)
        if (prime[i] == 0)
            v.push_back(i);
    int n, p;
    while (true)
    {
        cin >> n >> p;
        if (n == -1)
            break;
        std::vector<int> li;
        int idx = 0;
        while (v[idx] <= n)
            idx++;
        for (int i = idx; i < idx + p; i++)
        {
            for (int j = i; j < idx + p; j++)
            {
                li.push_back(v[i] + v[j]);
            }
        }
        sort(li.begin(), li.end());
        cout << li[p - 1] << endl;
    }
}


Measured memory_bytes: 8440
#include <iostream>
using namespace std;
 
int main() {
    int n, p;
    cin >> n >> p;
    long long x[2] = {1, 0};
    while(n--) {
        int a;
        cin >> a;
        if(a&1) x[0] = x[1] += x[0];
        else {x[0] *= 2; x[1] *= 2;}
    }
    cout << x[p] << endl;
	return 0;
}

Measured memory_bytes: 256
def main():
    n = int(input())
    numbers = list(map(int, input().split()))

    temp_numbers = [n % 2 for n in numbers]
    number_of_even = temp_numbers.count(0)
    number_of_odd = temp_numbers.count(1)
    while number_of_odd >= 2:
        temp = number_of_odd // 2
        number_of_even += temp
        number_of_odd -= temp * 2

    while number_of_even >= 2:
        temp = number_of_even // 2
        number_of_even -= temp

    if number_of_even + number_of_odd >= 2:
        print('NO')
    else:
        print('YES')


if __name__ == '__main__':
    main()


Measured memory_bytes: 62888
from collections import Counter as C;H,W,N,*L=map(int,open(0).read().split());K=[];M=[(H-2)*(W-2)]+[0]*9
for a,b in zip(*[iter(L)]*2):
	for c in range(9):
		x=b-c//3;y=a-c%3
		if H-1>y>0<x<W-1:K+=[y*W+x]
for k,v in C(C(K).values()).items():M[0]-=v;M[k]+=v
print(*M)

Measured memory_bytes: 131432
#include<bits/stdc++.h>
#define endl '\n';
#define rep(i,n) for(int i=0; i<(n); i++)
using namespace std;
using ll = long long;
using P = pair<int,int>;
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("Ofast")
constexpr ll INF = 1e18;
constexpr int inf = 1e9;
constexpr double INFD = 1e100;
constexpr ll mod = 1000000007;
constexpr ll mod2 = 998244353;
const double PI = 3.1415926535897932384626433832795028841971;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
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; }
// ios::sync_with_stdio(false);
// cin.tie(nullptr);
// ---------------------------------------------------------------------------


int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  string S;
  cin >> S;
  if(S[2]==S[3] and S[4]==S[5]){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
cnt = [0 for i in xrange(5)]

for i in xrange(3):
	a,b = map(int, raw_input().split())
	cnt[a] += 1
	cnt[b] += 1

x = 0
y = 0
for i in xrange(1,5):
	if cnt[i] == 1:
		x += 1
	elif cnt[i] == 2:
		y += 1

if x == y and x == 2:
	print 'YES'
else:
	print "NO"

Measured memory_bytes: 28012
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>

#define rep(i,j) REP((i), 0, (j))
#define REP(i,j,k) for(int i=(j);(i)<(k);++i)
#define between(a,x,b) ((a)<=(x)&&(x)<=(b))
#define MAX_N 100
#define INF 1 << 30

using namespace std;


int cost[MAX_N][MAX_N];
int mincost[MAX_N];
bool used[MAX_N];
int n, m;

int prim(){
  for(int i = 0; i < n; ++i){
    mincost[i] = INF;
    used[i] = false;
  }

  mincost[0] = 0;
  int res = 0;

  while(true){
    int v = -1;
    for(int u = 0; u < n; ++u)
      if(!used[u] && (v == -1 || mincost[u] < mincost[v])) v = u;

    if(v == -1) break;
    used[v] = true;
    res += mincost[v];

    for(int u = 0; u < n; ++u)
      mincost[u] = min(mincost[u], cost[v][u]);
  }
  return res;
}

int main(){
  int from, to, c;
  while(scanf("%d", &n) && n){
    rep(i, n) rep(j, n) cost[i][j] = INF;
    scanf("%d", &m);
    rep(i, m){
      scanf("%d,%d,%d", &from, &to, &c);
      cost[from][to] = cost[to][from] = c;
    }
    printf("%d\n", prim()/100-(n-1));
  }
  return 0;
}

Measured memory_bytes: 1232
#include<stdio.h>


int main(){
    char chars[4] = {'S','H','C','D'};
    int clist[4][13];
    for(int i=0;i<4;i++){
        for(int j=0;j<13;j++){
                clist[i][j] = 0;
            }
        }
    int n,num;
    char c;
    scanf("%d",&n);
    for(int i=1;i <= n;i++){
        scanf("%c",&c);
        scanf("%c %d",&c,&num);
        if(c == 'S'){
            clist[0][num-1] = 1;
        } else if(c == 'H'){
            clist[1][num-1] = 1;
        } else if(c == 'C'){
            clist[2][num-1] = 1;
        } else if(c == 'D'){
            clist[3][num-1] = 1;
        }
    }
    for(int i=0;i<4;i++){
        for(int j=0;j<13;j++){
            if(clist[i][j] == 0){
                printf("%c %d\n",chars[i],j+1);
            }
        }
    }
}




Measured memory_bytes: 2612
#include<bits/stdc++.h>
#define lson (o<<1)
#define rson (o<<1|1)
#define fi first
#define sc second
#define dbg(x) cout<<#x<<" = "<<(x)<<endl;
const int N=2010;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
using namespace std;
const double pi=acos(-1);
const double eps=1e-6;
inline int lowbit(int x){return x&(-x);}
inline int read(){
	int f=1,x=0;char ch;
	do{ch=getchar();if(ch=='-')f=-1;}while(ch<'0'||ch>'9');
	do{x=x*10+ch-'0';ch=getchar();}while(ch>='0'&&ch<='9');
	return f*x;
}
template<typename T> inline T max(T x,T y,T z){return max(max(x,y),z);}
template<typename T> inline T min(T x,T y,T z){return min(min(x,y),z);}
template<typename T> inline T sqr(T x){return x*x;}
template<typename T> inline void checkmax(T &x,T y){x=max(x,y);}
template<typename T> inline void checkmin(T &x,T y){x=min(x,y);}
template<typename T> inline void read(T &x){
x=0;T f=1;char ch;do{ch=getchar();if(ch=='-')f=-1;}while(ch<'0'||ch>'9');
do x=x*10+ch-'0',ch=getchar();while(ch<='9'&&ch>='0');x*=f;
}
template<typename A,typename B> inline A fpow(A x,B p,A yql){
	A ans=1;
	for(;p;p>>=1,x=1LL*x*x%yql)if(p&1)ans=1LL*x*ans%yql;
	return ans;
}
struct FastIO{
	static const int S=1310720;
	int wpos;char wbuf[S];
	FastIO():wpos(0) {}
	inline int xchar(){
		static char buf[S];
		static int len=0,pos=0;
		if(pos==len)pos=0,len=fread(buf,1,S,stdin);
		if(pos==len)return -1;
		return buf[pos++];
	}
	inline int read(){
		int c=xchar(),x=0;
		while(c<=32&&~c)c=xchar();
		if(c==-1)return -1;
		for(;'0'<=c&&c<='9';c=xchar())x=x*10+c-'0';
		return x;
	}
}io;
const int yql=1e9+7;
//#define read io.read
int dp[N][N],fac[N*N],inv[N*N],n,k;
inline int C(int n,int m){
	if(n<m||n<0)return 0;
	return 1LL*fac[n]*inv[m]%yql*inv[n-m]%yql;
}
int main(){
	n=read();k=read();
	if(k==1)return puts("1"),0;
	fac[0]=1;
	for(int i=1;i<=n*k;i++)fac[i]=1LL*fac[i-1]*i%yql;
	inv[n*k]=fpow(fac[n*k],yql-2,yql);
	for(int i=n*k-1;~i;i--)inv[i]=1LL*inv[i+1]*(i+1)%yql;
	dp[0][0]=1;
	for(int i=0;i<=n;i++)
	for(int j=n;~j;j--){
		if(!dp[i][j])continue;
		if(j)dp[i][j-1]=(dp[i][j-1]+dp[i][j])%yql;
		if(i<n)dp[i+1][j+1]=(dp[i+1][j+1]+1LL*dp[i][j]*C((i+1)*k-j-2,k-2)%yql)%yql;
	}
	int ans=1LL*fac[n]*dp[n][0]%yql;
	ans=(ans+yql)%yql;
	printf("%d\n",ans);
}

Measured memory_bytes: 47488
#include <iostream>
#include <vector>
//#define
using namespace std;

int main()
{
    int n, q;
    cin >> n >> q;
    int *length = new int[n]{0};        // all 0?
    vector<vector<int> > arr(n);

    int flag, index, num;
    for (int i = 0; i < q; i++)
    {
        cin >> flag;
        switch(flag)
        {
        case 0:
            cin >> index >> num;
            if (length[index] < arr[index].size())
            {
                arr[index][length[index]] = num;
            }
            else
            {
                arr[index].push_back(num);
            }
            length[index]++;
            break;
        case 1:
            cin >> index;
            if (length[index] > 0)
            {
                int t = length[index];
                cout << arr[index][--t] << "\n";
            }
            break;

        case 2:
            cin >> index;
            if (length[index] > 0)
            {
                length[index]--;
            }
            break;
        default:
            break;
        }
    }

    return 0;
}



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

using namespace std;
typedef long long ll;

ll divisor(ll n)
{

    ll c = 0;
    for (long long i = 1; i * i <= n; i++)
    {
        if (n % i == 0)
        {
            c++;
            if (i * i != n)
                c++;
        }
    }
    // 昇順に並べる
    return c;
}

int main()
{

    ll N;

    cin >> N;


    ll sum=0;


    vector<ll> Ys(N+1,2);


    Ys[1] =1; 


    for (ll i=2;i<=N;i++){

        if(i*i>N){

            break;
        }

        for(ll j=i;j<=N;j++){

            if(i*j>N){

                break;
            }

            Ys[i*j]++;

            if(i!=j){

                Ys[i*j]++;
            }

        }
    }

    for (ll i=1;i<=N;i++){

        sum=sum+i*Ys[i];

    }


    cout << sum << endl;


    return 0;

}

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

using namespace std;

#define fo(i,n) for(int i=0; i<n; i++)
#define Fo(i,k,n) for(int i=k; i<n; i++)
#define ll long long
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define clr(x) memset(x, 0, sizeof(x))
#define tr(it, a) for(auto it=a.begin(); it!=a.end(); it++)
#define PI 3.1415926535897932384626
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vi> vvi;
typedef vector<vl> vvl;

int n;
vi a,b,c;
vvi dp;

int main() {
    ios_base::sync_with_stdio(false);
	cin.tie(NULL);
    cin>>n;
    a.resize(n+1);b.resize(n+1);c.resize(n+1);dp.resize(n+1, vi(4));
    Fo(i,1,n+1){
        cin>>a[i]>>b[i]>>c[i];
    }
    Fo(i,1,n+1){
        Fo(j,1,4){
            if(j==1){
                dp[i][j] = a[i] + max(dp[i-1][2], dp[i-1][3]);
            }else if(j==2){
                dp[i][j] = b[i] + max(dp[i-1][3], dp[i-1][1]);
            }else{
                dp[i][j] = c[i] + max(dp[i-1][1], dp[i-1][2]);
            }
        }
    }
    int max=0;
    Fo(i,1,4){
        if(max<dp[n][i])max = dp[n][i];
    }
    cout<<max<<endl;
    
    return 0;
}

Measured memory_bytes: 6912
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>

using namespace std;
#define rep(i, s, e) for (int(i) = (s); (i) < (e); (i)++)

int main()
{
	int a, b, c, x, y, cost, ans;
	cin >> a >> b >> c >> x >> y;
	ans = a*x + b*y;
	rep(i, 0, 100001)
	{
		cost = c * i * 2 + a * max(0, x - i) + b * max(0, y - i);
		ans = min(ans, cost);
	}
	cout << ans << endl;
}


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

using Int = long long;
const char newl = '\n';

template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
template<typename T> void drop(const T &x){cout<<x<<endl;exit(0);}
template<typename T=int>
vector<T> read(size_t n){
  vector<T> ts(n);
  for(size_t i=0;i<n;i++) cin>>ts[i];
  return ts;
}


template<typename TV, const int N> void read_tuple_impl(TV&) {}
template<typename TV, const int N, typename Head, typename... Tail>
void read_tuple_impl(TV& ts) {
  get<N>(ts).emplace_back(*(istream_iterator<Head>(cin)));
  read_tuple_impl<TV, N+1, Tail...>(ts);
}
template<typename... Ts> decltype(auto) read_tuple(size_t n) {
  tuple<vector<Ts>...> ts;
  for(size_t i=0;i<n;i++) read_tuple_impl<decltype(ts), 0, Ts...>(ts);
  return ts;
}


template<typename ...Ts>
decltype(auto) zip(vector<Ts>... args){
  vector<decltype(make_tuple(args[0]...))> res;
  int n=min({args.size()...});
  res.reserve(n);
  for(int i=0;i<n;i++) res.emplace_back(args[i]...);
  return res;
}


struct UnionFind{
  int num;
  vector<int> rs,ps;
  UnionFind(){}
  UnionFind(int n):num(n),rs(n,1),ps(n,0){iota(ps.begin(),ps.end(),0);}
  int find(int x){
    return (x==ps[x]?x:ps[x]=find(ps[x]));
  }
  bool same(int x,int y){
    return find(x)==find(y);
  }
  void unite(int x,int y){
    x=find(x);y=find(y);
    if(x==y) return;
    if(rs[x]<rs[y]) swap(x,y);
    rs[x]+=rs[y];
    ps[y]=x;
    num--;
  }
  int size(int x){
    return rs[find(x)];
  }
  int count() const{
    return num;
  }
};


vector<int> identity(int n){
  vector<int> ord(n);
  iota(ord.begin(),ord.end(),0);
  return ord;
}


template<typename F>
struct FixPoint : F{
  FixPoint(F&& f):F(forward<F>(f)){}
  template<typename... Args>
  decltype(auto) operator()(Args&&... args) const{
    return F::operator()(*this,forward<Args>(args)...);
  }
};
template<typename F>
inline decltype(auto) MFP(F&& f){
  return FixPoint<F>{forward<F>(f)};
}

//INSERT ABOVE HERE
signed main(){
  cin.tie(0);
  ios::sync_with_stdio(0);

  int n;
  cin>>n;
  auto[xs,ys]=read_tuple<int,int>(n);
  auto zs=zip(xs,identity(n));
  sort(zs.begin(),zs.end());

  vector<int> os(n);
  for(int i=0;i<n;i++) os[i]=get<1>(zs[i]);
  // for(int i=0;i<n;i++) cout<<xs[os[i]]<<newl;

  UnionFind uf(n);
  MFP([&](auto dfs,int l,int r)->void{
    if(l+1==r) return;
    int m=(l+r)>>1;

    {
      int t=m;
      for(int i=m;i<r;i++)
        if(ys[os[t]]<ys[os[i]]) t=i;

      for(int i=l;i<m;i++)
        if(ys[os[i]]<ys[os[t]]) uf.unite(os[i],os[t]);
    }
    {
      int t=l;
      for(int i=l;i<m;i++)
        if(ys[os[t]]>ys[os[i]]) t=i;

      for(int i=m;i<r;i++)
        if(ys[os[i]]>ys[os[t]]) uf.unite(os[i],os[t]);
    }

    dfs(l,m);
    dfs(m,r);
  })(0,n);

  for(int i=0;i<n;i++) cout<<uf.size(i)<<newl;
  return 0;
}


Measured memory_bytes: 8788
n,m=map(int,input().split())
eng=[]
for i in range(n):
    eng.append([int(i) for i in input().split()])
eng.sort()
can=0
mny=0
i=0
while can<m:
    if m-can>=eng[i][1]:
        can+=eng[i][1]
        mny+=eng[i][1]*eng[i][0]
        i+=1
    else:
        mny+=eng[i][0]*(m-can)
        can=m
print(mny)   

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

int main()
{
    int n,m;
    cin >> n >> m;
    if(n<m)
    {
        while(m--)
        cout << n;
    }
    else
    {
        while(n--)
        cout << m;
    }
    cout << endl;
    return 0;
}


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

int main() {
  string s;
  bool ans = false;
  cin >> s;
  for(int i = 0; i < 3; i++){
    if(s[i] == '7') {
      ans = true;
    }
  }
  if(ans)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 3624
#B
#入力
A,B,M=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
d=[list(map(int,input().split())) for i in range(M)]

#処理
x=min(a)+min(b)

for i in d:
    t=a[i[0]-1]+b[i[1]-1]-i[2]
    if t<x:
        x=t
print(x)
        

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

int main()
{
  int N;
  cin >> N;
  vector<int> H(N),dist(N,INT_MAX);
  for(int i=0 ; i<N ; i++)
    cin >> H[i];
  dist[0] = 0;
  for(int i=0 ; i<N-1 ; i++)
  {
    int a = dist[i]+abs(H[i]-H[i+1]);
    dist[i+1] = min(dist[i+1],a);
    if(i+2 < N)
    {
      int b = dist[i]+abs(H[i]-H[i+2]);
      dist[i+2] = min(dist[i+2],b);
    }
  }
  cout << dist[N-1] << endl;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
typedef complex<double> P;
#define x real()
#define y imag()

double eps = 1e-9;

string ccw(P a,P b,P c){
  P ab=b-a;
  P ac=c-a;
  P k=ac*conj(ab);
  if( k.y > eps ){
    return "COUNTER_CLOCKWISE";
  }
  if( k.y < -eps ){
    return "CLOCKWISE";
  }
  if( k.x < -eps ){
    return "ONLINE_BACK";
  }  
  if( abs(ab)+eps < abs(ac) ){
    return "ONLINE_FRONT";
  }
  return "ON_SEGMENT";
}

int main(){
  
  double x0,y0,x1,y1,x2,y2;
  cin>>x0>>y0>>x1>>y1;
  P a(x0,y0);
  P b(x1,y1);
  int n;
  cin>>n;
  while(n--){
    cin>>x2>>y2;
    P c(x2,y2);
    cout<< ccw(a,b,c) <<endl;
  }
  return 0;
}

Measured memory_bytes: 1252
#include <stdio.h>
int main(){
  
  int a,b,i,d;
  
  while(1){
  scanf("%d %d",&a,&b);
if(a==0 && b==0)break;
  
  for(i=0;i<a;i++){
 
    for(d=0;d<b;d++)
{
    printf("#");
  } 
  printf("\n");
  
   
  }
  printf("\n");
  }
   
  
  return 0;
  }


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

long long MOD=1000000007;

long long add_mod(long long x,long long y){
	return (x+y)%MOD;
}

long long sub_mod(long long x,long long y){
	return (x-y+MOD)%MOD;
}

long long mul_mod(long long x,long long y){
	return x*y%MOD;
}

long long inv_mod(long long x){
	if(x == 1) return 1;
	long long d = MOD/x+1;
	return d*inv_mod(x-(MOD%x))%MOD;
}

long long div_mod(long long x, long long y){
	return x*inv_mod(y)%MOD;
}

long long conv_mod(long long n,long long r){
	vector<long long> kaijyo(n+1);
	kaijyo[0] = 1;
	kaijyo[1] = 1;
	for(int i = 2;i <= n;i++){
		kaijyo[i] = i*kaijyo[i-1]%MOD;
	}
	return div_mod(div_mod(kaijyo[n],kaijyo[n-r]),kaijyo[r]);
}

int i,j,n;
string str;

int main(){
  cin >> n;
  vector<long long> cv(n+2),kaijyo(n+2);
  kaijyo[0] = 1;kaijyo[1] = 1;
  for(i = 2;i < kaijyo.size();i++) kaijyo[i] = mul_mod(kaijyo[i-1],i);
  for(i = 0;i < cv.size();i++){
    cv[i] = div_mod(kaijyo[n+1],mul_mod(kaijyo[n+1-i],kaijyo[i]));
  }
  vector<int> did(n+2,0);
  int r,l;
  for(i = 1;i <= n+1;i++){
    int a;
    cin >> a;
    if(did[a]){
      l = did[a]-1;
      r = n+1-i;
      break;
    }
    else did[a] = i;
  }
  vector<long long> sb(n+2,0);
  l += r;
  for(i = 0;i <= l;i++){
    sb[i] = div_mod(kaijyo[l],mul_mod(kaijyo[l-i],kaijyo[i]));
  }
  for(i = 1;i <= n+1;i++){
    cout << sub_mod(cv[i],sb[i-1]) << endl;
  }
}


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

int main(){
    int a,b,c,d;
    cin >> a >> b >> c >> d;

    if (d < 0) {
        if(a < 0) cout << (ll)a*(ll)c << endl;
        else cout << (ll)a*(ll)d << endl;
    }else {
        if(c < 0) {
            if(b < 0) cout << (ll)c*(ll)a << endl;
            else {
                if(a < 0) {
                    if( (ll)b*(ll)d > (ll)c*(ll)a ) cout << (ll)b*(ll)d << endl;
                    else cout << (ll)c*(ll)a << endl;
                }else cout << (ll)b*(ll)d << endl;
            }
        }else {
            if(b < 0) cout << (ll)c*(ll)b << endl;
            else cout << (ll)b*(ll)d << endl;
        }
    }
    
}

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

using namespace std;

int main() {
    string s;   cin >> s;
    int count_0 = 0, count_1 = 0;
    for (int i = 0; i < s.length(); i++) {
        if (s[i] == '0')
            count_0++;
        else 
            count_1++;
    }
    cout << 2*min(count_1, count_0) << endl;
    return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <vector>
using namespace std;
int main(void) {
  string str;
  cin >> str;
  vector<int> data;
  for (auto ch: str) {
  	data.emplace_back(ch - '0');
  }
  int A=0; int B=0; int C=0;
  string a=""; string b=""; string c="";
  for (int i=0; i<2; ++i) {
    if (0 == i) {
      A = data[0] + data[1];
      a = "+";
    }
    else {
      A = data[0] - data[1];
      a = "-";
    }
  	for (int j=0; j<2; ++j) {
      if (0 == j) {
        B = A + data[2];
        b = "+";
      }
      else {
        B = A - data[2];
        b = "-";
      }
      for (int k=0; k<2; ++k) {
        if (0 == k) {
          C = B + data[3];
          c = "+";
        }
        else {
          C = B - data[3];
          c = "-";
        }
        if (7 == C) {
          string out = to_string(data[0]) + a + to_string(data[1]) + b + to_string(data[2]) + c + to_string(data[3]) + "=7";
          cout << out;
          goto OUT;
        }
      }
    }
  }
  OUT:
  return 0;
}


Measured memory_bytes: 256
use proconio::input;

fn main() {
    input! {
        n: usize,
        x: usize,
        t: usize,
    }

    let ans = if n % x == 0 {
        n / x * t
    } else {
        (n / x + 1) * t
    };

    println!("{}", ans)
}


Measured memory_bytes: 2112
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <vector>

#define rep(i,x,y) for (int i=x;i<=y;i++)
#define dep(i,y,x) for (int i=y;i>=x;i--)
#define sz(x) (int)(x.size())

using namespace std;

typedef long long LL;   
typedef unsigned long long uLL;

const LL MOD=(1e9)+7;

int n,m;
LL ans;

int main()
{
    scanf("%d%d",&n,&m);
    if ((abs(n-m))>1) {printf("%d\n",0);return 0;}

    ans=(n==m)?(2):(1);
    rep(i,1,n) ans=(ans*(LL)(i))%MOD;
    rep(i,1,m) ans=(ans*(LL)(i))%MOD;

    printf("%lld\n",ans);

    // system("pause");
    return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <stdlib.h>
using namespace std;

int main(void){
		string a[3];
		int f=0;
		cin >> a[0] >> a[1] >> a[2];
		for(int i=0;i<2;i++){
				int len = a[i].size();
				if(a[i][len-1]!=a[i+1][0]){
						f=1;
						break;
			}
		}
		if(f==0){
				cout << "YES" << endl;
		}else{
				cout << "NO" << endl;
		}
		exit(0);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const int INF = 1001001001;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};

int main() {
string s,ans;
cin >> s;
rep(i,s.size()) {
  if (s[i] == 'B') {
    if (ans == "") continue;
    ans.pop_back();
    continue;
  }
  ans.push_back(s[i]);
}
cout << ans << endl;
    
return 0;
}


Measured memory_bytes: 3596
#include <iostream>
#include <string>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cmath>
#include <stdio.h>
#include <vector>
#define int long long
#define endre getchar();getchar();return 0
using namespace std;
bool prime(int n) {
	for (int i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}
int gcd(int x, int y) {
	if (x < y)swap(x, y);
	if (y == 0)return x;
	return (y, x%y);
}
int lcm(int x, int y) {
	return x * y / gcd(x, y);
}
int kai(int n) {
	if (n == 0)return 1;
	return kai(n - 1)*n;
}
int mod_pow(int x, int y, int mod) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x%mod;
		}
		x = x * x%mod;
		y >>= 1;
	}
	return res;
}
int h, w, a, b;
signed main() {
	cin >> h >> w >> a >> b;
	if ((h*w) % 2 == 0)cout << "Yes" << endl;
	else if ((a + b) % 2 == 0)cout << "Yes" << endl;
	else cout << "No" << endl;
	endre;
}


Measured memory_bytes: 3108
#include<stdio.h>
int main() {
	int n,i,j,min,t=0,mid;
	scanf("%d",&n);
	int a[n+1];
	for(i=0; i<n; i++)
		scanf("%d",&a[i]);
	for(i=0; i<n; i++) {
		min=i;
		for(j=i; j<n; j++) {
			if(a[j]<a[min]) {
				min=j;
			}
		}
		if(min!=i) {
			mid=a[i];
			a[i]=a[min];
			a[min]=mid;
			t++;
		}
	}
	for(i=0; i<n; i++) {
		if(i>0)
			printf(" ");
		printf("%d",a[i]);
	}
	printf("\n%d\n",t);
	return 0;
}


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

#define SQ(x) ((x) * (x))

int main(void)
{
    int n;
    double x1, x2, x3, y1, y2, y3;
    double a, b, c, d, e, f;
    double l, m, g;
    
    cin >> n;
    for (int i = 0; i < n; i++){
        scanf("%lf%lf%lf%lf%lf%lf", &x1, &y1, &x2, &y2, &x3, &y3);
        
        a = (x1 - x2);
        b = (y1 - y2);
        c = -1 * (SQ(x1) - SQ(x2) + SQ(y1) - SQ(y2));
        d = (x1 - x3);
        e = (y1 - y3);
        f = -1 * (SQ(x1) - SQ(x3) + SQ(y1) - SQ(y3));
        
        l = (c * e - b * f) / (e * a - b * d);
        m = (d * c - a * f) / (d * b - e * a);
        
        g = -1 * (SQ(x1) + SQ(y1) + l * x1 + m * y1);
        
        printf("%.3f %.3f %.3f\n", l / -2.0, m / -2.0, sqrt(SQ(l) + SQ(m) - 4 * g) / 2.0);
    }
    
    return (0);
}

Measured memory_bytes: 0
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstring>

using namespace std;

#define INF 2140000000
#define MOD 1000000007

int main() {
	long long n, sum = 0;

	cin >> n;

	for (long long  i = 1; i * i <= n; ++i) {
		if (n % i == 0) {
			if (i != 1 && (n / (i - 1)) * i  == n) {
				sum +=  i - 1;
			}

			long long k = n / i;

			if (k != 1 && (n / (k - 1)) * k  == n) {
				sum +=  k - 1;
			}
		}
	}

	cout << sum << endl;
	return 0;
}

Measured memory_bytes: 256
Imports System.Collections.Generic
Imports System.Console

Module Program
    Sub Main()
        Dim N As Integer = NextInt()
        Dim ans As Integer = 0

        For i As Integer = 0 To N - 1
            Dim l As Integer = NextInt()
            Dim r As Integer = NextInt()
            ans += r - l + 1
        Next
        WriteLine(ans)
    End Sub

    Function NextInt() As Integer
        Return CInt(NextString())
    End Function

    Function NextString() As String
        Dim result As New List(Of Char)
        Do
            Dim tmp As Integer = Read()
            If tmp < 0 Then Exit Do
            Dim nextChar As Char = Chr(tmp)

            If Not Char.IsWhiteSpace(nextChar) Then
                result.Add(nextChar)
            ElseIf nextChar <> vbCr Then
                Exit Do
            End If
        Loop
        Return New String(result.ToArray())
    End Function

End Module


Measured memory_bytes: 19920
#include <stdio.h>
#include <stdlib.h>

int linSearch(int,int[],int);

int main(int argc, char** argv) {
    int size1;
    scanf("%d\n", &size1);
    int array1[size1];
    for(int i = 0; i < size1; i++)
        scanf("%d", &array1[i]);
    
    int size2;
    scanf("%d\n", &size2);
    int array2[size2];
    for(int i = 0; i < size2; i++)
        scanf("%d", &array2[i]);
    
    int searched[size1];
    for(int i = 0; i < size1; i++)
        searched[i] = 0;
    int count = 0;
    int temp;
    for(int i = 0; i < size2; i++){
        temp = linSearch(size1,array1,array2[i]);
        if(temp >= 0 && temp < size1)
            searched[temp]++;
    }
    
    for(int i = 0; i < size1; i++)
        if(searched[i])
            count++;
    
    printf("%d\n", count);
    return (EXIT_SUCCESS);
}

int linSearch(int size, int array[size], int searchVal){
    int i = 0;
    while(array[i] != searchVal && i < size)
        i++;
    if(i == size)
        return -1;
    return i;
}



Measured memory_bytes: 2128
n, k = map(int, input().split(" "))
ps = list(map(int, input().split(" ")))

max = 0
for i in range(n-k+1):
  if i == 0:
    s = sum(ps[i:i+k])
  else:
    s = s - (ps[i-1] - ps[i+k-1])
  if s > max:
    max = s
print((max + k) / 2)

Measured memory_bytes: 25060
import java.io.*;
import java.util.Scanner;
import java.util.Arrays;
import java.util.Comparator;

public class Main{
    public static void main(String args[]){
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        Integer a[] = new Integer [n];
        int sum = 0;
        int flag = 1;

        for(int i = 0;i < n;i++){
            a[i] = scanner.nextInt();
        }

        Arrays.sort(a,Comparator.reverseOrder());
        for(int i = 0;i < n;i++){
            sum += flag * a[i];
            flag = -flag;
        }

        System.out.println(sum);
    }
}

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



int main(){
	int N;
	cin>>N;
	vector<pair<int,int>> ans;
	ans.push_back(make_pair(1,3));
	ans.push_back(make_pair(2,3));
	
	for(int i=4;i<=N;i++){
		if(i%2==0){
			for(int j=0;j<ans.size();j++){
				ans[j].first++;
				ans[j].second++;
			}
			for(int j=0;j<i-2;j++){
				ans.push_back(make_pair(1,j+2));
			}
		}
		else{
			for(int j=0;j<i-1;j++){
				ans.push_back(make_pair(i,j+1));
			}
		}
	}
	
	cout<<ans.size()<<endl;
	
	for(int i=0;i<ans.size();i++){
		cout<<ans[i].first<<' '<<ans[i].second<<endl;
	}
	
	return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
typedef long long ll;
#define vr vector<ll>
#define all(a) a.begin(),a.end()
#define pb push_back
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define DFOR(i,a,b) for(ll i=(a);i>(b);i--)
#define fast ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define PI 3.14159265
using namespace std;

int main()
{
	fast;
    
    
    
    
       ll N,X,S;
        cin>>N>>X>>S;
        ll x,y;
        x=N/X;
        y=N%X;
        
        if(y==0)
        {
            cout<<x*S;
        }
        else if(y!=0)
        {cout<<(x+1)*S;}
    
            
     
	return 0;
}

Measured memory_bytes: 3648
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <cassert>
using namespace std;
typedef long long ll;
const int INF = 1<<30;
const ll MOD = 1e9+7;
const double EPS = 1e-9;

int main(int argc, const char * argv[]) {
  int N, M; cin >> N >> M;
  
  vector<vector<int>> v(M);
  int k, s;
  for(int i=0; i<M; i++){
    cin >> k;
    for(int j=0; j<k; j++){
      cin >> s;
      v[i].push_back(s-1);
    }
  }
  vector<int> p(M);
  for(int i=0; i<M; i++)
    cin >> p[i];
  
  int ans = 0;
  int pn, tmp;
  for(int i=0; i<(1<<N); i++){
    tmp = 0;
    for(int j=0; j<M; j++){
      pn = 0;
      for(auto si: v[j]){
        if((i>>si) & 1) pn++;
      }
      if(pn%2 == p[j]) tmp++;
    }
    if(tmp == M) ans++;
  }
  
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int h,m;
  cin >> h >> m;
  vector<int> count(h);
  for (int i = 0;i < m;i++){
    int a,b;
    cin >> a >> b;
    count.at(a-1) += 1;
    count.at(b-1) += 1;
  }
  for (int i = 0;i < h;i++) cout << count.at(i) << endl;
}

Measured memory_bytes: 256
//0027 What day is today?

//2004N11ú`1231úÜÅÌútðüÍµ½Æ«A»Ìjúð¦Ä­¾³¢
//È¨2004N11úÍØjúÅA2004NÍ[NÅ·

#include<iostream>
#include<numeric>
using namespace std;

int main(void)
{
	const char* week[] = 
	{
		"Monday",
		"Tuesday",
		"Wednesday",
		"Thursday",
		"Friday",
		"Saturday",
		"Sunday",
	};
	//indexÌú
	const int days[13] = 
	{
		0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
	};
	//indexÌ1úÌA11ú©çÌoßú
	int elapsedDays[13];
	partial_sum(days, days+13, elapsedDays);

	int month, day;
	
	while(cin >> month >> day, month)
	{
		cout << week[ (elapsedDays[month-1] + day + 2) %  7] << endl;
	}
	return 0;
}

Measured memory_bytes: 0
// The moment you think of giving up you have already lost the battle
#include <iostream>
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
typedef long long int ll;
typedef long double dl;
#define PI  3.14159265358979323846
#define Mod 1000000007
ll fast(ll n,ll a,ll m)
{
    if(n==0)
        return 1;
    else if(n==1)
        return a;
    else
    {
        ll r=fast(n/2,a,m);
        if(n%2==0)
        {
            return (((r%m)*(r%m))%m);
        }
        else
        {
            return (((((r%m)*a)%m)*r)%m);
        }

    }
}
const ll N=1e7+5;
ll  dp[N+1]={0};
int main()
{
    ll n,i;
    ll j;
    cin>>n;
    for(i=1;i<=n;i++)
    {
        for(j=i;j<=n;j+=i)
        {
            dp[j]++;
        }
    }
    ll ans=0;
    for(i=1;i<=n;i++)
    {
      ll g=i*dp[i];
      ans+=g;
    }
    cout<<ans;





}


Measured memory_bytes: 81756
#include <stdio.h>
#define N 50


int fib(int); 


main(){


  int n;



  scanf("%d",&n);

  printf("%d\n",fib(n));

  return 0;

}


int fib(int n)
{

  int res=0,i,a=1,b=1;
  for(i = 1; i < n; i++){
    res = (a + b);
    b = a;
    a = res;
}

  return a;
}

Measured memory_bytes: 596