akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>

using namespace std;

class Node {
public:
    Node(int key, Node* parent = nullptr) : key_(key), parent_(parent), leftChild_(nullptr), rightChild_(nullptr) {}
    void insert(int key) {
        Node* y = nullptr;  // x の親
        Node* x = this;
        while (x != nullptr) {
            y = x;  // 親を設定
            if (key < x->key_) {
                x = x->leftChild_;  // 左の子へ移動
            }
            else {
                x = x->rightChild_; // 右の子へ移動
            }
        }
        Node* z = new Node(key, this);
        if (key < y->key_) {
            y->leftChild_ = z;
        }
        else {
            y->rightChild_ = z;
        }
    }
    void printInorder() {
        if (leftChild_ != nullptr) {
            leftChild_->printInorder();
        }
        cout << " " << key_;
        if (rightChild_ != nullptr) {
            rightChild_->printInorder();
        }
    }
    void printPreorder() {
        cout << " " << key_;
        if (leftChild_ != nullptr) {
            leftChild_->printPreorder();
        }
        if (rightChild_ != nullptr) {
            rightChild_->printPreorder();
        }
    }
private:
    int key_;
    Node* parent_;
    Node* leftChild_;
    Node* rightChild_;
};

class Tree {
public:
    Tree() : root_(nullptr) {}
    void insert(int key) {
        if (root_ != nullptr) {
            root_->insert(key);
        }
        else {
            root_ = new Node(key);
        }
    }
    void print() {
        if (root_ != nullptr) {
            root_->printInorder();
            cout << endl;
            root_->printPreorder();
            cout << endl;
        }
    }
private:
    Node* root_;
};

int main()
{
    int n;
    cin >> n;
    string operation;
    Tree tree;
    for (int i = 0; i < n; ++i) {
        cin >> operation;
        if (operation == "insert") {
            int x;
            cin >> x;
            tree.insert(x);
        }
        else {
            tree.print();
        }

    }
}



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

namespace Practice
{
    class Program
    {
        static void Main(string[] args)
        {
            Solve();
        }
        private const int MOD = 1000000007;
        static void Solve()
        {
            var nk = ReadAndParseIntArr();
            int n = nk[0];
            int k = nk[1];
            var h = ReadAndParseIntArr();
            int[] dp = new int[n + 1];

            for(int i=1;i<n;++i)
            {
                int curMin = int.MaxValue;
                for(int j=1;j<=k;++j)
                {
                    if( i - j >= 0)
                    {
                        int curdp = dp[i - j] + Math.Abs(h[i] - h[i - j]);
                        curMin = Math.Min(curMin, curdp);
                    }
                }
                dp[i] = curMin;
            }
            int ans = dp[n - 1];
            Console.WriteLine(ans);
        }
        #region よく使う便利関数
        private static bool isPrime(long x)
        {
            if (x == 2) { return true; }
            if (x < 2 || x % 2 == 0) { return false; }
            long i = 3;
            while (i * i <= x)
            {
                if (x % i == 0) { return false; }
                i = i + 2;
            }
            return true;
        }
        private static long lcm(long x, long y)
        {
            return x / gcd(x, y) * y;
        }
        private static long gcd(long x, long y)
        {
            return y > 0 ? gcd(y, x % y) : x;
        }
        private static long pow(long x, long n)
        {
            if (n == 0) { return 1; }
            long res = pow(x * x % MOD, n / 2);
            if (n % 2 == 1)
            {
                res = res * x % MOD;
            }
            return res;
        }
        private static int ReadAndParseInt()
        {
            return int.Parse(Console.ReadLine());
        }
        private static int[] ReadAndParseIntArr()
        {
            return Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
        }
        private static long ReadAndParseLong()
        {
            return long.Parse(Console.ReadLine());
        }
        private static long[] ReadAndParseLongArr()
        {
            return Array.ConvertAll(Console.ReadLine().Split(' '), long.Parse);
        }
        #endregion
    }
}

Measured memory_bytes: 19296
using System;
using System.Collections.Generic;
using System.Text;
using System.Numerics;

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

            int N = int.Parse(strs[0]);
            int X = int.Parse(strs[1]);

            int ans = 1;
            int dist = 0;

            strs = Console.ReadLine().Split(' ');

            for (int i = 0; i < strs.Length; i++)
            {
                dist += int.Parse(strs[i]);

                if ( dist > X)
                {
                    break;
                }

                ans++;
            }

            Console.WriteLine(ans);
        }
    }
}


Measured memory_bytes: 13140
#include <stdio.h>
#include <stdlib.h>

int like[30] = {0};

int main()
{
    int n_person = 0;
    int m_food = 0;
    int likes = 0;
    int i = 0;
    int j = 0;
    int temp = 0;
    int count = 0;
    scanf("%d %d", &n_person, &m_food);

    for(i = 0; i < n_person; i++) {
    	scanf("%d", &likes);
    	for(j = 0; j < likes; j++) {
    		scanf("%d", &temp);
    		like[temp-1]++;
    	}
    }

    for(i = 0; i < m_food; i++) {
    	if(like[i] == n_person) {
    		count++;
    	}
    }
    printf("%d",count);
	return 0;
}


Measured memory_bytes: 128
#include<stdio.h>
#define L 100005

typedef struct{
  char pname[100];
  int time;
}EQ;

EQ eq[L];
int head, tail,n;

void enqueue(EQ a){
  eq[tail]=a;
  tail=(tail+1)%L;
}

EQ dequeue(){
  EQ a=eq[head];
  head=(head+1)%L;
  return a;
}

int minjudge(int a,int b){
  if(a<b){return a;}
  else{return b;}
}

int main(){

  int sumtime=0,add;
  int i,q;
  EQ ch;
  scanf("%d %d",&n,&q);
  for(i=1;i<=n;i++){
    scanf("%s%d",eq[i].pname,&eq[i].time);
  }
  head=1;
  tail=n+1;

  while(head!=tail){
    ch=dequeue();
    add=minjudge(q,ch.time);
    ch.time-=add;
    sumtime+=add;
    if(ch.time>0)enqueue(ch);
    else{printf("%s %d\n",ch.pname,sumtime);}
  }
  return 0;
}




  




Measured memory_bytes: 11864
#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll gcd(ll a,ll b){
  if(a==0)return b;
  else return gcd(b%a,a);
}

int main() 
{
    ll a,b,c,d,lcm,p;
    cin >> a >> b >> c >> d;
    lcm=c*d/gcd(c,d);
    p=(b/c-(a-1)/c)+(b/d-(a-1)/d)-(b/lcm-(a-1)/lcm);
    cout << b-a+1-p;
    return 0;
}

Measured memory_bytes: 256
n,m=map(int,input().split())
ka=[]
for i in range(n):
    ka.append(list(map(int,input().split())))
tmp=[0]*m
for i in range(n):
    for j in range(ka[i][0]):
        tmp[ka[i][j+1]-1]+=1
ans=0
for i in range(m):
    if tmp[i]==n:
        ans+=1
print(ans)

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

string rotate(string s){
    string ans = "";
    for(int i=1; i<s.size(); i++){
        ans += s[i];
    }
    return ans + s[0];
}

signed main(){
    // cout << fixed << setprecision(10) << flush;

    string s, t;
    cin >> s >> t;
    for(int i=0; i<=s.size(); i++){
        if(s == t){
            cout << "Yes" << endl;
            return 0;
        }
        else{
            s = rotate(s);
        }
    }    

    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 3628
#include<stdio.h>
int main(){
  long long n,i,j,d[4010]={1},M=1e9+7;
  scanf("%lld",&n);
  for(i=0;i<n;i++){
    for(j=3;j<=n;j++)d[i+j]=(d[i+j]+d[i])%M;
  }
  printf("%lld\n",d[n]);
  return 0;
}


Measured memory_bytes: 1764
#include <bits/stdc++.h>
 
#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)
 
#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=(int)(a)-1;i>=(int)(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)
 
#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define bit(n) (1LL<<(n))
 
// #define DEBUG
 
#ifdef DEBUG
    #define dump(...) fprintf(stderr, __VA_ARGS__)
#else
    #define dump(...)
#endif
 
template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}
 
using namespace std;
using ll=long long;
using vi=vector<int>;
using vll=vector<ll>;
 
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int inf = INT_MAX;
const ll INF = LLONG_MAX;
const ll MOD = 1000000007LL;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
 
ll extgcd(ll a,ll b,ll& x,ll& y){x=1,y=0;ll g=a;if(b!=0) g=extgcd(b,a%b,y,x),y-=a/b*x;return g;}
ll ADD(const ll &a, const ll &b, const ll mod=MOD) { return (a+b)%mod;}
ll SUB(const ll &a, const ll &b, const ll mod=MOD) { return (a-b+mod)%mod;}
ll MUL(const ll &a, const ll &b, const ll mod=MOD) { return (1LL*a*b)%mod;}
ll DIV(const ll &a, const ll &b, const ll mod=MOD) {ll x,y; extgcd(b,mod,x,y);return MUL(a,(x+mod)%mod,mod);}
 
int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);

    int X, Y, Z; cin >> X >> Y >> Z;
    cout << (X - Z) / (Y + Z) << endl;

    return 0;
}


Measured memory_bytes: 256
/// Rustで競技プログラミングの入力をスッキリ記述するマクロ
///
/// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

#[inline]
#[allow(dead_code)]
fn gcd(mut m: u64, mut n: u64) -> u64 {
    if m < n {
        std::mem::swap(&mut m, &mut n);
    }

    loop {
        let k = m % n;
        if k == 0 {
            return n;
        }

        m = n;
        n = k;
    }
}

#[inline]
#[allow(dead_code)]
fn lcm(m: u64, n: u64) -> u64 {
    m / gcd(m, n) * n
}

macro_rules! eprint(
    ($($arg:tt)*) => { {
        use std::io::Write;
        let r = write!(&mut ::std::io::stderr(), $($arg)*);
        r.expect("failed printing to stderr");
    } }
);

macro_rules! eprintln(
    ($($arg:tt)*) => { {
        use std::io::Write;
        let r = writeln!(&mut ::std::io::stderr(), $($arg)*);
        r.expect("failed printing to stderr");
    } }
);

macro_rules! dbg {
    ($val:expr) => {
        // Use of `match` here is intentional because it affects the lifetimes
        // of temporaries - https://stackoverflow.com/a/48732525/1063961
        match $val {
            tmp => {
                eprintln!("[{}:{}] {} = {:#?}",
                          file!(), line!(), stringify!($val), &tmp);
                tmp
            }
        }
    }
}

fn main() {
    input!{
        s: chars,
    }

    let mut score = 0i64;
    let mut g_count = 0;
    for c in s {
        if g_count == 0 {
            // グーを出すしかない
            g_count += 1;

            if c == 'p' {
                score -= 1;
            }
        } else {
            // パーを出す
            g_count -= 1;
            if c == 'g' {
                score += 1;
            }
        }
    }

    println!("{}", score);
}


Measured memory_bytes: 4352
#!usr/bin/env python3
from collections import defaultdict
from heapq import heappush, heappop
import sys
import math
import bisect
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return list(sys.stdin.readline())
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
mod = 1000000007

#A

a = IR(2)
b = IR(2)
print(min(a)+min(b))

Measured memory_bytes: 3436
#include <bits/stdc++.h>
using namespace std;
bool ok[505];
string s[505];
int main()
{
	int n,ans=1e9;
	cin >> n;
	for (int i=0;i<n;i++)
	{
		cin >> s[i];
		for (int j=0;j<n;j++)
		{
			if (s[i][j]=='#')
			ok[j]=1;
		}
	}
	if (!count(ok,ok+n,1))
	{
		printf("-1");
		return 0;
	}
	for (int i=0;i<n;i++)
	ans=min(ans,n-(int)count(s[i].begin(),s[i].end(),'#')+!ok[i]);
	for (int i=0;i<n;i++)
	{
		int cnt=0;
		for (int j=0;j<n;j++)
		cnt+=(s[j][i]=='#');
		ans+=(cnt!=n);
	}
	printf("%d",ans);
}

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

int main() {
  int N, x;
  cin >> N >> x;
  vector<int> a(N);
  for (int i = 0; i < N; i++) cin >> a[i];
  sort(a.begin(), a.end());
  int ans = 0;
  for (int i = 0; i < N; i++) {
    if (i == N - 1) {
      if (a[i] == x) ans++;
    } else if (a[i] <= x) {
      ans++;
      x -= a[i];
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
x = int(input())
ans = 0
while True:
    i = 2
    while i < 11:
#        print(round(x**(1/i),1),round((x**(1/i)),8))
        if round(x**(1/i),1)==round((x**(1/i)),8):
            ans = x
            break
        i += 1
    if ans != 0:
        break
    x -= 1
#    print(x)
print(ans)

Measured memory_bytes: 3060
#include "bits/stdc++.h"
using namespace std;
#define FOR(i,a,b) for(int i =(a);i<(b);i++)
#define REP(i,n) for(int i=0;i<(n);i++)
#define REPm(i,n) for(int i=(n)-1;i>=0;i--)
#define REP1(i,n) for(int i=1;i<=(n);i++)
typedef long long ll;
int main(){
    int H,W;
    int c = 0;
    cin >> H >> W;
    REP(i,H){
        string A;
        cin >> A;
        REP(j,W){
            if(A[j] == '#') c++;
        }
    }
    if(H+W-1 == c) cout << "Possible" << endl;
    else cout << "Impossible" << endl;
    return 0;
}


Measured memory_bytes: 256
/*http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_3_A&lang=jp*/
#include <iostream>
#include <stack>
#include <stdexcept>

using namespace std;

int calc(stack<string> *s){
    string opr = (*s).top();
    (*s).pop();
    int opt[2];
    for (int j = 0; j < 2; j++) {
        try {
            opt[j] = stoi((*s).top());
        }catch(invalid_argument e){
            opt[j] = calc(s);
        }
        (*s).pop();
    }
    if (opr == "+") {
        (*s).push(to_string(opt[1] + opt[0]));
    } else if (opr == "-") {
        (*s).push(to_string(opt[1] - opt[0]));
    } else if (opr == "*") {
        (*s).push(to_string(opt[1] * opt[0]));
    } else if (opr == "/") {
        (*s).push(to_string(opt[1] / opt[0]));
    }
    return stoi((*s).top());
}

int main(){
    stack<string> s;
    while(cin.peek()!='\n'){
        string i;
        cin >> i;
        s.push(i);
    }
    cout<<calc(&s)<<endl;
    return 0;
}

Measured memory_bytes: 1388
import java.util.Arrays;
import java.util.Scanner;

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

        int N = sc.nextInt();
        int A = sc.nextInt();
        int B = sc.nextInt();
        int[] h = new int[N];
        for (int i = 0; i < h.length; ++i) {
            h[i] = sc.nextInt();
        }

        System.out.println(solve(h, A, B));

        sc.close();
    }

    static int solve(int[] h, int A, int B) {
        int result = -1;
        int lower = 1;
        int upper = Arrays.stream(h).max().getAsInt();
        while (lower <= upper) {
            int middle = (lower + upper) / 2;

            if (check(h, A, B, middle)) {
                result = middle;
                upper = middle - 1;
            } else {
                lower = middle + 1;
            }
        }

        return result;
    }

    static boolean check(int[] h, int A, int B, int round) {
        return Arrays.stream(h).mapToLong(hi -> divideToCeil(Math.max(0, hi - (long) B * round), A - B)).sum() <= round;
    }

    static long divideToCeil(long x, long y) {
        return (x + y - 1) / y;
    }
}

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

#define rep(i,n) for(int i=0; i<(n); i++)
#define reps(i,x,n) for(int i=x; i<(n); i++)
#define rrep(i,n) for(int i=(n)-1; i>=0; i--)
#define all(X) (X).begin(),(X).end()
#define X first
#define Y second
#define pb push_back
#define eb emplace_back

using namespace std;
typedef long long int ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

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

template<class A, size_t N, class T> void Fill(A (&a)[N], const T &v){ fill( (T*)a, (T*)(a+N), v ); }

template<class T> ostream& operator<<(ostream &os, const vector<T> &t) {os<<"{"; rep(i,t.size()) {os<<t[i]<<",";} os<<"}"; return os;}
template<class T,size_t n> ostream& operator<<(ostream &os, const array<T,n> &t) {os<<"{"; rep(i,n) {os<<t[i]<<",";} os<<"}"; return os;}
template<class S, class T> ostream& operator<<(ostream &os, const pair<S,T> &t) { return os<<"("<<t.first<<","<<t.second<<")";}

const ll INF = 1e9+7;


int main(){
	ios_base::sync_with_stdio(false);
	int N, K;
	string S;

	cin >> N >> K;
	cin >> S;

	int count = 0, pos = N;
	bool flip = false;
	rep(i,N){
		if( S[i] == (i%2 ? 'B' : 'A') ) count++;
		if( count == K ){
			pos = i;
			flip = true;
			break;
		}
		count++;
		if( count == K ){
			pos = i+1;
			break;
		}
	}
	if( K - count > 0 ){
		if( N % 2 == 1 && (K - count) % 2 == 1 ) flip = true;
	}

	//cout << pos << " " << flip << endl;

	auto ans = S.substr(pos);
	if( pos%2 ) for(auto &&c: ans) c = (c == 'A' ? 'B' : 'A');
	while( ans.length() < N ) ans += ((N - ans.length()) % 2 ? 'A' : 'B');
	if( flip ) ans[0] = (ans[0] == 'A' ? 'B' : 'A');

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 1048
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, c) for (int i = 0; i < (int)c; i++)
#define all(v) v.begin(), v.end()
const int inf = 1000000000; //10^9
using ll = long long;
using P = pair<int, int>;
//加算代入演算子は+=！！！！！
//int 2^31 10^9まで
int main()
{
    ll n, count = 0, ans = 1;
    cin >> n;
    vector<ll> vec(n);
    rep(i, n) cin >> vec.at(i);
    sort(vec.begin(), vec.end());
    bool can = true;
    rep(i, n - 1)
    {
        if (n % 2 != 0 && vec[i] == 0 && vec[i] == vec[i + 1])
        {
            can = false;
            break;
        }
        else if (i < n - 2 && vec[i] == vec[i + 1] && vec[i + 1] == vec.at(i + 2))
        {
            can = false;
            break;
        }
    }
    if (can)
    {
        rep(i, n - 1)
        {
            if (vec[i] == vec[i + 1])
            {
                count++;
            }
        }
        for (int i = 0; i < count; i++)
        {
            ans *= 2;
            ans %= 1000000007;
        }
        cout << ans << endl;
    }
    else cout << 0 << endl;
    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef pair< int,int > pi;

double Distance(pi u,pi v){
    double ans = ((u.first-v.first)*(u.first-v.first) + (u.second-v.second)*(u.second-v.second))*1.0;
    ans = sqrt(ans*1.0);
    return ans;
}

int main()
{
    int n;
    double sum = 0;

    cin >> n;

    vector< pi > towns;

    for(int i = 0;i<n;i++){
        int a,b;
        cin >> a >> b;
        towns.push_back(make_pair(a,b));
    }

    for(int i=0;i<n-1;i++){
        for(int j=i+1;j<n;j++){
            double ans = Distance(towns[i],towns[j]);
            sum += ans;
        }
    }

    cout.precision(10);
    cout << fixed << 2*sum/n << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define MOD 1000000007
 
using namespace std;
typedef long long ll;
int H,W,A,B;
ll ans;
ll fac[345678],rfac[345678];

ll mod_pow(ll x,ll y){
    ll a=1LL;
    while(y){
        if(y%2) a=a*x%MOD;
        x=x*x%MOD;
        y/=2;
    }
    return a;
}

ll mod_reverse(ll x,ll mod){
    return mod_pow(x,mod-2);
}

ll comb(int n,int r){
    return fac[n]*rfac[n-r]%MOD*rfac[r]%MOD;
}

int main(){

cin>>H>>W>>A>>B; 

fac[0]=1LL; rfac[0]=1LL;
for(int i=0; i<300000; i++){
    fac[i+1]=(fac[i]*(i+1))%MOD;
    rfac[i+1]=mod_reverse(fac[i+1],MOD);
}

int C=H-A;

for(int i=C; i>=1; i--) ans=(ans+comb(i-1+B-1,i-1)*comb(H-i+W-B-1,H-i))%MOD;

cout<<ans<<endl;

return 0;
 
}

Measured memory_bytes: 5248
using System;
using System.Collections.Generic;
using System.Linq;

class Procon
{
    public Procon() { }
    static void Main(string[] agrs)
    {
        new Procon().Do();
    }

    Scanner cin;

    public void Do()
    {
        cin = new Scanner();
        int N = cin.nextInt();
        int[] h = cin.arrayInt();
        long[] DP = new long[N];

        for (int i = 0; i < N; i++)
        {
            DP[i] = 10000000000;
        }

        DP[0] = 0;

        for (int i = 0; i < N; i++)
        {
            if (i + 1 < N)
            {
                DP[i + 1] = Math.Min(DP[i + 1], DP[i] + Math.Abs(h[i] - h[i + 1]));
            }
            if (i + 2 < N)
            {
                DP[i + 2] = Math.Min(DP[i + 2], DP[i] + Math.Abs(h[i] - h[i + 2]));
            }
        }

        Console.WriteLine(DP[N - 1]);
    }
}

class Scanner
{
    string[] s;
    int i;
    int max_i;

    public Scanner()
    {
        s = new string[0];
        max_i = 0;
        i = 0;
    }

    public string nextString()
    {
        if (i >= s.Length)
        {
            s = Console.ReadLine().Split(' ');
            max_i = s.Length;
            i = 0;
            if (max_i == 0)
            {
                return "";
            }
            return s[i++];
        }
        else
        {
            return s[i++];
        }
    }

    public int nextInt()
    {
        return int.Parse(nextString());
    }


    public long nextLong()
    {
        return long.Parse(nextString());
    }

    public double nextDouble()
    {
        return double.Parse(nextString());
    }

    public string[] arrayString()
    {
        return Console.ReadLine().Split(' ');
    }

    public int[] arrayInt()
    {
        string[] str = Console.ReadLine().Split(' ');
        int[] array = new int[str.Length];
        for (int i = 0; i < str.Length; i++)
        {
            array[i] = int.Parse(str[i]);
        }
        return array;
    }

    public long[] arrayLong()
    {
        string[] str = Console.ReadLine().Split(' ');
        long[] array = new long[str.Length];
        for (int i = 0; i < str.Length; i++)
        {
            array[i] = long.Parse(str[i]);
        }
        return array;
    }

    public double[] arrayDouble()
    {
        string[] str = Console.ReadLine().Split(' ');
        double[] array = new double[str.Length];
        for (int i = 0; i < str.Length; i++)
        {
            array[i] = double.Parse(str[i]);
        }
        return array;
    }
}



Measured memory_bytes: 17248
#include <cstdio>
#define repi(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,a) repi(i,0,a)
#define all(a) (a).begin(), (a).end()

using ll = long long;

ll N, K;
ll A[100010];
ll cnt[40];

int main()
{
  scanf( "%lld%lld", &N, &K );

  rep( i, N )
  {
    scanf( "%lld", A+i );

    ll x = A[i], p = 0;
    while( x > 0 )
    {
      cnt[p++] += x&1;
      x >>= 1;
    }
  }

  ll x = K, dig = 0;
  while( x > 0 )
    x >>= 1, ++dig;

  ll X = 0;
  for( ll i = dig-1; i >= 0; --i )
  {
    if( N-cnt[i] >= cnt[i] )
    {
      X += 1ll<<i;

      if( X > K )
        X -= 1ll<<i;
    }
  }

  ll ans = 0;
  rep( i, N )
    ans += X^A[i];

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

  return 0;
}

Measured memory_bytes: 896
import java.util.*;
import java.io.*;

class Main
{
    public static void main(String[] args) throws IOException{
        // Solution sol = new Solution();
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer(br.readLine());
        int t = Integer.parseInt(st.nextToken());
        
        System.out.println((int)(Math.ceil(t/1000.0)*1000-t));


    }

    


    

}

Measured memory_bytes: 32816
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<sstream>
#include<stack>
#include<string>
#include<unordered_set>
#include<vector>

#define ll long long
#define P pair<int,int>
#define FOR(i,N) for(int i=0;i<(int)N;i++)
#define FORIN(i,a,b) for(int i=a;i<(int)b;i++)
#define ALL(x) (x).begin(),(x).end()
#define LAST(x) (x)[(x).size()-1]
#define GI(name) int (name);scanf("%d",&(name))
#define GI2(name1,name2) int (name1),(name2);scanf("%d %d",&(name1),&(name2))
#define GI3(name1,name2,name3) int (name1),(name2),(name3);scanf("%d %d %d",&(name1),&(name2),&(name3))
#define GVI(name,size) vector<int> (name)(size);FOR(i,(size))scanf("%d",&(name)[i])
#define MOD 1000000007

using namespace std;

string to_hex(int x){
    stringstream ss;
    ss<<hex<<x;
    return ss.str();
}

inline int get_int(){
    int ret;
    scanf("%d",&ret);
    return ret;
}

inline vector<int> get_ints(int n){
    vector<int> ret(n);
    FOR(i,n){
        scanf("%d",&ret[i]);
    }
    return ret;
}

inline string get_str(){
    string ret;
    cin>>ret;
    return ret;
}

bool is_prime(int n){
    int s=sqrt(n)+1;
    for(int i=2;i<=s;++i){
        if(n%i==0){
            return 0;
        }
    }
    return 1;
}

vector<P> prime_division(int n){
    vector<P> ret;
    int s=sqrt(n)+1;
    int c=0;
    for(int i=2;i<=n;++i){
        if(n%i==0){
            c=0;
            do{
                ++c;
                n/=i;
            }while(n%i==0);
            ret.push_back(P(i,c));
        }
    }
    return ret;
}

struct UnionFind{
    vector<int> data;
    UnionFind(int size){
        data=vector<int>(size,-1);
    }
    bool union_set(int x,int y){
        x=root(x);
        y=root(y);
        if(x!=y){
            if(data[y]<data[x])swap(x,y);
            data[x]+=data[y];
            data[y]=x;
        }
        return x!=y;
    }
    bool find(int x,int y){
        return root(x)==root(y);
    }
    int root(int x){
        return data[x]<0?x:data[x]=root(data[x]);
    }
    int size(int x){
        return -data[root(x)];
    }
};

string to_string(string s){
    return s;
}

template<class T>
string to_string(vector<T> v){
    string ret="{";
    FOR(i,v.size()-1){
        ret+=to_string(v[i])+",";
    }
    if(v.size()>0){
        ret+=to_string(LAST(v));
    }
    ret+="}";
    return ret;
}

void debug_print(){
    cerr<<endl;
}

template<class Head,class... Tail>
void debug_print(Head head,Tail... tail){
    cerr<<to_string(head)<<" ";
    debug_print(tail...);
}

template<class... T>
void debug(T... args){
    cerr<<"["<<__LINE__<<"]: ";
    debug_print(args...);
}

void print(){
    cout<<endl;
}

template<class Head,class... Tail>
void print(Head head,Tail... tail){
    cout<<to_string(head);
    print(tail...);
}

int main(){
    ll N,M;
    cin>>N>>M;
    if(N==1){
        if(M==1){
            print(1);
        }else{
            print(M-2);
        }
    }else if(M==1){
        print(N-2);
    }else{
        print((N-2)*(M-2));
    }
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;

public class Solution
{
    public static void Main()
    {
        var k = int.Parse(Console.ReadLine());
        var array = new int[] { 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 };

        Console.WriteLine(array[k - 1]);
    }
}

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

typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<double> vd;
typedef vector<ll> vl;
typedef vector<string> vs;
#define fo(i, a, b) for (int i = a; i < b; i++)
#define re(i, n) fo(i, 0, n)
#define pb push_back
#define all(s) s.begin(), s.end()
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { ll g = gcd(a, b); return a / g * b; }

int f(int n) {
  if(n % 2 == 0) return n / 2;
  else return 3 * n + 1;
}

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

  vi a;
  a.pb(s);
  int n = 1;
  bool dif = true;
  while(dif) {
    a.pb(f(a[n-1]));
    re(i, n) {
      if(a[n] == a[i]) {
        cout << n + 1 << endl;
        dif = false;
        break;
      }
    }
    n++;
  }

  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
	char c[4];
	char a[4];
	int b;
	scanf("%s",c);
	scanf("%s",a);
	b=0;
	if(c[0]==a[2]){
		b=b+1;
		if(c[1]==a[1]){
			b=b+1;
			if(c[2]==a[0]){
				b=b+1;
	}}}
    if(b==3){
		printf("YES\n");
	}
	else{
		printf("NO\n");
	}
	return 0;
}

Measured memory_bytes: 128
N = input()

num_list = [sum(map(int, N))]
l = len(N)
head = 0

for i, num in enumerate(N):
    if num == 0:
        continue
    num_list += [head + int(num) - 1 + 9 * (l - i - 1)]
    head += int(num)

print(max(num_list))


Measured memory_bytes: 2940
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <stack>
#include <numeric>
#include <algorithm>
#include <tuple>
#include <stdio.h>
#include <bitset>
#include <limits.h>
#include <complex>
#include <deque>
#include <iomanip>
#include <list>
#include <cstring>
using namespace std;
#define pi pair<int,int>
#define pl pair<long long,long long>
#define chmax(a,b) (a<b ? a=b:0)
#define chmin(a,b) (a>b ? a=b:0)
#define en cout << endl //セミコロンつけろ
//#define MM 1000000000
//#define MOD MM+7
typedef long long ll;
const int MM = 1e9;
const int MOD = MM+7;
const long double PI = acos(-1);
const long long INF = 1e15;
int dx[8] = {-1,0,1,0,-1,-1,1,1};
int dy[8] = {0,-1,0,1,-1,1,1,-1};
// 'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122

template<typename T> //最大公約数
T GCD(T u,T v){
    return v ? GCD(v,u%v) : u;
}
template<typename T> //最小公倍数
T LCM(T x,T y){
    T gc = GCD(x,y);
    return x*y/gc;
}


struct Edge
{
    ll to, cost;
};

void DFS(vector<vector<Edge> > &G, vector<ll> &color, int now){
    queue<ll> que;
    que.push(now);
    while (que.size()){
        int pos = que.front();
        que.pop();
        for (int i = 0; i < G[pos].size(); i++){
            Edge es = G[pos][i];
            if (color[es.to] != -1) continue;
            if (es.cost % 2 == 0){
                color[es.to] = color[pos];
            } else {
                color[es.to] = !color[pos];
            }
            que.push(es.to);
        }
    }
}

int main(){
    int N; cin >> N;
    vector<vector<Edge> > g(N);
    vector<ll> color(N, -1);
    for (int i = 0; i < N-1; i++){
        ll u, v, w; cin >> u >> v >> w;
        u--; v--;
        Edge e; e.to = v; e.cost = w;
        g[u].push_back(e);
        e.to = u;
        g[v].push_back(e);
    }

    queue<ll> que;
    for (int i = 0; i < N; i++){
        if (color[i] != -1) continue;
        color[i] = 0;
        DFS(g, color, i);
    }
    for (int i = 0; i < N; i++){
        cout << color[i] << endl;
    }
}

Measured memory_bytes: 8704
#include<iostream>
#include<cmath>
using namespace std;
int main()
{
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    if((abs(a-b)<=d&&abs(b-c)<=d)||abs(a-c)<=d) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}

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

namespace D_Knapsack1
{
    class Program
    {
        static void Main(string[] args)
        {
            var input = Console.ReadLine().Split(' ');
            var N = int.Parse(input[0]);
            var W = long.Parse(input[1]);

            var weight = new long[110];
            var value = new long[110];
            for (int i = 0; i < N; i++)
            {
                input = Console.ReadLine().Split(' ');

                weight[i] = long.Parse(input[0]);
                value[i] = long.Parse(input[1]);
            }

            var dp = new long[110][];
            for (int i = 0; i < dp.Length; i++)
            {
                dp[i] = new long[100100];
            }

            for (int i = 0; i < N; i++)
            {
                for (int sum_w = 0; sum_w <= W; sum_w++)
                {
                    if (sum_w - weight[i] >= 0) //i番目の品物を選ぶとき
                    {
                        dp[i + 1][sum_w] = Chmax(dp[i + 1][sum_w], dp[i][sum_w - weight[i]] + value[i]);
                    }

                    dp[i + 1][sum_w] = Chmax(dp[i + 1][sum_w], dp[i][sum_w]); //選ばないとき
                }
            }
            Console.WriteLine(dp[N][W]);
        }

        public static long Chmax(long a, long b)
        {
            return a < b ? b : a;
        }
    }
}


Measured memory_bytes: 98112
A,B = (int(i) for i in input().split())

if A == 1 and B == 1:
    print("Draw")
elif A == 1:
    print("Alice")
elif B == 1:
    print("Bob")
elif A == B:
    print("Draw")
elif A > B:
    print("Alice")
else:
    print("Bob")

Measured memory_bytes: 2940
/*Function Template*/
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
const int mod = 1000000007;
const ll MOD = 1000000000000000001;
#define rep(i, n) for(ll i = 0; i < (n); i++)
#define ALL(a)  (a).begin(),(a).end()
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);


ll Len(ll n) {
  ll s=0;
  while(n!=0) s++, n/=10;
  return s;
}


ll Sint(ll n) {
  ll m=0,s=0,a=n;
  while(a!=0) s++, a/=10;
  for(ll i=s-1;i>=0;i--) m+=n/((ll)pow(10,i))-(n/((ll)pow(10,i+1)))*10;
  return m;
}


ll Svec(vector<ll> v){
  ll n=0;
  for(ll i=0;i<v.size();i++) n+=v[i];
  return n;
}


ll GCD(ll a,ll b){
  ll r,tmp;
/*自然数 a > b を確認・入替*/
  if(a<b){
    tmp=a,a=b,b=tmp;
  }
/*ユークリッドの互除法*/
  r=a%b;
  while(r!=0){
    a=b,b=r,r=a%b;
  }
  return b;
}


ll LCM(ll a,ll b){
  ll c=a,d=b,r,tmp;
/*自然数 a > b を確認・入替*/
  if(a<b){
    tmp=a,a=b,b=tmp;
  }
/*ユークリッドの互除法*/
  r=a%b;
  while(r!=0){
    a=b,b=r,r=a%b;
  }
  return c/b*d;
}


ll Factorial(ll n){
  ll m=1;
  while(n>=1) m*=n,n--;
  return m;
}

vector<pair<char,ll>> runlength(string s,vector<pair<char,ll>> p){
  ll x=1;
  if(s.size()==1){
    p.push_back(pair<char,ll>(s[0],1));
    return p;
  }
  for(ll i=0;i<s.size()-1;i++){
    if(s[i]==s[i+1]){
      x++;
      if(i==s.size()-2){
        p.push_back(pair<char,ll>(s[i],x));
      }
    }else{
      p.push_back(pair<char,ll>(s[i],x));
      x=1;
      if(i==s.size()-2){
        p.push_back(pair<char,ll>(s[s.size()-1],x));
      }
    }
  }
  return p;
}



/*↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓*/
int main() {
  IOS;
  ll k,a,b,ans=1;
  cin>>k>>a>>b;
  if(a>1){
    k-=(a-1);
    ans+=(a-1);
  }
  if(b-a>2){
    if(k%2==0){
      ans+=(b-a)*k/2;
    }else{
      ans+=(b-a)*(k/2)+1;
    }
  }else{
    ans+=k;
  }
  cout<<ans<<endl;
  
  
}

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

int card[3][3];

bool isExist(int b) {
    for (int i=0;i<3;i++) {
        for (int j=0;j<3;j++) {
            if (card[i][j] == b) {
                card[i][j] = 0;
                return true;
            }
        }
    }
    return false;
}

bool isBingo() {
    //よこ
    for (int i=0;i<3;i++) {
        if (card[i][0] == 0 && card[i][1] == 0 && card[i][2] == 0) return true;
    }
    //たて
    for (int j=0;j<3;j++) {
        if (card[0][j] == 0 && card[1][j] == 0 && card[2][j] == 0) return true;
    }
    //ななめ
    if (card[0][0] == 0 && card[1][1] == 0 && card[2][2] == 0) return true;
    if (card[2][0] == 0 && card[1][1] == 0 && card[2][0] == 0) return true;
    return false;
}

int main(void){
    for (int i=0;i<3;i++) {
        cin >> card[i][0] >> card[i][1] >> card[i][2];
    }
    int n, b;
    bool ans = false;
    cin >> n;
    for (int i=0;i<n;i++) {
        cin >> b;
        if(ans) continue;
        if(isExist(b)) {
            if(isBingo()) {
                ans = true;
            }
        }
    }
    if(ans) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<complex>
#include<cstdio>

using namespace std;

#define X real()
#define Y imag()

int main(){
	typedef complex<double> P;
	
	
	int a,b,c,d;
	cin>>a>>b>>c>>d;
	
	P padding = P(a,b);
	P p1 = P(0,0);
	P p2 = P(c-a, d-b);
	
	P e = p2 / abs(p2);
	
	int n;
	cin>>n;
	
	for(int i=0;i<n;i++){
		int g,h;
		cin>>g>>h;
		
		P q = P(g,h) - padding;
		
		double len = q.X*e.X + q.Y*e.Y;
		P pro = e*len;
		P ans = pro + (pro-q) + padding;
		
		printf("%.10lf %.10lf\n",ans.X, ans.Y);
		
	}
	
}

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

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

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

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

int n,m;
map<string,int> mp;
string s;

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

	cin>>n;
	REP(i,n) {
		cin>>s;
		mp[s]++;
	}
	cin>>m;
	REP(i,m) {
		cin>>s;
		mp[s]--;
	}
	int ans=0;
	for(auto x:mp) ans=max(ans,x.se);
	cout<<ans<<endl;

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string s;
    cin>>s;
    if(s[0]==s[1]||s[1]==s[2]||s[2]==s[3]){
        cout<<"Bad"<<endl;
    }
    else{
        cout<<"Good"<<endl;
    }
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
signed main(){
  long long n,m,p,ac=0,wrong[100050],wa=0;
  bool dudge[100050];
  string s;
  cin>>n>>m;
  for(int i=1;i<=n;i++)
    dudge[i]=false,wrong[i]=0;
  
  for(int i=0;i<m;i++){
    cin>>p>>s;
    if(s == "AC")
      dudge[p]=true;
 
    else{
      if(dudge[p] == false)
	wrong[p]++;
    }
  }
 
  for(int i=1;i<=n;i++){
    ac+=dudge[i];
    if(dudge[i] == true)
      wa+=wrong[i];
  }
    
  cout<<ac<<' '<<wa<<endl;
  return(0);
}

Measured memory_bytes: 1152
S = input()

# TODO: 再帰関数でリストを作成 [s1, "+", s2, s3, "+", s4]とか
result = []
def dfs(i, list):
    if i == len(S):
        result.append(list)
        return
    else:
        if i == len(S) - 1:
            return dfs(i+1, list+[S[i]])
        else:
            return dfs(i+1, list+[S[i]]), dfs(i+1, list+[S[i], "+"])

# TODO: リストに従って和を計算
dfs(0, [])
ans = 0
for l in result:
    sum_of_l = 0
    sequence = 0
    for id in range(len(l)):
        if l[id] == "+":
            sum_of_l += sequence
            sequence = 0
        else:
            sequence *= 10
            sequence += int(l[id])
    sum_of_l += sequence
    ans += sum_of_l

print(ans)


Measured memory_bytes: 9104
#include "bits/stdc++.h"
// Begin Header {{{
#define all(x)      x.begin(), x.end()
#define rep(i,n)    for (i64 i = 0; i < (n); ++i)
#define reps(i,s,t) for (i64 i = (s); i <= (t); ++i)
#define repr(i,s,t) for (i64 i = (s); i >= (t); --i)

#ifdef DBG
#define trace(...) _trace(#__VA_ARGS__, __VA_ARGS__);
#else
#define trace(...)
#endif

using namespace std;
using i64 = int_fast64_t;
using pii = pair<i64, i64>;
template<class T, class U>inline bool chmax(T &a, const U &b){return b>a ? (a=b,1) : 0;}
template<class T, class U>inline bool chmin(T &a, const U &b){return b<a ? (a=b,1) : 0;}
constexpr int INF  = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;

template<class T>
ostream& operator<< (ostream &os, const vector<T> &vec) {
    rep(i, vec.size()) os << vec[i] << (i+1 == vec.size() ? "" : " ");
    return os;
}

template<class T, class U>
ostream& operator<< (ostream &os, const pair<T, U> &p) {
    return os << p.first << ' ' << p.second;
}

template <class T>
void _trace(const char *s, T&& x)
{
    clog << '{';
    while(*s != '0' && *s != ',') clog << *(s++);
    clog << ":" << setw(3) << x << '}' << endl;
}

template <class Head, class... Tail>
void _trace(const char *s, Head&& head, Tail&&... tail)
{
    clog << '{';
    while(*s != ',') clog << *(s++);
    clog << ":" << setw(3) << head << "}, ";
    for (++s; !isgraph(*s); ++s);
    _trace(s, std::forward<Tail>(tail)...);
}
// }}} End Header

signed main()
{
    // ios::sync_with_stdio(false); cin.tie(nullptr);
    string s;
    cin >> s;

    set<int> U;
    for (char c : s) U.insert(c);

    cout << ((U.size() == s.length()) ? "yes" : "no") << "\n";


    return 0;
}


Measured memory_bytes: 256
#include <iostream>

int main() {
  int N;
  std::cin >> N;

  long long sum = 0;
  for (int i = 0; i <= N; i++) {
    if (i % 3 != 0 && i % 5 != 0) {
      sum += i;
    }
  }

  std::cout << sum << '\n';
  return 0;
}

Measured memory_bytes: 3596
#include <iostream>
#include <vector>
#include <algorithm>
#include <stack>
#include <iomanip>
#include <string>
#include <cmath>
#include <set>
#include <map>
#include <unordered_map>
#include <queue>
#pragma GCC optimize("Ofast")
#pragma GCC target( "sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native" )
#define endl "\n"
#define int long long
#define debug(x) cout << #x << " is " << x << endl;
using namespace std;
int fastpow(int a, int b) {
	if (!b) return 1ll;
	if (b % 2 == 1) return fastpow(a, b - 1) * a;
	int t = fastpow(a, b / 2);
	return t * t;
}
void solve() {
	char x; cin >> x;
	if (x >= 'a' and x <= 'z') cout << 'a';
	else cout << 'A';
}
signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	cout << fixed << setprecision(15);
	int t; t = 1;
	while (t--) {
		solve();
	}
	return 0;
}


Measured memory_bytes: 3608
#問題B
import numpy as np
R, G, B, N= map(int, input().split())

A=[R,G,B]
A.sort()
A=np.array(A)

count=0

shou_max = N//A[2]
warukazu2 = np.arange(0, shou_max+1)
A3 = N-warukazu2*A[2]

for x in A3:
    shou_max = x//A[1]
    warukazu1 = np.arange(0, shou_max+1)
    A2 = x-warukazu1*A[1]
    
    count+=np.sum(A2%A[0]==0)
#     A2*A[0]==0
#     for y in A2:
#         if y%A[0]==0:
#             count+=sum_
print(count)

Measured memory_bytes: 12500
#include <iostream>
#include <cstdio>
#include <cctype>
#define il inline
#define vd void
#define rg register
#define mn 300005
#define rep(i,x,y) for(rg int i=x;i<=y;++i)
#define drp(i,x,y) for(rg int i=x;i>=y;--i)
using namespace std;
const int Len=2333333;
char buf[Len],*p1=buf,*p2=buf,duf[Len],*q1=duf;
il char gc(); il int rd(); il vd pc(char c); il vd rt(int x); il vd flush();
template<class T> il T Max(T a,T b){return a>b?a:b;}
template<class T> il T Min(T a,T b){return a<b?a:b;}
int n,m,l,tot,sum,a[mn],c[mn],ans[mn];
int main(){
    n=rd();
    rep(i,1,n) ++a[rd()];
    rep(i,1,n) ++c[a[i]];
    rep(i,1,n) if(a[i]) ++tot;
    rep(i,1,n) ans[sum/i+tot]=i,tot-=c[i],sum+=c[i]*i;
    drp(i,n-1,1) ans[i]=Max(ans[i],ans[i+1]);
    rep(i,1,n) rt(ans[i]),pc(' ');
    return flush(),0;
}

il char gc(){return p1==p2&&(p2=(p1=buf)+fread(buf,1,Len,stdin),p1==p2)?-1:*p1++;}
il int rd(){char c;
    while(!isdigit(c=gc())&&c!='-');
    int f=c=='-'?c=gc(),1:0,x=c^48;
    while(isdigit(c=gc())) x=((x+(x<<2))<<1)+(c^48);
    return f?-x:x;
}
il vd pc(char c){q1==duf+Len&&fwrite(q1=duf,1,Len,stdout),*q1++=c;}
il vd rt(int x){x<0?pc('-'),x=-x:0,pc((x>=10?rt(x/10),x%10:x)+48);}
il vd flush(){fwrite(duf,1,q1-duf,stdout);}

Measured memory_bytes: 7808
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
long long inf=(long long)1E17;
#define i_7 (long long)(1E9+7)
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
using namespace std;
long long gcd(long long a, long long b){
  if(a<b){
    swap(a,b);
  }
  if(a%b==0){
    return b;
  }else{
    return gcd(b,a%b);
  }
}
 
long long lcm(long long x, long long y){
  return (x/gcd(x,y))*y;
}
 
class UnionFind {
    public:
    //各頂点の親の番号を格納する。その頂点自身が親だった場合は-(その集合のサイズ)を入れる。
    vector<int> Parent;
    
    //クラスを作るときは、Parentの値を全て-1にする。
    //以下のようにすると全てバラバラの頂点として解釈できる。
    UnionFind(int N) {
        Parent = vector<int>(N, -1);
    }
    
    //Aがどのグループに属しているか調べる
    int root(int A) {
        if (Parent[A] < 0) return A;
        return Parent[A] = root(Parent[A]);
    }
    
    //自分のいるグループの頂点数を調べる
    int size(int A) {
        return -Parent[root(A)];//先祖をrootで取っておきたい。
    }
    
    //AとBをくっ付ける
    bool connect(int A, int B) {
        //AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
        A = root(A);
        B = root(B);
        if (A == B) {
            //すでにくっついてるからくっ付けない
            return false;
        }
        
        //大きい方(A)に小さいほう(B)をくっ付けたい
        //大小が逆だったらAとBをひっくり返す。
        if (size(A) < size(B)) swap(A, B);
        
        //Aのサイズを更新する
        Parent[A] += Parent[B];
        //Bの親をAに変更する
        Parent[B] = A;
        
        return true;
    }
};
 
int main(){
  int n,a;
  cin>>n;
  int M,m;
  REP(i,n){
    cin>>a;
    if(i==0){
      M=m=a;
    }else{
      M = max(M,a);
      m = min(m,a);
    }
  }
  cout<<M-m<<endl;
  return 0;
}

Measured memory_bytes: 256
#include<algorithm>
#include<iostream>
#include<cstring>
#include<cstdio>
//by NeighThorn
using namespace std;
const int maxn=10000+5;
int n,hd[maxn],to[maxn*2],nxt[maxn*2],w[maxn*2],cnt,maxdis[maxn],secdis[maxn];
inline void add(int s,int x,int y){
	w[cnt]=s;to[cnt]=y;nxt[cnt]=hd[x];hd[x]=cnt++;
}
inline void dfs(int root,int fa){
	for(int i=hd[root];i!=-1;i=nxt[i])
		if(to[i]!=fa){
			dfs(to[i],root);
			if(maxdis[to[i]]+w[i]>maxdis[root])
				secdis[root]=maxdis[root],maxdis[root]=maxdis[to[i]]+w[i];
			else if(maxdis[to[i]]+w[i]>secdis[root])
				secdis[root]=maxdis[to[i]]+w[i];
		}
}
inline void change(int root,int fa){
	for(int i=hd[root];i!=-1;i=nxt[i])
		if(to[i]!=fa){
			if(maxdis[root]==maxdis[to[i]]+w[i]){
				if(maxdis[to[i]]<secdis[root]+w[i])
					secdis[to[i]]=maxdis[to[i]],maxdis[to[i]]=secdis[root]+w[i];
				else if(secdis[to[i]]<secdis[root]+w[i])
					secdis[to[i]]=secdis[root]+w[i];
			}
			else{
				if(maxdis[to[i]]<maxdis[root]+w[i])
					secdis[to[i]]=maxdis[to[i]],maxdis[to[i]]=maxdis[root]+w[i];
				else if(secdis[root]<secdis[root]+w[i])
					secdis[to[i]]=maxdis[root]+w[i];
			}
			change(to[i],root);
		}
}
signed main(void){
	scanf("%d",&n);cnt=0;memset(hd,-1,sizeof(hd));
	for(int i=1,s,x,y;i<n;i++)
		scanf("%d%d%d",&x,&y,&s),add(s,x,y),add(s,y,x);
	memset(maxdis,0,sizeof(maxdis));memset(secdis,0,sizeof(secdis));
	dfs(0,-1);change(0,-1);
	for(int i=0;i<n;i++)
		printf("%d\n",maxdis[i]);
	return 0;	
}

Measured memory_bytes: 3800