akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

#define debug(x) cout <<"DEBUG"<<" "<< #x << ":" << x << '\n'

// n回繰り返し
#define rep(i,n) for(int i = 0; i < ((int)(n)); i++)   // 0-indexed昇順
#define rep1(i,n) for(int i = 1; i <= ((int)(n)); i++) // 1-indexed昇順
#define rrep(i,n) for(int i = ((int)(n)-1); i >= 0; i--)  // 0-indexed降順
#define rrep1(i,n) for(int i = ((int)(n)); i >= 1; i--)   // 1-indexed降順
#define all(x) (x).begin(),(x).end()

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vi> vii;  // 2次元配列
typedef vector<ll> vll;
typedef vector<double> vd;
typedef pair<int, int> PII;

template<typename T>
using vec = vector<T>;
template<class T>
using maxheap = std::priority_queue<T>;
template<class T>
using minheap = std::priority_queue<T, std::vector<T>, std::greater<T>>;

template<class T,class U> inline bool chmax(T &a, const U &b){if(a<b){a=b;return 1;}return 0;}
template<class T,class U> inline bool chmin(T &a, const U &b){if(a>b){a=b;return 1;}return 0;}

const ld Pi = std::acos(-1.0L);
const ll infll = (1LL<<62)-1;
const int inf = (1<<30)-1;
const int mod = 1000000007;
// const int mod = 998244353;


/*FUNCs=================================================*/


/*MAIN==================================================*/
signed main(){
    int _StartTime_ = clock();
    cin.tie(nullptr);
    ios::sync_with_stdio(false);   //cin cout 高速化
    // cout << fixed << setprecision(15);

    int x; cin >> x;
    int d = 0, t = 1;
    while(1) {
        d += t;
        ++t;
        if(d>=x) break;
    }
    cout << t-1 << '\n';



    // printf("ExcutionTime: %d /ms\n",1000*(int)((clock()-_StartTime_)/CLOCKS_PER_SEC));
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
constexpr int MOD=1000000007;
//constexpr int MOD=998244353;
#define INF (1<<30)
#define LINF (lint)(1LL<<56)
#define endl "\n"
#define rep(i,n) for(lint (i)=0;(i)<(n);(i)++)
#define reprev(i,n) for(lint (i)=(n-1);(i)>=0;(i)--)
#define Flag(x) (1<<(x))
#define Flagcount(x) __builtin_popcount(x)
#define pint pair<int,int>
#define pdouble pair<double,double>
#define plint pair<lint,lint>
#define fi first
#define se second
typedef long long lint;
int dx[8]={1,1,0,-1,-1,-1,0,1};
int dy[8]={0,1,1,1,0,-1,-1,-1};
const int MAX_N=2e5+5;

int main(void){
    int L,R,d;
    cin >> L >> R >> d;
    int ans=0;
    for(int i=L;i<=R;i++) if(i%d==0) ans++;
    cout << ans << endl;
}

Measured memory_bytes: 3608
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cstdlib>
#include<queue>
#include<set>
#include<cstdio>

using namespace std;

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

typedef vector<int> vec;
typedef vector<vec> mat;

int n;
int a[200000];
int k;

bool func(int x){
    int res = 0;
    rep(i, n){
        if(a[i] % x == 0){
            res += (a[i] / x) - 1;
        }else{
            res += (a[i] / x);
        }
    }
    if(res <= k) return true;
    else return false;
}

int main(){
    cin >> n >> k;
    rep(i, n) cin >> a[i];
    int l = 1, r = 1000000000;
    while(l < r - 1){
        int mid = (l + r) / 2;
        if(func(mid)) r = mid;
        else l = mid;
    }
    if(func(l)) cout << l << endl;
    else cout << r << endl;
}

Measured memory_bytes: 4412
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define endl '\n'
signed main()
{
	 ios_base::sync_with_stdio(false);
	 cin.tie(NULL);
	 cout.tie(NULL);
	 string s;
	 cin>>s;
	 for(int i=0;i<5;i++)
	 	cout<<s[i];
	 cout<<" ";
	 for(int i=6;i<13;i++)
	 	cout<<s[i];
	 cout<<" ";
	 for(int i=14;i<19;i++)
	 	cout<<s[i];
	 cout<<" ";
	 cout<<endl;
	 return 0;
	}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}


template<typename T>
vector<T> compress(vector<T> v){
  sort(v.begin(),v.end());
  v.erase(unique(v.begin(),v.end()),v.end());
  return v;
}

//INSERT ABOVE HERE
signed main(){
  Int n,k,q;
  cin>>n>>k>>q;
  vector<Int> a(n);
  for(Int i=0;i<n;i++) cin>>a[i];

  auto c=compress(a);

  auto check=
    [&](Int d)->Int{
      Int res=0;
      for(Int y:c){
        Int tmp=0,len=0,cnt=0;
        for(Int i=0;i<n;i++){
          if(a[i]<y){
            tmp+=max(0LL,min(len-(k-1),cnt));
            len=cnt=0;
            continue;
          }
          len++;
          if(a[i]<=y+d) cnt++;
        }
        tmp+=max(0LL,min(len-(k-1),cnt));
        chmax(res,tmp);
      }
      return res>=q;
    };

  Int l=-1,r=2e9+1;
  while(l+1<r){
    Int m=(l+r)>>1;
    if(check(m)) r=m;
    else l=m;
  }
  cout<<r<<endl;
  return 0;
}


Measured memory_bytes: 384
import math
n=int(input())
s=[]
for i in range(n):
  m=[int(x) for x in input().split()]
  s.append(m)
d=0
for i in range(n-1):
  for j in range(i+1,n):
    d+=math.sqrt((s[i][0]-s[j][0])**2+(s[i][1]-s[j][1])**2)
ans=d*2/n
print(ans)

Measured memory_bytes: 9124
import core.bitop;
import std.algorithm;
import std.ascii;
import std.bigint;
import std.conv;
import std.functional;
import std.math;
import std.numeric;
import std.range;
import std.stdio;
import std.string;
import std.random;
import std.typecons;
import std.container;

ulong MOD = 1_000_000_007;
ulong INF = 1_000_000_000_000;
alias sread = () => readln.chomp();

void main()
{
    auto n = lread();
    auto s = sread();
    s.uniq.array.length.writeln();
}

T lread(T = long)()
{
    return readln.chomp.to!T();
}

T[] aryread(T = long)()
{
    return readln.split.to!(T[])();
}

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


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

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

  ll X; cin >> X;
  ll c = 100;
  ll ans = 0;

  while (c < X) {
    c += c * 0.01;
    ans++;
  }

  cout << ans << endl;

  return 0;
}


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

using namespace std;

#define pb push_back
#define mp make_pair
#define MOD ((int)(1e9) + 7)
#define fast cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(false)
#define filename "lynext"
#define freop freopen(filename ".cik","w",stdout);freopen(filename ".gir","r",stdin)
const long long int N = ((long long int)1e3) + 5;
const long long int M = ((long long int)1e3) + 5;
const long long int llinf = (long long int)1e18;
const int inf = INT_MAX;
typedef long long int lli;

int n,m;
bool g[N][N];
lli dp[N][N];

lli add (lli x, lli y)
{
	return ((x % MOD) + (y % MOD)) % MOD;
}

lli f (int x, int y)
{
	if (dp[x][y] != -1)
		return dp[x][y];
	if (x > n || y > m || g[x][y] == true)
		return INT_MIN;
	lli t1 = max(f(x + 1,y),(lli)0);
	lli t2 = max(f(x,y + 1),(lli)0);
	return dp[x][y] = add(t1,t2);
}

int main ()
{
	fast;
	//freop;
	cin >> n >> m;
	memset(dp, -1, sizeof dp);
	dp[n][m] = 1;
	for (int i = 1; i <= n; i++)
	{
		for (int j = 1; j <= m; j++)
		{
			char c;
			cin >> c;
			if (c == '#')
				g[i][j] = true;
		}
	}
	cout << f(1,1) << "\n";
}


Measured memory_bytes: 9344
import sys
BASE, MOD1, MOD2 = (1<<30), (1<<61)-1, (1<<31)-1

class RollingHash():
	def __init__(self, s, base, mod):
		self.mod = mod
		self.pw = pw = [1]*(len(s)+1)

		l = len(s)
		self.h = h = [0]*(l+1)

		v = 0
		for i in range(l):
			h[i+1] = v = (v * base + s[i]) % mod
		v = 1
		for i in range(l):
			pw[i+1] = v = v * base % mod

	# [l. r)
	def get(self, l, r):
		return (self.h[r] - self.h[l] * self.pw[r-l]) % self.mod

	def concatenate(self, l1, r1, l2, r2):
		return (self.get(l1, r1) * self.pw[r2-l2] + self.get(l2, r2)) % self.mod


n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
if n == 1:
	print(0, a[0]^b[0])
	sys.exit()
x = [a[n-1]^a[0]]
y = [b[n-1]^b[0]]
for i in range(n-1):
	x.append(a[i]^a[i+1])
	y.append(b[i]^b[i+1])

rh1_x, rh1_y = RollingHash(x, BASE, MOD1), RollingHash(y, BASE, MOD1)
rh2_x, rh2_y = RollingHash(x, BASE, MOD2), RollingHash(y, BASE, MOD2)
for k in range(n):
	if rh1_y.concatenate(n-k, n, 0, n-k) == rh1_x.get(0, n) and rh2_y.concatenate(n-k, n, 0, n-k) == rh2_x.get(0, n):
		print(k, a[0]^b[(n-k)%n])

Measured memory_bytes: 136168
N,K = map(int,input().split())
x = list(map(int,input().split()))

ans = 10**18
for i in range(N - K + 1):
    p1 = x[i]
    p2 = x[i+K-1]
    lr = abs(p1) + abs(p2 - p1)
    rl = abs(p2) + abs(p1 - p2)
    if lr < rl:
        ans = min(ans,lr)
    else:
        ans = min(ans,rl)
print(ans)


Measured memory_bytes: 14252
import java.util.*;
import java.math.*;
public class Main{
  public static void main(String[] args){
    Scanner scn = new Scanner(System.in);
    BigDecimal input1 = scn.nextBigDecimal();
    BigDecimal input2 = scn.nextBigDecimal();
    BigDecimal big = input1.multiply(input2);  
    BigInteger value = big.toBigInteger();
        System.out.println(value);
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
  }
  
  
  
  
  
  
  
  
  
  
  
  
  
}

Measured memory_bytes: 37592
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {

    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("Failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();

    token.parse().ok().expect("failed to parse token")

}


fn main() {
    let n: u32 = read();
    let v: Vec<_> = read::<String>().chars().collect();
    let mut s: Vec<u32> = Vec::new();
    let mut ans = 1;
    ans *= v.iter().filter(|&n| *n == 'R').count();
    ans *= v.iter().filter(|&n| *n == 'G').count();
    ans *= v.iter().filter(|&n| *n == 'B').count();

    for &c in &v {
        match c {
            'R' => s.push(1),
            'G' => s.push(2),
            'B' => s.push(4),
            _ => ()
        }
    }

    for i in 0..n {
        for j in i+1..n {
            let k = 2*j-i; // j−i≠k−jから、条件を満たさないk
            if k >= n {
                continue
            }
            if s[i as usize] + s[j as usize] + s[k as usize] == 7 {
                ans -= 1;
            }
        }
    }
    println!("{}", ans);
}



Measured memory_bytes: 2172
#include <cstdio>
#include <iostream>
#include <cmath>
#include <ctype.h>
#include <string> 
#include <sstream>
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <queue>
#include <utility>
#include <vector>
#include <set>
#include <list>
#include <cstring>
#include <stack>
   
using namespace std;

string solve(string s)
{
    string ans = "";
    int plusnum = 0;
    for(int i = 0; i < s.length(); i++){
        if(s[i] == '+'){
            plusnum++;
        } else if(s[i] == '-'){
            plusnum--;
        } else if(s[i] == '['){
            string news = "";
            int kakkonum = 1;
            i++;
            while(kakkonum != 0){
                if(s[i] == ']') kakkonum--;
                if(kakkonum == 0) break;
                if(s[i] == '[') kakkonum++;
                news += s[i];
                i++;
            }
            // cout << news << endl;
            news = solve(news);
            // cout << news << endl;
            reverse(news.begin(), news.end());
            ans += news;
        } else {
            if(s[i] == '?'){
                ans += 'A';
            } else {
                int tmp = s[i] - 'A' + plusnum;
                while(tmp < 0) tmp += 26;
                while(tmp > 25) tmp -= 26;
                // cout << (char)tmp + 'A' << endl;
                ans += (char)tmp + 'A';  
            }
            plusnum = 0;
        }
    }
    return ans;
}

int main()
{
    string s;
    while(1){
        cin >> s;
        if(s == ".") break;
        cout << solve(s) << endl;
    }
    return 0;
}

Measured memory_bytes: 1204
//#define _GLIBCXX_DEBUG

#include<bits/stdc++.h>
#define PI 3.14159265359
using namespace std;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
const int INF= 1e9+5;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll> >vvl;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> T;
const ll MOD=1000000007LL;
string abc="abcdefghijklmnopqrstuvwxyz";
string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
//素因数分解O(√n)
map<ll,ll>prime_factor(ll n){
  map<ll,ll>res;
  for(ll i=2;i*i<=n;i++){
    while(n%i==0){
      res[i]++;
      n/=i;
    }
  }
  if(n!=1)res[n]=1;
  return res;
}
ll modpow(ll a, ll n, ll mod) {
  
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

int main(){
  ll n;cin>>n;
  vector<ll>a(n);
  rep(i,n)cin>>a[i];
  map<ll,ll>M;
  rep(i,n){
    map<ll,ll>part=prime_factor(a[i]);
    for(auto p:part){
      M[p.first]=max(p.second,M[p.first]);
    }
  }
  ll ans=0;
  ll MAX=1;
  for(auto p:M){
    MAX*=modpow(p.first,p.second,MOD);
    MAX%=MOD;
  }
  rep(i,n){
    ans+=MAX*modpow(a[i],MOD-2,MOD);
    ans%=MOD;
  }
  cout<<ans<<endl;
}
  
          

Measured memory_bytes: 896
import sys
input = sys.stdin.buffer.readline

# https://note.nkmk.me/python-union-find/
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())


N, M, K = map(int, input().split())
uf = UnionFind(N)

n_friend = [0]*N
for i in range(M):
    a, b = map(int, input().split())
    uf.union(a-1, b-1)
    n_friend[a-1] += 1
    n_friend[b-1] += 1

n_block_in_friend_cluster = [0]*N
for i in range(K):
    c, d = map(int, input().split())
    if uf.same(c-1, d-1):
        n_block_in_friend_cluster[c-1] += 1
        n_block_in_friend_cluster[d-1] += 1

ans = [uf.size(i) - n_friend[i] - n_block_in_friend_cluster[i] - 1 for i in range(N)]
print(*ans)

Measured memory_bytes: 14884
import scala.io.{ StdIn => in}

object Main extends App {
  val n = in.readInt
  val ans = in.readLine.take(n)
    ./:(0,0)((acc,ch) => {
      val x = if(ch == 'I') acc._2 + 1 else acc._2 - 1
      (math.max(acc._1, x), x)
    })._1
  println(ans)
}

Measured memory_bytes: 25408
#include <iostream>
using namespace std;
bool Init(int *a, int *b);


int main()
{
	int a[4], b[4];
	int cntHits, cntBlow;
	while (Init(a, b))
	{
		cntHits = cntBlow = 0;
		for (int i = 0; i < 4; ++i)
		{
			if (a[i] == b[i]) ++cntHits;
		}
		for (int i = 0; i < 4; ++i)
		{
			for (int j = 0; j < 4; ++j)
			{
				if (i != j && a[i] == b[j]) ++cntBlow;
			}
		}
		cout << cntHits << " " << cntBlow << endl;
	}
	return 0;
}
bool Init(int *a, int *b)
{
	while (cin >> a[0] >> a[1] >> a[2] >> a[3] >> b[0] >> b[1] >> b[2] >> b[3])
	{
		return true;
	}
	return false;
}

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

class Cell {
	int data;
	Cell next;
	Cell prev;

	Cell(int data) {
		this.data = data;
	}
}

class DLList {
	final Cell header;

	DLList() {
		header = new Cell(-1);
		header.next = header;
		header.prev = header;
	}
	void insert(int x) {
		Cell c = new Cell(x);
		Cell d = header.next;
		c.next = d;
		c.prev = header;
		header.next = c;
		d.prev = c;
	}
	Cell search(int x) {
		Cell c = header.next;
		while(c.data != x) {
			c = c.next;
			if(c == header) {
				return header;
			}
		}
		return c;
	}
	void delete(int x) {
		Cell c = search(x);
		if(c == header) {

		} else {
			c.prev.next = c.next;
			c.next.prev = c.prev;
		}
		c = null;
	}
	void deleteFirst() {
		Cell c = header.next;
		header.next = c.next;
		c.next.prev = header;
		c = null;
	}
	void deleteLast() {
		Cell c = header.prev;
		c.prev.next = header;
		header.prev = c.prev;
		c = null;
	}
}

//双方向連結リスト
public class Main {
	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		DLList list = new DLList();
		try {
			int n = Integer.parseInt(br.readLine());
			for(int i = 0; i < n; i++) {
				String[] str = br.readLine().split(" ");
				if(str[0].startsWith("i")) {
					int a = Integer.parseInt(str[1]);
					list.insert(a);
				} else if(str[0].equals("deleteFirst")) {
					list.deleteFirst();
				} else if(str[0].equals("deleteLast")) {
					list.deleteLast();
				} else {
					int a = Integer.parseInt(str[1]);
					list.delete(a);
				}
			}
			Cell c = list.header.next;
			while(c != list.header) {
				if(c.next == list.header) {
					System.out.println(c.data);
				} else {
					System.out.print(c.data + " ");
				}
				c = c.next;
			}
		} catch(IOException e) {
			System.out.println("error");
		} finally {
			try {
				br.close();
			} catch(IOException e) {

			}
		}
	}

}



Measured memory_bytes: 189764
#include<iostream>
#include<algorithm>
using namespace std;
main(){
	int N;
	while(cin>>N,N){
		int te[N],ba=0;
		for(int i=0;i<N;++i)te[i]=0;
		string str;
		cin>>str;
		for(int i=0;i<100;++i){
			int m=i%N;
			if (str[i]=='M'){
				te[m]++;
			}else if(str[i]=='S'){
				ba+=te[m]+1;
				te[m]=0;
			}else if(str[i]=='L'){
				te[m]+=ba+1;
				ba=0;
			}
		}
		sort(te,te+N);
		for(int i=0;i<N;++i)cout<<te[i]<<" ";
		cout<<ba<<endl;
	}
}

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

int main(int argc, const char * argv[]) {
    // insert code here...
    int A, B;
    cin >> A >> B;
    int C = A + B;
    
    if (A % 3 == 0 || B % 3 == 0 || C % 3 == 0) cout << "Possible" << endl;
    else cout << "Impossible" << endl;
    
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

// cpp_binarysearch (C) @cielavenir under Boost Software License.
// returns the smallest value satisfying the predicate.
// type F should be something like std::function<bool(T)>.

template<typename T,typename F>
T binarysearch(T lo,T hi,const T eps,const F &predicate){
	T r=hi+eps;
	for(;lo<hi+eps;){
		T mi=eps!=1||(lo<0)==(hi<0) ? lo+(hi-lo)/2 : (lo<-hi) ? -((-lo-hi-1)/2+1) : (lo+hi)/2;
		if(predicate(mi)){
			r=mi;
			hi=mi-eps;
		}else{
			lo=mi+eps;
		}
	}
	return r;
}
template<typename T,typename F>
T binarysearch(T lo,T hi,const F &predicate){return binarysearch(lo,hi,(T)1,predicate);}

template<typename F>
double binarysearch(double _lo,double _hi,const F &predicate){
	long long lo;
	if(_lo<0)_lo=-_lo,lo=-*(long long*)(&_lo);else lo=*(long long*)(&_lo);
	long long hi;
	if(_hi<0)_hi=-_hi,hi=-*(long long*)(&_hi);else hi=*(long long*)(&_hi);
	long long _r=binarysearch(lo,hi,1LL,[&](long long _mi){
		double mi;
		if(_mi<0)_mi=-_mi,mi=-*(double*)(&_mi);else mi=*(double*)(&_mi);
		return predicate(mi);
	});
	double r;
	if(_r<0)_r=-_r,r=-*(double*)(&_r);else r=*(double*)(&_r);
	return r;
}

int a[100000];
int ok(int M,int N,int C){
	int sum=0,ret=1,i=0;
	for(;i<N;i++){
		if(a[i]>M)return 0;
		sum+=a[i];
		if(sum>M)sum=a[i],ret++;
	}
	return ret<=C;
}
int main(){
	int N,C,i=0;
	scanf("%d%d",&N,&C);
	for(;i<N;i++)scanf("%d",a+i);
	printf("%d\n",binarysearch(0,1<<30,[&](int m){
		return ok(m,N,C);
	}));
}

Measured memory_bytes: 1396
from collections import Counter

n = int(input())
ans = Counter(input())

for i in range(n - 1):
    _ans = ans.copy()
    c = Counter(input())
    s = _ans.keys() & c.keys()
    ans = {}
    for k in s:
        ans[k] = min(_ans[k], c[k])

anstr = "".join(sorted([k * ans[k] for k in ans.keys()]))

print(anstr)


Measured memory_bytes: 9452
#include <iostream>
#include <string> 
#include <vector> 
#include <algorithm> 
#include <utility> 
#include <tuple> 
#include <cstdint> 
#include <cstdio> 
#include <map> 
#include <queue> 
#include <set> 
#include <stack> 
#include <deque> 
#include <unordered_map> 
#include <unordered_set> 
#include <bitset> 
#include <cctype> 
#include<math.h>
using namespace std;

#define int long long
#define endl "\n"
#define fir first
#define sec second
#define fro front
#define m_p make_pair
#define mod 1000000007
#define all(v)  v.begin(),v.end()
#define rep(i,n)  for(int i=0; i<(int) (n); i++)
#define all(v)  v.begin(),v.end()
#define vecin(v) for(int i=0; i<(int)v.size(); i++)cin>>v[i];
using namespace std;

const int MAX = 510000;
const int MOD = 1000000007;
long long fac[MAX], finv[MAX], inv[MAX];
int jousu(int x00, int y00) {
	int z00 = 1;
	for (int i = 0; i < y00; i++) {
		z00 *= x00;
	}
	return z00;
}
int keta(int x00) {
	int z00 = x00;
	int w00 = 0;
	while (z00 != 0) {
		z00 /= 10;
		w00++;
	}
	return w00;
}

int modinv(int a, int m) {
	int b = m, u = 1, v = 0;
	while (b) {
		int t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
int modpow(int a, int n) {
	int res = 1;
	while (n > 0) {
		if (n & 1) res* a% mod;
		a = a * a % mod;
		n >>= 1;
	}
	return res;
}
int gcd(int xx, int yy) {
	int p = xx;
	int q = yy;
	if (q > p)swap(p, q);
	while (p % q != 0) {
		p %= q;
		swap(p, q);
	}
	return q;
}
int lcm(int xx, int yy) {
	return xx * yy / gcd(xx, yy);
}
bool prime(int xx) {
	int a = xx;
	for (int i = 2; i * i <= xx; i++) {
		if (xx % i == 0) {
			return 0;
		}
	}
	return 1;
}
int com(int xx, int yy) {
	int zz = 1;
	for (int i = xx; i > xx - yy; i--) {
		zz *= i;
		zz %= mod;
	}
	for (int i = 1; i <= yy; i++) {
		zz *= modinv(i, mod);
		zz %= mod;
	}
	return zz;
}



signed main() {
	int n,k;
	string s;
	cin >> n >> k >> s;
	s[k - 1] = s[k - 1] - 'A' + 'a';
	cout << s << endl;
}


Measured memory_bytes: 256
#[allow(unused_imports)]
use std::cmp::Ordering;

#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};

#[allow(unused_imports)]
use std::io::{stdin, stdout, BufWriter, Write};

#[allow(unused_imports)]
use std::iter::FromIterator;

#[allow(unused_macros)]
macro_rules! min {
    ($x: expr) => ($x);
    ($x: expr, $($z: expr),+) => {{
        std::cmp::min($x, min!($($z),*))
    }}
}

#[allow(unused_macros)]
macro_rules! max {
    ($x: expr) => ($x);
    ($x: expr, $($z: expr),+) => {{
        std::cmp::max($x, max!($($z),*))
    }}
}

#[allow(unused_macros)]
macro_rules! get {
    ([$t: ty]) => {
        {
            let mut line = String::new();
            stdin().read_line(&mut line).unwrap();
            line.split_whitespace().map(|t|t.parse::<$t>().unwrap()).collect::<Vec<_>>()
        }
    };
    ([$t: ty];$n: expr) => {
        (0..$n).map(|_|get!([$t])).collect::<Vec<_>>()
    };
    ($t: ty) => {
        {
            let mut line = String::new();
            stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t: ty),*) => {
        {
            let mut line = String::new();
            stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            ($(iter.next().unwrap().parse::<$t>().unwrap(),)*)
        }
    };
    ($t: ty; $n: expr) => {
        (0..$n).map(|_|get!($t)).collect::<Vec<_>>()
    };
    ($($t: ty),*; $n: expr) => {
        (0..$n).map(|_|get!($($t),*)).collect::<Vec<_>>()
    };
}

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

const BIG_STACK_SIZE: bool = true;

#[allow(dead_code)]
fn main() {
    use std::thread;
    if BIG_STACK_SIZE {
        thread::Builder::new()
            .stack_size(32 * 1024 * 1024)
            .name("solve".into())
            .spawn(solve)
            .unwrap()
            .join()
            .unwrap();
    } else {
        solve();
    }
}

fn solve() {
    let n = get!(usize);
    let mut s = get!([usize]);

    s.sort();
    let mut parents = vec![s[(1 << n) - 1]];
    let mut cands = BTreeMap::new();
    for e in s {
        *cands.entry(e).or_insert(0) += 1;
    }
    for _ in 0..n {
        let mut new_parents = Vec::new();
        for &p in &parents {
            let mut zero = None;
            for (key, value) in cands.iter_mut().rev() {
                if *key < p {
                    *value -= 1;
                    new_parents.push(*key);
                    if *value == 0 {
                        zero = Some(*key);
                    }
                    break;
                }
            }
            if let Some(key) = zero {
                cands.remove(&key);
            }
        }
        parents.extend(&new_parents);
    }

    if parents.len() == 1 << n {
        println!("Yes");
    } else {
        println!("No");
    }
}


Measured memory_bytes: 16752
n,m = map(int,input().split(" "))
h = list(map(int,input().split(" ")))
low = []
better = 0
for i in range(m):
  a,b = map(int,input().split(" "))
  if h[a-1] > h[b-1]:
    low.append(b)
  elif h[a-1] < h[b-1]:
    low.append(a)
  else:
    low.append(a)
    low.append(b)
print(n-len(set(low)))

Measured memory_bytes: 20112
#include<iostream>
#include<string>
#include<queue>
#include<set>
#include<map>
#include<vector>
#include<algorithm>
#define inf 1000000007
using namespace std;
map<int,int> mp;
void fz(int x)
{
  int k=2;
  while (x!=1)
  {
    if (x%k==0) mp[k]++,x/=k;
    else k++;
  }
}
long long solve(int x)
{
  long long res=1;
  for (int i=1;i<=x;i++)
    fz(i);
  for (int i=1;i<=x;i++)
  {
    res*=mp[i]+1;
    res%=inf;
  }
  return res;
}
int main()
{
  int N;
  cin>>N;
  cout<<solve(N)<<endl;
  //system("pause");
  return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <string>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <iterator>
#include <cassert>
#include <numeric>
#pragma warning(disable:4996) 
 
typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF  9223300000000000000
#define LINF2 1223300000000000000
#define INF 2140000000
const long long MOD = 1000000007;
//const long long MOD = 998244353;

using namespace std;


void solve()
{
    int n;
    scanf("%d", &n);
    vector<int> a(n);
    int flag = 0;
    int i;
    int cnt = 0;
    for (i = 0; i < n; i++) {
        scanf("%d", &a[i]);
    }
    for (i = 0; i < n; i++) {
        if (i > 0) {
            if (a[i] > a[i - 1]) {
                if (flag < 0) {
                    cnt++;
                    flag = 0;
                    continue;
                }
                flag = 1;
            }
            else if (a[i] < a[i - 1]) {
                if (flag > 0) {
                    cnt++;
                    flag = 0;
                    continue;
                }
                flag = -1;
            }
        }
    }
    printf("%d\n", cnt + 1);


    return;
}

int main(int argc, char* argv[])
{
#if 1
    solve();
#else
    int T;
    scanf("%d", &T);
    int t;
    for(t=0; t<T; t++) {
        printf("Case #%d: ", t+1);
        solve();
    }
#endif
    return 0;
}



Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
 
typedef long long ll;
#define FIN ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define forr(i, a, b) for(int i = (a); i < (int) (b); i++)
#define forn(i, n) forr(i, 0, n)
#define pb push_back
#define mp make_pair
#define all(c) (c).begin(),(c).end()
#define DBG(x) cerr << #x << " = " << (x) << endl
#define DBGV(v,n) forn(i,n) cout << v[i] << " "; cout << endl
#define esta(x,c) ((c).find(x) != (c).end())
#define RAYA cerr << "===============================" << endl
#define MAXN 2005


int main()
{ 
	FIN;
	
	#ifdef input
		//freopen("test1.txt", "r", stdin);
	#endif
	
	int n, k;
	cin >> n >> k;
	vector <ll> v(n);
	forn(i,n) cin >> v[i];
	sort(all(v));
	ll ans = 0;
	forn(i,k) ans+=v[i];
	cout << ans;
		
		
	
	return 0;
}


Measured memory_bytes: 3656
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
int main(){
    string s;
    cin >> s;
    map<char,int>c_kosu;
    int cnt=0;
    rep(i,s.size()) if(s[i] < 'a')cnt++;
    bool hantei = false;

    if(s[0] == 'A'){
        for(int i=2; i<=s.size()-2; i++) c_kosu[s.at(i)]++;
        if(c_kosu['C'] == 1){
            if(cnt ==2) hantei=true;
        }
    }
    if(hantei) cout << "AC" <<endl;
    else cout << "WA" << endl;
    return 0;
}

Measured memory_bytes: 256
#pragma region Macros
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define rep2(i, a, b) for(ll i = a; i <= b; ++i)
#define rep(i, n) for(i = 0; i < n; ++i)
#define rep3(i, a, b) for(ll i = a; i >= b; --i)
using namespace std;

// _________コーディングはここから！！___________

int n, m, k, i;
constexpr int N = 200010;
int a[N], b[N];
constexpr int sz = 5000000;
char reader[sz];
char *pos = reader;
int nn, now, ans;
int kk;
main() {
    reader[fread(reader, sizeof(char), sizeof(char) * sz, stdin)];
    while('0' <= *pos) n = n * 10 + *pos++ - '0';
    pos++;
    while('0' <= *pos) m = m * 10 + *pos++ - '0';
    pos++;
    while('0' <= *pos) k = k * 10 + *pos++ - '0';
    nn = n;
    pos++;
    rep(i, n) {
        while('0' <= *pos) a[i + 1] = a[i + 1] * 10 + *pos++ - '0';
        pos++;
        a[i + 1] += a[i];
        if(a[i + 1] > k) {
            nn = i;
            ++i;
            for(; i < n; ++i) {
                while('0' <= *pos) pos++;
                pos++;
            }
            break;
        }
    }
    while(*pos and *pos <= 32) pos++;
    rep(i, m) {
        while('0' <= *pos) b[i + 1] = b[i + 1] * 10 + *pos++ - '0';
        pos++;
        b[i + 1] += b[i];
        if(b[i + 1] > k) {
            m = i;
            break;
        }
    }
    now = ans = nn;
    for(i = 1; i <= m; i++) {
        kk = k - b[i];
        while(a[now] > kk) now--;
        ans = max(ans, i + now);
    }
    pos = reader;
    i = 0;
    do {
        *pos++ = ans % 10 + '0';
        ans /= 10;
        i++;
    } while(ans);
    reverse(reader, reader + i);
    fwrite(reader, sizeof(char), sizeof(char) * i, stdout);
}


Measured memory_bytes: 7820
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scn = new Scanner(System.in);
		while (true) {
			int H = scn.nextInt();
			int W = scn.nextInt();
			if (H == 0 && W == 0) {
				break;
			}
			for (int i = 0; i < H; i++) {
				if (i == 0 || i == H - 1) {
					for (int j = 0; j < W; j++) {
						System.out.print("#");
					}
					System.out.println();
				} else {
					System.out.print("#");
					for (int j = 2; j < W; j++) {
						System.out.print(".");
					}
					System.out.println("#");
				}
			}
			System.out.println();
		}
	}
}



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

const int INF = 1001001001;
vector<int> to[100005];

int main() {
  int n, m;
  cin >> n >> m;
  rep(i, m) {
    int a, b;
    cin >> a >> b;
    --a, --b;
    to[a].push_back(b);
    to[b].push_back(a);
  }
  queue<int> q;
  vector<int> dist(n, INF);
  vector<int> pre(n, -1);
  dist[0] = 0;
  q.push(0);
  while (!q.empty()) {
    int v = q.front();
    q.pop();
    for (int u : to[v]) {
      if (dist[u] != INF) continue;
      dist[u] = dist[v] + 1;
      pre[u] = v;
      q.push(u);
    }
  }
  cout << "Yes" << endl;
  rep(i, n) {
    if (i == 0) continue;
    int ans = pre[i];
    ++ans;
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 10548
n=int(input())
a=list(map(int,input().split()))
q=int(input())
b=[0]*q
c=[0]*q
s=[0]*(q+1)
for i in range(q):
	b[i],c[i]=map(int,input().split())
f={}
for i in range(n):
	f.setdefault(a[i],0)
for i in range(n):
	f[a[i]]+=1
for g,h in f.items():
	#print(len(h)*g)
	s[0]=s[0]+h*g
#print(f)
for i in range(1,q+1):
	if b[i-1] in f:
		if c[i-1] in f:
			f[c[i-1]]=f[c[i-1]]+f[b[i-1]]
			s[i]=s[i-1]-f[b[i-1]]*b[i-1]
			#print(s[i])
			
			s[i]=s[i]+f[b[i-1]]*c[i-1]
			f.pop(b[i-1])
		else:
			f.setdefault(c[i-1],0)
			f[c[i-1]]=f[c[i-1]]+f[b[i-1]]
			s[i]=s[i-1]-f[b[i-1]]*b[i-1]
			#print(s[i])
			
			s[i]+=f[b[i-1]]*c[i-1]
			f.pop(b[i-1])
	#print(f)
	#for g,h in f.items():
		#print(len(h)*g)
		#s[i]=s[i]+len(h)*g
	else:
		s[i]=s[i-1]
	print(s[i])

Measured memory_bytes: 30200
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
typedef long long int ll;

int main(){
  int a,b;
  scanf("%d%d",&a,&b);
  if(b%a==0) printf("%d\n",a+b);
  else printf("%d\n",b-a);
  return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
const int p[7]={2,3,5,7,11,13,17};
const int q[7]={9,6,4,3,3,3,3};

int n,ans;
int m[350],r[350],w[350],v[350];

void dfs(int x) {
	if (x==7)
	{
		memset(w,0,sizeof(w));
		int res=0;
		for (int i=1;i<=n;i++)
		{
			int tmp=m[i],flag=0;
			for (int j=0;j<7;j++)
			{
				for (int k=0;k<r[j];k++)
					if (tmp%p[j]==0) tmp/=p[j]; else break;
				if (tmp%p[j]==0) {flag=1; break;}
			}
			if (flag) continue;
			w[tmp]+=v[i];
		}
		res=w[1];
		for (int i=2;i<=300;i++)
			if (w[i]>0) res+=w[i];
		ans=max(ans,res);
		return;
	}
	for (int i=0;i<q[x];i++) {r[x]=i; dfs(x+1);}
}

int main()
{
	scanf("%d",&n);
	for (int i=1;i<=n;i++) scanf("%d %d",&m[i],&v[i]);
	dfs(0);
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 256
N=int(input())
A=list(map(int,input().split()))+[0]
csum=[abs(A[i]-A[i-1]) for i in range(N+1)]
csum=sum(csum)
cdiff=[abs(A[i+1]-A[i-1])-abs(A[i]-A[i-1])-abs(A[i+1]-A[i]) for i in range(N)]
for _ in cdiff:
  print(csum+_)

Measured memory_bytes: 14048
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
using namespace std;

#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 1000000007;
const ll MAX = 1000001;

ll max(ll a, ll b) {
	if (a > b) { return a; }
	return b;
}

ll min(ll a, ll b) {
	if (a > b) { return b; }
	return a;
}

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

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



///////////////////////////



int main() {

	string s;
	ll K;
	cin >> s >> K;

	ll d = s.size();

	ll n[200];

	repn(i, d) {
		n[i] = s[i - 1] - '0';
	}
	
	ll dp[200][2][4] = {};//上からi桁、未満フラグ、0でないものの個数

	dp[0][1][0] = 1;

	repn(i, d) {
		rep(j, 4) {
			dp[i][0][j] = dp[i - 1][0][j];
			if (n[i] != 0) { dp[i][0][j] += dp[i - 1][1][j];}
			else { dp[i][1][j] = dp[i - 1][1][j]; }
		}

		repn(j, 3) {
			dp[i][0][j] += 9 * dp[i - 1][0][j - 1];
			if (n[i] != 0) {dp[i][0][j]+= (n[i] - 1) * dp[i - 1][1][j - 1]; }
			if (n[i] != 0) {
				dp[i][1][j] += dp[i - 1][1][j - 1];
			}

			
		}

	}


	cout << dp[d][0][K] + dp[d][1][K];





	system("PAUSE");

}


Measured memory_bytes: 504
//
//AtCoder Beginner Contest 175
//A
//

#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <ctime>
#include <queue>
#include <map>
#include <set>
#include <tuple>
#include <functional>
#include <cassert>
#include <bitset>

using namespace std;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define SIZE(x) (int)(x).size()
#define SIZEL(x) (ll)(x).size()
#define MSG(a) cout << #a << " " << a << endl;

using ll = long long;
using ld = long double;
using Graph = vector<vector<int>>;

const double PI = 3.14159265358979323846;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

ll gcd(ll x, ll y) { return (x % y)? gcd(y, x % y): y; }    //最大公約数
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }            //最小公倍数

int main()
{
    string s;
    cin >> s;

    int rCnt=0;
    int ans=0;
    REP(i, s.size()){
        if (s[i]=='R') {
            rCnt++;
        }else{
            ans = max(ans, rCnt);
            rCnt=0;
        }
    }
    ans = max(ans, rCnt);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
#define rep(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(v) v.begin(), v.end()
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; }
using ll = long long;
const ll mod = 1e9+7; ll LLINF = 1LL << 60; int INF = INT_MAX;

//
class mint {
    long long x;
public:
    mint(long long x=0) : x((x%mod+mod)%mod) {}
    mint operator-() const { 
      return mint(-x);
    }
    mint& operator+=(const mint& a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint& a) {
        if ((x += mod-a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const  mint& a) {
        (x *= a.x) %= mod;
        return *this;
    }
    mint operator+(const mint& a) const {
        mint res(*this);
        return res+=a;
    }
    mint operator-(const mint& a) const {
        mint res(*this);
        return res-=a;
    }
    mint operator*(const mint& a) const {
        mint res(*this);
        return res*=a;
    }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }
    // for prime mod
    mint inv() const {
        return pow(mod-2);
    }
    mint& operator/=(const mint& a) {
        return (*this) *= a.inv();
    }
    mint operator/(const mint& a) const {
        mint res(*this);
        return res/=a;
    }

    friend ostream& operator<<(ostream& os, const mint& m){
        os << m.x;
        return os;
    }
};


int main(){
    ll n,k;
    cin>>n>>k;
    mint sum=0;
    for(ll i=k; i<=n+1; i++){
        sum+=n*(n+1)/2 - (n-i+1)*(n-i)/2 - i*(i-1)/2 + 1;
    }
    cout<<sum<<endl;
}

Measured memory_bytes: 3636
# pythonでスタック、キューを実現するためにdequeをimport
from collections import deque

N, M = map(int, input().split())

# 辺集合EとグラフGの構築
G = [[] for _ in range(N)]
E = []
for _ in range(M):
    a, b = map(int, input().split())
    # 入力は1-indexedだがこれを扱いやすいように0-indexedに変更
    a -= 1
    b -= 1
    E.append((a, b))
    G[a].append(b)
    G[b].append(a)
# print(G)

# 橋を数えるための変数cntを用意
cnt = 0
for edge_to_remove in E:
    # 橋であるか判定したい辺を取り除いてみる
    i, j = edge_to_remove
    G[i].remove(j)
    G[j].remove(i)

    # 深さ優先探索
    seen = [False] * N
    todo = deque()
    # 適当な頂点から深さ優先探索をスタート（ここでは頂点0をスタートに選んだ）
    todo.append(0)
    seen[0] = True
    seen_nodes_num = 0
    while todo:
        here = todo.pop()
        seen_nodes_num += 1
        for neighbor in G[here]:
            if seen[neighbor] == False:
                seen[neighbor] = True
                todo.append(neighbor)
    # print(seen)
    # もし訪問できていない頂点があれば連結でないというなので今着目している辺は橋であった！
    if seen_nodes_num != N:
        cnt += 1

    # 次の辺について調べるために今取り除いた辺を再びGに戻しておく
    G[i].append(j)
    G[j].append(i)
print(cnt)


Measured memory_bytes: 3316
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigDecimal;

public class Main {

	private static BufferedReader brStdin = new BufferedReader(new InputStreamReader(System.in));
	private static String[] readBuf = null;
	private static int readPtr = 0;
	private static String getString() throws IOException {
		while ( readBuf == null || readPtr >= readBuf.length ) {
			readBuf = brStdin.readLine().split(" ");
		}
		return readBuf[readPtr++];
	}
	private static int getInt() throws IOException {
		return Integer.parseInt(getString());
	}
	private static long getLong() throws IOException {
		return Long.parseLong(getString());
	}
	private static BigDecimal getBD() throws IOException {
		return new BigDecimal(getString());
	}
	@SuppressWarnings("unused")
	private static String[] getStringArray(int size) throws IOException {
		String stringArray[] = new String[size];
		for (int i = 0; i < stringArray.length; i++) {
			stringArray[i] = getString();
		}
		return stringArray;
	}
	@SuppressWarnings("unused")
	private static int[] getIntArray(int size) throws IOException {
		int intArray[] = new int[size];
		for (int i = 0; i < intArray.length; i++) {
			intArray[i] = getInt();
		}
		return intArray;
	}
	@SuppressWarnings("unused")
	private static long[] getLongArray(int size) throws IOException {
		long longArray[] = new long[size];
		for (int i = 0; i < longArray.length; i++) {
			longArray[i] = getLong();
		}
		return longArray;
	}
	@SuppressWarnings("unused")
	private static BigDecimal[] getBDArray(int size) throws IOException {
		BigDecimal bdArray[] = new BigDecimal[size];
		for (int i = 0; i < bdArray.length; i++) {
			bdArray[i] = getBD();
		}
		return bdArray;
	}
	
	public static void main(String args[]) throws IOException {
		int n = getInt();
		int l = getInt();

		int p;
		if ( l >= 0 ) {
			p=0;
		} else if ( l <= 1-n ) {
			p=n-1;
		} else {
			p = n;
		}

		int t = 0;
		for ( int i = 0 ; i < n ; i++ ) {
			if ( i != p ) {
				t += l + i ;
			}
		}
		System.out.println(t);
	}
}


Measured memory_bytes: 21204
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <cstdlib>
using namespace std;
typedef long long LL;
const int inf = 1 << 30;
const LL INF = 1LL << 60;
const int MaxN = 100005;

int n;
struct Point {
	int t, x, y;
	Point () {}
	Point (int a, int b, int c) {
		t = a; x = b; y = c;
	}
}PP[MaxN + 5];

int dis(Point A, Point B) {
	return (abs(A.x - B.x) + abs(A.y - B.y));
}

int main()
{
	while(scanf("%d", &n) != EOF)
	{
		for(int i = 1; i <= n; i++)
			scanf("%d %d %d", &PP[i].t, &PP[i].x, &PP[i].y);
		PP[0] = Point(0, 0, 0);
		bool flag = 1;
		for(int i = 1; i <= n; i++) {
			int T = PP[i].t - PP[i - 1].t;
			int D = dis(PP[i], PP[i - 1]);
			int tmp = T - D;
			if(tmp < 0 || (tmp & 1) ) {
				flag = 0;
				break;
			}
		}
		if(flag == 1) printf("Yes\n");
		else printf("No\n");
	}
	return 0;
}

Measured memory_bytes: 1280
/// IN THE NAME OF METAL
#include <bits/stdc++.h>

using namespace std;

typedef long long int ll;
typedef pair<ll, ll> pll;

#define sz(x)                       (ll) x.size()
#define all(x)                      (x).begin(),(x).end()
#define F                           first
#define S                           second

ll Pow(ll a, ll b, ll md, ll ans = 1) {
    for (; b; b >>= 1, a = a * a % md)
        if (b & 1)
            ans = ans * a % md;
    return ans % md;
}

const ll MAXN = 1e6 + 10;
const ll INF = 8e18;
const ll MOD = 998244353;
ll n, k, fact[MAXN], inv[MAXN], res[MAXN];

ll C(ll x, ll y) {
    if (x > y) return 0;
    return fact[y] * inv[x] % MOD * inv[y - x] % MOD;
}

int main() {
    fact[0] = inv[0] = 1;
    for (ll i = 1; i < MAXN; i++) {
        fact[i] = fact[i - 1] * i % MOD;
        inv[i] = Pow(fact[i], MOD - 2, MOD);
    }
    scanf("%lld%lld", &k, &n);
    for (ll i = 2; i <= 2 * k; i++) {
        ll ans = 0;
        for (ll j = 0; j <= i / 2; j++) {
            if (j & 1) {
                ans = (ans - C(n - j - j, k + n - j * 2 - 1) * C(j, i / 2) % MOD + MOD) % MOD;
            } else {
                ans = (ans + C(n - j - j, k + n - j * 2 - 1) * C(j, i / 2) % MOD) % MOD;
            }
        }
        res[i] = ans;
        if (i <= k + 1) printf("%lld\n", res[i]);
        else printf("%lld\n", res[k + k + 2 - i]);
    }
    return 0;
}



Measured memory_bytes: 17664
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstring>
#include <iomanip>

using namespace std;

int main(){
   int N;
   cin >> N;
   vector<pair<int, int>> V;

   for(int i=0;i<N;i++){
      int A,B;
      cin >> A >> B;
      V.push_back(make_pair(B,A));
   }
   sort(V.begin(),V.end());
   long long curTime=0;
   for(int i=0;i<N;i++){
      curTime += V[i].second;
      if(curTime > V[i].first){
         cout <<"No" << endl;
         return 0;
      }
   }

   cout << "Yes"<< endl;
   return 0;
}


Measured memory_bytes: 2420
#include<bits/stdc++.h>
using namespace std;
 
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define rrep(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define vsort(v) sort(v.begin(), v.end());
#define rvsort(v) sort(v.begin(), v.end(),greater<int>());
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return
#define lb(v,n) lower_bound(v.begin(),v.end(),n)
#define ub(v,n) upper_bound(v.begin(),v.end(),n)
#define mae(v) max_element(v.begin(),v.end())
#define mie(v) min_element(v.begin(),v.end())
#define INF 0x7FFFFFFF
#define mod 1000000007
#define fir first
#define sec second
typedef long long ll;
////////////////////////////////////////////////////////////

int main(){
	int n;
	cin >> n;
	vector<int> a(n,1);

	int cnt1 = 0 , cnt2 = 0 , cnt4 = 0;
	rep(i,0,n){
		int tmp;
		cin >> tmp;
		if( tmp % 2 == 0 ){
			if( tmp % 4 == 0 ) cnt4++;
			else cnt2++;
		}
		else cnt1++;
	}

	if( cnt2 % 2 ) cnt1++;
	if( n % 2 ){
		if( cnt1 > cnt4+1 ) No;
		else Yes;
	}
	else{
		if( cnt1 > cnt4 ) No;
		else Yes;
	}

	ret 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <map>
#include <bitset>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>

using namespace std;

void printv(int v[], int len) {
	for (int i = 0; i < len; i++)
		cout << " " << v[i];
	cout << endl;
}

int main() {
	int n, m;
	int c[20];
	cin >> n >> m;
	for (int i = 0; i < m; i++)
		cin >> c[i];
	int dp[50001] = {};
	fill_n(dp, 50001, INT_MAX / 2);
	dp[0] = 0;
	for (int i = 0; i < m; i++) {
		for (int j = c[i]; j <= n; j++)
			dp[j] = min(dp[j], dp[j-c[i]] + 1);
//		printv(dp, n+1);
	}
	cout << dp[n] << endl;
	return 0;
}

Measured memory_bytes: 1364