akhauriyash/Code-Regression huggingface dataset:
package main

import "fmt"

func main() {
	var s string
	fmt.Scan(&s)

	m := make(map[rune]bool)
	for _, c := range s {
		m[c] = true
	}

	if len(m) < 26 {
		for i := 'a'; i <= 'z'; i++ {
			if !m[i] {
				fmt.Println(s + string(i))
				return
			}
		}
	}

	for i := len(s) - 2; i >= 0; i-- {
		c := byte('z') + 1
		for j := i + 1; j < len(s); j++ {
			if s[i] < s[j] && s[j] < c {
				c = s[j]
			}
		}
		if c <= 'z' {
			fmt.Println(s[:i] + string(c))
			return
		}
	}
	fmt.Println(-1)
}


Measured memory_bytes: 512
let split_string ?(pattern=" ") = Str.split @@ Str.regexp pattern
let x = read_line () |> split_string |> List.map int_of_string

let rec loop i = function
  | 0 :: xs -> Printf.printf "%d\n" i
  | _ :: xs -> loop (i + 1) xs
  | _ -> failwith " "

let () = loop 1 x

Measured memory_bytes: 3684
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define repone(i,n) for(int i=1;i<(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define Rep(j,n) for(int j=0;j<(int)(n);++j)
#define Repo(j,o,n) for(int j=o;j<(int)(n);++j)
#define Repone(j,n) for(int j=1;j<(int)(n);++j)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define int long long
#define pb(a) push_back(a)
#define eraser(v,i) (v).erase(v.begin()+(i))
#define pbpair(a,b) push_back(make_pair(a,b))
#define MOD 1000000007
#define MODB 998244353
#define INF 9223372036854775807
bool compare_by_b(pair<int, int> a, pair<int, int> b) {
    if(a.second != b.second){
        return a.second < b.second;
    }else{
        return a.first < b.first;
    }
}
signed main()
{
  int x=0,y=0,z=0,w=0,n=0,m=0;
string s;
std::cin >> x>>y>>s;
rep(i,s.size()){
  if(i==x){
    if(s[i]!='-'){
      std::cout << "No" << '\n';
      return 0;
    }
  }else{
    if(!isdigit(s[i])){
      std::cout << "No" << '\n';
      return 0;
    }
  }
}
std::cout << "Yes" << '\n';
}


Measured memory_bytes: 256
n=int(input())
a=[int(i) for i in input().split()]
b=[int(i) for i in input().split()]
res_a=[0]*n
res_b=[0]*n
res_a[0]=a[0]
res_b[n-1]=b[n-1]
for i in range(1,n):
	res_a[i]=res_a[i-1]+a[i]
	res_b[n-1-i]=res_b[n-i]+b[n-1-i]
ans=-1
for i in range(0,n):
	tmp=res_a[i]+res_b[i]
	ans=max(ans,tmp)
print(ans)

Measured memory_bytes: 3064
s=input()
l=[0]*(len(s)+1)

for i in range(len(s)):
  if s[i]=='<':
    l[i+1]=l[i]+1
    
for i in range(len(s)-1,-1,-1):
  if s[i]=='>':
    l[i]=max(l[i],l[i+1]+1)
print(sum(l))

Measured memory_bytes: 29052
#include <bits/stdc++.h>
using namespace std;
long long int power(long long int x,long long int y) 
{ 
    long long int res = 1;     // Initialize result 
  // x=x;
    while (y > 0) 
    { 
        // If y is odd, multiply x with result 
        if (y & 1) 
            res = (res*x); 
   
        // y must be even now 
        y = y>>1; // y = y/2 
        x = (x*x);  // Change x to x^2 
    } 
    return res; 
}
long long int power(long long int x,long long int y,long long int m) 
{ 
    long long int res = 1;     // Initialize result 
   x=x%m;
    while (y > 0) 
    { 
        // If y is odd, multiply x with result 
        if (y & 1) 
            res = (res*x)%m; 
   
        // y must be even now 
        y = y>>1; // y = y/2 
        x = (x*x)%m;  // Change x to x^2 
    } 
    return res; 
}

long long int gcd(long long int a, long long int b){ 
    if (a == 0) 
        return b;  
    return gcd(b % a, a);  
 } 
 long long int lcm(long long int a, long long int b)  
 { 
     long long int temp;
    
    return (a*b)/gcd(a, b);  
 }
 
int main() {
        long long int t=0,b[1000000]={0};
        string c;
        string s;
       long long int n,m,o=0,l,d=0,i,j,p=0,k,f;
       double pie=3.141592653589793238;
    long long int MOD=1000000007;
    cin>>n>>k>>l;
    long long int a[n];
    memset(a,0,sizeof(a));
    for(i=0;i<l;i++)
    {
        cin>>f;
        a[f-1]++;
    }
    for(i=0;i<n;i++)
    {
        if((k-(l-a[i]))>0)
       // p++;
       cout<<"Yes"<<"\n";
       else
       cout<<"No"<<"\n";
    }
    //cout<<P;
 return 0;
}

Measured memory_bytes: 1408
#include<stdio.h>
#include<string.h>
int main()
{
    long long N,sum=1,i,b;
    while(~scanf("%lld",&N))
    {
        for(i=1; i>0; i++)
    {
        sum=i*i;
        if(sum>N)
            break;
        b=sum;
    }
    printf("%d\n",b);
    }

    return 0;
}


Measured memory_bytes: 128
N = int(input())
num = list(1+ int(x) for x in input().split())
L = max(num)
sumR = [0 for x in range(L+3)]
for i in range(N):
  sumR[num[i]-1] +=1
  sumR[num[i]+2] -=1
for j in range(len(sumR)-1):
  sumR[j+1] += sumR[j]
print(max(sumR))

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

int n,m,p;
int a[15][15];

long double dp[1<<14];
long double tmp[1<<14][14];

long double fact[1<<14][14];



int main(void){
	cin >> n >> m >> p;
	rep(i,m){
		int u,v;
		cin >> u >> v;
		a[u-1][v-1]++;
		a[v-1][u-1]++;
	}

	rep(i,n) fact[1<<i][0]=1.0;
	for(int mask=1;mask<(1<<n);++mask){
		for(int smask=(mask-1)&mask;;smask=(smask-1)&mask){
			int tmask=mask^smask;
			if(tmask>smask) break;
			rep(snum,n)rep(tnum,n) if(snum+tnum<n) fact[mask][snum+tnum+1]+=fact[smask][snum]*fact[tmask][tnum];
		}
	}
	
	// cerr << fact[3][1] << endl;
	// cerr << fact[7][2] << endl;
	// cerr << fact[15][3] << endl;

	/*
	for(int i=2;i<n;++i){
		fact[i]=1.0*(i+1)*i/2.0*fact[i-1]; 
		cerr << fact[i] << endl;
	}
	*/

	rep(i,n){
		rep(mask,1<<i)rep(j,i+1) tmp[mask][j]=0.0;

		for(int mask=1;mask<(1<<i);++mask){
			double cur=1.0;
			rep(j,i) if(mask&(1<<j)) rep(loop,a[j][i]) cur*=1.0*p/100.0; 
			tmp[mask][0]=(1.0-cur)*dp[mask];
		}
		
		
		for(int mask=1;mask<(1<<i);++mask){
			for(int smask=(mask-1)&mask;;smask=(smask-1)&mask){
				int tmask=mask^smask;
				if(tmask>smask) break;
				double cur=1.0;
				rep(j,i)rep(k,i) if((smask&(1<<j))&&(tmask&(1<<k))) rep(loop,a[j][k]) cur*=1.0*p/100.0;
				rep(snum,i+1)rep(tnum,i+1) if(snum+tnum<=i) tmp[mask][snum+tnum+1]+=cur*tmp[smask][snum]*tmp[tmask][tnum];
			}
		}

		tmp[0][0]=1.0;
		rep(mask,1<<i){
			for(int num=0;num<=i;++num){
				// cerr << mask << " " << num << " " << tmp[mask][num] << endl;
 				dp[mask|(1<<i)]+=tmp[mask][num]/fact[(1<<(num+1))-1][num];
			}
		}

	}
	cout.precision(20);
	cout << fixed << dp[(1<<n)-1] << endl;
	// rep(mask,1<<n) cerr << mask << " " << dp[mask] << endl;
	return 0;
}

Measured memory_bytes: 8900
#include<iostream>
#include<algorithm>
#include<cmath>

bool isTriangle(int a, int b, int c);

int main(){
	int a, b, c, count;
	bool check;
	
	std::cin >> count;
	
	for(int i = 0; i < count; ++i){
		std::cin >> a >> b >> c;
		
		int max_num = std::max({a, b, c});
		if(max_num == a) check = isTriangle(b, c, a);
		else if(max_num == b) check = isTriangle(a, c, b);
		else if(max_num == c) check = isTriangle(a, b, c);
		
		if(check) std::cout << "YES" << std::endl;
		else std::cout << "NO" << std::endl;
	}
	
	return 0;
}

bool isTriangle(int a, int b, int c){
	if(std::pow(a, 2) + std::pow(b, 2) == std::pow(c, 2)) return true;
	else return false;
}

Measured memory_bytes: 1152
#include<iostream>
#include<string>
using namespace std;
#include<stdlib.h>


main(){
  string cla[10][3];//for input// class name: am in:  pm in
  int data[10][2];//for output // sum(people) :sum(income)
  int i;
  int data2[10][2];
  i=0;
  while(cin >> cla[i][0] >> data[i][0]>> data[i][1]){
      i++;
     
      /* //Ã£ÂÂÃ£ÂÂÃ£ÂÂÃ£ÂÂ¯Ã§ÂÂ¨
      cout << cla[i-1][0]<< " "<< cla[i-1][1]<<" "<< cla[i-1][2]<<endl;//Ã¤Â¸ÂÃ£ÂÂ§Ã¨Â¶Â³Ã£ÂÂÃ£ÂÂ¦Ã£ÂÂÃ£ÂÂ®Ã£ÂÂ§Ã¯Â¼ÂÃ¥Â¼ÂÃ£ÂÂ
      */

      
      //data[i-1][1] = atoi(cla[i-1][1])*200 + atoi(cla[i-1][2])*300;
      data2[i-1][0] = data[i-1][0] + data[i-1][1];
      data2[i-1][1] = data[i-1][0]*200 + data[i-1][1]*300;
      
      //cout << cla[i-1][0] << " " << data[i-1][0]<<" " << data[i-1][1]<<endl;
      

    }

  i--;
  for(int j=0;j<9;j++){

    cout << cla[j][0] << " "<< data2[j][0] << " "<< data2[j][1]<< endl;

  }

  return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
//#include <atcoder/all>
using namespace std;
//using namespace atcoder;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
typedef long long ll;
#define ALL(v) v.begin(), v.end()
#define vmax(v) *max_element(ALL(v))
#define vmin(v) *min_element(ALL(v))
#define chmax(x, a) x = max(x, a)
#define chmin(x, a) x = min(x, a)

int main() {
    ll N, X, M; cin >> N >> X >> M;
    vector<ll> ms = {X};
    set<ll> mset = {X};
    ll tmp = X*X % M;
    while (!mset.count(tmp) && ms.size() < N) {
        ms.push_back(tmp);
        mset.insert(tmp);
        tmp = tmp*tmp % M;
    }
    if (ms.size() == N) {
        ll ans = 0;
        rep(i, (int)N) ans+=ms[i];
        cout << ans << endl;
        return 0;
    }
    int tmpPos = 0;
    ll ans = 0;
    while(ms[tmpPos] != tmp) {
        ans += ms[tmpPos];
        tmpPos++;
    }
    N-=tmpPos;
    for (int i = 0; i < ms.size()-tmpPos; i++) {
        ans += N/(ms.size()-tmpPos) * ms[tmpPos+i];
        if (i < N%(ms.size()-tmpPos)) ans += ms[tmpPos+i];
    }
    cout << ans << endl;
}


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

int main() {
  int N;
  cin>>N;
  int64_t Z=1,A=0;
  int64_t K=1000000000000000000;
  for(int i=0;i<N;i++){
    int64_t a;
    cin>>a;
    if(1+(K-1)/Z<a&&a!=0){
      A++;
    }
    else{
      Z*=a;
    }
    if(Z==0){
      break;
    }
  }
  if((A==0&&Z<=K)||Z==0){
    cout<<Z<<endl;
  }
  else{
    cout<<"-1"<<endl;
  }
}


Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repe(i, n) for (int i = 0; i <= (int)(n); i++)
#define YES cout<<"YES"<<endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define ANS cout << ans << endl
#define all(a) a.begin(),a.end()
#define SORT(a) sort(all(a))
#define REVERSE(a) reverse(all(a))
#define int ll
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORe(i, m, n) for(int i = m;i <= n;i++)
#define VIin(a) for(int i=0; i<a.size(); i++) cin >> a[i]
#define OUT(a) cout << a << endl
#define IN(a) cin >> a
#define INT(a) int a; cin >> a
typedef vector<int> VI;
typedef vector<VI> VVI;
const int MOD=1e9+7;
const long long INF = 1LL << 60;
/*最大公約数*/int gcd(int x, int y) { return y ? gcd(y,x%y) : x;}
/*最小公倍数*/int lcm(int a, int b) { int g = gcd(a, b); return a / g * b; }
/*素数判定*/int isPrime(int n){if(n<2){return 0;}for(int i=2; i*i<=n; i++){if(n%i==0){return 0;}}return 1;}
/*約数列挙*/vector<int> getDivisor(int n){vector<int> v; for(int i=1; i*i<=n; i++){if(n%i==0){v.push_back(i);if(i!=n/i){v.push_back(n/i);}}}sort(v.begin(),v.end()); return v;}
//----------------------------------------------
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    string a,b; cin >> a >> b;
    double x = sqrt(stoi(a+b));
    if(x == (int)x) Yes;
    else No;

    return 0;
}

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

using namespace std;

int main(){
	int N;
	vector<int> d;
	
	cin >> N;
	for(int i = 0; i < N; i++){
		int tmp;
		cin >> tmp;
		d.push_back(tmp);
	}
	
	sort(d.begin(), d.end());
	
	cout << d[N/2] - d[N/2 - 1] << endl;
}

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

using namespace std;

int main(){
    int n;
    cin >> n;
    vector<int> h(n);
    for(int i = 0; i < n; i++){
        cin >> h[i];
    }
    int result = 0;
    int a = h[0];
    for(int i = 0; i < n; i++){
        if(a <= h[i]){
            result++;
            a = max(a, h[i]);

        }
    }
    cout << result << endl;
}

Measured memory_bytes: 256
n, m = list(map(int, input().split()))
ab = []
cd = []
for i in range(n):
  ab.append(list(map(int, input().split())))
for i in range(m):
  cd.append(list(map(int, input().split())))

for i in range(n):
  t = float("INF")
  for j in range(m):
    if abs(ab[i][0]-cd[j][0])+abs(ab[i][1]-cd[j][1])<t:
      t = abs(ab[i][0]-cd[j][0])+abs(ab[i][1]-cd[j][1])
      ans = j+1
  print(ans)

Measured memory_bytes: 3064
using System;

class Atcoder58
{
    public static void Main()
    {
        string n = Console.ReadLine();
        int nint = int.Parse(n);

        char dig3 = n[0];
        char dig2 = n[1];
        char dig1 = n[2];

        string str3 = dig3.ToString();
        string str2 = dig2.ToString();
        string str1 = dig1.ToString();

        string nrev = str1 + str2 + str3;
        int nrevint = int.Parse(nrev);

        if (nint == nrevint)
            Console.WriteLine("Yes");
        else
            Console.WriteLine("No");
    }
}

Measured memory_bytes: 13140
#include <bits/stdc++.h>
#include <chrono>
#include <math.h>
using namespace std;
using ll = long long;
using ld = long double;
using namespace std::chrono; 
#define fo(i,z,n) for(int i = z;i<n;i++)
#define Fo(i,z,n) for(ll i = z;i<n;i++)
#define INT_BITS 32
#define mod 1000000007
#define vi vector<int>
#define vll vector<ll>
#define vvi vector<vector<int> >
#define vvl vector<vector<ll> > 
#define pb push_back
#define f first
// #define s second
#define int long long
#define float long double
#define all(c) (c).begin(), (c).end()
#define endl '\n'







int32_t main()
{
 
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
     cout.tie(0);
   	
//     int t;
//      cin >> t;

//      while(t--){
    
// }

char a;
cin >> a;
if(a >= 'A' && a < 'a')cout << 'A' << endl;
else cout << 'a' << endl;


    
 
return 0;
}




Measured memory_bytes: 3636
import java.util.Scanner;
public class Main{
	public static void main(String[] args){
		new Main().run();
	}
	Scanner scan = new Scanner(System.in);
	String str;
	int[][] sampColor = {
		{0,0,0},
		{0,0,255},
		{0,255,0},
		{0,255,255},
		{255,0,0},
		{255,0,255},
		{255,255,0},
		{255,255,255}
		};
	String[] color = new String[8];
	int[] t = new int[3];
	public void run(){
		double dis = 0;
		double s;
		int f = 0;
		color[0] = "black";
		color[1] = "blue";
		color[2] = "lime";
		color[3] = "aqua";
		color[4] = "red";
		color[5] = "fuchsia";
		color[6] = "yellow";
		color[7] = "white";
		while(scan.hasNext()){
			str = scan.next();
			if(str.equals("0")){
				return;
			}
			dis = 0;
			f = 0;
			char[] c = str.toCharArray();
			for(int i = 0;i < 3;i++){
				t[i] = 16 * change(c[2*i+1]) + change(c[2*i+2]);
			}
			for(int i = 0;i < 8;i++){
				s = calcDis(i);
				if(i == 0 || dis > s){
					f = i;
					dis = s;
				}
			}
			System.out.println(color[f]);
		}
	}
	public int change(char a){
		return (int)a - (((int)a > 96)?87:48);
	}
	public double calcDis(int num){
		int x = 0;
		for(int i = 0;i < 3;i++){
			x += (t[i] - sampColor[num][i])*(t[i] - sampColor[num][i]);
		}
		return Math.sqrt(x);
	}
}

Measured memory_bytes: 20156
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <queue>
#include <cstring>
#include <vector>
#include <map>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <bitset>
#include <set>
#include <stack>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)
#define all(i,n) (i),(i+n)

int dx4[4]={1,0,-1,0};
int dy4[4]={0,-1,0,1};
int dx8[8]={1,0,-1,1,-1,1,0,-1};
int dy8[8]={1,1,1,0,0,-1,-1,-1};
int dx9[9]={0,1,0,-1,1,-1,1,0,-1};
int dy9[9]={0,1,1,1,0,0,-1,-1,-1};

typedef pair<int, int> P;
typedef pair<string, int> SP;
typedef long long ll;
typedef pair<ll, ll> PLL;

const int INF = 1e9;
const ll LLINF = 1e18;
const int MAX_V = 1e6+1;
const ll mod = 1000000007;

// << fixed << setprecision
// --------------------------------------
class UnionFind {
public:
  vector<int> data;
  UnionFind(int size) : data(size, -1) {}

  int find(int x) {
    return data[x] < 0 ? x : data[x] = find(data[x]);
  }
  void unite(int x, int y) {
    x = find(x);
    y = find(y);
    if(x != y) {
      if(data[y] < data[x]) swap(x, y);
      data[x] += data[y];
      data[y] = x;
    }
  }
  int size(int x) {
    return -data[find(x)];
  }
};
int n, m;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  cin >> n >> m;

  UnionFind uf(n + 1);
  REP(i, m) {
    int a, b;
    cin >> a >> b;
    a--; b--;
    uf.unite(a, b);
  }

  vector<bool> used(n, false);
  ll ans = 0;
  REP(i, n) {
    if(!used[uf.find(i)]) {
      ans++;
      used[uf.find(i)] = true;
    }
  }
  cout << (ans - 1) << endl;
}


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

int main(){
	int a,b,gcd,lcm;
	while(cin >> a >> b){
		int c=a,d=b;
		lcm=gcd=1;
		for(int i = 2; i < c || i < d;){
			if(c%i==0&&d%i==0){
				c/=i;
				d/=i;
				lcm=gcd*=i;
			}else i++;
		}
		lcm*=c*d;
		cout << gcd << " " << lcm << endl;
	}
	return 0;
}

Measured memory_bytes: 1160
import java.io.BufferedReader
import java.io.InputStream
import java.io.InputStreamReader
import java.io.PrintWriter
import java.lang.StringBuilder
import java.util.*

fun PrintWriter.solve(sc: FastScanner) {
    val n = sc.nextInt()
    val a = Array(n) { sc.nextLong() }
    val count = mutableMapOf<Long, Int>()
    for (i in 0 until n) {
        count[a[i]] = (count[a[i]] ?: 0) + 1
    }
    var ans = 0L
    var max = -1L
    for (key in count.keys) {
        if (count[key]!! >= 4 && max < key) {
            max = key
        }
    }
    if (max != -1L) {
        ans = max * max
    }
    val b = count.filter { it.value >= 2 }.toList().sortedByDescending { it.first }
    if (b.count() >= 2) {
        ans = Math.max(ans, b[0].first * b[1].first)
    }
    println(ans)
}

fun main(args: Array<String>) {
    val writer = PrintWriter(System.out, false)
    writer.solve(FastScanner(System.`in`))
    writer.flush()
}

class FastScanner(s: InputStream) {
    private var st = StringTokenizer("")
    private val br = BufferedReader(InputStreamReader(s))

    fun next(): String {
        while (!st.hasMoreTokens()) st = StringTokenizer(br.readLine())

        return st.nextToken()
    }

    fun nextInt() = next().toInt()
    fun nextLong() = next().toLong()
    fun nextLine() = br.readLine()
    fun nextDouble() = next().toDouble()
    fun ready() = br.ready()
}

Measured memory_bytes: 48576
#include<bits/stdc++.h>
//P:Independent Set

using namespace::std;

const int SIZE = 1e5 + 1,MOD = 1e9 + 7;
vector<int> Adlist[SIZE];
int dp[SIZE][2];

void mul(int &a,int b){
	a = 1LL * a * b % MOD;
}

void dfs(int nodo,int padre,int color){
	if(dp[nodo][color])
		return;

	dp[nodo][color] = 1;
	for(int nnodo : Adlist[nodo]){
		if(nnodo == padre)
			continue;

		dfs(nnodo,nodo,0);	dfs(nnodo,nodo,1);
		if(color == 1)
			mul(dp[nodo][1],dp[nnodo][0]);
		else
			mul(dp[nodo][0],(dp[nnodo][1] + dp[nnodo][0]) % MOD);
	}
//	cerr << nodo << ' ' << color << ' ' << dp[nodo][color] << '\n';
}

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

	int N;
	cin >> N;

	for(int i = 1;i < N;i++){
		int a,b;
		cin >> a >> b;

		Adlist[a].push_back(b);
		Adlist[b].push_back(a);
	}

	Adlist[0].push_back(1);

	dfs(0,-1,0);

//	cerr << dp[1][0] << ' ' << dp[1][1] << '\n';
	cout << dp[0][0] << '\n';

	return 0;
}


Measured memory_bytes: 13440
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <map>
#include <queue>
#include <deque>
#include <string>
#include <stack>
#include <vector>
#include <set>
#include <tuple>
#include <utility>
#include <functional>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
const int INF = 1000000000;
const int MOD = 1000000007;
int main(){
	int n,x,t;
	cin >> n >> x >> t;
	cout << (n + x - 1) / x * t << endl;
}


Measured memory_bytes: 3592
// -----------------------------------
// author   : MatsuTaku
// country  : Japan
// created  : 07/17/20 22:14:12
// -----------------------------------

#include <bits/stdc++.h>

using namespace std;
using ll = long long;

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

  string s; cin>>s;
  auto get_num = [](string_view str) {
    ll num = 0;
    for (auto c:str) {
      num = num*10+(c-'0');
    }
    return num;
  };
  vector<ll> dp(s.size()+1);
  dp[0] = 0;
  string_view sv(s);
  for (int i = 1; i <= s.size(); i++) {
    for (int j = 0; j < i; j++) {
      dp[i] += dp[j] + get_num(sv.substr(j, i-j)) * (j==0?1:1<<(j-1));
    }
  }
  cout << dp[s.size()] << endl;

  return 0;
}


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

int main() {
  int N, K;
  cin >> N >> K;
  vector<int> vec(N, 0);
  for(int i = 0; i < K; i++) {
    int d;
    cin >> d;
    for(int j = 0; j < d; j++) {
      int A;
      cin >> A;
      vec.at(A-1)++;
    }
  }
  int count = 0;
  for(int i = 0; i < N; i++) {
    if (vec.at(i) == 0) count++;
  }
  cout << count << endl;
}

Measured memory_bytes: 3632
#include <iostream>
#include <vector>
#include <queue>
#define INF 1e+18
#define int long long
using namespace std;

struct edge{ int to,cost; };
typedef pair<int,int> P;

signed main(){
	int n,m,x,h[100000];
	int d[100000];
	vector<edge> G[100000];
	cin >> n >> m >> x;
	for(int i = 0;i < n;i++) {
		cin >> h[i];
		d[i] = INF;
	}
	d[0] = 0;
	for(int i = 0;i < m;i++){
		int a,b,c;
		cin >> a >> b >> c;
		if(h[a - 1] >= c) G[a - 1].push_back({b - 1,c});
		if(h[b - 1] >= c) G[b - 1].push_back({a - 1,c});
	}
	priority_queue<P,vector<P>,greater<P> > que;
	que.push(P(0,0));
	while(!que.empty()){
		P p = que.top();que.pop();
		int v = p.second,nowh = x - d[v];
		if(d[v] < p.first) continue;
		for(int i = 0;i < G[v].size();i++){
			edge e = G[v][i];
			if(h[e.to] + e.cost < nowh){
				if(x - h[e.to] < d[e.to]){
					d[e.to] = x - h[e.to];
					que.push(P(d[e.to],e.to));
				}
			}
			else if(nowh > 0 && nowh < e.cost){
				if(d[v] + e.cost - nowh + e.cost < d[e.to]){
					d[e.to] = d[v] + e.cost - nowh + e.cost;
					que.push(P(d[e.to],e.to));
				}
			}else if(nowh >= e.cost){
				if(d[v] + e.cost < d[e.to]){
					d[e.to] = d[v] + e.cost;
					que.push(P(d[e.to],e.to));
				}
			}
			else{
				if(d[v] + e.cost * 2 < d[e.to]){
					d[e.to] = d[v] + e.cost * 2;
					que.push(P(d[e.to],e.to));
				}
			}
		}
	}
	if(d[n - 1] == INF) cout << -1 << endl;
	else cout << d[n - 1] + h[n - 1] - max(0ll,x - d[n - 1]) << endl;
	return 0;
}

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

int main() {
  int H, W;
  cin >> H >> W;
  vector<string> A(H);
  for (int i = 0; i < H; i++) {
    cin >> A.at(i);
  }
  
  vector<string> B;
  for (int i = 0; i < H; i++) {
    for (int j =0; j < W; j++) {
      if (A.at(i).at(j) == '#') {
        B.push_back(A.at(i));
        break;
      }
    }
  }
  
  vector<string> C(W);
  for (int i = 0; i < B.size(); i++) {
    for (int j = 0; j < W; j++) {
      C.at(j) += B.at(i).at(j);
    }
  }
  
  vector<string> D;
  for (int i = 0; i < W; i++) {
    for (int j =0; j < B.size(); j++) {
      if (C.at(i).at(j) == '#') {
        D.push_back(C.at(i));
        break;
      }
    }
  }
  
  for (int i = 0; i < B.size(); i++) {
    for (int j = 0; j < D.size(); j++) {
      cout << D.at(j).at(i);
    }
    cout << endl;
  }
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int N; cin >> N;
    vector<string> s(N);
    map<string, int> maps;
    for(int i = 0; i < N; i++)
    {
        cin >> s.at(i);
        maps[s.at(i)] += 1;
    }
    int M; cin >> M;
    vector<string> t(M);
    for(int i = 0; i < M; i++)
    {
        cin >> t.at(i);
        maps[t.at(i)] -= 1;
    }
    int ans = 0;
    for(string i : s)
    {
        if(ans < maps[i])
        {
            ans = maps[i];
        }
    }
    cout << ans << endl;
}

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

int main() {
    int N, cnt = 0, next = 1;
    cin >> N;
    int a[N], b[N];
    for(int i = 0; i < N; i++) {
        cin >> a[i];
        b[i] = 0;
    }
    while(true) {
        next = a[next-1];
        cnt += 1;
        if(next == 2) {
            cout << cnt << endl;
            return 0;
        }
        if(b[next-1] == 0) {
            b[next-1] = 1;
        } else {
            cout << -1 << endl;
            return 0;
        }
    }
    
    return 0;
}

Measured memory_bytes: 1024
while True :
    try :
        string = input()
    except EOFError :
        break
    
    for i in range(26) :
        new_string = []
        for j in range(len(string)) :
            if 97 <= ord(string[j]) <= 122 :
                x = ord(string[j]) + i
                if x > 122 :
                    x -= 26
                new_string.append(chr(x))
            else :
                new_string.append(string[j])
        new_string = ''.join(new_string)
        if 'the' in new_string or 'this' in new_string or 'that' in new_string :
            print(new_string)
            break


Measured memory_bytes: 5560
import java.util.*;
public class Main{
	public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
      int[] array = new int[5];
      int[] mod = new int[5];
      int re = 0;
		for(int i = 0;i < 5;i++){
          array[i] = sc.nextInt();
          mod[i] = array[i]%10;
          if(mod[i] == 0){
            	mod[i] = 10;
          }
          re = re + array[i] + 10 - mod[i];
        }
      
      int x = 11;
      for(int i = 0;i < 5;i++){
      	x = Math.min(x,mod[i]);
      }
      System.out.println(re-10+x);
    }
}

Measured memory_bytes: 21844
#include <stdio.h>
int main(void)
{
	int i, j;
	for(i = 1; i <= 9; i++)
	{
		for(j = 1; j <= 9; j++)
		{
			printf("%dx%d=%d\n", i, j, i * j);
		}
	}
	return 0;
}


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

int main(){
    int n, k;
    cin >> n >> k;
    double p[n];
    for(int i = 0; i < n; i++){
        cin >> p[i];
        p[i] = (p[i] + 1.0) / 2.0;
    }
    double sum = 0;
    for(int i = 0; i < k; i++) sum += p[i];
    double ans = sum;
    for(int i = 0; i < n - k; i++){
        double tmp = sum - p[i] + p[i + k];
        if(tmp > ans) ans = tmp;
        sum = tmp;
    }
    cout << fixed << setprecision(10) << ans << endl;
    return 0;
}


Measured memory_bytes: 1792
package main

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

func main() {
	scan_init()
	a := scan()
	if strings.ToLower(a) == a {
		fmt.Println("a")
	} else {
		fmt.Println("A")
	}
}
var sc = bufio.NewScanner(os.Stdin)
func scan_init () {
	sc.Split(bufio.ScanWords)
}
//func scanInt () int{
//sc.Scan()
//	i,_ := strconv.Atoi(sc.Text())
//	return i
//}
func scan () string{
 sc.Scan()
	return sc.Text()
}

Measured memory_bytes: 1776
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.next());
        long sum = 1;
        for(int i=0; i<N; i++) {
            long next = Long.parseLong(sc.next());
            if(next == 0) {
                sum = 0;
                break;
            }
            if(sum != -1) {
                if(1000000000000000000L / next < sum) {
                    sum = -1;
                }else {
                    sum *= next;
                }
            }else {
                continue;
            }
        }
        System.out.println(sum);
        
    }
}


Measured memory_bytes: 58876
#include "bits/stdc++.h"
using namespace std;
#define Rep(i,n) for(int i=0;i<(int)(n);i++)
#define For(i,n1,n2) for(int i=(int)(n1);i<(int)(n2);i++)
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define RREP(i,n) for(ll i=((ll)(n)-1);i>=0;i--)
#define FOR(i,n1,n2) for(ll i=(ll)(n1);i<(ll)(n2);i++)
#define RFOR(i,n1,n2) for(ll i=((ll)(n1)-1);i>=(ll)(n2);i--)
#define all(a)  (a).begin(),(a).end()
#define SORT(a) sort((a).begin(),(a).end())
#define oorret 0
#define oor(x) [&](){try{x;} catch(const out_of_range& oor){return oorret;} return x;}()
#define IOS cin.tie(0),ios::sync_with_stdio(false)
typedef long long ll;
typedef unsigned long long ull;
typedef std::pair<ll, ll> P;
template<typename T1, typename T2> inline bool chmin(T1& a, T2 b) { if (a > b) { a = b; return 1; }return 0; }
template<typename T1, typename T2> inline bool chmax(T1& a, T2 b) { if (a < b) { a = b; return 1; }return 0; }
template<class Type>struct is_vector : std::false_type {};
template<class ValueType, class Alloc>struct is_vector<std::vector<ValueType, Alloc>> : std::true_type {};
template <typename T> inline std::ostream& operator << (std::ostream& out, const std::vector<T>& v) {
	if (v.empty())return out;
	constexpr bool is_vector_v = is_vector<T>::value;
	if (is_vector_v)for (auto itr = v.begin(); itr != v.end();)out << (*itr), out << ((++itr != v.end()) ? "\n" : "");
	else for (auto itr = v.begin(); itr != v.end();)out << (*itr), out << ((++itr != v.end()) ? " " : "");
	return out;
}
inline void put() {}
template<class T> inline void put(const T& first) { std::cout << first << "\n"; }
template<class T, class... N> inline void put(const T& first, const N& ... rest) { std::cout << first << " "; put(rest...); }
inline void putn() {}
template<class T, class... N> inline void putn(const T& first, const N& ... rest) { std::cout << first << "\n"; putn(rest...); }

int main() {
	IOS;
	ll n, k;
	cin >> n >> k;
	ll res = n;
	ll tmp = n % k;
	chmin(res, tmp);
	tmp = k - tmp;
	chmin(res, tmp);
	put(res);
	return 0;
}

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

int main() {
    int n;
    cin>>n;
    if((n%1000)==0){
        cout<<0<<endl;
    }else{
        cout<<(1000-(n%1000))<<endl;
    }
    return 0;
}


Measured memory_bytes: 3620
// F - Strings of Eternity
#include <bits/stdc++.h>

using namespace std;

void z_func(const string &p, vector<int> &z)
{
	int n = p.size();
	z.assign(n, 0);
	for (int l = 0, r = 0, i = 1; i < n; i++)
		if (r >= i && z[i - l] < r - i + 1) {
			z[i] = z[i - l];
		} else {
			if (i > r) r = i;
			for (l = i; r < n && p[r - l] == p[r]; ) r++;
			z[i] = r - l;
			r--;
		}
}

int find(const string &s, const string &t)
{
	int m = t.size();
	string r = t + "|" + s;
	vector<int> z;
	z_func(r, z);
	vector<int> dp(z.size() + 1);
	for (int i = m; i < z.size(); i++)
		if (z[i] == m) dp[i + m] = max(dp[i + m], dp[i] + 1);
	return *max_element(dp.begin(), dp.end());
}

int main(int argc, char *argv[])
{
	ios::sync_with_stdio(false); cin.tie(0);
	string s, t;
	cin >> s >> t;
	string r = s;
	while (r.size() <= (s.size() + t.size()) * 2) r += s;

	int ans = find(r, t);
	if (find(r + r, t) != ans)
		ans = -1;

	cout << ans << endl;

	return 0;
}


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

const int MN = 100010;

int N;
int A[MN], B[MN], dp[MN][2];

int calc(int x) {
    int ret = 0;
    while(x != 1) {
        x = (x + 1)>>1;
        ret++;
    }
    return ret;
}

int main() {
    scanf("%d", &N);

    for(int i = 0; i < N; i++) {
        scanf("%d", &A[i]);
    }
    for(int i = 0; i < N; i++) {
        int x = calc(A[i]);
        B[i] = A[i] == (1 << x)? 2 : 1;
    }

    for(int i = N - 1; i >= 1; i--) {
        for(int j = 0; j < 2; j++) {
            int a = calc(A[i - 1]);
            int b = calc(A[i]);

            dp[i][j] = 1e9;
            for(int k = 0; k <= 1; k++) {
                int l = B[i] - k;
                if(l < 0 || 1 < l) continue;
                int p = j? a : a - 1;
                int q = k? b : b - 1;
                dp[i][j] = min(dp[i][j], dp[i + 1][l] + b - min(p, q));
            }

            //cout << i << ' ' << j << ' ' << dp[i][j] << endl;
        }
    }
    printf("%d", dp[1][ B[0]? 1 : 0 ] + calc(A[0]));
}


Measured memory_bytes: 1792
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <iomanip>
#include <cassert>
#include <cmath>
#include <cstring>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <limits>
using namespace std;
#define ll long long
#define ld long double
#define pii pair<int,int>
#define x first
#define y second
#define sf scanf
#define pf printf
#define vec vector
#define pb push_back
#define mp make_pair
#define sz(a) int(a.size())
#define all(a) a.begin(),a.end()
#define clr(a,b) memset(a,b,sizeof(a))
#define bin_cnt(x) __builtin_popcount(x)
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define rrep(i,b,a) for(int i=b;i>=a;i--)
#define srep(sub,s) for(int sub=s&(s-1);sub;sub=(sub-1)&s)
#define irep(i,a) for(__typeof(a.begin()) i=a.begin();i!=a.end();i++)
#define irrep(i,a) for(__typeof(a.rbegin()) i=a.rbegin();i!=a.rend();i++)
#define inf numeric_limits<int>::max()
#define finf numeric_limits<double>::infinity()
#define eps 1e-8
#pragma GCC optimize ("O3")
#define o3 __attribute__((optimize("O3")))
#pragma comment(linker, "/STACK:32505856")

template<class T> inline T sqr(T a) {return a*a;}
template<class T> inline int gmin(T&a,T b) {if(a>b){a=b;return 1;}return 0;}
template<class T> inline int gmax(T&a,T b) {if(a<b){a=b;return 1;}return 0;}
inline int dcmp(const double &a) {return a>eps?1:(a<-eps?-1:0);}
struct Initializer{Initializer(){ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);}}initializer;

#define N 200010
int dad[N];

int find_set(int x) {
    if (dad[x] == x) return x;
    return dad[x] = find_set(dad[x]);
}

void unif(int x,int y) {
    x = find_set(x);
    y = find_set(y);
    if (x != y) {
        dad[x] = y;
    }
}

int n, m, k;
int used[N];
int a;

int main() {
    sf("%d%d", &n, &m);

    rep(i,1,m) dad[i] = i;
    rep(i,1,n) {
        sf("%d", &k);

        int l1,l2;
        k--;
        sf("%d", &l1);
        used[l1] = 1;
        a = l1;

        while (k--) {
            sf("%d", &l2);
            used[l2] = 1;
            unif(l1, l2);
//            pf("<%d,%d>\n",l1,l2);
        }
    }

    rep(i,1,m)
        if (used[i])
        if (find_set(i) != find_set(a)) {
//            pf("dad[%d] = %d\n",i,dad[i]);
//            pf("dad[%d] = %d\n",a,dad[a]);
            pf("NO\n");
            return 0;
        }

    pf("YES\n");
    return 0;
}


Measured memory_bytes: 1152
#include <iostream>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;

int main(void) {
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  int prev = 0;
  int answer = 0;
  rep(i, N) {
    int A;
    cin >> A;
    if (prev == A) {
      ++answer;
      A = 0;
    }
    prev = A;
  }
  cout << answer << endl;
  return 0;
}

Measured memory_bytes: 3568
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>

using namespace std;
#define int long long int
const int INF = 1001001001001001LL;
const int MOD = 1000000007;

int h, w;

int f(int a, int b){
    
    a %= 2 * w;
    while(a > 0){
        
        if((a + b) % 2 == 0){
            // 左へ
            if(b == 0){
                a--;
                continue;
            }else{
                int val = min(a, b);
                a -= val;
                b -= val;
            }
        }else{
            // 右へ
            if(b == w - 1){
                a--;
                continue;
            }else{
                int val = min(a, w - 1 - b);
                a -= val;
                b += val;
            }
        }
    }
    
    return b;
}

signed main(){
    
    int n; cin >> h >> w >> n;
    vector<pair<int, int> > p(n);
    for(int i = 0; i < n; i++){
        int a, b; cin >> a >> b;
        p[i].first = a - 1;
        p[i].second = b - 1;
    }

    sort(p.begin(), p.end());

    vector<int> m(w);
    for(int i = 0; i < w; i++) m[i] = i;

    for(int i = 0; i < n; i++){
        int u = f(p[i].first, p[i].second);
        int v = f(p[i].first, p[i].second + 1);
        
        swap(m[u], m[v]);
    }
    
    vector<int> ans(w);
    for(int i = 0; i < w; i++){
        ans[m[f(h, i)]] = i + 1;
    }

    for(int i = 0; i < w; i++) cout << ans[i] << endl;

    return 0;
}




Measured memory_bytes: 9124
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define o(a) cout << a << endl
#define int long long
using namespace std;
typedef pair<int, int> P;

signed main(){
    int n;
    cin >> n;
    vector<int> a(n);
    int od = 0, e = 0;
    rep(i, 0, n){
        cin >> a[i];
        if(a[i] % 2) od++;
        else e++;
    }
    cout << (od % 2 == 0 ? "YES" : "NO") << endl;
}

Measured memory_bytes: 1024
import java.util.*;

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

    String c = sc.next();
    switch (c) {
      case "a":
        System.out.println("vowel");
        break;
      case "e":
        System.out.println("vowel");
        break;
      case "u":
        System.out.println("vowel");
        break;
      case "i":
        System.out.println("vowel");
        break;
      case "o":
        System.out.println("vowel");
        break;
      default:
      System.out.println("consonant");
      break;
    }
  }
}

Measured memory_bytes: 22868
# https://atcoder.jp/contests/abc149/submissions/9219994

import numpy as np

N,M = map(int,input().split())
A = np.array(list(map(int,input().split())))
A.sort()

def shake_cnt(x):
    X = np.searchsorted(A,x-A)  #numpy内蔵のbisect_left, np.array一括で検索可
    return N*N - X.sum()
    #行わない握手のcnt, X.sum()は行う握手のcnt ? 逆か?

#にぶたん
L = 0
R = 10**6   #範囲外
while L+1 < R:
    mid = (L+R) // 2
    if shake_cnt(mid) >= M:
        L = mid
    else:
        R = mid
#増える幸福度がL以上になる握手の方法がM通り ?

Acum = np.zeros(N+1)
Acum[1:] = np.cumsum(A) #この書き方を覚えておく、np.arrayで先頭に0を残せる
X = np.searchsorted(A,R-A)
shake = N*N - X.sum()
ans = (Acum[-1] - Acum[X]).sum() + (A*(N-X)).sum()
#Acum[-1]は定数, Acum[X]はnp.array A,Xはnp.array
ans += (M-shake)*L
print(int(ans))


Measured memory_bytes: 24692
import java.util.Scanner;

class Main {
	public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt();
        int B = sc.nextInt();
        int C = sc.nextInt();
        int D = sc.nextInt();
        
        while(true) {
        	A = A-D;
        	C = C-B;
        	
        	if(A <= 0 && C <= 0) {
        		System.out.print("Yes");
        		break;
        	}else if(C<=0) {
        		System.out.print("Yes");
        		break;
        	}else if(A<=0) {
        		System.out.print("No");
        		break;
        	}
        	
        	
        	
        }

        

        
        }
	}



Measured memory_bytes: 35740
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#define DEBUG(x) std::cout << '>' << #x << ':' << x << '\n';
#define PRINTVEC(x) for (int i = 0; i < (int)x.size(); i++) std::cout << x[i] << ' '; std::cout << '\n';
#define PRINTPAIR(x) for (int i = 0; i < (int)x.size(); i++) std::cout << x[i].first << ' ' << x[i].second << '\n'; std::cout << '\n';
#define PRINTSET(x) for (auto it = x.begin(); it != x.end(); it++) { std::cout << *it << ' '; } std::cout << '\n';
#define io std::ios_base::sync_with_stdio(false);std::cin.tie(NULL);   
const int INF = 1<<29;
typedef long long ll;
using namespace std;


int main()
{
	io;
    #ifndef ONLINE_JUDGE
    //freopen("input.txt", "r", stdin); 
    //freopen("output.txt", "w", stdout);  
    #endif

    int n;
    cin >> n;
    string ans = "";
    for (int i = 0; i < n; i++) {
        ans += "ACL";
    }   
    cout << ans << endl;


    #ifndef ONLINE_JUDGE   
    std::cout << '\n' << "Time elapsed : " << 1.0 * clock() / CLOCKS_PER_SEC << " sec \n";
    #endif
    return 0;
}


Measured memory_bytes: 3656
#include <cstdio>

int main(void){
	int n;
	long a, max=-1000000, min=1000000, sum=0;

	scanf(" %d", &n);
	for(int i=0; i<n; ++i){
		scanf(" %ld", &a);
		if(a>max) max = a;
		if(a<min) min = a;
		sum+=a;
	}

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

	return 0;
}


Measured memory_bytes: 2768
#include<bits/stdc++.h>
using namespace std;
#define nl '\n' 
#define fast ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ll long long int
#define pii pair <int,int>
ll m=1000000007;

int main()
{
	fast;
	char x;cin>>x;
	if(x-'a'>=0)
		cout<<"a";
	else
		cout<<"A";
	cout<<nl;
}

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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<int, int> Pi;
typedef vector<ll> Vec;
typedef vector<int> Vi;
typedef vector<string> Vs;
typedef vector<P> VP;
typedef vector<vector<ll>> VV;
typedef vector<vector<int>> VVi;

#define REP(i, a, b) for(ll i=(a); i<(b); i++)
#define PER(i, a, b) for(ll i=(a); i>=(b); i--)
#define rep(i, n) REP(i, 0, n)
#define per(i, n) PER(i, n, 0)
const ll INF=1e18+18;
const ll MAX=100005;
const ll MOD=1000000007;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl;
#define YES(n) cout << ((n) ? "YES" : "NO") << endl;
#define ALL(v) v.begin(), v.end()
#define rALL(v) v.rbegin(), v.rend()
#define pb(x) push_back(x)
#define mp(a, b) make_pair(a,b)
#define Each(a,b) for(auto &a :b)
#define REPM(i, mp) for (auto i = mp.begin(); i != mp.end(); ++i)
#define dbg(x_) cerr << #x_ << ":" << x_ << endl;
#define dbgmap(mp) cerr << #mp << ":"<<endl; for (auto i = mp.begin(); i != mp.end(); ++i) { cerr << i->first <<":"<<i->second << endl;}
#define dbgarr(n,m,arr) rep(i,n){rep(j,m){cerr<<arr[i][j]<<" ";}cerr<<endl;}
#define dbgdp(n,arr) rep(i,n){cerr<<arr[i]<<" ";}cerr<<endl;
#define dbgmint(n,arr) rep(i,n){cerr<<arr[i].x<<" ";}cerr<<endl;
#define out(a) cout<<a<<endl
#define out2(a,b) cout<<a<<" "<<b<<endl
#define vout(v) rep(i,v.size()){cout<<v[i]<<" ";}cout<<endl
#define Uniq(v) v.erase(unique(v.begin(), v.end()), v.end())
#define fi first
#define se second

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

template<typename T1, typename T2>
ostream &operator<<(ostream &s, const pair<T1, T2> &p) { return s<<"("<<p.first<<", "<<p.second<<")"; }

template<typename T>istream& operator>>(istream&i,vector<T>&v)
{rep(j,v.size())i>>v[j];return i;}

// vector
template<typename T>
ostream &operator<<(ostream &s, const vector<T> &v) {
    int len=v.size();
    for(int i=0; i<len; ++i) {
        s<<v[i];
        if(i<len-1) s<<"	";
    }
    return s;
}

// 2 dimentional vector
template<typename T>
ostream &operator<<(ostream &s, const vector<vector<T> > &vv) {
    int len=vv.size();
    for(int i=0; i<len; ++i) {
        s<<vv[i]<<endl;
    }
    return s;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<std::setprecision(10);

    ll n,t;
    cin>>n>>t;
    Vec a(n);
    cin>>a;
    Vec m(n+1);
    m[n] = 0;
    per(i,n-1){
        chmax(m[i],max(m[i+1],a[i]));
    }
    map<ll,ll> mp;
    rep(i,n){
        mp[a[i]]++;
    }
    ll k = 0;
    rep(i,n){
        chmax(k,m[i]-a[i]);
    }
    ll ans=0;

    rep(i,n){
        if(m[i]-a[i]==k){
            ans += mp[a[i]+k];
        }
    }
    cout<<ans<<endl;
    return  0;
}


Measured memory_bytes: 8064
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
const int maxn = 200007;
const ll inf = 1e9 + 7;
int n;
int arr[maxn][3], dp[maxn][3];

bool comp(int a, int b)
{
    return a < b;
}

int main()
{
    cin >> n;
    for (int i = 0; i < n; i++)
    {
        cin >> arr[i][0] >> arr[i][1] >> arr[i][2];
    }
    dp[0][0] = arr[0][0];
    dp[0][1] = arr[0][1];
    dp[0][2] = arr[0][2];
    for (int i = 1; i < n; i++)
    {

        dp[i][0] = max(dp[i - 1][1], dp[i - 1][2]) + arr[i][0];
        dp[i][1] = max(dp[i - 1][0], dp[i - 1][2]) + arr[i][1];
        dp[i][2] = max(dp[i - 1][1], dp[i - 1][0]) + arr[i][2];
    }

    cout << max({dp[n - 1][0], dp[n - 1][1], dp[n - 1][2]}, comp);

    return 0;
}

Measured memory_bytes: 5980
#include <cstdio>
#include <algorithm>

long long fact(long long x) {
    long long r = 1;
    for (long long i = 2; i <= x; i++) {
        r = r * i % 1000000007;
    }
    return r;
}
int main()
{
    long long n, m;
    scanf("%lld%lld", &n, &m);

    long long dif = abs(n - m);
    long long ans;
    if (dif == 1) {
        ans = fact(n) * fact(m) % 1000000007;
    } else if (dif == 0) {
        ans = fact(n) * fact(m) * 2 % 1000000007;
    } else {
        ans = 0;
    }
    printf("%lld\n", ans);
}


Measured memory_bytes: 128
#include<iostream>
#include<string>
#include<iomanip>
#include<cmath>
#include<vector>
#include<algorithm>
#include<utility>

using namespace std;

#define int long long
#define endl "\n"

constexpr long long INF = (long long)1e18;
constexpr long long MOD = 1'000'000'007; 

struct fast_io {
	fast_io(){
		std::cin.tie(nullptr);
		std::ios::sync_with_stdio(false);
	};
} fio;

signed main(){
	cout<<fixed<<setprecision(10);
	
	string S;
	string hoge = "keyence";
	
	cin>>S;
	
	if(S == hoge){
		cout<<"YES"<<endl;
	} else {
		string x;
		for(int i = 0; i + 1 < hoge.size(); i++){
			x += S[i];
			string y = S.substr(S.size() - (7 - i) + 1, 7-i+1);
			// cout<<x+y<<endl;
			if(x+y == hoge) {
				cout<<"YES"<<endl;
				return 0;
			}
		}
		
		cout<<"NO"<<endl;
	}
	
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <functional>
#include <cstdlib>
#include <sstream>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <complex>
#include <vector>
#include <bitset>
#include <cstdio>
#include <cmath>
#include <time.h>
#include <tuple>
#define all(c) ((c).begin(),(c).end())
#define rall(c) ((c).rbegin(),(c).rend())
//#define sort(v,n) sort(v,v+n)
#define ll long long
#define fi first
#define se second
#define inf 999999999
using namespace std;
const ll MOD = 1e9 + 7;
const double PI = acos(-1.0);
//---------------------------------------------------------------------------------------------//
int t, p, r;
int main() {
	while (cin >> t >> p >> r, t) {
		int score[55];
		bool accepted[55][11];
		for (int i = 0; i < 55; i++)score[i] = 0;
		int wrong[55][11];
		for (int i = 0; i < 55; i++)
			for (int j = 0; j < 11; j++)  wrong[i][j] = 0, accepted[i][j] = 0;
		for (int i = 0; i < r; i++) {
			int tid, pid, time;
			string a;
			cin >> tid >> pid >> time >> a;
			tid--; pid--;
			if (accepted[tid][pid] == 1)continue;
			if (a[0] == 'W') {
				wrong[tid][pid]++;
			}
			else {
				score[tid] += time + wrong[tid][pid] * 1200;
				accepted[tid][pid] = 1;
			}
		}
		vector < pair <pair <int, int>, int >> vpp;
		for (int i = 0; i < t; i++) {
			int cont = 0;
			for (int j = 0; j < p; j++) {
				if (accepted[i][j])cont++;
			}
			vpp.push_back( pair<pair<int,int>,int>(pair<int,int>(cont,-score[i]),-i-1));
		}
		sort(vpp.begin(), vpp.end());
		for (int i = t-1; i >=0; i--) {
			cout << -vpp[i].second << " " << vpp[i].first.first << " " << -vpp[i].first.second << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 3164