akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <set>
#include <string>
using namespace std;

int main() {
	int n;cin >> n;
	string a,b,c;
	cin >>a;
	cin >>b;
	cin >>c;
	int cnt =0;
	for(int i=0;i<n;++i){
		set<char> st;
		st.insert((char)a[i]);
		st.insert((char)b[i]);
		st.insert((char)c[i]);
		if(st.size()==2)++cnt;
		if(st.size()==3)cnt+=2;
	}
	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 384
import itertools
n,m,q=map(int,input().split())
a=[0 for i in range(q)]
b=[0 for i in range(q)]
c=[0 for i in range(q)]
d=[0 for i in range(q)]
for i in range(q):
    a[i],b[i],c[i],d[i]=map(int,input().split())
    b[i]-=1;a[i]-=1
ans=0
for seq in itertools.combinations_with_replacement(range(m),n):
    tmp = 0
    for i in range(q):
        if seq[b[i]]-seq[a[i]]==c[i]:
            tmp+=d[i]
    ans=max(ans,tmp)
print(ans)


Measured memory_bytes: 9196
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define ft first
#define sd second
#define fr(i,n) for(int i=0;i<(n);++i)
#define Fr(i,n) for(int i=1;i<=(n);++i)
#define ifr(i,n) for(int i=(n)-1;i>=0;--i)
#define iFr(i,n) for(int i=(n);i>0;--i)

vector<pair<int,int>> p;
vector<set<int>> x(100001),y(100001),z;
vector<bool> vx(100001),vy(100001);


void sy(int i,set<int>& s,set<int>& t);

void sx(int i,set<int>& s,set<int>& t){
    if(vx[i]) return;
    vx[i]=1;
    for(auto& j:x[i]){
        if(s.insert(j).sd){
            sy(j,s,t);
        }
    }
}

void sy(int i,set<int>& s,set<int>& t){
    if(vy[i]) return;
    vy[i]=1;
    for(auto& j:y[i]){
        if(t.insert(j).sd){
            sx(j,s,t);
        }
    }
}

ll slvx(int i){
    if(vx[i]) return 0;
    if(x[i].size()==1) return 0;
    set<int> s,t;
    t.insert(i);
    sx(i,s,t);
    return s.size()*t.size();
}

ll slvy(int i){
    if(vy[i]) return 0;
    if(y[i].size()==1) return 0;
    set<int> s,t;
    s.insert(i);
    sy(i,s,t);
    return s.size()*t.size();
}

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n;
    cin>>n;
    p.resize(n);
    for(auto& i:p){
        cin>>i.ft>>i.sd;
        x[i.ft].insert(i.sd);
        y[i.sd].insert(i.ft);
    }
    ll ans=0;
    fr(i,n){
        ans+=slvx(p[i].ft)+slvy(p[i].sd);
    }
    fr(i,n){
        ans+=!vx[p[i].ft];
    }
    cout<<ans-n<<endl;
}

Measured memory_bytes: 29184
#include <bits/stdc++.h>
#include <complex>
#include <iomanip>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define fi first
#define se second
#define mp make_pair
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;

ll N,M,H,W,K,Q,A,B,C,L,R;
string S,T;
const ll MOD = (1e+9) + 7;
const ll INF = 1LL << 60;
const long double EPS = 1e-9;
typedef pair<ll,ll> P;

typedef vector<P> vp;
typedef vector<vp> matP;

int main() {
    cin>>A>>B;
    cout<<((A%3 == 0)||(B%3 == 0)||((A+B)%3 == 0) ? "Possible" : "Impossible")<<endl;
}

Measured memory_bytes: 256
use std::io::stdin;
use std::vec::Vec;

mod utils {
    use std::io::BufRead;
    use std::str::{self, FromStr};

    pub struct StdinReader<R: BufRead> {
        reader: R,
        buf: Vec<u8>,
    }

    impl<R: BufRead> StdinReader<R> {
        pub fn new(reader: R) -> StdinReader<R> {
            StdinReader {
                reader: reader,
                buf: Vec::new(),
            }
        }

        #[allow(unused)]
        #[inline]
        pub fn reads<T: FromStr>(&mut self) -> T {
            self.read_until(b' ')
        }

        #[allow(unused)]
        #[inline]
        pub fn readl<T: FromStr>(&mut self) -> T {
            self.read_until(b'\n')
        }

        #[allow(unused)]
        #[inline]
        pub fn read_vec<T: FromStr>(&mut self) -> Vec<T> {
            return self.read_until::<String>(b'\n').trim().split_whitespace().map(|c| c.parse().ok().unwrap()).collect();
        }

        #[inline]
        pub fn read_until<T: FromStr>(&mut self, delim: u8) -> T {
            loop {
                self.buf.clear();
                let len = self.reader
                    .read_until(delim, &mut self.buf)
                    .expect("failed reading bytes");
                match len {
                    0 => panic!("early eof"),
                    1 if self.buf[0] == delim => (),
                    _ => {
                        if self.buf[len - 1] == delim {
                            self.buf.truncate(len - 1);
                        }
                        break;
                    }
                }
            }

            let elem = unsafe { str::from_utf8_unchecked(&self.buf) };
            elem.parse().unwrap_or_else(|_| panic!(format!("failed parsing: {}", elem)))
         }
    }
}


fn main(){
    let stdin = stdin();
    let mut r = utils::StdinReader::new(stdin.lock());
    let a:i32 = r.reads();
    let b:i32 = r.readl();
    if(a < b){
        for i in 0..b {
            print!("{}",a);
        }
    }else{
        for i in 0..a {
            print!("{}",b);
        }
    }
}   


Measured memory_bytes: 4352
import java.math.*;
import java.util.*;
import java.util.function.*;
 
public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    List<BigInteger> A = new LinkedList<>();
    for (int i = 0; i < N; i++) A.add(BigInteger.valueOf(sc.nextInt()));
    sc.close();

    BigInteger lcm = A.stream().parallel()
      .reduce(BigInteger.ONE, (a, b) -> a.divide(a.gcd(b)).multiply(b));

    BigInteger ans = A.stream().parallel()
      .map(lcm::divide)
      .reduce(BigInteger::add)
      .get();

    BigInteger mod = BigInteger.valueOf(1000000007);
    System.out.println(ans.mod(mod));
  }
}

Measured memory_bytes: 194952
#include <bits/stdc++.h>
#include<cmath>
#define big long long
using namespace std;
 
int main() {
 
	//freopen("in.txt","r",stdin);
	//freopen("out.txt","w",stdout);

	int n,k,q;
	cin>>n>>k>>q;
	vector<int>a(n);
	for(int i=0;i<n;i++)
	{
		a[i]=k-q;
	}
	while(q--)
	{
		int t;
		cin>>t;
		a[t-1]++;
	}
	for(int i=0;i<n;i++)
	{
		if(a[i]<=0) cout<<"No"<<endl;
		else cout<<"Yes"<<endl;
	}
	return 0;

}

Measured memory_bytes: 1024
let () = Scanf.scanf "%d\n" @@ fun n ->
  let xs = Array.init n @@ fun _ -> Scanf.scanf "%d " @@ fun x -> x in
  Printf.printf "%d\n" @@
  Array.fold_left min max_int @@
  Array.init 101 @@ fun x ->
    Array.fold_left ( + ) 0 @@
    Array.init n @@ fun i ->
      (xs.(i) - x) * (xs.(i) - x)

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

using namespace std; 

int main(){ 
  string a,b;
  cin>>a>>b;
  if(a==b) cout<<"EQUAL";
  else if(a.size()<b.size()) cout<<"LESS";
  else if(a.size()>b.size()) cout<<"GREATER";
  else if(a<b) cout<<"LESS";
  else cout<<"GREATER";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(long long int i = 0; i < n; i++)
#define print(n) std::cout << n << std::endl
#define _print(n) std::cout << n
using namespace std;
typedef long long ll;
const int N = 1000000;

int main() {
    long double a,b,c; cin >> a >> b >> c;
    long double d = min({a,b,c});
    long double A = sqrt(a/d);
    long double B = sqrt(b/d);
    long double C = sqrt(c/d);

    long double D = A + B;


    if(D < C)print("Yes");
    else print("No");
}

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

int main() {
  
  int A, B, C, D;
  cin >> A >> B >> C >> D;
  
  int Left, Right;
  Left = A + B;
  Right = C + D;
  
  if (Left > Right) cout << "Left";
  if (Left < Right) cout << "Right";
  if (Left == Right) cout << "Balanced";  
   
    
}

Measured memory_bytes: 256
import java.util.*;

class Graph {
	private int totalVertex;
	private LinkedList<LinkedList<Integer>> adjList;
	//adjacency list of edges
	public Graph() { totalVertex = 0; }
	public void loadAdjList() {
		Scanner in = new Scanner(System.in);
		totalVertex = in.nextInt();
		adjList = new LinkedList<LinkedList<Integer>>();
		for(int i = 0; i < totalVertex; i ++) {
			LinkedList<Integer> tmp = new LinkedList<Integer>();
			int idx1 = in.nextInt() - 1;
			int degree = in.nextInt();
			//System.out.println("mark idx1 = " + idx1 + " degree = " + degree);
			for(int j = 0; j < degree; j ++) {
				int idx2 = in.nextInt() - 1;
				tmp.add(idx2);
			}	
			adjList.add(tmp);
		}
		in.close();
	}
	
	public int[][] shortestPath() {
		ArrayList<Integer> visited = new ArrayList<>();
		visited.add(1);
		Queue<Integer> q = new LinkedList<Integer>();
		q.add(1);
		int path = 0;
		int[][] result = new int[totalVertex][2];
		for(int k = 0; k < totalVertex; k++) {
			result[k][0] = k+1;
		}
		while(!q.isEmpty()) {
			int s = q.size();
			int[] temps = new int[q.size()];
			for(int i = 0; i < s; i++) {
				temps[i] = q.remove();
			}
			for(int l = 0; l < temps.length; l++) {
				result[temps[l]-1][1] = path;
				for(int j = 0; j < adjList.get(temps[l]-1).size(); j++) {
					int temp2 = adjList.get(temps[l]-1).get(j);
					if(!visited.contains(temp2+1)) {
						visited.add(temp2+1);
						q.add(temp2+1);
					}
				}
			}
			path +=1;
		}
		for(int n = 1; n < totalVertex; n++) {
			if(result[n][1] == 0) {
				result[n][1] = -1;
			}
		}
		return result;
	}
}

//change class name GraphRepresentation to Main() for submission to AIZU
public class Main {
	public static void main(String argv[]) {
		Graph g = new Graph();
		g.loadAdjList();
		int[][] result = g.shortestPath();
		for(int i = 0; i < result.length; i++) {
			System.out.println(result[i][0] + " " + result[i][1]);
		}
	}
}


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

void solve() {
    long long n;
    cin >> n;
    long long ans = n * (n - 1) / 2;
    cout << ans;
}

int main() {
    ios::sync_with_stdio(NULL), cin.tie(0), cout.tie(0);
    cout.setf(ios::fixed), cout.precision(20);
    solve();
    return 0;
}


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

///経路を復元する関数
int flags[101][101] = {0};
void regenerate_path(int start, int end, vector<vector<pair<int, int>>> dp,
                                        set<pair<int, int>> &paths)
{
  //vector<pair<int, int>> path;
  if(flags[start][end] == 1 || flags[end][start] == 1) return;
  if(dp[start][end].second == start)
  {
    //path.push_back({min(start,end), max(start, end)});
    paths.insert({min(start, end), max(start, end)});
    flags[start][end] = 1;
    flags[end][start] = 1;
    //return path;
    return ;
  }
  //vector<pair<int, int>> temp1 = regenerate_path(start, dp[start][end].second, dp, paths);
  //vector<pair<int, int>> temp2 = regenerate_path(dp[start][end].second, end, dp, paths);
  regenerate_path(start, dp[start][end].second, dp, paths);
  regenerate_path(dp[start][end].second, end, dp, paths);
  flags[start][end] = 1;
  flags[end][start] = 1;

  //path.insert(path.end(), temp1.begin(), temp1.end());
  //path.insert(path.end(), temp2.begin(), temp2.end());
  ///return path;
  return ;
};

int main() {
  int n, m;
  cin >> n >> m;
  struct edge
  {
    int a, b, c;
  };
  vector<edge> edges(m);
  for(int i = 0; i < m; i++)
  {
    int a, b, c;
    cin >> a >> b >> c;
    edges[i] = {a - 1, b - 1, c};
  }
  const int max_dist = 1000 * 1000 + 1;
  ///隣接行列の作成
  vector<vector<pair<int, int>>> dp(n, vector<pair<int, int>>(n, {max_dist, -1}));
  for(auto e : edges)
  {
    dp[e.a][e.b] = {e.c, e.a};
    dp[e.b][e.a] = {e.c, e.b};
  }
  for(int i = 0; i < n; i++)
  {
    dp[i][i] = {0, -1};
  }
  ///ワーシャルフロイド法
  for(int k = 0; k < n; k++)
  {
    for(int i = 0; i < n; i++)
    {
      for(int j = 0; j < n; j++)
      {
        if(dp[i][j].first > dp[i][k].first + dp[k][j].first)
        {
          dp[i][j].first = dp[i][k].first + dp[k][j].first;
          dp[i][j].second = k;
        }
      }
    }
  }
  ///すべての経路について経路復元を行いsetにパスを追加していく
  set<pair<int, int>> paths;
  for(int i = 0; i < n - 1; i++)
  {
    for(int j = i + 1; j < n ; j++)
    {
      regenerate_path(i, j, dp, paths);
    }
  }
  cout << m - paths.size() << endl;
  return 0;
}


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

public class Main {
    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new
                    InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

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

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }

    static FastReader s = new FastReader();
    static PrintWriter out = new PrintWriter(System.out);

    private static int[] rai(int n) {
        int[] arr = new int[n];
        for (int i = 0; i < n; i++) {
            arr[i] = s.nextInt();
        }
        return arr;
    }

    private static int[][] rai(int n, int m) {
        int[][] arr = new int[n][m];
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < m; j++) {
                arr[i][j] = s.nextInt();
            }
        }
        return arr;
    }

    private static long[] ral(int n) {
        long[] arr = new long[n];
        for (int i = 0; i < n; i++) {
            arr[i] = s.nextLong();
        }
        return arr;
    }

    private static long[][] ral(int n, int m) {
        long[][] arr = new long[n][m];
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < m; j++) {
                arr[i][j] = s.nextLong();
            }
        }
        return arr;
    }

    private static int ri() {
        return s.nextInt();
    }

    private static long rl() {
        return s.nextLong();
    }

    private static String rs() {
        return s.next();
    }

    static boolean isPrime(int val)
    {
        int flag=0;
        for(int i=2;i<=Math.sqrt(val);i++)
        {
            if(val%i==0)
            {
                flag=1;
                break;
            }
        }
        return flag==0;
    }
    public static void main(String[] args) throws IOException {
        StringBuilder ans = new StringBuilder();
//        int t=ri();
        int t=1;
        while (t-- > 0)
        {
            int[] arr=rai(5);
            for(int i=0;i<5;i++)
            {
                if(arr[i]==0)
                {
                    ans.append(i+1).append("\n");
                    break;
                }
            }
        }
        out.print(ans.toString());
        out.flush();

    }
}
//9999991


Measured memory_bytes: 25432
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<iostream>
#include<queue>
#include<stack>
#include<utility>
#include<vector>
using namespace std;

typedef long long lint;

int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    for(int i = 0 ; i < n ; i++){
        cin >> a[i];
    }
    int ans = 0;
    for(int i = 0 ; i < n ; i++){
        while(a[i] % 2 == 0){
            a[i] /= 2;
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
N,M = map(int, input().split())
py = [(0,0,0)]*M
for i in range(M):
    p,y = map(int,input().split())
    py[i] = (p,y,i)

py.sort(key=lambda x:(x[0], x[1]))

ans = [(0,0)]*M

year = 1
tmp_city = 0

for index, i in enumerate(py):
    city_str = "{}".format(i[0]).zfill(6)
    if tmp_city != i[0]:
        year = 1
    year_str = "{}".format(year).zfill(6)
    tmp_city = i[0]
    year += 1
    
    ans_str = city_str + year_str
    
    ans[index] = (ans_str,i[2])

ans.sort(key=lambda x:x[1])
for i in ans:
    print(i[0])

Measured memory_bytes: 35520
#include <iostream>
#include <cstring>
#include <stdlib.h>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <math.h>
#include <string>
#include <map>
using namespace std;

int main()
{
    int N,K;
    cin >> N >> K;
    if(N%K==0) cout << 0;
    else cout << 1;
    
    return 0;
}

Measured memory_bytes: 256
def get_i() #空白区切の入力を数値(整数)の配列で返す
  return gets.chomp.split(" ").map(&:to_i)
end
def get_f() #空白区切の入力を数値(実数)の配列で返す
  return gets.chomp.split(" ").map(&:to_f)
end
def get() #空白区切の入力を文字列の配列で返す
  return gets.chomp.split(" ")
end
def get_nsp() #入力されたものを一文字ずつに区切った文字列の配列で返す
  return gets.chomp.split("")
end
def yn_judge(bool,y="Yes",n="No") #boolに真偽を投げることで、trueならy、falseならnの値を出力する
  return bool ? y : n 
end
def array(size1,init=nil,size2=1) #size2に二次元配列時の最初の要素数、size1に次の配列の大きさ、initに初期値を投げることでその配列を返す
  if size2==1
    return Array.new(size1){init}
  else
    return Array.new(size2){Array.new(size1){init}}
  end
end

find={}
("a".."z").to_a.each do|key|
    find[key]=0
end
S=get_nsp
S.each do|c|
    find[c]=1
end
ans=-1
find.each do|key,val|
  if val.zero?
    ans=key
    break
  end
end
if ans==-1
    puts "None"
else
    puts ans
end

Measured memory_bytes: 6908
#include <bits/stdc++.h>
// #include <math.h>
// #include <cmath>
// #include <vector>
// #include <utility> 
// #include <unordered_map>
// #include <map>
// #include <string>

using namespace std;
typedef long long int lli;

#define M_PI_H  3.14159265358979323846/2  /* pi by two*/
#define rep(i, start, end) for(int i = start; i < end; i++) 
#define repr(i, start, end) for(int i = start; i >= end; i--)   //INCLUSIVE



int main() 
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	cout.tie(NULL);
	
	int a[102] = {0};
	int x, n; cin>>x>>n;
	rep(i, 0, n){
		int j; cin>>j;
		a[j] = 1;
	}

	int high=-1, low=-1;
	int i=x;
	while(true){
		if(a[i] == 0){
			high = i; break;
		} else { 
			i++;
		}
	}
	i=x;
	while(true){
		if(a[i] == 0){
			low = i; break;
		} else {
			i--;
		}
	}

	if(high == -1){
		cout<<low; return 0;
	}

	if(low == -1){
		cout<<high; return 0;
	}

	if(high-x < x-low){
		cout<<(high);
	} else{
		cout<<low;
	} 

    return 0;
}

Measured memory_bytes: 3648
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

public class Main {

    private static Scanner sc;

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

    private void solve() {
        try {
        	int a = sc.nextInt();
        	int b = sc.nextInt();
        	int c = sc.nextInt();
        	int max = Math.max(a, Math.max(b, c));
        	int kaisuu = 0;

        	List<Integer> list = new ArrayList<>();
        	list.add(a);
        	list.add(b);
        	list.add(c);

        	//まず2あげるのを使って、最大値に近づける
        	int pos = 0;
        	for(Integer i : list) {
        		if(max == i) {
        			//同じなら次へ
        			pos ++;
        			continue;
        		}else {
        			//違う
        			kaisuu = kaisuu + (max - i) / 2;
        			if((max - i) % 2 != 0) {
        				list.set(pos, max - 1);
        			}else {
        				list.set(pos, max);
        			}
        			pos ++;
        		}
        	}

        	if((list.get(0)== list.get(1)) &&  (list.get(0)== list.get(2))) {
        		//すべての値が一致
        		System.out.println(kaisuu);
        		return;
        	}

        	pos = 0;
        	int notMaxEqlCount = 0;
        	for(Integer j : list) {
        		if(j != max) {
        			notMaxEqlCount++;
        		}
        	}

        	if(notMaxEqlCount == 1) {
        		System.out.println(kaisuu + 2);
        	}else {
        		System.out.println(kaisuu + 1);
        	}

        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    private class Scanner {
        String[] s;
        int i;
        BufferedReader br;
        String regex = " ";

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

        @Override
        protected void finalize() throws Throwable {
            try {
                super.finalize();
            } finally {
                destruction();
            }
        }

        private void destruction() throws IOException {
            if (br != null) br.close();
        }

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

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

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

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

Measured memory_bytes: 22484
n = int(input())
arr = list(map(int, input().split()))
total = 1
if 0 in arr:
    print(0)
else:
    for num in arr:
        if total > 10**18:
            break
        total *= num
    if total > 10**18:
        print(-1)
    else:
        print(total)

Measured memory_bytes: 21588
#include<stdio.h>
int main(){
	int room[5][4][11]={0},n,a,b,c,d;
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		scanf("%d %d %d %d",&a,&b,&c,&d);
		room[a][b][c]=d+room[a][b][c];
	}
	
	for(int x=1;x<=4;x++){
		for(int y=1;y<=3;y++){
			for(int z=1;z<=10;z++){
				printf(" %d",room[x][y][z]);
			}
			printf("\n");
		}
		if(x!=4){
			printf("####################\n");
		}
	}
	return 0;
}

Measured memory_bytes: 2676
//#include <bits/stdc++.h>
#include <string>
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <utility>
#include <climits>

using namespace std;
using ll=long long;

void solve(){
  while(true){
  int num;
  cin >> num;if(num==0){return;}
  int ma=0,mi=10000,sum=0;
  for(int i=0;i<num;i++){
    int c=0;
    cin >> c;
    ma=max(ma,c);
    mi=min(mi,c);
    sum+=c;
  }
  cout << (sum-ma-mi)/(num-2) << endl;
  }
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int roop=1;
  while(roop--)
    solve();
  return 0;
}



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

typedef long long LL;

int main(void){
  LL n,prod,ans;
  
  cin >> n >> prod;
  ans = 1;
  for (LL i=2; i*i<=prod; i++){
    int cnt=0;
    if (prod%i!=0) continue;
    while (prod%i==0){
      prod /= i;
      cnt++;
    }
//    cout << i << "^" << cnt << endl;
    for (cnt/=n; cnt>0; cnt--) ans *= i;
  }
  // n=1なら残った素数が使える
  if (n==1) ans*=prod;
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
import Control.Monad

main = do
    w <- getLine
    if w == "-"
        then return ()
        else do
            shuffleWord w
            main

shuffleWord w = do
    sm <- getLine
    let nm = read sm :: Int
    shufflesS <- replicateM nm getLine
    let shufflesN = map (\x -> read x :: Int) $ shufflesS
    let result = foldl shuffle w shufflesN
    putStrLn result

shuffle :: String -> Int -> String
shuffle w n = (drop n w) ++ (take n w)


Measured memory_bytes: 4176
import Control.Applicative ((<$>))

main :: IO ()
main = solve <$> map read <$> words <$> getLine >>= putStrLn

solve :: [Int] -> String
solve [m, f, b] | lm < 0 = "0"
                | lm > f = "NA"
                | otherwise = show lm
  where lm = b - m



Measured memory_bytes: 3644
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <tuple>
#include <utility>
#include <vector>
#define ll long long
#define itn int
#define endl '\n'
#define co(ans) cout<<ans<<endl
#define COYE cout<<"YES"<<endl
#define COYe cout<<"Yes"<<endl
#define COye cout<<"yes"<<endl
#define CONO cout<<"NO"<<endl
#define CONo cout<<"No"<<endl
#define COno cout<<"no"<<endl
#define FORE(i,a) for(auto &i:a)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n)  FFOR(i,1,n)
#define PB push_back
#define MP make_pair
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort((V).begin(),(V).end())
#define REVERSE(V) reverse((V).begin(),(V).end())
#define EACH(V,i) for(typeof((V).begin()) i=(V).begin();i!=(V).end();++i)
#define equals(a,b) (fabs((a)-(b))<EPS)
#define INF ((1LL<<62)-(1LL<<31))
#define EPS 1e-10
#define PI 3.141592653589793238
#define MOD 1000000007
#define MMOD 998244353
#define MAX 2010101
using namespace std;
using Edge=pair<ll,ll>;
using Graph=vector<vector<int>>;
inline int toInt(string s){int v;istringstream sin(s);sin>>v;return v;}
template<class T>inline string toString(T x){ostringstream sout;sout<<x;return sout.str();}
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return 1;}return 0;}
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int,int> PII;
typedef pair<ll,ll> PLL;
typedef long long LL;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

int main(){
  ll XS,YS,XG,YG,N;
  cin>>XS>>YS>>XG>>YG>>N;
  
  ll X[N+2],Y[N+2],R[N+2];
  RREP(i,N) cin>>X[i]>>Y[i]>>R[i];
  X[0]=XS,Y[0]=YS,R[0]=0;
  X[N+1]=XG,Y[N+1]=YG,R[N+1]=0;
  
  long double DIS[N+2][N+2];
  REP(i,N+2){
    REP(j,N+2){
      DIS[i][j]=sqrt((X[i]-X[j])*(X[i]-X[j])+(Y[i]-Y[j])*(Y[i]-Y[j]))-(R[i]+R[j]);
      if(DIS[i][j]<0) DIS[i][j]=0;
    }
  }
  
  long double ANS[N+2];
  REP(i,N+2) ANS[i]=DIS[0][i];
  priority_queue<pair<long double,ll>> P;
  RREP(i,N+1) P.emplace(MP(-ANS[i],i));
  
  while(!P.empty()){
    ll a=P.top().first,b=P.top().second;
    P.pop();
    
    REP(i,N+2){
      if(i!=b && ANS[i]>ANS[b]+DIS[b][i]){
        ANS[i]=ANS[b]+DIS[b][i];
        P.emplace(MP(-ANS[i],i));
      }
    }
  }
  
  cout<<setprecision(15)<<ANS[N+1]<<endl;
  return 0;
}

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

int SOINSU(int x) {
  int ans = 1;
  int y = x;
  for (int i=2; i<x; i++) {
    int SOISU=1;
    while (y%i == 0) {
      SOISU++;
      y /= i;
    }
    ans *= SOISU;
  }
  return ans;
}

int main() {
  int n;
  scanf("%d", &n);
  int ans = 0;
  for (int i=1; i<=n; i++) {
    if (i%2 == 1 && SOINSU(i) == 8) ans++;
  }
  printf("%d\n", ans);
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#define INF 0x3f3f3f3f
#include <cstdio>
#include <iostream>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>
#include <cctype>
#include <utility>
 
using namespace std;
 
typedef long long ll;
typedef pair <int,int> P;
typedef pair <int,P > PP;
 
int tx[] = {0,1,0,-1};
int ty[] = {-1,0,1,0};
 
static const double EPS = 1e-8;
 
int main(){
 
    int n,k,m;
 
    while(~scanf("%d %d %d",&n,&k,&m)){
        if(n==0) break;
 
        vector<int> nums;
        for(int i=1;i<=n;i++){
            nums.push_back(i);
        }
 
        int pos = m-1;
 
        while(nums.size() > 1){
            nums.erase(nums.begin()+pos);
            pos--;
            pos = (pos + k) % nums.size();
        }
 
        printf("%d\n",nums[0]);
    }
}

Measured memory_bytes: 1300
#pragma region
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <map>
#include <queue> 
#include <stack>
#include <set>
#include <list>

using namespace std;
typedef long long ll;
//#define rep(i, s, e) for (int(i) = (s); (i) < (e); ++(i))
#define rep(i, e) for (int(i) = 0; (i) < (e); ++(i))
#define all(x) x.begin(),x.end()
#pragma endregion


int main()
{
	int n; cin >> n;
	deque<int> q;
	while (n--)
	{
		int a; cin >> a;
		int it = lower_bound(all(q), a) - q.begin();
		if (it == 0)q.push_front(a);
		else q[it - 1] = a;
	}
	cout << q.size() << endl;
}

Measured memory_bytes: 640
#include <cmath>
#include <cstdio>
#include <limits>
#include <tuple>
#include <stack>
#include <queue>
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <numeric>
#include <string>
#include <array>
#include <iomanip>

#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define all(x) x.begin(), x.end()

using namespace std;
using ll = long long;

int main() {
  ios::sync_with_stdio(false);
  ll n, c;
  cin >> n >> c;

  vector<vector<ll>> req(30, vector<ll>(100001, 0));
  rep(i, n) {
    ll s, t, cc;
    cin >> s >> t >> cc;
    --cc;
    for (int j = s; j <= t; ++j) {
      req.at(cc).at(j)=1;
    }
  }

  vector<ll> sumrec(100001);
  rep(i, c) {
    rep(j, req.at(i).size()) {
      sumrec.at(j) += req.at(i).at(j);
    }
  }

  ll ans = *max_element(all(sumrec));

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 24576
#include <stdio.h>

int main(void)
{
	int a,b,c,w;
	scanf("%d%d%d",&a,&b,&c);
	
	if (a>b){
		w=a;
		a=b;
		b=w;
	}
	if(b>c){
		w=b;
		b=c;
		c=w;
	}
	if(a>b){
		w=a;
		a=b;
		b=w;
	}
	printf("%d %d %d\n",a,b,c);	
		
	return 0;
}


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

int K,N;
int p[2000000];

int main(){
	cin >> N >> K;
	for(int i = 0; i < N; i++){
		cin >> p[i];
		p[i] = 1 + p[i];
	}
	
	int mx = 0;
	int sm = 0;
	for(int i = 0; i < K; i++){
		sm += p[i];
	}
	mx = sm;
	for(int i = K; i < N; i++){
		sm -= p[i-K];
		sm += p[i];
		if(sm > mx){
			mx = sm;
		}
	}
	printf("%.7f\n",mx*0.5);
	return 0;
}


Measured memory_bytes: 1024
#include<cstdio>
using namespace std;
int q[200001];
void read(int&in){
	char c=getchar();in=0;
	while(c<48||c>57)c=getchar();
	while(c>47&&c<58)in=(in<<3)+(in<<1)+c-48,c=getchar();
}
int main(){
	int now,sum=0,n,head=1,tail=0;
	long long ans=0;
	read(n);
	while(n--){
		read(now);
		while((sum^now)!=sum+now)sum^=q[head++];
		sum^=(q[++tail]=now);
		ans+=tail-head+1;
	}
	printf("%lld",ans);
	return 0;
}

Measured memory_bytes: 896
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <utility>
#include <map>
#include <set>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
using namespace std;

#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define rep(i,n) for(int i = 0; i < n; ++i)
#define rrep(i,n) for(int i = (int)n - 1; i >= 0; --i)

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

int main() {
	string s;
	int K;
	cin >> s >> K;
	for(int i = 0; i < s.size(); i++) {
		if(s[i] == 'a') {
			;
		}
		else if(K >= 26-(s[i]-'a')) {
			K -= 26-(s[i]-'a');
			s[i] = 'a';
		}
	}
	int n;
	n = s.size()-1;
	s[n] = (s[n]-'a' + K) % 26  +'a';
	cout << s << endl;
}


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

int main(){
    int N,M;
    cin >> N>>M;
    int connect[M][N]={};
    for(int i=0;i<M;i++){
        int k;
        cin >>k;
        for(int j=0;j<k;j++){
            int tmp;
            cin >>tmp;
            connect[i][tmp-1]=1;
        }
    }
    int p[M];
    for(int i=0;i<M;i++){
        int tmp;
        cin >>tmp;
        p[i]=tmp;
    }
    int pattern=0;
    for(int i=0;i<pow(2.0,N);i++){
        int bit =1;
        int on[N]={};
        for(int j=0;j<N;j++){
            if(i&bit){
                on[j]=1;
            }
            bit=(bit<<1);
        }
        int counter=0;
        for(int j=0;j<M;j++){
            int tmp=0;
            for(int k=0;k<N;k++){
                if(connect[j][k]*on[k]){
                    tmp++;
                }
            }
            if(tmp%2==p[j]){
                counter++;
            }
        }
        if(counter==M){
            pattern++;
        }
    }
    cout<<pattern<<endl;
    return 0;
}

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


    using namespace std;
    typedef long long ll;
    # define M_PI  3.14159265358979323846
    const int MOD=1e9+7;

    void solve(){
        int a,b;
        cin>>a>>b;
        cout<<a*b;
    }

    int main(){
        ios::sync_with_stdio(0);
        cin.tie(0);
        cout.tie(0);
        cout<<fixed;
        cout<<setprecision(10);
        int t=1;
//        cin>>t;
        for(int i=1;i<=t;i++){
            solve();
        }
        return 0;
    }


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

class Main {
    public static void main(String[] args) {
        try {
            BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
            String line;
            Calendar cal = Calendar.getInstance();
            int y = 2004;
            int m;
            int d;
			while(true) {
            		line = br.readLine();
            		String[] lineList = line.split(" ", 0);
                m = Integer.parseInt(lineList[0]);
                d = Integer.parseInt(lineList[1]);
                if(m == 0) {
                	break;
                }
                System.out.println(getDay(y, m, d));
            }
            
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    /**
     * @param line
     *            ??´??°x,y?????\???
     * @return x,y????????§??¬?´???°
     */
    private static String getDay(int y, int m, int d) {
    		Calendar cal = Calendar.getInstance();
    		cal.set(y, m - 1, d);
        switch (cal.get(Calendar.DAY_OF_WEEK)) {
            case Calendar.SUNDAY: return "Sunday";
            case Calendar.MONDAY: return "Monday";
            case Calendar.TUESDAY: return "Tuesday";
            case Calendar.WEDNESDAY: return "Wednesday";
            case Calendar.THURSDAY: return "Thursday";
            case Calendar.FRIDAY: return "Friday";
            case Calendar.SATURDAY: return "Saturday";
        }
        throw new IllegalStateException();
    }
}

Measured memory_bytes: 25960
ma = lambda :map(int,input().split())
ni = lambda:int(input())
yn = lambda fl:print("Yes") if fl else print("No")
import collections
import math
import itertools
import heapq as hq
a,b,c = ma()
k = ni()
f = False
for i in range(k+1):
    if a < b*2**i and b*2**i <c*2**(k-i):
        f =True
yn(f)


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

#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define repp(i, n, m) for(int (i) = (n); (i) < (m); (i)++)
#define repn(i, n) for(int (i) = 1; (i) <= (n); (i)++)
#define repr(i, n) for(int (i) = (n-1); (i) >= 0; (i)--)
#define all(x) (x).begin(), (x).end()
#define lint long long
#define ulint unsigned long long
#define ldou long double
#define fi first
#define se second
#define setpre(x) std::cout << fixed << setprecision(x)
#define ii(x) int x; cin >> (x)
#define ii2(x, y) int x, y; cin >> (x) >> (y)
#define ii3(x, y, z) int x, y, z; cin >> (x) >> (y) >> (z)
#define out(x) cout << (x) << endl
#define outs(x) cout << (x) << " "
#define yn(x) cout << ((x)?("Yes"):("No")) << endl
#define YN(x) cout << ((x)?("YES"):("NO")) << endl
#define bit_c(x) __builtin_popcountll(x)

inline void logger(){ std::cout << " [LOGGER] " << endl; }
template<typename A, typename... B>
void logger(const A& a, const B&... b){
    cout << a << " , ";
    logger(b...);
}

typedef pair<lint, lint> P;
const lint MOD = 1000000007;
const lint MOD9 = 998244353;
const lint INF = MOD * MOD;
const int MAX = 3005;

/* ...o(^-^)o... */

double dp[MAX][MAX];
int main(){
    int n; cin >> n;

    repn(j, n) dp[0][j] = 0; dp[0][0] = 1;
    repn(i, n){
        double p; cin >> p;
        rep(j, i+1){
            dp[i][j] = dp[i-1][j-1]*p + dp[i-1][j]*(1-p);
        }
    }
    double ans = 0;
    repp(k, (n+1)/2, n+1) ans += dp[n][k];
    setpre(10); out(ans);
}

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

const int MOD = 1000000007;

int main(){
	int n, k;
	scanf("%d%d", &n, &k);
	long ans = 0;
	for(int i = k; i <= n + 1; i++)
		ans += (long)(n-i+1)*i + 1;
	printf("%ld\n", ans % MOD);
}

Measured memory_bytes: 3836
#include<cstdio>
#include<vector>
#include<algorithm>
using namespace std;

const int N_MAX = 100005;

int main(){
  int n;
  scanf("%d", &n);
  vector<int> problem(n);

  for(int i = 0; i < n; i++){
    int d;
    scanf("%d", &d);
    problem[i] = d;
  }

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

  int h = n / 2;

  int dl = problem[h-1];
  int dh = problem[h];
  int ans = dh - dl;

  printf("%d\n", ans);

  return 0;
}

Measured memory_bytes: 640
M, D = map(int, input().split())

ans = 0
for m in range(1, M + 1):
    for d in range(22, D + 1):
        d1 = int(str(d)[1])
        d10 = int(str(d)[0])
        if d1 == 1 or d10 == 1:
            continue
        if m == d1 * d10:
            ans += 1

print(ans)

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

int main(){
    ll n,d;
    cin>>n>>d;
    ll ans=0;
    while(n--){
        ll a,b;
        cin>>a>>b;
        ll D=a*a+b*b;
        if((ll)(d*d)>=D)
         ans++;
    }
    cout<<ans<<endl;
   
}


Measured memory_bytes: 3596
//#include <fstream>
#include <iostream>
#include <vector>
#include <string>
#include <cassert>
#include <algorithm>

using namespace std;

//ifstream cin("x.in"); ofstream cout("x.out");

const int lim = 1e6;
const int nmax = 8;
const int mod = 1e9 + 7;

long long ans;
int s;
int cate_au[nmax + 1];

void precalc () {
    cate_au[ 1 ] = 9;
    for (int i = 2; i <= 8; ++ i)
        cate_au[ i ] = cate_au[i - 1] * 10;
}

int cate_cif (int aux) {
    int cif = 0;
    while (aux > 0) {
        aux /= 10;
        ++ cif;
    }
    return cif;
}

void serie_intreaga () {
    int p10 = 10;

    for (int i = 1; i <= lim; ++ i) {
        if (i == p10)
            p10 *= 10;

        int c = cate_cif( i );
        int r = s;

        if (1LL * c * (p10 - i) > s)
            continue;

        r -= c * (p10 - i);

        int lst = c;
        for (int j = c + 1; r >= 1LL * j * cate_au[ j ]; ++ j) {
            r -= j * cate_au[ j ];
            lst = j;
        }

        if (lst > c && r % (lst + 1) == 0) {
            ++ ans;
        }
    }
}

void fa_bine (long long &x) {
    if (x >= mod)
        x -= mod;
    if (x < 0)
        x += mod;
}

void ac_serie () {
    long long cateau = 9;

    for (int nrc = 1; nrc <= s; ++ nrc) {
        if (s % nrc == 0) {
            int catenr = s / nrc;
            if (!(nrc <= 8 && catenr > cateau)) {
                ans += (cateau - catenr + 1);
                fa_bine( ans );
            }
        }

        cateau = cateau * 10 % mod;
    }
}

int solve (int x, int a) {
    int r = s % a;

    if (x % a >= r) {
        return x / a + 1;
    } else {
        return x / a;
    }
}

void jumatati () {
    for (int a = 1; a <= s; ++ a) {
        /// a(x + y) + y = s; x, y > 0

        int ymax = (s - a) / (a + 1);
        int ymin = 1;

        if (a + 1 <= 8) {
            ymax = min(ymax, cate_au[a + 1] - 1);
        }

        if (a <= 8 && 1LL * a * cate_au[ a ] <= s) {
            int rst = (s - a * cate_au[ a ]);

            if (rst % (a + 1) == 0)
                ymin = max(ymin, rst / (a + 1));
            else
                ymin = max(ymin, rst / (a + 1) + 1);

            assert(a * (ymin + cate_au[ a ]) + ymin >= s);
        }


        /// cate y in [ymin, ymax] exista a.i. y ~ s (a)
        if (ymin <= ymax) {
            int sol = 0;

            sol += solve(ymax, a) - solve(ymin - 1, a);
            ans += sol;

            //cout << a << "->  " << ymin << " " << ymax << " " << sol << "\n";
            fa_bine( ans );
        }
    }
}

int main() {
    precalc ();

    cin >> s;

    serie_intreaga ();
    ac_serie ();
    jumatati ();

    cout << ans << "\n";

    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
 
int main(void){
 
 
  int i,sum = 0,total,kakaku;
 
   
    
     
    while(1){ 
      sum = 0;
      scanf("%d",&total);   
       
      if(total == 0)break;
      
       
       
      for(i = 0;i < 9;i++){
       
    scanf("%d",&kakaku);
    sum+=kakaku;
     
      }
       
       
      printf("%d\n",(total - sum));
    }
     
    
return 0;
 
}

Measured memory_bytes: 1028
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define fr front()
#define tp top()
typedef long long int ll;
typedef long double ld;
typedef pair <int, int> pii;
typedef pair <pii, int> ppi;
typedef pair <int, pii> pip;
#define iofast ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define iofile freopen("input.txt","r",stdin),freopen("output.txt","w",stdout)
const ll LLINF = 1e18;
const int INF = 1e9;
const int MOD = 1e9 + 7;
const double EPS = 1e-10;
const double PI = acos(-1);
const int SIZE = 100005;

int main (){
	
	int n;
	int l, r;
	int ans=0;
	
	scanf("%d", &n);
	for(int i=0;i<n;i++){
		scanf("%d %d", &l, &r);
		ans+=(r-l+1);
	}
	printf("%d\n", ans);
	
	return 0;
}

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

string f(ll n){
    if (n == 0) return "";
    n--;
    return f(n/26) + string(1, 'a' + n%26);
}

int main(){
    ll n;
    cin >> n;
    cout << f(n) << endl;
    return 0;
}

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

const int mod = 100'0000'007;
int main(void)
{
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i, n) cin >> a[i];
  int x = 0;
  int ans = 0;
  rep(i, n)
  {
    ans = (ans + (ll)a[i] * x) % mod;
    x = (a[i] + x) % mod;
  }

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


Measured memory_bytes: 3984
//#include <bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
using namespace std;
typedef long long ll;//int64
typedef unsigned long long ull;
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
//----------program from here----------



int main(){
  int a,b,x,sum;
  cin>>a>>b>>x;
  sum=a+b;
  if(sum>=x&&a<=x){
    cout << "YES";
  }else{
    cout << "NO";
  }
  return 0;
}

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

#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <cstring>

#include <algorithm>
#include <numeric>
#include <functional>
#include <string>
#include <vector>
#include <deque>
#include <stack>
#include <queue>
#include <list>
#include <map>
// #include <unordered_map>
#include <set>
#include <utility>
#include <bitset>
#include <limits>
#include <climits>
using namespace std;

#ifdef DEBUG
#define NDEBUG
#include "cout11.h"
#endif
#undef NDEBUG
#include <cassert>

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> ii;
typedef pair<ll,ll> llll;
typedef pair<double,double> dd;

typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<ii> vii;
typedef vector<vector<ii>> vvii;
typedef vector<ll> vll;

#define sz(a)  int((a).size())
#define pb  push_back
#define rep(var,n)  for(int var=0;var<(n);++var)
#define rep1(var,n)  for(int var=1;var<=(n);++var)
#define repC2(vari,varj,n)  for(int vari=0;vari<(n)-1;++vari)for(int varj=vari+1;varj<(n);++varj)
#define ALL(c)  (c).begin(),(c).end()
#define RALL(c)  (c).rbegin(),(c).rend()
#define tr(i,c)  for(auto i=(c).begin(); i!=(c).end(); ++i)
#define found(s,e)  ((s).find(e)!=(s).end())


const ll INF = 1000000000000000000LL;// 1e18


template <typename T>
void dij1(int nV, vector<vector<pair<int,T>>>& adjacent, vector<T>& d, int start) {
	// nV: |V|
	d.assign(nV, INF);
	d[start] = 0;
	vector<int> prev(nV, -1);

	priority_queue<pair<T, int>> Q;
	Q.push(make_pair(0, start));

	vector<bool> visited(nV, false);

	while (!Q.empty()) {
		T du = -Q.top().first;
        int u = Q.top().second; Q.pop();
		if (visited[u]) continue;
		visited[u] = true;

		int c = adjacent[u].size();
		for (int i=0; i<c; ++i) {
			int v = adjacent[u][i].first;
			T distance = adjacent[u][i].second;
			T alt = du + distance;
			if (d[v] > alt) {
				d[v] = alt;
				prev[v] = u;
				Q.push(make_pair(-alt, v));
			}
		}
	}
}

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

    vector<vector<pair<int,ll>>> adj(N);
    rep(i, N-1) {
        int ai,bi; ll ci; cin >> ai >> bi >> ci;
        --ai; --bi;
        adj[ai].pb(make_pair(bi, ci));
        adj[bi].pb(make_pair(ai, ci));
    }
    int Q, K; cin >> Q >> K;
    --K;

    vector<ll> d(N, INF);
    dij1(N, adj, d, K);
    // cout << d << endl;

    rep(j, Q) {
        int xi,yi; cin >> xi >> yi;
        --xi; --yi;
        ll ans = d[xi] + d[yi];
        cout << ans << endl;
    }
    return 0;
}


Measured memory_bytes: 14112
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

S = [int(x) for x in input().rstrip().split("/")]

if S[0] == 2019 and S[1] > 4:
    print("TBD")
elif S[0] > 2019:
    print("TBD")
else:
    print("Heisei")


Measured memory_bytes: 2940
import sys
INF = 1 << 60
MOD = 10**9 + 7 # 998244353
sys.setrecursionlimit(2147483647)
input = lambda:sys.stdin.readline().rstrip()

class RangeSpannedGraph(object):
    def __init__(self, n, weighted = False):
        self.n = n
        self.N = N = 1 << (n - 1).bit_length()
        self._weighted = weighted
        N2, N3 = N * 2, N * 3
        ref, _add_edge = self._reflect, self._add_edge
        self.E = [[] for _ in range(N3)]
        for i in range(N - 1, 0, -1):
            cl, cr = i << 1, i << 1 | 1
            _add_edge(i, cl)
            _add_edge(i, cr)
            _add_edge(ref(cl + N2), i + N2)
            _add_edge(ref(cr + N2), i + N2)

    def _reflect(self, v):
        return v if v < 3 * self.N else v - 2 * self.N

    def add_edge(self, u, v, w = 0):
        self._add_edge(self.to_index(u), self.to_index(v), w)

    def _add_edge(self, u, v, w = 0):
        self.E[u].append((v, w)) if self._weighted else v

    def add_range_edge(self, l0, r0, l1, r1, w):
        N, E = self.N, self.E
        E.append([])
        v = len(E) - 1
        self._add_range_edge(l0 + N, r0 + N, v, w, to = True)
        self._add_range_edge(l1 + N, r1 + N, v, 0, to = False)

    def _add_range_edge(self, l, r, v, w, to):
        N2, E = self.N * 2, self.E
        ref, _add_edge = self._reflect, self._add_edge
        while l < r:
            if l & 1:
                _add_edge(ref(l + N2), v, w) if to else _add_edge(v, l, w)
                l += 1
            if r & 1:
                r -= 1
                _add_edge(ref(r + N2), v, w) if to else _add_edge(v, r, w)
            l >>= 1
            r >>= 1

    def to_index(self, v):
        return v + self.N

from heapq import heappop, heappush
def resolve():
    n, m = map(int, input().split())
    rsg = RangeSpannedGraph(n, weighted = True)
    for _ in range(m):
        l, r, w = map(int, input().split())
        l -= 1
        rsg.add_range_edge(l, r, l, r, w)

    E = rsg.E
    dist = [INF] * len(E)
    dist[rsg.to_index(0)] = 0
    heap = [(0, rsg.to_index(0))]
    while heap:
        d, v = heappop(heap)
        if dist[v] != d:
            continue
        for nv, w in E[v]:
            if dist[nv] > d + w:
                dist[nv] = d + w
                heappush(heap, (d + w, nv))

    ans = dist[rsg.to_index(n - 1)]
    if ans == INF:
        ans = -1
    print(ans)
resolve()

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

int main(){
  vector<int> L(3);
  for (int i = 0; i < 3; i++) {
    cin >> L.at(i);
  }
  sort(L.begin(),L.end());

  cout << L.at(0)*L.at(1)/2 << endl;
}

Measured memory_bytes: 256