akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define rep1(i,n) for(int i=1;i<=(int)n;i++)
#define sp(n) cout << fixed << setprecision(n)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
typedef long long ll;
using namespace std;
int main(void){
    string s;cin>>s;
    string t="keyence";
    rep(i,7){
        string x=s.substr(0,i)+s.substr(s.size()-7+i,7-i);
        if(x==t){
            cout<<"YES"<<endl;
            return 0;
        }
    }
    cout<<"NO"<<endl;
}

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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
template<typename T> using v = vector<T>;
template<typename T> using pq = priority_queue<T>;
template<typename T> using minpq = priority_queue<T, vector<T>, greater<T>>;
template<typename T, typename K> using ump = unordered_map<T, K>;
const ll dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const ll mod = 1000000007;
const ll inf = ll(1e9);
const ll e5 = ll(1e5);
const ll ll_inf = ll(1e9) * ll(1e9);

#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for(ll i = n - 1; i >= 0; i--)
#define repone(i, n) for(ll i = 1; i <= (ll)(n); i++)
#define each(i, mp) for(auto& i:mp)
#define eb emplace_back
#define F first
#define S second
#define all(obj) (obj).begin(), (obj).end()

template<class T>
void dump_debug(T list) {
#ifdef MY_DEBUG
    each(e, list) cout << e << " ";
    printf("\n");
#endif
}

inline ll inl() {
    ll x;
    cin >> x;
    return x;
}

inline string ins() {
    string x;
    cin >> x;
    return x;
}

/* ------------- ANSWER ------------- */
/* ---------------------------------- */

// 約数列挙
vector<ll> divisor(ll n) {
    vector<ll> res;
    for (ll i = 1; i * i <= n; ++i) {
        if (n % i == 0) {
            res.emplace_back(i);
            if (i != n / i) res.emplace_back(n / i);
        }
    }
    return res;
}

int main() {
#ifdef MY_DEBUG
    while (true) {
#endif
        ll n = inl();
        vl a(n);
        rep(i, n) cin >> a[i];

        vl sums(n);
        v<bool> add(n, false);
        for (ll i = n - 1; i >= 1; --i) {
            vl pri = divisor(i + 1);

            if ((a[i] == 1 && sums[i] % 2 != 1) || (a[i] == 0 && sums[i] % 2 == 1)) {
                add[i] = true;
                each(e, pri) {
                    sums[e - 1]++;
                }
            }
        }
        ll ss = 0;
        rep(i, n) ss += add[i];

        ll ans = 0;
        vl ansv;
        if ((a[0] == 1 && ss % 2 == 0) || (a[0] == 0 && ss % 2 != 0)) {
            ans++;
            ansv.eb(1);
        }
        for (ll i = 1; i < n; ++i) {
            if (add[i]) {
                ansv.eb(i + 1);
                ans++;
            }
        }
        cout << ans << endl;
        each(e, ansv) cout << e << " ";

#ifdef MY_DEBUG
    }
#endif
    return 0;
}

Measured memory_bytes: 5112
#include "bits/stdc++.h"

#define sp <<" "
#define el <<"\n"
#define S second
#define F first
#define mp make_pair
#define pb push_back
#define pf push_front
#define pob pop_back
#define obit __builtin_popcount
#define pof pop_front
#define For(i,a,n) for(i=a;i<n;i++)
#define all(ar) ar.begin(),ar.end() 
using namespace std;

typedef long long ll;
typedef unsigned long long ul;
typedef unsigned short int us;
typedef short int ss;
typedef long double ld;
const ll mod = 1000000007;


bool cmp(pair<int,int> a,pair<int,int> b){
    return a.S > b.S;
}

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    /*
#ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
#endif
    //*/
    ll i,n;
    cin>>n;
    ll ar[n];
    For(i,0,n) cin>>ar[i];
    map<ll,ll> oc0, oc1;
    pair<ll,ll> mx10 = {-1,0},mx11 = {-1,0},mx20 = {-1,0},mx21 = {-1,0};
    for(ll a = 0; a < n;a += 2){
        oc0[ar[a]] += 1;
    }
    for(ll a = 1; a < n;a += 2){
        oc1[ar[a]] += 1;
    }
    vector<pair<ll,ll> > vec0,vec1;
    for(auto itr = oc0.begin(); itr != oc0.end(); ++itr){
        vec0.pb(*itr);
    }
    for(auto itr = oc1.begin(); itr != oc1.end(); ++itr){
        vec1.pb(*itr);
    }
    sort(vec0.begin(),vec0.end(),cmp);
    sort(vec1.begin(),vec1.end(),cmp);
    mx10 = vec0[0];
    mx11 = vec1[0];
    if(vec0.size()>1) mx20 = vec0[1];
    if(vec1.size()>1) mx21 = vec1[1];
    //for(auto k: vec0) cout<<k.F sp<<k.S el;
    //for(auto k: vec1) cout<<k.F sp<<k.S el;
    if(mx11.F != mx10.F){
        int a = mx10.S, b = mx11.S;
        cout<<n - (a + b);
    }
    else{
        int x;
        x = max((mx10.S + mx21.S),(mx11.S + mx20.S));
        cout<< n - x;
    }
    return 0;
}

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

int main(){
  
  char In;
  cin >> In;
  
  switch(In){
    case 'A':
      cout << 'T' << endl;
      break;
    case 'C':
      cout << 'G' << endl;
      break;
    case 'G':
      cout << 'C' << endl;
      break;
    case 'T':
      cout << 'A' << endl;
      break;
    default:
      break;
  }
  return 0;
}


Measured memory_bytes: 3576
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
using static System.Math;
using static System.Array;

namespace AtCoderSolve
{
    class Solve
    {
        const int mod = 1000000007;
        const int INF = 2147483647;
        const long SINF = 9223372036854775807;

        static int N, K;
        static string[] D;
        //static string S;


        public static void Input()
        {
            var cin = new Scanner();
            var input = cin.SplitReader();
            N = input[0];
            K = input[1];
            D = Console.ReadLine().Split().ToArray();
        }

        static void Main(string[] args)
        {
            Input();
            //var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            //Console.SetOut(sw);

            for(var i = N; i <= 99999; i++)
            {
                string I = i.ToString();
                bool ok = true;
                for(var j = 0; j < I.Length; j++)
                {
                    if (D.Contains(I[j].ToString()))
                    {
                        ok = false;
                        break;
                    }
                }
                if (ok)
                {
                    Console.WriteLine(i);
                    break;
                }

            }

            
            //Console.Out.Flush();
        }

        
    }

    

    public class Scanner
    {
        public int[] SplitReader()
        {
            int[] array = Console.ReadLine().Split().Select(int.Parse).ToArray();
            return array;
        }
        public long[] SplitReaderL()
        {
            long[] array = Console.ReadLine().Split().Select(long.Parse).ToArray();
            return array;
        }

        public int[] MultiLineReader(int N)
        {
            int[] ret = new int[N];
            for(var i = 0; i < N; i++)
            {
                ret[i] = int.Parse(Console.ReadLine());
            }

            return ret;
        }
        public long[] MultiLineReaderL(int N)
        {
            long[] ret = new long[N];
            for (var i = 0; i < N; i++)
            {
                ret[i] = long.Parse(Console.ReadLine());
            }

            return ret;
        }

    }

    public class Graph
    {
        
    }
}

    



Measured memory_bytes: 13396
def b_two_arrays(N, A, B):
    import math
    operation_times = 0
    for a, b in zip(A, B):
        if a < b:
            operation_times += math.ceil((b - a) / 2)
    ans = 'Yes' if operation_times <= (sum(B) - sum(A)) else 'No'
    return ans

N = int(input())
A = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]
print(b_two_arrays(N, A, B))


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

int  main()
{
	char a,b; cin >> a >> b;
	if (a == b)
		cout << "=\n";
	else if (a < b)
		cout << "<\n";
	else
		cout << ">\n";
	return (0);
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
using namespace std;
typedef long long ll;
typedef tuple<ll,ll,ll> tp;
typedef pair<ll,int> P;
int INF = (1LL << 30) - 1;
int MOD = 1e9+7;
main(){
    int N,M;
    cin >> N >> M;
    vector<vector<ll>> V(N, vector<ll>(3));
    rep(i,0,N){
        cin >> V[i][0] >> V[i][1] >> V[i][2];
    }
    ll maxi = 0;
    rep(i,0,8){
        vector<P> vec(N);
        rep(j,0,N){
            rep(k,0,3)vec[j].first += V[j][k] * ((i & (1<<k)) ? 1 : -1);
            vec[j].second = j;
        }
        sort(vec.rbegin(), vec.rend());
        ll sum[3] = {};
        rep(j,0,M){
            int idx = vec[j].second;
            rep(k,0,3)sum[k] += V[idx][k];
        }
        maxi = max(maxi, abs(sum[0]) + abs(sum[1]) + abs(sum[2]));
    }
    cout << maxi << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>
#include<stack>
#include<queue>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<utility>
#include<cassert>

typedef long long int ll;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) for(int i=0;i<signed(n);i++)
#define EREP(i,n) for(int i=1;i<=signed(n);i++)
#define ALL(a) (a).begin(),(a).end()
using std::cout;
using std::vector;
using std::endl;
using std::cin;
using std::string;
using std::max;
using std::min;
using std::abs;
//#define EVEL 1
#ifdef EVEL
#define DEB(X) cout << #X << ":" <<X<<" " ;
#define TF(f) f ? cout<<"true  " : cout<<"false ";
#define END cout<<"\n";
#else
#define DEB(X) {}
#define TF(f) {}
#define END {}
#endif
const int MOD = 1000000007;
const ll INF = 5000000000000;
//typedef std::pair<int, int> P;
struct edge { int to;double cost; };
#define VMAX 1010

     ll N,M;
     ll A[100010],B[100010];
     ll K[11],P[11];
     ll ans;
     char S[100];
int main() {
    cin>>N>>M;
    REP(i,1100){
        float q=i;
        if(ll(q*0.08)==N&&ll(q*0.1)==M){
            cout<<i<<endl;return 0;
        }
    }
    cout<<-1;


	return 0;
}


Measured memory_bytes: 256
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int[] a = new int[3];
    a[0] = sc.nextInt();
    a[1] = sc.nextInt();
    a[2] = sc.nextInt();
    Arrays.sort(a);
    System.out.println(a[0] == a[1] ? a[2] : a[0]);
  }
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define In_The_Name_Of_Allah_The_Merciful ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define Alhamdulillah return 0;
#define all(v) v.begin(),v.end()
#define debug(n) cerr << "[" << #n << " = " << n << "]" << endl 

void Suhaib_Sawalha (){

    string s , w;
    cin >> s >> w;
    cout << w + s;

}

int main(){
                                In_The_Name_Of_Allah_The_Merciful   /* بسم الله الرحمن الرحيم  */
#ifndef ONLINE_JUDGE
    freopen("SuhaibSawalha1.txt","r",stdin);
#endif
//int _;for(cin>>_;_;--_,cout<<'\n')
        Suhaib_Sawalha();
                                         Alhamdulillah                    /* الحمد لله */
}

Measured memory_bytes: 3632
n = int(input())
p = list(map(int, input().split()))

ans = 0

for i in range(n-2):
    now_p = [p[i], p[i+1], p[i+2]]
    if now_p[1] != max(now_p) and now_p[1] != min(now_p):
        ans += 1
        
print(ans)

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

public class Main {
    public static void main(String[] args) throws Exception {
        Reader sc = new Reader();
        PrintWriter pw = new PrintWriter(System.out);
        
        try {
            int n = sc.nextInt();
            int[] a = new int[n];
            for(int i=0 ; i<n ; i++) {
                a[i] = sc.nextInt();
            }

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

            if(gcd == 1) {
                int m = 1_000_000;
                int[] lf = lf(m);
                boolean[] pres = new boolean[m+1];
                boolean pc = true;
                for(int i=0 ; i<n ; i++) {
                    int x = a[i];
                    TreeSet<Integer> ts = new TreeSet<>();
                    while(x != 1) {
                        int elem = lf[x];
                        ts.add(elem);
                        x /= lf[x];
                    }
                    for(int elem: ts) {
                        if(pres[elem]) {
                            pc = false;
                            break;
                        }
                        else {
                            pres[elem] = true;
                        }
                    }
                }

                if(pc) {
                    pw.println("pairwise coprime");
                }
                else {
                    pw.println("setwise coprime");
                }
            }
            else {
                pw.println("not coprime");
            }
        }
        finally {
            pw.flush();
            pw.close();
        }
    }

    static int[] lf(int n) {
        int[] lf = new int[n+1];
        for(int i=1 ; i<=n ; i++) {
            lf[i] = i;
        }
        for(int i=2 ; i<=n ; i++) {
            if(lf[i] == i) {
                for(int j=2*i ; j<=n ; j+=i) {
                    if(lf[j] == j) {
                        lf[j] = i;
                    }
                }
            }
        }
        return lf;
    }

    static int gcd(int a, int b) {
        return b == 0 ? a : gcd(b, a%b);
    }
    
    static class Reader {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer("");

        String next() {
            while(!st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                }
                catch(IOException io) {
                    io.printStackTrace();
                }
            }
            return st.nextToken();
        }

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

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


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

using namespace std;

#define el				'\n'
#define sz(v)			((int)((v).size()))
#define all(v)          ((v).begin()),((v).end())
#define clr(v, d)		memset(v, d, sizeof(v))

double const EPS = 1e-8, PI = acos(-1);
const int N = 1e5 + 9, M = 50 + 9, OO = (int) 1e9 + 1;
const long long MOD = 1e9 + 7;

typedef long long ll;

void OUTPUT() {
	cout << fixed << setprecision(12);
	ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
}

void INPUT() {
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
#endif
	cout << fixed << setprecision(0);
//	ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
}

int n, m, x, y, vis[N], ans;
vector<vector<int>> edges(N);

int DFS(int node) {
	if (vis[node] != -1)
		return vis[node];
	vis[node] = 0;
	for (auto child : edges[node]) {
		DFS(child);
		vis[node] = max(vis[node], vis[child] + 1);
	}
	return 0;
}

int main() {
//	INPUT();
	OUTPUT();
	clr(vis, -1);
	cin >> n >> m;
	for (int i = 0; i < m; ++i) {
		cin >> x >> y;
		edges[x].push_back(y);
	}
	for (int j = 1; j <= n; j++) {
		DFS(j);
	}
	for (int i = 1; i <= n; i++) {
		ans = max(ans, vis[i]);
	}
	cout << ans;

	return 0;

}


Measured memory_bytes: 8192
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <algorithm>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <functional>
#include <iomanip>
#define vll vector<ll>
#define vvvl vector<vvl>
#define vvl vector<vector<ll>>
#define VV(a, b, c, d) vector<vector<d>>(a, vector<d>(b, c))
#define VVV(a, b, c, d) vector<vvl>(a, vvl(b, vll (c, d)));
#define re(c, b) for(ll c=0;c<b;c++)
#define all(obj) (obj).begin(), (obj).end()
typedef long long int ll;
typedef long double ld;
using namespace std;


#define P 998244353
#define N_MAX 10000000
typedef long long int ll;
ll fac[N_MAX+1];
ll inv[N_MAX+1];
ll finv[N_MAX+1];

ll comb(ll n, ll k){
  if(n<0||k<0||n<k) return 0;
  return (((fac[n]*finv[n-k])%P)*finv[k])%P;
}
ll perm(ll n, ll k){
  if(n<0||k<0||n<k) return 0;
  return (fac[n]*finv[n-k])%P;
}

void init(){
  fac[0] = finv[0] = fac[1] = finv[1] = inv[1] = 1;
  for(int i = 2; i <= N_MAX; i++){
    fac[i] = (fac[i-1]*i)%P;
    inv[i] = ((-(P/i)*inv[P%i])%P+P)%P;
    finv[i] = (finv[i-1]*inv[i])%P;
  }
}
ll pp(ll a, ll b){
  return (a * b)%P;
}
//凸包Sのスコア = N個の点のうちSの内部に含まれる個数kに対し2^k
// = N個のうちの部分集合Sについて内部の部分集合k個から任意個選ぶパターン
// = 2^Nのうち、凸包を作ることのできる部分集合の選び方

ll gcd(ll a, ll b){
  if(b<a) swap(a, b);
  ll r = a % b;
  if(r==0) return b;
  while(r!=0) r = a % b, a = b, b = r;
  return a;
}
ll lcm(ll a, ll b){return (a*b)/gcd(a, b);}
vll extgcd(ll a, ll b) {
  ll x, y;
  for (ll u = y = 1, v = x = 0; a;) {
    ll q = b / a;
    swap(x -= q * u, u);
    swap(y -= q * v, v);
    swap(b -= q * a, a);
  }
  return vll{x, y, b};
}

typedef pair<ll, ll> p;
int main(int argc, char const *argv[]) {
  // sample1 2^4 - 1(0個) - 4C2(直線) - 4(1点)
  // sample2 2^5 - 1 - 5C2 - 5 - 4C3 - 4C4
  // = 32 - 1 - 10 - 5 - 4 - 1 = 11
  // sample3 2^1 - 1 - 1

  init();
  ll n;std::cin >> n;
  vll t(300, 1);// 2^k
  for(int i=1;i<300;i++) t[i] = (t[i-1]*2)%P;
  ll all = t[n];
  ll sub = 1 + n; //条件を満たさないもの(0点, 1点, 直線)

  vvl d = VV(n, 2, 0, ll);
  for(int i=0;i<n;i++) scanf("%lld %lld", &d[i][0], &d[i][1]);

  // ある点からある別の点までの方向に他の頂点があるかを確認する
  // 他の点に注目した時も含めK回カウントされる

  vll f(201, 0);//点をK個含む線がいくつあるか

  for(int i=0;i<n;i++){
    //他の点への角度を求める
    map<p, ll> mp;
    for(int j=0;j<n;j++){
      if(j==i) continue;
      ll dx = d[i][0] - d[j][0];
      ll dy = d[i][1] - d[j][1];
      if(dx<0) dx*=-1, dy*=-1;

      if(dx==0) dy = 1;
      else if(dy==0) dx = 1;
      else{
        ll g = gcd(abs(dx), abs(dy));
        dx /= g, dy /= g;
      }
      //std::cout << i << " " << j << " " << "(" << dx << ", " << dy << ")" << '\n';
      auto itr = mp.find(p(dx, dy));
      if(itr==mp.end()) mp.emplace(p(dx, dy), 2);
      else (*itr).second++;
    }
    for(auto itr:mp) f[itr.second]++;
  }
  for(ll i=2;i<=n;i++) f[i]/=i;
  //for(ll i=2;i<=n;i++) std::cout << i << " " << f[i] << '\n';

  for(int i=2;i<=n;i++){
    for(int j=2;j<=i;j++){
      sub = (sub + pp(f[i], comb(i, j)))%P;
    }
  }
  std::cout << (all - sub + P)%P << '\n';
  return 0;
}


Measured memory_bytes: 237608
#include <iostream>
#include <vector>
#include <utility>
#include <map>
#include <algorithm>
#include <queue>
#include <cmath>

using namespace std;

int main() {
    int n,k;
    int ans = 0;
    cin >> n >> k;

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

    vector<int> ball;
    for (auto b : mp) {
        ball.push_back(b.second);
    }

    sort(ball.rbegin(), ball.rend());

    int cnt = 0;
    for (auto b : ball) {
        cnt++;
        if (cnt <= k) continue;
        ans += b;
    }

    cout << ans << endl;
}

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

using namespace std;

const int N = 105;
long long memo[N][2][4];
string s;

long long solve (int i , bool less , int rem) {
    if (rem == 0)
        return 1;

    if (i == s.size())
        return 0;

    long long &ret = memo[i][less][rem];
    if (~ret)
        return ret;

    ret = 0;

    int r = less ? 9 : s[i];
    for (int d = 0 ; d <= r ; d++)
        ret += solve(i + 1 , less || (d < s[i] ), rem - (d != 0));

    return ret;
}

int main() {
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#ifndef ONLINE_JUDGE
    freopen("input.in" , "r" , stdin);
#endif
    int k;
    cin >> s >> k;

    for (char &c : s)
        c -= '0';

    memset(memo , -1 , sizeof memo);
    cout << solve(0 , 0 , k);
}

Measured memory_bytes: 3660
#! /usr/bin/env python3

import sys
import numpy as np
int1 = lambda x: int(x) - 1
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

N, K, *A = map(int, read().split())

for i in range(N - K):
    if A[i] < A[i + K]:
        print("Yes")
    else:
        print("No")


Measured memory_bytes: 46136
MOD = 10**9 + 7

def prod(a):
    res = 1
    for x in a:
        res = (res * x) % MOD
    return res

def solve(n, k, a):
    if k == 1:
        return max(a)
    elif k == n:
        return prod(a)
    elif (max(a) < 0) and (k % 2 == 1):
        a = sorted(a, reverse=True)
        return prod(a[:k])
    else:
        a = sorted(a, key=lambda x: -abs(x))
        num_negative = len(list(filter(lambda x: x < 0, a[:k])))
        if num_negative % 2 == 0:
            return prod(a[:k])
        else:
            i1, j1 = None, None
            for i in range(k):
                if a[i] < 0:
                    i1 = i
            for j in range(k,n):
                if a[j] >= 0:
                    j1 = j
                    break
            i2, j2 = None, None
            for i in range(k):
                if a[i] >= 0:
                    i2 = i
            for j in range(k, n):
                if a[j] < 0:
                    j2 = j
                    break
            if (i1 is None) or (j1 is None):
                return prod(a[:i2] + a[i2+1:k] + [a[j2]])
            elif (i2 is None) or (j2 is None):
                return prod(a[:i1] + a[i1+1:k] + [a[j1]])
            elif abs(a[j1] * a[i2]) > abs(a[i1] * a[j2]):
                return prod(a[:i1] + a[i1+1:k] + [a[j1]])
            else:
                return prod(a[:i2] + a[i2+1:k] + [a[j2]])

n, k = map(int, input().split())
a = list(map(int, input().split()))
print(solve(n, k, a))



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

int main(){
  int N, M;
  vector<pair<int,int>> AB(100010, make_pair(1e8, 1e8));

  cin >> N >> M;
  for(int i=0; i<N; i++) cin >> AB[i].first >> AB[i].second;
  sort(AB.begin(), AB.begin()+N);

  priority_queue<int> Q;

  int ans = 0, id = 0;
  for(int i=1; i<=M; i++){
    if(AB[id].first > i) {
      if(!Q.empty()){
        ans += Q.top();
        //cout << Q.top() << endl;
        Q.pop();
      }
      continue;
    }

    while(AB[id].first <= i){
      Q.push(AB[id].second); id++;
      //cout << i << " " << id << endl;
    }

    ans += Q.top(); //cout << Q.top() << endl;
    Q.pop();
  }

  cout << ans << endl;
}

Measured memory_bytes: 1788
A=abs;n=int(input());p=eval('list(map(int,input().split())),'*n);x,y,h=[x for x in p if x[2]][0]
for I in range(10201):j,i=I//101,I%101;H=h+A(x-j)+A(y-i);print(*(j,i,H)*all(u==max(H-A(s-j)-A(t-i),0)for s,t,u in p))

Measured memory_bytes: 3928
#include <bits/stdc++.h>
#include <vector>
#include <numeric>
#define PI 3.14159265358979323846
#define MAXINF 1e18L
#define INF 1e9L
#define EPS 1e-9
#define REP(i, n) for(int i=0;i<int(n);++i)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define ALL(v) v.begin(),v.end()
#define SORT(v) sort(ALL(v))
#define RSORT(v) sort(ALL(v));reverse(ALL(v))
#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl
#define Yes(n) cout<<((n)?"Yes":"No")<<endl
#define pb push_back
using namespace std;
template<class A>void pr(A a){cout << (a) << endl;}
template<class A,class B>void pr(A a,B b){cout << a << " "  ;pr(b);}
template<class A,class B,class C>void pr(A a,B b,C c){cout << a << " " ;pr(b,c);}
template<class A,class B,class C,class D>void pr(A a,B b,C c,D d){cout << a << " " ;pr(b,c,d);}
typedef long long ll;
typedef pair<int, int> pii;

int main(void)
{
    string s;
    cin >> s;
    int ans = 0;
    REP(i, s.size()){
        if(s[i]=='+')ans++;
        else ans--;
    }
    pr(ans);
}

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

using namespace std;

int d(int x) {
	int ret = 0;
	while (x > 0) {
		++ret;
		x /= 10;
	}
	return ret;
}

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

	int res = 0;
	for (int i = 1; i <= N; ++i) {
		if (d(i) % 2 == 1) { ++res; }
	}
	cout << res << endl;

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep2(i, m, n) for(int i=int(m); i<int(n); i++)
#define rep(i, n) rep2(i, 0, n)
#define ALL(a) a.begin(), a.end()
using ll = long long;
using ld = long double;
using V = vector<int>;
using Vll = vector<ll>;
using Vld = vector<ld>;
using VV = vector<V>;
using VVll = vector<Vll>;
using VVld = vector<Vld>;
using P = pair<int, int>;
using Pll = pair<ll, ll>;
using Pld = pair<ld, ld>;
const int INF = int(1e9)+10;
const ll INFll = ll(1e18)+10;
const ld EPS = 1e-10;
const int MOD = int(1e9)+7;

int main() {
	string S; cin >> S;
	int N = S.size();

	bool ok = true;
	if (S[0] == '0') ok = false;
	if (S[N-1] != '0') ok =false;
	rep(i, (N-1)/2) {
		if (S[i] != S[N-i-2]) ok = false;
	}
	if (!ok) {
		cout << -1 << endl;
		return 0; 
	}

	int vto = 1;
	rep2(i, 2, N+1) {
		cout << i << " " << vto << endl;
		if (S[i-2] == '1') vto = i;
	}
	return 0;
}


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

int main(){
  int k;
  cin>>k;
  int a=7;
  rep(i,k){
    if(a%k==0){
      cout<<i+1<<endl;
      return 0;
    }
    a=(a*10+7)%k;
  }
  cout<<-1<<endl;
  return 0;
}


Measured memory_bytes: 3604
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <array>
#include <cassert>
#include <utility>
#include <vector>
#include <atcoder/all>

template <class InputIterator>
std::ostream& range_output(std::ostream& os_arg, InputIterator first_arg, InputIterator last_arg){ if(first_arg != last_arg){ do{ os_arg << *(first_arg++); if(first_arg == last_arg) break; os_arg << ' '; } while(true); }  return os_arg; }
template <class Tp> std::ostream& operator << (std::ostream& os_arg, const std::vector<Tp>& arr_arg){ return range_output(os_arg, arr_arg.cbegin(), arr_arg.cend()); }
template <class Tp, std::size_t Size> std::ostream& operator << (std::ostream& os_arg, const std::array<Tp, Size>& arr_arg){ return range_output(os_arg, arr_arg.cbegin(), arr_arg.cend()); }
template <class S, class T> std::ostream& operator << (std::ostream& os_arg, const std::pair<S, T>& pair_arg){ return os_arg << '(' << pair_arg.first << ", " << pair_arg.second << ')'; }

#ifndef ONLINE_JUDGE
    template <typename Head> void dump_out(Head head_arg){ std::cerr << head_arg << '\n'; }
    template <typename Head, typename... Tail>
    void dump_out(Head head_arg, Tail... tail_args){ std::cerr << head_arg << ", "; dump_out(tail_args...); }
    #define dump(...) do { std::cerr << "[in line " << __LINE__ << "] " << #__VA_ARGS__ << " : "; dump_out(__VA_ARGS__); } while(false)
#else
    #define dump(...) (void(0))
#endif


int main(void){
    std::cin.tie(nullptr); std::ios_base::sync_with_stdio(false); 
    std::cout << std::fixed << std::setprecision(16);

    int n, m; std::cin >> n >> m;
    std::vector<long long int> A(n), B(m);
    for(auto& itr : A) std::cin >> itr;
    for(auto& itr : B) std::cin >> itr;
    const auto res = atcoder::convolution<998244353>(A, B);
    std::cout << res << '\n';
    return 0;
}

Measured memory_bytes: 27260
#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>
#include <iomanip>
int main()
{
    long H,W;
    std::cin >> H >> W;
    std::string s[52][52];
    for(long i=0; i<=H+1; i++){
        for(long j=0; j<=W+1; j++){
            s[i][j]=".";
        }
    }
    for(long i=1; i<=H; i++){
        std::string temp;
        std::cin >> temp;
        for(long j=1; j<=W; j++){
            s[i][j]=temp[j-1];
        }
    }
    int flag=1;
    for(long i=1; i<=H; i++){
        for(long j=1; j<=W; j++){
            if(s[i][j]=="#"){
                if(s[i-1][j]!="#" && s[i+1][j]!="#" 
                && s[i][j-1]!="#" && s[i][j+1]!="#"){
                    flag=0;
                    break;
                }
            }
        }
        if(flag==0){
            break;
        }
    }
    if(flag==1){
        std::cout << "Yes" << std::endl;
    }else{
        std::cout << "No" << std::endl;
    }
    return 0;
}

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

string S;

int main() {
    cin >> S;

    // 先頭、末尾が同じ文字列であるか？
    bool same_value = false;
    if (S[0] == S[S.length() - 1]) same_value = true;

    // 文字列長さが偶数であるか？
    bool even_length = false;
    if (S.length() % 2 == 0) even_length = true;

    string winner = "First";
    if (even_length == true && same_value == false) winner = "Second";
    if (even_length == false && same_value == true) winner = "Second";

    cout << winner << endl;
    return 0;
}

Measured memory_bytes: 512
N = int(input())
a = [1, 6, 6**2, 6**3, 6**4, 6**5, 6**6, 9, 9**2, 9**3, 9**4, 9**5]
a.sort()
dp = [10**6]*160000
for i in a:
    dp[i] = 1
for i in range(1, N+1):
    for j in a:
        dp[i+j] = min(dp[i]+1, dp[i+j])
print(dp[N])

Measured memory_bytes: 4212
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <iomanip>

using namespace std;

// Graph
struct UsedEdge{
    int nextNode;
    bool used;
    int invIndex;
};

class UsedEdgeGraph{
public:
    vector<vector<UsedEdge>> E;

    UsedEdgeGraph(int n){
        E.resize(n);
    }

    void add(int node, int nextNode){
        E[node].emplace_back((UsedEdge){nextNode, false, (int)E[nextNode].size()});
        E[nextNode].emplace_back((UsedEdge){node, false, (int)E[node].size() - 1});
    }
};

// lowlink
class Lowlink{
public:
    vector<int> ord, low;
    vector<vector<int>> dfsTree;
    int root;
    
    Lowlink(vector<vector<UsedEdge>>& E, int root){
        int n = (int)E.size();
        this->root = root;
        ord.assign(n, -1);
        low.resize(n);
        dfsTree.resize(n);

        tempOrd = 0;
        dfs(E, root);
    }

    bool isBridge(int u, int v){
        if(ord[u] < low[v]){
            return true;
        }
        else{
            return false;
        }
    }

    bool isPoint(int node){
        if(node == root){
            if((int)dfsTree[node].size() > 1){
                return true;
            }
            else{
                return false;
            }
        }
        else{
            for(int nextNode: dfsTree[node]){
                if(ord[node] <= low[nextNode]){
                    return true;
                }
            }
            return false;
        }   
    }

private:
    int tempOrd;

    void dfs(vector<vector<UsedEdge>>& E, int node){
        ord[node] = tempOrd;
        tempOrd++;
        low[node] = ord[node];
        for(auto& e: E[node]){
            if(ord[e.nextNode] == -1){
                e.used = true;
                E[e.nextNode][e.invIndex].used = true;
                dfsTree[node].push_back(e.nextNode);

                dfs(E, e.nextNode);
                low[node] = min(low[node], low[e.nextNode]);
            }
            else if(!e.used){
                low[node] = min(low[node], ord[e.nextNode]);
            }
        }
    }
};

int main(){

    int V, E;
    cin >> V >> E;
    UsedEdgeGraph graph(V);
    
    int s, t;
    for(int i = 0; i < E; i++){
        cin >> s >> t;
        graph.add(s, t);
    }

    Lowlink lowlink(graph.E, 0);

    vector<int> ans;
    for(int i = 0; i < V; i++){
        if(lowlink.isPoint(i)){
            ans.push_back(i);
        }
    }

    for(int temp: ans){
        cout << temp << endl;
    }

    return 0;
}


Measured memory_bytes: 5600
def solve():
    n = int(input())
    cards = list(map(int, input().split()))
    cards = sorted(cards, reverse=True)
    alice, bob = 0, 0
    for i in range(len(cards)):
        if i % 2 == 0:
            alice += cards[i]
        else:
            bob += cards[i]
    print(alice - bob)


solve()

Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <cmath>
#include <iomanip>
#include <bitset>
#include <string>
#include <stdlib.h>
using namespace std;
//cout <<  << endl;
typedef long long int ll;
typedef long double ld;

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

#define MAX_N 110
#define MAX_V 100100
const long long INF = 1LL << 60;

//境界値に注意！！！

// DP テーブル
ll dp[MAX_N][MAX_V];

int main (){
    ll n,w;
    cin >> n >> w;
    ll weight[MAX_N],value[MAX_N];
    for (ll i=0;i<n;i++)cin >> weight[i] >> value[i];
    for (ll i=0;i<MAX_N;++i)for (ll j=0;j<MAX_V;++j)dp[i][j]=INF;
    dp[0][0]=0;
    for (ll i=0;i<n;i++){
        for (ll sum_v=0;sum_v<MAX_V;sum_v++){
            if (sum_v-value[i]>=0){
                chmin(dp[i+1][sum_v],dp[i][sum_v-value[i]]+weight[i]);
            }
            chmin(dp[i+1][sum_v],dp[i][sum_v]);
        }
    }
    ll ans=0;
    for (ll i=0;i<MAX_V;++i){
        if(dp[n][i]<=w){
            ans=i;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 86400
#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e18;

int main() {
    int n;
    cin >> n;
    vector<long long> a(n), sum(n+1, 0);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        sum[i+1] = sum[i] + a[i];
    }
    
    auto bs = [&](int i)->long long {
        int l = 0, r = i-1;
        long long value = sum[i] / 2;
        while (abs(l - r) > 1) {
            int m = (l + r) / 2;
            if (sum[m] < value) l = m;
            else r = m;
        }
        long long vl = sum[l], vr = sum[r];
        long long nl = sum[i] - sum[l], nr = sum[i] - sum[r];
        if (abs(nl - vl) > abs(nr - vr)) return vr;
        else return vl;
    };
    auto bss = [&](int i) {
        int l = i+1, r = n-1;
        long long value = sum[i] + (sum[n] - sum[i]) / 2;
        while (abs(l - r) > 1) {
            int m = (l + r) / 2;
            if (sum[m] < value) l = m;
            else r = m;
        }
        long long vl = sum[l] - sum[i], vr = sum[r] - sum[i];
        long long nl = sum[n] - sum[l], nr = sum[n] - sum[r];
        if (abs(nl - vl) > abs(nr - vr)) return vr;
        else return vl;
    };
    
    long long ans = INF;
    for (int i = 2; i < n-1; i++) {
        long long b = bs(i), c = sum[i] - b;
        long long d = bss(i), e = sum[n] - (b + c + d);
        long long f = max({b, c, d, e}) - min({b, c, d, e});
        if (ans > f) ans = f;
    }
    
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3328
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <ctime>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>

using namespace std;

#ifdef _MSC_VER
#define __typeof__ decltype

template <class T>
int __builtin_popcount(T n) { return n ? 1 + __builtin_popcount(n & (n - 1)) : 0; }
#endif

#define foreach(it, c) for (__typeof__((c).begin()) it=(c).begin(); it != (c).end(); ++it)
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define popcount __builtin_popcount

template <class T> void max_swap(T& a, const T b) { a = max(a, b); }
template <class T> void min_swap(T& a, const T b) { a = min(a, b); }

const double EPS = 1e-10;
typedef long long ll;
typedef pair<int, int> pint;


int main()
{
	int h, w, n;
	while (scanf("%d%d%d", &h, &w, &n), h | w | n)
	{
		static bool east[1024][1024];
		for (int i = 0; i < h; ++i)
		{
			for (int j = 0; j < w; ++j)
			{
				int t;
				scanf("%d", &t);
				east[i][j] = t == 1;
			}
		}

		static int visit[1024][1024];
		memset(visit, 0, sizeof(visit));
		visit[0][0] = --n;
		for (int i = 0; i < h; ++i)
		{
			for (int j = 0; j < w; ++j)
			{
				int a = visit[i][j] / 2, b = (visit[i][j] + 1) / 2;
				if (east[i][j])
					swap(a, b);
				visit[i][j + 1] += a;
				visit[i + 1][j] += b;

				east[i][j] ^= visit[i][j] & 1;
			}
		}

		int x, y;
		x = y = 0;
		while (x < w && y < h)
		{
			if (east[y][x])
				++x;
			else
				++y;
		}
		printf("%d %d\n", ++y, ++x);
	}
}

Measured memory_bytes: 5980
A, B, C = map(int, input().split())

week = C // (7 * A + B)
coin = week * (7 * A + B)

day = week * 7

if (C - coin) / A < 7 :
    day += (C - coin) // A
    coin += (C - coin) // A * A
    
    if coin != C :
        day += 1
        
else :
    day += 7
    coin += 7 * A + B
    
    if coin < C :
        day += 1
        
print(day)


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

int main() {
    long long int N, K;
    cin >> N >> K;
    if(N == 0) {
        cout << 0 << endl;
        return 0;
    }
    N %= K;
    while(true) {
        if(N > abs(N - K)) {
            N = abs(N - K);
        } else {
            break;
        }
    }
    cout << N << endl;
}

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

int A;
int B;
int C;
int X;
int Y;
int ans;

void solve() {
  if (X > Y) {
    ans = min(A*Y+B*Y, 2*C*Y) + min(A*(X-Y), 2*C*(X-Y));
  } else {
    ans = min(A*X+B*X, 2*C*X) + min(B*(Y-X), 2*C*(Y-X));
  }
  cout << ans << endl;
}

int main() {
  cin >> A >> B >> C >> X >> Y;
  solve();
}

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

struct StaticUnion {
  vector<int> parents, ranks;
  StaticUnion(int n) : parents(n), ranks(n) {
  iota(parents.begin(), parents.end(), 0);
  }
  int find(const int& x) {
  if (x != parents[x])
  parents[x] = find(parents[x]);
  return parents[x];
  }
  void unite(const int& x, const int& y) {
  int px(find(x)), py(find(y));
  if (px == py) return;
  ranks[px] >= ranks[py] ? parents[py] = px : parents[px] = py;
  if (ranks[px] == ranks[py]) ranks[px]++;
  }
};


int main() {
    int n, m, x, y, ans(0);
    cin >> n >> m;
    StaticUnion uf(n);
    unordered_map<int, int> mp;
    for (int i = 0; i < m; ++i) {
        cin >> x >> y;
        uf.unite(x, y);
    }
    for (int i = 0; i < n; ++i) {
        ans = max(ans, ++mp[uf.find(i)]);
    }
    cout << ans << endl;
    return 0;
};


Measured memory_bytes: 12804
#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b; cin >> a >> b;
  if (a == b) cout << "Draw" << endl;
  else if (a == 1 || (b != 1 && a > b)) cout << "Alice" << endl;
  else cout << "Bob" << endl;
  return 0;
}

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

typedef long long ll;
#define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i)
#define ALL(v) (v).begin(),(v).end()
#define CLR(t,v) memset(t,(v),sizeof(t))
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>&a){return os<<"("<<a.first<<","<<a.second<< ")";}
template<class T>void pv(T a,T b){for(T i=a;i!=b;++i)cout<<(*i)<<" ";cout<<endl;}
template<class T>void chmin(T&a,const T&b){if(a>b)a=b;}
template<class T>void chmax(T&a,const T&b){if(a<b)a=b;}

int nextInt() { int x; scanf("%d", &x); return x;}
ll nextLong() { ll x; scanf("%lld", &x); return x;}

int main2() {
  int N = nextInt();

  bool ans = false;
  for (int x = 1; x <= 9; x++) {
    for (int y = 1; y <= 9; y++) {
      if (N == x * y) {
        ans = true;
      }
    }
  }
  cout << (ans?"Yes":"No") << endl;
  return 0;
}

int main() {

#ifdef LOCAL
  for (;!cin.eof();cin>>ws)
#endif
    main2();
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
#define maxn 1001

int lac(string x, string y) {
	int c[maxn][maxn];
	int m = x.size();
	int n = y.size();
	int maxl = 0;
	x = ' ' + x;
	y = ' ' + y;

	for (int i = 0; i <= m; i++) c[i][0] = 0;
	for (int j = 1; j <= n; j++) c[0][j] = 0;
    
	for (int i = 1; i <= m; i++) {
		for (int j = 1; j <= n; j++) {
			if (x[i] == y[j]) {
				c[i][j] = c[i - 1][j - 1] + 1;
			}
			else {
				c[i][j] = max(c[i - 1][j], c[i][j - 1]);
			}
			maxl = max(maxl, c[i][j]);
		}
	}
	return maxl;
}

int main()
{
	int n;
	cin >> n;
	string x, y;
	for (int i = 0; i < n; i++) {
		cin >> x;
		cin >> y;
		cout << lac(x, y) << endl;
	}
	return 0;
}


Measured memory_bytes: 7052
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <climits>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#define int long long
#define FIO ios_base::sync_with_stdio(false);cin.tie(NULL)
using namespace std;
int mod = 1e9+7;

int32_t main(){
    map<int,int> m;

    int x, n;
    cin>>x>>n;

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

    int ans = INT_MAX;
    int k = -200;
    for(int i = -200; i <= 200; i++){
       if(m.find(i)==m.end()){
            int diff = abs(i-x);
            if(ans > diff){
                ans = diff;
                k = i;
            }
       } 
    }

    cout<<k<<"\n";
    return 0;
}

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

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

  int max_h;
  cin >> max_h;

  int count = 1;

  for (int i = 1; i < N; i++) {
    int h;
    cin >> h;

    if (h >= max_h) {
      count++;
      max_h = h;
    }
  }

  cout << count << endl;
}

Measured memory_bytes: 256
import math
ls = [int(input()) for i in range(5)]
ls1 = []
for i in range(5):
    ls1.append(ls[i]%10)
for i in range(5):
    if ls1[i] == 0:
        ls1[i] = 10
a = min(ls1)
b = ls1.index(a)
c = 0
for i in range(5):
    if not i == b:
        c += math.ceil(ls[i]/10)*10
c += ls[b]
print(c)

Measured memory_bytes: 3064
using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    static void Main(string[] args)
    {
        var N = sc.ReadInt();
        var W = sc.ReadStrArray(N);
        var c = W[0].Last();
        var map = new HashMap<string, int>();
        map[W[0]]++;
        var ok = true;
        for (int i = 1; i < N; i++)
        {
            if (c != W[i].First() || map[W[i]] > 0)
            {
                ok = false;
                break;
            }
            c = W[i].Last();
            map[W[i]]++;
        }
        Console.WriteLine(ok ? "Yes" : "No");
    }
    static Scanner sc = new Scanner();
}

class Scanner
{
    string[] S = new string[0];
    int Index = 0;
    char[] Separators = new char[] { ' ' };

    public string Next()
    {
        if (this.Index < this.S.Length) return this.S[this.Index++];
        var line = "";
        while (line == "") line = Console.ReadLine();
        this.S = line.Split(this.Separators, StringSplitOptions.RemoveEmptyEntries);
        if (this.S.Length == 0) return this.Next();
        this.Index = 0;
        return this.S[this.Index++];
    }
    public string ReadStr()
    {
        return this.Next();
    }
    public char ReadChar()
    {
        return this.Next()[0];
    }
    public int ReadInt()
    {
        return int.Parse(this.Next());
    }
    public uint ReadUInt()
    {
        return uint.Parse(this.Next());
    }
    public long ReadLong()
    {
        return long.Parse(this.Next());
    }
    public double ReadDouble()
    {
        return double.Parse(this.Next());
    }
    public int[] ReadIntArray(int n)
    {
        var array = new int[n];
        for (int i = 0; i < array.Length; i++)
        {
            array[i] = this.ReadInt();
        }
        return array;
    }
    public long[] ReadLongArray(int n)
    {
        var array = new long[n];
        for (int i = 0; i < array.Length; i++)
        {
            array[i] = this.ReadLong();
        }
        return array;
    }
    public double[] ReadDoubleArray(int n)
    {
        var array = new double[n];
        for (int i = 0; i < array.Length; i++)
        {
            array[i] = this.ReadDouble();
        }
        return array;
    }
    public char[] ReadCharArray(int n)
    {
        var array = new char[n];
        for (int i = 0; i < array.Length; i++)
        {
            array[i] = this.ReadChar();
        }
        return array;
    }
    public string[] ReadStrArray(int n)
    {
        var array = new string[n];
        for (int i = 0; i < array.Length; i++)
        {
            array[i] = this.ReadStr();
        }
        return array;
    }
}

class HashMap<K, V> : Dictionary<K, V> where V : new()
{
    private V DefaltValue = new V();
    public HashMap() { }
    public HashMap(V defaultValue)
    {
        this.DefaltValue = new V();
    }
    new public V this[K i]
    {
        get
        {
            V v;
            return TryGetValue(i, out v) ? v : base[i] = this.DefaltValue;
        }
        set { base[i] = value; }
    }
}

Measured memory_bytes: 11348
use proconio::{fastout, input};

#[fastout]
fn main() {
    input! {
        n: usize,
        l: [usize; n]
    }

    let mut cnt = 0;
    for a in 0..l.len() {
        let b_start = a + 1;
        for b in b_start..l.len() {
            let c_start = b + 1;
            for c in c_start..l.len() {
                if l[a] + l[b] > l[c]
                    && l[b] + l[c] > l[a]
                    && l[c] + l[a] > l[b]
                    && l[a] != l[b]
                    && l[a] != l[c]
                    && l[b] != l[c]
                {
                    cnt += 1;
                }
            }
        }
    }

    println!("{}", cnt);
}


Measured memory_bytes: 2148
#include <iostream>
#include <string>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <list>
#include <iomanip>
#include <vector>
#include <functional>
#include <algorithm>
#include <cstdio>
#include <random>
#include <ctime>
#include <cstdlib>
#include <unordered_map>
#include <string.h>
#include <iostream>

using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(begin, i, end) for (int i = begin; i < (int)(end); i++)
#define all(v) v.begin(), v.end()
const int MOD = 1000000007;

int main()
{
    int H, W;
    cin >> H >> W;
    vector<vector<char> > S(H + 2, vector<char>(W + 2, '.'));
    rep(1, i, H + 1)
    {
        rep(1, j, W + 1)
        {
            cin >> S.at(i).at(j);
        }
    }
    vector<int> dx(8), dy(8);
    dx = {1, 0, -1, 0, 1, 1, -1, -1};
    dy = {0, 1, 0, -1, 1, -1, 1, -1};
    int count;
    rep(1, i, H + 1)
    {
        rep(1, j, W + 1)
        {
            if (S.at(i).at(j) == '.')
            {
                count = 0;
                rep(0, k, 8)
                {
                    if (S.at(i + dx.at(k)).at(j + dy.at(k)) == '#')
                    {
                        count++;
                    }
                }
                S.at(i).at(j) = (char)('0' + count);
            }
            cout << S.at(i).at(j);
        }
        cout << endl;
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<iomanip>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long ll;
// typedef long  l;
typedef pair<int,int> P;
const int INF=10000001;
const double PI=3.141592653589;


int main(){
  int n; cin>>n;
  int ans;
  for(int i=100;i<1000;i++){
    int a=i/100;
    int b=(i%100)/10;
    int c=i%10;
    if(i>=n&&(a==b&&b==c)){
      ans=i;
      break;
    }
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256