akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Net;
using System.Numerics;
using System.Reflection.Metadata;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Intrinsics.X86;
using System.Text;
using System.Threading;

namespace AtCoder
{
	public class Program
	{
		public static void Main()
		{
			var nm = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
			int n = nm[0];
			int m = nm[1];

			var ab = new (int a, int b)[n];
			for (int i = 0; i < n; i++) {
				var temp = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
				ab[i] = (temp[0], temp[1]);
			}

			Array.Sort(ab, (x, y) => x.a.CompareTo(y.a));
			var q = new Queue<(int a, int b)>();
			foreach (var item in ab) {
				q.Enqueue(item);
			}

			var heap = new (int a, int b)[n * 2];
			int count = 0;

			void Enqueue((int a, int b) item)
			{
				heap[count] = item;
				++count;

				int me = count - 1;
				while (me > 0) {
					int p = (me - 1) / 2;
					if (heap[p].b < item.b) {
						heap[me] = heap[p];
						me = p;
					} else {
						break;
					}
				}

				heap[me] = item;
			}

			(int a, int b) Dequeue()
			{
				var ret = heap[0];
				int n = count - 1;

				var item = heap[n];
				int me = 0;
				int c = me * 2 + 1;
				while (c < n) {
					if (c != n - 1 && heap[c].b < heap[c + 1].b) {
						++c;
					}

					if (item.b < heap[c].b) {
						heap[me] = heap[c];
						me = c;
						c = c * 2 + 1;
					} else {
						break;
					}
				}

				heap[me] = item;
				--count;

				return ret;
			}


			long ans = 0;
			for (int i = m; i >= 0; i--) {
				while (q.Count > 0 && m - i >= q.Peek().a) {
					Enqueue(q.Dequeue());
				}

				if (count > 0) {
					var next = Dequeue();
					ans += next.b;
				}
			}

			Console.WriteLine(ans);
		}
	}
}


Measured memory_bytes: 50464
import java.util.Scanner;

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

		while (true) {
			n = sc.nextInt();
			if (n == 0) {
				break;
			}
			money = 0L;
			for (int i = 0; i < n; i++) {
				int x = sc.nextInt();
				int y = sc.nextInt();
				int z = sc.nextInt();
				int w = sc.nextInt();
				int k = x + y + z;
				
				if (k <= 60 && w <= 2) {
					money += 600L;
				} else if (k <= 80 && w <= 5) {
					money += 800L;
				} else if (k <= 100 && w <= 10) {
					money += 1000L;
				} else if (k <= 120 && w <= 15) {
					money += 1200L;
				} else if (k <= 140 && w <= 20) {
					money += 1400L;
				} else if (k <= 160 && w <= 25) {
					money += 1600L;
				}
			}
			System.out.println(money);
		}
	}
}

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

#define f(i, a, b, c) for(int i = a ; i < b ; i += c)
#define fr(i, a, b, c) for(int i = a ; i >= b ; i -= c)
#define fit(it, v) for(auto it = v.begin() ; it != v.end() ; ++it)
#define frit(it, v) for(auto it = v.rbegin() ; it != v.rend() ; ++it)
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()
#define eb emplace_back
#define pb push_back
#define lli long long int
#define modn 1000000007
#define NL '\n'

using namespace std;

typedef vector< int > vi;
typedef vector< char > vc;
typedef vector< bool > vb;
typedef vector< string > vs;
typedef vector< lli > vli;
typedef vector< vector< char > > vvc;
typedef vector< vector< int > > vvi;
typedef pair< int, int > ii;
typedef vector< ii > vii;
typedef pair< lli, int> pli;
typedef pair< lli, lli> pll;
typedef set< int > si;
typedef set< ii > sii;

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	
	#ifdef LOCAL_TEST
		clock_t z = clock();
    	ifstream h("in");
	    ofstream g("out");
	#else
	    #define h cin
	    #define g cout
	#endif // LOCAL_TEST
	
	string s;
	h >> s;
	int t = s.size();
	string ans(t, 'x');
	g << ans;
	
	#ifdef LOCAL_TEST
		cerr << "Time taken is: " << double(clock() - z) / CLOCKS_PER_SEC << NL;
		h.close();
		g.close();
	#endif // LOCAL_TEST
}



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



int main (){
    int N;
    cin>>N;
    vector<int> L(N);
    for(int i=0; i<N; i++){
        cin>>L.at(i);
    }
    sort(L.begin(), L.end());
    long long Count=0;
    for(int i=0; i<N-2; i++){
        for(int j=i+1; j<N-1; j++){
            for(int k=j+1; k<N; k++){
                if(L.at(i)+L.at(j)>L.at(k)){
                    Count ++;
                    continue;
                }
                else{
                    break;
                }
            }
        }
    }
    cout<<Count;

}

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



int main() {
	int N, X,count=0;
	cin >> N;
	cin >> X;
	int m[1000000];
	for (int i = 0; i < N; i++) {
		cin >> m[i];
	}
	int j = m[0];
	for (int i = 1; i < N; i++) {
		if (j > m[i]) {
			j = m[i];
		}
	}

		for (int i = 0; i < N; i++) {
			X = X - m[i];
			count++;
		}

		while (true){
			X = X - j;
			if (X < 0) {
				break;
			}
			count++;
	}

	cout << count << endl;
	return 0;
}

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

namespace ITP2_8_C
{
    public class Program

    {
        public static void Main(string[] args)
        {
            int n = ReadInt();
            Dictionary<string, int> sd = new Dictionary<string, int>();
            SortedSet<string> ss = new SortedSet<string>();
            for (int i = 0 ; i < n ; i++)
            {
                string[] line = ReadStAr();
                switch (int.Parse(line[0]))
                {
                    case 0:
                        if (sd.ContainsKey(line[1]))
                        {
                            sd[line[1]] = int.Parse(line[2]);
                        }
                        else
                        {
                            sd.Add(line[1], int.Parse(line[2]));
                            ss.Add(line[1]);
                        }
                        break;
                    case 1:
                        if (sd.ContainsKey(line[1]))
                        {
                            Console.WriteLine(sd[line[1]]);
                        }
                        else
                        {
                            Console.WriteLine(0);
                        }
                        break;
                    case 2:
                        sd.Remove(line[1]);
                        ss.Remove(line[1]);
                        break;
                    case 3:
                        foreach (var item in ss.GetViewBetween(line[1], line[2]))
                        {
                            Console.WriteLine("{0} {1}", item, sd[item]);
                        }
                        break;
                }

            }
        }

        static string ReadSt() { return Console.ReadLine(); }
        static int ReadInt() { return int.Parse(Console.ReadLine()); }
        static long ReadLong() { return long.Parse(Console.ReadLine()); }
        static double ReadDouble() { return double.Parse(Console.ReadLine()); }
        static string[] ReadStAr(char sep = ' ') { return Console.ReadLine().Split(sep); }
        static int[] ReadIntAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Split(sep), e => int.Parse(e)); }
        static long[] ReadLongAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Split(sep), e => long.Parse(e)); }
        static double[] ReadDoubleAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Split(sep), e => double.Parse(e)); }
        static string WriteAr(int[] array, string sep = " ") { return String.Join(sep, array.Select(x => x.ToString()).ToArray()); }
        static string WriteAr(double[] array, string sep = " ") { return String.Join(sep, array.Select(x => x.ToString()).ToArray()); }
        static string WriteAr(long[] array, string sep = " ") { return String.Join(sep, array.Select(x => x.ToString()).ToArray()); }

    }

}



Measured memory_bytes: 49552
import sys

sys.setrecursionlimit(10**7)

N,M = map(int,input().split())
A = list(map(int,input().split()))
B = [list(map(int,input().split())) for _ in range(M)]
A.sort()
B.sort(key = lambda x: -x[1])
# print(A)
# print(BC)
ans = sum(A)
i = 0
j = 0
while i < N:
    if j >= M:
        break
    if A[i] >= B[j][1]:
        break
    ans += B[j][1] - A[i]
    i += 1
    B[j][0] -= 1
    if B[j][0] == 0:
        j += 1
print(ans)

Measured memory_bytes: 36088
main = getContents >>= putStrLn . solve 'a' . words

solve 'a' ["", _, _] = "A"
solve 'b' [_, "", _] = "B"
solve 'c' [_, _, ""] = "C"
solve 'a' [a:as, bs, cs] = solve a [as, bs, cs]
solve 'b' [as, b:bs, cs] = solve b [as, bs, cs]
solve 'c' [as, bs, c:cs] = solve c [as, bs, cs]

Measured memory_bytes: 508
// lcmとか__builtin_popcountとかはg++ -std=c++17 default.cppみたいなかんじで

#include <bits/stdc++.h>
#define mod 1000000007
#define INF LLONG_MAX
#define ll long long
#define ln cout<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
using namespace std;

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

    ll a,b,c,d,m,n,maxi=0,f=0,mini=INF,sum=0;
    string str;
    cin>>n;
    a=9;
    for(ll i=400;i<2000;i+=200){
        a--;
        if(i<=n&&n<i+200){
            cout<<a<<endl;
        }
    }

    return 0;
}


Measured memory_bytes: 3648
#pragma GCC optimize ("O3")
#pragma GCC target ("tune=native")
#pragma GCC target ("avx")

#include <bits/stdc++.h>

// 汎用マクロ
#define ALL_OF(x) (x).begin(), (x).end()
#define REP(i,n) for (long long i=0, i##_len=(n); i<i##_len; i++)
#define RANGE(i,is,ie) for (long long i=(is), i##_end=(ie); i<=i##_end; i++)
#define DSRNG(i,is,ie) for (long long i=(is), i##_end=(ie); i>=i##_end; i--)
#define UNIQUE(v) { sort((v).begin(), (v).end()); (v).erase(unique((v).begin(), (v).end()), (v).end()); }
template<class T> bool chmax(T &a, const T &b) {if (a < b) {a = b; return true;} return false; }
template<class T> bool chmin(T &a, const T &b) {if (a > b) {a = b; return true;} return false; }
#define INF 0x7FFFFFFF
#define LINF 0x7FFFFFFFFFFFFFFFLL
#define Yes(q) ((q) ? "Yes" : "No")
#define YES(q) ((q) ? "YES" : "NO")
#define Possible(q) ((q) ? "Possible" : "Impossible")
#define POSSIBLE(q) ((q) ? "POSSIBLE" : "IMPOSSIBLE")
#define DUMP(q) cerr << "[DEBUG] " #q ": " << (q) << " at " __FILE__ ":" << __LINE__ << endl
#define DUMPALL(q) { cerr << "[DEBUG] " #q ": ["; REP(i, (q).size()) { cerr << (q)[i] << (i == i_len-1 ? "" : ", "); } cerr << "] at " __FILE__ ":" << __LINE__ << endl; }
template<class T> T gcd(const T &a, const T &b) { return a < b ? gcd(b, a) : b ? gcd(b, a % b) : a; }
template<class T> T lcm(const T &a, const T &b) { return a / gcd(a, b) * b; }

// gcc拡張マクロ
#define popcount __builtin_popcount
#define popcountll __builtin_popcountll

// エイリアス
#define DANCE_ long
#define ROBOT_ unsigned
#define HUMAN_ signed
#define CHOKUDAI_ const
using  ll = DANCE_ HUMAN_ DANCE_;
using ull = DANCE_ ROBOT_ DANCE_;
using cll = DANCE_ DANCE_ CHOKUDAI_;
using  ld = long double;
using namespace std;

// モジュール
constexpr ll p = 1000000007LL;

// 処理内容
int main() {
    
    ll n, k; cin >> n >> k;
    vector<ll> a(n);
    REP(i, n) cin >> a[i];

    ll tento_itself = 0;
    RANGE(i, 0, n-1) RANGE(j, i+1, n-1) {
        if (a[i] > a[j]) tento_itself++;
    }

    ll tento_prev = 0;
    REP(i, n) REP(j, n) {
        if (a[i] > a[j]) tento_prev++;
    }
    
    ll ans_prev = tento_prev * ((k-1) * (k-2) / 2 % p) % p;
    ll ans_chokkaku = (tento_prev * (k-1) % p + tento_itself * k % p) % p;
    cout << (ans_prev + ans_chokkaku) % p << endl;
    
}

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


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

	int res = 0;

	char pin_s[4] = "000";
	for (int pin = 0; pin < 1000; ++pin) {
		sprintf(pin_s, "%03d", pin);
		int state = 0;
		for (int i = 0; i < n; ++i) {
			if (s[i] == pin_s[state]) {
				state++;
				if (state == 3) {
					res++;
					break;
				}
			}
		}
	}

	cout << res << endl;

	return 0;
}

Measured memory_bytes: 256
//快速幂,2^n
#include<cstdio>
#define MOD 1000000007
long long fast(int a,int b)
{
	long long ans=1,x=a;
	while(b)
	{	
		if(b&1)     //奇数 
		{
			ans=(ans*x)%MOD;
		}
		x=(x*x)%MOD;
		b=b/2;
	}
	return ans;
 }	
int vis[100000+5];
int main()
{
	long long n,flag=0;
	scanf("%lld",&n);
	for(int i=0;i<n;i++)
	{
		int x;
		scanf("%d",&x);
		vis[x]++;
	}
	for(int i=1;i<=n;i++)
	{
		if(vis[i]==0||vis[i]==2)
		{
			continue;
		}
		else
		{
			flag=1;
		}
	}
	if(n%2==0&&vis[0]!=0)
	{
		flag=1;
	}
	if(n%2==1&&vis[0]!=1)
	{
		flag=1;
	}
	if(flag)
	printf("0\n");
	else
	{
		n=n/2;
		long long ans=fast(2,n);
		printf("%lld\n",ans);
	 } 
	return 0;
//	long long a,b;
//	scanf("%lld%lld",&a,&b);
//	printf("%lld\n",fast(a,b));
 } 

Measured memory_bytes: 512
N = int(input())
A = [int(x) for x in input().split(" ")]

ans=0
r = 0
for i,a in enumerate(A):
    if (i == 0) or (r + 1 == i):
        l = i+1
        a_xor = A[i]
    else:
        a_xor -= A[i-1]
    while(l < len(A)):
        if (a_xor ^ A[l]) == (a_xor + A[l]):
            a_xor += A[l]
            l += 1
        else:
            break
    r = l-1
    ans += l - i
print(ans)

Measured memory_bytes: 23560
// AOJ 0203
#include <iostream>
#include <cstring>

using namespace std;

int main(void)
{
	int x, y;
	while (cin >> x >> y, x || y){
		int field[32][32] = {};
		for (int i = 1; i <= y; i++){
			for (int j = 1; j <= x; j++){
				cin >> field[i][j];
			}
		}
		int dp[32][32];
		memset(dp, 0, sizeof(dp));

		for (int j = 1; j <= x; j++){
			if (field[1][j] == 0){
				dp[1][j] = 1;
			}
		}
		for (int i = 1; i <= y; i++){
			for (int j = 1; j <= x; j++){
				if (field[i][j] == 1){
					continue;
				}
				if (field[i][j] == 2){
					dp[i + 2][j] += dp[i][j];
					continue;
				}
				if (field[i + 1][j - 1] == 0){
					dp[i + 1][j - 1] += dp[i][j];
				}
				if (field[i + 1][j] != 1){
					dp[i + 1][j] += dp[i][j];
				}
				if (field[i + 1][j + 1] == 0){
					dp[i + 1][j + 1] += dp[i][j];
				}
			}
		}

		int ret = 0;
		for (int i = y - 1; i <= y; i++){
			for (int j = 1; j <= x; j++){
				if (i == y - 1){
					if (field[i][j] == 2) ret += dp[i][j];
					continue;
				}
				else if (field[i][j] != 1){
					ret += dp[i][j];
				}
			}
		}
		cout << ret << endl;
	}

	return 0;
}

Measured memory_bytes: 1168
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<P,P> PP;
const ll MOD = 1000000007;
const int IINF = INT_MAX;
const ll LLINF = LLONG_MAX;
const int MAX_N = int(1e5 + 5);
const double EPS = 1e-10;
const int di[] = {0, 1, 0, -1}, dj[] = {1, 0, -1, 0};
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define SORT(v) sort((v).begin(), (v).end())
#define ALL(v) (v).begin(), (v).end()

int main() {
    double W, H, w, h, x, y, px, py;
    cin >> W >> H >> w >> h >> x >> y;
    px = (max(-W/2,x-w/2)+min(W/2,x+w/2))/2;
    py = (max(-H/2,y-h/2)+min(H/2,y+h/2))/2;
    printf("%.8lf\n",py/px);
    return 0;
}



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

int main(){
    int x,n;
    cin>>x>>n;
    if(n==0){
        cout<<x<<endl;
        return 0;
    }
    int a[n];
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    sort(a,a+n);
    int ind=0;
    while(a[ind]<x) ind++;
    if(a[ind]!=x){
        cout<<x<<endl;
        return 0;
    }
    int l=x-1,h=x+1;
    for(int i=ind-1;i>=0;i--){
        if(l==a[i]){
            l--;
            continue;
        }
        if(l!=a[i])
            break;
    }
    for(int i=ind+1;i<n;i++){
        if(h!=a[i])
            break;
        if(h==a[i]){
            h++;
            continue;
        }
    }
    cout<<(abs(l-x)<=abs(h-x)?l:h)<<endl;
}

Measured memory_bytes: 3632
function main()
  
  A = parse(Int,readline())
  B = parse(Int,readline())
  C = parse(Int,readline())
  X = parse(Int,readline())
  
  count = 0
  
  for i in 0:A
    for j in 0:B
      for k in 0:C
        
        if 500i + 100j + 50k == X
          count += 1
        end
        
      end
    end
  end
  
  println(count)
  
end

main()

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

const ll size = 100000;
ll N, A, B;
ll X[size];

void init() {
  cin >> N >> A >> B;
  for(ll i = 0; i < N; i++) {
    cin >> X[i];
  }
}

void solve() {

  ll ans = 0;
  
  for(ll i = 1; i < N; i++) {
    ans += min(A * (X[i] - X[i - 1]), B);
  }

  cout << ans << endl;
}


int main() {
  init();
  solve();

}


Measured memory_bytes: 1024
x,n = map(int,input().split())
P = list(map(int,input().split()))


all_l = [i for i in range(0,101)]
for p in P:
    all_l.remove(p)

kouho = x
for i in range(200):
    kouho1 = x-i
    kouho2 = x+i
    if kouho1 not in P:
        print(x-i)
        break
    elif kouho2 not in P:
        print(x+i)
        break

Measured memory_bytes: 9196
<?php
fscanf(STDIN, "%d", $N);
for ($i = 0; $i < $N; $i++) {
    fscanf(STDIN, "%d %d %d", $C[$i], $S[$i], $F[$i]);
}
for ($i = 0; $i < $N; $i++) {
    echo solve($i) . PHP_EOL;
}

function solve($start) {
    global $C, $S, $F, $N;

    $t = 0;
    for ($i = $start; $i < $N - 1; $i++) {
        if ($S[$i] >= $t) {
            $t = $S[$i];
        } else {
            $num = ceil(($t - $S[$i]) / $F[$i]);
            $t = $S[$i] + $num * $F[$i];
        }
        $t += $C[$i];
    }
    
    return $t;
}

Measured memory_bytes: 4728
using System;

public class P
{
    public int a { get; set; }
    public int b { get; set; }
}

public class hello
{
    public static void Main()
    {
        var n = long.Parse(Console.ReadLine().Trim());
        string[] line = Console.ReadLine().Trim().Split(' ');
        var a = int.Parse(line[0]);
        var b = int.Parse(line[1]);
        var t = n % 12;
        if (t >= 6)
        {
            t -= 6;
            var ans = getAns((int)t, a, b);
            Console.WriteLine("{0} {1}", -ans.a, -ans.b);
        }
        else
        {
            var ans = getAns((int)t, a, b);
            Console.WriteLine("{0} {1}", ans.a, ans.b);
        }
    }
    static P getAns(int n, int a, int b)
    {
        if (n == 0) return new P { a = a, b = b };
        if (n == 1) return new P { a = a - b, b = b };
        if (n == 2) return new P { a = a - b, b = a };
        if (n == 3) return new P { a = -b, b = a };
        if (n == 4) return new P { a = -b, b = a - b };
        return new P { a = -a, b = a - b };
    }
}



Measured memory_bytes: 7864
#include<iostream>
using namespace std;
int main(){
int w,h;
char C[101][101];
char C1[201][201];
cin>>h>>w;
for(int i=0;i<h;i++)
 for(int j=0;j<w;j++)
  cin>>C[i][j];

 for(int i=0;i<w;i++)C1[0][i]=C[0][i];

for(int i=1;i<2*h;i++)
 for(int j=0;j<w;j++)C1[i][j]=C[i/2][j];

for(int i=0;i<2*h;i++){
 for(int j=0;j<w;j++)
  cout<<C1[i][j];
  cout<<endl;
}
return 0;
}


Measured memory_bytes: 256
// Made by Luis Miguel Baez
// es.luismiguelbaez@gmail.com

#include <bits/stdc++.h>
 
using namespace std;

#define endl '\n'
#define precise(n,k) fixed << setprecision(k) << n
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define uint  unsigned int
#define ll    long long
#define ull   unsigned long long
#define ld    long double

#define pii   pair<int, int>
#define piii  pair<int, pair<int, int>>
#define pll   pair<ll, ll>

#define F  first
#define S  second
#define PB push_back
#define MP make_pair

#define debug(...) "[" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

string to_string(string s) {
    return '"' + s + '"';
}

string to_string(bool b) {
    return (b ? "true" : "false");
}
 
template <typename A, typename B>
string to_string(pair<A, B> p) {
    return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

template <typename T>
string to_string(const vector<T> &v) {
    bool first = true;
    string res = "{";
    for (const T &x : v) {
        if (!first) {
            res += ", ";
        }
        first = false;
        res += to_string((T)x);
    }
    res += "}";
    return res;
}

// add templates here

template<class T>
void println(const T &data) {
    cout << to_string((T)data) << endl;
}

template <typename T>
void write(vector<T> &v, bool size=true) {
    if(size) cout << v.size() << endl;
    string res = "";
    for(const T &x: v) {
        res += to_string((T)x) + " ";
    }
    cout << res << endl;
}

template <typename T>
void read(vector<T> &v) {

    for(const T &x: v) {
        cin >> x;   
    }
}

const int MOD = int(1e9+7);
const int oo  = int(1e9 + 20);
const ll lloo  = (ll)(1e18 + 10);

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

    int n;
    cin >> n;
    vector<int> val(n+1);
    vector<int> sorted;
    for(int i = 1; i <= n; ++i) {
        cin >> val[i];
        sorted.push_back(val[i]);
    }
    sort(all(sorted));
    
    for(int i = 1; i <= n; ++i) {
        if(val[i] != sorted[n-1]) {
            cout << sorted[n-1];
        } else {
            cout << sorted[n-2];
        }
        cout << endl;
    }
    

    return 0;
}

Measured memory_bytes: 5036
#include <string>
#include <vector>
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<stack>
#include<queue>
#include<cmath>
#include<algorithm>
#include<functional>
#include<list>
#include<deque>
#include<bitset>
#include<set>
#include<map>
#include<unordered_map>
#include<cstring>
#include<sstream>
#include<complex>
#include<iomanip>
#include<numeric>
#include<cassert>
#define X first
#define Y second
#define pb push_back
#define rep(X,Y) for (int (X) = 0;(X) < (Y);++(X))
#define reps(X,S,Y) for (int (X) = S;(X) < (Y);++(X))
#define rrep(X,Y) for (int (X) = (Y)-1;(X) >=0;--(X))
#define repe(X,Y) for ((X) = 0;(X) < (Y);++(X))
#define peat(X,Y) for (;(X) < (Y);++(X))
#define all(X) (X).begin(),(X).end()
#define rall(X) (X).rbegin(),(X).rend()
#define eb emplace_back
#define UNIQUE(X) (X).erase(unique(all(X)),(X).end())

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
template<class T> using vv=vector<vector<T>>;
template<class T> ostream& operator<<(ostream &os, const vector<T> &t) {
os<<"{"; rep(i,t.size()) {os<<t[i]<<",";} os<<"}"<<endl; return os;}
template<class S, class T> ostream& operator<<(ostream &os, const pair<S,T> &t) { return os<<"("<<t.first<<","<<t.second<<")";}
template<class T> inline bool MX(T &l,const T &r){return l<r?l=r,1:0;}
template<class T> inline bool MN(T &l,const T &r){return l>r?l=r,1:0;}
const ll MOD=1e9+7;

vector<pll> nums[112345];

int main(){
  ios_base::sync_with_stdio(false);
  cout<<fixed<<setprecision(0);
  int r,c,n;
  cin>>r>>c>>n;
  rep(i,n){
    int y,x,a;
    cin>>y>>x>>a; --y; --x;
    nums[y].eb(x,a);
  }
  vv<pll> g(c);
  rep(y,r){
    sort(all(nums[y]));
    UNIQUE(nums[y]);
    rep(x,int(nums[y].size())-1){
      const pll p=nums[y][x];
      const pll q=nums[y][x+1];
      g[p.X].eb(q.X,q.Y-p.Y);
      g[q.X].eb(p.X,p.Y-q.Y);
    }
  }
  for(auto &v:g){
    sort(all(v));
    UNIQUE(v);
  }
  //cout<<g;
  vector<ll> d(c);
  vector<int> usd(c),grp(c);
  rep(orig,c)if(!usd[orig]){
    queue<int> que;
    que.push(orig);
    d[orig]=0; usd[orig]=1; grp[orig]=orig;
    while(que.size()){
      int v=que.front(); que.pop();
      for(pll p:g[v]){
	ll dd=d[v]+p.Y;
	if(usd[p.X]){
	  if(d[p.X]!=dd){
	    cout<<"No"<<endl;
	    return 0;
	  }
	  continue;
	}
	usd[p.X]=1;
	grp[p.X]=orig;
	d[p.X]=dd;
	que.push(p.X);
      }
    }
  }
  //cout<<usd<<d;
  vector<ll> mn(c,0);
  rep(i,c) MN(mn[grp[i]],d[i]);
  //cout<<mn;
  rep(y,r) for(pll p:nums[y]){
    if(p.Y-d[p.X]+mn[grp[p.X]] < 0){
      cout<<"No"<<endl;
      return 0;
    }
  }
  cout<<"Yes"<<endl;
  return 0;
}


Measured memory_bytes: 12800
/* ex 7_3
   unomi */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main(void){
    int row=0,column=0,i=0,j=0;
    int flag_row[1000],flag_column[1000];
    char **grid;

    // 行数と列数 の入力を取得
    scanf("%d %d", &row, &column);



    // サイズrowのchar*型ポインタ配列を動的確保
    // 各行の配列へのポインタ分のメモリ領域を確保
    grid = (char**)calloc(row,sizeof(char*));
    // エラー処理
    if(grid == NULL){
        exit(1);
    }
    //各行の要素分のメモリ領域を確保
    for(i=0; i<row; i++){
        grid[i] = (char*)calloc(column, sizeof(char));
        if(grid[i] == NULL){
            exit(1);
        }
    }



    // grid[row][column] で入力を取得
    for(i=0; i<row; i++){
        for(j=0; j<column; j++){
            scanf(" %c", &grid[i][j]);
        }
    }
 
    for(i=0; i<row; i++){
        for(j=0; j<column; j++){
            // 黒のマスがあった場合
            if(grid[i][j]=='#'){
                // そのマスがある行と列に対してフラグを建てる
                flag_row[i] = 1;
                flag_column[j] = 1;
            }
        }
    }
 
    for(i=0; i<row; i++){
        for(j=0; j<column; j++){
            // 対象のマスの行か列に黒のマスがあるなら、表示
            if(flag_row[i]==1 && flag_column[j]==1) printf("%c",grid[i][j]);
        }
        // 現在の行に黒のマスがあるなら、改行
        if(flag_row[i]==1) printf("\n");
    }

    // 各行の要素分のメモリ領域を解放 -> 各行の配列へのポインタの領域を解放
    for(i=0; i<row; i++){
        free(grid[i]);
    }
    free(grid);

    return 0;
}

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

#define st first
#define nd second
#define pb push_back

typedef long long   ll;
typedef double      db;
typedef long double ldb;

typedef pair <int, int> pii;
typedef pair <ll,  ll>  pll;
typedef pair <ll,  db>  pdb;
typedef pair <ldb, ldb> pldb;

template <typename T>
void   Debug (T begin, T end);
int    si    ();
ll     sl    ();
string ss    (int); 
db     sf    ();
ldb    slf   ();
void   pi    (int, char = '\n');
void   pl    (ll, char = '\n');
void   pf    (db, char = '\n');
void   plf   (ldb, char = '\n');
void   ps    (string, char = '\n');

ll russian(ll, ll, ll);
ll fastpow(ll, ll, ll);
ll slowpow(ll, ll, ll);
ll _gcd(ll, ll);
ll _lcm(ll, ll);
ll extgcd(ll, ll, ll&, ll&);
ll _inv(ll, ll);

const int INF  = 1e9;
const ll  LINF = 1e18;

int main()
{
    int a = si(), b = si(),  c= si();
    if ( a + b + c >= 22)
        ps("bust");
    else
        ps("win");

    return 0;
}

template <typename T>
void Debug(T begin, T end)
{
    printf("\nDEBUG:\n");
    while (begin != end)
        printf("%d ", *begin),
        begin++;
    printf("\n\n");
}

template <typename T>
T scanf_t(string s)
{
    T a;
    scanf(s.c_str(), &a);
    return a;
}

template <typename T>
void printf_t(T a, string s, char end_l)
{
    s.push_back(end_l);
    printf(s.c_str(), a);
}

int si() { return scanf_t<int>("%d"); }
ll sl() { return scanf_t<ll>("%lld"); }
db sf() { return scanf_t<db>("%f"); }
ldb slf() { return scanf_t<ldb>("%Lf"); }

void pi(int a, char end_l) { printf_t<int>(a, "%d", end_l); }
void pl(ll a, char end_l) { printf_t<ll>(a, "%lld", end_l); }
void pf(db a, char end_l) { printf_t<db>(a, "%lf", end_l); }
void plf(ldb a, char end_l) { printf_t<ldb>(a, "%Lf", end_l); }

void ps(string a, char end_l)
{
    string s = "%s";
    s.push_back(end_l);
    printf(s.c_str(), a.c_str());
}

string ss(int NN)
{
    char T[NN];
    scanf("%s", T);
    return (string)T;
}

ll fastpow(ll a, ll k, ll m)
{
    ll r = 1LL;
    while (k)
    {
        if (k & 1LL)
            r = (r * a) % m;
        a = (a * a) % m;
        k >>= 1LL;
    }
    return r;
}

ll slowpow(ll a, ll k, ll m)
{
    ll r = 1LL;
    while (k)
    {
        if (k & 1LL)
            r = russian(r, a, m);
        a = russian(a, a, m);
        k >>= 1LL;
    }
    return r;
}

ll russian(ll a, ll k, ll m)
{
    ll r = 0LL;
    while (k)
    {
        if (k & 1LL)
            r = (r + a) % m;
        a = (a + a) % m;
        k >>= 1LL;
    }
    return r;
}

ll _gcd(ll a, ll b)
{
    while (b)
        swap(a %= b, b);
    return a;
}

ll _lcm(ll a, ll b)
{
    return a / _gcd(a, b) * b;
}

ll extgcd(ll a, ll b, ll& k, ll& l)
{
    if (b == 0)
    {
        k = 1; l = 0;
        return a;
    }    
    ll res = extgcd(b, a % b, l, k);
    l -= a / b * k;
    return res;
}

ll _inv(ll a, ll p)
{
    return fastpow(a, p - 2, p);
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,day,excess,r=0;
    cin>>n;
    cin>>day>>excess;
    int a[n+2];
    for(int i=0; i<n; i++)
    {
        cin>>a[i];
    }
    for(int i=0; i<n; i++)
    {
        int m=a[i];
        int c=1;
        int s=1+a[i];
        for(int j=s; j<=day; j+=m)
        {
            c++;

        }

        r=r+c;
    }
    cout<<r+excess<<endl;
}


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

using namespace std;
using int64 = long long;

constexpr int DEBUG = 0;

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

  int n;
  cin >> n;
  vector<int> vs(n);
  vector<int> cs(n);
  for (int i = 0; i < n; i++) {
    cin >> vs[i];
  }
  for (int i = 0; i < n; i++) {
    cin >> cs[i];
  }
  int ans = 0;
  for (int i = 0; i < n; i++) {
    if (vs[i] - cs[i] >= 0) ans += vs[i] - cs[i];
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int W,H;
    
    while(1){
        cin>>H>>W;
        if(H==0  && W==0) break;
        
        for(int i=1; i<=H; i++){
            for(int j=1; j<=W; j++){
                cout << '#' << flush;
            }
        cout<<'\n';
        }
    cout<<'\n';
    }
    return 0;
}



Measured memory_bytes: 3060
#!/usr/bin/env python3
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = 0 ;count = 0 ;pro = 1

a,b,c,d = map(int,input().split())
while True:
  c -= b
  if c <= 0:print("Yes");exit()
  a -= d
  if a <= 0:print("No");exit()

Measured memory_bytes: 65260
#include <bits/stdc++.h>
using namespace std;
int main(void){
    
    int n;
    char s[300009];
    int ans=0;
    int tmp=0;
    int tmpm=0;
    int ansp=0;
    
    cin >> n;
    cin >> s;
    
    for(int i=0; i<=n-2; i++){
        
        if(s[i]=='E'&&s[i+1]=='E'){
            
            tmp -= 1;
            
            if(tmp<tmpm){
                
                ansp = i + 1;
                tmpm = tmp;
                
            }
            
        } else if(s[i]=='W'&&s[i+1]=='W'){
            
            tmp += 1;
            
        }
        
    }
    
    for(int j=0; j<=n-1; j++){
        
        if(j<ansp&&s[j]=='W'){
            
            ans += 1;
            
        } else if(j>ansp&&s[j]=='E'){
            
            ans += 1;
            
        }
        
    }
    
    cout << ans << endl;
    
    return 0;
    
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
  int N, M, R;
    cin >> N >> M >> R;
    int r[R];
 
    int A[M], B[M] ,C[N][N] = {};
    for(int i = 0; i < N; i++)
        for(int j = 0; j < N; j++)
            if ( i != j) C[i][j] = 50000000;
    for(int i = 0; i < R; i++) {
        cin >> r[i];
        r[i]--; // ここをdecrementするのを忘れていた。
    }
    for(int i = 0; i < M; i++) {
        cin >> A[i] >> B[i];
        A[i]--; B[i]--;
        cin >> C[A[i]][B[i]];
        C[B[i]][A[i]] = C[A[i]][B[i]];
    }
 
    int ans = 1000000000;
 
    for(int k = 0; k < N; k++){
        for(int i = 0; i < N; i++){
            for(int j = 0; j < N; j++){
                    C[i][j] = min(C[i][j], C[i][k] + C[k][j]);
            }
        }
    }
    sort(r, r+R);
    do{
        int _ans = 0;
        for(int i = 0; i < R - 1; i++)  
            _ans += C[r[i]][r[i + 1]];

        if(_ans < ans && _ans) 
            ans = _ans;
    }while(next_permutation(r, r+R));
 
    cout << ans << endl;
 
    return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<long long,long long> pll;
#define ep emplace_back
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i=0;i<(n);++i)
constexpr int mod=1000000007;
constexpr int mod1=998244353;
vector<int> dx={0,1,0,-1},dy={-1,0,1,0};
bool inside(int y,int x,int h,int w){
	if(y<h && y>=0 && x<w && x>=0) return true;
	return false;
}





int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n,W;cin >> n >> W;
	vector<int> w(n),v(n);
	rep(i,n) cin >> w.at(i) >> v.at(i);
	vector<vector<ll>> dp(n + 1, vector<ll>(W + 1));
	rep(i,n){
		rep(j,W + 1){
			if(j - w.at(i) >= 0) dp[i + 1][j] = max(dp[i + 1][j], dp[i][j - w.at(i)] + v.at(i));
			dp[i + 1][j] = max(dp[i + 1][j], dp[i][j]);
		}
	}
	cout << dp[n][W] << endl;
}


Measured memory_bytes: 80256
# -*- coding: utf-8 -*-
import sys
from collections import deque, defaultdict
from math import sqrt, factorial
# def input(): return sys.stdin.readline()[:-1] # warning not \n
# def input(): return sys.stdin.buffer.readline().strip() # warning bytes
# def input(): return sys.stdin.buffer.readline().decode('utf-8')


def solve():
    n, l = [int(x) for x in input().split()]
    a = []
    for _ in range(n):
        a.append(input())
    a.sort()
    print(''.join(a))



t = 1
# t = int(input())
for case in range(1,t+1):
    ans = solve()


"""

a aa c ca c a b a ab a b c

"""


Measured memory_bytes: 9372
import sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def dp2(ini, i, j): return [[ini]*i for i2 in range(j)]
def dp3(ini, i, j, k): return [[[ini]*i for i2 in range(j)] for i3 in range(k)]
#import bisect #bisect.bisect_left(B, a)
#from collections import defaultdict #d = defaultdict(int) d[key] += value


S = input()

if S[0]=='7' or S[1]=='7' or S[2]=='7':
    print('Yes')
else:
    print('No')

Measured memory_bytes: 9088
function main(input){
  const lines = input.split('\n');
  const N = lines[0].split(' ').map(x => parseInt(x))[0];
  const K = lines[0].split(' ').map(x => parseInt(x))[1];


  console.log(N-K+1)

}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));


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

const int M = 1000005;

int main() {
	int n;
	cin >> n;
	vector<int> a(n);
	
	rep(i,n) {
		cin >> a.at(i);
	}
	vector<int> cnt(M);
	for (int x : a) {
		if (cnt[x] != 0) {
			cnt[x] = 2;
			continue;
		}
		for (int i=x;i<M;i+=x) {
			cnt[i]++;
		}
	}
	int ans = 0;
	for (int x : a) {
		if (cnt[x] == 1) ans++;
	}
	cout << ans << "\n";
	return 0;
}


Measured memory_bytes: 8008
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define pb push_back
#define mp make_pair
#define SZ(x) ((int)(x).size())
#define all(x) x.begin(),x.end()
#define mem0(s) memset(s,0,sizeof(s))
#define meminf(s) memset(s,0x3f,sizeof(s))
#define mp_insert(a,b,c) mp.insert(map<pair<int,int>,int>::value_type(make_pair(a,b),c))
double pi=acos(-1);
typedef long long ll;
typedef unsigned long long ull;
inline ll lowbit(ll x){return x&(-x);}
inline ll min(ll a,ll b){return a<b?a:b;}
inline ll max(ll a,ll b){return a>b?a:b;}
const ll INF=4223372036854775807,max_n=300005,mod=0x7f7f7f7f7f;
inline ll gcd(ll a,ll b){return b==0?a:gcd(b,a%b);}
inline ll pow(ll a,ll b,ll mod){ll res=1;a%=mod;assert(b>=0);for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}

int main()
{
	ll n;
	cin>>n;
	ll x=100;
	for(int i=1;;i++)
	{
		x=x*1.01;
		if(x>=n)
		{
			cout<<i;return 0;
		}
	}

	return 0;
}

Measured memory_bytes: 3596
#include <iostream>

int main() {
	
	int first, second, third;
	first = second = third = 0;
	
	for(int i=0; i<10; i++) {
		int t;
		std::cin >> t;
		
		if(first < t) {
			third = second;
			second = first;
			first = t;
		} else if(second < t) {
			third = second;
			second = t;
		} else if(third < t) {
			third = t;
		}
	}
	std::cout << first << std::endl;
	std::cout << second << std::endl;
	std::cout << third << std::endl;
	
	return 0;
}

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


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

  ll h,n;
  cin >> h >> n;
  ll sum=0;
  rep(i,n){
    ll a;
    cin >> a;
    sum +=a;    
  }
  if(sum >=h) cout << "Yes" << endl;
  else cout << "No" << endl;

  
  return 0;
    

}


Measured memory_bytes: 256
#include <cstdio>
#include <cctype>
#include <cstring>
#include <algorithm>
int read(){
	register int x = 0;
	register char f = 1, ch = getchar();
	for (; !isdigit(ch); ch = getchar()) if (ch == '-') f ^= 1;
	for (; isdigit(ch); ch = getchar()) x = (x << 1) + (x << 3) + (ch ^ '0');
	return f ? x : -x;
}
#define N 100005
int n, c[N];
long long a[N], b[N], ans;
char s[15];
int main(){
	n = read();
	for (register int i = 1; i <= n; ++i){
		scanf("%s", s);
		std :: sort(s, s + 10);
		for (register int j = 0; j < 10; ++j) a[i] = a[i] * 26 + s[j] - 'a';
		b[i] = a[i];
	}
	std :: sort(b + 1, b + 1 + n);
	for (register int i = 1; i <= n; ++i)
		a[i] = std :: lower_bound(b + 1, b + 1 + n, a[i]) - b;
	for (register int i = 1; i <= n; ++i)
		++c[a[i]];
	for (register int i = 1; i <= n; ++i) ans += 1ll * c[i] * (c[i] - 1) >> 1;
	printf("%lld\n", ans);
}

Measured memory_bytes: 2048
#include <stdio.h>
#include <stdlib.h>

#include <iostream>
#include <iomanip>
#include <sstream>
#include <fstream>
#include <stdint.h>
#include <string.h>

#define _USE_MATH_DEFINES
#include <math.h>

#include <vector>
#include <list>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <stack>
#include <deque>
#include <string>

#include <algorithm>
#include <functional>
#include <bitset>
#include <functional>
#include <chrono>
#include <random>

#define sqr(x) (x) * (x)

typedef unsigned int u32;
typedef int i32;
typedef unsigned long long int u64;
typedef long long int i64;
typedef uint16_t u16;
typedef int16_t i16;
typedef uint8_t u8;
typedef int8_t i8;

using namespace std;
using namespace std::chrono;

const i64 mod = 1'000'000'000ll + 7;
//const i64 smod = 998244353ll;
//const i64 inf = 1'000'000'000'000'000'000ll + 7;
//const i64 inf = 1'000'000'007;

const long double eps = 1e-8;

const i64 MAXN = 3 * 100'000 + 5;

i64 n;
i64 a[MAXN];

int main(int argc, char* argv[]) {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cout.precision(15); cout.setf(ios::fixed);

    i64 p = 1;

    string s;
    cin >> n >> s;

    s[1] = s[0];

    stringstream ss(s.substr(1));
    i64 t;
    ss >> t;

    i64 R = n * t;
    cout << R / 100 << endl;



    return 0;
}

Measured memory_bytes: 3664
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
typedef long long ll;
#define pi acos(-1);
ll strtoint(string str);
int main(){
	fast;
	string s,t;
	cin>>s>>t;
	if(s==t.substr(0,t.size()-1))cout<<"Yes\n";
	else
		cout<<"No\n";
	return 0;
}
ll strtoint(string str){
	ll x=0;
	stringstream ss;
	ss<<str;
	ss>>x;
	return x;
}

Measured memory_bytes: 3620
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <math.h>
#include <vector>
#include <string>
#include <sstream>
#include <numeric>
#include <set>
#include <map>
//#include <bits/stdc++.h>

#define rep(i, j) for(int i = 0; i < j; i++)
#define all(i) i.begin(), i.end()
#define ll long long
#define bl bool
#define nn printf("\n");
#define mod 1000000007

using namespace std;

int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	int N, M, P;
	while(cin >> N >> M >> P && N != 0 && M != 0)
	{
		vector<int> dat(N, 0);
		rep(i, N){ cin >> dat[i]; }
		if(dat[M - 1] == 0){ printf("0\n"); }
		else{ printf("%d\n", (accumulate(all(dat), 0) * (100 - P)) / dat[M - 1]); }
	}
	
	return 0;
}

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

int main(){
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  long long int n;
  cin>>n;
  long long int sum=0;
  for(long long int i=1;i<=n;i++){
    if(i%3 !=0 && i%5 !=0){
      sum +=i;
    }
  }
  cout<<sum<<endl;
}



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


int main() {
  int N;cin>>N;
  vector<int> s(N);rep(i,N) cin>>s[i];
  
  int sum=0;
  for(int i=0;i<N;i++) sum+=s[i];
  
  int count=0;
  for(int i=0;i<N;i++){
    if(s[i]%10==0) count++;
  }
  if(count==N){
    cout << 0 << endl;
    return 0;
  }
  
  int min_ans=110;
  if(sum%10!=0){
    cout << sum << endl;
    return 0;
  }
  else{
    for(int i=0;i<N;i++){
      if(s[i]%10!=0) min_ans=min(min_ans,s[i]);
    }
    
    cout << sum-min_ans << endl;
  }
}
 

Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define ll long long
#define ld long double
#define tc() ll t;cin>>t;while(t--)
#define inp(n) ll n;cin>>(n)
#define inp2(n,m) ll n,m;cin>>(n);cin>>(m)
#define inp3(n,m,g) ll n,m,g;cin>>(n);cin>>(m);cin>>(g)
#define inps(s) string s;cin>>(s)
#define fr(i,n) for(ll i=0;i<n;i++)
#define rf(n,i) for(ll i=n-1;i>=0;i--)
#define vi vector<int >
#define vl vector<ll>
#define vd vector<ld>
#define vs vector<string >
#define pii pair<int,int>
#define pci pair<char ,int>
#define pic pair<int ,char>
#define psi pair<string ,int>
#define mii map<int ,int >
#define mci map<char ,int>
#define msi map<string ,int>
#define si set<int >
#define ss set<string>
#define pb push_back
#define mp make_pair
#define ft first
#define sd second
#define mem(a,b) memset(a,b,sizeof(a))
#define mod 1000000007

int main() {
    fast
    string s;
    cin>>s;
    int n = s.length();
    
    if(s[n-1]=='s'){
        s.push_back('e');
        s.push_back('s');
    }
    else{
        s.push_back('s');
    }
    cout<<s<<endl;
	return 0;
}


Measured memory_bytes: 3680
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <ctime>
#include <list>
#include <numeric>
#include <utility>
#include <ctime>
#define INF 100000000
#define LINF 9000000000000000000
#define mod 1000000007
 
#define rep(i,n) for(int i=0;i<int(n);i++)
#define REP(i,a,b) for(int i=(a);i<int(b);i++)
#define all(x) (x).begin(),x.end()
#define pb push_back
#define mp make_pair
#define MOD(x) (x%(mod))
 
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int,int> pi;
 
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
bool debug=false;
 
/*---------------------------------------------------*/
 
ll n,a,b,H;
ll l,r,mid;
vector<int>h;
 
bool check(int cnt){
  int index=upper_bound(all(h),cnt*b)-h.begin();
  ll con=cnt*b;
  for(int i=index;i<n;i++){
    cnt-=(h[i]-con)/(a-b);
    if((h[i]-con)%(a-b)!=0)cnt--;
    if(cnt<0)return false;
  }
  return true;
}
 
int main(){
  scanf("%d%d%d",&n,&a,&b);
  rep(i,n){scanf("%d",&H);h.pb(H);}
  sort(all(h));
  l=0;r=1000000001;mid=(l+r)/2;
  while(l<r){
    if(check(mid))r=mid;
    else l=mid+1;
    mid=(l+r)/2;
  }
  cout<<mid<<endl;
  return 0;
}

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

int n;
const int maxn = 55;

int a[maxn], b[maxn];

bool vis[maxn];
typedef long long ll;

bool check(int start, int end, ll mask){
    memset(vis, 0, sizeof(vis));
    vis[start] = 1;
    queue<int> q;
    q.push(start);
    while(!q.empty()){
        int p = q.front(); q.pop();
        if(p == end)
            return true;
        for(int i = 49;i >= 0;i--){
            if(mask & (1LL << i)){
                int to = p % (i + 1);
                if(!vis[to]){
                    vis[to] = true;
                    q.push(to);
                }
            }
        }
    }
    return false;
}

bool check(ll mask){
    for(int i = 1;i <= n;i++){
        if(!check(a[i], b[i], mask)){
            return false;
        }
    }
    return true;
}

int main(){
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    cin >> n;    
    for(int i = 1;i <= n;i++){
        cin >> a[i];
    }
    for(int i = 1;i <= n;i++){
        cin >> b[i];
    }
    long long all = 0;
    int l = 0, r = 50;
    if(!check((1LL << r) - 1)){
        cout << -1 << endl;
        return 0;
    } 
    while(r > 0){
        int ll = 0, rr = r;
        while(ll < rr){
            int mid = (ll + rr) / 2;
            long long tmp = all + (1LL << mid) - 1; 
            if(check(tmp)){
               rr = mid;
            }else{
               ll = mid + 1;
            }
        }
        r = ll - 1;
        if(r >= 0)
            all += (1LL << r);
    }
    cout << all * 2<< endl;
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>
#include <stdlib.h>
int main()
{
    char a,b;

    scanf("%c", &b);
	/*printf("%c",b);*/
    if(b=='A'){
      a='T';
    } else if (b=='T'){
      a='A';
    } else if (b=='G'){
      a='C';
    } else {
      a='G';
    }

    printf("%c",a);
    return 0;
}

Measured memory_bytes: 128
// B.

#include <iostream>
#include <algorithm>

using namespace std;

int main(int argc, char *argv[]) {
	int a, b, c, x, ans = 0;
	cin >> a >> b >> c >> x;
	for (int i = 0; i <= a; ++i) {
		for (int j = 0; j <= b; ++j) {
			for (int k = 0; k <= c; ++k) {
				int l = i * 500 + j * 100 + k * 50;
				ans += x == l;
				if (l > x) {
					break;
				}
			}
		}
	}
	cout << ans << endl;
	return 0;
}


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

namespace abc119b
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());

            double otoshi = 0;

            for(int i = 0; i < n; i++)
            {
                string[] s = Console.ReadLine().Split(' ');
                double o = double.Parse(s[0]);

                if (s[1] == "BTC")
                {
                    otoshi += o * 380000.0;
                }
                else
                {
                    otoshi += o;
                }
            }

            Console.WriteLine(otoshi);
        }
    }
}


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

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

Measured memory_bytes: 256
#include <stdio.h>
int main ()
{
    int A,B;
    scanf ("%d %d", &A, &B);
    if (A<=13 && B<=13)
    {
    if (A ==1 && B!=1)
    {
        printf ("Alice");
    }
    else if (A > B && B != 1)
    {
        printf ("Alice");
    }
    else if (B == 1 && A!=1)
    {
        printf ("Bob");
    }
    else if (B  > A && A != 1)
    {
        printf ("Bob");
    }
    else
    {
        printf ("Draw");
    }
    }
}


Measured memory_bytes: 128