akhauriyash/Code-Regression huggingface dataset:
import sys
sys.setrecursionlimit(4100000)

import math

import logging

logging.basicConfig(level=logging.DEBUG)

logger = logging.getLogger(__name__)


def resolve():
    # S = [x for x in sys.stdin.readline().split()][0]  # 文字列 一つ
    # N = [int(x) for x in sys.stdin.readline().split()][0]  # int 一つ
    N, K = [int(x) for x in sys.stdin.readline().split()]  # 複数int
    h_list = [int(x) for x in sys.stdin.readline().split()]  # 複数int

    # grid = [list(sys.stdin.readline().split()[0]) for _ in range(N)]  # 文字列grid
    # grid = [[int(x) for x in sys.stdin.readline().split()]
    #         for _ in range(N)]  # int grid

    logger.debug('{}'.format([]))

    h_list = sorted(h_list, reverse=True)

    if len(h_list) <= K:
        print(0)
    else:
        print(sum(h_list[K:]))


if __name__ == "__main__":
    resolve()

# AtCoder Unit Test で自動生成できる, 最後のunittest.main は消す
# python -m unittest template/template.py で実行できる
# pypy3 -m unittest template/template.py で実行できる

import sys
from io import StringIO
import unittest


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """3 1
4 1 5"""
        output = """5"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """8 9
7 9 3 2 3 8 4 6"""
        output = """0"""
        self.assertIO(input, output)

    def test_入力例_3(self):
        input = """3 0
1000000000 1000000000 1000000000"""
        output = """3000000000"""
        self.assertIO(input, output)




Measured memory_bytes: 27008
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
typedef long long ll;
int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int n;
  cin>>n;
  vector<double> a(n);
  double ans=0.0;
  rep(i,n){
    cin>>a[i];
    ans+=1/a[i];
  }
  cout<<fixed<<1/ans;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#define all(x) x.begin(),x.end()
#define rep(i,j,n) for (long long i = j; i < (long long)(n); i++)
#define _GLIBCXX_DEBUG
#define MOD 1000000007
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; }
//name[i][j]-> vvl name(i,vl(j))
//map<int,int>mp
//余りを切り上げる =>  (a + b - 1) / b 

signed main(){
	cout<<fixed<<setprecision(10);
	int n,k; cin>>n>>k;
	vector<double> vec(n);
	rep(i,0,n){
		double a; cin>>a;
		double f=(a+1)/2;
		vec[i]=f;
	}
	double ans=0.0;
	double memo=0.0;
	rep(i,0,n){
		memo+=vec[i];
		if(i>=k){
			memo-=vec[i-k];
		}
		//cout<<"memo:"<<memo<<endl;
		chmax(ans,memo);
	}
	cout<<ans<<endl;
	
	return 0;
}

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

#define ld long double
#define ll long long
#define ALL(a)  (a).begin(),(a).end()
#define spa << " " <<
#define MP make_pair
ll MOD = 1e9+7;
//ll MOD = 998244353;
ll INF = 1e18;
void chmin(ll &a, ll b) { if (a > b) a = b; }
void chmax(ll &a, ll b) { if (a < b) a = b; }
void ans1(bool x){
  if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}
void ans2(bool x){
  if(x) cout<<"YES"<<endl;else cout<<"NO"<<endl;}
void ans3(bool x){
  if(x) cout<<"Yay!"<<endl;else cout<<":("<<endl;}
void ans(bool x, ll y, ll z){
  if(x) cout<<y<<endl;else cout<<z<<endl;}   


int main(){
  ll i,j;
  ll n; cin>>n;
  //ll a,b,c,d,e,f; cin>>a>>b;
  //ll a,b,c,d,e,f; cin>>a>>b>>c;
  //ll a,b,c,d,e,f; cin>>a>>b>>c>>d;
  //string s; cin >> s;
  ll result = 0;
  ll buf = 0;
  bool judge = true;
  //cout<<48-n<<endl;

  
  vector<ll> c(n-1),s(n-1),f(n-1);
  for(i=0;i<n-1;i++){
    cin>>c[i]>>s[i]>>f[i];
  }
  for(j=0;j<n-1;j++){
  for(i=j,buf=0;i<n-1;i++){
    if(buf<=s[i]){
      buf=s[i];
    }
    else{
      if(buf%f[i]!=0)buf+=(f[i]-buf%f[i]);
    }
    buf+=c[i];
  }
  cout<<buf<<endl;
  }
  cout<<0<<endl;
  

  return 0;
}

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

ll N,W,weights[101],value[101];
//ll memo[1001][1001];

/*ll solve(ll id, ll w) {
  if (id >= N || w == 0) return 0;
  if (memo[id][w] != -1) return memo[id][w];
  if (weights[id] > w)         return memo[id][w] = solve(id + 1, w);
  return memo[id][w] = max(solve(id + 1, w), value[id] + solve(id + 1, w - weights[id]));
}*/

ll knapSack() 
{ 
   ll i, w; 
   ll K[N+1][W+1]; 
  
   for(i=0;i<=N;i++) 
   { 
     for(w=0;w<=W;w++) 
       { 
           if(i==0||w==0) 
				K[i][w]=0; 
           else if(weights[i-1]<=w) 
                K[i][w]=max(value[i-1]+K[i-1][w-weights[i-1]],K[i-1][w]); 
           else
                K[i][w] = K[i-1][w]; 
       } 
   } 
  
   return K[N][W]; 
} 


int main(){
	
	cin>>N>>W;
	for(int i=0;i<N;i++){
		cin>>weights[i]>>value[i];
	}
	cout<<knapSack()<<endl;
	
}

Measured memory_bytes: 79104
#include <stdio.h>
#include <math.h>
#define PI 3.14159265358979323846

int main(void) {
	int N;
	scanf("%d", &N);
	int A[100000];
	int a = 0;
	int B[100000];
	for (int i = 0; i < N; i++) {
		scanf("%d", &A[i]);
		a = A[i];
		B[a - 1] = i+1;
	}


	for (int i = 0; i < N; i++) {
		printf("%d ", B[i]);
	}


	return 0;
}

Measured memory_bytes: 1536
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define rep2(i, l, r) for (ll i = (l); i < (r); i++)
#define ALL(x) (x).begin(), (x).end()     //昇順
#define RALL(x) (x).rbegin(), (x).rend()  // 降順
#define pri(x) cout << (x) << "\n"
#define pri2(x, y) cout << (x) << " " << (y) << "\n"
#define pri3(x, y, z) cout << (x) << " " << (y) << " " << (z) << "\n"
const long long mod = 1e9 + 7;
typedef long long ll;
typedef priority_queue<int> PQ;
typedef vector<long long> VL; // VL a(n);
typedef vector<bool> VB;
typedef vector<double> VD;
typedef vector<string> VS;
typedef vector<char> VC;
typedef vector<VS> VSS;
typedef vector<VC> VCC;
typedef vector<VL> VLL; // VII a(n,VI(m)) n * m
typedef pair<ll, ll> PL;
typedef map<ll, ll> MP; // MP a;
typedef vector<pair<ll, ll>> PS; // PS a(n);

template <class T, class U>
bool chmax(T &a, U b) {
  if (a <= b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T, class U>
bool chmin(T &a, U b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
template <typename T>
ostream &operator<<(ostream &os, vector<T> &v) {
  os << "{";
  rep(i, (int)v.size()) { os << v[i] << (i < v.size() - 1 ? ", " : ""); }
  os << "}";
  return os;
}

// g++ -std=c++11 prac.cpp
// operator << (cout,a);
// chmin(min,a)
ll sum(ll n){return n*(n+1)/2;} 

int main() {
  ll n,k,m,x=0,y=0,z=0,cnt=0,h=0,w=0,ans=0,Max=0, Min=3e9+1;
  string s,t;
  cin >> n;
  map<string, ll> mp;
  rep(i,n){
    cin >> s;
    auto itr = mp.find(s);
    if(itr != mp.end()){
        itr->second++;
    }
    else{
        mp.insert(make_pair(s,1));
    }
  }
  cin >> m;
  rep(i,m){
    cin >> s;
    auto itr = mp.find(s);
    if(itr != mp.end()){
        itr->second--;
    }
    else{
        mp.insert(make_pair(s,-1));
    }
  }
  for( auto i = mp.begin(); i != mp.end();i++ ) { 
    chmax(Max,i->second);
  }


  pri(Max);
  return 0;
}

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

typedef struct point{
  int x, y;
  point operator+(const point &a){
    point p = (point){x + a.x, y + a.y};
    return p;
  }
  point operator-(const point &a){
    point p = (point){x - a.x, y - a.y};
    return p;
  }
}point;

bool grid[5001][5001];

int calc(point u, point v){
  point a = u - v;
  return a.x*a.x + a.y*a.y;
}

void rotate(point &u){
  int tmp = u.x;
  u.x = u.y, u.y = -tmp;
}

bool range(int y, int x){
  return (0 <= x and x < 5000 and
          0 <= y and y < 5000);
}

int main(){
  int n;
  while (std::cin >> n, n) {
    memset(grid, false, sizeof(grid));
    vector<point> vp(n);
    int x, y;
    for (int i = 0; i < n; i++) {
      std::cin >> x >> y;
      grid[y][x] = true;
      vp[i] = (point){x, y};
    }
    int area = 0;
    for (int i = 0; i < n; i++) {
      point u = vp[i];
      for (int j = 0; j < n; j++) {
        if(i == j)continue;
        point v = vp[j];
        point uv  = v - u;
        //std::cout << "uv.x:" << uv.x << " uv.y:" << uv.y << std::endl;
        rotate(uv);
        //std::cout << "uv.x:" << uv.x << " uv.y:" << uv.y << std::endl;
        
        point x = v + uv, y = u + uv;
        if(range(x.y, x.x) and range(y.y, y.x) and
           grid[x.y][x.x] == true and
           grid[y.y][y.x] == true and
           area < calc(u, v)){
          area = calc(u, v);
          //std::cout << "u.x:" << u.x << " u.y:" << u.y << std::endl;
        }
        rotate(uv);
        rotate(uv);
        x = v + uv, y = u + uv;
        if(range(x.y, x.x) and range(y.y, y.x) and
           grid[x.y][x.x] == true and
           grid[y.y][y.x] == true and
           area < calc(u, v))
          area = calc(u, v);
      }
    }
    std::cout << area << std::endl;
  }
  return 0;
}

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

public class Hello
{
    private const int MOD_N = 1000000000 + 7;

    public static void Main()
    {
        var list = Console.ReadLine().Split(' ');
        var n = int.Parse(list[0]);
        var m = int.Parse(list[1]);

        var maps = new List<int>[n];
        for (int i = 0; i < maps.Length; ++i)
            maps[i] = new List<int>();

        for (; m > 0; --m)
        {
            var list2 = Console.ReadLine().Split(' ');
            var x = int.Parse(list2[0]) - 1;
            var y = int.Parse(list2[1]) - 1;
            maps[x].Add(y);
            maps[y].Add(x);
        }

        var flags = new bool[n];
        var candidates = new List<int>();

        int ans = 0;

        for (int i = 0; i < flags.Length; ++i)
        {
            if (flags[i])
                continue;
            flags[i] = true;
            ++ans;

            candidates.Add(i);
            do
            {
                var index = candidates.Count - 1;
                var c = candidates[index];
                candidates.RemoveAt(index);
                var map = maps[c];
                for (int j = 0, count = map.Count; j < count; ++j)
                {
                    var mp = map[j];
                    if (flags[mp])
                        continue;
                    flags[mp] = true;
                    candidates.Add(mp);
                }
            } while (candidates.Count > 0) ;
        }

        Console.WriteLine(ans);
    }
}


Measured memory_bytes: 28932
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        
        while(sc.hasNext()) {
            String in = sc.next().trim();
            
            if ("ABC".equals(in)) {
                System.out.println("ARC");
            } else {
                System.out.println("ABC");
            }
        }
    }
}

Measured memory_bytes: 35624
from sys import stdin

n = int(stdin.readline())
l = list(stdin.readline().split())
q = int(stdin.readline())

for i in range(q):
    inp_l = list(map(int,stdin.readline().split()))
    displacement = inp_l[1] - inp_l[0]
    for i in range(displacement):
        l[inp_l[0] + i],l[inp_l[2] + i] =l[inp_l[2] + i],l[inp_l[0] + i]

print(' '.join(l))


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

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

    int n;
    cin >> n;

    vector<int> A;
    A.push_back(11);
    A.push_back(31);
    A.push_back(41);
    A.push_back(61);
    A.push_back(101);

    A.push_back(151);
    A.push_back(181);
    A.push_back(211);
    A.push_back(241);
    A.push_back(251);
    
    A.push_back(271);
    A.push_back(281);
    A.push_back(311);
    A.push_back(331);
    A.push_back(401);

    A.push_back(431);
    A.push_back(461);
    A.push_back(491);
    A.push_back(521);
    A.push_back(541);

    A.push_back(661);
    A.push_back(691);
    A.push_back(751);
    A.push_back(1171);
    A.push_back(1201);

    A.push_back(1901);
    A.push_back(2111);
    A.push_back(2311);
    A.push_back(2341);
    A.push_back(2351);

    A.push_back(2731);
    A.push_back(2741);
    A.push_back(2791);
    A.push_back(2801);
    A.push_back(3001);

    A.push_back(3011);
    A.push_back(3041);
    A.push_back(3061);
    A.push_back(3121);
    A.push_back(3181);

    A.push_back(3191);
    A.push_back(3221);
    A.push_back(3251);
    A.push_back(3271);
    A.push_back(3301);

    A.push_back(3331);
    A.push_back(3371);
    A.push_back(3361);
    A.push_back(3391);
    A.push_back(3461);

    A.push_back(4421);
    A.push_back(4441);
    A.push_back(4451);
    A.push_back(4481);
    A.push_back(4591);
    
    A.push_back(4861);
    A.push_back(4931);
    
    REP(i, n){
        if(i) cout << " " << A[i];
        else cout << A[i];
    }
    cout << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <iomanip>
#include <stack>
#include <array>
#include <deque>
#include <forward_list>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <iterator>
#include <string>
#include <cstring>
#include <fstream>
#include <random>
#include <time.h>
#include <complex>
#include <cmath>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=n;i>0;i--)
#define arep(a,i,n) for(int i=(a);i<(n);i++)
#define SORT(v) sort((v).begin(),(v).end())
#define TEMP(type,x,y) do {temp temp=x,x=y,y=temp}while(0)
const ll INF = (1LL << 50);

ll N;

/*
	7 -> 0b001
	5 -> 0b010
	3 -> 0b100
	とする。7をつかい、その後に5を使うと、0b001 | 0b010 = 0b011
	7を使い、7を使うと、0b001 | 0b001 = 0b001
	7,5,3をすべて使うと、use = 9b111となる

*/
void dfs(ll cur, int use, ll &counter) {

	if (cur > N) return;//生成した数がN以上ならば、処理を終了する
	if (use == 0b111) counter++;

	dfs(cur * 10 + 7, use | 0b001, counter);

	dfs(cur * 10 + 5, use | 0b010, counter);

	dfs(cur * 10 + 3, use | 0b100, counter);
}


int main() {

	cin >> N;

	ll res = 0;

	dfs(0, 0, res);

	cout << res << endl;

	return 0;

}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int h = sc.nextInt();
        int w = sc.nextInt();
        String[][] board = new String[h][w];

        for (int i = 0; i < h; i++) {
            board[i] = sc.next().split("");
        }

        sc.close();

        int[] dx = { 1, 0, 1, -1, -1, -1, 0, 1 };
        int[] dy = { 0, 1, 1, 1, 0, -1, -1, -1 };

        for (int i = 0; i < h; i++) {
            for (int j = 0; j < w; j++) {
                if (board[i][j].equals(".")) {
                    int cnt = 0;
                    for (int k = 0; k < 8; k++) {
                        int x = i + dx[k];
                        int y = j + dy[k];

                        if (x < h && x >= 0 && y < w && y >= 0 && board[x][y].equals("#")) {
                            cnt++;
                        }
                    }
                    board[i][j] = String.valueOf(cnt);
                }
            }
        }

        for (String[] strArray : board) {
            for (String str : strArray) {
                System.out.print(str);
            }
            System.out.println("");
        }
    }

}

Measured memory_bytes: 23892
N=int(input())
v=list(map(int,input().split()))
v=sorted(v,key=int)
def fusion():
    if len(v)==1:
        return v[0]
    else:
        v.insert(0,(v.pop(0)+v.pop(0))/2)
        v.sort(key=float)
        return fusion()
print(fusion())

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

//+=と=+に注意

const int INF = 1001000000;

int main(){
  int n,d[150]={0};
/*
  //文字番号のチェック
  string st="abcdefghijklmnopqrstuvwxyz";
  for (int i = 0; i < st.size(); i++) {
    cout << (int)st[i] << " ";
  }
  cout << endl;
  //cout << (int)moji[0] << endl << (int)'b' << endl << char(98) << endl << (int)moji[1] << endl;
*/
  //a=97,z=122
  string str;
  bool found =false;
  cin >> str;
  for(int i=0;i<str.size();++i){
    d[(int)str[i]]=1;
  }
  //cout << str.size() <<endl;
  for(int i=97;i<=122;i++){
    if(d[i]==0){
      cout << (char)i << endl;
      found =true;
      break;
    }
  }
  if(!found)cout << "None" << endl;
}


Measured memory_bytes: 512
///supercalifragilisticexpialidocious.
#include<bits/stdc++.h>
using namespace std;
#define boo first
#define s second
#define PB pop_back
#define pb push_back
#define mp make_pair
#define int long long
#define sz(s) (int)s.size()
#define seper(n) setprecision(n)
#define all(v) v.begin(),v.end()
#define mem(a,b) memset(a,b,sizeof a)
#define IOS ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
typedef long long ll;
typedef map<int , int> mii;
typedef pair<int , int> pii;
typedef map<string , int> msi;
typedef pair<int , string> pis;
const int MAXN = 4e3 + 10 , INF = 1e18;
int n , a[MAXN] , dp[MAXN][MAXN] , co[MAXN][MAXN][2];
bool bo[MAXN][2] , boo;
char c[MAXN];
void dp_update()
{
    mem(dp , 127);
   for(int i = 0 ; i <= n ; i ++)
      for(int j = 0 ; j <= n ; j ++)
        {
            if(!i and !j)
                dp[i][j] = 0 ;
            if(i)
                dp[i][j] = min(dp[i][j] , dp[i - 1][j] + co[i - 1][j][0]) ;
			if(j)
                dp[i][j] = min(dp[i][j] , dp[i][j - 1] + co[j - 1][i][1]) ;
		}
	return;
}
int32_t main()
{
	cin >> n;
	for(int i = 0 ; i < 2 * n ; i ++)
		cin >> c[i] >> a[i] , a[i] --;
    for(int i = 0 ; i < 2 * n ; i ++)
    {
		if(c[i] == 'W')
            boo = false;
		else
            boo = true;
        bo[a[i]][boo] = true;
		for(int j = n ; j >= 0 ; j --)
		{
			co[a[i]][j][boo] = co[a[i]][j + 1][boo];
			if(bo[j][!boo])
                co[a[i]][j][boo] ++;
		}
	}
	///update:))
	dp_update();
    ///ans
	for(int i = 0 ; i < 2 * n ; i ++)
		for(int j = 0 ; j < i ; j ++)
			if(a[i] < a[j] and c[i] == c[j])
                dp[n][n] ++;
    return cout << dp[n][n] << endl , 0;
}


Measured memory_bytes: 253440
///-----Bismillahir Rahmanir Rahim-----///

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

///---FAST I/O---///
#define Boost() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

///---DATA TYPE---///
typedef long long ll;
typedef long long int lli;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<double, double> pdd;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef vector<int>::iterator vit;
typedef set<int>::iterator sit;

///---LOOP---///
#define rep0(i,n) for(i=0;i<n;i++)
#define rep1(i,n) for(i=1;i<=n;i++)

///---I/O---///
#define sf scanf
#define pf printf

///---OTHERS---///
#define pb push_back
#define all(c)		c.begin(),c.end()
#define MK make_pair
#define F first
#define S second
#define endl '\n'


///---INITIALIZATION---//
#define mem(a,b) memset(a, b, sizeof(a) )

///---CALCULATE---///
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*(b/gcd(a,b)))
#define sqr(a) ((a) * (a))

///---BIT OPERATION---///
inline bool checkBit(ll n, int i)
{
    return n&(1LL<<i);
}
inline ll setBit(ll n, int i)
{
    return n|(1LL<<i);;
}
inline ll resetBit(ll n, int i)
{
    return n&(~(1LL<<i));
}

///------String/Char Related Functions-----///
string makeintString(int x)
{
    stringstream ss;
    ss << x;
    string str = ss.str();
    ///cout<<str<<endl;
    return str;
}
string makellString(ll x)
{
    stringstream ss;
    ss << x;
    string str = ss.str();
    ///cout<<str<<endl;
    return str;
}
char cpp(char c)
{
    return static_cast<char>(c + 1);
}

///------------Sorting STL----------///
struct func
{
	//this is a sample overloading function for sorting stl
	bool operator()(pii const &a, pii const &b)
	{
		if(a.F==b.F)
			return (a.S<b.S);
		return (a.F<b.F);
	}
};

///---CONSTANT---///
const double PI = acos(-1);
const double eps = 1e-9;
const int inf = 2000000000;
const ll infLL = 9000000000000000000;
#define MOD 1000000007

int main()
{
    Boost();

    int t;
    t=1;
    //cin>>t;
    while(t--)
    {
      int n,l;
      cin>>n>>l;
      vector<string>s(n);
      for(int i=0;i<n;i++)
      {
          cin>>s[i];
      }
      sort(s.begin(),s.end());
      for(int i=0;i<n;i++)
      {
          cout<<s[i];
      }
      cout<<endl;
    }
    return 0;
}



Measured memory_bytes: 3664
fn read<T: std::str::FromStr>(
    stdin_lock: &mut std::io::StdinLock,
    buf: &mut Vec<u8>,
    delimiter: u8,
) -> T {
    buf.clear();
    let l = std::io::BufRead::read_until(stdin_lock, delimiter, buf).unwrap();
    buf.truncate(l - 1); // remove delimiter
    let s = unsafe { std::str::from_utf8_unchecked(&buf) };
    s.parse().unwrap_or_else(|_| panic!("read"))
}

fn main() {
    let stdin = std::io::stdin();
    let mut stdin_lock = stdin.lock();
    let mut buf: Vec<u8> = Vec::new();
    let r = read(&mut stdin_lock, &mut buf, b'\n');
    println!("{}", solve(r));
}

fn solve(r: u16) -> String {
    if r < 1200 {
        "ABC".to_owned()
    } else if r < 2800 {
        "ARC".to_owned()
    } else {
        "AGC".to_owned()
    }
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
// type alias
typedef long long LL;
typedef pair<int,int> II;
typedef tuple<int,int,int> III;
typedef vector<int> VI;
typedef vector<string> VS;
typedef unordered_map<int,int> MAPII;
typedef unordered_set<int> SETI;
template<class T> using VV=vector<vector<T>>;
// minmax
template<class T> inline T SMIN(T& a, const T b) { return a=(a>b)?b:a; }
template<class T> inline T SMAX(T& a, const T b) { return a=(a<b)?b:a; }
// repetition
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)
#define REPE(i,n)  for(int i=0;i<=(n);++i)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  for(int i=0;i<(n);++i)
#define FORR(x,arr) for(auto& x:arr)
#define SZ(a) int((a).size())
// collection
#define ALL(c) (c).begin(),(c).end()
// DP
#define MINUS(dp) memset(dp, -1, sizeof(dp))
#define ZERO(dp) memset(dp, 0, sizeof(dp))
// stdout
#define println(args...) fprintf(stdout, ##args),putchar('\n');
// debug cerr
template<class Iter> void __kumaerrc(Iter begin, Iter end) { for(; begin!=end; ++begin) { cerr<<*begin<<','; } cerr<<endl; }
void __kumaerr(istream_iterator<string> it) { (void)it; cerr<<endl; }
template<typename T, typename... Args> void __kumaerr(istream_iterator<string> it, T a, Args... args) { cerr<<*it<<"="<<a<<", ",__kumaerr(++it, args...); }
template<typename S, typename T> std::ostream& operator<<(std::ostream& _os, const std::pair<S,T>& _p) { return _os<<"{"<<_p.first<<','<<_p.second<<"}"; }
#define __KUMATRACE__ true
#ifdef __KUMATRACE__
#define dump(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); __kumaerr(_it, args); }
#define dumpc(ar) { cerr<<#ar<<": "; FORR(x,(ar)) { cerr << x << ','; } cerr << endl; }
#define dumpC(beg,end) { cerr<<"~"<<#end<<": "; __kumaerrc(beg,end); }
#else
#define dump(args...)
#define dumpc(ar)
#define dumpC(beg,end)
#endif

// $ cp-batch ProductMax | diff ProductMax.out -
// $ g++ -std=c++14 -Wall -O2 -D_GLIBCXX_DEBUG -fsanitize=address ProductMax.cpp && ./a.out

/*

 9/13/2020

 5:01-

 */

LL a,b,c,d;

void solve() {
  vector<LL> as={a,b},bs={c,d};
  LL res=-2e18;
  REP(i,SZ(as))REP(j,SZ(bs)) {
    SMAX(res,as[i]*bs[j]);
  }
  cout<<res<<endl;
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout<<setprecision(12)<<fixed;

  cin>>a>>b>>c>>d;
  solve();

  return 0;
}


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

int main()
{
    int n;
    cin >> n;
    vector<int> x;
    vector<int> y;
    int in;
    for(int i = 0; i < n; i++){
        cin >> in;
        x.push_back(in);
        y.push_back(in);
    }
    sort(x.begin(), x.end());
    int m1, m2;
    m1 = x[n/2 - 1];
    m2 = x[n/2];
    for(int i = 0; i < n; i++){
        if(y[i] >= m2){
            cout << m1 << endl;
        }
        else {
            cout << m2 << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 3948
N = int(input())
Nloop = N + 1
A = [[0] * Nloop for _ in range(Nloop)]

for i in range(1, Nloop):
    Acount = int(input())
    for _ in range(Acount):
        x, y = map(int, input().split())
        if y == 1:
            A[i][x] = 1
        else:
            A[i][x] = -1

honest_loop = 2 ** N
is_honest = [False] * Nloop

ans = 0

for i in range(1, honest_loop):
    for l in range(1, Nloop):
        is_honest[l] = (i >> (l - 1) & 1 == 1)

    honest_check = True
    for l in range(1, Nloop):
        # lの人が正直者のとき
        if is_honest[l]:
            # lの人から見てjの人は正直者か？
            for j in range(1, Nloop):
                if A[l][j] == 1:
                    if not is_honest[j]:
                        honest_check = False
                elif A[l][j] == -1:
                    if is_honest[j]:
                        honest_check = False
                if not honest_check:
                    break
        if not honest_check:
            break

    if honest_check:
        ans = max(sum(is_honest), ans)

print(ans)


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

int main() {
	int x;
	long long d;
	const unsigned int M = 1000000007;
	cin>>x;
	d = x;
	for(int i=x; i>1; i--){
		d=d*(i-1)% M;
	}
	cout<<d;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<math.h>
#include<vector>
#include<map>
#include<set>

using namespace std;
using ll = long long;

const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;
const double PI = acos(-1.0);

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, a, n) for (int i = a; i <= (n); ++i)

int main() {
    vector<int> A(3); rep(i, 3) cin >> A[i];
    sort(A.begin(), A.end());

    cout << A[0] + A[1] << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <map>
#include <algorithm> 
#include <vector> 
#include <string.h> 
#include <math.h> 
#include <stdio.h> 
#include <stdlib.h> 
#include <chrono> 
#include <thread> 
#include <iomanip>
#include <typeinfo>
 
//define
#define trav(i,v)   for(auto i: v)
#define rep(i,n)    for(int i=0;i<n;i++)
#define repu(i,k,n) for(int i=k;i<=n;i++)
#define repd(i,k,n) for(int i=k;i>=n;i--)
#define se second
#define fi first
#define pb push_back
#define mp make_pair
#define all(v)  v.begin(), v.end()
#define itn int 

//typedef
typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
typedef std::pair<int, int> pii;
typedef std::vector<int> vi;
typedef std::vector< pii > vii;
typedef std::vector< ll > vll;
typedef std::vector< std::pair < pii, int > > vpp;
 
const long long MOD = 1000000007;
// const long long MOD = 998244353;
const long long inf = 1000000000000000000;
 
using namespace std;

ll modpow(ll x,ll n){
    ll res=1;
    while(n>0){
        if(n&1) res=res*x%MOD;
        x=x*x%MOD;
        n>>=1;
    }
    return res;
}
 
ll power(ll x, ll n)
{
    ll res=1;
    while(n>0){
        if(n&1) res=res*x;
        x=x*x;
        n>>=1;
    }
    return res;
}

void solve()
{
    int n;
    ll k;
    cin>>n>>k;
    vll v(n+1);
    repu(i,1,n)
    {
        cin>>v[i];
    }
    ll l=1, r=10000000000;
    while(l<=r)
    {
        if(l==r)
        {
            cout<<l<<endl;
            return;
        }
        ll m=(l+r)/2;
        ll k1=0;
        repu(i,1,n)
        {
            k1+=v[i]/m;
            if(v[i]%m==0)
                k1--;
        }
        if(k1<=k)
        {
            r=m;
        }
        else
        {
            l=m+1;
        }
    }
}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    int t = 1, tt=1;
    // cin>>t;
    while(tt<=t)
    {
        // cout<<"Case #"<<tt<<": ";
        solve();
        tt++;
    }
    cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
}   

Measured memory_bytes: 4724
#include <bits/stdc++.h>
using namespace std;
int main() {
  long long a;
  long long b;
  long long c;
  long long d;
  cin >> a >> b >> c >> d;
  long long ans;
  if(a > 0){
    ans = max(b*d, a*d);
   
  }
  else if (c > 0){
    ans = max(b*c, b*d);
    
  }
  else{
    ans = max( a * c, b * d);
  }
  cout << ans << endl;
    
    
}

Measured memory_bytes: 3628
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#include <x86intrin.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()
#define V vector
template <typename T> bool chmin(T &a, const T &b) {if(a > b){a = b; return true;} return false;}
template <typename T> bool chmax(T &a, const T &b) {if(a < b){a = b; return true;} return false;}
template<typename A, size_t N, typename T> void Fill (A (&array)[N], const T & val) {fill ((T*)array, (T*)(array+N), val);}
V<int> dx = {-1, 1,  0, 0, -1, -1,  1, 1};
V<int> dy = { 0, 0, -1, 1, -1,  1, -1, 1};

V<V<P>> to(1e5+5);
V<ll> dk(1e5+5, -1);

void dfs (int now, int p, ll cost) {//nowの親はp
    dk[now] = cost;
    for (auto nxt : to[now]) {
        if (nxt.first == p) continue;
        dfs(nxt.first, now, cost + nxt.second);
    }
}

int main () {
    int n; cin >> n;
    rep(i, n-1) {
        int a, b, c; cin >> a >> b >> c; a--; b--;
        to[a].emplace_back(b, c); to[b].emplace_back(a, c);
    }
    int q, k; cin >> q >> k; k--;
    dfs(k, -1, 0);
    rep(i, q) {
        int x, y; cin >> x >> y; x--; y--;
        printf("%ld\n", dk[x] + dk[y]);
    }

    return 0;
}

Measured memory_bytes: 15616
#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
#include<queue>
#include<map>
#include<math.h>
#include<string>
#include <cctype>
#include <cstdlib>
#include<bitset>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, s, n) for (int i = s; i < (int)(n); i++)
#define out(x) cout << x << endl
#define INF 1ll<<60;
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; }

using namespace std;
using ll = long long;
typedef pair<int, int> P;

int main(){
    char a; cin >> a;
    if(islower(a)) out("a");
    else out("A");
}

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


int main(){
   cin.tie(0);
   ios::sync_with_stdio(false);
   cout << fixed << setprecision(20);
   
   int n,ans; cin >> n;
   vector<int> a(n),b(n),c(n),d(n);
   rep(i,0,n){
   	cin >> a[i];
   }
   rep(i,0,n){
   	cin >> b[i];
   	ans+=b[i];
   }
   rep(i,0,n-1) cin >> c[i];
   rep(i,0,n-1){
   	if(a[i]+1==a[i+1])d.push_back(c[a[i]-1]);
   }
   rep(i,0,d.size()) ans+=d[i];
   cout << ans << endl;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
using namespace std;
int maxa(int a,int b)
{
	if (b>a)
		return b;
	else 
		return a;
}
signed main()
{
	int n,m;
	cin>>n>>m;
	int w[n],v[n];
	for (int i = 0; i < n; ++i)
	{
		cin>>w[i]>>v[i];
	}
	int r[n+1][m+1];
	for(int i=0; i<=n; i++)
		r[i][0]=0;
	for(int i=0; i<=m; i++)
		r[0][i]=0;
	for(int i=1; i<=n; i++)
	{
		for(int j=1; j<=m; j++)
		{
			if (w[i-1]<=j)
				r[i][j]=maxa(r[i-1][j-w[i-1]]+v[i-1],maxa(r[i-1][j],r[i][j-1]));
			else
				r[i][j]=maxa(r[i-1][j],r[i][j-1]);
		}
	}
	cout<<r[n][m];
}

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

#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define eb emplace_back

typedef unsigned long long ll;
typedef long double ld;
		

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	
	ll n; cin >> n;
	vector<ll> monsters(n+1);
	vector<ll> heroes(n);
	
	for (ll &e : monsters) {
		cin >> e;
	}
	for (ll &e : heroes) {
		cin >> e;
	}
	
	ll res = 0;
	for (int i=n-1; i>=0; i--) {
		ll take = min(heroes[i], monsters[i+1]);
		res += take;
		heroes[i] -= take;
		monsters[i+1] -= take;
		take = min(heroes[i], monsters[i]);
		res += take;
		heroes[i] -= take;
		monsters[i] -= take;
	}
	cout << res << endl;
	
				
}


Measured memory_bytes: 1792
#include <cstdio>

int main() {
    while (1) {
        int i;
        int n, m;
        char s;
        char prev = '\0';
        int is_chain = 0;
        int chain_time = 0;
        int sum = 0;

        scanf("%d", &n);
        if (n == 0) return 0;

        scanf("%d", &m);

        for (i=0;i<m;i++) {
            scanf(" %c", &s);
            if (is_chain) {
                if (prev == s) {
                    int tmp = chain_time - n + 1;
                    if (tmp > 0) sum += tmp;
                    chain_time = 0;
                    is_chain = 0;
                } else if (s == 'I') {
                    chain_time++;
                }
            }

            if (s == 'I') {
                is_chain = 1;
            }

            prev = s;
        }

        printf("%d\n", sum);
    }
}

Measured memory_bytes: 1028
a,b,c = map(int, input().split())
k = int(input())

cnt = 0 #マジックを何回使ったか？

while a >= b:
    b *= 2
    cnt +=1
while b >= c:
    c *= 2
    cnt += 1
    
if cnt <= k:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 8992
#define _USE_MATH_DEFINES
#include<iostream>
#include <iomanip>
#include<stdio.h>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include <queue>
#include <utility>
#include <map>
#include <set>
#include <deque>
#include <numeric>
using namespace std;

int main() {
    int N,min_=10000,max_=-1;
    cin >> N;
    for (int i = 0; i < N; i++) {
        int a;
        cin >> a;
        min_ = min(min_, a);
        max_ = max(max_, a);
    }

    cout << max_ - min_ << endl;

    return 0;
}

Measured memory_bytes: 256
n=int(input())
arr = list(map(float,input().split()))
dp = [[-1]*(n+1) for i in range(n+1)]
def func(n,x):
    for i in range(0,n+1):
        for j in range(0,n+1):
            if j==0:
                dp[i][j] = 1
            elif i==0:
                dp[i][j]=0
            else:
                p=(arr[i-1])*dp[i-1][j-1]
                q=(1-arr[i-1])*dp[i-1][j]
                dp[i][j] = p+q 
    
    return dp[n][x]

print("%0.10f"%func(n,(n+1)//2))

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


int main() {
    int x,y;
    cin>>x>>y;
    if(y%2==1){
        cout<<"No"<<endl;
        return 0;
    }
    if(y>4*x){
        cout<<"No"<<endl;
        return 0;
    }
    if(y<2*x){
        cout<<"No"<<endl;
        return 0;
    }
    cout<<"Yes"<<endl;
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
#define all(cont) cont.begin(), cont.end()
#define pb push_back
#define fi first
#define se second
#define DEBUG(x) cerr << (#x) << ": " << (x) << '\n'

using namespace std;

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

template<class T> bool uin(T &a, T b) {return (a < b ? false : (a = b, true));}
template<class T> bool uax(T &a, T b) {return (a > b ? false : (a = b, true));}

//ifstream f(".in");
//ofstream g(".out");

const int NMAX = 305;

double prob[NMAX][NMAX][NMAX];
double exp_val[NMAX][NMAX][NMAX];

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
#ifdef LOCAL_DEFINE
  freopen(".in", "r", stdin);
#endif

  int n;
  cin >> n;
  vector<int> cnt(4);
  for (int i = 1; i <= n; ++i) {
    int a;
    cin >> a;
    ++cnt[a];
  }

  prob[cnt[1]][cnt[2]][cnt[3]] = 1.0;
  for (int threes = n; threes >= 0; --threes) {
    for (int twos = n; twos >= 0; --twos) {
      for (int ones = n; ones >= 0; --ones) {
        if (ones + twos + threes > n || (ones == 0 && twos == 0 && threes == 0)) {
          continue;
        }

        double p_zero = (double)(n - (ones + twos + threes)) / n;
        // p_zero + p_zero ^ 2 + p_zero ^ 3 + ... = S
        // 1 + S = S / p_zero
        // p_zero + S * p_zero = S
        // S = p_zero / (1 - p_zero)

        double p_curr = prob[ones][twos][threes];
        exp_val[ones][twos][threes] += ((p_zero / (1.0 - p_zero)) + 1.0) * p_curr;
        double exp_val_curr = exp_val[ones][twos][threes];

        if (ones != 0) {
          double p_one = (double) ones / (ones + twos + threes);
          prob[ones - 1][twos][threes] += p_one * p_curr;
          exp_val[ones - 1][twos][threes] += p_one * exp_val_curr;
        }
        if (twos != 0) {
          double p_two = (double) twos / (ones + twos + threes);
          prob[ones + 1][twos - 1][threes] += p_two * p_curr;
          exp_val[ones + 1][twos - 1][threes] += p_two * exp_val_curr;
        }
        if (threes != 0) {
          double p_three = (double) threes / (ones + twos + threes);
          prob[ones][twos + 1][threes - 1] += p_three * p_curr;
          exp_val[ones][twos + 1][threes - 1] += p_three * exp_val_curr;
        }
      }
    }
  }

  cout.precision(10);
  cout << exp_val[0][0][0] << '\n';

#ifdef LOCAL_DEFINE
  cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
  return 0;
}


Measured memory_bytes: 438528
#define _CRT_SECURE_NO_WARNINGS // #pragma warning(disable:4996)
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <functional>
#include <sstream>
#include <cmath>
#include <set>
#include <map>
#include <stack>
using namespace std; 

#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(a);i>=(b);i--)
#define pb push_back
#define mp(a,b) make_pair(a,b)
#define all(a) a.begin(),a.end()
#define len(x) ((int)(x).size())
#define tmax(a,b,c) max((a),max((b),(c)))
#define tmin(a,b,c) min((a),min((b),(c)))
#define debug(x) cerr << #x << " is " << x << endl;

typedef pair<int, int> Pii;
typedef map<int, int> Mii;
typedef vector<int> Vi;
typedef long long ll;
const int inf = 2e9;
const ll ll_inf = 1e17;
const int mod = 1e9 + 7;
const long double eps = 1e-10;

ll a[3];

int main()
{
	cin >> a[0] >> a[1] >> a[2];
	sort(a, a+3);
	if (a[0]%2==0 || a[1]%2==0 || a[2]%2==0) cout << 0 << endl;
	else cout << a[0] * a[1] << endl;

	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
int main()
{long long t,m,n;
scanf("%lld%lld",&m,&n);
t=m*n;
while(m!=n)
if(m>n)
	m=m-n;
else if(m<n)
	n=n-m;
t=t/n;
printf("%lld",t);
}

Measured memory_bytes: 128
import sys
input = sys.stdin.readline
INF = 10**18
sys.setrecursionlimit(10**6)
import itertools as it
import collections as cl
from collections import deque
import math
from functools import reduce
from collections import defaultdict
D = 10 ** 9 + 7

def li():
    return [int(x) for x in input().split()]


def modpow(a, n, mod):
    res = 1
    while n > 0:
        if n & 1:
            res = res * a % mod
        a = a * a % mod
        n >>= 1
    return res

N = int(input())

total = modpow(10, N, D)
A = total - modpow(9, N, D)
B = total - modpow(9, N, D)
C = total - modpow(8, N, D)

ans = (A + B - C) % D
print(ans)

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

int main(){
    int n;
    cin >> n;
    int res = n;
    for(int i=0;i<=n;i++){
        int cc=0;
        int t=i;
        while(t>0){
            cc+=t%6;
            t/= 6;
        }
        t = n-i;
        while(t>0){
            cc+=t%9;
            t/=9;
        }
        if(res > cc){
            res =cc;
        }
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 256
x1,y1,x2,y2 = gets.chomp.split(' ').map(&:to_i)
x = x2 - x1
y = y2 - y1
x3 = x2 - y 
y3 = y2 + x
x = x3 - x2
y = y3 - y2
x4 = x3 - y
y4 = y3 + x
puts "#{x3} #{y3} #{x4} #{y4}"

Measured memory_bytes: 1788
public class Main {
    public static void main(String[] args) {

         java.util.Scanner sc = new java.util.Scanner(System.in);

         int number[] = new int[6];
        dice d1 = new dice();
        for (int i = 0; i < 6; i ++) { d1.number[i] = sc.nextInt(); }

         d1.command = sc.next();
        for (int i = 0; i < d1.command.length(); i ++) {
            if (d1.command.charAt(i) == ('N')) { d1.toNorth(); }
            if (d1.command.charAt(i) == ('S')) { d1.toSouth(); }
            if (d1.command.charAt(i) == ('W')) { d1.toWest(); }
            if (d1.command.charAt(i) == ('E')) { d1.toEast(); }
        }
        System.out.println(d1.number[0]);
    }
}

class dice {
    int number[] = new int[6];
    String command;

     public void toNorth() {
        int buf = number[5];
        number[5] = number[4];
        number[4] = number[0];
        number[0] = number[1];
        number[1] = buf;
    }
    public void toSouth() {
        int buf = number[5];
        number[5] = number[1];
        number[1] = number[0];
        number[0] = number[4];
        number[4] = buf;
    }
    public void toWest() {
        int buf = number[5];
        number[5] = number[3];
        number[3] = number[0];
        number[0] = number[2];
        number[2] = buf;
    }
    public void toEast() {
        int buf = number[5];
        number[5] = number[2];
        number[2] = number[0];
        number[0] = number[3];
        number[3] = buf;
    }
}

Measured memory_bytes: 26348
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int[] t=new int[100];
		int[] m=new int[100];
		int[] sm=new int[100];
		int k=0;
		for(int i=0;i<a;i++) {
		    int b= sc.nextInt();
		    t[i]=b;
		}
		int c = sc.nextInt();
		for(int i=0;i<c;i++) {
		    int b= sc.nextInt();
		    int d= sc.nextInt();
		    int s=t[b-1];
		    t[b-1]=d;
		    int sum=0;
		    for(int j=0;j<a;j++) {
		    	   sum+=t[j];
		    }
		    sm[k]=sum;
		    k++;
		    t[b-1]=s;
		}
		for(int i=0;i<k;i++) {
			System.out.println(sm[i]);
			
		}
	}
}

Measured memory_bytes: 21716
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) {
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		String buffer;
		try {
			while ((buffer = reader.readLine())  != null) {
				Integer a = Integer.valueOf(buffer.substring(0, buffer.indexOf(" ")));
				Integer b = Integer.valueOf(buffer.substring(buffer.indexOf(" ") + 1, buffer.indexOf(" ", buffer.indexOf(" ") + 1)));
				Integer c = Integer.valueOf(buffer.substring(buffer.indexOf(" ", buffer.indexOf(" ") + 1) + 1));
				if (a < b && b < c) {
					System.out.println("Yes");
				}
				else {
					System.out.println("No");
				}
			}
		} catch (Exception ex) {
			ex.printStackTrace();
		}
	}
}

Measured memory_bytes: 24172
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    string s;
    cin>>s;
    if(s[2]==s[3]&&s[4]==s[5]) cout<<"Yes";
    else cout<<"No";
}

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

#define GET_ARG(a,b,c,F,...) F
#define REP3(i,s,e) for (i = s; i <= e; i++)
#define REP2(i,n) REP3 (i,0,(int)(n)-1)
#define REP(...) GET_ARG (__VA_ARGS__,REP3,REP2) (__VA_ARGS__)
#define RREP3(i,s,e) for (i = s; i >= e; i--)
#define RREP2(i,n) RREP3 (i,(int)(n)-1,0)
#define RREP(...) GET_ARG (__VA_ARGS__,RREP3,RREP2) (__VA_ARGS__)
#define DEBUG(x) cerr << #x ": " << x << endl

int a[200000];

int main(void) {
    int i, j, k, n;
    scanf("%d",&n);
    REP (i,1,2*n-1) scanf("%d",&a[i]);
    int l = 1, r = 2 * n;
    while (l + 1 < r) {
        int m = (l + r) / 2;
        bool ok = false;
        REP (i,n,2*n-2) {
            if (a[i] >= m && a[i+1] >= m) {
                REP (k,2*n-i,i) if (a[k] < m && a[k+1] < m) break;
                if (k == i+1) ok = true;
                break;
            }
            else if (a[i] < m && a[i+1] < m) break;
        }
        RREP (j,n,2) {
            if (a[j] >= m && a[j-1] >= m) {
                RREP (k,2*n-j,j) if (a[k] < m && a[k-1] < m) break;
                if (k == j-1) ok = true;
                break;
            }
            else if (a[j] < m && a[j-1] < m) break;
        }
        if (ok || i == 2*n-1 && j == 1 && a[1] >= m)
            l = m;
        else
            r = m;
    }
    printf("%d\n",l);
    return 0;
}


Measured memory_bytes: 1152
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int N;
    vector<int> a;
    cin >> N;
    for (int i = 0; i < N; i++)
    {
        int in;
        cin >> in;
        a.push_back(in);
    }
    sort(a.begin(), a.end());
    cout << abs(a.front() - a.back());
    return 0;
}

Measured memory_bytes: 256
def checkGrade(m,f,r):
  if m==-1 or f==-1:
    return 'F'
  elif m+f>=80:
    return 'A'
  elif m+f>=65:
    return 'B'
  elif m+f>=50:
    return 'C'
  elif m+f>=30:
    if r>=50:
      return 'C'
    else:
      return 'D'
  else:
    return 'F'

while True:
  m,f,r = map(int, input().split())
  
  if m+f+r == -3:
    break
  else:
    print(checkGrade(m,f,r))


Measured memory_bytes: 5600
n = int(input())

def dfs(s):
    
    if int(s) > n:
        return 0

    if all(s.count(c) > 0 for c in ["7","5","3"]):
        ret = 1
    else:
        ret = 0

    for c in ["7","5","3"]:
        ret += dfs(s + c)

    return ret

print(dfs("0"))


Measured memory_bytes: 2940
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

type Scanner struct {
	sc *bufio.Scanner
}

func NewScanner() *Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), int(1e+9))
	return &Scanner{sc}
}

func (s *Scanner) nextStr() string {
	s.sc.Scan()
	return s.sc.Text()
}

func (s *Scanner) nextInt() int {
	i, e := strconv.Atoi(s.nextStr())
	if e != nil {
		panic(e)
	}
	return i
}

func (s *Scanner) nextFloat() float64 {
	f, e := strconv.ParseFloat(s.nextStr(), 64)
	if e != nil {
		panic(e)
	}
	return f
}

func (s *Scanner) nextRuneSlice() []rune {
	return []rune(s.nextStr())
}

func (s *Scanner) nextIntSlice(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextInt()
	}
	return res
}

func max(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m < i {
			m = i
		}
	}
	return m
}

func min(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m > i {
			m = i
		}
	}
	return m
}

func abs(x int) int {
	if x > 0 {
		return x
	}
	return -x
}

func pow(x, y int) int {
	res := 1
	for i := 0; i < y; i++ {
		res *= x
	}
	return res
}

func main() {
	sc := NewScanner()
	A, B := sc.nextInt(), sc.nextInt()
	if B%A == 0 {
		fmt.Println(A + B)
	} else {
		fmt.Println(B - A)
	}
}


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

int main(void) {
    int64_t X,Y;
    int cnt = 0;
    int64_t target;
    cin >> X >> Y;

    target = Y/X;
//printf("target:%ld\n", target);
    for(int64_t i=0;i<61;i++) {
//printf("cur:%ld\n", ((int64_t)1<<i));
        if(((int64_t)1<<i) <= target) {
            cnt++;
        } else {
            break;
        }
    }

    cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main(){
    int n;
    cin >> n;
    int L[n];
    for(int i = 0; i < n; i++){
        cin >> L[i];
    }
    sort(L, L+n);
    int sum = 0;
    for(int i = 0; i < n-1; i++){
        sum += L[i]; 
    }
    if(L[n-1] < sum){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int b,c,n,m,x=0,y=0,i;
    int a[4];
    cin>>n>>m;
    string s[n+5];
    for(i=0;i<n;i++)
    {
        cin>>s[i];
    }
    sort(s,s+n);
    for(i=0;i<n;i++)
    {
        cout<<s[i];
    }
}


Measured memory_bytes: 256