akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <stdlib.h>

int main(){
  int n;
  scanf("%d",&n);
  for(int i=0;i<3;i++){
    if(n%10==7){
      printf("Yes\n");
      return 0;
    }
    n = n/10;
  }

  printf("No\n");
  return 0;

}

Measured memory_bytes: 1648
using System;

namespace ITP1
{
    class Program
    {
        static void Main(string[] args)
        {
            while (true)
            {
                string x = Console.ReadLine();
                if (x == "0") break;
                int sum = 0;
                
                for (int i = 0; i < x.Length; i++)
                {
                    string s = x[i].ToString();
                    sum += int.Parse(s);
                }
                Console.WriteLine(sum);
            }
        }
    }
}

Measured memory_bytes: 9208
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair< ll, ll > Pi;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep2(i,n) for(int i=1;i<=(n);i++)
#define rep3(i,i0,n) for(int i=i0;i<(n);i++)
#define pb push_back
#define mod 1000000007
const ll INF = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
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;}
#define all(x) x.begin(), x.end()
#define mp make_pair
bool compare(Pi a, Pi b) {
    if(a.first != b.first){
        return a.first < b.first;
        
    }else{
        return a.second < b.second;
    }
}


bool In_map(ll y,ll x,ll h,ll w){
    if(y<0 || x<0 || y>=h || x>=w){
        return 0;
    }else{
        return 1;
    }
}
const vector<ll> dx{1,0,-1,0};
const vector<ll> dy{0,1,0,-1};


int main() {
    ll X,A,B;
    cin >>X>>A>>B;
    
    if(A>=B){
        cout<<"delicious"<<endl;
    }else if(A+X>=B){
        cout << "safe" << endl;
    }else{
        cout << "dangerous" << endl;
    }
    


    return 0;
    

}

Measured memory_bytes: 3600
n = int(input())
r = n % 10
if r == 2 or r == 4 or r == 5 or r == 7 or r == 9:
	print("hon")
elif r == 0 or r == 1 or r == 6 or r == 8:
    print("pon")
else:
    print("bon")

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

namespace Atcoder
{
    class Program
    {
        private static string Read() { return Console.ReadLine(); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }

        private static void Yes() { print("Yes"); }
        private static void No() { print("No"); }
        private static void print(object obj) { Console.WriteLine(obj); }

        static void Main(string[] args)
        {
            int a = ReadInt();
            char s,g;
            List<string> list = new List<string>();
            bool yes = true;
            string befo = Read();
            list.Add(befo);
            for(int i = 1; i<a;i++)
            {
                string core = Read();

                
                if(core[0] != befo[befo.Length -1] || list.Contains(core))
                {
                    yes = false;
                    
                }
                list.Add(core);
                befo = core;
            }
            if(yes)
            {
                Yes();
            }
            else
            {
                No();
            }
        }

    }
}

Measured memory_bytes: 13148
#include <iostream>
#include <bitset>
#include <sstream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;

typedef long long ll;

void advance(string &s, int k){
    while(1){
        if(s.size()-1 < k){
            s = s + "1";
            break;
        }

        if(s[k]=='0'){
            s[k] = '1';
            break;
        }
        else{
            s[k] = '0';
            k++;
        }
    }
    return;
}

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

    stringstream ss;
    ss << std::bitset<30>(abs(N));
    string two_base_N = ss.str();

    int head_zero_num = 0;
    for(int i=0;i<two_base_N.size();i++){
        if(two_base_N[i] == '1'){
            break;
        }
        head_zero_num++;
    }
    if(head_zero_num != two_base_N.size()){
        two_base_N.erase(0, head_zero_num);
    }
    else{
        two_base_N.erase(0, head_zero_num-1);
    }

    reverse(two_base_N.begin(), two_base_N.end());

    for(int i=0;i<two_base_N.size();i++){
        if(N>=0){
            if(i%2==1 && two_base_N[i]=='1'){
                advance(two_base_N, i+1);
            }
        }
        else{
            if(i%2==0 && two_base_N[i]=='1'){
                advance(two_base_N, i+1);
            }
        }
    }
    reverse(two_base_N.begin(), two_base_N.end());
    cout << two_base_N << endl;

    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstring>
#include <iostream>
#include <list>
#include <functional>
#include <algorithm>
#include <sstream>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
using namespace std;

int main()
{
	//freopen("in.txt", "r", stdin);
	//freopen("out.txt", "w", stdout);
	double a, b;
	scanf("%lf %lf", &a, &b);
	printf("%d\n", (int)ceil((a-1) / (b-1)));
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
#define ff              first
#define ss              second
#define ll              long long
#define dd              double
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define vll             vector<long long>
#define vdd             vector<double>
#define vpii            vector<pair<int,int>>
#define vpll            vector<pair<long long,long long>>
#define vvi             vector<vector<int>>
#define vvl             vector<vector<long long>>
#define mii             map<int,int>
#define mll             map<long long,long long>
#define umii            unordered_map<int,int>
#define umll            unordered_map<long long,long long>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define rep(i,n)        for(int i=0;i<n;i++)
#define rep2(i,a,b)     for(int i=a;i<b;i++)
#define rev(i,n)        for(int i=n;i>=0;i--)
#define rev2(i,a,b)     for(int i=a;i>=b;i--)
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define inf             9e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define fio             ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl            '\n'
#define all(x)          x.begin(),x.end()
#define d0(x)           cout <<x<<" "
#define d1(x)           cout <<x<<endl
#define d2(x,y)         cout <<x<<" "<<y<<endl
#define d3(x,y,z)       cout <<x<<" "<<y<<" "<<z<<endl
#define d4(x,y,z,w)     cout <<x<<" "<<y<<" "<<z<<" "<<w<<endl
#define read2(x,y)      cin>>x>>y
#define read3(x,y,z)    cin>>x>>y>>z
#define read4(x,y,z,w)  cin>>x>>y>>z>>w
#define read5(x,y,z,w,a)cin>>x>>y>>z>>w>>a
#define sz(a)           (int)a.size()
const ll mod=1e9+7;
const double PI = 3.14159265359;
const ll MOD=998244353;
void i_o()
{
   #ifndef ONLINE_JUDGE
   freopen("input.txt", "r", stdin);
   freopen("output.txt", "w", stdout);
   #endif
}
map<int,vi> ma;
int help(vi& cst,vvi& inc,int n,int m,int x){
   int cs=INT_MAX;
   for(int i=1;i<=(1<<n)-1;i++){
      vi tot(m,0);
      int cost=0;
      for(int j=0;j<n;j++){
         if((1<<j)&i){
            cost+=cst[j];
            for(int k=0;k<m;k++){
               tot[k]+=inc[j][k];
            }

         }
      }
      if(*min_element(all(tot))>=x) cs=min(cs,cost);
   }
   return cs;

}
int main() {

   fio
   i_o();
   int n,m,x;
   cin>>n>>m>>x;
   vi cst(n);
   vvi inc(n,vi(m));
   vi maxi(m,0);
   rep(i,n){
      cin>>cst[i];
      rep(j,m){
         cin>>inc[i][j];
         maxi[j]+=inc[i][j];
      }
   }
   bool b=true;
   rep(i,m){
      if(maxi[i]<x){
         b=false;
         break;
      }
   }
   if(!b){
      d1(-1);
      return 0;
   }
   d1(help(cst,inc,n,m,x));


   return 0;
}



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

int main(){
  int H,W;
  while(cin>>H>>W){
    if(H==0 && W==0){break;}
    REP(h,H){
      if(h%2==0){
        REP(w,W){
          if(w%2==0){printf("#");}
          else{printf(".");}
        }
      }else{
        REP(w,W){
          if(w%2==0){printf(".");}
          else{printf("#");}
        }
      }
      printf("\n");
    }
    printf("\n");
  }
}


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

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));
        }

        public void Solve(ConsoleInput cin)
        {
            var N = cin.ReadInt;
            var mountain = cin.ReadIntArray(N);

            int result = 0;
            for (int i = 0; i < N; i++)
            {
                bool canSee = true;
                for (int j = 0;  j < i; j++)
                {
                    if (mountain[i] - mountain[j] < 0)
                    {
                        canSee = false;
                    }
                }
                if (canSee)
                {
                    result++;
                }
            }

            Console.Write(result);
        }
    }
    public class deci
    {
        public bool IsFinish { get; set; } = false;
        public int Len { get; set; }
    }
    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); } }
        public int ReadInt { get { return int.Parse(Read); } }
        public long ReadLong { get { return long.Parse(Read); } }
        public double ReadDouble { get { return double.Parse(Read); } }
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret; }
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; }
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret; }
    }
}

Measured memory_bytes: 13268
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define all(v) v.begin(), v.end()
using ll = long long;
const int inf = (int)1e10;
const int mod = (int)1e9 + 7;
typedef pair<int, int> P;

int n;
P ab[(int)1e5];
vector<vector<int>> G((int)1e5);
map<P, int> color;

queue<P> que;
int bfs(int v, int number){
    que.push(P(v, -1));
    color[P(-1, v)] = 0;
    while(que.size()){
        P p = que.front(); que.pop();
        
        int num = 1;
        for(auto new_v:G[p.first]){
            if(new_v == p.second) continue;
            if(color.count(P(p.first, new_v))) continue;
            if(num == color[P(p.second, p.first)]) num++;
            color[P(p.first, new_v)] = num;
            que.push(P(new_v, p.first));
            if(number < num) number = num;
            num ++;
        }
    }
    return number;
}

int main(){
    cin >> n;
    rep(i, n - 1){
        int a, b;
        cin >> a >> b;
        ab[i] = P(a - 1, b - 1);
        G[a - 1].push_back(b - 1);
        G[b - 1].push_back(a - 1);
    }
    int res = bfs(0, 0);
    cout << res << endl;
    rep(i, n - 1) cout << color[ab[i]] << endl;
}

Measured memory_bytes: 15932
import java.math.*;
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner cin = new Scanner(System.in);
		while(cin.hasNext()){
			int a = cin.nextInt();
			int b = cin.nextInt();
			int c = cin.nextInt();
			int k = cin.nextInt();
			int maxn = Math.max(Math.max(a, b),c);
			int sum = a+b+c-maxn;
			for(int i=1;i<=k;++i){
				maxn *= 2;
			}
			sum += maxn;
			System.out.println(sum);
		}
	}
}



Measured memory_bytes: 21588
import java.util.Scanner;

public class Main {
	public static void main (String[] args) {
		Scanner scan = new Scanner (System.in);
		int count = 0;
		final int n = scan.nextInt();
		int[] dataS = new int[n + 1];
		
		for (int i = 0; i < n; i++) {
			dataS[i] = scan.nextInt();
		}
		
		final int q = scan.nextInt();
		
		for (int i = 0; i < q; i++) {
			final int search = scan.nextInt();
			count += LinearSearch (dataS, search);
		}
		scan.close();
		System.out.println(count);
	}
	
	public static int LinearSearch ( int[] data, int s) {
		
		int i = 0;
		int n = data.length - 1;
		data[n] = s;
		
		while (data[i] != s) {
			
			i++;
			if (i == n) return 0;
		}
		
		return 1;
	}
}



Measured memory_bytes: 66020
def joint(i):
    cnt = 0
    for node in line_dict[i]:
        if cnt_list[node] == -1:
            cnt += joint(node)



if __name__ == '__main__':
    import sys
    input = sys.stdin.readline

    n, m = map(int, input().split())

    wa = 0

    wa_cnt = [0]*n
    for _ in range(m):
        p, result = input().split()
        p = int(p)-1
        if wa_cnt[p] == -1:
            continue
        else:
            if result == 'AC':
                wa += wa_cnt[p]
                wa_cnt[p] = -1
            else:
                wa_cnt[p] += 1

    print(str(wa_cnt.count(-1)) + ' ' + str(wa))


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

int main()
{
    ll n,a,b;
    cin>>n>>a>>b;
    ll sum=0;
    ll c= n/(a+b);
    n = n%(a+b);
    if(n>a)
        sum+= a;
    else
        sum+= n;
    sum+= c*a;
    cout<<sum;
    
    
}
 


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

int main(){
  int a, b;
  cin >> a >> b;
  int n = (a + b) % 10;
  if(n % 2 == 0){
    cout << (a + b) / 2 << endl;
  } else {
    cout << (a + b) / 2 + 1 << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=(a),i##_end=(b);i<=i##_end;++i)
#define per(i,a,b) for(int i=(b),i##_end=(a);i>=i##_end;--i)
#define For(i,a,b) for(int i=(a),i##_end=(b);i<i##_end;++i)
#define foe(i,a) for(__typeof(a.begin())i=a.begin();i!=a.end();++i)
#define X first
#define Y second
#define mp make_pair
#define pb push_back
#define SZ(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
typedef double ld;
typedef long long L;
typedef vector<int> vi;
typedef pair<int,int> pa;
int n,a[2000011];
int main(){
	cin>>n;
	n<<=1;
	For(i,0,n)scanf("%d",a+i);
	sort(a,a+n);
	ld ans=0;
	For(i,0,n)ans+=1.0*i/(n-1)*a[i];
	printf("%.7f\n",ans);
}

Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>

using namespace std;
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define IN(v) int v;cin>>v;
#define OUT(v) cout<<v<<"\n"

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

  IN(N);

  vi A(N);
  vl sum(N+1, 0);
  REP(i, N) {
    cin >> A[i];
    sum[i+1] = sum[i] + A[i];
  }
  ll ans = 0;
  map<ll, int> m;
  for (int i = N; i >= 0; --i) {
    ans += m[sum[i]];
    ++m[sum[i]];
  }
  OUT(ans);

  return 0;
}


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

using namespace std;

int main()
{
    int a,b,k;
    cin>>k>>a>>b;
    int i;
    int flag=1;
    for(i=a; i<=b; i++)
    {
        if(!(i%k))
        {
            flag=0;
            cout<<"OK"<<endl;
            break;
        }
    }
    if(flag)
        cout<<"NG"<<endl;
    return 0;
}


Measured memory_bytes: 3624
import { isRegExp } from "util";

class AtCoder {
  // 入力系
  input=require('fs').readFileSync('/dev/stdin','utf8').split(/[\s]/);
  input_i=-1;

  n(){
    this.input_i++;
    return Number(this.input[this.input_i]);
  }
  nn(n:number):number[]{
    const a=[];
    for(let i=0;i<n;i++){
      a.push(this.n());
    }
    return a;
  }
  s(){
    this.input_i++;
    return String(this.input[this.input_i]);
  }
  ss(n:number):string[]{
    const a=[];
    for(let i=0;i<n;i++){
      a.push(this.s());
    }
    return a;
  }

  // コンソール
  o(...a:any){
    console.log(...a);
  }

  // Math
  abs(a:number){
    return Math.abs(a);
  }
  min(...a:number[]){
    return Math.min(...a);
  }
  max(...a:number[]){
    return Math.max(...a);
  }
  floor(a:number){
    return Math.floor(a);
  }
  ceil(a:number){
    return Math.ceil(a);
  }
  round(a:number){
    return Math.round(a);
  }

  // ソート
  asc(ar:number[]){
    const t=[...ar];
    ar.sort((a,b)=>{return a-b});
  }
  desc(ar:number[]){
    const t=[...ar];
    ar.sort((a,b)=>{return b-a});
  }

  // 自作
  gcd(...arr:number[]):number{
    for(let i=0;i<arr.length-1;i++){
      let [x,y]=[arr[i],arr[i+1]];
      while(y){
        [x,y]=[y,x%y];
      }
      arr[i+1]=x;
    }
    return arr[arr.length-1];
  };
  lcm(...arr:number[]):number{
    for(let i=0;i<arr.length-1;i++){
      let [x,y]=[arr[i],arr[i+1]];
      while(y){
        [x,y]=[y,x%y];
      }
      arr[i+1]=arr[i]*arr[i+1]/x;
    }
    return arr[arr.length-1];
  };
  isPrime(n:number):boolean{
    if(n < 2) return false;
    const suq=Math.sqrt(n);
    for(let i=2;i<=suq;i++){
      if(n%i==0){
        return false;
      }
    }return true;
  };
  deduplicate(a:any[]):any[]{
    return Array.from(new Set(a));
  };
  f(roop:number, callback:any){
    for(let i=0;i<roop;i++){
      callback(i);
    }
  };
  Yes(){
    console.log('Yes');
  }
  No(){
    console.log('No');
  }
  YES(){
    console.log('YES');
  }
  NO(){
    console.log('NO');
  }
}
const m = () => {
  const o = new AtCoder();
  let n=o.n()
  let ar=o.nn(n)
  o.asc(ar)
  let ans =Infinity
  for(let i=1;i<=100;i++){
    let tmp=0;
    for(let j=0;j<ar.length;j++){
      tmp+=(ar[j]-i)**2
    }
    if(ans>tmp)ans=tmp
  }
  o.o(ans)
}
m();

Measured memory_bytes: 7628
#include <stdio.h>
#include<string.h>
 
int main(void) {
 
	// ??°????????\???????????°?????????
	int num;
	scanf("%d", &num);
	int sequence[num];

		// ???????????°??????????????????
		for(int cnt = 0; cnt < num; cnt++) {
			
			sequence[cnt] = cnt+1;
			
			if(sequence[cnt] % 3 == 0 || sequence[cnt] % 10 == 3) {
					
				printf(" %d", sequence[cnt]);
					
			} else {
				
				char symbol[10];
				snprintf(symbol, 10, "%d", sequence[cnt]);
				
				if(strchr(symbol,'3')) {
				 printf(" %s", symbol);
				}
			}
		}
		printf("\n");
		return 0;
	}

Measured memory_bytes: 1832
import java.util.Scanner;

class Main {

    static int n = 5;
    static int max;
    static int g[][];

    public static void go(int x, int y, int cur) {
        cur += g[x][y];
        if (x == 0) {
            go(x + 1, y, cur);
        }
        if (y < n - 1)
            go(x, y + 1, cur);
        max = Math.max(max, cur);
    }

    public static void main(String... args) {
        Scanner in = new Scanner(System.in);
        n = in.nextInt();
        g = new int[2][n];
        for (int i = 0, col = 0; i < n; i++) {
            g[col][i] = in.nextInt();
        }
        for (int i = 0, col = 1; i < n; i++) {
            g[col][i] = in.nextInt();
        }
        go(0, 0, 0);
        System.out.println(max);

    }

}



Measured memory_bytes: 21844
[n, m, x], *t = [[*map(int, t.split())] for t in open(0)]
ans = 1200001
for i in range(1, 2**n):
    tmp = [t[k] for k in range(n) if 1 << k & i]
    c, *a = map(sum, zip(*tmp))
    if min(a) >= x:
        ans = min(ans, c)
if ans == 1200001:
    print(-1)
else:
    print(ans)


Measured memory_bytes: 9100
#include <bits/stdc++.h>
#define ss second
#define ff first
#define all(x) x.begin(), x.end()
 
// #define DEBUG 100
 
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll >;
 
const ll oo = 1e9 + 7;
const ll mod = 1e9 + 7,maxn = 1e6 + 100, maxm = 1e3+100;
const double PI = acos(-1);
int vs[maxn];
vector<int> prim;
bitset<1010> notprim(0);

void init(){
    for (int i=2; i<1000; i++){
        if (!notprim[i]){
            prim.push_back(i);
            for (int j=i*i; j<1000; j+=i){
                notprim[j] = true;
            }
        }
    }
}
int solve(int n){
    init();

    map<int, int> mp;

    for (int i=0; i<n; i++){
        int val = vs[i];

        for (auto p: prim){
            if (p > val) break;
            int cnt = 0;
            while (val%p == 0) val/=p, cnt++;
            if (cnt) mp[p]++;
        }
        if (val != 1) mp[val]++;
    }

    bool par = true;
    for (auto it: mp){
        if (it.ss == n) {
            // cout << it.ff << endl;
            return 1;
        }
        if (it.ss > 1) par = false;
    }
    if (par) return -1;
    return 0;
}

int main (){
    ios_base::sync_with_stdio(false);
    int n;
    cin >> n;
    for (int i=0; i<n; i++){
        cin >> vs[i];
    }

    int ans = solve(n);

    if (ans == -1){
        cout << "pairwise coprime" << endl;
    }
    else if (ans == 0){
        cout << "setwise coprime" << endl;
    }
    else {
        cout << "not coprime" << endl;
    }
    return 0;
}

Measured memory_bytes: 11068
N = int(input())
h = list(map(int, input().split()))
dp = [0 for i in range(N)]
dp[0] = 0
dp[1] = abs(h[1]-h[0])

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

print(dp[N-1])


Measured memory_bytes: 13928
#include <iostream>
#include<cmath>
#include<stack>
#include<queue>
#include<string>
#include<algorithm>
using namespace std;


int main(){
    int n,q,t;
    string name;
    queue<pair<string,int> >Q;
    cin>>n>>q;
    
    for(int i=0;i<n;i++){
        cin>>name>>t;
        Q.push(make_pair(name,t));
    }
    
    pair<string,int> u;
    int elaps = 0,a;
    
    while( !Q.empty() ){
        u=Q.front();Q.pop();
        a = min(u.second,q);
        u.second -=a;
        elaps += a;
        if(u.second>0){
            Q.push(u);
        }else{
            cout<<u.first<<' '<<elaps<<endl;
        }
    }

    
    return 0;
}


Measured memory_bytes: 6240
(defun solver ()
  (let* ((n (read))
         (ti (make-array (1+ n) :fill-pointer 1))
         (xi (make-array (1+ n) :fill-pointer 1))
         (yi (make-array (1+ n) :fill-pointer 1)))
    (loop repeat n do
          (vector-push (read) ti)
          (vector-push (read) xi)
          (vector-push (read) yi))
    (loop for i from 0 to (1- n)
          when (or
                (< (- (aref ti (1+ i)) (aref ti i))
                   (+ (abs (- (aref xi (1+ i)) (aref xi i)))
                      (abs (- (aref yi (1+ i)) (aref yi i)))))
                (/= (mod (- (aref ti (1+ i)) (aref ti i)) 2)
                    (mod (+ (abs (- (aref xi (1+ i)) (aref xi i)))
                            (abs (- (aref yi (1+ i)) (aref yi i)))) 2)))
          return (format t "No~%")
          finally (format t "Yes~%"))))

(solver)

Measured memory_bytes: 61864
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define P pair<ll,ll>
#define FOR(I,A,B) for(ll I = ll(A); I < ll(B); ++I)
#define FORR(I,A,B) for(ll I = ll((B)-1); I >= ll(A); --I)
#define TO(x,t,f) ((x)?(t):(f))
#define SORT(x) (sort(x.begin(),x.end())) // 0 2 2 3 4 5 8 9
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin()) //xi>=v  x is sorted
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin()) //xi>v  x is sorted
#define NUM(x,v) (POSU(x,v)-POSL(x,v))  //x is sorted
#define REV(x) (reverse(x.begin(),x.end())) //reverse
ll gcd_(ll a,ll b){if(a%b==0)return b;return gcd_(b,a%b);}
ll lcm_(ll a,ll b){ll c=gcd_(a,b);return ((a/c)*(b/c)*c);}
#define NEXTP(x) next_permutation(x.begin(),x.end())
const ll INF=ll(1e16)+ll(7);
const ll MOD=1000000007LL;
#define out(a) cout<<fixed<<setprecision((a))
//tie(a,b,c) = make_tuple(10,9,87);
#define pop_(a) __builtin_popcount((a))
ll keta(ll a){ll r=0;while(a){a/=10;r++;}return r;}



int main(){

  ll n,m,k;
  cin >> n >> m >> k;
  vector<ll> a(n),b(m),A(n+2,0),B(m+2,0);
  FOR(i,0,n) cin >> a[i];
  FOR(i,0,m) cin >> b[i];

  FOR(i,1,n+1) A[i] = A[i-1] + a[i-1];
  FOR(i,1,m+1) B[i] = B[i-1] + b[i-1];
  A[n+1] = B[m+1] = INF;


  ll ans = 0;
  FOR(i,0,n+1){
    ll p = k - A[i];
    ll t = i + POSU(B,p) - 1;
    if(p>=0)ans = max(t,ans);
  }
  cout << ans << endl;
}




Measured memory_bytes: 9596
#include <iostream>
#include <string>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <cstdio>
#include <vector>
#include <queue>
#include <assert.h>
#include <map>
#include <set>
#include <bitset>
#include <iomanip>
#include <stack>
// #include <unordered_map>
#include <cmath>
using namespace std;
#pragma comment(linker, "/STACK:1024000000,1024000000")
// #define INF 0x7f7f7f7f  //2139062143
#define INF1 0x3f3f3f3f //1061109567
#define INF2 2147483647
#define llINF 9223372036854775807
#define pi 3.14159265358979323846264338327950254
#define pb push_back
#define ll long long
#define debug cout << "debug\n";
#define STDIN                      \
    freopen("in.txt", "r", stdin); \
    freopen("out.txt", "w", stdout);
#define IOS                      \
    ios::sync_with_stdio(false); \
    cin.tie(NULL);
#define scai(x) scanf("%d", &x)
#define sca2i(x, y) scanf("%d %d", &x, &y)
#define scaf(x) scanf("%lf", &x)
#define sca2f(x, y) scanf("%lf %lf", &x, &y)
#define For(m, n) for (int i = m; i < n; i++)
#define PII pair<int, int>
#define PLL pair<long, long>
#define ft first
#define sd second
#define pb push_back
#define ST(x, y, z) sort(x + y, x + z);
#define lson o << 1, l, mid
#define rson o << 1 | 1, mid + 1, r
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define ROF(i, a, b) for (int i = (a); i >= (b); i--)
#define MEM(x, v) memset(x, v, sizeof(x))
#define rep(i, a, b) for (register int i = a; i <= b; i++)
#define rrep(i, a, b) for (register int i = a; i >= b; i--)
#define PIII pair<int, PII>
#define re read()
#define case  \
    int T;    \
    cin >> T; \
    rep(_,1,T)
// #define int ll
#define LL long long
#define int ll
inline int read()
{
    char tempt = getchar();
    int x = 0, f = 0;
    while (tempt < '0' || tempt > '9')
        f |= tempt == '-', tempt = getchar();
    while (tempt >= '0' && tempt <= '9')
        x = x * 10 + tempt - '0', tempt = getchar();
    return f ? -x : x;
}

template <class T>
inline bool chmax(T &a, T b)
{
    if (a < b)
    {
        a = b;
        return true;
    }
    return false;
}

template <class T>
inline bool chmin(T &a, T b)
{
    if (a > b)
    {
        a = b;
        return true;
    }
    return false;
}

const int N =  100+5;
int a[N];
int dp[N][N];

int st[27][N];
signed main()
{
    //STDIN
    string s1, s2;
    cin >> s1 >> s2;
    int len = s1.size();
    int cnt= 0;
    rep(i, 0, len-1)
    {
        if (s1[i] != s2[i]) cnt++;
    }
    cout << cnt << endl;
}

Measured memory_bytes: 3856
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define pb push_back
void orz(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);    
    #ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
        freopen("out.txt","w",stdout);
    #endif
}
int main()
{
    //orz();
    long long n,d,x,ans;
    cin>>n>>d;
    d=d*2+1;

    ans=n/d;
    if(n%d)
            ans++;
        cout<<ans;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define endl '\n'
#define FOR(i, a, n) for (int i = (a); i < (n); ++i)
#define REP(i, n) FOR(i, 0, n)
using namespace std;

void _main() {
    int N;
    cin >> N;
    vector<int> s(N);
    int sum = 0, mn = 1LL << 30;
    REP (i, N) {
        cin >> s[i];
        sum += s[i];
        if (s[i] % 10 != 0) mn = min(mn, s[i]);
    }
    if (sum % 10 != 0) cout << sum << endl;
    else if (mn != 1LL << 30) cout << sum - mn << endl;
    else cout << 0 << endl;
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(10);
    _main();
    return 0;
}

Measured memory_bytes: 256
while 1:
    n , o = map(int, input().split())
    if n == 0 and o == 0:break
    else:
        k = [0]
        for i in range(n):
            k.append(k[-1]+int(input()))
        m = -float("INF")
        for i,l in zip(k,k[o:]):
            m = max(m,l-i)
        print(m)


Measured memory_bytes: 9928
N, K = map(int, input().split())
S = str(input())
max = N-1
cnt = 0
if N == 1:
    print(0)
    exit()
    
if (S[0] == "R") & (S[1] == "R"):
    cnt += 1
if (S[N-1] =="L") & (S[N-2]=="L"):
    cnt += 1
for i in range(1, N-1):
    if S[i] == "L":
        if S[i-1] == "L":
            cnt += 1
    if S[i] == "R":
        if S[i+1] == "R":
            cnt += 1

if (cnt + K*2) > max:
    print(max)
else:
    print(cnt + K*2)

Measured memory_bytes: 3316
#include<stdio.h>

int main(void)

{

long long int a[10000],min=1000000,max=-1000000,sum=0;

int n,i;

scanf("%d",&n);

for(i=0;i<n;i++){

scanf("%lld",&a[i]);

if(a[i]>=max){

max=a[i];

}

if(a[i]<=min){

min=a[i];

}

sum+=a[i];

}

printf("%lld %lld %lld\n",min,max,sum);

return 0;

}

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

using namespace std;


 
int ctoi(const char c){
  switch(c){
    case '0': return 0;
    case '1': return 1;
    case '2': return 2;
    case '3': return 3;
    case '4': return 4;
    case '5': return 5;
    case '6': return 6;
    case '7': return 7;
    case '8': return 8;
    case '9': return 9;
    default : return -1;
  }
}

//5
int gcd(int a,int b){return b?gcd(b,a%b):a;}

long long int h[100002]={};

long long int dat[100001]={};

int main(){

ios::sync_with_stdio(false);
cin.tie(0);
long long int n,m;

cin>>n>>m;//n展望台m道数


long long int a;
long long int b;


long long int res=0;

for(long long int i=0;i<n;i++)cin>>h[i];

for(long long int i=0;i<m;i++){
cin>>a>>b;
dat[a-1]=max(dat[a-1],h[b-1]);
dat[b-1]=max(dat[b-1],h[a-1]);
}

for(long long int i=0;i<n;i++){

if(h[i]>dat[i])res++;

}


cout<<res<<endl;



}



//cout << fixed << setprecision(5) <<(n*2)*M_PI << endl;


Measured memory_bytes: 5196
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <queue>
using ll = long long;

using namespace std;

int main() {
    ll N;
    ll MOD = 1000000007;
    cin >> N;
    ll count[N];
    for(ll i = 0; i < N; i++){
        count[i] = 0;
    }
    ll val = 1;
    for(ll i = 0; i < N; i++){
        int tmp;
        cin >> tmp;
        count[tmp]++;
        if(tmp == 0){
            val = (val * (4 - count[tmp])) % MOD;
        }else{

            val = (val * (count[tmp - 1] -count[tmp] + 1)) % MOD;
        }
    }
    cout << val << endl;
}

Measured memory_bytes: 1024
p,h,l,s,w,b,r=print,80,40,list,'.','#',range
W,B=map(int,input().split())
m=s(map(s,zip(*[iter(w*h*l+b*h*l)]*h)))
for i in r(B-1):m[i//l*2][i%l*2]=b
for i in r(W-1):m[79-i//l*2][79-i%l*2]=w
p(h,h)
[p(''.join(l)) for l in m]

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


int main() {
int n;
cin>>n;
int a[n];
   int k=-1;
   int g=-2;
   int p;
   int q;
   for(int i =0;i<n;i++){
      cin>>a[i];
      if(k<a[i]){
         g=k;
         k=a[i];
         p=i;
      }
      else if(a[i]<=k&&a[i]>g){
         g=a[i];
      }
   }
   for(int j=1;j<=n;j++){
      if(j!=p+1){
         cout<<k<<endl;
      }
      else{
         cout<<g<<endl;
      }
   }
}



Measured memory_bytes: 2432
#include<stdio.h>
int main()
{
    int i,t;
    int data[5];
    scanf("%d %d %d %d %d",&data[0],&data[1],&data[2],&data[3],&data[4]);
    for(i=0;i<5;i++){
        for(t=i+1;t<5;t++){
            if(data[i]<data[t]){
                int work=data[i];
                data[i]=data[t];
                data[t]=work;
            }
        }
    }
    printf("%d %d %d %d %d\n",data[0],data[1],data[2],data[3],data[4]);
    return 0;
}

Measured memory_bytes: 596
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main()
{
   long long a,b;
   cin>>a>>b;
   for(int i=1;i<=b;i++)
   {
       if((a*i)%b==0)
       {
           cout<<(a*i)<<"\n";
           break;
           
       }
   }
}

Measured memory_bytes: 3636
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
using namespace std;

typedef pair<int,int> pii;

int main(){
    int n;
    cin >> n;
    vector<int> a(n*n, 0);
    int pos = 0;
    vector<pii> vp;
    for(int i = 0; i < n; i++){
        int x;  cin >> x;
        vp.push_back({--x, i+1});
    }
    sort(vp.begin(), vp.end());
    for(int i = 0; i < n; i++){
        int x = vp[i].first;
        int number = vp[i].second;
        a[x] = number;
        int residual = number-1;
        while(residual > 0 && pos < x){
            if(a[pos] == 0) a[pos] = number, residual--;
            pos++;
        }
        if(residual){
            cout << "No" << endl;
            return 0;
        }
    }
    reverse(vp.begin(), vp.end());
    pos = n*n-1;
    for(int i = 0; i < n; i++){
        int x = vp[i].first;
        int number = vp[i].second;
        int residual = n-number;
        while(x < pos && residual > 0){
            if(a[pos] == 0) a[pos] = number, residual--;
            pos--;
        }
        if(residual){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    for(int i = 0; i < n*n; i++)    cout << a[i] << " \n"[i+1==n*n];
    return 0;
}

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


#include "boost/multiprecision/cpp_int.hpp"
#include "boost/multiprecision/cpp_dec_float.hpp"
namespace mp = boost::multiprecision;
typedef mp::cpp_int LL;
typedef mp::number<mp::cpp_dec_float<1024>> DD;// 仮数部が1024ビットの浮動小数点数型(TLEしたら小さくする)


typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
typedef pair<dd,dd> d_d;
ll inf=(ll)1E16;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define fi first
#define se second
#define endl "\n"
#define SORT(v) sort(v.begin(),v.end())
#define ERASE(v) v.erase(unique(v.begin(),v.end()),v.end())
#define POSL(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define POSU(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}
template<class T>
inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}

void mod_print(ll k){
    ll P=1000;
    rep(y,1,P){
        ll x=mod(y*k);
        if(x+P>=i_7){
            x-=i_7;
        }
        if(abs(x)<=P){
            cout<<x<<"/"<<y<<endl;
            return;
        }
    }
    cout<<"nun"<<endl;
}
//////////////////////////



int SOLVE(){fastio
    ll n,m;cin>>n>>m;
    ll dp[2][n+1][n+1];
    memset(dp,0,sizeof(dp));
    dp[0][1][1]=1;
    rep(i,0,m-1){
        rep(j,0,n)rep(k,0,n)dp[(i+1)&1][j][k]=0;
        rep(j,0,n){
            rep(k,0,n){
                if(k+1<=n)Add(dp[(i+1)&1][j][k+1],dp[i&1][j][k]*(n-k));
                Add(dp[(i+1)&1][j][k],dp[i&1][j][k]*(k-j));
                Add(dp[(i+1)&1][k][k],dp[i&1][j][k]*j);
            }
        }
        /*
        rep(j,0,n){
            rep(k,0,n){
                cout<<dp[(i+1)&1][j][k]<<" ";
            }cout<<endl;
        }cout<<endl;*/
    }
    
    cout<<mod(dp[m&1][n][n])<<endl;
    
    return 0;
}

int main(){fastio
    clock_t start = clock();
    SOLVE();
    clock_t end = clock();
    const double time = static_cast<double>(end - start) / CLOCKS_PER_SEC * 1000.0;
    cerr<<endl<<time<<"ms"<<endl;
    
    return 0;
}


Measured memory_bytes: 1664
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <fstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <limits>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }

//math
//-------------------------------------------
template<class T> inline T sqr(T x) { return x * x; }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define EXISTch(s,c) ((((s).find_first_of(c)) != std::string::npos)? 1 : 0)//cがあれば1 if(1)
#define SORT(c) sort((c).begin(),(c).end())

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = (int)1000000007;
const LL MOD = (LL)1000000007;//10^9+7
const LL INF2 = (LL)100000000000000000;//10^18

int main() {
	int A, B, M; cin >> A >> B >> M;
	vector<int> a(A);
	for (int i = 0; i < A; i++) {
		cin >> a[i];
	}

	vector<int> b(B);

	for (int i = 0; i < B; i++) {
		cin >> b[i];
	}

	int ans = *min_element(a.begin(), a.end()) + *min_element(b.begin(), b.end());

	for (int i = 0; i < M; i++) {
		int x, y, c; cin >> x >> y >> c; x--; y--;

		int val = a[x] + b[y] - c;
		ans = min(ans, val);
	}

	cout << ans << endl;

}

Measured memory_bytes: 1024
import sys
m=166666;a=[[1]*m for _ in[0]*2]
for i in range(m):
 if a[0][i]:
  k=6*i+5
  a[0][i+k::k]=[0]*len(a[0][i+k::k])
  a[1][-2-i+k::k]=[0]*len(a[1][-2-i+k::k])
 if a[1][i]:
  k=6*i+7
  a[0][-2-i+k::k]=[0]*len(a[0][-2-i+k::k])
  a[1][i+k::k]=[0]*len(a[1][i+k::k])
for e in map(int,sys.stdin):
 print([e-1,sum(a[0][:(e+1)//6])+sum(a[1][:(e-1)//6])+2][e>3])


Measured memory_bytes: 9892
import sys
import math
from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN
from collections import deque
def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LI2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def S(): return sys.stdin.readline().rstrip()
def LS(): return sys.stdin.readline().split()
def LS2(N): return [sys.stdin.readline().split() for i in range(N)]
def FILL(i,h): return [i for j in range(h)]
def FILL2(i,h,w): return [FILL(i,w) for j in range(h)]
def FILL3(i,h,w,d): return [FILL2(i,w,d) for j in range(h)]
def FILL4(i,h,w,d,d2): return [FILL3(i,w,d,d2) for j in range(h)]
def sisha(num,digit): return Decimal(str(num)).quantize(Decimal(digit),rounding=ROUND_HALF_UP)
#'0.01'や'1E1'などで指定、整数に戻すならintをかます
MOD = 1000000007
INF = float("inf")
sys.setrecursionlimit(10**5+10)
#input = sys.stdin.readline

N,M = MI()
hlist = LI()
link = [[] for i in range(N)]
ans = 0
for i in range(M):
    a,b = MI()
    link[a-1].append(b)
    link[b-1].append(a)
for i in range(N):
    here = hlist[i]
    for next in link[i]:
        if here<=hlist[next-1]:
            break
    else:
        ans += 1
print(ans)


Measured memory_bytes: 99992
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <string>
#include <queue>
#include <stack>
#include <math.h>
#include <set>
#include <cstdio>
#define ALL(obj) (obj).begin(),(obj).end()
#define RALL(obj) (obj).rbegin(),(obj).rend()
#define P pair<int, int>

#define MOD 1000000007
#define INF 1012345678
#define NINF (-2147483647-1)
#define LLINF 9012337203685477580
using ll = long long;
using namespace std;

// bellman-ford法
const int MAX_V = 1000;
struct edge { int to, cost; };
int V;
vector<edge> G[MAX_V];
ll d[MAX_V];

// sからnまでの最短距離
// 負の閉路がある(いくらでも小さくできる)時はfalse
bool bellman_ford(int s, int n) {
    fill(d, d + V, LLINF);
    d[s] = 0;
    for (int i = 0; i < V; i++)
    {
        for (int j = 0; j < V; j++)
        {
            for (edge e : G[j])
            {
                if (d[j] != LLINF && d[j] + e.cost < d[e.to]) {
                    d[e.to] = d[j] + e.cost;
                    if (i == V - 1 && e.to == n) {
                        return false;
                    }
                }
            }
        }
    }
    return true;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, M;
    cin >> N >> M;
    V = N;
    for (int i = 0; i < M; i++)
    {
        int a, b, c;
        cin >> a >> b >> c;
        a--; b--; c = -c;
        G[a].push_back(edge{b,c});
    }
    if (bellman_ford(0,N-1)) {
        cout << -d[N - 1] << endl;
    }
    else {
        cout << "inf" << endl;
    }
    getchar(); getchar();
}

Measured memory_bytes: 384
import java.io.UnsupportedEncodingException;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		String str = scanner.nextLine();
		byte[] ascii = null;

		try {
			ascii = str.getBytes("US-ASCII");
		} catch (UnsupportedEncodingException e) {
			// TODO 自動生成された catch ブロック
			e.printStackTrace();
		}

		Arrays.sort(ascii);
		HashSet<Byte> set = new HashSet<>();
		for(int i = 0; i < ascii.length; i++){
			set.add(ascii[i]);
		}

		if(set.size() == 26){
			System.out.println("None");
		}else{
			for(int i = 97; i < 123; i++){
				if(!set.contains((byte)i)){
					System.out.println((char)(byte)i);
					break;
				}
			}
		}
	}
}

Measured memory_bytes: 26188
n = int(input())
l = list(map(int,input().split()))
x = 0
for i in range(n):
    for j in range(i + 1,n):
        for k in range(j + 1,n):
            if l[i] != l[j] and l[j] != l[k] and l[i] != l[k]:
                if l[i] + l[j] > l[k] and l[i] + l[k] > l[j] and l[j] + l[k] > l[i]:
                    x += 1
print(x)

Measured memory_bytes: 9204
void main()
{
    long[] tmp = rdRow;
    long n = tmp[0], k = tmp[1];
    long[] h = rdRow;

    h.sort!"a > b";
    if (k >= n) 0.writeln;
    else h[k..$].sum.writeln;
}

T rdElem(T = long)()
if (!is(T == struct))
{
    return readln.chomp.to!T;
}

alias rdStr = rdElem!string;
alias rdDchar = rdElem!(dchar[]);

T rdElem(T)()
if (is(T == struct))
{
    T result;
    string[] input = rdRow!string;
    assert(T.tupleof.length == input.length);
    foreach (i, ref x; result.tupleof)
    {
        x = input[i].to!(typeof(x));
    }
    return result;
}

T[] rdRow(T = long)()
{
    return readln.split.to!(T[]);
}

T[] rdCol(T = long)(long col)
{
    return iota(col).map!(x => rdElem!T).array;
}

T[][] rdMat(T = long)(long col)
{
    return iota(col).map!(x => rdRow!T).array;
}

void wrMat(T = long)(T[][] mat)
{
    foreach (row; mat)
    {
        foreach (j, compo; row)
        {
            compo.write;
            if (j == row.length - 1) writeln;
            else " ".write;
        }
    }
}

import std.stdio;
import std.string;
import std.array;
import std.conv;
import std.algorithm;
import std.range;
import std.math;
import std.numeric;
import std.traits;
import std.container;
import std.functional;
import std.typecons;
import std.ascii;
import std.uni;

Measured memory_bytes: 11240
#include <iostream>
#include <algorithm>
#include <math.h>
#include <vector>
using namespace std;

int findsumofDigits(int n){
        int sum = 0;
        while(n >0){
            sum += n%10;
            n /= 10;
        }
        return sum;
    }

int main()
{
    long n,x,y,ans;
    cin >> n >> x;
    ans = 0;
    y = 0;
    std::vector<long>  vec(n);
    
    for(int i = 0; i < n; i++)
    {
        cin >> vec[i];
        y += vec[i];
    }
    
    sort(vec.begin(),vec.end());

    if(y < x)ans = vec.size() - 1;
    else if(y == x)ans = vec.size();  
    else
    {
        
        for(int i = 0; 0 < x; i++)
        {
            x -= vec[i];
            ans++;
            if(x == 0)ans++;
        }
        
        ans -= 1;
    }
    
    
    cout << ans  << endl;
}




Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std; 
#define LIM 1000003

#define M 1000000007
#define inf 99999999999999999LL	//long long inf
typedef long long ll;

#define sc(x) scanf("%d",&x);
#define sc2(x,y) scanf("%d%d",&x,&y);
#define sc3(x,y,z) scanf("%d%d%d",&x,&y,&z);
#define scl(x) scanf("%lld",&x);
#define scl2(x,y) scanf("%lld%lld",&x,&y);
#define scl3(x,y,z) scanf("%lld%lld%lld",&x,&y,&z);

#define pb push_back
#define mp make_pair
#define fi first
#define se second 
ll power(ll x,ll y,ll z) {	ll ret = 1;	while(y > 0) {	if(y & 1) ret = (ret*x)%z;x = (x*x)%z;y >>= 1;}return ret;}


#define debug(x) cerr<<#x<<" :: "<<x<<"\n";
#define debug2(x,y) cerr<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\n";
#define debug3(x,y,z) cerr<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<"\n";
#define debug4(x,y,z,a) cerr<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<"\t"<<#a<<" :: "<<a<<"\n";



int n, p;
string s;
int main() {
	int i, j, t;
	sc2(n, p);
	cin >> s;
	long long int answer = 0;
		
	//debug(s);
	if (p == 2 || p == 5) {
		for(i=0; i<n; i++) {
			int ele = s[i] - '0';
			if(ele % p == 0)
				answer += (i+1);
		}	
	} else {
		reverse(s.begin(), s.end());
		int curMod = 0;
		map< int, int >mm;
		mm[curMod]++;
		int powTen = 1LL;
		for(i=0; i<n; i++) {
			int ele = s[i] - '0';
			curMod = (curMod +  ele * powTen)%p;
			powTen = (powTen * 10 )%p;
			answer = (answer + mm[curMod]);
			mm[curMod]++;
		}
	}
	cout << answer << endl;		
	
	return 0;
}




Measured memory_bytes: 900
#include <bits/stdc++.h>
#define rep(i,cc,n) for(int i=cc;i<=n;++i)
#define drep(i,cc,n) for(int i=cc;i>=n;--i)
#define sz(s) (int)(s.size())
#define vecprint(v) rep(i,0,v.size()-1)cout << v[i] << " ";cout << endl;
#define arrprint(v,n) rep(i,0,n-1)cout << v[i] << " ";cout << endl;
#define matprint(v,n,m) rep(i,0,n-1){rep(j,0,m-1){cout << v[i][j] << " ";}cout << endl;}
#define SORT(v) sort(v.begin(), v.end())
#define REV(v) reverse(v.begin(), v.end())
using namespace std;
const int mod=1000000007;
const int INF=1001001001;
typedef long long ll;
typedef pair<int,int> P;
template<typename T>
using priority_queue_rev = priority_queue<T, vector<T>, greater<T>>; //小さいものから取り出す

int main(){
    int n;
    cin >> n;
    string ans;
    if(n%10 == 0)ans = "pon";
    if(n%10 == 1)ans = "pon";
    if(n%10 == 2)ans = "hon";
    if(n%10 == 3)ans = "bon";
    if(n%10 == 4)ans = "hon";
    if(n%10 == 5)ans = "hon";
    if(n%10 == 6)ans = "pon";
    if(n%10 == 7)ans = "hon";
    if(n%10 == 8)ans = "pon";
    if(n%10 == 9)ans = "hon";


    cout << ans << endl;
//  printf("%.10f\n",ans);

    return 0;
}

Measured memory_bytes: 3628