akhauriyash/Code-Regression huggingface dataset:
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef map<int, int> mii;
typedef map<char,int> mci;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<pair<int,int>> vii;
typedef vector<char> vc;
typedef vector<vc> vcc;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pb push_back
#define F first
#define S second
#define in insert
#define mina(a,b) (a)=min((a),(b));
#define maxa(a,b) (a)=max((a),(b));
const int INF = 1e9 + 7;
void solve(){
    int a,b,c; cin>>a>>b>>c;
    int cnt=0;
    for(int i = min(a,b); i > 0; i--){
        if(a%i==0 && b%i==0){
            cnt++;
            if(cnt==c){
                cout<<i;
                return;
            }
        }
    }
}
int main(){
    int T=1;
    //cin>>T;
    for(int i = 0; i < T; i++) solve(); 
}

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

int main() {
  int N;
  cin >> N;
  int sum = 0;
  
  for (int i = 0; i < N; i++) {
    int l, r;
    cin >> l >> r;
    
    sum += (r - l + 1);
  }
  cout << sum << endl;
}


Measured memory_bytes: 256
n = int(input())
dp=[]
next = list(map(int,input().split()))
dp.append(next)
for i in range(n-1):
    cur=[0,0,0]
    next =list(map(int,input().split()))
    cur[0]=max(next[0]+dp[i][1],next[0]+dp[i][2])
    cur[1] = max(next[1] + dp[i][0], next[1] + dp[i][2])
    cur[2] = max(next[2] + dp[i][0], next[2] + dp[i][1])
    dp.append(cur)
print(max(dp[-1]))



Measured memory_bytes: 63704
from math import sqrt

_, d = map(int, input().split())
count = 0
while 1:
    try:
        x, y = map(int, input().split())
        res = sqrt(pow(x, 2) + pow(y, 2))
        if res <= d:
            count += 1
    except EOFError:
        break

print(count)

Measured memory_bytes: 9188
#include <bits/stdc++.h>
#define FRU                                  freopen("out.txt","w",stdout);
#define FRO                                  freopen("in.txt","r",stdin);
#define pb                                   push_back
#define pf                                   push_front
#define ppb                                  pop_back()
#define ppf                                  pop_front()
#define mp                                   make_pair
#define ff                                   first
#define ss                                   second
#define flash                                ios_base::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL);
#define mem(ara,n)                           memset(ara,n,sizeof ara)
#define fr(i,j,n)                            for(i=j;i<n;i++)
#define rf(i,j,n)                            for(i=n;i>=j;i--)
#define inf                                  2147483647
#define ll                                   long long
#define ull                                  unsigned long long
#define pii                                  pair<int,int>
#define vi                                   vector<int>
#define vll                                  vector <long long>
#define vch                                  vector <char>
#define itr                                  ::iterator
#define msi                                  map<string,int>
#define psi                                  pair <string,int>
#define vii                                  vector <pair<int,int> >
#define all(n)                               n.begin(),n.end()
#define INF                                  10000000000000000LL
#define pi                                   3.1415926535897932384626434
#define sii                                  set <int>
#define max3(a,b,c)                          max(a,max(b,c))
#define min3(a,b,c)                          min(a,min(b,c))
#define mid3(a,b,c)                          min(max(a,b),max(b,c),max(a,b))
#define max4(a,b,c,d)                        max(max(a,b),max(c,d))
#define min4(a,b,c,d)                        min(min(a,b),min(c,d))
#define endl                                 "\n"
#define endll                                cout<<"\n";
#define spc                                  " "

using namespace std;



int main()
{
    flash
    string s,st;
    ll n,t,T,i,j,J,I,k,m;
    char ch;
    cin>>n>>k;
    m=n/k;
    j=m*m*m;
    if(k%2==0)
    {
        i=k/2;
        i=n/i;
        i-=m;
        i=i*i*i;
        j+=i;
    }
    cout<<j;
    return 0;
}




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

using namespace std;
int main(){
    int n,q;
    cin >> n >> q;
    string s;
    cin >> s;
    vector<int> vec(s.size(),0);
    bool hantei=0;
    if(s[0]=='A'){
        hantei=1;
    }
    for(int i=1;i<s.size();i++){
        if(hantei){
            if(s[i]=='C'){
                vec[i]=vec[i-1]+1;
                hantei=0;
            }else if(s[i]=='A'){
                vec[i]=vec[i-1];
                hantei=1;
            }else{
                vec[i]=vec[i-1];
                hantei=0;
            }
        }else{
            if(s[i]=='A'){
                hantei=1;
                vec[i]=vec[i-1];

            }else{
                hantei=0;
                vec[i]=vec[i-1];
            }
        }
    }
   /* cout <<vec[0]<<endl;
    cout <<vec[1]<<endl;
    cout <<vec[2]<<endl;
    cout <<vec[3]<<endl;a
    */
    for(int i=0;i<q;i++){
        int x,y;
        cin >> x >> y;
        cout << vec[y-1]-vec[x-1] <<endl;
    }
}


Measured memory_bytes: 1408
//caddi2018_c.cpp
//Sat Dec 22 20:47:31 2018

#include <iostream>
#include <string>
#include <queue>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <math.h>
#define INTINF 2147483647
#define LLINF 9223372036854775807
using namespace std;
using ll=long long;
typedef pair<int,int> P;

int main(){
	ll n,p;
	cin >> n >> p;

	unordered_map<ll,ll> map;
	ll a = 2;
	ll temp = p;
	if (n==1){
		cout << p << endl;
		return 0;
	}
	while (temp >= a*a){ //iの素因数分解ここから
		if (temp%a == 0){
			map[a]++;
			temp = temp/a;
		}else {
			a++;
		}
	}
	map[temp]++;

	ll ans = 1;
	for(auto itr = map.begin();itr!=map.end();++itr){
//		cout << itr->first << " " << itr->second << endl;
		ll temp = (itr->second)/n;
		ll tempans = pow(itr->first,temp);
		ans = ans * tempans;
	}
	cout << ans << endl;
}

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

using namespace std;

#define el				'\n'
#define sz(v)			((int)((v).size()))
#define all(v)          ((v).begin()),((v).end())
#define clr(v, d)		memset(v, d, sizeof(v))

double const EPS = 1e-8, PI = acos(-1);
const int N = 2e5 + 9, M = 100 + 9, OO = (int) 1e9 + 1;
const long long MOD = 1e9 + 7;

typedef long long ll;

void OUTPUT() {
	cout << fixed << setprecision(0);
	ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
}

void READ() {
	freopen("input.txt", "r", stdin);
	//	freopen("output.txt", "w", stdout);
}

int n, values[M];
ll W, dp[N], weights[M];

int main() {
//	READ();
	OUTPUT();
	cin >> n >> W;
	for (int o = 0; o < n; ++o) {
		cin >> weights[o] >> values[o];
	}
	memset(dp, '?', sizeof dp);
	int ans = 0;
	for (int i = 0; i < n; i++) {
		dp[0] = 0;
		if (dp[values[i]] <= W)
			ans = max(ans, values[i]);
		for (int j = N; j >= 0; --j) {
			if (j + values[i] >= N)
				continue;
			dp[j + values[i]] = min(dp[j + values[i]], dp[j] + weights[i]);
			if (dp[j + values[i]] <= W)
				ans = max(ans, j + values[i]);
		}
	}
	cout << ans;

	return 0;

}


Measured memory_bytes: 1792
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <climits>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <queue>
#include <random>
#include <complex>
#include <regex>

using namespace std;

#define SHOW_VECTOR(v) {std::cerr << #v << "\t:";for(const auto& xxx : v){std::cerr << xxx << " ";}std::cerr << "\n";}
#define SHOW_MAP(v){std::cerr << #v << endl; for(const auto& xxx: v){std::cerr << xxx.first << " " << xxx.second << "\n";}}

vector<long long> parse(long long N) {
    vector<long long> ret;
    for (int i = 1; i * i <= N; i++) {
        if (N % i == 0) {
            ret.push_back(i);
            if (i != N / i) ret.push_back(N / i);
        }
    }
    sort(ret.begin(), ret.end());
    return ret;
}

int main() {

    long long N, M;
    cin >> N >> M;

    long long ans = 1;
    auto res = parse(M);

    for (auto x :res) {
        if (x * N <= M) {
            ans = x;
        }
    }

    cout << ans << endl;

    return 0;
}











































































Measured memory_bytes: 256
package main

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

func main() {
	solve(os.Stdin, os.Stdout)
}

func solve(in io.Reader, out io.Writer) {
	var bs = NewBufScanner(in)
	var bw = NewBufWriter(out)
	defer bw.w.Flush()

	n, m := bs.IntScan(), bs.IntScan()
	
	uf := InitUnionFindTree(n)

	for i := 0; i < m; i++ {
		l, r, d := bs.IntScan(), bs.IntScan(), bs.IntScan()
		l--
		r--
		if uf.Same(l, r) {
			diff := uf.Diff(l, r)
			if diff != d {
				bw.Printf("No\n")
				return
			}
		} else {
			uf.Unite(l, r, d)
		}
	}
	bw.Printf("Yes\n")
}

type UnionFindTree struct {
	parent []int
	rank   []int
	weight []int
}

// InitUnionFindTree 初期化
func InitUnionFindTree(n int) *UnionFindTree {
	p := make([]int, n)
	r := make([]int, n)
	w := make([]int, n)
	for i := 0; i < n; i++ {
		p[i] = i
	}

	return &UnionFindTree{
		parent: p,
		rank:   r,
		weight: w,
	}
}

// Root Union-Find木からルートの値を取得
func (u *UnionFindTree) Root(x int) int {
	if u.parent[x] == x {
		return x
	}
	// 経路圧縮
	r := u.Root(u.parent[x])
	// 累積和
	u.weight[x] += u.weight[u.parent[x]]
	u.parent[x] = r
	return u.parent[x]
}

// Weight 重みを返す
func (u *UnionFindTree) Weight(x int) int {
	// 経路圧縮により重みを累積和で計算
	u.Root(x)
	return u.weight[x]
}

// Same ２値のルートが同じかチェック
func (u *UnionFindTree) Same(x, y int) bool {
	return u.Root(x) == u.Root(y)
}

// Unite xとyの属する集合を結合
func (u *UnionFindTree) Unite(x, y, w int) {
	w += u.Weight(x)
	w -= u.Weight(y)
	xR, yR := u.Root(x), u.Root(y)
	
	if xR == yR {
		return
	}

	if u.rank[xR] < u.rank[yR] {
		xR, yR = yR, xR
		w = -1 * w
	}
		
	if u.rank[xR] == u.rank[yR] {
		u.rank[xR]++
	}

	u.parent[yR] = xR
	u.weight[yR] = w
}

// Diff 重みの差分を取得
func (u *UnionFindTree) Diff(x, y int) int {
	return u.Weight(y) - u.Weight(x)
}

// BufScanner original scanner
type BufScanner struct {
	s *bufio.Scanner
}

// NewBufScanner constructer
func NewBufScanner(in io.Reader) *BufScanner {
	s := bufio.NewScanner(in)
	s.Buffer(make([]byte, 1024), 1e+9)
	s.Split(bufio.ScanWords)
	return &BufScanner{
		s: s,
	}
}

// Scan Scan Data
func (b *BufScanner) Scan() string {
	b.s.Scan()
	return b.s.Text()
}

// IntScan Scan Data
func (b *BufScanner) IntScan() int {
	v, err := strconv.Atoi(b.Scan())
	if err != nil {
		panic(err)
	}
	return v
}

// BufWriter original writer
type BufWriter struct {
	w *bufio.Writer
}

// NewBufWriter constructer
func NewBufWriter(out io.Writer) *BufWriter {
	w := bufio.NewWriter(out)
	return &BufWriter{
		w: w,
	}
}

// Printf Output file
func (b *BufWriter) Printf(format string, a ...interface{}) {
	fmt.Fprintf(b.w, format, a...)
}

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

int main() {
  
  int a, b, c, k;
  cin >> a >> b >> c >> k;
  
  int count;
  
  while(a >= b) {
    count++;
    b = 2*b;
  }
  
  while(b >= c) {
    count++;
    c = 2*c;
  }
  
  if (count <= k) cout << "Yes";
  else cout << "No";
  
}


Measured memory_bytes: 3644
import java.util.Scanner;

public class Main {
	public static void main(String args[]){
		try(Scanner sc=new Scanner(System.in)){
			int casenum=0;
			while(sc.hasNext()) {
				int a=sc.nextInt();
				int b=sc.nextInt();
				if(a==0) break;
				int n=sc.nextInt();
				int[][] dp=new int[a+1][b+1];
				boolean[][] ob=new boolean[a+1][b+1];
				for(int i=0; i<n; i++) {
					int w=sc.nextInt();
					int h=sc.nextInt();
					dp[w][h]=0;
					ob[w][h]=true;
				}
				for(int i=1; i<=a; i++) {
					dp[i][0]=0;
				}
				for(int i=1; i<=b; i++) {
					dp[0][i]=0;
				}
				dp[1][1]=1;
				ob[1][1]=true;
				
				for(int i=1; i<=a; i++) {
					for(int j=1; j<=b; j++) {
						if(ob[i][j]) continue;
						dp[i][j]=dp[i][j-1]+dp[i-1][j];
						//System.out.println("dp["+i+"]["+j+"]="+dp[i][j]);
					}
				}
				System.out.println(dp[a][b]);
			}
		}
	}
} 


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

int main() {
    string s;
    while (getline(cin, s) , s != ".") {
        stack<char> v;
        bool flag = true;
        for (int i = 0; i < s.size() && flag; i++) {
            if (s[i] == '(' || s[i] == '[') v.push(s[i]);
            else if (s[i] == ')' && v.size() && v.top() == '(') v.pop();
            else if (s[i] == ']' && v.size() &&  v.top() == '[') v.pop();
            else if (s[i] == ')' || s[i] == ']') flag = false;
        }

        if (flag && v.size() == 0) cout << "yes" << endl;
        else cout << "no" << endl;
    }
}



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

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

  vector<ll> A(n);
  rep(i, n) cin >> A[i];

  int l = 0, r = n-1;
  ll sumL = 0LL, sumR = 0LL;

  rep(i, n) {
    if (sumL <= sumR) {
      sumL += A[l];
      l++;
    } else {
      sumR += A[r];
      r--;
    }
  }

  cout << abs(sumL-sumR) << endl;


  return 0;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
int main ()
{ 
	string s,t;
	int a[26]={0};
	int b[26]={0};
	cin>>s>>t;
	for(int i=0;i<s.size();i++)
		a[s[i]-'a']++;
	for(int i=0;i<t.size();i++)
		b[t[i]-'a']++;
	sort(a,a+26);
	sort(b,b+26);
	for(int i=0;i<26;i++)
		if(a[i]!=b[i])
		{
			cout<<"No";
			return 0;
			}	
	cout<<"Yes";
	return 0;
} 

Measured memory_bytes: 776
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
template<class T> using vc = vector<T>;
template<class T> using vvc = vector<vector<T>>;

#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define repr(i, n) for (ll i = (n)-1; i >= 0; i--)
#define repe(i, l, r) for (ll i = (l); i < (r); i++)
#define reper(i, l, r) for (ll i = (r)-1; i >= (l); i--)
#define repa(i,n) for (auto& i: n)

template<class T> inline bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> inline bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
void init() {cin.tie(0);ios::sync_with_stdio(false);cout << fixed << setprecision(15);}

#ifdef DEBUG
template <class T, class N> void verr(const T& a, const N& n) { rep(i, n) cerr << a[i] << " "; cerr << "\n" << flush; }
ll dbgt = 1; void err() { cerr << "passed " << dbgt++ << "\n" << flush; }
template<class H, class... T> void err(H&& h,T&&... t){ cerr<< h << (sizeof...(t)?" ":"\n") << flush; if(sizeof...(t)>0) err(forward<T>(t)...); }
#endif

const ll INF = 5e18;
const ld EPS = 1e-11;
const ld PI = acos(-1.0L);
const ll MOD = 1e9 + 7;
// const ll MOD = 998244353;
//--------------------------------------------------------------------------------//
ll H[100000];
int main() {
    init();
    ll N,M;
    cin>>N>>M;
    vvc<ll> G(N);
    rep(i, N) cin >> H[i];
    
    rep(i,M){
        ll a, b;
        cin >> a >> b;
        a--, b--;
        G[a].eb(b), G[b].eb(a);
    }

    ll ans = 0;
    rep(i,N){
        bool isok = true;
        repa(to,G[i]){
            if (H[to] >= H[i]) isok = false;
        }
        if (isok) ans++;
    }

    cout << ans << endl;
}

Measured memory_bytes: 9804
import scala.io.StdIn

/**
  * AOJ
  */
object Main {

  def main(args: Array[String]): Unit = {

    var str = StdIn.readLine()
    val q =  StdIn.readInt()

    for(_ <- 1 to q){

      val line = StdIn.readLine().split(" ")
      val a = line(1).toInt
      val b = line(2).toInt

      line(0) match {
        case "replace" => {
          str = str.patch(a,line(3),b - a + 1)
        }
        case "reverse" => {
          str = str.patch(a,str.slice(a,b + 1).reverse,b - a + 1)
        }
        case "print"   => println(str.slice(a,b + 1))
      }
    }
  }
}

Measured memory_bytes: 45712
PROGRAM-ID.                      ABC_050_B.
DATA                             DIVISION.
WORKING-STORAGE                  SECTION.
    01 INP     PIC X(700).
    01 maxlen  PIC 9(3) VALUE 600.
    01 cur     PIC 9(3) VALUE 1.
    01 i       PIC 9(18) VALUE 1.
    01 j       PIC 9(18).
    01 len     PIC 9(3).
    01 ans     PIC X(8).
    01 T1.
        03 T11 OCCURS 600 DEPENDING ON maxlen.
            05 T PIC 9(6).

    01 INP2    PIC X(10).
    01 M       PIC 9(3).
    01 P       PIC 9(3).
    01 X       PIC 9(6).

    01 sm      PIC 9(8).
    01 tmp     PIC 9(8).

    01 ZS      PIC Z(8)9.
    01 DUMMY   PIC X(1).

PROCEDURE                        DIVISION.
    ACCEPT maxlen.
    ACCEPT INP.

    MOVE ZERO TO sm.

    PERFORM maxlen TIMES

        PERFORM VARYING j FROM cur BY 1
            UNTIL INP(j:1) = SPACE
        END-PERFORM

        COMPUTE len = j - cur

        MOVE INP(cur:len) TO T(i)

        ADD T(i) TO sm

        COMPUTE cur = j + 1

        ADD 1 TO i

    END-PERFORM.

    ACCEPT M.

    PERFORM VARYING i FROM 1 BY 1 UNTIL M < i
        ACCEPT INP2

        UNSTRING INP2
        DELIMITED BY SPACE
        INTO P X

        SUBTRACT T(P) FROM sm GIVING tmp

        ADD X TO tmp

        MOVE tmp TO ZS
        PERFORM UNANS

        DISPLAY ans(1:FUNCTION STORED-CHAR-LENGTH(ans))

    END-PERFORM.

    STOP RUN.

UNANS                            SECTION.
    UNSTRING
        ZS DELIMITED BY ALL SPACE
        INTO DUMMY ans
    END-UNSTRING.


Measured memory_bytes: 384
H, W = map(int, input().split())
A = []
b = ['.' for i in range(W)]
for i in range(H):
  a = list(input())
  if a != b:
    A.append(a)
m = len(A)
import numpy as np
A = np.array(A).T.tolist()
d = ['.' for i in range(m)]
C = []
for i in range(W):
  c = A[i]
  if c != d:
    C.append(c)
    
C = np.array(C).T.tolist()
n = len(C)
for i in range(n):
  ans="".join(C[i])
  print(ans)

Measured memory_bytes: 12504
using System;
class Hjo {
  static void Main(){
    var aho = Console.ReadLine().Split();
    var a = int.Parse(aho[0]);
    var b = int.Parse(aho[1]);
    var c = int.Parse(aho[2]);
    var kotae = b/a;
    if(kotae < c ){
      Console.WriteLine(kotae);
    }
    else{
       Console.WriteLine(c);
    }
  }
}

Measured memory_bytes: 11092
def main():
    s = str(input()).split(' ');
    cnt = []
    for n1 in s:
        cnt.append(0)
        for n2 in s:
            if n1 == n2:
                cnt[-1] += 1
#    print(cnt)
    for i in cnt[:-1]:
        if i == 2:
            print('Yes')
            break
    else:
        print('No')


main()


Measured memory_bytes: 38384
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 1; i < (int)(n); i++)
using namespace std;

int main() {
    int N;
    cin >> N;
    vector<int> ans;
    int tmp = 0;
    for(int i=ceil(sqrt(2*N)-0.5); i >= 1; i--) {
        if (tmp + i <= N) {
            tmp += i;
            ans.push_back(i);
        }
        if (tmp == N) break;
    }
    reverse(ans.begin(), ans.end());
    for(int x:ans) {
        cout << x << endl;
    }
}


Measured memory_bytes: 384
import copy
h,w,k = map(int, input().split())
t = []
for l in range(h):
  t.append(list(input()))

counts = []

for hp in range(2 ** h):
  for wp in range(2 ** w):
    tt = copy.deepcopy(t)
    for hs in range(h + 1):
      for ws in range(w + 1):
        if hs > 0:
          hb = 1 << (hs - 1)
          if hp & hb > 0:
            for wi in range(w):
              tt[hs - 1][wi] = '.'
        if ws > 0:
          wb = 1 << (ws - 1)
          if wp & wb > 0:
            for hi in range(h):
              tt[hi][ws - 1] = '.'
    total = 0
    for hh in range(h):
      for ww in range(w):
        if tt[hh][ww] == '#':
          total += 1
    counts.append(total)
print(counts.count(k))

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

#define ll long long

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n;
    string s;
    cin >> n >> s;
    int ans = 0;
    for (int i = 1; i < n - 1; i++) {
        string a = s.substr(0, i);
        string b = s.substr(i, n - i);
        vector<int> cnt(26, 0);
        for (char c: a) {
            cnt[c - 'a']++;
        }
        int cur = 0;
        for (char c: b) {
            if (cnt[c - 'a']) cur++;
            cnt[c - 'a'] = 0;
        }
        ans = max(ans, cur);
    }
    cout << ans << '\n';
    return 0;
}

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

#define int long long

signed main(){
    std::ios::sync_with_stdio(false);
    std::cin.tie(0);
 
    int n, m, l;
    std::cin >> n >> m >> l;
    std::vector<std::vector<int>> a(n, std::vector<int>(m));
    for(auto& r : a){
        for(auto& i : r){
            std::cin >> i;
        }
    }
    std::vector<std::vector<int>> b(m, std::vector<int>(l));
    for(auto& r : b){
        for(auto& i : r){
            std::cin >> i;
        }
    }
    for(int i=0; i<n; ++i){
        for(int j=0; j<l; ++j){
            int c = 0;
            for(int k=0; k<m; ++k){
                c += a[i][k]*b[k][j];
            }
            std::cout << c << ((j!=l-1)?" ":"\n");
        }
    }
    return 0;
}

Measured memory_bytes: 3232
import math
x = int(input())
if x == 2:
    print(2)
    exit()
def is_prime(n):
    if n == 1: return False

    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False

    return True

if x %2 == 0:
    target = (x+1)
else:
    target = x
for i in range(target, 1000000):
    if is_prime(i) is True:
        print(i)
        exit()
    else:
        continue

Measured memory_bytes: 3060
//This code was made by Chinese_zjc_.
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<string>
#define int long long
#define INF 0x3fffffffffffffff
using namespace std;
int a,b,c;
signed main()
{
	std::ios::sync_with_stdio(false);
	cin>>a>>b>>c;
	if(a<=c)
	{
		cout<<0<<' '<<max(b+a-c,a-a);
	}
	else
	{
		cout<<a-c<<' '<<b;
	}
	return 0;
}


Measured memory_bytes: 256
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <bits/stdc++.h>
#define ll long long
#define pi 3.1415926535897
using namespace std;
void put(int x){
	if(x<0) {
		putchar('-');
		x*=-1;
	}
	if(x==0) {
		putchar('0');
	}
	int num=0;
	char c[15];
	while(x) {
		c[++num]=(x%10)+48;
		x/=10;
	}
	while(num) {
		putchar(c[num--]);
	}
	putchar('\n');
}
inline void in(int &x){
	char ch=getchar();
	int flag=1;
	while(!(ch>='0'&&ch<='9')) {
		if(ch=='-')
			flag*=-1;
		ch=getchar();
	}
	x=ch-'0';
	ch=getchar();
	while(ch>='0'&&ch<='9') {
		x=((x<<3)+(x<<1))+ch-'0';
		ch=getchar();
	}
	x*=flag;
}
int n,m,a[105],sum,k;
bool cmp(int a,int b){
	return a>b;
}
int main(){
//	freopen("1.in","r",stdin);
//	freopen("1.out","w",stdout);
	in(n);in(m);
	for(int i=1;i<=n;i++){
		in(a[i]);sum+=a[i];
	}
	sort(a+1,a+n+1,cmp);
	sum=(sum-1)/(4*m)+1;
	for(int i=1;i<=n;i++){
		if(a[i]>=sum)k++;
		else break;
	} 
	if(k>=m)printf("Yes\n");
	else printf("No\n");
	return 0;
}

Measured memory_bytes: 3636
#include <iostream>
#include <cstdlib>

using namespace std;

#define MAXN 500

int ans[MAXN * MAXN + 1], u[MAXN * MAXN + 1], v[MAXN + 1];

inline void gata() {
    cout << "No\n";
    exit(0);
}

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

    for (int i = 1; i <= n; i++) {
        cin >> v[i];
        u[v[i]] = i;
    }

    int st = 1;
    for (int i = 1; i <= n * n; i++) if (u[i]) {
        int cnt = u[i] - 1;
        while (st < i && cnt > 0) {
            if (ans[st] == 0) ans[st] = u[i], cnt--;
            st++;
        }

        if (cnt > 0)
            gata();

        ans[i] = u[i];
    }

    int dr = n * n;
    for (int i = n * n; i > 0; i--) if (u[i]) {
        int cnt = n - u[i];
        while (dr > i && cnt > 0) {
            if (ans[dr] == 0) ans[dr] = u[i], cnt--;
            dr--;
        }

        if (cnt > 0)
            gata();
    }

    cout << "Yes\n";
    for (int i = 1; i <= n * n; i++)
        cout << ans[i] << ' ';

    return 0;
}


Measured memory_bytes: 2816
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long
 
#define FI(z,n) for(int j=z; j<=n; j++)
#define FL(z,n) for(l j=z; j<=n; j++)
 
#define inf 10000000000
#define mod 1000000007
 
void In_Out(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
 
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
        freopen("error.txt", "w", stderr);
    #endif
}
 
 
int main(){
 
    // In_Out();
 
    ll n, k;
    cin >> n >> k;

    ll h[n];
    ll dp[n];

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

    dp[0] = 0;

    for(ll i=1; i<n; i++){

        dp[i] = INT_MAX;

        for(ll j=i-1; i-j<=k && j>=0; j--){
            dp[i] = min(dp[i], dp[j] + abs(h[i]-h[j]));
        }
    }

    cout << dp[n-1];
}

Measured memory_bytes: 5152
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <cmath>
#include <set>
#include <map>
#include <string>
#include <numeric>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iterator>
#include <cstring>

using namespace std;
const int INF = (1<<30);
typedef pair<int, int> P;
typedef long long ll;
#define PB push_back
#define rep(i, a) for (int i = 0; i < a; i++)
#define all(v) v.begin(),v.end()
#define FF first
#define SS second
#define mp make_pair

int sx, sy;
const int MAXN = 100000;
bool used[MAXN];
int gx, gy;

//出力チェック用
int qqq;

//各座標までの最短距離
int d[100][100];


//移動方向のベクトル
int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };

//汎用
ll ans = 0;
pair<int, int> red[101], blue[101];
ll BIG = 10000000000;


//累乗
ll POW(ll a, ll b) {
	if (b == 0) return 1;
	if (b % 2) return a * POW(a, b - 1)%BIG;
	ll d = POW(a, b / 2);
	return (d*d) % BIG;
}


//階乗
int Kaijou(int a) {
if (a < 2) return 1;
return a * Kaijou(a - 1);
}


int A[200000];
int kinds[200001];


int main() 
{
	int a, b, c, x, y;
	cin >> a >> b >> c >> x >> y;
	int s = a * x + b * y;
	
	int t = 1;
	int po = 1;
	int f = 0;
	while (1) {
		f = 0;
		if (s > 2*c*t + a * max(0,(x - po)) + b * max(0,(y - po))) {
			s = 2*c * t + max(0,a * (x - po)) +max(0, b * (y - po));
			t++; po++;
			f = 1;
		}
		if (!f) break;
	}
	cout << s << endl;
	cin >> qqq;
}


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

using namespace std;

int main() {
	int x = 0, ans = INT_MAX;
	const int z = 753;
	string s;
	cin >> s;
	for (int i = 0; i < s.size() - 2; i++) {
		x = (s[i] - '0') * 100 + (s[i + 1] - '0') * 10 + (s[i + 2] - '0');
		ans = min(ans, abs(z - x));
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
#define LONGMAX 1e18
#define MOD 1000000007
#define mp make_pair
#define endl "\n"
#define test() ull t;cin>>t;while(t--)
#define pb push_back
#define printclock cerr<<"Time : "<<1000*(long double)clock()/(long double)CLOCKS_PER_SEC<<"ms\n";
#define fastio()  ios_base::sync_with_stdio(false);cin.tie(NULL);

int main()
{
	#ifndef ONLINE_JUDGE
    	freopen("input.txt","r",stdin);
    	freopen("output.txt","w",stdout);
	#endif
	fastio()
	
	int n;
	cin>>n;
	vector<int> arr(n,-1);
	for(int i = 0 ; i < n ; i++)
		cin>>arr[i];

	//creating 2D DP table where dp[i][j] denotes the scores of 
	// taro and jiro with arr i to j

	vector<vector<pair<ll,ll>>> dp(n,vector<pair<ll,ll>>(n,{0,0}));
	//first element of pair is taros score and second is jiros.

	//base case is arrays with one element
	for(int i = 0 ; i < n ; i++)
		dp[i][i].first = arr[i];

	for(int size = 1 ; size < n ; size++){
		for( int i = 0 ; i + size < n ; i++){
			int j = i + size;
			ll pickright = arr[j] + dp[i][j-1].second; 
			ll pickleft = arr[i] + dp[i+1][j].second;
			if(pickleft > pickright){
				dp[i][j].first = pickleft;
				dp[i][j].second = dp[i+1][j].first;
			}else{
				dp[i][j].first = pickright;
				dp[i][j].second = dp[i][j-1].first;
			}
		}
	}
	cout<<dp[0][n-1].first - dp[0][n-1].second<<endl;
}


Measured memory_bytes: 143912
#include<bits/stdc++.h>
#define fi first
#define se second
#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define rrep(i, n) for (int (i) = 1; (i) <= (n); (i++))
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define pb push_back
#define eb emplace_back
#define yn {puts("Yes");}else {puts("No");}
#define printd(x) printf("%.12f\n", ans);
template<class T> bool chmin(T& a, const T& b) {if (a > b) {a = b; return 1;} return 0;}
template<class T> bool chmax(T& a, const T& b) {if (a < b) {a = b; return 1;} return 0;}
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main(void) {
    int n, m;
    cin >> n >> m;
    int a[m], b[m];
    rep (i, m) cin >> a[i] >> b[i];

    vector<int> num(n + 1, 0);
    bool ok = true;
    rep (i, m) {
        num[a[i]]++;
        num[b[i]]++;
    }
    rrep (i, n) if (num[i] % 2) ok = false;
    
    cout << (ok ? "YES" : "NO") << endl;
    return 0;
}

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repl(i, n) for (ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for(int i = n; i >= 0; i--)
#define reprl(i, n) for(ll i = n; i >= 0; i--)
#define fori(i, m, n) for(int i = m; i < (int)n; i++)
#define forl(i, m, n) for(ll i = m; i < (ll)n; i++)
#define all(v) v.begin(), v.end()
ll gcd(ll a,ll b) {
  return b? gcd(b,a%b): a;  
}
ll lcm(ll a,ll b) {
  return a*b/gcd(a,b);
}
bool isLowerCase(char c){
  return (c>='a'&&c<='z');
}
const string bans(bool ans){
  return (ans?"Yes":"No");
}
int main() {
  int h,a;cin>>h>>a;
  int ans=h/a;
  if((h-(a*ans))>0)ans++;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
open System

// prelude
let readStr () = stdin.ReadLine()

let read f () = readStr() |> f
let reads f () = readStr().Split() |> Array.map f

let pair = function
| [|a; b|] -> (a, b)
| _ -> failwith "owatta"

let triple = function
| [|a; b; c|] -> (a, b, c)
| _ -> failwith "owatta"

let readPair f g () =
  let (a,b) = readStr().Split() |> pair
  (f a, g b)

let readTriple f g h () =
  let (a,b,c) = readStr().Split() |> triple
  (f a, g b, h c)

let inc n = n + 1
let dec n = n - 1

let inline flip f a b = f b a
let rec fix f = fun x -> (f (fix f)) x

module Option =
  let getOr defaultValue = function
  | Some x -> x
  | None -> defaultValue

module Array =
  let modify (arr: _ []) i f =
    arr.[i] <- f arr.[i]

module Array2D =
  let modify (arr: _ [,]) i j f =
    arr.[i, j] <- f arr.[i, j]

// startlet X = jlet X = jj
let X = read int64 ()
let rec cnt y =
  if y>=X then 0
  else 1+cnt (int64 (float y * 1.01))

cnt 100L
|> printfn "%d"

Measured memory_bytes: 30092
read N M
maru_data=$(cat)

cmd_str='grep -o -E "\-?[0-9]+\s\-?[0-9]+"'

c_d=$(echo $maru_data |eval $cmd_str |tail -n $M)
#echo $c_d
eval $(\
echo $maru_data | eval $cmd_str |head -n $N|
    awk ' {print("mae awk sqt {print(abs("$1"-one) + abs("$2"-two))} sqt ato")}' |
    sed "s/sqt/\'/g" | sed 's/one/$1/g' |sed 's/two/$2/g' | sed 's/abs\(([^\)]*)\)/sqrt((\1)^2)/g'|
    sed "s/mae/echo $(echo $c_d) |eval \$cmd_str | /g" |
    sed 's/ato/| cat -n | sort -n -s -k 2|head -n 1;/g' ) | cut -f 1 |tr -d " "




Measured memory_bytes: 4012
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
a1 = 10 - a%10
b1 = 10 - b%10
c1 = 10 - c%10
d1 = 10 - d%10
e1 = 10 - e%10
l = [a1,b1,c1,d1,e1]

for i in range(5):
  if l[i] == 10:
    l[i] = 0
  
def max(x,y):
  if x <= y:
    return y
  else:
    return x
f = max(max(max(max(l[0],l[1]),l[2]),l[3]),l[4])

ans = (a+b+c+d+e) + (l[0]+l[1]+l[2]+l[3]+l[4]) - f
print(ans)


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

using namespace std;

int solve(int n, int m, int c, const std::vector<int>& bs,
          const std::vector<std::vector<int>>& as) {
  int ret = 0;
  for (const auto& code : as) {
    int value = c;
    for (int i = 0; i < m; ++i) {
      value += code[i] * bs[i];
    }
    if (value > 0) {
      ret++;
    }
  }
  return ret;
}

int main() {
  std::cin.tie(nullptr);
  std::ios::sync_with_stdio(false);
  int n, m, c;
  std::cin >> n >> m >> c;
  std::vector<int> bs(m);
  for (auto& b : bs) {
    std::cin >> b;
  }
  std::vector<std::vector<int>> as(n, std::vector<int>(m));
  for (auto& code : as) {
    for (auto& a : code) {
      std::cin >> a;
    }
  }
  std::cout << solve(n, m, c, bs, as) << std::endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#define INF 1e+18
using namespace std;

int main(){
	int n,m,k;
	long long int a[20001];
	long long int dp[20001];
	cin >> n >> m >> k;
	for(int i = 0;i < n;i++){
		cin >> a[i + 1];
		dp[i + 1] = INF;
	}
	dp[0] = 0;
	for(int i = 0;i < n;i++){
		long long int mi = INF,ma = 0;
		for(int j = i + 1;j <= min(i + m,n);j++){
			mi = min(a[j],mi);
			ma = max(a[j],ma);
			dp[j] = min(dp[j],dp[i] + (j - i) * (ma - mi) + k);
		}
	}
	cout << dp[n] << endl;
	return 0;
}

Measured memory_bytes: 3444
#include<bits/stdc++.h>
using namespace std;
int main(){
int A,B;
  cin>>A>>B;
  
  if(A==1&&B==2){
  cout<<3<<endl;
  }
if(A==1&&B==3){
cout<<2<<endl;
}
if(A==2&&B==3){
cout<<1<<endl;

}
  if(A==2&&B==1){
  cout<<3<<endl;
  }
  if(A==3&&B==1){
  cout<<2<<endl;
  }
  if(A==3&&B==2){
  cout<<1<<endl;
  }
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
 
int main(){
    int n[4][13]={}, num;
    char mark;
    cin >> num;
    while(cin >> mark >> num){
        switch(mark){
            case 'S':n[0][num-1]++;break; 
            case 'H':n[1][num-1]++;break; 
            case 'C':n[2][num-1]++;break; 
            case 'D':n[3][num-1]++;break; 
        }
    }
    for(int i = 0; i < 4; i++){
        for(int j = 0; j < 13; j++){
            if(n[i][j] == 0){
                switch(i){
                    case 0: cout << "S " << j+1 << endl;break;
                    case 1: cout << "H " << j+1 << endl;break;
                    case 2: cout << "C " << j+1 << endl;break;
                    case 3: cout << "D " << j+1 << endl;break;
                }
            }
        }
    }
    return 0;
}


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

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



int main() {

    long long h, n;
    cin >> h >> n;
    long long temp = 0;
    long long sum = 0;
    for (long long i = 0; i < n;i++)
    {
        cin >> temp;
        sum += temp;
    }
    if(sum>=h)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String args[]) {

        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        long k = sc.nextLong();

        String t = s + s;

        if (s.length() == 1) {
            long result = k / 2L;
            System.out.println(result);

        } else {
            long result = Math.min(countOverlap(s, k, true), countOverlap(s, k, false));
            System.out.println(result);
        }
    }

    public static long countOverlap(String s, long k, boolean isStart) {
        long count = 0L;
        String[] arrS = s.split("");
        if (isStart) {
            for (int i = 1; i < s.length(); i++) {
                if (arrS[i - 1].equals(arrS[i])) {
                    count++;
                    arrS[i] = "rp";
                }
            }
        } else {
            for (int i = s.length() - 1; i > 0; i--) {
                if (arrS[i - 1].equals(arrS[i])) {
                    count++;
                    arrS[i - 1] = "rp";
                }
            }
        }
        long result = count * k;
        if (arrS[0].equals(arrS[s.length() - 1]) && k != 1) {
            if (k % 2 == 1) {
                result += k / 2;
            } else {
                result += k - 1;
            }
        }
        return result;
    }
}


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

int main()
{
    long long int n;
    cin >> n;
    vector<tuple<int,int,int> > v;
    for(int i=0;i<n;i++)
    {
        int a,b,c;
        cin >> a >> b >> c;
        v.push_back(make_tuple(a,b,c));
    }
    vector<tuple<int,int,int> > dp(n);
    dp[0]=v[0];
    for(int i=1;i<n;i++)
    {
        get<0>(dp[i])=get<0>(v[i])+max(get<1>(dp[i-1]),get<2>(dp[i-1]));
        get<1>(dp[i])=get<1>(v[i])+max(get<0>(dp[i-1]),get<2>(dp[i-1]));
        get<2>(dp[i])=get<2>(v[i])+max(get<1>(dp[i-1]),get<0>(dp[i-1]));
    }
    int a=get<0>(dp[n-1]);
    int b=get<1>(dp[n-1]);
    int c=get<2>(dp[n-1]);
    cout << max(a,max(b,c)) << endl;
}

Measured memory_bytes: 2676
<?php
 
	fscanf(STDIN, "%d %d %d %d", $a, $b, $c, $d);
	
	if ($a > 0 && $b > 0) {
      if ($d <= 0) {
        echo ($a * $d);
      } else {
      	echo ($b * $d);
      }
    } else if ($a <= 0 && $b > 0) {
      if ($c <= 0 && $d > 0) {
        echo (max($b * $d, $a * $c));
      } else if ($c <=0 && $d <= 0) {
      	echo ($a * $c);
      } else if ($c > 0 && $d > 0) {
        echo ($b * $d);
      }
    } else if ($a <= 0 && $b <= 0) {
      if ($c <= 0 && $d > 0) {
        echo (max($b * $d, $a * $c));
      } else if ($c <=0 && $d <= 0) {
      	echo ($a * $c);
      } else if ($c > 0 && $d > 0) {
        echo ($b * $c);
      }
    }
?>

Measured memory_bytes: 16136
#include <iostream>
#include <map>
#include <algorithm>
#include <string>
#include <vector> 
#include <numeric>
#include <cmath>
#include <queue>
#include <iomanip>
#include <functional>


#define CHMAX(a,b) a = std::max(a,b)
#define CHMIN(a,b) a = std::min(a,b)
#define MAXMIN(a,b,c) std::max(a,min(b,c))
#define CHABS(a) a = std::abs(a) 
#define COUT(a) std::cout << a << std::endl
#define CERR(a) std::cerr << a << std::endl
#define FOR(n) for(lli i = 0; i < n; i++)

using namespace std;
using lli = long long int;
using pll = pair<lli, lli>;
using tlll = tuple<lli, lli, lli>;
using vll = vector<lli>;

lli mod197 = 1000000007LL;
lli INF = 10000000000000;

// ax + by = gcd(a,b) 最大公約数
template< typename T >
T extgcd(T a, T b, T& x, T& y) {
	T d = a;
	if (b != 0) {
		d = extgcd(b, a % b, y, x);
		y -= (a / b) * x;
	}
	else {
		x = 1;
		y = 0;
	}

	return d;
}



lli input[50][4] = {};
lli n, m, q, answer = 0;

bool next(vector<int>& v) {

	bool f = false;
	for (int i = 0; i < n; i++) {
		if (v[i] != m) {
			f = true;
		}
	}

	if (!f)
		return false;

	for (int i = n - 1; i >= 0; i--) {
		if (v[i] == m) {
		}
		else {
			v[i]++;
			for (int j = i + 1; j < n; j++) {
				v[j] = v[i];
			}
			break;
		}
	}

	return true;
}

lli dfs(vector<int>& v) {

	lli t = 0;

	for (int i = 0; i < q; i++) {
		if (v[input[i][1]] - v[input[i][0]] == input[i][2])
			t += input[i][3];
	}

	answer = max(t, answer);

	return !next(v);
}

int main(void) {

	cin >> n >> m >> q;

	for (int i = 0; i < q; i++) {
		lli a, b, c, d;
		cin >> a >> b >> c >> d;

		a--; b--;
		input[i][0] = a;
		input[i][1] = b;
		input[i][2] = c;
		input[i][3] = d;

	}

	bool end = false;
	vector<int> v(n,1);
	while (!end) {
		end = dfs(v);
	}

	cout << answer << endl;

	return 0;
}

Measured memory_bytes: 3208
a=int(input())
b=list(map(int,input().split()))
total=0
total2=0
i=1
for i in range(a-1):
    if b[i+1]<=b[i]:
        total+=1
    else:
        if total2<=total:
            total2=total
        total=0
print(max(total2,total))

Measured memory_bytes: 20644
n,x = map(int,input().split())
l = list(input().split())
#print(l)
s = []
s.append(0)
count = 0
for i in range(n):
    if i == 0:
        l[0] = int(l[0])
        s.append(l[0])
    else:
        l[i] = int(l[i])
        s.append(l[i] + s[i])

for i in range(n+1):
    if s[i] <= x:
        count += 1
    else:
        break
#print(s)
print(count)

Measured memory_bytes: 3064
import sys
input = sys.stdin.readline

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

# UnionFind

Group = [i for i in range(N)] # グループ分け
Nodes = [1]*N # 各グループのノードの数

def find(x):
    while Group[x] != x:
        x=Group[x]
    return x

def Union(x,y):
    if find(x) != find(y):
        if Nodes[find(x)] < Nodes[find(y)]:
            
            Nodes[find(y)] += Nodes[find(x)]
            Nodes[find(x)] = 0
            Group[find(x)] = find(y)
            
        else:
            Nodes[find(x)] += Nodes[find(y)]
            Nodes[find(y)] = 0
            Group[find(y)] = find(x)

for i in range(M):
    x,y=map(int,input().split())
    Union(x-1,y-1)

from collections import Counter

print(max(Counter([find(x) for x in range(N)]).values()))


Measured memory_bytes: 115992
#pragma region template
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const long long MOD = 1e9 + 7, MAX = LLONG_MAX, larg = 1e5, INF = -1e9;
long long A, B, C, D, E, F, G, H, I, J, K, L, N, M, O, P, Q, R, S, T, U, V, W;
typedef long long ll;
typedef pair<ll, ll> Pa;

int main() {
    cin >> K >> A >> B;
    int curr = K;
    for(int i=0;i<1000;i++){
        if(A <= curr && curr <= B) {
            cout << "OK";
            return 0;
        }
        curr += K;
    }
    cout << "NG";
}


Measured memory_bytes: 3608
#include <bits/stdc++.h>
#define INF 1e9
#define all(v) v.begin(), v.end()
#define rep(i, n) for(int i = 0; i < n; i++)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define max(v) *max_element(v.begin(), v.end())
#define min(v) *min_element(v.begin(), v.end())
using namespace std;

void kock(int n, long double p1x, long double p1y, long double p2x, long double p2y){
    static const double pi = 3.141592653589793;
    if(n == 0){
        return;
    }
    long double sx = (2*p1x + 1*p2x)/3;
    long double sy = (2*p1y + 1*p2y)/3;
    long double tx = (1*p1x + 2*p2x)/3;
    long double ty = (1*p1y + 2*p2y)/3;
    long double ux = (tx-sx)*cos(pi/3) - (ty-sy)*sin(pi/3) + sx;
    long double uy = (tx-sx)*sin(pi/3) + (ty-sy)*cos(pi/3) + sy;

    kock(n-1, p1x, p1y, sx, sy);
    cout<<setprecision(8)<<sx<<" "<<setprecision(8)<<sy<<endl;
    kock(n-1, sx, sy, ux, uy);
    cout<<setprecision(8)<<ux<<" "<<setprecision(8)<<uy<<endl;
    kock(n-1, ux, uy, tx, ty);
    cout<<setprecision(8)<<tx<<" "<<setprecision(8)<<ty<<endl;
    kock(n-1, tx, ty, p2x, p2y);
}

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

    int n;
    cin>>n;
    long double p1x, p1y, p2x, p2y;
    p1x = 0;
    p1y = 0;
    p2x = 100;
    p2y = 0;
    cout<<setprecision(8)<<p1x<<" "<<setprecision(8)<<p1y<<endl;
    kock(n, p1x, p1y, p2x, p2y);
    cout<<setprecision(8)<<p2x<<" "<<setprecision(8)<<p2y<<endl;
    return 0;
}



Measured memory_bytes: 3248
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=1e6+6;
typedef long long ll;
const int mod=1e9+7;
ll pre[maxn],a[maxn],b[maxn],cnt[maxn];
ll n,m;
ll anss[maxn];
ll ans;
ll Find(ll x)
{
    return pre[x]==x?x:pre[x]=Find(pre[x]);
}
ll join(ll x,ll y)
{
    ll fx=Find(x);
    ll fy=Find(y);
    if(fx!=fy)
    {
        ans+=cnt[fx]*cnt[fy];
        pre[fx]=fy;
        cnt[fy]+=cnt[fx];
    }
}
void init()
{
    for(int i=0; i<n; i++)pre[i]=i,cnt[i]=1;

}
int main()
{
    scanf("%lld%lld",&n,&m);
    init();
    for(int i=0; i<m; i++)scanf("%lld",&a[i]),scanf("%lld",&b[i]);
    int xx=0;
    for(int i=m-1; i>=0; i--)
    {
        anss[xx++]=n*(n-1)/2-ans;
        join(a[i],b[i]);
    }

    for(int i=xx-1;i>=0;i--)
    {
        printf("%lld\n",anss[i]);
    }

    return 0;
}


Measured memory_bytes: 14336
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <utility>
#include <functional>
#include <cstdlib>
long long int n,k, c1, c2;
int main()
{
    scanf("%lld%lld", &n, &k);
    c1 = n/k;
    if(k%2 == 0)
        c2 = (n+k/2)/k;
    printf("%lld\n", c1*c1*c1+c2*c2*c2);
}

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

using namespace std;

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

    int ans=0;
    for(int a=1;a<=k;a++){
        for(int b=1;b<=k;b++){
            for(int c=1;c<=k;c++){
                ans+=gcd(gcd(a,b),c);
            }
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 3624
import numpy as np
N,W = map(int,input().split())
ndp = np.zeros(W+1,dtype= np.int64)
for _ in range(N):
    w,v = map(int,input().split())
    np.maximum(ndp[:-w] + v, ndp[w:], out = ndp[w:])
print(ndp[-1])


Measured memory_bytes: 14568
#include <iostream>
using namespace std;
int lhs[200001] = {}, rhs[200001] = {};

bool checkBoundary(int num, int n){
    if(0 <= num && num < n)
        return true;
    return false;
}

int main(){
    int n;
    cin >> n;
    for(int i = 0, num; i < n ; ++i){
        cin >> num;
        if(checkBoundary(i-num,n))
            lhs[i-num]++;
        if(checkBoundary(i+num,n))
            rhs[i+num]++;
    }
    long long ans = 0;
    for(int i = 0 ; i < n ; ++i)
        ans += (long long)lhs[i]*rhs[i];
    cout << ans;
    
    return 0;
}

Measured memory_bytes: 5204
import sys
sys.stdin.readline

n = int(input())
a = []
for _ in range(n):
    sa = input().strip()
    tmp = 0
    for i in range(len(sa)):
        if sa[i] == '.':
            break
        tmp = tmp * 10 + int(sa[i])
    i += 1
    for j in range(i, i + 9):
        if j < len(sa):
            tmp = tmp * 10 + int(sa[j])
        else:
            tmp *= 10
    a.append(tmp)

div25 = [[0, 0] for _ in range(n)]
for i, _a in enumerate(a):
    while _a % 2 == 0:
        div25[i][0] += 1
        _a //= 2
    while _a % 5 == 0:
        div25[i][1] += 1
        _a //= 5

div25.sort(key=lambda x: (-x[1], -x[0]))

plot = [[0 for _ in range(19)] for _ in range(19)]
ans = 0
for d25 in div25:
    rem2, rem5 = max(0, 18 - d25[0]), max(0, 18 - d25[1])
    for j in range(rem5, 19):
        for k in range(rem2, 19):
            ans += plot[j][k]
    plot[min(18, d25[1])][min(18, d25[0])] += 1
print(ans)

Measured memory_bytes: 119432
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;

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

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

// Self settings
// clang-format off
#define MAX_N 100000
#define REP(i, N) for (int i = 0; i < (int)(N); ++i)
#define SLN(i,N) (i == N-1 ? "\n" : " ")
// clang-format on

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

int main(void)
{
  int N, X;
  cin >> N >> X;
  vector<int> x(N + 1);
  REP(i, N) cin >> x[i];
  x[N] = X;

  // N log N
  sort(x.begin(), x.end());

  ll w[N + 1];
  REP(i, N) { w[i] = x[i + 1] - x[i]; }

  ll dp[N + 1];
  dp[0] = w[0];
  REP(i, N) { dp[i + 1] = gcd(dp[i], w[i]); }

  cout << dp[N] << endl;
  return 0;
}


Measured memory_bytes: 2176
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<stdlib.h>

int main(void) {
	int A,B;
	int num = 1;
	scanf("%d %d", &A,&B);
	for (int i = A; i < B; i += A - 1) {
		num++;
	}
	if (B == 1) {
		num = 0;
	}
	printf("%d\n", num);
}

Measured memory_bytes: 128
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,fractions,copy
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

n,p = inpl()
t = list(input())[::-1]
res = 0
if p == 2 or p == 5:
    t = t[::-1]
    for i,x in enumerate(t):
        if int(x) % p == 0:
            res += i+1
    print(res)
    quit()
d = defaultdict(int)
now = 0
d[0] += 1
# print(t)
for i,x in enumerate(t):
    tmp = (pow(10,i,p) * int(x)) % p
    now += tmp
    now %= p
    d[now] += 1
# print(d)
for va in d.values():
    res += va*(va-1)//2
print(res)

Measured memory_bytes: 8308