akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
 
#define ff              first
#define ss              second
#define ll              long long
#define dd              double
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define pll             pair<ll,ll>
#define vi              vector<int>
#define vll             vector<long long>
#define vdd             vector<double>
#define vpii            vector<pair<int,int>>
#define vpll            vector<pair<long long,long long>>
#define vvi             vector<vector<int>>
#define vvll            vector<vector<long long>>
#define mii             map<int,int>
#define mll             map<long long,long long>
#define umii            unordered_map<int,int>
#define umll            unordered_map<long long,long long>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define rep(i,n)        for(int i=0;i<n;i++)
#define rep2(i,a,b)     for(int i=a;i<b;i++)
#define rev(i,n)        for(int i=n;i>=0;i--)
#define rev2(i,a,b)     for(int i=a;i>=b;i--)
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define inf             9e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define wh(x)           int x; cin>>x; while(x--)
#define fio             ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl            '\n'
#define all(x)          x.begin(),x.end()
#define d0(x)           cout <<x<<" "
#define d1(x)           cout <<x<<endl
#define d2(x,y)         cout <<x<<" "<<y<<endl
#define d3(x,y,z)       cout <<x<<" "<<y<<" "<<z<<endl
#define d4(x,y,z,w)     cout <<x<<" "<<y<<" "<<z<<" "<<w<<endl
#define read2(x,y)      cin>>x>>y
#define read3(x,y,z)    cin>>x>>y>>z
#define read4(x,y,z,w)  cin>>x>>y>>z>>w
#define read5(x,y,z,w,a)cin>>x>>y>>z>>w>>a
#define sz(a)           (int)a.size()
#define deb(x)          cout <<#x << " is "<<x<<endl;
const ll mod=1e9+7;
const double PI = 3.14159265359;
const ll MOD=998244353;
void i_o()
{
   #ifndef ONLINE_JUDGE
   freopen("input.txt", "r", stdin);
   freopen("output.txt", "w", stdout);
   #endif
}


int main(){
  fio
  i_o();
  int h1,m1,h2,m2,k;
  cin>>h1>>m1>>h2>>m2>>k;
  int in=(h2-h1)*60 + m2-m1-k;
  d1(in);
  return 0;
}


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

using namespace std;

void hoge(int N, int W){

   int v[N];
   for(int i=0; i<N; i++) cin>> v[i];
   int ma=*max_element(v, v+N);
   int M=ma/W+1;
   int b[M];
   for(int i=0; i<M; i++) b[i]=0;
   for(int i=0; i<N; i++){
      for(int j=0; j<M; j++){
         if(j*W<=v[i]&&v[i]<(j+1)*W) b[j]++;
      }
   }
   int mah=*max_element(b, b+M);
   vector<pair<int, int>> V;
   for(int i=0; i<M; i++){
      V.push_back(make_pair(b[i], i));
   }
   sort(V.rbegin(), V.rend());
   double r=0;
   for(auto p: V){
      r+=(1.*p.first/mah)*(1.*(M-1-p.second)/(M-1));
   }

   printf("%.15f\n", r+0.01);

}

int main(){

   while(1){
      int N, W;
      cin>> N>> W;
      if(!(N||W)) break;

      hoge(N, W);
   }

   return 0;
}

Measured memory_bytes: 3056
s=input()[::-1]
ans='YES'
while len(s)>0:
    if s[:5] in ['dream'[::-1],'erase'[::-1]]:
        s=s[5:]
    elif s[:6] in ['eraser'[::-1]]:
        s=s[6:]
    elif s[:7] in ['dreamer'[::-1]]:
        s=s[7:]
    else:
        ans='NO'
        break
print(ans)

Measured memory_bytes: 3188
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
typedef long long ll;
const int maxn=1e6+10;
#define p 1000000007
int main(){
	fast;
	ll n,t; cin>>n;
	if(n==0)cout<<1<<'\n';
	else cout<<0<<'\n';
	return 0;
}
//period of a string(prefix-function) with KMP
//prime func
//subset production
//factorization
//modpow
//modinv ( a^(p-2)=a^(-1) (mod p) )
//sieve
//ncr
//euler totien func (co prime divisiors upto n)
//matrix exponentation(fast fibonacci)
//dsu
//Trees
//Graphs(dfs,bfs,shortes path etc.)
//DP-Recursion

Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define de cout<<"debuglandınız\n";
ll int n,c,i,j,ans;
int main(){
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	cin >> n;
	ll int ar[n][3];
	for(i=0;i<n;i++){
		cin>>ar[i][0];
		cin>>ar[i][1];
		cin>>ar[i][2];
	}
	for(i=1;i<n;i++){
		ar[i][0]=max(ar[i-1][1],ar[i-1][2])+ar[i][0];
		ar[i][1]=max(ar[i-1][0],ar[i-1][2])+ar[i][1];
		ar[i][2]=max(ar[i-1][1],ar[i-1][0])+ar[i][2];
	}
	cout<<max(max(ar[n-1][0],ar[n-1][1]),ar[n-1][2]);
	return 0;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define rep2(i,x,n) for(int i=x; i<(n); i++)
#define all(n) begin(n),end(n)
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
const long long INF = numeric_limits<long long>::max();
int main(){
    long long N;
    cin>>N;
    set<long long> div;//Nの約数を全列挙
    rep(i,(int)ceil(sqrt(N))){
        if(N%(i+1)==0){
            div.insert(i+1);
        }
    }
    int ans=10000;
    int cnt=0;
    long long bud;
    for(auto x : div){
        bud=N/x;
        cnt=max(to_string(x).size(),to_string(bud).size());
        ans=min(ans,cnt);
    }
    cout << ans << endl;
    return 0;
}

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

int main(){
    //input
    double n;
    cin >> n;

    //calculate
    double nn = n / 1.08;
    int nnn = nn;
    int nnnn;
    while(1){
        nnnn = nnn * 1.08;
        if(nnnn < n) nnn++;
        else if(nnnn == n){
            cout << nnn << endl;
            break;
        }else{
            cout << ":(" << endl;
            break;
        }
    }

    return 0;
}

Measured memory_bytes: 256
#n=int(input())
n,m,k=map(int,input().split())
al=list(map(int,input().split()))
bl=list(map(int,input().split()))
#l=[list(map(int,input().split())) for i in range(n)]

A=[0]
for i in range(n):
    A.append(A[i]+al[i])
B=[0]
for i in range(m):
    B.append(B[i]+bl[i])
B.append(max(B[m],k)+1)
mx=0
for i in range(n+1):
    rem=k-A[i]
    if rem<0:
        continue
    left=0;right=m+1
    while right-left>1:
        mid=(left+right)//2
        if B[mid]>rem:
            right=mid
        else:
            left=mid
    mx=max(left+i,mx)

print(mx)


Measured memory_bytes: 47352
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_set>
#include<unordered_map>
#include<bitset>
#include<iomanip>
#include<list>
#include<deque>
using namespace std;
//#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define END {}
#endif
typedef long long ll;
#define int ll
#define uset unordered_set
#define umap unordered_map
typedef std::pair<int,int> P;
struct edge{int to,cost;};
const int INF=100000000000000000;
const int INF2=9223372036854775807;
const int MOD=1000000007;
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define min(X,Y) (((int)(X)<(int)(Y))?(X):(Y))
#define max(X,Y) (((int)(X)>(int)(Y))?(X):(Y))
#define MAX(X,Y) (*max_element(X,Y))
#define MIN(X,Y) (*min_element(X,Y))
#define NP(X,Y) next_permutation(X,Y)
#define setp(X,Y) cout<<fixed<<setprecision(Y)<<X;
int ceil2(int a,int b){if(a%b==0){return a/b;}else{return a/b+1;}}
int pow2(int a,int b){int r=1;for(int i=1;i<=b;i++){r*=a;}return r;}
int Log2(int a){int t=0;while(1){if(a==0||a==1){break;}a/=2;t++;}return t;}

signed main(){
	int A,B;
	cin>>A>>B;
	if(A<=B*2){
		cout<<0<<endl;
	}
	else{
		cout<<A-B*2<<endl;
	}
	return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {

    public static void main(String[] args) {
       Scanner scan=new Scanner(System.in);

        int a=scan.nextInt();
        int b=scan.nextInt();
        int c=scan.nextInt();

        if(a==5) {
            if ((b == 5 && c == 7) || (b == 7 && c == 5))
                System.out.println("YES");
            else
                System.out.println("NO");
        }else {
            if (b == 5 && c == 5)
                System.out.println("YES");
            else
                System.out.println("NO");
        }

    }
}

Measured memory_bytes: 9424
# -*- coding: utf-8 -*-


from sys import stdin


############################################


# read data for n sequences.
input=[]
for _ in range(6):
    input.append(int(stdin.readline().split()[0]))
k=input[5]

ant = input[0:5]

x=0
for a in ant[:4]:
    for b in ant[1:]:
        if b-a <= k:
            continue
        else:
            x=1
            break

if x==0:
    print("Yay!")
else:
    print(":(")
#data = [int(stdin.readline().rstrip()) for _ in range(n)]


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#define all(x) x.begin(),x.end()
#define rep(i,j,n) for (int i = j; i < (int)(n); i++)
#define _GLIBCXX_DEBUG
#define MOD 1000000007
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
//name[i][j]-> vvl name(i,vl(j))
//map<int,int>mp
//余りを切り上げる =>  (a + b - 1) / b 

signed main(){
	int a,b; cin>>a>>b;
	if(a>=13) cout<<b;
	else if(6<=a) cout<<b/2;
	else cout<<0;
	
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <unordered_map>
#include <algorithm>

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

using std::cin;
using std::cout;
using std::endl;
using std::string;
using std::vector;

long long combi(long long num)
{
  return num * (num - 1) / 2;
}

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

  std::unordered_map<string, int> m;
  rep(i, N)
  {
    string s;
    cin >> s;
    std::sort(s.begin(), s.end());
    m[s]++;
  }

  long long count = 0;
  for (const auto &e : m)
  {
    count += combi(e.second);
  }

  cout << count << endl;

  return 0;
}


Measured memory_bytes: 10372
#include <iostream>
#include <cstring>
#include <cmath>
#include <iomanip>


using namespace std;

double minkowsky1(int n, int *x, int *y);
double minkowsky2(int n, int *x, int *y);
double minkowsky3(int n, int *x, int *y);
double chebyshev(int n, int *x, int *y);

int main() {
    cout << fixed;
    cout << setprecision(10);

    int n;
    cin >> n;

    int x[n];
    memset(x, 0, sizeof(int) * n);
    int y[n];
    memset(y, 0, sizeof(int) * n);

    for (int i = 0; i < n; i++) {
        cin >> x[i];
    }

    for (int i = 0; i < n; i++) {
        cin >> y[i];
    }

    cout << minkowsky1(n,x,y) << endl;
    cout << minkowsky2(n,x,y) << endl;
    cout << minkowsky3(n,x,y) << endl;
    cout << chebyshev(n,x,y) << endl;

    return 0;
}

double minkowsky1(int n, int *x, int *y) {
    double ret = 0;
    for (int i = 0; i < n; i++) {
        ret += abs(x[i] - y[i]);
    }
    return ret;
}

double minkowsky2(int n, int *x, int *y) {
    double ret = 0;
    for (int i = 0; i < n; i++) {
        ret += pow(x[i] - y[i], 2);
    }
    return sqrt(ret);
}

double minkowsky3(int n, int *x, int *y) {
    double ret = 0;
    for (int i = 0; i < n; i++) {
        ret += pow(abs(x[i] - y[i]), 3);
    }
    return cbrt(ret);
}

double chebyshev(int n, int *x, int *y) {
    double ret = 0;
    for (int i = 0; i < n; i++) {
        int tmp = abs(x[i] - y[i]);

        if (tmp > ret)
            ret = tmp;
    }
    return ret;
}

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

#define f(x, y, z) for (int x = (y), __ = (z); x < __; ++x)
#define _rep(i, a, b) for (int i = (a); i <= (b); ++i)
#define mst(x, a) memset(x, a, sizeof(x))

typedef long long ll;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;
const int INF = 1 << 27;
const ll LLINF = (ll)1 << 60;
const ll MOD = 1e9 + 7;

int dx[4] = {-1, 0, 1, 0};
int dy[4] = {0, -1, 0, 1};

const int MAXN = 301;
double dp[MAXN][MAXN][MAXN];

int main() {
  int N;
  scanf("%d", &N);
  int cnt[4] = {};
  for (int i = 0; i < N; i++) {
    int x;
    scanf("%d", &x);
    cnt[x]++;
  }

  dp[0][0][0] = 0;
  
  for (int d = 0; d <= N; d++) {
    for (int c = 0; c <= N - d; c++) {
      for (int b = 0; b <= N - d - c; b++) {
        int sum = b + c + d;
        if (sum == 0) continue;
        double s = sum;
        double ans = N / s;
        if (b) ans += b * dp[d][c][b-1] / s;
        if (c) ans += c * dp[d][c-1][b+1] / s;
        if (d) ans += d * dp[d-1][c+1][b] / s;
        dp[d][c][b] = ans;
      }
    }
  }
  printf("%.10lf\n", dp[cnt[3]][cnt[2]][cnt[1]]);
}


Measured memory_bytes: 213248
#![allow(unused_imports)]
#![allow(non_snake_case)]
use std::cmp::*;
use std::collections::*;
use std::io::Write;

#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), std::io::stderr());
            writeln!(err, "{} = {:?}", e, $e).unwrap()
        })*
    };
}

fn main() {
    let v = read_vec::<i64>();
    let (n, k) = (v[0], v[1]);
    let ab = (k..k + 2 * n).collect::<Vec<_>>();
    let c = (k + 2 * n..k + 3 * n).collect::<Vec<_>>();
    if c.iter().sum::<i64>() < ab.iter().sum::<i64>() {
        println!("-1");
        return;
    }
    let longer_oe_len = n - n / 2;
    let mut answers = vec![];
    for i in 0..longer_oe_len {
        answers.push((k + i, k + 2 * n - longer_oe_len + i, k + 2 * n + 2 * i));
    }
    let shorter_oe_len = n / 2;
    for i in 0..shorter_oe_len {
        answers.push((k + longer_oe_len + i, k + n + i, k + 2 * n + 2 * i + 1));
    }
    for ans in answers {
        println!("{} {} {}", ans.0, ans.1, ans.2);
    }
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}


Measured memory_bytes: 13688
#include <bits/stdc++.h>
#define PI 3.14159265358979323846
#define MAXINF (1e18L)
#define INF (1e9L)
#define EPS (1e-9)
#define MOD ((ll)(1e9+7))
#define REP(i, n) for(int i=0;i<int(n);++i)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define ALL(v) v.begin(),v.end()
#define FIND(v,x) (binary_search(ALL(v),(x)))
#define SORT(v) sort(ALL(v))
#define RSORT(v) sort(ALL(v));reverse(ALL(v))
#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl
#define Yes(n) cout<<((n)?"Yes":"No")<<endl
#define YES(n) cout<<((n)?"YES":"NO")<<endl
#define pb push_back
#define fi first
#define se second
using namespace std;
template<class A>void pr(A a){cout << (a) << endl;}
template<class A,class B>void pr(A a,B b){cout << a << " "  ;pr(b);}
template<class A,class B,class C>void pr(A a,B b,C c){cout << a << " " ;pr(b,c);}
template<class A,class B,class C,class D>void pr(A a,B b,C c,D d){cout << a << " " ;pr(b,c,d);}
template<class T> void pr_vec(vector<T> &v, char ep=' '){int n=v.size();REP(ni,n){cout<<v[ni];if(ni!=n-1)cout<<ep;}cout<<endl;};
template<class T> inline bool chmin(T& a, T b){return a>b ? a=b, true : false;}
template<class T> inline bool chmax(T& a, T b){return a<b ? a=b, true : false;}
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll,ll> pll;

int main(void)
{
    int X;
    cin >> X;
    ll K = 0;
    int k = 0;
    while(1){
        (K += X) %= 360;
        k++;
        if(K==0){
            pr(k);
            return 0;
        }
    }
}

Measured memory_bytes: 3668
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
using ll = long long;
int INF = 1000000009;
int main()
{
  int a,b,c;
  cin >> a >> b >> c;
  if(a<b)swap(a,b);
  if(b<c)swap(b,c);
  if(a<b)swap(a,b);
  int ans = 0;
  ans += a-b;
  c += (a-b);
  b = a;
  ans += (b - c + 1) / 2;
  c += (b - c + 1) / 2 * 2;
  if (b != c)
    ans++;
  cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int d = sc.nextInt();
        int t = sc.nextInt();
        int s = sc.nextInt();

        String ans = "";

        float x = (float)d / (float)s;
        if (x <= (float)t) ans = "Yes";
        else ans = "No";

        System.out.println(ans);
    }
}

Measured memory_bytes: 35748
/* Work 3_4
 * AtCoder 81
 * cy_an */

#include <stdio.h>

int main(void){
    int n, i, for_flag = 1;           // 変数宣言
    scanf("%d", &n);                  // n, kを入力

    for(i = 9; 0 < i; i--){           // 1から9で除算
        if(n / i < 10 && n % i == 0){ // 商が10未満かつ余りが0の場合
            printf("Yes\n"); for_flag--; break;   // "Yes"を出力し、ループを終了する
        }
    }
    if(for_flag){
        printf("No\n");
    }
    return 0;
}

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

using namespace std;

typedef long long ll;
int main(){
    int x, y, z, k;
    cin >> x >> y >> z >> k;
	ll maxn = max(x, max(y, z));
	for(int i = 0; i < k; i++)maxn *= 2;
    cout << x + y + z + maxn - max(x, max(y, z)) << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    private static final int MOD = 1_000_000_007;
    private static final String YES = "Yes";
    private static final String NO = "No";

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int X = sc.nextInt();
        int Y = sc.nextInt();

        System.out.println(solve(X, Y));
    }

    private static long solve(int X, int Y) {
        if ((2*X-Y)%3 != 0 || (2*Y-X)%3 != 0) {
            return 0;
        } else if (2*X < Y || 2*Y < X) {
            return 0;
        }

        int a = (2*X-Y)/3;
        int b = (2*Y-X)/3;
        return combinationSimple(a+b, a, MOD);
    }

    public static long combinationSimple(int n, int r, int p) {
        if (n == 0 && r == 0) return 1;
        if (n < r || n < 0)   return 0;

        r = Math.min(r, n-r);
        long x = 1;
        long y = 1;
        for (int i=1; i<=r; i++) {
            x = x * (n-i+1) % p;
            y = y * i % p;
        }

        return x * power(y, p-2, p) % p;
    }

    public static long power(long base, long t, long p) {
        long ans = 1;

        while (t > 0) {
            if (t%2 == 1) {
                ans = ans * base % p;
            }

            t /= 2;
            base = base * base % p;
        }

        return ans;
    }
}

Measured memory_bytes: 21844
#include<cstdio>

int A,B,cnt;

int Get(int x) {
	return 100*x+x/10%10*10+x/100;
}

int main() {
	scanf("%d %d",&A,&B);
	int a=A/100,b=B/100;
	for(int i=a;i<=b;i++) {
		int x=Get(i);
		if(A<=x&&x<=B) cnt++;
	}
	printf("%d\n",cnt);
}

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

int main(void) {
  int a, b, ans;
  cin >> a >> b;
  if (a < 10 && b < 10)
    ans = a * b;
  else
    ans = -1;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3548
package main

import (
	"bufio"
	"fmt"
	"io"
	"math"
	"os"
	"strconv"
)

func main() {
	var maxv, minv int
	maxv = math.MinInt32

	scanner := bufio.NewScanner(os.Stdin)
	if scanner.Scan() {
		_, err := strconv.Atoi(scanner.Text())
		if err != nil {
			os.Exit(1)
		}
	}
	if scanner.Scan() {
		var err error
		minv, err = strconv.Atoi(scanner.Text())
		if err != nil {
			os.Exit(1)
		}
	}

	for scanner.Scan() {
		v, err := strconv.Atoi(scanner.Text())
		if err != nil {
			if err == io.EOF {
				break
			}
			os.Exit(1)
		}
		if v-minv > maxv {
			maxv = v - minv
		}
		if v < minv {
			minv = v
		}
	}
	fmt.Println(maxv)
}



Measured memory_bytes: 4092
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
#pragma warning (disable: 4996)

int N, M, A[1 << 17], B[1 << 17], low[1 << 17], pre[1 << 17], cnts = 0;
vector<int> G[1 << 17], Articulation;

void dfs(int pos, int prevs) {
	cnts++; pre[pos] = cnts; low[pos] = cnts;

	bool flag = false; int deg = 0;
	for (int i = 0; i < G[pos].size(); i++) {
		if (pre[G[pos][i]] == 0) {
			dfs(G[pos][i], pos); deg++;
			low[pos] = min(low[pos], low[G[pos][i]]);
			if (pos >= 1 && pre[pos] <= low[G[pos][i]]) {
				flag = true;
			}
		}
		else {
			if (pos != prevs) low[pos] = min(low[pos], pre[G[pos][i]]);
		}
	}
	if (pos == 0 && deg >= 2) flag = true;
	if (flag == true) Articulation.push_back(pos);
}

int main() {
	scanf("%d%d", &N, &M);
	for (int i = 1; i <= M; i++) {
		scanf("%d%d", &A[i], &B[i]);
		G[A[i]].push_back(B[i]);
		G[B[i]].push_back(A[i]);
	}
	dfs(0, -1);
	sort(Articulation.begin(), Articulation.end());
	for (int i : Articulation) printf("%d\n", i);
	return 0;
}


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

#define rep(i,n) for(int i=0; i<(n); ++i)
using ll = long long;
using P = pair<int, int>;

int main() {
  ll x, y;
  cin >> x >> y;

  ll cur = x;
  ll ans = 0;
  while (cur <= y) {
    ans++;
    cur += cur;
  }
  cout << ans << endl;
}


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

using namespace std;

typedef long long ll;

int main()
{
    ios_base::sync_with_stdio(0);
    ll n, x, MOD;
    cin >> n >> x >> MOD;
    vector<ll> a;
    a.push_back(x);
    vector<int> gdzie(MOD, -1);
    while (gdzie[a.back()] == -1)
    {
        gdzie[a.back()] = a.size() - 1;
        ll ost = a.back();
        a.push_back(ost * ost % MOD);
    }
    ll powt = gdzie[a.back()];
    a.pop_back();
    vector<ll> cykl;
    while (a.size() >= powt + 1)
    {
        cykl.push_back(a.back());
        a.pop_back();
    }
    reverse(cykl.begin(), cykl.end());
    ll odp = 0;
    if (n <= a.size())
    {
        for (int i = 0; i < n; ++i)
            odp += a[i];
    }
    else
    {
        for (int i = 0; i < a.size(); ++i)
            odp += a[i];
        n -= a.size();
        ll cale = n / cykl.size();
        ll reszta = n - cale * cykl.size();
        ll sCykl = 0;
        for (int i = 0; i < cykl.size(); ++i)
            sCykl += cykl[i];
        odp += sCykl * cale;
        for (int i = 0; i < reszta; ++i)
            odp += cykl[i];
    }
    cout << odp;
    return 0;
}


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

#define pb push_back
#define fst first
#define snd second
#define fill(a,c) memset(&a, c, sizeof(a))
#define fore(i,x,y) for(ll i=x;i<y;i++)
#define FIN ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)

typedef long long ll;
using namespace std;

int main() {FIN;
    int n; cin>>n;
    vector<int> v(n);
    fore(i,0,n) cin>>v[i];
    int dp[n];
    dp[0] = 0;
    fore(i,1,n){
        dp[i] = 1e9;
        if(i-1>=0)  dp[i] = min(dp[i],dp[i-1]+abs(v[i]-v[i-1]));
        if(i-2>=0)  dp[i] = min(dp[i],dp[i-2]+abs(v[i]-v[i-2]));
    }
    cout<<dp[n-1]<<"\n";
    return 0;
}


Measured memory_bytes: 3976
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define yesno(flg) if(flg){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define MAX_N 1002
#define i197 1000000007

using namespace std;

typedef long long ll;
typedef pair<ll,ll> P1;
typedef pair<int,int> Pi;
typedef pair<double,Pi> Pdi;
typedef pair<ll,int>Pli;
typedef pair<P1,ll> P2;
const ll INF=1000000000000000001;
struct edge{int to,cost;};
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
struct Road{double cost;int a,b;};

int main() {

	ll n;
	ll a,b,c,d;
	string s;

	cin>>n>>a>>b>>c>>d;
	cin>>s;
	for(int i=a-1; i<c-1; i++){
		if(s[i]=='#'&&s[i+1]=='#'){
			cout<<"No"<<endl;
			return 0;
		}
	}
	for(int i=b-1; i<d-1; i++){
		if(s[i]=='#'&&s[i+1]=='#'){
			cout<<"No"<<endl;
			return 0;
		}
	}
	if(c>d){
		for(int i=max(b-2,a); i<d-1; i++){
			if(s[i]=='.'&&s[i+1]=='.'&&s[i+2]=='.'){
				cout<<"Yes"<<endl;
				return 0;
			}
		}
		cout<<"No"<<endl;
	}
	if(c<d)cout<<"Yes"<<endl;
	return 0;

}


Measured memory_bytes: 640
#include<iostream>
#include<algorithm>
#include<bitset>
using namespace std;
int main()
{
    bitset<32> b(0);
    int n;
    cin>>n;
    int k;
    cin>>k;
    for (int l = 0; l <k ; ++l)
    {
        int t;
        cin>>t;
        b.set(t);
    }
    for(int i=0;i< 1<<n ;i++)
    {
        if((i|b.to_ulong())==i)
        {
            cout<<i<<":";
            for(int j=0;j<n;j++)
            {
                if(i>>j & 1)
                {
                    cout<<" "<<j;
                }
            }
            cout<<endl;
        }
       
    }
}


Measured memory_bytes: 3080
#include<bits/stdc++.h>
using namespace std;
int qz(int x)
{
	x-=1;
	x/=10;
	x*=10;
	x+=10;
	return x;
}
int main()
{
	int a[5],b[5],c[5],m=10,n;
	for(int i=0;i<5;i++)
	{
		cin>>a[i];
		b[i]=a[i]%10;
		c[i]=qz(a[i]);
		if(b[i]!=0&&b[i]<m)
		{
			m=b[i];
			n=i;
		}
	}
	cout<<c[0]+c[1]+c[2]+c[3]+c[4]-c[n]+a[n];
	return 0;
}

Measured memory_bytes: 256
sx,sy,tx,ty = list(map(int, input().split()))

x = tx-sx
y = ty-sy
str = ""

str += "R"*x+ "U"*y+ "L"*x+ "D"*y+ "L"+ "U"*(y+1)+ "R"*(x+1)+"D"+ "R"+ "D"*(y+1)+ "L"*(x+1)+ "U"

print(str)

Measured memory_bytes: 3060
#include<stdio.h> 
#include<iostream> 
#include<string.h>
#include<cstring>
#include<string>
#include<math.h>
#include<algorithm>
#include<bits/stdc++.h>
#include<map>
#include<vector>
#include<cmath>
#include<queue>
#include<set>
#define cuttime ios::sync_with_stdio(false)
#define swap(x, y) x ^= y, y ^= x, x^= y
#define INF 0x3f3f3f3f
#define rep(i,a,b) for(int i=(a);i<=(b);++i)
#define dep(i,a,b) for(int i=(a);i>=(b);--i)
#define scan1(x) scanf("%d",&x)
#define scan2(x,y) scanf("%d%d",&x,&y)
#define scan3(x,y,z) scanf("%d%d%d",&x,&y,&z)
#define scanll1(x) scanf("%lld",&x)
#define scanll2(x,y) scanf("%lld%lld",&x,&y)
#define scanll3(x,y,z) scanf("%lld%lld%lld",&x,&y,&z)
#define lowbit(x) (x&(-x))
#define lson l,mid,rt<<1
#define rson mid+1,r,rt<<1|1
#define debug(x) cout <<#x<<": "<<x<<endl
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
const int N=2e5+20;
const int MAX=10000007;
inline ll read() {
    char c=getchar();ll x=0,f=1;
    while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}
    while(c>='0'&&c<='9'){x=x*10+c-'0',c=getchar();}
    return x*f;
}
inline void out(ll x) {   
    if(x>9) out(x/10);   
    putchar(x%10+'0'); 
}
int q[N];
map<int,int>mp,vis;
string s="abcdefghijklmnopqrstuvwxyz";
int main(){
    ll n;
    n=read();
    string ans;
    while(n){
        n--;
        ans+=s[n%26];
        n/=26;
    }
    reverse(ans.begin(),ans.end());
    cout<<ans;
    return 0;
}
/*

 */

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main()
{
    string s;
    cin >> s;
    int n = s.size();
    for(int i = 2; i < n; i++)
    {
        if(s[i-2] != s[i])
        {
            if(n % 2 == 0 ^ s[0] == s[n-1]) cout << "Second" << endl;
            else cout << "First" << endl;
            return 0;
        }
    }
    cout << "Second" << endl;
}


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

#if MYDEBUG
#include "lib/cp_debug.hpp"
#else
#define DBG(...) ;
#endif
#if __cplusplus <= 201402L
template <typename T>
T gcd(T a, T b) { return ((a % b == 0) ? b : gcd(b, a % b)); }
template <typename T>
T lcm(T a, T b) { return a / gcd(a, b) * b; }
#endif
using LL = long long;
constexpr LL LINF = 334ll << 53;
constexpr int INF = 15 << 26;
constexpr LL MOD = 1E9 + 7;

namespace Problem {
using namespace std;

class Solver2 {
 public:
  LL n, k;
  Solver2(LL n, LL k) : n(n), k(k){};

  void solve() {
    LL a = (n / k);
    LL ans = 0;
    DBG(a)
    ans += a * (a - 1) * (a - 2);
    ans += a * (a - 1) * 3;
    ans += a;
    DBG(ans)
    if (k % 2 == 0) {
      if (n % k >= k / 2) a++;
      DBG(a)
      ans += a * (a - 1) * (a - 2);
      ans += a * (a - 1) * 3;
      ans += a;
    }
    cout << ans << endl;
  }
};
}  // namespace Problem

int main() {
  std::cin.tie(0);
  std::ios_base::sync_with_stdio(false);
  // std::cout << std::fixed << std::setprecision(12);
  long long n = 0, k;
  std::cin >> n >> k;

  Problem::Solver2 sol(n, k);
  sol.solve();
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
     
using namespace std;
     
typedef long long ll;
typedef pair<int,int>P;

#define INF 2<<29;
#define F first
#define S second
     
int main(){
  int n;
  int cnt;
  int sum;
  int ans=-INF;
  int temp;
  int f[105]={};
  int p[105][12];
  
  scanf("%d",&n);
  for(int i=0;i<n;i++){
    int a;
    for(int j=0;j<10;j++){
      scanf("%d",&a);
      f[i]+=a<<j;
    }
  }

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

  for(int i=1;i<1024;i++){
    sum=0;
    for(int j=0;j<n;j++){
      temp=(f[j] & i);
      cnt=0;
      for(int k=0;k<10;k++){
	cnt+=temp%2;
	temp/=2;
      }
      sum+=p[j][cnt];
    }
    if(ans<sum) ans=sum;
  }

  printf("%d\n",ans); 
  
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

void change(int A[],int B[]){
	int k[0];
	k[0]=A[0];
	A[0]=B[0];
	B[0]=k[0];
}

int main(){
	int place,cup[3];
	char one,two;
	cup[0]=1;
	cup[1]=0;
	cup[2]=0;
	//A:1 B:0 C:0
	
	while(scanf("%c,%c",&one,&two)!=EOF){
		if(one=='A'){
			if(two=='B')change(&cup[1],&cup[0]);
			else if(two=='C')change(&cup[2],&cup[0]);
		}
		if(one=='B'){
			if(two=='A')change(&cup[1],&cup[0]);
			else if(two=='C')change(&cup[1],&cup[2]);
		}
		if(one=='C'){
			if(two=='A')change(&cup[2],&cup[0]);
			else if(two=='B')change(&cup[1],&cup[2]);
		}
		
	}
	if(cup[0]==1)printf("A\n");
	else if(cup[1]==1)printf("B\n");
	else if(cup[2]==1)printf("C\n");
	
return 0;
}

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

#define MOD (1000000000+7)
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define all(x) x.begin(), x.end()
#define print(vec,l,r) for(int i = l; i <= r; i++) cout << vec[i] <<" "; cout << endl;
#define forf(i,a,b) for(int i = (a); i < (b); i++)
#define forr(i,a,b) for(int i = (a); i > (b); i--)
#define input(vec,N) for(int i = 0; i < (N); i++) cin >> vec[i];

// template starts
typedef long long int ll;

// template ends here

void solve(){
	// code starts from here
	int K;
	string s;
	cin >> K >> s;
	for(int i = 0; i < K; i++){
		cout << s[i];
		if(i == (int)s.size()-1) break;
	}
	if(K < (int)s.size())cout << "..." << endl;
 }

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

	int T;
	T = 1;
	while(T--){
		solve();
	}

	return 0;
}


Measured memory_bytes: 3604
N = gets.to_i
A = gets.split.map(&:to_i)
B = gets.split.map(&:to_i)

limit = B.inject(:+) - A.inject(:+)
cnt1 = 0
cnt2 = 0

A.zip(B).each do |a, b|
  next if a == b

  if a > b
    cnt1 += a - b
  else
    cnt2 += (b - a) / 2
  end
end

if cnt1 <= cnt2
  puts 'Yes'
else
  puts 'No'
end


Measured memory_bytes: 3452
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <map>
#include <numeric>
#include <string>
#include <cmath>
#include <iomanip>
#include <queue>
#include <list>
#include <set>
#include <stack>
#include <cctype>
#include <cmath>

using namespace std;

/* typedef */
typedef long long ll;

/* constant */
const int INF = 1 << 30;
const int NIL = -1;
const int MAX = 10000;
const int mod = 1000000007;
const double pi = 3.141592653589;

/* global variables */

/* function */

/* main */
int main(){

    int n, m, x;
    set<int> odd, even;
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> x;
        odd.insert(x);
    }
    cin >> m;
    for (int i = 0; i < m; i++) {
        cin >> x;
        even.insert(x);
    }

    // ==========================================
    set<int> s;
    set_intersection(odd.begin(), odd.end(),
          even.begin(), even.end(),
          inserter(s, s.begin()));

    for (auto const &e: s) {
        cout << e << '\n';
    }
}



Measured memory_bytes: 23700
n=int(input())
l=list(map(int,input().split()))
dp=[0 for i in range(n)]
dp[1]=abs(l[0]-l[1])
for i in range(n)[2:]:
  dp[i]=min(dp[i-1]+abs(l[i-1]-l[i]),dp[i-2]+abs(l[i-2]-l[i]))
print(dp[-1])

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

int main(){
  int w,flag;
  int b[10]={0};

  while(std::cin >> w){
    for(int i=0;i<10;i++){
      b[i] = 0;
    }
    for(int i=9;i>=0;i--){
      if(w>=std::pow(2,i)){
        w = w - std::pow(2,i);
        b[i] = 1;
      }
    }
    flag = 1;
    for(int i=0;i<10;i++){
      if(flag&&b[i]){
        std::cout << std::pow(2,i);
        flag = 0;
        continue;
      }
      if(b[i]){
        std::cout << ' ' << std::pow(2,i);
      }
    }
    std::cout << std::endl;
  }
}

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

#define trace(...) __f( #__VA_ARGS__ , __VA_ARGS__ )
template <typename Arg1>
void __f( const char* name , Arg1&& arg1 ) {
        cerr << name << " : " << arg1 << "\n";
}
template <typename Arg1, typename... Args>
void __f( const char* na , Arg1&& arg1 , Args&&... args ) {
        const char* c = strchr( na + 1 , ',' );
        cerr.write( na , c - na ) << " : " << arg1 << " , ";
        __f( c + 1 , args... );
}
#define endl "\n"
#define all(V) V.begin(),V.end()
#define Unique(V) sort(all(V)),V.erase(unique(all(V)),V.end())
#define IO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
typedef long long int LL;
typedef pair <int,int> pii;
const int MOD = 1e9 + 7;
const int inf = 1e9;
const double EPS = 1e-9;
const double PI = acos(-1.0);
const long long INF = 1e18;
const int N = 1e5 + 5;

int main( ) {
        IO;
        #ifdef LOCAL
            //freopen( "input.txt" , "r" , stdin );
        #endif // LOCAL
        string s;
        cin >> s;
        if( s == "SUN" ) cout << 7 << endl;
        if( s == "MON" ) cout << 6 << endl;
        if( s == "TUE" ) cout << 5<< endl;
        if( s == "WED" ) cout << 4<< endl;
        if( s == "THU" ) cout << 3<< endl;
        if( s == "FRI" ) cout << 2<< endl;
        if( s == "SAT" ) cout << 1<< endl;
        return 0;
}










Measured memory_bytes: 256
n = int(input())
s = input()
i = 0
ans = 0
while i < n:
    if i > n - 3:
        break
    if s[i] == 'A' and s[i + 1] == 'B' and s[i + 2] == 'C':
        ans += 1
    i += 1
print(ans)

Measured memory_bytes: 3060
/*
	@・ω・@ <だれだろうね
*/

/*****/

#include <iostream>
#include <array>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <iomanip>	//cout << fixed << setprecision(桁数);
#include <stdexcept>
#include <fstream>

//#define int long long

using namespace std;
using ll = long long;
using ld = long double;
using pll = pair<long long, long long>;
template<class T> using pr = pair<T, T>;
template<class T> using vec = vector<T>;

#define debug(x) (std::cerr << x)
#define debugln(x) (std::cerr << x << "\n")
#define debug_tab(n, x) (std::cerr << strMulti("\t",n) << (x) << "\n")
#define debug_cout(x) (std::cerr << #x << " : " <<  (x) << "\n")
#define debug_tabcout(n, x) (std::cerr << strMulti("\t",n) << #x << " : " <<  (x) << "\n")
#define debug_headcout(h, x) (std::cerr << h << " : " <<  (x) << "\n")
#define debug_tabheadcout(n, h, x) (std::cerr << strMulti("\t",n) << h << " : " <<  (x) << "\n")

#define str(n)	(n.toString())

#define rep(i, n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define rep1(i, n) for(ll i=1, i##_len=(n); i<=i##_len; ++i)
#define rrep(i, n) for(ll i=(n)-1; i >= 0; --i)
#define rrep1(i, n) for(ll i=(n); i > 0; --i)
#define step(i, a, n) for(ll i=(a), i##_len=(a)+(n); i<i##_len; ++i)
#define rstep(i, a, n) for(ll i=(a)+(n)-1, i##_len=(a); i>=i##_len; --i)
#define range(i, a, b) for(ll i=(a), i##_len=(b); i<i##_len; ++i)
#define rrange(i, a, b) for(ll i=(b)-1, i##_len=(a); i>=i##_len; --i)
#define all(x) (x).begin(), (x).end()
#define pair(a, b) make_pair(a, b)
constexpr int INF = 2000000100;
constexpr ll MOD = 1000000007;	// 10e9+7
template<class T> bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> T divup(T a, T b) { if (a % b == 0) { return a / b; } return a / b + 1; }
std::string strMulti(std::string t, int n) { std::string out = ""; for (int i = 0; i < n; i++) { out += t; } return out; }
template<class T> T math_P(T m, T n) { T ret = 1; for (T i = m; i > m - n; i--) { ret *= i; } return ret; }
template<class T> T math_C(T m, T n) { T ret = math_P(m, n); for (T i = 2; i <= n; i++) { ret /= i; } return ret; }
template<class T> bool cmp_2nd(pair<T, T> a, pair<T, T> b) { if (a.second != b.second) { return a.second < b.second; } return a.first < b.first; }
template<class T> T mod_pow(T x, T n, const T& p) { T ret = 1; while (n > 0) { if (n & 1) { (ret *= x) %= p; } (x *= x) %= p; n >>= 1; } return ret; }

/*****/

using graph = vec<vec<ll>>;

void Main()
{
	ll x, y, z;
	cin >> x >> y >> z;
	swap(x, y);
	swap(x, z);
	cout << x << " " << y << " " << z;
}

/*****/

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

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

	/**
	ifstream in("input.txt");
	cin.rdbuf(in.rdbuf());
	ofstream out("output.txt");
	cout.rdbuf(out.rdbuf());
	/**/

	/**
	while (true)
	{
		Main();
		std::cerr << flush;
		cout << endl;
	}
	/*/
	Main();
	std::cerr << flush;
	cout << endl;
	/**/

	return 0;
}


Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;

using E = System.Linq.Enumerable;

public class Program
{
    public static void Main()
    {
        var s = Console.ReadLine().Trim();
        var p = s.Count(x => x == '+');
        var m = s.Length - p;
        Console.WriteLine(p - m);
    }
}

Measured memory_bytes: 11220
#include <stdio.h>

int H[250];
 
int main(){
  int i,n;
  
  scanf("%d",&n);

  for( i=0 ; i<n ; i++ ) 
    scanf("%d",&H[i]);
 
  for( i = 1 ; i < n+1 ; i++ ){
    
    printf("node %d: key = %d, ",i,H[i-1]);
    
    if( i / 2 > 1 )
      printf("parent key = %d, ",H[i/2-1]);
    if( i / 2 == 1 )
      printf("parent key = %d, ",H[i/2-1]);
    if( i * 2 < n+1 )
      printf("left key = %d, ",H[i*2-1]);
    if( i * 2 + 1 < n+1 )
      printf("right key = %d, ",H[i*2+1-1]);
    
    printf("\n");
 
  }
 
 
  return 0;
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(ll i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

int main() {
  ll n, m;
  cin >> n >> m;
  map<ll, ll> mp, mx, my;
  rep(i, n) {
    ll x;
    cin >> x;
    mp[x]++;
  }
  for(auto v : mp) {
    ll k = v.first;
    ll num = v.second;
    my[k % m] += num;
    mx[k % m] += num / 2;
  }
  ll ans = my[0] / 2;
  if(m % 2 == 0) ans += my[m / 2] / 2;
  rep2(i, 1, (m + 1) / 2) {
    if(my[i] >= my[m - i]) {
      ans += my[m - i];
      my[i] -= my[m - i];
      ans += min(my[i] / 2, mx[i]);
    } else {
      ans += my[i];
      my[m - i] -= my[i];
      ans += min(my[m - i] / 2, mx[m - i]);
    }
  }
  cout << ans << endl;
}

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

int main(){
  int n,i,ac=0,wa=0,tle=0,re=0;
  cin >> n;
  string s;
  
  for(i=0;i<n;i++){
    cin >> s;
    if(s=="AC"){
      ac++;
    }else if(s=="WA"){
      wa++;
    }else if(s=="TLE"){
      tle++;
    }else{
      re++;
    }
  }
  
  cout << "AC x " << ac << endl;
  cout << "WA x " << wa << endl;
  cout << "TLE x " << tle << endl;
  cout << "RE x " << re << endl;
}

Measured memory_bytes: 3628
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>


#define fo(i,j,l) for(int i=j;i<=l;++i)
#define fd(i,j,l) for(int i=j;i>=l;--i)

using namespace std;
typedef long long ll;
const ll N=21e4;

char s[N];
int n;

int main()
{
	scanf("%s",s+1);
	int lj=0;
	n=strlen(s+1);
	ll ans=0;
	fo(i,1,n)if(s[i]=='B')++lj;
	else ans+=lj;
	cout<<ans<<endl;
}

Measured memory_bytes: 384
(let ((ans 0)
      (mx 10)
      temp)
     (dotimes (i 5)
       (setf temp (read))
       (incf ans (* 10 (ceiling temp 10)))
       (if (not (zerop (rem temp 10))) (setf mx (min mx (rem temp 10)))))
     (if (not (= 10 mx)) (decf ans 10) (setf mx 0))
     (princ (+ mx ans)))

Measured memory_bytes: 15712
#include<bits/stdc++.h>
#define Bye return 0

using namespace std;

void solve(){
    int x, n; cin>>x>>n;

    int hash_table[102];

    int l = 0, r = 101;

    for (int i=l; i<=r; i++)
        hash_table[i] = 0;

    for (int i=0; i<n; i++){
        int num; cin>>num;
        hash_table[num] = 1;
    }

    int ans = l, dis = 101;

    for (int i=l; i<=r; i++){
        if(abs(x-i)<dis && hash_table[i]==0){
            dis = abs(x-i);
            ans = i;
        }
    }

    if(n==0) printf("%d\n", x);
    else printf("%d\n", ans);
}

int main()
{
    solve();

    Bye;
}


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

using namespace std;

struct Bipartite_Matching
{
  vector< vector< int > > graph;
  vector< int > match, alive, used;
  int timestamp;

  Bipartite_Matching(int n)
  {
    timestamp = 0;
    graph.resize(n);
    alive.assign(n, 1);
    used.assign(n, 0);
    match.assign(n, -1);
  }

  void add_edge(int u, int v)
  {
    graph[u].push_back(v);
    graph[v].push_back(u);
  }

  bool dfs(int v)
  {
    used[v] = timestamp;
    for(int i = 0; i < graph[v].size(); i++) {
      int u = graph[v][i], w = match[u];
      if(alive[u] == 0) continue;
      if(w == -1 || (used[w] != timestamp && dfs(w))) {
        match[v] = u;
        match[u] = v;
        return (true);
      }
    }
    return (false);
  }

  int bipartite_matching()
  {
    int ret = 0;
    for(int i = 0; i < graph.size(); i++) {
      if(alive[i] == 0) continue;
      if(match[i] == -1) {
        ++timestamp;
        ret += dfs(i);
      }
    }
    return (ret);
  }
};

int main()
{
  int M, N, B[500], R[500];
  while(scanf("%d %d", &M, &N), M) {
    Bipartite_Matching flow(M + N);
    for(int i = 0; i < M; i++) scanf("%d", &B[i]);
    for(int i = 0; i < N; i++) scanf("%d", &R[i]);
    for(int i = 0; i < M; i++) {
      for(int j = 0; j < N; j++) {
        if(__gcd(B[i], R[j]) > 1) flow.add_edge(i, j + M);
      }
    }
    printf("%d\n", flow.bipartite_matching());
  }
}

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

using ll = long long;

//constant
const double EPS = 1e-10;

#define REP(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, s, e) for (ll i = s; i < e; i++)
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(), (x).rend()

//debug
#define DUMP(x)  cerr << #x << " = " << (x) << endl;
#define DEBUG(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl;

// view vector
template<typename T> void view(T e) { std::cout << e << std::endl; }
template<typename T> void view(const std::vector<T>& v) { for (const auto& e : v) { std::cout << e << " "; } std::cout << std::endl; }
template<typename T> void view(const std::vector<std::vector<T> >& vv) { for (const auto& v : vv) { view(v); } }

// DP
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; }

// ***************************************

int N;

bool cmp(char a, char b) {
	return a == '?' || b == '?' || a == b;
}


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


	vector<bool> ab(1e5, false);
	vector<bool> bc(1e5, false);
	vector<bool> ac(1e5, false);

	int A, B, C;
	A = a.length(); B = b.length(); C = c.length();

	REP(i, A) REP(j, B) if (!cmp(a[i], b[j])) ab[i - j + 50000] = true;
	REP(i, B) REP(j, C) if (!cmp(b[i], c[j])) bc[i - j + 50000] = true;
	REP(i, A) REP(j, C) if (!cmp(a[i], c[j])) ac[i - j + 50000] = true;

	const int M = 2000;
	int ans = 3 * M;

	FOR(i, -2 * M, 2 * M + 1) {
		FOR(j, -2 * M, 2 * M + 1) {
			if (!ab[i + 50000] && !ac[j + 50000] && !bc[j - i + 50000]) {
				int L = min<int>(0, min(i, j));
				int R = max<int>(A, max(B + i, C + j));
				chmin(ans, R - L);
			}
		}
	}

	cout << ans << endl;



	return 0;
}

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

#define mod 1000000007

using namespace std;
 
int main(void){
	
	long long int N, count = 0, sum;
	
	cin >> N;
	
	long long int A[N];
	
	for(long long int i=0; i<N; i++)
		cin >> A[i];
	
	sort(A, A+N);
	
	for(long long int i=0; i<N; i++){
		sum = 0;
		while(A[i] == A[i+1]){
			i++;
			sum++;
		}
		if(sum%2 == 0)
			count++;
	}
	
	cout << count;
	
	return 0;
}

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

int main(){
    string S;
    cin >> S;
    ll cnt = 0;
    for(int i = 0; i < S.size() - 1; i++){
        if(S[i] != S[i + 1]) cnt++;
    }
    cout << cnt << endl;
    return 0;
}   


Measured memory_bytes: 512
/**
 *Code Author: codeknight13
 *Institution: IIT(ISM)
**/

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

/*
use these format of input when number of inputs not provided
while(scanf("%lld",&n)!=EOF)
*/

#define fast ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define ll long long int
#define vi vector< ll >
#define vii vector< vi >
#define viii vector< vii >
#define pii pair< ll , ll >
#define vpii vector< pii >
#define mii unordered_map< ll , ll >
#define mci map< char , ll >
#define pq priority_queue
#define str string
#define len length()
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define nl cout <<  endl
#define sp " "
#define all(ar) ar.begin(), ar.end()
#define itern(n) for (int i=0; i<n; i++)
#define ritern(n) for (int i=n-1; i>=0; i--)
#define sz(x) ((int)(x).size())
#define pi acos(1);                   /* pi */
#define inf (int(1e9+7))
#define fl(x) int(x)
#define mod %(inf)
#define yes "YES"
#define no "NO"
//debugger
#define trace1(x)                cerr << #x << ": " << x << endl;
#define trace2(x, y)             cerr << #x << ": " << x << " | " << #y << ": " << y << endl;
#define trace3(x, y, z)          cerr << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": " << z << endl;
#define trace4(a, b, c, d)       cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << endl;
#define trace5(a, b, c, d, e)    cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << endl;
#define trace6(a, b, c, d, e, f) cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << " | " << #f << ": " << f << endl;


//#------------------------------complete template------------------------------#//


int main()
{
  int n;
  cin >> n;
  vpii a(n);
  for (int i=0; i<n; i++)
  {
    cin >> a[i].ff;
  }
  for (int i=0; i<n; i++)
  {
    cin >> a[i].ss;
    a[i].ff-=a[i].ss;
  }
  sort(all(a));
  ll sum=0;
  for (int i=0; i<n; i++)
  {
    if (a[i].ff>0)
    {
      sum+=a[i].ff;
    }
  }
  cout << sum;
  return 0;
}

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

typedef long long ll;

ll a, b, ans;

ll chk(ll a, ll b, ll c){
    ll mx = max({a, b, c});
    ll mn = min({a, b, c});
    return min(ans, mx-mn);
}

void f(){
    for(int i=0; i<=a/2+1; i++){
        ll x = b*i, y, z;
        ll l = 0, r = b/2+1;
        while(l+3 <= r){
            ll m1 = (l+l+r)/3, m2 = (l+r+r)/3;
            ll r1, r2;
            
            y = m1*(a-i); z = (b-m1)*(a-i);
            if(x && y && z) r1 = chk(x, y, z);
            else r1 = 1e18;
            
            y = m2*(a-i); z = (b-m2)*(a-i);
            if(x && y && z) r2 = chk(x, y, z);
            else r2 = 1e18;
            
            if(r1 < r2) r = m2 - 1;
            else l = m1 + 1;
        }
        for(ll j=l; j<=r; j++){
            y = j*(a-i); z = (b-j)*(a-i);
            if(x && y && z) ans = min(ans, chk(x, y, z));
        }
    }
}

int main(){
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin >> a >> b;
    if(a%3 == 0 || b%3 == 0){ cout << 0; return 0; }
    ans = min(a, b);
    f();
    swap(a, b);
    f();
    cout << ans;
}

Measured memory_bytes: 3644