akhauriyash/Code-Regression huggingface dataset:
//=============================================================
// Name        : b
// Date        : Wed Jul  3 22:42:36 CST 2019
// Accepted    : Wed Jul  3 22:43:40 CST 2019
// Author      : landcold7
// Description : Actions speak louder more than words
//=============================================================
#include <bits/stdc++.h>
using namespace std;

#define x first
#define y second
#define sz(x) ((int)(x).size())
#ifndef _has_trace
#define trace(...)
#endif
typedef long long ll;

void solve() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  int ans = 0;
  for (int i = 1; i < n - 1; ++i) {
    int x = a[i - 1], y = a[i + 1];
    if (x > y) {
      swap(x, y);
    }
    if (x < a[i] && a[i] < y) {
      ans++;
    }
  }
  cout << ans << "\n";
}

int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  solve();
  return 0;
}


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

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef long long LL;

typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

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

//constant
//--------------------------------------------
const double PI  = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
const LL MOD = 1e9+7; 
//vector <vector<int>> x(20, vector<int> (20)), y(20,vector<int> (20));
/*int counter_1 (int x) {
    if(x == 0) return 0;
    return counter_1(x >> 1) + (x & 1);
}*/


int main(){
    string s;
    cin>> s;
    int n=s.size();
    vector<LL> T(n+1,0);
    map<int, LL> cnt;
    LL k = 1;
    cnt[0]++;
    for(int i=n-1; i>=0; i--){
        LL tmp = s[i]-'0';
        T[i]=(T[i+1]+(tmp*k))%2019;
        //cout << tmp << ' ' << T[i+1] << endl;
        cnt[T[i]]++;
        k=(k*10)%2019;
    }
    LL ans = 0;
    for (auto& x : cnt){
            int m = x.second;
            ans+=(m*(m-1))/2;
            //cout << x.first << ' ' << x.second << endl;
    }
    cout << ans << endl;

}

Measured memory_bytes: 5184
//Heaplax
//别让自己后悔
#include<bits/stdc++.h>
#define int long long
#define LOG(x) cerr<<#x<<" = "<<x<<endl
#define add_edge(u,v) nxt[++cnt]=head[u],head[u]=cnt,to[cnt]=v
#define open(x) freopen(#x".in","r",stdin),freopen(#x".out","w",stdout)
char ch;bool fs;void re(int& x)
{
	while(ch=getchar(),ch<33);
	if(ch=='-')fs=1,x=0;else fs=0,x=ch-48;
	while(ch=getchar(),ch>33)x=x*10+ch-48;
	if(fs)x=-x;
}
using namespace std;
int n,cnt;
deque<int> que;
void solve(int n)
{
	if(n==1)return;
	if(n&1)
	{
		solve(n-1);
		que.push_front(++cnt);
	}
	else
	{
		solve(n>>1);
		que.push_back(++cnt);
	}
}
main()
{
	re(n);
	++n;
	solve(n);
	printf("%lld\n",cnt*2);
	for(int i:que)printf("%lld ",i);
	for(int i=1;i<=cnt;++i)printf("%lld ",i);
}


Measured memory_bytes: 256
#coding: utf-8

if __name__ == '__main__':
    while True:
        n = int(input())
        if n == 0:
            break
        flag = []
        for i in range(21):
            flag.append([0 for j in range(21)])
        for i in range(n):
            x,y = map(int,input().split())
            flag[x][y] = 1;
        m = int(input())
        nx,ny = 10,10
        for i in range(m):
            dre,num = input().split()
            num = int(num)
            if dre == 'N':
                for i in range(num):
                    ny += 1
                    if flag[nx][ny] == 1:
                        flag[nx][ny] = 0
            elif dre == 'W':
                for i in range(num):
                    nx -= 1
                    if flag[nx][ny] == 1:
                        flag[nx][ny] = 0
            elif dre == 'E':
                for i in range(num):
                    nx += 1
                    if flag[nx][ny] == 1:
                        flag[nx][ny] = 0
            else:
                for i in range(num):
                    ny -= 1
                    if flag[nx][ny] == 1:
                        flag[nx][ny] = 0
        ans = True
        for i in range(21):
            for j in range(21):
                if flag[i][j] == 1:
                    ans = False
        if ans:
            print('Yes')
        else:
            print('No')

Measured memory_bytes: 7704
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int main() {
  int n;
  cin >> n;
  ll ans = 0;
  for(ll ii = 0; ii < n; ii++) {
    ans += (ii + 1) * (n - ii);
  }
  for(ll ii = 1; ii < n; ii++) {
    ll u, v;
    cin >> u >> v;
    u--, v--;
    if(u > v) {
      swap(u, v);
    }
    ans -= (u + 1) * (n - v);
  }
  cout << ans;
}


Measured memory_bytes: 3604
<?php
# スペース区切りの整数の入力
# fscanf(STDIN, "%d %d", $a, $b);
# 文字列の入力
# fscanf(STDIN, "%s", $s);
# 出力
# echo ($a+$b)." ".$s."\n";

fscanf(STDIN, "%d", $w);
fscanf(STDIN, "%d", $n);

$amida = range(1, $w);

for($i = 0; $i < $n; $i++){
  fscanf(STDIN, "%d,%d", $a, $b);
  $tmp = $amida[$a-1];
  $amida[$a-1] = $amida[$b-1];
  $amida[$b-1] = $tmp;
}

for($i = 0; $i < $w; $i++){
  print $amida[$i]."\n";                                                                                              
}
?>

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

int main(){
  int r;
  cin >>r;
  double ans = 2*r*3.141592653;
  cout << fixed << setprecision(6) << ans << endl;
  return 0;
}

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

#define ll long long
#define INF 99999999
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()

int main()
{
    int N;
    cin >> N;
    vector<int> W(N);
    rep(i,N) cin >> W[i];

    int ans = INF;
    rep(i,N)
    {
        int tmp_left = 0;
        for(int j = i;j < N;j++) tmp_left += W[j];
        int tmp_right = 0;
        for(int j = 0;j < i;j++) tmp_right += W[j];
        ans = min(ans, abs(tmp_left - tmp_right));
    }
    cout << ans << endl;


}


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

using namespace std;

int main()
{
    int a, b, c;
    scanf("%d%d%d", &a, &b, &c);
    if(c > a + b)
    {
        printf("%d", a + b + b + 1);
    }
    else
    {
        printf("%d", b + c);
    }
    return 0;
}


Measured memory_bytes: 256
/*
 * Problem     : AOJ0014
 * Title       : Integral
 * Author      : mizo0203
 * Copyright   : Your copyright free
 * Description : スタック
 */

#include <stdio.h>
#include <stack>
using namespace std;

int d, sum;

bool input() {

  if (scanf("%d", &d) == EOF)
    return false;

  return true;
}

int main() {
  int i;

  while (input()) {
    sum = 0;
    for (i = d; i < 600; i+=d) {
      sum += i * i * d;
    }
    printf("%d\n", sum);
  }

  return 0;
}

Measured memory_bytes: 0
# coding: utf-8
import numpy as np


def solve(*args: str) -> str:
    n = int(args[0])
    S = np.array([0 if c == 'R' else (1 if c == 'G' else 2) for c in args[1]])

    RGB = [np.where(S == 0)[0],
           np.where(S == 1)[0],
           np.where(S == 2)[0]]
    X = [0]*3

    ret = 0
    X[S[0]] += 1
    for j in range(1, n-1):
        X[S[j]] += 1
        a, b = (S[j]+1) % 3, (S[j]-1) % 3
        ret += X[a]*(len(RGB[b])-X[b])
        ret += X[b]*(len(RGB[a])-X[a])
        ret -= len(RGB[a])+len(RGB[b])-len(
            np.unique(np.concatenate([RGB[a]-j, j-RGB[b]]))
        )

    return str(ret)


if __name__ == "__main__":
    print(solve(*(open(0).read().splitlines())))


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

#define DEBUG 0
#define lli long long int
#define REP(i,n) for(int i=0;i<n;i++)
#define LIM 1000000007

using namespace std;

vector<lli> makeYakusuList(lli num){
	vector<lli> rtlList;
	for(lli i=1;i*i<=num;i++){
		if(num % i == 0){
			rtlList.push_back(i);
			rtlList.push_back(num/i);
		}
	}

	sort(rtlList.begin(),rtlList.end());
	return rtlList;
}

int main(){

	lli n,m;
	cin>>n>>m;

	vector<lli> yakusuList;
	yakusuList = makeYakusuList(m);

	auto itr = upper_bound(yakusuList.begin(),yakusuList.end(),m/n);
	cout<<*(itr-1)<<endl;

	return 0;
}

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

int main(){
	long long n,m,l,r,ll,rr,temp;
	
	cin>>n>>m;
	ll=0;
	rr=n;
	for(int i=1;i<=m;i++){
		cin>>l>>r;
		ll=max(ll,l);
		rr=min(rr,r);
	}
	temp=rr-ll+1;
	if(temp<=0){
		temp=0;
	}
	cout<<temp<<endl;
}

Measured memory_bytes: 256
N = int(input())
arr = []
for i in range(N):
    a,b = list(map(int, input().split()))
    arr.append([a,b])
arr = sorted(arr, key=lambda x: x[0]+x[1], reverse=True)
ans = 0
for i in range(N):
    if i%2 == 0:
        ans += arr[i][0]
    else:
        ans -= arr[i][1]
print(ans)

Measured memory_bytes: 25640
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>

using namespace std;
int main()
{
    int n,i;
    long long int ans=0,cnt=1;
    vector<string> s;
    cin >> n;
    s.resize(n);
    for(i=0;i<n;i++){
        cin >> s[i];
        sort(s[i].begin(),s[i].end());
    }
    sort(s.begin(),s.end(), greater<string>());
    for(i=0;i<n-1;i++){
        if(s[i]==s[i+1]) cnt++;
        else{
            ans+=cnt*(cnt-1)/2;
            cnt=1;
        }
    }
    ans+=cnt*(cnt-1)/2;
    cout << ans;
    return 0;
}

Measured memory_bytes: 7296
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int N = in.nextInt(); int M = in.nextInt();

		// 壊れ段 スタート直前とゴール直後も登録しておく
		int[] a = new int[M + 2];
		a[0] = -1;
		a[M + 1] = N + 1;		
		
		long result = 1;
		final long D = 1000000007;
		for ( int i = 1; i <= M; i++ ) {
			a[i] = in.nextInt();
			result = (result * getStepPatterns(a[i] - a[i - 1] - 1)) % D;
		}
		result = (result * getStepPatterns(a[M + 1] - a[M] - 1)) % D;

		System.out.println(result);
		in.close();
	}

	// n段のステップパターンを計算する（nにはスタートとゴールの段を含む）
	private static long getStepPatterns(int ｎ) {
		long D = 1000000007;
		long ptrn = 0;

		if ( ｎ <= 0 ) ptrn = 0;
		else if ( ｎ == 1 || ｎ == 2 ) ptrn = 1;
		else
		// (p+2)段目のパターン = (p+1)段目のパターン + p段目のパターン
		if ( 3 <= ｎ ) {
			long p0, p1, p2;
			p0 = p1 = p2 = 1;

			for ( int i = 2; i < ｎ; i++ ) {
				p2 = (p1 + p0) % D;
				p0 = p1;
				p1 = p2;
			}
			ptrn = p2;
		}
		return ptrn;
	}
}

Measured memory_bytes: 49008
#include <iostream>
#include<math.h>
#include<iomanip>
#include<vector>
#include<algorithm>
#include<functional>
using namespace std;

int main()
{
    int  a=0,c=0,i=0,n=0;
    cin >> a;
    cout << a << ":";
    i=2;
    n=a;
    while(i<=sqrt(a)){
        while(n%i==0){
            n=n/i;
            cout <<' '<< i;
            c++;
        }
        i++;
    }
    if(n>sqrt(a) && n<a)cout << ' '<<n;
    if(a==n)cout << ' ' << a;
    cout << endl;
    //cout << b;
}

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

using VI = vector<int>;
using VVI = vector<VI>;
using PII = pair<int, int>;
using LL = long long;
using VL = vector<LL>;
using VVL = vector<VL>;
using PLL = pair<LL, LL>;
using VS = vector<string>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))

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

#define FF first
#define SS second
template<class S, class T>
istream& operator>>(istream& is, pair<S,T>& p){
  return is >> p.FF >> p.SS;
}
template<class S, class T>
ostream& operator<<(ostream& os, const pair<S,T>& p){
  return os << p.FF << " " << p.SS;
}
template<class T>
void maxi(T& x, T y){
  if(x < y) x = y;
}
template<class T>
void mini(T& x, T y){
  if(x > y) x = y;
}


const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL MOD = 1e9+7;

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

  string S, T;
  cin >> S >> T;
  REP(i,SZ(S))
	if(S.substr(i,SZ(T)) == T)
	  cout << i << endl;

  return 0;
}

Measured memory_bytes: 3224
n = int(input())
s = str(input())
ans = 0
for i in range(10):
    for j in range(10):
        for k in range(10):
            i_pos = s.find(str(i))

            if i_pos == -1:
                continue

            j_pos = s.find(str(j), i_pos+1)

            if j_pos == -1:
                continue

            k_pos = s.find(str(k), j_pos+1)

            if k_pos == -1:
                continue

            ans += 1

print(ans)


Measured memory_bytes: 3188
#include <stdio.h>

int main()
{
	int ia,ib;
	long int a,b,m,t;
	scanf( "%u", &ia );
	scanf( "%u", &ib );
	a = ia;
	b = ib;
	m = a*b;
	if (a<b) {
		t = a;
		a = b;
		b = t;
	}
	t = a%b;
	while (t!=0) {
		a = b;
		b = t;
		t = a%b;
	}
	printf("%ld",m/b);
}


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

#define rep(i,x,y) for(int i=(x);i<(y);++i)
#define debug(x) #x << "=" << (x)
 
#ifdef DEBUG
#define _GLIBCXX_DEBUG
#define dump(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define dump(x)
#endif

typedef long long int ll;
typedef pair<int,int> pii;
//template<typename T> using vec=std::vector<T>;

const int inf=1<<30;
const long long int infll=1LL<<58;
const double EPS=1e-9;
const int dx[]={1,0,-1,0},dy[]={0,1,0,-1};

template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){
	os << "[";
	for (const auto &v : vec) {
		os << v << ",";
	}
	os << "]";
	return os;
}

void solve(){
    int N,M,Q;
    cin >> N >> M >> Q;
    
    vector<int> a(M),q(Q);
    for(auto &x:a) cin >> x;
    for(auto &x:q) cin >> x;
    
    list<int> l;
    rep(i,0,N) l.push_back(i);
    auto pos=l.begin();
    int size=N;
    for(auto &step:a){
        if(step%2==0){
            rep(i,0,step){
                ++pos;
                if(pos==l.end()) pos=l.begin();
            }
        }else{
            rep(i,0,step){
                if(pos==l.begin()) pos=l.end();
                --pos;
            }
        }
        pos=l.erase(pos);
        if(pos==l.end()) pos=l.begin();
    }
    
    set<int> remaining;
    for(auto it=l.begin(); it!=l.end(); ++it) remaining.insert(*it);
    
    for(auto &x:q){
        if(remaining.find(x)!=remaining.end()) cout << 1 << endl;
        else cout << 0 << endl;
    }
}

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

Measured memory_bytes: 8124
N=int(input())
a=[int(i) for i in input().split()]
num4=0
num2=0
num1=0
for i in a:
        if i%4==0:
                num4+=1
        elif i%2==0:
                num2+=1
num1=N-num4-num2

if num2>0:
        num1+=1

if num1<=num4+1:
        print("Yes")
else:
        print("No")

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

if sum(A) < sum(B):
    print(-1)
else:
    diff = [0] * N
    for i in range(N):
        diff[i] = A[i] - B[i]
    
    diff.sort()

    ans = 0

    l = 0
    r = N - 1

    point = 0
    while(True):
        left = diff[l]
        if left < 0:
            if point >= abs(left):
                ans += 1
                point -= abs(left)
                l += 1
            else:
                ans += 1
                point += diff[r]
                r -= 1
        else:
            break
    
    print(ans)

Measured memory_bytes: 18524
#include "bits/stdc++.h"
using namespace std;

#define all(x)  x.begin(), x.end()
#define mp      make_pair
#define pii     pair<int, int>
#define pll     pair<long long, long long>
#define ll      long long

int main() {
        string s;
        cin >> s;
        cout << s.substr(0, s.size() - 8) << endl;
        return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define Rep(i,n) for(int i=0;i<(int)(n);i++)
#define For(i,n1,n2) for(int i=(int)(n1);i<(int)(n2);i++)
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define RREP(i,n) for(ll i=((ll)(n)-1);i>=0;i--)
#define FOR(i,n1,n2) for(ll i=(ll)(n1);i<(ll)(n2);i++)
#define RFOR(i,n1,n2) for(ll i=((ll)(n1)-1);i>=(ll)(n2);i--)
#define all(a)  (a).begin(),(a).end()
#define SORT(a) sort((a).begin(),(a).end())
#define oorret 0
#define oor(x) [&](){try{x;} catch(const out_of_range& oor){return oorret;} return x;}()
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
template<typename T1, typename T2> inline bool chmin(T1& a, T2 b) { if (a > b) { a = b; return 1; }return 0; }
template<typename T1, typename T2> inline bool chmax(T1& a, T2 b) { if (a <= b) { a = b; return 1; }return 0; }
template<class Type>struct is_vector : std::false_type {};
template<class ValueType, class Alloc>struct is_vector<std::vector<ValueType, Alloc>> : std::true_type {};
template <typename T> inline ostream& operator << (ostream& out, const vector<T>& v) {
	if (v.empty())return out;
	constexpr bool is_vector_v = is_vector<T>::value;
	if (is_vector_v)for (auto itr = v.begin(); itr != v.end();)out << (*itr), out << ((++itr != v.end()) ? "\n" : "");
	else for (auto itr = v.begin(); itr != v.end();)out << (*itr), out << ((++itr != v.end()) ? " " : "");
	return out;
}
inline void put() {}
template<class T> inline void put(const T& first) { std::cout << first; printf("\n"); }
template<class T, class... N> inline void put(const T& first, const N& ... rest) { std::cout << first; printf(" "); put(rest...); }
inline void putn() {}
template<class T, class... N> inline void putn(const T& first, const N& ... rest) { std::cout << first; printf("\n"); putn(rest...); }

int main() {
	int n;
	cin >> n;
	vector<ll> a(n), b(n);
	REP(i, n) {
		cin >> a[i];
	}
	REP(i, n) {
		cin >> b[i];
	}
	ll res = 0;
	priority_queue<int> q;
	Rep(i, n) {
		if (i == 0) {
			if (b[i] > b[i + 1] + b[n - 1]) {
				q.push(i);
			}
		} else if (i == n - 1) {
			if (b[i] > b[0] + b[i - 1]) {
				q.push(i);
			}
		} else {
			if (b[i] > b[i + 1] + b[i - 1]) {
				q.push(i);
			}
		}
	}
	while (!q.empty()) {
		int i = q.top();
		q.pop();
		if (i == 0) {
			if (b[i] > b[i + 1] + b[n - 1]) {
				ll temp = b[i + 1] + b[n - 1];
				ll t = (b[i] - a[i]) / temp;
				if (t > 0) {
					res += t;
					b[i] -= t * temp;
					q.push(n - 1);
					q.push(i + 1);
				}
				
			}
		} else if (i == n - 1) {
			if (b[i] > b[0] + b[i - 1]) {
				ll temp = b[0] + b[i - 1];
				ll t = (b[i] - a[i]) / temp;
				if (t > 0) {
					res += t;
					b[i] -= t * temp;
					q.push(i - 1);
					q.push(0);
				}
				
			}
		} else {
			if (b[i] > b[i + 1] + b[i - 1]) {
				ll temp = b[i + 1] + b[i - 1];
				ll t = (b[i] - a[i]) / temp;
				if (t > 0) {
					res += t;
					b[i] -= t * temp;
					q.push(i - 1);
					q.push(i + 1);
				}
			}
		}
	}
	bool flag = true;
	REP(i, n) {
		if (a[i] != b[i]) {
			flag = false;
		}
	}
	if (flag) {
		put(res);
	} else {
		//at(1000000000);
		put(-1);
	}
	
	return 0;
}

Measured memory_bytes: 3964
import sys
readline = sys.stdin.readline
write = sys.stdout.write

def convert(y, m, d):
    if m <= 2:
        m += 12
        y -= 1
    mjd = int(365.25*y) + (y//400) - (y//100) + int(30.59*(m-2)) + d - 678912
    return mjd

youbi = [
    "Monday",
    "Tuesday",
    "Wednesday",
    "Thursday",
    "Friday",
    "Saturday",
    "Sunday",
]

def solve():
    m, d = map(int, readline().split())
    if m == 0:
        return False
    write("%s\n" % youbi[(convert(2004, m, d) - convert(2004, 1, 1) + 3) % 7])
    return True
while solve():
    ...


Measured memory_bytes: 5624
#include <bits/stdc++.h>
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
using namespace std;

int main()
{
    long long H, W;
    cin >> H >> W;
    if (H % 3 == 0 || W % 3 == 0) {
        cout << 0 << endl;
        return 0;
    }

    if (H == 2 && W == 2) {
        cout << 1 << endl;
        return 0;
    }

    //Hの方が小さいとする
    if (H > W)
        swap(H, W);

    //縦に三分割すると差の最小はH
    long long ans = min(H, W);

    for (int k = 0; k < 2; k++) {
        if (k == 1)
            swap(H, W);
        //縦に一本,その中央付近から左に一本区切りを入れた場合
        for (long long i = 1; i < W; i++) {
            if (H % 2 == 0) { //上下に分かれたものの面積は同じ
                //左下(=左上)
                long long s1 = i * H / 2;

                //右側
                long long s2 = H * (W - i);

                ans = min(ans, abs(s1 - s2));
            } else {
                vector<long long> s;
                //左上
                s.push_back(i * (H - 1) / 2);

                //左下
                s.push_back(i * (H + 1) / 2);

                //右側
                s.push_back(H * (W - i));

                ans = min(ans, *(max_element(s.begin(), s.end())) - *(min_element(s.begin(), s.end())));
            }
        }
    }

    cout << ans << endl;
}


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

using namespace std;

int a[301];

int main () {                           
	int l, r;
	cin >> l >> r;
	if (l <= 0 && r >= 0) {
		cout << "Zero";
		return 0;
	}
	if (l > 0) {
		cout << "Positive";
		return 0;
	}
	if ((r - l + 1) % 2) {
		cout << "Negative";
	}
	else cout << "Positive";
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <set>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <fstream>
#include <bitset>
#include <queue>
#include <stack>
#include <deque>
#include <complex>
#include <iomanip>
#include <stdio.h>
#include <string.h>
#include <random>
#include <functional>

using std::cin;
using std::cout;
using std::cerr;
using std::endl;

using std::map;
using std::set;
using std::bitset;
using std::vector;
using std::string;
using std::multimap;
using std::multiset;
using std::deque;
using std::queue;
using std::stack;
using std::pair;
using std::iterator;

using std::sort;
using std::stable_sort;
using std::reverse;
using std::max_element;
using std::min_element;
using std::unique;
using std::ios_base;
using std::swap;
using std::fill;

using std::setprecision;
using std::fixed;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<long long> vl;
typedef string S;

ll min(ll a, ll b) {return a < b ? a : b;}
ll min(int a, ll b) {return a < b ? a : b;}
ll min(ll a, int b) {return a < b ? a : b;}
ll min(int a, int b) {return a < b ? a : b;}

ll max(ll a, ll b) {return a > b ? a : b;}
ll max(int a, ll b) {return a > b ? a : b;}
ll max(ll a, int b) {return a > b ? a : b;}
ll max(int a, int b) {return a > b ? a : b;}

namespace MySpace{

};

#define F(i, n) for (int (i) = 0; (i) != (n); (i)++)
#define fi first
#define se second
#define re return
#define all(x) (x).begin(), (x).end()
#define int long long

const int N = 111;
const int MOD = 1e9 + 7;

int n;
int h[500];
int dp[N];
int kek[N][N];

long long inq(long long x, long long y)
{
    if (y == 0) return 1;
    long long l = inq(x, y / 2);
    if (y % 2) return l * l % MOD * x % MOD;
    return l * l % MOD;
}

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin >> n;
    h[0] = 1, h[n + 1] = 1;
    for (int i = 1; i <= n; i++) cin >> h[i];
    for (int r = 1; r <= n; r++)
    {
        int limit = min(h[r], h[r + 1]);
        for (int i = r; i >= 1; i--)
        {
            int a = max(h[i - 1], limit);
            int b = h[i];
            kek[i][r] = kek[i + 1][r];
            if (b >= a)
            {
                kek[i][r] += b - a;
            }
            limit = min(limit, h[i]);
        }
    }
    //for (int l = 1; l <= n; cout << "\n", l++) for (int r = 1; r <= n; r++) cout << kek[l][r] << " ";
    dp[0] = 1;
    for (int i = 1; i <= n; i++)
    {
        for (int j = 0; j < i; j++)
        {
            dp[i] = (dp[i] + dp[j] * inq(2, kek[j + 1][i])) % MOD;
        }
    }
    cout << 2 * dp[n] % MOD;
}


Measured memory_bytes: 384
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;

namespace A
{
    public class Program
    {
        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            Solve();
            Console.Out.Flush();
        }

        public static void Solve()
        {
            var ap = Console.ReadLine().Trim().Split(' ').Select(int.Parse).ToArray();
            Console.WriteLine((int)(ap[0] * 3 + ap[1]) / 2);
        }
    }
}


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

using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define ll long long int

int main(){
  int P,Q,R;
  cin>>P>>Q>>R;
  cout<<min({P+Q,Q+R,R+P})<<endl;

  return 0;
}
  


Measured memory_bytes: 256
from math import factorial
n = int(input())
l = list(map(int, input().split()))
l.sort()
disabled = 0
for i in range(n-2):
    for j in range(i+1,n-1):
            for k in range(j+1,n):
                if (l[i] + l[j]) <= l[k] or l[i] == l[j] or l[j] == l[k]:
                    disabled += 1
if n >= 3:
    print(int(factorial(n) / factorial(3) / factorial(n-3) - disabled))
else:
    print("0")

Measured memory_bytes: 9172
#include <bits/stdc++.h>
#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 equals(a, b) (fabs((a) - (b)) < EPS)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
const ll mod = 1000000007;
//const ll mod = 998244353;
const int inf = 1e9 + 10;
const ll INF = 1e18;
const ld EPS = 1e-10;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
template<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 (a>b) { a=b; return 1; } return 0; }

ll f[1000100], s[1000100];

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

  ll n;
  cin >> n;

  f[1] = n;
  s[1] = n;
  f[2] = n * n % mod;
  s[2] = (s[1] + f[2]) % mod;
  FOR(i, 3, n + 1) {
    f[i] = f[i - 1];
    f[i] = (f[i] + (n - 1) * (n - 1)) % mod;
    f[i] = (f[i] + s[i - 3] + n - 1 - (i - 3)) % mod;
    s[i] = (s[i - 1] + f[i]) % mod;
  }
  cout << f[n] << '\n';

  

  




  
  return 0;
}

Measured memory_bytes: 19280
#include <algorithm>
#include <iostream>
#include <stdio.h>

#define MAX_N 100

using namespace std;

int A[MAX_N]{};

int main() {
  int N;
  cin >> N;
  for (int i = 0; i < N; ++i) {
    cin >> A[i];
  }
  sort(A, A + N);
  int alice = 0;
  int bob = 0;
  for (int i = N - 1; i >= 0; i -= 2) {
    alice += A[i];
  }
  for (int i = N - 2; i >= 0; i -= 2) {
    bob += A[i];
  }
  printf("%d\n", alice - bob);
}

Measured memory_bytes: 3256
import java.util.Scanner;

class Main {
	static int mod = 1000000007;
	private static long[] fact;
	private static long[] inv_fact;

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();

		int sum = a + b+ c;

		if(sum>=22) {
			System.out.println("bust");
		} else {
			System.out.println("win");
		}

	}

}

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

const int MAXN = 1000000;

int n;
long long ans;
long long v[MAXN];

int main(){
	scanf("%d", &n);
	//n = 300000;
	stack<long long> stk;
	for(int i = 1; i <= n; i++)
		//v[i] = 100000000;
		scanf("%lld", &v[i]);
	for(int i = 1; i <= n + 1; i++){
		while(!stk.empty() && v[stk.top()] >= v[i]){
			long long height = v[stk.top()];
			int idx = stk.top();
			stk.pop();
			int right = stk.empty() ? 0: stk.top(), left = i;
			ans += v[idx] * (idx - right) * (left - idx);
			//printf("v[%d] = %lld\nleft = %d, right = %d\nsum = %lld\n", idx, v[idx], right, left, v[idx] * (idx - right) * (left - idx));
		}
		stk.push(i);
	}
	printf("%lld\n", ans);
}

Measured memory_bytes: 3456
import numpy as np


def getInput():
    """

    :return: list of list of str. 1st dim: row, 2nd dim: column.
    """
    separator = ' '
    ret_array = []
    while True:
        try:
            row = input().split(sep=separator)
            ret_array.append(row)
        except EOFError:
            break
    return ret_array


g = getInput()

# number
N, M = np.array(list(map(int, g[0])), dtype=np.int32)
C = 1900 * M + 100 * (N - M)
print(np.int32(C*(2**M)))

Measured memory_bytes: 12508
using System.Linq;
using System;

public class Hello
{
    public static void Main()
    {
        var n = long.Parse(Console.ReadLine().Trim());
        var a = new long[5];
        for (int i = 0; i < 5; i++) a[i] =  long.Parse(Console.ReadLine().Trim());
        var b = a.Min();
        var c = (n + b - 1) / b;
        var ans = c + 4L;
        Console.WriteLine(ans);
    }
}

Measured memory_bytes: 13268
import java.util.*;

public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int A1 = sc.nextInt();
        int A2 = sc.nextInt();
        int A3 = sc.nextInt();
		int mic = Math.abs(Math.max(Math.max(A1, A2), A3) - Math.min(Math.min(A1,A2), A3));
		System.out.println(mic);
	}
}


Measured memory_bytes: 23764
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
int gcd(int x, int y) { return (x % y)? gcd(y, x % y): y; }    //最大公約数
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }     //最小公倍数
using Graph = vector<vector<ll>>;
ll inf=300000000000000000;
const double PI = 3.14159265358979323846;
int main(){
  ll n;
  cin >> n;
  ll u;
  cin >> u;
  if(n==0&&u==1){
    cout << 1 << endl;
    return 0;
  }
  if(u!=0){
    cout << -1 << endl;
    return 0;
  }
  ll cnt=-1;
  ll k[n+1];
  k[0]=0;
  rep(i,n){
    cin >> k[1+i];
    cnt+=k[1+i];
  }
  ll ans=1;
  ll ma[n+1];
  ma[0]=1;
  rep(i,n)ma[i+1]=0;
  rep(i,n){
    if(ma[i]+min(cnt,ma[i])<k[1+i]){
      cout << -1 << endl;
      return 0;
    }
    if(ma[i]+min(cnt,ma[i])==k[i+1]&&i!=n-1){
      cout << -1 << endl;
      return 0;
    }
     
    
    ll o=min(cnt,ma[i]);
    ma[i+1]=ma[i]+o-k[i+1];
    cnt-=o;
    ans+=k[i+1]+ma[i+1];
  }
  cout << ans << endl;
}  


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

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

Measured memory_bytes: 4844
#include<cstdio>
#include<cstring>
#include<algorithm>
int c[]={111,222,333,444,555,666,777,888,999};
int n;
int main()
{
    scanf("%d",&n);
    for(int i=0;i<9;i++)
    {
        if(n<=c[i])
        {
            printf("%d\n",c[i]);
            break;
        }
    }
}


Measured memory_bytes: 128
def eat(x,n):
    ans,p = 0,0
    while(n>=0 and x>0):
        p = 2**(n+1)-1
        if x>=p:
            x-=p
            ans+=int((p+1)/2)
        else:
            x-=1
        n-=1
    return ans

if __name__ == '__main__':
    n,x=map(int, input().split())
    p = 2**(n+1)-1
    if x<n:
        print(0)
    elif x>=2*p-n-1:
        print(p)
    else:
        print(int(eat(x,n)))



Measured memory_bytes: 3064
N, W = [int(_) for _ in input().split()]
dp = [0] * (W + 10)  # [[0] * 3 for _ in range(10 ** 5 + 2)]

for i in range(1, N + 1):
    w, v = [int(_) for _ in input().split()]
    for j in range(len(dp) - 1, -1, -1):
        if j + w <= W:
            dp[j + w] = max(dp[j + w], dp[j] + v)

print(max(dp))


Measured memory_bytes: 42348
#include <iostream>
#include<math.h>
 
using namespace std; 
int main() {
  long long N;
  cin >> N;
  long long power = 1;
  for(long long i = 1; i <= N; i++){
    power = (power * i) % 1000000007;
  }
 
  cout << power;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef pair<P,int> T;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000
#define sz(x) ((int)(x).size())
#define fi first
#define sec second
#define all(x) (x).begin(),(x).end()
#define sq(x) ((x)*(x))
#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define repn(i,a,n) for(int (i)=(a);(i)<(int)(n);(i)++)
#define EQ(a,b) (abs((a)-(b))<eps)
template<class T> void chmin(T& a,const T& b){if(a>b)a=b;}
template<class T> void chmax(T& a,const T& b){if(a<b)a=b;}
int N;
ll L[100100],R[100100];
int main(){
	cin >> N;
	for(int i=0;i<N;i++){
		cin >> L[i] >> R[i];
	}
	sort(L,L+N);
	reverse(L,L+N);
	sort(R,R+N);
	for(int i=0;i<N;i++){
		L[i+1] += L[i];
		R[i+1] += R[i];
	}
	int r = 0;
	ll ans = 0ll;
	for(int l=0;l<=N;l++){
		for(int r=max(0,l-1);r<=min(N,l+1);r++){
			ll a = (l==0)?0ll:L[l-1];
			ll b = (r==0)?0ll:R[r-1];
			ans = max(ans,2ll*a-2ll*b);
		}
	}
	cout << ans << endl;
	return 0;
}



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

int main(){
  int a , b , c , d;
  cin >> a >> b >> c >> d;
  int an = max(a , b) - min(a , b);
  int sw = max(b , c) - min(b , c);
  int er = max(a , c) - min(a , c);
  if( an <= d && sw <= d){
    cout << "Yes" << endl;
  }
  else if(er <= d){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        char[] w = sc.next().toCharArray();
        HashMap<Character,Integer> map = new HashMap<>();
        for(char c : w){
            if(map.containsKey(c)){
                map.put(c,map.get(c)+1);
            }else{
                map.put(c,1);
            }
        }
        for(Map.Entry<Character, Integer> entry : map.entrySet()){
            if(entry.getValue()% 2 != 0){
                System.out.println("No");
                return;
            }
        }
        System.out.println("Yes");
    }
}


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

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

using namespace std;

int main() {
  int n;
  std::cin >> n;
  bool ok = false;

  for (int i = 0; i <= n; ++i) {
    if (floor(i * 1.08) == n) {
      std::cout << i << std::endl;
      ok = true;
      break;
    }
  }
  if (!ok) {
    std::cout << ":(" << std::endl;
  }
  return 0;
}


Measured memory_bytes: 3592
require 'prime'

K = gets.to_i

ans = 0

(1..K).each do |a|
  v = a
  (1..K).each do |b|
    t = v.gcd(b)

    (1..K).each do |c|
      ans += t.gcd(c)
    end
  end
end

puts ans


Measured memory_bytes: 14412
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<map>
#define SF scanf
#define PF printf
#define MAXN 100010
using namespace std;
int n;
map<long long,int> used;
long long a,las;
long long ans=0;
int main(){
	SF("%d",&n);
	used[0]++;
	for(int i=1;i<=n;i++){
		SF("%lld",&a);
		las+=a;
		ans+=used[las];
		used[las]++;
	}
	PF("%lld",ans);
} 

Measured memory_bytes: 12800
odd_number = input()
even_number = input()
passwd = ""
for i in range(len(even_number)):
  passwd += odd_number[i]
  passwd += even_number[i]
if len(odd_number) - len(even_number) == 1:
  passwd += odd_number[len(odd_number) - 1]
print(passwd)

Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <stdlib.h>
#include <map>
#define MOD_P 1000000007
#define ll long long
using namespace std;



int main()
{
	string test;
	int n;
	ll ans = 0LL;
	map<string, int> dic;
	cin >> n;

	for (int i = 0; i < n; i++) {
		cin >> test;
		sort(test.begin(), test.end());
		dic[test]++;
	}

	for (pair<string,int> i : dic) {
		//printf("[%s,%d]\n", i.first.c_str(), i.second);
		ans += ((ll)i.second * ((ll)i.second - 1LL))/2LL;
	}

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

	return 0;
}

Measured memory_bytes: 11136
#include<bits/stdc++.h>
#define endl '\n'
using namespace std;
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int k;
  int cnt = 0;

  cin >> k;

  for(int i = 1;i <= k;i += 2){
    for(int j = 2;j <= k;j += 2){
      cnt ++;
    }
  }

  cout << cnt << endl;
  return 0;
}

    


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a) for(int i = 0; i < (a); i++)
#define ALL(a) (a).begin(),(a).end()
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9;
const long long LINF = 1e18;
const long long MOD = 1e9 + 7;

signed main(){
    string s,t;
    cin >> s >> t;
    int n = s.size(), m = t.size();
    vector<vector<int>> dp(vector<vector<int>>(n + 1, vector<int>(m + 1, 0)));
    for(int i = 0; i < n; i++){
        for(int j = 0; j < m; j++){
            if(s[i] == t[j]) dp[i + 1][j + 1] = dp[i][j] + 1;
            else dp[i + 1][j + 1] = max(dp[i + 1][j], dp[i][j + 1]);
        }
    }
    string ans;
    int i = n, j = m;
    while(i && j){
        if(dp[i][j] == dp[i - 1][j]) i--;
        else if(dp[i][j] == dp[i][j - 1]) j--;
        else{
            i--;
            j--;
            ans.push_back(s[i]);
        }
    }
    reverse(ALL(ans));
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 35584
x,y,a,b,c = map(int,input().split())
p = list(map(int,input().split()))
q = list(map(int,input().split()))
r = list(map(int,input().split()))

p.sort()
q.sort()
r.sort(reverse=True)

ppick = p[-x:]
qpick = q[-y:]
pi = 0
qi = 0

for i in range(len(r)):
    if pi >= x:
        while True:
            if qi < y and i < c and r[i] > qpick[qi]:
                qpick[qi] = r[i]
                qi += 1
                i += 1
            else:
                break
    elif qi >= y:
        while True:
            if pi < x and i < c and r[i] > ppick[pi]:
                ppick[pi] = r[i]
                pi += 1
                i += 1
            else:
                break
    elif ppick[pi] >= qpick[qi] and qpick[qi] < r[i]:
        qpick[qi] = r[i]
        qi += 1
        continue
    elif ppick[pi] < qpick[qi] and ppick[pi] < r[i]:
        ppick[pi] = r[i]
        pi += 1
        continue
    break

print(sum(ppick) + sum(qpick))


Measured memory_bytes: 23216
w = list(input())
w_unique = list(set(w))
w_unique_count = []

for i in range(len(w_unique)):
    w_unique_count.append(w.count(w_unique[i]))

check = 0

for i in range(len(w_unique)):
    if w_unique_count[i] % 2 == 1:
        check = 1

if check == 0:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3064
#include <iostream>
#include <vector>

using namespace std;

int main(void) {
    int N, K, Q;
    cin >> N >> K >> Q;
    vector<int> point(N, K-Q);
    while(Q--) {
        int A;
        cin >> A;
        --A;
        point[A]++;
    }

    for(auto e: point) {
        if(e > 0) {
            cout << "Yes" << endl;
        } else {
            cout << "No" << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 1024
import java.io.*;
import java.util.*;
import java.math.*;
     
public class Main{
	public static void main(String[] args) throws Exception {
	IO io = new IO();
	PrintWriter out = new PrintWriter(System.out);
	Solver sr = new Solver();
	sr.solve(io,out);
	out.flush();
	out.close();
    	}

	static class Solver
	{
	    void solve(IO io, PrintWriter out)
	    {
          long n = io.nextLong();
          long x = io.nextLong();
          long y = io.nextLong();
          
          long tmp = n%(x+y);
          long num = n/(x+y);
          out.print((num*x+(tmp>=x?x:tmp)));
	    }
    	
	}
	//Special thanks to Petr (on codeforces) who inspired me to implement IO class!
	static class IO
	{
    	BufferedReader reader;
        StringTokenizer tokenizer;
    	public IO() {
                reader = new BufferedReader(new InputStreamReader(System.in));
                tokenizer = null;
            }
     
        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }
        public String nextLine() {
            String s="";
            try {
                    s=reader.readLine();
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            return s;
        }
        public int nextInt() {
            return Integer.parseInt(next());
        }
    
        public long nextLong() {
            return Long.parseLong(next());
        }
    	double nextDouble()
    	{
    		return Double.parseDouble(next());
    	}
	}
}

Measured memory_bytes: 21844
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        while(true){
            int H = sc.nextInt();
            int W = sc.nextInt();
            if(H == 0 && W == 0){
                break;
            }else{
                for(int i = 0;i < H; i++){
                    for(int j = 0; j < W;j++){
                        if ((i + j) % 2 == 0) {
                            System.out.printf("#");
                        }else{
                            System.out.printf(".");
                        }
                    }
                    System.out.printf("\n");
                }
                System.out.printf("\n");
            }

        }
    }

}



Measured memory_bytes: 63504
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <cstdio>
#include <string>
#include <cmath>
#include <queue>
#include <tuple>
#include <bitset>
#include <cassert>
#include <chrono>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <random>
#include <set>
#include <stack>
#include <time.h>

//#include <bits/stdc++.h>
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repr(i, n) for (int i = (n) - 1; i >= 0; i--)
#define FOR(i,i0,n) for(int (i)=(i0);(i)<(n);(i)++)
#define FORR(i,i0,n) for(int (i)=(n)-1; (i)>=(i0);(i)--)
#define SORT(x) sort(x.begin(),x.end())
#define SORTR(x) sort(x.begin(),x.end(),greater<vector<int>>())
#define rn return
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple

using namespace std;
using ll = long long;
typedef std::pair<int,int> pii;
typedef std::pair<int,double> pid;
typedef std::vector<int> vi;
typedef std::vector<pii> vii;

#define PI 3.14159265358979323846264338327950L
const int mod = 1000000007;



void solve(){
    ll n,d;
    cin >> n >> d;
    d *= d;
    int ans = 0;
    rep(i,n){
        ll x,y;
        cin >> x >> y;
        ll da = x*x + y*y;
        if (da <= d) ans++;
    }
    cout << ans;
}


int main(){
    int T;
    //cin >> T;
    T = 1;
    while(T--){
        solve();
        cout << endl;
    }
}











Measured memory_bytes: 3632
#include <stdio.h>
int main(void){
    long long a;
    long long b;
    long long c;
    long long k;
    int i, ans = 0;
    
    scanf("%lld %lld %lld %lld", &a, &b, &c, &k);
    
    for(i = 0; i < k; i++){
        if(a > 0){
            ans = ans + 1;
            a = a - 1;
        }else if(b > 0){
            ans = ans + 0;
            b = b - 1;
        }else if(c > 0){
            ans = ans - 1;
            c = c - 1;
        }
    }
    printf("%d\n", ans);
}


Measured memory_bytes: 1732
from collections import Counter

N=int(input())
A=list(map(int, input().split()))
D=Counter(A)
ans=1
p=10**9+7
for k,v in D.items():

    if k==0:
        if v!=1:
            print(0)
            exit()
    else:
        if v!=2:
            print(0)
            exit()
        else:
            ans*=2
            ans%=p
print(ans)

Measured memory_bytes: 92728
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const ll INF = 1LL << 60;

int main() {
    int N, M; cin >> N >> M;
    int t = pow(2, M);
    int ans = ((N - M) * 100 + M * 1900) * t;
    cout << ans << endl;
    return 0;
}

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

int main() {
   string S;
  vector<int>num(26);
  while(getline(cin,S)){
  for(int i=0;i<S.size();i++){
    S.at(i)=(char)tolower(S.at(i));
   if(isalpha(S.at(i))){ num.at(S.at(i)-'a')++;}}}
  for(int i=0;i<num.size();i++){
  cout<<(char)('a'+i)<<" "<<":"<<" "<<num.at(i)<<endl;}
  return 0;
}


Measured memory_bytes: 3164
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i=0; i<(int)(n); i++)
typedef unsigned long long ULL;
const int nMax=2e6+1, MOD=1e9+7;
ULL inv[nMax], fct[nMax], ivf[nMax];
ULL Comb(int n, int r){ return (((fct[n]*ivf[r])%MOD)*ivf[n-r])%MOD; }
ULL pw(ULL a, ULL n){ ULL b=1; while(n){ if(n&1){ b=(b*a)%MOD; } a=(a*a)%MOD; n>>=1; } return b; }
int main(){
inv[1]=fct[0]=fct[1]=ivf[0]=ivf[1]=1;
for(int i=2; i<nMax; i++){ 
  inv[i]=((MOD-MOD/i)*inv[MOD%i])%MOD;
  fct[i]=(fct[i-1]*i)%MOD; ivf[i]=(ivf[i-1]*inv[i])%MOD;
}
ULL K, N, ans=0; string S; cin >> K >> S; N=S.size();
REP(i, K+1){ ans=(ans+(((pw(25, K-i)*pw(26, i))%MOD)*Comb(N+K-i-1, N-1))%MOD)%MOD; }
cout << ans << "\n";
}


Measured memory_bytes: 52216