akhauriyash/Code-Regression huggingface dataset:
#!/usr/bin/env ruby

require 'set'

class Hash
  def push(key, value)
    self[key] = [] if self[key] == nil
    self[key].push(value)
  end
end

class Array
  def lower_bound(value)
    left = -1;
    right = self.length;
    while left + 1 < right
      mid = left + (right - left) / 2;
      if self[mid] >= value
        right = mid
      else
        left = mid
      end
    end
    right
  end

  def unique
    res = [self.first]
    each_cons(2) do |a, b|
      if a != b
        res.push(b)
      end
    end
    res
  end
end

def get_ints
  gets.chomp.split.map(&:to_i)
end

def get_ints_minus_one
  get_ints.map { |x| x - 1 }
end

def get_int
  gets.chomp.to_i
end

S = gets.chomp

sx = S.split('')

ac = true

ac = false if sx.first != 'A'

ac = false unless sx[2..-2].include?('C')

ac = false if sx.count { |s| s.upcase == s } != 2

puts ac ? 'AC' : 'WA'


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

int main()
{
	int n;
	cin>>n;
	double a[n+1];
	for(int i=0;i<n;i++)cin>>a[i];
	sort(a,a+n);
	double total=a[n-1]/2;
	for(int i=0;i<n-1;i++)total+=a[i];
	cout<<total;
	return 0;
}


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

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  int h[n];
  for(int i=0;i<n;i++) cin >> h[i];
  int m = 0;
  int tmp = 0;
  for(int i=0;i<n-1;i++) {
    if(h[i]>=h[i+1]) tmp++;
    else {
      m = max(m,tmp);
      tmp = 0;
    }
  }
  m = max(m,tmp);
  cout << m << endl;

  return 0;
}


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

result = 0
for i in range(N):
    if (B[i] <= A[i]):
        result += B[i]
        B[i] = 0
    else:
        result += A[i]
        B[i] -= A[i]
        A[i] = 0
        if A[i+1] >= B[i]:
            result += B[i]
            A[i+1] = A[i+1]-B[i]
            B[i] = 0
        else:
            result += A[i+1]
            A[i+1] = 0
            B[i] -= A[i+1]
print(result)

Measured memory_bytes: 18752
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<queue>
#include<list>

using namespace std;

int main()
{
	int A, B , C;
	cin >> A >> B >> C;
	if (A==B && C==B)
	{
		cout << "Yes" << endl;
	}
	else
	{
		cout << "No" << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef pair<int, int> pii;
typedef long long ll;
#define x first
#define y second
#define mod 1000000007
#define LEN 200005
ll frc[LEN], inv[LEN];
ll modinv(ll a, ll p = mod) {
    if (p == 1) return 0;
    ll pp = p, y = 0, x = 1;
    while (a > 1) {
        ll q = a / p, t = p;
        p = a % p, a = t, t = y, y = x - q * y, x = t;
    }
    if (x < 0) x += pp;
    return x;
}
void init() {
	frc[0] = frc[1] = inv[0] = inv[1] = 1; 
	for (int i = 2; i < LEN; i++) {
		frc[i] = frc[i-1] * i % mod;
		inv[i] = modinv(frc[i]);
	}
}
inline ll C(int a, int b) {
	return frc[a + b] * inv[a] % mod * inv[b] % mod;
}
inline void sub(ll &a, ll b) {
	a = (a - b % mod + mod) % mod;
}
int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    init();
    int h, w, n;
    cin >> h >> w >> n;
    vector<pii> p(n);
    for (int i = 0; i < n; i++)
    	cin >> p[i].x >> p[i].y;
    sort(p.begin(), p.end());
    p.push_back(pii(h, w));
    vector<ll> dp(n + 1, 0);
    for (int i = 0; i <= n; i++) {
    	dp[i] = C(p[i].x - 1, p[i].y - 1);
    	for (int j = 0; j < i; j++)
    		if (p[i].y >= p[j].y)
    			sub(dp[i], dp[j] * C(p[i].x - p[j].x, p[i].y - p[j].y));
    }
    cout << dp[n] << "\n";
    return 0;
}

Measured memory_bytes: 3456
#include<iostream>
#include<vector>
#include<cmath>
#include<algorithm>
#include<utility>
#include<set>
using namespace std;
string a,b;

int main()
{
int n;
set<string>a;
cin>>n;
for(int i=0;i<n;i++)
{
    string b;
    cin>>b;
    a.insert(b);
}
cout<<a.size();
return 0;   
}

Measured memory_bytes: 19260
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define pii pair<int,int>
#define vpii vector< pair<int,int> >
#define mii map<int,int>
#define MOD 1000000007
#define fr(i,k,n) for(int i=k;i<n;i++)
#define fl(i,k,n) for(int i=k;i>=n;i--)
using namespace std;
typedef long long ll;
int prime[100001]={};
void sieve()
{
	prime[0]=1;
	prime[1]=1;
	for(int i=0;i*i<100001;i++)
	{
		if(prime[i]==0)
		{
			for(int j=i*i;j<100001;j+=i)
			{
				prime[j]=1;
			}
		}
	}
}
ll binpow(ll a,ll b,ll m)
{
	ll res=1;
	while(b>0)
	{

	if(b&1)
	{
		res=res*a%m;
	}
	a=a*a%m;
	b>>=1;
   }
   return res;
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int n;
cin>>n;
double x=n/(3*1.0);
double y=x*x*x;
cout<<setprecision(12)<<y<<endl;
return 0;
}



Measured memory_bytes: 256
n, a, b = map(int, input().split())
m = int(1e9) + 7
ans = (pow(2, n, m) -1) % m
val = 1
val2 = 1
for i in range(a):
    val = (val * (n - i)) % m
    val2 = (val2 * (i + 1)) % m
ans -= (val * (pow(val2, m-2, m)))
#print(((val % m) * (pow(val2, m-2, m))))
val = 1
val2 = 1
for i in range(b):
    val = (val * (n - i)) % m
    val2 = (val2 * (i + 1)) % m
ans -= val * (pow(val2, m-2, m))
#print(((val % m) * (pow(val2, m-2, m))))
print(ans % m)

Measured memory_bytes: 3064
using System;
using System.Collections.Generic;
using System.Text;
using System.Numerics;
using System.IO;

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

            int[] o = new int[N];
            int[] v = new int[N];
            for (int i = 0; i < N; i++)
            {
                o[i] = v[i] = int.Parse(s[i]);
            }
            Array.Sort(v);

            int cL = v[N / 2 - 1];
            int cR = v[N / 2];

            if ( cL == cR)
            {
                for (int i = 0; i < N; i++)
                {
                    Console.WriteLine(cL);
                }
            }
            else
            {
                for (int i = 0; i < N; i++)
                {
                    if ( o[i] < cR)
                    {
                        Console.WriteLine(cR);
                    }
                    else
                    {
                        Console.WriteLine(cL);
                    }
                }
            }
        }
    }
}


Measured memory_bytes: 34248
a = int(input())
b = int(input())
c = int(input())
x = int(input())

ans = 0
for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            if i*500+j*100+k*50 == x:
                ans += 1

print(ans)

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

int main(){
    string S;
    cin >> S;
    if( S == "RRR" ) cout << 3 << endl;
    if( S == "RRS" or  S == "SRR" ) cout << 2 << endl;
    if( S == "RSS" or S == "RSR" or S == "SRS" or S == "SSR" ) cout << 1 << endl;
    if( S == "SSS" ) cout << 0 << endl;
    return 0;
}

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

public class Main {

	public static void main(String[] args) throws NumberFormatException, IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		int n = Integer.parseInt(br.readLine());
		String[] set1 = br.readLine().split(" ");
		String[] set2 = br.readLine().split(" ");
		double[] x = new double[n];
		double[] y = new double[n];

		for (int i = 0; i < n; i++) {
			x[i] = Double.parseDouble(set1[i]);
			y[i] = Double.parseDouble(set2[i]);
		}

		double D1 = 0d, D2 = 0d, D3 = 0d;
		double Dmax = Math.abs(x[0] - y[0]);
		double abs;
		for (int i = 0; i < n; i++) {
			abs = Math.abs(x[i] - y[i]);
			D1 += abs;
			D2 += Math.pow(abs, 2);
			D3 += Math.pow(abs, 3);
			if (abs > Dmax) {
				Dmax = abs;
			}
		}

		System.out.println(D1 + "\n" + Math.pow(D2, 1d / 2d) + "\n" + Math.pow(D3, 1d / 3d) + "\n" + Dmax);
	}
}

Measured memory_bytes: 24476
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
 
ll N, Z, W;
vector<ll> a(2001, 0);
vector<vector<int>> dp(2, vector<int>(2001, -1));
 
ll rec(bool turn = true, int count = 0, int x = Z, int y = W){
    
    if(count == N) return abs(x - y);
    
    int& res = dp[turn][count];
    if(~res) return res;
    res = (turn) ? 0 : INT_MAX;
    
    for(int i = count; i < N; ++i){
        int n = (turn) ? a[i] : x;
        int m = (turn) ? y : a[i];
        int num = rec(!turn, i + 1, n, m);
        res = (turn) ? max(res, num) : min(res, num);
    }
    
    return res;   
}
 
int main(void){
    
    cin >> N >> Z >> W;
    for(int i = 0; i < N; ++i) cin >> a[i];
    
    if(N == 1) cout << abs(a[0] - W) << endl;
    else cout << rec() << endl;
    
    return 0;
}

Measured memory_bytes: 384
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>;
using namespace std;
char s[100010];
int main(){
    scanf("%s",&s);
    int k=strlen(s);
    if(k%2!=0){//如果项数是奇数，则一定不是镜像字符串 
        printf("No");
        return 0;
    }
    for(int i=0;i<k/2;i++){
        int u=abs(s[i]-s[k-i-1]);
        if(u!=1&&u!=2){//两项的差要么为1，要么为2 
            printf("No");//两项之差不为1，不为2，说明不是镜像字符串 
            return 0;
        }
    }
    printf("Yes");//到这里程序还没结束，则是镜像字符串 
    return 0;
}

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

int main(){
    int A,B;
    cin >> A >> B;
    if(A >= 13){
        cout << B << endl;
    }else if(A >= 6){
        cout << B/2 <<endl;
    }else{
        cout << 0 << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
    int n;
    cin>>n;
    int x=0;
    for(int i=0;i<26;i++){
        for(int j=0;j<15;j++){
            if(i*4+j*7==n){
                x=1;
                break;
            }
        }
        if(x==1) break;
    }
    if(x==0) cout<<"No";
    else cout<<"Yes";
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int maxn=1e5+5;
using pii = pair<int,int>;
char s[maxn];
vector<int>v,son[maxn];
int id[maxn],use[maxn];
int tot = 0;
int GetWay(int st)
{
    int x = ++tot;
    for(auto &u:son[st]){
        int y = GetWay(u);
        son[x].push_back(y);
    }
    return x;
}
int main()
{
   // freopen("1.in","r",stdin);
    //freopen("1.out","w",stdout);
    int n;
    scanf("%s",s+1);
    bool ok = 0;
    n = strlen(s+1);
    if(s[n]=='1'||s[1]=='0'||s[n-1]=='0') ok = 1;
    for(int i = 1;i <= n/2; ++i) if(s[i]!=s[n-i]) ok = 1;
    set<int>se;
    for(int i = 1; i < n; ++i) if(s[i]=='1') v.push_back(i),se.insert(i);

    if(ok) puts("-1");
    else
    {
     //   for(int i = 0;i < v.size(); ++i )cout<<v[i]<<" ";puts("");
        int e = 0;
        for(int i = 0;i < v.size(); ++i)
        {
            ++tot;id[v[i]] = tot;
            if(i==5)
            {

                e++;
            }
            int Size = v[i]-1;
            for(int j = i-1;j >= 0&&Size; --j)
            {
                Size -= v[j];
                if(Size < 0)
                {
                     Size += v[j];
                     while(Size--){
                        if(use[1]) son[id[v[i]]].push_back(++tot);
                        else son[id[v[i]]].push_back(id[v[1]]),
                            use[1] = 1;
                     }
                     break;
                }
                if(use[v[j]])
                {
                    //assert(0);
                    son[id[v[i]]].push_back(GetWay(id[v[j]]));
                   // GetWay(id[v[j]]);
                }
                else son[id[v[i]]].push_back(id[v[j]]),
                        use[v[j]] = 1;
                //printf("%d %d\n",id[v[i]],id[v[j]]);
            }
             while(Size>0){ Size --;
                    if(use[1]) son[id[v[i]]].push_back(++tot);
                    else son[id[v[i]]].push_back(id[v[1]]),
                        use[1] = 1;
            }
        }
        son[id[*v.rbegin()]].push_back(++tot);
        for(int i = 1;i <= tot; ++i) for(auto &u:son[i]) printf("%d %d\n",i,u);
    }
    return 0;
}
/*
101111010
*/


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

using namespace std;

int main(){
    int n, c=0;
    cin >> n;
    for (int i=1; i<=n; ++i){
        int ai;
        cin >> ai;
        if (ai&1 && i&1){
            ++c;
        }
    }
    cout << c;
}


Measured memory_bytes: 3616
#![allow(unused, non_snake_case, dead_code, non_upper_case_globals)]
#![macro_use]

use std::cmp::*;
use std::collections::*;
use std::io::*;
use std::mem::*;
use std::num::*;
use std::slice::*;

fn main() {
    let (r, w, e) = (stdin(), stdout(), stderr());
    let mut io = IO::new(r.lock(), w.lock(), e.lock());
    // =============================================== //
    let (n, w): (usize, usize) = (io.read(), io.read());
    let mut dp = vec![vec![0; 101010]; 105];
    for i in 1..n + 1 {
        let (nw, nv): (usize, isize) = (io.read(), io.read());
        for j in 0..w + 1 {
            if j >= nw {
                dp[i][j] = max(dp[i - 1][j], dp[i - 1][j - nw] + nv);
            } else {
                dp[i][j] = dp[i - 1][j];
            }
        }
    }
    let mut ans = 0;
    for i in 0..w + 1 {
        ans = max(ans, dp[n][i]);
    }
    io.writeln(ans);
}

// IO
struct IO<R: Read, W: Write, E: Write> {
    Read: R,
    Write: BufWriter<W>,
    Error: BufWriter<E>,
}
impl<R: Read, W: Write, E: Write> IO<R, W, E> {
    fn new(r: R, w: W, e: E) -> IO<R, W, E> {
        IO {
            Read: r,
            Write: BufWriter::new(w),
            Error: BufWriter::new(e),
        }
    }
    fn read<T>(&mut self) -> T
    where
        T: std::str::FromStr,
    {
        let next: String = self
            .Read
            .by_ref()
            .bytes()
            .map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect();
        next.parse().ok().unwrap()
    }
    fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
    fn readn<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read::<T>()).collect::<Vec<_>>()
    }
    fn readmat<T: std::str::FromStr>(&mut self, n: usize, m: usize) -> Vec<Vec<T>> {
        (0..n).map(|_| self.readn(m)).collect()
    }
    fn write<S: ToString>(&mut self, val: S) {
        self.Write.write(val.to_string().as_bytes());
    }
    fn writeln<S: ToString>(&mut self, val: S) {
        self.Write.write(val.to_string().as_bytes());
        self.Write.write(b"\n");
    }
    fn debug<S: std::fmt::Debug>(&mut self, val: S) {
        writeln!(self.Error, "(debug ) {:?}", &val);
    }
    fn debug2<S: std::fmt::Debug>(&mut self, val1: S, val2: S) {
        writeln!(self.Error, "(debug2) {:?} -> {:?}", val1, val2);
    }
}


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

using namespace std;

namespace mylib {
template<int mod>
struct ModInt {
	using ll = long long;
	int x;
	const static int M = mod;
	ModInt(ll x_) {
		x = x_ % mod;
		if (x < 0) x += mod;
	}
	ModInt() : ModInt(0) {}
	inline ModInt& operator+=(const ModInt rhs) {
		x += rhs.x;
		x %= mod;
		return (*this);
	}
	inline ModInt& operator-=(const ModInt rhs) {
		x += -rhs;
		return *this;
	}
	inline ModInt& operator*=(const ModInt rhs) {
		x = ((ll) x * rhs.x) % mod;
		return *this;
	}
	inline ModInt& operator/=(ModInt rhs) {
		return *this *= rhs.power(mod - 2);
	}
	inline ModInt power(ll p) {
		ModInt res = 1;
		ModInt a = x;
		for (; p; res = p & 1 ? res * a : res, a *= a, p >>= 1);
		return res;
	}
	inline ModInt& operator=(const ModInt& rhs) {
		this->x = rhs.x;
		return *this;
	}
	inline int operator==(const ModInt& rhs) const {
		return this->x == rhs.x;
	}
	inline int operator!=(const ModInt& rhs) const {
		return !(*this != rhs);
	}
	inline ModInt operator++(signed unused) {
		ModInt res(*this);
		++(*this);
		return res;
	}
	inline ModInt& operator++() {
		(*this) += 1;
		return (*this);
	}
	inline ModInt operator--(signed unused) {
		ModInt res(*this);
		--(*this);
		return res;
	}
	inline ModInt& operator--() {
		(*this) -= 1;
		return (*this);
	}
	inline ModInt operator+() const {
		return (*this);
	}
	inline ModInt operator-() const {
		return (*this).x ? ModInt(mod - (*this).x) : ModInt(0);
	}
	friend const ModInt operator+(const ModInt& lhs, const ModInt& rhs) {return ModInt(lhs) += rhs;}
	friend const ModInt operator-(const ModInt& lhs, const ModInt& rhs) {return ModInt(lhs) -= rhs;}
	friend const ModInt operator*(const ModInt& lhs, const ModInt& rhs) {return ModInt(lhs) *= rhs;}
	friend const ModInt operator/(const ModInt& lhs, const ModInt& rhs) {return ModInt(lhs) /= rhs;}
	explicit operator int() const {return x;}
	friend ostream& operator<<(ostream& lhs, const ModInt& rhs) {
		lhs << rhs.x;
		return lhs;
	}
	friend istream& operator>>(istream& lhs, ModInt& rhs) {
		long long t;
		lhs >> t;
		rhs = ModInt(t);
		return lhs;
	}
};
using modint = ModInt<1000000007>;
//using modint = ModInt<998244353>;
modint operator"" _mi(unsigned long long lit) {
	return modint(lit % modint::M);
}
}; // mylib
using namespace mylib;

modint solve() {
	int N;
	cin >> N;
	vector<int> A(N);
	for (int i = 0; i < N; i++) {
		cin >> A[i];
	}
	sort(A.begin(), A.end());
	if (N % 2) {
		for (int i = 0; i < N; i++) {
			if (A[i] != (i + 1) / 2 * 2) return 0;
		}
	} else {
		for (int i = 0; i < N; i++) {
			if (A[i] != i / 2 * 2 + 1) return 0;
		}
	}
	modint res = 1;
	modint d = 1_mi / 2;
	for (int i = 0; i < N / 2; i++) {
		res /= d;
	}
	return res;
}

int main() {
	cout << solve() << endl;
}



Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
int s[200005];
long long x[200005];
int y[200005];
long long  fun(long long x)
{
    return x*(x-1);
}
int main()
{
    int T;
    cin>>T;
    for(int i=1; i<=T; i++)
    {
        scanf("%d",&s[i]);
        x[s[i]]++;
    }
    long long sum=0;
   /* for(int i=1; i<=T; i++)
    {
        printf("s[i]=%d\n",fun(x[s[i]])/2);
    }*/
    for(int i=1; i<=T; i++)
    {
        if(y[s[i]]==0&&x[s[i]]!=0)
        {
            sum+=fun(x[s[i]]);
                 y[s[i]]=1;
        }
    }
    /*printf("sum=%d\n",sum);*/
    for(int i=1; i<=T; i++)
    {
        long long h=(fun(x[s[i]])-fun(x[s[i]]-1));
        printf("%lld\n",(sum-h)/2);
    }
    return 0;
}


Measured memory_bytes: 4736
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mp make_pair
#define pb push_back
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)

const int n_max=1e5+2;
vector<pair<int,int> >g[n_max];
set<int> used_num[n_max];
int used_c[n_max];
int ans[n_max];

void dfs(int p, int v){
  queue<int> qu;
  rep(i,g[v].size()){
    if(used_num[v].count(i)==1) continue;
    qu.push(i);
  }
  for(auto i:g[v]){
    int nv=i.first;
    int ind=i.second;
    if(nv==p) continue;
    ans[ind]=qu.front();qu.pop();
    used_num[v].insert(ans[ind]);
    used_num[nv].insert(ans[ind]);
    used_c[v]++;used_c[nv]++;
    dfs(v,nv);
  }
}

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  rep(i,n_max) used_c[i]=0;
  int n;
  cin >> n;
  int a,b;
  rep(i,n-1){
    cin >> a >> b;
    --a;--b;
    g[a].pb(mp(b,i));
    g[b].pb(mp(a,i));
  }
  dfs(-1,0);
  int k=0;
  rep(i,n-1){
    k=max(k,ans[i]+1);
  }
  cout << k << endl;
  rep(i,n-1){
    cout << ans[i]+1 << endl;
  }
  
  return 0;
    

}


Measured memory_bytes: 65408
import sys
stdin = sys.stdin
 
sys.setrecursionlimit(10**5) 
 
def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

n,x = li()

top = [4*pow(2,i) - 3 for i in range(n+1)]
med = [pow(2,i+1) - 1 for i in range(n+1)]
bot = [1 for _ in range(n+1)]

def findPattyNum(level:int, lay: int):
    if level == 0 and lay == 1:
        return 1
    
    if lay == 4*pow(2,level)-3:
        return pow(2,level+1) - 1
    
    elif pow(2,level+1)-1 < lay < 4*pow(2,level)-3:
        return pow(2,level) + findPattyNum(level-1, lay - (pow(2,level+1)-1))
    
    elif lay == pow(2,level+1)-1:
        return pow(2,level)
    
    elif 1 < lay < pow(2,level+1)-1:
        return findPattyNum(level-1, lay-1)
    
    elif lay == 1:
        return 0
    
print(findPattyNum(n,x))

Measured memory_bytes: 3064
def main():
    ary = '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'
    ans = list(map(int, ary.split(', ')))
    a = int(input()) - 1
    print(ans[a])


if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using System.Text;

class Program
{
    static void Main(string[] args)
    {
        // 入力
        long[] abc = Console.ReadLine().Split().Select(long.Parse).ToArray();
        long a = abc[0];
        long b = abc[1];
        long c = abc[2];


        string ans = "No";
        var d = c - a - b;
        if (d > 0 && 4 * a * b < d * d)
        {
            ans = "Yes";
        }
        Console.WriteLine(ans);
    }
}


Measured memory_bytes: 13396
#include <stdio.h>
#define INF 100000000

int n;
int size[100];
int to[100][100];
int cost[100][100];
int dist[100];

void dfs(int p, int c){
  int i;
  dist[p] = c;
  for(i=0;i<size[p];i++){
    if(dist[to[p][i]] > c + cost[p][i]) dfs(to[p][i], c + cost[p][i]);
  }
}

int main(){
  int i, j;
  scanf("%d", &n);

  for(i=0;i<n;i++){
    if(i<n)break;
  }
  
  for(i=0;i<n;i++){
    int u;
    scanf("%d", &u);
    scanf("%d", &size[u]);
    for(j=0;j<size[u];j++){
      scanf("%d", &to[u][j]);
      scanf("%d", &cost[u][j]);
    }
  }
  for(i=0;i<n;i++) dist[i] = INF;
  dfs(0, 0);
  for(i=0;i<n;i++){
    printf("%d %d\n", i, dist[i]);
  }
  return 0;
}



Measured memory_bytes: 2052
#include<iostream>
#include<stdio.h>
using namespace std;
int main()
{
	int n;
	cin>>n;
	if(n%2!=0)
	{
		double a=(double)(n+1)/(2*n);
		printf("%.10f",a);
	}
	else
	{
		double b=0.5;
		printf("%.10f",b);
	}
	
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
ll dp[100005][4];
ll max_points(ll a[],ll b[],ll c[],ll n,int last)
{
    ll ans;
    if(n==0)
    return 0;
    if(dp[n][last]!=-1)
    return dp[n][last];
    if(last==0)
    ans=max(max(max_points(a,b,c,n-1,1)+a[n-1],max_points(a,b,c,n-1,2)+b[n-1]),max_points(a,b,c,n-1,3)+c[n-1]);
    else if(last==1)
    ans=max(max_points(a,b,c,n-1,3)+c[n-1],max_points(a,b,c,n-1,2)+b[n-1]);
    else if(last==2)
    ans=max(max_points(a,b,c,n-1,3)+c[n-1],max_points(a,b,c,n-1,1)+a[n-1]);
    else
    ans=max(max_points(a,b,c,n-1,1)+a[n-1],max_points(a,b,c,n-1,2)+b[n-1]);
    return dp[n][last]=ans;
}
int main()
{
	memset(dp,-1,sizeof(dp));
	ll n,i,a[100005],b[100005],c[100005];
	cin>>n;
	for(i=0;i<n;i++)
	cin>>a[i]>>b[i]>>c[i];
	cout<<max_points(a,b,c,n,0);
	return 0;
}

Measured memory_bytes: 16832
#include <iostream>
#include <limits.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <cassert>

#define REP(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()
#define mp make_pair
#define eb emplace_back

typedef long long ll;
using namespace std;

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

    ll n,k;cin >> n >> k;
    vector<ll> a(n);
    REP(i,n)cin >> a[i];
    vector<ll> cum(n+1,0);
    REP(i,n)cum[i+1] = cum[i] + a[i];

    vector<ll> rng(n-k+1,0);
    REP(i,n-k+1){
        rng[i] = cum[i+k] - cum[i];
    }
    ll mx = 0,mxn = -1;
    REP(i,n-k+1){
        if(rng[i] > mx){
            mx = rng[i],mxn = i;
        }
    }
    double ans = 0;
    for(int i = mxn;i < mxn + k;i++){
        ans += (double)(a[i] + 1)/(double)2;
    }
    cout << fixed << setprecision(20);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 4992
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <vector>

using namespace std;
using ll = long long;

#define all(c) (c).begin(), (c).end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define pb(e) push_back(e)
#define mp(a, b) make_pair(a, b)
#define fr first
#define sc second

const ll INF = 1e9;
const ll MOD = 1e9 + 7;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

int dp[32];
int main() {
    dp[0] = 1;
    dp[1] = 1;
    dp[2] = 2;
    rep(i, 32) {
        if (i - 3 >= 0) {
            dp[i] = dp[i - 1] + dp[i - 2] + dp[i - 3];
        }
    }
    int n;
    while (cin >> n, n) {
        int ans = ceil(dp[n] / 3650);
        cout << ans + 1 << endl;
    }
    return 0;
}

Measured memory_bytes: 3044
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,t,f=0;
	cin>>n;
	while(n!=0)
	{
		t=n%10;
		n/=10;
		if(t==2)
		{
			f++;
		}
	}
	cout<<f;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <functional>
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000
vector<int> enum_div(int n)//nの約数を列挙
{
	vector<int> ret;
	for(int i=1 ; i*i<=n ; ++i)
	{
		if(n%i == 0)
		{
			ret.push_back(i);
			if(i*i!=n)
			{
				ret.push_back(n/i);
			}
		}
	}
	return ret;
}

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, M;
    cin >> N >> M;
    vector<int> v = enum_div(M);
    int ans = 0;
    for(auto& e: v) {
        if(M / e >= N) {
            //cout << M / e << " " << e << endl;
            ans = max(ans, e);
        }
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
using namespace std;

//typedefリスト
typedef vector<int> vint;
typedef vector<string> vstr;

int main(void) {
	int A, B;
	cin >> A >> B;
	cout << A * B - (A + B - 1) << endl;
}

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


int main(){

    int N;
    int M;

    cin >> N;
    cin >> M;
    int ans[M];

    for(int i = 0;i < M;i++){
        ans[i]=0;
    }

    int K;
    int index;
    for(int i = 0;i < N;i++){
        cin >> K;
        for(int ki = 0 ; ki < K; ki++){
            cin >> index;
            index      = index - 1;
            ans[index] = ans [index] + 1;
        }

    }

    int count;
    count = 0;
    for(int i = 0; i < M ; i++){
        if(ans[i]==N){
            count = count + 1;
        }
    }
    cout << count;

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll,string>;
using Map = map<string,ll>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;

int main(){
    ll A;
    cin >> A;
    ll B;
    cin >> B;
    cout<<max(0LL,A-2*B)<<endl;


return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <vector>
//#include <map>

/*
A1 ... An
B1 ... Bn
Ai Bi
min_{A1B1 = ... = AnBn} B_1+ ... +Bn
lcm/A1 + lcm/A2 + ... lcm/An
*/

constexpr int mod = 1000000007;

//std::map<int, int> factors;

int n;
int A[10000];
int B[10000];

int modpow(int x, int n){
  int r = 1;
  for(; n; n>>=1){
    if(n&1) r = (long long) r * x % mod;
    x = (long long) x * x % mod;
  }
  return r;
}

constexpr int maxi = 1000000;

bool sieve[maxi+1];
std::vector<int> primes;
int minv[maxi+1];
int f2;
int exponents[maxi+1];

int main(){
  for(int i = 3; i < maxi; i+=2){
    if(sieve[i]) continue;
    for(int j = 2*i; j <= maxi; j+=i) sieve[j] = true;
    primes.push_back(i);
  }

  minv[1] = 1;
  for(int i = 2; i <= maxi; i++) minv[i] = mod - (long long) minv[mod % i] * (mod / i) % mod;

  scanf("%d", &n);
  for(int i = 0; i < n; i++) scanf("%d", A+i), B[i] = A[i];

  for(int i = 0; i < n; i++){
    int ff2 = __builtin_ctz(B[i]);
    f2 = std::max(f2, ff2);
    B[i] >>= ff2;
    if(!sieve[B[i]]){
      if(exponents[B[i]] == 0) exponents[B[i]] = 1;
      continue;
    }
    for(int p: primes){
      if(p > B[i]) break;
      if(B[i] % p) continue;
      int np = 0;
      do { B[i]/=p; np++; } while(B[i] % p == 0);
      exponents[p] = std::max(exponents[p], np);
    }
  }

  int lcm = 1 << f2;
  for(int i = 3; i <= maxi; i++){
    lcm = (long long) lcm * modpow(i, exponents[i]) % mod;
  }

  long long int ans = 0;
  for(int i = 0; i < n; i++) ans += minv[A[i]];
  ans %= mod;


  printf("%d\n", (int) ((long long)lcm*ans%mod));

  return 0;
}


Measured memory_bytes: 9208
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string S_1, S_2, S_3;
  
  // ここにプログラムを追記
  cin >> S_1 >> S_2 >> S_3;
  
  cout << "A" << S_2.at(0) << "C" << endl;
}

Measured memory_bytes: 256
def main():
    nvertices, nedges = map(int, input().split())
    indegrees = [0 for i in range(nvertices)]
    adj = [[] for i in range(nvertices)]
    for i in range(nedges):
        s, t = map(int, input().split())
        adj[s].append(t)
        indegrees[t] += 1

    S = []
    for i in range(nvertices):
        if indegrees[i] == 0:
            S.append(i)
    ordering = []
    while S:
        u = S.pop(0)
        ordering.append(u)
        for v in adj[u]:
            indegrees[v] -= 1
            if indegrees[v] == 0:
                S.append(v)

    for v in ordering:
        print(v)


main()

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

vector<int> S;

int partition(vector<int>& A, int p, int r) {
    int x = A[r];
    int i = p - 1;
    for (int j=p; j<r; j++) {
        if (A[j] <= x) {
            i++;
            int temp = A[i];
            A[i] = A[j];
            A[j] = temp;
        }
    }
    int temp = A[i+1];
    A[i+1] = A[r];
    A[r] = temp;
    return i+1;
}

int main() {
    int n;
    cin >> n;
    int i;
    rep(i, n) {
        int input;
        cin >> input;
        S.push_back(input);
    }

    int idx = partition(S, 0, n-1);
    rep(i, n-1) {
        if (i == idx) {
            cout << "[" << S[i] << "] ";
        } else {
            cout << S[i] << " ";
        }
    }
    cout << S[n-1] << endl;

    return 0;
}



Measured memory_bytes: 3488
#include<stdio.h>
int main(void){
    int n,x;
    scanf("%d",&n);
    for (int i = 1; i <= n; i++)
    {
        x=i;
        if (x%3==0)printf(" %d",i);
        else {
            do{   
                if (x%10==3){printf(" %d",i); break;}
                x/=10;
            } while (x);
        }
    }printf("\n");
    
    return 0;
}


Measured memory_bytes: 2032
import sys

sys.setrecursionlimit(1000000)


def solve(N, K):
    M = 10 ** 9 + 7
    pre = []
    post = []
    s = 0
    for i in range(N + 1):
        s += i
        pre.append(s)

    s = 0
    for i in range(N, -1, -1):
        s += i
        post.append(s)
    post = post[::-1]

    ans = 0
    for i in range(K, N + 2):
        a = post[N + 1 - i] - pre[i - 1] + 1
        ans += a
        ans %= M
    return ans


if __name__ == "__main__":
    N, K = tuple(map(int, input().split(" ")))
    print(solve(N, K))


Measured memory_bytes: 31704
import java.util.*


fun main(args: Array<String>) {
    val scanner = Scanner(System.`in`)
    val a = scanner.nextInt()
    val b = scanner.nextInt()
    val c = scanner.nextInt()

    println(
        if (a + b + c >= 22) {
            "bust"
        } else {
            "win"
        }
    )
}

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

#define rep(i,z) for(int i = 0; i<(int)(z); i++)
#define rep1(i,z) for(int i = 1; i<=(int)(z); i++)
 
using namespace std;

typedef long long ll;
const ll MOD=1e9+7;
using pear = pair<int,int>;

int main(){
  int n, ans=0; cin>>n;
  string s; cin>>s;
  int i=0,j=n-1;
  while(i<j){
      while(i<n&&s[i]!='W') i++;
      while(j>-1&&s[j]!='R') j--;
      if(i>=j) break;
      s[i]='R';s[j]='W';
      ans++;
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 3696
#include <iostream>

using namespace std;

int main(void){
    int N, K;
    int x = 0;
    
    cin >> N >> K;
    
    for (int i = 0; i < N; i++)
    {
        int h;
        cin >> h;
        if (K <= h) {
            x++;
        }
    }
    cout << x;
}


Measured memory_bytes: 3640
(let* ((n (read))
       (ai (loop repeat n
                 collect (read))))
  (labels ((f (list n acc)
             (if list
                 (if (= (first list) n)
                     (f (cddr list) (+ n 2) (1+ acc))
                     (f (cdr list) (1+ n) acc))
                 acc)))
    (format t "~A~%" (f ai 1 0))))

Measured memory_bytes: 59752
#include<string>
#include<string.h>
#include<map>
#include<set>
#include<vector>
#include<stdio.h>
#include<math.h>
#include<iostream>
#include<algorithm>
#include<queue>


using namespace std;


int main()
{
    int n;
    cin>>n;
    cout<<(n*800)-((n/15)*200);
        system("pause");
    return 0;
}     

Measured memory_bytes: 504
#include <stdio.h>

int main(){
        int N, K, h, cnt = 0;
        int i;

        scanf("%d %d", &N, &K);
        for(i = 0; i < N; i++) {
                scanf("%d", &h);
                if(h >= K) cnt++;
        }

        printf("%d\n", cnt);
        return 0;
}

Measured memory_bytes: 128
from fractions import gcd

def lcm(x, y):
    return (x * y) // gcd(x, y)

A,B,C,D=map(int, raw_input().split())

C_cnt=B/C-(A-1)/C
D_cnt=B/D-(A-1)/D
CD_cnt=B/lcm(C,D)-(A-1)/lcm(C,D)

print (B-A+1)-C_cnt-D_cnt+CD_cnt


Measured memory_bytes: 34664
N, M, Q = map(int, input().split())
LR = [[0] * (N + 1) for _ in range(N + 1)]

for i in range(M):
    L, R = map(int, input().split())
    LR[L][R] += 1

S = [[0] * (N + 1) for _ in range(N + 1)]
for l in range(N+1):
    for r in range(1, N+1):
        S[l][r] = LR[l][r] + S[l-1][r] + S[l][r-1] - S[l-1][r-1]

for i in range(Q):
    p, q = map(int, input().split())
    ans = S[q][q] - S[p-1][q] - S[q][p-1] + S[p-1][p-1]
    print(ans)

Measured memory_bytes: 58840
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<climits>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
#include<numeric>
#include<map>
#include<set>
#include<bitset>
using namespace std;
#define REP(i,m,n) for(int i = m; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a)  (a).rbegin(),(a).rend()
#define dup(x,y) (((x)+(y)-1) / (y)); //整数型のまま切り上げ演算する
#define PI 3.14159265359
typedef long long LL;
template<class T> inline void chmax(T& a, T b) { if (a < b) { a = b; } }
template<class T> inline void chmin(T& a, T b) { if (a > b) { a = b; } }
template<class T> inline T gcd(T x, T y) { if (y == 0) { return x; } else if (x == 0) { return y; }return gcd(y, x % y); }
template<class T> inline T lcm(T x, T y) { return (x * y) / find_greatest_common_divisor(x, y); }
template<class T> void print_vector(vector<T> vec) { for (int i = 0; i < vec.size(); i++) { cout << vec[i] << " "; } }
const LL MOD = 1e9 + 7;
const LL INF = 1LL << 60;

vector<LL> dp(100010, -1);
vector<vector<LL> > G(100010);

/*
全体の方針

i番目のノードから出発する時の最長経路はどうなるかを考えてループをN回回す。
出発点となるノードの番号をメモ化再帰の関数に投げてdpテーブルを更新する。
再帰の枝分かれが多くなるが、dpが更新されているノードにたどり着いた場合、その先に最長でどれだけ進むことができるのかはもうdpテーブルに保存されているので、
そこで探索を打ち切ってdpテーブルに保存されている値を返せばよい。
一度値が確定したノードは二度と更新しなくてよいので結果的にオーダーはNとなる（はず）。
*/

LL memorization_recursive(LL v) {
	if (dp[v] != -1) {//更新済み
		return dp[v];
	}

	LL path_length = 0;
	for (LL nv:G[v]) {
		chmax(path_length, memorization_recursive(nv) + 1);//再帰が進むごとに移動距離が増えるように実装
	}
	return dp[v] = path_length;//メモしながらリターン
}


int main(void) {
	LL N, M;
	cin >> N >> M;

	for (LL i = 0; i < M; i++) {
		LL x, y;
		cin >> x >> y;
		G[x].push_back(y);
	}
	
	LL ans = 0;
	for (LL v = 1; v <= N; v++) {
		chmax(ans, memorization_recursive(v));
	}

	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 8576
#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<bitset>
#include<queue>
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) FOR(i,0,n)
typedef long long ll;
int main(){
	double x;
	cin >> x;

	cout << (ll)ceil((-1.0 + sqrt(1.0 + 8.0 * x))/2.0) << endl;
	}


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

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
vl A;
vl T;
ll solve(int bg, int en,vl &A){
	if(en-bg<=1)return 0;
	int cnt =(bg+en)/2;
	ll ans=0;
	ans += solve(bg,cnt,A);
	ans += solve(cnt,en,A);
	for(int i=bg;i<en;i++){
		T[i] = A[i];
	}
	ll lat=0;
	int p1 = bg;
	int p2 = cnt;
	for(int i=bg;i<en;i++){
		if(p1!=cnt &&( p2==en || T[p1] <= T[p2])){
			A[i] = T[p1];
			p1++;
			ans+= lat;
		}else{
			A[i] = T[p2];
			p2++;
			lat++;
		}
	}
	return ans;
}
int main(){
	int n;
	cin>>n;
	A.resize(n);
	T.resize(n);
	for(int i=0;i<n;i++){
		cin>>A[i];
	}
	cout<<solve(0,n,A)<<endl;
	return 0;
}

Measured memory_bytes: 5996
import sys
input=sys.stdin.readline
n,a,b,c=map(int,input().split())
s=[]
for i in range(n):
    sub=input().rstrip()
    s.append(sub)
if a+b+c==0:
    print('No')
    sys.exit()
if a+b+c==1:
    com=[]
    for i in s:
        if i=='AB':
            if a==0 and b==0:
                print('No')
                sys.exit()
            else:
                if a>b:
                    com.append('B')
                else:
                    com.append('A')
                a,b=b,a
        elif i=='AC':
            if a==0 and c==0:
                print('No')
                sys.exit()
            else:
                if a>c:
                    com.append('C')
                else:
                    com.append('A')
                a,c=c,a
        elif i=='BC':
            if b==0 and c==0:
                print('No')
                sys.exit()
            else:
                if b>c:
                    com.append('C')
                else:
                    com.append('B')
                b,c=c,b
    print('Yes')
    for i in com:
        print(i)
    sys.exit()
if (s[0]=='AB' and a**2+b**2==0) or (s[0]=='AC' and a**2+c**2==0) or (s[0]=='BC' and c**2+b**2==0):
    print('No')
else:
    print('Yes')
    for i in range(n):
        check=True
        if s[i]=='AB':
            at=a+1
            bt=b-1
            ct=c
            if bt<0:
                check=False
            if i<n-1:
                if (s[i+1]=='AB' and at**2+bt**2==0) or (s[i+1]=='AC' and at**2+ct**2==0) or (s[i+1]=='BC' and ct**2+bt**2==0):
                    check=False
            if check:
                a,b,c=at,bt,ct
                print('A')
            else:
                a-=1
                b+=1
                print('B')
        elif s[i]=='AC':
            at=a+1
            bt=b
            ct=c-1
            if ct<0:
                check=False
            if i<n-1:
                if (s[i+1]=='AB' and at**2+bt**2==0) or (s[i+1]=='AC' and at**2+ct**2==0) or (s[i+1]=='BC' and ct**2+bt**2==0):
                    check=False
            if check:
                a,b,c=at,bt,ct
                print('A')
            else:
                a-=1
                c+=1
                print('C')
        elif s[i]=='BC':
            at=a
            bt=b+1
            ct=c-1
            if ct<0:
                check=False
            if i<n-1:
                if (s[i+1]=='AB' and at**2+bt**2==0) or (s[i+1]=='AC' and at**2+ct**2==0) or (s[i+1]=='BC' and ct**2+bt**2==0):
                    check=False
            if check:
                a,b,c=at,bt,ct
                print('B')
            else:
                b-=1
                c+=1
                print('C')




Measured memory_bytes: 81260
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<vector>
#define MAXN 100000
using namespace std;
struct node
{
	int to;
	node *nxt;
}edges[MAXN*2+5];
node *ncnt=&edges[0],*Adj[MAXN+5];
int n,m;
bool vis[MAXN+5];
vector<int> ans;
void AddEdge(int u,int v)
{
	node *p=++ncnt;
	p->to=v;
	p->nxt=Adj[u];
	Adj[u]=p;
	
	node *q=++ncnt;
	q->to=u;
	q->nxt=Adj[v];
	Adj[v]=q;
}
void DFS1(int u)
{
	vis[u]=true;
	for(node *p=Adj[u];p!=NULL;p=p->nxt)
	{
		int v=p->to;
		if(vis[v]==true)
			continue;
		DFS1(v);
		break;
	}
	ans.push_back(u);
}
void DFS2(int u)
{
	vis[u]=true;
	ans.push_back(u);
	for(node *p=Adj[u];p!=NULL;p=p->nxt)
	{
		int v=p->to;
		if(vis[v]==true)
			continue;
		DFS2(v);
		break;
	}
}
int main()
{
//	freopen("path.in","r",stdin);
//	freopen("path.out","w",stdout);
	scanf("%d %d",&n,&m);
	int u,v;
	for(int i=1;i<=m;i++)
	{
		scanf("%d %d",&u,&v);
		AddEdge(u,v);
	}
	vis[1]=true;
	int cnt=0;
	for(node *p=Adj[1];p!=NULL;p=p->nxt)
	{
		int v=p->to;
		if(cnt>=2)
			break;
		if(vis[v]==false)
		{
			if(cnt==0)
			{
				DFS1(v),cnt++;
				ans.push_back(1);
			}
			else
				DFS2(v),cnt++;
		}
	}
	printf("%d\n",(int)ans.size());
	for(int i=0;i<(int)ans.size();i++)
	{
		if(i==0)
			printf("%d",ans[i]);
		else
			printf(" %d",ans[i]);
	}
	printf("\n");
	return 0;
}

Measured memory_bytes: 7928
#include<iostream>
#include<string>
#include<algorithm>    
#include<cmath>
#include<map>
#include<vector>
#include<math.h>
#include<stdio.h>
#include<stack>
#include<queue>
#include<tuple>
#include<cassert>
#include<set>
#define int long long
#define mod(int)(1000000007)
using namespace std;
int test[213456];
char maze[213][213];
signed main() {
	int n, m, ans = 0; cin >> n >> m;
	char a;
	for (int h = 1; h <= n; h++) {
		for (int i = 1; i <= m; i++) {
			cin >> a; maze[h][i] = a;
		}
	}
	for (int h = 1; h <= n; h++) {
		int count = 0;
		for (int i = 1; i <= m; i++) {
			if (maze[h][i] == '.') { count++; }
		}
		if (count == m) {
			for (int j = h + 1; j <= n; j++) {
				for (int k = 1; k <= m; k++) {
					maze[j - 1][k] = maze[j][k];
				}
			}
			n--; h--;
		}
	}
	for (int h = 1; h <= m; h++) {
		int count = 0;
		for (int i = 1; i <= n; i++) {
			if (maze[i][h] == '.') { count++; }
		}
		if (count == n) {
			for (int j = 1; j <= n; j++) {
				for (int k = h + 1; k <= m; k++) {
					maze[j][k - 1] = maze[j][k];
				}
			}
			m--; h--;
		}
	}
	for (int h = 1; h <= n; h++) {
		for (int i = 1; i <= m; i++) {
			cout << maze[h][i];
		}
		cout << endl;
	}
}

Measured memory_bytes: 256
#include <iostream>
#include <string.h> 
#include <stack>
#include <sstream>
#include <stdlib.h>

using namespace std ;

int main()
{stack<float>stack;
  int i;
  float num,result,first,second;  
  char op,ch;
  string str,str1;

  while(getline(cin,str)){
    istringstream is(str); 
    for(;is>>str1;){
      if(str1.compare("+")==0){

	first=stack.top();
	stack.pop();
	second=stack.top();
	stack.pop();
	stack.push(first+second);

      }else if(str1.compare("-")==0){

	first=stack.top();
	stack.pop();
	second=stack.top();
	stack.pop();
	stack.push(second-first);

      }else if(str1.compare("*")==0){

	first=stack.top();
	stack.pop();
	second=stack.top();
	stack.pop();
	stack.push(first*second);

      }else{
	stack.push(strtof(str1.c_str(),NULL));              
      }
    }
    cout<<stack.top()<<'\n';
  } 
}



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

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            string[] original_A = Console.ReadLine().Split();
            int[] A = original_A.Select(int.Parse).ToArray();
            int[] Even_number = A.Where(x => x % 2 == 0).ToArray();
            int count = 0;
            foreach(int a in Even_number)
            {
                if(a % 3 !=0 && a % 5 != 0)
                {
                    count++;
                }
            }
            if(count > 0)
            {
                Console.WriteLine("DENIED");
            }
            else
            {
                Console.WriteLine("APPROVED");
            }
            Console.Read();
        }
    }
}

Measured memory_bytes: 13396
import java.util.Scanner

val sc = Scanner(System.`in`)
val n = sc.nextInt()
val t = sc.nextInt()
val a = sc.nextInt()

fun main(args: Array<String>) {
    var tmp: Double = 0.0
    var result = 0
    for (i in 0 until n) {
        val heikin = (t - sc.nextInt()*0.006)
        if (i == 0 || tmp > Math.abs(heikin - a)) {
            tmp = Math.abs(heikin - a)
            result = i+1
        }
    }
    println(result)
}

Measured memory_bytes: 31392
#include<bits/stdc++.h>
using namespace std;
int const nax = 5010;
int k , q, md;
int oldD[nax];
int d[nax];

int n, x;


int query () {
    scanf("%d %d %d", &n, &x, &md);
    x %= md;
    for (int i = 0 ; i < k ; ++ i)
        d[i] = oldD[i] % md;
    long long zero = 0 ;
    long long sum = 0;
    for (int i = 0 ; i < k ; ++ i) {
        if (d[i] == 0) zero ++ ;
        sum += d[i];
    }
    -- n;
    int blockNum = n / k;
    long long last = sum * blockNum ;
    zero *= (long long)blockNum;
    int res = n % k;
    for (int i = 0 ; i < res ; ++ i) {
           if (d[i] == 0 ) zero ++ ;
           last += d[i];
    }
    last += x;
    long long pass = (last / md ) - ((x - 1)/ md);
    printf("%lld\n", n - pass - zero);
}

int main () {
    scanf("%d %d", &k, &q);
    for (int i = 0 ; i < k ; ++ i) {
        scanf("%d", oldD + i);
    }
    while (q --) {
         query() ;
    }
}
/*
    Good Luck
        -Lucina
*/


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod = 1000000007;

int main()
{
  int H; cin >> H;
  int W; cin >> W;
  int K; cin >> K;

  vector<int> fib(W, 0);
  fib[0] = fib[1] = 1;
  for (int i=2; i<W; i++) {
    fib[i] = fib[i-1] + fib[i-2];
  }

  vector<vector<ll>> dp(H+1, vector<ll>(W, 0));
  dp[0][0] = 1;

  for (int i=0; i<H; i++) {
    for (int j=0; j<W; j++) {
      ll a = fib[max(0, j-1)] * fib[max(0, W-j-1)];
      ll b = fib[max(0, j)] * fib[max(0, W-j-1)];
      ll c = fib[max(0, j)] * fib[max(0, W-j-2)];
      dp[i+1][j] += (b * dp[i][j])%mod;
      if (j>0) dp[i+1][j] += (a * dp[i][j-1])%mod;
      if (j<W-1) dp[i+1][j] += (c * dp[i][j+1])%mod;
      dp[i+1][j] = dp[i+1][j] % mod;
    }
  }
  cout << dp[H][K-1] << endl;

  return 0;
}


Measured memory_bytes: 256