akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#define FOR(n) for(int i=0;i<n;i++)
#define FORJ(n) for(int j=0;j<n;j++)
#define PRN(n) printf("%d\n",n)
#define PRF(n) printf("%lf\n",n)
#define PRL(n) printf("%lld\n",n)
#define PRS(s) printf("%s\n",s)
#define PRC(c) printf("%c",c)
#define INF 10000000000
#define mod 1000000007
typedef long long int ll;
ll u(const void *a, const void *b){return *(ll*)a-*(ll*)b;}
ll d(const void *a, const void *b){return *(ll*)b-*(ll*)a;}
ll min(ll a,ll b){
  if(a>b)return b;
  return a;
}
ll max(ll a,ll b){
  if(a>b)return a;
  return b;
}
ll gcd(ll a,ll b){
  if(!b)return a;
  return gcd(b,a%b);
}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}
int kt(ll a){
  int sum=0;
  while(a){
    a/=10;
    sum++;
  }
  return sum;
}
int ks(ll a){
  int sum=0;
  while(a){
    sum+=a%10;
    a/=10;
  }
  return sum;
}
ll f(ll a){
  return a*(a+1)/2;
}
int main(void){
  int a,b,ans;
  scanf("%d",&a);
  ans=a*a;
  PRN(ans);
  return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
using st = size_t;
using vi = vector<int>;
using vvi = vector<vi>;
using ll = long long;
using ull = unsigned long long;
#define inf 0x40000000
#define all(v) v.begin(), v.end()
#define alld(v) v.begin(), v.end()
#define rep(i, n) for(int i = 0; i < (int)(n); ++i)
template <typename T> using mptr = T*;
using mp = pair<int, int>;
auto des = [](auto a, auto b) { return a > b; };

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

int main() {
	int n,m,t,t2;
	cin>>n>>m;
	map<int,int>a;
	vector<int>b(n);
	bool yes=true;
	rep(i,m){
		cin>>t>>t2;
		if(!a.count(t-1)){
			a[t-1]=t2;
			b.at(t-1)=t2;
		}else if(a.at(t-1)!=t2){
			yes=false;
			break;
		}
	}
	if(n==3&&!a.count(0))b.at(0)=1;
	if(n==3&&a.count(0)&&a.at(0)==0)yes=false;
	if(n==2&&!a.count(1))b.at(1)=0;
	if(n==2&&!a.count(0))b.at(0)=1;
	if(n==2&&a.count(0)&&a.at(0)==0)yes=false;
	if(n==1&&!a.count(0))b.at(0)=0;
	if(yes)rep(i,n)cout<<b.at(i);
	else cout<<"-1"s;
	cout<<"\n"s;
}

Measured memory_bytes: 256
import Foundation

#if swift(>=4.0)
extension String {
    func split(by separator: String) -> [String] {
        return self.components(separatedBy: separator)
    }
    func toArray() -> [String] {
        return self.map{String($0)}
    }
}
func exponentiate(_ lhs: Int, _ rhs: Int) -> Int {
    return (0..<rhs).reduce(1){i,_ in i*lhs}
}
#else
extension String {
    func split(by separator: String) -> [String] {
        return self.componentsSeparatedByString(separator)
    }
    var count: Int {
        return self.characters.count
    }
    func toArray() -> [String] {
        return self.characters.map{String($0)}
    }
    func uppercased() -> String {
        return self.uppercaseString
    }
    func lowercased() -> String {
        return self.lowercaseString
    }
}
//extension Array where Element == String {
//    func joined(separator separator: String) -> String {
//        return self.joinWithSeparator(separator)
//    }
//}
extension Array where Element: Comparable {
    func max() -> Element {
        return self.maxElement()!
    }
    func min() -> Element {
        return self.minElement()!
    }
    func sorted() -> Array {
        return self.sort()
    }
    func reversed() -> Array {
        return self.reverse()
    }
    mutating func sort() {
        self.sortInPlace()
    }
}
extension Array {
    init(repeating: Element, count: Int) {
        self.init(count: count, repeatedValue: repeating)
    }
}
func stride<T: Strideable>(from start: T, to end: T, by stride: T.Stride) -> StrideTo<T> {
    return start.stride(to: end, by: stride)
}
func exponentiate(lhs: Int, _ rhs: Int) -> Int {
    return (0..<rhs).reduce(1){i,_ in i*lhs}
}
#endif
func readInt() -> Int? {
    return Int(readLine()!)
}
func readStringSplit(by separator: String) -> [String] {
    return readLine()!.split(by: separator)
}
func readIntSplit(by separator: String) -> [Int] {
    return readLine()!.split(by: separator).map{Int($0)!}
}

/*************** テストスペース ***************/

//var min, min2, count: Int!
//for i in 1...10 {
//    let x = readInt()!
//    if i == 1 {
//        min = x
//        count = 1
//    } else if x < min {
//        min2 = min
//        min = x
//        count = 1
//    } else if x == min && count == 1 {
//        min2 = x
//        count = 2
//    }
//}
//print(min2)

/*************** メインプログラム ***************/

let N = readInt()!
var blue = [String : Int]()
for _ in 0..<N {
    let s = readLine()!
    if blue[s] == nil {
        blue[s] = 1
    } else {
        blue[s] = blue[s]! + 1
    }
}
let M = readInt()!
var red = [String : Int]()
for _ in 0..<M {
    let s = readLine()!
    if red[s] == nil {
        red[s] = 1
    } else {
        red[s] = red[s]! + 1
    }
}
var ans = 0
for (s, _) in blue {
    ans = max(blue[s]! - (red[s] ?? 0), ans)
}
print(ans)


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

public class Main {

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        String[] strings = br.readLine().split(" ");
        int[] ls = new int[strings.length];
        for (int i = 0; i < ls.length; i++) {
            ls[i] = Integer.parseInt(strings[i]);
        }
        System.out.println(problem175b(n, ls));
    }

    private static int problem175b(int n, int[] ls) {
        int count = 0;
        for (int i = 0; i < ls.length - 2; i++) {
            int li = ls[i];
            for (int j = i + 1; j < ls.length - 1; j++) {
                int lj = ls[j];
                for (int k = j + 1; k < ls.length; k++) {
                    int lk = ls[k];
                    if (isDifference(li, lj, lk) && isTriangle(li, lj, lk)) {
                        count++;
                    }
                }
            }
        }
        return count;
    }

    private static boolean isDifference(int a, int b, int c) {
        return (a != b && b != c && a != c);
    }

    private static boolean isTriangle(int a, int b, int c) {
        return ((a + b) > c) && ((b + c) > a) && ((c + a) > b);
    }
}

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

//#define var auto
#define ll long long

using namespace std;

int parse(string s)  {
	int res = 0;
	int dig = 0;
	//5m2c3x4i
	for (auto&& c : s) {
		if ('0' <= c && c <= '9') {
			dig = c - '0';
			continue;
		}
		int mul;
		switch (c)
		{
		case 'm':
			mul = 1000;
			break;
		case 'c':
			mul = 100;
			break;
		case 'x':
			mul = 10;
			break;
		case 'i':
			mul = 1;
			break;
		}
		//i
		if (dig == 0) dig = 1;
		res += dig * mul;
		dig = 0;
	}
	return res;
}

string encode(int n) {
	string res = "";
	for (int mul = 1000; mul != 0; mul /= 10) {
		int dig = n / mul;
		if (dig == 0) continue;
		if (dig != 1) {
			res += (char)('0' + dig);
		}
		char c;
		switch (mul)
		{
		case 1000:
			c = 'm';
			break;
		case 100:
			c = 'c';
			break;
		case 10:
			c = 'x';
			break;
		case 1:
			c = 'i';
			break;
		}
		res += c;
		n = n % mul;
	}
	return res;
}

void solve() {
	string s, t;
	cin >> s >> t;
	int a, b;
	a = parse(s);
	b = parse(t);
	int res = a + b;
	cout << encode(res) << endl;
}

int main() {
	int n;
	cin >> n;
	for (size_t i = 0; i < n; i++)
	{
		solve();
	}
}



Measured memory_bytes: 3176
#include <iostream>
#include <cmath>
#include <cstdio>
using namespace std;
#define INF 1 << 29

#define elif else if
#define read cin >>
#define echo cout <<
#define fin << '\n'
#define endl '\n'
#define max min
int a[3];

int main(){
    read a[0] >> a[1] >> a[2];
    int tmp = abs(a[1] - a[0]) + abs(a[2] - a[1]);
    tmp = max(tmp, abs(a[0] - a[1]) + abs(a[2] - a[0]));
    tmp = max(tmp, abs(a[2] - a[1]) + abs(a[0] - a[2]));
    tmp = max(tmp, abs(a[2] - a[0]) + abs(a[1] - a[2]));
    tmp = max(tmp, abs(a[0] - a[2]) + abs(a[1] - a[0]));
    tmp = max(tmp, abs(a[1] - a[2]) + abs(a[0] - a[1]));
    echo tmp fin;
    
	return 0;
}


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

//型定義
typedef long long ll;

//定数
const int INF=1e+9;
const int MOD=1e+9+7;

//REPマクロ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define REP2(i,a,b) for(ll i=a;i<(ll)(b);i++)
#define REPD2(i,a,b) for(ll i=a;i>(ll)(b);i--)

// 多次元 vector 生成
template<class T>
vector<T> make_vec(size_t a){
    return vector<T>(a);
}
template<class T, class... Ts>
auto make_vec(size_t a, Ts... ts){
  return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}

//vectorの扱い
#define ALL(x) (x).begin(),(x).end() //sortなどの引数省略
#define SIZE(x) ((ll)(x).size()) //size
#define MAX(x) *max_element(ALL(x)) //最大値
#define MIN(x) *min_element(ALL(x)) //最小値

int main(){
    ll N,M;
    cin>>N>>M;
    string S;
    cin>>S;
    vector<int> ans;
    vector<int> pos_ok;
    REP(i,N+1){
        if(S[i]=='0') pos_ok.push_back(N-i);
    }

    sort(ALL(pos_ok));
    int x=0;
    while(x!=N){
        auto itr=upper_bound(pos_ok.begin(),pos_ok.end(),x+M);
        itr--;
        int next=*itr;
        if(x==next){
            cout<<-1<<endl;
            return 0;
            break;
        }else{
            ans.push_back(next-x);
        }
        x=next;
    }

    REP(i,ans.size()){
        cout<<ans[ans.size()-1-i];
        if(i==ans.size()-1){
            cout<<endl;
        }else{
            cout<<" ";
        }
    }

}

Measured memory_bytes: 4396
N = int(input())
a = [int(i) for i in input().split()]
a.insert(0,0),a.append(0)
k,sum = [],0
for i in range(1,len(a)):
    k.append(abs(a[i-1]-a[i]))
    sum += abs(a[i-1]-a[i])
#print(k,sum)
for i in range(1,N+1):
    if a[i-1]>=a[i]>=a[i+1] or a[i-1]<=a[i]<=a[i+1]:
        print(sum)
    else:
        print(sum-(k[i-1]+k[i])+abs(a[i-1]-a[i+1]))


Measured memory_bytes: 14172
# UnionFind構造

class UnionFind:
    def __init__(self, n):
        self.par = [i for i in range(n+1)]
        self.rank = [0] * (n+1)

    # 検索
    def find(self, x):
        if self.par[x] == x:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]

    # 併合
    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if self.rank[x] < self.rank[y]:
            self.par[x] = y
        else:
            self.par[y] = x
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1
        

    # 同じ集合に属するか判定
    def same_check(self, x, y):
        return self.find(x) == self.find(y)
    
n, m = map(int, input().split())
lst = [list(map(int, input().split())) for _ in range(m)]

count = 0
for i in range(len(lst)):
    llst = lst[:]
    del llst[i]
    a = UnionFind(n)
    for i in llst:
        a.union(i[0], i[1])
    rootset = set()
    for i in range(1, n+1):
        rootset.add(a.find(i))
    if len(rootset)==1:
        pass
    else:
        count += 1
        
print(count)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;

template<class T> struct FenwickTree {
  const int n;
  V<T> t;
  FenwickTree(int n) : n(n), t(n + 1) {}
  void add(int i, T x) { for (++i; i <= n; i += i & -i) t[i] += x; }
  T sum(int i) const {
    T s = 0;
    for (; i; i -= i & -i) s += t[i];
    return s;
  }
  T sum(int l, int r) const { return sum(r) - sum(l); }
};

int main() {
  cin.tie(nullptr); ios::sync_with_stdio(false);
  int n; cin >> n;
  VV<> a(3, V<>(n));
  for (auto&& v : a) for (auto&& e : v) cin >> e;
  V<> v(n);
  int ce = 0, co = 0;
  for (int i = 0; i < n; ++i) {
    if (a[0][i] % 3 == 1) {
      if (a[1][i] != a[0][i] + 1) return cout << "No" << '\n', 0;
      if (a[2][i] != a[0][i] + 2) return cout << "No" << '\n', 0;
    } else if (a[0][i] % 3 == 2) {
      return cout << "No" << '\n', 0;
    } else {
      if (a[1][i] != a[0][i] - 1) return cout << "No" << '\n', 0;
      if (a[2][i] != a[0][i] - 2) return cout << "No" << '\n', 0;
      ++(i & 1 ? co : ce);
    }
    v[i] = (a[0][i] - 1) / 3;
    if (v[i] - i & 1) return cout << "No" << '\n', 0;
  }
  lint ie = 0, io = 0;
  {
    FenwickTree<int> ft(n);
    for (int i = 0; i < n; i += 2) {
      ie += ft.sum(v[i], n);
      ft.add(v[i], 1);
    }
  }
  {
    FenwickTree<int> ft(n);
    for (int i = 1; i < n; i += 2) {
      io += ft.sum(v[i], n);
      ft.add(v[i], 1);
    }
  }
  if (ce - io & 1 or co - ie & 1) return cout << "No" << '\n', 0;
  cout << "Yes" << '\n';
}

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

int main() {
  int N, M, P;
  while (cin >> N >> M >> P, N) {
    auto X = vector<int>(N);
    for (int i = 0; i < N; ++i) cin >> X[i];
    int sum = accumulate(begin(X), end(X), 0);
    cout << ( (X[M - 1] == 0) ? 0 : sum * (100 - P) / X[M - 1] ) << endl;
  }
  return 0;
}



Measured memory_bytes: 3096
N = int(input())
H = map(int, input().split())

counter = -1
last_h = float('inf')
_max = 0
for h in H:
    if h <= last_h:
        counter += 1
    else:
        if _max < counter:
            _max = counter
        counter = 0
    last_h = h
if _max < counter:
    _max = counter
print(_max)

Measured memory_bytes: 11128
//#include <math.h>
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
#include<stdio.h>
#include <iostream>
#include <vector>
//#include <string.h>
using namespace std;
 
int main(){
    int n;
    cin >>n;
    long long ans=1;
    vector<long long> array(n);
    rep(i,n){
        cin >> array[i];
        if(array[i]==0)
            ans =0;
    }
    
    if(ans!=0){
    rep(i,n){
        if(array[i]*ans>1000000000000000000){
            ans = -1;
            break;
        }
        if(array[i]*ans<ans){
            ans = -1;
            break;
        }
        ans *= array[i];
    }
    }
    
    if(ans<0)
        ans =-1;
    
    cout << ans<<endl;
    
}


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

const ll LINF = 1e18;
const int INF = 1e9;
const ll MOD = 1000000007;

int main(){

    int a, b,c;
    cin >> a >> b >> c;
    if(a+b >= c) cout << "Yes" <<endl;
    else cout << "No" << endl; 

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <numeric>
#include <functional>
#include <map>
#include <set>
#define Rep(i, n) for(int i=0;i<n;++i)
#define rep(i, n) for(int i=1;i<=n;++i)
#define ll long long int
#define INF 100000000
#define INFLL 100000000000
#define MOD 1000000007
#define PI 3.14159265359
#define All(a) (a).begin(), (a).end()

using namespace std;
using P = pair<ll, ll>;
 
int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};

struct Edge {
  int to;     
  ll weight; 
  Edge(int t, ll w) : to(t), weight(w) { }
};

template<class T>
inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}

template<class T>
inline bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}

ll GCD(ll m, ll n) {
  if (m == 0) {
    return n;
  } 
  if (n == 0) {
    return m;
  }

  if (m >= n) {
    return GCD(m%n, n);
  } else {
    return GCD(m, n%m);
  }
}


int N;
ll a[110000];
ll l[110000];
ll r[110000];

int main () {
  cin >> N;
  Rep(i, N) cin >> a[i];

  l[0] = a[0];
  for (int i=1;i<N-1;++i) {
    l[i] = GCD(l[i-1], a[i]);
  }

  r[0] = a[N-1];
  for (int i=1;i<N-1;++i) {
    r[i] = GCD(r[i-1], a[N-1-i]);
  }

  ll ans = max(l[N-2], r[N-2]);
  for (int i=0;i<=N-3;++i) {
    ans = max(GCD(l[i], r[N-3-i]), ans);
  }

  //Rep(i, N) {
  //  cout << l[i] << " " << r[i] << "\n";
  //}

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

Measured memory_bytes: 2560
#include <iostream>
#include <vector>

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

    std::vector<int> c(N + 1), v(N + 1);
    for (int i = 0; i < N; i++) {
        int A;
        std::cin >> A;
        ++v[++c[A]];
    }

    for (int i = 0; i < N; i++) v[i + 1] += v[i];
    for (int i = 1; i <= N; i++) v[i] /= i;

    int x = N;
    for (int i = 1; i <= N; i++) {
        while (x > 0 && v[x] < i) x--;
        std::cout << x << "\n";
    }
}

Measured memory_bytes: 3200
import java.util.*;
import java.io.*;
//atcoder
public class Main {
    static ArrayList<Integer>[] graph;
    static final long MOD = 1000000007L;
    static long K;
    public static void main(String[] args) {
        FastScanner scanner = new FastScanner();
        PrintWriter out = new PrintWriter(System.out);
        int N = scanner.nextInt();
        K = scanner.nextInt();
        graph = new ArrayList[N];
        for(int i = 0; i < N; i++) graph[i] = new ArrayList<>();
        for(int i = 1; i < N; i++) {
            int a = scanner.nextInt()-1;
            int b = scanner.nextInt()-1;
            graph[a].add(b);
            graph[b].add(a);
        }
        out.println((K*dfs(0, 0))%MOD);
        out.flush();
    }
    
    static long dfs(int v, int p) {
        if (v != 0 && graph[v].size() == 1) return 1L;
        long ret  = 1;
        long cnt = v == 0 ? -1 : 0;
        for(int edge: graph[v]) {
            if (edge == p) continue;
            ret = (ret * (K-2-cnt))% MOD;
            ret = (ret * (dfs(edge,v))) % MOD;
            cnt++;
        }
        return ret;
    }
    
    public static class FastScanner {
        BufferedReader br;
        StringTokenizer st;
        
        public FastScanner(Reader in) {
            br = new BufferedReader(in);
        }
        
        public FastScanner() {
            this(new InputStreamReader(System.in));
        }
        
        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }
        
        int nextInt() {
            return Integer.parseInt(next());
        }
        
        long nextLong() {
            return Long.parseLong(next());
        }
        
        double nextDouble() {
            return Double.parseDouble(next());
        }
        
        String readNextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
        
        int[] readIntArray(int n) {
            int[] a = new int[n];
            for (int idx = 0; idx < n; idx++) {
                a[idx] = nextInt();
            }
            return a;
        }
    }
}


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

using namespace std;

#define reps(i, n, m) for (int i = (int) (n); i < (int) (m); i++)
#define rep(i, n) reps(i, 0, (n))
#define all(v) (v).begin(), (v).end()

int main() {
    int n; cin >> n;
    vector<int> v(n);
    rep(i, n) cin >> v[i];
    int m; cin >> m;
    vector<int> u(m);
    rep(i, m) cin >> u[i];
    cout << includes(all(v), all(u)) << endl;
}


Measured memory_bytes: 4332
#include<stdio.h>
#include<stdlib.h>
#define LEN 100000

typedef struct pp{
  char name[10];
  int t;
}P;

P Q[LEN];
int head, tail, n,b;
void enqueue(P x);
P dequeue(void);
int a(int,int);

int main(){
  int elaps = 0, c=0;
  int i, q;
  P u;
  scanf("%d %d", &n, &q);

  for ( i = 1; i <= n; i++){
    scanf("%s", Q[i].name);
    scanf("%d", &Q[i].t);
  }
  head=1;
  tail=n+1;
  while(head!=tail){
    u=dequeue();
    c=a(q,u.t);
    u.t=u.t-c;
    elaps=elaps+c;
    if(u.t>0){
      enqueue(u);
    }
    else{
      printf("%s %d\n",u.name,elaps);
    }
  }
  return 0;
}

void enqueue(P x){
  Q[tail]=x;
  tail=(tail+1) % LEN;
}

P dequeue(){
  P x=Q[head];
  head=(head+1) % LEN;
  return x;
}

int a(int x, int y){
  y=x<y ? x:y;
  return y;
}



Measured memory_bytes: 3288
#C
from itertools import accumulate
from collections import deque
import bisect

n,m,k = map(int,input().split())
a = [0] + list(map(int,input().split()))
b = [0] + list(map(int,input().split()))

cnt = 0

a_c = list(accumulate(list(a)))
b_c = list(accumulate(list(b)))
result = []

for i in range(n+1):
    if a_c[i] > k:
        continue
    b_idx = bisect.bisect_left(b_c,k-a_c[i]+1)
    result.append(i+b_idx-1)
    
print(max(result))


Measured memory_bytes: 51232
#include<bits/stdc++.h>				//Written by ThiDaiLoc
using namespace std;				//Team Three Wolves
typedef long long ll;
typedef vector<ll> vi;
typedef pair<ll,ll> pll;
#define fu(i,a,b)   for(ll i=a;i<b;i++)
#define fd(i,b,a)   for(ll i=b;i>=a;i--)
#define ms(a,x) 	memset(a, x, sizeof a)
#define prec(n) 	fixed<<setprecision(n)
#define pb(i)	    push_back(i)
#define popb()    	pop_back()
#define sc(a) 	    cin>>a
#define sc2(a,b)    cin>>a>>b
#define pr(a)	    cout<<a<<" "
#define pr2(a,b)    cout<<a<<" "<<b<<" "
#define lowb(a,n,x) lower_bound(a,a+n,x) -a
#define lowb2(a,x)	lower_bound(a.begin(),a.end(),x) -a.begin()
#define all(x) 		(x).begin(), (x).end()
#define sz(a) 		(ll)a.size()
#define le(s)		(ll)s.length()						
#define re 			return 	
#define	mp(a,b)  	make_pair(a,b)
#define se			second
#define fi			first 
#define debug(x)    cerr << #x << " = " << x << endl
#define INPUT       freopen("locin.txt", "r", stdin)
#define OUTPUT      freopen("locout.txt", "w", stdout)
void inline minize(ll& a,ll b){a=(a>b?b:a);};
void inline maxize(ll& a,ll b){a=(a<b?b:a);};
double const eps = 1e-6;
ll const Base=1e9+7,oo=1e17;


ll arr[1000000],mark[1000000];

ll Solves(){
	//INPUT;
	ll n,k,cnt=0,ans=0,x;
	// PROCESSING IN HERE
	sc(n);
	fu(i,1,n+1)sc(arr[i]);
	
	if(n&1){
		x=n+2;
		while((x-=2)>0)pr(arr[x]);
		x=0;
		while((x+=2)<n)pr(arr[x]);
	}
	else{
		x=n+2;
		while((x-=2)>0)pr(arr[x]);
		x=-1;
		while((x+=2)<n)pr(arr[x]);
	}
	
	
	re 0;
	// Hack it if you can :)
}
int main(){
	
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);

	Solves();
}

Measured memory_bytes: 6272
#include"bits/stdc++.h"
#define int long long
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(a);i<(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define itr(i,x) for(auto i=(x).begin();i!=(x).end();++i)
#define All(x) (x).begin(),(x).end()
#define gridif(a,x,b) if((a)<=(x)&&(x)<(b))

using namespace std;
typedef pair<int,int> P;
const int mod=1000000007;

int digitsum(int n,int b){
	if(b<2) return -1;
	if(n<b) return n;
	return digitsum(n/b,b)+n%b;
}
int mpow(int a,int x);
int m_inv(int n);
vector<int> split(int n,int a);
string xal_number(int n,int x);
int gcd(int x,int y){return y?gcd(y,x%y):x;}
int lcm(int x,int y){return x*y/gcd(x,y);}
class Factorial{
private:
	vector<int> fac;
public:
	Factorial(int N){
		fac.push_back(1);
		rep(i,N) fac.push_back(fac[i]*(i+1)%mod);
	}
	int fact(int a){return fac[a];}
	int ifac(int a){return m_inv(fac[a]);}
	int cmb(int n,int r);
};
struct UnionFind {
    vector<int> par; // 親ノード
    UnionFind(int n = 1) { init(n);}
    void init(int n = 1) {
        par.resize(n);
        rep(i,n) par[i] = -1;
    }
    int root(int x) {
        if (par[x] <0) return x;
        else return par[x] = root(par[x]);      
    }
    int size(int x){ return -par[root(x)];}
    bool issame(int x, int y) {return root(x)==root(y);}
    bool connect(int x, int y);
};

signed main(){
	int K,S;
	cin>>K>>S;
	int ans=0;
	rep(x,K+1){
		rep(y,K+1){
			int z=S-x-y;
			gridif(0,z,K+1) ans++;
		}
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include<algorithm>
#include <cstdlib>

using namespace std;

int main()
{
	int a, b,c,max;
	cin >> a >> b>>c;
	max = a;
	if (max < b) max = b;
	if (max < c) max = c;
	cout << a + b + c - max << endl;
    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector> //動的配列
#include <string>
#include <list> //双方向リスト
#include <map> //連想配列
#include <set> //集合
#include <stack>
#include <queue>
#include <deque>
#include <cmath>
#include <bitset>
#include <numeric>
#include <tuple>




typedef long long ll;


using namespace std;

typedef pair<int, int> P;
#define FOR(i,a,b) for(int i=(int)(a) ; i < (int) (b) ; ++i )
#define rep(i,n) FOR(i,0,n)
#define sz(x) int(x.size())


template <class T>ostream &operator<<(ostream &o,const vector<T>&v)
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}

// n次元配列の初期化。第２引数の型のサイズごとに初期化していく。
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

//小さい順から取り出すヒープ
//priority_queue<ll, vector<ll>, greater<ll> > pque1;

const int mod=1e9+7;

int main(){
    int n;
    cin>>n;
    vector<vector<int>> v(n,vector<int>(n));
    rep(i,n) rep(j,n) {
        cin>>v[i][j];
        //cout<<v[i][j]<<endl;
    }
    
    int dp[n+1][(1<<n)]; //  1<<n 配列がn+1個
    for (int i=0;i<=n;i++) {
        rep(j,1<<n) {
            dp[i][j]=0;
        } 
    }
    
   
    dp[0][0]=1;
    
     for(int i=0;i<n;i++){
        for (int j=0;j<(1<<n);j++){
            if (__builtin_popcount(j)==i){
                for (int k=0;k<n;k++){
                if (v[i][k]==0) continue;
                
                int seni=j|(1<<k);
                if (seni!=j) {
                    dp[i+1][seni]+=dp[i][j];
                    dp[i+1][seni]%=mod;
                    }
                }
            
            }
        }
    }
    
    
    
    cout<<dp[n][(1<<n)-1];
    
    return 0;
    for (int i=0;i<=n;i++) {
        rep(j,1<<n) {
            cout<<dp[i][j];
        } cout<<endl;
    }
}



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

typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<P,ll> PLL;
typedef pair<P,P> PP;
typedef vector<ll> llVEC;
typedef vector<P> PVEC;
typedef priority_queue<P,PVEC,greater<P> > PPQ;
typedef priority_queue<ll, llVEC, greater<ll> > llPQ;

#define rep(i,a,n) for(ll i = a;i < n;i++)
#define rrep(i,a,n) for(ll i = n-1; i >= a;i--)
#define index_check(i,n) if(i > n-1 || i < 0) continue;
#define LINF (ll)1e18
#define INF (int)1e9
#define fs first
#define sc second

template<typename T>
ll sz(vector<T> &vec){ return (ll)vec.size(); }
ll sz(string &s){ return (ll)s.size(); }

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


int main(){
    ll n;

    cin >> n;
    cout << n*(n-1)/2 << endl;
    return 0;
}


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

using namespace std;

int main(){
    int n;
    string ans = "No";
    cin >> n;

    while(n > 0){
        int t;
        t = n%10;
        n /= 10;
        if(t == 9)ans = "Yes";
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int gcd(int a,int b) {
  if(a<b) {
    int tmp=a;
    a=b;
    b=tmp;
  }
  if(a%b==0) return b;
  return gcd(b,a%b);
}

int main() {
  int a=0;
  int b=0;
  while(cin>>a>>b) {
    int n=gcd(a,b);
    cout<<n<<" "<<a/n*b<<endl;
  }
  return 0;
}



Measured memory_bytes: 3076
// code test
#include<iostream>
#include<vector>
#include<algorithm>
#include<math.h>
#include<string>
#include<map>
#include<queue>

using namespace std;

void comb(vector<vector <unsigned long long> >& v) {
	for (unsigned long long i = 0; i < v.size(); i++) {
		v[i][0] = 1;
		v[i][i] = 1;
	}
	for (unsigned long long k = 1; k < v.size(); k++) {
		for (int j = 1; j < k; j++) {
			v[k][j] = (v[k - 1][j - 1] + v[k - 1][j])%1000000007;
		}
	}
}

int main() {
	int N, K;
	cin >> N >> K;
	vector<vector<unsigned long long> > v(2*N , vector<unsigned long long>(2*N, 0));
	comb(v);
	for (int i = 0; i < K; i++) {
		//cout << v[N - K + 1][i + 1] << endl;
		//cout << v[K - 1][i] << endl;
		cout << (unsigned long long)(v[N - K + 1][i + 1] * v[K - 1][i])%1000000007 << endl;
	}
	return 0;
}



Measured memory_bytes: 125440
#include <bits/stdc++.h>
using namespace std;
#define ll  long long
#define mod 1000000007
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define FASTIO ios_base::sync_with_stdio(false);cout.tie(NULL);cout.tie(NULL);
ll max(ll a, ll b) { return (a > b) ? a : b; }
ll min(ll a, ll b) { return (a < b) ? a : b; }
bool cmp(pair<ll,ll> a,pair<ll,ll> b)
{
    if((a.first)==(b.first))
        return a.second>b.second;
    else return a.first<b.first;
}
ll power(ll a,ll b)
{
        ll p=1;
        for(ll i=1;i<=b;i++)
        p*=a;

        return p;
}
ll gcd(ll a, ll b){
    if (a == 0)
        return b;
    return gcd(b % a, a);
 }
 void swap(int *xp, int *yp)
{
    int temp = *xp;
    *xp = *yp;
    *yp = temp;
}
void bfs(map<ll,vector<ll> > &g,ll src,vector<ll> &c)
{
    queue<ll> q;
    map<ll,ll> p;
    q.push(src);
    p[src]=src;
    c[src]=1;
    while(!q.empty())
    {
        ll u=q.front();
        q.pop();
        ll i=1;
        for(auto v:g[u])
        {
            if(c[v]==-1)
            {
                q.push(v);
                p[v]=u;
                if(i==c[u]||i==c[p[u]])
                    i++;
                if(i==c[u]||i==c[p[u]])
                    i++;
                c[v]=i;
                i++;
            }
        }
    }
}
double dp[3000][1500];
double a[3000];
double fun(ll n,ll nh)
{
    if(nh==0) return 1;
    if(n==0)
        return 0;
    if(dp[n][nh] > -0.9) return dp[n][nh];
    dp[n][nh]=(a[n-1]*fun(n-1,nh-1))+((1-a[n-1])*fun(n-1,nh));
    //cout<<"for "<<n<<" coins ans "<<nh<<" number of head is "<<dp[n][nh]<<endl;
    return dp[n][nh];
}
int main()
{
	FASTIO;
	ll n,i;
	cin>>n;
	for(i=0;i<n;i++) cin>>a[i];
	//for(i=0;i<n;i++) cout<<a[i]<<" ";
	//cout<<endl;
	memset(dp,-1.0,sizeof(dp));
	cout<<fixed<<setprecision(10)<<fun(n,(n+1)/2);
	return 0;
}
















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

using namespace std;
const int N = 1e5 + 100;

vector<pair<int, int> > ret;
int num[N], low[N], TIME, nComp, id[N];
vector<int> e[N];
stack<int> st;

void dfs(int u, int p, int bef) {
    // cerr << "DFS " << u << ' ' << p << '\n';
    num[u] = low[u] = ++TIME;
    st.push(u);
    for (int v : e[u]) if (v != p) {
        if (num[v]) {
            if (num[v] > num[u]) continue;
            // cerr << "Reverse " << u << ' ' << v << '\n';
            ret.push_back({u, v});
            low[u] = min(low[u], num[v]);
            continue;
        }
        dfs(v, u, st.top());
        low[u] = min(low[u], low[v]);
    }
    if (low[u] == num[u]) {
        // SCC
        ++nComp;
        while (st.size() && st.top() != bef) {
            int v = st.top(); st.pop(); 
            id[v] = nComp;
        }
    } else {
        if (p != -1) ret.push_back({p, u});
    }
}

map< pair<int, int>, pair<int, int> > mp;
set<int> Set[N];
vector<int> newE[N];
void dfs2(int u, int p) {
    // cerr << "DFS " << u << '\n';
    for (int v : newE[u]) if (v != p) {
        dfs2(v, u);
        if (Set[u].size() < Set[v].size()) swap(Set[u], Set[v]);
        // cerr << "Set " << u << ": "; for (int x : Set[u]) cerr << x << ' '; cerr << endl;
        // cerr << "Set " << v << ": "; for (int x : Set[v]) cerr << x << ' '; cerr << endl;
        for (int x : Set[v]) {
            if (Set[u].count(-x)) {
                Set[u].erase(-x);
            } else Set[u].insert(x);
        }
        Set[v].clear();
    }
    if (Set[u].size() && *Set[u].begin() < 0 && *Set[u].rbegin() > 0) {
        cout << "No\n";
        exit(0);
    }
    if (Set[u].empty() || *Set[u].begin() > 0) {
        if (p != -1) ret.push_back(mp[{u, p}]);
    } else {
        if (p != -1) ret.push_back(mp[{p, u}]);
    }
}

int main() {
    int n, m;
    cin >> n >> m;
    for (int i = 1; i <= m; ++i) {
        int u, v;
        cin >> u >> v;
        e[u].push_back(v);
        e[v].push_back(u);
    }
    dfs(1, -1, -1);
    int q;
    cin >> q;
    for (int i = 1; i <= q; ++i) {
        int u, v;
        cin >> u >> v;
        if (id[u] == id[v]) continue;
        u = id[u], v = id[v];
        Set[u].insert(+i);
        Set[v].insert(-i);
    }
    for (int u = 1; u <= n; ++u) {
        // cerr << id[u] << " \n"[u == n];
        for (int v : e[u]) if (id[u] != id[v]) {
            newE[id[u]].push_back(id[v]);
            mp[{id[u], id[v]}] = {u, v};
        }
    }
    dfs2(1, -1);
    cout << "Yes\n";
    for (auto x : ret) cout << x.first << ' ' << x.second << '\n';
}


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

int main() {
    int n,k,x,y;
    cin >> n >> k >> x >> y;
    ll total = 0;
    if(n > k){
      total = k*x;
      total += (n-k)*y;
    }else{
      total = n*x;
    }
    cout << total;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define ld long double
#define pb emplace_back
#define mp make_pair
#define f(i,a,n) for(int i=a ; i<n ; i++)
#define F first
#define S second
#define vll vector<ll>
#define fast ios:: sync_with_stdio(false),cin.tie(0);
#define COUT cout<<fixed<<setprecision(9)
#define SET set<ll,greater<ll>>gquiz
#define ITERATOR set<ll,greater<ll>> :: iterator itr
#define V vector<ll>vector
#define sz size()
#define A vector<pair<ll,ll>>vect
ll N=100000,M=100000;
#define B vect.push_back(make_pair(N,M));
 
bool sortbysec(const pair<int,int> &a,const pair<int,int> &b) 
{ 
    return (a.second < b.second); 
} 
ll pow1(ll n,ll k,ll mm){
    if(k==0)return 1;
    if(k%2==0)return (pow1((n%mm)*(n%mm),k/2,mm))%mm;
    return ((n%mm)*(pow1((n%mm)*(n%mm),k/2,mm)%mm))%mm;
}
ll pow2(ll n,ll k){ll ans=1;
	while(k>0){
        if(k%2==1)ans=ans*n;n=n*n;k/=2;
    }return ans;
}
ll ncr(ll n,ll r){if(n==1 || r==0)return 1;if(r>n/2)r=n-r;
	ll ans=1;for(ll i=1;i<=r;i++){ans=((ans * n )/i);n--;}return ans;
}
ll ncrsum(ll n,ll r, ll mod){
	if(n==1 || r==0)return 1;
	ll ans=1,sum=1;for(ll i=1;i<=r;i++){ans=(((ans * n )/i)%mod);n--;sum+=ans;sum%=mod;}return sum;
}
bool isprime(ll n){if(n==1 || (n!=2 && n%2==0))return false; if(n==2)return true; 
		for(ll i=3;i<=sqrt(n);i+=2)if(n%i==0)return false; return true; }
		
vll factor(ll n){
	vll ans;
	if(n>0)ans.pb(1);if(n==2)ans.pb(2);
	for(ll i=2;i*i<=n;i++){if(n%i==0){ans.pb(i);if(n/i!=i)ans.pb(n/i);}}if(n>2)ans.pb(n);
	return ans;
}
ll numoffactor(ll n){ return factor(n).sz;}
ll gcd(ll a,ll b) 
{ 
	if (a == 0) 
		return b; 
	return gcd(b%a, a); 
} 
 
int main()
{
	ll n;
	cin>>n;
	ll a[n+1],b[n+1];
	for(ll i=0;i<n;i++)
	cin>>a[i]>>b[i];
	
	vector<pair<ll,ll>>v;
	for(ll i=0;i<n;i++)
	{
		ll j=a[i]-b[i];
		ll k=a[i]+b[i];
		v.push_back(make_pair(k,j));
	}
	sort(v.begin(),v.end());
	
	ll ans=-1e9;
	ll x=0;
	for(ll i=0;i<n;i++)
	{
		if(v[i].second>=ans)
		{
		  ans=v[i].first;
		  x++;
		}
	}
	cout<<x;
}

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

using ll = long long int;
using P = std::pair<int, int>;

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

int d[(int)1e6 + 10][2];

int main()
{
    std::string s;

    std::cin >> s;

    std::vector<int> vec;

    for (char ch : s)
        vec.emplace_back(atoi(&ch));

    std::reverse(std::begin(vec), std::end(vec));

    vec.push_back(0);

    int n = vec.size();

    d[0][0] = vec[0];
    d[0][1] = 10 - vec[0];

    for (int i = 1; i < n; ++i)
    {
        d[i][0] = std::min(d[i - 1][0] + vec[i], d[i - 1][1] + vec[i] + 1);
        d[i][1] = std::min(d[i - 1][0] + 10 - vec[i], d[i - 1][1] + 9 - vec[i]);
    }

    std::cout << d[n - 1][0] << std::endl;

    return 0;
}

Measured memory_bytes: 16972
#include <vector>
#include <iostream>
#include <algorithm>


using namespace std;
using ll = long long int;

int main() {
  ll N, M;
  cin >> N >> M;
  vector<ll> s(N + 1);

  s[0] = 0;
  ll a = 0;
  for (ll i = 0; i < N; i++) {
    ll tmp; cin >> tmp;
    s[i + 1] = a = (a + tmp) % M;
  }

  sort(s.begin(), s.end());

  ll sum = 0;
  ll streak = 0;
  ll current = -1;

  for (ll si : s) {
    if (si == current) {
      streak++;
    } else {
      streak = 0;
      current = si;
    }
    sum += streak;
  }

  cout << sum << endl;
  return 0;
}


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

int main() {
    int a;
    string s;
    cin >> a >> s;
    if(a >= 3200) cout << s << endl;
    else cout << "red" << endl;
}

Measured memory_bytes: 256
import java.util.*;
import java.io.*;
public class Main
{
	
	
	/************************ SOLUTION STARTS HERE ***********************/
	
	
	
	private static void solve(FastScanner s1, PrintWriter out){
		
		out.println("A" + s1.nextLine().split(" ")[1].charAt(0) + "C");
		
	}
	
	
	
	/************************ SOLUTION ENDS HERE ************************/
	
	
	
	
	
	/************************ TEMPLATE STARTS HERE *********************/
	
	public static void main(String []args) throws IOException {
		FastScanner in  = new FastScanner(System.in);
		PrintWriter out = 
				new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)), false); 
		solve(in, out);
		in.close();
		out.close();
	}    
	
	static class FastScanner{
		BufferedReader reader;
		StringTokenizer st;
		FastScanner(InputStream stream){reader=new BufferedReader(new InputStreamReader(stream));st=null;}	
		String next()
		{while(st == null || !st.hasMoreTokens()){try{String line = reader.readLine();if(line == null){return null;}		    
		st = new StringTokenizer(line);}catch (Exception e){throw new RuntimeException();}}return st.nextToken();}
		String nextLine()  {String s=null;try{s=reader.readLine();}catch(IOException e){e.printStackTrace();}return s;}	    	  	
		int    nextInt()   {return Integer.parseInt(next());}
		long   nextLong()  {return Long.parseLong(next());}		
		double nextDouble(){return Double.parseDouble(next());}
		char   nextChar()  {return next().charAt(0);}
		int[]  nextIntArray(int n)         {int[] arr= new int[n];   int i=0;while(i<n){arr[i++]=nextInt();}  return arr;}
		long[] nextLongArray(int n)        {long[]arr= new long[n];  int i=0;while(i<n){arr[i++]=nextLong();} return arr;}	
		int[]  nextIntArrayOneBased(int n) {int[] arr= new int[n+1]; int i=1;while(i<=n){arr[i++]=nextInt();} return arr;}	    	
		long[] nextLongArrayOneBased(int n){long[]arr= new long[n+1];int i=1;while(i<=n){arr[i++]=nextLong();}return arr;}	    	
		void   close(){try{reader.close();}catch(IOException e){e.printStackTrace();}}				
	}
	
	/************************ TEMPLATE ENDS HERE ************************/
}

Measured memory_bytes: 8276
#include <bits/stdc++.h>
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (ll i = (ll)(a); i < (ll)(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define ll long long
#define lld long double
#define ALL(x) x.begin(), x.end()
#ifdef DEBUG
#define line() cerr << "[" << __LINE__ << "] ";
#define dump(i) cerr << #i ": " << i << " ";
#define dumpl(i) cerr << #i ": " << i << endl;
#else
#define line(i)
#define dump(i)
#define dumpl(i)
#endif
using namespace std;

ll divnum(ll a, ll b, ll n)
{
    return (b / n - (a - 1) / n);
}

ll gcd(ll a, ll b)
{
    if (b > a)
    {
        ll tmp = a;
        a = b;
        b = tmp;
    }

    if (b == 0)
    {
        return a;
    }
    return gcd(b, a % b);
}

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

int main(int argc, char const *argv[])
{
    ll a, b, c, d;
    cin >> a >> b >> c >> d;
    cerr << divnum(a, b, c) << endl;
    cerr << divnum(a, b, d) << endl;
    cerr << divnum(a, b, c * d) << endl;
    ll ans = (b - a + 1) - (divnum(a, b, c) + divnum(a, b, d) - divnum(a, b, lcm(c, d)));
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cassert>
#include <climits>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <fstream>

using namespace std;
#define TOSTRING(x) #x
#define SZ(x) (int)(x).size()
#define REP(i, n) for (int i = 0; i < (n); i++)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REPR(i, n) for (int i = (n)-1; i >= 0; i--)
#define ALL(s) (s).begin(), (s).end()
#define so(V) sort(ALL(V))
#define rev(V) reverse(ALL(V))
#define uni(v) v.erase(unique(ALL(v)), v.end());

typedef long long unsigned int llu;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef vector<vb> vvb;
const double EPS = 1e-9;
const int MOD = 1e9 + 7;
const int INF = (1 << 28);
const ll LINF = 2e18;
const double PI = acos(-1);

int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	int H, W, h, w;
	cin >> H >> W >> h >> w;
	cout << (H - h) * (W - w) << endl;
	return 0;
}


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

#define REP(i,num) for(ll i=0;i<(num);++i)
#define LOOP(i) while(i--)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto pitr=c.begin();pitr!=c.end();++pitr){cout<<*pitr;if(next(pitr,1)!=c.end())cout<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=ll>
T in(){T x; cin >> x; return (x);}
template<typename T=ll,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);

	int N=in();
	vector<pair<int,pair<double,double>>> P(N);
	REP(i,N){
		P[i].first=i;
		P[i].second.first=in(),P[i].second.second=in();
	}
	
	double S=0;
	int K=0;
	do{
		double D=0;
		REP(i,N-1){
			D += hypot(P[i+1].second.first-P[i].second.first,P[i+1].second.second-P[i].second.second);
		}
		S += D;
		K++;
	}while(next_permutation(ALL(P)));

	out(S/K);
	return 0;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES // for C++  
#include "bits/stdc++.h"
#define LL long long
#define NUM 1000000007

using namespace std;

int main()
{
    int x, a, b;
    cin >> x >> a >> b;
    if (abs(x-a) >= abs(x-b))
    {
        cout << 'B' << endl;
    }
    else
    {
        cout << 'A' << endl;;
    }
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
"""
Created on Tue May 12 12:45:03 2020

@author: shinba
"""
import sys

S = list(input())

if S.count("K") != 1 or S.count("I") != 1 or S.count("H") != 1 or S.count("B") != 1 or S.count("R") != 1:
    print("NO")
    sys.exit()    

l = len(S)

k = S.index("K")
i = S.index("I")
h = S.index("H")
b = S.index("B")
r = S.index("R")

while "A" in S:
    S.remove("A")
    
if len(S) != 5:
    print("NO")
    sys.exit()
    

if (0 <= k <= 1) and (h - k == 2) and (1 <= b - h <= 2) and (1 <= r - b <= 2) and (l-2 <= r <= l-1):
    if k < i < h < b < r:
        print("YES")
    else:
        print("NO")
else:
    print("NO")


    
    

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

int main(){
  ll n;
  cin >> n;
  ll ans = 0;
  for(ll i=1;i<=n;i++){
    if( i%3 != 0 && i%5 != 0 ){
      ans += i;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3640
ord_a = ord('a')

A = input()

L = 26
counter = [0]*L
for c in A:
  counter[ord(c)-ord_a] += 1

n = len(A)
res = n*(n-1) - sum(x*(x-1) for x in counter)
res = res//2 + 1
print(res)

Measured memory_bytes: 3500
// AOJ 3117 K Average Ranges
// 2020.1.15 bal4u

#include <stdio.h>

typedef long long ll;

#define gc() getchar_unlocked()
//#define gc() getchar()

int in() {   // 非負整数の入力
	int n = 0, c = gc();
	do n = 10 * n + (c & 0xf); while ((c = gc()) >= '0');
	return n;
}

#define MAX 100005

// bit木 1-indexedに注意
int bit[MAX], bitn;
void add(int i) { while (i <= bitn) bit[i]++, i += i & -i; }
int sum(int i) { int s = 0; while (i > 0) s += bit[i], i -= i & -i; return s; }

#define MAX 100005
typedef struct { ll a; int id; } T;
T a[MAX]; int id[MAX]; int N;

void Qsort(T *a, int l, int r) {
	int i, j; T t;
	ll m;
	
	i = l, j = r, m = a[(l+r) >> 1].a;
	while (1) {
		while (a[i].a < m) i++;
		while (m < a[j].a) j--;
		if (i >= j)	break;
		t = a[i], a[i] = a[j], a[j] = t;
		i++, j--;
	}
	if (l+1 < i) Qsort(a, l, i-1);
	if (j+1 < r) Qsort(a, j+1, r);
}

int main()
{
	int i;

	N = in();
	int K = in();
	ll s = 0;
	a[0].a = 0;
	for (i = 1; i <= N; ++i) {
		s += in() - K;
		a[i].a = s, a[i].id = i;
	}
	Qsort(a, 0, N);
	for (i = 0; i <= N; ++i) id[a[i].id] = i+1;
//	for (i = 0; i <= N; ++i) printf("[%d] %d\n", i, id[i]);
	
	ll ans = 0;
	bitn = N+1;
	add(id[0]);
	for (i = 1; i <= N; ++i) {
		ans += sum(id[i]);
		add(id[i]);
	}
	printf("%lld\n", ans);
	return 0;
}



Measured memory_bytes: 4200
#include <bits/stdc++.h>
using namespace std;
 
int main(){
    int a,b;
    cin >> a >> b;
    int resd = a / b;
    int resr = a % b;
    double resf = (double) a / (double) b;
    printf("%d %d %.5f",resd,resr,resf);
    return 0;
}


Measured memory_bytes: 3220
#include <bits/stdc++.h>
using namespace std;
 
#define forn(i,n) for(int i=0;i<(int)(n);i++)
#define si(c) ((int)(c).size())
#define forsn(i,s,n) for(int i = (int)(s); i<((int)n); i++)
#define dforsn(i,s,n) for(int i = (int)(n)-1; i>=((int)s); i--)
#define all(c) (c).begin(), (c).end()
#define D(a) cerr << #a << "=" << a << endl;
#define pb push_back
#define eb emplace_back
#define mp make_pair
 
typedef long long int ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

const int N = 55;
const int L = 18;

int n,k,s,t;
ll a[N], comb[N][N], cnt[1<<L];

ll solve() {
    cin >> n >> k >> s >> t;
    if ((s & t) != s) return 0;
    {
        int sz = 0;
        forn(_,n) {
            ll x; cin >> x;
            if ((s & x) != s) continue;
            if ((x | t) != t) continue;
            a[sz++] = x-s;
        }
        n = sz;
    }
    ll ans = 0;
    forn(i,n) {
        memset(cnt, 0, sizeof cnt);
        forsn(j,i+1,n) cnt[a[j]^a[i]]++;
        forn(bit,L) forn(mask,1<<L) if ((mask>>bit)&1)
            cnt[mask] += cnt[mask - (1<<bit)];
        forn(mask,1<<L) cnt[mask] = comb[cnt[mask]][k-1];
        forn(bit,L) forn(mask,1<<L) if ((mask>>bit)&1)
            cnt[mask] -= cnt[mask - (1<<bit)];
        ans += cnt[t-s];
    }
    return ans;
}

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

    forn(n,N) {
        comb[n][0] = 1;
        forsn(r,1,n+1) comb[n][r] = comb[n-1][r-1] + comb[n-1][r];
    }
    forn(n,N) {
        forsn(r,1,N) comb[n][r] += comb[n][r-1];
    }

    cout << solve() << endl;

    return 0;
}


Measured memory_bytes: 5680
using System;
using System.Collections.Generic;
namespace ITP1_3_D
{
    class Problem
    {

        public static List<string[]> getinputdata (){

            List<string[]> list_temp = new List<string[]>();
            string strdata = Console.ReadLine ();

            while (strdata!=null) {

                string[] s_temp = strdata.Split (' ');

                list_temp.Add (s_temp);

                strdata = Console.ReadLine ();

            }

            return list_temp;
        }



        public static void Main (string[] args)
        {
            List<string[]> list_result = new List<string[]>();
            list_result = getinputdata ();

            int a = int.Parse(list_result[0][0]);
            int b = int.Parse(list_result[0][1]);
            int c = int.Parse(list_result[0][2]);

            int cnt = 0;

            for (int i = a; i <= b; i++)
            {
                if (c % i == 0)
                {

                    cnt++;

                }
            }

                Console.WriteLine("{0}",cnt);




        }
    }
}

Measured memory_bytes: 9400