akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

class Program {

    static void Main(string[] args) {
        //StreamWriter sw = new StreamWriter(Console.OpenStandardOutput()){AutoFlush =false};
        //Console.SetOut(sw);
        while (true) {
            string str = Console.ReadLine();
            int n = int.Parse( str.Split(' ')[0]);
            if (n == 0) return;

            int[] Cards = new int[n];
            int[] PreCards = new int[n];

            for (int i = 0; i < n; i++) {PreCards[i] = Cards[i] = i + 1; }
            int iMax = int.Parse(str.Split(' ')[1]);
            for (int i = 0; i < iMax; i++) {
                for (int j = 0; j < n; j++) { PreCards[j] = Cards[j]; }
                str = Console.ReadLine();
                int p = int.Parse(str.Split(' ')[0])-1;
                int c = int.Parse(str.Split(' ')[1]);
                int startpos = n - p - c;
                for (int j = startpos; j < n; j++) {
                    if(j < startpos + p ){
                        Cards[j] = PreCards[j + c];
                    }else {
                        Cards[j] = PreCards[j - p];
                    }

                }
            }
            Console.WriteLine( Cards[n - 1]);
                
        }
        //Console.Out.Flush();
    }

}

/*
var empty = new int[] {};
        var a1533 = new int[] { 1, 5, 3, 3 };
        //Filter,map,平坦化
        a1533.Where (s=> s< 4).ToArray();
        a1533.Select (s =>s*2).ToArray();
        a1533.SelectMany(s => new[]{s,s}).ToArray();//11553333
        a1533.Zip (new int[]{1,2,1,2},(a,b)=> a+b).ToArray();//2745
            

    public class ShuffleList<T> {
        public T[] Tarray;
        private int[] Nextint;
        private int[] Beforeint;
        public int Top;

        public ShuffleList(int max) {
            Tarray = new T[max];
            Nextint = new int[max];
            Beforeint = new int[max];
            Top = 0;
        }
        public void Add(T val) {
            Tarray[Top] = val;
            Nextint[Top] = Top + 1;
            Beforeint[Top] = Top - 1;
            Top++;
        }
        public void Swap(int a, int b) {
            Nextint[a] = 9;

        }

    }




*/

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

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rrep(i, n) for(int i = ((int)(n)-1); i >= 0; i--)
#define all(x) (x).begin(), (x).end()
 
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> P;
 
const int INF = 1e9;
const int MOD = 1e9+7;
const double EPS = 1.0e-12;
const double PI = acos(-1.0);

int main() {
	int s,w;
	cin >> s >> w;
	cout << (s > w ? "safe" : "unsafe") << endl;

	return 0;
}

Measured memory_bytes: 3652
import sys
import socket

hostname = socket.gethostname()

if hostname == 'F451C':
    sys.stdin = open('c1.in')


def read_int_list():
    return list(map(int, input().split()))


def read_str_list():
    return input().split()


def read_int():
    return int(input())


def read_str():
    return input()


def main():
    N = read_int()
    A = read_int_list()
    A.sort()
    s = []
    for i in range(N-1):
      if A[i+1] != A[i]:
        s.append(A[i])
    l = len(s)
    if l == N - 1:
      res = 'YES'
    else:
      res = 'NO'
    print(res)


main()


Measured memory_bytes: 27084
import java.util.*

fun main(args: Array<String>) {
    val (N, M) = readLine()!!.split(" ").map {it.toInt()}
    val g = Graph(N + 1, 0, 0) { a, b -> a + b }

    for (i in 1 .. M) {
        val (a, b) = readLine()!!.split(" ").map{it.toInt()}
        g.edges[a].add(Edge(a, b, 0))
        g.edges[b].add(Edge(b, a, 0))
    }

    println(findBridges(g).first.size)
}

data class Edge<T: Comparable<T>>(val from: Int, val to: Int, val weight: T): Comparable<Edge<T>> {
    constructor(from: Long, to: Long, weight: T) : this(from.toInt(), to.toInt(), weight)

    override fun compareTo(other: Edge<T>) = weight.compareTo(other.weight)
}

class Graph<T: Comparable<T>>(val n: Int, val zero: T, val inf: T, val plus: (T, T) -> T) {
    val edges = Array(n) { ArrayList<Edge<T>>() }
}

fun <T : Comparable<T>>findBridges(g: Graph<T>): Pair<Array<Edge<T>>, Array<TreeSet<Int>>> {
    val num = Array(g.n) {0}
    val open = Array(g.n) {false}
    val oReps = ArrayDeque<Int>()
    val oNodes = ArrayDeque<Int>()
    var cnt = 0
    val bridges = ArrayList<Edge<T>>()
    val comp = ArrayList<TreeSet<Int>>()

    fun recur(v: Int, u: Int) {
        if (num[v] != 0) {
            if (open[v]) while(num[oReps.first] > num[v]) oReps.removeFirst()
            return
        }

        num[v] = ++cnt
        oReps.addFirst(v)
        oNodes.addFirst(v)
        open[v] = true

        for (e in g.edges[v]) if (e.to != u) {
            recur(e.to, e.from)
        }

        if (v == oReps.first) {
            oReps.removeFirst()
            comp.add(TreeSet())

            do {
                val w = oNodes.first
                oNodes.removeFirst()
                open[w] = false
                comp.last().add(w)
            } while (v != w)
            bridges.add(Edge(Math.min(u, v), Math.max(u, v), g.zero))
        }
    }

    for (i in 0 until g.n) if (num[i] == 0) {
        recur(i, g.n)
        bridges.removeAt(bridges.size - 1)
    }

    return Pair(bridges.toTypedArray(), comp.toTypedArray())
}


Measured memory_bytes: 37824
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <math.h>

using namespace std;

int main() {
    string s;
    long long int k;
    cin >> s;
    cin >> k;
    vector<long long int> sk;
    for (int i = 0; i < s.size(); ++i) {
        int temp = s[i] - '0';
        if(temp != 1)
        {
            cout << s[i] << endl;
            break;
        }else{
            if(k == 1)
            {
                cout << s[i] << endl;
                break;
            }
            k--;
        }
    }
    return 0;
}


Measured memory_bytes: 256
n,k=map(int,input().split())
a=sorted(list(map(int,input().split())))
#こっちは変えられない
f=sorted(list(map(int,input().split())),reverse=True)
l,r=0,10**12
def cal(x):
    global n,f,a,k
    ret=0
    for i in range(n):
        ret+=max(0,a[i]-(x//f[i]))
    #print(ret,x)
    return ret
while l+1<r:
    x=l+(r-l)//2
    if cal(x)<=k:
        r=x
    else:
        l=x
if cal(l)<=k:
    print(l)
else:
    print(r)

Measured memory_bytes: 117532
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <vector>
#define sz(a) int(a.size())
#define all(a) a.begin(), a.end()
#define rep(i,x,n) for(int i=x;i<n;i++)
#define repd(i,x,n) for(int i=x;i<=n;i++)
#define pii pair<int,int>
#define pll pair<long long ,long long>
#define gbtb ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define MS0(X) memset((X), 0, sizeof((X)))
#define MSC0(X) memset((X), '\0', sizeof((X)))
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define eps 1e-6
#define gg(x) getInt(&x)
using namespace std;
typedef long long ll;
inline void getInt(int* p);
const int maxn=1000010;
const int inf=0x3f3f3f3f;
/*** TEMPLATE CODE * * STARTS HERE ***/
ll dp[maxn];
ll n,W;
ll v[maxn];
ll w[maxn];
int main()
{
    memset(dp,0x3f,sizeof(dp));
    gbtb;
    cin>>n>>W;
    repd(i,1,n)
    {
        cin>>w[i]>>v[i];
    }
    ll ans=0ll;
    dp[0]=0;
    repd(i,1,n)
    {
        for(int j=1e5;j>=v[i];--j)
        {
            // if(dp[j-v[i]]!=-1)
            // {
                dp[j]=min(dp[j],dp[j-v[i]]+w[i]);
                if(dp[j]<=W)
                    ans=max(ans,(ll)(j));
            // }
        }
    }
    cout<<ans<<endl;
    return 0;
}

inline void getInt(int* p) {
    char ch;
    do {
        ch = getchar();
    } while (ch == ' ' || ch == '\n');
    if (ch == '-') {
        *p = -(getchar() - '0');
        while ((ch = getchar()) >= '0' && ch <= '9') {
            *p = *p * 10 - ch + '0';
        }
    }
    else {
        *p = ch - '0';
        while ((ch = getchar()) >= '0' && ch <= '9') {
            *p = *p * 10 + ch - '0';
        }
    }
}



Measured memory_bytes: 11392
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define INF 1000000010
#define EPS 1e-9
#define fst first
#define scd second

#define debug(x) cout<<x<<endl;
#define repi(i,x,n) for(int i=x;i<n;i++)
#define rep(i,n) repi(i,0,n)
#define lp(i,n) repi(i,0,n)
#define repn(i,n) for(int i=n;i>=0;i--)
#define int long long
#define endl "\n"

#define N 200000

int prime[N];

void eratosthenes(){
  rep(i,N) prime[i]=1;
  prime[0]=prime[1]=0;
  rep(i,N){
    if(prime[i]){
      for(int j=i+i;j<N;j+=i) prime[j]=0;
    }
  }
}


signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int x;
  cin>>x;
  eratosthenes();
  repi(i,x,200000){
    if(prime[i]==1){
      cout<<i<<endl;
      return 0;
    }
  }

  return 0;
}


Measured memory_bytes: 1792
using System;
using System.Collections.Generic;
using System.Linq;
 
public class C {
    public static void Main(){
        string[] line = Console.ReadLine().Split(' ');
        int N = int.Parse(line[0]);
        int M = int.Parse(line[1]);
        Dictionary<int, int> numberinfo = new Dictionary<int, int>();
        bool cannotOutput = false;
        for (int i=0;i<M;i++)
        {
            line = Console.ReadLine().Split(' ');
            int s = int.Parse(line[0]);
            int c = int.Parse(line[1]);
            if (numberinfo.ContainsKey(s))
            {
                if (numberinfo[s] != c)
                {
                    cannotOutput = true;
                    break;
                }
            }
            else 
            {
                numberinfo[s] = c;
            }
        }
        if (cannotOutput) Console.WriteLine(-1);
        else
        {
            int[] number = new int[N];
            for (int i=0;i<N;i++) number[i] = 0;
            foreach (int s in numberinfo.Keys)
            {
                number[s-1] = numberinfo[s];
            }
            bool minZero = false;
            if (numberinfo.ContainsKey(1)&&N==1)
            {
                if (numberinfo[1]==0)
                {
                    minZero = true;
                }
            }
            else if (N==1)
            {
                minZero = true;
            }
            else if (!numberinfo.ContainsKey(1)&&N!=1)
            {
                number[0] = 1;
            }
            if (minZero) Console.WriteLine(0);
            else if (number[0]==0) Console.WriteLine(-1);
            else
            {
                string output = "";
                for (int i=0;i<N;i++)
                {
                    output += number[i]+"";
                }
                Console.WriteLine(output);
            }
        }
    }
}

Measured memory_bytes: 13152
#include<stdio.h>
int a[2000000]={0};
int main(){
	int n;
	scanf("%d",&n);
	for (int i=1;i<=n;i++){
		for (int j=1;j*j<=i;j++){
			if (i%j==0){
			  if (j*j==i) a[i]++;
			  if (j*j<i) a[i]+=2;
		}
		}
	}
	int ans=0;
	for (int i=1;i<=n-1;i++){
		ans=ans+a[i];
	}
	printf("%d",ans);
}

Measured memory_bytes: 5628
#include <bits/stdc++.h>
using namespace std;
int main() {
    int N,max,min;
    cin >> N;
    int A[N];
    for (int i = 0;i<N;i++) {
        cin >> A[i];
    }
    sort(A, A+N);
    min = A[0];
    max = A[N-1];
    cout << max -min;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
  int t,time,m,s;
  while(cin >> t){
    time=0;
    time+=t;
    for(int i=0;i<3;i++){
      cin >> t;
      time+=t;
    }
    m=time/60;
    s=time%60;
    cout << m << endl << s << endl;
  }
}

Measured memory_bytes: 1160
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
typedef int64_t int64;
typedef uint32_t uint;
typedef uint64_t uint64;
using namespace std;

//---

template <typename T>
inline void print(const T& rhs){ std::cout<<" = "<<rhs<<std::endl; }
template <typename T>
inline void print(const std::vector<T>& rhs){
    std::cout<<" = [ ";
    for(uint i=0; i<rhs.size(); ++i){ std::cout<<rhs[i]<<' '; }
    std::cout<<"]"<<std::endl;
}
template <typename T>
inline void print(const std::vector<std::vector<T>>& rhs){
    std::cout<<" = "<<std::endl;
    std::cout<<"[[ ";
    for(uint p=0; p<rhs.size(); ++p){
        if(p!=0){ std::cout<<" [ "; }
        for(uint q=0; q<rhs[p].size(); ++q){
            std::cout<<rhs[p][q]<<' ';
        }
        if(p!=rhs.size()-1){ std::cout<<"]"<<std::endl; }
    }
    std::cout<<"]]"<<std::endl;
}
template <typename TL, typename TR>
inline void print(const std::vector<std::pair<TR,TL>>& rhs){
    std::cout<<" = [";
    uint i=0;
    for(; i<rhs.size()-1; ++i){ std::cout<<"[f: "<<rhs[i].first<<", s: "<<rhs[i].second<<"], "; }
    std::cout<<"[f: "<<rhs[i].first<<", s: "<<rhs[i].second<<"]]" << endl;
}
#define printn(var) {printf("%s", #var);print(var);}
#define printn_all(var) {printf("%s(%d): ", __func__, __LINE__);printf("%s", #var);print(var);}

//---

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    string a, b; cin >> a >> b;
    string c = a+b;
    int C = stoi(c);
    int Cs = sqrt(C);
    
    cout << (C==Cs*Cs?"Yes":"No") << endl;
    
    return 0;
}

Measured memory_bytes: 256
import sys
from math import sqrt
from collections import Counter, defaultdict, deque

input = sys.stdin.readline
sys.setrecursionlimit(10 ** 6)


def I():
    return int(input())


def MI():
    return map(int, input().split())


def LI():
    return list(MI())


def LIN(n: int):
    return [I() for _ in range(n)]


inf = float("inf")
mod = 10 ** 9 + 7


def main():
    s, w = MI()
    if s <= w:
        print("unsafe")
    else:
        print("safe")
    pass


if __name__ == "__main__":
    main()


Measured memory_bytes: 9488
#include <bits/stdc++.h>
#include <math.h>
#include <vector>
#include <queue>
#include <iomanip>
#include <string>
#include <algorithm>
using namespace std;
using Graph = vector<vector<int>>;
#define rep(i,n) for(int i=0;i<n;i++)
#define rep_1 (i,j,n) for(int i=j;i<n;i++)
typedef long long ll;
typedef long l;
const ll l_INF = 1010101010101010;
const int INF = 1010101010;
const int dx[4] = {-1,0,1,0};
const int dy[4] = {0,-1,0,1};
using vi = vector<int>;
using vll = vector<ll>;
using vvi = vector<vi>;
using vvll = vector<vll>;
using pii = pair<int,int>;
using pll = pair<ll,ll>;

int main(){
  int n,k; cin>>n>>k;
  vll a(n); rep(i,n) cin>>a[i];
  sort(a.begin(),a.end());
  reverse(a.begin(),a.end());
  ll ans=500001;
  ll left=1000000000, right=0;
  while(right!=ans&&left!=ans){
    ll cnt=0;
    rep(i,n){
      cnt+=(a[i]/ans);
      if(a[i]%ans==0) cnt--;
    }
    if(cnt<=k){
      left=ans;
      ans=(left+right+1)/2;
    }else{
      right=ans;
      ans=(left+right+1)/2;
    }
  }
  if(k!=0)cout<<ans<<endl;
  else cout<<a[0]<<endl;
}


Measured memory_bytes: 4792
#include<iostream>
#include<cmath>
#include<algorithm>
#include<string>
#include<vector>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 998244353
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
int main(){
  ll n;cin>>n;
  ll i,j;
  ll cnt=0;
  ll tmp=sqrt(n);
  if(tmp*tmp<n) tmp++;
  //cout<<tmp<<endl;
  for(i=1;i<tmp;i++){
    if(n%i==0){
      //cout<<i<<endl;
      ll x=n/i;
      if(abs(x-i)==1) continue;
      x--;
      //cout<<x<<endl;
      cnt+=x;
    }
  }
  if(n<3) cnt=0;
  cout<<cnt<<endl;
}


Measured memory_bytes: 256
import java.io.PrintWriter
import java.util.*
import java.math.*
import java.lang.*
import kotlin.comparisons.*

val pw = PrintWriter(System.out)
val MOD: Long = (1e+9 + 7).toLong()

fun main(args: Array<String>) {
    val n = readInt()
    if(n==1) {
        println("Hello World")
    } else {
        val a = readInt()
        val b = readInt()
        println(a + b)
    }

    pw.flush()
}

/****** Declared Functions and Data Structures ******/
// IO
fun read() = readLine()!!
fun readInt() = read().toInt()
fun readLong() = read().toLong()
fun readDouble() = read().toDouble()
fun readListOfString() = read().split(" ")
fun readListOfInt() = readListOfString().map { it.toInt() }
fun readListOfLong() = readListOfString().map { it.toLong() }
fun readListOfDouble() = readListOfString().map { it.toDouble() }

fun Double.format(digits: Int) = String.format("%.${digits}f", this)
fun Float.format(digits: Int) = String.format("%.${digits}f", this)

fun print(value: Any) { pw.print(value) }
fun println(value : Any) { pw.println(value) }


// Extensions
fun<T> List<T>.toBuckets(bucketKeys: List<T>): Map<T, Int> {
    val buckets = bucketKeys.associate { t -> Pair(t, 0) }.toMutableMap()
    this.forEach { t ->
        buckets[t] = buckets[t]!! + 1
    }
    return buckets
}

fun <K, V> Map<K, V>.toMutableMap(): MutableMap<K, V> = HashMap(this)

// Util Functions
fun<T> permutations(src: List<T>): List<List<T>> {
    if(src.size == 1) return listOf(src)
    val perms = mutableListOf<List<T>>()
    val insertElement = src[0]
    permutations(src.drop(1)).forEach { perm ->
        for(i in 0..perm.size) {
            val newPerm = perm.toMutableList()
            newPerm.add(i, insertElement)
            perms.add(newPerm.toList())
        }
    }
    return perms
}

// return nCr, if you want nCr, please access v[n][r]
fun combinations(n: Long): List<List<Long>> {
    val v = (0..n).map { (0..n).map{0L}.toMutableList() }.toMutableList()
    for(i in 0 until v.size) {
        v[i][0] = 1L
        v[i][i] = 1L
    }
    for(i in 0 until v.size) {
        for(j in 1 until i) {
            v[i][j] = (v[i-1][j-1] + v[i-1][j]) % MOD
        }
    }
    return v.map { it.toList() }.toList()
}

// should be a >= b
fun gcd(a: Long, b: Long): Long = 
    if(b == 0L) a else gcd(b, a % b)

// shoud be a >= b
fun lcm(a: Long, b: Long): Long = 
    a / gcd(a, b) * b

fun sumDigits(num_: Long): Long {
    var num = num_
    var rtn: Long = 0
    while(num != 0.toLong()) {
        val tmp = num % 10
        rtn += tmp
        num /= 10
    }
    return rtn
}

fun Double.isDecimal(): Boolean = ((this - Math.floor(this)) != 0.0)

// Data Structures
class Stack<T>(private var st: MutableList<T> = mutableListOf<T>()) {
    fun isEmpty() = st.isEmpty()
    fun top(): T = st.last()
    fun push(e: T) { st.add(e) }
    fun pop() { st = st.dropLast(1).toMutableList() }
}

class Queue<T>(private var que: MutableList<T> = mutableListOf<T>()) {
    fun isEmpty() = que.isEmpty()
    fun top(): T = que.first()
    fun push(e: T) { que.add(e) }
    fun pop() { que = que.drop(1).toMutableList() }
}


Measured memory_bytes: 29756
#include<bits/stdc++.h>
#define ll long long int
#define ff first
#define ss second
#define eps 1e-9

using namespace std;

int main()
{

    ll t,n,m,f,a,b,c,l,r,q,k,x,y,z,ans,mn,mx,sum=0;

    cin>>n;

    ll arr[n+1]={0};

    for(int i=1;i<=n;i++)
    {
        for(int j=i; j<=n;j+=i)
        {
            arr[j]++;
        }
    }

    for(int i=1;i<=n;i++)
    {
        sum+= (i * arr[i]);
    }
    cout<<sum<<endl;
}


Measured memory_bytes: 81708
#include <bits/stdc++.h>
#define ALL(obj) begin(obj), end(obj)
#define debug(x) cerr << #x << ": " << x << '\n'
using namespace std;
template <class T>
vector<T> make_vec(size_t a) {
    return vector<T>(a);
}
template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
template <class T>
bool chmax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}

using ll = long long;
using ull = unsigned long long;
const int INF = 1e9;
// const int MOD = 1e9 + 7;

/* nCk for small n
    n は 50 程度まで
    計算量: O(k)
*/
long long nCk(int n, int k) {
    long long ret = 1;
    for (int i = 0; i < k; i++) {
        ret = ret * (n - i) / (i + 1);
    }
    return ret;
}

int main() {
    int N, A, B;
    cin >> N >> A >> B;
    vector<ll> v(N);
    map<ll, ll> m;
    for (int i = 0; i < N; i++) {
        cin >> v.at(i);
        m[v[i]]++;
    }
    sort(v.begin(), v.end(), greater<ll>());

    ll sum = 0;
    map<ll, ll> mt;
    for (int i = 0; i < A; i++) {
        sum += v[i];
        mt[v[i]]++;
    }

    ll ans = 0;
    if (mt[v[A - 1]] == A) {
        for (int i = 0; i <= B - A && m[v[A - 1]] >= mt[v[A - 1]] + i; i++) {
            ans += nCk(m[v[A - 1]], mt[v[A - 1]] + i);
        }
    } else {
        ans += nCk(m[v[A - 1]], mt[v[A - 1]]);
    }

    cout << setprecision(20) << (long double)(sum) / (long double)A << "\n";
    cout << ans << endl;
}


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

int n,a[55];

int main()
{
    cin>>n;
    int x;
    for(int i=1;i<=n;i++)
        cin>>a[i];
    sort(a+1,a+n+1);
    for(int i=1;i<=n;i++)
        if(i%2==0)
            a[i]=24-a[i];
    sort(a+1,a+n+1);
    int res=1e9;
    for(int i=1;i<=n;i++)
        res=min(res,a[i]-a[i-1]);
    cout<<res;
}



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

#define pb push_back
#define ll long long
using namespace std;

int v[1000005];

int main() {
   int n; cin >> n;
   ll sum = 0;
   for(int i = 1; i <= n; i++) {
    for(int j = 1; j <= n; j++) {
        for(int k = 1; k <= n; k++) {
            int a = __gcd(i, j);
            int b = __gcd(a, k);
            //cout << a << endl;
            sum += b;
        }
    }
   }
   cout << sum << endl;
}


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

int main() {
    double a, b;

    cin >> a >> b;

    // 平均値
    double x = (a + b) / 2;
    int y = (a + b) / 2;

    if (x > y) {
        cout << y + 1 << endl;
    } else {
        cout << y << endl;
    }
}

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

namespace CSharp_AtCoder
{

    
    class Program
    {

        static List<int> TS(int N, int[] into_num, List<int>[] out_node)
        {
            List<int> ts_order = new List<int>(); 
            Queue<int> q = new Queue<int>(); 

            for(int i = 0; i < N; i++)
            {
                if (into_num[i] == 0) q.Enqueue(i);
            }

            while(q.Count != 0)
            {
                int from = q.Dequeue();
                ts_order.Add(from);
                foreach (var to in out_node[from])
                {
                    into_num[to]--;
                    if (into_num[to] == 0) q.Enqueue(to);
                }
            }

            return ts_order;
        }

        
        static void Main(string[] args)
        {
            int[] input = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
            int N = input[0];
            int M = input[1];

            List<int>[] out_node = new List<int>[N];
            for (int i = 0; i < N; i++) out_node[i] = new List<int>();
            int[] into_num = new int[N];

            for(int i = 0; i < M; i++)
            {
                input = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
                int from = input[0] - 1;
                int to = input[1] - 1;
                out_node[from].Add(to);
                into_num[to]++;
            }

            List<int> ts_order = TS(N, into_num, out_node);
            
            int[] dp = new int[N];
            for(int i = 0; i < N; i++)
            {
                int from = ts_order[i];
                foreach(var to in out_node[from])
                {
                    dp[to] = Math.Max(dp[to], dp[from] + 1);
                }
            }

            Console.WriteLine(dp.Max());
        }
    }
}


Measured memory_bytes: 28668
#include<bits/stdc++.h>
typedef long long ll;
#define REP(i,n) for(int i = 0;i < (n);i++)
#define rep(i,m,n) for(int i = (m);i < (n);i++)
#define P pair<int,int>
#define pb push_back
#define mk make_pair
using namespace std;
#define Vec(a) vector <int> a
const int INF = 1 << 20;
const int MOD = 1e9+7;





int main(){
  int a,b,sum = -3000000;
  cin >> a >> b;
  sum = max(sum,a+b);
  sum = max(sum,a-b);
  sum = max(sum,a*b);
  cout << sum << endl;
  return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#define in std::cin
#define out std::cout
#define rep(i,N) for(int i=0;i<N;++i)
typedef long long int LL;

LL Q, A, B;

int main()
{
	in >> Q;
	rep(loop, Q)
	{
		in >> A >> B;
		if (A > B) std::swap(A, B);
		if (B - A <= 1) out << 2 * A - 2 << std::endl;
		else
		{
			LL C = sqrt(A*B);
			if (C*C == A * B) --C;
			out << (C*(C + 1) >= A * B ? 2 * C - 2 : 2 * C - 1) << std::endl;
		}
	}
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
int gcd(int x, int y) { return (x % y)? gcd(y, x % y): y; }    //最大公約数
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }     //最小公倍数
using Graph = vector<vector<int>>;
ll inf=300000000000000000;
const double PI = 3.14159265358979323846;
int binary(vector<pair<pair<int,int>,int>> &k,int key,int l,int r){
  int mid=(l+r)/2;
  //if(key==2)cout << mid << " " << k[mid].first.second << " " << endl;
  if(l==mid){
    if(key>k[mid].first.first)return k[mid].second;
    else return k[r].second;
  }
  int x,y;
  x=k[mid].first.first;
  y=k[mid].first.second;
  if(x<key&&y>key)return k[mid].second;
  if(y<key)return binary(k,key,l,mid);
  else return binary(k,key,mid,r);
}
int main(){
  ll n,q;
  cin >> n >> q;
  ll ans=(n-2)*(n-2);
  int a=n,b=n;
  vector<pair<pair<int,int>,int>> k;
  vector<pair<pair<int,int>,int>> l;
  k.push_back(make_pair(make_pair(1,n),n));
  l.push_back(make_pair(make_pair(1,n),n));
  rep(i,q){
    //cout << ans << endl;
    int c,d;
    cin >> c >> d;
    if(c==1){
      //rep(j,k.size()){
      //  cout << k.size() << " " << k[j].first.first<< " " << k[j].first.second << " " << k[j].second << endl;
      //}
      ans-=(binary(k,d,0,k.size()-1)-2);
      if(b>d){
        pair<pair<int,int>,int> p=l[l.size()-1];
        l.pop_back();
        if(p.first.second==a)l.push_back(make_pair(make_pair(p.first.first,p.first.second),d));
        else{
          l.push_back(make_pair(make_pair(a,p.first.second),p.second));
          l.push_back(make_pair(make_pair(p.first.first,a),d));
        }
        b=d;
      }
    }
    if(c==2){
      /*rep(j,l.size()){
        cout << l.size() << " " <<  l[j].second << endl;
      }*/
      ans-=(binary(l,d,0,l.size()-1)-2);
      if(a>d){
        pair<pair<int,int>,int> p=k[k.size()-1];
        k.pop_back();
        if(p.first.second==b)k.push_back(make_pair(make_pair(p.first.first,p.first.second),d));
        else{
          k.push_back(make_pair(make_pair(b,p.first.second),p.second));
          k.push_back(make_pair(make_pair(p.first.first,b),d));
        }
        a=d;
      }
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 4532
#include <bits/stdc++.h>
using namespace std;
typedef pair<long long, long long> P;
#define int long long
#define override_rep(i, l, r, mes, ...) mes
#define rep1(i, n) for (int i = 0; i < n; i++)
#define rep2(i, l, r) for (int i = l; i < r; i++)
#define rep(...) override_rep(__VA_ARGS__, rep2, rep1)(__VA_ARGS__)
#ifdef DEBUG
std::ostream& dout = cout;
#else
stringstream dout;
#endif
template<typename T, typename U>
istream& operator>>(istream& in, pair<T, U>& p) {
    in >> p.first >> p.second;
    return in;
}

bool isPalindrome(string s){
    rep(i,s.size()){
        if(s[i]!=s[s.size()-i-1]){
            return false;
        }
    }
    return true;
}

signed main(signed argc, char* argv[]) {
    cin.tie(0);
    ios::sync_with_stdio(false);
    const int MOD = 1000000007;
    string s;
    cin>>s;
    if(isPalindrome(s)&&isPalindrome(s.substr(0,(s.size()-1)/2))&&isPalindrome(s.substr((s.size()+3)/2-1)))cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define data_type long long
#define endl "\n"
vector<data_type>nod;
inline void nod_all()
{
    data_type n=10000001;
    nod.resize(n+7);
    for(data_type i=1; i<=n; i++)
        {
            for(data_type j=i; j<=n; j+=i)
                nod[j]+=1;
        }
    for(data_type i=2; i<=n; i++)
        nod[i]=(nod[i]*i)+nod[i-1];
}
int main()
{
    nod_all()
;    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    data_type n;
    cin>>n;
    cout<<nod[n]<<endl;


    return 0;
}


Measured memory_bytes: 81232
inf = 10**18
mod = 10**9+7
n, k = map(int, input().split())
pc = [list(map(int, input().split())) for i in range(n)]
pc.reverse()
ans = inf
for i in range(2**n):
    acc=0
    accn=0
    for j in range(n):
        if ((i >> j) & 1):  # 1だったら(オンだったら)
            p,c = pc[j]
            acc+=((n-j)*100*p+c)
            accn+=p
            if acc>=k:
                ans=min(ans, accn)
    if k-acc >= 0:
        for j in range(n):
            if not ((i >> j) & 1):  # 0だったら(おふだったら)
                p, c = pc[j]
                if k - acc > ((n - j) *100* (p - 1)):
                    acc += ((n - j) *100* (p - 1))
                    accn += (p - 1)
                else:
                    tmp = (k-acc+(n-j)*100-1)//((n-j)*100)
                    acc += ((n - j) *100* tmp)
                    accn += tmp
                    ans = min(ans, accn)
                    break
print(ans)

Measured memory_bytes: 41200
N = int(input())
lst = []
for i in range(N):
    a, b = map(int, input().split())
    lst.append([a+b, a-b])
lst.sort()

cnt = 1
x = lst[0][0]
for i in lst:
    if x <= i[1]:
        cnt += 1
        x = i[0]

print(cnt)

Measured memory_bytes: 20104
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
using namespace std;

int main(){
    int n, x;
    cin >> n >> x;
    vector<int> m(n);
    int sum = 0;
    for(size_t i = 0; i < n; i++)
    {
        cin >> m[i];
        sum += m[i];
    }
    int min = *min_element(m.begin(), m.end());
    cout << n + (x-sum) / min << endl;
    return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(100000)
input = sys.stdin.readline
INF = 2**62-1

def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(H, W, N):
    return math.ceil(N/ max(H, W))


def main():
    H = read_int()
    W = read_int()
    N = read_int()
    print(slv(H, W, N))


if __name__ == '__main__':
    main()


Measured memory_bytes: 6732
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

// c++11
#include <array>
#include <tuple>
#include <unordered_map>
#include <unordered_set>

#define mp make_pair
#define mt make_tuple
#define rep(i, n) for (int i = 0; i < (n); i++)

using namespace std;

using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;

const int INF = 1 << 29;
const double EPS = 1e-9;
const ll MOD = 1000000007;

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

const int MAX_N = 100100;
vector<int> edges[MAX_N];
int N,M,Q;
bool visited[MAX_N];
int color[MAX_N];
int dp[MAX_N][11];
void color_node(const int idx, int v, int d, int c){
  queue<pii> que;

  que.push(mp(v, 0));
  while (not que.empty()){
    pii pos = que.front();
    que.pop();
    int p = pos.first;
    int dist = pos.second;
    if (dist > d)continue;
    if (visited[p]){
      int tmp = d - dist;
      bool ok = false;
      for (int i = tmp; i <= 10; i++){
          if (dp[p][i] >= 0){
            ok = true;
            break;
          }
      }
      if (ok)continue;
      dp[p][d - dist] = idx;
    }else{
      color[p] = c;
      visited[p] = true;

    }
    dp[p][d - dist] = idx;


    for (const auto &nxt : edges[p]){
      que.emplace(mp(nxt, dist + 1));
    }
  }
}
vector<tuple<int, int, int>> query;
void memo(const int v){
  queue<pii> que;
  que.push(mp(v, 0));
  while (not que.empty()){
    pii pos = que.front();
    que.pop();
    int p = pos.first;
    int dist = pos.second;
    if (dist > 10)continue;
    if (visited[p]){
      int res = INF;
      for (int i = dist; i <= 10; i++){
        if (dp[p][i] == -1)continue;
        res = min(res, dp[p][i]);
      }
      if (res == INF)continue;
      color[p] = get<2>(query[res]);
      dp[p][dist] = res;
      continue;
    }
    visited[p] = true;
    for (const auto &nxt : edges[p]){
      que.emplace(mp(nxt, dist + 1));
    }
  }
}

int main() {
  scanf("%d %d", &N, &M);
  for (int i = 0; i < M; i++){
    int a,b;
    scanf("%d %d", &a, &b);
    a--,b--;
    edges[a].push_back(b);
    edges[b].push_back(a);
  }
  scanf("%d", &Q);

  for (int i = 0; i < Q; i++){
    int v,d,c;
    scanf("%d %d %d", &v, &d, &c);
    v--;
    query.emplace_back(mt(v, d, c));
    // color_node(v, d, c);
  }
  reverse(query.begin(), query.end());
  for (int i = 0; i < MAX_N; i++){
    for (int j = 0; j < 11; j++){
      dp[i][j] = -1;
    }
  }
  for (int i = 0; i < Q; i++){
    int v,d,c;
    tie(v, d, c) = query[i];
    color_node(i, v, d, c);
  }




  for (int i = 0; i < N; i++){
    if (not visited[i]){
      // cout << "none" << " " << i << endl;
      memo(i);
    }
  }

  for (int i = 0; i < N; i++){
    cout << color[i] << endl;
  }
  return 0;
}


Measured memory_bytes: 13556
import sys

def BinarySearch(S, n, t):
    bottom = 0
    top = n - 1

    while bottom <= top:
        center = (bottom + top) // 2

        if S[center] == t:
            return center
        elif S[center] < t:
            bottom = center + 1
        else:
            top = center - 1

    return -1


n = int(sys.stdin.readline())
S = [int(s) for s in sys.stdin.readline().split()]

q = int(sys.stdin.readline())
T = {int(t) for t in sys.stdin.readline().split()}

ans = sum(BinarySearch(S, n, t) != -1 for t in T)

print(ans)

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

int main()
{
  int x, y, z;
  cin >> x >> y >> z;
  
  int cnt = 0;
  x -= z * 2;
  cnt += x / (y+z);
  if (x%(y+z) == y) cnt++;
  
  cout << cnt << endl;
}

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

namespace ABC091A
{
	class Program
	{
		static void Main(string[] args)
		{
			int a,b, c;
			var word = Console.ReadLine().Split(' ');
			a = int.Parse(word[0]);
			b = int.Parse(word[1]);
			c = int.Parse(word[2]);
			if (a + b < c)
			{
				Console.WriteLine("No");
			}
			else 
			{
				Console.WriteLine("Yes");
			}
			Console.ReadKey();
		}
	}
}


Measured memory_bytes: 13140
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ll long long
#define pp pair<ll,ll>
#define ld long double
#define all(a) (a).begin(),(a).end()
#define mk make_pair
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;
ll MOD=INF;
 
int main() {
    int a,b,c,k;
    cin >> a >> b >> c >> k;
    if (k<=a) cout << k << endl;
    else if (k<=a+b) cout << a << endl;
    else cout << a-(k-a-b) << endl;
}


Measured memory_bytes: 3636
#include <iostream>
#include <vector>
#include <cstring>
#include <string>
#include <algorithm>
#include <iomanip>
#include <cmath>
#include <cassert>
#include <map>
#include <set>
#include <complex>
using namespace std;
using ld = long double;
using P = complex<ld>;
using G = vector<P>;
const ld pi = acos(-1);
const ld eps = 1e-10;
const ld inf = 1e12;


ld cross(const P& a, const P& b) { return a.real()*b.imag() - a.imag()*b.real(); }
ld dot(const P& a, const P& b) { return a.real()*b.real() + a.imag()*b.imag(); }

enum { CCW = +1, CW = -1, BEHIND = +2, FRONT = -2, ON = 0 };
int ccw(P a, P b, P c) {
	b -= a; c -= a;
	if(cross(b, c) > eps)  return CCW;    // counter clockwise
	if(cross(b, c) < -eps) return CW;     // clockwise
	if(dot(b, c) < 0)      return BEHIND; // c--a--b on line
	if(norm(b) < norm(c))  return FRONT;  // a--b--c on line
	return ON;
}

struct L : public vector<P> {
	L(const P &a = 0, const P &b = 0) {
		push_back(a); push_back(b);
	}
	L(ld A, ld B, ld C) { // Ax + By + C = 0
		if(A < eps) *this = L(P(0, -C / B), P(1, -C / B));
		else if(B < eps) *this = L(P(-C / A, 0), P(-C / A, 1));
		*this = L(P(0, -C / B), P(-C / A, 0));
	}
	int ccw(const P& p) {
		return ::ccw((*this)[0], (*this)[1], p);
	}
};

P crosspointLL(const L &l, const L &m) {
	ld A = cross(l[1] - l[0], m[1] - m[0]);
	ld B = cross(l[1] - l[0], l[1] - m[0]);
	if(abs(A) < eps && abs(B) < eps) return m[0]; // same line
	if(abs(A) < eps) assert(false); // !!!PRECONDITION NOT SATISFIED!!!
	return m[0] + B / A * (m[1] - m[0]);
}

#define curr(pol, i) pol[i]
#define next(pol, i) pol[(i+1)%pol.size()]
G convex_cut(const G& pol, const L& l) {
	G res;
	for(int i = 0; i < pol.size(); ++i) {
		P A = curr(pol, i), B = next(pol, i);
		if(ccw(l[0], l[1], A) != -1) res.push_back(A);
		if(ccw(l[0], l[1], A)*ccw(l[0], l[1], B) < 0)
			res.push_back(crosspointLL(L(A, B), l));
	}
	return res;
}

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

	int n;
	while(cin >> n, n) {
		G g;
		for(int i = 0; i < n; i++) {
			ld x, y;
			cin >> x >> y;
			g.push_back(P(x, y));
		}

		G cut;
		cut.push_back(P(-1, 100000));
		cut.push_back(P(-1, -100000));
		cut.push_back(P(100000, 100000));
		cut.push_back(P(100000, -100000));

		bool ok = true;
		for(int i = 0; i < n; i++) {
			L l = L(g[i], g[(i + 1) % n]);
			cut = convex_cut(cut, l);
			if(cut.size() < 3) {
				ok = false;
				break;
			}
		}

		cout << 0 + ok << endl;
	}
}

Measured memory_bytes: 3064
// https://atcoder.jp/contests/agc039/tasks/agc039_a

#include "algorithm"
#include "iostream"
#include "set"
#include "vector"
#define rep(i, from, to) for (ll i = from; i < (to); ++i)
using namespace std;
typedef long long ll;
template <typename T>
using V = vector<T>;
template <typename T>
inline bool chmax(T& a, T b);
template <typename T>
inline bool chmin(T& a, T b);
void print_ints(vector<ll> v);
template <typename T>
void drop(T a);

string s;
ll k;

ll partial(string t) {
  ll len = t.size();
  ll ct = 0;
  auto prev = t[0];

  rep(i, 1, len) {
    if (t[i] == prev) {
      ct++;
      i++;
    }

    prev = t[i];
  }

  return ct;
}

void solve() {
  cin >> s >> k;
  ll len = s.size();

  {
    auto all_same = true;

    rep(i, 0, len - 1) {
      if (s[i] != s[i + 1]) {
        all_same = false;
        break;
      }
    }

    if (all_same) {
      drop((len * k) / 2);
    }
  }

  ll inside = partial(s);

  if (s[0] != s[len - 1]) {
    drop(inside * k);
  }

  // 等差で増えていく？

  ll twice = partial(s + s);
  ll diff = twice - inside;

  ll res = inside + (k - 1) * diff;
  cout << res << endl;
}

struct exit_exception : public std::exception {
  const char* what() const throw() { return "Exited"; }
};

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

  try {
    solve();
  } catch (exit_exception& e) {
  }

  return 0;
}
#endif

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

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

void print_ints(vector<ll> v) {
  rep(i, 0, v.size()) {
    if (i > 0) {
      cout << " ";
    }

    cout << v[i];
  }

  cout << endl;
}

template <typename T>
void drop(T res) {
  cout << res << endl;
  throw exit_exception();
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stdio.h>
#include <queue>
#include <stack>
#include <climits>
#include <map>
#include <set>

using namespace std;

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

const ll mod = 1000000007;
const int inf = 1e9;
const long long INF = 1LL << 60;   // INFの値は1152921504606846976

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

int main()
{
    int h,w;
    cin >> h >> w;
    char f[h][w];
    int d[h][w];
    int cnt = 0;
    for(int i = 0; i < h; i++){
        for(int j = 0; j < w ;j++){
            cin >> f[i][j];
            if(f[i][j] == '#') cnt++;
            d[i][j] = -1;
        }
    }
    vector<P> v;
    queue<P> que;
    que.push(make_pair(0,0));
    d[0][0] = 0;
    while(!que.empty()){
        P p = que.front(); que.pop();
        int x = p.first,y = p.second;
        for(int i = 0; i < 4; i++){
            int nx = x + dx[i];
            int ny = y + dy[i];
            if(nx >= 0 && nx < w && ny >= 0 && ny < h && d[ny][nx] == -1 && f[ny][nx] == '.'){
                d[ny][nx] = d[y][x] + 1;
                que.push(make_pair(nx,ny));
            }
        }
    }
    if(d[h-1][w-1] != -1){
        cout << h * w - d[h-1][w-1] - 1 - cnt;
    }else{
        cout << -1;
    }
  
    
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <algorithm>
#include <string>
#include <vector>
using namespace std;

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

vector<bool> seen;
vector<int> a, b;
void dfs(const vector<vector<int> > &graph, int v, int i){
    seen[v] = true;

    for(auto next_v : graph[v]){
        if((v==a[i] && next_v==b[i]) || (v==b[i] && next_v==a[i])) continue;
        if(seen[next_v]) continue;
        dfs(graph, next_v, i);
    }
}

int main()
{
    int n, m; cin >> n >> m;
    vector<vector<int> > edges(n);
    rep(i, m){
        int ai, bi;
        cin >> ai >> bi;
        --ai, --bi;
        a.push_back(ai);
        b.push_back(bi);
        edges[ai].push_back(bi);
        edges[bi].push_back(ai);
    }

    int ans = 0;
    rep(i, m){
        int cnt = 0;
        seen.assign(n, false);
        rep(k, n){
            if(seen[k]) continue;

            dfs(edges, k, i);
            cnt++;
        }
        if(cnt > 1) ans++;
    }
    
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3604
#include <iostream>
#include <fstream>
#include <typeinfo>
#include <vector>
#include <cmath>
#include <set>
#include <map>
#include <string>
#include <algorithm>
#include <cstdio>
#include <queue>
#include <iomanip>
#include <cctype>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<25;
const double pi=acos(-1);
const double eps=1e-8;
const vi emp;

int n;

int main(){
	while(1){
		cin>>n;
		if(!n) break;
		vp a(n);
		int c,m1,m2,m3,m4,s1,s2,s3,s4;
		for(int i=0;i<n;i++){
			cin>>c>>m1>>s1>>m2>>s2>>m3>>s3>>m4>>s4;
			a[i]=P((m1+m2+m3+m4)*60+s1+s2+s3+s4,c);
		}
		sort(a.begin(),a.end());
		cout<<a[0].second<<endl;
		cout<<a[1].second<<endl;
		cout<<a[n-2].second<<endl;
	}
}

Measured memory_bytes: 1236
N, M = map(int, input().split())
cities = []

for i in range(M):
    P, Y = map(int, input().split())
    cities.append((i, P, Y, ))

cities.sort(key=lambda x: (x[1], x[2], ))

c = 1
res = []
for i in range(len(cities)):
    cur = cities[i]
    code = '{0:06d}{1:06d}'.format(cur[1], c)
    if i + 1 < M:
        nxt = cities[i + 1]
        c = 1 if cur[1] != nxt[1] else c + 1
    res.append((cur[0], code, ))

res.sort(key=lambda x: x[0])

for r in res:
    print(r[1])


Measured memory_bytes: 35460
import java.util.Scanner;

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

        // 入力(a b)
        String a = sc.next();
        String b = sc.next();

        boolean honestA = a.equals("H");
        boolean honestB = b.equals("H");
        System.out.println(!(honestA ^ honestB) ? "H" : "D");
        sc.close();
    }
}

Measured memory_bytes: 35640
import java.util.*;
import java.lang.*;
import java.io.*;

class Main {
	public static void main (String[] args) throws java.lang.Exception {
		// your code goes here
		BufferedReader stdReader = new BufferedReader(new InputStreamReader(System.in));
		String line = stdReader.readLine();
		int n = Integer.valueOf(line);
		LinkedList<Integer> li = new LinkedList<Integer>();
		for(int i = 0; i < n; i++) {
			line = stdReader.readLine();
			String[] sss = line.split(" ");
			if(sss[0].equals("insert")) {
				Integer o = Integer.valueOf(sss[1]);
				li.add(0, o);
			}else if(sss[0].equals("delete")){
				Integer o = Integer.valueOf(sss[1]);
				li.remove((Object) o);
			}else if(sss[0].equals("deleteFirst")) {
				li.remove(0);
			}else if(sss[0].equals("deleteLast")) {
				li.remove(li.size()-1);
			}
		}
		result(li);
	}
	public static void print(String s) {
		System.out.println(s);
	}
	public static void result(LinkedList<Integer> li) {
		StringBuilder bu = new StringBuilder();
		for(Integer i: li) {
			if(bu.length() > 0) {
				bu.append(" ");
			}
			bu.append(i);
		}
		print(bu.toString());
	}
}


Measured memory_bytes: 203812
num, length = map(int, input().split(" "))
li = [input() for x in range(num)]
li_sort = []

def q_sort(li):
    left = []
    right = []
    if len(li) <= 1:
        return li
    
    ref = li[0]
    ref_count = 0

    for ele in li:
        if ele < ref:
            left.append(ele)
        elif ele > ref:
            right.append(ele)
        else:
            ref_count += 1
    left = q_sort(left)
    right = q_sort(right)
    return left + [ref] * ref_count + right
print("".join(q_sort(li)))


Measured memory_bytes: 3064
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <cmath>
#include <map>
using namespace std;

int main()
{

    int n;
    cin >> n;
    double x;
    string u;
    double ans;
    for (int i = 0; i < n; i++)
    {
        cin >> x >> u;
        if(u == "JPY")
        {
            ans += x;
        }
        else
        {
            ans += 380000.0 * x;
        }
        
    }
    cout << ans << endl;
    
    
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
long long int s, m, l, el;
long long int am;
vector<pair<long long int, long long int> > v;
long long int pr = 0;
int main() {
	cin >> s >> m >> l >> el;
	cin >> am;
	am *= 4;
	//cout << am << "AM" << endl;
	while (am != 0) {
		v.clear();
		v.push_back(make_pair(s * 8, 1));
		if (am >= 2)
			v.push_back(make_pair(m * 4, 2));
		if (am >= 4)
		v.push_back(make_pair(l * 2, 4));
		if (am >= 8)
			v.push_back(make_pair(el, 8));
		sort(v.begin(), v.end()); 
		for (int i = 0; i < v.size(); i++)
			v[i].first /= (8 / v[i].second);
		//cout << v[0].first << " " << v[0].second << "HELLO" << endl;
		pr += ((am / (v[0].second)) * v[0].first);	
		am %= v[0].second;
		//cout << pr << " " << am << endl;
		//cout << s << " " << m << " " << l << " " << el << endl;	
	}
	cout << pr << endl;
}

Measured memory_bytes: 256