akhauriyash/Code-Regression huggingface dataset:
package main
import . "fmt"
// github.com/EndlessCheng/codeforces-go
func main() {
	c,n,s:=map[string]int{},0,""
	for Scan( &n); n > 0; n-- {
		Scan( &s)
		c[s]++
	}
	for _, s := range []string{"AC","WA","TLE","RE"} {
		Println(s,"x",c[s])
	}
}


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

using namespace std;

int main() {
  //
  int X, Y, Z, K;
  cin >> X >> Y >> Z >> K;
  vector<long long> A(X), B(Y), C(Z);
  for (int i = 0; i < X; ++i) cin >> A[i];
  for (int i = 0; i < Y; ++i) cin >> B[i];
  for (int i = 0; i < Z; ++i) cin >> C[i];


  //
  vector<long long> buf(X * Y);
//  int b = 0;
  for (int i = 0; i < X; ++i) {
    for (int j = 0; j < Y; ++j) {
      buf.push_back(A[i] + B[j]);
//      buf[b++] = A[i] + B[j];
    }
  }

  sort(buf.begin(), buf.end(), greater<long long >());
  vector<long long> buf2(K * Z);
//  b = 0;
  for (int i = 0; i < K; ++i) {
    for (int j = 0; j < Z; ++j) {
//      buf2[b++] = buf[i] + C[j];
      buf2.push_back(buf[i] + C[j]);
    }
  }

  sort(buf2.begin(), buf2.end(), greater<long long >());
  for (int i = 0; i < K; ++i) {
//  for (int i = 0; i < buf2.size(); ++i) {
    cout << buf2[i] << endl;
  }




  return 0;
}

Measured memory_bytes: 64760
#include <bits/stdc++.h>
  
using namespace std;
  
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define repr(i, n) REPR(i, n, 0)
#define REPR(i, s, e) for(int i=(int)(s-1); i>=(int)(e); i--)
#define pb push_back
#define all(r) r.begin(),r.end()
#define rall(r) r.rbegin(),r.rend()
#define fi first
#define se second
  
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
const int INF = 1e9;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;

int main(){
	int n;
	cin >> n;
	vi a(n);
	rep(i, n) cin >> a[i];
	vi b;
	b.pb(a[0]);
	REP(i, 1, n) {
		if(b.back() != a[i]) b.pb(a[i]);
	}
	if(b.size() == 1) {
		cout << 1 << endl;
		return 0;
	}
	vi c;
	c.pb(b[0] < b[1]);
	int idx = 1;
	while(idx+1 < b.size()) {
		if((b[idx+1] > b[idx])^c.back()) {
			if(idx+2 >= b.size()) {
				c.pb(0);
				break;
			}
			c.pb(b[idx+2] > b[idx+1]);
			idx++;
		}
		idx++;
	}	
	cout << c.size() << endl;
	return 0;
}

Measured memory_bytes: 1400
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>

using namespace std;

typedef long long int ll;

const ll MOD = 1000000007;

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

  int N;
  cin >> N;
  vector<int> a(N);
  for (auto &x: a) cin >> x;

  map<int, int> bucket;
  for (auto &x: a) bucket[x]++;

  if (bucket.size() == 1) {
    int num = 0, count = 0;
    for (auto &x: bucket) num = x.first, count = x.second;
    if (num == 0) cout << "Yes" << endl;
    else cout << "No" << endl;
  }
  else if (bucket.size() == 2) {
    vector<int> num, count;
    for (auto x: bucket) {
      num.push_back(x.first);
      count.push_back(x.second);
    }
    if (num[0] != 0) cout << "No" << endl;
    else if (count[0] * 2 >= count[1] && count[1] % 2 == 0) cout << "Yes" << endl;
    else cout << "No" << endl;
  }
  else if (bucket.size() == 3) {
    vector<int> num, count;
    for (auto x: bucket) {
      num.push_back(x.first);
      count.push_back(x.second);
    }
    if (count[0] != count[1] || count[1] != count[2]) cout << "No" << endl;
    else if ((num[0] ^ num[1]) == num[2]) cout << "Yes" << endl;
    else cout << "No" << endl;
  }
  else cout << "No" << endl;

  return 0;
}


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

#define REP(i,n) for(int i=0; i < (n); ++i)
#define REPR(i,n) for(int i=(n); i >= 0; --i)
#define FOR(i, m, n) for(int i = (m); i < (n); ++i)

typedef long long ll;



int main(){
  int N, M;
  cin >> N >> M;
  vector<int> A(N), B(M), C(M);;
  vector<pair<int, int>> p(M);
  priority_queue<int, vector<int>, greater<int>> pq;
  ll ans = 0;

  REP(i, N){
    cin >> A[i];
    pq.push(A[i]);
    ans += A[i];
  }
  REP(i, M){
    cin >> B[i] >> C[i];
    p[i] = make_pair(C[i], B[i]);
  }
  sort(p.begin(), p.end());
  int cnt = 0;
  for(int i = 0; (i < M )&& (cnt <= N); ++i){
    REP(j, p[M-1-i].second){
      int x = pq.top();
      if(x < p[M-1-i].first){
        pq.pop();
        pq.push(p[M-1-i].first);
        ans = ans - x + p[M-1-i].first;
        cnt++;
      }
      else{
        break;
      }
    }
  }
  cout << ans << endl;
  
  return 0;
}


Measured memory_bytes: 2812
import java.util.ArrayDeque;
import java.util.BitSet;
import java.util.Deque;
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Deque<Integer> deque = new ArrayDeque<Integer>();
        StringBuilder sb = new StringBuilder();
        Scanner fs = new Scanner(System.in);
        int n = fs.nextInt();
        BitSet bitSet = new BitSet(2000);
        for(int i=0;i<n;i++){
            Integer m = fs.nextInt();
            bitSet.set(m);
            Object[] mm = deque.toArray();
            for (int j=0;j<mm.length;j++){
                int i1 = ((Integer) mm[j]) + m;
                bitSet.set(i1);
                deque.add(i1);
            }
            deque.add(m);
        }
        int q = fs.nextInt();
        for (int i=0;i<q;i++){
           sb.append( bitSet.get(fs.nextInt())?"yes\n":"no\n");
        }
        System.out.print(sb.toString());
    }

}



Measured memory_bytes: 56540
#[allow(unused_macros)]
macro_rules ! read_value {($ next : expr , ($ ($ t : tt ) ,* ) ) => {($ (read_value ! ($ next , $ t ) ) ,* ) } ; ($ next : expr , [$ t : tt ; $ len : expr ] ) => {(0 ..$ len ) . map (| _ | read_value ! ($ next , $ t ) ) . collect ::< Vec < _ >> () } ; ($ next : expr , chars ) => {read_value ! ($ next , String ) . chars () . collect ::< Vec < char >> () } ; ($ next : expr , usize1 ) => {read_value ! ($ next , usize ) - 1 } ; ($ next : expr , $ t : ty ) => {$ next () . parse ::<$ t > () . expect ("Parse error" ) } ; }
#[allow(unused_macros)]
macro_rules ! input_inner {($ next : expr ) => {} ; ($ next : expr , ) => {} ; ($ next : expr , $ var : ident : $ t : tt $ ($ r : tt ) * ) => {let $ var = read_value ! ($ next , $ t ) ; input_inner ! {$ next $ ($ r ) * } } ; }
#[allow(unused_macros)]
macro_rules ! input {(source = $ s : expr , $ ($ r : tt ) * ) => {let mut iter = $ s . split_whitespace () ; let mut next = || {iter . next () . unwrap () } ; input_inner ! {next , $ ($ r ) * } } ; ($ ($ r : tt ) * ) => {let stdin = std :: io :: stdin () ; let mut bytes = std :: io :: Read :: bytes (std :: io :: BufReader :: new (stdin . lock () ) ) ; let mut next = move || -> String {bytes . by_ref () . map (| r | r . unwrap () as char ) . skip_while (| c | c . is_whitespace () ) . take_while (| c |! c . is_whitespace () ) . collect () } ; input_inner ! {next , $ ($ r ) * } } ; }

fn solve(s: &Vec<char>) -> i32 {
    let n = s.len();

    let mut l = (n - 1) / 2;
    let mut r = n / 2;
    let center = s[l];

    if s[r] != center {
        return l as i32 + 1;
    }

    while l >= 0 && r < n && s[l] == center && s[r] == center {
        l -= 1;
        r += 1;
    }
    r as i32
}

fn main() {
    input! {
        s: String,
    }

    println!("{}", solve(&s.chars().collect()));

}


Measured memory_bytes: 2788
N=int(input())
count=0
ans =0
for j in range(N+1):
    count =0
    if j %2 ==0:
        continue
    for i in range(1,N+1):
        if j % i ==0:
            count +=1
        else:
            continue
    if count == 8:
        ans += 1
print(ans)

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

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

typedef long long LL;
typedef unsigned long UL;

using namespace std;

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

    string s;
    int k;

    cin >> s >> k;

    int i = 0;
    int j;
    long long int l = 0;

    while(1)
    {
        j = s[i] - '0';

        if (j != 1)
        {
            cout << j << endl;
            return 0;
        }
        else if (i == k - 1)
        {
            cout << 1 << endl;
            return 0;
        }

        ++i;
    }

    return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
#define EPS (1e-8)
using namespace std;
typedef complex<double> point;

vector<point> CrossPoints_CC(point a,double ra,point b,double rb){
  vector<point> res;
  b-=a;
  //if(abs(abs(b)-(ra+rb))>EPS)return res;
  double c=(ra+rb+abs(b))/2;
  c=2*sqrt(c*(c-ra)*(c-rb)*(c-abs(b)))/abs(b);
  double d=sqrt(ra*ra-c*c);

  double Cos = ( norm(b) + ra*ra - rb*rb ) / ( 2.0 * ra * abs(b)  );

  if(Cos < 0) d*=-1;

  res.push_back(point(d,c));
  res.push_back(point(d,-c));  
  for(int i=0;i<(int)res.size();i++)res[i]=res[i]*b/abs(b)+a;
  return res;
}


int main(){
  point c1,c2;
  double a,b,r1,r2;
  cin>>a>>b>>r1;
  c1=point(a,b);
  cin>>a>>b>>r2;
  c2=point(a,b);
  vector<point> ans=CrossPoints_CC(c1,r1,c2,r2);
  if(ans[0].real()>ans[1].real())swap(ans[0],ans[1]);
  if(ans[0].real()==ans[1].real())
    if(ans[0].imag()>ans[1].imag())swap(ans[0],ans[1]);
  for(int i=0;i<2;i++){
    if(i)cout<<' ';
    printf("%.8f %.8f",ans[i].real(),ans[i].imag());
  }
  cout<<endl;
  return 0;
}

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

#define rep(i,n) for(long long int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(long long int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(long long int i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define pb(q) push_back(q)
#define P pair<int,int>
#define Abs(a,b) max(a,b)-min(a,b)
#define YES(condition) if(condition){cout << "YES" << endl;}else{cout << "NO" << endl;}
#define Yes(condition) if(condition){cout << "Yes" << endl;}else{cout << "No" << endl;}
#define Cout(x) cout<<(x)<<endl

typedef long long ll;

using namespace std;

const int INF = 1e9,MOD = 1e9 + 7;
const ll LINF = 1e18;

//while(x!=0){
            //sum+=x%10;
           // x/=10;
        //}
        //各桁の和

//pair<int,int> p[100000];
//P r[100000];
//cin >> tmp;
//p[i]=make_pair(tmp,i);
//cout << p[i].second+1 << endl;//ペアの右側つまりiを出力

//s.find(w[i])==string::npos
//findの使い方

//for(int i=0;i<n;i++){
   // b[i]=x%2;
    //x/=2;
  //}二進数

long long int n,cnt=0,ans=0,a[25],b,c,cmp,cmpp,k,m,h,w,x,y,sum=0,pos;

string s;

vector<int> z;

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

   cin >> s;
   h=s.size();
   for(int bit=0;bit<(1<<(h-1));bit++){
       sum=0;m=0;
       rep(i,h){
           m=10*m+s[i]-'0';
           if(bit & (1<<i) || i==h-1){
               sum+=m;
               m=0;
           }
       }
       ans+=sum;
   }
   Cout(ans);
return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2e5+10;
vector<int>g[MAXN];
int ans[MAXN];
void bfs() {
    queue<int> q;
    q.push(1);
    ans[1] = 1;
    while (!q.empty()) {
        int u = q.front();
        q.pop();
        for (int i=0;i<g[u].size();i++)
		 {  int v=g[u][i];
            if (0==ans[v]) {
                q.push(v);
                ans[v] = u;
            }
        }
    }
}
 
int main() {
    int n,m;
   cin>>n>>m;
    for (int i=0; i<m; i++) {
        int u, v;
       cin>>u>>v;
        g[u].push_back(v);
        g[v].push_back(u);
    }
 
    bfs();
    for (int i=2; i<=n; i++) {
        if (0==ans[i]) {
            cout<<"No"<<endl;
            return 0;
        }
    }
    cout<<"Yes"<<endl;
    for (int i=2; i<=n; i++) {
        cout<<ans[i]<<endl;
    }
    return 0;
}

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

int main(void){
	int N;
	cin >> N;
	long count[100001] = {0};
	int a;
	for (int i = 0; i < N; i++) {
		cin >> a;
		count[a]++;
	}
	long long tot = 0;
		for (int j = 1; j <= 1e5; j++) {
			tot += count[j]*j;
		}
	int Q;
	cin >> Q;
	int b, c;
	for (int i = 0; i < Q; i++) {
		cin >> b >> c;
		count[c] += count[b];
		tot = tot - b*count[b] + c*count[b];
		count[b] = 0;
		cout << tot << endl;
	}

	return 0;
}

Measured memory_bytes: 4352
class Dice:
    def __init__(self):
        self.side = {"top": 0, "front": 0, "right": 0, "left": 0, "back": 0, "bottom": 0}

    def roll(self, direction):
        self.direction = direction
        if self.direction == "N":
            w = self.side["top"]
            self.side["top"] = self.side["front"]
            self.side["front"] = self.side["bottom"]
            self.side["bottom"] = self.side["back"]
            self.side["back"] = w
        elif self.direction == "S":
            w = self.side["top"]
            self.side["top"] = self.side["back"]
            self.side["back"] = self.side["bottom"]
            self.side["bottom"] = self.side["front"]
            self.side["front"] = w
        elif self.direction == "E":
            w = self.side["top"]
            self.side["top"] = self.side["left"]
            self.side["left"] = self.side["bottom"]
            self.side["bottom"] = self.side["right"]
            self.side["right"] = w
        elif self.direction == "W":
            w = self.side["top"]
            self.side["top"] = self.side["right"]
            self.side["right"] = self.side["bottom"]
            self.side["bottom"] = self.side["left"]
            self.side["left"] = w

dice = Dice()
for s, n in zip(dice.side, input().split()):
    dice.side[s] = n

for direction in input():
    dice.roll(direction)
print(dice.side["top"])



Measured memory_bytes: 5576
def main():
    n=int(input())
    s=input()
    cnt=0
    for i in range(1000):
        i="".join(["00",str(i)])[-3:]
        now=0
        char=i[0]
        for c in s:
            if char==c:
                if now<2:
                    now+=1
                    char=i[now]
                else:
                    cnt+=1
                    break
    print(cnt)
main()


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

using namespace std;

void hawawa()
{
  string str;
  cin >> str;
  reverse(str.begin(), str.end());
  string adds[] = {"dream", "dreamer", "erase", "eraser"};
  for (auto&& i : adds) {
    reverse(begin(i), end(i));
  }
  while (str.size()) {
    bool check = true;
    for (auto&& i : adds) {
      if (str.substr(0, i.size()) == i) {
        check = false;
        if (str.size() == i.size()) {
          str = "";
        } else {
          str = str.substr(i.size(), str.size() - i.size());
        }
      }
    }
    if (check) {
      break;
    }
  }
  if (str.size()) {
    cout << "NO\n";
  } else {
    cout << "YES\n";
  }
}

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

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
// マクロ
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
// 型エイリアス
using ll = long long;
using vi = vector<int>;
using vs = vector<string>;
using vvi = vector<vi>;
using vvs = vector<vs>;

int main() {
    int n;
    cin >> n;
    if (n%10 ==9 || n/10%10 == 9) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
vector<pair<int,int>> v1;
int main(){
    int n,c;
    cin>>n>>c;
    if(c>((n-1)*(n-2))/2){
        cout<<-1<<endl;
        return 0;
    }
    for(int i=2;i<=n;i++){
        v1.push_back(make_pair(1,i));
    }
    int diff = ((n-1)*(n-2))/2;
    diff-=c;
    while(diff){
        for(int i=2;i<n;i++){
            for(int j=i+1;j<=n;j++){
                v1.push_back(make_pair(i,j));
                diff--;
                if(!diff){
                    break;
                }
            }
            if(!diff){
                    break;
                }
        }
    }
    cout<<v1.size()<<endl;
    for(auto x:v1){
        cout<<x.first<<" "<<x.second<<endl;
    }
}

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

typedef long long int ll;
ll MOD = 1000000007;
ll INFL = 1ll << 60;
ll INF = 1 << 28;

// ====================================================================

int main() {
  int a,b,c;
  cin >> a >> b >> c;
  cout << min(a*b,c) << endl;
  
}


Measured memory_bytes: 256
S = input()
T = input()
smap = {}
tmap = {}
replaceS = []
replaceT = []
n = 'a'
for c in S:
  if c not in smap:
    smap[c] = n
    n = chr(ord(n)+1)
  replaceS.append(smap[c])

n = 'a'
for c in T:
  if c not in tmap:
    tmap[c] = n
    n = chr(ord(n)+1)
  replaceT.append(tmap[c])

if ''.join(replaceS) == ''.join(replaceT) \
  and len(smap.keys()) == len(tmap.keys()):
  print('Yes')
else:
  print('No')

Measured memory_bytes: 6960
#include <bits/stdc++.h>  
 
using namespace std;
 
#define FOR(i, j, k) for(int i = j; i < k; ++i)
#define rep(i, j) FOR(i, 0, j)
#define repr(i, j) for(int i = j; i >= 0; --i)
#define INF (1 << 30)
#define MOD 1e9 + 7
 
typedef long long ll;
typedef unsigned long long ull;
typedef pair<string, int> P;

map<string, int> goods;
map<string, int> mp;

int main() {
	int N;
	while(scanf("%d", &N), N) {
		rep(i, N) {
			string s;
			int price;
			cin >> s >> price;
			goods[s] = price; 
		}
		int M;
		scanf("%d", &M);
		rep(i, M) {
			string s;
			int num;
			cin >> s >> num;
			int sum = 0;
			rep(j, num) {
				string g;
				cin >> g;
				sum += goods[g];
			}
			if(sum < goods[s]) goods[s] = sum;
		}
		string ans;
		cin >> ans;
		cout << goods[ans] << endl;
	}
	return 0;
}

Measured memory_bytes: 3088
#include<bits/stdc++.h>
#define F first
#define S second
using namespace std;
typedef pair<int,int> P;//first=point second=num||first=time second=num
int N,r,l;
int d,t,x;
int n;
P team[100005];
P Seg[100005*2];
P Ttime[100005];
int top=0;
int btop=0;
int smin=-1;
int btime=0;
P Pmax(P a,P b);
void init(int n_);
void update(int k,int a);
P query(int a,int b,int k,int l,int r);
main(){
  cin>>N>>r>>l;
  for(int i=0;i<100005;i++){
    team[i].F=0;
    team[i].S=i+1;
    Ttime[i].F=0;
    Ttime[i].S=i+1;
  }
  init(N);
  for(int i=0;i<r;i++){
    cin>>d>>t>>x;
    Ttime[top].F+=t-btop;
    update(d-1,x);
    /*
    for(int i=n-1;i<2*n-1;i++){
      cout<<"|"<<Seg[i].F<<"|"<<Seg[i].S<<"| ";
    }
    */
    //cout<<endl;
    P tops;
    tops=query(0,n-1,0,0,n);
    top=tops.S;
    btop=t;
    int a=1;
  }
  Ttime[top].F+=l-btop;
  sort(Ttime,Ttime+N);
  /*
  for(int i=0;i<N;i++){
    cout<<Ttime[i].F<<"|"<<Ttime[i].S<<" ";
  }
  */
  //cout<<endl;
  cout<<Ttime[N-1].second<<endl;
}
void init(int n_){
  n=1;
  while(n<n_){
    n*=2;
  }
  for(int i=0;i<2*n-1;i++){
    Seg[i]=P(0,0);
  }
  for(int i=n-1;i<2*n-1;i++){
    Seg[i].S=i-(n-1);
  }
  return;
}
void update(int k,int a){
  k+=n-1;
  Seg[k].F+=a;
  if(Seg[k].F<smin){
    smin=Seg[k].F;
  }
  while(k>0){
    k=(k-1)/2;
    Seg[k]=Pmax(Seg[k*2+1],Seg[k*2+2]);
  }

  return;
}
P Pmax(P a,P b){
  if(a.F>b.F||(a.F==b.F&&a.S<b.S)){
    return a;
  }
  else{
    return b;
  }
}
P query(int a,int b,int k,int l,int r){
  if(r<=a||b<=l){
    return P(smin,100010);
  }
  if(a<=l&&r<=b){
    return Seg[k];
  }
  else{
    P vl=query(a,b,k*2+1,l,(l+r)/2);
    P vr=query(a,b,k*2+2,(l+r)/2,r);
    return Pmax(vl,vr);
  }
}

Measured memory_bytes: 4288
#include "iostream"
#include "algorithm"
#include "string"
#include "vector"
#include "cmath"
#include "bitset"
#include "queue"
#include "functional"
#include "map"
#include "unordered_map"

#define lp(n) for (int i = 0; i < n; i++)
#define LP(n,i) for (int i = 0; i < n; i++)
#define mod 1000000007
#define sp ' '
#define intmax 2147483647
#define llmax 9223372036854775807
#define nya_n "(=^･ω･^=)"
typedef long long ll;
using namespace std;


int n, k, l, p, q, r, s, cnt, ans[200000], mem;
vector<int>c[200000], t[200000];
pair<pair<int, int>, int>g[200001];
bool vtdc[200000], vtdt[200000];

int dfsc(int x) {
	lp(c[x].size()) {
		if (!vtdc[c[x][i]]) {
			vtdc[c[x][i]] = true;
			g[c[x][i]].first.first = mem;
			dfsc(c[x][i]);
		}
	}
	return 0;
}

int dfst(int x) {
	lp(t[x].size()) {
		if (!vtdt[t[x][i]]) {
			vtdt[t[x][i]] = true;
			g[t[x][i]].first.second = mem;
			dfst(t[x][i]);
		}
	}
	return 0;
}


int main() {
	int n, k, l;
	cin >> n >> k >> l;
	lp(k) {
		cin >> p >> q;
		c[p - 1].push_back(q - 1);
		c[q - 1].push_back(p - 1);
	}
	lp(l) {
		cin >> r >> s;
		t[r - 1].push_back(s - 1);
		t[s - 1].push_back(r - 1);
	}
	lp(n) {
		vtdc[i] = false;
		vtdt[i] = false;
		g[i].second = i;
	}
	lp(n) {
		if (!vtdc[i]) {
			mem = i;
			g[i].first.first = i;
			vtdc[i] = true;
			dfsc(i);
		}
	}
	lp(n) {
		if (!vtdt[i]) {
			mem = i;
			g[i].first.second = i;
			vtdt[i] = true;
			dfst(i);
		}
	}
	sort(g, g + n);
	g[n] = make_pair(make_pair(intmax, intmax), intmax);
	cnt = 1;
	mem = 0;
	lp(n) {
		if (g[i].first == g[i + 1].first) {
			cnt++;
		}
		else {
			for (int j = mem; j <= i; j++) {
				ans[g[j].second] = cnt;
			}
			mem = i + 1;
			cnt = 1;
		}
	}
//	lp(n)cout <<g[i].second<< sp << g[i].first.first << sp << g[i].first.second << endl;
	lp(n-1) {
		cout << ans[i] << sp;
	}
	cout << ans[n - 1] << endl;
	return 0;
}

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

using namespace std;

using ll = long long;
using Pi = pair<int, int>;
using Pl = pair<ll, ll>;
using Ti = tuple<int, int, int>;
using Tl = tuple<ll, ll, ll>;

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define F first
#define S second
#define Get(t, i) get<(i)>((t))
#define all(v) (v).begin(), (v).end()
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define reps(i, f, n) for(int i = (int)(f); i < (int)(n); i++)
#define each(a, b) for(auto& a : b)

const int inf = 1 << 25;
const ll INF = 1LL << 55;

int main()
{
  string s; cin >> s;
  bool alpha[30] = {false};
  int cnt = 0;
  int len = s.size();
  rep(i, len) {
    if(!alpha[s[i]-'a']) alpha[s[i]-'a'] = true, cnt++;
  }
  if(s[0] == s[len-1]) len--;
  if(cnt < 3) cout << "Second" << endl;
  else cout << (len % 2 == 0 ? "Second" : "First") << endl;
  return 0;
}


Measured memory_bytes: 640
import java.util.*;

class Main{

    int n,m,k;
    int[] sum;

    void solve(){
        Scanner sc = new Scanner(System.in);

        while(true){
            n = sc.nextInt();
            m = sc.nextInt();
            k = sc.nextInt();
            if(n==0 && m==0 && k==0) break;

            sum = new int[n*m-k+1];

            getsum(0,0);

            double ans = 0.0;
            for(int i=0; i<sum.length; i++){
                ans += (double)sum[i]/Math.pow(m,n)*i;
            }

            System.out.println(ans);
        }
    }

    void getsum(int pos, int s){
        if(pos==n){
            int num = Math.max(s-k,1);
            sum[num]++;
            return;
        }

        for(int i=1; i<=m; i++){
            getsum(pos+1,s+i);
        }
    }

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

Measured memory_bytes: 20072
#include<bits/stdc++.h>
#define F first
#define S second
#define int long long
#define double long double
using namespace std;
typedef pair<int,int> P;
typedef pair<int,P> iP;
typedef pair<P,int> Pi;
typedef pair<P,P> PP;
double eps=1e-8;
int mod=1e9+7;
int inf=1LL<<55;

priority_queue<P,vector<P>,greater<P> > pq;

template <typename T>
int Count(const vector<T> &v, T l,T r){
  //counting [l,r]
  auto L = lower_bound(v.begin(), v.end(), l );
  auto R = upper_bound(v.begin(), v.end(), r );
  // [l,r) change upper -> lower
  return R-L;
}

signed main(){
  int n,m;
  string s,t;
  cin>>n>>m>>s>>t;
  bool ans=1;
  int d=__gcd(n,m);
  map<int,char> mp;

  int a=m/d;
  for(int i=0;i<s.size();i++)
    mp[i*a]=s[i];
  a=n/d;
  for(int i=0;i<t.size();i++){
    if(mp.count(i*a)&&mp[i*a]!=t[i])ans=0;
    
  }
  
  if(ans)cout<<n*m/d<<endl;
  else cout<<-1<<endl;
  return 0;
}


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

using namespace std;

#define all(x) begin(x), end(x)

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

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

    int n, m;
    cin >> n >> m;
    int x = 1;
    int y = n;
    for (int i = 0; i < m; ++i) {
        int l, r;
        cin >> l >> r;
        x = max(l, x);
        y = min(r, y);
    }

    int ans = max(0, y - x + 1);
    cout << ans;
    
    return 0;
}


Measured memory_bytes: 256
n, m, k = map(int, input().split())
mod = 998244353

MAX = 2 * 10 ** 5 + 10

fact = [1] * (MAX + 1)
for i in range(1, MAX + 1):
    fact[i] = (fact[i-1] * i) % mod

inv = [1] * (MAX + 1)
for i in range(2, MAX + 1):
    inv[i] = inv[mod % i] * (mod - mod // i) % mod

fact_inv = [1] * (MAX + 1)
for i in range(1, MAX + 1):
    fact_inv[i] = fact_inv[i-1] * inv[i] % mod


def comb(n, k):
    if n < k:
        return 0
    return fact[n] * fact_inv[n-k] * fact_inv[k] % mod


ans = 0
power = pow(m - 1, n - k - 1, mod)
for i in range(k, -1, -1):
    ans += comb(n - 1, i) * m * power
    ans %= mod
    power *= m - 1
    power %= mod

print(ans)


Measured memory_bytes: 32548
#include<iostream>
#include<string>
#include<algorithm>
#include<cstdlib>
template<typename T>
void fin(T const& t){ std::cout << t << std::endl; exit(0); }

int const MAXLS = 1e5;

// mint
#include<cstdint>
int64_t const MOD = 1e9+7;

template<int64_t Prime>
struct mod_int {
  int64_t v_;
  mod_int(int64_t x=0) : v_(x) { normalize(); }
  void normalize() { ((v_ %= Prime) += Prime) %= Prime; }
  mod_int operator+=(mod_int const& r){ (v_ += r.v_) %= Prime; return *this; }
  mod_int operator-=(mod_int const& r){ (v_ += Prime - r.v_) %= Prime; return *this; }
  mod_int operator*=(mod_int const& r){ (v_ *= r.v_) %= Prime; return *this; }
  mod_int operator+(mod_int const& r) { mod_int res(*this); return res += r; }
  mod_int operator-(mod_int const& r) { mod_int res(*this); return res -= r; }
  mod_int operator*(mod_int const& r) { mod_int res(*this); return res *= r; }
  mod_int pow(int x) const {
    int64_t res = 1, v = v_;
    while(x > 0) {
      if(x&1) (res *= v) %= Prime;
      x/=2; (v *= v) %= Prime;
    }
    return mod_int(res);
  }
  mod_int inv() const { return pow(Prime-2); }
};
typedef mod_int<MOD> mint;

mint dp[MAXLS][13];

int main() {
  std::string S; std::cin >> S; std::reverse(S.begin(), S.end());
  dp[0][0] = 1;
  for(int i = 0, m = 1; i < S.size(); ++i, m=(m*10)%13) {
    char c = S[i];
    if(c == '?') {
      for(int j = 0; j < 13; ++j) {
        for(int k = 0; k < 10; ++k) dp[i+1][(j+k*m)%13] += dp[i][j];
      }
    } else {
      int d = c - '0';
      for(int j = 0; j < 13; ++j) dp[i+1][(j+d*m)%13] = dp[i][j];
    }
  }
  fin(dp[S.size()][5].v_);
  return 0;
}


Measured memory_bytes: 10624
#include<stdio.h>

void quick(int *,int,int);


int main(){
  int N,ans=0;
  scanf("%d",&N);
  int a[N];
  for (int i = 0; i < N; i++)
  {
    scanf("%d",&a[i]);
  }
  
  quick(a,0,N-1);

  int i=0,j=0,k=0,x=0;
  while (x<N&&k<N)
  {
    int counter=0;
    while (a[x]==a[i]){ counter++; i++; j=i;}
    while (a[x]+1==a[j]){ counter++; j++; k=j;}
    while (a[x]+2==a[k]&&k<N){ counter++; k++;}
    if (ans<counter){ ans=counter; }
    x=i;
  }

  printf("%d",ans);

  return 0;
}

void quick(int a[],int left,int right)
{
    int s,t,i,j;

    if (left<right){
        s=a[left];            
        i=left; j=right+1;      
        while (1){              
            while (a[++i]<s);
            while (a[--j]>s);
            if (i>=j) break;
            t=a[i]; a[i]=a[j]; a[j]=t;
        }
        a[left]=a[j]; a[j]=s;

        quick(a,left,j-1);
        quick(a,j+1,right);
    }
}

Measured memory_bytes: 2016
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
ll INF = 1e9;
int main()
{
    ll n, m, x;
    cin >> n >> m >> x;
    vector<ll> c(n);
    vector<vector<ll>> a(n, vector<ll>(m));
    for(int i = 0; i < n; i++)
    {
        cin >> c[i];
        for(int j = 0; j < m; j++)
        {
            cin >> a[i][j];
        }
    }
    ll ans = INF;
    for(int i = 0; i < 1 << n; i++)
    {
        ll cost = 0;
        vector<ll> sk(m, 0);
        for(int j = 0; j < n; j++)
        {
            if(i >> j & 1)
            {
                cost += c[j];
                for(int k = 0; k < m; k++)
                {
                    sk[k] += a[j][k];
                }
            }
        }
        bool flag = true;
        for(int k = 0; k < m; k++)
        {
            if(sk[k] < x) flag = false;
        }
        if(flag)
        {
            ans = min(ans, cost);
        }
    }
    if(ans == INF) cout << -1 << endl;
    else cout << ans << endl;
}


Measured memory_bytes: 3636
#include <stdio.h>

int main(void)
{
	int i, n;
	long long int a[100005], b, c = 0, sum = 0;
	scanf("%d", &n);
	for (i = 1; i <= n + 1; i++)
		scanf("%lld", &a[i]);
	

	for (i = 1; i <= n; i++) {
		scanf("%lld", &b);
		if (a[i] <= b+c) {
			sum += a[i];
			if (c >= a[i]) c = b;
			else c = b - (a[i] - c);
		}
		else {
			sum += b+c;
			c = 0;
		}
	}

	if (a[i] <= c)
		printf("%lld", sum + a[i]);
	else
		printf("%lld", sum + c);


	return 0;
}


Measured memory_bytes: 896
#include <algorithm>
#include <iostream>
#include <cstring>
#include <complex>
#include <cassert>
#include <cstdio>
#include <cstdlib>
#include <vector>  
#include <string>
#include <cmath>
#include <ctime>
#include <queue>
#include <list>
#include <map>
#include <numeric>
#include <set>
#include <ext/pb_ds/assoc_container.hpp>    // PBDS
#include <ext/pb_ds/tree_policy.hpp>      // PBDS

using namespace std;
using namespace __gnu_pbds;                 // PBDS

/* typedef starts */

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> PBDS_INT;               // PBDS for int
typedef tree<long long, null_type, less<long long>, rb_tree_tag, tree_order_statistics_node_update> PBDS_LL;    // PBDS for long long

/* typedef ends */

/* macro starts */

#define PI acos(-1)
#define EPS 1e-9
#define INF (1e9 + 7)
#define fastIO ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define sinD(degree) sin((degree * PI) / 180.0)
#define cosD(degree) cos((degree * PI) / 180.0)
#define tanD(degree) tan((degree * PI) / 180.0)
#define cotD(degree) (1.0 / tanD(degree))
#define secD(degree) (1.0 / cosD(degree))
#define cosecD(degree) (1.0 / sinD(degree))
#define asinD(value) (asin(value) * 180.0) / PI
#define acosD(value) (acos(value) * 180.0) / PI
#define atanD(value) (atan(value) * 180.0) / PI
#define forn(i,n) for(int i=0;i<n;i++)
#define value_at_index(x) find_by_order(x)
#define index_of(x) order_of_key(x)
#define pb push_back
#define setval(add,n) memset(add,n,sizeof(add))
#define max(a,b) a>b ? a : b
#define forr(i,a,b) for(int i=a;i<b;i++)

/* macro ends */

/* function starts */

/// calculates n-th (0-based) Gray Code
template<typename dataType>
dataType nthGrayCode(dataType n)
{
    return (n ^ (n >> 1));
}

/// generates all possible subsets for the given set
//template<typename dataType>
// void generateAllSubset(vector<dataType> &data)
// {
//     int i, j, n;
//     n = data.size();

//     for (i = 0; i < (1 << n); i++) {
//         for (j = 0; j < n; j++) {
//             if (i & (1 << j)) {
//                 cout << data[j] << " ";
//             }
//         }
//         cout << "\n";
//     }
// }


void swap(ll *a, ll *b){
	ll *temp=a;
	*a=*b;
	*b=*temp;
}
int n,k;

void solve(){
  cin >> n;
  int a[n][2];
  forn(i,n)
    forn(j,2)cin >> a[i][j];
  forn(i,n-2){
    if(a[i][0]==a[i][1] and a[i+1][0]==a[i+1][1] and a[i+2][0]==a[i+2][1] ){cout << "Yes\n";return;}

  }
  cout << "No\n";
}





int main()
{
  #ifndef ONLINE_JUDGE
       freopen("in.txt", "r", stdin);
       freopen("out.txt", "w", stdout);
  #endif
  fastIO;
    int t=1;
    //cin >> t;
    while(t--){
     solve();
     
    }
    return 0;
    }

Measured memory_bytes: 3648
#include<stdio.h>
#include<string.h>
int main()
{
	char a[20]={'A','K','I','H','A','B','A','R','A'};
	char b[50],c[100]={'K','I','H','B','R'};
	while(scanf("%s",b)!=EOF)
	{
		int f=0;
		int k=0,i,j;
		
		if(f==1)
		continue;
		if(strlen(a)<strlen(b))
		{printf("NO\n");
		continue;}
		if(strlen(a)==strlen(b))
		{
			for(i=0;i<strlen(a);i++)
			{
				if(a[i]!=b[i])
				{
					f=1;
				}
			}
			if(f==1)
			printf("NO\n");
			else
			printf("YES\n");
			continue;
		}
		for(i=0;i<strlen(b);i++)
		{
			if(b[i]==b[i+1])
			{printf("NO\n");
			f=1;
			break;}
		}
		if(f==1)
		continue;
		for(i=0;i<strlen(c);i++)
		{
			for(j=0;j<strlen(b);j++ )
			{
				if(c[i]!=b[j])
				{f=1;
				continue;}
				else
				{
				f=0;
				k=j+1;
				break;
				}
			}
			if(j==strlen(b)-1&&i<strlen(c)-1)
				{
					f=1;
				}
				if(f==1)
				break;
		}
		if(f==1)
			{printf("NO\n");continue;}
		k=0;
		if(strlen(a)>strlen(b))
		{
			for(i=0;i<strlen(b);i++)
			{
				for(j=k;j<strlen(a);j++)
				{
					if(b[i]!=a[j])
					{f=1;
					continue;}
					else
					{
						f=0;
						k=j+1;
						break;
					}
				}
				if(j==strlen(a)-1&&i<strlen(b)-1)
				{
					f=1;
				}
				if(f==1)
				break;
			}
			if(f==1)
			printf("NO\n");
			else
			printf("YES\n");
		}
	}
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline

a,b,c = map(int, input().split())

if a == b and a != c and b != c:
    print("Yes")
elif a == c and a != b and c != b:
    print("Yes")
elif b == c and a != b and a != c:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 9136
#include <iostream>
#include <cmath>

int gcd(int m, int n){
    int r;
    do{
        r = m % n;
        m = n;
        n = r;
    } while (r != 0);

    return m;
}

int main(void){
    using namespace  std;
    long A, B;
    cin >> A >> B;

    cout << A * B / gcd(A, B) << endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
#define MAX_N 100
#define MAX_M 16
int N,M,K;
 
int s[MAX_M];
int t[MAX_N];
 
vector<int> G[MAX_N];
int d[(1<<MAX_M)];
 
int main(){
  memset(t,-1,sizeof(t));
   
  cin>>N>>M>>K;
  for(int i=0;i<M;i++){
    cin>>s[i];
    s[i]--;
    t[s[i]]=i;
  }
   
  for(int i=0;i<N;i++){
    G[i].resize(K);
    for(int j=0;j<K;j++){
      cin>>G[i][j];
      G[i][j]--;
    }
  }
 
  memset(d,-1,sizeof(d));
  d[ (1<<M)-1 ]=0;
  queue<int> Q;
  Q.push( (1<<M)-1 );
  while(!Q.empty()){
    int bit=Q.front();Q.pop();
    if(bit==0){
      cout<<d[bit]<<endl;
      break;
    }
    for(int i=0;i<K;i++){
      int nbit=0;
      for(int j=0;j<M;j++){
        int to=G[s[j]][i];
        if(bit>>j&1)
          if(t[to]!=-1)
            nbit|=(1<<t[to]);
      }
      if(d[nbit]==-1){
        d[nbit]=d[bit]+1;
        Q.push(nbit);
      }
    }
  }
  return 0;
}

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

int main()
{
	int n;
	cin >> n;
	while (n--)
	{
		int k = 10;
		int x = 0, y = 0;
		int i;
		bool flag = true;
		while (k--)
		{
			cin >> i;
			if (i > y) y = i;
			else if (i > x) x = i;
			else flag = false;
		}
		if (flag) cout << "YES" << endl;
		else cout << "NO" << endl;
	}
	return 0;
}


Measured memory_bytes: 3092
#include<iostream>
#include<algorithm>
using namespace std;
int n,a[200005],c[200005];
int main(){
    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>a[i];
    }
    for(int i=0;i<200005;i++)c[i]=-1;
    int f=n,g=1;
    for(int i=n;i>0;i--){
        if(i%2==n%2)c[g]=a[i],g++;
        else c[f]=a[i],f--;
    }
    cout<<c[1];
    for(int i=2;i<=200004;i++){
        if(c[i]==-1)continue;
        cout<<" "<<c[i];
    }
    cout<<endl;
}

Measured memory_bytes: 3712
#include <stdio.h>
#define ll long long int
#include <queue>
#include <vector>
#include <iostream>
using namespace std;

int main(){
 string k[4]={"Sunny","Cloudy","Rainy"};
string j;
cin>>j;
if(j==k[0]){
  cout<<k[1];
}else if (j==k[1])
{
  cout<<k[2];
}else if(j==k[2]){
cout<<k[0];
}


}

Measured memory_bytes: 256
// https://atcoder.jp/contests/abc067/tasks/abc067_b

#include <bits/stdc++.h>

using namespace std;

#define REP(i,n)   for(int i=0; i<(int)(n); i++)
#define FOR(i,b,e) for(int i=(b); i<=(int)(e); i++)
#define DUMP(a, n) REP(_i, n) printf("%d%c", a[_i], _i + 1 == n ? '\n' : ' ')
#define DUMP2D(a, n, m) REP(_i, n) REP(_j, m) printf("%d%c", a[_i][_j], _j + 1 == m ? '\n' : ' '); puts("")

const int N_MAX = 50;
const int L_I_MAX = 50;

int N, K;
int l[N_MAX];

void solve() {
  sort(l, l + N, greater<int>());
  int ans = 0;
  REP(i, K) ans += l[i];
  printf("%d\n", ans);
}

void input() {
  scanf("%d%d", &N, &K);
  REP(i, N) scanf("%d", l + i);
}

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


Measured memory_bytes: 256
chomp($n = <>);
@s = split(/ /, <>);

@s = ("", sort {$a <=> $b} @s);
$r = 0;
$mid = ($n / 2);
$r = ($s[$mid + 1] - ($s[$mid] + 1) + 1) if($s[$mid + 1] - $s[$mid] > 0);

print "$r\n";


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

int n, q;

void setPoint(vector<int> &p, vector<int> &A) {
    for (int i = 0; i < q; i++) {
        int a = A.at(i);
        p.at(a)++;
    }
}

void solve(vector<int> &p, vector<int> &A) {
    setPoint(p, A);
    for (int i = 1; i <= n; i++) {
        if (p.at(i) <= 0) {
            cout << "No" << endl;
        } else {
            cout << "Yes" << endl;
        }
    }
}

int main() {
    int k;
    cin >> n >> k >> q;
    vector<int> p(n + 1, k - q);
    vector<int> A(q);
    for (int i = 0; i < q; i++) {
        scanf("%d", &A.at(i));
    }

    solve(p, A);

    return 0;
}

Measured memory_bytes: 1408
def f(ball):
    b, c = 0, 0
    for a in ball:
        if a > b:
            b = a
        elif a > c:
            c = a
        else:
            return False
    return True

n = int(raw_input())
for i in range(n):
    a = map(int, raw_input().split())
    print 'YES' if f(a) else 'NO'

Measured memory_bytes: 4224
#include <bits/stdc++.h>
using namespace std;
using Int = long long;
int PREP = (cin.tie(nullptr), ios::sync_with_stdio(false), cout << fixed << setprecision(9), 0);
//int SEGV = getenv("D") || (exit(system("D= SEGFAULT_SIGNALS=all catchsegv ./prog.exe") >> 8), 0);
const Int MOD = 998244353;
const Int MAX = 500000;
Int fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
    fac[0] = fac[1] = finv[0] = finv[1] = inv[1] = 1;
    for (int i = 2; i < MAX; i++) {
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
Int COM(int n, int k) {
    if (n < k || n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
Int POW(Int x, Int y) {
    if (y == 0) return 1;
    if (y % 2 == 0) return POW(x * x % MOD, y / 2);
    return x * POW(x, y - 1) % MOD;
}
int main() {
    COMinit();
    int N, M, K; cin >> N >> M >> K;
    Int ans = 0;
    for (int i = 0; i <= K; i++) {
        ans += COM(N - 1, i) * M % MOD * POW(M - 1, N - 1 - i);
        ans %= MOD;
    }
    cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 15376
package main

import (
	"fmt"
	"math"
)

// 足場 i + 1 or i + 2

func main() {
	n := SingleInt()
	chs := make([]int, 0, n)
	for i := 0; i < n; i++ {
		chs = append(chs, SingleInt())
	}

	dp := make([]int, n, n)
	dp[0] = 0
	dp[1] = int(math.Abs(float64(chs[1] - chs[0])))
	for i := 2; i < n; i++ {
		dp[i] = Min(dp[i-1]+int(math.Abs(float64(chs[i]-chs[i-1]))), dp[i-2]+int(math.Abs(float64(chs[i]-chs[i-2]))))
	}

	fmt.Printf("%#v\n", dp[n-1])
}

func SingleInt() int {
	var n int
	fmt.Scan(&n)
	return n
}

func Min(nums ...int) int {
	if len(nums) == 0 {
		panic("function min() requires at least one argument.")
	}
	res := nums[0]
	for i := 0; i < len(nums); i++ {
		res = int(math.Min(float64(res), float64(nums[i])))
	}
	return res
}


Measured memory_bytes: 5504
#include <iostream>
#include <stdio.h>       // printf,scanf
#include <stdlib.h>
#include <math.h>
#include <string>
#include <vector>
#include <algorithm>  //sort,binarySearch
#include <functional> 
#include <iomanip>    // setprecision
#include <utility>    // c+11 Array
#include <set>
#include <sstream>
#include <map>
#include <bits/stdc++.h>
#define MOD 1000000007
#define PI 3.141592653589793238462643383279
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define pb(x) push_back(x)
#define debug(x) cout << #x << " = " << x << endl;
#define debret(x) debug(x) ; return 0;

using namespace std;

int main(void){

    int n;
    string str1,str2;
    cin >> n >> str1 >> str2;

    int ans = 0;

    REP(i,n){
        string sub1 = str1.substr(i,str1.size());
        string sub2 = str2.substr(0,str2.size()-i);
        if(sub1 == sub2){
            int size = sub1.size();
            ans = max(ans,size);
        }
    }

    string str = str1+str2;

    cout << str.size()-ans << endl;

    return 0;
}


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

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

    const int row = 9;
    const int col = 9;

    vector<int> multiplicationTable = vector<int>(row * col);

    rep(j, row)
    {
        rep(i, col)
        {
            multiplicationTable.at(i + j * row) = (i + 1) * (j + 1);
        }
    }

    auto it = find(multiplicationTable.begin(), multiplicationTable.end(), N);

    if (it != multiplicationTable.end())
    {
        std::cout << "Yes";
        return 0;
    }

    std::cout << "No";

    return 0;
}


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

using namespace std;

void Main()
{
    string s;
    cin >> s;
    string ret = "";
    array<string, 3> weather = {"Sunny", "Cloudy", "Rainy"};
    for (int i = 0; i < 3; ++i)
    {
        if (weather[i] == s)
            ret = weather[(i + 1) % 3];
    }

    cout << ret;
}

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

    std::cout << std::fixed << std::setprecision(10);

#ifdef DEBUG_BUILD
    while (true)
    {
        Main();
        cout << std::endl;
    }
#endif

    Main();
    cout << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <stack>
#include <iomanip>
using namespace std;
#define all(x) x.begin(), x.end()
typedef vector <int> vi;
typedef pair<int,int> ii;
typedef long long ll;
typedef long double ld;
const int mod = 1e9 + 7;
const ll inf = 3e18 + 5;
int add(int a, int b) { return (a += b) < mod ? a : a - mod; }
int mul(int a, int b) { return 1LL * a * b % mod; }
int sub(int a, int b) { return (a -= b) < 0 ? a + mod : a; }
int ctz(int x) { return __builtin_ctz(x); }
int clz(int x) { return __builtin_clz(x); }

int main(){
  ios_base::sync_with_stdio(false); cin.tie(0);
  #ifdef LOCAL
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
  #endif

  int x, y;
  cin >> x >> y;
  int res = 0;
  if(x <= 3) res += 100000 * (4 - x);
  if(y <= 3) res += 100000 * (4 - y);
  if(x == 1 && y == 1) res += 100000 * 4;
  cout << res;
}

Measured memory_bytes: 892
n=int(input())
a=[x-i for i,x in enumerate(map(int,input().split()))]
a.sort()
S=s=0
a_l=len(a)
a_m=(a_l+1)//2
for j in range(a_l-a_m):
    S+=a[a_m]-a[j]
for j in range(a_m-1):
    S+=a[-j-1]-a[a_m]
print(S)


Measured memory_bytes: 26128
#include <stdio.h>
#include <stdlib.h>

typedef long long int lli;

void pushBack(lli* alliData, int* iRecordCnt);
void randomAccess(lli* alliData, int* iRecordCnt);
void popBack(int* iRecordCnt);

// 可変長配列Aに対して以下の操作を行う。
// ・pushBack(x): Aの末尾に整数xを挿入する
// ・randomAccess(p) :Aのq番目の要素の値を出力する
// ・popBack() : Aの末尾の要素を削除する
// 操作は数字で与えられ、上から0,1,2で指定される。
// また、から配列に対してrandomAccessやpopBuck操作は行われない。
int main()
{

	lli* alliData;
	int iInputQ;
	int iInputOrder;	// 命令番号
	int iRecordCnt=0;
	int iCnt;

	scanf("%d", &iInputQ);

	// 最大要素数iInputQの配列をメモリ確保
	alliData = (lli*)malloc(sizeof(lli) * iInputQ);

	for (iCnt = 0; iCnt < iInputQ; iCnt++)
	{
		scanf("%d", &iInputOrder);

		switch (iInputOrder)
		{
		case 0:
			pushBack(alliData, &iRecordCnt);
			break;
		case 1:
			randomAccess(alliData, &iRecordCnt);
			break;
		case 2:
			popBack(&iRecordCnt);
			break;
		default:
			break;
		}
	}

	free(alliData);

	return 0;
}

// 末尾に要素を挿入
void pushBack(lli* alliData, int* piRecordCnt)
{
	scanf("%lld", &alliData[*piRecordCnt]);
	(*piRecordCnt)++;

	return;
}

// iValue番目の要素を出力
void randomAccess(lli* alliData, int* iRecordCnt)
{
	int iInputIdx;

	scanf("%d", &iInputIdx);

	printf("%lld\n", alliData[iInputIdx]);

	return;
}

// 末尾を削除
void popBack(int* piRecordCnt)
{
	// 配列の要素数をデクリメントすることで疑似的に末尾削除
	(*piRecordCnt)--;

	return;
}


Measured memory_bytes: 3064
#include <stdio.h>

int fib(int);

int main(int argc, char const *argv[]) {

  int n;

  scanf("%d",&n);
  printf("%d\n",fib(n));

  return 0;
}

int fib(int n){

  int f0 = 1, f1 = 1;
  int fn;
  int i;


  if( n == 0 || n == 1 )
    return 1;

  for( i = 1 ; i < n ; i++ ){

    fn = f0 + f1;

    f0 = f1;
    f1 = fn;

  }

  return fn;

}

Measured memory_bytes: 596
#include <iostream>
#include <algorithm>
#include <string.h>
#include <stdio.h>
using namespace std;
#define ll long long
int dp[105][105], a[105][105];
int main(int argc, char const *argv[])
{
    int n;
    memset(a, 0, sizeof a);
    memset(dp, 0, sizeof dp);
    cin >> n;
    for (int i = 1; i <= 2; i++)
        for (int j = 1; j <= n; j++)
            cin >> a[i][j];
    for (int i = 1; i <= 2; i++)
        for (int j = 1; j <= n; j++)
            dp[i][j] = max(dp[i-1][j], dp[i][j-1])+a[i][j];
    printf("%d\n", dp[2][n]);
    return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <iomanip>
#include <fstream>
#include <string>
#include <array>
#include <vector>
#include <deque>
#include <list>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <stack>
#include <queue>
#include <bitset>
#include <tuple>
#include <cmath>
#include <complex>
#include <algorithm>
#include <utility>
#include <regex>
#include <cstdint>
#include <numeric>
#include <functional>
#include <cassert>

using namespace std;
using ll = int64_t;
using ull = uint64_t;

constexpr ll INF = 1000000000;/* 1e+9a */

void sub_main(istream &cin) {
    double n, m, d;
    cin >> n >> m >> d;
    if(!cin) return;
    
    double ans = 0;
    if(d <= n/2 and d != 0){
        ans = (n/2-d)*2 + d;
        ans *= 2;
        ans /= n * n;
        ans *= m-1;
    }
    else{
        ans = (m-1ll)/ n;
    }
    cout << ans << endl;

}

int main(int argc, char *argv[]) {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << setprecision(16) << scientific;
#ifdef DEBUG
    cerr << "DEBUG MODE" << endl;
    string test_cases = "test_2.txt";
    auto fs = fstream(test_cases, fstream::in);
    int lp = 0;
    while(fs) {
        lp++;
        cout << lp <<  "#------\n";
        sub_main(fs);
    }
    cout << "------#\n";
    if(lp <= 1) sub_main(cin);
#else
    sub_main(cin);
#endif
    return 0;
}


Measured memory_bytes: 256