akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
 
template<typename T> istream &operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &vec){ os << "["; for (auto v : vec) os << v << ", "; os << "]"; return os; }
template<typename T> ostream &operator<<(ostream &os, const deque<T> &vec){ os << "deq["; for (auto v : vec) os << v << ", "; os << "]"; return os; }
template<typename T> ostream &operator<<(ostream &os, const set<T> &vec){ os << "{"; for (auto v : vec) os << v << ", "; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const unordered_set<T> &vec){ os << "{"; for (auto v : vec) os << v << ", "; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ", "; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const unordered_multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ", "; os << "}"; return os; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &pa){ os << "(" << pa.first << ", " << pa.second << ")"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << ": " << v.second << ", "; os << "}"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const unordered_map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << ": " << v.second << ", "; os << "}"; return os; }
template<typename T> void ndarray(vector<T> &vec, int len) { vec.resize(len); }
template<typename T, typename... Args> void ndarray(vector<T> &vec, int len, Args... args) { vec.resize(len); for (auto &v : vec) ndarray(v, args...); }
template<typename T> bool chmax(T &m, const T q) { if (m < q) {m = q; return true;} else return false; }
template<typename T> bool chmin(T &m, const T q) { if (q < m) {m = q; return true;} else return false; }
template<typename T1, typename T2> pair<T1, T2> operator+(const pair<T1, T2> &l, const pair<T1, T2> &r) { return make_pair(l.first + r.first, l.second + r.second); }
template<typename T1, typename T2> pair<T1, T2> operator-(const pair<T1, T2> &l, const pair<T1, T2> &r) { return make_pair(l.first - r.first, l.second - r.second); }
#define f first
#define s second
 
int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int len, t;
    cin >> len >> t;
    map<int, int> m;
    for(int i = 0; i < t; i++) {
        int a, b;
        cin >> a >> b;
        if((m.count(a) && m[a] != b) || (a == 1 && b == 0 && len != 1)) {
            cout << -1;
            return 0;
        }
        m[a] = b;
    }
    for(int i = 1; i <= len; i++) {
        if(m.count(i))
            cout << m[i];
        else if(i > 1 || (i == 1 && len == 1))
            cout << 0;
        else
            cout << 1;
    }
}

Measured memory_bytes: 3660
#include<bits/stdc++.h>
using namespace std;
int main()
{
int long long n;
unordered_set<string> s;
string a;
cin>>n;
for(int i=0;i<n;i++)
{
	cin>>a;
	s.insert(a);
}
n=0;
for(auto it:s)
{
	n++;
	
}
cout<<n;
	}


Measured memory_bytes: 17792
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        long n = sc.nextLong();
        
        int count = 0;
        long ts = 1;
        long tssum = 0;
        for (int i = 2; i < 100; i++) {
            if (n <= tssum) {
                break;
            } else {
                ts *= 26;
                tssum += ts;
                count++;
            }
        }
        
        // System.out.println(count);
        
        long tmp2 = 1;
        long tmpsum = 0;
        for (int i = 0; i < count-1; i++) {
            tmp2 *=26;
            tmpsum += tmp2;
        }
        n -= tmpsum;
        n--;
        
        // System.out.println(n);
        
        long twosix = 1;
        for (int i = 0; i < count-1; i++) {
            twosix *= 26;
        }
        
        String str = "";
        for (int i = 0; i < count; i++) {
            long tmp3 = n / twosix;
            // System.out.println(tmp3);
            char c = (char)(tmp3 + 'a');
            str += c;
            // System.out.println(c);
            
            n -= twosix * tmp3;
            twosix /= 26;
            // System.out.println(n);
        }
        
        System.out.println(str);
    }
}


Measured memory_bytes: 39364
#include <iostream>
#include <string>
#include <vector>
#include <cstdio>
#include <algorithm>
#include <array>
#include <cmath>

using namespace std;

using ll = long long int;

// GCDを計算します
template <typename NumType>
NumType calcGCD(NumType a, NumType b) {
    if (a < b) {
        NumType tmp = a;
        a = b;
        b = tmp;
    }

    NumType r = a % b;
    while (r != 0) {
        a = b;
        b = r;
        r = a % b;
    }

    return b;
}

// 約数を数えます
template <typename NumType>
NumType cntDivisor(const NumType & num) {
    NumType cnt = 0;
    for(NumType i = 1; i * i <= num; ++i) {
        if(num % i == 0) {
            cnt++;
            if(i * i != num) cnt++;
        }
    }

    return cnt;
}

// [beg, end)の範囲を，添え字indexでループするfor文に置換します
#define FOR_RANGE(index, beg, end)     for (ll index = beg; index < N; ++index)

#define DEBUG(x)     std::cout << #x << " : " << x << "\n"

ll powMod(ll a, ll n, ll mod){
    if(n == 0) return 1;
    if(n%2 == 0)
        return powMod(a, n/2, mod) * powMod(a, n/2, mod) % mod;
    else
        return a * powMod(a, n-1, mod)% mod;
}

ll ncrMod(ll n, ll r, ll mod){
    ll x=1, y=1;
    for(ll i = 1; i <= r; ++i){
        x *= n-i+1;
        x %= mod;
        y *= i;
        y %= mod;
    }
    return x * powMod(y, mod-2, mod) % mod;
}

int main() {
    int A, B;

    cin >> A >> B;

    int ans = -1;

    for (int price = 0; true; price++) {
        int a_tax = floor(price * 0.08);
        int b_tax = floor(price * 0.10);

        if (a_tax == A && b_tax == B) {
            ans = price;
            break;
        }

        if (a_tax > A || b_tax > B) {
            break;
        }
    }

    cout << ans;

    return 0;
}



Measured memory_bytes: 256
from collections import deque
from collections import Counter
from itertools import product, permutations,combinations
from operator import itemgetter
from heapq import heappop, heappush
from bisect import bisect_left, bisect_right, bisect
#pypyではscipy, numpyは使えない
#from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson, minimum_spanning_tree
#from scipy.sparse import csr_matrix, coo_matrix, lil_matrix
#import numpy as np
from fractions import gcd
from math import ceil,floor, sqrt, cos, sin, pi, factorial
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**8)
INF = float('inf')
MOD = 10**9+7

def main():
  n, k = map(int, readline().split())
  a = n//k
  ans = min(n-a*k, abs(n-(a+1)*k))
  print(ans)
  
if __name__ == '__main__':
  main()

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

int main() {
  	int n;
  	cin >> n;
  
  	if(n == 1) cout << 1 << endl;
  	else if(n%2==0) cout << 0.5000000000 << endl;
  	else cout << (double)((n/2)+1)/n << endl;
  	return 0;  
}


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

int main() {
  int n; cin>>n;
  vector<int> a(n);
  for (int i=0; i<n; i++) cin>>a[i];

  deque<int> ans;

  if (n%2==0){
    for (int i=0; i<n; i++){
      if (i%2==0) ans.push_back(a[i]);
      else ans.push_front(a[i]);
    }
  }
  else{
    for (int i=0; i<n; i++){
      if (i%2==0) ans.push_front(a[i]);
      else ans.push_back(a[i]);
    }
  }
  
  for (auto x : ans){
    cout<<x<<' ';
  }
  cout<<endl;
}

Measured memory_bytes: 3840
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	string s, t, u;
	int a, b;
	cin >> s >> t >> a >> b >> u;
	if(s == u) a--;
	else b--;
	cout << a << " " << b << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
template<typename ...Args> void read(Args&... args) { (cin >> ... >> args); }
template <typename...Args> void writeln(const Args &... args) { ((cout << args << " "), ...), cout << "\n"; }
template <typename...Args> void write(const Args &... args) { ((cout << args), ...), cout << "\n"; }
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
template <typename T> typename enable_if<is_same<decltype(declval<T>().size()), size_t>::value, int>::type operator~(const T& ct) { return (int)ct.size(); }
template <typename T, typename... Args> bool ckmax(T &a, const Args&... b) { return (a < max({b...})) ? (a = max({b...}), true) : false; }
template <typename T, typename... Args> bool ckmin(T &a, const Args&... b) { return (a > min({b...})) ? (a = min({b...}), true) : false; }
template <typename T> struct range {
    T u, v; bool inclusive;
    range(const T& _u, const T& _v, const bool& _inclusive = false) : u(_u), v(_v), inclusive(_inclusive) {}
    bool has(const T& w) { return (u <= w) and (inclusive ? (w <= v) : (w < v)); }
};
using vi = vector<int>;
using vb = vector<bool>;
using pii = pair<int, int>;
using vvi = vector<vector<int>>;
using vpii = vector<pii>;
using uint = unsigned;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using vll = vector<ll>;
using pll = pair<ll, ll>;
using vpll = vector<pll>;
template<typename T> using vv = vector<vector<T>>;
template<typename T> using min_heap = priority_queue<T, vector<T>, greater<T>>;
template<typename T> using max_heap = priority_queue<T, vector<T>, less<T>>;
const int N = 200'010;
auto soln() {
    long long n, k; read(n, k);;
    vll a(n + 1);
    for (int i = 1; i <= (int)(n); ++i) read(a[i]);
    ll mu = 0, len = 1;
    ll h = a[a[1]], t = a[1];
    while (h != t) {
        h = a[a[h]], t = a[t];
    }
    h = 1;
    while (h != t) {
        h = a[h], t = a[t], ++mu;
    }
    h = a[t];
    while (h != t) {
        h = a[h], ++len;
    }
    h = 1;
    if (k <= mu) {
        for (ll i = 1; i <= k; ++i) {
            h = a[h];
        }
        cout << h << "\n";
    }
    else {
        for(ll i = 1; i <= mu; ++i) {
            h = a[h], k--;
        }
        k %= len;
        for(ll i = 1; i <= k; ++i) {
            h = a[h];
        }
        cout << h << "\n";
    }
}
signed main() {
    int t = 1;
    { ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL); }
    while (t--)
        soln();
    return 0;
}


Measured memory_bytes: 4804
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<string>
#include<iostream>
#include<cctype>
#include<cstdio>
#include<vector>
#include<stack>
#include<queue>
#include <algorithm>
#include<math.h>
#include<set>
#include<map>
#include <sstream>
#include<iomanip>
#include <ctype.h>

//#include<bits/stdc++.h>




using namespace std;
int main() {
	
	string a, b;
	cin >> a >> b;

	string c = b + b;

	for (int i = 0; i < a.size(); i++) {
		string p = c.substr(i, a.size());
		if (a == p) {
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;


	return 0;
}

Measured memory_bytes: 256
import itertools
n = int(input())
h_list = []
for i in range(n):
    h_list.append(input()[0])
MARCH = ['M', 'A', 'R', 'C', 'H']
b = []
for a in MARCH:
    b.append(h_list.count(a))
bc = itertools.combinations(b, 3)
count = 0
for v in bc:
    count += v[0] * v[1] * v[2]
print(count)

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

using namespace std;

int main(){
  ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  cout.setf(ios::fixed); cout.precision(17);
  
  int n, k;
  cin >> n >> k;
  vector<int> h(n), f(n,(int)1e9);
  for(int i = 0; i < n; i++) cin >> h[i];
  f[0] = 0;  
  for(int i = 1; i < min(n, k); i++){
    f[i] = abs(h[i] - h[0]);
  }
  for(int i = k; i < n; i++){
    for(int j = i - k; j < i; j++){
      f[i] = min(abs(h[i] - h[j]) + f[j], f[i]);
    }
  }
  cout << f[n-1] << '\n';

  return 0;
}


Measured memory_bytes: 1024
S=input()
T=input()

Rs = {}
Rt = {}

for s,t in zip(S,T):
    
    if s in Rs.keys() and Rs[s] != t:
        print("No")
        exit()
    if t in Rt.keys() and Rt[t] != s:
        print("No")
        exit()

    if not s in Rs.keys():
        Rs[s] = t
    if not t in Rt.keys():
        Rt[t] = s

ress = [""] * len(S)
for i,s in enumerate(S):
    ress[i] = Rs[s]

print("Yes" if "".join(ress)==T else "No")

Measured memory_bytes: 5168
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
#define tr(container, it) \
        for (auto it = container.begin(); it != container.end(); it++)
#define scontains(c, x) ((c).find(x) != (c).end())   //O(log n)
#define contains(c, x) (find((c).begin(),(c).end(),x) != (c).end()) //O(n)
#define pll pair<ll,ll>
#define pii pair<int,int>
#define mll map<ll,ll>
#define intv(x, a, b)((x)>=a && (x)<=b)
#define  rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define  _for(i, end) for (__typeof(end) i = 0; i < (end); i += 1)
#define all(x) (x).begin(),(x).end()
//#define len(array)  (sizeof(array)/sizeof((array)[0]))
#define what_is(x) cerr << #x << " is " << x << endl;
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
#define mod(x, m) ((((x) % (m)) + (m)) % (m))
const double PI = 2 * acos(.0);
const int INF = 0x3f3f3f3f;
const ll LLINF = 1000000000000000005LL;;
const ll MOD = (ll) (1e9) + 7;
void _mod(ll &x){x = mod(x, MOD);}
//const ll MOD = (ll) 998244353 ;
const double EPS = 1e-10;

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


class DWeLikeAGC {
public:
    ll memo[104][4][4][4];
    bool wa3(int a,int b,int c){
        return a==0 && b == 2 && c == 1 || (a == 0 && b == 1 && c == 2) || (a == 2 && b == 0 && c == 1);
    }
    bool wa(int a, int b, int c){
        return a==0 && b == 2 && c == 1;
    }
    bool ok(int c0, int c1, int c2 ,int c3){
        if(wa(c0, c1, c2) || wa(c0, c2, c1) || wa(c0,c1,c3) || wa(c0,c2,c3) || wa(c2,c1,c3) || wa(c1,c3,c2) || wa(c1,c2,c3) || wa(c1,c0,c2))return 0;
        return 1;
    }
    ll dp(int n, int c1, int c2, int c3){
        if(n == 3)return !wa3(c1,c2,c3);
        if(wa3(c1,c2,c3))return 0;
        if((ll)memo[n][c1][c2][c3] != -1)return memo[n][c1][c2][c3];
        ll sum = 0;
        _for(c0,4)if(ok(c0,c1,c2,c3))sum += dp(n-1,c0,c1,c2),sum %= MOD;
        return memo[n][c1][c2][c3] = sum;
    }
void solve(std::istream& cin, std::ostream& cout) {
    Fill(memo,-1);
    ll sum = 0;
    int N;
    cin >> N;
    _for(i,4)_for(j,4)_for(k,4)sum += dp(N,i,j,k), sum %= MOD;
    cout << sum << endl;
}
};


#undef int
int main() {
	DWeLikeAGC solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


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

/**
 * Created by sonekenichiro on 2017/06/28.
 */
public class Main {
    public static void main(String[] args) {
        Scanner sc =new Scanner(System.in);


        while(true){

            String[] line = sc.nextLine().split(" ");
            int personNum = Integer.parseInt(line[0]);
            int maxStoneNum = Integer.parseInt(line[1]);


            if(personNum==0&&maxStoneNum==0){
                break;
            }


            int[] people=new int[personNum];
            Arrays.fill(people,0);


            int stoneNum=maxStoneNum;
            int personIndex=-1;

            while(true){
                for (int i =0;i<personNum;i++){
                    if(stoneNum==0){//??????????????£??????
                        stoneNum=people[i];
                        people[i]=0;

                    }else{
                        stoneNum -= 1;
                        people[i] += 1;
                    }


                    if(people[i]==maxStoneNum){//??°???????????¨??¨?????£?????????
                        personIndex=i;
                        break;
                    }
                }


                if(personIndex!=-1){
                    System.out.println(personIndex);
                    break;
                }

            }


        }//??°?????????



    }
}

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

using namespace std;

#define ll long long
#define forn(i, n) for (ll i = 0; i < (ll) n; ++i)
#define sz(a) static_cast<int>(a.size())

char buff[(int) 2e7 + 17];
const ll inf = (ll) 1e9 + 7ll;

const int maxn = (int) 1e6 + 17;

int n, a, b;

bool read() {
    if (scanf("%d %d %d", &n, &a, &b) != 3)
        return false;

    return true;
}

void solve() {
    if ((b - a) & 1)
        printf("Borys\n");
    else
        printf("Alice\n");
}

int main() {
#if SEREZHKA
    freopen("file.in", "r", stdin);
#endif

    while (read())
        solve();

    return 0;
}


Measured memory_bytes: 256
import sys
from collections import deque
input = sys.stdin.buffer.readline

N, M = map(int, input().split())
adj = [[] for _ in range(N+1)]
for _ in range(M):
    l, r, d = map(int, input().split())
    adj[l].append((r, d))
    adj[r].append((l, -d))

seen = ['!'] * (N+1)
for i in range(1, N+1):
    if seen[i] == '!':
        que = deque()
        seen[i] = 0
        que.append(i)
        while que:
            v = que.popleft()
            for u, d in adj[v]:
                if seen[u] == '!':
                    seen[u] = seen[v] + d
                    que.append(u)
                else:
                    if seen[v] + d != seen[u]:
                        print('No')
                        exit()
print('Yes')


Measured memory_bytes: 76448
#include <stdio.h>

int main( void )
{
    int a,b,c,d,e,f;
    float x,y;
    
    while(scanf("%d %d %d %d %d %d",&a,&b,&c,&d,&e,&f)!=-1){    
        y = (float)( c*d -a*f ) / (b*d-a*e); 
        x = (float)( c*e -b*f ) / (a*e-b*d);
        if(-0.0005<x && x<=0 ){
            x = 0;
        }
        if(-0.0005<y && y<=0 ){
            y = 0;
        }
        printf( "%.3lf %.3f\n",x,y); 
    }
    return 0;
}

Measured memory_bytes: 1680
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>

const int s=1001;

using namespace std;

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

	long long int a,b,c,x,y,mini;
	long long int ans;
	cin >> a >> b >> c >> x >> y;

	if(a+b <= 2*c){
		ans = a*x + b*y;
	}else{
		mini = min(x,y);
		ans = mini * c * 2;
		x -= mini;
		y -= mini;
		if(x == 0 && y != 0){
			if(b <= 2*c){
				ans += b * y;
			}else{
				ans += c * y * 2;
			}
		}else if(y == 0 && x != 0){
			if(a <= 2*c){
				ans += a * x;
			}else{
				ans += c * x * 2;
			}
		}
	}
	cout << ans << "\n";

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<string> vs;
typedef pair<int, int> P;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()

void YN(bool flg){if(flg) cout << "YES" << endl; else cout << "NO" << endl;}
void Yn(bool flg){if(flg) cout << "Yes" << endl; else cout << "No" << endl;}
void yn(bool flg){if(flg) cout << "yes" << endl; else cout << "no" << endl;}

int main() {
    int n, k;
    cin >> n >> k;
    map<int, int> m;
    rep(i, n) {
        int a;
        cin >> a;
        m[a]++;
    }

    /*
    cout << m.size() << endl;

    for(auto p : m) {
        cout << "1:" << p.first << " " << "2:" << p.second << endl;
    }
    */
    vi tmp;
    for(auto p : m) {
        tmp.push_back(p.second);
    }
    sort(all(tmp));

    int diff = 0;
    if(m.size() > k) {
        diff = m.size() - k;
    }

    int ans = 0;
    rep(i, diff) {
        ans += tmp[i];
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 10748
s = str(input())
t = str(input())

dp = [[0]*3100 for _ in range(3100)]

for i in range(len(s)):
    for j in range(len(t)):
        if s[i] == t[j]:
            dp[i+1][j+1] = max(dp[i+1][j+1], dp[i][j]+1)
        dp[i+1][j+1] = max(dp[i+1][j+1], dp[i+1][j])
        dp[i+1][j+1] = max(dp[i+1][j+1], dp[i][j+1])

i = len(s)
j = len(t)
ans = []
while i > 0 and j > 0:
    if dp[i][j] == dp[i-1][j]:
        i -= 1
    elif dp[i][j] == dp[i][j-1]:
        j -= 1
    else:
        ans.append(s[i-1])
        i -= 1
        j -= 1
ans.reverse()
print(''.join(ans))


Measured memory_bytes: 149792
#include <stdio.h> 
 #include <math.h> 
 #define MAX 1000 
 
 
 int main(){ 
     int n; 
     int i, j=0, sum; 
     int score[MAX]; 
     double ave, tmp; 
     double dev[MAX]; 
 
 
     while(1){ 
         scanf("%d", &n); 
         if(n==0)break; 
         sum=0; 
         for(i=0;i<n;i++){ 
             scanf("%d", &score[i]); 
             sum+=score[i]; 
         } 
         ave=(double)sum/(double)n; 
         tmp=0.0; 
         for(i=0;i<n;i++){ 
             tmp+=pow(score[i]-ave, 2); 
         } 
         dev[j++]=sqrt(tmp/(double)n); 
     } 
     for(i=0;i<j;i++){ 
         printf("%f\n", dev[i]); 
     } 
     return 0; 
 } 



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

using namespace std;

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

    int i,j,k;
    i = j = k = 0;

    char s = 'a';

    while(true)
    {
        if(s == 'a')
        {
            if(i == a.size())
            {
                cout << 'A';
                return 0;
            }

            s = a[i++];
        }
        else if(s == 'b')
        {
            if(j == b.size())
            {
                cout << 'B';
                return 0;
            }

            s = b[j++];
        }
        else if(s == 'c')
        {
            if(k == c.size())
            {
                cout << 'C';
                return 0;
            }

            s = c[k++];
        }
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <functional>
#include <iomanip>
#include <bitset>
using namespace std;

typedef long long ll;

vector<ll> l(1000005), r(1000005);

int main() {
	int N; cin >> N;
	string S; cin >> S;
	S = "0" + S;
	int Q; cin >> Q;
	for (int i = 1; i <= N; i++) {
		l[i] = l[i - 1] + (S[i] == 'D');
	}
	for (int i = N; i >= 1; i--) {
		r[i] = r[i + 1] + (S[i] == 'C');
	}
	for (int q = 0; q < Q; q++) {
		int k; cin >> k;

		ll cntm = 0, cntc = 0;
		for (int i = 1; i <= k; i++) {
			if (S[i] != 'M') continue;
			cntm++;
			cntc += r[i + 1] - r[k + 1];
		}

		ll ans = S[1] == 'D' ? cntc : 0;
		for (int i = 2; i < N; i++) {
			if (S[i - 1] == 'M') {
				cntc -= r[i] - r[min(i + k - 1, N + 1)];
				cntm--;
			}

			if (i + k - 1 > N);
			else if (S[i + k - 1] == 'M') {
				cntm++;
			}
			else if (S[i + k - 1] == 'C') {
				cntc += cntm;
			}

			if (S[i] == 'D') {
				ans += cntc;
			}
		}
		cout << ans << endl;
	}
	return 0;
}


Measured memory_bytes: 17924
#include<iostream>
using namespace std;
int main()
{
    int a,b,c;
    cin>>a>>b>>c;
    int q,w,r;
    q=a+b;
    w=a+c;
    r=b+c;
    if(q<=w&&q<=r)
    {
        cout<<q;
    }
    else if(w<=q&&w<=r)
    {
        cout<<w;
    }
else
{
    cout<<r;
}





    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int             long long int
#define pb              push_back
#define se              second
#define mp              make_pair
#define fi              first
#define del(a,vec)      vec.erase(std::remove(vec.begin(), vec.end(), a), vec.end());
#define search(f,l,v)   binary_search(f,l,v)
#define iter(a,b)       vector<int>::iterator a,b
#define lower(v,num)    lower_bound (v.begin(), v.end(), num);
#define upper(v,num)    upper_bound (v.begin(), v.end(), num); 
#define removecopy(a)   unique(a.begin(), a.end()); 
#define vi              vector<int> 
#define pi              pair<int,int>    
#define vpi             vector<pi>      
#define mlbb            ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)    
int mod =1000000007;
namespace Rahul{
    bool isPrime(int n) 
    {if (n <= 1)  return false; if (n <= 3)  return true; 
    if (n%2 == 0 || n%3 == 0) return false; 
    for (int i=5; i*i<=n; i=i+6) 
        if (n%i == 0 || n%(i+2) == 0) 
           return false; 
    return true; }
    int pow (int x, int n,int mod) {//calculate x^n
    if (n == 0) return 1;

    int res = pow (x, n / 2,mod);

    res = (res * res) % mod;
    if (n % 2) res = (res * x ) % mod;

    return res;
    }
    int _gcd(int a,int b)
    {
        if(a==0)
            return b;
        else    
            return _gcd(b%a,a);
    }
    //s.erase(s.find(2)) where s={1,2,3,3,2}; 
};
using namespace Rahul;
int32_t main()
{
        
     mlbb;   
     int a,b;
     cin>>a>>b;
     int mul=a*b;
     mul = mul/_gcd(a,b);
     cout<<mul<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define len(v) ll(v.size())
#define fi first
#define se second

template <class T>
void cout_vec(const vector<T> &vec){
  for(auto itr:vec) cout<<itr<<' ';
  cout<<'\n';
}

typedef pair<ll,ll> P;
const ll mod=1e9+7;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin>>n;
    vector<ll> p(n+1);
    FOR(i,1,n+1) cin>>p[i];
    vector<ll> x(n+1);
    FOR(i,1,n+1) x[p[i]]=i;
    vector<ll> a(n+1),b(n+1);
    FOR(i,1,n+1){
      a[i]=30000*i;
      b[i]=30000*(n-i)+x[i];
    }
    FOR(i,1,n+1){
      cout<<a[i]<<' ';
    }
    cout<<endl;
    FOR(i,1,n+1){
      cout<<b[i]<<' ';
    }
    cout<<endl;
}

Measured memory_bytes: 1280
#include<bits/stdc++.h>
using namespace std;
/*#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
/*template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
*/typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll,ll> pl;
typedef pair<int,int> pii;

#define LOCAL 0
#define dbg(x) cout << #x << " is " << x << "\n"
#define gll(x) scanf("%d",&x)
#define gll2(x,y) scanf("%d%d",&x,&y)
#define gll3(x,y,z) scanf("%d%d%d",&x,&y,&z)
#define gllarr(arr,n) f(i,n) gll(arr[i]);
#define sz(x) ((int)x.size())
#define s(x) sort(x.begin(),x.end())
#define all(v) v.begin(),v.end()
#define rs(v) { s(v) ; r(v) ; }
#define r(v) {reverse(all(v));}
#define pb push_back
#define f(i,n) for(int i=0;i<n;i++)
#define fr(i,n) for(int i=n-1;i>=0;i--)
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define repr(i,a,b) for(int i=a;i>=b;i--)

const ll mod = (ll)1e9 + 7;
const ll inf = (ll)1e16;
const ld eps = 1e-12;
const ll N = (int)1e5 + 5;
const ll LOGN = 19;
const ld PI = 3.14159265358979323846;
inline ll mul(ll a, ll b, ll m = mod) { return (ll)(a * b) % m;}
inline ll add(ll a, ll b, ll m = mod) { a += b; if(a >= m) a -= m; if(a < 0) a += m; return a;}
inline ll power(ll a, ll b, ll m = mod) { if(b == 0) return 1; if(b == 1) return (a % m); ll x = power(a, b / 2, m); x = mul(x, x, m); if(b % 2) x = mul(x, a, m); return x;}

map<int, int> mp1, mp2;
vector<int> ans;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    if (LOCAL) {
        freopen("C:\\Users\\Dishant\\Desktop\\Collection-DEV c++\\input.txt", "r", stdin);
        freopen("C:\\Users\\Dishant\\Desktop\\Collection-DEV c++\\output.txt", "w", stdout);
    }
    int a, b, k;
    cin>>a>>b>>k;
    rep(i, 1, a){
        if(a % i) continue;
        mp1[i]++;
    }
    rep(i, 1, b){
        if(b % i) continue;
        mp2[i]++;
    }
    for(auto &it : mp1){
        if(mp2.find(it.first) != mp2.end()) ans.pb(it.first);
    }
    rs(ans);
    cout<<ans[k - 1];
    return 0;
}

Measured memory_bytes: 256
n = gets.chomp.to_i

def to_755(n)
  n.gsub('3','7').gsub('2', '5').gsub('1', '3')
end

ans = 0
1000000.times do |i|
  s = i.to_s(4)
  next if s.include?('0')
  break if to_755(s).to_i > n
  if s.split(//).uniq.size == 3
    ans += 1
    # p to_755(s)
  end
end

puts ans


Measured memory_bytes: 1916
N = int(input())
words = [input()]
last_word = words[0][-1]
flag = 1
for i in range(1, N):
    word = input()
    if word in words or word[0] != last_word:
        flag = 0
    words.append(word)
    last_word = word[-1]
if flag:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
#define ll long long
vector<ll> g,v;
map<ll,ll> ANS,mp,mp1;
ll ans = 0,d,pw10[20],digit;
ll solve(int n,ll d) {
	if (n == 1)	{
		if (d == 0) return 10;
		return 0;
	}
	if (n == 0) return d == 0;
	ll x = pw10[n-1] - 1;
	for (int i = -9; i <= 9; i++) {
		if ( abs(d - x*i) < pw10[n-1] ) {
			if ((d - x*i)%10 == 0) {
				ll f = 0;
				if (digit == n) f = mp1[i];
				else f = mp[i];
			return solve(n-2,(d - x*i)/10)*f;
		}
		}
	}
	return 0;
}
main() {
	ll d;
	cin >> d;
	pw10[0] = 1;
	for (int i = 1; i <= 18; i++) 
		pw10[i] = pw10[i-1]*10;
	for (int i = 0; i <= 9; i++)
	for (int j = 0;j  <= 9; j++)
		mp[i-j]++;
	for (int i = 1; i <= 9; i++)
	for (int j = 1; j <= 9; j++) {
		mp1[i-j]++;
	}
	ll ans = 0;
	for (int i = 1; i <= 19; i++) {
		digit = i;
		ans += solve(i,d);
	}
	cout << ans;
}

Measured memory_bytes: 3652
#include<cstdio>
#include<algorithm>
#include<iostream>



using namespace std;



int h,w,ans= 0;
char m[110][110];
int dx[] = {1,-1,0,0},dy[] = {0,0,1,-1};
int dp[110][110];

void dfs(int i,int j)
{
	dp[i][j] = -1;
	for(int k = 0;k < 4;k++)
	{
		if(dp[i+dy[k]][j+dx[k]] != -1 && m[i][j] == m[i+dy[k]][j+dx[k]])
		dfs(i+dy[k],j+dx[k]);
	}
	return;
}

int main()
{
	fill_n(dp[0],110*110,-1);
	for(;;)
	{
		cin >> h >> w;
		if(h == 0&& w == 0)break;
		ans = 0;
		for(int i = 1;i <= h;i++)
			for(int j = 1;j <= w;j++)
				scanf(" %c",&m[i][j]),dp[i][j] = 0;
		
		for(int i = 1;i <= h;i++)
		{
			for(int j = 1;j <= w;j++)
			{
				if(dp[i][j] != -1)
				{
					dfs(i,j);
					ans++;
				}
			}
		}
		cout << ans << endl;
	}
	return 0;
}

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

using namespace std;

int main() {
    ios_base::sync_with_stdio(false); cin.tie(0);
    int n, m, k;
    cin >> n >> m >> k;
    vector<string> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    int ans = 0;
    for (int maskI = 0; maskI < (1<<n); maskI++) {
        for (int maskJ = 0; maskJ < (1<<m); maskJ++) {
            auto b = a;
            for (int i = 0; i < n; i++) {
                if ((maskI & (1<<i)) > 0) {
                    for (int j = 0; j < m; j++) {
                        b[i][j] = '.';
                    }
                }
            }
            for (int j = 0; j < m; j++) {
                if ((maskJ & (1<<j)) > 0) {
                    for (int i = 0; i < n; i++) {
                        b[i][j] = '.';
                    }
                }
            }
            int cnt = 0;
            for (int i = 0; i < n; i++) {
                for (int j = 0; j < m; j++) {
                    if (b[i][j] == '#') {
                        cnt++;
                    }
                }
            }
            if (cnt == k) {
                ans++;
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 3616
#include<iostream>
#include<algorithm>
using namespace std;
int a[3];
int main()
{
    cin>>a[0]>>a[1]>>a[2];
    sort(a,a+3);
    int ans=2*a[2]-a[1]-a[0];
    if (ans%2)
        ans+=3;
    ans/=2;
    cout<<ans<<endl;
    return 0;
}


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

const ll MOD = 998244353;
const int MAX_N = 1e5+10;
int N;
int D[MAX_N];

void solve()
{
	if(D[0]){
		cout << 0 << "\n";
		return;
	}
	sort(D, D+N);
	if(N>1 && !D[1]){
	    cout << 0 << "\n";
	    return;
	}
	if(D[N-1]>N-1){
		cout << 0 << "\n";
		return;
	}
	map<int, int> cnt;
	for(int i=1;i<N;++i) cnt[D[i]]++;
	ll ans = 1LL;
	for(int i=2;i<=D[N-1];++i){
	    if(!ans) break;
	    for(int j=0;j<cnt[i];++j)
		    ans = (ans * cnt[i-1])%MOD;
	}
	cout << ans << "\n";
}

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


Measured memory_bytes: 5376
#include<iostream>
#include<string>
#include<algorithm>

using namespace std;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	string S;
	cin >> S;
	int cnt = 0;
	int cnt2 = 0;
	for (int i = 0; i < S.length(); i++){
		if (S[i] == '0') {
			cnt++;
		}
		else if (S[i] == '1') {
			cnt2++;
		}
	}
	cout << min(cnt, cnt2) * 2 << endl;


	return 0;
}

Measured memory_bytes: 512
/*
 * Author : Andrew J
*/
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
using ll = long long;
using ii = pair <int , int>;
void in(int &x);
const int INF = 1e9;
const int N = 3005;
char s[N], t[N];
int sl, tl, dp[N][N];

int f(int curs , int curt) {
  if (curs > sl || curt > tl) return 0;
  int &sol = dp[curs][curt];
  if (sol != -1) return sol;
  sol = max(f(curs + 1 , curt) , f(curs , curt + 1));
  if (s[curs] == t[curt]) {
    sol = max(sol , f(curs + 1 , curt + 1) + 1);
  }
  return sol;
}

void backtrack(int curs , int curt) {
  if (curs > sl || curt > tl) return;
  int take = -INF, skips, skipt;
  skips = f(curs + 1 , curt);
  skipt = f(curs , curt + 1);
  if (s[curs] == t[curt]) {
    take = f(curs + 1 , curt + 1) + 1;
  }
  if (take >= max(skips , skipt)) {
    printf("%c" , s[curs]);
    backtrack(curs + 1 , curt + 1);
  } else {
    if (skips > skipt) {
      backtrack(curs + 1 , curt);
    } else {
      backtrack(curs , curt + 1);
    }
  }
}

int main() {
  scanf("%s" , s + 1);
  scanf("%s" , t + 1);
  sl = strlen(s + 1);
  tl = strlen(t + 1);
  memset (dp , -1 , sizeof dp);
  backtrack(1 , 1);
  puts("");
  return 0;
}

void in(int &x){
	bool neg = false;
	register int c;
	x = 0;
	c = getchar();
	if(c == '-'){
		neg = true;
		c = getchar();
	}
	for (; c > 47 && c < 58; c = getchar())
	x = (x << 1) + (x << 3) + c - 48;
	if (neg) x *= -1;
}


Measured memory_bytes: 39512
#include<bits/stdc++.h>
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
#define vi vector<ll>
#define vvi vector<vi>
#define BITLE(n) (1LL<<((ll)n))
#define SHIFT_LEFT(n) (1LL<<((ll)n))
#define SUBS(s,f,t) ((s).substr((f),(t)-(f)))
#define ALL(a) (a).begin(),(a).end()
using namespace std;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n,m;cin>>n>>m;
  vi A(n);
  for(auto &a:A)cin>>a;
  sort(ALL(A));
  ll ans = llINF;
  for(int i=0;i<=n-m;i++){
    ans = min(ans,A[i+m-1]-A[i]);
  }
  cout<<ans<<endl;
  return 0;
}


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

using ll = long long;
using Pi = pair < int, int >;

constexpr int INF = (1 << 30) - 1;
constexpr int dy[] = { 1, 0, -1, 0, 1, -1, -1, 1 };
constexpr int dx[] = { 0, 1, 0, -1, 1, 1, -1, -1 };
constexpr int mod = 1000000007;
template < typename T > T gcd(T a, T b) { return ( b ? gcd(b, a % b) : a ); }
template < typename T > T lcm(T a, T b) { return ( a / gcd(a, b) * b ); }

int main()
{
    ll N;
    ll cnt[100005] = {};
    ll ans = 1;

    cnt[0] = 3;
    cin >> N;
    for ( int i = 0; i < N; i++ ) {
        ll A;
        cin >> A;
        (ans *= cnt[A]) %= mod;
        cnt[A]--;
        cnt[A + 1]++;
    }

    cout << ans << endl;

    return ( 0 );
}


Measured memory_bytes: 1024
#include<stdio.h>
#include<stdlib.h>
#include<string.h>


struct node{
  int key;
  struct node *right,*left,*parent;
};

struct node *root,*NIL;

struct node * search(struct node *a,int k){
while(a!=NIL&&k!=a->key){
  if(k<a->key)a=a->left;
  else a=a->right;
}
return a;
}

void insert(int k){
struct node *y=NIL;
struct node *x=root;
struct node *z;
z=malloc(sizeof(struct node));
z->key = k;

z->left = NIL;
z->right = NIL;
while(x!=NIL){
  y=x;
  if(k < x->key) x=x->left;
  else x=x->right;
}
 z->parent=y;
 if(y==NIL)root=z;
 else{
    if(y->key>k)y->left=z;

    else y->right=z;
    }
  }



void inorder(struct node *z){
  if(z==NIL)return;
  inorder(z->left);
  printf(" %d",z->key);
  inorder(z->right);
}
void preorder(struct node *z){
if(z==NIL) return;
printf(" %d",z->key);
preorder(z->left);
preorder(z->right);
}

int main(){
  int i,n,x;
  char str[10];
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%s",str);
    if(str[0]=='f'){
      scanf("%d",&x);
      struct node *t=search(root,x);
      if(t!=NIL)printf("yes\n");
      else printf("no\n");
      }
    else if(strcmp(str,"insert")==0){
        scanf("%d",&x);
        insert(x);
      }
    else if(strcmp(str,"print")==0){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    }
  }
return 0;
}



Measured memory_bytes: 20496
N=int(input())
L=list(map(int,input().split()))
L.sort()
ans = 0
i = 0
while i < N - 2:
    j = i + 1
    k = j + 1
    while j < N - 1:
        while k < N:
            if L[i] + L[j] <= L[k]:
                ans += k - j - 1
                break
            k += 1
        if k == N:
            ans += k - 1 - j
        j += 1
    i += 1
print(ans)

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

int main()  
{  
    int a,b,c;
    int s;
    cin>>a>>b>>c;
    s=a+b+c;
    if(s>=22)
        cout<<"bust"<<endl;
    else
        cout<<"win"<<endl;


    return 0;  
}  
  


Measured memory_bytes: 3600
#!/usr/bin/env python3

def main():
    N = int(input())
    p = list(map(int, input().split()))

    r = 0
    i = 0
    while i < N:
        if p[i] == i + 1:
            r += 1
            i += 1
        i += 1

    print(r)


if __name__ == '__main__':
    main()



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

public class Main {
	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		
		int n = sc.nextInt();
		int l = sc.nextInt();
		int[] a = new int[n];
		for(int i = 0; i < n; i++) {
			a[i] = sc.nextInt();
		}
		
		for(int i = 0; i < n-1; i++) {
			if(a[i] + a[i+1] >= l) {
				System.out.println("Possible");
				for(int j = 0; j < i; j++) {
					System.out.println(j+1);
				}
				for(int j = n-2; j > i; j--) {
					System.out.println(j+1);
				}
				System.out.println(i+1);
				return;
			}
		}
		System.out.println("Impossible");
		return;
	}
	
}

class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
    private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
    private void skipUnprintable() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;}
    public boolean hasNext() { skipUnprintable(); return hasNextByte();}
    
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    
    public int nextInt() {
    	return (int)nextLong();
    }
    
    public long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true){
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return minus ? -n : n;
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
}

Measured memory_bytes: 27904
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <memory.h>
#include <limits.h>
#include <float.h>
#include <math.h>

int main(int argc, char *argv[])
{
    int p, q, r;
    int ans;

    scanf("%d %d %d", &p, &q, &r);

    ans = p + q;
    ans = fmin(ans, q + r);
    ans = fmin(ans, r + p);

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

    return 0;
}

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

/*** Typedef ***/
typedef long long ll;
typedef unsigned long long ull;

/*** Loops ***/
#define ffit(i, dat)    for (__typeof(dat.begin()) i = dat.begin(); i != dat.end(); ++i)
#define ff1(i,a,b) for(ll i = a; i <b; i++)
#define ff2(i,a,b) for(ll i = b-1; i >= a; i--)
#define ff3(i,a,b,m) for(ll i = a; i <=b; i+=m)
#define ipar(ar,n) ll ar[n]; ff1(i,0,n) cin>>ar[i];
#define opar(ar,n) ff1(i,0,n) cout<<ar[i]<<" ";
#define foRev(num) for(ll i = num - 1; i >= 0; i--)
#define forIn(arr, num) for(ll i = 0; i < num; i++) sc1(arr[i]);
#define forIn1(arr, num) for(ll i = 1; i <= num; i++) sc1(arr[i]);
#define vpnt(ans) for(ll i = 0; i < ans.size(); i++) cout << ans[i] << (i + 1 < ans.size() ? ' ' : '\n');
#define apnt(arr, num) for(ll i = 0; i < num; i++) cout << arr[i] << (i + 1 < num ? ' ' : '\n');

/*** Define Values ***/
//#define mod 1000000007
#define PI acos(-1.0)
#define eps 1e-7
#define size1 15

/*** STLs ***/
#define rsz(x...) resize(x)
#define ins(x...) insert(x)
#define ft() front()
#define bk() back()
#define eb(x...) emplace_back(x)
#define lb(x...) lower_bound(x)
#define ub(x...) upper_bound(x)
#define pb push_back
#define ff first
#define ss second
#define mp make_pair
#define mem(name, value) memset(name, value, sizeof(name))
#define endl " \n"

/*** STLs ***/
typedef vector <ll> vll;
#define vvll vector<vll>
typedef set <ll> sll;
typedef multiset <ll> msll;
typedef queue <ll> qll;
typedef map <ll, ll> mll;
typedef pair <ll, ll> pll;
typedef vector <pair <ll, ll> > vpll;

///vector<vector<int>> v(10, vector<int>(20,500)); 2d vector initialization. of 10 rows and 20 columns, with value 500.

/*** Sorts ***/
#define all(v) (v).begin(), (v).end()
#define rev(v) reverse(all(v))
#define srt(v) sort(all(v))
#define srtgrt(v) sort(all(v), greater<ll>())
#define prsrt greater<pair<int,int>>()
/*** Some Prints ***/
#define q2(n) (n%2)==0
#define ip(n) ll n; cin>>n;
#define en cout << '\n';
#define no cout << "NO" << '\n'
#define yes cout << "YES" << '\n'
#define case cout << "Case " << t++ << ": ";
#define ps(x,y)         fixed<<setprecision(y)<<x
#define inf             1e18
#define debug(x) cout << '>' << #x << ':' << x << endl;
//const ll N = 1e6 + 9;
#define w(x)             ll x; cin>>x; while(x--)
//#define SIZE_INT sizeof(int) * 4
ll lcm(ll a, ll b){return (a*b)/__gcd(a, b);}
int main()
{
    ip(n);
    cout<<lcm(2,n);

return 0;
}








Measured memory_bytes: 256
#include <stdio.h>

int main(){
  int a,b,c,i,num;
  
  scanf("%d %d",&a,&b);
  c=b;
  for(i=1;i<=c;i++){
    num=b;
    b=a%b;
    a=num;
    if(b==0)break;
  }
  printf("%d\n",a);
  
  return 0;
}

Measured memory_bytes: 592
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.next());
        String S = sc.next();
        int[] answers = new int[2*N];
        char[] animals = new char[2*N];
        for (int i=0;i<N;i++) {
            if (S.charAt(i)=='o') answers[i]=1;
        }
        answers[N]=answers[0];

        int flag = 0;
        StringBuilder sb = new StringBuilder();

        for (int j=0;j<4;j++) {
            if (j%2==0) animals[0]='S';
            else animals[0]='W';
            if (j/2==0) animals[1]='S';
            else animals[1]='W';
            for (int i=0;i<N;i++) {
                animals[i+2]=put_animal(animals[i], animals[i+1], answers[i+1]);
            }
            if (animals[N]==animals[0] && animals[N+1]==animals[1]) {
                flag=1;
                sb = new StringBuilder();
                for (int i=0;i<N;i++) {
                    sb.append(animals[i]);
                }
            }
        }

        if (flag==0) System.out.println(-1);
        else System.out.println(sb);
    }

    static char put_animal(char before, char center, int answer) {
        if (before=='S' && center=='S') {
            if (answer==1) return 'S';
            else return 'W';
        } else if (before=='S' && center=='W') {
            if (answer==1) return 'W';
            else return 'S';
        } else if (before=='W' && center=='S') {
            if (answer==1) return 'W';
            else return 'S';
        } else {
        // } else if (before=='W' && center=='W') {
            if (answer==1) return 'S';
            else return 'W';
        }
    }
}

Measured memory_bytes: 24512
#include <bits/stdc++.h>
#define ll long long int
using namespace std;
#define MAX 200005
#define MOD 1000000007
#define max(a,b) (a>b?a:b)
#define min(a,b) (a<b?a:b)
#define vi vector<int>
#define ii pair<int,int>
#define vii vector<ii>
#define si set<int>
#define mp map<ll,ll>
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
ll dp[3005][3005];
int main()
{ 
	fast 
	string s,t;
	cin>>s>>t;
	ll i,j;
	for(i=0;i<=s.length();i++)
	{
		dp[0][i]=0;
	}
	for(i=0;i<=t.length();i++)
	{
		dp[i][0]=0;
	}
	for(i=1;i<=s.length();i++)
	{
		for(j=1;j<=t.length();j++)
		{
			if(t[j-1]==s[i-1])
			{
				dp[i][j]=dp[i-1][j-1]+1;
			}
			else
			{
				dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
			}
		}
	}
	i=s.length();
	j=t.length();
	char lcs[dp[s.length()][t.length()]+5];
	ll index=dp[s.length()][t.length()];
	while(dp[i][j])
	{
		if(s[i-1]==t[j-1])
		{
			lcs[index-1]=s[i-1];
			i--;
			j--;
			index--;
		}
		else if(dp[i-1][j]>=dp[i][j-1])
		{
			i--;
		}
		else
		{
			j--;
		}
	}
	for(i=0;i<dp[s.length()][t.length()];i++)
	{
		cout<<lcs[i];
	}
}

Measured memory_bytes: 70784
#include<stdio.h>

/* ?????????????´??????????????????? */
void trace(int A[], int N) {
  int i;
  for ( i = 0; i < N; i++ ) {
    if ( i > 0) printf(" ");  /* ??£??\??????????´?????????????????????????????????? */
      printf("%d", A[i]);
  }
  printf("\n");
}

/* ?????\?????????(0??????????????????) */
void insertionSort(int A[], int N) {
  int j, i, v;
  for ( i = 1; i < N; i++ ) {
    v = A[i];
    j = i - 1;
    while ( j >= 0 && A[j] > v ) {
      A[j + 1] = A[j];
      j--;
    }
    A[j + 1] = v;
    trace(A, N);
  }
}

int main() {
  int N, i, j;
  int A[100];

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

  trace(A, N);
  insertionSort(A, N);

  return 0;
}

Measured memory_bytes: 1032
A, B, C = list(map(int, input().split()))

a = sorted([A, B, C])
s = 0

for i in range(0, 2):
    tmp = a[2] - a[i]
    
    s += tmp // 2
    a[i] += tmp // 2 * 2

s += sum(a) % 3

print(s)

Measured memory_bytes: 3064
N = int(input())
A = [0]*N
B = [0]*N
C = [0]*N
for i in range(N):
    A[i], B[i], C[i] = map(int, input().split())

pointA = [0]*N; pointB = [0]*N; pointC = [0]*N
pointA[0] = A[0]; pointB[0] = B[0]; pointC[0] = C[0]
for i in range(1, N):
    pointA[i] = max(pointB[i-1], pointC[i-1]) + A[i]
    pointB[i] = max(pointA[i-1], pointC[i-1]) + B[i]
    pointC[i] = max(pointA[i-1], pointB[i-1]) + C[i]
print(max((pointA[N-1], pointB[N-1], pointC[N-1])))

Measured memory_bytes: 32584