akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
 
using namespace std;
 
typedef vector< int > vi;
typedef vector< vi > vvi;
typedef pair< int,int > ii;
#define ll	long long
#define sz(a) int((a).size())
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define tr(c,i) for(typeof((c)).begin() i = (c).begin(); i != (c).end(); i++)
#define present(c,x) ((c).find(x) != (c).end())
#define cpresent(c,x) (find(all(c),x) != (c).end())
#define ios	ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define hell 1000000007
#define M_PI 3.141592653589793238462643383279502884L

int main() {
	ios;
	double r;
	cin>>r;
	cout<<setprecision(15)<<(2 * M_PI * r);
	return 0;
}


Measured memory_bytes: 3692
#include <cassert>

#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
//#include <boost/foreach.hpp>
//#include <boost/range/algorithm.hpp>
#define rep(i,j,k) for(int i=(int)j;i<(int)k;i++)
#define ll long long
#define Sort(v) sort(all(v))
#define INF 1e9
#define LINF 1e18
#define END return 0
#define pb push_back
#define se second
#define fi first
#define pb push_back
#define all(v) (v).begin() , (v).end()
#define MP make_pair
#define MOD 1000000007LL
#define int long long
using namespace std;
int day[12]={31,28,31,30,31,30,31,31,30,31,30,31};
struct edge{int to,cost;};
typedef pair<int,int> P;

vector<bool> visit(100010,false);
vector<int> d(100010);
vector<edge> g[100010];

void dfs(int v,int parent,int dist){
    d[v]=dist;
    rep(i,0,g[v].size()){
        edge e=g[v][i];
        if(e.to==parent)continue;
        dfs(e.to,v,dist+e.cost);
    }
    return;
}

signed main (){
    int n;
    cin>>n;
    rep(i,0,n-1){
        int a,b,c;
        cin>>a>>b>>c;
        a--; b--;
        g[a].push_back({b,c});
        g[b].push_back({a,c});
    }
    int q,k;cin>>q>>k;
    k--;
    d[k]=0;
    dfs(k,-1,0);

    rep(i,0,q){
        int x,y;cin>>x>>y; x--;y--;
        cout<<d[x]+d[y]<<endl;
    }
    

    
}
/*
1-21-2
*/


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

int main() {
    int a, b, c, x;
    std::cin >> a >> b >> c >> x;

    int ans = 0;
    for (int i = 0; i <= a; i++)
    {
        for (int j = 0; j <= b; j++) {
            for (int k = 0; k <= c; k++) {
                if(500*i+100*j+50*k == x) {
                    ans++;
                }
            }
        }
    }

    std::cout << ans << "\n";
}

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

const ll MAXX = 1e18;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    //freopen("INP.txt", "r", stdin);
    //freopen("OUT.txt", "w", stdout);
	ll n;
	cin >> n;
	ll cnt = 0;
	for (ll i = 1; i <= n; i++) {
		if (i % 2 != 0) {
			cnt++;
		}
	}
	cout << setprecision(13) << (cnt * 1.0) / n << '\n';
	return 0;
}

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

#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 1000000007;
const ll MAX = 1000001;

ll max(ll a, ll b) {
	if (a > b) { return a; }
	return b;
}

ll min(ll a, ll b) {
	if (a > b) { return b; }
	return a;
}

ll gcd(ll a, ll b) {
	if (b == 0) { return a; }
	if (a < b) { return gcd(b, a); }
	return gcd(b, a%b);
}

ll lcm(ll a, ll b) {
	return a * b / gcd(a, b);
}

struct edge {
	ll ind;
	ll to;
	ll d;
};


///////////////////////////


int main() {
    ll N;
    cin >>N;
	vector<ll> a(N+1);

    repn(i,N) cin >>a[i];

   ll count[MAX]={};

   repn(i,N){count[a[i]]++;}

   ll ans=0;

   repn(i,MAX-2){
       ans=max(ans,count[i-1]+count[i]+count[i+1]);
   }

   cout <<ans;

}


Measured memory_bytes: 8832
#!/usr/bin/env python
from fractions import gcd
#from math import gcd

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

    L = [[] for i in range(N+1)]
    R = [[] for i in range(N+1)]
    L[0] = 0
    R[N] = 0

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

    M = [[] for i in range(N)]
    for i in range(N):
        M[i] = gcd(L[i], R[i+1])

    return max(M)

if __name__ == '__main__':
    print(main())

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

int n;
vector <int> a;

int main(void) {
	cin >> n;
	for(int i = 0; i < n; i++) {
		int y;
		cin >> y;
		a.push_back(y);
	}

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

	int m = a[n - 1];

	if(m == 1) 
		return cout << (n == 2 ? "Possible" : "Impossible") << '\n', 0;
	if(m % 2 == 0) {
		bool ok = true;
		for(long i = m / 2 + 1; i <= m; i++)
			ok &= (upper_bound(a.begin(), a.end(), i) - lower_bound(a.begin(), a.end(), i)) >= 2;
		ok &= a[0] == m / 2;
		ok &= a[1] > m / 2;

		return cout << (ok ? "Possible" : "Impossible") << '\n', 0;
	} 
	else {
		bool ok = true;
		for(long i = (m + 1) / 2; i <= m; i++)
			ok &= (upper_bound(a.begin(), a.end(), i) - lower_bound(a.begin(), a.end(), i)) >= 2;
		ok &= a[0] == (m + 1) / 2;
		ok &= a[1] == (m + 1) / 2;
		ok &= a[2] > (m + 1) / 2;
		return cout << (ok ? "Possible" : "Impossible") << '\n', 0;
	}
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Math;

struct Edge
{
    public int to;
    public int dist;
}
struct FC
{
    public int now;
    public int from;
    public bool color;
}
class Program
{
    static void Main()
    {
        var N = int.Parse(ReadLine());
        var u = new int[N - 1];
        var v = new int[N - 1];
        var w = new int[N - 1];
        for (int i = 0; i < N - 1; i++)
        {
            var line = ReadLine().Split(' ');
            u[i] = int.Parse(line[0]) - 1;
            v[i] = int.Parse(line[1]) - 1;
            w[i] = int.Parse(line[2]);
        }

        var tree = new List<Edge>[N];
        for (int i = 0; i < tree.Length; i++)
        {
            tree[i] = new List<Edge>();
        }
        for (int i = 0; i < N - 1; i++)
        {
            tree[u[i]].Add(new Edge { to = v[i], dist = w[i] });
            tree[v[i]].Add(new Edge { to = u[i], dist = w[i] });
        }

        var vis = new bool[N];
        var col = new bool[N];
        var q = new Queue<FC>();
        q.Enqueue(new FC { from = -1, color = false });
        vis[0] = true;
        while (q.Count != 0)
        {
            var n = q.Dequeue();
            if (n.from != -1)
            {
                col[n.now] = n.color;
            }
            foreach (var s in tree[n.now])
            {
                if (!vis[s.to])
                {
                    q.Enqueue(new FC { now = s.to, color = s.dist % 2 == 0 ? n.color : !n.color });
                    vis[s.to] = true;
                }
            }
        }

        for (int i = 0; i < N; i++)
        {
            WriteLine(col[i] ? "0" : "1");
        }
    }
}


Measured memory_bytes: 31684
#include "bits/stdc++.h"
#include <set>

using namespace std;
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i < (n); i++)
#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)
#define all(i) (i).begin(), (i).end()
#define rall(i) (i).begin(), (i).end(), greater<int>()
#define int long long
#define elif else if
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define fst first
#define sec second
#define mod 1000000007
#define INF 10e10
template <typename T>

void print(T x)
{
	std::cout << x << " ";
}

template <typename T>

void println(T x)
{
	std::cout << x << "\n";
}

signed main(void) {
	int n;
	cin >> n;
	vector<int>a(n);
	vector<int>b(n);
	vector<int>c(n);
	rep(i, n) {
		cin >> a[i];
	}
	rep(i, n) {
		cin >> b[i];
	}
	rep(i, n) {
		cin >> c[i];
	}
	sort(a.begin(), a.end());
	sort(b.begin(), b.end());
	sort(c.begin(), c.end());
	
	int ret = 0;
	rep(i, n) {
		auto itera = lower_bound(a.begin(), a.end(), b[i]);
		auto iterc = upper_bound(c.begin(), c.end(), b[i]);
		int smallera = itera - a.begin();
		int smallerc = iterc - c.begin();
		ret += smallera * (n-smallerc);
	}
	print(ret);
}

Measured memory_bytes: 5636
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define rrep(i,n) for(int i=1;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin,(a).rend()
#define dunk(a) cout << (a) << endl
using namespace std;
typedef long long ll;
const int inf = 1001001001;
const int mod = 1000000007;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int a, b, c, d; 
	cin >> a >> b >> c >> d;
	dunk(a * b >= c * d ? a * b : c * d);
	return 0;
}

Measured memory_bytes: 256
mod=10**9+7

def add(a, b):
    return (a + b) % mod

def sub(a, b):
    return (a + mod - b) % mod

def mul(a, b):
    return ((a % mod) * (b % mod)) % mod

def power(x, y):
    if   y == 0     : return 1
    elif y == 1     : return x % mod
    elif y % 2 == 0 : return power(x, y//2)**2 % mod
    else            : return power(x, y//2)**2 * x % mod

def div(a, b):
    return mul(a, power(b, mod-2))

def cc(ii):
    iii=1
    for ii in range(1,ii+1):
        iii=iii*ii
    return iii

def cmb(a,b):
    iii=1
    for ii in range(a-b+1,a+1):
        iii=(iii*ii)%mod
    iiii=1
    for ii in range(1,b+1):
        iiii=(iiii*ii)%mod
#        print("ii,iiii:",ii,iiii)
#    print("a:",a,"b:",b,"iii:",iii,"iiii:",iiii)
#    print("a:",a,"b:",b,"a-b:",a-b,"a!:",iii,"b!:",iiii,"cmb:",iii//iiii)
    return div(iii,iiii)        


n,k=map(int,input().split())

ib=k-1
ir=n-ib

for i in range(1,ib+2):
#    cb=cc(ib)//cc(ib-i+1)//cc(i-1)
#    cr=cc(ir)//cc(ir-i)//cc(i)
    cb=cmb(ib,i-1)
    cr=cmb(ir,i)
#    print("ib:",ib,i-1,cb,"ir:",ir,i,cr)
    print(mul(cb,cr))
    


Measured memory_bytes: 9292
#include <bits/stdc++.h>
#define MOD 1000000007
#define endl "\n"
typedef long long ll;
using namespace std;
int main() {
    ios_base::sync_with_stdio(false);
    int a, b, c, k;
    cin >> a >> b >> c >> k;
    int ans = a + b + c;
    int x = max(max(a, b), c);
    ans = ans - x + (x << k);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
n, k = map(int, input().split())
a = [0]*n
for i in range(n):
  a[i] = int(input())

a.sort()

ans = a[-1]-a[0]
for i in range(n-k+1):
  if ans > a[i+k-1]-a[i]:
    ans = a[i+k-1]-a[i]

print(ans)

Measured memory_bytes: 7472
Data = input()

import re

Shift = re.split(" ",Data)
LenA = int(Shift[0])
LenB = int(Shift[1])

Delta = LenB - LenA
Mount = 0
Ctr = 0
while True:
    Ctr += 1
    Mount += Ctr
    if Ctr == Delta:
        break
print(Mount - LenB)

Measured memory_bytes: 3316
import sys

MOD = 10 ** 9 + 7

def make_power_2_table(n=10**6, mod=MOD):
    power = [None] * (n + 1)
    power[0] = 1
    for i in range(n):
        power[i+1] = power[i] * 2 % mod
    return power

power_2 = make_power_2_table(2*10**5)
inv_2 = pow(2, MOD-2, MOD)

n, *c = map(int, sys.stdin.read().split())
c.sort()

def main():
    res = 0
    for i in range(n):
        sum_d = (power_2[n-i-1] + power_2[n-(i+1)] * inv_2 % MOD * (n-(i+1)) % MOD) % MOD
        l_comb = power_2[i]
        res += c[i] * l_comb % MOD * sum_d % MOD
        res %= MOD

    return res * power_2[n] % MOD

if __name__ == '__main__':
    ans = main()
    print(ans)

Measured memory_bytes: 33164
#include<iostream>

using namespace std;

int main(){
  int N[3];
  bool flag_r = false;
  int cntr_5 = 0;
  int cntr_7 = 0;

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

  for(int i = 0; i < 3; i++){
    switch(N[i]) {
      case 5:
        cntr_5++;
        break;
      case 7:
        cntr_7++;
        break;
      default:
        break;
    }
  }

  if(cntr_5 == 2 && cntr_7 == 1) flag_r = true;

  string r = flag_r ? "YES" : "NO";
  cout << r << endl;

  return 0;
}

Measured memory_bytes: 256
#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 INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

int abs(int task)
{
	if (task < 0) return (task *= -1);
	else return task;

}

int main()
{
	vector<int> v(3);
	REP(i, 3) cin >> v[i];

	sort(ALL(v));

	int task = 0;

	task += abs(v[1] - v[0]);
	task += abs(v[2] - v[1]);

	cout << task << endl;
}


Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
	"strconv"
	"strings"
	"unicode"
)

func main() {
	sc = initScanner(os.Stdin)
	s := scanString(sc)
	fmt.Println(solve(s))
}

func solve(s string) string {
	ss := strings.Split(s, "")

	if ss[0] != "A" {
		return "WA"
	}

	cnt, point := 0, 0
	for i := 2; i < len(ss)-1; i++ {
		if ss[i] == "C" {
			cnt++
			point = i
		}
	}
	if cnt != 1 {
		return "WA"
	}

	for i := 1;i<len(ss);i++ {
		if i == point {
			continue
		}
		if unicode.IsUpper(rune(s[i])) {
			return "WA"
		}
	}


	return "AC"
}

// --------------- BASE DEFINITIONS ---------------

const (
	initialBufSize = 100000
	maxBufSize     = 1000000
)

var sc *bufio.Scanner

func initScanner(r io.Reader) *bufio.Scanner {
	buf := make([]byte, initialBufSize)

	sc := bufio.NewScanner(r)
	sc.Buffer(buf, maxBufSize)
	sc.Split(bufio.ScanWords)
	return sc
}

func scanInt(sc *bufio.Scanner) int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return i
}

func scanIntSlice(sc *bufio.Scanner, n int) []int {
	is := make([]int, n)
	for i := 0; i < n; i++ {
		is[i] = scanInt(sc)
	}

	return is
}

func scanFloat64(sc *bufio.Scanner) float64 {
	sc.Scan()
	f, _ := strconv.ParseFloat(sc.Text(), 64)
	return f
}

func scanFloat64Slice(sc *bufio.Scanner, n int) []float64 {
	fs := make([]float64, n)
	for i := 0; i < n; i++ {
		fs[i] = scanFloat64(sc)
	}

	return fs
}

func scanString(sc *bufio.Scanner) string {
	sc.Scan()
	return sc.Text()
}

func scanStringSlice(sc *bufio.Scanner, n int) []string {
	ss := make([]string, n)
	for i := 0; i < n; i++ {
		sc.Scan()
		ss[i] = sc.Text()
	}

	return ss
}

func abs(n int) int {
	if n < 0 {
		return -n
	}
	return n
}


Measured memory_bytes: 1788
import sys

n, w = [int(x) for x in input().split(" ")]

wv_list = []

for i in range(n):
  wv_list.append([int(x) for x in input().split(" ")])

dp = [[0 for y in range(w+2)] for x in range(n+1)]

for i in range(n):
  for j in range(w+1):
    if j >= wv_list[i][0]:
      dp[i+1][j] = max(dp[i][j - wv_list[i][0]] + wv_list[i][1], dp[i][j])
    else:
      dp[i+1][j] = dp[i][j]
      
print(dp[-1][w])

Measured memory_bytes: 171912
#include <bits/stdc++.h>
#include <math.h>
#define _GLIBCXX_DEBUG
using namespace std;
int main() {
  
  int X,A,B;cin>>X>>A>>B;
  
  int x=abs(X-A);
  int y=abs(X-B);
  
  if(x>=y){
    cout<<'B'<<endl;
  }
  else{
    cout<<'A'<<endl;
  }
}

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

void Main() {
  string s;
  int x, y;
  cin >> s >> x >> y;

  vector<int> X, Y;
  bool yoko = true;
  int tmp = 0;
  for (int i = 0; i < s.length(); i++) {
    if (s[i] == 'F') {
      tmp++;
    } else {
      if (yoko) {
        X.push_back(tmp);
        yoko = false;
      }
      else {
        Y.push_back(tmp);
        yoko = true;
      }
      tmp = 0;
    }
  }
  if (s[s.length() - 1] == 'F') {
    if (yoko) X.push_back(tmp);
    else Y.push_back(tmp);
  }

  int size = s.length() * 2 + 1;

  vector<vector<int>> dpx(X.size() + 1, vector<int>(size, 0));
  dpx[0][s.length()] = 1;
  if (X.size() > 0) dpx[1][X[0] + s.length()] = 1;
  for (int i = 1; i < X.size(); i++) {
    for (int j = 0; j < size; j++) {
      if (j - X[i] >= 0 && dpx[i][j - X[i]] == 1) dpx[i + 1][j] = 1;
      if (j + X[i] < size && dpx[i][j + X[i]] == 1) dpx[i + 1][j] = 1;
    }
  }

  /*
  for (int i = 0; i <= X.size(); i++) {
    for (int j = 0; j < size; j++) {
      cout << dpx[i][j] << " ";
    }
    cout << endl;
  }
  cout << "###################" << endl;
  */

  vector<vector<int>> dpy(Y.size() + 1, vector<int>(size, 0));
  dpy[0][s.length()] = 1;
  for (int i = 0; i < Y.size(); i++) {
    for (int j = 0; j < size; j++) {
      if (j - Y[i] >= 0 && dpy[i][j - Y[i]] == 1) dpy[i + 1][j] = 1;
      if (j + Y[i] < size && dpy[i][j + Y[i]] == 1) dpy[i + 1][j] = 1;
    }
  }

  /*
  for (int i = 0; i <= Y.size(); i++) {
    for (int j = 0; j < size; j++) {
      cout << dpy[i][j] << " ";
    }
    cout << endl;
  }
  */
  if (dpx[X.size()][x + s.length()] == 1 && dpy[Y.size()][y + s.length()]) cout << "Yes" << endl;
  else cout << "No" << endl;
}

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



Measured memory_bytes: 492672
const val MOD = 1000000007L
fun main(args: Array<String>) {
    val (N, A, B) = listOfInt()
    fun pow2(n: Int): ModInt {
        if (n == 0) return ModInt(1)
        var x = pow2(n / 2)
        x *= x
        if (n % 2 == 1) x *= 2
        return x
    }
    fun C(n: Int, a: Int): ModInt {
        var x = ModInt(1)
        var y = ModInt(1)
        repeat(a) { i ->
            x *= n - i
            y *= i + 1
        }
        return x / y
    }
    var ans = pow2(N)
    ans -= 1
    ans -= C(N, A)
    ans -= C(N, B)
    println(ans.toString())
}
fun next() = readLine()!!
fun nextInt() = Integer.parseInt(next())
fun listOfString() = next().split(" ")
fun listOfInt() = listOfString().map(String::toInt)


data class ModInt(private var v: Long) {
    companion object {
        private const val MOD = 1000000007L
    }
    init {
        if (v >= MOD) v %= MOD
    }
    constructor(n: Int): this(n.toLong())
    operator fun plus(other: Int): ModInt {
        val x = v + other
        if (x >= MOD) {
            return ModInt(x - MOD)
        }
        return ModInt(x)
    }
    operator fun minus(other: Int): ModInt {
        val x = v + MOD - other
        if (x >= MOD) {
            return ModInt(x - MOD)
        }
        return ModInt(x)
    }
    operator fun minus(other: ModInt): ModInt {
        val x = v + MOD - other.v
        if (x >= MOD) {
            return ModInt(x - MOD)
        }
        return ModInt(x)
    }
    operator fun times(other: Int): ModInt {
        return ModInt(v * other % MOD)
    }
    operator fun times(other: ModInt): ModInt {
        return ModInt(v * other.v % MOD)
    }
    operator fun div(other: ModInt): ModInt {
        return ModInt(v * pow(other.v, MOD - 2) % MOD)
    }
    private fun pow(a: Long, b: Long): Long {
        if (b == 0L) return 1L
        if (b % 2L == 0L) {
            val d = pow(a, b / 2)
            return d * d % MOD
        }
        return a * pow(a, b - 1) % MOD
    }
    override fun toString(): String {
        return v.toString()
    }
}



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

using namespace std;

#define MAX 100000
#define INF 2140000000
#define MOD 1000000007

int main() {
	string s;
	cin >> s;

	if (s[0] == s[1] || s[1] == s[2] || s[2] == s[3]) {
		cout << "Bad" << endl;
	}
	else {
		cout << "Good" << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <queue>
#include <vector>
#include <algorithm>
#include <math.h>
#include <map>
#include <iomanip>
#include <queue>
#include <numeric>
#define repl(i, l, r) for (ll i = l; i < r; i++)
#define rep(i, n) repl(i, 0, n)

using namespace std;
using ll = long long;

int main() {
    ll count = 0;

    ll K, A, B, ans = 0;
    cin >> K >> A >> B;

    if (B <= A + 2 || K - A < 1) {
        ans = K + 1;
    }
    else {
        ans += B + (K - A - 1) / 2 * (B - A) + (K - A - 1) % 2;
    }
    cout << ans;

    return 0;
}


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

#define GET_MACRO(_1,_2,_3,_4,NAME,...) NAME
#define REP2(i,n) for(int i=0;i<(int)(n);i++)
#define REP3(i,m,n) for(int i=m;i<(int)(n);i++)
#define REP4(i,m,n,s) for(int i=m;(s>0 and i<(int)(n)) or (s<0 and i>(int)(n));i+=s)
#define REP(...) GET_MACRO(__VA_ARGS__, REP4, REP3, REP2)(__VA_ARGS__)
#define REPIT(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)
#define PIS(x) printf("%d ",x)
#define PN() putchar('\n')
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define MT make_tuple

using PII = pair<int, int>;
using TI3 = tuple<int, int, int>;
using LL = long long;
using ULL =  unsigned long long;
using MAT = array<array<LL, 2>, 2>;

void RI() {}
template<typename... T>
void RI( int& head, T&... tail ) {
    scanf("%d", &head);
    RI(tail...);
}
void RLL() {}
template<typename... T>
void RLL( LL& head, T&... tail ) {
    scanf("%lld", &head);
    RLL(tail...);
}
void print() {putchar('\n');}
template<typename T, typename... U>
void print(T head, U... tail) {
    cout << head << " ";
    print(tail...);
}

const int MOD = 1000000007;
#define MAX_N 300005


int main()
{
    int A, B, C, D, E, F;
    RI(A, B, C, D, E, F);

    vector<int> ans = {0, 0};
    double M = 0;

    for(int i = 0; i * 100 * A <= F; i++) {
        for(int j = 0; i * 100 * A + j * 100 * B <= F; j++) {
            int water = i * 100 * A + j * 100 * B;

            for(int k = 0; water + k * C <= F; k++) {
                for(int l = 0; water + k * C + l * D <= F; l++) {
                    int sugar = k * C + l * D;
                    if(double(sugar) / water > double(E) / 100) {
                        continue;
                    }
                    if(double(sugar) / (water + sugar) > M or ans[0] == 0) {
                        M = double(sugar) / (water + sugar);
                        ans = {water + sugar, sugar};
                    }
                }
            }
        }
    }
    printf("%d %d\n", ans[0], ans[1]);
    return 0;
}


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

using namespace std;


int main() {

  int X;
  cin >> X;

  string ans = (X==7 or X==5 or X==3) ? "YES" : "NO";

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(int argc, char const *argv[])
{
	int N,M;
	bool a[100005]; //i段目を踏める(true) 踏めない(false)
	for (int i = 0; i < 100005; ++i)
	{
		a[i] = true;
	}
	cin >> N >> M;
	int temp;
	for (int i = 0; i < M; ++i)
	{
		cin >> temp;
		a[temp] = false;
	}

	long long ans[100005];
	for (int i = 0; i <= N; ++i)
	{
		if (a[i] == false)
		{
			ans[i] = 0;
		}
		else if (i == 0)
		{
			ans[i] = 1;
		}
		else if (i == 1)
		{
			ans [i] = ans[i-1];
		}
		else
		{
			ans[i] = ans[i-1] + ans[i-2];
			if (ans[i] > 1000000007)
			{
				ans[i] %= 1000000007;				
			}
		}
	}

	cout << ans[N] << endl; 
	return 0;
}

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


int main()
{
    int n;
    cin>>n;
    string s;
    cin>>s;
    if(n%2==0)
    {
        int div=n/2;
        for(int i=0;i<(n/2);i++)
        {
            if(s[i]!=s[div])
            {
                cout<<"No\n";
                return 0;
            }
            div++;
        }
        cout<<"Yes\n";
    }
    else
    {
        cout<<"No\n";
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
   
int main(){
    long long a,b;
    cin >> a >> b;
    long long x = a * b;
    long long tmp;
    if(a<b){
    tmp = a;
    a = b;
    b = tmp;
  }
    long long r;
    r = a % b;
   while(r!=0){
    a = b;
    b = r;
    r = a % b;
   }
    cout << x/b << endl;
}

Measured memory_bytes: 256
def solve(n, d, xy_list):
    res = 0
    d_square = d * d
    for i in range(n):
        x, y = xy_list[i]
        if x ** 2 + y ** 2 <= d_square:
            res += 1
    return res


def main():
    n, d = map(int, input().split())
    xy_list = [list(map(int, input().split())) for _ in range(n)]
    res = solve(n, d, xy_list)
    print(res)


def test():
    assert solve(4, 5, [[0, 5], [-2, 4], [3, 4], [4, -4]]) == 3
    assert solve(12, 3, [
        [1, 1], [1, 1], [1, 1], [1, 1], [1, 2], [1, 3], [2, 1], [2, 2], [2, 3], [3, 1], [3, 2], [3, 3]
    ]) == 7


if __name__ == "__main__":
    test()
    main()


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

int main(){
	int n, t;
	cin >> n >> t;
	int min = 1001;
	for(int i = 0; i < n; i++){
		int a, b;
		cin >> a >> b;
		if(b <= t && a < min)
			min = a;
	}
	if(min <= 1000)
		cout << min << endl;
	else
		cout << "TLE\n";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define f first
#define s second
#define pb push_back
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef pair<ll, ll> pll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<ll> vll;
const int MN = 2e5+5, MOD=1e9+7, LOG=33;
ll lcm (ll a, ll b) {return a*b/__gcd(a,b);}
ll multiplyMod(ll a, ll b) { return (a % MOD * b % MOD) % MOD; }
ll addMod(ll a, ll b) { return (a % MOD + b % MOD) % MOD; }
ll subMod(ll a, ll b) { return (a % MOD - b % MOD) % MOD; }
ll fpow(ll b, ll exp, ll mod){if(exp == 0) return 1;ll t = fpow(b,exp/2,mod);if(exp&1) return t*t%mod*b%mod;return t*t%mod;}
ll divmod(ll i, ll j, ll mod){i%=mod,j%=mod;return i*fpow(j,mod-2,mod)%mod;}
vpii points;
ll N,D,A;
ll en[MN];
vll point;
int main() {
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    cin >> N >> D >> A;
    for (int i = 0, x, h;i<N;i++) {
        cin >> x>> h;
        points.pb({x, h});
    }
    sort(points.begin(), points.end());
    for (int i = 0; i<N;i++) {
        point.pb(points[i].f);
    }
    ll moves = 0;
    ll sume = 0;
    for (int i = 0; i<N;i++) {
        ll x = points[i].f, h = points[i].s;
        sume -= en[i];
        h -= sume;
        if (h <= 0) {
            continue;
        }
        int ptr = upper_bound(point.begin(), point.end(), x+2*D) - point.begin();
        ll nxt = (h+A-1)/A;
        en[ptr] += nxt*A;
        moves += nxt;
        sume += nxt*A;
    }
    cout << moves << '\n';
    return 0;

}

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

using namespace std;

#define COUNTOF(array) (sizeof(array) / sizeof(array[0]))
#define OUT(P) cout << (P) << endl
#define OUT2(P1, P2) cout << (P1) << " " << (P2) << endl
#define PRINT_ARRAY(P) for(int i=0; i<P.size(); i++) cout << P[i] << endl;
#define PRINT_ARRAY_INLINE(P) do { for(int i=0; i<P.size(); i++) cout << P[i] << " "; cout << endl; } while(0)
#define PRINT_ARRAY_WITH_LABEL(L, P) do { cout << L << ": "; PRINT_ARRAY_INLINE(P); cout << endl; } while(0)
typedef long long ll;

int sum_digits(int num);
template <class T>
vector<T> copy_vector(vector<T> vec);

long n;


bool is753(string n) {
    bool exist7, exist5, exist3, exist_not753;
    exist7 = exist5 = exist3 = false;
    exist_not753 = true;

    for(int i=0; i<n.size(); i++) {
        switch(n[i]) {
            case '7':
                exist7 = true;
                break;
            case '5':
                exist5 = true;
                break;
            case '3':
                exist3 = true;
                break;
            default: 
                exist_not753 = false;
                break;
        }
    }
    return (exist7 && exist5 && exist3 && exist_not753);
}

long dfs(long x) {
    if(x > n) return 0;
    else {
        long current_is753 = is753(to_string(x))? 1 : 0;
        return current_is753 + dfs(x * 10 + 3)
            + dfs(x * 10 + 5) + dfs(x * 10 + 7);
    }     
}

int main() {
    cin >> n;

    cout << dfs(0) << endl;

    return 0;
}

/******************************/
/***** DECRARED FUNCTIONS *****/
/******************************/

int sum_digits(int num) {
    int rtn = 0;
    while(num != 0) {
        int tmp = num % 10; 
        rtn += tmp;
        num /= 10; 
    }   
    return rtn;
}
//int sum_digits(int num) {
//    int rtn = 0;
//    string num_str = to_string(num);
//    for(int i=0; i<num_str.size(); i++) {
//        rtn += num_str[i] - '0';
//    }   
//    return rtn;
//}

// vectorのコピー
template <class T>
vector<T> copy_vector(vector<T> vec) {
    vector<T> rtn;
    rtn.reserve(vec.size());
    copy(vec.begin(), vec.end(), back_inserter(rtn));
    return rtn;
}



Measured memory_bytes: 256
def main():
    n = int(input())
    y = [0]*(n+1)
    for i in range(1,n+1):
        j = 1
        while True:
            if i*j > n:
                break
            y[i*j] += 1
            j += 1
    res = 0
    for i in range(1,n+1):
        res += i*y[i]
    print(res)

if __name__ == '__main__':
    main()


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

int main() {
  string S;
  cin >> S;
  if (S == "SUN") {
    cout << 7 << endl;
  }
  if (S == "SAT") { 
    cout << 1 << endl;
  }
  if (S == "FRI") {
    cout << 2 << endl;
  }
  if (S == "THU") {
    cout << 3 << endl;
  }
  if (S == "WED") {
    cout << 4 << endl;
  }
  if (S == "TUE") {
    cout << 5 << endl;
  }
  if (S == "MON") {
    cout << 6 << endl;
  }
  
}

Measured memory_bytes: 256
N = int(input())
T, A = map(int, input().split())
H = list(map(int, input().split()))
ans_list = []

def temperature(T, x):
  temp = T - 0.006 * x
  return temp

for i in range(N):
  ans_list.append(abs(temperature(T, H[i]) - A))

print(ans_list.index(min(ans_list))+1)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
using ll=long long;
using Graph=vector<vector<int>>;
using pp=pair<ll,pair<ll,ll>>;
#define MAX 1000000
#define MOD 1000000007
#define INF 1000000000000000000

int main(){
  int T;
  cin>>T;
  vector<ll> N(T),M(T),A(T),B(T);
  for(int i=0;i<T;i++){
    cin>>N[i]>>M[i]>>A[i]>>B[i];
  }

  for(int i=0;i<T;i++){
    cout<<floor_sum(N[i],M[i],A[i],B[i])<<endl;
  }
}


Measured memory_bytes: 5352
N = [int(i) for i in input().split()][0]
ordA = ord("a")

def recursion(x, k,  max_c, words):
  if k == 0:
    words.append(x)
    return
  for i in range(max_c+2):
    recursion(x+chr(ordA+i), k-1, max(i, max_c), words) 
  
words = []
recursion("a", N - 1, 0,  words)
for word in words:
  print(word)
    



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

using namespace std;

using ll = long long;

const ll MOD = 1000000007;

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

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    int n; cin >> n;
    vector<ll> a(n);
    vector<ll> b;
    for(int i=0;i<n;i++){
        cin >> a[i];
    }
    b.push_back(-a[0]);
    for(int i=1;i<n;i++){
        auto iter = upper_bound(b.begin(), b.end(), -a[i]);
        // cout << *iter << endl;
        if(iter == b.end()){
            b.push_back(-a[i]);
            continue;
        }
        *(iter) = -a[i];
    }
    /*
    for(ll bi: b){
        cout << bi << endl;
    }
    */
    cout << b.size() << endl;
}

Measured memory_bytes: 2168
#include <bits/stdc++.h>
using namespace std;
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; }
#define rep(i, n) for (int i = 0; i < (int)n; i++)
typedef long long ll;
const ll MOD = 1e9+7;
const int inf = 1000000;
const int minf = -1000000;
const ll lnf = 1e9;
const ll mlnf = -1e9;

void debug_vector(vector<int>& v){
    int n = v.size();
    for (int i = 0; i < n; i++){
        cout << v[i] << " ";
    }
    cout << endl;
}

void solve();

int main(void){
    solve();
    return 0;
}
void solve(){
    int A, B, C, X, Y;
    cin >> A >> B >> C >> X >> Y;
    ll ans = 0;
    if (A + B < 2 * C){
        ans = A * X + B * Y;
    }else{
        ans = min(X, Y) * 2 * C;
        int tmp = abs(X - Y);
        if (X > Y){
            ans += min(tmp * 2 * C, tmp * A);
        }else{
            ans += min(tmp * 2 * C, tmp * B);
        }
    }


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

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 n[]=new int[10];
		for(int j=0;j<a;j++){
			boolean s=true;int cb=0,bb=0;
			for(int i=0;i<n.length;i++){
				n[i]=sc.nextInt();
			}
			cb=n[0];
			for(int i=1;i<n.length;i++){
				if(cb<n[i])cb=n[i];
				else if(bb<n[i])bb=n[i];
				else s=false;
			}
			if(s)System.out.println("YES");
			else System.out.println("NO");
		}
	}
}

Measured memory_bytes: 18120
S=input()
n,w,s,e=0,0,0,0
for i in range(len(S)):
    if S[i]=="N":
        n=1
    elif S[i]=="W":
        w=1
    elif S[i]=="S":
        s=1
    else:
        e=1
if n*w*s*e==1 or n*s==1 and w==0 and e==0 or w*e==1 and n==0 and s==0:
    print("Yes")
else:
    print("No")

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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
//const ull mod = 1e9 + 7;
const ll mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

// debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

template<class S, class T> ostream& operator << (ostream& os, const pair<S, T> v){
  os << "(" << v.first << ", " << v.second << ")"; return os;
}
template<class T> ostream& operator << (ostream& os, const vector<T> v){
  for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << " ";} os << v[i];} return os;
}
template<class T> ostream& operator << (ostream& os, const vector<vector<T>> v){
  for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << endl;} os << v[i];} return os;
}
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; }

// conversion number to bit
string num2bit(ll num, ll len){
  string bit = "";
  REP(i, len){
    bit += char('0'+(num>>i & 1));
  }
  return bit;
}

ll dp1[3030][3030];
ll dp2[3030][3030];

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

    ll N, T;
    cin >> N >> T;
    vector<ll> A(N), B(N);
    REP(i, N) cin >> A[i] >> B[i];

    REP(i, N){
    	REP(j, 3030){
    		chmax(dp1[i+1][j], dp1[i][j]);
    		if(j+A[i]<3030) chmax(dp1[i+1][j+A[i]], dp1[i][j]+B[i]);
    	}
    }

    REP(i, N){
    	REP(j, 3030){
    		chmax(dp2[i+1][j], dp2[i][j]);
    		if(j+A[N-1-i]<3030) chmax(dp2[i+1][j+A[N-1-i]], dp2[i][j]+B[N-1-i]);
    	}
    }

    ll res = 0;
    REP(i, N){
    	REP(j, T){
    		chmax(res, dp1[i][j] + dp2[N-1-i][T-1-j]+B[i]);
    	}
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 143616
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <functional>
#include <limits.h>
#include <set>
#include <map>
#include <tuple>
using namespace std;

#define ll long long
#define ull unsigned long long
#define rep(i,N) for (int i=0;i<N;i++)
#define loop(i,N,M) for(int i=N;i<M;i++)
#define MAX(v) *max_element(v.begin(),v.end())
#define MIN(v) *min_element(v.begin(),v.end())
#define SORTL2S(type,v) sort(v.begin(),v.end(),greater<type>())
#define SORTS2L(type,v) sort(v.begin(),v.end())
#define SORTMF(v,func) sort(v.begin(),v.end(),func)

//変数
ll N;
vector<ll> vec;

//解法
void solve() {
	
	while (1) {

		SORTL2S(ll, vec);

		ll minn = vec.size()-1;
		rep(i, vec.size()) {
			if (vec[i] == 0) {
				minn = i - 1;
				break;
			}
		}

		if (vec[0] == vec[minn]) break;

		rep(i, vec.size()) {
			if (i == minn) break;
			vec[i] %= vec[minn];
		}

	}

	cout << vec[0];


	return;
}

int main() {

	//入力
	cin >>N;
	vec.resize(N);
	rep(i, N) cin >> vec[i];

	solve();
	cout << endl;
	return 0;
}

Measured memory_bytes: 1024
import sys

stdin = sys.stdin
inf = 1 << 60
mod = 1000000007

sys.setrecursionlimit(10**7)

ni = lambda: int(ns())
nin = lambda y: [ni() for _ in range(y)]
na = lambda: list(map(int, stdin.readline().split()))
nan = lambda y: [na() for _ in range(y)]
nf = lambda: float(ns())
nfn = lambda y: [nf() for _ in range(y)]
nfa = lambda: list(map(float, stdin.readline().split()))
nfan = lambda y: [nfa() for _ in range(y)]
ns = lambda: stdin.readline().rstrip()
nsn = lambda y: [ns() for _ in range(y)]
ncl = lambda y: [list(ns()) for _ in range(y)]
nas = lambda: stdin.readline().split()

n = ni()
a = na()

ans = inf
s = sum(a)
cur = 0
for i in range(n):
    cur += a[i]
    ans = min(ans, abs(cur * 2 - s))

print(ans)

Measured memory_bytes: 25912
/*input
98765432109876543210
58
*/

//sometimes it's the people who no one imagines anything of 
//who do the things that no one can imagine.

//code author: iamxlr8

#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define N 300005
#define mod 1000000007
#define off ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)

ll d;
string k;
vector<ll> num;
ll dp[10005][2][102];

ll fun(ll id,ll small,ll rem)
{
    if(id==num.size())
        return (rem==0);
    if(dp[id][small][rem]!=-1)
        return dp[id][small][rem];
    ll lmt=9;
    if(!small)
        lmt=num[id];
    ll ans=0;
    for(ll x=0;x<=lmt;x++)
    {
        ll nsmall=small;
        if(x<lmt)
            nsmall=1;
        ans=(ans%mod+fun(id+1,nsmall,(rem+x)%d)%mod)%mod;
    }
    return dp[id][small][rem]=ans;
}

ll solve(string x)
{
    for(ll i=0;i<x.size();i++)
        num.push_back(x[i]-'0');
    memset(dp,-1,sizeof(dp));
    ll ans=fun(0,0,0)-1;
    if(ans<0)
        ans+=mod;
    return ans;
}

int main() 
{
    off;
    cin>>k>>d;
    cout<<solve(k);
    return 0;
}

Measured memory_bytes: 17176
#include<bits/stdc++.h>
using namespace std;
int main()
{
    cin.tie(0);
    cout.tie(0);
    ios_base::sync_with_stdio(false);
	string str;
	cin>>str;
	long long int out = 0;
	int n = str.length();
	for(int i=0;i<n;i++)
	{
		out = out + (str[i]-'0');
	}
	//cout<<out<<endl;
	if(out%9==0)
	{
		cout<<"Yes"<<endl;
	}
	else
	{
		cout<<"No"<<endl;
	}
    return 0;
}


Measured memory_bytes: 3784
#include<iostream>
#include<string>
#define MOD 1000000007
#define MAX_S_LEN 100001
using namespace std;
typedef long long ll;

ll dp[MAX_S_LEN][4];

int main() {
    string S;
    cin >> S;
    for (int i = S.length(); i >= 0; i--) {
        for (int j = 3; j >= 0; j--) {
            if (i == S.length() && j == 3) dp[i][j] = 1;
            else if (i == S.length() && j < 3) dp[i][j] = 0;
            else if (i < S.length() && j == 3) {
                dp[i][j] = (S[i] == '?' ? (3 * dp[i + 1][j]) % MOD : dp[i + 1][j]);
            }
            else {
                int m1 = (S[i] == '?' ? 3 : 1);
                int m2 = (S[i] == '?' || (j == 0 && S[i] == 'A') || (j == 1 && S[i] == 'B') || (j == 2 && S[i] == 'C') ? 1 : 0);
                dp[i][j] = ((m1 * dp[i + 1][j]) % MOD + (m2 * dp[i + 1][j + 1]) % MOD) % MOD;
            }
        }
    }
    cout << dp[0][0] % MOD << endl;
    return 0;
}

Measured memory_bytes: 3584
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define rep2(i, s, n) for (ll i = s; i < (ll)(n); i++)
#define repr(i, n) for (ll i = n; i >= 0; i--)
#define pb push_back
#define COUT(x) cout << (x) << endl
#define COUTF(x) cout << setprecision(15) << (x) << endl
#define ENDL cout << endl
#define DF(x) x.erase(x.begin())  // 先頭文字削除
#define ALL(x) x.begin(), x.end()
#define SORT(x) sort(ALL(x))
#define REVERSE(x) reverse(ALL(x))
#define ANS cout << ans << endl
#define RETURN(x)    \
  cout << x << endl; \
  return 0
#define init() \
  cin.tie(0);  \
  ios::sync_with_stdio(false)
#define debug(x) cerr << "[debug] " << #x << ": " << x << endl;
#define debugV(v)                       \
  cerr << "[debugV] " << #v << ":";     \
  rep(i, v.size()) cerr << " " << v[i]; \
  cerr << endl;
using namespace std;
using ll = long long;
using ld = long double;
using vll = vector<ll>;
using P = pair<ll, ll>;
constexpr ll INF = 0x3f3f3f3f3f3f3f3f;
constexpr ld PI = 3.141592653589793238462643383279;
ll get_digit(ll x) {
  return to_string(x).size();
}

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

ll lcm(ll a, ll b) {
  return a / gcd(a, b) * b;
}

vector<P> factorize(ll n) {
  vector<P> result;
  for (ll i = 2; i * i <= n; ++i) {
    if (n % i == 0) {
      result.pb({i, 0});
      while (n % i == 0) {
        n /= i;
        result.back().second++;
      }
    }
  }
  if (n != 1) {
    result.pb({n, 1});
  }
  return result;
}

vll divisor(ll n) {
  vll ret;
  for (ll i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      ret.push_back(i);
      if (i * i != n) ret.push_back(n / i);
    }
  }
  SORT(ret);
  return (ret);
}

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;
}

signed main() {
  init();
  ll A, B, C;
  cin >> A >> B >> C;
  if (A + B >= C) {
    COUT("Yes");
  } else {
    COUT("No");
  }
  return 0;
}

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

int main() {
    int x;
    cin >> x;

    if (x < 600) {
        cout << 8 << endl;
    } else if (x < 800) {
        cout << 7 << endl;
    } else if (x < 1000) {
        cout << 6 << endl;
    } else if (x < 1200) {
        cout << 5 << endl;
    } else if (x < 1400) {
        cout << 4 << endl;
    } else if (x < 1600) {
        cout << 3 << endl;
    } else if (x < 1800) {
        cout << 2 << endl;
    } else if (x < 2000) {
        cout << 1 << endl;
    }

    return 0;
}


Measured memory_bytes: 3632
#define scanf_s scanf
//#define sscanf_s sscanf
//#define gets_s gets
#include <stdio.h>
#include <string>
#include <iostream>
#include <math.h>
using namespace std;
#define MAX 101
#define HO 6
int main(void)
{
	int H, W;
	while (scanf_s("%d %d", &H,&W) != EOF) {
		if (H == 0 && W == 0) break;
		char tile[MAX][MAX];
		int  h = 0, w = 0;
		bool tile_b[MAX][MAX] = { 0 };
		for (int i = 0; i < H; ++i) {
			scanf_s("%s", tile[i], MAX);
		}
		h = 0; w = 0;
		while (1) {
			if (tile[h][w] == '.') { 
				printf("%d %d\n",w,h); break; 
			}
			if (tile_b[h][w] == true) {
				printf("LOOP\n"); break;
			}
			tile_b[h][w] = true;
			switch (tile[h][w]) {
			case '>': ++w; break;
			case '<': --w; break;
			case 'v': ++h; break;
			case '^': --h; break;
			}
		}
		
	}
}

Measured memory_bytes: 1228
import java.util.*;

public class Main{
  public static void main(String[] args) {
    Scanner sc=new Scanner(System.in);
    String s=sc.next();
    if (s.charAt(0)=='A'&&s.charAt(1)=='A'&&s.charAt(2)=='A'||s.charAt(0)=='B'&&s.charAt(1)=='B'&&s.charAt(2)=='B') {
      System.out.println("No");
    }else{
      System.out.println("Yes");
    }
  }
}


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

namespace ConsoleApp110 {
    class Program {
        static void Main(string[] args) {
            int mod = 1000000007;
            int N = int.Parse(Console.ReadLine());

            //素因数の次数を格納するテーブル
            var table = new int[N + 2];

            for (int i = 2; i <= N; i++) {
                int divisor = 2;
                int start = i;
                while (start != 1) {
                    if (start % divisor == 0) {
                        table[divisor]++;
                        start /= divisor;
                    } else {
                        divisor++;
                    }
                }
            }

            long ans = 1;

            for (int i = 0; i <= N; i++) {
                ans = ans * ((long)table[i] + 1) % mod;

            }

            Console.WriteLine(ans);


        }

    }
}


Measured memory_bytes: 13140
# https://onlinejudge.u-aizu.ac.jp/courses/library/7/DPL/1/DPL_1_A
# めちゃくちゃナップサックっぽい。ってかナップサックじゃん
# 本ではdpテーブルに当たるTを1次元配列にすることによってメモリを削減しているが、ここではしない。

# dpテーブルは初期化と、更新が必要でそれらを意識しながら実装する。
# C ... (m,) i番目のコインの額面
# dp ... (m, n+1) i番目まで(それを含む)のコインをつかってj円払うときのコインの最小枚数

INF = 1e5

# load data
n, m = list(map(int, input().split()))
C = list(map(int, input().split()))

# dpテーブルの作成 minを取りながら更新するときは初期値にINFをぶちこんでおくとよい
dp = [[INF] * (n + 1) for _ in range(m)]  # (m,n+1)のリストの作成

# dpテーブルの初期化
# dp[:][0] は常に0 ∵ 0円はコインを一つも使わなければ良い
# dp[0][:] は即座に決定する。 ∵ dp[0][j]%C[0] == 0ならばdp[0][j]//C[0]の枚数で j 円を達成可能だから
for i in range(m):
    dp[i][0] = 0
for j in range(1 + n):
    dp[0][j] = j  # いまC[0]は必ず1と問題文にあるので、これを用いることにする。

# dpテーブルの更新
# 更新則は T[i][j]=min(T[i-1][j], T[i][j-C[i]]+1)
# 1項目 i-1までのコインでj円が作れるとき、i番目のコインを使わなくてもj円を作る枚数は変わらない。
# 2項目 i番目のコインを使ってちょうどj円を達成するには、j-C[i]円のときに達成可能なコインの枚数に1を足せば良い
# 最小のコインの枚数を知りたいのだから上記の小さい方を採用すれば良い
from itertools import product
# Z字にdpを更新していく.初期値のある列と行は省略
for i, j in product(range(1, m), range(1, n + 1)):
    dp[i][j] = min(dp[i][j], dp[i - 1][j])
    if 0 <= j - C[i]:
        dp[i][j] = min(dp[i][j], dp[i][j - C[i]] + 1)

print(dp[i][j])



Measured memory_bytes: 45356
import sys
stdin = sys.stdin

def li(): return [int(x) for x in stdin.readline().split()]
def li_(): return [int(x)-1 for x in stdin.readline().split()]
def lf(): return [float(x) for x in stdin.readline().split()]
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(ns())
def nf(): return float(ns())

def nex_animal(prev: str, cur:str, say: str) -> str:
    ret_dic = {("S", "S", "o"): "S", ("S", "S", "x"): "W",
               ("S", "W", "o"): "W", ("S", "W", "x"): "S",
               ("W", "S", "o"): "W", ("W", "S", "x"): "S",
               ("W", "W", "o"): "S", ("W", "W", "x"): "W"}
    
    return ret_dic[(prev, cur, say)]

n = ni()
s = lc()
ans = [""]*n

init = {"o":[("S", "S", "S"), ("W","S","W"), ("W","W","S"), ("S","W","W")],
        "x":[("W", "S", "S"), ("S","S","W"), ("S","W","S"), ("W","W","W")]}

exist = False
if s[-1] == "o":
    for a1,a2,a3 in init["o"]:
        ans = [""]*n
        ans[-2], ans[-1], ans[0] = a1, a2, a3
        
        for i in range(n-1):
            if i < n-3:
                ans[i+1] = nex_animal(ans[i-1], ans[i], s[i])
            elif i == n-3:
                if ans[i+1] != nex_animal(ans[i-1], ans[i], s[i]):
                    break
                
            else:
                if ans[i+1] != nex_animal(ans[i-1], ans[i], s[i]):
                    break
                
                else:
                    print("".join(ans))
                    exist = True
                    break
                
        if exist:
            break
                
else:
    for a1,a2,a3 in init["x"]:
        ans = [""]*n
        ans[-2], ans[-1], ans[0] = a1, a2, a3
        
        for i in range(n-1):
            if i < n-3:
                ans[i+1] = nex_animal(ans[i-1], ans[i], s[i])
            
            elif i == n-3:
                if ans[i+1] != nex_animal(ans[i-1], ans[i], s[i]):
                    break
            
            else:
                if ans[i+1] != nex_animal(ans[i-1], ans[i], s[i]):
                    break
                
                else:
                    print("".join(ans))
                    exist = True
                    break
                
        if exist:
            break
    
                    
if not exist:
    print(-1)        

Measured memory_bytes: 5720