akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int n;
int a[200003],b[200003];
queue<int>q;
void check(int i){
	if(i==0) i+=n;
	if(i==n+1) i-=n;
	if(a[i]!=b[i] && b[i]>b[i-1] && b[i]>b[i+1]) q.push(i);
}
int main(){
	ios::sync_with_stdio(false);
	cin >> n;
	for(int i=1; i<=n ;i++) cin >> a[i];
	for(int i=1; i<=n ;i++){
		cin >> b[i];
		if(a[i]>b[i]) return cout << "-1\n",0;
	}
	b[n+1]=b[1];b[0]=b[n];
	for(int i=1; i<=n ;i++){
		check(i);
	}
	ll ans=0;
	while(!q.empty()){
		int i=q.front();q.pop();
		if(b[i]%(b[i-1]+b[i+1])==a[i]%(b[i-1]+b[i+1])){
			ans+=(b[i]-a[i])/(b[i-1]+b[i+1]);
			b[i]=a[i];
		}
		else if(b[i]%(b[i-1]+b[i+1])<a[i]){
			return cout << "-1\n",0;
		}
		else{
			ans+=b[i]/(b[i-1]+b[i+1]);
			b[i]%=(b[i-1]+b[i+1]);
		}
		if(i==n) b[0]=b[n];
		if(i==1) b[n+1]=b[1];
		check(i-1);check(i+1);
	}
	for(int i=1; i<=n ;i++){
		if(a[i]!=b[i]) return cout << "-1\n",0;
	}
	cout << ans << endl;
}

Measured memory_bytes: 2304
#include<iostream>
#include<algorithm>
using namespace std;
int main(int argc, char const *argv[])
{
   int a, b;
   cin >> a >> b;
   int plus = a + b;
   int diff = a - b;
   int pro = a * b;
   int ans = max(plus, max(diff, pro));
   cout << ans << endl;
   return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) throws IOException {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;

		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskX solver = new TaskX();
		solver.solve(1, in, out);
		out.close();
	}

	static int INF = 1 << 30;
	static int modP = 1000000007;

	static class TaskX {
		public void solve(int testNumber, InputReader in, PrintWriter out) {

			char[] moji = in.nextString().toCharArray();
			int len = moji.length;
			int[] s = new int[len];
			for (int i = 0; i < len; i++) {
				s[i] = (int)(moji[i]-'a');
			}
			long k = in.nextLong();
			for (int i = 0; i < len; i++) {
				if (k >= 26-s[i] && s[i]!=0) {
					k -= (26-s[i]);
					s[i] = 0;
				}
			}

			k %= 26;
			while (k > 0) {
				s[len-1]++;
				s[len-1] %= 26;
				k--;
			}

			StringBuffer sb = new StringBuffer();
			for (int i = 0; i < len; i++) {
				sb.append((char)(s[i]+'a'));
			}
			out.println(sb.toString());

		}
	}

	static class InputReader {
		BufferedReader in;
		StringTokenizer tok;

		public String nextString() {
			while (!tok.hasMoreTokens()) {
				try {
					tok = new StringTokenizer(in.readLine(), " ");
				} catch (IOException e) {
					throw new InputMismatchException();
				}
			}
			return tok.nextToken();
		}

		public int nextInt() {
			return Integer.parseInt(nextString());
		}

		public long nextLong() {
			return Long.parseLong(nextString());
		}

		public double nextDouble() {
			return Double.parseDouble(nextString());
		}

		public int[] nextIntArray(int n) {
			int[] res = new int[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextInt();
			}
			return res;
		}

		public long[] nextLongArray(int n) {
			long[] res = new long[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextLong();
			}
			return res;
		}

		public InputReader(InputStream inputStream) {
			in = new BufferedReader(new InputStreamReader(inputStream));
			tok = new StringTokenizer("");
		}

	}

}


Measured memory_bytes: 25300
#include<iostream>
#include<cmath>
#include<vector>
#include<algorithm>
#include <string.h>
#include <iomanip>
using namespace std;

#define PI 3.14159265358979323846264338327950L

int main() {
	int a, b, h, m;
	cin >> a >> b >> h >> m;

	long double rad = PI * 2 *
		((long double)h / 12.0 + ((long double)m / 60.0) / 12.0 - (long double)m / 60.0);

	long double rsq = (long double)(a * a + b * b) -
		(long double)(2 * a * b) * cosl(rad);

	cout << setprecision(20) << (sqrtl(rsq)) << endl;

	return 0;
}

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

public class Main{
    public static void main(String[] args)throws Exception{
        Scanner sc=new Scanner(System.in);
        long n=sc.nextLong();
        long k=sc.nextLong();
        n=n%k;
        long m=n-k;
        if(m<0)m=-m;
        n=(n>=m?m:n);
        System.out.println(n);
    }
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
template<typename key>
using ordered_set = tree<key, null_type, less<key>, rb_tree_tag, tree_order_statistics_node_update>;
#define F first
#define S second
#define T second.first
#define D second.second
#define FIO ios_base::sync_with_stdio(0);cin.tie(0);
#define all(v) v.begin(),v.end()
#define OO 0x3f3f3f3fLL
#define INF 0x3f3f3f3f3f3f3f3fLL
#define sz(s) (int)(s.size())
#define RT(s) return cout<<s,0
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pii;
typedef pair<ll,pair<ll,ll>> piii;
const int N = 2e5+5, M= 20, mod = 1000000000;
const double EPS = 1e-10;


int main(){
    FIO
//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);
    string s;
    cin>>s;
    int cnt = 0;
    int ans = 0;
    for(int i=0; i<sz(s); i++){
        if(s[i] == 'S'){
            ans = max(cnt, ans);
            cnt = 0;
        }
        else{
            cnt++;
            ans = max(cnt, ans);
        }
    }
    cout<<ans;
}


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

int main() {
    string s;
    cin >> s;

    vector<bool> b(26, false);
    for (char c : s)
        b.at(c - 'a') = true;

    bool o = false;
    for (int i = 0; i < 26; i++)
        if (!b.at(i)) {
            cout << (char) ('a' + i) << endl;
            o = true;
            break;
        }

    if (!o)
        cout << "None" << endl;
}

Measured memory_bytes: 3724
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#include <limits.h>
#include <math.h>
#include <time.h>
#include <queue>
#include <stdarg.h>
#include <map>
#include <vector>
#include <algorithm>
#include <stack>
#include <iostream>
#include <numeric>
#include <set>

#define ll long long

using namespace std;

void
solve() {
  ll k, x;
  cin>>k>>x;

  if (k * 500 >= x) 
    cout<<"Yes"<<endl;
  else
    cout<<"No"<<endl;
}

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

  int t = 1;
  //cin>>t;

  while (t > 0) {
    t--;
    solve();
  }

  return 0;
}



Measured memory_bytes: 256
dp = 20.times.map{ 10.times.map{ [0] * 156 } }


(1..20).each do |i|
  cnt = 0
  (1..i).each do |n|
    cnt.downto(1).each do |j|
      (1..155-n).each do |k|
        dp[i - 1][j][n + k] += dp[i - 1][j - 1][k]
      end
    end
    dp[i - 1][0][n] = 1
    cnt += 1 if cnt < 9
  end
end

loop do
  n, k, s = gets.split.map(&:to_i)
  break if n == 0
  p dp[n - 1][k - 1][s]
end

Measured memory_bytes: 9060
//include
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath> 
#include <iomanip>
#include <math.h>
#include <utility>
#include <functional>
#include <cstdlib>
//using
using namespace std;
using vl = vector <long long>;
using vs = vector <string>;
using vc = vector <char>;
using ll= long long;
using vvl = vector<vector<ll> >;
using vvc = vector<vector<char> >;
//vector<vector<char> > hyou(N, vector<char>(N));
using vd = vector <double>;
//define
//#define int long long
#define rep(i,n) for(int i=0; i<n; i++)
#define print(n) cout<<n<<endl;
#define sortp(d) sort(d.begin(),d.end()) //1234
#define sortm(d) sort(d.rbegin(),d.rend()) //4321
//素数判定　O(√A) 
bool is_prime(int x){
 if(x<=1) return false;
 for(int i=2;i*i<=x;i++)
 if(x%i==0) return false;
 return true;
 }
 //各位の和　
int wa(ll x)
{
ll sum = 0;
while(x!=0){
  sum += x% 10;
  x /= 10;
}
return sum;
}
/*順列生成
do {
  // 順列に対する処理
} while (next_permutation(配列変数.begin(), 配列変数.end()));*/

//絶対値　abs()
//文字→数字　'0' アルファベット→数字　'a'　'A'が65番,'a'が97番だわ
//型キャスト　char('a'+1)
//reverse 回文
//if(isupper('A'))->大なら真


//グローバル変数宣言
ll p=0,q=0,r=0,s,t,u;

int main()
{
  string s;
  cin>>s;
  p=s.size();
  rep(i,p)
  {
    if (s[i]=='N')
    {
      q++;
    }
    if (s[i]=='W')
    {
      r++;
    }
    if (s[i]=='S')
    {
      u++;
    }
    if (s[i]=='E')
    {
      t++;
    }
  }
  if (((q>0&&u>0)||(q==0&&u==0))&&((r>0&&t>0)||(r==0&&t==0)))
  {
    print("Yes")
  }else
  {
    print("No")
  }
  
  
}

Measured memory_bytes: 3612
N, K = map(int, input().split())
p = list(map(int,input().split()))
E = []
for i in range(N):
    E.append((p[i]+1)/2)
S = [0]
num = 0
for i in range(N):
    num += E[i]
    S.append(num)
Max = 0
for i in range(N-K+1):
    Max = max(Max, S[K+i]-S[i])
print(Max)

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

typedef long long int ll;
ll MOD = 1000000007;
ll INFL = 1ll << 60;
ll INF = 1 << 28;

// ====================================================================

int main() {
  int n;
  cin >> n;
  cout << (n+1)/2 << endl;
}


Measured memory_bytes: 256
using System;

namespace _0004 {

	public static class Program {

		public static void Main() {
			string input;
			while (!string.IsNullOrEmpty(input = Console.ReadLine())) {
				var splitStr = input.Split(' ');
				var a = int.Parse(splitStr[0]);
				var b = int.Parse(splitStr[1]);
				var c = int.Parse(splitStr[2]);
				var d = int.Parse(splitStr[3]);
				var e = int.Parse(splitStr[4]);
				var f = int.Parse(splitStr[5]);

				if (a != 0 && d != 0) {
					var adLcm = LCM(a, d);
					var beDiff = b * (adLcm / a) - e * (adLcm / d);
					var cfDiff = c * (adLcm / a) - f * (adLcm / d);

					var y = ((double) cfDiff) / beDiff;
					var x = (c - (b * y)) / a;
					Console.WriteLine("{0:f3} {1:f3}", x, y);
				} else if (a == 0) {
					var y = ((double) c) / b;
					var x = (f - (e * y)) / d;
					Console.WriteLine("{0:f3} {1:f3}", x, y);
				} else {
					var y = ((double) f) / e;
					var x = (c - (b * y)) / a;
					Console.WriteLine("{0:f3} {1:f3}", x, y);
				}
			}
		}

		private static int LCM(int m, int n) {
			return m * n / GCD(m, n);
		}

		private static int GCD(int m, int n) {
			m = Math.Abs(m);
			n = Math.Abs(n);

			if (m < n) {
				return GCD(n, m);
			}
			return n == 0 ? m : GCD(n, m % n);
		}

	}

}

Measured memory_bytes: 9188
#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <cstring>
#include <numeric>
#include <algorithm>
#include <functional>
#include <array>
#include <map>
#include <queue>
#include <time.h>
#include <limits.h>
#include <set>
#include <stack>
#include <random>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#define rep(i,s,n) for(int i = (s); (n) > i; i++)
#define REP(i,n) rep(i,0,n)
#define RANGE(x,a,b) (min(a,b) <= (x) && (x) <= max(a,b)) //hei
#define DUPLE(a,b,c,d) (RANGE(a,c,d) || RANGE(b,c,d) || RANGE(c,a,b) || RANGE(d,a,b))
#define INCLU(a,b,c,d) (RANGE(a,c,d) && (b,c,d))
#define PW(x) ((x)*(x))
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define MODU 1000000007LL
#define bitcheck(a,b)   ((a >> b) & 1)
#define bitset(a,b)      ( a |= (1 << b))
#define bitunset(a,b)    (a &= ~(1 << b))
#define MP(a,b) make_pair((a),(b))
#define Manh(a,b) (abs((a).first-(b).first) + abs((a).second - ((b).second))
#define pritnf printf
#define scnaf scanf
#define itn int
#define PI 3.141592653589


#define izryt bool
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T &val) {
	std::fill((T*)array, (T*)(array + N), val);
}
pll Dir[4] = {
	{ -1 ,0 },{ 0 , 1 },{ 1 ,0 },{ 0 ,-1 }
};

//[a, b)
#define Getsum(ar, a,b) (ar[b] - ar[a])
#define INF 10000000000000000LL
#define chmax(a,b) a = max(a,b)
#define chmin(a,b) a = min(a,b)

struct Edge {
	int from, to;
	ll w;
	bool operator<(const Edge& rhs) const {
		return MP(w, MP(from, to)) < MP(rhs.w, MP(rhs.from, rhs.to));
	}
};

typedef vector<set<Edge>> Graph;


signed main(void) {

	int a, b, c;
	cin >> a >> b >> c;
	if (a == b && b == c) {
		cout << "Yes" << endl;
	}
	else
	{
		cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
using System;
using System.IO;
using System.Net;
using System.Net.Sockets;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using System.Text.RegularExpressions;
using static System.Math;
using MethodImplOptions = System.Runtime.CompilerServices.MethodImplOptions;
using MethodImplAttribute = System.Runtime.CompilerServices.MethodImplAttribute;

public static class P
{
    public static void Main()
    {
        int n = int.Parse(Console.ReadLine());
        var s = Console.ReadLine();
        int curMaxLength = 0;
        var hash = new RollingHash(s);
        for (int i = 0; i < s.Length; i++)
            for (int j = i; j < s.Length; j++)
                while (curMaxLength < j - i && j + curMaxLength < n && hash.Slice(i, curMaxLength + 1) == hash.Slice(j, curMaxLength + 1)) curMaxLength++;
        Console.WriteLine(curMaxLength);
    }
}

class RollingHash
{
    const ulong MASK30 = (1UL << 30) - 1;
    const ulong MASK31 = (1UL << 31) - 1;
    const ulong MOD = (1UL << 61) - 1;
    const ulong POSITIVIZER = MOD * ((1UL << 3) - 1);
    static uint Base;
    static ulong[] powMemo = new ulong[5000 + 1];
    static RollingHash()
    {
        Base = (uint)new Random().Next(129, int.MaxValue);
        powMemo[0] = 1;
        for (int i = 1; i < powMemo.Length; i++)
            powMemo[i] = CalcMod(Mul(powMemo[i - 1], Base));
    }

    ulong[] hash;

    public RollingHash(string s)
    {
        hash = new ulong[s.Length + 1];
        for (int i = 0; i < s.Length; i++)
            hash[i + 1] = CalcMod(Mul(hash[i], Base) + s[i]);
    }

    public ulong Slice(int begin, int length)
    {
        return CalcMod(hash[begin + length] + POSITIVIZER - Mul(hash[begin], powMemo[length]));
    }

    private static ulong Mul(ulong l, ulong r)
    {
        var lu = l >> 31;
        var ld = l & MASK31;
        var ru = r >> 31;
        var rd = r & MASK31;
        var middleBit = ld * ru + lu * rd;
        return ((lu * ru) << 1) +
            ld * rd +
            ((middleBit & MASK30) << 31) +
            (middleBit >> 30);
    }

    private static ulong CalcMod(ulong val)
    {
        val = (val & MOD) + (val >> 61);
        if (val > MOD) val -= MOD;
        return val;
    }
}

Measured memory_bytes: 11216
#include<iostream>
#include<math.h>
#include<vector>
#include <algorithm>


using namespace std;

int main(){
  int a,b,result;
  cin >>a>>b;
  result = b;
  if(a<6){
    result = 0;
  }else if(a<=12){
    result /= 2;
  }
  cout << result;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define gc getchar_unlocked
#define fo(i,n) for(i=0;i<n;i++)
#define Fo(i,k,n) for(i=k;k<n?i<n:i>n;k<n?i+=1:i-=1)
#define ll long long
#define si(x)	scanf("%d",&x)
#define sl(x)	scanf("%lld",&x)
#define ss(s)	scanf("%s",s)
#define pi(x)	printf("%d\n",x)
#define pl(x)	printf("%lld\n",x)
#define ps(s)	printf("%s\n",s)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define PI 3.1415926535897932384626
typedef pair<int, int>	pii;
typedef pair<ll, ll>	pl;
typedef vector<int>		vi;
typedef vector<ll>		vl;
typedef vector<pii>		vpii;
typedef vector<pl>		vpl;
typedef vector<vi>		vvi;
typedef vector<vl>		vvl;
int mpow(int base, int exp); 
void ipgraph(int m);
void dfs(int u, int par);
const int mod = 1000000007;
const int N = 3004, M = N;
//=======================

vi g[N];
int a[N];
ll dp[N][N][2];
int n;
ll go(int r, int m, int k){
	int b = n-r;
	if(b<0 or r<0) return 0;
	if(m == 0) return k;
	ll &ans = dp[r][m][k];
	if(ans >= 0) return ans;
	ans = 0;
	//-r +r,+b -r
	if(r)
	ans += go(r-1, m-1, k || (r == 1));
	//-r +r,+b -b
	if(r)
	ans += go(r, m-1, k || (r == 1));
	//-b +r,+b -r
	if(b)
	ans += go(r, m-1, k || (r == 0));
	//-b +r,+b -b
	if(b)
	ans += go(r+1, m-1, k || (r == 0));
	return ans = ans%mod;
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int i,k,j,m;
	cin >> n >> m;
	ll ans = 0;
	fo(i, n+1) fo(j, m+1)fo(k,2) dp[i][j][k] = -1;
	fo(i, n+1){
		ans += go(i, m, 0);
		if(ans>=mod)
			ans-=mod;
	}
	cout << ans << endl;
	

	return 0;
} 

int mpow(int base, int exp) {
	base %= mod;
	int result = 1;
	while (exp > 0) {
	if (exp & 1) result = ((ll)result * base) % mod;
	base = ((ll)base * base) % mod;
	exp >>= 1;
	}
	return result;
}

void ipgraph(int m){
	int i, u, v;
	fo(i, m){
		cin>>u>>v; 
		u++, v++;
		g[u-1].pb(v-1);
		g[v-1].pb(u-1);
	}
}

void dfs(int u, int par){
	for(int v:g[u]){
		if (v == par) continue;
		dfs(v, u);
	}
}

Measured memory_bytes: 141440
a=int(input())
b=int(input())
c=int(input())
sum_=int(input())
count=0

for i in range(0,a+1):
    for j in range(0,b+1):        
        for k in range(0,c+1):
            check=500*i+100*j+50*k
            if(check==sum_):
                count+=1
print(count)                


Measured memory_bytes: 9136
#include <vector>
#include <iostream>
#include <set>
#include <algorithm>
#include <map>
#include <string>
#include <cmath>
#include <tuple>
#include <queue>

using namespace std;
typedef long long ll;
typedef pair<ll,ll> P; 
typedef tuple<ll,ll,ll> T;
const ll INF = 1e8;

int main(){
	ll A,B;
	cin >> A >> B;
	if(A+B>=10)
		cout << "error" << endl;
	else
		cout << A+B << endl;

	return 0;
}


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

int main(){
    char a;
    int b[26]={};
    while(cin>>a){
        a=tolower(a);
        if(isalpha(a))b[a-'a']+=1;
    }
    for(int i=0;i<26;i++){
        cout<<(char)('a'+i)<<" : "<<b[i]<<endl;
    }
    return 0;
}


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

using namespace std;

int main()
{
  int n, q, b, e, t;
  cin >> n;

  std::vector<int> A;
  int a[n];
  for(int i=0; i<n; i++){
    cin >> a[i];
    A.push_back(a[i]);
  }

  cin >> q;
  for(int j=0; j<q; j++){
    cin >> b >> e >> t;
    std::swap_ranges(A.begin()+b, A.begin()+e, A.begin()+t);
  }

  for(int k=0; k<n; k++){
    cout << A[k];
    if(k!=n-1) cout << " ";
  }
  cout << endl;
  return 0;
}



Measured memory_bytes: 3160
import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int a = sc.nextInt();
		int b = sc.nextInt();
		
		
		System.out.println(a-2*b<0 ? 0 : a-2*b);
	}

}


Measured memory_bytes: 21968
#include <iostream>
#include <vector>
#include <cassert>
#include <algorithm>
#include <functional>
#include <string>

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

int main() {
	string n;
	cin >> n;
	int aPos = n.find_first_of('7');

	if (aPos == std::string::npos) {
		cout << "No" << endl;
	}
	else {
		cout << "Yes" << endl;
	}
	
	return 0;
}

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

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

	int n, k;
	vector<int> a(100005), dp(100005, 1e9);
	cin >> n >> k;
	for (int i = 1; i <= n; i++) {
		cin >> a[i];
	}
	dp[1] = 0;
	for (int i = 2; i <= n; i++) {
		for (int j = 1; j <= k; j++) {
			if (j <= i)
				dp[i] = min(dp[i], dp[i-j] + abs(a[i] - a[i-j]));
		}
	}
	cout << dp[n];
}

Measured memory_bytes: 1024
import heapq  # heapqライブラリのimoprt
N = int(input())
A = []

for i in range(N):
 a = int(input())
 if(i == 0):
    A_max,A_max_index = a,i
 else: 
    if(A_max <= a):
      A_max,A_max_index = a,i
 A.append(a)

for i in range(N):
  if(i != A_max_index): 
    print(A_max)
  else:
    A[i] = 0
    A =  list(map(lambda x: x*(-1), A))
    heapq.heapify(A)
    ans = -heapq.heappop(A)
    print(ans)


Measured memory_bytes: 20616
# -*- coding: utf-8 -*-
"""
Created on Fri Sep 18 10:13:51 2020

@author: liang
"""
H, W = map(int, input().split())
flag = True
field = [input() for i in range(H)]

for i in range(H):
    for j in range(W):
        if field[i][j] == "#":
            tmp = False
            if i-1>= 0 and field[i-1][j] == "#":
                tmp = True
            if i+1 < H and field[i+1][j] == "#":
                tmp = True
            if j-1>= 0 and field[i][j-1] == "#":
                tmp = True
            if j+1 < W and field[i][j+1] == "#":
                tmp = True
            if tmp == False:
                flag = False

if flag :
    print("Yes")
else:
    print("No")

Measured memory_bytes: 9000
// Ref : https://book.mynavi.jp/ec/products/detail/id=35408
// Ref : http://judge.u-aizu.ac.jp/onlinejudge/review.jsp?rid=2679699#1

#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
using namespace std;

int NV, NE;

struct artPoint {
	int cnt, N;
	vector<vector<int> > G;
	set<int> AP;
	vector<bool> visited;
	// DFS木の各頂点について, prenum: DFS木の訪問順番,
	// parent: 親の頂点番号, lowest: 親への辺以外から辿れる上位のprenum
	vector<int> prenum, parent, lowest;

	artPoint(int n):N(n),G(n),visited(n, false),prenum(n),parent(n),lowest(n){}
	
	void addVertex(int a, int b) {
		G[a].push_back(b);
		G[b].push_back(a);
	}

	void dfs(int cur, int prev) {
		prenum[cur] = lowest[cur] = cnt++;
		visited[cur] = true;
		int next;
		for (unsigned int i = 0; i < G[cur].size(); i++) {
			next = G[cur][i];
			if (!visited[next]) {
				parent[next] = cur;
				dfs(next, cur);
				// 深さ優先で探索するので、親は子がより上位に辿れれば更新
				lowest[cur] = min(lowest[cur], lowest[next]);
			}
			else if (next != prev) {
				// DFS木の訪問順番の上位が辿れれば更新
				lowest[cur] = min(lowest[cur], prenum[next]);
			}
		}
	}

	// ある点からの1回のDFSで、関節点を求める
	void build() {
		cnt = 1;
		dfs(0, -1); // 頂点番号0をルートとする深さ優先探索
		int np = 0;
		for (int i = 1; i < N; i++) { // ルート以外を処理する
			int p = parent[i];
			if (p == 0) np++;
			else if (prenum[p] <= lowest[i]) AP.insert(p);
		}
		if (np > 1) AP.insert(0); // ルートを処理する
	}

	void print() {
		for (set<int>::iterator it = AP.begin(); it != AP.end(); it++) {
			cout << *it << endl;
		}
	}
};

int main() {
	cin >> NV >> NE;
	artPoint A(NV);
	for (int i = 0; i < NE; i++) {
		int s, t;
		cin >> s >> t;
		A.addVertex(s, t);
	}

	A.build();
	A.print();

	return 0;
}


Measured memory_bytes: 4420
def abc167_e():
    N, M, K = map(int, input().split())
    Mod = 998244353

    class CombiMod:
        ''' combination mod prime '''

        def __init__(self, N, Mod):
            ''' 前計算 '''
            self.mod = Mod
            self.fac = [1] * (N+1)  # fac[0] = fac[1] = 1
            for i in range(1, N+1):
                self.fac[i] = (self.fac[i-1] * i) % self.mod
            self.finv = [1] * (N+1)  # finv[0] = finv[1] = 1
            self.finv[N] = pow(self.fac[N], self.mod-2, self.mod)
            for i in range(N, 0, -1):
                self.finv[i-1] = (self.finv[i] * i) % self.mod

        def __call__(self, n: int, k: int):
            ''' nCkを実際に計算する '''
            if k < 0 or n < k: return 0
            ret = self.fac[n] * self.finv[k] % self.mod
            ret = ret * self.finv[n-k] % self.mod
            return ret

    cmb = CombiMod(N, Mod)
    ans = 0

    for x in range(K+1):
        p = cmb(N-1, x) * M * pow(M-1, N-x-1, Mod) % Mod
        ans = (ans + p) % Mod
    print(ans)

abc167_e()

Measured memory_bytes: 24640
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <queue>
#include <array>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <cassert>
#include <utility>
#include <functional>

using namespace std;
using lli = long long int;
template<class T, class U> void init_n(vector<T>& v, size_t n, U x) 
{ v = vector<T>(n, x); }
template<class T> void init_n(vector<T>& v, size_t n) { init_n(v, n, T()); }
template<class T> void read_n(vector<T>& v, size_t n, size_t o = 0) 
{ v = vector<T>(n+o); for (lli i=o; i<n+o; ++i) cin >> v[i]; }
template<class T> void read_n(T a[], size_t n, size_t o = 0)
{ for (lli i=o; i<n+o; ++i) cin >> a[i]; }
template<class T> T gabs(const T& x) { return max(x, -x); }
#define abs gabs

lli n; vector<lli> a;
int main() {
  cin >> n; read_n(a, n);
  sort(begin(a), end(a));
  lli x[2]; x[0]=x[1]=0;
  for (lli i=0; i<n; ++i) {
    x[i%2] += a.back(); a.pop_back();
  }
  cout << x[0]-x[1] << endl;
  return 0;
}


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


int main(){
	int dp[31]={0};
	dp[0]=dp[1]=1;
	dp[2]=2;
	for(int i=3;i<=30;i++){
		dp[i]=dp[i-1]+dp[i-2]+dp[i-3];
	}
	int n;
	while(cin>>n&&n){
		cout<<(dp[n]+3649)/3650<<endl;
	}
	return 0;
}

Measured memory_bytes: 1160
import java.util.*;
import java.util.stream.*;
import java.util.function.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        double t = sc.nextInt();
        double a = sc.nextInt();
        double[] h = IntStream.range(0, n).mapToDouble(i -> sc.nextInt()).toArray();
        
        int result = 0;
        double min = Double.MAX_VALUE;
        for(int i = 0; i < h.length; i++) {
            double diff = Math.abs(a - (t - (h[i] * 0.006)));
            if(diff < min) {
                min = diff;
                result = i;
            }
        }
        
        System.out.println(result + 1);
    }
}


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

const int INF = 1e8;
int main(){
  cin.tie(0); ios::sync_with_stdio(0);
  int n;
  string x;
  cin >> n >> x;

  set< pair<int,int> > intervals;
  intervals.emplace( make_pair(-INF, -INF+1) );
  for(int i=0;i<n;i++){
    if(x[i]=='1'){
      int s = i;
      while(i<n and x[i]=='1') i++;
      intervals.emplace( make_pair(s,i) );
    }
  }

  int q;
  cin >> q;
  while(q--){
    int l, r, b;
    cin >> l >> r >> b; l--;

    if(b==0){
      vector< pair<int,int> > add_intvs;
      auto sit = intervals.upper_bound( make_pair(l,INF) ); sit--;
      auto tit = sit;
      if(sit->second <= l){
        sit++; tit++;
      }else if(sit->first < l){
        add_intvs.emplace_back( make_pair(sit->first,l) );
      }
      while(tit!=intervals.end() and tit->first < r) tit++; tit--;
      if(r < tit->second){
        add_intvs.emplace_back( make_pair(r,tit->second) );
      }
      tit++;
      intervals.erase(sit, tit);
      for(auto new_intv : add_intvs){
        intervals.emplace(new_intv);
      }
    }else{
      auto sit = intervals.upper_bound( make_pair(l,INF) ); sit--;
      auto tit = sit;
      int s = sit->first;
      if(sit->second < l){
        s = l; sit++; tit++;
      }
      while(tit!=intervals.end() and tit->first <= r) tit++; tit--;
      int t = max(r, tit->second); tit++;
      intervals.erase(sit, tit);
      intervals.emplace( make_pair(s,t) );
    }

    cout << intervals.size()-1 << endl;
  }
}



Measured memory_bytes: 4368
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define E "\n"

using namespace std;
const long long MOD = (long long)1e9 + 7;

long long k;
long long dp[20][10], dat[20];
vector<int> vec;

int main()
{
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin >> k;
	for (int i = 0; i < 10; i++) dp[0][i] = 1;
	for (int i = 1; i < 19; i++) {
		dp[i][0] = dp[i - 1][0] + dp[i - 1][1];
		dat[i] = dat[i - 1];
		for (int j = 1; j < 9; j++) {
			dp[i][j] = dp[i - 1][j - 1] + dp[i - 1][j] + dp[i - 1][j + 1];
			dat[i] += dp[i - 1][j];
		}
		dp[i][9] = dp[i - 1][8] + dp[i - 1][9];
		dat[i] += dp[i - 1][9];
	}
	long long acc = 0;
	int cur = 0;
	while (dat[cur] < k) {
		cur++;
	}
	int pre;
	for (int i = cur - 1; i >= 0; i--) {
		if (i == cur - 1) {
			for (int j = 0; j < 10; j++) {
				long long tmp = dp[i][j];
				if (i == cur - 1 && j == 0) tmp = dat[i];
				if (acc + tmp >= k) {
					vec.pb(j);
					pre = j;
					break;
				}
				acc += tmp;
			}
		}
		else {
			for (int j = max(0, pre - 1); j <= min(9, pre + 1); j++) {
				if (acc + dp[i][j] >= k) {
					vec.pb(j);
					pre = j;
					break;
				}
				acc += dp[i][j];
			}
		}
	}
	int sz = vec.size();
	for (int i = 0; i < sz; i++) {
		cout << vec[i];
	}
	cout << E;
	//system("pause");
	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<vector>
#include<map>
#include<string>
#include<stack>
#include<queue>
bool isexist = true;
const int infty = 100000000;
const int vmax = 100000;
typedef int vname;
struct vertex;
struct edge {
	int weight;
	vertex *to;
	edge(int w, vertex *v) :weight(w), to(v) {};
};
struct vertex {
	std::vector<edge> adj;
	int distance;
	vname name, trace;
	vertex(vname s) :name(s) {}
	bool operator<(const vertex& v)const {
		return distance > v.distance;
	}
};
class graph {
private:
	std::map<vname, vertex*> work;
public:
	int vertexsize, edgesize;
	void addvertex(const vname& name) {
		if (work.count(name) == 0) work[name] = new vertex(name);
	}
	void addedge(vname from, vname to, int cost) {
		if (work.count(from) > 0 && work.count(to) > 0) {
			(work[from]->adj).push_back(edge(cost, work[to]));
		}
	}
	void bfs() {
		std::map<vname, bool> visited;
		for (auto i : work)visited[i.first] = false;
		for (auto i : work) {
			if (!visited[i.first]) {
				visited[i.first] = true;
				work[i.first]->distance = 0;
				std::stack<vertex *> st;
				st.push(work[i.first]);
				while (!st.empty()) {
					vertex *v = st.top();
					st.pop();
					for (auto e : v->adj) {
						if (!visited[e.to->name]) {
							visited[e.to->name] = true;
							e.to->distance = v->distance + e.weight;
							e.to->trace = v->name;
							st.push(e.to);
						}
						else {
							if (e.to->distance != v->distance + e.weight)isexist = false;
						}
					}
				}
			}
		}
	}
};
int main() {
	graph g;
	vname a, b;
	int d;
	scanf("%d%d", &g.vertexsize, &g.edgesize);
	for (int i = 0; i < g.edgesize; i++) {
		std::cin >> a >> b >> d;
		g.addvertex(a);
		g.addvertex(b);
		g.addedge(a, b, d);
		g.addedge(b, a, -d);
	}
	g.bfs();
	if (isexist)printf("Yes");
	else printf("No");
	return 0;
}

Measured memory_bytes: 26112
def I(): return int(input())
def LI(): return list(map(int,input().split()))
def MI(): return map(int,input().split())
def LLI(n): return [list(map(int, input().split())) for _ in range(n)]

#bisect.bisect_left(list,key)はlistのなかでkey未満の数字がいくつあるかを返す
#つまりlist[i] < x となる i の個数
#bisect.bisect_right(list, key)はlistのなかでkey以下の数字がいくつあるかを返す
#つまりlist[i] <= x となる i の個数
#これを応用することで
#len(list) - bisect.bisect_left(list,key)はlistのなかでkey以上の数字がいくつあるかを返す
#len(list) - bisect.bisect_right(list,key)はlistのなかでkeyより大きい数字がいくつあるかを返す
#これらを使うときはあらかじめlistをソートしておくこと！
li = LI()
c = 1
i = 0
while c:
    if li[i] == 0:
        print(i+1)
        c = 0
    i += 1

Measured memory_bytes: 9132
#include<iostream>
using namespace std;
long dp[1111][1111],mod=1e9+7;
main()
{
	int n,k;cin>>n>>k;
	dp[0][0]=1;
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=k;j++)
		{
			dp[i][j]=(dp[i-1][j-1]+dp[i-1][j]*j)%mod;
		}
	}
	long ans=0;
	for(int i=0;i<=k;i++)ans=(ans+dp[n][i])%mod;
	cout<<ans<<endl;
}



Measured memory_bytes: 11776
n = int(input())
S = list(map(int, input().split()))


def partition(A, p, r):
  x = A[r]
  i = p
  for j in range(p, r):
    if A[j] <= x:
      A[i], A[j] = A[j], A[i]
      i += 1
  A[i], A[r] = A[r], A[i]
  return i

r = partition(S, 0, n-1)

ans = [str(x) for x in S]
ans[r] = '[{}]'.format(ans[r])
print(' '.join(ans)) 




Measured memory_bytes: 16588
unittest
{
	assert( [ "3 3", "1 7", "3 2", "1 7" ].parse.expand.solve == 702 );
	assert( [ "3 2", "2 1", "2 3" ].parse.expand.solve == -1 );
	assert( [ "3 1", "1 0" ].parse.expand.solve == -1 );
	
	assert( [ "1 1", "1 0" ].parse.expand.solve == 0 );		// 追加ケース
	assert( [ "2 1", "1 0" ].parse.expand.solve == -1 );		// 追加ケース
	assert( [ "2 1", "2 1" ].parse.expand.solve == 11 );		// 追加ケース
	assert( [ "3 1", "2 3" ].parse.expand.solve == 130 );		// 追加ケース
	assert( [ "2 0" ].parse.expand.solve == 10 );		// 追加ケース
	assert( [ "1 0" ].parse.expand.solve == 0 );		// 追加ケース
}



import std.algorithm;
import std.conv;
import std.range;
import std.stdio;
import std.typecons;

void main()
{
	stdin.byLineCopy.parse.expand.solve.writeln;
}

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto nm = input.front.split.to!( long[] );
	auto scs = new long[ 2 ][ nm[ 1 ] ];
	foreach( ref sc; scs )
	{
		input.popFront;
		sc = input.front.split.to!( long[] );
		sc[ 0 ]--;
	}
	return tuple( nm[ 0 ], scs );
}

auto solve( long n, long[ 2 ][] scs )
{
	auto anss = new long[ n ];
	anss[] = -1;
	foreach( sc; scs.sort().uniq )
	{
		if( anss[ sc[ 0 ] ] != -1 ) return -1;
		anss[ sc[ 0 ] ] = sc[ 1 ];
	}
	if( anss[ 0 ] == 0 )
	{
		if( anss.length == 1 ) return 0;
		else                   return -1;
	}
	if( anss[ 0 ] == -1 )
	{
		if( anss.length == 1 ) anss[ 0 ] = 0;
		else                   anss[ 0 ] = 1;
	}
	foreach( i, ref ans; anss )
	{
		if( ans == -1 ) ans = 0;
	}
	return reduce!( ( a, b ) => a * 10 + b )( 0L, anss );
}


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

int main(){
	int a,b,c;
	cin>>a>>b>>c;
 if(b<=c){
     if(a+b>=c){
	 	cout<<0<<endl;
	 }
	 else{
	 	cout<<c-a-b<<endl;
	 }
	}
 else{
	 if(a+c>=b){
	 	cout<<0<<endl;
	 }
	 else{
	 	cout<<b-a-c<<endl;
	 }
	}
}

Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
using namespace std;
int main(){
  int card[4][13],m,n,numC,i;
  char mark;
 for(i=0; i<4; i++){
    for(m=0; m<13; m++){
      card[i][m]=1;
    }
  }
  
  cin>>numC;


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

    cin>>mark>>n;
    m=n-1;

    switch(mark){
      
    case 'S':
      card[0][m]=0;
      break;
      
    case 'H':
      card[1][m]=0;
      break;
      
    case 'C':
      card[2][m]=0;
      break;
      
    case 'D':
      card[3][m]=0;
      break;
    }
    
  }
  
  
  for(i=0; i<4; i++){
    
    switch(i){

    case 0:
      for(m=0; m<13; m++){

	if(card[i][m]==1){
	  printf("S %d\n",m+1);
	}

      }
      break;

    case 1:
      for(m=0; m<13; m++){

	if(card[i][m]==1){
	  printf("H %d\n",m+1);
	}

      }
      break;

    case 2:
      for(m=0; m<13; m++){

	if(card[i][m]==1){
	  printf("C %d\n",m+1);
	}

      }
      break;

    case 3:
      for(m=0; m<13; m++){

	if(card[i][m]==1){
	  printf("D %d\n",m+1);
	}

      }
      break;

    }

  }

	return 0;
}

Measured memory_bytes: 1144
#include <bits/stdc++.h>
#define fast ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define pb push_back
#define endl '\n'
#define MOD 1000000007
#define MOD2 998244353

using namespace std;
typedef long long int ll;

long double dp[3010][3010];
long double p[3010];

int main(void)
{
	fast;
	#ifndef ONLINE_JUDGE
	// freopen("in", "r", stdin);
	// freopen("out", "w", stdout);
	#endif

	int n; cin >> n;
	for (int i = 0; i < n; ++i)
	{
		cin >> p[i];
	}
	long double ans = 0;
	dp[0][0] = 1-p[0];
	dp[0][1] = p[0];
	for (int pos = 1; pos < n; ++pos)
	{
		for (int ct = 0; ct <= n; ++ct)
		{
			dp[pos][ct] = (1-p[pos])*dp[pos-1][ct];
			if (ct) dp[pos][ct] += p[pos]*dp[pos-1][ct-1];
			if (pos == n-1 and ct > n-ct) ans += dp[pos][ct];
		}
	}
	if (n == 1) ans = dp[0][1];
	cout << fixed << setprecision(15) << ans;
}

Measured memory_bytes: 141696
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <functional>

using namespace std;

#define fst first
#define scd second
#define PB push_back
#define MP make_pair
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define omajinai ios::sync_with_stdio(false);cin.tie(0)
#define rep(i,x) for(int i=0;i<(int)(x);++i)
#define rep1(i,x) for(int i=1;i<=(int)(x);++i)

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef vector<pii> vpii;

template<typename T>T& max(T&a,T&b){if(a>=b)return a;return b;}
template<typename T>T& min(T&a,T&b){if(a<b)return a;return b;}
template<typename T>bool chmax(T&a,T b){if(a<b){a=b;return true;}return false;}
template<typename T>bool chmin(T&a,T b){if(a>b){a=b;return true;}return false;}
template<typename T>T get(){T a;cin>>a;return a;}
template<typename T>T rev(T a){reverse(all(a));return a;}
template<typename T>vector<T>&sort(vector<T>&a){sort(all(a));return a;}

const int inf = INT_MAX;
const ll linf = 3e18;
const double eps = 1e-9;

struct SegTree { // ??????min,max
    int n;
    vector<int> Max;
    vector<int> Min;
    void init(int n_) {
        n = 1;
        while (n < n_) n *= 2;
        Min.resize(2 * n);
        //Max.resize(2 * n);
        for (int i = 0; i < 2 * n - 1; ++i) {
            Min[i] = inf;
            //Max[i] = -inf;
        }
    }
    void update(int idx, int val) {
        idx += n - 1;
        Min[idx] = val;
        //Max[idx] = val;
        while (idx > 0) {
            idx = (idx - 1) / 2;
            Min[idx] = min(Min[idx * 2 + 1], Min[idx * 2 + 2]);
            //Max[idx] = max(Max[idx * 2 + 1], Max[idx * 2 + 2]);
        }
    }
    int get_min(int a, int b, int k = 0, int l = 0, int r = -1) { // [a, b)???min
        if (r == -1) r = n;
        if (r <= a || b <= l) return inf;
        if (a <= l && r <= b) return Min[k];
        int vl = get_min(a, b, k * 2 + 1, l, (l + r) / 2);
        int vr = get_min(a, b, k * 2 + 2, (l + r) / 2, r);
        return min(vl, vr);
    }
    int get_max(int a, int b, int k = 0, int l = 0, int r = -1) { // [a, b)???max
        if (r == -1) r = n;
        if (r <= a || b <= l) return -inf;
        if (a <= l && r <= b) return Max[k];
        int vl = get_max(a, b, k * 2 + 1, l, (l + r) / 2);
        int vr = get_max(a, b, k * 2 + 2, (l + r) / 2, r);
        return max(vl, vr);
    }
};

signed main()
{
    int n, q; scanf("%d%d", &n, &q);

    SegTree seg;

    seg.init(n);

    rep(i, q) {
        int type, x, y;
        scanf("%d%d%d", &type, &x, &y);

        if (type % 2 == 0) {
            seg.update(x, y);
        } else {
            printf("%d\n", seg.get_min(x, y + 1));
        }
    }
}

Measured memory_bytes: 2056
import java.util.*;
class Main
{
    public static void main (String[] args)
    {
        Scanner sc = new Scanner(System.in);
        int[] a = new int[3], b = new int[3];
        int[] cnt = new int[4];
        for(int i = 0; i < 3; i++){
            a[i] = sc.nextInt()-1;
            b[i] = sc.nextInt()-1;
            cnt[a[i]]++;
            cnt[b[i]]++;
        }
        String ans = "NO";
        int x = 0, y = 0;
        for(int i = 0; i < 4; i++){
            if(cnt[i]==2) x++;
            if(cnt[i]==1) y++;
        }
        if(x == 2 && y == 2) ans = "YES";
        System.out.println(ans);
    }
}

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

#define temp(t,h) (t - (h * 0.006)) 

int main(void){

	int n,t,a,i,ansn,ansh,h;
  
  	scanf("%d",&n);
   	scanf("%d %d",&t,&a);
    scanf("%d",&h); 
  	
  	ansn=1;
  	ansh=h;
  
  	for(i=2;i<=n;i++){
      scanf("%d",&h);
      
  	  if(fabs(a - temp(t,h)) < fabs(a - temp(t,ansh))){
      	ansn = i;
        ansh = h;
      }    
    }
  	
	printf("%d\n",ansn);
  
  
    return 0;
}


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

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

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define ALL(c) (c).begin(),(c).end()

//bipartite matching
const int MAX_V = 210;

int V; 
vector<int> g[MAX_V];
int match[MAX_V];
bool used[MAX_V];

inline void add_edge(int u, int v)
{
	g[u].push_back(v);
	g[v].push_back(u);
}

bool dfs(int v)
{
	used[v] = true;

	for (int u : g[v]) {
		int w = match[u];
		if (w < 0 || (!used[w] && dfs(w))) {
			match[v] = u;
			match[u] = v;
			return true;
		}
	}

	return false;
}

int bipartite_matching()
{
	int res = 0;
	memset(match, -1, sizeof(match));

	for (int v = 0; v < V; ++v) {
		if (match[v] < 0) {
			memset(used, 0, sizeof(used));
			res += dfs(v);
		}
	}

	return res;
}

const int MX = 10000010;
bool pr[MX];
bool e[MX];

int main() {
	pr[0] = pr[1] = 1;
	for (int i = 2; i < MX; ++i) {
		if (!pr[i]) {
			for (int j = i * 2; j < MX; j += i) {
				pr[j] = 1;
			}
		}
	}

	int N; cin >> N;
	vi x(N);
	rep(i, N) {
		cin >> x[i];
		e[x[i]] = 1;
	}

	vi vx;
	rep(i, MX-1) {
		if (e[i] != e[i+1]) {
			vx.pb(i);
		}
	}

	vi vl, vr;

	V = vx.size();

	rep(i, V) {
		if (vx[i] & 1) {
			vl.pb(vx[i]);
		} else {
			vr.pb(vx[i]);
		}
	}

	rep(i, vl.size()) {
		rep(j, vr.size()) {
			int t = abs(vl[i] - vr[j]);
			if (!pr[t]) {
				add_edge(i, vl.size() + j);
			}
		}
	}

	int t = bipartite_matching();
	int nl = vl.size() - t, nr = vr.size() - t;
	int ans = t;
	int d = nl / 2;
	ans += d * 2;
	nl -= d * 2;
	d = nr / 2;
	ans += d * 2;
	nr -= d * 2;
	ans += 3 * nl;

	cout << ans << endl;


	return 0;
}

Measured memory_bytes: 17920
#include<iostream>
#include <string>
#include <cstdlib> //絶対値利用のため
#include <algorithm>
#include <vector>
using namespace std;
typedef long long ll;
#define fr(i,n) for(int i=0;i<n;i++)
#define ifr(i,n) for(int i=n-1;i>=0;i--)

//const int INF = INT_MAX / 2;



int main() {
	int a, b, c;
	cin >> a >> b >> c;
	if (b / a >= c) cout << c << endl;
	else cout << b / a << endl;
	
	return 0;
}

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

namespace _20191224_ATC
{
    class Program
    {
        static void Main(string[] args)
        {
            var m = int.Parse(Console.ReadLine());
            var str = Console.ReadLine().ToString().Split(' ');
            var s = str[0];
            var t = str[1];

            //Zip : 2つのリストから一個ずつ取り出して結合する
            //SelectMany : 結合したものを1文字ずつ1つのリストにまとめる
            var output = s.Zip(t, (x, y) => new[] { x, y }).SelectMany(xs => xs);
            //foreach (var item in output)
            //{
            //    Console.WriteLine(item);
            //}

            //char型のリストから文字列を生成
            Console.WriteLine(string.Join("", output));
        }

        private static void ABC148_A()
        {
            var a = int.Parse(Console.ReadLine());
            var b = int.Parse(Console.ReadLine());
            var c = Enumerable.Range(1, 3).Where(x => x != a && x != b).First();
            Console.WriteLine(c);
        }
    }
}


Measured memory_bytes: 13396
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef double db;
typedef vector <ll> vll;
typedef pair <ll, ll> pll;
#define pb push_back
#define mp make_pair
#define MAX 1000000
#define mod 1000000007
#define all(_) _.begin(), _.end()
#define F first
#define S second
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>

int main()
{
    ios_base :: sync_with_stdio(false);
    cin.tie(NULL), cout.tie(NULL);
    ll n, i, ans = 0;
    cin >> n;
    vll a(n + 1), b(n);
    for(i = 0; i <= n; i++)
    {
        cin >> a[i];
    }
    for(i = 0; i < n; i++)
        cin >> b[i];
    for(i = 0; i < n; i++)
    {
        ans += min(a[i], b[i]);
        b[i] -= min(a[i], b[i]);
        ans += min(a[i + 1], b[i]);
        a[i + 1] -= min(a[i + 1], b[i]);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1792
import java.util.Scanner;
public 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 count=0;
        
        for(int i=a;i<=b;i++){
            if(c%i==0){
                count++;
            }
        }
        System.out.println(count);
    }
}


Measured memory_bytes: 26340
#include <iostream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <bitset>

#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <numeric>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define INF 2000000000
#define rep(i,n) for(int i=0;i<(n);i++)
typedef pair<string, string> P;
const ll MOD=1000000007;
using Graph = vector<vector<int>>;

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


ull gcd(ull a, ull b) {
    while (a % b != 0) {
        ull tmp = b;
        b = a % b;
        a = tmp;
    }
    return b;
}

ull lcm(ull a, ull b) {
    if (a == b) return b;
    ull g = gcd(a, b);
    return (a / g) * b;
}

int up(int a, int b) {
    return (a + a % b) / b;
}

//int num[10] = { 0,1,2,3,4,5,6,7,8,9 };
ll d[100005];
int k;
int dfs(int i,string s,int p) {
    if (s.length()>11) return 0;
    if (s.length() <= 0) {
        for (int j = 1; j <= 9; j++) {
            d[i] = stoi(s);
            dfs(i+1, s+to_string(j),j);
        }
    }
    else {
        for (int j = p - 1; j <= p + 1; j++) {
            if (j < 0) continue;
            d[i] = stoi(s + to_string(j));
            dfs(i + 1, s + to_string(j),j);
        }
    }
    return i;
}
queue<P>  p;
vector<ll> a;
int main() {
    
    cin >> k;
    //k--;
    for (int i = 1; i <= 9; i++) a.push_back(i);

    while (1) {
        
        if (k <= a.size()) {
            cout << a[k-1] << endl;
            return 0;
        }
        k -= a.size();
        vector<ll> old;
        swap(old, a);
        for (ll x : old) {
            for (int i = -1; i <= 1; ++i) {
                int d = x % 10 + i;
                if (d < 0 || d > 9) continue;
                ll nx = x * 10 + d;
                a.push_back(nx);
            }
        }

    }
    
    
    return 0;
}

Measured memory_bytes: 1840
from sys import setrecursionlimit
setrecursionlimit(10**8)

N, M = [int(i) for i in input().split()]

if M % 2 == 1:
    print(-1)
    exit()

E = [[] for i in range(N + 1)]
used_e = [False] * M
ans = []

for i in range(M):
    A, B = map(int, input().split())
    E[A].append((B, i))
    E[B].append((A, i))

visited = [False] * (N + 1)


def dfs(prev, v):
    if visited[v]: return
    visited[v] = True
    cnt = 0

    for to, i in E[v]:
        dfs(v, to)
        if not used_e[i]: cnt += 1

    for to, i in E[v]:
        if cnt % 2 == 1 and to == prev: continue
        if not used_e[i]:
            ans.append((v, to))
            used_e[i] = True


dfs(0, 1)

for a in ans: print(*a)


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

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

unsigned lcm(int a, int b) { return (a / __gcd(a, b) * b); }
#define fri(i, n) for (int i = 0; i < n; ++i)
#define jri(j, k, n) for (int j = k; j >= n; j--)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define fa(x , n , v) fill(&(x)[0][0], &(x)[0][0] + (0 + n) *(0 + n) , (v))
#define ra(a) for(int &x : (a)) cin >> (x);
typedef long long int lli;
typedef unsigned long long int ulli;
const lli MOD = 1e9 + 7;
#define pb emplace_back
#define mp make_pair
#define vi vector<int>
#define vlli vector<lli>

int32_t main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n , k;
  cin >> n >> k;
  vi h(n);
  ra(h);
  vi dp(n , INT_MAX);
  dp[0] = 0;
  fri(i,n)
  for(int j = i+1 ; j<= i+k ; ++j){
  	if(j < n){
    dp[j] = min(dp[j] , dp[i] + abs(h[i] - h[j]));
  }
  }
  cout << dp[n-1];
  return 0;
}

Measured memory_bytes: 1024