akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<vector>
#include<string>
#include<cmath>
#include<algorithm>
#include <numeric>
#include<map>
#include<unordered_map>
#include <queue>
 
using namespace std;
using ll=long long;
#define rep(i,n) for(ll i=0;i<n;++i)
#define all_map(itr,mp) for(auto itr=mp.begin();itr!=mp.end();itr++)
#define ALL(a) (a).begin(),(a).end()

int main(){
    ll n;
    cin >> n;
    ll p[n];
    rep(i, n)cin >> p[i];
    
    ll dp[n+1];
    rep(i, n+1)dp[i]=0;
    ll res = 0;
    rep(i, n){
        dp[p[i]] = dp[p[i]-1]+1;
        res = max(res, dp[p[i]]);
    }

    cout << n-res << endl;
}

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

int main(void)
{
    int k,a,b;
    cin >> k >> a >> b;
    int ans = k;
    for (int i = 0; ans < a; i++)
    {
        ans += k;
    }
    if(b>=ans)
    {
        cout << "OK" << endl;
    }else
    {
        cout << "NG" << endl;
    }

        return 0;
}


Measured memory_bytes: 3632
N, M = map(int, input().split())
adj_matrix = [[0]* N for _ in range(N)]

for i in range(M):
    a, b = map(int, input().split())
    adj_matrix[a-1][b-1] = 1
    adj_matrix[b-1][a-1] = 1

def dfs(v, used):
    if not False in used:
        return 1
    
    ans = 0
    for i in range(N):
        if not adj_matrix[v][i]:
            continue
        if used[i]:
            continue
        
        used[i] = True
        ans += dfs(i, used)
        used[i] = False
    
    return ans

used = [False] * N
used[0] = True

print(dfs(0, used))

Measured memory_bytes: 3192
w, h = map(int, raw_input().split())
P = [int(raw_input()) for i in xrange(w)]
Q = [int(raw_input()) for i in xrange(h)]

P.sort()
Q.sort()

cp = cq = 0
ans = 0
while cp < w and cq < h:
    #print cp, cq, ans
    if P[cp] < Q[cq]:
        #print P[cp]
        ans += P[cp] * (h+1-cq)
        cp += 1
    else:
        #print Q[cq]
        ans += Q[cq] * (w+1-cp)
        cq += 1
while cp < w:
    ans += P[cp] * (h+1-cq)
    cp += 1
while cq < h:
    ans += Q[cq] * (w+1-cp)
    cq += 1

print ans



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

int main(void){
  int n; cin >> n;
  int b[n];
  pair<int,int> a[n];
  rep(i,n){
    cin >> a[i].first;
    b[i] = a[i].first;
    a[i].second = i;
  }
  sort(a,a+n);
  int record = a[n-1].second;
  for(int i = 0; i < n; i++){
    if(i == record){
      cout << a[n-2].first << endl;
    }
    else cout << a[n-1].first << endl;
  }
  return 0;
}


Measured memory_bytes: 3968
while True:
    x,y = map(int,input().split())
    if x == 0 and y == 0:
        break
    if x < y:
        x,y=y,x
    c = 0
    while True:
        if y == 0:
            break
        x = x % y
        x,y=y,x
        c += 1
    print(x,c)

    
    


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

int main(){
  int n;
  cin >> n;
  vector<int> x(n);
  rep(i,n) cin >> x[i];
  sort(x.begin(),x.end());
  
  
  ll ans = inf;
  rep(i,x[n-1]+1){
    ll temp = 0;
    rep(j,n){
    temp += (x[j]-i)*(x[j]-i);
    }
    ans = min(ans,temp);
  }
  cout << ans << endl;
}

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

#define ld long double
#define sf scanf
#define pf printf
#define pb push_back
#define mp make_pair
#define PI ( acos(-1.0) )
#define IN freopen("input.txt","r",stdin)
#define OUT freopen("output.txt","w",stdout)
#define FOR(i,a,b) for(int i=a ; i<=b ; i++)
#define FORD(i,a,b) for(int i=a ; i>=b ; i--)
#define INF 1000000000
#define ll long long int
#define eps (1e-8)
#define sq(x) ( (x)*(x) )
#define all(x) x.begin(),x.end()
#define flog2(n) 64 - __builtin_clzll(n) - 1
#define popcnt(n) __builtin_popcountll(n)

using namespace std;

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

ll d[3005][3005];
ll a[3005];

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(NULL);
    int n;
    cin >> n;
    FOR (i, 1, n) {
    	cin >> a[i];
    }

    FOR (len, 0, n - 1) {
     	FOR (i, 1, n - len) {
     		if (len == 0) {
    			d[i][i] = a[i];
	    		continue;
	    	}

    		int j = i + len;

    		d[i][j] = max(a[j] - d[i][j - 1], a[i] - d[i + 1][j]);
    	}
    }

    cout << d[1][n] << endl;

		

	return 0;
}

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

#define REP(type, i, a, b) for( type i = a; i < b; i++ )
typedef long long ll;

using namespace std;

int main (void) {
    int A,B;
    int ans = 1;
    scanf("%d %d", &A, &B);
    if ( B == 1 ) ans = 0;
    else{
        while ( (ans - 1) * ( A - 1 ) + A < B ){
            ans++;
        }
    }

    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 256
import java.io.*;

public class Main{
    public static void main(String[] args){
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        
        try{
            String line;
            line = reader.readLine();
            String[] data = line.split(" ",2);
            int a = 0, b = 0;
            a = Integer.parseInt(data[0]);
            b = Integer.parseInt(data[1]);

            System.out.print(a*b + " ");
            System.out.println((a+b)*2);


        }catch(NumberFormatException e){
            System.out.println(e);
        }catch(IOException e){
            System.out.println(e);
        }
    }
}


Measured memory_bytes: 24244
N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
ans=0
for i in range(N):
    if B[i]>(A[i]+A[i+1]):
        ans+=(A[i]+A[i+1])
        A[i+1]=0
    elif B[i]>A[i]:
        ans+=B[i]
        A[i+1]-=(B[i]-A[i])
    elif B[i]<=A[i]:
        ans+=B[i]
print(ans)

Measured memory_bytes: 18624
import java.io.*;
import java.util.*;
public class Main {
    private static MyScanner scanner;

    public static void main (String[] args){
        Main instance = new Main();
        scanner = instance.new MyScanner();
        instance.solve();
    }

    private void solve() {
        try {
            int A = scanner.nextInt();
            int B = scanner.nextInt();
            int C = scanner.nextInt();
            int D = scanner.nextInt();
            int square1 = A * B;
            int square2 = C * D;
            if (square1 > square2) {
                System.out.println(square1);
            } else {
                System.out.println(square2);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    private class MyScanner {
        String[] s;
        int i;
        BufferedReader br;
        String reg = " ";

        MyScanner () {
            s = new String[0];
            i = 0;
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        public String next() throws IOException {
            if (i < s.length) return s[i++];
            String line = br.readLine();
            while (line.equals("")) {
                line = br.readLine();
            }
            s = line.split(reg, 0);
            i = 0;
            return s[i++];
        }

        public int nextInt() throws NumberFormatException, IOException {
            return Integer.parseInt(next());
        }

        public double nextDouble() throws NumberFormatException, IOException {
            return Double.parseDouble(next());
        }

        public long nextLong() throws NumberFormatException, IOException {
            return Long.parseLong(next());
        }
    }
}

Measured memory_bytes: 21204
#include<stdio.h>
#define N 100
#define WHITE 0
#define GRAY 1
#define BLACK 2
#define INFTY 10000001
void dij(int n,int d[],int M[N][N])
{
  int i,vertex,min_d,color[N];

  for(i=0;i<n;i++)
    {
      d[i] = INFTY;
      color[i] = WHITE;

    }
  d[0] = 0;
  color[0] = GRAY;


  while(1)
    {

      vertex = -1;
      min_d = INFTY;

      for(i=0;i<n;i++)
	{
	  if(color[i] == GRAY && d[i] < min_d)
	    {
	      min_d = d[i];
	      vertex = i;
	    }
	}
      if(vertex == -1)break;
      color[vertex] = BLACK;
  

      for(i=0;i<n;i++)
	{
	  if(color[i] != BLACK && M[vertex][i]< INFTY)
	    {
	      color[i] = GRAY;
	      if(d[i] > d[vertex] + M[vertex][i])
		{
		  d[i] = d[vertex] + M[vertex][i];
		}
	    }
	}
    }
}
	       


int main()
{
  int n,i,j,v,u,k,c,d[N],M[N][N];
  scanf("%d",&n);
  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      M[i][j] = INFTY;
    }
  }


  for(i=0;i<n;i++)
    {
      scanf("%d %d",&u,&k);
      for(j=0;j<k;j++)
	{
	  scanf("%d %d",&v,&c);
	  M[u][v] = c;
	}
    }
 
  dij(n,d,M);
  for(i=0;i<n;i++)
    {
      printf("%d %d\n",i,d[i]);
    }
  return 0;
}


/*void dij()
{
  int min,d[MAX],color[MAX],u,v,i;


  for(i=0;i<n;i++)
    {
      d[i] = 100000;
      color[i] = WHITE;
    }
  d[0] = 0;
  color[0] = GRAY;
   while(1)
    {
      min = 100000;
      u=-1;
      for(i=0;i<n;i++)
	{
	  if(color[i] != BLACK && d[i] < min)
	    {
	      min = d[i];
	      u=i;
	    }
	}
      if(u == -1) break;
      color[u] = BLACK;
      for(v=0;v<n;v++)
	{
	  if(color[v] != BLACK && M[u][v] != 100000)
	    {
	      if(d[v] > d[u] +M[u][v])
		{
		  d[v] = d[u] + M[u][v];
		  color[v] = GRAY;
		}
	    }
	}
    }
  

  for(i=0;i<n;i++)
    {
      printf("%d ",i);
      if(d[i] == 100000) printf("-1\n");
      else printf("%d\n",d[i]);
    }
    }*/



Measured memory_bytes: 2052
#![allow(unused_imports)]

use text_io::*;
use proconio::*;
use std::collections::*;
use itertools::Itertools;
use std::process::exit;
use std::cmp::*;
use num::*;
use num::integer::Roots;

fn main() {
    input! {
    a:[usize;6],
    }
    let mut v=[0,0,0,0];
    for i in 0..6{
        v[a[i]-1]+=1;
        if v[a[i]-1]>2 {println!("NO");exit(0)}
    }
    println!("YES")
}

Measured memory_bytes: 2084
#include <stdio.h>
#include <math.h>

int j;


void compute(int depth,double x1,double y1,double x2,double y2)
{
  double sin60 = sqrt(3.0)/2.0;
  double cos60 = 0.5;

  double sx = (x1+x1+x2)/3.0;
  double sy = (y1+y1+y2)/3.0;
  double tx = (x1+x2+x2)/3.0;
  double ty = (y1+y2+y2)/3.0;

  double vx = tx-sx;
  double vy = ty-sy;

  double ux = sx + cos60*vx - sin60*vy;


  double uy = sy + sin60*vx + cos60*vy;

  if(depth>= j) return;

  compute(depth +1,x1,y1,sx,sy);
  printf("%.8f %.8f\n",sx,sy);
 compute(depth +1,sx,sy,ux,uy);
  printf("%.8f %.8f\n",ux,uy);
  compute(depth+1,ux,uy,tx,ty);
  printf("%.8f %.8f\n",tx,ty);
  compute(depth+1,tx,ty,x2,y2);
}


int main(void)
{
  scanf("%d",&j);
  printf("%.8f %.8f\n",0.0,0.0);
  compute(0,0.0,0.0,100.0,0.0);
  printf("%.8f %.8f\n",100.0,0.0);
  return 0;
}



Measured memory_bytes: 2736
n = int(input())
s = input()
t = input()

moji = ""
flag = True

for i in range(n):
    if flag == False:
        flag = True
        continue
    if s[i] != t[i]:
        moji += "A"
        flag = False
    else:
        moji += "B"

if moji[0] == "A":
    now = 6
else:
    now = 3

l = len(moji)
mod = 10**9+7

for i in range(1,l):
    if moji[i-1] == "A" and moji[i] == "A":
        now *= 3
        now %= mod
    elif moji[i-1] == "A" and moji[i] == "B":
        continue
    elif moji[i-1] == "B" and moji[i] == "A":
        now *= 2
        now %= mod
    else:
        now *= 2
        now %= mod

print(now%mod)

Measured memory_bytes: 3064
#include <cstdio>
#include <set>
#define repi(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,a) repi(i,0,a)
#define all(a) (a).begin(), (a).end()

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

int N;
int A[200010];
std::set<int> S;

int main()
{
  scanf( "%d", &N );
  rep( i, N )
    scanf( "%d", A+i ), S.insert(A[i]);

  puts( S.size()==N ? "YES" : "NO" );

  return 0;
}

Measured memory_bytes: 10368
package main

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

func brickBreak(n int, a []int) int {
	c, j := 0, 1
	for i := 0; i < n; i++ {
		if a[i] != j {
			c++
		} else {
			j++
		}
	}
	if c == n {
		return -1
	}
	return c
}

func main() {
	reader := bufio.NewReaderSize(os.Stdin, 10240*10240)

	n, err := strconv.Atoi(readLine(reader))
	checkError(err)
	a := make([]int, n)
	ss := strings.Split(readLine(reader), " ")
	for i := range ss {
		a[i], err = strconv.Atoi(ss[i])
		checkError(err)
	}
	fmt.Println(brickBreak(n, a))
}

func readLine(reader *bufio.Reader) string {
	str, _, err := reader.ReadLine()
	if err == io.EOF {
		return ""
	}

	return strings.TrimRight(string(str), "\r\n")
}

func checkError(err error) {
	if err != nil {
		panic(err)
	}
}


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

int main(){
	int n; cin>>n;
	cout<<(n % 2 ? (n+1)/2 - 1 : n/2 - 1);
	return 0;
}

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

using namespace std;

int main() {
  int N, M;
  scanf("%d%d", &N, &M);
  char S[100000], T[100000];
  scanf("%s%s", S, T);
  
  // 最大公約数を計算
  int g = __gcd(N, M);
  int stepS = N / g;
  int stepT = M / g;
  for (int i = 0; i < g; ++i) {
    if (S[stepS * i] != T[stepT * i]) {
      cout << -1 << '\n';
      return 0;
    }
  }
  cout << (long long) N / g * M << '\n';
  return 0;
}


Measured memory_bytes: 384
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; ++i)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = int64_t;
using P = pair<int, int>;
using vs = vector<string>;
using vi = vector<int>;
using vvi = vector<vi>;
const int INF = 100010001;
const ll LINF = (ll)INF*INF*10;

int main() {
    int n, m;
    cin >> n >> m;
    int k;
    cin >> k;

    rep(i, n+1) {
        rep(j, m+1) {
            int x;
            x = i*j + (n-i)*(m-j);
            if(x == k) {
                cout << "Yes" << endl;
                return 0;
            }
        }
    }

    cout << "No" << endl;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Xml.Schema;

namespace Contest
{
    class Scanner
    {
        private string[] line = new string[0];
        private int index = 0;
        public string Next()
        {
            if (line.Length <= index)
            {
                line = Console.ReadLine().Split(' ');
                index = 0;
            }
            var res = line[index];
            index++;
            return res;
        }
        public int NextInt()
        {
            return int.Parse(Next());
        }
        public long NextLong()
        {
            return long.Parse(Next());
        }
        public ulong NextUlong()
        {
            return ulong.Parse(Next());
        }
        public string[] Array()
        {
            line = Console.ReadLine().Split(' ');
            index = line.Length;
            return line;
        }
        public int[] IntArray()
        {
            var array = Array();
            var result = new int[array.Length];
            for (int i = 0; i < array.Length; i++)
            {
                result[i] = int.Parse(array[i]);
            }

            return result;
        }
        public long[] LongArray()
        {
            var array = Array();
            var result = new long[array.Length];
            for (int i = 0; i < array.Length; i++)
            {
                result[i] = long.Parse(array[i]);
            }

            return result;
        }
    }

    struct S
    {
        public int X, Y, H;
    }

    class Program
    {
        private int N, M;
        private string S, T;
        private void Scan()
        {
            var sc = new Scanner();
            N = sc.NextInt();
            M = sc.NextInt();

            S = sc.Next();
            T = sc.Next();
        }

        public void Solve()
        {
            Scan();
            long lcm = LCM(N, M);
            long nn = lcm / N;
            long mm = lcm / M;
            long llccmm = LCM(nn, mm);
            for (long i = 0; i < lcm; i += llccmm)
            {
                if (S[(int)(i / nn)] != T[(int)(i / mm)])
                {
                    Console.WriteLine(-1);
                    return;
                }
            }
            Console.WriteLine(lcm);
        }


        public long LCM(long a, long b)
        {
            return a * b / GCD(a, b);
        }

        public long GCD(long a, long b)
        {
            while (b > 0)
            {
                var r = b;
                b = a % b;
                a = r;
            }
            return a;
        }

        static void Main() => new Program().Solve();
    }
}

Measured memory_bytes: 13920
#include <stdio.h>

#define abs(x, y) ((x) > (y) ? (x) - (y) : (y) - (x))
#define atoi(x) ((x) - '0')
#define min(x, y) ((x) > (y) ? (y) : (x))

int main(){
  double h, m, angle, s, l;
  char t[8];
  int n;
  scanf("%d", &n);
  while(n--){
    scanf("%s", t);
    h = atoi(t[0]) * 10 + atoi(t[1]);
    m = atoi(t[3]) * 10 + atoi(t[4]);
    s = h * 30 + m / 2;
    l = m * 6;
    angle = abs(s, l);
    if(angle > 180) angle = 360 - angle;
    if(angle < 30) puts("alert");
    else if(angle < 90) puts("warning");
    else puts("safe");
  }
  return 0;
}

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

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

using namespace std;

int main(){
	int n; cin>>n;
	string ans;
	do{
		if(n%2!=0) n--, ans='1'+ans;
		else       ans='0'+ans;
		n/=-2;
	}while(n!=0);
	cout<<ans<<endl;

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <iomanip>
#include <numeric>
#include <queue>
#include <cmath>
using namespace std;


int main() {
    int t;
    cin >> t;
    for (int tt = 0; tt < t; tt++) {
        long long int a, b, c, d;
        cin >> a >> b >> c >> d;
        if (a < b || b > d) {
            cout << "No" << endl;
            continue;
        }

        // [c + 1, b - 1]

        long long int bd = gcd(b, d);
        if (c + 1 > b - 1) {
            cout << "Yes" << endl;
            continue;
        }
        if (a >= c + 1 && a <= b - 1) {
            cout << "No" << endl;
            continue;
        }
        a = (a - b) % bd + b;
        a -= bd;
        if (a <= b - 1 && a >= c + 1) {
            cout << "No" << endl;
        } else {
            cout << "Yes" << endl;
        }
    }
}




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

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

    double r;
    cin >> r;
    double circle = 3.14159265358979 * r * r, length = 3.14159265358979 * 2 * r;
    printf("%.8lf %.8lf\n", circle, length);

    return 0;
}


Measured memory_bytes: 3164
fun main(args: Array<String>) {
    val s = readLine()!!.toCharArray().sorted()
    val t = readLine()!!.toCharArray().sortedDescending()
    val min = Math.min(s.size, t.size)
    for (i in 0 until min) {
        if (s[i].toInt() == t[i].toInt()) {
            continue
        }

        if (s[i].toInt() < t[i].toInt()) {
            println("Yes")
            return
        }
        if (s[i].toInt() > t[i].toInt()) {
            println("No")
            return
        }
    }
    if (s.size < t.size) {
        println("Yes")
    } else {
        println("No")
    }
}



Measured memory_bytes: 35804
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int n = getInt(sc);
		int m = getInt(sc);

		if (n == m) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}

	}

	/**
	 * *汎用メソッド<br>
	 * 入力した配列に対する順列を取得
	 *
	 * @param numArray
	 * @return
	 */
	private static List<Integer[]> getPermutation(int[] numArray) {
		List<Integer[]> permutation = new ArrayList<>();
		Integer[] ans = new Integer[numArray.length];
		boolean[] used = new boolean[numArray.length];

		return buildPermutaion(permutation, numArray, ans, used, 0);
	}

	/**
	 * *汎用メソッド(内部)<br>
	 * 入力した配列に対する順列を作成
	 *
	 * @param list
	 * @param numArray
	 * @param ans
	 * @param used
	 * @param depth
	 * @return
	 */
	private static List<Integer[]> buildPermutaion(List<Integer[]> list, int[] numArray, Integer[] ans, boolean[] used,
			int depth) {

		// 全部使い切った時=>できた順列を返す
		if (depth == numArray.length) {
			list.add(ans.clone());
			return list;
		}
		// 使い切っていない場合

		for (int i = 0; i < numArray.length; i++) {
			if (used[i]) {
				continue;
			}
			ans[depth] = numArray[i];
			used[i] = true;
			list = buildPermutaion(list, numArray, ans, used, depth + 1);

			used[i] = false;
		}

		return list;
	}

	/**
	 * *汎用メソッド <br>
	 * スキャナーからの入力値をlongで返却
	 *
	 * @return
	 */
	public static long getLong(Scanner sc) {

		return Long.parseLong(sc.next());
	}

	/**
	 * *汎用メソッド <br>
	 * スキャナーからの入力値をintで返却
	 *
	 * @return
	 */
	public static int getInt(Scanner sc) {

		return Integer.parseInt(sc.next());
	}

	/**
	 * *汎用メソッド <br>
	 * スキャナーからの入力値をStringで返却
	 *
	 * @return
	 */
	public static String getString(Scanner sc) {

		return sc.next();
	}

	/**
	 * *汎用メソッド <br>
	 * スキャナーからの入力値をint配列で返却
	 *
	 * @return
	 */
	public static int[] getIntArray(Scanner sc) {
		String line = "";
		// 直前にnext()を実行していると改行コードだけ取ってしまうのでその対策
		while (line.equals("")) {
			line = sc.nextLine();
		}

		String[] strArray = line.split(" ");
		int[] intArray = new int[strArray.length];
		for (int i = 0; i < strArray.length; i++) {
			intArray[i] = Integer.parseInt(strArray[i]);
		}
		return intArray;
	}

}

class Status {
	long x;
	long tmpCoins;

	public Status(long x, long tmpCoins) {
		this.x = x;
		this.tmpCoins = tmpCoins;
	}
}


Measured memory_bytes: 23764
#include<stdio.h>
int main(void){
int a;
int b[200];
scanf("%d",&a);
for(int i=0;i<a;i++){
    scanf("%d",&b[i]);
}
int sum=1;
int c=0;
c=b[0];
for(int i=1;i<a;i++){
  if(b[i]>=c){
    sum+=1;
  }
    if(c<b[i]){
    c=b[i];
  }
}
printf("%d",sum);
return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
typedef long long ll;
#define mod 1000000007

using namespace std;

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

    // code comes here
   int k,n;
   cin>>k>>n;
   
   vector<int> arr;
   for(int i=0;i<n;i++)
   {
       int d;
       cin>>d;
       arr.push_back(d);
   }
   
   vector<int> a2;
   for(int i=0;i<n;i++)
   {
       a2.push_back(arr[i]-k);
   }
   for(int i=0;i<n;i++)
   {
       a2.push_back(arr[i]);
   }
   
   int i=0,j=n-1;
   int m=INT_MAX;
   int fff=a2.size();
   while(j<fff)
   {
       m=min(m,a2[j]-a2[i]);
       i++;
       j++;
   }
   cout<<m<<endl;
   
   
    


    return 0;
}





Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, a, b) for (int i = a; i < b; i++)
#define all(v) v.begin(), v.end()
#define mod 1000000007
//'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122

int main() {
    string s;
    cin >> s;
    int ans = 0;
    int len = s.size();
    for (int i = 0; i < len; i++) {
        int l = 0;
        for (int j = i; j < len; j++) {
            if (s[j] == 'A' || s[j] == 'C' || s[j] == 'G' || s[j] == 'T') {
                l++;
            } else break;
        }
        ans = max(ans, l);
    }

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


Measured memory_bytes: 256
N,M,C=map(int,input().split())
Bs=[int(b) for b in input().split()]

c=0
for n in range(N):
    As=[int(a) for a in input().split()]
    r = sum([a*b for a,b in zip(As,Bs)]) + C
    if r>0:
        c+=1
    #print(r)
print(c) 

Measured memory_bytes: 3060
#include<cstdio> 
#include<cstring>
#include<iostream> 
#include<algorithm>
#include<cmath>
using namespace std;
long long a[100010],b[100010];
int main()
{
	long long n,sum=0,i;
	cin>>n;
	for(i=1;i<=n+1;i++)
	cin>>b[i];
	for(i=1;i<=n;i++)
	cin>>a[i];
	for(i=1;i<=n;i++){
		if(a[i]>=b[i]){
			sum+=b[i];
			a[i]-=b[i];
			if(a[i]>=b[i+1]){
				sum+=b[i+1];
				b[i+1]=0;
			}
			else {
				b[i+1]-=a[i];
				sum+=a[i];
			}
		}
		else sum+=a[i];
	}
	cout<<sum;
	return 0;
} 

Measured memory_bytes: 1792
#[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")
    };
}

fn main() {
    input! {
        n: usize,
        p: [usize; n],
    }
    let mut count = 0;
    for i in 2..n {
        if (p[i - 2] < p[i - 1] && p[i - 1] < p[i]) || (p[i - 2] > p[i - 1] && p[i - 1] > p[i]) {
            count += 1;
        }
    }
    println!("{}", count);
}


Measured memory_bytes: 4352
#include <stdio.h>
#include <string.h>
int main(void){
	char s[101];
	char k[101];
	char ans;
	scanf("%s",&s);
	scanf("%s",&k);
	if( strlen(k)>2){
		//kは100より大きい
		/*sを0から100まで見ていってずっと1だったら1を出力し、
		1以外の数値が来たらそれを出力する*/
		for(int i=0;i<100;i++){
			if( s[i] !='1'){
				printf("%c",s[i]);
				return 0;
			}
		}
		printf("1");
		return 0;
	}else{
		//kは100より小さい
		/*kを文字列から数字に直し、sを左からk番まで見ていって
		ずっと1だったら1を出力し、1以外の数値が来たらそれを出力する
		*/
		int x1=0;
		int x2=0;
		if (strlen(k)>1){
			x2 = k[1]-'0';
		}
		x1 = k[0]-'0';
		int x = x2*10 + x1;
		//printf("x = %d\n",x);
		for(int i=0;i<x;i++){
			if( s[i] !='1'){
				printf("%c",s[i]);
				return 0;
			}
		}
		printf("1");
		return 0;
	}
	return 0;
}

Measured memory_bytes: 128
import java.util.Scanner;
class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String[] lines = sc.nextLine().split(" ");
        System.out.println(Math.max(Integer.parseInt(lines[0]), Integer.parseInt(lines[2])) == Math.min(Integer.parseInt(lines[2]), Integer.parseInt(lines[1])) ? "Yes" : "No");
    }
}


Measured memory_bytes: 21972
import java.util.Arrays;
import java.util.Scanner;
public class Main {
public static void main(String[]srgs) {
	Scanner scan=new Scanner(System.in);
	long a[]= {scan.nextInt(),scan.nextInt(),scan.nextInt()};
	long ans=0;
	Arrays.sort(a);
	if(a[0]%2==0||a[1]%2==0||a[2]%2==0) {
		ans=0;
	}
	else {
		ans=a[0]*a[1];
	}
	System.out.println(ans);
	}
}


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

#define int long long
#define MOD 1000000007

int n, k;

int kai[100010];
int rkai[100010];

int a[100010];

int pow_mod(int i, int j){
    int ans = 1;
    while(j > 0){
        if(j & 1) ans = (ans * i) % MOD;
        i = i * i % MOD;
        j >>= 1;
    }
    return ans;
}

int combi(int n, int r){
    if(n < r) return 0;
    return kai[n] * rkai[r] % MOD * rkai[n-r] % MOD;
}

signed main(){
    cin >> n >> k;

    kai[0] = 1;
    rkai[0] = 1;

    for(int i = 1;i < 100010;i++) kai[i] = (kai[i-1] * i) % MOD;
    for(int i = 1;i < 100010;i++) rkai[i] = (rkai[i-1] * pow_mod(i, MOD-2)) % MOD;

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

    int ans = 0;

    sort(a, a+n);

    for(int i = 0;i < n;i++){
        ans = (ans + a[i] * combi(i, k-1) % MOD) % MOD;
        ans = (MOD + ans + (- a[i] * combi(n-(i+1), k-1)) % MOD) % MOD;
    }

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


Measured memory_bytes: 2560
n,k = list(map(int,input().split()))
h = list()

for i in range(0,n):
  h.append(int(input()))
h.sort()

d= h[k-1]-h[0]

for i in range(k,n):
  d = min(d,h[i]-h[i-k+1])
print(d)

Measured memory_bytes: 7384
#include <iostream>

using namespace std;

int main(){
	int i,n,m,x,y,ans=0;
	cin >> n >> m;
	bool b[100010];
	int c[100010];
	for(i=1;i<=n;i++){
		b[i] = false;
		c[i] = 1;
	}
	b[1] = true;
	
	for(i=0;i<m;i++){
		cin >> x >> y;
		c[x]--;
		c[y]++;
		if(b[x]){
			b[y] = true;
		}
		if(c[x]==0){
			b[x] = false;
		}
	}
	
	for(i=1;i<=n;i++){
		if(b[i]){
			ans += 1;
		}
	}
	
	cout << ans << endl;
}
			
		
		
		

Measured memory_bytes: 768
import java.util.Arrays;

public class Main {


  private static void solve() {
    int n = ni();
    long w = nl();
    int[][] p = ntable(n, 2);
    
    int vmax = 100010;
    long[][] dp = new long[n + 1][vmax];
    for (long[] v : dp) Arrays.fill(v, Long.MAX_VALUE / 2);
    dp[0][0] = 0;

    for (int i = 0; i < n; i ++) {
      for (int j = 0; j < vmax; j ++) {
        dp[i + 1][j] = Math.min(dp[i + 1][j], dp[i][j]);
        if (j - p[i][1] >= 0)
          dp[i + 1][j] = Math.min(dp[i + 1][j], dp[i][j - p[i][1]] + p[i][0]);
      }
    }
    long ret = 0;
    for (int i = 0; i < vmax; i ++) {
      if (dp[n][i] <= w)
        ret = Math.max(ret, i);
    }
    System.out.println(ret);
  }

  public static void main(String[] args) {
    new Thread(null, new Runnable() {
      @Override
      public void run() {
        long start = System.currentTimeMillis();
        String debug = args.length > 0 ? args[0] : null;
        if (debug != null) {
          try {
            is = java.nio.file.Files.newInputStream(java.nio.file.Paths.get(debug));
          } catch (Exception e) {
            throw new RuntimeException(e);
          }
        }
        reader = new java.io.BufferedReader(new java.io.InputStreamReader(is), 32768);
        solve();
        out.flush();
        tr((System.currentTimeMillis() - start) + "ms");
      }
    }, "", 64000000).start();
  }

  private static java.io.InputStream is = System.in;
  private static java.io.PrintWriter out = new java.io.PrintWriter(System.out);
  private static java.util.StringTokenizer tokenizer = null;
  private static java.io.BufferedReader reader;

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

  private static double nd() {
    return Double.parseDouble(next());
  }

  private static long nl() {
    return Long.parseLong(next());
  }

  private static int[] na(int n) {
    int[] a = new int[n];
    for (int i = 0; i < n; i++)
      a[i] = ni();
    return a;
  }

  private static char[] ns() {
    return next().toCharArray();
  }

  private static long[] nal(int n) {
    long[] a = new long[n];
    for (int i = 0; i < n; i++)
      a[i] = nl();
    return a;
  }

  private static int[][] ntable(int n, int m) {
    int[][] table = new int[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[i][j] = ni();
      }
    }
    return table;
  }

  private static int[][] nlist(int n, int m) {
    int[][] table = new int[m][n];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[j][i] = ni();
      }
    }
    return table;
  }

  private static int ni() {
    return Integer.parseInt(next());
  }

  private static void tr(Object... o) {
    if (is != System.in)
      System.out.println(java.util.Arrays.deepToString(o));
  }
}


Measured memory_bytes: 126160
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <vector>
#include <algorithm>
#include <string>

using namespace std;

int min( int p, int q ) {
	if( p > q ) return q;
	return p;
}

int max( int p, int q ) {
	if( p > q ) return p;
	return q;
}

int main(void){

	int a, b, c, d, p;
	cin >> a >> b >> c >> d >> p;
	cout << min( a * p, max( 0, p - c ) * d + b ) << endl;

    return 0;
}

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

int main() {
  int N, M; cin >> N >> M;
  map<int, int> C;
  for (int i = 0; i < 2 * M; i++) {
    int v; cin >> v;
    if (C.count(v)) C[v]++;
    else C[v] = 1;
  }
  for (auto p : C) {
    if (p.second % 2 != 0) {
      cout << "NO" << endl;
      return 0;
    }
  }
  cout << "YES" << endl;
}

Measured memory_bytes: 4352
#include <algorithm>
#include <iostream>

using namespace std;

enum Action {
  A = 0,
  B,
  C,
};

int v[3][100000];
int dp[3][100000];

int main() {
  int N;
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> v[0][i] >> v[1][i] >> v[2][i];
  }
  for (auto&& a : {A, B, C}) {
    dp[a][0] = v[a][0];
  }
  for (int i = 1; i < N; i++) {
    dp[A][i] = max(dp[B][i - 1], dp[C][i - 1]) + v[A][i];
    dp[B][i] = max(dp[A][i - 1], dp[C][i - 1]) + v[B][i];
    dp[C][i] = max(dp[A][i - 1], dp[B][i - 1]) + v[C][i];
  }
  const auto ans = max({dp[A][N - 1], dp[B][N - 1], dp[C][N - 1]});
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 5968
import sys
# from collections import deque, defaultdict, Counter
# from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, log2
# from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

H, W = MAP()
S = [input() for _ in range(H)]

L = [[0]*W for _ in range(H)]
R = [[0]*W for _ in range(H)]
D = [[0]*W for _ in range(H)]
U = [[0]*W for _ in range(H)]

for i in range(H):
	for j in range(W):
		if S[i][j] == '#':
			L[i][j] = 0
		elif j == 0:
			L[i][j] = 1
		else:
			L[i][j] = L[i][j-1] + 1

for i in range(H):
	for j in range(W-1, -1, -1):
		if S[i][j] == '#':
			R[i][j] = 0
		elif j == W-1:
			R[i][j] = 1
		else:
			R[i][j] = R[i][j+1] + 1

for i in range(H):
	for j in range(W):
		if S[i][j] == '#':
			U[i][j] = 0
		elif i == 0:
			U[i][j] = 1
		else:
			U[i][j] = U[i-1][j] + 1

for i in range(H-1, -1, -1):
	for j in range(W):
		if S[i][j] == '#':
			D[i][j] = 0
		elif i == H-1:
			D[i][j] = 1
		else:
			D[i][j] = D[i+1][j] + 1

ans = 0
for i in range(H):
	for j in range(W):
		ans = max(ans, L[i][j]+R[i][j]+U[i][j]+D[i][j]-3)

print(ans)


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

using namespace std;
using ll=long long;
using ull=unsigned long long;
using pii=pair<int,int>;

#define INF LONG_MAX
#define MOD 1000000007
#define rng(a) a.begin(),a.end()
#define rrng(a) a.end(),a.begin()

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

  int X,Y;
  cin>>X>>Y;
  if(X<Y)cout<<X<<endl;
  else{
    if(X%Y==0)cout<<-1<<endl;
    else cout<<X<<endl;
  }
  return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define MOD 1000000007
#define INF (1<<30)
#define LINF (lint)(1LL<<56)
#define endl "\n"
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define reprev(i,n) for(int (i)=(n-1);(i)>=0;(i)--)
#define Flag(x) (1<<(x))
#define Flagcount(x) __builtin_popcount(x)
#define pint pair<int,int>
#define pdouble pair<double,double>
#define plint pair<lint,lint>
#define fi first
#define se second
typedef long long lint;
int dx[8]={1,1,0,-1,-1,-1,0,1};
int dy[8]={0,1,1,1,0,-1,-1,-1};

int main(void){
    lint H,W,K;
    cin >> H >> W >> K;
    lint h=H-1;
    char S[H][W];
    rep(i,H) cin >> S[i];
    lint ans=INF;
    rep(i,(1<<h)){
        lint count=Flagcount(i);
        lint scount=count;
        lint cut[count+1]={}; //分割の個数
        lint now[H]={}; //iが何個目の分割か
        now[0]=0;
        for(int j=1;j<H;j++){
            int q=j-1;
            if(i&(1<<q)) now[j]=now[j-1]+1;
            else now[j]=now[j-1];
        }
        rep(j,W){
            rep(k,H) if(S[k][j]=='1') cut[now[k]]++;
            rep(k,scount+1){
                if(cut[k]>K){
                    count++;
                    rep(l,scount+1) cut[l]=0;
                    rep(l,H) if(S[l][j]=='1') cut[now[l]]++;
                    rep(l,scount+1) if(cut[l]>K) count=INF;
                    break;
                }
            }
        }
        rep(j,scount+1){
            if(cut[j]>K){
                count++;
                break;
            }
        }
        ans=min(ans,count);
        lint count2=Flagcount(i);
        lint scount2=count2;
        lint cut2[count2+1]={}; //分割の個数
        lint now2[H]={}; //iが何個目の分割か
        now2[0]=0;
        for(int j=1;j<H;j++){
            int q=j-1;
            if(i&(1<<q)) now2[j]=now2[j-1]+1;
            else now2[j]=now2[j-1];
        }
        reprev(j,W){
            rep(k,H) if(S[k][j]=='1') cut2[now[k]]++;
            rep(k,scount2+1){
                if(cut2[k]>K){
                    count2++;
                    rep(l,scount2+1) cut2[l]=0;
                    rep(l,H) if(S[l][j]=='1') cut2[now[l]]++;
                    rep(l,scount2+1) if(cut2[l]>K) count2=INF;
                    break;
                }
            }
        }
        rep(j,scount2+1){
            if(cut2[j]>K){
                count2++;
                break;
            }
        }
        ans=min(ans,count2);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
	int r,c,num[101][101],i,j;
	int yoko[101],tate[101];
	int tans=0,yans=0;
	cin>>r>>c;
	for(i=0;i<r;i++){
		for(j=0;j<c;j++){
			cin>>num[i][j];
		}
	}
	for(i=0;i<r;i++){
		for(j=0;j<c;j++){
			tans=tans+num[i][j];
		}
		num[i][c]=tans;
		tans=0;
	}
	for(j=0;j<c;j++){
		for(i=0;i<r;i++){
			yans=yans+num[i][j];
		}
		num[r][j]=yans;
		yans=0;
	}
	for(j=0;j<c;j++){yans=yans+num[r][j];}
	num[r][c]=yans;
	for(i=0;i<=r;i++){
		for(j=0;j<=c;j++){
			if(j==c){
				cout<<num[i][j];
			}else{
		    	cout<<num[i][j]<<" ";
			}
		}
		cout<<endl;
	}
	return 0;
}

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

using namespace std;
typedef long long ll;
typedef pair<int,int> P;

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

	int K; cin >> K;

	vector<P> G[100005];

	for (int i = 0;i < K;i++){
		G[i].push_back(P((i+1)%K, 1));
		G[i].push_back(P((i*10)%K, 0));
	}

	int dist[100005]; fill(dist,dist+K,INT_MAX);
	priority_queue<P, vector<P>, greater<P> > que; // cost, node
	que.push(P(1,1));
	dist[1] = 1;

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

	cout << dist[0] << endl;

	return 0;

}


Measured memory_bytes: 6780
#include <bits/stdc++.h>
using namespace std;
//typedef long long ll;
#include <boost/multiprecision/cpp_int.hpp>
typedef boost::multiprecision::cpp_int ll;
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;
ll inf=(ll)1E17;

#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);
///////////////////////////////////////

vector<ll> add(ll k){
    vector<ll>res;
    for(ll i=1;i*i<=k;i++){
        if(k%i==0){
            res.pb(i);res.pb(k/i);
        }
    }
    return res;
}

int main(){fastio
    ll n;cin>>n;
    vector<ll> a;
    rep(i,0,n-1){
        ll k;cin>>k;a.pb(k);
    }
    vector<ll>v,vv;
    v=add(a[0]);vv=add(a[1]);
    for(auto x:vv)v.pb(x);
    ll ans=0;
    for(auto x:v){
        ll count=0;
        for(auto y:a){
            if(y%x!=0){
                count++;
            }
        }
        if(count<=1)Max(ans,x);
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 5872
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = a; i < n; i++)
#define repr(i, a, n) for (int i = n - 1; i >= a; i--)
using namespace std;
using ll = long long;
using P = pair<int, int>;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }

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

  int n;
  string s;
  cin >> n >> s;

  int ans = 0;
  rep(i, 0, 10) {
    rep(j, 0, 10) {
      rep(k, 0, 10) {
        string x = to_string(i) + to_string(j) + to_string(k);
        int c = 0;
        rep(v, 0, n) {
          if (s[v] == x[c])
            c++;
          if (c == 3) {
            ans++;
            break;
          }
        }
      }
    }
  }

  cout << ans << endl;
}


Measured memory_bytes: 384
// Problem : C - One Quadrillion and One Dalmatians
// Contest : AtCoder - AtCoder Beginner Contest 171
// URL : https://atcoder.jp/contests/abc171/tasks/abc171_c
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>
#define int long long
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define vi vector<int>
#define vstr vector<string>
#define vdb vector<double>
#define vbool vector<bool>
#define vvi vector<vector<int> >
#define mii map<int,int>
#define pb push_back
#define pii pair<int,int>
#define vpair vector<pii > 
#define mkp make_pair
#define scan(a,n) for(int i =0 ; i<n ; i++) cin>>a[i]
#define print(a,n) for(int i = 0 ; i < n ; i++) {cout<<a[i]<<' ';}cout<<'\n'
#define mem(a,v) memset(a,v,sizeof(a))
#define loop(i,a,b) for (int i = a; i < b; i++)
#define loope(i,a,b) for (int i = a; i <= b; i++)
#define bloop(i,a,b) for(int i = a;i>=b;i--)
#define FastIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define PRECISION std::cout.unsetf ( std::ios::fixed );std::cout.precision(9)
#define PI 3.14159265
#define S second
#define F first
#define CHECK cout<<"CHEDEDWB"<<endl
#define CHECK1(a) cout<<a<<endl
#define CHECK2(a,b) cout<<a<<' '<<b<<endl;
#define br '\n'
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(),x.end()
using namespace std;
int mod = 1e9+7;
int inf = 1e18;
int m_inf = INT_MIN;
// int extendedgcd(int a,int b,int &x,int &y){
	// if(a == 0){
		// x = 0; y = 1;
		// return b;
	// }
	// int x1,y1;
	// int d = extendedgcd(b%a,a,x1,y1);
	// x = y1 - (b/a)*x1;y = x1;
	// return d;
// }
// int expmod(int a,int b) {
// 	if(b == 1) return a;
// 	if(b == 0) return 1;
// 	int m1 = expmod(a,b/2)%mod;
// 	if(b%2) return ((m1*m1)%mod*a%mod)%mod;
// 	return (m1*m1)%mod;
// }
// int power(int a,int b) {
// 	if(b == 1) return a;
// 	if(b == 0) return 1;
// 	int m1 = power(a,b/2);
// 	if(b%2) return m1*m1*a;
// 	return m1*m1;
// }
// int logn(int n, int r) 
// { 
//     return (n > r - 1) ? 1 + logn(n / r, r) : 0; 
// } 

// int nCr(int n,int r)
// {
	// r = min(r,n-r);
	// if(r<0)
		// return 0;
	// if(r == 0)
		// return 1;
	// int ans = 1;
	// for(int i = 1;i<=r;i++)
	// {
		// ans = ans*(n-i+1)/i;
	// }
	// return ans;
// 		
// }
// vi factmod(int n)
// {
	// vi ans(n+1);
	// ans[0] = 1;
	// loop(i,1,n+1)
	// {
		// ans[i] = (ans[i-1]*i)%mod;
	// }
	// return ans;
// }
// int nCrmod(int n,int r,vi &fact)
// {
	// int x1,y1;
	// extendedgcd(fact[r],mod,x1,y1);
	// int x2,y2;
	// extendedgcd(fact[n-r],mod,x2,y2);
	// int ans = (fact[n]*((x1+mod)%mod))%mod;
	// ans = (ans*((x2+mod)%mod))%mod;
	// return ans;
// }

// void dfs(vector<vector<int> > &adj,int root,vbool &vis)
// {
// 	vis[root] = true;
// 	for(int i = 0;i<adj[root].size();i++){
// 		int v = adj[root][i];
// 		if(!vis[v])		
// 			dfs(adj,v,vis);
// 	}
// }

int32_t main() 
{
	FastIO; PRECISION;
	int t = 1;
	// cin>>t;
	while(t--)
	{
		int n;
		cin>>n;
		n--;
		string ans;
		while(n>=0)
		{
			ans+=((int)'a'+(n%26));
			n/=26;
			n--;
		}
		reverse(all(ans));
		cout<<ans<<'\n';
		
	}
}

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

using namespace std;

int main(){

    int N;
    cin >> N;
    vector<int> A(N);
    for(int i = 0; i < N; i++) cin >> A.at(i);

    vector<int> order(N);
    for(int i = 0; i < N; i++) order.at(A.at(i) - 1) = i + 1;

    for(int i = 0; i < N; i++) cout << order.at(i) << " "; cout << endl;

    return 0;
}

Measured memory_bytes: 1664
import java.io.*;
import java.util.*;

public class Main {

    static class InputReader {
        BufferedReader reader;
        StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null; }
        String next() { while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try { tokenizer = new StringTokenizer(reader.readLine()); } 
                catch (IOException e) { throw new RuntimeException(e);} }
            return tokenizer.nextToken(); }
        public int nextInt() { return Integer.parseInt(next()); }
        public long nextLong() { return Long.parseLong(next()); }
        public double nextDouble() { return Double.parseDouble(next()); }
    }

    static InputReader r = new InputReader(System.in);
    static PrintWriter pw = new PrintWriter(System.out);

    public static void main(String[] args) {
        
        int n = r.nextInt(); // # players
        int k = r.nextInt(); // # starting points
        int q = r.nextInt(); // # total correct answers
        
        int[] players = new int[n+1]; // counts number correct for each playert
        for(int i = 1; i <= q; i++){
            players[r.nextInt()]++;
        }
        for(int i = 1; i <= n; i++){
            pw.println((k - q + players[i] > 0) ? "Yes" : "No");
        }

        pw.close();
    }
}

/**
                _        _                 _                                                
               | |      | |               | |                                               
   ___ ___   __| | ___  | |__  _   _    __| | __ _ _ __ _ __ ___ _ __     _   _  __ _  ___  
  / __/ _ \ / _` |/ _ \ | '_ \| | | |  / _` |/ _` | '__| '__/ _ \ '_ \   | | | |/ _` |/ _ \ 
 | (_| (_) | (_| |  __/ | |_) | |_| | | (_| | (_| | |  | | |  __/ | | |  | |_| | (_| | (_) |
  \___\___/ \__,_|\___| |_.__/ \__, |  \__,_|\__,_|_|  |_|  \___|_| |_|   \__, |\__,_|\___/ 
                                __/ |                               ______ __/ |            
                               |___/                               |______|___/             
 */

Measured memory_bytes: 35276