akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
	Scanner scan = new Scanner(System.in);
	int W = scan.nextInt();
	int a =scan.nextInt();
	int b = scan.nextInt();
	
	if(a+W<b){
		System.out.println((b-a-W));
	}else if (b+W<a){
		System.out.println((a-b-W));
	}else{
		System.out.println(0);
	}
 }
}

Measured memory_bytes: 21844
import java.io.*;
 
class Main{
    public static void main(String[] args) throws IOException{
     
        int x,y,z,temp;
 
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String str[] = br.readLine().split(" ");
        x = Integer.parseInt(str[0]);
        y = Integer.parseInt(str[1]);
	z = Integer.parseInt(str[2]);

	for(int i=0; i<3; i++){
		if(z<y){
			temp=y;
			y=z;
			z=temp;
		}else if(y<x){
			temp=x;
			x=y;
			y=temp;
		}
	}

	System.out.println(x + " " + y + " " + z);
    }
}

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

#define gif(a,b) ((a)/(b)+((a)%(b)?1:0))
#define float long double
#define int long long 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define w(x) cout<<(#x)<<" is "<<(x)<<"\n";
using namespace std;

int32_t main()
{ 
    IOS
    int T; 
    T=1; 
    for (int t = 0; t < T; ++t)
    {
        int a[5];
        for(int i =0; i <5 ;++i)
        {
        cin >> a[i];
        if(a[i] == 0)
        	{
        		cout << i+1 << endl;
        		return 0;
        	}
        }
    }

    return 0;
}


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

typedef long long ll;

using namespace std;

int n;
int G[10010][10010];
int minlen[10010];
bool vis[10010];


void dijkstra(int p){
	memset(minlen,-1,sizeof(minlen));
	memset(vis,0,sizeof(0));
	
	minlen[p] = 0;
	
	while (1){
		int minp = -1;
		int minn = 1<<30;
	
		for(int i = 0 ; i<n ; i++){
			if(!vis[i] && minlen[i]!=-1 && minn>minlen[i]){
				minp = i;
				minn = minlen[i];
			}
		}
		if(minp == -1) break;
		
		vis[minp] = 1;
		for(int j = 0 ; j<n ; j++){
			if(!vis[j] && G[minp][j]!=1<<30){
				if(minlen[j] == -1){
					minlen[j] = minlen[minp]+G[minp][j];
				}
				else if( minlen[j] > minlen[minp]+G[minp][j]){
					minlen[j] = minlen[minp]+G[minp][j];
				}
			}
		}
	}
}

int main(){
	ios::sync_with_stdio(false);
	cin>>n;
	for(int i = 0 ; i<n ; i++)
		for(int j = 0 ; j<n ; j++)
			G[i][j] = 1<<30;
	
	for(int t = 0 ; t<n ; t++){
		int u,k;
		cin>>u>>k;
		for(int i = 0 ; i<k ; i++){
			int to,weight;
			cin>>to>>weight;
			G[u][to] = weight;
		}
	}

	dijkstra(0);	
	for(int i = 0 ; i<n ; i++){
		cout<<i<<" "<<minlen[i]<<endl;
	}
	return 0;
}




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

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

typedef long long ll;
using Graph = vector<vector<int>>;
typedef long long ll;
typedef pair<int, int> P;

const int MOD = 1000000007;
const int INF_32 = 1LL << 30;
const int64_t INF_64 = 1LL << 60;

struct edge {
    int to, cost;
    edge(int to, int cost)
    {
        this->to = to;
        this->cost = cost;
    }
};

int V;
vector<edge> G[MAX_V];
int d[MAX_V];

void dijkstra(int s)
{
    priority_queue<P, vector<P>, greater<P>> que;
    fill(d, d + V, INF_32);
    d[s] = 0;
    que.push(P(0, s));

    while (!que.empty()) {
        P p = que.top();
        que.pop();
        int v = p.second;
        if (d[v] < p.first)
            continue;
        for (int i = 0; i < G[v].size(); i++) {
            edge e = G[v][i];
            if (d[e.to] > d[v] + e.cost) {
                d[e.to] = d[v] + e.cost;
                que.push(P(d[e.to], e.to));
            }
        }
    }
}

int main()
{
    int n, x, y;
    map<int, int> dis;
    cin >> n >> x >> y;
    x--;
    y--;
    V = n;
    rep(i, n - 1)
    {
        G[i].push_back(edge(i + 1, 1));
        G[i + 1].push_back(edge(i, 1));
    }
    G[x].push_back(edge(y, 1));
    G[y].push_back(edge(x, 1));

    for (int i = 0; i < n; i++) {
        // iがスタート
        dijkstra(i);
        for (int j = 0; j < n; j++) {
            if (j != i) {
                if (!dis.count(d[j]))
                    dis[d[j]] = 1;
                else {
                    dis[d[j]]++;
                }
            }
        }
    }

    for (int i = 1; i < n; i++) {
        cout << dis[i] / 2 << endl;
    }
}

Measured memory_bytes: 512
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <bitset>
#include <utility>
#include <numeric>
#include <iterator>

using namespace std;

using ll = long long;
using ull = unsigned long long;

const ll inf = 1ll << 60;
const ll mod = (ll)1e9 + 7;

#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()

#define print(s) cout << s;
#define println(s) cout << s << endl;
#define printd(s, f) cout << fixed << setprecision(f) << s << endl;


int main()
{
	ll a, b, c;
	cin >> a >> b >> c;

	ll l = 4 * a * b;
	ll r = (c - a - b);

	if (r <= 0)
	{
		println("No");
		return 0;
	}
	println((l < r * r ? "Yes" : "No"));
}

Measured memory_bytes: 256
/***********************************************
#
#      Filename: c.cpp
#
#        Author: Comsyl - ylsong15@fudan.edu.cn
#   Description: ---
#        Create: 2017-05-19 23:53:20
***********************************************/
#include <bits/stdc++.h>
#define ll long long
using namespace std;
ll n;
int m, q;
bool vis[100000 + 10];
bool bao[1000000 + 10][7];
bool used[1000000 + 10][7];

void paint(int base, int mm) {
    for (int i = 0; i < mm; ++ i) {
        if (vis[i % m]) {
            int r = i / 7;
            int c = i % 7;
            bao[r + base][c] = true;
        }
    }
}

int dir[4][2] = {{-1,0}, {0,1}, {1,0}, {0,-1}};
void dfs(int x, int y, int rmax) {
    used[x][y] = true;
    for (int i = 0; i < 4; ++ i) {
        int nx = x + dir[i][0];
        int ny = y + dir[i][1];
        if (nx>=0 && nx<rmax && ny>=0 && ny<7 && !used[nx][ny] && !bao[nx][ny]) {
            dfs(nx, ny, rmax);
        }
    }
}

int main()
{
    cin >> n >> m >> q;
    int r;
    for (int i = 0; i < q; ++ i) {
        cin >> r;
        vis[r] = true;
    }

    int mm = m;
    if (m % 7) mm *= 7;

    paint(0, mm);
    int count1 = 0;
    for (int i = 0; i < mm/7; ++ i) {
        for (int j = 0; j < 7; ++ j) {
            if (!bao[i][j] && !used[i][j]) {
                dfs(i, j, mm/7);
                ++ count1;
            }
        }
    }

    paint(mm/7, mm);
    int count2 = 0;
    memset(used, false, sizeof(used));
    for (int i = 0; i < 2*mm/7; ++ i) {
        for (int j = 0; j < 7; ++ j) {
            if (!bao[i][j] && !used[i][j]) {
                dfs(i, j, 2*mm/7);
                ++ count2;
            }
        }
    }

    cout << count1 * 1L + (count2 - count1) * 1L * (n / (mm/7) - 1L) << endl;
    return 0;
}


Measured memory_bytes: 21888
#include <iostream>

int main(){
    
    int S;
    std::cin >> S;
    
    int h = (S / 3600);
    S %= 3600;
    int m = (S / 60);
    S %= 60;
    int s = S;
    
    std::cout << h << ":" << m << ":" << s << std::endl;
    
    return 0;
}


Measured memory_bytes: 3092
#include <iostream>

int main(int argc, char const *argv[])
{
	int n,m;
	std::cin >> n >> m;

	int **matrix;
	matrix = new int*[n];
	for(int i = 0 ; i < n ; i ++){
		matrix[i] = new int[m];
	}
	for(int i = 0 ; i < n ; i ++){
		for(int j = 0 ; j < m ; j ++){
			std::cin >> matrix[i][j];
		}
	}

	int *vec = new int[m];
	for(int i = 0 ; i < m ; i ++){
		std::cin >> vec[i];
	}

	int *ans = new int[n];
	for(int i = 0 ; i < n ; i ++){
		ans[i]= 0;
		for(int j = 0 ; j < m ; j ++){
			ans[i] += matrix[i][j]*vec[j];
		}
		std::cout << ans[i] << std::endl;
	}
	return 0;
}

Measured memory_bytes: 1228
import java.util.*;
class Main{
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int k[]=new int[n+1];
    for(int i=1;i<n;i++){
    	k[sc.nextInt()]++;
    }
    for(int i=1;i<=n;i++){
    	pl(k[i]+"");
    }
  }

  public static void pr(String str){
    System.out.print(str);
  }
  public static void pl(String str){
    System.out.println(str);
  }
}


Measured memory_bytes: 69936
#include <iostream>

class Dice {
public:
    int num[6];
    void move (char cmd) {
        if (cmd == 'N') north();
        if (cmd == 'S') south();
        if (cmd == 'E') east();
        if (cmd == 'W') west();
        if (cmd == 'R') right();
        if (cmd == 'L') left();
    }
    void north () {
        std::swap(num[0], num[1]);
        std::swap(num[1], num[5]);
        std::swap(num[5], num[4]);
    }
    void south () {
        std::swap(num[0], num[4]);
        std::swap(num[4], num[5]);
        std::swap(num[5], num[1]);
    }
    void east () {
        std::swap(num[0], num[3]);
        std::swap(num[3], num[5]);
        std::swap(num[5], num[2]);
    }
    void west () {
        std::swap(num[0], num[2]);
        std::swap(num[2], num[5]);
        std::swap(num[5], num[3]);
    }
    void right () {
        move('W'); move('S'); move('E');
    }
    void left () {
        move('E'); move('S'); move('W');
    }
    bool operator == (Dice _dice) {
        int count = 0;
        for (int i=0;i<6;++i)
            if (this->num[i] != _dice.num[i])
                count++;
        if (count == 0) return true;
        else return false;
    }
};

int main() {
    int n;
    std::cin >> n;
    Dice d[100];
    for (int i=0;i<n;++i)
        for (int j=0;j<6;++j)
            std::cin >> d[i].num[j];
    std::string cmd_gorogoro = "NNNNEEEE";
    std::string cmd_rotate = "RRRR";
    for (int i=0;i<n;++i)
        for (int j=0;j<i;++j) {
            for (int k=0;k<(int)cmd_gorogoro.size();++k) {
                for (int l=0;l<(int)cmd_rotate.size();++l) {
                    if (d[i] == d[j]) {
                        std::cout << "No" << std::endl;
                        return 0;
                    }
                    else d[i].move(cmd_rotate[l]);
                }
                d[i].move(cmd_gorogoro[k]);
            }
        }
    std::cout << "Yes" << std::endl;
    
    return 0;
}


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

int main(void){
    int A, B;
    string ans;
    scanf("%d %d",&A, &B);
    // implements
    if(A <= 8 && B <= 8){
        ans = "Yay!";
    }
    else{
        ans = ":(";
    }
    // output
    printf("%s\n", ans.c_str());
}

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

int main(){

  int n, m, a[100000], ans=0;

  cin>>n>>m;
  for(int i=0;i<m;i++) cin>>a[i];

  for(int i=1;i<m;i++) ans=max(ans, (a[i]-a[i-1])/2);

  ans=max(ans, a[0]-1);
  ans=max(ans, n-a[m-1]);

  cout<<ans<<endl;

  return 0;
}

Measured memory_bytes: 3172
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,b,a) for(int i=b;i>=a;i--)
#define fori(a) for(auto i : a )
#define all(a) begin(a), end(a)
#define set(a,b) memset(a,b,sizeof(a))
#define sz(a) a.size()
#define pi 3.14159
#define ll long long
#define ull unsigned long long
#define pb push_back
#define PF push_front //deque
#define mp make_pair
#define pq priority_queue
#define mod 1000000007
#define f first
#define s second
#define pii pair< int, int >
#define vi vector<int>
#define vpii vector<pii>
#define debug(v) for(auto i:v) cout<<i<<" ";
#define tc int t; cin >> t; while(t--)

using namespace std;
string repeat(string s, int n) {
    string s1 = "";
    for (int i=0; i<n;i++)
        s1+=s;
    return s1;
}
string getString(char x) {
    string s(1, x);
    return s;
}

void optimizeIO(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}
int gcd(int a, int b){
    if (a == 0)  return b;
    return gcd(b % a, a);
}

void solve(){
  ll n;
  cin>>n;
  vector<ll> v1(n),v2(n);
  rep(i,0,n) cin>>v1[i]>>v2[i];
  sort(all(v1));
  sort(all(v2));
  if(n%2) cout<<v2[n/2]-v1[n/2]+1LL<<endl;
  else{
    double x = (v1[n/2LL]+v1[(n)/2LL-1]), zy= (v2[n/2]+v2[(n)/2LL-1]);
    ll z=(zy-x)+1;
    cout<<z<<endl;
  }
}
int main(){
    optimizeIO();
    // tc
    {
      solve();
    }
}


Measured memory_bytes: 6364
// while( !(succeed == try()) );

#include "bits/stdc++.h"
using namespace std;

// Alpha // Alpha // Alpha // Alpha // Alpha // Alpha // Alpha // Alpha // Alpha // Alpha


#define int long long int
#define loop(i,s,e) for(int i=s; i<e; i++)
#define endl '\n'
#define vii vector<int>
#define pii pair<int, int>
#define ff first
#define ss second
#define N 100001
#define pb push_back
#define INF LLONG_MAX
#define inf INT_MAX

void INP();

#define bug(...)        __f (#__VA_ARGS__, __VA_ARGS__)
#define rtn                                       if(0)return;
template <typename Arg1>
void __f (const char* name, Arg1&& arg1) { rtn cout << name << " : " << arg1 << endl; }
template <typename Arg1, typename... Args>
void __f (const char* names, Arg1&& arg1, Args&&... args)
{     rtn 
     const char* comma = strchr (names + 1, ',');
     cout.write (names, comma - names) << " : " << arg1 << " | "; __f (comma + 1, args...);
}

// Alpha // Alpha // Alpha // Alpha // Alpha // Alpha // Alpha // Alpha // Alpha // Alpha


void alpha()
{	
	int k, a, b;
	cin>>k>>a>>b;

	loop(i,a, b+1)
	{
		if(i%k==0)
		{
			cout<<"OK"<<endl;
			return;
		}
	}

	cout<<"NG"<<endl;
}

int32_t main(){

	ios_base:: sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	// INP();
    int t=1;
	//cin>>t;

  	while(t--) alpha();

	return 0;

}






















inline void INP()
{
      #ifndef ONLINE_JUDGE
          freopen("input.txt",  "r",  stdin);
          freopen("output.txt", "w", stdout);
      #endif
}
 
 

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

public class Main
{
	PrintWriter out = new PrintWriter(System.out);
	BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    StringTokenizer tok = new StringTokenizer("");
    String next() throws IOException {
        if (!tok.hasMoreTokens()) { tok = new StringTokenizer(in.readLine()); }
        return tok.nextToken();
    }
    int ni() throws IOException { return Integer.parseInt(next()); }
    long nl() throws IOException { return Long.parseLong(next()); }
  
    static long m=998244353;
  
    void solve() throws IOException {
        int n=ni();
        int[]A=new int[n];
        long[]B=new long[n];
        A[0]=ni();
        A[1]=ni();
        B[1]=Math.abs(A[0]-A[1]);
        for (int x=2;x<n;x++) {
            A[x]=ni();
            B[x]=Math.min(B[x-2]+Math.abs(A[x]-A[x-2]), B[x-1]+Math.abs(A[x]-A[x-1]));
        }
        System.out.println(B[n-1]);
    }
    
    public static void main(String[] args) throws IOException {
        new Main().solve();
    }
}

Measured memory_bytes: 33620
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import array
from bisect import *
from collections import *
import fractions
import heapq 
from itertools import *
import math
import random
import re
import string
import sys

N, Y = map(int, input().split())
Y2 = Y // 1000

for a in range(2001):
    for b in range(2001 - a):
        if 9 * a + 4 * b + N == Y2 and a + b <= N:
            print(a, b, N - a - b)
            sys.exit(0)
print(-1, -1, -1)


Measured memory_bytes: 7880
n = int(input())
s = list(input())

b_sum = []
w_sum = []
b_num = 0
w_num = 0

#b_sum:i番目まで黒が何個か
#w_sum:i番目まで白が何個か

for i in range(n):
    if s[i] == "#":
        b_num = b_num + 1
    else:
        w_num = w_num + 1
    b_sum.append(b_num)
    w_sum.append(w_num)

#i番目まで白になるときは何個ひっくり返す？

ans = []

for i in range(n):
    ans.append(b_sum[i] + w_sum[n - 1] - w_sum[i])
ans.append(w_sum[n - 1])

print(min(ans))

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

int main()
{
    int h, w;
    while(1)
    {
        cin >> h >> w;
        if(h == 0 && w == 0) break;
        for(int i=0;i<h;i++)
        {
            for(int j=0;j<w;j++)
            {
                if((i + j) % 2 == 0)
                {
                    cout << '#';
                } else {
                    cout << '.';
                }
            }
            cout << endl;
        }
        cout << endl;
    }
    return 0;
}


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

char a[]="0123456789";
int main(){
int a,b,c;
int x=0;
int i;
int k=0;
scanf("%d%d%d",&a,&b,&c);
for(i=0;i<1000;i++){
	x=i*a;
	if(x%b==c){
		
		
		k++;
		
	}
	
	
	
	
	
	
	
}
if(k>0){
	
	printf("YES\n");
	
}else{
	printf("NO\n");
	
}

	return 0;
}

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

int N,n;

int main()
{
    scanf("%d",&N);
    n = N;
    int sum = 0;
    while(n)
    {
        sum += n % 10;
        n /= 10;
    }
    if(N % sum)printf("No\n");
    else printf("Yes\n");
    return 0;
}


Measured memory_bytes: 256
# import itertools
# import math
# import sys
# sys.setrecursionlimit(500*500)
# import numpy as np

N = int(input())
# S = input()
# n, *a = map(int, open(0))
# N, M = map(int, input().split())
A = list(map(int, input().split()))
# B = list(map(int, input().split()))
# tree = [[] for _ in range(N + 1)]
# B_C = [list(map(int,input().split())) for _ in range(M)]
# S = input()

# B_C = sorted(B_C, reverse=True, key=lambda x:x[1])
# all_cases = list(itertools.permutations(P))
# a = list(itertools.combinations_with_replacement(range(1, M + 1), N))
# itertools.product((0,1), repeat=n)

# A = np.array(A)
# cum_A = np.cumsum(A)
# cum_A = np.insert(cum_A, 0, 0)

# def dfs(tree, s):
#     for l in tree[s]:
#         if depth[l[0]] == -1:
#             depth[l[0]] = depth[s] + l[1]
#             dfs(tree, l[0])
# dfs(tree, 1)

def nC2(n):
    return n*(n-1)//2

cnt = [0] * (N + 1)

for i in A:
    cnt[i] += 1

tot = 0
for i in cnt:
    if i > 1:
        tot += nC2(i)

for i in A:
    j = cnt[i]
    if j < 2:
        print(tot)
    else:
        print(tot - (j - 1))

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

int main(){
    long long n;
    cin>>n;
    
    string ans="";
    while(n>0){
        n--;
        char c = 'a'+n%26;        
        ans.push_back(c);
        n = n/26;
    }    
    reverse(ans.begin(),ans.end());
    cout<<ans;
}

Measured memory_bytes: 3444
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define all(c) c.begin(), c.end()
#define FAST ios_base::sync_with_stdio(false) , cin.tie(NULL);
#define pii pair<int,int>
#define pb push_back
#define F first
#define S second
#define endl "\n"
#define bitcnt(n) __builtin_popcountll(n)
#define setpre(n) cout << fixed << setprecision(n)
#define tr(c) for(const auto& x : c )cout << x << " "; cout << "\n";
#define PI acos(-1LL)


#ifdef LOCAL
string to_string(const string& s){
    return '"' + s + '"';
}
string to_string(const char* s) {
    return to_string((string) s);
}
string to_string(bool b) {
    return (b ? "true" : "false");
}
template <typename A, typename B>
string to_string(pair<A, B> p) {
    return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
template <typename T>
string to_string(T v){
    bool first = true;
    string res = "{";
    for(const auto& x: v){
        if(!first) res+=", ";
        first = false;
        res+=to_string(x);
    }
    res+="}";
    return res;
}
void bug() { cerr << endl; }
template<typename Head, typename... Tail>
void bug(Head H, Tail... T) {
    cerr << " " << to_string(H);
    bug(T...);
}
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", bug(__VA_ARGS__);
#else
#define debug(...) 11;
#endif


const int M = 1000000007;
const int N = 2e6 + 5;
const long long INF = 2e17 + 12;

int minPrime[N + 1];
set<int> fact;
void leastPrimeFactor()
{
    for (int i = 2; i * i <= N; ++i)
    {
        if (minPrime[i] == 0)
        { //If i is prime
            for (int j = i * i; j <= N; j += i)
            {
                if (minPrime[j] == 0)
                {
                    minPrime[j] = i;
                }
            }
        }
    }
    for (int i = 2; i <= N; ++i)
    {
        if (minPrime[i] == 0)
        {
            minPrime[i] = i;
        }
    }
}

//**** ALL PRIME FACTORS
//**** IT IS IN O(LOG N)
bool getPrimeFactorization(int x)
{
    set<int> ff;
    while (x != 1)
    {
        ff.insert(minPrime[x]);
        x = x / minPrime[x];
    }
    for(auto i: ff){
        if(fact.find(i)!=fact.end()){
            return false;
        }
        fact.insert(i);
    }
    return true;
}

void solve(){
    int n;
    cin >> n;
    int a[n];
    int total_gc = 0;
    for(int i=0; i<n; i++){
        cin >> a[i];
        total_gc = __gcd(a[i], total_gc);
    }
    if(total_gc > 1){
        cout << "not coprime\n";
        return;
    }
    leastPrimeFactor();
    fact.clear();
    for(int i=0; i<n; i++){
        if(!getPrimeFactorization(a[i])){
            cout << "setwise coprime\n";
            return;
        }
    }
    cout << "pairwise coprime\n";
}

signed main(){
    FAST
#ifdef TIMER
    clock_t start;
    double duration;
    start = clock();
#endif
    int tc = 1;
//    TODO: check for tc
//    cin >> tc;
    for (int t = 1; t <= tc; t++) {
        solve();
    }
#ifdef TIMER
    duration = (clock() - start) / (double) CLOCKS_PER_SEC;
    cerr <<"\n\nTotal time elapsed: "<< duration <<"sec\n";
#endif
}


Measured memory_bytes: 27092
#include <iostream>
#define ll long long int
#include<bits/stdc++.h>
#include<cmath>
#define MOD 1000000009
using namespace std;
int main()
{
ll n;
cin>>n;
char xa[26];
xa[0]='z';
ll c=0;
for(char x='a';x<='z';x++)
xa[c++]=x;
string s="";
while(n>0)
{	
	ll d=n%26;
	if(d==0){
	s='z'+s;n=n/26;n-=1;}
	else{
	s=xa[d-1]+s;
	n=n/26;}

}
cout<<s<<endl;
return 0;
}


Measured memory_bytes: 3512
n, k, q = gets.to_s.split.map{|t| t.to_i }

seikai_su = [k-q] * n

q.times do
  a = gets.to_i - 1
  seikai_su[a] += 1
end

puts seikai_su.map!{|t| t > 0 ? "Yes" : "No" }

Measured memory_bytes: 10364
#include <bits/stdc++.h>
#define IO_OP std::ios::sync_with_stdio(0); std::cin.tie(0);
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define EB emplace_back

using namespace std;

typedef long long ll;
typedef pair<int, int> pi;
typedef vector<int> vi;

const int INF = 1e9 + 7;

int main()
{
	IO_OP;
	int a, b;
	cin >> a >> b;
	if((a-b)&1) cout << "IMPOSSIBLE" << endl;
	else cout << (a + b) / 2 << endl;

}



Measured memory_bytes: 256
#include <iostream>

using namespace std;

const int MAX_N = 1000 + 5;
int era_y[MAX_N], wes_y[MAX_N];
string name[MAX_N];

int main()
{
    int N, Q;

    while (cin >> N >> Q, N || Q) {
        for (int i = 0; i < N; i++) 
            cin >> name[i] >> era_y[i] >> wes_y[i];

        for (int i = 0; i < Q; i++) {
            int q;

            cin >> q;
            bool flag = false;
            for (int j = 0; j < N; j++) {
                if (wes_y[j] - era_y[j] + 1 <= q && q <= wes_y[j]) {
                    flag = true;
                    cout << name[j] << " " << q - (wes_y[j] - era_y[j]) << endl;
                    break;
                }
            }

            if (!flag) {
                cout << "Unknown" << endl;
            }
        }
    }

    return 0;
}

Measured memory_bytes: 1304
# coding: utf-8

N = int(input())
mems = [list(map(int, input().split(' '))) for _ in range(N)]
points = [0 for _ in range(N)]

for i in range(3):
    turn = {}
    for j in range(N):
        if mems[j][i] not in turn: turn[mems[j][i]] = 0
        turn[mems[j][i]] += 1

    for j in range(N):
        if turn[mems[j][i]] == 1: points[j] += mems[j][i]

for point in points:
    print(point)



Measured memory_bytes: 5636
#include <bits/stdc++.h>
typedef long long ll;
#define pb push_back
#define mii map <int, int>
#define mll map <ll, ll>
#define pii pair <int, int>
#define pll pair <ll, ll>
#define vi vector <int>
#define vd vector <double>
#define vll vector <ll>
#define fi first
#define se second
#define si set <int>
#define sll set <ll>
#define spii set <pii>
#define vs vector <string>
#define vpii vector <pair <int,int> >
#define vpll vector <pair <long long,long long> >
#define vvi vector <vector <int> >
#define vvpii vector <vector <pii > >
#define forn(i, n) for (int i = 0; i < (n); i++)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define for1(i, n) for (int i = 1; i < (n); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(),(x).rend()


using namespace std;
const ll INFLL = 1e18;
const int MAXN = 1e6+100;
const ll INF = 1e9;
const ll mod1=1e9+7;
const ll mod2=2e9+11;

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
#ifdef LOCAL
    freopen("a.in","r",stdin);
#endif
    string s;
    cin>>s;
    for (int i=0;i<s.size();i++)
        cout<<'x';




}

Measured memory_bytes: 384
N=int(input())
a=list(map(int,input().split()))
x=a[0]
y=sum(a)-a[0]
mi=10**15
for i in range(1,N-1):
    x+=a[i]
    y-=a[i]
    mi=min(mi,abs(x-y))
mi=min(mi,abs(x-y))
print(mi)


Measured memory_bytes: 23800
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<limits.h>
#include<cmath>
#include<queue>
#include<stack>

#include<stdio.h>
#include<stdlib.h>

#define rep(i,n) for(ll i = 0; i < (ll)n; i++)
#define swap(a,b) a^=b;b^=a;a^=b;
#define chmax(a,b) {if(a < b) a = b;}
#define chmin(a,b) {if(a > b) a = b;}

using namespace std;
typedef long long ll;
ll gcd(ll, ll);
vector<bool> to_binary(int);
ll nCr(ll n, ll r);

const ll INF = 1LL << 60;

typedef tuple<ll, ll> mtupl;

bool mycomp(mtupl x, mtupl y) {
	return get<1>(x) < get<1>(y);
}

int vsum(vector<int> v) {
	int res = 0;
	for (auto it = v.begin(); it != v.end(); it++)
		res += *it;
	return res;
}

int vmin(vector<int> v) {
	int min = INT32_MAX;
	for (auto it = v.begin(); it != v.end(); it++)
		min = std::min(min, *it);
	return min;
}

int vmax(vector<int> v) {
	int max = INT32_MIN;
	for (auto it = v.begin(); it != v.end(); it++)
		max = std::max(max, *it);
	return max;
}

ll gcd(ll A, ll B) {
	if (A == 0 || B == 0) return max(A, B);
	int r = A % B;
	while (r != 0) {
		A = B;
		B = r;
		r = A % B;
	}
	return B;
}

vector<ll> prime_factor(int64_t n) {
	//map< ll, ll > ret;
	vector<ll> ret;
	for (ll i = 2; i * i <= n; i++) {
		while (n % i == 0) {
			//ret[i]++;
			ret.push_back(i);
			n /= i;
		}
	}
	if (n != 1)ret.push_back(n);// ret[n] = 1;
	return ret;
}

const int MAX = 1000000;
const int MOD = 1000000007;
ll fac[MAX], finv[MAX], inv[MAX];

void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}
ll COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

struct edge {
	ll to;
	ll cost;
};

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

	string S, T;
	cin >> S >> T;

	ll ans = 0;
	rep(i, 3)
		if (S[i] == T[i]) ans++;

	cout << ans << endl;

ProgramEndPointLabel:;

	//Program End
#ifndef DEBUG
	system("pause");
#endif // !DEBUG


	return 0;
}




Measured memory_bytes: 504
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <cstring>
#include <iomanip>
#include <bitset>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <list>
#include <map>

using namespace std;

int main() {
  string a;
  cin >> a;
  int ans = 0, cnt = 0;
  for (int i = 0; i < a.size(); i++) {
    if (a[i] == 'A' || a[i] == 'G' || a[i] == 'C' || a[i] == 'T') {
      cnt++;
      ans = max(ans, cnt);
    } else cnt = 0;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define MAXN 14
int a[MAXN][MAXN];
int n,m,x,c[MAXN],level[MAXN];
int ans;
bool check()
{
    for(int i=1;i<=m;i++)
    {
        if(level[i]<x)return 0;
    }
    return 1;
}
void dfs(int k,int cost)
{
    if(check())
    ans=min(cost,ans);
    if(k>n)return;
    for(int i=1;i<=m;i++)
    level[i]+=a[k][i];
    dfs(k+1,cost+c[k]);
    for(int i=1;i<=m;i++)
    level[i]-=a[k][i];
    dfs(k+1,cost);
}
int main()
{
    ans=0x3f3f3f3f;
    scanf("%d%d%d",&n,&m,&x);
    for(int i=1;i<=n;i++)
    {
        scanf("%d",&c[i]);
        for(int j=1;j<=m;j++)
        scanf("%d",&a[i][j]);
    }
    dfs(1,0);
    if(ans!=0x3f3f3f3f)
    printf("%d\n",ans);
    else printf("-1\n");
    return 0;
}

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

int main()
{
    int n,a[11],sum=0;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    sort(a,a+n);
    for(int i=0;i<n-1;i++){
        sum+=a[i];
    }
    cout<<sum+(a[n-1]/2);
    return 0;
}


Measured memory_bytes: 3596
#include<bits/stdc++.h>
using namespace std;
 
using ll = long long;
using pll = pair<ll, ll>;
#define all(x) (x).begin(), (x).end()
#define call(x) (x).cbegin(), (x).cend()
#define rall(x) (x).rbegin(), (x).rend()
#define pb push_back
#define sz(x) ((x).size())
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
#define rep(i, a, b) for(ll i = ll(a); i < ll(b); i++)
const double PI = acos(-1);
const int mod = 1e9+7;
const long long INF = (1LL << 60);
const int dx[] = {0,1,0,-1,1,1,-1,-1};
const int dy[] = {1,0,-1,0,1,-1,-1,1};
ll gcd(ll a,ll b){return b ? gcd(b,a%b) : a;}
ll lcm(ll a,ll b){return a / gcd(a,b) * b;}
ll stringcount(string s, char c){return count(s.cbegin(), s.cend(), c);}
bool isInteger(double x){return floor(x) == x;}
ll ceil(ll a, ll b){return ((a)+(b)-1)/b;}
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(a > b){ a=b; return 1; } return 0; }


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

  string s;
  cin >> s;

  ll cntw = 0, cntb = 0;
  ll n = sz(s);
  rep(i, 0, n){
    if(s[i] == s[i+1]) continue;
    else if(s[i] == 'B') cntb++;
    else if(s[i] == 'W') cntw++;
  }
  //cout << cntb << ' ' << cntw << endl;
  
  if(cntw == 0 || cntb == 0) cout << 0 << endl;
  else cout << cntb + cntw - 1 << endl;
  return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <vector>

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

	std::vector<int> A(N), B(N), C(N - 1);
	for(auto &a : A) {
		std::cin >> a;
		a--;
	}
	for(auto &b : B) {
		std::cin >> b;
	}
	for(auto &c : C) {
		std::cin >> c;
	}

	int result = 0;
	int before, index = 0;
	for(int i = 0; i < N; i++) {
		before = index;
		index = A[i];
		result += B[index];
		if(i != 0 && (before + 1) == index) {
			result += C[before];
		}
	}

	std::cout << result << std::endl;

	return 0;
}


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

string N;

int main() {
    cin >> N;

    int two = 0;
    for (int i = 0; i < 4; i++) {
        if (N[i] == '2') two++;
    }

    cout << two << endl;


    return 0;
}


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

int main(){
    int N, M, K;
    cin >> N >> M >> K;
    long long A[N+1], B[M+1];
    int i, j;
    int max_count = 0;
    A[0] = 0;
    for(i=1;i<=N;i++){
        cin >> A[i];
        if(i>0) A[i] += A[i-1];
    }
    B[0] = 0;
    for(i=1;i<=M;i++){
        cin >> B[i];
        if(i>0) B[i] += B[i-1];
    }
    j=M;
    for(i=0;A[i]<=K;i++){
        while((j>0) && (A[i]+B[j]>K)){
            j--;
        }
        max_count = max(max_count, i+j);
    }
    cout << max_count << endl;
}

Measured memory_bytes: 6636
#include <bits/stdc++.h>
using namespace std;
#define int                  long long int
#define ff                   first
#define ss                   second
#define pb                   push_back
#define mp                   make_pair
#define pii                  pair<int,int>
#define vi                   vector<int>
#define mi                   map<int,int>
#define pqb                  priority_queue<int>
#define pqs                  priority_queue<int,vi,greater<int>>
#define setbits(x)           __builtin_popcountll(x)
#define zrobits(x)           __builtin_ctzll(x)
#define mod                  1000000007
#define inf                  1e18
#define precise(x,y)         fixed<<setprecision(y)<<x
#define w(x)                 int x;cin>>x;while(x--)
#define endl                 "\n"
#define no_of_digit(n)       floor(log10(n))+1
#define copyarr(a,b,n)       copy_n(a,n,b)
mt19937                      rng(chrono::steady_clock::now().time_since_epoch().count());

//*******************to check if all number in array are positive*******************
//all_of(arr,arr+n,[](int x){return x>0;})?cout<<"positive":cout<<"some negative";


//*******************to check if any element in array is negative*******************
//any_of(arr,arr+n,[](int x){return x<0;})?cout<<"Any negative":cout<<"All positive";


int32_t main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    //*****************Enter the code here*******************//
    int n;
    cin>>n;
    int ans=no_of_digit(n);
    for(int i=1;i*i<=n;i++){
        if(n%i!=0)
            continue;
        int b=n/i;
        int curr=max(no_of_digit(i),no_of_digit(b));
            ans=curr;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define rep(i, n)	for(int i=0;i<(int)(n);i++)
using namespace std;
using ll=long long;

int main(){
    double l;
    cin>>l;
    double v=pow(l/3.0, 3);
    cout<<fixed<<setprecision(12)<<v<<endl;
}

Measured memory_bytes: 4216
N = input()
digits = len(N)
K = int(input())
dp0 = [[0]*5 for i in range(digits + 1)] 
dp1 = [[0]*5 for i in range(digits + 1)]
dp0[0][0] = 1
for i, n in enumerate(N):
    n = int(n)
    for j in range(4):
        if n == 0:
            dp0[i+1][j] += dp0[i][j]
            dp1[i+1][j] += dp1[i][j]
            dp1[i+1][j+1] += 9 * dp1[i][j]
        else:
            dp0[i+1][j+1] += dp0[i][j]
            dp1[i+1][j] += dp0[i][j] + dp1[i][j]
            dp1[i+1][j+1] += (n - 1) * dp0[i][j] + 9 * dp1[i][j]
print(dp0[digits][K] + dp1[digits][K])     

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define modulo 998244353
#define mod(mod_x) ((((long long)mod_x+modulo))%modulo)
#define Inf 1000000000



int main(){
	
	int N;
	cin>>N;
	
	vector<int> A(N);
	
	for(int i=0;i<N;i++){
		cin>>A[i];
		A[i]-=i+1;
	}
	
	sort(A.begin(),A.end());
	
	long long ans = 0;
	
	for(int i=0;i<N;i++){
		ans += (long long)abs(A[N/2]-A[i]);
	}
	
	cout<<ans<<endl;
	
    return 0;
}


Measured memory_bytes: 1024
from sys  import stdin,stdout

import bisect
import math
def st():
    return list(stdin.readline().strip())

def inp():
    return int(stdin.readline())

def li():
    return list(map(int,stdin.readline().split()))

def mp():
    return map(int,stdin.readline().split())

def pr(n):
    stdout.write(str(n)+"\n")

def soe(limit):
    l=[1]*(limit+1)
    prime=[]
    for i in range(2,limit+1):
        if l[i]:
            for j in range(i*i,limit+1,i):
                l[j]=0

    for i in range(2,limit+1):
        if l[i]:
            prime.append(i)
    return prime

def segsoe(low,high):
    limit=int(high**0.5)+1
    prime=soe(limit)
    n=high-low+1
    l=[0]*(n+1)
    for i in range(len(prime)):
        lowlimit=(low//prime[i])*prime[i]
        if lowlimit<low:
            lowlimit+=prime[i]
        if lowlimit==prime[i]:
            lowlimit+=prime[i]
        for j in range(lowlimit,high+1,prime[i]):
            l[j-low]=1
    for i in range(low,high+1):
        if not l[i-low]:
            if i!=1:
                print(i)

def power(a,n):
    r=1
    while n:
        if n&1:
            r=(r*a)
            n=n-1
        else:
            a=(a*a)
            n=n>>1
    return r
    
def solve():
    n=inp()
    a=math.ceil(n/1000)
    print(1000*a-n)




tc=1

for _ in range(tc):
    solve()
    


Measured memory_bytes: 9312
import java.util.*;

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 * b % 2 == 0)
            System.out.println("No");
        else
            System.out.println("Yes");
    }

}


Measured memory_bytes: 22740
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <ctime>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cassert>
#include <unordered_map>
#include <unordered_set>

using namespace std;

typedef long long lli;
typedef long double ld;
typedef pair<lli, lli > plli;
typedef vector<lli> vlli;
typedef vector<plli > vplli;

#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);
#define lcm(a, b) ((a * b) / gcd(a, b))
#define sqr(x) (x)*(x)
#define all(a) a.begin(),a.end()
#define UN(v) sort(all(v)), v.resize(unique(all(v))-v.begin())

#define endl '\n'

const long long INF = 100000000000000000;
const long long MOD = 1000000007;
const long long MAXN = 100005;
const double PI = acos(-1);

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

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

void solve() {
    int n;
    cin >> n;
    string s, a, b;

    for (int i = 1; i <= n; i++) {
        int x;
        cin >> x;
        a += to_string(x);
    }


    for (int i = 1; i <= n; i++) {
        int x;
        cin >> x;
        b += to_string(x);
    }

    for (int i = 1; i <= n; i++) {
        s += to_string(i);
    }

    vector<string> v;
    do {
        v.push_back(s);
    } while (next_permutation(all(s)));

    cout << abs(lower_bound(all(v), a) - lower_bound(all(v), b)) << endl;

}

int main()
{
    IOS;
    int t = 1;
    //cin >> t;
    for (int i = 1; i <= t; i++) {
        //cout << "Case " << i << ": ";
        solve();
    }
    return 0;
}


Measured memory_bytes: 2424
#include <algorithm>
#include <cmath>
#include <iostream>
#include <vector>

#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(a) (a).begin(), (a).end()

using namespace std;

template <typename T>
bool check(const vector<T>& arr) {
    for (auto v : arr) {
        if (v % 2 == 1 || v == 0) return false;
    }

    return true;
}

template <typename T>
void shift(vector<T>& arr) {
    for (auto& v : arr) v >>= 1;
}

int main() {
    int N;
    cin >> N;
    vector<int> A(N);

    REP(i, N)
    cin >> A[i];

    int n = 0;

    while (check(A)) {
        n++;
        shift(A);
    }

    cout << n << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define sz(x) (int)(x).size()
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef set<int> S;
typedef queue<int> Q;
typedef queue<P> QP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<double> vd;
typedef pair<double,double> PD;
typedef pair<int,P> ed;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
const int MOD = 1000000007;
const double eps = 1e-10;
  
int main() {
  int N;
  cin >> N;
  vi A(N);
  rep(i,N) {
    cin >> A[i];
  }
  vi pos(N+1,0);
  rep(i,N) {
    pos[A[i]]++;
  }
  ll all = 0;
  rep(i,N+1) {
    all += 1ll*pos[i]*(pos[i]-1)/2;
  }
  vl ans(N,all);
  rep(i,N) {
    ans[i] -= 1ll*pos[A[i]]*(pos[A[i]]-1)/2;
    ans[i] += 1ll*(pos[A[i]]-1)*(pos[A[i]]-2)/2;
  }
  rep(i,N) {
    cout << ans[i] << endl;
  }
  return 0;
}

Measured memory_bytes: 5760
#include <bits/stdc++.h>
#define ll long long
#define PB push_back
#define MP make_pair

#define REP(i,n) for(i=0;i<(n);++i)
#define FOR(i,l,h) for(i=(l);i<=(h);++i)
#define FORD(i,h,l) for(i=(h);i>=(l);--i)

#define max(a,b) a>b?a:b
#define min(a,b) a>b?b:a
using namespace std;


vector<vector<int> >gr;
int dp[100005];

int dfs(int s){
    if(dp[s]!=-1)return dp[s];
    int ret = 0;
    for(int i=0;i<gr[s].size();i++){
        ret = max(ret,dfs(gr[s][i])+1);
    }
    return dp[s] = ret;

}
int main(){
    ios_base::sync_with_stdio(false);
  	cin.tie(NULL);
    cout.tie(NULL);
    
    int N,M;
    cin>>N>>M;
    
    gr.assign(N,vector<int>());

    for(int i=0;i<M;i++){
        int a,b;
       cin>>a>>b;a--;b--;//a-- && b-- isliye kyuki index start from 0
       gr[a].push_back(b);
    }
    for(int i=0;i<N;i++) dp[i] = -1;

    int ret = 0;
    for(int i=0;i<N;i++){
        ret = max(ret,dfs(i));
    }
    cout<<ret;
    return 0;
}


Measured memory_bytes: 8192
#include <bits/stdc++.h>
#define int long long
#define ll long long
#define fi first
#define se second
using namespace std;

typedef pair<int,int> ii;
typedef vector<ii> vii;

const ll siz = 1e5 + 10;
const ll SIZ = 1e6 + 10;
const ll mod = 1e9 + 7;
const ll maxx = 2e9;
const ll MAXX = 1e18;
const ll base = 31;

string s;

int32_t main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
//    freopen ("IN_3.INP", "r", stdin);
//    freopen ("OUT_3.OUT", "w", stdout);
    cin >> s;
    cout << ((s[2] == s[3] && s[4] == s[5]) ? "Yes" : "No");
    return 0;
}

Measured memory_bytes: 256
import queue
import math
import copy
"""
N = int(input())
#S = input()
# (N,M) = (int(i) for i in input().split(" "))
# A = [int(i) for i in input().split()]
A = []
for i in range(N):
	A.append(int(input()))

print(A)

"""
(A,B,C) = (int(i) for i in input().split(" "))
print("Yes" if 4*A*B < ((C-A-B)**2) and C > A+B else "No")


Measured memory_bytes: 4080
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

const M : u64 = 1000000007;

fn main() {
    input! {
        n: usize,
        mut c: [u64; n],
    }
    if n == 1 {
        println!("{}", c[0] * 2 % M);
        return;
    }
    c.sort();
    c.reverse();
    let mut f = 1u64;
    for _ in 2..n {
        f = f * 2 % M
    }
    let g = f;
    f = f * 2 % M;
    let mut h = f;
    f = f * 2 % M;
    let mut result = 0u64;
    for i in 0..n {
        result = (result + h * c[i] % M) % M;
        h = (h + g) % M;
    }
    result = result * f % M;
    println!("{}", result);
}


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

using ll = long long;
using namespace std;
const int INFint = 2e9+1;
const ll INFll = 2e18+1;
ll MOD=1e9+7;

int main(){
  int N,M;
  cin>>N>>M;
  int A[1000],B[1000];
  for(int i(0);i<M;i++){
    int a,b;
    cin>>a>>b;

    a--;
    b--;
    A[i] = a;
    B[i] = b;
  }
  int ans(0);
  for(int i(0);i<M;i++){
    vector<int> G[100];
    for(int j(0);j<M;j++){
      if(i != j){
        G[A[j]].push_back(B[j]);
        G[B[j]].push_back(A[j]);
      }
    }
    int cnt(0);
    int pathed[100] = {0};
    queue<int> q;
    q.push(0);
    while(!q.empty()){
      int now = q.front();q.pop();
      for(int i(0);i<int(G[now].size());i++){
        int next = G[now][i];
        if(!pathed[next]){
          q.push(next);
          pathed[next] = 1;
          cnt++;
        }
      }
    }
    //cout << cnt << endl;
    if(cnt != N) ans++;
  }

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




Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <queue>
#include <bitset>     //UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>        //do setprecision
#include <ctime>
#include <complex>
using namespace std;

#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)

#define ST first
#define ND second
#define PB push_back
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double

const double pi = 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342;
const int mod=1000000007;

int main(){
	int n;
	string s;
	char c[2]={'S','W'};
	string ans="";
	cin>>n>>s;
	FOR(a1,0,2){
		FOR(a2,0,2){
			ans="";
			ans+=c[a1];
			ans+=c[a2];
			FOR(i,1,n){
				if(ans[i]=='S'){
					if(s[i]=='o'){
						ans+=ans[i-1];
					}else{
						if(ans[i-1]=='S')ans+=c[1];
						else ans+=c[0];
					}
				}else{
					if(s[i]=='o'){
						if(ans[i-1]=='S')ans+=c[1];
						else ans+=c[0]; 
					}else{
						ans+=ans[i-1];
					}
				}
			}
			if(ans[0]==ans[n]){
				if(ans[0]=='S'&&s[0]=='o'){
					if(ans[n-1]!=ans[1])continue;
				}else if(ans[0]=='S'&&s[0]=='x'){
					if(ans[n-1]==ans[1])continue;
				}else if(ans[0]=='W'&&s[0]=='o'){
					if(ans[n-1]==ans[1])continue;
				}else{
					if(ans[n-1]!=ans[1])continue;
				}
				FOR(i,0,n){
					cout<<ans[i];
				}
				cout<<endl;
				return 0;
			}
		}
	}
	cout<<-1<<endl;

    return 0;
}


Measured memory_bytes: 640