akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <algorithm>
using namespace std;

int MatrixChainMaltiplication(int *p, int n) {
    int m[n+1][n+1];
    for (int i=0; i<=n; i++) m[i][i] = 0;

    for (int l=2; l<=n; l++) {
        for (int i=1; i<=(n-l+1); i++) {
            int j = i + l - 1;
            m[i][j] = (1 << 21);
            for (int k=i; k<=j-1; k++) {
                m[i][j] = min(m[i][j], m[i][k] + m[k + 1][j] + p[i - 1] * p[k] * p[j]);
            }
        }
    }
    return m[1][n];
}

int
main()
{
    int n;
    scanf("%d", &n);
    int p[n+1];
    for (int i=0; i<n; i++) {
        int a, b;
        scanf("%d %d", &a, &b);
        if (i == 0) p[i] = a;
        p[i+1] = b;
    }
    printf("%d\n", MatrixChainMaltiplication(p, n));
    return 0;
}

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

int64_t compute(const int a) {
  constexpr int k = 1000000000 + 7;
  int64_t result = 1;
  for (int i = 1; i <= a; ++i) {
    result *= i;
    result %= k;
  }
  return result;
}

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

  if (abs(N - M) >= 2) {
    cout << 0 << endl;
    return 0;
  } else if (N + M == 1) {
    cout << 1 << endl;
    return 0;
  }
  int64_t result = 0;
  constexpr int k = 1000000000 + 7;
  if (N == M) {
    int64_t tmp = compute(N);
    tmp *= compute(M);
    tmp %= k;
    tmp *= 2;
    tmp %= k;
    result = tmp;
  } else {
    int64_t tmp = compute(N);
    tmp *= compute(M);
    tmp %= k;
    result = tmp;
  }

  cout << result << endl;
  return 0;
}


Measured memory_bytes: 384
#include <algorithm>
#include <bitset>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstring>
#include <fstream>
#include <iostream>
#include <iomanip>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <string>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

const int MAX = 100007;
const int MOD = 1000000007;

void solve() {
    int n, a, b, c;
    cin >> n >> a >> b >> c;
    string arr[MAX];
    for (int i = 1; i <= n; i++) {
        cin >> arr[i];
    }
    char ans[MAX];
    for (int i = 1; i <= n; i++) {
        if (arr[i] == "AB") {
            if (a == 0 && b == 0) {
                cout << "No";
                return;
            }
            if (a == 1 && b == 1 && c == 0 && i != n && arr[i + 1] == "AC") {
                ans[i] = 'A';
                a++;
                b--;
                continue;
            }
            if (a == 1 && b == 1 && c == 0 && i != n && arr[i + 1] == "BC") {
                ans[i] = 'B';
                b++;
                a--;
                continue;
            }
            if (a > b) {
                ans[i] = 'B';
                b++;
                a--;
            }
            else {
                ans[i] = 'A';
                a++;
                b--;
            }
        }
        if (arr[i] == "AC") {
            if (a == 0 && c == 0) {
                cout << "No";
                return;
            }
            if (a == 1 && b == 0 && c == 1 && i != n && arr[i + 1] == "AB") {
                ans[i] = 'A';
                a++;
                c--;
                continue;
            }
            if (a == 1 && b == 0 && c == 1 && i != n && arr[i + 1] == "BC") {
                ans[i] = 'C';
                c++;
                a--;
                continue;
            }
            if (a > c) {
                ans[i] = 'C';
                c++;
                a--;
            }
            else {
                ans[i] = 'A';
                a++;
                c--;
            }
        }
        if (arr[i] == "BC") {
            if (b == 0 && c == 0) {
                cout << "No";
                return;
            }
            if (a == 0 && b == 1 && c == 1 && i != n && arr[i + 1] == "AB") {
                ans[i] = 'B';
                b++;
                c--;
                continue;
            }
            if (a == 0 && b == 1 && c == 1 && i != n && arr[i + 1] == "AC") {
                ans[i] = 'C';
                c++;
                b--;
                continue;
            }
            if (b > c) {
                ans[i] = 'C';
                c++;
                b--;
            }
            else {
                ans[i] = 'B';
                b++;
                c--;
            }
        }
    }
    cout << "Yes" << endl;
    for (int i = 1; i <= n; i++) {cout << ans[i] << endl;}
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    //int tt; cin >> tt; for (int i = 1; i <= tt; i++) {solve(); cout << endl;}
    solve();
}

Measured memory_bytes: 6792
package main

import (
	"fmt"
)

func main() {
	var A, B, C, D int

	fmt.Scan(&A, &B, &C, &D)

	for {
		C = C - B
		if C <= 0 {
			fmt.Println("Yes")
			break
		}

		A = A - D
		if A <= 0 {
			fmt.Println("No")
			break
		}
	}
}


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

int main() {
    int n;
    while(cin >> n, n) {
        int ans = 0;
        for(int i = 1; i < 1000; ++i) {
            for(int j = i + 1; j < 1000; ++j) {
                ans += (i + j) * (j - i + 1) / 2 == n;
            }
        }
        cout << ans << endl;
    }
}



Measured memory_bytes: 3000
K, N = map(int, input().split())
A = list(map(int, input().split()))
dist=0
max_dist=0
max_i=0
for i in range(N):
	a=A[i%N]
	b=A[(i+1)%N]
	tmp=b-a if b>a else K+b-a
	if max_dist<tmp:
		max_dist=max(max_dist,tmp)
		max_i = i
for i in range(N-1):
	i2 = i+max_i+1
	a=A[i2%N]
	b=A[(i2+1)%N]
	tmp=b-a if b>a else K+b-a
	dist+=tmp
print(dist)

Measured memory_bytes: 26444
#include<bits/stdc++.h>
#define F first
#define S second
#define REP(i, a, b, c) for(int i = a; i <= b; i+=c)
#define pb push_back
#define int long long int
#define MOD 1000000007
using namespace std;

/*class Graph {

  map<int, list<pair<int, int> > > l;

public:
  void addEdge(int x, int y, int cost) {
    l[x].pb(make_pair(y, cost));
    l[y].pb(make_pair(x, cost));
  }

  int dfs_helper(int n, int node, map<int, int> &vis, map<int, int> &count, int &ans) {
    //cout << node << " " ;
    vis[node] = 1;
    count[node] = 1;
    for (auto m : l[node]) {
      if (!vis[m.F]) {
        vis[m.F] = 1;
        count[node] += dfs_helper(m.F, vis, count, ans);
        ans += 2 * min(count[node], n - count[node]) * m.S.S;
      }
    }
    return count[node];
  }

  void dfs() {
    map<int, int> vis;
    map<int, int> count;
    int ans = 0;
    dfs_helper(0, vis, count, ans);
    cout << ans << endl;
  }

};*/

int dp[100005];

int f(int a[], int i, int n, int k)
{
  //cout << i << endl;
  if (i == (n - 1))
    return 0;
  if (i >= n)
    return INT_MAX;
  if (dp[i] != -1)
    return dp[i];
  int ans = INT_MAX;
  for (int j = 1; j <= k; j++)
  {
    if (i + j <= n - 1)
    {
      ans = min(ans, abs(a[i] - a[i + j]) + f(a, i + j, n, k));
    }
  }
  return dp[i] = ans;
}


int32_t main()
{
  ios :: sync_with_stdio(false); cin.tie(0);
  int t = 1;
  //cin >> t;
  for (int i9 = 1; i9 <= t; i9++)
  {
    /* Graph G;
     int n, x, y, cost;
     cin >> n;
     while (n--) {
       cin >> x >> y >> cost;
       G.addEdge(x, y, cost);
     }
     G.dfs();*/
    //freopen("ouputnew.txt", "w", stdout);
    //flclose(stdout);
    memset(dp, -1 , sizeof (dp));
    int n, k;
    cin >> n >> k;
    int a[n];
    for (int i = 0; i < n; i++)
      cin >> a[i];
    cout << f(a, 0, n, k);
  }
}



Measured memory_bytes: 14624
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<climits>
#include<string>
#include<vector>
#include<map>
#include<queue>
#include<set>
#include<algorithm>

#define ll long long
#define dl double
#define mod 1000000007
#define sz 1005
#define szz 1005

#define PI 2*acos(0.0)

using namespace std;

int main()
{
    char str[sz];

    scanf("%s",str);

    str[3]='8';

    printf("%s\n",str);

    return (0);
}





Measured memory_bytes: 256
n = gets.to_i
@r = 0
def rec(s, n)
  if s.count('3') > 0 && s.count('5') > 0 && s.count('7') > 0
    return if s.to_i > n
    @r += 1
  end
  return if s.to_i > n
  rec(s + '3', n)
  rec(s + '5', n)
  rec(s + '7', n)
end
rec('0', n)
puts @r

Measured memory_bytes: 1788
a,b,k = gets.split.map(&:to_i)
t=0;aok=0;
if a>=k
    t = a-k
    aok = b
elsif b>=k-a
    t = 0
    aok = b-(k-a)
else
    t = 0
    aok = 0
end
printf('%d %d', t, aok)

Measured memory_bytes: 1788
#include"bits/stdc++.h"
using namespace std;

int main() {
	string s;
	cin >> s;
	string answer = "";
	for (int i = 0; i < s.size(); ++i) {
		if (s[i] == '0') {
			answer += '0';
		}
		else if (s[i] == '1') {
			answer += '1';
		}
		else {
			if (answer.size() > 0) {
				answer.pop_back();
			}
		}
	}
	cout << answer << endl;
	return 0;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES

#include <iostream>
#include <iomanip>
#include <stdio.h>

#include <sstream>
#include <algorithm>
#include <iterator>
#include <cmath>
#include <complex>

#include <string>
#include <cstring>
#include <vector>
#include <bitset>

#include <queue>
#include <set>
#include <map>
#include <stack>
#include <list>

#include <ctime>
////
//#include <random>//
/////////
#define R(i,n) for(int i=0;i<(n);i=i+1)
/////////
typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;

////定数
const int INF = (int)1e9 + 10;
const LL MOD = (LL)1e9 + 7;
const LL LINF = (LL)4e18 + 20;
const LD PI = acos(-1.0);
const double EPS = 1e-9; 
/////////
using namespace::std;
template<typename T>
void chmax(T& a, T b) {
	a = max(a, b);
}

template<typename T>
void chmin(T& a, T b) {
	a = min(a, b);
}

template<typename T>
void IN(vector<T> &A,int N=-1) {
	if (N == -1) {
		N = A.size();
	}
	for (int i = 0; i < N; ++i) {
		cin >> A[i];
	}
}

template<typename T>
void SO(vector<T> &A,bool F=false) {
	sort(A.begin(), A.end());
	if (F) {
		reverse(A.begin(), A.end());
	}
}
//////////////

int dist1[300][300];
int dist2[300][300];

void solve() {
	int N, M, L;
	cin >> N >> M >> L;
	for (int i = 0; i < N; ++i) {
		for (int j = 0; j < N; ++j) {
			dist1[i][j] = INF;
			dist2[i][j] = INF;
			if (i == j) {
				dist1[i][j] = 0;
			}
		}
	}
	for (int i = 0; i < M; ++i) {
		int a, b, c;
		cin >> a >> b >> c;
		--a; --b;
		dist1[a][b] = c;
		dist1[b][a] = c;
	}
	R(k, N)R(i, N)R(j, N)chmin(dist1[i][j], dist1[i][k] + dist1[k][j]);
	

	R(i, N)for(int j=i+1;j<N;++j){
		if (dist1[i][j] <= L) {
			dist2[i][j] = 1;
			dist2[j][i] = 1;
		}
	}
	R(k, N)R(i, N)R(j, N)chmin(dist2[i][j], dist2[i][k] + dist2[k][j]);

	int Q;
	cin >> Q;
	while (Q--) {
		int s, t;
		cin >> s >> t; --s; --t;
		int ans = -1;
		if (dist2[s][t] != INF) {
			ans = dist2[s][t]-1;
		}
		cout << ans << endl;
	}
}

signed main(void) {
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	std::cout << std::fixed;//小数を10進数表示
	cout << setprecision(16);//小数点以下の桁数を指定//coutとcerrで別	

	solve();
}

Measured memory_bytes: 1280
#include <stdio.h>

int main(void){
  int N = 0, i = 0;
  char buffer[256];
  int count = 0;
  int left = 0;
  
  scanf("%d", &N);
  scanf("%s", buffer);
  
  for (i = 0; i < N; i++){
    if (buffer[i] == '('){
      count++;
    } else if (buffer[i] == ')') {
      count--;
      if (count < 0){
        left++;
        count++;
      }
    }
  }
  
  for (i = 0; i < left; i++){
    printf("(");
  }
  
  printf("%s", buffer);
  
  for (i = 0; i < count; i++){
    printf(")");
  }
  
  printf("\n");
  
  return 0;
}

Measured memory_bytes: 128
import itertools
import math

def dist(x1, x2, y1, y2):
    return math.sqrt((x1 - x2)**2 + (y1 - y2)**2)

def dist_p(p1, p2):
    return dist(p1[0], p2[0], p1[1], p2[1])

n = int(input())
c = []

for i in range(n):
    xi,yi = map(int, input().split())
    c.append((xi, yi))

l = list(itertools.permutations(c))

sum = 0
for e in l:
    for i in range( len(e)-1 ):
        sum += dist_p(e[i], e[i+1])

print(sum/len(l))


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

#define int long long
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<n;++i)
#define exrep(i, a, b) for(ll i = a; i < b; i++)
#define out(x) cout << x << endl
#define EPS (1e-7)
#define gearup ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<bool> > vvb;
typedef vector<vector<double> > vvd;
typedef vector<vector<string> > vvs;
typedef vector<ll> vl;
typedef vector<vector<ll> > vvl;
typedef vector<vector<vector<ll> > > vvvl;
ll MOD = 1000000007;
const long long L_INF = 1LL << 60;
const int INF = 2147483647; // 2^31-1
const double PI = acos(-1);
//cout<<fixed<<setprecision(10);

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;}
template<class T> void debug(T v){rep(i,v.size()) cout<<v[i]<<" ";cout<<endl;}
const ll dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll dy[8] = {0, 1, 1, 1, 0, -1, -1, -1};
//以降 cin の入力元が 'input.txt' になる
//std::ifstream in("input.txt");
//std::cin.rdbuf(in.rdbuf());


signed main()
{
    gearup;
    ll n,h,w; cin >> n >> h >> w;
    ll res = 0;
    rep(i,n){
        int a,b; cin >> a >> b;
        if(a >= h && b >= w)res++;
    }
    out(res);
}

Measured memory_bytes: 3644
n,k=map(int,input().split())
a=list(map(int,input().split()))
a=[(i+1)/2 for i in a]
from itertools import accumulate
a=list(accumulate(a))
ans=0
for i in range(n-k+1):
    if i-1>=0:
        tmp=a[i+k-1]-a[i-1]
    else:
        tmp=a[i+k-1]
    ans=max(ans,tmp)
print(ans)

Measured memory_bytes: 25060
if __name__ == "__main__":
    A,B,C = map(int, input().split())
    res = set()
    a = A % B
    while (True):
        if a in res:
            break
        res.add(a)
        a += A % B
        a %= B
    if C in res:
        print ("YES")
    else:
        print ("NO")


Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,flag,j,cnt=0;
  cin >> n;
  vector<int> a(n);
  for(int i=0;i<n;i++)
    cin >> a.at(i);
  
  flag = 1;
  j = 0;//未ソート部分列の先頭インデックス
  while(flag){
    flag = 0;
    for(int k=n-1;k>j;k--){
      if(a[k-1]>a[k]){
        swap(a[k-1],a[k]);
        cnt++;
        flag = 1;
      }
    }
    j++;
  }
  
  for(int i=0;i<n-1;i++)
    cout << a.at(i) << " ";
  cout << a.at(n-1) << endl;
  cout << cnt << endl;
  
  return 0;
}


Measured memory_bytes: 3072
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

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

    static class FRemovingRobots {
        long mod = 998244353;

        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            int a[][] = new int[n][2];
            for (int i = 0; i < n; i++) {
                a[i][0] = in.nextInt();
                a[i][1] = in.nextInt();
            }
            Arrays.sort(a, (a1, a2) -> a1[0] - a2[0]);
            int next[] = new int[n];
            next[n - 1] = n;
            long dp[] = new long[n + 1];
            dp[n] = 1;
            for (int i = n - 1; i >= 0; i--) {
                int max = a[i][0] + a[i][1];
                int ne = i + 1;
                while (ne < n && max > a[ne][0]) {
                    ne = next[ne];
                }
                next[i] = ne;
            }
            for (int i = n - 1; i >= 0; i--) {
                dp[i] = dp[i + 1] + dp[next[i]];
                dp[i] %= mod;
            }
            out.println(dp[0]);
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}



Measured memory_bytes: 61856
N=int(input())
A=[list(map(int,input().split())) for i in range(N-1)]
for i in range(N):
  t=0
  for j in range(i,N-1):
    if t<A[j][1]:
      t=A[j][1]
    elif (t-A[j][1])%A[j][2]:
      t+=A[j][2]-t%A[j][2]
  
    t+=A[j][0]
  print(t)

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

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

    if (A + B > C + D) {
        cout << "Left" << endl;
    }
    else if (A + B < C + D) {
        cout << "Right" << endl;
    }
    else {
        cout << "Balanced" << endl;
    }
}

Measured memory_bytes: 256
<?php
$fp = fopen("php://stdin", "r");
$con=array();
while(true){
    $in=trim(fgets($fp));
    if($in){
      //  echo $in;
        $arr=explode(" ",$in);
        if(isset($con[$arr[0]])){
            array_push($con[$arr[0]],$arr[1]);
        }
        else {
            $con[$arr[0]]=array();
            array_push($con[$arr[0]],$arr[1]);
        }
    }
    else break;
}
ksort($con);
//print_r($con);
foreach($con as $k=>$v){
    echo $k."\n";
    sort($v);
    echo implode(" ",$v)."\n";

}

Measured memory_bytes: 6660
#include"bits/stdc++.h"
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
const long long mod = 1000000007;
const double pi = 3.1415926535897932;
const double eps = 0.000000000001;
const int inf = 1145141919;
struct edge { int to, cost; };
int X[2005], Y[2005];

double add(double a, double b) {
	if (abs(a + b) < eps*(abs(a) + (abs(b))))return 0;
	return a + b;
}

struct P {
	double x, y;
	P() {}
	P(double x, double y) :x(x), y(y) {}
	P operator +(P p) {
		return P(add(x, p.x), add(y, p.y));
	}
	P operator -(P p) {
		return P(add(x, -p.x), add(y, -p.y));
	}
	P operator *(double d) {
		return P(x*d, y*d);
	}
	double dot(P p) {
		return add(x*p.x, y*p.y);
	}
	double det(P p) {
		return add(x*p.y, -y*p.x);
	}
};
double dist(P a) {
	return sqrt((a.x*a.x)+(a.y*a.y));
}
bool cmpx(const P& p, const P& q) {
	if (p.x != q.x)return p.x < q.x;
	return p.y < q.y;
}
vector<P>totuho(P* ps, int n) {
	sort(ps, ps + n,cmpx);
	int k = 0;
	vector<P>qs(n * 2);
	rep(i, n) {
		while (k > 1 && (qs[k - 1] - qs[k - 2]).det(ps[i] - qs[k - 1]) <= 0)k--;
		qs[k++] = ps[i];
	}
	for (int i = n - 2, t = k; i >= 0; i--) {
		while (k > t && (qs[k - 1] - qs[k - 2]).det(ps[i] - qs[k - 1]) <= 0)k--;
		qs[k++] = ps[i];
	}
	qs.resize(k - 1);
	return qs;
}


P ps[115];
double ans[115];

signed main() {
	int n; cin >> n;
	rep(i, n)cin >> X[i] >> Y[i];
	
	rep(i, n)ps[i] = { (double)X[i], (double)Y[i] };
	vector<P>qs = totuho(ps, n);
	int Z = qs.size();
	
	rep(i, Z){
		int idx;
		rep(j, n) {
			if (X[j] == qs[i].x&&Y[j] == qs[i].y)idx = j;
		}
		P vp = qs[(i + 1) % Z] - qs[i], vq = qs[(i + Z - 1) % Z] - qs[i];

		ans[idx] = atan2(vq.y, vq.x) - atan2(vp.y, vp.x);
		if (ans[idx] < 0)ans[idx] += 2 * pi;
		if (ans[idx] > pi + eps)ans[idx] = pi * 2 - ans[idx];
		ans[idx] = pi - ans[idx];
	}
	rep(i, n) {
		ans[i] /= pi*2;
		if (n == 2)ans[i] = 0.5;
	}
	rep(i, n) {
		printf("%.13lf\n", ans[i]);
	}

}

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

map<ll,ll> mp;
vector<ll> v[1000000];
ll dfs(ll node)
{
	
	if(mp[node]==0)
	{
		mp[node]++;
		ll i,l=v[node].size(),s=0;
		for(i=0;i<l;i++)
		{
			s+=dfs(v[node][i]);
		}
		return s+1;
	}
	else
	{
		return 0;
	}
}
int main()
{
	ll i,j,t=1;
	//cin>>t;
	for(i=0;i<t;i++)
	{
		ll n,m,x,y,mini=0;
		cin>>n>>m;
		for(j=0;j<m;j++)
		{
			cin>>x>>y;
			v[x].push_back(y);
			v[y].push_back(x);
		}
		for(j=1;j<=n;j++)
		{
			if(mp[j]==0)
			{
				mini=max(mini,dfs(j));
			}
		}
		cout<<mini;
	}
}

Measured memory_bytes: 64320
#include <iostream>
#include <string>
#include <math.h>
#include <stdlib.h>

using namespace std;

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

	int e_num = 0;
	int o_num = 0;
	int num = 0;

	if(N >= 2){
		e_num = N * (N-1) / 2;
	}
	if(M >= 2){
		o_num = M * (M-1) / 2;
	}

	num = e_num + o_num;

	cout << num << endl;

	return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
  int n,i;
  cin>>n;
  int num,freq[n]={0};
  for(i=0;i<n-1;i++)
  {
    cin>>num;
    freq[num-1]++;
  }
  for(i=0;i<n;i++)
    cout<<freq[i]<<endl;
  return 0;
}


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

int main(){
  ll n,k;
  std::cin >> n>>k;
  std::vector<int> h(n);
  for (int i = 0; i < n; i++) {
    std::cin >> h[i];
  }
  std::sort(h.begin(), h.end(), std::greater<int>() );


  ll ans=0;
  if(n>k){
    for (int i = k; i < n; i++) {
      ans+=h[i];
    }
  }
  std::cout <<ans << '\n';
  return 0;
}


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

using namespace std;

#define rep(i,n) for(int i=0;i<n;i++)
int main(){
    int N;
    cin >> N;
    int ans = N;
    
    rep(i, N+1){
        int res = 0;
        int t = i;
        while(t > 0){
             res += t%9;
             t = t/9;
        }
        t = N - i;
        while(t > 0){
            res += t%6;
            t = t/6;
        }
        if(res < ans)ans = res;
    }
    cout << int(ans);
}

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

using namespace std;

int main(){

  string s1, s2;
  cin >> s1 >> s2;

  if (s1 > s2){
    cout << '>' << endl;
  }
  else if (s1 < s2){
    cout << '<' << endl;
  }
  else {
    cout << '=' << endl;
  }

  return 0;
}


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

using namespace std;

int main()
{
    int a[3],i;int k;
    for(i=0;i<3;i++)
        scanf("%d",&a[i]);

    scanf("%d",&k);
    sort(a,a+3);int t=1;
    for(i=0;i<k;i++)
        t=t*2;
    t=a[2]*t;
    int s;
    s=a[0]+a[1]+t;
    printf("%d\n",s);

    return 0;
}


Measured memory_bytes: 256
N = int(input())
A = [0] * N
B = [0] * N

for i in range(N):
    A[i], B[i] = map(int, input().split())

A.sort()
B.sort()

if N % 2 == 1:
    mid_a = A[(N + 1) // 2 - 1]
    mid_b = B[(N + 1) // 2 - 1]
    print(mid_b - mid_a + 1)
else:
    mid_a = (A[N // 2 - 1] + A[N // 2]) / 2
    mid_b = (B[N // 2 - 1] + B[N // 2]) / 2
    print(int((mid_b - mid_a) * 2) + 1)


Measured memory_bytes: 25356
#include <bits/stdc++.h>
#define pb push_back
#define ll long long
#define md 1000000007
#define ld long double
using namespace std;
ld pi = 3.14159265359;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll n, i = 0, j= 0, k = 0, l = 0, m = 0, a = 0, b = 0, sum = 0, x = 0, y = 0, z = 0, c, p = 0;
    cin >> n;
    ld d;
    cout << fixed << setprecision(9) << 2 * pi * n;

    return 0;
}


Measured memory_bytes: 3728
from itertools import groupby
n=int(input())
h = list(map(int,input().split()))
p=[]
ans=[0]
for i in range(n-1):
  if h[i] >= h[i+1]:
    p.append(1)
  else:
    p.append(0)
for key, value in groupby(p):
  ans.append(sum(value))
print(max(ans))

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

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

long long MOD = 1000000000 + 7;

int main(){
  cout << setprecision(10);

  int N;
  cin >> N;
  vector<ll> A(N), B(N);
  for(int i = 0; i < N; i++){
    ll tmp1,tmp2;
    cin >> A.at(i) >> B.at(i);
  }

  ll ans = 0;
  for(int i = N-1; i >= 0; i--){
    ll tmp1 = A.at(i);
    ll tmp2 = B.at(i);
    ll mod = (tmp1+ans) % tmp2;
    ans += (mod == 0 ? 0 : tmp2 - mod);
  }
  cout << ans << endl;
}


Measured memory_bytes: 1792
fun main(args:Array<String>):Unit {
    val (n, t) = readLine()!!.trim().split(' ').map(String::toInt)
    println(
            String.format("%.5f",Array(n){
                val (x, h) = readLine()!!.trim().split(' ').map(String::toDouble)
                h * t / x
            }.max())
    )
}


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

#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define intll int long long
const int INF = 1e9;
const int MOD = 1e9 + 7;

int main() {
  int n ; 
  cin >> n ;
  int ans = 0;
  
  ans += n/500*1000 ;
  n %= 500 ;
  ans += n/5 * 5 ;
  
  cout << ans ;

}


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

using namespace std;

int oneDigit(int num)
{
    return (num >= 0 && num < 10);
}
 
bool isPalUtil(int num, int* dupNum)
{
    
    if (oneDigit(num))
        return (num == (*dupNum) % 10);
 
    if (!isPalUtil(num/10, dupNum))
        return false;
 
 
    *dupNum /= 10;
 
    return (num % 10 == (*dupNum) % 10);
}
 
int isPal(int num)
{
    if (num < 0)
       num = -num;
 
    int *dupNum = new int(num); 
 
    return isPalUtil(num, dupNum);
}

long long A;
long long B;
long long cnt;

int main()
{
	cnt = 0;
	scanf("%lld %lld", &A, &B);
	for(int i = A; i <= B; i++)
	{
		if(isPal(i))
		{
			cnt++;
		}
	}
	printf("%lld\n", cnt);
	return 0;
}
/*
	Powered by Buggy Plugin
*/


Measured memory_bytes: 3072
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	ll n;
	cin>>n;
	string s[n+2];
	map<string,ll> pam;
	for(ll i=0;i<n;i++)
	{
		cin>>s[i];
		pam[s[i]]++;
	}
	ll ans = pam.size();
	cout<<ans;

}

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

#define MOD 998244353
#define MAXN 3007

int a , b , c , d ;

long long dp[ MAXN ][ MAXN ] ;
long long w[ MAXN ][ MAXN ] ;
long long h[ MAXN ][ MAXN ] ;

long long pw[ 2 ][ MAXN ] ;

void input ( ) {
    scanf ( "%d%d%d%d" , &a , &b , &c , &d ) ;
}

void solve ( ) {
    dp[ a ][ b ] = 1 ;
    for ( int i = a + 1 ; i <= c ; ++ i ) {
        dp[ i ][ b ] = ( dp[ i - 1 ][ b ] * b ) % MOD ;
    }
    for ( int j = b + 1 ; j <= d ; ++ j ) {
        dp[ a ][ j ] = ( dp[ a ][ j - 1 ] * a ) % MOD ;
    }
    for ( int i = a + 1 ; i <= c ; ++ i ) {
        for ( int j = b + 1 ; j <= d ; ++ j ) {
            dp[ i ][ j ] = dp[ i - 1 ][ j ] * j + dp[ i ][ j - 1 ] * i ;
            dp[ i ][ j ] %= MOD ;

            long long sub = dp[ i - 1 ][ j - 1 ] * ( i - 1 ) * ( j - 1 ) ;
            sub %= MOD ;
            dp[ i ][ j ] = ( dp[ i ][ j ] - sub + MOD ) % MOD ;
        }
    }
    printf ( "%lld\n" , dp[ c ][ d ] ) ;
}


int main ( ) {
    ios_base :: sync_with_stdio ( false ) ;
    cin.tie ( NULL ) ;
    input ( ) ;
    solve ( ) ;
    return 0 ;
}


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

int main()
{
	vector<int> x(3);
	for (int i = 0; i < 3; ++i)
		cin >> x[i];
	sort(x.begin(), x.end());
	cout << ((x[0] == 5 && x[1] ==5 && x[2] == 7) ? "YES" : "NO") << endl;
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>

#include <complex>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#define debug(x) cerr << #x << " = " << (x) << endl;


#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 100010


int n,m;
int a[SIZE];

int main(){
  vector<int> vec[SIZE];
  ll sum_dif = 0;
  
  scanf("%d%d",&n,&m);
  for(int i=0;i<n;i++){
    scanf("%d",a+i);

    if(i > 0 && a[i-1] != a[i]){
      if(a[i-1] < a[i]){
        vec[a[i]].push_back(a[i-1]+1);
        sum_dif += a[i]-a[i-1];
      }else{
        //a[i-1] -> m+a[i]
        if(a[i-1]+1 <= m) 
          vec[m].push_back(a[i-1]+1);
        
        vec[a[i]].push_back(a[i-1]-m+1);        

        sum_dif += m+a[i] - a[i-1];
      }
    }
  }

  //debug(sum_dif);

  priority_queue<int> que;
  ll sum = 0;
  ll ans = -LLINF;
  
  for(int i=m;i>=1;i--){

    for(int j=0;j<vec[i].size();j++){
      que.push(vec[i][j]);
      sum += i - vec[i][j];
    }

    while(que.size() && que.top() >= i) que.pop();
    
    ans = max(ans, sum);
    sum -= que.size();
  }
  
  printf("%lld\n",sum_dif - ans);
  
  return 0;
}


Measured memory_bytes: 6520
#include <cmath>
#include <iostream>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <algorithm>
#include <utility>
#include <iomanip>

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

using namespace std;

typedef pair<int, int> P;

const int INF = 1e15;
const int MOD = 1e9+7;

signed main(){
    int h, w;
    cin >> h >> w;

    vector<int> a(26);
    rep(i, h){
        rep(j, w){
            char c;
            cin >> c;
            a[c-'a']++;
        }
    }

    int once = h * w % 2;
    int twice = 0;
    if(h % 2 == 1){
        twice += w / 2;
    }
    if(w % 2 == 1){
        twice += h / 2;
    }
    int other = (h / 2) * (w / 2);

    rep(i, once){
        rep(j, 26){
            if(a[j] % 4 == 1 || a[j] % 4 == 3){
                a[j] -= 1;
                break;
            }
        }
    }

    int cnt = 0;
    rep(i, twice){
        rep(j, 26){
            if(a[j] < 2){
                continue;
            }
            if(a[j] % 4 == 2){
                a[j] -= 2;
                cnt++;
                break;
            }
        }
    }

    if((twice - cnt) % 2 == 1){
        cout << "No" << endl;
        return 0;
    }

    rep(i, other+(twice - cnt)/2){
        rep(j, 26){
            if(a[j] < 4){
                continue;
            }
            if(a[j] % 4 == 0){
                a[j] -= 4;
                break;
            }
        }
    }

    rep(i, 26){
        if(a[i] != 0){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;

    return 0;
}


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

int main() {
    int64_t a, b, c, d;
    cin >> a >> b >> c >> d;
    
    a--;
    int64_t lcd = c * d / __gcd(c, d);
    cout << b - a - (b / c - a / c) - (b / d - a / d) + (b / lcd - a / lcd) << endl;
}


Measured memory_bytes: 256
N = int(input())
nums = list(map(int, input().split()))

for i in range(N):
    if i!=N-1:
        print(nums[i],end=' ')
    else:
        print(nums[i])
    
for i in range(1,N):
    key = nums[i]
    j =i-1
    while j >= 0 and nums[j] > key:
        nums[j+1] = nums[j]
        j-=1
    nums[j+1] = key
    
    for i in range(N):
        if i!=N-1:
            print(nums[i],end=' ')
        else:
            print(nums[i])


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

int main() {
    int n;
    cin >> n;
    vector <int>a(n);
    vector <int> b(10);
    bool r = true;
    for (int i=0;i<n;i++){
        cin >> a.at(i);
    }
    for (int i=0;i<n-1;i++) {
        int e =0;
          if (a.at(i) == a.at(i+1)){
              e++;
          }
          if( e == n ){
              cout << 0 << endl;
              r = false;
          }
    }
      while(r){
          sort(a.begin(),a.end());
          cout <<a.at(n-1)-a.at(0) << endl;
          break;

      }
    }


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <complex>
#include <math.h>
#include <set>
#include <vector>
#include <map>
#include <queue>
#include <stdio.h>
#include <stack>
#include <algorithm>
#include <list>
#include <ctime> 
#include <memory.h>
#include <assert.h>

using namespace std;

using ll = long long;
using pii = pair<int, int>;
const int INF = 1e9 + 1;
const int LLINF = 1e18 + 1;

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

    int sum = 0;
    for(int i = 0; i < N; i++) {
        int n = v[i];
        int cnt = 0;
        while(true) {
            if(n % 2 != 0) break;
            n /= 2;
            cnt++;
        }
        sum += cnt;
    }

    cout << sum << endl;

    return 0;
}

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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<ll, pair<ll, ll> > P3;

const ll MOD = ll(1e9 + 7);
const ll LLINF = LLONG_MAX;
const int IINF = INT_MAX;
const int MAX_N = int(3e5) + 5;
const double EPS = 1e-8;
int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};
#define SORT(v) sort((v).begin(), (v).end())
#define SORTR(v) sort((v).rbegin(), (v).rend())
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)


int main() {
    int n;
    cin >> n;
    vector<ll> a(n*3);
    REP(i,n*3)cin >> a[i];
    SORTR(a);
    ll sum = 0;
    for(int i=0;i<n;i++){
        sum += a[i*2+1];
    }
    cout << sum << endl;
    return 0;
}


Measured memory_bytes: 2560
//#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("Ofast,unroll-loops,no-stack-protector,fast-math")
///#pragma GCC target("avx2")
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <fstream>
#include <cmath>
#include <deque>
#include <list>
#include <stack>
#include <queue>
#include <iomanip>
#include <cassert>
#include <functional>
#include <ctime>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <climits>
#include <numeric>

using namespace std;
#define open_streams ifstream fin("olympiad.in");ofstream fout("olympiad.out")
#define close_streams fin.close();fout.close()
#define speed cout.tie(0);cin.tie(0);ios_base::sync_with_stdio(0)
#define ll long long
#define ull unsigned long long
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define mp(a,b) make_pair(a,b)
#define pb push_back
#define UNIQ(a) a.resize(unique(all(a)) - a.begin())
#define eps 1e-6
const double PI = M_PI;
const int INF = INT_MAX;
const ll limit = 1LL * 4e18;
const int MOD = 1e9 + 711;
const int MOD2 = 1e9 + 933;
//---------------------------------------------------------------------------
const int mod = 1e9 + 7;
const int maxn = 2e5 + 100;





signed main() {
    speed;
   int n,m;
   cin >> n >> m;
   int sum  =0;
   for(int i = 0; i < m;++i) {
       int x;
       cin >> x;
       sum += x;
   }
    cout << max(n-sum,-1);
    return 0;
}


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

int main(){
    int n,k;
    cin>>n>>k;
    vector<int> s(n,0);
    for(int i=0; i<k; i++){
        int d;
        cin>>d;
        for(int j=0; j<d; j++){
            int tmp;
            cin>>tmp;
            s.at(tmp-1)++;
        }
    }
    int count = 0;
    for(int i=0; i<n; i++){
        if(s.at(i) == 0){
            count++;
        }
    }
    cout<<count<<endl;
    return 0;
}

Measured memory_bytes: 3612
#include<algorithm>
#include<bitset>
#include<cmath>
#include<complex>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<iterator>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>

using namespace std;
typedef long long ll;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define ALL(x) (x).begin(),(x).end()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define D()
#define INF 1000000000000
#define MOD 10000007
#define MAXR 100000
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define INITA(a,i,j,v) for(ll k=i;k<=j;k++){a[k]=v;}

int main() {
    int x;
    cin >> x;
    vector<int> v = {1};
    FOR(i, 2, 32) {
        FOR(j, 2, 10) {
            int tmp = pow(i, j);
            if (tmp > 1000) {
                break;
            } else {
                v.push_back(tmp);
            }
        }
    }
    sort(v.begin(), v.end(), greater<int>());
    REP(i, v.size()) {
        if (v[i] <= x) {
            cout << v[i] << endl;
            return 0;
        }
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef pair<int,int> pii;
typedef tree<ll, null_type, less_equal<ll>, rb_tree_tag,  //less_equal
             tree_order_statistics_node_update> oset; 
const int MAXN = 1e5 + 5;
const int MOD = 1e9 + 7;
const int MAXK = 2e3 + 2;
#define sz(x) (int)(x).size()
#define f first




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

int n;
string s;
cin >> n >> s;
if(n >= 3200)
	  cout << s;
else
	 cout << "red";

}


Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<vector>
#include<set>
using namespace std;

int main(void) {
	int N, M;
	scanf("%d %d", &N, &M);
	int p[100001];
	string s[100001];
	set<int> ac;
	for (int i = 0; i < M; i++) {
		cin >> p[i] >> s[i];
		if (s[i] == "AC") ac.insert(p[i]);
	}

	set<int> correct;
	int ans = 0;
	int pena = 0;
	for (int i = 0; i < M; i++) {
		if (s[i] == "AC") {
			if (correct.find(p[i]) == correct.end()) {
				correct.insert(p[i]);
				ans++;
			}
		} else {
			if (correct.find(p[i]) == correct.end() && ac.find(p[i]) != ac.end()) {
				pena++;
			}
		}
	}
	printf("%d %d\n", ans, pena);

	return 0;
}


Measured memory_bytes: 16508
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>

#define llong long long
#define fr(i,l,r) for(i=(l);i<(r);i++)
#define min(p,q) ((p)<(q)?(p):(q))
#define max(p,q) ((p)>(q)?(p):(q))


int main(void)
{
	//変数の宣言
	int n;
	llong m=0;
	llong a[50];
	llong b[50];
	
	//よく使う変数
	int i,j,k,l;
	int flag=0;
	int ans=0;
	int count=0;
	int temp,temp1,temp2;
	llong int max,min;
	int len;
	llong int sum=0;
	//データの読み込み
	
	scanf("%d",&n);
	
	for(i=0;i<n;i++){
		scanf("%lld",&a[i]);
	}
	
	
	
//	printf("nは%dです\n", n);
//	printf("データの読み込み終了\n");
	//実際の処理
	
	for(i=0;i<n;i++){
		if(i==0)min=a[0];
		min = min(min,a[i]);
	}
	
//	printf("min=%d\n",min);
	
	for(i=0;i<n;i++){
		b[i]=(a[i]-min)/(n+1);
		m=m+b[i];
//		printf("b[%d]=%d\n",i,b[i]);
	}
	
	for(i=0;i<n;i++){
//		printf("a[i]=%lld,b[i]=%lld,n=%d,m=%lld,ans=%lld\n",a[i],b[i],n,m,a[i]-b[i]*n+(m-b[i]));
		a[i]=a[i]-b[i]*n+(m-b[i]);
	}
	
/*	for(i=0;i<n;i++){
		printf("%lld ",a[i]);
	}
	printf("\n");
	
	for(i=0;i<n;i++){
		printf("%lld ",b[i]);
	}
*/	
	for(i=0;i<n;i++){
		if(i==0) max=a[0];
		max=max(max,a[i]);
	}
	
	if(max>n+50){
		for(i=0;i<n;i++){
			a[i]=a[i]-(max-n-50);
		}
		m=m+(max-n-50)*n;
	}
	
	flag=1;
	while(flag==1){
		count++;
	//	printf("count=%d ",count);
	//	for(i=0;i<n;i++){
	//		printf("%lld ",a[i]);
	//	}
	//	printf("\n");

		flag=0;
		for(i=0;i<n;i++){
			if(flag==0&&a[i]>=n){
				a[i]=a[i]-n-1;
				flag=1;
			}
		}
		if(flag==1){
			for(i=0;i<n;i++){
				a[i]++;
			}
			m++;
		}
	}
	
//	printf("計算部分終了\n");
	//出力
	
	printf("%lld",m);
	
//	printf("結果の出力終了\n");
	
	return 0;
	
}



Measured memory_bytes: 128
N=int(input())
h=list(map(int,input().split()))

dp=[0,abs(h[0]-h[1])]

for i in range(2,N):
    dp.append(min(dp[i-2]+abs(h[i]-h[i-2]),dp[i-1]+abs(h[i]-h[i-1])))
print(dp[-1])

Measured memory_bytes: 13980
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();
		if(a == 1){
			a =14;
		}
		if(b == 1){
			b =14;
		}
		if(a == b ){
			System.out.println("Draw");
		}else if(a>b){
			System.out.println("Alice");
		}else{
			System.out.println("Bob");
		}
		sc.close();
	}
}

Measured memory_bytes: 21972
#include<stdio.h>

//search greatest common divisor
int gcd(int,int);

int main(){
  int x, y;


  //input data
  scanf("%d %d",&x,&y);
  

  //print
  if(x>y) printf("%d\n",gcd(x,y));
  else printf("%d\n",gcd(y,x));
  
  return 0;
}

//search greatest common divisor
int gcd(int x,int y){
  int r;
  
  r=x%y;
  x=y;
  y=r;
  
  if(y==0) return x;
  else return gcd(x,y);
}



Measured memory_bytes: 2104
#include <bits/stdc++.h>
#pragma GCC optimize(2)
using namespace std;

typedef unsigned long long ull;

string s;

inline ull in()
{
	ull ret = 0, w = 0;
	char ch;
	while (!isdigit(ch))
	{
		w |= (ch == '-');
		ch = getchar();
	}
	while (isdigit(ch))
	{
		ret = (ret << 3) + (ret << 1) + (ch ^ 48);
		ch = getchar();
	}
	return w ? -ret : ret;
}

inline void out(ull x)
{
	if (x < 0)
	{
		putchar('-');
		x = -x;
	}
	if (x > 9)
		out(x / 10);
	putchar(x % 10 + 48);
}

int main()
{

  ios::sync_with_stdio(false);
  cin.tie(NULL); cout.tie(NULL);

  //freopen(".in", "r", stdin);
  //freopen(".out", "w", stdout);
  
  cin >> s;
  string last = "~Author:BJQ~", now = "";
  int len = s.length(), res = 0;
  for (int i = 0; i < len; i++)
  {
  	now += s[i];
  	if (now == last) continue;
  	res++;
  	last = now;
  	now = "";
	}
	cout << res << endl;
  
  return 0;
  
}


Measured memory_bytes: 720
#include<bits/stdc++.h>
#define llt long long  int
#define ullt unsigned long long int
using namespace std;
void fast(){
        ios_base::sync_with_stdio(false);
        cin.tie(0);
        cout.tie(0);
    }
int main()
{
    fast();
    llt n,m;
    cin>>n>>m;
    if(n==m)
    cout<<"Yes"<<"\n";
    else
    cout<<"No"<<"\n";
}

Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<algorithm>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<set>
#include<map>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())

const ll MAX = 510000;
const ll MOD = 1000000007;


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


int main(){
  ll N;cin>>N;
  vector<ll> a(N);
  rep(i,N) cin>>a[i];


  vector<ll> right(N+2);
  vector<ll> left(N+2);

  left[0] = a[0];
  right[N-2] = a[N-1];

  repn(i,N){
    left[i] = gcd(left[i-1], a[i]);
  }
  for(ll i = N-3; i >= 0; i--){
    right[i] = gcd(right[i+1], a[i+1]);
  }


  ll ans = 1;
  ans = max(left[N-2], right[0]);

  rep(i,N){
    ans = max(ans, gcd(left[i], right[i+1]));
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 2560
#include <stdio.h>
#include <stdlib.h>

int main(int argc, char **argv)
{
    int n;
    scanf("%d", &n);

    int base = 0;
    int *t = (int *) calloc(n, sizeof(int));
    for (int i = 0; i < n; ++i) {
        scanf("%d", &t[i]);
        base += t[i];
    }

    int m;
    scanf("%d", &m);

    for (int i = 0; i < m; ++i) {
        int p, x;
        scanf("%d %d", &p, &x);
        printf("%d\n", (base - t[p-1] + x));
    }
    return 0;
}

Measured memory_bytes: 128
package main

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

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Scan()
	n, _ := strconv.Atoi(sc.Text())
	sc.Scan()
	s := sc.Text()

	for _, c := range s {
		fmt.Print(string(rot(c, n)))
	}
	fmt.Println()
}

func rot(r rune, n int) rune {
	return 'A' + (r-'A'+int32(n))%26
}


Measured memory_bytes: 896
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace ABC_practice
{
    public class Program
    {

        #region templete

        private static void WL(string s) { WriteLine(s); }

        /// <summary>
        /// 最小公倍数
        /// </summary>
        /// <param name="a"></param>
        /// <param name="b"></param>
        /// <returns></returns>
        static long Gcd(long a, long b)
        {
            var v = new[] { a, b };
            while (v[1] != 0) { v = new[] { v[1], v[0] % v[1] }; }
            return v[0];
        }
        /// <summary>
        /// 最小公約数
        /// </summary>
        /// <param name="a"></param>
        /// <param name="b"></param>
        /// <returns></returns>
        static long Lcm(long a, long b)
        {
            return a / Gcd(a, b) * b;
        }

        public static void Main(string[] args)
        {
            new Program().Solve();
            ReadLine();
        }

        #endregion

        public void Solve()
        {
            var cin = new Scanner();
            var n = cin.nextInt();
            var k = cin.nextInt();
            var x = cin.ArrayInt(n);
            var ans = 0;
            for (int i = 0; i < n; i++)
            {
                ans += 2 * Min(Abs(x[i]), Abs(x[i] - k));
            }

            WL($"{ans}");
        }

    }
}


#region console in

class Scanner
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

    public string next()
    {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int nextInt()
    {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0)
    {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong()
    {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0)
    {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble()
    {
        return double.Parse(next());
    }


    public double[] ArrayDouble(int N, double add = 0)
    {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}

#endregion

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

int main() {
  int N,M;
  cin >> N >> M;
  vector<int> city(60);
  int a,b;
  for(int i=0;i<M;i++) {
    cin >> a >> b;
    city.at(a-1)++;
    city.at(b-1)++;
  }
  for(int i=0;i<N;i++) cout << city.at(i) << endl;
}

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

int main() {
    long long N, A, B, C, D, E;
    cin >> N >> A >> B >> C >> D >> E;

    long long mini = min({A, B, C, D, E});
    cout << 5 + (N - 1) / mini << endl;
    return 0;
}

Measured memory_bytes: 256