akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
// #include <atcoder/all>
#define ll long long int
#define ld long double
#define yorn(f) cout<<((f)?"Yes":"No")<<endl;
#define YORN(f) cout<<((f)?"YES":"NO")<<endl;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define repi(i, n) for (ll i = 1; i < (ll)(n); i++)
#define all(x) (x).begin(), (x).end()
#define put(x) cout << x << endl;
#define println(x) cout << x << endl;
using namespace std;
// using namespace atcoder;

ll mod = 7LL + 1e9;
ll n;
vector<unordered_map<string, ll>> memo;
ll dfs(int depth, string c4) {
    if (memo[depth].find(c4) != memo[depth].end()) {
        return memo[depth][c4];
    }

    ll cnt = 0;
    if ( // AGC, ACG, GAC, A?GC, AG?Cがだめ
        c4.substr(0, 3) == "AGC" || c4.substr(1) == "AGC" ||
        c4.substr(0, 3) == "ACG" || c4.substr(1) == "ACG" ||
        c4.substr(0, 3) == "GAC" || c4.substr(1) == "GAC" ||
        (c4[0] == 'A' && c4.substr(2) == "GC") || 
        (c4[3] == 'C' && c4.substr(0, 2) == "AG")) {
        cnt = 0;
    }
    else if (depth == n) {
        cnt = 1;
    }
    else {
        for (char v: { 'A', 'T', 'C', 'G' }) {
            cnt += dfs(depth + 1, c4.substr(1) + v);
            cnt %= mod;
        }
    }

    memo[depth][c4] = cnt;
    return cnt;
}

void Main()
{
    cin >> n;
    memo.assign(n+1, unordered_map<string, ll>());
    ll ret = dfs(0, "XXXX");
    put(ret);
}
signed main(){ Main();return 0;}

Measured memory_bytes: 5436
// includes {{{
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<tuple>
#include<cmath>
#include<random>
#include<cassert>
#include<bitset>
#include<cstdlib>
// #include<deque>
// #include<multiset>
// #include<cstring>
// #include<bits/stdc++.h>
// }}}
using namespace std;
using ll = long long;

int c[312345];

int main() {
  std::ios::sync_with_stdio(false), std::cin.tie(0);
  int n, q;
  cin >> n >> q;
  set<int> s;
  for(int i = 0; i < n; i++) cin >> c[i], s.insert(c[i]);
  for(int i = 0; i < q; i++) {
    int x;
    cin >> x;
    int ans = 0;
    for(int j = x; j <= (300000 + x - 1) / x * x; j += x) {
      auto ite = s.lower_bound(j);
      if(ite != s.begin()) {
        ans = max(ans, (*prev(ite)) % x);
      }
    }
    cout << ans << "\n";
  }

  return 0;
}



Measured memory_bytes: 18372
N = int(input())
data = list(map(int,input().split()))
box = [0]*8
num = 0
for i in range(len(data)):
        x = int(data[i] / 400)
        if x < 8:
            box[x] += 1
        else:
            num += 1
answer = len(box)   - box.count(0)
if answer == 0:
    print(1,num)
else:
    print(answer,(answer+num))



Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
int main(){
  ll n;
  cin >> n;
  vector<string> s(n);
  vector<ll> p(5);
  rep(i,n){
    cin >> s.at(i);
    if(s.at(i).at(0)=='M'){
      p.at(0)++;
    }
    if(s.at(i).at(0)=='A'){
      p.at(1)++;
    }
    if(s.at(i).at(0)=='R'){
      p.at(2)++;
    }
    if(s.at(i).at(0)=='C'){
      p.at(3)++;
    }
    if(s.at(i).at(0)=='H'){
      p.at(4)++;
    }
  }
  ll ans=0;
  ll i,j,k;
  for(i=0;i<3;i++){
    for(j=i+1;j<4;j++){
      for(k=j+1;k<5;k++){
        ans+=p.at(i)*p.at(j)*p.at(k);
      }
    }
  }
  cout << ans;
}

Measured memory_bytes: 6384
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,m;
    cin >> n >> m;
    int l[60] = {0};
    int tmp;
    for(int i = 0;i < m;++i)
    {
        cin >> tmp;
        l[tmp]++;
        cin >> tmp;
        l[tmp]++;
    }
    for(int i = 1;i <= n; i++)
    {
        cout << l[i] << '\n';
    }
}

Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
count = 0
for i in b:
    count += i
for i in range(n-1):
    if a[i]+1 == a[i+1]:
        count += c[a[i]-1]
print(count)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0; i<(n); i++)
#define repi(i,a,b) for (int i=a;i<(b);i++)
using namespace std;
typedef long long ll;
int main(){
  int n,k;
  cin >> n >> k;
  if(n%k==0){
    cout << 0 << endl;
  }else{
    cout << 1 << endl;
  }
  return 0;
}
    

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    string S, T;
    cin >> S >> T;
   long long  int ans = T.size();
    for (int start = 0; start <= S.size() - T.size(); start++)
    {
        long long int diff = 0;
        for (int i = 0; i < T.size(); i++)
        {
            if (T[i] != S[start + i]) {
                diff++;
            }
        }
        ans = min(ans,diff);
    }
 
    cout << ans << endl;
}


Measured memory_bytes: 3620
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
using ll = long long;
using p = pair<int,int>;
int main(int argc, const char * argv[]) {



    cin.tie(0);
    ios::sync_with_stdio(false);

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

    return 0;
}


Measured memory_bytes: 3640
#include <iostream>
#include <cstdio>
#include <string>
#include <sstream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <queue>
using namespace std;

int main() {
    int N;
    string S;
    cin >> N >> S;
    
    int E_sum=0;
    for (int i=0; i<N; i++) {
        if (S[i]=='E') {
            E_sum++;
        }
    }
    
    int ans=N, E_num=0, W_num=0;
    for (int i=0; i<N; i++) {
        if (S[i]=='E') {
            E_num++;
        }
        
        if (ans>W_num+(E_sum-E_num)) {
            ans=W_num+(E_sum-E_num);
        }
        
        if (S[i]=='W') {
            W_num++;
        }
    }
    
    cout << ans << endl;
}


Measured memory_bytes: 900
n=int(input())
p=list(map(int,input().split()))
res=0
for i in range(1,n-1):
  a = p[i-1:i+2]
  if a[0]==max(a) and a[2]==min(a):
    res+=1
  if a[0]==min(a) and a[2]==max(a):
    res+=1
print(res)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
typedef long long ll;
typedef pair<int, int> pii;
const ll INF = 1e9+100;
const ll MOD = 1e9+7;
const bool debug = 0;
//-----------------------------------------------//

int main() {
	int N;
	int a[100];
	cin >> N;
	REP(i, N) scanf("%d", a + i);
	sort(a, a + N, greater<int>());
	
	int alice = 0, bob = 0;
	REP(i, N) (i&1 ? bob : alice) += a[i];
	cout << alice - bob << endl;
	
	return 0;
}


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

using namespace std;

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

typedef long long i64;
typedef pair<i64, i64> pii;

constexpr int INF = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;

signed main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  i64 r;
  cin >> r;
  cout << 3 * r * r << "\n";
  return 0;
}

Measured memory_bytes: 256
import copy
N,K=map(int,input().split())
A=list(map(int,input().split()))
tentou1=0
tentou2=0
l2=copy.deepcopy(A)
l2.extend(A)
p=10**9+7
#print(l2,A)
for i in range(N):
    for j in range(i+1,N):
        #print(i,j)
        if A[i]>A[j]:
            tentou1=tentou1+1
for i in range(2*N):
    for j in range(i+1,2*N):
        if l2[i]>l2[j]:
            tentou2=tentou2+1
#print(tentou1,tentou2)
n=(tentou2-tentou1)-tentou1
#for i in range(10):
#    print((i*(3*tentou1-tentou2)+n*(i*(i+1))//2)%p)

print((K*(3*tentou1-tentou2)+n*(K*(K+1))//2)%p)


Measured memory_bytes: 43228
class BinaryIndexedTree:
    def __init__(self, size=10**7):
        self.size = size
        self.data = [0]*(size+1)

    def add(self, index, x):
        while index <= self.size:
            self.data[index] += x
            index += index & -index

    def prefix_sum(self, index):
        res = 0
        while index >= 1:
            res += self.data[index]
            index -= index & -index
        return res
    
    def interval_sum(self, left, right):
        return self.prefix_sum(right) - self.prefix_sum(left-1)

    def __getitem__(self, index):
        return self.sum(index) - self.sum(index-1)

    # def __setitem__(self, index, x):
    #     before = self.__getitem__(index)
    #     self.add(index, -before)
    #     self.add(index, x)

def main():
    from sys import stdin
    input = lambda: stdin.readline()
    LMIIS = lambda: list(map(int,input().split()))


    N,Q = LMIIS()
    # 1-indexedにするためリストの先頭に0を追加
    C = [0] + LMIIS()
    queries = []

    # 順番と一緒にクエリを保存
    for i in range(Q):
        l,r = map(int,input().split())
        queries.append((i,l,r))
    
    # rについてクエリをソート
    queries.sort(key=lambda x: x[2])

    # 玉の種類 -> 良い玉の場所
    good_ball_places = [0] * (N+1)

    # 場所 -> 良い玉が存在するなら1,しないなら0
    good_ball_exists = BinaryIndexedTree()

    #　玉の更新済み範囲
    k = 0
    # クエリの回答
    out = [0] * Q
    for order,l,r in queries:
        for i in range(k+1,r+1):
            # 位置iの玉の色
            color = C[i]
            # 色colorの良い玉の前の位置
            before = good_ball_places[color]
            # 色colorが既出なら、前の位置での存在を消去
            if 0 < before:
                good_ball_exists.add(before,-1)
            # 色colorの良い玉の位置はi
            good_ball_places[color] = i
            # 位置iに良い玉が存在
            good_ball_exists.add(i,1)
        # 良い玉を更新した範囲
        k = r
        # [l,r]に存在する良い玉の数の合計
        out[order] = good_ball_exists.interval_sum(l,r)
    print('\n'.join(map(str,out)))


        








    
main()

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

using namespace std;

typedef long long          ll;
typedef unsigned long long ull;
typedef vector<int>	       vi;
typedef vector<bool>       vb;
typedef map<int, int>      mii;
typedef pair<int, int>     ii;

#define INF                0x3f3f3f3f
#define INFLL              0x3f3f3f3f3f3f3f3f
#define each(x, s)         for(auto& x : s)
#define loop(x)	           for(int i = 0;i < x;i++)
#define vloop(v, x)        for(int v = 0;v < x;v++)
#define avg(l, r)          l + (r - l) / 2
#define iter(a)            a.begin(), a.end()
#define riter(a)           a.rbegin(), a.rend()
#define endl               "\n"

const ll mod = 1000000007;

int main() {
	ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

	int x;
	cin >> x;
	cout << (x >= 30 ? "Yes" : "No") << endl;
	return 0;
}



Measured memory_bytes: 3612
#include<iostream>
#include<algorithm>
#include<stdio.h>
#include<string.h>
using namespace std;
int main(){
	int c=0;
	int i;
	for( i=0;i<3;i++){
	char a;
	cin>>a;
	if(a=='o')c++;
	}
	cout<<700+c*100<<endl;
}


Measured memory_bytes: 256
import itertools

N,M,Q=map(int,input().split())
a=[]
b=[]
c=[]
d=[]
for i in range(Q):
  a1,b1,c1,d1=map(int,input().split())
  a.append(a1)
  b.append(b1)
  c.append(c1)
  d.append(d1)

point=0
x=list(itertools.combinations_with_replacement(range(M), N))
for y in x:
  temppoint=0
  for i in range(Q):
    if(y[b[i]-1]-y[a[i]-1]==c[i]):
      temppoint+=d[i]
  point=max(point,temppoint)
print(point)

Measured memory_bytes: 21608
/**
*    author:  Dooloper
*    created: 06.06.2020 00:59:13
**/

#include <iostream>
#include <vector>
#include <map>
#include <string>
#include <utility>
#include <algorithm>
#include <queue>
#include <deque>
#include <stack>
#include <cmath>
#include <functional>
#include <cassert>


using namespace std;
typedef unsigned long long ull;
typedef long long ll;

int main() {
    cin.tie(0);
    ll N;
    cin >> N;
    vector<int> Eratosthenes((int)sqrt(N)+10,0);
    vector<int> factor;
    vector<ll> prime;

    /*エラトステネス*/
    for (ll i = 2; i * i < N; i++)
    {
        if(!Eratosthenes[i]){
            for (ll j = 2; i*i * j*j <= N;j++)
                Eratosthenes[i * j] = 1;
        }
    }

    for (ll i = 2; i < Eratosthenes.size(); i++)
    {
        if(!Eratosthenes[i]){
            int keep = 0;
            while (N % i == 0)
            {
                keep++;
                N /= i;
            }
            factor.emplace_back(keep);
        }
    }
    if(N > 1)
        factor.emplace_back(1);

    int ans = 0;
    for (int i : factor)
    {
        for (int j = 1; j <= i; j++){
            ans++;
            i -= j;
        }
    }

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

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

public class Main {

	final static long MOD = 1000000007;
	public static String[] Ws = null;
	public static int wsIndx = 0;
	public static BufferedReader in = null;
	public static void main(String[] args) throws Exception {
		solution(args);
		if(in!=null){
			in.close();
		}
	}

	public static void solution(String[] args) throws Exception{

		int a=nextInt();
		int b=nextInt();
		int c=nextInt();
		
		String ans ="NO";
		if(b-a==c-b)
			ans="YES";
		System.out.println(ans);

	}

	public static boolean isPalindromicStr(String s) {
		int h = 0;
		int t = s.length() - 1;
		while (h <= t) {
			if (s.charAt(h) != s.charAt(t)) {
				break;
			}
			h++;
			t--;
		}
		if (h > t) {
			return true;
		}
		return false;
	}
	public static String[] toStringArray(String s) {
		String[] tmp = new String[s.length()];
		char[] c = s.toCharArray();
		for (int i = 0; i < tmp.length; i++) {
			tmp[i] = String.valueOf(c[i]);
		}
		return tmp;
	}

	public static void check() throws Exception{
		if(in == null){
			in = new BufferedReader(new InputStreamReader(System.in));
		}
		if(Ws==null || Ws.length<=wsIndx){
			Ws = in.readLine().split(" ");
			wsIndx=0;
		}
	}
	public static int nextInt()throws Exception{
		check();
		return Integer.parseInt(Ws[wsIndx++]);
	}

	public static long nextLong()throws Exception{
		check();
		return Long.parseLong(Ws[wsIndx++]);
	}

	public static String nextString()throws Exception{
		check();
		return Ws[wsIndx++];
	}

	public static int[] nextInts()throws Exception{
		check();
		int[] tmp = new int[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Integer.parseInt(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static long[] nextLongs()throws Exception{
		check();
		long[] tmp = new long[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Long.parseLong(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static String[] nextStrings()throws Exception{
		check();
		wsIndx=Ws.length;
		return Ws;
	}


}


Measured memory_bytes: 21076
A = [0,0,0,0,0,0,0,0,0]
A[0], A[1], A[2] = gets.split(" ").map(&:to_i)
A[3], A[4], A[5] = gets.split(" ").map(&:to_i)
A[6], A[7], A[8] = gets.split(" ").map(&:to_i)
N = gets.to_i
R = [false, false, false, false, false, false, false, false, false]
N.times{
  k = gets.to_i
  (0...9).each{|i|
    if A[i] == k
      R[i] = true
    end
  }
}
if R[0] && R[1] && R[2]
  puts "Yes"
  exit
end
if R[0] && R[3] && R[6]
  puts "Yes"
  exit
end
if R[0] && R[4] && R[8]
  puts "Yes"
  exit
end
if R[1] && R[4] && R[7]
  puts "Yes"
  exit
end
if R[2] && R[5] && R[8]
  puts "Yes"
  exit
end
if R[2] && R[4] && R[6]
  puts "Yes"
  exit
end
if R[3] && R[4] && R[5]
  puts "Yes"
  exit
end
if R[6] && R[7] && R[8]
  puts "Yes"
  exit
end
puts "No"

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

// --- DEBUG begin --- cut here ---
template <class... Args>
string dbgFormat(const char* fmt, Args... args) {
  size_t len = snprintf(nullptr, 0, fmt, args...);
  char buf[len + 1];
  snprintf(buf, len + 1, fmt, args...);
  return string(buf);
}

template <class Head>
void dbgLog(Head&& head) {
  cerr << head << endl;
}

template <class Head, class... Tail>
void dbgLog(Head&& head, Tail&&... tail)
{
  cerr << head << " ";
  dbgLog(forward<Tail>(tail)...);
}

#if DEBUG
  #define DLOG(...)        dbgLog(__VA_ARGS__)
  #define DFMT(...)        cerr << dbgFormat(__VA_ARGS__) << endl
  #define DCALL(func, ...) func(__VA_ARGS__)
#else
  #define DLOG(...)
  #define DFMT(...)
  #define DCALL(func, ...)
#endif

// operator<< definitions for some classes

template <typename T1, typename T2>
ostream& operator<< (ostream& os, const pair<T1,T2>& p) {
  os << "(" << p.first << ", " << p.second << ")";
  return os;
}

template <typename T>
ostream& operator<< (ostream& os, const vector<T>& v) {
  os << '[';
  for (auto it = v.begin(); it != v.end(); it++) {
    if (it != v.begin()) os << ", ";
    os << *it;
  }
  os << ']';

  return os;
}

template <typename T, typename T2, typename T3>
ostream& operator<< (ostream& os, const priority_queue<T, T2, T3>& orig) {
  priority_queue<T, T2, T3> pq(orig);
  bool first = true;
  os << '[';
  while (!pq.empty()) {
    T x = pq.top(); pq.pop();
    if (!first) os << ", ";
    os << x;
    first = false;
  }
  return os << ']';
}
// --- DEBUG end --- cut here ---

ll INF = (ll)(1e15);

int main(int argc, char *argv[]) {
  // C-style stdio functions should not be used.
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout << setprecision(20);

  int N, M; cin >> N >> M;
  vector<vector<pair<int, int>>> fwd(N), bwd(N);
  for (ll i = 0; i < M; i++) {
    int a, b, c;
    cin >> a >> b >> c; a--; b--;
    fwd.at(a).emplace_back(b, c);
    bwd.at(b).emplace_back(a, c);
  }
  vector<bool> rcbl(N);
  stack<int> st;
  st.push(N-1);
  while (!st.empty()) {
    int x = st.top(); st.pop();
    if (rcbl.at(x)) continue;
    rcbl.at(x) = true;
    for (auto t : bwd.at(x)) {
      int y = t.first;
      if (rcbl.at(y)) continue;
      st.push(y);
    }
  }
  int nRcbl = 0;
  for (int i = 0; i < N; i++) if (rcbl.at(i)) nRcbl++;
  vector<ll> score(N, -INF);
  score.at(0) = 0;
  int n = 0;
  for ( ; n < nRcbl; n++) {
    int chgd = 0;
    for (int i = 0; i < N; i++) {
      if (!rcbl.at(i)) continue;
      if (score.at(i) == -INF) continue;
      DLOG("i", i);
      DLOG("fwd(i)", fwd.at(i));
      for (auto p : fwd.at(i)) {
	DLOG("p", p);
	int dest = p.first;
	int rew = p.second;
	if (!rcbl.at(dest)) continue;
	if (score.at(i) + rew > score.at(dest)) {
	  chgd = 1;
	  score.at(dest) = score.at(i) + rew;
	}
      }
    }
    DLOG("n = ", n);
    DLOG(score);
    if (chgd == 0) {
      cout << score.at(N-1) << endl;
      return 0;
    }
  }
  cout << "inf" << endl;
  return 0;
}



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

int main(){
  int n,m;
  int t[101] = {};

  scanf("%d", &n);

  for(int i  = 0; i < n; i++){
    scanf("%d", &t[i]);
  }

  scanf("%d", &m);

  for(int i  = 0; i < m; i++){
    int p, x;
    int sum = 0;
    int temp[101] = {};
    scanf("%d%d", &p, &x);

    p--;
    for(int i= 0; i < n; i++) temp[i] = t[i];
    
    temp[p] = x;

    for(int j = 0; j < n; j++){
      sum += temp[j];
    }

    printf("%d\n", sum);
  }

  return 0;
}


Measured memory_bytes: 128
#define _CRT_SECURE_NO_WARNINGS

#include<iostream>
#include<string>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<map>
#include<tuple>
#include<algorithm>
#include<numeric>
#include<math.h>

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

using namespace std;

using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;

const int mod = 1e9 + 7;
const long double pi = 3.141592653589793238462643383279502884197;
const long double eps = 1e-7;

int main() {
	int X;
	cin >> X;
	
	int max_num = 0;
	if (X == 1) {
		max_num = 1;
	}
	else {
		for (int b = 2; b <= (int)floor(sqrt(X)); ++b) {
			int p = 2;
			while (1) {
				int num = pow(b, p);
				if (num > X) break;
				max_num = max(max_num, num);
				p++;
			}
		}
	}
	cout << max_num;
	system("pause");
	return 0;
}

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

using namespace std;

int main(){
	int n, k, g, mx;
	scanf("%d%d",&n,&k);
	for(int i = 1; i <= n; ++i){
		int x;
		scanf("%d",&x);
		g = __gcd(g, x);
		mx = max(mx, x);
	}
	if (k <= mx && k % g == 0) printf("POSSIBLE");
	else printf("IMPOSSIBLE");
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		if(n==m){
			System.out.println("Yes");
		}else{
			System.out.println("No");
		}
	}
}

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

using ll = long long;

const int mod = 1e9 + 7;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int N;
    cin >> N;
    string S, T;
    cin >> S >> T;
    for (int i = 0; i < N; i++) {
        cout << S[i] << T[i];
    }
    cout << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <math.h>
using namespace std;

typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<long long> vll;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<vector<bool>> vvb;
typedef vector<vector<int>> vvi;

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

int main() {
	string s;
	cin >> s;
	bool found = false;
	for (char i = 'a'; i <= 'z'; i++) {
		found = false;
		for (int j = 0; j < s.size(); j++) {
			if (i == s.at(j)) {
				found = true;
				break;
			}
		}
		if (!found) {
			cout << i << endl;
			return 0;
		}
	}
	cout << "None" << endl;
	return 0;
}

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

int main() {
	string s;
	cin >> s;
	int i = 0;
	if (s[0] == '1') i++;
	if (s[1] == '1') i++;
	if (s[2] == '1') i++;
	cout << i << endl;
}

Measured memory_bytes: 3624
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.List;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		Long[] a = new Long[n];
		for(int i = 0 ; i < n ; i++) a[i] = sc.nextLong();
		Arrays.sort(a, new Comparator<Long>() {
			public int compare(Long x, Long y) {
				return (int)(y - x);
			}
		});
		List<Long> list = new ArrayList<>();
		for(int i = 0 ; i < n - 1 ; i++) {
			if(a[i].longValue() == a[i + 1].longValue()) {
				list.add(a[i]);
				i++;
			}
			if(list.size() == 2) {
				System.out.println(list.get(0) * list.get(1));
				return;
			}
		}
		System.out.println(0);
	}
}

Measured memory_bytes: 62764
#include <bits/stdc++.h>
using namespace std;
using int64 = long long;
#define int int64
#define rep(i, n) for(int i=0; i<n; i++)
#define FOR(i, a, b) for(int i=a; i<b; i++)
#define SORT(x) sort(x.begin(), x.end())
#define GSORT(x) sort(x.begin(), x.end(), greater<int>())
#define mk make_pair
#define fi first
#define se second
#define pb push_back
#define ALL(x) x.begin(), x.end()
#define V(T) vector<T>
typedef pair<int, int> P;
typedef pair<P, P> PP;
typedef vector<int> vi;
typedef vector<vi> vvi;
int max(int a, int b) {if(b>a) return b; else return a;}
int min(int a, int b) {if(b<a) return b; else return a;}


signed main() {
    int N;
    cin >> N;
    vi ue(N+1, 0), shita(N+1, 0);
    FOR(i, 1, N+1) {
        int a;
        cin >> a;
        ue[i] = ue[i-1]+a;
    }
    FOR(i, 1, N+1) {
        int a;
        cin >> a;
        shita[i] = shita[i-1]+a;
    }

    int res = 0;
    FOR(i, 1, N+1) {
        int usum = ue[i];
        int ssum = shita[N] - shita[i-1];
        res = max(res, usum+ssum);
    }

    cout << res << endl;

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <vector>
#include <set>
#include <stack>
#include <bitset>
using namespace std;
#define PB push_back
const int N=1e4+10;
vector<int> graph[N];
int dep[N],low[N],p[N],t=0;
stack<int>s;
bitset<N>went,in;
void dfs(int now){
    s.push(now);
    low[now]=dep[now]=++t;
    in[now]=went[now]=true;
    for(auto u:graph[now]){
        if(!went[u])dfs(u);
        if(in[u])low[now]=min(low[now],low[u]);
    }
    if(low[now]==dep[now]){
        while(s.top()!=now){
            in[s.top()]=false;
            p[s.top()]=now;
            s.pop();
        }
        p[now]=now;
        s.pop();
        in[now]=false;
    }
    return ;
}
int main(){
    int n,m,l,r;
    scanf("%d%d",&n,&m);
    while(m--){
        scanf("%d%d",&l,&r);
        graph[l].PB(r);
    }
    went.reset();
    in.reset();
    for(int i=0;i<n;i++)if(!went[i])dfs(i);
    scanf("%d",&m);
    while(m--){
        scanf("%d%d",&l,&r);
        printf("%d\n",p[l]==p[r]);
    }
}


Measured memory_bytes: 4312
#include<stdio.h>
#include<iostream>
#include <algorithm>
#include<string.h>
#include<ctype.h>
using namespace std;
int main(){
	char n[10000];
	int i=0;
	int m=0;

	while(1){
		i=0;
		m=0;
		cin>>n;


		while(n[i]!='\0'){
			m=m+(n[i]-'0');
			i++;

			if(m==0){
				break;
			}
		}

		if(m==0){
			break;
		}

		cout<<m<<endl;

	}
	return 0;
}

Measured memory_bytes: 3108
#include <algorithm>
#include <climits>
#include <functional>
#include <iostream>
#include <queue>
#include <vector>
using namespace std;

typedef long long ll;
typedef pair<int, int> i_i;
struct edge { int v, w; };

ll INF = LLONG_MAX / 2;

int main() {
	int N, A, B; cin >> N >> A >> B;
	vector<int> r(N), s(N);
	int M = 0;
	for (int i = 0; i < N; i++) {
		cin >> r[i] >> s[i];
		M += s[i];
	}
	int lb = 0, ub = M + 1;
	while (ub - lb > 1) {
		int mid = (lb + ub) / 2;
		vector<vector<ll> > dp(2, vector<ll>(M + 1));
		for (int t = 0; t <= 1; t++)
			for (int x = 0; x <= M; x++)
				dp[t][x] = (x >= mid ? -INF : INF);
		for (int i = N - 1; i >= 0; i--) {
			vector<vector<ll> > _dp(2, vector<ll>(M + 1));
			for (int x = 0; x <= M; x++) {
				_dp[0][x] = INF;
				if (x + s[i] <= M)
					_dp[0][x] = min(_dp[0][x], dp[1][x + s[i]] - r[i]);
				_dp[0][x] = min(_dp[0][x], max(1LL, dp[0][x] + r[i] + 1));
			}
			for (int x = 0; x <= M; x++) {
				_dp[1][x] = -INF;
				_dp[1][x] = max(_dp[1][x], dp[0][x] + r[i]);
				if (x + s[i] <= M)
					_dp[1][x] = max(_dp[1][x], min(-1LL, dp[1][x + s[i]] - r[i] - 1));
			}
			dp = _dp;
		}
		if (dp[0][0] <= A - B) lb = mid;
		else ub = mid;
	}
	cout << lb << ' ' << M - lb << endl;
}

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

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep3(i,m,n) for(int (i)=m;(i)<=(n);(i)++)
#define rep3rev(i,m,n) for(int (i)=m;(i)>=(n);(i)--)
#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define eb emplace_back

using ll = long long;
using vll = vector<ll>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using P = pair<int, int>;

/*** MOD CALCULATION ***/

const int MOD = 1e9+7;
const int MAX = 2'000'005;

ll addM(ll a, ll b){
	return (a + b) % MOD;
}

ll mulM(ll a, ll b){
	ll temp = ((a % MOD) * (b % MOD)) % MOD;
  	return temp;
}

ll powM(ll a, ll b){
	if(b == 0) return 1;
  	else if(b == 1) return a % MOD;
  	else if(b%2==0) return mulM(powM(a, b/2), powM(a, b/2));
  	else return mulM(a, mulM(powM(a, (b-1)/2), powM(a, (b-1)/2)));
}

// b^{-1} = b^{p-2} (mod p)
// a/b = a*b^{p-2} (mod p)
ll divM(ll a, ll b){ 
  	return mulM(a, powM(b, MOD-2));
}

// n!, (n!)^{-1} のテーブル作成
ll fac[MAX], finv[MAX], inv[MAX];
void COMBinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    rep3(i,2,MAX-1){
        fac[i] = fac[i-1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i-1] * inv[i] % MOD;
    }
}

// 二項係数計算
ll COMB(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n-k] % MOD) % MOD;
}

/*** MOD CALCULATION ここまで ***/

void Main() {
    const int A = 26;
    
    int k; string s; cin >> k >> s;
    int n = s.size();
    
    COMBinit();
    ll tot = 0;
    
    rep3(last, n, n+k){
        ll temp = COMB(last-1, n-1);
        temp = mulM(temp, powM(A-1, last-n));
        temp = mulM(temp, powM(A, n+k-last));
        tot = addM(tot, temp);
    }
    cout << tot << endl;
    return;
}

int main() {
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
	return 0;
}

Measured memory_bytes: 51264
using System;
//k番目の値->「x未満がk未満」であるxの最大値
//-INF=ok,INF=ngを条件に(今回はINF=10^18 +1)二分探索でO(log INF)
//「x未満が何個？」
class Program
{
    static public readonly long INF = (long)Math.Pow(10, 18) + 1;
    static void Main(string[] args)
    {
        string[] In = Console.ReadLine().Split(' ');
        int n = int.Parse(In[0]);
        long k = long.Parse(In[1]);
        string[] In1 = Console.ReadLine().Split(' ');
        long[] A = new long[n];
        for (int i = 0; i < n; i++)
        {
            A[i] = long.Parse(In1[i]);
        }
        //A[i]のソートを行う
        Array.Sort(A);
        //二分探索 lとrが隣あったら終わり
        long l = -INF, r = INF;//left right
        while (l + 1 < r)
        {
            long x = (l + r) / 2;
            bool ok = BinarySerach(A, n, x, k);
            if (ok) l = x;
            else r = x;
        }
        Console.WriteLine(l);
    }
    static public bool BinarySerach(long[] A,int n,long x,long k)
    {
        long tot = 0;
        for(int i = 0; i < n; i++)
        {
            if (A[i] < 0)
            {
                int L = -1, R = n;
                while (L + 1 < R)
                {
                    int c = (L + R) / 2;
                    if (A[c] * A[i] < x) R = c;
                    else L = c;
                }
                tot += n - R;
            }
            else
            {
                int L = -1, R = n;
                while (L + 1 < R)
                {
                    int c = (L + R) / 2;
                    if (A[c] * A[i] < x) L = c;
                    else R = c;
                }
                tot += R;
            }
            if (A[i] * A[i] < x) tot--;
        }
        tot /= 2;
        return tot < k;
    }
}
// class Program
// {
//    static void Main(string[] args)
//    {
//        string[] In = Console.ReadLine().Split(' ');
//        int n = int.Parse(In[0]);
//        int k = int.Parse(In[1]);
//        string[] In1 = Console.ReadLine().Split(' ');
//        int[] A = new int[n];
//        int m = 0, z = 0, p = 0;//minus,zero,plus
//        for(int i=0; i < n; i++)
//        {
//            A[i] = int.Parse(In1[i]);
//            if (A[i] < 0) m++;
//            else if (A[i] == 0) z++;
//            else if (A[i] > 0) p++;
//        }
//        long rm =m*p;
//        long rp =p*(p-1)/2;
//        long rz = n * (n - 1) / 2 - rm - rp;

//        }   
//}



Measured memory_bytes: 37196
#include <bits/stdc++.h>
using namespace std; 
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define ALL(a) (a).begin(),(a).end()
#define UMAP unordered map
#define ll long long
long long min(long long x,long long y){return (x<y ? x:y);}
long long max(long long x,long long y){return (x>y ? x:y);}
#define ld long double
int stoi(string s) {return atoi(s.c_str());}
int keta(ll x){ if(x<10){return 1;} else{return keta(x/10) + 1;}}
#define LINEY "YES\n"
#define Liney "Yes\n"
#define LINEN "NO\n"
#define Linen "No\n"

int N;
bool e_mat[100][100];
bool dfs_connected(int v,int* v_n,bool visit[]){
  //printf("v:%d v_n:%d\n",v,*v_n);
  if(*v_n==N-1){
    //printf("connect\n");
    return 1;
  }
  bool r = false;
  if(visit[v]==false){
    //printf("visit %d\n",v);
    visit[v] = true;
    ++*v_n;
    REP(i,N){
      if(e_mat[v][i]==true){
        if(visit[i]==false){
          r += dfs_connected(i,v_n,visit);
        }
      }
    }
  }
  return r;
}

int main(){
  cin>>N;
  REP(i,N){REP(j,N){e_mat[i][j]=0;}}
  
  int M; cin >>M;
  pair<int,int> e[M];
  REP(i,M){
    int a,b; cin >> a >> b;
    a--; b--;
    e_mat[a][b] = 1;
    e_mat[b][a] = 1;
    e[i] = make_pair(a,b);
  }
  
  int r = 0;
  REP(i,M){
    bool visit[N];
    REP(j,N){visit[j] = false;}
    int v_n = 0;
    int a = e[i].first;
    int b = e[i].second;
    //printf("(%d,%d)\n",a,b);
    e_mat[a][b] = 0;
    e_mat[b][a] = 0;
    r += dfs_connected(0,&v_n,visit);
    e_mat[a][b] = 1;
    e_mat[b][a] = 1;
  }
  printf("%d\n",M-r);
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
// 縦と横で整数の個数を数える。
int main() {
    int N, M, yokomax, tatemax, dist, temp;
    cin >> N >> M;
    while (N != 0 && M != 0) {  
    vector<int> H(N+1,0);
    vector<int> W(M+1,0);

    
    // 座標の形で入力（始点は0）
    for(int i=1;i<=N;i++) {
        cin >> temp;
        H.at(i) = H.at(i-1) + temp;
    }

    for(int i=1;i<=M;i++) {
        cin >> temp;
        W.at(i) = W.at(i-1) + temp;
    }
    yokomax = H.at(N);
    tatemax = W.at(M);
    
    int maxside;
    if (yokomax >= tatemax) {
        maxside = tatemax;
    }
    else{
        maxside = yokomax;
    }
    vector<int> tatecount(maxside+1,0); 
    vector<int> yokocount(maxside+1,0); 
    for(int i=0;i<N;i++) {
        for(int j=i+1;j<N+1;j++){
            dist = H.at(j) - H.at(i);
            if (dist <= maxside){
                yokocount.at(dist) += 1;
            }
        }
    }
    for(int i=0;i<M;i++) {
        for(int j=i+1;j<M+1;j++){
            dist = W.at(j) - W.at(i);
            if (dist <= maxside){
                tatecount.at(dist) += 1;
                           }
        }
    }
    //cout << tatecount << " " << yokocount << endl;
      
    int ans = 0;
    for(int i=1;i<maxside+1;i++){
        ans += tatecount.at(i)*yokocount.at(i);
    }
    cout << ans << endl;
    cin >> N >> M;
    }
    

}


Measured memory_bytes: 6676
import java.io.PrintWriter;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        Scanner in = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);
        int n = in.nextInt();
        int[] raw = new int[n];

        // 初回
        for (int i = 0; i < n; i++) {
            int tmp = in.nextInt();
            out.append(Integer.toString(tmp));
            // System.out.print(tmp);
            if (i != n - 1) {
                // System.out.print(" ");
                out.append(" ");
            }
            raw[i] = tmp;
        }
        out.append("\n");


        for (int i = 1; i < n; i++) {
            int key = raw[i];
            int j = i - 1;

            while (j >= 0 && raw[j] > key) {
                raw[j + 1] = raw[j];
                j--;
            }
            raw[j + 1] = key;

            for (int k = 0; k < n; k++) {
                out.append(Integer.toString(raw[k]));
                // System.out.print(raw[k]);
                if (k != n - 1) {
                    //System.out.print(" ");
                    out.append(" ");
                }
            }
            
                //System.out.print("\n");
                out.append("\n");
            
        }

        out.flush();

    }
}



Measured memory_bytes: 29052
n=int(input())
x = list(map(int,input().split()))

y = len(x)
mini = min(x)
maxi = max(x)
x.sort()

ans = 0
p = 0
for valuse in range(mini,maxi):
  p=0
  for j in range(n):
    p += (x[j] -valuse) **2
  if p < ans or ans == 0 :
    ans = p

    ans1 = valuse
  else:
    break

print(ans)

Measured memory_bytes: 3064
#include <stdio.h>

void BubbleSort(int A[],int N){
    int flag = 1,i,j,temp,count=0;
    while(flag){
        flag=0;
        for(j=N-1;0<j;j--){
            if(A[j]<A[j-1]){
                temp=A[j];
                A[j]=A[j-1];
                A[j-1]=temp;
                
                flag=1;
                count++;
            }
        }
    }
    for(i=0;i<N;i++){
        printf("%d",A[i]);
        if(i<N-1) printf(" ");
    }
    printf("\n%d\n",count);
}

int main(){
    int i,N;
    scanf("%d",&N);
    int A[N];
    for(i=0;i<N;i++){
        scanf("%d",&A[i]);
    }
    BubbleSort(A,N);
    return 0;
}

Measured memory_bytes: 1820
#include <iostream>
#include <algorithm>
#include <stdio.h>
using namespace std;

void selectionSort(int A[], int N);

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

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

  selectionSort(A, N);

  return 0;
}

void selectionSort(int A[], int N){
  int i, j, minj;
  int count = 0;

  for(i = 0; i < N; i++){
    minj = i;
    for(j = i; j < N; j++){
      if(A[j] < A[minj]) minj = j;
    }
    swap(A[i], A[minj]);
    if(i != minj) count++;
  }

  for(i = 0; i < N; i++){
    printf("%d", A[i]);
    if(i == N-1){
      printf("\n");
    }else{
      printf(" ");
    }
  }
  printf("%d\n", count);
}



Measured memory_bytes: 3208
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<int,int> Pi;
#define rep(i,n) for(ll i=0;i<n;i++)
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define fi first
#define se second
#define endl "\n"

template<typename T> inline bool chmax(T &a, T b){if(a<b){a=b;return true;}return false;}
template<typename T> inline bool chmin(T &a, T b){if(a>b){a=b;return true;}return false;}
template<typename T> ostream& operator<<(ostream& s,const complex<T>& d) {return s<<"("<<d.real()<<", "<<d.imag()<< ")";}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const pair<T1,T2>& d) {return s<<"("<<d.first<<", "<<d.second<<")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& d){int len=d.size();rep(i,len){s<<d[i];if(i<len-1) s<<" ";}return s;}
template<typename T> ostream& operator<<(ostream& s,const vector<vector<T>>& d){int len=d.size();rep(i,len){s<<d[i]<<endl;}return s;}
template<typename T> ostream& operator<<(ostream& s,const set<T>& v){s<<"{ ";for(auto itr=v.begin();itr!=v.end();++itr) {if (itr!=v.begin()) {s<< ", ";}s<<(*itr);}s<<" }";return s;}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const map<T1,T2>& m){s<<"{"<<endl;for(auto itr=m.begin();itr!=m.end();++itr){s<<" "<<(*itr).first<<" : "<<(*itr).second<<endl;}s<<"}"<<endl;return s;}

const ll mod=1e9+7;
const ll inf=1e17;
const int INF=1e9;
const double PI=acos(-1);
const double EPS=1e-10;

int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    ll n,m,x;
    cin>>n>>m>>x;
    vector<vector<ll>> a(n,vector<ll>(m));
    vector<ll> c(n);
    rep(i,n){
        cin>>c[i];
        rep(j,m) cin>>a[i][j];
    }
    ll ans=inf;
    rep(S,1<<n){
        vector<ll> now(m,0);
        ll cnt=0;
        rep(i,n){
            if(S & 1<<i){
                cnt+=c[i];
                rep(j,m){
                    now[j]+=a[i][j];
                }
            }
        }
        bool flag=true;
        rep(i,m){
            if(now[i]<x) flag=false;
        }
        if(flag) chmin(ans,cnt);
    }
    if(ans!=inf) cout<<ans<<endl;
    else cout<<-1<<endl;
}

Measured memory_bytes: 3664
import sys
import itertools
import queue
input = sys.stdin.readline
sys.setrecursionlimit(100000)
# mod = 10 ** 9 + 7

def read_values(): return map(int, input().split())
def read_index(): return map(lambda x: int(x) - 1, input().split())
def read_list(): return list(read_values())
def read_lists(N): return [read_list() for n in range(N)]


class V:
    def __init__(self, f, v=None):
        self.f = f
        self.v = v
 
    def __str__(self):
        return str(self.v)
 
    def ud(self, n):
        if n is None:
            return

        if self.v is None:
            self.v = n
            return
        self.v = self.f(self.v, n) 


def main():
    K = int(input())
    
    q = queue.Queue()
    for i in range(1, 10):
        q.put(i)

    r = 9
    for k in range(K):
        a = q.get()
        l = max(0, a % 10 - 1)
        ll = min(10, a % 10 + 2)
        for b in range(l, ll):
            q.put(a * 10 + b)
            r += 1
    print(a)


if __name__ == "__main__":
    main()


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

#define Abs(x)((x) < 0 ? (x) * -1 : (x))

#define rep(x, y) for ((x) = 0; (x) < (y); (x)++)
#define repin(x, y) for ((x) = 0; (x) <= (y); (x)++)
#define nep(x, y) for ((x) = (y) - 1; 0 <= (x); (x)--)
#define nepi(x, y, z) for ((x) = (y) - 1; (z) <= (x); (x)--)
#define repi(x, y, z) for ((x) = (z); (x) < (y); (x)++)
#define repiin(x, y, z) for ((x) = (z); (x) <= (y); (x)++)
#define reps(x, y, z) for ((x) = 0; (x) < (y); (x) += (z))
#define repis(x, y, z, s) for ((x) = (z); (x) < (y); (x) += (s))
#define repiins(x, y, z, s) for ((x) = (z); (x) <= (y); (x) += (s))
#define repit(x) for (__typeof((x).begin()) it = (x).begin(); it != (x).end(); it++)
#define nepit(x) for (__typeof((x).rbegin()) it = (x).rbegin(); it != (x).rend(); it++)

#define All(x) (x).begin(),(x).end()

#define Mem0(x) memset(x, 0, sizeof(x))
#define Mem1(x) memset(x, -1, sizeof(x))

#define Unique(v) v.resize(unique(All(v)) - v.begin())

#define peq(p0, p1)(p0.first == p1.first && p0.second == p1.second)

#define End '\n'
#define Out(x) cout<<(x)<<End
#define OutP(p, sep, end) cout<<p.first<<sep<<p.second<<end

template<typename T> inline bool Max(T &x, const T &y) { return x < y ? x = y, 1 : 0; }
template<typename T> inline bool Min(T &x, const T &y) { return x > y ? x = y, 1 : 0; }
template<typename T> using V = vector<T>;
template<typename T> using VV = V<V<T> >;

#define pb push_back
#define mp make_pair
#define X first
#define Y second
#define lb std::lower_bound
#define ub std::upper_bound

#define lbi(v, x) lb(All(v), (x))-v.begin()
#define ubi(v, x) ub(All(v), (x))-v.begin()

static const ll MOD = 1e9 + 7;
static const double PI = 3.141592653589793;

#define LOCAL 0

int main()
{
#if LOCAL
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
    freopen("debug.txt", "w", stderr);
#endif

    cin.tie(0);
    ios::sync_with_stdio(false);
	//std::cout.precision(18);

    string s;

	cin >> s;

	string ans = "";

	int i, len = s.size();

	reps(i, len, 2) ans += s[i];

	Out(ans);
	
	return 0;
}


Measured memory_bytes: 592
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b)  for(int i=(a),i##formax=(b);i< i##formax;i++)
#define FORR(i,a,b) for(int i=(a),i##formin=(b);i>=i##formin;i--)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define pcnt __builtin_popcount
#define sz(x) (int)(x).size()
#define maxs(x,y) x=max((x),(y))
#define mins(x,y) x=min((x),(y))
#define show(x) cout<<#x<<" = "<<(x)<<endl;
#define all(a) ((a).begin()),((a).end())
#define each(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)
#define bit(n) (1LL<<(n))
typedef long long ll;
typedef __int128_t lll;
template<class T>using V=vector<T>;
template<class T>using VV=V<V<T>>;
template<class T,class Y>using P=pair<T,Y>;
template<class T,class Y>ostream& operator<<(ostream&o,P<T,Y>&p){return o<<"("<<p.fi<<","<<p.se<<")";}
template<class T>ostream& operator<<(ostream&o,V<T>&v){for(T&t:v)o<<t<<",";return o<<endl;}
template<class T>void uniq(V<T>&v){sort(all(v));v.erase(unique(all(v)), v.end());}

lll gcd(lll a,lll b,lll&x,lll&y){if(!b){x=1;y=0;return a;}lll d=gcd(b,a%b,y,x);y-=a/b*x;return d;}
ll modInv(ll a,ll m){lll x,y;gcd(a,m,x,y);return(x%m+m)%m;}
ll modPow(lll a,lll n,ll m){lll p=1;for(;n;n>>=1,a=a*a%m)if(n&1)p=p*a%m;return p;}
//V<ll>F,R;void setF(int n,int mod){F=R=V<ll>(++n);F[0]=1;FOR(i,1,n)F[i]=F[i-1]*i%mod;R[n-1]=modInv(F[n-1],mod);FORR(i,n-1,1)R[i-1]=R[i]*i%mod;}
//ll comb(int a,int b,int m){return a<b||b<0?0:F[a]*R[b]%m*R[a-b]%m;}

const int IINF = 1e9+6;
const ll LINF = 1e18;
const int MOD = 1e9+7; //998244353;
const ll N = 1e5;
ll a[N];
ll n, m, c[N+2], s[N+2];
main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> n >> m;
  FOR(i, 0, n){
    cin >> a[i];
    c[a[i]]++;
    s[a[i]] += a[i];
  }
  FORR(i, N-1, 0){
    s[i] += s[i+1];
    c[i] += c[i+1];
  }
  ll l = 0, r = N*2+1, k;
  ll ans;
  while(r-l>1){
    k = (l+r)/2;
    ll cc = 0, ss = 0;
    FOR(i, 0, n){
      ll t = max(0ll, min(k-a[i], N+1));
      cc += c[t];
      ss += s[t]+c[t]*a[i];
    }
    if(cc < m){
      r = k;
    }else{
      l = k;
      ans = ss-(cc-m)*k;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 2688
def main():
  n = int(input())
  ls = list(map(int, input().split()))
  if 0 in ls:
      print(0)
      return
  ans = 1
  for l in ls:
      ans *= l
      if ans > 1e18:
          print(-1)
          return
  print(ans)
  
main()

Measured memory_bytes: 21588
N = int(input())
X = []
Y = []
answer = 'No'
for i in range(N):
    x,y = map(int, input().split())
    X.append(x)
    Y.append(y)
for j in range(N-2):
    if ((X[j]==Y[j])and(X[j+1]==Y[j+1])and(X[j+2]==Y[j+2])):
        answer = 'Yes'
print(answer)


Measured memory_bytes: 9184
#include<bits/stdc++.h>
using namespace std;
int main(){
	char a[4];
	cin>>a[0]>>a[1]>>a[2];
	if(a[0]=='S'&&a[1]=='A'&&a[2]=='T') cout<<"1";
	if(a[0]=='M'&&a[1]=='O'&&a[2]=='N') cout<<"6";
	if(a[0]=='T'&&a[1]=='U'&&a[2]=='E') cout<<"5";
	if(a[0]=='W'&&a[1]=='E'&&a[2]=='D') cout<<"4";
	if(a[0]=='T'&&a[1]=='H'&&a[2]=='U') cout<<"3";
	if(a[0]=='F'&&a[1]=='R'&&a[2]=='I') cout<<"2";
	if(a[0]=='S'&&a[1]=='U'&&a[2]=='N') cout<<"7";
	return 0;
}

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

#define MAX 1000000
#define NIL -1

int primes[MAX];

bool isPrime(int n)
{
    if (n <= 1) {
        primes[n] = 0;
        return false;
    }
    if (n <= 3) {
        primes[n] = 1;
        return true;
    }
    if (n % 2 == 0 || n % 3 == 0) {
        primes[n] = 0;
        return false;
    }
    for (int i = 5; i * i <= n; i = i + 6)
        if (n % i == 0 || n % (i + 2) == 0) {
            primes[n] = 0;
            return false;
    }
    primes[n] = 1;
    return true;
}

int main()
{
    for (int i = 1; i <= MAX; i++) primes[i] = NIL;
    int N, sum;
    while(std::scanf("%d", &N) != EOF) {
        sum = 0;
        for (int i = 2; i <= N; i++) {
            if (primes[i] != NIL) {
                if (primes[i] == 1) sum++;
            }
            else {
                if (isPrime(i)) sum++;
            }
        }
        std::printf("%d\n", sum);
    }
    return 0;
}



Measured memory_bytes: 7104
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		new Main().run();
	}

	void run() {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		sc.close();

		if(a+b >= c) System.out.println("Yes");
		else System.out.println("No");
	}
}

Measured memory_bytes: 22100
#include <bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
const long long LINF = 1e18;
#define dump(x)  cout << 'x' << ' = ' << (x) << ` `;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOREACH(x,a) for(auto& (x) : (a) )
typedef long long ll;
using namespace std;
int main(int argc, char const *argv[]) {
    int a, b, k;
    cin >> a >> b >> k;
    vector<int> c;
    for (int i = 1; i <= 100; ++i) if (a%i == 0 && b%i == 0) c.push_back(i);
    cout << c[c.size()-k] << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() { 
  int a , b , c , d ;
  cin>> a>>b>>c>>d ;
  if (a+b>c+d){
   cout << "Left" << endl;
  }
  else if(a+b<c+d){
    cout << "Right" << endl;
  }
  else{
    cout << "Balanced" << endl;
  }
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
#include<string.h>
using namespace std;
int main(void){
	char a[1001],b[1001];
	int x,y,cnt;
	scanf("%s %s",a,b);
	x=strlen(b);  y=strlen(a);
	int dp[x][y],i,j,k;
	for(i=0;i<x;i++){
		for(j=0;j<y;j++) dp[i][j]=0;
	}
//printf("x=%d y=%d\n",x,y);
	for(i=0;i<y;i++){
		if(b[0]==a[i]) dp[0][i]=1;
//printf(" %d",dp[0][i]);
	}
//printf("\n");
	for(i=1;i<x;i++){
		for(j=i-1;j<y-1;j++){
			if(dp[i-1][j]>0){
//printf("j=%d ",j);	
				for(k=j+1;k<y;k++){
					if(b[i]==a[k])    dp[i][k]=(dp[i][k]+dp[i-1][j])%1000000007;
//printf(" %d",dp[i-1][j]);
				}
//printf("\n");
			}
/*for(k=0;k<y;k++)printf(" %d",dp[i][k]);
printf("\n");*/
		}
	}
/*for(i=0;i<x;i++){
	printf("%d ",i);
	for(j=0;j<y;j++) printf(" %d",dp[i][j]);
	printf("\n");
}*/
	cnt=0;
	for(i=0;i<y;i++) cnt=(cnt+dp[x-1][i])%1000000007;
	printf("%d\n",cnt);
	return 0;
}


Measured memory_bytes: 7120