akhauriyash/Code-Regression huggingface dataset:
import sys
import numpy as np
import random
from decimal import Decimal
import itertools
import re
import bisect
from collections import deque, Counter
from functools import lru_cache

sys.setrecursionlimit(10**9)
INF = 10**13
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
def SERIES(n): return np.fromstring(sys.stdin.buffer.read(), dtype=np.int32, sep=' ')
def GRID(h,w): return np.fromstring(sys.stdin.buffer.read(), dtype=np.int32, sep=' ').reshape(h,-1)[:,:w]
def GRIDfromString(h,w): return np.frombuffer(sys.stdin.buffer.read(), 'S1').reshape(h,-1)[:,:w]
MOD = 1000000007

def main():
	n, x = LI()
	a_list = LI()
	count = 0

	for i in range(n-1):
		a1, a2 = a_list[i], a_list[i+1]
		if a1 + a2 <= x:
			continue
		else:
			if a1 <= x:
				eat_candy = (a1+a2) - x
				a_list[i+1] -= eat_candy
				count += eat_candy
			else:
				a_list[i] = x
				a_list[i+1] = 0
				count += a1 + a2 - x

	print(count)


if __name__ == '__main__':
    main()

Measured memory_bytes: 36656
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<stdbool.h>
#include<time.h>
#include<math.h>
#include<assert.h>
#define inf 1072114514
#define llinf 4154118101919364364
#define mod 1000000007
#define pi 3.1415926535897932384
int max(int a,int b){if(a>b){return a;}return b;}
int min(int a,int b){if(a<b){return a;}return b;}
int zt(int a,int b){return max(a,b)-min(a,b);}
int gcd(int a,int b){int c;while(b!=0){c=a%b;a=b;b=c;}return a;}
int lcm(int a,int b){int c=gcd(a,b);a/=c;return a*b;}
int nCr(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
int nHr(int a,int b){return nCr(a+b-1,b);}
int fact(int a){int i,r=1;for(i=1;i<=a;i++){r*=i;}return r;}
int dsum(int x){int r=0;while(x){r+=(x%10);x/=10;}return r;}
int dsumb(int x,int b){int r=0;while(x){r+=(x%b);x/=b;}return r;}
int sankaku(int x){return ((1+x)*x)/2;}
void swap(int *a,int *b){int c;c=(*a);(*a)=(*b);(*b)=c;}
//小さい順
int compareInt(const void* a, const void* b){int aNum = *(int*)a;int bNum = *(int*)b;return aNum - bNum;}

int main(void){
    char a[3];
    scanf("%s",a);
    int a1=0,b=0,c=0;
    for(int i=0;i<3;i++){
        if(a[i]=='a'){
            a1++;
        }else if(a[i]=='b'){
            b++;
        }else if(a[i]=='c'){
            c++;
        }
     }
    if(a1*b*c==1){
        printf("Yes");
        return 0;
    }else{
        printf("No");
        return 0;
    }
}


Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <bitset>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <cstring>
#include <utility>
#include <vector>
#include <complex>
#include <valarray>
#include <fstream>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <numeric>

#define rep(X,Y) for (int (X) = 0;(X) < (Y);++(X))
#define rrep(X,Y) for (int (X) = Y-1;(X) >= 0;--(X))
#define repa(X,A,Y) for (int (X) = A;(X) <= (Y);++(X))
#define all(X) (X).begin(),(X).end()
#define mod(n, m) (((n)%(m)+(m))%m)
#define fi first
#define sc second
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
const int INFINT = 1 << 30;                          // 1.07x10^ 9
const ll INFLL = 1LL << 60;                          // 1.15x10^18
const double EPS = 1e-10;
const int MOD = 1000000007;

ll N, A, B;

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

  cin >> N >> A >> B;
  if (N < A+B-1 || N > A*B) {
    cout << -1 << endl;
    return 0;
  }

  vector<int> ans;
  for (int i = 1; i <= A; ++i) ans.push_back(N-A+i);
  int remain = N-A;
  if (B != 1) {
    int size = remain/(B-1);
    int rest = remain%(B-1);
    for (int i = 1; i <= B-1; ++i) {
      if (i <= rest) {
        for (int i = 1; i <= size+1; ++i) {
          ans.push_back(remain-size-1+i);
        }
        remain -= size+1;
      } else {
        for (int i = 1; i <= size; ++i) {
          ans.push_back(remain-size+i);
        }
        remain -= size;
      }
    }
  }

  for (int i = 0; i < ans.size(); ++i) cout << ans[i] << (i+1 == ans.size() ? '\n' : ' ');

  return 0;
}


Measured memory_bytes: 3440
#include <bits/stdc++.h>
#define f first
#define s second
#define MOD 1000000007
#define PMOD 998244353
#define pb(x) push_back(x)
using namespace std;

typedef long long int ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> plii;
typedef pair<int, pii> piii;
const int INF = 1e9+10;
const ll LINF = 1LL*INF*INF;
const int MAXN = 2e5+10;
const int MAXM = 5e3+10;

priority_queue<int> pq;
vector<vector<int> > graph;
queue<int> que;

int A[MAXN];

vector<string> P;

int main()
{
    int n,m,k,a,b,x,y;
    int sum = 0;
    int cnt = 0;
    int mx = 0;
    int mn = INF;
    int cur = 0, idx = -1;

    cin>>n;

    string S;

    for(int i=0;i<n;i++){

        cin>>S;
        sort(S.begin(),S.end());
        P.push_back(S);
    }

    sort(P.begin(),P.end());

    cnt = 1;

    ll res = 0;

    for(int i=1;i<P.size();i++){
        if(P[i]!=P[i-1]){
            res+=(ll)cnt*(cnt-1)/2;
            cnt = 1;
        }
        else cnt++;
    }

    res+=(ll)cnt*(cnt-1)/2;

    cout<<res<<"\n";

    return 0;
}


Measured memory_bytes: 5748
class UnionFind():
 def __init__(self, n):
  self.n = n
  self.parents = [-1] * n

 def find(self, x):
  if self.parents[x] < 0:
   return x
  else:
   self.parents[x] = self.find(self.parents[x])
   return self.parents[x]

 def union(self, x, y):
  x = self.find(x)
  y = self.find(y)

  if x == y:
   return

  if self.parents[x] > self.parents[y]:
   x, y = y, x

  self.parents[x] += self.parents[y]
  self.parents[y] = x

 def size(self, x):
  return -self.parents[self.find(x)]
 def same(self, x, y):
  return self.find(x) == self.find(y)

import sys
input = sys.stdin.readline
N,M,K = map(int,input().split())
uf = UnionFind(N)
lst=[0]*(N)
ans=[0]*(N)
for i in [0]*M:
 A,B=map(int,input().split())
 uf.union(A-1,B-1)
 lst[A-1]+=1
 lst[B-1]+=1
for i in [0]*K:
 A,B=map(int,input().split())
 if uf.same(A-1,B-1):
  lst[A-1]+=1
  lst[B-1]+=1
for i in range(N):
 ans[i]=uf.size(i)-lst[i]-1
L=[str(a) for a in ans]
L=' '.join(L)
print(L)


Measured memory_bytes: 18608
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define mod 1000000007ll
#define mod1 998244353ll
#define endl "\n"
#define inf (ll)1e18+1
using namespace std::chrono;

ll solve(ll h){
    if(h<1){
        return 0;
    }
    if(h==1){
        return 1;
    }
    return 2*solve(h/2)+1;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    ll h;
    cin>>h;
    ll ans=solve(h);
    cout<<ans<<endl;
    return 0;
}

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

#define Fast            ios_base::sync_with_stdio(false);cin.tie(nullptr);
#define fWrite          freopen ("out.txt","w",stdout);
#define TC              int t;cin >> t;FOR(tc,1,t)
#define LL              long long
#define ULL             unsigned long long
#define ff              first
#define ss              second
#define pb              push_back
#define pii             pair<int,int>
#define all(a)          a.begin(),a.end()
#define MEM(a,x)        memset(a,x,sizeof(a))
#define FOR(i,a,b)      for(int i=a;i<=b;i++)
#define ROF(i,a,b)      for(int i=a;i>=b;i--)
#define REP(i,b)        for(int i=0;i<b;i++)

#define Make(x,p)       (x  (1<<p))
#define DeMake(x,p)     (x & ~(1<<p))
#define Check(x,p)      (x & (1<<p))
#define popcount(x)     __builtin_popcount(x)

int main()
{
    int x,y,a,b,c;
    cin >> x >> y >> a >> b >> c;
    priority_queue<pii>pq;
    FOR(i,1,a){
        int tmp;
        cin >> tmp;
        pq.push({tmp,1});
    }
    FOR(i,1,b){
        int tmp;
        cin >> tmp;
        pq.push({tmp,2});
    }
    FOR(i,1,c){
        int tmp;
        cin >> tmp;
        pq.push({tmp,3});
    }
    int p=0,q=0,r=0;
    LL sum=0;
    vector<LL>v;
    while(p+q+r!=x+y){
        pii pp=pq.top();
        pq.pop();
        if(pp.ss==1 and p<x){
            sum+=(LL)pp.ff;
            p++;
        }
        else if(pp.ss==2 and q<y){
            sum+=(LL)pp.ff;
            q++;
        }
        else if(pp.ss==3){
            v.pb(pp.ff);
            r++;
        }
        //cout << "---> " << sum << ' ' << pp.ff << ' ' << pp.ss << '\n';
    }
    int i=0;
    while(p!=x){
        p++;
        sum+=v[i];
        i++;
    }
    while(q!=y){
        q++;
        sum+=v[i];
        i++;
    }
    cout << sum;
}


Measured memory_bytes: 6516
#include<cstdio>
#include<algorithm>
#include<functional>
using namespace std;
int main(void)
{
	float yama,max,min,x;
	max=-1;
	min=1000.0;
	while(scanf("%f",&yama)!=EOF){
		if(max<yama){
			max=yama;
		}
		else if(min>yama){
			min=yama;
		}
	}
	x=max-min;
	printf("%f\n",x);
	return 0;
}

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

#define _USE_MATH_DEFINES
#include<cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iterator>
#include<iomanip>
#include<unordered_set>
#include<bitset>
#include<complex>

using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

#define int ll
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

//typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pdd;
typedef vector< vector<int> > mat;

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

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;

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

	string A, B, C;
	cin >> A >> B >> C;

	if (A.back() == B.front() && B.back() == C.front())
	{
		cout << "YES" << endl;
	}
	else
	{
		cout << "NO" << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#pragma region template
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using vld = vector<ld>;
using vvld = vector<vld>;
using vvvld = vector<vvld>;
using vs = vector<string>;
using pll = pair<ll, ll>;
using vp = vector<pll>;
template <typename T>
using pqrev = priority_queue<T, vector<T>, greater<T>>;
#define rep(i, n) for (ll i = 0, i##_end = (n); i < i##_end; i++)
#define repb(i, n) for (ll i = (n)-1; i >= 0; i--)
#define repr(i, a, b) for (ll i = (a), i##_end = (b); i < i##_end; i++)
#define reprb(i, a, b) for (ll i = (b)-1, i##_end = (a); i >= i##_end; i--)
#define ALL(a) (a).begin(), (a).end()
#define SZ(x) ((ll)(x).size())
//*
constexpr ll MOD = 1e9 + 7;
/*/
constexpr ll MOD = 998244353;
//*/
constexpr ll INF = 1e+18;
constexpr ld EPS = 1e-12L;
constexpr ld PI = 3.14159265358979323846L;
constexpr ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }
constexpr ll LCM(ll a, ll b) { return a / GCD(a, b) * b; }
template <typename S, typename T>
constexpr bool chmax(S &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <typename S, typename T>
constexpr bool chmin(S &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
#ifdef OJ_LOCAL
#include "dump.hpp"
#else
#define dump(...) ((void)0)
#endif
template <typename T>
bool print_(const T &a) {
  cout << a;
  return true;
}
template <typename T>
bool print_(const vector<T> &vec) {
  for (auto &a : vec) {
    cout << a;
    if (&a != &vec.back()) {
      cout << " ";
    }
  }
  return false;
}
template <typename T>
bool print_(const vector<vector<T>> &vv) {
  for (auto &v : vv) {
    for (auto &a : v) {
      cout << a;
      if (&a != &v.back()) {
        cout << " ";
      }
    }
    if (&v != &vv.back()) {
      cout << "\n";
    }
  }
  return false;
}
void print() { cout << "\n"; }
template <typename Head, typename... Tail>
void print(Head &&head, Tail &&... tail) {
  bool f = print_(head);
  if (sizeof...(tail) != 0) {
    cout << (f ? " " : "\n");
  }
  print(forward<Tail>(tail)...);
}
#pragma endregion

void Pr(bool f){
  cout << (f ? "Yes" : "No") << "\n";
  exit(0);
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(20);
  string s;
  cin >> s;
  ll n = SZ(s)-1;
  if(s[n]=='s'){
    cout << s << "es" << endl;
  }else{
    cout << s << "s" << endl;
  }
}


Measured memory_bytes: 3652
#include <iostream>
#include <climits>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <string>
#include <deque>
#define INF_INT (INT_MAX / 2)
#define INF_LONG (LONG_MAX / 2)
//#define DEBUG true
#define DEBUG false
using namespace std;

const int MAX = 100001;
const int MOD = 1000000007;

typedef long long ll;
typedef pair< int, int > pii;
typedef pair< ll, ll > pll;
typedef pair< ll, int > pli;
typedef pair< int, ll > pil;

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

  int n;
  cin >> n;
  double t, a;
  cin >> t >> a;
  double h[n];
  for(int i = 0; i < n; i++) cin >> h[i];

  int i = 0;
  for(int j = 1; j < n; j++){
    if(abs(a - (t - h[i] * 0.006)) > abs(a - (t - h[j] * 0.006))) i = j;
  }

  cout << (i + 1) << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i=0; i<(int)(n); i++)
#define REP1(i,a,b) for(int i=a; i<=(int)(b); i++)
#define ALL(x) begin(x),end(x)
#define PB push_back
using namespace std;
typedef int64_t LL;
typedef vector<int> VI;
typedef pair<int,int> PII;

template<class T> inline bool chmax( T &a, const T &b ) { return b>a ? a=b,true : false; }
template<class T> inline bool chmin( T &a, const T &b ) { return b<a ? a=b,true : false; }
template<class T> using MaxHeap = priority_queue<T>;
template<class T> using MinHeap = priority_queue<T, vector<T>, greater<T>>;
template<class T, class F=less<T>> void sort_uniq( vector<T> &v, F f=F() ) {
    sort(begin(v),end(v),f);
    v.resize(unique(begin(v),end(v))-begin(v));
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int x,a,b;
    cin >> x >> a >> b;
    if ( b<=a ) {
        cout << "delicious" << '\n';
    }
    else if ( b<=a+x ) {
        cout << "safe" << '\n';
    }
    else {
        cout << "dangerous" << '\n';
    }


    return 0;
}

Measured memory_bytes: 3592
import sys
a=int(input())
b=sorted([list(map(int,input().split())) for i in range(a)],key=lambda x:x[1])
sofar=0
flag=True
for i in b:
    sofar+=i[0]
    if sofar>i[1]:
        print('No')
        sys.exit()
print('Yes')

Measured memory_bytes: 55568
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <cctype>
#include <cmath>
#include <vector>
#include <climits>
#include <queue>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
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; }
const ll MOD = 1000000007;
const ll INF = 1LL << 60;


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

	cout << n * m;





}

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

int main() {
    string s,t;
    cin>>s;
    cin>>t;
    int len = s.length();
    string x = t.substr(0,len);
    if(x==s && t.length()==len+1){
        cout<<"Yes";
    }
    else{
        cout<<"No";
    }
    return 0;
}


Measured memory_bytes: 3600
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
using vll = vector<vl>;
using Pll = pair<ll, ll>;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(v) v.begin(), v.end()
#define sz(x) ((int) x.size())
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define F first
#define S second
const int MOD = 1e9+7;
const ll INF = 2e15;
template<class T> void print(const T& t){ cout << t << endl; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}

int main(){
  ll h,n;
  cin>>h>>n;
  vl a(n+1);
  vl b(n+1);
  for(ll i=1;i<=n;i++){
    cin>>a[i]>>b[i];
  }
  ll dp[n+1][h+1];
  dp[0][0]=0;
  for(ll i=1;i<=h;i++){
    dp[0][i]=INF;
  }
  for(ll i=1;i<=n;i++){
    rep(j,a[i]){
      if(dp[i-1][j]>b[i]){
        dp[i][j]=b[i];
      }
      else{
        dp[i][j]=dp[i-1][j];
      }
      if(j==h){
        break;
      }
    }
    for(ll j=a[i];j<=h;j++){
      if(dp[i-1][j]>dp[i][j-a[i]]+b[i]){
        dp[i][j]=dp[i][j-a[i]]+b[i];
      }
      else{
        dp[i][j]=dp[i-1][j];
      }
    }
  }
  print(dp[n][h]);
}

Measured memory_bytes: 81796
#include <iostream>
#include <string>
#include <limits.h>
#include <numeric>
#include <bits/stdc++.h>
#include <cmath>
#define rep(i,c) for (int i=0;i<c;i++)
using namespace std;
typedef long long ll;

int main(){
  int A,B;
  cin >> A >> B;
  cout << A*B << endl;

}

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

int main()
{
  int N,K;
  cin >> N >> K;

  int x;
  int sum = 0;

  for (int i = 0; N > i; i++) {
    cin >> x;
    int k = K;

    if (x > K) {
      k = x - K;
    } else if (x < K) {
      k = K - x;
    } else {
      k = 0;
    }

    if (k > x) {
      sum += x * 2;
    } else if (x > k) {
      sum += k * 2;
    } else {
      sum += x * 2;
    }
  }

  cout << sum << endl;
}

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

#define x first
#define y second

using namespace std;

const int N = 1e3 + 7;

struct node
{
    int x, y;
};

pair<int, int> a[N], b[N];
map<pair<int, int>, bool> u;

int ans;

bool cmp(pair<int, int>a, pair<int, int>b)
{
    if (a.y > b.y)return 1;
    else if (a.y == b.y)
        return (a.x > b.x);

    return 0;
}

main()
{
    int n;

    cin >> n;

    for (int i = 0; i < n; i++)
    {
        cin >> a[i].x >> a[i].y;
    }
    for (int i = 0; i < n; i++)
    {
        cin >> b[i].x >> b[i].y;
    }

    sort(b, b + n);
    sort(a, a + n, cmp);

    for (int i = 0; i < n; i++)
    {
        int mx = 0, my = 0;
        for (int j = 0; j < n; j++)
        {
            if (b[i].x > a[j].x && b[i].y > a[j].y && !u[a[j]])
            {
                ans++;
                u[a[j]] = 1;
                break;
            }
        }
    }

    cout << ans;
}




Measured memory_bytes: 256
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#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 <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

#define SORT(c) sort((c).begin(),(c).end())
#define ANS(ans) cout<<(ans)<<endl;


//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  for(int i=0;i<(n);++i)
#define VI(v,n) vector<int> (v)((n))


int main() {
	int n, m, k;

	cin >> n >> m >> k;
	

	FOR(i, 0, n) {
		FOR(j, 0, m) {
			if (i*(m - j) + (n - i)*j == k) {
				cout << "Yes" << endl;
				return 0;
			}
		}
	}
	cout << "No" << endl;
	


	return 0;
}



Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define FOR(i,a,b) for(int i =(a);i<(b);i++)
#define REP(i,n) for(int i=0;i<(n);i++)
#define REPm(i,n) for(int i=(n)-1;i>=0;i--)
#define REP1(i,n) for(int i=1;i<=(n);i++)
#define mp make_pair
typedef long long ll;
int main(){
    int a,b,c;
    cin >> a >> b >> c;
    if(b-a == c-b) cout << "YES" << endl;
    else cout << "NO" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int n;
vector <vector <int> > input;
vector <int> dp;
int func(int node)
{
    if(input[node].size() == 0)
        return 0;
    if(dp[node] != -1)
        return dp[node];
    int result = 0;
    for(int i=0;i<input[node].size();i++)
    {
        result = max(result,1+func(input[node][i]));
    }
    return dp[node] = result;
}
int main()
{
    int n,m;cin>>n>>m;
    input.clear();
    input.resize(n+1);
    for(int i=0;i<m;i++)
    {
        int a,b;
        cin>>a>>b;
        input[a].push_back(b);
    }
    dp.clear();
    dp.resize(n+1,-1);
    int ans =1;
    for(int i=1;i<=n;i++)
    {
        if(dp[i] == -1)
        {
            ans = max(ans,func(i));
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 8192
import Control.Applicative
import Data.List

main :: IO ()
main = solve <$> f >>= print
  where
    f = map read <$> words <$> getLine

solve :: [Int] -> Int
solve [n, k] = length $ unfoldr f n
  where
    f 0 = Nothing
    f x = let (q, r) = divMod x k in Just (r, q)


Measured memory_bytes: 508
#include <cstdio>
#include <utility>
#include <vector>
#include <complex>
#include <cmath>
#include <algorithm>
#include <functional>

using namespace std;

static const double EPS=1e-12;
static const double INF=1e24;

using Point=complex<int>;
using Plane=vector<Point>;
using Polygon=vector<Point>;

bool operator<(const Point &a, const Point &b) {
    return real(a)!=real(b)? real(a)<real(b) : imag(a)<imag(b);
}

double cross_prod(const Point &a, const Point &b) {
    return imag(conj(a)*b);
}

double dot_prod(const Point &a, const Point &b) {
    return real(conj(a)*b);
}

enum {
    ONLINE_FRONT=-2,
    CLOCKWISE,
    ON_SEGMENT,
    COUNTER_CLOCKWISE,
    ONLINE_BACK,
};

int ccwise(Point a, Point b, Point c) {
    b -= a; c -= a;

    if (cross_prod(b, c) > 0) {
        return COUNTER_CLOCKWISE;
    } else if (cross_prod(b, c) < 0) {
        return CLOCKWISE;
    } else if (dot_prod(b, c) < 0) {
        return ONLINE_BACK;
    } else if (norm(b) < norm(c)) {
        return ONLINE_FRONT;
    } else {
        return ON_SEGMENT;
    }
}

Polygon convex_hull(Polygon g) {
    size_t V=g.size(), k=0;
    sort(g.begin(), g.end(), [](const Point &x, const Point &y) {
        return imag(x)!=imag(y)? imag(x)<imag(y) : real(x)<real(y);
    });

    Polygon chull(V<<1);
    for (size_t i=0; i<V; chull[k++]=g[i++])
        while (k >= 2) {
            int state=ccwise(chull[k-2], chull[k-1], g[i]);
            if (state > 0 || state < -1)
                break;

            --k;
        }

    for (size_t i=V-2, t=k+1; ~i; chull[k++]=g[i--])
        while (k >= t) {
            int state=ccwise(chull[k-2], chull[k-1], g[i]);
            if (state > 0 || state < -1)
                break;

            --k;
        }

    chull.resize(k-1);
    return chull;
}

int main() {
    size_t n;
    scanf("%zu", &n);

    Polygon g(n);
    for (size_t i=0; i<n; ++i) {
        int x, y;
        scanf("%d %d", &x, &y);
        g[i] = Point(x, y);
    }

    Polygon h=convex_hull(g);
    printf("%zu\n", h.size());
    for (size_t i=0; i<h.size(); ++i)
        printf("%d %d\n", real(h[i]), imag(h[i]));

    return 0;
}

Measured memory_bytes: 5464
#include <iostream>

using namespace std;

int solve(long long n, long long c, int th, int fo, int fi) {
    return (10 * c + 3 <= n ? solve(n, 10 * c + 3, th + 1, fo, fi) + (fo > 0 && fi > 0 ? 1 : 0) : 0)
        + (10 * c + 5 <= n ? solve(n, 10 * c + 5, th, fo + 1, fi) + (th > 0 && fi > 0 ? 1 : 0) : 0)
        + (10 * c + 7 <= n ? solve(n, 10 * c + 7, th, fo, fi + 1) + (th > 0 && fo > 0 ? 1 : 0) : 0);
}

int main() {
    long long n;
    cin >> n;
    cout << solve(n, 0LL, 0, 0, 0) << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
#define REP(i,n) for(int i=0;i<(n);i++)
int main(){
	bool present[30]={false};
	int a;
	REP(i,28){
		cin>>a;
		present[a-1]=true;
	}
	a=find(present,present+30,false)-present;
	cout<<a+1<<endl;
	a=find(present+a+1,present+30,false)-present;
	cout<<a+1<<endl;
}

Measured memory_bytes: 1160
#include<iostream>
using namespace std;
 
bool check(int n, int maxi){
  for (int i = maxi; i > 0; i--) {
    if(n >= i){
      n -= i;
    }
  }
  return (n == 0);
}
 
int main(){
  int n;
  std::cin >> n;
  int l = 0, r = n, mid = (r + l)/2;
  while(r - l > 1){
    if(check(n, mid)){
      r = mid;
    }else{
      l = mid;
    }
    mid = (l + r)/2;
  }
  for (int i = r; i > 0; i--) {
    if(n >= i){
      std::cout << i << std::endl;
      n -= i;
    }
  }
  return 0;
}

Measured memory_bytes: 256
#include <cstdio>

#define int long long

int L,R,ans(2019),mark;

signed main() {
	scanf("%lld%lld",&L,&R);
	if(R>=L+2019)
		mark=1;
	while(L>=2019)
		L-=2019;
	while(R>L+2019)
		R-=2019;
	if(mark)
		R+=2019;
	for(int i=L;i<R;++i)
		for(int j=i+1;j<=R;++j)
			if(i*j%2019<ans)
				ans=i*j%2019;
	printf("%lld",ans);
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
int n,m;
ll c[5005],e[5005][205];
ll ans;
struct segtree{
	int seg[(1<<14)];
	void init(int a,int x){
		a += (1<<13)-1; seg[a] = x;
		while(a){
			a=(a-1)/2;
			seg[a] = max(seg[a*2+1],seg[a*2+2]);
		}
	}
	int query(int a,int b,int k,int l,int r){
		if(r<a||b<l) return 0;
		if(a<=l&&r<=b) return seg[k];
		return max(query(a,b,k*2+1,l,(l+r)/2),query(a,b,k*2+2,(l+r)/2+1,r));
	}
}S[205];
pair<ll,int> score(int L,int R,int RR){
	ll y[205];
	pair<ll,int> X = mp(-1e18,0);
	ll sum = 0;
	for(int i=1;i<=m;i++){
		y[i] = S[i].query(L,R,0,0,(1<<13)-1);
		sum += y[i];
	}
	X = max(X,mp(sum+c[L-1]-c[R-1],R));
	for(int i=R+1;i<=RR;i++){
		for(int j=1;j<=m;j++){
			if(y[j] < e[i][j]){
				sum += e[i][j]-y[j];
				y[j] = e[i][j];
			}
		}
		X = max(X,mp(sum+c[L-1]-c[i-1],i));
	}
	return X;
}
void go(int L,int R,int a,int b){
	if(L>R || a>b) return;
	int mid = (L+R)/2;
	int p[205]={};
	pair<ll,int> X = mp(-1e18,0);
	for(int x=a;x<=b;x++){
		if(x>=mid){
			X = max(X,score(mid,x,b));
			break;
		}
	}
	ans = max(ans,X.fi);
	go(L,mid-1,a,X.sc);
	go(mid+1,R,X.sc,b);
}
int main(){
	cin >> n >> m;
	for(int i=1;i<n;i++) scanf("%lld",&c[i]);
	for(int i=2;i<n;i++) c[i] += c[i-1];
	for(int i=1;i<=n;i++) for(int j=1;j<=m;j++){
		scanf("%lld",&e[i][j]); S[j].init(i,e[i][j]);
	}
	
	go(1,n,1,n);
	cout << ans << endl;
}

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

long long a[500];
int parent(int i)
{
    return i/2;
}
int left(int i)
{
    return 2*i;
}
int right(int i)
{
    return 2*i+1;
}
int main()
{
    int H, p, l, r;
    cin >> H;
    for(int i=1; i<=H; i++)
        cin >> a[i];
    for(int i=1; i<=H; i++)
    {
        p = parent(i);
        l = left(i);
        r = right(i);
        cout << "node " << i << ": " << "key = " << a[i] << ", ";
        if(parent(i)>=1) cout << "parent key = " << a[p] << ", ";
        if(left(i)<=H)   cout << "left key = " << a[l] << ", ";
        if(right(i)<=H)  cout << "right key = " << a[r] << ", ";
        cout << endl;
    }
    return 0;
}

Measured memory_bytes: 3020
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <climits>
#include <cassert>
#include <cmath>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
#define rep(i, a, b) for(int i = a, i##_END_ = b; i < i##_END_; ++i)
#define per(i, a, b) for(int i = (b)-1, i##_BEGIN_ = a; i >= i##_BEGIN_; --i)
typedef long long ll;
typedef double db;
const int inf = (int)1e9;
const ll linf = (ll)1e18;
typedef pair<int, int> pii;
typedef vector<int> vi;
#define x first
#define y second
#define pb(x) push_back(x)
#define sz(x) (int)(x).size()
template<class T>
inline void read(T &x){
	char c; x = 0;
	bool neg = false;
	while(c = getchar(), c!='-' && (c<'0'||c>'9'));
	if(c == '-') neg = true, c = getchar();
	do x = (x*10) + (c^48);
	while(c = getchar(), c>='0'&&c<='9');	
	if(neg) x = -x;
}
template<class T>
inline void print(T x){
	if(x == 0){ putchar('0'); return;}
	if(x < 0){ putchar('-'); x = -x;}
	static char stk[30]; int top = 0;
	while(x) stk[++top] = x%10^48, x /= 10;
	while(top) putchar(stk[top--]);
}
#ifdef Leefir
	#define ast(x) assert(x)
	#define dig(...) fprintf(stderr, __VA_ARGS__)
#else
	#define ast(x) ;
	#define dig(...) ;
#endif

namespace Program{

const int N = (int)2e5;
const int M = (int)2e5;
int n, m;
char str[N+5];
vi vec[N+5];
int cnt[N+5][2];
void input(){
	scanf("%d %d", &n, &m);
	scanf("%s", str);
	rep(i, 0, n) str[i] -= 'A';	
	rep(i, 0, n) cnt[i][0] = cnt[i][1] = 0;
	rep(i, 0, n) vec[i].clear();
	rep(i, 0, m){
		int x, y; scanf("%d %d", &x, &y);
		--x; --y;
		cnt[x][str[y]]++;
		cnt[y][str[x]]++;
		vec[x].pb(y);
		vec[y].pb(x);
	}
}
bool del[N+5];
void solve(){
	rep(i, 0, n) del[i] = false;
	static int que[N+5];
	int qh = 0, qt = 0;
	rep(i, 0, n) if(cnt[i][0] == 0 || cnt[i][1] == 0) que[qt++] = i, del[i] = true;
	while(qh < qt){
		int u = que[qh++];
		rep(i, 0, sz(vec[u])){
			int v = vec[u][i];
			cnt[v][str[u]]--;
			if(cnt[v][0] == 0 || cnt[v][1] == 0){
				if(!del[v]) que[qt++] = v, del[v] = true;
			}
		}
	}
	bool ok = false;
	rep(i, 0, n) if(del[i] == false) ok = true;
	if(ok) puts("Yes");
	else puts("No");
}
void Main(){
	input();
	solve();
}

} //namespace Program
int main(){
#ifdef Leefir
	dig("**********define Leefir***********\n");
#endif
	srand(time(NULL));
	
	Program::Main();
	
	return 0;
}


Measured memory_bytes: 12800
#include<stdio.h>


int main(){
    int n,k,a[1010],i,tmp=0,all=0;

    scanf("%d %d",&n,&k);
    

    for(i=0;i<n;i++){
        scanf("%d",&a[i]);

    }
    for(i=0;i<n;i++){
        for(int j=i+1;j<n;j++){
            if(a[i]>a[j]){
            tmp=a[i];
            a[i]=a[j];
            a[j]=tmp;
            }
        }
    }

    for(i=0;i<k;i++){
        all+=a[i];

    }
    printf("%d",all);



    return 0;
}

Measured memory_bytes: 1740
#include <bits/stdc++.h>
#include <ext/rope>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#define int long long
#define pb push_back
#define x first
#define y second
#define mk(a,b) make_pair(a,b)
#define rr return 0
#define sqr(a) ((a)*(a))
#define all(a) (a).begin(), (a).end()
#define sz(a) (int)(a).size()

using namespace std;
using namespace __gnu_cxx;
using namespace __gnu_pbds;

using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

template<class value, class cmp = less<value> >
using ordered_set = tree<value, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
template<class value, class cmp = less_equal<value> >
using ordered_multiset = tree<value, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
template<class key, class value, class cmp = less<key> >
using ordered_map = tree<key, value, cmp, rb_tree_tag, tree_order_statistics_node_update>;

/// find_by_order()
/// order_of_key()
mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
inline int randll(int l = INT_MIN, int r = INT_MAX) {
    return uniform_int_distribution<int>(l, r)(rng);
}
const int INF = 1e9, MOD = 1e9 + 7; /// think
const ll LINF = 1e18;


const int dx[] = {0, 0, 1, -1}, dy[] = {1, -1, 0, 0};
inline bool inside (int x, int y, int n, int m) {
    return 0 <= x && 0 <= y && x < n && y < m;
}

template<class T> bool umin (T &a, T b) {return a > b ? (a = b, true) : false; }
template<class T> bool umax (T &a, T b) {return a < b ? (a = b, true) : false; }

main()
{
    ios::sync_with_stdio(0);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int a, b;
    cin >> a >> b;
    if (a <= 9 && b <= 9) {
        cout << a * b << '\n';
    }
    else cout << "-1\n";
}


Measured memory_bytes: 3620
S = input()

s1 = int(S[:2])
s2 = int(S[2:])

def is_month(ss):
    if ss > 0 and ss <= 12:
        return True
    else:
        return False

if is_month(s1) and is_month(s2):
    print('AMBIGUOUS')
elif is_month(s1) and not is_month(s2):
    print('MMYY')
elif is_month(s2) and not is_month(s1):
    print('YYMM')
else:
    print('NA')


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
typedef long double ld;
typedef long long ll;
typedef pair<double, double> pdd;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<int, int> pii;
typedef vector<pii> vii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
//const int mod = ;

int n;
int pw = 1;

int ind(int i) {
  if (i <= pw - 1) return i;
  else return i - (pw - 1) + n;
}

int main() {
  std::ios::sync_with_stdio(false); std::cin.tie(0);
  if (0) for (int pw = 4; pw <= (1 << 17); pw *= 2) {
    int cur = 0;
    vi was(pw);
    for (int i = 1; i < pw; ++i) {
      cur ^= i;
      was[cur] = was[cur ^ 1] = 1;
    }
    cur = 0;
    for (int i = pw - 1; i > 0; --i) {
      cur ^= i;
      was[cur] = was[cur ^ 1] = 1;
    }
    for (int i = 2; i < pw; ++i) if (!was[i]) {
      cerr << pw << ' ' << i << endl;
    }
  }
  cin >> n;
  while (pw * 2 <= n) pw *= 2;
  if (pw == n) {
    cout << "No\n";
    return 0;
  }
  cout << "Yes\n";
  if (n == 3) {
    for (int i = 1; i < 2 * n; ++i) cout << i << ' ' << i + 1 << endl;
    return 0;
  }
  for (int i = 1; i < 2 * (pw - 1); ++i) {
    cout << ind(i) << ' ' << ind(i + 1) << '\n';
  }
  cout << pw << ' ' << ind(pw) << '\n'; 
  cout << pw + 1 << ' ' << ind(pw) << '\n'; 
  cout << pw << ' ' << n + pw + 1 << '\n'; 
  cout << n + pw << ' ' << pw + 1 << '\n';
  vi done(n + 1);
  int cur = 0;
  for (int i = 1; i < pw; ++i) {
    cur ^= i;
    for (int t = 0; t < 2; ++t) {
      int xr = pw + (cur ^ t);
      if (xr <= n && xr >= pw + 2 && !done[xr]) {
        done[xr] = 1;
        cout << xr + n << ' ' << n + i << '\n';
        cout << xr << ' ' << pw + t << '\n';
      }
    }
  }
  cur = 0;
  for (int i = pw - 1; i > 0; --i) {
    cur ^= i;
    for (int t = 0; t < 2; ++t) {
      int xr = pw + (cur ^ t);
      if (xr <= n && xr >= pw + 2 && !done[xr]) {
        done[xr] = 1;
        cout << xr + n << ' ' << i << '\n';
        cout << xr << ' ' << pw + 1 - t << '\n';
      }
    }
  }
  for (int i = pw + 2; i <= n; ++i) {
    if (!done[i]) cerr << i << endl;
    assert(done[i]);
  }
  return 0;
}


Measured memory_bytes: 3200
def combination(n, r, m):
    res = 1
    r = min(r, n - r)

    for i in range(r):
        res = res * (n - i) % m
        res = res * pow(i + 1, m - 2, m) % m
    return res

mod = 10**9 + 7
n, a, b = map(int, input().split())
total = pow(2, n, mod) - 1

total -= (combination(n, a, mod) + combination(n, b, mod)) % mod

print(total % mod)

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

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int testcase=1;
    //cin>>testcase;
    for(int p=0;p<testcase;p++){
    ll x=0,n=0;
    cin>>x>>n;
    if(n==0)
    cout<<x;
    else {
        int array[101]={0};
        int hash[301]={0};
        for(int i=0;i<n;i++){
            cin>>array[i];
            hash[array[i]+100]++;
            
        }
        ll min=999,max=0;
        for(int i=0;i<100;i++){
            if(hash[x-i+100]==0)
            {
                min=x-i;
                break;
            }
        }
        for(int i=0;i<100;i++){
            if(hash[x+i+100]==0)
            {
                max=x+i;
                break;
            }
        }
        //cout<<min<<' '<<max<<' '<<"\n";
        if(abs(min-x)<=abs(max-x))
        cout<<min;
        else
        cout<<max;
    }
    
        
    }

    return 0;
}


Measured memory_bytes: 3636
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <iostream>
#include <vector>
#include <algorithm>
#include <assert.h>
#include <string>
#include <stdio.h>
#include <time.h>

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int inf_int = 1e9 + 100;
const ll inf_ll = 1e18;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef long double dbl;
#define pb push_back
#define eb emplace_back
const double pi = 3.1415926535898;
#define dout if(debug) cout
#define fi first
#define se second
#define sp setprecision
#define sz(a) (int(a.size()))
#define mp make_pair
#define all(a) a.begin(),a.end()
bool debug = 0;
const int MAXN = 4e5 + 100;
const int LOG = 21;
const int mod = 1e9 + 7;
const int MX = (1e7 + 100) * 1.5;
typedef long long li;
const li MOD = 1000000000949747713ll;

template<class T1, class T2>
std::ostream &operator<<(std::ostream &out, const std::pair<T1, T2> &rhs) {
    out << "( " << rhs.first << " , " << rhs.second << " )";
    return out;
}


ll dp[2][3010][2];

void solve() {
    int n, m;
    cin >> n >> m;


    for (int i = 0; i <= n; ++i) {
        dp[0][i][0] = 1;
    }

    for (int i = 1; i <= m; ++i) {
        int nxt = i & 1;
        memset(dp[nxt], 0, sizeof dp[nxt]);
        for (int j = 0; j <= n; ++j) {
            for (int k = 0; k < 2; ++k) {
                dp[nxt ^ 1][j][k] %= mod;
                //RR
                if (j > 1) {
                    dp[nxt][j - 1][k] += dp[nxt ^ 1][j][k];
                } else if (j == 1) {
                    dp[nxt][j - 1][1] += dp[nxt ^ 1][j][k];
                }

                //RB
                if (j > 1) {
                    dp[nxt][j][k] += dp[nxt ^ 1][j][k];
                } else if (j == 1) {
                    dp[nxt][j][1] += dp[nxt ^ 1][j][k];
                }
                //BR
                if (j + 1 <= n && j > 0) {
                    dp[nxt][j][k] += dp[nxt ^ 1][j][k];
                } else if (j == 0) {
                    dp[nxt][j][1] += dp[nxt ^ 1][j][k];
                }
                //BB
                if (j + 1 <= n && j > 0) {
                    dp[nxt][j + 1][k] += dp[nxt ^ 1][j][k];
                } else if (j == 0) {
                    dp[nxt][j + 1][1] += dp[nxt ^ 1][j][k];
                }

            }
        }

    }
    ll ans = 0;
    for (int i = 0; i <= n; ++i) {
        ans += dp[m & 1][i][1];
    }
    ans %= mod;
    cout << ans;

}

signed main() {
#ifdef zxc
    debug = 0;
   // freopen("../input.txt", "r", stdin);
    //  freopen("../output.txt", "w", stdout);
#else

#endif //zxc
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cout.setf(ios::fixed);
    cout.precision(20);

    debug = 1;
    int t = 1;
    while (t--)
        solve();
    if (debug)
        cerr << endl << "time : " << (1.0 * clock() / CLOCKS_PER_SEC) << endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define MOD 1000000007
#define MAX 2100000

int main(){
  int N;
  ll C;
  cin>>N>>C;
  vector<ll> x(N),v(N);
  for(int i=0;i<N;i++){
    cin>>x.at(i)>>v.at(i);
  }

  vector<ll> plus(N+1,0),plus1(N+1,0);
  ll sum=0;
  for(int i=0;i<N;i++){
    sum+=v.at(i);
    plus.at(i+1)=max<ll>(plus.at(i),sum-x.at(i));
  }
  sum=0;
  for(int i=N-1;i>=0;i--){
    sum+=v.at(i);
    plus1.at(i)=max<ll>(plus1.at(i+1),sum-2*(C-x.at(i)));
  }
  vector<ll> minus(N+1,0),minus1(N+1,0);
  sum=0;
  for(int i=N-1;i>=0;i--){
    sum+=v.at(i);
    minus.at(i)=max<ll>(minus.at(i+1),sum-(C-x.at(i)));
  }
  sum=0;
  for(int i=0;i<N;i++){
    sum+=v.at(i);
    minus1.at(i+1)=max<ll>(minus1.at(i),sum-2*x.at(i));
  }
  ll ans=0;
  for(int i=0;i<=N;i++){
    ans=max<ll>(ans,plus.at(i)+plus1.at(i));
    ans=max<ll>(ans,minus.at(i)+minus1.at(i));
  }
  cout<<ans<<endl;

}


Measured memory_bytes: 4992
S=input()
if S=='SUN':
    print(7)
elif S=='MON':
    print(6)
elif S=='TUE':
    print(5)
elif S=='WED':
    print(4)
elif S=='THU':
    print(3)
elif S=='FRI':
    print(2)
elif S=='SAT':
    print(1)

Measured memory_bytes: 3060
import sys
N = int(input())
A = list(map(int, input().split()))
cusum = [0 for i in range(N+1)]
cusum[N] = A[N]

if N == 0 and A[0] > 1:
    print(-1)
    sys.exit()

for i in range(N-1, -1, -1):
    cusum[i] = cusum[i+1] + A[i]

# print(cusum)
pre_node = 1
ans = 1
for i in range(1, N+1):
    node = (pre_node - A[i-1]) * 2
    if node < A[i]:
        ans = -1
        break
    pre_node = min(node, cusum[i])
    ans += pre_node
print(ans)
    


Measured memory_bytes: 90984
#import 
#=input()
n=int(input())
#=map(int,input().split())
a=[0]
a+=list(map(int,input().split()))
#=[list(map(int,input().split())) for _ in range()]

cnt = 0
for i in range(1,n+1,2):
    if a[i] % 2 != 0:
        cnt += 1
print(cnt)

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

// for loop
#define rep(i,a,n) for(int i=(a);i<(n);++i)
#define repe(i,a,n) for(int i=(a);i<=(n);++i)
#define rrep(i,n,a) for(int i=(n);n>(a);--i)
#define rrepe(i,n,a) for(int i=(n);n>=(a);--i)

// abbreviati
#define PB(v) push_back(v)
#define MP make_pair
#define F first
#define S second
#define all(v) v.begin(),v.end()
#define ENDL << "\n"

using ll = long long;
using P = pair<int,int>;
using itn = int;

// constant
const int INF = 1<<30;
const ll INFLL = 1LL << 60;
const ll MOD = 1000000007;
const long double PI =(acos(-1));

/***Snippet***************************************************
ifelse, isprime, torad, todeg, lcm, bfs,chmin,chmax
**************************************************************/

// adjacency list
vector<int> to[100005];

// Graph
using Graph = vector<vector<int>>;

// Grid
int H,W;
vector<vector<int>> field;

// 4方向への移動ベクトル
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};


int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    string s; cin >> s;
    bool flag=0;
    rep(i,1,4){
        if(s[i-1]==s[i]) flag=1;
    }
    if(flag) cout << "Bad" ENDL;
    else cout << "Good" ENDL;
    return 0;
}

Measured memory_bytes: 5984
#include <stdio.h>
#include <math.h>
int kouho[100000][2];
int yakusuu(int a)
{
	int i,j=0;
	for(i = 1; i <= (int)sqrt(a); i++)
	{
		if(a%i == 0)
		{
			kouho[j][0] = i;
			kouho[j][1] = a/i;
			j++;
		}
	}
	return j;
}
int bsort(int d[],int N)
{
	int i, j,tmp;
	for ( i = 0 ; i < N-1; i++)
	{
		for(j = N-1; j > i; j--)
		{
			if(d[j] < d[j-1])
			{
				tmp = d[j];
				d[j] = d[j-1];
				d[j-1] = tmp;
			}
		}
	}
}
int kyori(int k,int K,int A[],int N,int sum)
{
	//printf("\n");
	int i,B[N],C[N],e = k/2,r = 1;
	int plas = 0, mainus = 0,ans = 0,flag = 0;
	//printf("k = %d ,K = %d,N = %d\n",k,K,N);
	for(i = 0 ;i < N ; i++){
		B[i] = A[i]/k;
		C[i] = A[i]%k;
	}
	int j = 0;
	bsort(C,N);
	/*
	for( i = 0; i < N; i++)
	{
		printf("C[%d] = %d\n",i,C[i]);
	}
	*/
	for(i = 0; i < N ; i++)
	{
		plas = 0, mainus = 0;
		for(j = 0; j < i; j++)
		{
			plas+= C[j];
		}
		for(r = i; r < N; r++)
		{
			mainus+=k-C[r];
		}
		//printf("i = %d, plas = %d, mainus = %d\n",i,plas,mainus);
		if(plas == mainus){
			flag = 1;
			break;
		}
	}
	//printf("\n");
	if(flag == 1&&plas <= K)
	{
		return 1;
	}
	else return 0;
}
int main(void)
{
	int N,K;
	scanf("%d %d",&N,&K);
	int i,A[N],sum = 0;
	int ans = 0;
	for(i = 0; i < N; i++){
		scanf("%d",&A[i]);
		sum += A[i];
	}
	int c,k,e,r;
	c = yakusuu(sum);
	for(i = 0; i < c; i++)
	{
		k = kouho[i][1];
		ans = kyori(k,K,A,N,sum);
		if(ans ==1)
		{
			printf("%d",k);
			return 0;
		}
	}
	for(i = c-1; i >= 0; i--)
	{
		k = kouho[i][0];
		if(k == 1)
		{
			printf("%d",k);
			return 0;
		}
		ans = kyori(k,K,A,N,sum);
		if(ans ==1)
		{
			printf("%d",k);
			return 0;
		}
	}
	return 0;
}




Measured memory_bytes: 128
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<vector>
#include<queue>
#include<map>
#include<tuple>
#define rep(index,num) for(int index=0;index<num;index++)
#define rep1(index,num) for(int index=1;index<=num;index++)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-15
#define mp(a1,a2) make_pair(a1,a2)
typedef long long ll;
using namespace std;
typedef pair<ll,ll> pll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
typedef vector<pll> vpll;
ll INFl=1e+18+1;
int INF=1e+9+1;
int main(){
	int N;
	int s[101];
	int summax=0;
	int WAmin=INF;
	scan(N);
	rep(i,N){
		scan(s[i]);
		summax+=s[i];
		if(s[i]%10!=0&&s[i]<WAmin){
			WAmin=s[i];
		}
	}
	if(summax%10==0){
		if(WAmin==INF) prin(0);
		else prin(summax-WAmin);
	}
	else{
		prin(summax);
	}

	return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python
# -*- coding: utf-8 -*-


def main():
  _, m = map(int, input().split())
  traps = [v == '1' for v in input().strip()]
  values = [None] * len(traps)
  values[0] = -1

  for i in range(len(values) - 1):
    if values[i] is None:
      continue

    for j in range(min(i + m, len(values) - 1), i, -1):
      if j >= len(values) or traps[j]:
        continue

      if values[j] is not None:
        break

      values[j] = i

  if values[-1] is None:
    print(-1)
    return

  index = len(values) - 1
  route = []

  while values[index] != -1:
    route.append(index - values[index])
    index = values[index]

  print(' '.join(str(v) for v in route[::-1]))


if __name__ == '__main__':
  main()


Measured memory_bytes: 54708
#include<iostream>
#include<stdio.h>
using namespace std;
int main(){
int x,y;
while(cin>>x>>y){
if(x==0&&y==0) break;
if(x<y){
cout<<x<<" "<<y<<endl;
}
else if(x>y){
cout<<y<<" "<<x<<endl;
}
else if(x==y){
cout<<x<<" "<<y<<endl;
}
}
     return 0;
}

Measured memory_bytes: 1164
#include<stdio.h>
int main(void){
    int n, i, j;
    scanf("%d",&n);
    if((n>0)&&(n<10)) printf("Yes\n");
    else if((n>1)&&(n<19)&&(n%2==0)) printf("Yes\n");
    else if((n>1)&&(n<28)&&(n%3==0)) printf("Yes\n");
    else if((n>1)&&(n<37)&&(n%4==0)) printf("Yes\n");
    else if((n>1)&&(n<46)&&(n%5==0)) printf("Yes\n");
    else if((n>1)&&(n<55)&&(n%6==0)) printf("Yes\n");
    else if((n>1)&&(n<64)&&(n%7==0)) printf("Yes\n");
    else if((n>1)&&(n<73)&&(n%8==0)) printf("Yes\n");
    else if((n>1)&&(n<82)&&(n%9==0)) printf("Yes\n");
    else printf("No\n");
    return 0;
}

Measured memory_bytes: 128
/* ITP1_2_D: Circle in a Rectangle */

#include <iostream>
using namespace std;

bool between(int from, int v, int to) {
    return from <= v && v <= to;
}

int main() {
    int W, H, x, y, r, c_x = 0, c_y = 0;
    cin >> W >> H >> x >> y >> r;

    bool is_inside = between(c_x + r, x, W - r) && between(c_y + r, y, H - r);
    cout << ( is_inside ? "Yes" : "No" ) << endl;
    return 0;
}

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

using ll = long long; using vi = vector<int>; using vll = vector<ll>;
using vvi = vector<vi>; using vvll = vector<vll>;
const int MOD = 1e9 + 7;
const int INF = numeric_limits<int>::max();
const ll INF_MAX = numeric_limits<ll>::max();

int main() {
  int n;
  cin >> n;
  int sum_weight = 0;
  vector<int> arr(n);
  for (int i = 0; i < n; ++i) {
    cin >> arr[i];
    sum_weight += arr[i];
  }
  int min_diff = INF;
  int small = 0;
  for (int i = 0; i < n; ++i) {
    small += arr[i];
    min_diff = min(min_diff, abs(sum_weight - 2 * small));
  }
  cout << min_diff << endl;
}


Measured memory_bytes: 256