akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define ll long long
#define MODV 1000000007
#define INFLL LLONG_MAX // 9223372036854775807
#define EPS 1e-9
#define rep(i, n) for(ll i=0, i##_len=(ll)(n); i<i##_len; i++)
#define repf(i, n) for(ll i=1, i##_len=(ll)(n+1); i<i##_len; i++)
#define all(v) v.begin(), v.end()
#define endl "\n"
#define vi vector<ll>
#define vvi vector<vector<ll>>
#define Yes() cout << "Yes" << endl
#define YES() cout << "YES" << endl
#define No() cout << "No" << endl
#define NO() cout << "NO" << endl
#define Init() std::ios::sync_with_stdio(false); std::cin.tie(0); std::cout<<fixed<<setprecision(15);
template<class T>bool chmax(T &a, const T &b){ if(a<b){ a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b){ if(b<a){ a=b; return 1; } return 0; }
using namespace std;

int main(){
    Init();
    string s; cin >> s;
    vector<string> t;
    t.emplace_back("KIHBR");
    t.emplace_back("KIHBRA");
    t.emplace_back("KIHBAR");
    t.emplace_back("KIHBARA");
    t.emplace_back("KIHABR");
    t.emplace_back("KIHABRA");
    t.emplace_back("KIHABAR");
    t.emplace_back("KIHABARA");
    t.emplace_back("AKIHBR");
    t.emplace_back("AKIHBRA");
    t.emplace_back("AKIHBAR");
    t.emplace_back("AKIHBARA");
    t.emplace_back("AKIHABR");
    t.emplace_back("AKIHABRA");
    t.emplace_back("AKIHABAR");
    t.emplace_back("AKIHABARA");
    bool ans = false;
    for(auto &m: t) if(m == s) ans = true;
    ans ? YES() : NO();
}

Measured memory_bytes: 3660
#include <bits/stdc++.h>
#define LL long long
#define FOR(i,a,b) for(int i=a; i<=b; i++)
#define FOD(i,a,b) for(int i=a; i>=b; i--)
#define pa pair<int,int>
#define fi first
#define se second
#define MOD xxx
#define getbit(n,i) ((n>>(i-1))&1)
#define offbit(n,i) ((n^(1<<(i-1))
#define onbit(n,i) (n|(1<<(i-1)))
#define cntone(x) (__builtin_popcount(x))

using namespace std;
int n,k,ans(0),x,y;
pa A[105][105];
int B[105],X[105];
void dq(int i)
{
    if(i>n)
    {
        int ok = 0,s(0);
        FOR(i,1,n)
        if(X[i]==1)
        {
            FOR(j,1,B[i])
            if(X[A[i][j].fi]!=A[i][j].se) ok = 1;
            s += X[i];
        }
        if(ok==0) ans = max( ans , s);
        return;
    }
    X[i] = 0;
    dq(i+1);
    X[i] = 1;
    dq(i+1);
}
int main()
{
    if(fopen("C.inp","r"))
    {
        freopen("C.inp","r",stdin);
        freopen("C.out","w",stdout);
    }
    cin >> n;
    FOR(j,1,n)
    {
        cin >> B[j];
        FOR(i,1,B[j])
        {
            cin >> A[j][i].fi >> A[j][i].se;
        }
    }
    dq(1);
    cout << ans;
	return 0;
}


Measured memory_bytes: 3608
{-#LANGUAGE FlexibleContexts#-}
import Control.Monad
import Control.Monad.State
import Control.Monad.Reader
import Control.Arrow
-- import Control.Comonad
import Data.Maybe
import Data.List
import Data.Bool
import Data.Fixed
import Data.Tuple
import Data.Ratio
import Data.Bits
import qualified Data.Map.Strict as M
import qualified Data.Array.IO as IA
import qualified Data.Vector as V

getI = read <$> getLine :: IO Int
getIs = map read . words <$> getLine :: IO [Int]
getD = read <$> getLine :: IO Double
getDs = map read . words <$> getLine :: IO [Double]
getInt = read <$> getLine :: IO Integer
getInts = map read . words <$> getLine :: IO [Integer]

type Row = Integer
type Col = Integer
type PointI = (Integer, Integer)
type Point = (Int, Int)

mmm = 1000000007
fact n
    | n < 1 = 1
    | True = foldr1 (*) [1..n]
ti = toInteger
fi = fromInteger
fig = fromIntegral
rf = realToFrac

(.<.) :: Integer -> Integer -> Integer
(.<.) f g -- combination
    | g < 1 || f < 1 || f < g = 1
    | True = foldr1 (*) (take (fi g) [f,f-1..]) `div` fact g
(.>.) f g --combination with repetition
    | g < 1 || f < 1 = 1
    | True = fact (f + g - 1) `div` (fact (f - 1) * fact g)
permutation n x 
    | n < x || x < 0 = 0
    | True = foldr1 (*) . take x $ [n,n-1..1]

comb = (.<.)
combWp = (.>.)

unique a = unique_ (reverse . sort $ a) [] Nothing
    where
        unique_ [] arr _ = arr
        unique_ (x:xs) arr n
            | n == Just x = unique_ xs arr n
            | otherwise = unique_ xs (x:arr) $ Just x
 
zeroume keta num
    | (length . show $ num) > keta = show num
    | otherwise = do 
        let zeros = take keta $ repeat '0'
        reverse . take keta $ (reverse . show $ num) ++ zeros
 
i2b num
    | num < 2 = show num
    | otherwise = i2b_ num []
        where
            i2b_ num str
                | num == 0 = str
                | num == 1 = '1':str
                | otherwise = do
                    let next = num `div` 2
                    let this = if odd num then '1' else '0'
                    i2b_ next (this:str)

mapIncr = mapPlus 1
mapPlus n Nothing = Just n
mapPlus n a = (+) n <$> a

countIf f = length . filter f

enumDivisor :: Int -> [Int]
enumDivisor n = do
    let sqrted = floor $ sqrt (fromIntegral n)
        smaller = filter (\x -> mod n x == 0) [1..sqrted]
        bigger = reverse $ map (div n) smaller
    if head bigger == sqrted then smaller ++ (init bigger)
    else smaller ++ bigger

-- 
--
--

main = do
    [n,x] <- getIs
    putStrLn . show $ count n x

count n x
    | even x = cn (n `div` x) + cn ((x `div` 2 + n) `div` x)
    | True = cn (n `div` x)

cn n = permutation n 3 + 3 * permutation n 2 + n


Measured memory_bytes: 508
a,b = map(int,input().split())
if (a>=0):
  if(a == 0):
    print("Zero")
  else:
    print("Positive")
else:
  if(b>= 0):
    print("Zero")
  else:
    k = b - a +1
    if(k%2==0):
      print("Positive")
    else:
      print("Negative")
  
  

Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
const long long md=1e9+7;
string s;
long long n;
vector<long long> dp(13);
int main()
{
	cin>>s;
	dp[0]=1;
	for(int i=0;i<s.size();i++)
	{
		vector<long long> d_n(13);
		for(int j=0;j<=9;j++)
		{
			if(s[i]=='?'||s[i]-'0'==j)
			{
				for(int k=0;k<13;k++)
				{
					d_n[(k*10+j)%13]+=dp[k]%md;
				}
			}
		}
		dp=d_n;
	}
	cout<<dp[5]%md;
	return 0;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main(){
  int n;
  cin >> n;
  vector<int> k(1000001,0);
  k[n]=1;
  int cnt=2;
  while(1){
    if(n%2==0){
      n/=2;
    }
    else{
      n=n*3+1;
    }
    if(k[n]==1){
      cout << cnt << endl;
      return 0;
    }
    else{
      k[n]=1;
    }
    cnt++;
  }
}


Measured memory_bytes: 4096
#pragma GCC optimize("O3")
#pragma GCC target("sse4")

#include <bits/stdc++.h>

// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;

using namespace std;

typedef long long ll;
typedef long double ld;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;

const int MXN = 2e5, IINF = 1e9 + 10, INF = 1e18 + IINF + 10, MOD = 1000000007;
const ld PI = 4.0 * atanl(1.0), PREC = .000001;
const char nl = '\n';

#define FOR(i, a, b) for (int i = a; i < (b); i++)
#define F0R(i, a) for (int i = 0; i < (a); i++)
#define FORd(i, a, b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i, a) for (int i = (a)-1; i >= 0; i--)
#define trav(a, x) for (auto& a : x)
#define uid(a, b) uniform_int_distribution<int>(a, b)(rng)

#define f first
#define s second
#define pb push_back
#define mp make_pair
#define all(x) x.begin(), x.end()
#define rall(x) x.end(), x.begin()
#define lb lower_bound
#define ub upper_bound
#define sz(x) (int)(x).size()
#define ins insert

int n, m, t, a[MXN];

void fast() { ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); }

ll gcd(ll a, ll b) { return b == 0 ? a : gcd(b, a % b); }

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

int main() {
  fast();
  cin >> n >> m;
  map<int, int> wa;
  set<int> ac;
  int ans = 0;
  FOR(i, 0, m) {
    int p;
    string s;
    cin >> p >> s;
    if (ac.find(p) == ac.end() and s == "AC") {
      ac.ins(p);
      ans += wa[p];
    } else
      ++wa[p];
  }
  cout << sz(ac) << " " << ans;
  return 0;
}



Measured memory_bytes: 12936
#define _CRT_SECURE_NO_WARNINGS
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for(int i=0; i<(n); ++i)
#define FOR(i, m, n) for(int i=(m); i<(n); ++i)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define mp make_pair
#define pb push_back
#define Cout(x) cout << (x) << endl
#define Cout2(x, y) cout << (x) << " " << (y) << endl
#define dump(x) cout << #x << " = " << (x) << endl;
#define forauto(i, a) for(auto i : a)cout << i << " "; puts("");
typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef vector<vector<int>> VVI;
typedef pair<int, int> PII;
const int inf = 1e9;
const double pi = acos(-1.0);

int re(int s, int w) {
	int ss[] = { 60,80,100,120,140,160,609 };
	int ww[] = { 2,5,10,15,20,25,209 };
	int mm[] = { 600,800,1000,1200,1400,1600,0 };

	int a1, a2;
	rep(i, 7) {
		if (ss[i] >= s) { a1 = i; break; }
	}
	rep(i, 7) {
		if (ww[i] >= w) { a2 = i; break; }
	}

	return mm[max(a1, a2)];
}

int main() {
	int n;
	while (cin >> n && n) {
		int ans = 0;
		rep(i, n) {
			int x, y, h, w; cin >> x >> y >> h >> w;
			ans += re(x + y + h, w);
		}
		Cout(ans);
	}
}


Measured memory_bytes: 3036
#include <bits/stdc++.h>
#define rep(i, n) for (int i=0; i<(n); ++i)
#define repr(i, a, b) for (int i=a; i<(b); ++i)
#define reprev(i, n) for (int i=n-1; i>=0; --i)
#define reprrev(i, a, b) for (int i=b-1; i>=(a); --i)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

ll calc_xor_sum(ll a) {
    // 0, 1, 2, ..., aまでの排他的論理和を算出する
    // 偶数nとn+1のペアの個数
    ll np = (a+1) / 2;
    // npは2個ずつペアで消える
    np = np % 2;
    if (a % 2 == 0) {
        // aが偶数なら、a+1のペアで消えていないので
        return a + np;
    } else {
        return np;
    }
}

int main() {
    // cout << fixed << setprecision(10);
    
    ll A, B; cin >> A >> B;

    ll xa = calc_xor_sum(A-1), xb = calc_xor_sum(B);
    cout << (xa ^ xb) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <time.h>

#define _CRT_SECURE_NO_WARNINGS
#define TLong long long
#define TBMod 1000000007

int main(int argc, char const *argv[])
{
	int n,k;
	char s[17];
	scanf("%d",&n);
	scanf(" %s",s);
	scanf(" %d",&k);
	for (int i = 0; i < n; ++i)
	{
		if(s[i] == s[k - 1])	printf("%c",s[k - 1]);
		else printf("*");
	}
	puts("");
	return 0;
}


Measured memory_bytes: 128
###template###
import sys
input = sys.stdin.readline
def mi(): return map(int, input().split())
###template###

Rt, Gt, Bt, N = mi()

R = max(Rt, Gt, Bt)
B = min(Rt, Gt, Bt)
G = Rt+Gt+Bt-R-B

cnt = 0

for i in range(N//R+1):
  for j in range((N-R*i)//G+1):
    #残り必要ボール数
    if (N - R*i - G*j)%B == 0:
      cnt += 1

print(cnt)




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

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            input_iter = LazyLoadAllLines();
            //------------------------------------------------//
            //var h = Read<long>();
            //var n = Read<long>();
            //var m = Read<long>();
            //var s = Read();
            //var cls = Read<long>(n);
            //var bls = Read<long>(n);
            //var sls = Read(n);
            /*List<(string s, long c)> scls = new List<(string s, long c)>();
            for (int i = 0; i < m; ++i)
            {
                scls.Add((Read(), Read<long>()));
            }*/
            //List<List<long>> abls = new List<List<long>>();
            //List<long> cls = new List<long>();
            /*List<long> edgeNum = Enumerable.Repeat(0L, (int)n).ToList();
            for (int i = 0; i < n - 1; ++i)
            {
                abls.Add(Read<long>(2));
                abls[i].Add(i);
                abls[i].Add(-1);
                --abls[i][0];
                --abls[i][1];
                //cls.Add(Read<long>());
                ++edgeNum[(int)abls[i][0]];
                ++edgeNum[(int)abls[i][1]];
            }*/

            //als.Sort((l, r) => (int)(r - l));

            var n = Read<long>();
            var als = Read<long>(n);

            Console.WriteLine(als.Distinct().Count() == als.Count ? "YES" : "NO");
        }

        static IEnumerator<string> input_iter;

        static IEnumerator<string> LazyLoadAllLines(bool doSplit = true)
        {
            string line;
            if (doSplit)
            {
                do
                {
                    line = Console.ReadLine();
                    foreach (var s in line.Split(' '))
                        yield return s;
                } while (line != null);
            }
            else
            {
                do
                {
                    line = Console.ReadLine();
                    yield return line;
                } while (line != null);
            }
        }
        static _T Read<_T>() where _T : struct
        {
            input_iter.MoveNext();
            return (_T)Convert.ChangeType(input_iter.Current, typeof(_T));
        }
        static string Read()
        {
            input_iter.MoveNext();
            return input_iter.Current;
        }
        static List<_T> Read<_T>(long num) where _T : struct
        {
            List<_T> res = new List<_T>();
            for (long i = 0; i < num; ++i)
            {
                input_iter.MoveNext();
                res.Add((_T)Convert.ChangeType(input_iter.Current, typeof(_T)));
            }
            return res;
        }
        static List<string> Read(long num)
        {
            List<string> res = new List<string>();
            for (long i = 0; i < num; ++i)
            {
                input_iter.MoveNext();
                res.Add(input_iter.Current);
            }
            return res;
        }

    }
}


Measured memory_bytes: 48984
#include <bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define RFOR(i, a, b) for (int i = (a); i >= (b); i--)
#define LFOR(i, a, b) for (long long int i = (a); i <= (b); i++)
#define LRFOR(i, a, b) for (long long int i = (a); i >= (b); i--)
#define MOD 1000000007
#define INF 1000000000           // 2000000000
#define LINF 1000000000000000000 // 9000000000000000000
#define DINF 1000000000000000.0
#define PI 3.14159265358979

//.size()はunsigned int　0-1をするとオーバーフローする

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

int dy[5] = {-1, 0, 1, 0, 0};
int dx[5] = {0, -1, 0, 1, 0};

int main(void) {
    long long int n;
    long long int mini=LINF;

    cin>>n;

    long long int p;
    LFOR(i,1,sqrt(n)+1){
        p=n/i;
        if(i*p==n){
            mini=min(mini,p-1+i-1);
        }
    }
    cout<<mini<<endl;
}


Measured memory_bytes: 256
import java.util.*;
import java.util.Map.Entry;
 

public class Main{
	
	
	
	
	public static long answer = 0;
	public static long MOD=1000000007;
	
	
	

	

 
	
	//最大公約数・最小公倍数（セットで使う）
	public static long gcm(long a, long b) {
		long result = a;
		long k = 0;
		long n = b;
		do {
			k = result % n;
			result = n;
			n = k;
		} while(k != 0);
		return result;
	}
	
	public static long lcm(long a, long b) {
		long g;
		g = gcm(a, b);
		return a/g*b;
	}
	
	static long gcd(long a, long b) {
		if (b == 0) {
			return a;			
		}
		return gcd(b, a % b);
	}
	
	//等差数列
	static long tousasum(int n) {
		return (long)n*((long)n+1)/2;
	}
 
 
 
	//素数判定
	static boolean isPrime (int n) {
		if (n==2) return true;
		if (n<2 || n%2==0) return false;
		double d = Math.sqrt(n);
		for (int i=3; i<=d; i+=2) if(n%i==0){return false;}
		return true;
	}
 
 
	//倍数判定（10進数以外のときに有用）
	static boolean isMultiple (String s, int base, int m) {
		int temp = 0;
		for (int i=0; i<s.length(); i++) {
			temp = (temp*base+Character.getNumericValue(s.charAt(i)))%m;
		}
		if (temp==0) {return true;}
		return false;
	}
 
 
	//階乗
	static long factorial (int k) {
		long sum = 1;
		for(int i=1;i<=k;i++) {
			sum = (sum*i)%MOD;
		}
		return sum;
		
	}
 
 
	//進数変換
	static String toNbase (String sm, int m, int n) {
		return Long.toString(Long.parseLong(sm,m),n);
	}
	
	public static final long gcd_n(long[] param) {
	    final int len = param.length;
	    long g = gcd(param[0], param[1]);    //gcd(a, b) は以前作ったもの
	    for (int i = 1; i < len - 1; i++) {
	        g = gcd(g, param[i + 1]);       //gcd(a, b) は以前作ったもの
	    }
	    return g;
	}
	
	public static long lcm_n(long[] numbers) {
		long l;
		l = numbers[0];
		for (int i = 1; i < numbers.length; i++) {
			l = lcm(l, numbers[i]);
		}
		return l;
	}
	public static int H,W;
	public static char[][] c;
	public static boolean[][] b;
	
	

    
	
	
 public static void main(String[] args) {
	 
	 Scanner sc=new Scanner(System.in);
	 int N=sc.nextInt();
	 char[] c=sc.next().toCharArray();
	 long result = 1;
	 for(int i=0;i<N-1;i++) {
		 if(c[i]!=c[i+1]) {
			 result++;
		 }
	 }
	 System.out.println(result);

	 
	 
	
}
 
 
}


Measured memory_bytes: 25788
import java.util.*;

public class Main {

    public static void main(String args[]) {

        Scanner sc = new Scanner(System.in);

        int mod = (int)1e9 + 7;

        int n = sc.nextInt();
        int m = sc.nextInt();

        int block[] = new int[m];

        for (int i=0; i<m; i++){
            block[i] = sc.nextInt();
        }


        int sums[] = new int[n+1];

        boolean stone[] = new boolean[n+1];

        for (int i=0; i<m; i++) {
            stone[block[i]] = true;
        }


        if (m==0) {
            sums[0] = 1;
            sums[1] = 1;

            for (int i = 0; i < n - 1; i++) {
                if (stone[i + 2] == false) {
                    sums[i + 2] = (sums[i + 1] + sums[i]) % mod;
                } else if (stone[i + 2] == true) {
                    sums[i + 2] = 0;
                }
            }

            System.out.println(sums[n] % mod);
            return;

        }
        if (block[0]==0) {System.out.println(0);}
        else if (block[0]==1) {
            sums[0] = 1;
            sums[1] = 0;

            for (int i = 0; i < n - 1; i++) {
                if (stone[i + 2] == false) {
                    sums[i + 2] = (sums[i + 1] + sums[i]) % mod;
                } else if (stone[i + 2] == true) {
                    sums[i + 2] = 0;
                }
            }

            System.out.println(sums[n] % mod);

        }
        else{
            sums[0] = 1;
            sums[1] = 1;

            for (int i = 0; i < n - 1; i++) {
                if (stone[i + 2] == false) {
                    sums[i + 2] = (sums[i + 1] + sums[i]) % mod;
                } else if (stone[i + 2] == true) {
                    sums[i + 2] = 0;
                }
            }

            System.out.println(sums[n] % mod);
        }


    }

}


Measured memory_bytes: 46056
fn solve() {
    let s = std::io::stdin();
    let mut sc = Scanner { stdin: s.lock() };
    let n: usize = sc.read();
    let k: usize = sc.read();
    let mut h: Vec<usize> = sc.vec(n);
    h.sort();
    h.reverse();
    let result = h.iter().skip(k).fold(0, |sum, a| sum + a);
    println!("{}", result);
}

fn main() {
    std::thread::Builder::new()
        .stack_size(64 * 1024 * 1024) // 64MB
        .spawn(|| solve())
        .unwrap()
        .join()
        .unwrap();
}

//snippet from kenkoooo
pub struct Scanner<R> {
    stdin: R,
}

impl<R: std::io::Read> Scanner<R> {
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn read_line(&mut self) -> String {
        use std::io::Read;
        let buf = self
            .stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b'\n' || b == b'\r')
            .take_while(|&b| b != b'\n' && b != b'\r')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }

    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


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

bool f(int *a){
  bool ck=true;
  for(int k=0;k<9;k++){
    if(a[k]!=0) ck=false;
  }
  if(ck) return ck;
  for(int k=0;k<7;k++){
    if(a[k]>0&&a[k+1]>0&&a[k+2]>0){
      a[k]--;a[k+1]--;a[k+2]--;
      ck|=f(a);
      a[k]++;a[k+1]++;a[k+2]++;
    }
  }
  for(int k=0;k<9;k++){
    if(a[k]>=3){
      a[k]-=3;
      ck|=f(a);
      a[k]+=3;
    }
  }
  return ck;
}
  

int main(){
  string s;
  while(cin>>s){
    vector<int> v;
    int a[9]={0};
    for(string::iterator it=s.begin();it!=s.end();it++) a[*it-'1']++;
    for(int i=0;i<9;i++){
      bool flag=false;
      if(a[i]==4) continue;
      a[i]++;
      for(int j=0;j<9;j++){
	if(a[j]>=2){
	  a[j]-=2;
	  flag|=f(a);
	  a[j]+=2;
	}
      }
      if(flag) v.push_back(i+1);
      a[i]--;
    }
    if(v.size()==0){
      cout<<0<<endl;continue;
    }
    for(vector<int>::iterator it=v.begin();it!=v.end()-1;it++) cout<<*it<<" ";
    cout<<v.back()<<endl;
  }
  return 0;
}

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

int main()
{
    char A[11],B[11],C[11];
    cin >> A >> B >> C;
    char a = (int)A[0]-32;
    char b = (int)B[0]-32;
    char c = (int)C[0]-32;
    cout << a << b << c << endl;
    return 0;
}

Measured memory_bytes: 256
#include"bits/stdc++.h"
#define F(i,j,n) for(register int i=j;i<=n;i++)
#define D(i,j,n) for(register int i=j;i>=n;i--)
#define ll long long
#define P 998244353
using namespace std;
namespace io{
	const int L=(1<<19)+1;
	char ibuf[L],*iS,*iT,c;int f;
	char gc(){
		if(iS==iT){
			iT=(iS=ibuf)+fread(ibuf,1,L,stdin);
			return iS==iT?EOF:*iS++;
		}
		return*iS++;
	}
	template<class I>void gi(I&x){
		for(f=1,c=gc();c<'0'||c>'9';c=gc())if(c=='-')f=-1;
		for(x=0;c<='9'&&c>='0';c=gc())x=x*10+(c&15);x*=f;
	}
};
using io::gi;
using io::gc;
int n,m,a[200010],b[200010];ll z,x=1ll<<61,y=x,s[200010],f[200010],g[200010];
int main(){
	#ifdef JHR
	freopen("a.in","r",stdin);
	freopen("a.out","w",stdout);
	#endif
	gi(n);
	F(i,1,n)gi(a[i]),s[i]=s[i-1]+a[i];
	F(i,1,n)b[i]=b[i-1]+(a[i]+1&1);
	f[0]=0;F(i,1,n)f[i]=min(s[i],f[i-1]+(a[i]&1)+(a[i]==0)*2);
	g[n]=0;D(i,n,1)g[i-1]=min(s[n]-s[i-1],g[i]+(a[i]&1)+(a[i]==0)*2);
//	F(i,0,n)printf("%lld %lld %lld %d\n",s[i],f[i],g[i],b[i]);
	F(i,0,n){
		y=min(y,f[i]-b[i]);
		x=min(x,g[i]+b[i]+y);
//		printf("%lld %lld\n",x,y);
	}
	printf("%lld\n",x);
	return 0;
}



Measured memory_bytes: 7040
#include<bits/stdc++.h>
using namespace std;
#define fastio() ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define ll long long int
#define f first
#define s second
#define mp make_pair
#define pb push_back
#define M 1000000007
#define inf 1e9
#define pi 3.1415926536
#define mod 1000000007
#define fr(i,a,b,in) for(int i=a;i<b;i+=in)
#define frn(i,a,b,dc) for(int i=a;i>=b;i-=dc)
#define test(t) int t; cin>>t; while(t--)
int main()
{
	fastio();
	int n;
	cin>>n;
	int a[n];
	fr(i,0,n,1) cin>>a[i];
	sort(a,a+n);
	int ans=0;
	fr(i,0,n,1){
		fr(j,i+1,n,1){
			fr(k,j+1,n,1){
				if(a[i]!=a[j] && a[j]!=a[k] && a[k]!=a[i]){
					if(a[i]+a[j]>a[k])
						ans++;
				}
			}
		}
	}
	cout<<ans<<endl;
}

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

int main(){
  int n; cin >> n;
  vector<int> p(n);
  for(int pi=0; pi<n; ++pi) {
    cin>>p[pi];
    // 0-indexedに
    --p[pi];
  }
  
  vector<int> a(n), b(n),r(n);
  for(int pi=0; pi<n; ++pi){
    r[p[pi]] = pi;
  }
  for(int ai=0; ai<n; ++ai){
    a[ai] = n*ai + 1;
  }
  for(int bi=0; bi<n; ++bi){
    b[bi] = n*(n-bi) + r[bi] + 1;
  }
  
  for (int ai=0; ai<n; ++ai){
    cout << a[ai];
    if(ai<n-1) cout << " ";
    else cout << endl; 
  }
  for (int bi=0; bi<n; ++bi){
    cout << b[bi];
    if(bi<n-1) cout << " ";
    else cout << endl; 
  }
  
  return 0;
}

Measured memory_bytes: 896
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
#define all(x) (x).begin(),(x).end()
#define pll pair<ll,ll>
#define pii pair<int,int>
#define rep(i,n) for(int i=0;i<n;i++)
#define For(i,a,b) for(int i=a;i<b;i++)
#define sz(x) ((ll)(x).size())
#define pb push_back
#define mp make_pair
#define bit(n) (1LL<<(n))
#define F first
#define S second
#define debug(x) cerr << x << endl
#define Complex complex<double>
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
const ll INF = 1LL<<60;
const ll mod = (int)1e9 + 7;

/*
テストケース全てに目を通す
テストケースが2個以下だったらなんかある
N最小のコーナーケースがないか調べる
制約をしっかりと確認する（1からNまでの順列、全て異なる値などの制約も含め）
制約のn*mとn,mを読み違えない
操作の逆順を考える
オーバーフローしないか確かめる
Codeforcesではscanfを使う
modの引き算には+modをする
エラー出力は消す
エラー出力を消せ！！！！！
数値の区切り位置を誤読しない
cout << fixed;
cout << setprecision(n) << ans;
 */

int main() {
    int n,m;
    cin >> n >> m;
    int d[n];
    rep(i,n)d[i]=-1;
    rep(i,m){
        int s,c;
        cin >> s >> c;
        s--;
        if(d[s]!=-1 && d[s]!=c){
            cout << -1;
            return 0;
        }
        else d[s]=c;
    }
    rep(i,n){
        if(i==0){
            if(d[i]==0){
                if(n!=1){
                    cout << -1;
                    return 0;
                }
                else{
                    cout << 0;
                    return 0;
                }
            }
            else if(d[i]==-1){
                if(n==1)cout << 0;
                else cout << 1;
            }
            else cout << d[i];
        }
        else{
            if(d[i]==-1)cout << 0;
            else cout << d[i];
        }
    }


    
}

/*
*/


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define pq priority_queue
using namespace std;
const ll INF=(ll)1e9;
const ll MOD=(ll)1e9+7;
vector<int> dx={1,0,-1,0},dy={0,1,0,-1};
ll keta(ll a){
    ll k=0;
    while(a){
        a/=10;
        k++;
    }
    return k;
}

int main(){
    ll N,fa=0,sa=0,fb=0,sb=0,ac,bc;
    cin>>N;
    vector<ll> a,b;
    map<ll,ll> m,p;
    set<ll> s,t,s2,t2;
    for(ll i=0;i<N;i++){
        ll n;
        cin>>n;
        if(i%2==0){
            a.push_back(n);
            m[n]++;
        }else{
            b.push_back(n);
            p[n]++;
        }
    }
    for(ll i=0;i<N/2;i++){
        if(!s.count(a[i])){
            if(m[a[i]]>fa){
                fa=m[a[i]];
                ac=a[i];
            }
            s.insert(a[i]);
        }
         if(!t.count(b[i])){
            if(p[b[i]]>fb){
                fb=p[b[i]];
                bc=b[i];
            }
            t.insert(b[i]);
        }
    }

    for(ll i=0;i<N/2;i++){
        if(!s2.count(a[i])){
            if(m[a[i]]>sa&&ac!=a[i]){
                sa=m[a[i]];
            }
            s2.insert(a[i]);
        }
         if(!t2.count(b[i])){
            if(p[b[i]]>sb&&bc!=b[i]){
                sb=p[b[i]];
            }
            t2.insert(b[i]);
        }
    }
    
    if(ac==bc) cout<<N-max(fa+sb,fb+sa)<<endl;
    else cout<<N-fa-fb<<endl;
}


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

int main(){
  ll n;
  cin>>n;
  vector<ll> A(n);
  for(ll i=0;i<n;i++){
   	cin>>A[i]; 
  }
  vector<ll> B(n);
  for(ll i=0;i<n;i++){
  	cin>>B[i];
  }
  vector<ll> C(n-1);
  for(ll i=0;i<n-1;i++){
   cin>>C[i]; 
  }
  ll ans = 0;
  for(ll i=0;i<n;i++){
    if(i == 0){
    	ans += B[A[i]-1];
    }
    else{
      if(A[i-1] == A[i] - 1){
        ans += B[A[i]-1] + C[A[i]-2];
      }
      else{
        ans += B[A[i]-1];}
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll mod = 1e9+7;

int main(){

	ll n;
	cin>>n;
	ll ans = 0;
	for(int i = 1; i <= n; i++){
		for(int j = 1; j <= n; j++)
			for(int k = 1; k <= n; k++)
				ans += __gcd(i, __gcd(k,j));
	}

	cout<<ans<<"\n";
	return 0;
}

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

using namespace std;

int n,k,x,y;

int main()
{
	scanf("%d%d%d%d",&n,&k,&x,&y);
	if(n>k)printf("%d",k*x+(n-k)*y);
	else
	{
		printf("%d",n*x);
	}
	return 0;
}

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

# input
H, W = map(int, input().split())
a = [list(map(str, input().split())) for i in range(H)]

# solve & output
for i in range(H + 2):
    if i == 0 or i == H + 1:
        for _ in range(W + 2):
            if _ != W + 1:
                print('#', sep='', end='')
            else:
                print('#', sep='')
    else:
        for j in range(3):
            if j == 0:
                print('#', sep='', end='')
            elif j == 2:
                print('#', sep='')
            else:
                print(a[i - 1][0], sep='', end='')


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

int xcount[350000]={};
int ycount[350000]={};
vector<int> x;
vector<int> y;
map<pair<int,int>,int> ma;

int main(){
  int h,w,m;
  cin>>h>>w>>m;
  for(int i=0;i<m;i++){
    int a,b;
    cin>>a>>b;
    xcount[a]++;
    ycount[b]++;
    ma[make_pair(a,b)]++;
  }
  int xmax=0,ymax=0;
  for(int i=0;i<350000;i++){
    xmax=max(xmax,xcount[i]);
    ymax=max(ymax,ycount[i]);
  }
  for(int i=0;i<350000;i++){
    if(xmax==xcount[i]){
      x.push_back(i);
    }
    if(ymax==ycount[i]){
      y.push_back(i);
    }
  }
  int q=100,count=0;
  for(int i=0;i<x.size();i++){
    for(int j=0;j<y.size();j++){
      q=min(q,ma[make_pair(x[i],y[j])]);
      if(q==0){
        break;
      }
      //count++;
    }
  }
  //cout<<count<<endl;
  cout<<xmax+ymax-q<<endl;
}

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

int main() {
  int A;
  cin >> A;
  int X;
  int count = 0;
  for(int i = 1;i <= A;i++){
    cin >> X;
    if(i % 2 == 1 && X % 2 == 1){
      count++;
    }
  }
  cout << count << endl;
  
}


Measured memory_bytes: 3532
import java.util.Scanner;

class Main {

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

        var x = scaner.nextInt();
        var y = scaner.nextInt();

        var ans = "No";
        for (int i = 0; i <= x; i++) {
            if ((i*2) + (x-i)*4 == y ) {
                ans = "Yes";
                break;
            }
        }

        System.out.println(ans);

        scaner.close();
    }

}

Measured memory_bytes: 35932
#include <iostream>
#include <string>

using namespace std;

int main(void) {
	string s;
	int num, a, b, i;
	cin >> num >> a >> b >> s;
	a += b;
	for (i = 0; i < num; i++) {
		if (s[i] == 'a') {
			if (a > 0) {
				a--;
				printf("Yes\n");
				continue;
			}
		}
		else if (s[i] == 'b') {
			if (a > 0 && b > 0) {
				a--;
				b--;
				printf("Yes\n");
				continue;
			}
		}
		printf("No\n");
	}
	return 0;
}

Measured memory_bytes: 896
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdlib>
#include <map>
#include <iomanip>
#include <set>
#include <stdio.h>
#include <ctype.h>
using namespace std;
#define pie 3.141592653589793238462643383279
#define mod 1000000007
#define INF 1145141919364364
#define int long long
#define all(vec) vec.begin(),vec.end()
#define P pair<int,int>
#define S second
#define F first
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x / gcd(x, y)*y;
}
bool prime(int x) {
	for (int i = 2; i <= sqrt(x); i++) {
		if (x%i == 0)return false;
	}
	return true;
}
int kai(int x, int y) {
	int res = 1;
	for (int i = x - y + 1; i <= x; i++) {
		res *= i; res %= mod;
	}
	return res;
}
int mod_pow(int x, int y, int m) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}


int comb(int x, int y) {
	if (y > x)return 0;
	return kai(x, y) * mod_pow(kai(y, y), mod - 2, mod) % mod;
}

int n, p[200000];
int ans;
int k = INF;

signed main() {
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> p[i];
		if (k >= p[i]) {
			ans++;
			k = p[i];
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 1792
N = int(input())
A = sorted([int(i) for i in input().split()], reverse=True)

def gcd(a, b):
  if b == 0:
    return a
  return gcd(b, a%b)
g = A[0]
for a in A[1:]:
  g = gcd(g, a)
print(g)

Measured memory_bytes: 14224
using System;
using System.Collections.Generic;

public class CSharp
{
    public static void Main()
    {
        Kyopuro chokudai = new Kyopuro();
        chokudai.AtCoder();
    }
}

public class Kyopuro
{

    int n;
    int[] p;

    public void AtCoder()
    {
        string[] input;
        n = int.Parse(Console.ReadLine());
        input = Console.ReadLine().Split(' ');
        p = new int[n];
        for(int i=0; i<n; i++)
        {
            p[i] = int.Parse(input[i]);
        }
        Array.Sort(p);
        
        Console.WriteLine(p[n/2]-p[n/2-1]);
        
    }
    public static void DebugWL(object x) { System.Diagnostics.Debug.WriteLine(x); }
}


Measured memory_bytes: 18400
#include <iostream>
#include <cstdio>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <cstring>
#include <functional>
#include <cmath>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)
#define rep1(i,n) for(int i=1;i<=(n);++i)
#define all(c) (c).begin(),(c).end()
#define fs first
#define sc second
#define pb push_back
#define show(x) cout << #x << " " << x << endl
#define mz(x,y) x=min(x,y)
int inf=1e9;
int main(){
	while(true){
		int n;
		cin>>n;
		if(n==0) break;
		int t[16][17];
		int dp[1<<16];
		rep(i,n) rep(j,n+1) cin>>t[i][j];
		rep(i,1<<n) dp[i]=inf;
		dp[0]=0;
		rep(i,1<<n){
			int a[16]={};
			rep(j,n) a[j]=(i>>j)&1;
			rep(k,n){
				if(a[k]==1) continue;
				int mn=t[k][0];
				rep(s,n) if(a[s]==1) mz(mn,t[k][s+1]);
				mz(dp[i+(1<<k)],dp[i]+mn);
			}
		}
		cout<<dp[(1<<n)-1]<<endl;
	}
}

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

int main() {
  int a, b;
  cin >> a >> b;
  string as = "";
  string bs = "";
  for(int i = 0; i < a; i++){
      bs += to_string(b);
  }
  for(int i = 0; i < b; i++){
      as += to_string(a);
  }
  if(as >= bs)cout << bs << endl;
  else cout << as << endl;
  return 0;
}

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

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

int main(){
  string s;
  cin >> s;
  
  vector<char>ans;
  rep(i,s.length()){
    char now = s.at(i);
    if(now=='0') ans.push_back('0');
    if(now=='1') ans.push_back('1');
    if(now=='B'&&ans.size()) ans.pop_back();
  }

  rep(i, ans.size())cout << ans.at(i);
}

Measured memory_bytes: 3640
#[macro_use]
mod input {

use std;
use std::io;

const SPLIT_DELIMITER: char = ' ';

#[macro_export]
#[allow(unused_macros)]
macro_rules! input {
    ( $($x:expr ),*) => {
        {
            let temp_str = input_line_str();
            let mut split_result_iter = temp_str.split_whitespace();
                $(
                let buf_split_result = split_result_iter.next();
                let buf_split_result = buf_split_result.unwrap();
                    ($x) = buf_split_result.parse().unwrap();
                )*
        }
    };
}

#[allow(dead_code)]
pub fn input_line_str() -> String {
    let mut s = String::new();
    io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

#[allow(dead_code)]
pub fn p<T>(t: T)
where
    T: std::fmt::Display,
{
    println!("{}", t);
}

#[allow(dead_code)]
pub fn input_vector2d<T>(line: usize) -> Vec<Vec<T>>
where
    T: std::str::FromStr,
{
    let mut v: Vec<Vec<T>> = Vec::new();

    for _ in 0..line {
        let vec_line = input_vector();
        v.push(vec_line);
    }
    v
}

#[allow(dead_code)]
pub fn input_vector<T>() -> Vec<T>
where
    T: std::str::FromStr,
{
    let mut v: Vec<T> = Vec::new();

    let s = input_line_str();
    let split_result = s.split(SPLIT_DELIMITER);
    for z in split_result {
        let buf = match z.parse() {
            Ok(r) => r,
            Err(_) => panic!("Parse Error"),
        };
        v.push(buf);
    }
    v
}

#[allow(dead_code)]
pub fn str2vec(s: &str) -> Vec<char> {
    let mut v: Vec<char> = Vec::new();
    for c in s.chars() {
        v.push(c);
    }
    v
}

}
use input::*;

fn main() {
    let (n, m, x, y): (usize, usize, isize, isize);
    input!(n, m, x, y);
    let xx = input_vector::<isize>();
    let yy = input_vector::<isize>();
    let mut flag = true;

    for z in xx.iter().max().unwrap() + 1..yy.iter().min().unwrap() + 1 {
        if x < z && z <= y {
            flag = false;
            break;
        }
    }

    if flag {
        p("War");
    } else {
        p("No War");
    }
}

Measured memory_bytes: 4352
/*package whatever //do not write package name here */

import java.util.*;
import java.lang.*;
import java.lang.reflect.Array;
import java.io.*;

class Main {
    static int dp[][];
    
	public static void main (String[] args)throws IOException{
		//code
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		
		String s=br.readLine();
		String t=br.readLine();
           int n=s.length(),m=t.length();


        dp=new int[n+1][m+1];
        for(int i=1;i<=n;i++){
            for(int j=1;j<=m;j++){
                if(s.charAt(i-1)==t.charAt(j-1))dp[i][j]=dp[i-1][j-1]+1;
                else dp[i][j]=Math.max(dp[i-1][j],dp[i][j-1]);
            }
        }
        StringBuilder res=new StringBuilder();
        int i=n,j=m;
        while(i>0&&j>0){
           if(dp[i][j]>dp[i-1][j]&&dp[i][j]>dp[i][j-1]){
               res.append(s.charAt(i-1));
               i--;j--;
           }
           else{
               if(dp[i-1][j]>dp[i][j-1])i--;
               else j--;
           }

        }
        
           // for( i=1;i<=n;i++)
             //System.out.println(Arrays.toString(dp[i]));
            System.out.print(res.reverse());
		
		    
	
		
	}
}


Measured memory_bytes: 80468
#include<bits/stdc++.h>
#define N 200100
using namespace std;
int a[N];
int main(){
	int n,l,r;
	scanf("%d",&n);
	for(int i=1;i<n+n;i++){
		scanf("%d",&a[i]);
	}
	l=1,r=n+n;
	while(l+1<r){
		int m=(l+r)/2;
		int sl=0,sr=0;
		while(sl<n-1&&(a[n-sl]<m)!=(a[n-sl-1]<m)) sl++;
		while(sr<n-1&&(a[n+sr]<m)!=(a[n+sr+1]<m)) sr++;
		if(sl<sr){
			if(a[n-sl]<m) r=m;
			else l=m;
		}
		else{
			if(a[n+sr]<m) r=m;
			else l=m;
		}
	}
	printf("%d\n",l);
	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
#define sz(x) int(x.size())
using ll = long long;
using P = pair<int,int>;
const ll LLINF = numeric_limits<long long>::max();
const int mod = 1000000007;
const int INF = 1001001001;

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

    for(int i=0;i<T.length();i++){
        if(T[i] == '?'){
            T[i] = 'D'; 
        }
    }
    cout << T;
    return 0;
}

Measured memory_bytes: 3736
n, m = gets.strip.split.map(&:to_i)
graph = {}
m.times do
  a, b = gets.strip.split.map(&:to_i)
  if a == 1 || b == 1 || a == n || b == n
    graph[a].nil? ? graph[a] = [b] : graph[a] << b
    graph[b].nil? ? graph[b] = [a] : graph[b] << a
  end
end

(1..n).each do |i|
  edges = graph[i]
  if edges && edges.include?(1) && edges.include?(n)
    puts "POSSIBLE"
    exit 0
  end
end

puts "IMPOSSIBLE"


Measured memory_bytes: 29180
#include<stdio.h>
#include<cstdlib>
#include<iostream>
#include<string>
#include<sstream>

using namespace std;

int main(){
    int N;
    cin >> N;
    int A[N];
    double test=0;
    for (int i = 0; i < N; i++){
        cin >> A[i];
        test += 1.0/A[i];
    }
    double ans = 1.0/test;
    cout << ans <<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cmath>
#include <set>
#include <queue>
#include <map>
#include <cstdio>
#include <cstring>
#include <string>
#include <stack>
#include <algorithm>
#include <limits.h>
#include <bits/stdc++.h>
#define fw(x) freopen("x.txt","w",stdout)
#define For(i,a,b,c) for(int i = a;i < b;i+=c)
#define REP(i,n) for(int i = 0;i < n;++i)
#define REP1(i,n) for(int i = 1; i<=n;i++)
#define mem(a,s) memset(a,s,sizeof a)
#define fast ios_base::sync_with_stdio(0);cin.tie(NULL)
#define pf printf
#define sc scanf
#define ll long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define all(v) v.begin(),v.end()
#define vii vector<int>
#define vll vector<ll>
#define vss vector<string>
#define debug(x)  cout<<#x"="<<(x)<<endl
#define pb push_back


using namespace std;


// moves

//int dx[]= {0,0,1,-1};/*4 side move*/
//int dy[]= {-1,1,0,0};/*4 side move*/
//int dx[]= {1,1,0,-1,-1,-1,0,1};/*8 side move*/
//int dy[]= {0,1,1,1,0,-1,-1,-1};/*8 side move*/
//int dx[]={1,1,2,2,-1,-1,-2,-2};/*knight move*/
//int dy[]={2,-2,1,-1,2,-2,1,-1};/*knight move*/


//big_mod

//ll bigmod(ll a,ll b,ll m)
//{if(b == 0) return 1%m;ll x = bigmod(a,b/2,m);x = (x * x) % m;if(b % 2 == 1) x = (x * a)% m;return x;}
//ll BigMod(ll B,ll P,ll M){ ll R=1%M; while(P>0) {if(P%2==1){R=(R*B)%M;}P/=2;B=(B*B)%M;} return R;} /// (B^P)%M

//ll getBit(ll num, int idx) {return ((num >> idx) & 1ll) == 1ll;}
//ll setBit1(ll num, int idx) {return num or (1ll<<idx);}
//ll setBit0(ll num, int idx) {return num & ~(1ll<<idx);}
//ll flipBit(ll num, int idx) {return num ^ (1ll<<idx);}
ll war[101];
ll var[101];
ll ans[101][100001];
void npsk(int n, int w){
    if(n<=0||w<=0) return;
    if(war[n]>w){
        if(ans[n-1][w] == 0 ) npsk(n-1, w);
        ans[n][w] = ans[n-1][w];
    }
    else{
        if(ans[n-1][w-war[n]] == 0 ) npsk(n-1, w-war[n]);
        if(ans[n-1][w] == 0 ) npsk(n-1, w);
        ans[n][w] = max(var[n] + ans[n-1][w-war[n]], ans[n-1][w] );
    }
    //cout<<"n: "<<n<<" w: "<<w<<" ans: "<<ans[n][w]<<'\n';
}
int main()
{
    fast;
    int n, w;
    cin>>n>>w;
    memset(ans, 0, sizeof(ans));
    //REP(i, 101) ans[0][i] = 0;
    REP1(i, n){
        cin>>war[i]>>var[i];
    }
    npsk(n, w);
    cout<<ans[n][w]<<'\n';
    return 0;
}



Measured memory_bytes: 79232
import sys
import math
import collections
import bisect
import itertools

# import numpy as np

sys.setrecursionlimit(10 ** 7)
INF = 10 ** 20
MOD = 10 ** 9 + 7
# MOD = 998244353

ni = lambda: int(sys.stdin.readline().rstrip())
ns = lambda: map(int, sys.stdin.readline().rstrip().split())
na = lambda: list(map(int, sys.stdin.readline().rstrip().split()))
na1 = lambda: list(map(lambda x: int(x) - 1, sys.stdin.readline().rstrip().split()))


# ===CODE===

def main():
    s = list(input())

    for i in range(len(s)):
        if i - 1 >= 0:
            if s[i] == s[i - 1]:
                print(i, i + 1)
                exit()
        if i - 2 >= 0:
            if s[i] == s[i - 2]:
                print(i - 1, i + 1)
                exit()

    print(-1, -1)


if __name__ == '__main__':
    main()


Measured memory_bytes: 10172
#include<stdio.h>
#include<math.h>
#define PI 3.1415926535
int main()
{
  int a,b,c;
  int i,j;
  double n,r;
  double rad;
  double l2;
  scanf("%d%d%d",&a,&b,&c);
  rad=c*PI/180;

  printf("%f\n",a*b*sin(rad)/2.0);

  l2=a*a+b*b-2*a*b*cos(rad);
  n=0;
  for(i=0;i<9;i++)
    {
      r=1;
      for(j=0;j<i;j++) r/=10.0;
      while(1)
	{
	 
	  if((n+r)*(n+r)>=l2) break;
	  else n+=r;
	}
    }
  printf("%f\n",a+b+n);

  printf("%f\n",b*sin(rad));

  return 0;
}

Measured memory_bytes: 636
from operator import mul
from functools import reduce


def cmb(n, r):
    r = min(n-r, r)
    if r == 0:
        return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1, r + 1))
    return over // under


def main():
    n, m = map(int, input().split())
    MOD = 10 ** 9 + 7

    m0 = m
    primes = {}
    p = 2
    rtm = int(m ** 0.5 + 1)
    # prime factorization
    while m0 > 1:
        if m0 % p == 0:
            m0 /= p
            if p in primes:
                primes[p] += 1
            else:
                primes[p] = 1
        else:
            p += 1
        # m is prime
        if rtm <= p:
            primes[1] = 1
            break

    ans = 1
    for _, v in primes.items():
        ans *= cmb(n - 1 + v, v)
        ans %= MOD
    print(ans)


main()


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

#define ASC(vec) vec.begin(), vec.end()		// 昇順ソート 例：sort(ASC(vec));
#define DESC(vec) vec.rbegin(), vec.rend()	// 降順ソート 例:sort(DESC(vec));
#define rep(i, n) for(int i = 0; i < (n); i++)
#define Rep(i, n) for(int i = 1; i < n; i++)
#define REP(i, vec) for(auto i = vec.begin(); i != vec.end(); ++i)

const int mod = 1000000007;
const int inf = (1 << 21);
const long long INF = 1LL << 60;

using ii = pair<int, int>;
using ll = long long;
using vi = vector<int>;
using vd = vector<double>;
using vb = vector<bool>;
using vl = vector<ll>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;
using vvb = vector<vector<bool>>;
using vii = vector<pair<int, int>>;
using vll = vector<pair<ll, ll>>;

template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline T GCD(T a, T b) { return b ? GCD(b, a % b) : a; }
template<class T> inline T LCM(T a, T b) { return (a + (b - 1)) / b; }

int round_int(int a, int b) { return (a + (b - 1)) / b; }

constexpr array<int, 9> dx = { 0, 1, 0, -1, -1, 1, 1, -1, 0 };
constexpr array<int, 9> dy = { 1, 0, -1, 0, 1, 1, -1, -1, 0 };

// ──────────────────────────────────────────────────────────────────

int f(int n) {
	int res = 0;
	for (int i = 1; i <= n; ++i) {
		if (n % i == 0) res++;
	}
	return res;
}

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

	int ans = 0;
	for (int i = 1; i <= n; i += 2) {
		if (f(i) == 8) ans++;
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
<?php
fscanf(STDIN, '%d', $A);
fscanf(STDIN, '%d', $B);
fscanf(STDIN, '%d', $C);
fscanf(STDIN, '%d', $X);

$count = 0;
for($i = 0; $i <= $A; $i++){
    for($j = 0; $j <= $B; $j++){
        for($k = 0; $k <= $C; $k++){
            $total = 500*$i + 100*$j + 50*$k;
            if($total == $X){
                $count++;
            }
        }
    }
}
print $count;

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

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

#define DEBUG(x) cout<<#x<<": "<<(x)<<'\n'
#define DEBUG_VEC(v) cout<<#v<<":";REP(i, v.size())cout<<' '<<v[i];cout<<'\n'
#define ALL(a) (a).begin(), (a).end()

template<typename T> inline void CHMAX(T& a, const T b) {if(a<b) a=b;}
template<typename T> inline void CHMIN(T& a, const T b) {if(a>b) a=b;}

constexpr ll MOD=1000000007ll;
// constexpr ll MOD=998244353ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

const double EPS=1e-11;
#define EQ0(x) (abs((x))<EPS)
#define EQ(a, b) (abs((a)-(b))<EPS)

template<typename T> T gcd(T a, T b){
  if(b==0){
    return a;
  }
  return gcd(b, a%b);
}

template<typename T> T lcm(T a, T b){
  return a/gcd(a, b)*b;
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  // cout<<setprecision(10)<<fixed;
  int n;
  ll m, a[125252];
  cin>>n>>m;
  REP(i, n){
    cin>>a[i];
  }
  ll cur=1;
  REP(i, n){
    cur=lcm(cur, a[i]/2);
    if(cur>m){
      cout<<0<<'\n';
      return 0;
    }
  }
  int num=1;
  ll b=cur;
  while(b%2==0){
    b/=2;
    ++num;
  }
  REP(i, n){
    int tmp=0;
    while(a[i]%2==0){
      a[i]/=2;
      ++tmp;
    }
    if(num!=tmp){
      cout<<0<<'\n';
      return 0;
    }
  }
  m-=cur;
  ll ans=m/(cur*2)+1;
  cout<<ans<<'\n';
  return 0;
}


Measured memory_bytes: 1024
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int a = scan.nextInt();
		int b = scan.nextInt();
		scan.close();
		System.out.println((a+b>=24)? a+b-24:a+b);
	}
}

Measured memory_bytes: 21844