akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <unordered_map>

using namespace std;
using ll = long long;

void _cin(){} template <class Head, class... Tail> void _cin(Head&& head, Tail&&... tail){ cin >> head; _cin(forward<Tail>(tail)...); }
void _cout(){ cout << "\n"; } template <class Head, class... Tail> void _cout(Head&& head, Tail&&... tail){ cout << head; _cout(forward<Tail>(tail)...); }
int gcd(int a, int b){ return (b == 0) ? a : gcd(b, a % b); }
template<typename S, typename T> ostream& operator<<(ostream &os, const pair<S, T> &p){ cout << "[" << p.first << ", " << p.second << "]"; return os; }

#define Sq(x) (x)*(x)
#define For(i, n) for(int i = 0; i < (n); i ++)
#define Rep(n) For(_, n)
#define Range(c) c.begin(), c.end()
#define RevRange(c) c.rbegin(), c.rend()
#define Contains(c, x) (find(Range(c), x) != c.end())
#define Search(rb, re, x) distance(rb, find(rb, re, x))
#define Sort(a) sort(Range(a))
#define DeSort(a) sort(RevRange(a))
#define Reverse(c) reverse(Range(c))
#define Unique(a) a.erase(unique(Range(a)), a.end())
#define Cusum(T, xs, sxs) vector<T> sxs(xs.size()+1); For(i, (int)xs.size()) sxs[i+1] = sxs[i] + xs[i]
#define Cin(T, ...) T __VA_ARGS__; _cin(__VA_ARGS__)
#define Cins(T, n, xs) vector<T> xs(n); For(i, n) cin >> xs[i]
#define Cins2(T, n, xs, ys) vector<T> xs(n), ys(n); For(i, n) cin >> xs[i] >> ys[i]
#define Cins3(T, n, xs, ys, zs) vector<T> xs(n), ys(n), zs(n); For(i, n) cin >> xs[i] >> ys[i] >> zs[i]
#define Cinss(T, n, m, xs) Vec2(T, n, m, xs); For(i, n) For(j, m) cin >> xs[i][j]
#define Cinm(T, n, map) unordered_map<T, int> map; Rep(n){ Cin(T, x); map[x] ++; }
#define Cout(...) _cout(__VA_ARGS__)
#define Couts(xs) { for(const auto &e : xs) cout << e << " "; cout << "\n"; }
#define Coutyn(cond) Cout((cond) ? "yes" : "no")
#define CoutYn(cond) Cout((cond) ? "Yes" : "No")
#define CoutYN(cond) Cout((cond) ? "YES" : "NO")
#define Return(expr) { Cout(expr); return 0; }
#define vc vector
#define Mini(a, x) a = min(a, x)
#define Maxi(a, x) a = max(a, x)

// constexpr int MOD = 1e9+7;

int main(void){
    Cin(string, a);
    Cout(a == "ABC" ? "ARC" : "ABC");
}

Measured memory_bytes: 3600
#include <iostream>
#include <string>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <vector>
#include <map>

using namespace std;

int main(void) {
	
	int n,m;
	cin >>n >>m;
	
	int k[n],a[n][m],i,j,ch[m]={0};
	for (i=0 ; i<n ; i++) {
		cin >>k[i];
		for (j=0 ; j<k[i] ; j++) {
			cin >>a[i][j];
			ch[a[i][j]-1]++;
		}
	}
	
	int ans=0;
	for (i=0 ; i<m ; i++) {
		if (ch[i]==n) ans++;
	}
	cout <<ans <<endl;
	
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,n) for(int i=a;i<n;i++)
using namespace std;
typedef long long ll;
int a[10010];
int fuck[110][110];
int main()
{
    int h,w;
    while(scanf("%d%d",&h,&w)!=EOF)
    {
        int n;
        scanf("%d",&n);
        rep(i,1,n+1)
        {
            scanf("%d",&a[i]);
        }
        int cnt=1;
        rep(i,1,h+1)
        {
            if(i&1)
            {
                rep(j,1,w+1)
                {
                   if(a[cnt]>0) 
                   {
                        fuck[i][j]=cnt;
                        --a[cnt];
                   }
                   else if(a[cnt]==0) 
                   {
                        ++cnt;
                        fuck[i][j]=cnt;
                        --a[cnt];
                   }
                }
            }
            else
            {
                for(int j=w;j>=1;--j)
                {
                    if(a[cnt]>0) {fuck[i][j]=cnt;--a[cnt];}
                    else if(a[cnt]==0) {++cnt;fuck[i][j]=cnt;--a[cnt];}
                }
            }
        }
        for(int i=1;i<=h;++i)
        {
            for(int j=1;j<=w;++j)
            {
                if(j!=w) printf("%d ",fuck[i][j]);
                else printf("%d\n",fuck[i][j]);
            }
        }
    }
    return 0;
}


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

long long A,B,K;

int main(){
	scanf("%lld%lld%lld",&A,&B,&K);
	if(A>=K){
		printf("%lld %lld\n",A-K,B);
	}
	else{
		printf("%lld %lld\n",0ll,max(B-(K-A),0ll));
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#define int long long
using namespace std;
signed main() {
	int X, A, B;
	cin >> X >> A >> B;

	cout << (X - A) % B << endl;
}

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


using namespace std ;

    int main() {
    	
       string k {""} ;
       
       char rainy {'R'};
       
       char sunny {'S'} ;
       
       
       int r {0} ;
 
       char string[3] ;
       
       cin>>k;
       
       
       
       
       for( int j {0} ; j < 3 ; j++){
       	
       	if(k.at(j) == rainy){
       		
       		r++ ;
       		
       	}
       	
       } 
       
       if((k.at(0) == rainy) && (k.at(1) == sunny)  && (k.at(2) == rainy)){
       	
       	r = 1 ;
       	
       }
       
       cout<<r;
       
       

    }

Measured memory_bytes: 3620
//Radhe Radhe
#include<bits/stdc++.h>
#define godspeed  ios_base:: sync_with_stdio(false); cin.tie(0); cout.tie(0);

#define limit 1000000000000000000 //1e18
#define mod 1000000007 //1e9+7
#define llu long long unsigned
#define ll long long
#define ld long double
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define rep(i,n)    for(ll i=0; i<n; i++)
#define rep1(i,a,b)    for(ll i=a; i<b; i++)
#define repV(i,n)    for(ll i=0; i<v.size(); i++)
#define fixed cout.setf(ios::fixed);
#define Precise cout.precision(7);
#define yes cout<<"Yes"<<'\n';
#define no cout<<"No"<<'\n';
using namespace std;

int main()
{
    godspeed
    llu  i,j,n,k,x,mult=1;
    cin>>n;
    bool zero=0;
    vector<llu>v(n);
    for(i=0;i<n;i++)
    {
        cin>>v[i];
        if(v[i]==0)
            zero=1;
    }
    if(zero)
       return cout<<0<<endl,0;

    for(i=0;i<n;i++)
    {
        if(limit/mult>=v[i])
        {
            mult*=v[i];
        }
        else
            return cout<<"-1"<<endl,0;

    }

        cout<<mult<<endl;

    return 0;
}


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

int main()
{
   // 高橋君の宿泊数
    int stay;
    cin >> stay;

    // ホテルの宿泊境界値
    int line;
    cin >> line;

    // 宿泊金額（Kまで）
    int value1;
    cin >> value1;

	// 宿泊金額（K＋1から）
    int value2;
    cin >> value2;


	// 出力
    if( line + 1 <= stay ) {
		int payment = line * value1 + (stay - line) * value2;

		cout << payment;
	}
	else {
		cout << (stay * value1);
	}
    
	return 0;
}

Measured memory_bytes: 256
fun main(args: Array<String>) {
    val (S,T) = readStringList()
    var (A,B) = readIntList()
    val  u = readString()
    when (u){
        S-> A--
        T->B--
    }
    println("$A $B")
}

fun readString() = readLine()!!
fun readStringList() = readLine()!!.split(" ")
fun readInt() = readLine()!!.toInt()
fun readLong() = readLine()!!.toLong()
fun readIntList() = readLine()!!.split(" ").map(String::toInt)
fun readLongList() = readLine()!!.split(" ").map(String::toLong)

Measured memory_bytes: 36024
import sys
input = sys.stdin.readline

n = int(input())
a = [int(input()) for _ in range(n)]
ans=max(a)
if a.count(ans)>1:
    for _ in range(n):
        print(ans)
else:
    for i in range(n):
        print(ans if a[i]!=ans else sorted(a)[-2])

Measured memory_bytes: 57908
N, M = map(int, input().split())
graph = [[False for _ in range(N+1)] for __ in range(N+1)]
for _ in range(M):
    a, b = map(int, input().split())
    graph[a][b] = True
    graph[b][a] = True

def dfs(v, visited):
    if len(visited) == N:
        return 1
    ret = 0
    for i in range(1,N+1):
        if graph[v][i] and not i in visited:
            visited[i] = True
            ret += dfs(i, visited)
            visited.pop(i)
    return ret

print(dfs(1, {1: True}))

Measured memory_bytes: 42588
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<array>
#include<map>
#include<iomanip>
#include<assert.h>
#include<bitset>
using namespace std;
typedef long long int llint;
typedef long double lldo;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase
const llint mod=1e9+7;
const llint big=2.19e18+1;
const long double pai=3.141592653589793238462643383279502884197;
const long double eps=1e-15;
template <class T,class U>void mineq(T& a,U b){if(a>b){a=b;}}
template <class T,class U>void maxeq(T& a,U b){if(a<b){a=b;}}
llint gcd(llint a,llint b){if(a%b==0){return b;}else return gcd(b,a%b);}
llint lcm(llint a,llint b){return a/gcd(a,b)*b;}
template<class T> void SO(T& ve){sort(ve.begin(),ve.end());}
template<class T> void REV(T& ve){reverse(ve.begin(),ve.end());}
template<class T>llint LBI(vector<T>&ar,T in){return lower_bound(ar.begin(),ar.end(),in)-ar.begin();}
template<class T>llint UBI(vector<T>&ar,T in){return upper_bound(ar.begin(),ar.end(),in)-ar.begin();}
int main(void){
	cin.tie(0);
	ios::sync_with_stdio(false);
	llint i,k;cin>>k;
	//まずは観測
	//1~9
	//表10～99
	//そのあとは9999...
	vector<pair<llint,int>>snuke;
	for(i=1;i<=9;i++){snuke.pub(mp((llint)i,i));}
	for(i=1;i<=9;i++){snuke.pub(mp((llint)i*10+9,i+9));}
	llint kake=1;
	for(int h=0;h<14;h++){
		//hはそのあとの9の数
		for(i=100;i<=999;i++){
			llint deg=(i+1)*kake -1;
			llint gg=deg;
			int sum=0;
			while(gg>0){sum+=gg%10;gg/=10;}
			while(snuke.back().fir*sum>deg*snuke.back().sec){snuke.pob();}
			snuke.pub(mp(deg,sum));
		}
		kake*=10;
	}
	for(i=0;i<k;i++){cout<<snuke[i].fir<<endl;}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i = (a); i <= (b); i++)
#define rng(a) a.begin(), a.end()
#define ina(n,a) cin >> n; for(int i = 1; i <= n; i++) cin >> a[i]
#define sz(x) (int)(x).size()
#define se second
#define fi first
#define prev            coyhhhhhhyoc    
#define next          sdNNNmNNNNNNNmds  
#define y0           hNNNNy_yNNNNNN_sNh
#define y1          mNNNNNdtdNNNNNNtsNNm
#define yn          mNNNNNNNNy___smNNNms
#define tm            oooooosyysooooot 
#define read               tyhyt        
#define rank              ytmNmo         
#define index              yyy
#define pb push_back
#define pcnt __builtin_popcountll
#define rrep(i,a,b) for(int i = (b); i >= (a); i--)
#define rall(x,a) for(auto x : a)
#define MOD 1000000007
#define endl "\n"
typedef long long ll;
using namespace std;

const int N = 111111;
vector<pair<int, int> > tree[N];
int col[N];
int n;

void dfs(int u, int p = -1) {
    rall(e, tree[u]) {
        if(e.fi != p) {
            col[e.fi] = col[u] ^ (e.se & 1);
            dfs(e.fi, u);
        }
    }
}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cin >> n;
    rep(i, 1, n - 1) {
        int u, v, w;
        cin >> u >> v >> w;
        tree[u].pb(make_pair(v, w));
        tree[v].pb(make_pair(u, w));
    }
    dfs(1);
    rep(i, 1, n) {
        cout << col[i] << endl;
    }
    return 0;
}


Measured memory_bytes: 8704
def calc(n, r, mod):
    p, q = 1, 1
    for i in range(r):
        p = p * (n - i) % mod
        q = q * (i + 1) % mod
    return p * pow(q, mod - 2, mod) % mod
   
n, a, b = map(int,input().split())
ans = pow(2,n,10**9+7)
ans_a = calc(n,a,10**9+7)
ans_b = calc(n,b,10**9+7)
ans -= (ans_a + ans_b)

ans = ans % (10**9+7)
print(ans-1)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define FOR(v, a, b) for(int v = (a); v < (b); ++v)
#define FORE(v, a, b) for(int v = (a); v <= (b); ++v)
#define REP(v, n) FOR(v, 0, n)
#define REPE(v, n) FORE(v, 0, n)
#define REV(v, a, b) for(int v = (a); v >= (b); --v)
#define ALL(x) (x).begin(), (x).end()
#define ITR(it, c) for(auto it = (c).begin(); it != (c).end(); ++it)
#define RITR(it, c) for(auto it = (c).rbegin(); it != (c).rend(); ++it)
#define EXIST(c,x) ((c).find(x) != (c).end())
#define LLI long long int
#define fst first
#define snd second
#ifdef DEBUG
#include <boost/core/demangle.hpp>
#define dump(x) cerr << "L" << __LINE__ << ": in " << __PRETTY_FUNCTION__ << " \e[32;1m" << boost::core::demangle(typeid(x).name()) << "\e[37m" << " " << (#x) << " = " << (x) << "\e[m" << endl;
#else
#define dump(x)
#endif
using namespace std;
template <typename T> using V = vector<T>;
template <typename T, typename U> using P = pair<T,U>;
template <typename I> void join(ostream &ost, I s, I t, string d=" "){for(auto i=s; i!=t; ++i){if(i!=s)ost<<d; ost<<*i;}ost<<endl;}
template <typename T> istream& operator>>(istream &is, vector<T> &v){for(auto &a : v) is >> a; return is;}
template <typename T, typename U> istream& operator>>(istream &is, pair<T,U> &p){is >> p.first >> p.second; return is;}

template <typename T> ostream& operator<<(ostream &os, vector<T> &v){os << "{";ITR(i,v){if(i!=v.begin())os << ","; os << *i;}os << "}"; return os;}
template <typename T, typename U> ostream& operator<<(ostream& os, pair<T,U> &p){os << "(" << p.first << "," << p.second << ")"; return os;}

template <typename T> T& chmin(T &a, const T &b){return a = min(a,b);}
template <typename T> T& chmax(T &a, const T &b){return a = max(a,b);}

template <LLI INF> LLI knapsack_small_value(int N, LLI cap, const vector<int> &w, const vector<int> &v){
  int MAX_V = accumulate(ALL(v), 0);
  vector<vector<LLI>> dp(N+1, vector<LLI>(MAX_V+1, INF));

  dp[0][0] = 0;

  REP(i,N){
    REPE(j,MAX_V){
      chmin(dp[i+1][j], dp[i][j]);
      if(j+v[i] <= MAX_V) chmin(dp[i+1][j+v[i]], dp[i][j]+w[i]);
    }
  }

  LLI ret = 0;

  REPE(i,MAX_V){
    if(dp[N][i] <= cap) ret = i;
  }

  return ret;
}

LLI dp[110][101000];

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

  int N,W; cin >> N >> W;
  vector<int> w(N), v(N);
  REP(i,N) cin >> w[i] >> v[i];

  LLI ans = knapsack_small_value<1LL<<60>(N,W,w,v);

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


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

int main(){
	cin.tie(0),ios::sync_with_stdio(false);
	string s,t; cin>>s>>t;
	string ans="No"s;
	for(int i=0;i<s.size();++i){
		if(s==t)ans="Yes"s;
		s=s.back()+s.substr(0,s.size()-1);
	}
	cout<<ans<<"\n"s;
}

Measured memory_bytes: 256
a = int(input())
b = [9, 1000-100, 100000-10000]
c = 0
d = len(str(a))
if d%2==1:
    c = a-10**(d-1)+1
    d -= 1
d -= 1
i=0
while d>0:
    c += b[i]
    i += 1
    d -= 2
print(c)


Measured memory_bytes: 3060
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner std = new Scanner(System.in);
		while(true){
			int h = Integer.parseInt(std.next());
			int w = Integer.parseInt(std.next());
			if(h!=0 && w!=0){
				String line = "";
				String line2 = "#";
				for(int m=1; m<=w; m++){
					line += "#";
					line2 += ".";
				}
				line2 = line2.substring(0, w-1)+"#";
				System.out.println(line);
				for(int n=2; n<=h-1; n++){
					System.out.println(line2);
				}
				System.out.println(line);
				System.out.println();
			}else break;
		}
	}
}

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

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();

		int[] oddCnt = new int[100100];
		int[] evenCnt = new int[100100];

		Arrays.fill(oddCnt, 0);
		Arrays.fill(evenCnt, 0);

		for (int i = 0; i < N; i++) {
			int v = sc.nextInt();

			if (i % 2 == 0) evenCnt[v]++;
			else oddCnt[v]++;
		}

		int oddMax = 0, oddMaxId = 0, odd2ndMax = 0;
		int evenMax = 0, evenMaxId = 0, even2ndMax = 0;

		for (int i = 0; i < 100100; i++) {
			if (evenMax <= evenCnt[i]) {
				even2ndMax = evenMax;
				evenMax = evenCnt[i];
				evenMaxId = i;
			} else if (even2ndMax <= evenCnt[i]) {
				even2ndMax = evenCnt[i];
			}
			if (oddMax <= oddCnt[i]) {
				odd2ndMax = oddMax;
				oddMax = oddCnt[i];
				oddMaxId = i;
			} else if (odd2ndMax <= oddCnt[i]) {
				odd2ndMax = oddCnt[i];
			}
		}

		if (evenMaxId != oddMaxId) {
			System.out.println(N - evenMax - oddMax);
		} else if (even2ndMax > odd2ndMax) {
			System.out.println(N - even2ndMax - oddMax);
		} else {
			System.out.println(N - evenMax - odd2ndMax);
		}
	}
}


Measured memory_bytes: 61832
#include<unistd.h>
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<stdbool.h>
#include<stdint.h>
#include<time.h>
#include<tgmath.h>
inline int max(int a, int b){return a>b?a:b;}
inline int min(int a, int b){return a>b?b:a;}
long gcd(long a, long b){return b?gcd(b, a%b):a;}

//fast(?) Input
#define buf_sz 1<<24
char buf[buf_sz];
unsigned int nextint(){
	static int idx = 0;
	if(idx == 0)read(0, buf, buf_sz);
	unsigned int res = 0;
	while(idx<buf_sz && buf[idx]<'0' || '9'<buf[idx])idx++;
	while(idx<buf_sz && '0'<=buf[idx] && buf[idx]<='9'){
		res *= 10;
		res += buf[idx++] - '0';
	}if(idx>=buf_sz)exit(1);
	return res;
}

const long mod = 1e9 + 7;
long modpow(long x, long y, long m){
    long res = 1, tmp = x;
    while(y){
        if(y&1) res = res * tmp % m;
        tmp = tmp * tmp % m;
        y >>= 1;
    }
    return res;
}
long pom(long x, long y){return modpow(x, y, mod);}

int main(){
	long N = nextint();
	long ans = pom(10, N) - 2 * pom(9, N) + pom(8, N);
	ans = (mod + ans%mod) % mod;
	printf("%ld\n",ans);
}

Measured memory_bytes: 1596
#include <bits/stdc++.h>
using namespace std;
#define GET_MACRO(_1, _2, _3, NAME, ...) NAME
#define _repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define _rep(i,n) _repl(i,0,n)
#define rep(...) GET_MACRO(__VA_ARGS__, _repl, _rep)(__VA_ARGS__)
#define mp(a,b) make_pair((a),(b))
#define pb(a) push_back((a))
#define all(x) (x).begin(),(x).end()
#define uniq(x) sort(all(x)),(x).erase(unique(all(x)),end(x))
#define fi first
#define se second
#define dbg(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
void _dbg(string){cout<<endl;}
template<class H,class... T> void _dbg(string s,H h,T... t){int l=s.find(',');cout<<s.substr(0,l)<<" = "<<h<<", ";_dbg(s.substr(l+1),t...);}
template<class T,class U> ostream& operator<<(ostream &o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream &o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

#define INF 1120000000
#define long long long // for codeforces

void gen(int k, int n, vector<vector<int>> &v, vector<int> c){
  if(n==0) return;
  rep(i,k){
    c.pb(i+1);
    v.pb(c);
    gen(k,n-1,v,c);
    c.pop_back();
  }
}

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

  if(k%2==0){
    cout << k/2;
    rep(i,n-1) cout << " " << k;
    cout << endl;
    return 0;
  }

  vector<int> a(n, (k+1)/2);
  int m = n/2;
  while(m>0){
    if(a.back() == 1) a.pop_back();
    else {
      a.back()--;
      while(a.size() < n) a.push_back(k);
    }
    m--;
    // dbg(a);
  }

  rep(i,a.size()) cout << a[i] << " \n"[i==a.size()];

  return 0;
}


Measured memory_bytes: 3456
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<functional>
#include<vector>
#include<queue>
#include<stack>
#include<set>
using namespace std;
#define MOD 1000000007
#define f(i,n) for(int i=0;i<int(n);i++)
#define N 200000


int main(){
	int a[N];
	int n, k;
	int x, y, z;
	int s, ans;
	s = 0;
	ans = 0;
	scanf("%d", &n);
	while (n != 0){
		ans += (n % 10);
		n = n / 10;
	}
	if (ans == 1)ans = ans * 10;
	printf("%d\n", ans);

	return 0;
}

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

int main()
{
  i64 n, d;
  cin >> n >> d;
  i64 ans = 0;
  vector<vector<i64>> x(n, vector<i64>(d));
  for (i64 i = 0; i < n; i++)
    for (i64 j = 0; j < d; j++)
      cin >> x[i][j];
  for (i64 i = 0; i < n; i++)
    for (i64 j = i + 1; j < n; j++)
    {
      i64 sum = 0;
      for (i64 k = 0; k < d; k++)
        sum += (x[i][k] - x[j][k]) * (x[i][k] - x[j][k]);
      if ((int)sqrt(sum) * sqrt(sum) == sum)
        ans++;
    }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <ctime>
#include <list>
#include <numeric>
#include <utility>
#include <ctime>
#define INF 1000000000
#define LINF 9000000000000000000
#define mod 1000000007
 
#define rep(i,n) for(int i=0;i<int(n);i++)
#define REP(i,a,b) for(int i=(a);i<int(b);i++)
#define all(x) (x).begin(),x.end()
#define pb push_back
#define mp make_pair
#define MOD(x) (x%(mod))
 
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int,int> pi;
 
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
bool debug=false;
 
/*---------------------------------------------------*/

int main(){
  int n,m;
  cin>>n>>m;
  n--;m--;
  cout<<n*m<<endl;
  return 0;
}


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

int main(){
	int n;
	cin >> n;
	vector<int> a(200010);

	for (int i=0; i<n; i++) cin >> a[i];
	int first = 0;
	int second = 0;
	for (int i=0; i<n; i++){
		if(first < a[i]){
			second = first;
			first = a[i];
		}
		else if(second < a[i]){
			second = a[i];
		}
	}

	for(int i=0; i<n; i++){
		if (a[i] == first) cout << second << endl;
		else cout << first << endl;
	}
	return 0;
}

Measured memory_bytes: 3992
#include <stdio.h>
#include <string.h>
#define rep(i, n) for(int i = 0; i < n; ++i)
#define repi(i, n) for(int i = 1; i < n; ++i)

int max(int a, int b) {
  return a > b ? a : b;
}

int main(void) {
  int n;
  scanf("%d", &n);
  rep(i, n) {
    char x[1500], y[1500];
    int h, w;
    scanf("%s", x);
    scanf("%s", y);
    h = strlen(x), w = strlen(y);
    int dp[h][w], len[w], maxs = 0;
    rep(j, h) rep(k, w) dp[j][k] = 0;
    rep(j, w) if(x[0] == y[j]) dp[0][j] = 1, maxs = 1;
    len[0] = 0;
    repi(j, w) len[j] = max(dp[0][j - 1], len[j - 1]);
    repi(j, h) {
      rep(k, w) if(x[j] == y[k]) {
        dp[j][k] = len[k] + 1;
        if(maxs < dp[j][k]) maxs = dp[j][k];
      }
      repi(k, w) len[k] = max(dp[j][k - 1], max(len[k], len[k - 1]));
      /*rep(k, w) printf("%d ", len[k]);
      printf("\n");*/
    }
    /*printf("\n");
    rep(j, h) {
      rep(k, w) printf("%d ", dp[j][k]);
      printf("\n");
    }*/
    printf("%d\n", maxs);
  }
  return 0;
}


Measured memory_bytes: 6616
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

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

int toHash(int y1, int x1, int y2, int x2)
{
    return ((y1 * 52 + x1) * 52 + y2) * 52 + x2;
}

void fromHash(int hash, int& y1, int& x1, int& y2, int& x2)
{
    x2 = hash % 52;
    hash /= 52;
    y2 = hash % 52;
    hash /= 52;
    x1 = hash % 52;
    hash /= 52;
    y1 = hash % 52;
}

int main()
{
    for(;;){
        int h, w;
        cin >> w >> h;
        if(h == 0)
            return 0;

        int sy1, sx1, sy2, sx2;
        vector<string> grid1(h+2, string(w+2, '#'));
        vector<string> grid2(h+2, string(w+2, '#'));
        for(int i=1; i<=h; ++i){
            for(int j=1; j<=w; ++j){
                cin >> grid1[i][j];
                if(grid1[i][j] == 'L'){
                    sy1 = i;
                    sx1 = j;
                }
            }
            for(int j=1; j<=w; ++j){
                cin >>grid2[i][j];
                if(grid2[i][j] == 'R'){
                    sy2 = i;
                    sx2 = j;
                }
            }
        }

        queue<int> q;
        vector<bool> history(52*52*52*52, false);
        q.push(toHash(sy1, sx1, sy2, sx2));
        history[toHash(sy1, sx1, sy2, sx2)] = true;

        bool ret = false;
        while(!q.empty()){
            int y1, x1, y2, x2;
            fromHash(q.front(), y1, x1, y2, x2);
            q.pop();
            if(grid1[y1][x1] == '%' && grid2[y2][x2] == '%'){
                ret = true;
                break;
            }
            if(grid1[y1][x1] == '%' || grid2[y2][x2] == '%')
                continue;

            for(int i=0; i<4; ++i){
                int y3 = y1 + dy[i];
                int x3 = x1 + dx[i];
                int y4 = y2 + dy[i];
                int x4 = x2 + dx[i^1];

                if(grid1[y3][x3] == '#'){
                    y3 -= dy[i];
                    x3 -= dx[i];
                }
                if(grid2[y4][x4] == '#'){
                    y4 -= dy[i];
                    x4 -= dx[i^1];
                }

                int hash = toHash(y3, x3, y4, x4);
                if(!history[hash]){
                    q.push(hash);
                    history[hash] = true;
                }
            }
        }

        if(ret)
            cout << "Yes" << endl;
        else
            cout << "No" << endl;
    }
}

Measured memory_bytes: 2372
//Code by 27.
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<string>
#include<math.h>
#include<vector>
#include<queue>
#include<map>
#include<stack>
#include<fstream>
#include<stdlib.h>
#include<set>
#include<climits>
#include<cmath> 
#include<memory.h> 
#include<sstream>
#include<time.h>
using namespace std;
const unsigned long long BIGEST=1000000000000000+1000000000000000;
const long long BIGER=1000000000000000;
const int BIG=1000000000;
const long long MOD=19260817;
int main()
{
	string st;
	cin>>st;
	int g=0;
	char comm='#';
	for(int i=(st.size()+1)/2-1+(st.size()+1)%2,j=(st.size()+1)/2-1;i<st.size()&&j>=0;i++,j--)
	{
		//cout<<i<<" "<<j<<" "<<st[i]<<" "<<st[j]<<endl;
		if(st[i]==st[j]&&(comm=='#'||(st[i]==comm&&st[j]==comm)))
		{
			//cout<<i<<" "<<j<<endl;
			g++;
			comm=st[i];
		}
		else
		{
			break;
		}
	}
	cout<<g+st.size()/2;
	return 0;
}

Measured memory_bytes: 512
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
#define REP(i, limit) for(int i=0; i< limit; ++i)
#define LINT long long

int main(){
  int N;
  cin >> N;
  if(N==0){
    cout << 0 << endl;
    return 0;
  }

  int s[100];
  int l=0;
  while(N!=0){
    if(N%2!=0){
      s[l]=1;
      --N;
    }
    else s[l]=0;
    N=-N/2;
    ++l;
  }

  for(int i=l-1; i>-1; --i){
    cout << s[i];
  }


  return 0;
}


Measured memory_bytes: 256
//#include <bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <vector>
#include <map>
#include <queue>

using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<n;++i)
#define mod (ll)(1e9+7)
#define FIX(a) ((a)%mod+mod)%mod
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define fi first
#define se second
#define pb push_back
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};
mint pow(mint x, ll ntimes) {
    mint ret = 1;
    while (ntimes > 0) {
        if ((ntimes & 1) == 1) {
            ret = ret * x;
        }
        x = x * x;
        ntimes >>= 1;
    }
    return ret;
}
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n,k;
    cin >> n >> k;
    vector<mint> kai(n+1);
    kai[0] = mint(1);
    for(ll i=1;i<=n;i++){
        kai[i] = kai[i-1]*mint(i);
    }
    if(k>=n){
        k=n-1;
    }
    
    mint ans = mint(0);
    for(ll i=0;i<=k;i++){
        mint t1 = kai[n];
        t1/=kai[i];
        t1/=kai[n-i];
        mint t2 = kai[n-1];
        t2/=kai[i];
        t2/=kai[n-1-i];
        t1*=t2;
        ans+=t1;
    }
    cout << ans.x << endl;
    return 0;
}

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

int main(){
    string s;
    cin>>s;
    int a=-1,b=-1,n=s.size();
    rep(i,n-1){
        if(s[i]==s[i+1])a=i+1,b=i+2;
    }
    rep(i,n-2){
        if(s[i]==s[i+2])a=i+1,b=i+3;
    }
    cout<<a<<" "<<b<<endl;
    return 0;
}

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

int main() {
  int N,L;
  cin >> N>>L;
  vector<string> s(N);
    for(int i=0;i<N;i++) cin>>s[i];
  sort(s.begin(),s.end());
//cout<<s[0]<<endl;

for(int i=0;i<N;i++){
  cout<<s[i];

}
cout<<endl;
}


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

using namespace std;

int main()
{
  int a,b,count=0;
  cin>>a>>b;
  for(int i=a;i<=b;i++)
  {
    if((i/10000==i%10)&&((i/1000)%10==(i%100)/10))
    {
      count++;
    }
  }
  cout<<count<<endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<cstdio>
#include<cmath>
#include<numeric>
#include<queue>
#include<stack>
#include<cstring>
#include<limits>
#include<functional>
#define rep(i,a) for(int i=(int)0;i<(int)a;++i)
#define pb push_back
#define eb emplace_back
using ll=long long;
static const ll mod = 1e9 + 7;
static const ll INF = 1LL << 50;
using namespace std;

template<typename T>
vector<T>compression(int n,vector<T> &a){//座圧
//要素数nの配列aがある
vector<T> v;
for (int i = 0; i < n; ++i)v.push_back(a[i]);
sort(v.begin(), v.end());
v.erase(unique(v.begin(), v.end()), v.end());//重複を削除
vector<T>id(n);
for (int i = 0; i < n; ++i)id[i] = lower_bound(v.begin(), v.end(), a[i]) - v.begin();
//0オリジンで出てくる
return id;
}

int main(){
    int n;
    cin>>n;
    vector<ll>a(n);
    rep(i,n)cin>>a[i];
    auto x=compression<ll>(n,a);
    int i=0,cnt=0;
    for(auto z:x){
        if(z%2!=i)++cnt;
        i=1-i;
    }
    cout<<cnt/2<<endl;
    return 0;
    }


Measured memory_bytes: 2676
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
#include <assert.h>
#include <math.h>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <vector>
#include <string>
#include <iostream>
#include <algorithm>
#include <functional>

#define mp make_pair
#define pb push_back
#define mes(a,b) memset(a,b,sizeof(a))
#define mes0(a) memset(a,0,sizeof(a))
#define lson l,mid,pos<<1
#define rson mid+1,r,pos<<1|1
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define fi first
#define se second
#define sss(a) a::iterator
#define all(a) a.begin(),a.end()

using namespace std;

typedef double DB;
typedef long long LL;
typedef pair<int,int> pii;
typedef pair<long long ,int> pli;
typedef pair<int,long long > pil;
typedef pair<string,int> psi;
typedef pair<long long ,long long > pll;

const int inf = 0x3f3f3f3f;
const long long INF = 0x3f3f3f3f3f3f3f3f;
const double pi = acos(-1.0);
const int maxn = 100000+10;
const int mod = 1e9+7;
char s[212345];
int pos[30];
int nt[212345];
int dp[212345];
int main()
{
    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);

    scanf("%s",s+1);
    int len=strlen(s+1);
    for (int i=1;i<=26;i++){
        s[len+i]=i+'a'-1;
        pos[i-1]=len+i;
    }
    for (int i=len;i>=0;i--){
        int t=0;
        for (int j=0;j<26;j++){
            if (dp[pos[j]]<dp[pos[t]])t=j;
        }
        dp[i]=dp[pos[t]]+1;
        nt[i]=pos[t];
        if (s[i])
        pos[s[i]-'a']=i;
    }
    int now=0;
    while (now<=len){
        putchar(s[nt[now]]);
        now=nt[now];
    }
    return 0;
}


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

int main(int argc, const char * argv[]) {
    int a,b,c;
    cin >> a >> b >> c;
    int ans = 1;
    
    if(a != b){
        ans++;
    }
    if(c !=a && c!= b){
        ans++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
N = int(input())
L = list(map(int, input().split()))

L.sort()
ans = 0

for i in range(N) :
  li = L[i]
  for j in range(i+1, N) :
    flag = False
    lj = L[j]
    if li == lj :
      continue
    for k in range(j+1, N) :
      lk = L[k]
      if lj == lk :
        continue
      if flag :
        continue
      if li + lj > lk :
        ans += 1
      else :
        flag = True
        
print(ans)

Measured memory_bytes: 9212
#include<bits/stdc++.h>
using namespace std;
#define REP(i,st,ed) for(register int i=st,i##end=ed;i<=i##end;++i)
#define DREP(i,st,ed) for(register int i=st,i##end=ed;i>=i##end;--i)
typedef long long ll;
template<typename T>inline bool chkmin(T &x,T y){return (y<x)?(x=y,1):0;}
template<typename T>inline bool chkmax(T &x,T y){return (y>x)?(x=y,1):0;}
inline int read(){
	int x;
	char c;
	int f=1;
	while((c=getchar())!='-' && (c>'9' || c<'0'));
	if(c=='-') f=-1,c=getchar();
	x=c^'0';
	while((c=getchar())>='0' && c<='9') x=(x<<1)+(x<<3)+(c^'0');
	return x*f;
}
inline ll readll(){
	ll x;
	char c;
	int f=1;
	while((c=getchar())!='-' && (c>'9' || c<'0'));
	if(c=='-') f=-1,c=getchar();
	x=c^'0';
	while((c=getchar())>='0' && c<='9') x=(x<<1ll)+(x<<3ll)+(c^'0');
	return x*f;
}
const int maxn=2e3+10,mod=1e9+7;
int dp[maxn<<1][maxn],sum[maxn<<1][maxn];
int main(){
	int ans=0,n=read(),m=read(),k=read();
	dp[0][0]=1;
	REP(j,0,m) sum[0][j]=1;
	REP(i,1,n+m) REP(j,0,m){
		dp[i][j]=(j>0?sum[i-1][j-1]:0)-(j-k>=0?sum[i-1][j-k]:0);
		dp[i][j]=(dp[i][j]%mod+mod)%mod;
		if(j%(k-1)==m%(k-1) && i*(k-1)-j<=n-1 && (i*(k-1)-j)%(k-1)==(n-1)%(k-1)) ans=(ans+dp[i][j])%mod;
		dp[i][j]=(dp[i][j]%mod+dp[i-1][j])%mod;
//		cerr<<i<<' '<<j<<' '<<dp[i][j]<<endl;
		sum[i][j]=((j>0?sum[i][j-1]:0)+dp[i][j])%mod;
	}
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 63232
import itertools
S = list(input())
set01 = list(itertools.product('01', repeat=(len(S)-1)))
S_01 = ['','+']
counter = 0
for i in range(len(set01)):
    SS = ""
    for j in range(len(S)-1):
        SS += S[j   ] + S_01[int(set01[i][j])]
    SS += S[-1]
    SS = "".join(SS)
    counter += eval(SS)
print(counter)


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

int main() {
    int a,b,c,d;
    cin >> a >> b >> c >> d;
    if(a+b > c+d) cout << "Left" << endl;
    else if(a+b < c+d) cout << "Right" << endl;
    else cout << "Balanced" << endl;
 }

Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
typedef unsigned long long ullong;

int n, T;
string exp;
static const ullong S = 1000000000;

void solve(){
  int p = 0;
  ullong sum = 0;
  while(p < exp.size() ){
    p+=2; // n^
    int m = exp[p++]-'0';
    ullong d = 1;
    for ( int i = 0; i < m; i++ ){
      d *= n;
      if ( d > S ){ cout << "TLE" << endl; return ; }
    }
    sum += d;
    if ( sum*T > S ){ cout << "TLE" << endl; return ; }
    p++; //+
  }
  cout << sum*T << endl;
}

main(){
  cin >> n >> T >> exp;
  solve();
}

Measured memory_bytes: 1192
#include<iostream>
#include <algorithm>
#include<cstdio>
#include<string>
#include<math.h>
#include<vector>
#include <queue>
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); i++)
#define srep(i,s,t) for (int i = s; i < t; i++)
#define drep(i,n) for(int i = (n)-1; i >= 0; i--)
using namespace std;
typedef vector<vector<char>> field_t;

typedef pair<int, int> point_t;



int main()
{
    int N,Y,i;
    cin >> N;
	vector<int> D(N);
	rep(i,N-1){
    	cin>>Y;
		D[Y-1]++;
    }
	rep(i,N){
    	cout<<D[i]<<endl;
    }
}

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

int main() {
    int A,B,C;
    cin >>A>>B>>C;
    int count =0;
    int ss =B-A;
    while (ss>=0){
        count++;
        ss -=A;
        if(count == C) break;
    }
    cout << count <<endl;
}


Measured memory_bytes: 384
import math
def py():
    print("Yes")
def pn():
    print("No")
def iin():
    x = int(input())
    return x

x = iin()
b = math.floor(x/1.08)
a = math.ceil(x/1.08)
if int(b * 1.08) == x:
    print(b)
elif int(a * 1.08) == x:
    print(a)
else:
    print(":(")

Measured memory_bytes: 3060
#define _USE_MATH_DEFINES
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<climits>
#include<string>
#include<vector>
#include<list>
#include<map>
#include<set>
#include<cmath>
#include<queue>
#include<cstring>
#include<stack>
#include<functional>
using namespace std;
#define EPS 1e-4
typedef long long ll;

ll A[300001],B[300001],C[300001],sum[300001];

int main(){
	int N,M;
	cin>>N;
	for(int i=0;i<N;i++) cin>>A[i];
	A[N] = INT_MAX; sort(A,A+N);
	cin>>M;
	for(int i=0;i<M;i++) cin>>B[i];
	for(int i=0;i<M;i++) cin>>C[i];
	ll latte = 0;
	for(int i=0;i<=N;i++){
		sum[i] = latte;
		//printf("%d ",A[i]);
		latte += A[i];
	}//puts("");
	//for(int i=0;i<=N;i++) printf("%d ",sum[i]); puts("");
	for(int i=0;i<M;i++){
		if(C[i] <= sum[upper_bound(A,A+N+1,B[i])-A]) puts("Yes");
		else puts("No");
	}
	return 0;
}

Measured memory_bytes: 10500
#include <bits/stdc++.h>
#define aaa cout<<233<<endl;
#define endl '\n'
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
// mt19937 rnd(TM(0));
const int inf = 0x3f3f3f3f;//1061109567 > 1e9
const ll linf = 0x3f3f3f3f3f3f3f3f;
const double eps = 1e-6;
const double pi = 3.14159265358979;
const int maxn = 1e3 + 5;
const int maxm = 5e5 + 233;
const int mod = 1e9 + 7;

int n, a[maxn];
int main()
{
    // double pp = clock();
    // freopen("233.in", "r", stdin);
    // freopen("233.out", "w", stdout);
    ios_base::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    
    cin >> n;
    for(int i = 1; i <= n; ++i)cin >> a[i];
    ll ans = 0;
    for(int i = 1; i <= n; ++i){
        for(int j = i + 1; j <= n; ++j){
            ans += a[i] * a[j];
        }
    }
    cout << ans << endl;
    
    // cout << endl << (clock() - pp) / CLOCKS_PER_SEC << endl;
    return 0;
}

Measured memory_bytes: 896
#define ALL(obj) (obj).begin(), (obj).end()
 
#include <iomanip>
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
#include <functional>
 
using namespace std;
typedef long long ll;
const ll INF = 1e18;
 
ll N;
ll K;
 
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cin >> N >> K;
    vector<ll> p(N);
 
    for (ll i=0; i<N; i++) {
        cin >> p[i];
    }
    
    vector<ll> table(200001);
    ll sum = 0;
    
    for (ll i=1; i<=200000; i++) {
        sum += i;
        table[i] = sum;
    }
    
    double answer = 0.0;
 
    if (N==1) {
        cout << (double)table[p[0]] / (double)p[0] << endl;
        return 0;
    }
    
    if (N==2) {
        if (K==1) {
            double a = (double)table[p[0]] / (double)p[0];
            double b = (double)table[p[1]] / (double)p[1];
            if (a > b) {
                cout << a << endl;
                return 0;
            } else {
                cout << b << endl;
                return 0;
            }
        } else {
            double ans = (double)table[p[0]] / (double)p[0] + (double)table[p[1]] / (double)p[1];
            cout << ans << endl;
            return 0;
        }
    }
    
    for (ll j=0; j<K; j++) {
        answer += (double)table[p[j]] / (double)p[j];
    }
    
    double max = answer;
    for (ll i=K; i<N; i++) {
        double left = (double)table[p[i-K]] / (double)p[i-K];
        double right = (double)table[p[i]] / (double)p[i];
        double tmp = answer + right - left;
        if (max < tmp) {
            max = tmp;
        }
        answer = tmp;
    }
    
    cout << setprecision(12) << max << endl;
    
    return 0;
}


Measured memory_bytes: 3456
use proconio::{input, fastout};
use proconio::marker::{Chars};
use proconio::marker::Usize1;
use std::cmp::*;

macro_rules! debug {
      ($($a:expr),*) => {
          eprintln!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

#[fastout]
fn main() {
    input!{
        m: usize,
    }

    println!("{}", 24-m+24);

}


Measured memory_bytes: 2176
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
// #include <numeric> // gcdとかlcmとか C++17から
#include <time.h> // time_t timer; time(&timer); でtimerに現在時刻が代入される．
#include <unistd.h> // sleep関数．引数は秒単位．
using namespace std;

typedef long long ll;


// sortの仕方
// 	■ string s の場合
// 	昇順: sort(s.begin(), s.end())
// 	降順: sort(s.rbegin(), s.rend())
//
// 	■ ll a[N] の場合
// 	昇順: sort(a, a+N)
// 	降順: 不明


// int alph2int(char character) {
//     int x = character - 'a';
//     return x;
// }


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


//  ll my_lcm(ll a, ll b){
//  	return a*b / my_gcd(a,b);
//  }


// ll factorial(ll a){
// 	ll ans = 1;
// 	for(ll i=a; i>0; i--){
// 		ans *= i;
// 	}
// 	return ans;
// }

int main(int argc, char *argv[]){
    int N;
    cin >> N;
    int A[N];
    for (int i=0; i<N; i++){
        cin >> A[i];
    }

    int ans = 1000000000;
    for (int i=0; i<N; i++) {
        int ans_tmp = 0;
        while (A[i]%2 == 0){
            ans_tmp++;
            A[i] /= 2;
        }
        if (ans_tmp < ans) {
            ans = ans_tmp;
        }
    }

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

Measured memory_bytes: 256
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
	Scanner sc = new Scanner(System.in);
	
	int a = sc.nextInt();
	int b = sc.nextInt();
	
	if(a >= 13) {
		System.out.println(b);
	   }
	if(a >= 6 && a <= 12) {
		System.out.println(b/2);
	   }
	if(a <= 5)
		System.out.println(0);
	}
	
	 }
	


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

using namespace std;

#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,a,n) for(int i=a;i<n;i++)

typedef long long ll;

void Main()
{
	string s; cin >> s;
    int n = 3;
    int sum = 0;
    rep(i, 4)
    {
        sum += atoi(s.substr(i, 1).c_str());
    }
	for (int bit = 0; bit < (1<<n); ++bit) {
        vector<int> S;
        for (int i = 0; i < n; ++i) {
            if (bit & (1 << i)) {
                S.push_back(i + 1);
            }
        }
        int _sum = sum;
        rep(i, S.size())
        {
            _sum -= 2 * atoi(s.substr(S[i], 1).c_str());
        }
        if (_sum == 7) {
            char op[4];
            rep(i, 4)
            {
                if (i == 3) {
                    op[i] = '=';
                } else {
                    op[i] = '+';
                }
            }
            rep(i, S.size())
            {
                op[S[i] - 1] = '-';
            }
            rep(i, 4)
            {
                cout << s.at(i) << op[i];
            }
            cout << 7 << endl;
            break;
        }
    }
}

int main()
{
    cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	Main();
}


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

int main(){
   
  int N,A;
  
  cin >> N >> A;
  
  if (N%500 <= A){
    
    cout << "Yes" << endl;
    
  }
    
  else{
    
    cout << "No" << endl;
    
  }
}
   


Measured memory_bytes: 256
import itertools
n = int(input())
ls = [input()[:1] for _ in range(n)]
ans = 0
cmb = list(itertools.combinations(list("MARCH"), 3))

for c in cmb:
    ans += ls.count(c[0]) * ls.count(c[1]) * ls.count(c[2])

print(ans)


Measured memory_bytes: 3888
s[50],j,p,q;
main(i){for(;p=atoi(gets(s)),p;printf("%d\n",i)){
for(i=0;i<p;s[i++]=strlen(gets(s+i)));
for(i=j=0;j<7;)for(p=i++,j=q=1;q>0;)for(q=j++>5?0:j-2&&j-4?8:6;q>1;q-=s[p++]);
}}

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

int main() {
  
  int K, N; cin >> K >> N;
  
  vector<int> vec(N);
  
  for (int i = 0; i < N; i++) cin >> vec[i];
  
  int maxLength = vec.front() + (K - vec.back());
  
  for (int i = 0; i < N - 1; i++) {
    
    int tmp = vec[i + 1] - vec[i];
    
    maxLength = max(maxLength, tmp);
    
  }
  
  cout << K - maxLength << endl;
  
}

Measured memory_bytes: 1024
/*
 *  author : Atul Anand   
 *  created on : Wed Apr 01 2020
 */

import java.io.*;
import java.util.*;

public class Main{

    public static void main(String[] args) throws IOException {
        String S = in.next();
        int ans = 0;
        int i = 0;
        int j = S.length() - 1;
        while(i < j){
            if(S.charAt(i) != S.charAt(j)){
                ans++;
            }
            i++;
            j--;
        }
        println(ans);
        in.close();
        out.close();
    }

    static int MIN = Integer.MIN_VALUE;
    static int MAX = Integer.MAX_VALUE;
    static Reader in = new Reader();
    static PrintWriter out = new PrintWriter(System.out);

    static void read(int arr[], int N) throws IOException { 
    	for(int i = 0; i < N; i++){ 
    		arr[i] = in.nextInt(); 
    	} 
    }
    
    static void read(long arr[], int N) throws IOException { 
    	for(int i = 0; i < N; i++){ 
    		arr[i] = in.nextLong(); 
    	} 
    }
    
    static void read(String arr[], int N) throws IOException { 
    	for(int i = 0; i < N; i++){ 
    		arr[i] = in.next(); 
    	} 
    }
    
    static void print(Object O) {  
    	out.print(O); 
    }
    
    static void println(Object O) { 
    	out.println(O); 
    }
    
    static void println(int arr[]) { 
    	for(int i = 0; i < arr.length; i++){ 
    		print(arr[i]+" "); 
    	} 
    	println(""); 
    }

    static void println(int arr[][]) { 
    	for(int i = 0; i < arr.length; i++){ 
    		println(arr[i]); 
    	}
    }
    
    static void debug(Object O) { 
    	System.out.println(O); 
    }
}

class Reader {
    BufferedReader reader;
    StringTokenizer tokenizer;

    Reader() {
        reader = new BufferedReader(new InputStreamReader(System.in));
        tokenizer = new StringTokenizer("");
    }

    String next() throws IOException {
        while (!tokenizer.hasMoreTokens() ) { 
            tokenizer = new StringTokenizer(reader.readLine()); 
        }
        return tokenizer.nextToken();
    }

    int nextInt() throws IOException { 
        return Integer.parseInt(next()); 
    }
    
    double nextDouble() throws IOException { 
        return Double.parseDouble(next());
    }
    
    long nextLong() throws IOException { 
        return Long.parseLong(next()); 
    }
    
    String nextLine() throws IOException { 
        return reader.readLine(); 
    }
    
    void close() throws IOException { 
        reader.close(); 
    }
}

Measured memory_bytes: 21332