akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <vector>
#include <cstdint>
#define FOR(i,l,r) for(int i=(l);i<(r);++i)
#define RFOR(i,l,r) for(int i=(l);i>=(int)(r);i--)
#define rep(i,n)  FOR(i,0,n)
#define rrep(i,n)  RFOR(i,n-1,0)

#define int long long
using namespace std;
const int MX = 1e6;
const int inf = 1e9+5;
const int mod = 1e9+7;
int V;
int n,w;
vector<vector<int> > pq(4);

signed main(){
    cin >> n >> w;
    vector<int> ww(n);
    vector<int> vv(n);
    
    rep(i,n) {
        cin >> ww[i] >>vv[i];
    }
    int base = ww[0];
    // cout << base << endl;
    rep(i,n) {
        int weight = ww[i]-base;
        pq[weight].push_back(vv[i]);
        // cout << weight<<" "<<vv[i] << endl;
    }
    rep(i,4) {
        pq[i].push_back(0);
        sort(pq[i].begin(),pq[i].end(),greater<int>());
    }
    rep(i,4) {
        // cout << pq[i][0] << " "<< flush;
        FOR(j,1,pq[i].size()) {
            pq[i][j] += pq[i][j-1];
            // cout << pq[i][j]<<" " << flush;
        }
        // cout << "" << endl;
    }
    int ans = 0;
    rep(i,pq[0].size()) {
        int sum = 0;
        if(i!=0) sum +=pq[0][i-1];
        rep(j,pq[1].size()) {
            if(j!=0) sum +=pq[1][j-1];
            rep(k,pq[2].size()) {
                if(k!=0) sum +=pq[2][k-1];
                rep(l,pq[3].size()) {
                    if(l!=0) sum +=pq[3][l-1];
                    int weight = i*base+j*(base+1)+k*(base+2)+l*(base+3);
                    if(weight<=w)ans = max(ans, sum);
                    if(l!=0) sum -=pq[3][l-1];
                }
                if(k!=0) sum -=pq[2][k-1];
            }
            if(j!=0) sum -=pq[1][j-1];
        }
    }
    cout << ans << endl;
    return 0;

}


Measured memory_bytes: 3540
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main()
{
  string s; cin >> s;
  vector<char> cv;
  char ans = '\0';

  for (int i = 0; i < s.length(); i++) {
    char x = s[i];
    cv.push_back(x);
  }

  sort(cv.begin(), cv.end());
  cv.erase(unique(cv.begin(), cv.end()), cv.end());

  for (int i = 0; i < 26; i++) {
    int asc = 97 + i;
    if (cv[i] != asc) {
      ans = asc;
      break;
    }
  }

  if (ans == '\0') cout << "None" << endl;
  else             cout << ans << endl;

  return 0;
}


Measured memory_bytes: 640
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;

int main(){
  int N;
  cin >> N;
  double a[N];
  for(int i = 0; i < N; i++) cin >> a[i];
  double bunbo = 0;
  for(int i = 0; i < N; i++){
    a[i] = 1.0 / a[i];
    bunbo += a[i];
  }

  double ans = 1.0 / bunbo;

  printf("%.10f\n", ans);
  return 0;
}


Measured memory_bytes: 256
/*
LANG:C++
PROB:

*/
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <functional>
#include <iostream>
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)


using namespace __gnu_pbds;
using namespace std;


typedef tree<int, null_type, less<int>, rb_tree_tag,
            tree_order_statistics_node_update>
    ordered_set;

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long i64;
typedef vector<i64> vi64;
typedef vector<vi64> vvi64;
typedef pair<i64, i64> pi64;
typedef double ld;
typedef unsigned long long ui64;

template<class T> bool uin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool uax(T &a, T b) { return a < b ? (a = b, true) : false; }
const int mod=1000000007;
  i64 poww(i64 a, i64 b)
  {
    a%=mod;
    i64 res=1;
    while(b)
      {
if(b&1)res=res*a%mod;

      a=a*a%mod;
      b/=2;

      }
      return res;
  }
  i64 inv(i64 a)
  {
    return poww(a,mod-2);
  }


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

    // ifstream fin(".in");
    // ofstream fout(".in");
i64 n;
cin>>n;
vi64 v(n);
for1(x,100)
{
  for1(y,100)
  {
    for1(z,100)
    {
      i64 res=x*x+y*y+z*z+z*y+x*y+z*x;
      if(res<=n)
      {
        v[res-1]++;
      }

    }
  }
}

forn(i,n)cout<<v[i]<<"\n";



    return 0;
  }


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

using namespace std;

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

signed main () {
  int n;
  string s;
  cin >> n >> s;
  vector<int> sumw, sume;
  int tmpw = 0, tmpe = 0;
  REP(i, n) {
    if(s[i] == 'W') {
      tmpw += 1;
      sume.pb(tmpe);
      sumw.pb(tmpw);
    } else {
      tmpe += 1;
      sume.pb(tmpe);
      sumw.pb(tmpw);
    }
  }

  int tmp = sume[n-1] - sume[0];
  FOR (i, 1, n) {
    tmp = min(tmp, sumw[i-1] + sume[n-1] - sume[i]);
  }
  cout << tmp << endl;
}


Measured memory_bytes: 11116
def arcsuf(k,i,j)
  if i > j
    z = i
    i = j
    j = z
  end
  return i*(2*k-i-3)/2 + j
end

n = gets.to_i
x = 8*n+1
y = Math.sqrt(x).to_i
if y*y != x
  print "No"
  exit
end

k = (y+1)/2
print "Yes\n#{k}\n"
for i in 0..(k-1)
  print "#{k-1} "
  for j in 0..(k-1)
    next if j == i
    print "#{arcsuf(k,i,j)} "
  end
  print "\n"
end



Measured memory_bytes: 2940
#include <iostream>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <stdio.h>
#include <cstdio>
using namespace std;
int main()
{
	int a=0,b=0,c=0;
	while(cin>>a>>b>>c)
	{
			if(a==7) 
		{
			if(b==5&&c==5)
			{
				 cout<<"YES"<<endl;
			}
			else cout<<"NO"<<endl;
		}
		else if(a==5)
		{
			if((b==5&&c==7)||(b==7&&c==5))
			{
				 cout<<"YES"<<endl;
			}
			else cout<<"NO"<<endl;
		}
	}
	return 	0;
}


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

const int coin[] = {500, 100, 50, 10, 5, 1};

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	int n;
	while(cin >> n && n != 0){
	
		int a = 1000 - n;
		int cnt = 0;
		for(int i = 0; i < 6; ++i){
			while(a >= coin[i]){
				a -= coin[i];
				++cnt;
			}
		}
		
		cout << cnt << endl;
	}

	return 0;
}

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

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

int main() {
  ll n; cin >> n;
  ll ans = 0;
  REP (i, n) {
    REP(j, n) {
      ll g = gcd(i, j);
      REP(k, n) {
        ans += gcd(g, k);
      }
    }
  }
  
  cout << ans << endl;
  
  return 0;
}


Measured memory_bytes: 3620
r, g, b, n = map(int, input().split())
count = 0
for i in range(0, n + 1, r):
    for j in range(0, n + 1, g):
        if i + j > n:
            break
        k = n - i - j
        if k % b == 0:
            count += 1

print(count)

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

int main() {
  int H, W;
  cin >> H >> W;
  
  cout << "#";
  for(int i=0; i<W; i++){
    cout << "#";
  }
  cout << "#" << endl;
  
  for(int i=0; i<H; i++){
    string str;
    cin >> str;
    
    cout << "#";
  	cout << str;
    cout << "#" << endl;
  }
  
  cout << "#";
  for(int i=0; i<W; i++){
    cout << "#";
  }
  cout << "#" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
int main(){
    int n;
    cin >> n;
    ll sum=0;
    vector<int> ans;
    vector<int> a(n+2);
    a[0] == 0; a[n+1] ==0;
    for(int i=1; i<=n; i++) cin >> a[i]; // 3,5,-1 のとき{0,3,5,-1,0}
    
    rep(i,a.size()-1){
        sum += abs(a[i] - a[i+1]);
    }

    for(int i=1; i<=n; i++){
        int x,y;
        x = abs(a[i-1] - a[i+1]);
        y = abs(a[i-1] - a[i]) + abs(a[i] - a[i+1]);
        ans.push_back(sum - (y - x));
    }
    rep(i,n){
        cout << ans[i] << endl;
    }
    
    
}

Measured memory_bytes: 2168
package main

import "fmt"

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func main() {
	var a, b int
	fmt.Scan(&a, &b)
	if a == b {
		fmt.Println(2 * a)
	} else {
		fmt.Println(2*max(a, b) - 1)
	}
}


Measured memory_bytes: 512
N, M = map(int, input().split())

K_ary = []
for _ in range(M):
  k = list(map(int, input().split()))
  K_ary.append(k)
P = list(map(int, input().split()))

count_n = 0
for n in range(2 ** N):
  count_k = 0
  for i, k in enumerate(K_ary):
    s_k = k[1:]
    count_s = 0
    for s in s_k:
      shift_num = s - 1
      if ((n >> shift_num) & 1):
        count_s += 1
    
    if (count_s % 2 == P[i]):
      count_k += 1

  if (count_k == M):
    count_n += 1

print(count_n)

Measured memory_bytes: 3064
h, w = map(int, input().split())
s = []
s.append('.' * (w+2))
for i in range(h):
   s.append('.' + input() + '.')
s.append('.' * (w+2))

ans = 'Yes'
dx = [-1, 0, 1, 0]
dy = [0, 1, 0, -1]

for i in range(1, h+1):
   for j in range(1, w+1):
      if (s[i][j] == '#'):
         ok = False
         for k in range(4):
            if (s[i+dx[k]][j+dy[k]] == '#'):
               ok = True
         if not ok:
            ans = 'No'

print(ans)


Measured memory_bytes: 3064
import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int K = sc.nextInt();
		int[] P = new int[N];
		for(int i = 0; i < N; i++)
			P[i] = sc.nextInt();
		int ans = N-K+1;
		int nochange = 0, x = 1;
		for(int i = 1; i < N; i++) {
			if(P[i] > P[i-1]) {
				x++;
				if(i == N-1)
					if(x >= K)
						nochange++;
			}
			else {
				if(x >= K)
					nochange++;
				x = 1;
			}
		}
		if(nochange > 0)
			ans = ans - nochange + 1;
		TreeSet<Integer> ts = new TreeSet<>();
		for(int i = 0; i < K; i++)
			ts.add(P[i]);
		for(int i = 0; i < N-K; i++) {
			if(ts.first() == P[i] && P[i+K] > ts.last())
				ans--;
			ts.remove(P[i]);
			ts.add(P[i+K]);
		}
		System.out.println(ans);

	}

}

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

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

  int ans;
  if (a == b && b == c) {
    ans = 1;
  } else if (a != b && b != c && a != c) {
    ans = 3;
  } else {
    ans = 2;
  }

  cout << ans << endl;
}


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

if A % 2 != 0:
    tmp1 = (A-1)^(0 if ((A-2+1) // 2) % 2 == 0 else 1)
else:
    tmp1 = 0 if ((A-1+1) // 2) % 2 == 0 else 1

if B % 2 == 0:
    tmp2 = B^(0 if ((B-1+1) // 2) % 2 == 0 else 1)
else:
    tmp2 = 0 if ((B+1) // 2) % 2 == 0 else 1

print(tmp1^tmp2)

Measured memory_bytes: 3064
#include<iostream>
#include<vector>
using namespace std;
int main()
{
	int N,M,a[100],b[100],ans[100];
	cin >> N >> M;
	for(int i=1; i<=N; i++){
		ans[i] = 0;
	}
	for(int i=0; i<M; i++){
		cin >> a[i] >> b[i];
		ans[a[i]]++;
		ans[b[i]]++;
	}
	for(int i=1; i<=N; i++){
		cout << ans[i] << endl;
	}
	
	return 0;
}


Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
//      String[] nyu=sc.nextLine().split(" ");

     String nyu=sc.nextLine();
//int A=Integer.parseInt(nyu[0]);
//int B=Integer.parseInt(nyu[1]);
int C=Integer.parseInt(nyu);


//double A=Double.parseDouble(nyu[0]);
//double B=Double.parseDouble(nyu[1]);
/*
switch(C){
case 7:
case 5:
case 3:
System.out.println("YES") ;
break;
default:
System.out.println("NO") ;

break;
}
*/


if(C<1000){

System.out.println("ABC");
}else{
System.out.println("ABD");

}


	}
}

Measured memory_bytes: 21332
n=int(input())
W=[int(_) for _ in input().split()]
S_w=[W[0]]
for i in range(1,n):
    S_w.append(S_w[-1]+W[i])
ans=1000000
for i in range(n):
    ans=min(ans,abs(2*S_w[i]-S_w[n-1]))
print(ans)


Measured memory_bytes: 3060
package main

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

var (
	rdr   = bufio.NewReaderSize(os.Stdin, 1000000)
	reply string
)

func main() {
	in := make([]string, 2)
	fmt.Scan(&in[0], &in[1])
	solve(in)
}

func solve(buf []string) {
	reply = strconv.Itoa(strings.Count(buf[1], "ABC"))
	fmt.Println(reply)
}

func point(points []int, s string) (point int) {
	switch s {
	case "r":
		point = points[2]
	case "s":
		point = points[0]
	case "p":
		point = points[1]
	}
	return
}

func readLine() string {
	buf := make([]byte, 0, 1000000)
	for {
		l, p, e := rdr.ReadLine()
		if e != nil {
			panic(e)
		}
		buf = append(buf, l...)
		if !p {
			break
		}
	}
	return string(buf)
}

func nextSlice() []string {
	return strings.Split(readLine(), " ")
}

func atoi(a []string) (b []int) {
	b = make([]int, len(a))
	for i := range a {
		b[i], _ = strconv.Atoi(a[i])
	}
	return
}

func atof(a []string) (b []float64) {
	b = make([]float64, len(a))
	for i := range a {
		b[i], _ = strconv.ParseFloat(a[i], 64)
	}
	return
}

func scanSlice2(n int) (a []int, b []int) {
	a = make([]int, n)
	b = make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&a[i], &b[i])
	}
	return
}

func scanFloatSlice2(n int) (a []float64, b []float64) {
	a = make([]float64, n)
	b = make([]float64, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&a[i], &b[i])
	}
	return
}

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

func abs(a int) int {
	if a > 0 {
		return a
	}
	return -a
}

func gcd(a, b int) int {
	if b == 0 {
		return a
	}
	return gcd(b, a%b)
}

func min(a ...int) int {
	min := a[0]
	for i := 1; i < len(a); i++ {
		if min > a[i] {
			min = a[i]
		}
	}
	return min
}

func max(a ...int) int {
	max := a[0]
	for i := 1; i < len(a); i++ {
		if max < a[i] {
			max = a[i]
		}
	}
	return max
}

func sum(a []int) (ans int) {
	for i := range a {
		ans += a[i]
	}
	return
}

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

func yesOrNo(b bool) {
	if b {
		reply = "Yes"
		fmt.Println(reply)
		return
	}
	reply = "No"
	fmt.Println(reply)
}

func yesorNO(b bool) {
	if b {
		reply = "Yes"
		fmt.Println(reply)
		return
	}
	reply = "No"
	fmt.Println(reply)
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 20;
typedef long long ll;
ll n, a[N], c[10], d = 0;
int main(){
	cin >> n;
	for(int i = 0; i < n; i ++){
		cin >> a[i];
		if(a[i] % 4 == 0){
			a[i] = 2;
			c[0] += 1;
		}
		else if(a[i] % 4 == 2){
			a[i] = 1;
			c[1] += 1;
		}
		else{
			a[i] = 0;
			c[2] += 1;
		}
	}
	if(c[1] != 0){
		if(c[2] > c[0]){
			d = 1;
		}
	}
	else{
		if(c[2] > c[0] + 1){
			d = 1;
		}
	}
	if(d == 1){
		cout << "No";
	}
	else{
		cout << "Yes";
	}
	return 0;
}

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

const int MAX = 310000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit()
{
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++)
    {
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k)
{
    if (n < k)
        return 0;
    if (n < 0 || k < 0)
        return 0;
    ll result = n;
    for(int i = 1; i < k; i++)
    {
        result = (result * (n - i)) % MOD; 
    }
    return result * (finv[k] % MOD) % MOD;
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N, A, B;
    cin >> N >> A >> B;
    COMinit();
    ll answer = 1;
    ll kisuu = 2;
    ll temp = N;
    while(temp > 0)
    {
        if(temp & 1)
        {
            answer = (answer * kisuu) % MOD;
        }
        kisuu = (kisuu * kisuu) % MOD;
        temp >>= 1;
    }
    answer--;
    answer = (answer - COM(N, A) + MOD) % MOD;
    answer = (answer - COM(N, B) + MOD) % MOD;
    cout << answer << endl;
    return 0;
}


Measured memory_bytes: 7552
use std::vec::Vec;
use std::cmp::*;

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>().split_whitespace().map(|e| e.parse().ok().unwrap()).collect()
}

fn main() {
  let (x, a, b) = {
    let v: Vec<i64> = read_vec();
    (v[0], v[1], v[2])
  };

  if (x - a).abs() > (x - b).abs() {
    println!("B");
  } else {
    println!("A");
  }
}


Measured memory_bytes: 4352
#include<stdio.h>
int main(void){
  int N,M,C,B[20],A[20][20],i,j,c,sum;
  scanf("%d %d %d",&N,&M,&C);
  for(i=0;i<=M-1;i++){
    scanf("%d",&B[i]);
  }
  for(i=0;i<=N-1;i++){
    for(j=0;j<=M-1;j++){
      scanf("%d",&A[i][j]);
    }
  }
  c=0;
  sum=0;
  for(i=0;i<=N-1;i++){
  for(j=0;j<=M-1;j++){
    sum+=A[i][j]*B[j];
  }
    sum+=C;
    if(sum>0)
      c++;
    sum=0;
  }
  printf("%d",c);
  return 0;
}

Measured memory_bytes: 128
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
//#include<bits/stdc++.h>
#include<cstdio>
#include<algorithm>
//#include<vector>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

const int cm = 1 << 17;
char cn[cm], * ci = cn + cm, ct;
inline char getcha() {
	if (ci - cn == cm) { fread(cn, 1, cm, stdin); ci = cn; }
	return *ci++;
}
inline int getint() {
	int A = 0;
	if (ci - cn + 16 > cm) while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';
	else while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';
	return A;
}

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


	int N = getint();
	int A[300][300];
	bool owari = 0;
	rep(i, N) rep(j, N) A[i][j] = getint();
	rep(i, N) A[i][i] = 1e9;

	ll kotae = 0;
	rep(i, N) {
		rep(j, i) {
			auto a = A[i] + j;
			auto b = A[i];
			auto c = A[j];
			bool B = 1;
			rep(k, N) {
				if (*a == b[k] + c[k]) B = 0;
				if (*a > b[k] + c[k]) {
					printf("-1");
					return 0;
				}
			}
			if (B) kotae += *a;
		}
	}

	printf("%lld", kotae);

	Would you please return 0;
}

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

int main(){
    int N; cin >> N;
    vector<int> vec(N);
    
    for(auto &v: vec)
        cin >> v;
    
    int ans = -(1<<30);
    int mvalue = vec[0];
    
    for(int i=1; i<N; i++){
        ans = max(ans, vec[i]-mvalue);
        mvalue = min(mvalue, vec[i]);
    }
    
    cout << ans << endl;
    
    return 0;
}



Measured memory_bytes: 3620
package main

import "fmt"

func main() {
	var N string
	fmt.Scan(&N)
	if N[0] == N[1] && N[1] == N[2] {
		fmt.Println("Yes")
		return
	}
	if N[1] == N[2] && N[2] == N[3] {
		fmt.Println("Yes")
		return
	}
	fmt.Println("No")
}

Measured memory_bytes: 512
s=gets.chomp
odd =[]
even = []
s.each_char.with_index do |c, i|
    if i.even?
        if ["R", "U", "D"].include?(c)
            next
        else
            puts "No"
            exit
        end
    else
        if ["L", "U", "D"].include?(c)
            next
        else
            puts "No"
            exit
        end
    end
end
puts "Yes"

Measured memory_bytes: 1788
# ABC140D - Face Produces Unhappiness
def main():
    N, K = tuple(map(int, input().split()))
    S = input().rstrip()
    ans = min(N - 1, sum(i == j for i, j in zip(S, S[1:])) + K * 2)
    print(ans)


if __name__ == "__main__":
    main()

Measured memory_bytes: 3316
#include"bits/stdc++.h"
using namespace std;
using ll = int64_t;

constexpr ll MOD = (ll)1e9 + 7;

ll MODpow(ll n, ll m) {
    ll result = 1;
    while (m) {
        if (m % 2 == 1) {
            result *= n;
            result %= MOD;
        }

        m /= 2;
        n *= n;
        n %= MOD;
    }

    return result;
}

class Combination {
public:
    Combination(ll max_num, ll mod) {
        fact_.resize(max_num + 1, 1);
        inv_fact_.resize(max_num + 1, 1);
        mod_ = mod;
        for (ll i = 2; i <= max_num; i++) {
            fact_[i] = i * fact_[i - 1] % mod_;
            inv_fact_[i] = MODpow(fact_[i], mod_ - 2);
            assert(fact_[i] * inv_fact_[i] % mod_ == 1);
        }
    }
    ll operator()(ll n, ll m) const {
        if (m < 0 || m > n) return 0;
        return fact_[n] * inv_fact_[n - m] % mod_ * inv_fact_[m] % mod_;
    }
private:
    vector<ll> fact_, inv_fact_;
    ll mod_;
};


int main() {
    ll N, A, B, C;
    cin >> N >> A >> B >> C;

    Combination comb(2 * N, MOD);

    //1回どちらかに勝ち負けが付くとしてそれぞれが勝つ確率
    ll probA = A * MODpow(100 - C, MOD - 2) % MOD;
    ll probB = B * MODpow(100 - C, MOD - 2) % MOD;

    //1回勝ち負けが付くまでにかかる期待ゲーム数
    ll one_step = 100 * MODpow(100 - C, MOD - 2) % MOD;

    ll ans = 0;
    for (ll i = 0; i < N; i++) {
        //高橋君がN勝 i敗となる確率
        ll p1 = comb(N - 1 + i, N - 1) * MODpow(probA, N) % MOD * MODpow(probB, i) % MOD;

        //青木君がN勝 i敗となる確率
        ll p2 = comb(N - 1 + i, N - 1) * MODpow(probB, N) % MOD * MODpow(probA, i) % MOD;

        //N + i回の勝ち負けで終わる確率
        ll p = (p1 + p2) % MOD;

        //N + i回勝ち負けが付く場合の期待ゲーム数
        ll exp_game_num = one_step * (N + i) % MOD;

        //答えに足す
        (ans += p * exp_game_num % MOD) %= MOD;
    }

    cout << ans << endl;
}

Measured memory_bytes: 3328
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
typedef vector<int> VI;
typedef pair<int, int> pii;
#define fore(i,a) for(auto &i:a)
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
//vector<vector<int> > dp;
//vector<vector<vector<int> > > vvvi;
//dp=vector<vector<int> >(N, vector<int>(M,0));
//vector<pair<int,int> > v;
//v.push_back(make_pair(x,y));
//priority_queue<int,vector<int>, greater<int> > q2;



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

	int N, F;
	cin >> N >> F;
	vector<vector<string> >A(N);
	REP(i, N) {
		int M;
		cin >> M;
		REP(j, M) {
			string s;
			cin >> s;
			A[i].push_back(s);
		}
		SORT(A[i]);
	}
	map<pair<string, string>, int>mp;
	vector<pair<string, string> >ans;

	REP(i, N) {
		REP(j, A[i].size()-1) {
			FOR(k, j + 1, A[i].size()) {
				//cout << A[i][j] << " " << A[i][k] << endl;
				mp[make_pair(A[i][j], A[i][k])]++;
			}
		}
		//cout << endl;
	}
	REP(i, N) {
		REP(j, A[i].size() - 1) {
			FOR(k, j + 1, A[i].size()) {
				if (mp[make_pair(A[i][j], A[i][k])] >= F) {
					ans.push_back(make_pair(A[i][j], A[i][k]));
					mp[make_pair(A[i][j], A[i][k])] = 0;
				}
			}
		}
	}
	SORT(ans);
	cout << ans.size() << endl;
	REP(i, ans.size()) {
		cout << ans[i].first << " " << ans[i].second << endl;
	}

	return 0;
}




Measured memory_bytes: 3548
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;


ll get(ll x,ll y, ll st, ll nxt){
    if(y/2<x){
        if((y-x)%2)return nxt;
        else return st;
    }
    ll z = y/2;
    if(y%2==0){
        if((y-z)%2==0){
            return get(x,y/2,3-st-nxt,nxt);
        }
        else {
            if(st==0)return get(x,y/2,1,3-st-nxt);
            else return get(x,y/2,0,3-st);
        }
    }
    else{
        if(z%2==0){
            return get(x,y/2,3-st-nxt,st);
        }
        else {
            if(nxt==0)return get(x,y/2,1,3-st-nxt);
            else return get(x,y/2,0,3-nxt);
        }
    }
}
int main(){
    int n;
    cin>>n;
    ll s = 0;
    rep(i,n){
        ll x,y;
        cin>>x>>y;
        ll ret = get(x,y,0,1);
        s^=ret;
    }
    cout<<(s==0?"tubuann":"mo3tthi")<<endl;
    return 0;
}


Measured memory_bytes: 3120
#include<iostream>
#include<cmath>
#include<cstdio>
#include<algorithm>
#include<vector>
#include<cstring>
#include<queue>

using namespace std;

#define INF 999999999
#define REP(i,n) for(int i=0; i<(int)(n); i++)

vector<int> py, od;
int pol[1000000], odd[1000000];

void tri(){
	for(int i=0;i*i*i<=6000000;i++){
		py.push_back(i*(i+1)*(i+2)/6);
		if((i*(i+1)*(i+2)/6)%2==1)od.push_back(i*(i+1)*(i+2)/6);
	}
	//cout << py.size() << " " << od.size() << endl;
}

void tab_pol(){
	pol[0] = 0;
	int ans, ins;
	for(int i=1;i<1000000;i++){
		ans = i;
		for(int j=1;py[j]<=i&&j<py.size();j++){
			ins = 1 + pol[i-py[j]];
			if(ins < ans) ans = ins;
		}
		pol[i] = ans;
	}
}


void tab_odd(){
	odd[0] = 0;
	int ans, ins;
	for(int i=1;i<1000000;i++){
		ans = i;
		for(int j=1;od[j]<=i&&j<od.size();j++){
			ins = 1 + odd[i-od[j]];
			if(ins < ans) ans = ins;
		}
		odd[i] = ans;
	}
}

int main(){
	tri();
	//cout << "tri" <<endl;
	tab_pol();
	//cout << "pol" <<endl;
	tab_odd();
	int n;
	
	while(1){
		cin >> n;
		if(!n) break;
		cout << pol[n] << " " << odd[n] << endl;
	}
	return 0;
}

Measured memory_bytes: 9032
X = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

print(X[int(input())-1])

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define S second
#define F first
#define ll long long

using namespace std;

const ll N = 2e5 + 5, mod = 1e9 + 7;

ll a[N], b[N], c[N], ans1[N], n;

int main()
{
    ll ans = 0;
    scanf("%lld", &n);
    for(int i = 1 ; i <= n ; i++) scanf("%lld", a + i);
    for(int i = 1 ; i <= n ; i++) scanf("%lld", b + i);
    for(int i = 1 ; i <= n ; i++) scanf("%lld", c + i);
    sort(a, a + n + 1);
    sort(b, b + n + 1);
    sort(c, c + n + 1);
    for(int i = 1 ; i <= n ; i++)
    {
        ans1[i] = lower_bound(a, a + n + 1, b[i]) - a - 1;
        ans1[i] += ans1[i - 1];
    }
    for(int i = 1 ; i <= n ; i++)
    {
        ans += ans1[lower_bound(b, b + n + 1, c[i]) - b - 1];
    }
    printf("%lld\n", ans);
    return 0;
}


Measured memory_bytes: 5632
#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <functional>
#include <bitset>

using namespace std;
using lint = long long int;
long long int INF = 1001001001001001LL;
int inf = 1000000007;
long long int MOD = 1000000007LL;
double PI = 3.1415926535897932;

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

#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()

/* do your best */

int main() {
  
  string s; cin >> s;
  if (s == "RRR") cout << 3 << endl;
  else if (s == "RRS" or s == "SRR") cout << 2 << endl;
  else if (s == "SSS") cout << 0 << endl;
  else cout << 1 << endl;
  return 0;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define INF 0x3f3f3f3f
#define MOD 1000000007
#define MAXN 200005
#define TRACE(x) cout<<#x<<" = "<<x<<'\n'
#define TRACE2(x, y) cout<<#x<<" = "<<x<<" "<<#y<<" = "<<y<<'\n'
#define TRACEA(arr, i) cout<<#arr<<"["<<i<<"]"<<" = "<<arr[i]<<'\n'
#define PRINT(arr, n) for (int iDx = 0; iDx < (n); iDx++) cout << arr[iDx] << " \n"[iDx == (n)-1]
#define SZ(x) (int)(x).size()
using namespace std;
struct ii {
	int a, b;
	bool operator < (ii o) const { return tie(a, b) < tie(o.a, o.b); }
};
struct iii {
	int a, b, c;
	bool operator < (iii o) const { return tie(a, b, c) < tie(o.a, o.b, o.c); }
};
int TC, N, M, K, Q, x, y, z;

ii hor[MAXN], ver[MAXN];
iii edge[MAXN];
long long par[MAXN];

int find(int now) { return par[now] == now? now: par[now] = find(par[now]); }

void merge(int x, int y) {
	int a = find(x);
	int b = find(y);
	par[a] = b;
}

int main() {
	#ifdef FAIRUZI10
	freopen("/home/fairuzi/Documents/CP/input.in", "r", stdin);
	#endif
	
	scanf("%d", &N);
	for (int i = 0; i < N; i++) {
		scanf("%d%d", &x, &y);
		hor[i] = {x, i};
		ver[i] = {y, i};
	}
	sort(hor, hor+N);
	sort(ver, ver+N);
	
	for (int i = 0; i < N-1; i++) {
		edge[i<<1] = {hor[i+1].a-hor[i].a, hor[i+1].b, hor[i].b};
		edge[i<<1|1] = {ver[i+1].a-ver[i].a, ver[i+1].b, ver[i].b};
	}
	
	int N2 = N<<1;
	sort(edge, edge+N2);
	for (int i = 0; i < N2; i++) par[i] = i;
	
	long long ans = 0;
	for (int i = 0; i < N2; i++) {
		x = find(edge[i].b);
		y = find(edge[i].c);
		if (x != y) {
			ans += edge[i].a;
			merge(x, y);
		}
	}
	printf("%lld\n", ans);
	
	return 0;
}


Measured memory_bytes: 6528
line = STDIN.gets.chomp.to_i

arg = []
line.times do
  arg << STDIN.gets.chomp
end

arg.each do |l|
  arr = l.split(' ').map(&:to_i)
  max = arr.delete_at(arr.index(arr.max))
  if max**2 == arr[0]**2 + arr[1]**2
    puts "YES\n"
  else
    puts "NO\n"
  end
end

Measured memory_bytes: 8760
#include <bits/stdc++.h>  // include all standard C++ libraries

using namespace std;

// Loops
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define _rrep(i,n) rrepi(i,n,0)
#define rrepi(i,a,b) for(int i=int(a)-1;i>=int(b);--i)

#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define rrep(...) _overload3(__VA_ARGS__,rrepi,_rrep,)(__VA_ARGS__)
#define each(xi, x) for (auto&& xi : x)
// Note: we can use rep(i,N) or rep(i,from,to)


// typedef
using ll = long long;
template <class T> using vec = vector<T>;
using vi   = vector<int>;
using vvi  = vector<vi>;
using vvvi = vector<vvi>;
using pii  = pair<int, int>;


// Constants

// Shorter repr for frequently used terms
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define Fi first
#define Se second


// Algorithms
#define all(x) (x).begin(), (x).end()
#define uniq(v) v.erase( unique(all(v)), v.end() )
#define perm(c) sort(all(c));for(bool c##p=1;c##p;c##p=next_permutation(all(c)))

template<class T> pair<T, size_t> max(vector<T> &x){ auto it = max_element(all(x)); return mp(*it, it-x.begin()); }
template<class T> pair<T, size_t> min(vector<T> &x){ auto it = min_element(all(x)); return mp(*it, it-x.begin()); }

template<class T> inline bool chmax(T &maxval, const T &newval) { if (maxval<newval) { maxval=newval; return 1; } return 0; }
template<class T> inline bool chmin(T &minval, const T &newval) { if (minval>newval) { minval=newval; return 1; } return 0; }

// Utilities
// Grid world utilities
int dx[4]={0,1,0,-1};
int dy[4]={1,0,-1,0};
#define inside(H,W,y,x) 0<=(x) && (x)<(W) && 0<=(y) && (y)<(H)

inline int in() {int x; cin >> x; return x;} // read int from cin
inline  ll IN() {ll x; cin >> x; return x;}  // read ll from cin



// Debug
#ifdef LOCAL
  #include "dump.hpp"
  #define debug(x) cerr << #x << ": " << x << '\n'
#else
  #define dump(...)
  #define debug(x)
#endif

// Paste snippets here!!

// 

int main(){
  cin.tie(0); ios::sync_with_stdio(false);    // Magic for faster cin
  int a, b;
  cin >> a >> b;
  if((a+b)%2==1) cout << "IMPOSSIBLE" << endl;
  else cout << (a+b)/2 << endl;
  return 0;
}


Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;
public class Main {
	public static void main(String[] args)throws Exception{
		Scanner stdIn=new Scanner(System.in);
		int A[]=new int[4];
		for(int i=0;i<3;i++){
			int a=stdIn.nextInt()-1;
			int b=stdIn.nextInt()-1;
			A[a]++;A[b]++;
			if(A[a]>2||A[b]>2){
				System.out.println("NO");
				System.exit(0);
			}
		}
		if(A[0]!=0&&A[1]!=0&&A[2]!=0&&A[3]!=0)
			System.out.println("YES");
		else
			System.out.println("NO");
	}
}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
#define min(a,b) ((a)<(b)?(a):(b))
#define max(a,b) ((a)>(b)?(a):(b))
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,n1,n2) for(int i=n1;i<n2;i++)
#define bFOR(i,n1,n2) for(int i=n1;i>=n2;i--)
#define speed_up    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

typedef long long int ll;
typedef pair<int,int> Pi;
const int INF=(ll)(1LL<<31)-1;
const ll INFl=(ll)9223372036854775807;
const int MAX=10000;
const ll MOD=(ll)1e9+7;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a, b)*b;}
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

ll n,a,b,c,d;

int main(){
	cin>>n>>a>>b>>c>>d;
	for(int i=0;i<n;i++){
		ll t1=a+i*c-(n-1-i)*d;
		ll t2=a+i*d-(n-1-i)*c;
		if(t1<=b&&b<=t2){
			cout<<"YES"<<endl;
			return 0;
		}
	}
	cout<<"NO"<<endl;
	return 0;
}

Measured memory_bytes: 256
read n
read ps
n=$(echo $n | tr -d "\r\n")
ps=$(echo $ps | tr -d "\r\n")
arr=($ps)
ans=0


for ((i=1; i<n-1; i++)); do
    count=0
    if [ ${arr[$((i - 1))]} -lt ${arr[$i]} ]; then
        count=$((count+1))
    fi
    if [ ${arr[$((i + 1))]} -lt ${arr[$i]} ]; then
        count=$((count+1))
    fi
    if [ $count -eq 1 ]; then
        ans=$((ans+1))
    fi
done

echo $ans

Measured memory_bytes: 700
#include <bits/stdc++.h>
    using namespace std;
     
    typedef long long ll;
    typedef long double ld;
    typedef pair <ld, int> ldi;
    typedef pair <int, int> ii;
     
    const int Maxn = 105;
    const ld PI = acos(-1.0l);
     
    int n;
    int mn;
    int X[Maxn], Y[Maxn];
    vector <int> seq;
    vector <int> hull;
    ld my[Maxn], sum;
     
    ll Cross(ll ax, ll ay, ll bx, ll by) { return ax * by - ay * bx; }
     
    ll Dot(ll ax, ll ay, ll bx, ll by) { return ax * bx + ay * by; }
     
    ld Len(ld ax, ld ay) { return sqrt(ax * ax + ay * ay); }
     
    ld Angle(int a, int b, int c)
    {
    	ll ax = X[b] - X[a], ay = Y[b] - Y[a];
    	ll bx = X[c] - X[a], by = Y[c] - Y[a];
    	return acos(Dot(ax, ay, bx, by) / Len(ax, ay) / Len(bx, by));
    }
     
    bool Ok(int a, int b, int c)
    {
    	ll ax = X[b] - X[a], ay = Y[b] - Y[a];
    	ll bx = X[c] - X[a], by = Y[c] - Y[a];
    	return Cross(ax, ay, bx, by) > 0;
    }
     
    bool Less(const int &a, const int &b)
    {
    	ld v1 = atan2(ld(Y[a] - Y[mn]), ld(X[a] - X[mn]));
    	ld v2 = atan2(ld(Y[b] - Y[mn]), ld(X[b] - X[mn]));
    	if (fabs(v1 - v2) > 1e-9l) return v1 < v2;
    	return Len(X[mn] - X[a], Y[mn] - Y[a]) < Len(X[mn] - X[b], Y[mn] - Y[b]);
    }
     
    int main()
    {
    	scanf("%d", &n);
    	mn = 0;
    	for (int i = 0; i < n; i++) {
    		scanf("%d %d", &X[i], &Y[i]);
    		if (ii(X[i], Y[i]) < ii(X[mn], Y[mn])) mn = i;
    	}
    	for (int i = 0; i < n; i++) if (i != mn)
    		seq.push_back(i);
    	sort(seq.begin(), seq.end(), Less);
    	hull.push_back(mn);
    	for (int i = 0; i < seq.size(); i++) {
    		int ind = seq[i];
    		while (hull.size() >= 2 && !Ok(hull[int(hull.size()) - 2], hull.back(), ind)) hull.pop_back();
    		hull.push_back(ind);
    	}
    	while (hull.size() >= 3 && !Ok(hull[int(hull.size()) - 2], hull.back(), mn)) hull.pop_back();
    	if (hull.size() == 2) {
    		for (int i = 0; i < hull.size(); i++)
    			my[hull[i]] = 0.5;
    		sum = 1;
    	} else 
    		for (int i = 0; i < hull.size(); i++) {
    			int pi = (i - 1 + hull.size()) % hull.size();
    			int ni = (i + 1) % hull.size();
    			my[hull[i]] = PI - Angle(hull[i], hull[pi], hull[ni]);
    			sum += my[hull[i]];
    		}
    	for (int i = 0; i < n; i++)
    		cout << fixed << setprecision(15) << my[i] / sum << endl;
    	return 0;
    }

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const double PI = 4*atan(1);
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3f;
const double EPS = 1e-6;
const string YES = "Possible";
const string NO = "Impossible";
#define pb push_back
#define mp make_pair

const int MAX_N = 1e5+10;
int A[MAX_N];
int dist[MAX_N];

int N,X;

ll gcd(ll a, ll b)
{
	if(!b) return a;
	return gcd(b,a%b);
}

void solve()
{
	for(int i=0;i<N;++i){
		dist[i] = abs(X-A[i]);
	}
	ll g = dist[0];
	for(int i=1;i<N;++i) g=gcd(g,dist[i]);
	cout << g << endl;
}

int main()
{
	cin >> N >> X;
	for(int i=0;i<N;++i) cin >> A[i];
	solve();
	return 0;
}

Measured memory_bytes: 1024
package main 

import (
	"fmt"
)

type Rec struct {
	h int
	w int
}

func main() {
	var rec Rec
	var recs []Rec
	for {
		fmt.Scan(&rec.h, &rec.w)
		recs = append(recs, rec)
		if rec.h == 0 && rec.w == 0 {
			recs = recs[:len(recs) - 1]
			break
		}
	}

	for _, v := range recs {
		if v.h >= 3 && v.h <= 300 && v.w >= 3 && v.w <= 300 {
			for i := 0; i < v.w - 1; i++ {
				fmt.Print("#")
			}
			fmt.Print("#\n")

			for i := 0; i < v.h - 2; i++ {
				fmt.Print("#")
				for j := 0; j < v.w - 2; j++ {
					fmt.Print(".")
				}
				fmt.Print("#\n")
			}

			for i := 0; i < v.w - 1; i++ {
				fmt.Print("#")
			}
			fmt.Print("#\n")
			fmt.Println()
		}
	}
}




Measured memory_bytes: 1160
#include <stdio.h>
#include <math.h>

struct Point { double x, y; };

void koch(int n, Point a, Point b)
{
    Point s, t, u;
    double th = M_PI * 60.0 / 180.0;    // 度からラジアンへ単位を変換

    if (n == 0) return;

    s.x = (2.0 * a.x + 1.0 * b.x) / 3.0;
    s.y = (2.0 * a.y + 1.0 * b.y) / 3.0;
    t.x = (1.0 * a.x + 2.0 * b.x) / 3.0;
    t.y = (1.0 * a.y + 2.0 * b.y) / 3.0;
    u.x = (t.x - s.x) * cos(th) - (t.y - s.y) * sin(th) + s.x;
    u.y = (t.x - s.x) * sin(th) + (t.y - s.y) * cos(th) + s.y;

    koch(n - 1, a, s);
    printf("%.8f %.8f\n", s.x, s.y);
    koch(n - 1, s, u);
    printf("%.8f %.8f\n", u.x, u.y);
    koch(n - 1, u, t);
    printf("%.8f %.8f\n", t.x, t.y);
    koch(n - 1, t, b);
}

int main()
{
    Point a, b;
    int n;

    scanf("%d", &n);

    a.x = 0;
    a.y = 0;
    b.x = 100;
    b.y = 0;

    printf("%.8f %.8f\n", a.x, a.y);
    koch(n, a, b);
    printf("%.8f %.8f\n", b.x, b.y);

    return 0;
}


Measured memory_bytes: 2760
#include <stdio.h>

int main(void){
    int A, B, f1 = 1, i, f2 = 1;
    char S[10];

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

    scanf("%s", S);

    if(S[A] == 45){
        f1 = 0;
    }

    for (i = 0; i < A + B + 1; i++)
    {
        if (S[i] < 48 || S[i] > 58){
            if(i != A){
                f1 = 1;
            }
        }
    }

    if(f1==0){
        printf("Yes\n");
    } else {
        printf("No\n");
    }

    return 0;
}

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

#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 ALL(obj) (obj).begin(), (obj).end()
#define INF 1e9
typedef long long ll;


int main() {
    ll X;
    cin >> X;
    ll money = 100;
    int count = 0;
    while(money < X){
        money += money/100;
        count++;
    }
    cout << count << endl;
    return 0;
}

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

int main(void){

    unsigned int wide = 5;
    unsigned int height = 4;
    int pointX = 2;
    int pointY = 2;
    unsigned int radius = 1;
    int rightX;
    int leftX;
    int topY;
    int bottomY;

    std::cin >> wide >> height >> pointX >> pointY >> radius;

    rightX = pointX + radius;
    leftX = pointX - radius;
    topY = pointY + radius;
    bottomY = pointY - radius;

    if(rightX > wide || leftX < 0 || topY > height || bottomY < 0) {
        std::cout << "No" << std::endl;
    } else {
        std::cout << "Yes" << std::endl;
    }
    
    return 0;
}

Measured memory_bytes: 3112
#include<bits/stdc++.h>
#define fast ios::sync_with_stdio(false), cin.tie(0);
#define ll long long
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define endl '\n'

using namespace std;

main()
{
    fast;
    int n,i;
    cin>>n;
    ll a,mn=INT_MAX,mx=-1;
    for (i=0;i<n;i++)
    {
        cin>>a;
        mn=min(mn,a);
        mx=max(mx,a);
    }
    cout<<mx-mn<<endl;
}

Measured memory_bytes: 256
const val MOD: Long = (1e9+7).toLong()

fun main(args: Array<String>) {
    val b = readLine()!![0]

    if (b == 'A') {
        println('T')
    }
    if (b == 'C') {
        println('G')
    }
    if (b == 'G') {
        println('C')
    }
    if (b == 'T') {
        println('A')
    }
}


Measured memory_bytes: 31748
#pragma warning disable

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.Serialization.Formatters.Binary;
using System.Text;
using System.Text.RegularExpressions;
using System.Diagnostics;
using System.Numerics;
using System.Collections;

static class MainClass
{
    public static void Main(string[] args)
    {
        var tx = Console.ReadLine().SplittedStringToInt32List();
        Console.WriteLine(tx[0]/(double)tx[1]);

        Console.ReadLine();
    }
    
    

    #region ライブラリ
    public static long ToInt64(this string str) => long.Parse(str);
    public static int ToInt32(this string str) => int.Parse(str);
    public static BigInteger ToBigInteger(this string str) => BigInteger.Parse(str);
    public static List<string> SplittedStringToList(this string str) => str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).ToList();
    public static List<int> SplittedStringToInt32List(this string str) => str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(x => int.Parse(x)).ToList();
    public static List<long> SplittedStringToInt64List(this string str) => str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(x => long.Parse(x)).ToList();
    public static List<BigInteger> SplittedStringToBigInteger(this string str) => str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(x => BigInteger.Parse(x)).ToList();
    public const int INF = int.MaxValue / 2;
    public const long LONGINF = long.MaxValue / 2;

        // 素因数分解
    public static List<long> PrimeFactorize(long n)
    {
        var bases = n;
        var num = (long)Math.Pow(n, 0.5);
        var ls = new List<long>();
        for (int i = 2; i <= num; i++)
        {
            if (n % i == 0)
            {
                n = n / i;
                ls.Add(i);
                i--;
                continue;
            }
        }
        long nnn = 1;
        foreach (var item in ls)
        {
            nnn = nnn * item;
        }
        if (nnn != bases)
            ls.Add(n);
        return ls;
    }


    public static List<long> MakeDivisors(long n)
    {
        var ls = new List<long>();
        // ls.Add(1);
        for (int i = 1; i * i <= n; i++)
        {
            if (n % i == 0)
            {
                ls.Add(i);
                if (i != 1 && i * i != n)
                {
                    ls.Add(n / i);
                }
            }
        }
        return ls;
    }

    public static void PrintArray(bool[,] array)
    {
        for (int i = 0; i < array.GetLength(0); i++)
        {
            var sb = new StringBuilder();
            for (int j = 0; j < array.GetLength(1); j++)
            {
                sb.Append(array[i, j] ? "#" : ".").Append("");
            }
            Console.WriteLine(sb.ToString());
        }
    }

    #endregion
}



Measured memory_bytes: 11348
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>
using namespace std;

long long cnt;
int l;
int A[1000000];
int n;
vector<int> G;

void insertion(int A[], int n, int g)
{
	int i, j, v;
	for (i = g; i < n; i++) {
		v = A[i];
		j = i - g;
		while (j >= 0 && A[j] > v) {
			A[j + g] = A[j];
			j = j - g;
			cnt++;
		}
		A[j + g] = v;
	}
}

void shell(int A[], int n) {
	for (int h = 1;;) {
		if (h > n)break;
		G.push_back(h);
		h = 3 * h + 1;
	}

	for (int i = G.size() - 1; i >= 0; i--) {
		insertion(A, n, G[i]);
	}
}

int main()
{
	cin >> n;
	for (int i = 0; i < n; i++) scanf("%d", &A[i]);
	cnt = 0;

	shell(A, n);

	cout << G.size() << endl;
	for (int i = G.size() - 1; i >= 0; i--) {
		printf("%d", G[i]);
		if (i)printf(" ");
	}
	printf("\n");
	printf("%d\n", cnt);
	for (int i = 0; i < n; i++)printf("%d\n", A[i]);

	return 0;
}


Measured memory_bytes: 7096
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define GET_ARRAY_SIZE(a)   (sizeof(a)/sizeof(a[0]))
#define LL long long
LL facctorialMethod(int k);
int main(){
    LL a,b,c,k;
    cin >> a >> b >> c >> k;
    if((a+b) < k){
        cout << a + ((k-(a+b)) * -1) << endl;
    }else if(a < k){
        cout << a << endl;
    }else if(a >= k){
        cout << k << endl;
    }

    return 0;
}

LL facctorialMethod(int k){
    int sum = 1;
    for (int i = 1; i <= k; ++i){
        sum *= i;
    }
    return sum;
}


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

using namespace std;

int main(void)
{
  string S;
  cin>>S;
  long long N;
  cin>>N;
  
  if(S.size()==1){
    int result = N/2;
    cout << result << endl;
    return 0;
  }

  vector<int> Chars;
  int num =1;
  for(int i=1;i<S.size();i++){
    if(S[i]==S[i-1]){
      num++;
      if(i==S.size()-1){
        Chars.push_back(num);
      }
    }
    else{
      Chars.push_back(num);
      num = 1;
    }
  }

  long long result =0;
  for(int i=1;i<Chars.size()-1;i++){
    result += Chars[i]/2;
  }
  if(S.front()!=S.back()){
    result += Chars.front()/2;
    result += Chars.back()/2;
    result *= N;
  }
  else{
    if(Chars.size()==1){
      result += Chars.front()*N;
      result /= 2;
    }
    else{
    
    int add = (Chars.front()+Chars.back())/2;
    result *=N;
    result +=(N-1)*add;
    result += Chars.front()/2;
    result += Chars.back()/2;
    }
  }

  cout << result << endl;

  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(){
    int N, Y, i, j, yen;

    scanf("%d %d", &N, &Y);

    for(i=0; i<=N; i++){
        for(j=0; j+i<=N; j++){
            yen = i*10000 + j*5000 + (N-i-j)*1000;

            if(yen == Y){
                printf("%d %d %d\n", i,j,N-i-j);
                return 0;
            }
        }
    }

    printf("-1 -1 -1\n");

    return 0;
}

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

from math import gcd

def main():
     n, k = map(int, input().split())
     N = pow(10, 9) + 7
     gcd_num = [0 for i in range(k+1)]
     ans = 0

     for i in range(k, 0, -1):
          x = k // i
          gcd_num[i] = pow(x, n, N)
          for j in range(2, x+1):
               gcd_num[i] -= gcd_num[j * i]
          
          ans += gcd_num[i] * i

     print(ans%N)

if __name__ == "__main__":
    main()


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

int main() {
  string S;
  cin >> S;
  
  if (S.at(0) == S.at(1) && S.at(1) == S.at(2)){
    cout << "No" << endl;
  } else {
    cout << "Yes" << endl;
  }
  
}


Measured memory_bytes: 256