akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <stdlib.h>

#define MAX_E 100000

typedef struct edge{
    int s;
    int t;
    int w;
} edge;

int *p;
int *rank;
int V,E; // V:頂点, E:辺
edge es[MAX_E];

void unite(int, int);
void init(int);
void link(int, int);
int findSet(int);
int Same(int, int);
int comp(const void *, const void *);
int kuruskal(void);

int main(){
    int s,t,w;
    int i;
    int c=0;
    edge e;
    int res;

    scanf("%d %d", &V, &E);

    for(i=0;i<E;i++){
        scanf("%d %d %d", &s,&t,&w);
        e.s=s;
        e.t=t;
        e.w=w;
        es[c++]=e;
    }

    // クラスカル法で最小全域木を計算
    res=kuruskal();

    printf("%d\n",res);

    return 0;
}

// 初期化
void init(int n){
    int i;

    // create S
    p = (int *)malloc(n*sizeof(int));
    rank = (int *)malloc(n*sizeof(int));

    // make Set
    for(i=0;i<n;i++){
        p[i] = i;
        rank[i]=0;
    }
}

// xとyの属する集合を併合
void unite(int x, int y){
    link(findSet(x),findSet(y));
}

// xとyの属する集合を併合
void link(int x, int y){
    if(rank[x] > rank[y]) p[y] = x;
    else{
        p[x]=y;
        if(rank[x]==rank[y]) rank[y]=rank[x]+1;
    }
}

// 木のrootを求める
int findSet(int x){
    if(x!=p[x]) p[x]=findSet(p[x]);
    return p[x];
}

// xとyが同じ集合に属するか否か
int Same(int x, int y){
    if(findSet(x)==findSet(y)) return 1;
    else return 0;
}

// compare
int comp(const void * e1, const void * e2){
    return ((const edge*)e1)->w - ((const edge*)e2)->w;
}

// クラスカル法
int kuruskal(void){
    int res;
    int i;
    edge e;

    qsort(es,E,sizeof(es[0]),comp); // edge.wの小さい順

    init(V); // Union-Findの初期化

    res=0; // 答え, 辺の重みの総和

    for(i=0;i<E;i++){
        e=es[i];
        if(Same(e.s,e.t)==0){
            unite(e.s,e.t);
            res+=e.w;
        }
    }

    return res;
}


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

int main() {
  
  int n;
  cin >> n;
  int two = 0;
  int num = 0;
  
  for(int i = 0; i < n; i++){
    int x;
    cin >> x;
    if(x % 2 == 0){
      two++;
      if(x % 3 == 0){
        num++;
      }
      else if(x % 5 == 0){
        num++;
      }
    }
  }
  
  if(two == num){
    cout << "APPROVED" << endl;
  }
  else{
    cout << "DENIED" << endl;
  }
  
 
  
  

}



Measured memory_bytes: 3604
use std::slice::Iter;
use std::iter::Iterator;
use std::iter::Rev;
use std::iter::once;

#[derive(Clone, Debug)]
pub struct Scan2<I, St, F> {
    iter: I,
    f: F,
    state: St,
}

impl<I, St, F> Scan2<I, St, F> {
    fn new(iter: I, state: St, f: F) -> Scan2<I, St, F> {
        Scan2 { iter: iter, state: state, f: f }
    }
}

impl<I, St, F> Iterator for Scan2<I, St, F>
where
    I: Iterator + Iterator2,
    F: Fn(&St, I::Item) -> St,
    St: Clone,
{
    type Item = St;

    #[inline]
    fn next(&mut self) -> Option<St> {
        let o = self.iter.next();
        if let Some(a) = o {
            self.state = (self.f)(&self.state, a);
            Some(self.state.clone())
        } else {
            None
        }
    }
}

pub trait Iterator2 : Iterator {
    fn scan2<St, F>(self, initial_state: St, f: F) -> Scan2<Self, St, F>
    where
        F: Fn(&St, Self::Item) -> St,
        Self: std::marker::Sized,
    {
        Scan2::new(self, initial_state, f)
    }
}

impl<'a, T> Iterator2 for Iter<'a, T> {
}

impl<T: DoubleEndedIterator> Iterator2 for Rev<T> {
}

fn solve(_n: usize, a: [Vec<i32>; 2]) -> i32 {
    let s1 = a[0].iter().scan2(0, |&s, x| s + x);
    let sum2: i32 = a[1].iter().sum();
    let s2 = once(sum2).chain(a[1].iter().scan2(sum2, |&s, x| s - x));
    s1.zip(s2).map(|(x, y)| x + y).max().unwrap()
}

fn read_n(_n: usize) -> Vec<i32> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.split_whitespace().map(|w| w.trim().parse().ok().unwrap()).collect()
}

fn main() {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    let n = s.trim().parse().ok().unwrap();
    let a1 = read_n(n);
    let a2 = read_n(n);
    let ans = solve(n, [a1, a2]);
    println!("{}", ans);
}


Measured memory_bytes: 4352
#include <cstdio>
#include <cstring>
#include <vector>
#include <algorithm>

using namespace std;

int dp[1000005];
int dp2[1000005];
int pl[180];

int main() {
	//init
	for (int i = 1; i<=180; i++)pl[i-1] = (i*(i + 1)*(i + 2)) / 6;
	memset(dp, 0x7f, sizeof(dp));
	memset(dp2, 0x7f, sizeof(dp2));
	dp[0] = 0;
	dp2[0] = 0;
	for (int i = 0; i < 1000000; i++) {
		for (int j = 0; j < 180; j++) {
			if(i+pl[j] <= 1000000)dp[i + pl[j]] = min(dp[i] + 1, dp[i + pl[j]]);
			if (i + pl[j] <= 1000000 && pl[j]&1)dp2[i + pl[j]] = min(dp2[i] + 1, dp2[i + pl[j]]);
		}
	}
	while (1) {
		int n;
		scanf("%d", &n);
		if (n == 0)break;
		printf("%d %d\n", dp[n], dp2[n]);
	}
	return 0;
}

Measured memory_bytes: 10472
#include <algorithm>
#include <cmath>
#include <iostream>
#include <limits>
#include <vector>

using namespace std;

int main() {
  int N, K;
  cin >> N >> K;
  vector<int> h(N);
  for (int i = 0; i < N; ++i) cin >> h[i];

  vector<int> dp(N, numeric_limits<int>::max());
  dp[0] = 0;
  for (int i = 0; i < N; ++i) {
    for (int k = 1; k <= K; ++k) {
      if (i >= k) dp[i] = min(dp[i], dp[i - k] + abs(h[i] - h[i - k]));
    }
  }
  cout << dp[N - 1] << endl;
  return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<=(b);++i)
using namespace std;
const int P=1e9+7,N=(1<<16)+5;
int n,m,a[20],f[20][N],fac[N],ifac[N],inv[N];
void addx(int&k1,int k2){(k1+=k2)>=P&&(k1-=P);}
int C(int k1,int k2){
	if(k1<0||k2<0||k1-k2<0)return 0;
	return 1LL*fac[k1]*ifac[k2]%P*ifac[k1-k2]%P;
}
int main(){
	fac[0]=fac[1]=ifac[0]=ifac[1]=inv[0]=inv[1]=1;
	rep(i,2,N-1)fac[i]=1LL*fac[i-1]*i%P,inv[i]=1LL*(P-P/i)*inv[P%i]%P,ifac[i]=1LL*ifac[i-1]*inv[i]%P;
	scanf("%d%d",&n,&m);
	rep(i,0,m-1)scanf("%d",&a[i]);
	sort(a,a+m,greater<int>());
	f[0][0]=1;
	rep(i,0,m-1){
		memcpy(f[i+1],f[i],sizeof(f[i]));
		rep(j,0,(1<<n)-1)if(f[i][j]){
			rep(k,0,n-1)if(~j>>k&1){
				addx(f[i+1][j^(1<<k)],1LL*f[i][j]*C((1<<n)-j-a[i],(1<<k)-1)%P*fac[1<<k]%P);
			}
		}
	}
	int ans=0;
	rep(i,0,(1<<n)-1)addx(ans,1LL*f[m][i]*fac[(1<<n)-1-i]%P*(__builtin_popcount(i)&1?P-1LL:1LL)%P);
	ans=1LL*ans*(1<<n)%P;
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 8640
#include <bits/stdc++.h>
#define endl "\n"
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

template<class T>
inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}

const long long INF = 1e18;
//const ll mod = 1000000007;
ll A, B, N;
ll f(ll x) {
    return (A * x / B) - A * (x / B);
}


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> A >> B >> N;
    cout << f(min(N, B - 1)) << endl;
    return 0;
}

Measured memory_bytes: 3600
#include<stdio.h>

int main(void)
{
	int x[10000], y[10000], t,i,cnt;

	for (i = 0; i < 3000; i++) {
		scanf("%d %d", &x[i], &y[i]);
		if ((x[i] == 0) && (y[i] == 0))
			break;

		else {
			if (x[i] > y[i])
			{
				t = x[i];
				x[i] = y[i];
				y[i] = t;
			}
		}
	}

	cnt = i;

 for(i = 0;i < cnt;i++)
   printf("%d %d\n",x[i],y[i]);


	return 0;
}




Measured memory_bytes: 2776
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
int main() {

 int a,b;
 string op;
  
  while(op != "?") {
    cin >> a >> op >> b;
    
    if (op == "+") {
      cout << a + b << endl;
    }
    else if (op == "-") {
      cout << a - b << endl;
    }
    else if (op == "*") {
      cout << a * b << endl;
    }
    else if (op == "/") {
      cout << a / b << endl;
    }
    else {
      break;
    }
  }
}


Measured memory_bytes: 3088
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		try (Scanner scan = new Scanner(System.in)) {
			int n = scan.nextInt();
			int[][] mat = new int[n][n];
			for(int i=0; i<n; i++) {
				int from = scan.nextInt();
				int toNum = scan.nextInt();
				for(int j=0; j<toNum; j++) {
					int to = scan.nextInt();
					mat[from-1][to-1] = 1;
				}
			}
			for(int i=0; i<n; i++) {
				for(int j=0; j<n; j++) {
					System.out.print(mat[i][j]);
					if(j < n-1) System.out.print(" ");
				}
				System.out.println();
			}
		}
	}
}



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

int n;
int a[100000], b[100000];
bool f[100000];
const long long mod = 1000000007;

int main(){
	cin >> n;
	for (int i = 0; i < n; i++) cin >> a[i];
	for (int i = 0; i < n; i++) cin >> b[i];
	if (a[n - 1] != b[0]){
		cout << "0\n";
		return 0;
	}
	long long res = 1;
	for (int i = 1; i < n - 1; i++){
		if (a[i - 1] != a[i] && a[i] > b[i]) res = 0;
		if (b[i] != b[i + 1] && b[i] > a[i]) res = 0;
		if (a[i - 1] == a[i] && b[i] == b[i + 1]){
			res = res * min(a[i], b[i]) % mod;
		}
	}
	cout << res << endl;
}

Measured memory_bytes: 1024
package main

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

func main() {
	io := NewIo(os.Stdin, os.Stdout)
	defer io.Flush()
	s := io.Next()
	sum := 0
	for i := range s {
		sum += int(s[i] - '0')
	}
	if sum%9 == 0 {
		io.Println("Yes")
	} else {
		io.Println("No")
	}
}

// Io is I/O object
type Io struct {
	reader    *bufio.Reader
	writer    *bufio.Writer
	tokens    []string
	nextToken int
}

// NewIo returns a new Io instance
func NewIo(r io.Reader, w io.Writer) *Io {
	return &Io{
		reader: bufio.NewReader(r),
		writer: bufio.NewWriter(w),
	}
}

// Flush flushes writer
func (io *Io) Flush() {
	err := io.writer.Flush()
	if err != nil {
		panic(err)
	}
}

// NextLine scans a line from stdin
func (io *Io) NextLine() string {
	var buffer []byte
	for {
		line, isPrefix, err := io.reader.ReadLine()
		if err != nil {
			panic(err)
		}
		buffer = append(buffer, line...)
		if !isPrefix {
			break
		}
	}
	return string(buffer)
}

// Next return a word from stdin
func (io *Io) Next() string {
	for io.nextToken >= len(io.tokens) {
		line := io.NextLine()
		io.tokens = strings.Fields(line)
		io.nextToken = 0
	}
	r := io.tokens[io.nextToken]
	io.nextToken++
	return r
}

// Println is a wrapper of fmt.Fprintln
func (io *Io) Println(a ...interface{}) {
	fmt.Fprintln(io.writer, a...)
}


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

int main(){
	long long int x;
	cin>>x;
	long long int day=0,bal=100;
	while(true){
		day++;
		bal+=bal/100;
		if(bal>=x){
			return cout<<day<<endl,0;
		}
	}
	return 0;
}


Measured memory_bytes: 3592
#include <stdio.h>

int main(void) {
  int arr[4];
  for (int i = 0; i < 4; i++) scanf("%d", &arr[i]);

  while (arr[0] > 0 && arr[2] > 0) {
    arr[2] -= arr[1];
    if (arr[2] <= 0) {
      printf("Yes\n");
      return 0;
    }
    arr[0] -= arr[3];
    if (arr[0] <= 0) {
      printf("No\n");
      return 0;
    }
  }

  return 0;
}


Measured memory_bytes: 1616
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <cassert>
using namespace std;
  
//???¨????
int calc(vector<string> vec){
    vector<int> stack;
      
    for(int i =0; i < vec.size(); i++){
    //  cout << "i="<< i << "::" << vec[i] << endl;
          
        int res = 0;
        int sw = vec[i][0];
        switch(sw){
            case '+':{
               int num1 = stack.back();
               stack.pop_back();
               int num2 = stack.back();
               stack.pop_back();
               res  = num1 + num2;
               stack.push_back(res);
//   cout << num1 << "+"<< num2 << "=" << res << endl; 
               break;
            }
            case '-':{
               int num1 = stack.back();
               stack.pop_back();
               int num2 = stack.back();
               stack.pop_back();
    //   cout << "num1="<< num1 << endl;
    //   cout << "num2="<< num2 << endl;
               res  = num2 - num1;
//   cout << num2 << "-"<< num1 << "=" << res << endl; 
               stack.push_back(res);
               break;
            }
            case '*':{
               int num1 = stack.back();
               stack.pop_back();
               int num2 = stack.back();
               stack.pop_back();
    //   cout << "num1="<< num1 << endl;
    //   cout << "num2="<< num2 << endl;
               res  = num1 * num2;
//   cout << num1 << "*"<< num2 << "=" << res << endl; 
              stack.push_back(res);
               break;
            }
            case '/':{
               int num1 = stack.back();
               stack.pop_back();
               int num2 = stack.back();
               stack.pop_back();
               //0??????
               assert(num1 != 0);
                res  = num2 / num1;
               stack.push_back(res);
               break;
            }
            default: {
               stack.push_back(stoi(vec[i]));
               //res =  stoi(stack[i]);
            }
        }
        // cout <<"when i=" <<i << ";switch res::" << res << endl;
    }
    int ans = 0 ;
    ans = stack[0];
    return ans;
}
  
int main(){
    //input
    vector<string> vec;
    while(1){
        string str;
        cin >> str;
        if(cin.eof()){
            break;
        }
        vec.push_back(str);
    }
      
    //calc
    int result = calc(vec);
      
    //output
    cout << result << endl;
      
    return 0;
}

Measured memory_bytes: 3208
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
int main() {
	cin.tie(0); ios::sync_with_stdio(false);
	string str;
	while (cin >> str) {
		if (str == "#") break;
		vector<vector<char>> masu(1);
		int r = 0;
		for (int i = 0; i < str.length();i++) {
			if (str[i] == 'b') masu[r].push_back(str[i]);
			else if (str[i] == '/') { r++; masu.push_back(vector<char>(0)); }
			else {
				int key = str[i] - '0';
				for (int j = 0; j < key;j++) masu[r].push_back('.');
			}
		}
		int a, b, c, d; cin >> a >> b >> c >> d;
		swap(masu[a-1][b-1], masu[c-1][d-1]);
		for (int i = 0; i < masu.size();i++) {
			for (int j = 0; j < masu[0].size();j++) {
				if (masu[i][j] == 'b') cout << 'b';
				else {
					int k = j;
					for (;k < masu[0].size();k++) {
						if (masu[i][k] == 'b') { cout << k - j;break; }
						else {
							continue;
						}
					}
					if (k == masu[0].size()) cout << k - j;
					j = k-1;
				}
			}
			if (i != masu.size() - 1)cout << "/";
		}
		cout << endl;
	}
}

Measured memory_bytes: 3144
import numpy as np

x1, y1, x2, y2 = map(int, input().split())

# x1, y1, x2, y2 = 0,0,0,1

a1 = np.array([x1, y1])
a2 = np.array([x2, y2])

v = a2 - a1
S = np.array([[0, -1], [1, 0]])

a3 = a2 + np.dot(S, v)
SS = np.dot(S, S)
a4 = a3 + np.dot(SS, v)

ans = [a3[0], a3[1], a4[0], a4[1]]
ans = map(str, ans)
print(" ".join(ans))


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

#define rep(i, a, b) for(int i = (a); i < (b); ++i)
#define all(x) begin(x), end(x)
typedef long long ll;
typedef pair<int, int> pii;
const int inf=1010001000;
const ll  INF=1001000100010001000;
const int mod=(int)1e9+7;
using Graph = vector<vector<int>>;

int main(){
    int n,m;
    cin>>n>>m;
    vector<vector<int>>g(n,vector<int>());
    vector<int> dist(n, -1);
    queue<int> que;
    rep(i,0,m){
        int a,b;
        cin>>a>>b;
        a--;b--;
        g.at(a).push_back(b);
        g.at(b).push_back(a);
    }
    dist[0] = 0;
    que.push(0); // 0 を橙色頂点にする

    // BFS 開始 (キューが空になるまで探索を行う)
    while (!que.empty()) {
        int v = que.front(); // キューから先頭頂点を取り出す
        que.pop();

        // v から辿れる頂点をすべて調べる
        for (int nv : g[v]) {
            if (dist[nv] != -1) continue; // すでに発見済みの頂点は探索しない

            // 新たな白色頂点 nv について距離情報を更新してキューに追加する
            dist[nv] = dist[v] + 1;
            que.push(nv);
        }
    }

    rep(i,0,n){
        if(dist.at(i)==-1){
            cout<<"No"<<endl;
            return 0;
        }
    }
    cout<<"Yes"<<endl;
    rep(i,1,n){
        for(auto p:g.at(i)){
            if(dist.at(p)==dist.at(i)-1){
                cout<<p+1<<endl;
                break;
            }
        }
    }
return 0;
}

Measured memory_bytes: 10352
#include <cstring>
#include <sstream>
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <cmath>
#include <queue>
#include <set>
#include <stack>

using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for(ll i = n - 1; i >= 0; i--)
#define repone(i, n) for(ll i = 1; i <= (ll)(n); i++)
#define each(i, mp) for(auto i:mp)
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const ll mod = 1000000007;
const ll inf = ll(1e9);
const ll half_inf = ll(1e5);
const ll ll_inf = ll(1e9) * ll(1e9);
typedef unordered_map<ll, ll> ump;
typedef pair<ll, ll> P;

ump mp;

int main() {
#ifdef MY_DEBUG
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wmissing-noreturn"
    while (true) {
        mp = ump();
#pragma clang diagnostic pop
#endif
        int a, b, c;
        cin >> a >> b >> c;
        cout << min(c, b / a) << endl;


#ifdef MY_DEBUG
    }
#endif
    return 0;
}

Measured memory_bytes: 256
N = int(input())
S = list(input())
w_count = 0
e_count = 0
count_sum = [0 for k in range(N)]
for i in range(1,N):
    if S[i - 1] == "W":
        w_count += 1
    count_sum[i] += w_count
for q in range(N-2,-1,-1):
    if S[q + 1] == "E":
        e_count += 1
    count_sum[q] += e_count
print(min(count_sum))

Measured memory_bytes: 17528
package main

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

// I/O
type Scanner struct {
	sc *bufio.Scanner
}

func NewScanner() *Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), int(1e+9))
	return &Scanner{sc}
}

func (s *Scanner) nextStr() string {
	s.sc.Scan()
	return s.sc.Text()
}

func (s *Scanner) nextInt() int {
	i, e := strconv.Atoi(s.nextStr())
	if e != nil {
		panic(e)
	}
	return i
}

func (s *Scanner) nextFloat() float64 {
	f, e := strconv.ParseFloat(s.nextStr(), 64)
	if e != nil {
		panic(e)
	}
	return f
}

func (s *Scanner) nextRuneSlice() []rune {
	return []rune(s.nextStr())
}

func (s *Scanner) nextIntSlice(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextInt()
	}
	return res
}

func (s *Scanner) nextFloatSlice(n int) []float64 {
	res := make([]float64, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextFloat()
	}
	return res
}

// Arithmetic
func max(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m < i {
			m = i
		}
	}
	return m
}

func min(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m > i {
			m = i
		}
	}
	return m
}

func abs(x int) int {
	if x > 0 {
		return x
	}
	return -x
}

func pow(x, y int) int {
	res := 1
	for i := 0; i < y; i++ {
		res *= x
	}
	return res
}

func ceil(a, b int) int {
	if a%b == 0 {
		return a / b
	} else {
		return a/b + 1
	}
}

// Sort
type RuneSlice []rune

func (a RuneSlice) Len() int           { return len(a) }
func (a RuneSlice) Less(i, j int) bool { return a[i] < a[j] }
func (a RuneSlice) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }

// Main
func main() {
	sc := NewScanner()
	wtr := bufio.NewWriter(os.Stdout)
	N := sc.nextInt()
	C := make([][]int, 10)
	for i := 0; i < 10; i++ {
		C[i] = make([]int, 10)
	}
	for i := 1; i <= N; i++ {
		head, tail := f(i)
		C[head][tail]++
	}
	ans := 0
	for i := 1; i <= 9; i++ {
		for j := 1; j <= 9; j++ {
			ans += C[i][j] * C[j][i]
		}
	}

	fmt.Fprintln(wtr, ans)
	wtr.Flush()
}

func f(n int) (int, int) {
	if n < 10 {
		return n, n
	}
	tail := n % 10
	var head int
	n /= 10
	for {
		rest := n % 10
		n /= 10
		if n == 0 {
			head = rest
			break
		}
	}
	return head, tail
}


Measured memory_bytes: 640
#include <bits/stdc++.h> //C++の標準ライブラリを一行で一括でインクルードする
#include <math.h> //数学関数と数学定数を利用する
#define rep(i,n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
template<class T> void chmax(T &a,T b) { if (a<b) a=b;}
template<class T> void chmin(T &a,T b) { if (a>b) a=b;}

int main(){
  int n; string s;
  cin >> n >> s;
  
  int ans = 0;
  int cnt = 0;
  rep(i,n){
    if(s[i]=='I') cnt++;
    else cnt--;
    chmax(ans,cnt);
  }
  
  cout << ans;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int,int>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
const ll INF = 1LL << 60;

int main(){
    int a,b,c,k;
    cin >> a >> b >> c >> k;
    while(true){
        if(a<b) break;
        if(k==0){
            cout << "No" << endl;
            return 0;
        }
        b *= 2;
        k --;
    }
    while(true){
        if(b<c) break;
        if(k==0){
            cout << "No" << endl;
            return 0;
        }
        c *= 2;
        k --;
    }

    cout << "Yes" << endl;

}

Measured memory_bytes: 3668
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
typedef int64_t llong;
char moji[26]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
char moji2[26]={'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
char moji3[10]={'0','1','2','3','4','5','6','7','8','9'};
#define Sort(a) sort(a.begin(),a.end());
#define Reverse(a) reverse(a.begin(),a.end());
#define ld PRId64


int main(){
    int n,m;
    cin >> n >> m;
    int a,b;
    set<int> iti,enu;
    REP(i,m){
        scanf("%d%d",&a,&b);
        if( a == 1){
            if(enu.erase(b) == 1){
                cout <<"POSSIBLE"<< endl;
                return 0;
            }

            iti.insert(b);
        }
        else if( b == 1){
            if(enu.erase(a) == 1){
                cout <<"POSSIBLE"<< endl;
                return 0;
            }

            iti.insert(a);
        }

        else if( b == n){
            if(iti.erase(a) == 1){
                cout <<"POSSIBLE"<< endl;
                return 0;
            }

            enu.insert(a);
        }

        else if( a == n){
            if(iti.erase(b) == 1){
                cout <<"POSSIBLE"<< endl;
                return 0;
            }

            enu.insert(b);
        }
    }
    cout << "IMPOSSIBLE" << endl;
}

Measured memory_bytes: 9600
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <queue>
#include <string>
#include <set>
#include <bitset>
#include <unordered_map>

using namespace std;
using ll = long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;
template <class T>
using Vvec = vector<vector<T> >;

int main()
{
    string S;
    ll K;
    cin >> S >> K;

    int N = S.size();
    if(N == 1){cout << K/2 << endl; return 0;}
    if(N == 2){
        if(S[0] == S[1]) cout << K << endl;
        else cout << 0 << endl;
        return 0;
    }

    vector<int> count;
    count.push_back(1);
    for(int i=1; i<N; i++){
        if(S[i-1] == S[i]) count.back()++;
        else count.push_back(1);
    }
    if(count.size() == 1){cout << K*N/2 << endl; return 0;}

    int f = count.front();
    int b = count.back();
    ll ans = 0;
    for(int& x: count) ans += K*(x/2);
    if(S[0] == S[N-1] && f/2 + b/2 < (f+b)/2) ans += K-1;

    cout << ans << endl;
}

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

namespace AtCoder
{
	class Program
	{
		static void Main(string[] args)
		{
			var n = int.Parse(Console.ReadLine());
			var input = Console.ReadLine().Split(' ').Select(value => int.Parse(value)).ToList();

			var average = input.Average();

			var target = average % 1 >= 0.5 ? (int)(average + 1) : (int)average;

			var cost = input.Select(value => (value - target) * (value - target));

			Console.WriteLine(cost.Sum());
		}
	}
}


Measured memory_bytes: 13396
#include <iostream>
#include <stdio.h>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <algorithm>
#define MP make_pair
using ll = long long;
using namespace std;

int two(ll x)
{
  int ans=0;
  for(;;){
    if(x%2 == 1)
      break;
    x = x/2;
    ans++;
  }
  return ans;
}

int main()
{
  int N;
  cin >> N;
  vector<ll>A(N);
  for(int i=0; i < N; i++)
    cin >> A[i];
  int ans = 10000;
  for(int i=0; i < N; i++){
    ans = min(ans, two(A[i]));
  }
  cout << ans << endl;
  return 0;
}


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

#define ll long long 
 
using namespace std ;
 
ll z , ans , o ;

ll mod = 1e9 + 7 ;
ll N = 1e5 + 7 ;


int main( ){

	int n , m ;

	cin >> n >> m ;

	for( int i = 0 ; i < m ; i ++ ){

		int u ;

		cin >> u ;

		ans += u ;

	}

	if( ans > n ){

		cout << -1 << endl ;

	}else{

		cout << n - ans << endl ;

	}

}	



Measured memory_bytes: 3592
#include<iostream>
#include<cstring>
#include<cstdlib>

using namespace std;

long long int len[100000],ans=0;
int main(void){
	int a,n,m;
	memset(len,0,sizeof(len));
	cin >> n >> m;
	for(a=1;a<n;a++){
		int b;
		scanf("%d",&b);
		len[a]=b+len[a-1];
	}
	int x=0;
	for(a=1;a<=m;a++){
		int c;
		scanf("%d",&c);
		if(c>0)ans+=len[c+x]-len[x];
		else ans+=len[x]-len[x+c];
		x+=c;
	}
	cout << ans%100000 << endl;
	return 0;
}

Measured memory_bytes: 1652
#include<stdio.h>
#include<string.h>

int main(void){

        char a[100];
        char b[100];
        scanf("%s", a);
        scanf("%s", b);
        int i;
        if(strlen(a)>strlen(b)) {printf("GREATER");return 0;}
        else if(strlen(a)<strlen(b)) {printf("LESS");return 0;}
        else {
                for(i=0;i<strlen(a);i++){
                        if((a[i]-b[i])>0){printf("GREATER");return 0;}

                        if((a[i]-b[i])<0){printf("LESS");return 0;}

                }
                printf("EQUAL");}


        return 0;
}

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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
template<typename T> using pq = priority_queue<T>;
template<typename T> using minpq = priority_queue<T, vector<T>, greater<T>>;
template<typename T, typename K> using ump = unordered_map<T, K>;
const ll dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const ll mod = 1000000007;
const ll inf = ll(1e9);
const ll e5 = ll(1e5);
const ll ll_inf = ll(1e9) * ll(1e9);

#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for(ll i = n - 1; i >= 0; i--)
#define repone(i, n) for(ll i = 1; i <= (ll)(n); i++)
#define each(i, mp) for(auto& i:mp)
#define eb emplace_back
#define F first
#define S second
#define all(obj) (obj).begin(), (obj).end()

template<class T>
void dump_debug(T list) {
#ifdef MY_DEBUG
    each(e, list) cout << e << " ";
    printf("\n");
#endif
}

/* ------------- ANSWER ------------- */
/* ---------------------------------- */

void solve(istream &in, ostream &out) {

    vector<ll> G[2 * e5];
    vector<ll> ans(2 * e5);
    unordered_map<ll, ll> pl;
    vector<bool> seen(2 * e5);

    auto dfs = [&](auto &&f, ll now, ll value) -> void {
        seen[now] = true;
        ans[now] = value;
        each(e, G[now]) {
            if (!seen[e]) {
                f(f, e, value + pl[e]);
            }
        }
    };
    ll n, q;
    in >> n >> q;
    rep(i, n - 1) {
        ll a, b;
        in >> a >> b;
        a--, b--;
        G[a].eb(b);
        G[b].eb(a);
    }

    rep(i, q) {
        ll p, x;
        in >> p >> x;
        p--;
        pl[p] += x;
    }
    dfs(dfs, 0, pl[0]);

    rep(i, n) out << ans[i] << " ";
}

int main() {
#ifdef MY_DEBUG
    while (true) {
#endif
        solve(cin, cout);
#ifdef MY_DEBUG
    }
#endif
    return 0;
}

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

// -----------------------------------------------------------------------------
// main
// -----------------------------------------------------------------------------
fn main(){
    input!{
        h: usize,
        w: usize,
        a: [[i32; w]; h]
    }
    let mut ans = vec![];
    let mut a = a;
    for i in 0..h{
        // 偶数行は右へ進み
        if i%2==0{
            for j in 0..w-1{
                if a[i][j]%2==1{
                    a[i][j+1] += 1;
                    ans.push((i,j,i,j+1));
                }
            }
            if a[i][w-1]%2==1 && i<h-1{
                a[i+1][w-1] += 1;
                ans.push((i,w-1,i+1,w-1));
            }
        //奇数行は左へ戻る
        }else{
            for j in 0..w-1{
                if a[i][w-1-j]%2==1{
                    a[i][w-1-j-1] += 1;
                    ans.push((i,w-1-j,i,w-1-j-1));
                }
            }
            if a[i][0]%2==1 && i<h-1{
                a[i+1][0] += 1;
                ans.push((i,0,i+1,0));
            }
        }
    }
    println!("{}", ans.len());
    for (a,b,c,d) in ans{
        println!("{} {} {} {}",a+1,b+1,c+1,d+1);
    }
}


Measured memory_bytes: 12788
n = int(input())

v = list(map(int, input().split( )))
##
v1 = v[0::2]
v2 = v[1::2]
##

##
from  collections import Counter

n1 = len(v1)
n2 = len(v2)
v11 = Counter(v1)
v21 = Counter(v2)

##
#c1 = Counter.most_common(v11)
#c2 = Counter.most_common(v21)
c1 = v11.most_common(2)
c2 = v21.most_common(2)

#print(c2)
#print(v21)
#print(v11[c1])　エラー

###
###
if c1[0][0]!=c2[0][0]:
    print(n1-c1[0][1]+n2-c2[0][1])
else:
    try:
        ans1 = n1-c1[1][1]+n2-c2[0][1]
        ans2 = n1-c1[0][1]+n2-c2[1][1]
        print(min(ans1,ans2))
    except:
        try:
            ans1 = n1-c1[1][1]+n2-c2[0][1]
            #ans2 = n1-c1[0][1]+n2-c2[1][1]
            print(ans1)
        except:
            try:
                ans2 = n1-c1[0][1]+n2-c2[1][1]
                print(ans2)
            except:
                print(len(v2))


Measured memory_bytes: 18932
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
#include <ext/pb_ds/detail/standard_policies.hpp>

using namespace std;
using namespace  __gnu_pbds;

#define sz(v)           ((int)((v).size()))
#define clr(v, d)       memset(v, d, sizeof(v))
#define rep(i, v)       for(int i=0; i<sz(v); ++i)
#define lp(i, n)        for(int i=0; i<(int)(n); ++i)
#define lpi(i, j, n)    for(int i=(j); i<(int)(n); ++i)
#define lpd(i, j, n)    for(int i=(j); i>=(int)(n); --i)
#define INF             1000000000


typedef long long ll;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;
typedef tree<
ii,
null_type,
less<ii>,
rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;

void init() {
	std::ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
}

const int N = 5e3+5;
const int MOD = 1e9+7;

int main() {
	init();
	string str;
	int n, sum = 0;
	cin >> str;
	n = str.size();
	lp(i, n/2)
		if(str[i] != str[n-1-i])
			++sum;
	cout << sum;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <utility>
#include <string>
#include <cmath>
#include <numeric>
#include <iomanip>

using namespace std;
using ll = long long;

struct P{
	long double x;
	long double y;
};
long double dist(const P& a, const P& b){
	return sqrt((a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y));
}

int main(){
	cin.tie(0);
	ios_base::sync_with_stdio(false);
	int n;
	cin>>n;
	vector<P> v(n);
	for(auto &i: v)cin>>i.x>>i.y;
	vector<int> ind(n);
	iota(ind.begin(),ind.end(),0);
	long double res=0;
	do{
		for(int i=1; i<n; ++i){
			res+=dist(v[ind[i]],v[ind[i-1]]);
		}
	}while(next_permutation(ind.begin(),ind.end()));
	for(int i=2; i<=n; ++i){
		res/=i;
	}
	cout<<setprecision(12)<<res<<endl;
	return 0;
}



Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define REP(i, n) for(ll i = 0;i < n;i++)
#define ll long long
#define MOD 1000000007
#define llMAX 9223372036854775807
#define llMIN -9223372036854775808
using vi = vector<ll>; // intの1次元の型に vi という別名をつける
using vvi = vector<vi>; // intの2次元の型に vvi という別名をつける

ll n,a,b;







//   a/b mod c
ll moddiv(ll a,ll b){
	ll x0=MOD,x1=b,x2,n0=0LL,n1=1LL,n2,t=a%b,m,ans;
	if (t==0) return a/b;
		for(int i=0;i<900;i++){
      m=x0/x1;
      x2=x0-x1*m;
      n2=(n0-m*n1)%MOD;
      if (x2==1){
        ans=(n2+MOD)%MOD;
        break;
      }
      x0=x1;x1=x2;
      n0=n1;n1=n2;
    }
	return (a+((t*ans)%MOD)*b-t)/b;
}
//剰余の割ざん

//aのn乗 mod c
ll expmod(ll a,ll n){
  ll ans=1LL,aa=a,beki=n;
  for(int i=0;i<64;i++){
    if (beki%2==1) ans=ans*aa%MOD;
    aa=aa*aa%MOD;
    beki/=2;
    if (beki==0)break;
  }
  return ans;
}



int main(){
  ll ans=0;
  cin >> n >> a>>b;

  ans=expmod(2,n);

  ans=(ans-1+MOD)%MOD;

  ll ans1=1;
  for(ll i=1;i<=a;i++){
    ans1=ans1*(n-i+1)%MOD;
    ans1=moddiv(ans1,i);
  }
  

  ll ans2=1;
  for(ll i=1;i<=b;i++){
    ans2=ans2*(n-i+1)%MOD;
    ans2=moddiv(ans2,i);
  }

  ans1=MOD-ans1;
  ans2=MOD-ans2;
  ans=(ans+ans1+ans2)%MOD;
  
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
int main(){
    double x1,y1,x2,y2,x3,y3;
    int n;
 
    scanf("%d",&n);
 
    double a,b,c;
    double ans = 0;
    double xp,yp;
    for(int i = 0;i < n; i++){
        scanf("%lf%lf%lf%lf%lf%lf",&x1,&y1,&x2,&y2,&x3,&y3);
 
        a = hypot(x2 - x1,y2 - y1);
        b = hypot(x3 - x1,y3 - y1);
        c = hypot(x3 - x2,y3 - y2);
 
        ans = (a*b*c) / (sqrt((a+b+c)*(b+c-a)*(a-b+c)*(a+b-c)));
        xp = (((x1*x1)+(y1*y1))*(y2-y3)+((x2*x2)+(y2*y2))*(y3-y1)+((x3*x3)+(y3*y3))*(y1-y2))/(x1*(y2-y3)+x2*(y3-y1)+x3*(y1-y2))/2;
        yp = (((x1*x1)+(y1*y1))*(x2-x3)+((x2*x2)+(y2*y2))*(x3-x1)+((x3*x3)+(y3*y3))*(x1-x2))/(y1*(x2-x3)+y2*(x3-x1)+y3*(x1-x2))/2;
        printf("%.3lf %.3lf %.3lf\n",xp,yp,ans);
        ans = 0;
    }
    return 0;
}

Measured memory_bytes: 1260
import java.io.BufferedReader
import java.io.InputStreamReader
import java.io.PrintWriter
import java.util.*
import kotlin.math.abs
import kotlin.math.min

val br = BufferedReader(InputStreamReader(System.`in`))
val out = PrintWriter(System.out)

fun main() {
    br.use { out.use {
        solve()
        out.flush()
    } }
}

fun solve() {
    val x = readLong()

//    for (i in 1..40L) {
//        out.println("$i ${aaa(i)}")
//    }
    out.println(aaa(x))
}

fun aaa(x: Long): Long {
    var ans = x / (6 + 5) * 2
    val remain = x % (6 + 5)
    ans += if (remain == 0L) {
        0
    } else {
        if (remain <= 6 ) 1 else 2
    }
    return ans
}

fun readInteger() = Integer.parseInt(br.readLine())
fun readLong() = java.lang.Long.parseLong(br.readLine())
fun readStringList() = br.readLine()!!.split(' ')
fun readIntegerList() = readStringList().map(Integer::parseInt)
fun readLongList() = readStringList().map(java.lang.Long::parseLong)
fun readDoubleList() = readStringList().map(java.lang.Double::parseDouble)


Measured memory_bytes: 34160
n, k = map(int, input().split())
P = list(map(int, input().split()))
C = list(map(int, input().split()))

P = [p - 1 for p in P]

def max_point(p, k):
    point = p
    visited = set()
    visited_record = []
    score = 0
    scores = []
    while point not in visited:
        visited.add(point)
        visited_record.append(point)
        score += C[point]
        scores.append(score)
        #update
        point = P[point]
    else:
        loop_entry_index = visited_record.index(point)
        loop_len = len(visited_record) - loop_entry_index
        if loop_entry_index > 0:
            loop_score = scores[-1] - scores[loop_entry_index-1]
        else:
            loop_score = scores[-1]
        head_len = loop_entry_index
    #print(scores)

    if k <= len(scores):
        return max(scores[:k])
    else:
        if loop_score > 0:
            k -= head_len
            scores = scores[:head_len]
            quotient = k // loop_len
            reminder = k % loop_len
            #print(quotient, reminder)
            if scores == []:
                score = 0
            else:
                score = scores[head_len-1]
            score += (quotient - 1) * loop_score
            point = visited_record[loop_entry_index]
            for i in range(loop_len + reminder):
                score += C[point]
                scores.append(score)
                #print(scores, point)
                point = P[point]
            return max(scores)
        else:
            #print(scores)
            return max(scores)

#print(max_point(0, k))

point = -float("inf")
for p in P:
    point = max(max_point(p, k), point)
print(point)


Measured memory_bytes: 219716
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cassert>
#include <stack>
#include <limits>
#include <array>
#include <unordered_map>
#include <unordered_set>
#include <memory>
#include <numeric>
//#include <tuple>

constexpr long long mod = static_cast<long long>(1e9 + 7);

int main() {
    int X, Y;
    std::cin >> X >> Y;
    if(X % Y == 0) std::cout << -1 << std::endl;
    else std::cout << X << std::endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 using namespace std;
 using pii = pair<int, int>;
 using ll = long long;
 #define rep(i, j, n) for(int i = j; i < (int)(n); i++)
 const ll MOD = 1000000007;
 const ll INFL = (1LL << 60);
 const int INFI = (1 << 30);

 int main() {
   ll X; cin >> X;

   ll money = 100, ans = 0;

   while (money < X) {
     money *= 1.01;
     ans++;
   }
   cout << ans << endl;
 }


Measured memory_bytes: 3624
fn read() -> f64 {
    use std::io::*;
    let stdin = stdin();
    let s: String = stdin
        .bytes()
        .map(|c| c.unwrap() as char)
        .take_while(|c| !c.is_whitespace())
        .collect::<String>();
    s.parse::<f64>().ok().unwrap()
}
fn main() {
    let a = read();
    let b = read();

    if a > 0.0 && b > 0.0 {
        println!("Positive");
    } else if a <= 0.0 && b >= 0.0 {
        println!("Zero");
    } else if (a < 0.0 && b < 0.0) && (b - a) % 2.0 == 1.0 {
        println!("Positive");
    } else {
        println!("Negative");
    }
}


Measured memory_bytes: 4604
#coding: utf-8
s = input()
k = int(input())

if len(set(s))==1:
  print((len(s)*k)//2)
  exit()

dup = [1]
for i in range(1,len(s)):
  if s[i-1]==s[i]:
    dup[-1]+=1
  else:
    dup.append(1)
    
ans = 0
for i in dup:
  ans += (i//2)*k

if s[0]==s[-1]:
  ans += ((dup[0]+dup[-1])//2 - (dup[0]//2+dup[-1]//2))*(k-1)

print(ans)


Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include<limits.h>
#include<iomanip>
#define rep(i, n) for(int i = 0; i < n; i++)
#define REP(i, m, n) for(int i = m; i < n; i++)
#define ALL(v) v.begin(),v.end()
#define RALL(v) v.rbegin(),v.rend()
#define check(v) rep(i,v.size()) cout << v[i] << " ";\
cout << endl
#define INF 1e8
typedef long long ll;
using namespace std;
//オーバーフローに気をつけろよおおおおおお
//確認忘れるなよおおおおおお


int n, m;
int a[51], b[51];
bool graph[51][51];
bool visited[51];


void dfs(int v){
    visited[v] = true;
    rep(i,n){
        if(graph[v][i] == false) continue;
        if(visited[i] == true) continue;
        dfs(i);
    }
}
int main() {
    cin >> n>> m;
    rep(i,m){
        cin >> a[i] >> b[i];
        a[i]--; b[i]--;
        graph[a[i]][b[i]] = true;
        graph[b[i]][a[i]] = true;
    }

    int ans = 0;

    rep(i,m){
        graph[a[i]][b[i]] = false;
        graph[b[i]][a[i]] = false;

        rep(j,n){
            visited[j] = false;
        }
        dfs(0);

        bool bridge = false;
        rep(k,n){
            if(visited[k] == false) bridge = true;
        }
        if(bridge) ans++;

        graph[a[i]][b[i]] = true;
        graph[b[i]][a[i]] = true;
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define inf 1000000000
#define maxs(x,y) (x = max(x , y))
#define mins(x,y) (x = min(x , y))
using namespace std;
typedef long long int ll;

int main(){

  int T,X;
  cin >> T >> X;
  cout << (double)T/X << endl;
  
}


Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        B solver = new B();
        solver.solve(1, in, out);
        out.close();
    }

    static class B {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            // 入力
            int n = Integer.parseInt(in.next());
            int a[] = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = Integer.parseInt(in.next());
            }

            double ans = 0.0;
            for (int i = 0; i < n; i++) {
                ans += 1.0 / a[i];
            }

            // 出力
            out.printf("%.6f%n", 1.0 / ans);

        }

    }
}



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

using ll = long long;

int main() {
    ll N, K;  cin >> N >> K;
    vector<ll> A(N);
    for (int i = 0; i < N; ++i) cin >> A[i];

    int lb = 0, ub = 1e9 + 7;
    while (lb + 1 < ub) {
        int mid = (lb + ub) / 2;

        ll cnt = 0;
        for (int i = 0; i < N; ++i) {
            cnt += (A[i] - 1) / mid;
        }
        // DUMP(mid, cnt);

        if (cnt <= K) ub = mid;
        else lb = mid;
    }
    cout << ub << endl;
}


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

using namespace std;

#define X first
#define Y second
#define mp make_pair
#define pb push_back
#define Debug(...) fprintf(stderr, __VA_ARGS__)

typedef long long LL;
typedef long double LD;
typedef unsigned int uint;
typedef pair <int, int> pii;
typedef unsigned long long uLL;

template <typename T> inline void Read(T &x) {
  char c = getchar();
  bool f = false;
  for (x = 0; !isdigit(c); c = getchar()) {
    if (c == '-') {
      f = true;
    }
  }
  for (; isdigit(c); c = getchar()) {
    x = x * 10 + c - '0';
  }
  if (f) {
    x = -x;
  }
}

template <typename T> inline bool CheckMax(T &a, const T &b) {
  return a < b ? a = b, true : false;
}

template <typename T> inline bool CheckMin(T &a, const T &b) {
  return a > b ? a = b, true : false;
}

const int N = 105;

int n, dep[N], par[N];
vector <int> adj[N], seq[N];
LL ans, f[N], g[N];

inline void DFS(int x, int p) {
  par[x] = p, dep[x] = dep[p] + 1;
  for (auto y : adj[x]) {
    if (y != p) {
      DFS(y, x);
    }
  }
}

inline LL Solve(int x) {
  DFS(x, 0);
  int maxdep = 0;
  for (int i = 1; i <= n; ++i) {
    CheckMax(maxdep, dep[i]);
  }
  for (int i = 1; i <= maxdep; ++i) {
    seq[i].clear();
  }
  for (int i = 1; i <= n; ++i) {
    seq[dep[i]].pb(i);
  }
  LL ret = 1;
  for (int i = maxdep - 1; i; --i) {
    int maxson = 0;
    for (auto x : seq[i]) {
      int cnt = 0;
      for (auto y : adj[x]) {
        if (dep[y] == i + 1) {
          ++cnt;
        }
      }
      CheckMax(maxson, cnt);
    }
    ret *= maxson;
  }
  return ret;
}

inline LL Solve(int x, int y) {
  dep[y] = 0, DFS(x, y), dep[x] = 0, DFS(y, x), dep[x] = 1;
  int maxdep = 0;
  for (int i = 1; i <= n; ++i) {
    CheckMax(maxdep, dep[i]);
  }
  for (int i = 1; i <= maxdep; ++i) {
    seq[i].clear();
  }
  for (int i = 1; i <= n; ++i) {
    seq[dep[i]].pb(i);
  }
  LL ret = 1;
  for (int i = maxdep - 1; i; --i) {
    int maxson = 0;
    for (auto x : seq[i]) {
      int cnt = 0;
      for (auto y : adj[x]) {
        if (dep[y] == i + 1) {
          ++cnt;
        }
      }
      CheckMax(maxson, cnt);
    }
    ret *= maxson;
  }
  return ret << 1;
}

int main() {
#ifdef wxh010910
  freopen("d.in", "r", stdin);
#endif
  Read(n);
  for (int i = 1, x, y; i < n; ++i) {
    Read(x), Read(y);
    adj[x].pb(y), adj[y].pb(x);
  }
  DFS(1, 0);
  int s = 0;
  for (int i = 1; i <= n; ++i) {
    if (dep[i] > dep[s]) {
      s = i;
    }
  }
  DFS(s, 0);
  int t = 0;
  for (int i = 1; i <= n; ++i) {
    if (dep[i] > dep[t]) {
      t = i;
    }
  }
  if (!(dep[s] + dep[t] & 1)) {
    int mid = dep[s] + dep[t] >> 1, r;
    for (r = t; dep[r] != mid; r = par[r]);
    ans = Solve(r);
    for (auto x : adj[r]) {
      CheckMin(ans, Solve(r, x));
    }
    printf("%d %lld\n", mid, ans);
  } else {
    int mid1 = dep[s] + dep[t] >> 1, mid2 = dep[s] + dep[t] + 1 >> 1, r1, r2;
    for (r1 = t; dep[r1] != mid1; r1 = par[r1]);
    for (r2 = t; dep[r2] != mid2; r2 = par[r2]);
    printf("%d %lld\n", mid1, Solve(r1, r2));
  }
#ifdef wxh010910
  Debug("My Time: %.3lfms\n", (double)clock() / CLOCKS_PER_SEC);
#endif
  return 0;
}


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

#define MP make_pair
#define PB push_back
#define ALL(x)      (x).begin(),(x).end()
#define REP(i,n)    for(int i=0;i<(n);i++)
#define REP1(i,n)   for(int i=1;i<(n);i++)
#define REP2(i,d,n) for(int i=(d);i<(n);i++)
#define RREP(i,n)   for(int i=(n);i>=0;i--)
#define CLR(a)      memset((a),0,sizeof(a))
#define MCLR(a)     memset((a),-1,sizeof(a))
#define RANGE(x,y,maxX,maxY) (0 <= (x) && 0 <= (y) && (x) < (maxX) && (y) < (maxY))

typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI > VVI;
typedef vector<string> VS;
typedef vector<LL> VLL;
typedef pair<int,int> PII;

const int INF = 0x3f3f3f3f;
const LL INFL = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-9;

const int DX[]={1,0,-1,0},DY[]={0,-1,0,1};

const string YES = "Yes";
const string NO = "No";

void solve(std::string S){
    bool flag = true;
    REP(i, S.size()) {
        int j = S.size() - i - 1;
        flag &= S[i] == S[j];
    }
    REP(i, S.size() / 2) {
        int j = S.size() / 2 - i - 1;
        flag &= S[i] == S[j];
        flag &= S[i + S.size() / 2 + 1] == S[j + S.size() / 2 + 1];
    }

    cout << (flag ? YES : NO) << endl;
}

int main(){
    std::string S;
    std::cin >> S;
    solve(S);
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
#define deb(x) cout << #x << " = " << x << "\n";
using namespace std;

const int mod = 998244353;
signed main() {
    
    int n; cin >> n;
    int k; cin >> k;
    vector<int> dp(n+1, 0), sum(n+1, 0);
    dp[1] = sum[1] = 1;
    vector<vector<int>> seg(k, vector<int> (2));
    for(int i = 0; i < k; i++) {
        cin >> seg[i][0] >> seg[i][1];
    }
    sort(seg.begin(), seg.end());
    
    for(int i = 2; i <= n; i++) {
        sum[i] = sum[i-1];
        for(int j = 0; j < k; j++) {
            int l = min(i, seg[j][0]), r = min(i-1, seg[j][1]);
            dp[i] += (mod + sum[i - l] - sum[i - r - 1]) % mod;
            dp[i] %= mod;
            sum[i] %= mod;
        }
        sum[i] += dp[i];
            
    }
    
    cout << dp[n] << "\n";
}

Measured memory_bytes: 6428