akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    while(true){
      int m = Integer.parseInt(sc.next());
      int f = Integer.parseInt(sc.next());
      int r = Integer.parseInt(sc.next());
      if(m == -1 && f == -1 && r == -1){
        break;
      }
      else{
        if(m == -1 || f == -1){
          System.out.println("F");
          continue;
        }
        else if((m + f) >= 80){
          System.out.println("A");
          continue;
        }
        else if((m + f) >= 65){
          System.out.println("B");
          continue;
        }
        else if((m + f) >= 50){
          System.out.println("C");
          continue;
        }
        else if((m + f) >= 30){
          if(r >= 50){
            System.out.println("C");
            continue;
          }
          else{
            System.out.println("D");
            continue;
          }
        }
        else{
          System.out.println("F");
          continue;
        }
      }
    }
  }
}


Measured memory_bytes: 26176
s = input()
if len(s) < 2:
    print("-1 -1")
else:
    for i in range(len(s) - 1):
        if s[i] == s[i + 1]:
            print(i+1, i + 2)
            break
    else:
        for i in range(len(s) - 2):
            if s[i] == s[i + 2]:
                print(i+1, i + 3)
                break
        else:
            print("-1 -1")


Measured memory_bytes: 39408
#include<stdio.h>

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

int bubbleSort(int A[],int N){
	int i,j;
	int sw = 0;
	int flag = 1;
	for(i=0;flag;i++){
		flag=0;
		for(j=N-1;j>=i+1;j--){
			if(A[j]<A[j-1]){
				swap(&A[j],&A[j-1]);
				flag=1;
				sw++;
			}
		}
	}
	
	return sw;
}
	

int main(void){
int i, N=0, sw;
int A[100];
	scanf("%d", &N);
	for(i=0;i<N;i++){
		scanf("%d",&A[i]);
	}
		sw=bubbleSort(A,N);
		
		for(i=0;i<N;i++){
			if(i){
			printf(" ");
			}
			printf("%d",A[i]);
		}
	printf("\n%d\n", sw);
return 0;
}


Measured memory_bytes: 1952
(eval-when (:compile-toplevel :load-toplevel :execute)
  (defparameter OPT
    #+swank '(optimize (speed 3) (safety 2))
    #-swank '(optimize (speed 3) (safety 0) (debug 0)))
  #+swank (progn (ql:quickload '(:cl-debug-print :fiveam))
                 (shadow :run)
                 (use-package :fiveam)))
#+swank (cl-syntax:use-syntax cl-debug-print:debug-print-syntax)

;; BEGIN_INSERTED_CONTENTS
(defmacro define-int-types (&rest bits)
  `(progn
     ,@(mapcar (lambda (b) `(deftype ,(intern (format nil "UINT~A" b)) () '(unsigned-byte ,b))) bits)
     ,@(mapcar (lambda (b) `(deftype ,(intern (format nil "INT~A" b)) () '(signed-byte ,b))) bits)))
(define-int-types 2 4 7 8 15 16 31 32 62 63 64)

(defmacro println (obj &optional (stream '*standard-output*))
  `(let ((*read-default-float-format* 'double-float))
     (prog1 (princ ,obj ,stream) (terpri ,stream))))

(defconstant +mod+ 1000000007)

;; Hauptteil

(defun main ()
  (let* ((a (read))
         (b (read))
         (c (read)))
    (println
     (min c
          (floor b a)))))

#-swank(main)



Measured memory_bytes: 16228
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vl;

const ll lg=31;
const ll N=1e5+5;
const ll INF=3e18;
const ll mod=1e9+7;
const double PI = 3.14159265358979323846;

#define f first
#define s second
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define repp(i, a, b) for(int i = a; i > (b); --i)
#define sz(x) (int)(x).size()
#define pb push_back
#define GCD(a,b) __gcd((a),(b))
#define all(v) v.begin(),v.end()
#define LCM(a,b) ((a)*(b))/GCD((a),(b))
#define FASTIO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

int main() {
	FASTIO;
	string s;
	cin >> s;
	char c = s[s.size() - 1];
	if (c == 's') {
	    s += "es";
	} else {
	    s += "s";
	}
	cout << s << endl;
	return 0;
}

Measured memory_bytes: 3656
#include <bits/stdc++.h>
#define ll long long
#define INF 1000000005
#define MOD 1000000007
#define EPS 1e-10
#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 srep(i,s,t) for(int i=(int)(s);i<(int)(t);++i)
#define each(a,b) for(auto& (a): (b))
#define all(v) (v).begin(),(v).end()
#define len(v) (int)(v).size()
#define zip(v) sort(all(v)),v.erase(unique(all(v)),v.end())
#define cmx(x,y) x=max(x,y)
#define cmn(x,y) x=min(x,y)
#define fi first
#define se second
#define pb push_back
#define show(x) cout<<#x<<" = "<<(x)<<endl
#define spair(p) cout<<#p<<": "<<p.fi<<" "<<p.se<<endl
#define sar(a,n) cout<<#a<<":";rep(pachico,n)cout<<" "<<a[pachico];cout<<endl
#define svec(v) cout<<#v<<":";rep(pachico,v.size())cout<<" "<<v[pachico];cout<<endl
#define svecp(v) cout<<#v<<":";each(pachico,v)cout<<" {"<<pachico.first<<":"<<pachico.second<<"}";cout<<endl
#define sset(s) cout<<#s<<":";each(pachico,s)cout<<" "<<pachico;cout<<endl
#define smap(m) cout<<#m<<":";each(pachico,m)cout<<" {"<<pachico.first<<":"<<pachico.second<<"}";cout<<endl

using namespace std;

typedef pair<int,int> P;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<double> vd;
typedef vector<P> vp;
typedef vector<string> vs;

const int MAX_N = 100005;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vl x(n), y(n);
    ll flag = -1;
    rep(i,n){
        cin >> x[i] >> y[i];
        if(flag < 0){
            flag = abs(x[i]+y[i])%2;
        }else if(abs(x[i]+y[i])%2 != flag){
            cout << "-1\n";
            return 0;
        }
    }
    ll nw = 1;
    if(flag){
        cout << "40\n";
        rep(i,40){
            cout << nw << " ";
            nw *= 2;
        }
        cout << "\n";
    }else{
        cout << "40\n";
        cout << nw << " ";
        rep(i,39){
            cout << nw << " ";
            nw *= 2;
        }
        cout << "\n";
    }
    rep(i,n){
        if(!flag) cout << 'R', x[i]--;
        string s;
        ll val = nw / 2;
        while(val){
            if(y[i] > x[i]){
                if(y[i] > -x[i]){
                    s.pb('U');
                    y[i] -= val;
                }else{
                    s.pb('L');
                    x[i] += val;
                }
            }else{
                if(y[i] > -x[i]){
                    s.pb('R');
                    x[i] -= val;
                }else{
                    s.pb('D');
                    y[i] += val;
                }
            }
            val /= 2;
        }
        reverse(all(s));
        cout << s << "\n";
    }
    return 0;
}


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

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

typedef long long ll;


using namespace std;

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


long long int n,cnt=0,ans=0,a,b,c,d,cmp,cmpp,m,h,w,x,y,sum=0,pos,dp[100002][4];
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
string alph("ABC"),s;
bool fl;
struct edge{int to,cost;};

//-------------------------↓↓↓↓↓↓------------------------

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

      
      cin>>s;
      dp[0][0]=1;
      rep(i,Size(s)){
        if(s[i]=='A'||s[i]=='?'){
          dp[i+1][0]+=dp[i][0];
          dp[i+1][1]+=dp[i][1];
          dp[i+1][2]+=dp[i][2];
          dp[i+1][3]+=dp[i][3];
          dp[i+1][1]+=dp[i][0];
        }
        if(s[i]=='B'||s[i]=='?'){
          dp[i+1][0]+=dp[i][0];
          dp[i+1][1]+=dp[i][1];
          dp[i+1][2]+=dp[i][2];
          dp[i+1][3]+=dp[i][3];
          dp[i+1][2]+=dp[i][1];
        }
        if(s[i]=='C'||s[i]=='?'){
          dp[i+1][0]+=dp[i][0];
          dp[i+1][1]+=dp[i][1];
          dp[i+1][2]+=dp[i][2];
          dp[i+1][3]+=dp[i][3];
          dp[i+1][3]+=dp[i][2];
        }
        rep(j,4)dp[i+1][j]%=MOD;
      }
      Cout(dp[Size(s)][3]);
     

       
return 0;
}


Measured memory_bytes: 3664
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <string>
#include <map>
#include <queue>

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = (n) - 1; i >= 0; i--)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (a); i > (b); i--)
#define ALL(a) (a).begin(), (a).end()

int N;
char S[200][200];
bool used[200];
vector<int> before;

int check(vector<int> cur, int cnt) {
    map<int, bool> next_m;
    for (int c : cur) {
        REP(i, N) {
            if (S[c][i] == '1') {
                if (used[i]) {
                    if (!binary_search(ALL(before), i) && !next_m[i]) return -1;
                }
                else {
                    used[i] = true;
                    next_m[i] = true;
                }
            }
        }
    }
    vector<int> next;
    for (auto n : next_m) next.push_back(n.first);
    if (next.empty()) return cnt;

    sort(ALL(next));
    before = cur;
    return check(next, cnt + 1);
}

int main() {
    cin >> N;
    REP(i, N) cin >> S[i];

    int ans = -1;
    REP(i, N) {
        before.clear();
        REP(j, N) used[j] = false;
        used[i] = true;
        vector<int> v;
        v.push_back(i);
        ans = max(ans, check(v, 1));
    }

    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 384
#include<iostream>
#include<vector>
#include<string>
#include<string.h>
using namespace std;

char ma[12][12];
bool vi[12][12];
int mv[4][2]={{0,1},{0,-1},{1,0},{-1,0}};

void dfs(int x, int y){
    vi[y][x]=1;
    for(int i=0;i<4;i++){
        int nx=x+mv[i][0],ny=y+mv[i][1];
        if(ny>=0&&nx>=0&&ny<12&&nx<12&&(!vi[ny][nx])&&(ma[ny][nx]=='1'))
            dfs(nx,ny);
    }
}

int main(){
    
    while(cin>>ma[0][0]){
        for(int i=0;i<12;i++){
            for(int j=0;j<12;j++){
                if(!i&&!j)continue;
                cin>>ma[i][j];
            }
        }
        int co=0;
        memset(vi, 0, sizeof(vi));
        for(int i=0;i<12;i++){
            for(int j=0;j<12;j++){
                if(ma[i][j]=='1'&&!vi[i][j]){
                    co++;
                    dfs(j,i);
                }
            }
        }
        cout<<co<<endl;
    }
    
}

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

x = tx - sx
y = ty - sy

ans = ''
ans += 'U'*y+'R'*x
ans += 'D'*y+'L'*x
ans += 'L'+'U'*(y+1)+'R'*(x+1)+'D'
ans += 'R'+'D'*(y+1)+'L'*(x+1)+'U'
print(ans)

Measured memory_bytes: 3060
use std::io::{stdin, Read};

macro_rules! parse {
    ($it: ident) => {
        $it.next().unwrap().parse().unwrap()
    };
    ($it: ident,2) => {
        (parse!($it), parse!($it))
    };
    ($it: ident,3) => {
        (parse!($it), parse!($it), parse!($it))
    };
    ($it: ident,4) => {
        (parse!($it), parse!($it), parse!($it), parse!($it))
    };
    ($it: ident, $n: expr) => {
        (&mut $it).take($n).map(|e| e.parse().unwrap()).collect();
    };
}

fn primes(x: usize) -> Vec<usize> {
    let mut cur = 1;
    let mut ret = vec![];
    while cur * cur <= x {
        if x % cur == 0 {
            if cur != 1 {
                ret.push(cur);
            }
            if cur != x / cur {
                ret.push(x / cur);
            }
        }
        cur += 1;
    }
    ret
}

fn solve(s: &str) {
    let mut it = s.split_whitespace();
    let n: usize = parse!(it);
    let mut p = primes(n - 1);
    let mut ret = p.len();

    let p = primes(n);
    for k in p {
        let mut a = n / k;
        while a % k == 0 {
            a /= k;
        }
        if a % k == 1 {
            ret += 1;
        }
    }
    println!("{}", ret);
}

fn main() {
    let mut s = String::new();
    stdin().read_to_string(&mut s).unwrap();
    solve(&s);
}

#[cfg(test)]
mod tests {
    use super::*;
    #[test]
    fn test_input() {
        let s = "
        ";
        solve(s);
    }
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
typedef pair<double, int> P;
vector<P> v[4];

int main() {
	for (int i = 0; i != 24; ++i) {
		int n;
		double t;
		cin >> n >> t;
		v[i / 8].push_back(P(t, n));
	}
	for (int i = 0; i != 3; ++i)
		sort(v[i].begin(), v[i].end());

	for (int i = 0; i != 3; ++i)
		for (int j = 2; j != 8; ++j)
			v[3].push_back(v[i][j]);

	sort(v[3].begin(), v[3].end());

	for (int i = 0; i != 4; ++i)
		for (int j = 0; j != 2; ++j)
			cout << v[i][j].second << ' ' << fixed << setprecision(2)
					<< v[i][j].first << endl;

	return 0;
}

Measured memory_bytes: 3148
n=int(input())
cnt=0
def rei(a,f3,f5,f7):
    global cnt
    #print(a,cnt)
    if a>n:
        return
    elif f3&f5&f7:
        cnt+=1
    rei(a*10+3,True,f5,f7)
    rei(a*10+5,f3,True,f7)
    rei(a*10+7,f3,f5,True)

rei(0,False,False,False)
print(cnt)


Measured memory_bytes: 41840
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;

namespace AtCoderSolve
{
    class Solve
    {
        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

            string s = Console.ReadLine();
            char[] c = s.Distinct().ToArray();
            
            char[] t = "abcdefghijklmnopqrstuvwxyz".ToCharArray();


            string ans = "None";
            for(var i = 0; i < t.Length; i++)
            {
                if (c.Contains(t[i]))
                {
                    continue;
                }
                ans = $"{t[i]}";
                break;
                    

            }
            Console.WriteLine(ans);
           
            
            

            Console.Out.Flush();
        }
    }
}


Measured memory_bytes: 13664
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		int count = 0;

		while(true) {
			if((A-1) * count + 1 >= B) {
				break;
			}
			count += 1;
		}
		System.out.println(count);
	}
}

Measured memory_bytes: 22100
#include <bits/stdc++.h>
#define rep(i,j,k) for(int i=(int)j;i<(int)k;i++)
#define itrep(x) for(auto it=(x).begin();it!=(x).end();it++) 
#define Sort(x) sort((x).begin(),(x).end())
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define vi vector<int>
#define INF (int)1e9
#define INFL 1e18
#define MOD 1000000007
#define pb push_back
#define MP make_pair
typedef long long int ll;
typedef std::pair<int,int> P;
int D=1;
int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};
 
using namespace std;
 
int main(){
    while(1){
    int n,m,a;
    cin>>n>>m>>a;
    if(n==0&&m==0&&a==0)break;
    vector<int> ans(n);
    rep(i,0,n)ans[i]=i+1;
     
    vector<pair<int,pair<int,int>>> v(m);
    rep(i,0,m){
        cin>>v[i].first>>v[i].second.first>>v[i].second.second;
    }
     
    Sort(v);
    rep(i,0,m){
        swap(ans[v[i].second.first-1],ans[v[i].second.second-1]);
    }
    cout<<ans[a-1]<<endl;
    }
    return 0;
}


Measured memory_bytes: 3028
import java.util.Scanner;
 
public class Main {
    static final int INF = 2000000000;
 
    static long ans;
 
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
 
        int n = sc.nextInt();
        int[] a = new int[n];
        for(int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
        }
 
        ans = 0;
        mergeSort(a, 0, n);
 
        System.out.println(ans);
 
        sc.close();
    }
 
    private static void mergeSort(int[] a, int left, int right) {
        if(left + 1 < right) {
            int mid = (left + right) / 2;
            mergeSort(a, left, mid);
            mergeSort(a, mid, right);
            merge(a, left, mid, right);
        }
    }
 
    private static void merge(int[] a, int left, int mid, int right) {
        int n1 = mid - left;
        int n2 = right - mid;
 
        int[] l = new int[n1 + 1];
        int[] r = new int[n2 + 1];
        for(int i = 0; i < n1; i++) {
            l[i] = a[left + i];
        }
        for(int i = 0; i < n2; i++) {
            r[i] = a[mid + i];
        }
        l[n1] = INF;
        r[n2] = INF;
 
        int i = 0;
        int j = 0;
        for(int k = left; k < right; k++) {
            if(l[i] < r[j]) {
                ans += j;
                a[k] = l[i];
                i++;
            }else {
                a[k] = r[j];
                j++;
            }
        }
    }
}


Measured memory_bytes: 101240
#pragma GCC optimize ("Ofast")
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define FOR(i, a, b) for (int i=(a); i<(int)(b); i++)
#define FORD(i, a, b) for (int i=a; i>(int)(b); i--)
#define PPC(x) __builtin_popcount(x)
#define SZ(x) ((int)(x).size())
#define pb push_back
#define ALL(x) (x).begin(), (x).end()
#define ithBit(m, i) ((m) >> (i) & 1)
#define ft first
#define sd second
#define kw(a) ((a) * (a))
#ifdef DEBUG
#include "debug.h"
#else
#define dbg(...) 0
#endif
using namespace std;
 
const int maxN = 1 << 21;
 
 
void solve()
{
	int a, b, c, d;
	scanf ("%d", &a);
	
	long long res = 0;
	FOR(i, 1, a+1)
	{
		if (i % 3 != 0 and i%5 != 0)
			res += i;
	}
	
	printf("%lld\n", res);
}
 
int main()
{
	int t;
	t=1;//scanf ("%d", &t);
	while (t--)
		solve();
	return 0;
}

Measured memory_bytes: 3816
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define sz(a) (a).size() 
#define all(c) (c).begin(),(c).end()
#define rep(i,n) for(int i=0;i<n;i++)
#define forn(i,n) for(int i=1;i<=n;i++)
#define ford(i,n) for(int i=n;i>=0;i--) 
#define REP(i,a,n) for(int i=a;i<n;i++)
#define foreach(c,itr) for(__typeof((c).begin(),(c).end())itr=c.begin();itr!=c.end();itr++) 
#define fill(a,b) memset(a,b,sizeof(a))
#define re return
#define INF 1e9
#define LINF 1e18
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pi;
typedef vector<int> vi;
typedef vector<pi > vpi; 
int main(){
	int a,b,c;
	cin>>a>>b>>c;
	if(a+b+c>=22){
		cout<<"bust";
	} 
	else{
		cout<<"win";
	}
	re 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i,b,n) for(int i=b;i<(int)n;i++)
#define rep(i,n) REP(i,0,n)
ll mod=1e9+7;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,m;cin>>n>>m;
    std::vector<int> h(n);
    vector<int> to[n];
    rep(i,n)cin>>h[i];
    rep(i,m){
      int s,t;cin>>s>>t;
      --s;--t;
      to[s].push_back(t);
      to[t].push_back(s);
    }
    int tot=0;
    rep(i,n){
      int kari=0;
      for(auto g:to[i])kari=max(kari,h[g]);
      if(kari<h[i])tot++;
    }
    cout<<tot<<endl;
    return 0;
}


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

long long* binarySearch(long long x, long long* left, long long* right){
    
    while(left < right){
        long long *ptr = left + (right - left) / 2;
        if( x < *ptr ){
            right = ptr;
        }else{
            left = ptr + 1;
        }  
    }
    return left;
}

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

    long long a[N];
    for(int i = 0; i < N; i++) {
        cin >> a[i];
    }

    long long dp[N];
    int last = 1;
    dp[0] = a[0];
    for(int i = 1; i < N; i++) {
        // for(int j = 0; j <= last; j++) {
        //     cout << dp[j] << " ";
        // }
        // cout << endl;

        if(dp[last-1] < a[i]){
            dp[last++] = a[i];
            continue;
        }
        *lower_bound(dp,dp+last,a[i])=a[i];
        //long long* p = upper_bound(dp, dp+last-1, a[i]);
        //long long* p = binarySearch(a[i], dp, dp+last);
        //*p = a[i];
    }

    cout << last << endl;
    return 0;
}


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

using namespace std;

const int N = 2e5 + 10;
typedef long long LL;

int n, K, m, tot, a[N], idx[N], s[N];
LL sum[N], b[N];

int lowbit(int x){
	return x&(-x);
}

void add(int x, int v){
	for(; x<=m; x+=lowbit(x))	s[x] += v;
}

int Sum(int x){
	int ret = 0;
	for(; x>0; x-=lowbit(x))	ret += s[x];
	return ret;
}

int cal(LL val){
    int j = lower_bound(b, b+m, val) - b + 1;
    return tot - Sum(j - 1);
}

int main(){
	while(~scanf("%d %d", &n, &K)){
		sum[0] = 0;
		for(int i=1; i<=n; i++){
			scanf("%d", a+i);
			sum[i] = sum[i-1] + a[i] - K;
			b[i - 1] = sum[i];
			s[i] = 0;
		}
		sort(b, b+n);
		m = unique(b, b+n) - b;
        LL ans = 0;
        LL cur = 0;
        for(int i=1; i<=n; i++){
			idx[i] = lower_bound(b, b+m, sum[i]) - b + 1;
			add(idx[i], 1);
        }
        tot = n;
        for(int i=1; i<=n; i++){
			ans = ans + cal(cur);
            add(idx[i], -1);
            cur = cur + a[i] - K;
            tot--;
        }
        printf("%lld\n", ans);
	}
	return 0;
}


Measured memory_bytes: 5760
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <cmath>

using namespace std;
#define PI 3.1415926535897932384626433832795
#define MOD (1000000007)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repc(i, s, n) for (int i = (s); i <= (n); i++)
#define rrep(i, n) for (int i = (n) - 1; i >= 0; i--)
#define rrepc(i, s, n) for (int i = (s); i >= (n); i--)
#define swap(a, b, type) { type _tmp = a; a = b; b = _tmp; }
typedef long long ll;
typedef unsigned long long ull;

int main()
{
	string s, ans;
	set<char> chars;

	cin >> s;

	rep(i, s.length()) chars.insert(s[i]);

	if (chars.size() <= 2) ans = "Second";
	else if (s[0] == s[s.length() - 1]) {
		if (s.length() % 2 == 0) ans = "First";
		else ans = "Second";
	}
	else {
		if (s.length() % 2 == 0) ans = "Second";
		else ans = "First";
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <vector>
#include <queue>
#include <string>
#include <cmath>
#include <map>
#include <string.h>
#define ll long long

using namespace std;

int n;

int main(){
	
	cin >> n;
	if(n >= 195)
		cout << 5 << endl;
	else if(n >= 189)
		cout << 4 << endl;
	else if(n >= 165)
		cout << 3 << endl;
	else if(n >= 135)
		cout << 2 << endl;
	else if(n >= 105)
		cout << 1 << endl;
	else
		cout << 0 << endl;

	return 0;
}

Measured memory_bytes: 256
input = gets.split("\s")
a = gets.split("\s").map(&:to_i)
n = input[0].to_i
k = input[1].to_i

b_self = 0
b_other = 0
dp = Array.new(n, 0)

n.times do |i|
  n.times do |j|
    if(a[i] > a[j])
      b_other += 1
      if(i < j)
        b_self += 1
      end
    end
  end
end

b_other *= (k * (k-1)) / 2 #k-1 ... 1
b_self *= k
puts (b_other + b_self) % (10**9 + 7)


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

int main() {
  int x;
  cin >> x;
  while (true) {
    bool flag = true;
    for (int i = 2; 1LL*i*i <= x; i++) {
      if (x % i == 0) {
        flag = false;
        break;
      }
    }
    if (flag) break;
    x++;
  }
  cout << x << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
  int W,H,x,y,r,minx,miny,maxx,maxy;
  scanf("%d %d %d %d %d",&W,&H,&x,&y,&r);
  minx = x - r;
  miny = y - r;
  maxx = x + r;
  maxy = y + r;
  if (W > 0 && H > 0){
    if (maxx <= W && maxy <= H && minx >= 0 && miny >= 0){printf("Yes\n");}else{printf("No\n");}
  }
  if(W > 0 && H < 0){
    if (maxx <= W && maxy <= 0 && minx >= 0 && miny >= H){printf("Yes\n");}else{printf("No\n");}
  }
  if(W < 0 && H < 0){
    if (maxx <= 0 && maxy <= 0 && minx >= W && miny >= H){printf("Yes\n");}else{printf("No\n");}
  }
  if(W < 0 && H > 0){
    if (maxx <= 0 && maxy >= H && minx >= W && miny >= 0){printf("Yes\n");}else{printf("No\n");}
  }
}



Measured memory_bytes: 2668
use std::io::{stdin, Read, StdinLock};
use std::str::FromStr;
use std::cmp::max;

fn main() {
    let cin = stdin();
    let mut scan = Scanner::new(cin.lock());
    let n = scan.read::<usize>();
    let h = scan.readn::<i64>(n);
    let mut cnt = 0i64;
    let mut ret = 0i64;
    for i in (1..n).rev() {
        if h[i-1] >= h[i] {
            cnt += 1;
        } else {
            ret = max(ret, cnt);
            cnt = 0;
        }
    }
    ret = max(ret, cnt);
    println!("{}", ret);
}

// region template
#[allow(dead_code)]
fn iu(i: isize) -> usize { i as usize }

#[allow(dead_code)]
fn ui(i: usize) -> isize { i as isize }

#[allow(dead_code, deprecated)]
fn join<T: std::fmt::Display>(slice: &[T], sep: &str) -> String {
    let strings = slice.iter().map(|t| format!("{}", t)).collect::<Vec<_>>();
    strings.connect(sep)
}

#[allow(dead_code)]
fn arr<'a, S, T>(n: usize, mut f: S) -> Vec<T> where S: FnMut(usize) -> T + 'a {
    (0..n).map(|i| f(i)).collect::<Vec<T>>()
}

struct Scanner<'a> {
    cin: StdinLock<'a>,
}

#[allow(dead_code)]
impl<'a> Scanner<'a> {
    fn new(cin: StdinLock<'a>) -> Scanner<'a> {
        Scanner { cin: cin }
    }

    fn read1<T: FromStr>(&mut self) -> Option<T> {
        let token = self.cin.by_ref().bytes().map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>();
        token.parse::<T>().ok()
    }

    fn read<T: FromStr>(&mut self) -> T {
        self.read1().unwrap()
    }

    fn readn<T: FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read::<T>()).collect()
    }

    fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}
// endregion

Measured memory_bytes: 4352
#include<iostream>
#include<iomanip>
#include<limits>
#include<string>
#include<vector>
#include<algorithm>
#include<stdio.h>
#include<cmath>
#include <functional>

#define big ((long long)(1e9)+7)

using namespace std;

typedef unsigned long long ull;
typedef long long ll;

int main()
{
	string s;
	cin >> s;
	vector<ll> w;
	for(ll i = 0;i < s.size();i++)
	{
		if(s.at(i) == 'W')
		{
			w.push_back(i);
		}
	}

	// for(ll i = 0;i < w.size();i++)
	// {
	// 	cout << i << " " << w[i] << endl;
	// }

	ll ans = 0;
	for(ll i = 0;i < w.size();i++)
	{
		ans += w[i]-i;
	}
	cout << ans << endl;
}


Measured memory_bytes: 2552
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)*}
    };
  }

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)*}
    };
  }

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };
    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };
    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };
    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };
    // 3
    // 1 2
    // 1 3
    // 1 4
    // のようなタイプ
    ($next:expr, [ $t:tt ]) => {{
        let len = read_value!($next, usize);
        (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    }};
    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
  }
fn main() {
    input! {
        r:usize
    }

    println!("{}", r * r);
}


Measured memory_bytes: 4352
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <map>
#include <unordered_map>
#include <set>
#include <queue>
using namespace std;
#define ALL(x) (x).begin(),(x).end()
#define SZ(x) int((x).size())
#define OUT(x) cout << (x) << endl
typedef long long ll;
typedef vector<int> V;
typedef vector< vector<int> > VV;
typedef pair<int, int> P;
typedef map<string, int> M;
typedef unordered_map<int, int> HM;
typedef set<int> S;
typedef multiset<int> MS;
typedef queue<int> Q;

int main(){
    ll n,m; cin>>n>>m;
    ll ans = min(n,m/2);
    n -= ans;
    m -= ans*2;
    if(m > 1)
        ans += m/4;
    OUT(ans);
}

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

using namespace std;

int main()
{
	int A, B;
	cin >> A >> B;

	if(A==1){
		A = 14;
	}

	if (B == 1) {
		B = 14;
	}

	if (A > B) {
		cout << "Alice" << endl;
	}
	else if (A < B) {
		cout << "Bob" << endl;
	}
	else {
		cout << "Draw" << endl;
	}


}






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

using namespace std;

typedef long long int ll;

int n,k;
vector<int> a;

bool ok(int md){
	int cnt = 0;
	for(int  i = 0; i < n; i++){
		cnt += (a[i] - 1) / md;
	}
	return cnt <= k;
}

int main(){
	cin >> n >> k;
	a.resize(n);
	for(int i = 0; i < n; i++){
		cin >> a[i];
	}
	int low = 1;
	int high = 1e9;
	int ans = 1e9;
	while(low <= high){
		int md = (low + high) / 2;
		if(ok(md)){
			high = md - 1;
			ans = min(ans,md);
		}else{
			low = md + 1;
		}
	}
	cout << ans << "\n";
	return 0;
}


Measured memory_bytes: 3952
#include <iostream>
#include <cstdio>
#include <cctype>
#include <string>
using namespace std;

int main(int argc, char const *argv[])
{
    int la = 65, sa = 97;
    int d = sa - la;
    int arr[26];
    for(int i = 0; i < 26; i ++){
        arr[i] = 0;
    }
    char c;
    while(scanf("%c", &c) != EOF){
        if(isalpha(c)){
            arr[(c-la) % d]++;
        }
    }
    for(int i = 0; i < 26; i ++){
        printf("%c : %d\n", sa + i, arr[i]);
    }
    return 0;
}


Measured memory_bytes: 3232
#include <cstdio>
#include <algorithm>

int n;
int a[101];

int main() {
    scanf("%d", &n);
    for (int i = 1; i <= n; ++i) scanf("%d", a + i);
    int ans = 1e9;
    for (int i = 1; i <= 100; ++i) {
        int sum = 0;
        for (int j = 1; j <= n; ++j) sum += (a[j] - i) * (a[j] - i);
        ans = std::min(ans, sum);
    }
    printf("%d\n", ans);
    return 0;
}


Measured memory_bytes: 128
def main():
    import sys
    input = sys.stdin.readline

    N, M = map(int, input().split())
    cnt = 0
    wa = 0
    flg = {i: 0 for i in range(1, N+1)}
    for _ in range(M):
        p, ver = input().split()
        p = int(p)
        if ver == 'AC':
            if flg[p] >= 0:
                cnt += 1
                wa += flg[p]
                flg[p] = -1
        else:
            if flg[p] >= 0:
                flg[p] += 1
    print(cnt, wa)


if __name__ == '__main__':
    main()


Measured memory_bytes: 49136
def main():
    n = int(input())
   
    S = [i for i in range(1, 14)]
    H = [i for i in range(1, 14)]
    C = [i for i in range(1, 14)]
    D = [i for i in range(1, 14)]

    T = []
    St = []
    Ht = []
    Ct = []
    Dt = []
    for x in range(n):
        T.append(input().split())
        T[x][1] = int(T[x][1])
        if T[x][0] == "S":
            St.append(T[x][1])
        elif T[x][0] == "H":
            Ht.append(T[x][1])
        elif T[x][0] == "C":
            Ct.append(T[x][1])
        elif T[x][0] == "D":
            Dt.append(T[x][1])

    Ans = []
    for x in range(13):
        if x + 1 not in St:
             Ans.append(["S", x + 1])

    for x in range(13):
        if x + 1 not in Ht:
             Ans.append(["H", x + 1])

    for x in range(13):
        if x + 1 not in Ct:
             Ans.append(["C", x + 1])

    for x in range(13):
        if x + 1 not in Dt:
             Ans.append(["D", x + 1])

    for x in range(len(Ans)):
        print(Ans[x][0], Ans[x][1])

if __name__ == "__main__":
    main()

Measured memory_bytes: 7892
//teja349
#include <bits/stdc++.h>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <climits>
#include <utility>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <iomanip>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 
//setbase - cout << setbase (16); cout << 100 << endl; Prints 64
//setfill -   cout << setfill ('x') << setw (5); cout << 77 << endl; prints xxx77
//setprecision - cout << setprecision (14) << f << endl; Prints x.xxxx
//cout.precision(x)  cout<<fixed<<val;  // prints x digits after decimal in val

using namespace std;
using namespace __gnu_pbds;

#define f(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) f(i,0,n)
#define fd(i,a,b) for(i=a;i>=b;i--)
#define pb push_back
#define mp make_pair
#define vi vector< int >
#define vl vector< ll >
#define ss second
#define ff first
#define ll long long
#define pii pair< int,int >
#define pll pair< ll,ll >
#define sz(a) a.size()
#define inf (1000*1000*1000+5)
#define all(a) a.begin(),a.end()
#define tri pair<int,pii>
#define vii vector<pii>
#define vll vector<pll>
#define viii vector<tri>
#define mod (1000*1000*1000+7)
#define pqueue priority_queue< int >
#define pdqueue priority_queue< int,vi ,greater< int > >
#define flush fflush(stdout) 
#define primeDEN 727999983
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

// find_by_order()  // order_of_key
typedef tree<
int,
null_type,
less<int>,
rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;

int main(){
    std::ios::sync_with_stdio(false); cin.tie(NULL);
    int k;
    cin>>k;
    cout<<360/__gcd(360,k)<<endl;
    return 0;   
}


Measured memory_bytes: 3648
import java.util.Scanner;
	class Main {
	public static void main(String[] args){
        
		Scanner s = new Scanner(System.in);
		int i,m,f,r;
        boolean sw=true;
        //試験開始
     		      m=s.nextInt();
      			  f=s.nextInt();
       			  r=s.nextInt();
        
        if(m==-1&&f==-1&&r==-1)
            sw=false;
        
        while(sw){
            if(m==-1 || f==-1)
                System.out.println("F");
            
            else if((m+f)>=80)
                System.out.println("A");
            
            else if((m+f)>=65)
                System.out.println("B");
            
            else if((m+f)>=50 || r>=50)
                System.out.println("C");
            
           else if((m+f)>=30)
                System.out.println("D");
            
           else
                System.out.println("F");
            
                  m=s.nextInt();
      			  f=s.nextInt();
       			  r=s.nextInt();
            
            if(m==-1&&f==-1&&r==-1)
            sw=false;
        }
	}
}


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

long long a, b, k;

int main() {
	cin >> a >> b >> k;
	long long tmp = min(a, k);
	a -= tmp; k -= tmp;
	if (k > 0) b -= k; b = max(b, 0ll);
	cout << a << " " << b;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    int a,b,c,d,e,f,g;
    cin>>a>>b>>c>>d>>e>>f;
    g=a*1+b*5+c*10+d*50+e*100+f*500;
    if(g>=1000){
        cout<<1<<endl;
    }
    if(g<1000){
        cout<<0<<endl;
    }
}



Measured memory_bytes: 3100
def modinv(a,m):
    return pow(a,m-2,m)

n,k = map(int,input().split())
P = 10**9+7

ans = 1
nCl = 1
n1Cl = 1
for l in range(1,min(k+1,n)):
    nCl = nCl*(n+1-l)*modinv(l,P)%P
    n1Cl = n1Cl*(n-l)*modinv(l,P)%P
    ans = (ans+nCl*n1Cl)%P

print(ans)


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

// For given x, return maximum 2^n such that 2^n <= x
// This can be used for calculating the width of a segment(it's size/f(i))
// FIXME: dynamic segtree may use as large segments as int can't represent
// FIXME: what if the compiler is not gcc?
int HighestPow2(int x) {
  if (!x) return 0;
  return 1 << (31-__builtin_clz(x));
}

// T must support a constructor with no argument(works as the identity element)
// T must support `T operator *(T y)` which is associative
template<class T>
struct MonoidSegTree {
  int n;
  int size;
  vector<T> seg;

  MonoidSegTree(const vector<T> A) {
    n = A.size();

    size = 1;
    while (size < n) size *= 2;
    
    seg.resize(size);
    seg.insert(seg.end(), A.begin(), A.end());
    seg.resize(size*2);
    for (int i=size-1; i>0; --i) seg[i] = seg[i*2] * seg[i*2+1];
  }

  void Update(int k, const T v) {
    k += size;
    seg[k] = v;
    while (k > 1) {
      k /= 2;
      seg[k] = seg[k*2] * seg[k*2+1];
    }
  }

  T Get(int l, int r) {
    T retl = T(); // the identity element
    T retr = T();

    l += size;
    r += size;
    for (; l < r; l>>=1, r>>=1) {
      if (r & 1) retr = retr * seg[--r];
      if (l & 1) retl = seg[l++] * retl;
    }
    return retl * retr;
  }

  T At(int k) {
    return seg[k+size];
  }
};

#define INF 0x7fffffff
struct Monoid {
  int v;
  Monoid() {v = 0;}
  Monoid(const Monoid &a) : v(a.v) {}
  Monoid(int a) : v(a) {}
  Monoid operator*(Monoid y) {
    return Monoid(v+y.v);
  }
};

using SegTree = MonoidSegTree<Monoid>;

int n;
int q;

int main() {
  scanf("%d%d", &n, &q);
  SegTree seg = SegTree(vector<Monoid>(n+1));
  while (q--) {
    int cmd;
    int x, y;
    scanf("%d", &cmd);
    scanf("%d%d", &x, &y);
    if (cmd == 0) {
      seg.Update(x, seg.At(x).v+y);
    } else {
      printf("%d\n", seg.Get(x, y+1).v);
    }
  }
}
  

Measured memory_bytes: 4676
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(x) (x).begin(),(x).end()
const int mod=1000000007,MAX=100001,INF=1<<30;

ll rui(ll a,ll b){
    if(b==1) return a%mod;
    else if(b==0) return 1;
    else if(b%2==0) return (rui(a,b/2)*rui(a,b/2))%mod;
    else return (rui(a,b-1)*a)%mod;
}

ll inv[MAX],fac[MAX],finv[MAX];

void make(){
    
    fac[0]=fac[1]=1;
    finv[0]=finv[1]=1;
    inv[1]=1;
    
    for(int i=2;i<MAX;i++){
        inv[i]=mod-inv[mod%i]*(mod/i)%mod;
        fac[i]=fac[i-1]*(ll)i%mod;
        finv[i]=finv[i-1]*inv[i]%mod;
    }
    
}

ll comb(ll a,ll b){
    if(a<b) return 0;
    return fac[a]*(finv[b]*finv[a-b]%mod)%mod;
}

int main(){

    int N,K;cin>>N>>K;
    cout<<rui(K,N)<<endl;
}




Measured memory_bytes: 3088
n, m = map(int, input().split())
A = list(map(int, input().split()))

d = {1:2, 2:5, 3:5, 4:4, 5:5, 6:6, 7:3, 8:7, 9:6}

INF  =10**18
dp = [-INF]*(n+1)
dp[n] = 0
for i in reversed(range(1, n+1)):
    for a in A:
        j = i-d[a]
        if j >= 0:
            dp[j] = max(dp[j], dp[i]*10+a)
print(dp[0])

Measured memory_bytes: 20288
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n);i++)
#define sz(x) int(x.size())
typedef long long ll;
typedef pair<int,int> P;
constexpr int INF = 1e9;

int main(){
  int W, H, n;
  cin >> W >> H >> n;
  vector<int> w(W+1, 0), h(H+1, 0);
  for (int i = 0; i < n; i++) {
    int x, y, a;
    cin >> x >> y >> a;
    if (a == 1) {
      w[0]++;
      w[x]--;
    } else if (a == 2){
      w[x]++;
      w[W]--;
    } else if (a == 3) {
      h[0]++;
      h[y]--;
    } else {
      h[y]++;
      h[H]--;
    }
  }
  for (int i = 0; i < H; i++) h[i + 1] += h[i];
  for (int i = 0; i < W; i++) w[i + 1] += w[i];
  int res = 0;
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) res += (h[i] != 0 | w[j] != 0); 
  }
  cout << H * W - res << endl;
  return 0;
} 

Measured memory_bytes: 256
#include <vector>
#include <math.h>
#include <iostream>
#include <string>
#include <algorithm>
#include <queue>
#include <iomanip>
#include <deque>
#include <map>

typedef long long ll;
#define rep(i, a, n) for(int i = a; i<n; i++)
#define ALL(a) begin(a), end(a)
#define mii map<int, int>
#define msi map<string, int>
#define vi vector<int>
#define vl vector<ll>
#define MOD 1000000007
using namespace std;
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
int main() {
    int A, B, C;
    cin >> A >> B >> C;
    int ans = 0;
    chmax(ans, A * 10 + B + C);
    chmax(ans, B * 10 + A + C);
    chmax(ans, C * 10 + A + B);
    cout << ans << endl;
    return 0;
}

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

int main(){
    int c[3];
    map<int, int> mp;

    for(int i=0;i<3;i++){
        cin >> c[i];
        mp[c[i]]++;
    }

    cout <<  mp.size() << endl;
    return 0;
}

Measured memory_bytes: 256
N, M = map(int,input().split())                                         # N:ノード数、M:エッジ数
visited = [False for i in range(N)]                                     # ノードの訪問済みフラグ
edges = [[i-1 for i in map(int,input().split())] for j in range(M)]     # エッジ情報のインプット
graph = [[False for i in range(N)] for j in range(N)]                   # 接続行列の入れ物

# 各エッジについて、情報を接続行列に埋め込む
for edge in edges:
    graph[edge[0]][edge[1]] = True
    graph[edge[1]][edge[0]] = True

# dfs:ノードvについて、エッジで接続した未訪問のノードを深いほうから訪問(LIFO)
def dfs(v):
    queue = [v]
    while len(queue) != 0:
        now = queue.pop()
        visited[now] = True
        for next in range(N):
            if graph[now][next] == False:continue
            if visited[next] == True:continue
            queue.append(next)

ans = 0

# 各エッジを取り除いたとき、dfsして未訪問のノードが残っていれば、そのエッジは橋
for i in range(M):
    graph[edges[i][0]][edges[i][1]] = False
    graph[edges[i][1]][edges[i][0]] = False

    for j in range(N):
        visited[j] = False

    dfs(0)

    bridge = False
    for j in range(N):
        if visited[j] == False:
            bridge = True
    if bridge:
        ans += 1

    graph[edges[i][0]][edges[i][1]] = True
    graph[edges[i][1]][edges[i][0]] = True

print(ans)


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define int long long
// #define min(a,b) a<b ? a:b
// #define max(a, b) a < b ? b : a
#define IOS                           \
    ios_base::sync_with_stdio(false); \
    cin.tie(0);                       \
    cout.tie(0)
#define endl "\n"
#define pb push_back
#define pi 3.14159265358979323846

// int explore(vector<vector<int>> &adj,int x,int y,vector<int> &visited)
// {
//     if(x==y)
//     return 1;
//     visited[x]=1;
//     for(int i=0;i<adj[x].size();i++)
//     {
//         if(!visited[adj[x][i]])
//         {
//             if(explore(adj,adj[x][i],y,visited))
//             return 1;
//         }
//     }
//     return 0;
// }
bool valley(int p[], int k)
{
    if (p[k] < p[k - 1] && p[k] < p[k + 1])
        return true;
    return false;
}
bool peak(int p[], int k)
{
    if (p[k] > p[k - 1] && p[k] > p[k + 1])
        return true;
    return false;
}

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

int prime(int b)
{
    for (int i = 2; i < b; i++)
    {
        if (b % i == 0)
            return 0;
    }
    return 1;
}
int32_t main()
{
    IOS;
    // int t;
    // cin>>t;
    // while(t--)
    // {
    int d,t,s;
    cin>>d>>t>>s;
    if(s*t>=d)
    cout<<"Yes";
    else
    cout<<"No";
    // }
}

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

struct point{
  ll x,y;  
  point operator - (const point &p)const{
    return (point){x-p.x,y-p.y};
  }
  bool operator < (const point &p)const{
    return (y==p.y?x<p.x:y<p.y);
  }
};

ll cross(point a,point b){
  return a.x*b.y-b.x*a.y;
}

ll n;
point t[40];
ll dp[40][40][40][41];
ll pre[40][40][40][41];

int main(){
  cin>>n;
  for(int i=0;i<n;i++)cin>>t[i].x>>t[i].y;
  fill((ll*)dp[0],(ll*)dp[40], 1e9);
  
  for(int i=0;i<n;i++){
    for(int j=0;j<n;j++){
      if(i==j)continue;
      if(t[j].y<t[i].y)continue;
      dp[i][i][j][2]=0;
    }
  }
  
  for(int si=0;si<n;si++){
    for(int k=2;k+1<=n;k++){
      for(int i=0;i<n;i++){
        if(t[i].y<t[si].y)continue;
        for(int j=0;j<n;j++){
          if(t[j].y<t[si].y)continue;                    
          if(dp[si][i][j][k]==1e9)continue;
            
          for(int to=0;to<n;to++){
            if(t[to].y<t[si].y)continue;
            if(cross(t[j]-t[i],t[to]-t[j])<=0)continue;            
            ll cost = dp[si][i][j][k];
            ll addcost = cross(t[j]-t[si],t[to]-t[si]);            
            if(addcost<=0)continue;
            cost+=addcost;
            if(cost < dp[si][j][to][k+1] ){
              dp[si][j][to][k+1]=cost;              
              pre[si][j][to][k+1]=i;
            }
          }
        }
      }
    }
  }

  int q,a;
  cin>>q;
  while(q--){
    cin>>a;
    int I,J,K;
    ll mini=1e9;
    point g;
    for(int i=0;i<n;i++){
      for(int j=0;j<n;j++){
        for(int k=0;k<n;k++){
          if(dp[i][j][k][a]>mini)continue;
          if(dp[i][j][k][a]==mini&&g<t[i])continue;
          g=t[i];
          mini=dp[i][j][k][a];
          I=i,J=j,K=k;
        }
      }
    }
    if(mini==1e9){
      cout<<"NA"<<endl;
      continue;
    }
    vector<int> ans;
    for(int i=0;i<a-1;i++){
      ans.push_back(K);
      I=I;
      int tmp=pre[I][J][K][a-i];
      K=J;
      J=tmp;
    }
    ans.push_back(I);
    reverse(ans.begin(),ans.end());
    for(int i=0;i<(int)ans.size();i++){
      if(i)cout<<' ';
      cout<<ans[i]+1;
    }
    cout<<endl;
  }
  return 0;
}

Measured memory_bytes: 41484
#include<bits/stdc++.h>
#define int long long
using namespace std;
signed main() {
  int H, W;
  cin >> H >> W;
  vector<string> S(H);
  for (auto& s : S) cin >> s;

  const int dy[4] = {0, 1, 0, -1};
  const int dx[4] = {1, 0, -1, 0};
  const int inf = 1e18;
  auto bfs = [&](int sy, int sx){
    vector<vector<int>> G(H, vector<int> (W, -1));
    queue<pair<int, int>> q;
    q.push({sy, sx});
    G[sy][sx] = 0;
    while (q.size()) {
      auto p = q.front();
      q.pop();
      int y = p.first;
      int x = p.second;
      for (int i = 0; i < 4; i++) {
        int ny = y + dy[i];
        int nx = x + dx[i];
        if (ny < 0 || ny >= H) continue;
        if (nx < 0 || nx >= W) continue;
        if (S[ny][nx] == '#') continue;
        if (G[ny][nx] != -1) continue;
        q.push({ny, nx});
        G[ny][nx] = G[y][x] + 1;
      }
    }
    int ma = 0;
    for (auto v : G) for (auto x : v) ma = max(ma, x);
    return ma;
  };

  int ans = 0;
  for (int sy = 0; sy < H; sy++) {
    for (int sx = 0; sx < W; sx++) {
      if (S[sy][sx] == '#') continue;
      int t = bfs(sy, sx);
      ans = max(ans, t);
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<double> VD;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<VD> VVD;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
using Graph=vector<vector<int>>;


template<class t,class u> void chmax(t&a,u b){if(a<b)a=b;}
template<class t,class u> void chmin(t&a,u b){if(b<a)a=b;}

int main()
{
  int N,K;
  cin>>N>>K;
  int Y,X;
  cin>>X>>Y;
  if(N>K)
  {
    cout<<X*K+Y*(N-K);
  }
  else
  {
    cout<<X*N;
  }
}


Measured memory_bytes: 256