akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define int long long
using ll=long long;
using vi=vector<int>;
using pii=pair<int,int>;
#define ALL(c) begin(c),end(c)
#define RALL(c) rbegin(c),rend(c)
#define ITR(i,b,e) for(auto i=(b);i!=(e);++i)
#define FORE(x,c) for(auto &x:c)
#define REPF(i,a,n) for(int i=a,i##len=(int)(n);i<i##len;++i)
#define REP(i,n) REPF(i,0,n)
#define REPR(i,n) for(int i=(int)(n);i>=0;--i)
#define SZ(c) ((int)c.size())
#define CONTAIN(c,x) (c.find(x)!=end(c))
#define OUTOFRANGE(y,x,h,w) (y<0||x<0||y>=h||x>=w)
#define dump(...)
const int DX[9]={0,1,0,-1,1,1,-1,-1,0},DY[9]={-1,0,1,0,-1,1,1,-1,0};
#define INF (1001001001)
#define INFLL (1001001001001001001ll)
template<class T> ostream& operator << (ostream &os,const vector<T> &v) {
    ITR(i,begin(v),end(v)) os<<*i<<(i==end(v)-1?"":" "); return os; }
template<class T> istream& operator >> (istream &is,vector<T> &v) {
    ITR(i,begin(v),end(v)) is>>*i; return is; }
template<class T> istream& operator >> (istream &is, pair<T,T> &p) {
    is>>p.first>>p.second; return is; }
template <class T> bool chmax(T &a,const T &b) {if(a<b) {a=b;return 1;} return 0;}
template <class T> bool chmin(T &a,const T &b) {if(b<a) {a=b;return 1;} return 0;}
template <class T> using heap = priority_queue<T,vector<T>,greater<T>>;
struct before_main_function {
    before_main_function() {
        #ifdef int
            #undef INF
            #define INF INFLL
            #define stoi stoll
        #endif
        cin.tie(0);ios::sync_with_stdio(false);
        cout<<setprecision(15)<<fixed;
        // #define endl "\n"
    }
} before_main_function;
//------------------8<------------------------------------8<--------------------

signed main() {
    int n,a,b;
    cin>>n>>a>>b;
    cout<<min(n*a,b)<<endl;
    return 0;
}


Measured memory_bytes: 256
//in the name of allah the most gracious the most merciful
#include<bits/stdc++.h>
#pragma GCC optimize ("Ofast","unroll-loops")
#define int long long
#define pb push_back
#define fi  first
#define rep(i,n)  for(int i=0;i<n;i++)//looping 
#define rep1(i,n) for(int i=1;i<=n;i++)  
#define se  second
#define endl '\n'
#define PB pop_back
#define PF pop_front
#define pf push_front
#define all(x) x.begin(),x.end()
#define pii pair<int,int>
#define ld long double 
const double PI = acos(-1);
const double e = exp(1);
const int MAXN = 2e5+100;
using namespace std;
void solve(){
    int n,m; 
    cin>>n>>m;
    int ans  = 0 ; 
    ans += n*(n-1)/2;
    ans += m*(m-1)/2; 
    cout << ans;
    return ;
}
signed main ()
{
    int t=1; 
    
    while(t--){
        solve(); 
        cout << endl;
    }
    return 0 ; 
}   

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func main() {
	S := getStdin()
	if S == "Sunny" {
		fmt.Printf("Cloudy\n")
	} else if S == "Cloudy" {
		fmt.Printf("Rainy\n")
	} else {
		fmt.Printf("Sunny\n")
	}
}

var sc = bufio.NewReaderSize(os.Stdin, 1024*1024*10)

func getStdin() string {
	return readLine()
}
func getStdinInt() int {
	str := getStdin()
	rtn, _ := strconv.Atoi(str)
	return rtn
}
func getStdinInt2() (int, int) {
	list := getStdinIntArr()
	return list[0], list[1]
}
func getStdinInt3() (int, int, int) {
	list := getStdinIntArr()
	return list[0], list[1], list[2]
}
func getStdinInt64() int64 {
	str := getStdin()
	rtn, _ := strconv.ParseInt(str, 10, 64)
	return rtn
}
func getStdinIntU64() uint64 {
	str := getStdin()
	rtn, _ := strconv.ParseInt(str, 10, 64)
	return uint64(rtn)
}
func getStdinInt64_2() (int64, int64) {
	list := getStdinIntArr64()
	return list[0], list[1]
}
func getStdinInt64_3() (int64, int64, int64) {
	list := getStdinIntArr64()
	return list[0], list[1], list[2]
}
func getStdinIntArr() []int {
	str := getStdin()
	list := strings.Split(str, " ")
	rtn := make([]int, len(list))
	for idx, val := range list {
		rtn[idx], _ = strconv.Atoi(val)
	}
	return rtn
}
func getStdinIntArr64() []int64 {
	str := getStdin()
	list := strings.Split(str, " ")
	rtn := make([]int64, len(list))
	for idx, val := range list {
		rtn[idx], _ = strconv.ParseInt(val, 10, 64)
	}
	return rtn
}
func getStdinIntArrU64() []uint64 {
	str := getStdin()
	list := strings.Split(str, " ")
	rtn := make([]uint64, len(list))
	for idx, val := range list {
		r, _ := strconv.ParseInt(val, 10, 64)
		rtn[idx] = uint64(r)
	}
	return rtn
}
func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}
func min64(a, b int64) int64 {
	if a < b {
		return a
	}
	return b
}
func max(a, b int) int {
	if a < b {
		return b
	}
	return a
}
func max64(a, b int64) int64 {
	if a < b {
		return b
	}
	return a
}
func abs(n int) int {
	if n < 0 {
		return -n
	}
	return n
}
func abs64(n int64) int64 {
	if n < 0 {
		return -n
	}
	return n
}
func readLine() string {
	buf := make([]byte, 0, 0)
	for {
		l, p, _ := sc.ReadLine()
		buf = append(buf, l...)
		if !p {
			break
		}
	}
	return string(buf)
}


Measured memory_bytes: 2168
N,D = map( int, input().split() )
distance = []
c = 0
for i in range(N):
    a = list( map( int, input().split() ) )
    distance.append(a)

for i in range(N):
    for j in range(i+1,N):
        t = 0
        ans = 0
        for k in range(D):
            t += ( distance[i][k] - distance[j][k] )**2
        ans = t**(1/2)
        if ans.is_integer():
            c += 1
print(c)

Measured memory_bytes: 3064
'use strict'
function main(i) {
  i = i.trim().split('\n')
  const n = i[0] - 0
  i = i[1].split(' ').map(v => v - 0)

  let ans = 0
  for (let j = 1; j < n - 1; j++) {
    if (
      (i[j-1] < i[j] && i[j] < i[j+1]) ||
      (i[j+1] < i[j] && i[j] < i[j-1])) {
      ans++
    }
  }
  console.log(ans)
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));


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

vector<int> prime_3;

void prime()
{
    for(int i = 3; i <= 55555; i += 10){
        bool f = true;
        for(int j = 2; j * j <= i; j++){
            if(i % j == 0){
                f = false;
            }
        }
        if(f) prime_3.push_back(i);
    }
}

int main()
{
    int n;
    cin >> n;
    prime();
    for(int i = 0; i < n; i++){
        cout << prime_3[i] << " ";
    }
}

Measured memory_bytes: 256
// clang-format off
#include <bits/stdc++.h>
#define int long long
#define main signed main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define forever for (;;)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
typedef std::pair<int, int> pii;
typedef std::vector<int> vi;
typedef std::vector<double> vd;
typedef std::vector<std::string> vs;
typedef std::vector<pii> vpii;
typedef std::vector<vi> vvi;
typedef std::vector<vpii> vvpii;
const int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
const int MOD = 1000000007;
const double PI = acos(-1);
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
template<typename T> std::istream &operator>>(std::istream &is, std::vector<T> &v) { rep(i,v.size()) is >> v[i]; return is; }
template<typename A, typename B> std::istream &operator>>(std::istream &is, std::pair<A, B> &p) { is >> p.first; is >> p.second; return is; }
using namespace std;
// clang-format on

typedef int Weight;
struct Edge {
  int src, dst;
  Weight weight;
  Edge(const int &s = 0, const int &d = 0, const Weight &w = 0) : src(s), dst(d), weight(w) {}
};

typedef std::vector<Edge> Edges;
typedef std::vector<Weight> Array;
typedef std::vector<Array> Matrix;

class Graph {
  std::vector<Edges> g;

public:
  Graph(const int &size = 0) : g(size) {}
  int size() const { return g.size(); }
  const Edges &operator[](const int &i) const { return g[i]; }
  void addArc(const int &src, const int &dst, const Weight &w = 1) { g[src].emplace_back(src, dst, w); }
  void addEdge(const int &node1, const int &node2, const Weight &w = 1) {
    addArc(node1, node2, w);
    addArc(node2, node1, w);
  }
};

template<int inf = std::numeric_limits<Weight>::max() / 8> std::pair<std::vector<Weight>, std::vector<int>> dijkstra(const Graph &g, const int &src) {
  using state = std::pair<Weight, int>;
  std::priority_queue<state, std::vector<state>, std::greater<state>> q;
  std::vector<Weight> dist(g.size(), inf);
  std::vector<int> via(g.size());
  dist[src] = 0;
  q.emplace(0, src);
  while (q.size()) {
    Weight d;
    int v;
    std::tie(d, v) = q.top();
    q.pop();
    if (dist[v] < d) continue;
    for (auto &e : g[v]) {
      if (cmin(dist[e.dst], dist[v] + e.weight)) {
        via[e.dst] = v;
        q.emplace(dist[e.dst], e.dst);
      }
    }
  }
  return {dist, via};
}

main {
  int n;
  cin >> n;
  Graph g(n);
  while (n--) {
    int r, k;
    cin >> r >> k;
    --r;
    while (k--) {
      int t;
      cin >> t;
      --t;
      g.addArc(r, t);
    }
  }
  n = g.size();
  Matrix dist(n, Array(n));
  rep(i, n) {
    vector<Weight> d = dijkstra<INF>(g, i).first;
    rep(j, n) dist[i][j] = d[j];
  }
  int p;
  cin >> p;
  while (p--) {
    int s, d, v;
    cin >> s >> d >> v;
    --s, --d;
    if (dist[s][d] + 1 > v) {
      cout << "NA" << endl;
      continue;
    }
    cout << dist[s][d] + 1 << endl;
  }
}

Measured memory_bytes: 3180
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep1(i, n) for(int i = 1; i < n; i++)
#define all(v) (v).begin(), (v).end()
#define decimal fixed << setprecision(20)
#define fastcin() cin.tie(0);ios::sync_with_stdio(false)
using namespace std;
using LL = long long;
const int INF = 1e9;
const LL LLINF = 1e16;

int main(){
  vector<int> a(5);
  rep(i,5) cin>>a[i];
  int k;
  cin>>k;
  bool ans=false;
  rep(i,5)rep(j,5)if(abs(a[i]-a[j])>k) ans=true;
  cout << (ans ? ":(" : "Yay!") << endl;
  }

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

typedef long long ll;
#define int ll

using namespace std;

const int INF=1e9,N=12,PW=1<<N;

int ans[PW];

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

    int n,m;
    cin>>n>>m;
    int pw=1<<n;
    for(int i=0;i<pw;i++)
        ans[i]=INF;
    while(m--)
    {
        int a,b;
        cin>>a>>b;
        int mask=0;
        while(b--)
        {
            int c;
            cin>>c;
            mask|=1<<(c-1);
        }
        ans[mask]=min(ans[mask],a);
    }
    for(int i=0;i<pw;i++)
        for(int j=0;j<pw;j++)
            ans[i|j]=min(ans[i|j],ans[i]+ans[j]);
    cout<<(ans[pw-1]==INF?-1:ans[pw-1]);
}


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

int power(int x, int y)
{
    int res = 1;      // Initialize result

     // Update x if it is more than or
                // equal to p

    while (y > 0)
    {
        // If y is odd, multiply x with result
        if (y & 1)
            res = (res*x);

        // y must be even now
        y = y>>1; // y = y/2
        x = (x*x);
    }
    return res;
}

int32_t main(){
	int n;
	cin>>n;
	if(n<1200) cout<<"ABC";
	else cout<<"ARC";
	return 0;
}


Measured memory_bytes: 256
import std;
import core.bitop;

ulong MAX = 100_100, MOD = 1_000_000_007, INF = 1_000_000_000_000;
alias sread = () => readln.chomp();
alias lread(T = long) = () => readln.chomp.to!(T);
alias aryread(T = long) = () => readln.split.to!(T[]);
alias Pair = Tuple!(long, "x", long, "g");
alias PQueue(T, alias less = "a>b") = BinaryHeap!(Array!T, less);

void main()
{
    auto n = lread();
    auto a = aryread();
    auto b = new long[](n);
    auto c = new long[](n);
    foreach_reverse (i; iota(n).map!"a += 1"())
    {
        if (b[i - 1] != a[i - 1])
        {
            auto t = factorization(i);
            foreach (e; t)
            {
                b[e - 1] = (b[e - 1] + 1) % 2;
            }
            c[i - 1] = 1;
        }
    }

    c.sum.writeln();
    iota(n).filter!(i => c[i] > 0)
        .map!(x => x + 1)
        .map!text
        .join(' ').writeln();
}

auto factorization(long N)
{
    auto f = new long[](0);
    foreach (i; iota(1, N + 1))
    {
        if (i ^^ 2 > N)
            break;

        if (N % i == 0)
        {
            f ~= [i];
            f ~= [N / i];
        }
    }
    return f.sort.uniq.array();
}

void scan(TList...)(ref TList Args)
{
    auto line = readln.split();
    foreach (i, T; TList)
    {
        T val = line[i].to!(T);
        Args[i] = val;
    }
}


Measured memory_bytes: 13500
#include <bits/stdc++.h>
#define ll long long
#define lld long double
#define MOD 1000000007
#define CAP 10000000
#define inf 1000000000000000000LL
#define pii pair<ll,ll>
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define endl '\n'
#define sz(v) v.size()
#define all(v)    v.begin(),v.end()
#define fast  ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
using namespace std;
ll power(ll x,ll y, ll md=MOD){ll res = 1;x%=md;while(y>0){if(y&1)res = (res*x)%md;x = (x*x)%md;y = y>>1;}return res%md;}

#define int ll

bool check(string a) {
	int n = a.size();
	if(n%2) return false;

	for(int i=0;i<n/2;i++) if(a[i]!=a[i+n/2]) return false;
	return true;
}

signed main() {
	fast;

	int n;
	cin>>n;
	cout<<n*n;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <cmath>
using namespace std;

#define FOR(i,s,e) for (int i = int(s); i < int(e); i++)
#define FORIT(i,c) for (typeof((c).begin()) i = (c).begin(); i != (c).end(); i++)
#define ISEQ(c) (c).begin(), (c).end()

int SURP = 1000000007;

long long int sDiff(long long int H,long long int W){
	long long int ret = H*W;
	FOR(i,1,H){
		long long int s[3];
		s[0] = i * W;
		if(W%2 == 1){
			s[1] = (W/2+1) * (H-i);
			s[2] = (W/2) * (H-i);
		}else{
			s[1] = (W/2) * (H-i);
			s[2] = (W/2) * (H-i);
		}
		sort(s,s+3);
		if(s[2]-s[0] < ret) {
			ret = s[2]-s[0];
		}
	}

	FOR(i,1,H-1){
		long long int s[3];
		s[0] = i * W;
		if((H-i)%2 == 1){
			s[1] = W * ((H-i)/2+1);
			s[2] = W * ((H-i)/2);
		}else{
			s[1] = W * ((H-i)/2);
			s[2] = W * ((H-i)/2);
		}
		sort(s,s+3);
		if(s[2]-s[0] < ret){
			ret = s[2]-s[0];
		}
	}

	return ret;
}

int main(){
	long long int H,W;
	cin >> H >> W;
	long long int s1 = sDiff(H,W);
	long long int s2 = sDiff(W,H);
	long long int ret = min(s1,s2);

	cout << ret << endl;
	return 0;

}

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

using namespace std;

void solve() {
    int N, M;
    cin >> N >> M;
    vector<int> X(M);
    for (int i = 0; i < M; i++)
    {
        cin >> X[i];
    }

    if (M <= N)
    {
        cout << "0" << endl;
        return;
    }
    
    int ans;
    ans = 0;
    sort(X.begin(), X.end());
    vector<int> interval(M-1);
    for (int i = 0; i < M-1; i++)
    {
        interval[i] = X[i+1] - X[i];
        ans += interval[i];
    }
    sort(interval.begin(), interval.end(), greater<>());
    for (int i = 0; i < N-1; i++)
    {
        ans -= interval[i];
    }
    
    cout << ans << endl;
    
}

int main() {
    solve();
    return 0;
}

Measured memory_bytes: 1024
#include <stdio.h>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>
#include <functional>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef vector<vector<int>> v2int;
typedef vector<ll> vll;
typedef vector<vector<ll>> v2ll;
typedef list<int> liint;
typedef pair<int, int> pint;
const int INF = int(2e9);
const ll LINF = ll(2e9) * ll(2e9);
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T, class C> void chmax(T& a, C b) { a > b ? : a = b; }
template<class T, class C> void chmin(T& a, C b) { a < b ? : a = b; }



int main() {
    int N, K;
    cin >> N >> K;
    vint h(N);
    int ans = 0;
    rep(i, N) {
        int h;
        cin >> h;
        if (h >= K) ans++;
    }
    cout << ans << endl;


    return 0;
}

Measured memory_bytes: 640
import sys
import math
import heapq
sys.setrecursionlimit(10**7)
INTMAX = 9223372036854775807
INTMIN = -9223372036854775808
DVSR = 1000000007
def POW(x, y): return pow(x, y, DVSR)
def INV(x, m=DVSR): return pow(x, m - 2, m)
def DIV(x, y, m=DVSR): return (x * INV(y, m)) % m
def LI(): return [int(x) for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LS(): return input().split()
def II(): return int(input())
def FLIST(n):
    res = [1]
    for i in range(1, n+1): res.append(res[i-1]*i%DVSR)
    return res
def gcd(x, y):
    if x < y: x, y = y, x
    div = x % y
    while div != 0:
        x, y = y, div
        div = x % y
    return y

N,K=LI()
SC=LI()
T=input()

DP=[[[0]*3 for _ in range(K)] for _ in range(N//K + (1 if N%K else 0))]

for i in range(N):
    cur = i//K
    rest = i%K
    v = 0 if T[i] == 'r' else (1 if T[i] == 's' else 2)
    if cur > 0:
        # 負ける場合
        DP[cur][rest][v] = max(DP[cur-1][rest][(v+1)%3], DP[cur-1][rest][(v+2)%3])
        DP[cur][rest][(v+1)%3] = max(DP[cur-1][rest][v], DP[cur-1][rest][(v+2)%3])
        # 勝つ場合
        DP[cur][rest][(v+2)%3] = max(DP[cur-1][rest][v], DP[cur-1][rest][(v+1)%3]) + SC[(v+2)%3]
    else:
        # 負ける場合
        DP[cur][rest][v] = 0
        DP[cur][rest][(v+1)%3] = 0
        # 勝つ場合
        DP[cur][rest][(v+2)%3] = SC[(v+2)%3]

res = 0

for i in range(N-K, N):
    cur = i//K
    rest = i%K
    # print(DP[cur][rest])
    res += max(DP[cur][rest])
print(res)


Measured memory_bytes: 74716
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n;
	cin>>n;
	int A[n],B[n],C[n],DPA[n],DPB[n],DPC[n];
	for(int i=0;i<n;i++){
		cin>>A[i]>>B[i]>>C[i];
	}
	DPA[0]=A[0];
	DPB[0]=B[0];
	DPC[0]=C[0];
	int res;
	for(int i=1;i<n;i++){
		DPA[i]=max(DPB[i-1]+A[i],DPC[i-1]+A[i]);
		DPB[i]=max(DPC[i-1]+B[i],DPA[i-1]+B[i]);
		DPC[i]=max(DPB[i-1]+C[i],DPA[i-1]+C[i]);
	}
	res=max(DPA[n-1],max(DPB[n-1],DPC[n-1]));
	cout<<res<<endl;
}

Measured memory_bytes: 2560
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;


namespace Haji
{
    class Class2
    {
  static void Main(string[] args)
        {
          
      string[] a = Console.ReadLine().Split();
            if (a[0] == "5" && a[1] == "5" && a[2] == "7") { Console.WriteLine("YES"); }
            else if (a[0] == "5" && a[1] == "7" && a[2] == "5") { Console.WriteLine("YES"); }
            else if (a[0] == "7" && a[1] == "5" && a[2] == "5") { Console.WriteLine("YES"); }
            else { Console.WriteLine("NO"); }
               
                
            
            
               
        }
      
    }
}


Measured memory_bytes: 25748
#include<bits/stdc++.h>
using namespace std;
const int Max_N=1e5;
int N,A[Max_N+10]={},B[Max_N+10]={},C[Max_N+10]={};
long long P[Max_N*3+10]={};
inline int lowbit(int x){
	return x & -x ;
}
inline void Add(int x,int k){
	for(;x<=Max_N*3;x+=lowbit(x)) P[x]+=k;
}
inline long long Ask(int x){
	long long Sum=0;
	for(;x>0;x-=lowbit(x)) Sum+=P[x];
	return Sum;
}
inline bool chck(int x){
	long long Cnt=1;
	for(int i=1;i<=N;i++)
	 if(A[i]<=x) B[i]=0;
	 else B[i]=1;
	for(int i=1;i<=N;i++) B[i]+=B[i-1];
	for(int i=1;i<=N;i++) Add(B[i]*2-i+N+1,1);
	for(int i=1;i<=N;i++){
		Cnt+=(N-i+1)-Ask(B[i-1]*2-(i-1)-1+N+1);
		Add(B[i]*2-i+N+1,-1);
	}
	return Cnt*2<N*1LL*(N+1)/2;
}
int main(){
	scanf("%d",&N);
	for(int i=1;i<=N;i++) scanf("%d",&A[i]),C[i]=A[i];
	sort(C+1,C+N+1);
	int l=1,r=N;
	for(;l+1<r;){
		int Mid=(l+r)>>1;
		if(chck(C[Mid])) r=Mid;
		else l=Mid;
	}
	if(chck(C[l])) printf("%d\n",C[l]);
	else printf("%d\n",C[r]);
	return 0; 
} 

Measured memory_bytes: 2176
from collections import deque
s = deque(list(input()))
q = int(input())
flg = True
for _ in range(q):
    try:
        t,f,c = input().split()
        if flg:
            if f == "1":
                s.appendleft(c)
            else:
                s.append(c)
        else:
            if f == "1":
                s.append(c)
            else:
                s.appendleft(c)
    except ValueError:
        if flg:
            flg = False
        else:
            flg = True
if flg:
    print(''.join(s))
else:
    s = list(reversed(s))
    print(''.join(s))

Measured memory_bytes: 14340
D, G = map(int, input().split())
p, c = list(zip(*[list(map(int, input().split())) for _ in range(D)]))

ans = sum(p)
for i in range(2 ** D):
    complete_indexes = [j for j in range(D) if (i >> j) & 1]

    cur_ans = 0
    cur_point = 0
    for j in complete_indexes:
        cur_ans += p[j]
        cur_point += p[j] * 100 * (j + 1) + c[j]

    if cur_point < G:
        incomplete_indexes = [j for j in range(D) if j not in complete_indexes]
        if incomplete_indexes:
            used_index = incomplete_indexes[-1]
            required = (G - cur_point + 100 * (used_index + 1) - 1) // (100 * (used_index + 1))
            cur_ans += min(required, p[used_index])
            cur_point += min(required, p[used_index]) * 100 * (used_index + 1)

    if G <= cur_point and cur_ans < ans:
        ans = cur_ans

print(ans)


Measured memory_bytes: 74176
#include <iostream>
#include <string>
#include <cstdlib>
#include <vector>
#include <array>
#include <map>
#include <algorithm>
#include <queue>
#include <stack>

using namespace std;
typedef long long int ll;

int main()
{
    char a[3];
    for (ll i = 0; i < 3; i++)
    {
        cin >> a[0] >> a[1] >> a[2];
        cout << a[i];
    }

    cout << endl;
}

Measured memory_bytes: 256
# Hopcroft-Karp Algorithm
from collections import deque
class HopcroftKarp:
    def __init__(self, N0, N1):
        self.N0 = N0
        self.N1 = N1
        self.N = N = 2+N0+N1
        self.G = [[] for i in range(N)]
        for i in range(N0):
            forward = [2+i, 1, None]
            forward[2] = backward = [0, 0, forward]
            self.G[0].append(forward)
            self.G[2+i].append(backward)
        self.backwards = bs = []
        for i in range(N1):
            forward = [1, 1, None]
            forward[2] = backward = [2+N0+i, 0, forward]
            bs.append(backward)
            self.G[2+N0+i].append(forward)
            self.G[1].append(backward)

    def add_edge(self, fr, to):
        #assert 0 <= fr < self.N0
        #assert 0 <= to < self.N1
        v0 = 2 + fr
        v1 = 2 + self.N0 + to
        forward = [v1, 1, None]
        forward[2] = backward = [v0, 0, forward]
        self.G[v0].append(forward)
        self.G[v1].append(backward)

    def bfs(self):
        G = self.G
        level = [None]*self.N
        deq = deque([0])
        level[0] = 0
        while deq:
            v = deq.popleft()
            lv = level[v] + 1
            for w, cap, _ in G[v]:
                if cap and level[w] is None:
                    level[w] = lv
                    deq.append(w)
        self.level = level
        return level[1] is not None

    def dfs(self, v, t):
        if v == t:
            return 1
        level = self.level
        for e in self.it[v]:
            w, cap, rev = e
            if cap and level[v] < level[w] and self.dfs(w, t):
                e[1] = 0
                rev[1] = 1
                return 1
        return 0

    def flow(self):
        flow = 0
        G = self.G
        bfs = self.bfs; dfs = self.dfs
        while bfs():
            *self.it, = map(iter, G)
            while dfs(0, 1):
                flow += 1
        return flow

    def matching(self):
        return [cap for _, cap, _ in self.backwards]

N=int(input())
pro=HopcroftKarp(N,N)
point0=[]
for i in range(0,N):
    a,b=map(int,input().split())
    point0.append((a,b))

point1=[]
for i in range(0,N):
    c,d=map(int,input().split())
    point1.append((c,d))

for i in range(0,N):
    for j in range(0,N):
        a,b=point0[i]
        c,d=point1[j]
        if a<c and b<d:
            pro.add_edge(i,j)

print(pro.flow())

Measured memory_bytes: 45164
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
  ll N,K;
  cin>>N>>K;
  vector<ll>X(N);
  ll chk=0;
  bool flag=true;
   ll min=1000000000;
  cin>>X[0];
ll num=X[0];
  ll change=0;
  ll unko=0;
  ll zero=0;
  
 
  for(ll i=1;i<N;i++){
    cin>>X[i];
    
    if(i>=1&&X[i]>=0&&X[i-1]<0){//符号の変わり目があった場合記録
      num=X[i];
      chk=i;
      change++;
    }
    if(X[i]==0){//配列にゼロが含まれてた場合
      zero++;
    }

  }

  
  if(X[0]>=0&&X[N-1]>=0&&change==0){//X配列全てが正
    cout<<X[K-1]<<endl;
    flag=false;
  }
  
  else if(X[N-1]<0&&change==0){//X配列が全て負
    cout<<abs(X[N-K])<<endl;
    flag=false;
   
  }

  else{//途中で符号が変わる場合
    for(ll i=N-1;i>=K-1;i--){//iは範囲の一番上
      ll ans=min;
      if(i-chk+1>K||i<chk){//範囲の中に原点が含まれない場合
    unko++;
      }
      else if(i-K+1<=chk&&i>=chk){//範囲の中に原点が含まれる場合
        if(X[i]>abs(X[i-K+1])){
          ans=X[i]+2*abs(X[i-K+1]);
          }
          else{
            ans=abs(X[i-K+1])+2*X[i];
          }
          }

      
      if(ans<min){//最小値の判定
        min=ans;
      }
    }
  
}
  
  if(flag){
  cout<<min<<endl;
  }

 
}


Measured memory_bytes: 1024
#include<cstdio>
#include<iostream>
#include<cstring>
#include<algorithm>
#include<stack>
#include<map>
#include<queue>
#include<vector>
#include<cmath>
#include<set>
#define inf 0x3f3f3f3f
typedef long long ll;

const int maxn=1e5+5;

using namespace std;

ll h,w;

int main()
{
    scanf("%lld%lld",&h,&w);
    if(h==1||w==1)
        printf("1\n");
    else if(h%2==1&&w%2==1)
        printf("%lld\n",h*w/2+1);
    else
        printf("%lld\n",h*w/2);
}


Measured memory_bytes: 256
import java.io.InputStream;
import java.io.PrintStream;
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        solve(System.in, System.out);
    }

    static void solve(InputStream is, PrintStream os) {
        // Your code here!
        Scanner scan = new Scanner(is);
        int K = scan.nextInt();
        String S = scan.next();
        if(S.length() <= K){
            os.println(S);
            return;
        }

        os.println(S.substring(0,K)+"...");

    }

}

Measured memory_bytes: 27080
#include <cstdio>

int main()
{
	int A = 1, B = 1;
	scanf("%d", &A);
	scanf("%d", &B);

	if (A > 8 || B > 8)
	{
		printf(":(\n");
	}
	else
	{
		printf("Yay!\n");
	}
	return 0;
}

Measured memory_bytes: 128
#include<stdio.h>
int main(){
  char s[4],equ[10];
  scanf("%s",s);
  int i,j;
  for(i=0;i<4;i++)
    equ[2*i]=s[i];
  equ[7]='=';
  equ[8]='7';
  for(i=0;i<8;i++){
    int n=i,sum=s[0]-'0';
    for(j=1;j<=3;j++){
      if(n%2==0){
        sum+=s[j]-'0';
        equ[2*j-1]='+';
      }
      else{
        sum-=s[j]-'0';
        equ[2*j-1]='-';
      }
      n/=2;
    }
    if(sum==7){
      for(j=0;j<9;j++)
        printf("%c",equ[j]);
      return 0;
    }
  }
  return 0;
}


Measured memory_bytes: 128
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int n = sc.nextInt();
		if (n == 0) {
			System.out.println(x);
			System.exit(0);
		}
		List<Integer> list = new ArrayList<>();
		for (int i = 0; i < n; i++) {
			list.add(sc.nextInt());
		}
		boolean bool = true;
		int i = 0;
		while (bool) {
			if (!list.contains(x - i)) {
				bool = false;
				System.out.println(x - i);
				break;
			}
			if (!list.contains(x + i)) {
				bool = false;
				System.out.println(x + i);
				break;
			}
			i++;
		}
	}
}

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

int main()
{
    int64_t n, l;
    cin >> n >> l;
    int64_t a[n];
    for (auto &i : a)
    {
        cin >> i;
    }
    int p = -1;
    for (int i = 0; i < n - 1; i++)
    {
        if (l <= a[i] + a[i + 1])
        {
            p = i;
            break;
        }
    }
    if (p == -1)
    {
        cout << "Impossible" << endl;
        return 0;
    }
    cout << "Possible" << endl;
    for (int i = 1; i <= p; i++)
    {
        cout << i << endl;
    }
    for (int i = n - 1; p + 2 <= i; i--)
    {
        cout << i << endl;
    }
    cout << p + 1 << endl;
    return 0;
}

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

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

int main() {
    int a, b;
    
    cin >> a >> b;
    a = gcd(a, b);
    cout << a << endl;
    
    return 0;
}


Measured memory_bytes: 3136
#include <bits/stdc++.h>
using namespace std;
char a [100][101] , b [102][102];
int main () {
  int n,m,c;
  cin>>n>>m;
  vector<int>a(2*m);
  for(int i=0;i<2*m;i++){
    cin>>a.at(i);
  }
  for(int i=1;i<=n;i++){
    c=0;
     for(int j=0;j<2*m;j++){
      if(i==a.at(j)){
        c++;
      }
     }
  cout<< c <<endl;
  }
}

	

Measured memory_bytes: 3596
// Template Headers {{{
#include <bits/stdc++.h>
using namespace std;

using pii = pair<int, int>; using vpii = vector<pii>;
using vi = vector<int>; using vvi = vector<vi>;
using ll = long long;
using pll = pair<ll, ll>; using vpll = vector<pll>;
using vll = vector<long long>; using vvll = vector<vll>;
template <class T> using min_queue = priority_queue<T, vector<T>, greater<T>>;
template <class T> istream &operator>>(istream &, vector<T> &);
template <class T> ostream &operator<<(ostream &, const vector<T> &);
template <class T, class U> istream &operator>>(istream &, pair<T, U> &);
template <class T, class U> ostream &operator<<(ostream &, const pair<T, U> &);
template <class T> struct Inf { static constexpr T inf() { return std::numeric_limits<T>::has_infinity ? std::numeric_limits<T>::infinity() : std::numeric_limits<T>::max(); } };
template <> struct Inf<int> { static constexpr int inf() { return 0x3f3f3f3f; } };
template <> struct Inf<long long> { static constexpr long long inf() { return 0x3f3f3f3f3f3f3f3fLL; } };
constexpr int INF = Inf<int>::inf(); constexpr ll BINF = Inf<ll>::inf();
// mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
// }}}
// Preprocessing & "Global" variables {{{
struct Solver {
	Solver() {}
	int solve();
};
// }}}

int Solver::solve() {
	int n; cin >> n;
	switch (n % 10) {
		case 2:
		case 4:
		case 5:
		case 7:
		case 9:
			cout << "hon" << endl;
			break;
		case 0:
		case 1:
		case 6:
		case 8:
			cout << "pon" << endl;
			break;
		case 3:
			cout << "bon" << endl;
			break;
	}
	return 0;
}

// Template Main {{{
int main() {
	ios::sync_with_stdio(0); cin.tie(0);
	Solver solver;
	#ifdef JUDGE_MULTI_CASE
		int t; cin >> t; for (int i = 1; i <= t; i++)
	#endif
	solver.solve();
	// cout << "Case #" << i << ": ", solve();
	return 0;
}

template <class T> istream &operator>>(istream &is, vector<T> &v) {
	for (auto it=v.begin();it!=v.end();++it) is >> *it;
	return is;
}

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

template <class T, class U> istream &operator>>(istream &is, pair<T, U> &p) {
	return is >> p.first >> p.second;
}

template <class T, class U> ostream &operator<<(ostream &os, const pair<T, U> &p) {
	return os << p.first << ' ' << p.second;
}
// }}}

// vim: fdm=marker


Measured memory_bytes: 3640
// problem: "https://atcoder.jp/contests/tenka1-2019-beginner/tasks/tenka1_2019_a"

#include<iostream>

using namespace std;

int main()
{
    int a,b,c;

    cin>>a>>b>>c;

    if(c>min(a,b) && c<max(a,b))
        cout<<"Yes";
    else
        cout<<"No";
        
    return 0;
}


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

int main() {
    string s, t;
    cin >> s;
    cin >> t;
    s += s;
    int x = s.find(t);
    if (x == -1) {
        cout << "No" << endl;
    }else{
        cout << "Yes" << endl;
    }
    return 0;
}


Measured memory_bytes: 3208
package main

import (
	"fmt"
)

func main() {
	var s string
	fmt.Scan(&s)

	if (s[0] == s[1] && s[0] == s[2] && s[1] == s[2]) || (s[1] == s[2] && s[2] == s[3] && s[1] == s[3]) {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}


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


public class Main {

	static Scanner sc = new Scanner( System.in );
	
	public static void main(String[] args) {
		
		String str[] = sc.nextLine().split(" ");
		
		String word[] = new String[str.length];
		int word_count[] = new int[str.length];
		Arrays.fill(word_count, 0);
		
		for (int i=0; i < str.length; i++) {
			
			boolean flag = false;
			
			for( int j=0; j < word.length; j++ ) {
				if ( str[i].equals(word[j]) ) {
					word_count[j]++;
					flag = true;
				}
			}
			
			if ( !flag ) {
				word[i] = str[i];
				word_count[i]++;
			}
		}
		
		int most=0, longest=0;
		int max = Integer.MIN_VALUE;
		int word_length = Integer.MIN_VALUE;
		for ( int i=0; i < word_count.length; i++ ) {
			if ( max < word_count[i] ){
				max = word_count[i];
				most = i;
			}

			if ( word[i] != null ) {
				if ( word_length < word[i].length() ) {
					longest = i;
					word_length = word[i].length();
				}
			}
		}
		
		System.out.println( word[most] + " " + word[longest] );

	}
}

Measured memory_bytes: 17132
#include<bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep2(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define rep_inv(i, n, m) for(int i = (int)(n); i > (int)(m); i--)
using namespace std;
using ll = long long;
using vl = vector<ll>;
using vc = vector<char>;
using vvl = vector<vl>;
using vvc = vector<vc>;
using pll = pair<ll, ll>;
using vpll = vector<pll>;

string fail = "UNRESTORABLE";

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

  if(T.size() > Sd.size()){
    cout << fail << endl;
    return 0;
  }

  ll head = -1;
  
  rep_inv(h, Sd.size() - T.size(), -1){
    bool match = true;

    rep(i, T.size()){
      if((Sd[h + i] != '?') && (Sd[h + i] != T[i])){
        match = false;
        break;
      }
    }

    if(match){
      head = h;
      break;
    }
  }

  if(head == -1){
    cout << fail << endl;
    return 0;
  }

  if(head > 0){
    rep(i, head){
      if(Sd[i] != '?') cout << Sd[i];
      else cout << 'a';
    }
  }
  rep(i, T.size()){
    cout << T[i];
  }
  if(head + T.size() < Sd.size()){
    rep2(i, head + T.size(), Sd.size()){
      if(Sd[i] != '?') cout << Sd[i];
      else cout << 'a';
    }
  }

  cout << endl;
  
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <stack>
#include <queue>
#define MOD 1000000007
typedef long long ll;
using namespace std;

int main() {
    int n, k;
    cin >> n >> k;
    
    vector<int> p(n);
    for(int i = 0; i < n; i++) {
        cin >> p[i];
    }
    
    vector<int> save;
    int tmp = 0;
    for(int i = 1; i <= 1000; i++) {
        tmp += i;
        save.push_back(tmp);
    }
    
    vector<long double> v(n);
    for(int i = 0; i < n; i++) {
        v[i] = save[p[i] - 1] / (long double)p[i];
    }
    
    vector<long double> sum(n + 1, 0);
    for(int i = 1; i < n + 1; i++) {
        sum[i] = sum[i - 1] + v[i - 1];
    }
    
    long double ans = 0.0;
    for(int i = 0; i < n + 1 - k; i++) {
        ans = max(ans, sum[i + k] - sum[i]);
    }
    
    cout << setprecision(10) << ans << endl;
    
    return 0;
}


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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
const ull mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

template < typename T >
void vprint(T &v){
	REP(i, v.size()){
		cout << v[i] << " ";
	}
	cout << endl;
}

int main(){
	ll N, T, A;
	cin >> N >> T >> A;
	vector<ll> H(N);
	REP(i, N) cin >> H[i];

	double res = 10000000.0;
	ll ind;
	REP(i, N){
		double sa = abs(A - (T - H[i]*0.006));
		if (sa < res){
			res = sa;
			ind = i;
		}
	}
	cout << ind+1 << endl;
    return 0;
}

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

#pragma GCC optimize("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;

typedef long long ll;
typedef pair<ll, ll> pll;
typedef vector<long long> vll;
typedef vector<vector<long long>> vvll;
typedef map<ll, vector<ll>> mll;
typedef unordered_map<ll, vector<ll>> ull;

#define pb push_back
#define ff first
#define ss second
#define all(v) (v).begin(),(v).end()
#define rep(i, a, b) for(ll i = a; i < b ; i++)
#define repr(i, a, b) for(ll i = a; i >= b ; --i)
#define distinct(v) v.erase(unique(v.begin(), v.end()), v.end());
#define delt(v, x) (v).erase(std::remove((v).begin(), (v).end(), x), (v).end())
#define MAX 200010
#define INF 1000000007
const ll MAXN = 1e5 + 5;

void dfs(int u, int par, vector<bool> &v, unordered_map<int, vector<int>> g) {
    if (!v[u]) {
        v[u] = true;
        for (auto i:g[u]) {
            if (!v[i] && i != par)dfs(i, u, v, g);
        }
    }
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    int a, b;
    cin >> a >> b;
    cout << max(a - 2 * b, 0) << endl;
    return 0;
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <cstdlib>  // abs() for integer 絶対値求めやつ
#include <cmath>    // abs() for float, and fabs()
#include <algorithm>
#include <vector>
#include <string>
#define rep(i,n) for(int i = 0; i< (n);i++)
#define SORT(a) sort((a).begin(),(a).end());
#define che(a,string) cout<<string<<":"<<(a)<<endl;
#define ch(a,string) cout<<string<<":"<<(a)<<" ";
using namespace std;
typedef pair<int,int> p;
int main(){
  int n,d,x;
  cin>>n>>d>>x;
  vector<int> A(n);
  rep(i,n){
	  cin>>A[i];
	}
  int ans = n;
  rep(i,n){
  int day = 1;
	  while(1){
		  day+=A[i];
		  if(day<=d){
			  ans++;
			}
			else{
				break;
			  }
		}
	}
	cout<<ans+x<<endl;
}	


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


int main() {
  string a,b; cin >> a >> b;
  int x = stoi(a+b);
  rep(i,1000) {
    if (i*i == x) {
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;

  return 0;
}

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

int main(int argc, char *argv[])
{
    int a, b;
    while(true)
    {
        cin >> a >> b;
        if (a == 0 && b == 0) break;
        if (a > b) cout << b << " " << a << endl;
        else cout << a << " " << b << endl;
    }
}


Measured memory_bytes: 3104
from sys import stdin


def readline_from_stdin() -> str:
    return stdin.readline().rstrip


if __name__ == '__main__':
    L, R, d = input().split()
    L, R, d = int(L), int(R), int(d)

    print(len([v for v in range(L, R+1) if v % d == 0]))


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

int main(int argc, const char * argv[]) {
    int W,H,N;
    cin >> W >> H >> N;
    int xMax = W;
    int yMax = H;
    int xMin = 0;
    int yMin = 0;
    int a[N][3];
    for(int i=0; i<N; i++){
        scanf("%d %d %d", &a[i][0], &a[i][1], &a[i][2]);
    }
//    for(int i=0;i<N;i++){
//        int x,y,a;
//        cin >> x >> y >> a;
//        if(a == 1){
//            X[0] = x;
//        }else if(a == 2){
//            X[1] = x;
//        }else if(a == 3){
//            Y[0] = y;
//        }else{
//            Y[1] = y;
//        }
//    }
    for(int i=0;i<N;i++){
//        int x,y,a;
//        cin >> x >> y >> a;
        if(a[i][2] == 1){
            xMin = max(xMin,a[i][0]);
        }else if(a[i][2] == 2){
            xMax = min(a[i][0],xMax);
        }else if(a[i][2] == 3){
            yMin = max(a[i][1],yMin);
        }else if(a[i][2]==4){
            yMax = min(yMax,a[i][1]);
        }
    }
    
//    int width = X[1] - X[0];
//    int height = Y[1] - Y[0];
//    int ans = width*height;
    int width = xMax - xMin;
    int height = yMax - yMin;
    int ans = width*height;
    if(width<=0 || height <=0){
        cout << 0 << endl;
    }else{
        cout << ans << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
using namespace std;
int M,D,Ans;
int main(){
	scanf("%d%d",&M,&D);
	for(int i=4;i<=M;i++){
		for(int j=1;j<=D;j++){
			int a=j/10,b=j%10;
			if(a>=2&&b>=2)
				Ans+=(a*b==i);
		}
	}
	printf("%d\n",Ans);
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mod 1000000007
#define MAX 100000
void inarray(int a[], int n){
    for(int i = 0; i < n; i++) cin >> a[i];
}

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

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

public class Main {

    public static void main(String[] args) {
	    // input N D \n x11 x12 ... x1d \n x21 x22 ... x2d
        Scanner sc = new Scanner(System.in);
        int numPoint = sc.nextInt();
        int numDim = sc.nextInt();
        int resTuppleNum = 0;
        ArrayList<ArrayList<Integer>> dimArrayList = new ArrayList<>();
        for(int i = 0; i < numPoint; i++){
            ArrayList<Integer> posArrayList = new ArrayList<>();
            for(int j = 0; j < numDim; j++){
                posArrayList.add(sc.nextInt());
            }
            dimArrayList.add(posArrayList);
        }
        for(int i = 0; i < numPoint; i++){
            for(int j = i + 1; j < numPoint; j++){
                double sumPointDistance = 0;
                for(int k = 0; k < numDim; k++){
                    sumPointDistance += Math.pow(dimArrayList.get(i).get(k) - dimArrayList.get(j).get(k), 2);
                }
                if(isRegularNum(String.valueOf(Math.sqrt(sumPointDistance)))){
                    resTuppleNum++;
                }
            }
        }
        System.out.println(resTuppleNum);
    }

    public static boolean isRegularNum(String num){
        double regNum = Double.parseDouble(num.substring(0, num.indexOf(".")));
        if(String.valueOf(regNum).equals(num)){
            return true;
        } else {
            return false;
        }
    }
}


Measured memory_bytes: 23124
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vll = vector<long long>;
using vp = vector<pair<int, int>>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using vvll = vector<vector<long long>>;
template<class T> inline bool chmax(T &a, T b) { if (a<b) {a=b; return 1;} return 0;}
template<class T> inline bool chmin(T &a, T b) { if (b<a) {a=b; return 1;} return 0;}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    string s, t;
    cin >> s >> t;
    int n = sz(s);
    bool ans = true;
    rep(i, n) {
        if (s[i] != t[i]) ans = false;
    }
    cout << (ans ? "Yes" : "No") << endl;
}

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

using namespace std;

int main() {
	int n;
	while (cin >> n) {
		if (n == 0) {
			break;
		}
		int dd[55][33] = { 0 };
		int d2[55][55] = { 0 };
		int f, d;
		for (int i = 0; i < n; i++) {
			cin >> f;
			for (int j = 0; j < f; j++) {
				cin >> d;
				dd[i][d] = 1;
			}
			d2[i][i] = 1;
		}
		int ans = -1;
		for (int i = 1; i <= 30; i++) {
			int aa[55] = { 0 };
			for (int j = 0; j < n; j++) {
				if (dd[j][i] == 1) {
					for (int k = 0; k < n; k++) {
						if (d2[j][k] == 1) {
							aa[k] = 1;
						}
					}
				}
			}
			int sum = 0;
			for (int j = 0; j < n; j++) {
				sum += aa[j];
			}
			if (sum == n) {
				ans = i;
				break;
			}
			else {
				for (int j = 0; j < n; j++) {
					if (dd[j][i] == 1) {
						for (int k = 0; k < n; k++) {
							d2[j][k] = aa[k];
						}
					}
				}
			}
		}
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 3016
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
#define mrep(i,j,n) for(int i = j; i < n; i++)
#define reps(i,n) for(int i = 1; i <= n; i++)
#define rrep(i,n) for(int i = n-1; i >= 0; i--)
#define rreps(i,n) for(int i = n; i >= 1; i--)
#define co(x) cout << x <<endl
#define cs(x) cout << x <<" "
#define cer(x) cerr << x <<endl
#define ALL(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define ERASE(x,val) x.erase(remove(ALL(x), val), x.end())
#define pb push_back

typedef long long ll;
typedef unsigned long long ull;
using namespace std;
ll mod = 1e9 + 7;
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; }

int main()
{
	int n; cin >> n;
	vector<int> d(n);
	rep(i, n)cin >> d[i];
	int t = 0;
	int sum = 0;
	rep(i,n)
	{
		mrep(j,i+1,n)
		{
			t = d[i] * d[j];
			sum = sum + t;
		}
	}
	co(sum);
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;

void __print(int x) { cerr << x; }
void __print(long x) { cerr << x; }
void __print(long long x) { cerr << x; }
void __print(unsigned x) { cerr << x; }
void __print(unsigned long x) { cerr << x; }
void __print(unsigned long long x) { cerr << x; }
void __print(float x) { cerr << x; }
void __print(double x) { cerr << x; }
void __print(long double x) { cerr << x; }
void __print(char x) { cerr << '\'' << x << '\''; }
void __print(const char *x) { cerr << '\"' << x << '\"'; }
void __print(const string &x) { cerr << '\"' << x << '\"'; }
void __print(bool x) { cerr << (x ? "true" : "false"); }

template <typename T, typename V>
void __print(const pair<T, V> &x) {
    cerr << '{';
    __print(x.first);
    cerr << ',';
    __print(x.second);
    cerr << '}';
}
template <typename T>
void __print(const T &x) {
    int f = 0;
    cerr << '{';
    for (auto &i : x) cerr << (f++ ? "," : ""), __print(i);
    cerr << "}";
}
void _print() { cerr << "]\n"; }
template <typename T, typename... V>
void _print(T t, V... v) {
    __print(t);
    if (sizeof...(v)) cerr << ", ";
    _print(v...);
}
#ifdef LOCAL
#define debug(x...)               \
    cerr << "[" << #x << "] = ["; \
    _print(x)
#else
#define debug(x...)
#endif

#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

typedef long long ll;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int N;
    cin >> N;
    vector<double> A(N);
    rep(i, N) {
        double tmp;
        cin >> tmp;
        A[i] = 1 / tmp;
    }
    double deno = accumulate(A.begin(), A.end(), 0.0);
    debug(A, deno);
    cout << setprecision(20) << 1/deno << endl;
    return 0;
}


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

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

int main(void){

    int k; cin >> k;
    string s; cin >> s;

    if(s.size() > k){
        rep(i, k){
            cout << s.at(i);
        }
        cout << "...\n";
    } else {
        cout << s << endl;
    }

    return 0;
}

Measured memory_bytes: 3560