akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

#define int long long
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<n;++i)
#define exrep(i, a, b) for(ll i = a; i < b; i++)
#define out(x) cout << x << endl
#define EPS (1e-7)
#define gearup ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<bool> > vvb;
typedef vector<vector<double> > vvd;
typedef vector<vector<string> > vvs;
typedef vector<ll> vl;
typedef vector<vector<ll> > vvl;
typedef vector<vector<vector<ll> > > vvvl;
ll MOD = 1000000007;
const long long L_INF = 1LL << 60;
const int INF = 2147483647; // 2^31-1
const double PI = acos(-1);
//cout<<fixed<<setprecision(10);

template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
template<class T> void debug(T v){rep(i,v.size()) cout<<v[i]<<" ";cout<<endl;}
const ll dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll dy[8] = {0, 1, 1, 1, 0, -1, -1, -1};
//以降 cin の入力元が 'input.txt' になる
//std::ifstream in("input.txt");
//std::cin.rdbuf(in.rdbuf());

signed main()
{   
    gearup;
    int h,w,k;cin >> h >> w >> k;
    vs s(h);
    rep(i,h)cin >> s[i];
    ll res = 0;
    rep(i,1<<h)rep(j,1<<w){ //選ぶもののビット
        int tmp = 0;
        rep(ii,h)rep(jj,w){
            if(1 & (i >> ii))continue;
            if(1 & (j >> jj))continue;
            //両方選択しないなら
            if(s[ii][jj] == '#')tmp++;
        }
        if(tmp == k)res++;
    }
    out(res);
}

Measured memory_bytes: 3644
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long ll;

int main()
{
    ll n;
    string str;
    cin >> n >> str;
    ll leftS = 0, rightD = 0;
    for (int i = 0; (i < n); ++i) {
        if (str[i] == '.')
            rightD++;
    }
    ll result = leftS + rightD;
    for (int i = 0; (i < n); ++i) {
        if (str[i] == '.') {
            rightD--;
        } else {
            leftS++;
        }
        result = min(result, leftS + rightD);
    }
    cout << result << endl;
    return 0;
}


Measured memory_bytes: 640
#include<stdio.h>
#include<math.h>
typedef struct{
  double x,y;
}p;
void kock(int n, p p1,p p2){
  if(n==0) return;
  
  p s,t,u;
  double a = M_PI*60/180;

  s.x = (2*p1.x+p2.x)/3;
  s.y = (2*p1.y+p2.y)/3;
  t.x = (p1.x+2*p2.x)/3;
  t.y = (p1.y+2*p2.y)/3;
  u.x = (t.x-s.x)*cos(a) - (t.y-s.y)*sin(a) + s.x;
  u.y = (t.x-s.x)*sin(a) + (t.y-s.y)*cos(a) + s.y;
 
  kock(n-1,p1,s);
  printf("%.5f %.5f\n",s.x,s.y);
  kock(n-1,s,u);
  printf("%.5f %.5f\n",u.x,u.y);
  kock(n-1,u,t);
  printf("%.5f %.5f\n",t.x,t.y);
  kock(n-1,t,p2);
}

int main(){
  int n;
  p p1,p2;
  p1.x = 0;
  p1.y = 0;
  p2.x = 100;
  p2.y = 0;
  
  scanf("%d",&n);
  printf("%.5f %.5f\n",p1.x,p1.y);
  kock(n,p1,p2);
  printf("%.5f %.5f\n",p2.x,p2.y);
  
  return 0;
}



Measured memory_bytes: 2104
#include <stdio.h>

int main(void) {
  int count[101] = {0}, i, n, max;
  while (scanf("%d", &n) != EOF) {
    count[n]++;
  }
  max = count[1];
  for (i = 2; i <= 100;i++)
    if (count[i] > max) max = count[i];

  for (i = 1; i <= 100; i++)
    if (count[i] == max) printf("%d\n", i);

  return 0;
}

Measured memory_bytes: 596
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int sz = 4e5+9;

ll a[13][13], c[13];

int main()
{
    int n, m, x;
    cin >> n >> m >> x;
    for(int i=0; i<n; i++) {
        cin >> c[i];
        for(int j=0; j<m; j++) {
            cin >> a[i][j];
        }
    }

    ll ans = 1e18;
    for(int k=0; k<(1<<n); k++) {
        ll ara[15] = {}, cost = 0;
        for(int i=0; i<n; i++) {
            if(k & (1 << i)) {
                cost += c[i];
                for(int j=0; j<m; j++) {
                    ara[j] += a[i][j];
                }
            }
        }

        bool yes = 1;
        for(int i=0; i<m; i++) if(ara[i] < x) yes = 0;

        if(yes) ans = min(ans, cost);
    }

    if(ans == 1e18) puts("-1");
    else cout << ans << endl;
}


Measured memory_bytes: 3620
int a[200010];
int ans[200010];
int main(){
	int n;
	scanf("%d",&n);
	for(int i=2;i<=n;i++)scanf("%d",&a[i]); for(int i=2;i<=n;i++)ans[a[i]]++;
	for(int i=1;i<=n;i++)printf("%d\n",ans[i]);
}

Measured memory_bytes: 3232
#include<bits/stdc++.h>
#define ll long long
ll dp[1000000],freq[1000000];
using namespace std;
map<ll,ll>mp;
int main()
{
    ll tc,i,sum=0,cnt=0;
    cin>>tc;
    for(i=1;i<=tc;i++)cin>>dp[i];
    mp[0]=1;
    for(i=1;i<=tc;i++)
    {
        sum=sum+dp[i];
        mp[sum]++;
        //cout<<mp[sum]<<" "<<sum<<endl;
        if(mp[sum]>=2)cnt+=(mp[sum]-1);
    }
    cout<<cnt<<endl;
    return 0;
}


Measured memory_bytes: 16896
using System;
class Program
{
    public static void Main()
    {
        string[] str = Console.ReadLine().Split(' ');
        long x, y;
        x = long.Parse(str[0]);
        y = long.Parse(str[1]);
        int  i;
        long z;
        for (i = 0; ; i++)
        {
            z = (long)(x * Math.Pow(2, i));
            if (z > y)
                break;
        }
        Console.WriteLine(i);
    }
}

Measured memory_bytes: 11092
//#pragma GCC optimize("Ofast")
//#pragma GCC target("avx,avx2,fma")
//#pragma GCC target("avx,avx2,fma,sse,sse2")
//#pragma GCC optimization ("unroll-loops")
#include<bits/stdc++.h>
using namespace std;
using ll= long long;
int main()
{
//    ios_base::sync_with_stdio(0);
//    cin.tie(0);
    ll n,a,b;
    cin>>n>>a>>b;
    if((b-a)%2==0)cout<<(b-a)/2<<endl;
    else cout<<min((a-1)+((b-a)+1)/2,(n-b)+(n-(a+(n-b))+1)/2)<<endl;

}


Measured memory_bytes: 3540
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
typedef long long       ll;
#define pb                emplace_back
#define mp                make_pair
#define all(a)            (a).begin(), (a).end()
#define clr(a,h)          memset(a, (h), sizeof(a))
#define F first
#define S second
#define fore(i, b, e)	  for (int i = (int)b; i < (int)e; i++)
int faster_in(){int r=0,c;for(c=getchar();c<=32;c=getchar());if(c=='-') return -faster_in();for(;c>32;r=(r<<1)+(r<<3)+c-'0',c=getchar());return r;}

using namespace std;
//using namespace __gnu_pbds;

typedef pair<int, int>  ii;
typedef vector<int>     vi;
typedef vector<ii>      vii;
typedef vector<ll>      vll;
//typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
const int INF = int(1e9 + 7);
const double EPS = 1e-9;
const double PI = acos(-1);

ll f(ll h)
{
	if (h == 1) return 1;
	ll res = f(h/2);
	res = res * 2 + 1;
	return res;
}

int main()
{
    std::ios::sync_with_stdio(false); cin.tie(0);
    //freopen("","r",stdin);
    //freopen("","w",stdout);
    ll h;
    cin >> h;
    cout << f(h) << endl;
    return 0;
}
// PLUS ULTRA!

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

const int magic = 2500;
const long long inf = 4e18;

bool np[magic];
vector<int> prm;

void sieve() {
	np[0] = np[1] = 1;
	for (int i = 2; i < magic; ++i) if (!np[i]) {
		prm.push_back(i);
		for (int j = i + i; j < magic; j += i) np[j] = 1;
	}
}

int n;
long long a[100005];
map<long long,int> f, was;

void calc(int id) {
	for (int x : prm) {
		long long cub = 1ll * x * x * x;
		if (cub > a[id]) break;
		while (a[id] % cub == 0) a[id] /= cub;
	}
}

long long mul(long long x,long long y) {
	if (x > inf / y) return inf;
	return x * y;
}

long long needMul(long long x) {
	long long ret = 1;
	for (int v : prm) if (x % v == 0) {
		int cnt = 0;
		while (x % v == 0) cnt++, x /= v;
		for (int i = 1; i <= 3 - cnt; ++i) {
			ret = mul(ret, v);
		}
	}
	long long y = sqrt(x);
	if (y * y == x) ret = mul(ret, y);
	else ret = mul(ret, mul(x, x));
	return ret;
}

signed main() {
	ios_base::sync_with_stdio(false);
	sieve();
	cin >> n;
	for (int i = 1; i <= n; ++i) {
		cin >> a[i], calc(i);
		f[a[i]]++;
	}
	
	int ans = f.count(1);
	for (int i = 1; i <= n; ++i) if (a[i] != 1 && !was.count(a[i])) {
		long long tmp = needMul(a[i]);
		if (f.count(tmp)) {
			ans += max(f[a[i]], f[tmp]);
			was[tmp] = 1;
		} 
		else {
			ans += f[a[i]];
		}
		was[a[i]] = 1;
	}
	cout << ans << '\n';
}

Measured memory_bytes: 13568
use proconio::{fastout, input};
// use proconio::marker::*;

#[fastout]
fn main() {
   input! {
      mut n: usize,
   }
   n %= 10;

   match n {
      0 | 1 | 6 | 8 => println!("pon"),
      3 => println!("bon"),
      _ => println!("hon")
   }
}


Measured memory_bytes: 2160
#include <stdio.h>

int main(int argc, const char * argv[]) {
    // insert code here...
    int sum =0;
    char ch;
    
    while(true)
    {
        while((ch = getchar()) != '\n'){
            sum += ch - '0';
        }
        if(sum == 0)
            break;
        else{
            printf("%d\n",sum);
            sum = 0;
        }
    }
    return 0;
}



Measured memory_bytes: 2684
/* 
	Author: ankrypt
*/


#include <bits/stdc++.h>

using namespace std;

#define MOD 1000000007
#define ll long long int
#define u64 unsigned long long int

ll N, K;
ll arr[100005];
ll dp[100005];

ll rec(ll x) {
	if(x == N - 1) {
		return 0;
	}
	if(x > N - 1) {
		return 1e9;
	}
	ll &ans = dp[x];
	if(ans != 1e9) {
		return ans;
	} 
	for(int i = 1; i <= K; i++) {
		ans = min(ans, abs(arr[i + x] - arr[x]) + rec(i + x));
	}
	return ans;
}

int main() {
	scanf("%lld %lld", &N, &K);
	for(int i = 0; i < N; i++) {
		scanf("%lld", &arr[i]);
	}
	for(int i = 0; i < N; i++) {
		dp[i] = 1e9;
	}
	// memset(dp, -1, sizeof(dp));
	cout << rec(0);
	return 0;
}
/*
	Powered by Buggy Plugin
*/


Measured memory_bytes: 4992
#include <stdio.h>

int main(){
  int h,w;

  while(1){
    scanf("%d %d",&h,&w);
    if(h == 0 && w == 0)
      return 0;
    for(int i=0;i<h;i++){
      for(int j=0;j<w;j++){
        if((i%2 == 0) ^ (j%2 == 1))
          putchar('#');
        else
          putchar('.');
      }
      putchar('\n');
    }
    putchar('\n');
  }
  return 0;
}



Measured memory_bytes: 2604
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <cstdlib>
#include <utility>
#include <cstdio>
#include <vector>
#include <string>
#include <queue>
#include <stack>
#include <cmath>
#include <set>
#include <map>
using ll = long long;
using itn = int;
using namespace std;
int GCD(int a, int b){
    return b ? GCD(b, a%b) : a;
}
int main() {
    ll x,y;
    cin >> x >> y;
    ll add=0;
    ll xa=abs(x),ya=abs(y);
    if(y<x){
        add++;
        x*=-1;
    }
    if(xa<ya){
        swap(xa,ya);
    }
    add += xa-ya;
    if(x*y<0){
        add++;
    }
    cout << add << endl;
}

Measured memory_bytes: 256
/*
 *    J1K7_7
 *
 *    You can use my contents on a Creative Commons - Attribution 4.0 International - CC BY 4.0 License.  XD 
 *    - JASKAMAL KAINTH
 */
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <cstring>
#include <cassert>
#include <list>
#include <map>
#include <unordered_map>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <limits>
using namespace std;
typedef long long          ll;
typedef unsigned long long ull;
typedef long double        ld;
typedef pair<int,int>      pii;
typedef pair<ll,ll>        pll;
typedef vector<int>        vi;
typedef vector<long long>  vll;
#define left(x) 		   (x << 1)
#define right(x) 		   (x << 1) + 1
#define mid(l, r) 	       ((l + r) >> 1)
#define mp                 make_pair
#define pb                 push_back
#define all(a)             a.begin(),a.end()
#define debug(x)	       {cerr <<#x<<" = " <<x<<"\n"; }
#define debug2(x, y)       {cerr <<#x<<" = " <<x<<", "<<#y <<" = " <<y <<"\n";}
#define debug3(x, y, z)    {cerr <<#x<<" = " <<x<<", "<<#y <<" = " <<y <<", "<<#z<<" = "<<z<<"\n";}
#define debug4(x, y, z, w) {cerr <<#x<<" = " <<x<<", "<<#y <<" = " <<y <<", "<<#z<<" = "<<z<<", "<<#w << " = " <<w <<"\n";}
#define ss                 second
#define ff                 first
#define m0(x) 		       memset(x,0,sizeof(x))

const int mod=1e9+7;

template<class T> inline T gcd(T a,T b){ll t;while(b){a=a%b;t=a;a=b;b=t;}return a;}
template<class T> inline T lcm(T a,T b){return a/gcd(a,b)*b;}
template<typename T, typename S> T expo(T b, S e, const T &m){if(e <= 1)return e == 0?1: b;\
	return (e&1) == 0?expo((b*b)%m, e>>1, m): (b*expo((b*b)%m, e>>1, m))%m;}
template<typename T> T modinv(T a) { return expo(a, mod-2, mod); }

inline int nextint(){ int x; scanf("%d",&x); return x; }
inline ll nextll(){ ll x; scanf("%lld",&x); return x; }

const ll  mx_ll   = numeric_limits<ll> :: max();
const int mx_int  = numeric_limits<int> :: max();

const long double PI = (long double)(3.1415926535897932384626433832795);

#define gc getchar
template <typename T> void scanint(T &x) {
	T c = gc(); while(((c < 48) || (c > 57)) && (c!='-')) c = gc();
	bool neg = false; if(c == '-') neg = true; x = 0; for(;c < 48 || c > 57;c=gc());
	for(;c > 47 && c < 58;c=gc())	x = (x*10) + (c - 48); if(neg)	x = -x;
}

int main()
{
    ios_base::sync_with_stdio(false); cin.tie(0);
	ll a , b, c ; cin >> a >> b >> c;
	ll ans1;
	if( a%2 ==0 || b%2 ==0 || c%2 == 0)
	{
		cout << "0\n";
		return 0;
	}


	cout << min(b*c ,min(a*b,a*c)) << "\n";
    return 0;
}



Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

class Main {
	public static void main(String[] args) {
		InputStreamReader isr = new InputStreamReader(System.in);
		BufferedReader br = new BufferedReader(isr);
		try {
			String[] list = br.readLine().split(" ");
			int a = Integer.parseInt(list[0]);
			int b = Integer.parseInt(list[1]);
			int c = Integer.parseInt(list[2]);
			if (a < b && b < c) {
				System.out.println("Yes");
			} else {
				System.out.println("No");
			}
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
}

Measured memory_bytes: 16908
def mapint_inp():
    return map(int, input().split())

def intinp():
    return int(input())

N, M = mapint_inp()
H = list(mapint_inp())
ABs = [list(mapint_inp()) for _ in range(M)]

X = [0 for _ in range(N)]
# Y = [0 for _ in range(N)]

for AB in ABs:
    A, B = AB
    A -= 1
    B -= 1
    # Y[A] = 1
    # Y[B] = 1
    if H[A] > H[B]:
        X[B] = -1
    elif H[B] > H[A]:
        X[A] = -1
    else:
        X[B] = -1
        X[A] = -1

print(X.count(0))

Measured memory_bytes: 32028
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<array>
#include<map>
#include<iomanip>
#include<assert.h>
#include<list>
#include<bitset>
#include<stack>
#include<memory>
#include<numeric>
using namespace std;
using namespace std::chrono;
typedef long long int llint;
typedef long double lldo;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase
/*cout<<fixed<<setprecision(20);cin.tie(0);ios::sync_with_stdio(false);*/
const int mod=1000000007;
const llint big=2.19e15+1;
const long double pai=3.141592653589793238462643383279502884197;
const long double eps=1e-4;
template <class T,class U>bool mineq(T& a,U b){if(a>b){a=b;return true;}return false;}
template <class T,class U>bool maxeq(T& a,U b){if(a<b){a=b;return true;}return false;}
llint gcd(llint a,llint b){if(a%b==0){return b;}else return gcd(b,a%b);}
llint lcm(llint a,llint b){if(a==0){return b;}return a/gcd(a,b)*b;}
template<class T> void SO(T& ve){sort(ve.begin(),ve.end());}
template<class T> void REV(T& ve){reverse(ve.begin(),ve.end());}
template<class T>llint LBI(const vector<T>&ar,T in){return lower_bound(ar.begin(),ar.end(),in)-ar.begin();}
template<class T>llint UBI(const vector<T>&ar,T in){return upper_bound(ar.begin(),ar.end(),in)-ar.begin();}
int main(void){
	cout<<fixed<<setprecision(20);
	cin.tie(0);ios::sync_with_stdio(false);
	//seg木を使わずに行きたい
	//doubleはたぶんダメ
	int n,i,j;cin>>n;
	vector<pair<int,int>>zi;
	zi.reserve(n);
	for(i=0;i<n;i++){
		int T,A;cin>>T>>A;
		if(A==0){continue;}
		zi.pub(mp(T,A));
	}
	n=zi.size();
	vector<double>ma(n);
	for(i=0;i+20<=n;i++){
		double a=1;
		for(j=0;j<20;j++){a*=1-0.1*zi[i+j].sec;}
		ma[i]=a;
	}
	//+20のアレを使う
	//誤差を有効に使う
	int Q;cin>>Q;
	while(Q--){
		int L,R;cin>>L>>R;
		int Lb=LBI(zi,mp(L,0));
		int Rb=LBI(zi,mp(R,0));
		if(Rb-Lb>=400){cout<<0<<endl;continue;}//誤差なので
		double ans=1e9;
		while(Lb+20<=Rb){
			ans*=ma[Lb];
			Lb+=20;
		}
		while(Lb+1<=Rb){
			ans*=1-0.1*zi[Lb].sec;
			Lb++;
		}
		cout<<ans<<endl;
	}
	return 0;
}



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

int main() {
  string s1,s2,s3;
  cin >> s1 >> s2 >> s3;
  int dif = 'A'-'a';
  printf("%c%c%c" , s1[0]+dif, s2[0]+dif, s3[0]+dif);
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES // for C++  
#include "bits/stdc++.h"
using LL = long long;
using ULL = unsigned long long;
#define NUM 1000000007

using namespace std;

int main()
{
    int x, a, b;
    cin >> x >> a >> b;
    int tmp = x - a;
    cout << tmp % b << endl;
}

Measured memory_bytes: 256
n, a, b, c = map(int, input().split())
l = []
for i in range(n):
    l.append(int(input()))
from itertools import product
bamboo = [0, a, b, c]
min_num = float('inf')
for i in product([0, 1, 2, 3], repeat=n):
    if set(i) >= set([1, 2, 3]):
        sums = [0, 0, 0, 0]
        tmp = -30
        for j in range(n):
            if i[j] != 0:
                sums[i[j]] += l[j]
                tmp += 10
        min_num = min(min_num,tmp+sum(abs(sums[k] - bamboo[k]) for k in range(1, 4)))
print(min_num)

Measured memory_bytes: 47068
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
#define rep(i, n) for(int i=0;i<(int)n;i++)
#define PI acos(-1)
#define fast_io ios_base::sync_with_stdio(false) ; cin.tie(0); cout.tie(0);
ll mod=1e9+7;

int main(){
    fast_io

    int n,k;
    cin>>n>>k;

    ll res = 0;

    for(ll i=k;i<=n+1;i++){
        ll first = i*(i-1)/2;
        ll last = i*(2*n-i+1)/2;
        ll add=last-first+1;
        res+=add;
        res%=mod;
    }
    cout<<res<<endl;

    return 0;

}


Measured memory_bytes: 3628
import java.util.Scanner;
public class Main{
    public static void swap(long a[], int b, int e, int t){
        for(int i = 0 ; i < e-b ; i++){
            long tmp = a[b+i];
            a[b+i] = a[t+i];
            a[t+i] = tmp; 
        }
    }
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long a[] = new long[n];
        for(int i = 0 ; i < n ; i++)
            a[i] = sc.nextLong();
        int q = sc.nextInt();
        for(int i = 0 ; i < q ; i++){
            int b = sc.nextInt();
            int e = sc.nextInt();
            int t = sc.nextInt();
            swap(a,b,e,t);
        }
        for(int i = 0 ; i < n-1 ; i++)
            System.out.print(a[i] + " ");
        System.out.println(a[n-1]);
    }
}


Measured memory_bytes: 36792
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string s;
    cin>>s;
    if(s=="SAT")
        cout<<1<<endl;
    else if(s=="SUN")
        cout<<7<<endl;
    else if(s=="MON")
        cout<<6<<endl;
    else if(s=="TUE")
        cout<<5<<endl;
    else if(s=="WED")
        cout<<4<<endl;
    else if(s=="THU")
        cout<<3<<endl;
    else if(s=="FRI")
        cout<<2<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <deque>
#include <complex>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <cstring>

#define REP(i,x) for(int i=0 ; i<(int)(x) ; i++)
#define ALL(x) (x).begin(),(x).end()
#define LL long long

using namespace std;

int H, W;

bool solve(vector<int> hist){
    REP(y,H/2){
        REP(x,W/2){
            bool ok = false;
            REP(i, hist.size()){
                if(hist[i]>=4){
                    hist[i]-=4;
                    ok = true;
                    break;
                }
            }
            if(!ok)return false;
        }
    }
    if(H%2==1){
        REP(x,W/2){
            bool ok = false;
            REP(i, hist.size()){
                if(hist[i]>=2){
                    hist[i]-=2;
                    ok = true;
                    break;
                }
            }
            if(!ok)return false;
        }
    }
    if(W%2==1){
        REP(x,H/2){
            bool ok = false;
            REP(i, hist.size()){
                if(hist[i]>=2){
                    hist[i]-=2;
                    ok = true;
                    break;
                }
            }
            if(!ok)return false;
        }
    }
    return true;
}

int main(){
    cin >> H >> W;
    vector<string> A(H);
    REP(i, H)cin >> A[i];
    map<char, int> memo;
    REP(y, H)REP(x, W){
        if(memo.count(A[y][x])==0){
            memo[A[y][x]] = 0;
        }
        memo[A[y][x]]++;
    }
    vector<int> hist;
    for(map<char,int>::iterator it = memo.begin(); it!=memo.end(); it++){
        hist.push_back(it->second);
    }

    cout << (solve(hist) ? "Yes" : "No") << endl;

    return 0;
}


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

#define INF 1.1e9
#define LINF 1.1e18
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) for (int i = (n) - 1; i >= 0; i--)
#define ALL(v) (v).begin(), (v).end()
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define BIT(x, n) bitset<n>(x)
#define PI 3.14159265358979323846

typedef long long ll;
typedef pair< int, int > P;
typedef pair< int, P > PP;

//-------------------------------------------------

int n;
ll a[3010], ans;
ll g = 1;

ll gcd(ll x, ll y) {
	return y == 0 ? x : gcd(y, x % y);
}

ll lcm(ll x, ll y) {
	return x / gcd(x, y) * y;
}

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

	cin >> n;
    REP(i, n) {
		cin >> a[i];
		//g = lcm(a[i], g);
		ans += a[i] - 1;
	}
	/*g--;
	REP(i, n) {
		ans += (g % a[i]);
	} */
	cout << ans << endl;


	return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main (){
	int n;
	cin>>n;
	if (n<10) {
	    cout<<n<<endl;
	    return 0;
	}
	if (n<100) {
	    cout<<9<<endl;
	    return 0;
	}
	if (n<1000) {
	    cout<<n-90<<endl;
	    return 0;
	}
	if (n<10000) {
	    cout<<909<<endl;
	    return 0;
	}
	if (n<100000) {
	    cout<<n-9090<<endl;
	    return 0;
	}
	if (n=100000) {
	    cout<<90909<<endl;
	    return 0;
	}
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		
		int A = sc.nextInt();
		int B = sc.nextInt();
		int max = A + B;
		
		if(max < A - B) {
			max = A - B;
		}
		if(max < A * B) {
			max = A * B;
		}
		
		System.out.println(max);

	}	
}


Measured memory_bytes: 22868
#include<bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define int long long
#define ends ' '
#define endl '\n'
#define pb push_back
#define x first
#define y second

const int maxn = 3e3+5;
int rd[maxn], bl[maxn], gr[maxn];

int32_t main()
{
	IOS;

	int n;
	cin >> n;

	vector<int> v;

	int up = sqrt(n);

	for(int i = 1; i <= up; ++i)
	{
		if(n%i)
			continue;
		v.pb(i);
		if(n/i != i)
			v.pb(n/i);
	}

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

	int ans = 0;

	for(int i : v)
	{
	
		int divisor = n/i-1;
		if(divisor <= i)
			continue;
		ans += divisor;
	}

	cout << ans;
	return 0;
}

Measured memory_bytes: 384
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<climits>
#include<numeric>
#include<cmath>
#include<cstring>
#include<deque>
#include<map>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define VSORT(v) sort(v.begin(), v.end());
#define VE vector<int>
#define VEP vector<pair<int,int>>
#define llong long long
#define pb(a) push_back(a)
using namespace std;
long long GCD(long long a, long long b) {
	if (b == 0) return a;
	else return GCD(b, a % b);
}

int main() {
	int n;
	cin >> n;
	VE vec(n);
	REP(i, n) {
		cin >> vec[i];
	}
	int ans = 0;
	REP(i, n) {
		for (int k = i + 1; k < n; ++k) {
			ans += vec[i] * vec[k];
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int x, y, a, b, c, p;
int A[100005], B[100005];

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

//    freopen("input.txt","r",stdin);
//    freopen("output.txt","w",stdout);

    cin >> x >> y >> a >> b >> c;
    vector<int> v;
    long long sum = 0;
    for (int i = 0; i < a; i++) {
        cin >> A[i];
    }

    for (int i = 0; i < b; i++) {
        cin >> B[i];
    }

    sort(A, A + a, greater<int>());
    sort(B, B + b, greater<int>());

    for (int i = 0; i < x; i++) {
        v.emplace_back(A[i]);
    }

    for (int i = 0; i < y; i++) {
        v.emplace_back(B[i]);
    }

    for (int i = 0; i < c; i++) {
        cin >> p;
        v.emplace_back(p);
    }

    sort(v.rbegin(), v.rend());

    for (int i = 0; i < x + y; i++) {
        sum += v[i];
    }

    cout << sum << '\n';
}


Measured memory_bytes: 3316
h, w = map(int, input().split())
s = [[*input()] for _ in range(h)]

#左上から時計回り
dy = [-1, -1, -1, 0, 1, 1, 1, 0]
dx = [-1, 0, 1, 1, 1, 0, -1, -1]

for i in range(h):
    for j in range(w):
        if s[i][j] == "#": continue
        cnt = 0
        for k in range(8):
            x = j + dx[k]
            y = i + dy[k]
            if x < 0 or y < 0 or w <= x or h <= y: continue
            if s[y][x] == "#":
                cnt += 1
        s[i][j] = str(cnt)
print(*map("".join, s), sep = "\n")

Measured memory_bytes: 9232
#include <stdio.h>

int main(){  
	int H, W, i, j, k;
	for(i = 0; i < 90000; i++){
	scanf("%d %d", &H, &W);
	if ( H == 0 && W == 0) break;
	
	for (j = 0; j < H; j++){
		if(j%2== 0){
		for(k = 0; k < W; k++){
		if(k%2== 0)printf("#");
		else printf(".");
		}}
		else{
		for(k = 0; k < W; k++){
		if(k%2== 0)printf(".");
		else printf("#");
		}}
		printf("\n");
	}printf("\n");}
return 0;}



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

int main(){
  int N;
  cin >> N;
  int a=0;
  int n;
  n=N;
  for(int i=0;i<8;i++){
    a+=n%10;
    n=n/10;
  }
  if(N%a==0){
    cout << "Yes" << endl;}
  else{
    cout << "No" << endl;}
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <numeric>
#include <algorithm>
#include <queue>
#include <set>
#include <map>
#include <cmath>

using namespace std;
using ll = long long;

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

#define CIN(T, x) T x; cin >> x;
#define CINS(T, x, N) vector<T> x(N); for(int i = 0; i < (N); i++) { cin >> x[i]; }
#define SHOW(x) for(int i = 0; i < x.size(); i++) { cout << x[i] << " "; } cout << "\n";
#define SHOW2(x) for(int j = 0; j < x.size(); j++) { SHOW(x[j]); } cout << "\n";


struct UnionFind {
    vector<int> par;

    UnionFind(int N) : par(N) {
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) {
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) {
        int rx = root(x);
        int ry = root(y);
        if (rx == ry) return;

        par[rx] = ry;
    }

    bool same(int x, int y) {
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};


int main() {

    CIN(int, N);
    CIN(int, M);

    UnionFind tree(N);
    int ans = N;

    for (int i = 0; i < M; i++) {
        int x, y, z;
        cin >> x >> y >> z;
        x--; y--;
        if (!tree.same(x, y)) ans--;
        tree.unite(x, y);
    }

    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 640
import sys


def main():
    h, w = map(int, input().split())
    if h % 3 == 0 or w % 3 == 0:
        print(0)
        return

    pattern = [h, w]
    for x in range(1, w//2 + 2):
        first = x * h
        h1 = h // 2
        h2 = h - h1
        second = (w-x) * h1
        thrid = (w-x) * h2
        result = max(first, second, thrid) - min(first, second, thrid)
        pattern.append(result)

    for y in range(1, h//2 + 2):
        first = y * w
        w1 = w // 2
        w2 = w - w1
        second = (h-y) * w1
        thrid = (h-y) * w2
        result = max(first, second, thrid) - min(first, second, thrid)
        pattern.append(result)

    print(min(pattern))


if __name__ == "__main__":
    main()

Measured memory_bytes: 12516
unittest
{
	assert( [ "2 2", "3", "5", "2", "7" ].parse.expand.solve == 29 );
	assert( [ "4 3", "2", "4", "8", "1", "2", "9", "3" ].parse.expand.solve == 60 );
}



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

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

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto wh = input.front.split.to!( long[] );
	auto cs = new Tuple!( long, bool )[ wh[ 0 ] + wh[ 1 ] ];
	foreach( ref c; cs[ 0 .. wh[ 0 ] ] )
	{
		input.popFront;
		c = tuple( input.front.to!( long ), false );
	}
	foreach( ref c; cs[ wh[ 0 ] .. $ ] )
	{
		input.popFront;
		c = tuple( input.front.to!( long ), true );
	}
	return tuple( wh[ 0 ], wh[ 1 ], cs );
}

auto solve( long w, long h, Tuple!( long, bool )[] cs )
{
	// コストの少ない道から順に舗装する
	auto ans = 0L;
	w++;
	h++;
	foreach( c; cs.sort() )
	{
		if( c[ 1 ] )
		{
			// 縦の道
			ans += c[ 0 ] * w;
			h--;		// 舗装した道の両端の家は、後続処理では同一視してよい
		}
		else
		{
			// 横の道
			ans += c[ 0 ] * h;
			w--;		// 舗装した道の両端の家は、後続処理では同一視してよい
		}
	}
	return ans;
}


Measured memory_bytes: 5628
from collections import deque
def main():
    I = {
        1: ((6, 0), (2, 1), (5, 2), (4, 3)),
        2: ((6, 3), (3, 1), (5, 3), (1, 3)),
        3: ((6, 2), (4, 1), (5, 0), (2, 3)),
        4: ((6, 1), (1, 1), (5, 1), (3, 3)),
        5: ((1, 0), (2, 0), (3, 0), (4, 0)),
        6: ((1, 2), (2, 2), (3, 2), (4, 2)),
    }
    J = [[6, 7, 8], [2, 5, 8], [0, 1, 2], [0, 3, 6]]
    D = [
        (1, 5, 2, 3, 0, 4), # 'U'
        (3, 1, 0, 5, 4, 2), # 'R'
        (4, 0, 2, 3, 5, 1), # 'D'
        (2, 1, 5, 0, 4, 3), # 'L'
    ]
    def rotate_dice(L, k):
        return tuple(L[e] for e in D[k])

    R = (5, 1, 2, 4, 3, 6)
    que = deque()
    dist = {R: 0}
    que.append(R)
    while que:
        s = que.popleft()
        d = dist[s]
        for i in range(4):
            t = rotate_dice(s, i)
            if t in dist:
                continue
            dist[t] = d+1
            que.append(t)

    C = [None]*6
    while 1:
        S = input()
        if S == '#':
            break
        C[0] = "".join([S, input(), input()])
        for i in range(5):
            C[i+1] = "".join([input() for i in range(3)])
        ans = 10
        for s, v in dist.items():
            a = s[0]; b = s[1]
            for k, (i, e) in enumerate(I[a]):
                if i == b:
                    j, f = I[a][k-2]
                    if any(C[i-1][k1] == '*' for k1 in J[e]) and any(C[j-1][k2] == '*' for k2 in J[f]):
                        ans = min(ans, v)
                    break
        print(ans)
        input()
main()


Measured memory_bytes: 5984
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
typedef long long ll;
const long long INF = 1LL << 60; 

int main()
{
  char c; cin >> c;
  cout << char(c+1) << endl;
}


Measured memory_bytes: 384
#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string>
#include<algorithm>
#include<vector> 
#include<limits>
#include<numeric>
#include<type_traits>
#include<math.h>
#include<fstream>
#include<set>
#include<queue>
using namespace std;
typedef long long ll;

const ll MOD = 1e9 + 7; 

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i = (int)(a); i < (int)(b); i++)
#define out(str) cout << str << endl
#define ALL(a) (a).begin(),(a).end()
#define INF_INT (1<<30)
#define INF_LL (1ll<<62)

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

int a,b;

int main(){
    cin>>a>>b;
    if(a==1)a=14;
    if(b==1)b=14;
    if(a>b)out("Alice");
    else if(a<b)out("Bob");
    else out("Draw");
    
    
    
}

Measured memory_bytes: 256
import java.util.Scanner;
import java.math.*;

class Main {
	public static void main(String args[]) {
		Scanner scan = new Scanner(System.in);
		
		double r = Double.parseDouble(scan.next());
		
		double area = r * r * Math.PI;
		double perimeter = 2 * r * Math.PI;
		
		System.out.println(BigDecimal.valueOf(area).toPlainString() +" "+ BigDecimal.valueOf(perimeter).toPlainString());
	}
}

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

#define pb push_back
#define mp make_pair
#define taskname "A"

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int,int> ii;
const int maxn = 1e5 + 5;
const int mod = 1e9 + 7;
int n , a[maxn];

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    if(fopen(taskname".INP","r")){
		freopen(taskname".INP", "r",stdin);
		freopen(taskname".OUT", "w",stdout);
    }
    cin >> n;
    ll s = 0;
    for(int i = 0 ; i < n ; ++i){
        cin >> a[i];
        s += a[i];
    }
    ll tmp = 0;
    if(s % ((ll)n * (n + 1) / 2))return cout << "NO" , 0;
    s /= (ll)n * (n + 1) / 2;
    for(int i = 0 ; i < n ; ++i){
        if(s + a[i] - a[(i + 1) % n] < 0)return cout << "NO" , 0;
        tmp += (s + a[i] - a[(i + 1) % n]) / n;
    }
    puts(tmp == s ? "YES" : "NO");
}


Measured memory_bytes: 640
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Competitive
{
    internal class Solution
    {
        public int N, M;
        public long MOD = 1000000007;

        public void Run()
        {
            {
                var line = Input.ReadIntArray();
                N = line[0];
                M = line[1];
            }
            int[] L = new int[M];
            int[] R = new int[M];

            for (int i = 0; i < M; i++)
            {
                var line = Input.ReadIntArray();
                L[i] = line[0];
                R[i] = line[1];
            }

            int c = R.Min() - L.Max() + 1;
            c = Math.Max(c, 0);
            Console.WriteLine(c);

        }
    }

    // libs ----------
    

    // common ----------

    internal static class Input
    {
        public static string ReadString()
        {
            string line = Console.ReadLine();
            return line;
        }

        public static int ReadInt()
        {
            string line = Console.ReadLine();
            return int.Parse(line);
        }

        public static int[] ReadIntArray()
        {
            string line = Console.ReadLine();
            return line.Split(' ').Select(int.Parse).ToArray();            
        }

        public static long ReadLong()
        {
            string line = Console.ReadLine();
            return long.Parse(line);
        }

        public static long[] ReadLongArray()
        {
            string line = Console.ReadLine();
            return line.Split(' ').Select(long.Parse).ToArray();
        }

        public static double[] ReadDoubleArray()
        {
            string line = Console.ReadLine();
            return line.Split(' ').Select(double.Parse).ToArray();
        }
    }
    
    internal class Program
    {
        public static void Main(string[] args)
        {
            var s = new Solution();
            s.Run();
        }
    }
}

Measured memory_bytes: 17988
import java.util.*;
public class Main {
	public static void myout(Object text){//standard output
		System.out.println(text);
	}
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		//String tmp = sc.next();
		//int tmp = sc.nextInt();
		//Long tmp = sc.nextLong();
      
      Long output = new Long(0);
      
      int N = sc.nextInt();
      int H = sc.nextInt();
      ArrayList<Integer> aList = new ArrayList<Integer>(N);
      ArrayList<Integer> bList = new ArrayList<Integer>(N);
      for(int i = 0; i < N; i++){
        aList.add(sc.nextInt());
        bList.add(sc.nextInt());
      }
      //aの最大値以上となっているbをとりあえず全部投げておく(刀自体は残るものとする)
      //あとはaの最大値となる刀を振り回す（残HPを割る）
      Collections.sort(aList,Comparator.reverseOrder());
      Collections.sort(bList,Comparator.reverseOrder());
      int aMax = aList.get(0);
      for(int i = 0; i < N; i++){
        int tmpB = bList.get(i);
        if(tmpB >= aMax && H > 0){
          H = H - tmpB;
          output++;
        }else{
          break;
        }
      }
      
      if(H <= 0){
        H = 0;
      }
      int aAttack = H / aMax;
      if(H % aMax != 0){
        aAttack++;
      }
      output += aAttack;
      myout(output);
	}
}


Measured memory_bytes: 92368
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <algorithm>
#include <cmath>
#include <cstring>

using namespace std;

#define REP(i,n) for(int i = 0; i < n; i++)
#define RREP(i,n) for(int i = n - 1; i >= 0; i--)

#define ALL(v) v.begin(),v.end()
#define pb push_back
#define mp make_pair
#define F first
#define S second

#define UNIQUE(v) do{sort(v.begin(), v.end()); v.erase( unique(v.begin(), v.end()), v.end() );} while(0)


#define y0 y3487465
#define y1 y8687969

#define m0(x) memset(x,0,sizeof(x))
#define m1(x) memset(x,63,sizeof(x))

typedef long long ll;
typedef pair<int,int> pi;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pi> vpi;
typedef vector<ll> vll;
typedef vector<vll> vvll;

double EPS = 1e-9;
int INFi = 1000000005;
long long INFll = 1000000000000000005ll;
double PI = acos(-1);
int dirx[8] = {-1,0,0,1,-1,-1,1,1};
int diry[8] = {0,1,-1,0,-1,1,-1,1};
ll MOD = 1000000007;

int N, K;

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

  cout << N - K + 1 << endl;

  return 0;
}


Measured memory_bytes: 256
# include "bits/stdc++.h"
using namespace std;
using LL = long long;
using ULL = unsigned long long;
const double PI = acos(-1);
template<class T>constexpr T INF() { return ::std::numeric_limits<T>::max(); }
template<class T>constexpr T HINF() { return INF<T>() / 2; }
template <typename T_char>T_char TL(T_char cX) { return tolower(cX); };
template <typename T_char>T_char TU(T_char cX) { return toupper(cX); };
const int vy[] = { -1, -1, -1, 0, 1, 1, 1, 0 }, vx[] = { -1, 0, 1, 1, 1, 0, -1, -1 };
const int dx[4] = { 0,1,0,-1 }, dy[4] = { 1,0,-1,0 };
int popcnt(unsigned long long n) { int cnt = 0; for (int i = 0; i < 64; i++)if ((n >> i) & 1)cnt++; return cnt; }
int d_sum(LL n) { int ret = 0; while (n > 0) { ret += n % 10; n /= 10; }return ret; }
int d_cnt(LL n) { int ret = 0; while (n > 0) { ret++; n /= 10; }return ret; }
LL gcd(LL a, LL b) { if (b == 0)return a; return gcd(b, a%b); };
LL lcm(LL a, LL b) { LL g = gcd(a, b); return a / g*b; };
# define ALL(qpqpq)           (qpqpq).begin(),(qpqpq).end()
# define UNIQUE(wpwpw)        sort(ALL((wpwpw)));(wpwpw).erase(unique(ALL((wpwpw))),(wpwpw).end())
# define LOWER(epepe)         transform(ALL((epepe)),(epepe).begin(),TL<char>)
# define UPPER(rprpr)         transform(ALL((rprpr)),(rprpr).begin(),TU<char>)
# define FOR(i,tptpt,ypypy)   for(LL i=(tptpt);i<(ypypy);i++)
# define REP(i,upupu)         FOR(i,0,upupu)

struct INIT{
    INIT(){
        std::ios::sync_with_stdio(false);
        std::cin.tie(0);
        cout << fixed << setprecision(13);
    }
}INIT;

int h, w;
int a[88][88], b[88][88];
bool dp[88][88][12928];
int main(){
    cin >> h >> w;
    REP(i, h)REP(j, w)cin >> a[i][j];
    REP(i, h)REP(j, w)cin >> b[i][j];
    dp[0][0][abs(a[0][0] - b[0][0])] = true;
    REP(i, h)REP(j, w)REP(k, 6464){
        if(!dp[i][j][k])continue;
        dp[i + 1][j][k + abs(a[i + 1][j] - b[i + 1][j])] = true;
        dp[i + 1][j][abs(k - abs(a[i + 1][j] - b[i + 1][j]))] = true;
        dp[i][j + 1][k + abs(a[i][j + 1] - b[i][j + 1])] = true;
        dp[i][j + 1][abs(k - abs(a[i][j + 1] - b[i][j + 1]))] = true;
    }
    int ans = 0;
    while(!dp[h - 1][w - 1][ans])ans++;
    cout << ans << endl;
}

Measured memory_bytes: 89472
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder_20190707_1
{    class Program
    {
        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split(' ');

            double W = double.Parse(s[0]);
            double H = double.Parse(s[1]);
            long x = long.Parse(s[2]);
            long y = long.Parse(s[3]);

            string answer = "";

            if(W == x * 2 && H == y * 2)
            {
                answer = "1";
            }
            else
            {
                answer = "0";
            }

            Console.WriteLine((W * H / 2).ToString() + " " + answer);
        }
    }
}

Measured memory_bytes: 27616
#include<stdio.h>
int main(void)
{
	int a,b,c,d,p,x,y;
	scanf("%d %d %d %d %d",&a,&b,&c,&d,&p);
	x=a*p;
	if(p<=c){
		y=b;
	}
		else{
			y=b+(p-c)*d;
		}
		if(x<y){
			printf("%d\n",x);
		}
		else{
			printf("%d\n",y);
		}
	return 0;
}


Measured memory_bytes: 2044
#include<bits/stdc++.h>
using namespace std;
int main()
{
	string s1,s2;
	cin>>s1;
	s2=s1;
	for(int i=0;i<s2.length();i++)
	{
		if(s2[i]=='b')s2[i]='d';
		else if(s2[i]=='q')s2[i]='p';
		else if(s2[i]=='d')s2[i]='b';
		else if(s2[i]=='p')s2[i]='q';
	}
	reverse(s2.begin(),s2.end());
	if(s1==s2)cout<<"Yes\n";
	else cout<<"No\n";
}

Measured memory_bytes: 512
/*
https://atcoder.jp/contests/dp/tasks/dp_m
*/
#include <iostream>
#include <bits/stdc++.h>
using namespace std;

const int mod = 1e9 + 7;

int modAdd (int a, int b) {
	a += b;
	if (a >= mod) {
		a -= mod;
	}
	return a;
}
int modSub (int a, int b) {
	a -= b;
	if (a < 0) {
		a += mod;
	}
	return a;
}
template <class T>
void display (const vector <T> &arr) {
	for (T a : arr) {
		cout << a << " ";
	}
	cout << endl;
	return;
}

int getNumWays (const vector <int> &candies, int k) {
	int n = candies.size();
	vector <int> dp(k + 1);
	dp[0] = 1;
	// dp[i] - Total number of ways if i candies are used
	
	for (int i = 0; i < n; ++i) {
		vector <int> prefixSum(k + 1);
		for (int used = 0; used <= k; ++used) {
			int minCandies = used + 1;
			int maxCandies = used + min(candies[i], k - used);
			// for (int j = minCandies; j <= maxCandies; ++j) {
			// 	dp[j] = (dp[j] + dp[used]) % mod;
			// }
			if (minCandies <= maxCandies) {
				prefixSum[minCandies] = modAdd(prefixSum[minCandies], dp[used]);
				if (maxCandies + 1 <= k) {
					prefixSum[maxCandies + 1] = modSub(prefixSum[maxCandies + 1], dp[used]);
				}
			}
		}
		int prefix = 0;
		for (int j = 0; j <= k; ++j) {
			prefix = modAdd(prefix, prefixSum[j]);
			dp[j] = modAdd(dp[j], prefix);
		}
	}
	return dp[k];

}

int main() {
    int n, k;
    cin >> n >> k;
    vector <int> candies(n);
    for (int &c : candies) {
    	cin >> c;
    }
    int result = getNumWays(candies, k);
    cout << result << "\n";
    return 0;
}


Measured memory_bytes: 1024
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;

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

const int dx[4] = {-1, 0, 0, 1};
const int dy[4] = {0, -1, 1, 0};

// Self settings
// clang-format off
#define MAX_N 100000
#define REP(i, N) for (int i = 0; i < (int)(N); ++i)
#define SLN(i,N) (i == N-1 ? "\n" : " ")
ll fact(ll n) { ll res = 1; for(ll i=2;i<=n;++i) res = res * i; return res;}
ll nCr(ll n, ll r) {return (fact(n)/fact(n-r)*fact(r)) ;}
ll gcd(ll a,ll b){if(b==0)return a;return gcd(b,a%b);}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
const ll MOD = 1e9+7;
const ll INF = 1LL << 60;
const int inf = 1000100011;
// clang-format on
string s;

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

  s[5] = ' ';
  s[13] = ' ';
  cout << s << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iomanip>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define fi first
#define se second
#define mp make_pair
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;

ll N,M,H,W,K,A,B;
string S;
string alpha = "abcdefghijklmnopqrstuvwxyz";
string ALPHA = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";

int main(){
    cin>>S;
    vec a(3,0);
    ll ans = 1000;
    rep(i,S.size()-2){
        rep(j,3) {
            a[j] = S[i+j] - '0';
            rep(k,2-j) a[j] *= 10;
        }
        ans = min(ans,abs(a[0]+a[1]+a[2]-753));
    }
    cout<<ans<<endl;
}


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

using namespace std;
#ifdef _DEBUG
#define _GLIBCXX_DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

#define int long long
#define ll long long
#define ll1 1ll
#define ONE 1ll
#define DBG 1
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define rrep(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define loop(n) rep(loop, (0), (n))
#define all(c) begin(c), end(c)
const int INF =
    sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
const double PI = acos(-1);
const double EPS = 1e-9;
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
using pii = pair<int, int>;
// template<class T> ostream &operator<<(ostream &os,T &t){dump(t);return os;}
template <typename T, typename S>
istream &operator>>(istream &is, pair<T, S> &p) {
  is >> p.first >> p.second;
  return is;
}
template <typename T, typename S>
ostream &operator<<(ostream &os, pair<T, S> &p) {
  os << p.first << " " << p.second;
  return os;
}

template <typename T> void printvv(const vector<vector<T>> &v) {
  cerr << endl;
  rep(i, 0, v.size()) rep(j, 0, v[i].size()) {
    if (typeid(v[i][j]).name() == typeid(INF).name() and v[i][j] == INF) {
      cerr << "INF";
    } else
      cerr << v[i][j];
    cerr << (j == v[i].size() - 1 ? '\n' : ' ');
  }
  cerr << endl;
}
/*
   typedef __int128_t Int;
   std::ostream &operator<<(std::ostream &dest, __int128_t value) {
   std::ostream::sentry s(dest);
   if (s) {
   __uint128_t tmp = value < 0 ? -value : value;
   char buffer[128];
   char *d = std::end(buffer);
   do {
   --d;
 *d = "0123456789"[tmp % 10];
 tmp /= 10;
 } while (tmp != 0);
 if (value < 0) {
 --d;
 *d = '-';
 }
 int len = std::end(buffer) - d;
 if (dest.rdbuf()->sputn(d, len) != len) {
 dest.setstate(std::ios_base::badbit);
 }
 }
 return dest;
 }

 __int128 parse(string &s) {
 __int128 ret = 0;
 for (int i = 0; i < s.length(); i++)
 if ('0' <= s[i] && s[i] <= '9')
 ret = 10 * ret + s[i] - '0';
 return ret;
 }
 */

#ifndef _DEBUG
#define printvv(...)
#endif
void YES(bool f) { cout << (f ? "YES" : "NO") << endl; }
void Yes(bool f) { cout << (f ? "Yes" : "No") << endl; }
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 (a > b) {
    a = b;
    return true;
  }
  return false;
}

signed main(signed argc, char *argv[]) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(12);

  int x, y; cin >> x >> y;
  int a[13]={-1,0,2,0,1,0,1,0,0,1,0,1,0};
  Yes(a[x]==a[y]);

  return 0;
}


Measured memory_bytes: 256
import sys

sys.setrecursionlimit(500005)
stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().strip()

n = ns()
s = 0
for c in n:
    s += ord(c)-ord("0")
if s % 9 == 0:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 67748