akhauriyash/Code-Regression huggingface dataset:
/***************************************************
 * Problem Name : A.cpp
 * Problem Link :
 * OJ           :
 * Verdict      : Trying
 * Date         : 2020-05-03
 * Problem Type :
 * Author Name  : Saikat Sharma
 * University   : CSE, MBSTU
 ***************************************************/
#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <climits>
#include <cstring>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <list>
#include <unordered_map>
#include <unordered_set>
#include <cstdlib>
#include <deque>
#include <stack>
#include <bitset>
#include <cassert>
#include <map>
#include <set>
#include <cassert>
#include <iomanip>
#include <random>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef unsigned long long ull;

#define __FastIO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define __FileRead freopen ("input.txt", "r", stdin)
#define __FileWrite freopen ("output.txt", "w", stdout)
#define SET(a,v) memset(a,v,sizeof(a))
#define SZ(v) (int)v.size()
#define pii pair<int,int>
#define pil pair <int, ll>
#define pli pair <ll, int>
#define pll pair <ll, ll>
#define debug cout <<"######\n"
#define debug1(x) cout <<"### " << x << " ###\n"
#define debug2(x,y) cout <<"# " << x <<" : "<< y <<" #\n"
#define nl cout << "\n";
#define sp cout << " ";
#define sl(n) scanf("%lld", &n)
#define sf(n) scanf("%lf", &n)
#define si(n) scanf("%d", &n)
#define ss(n) scanf("%s", n)
#define pf(n) scanf("%d", n)
#define pfl(n) scanf("%lld", n)
#define all(v) v.begin(), v.end()
#define rall(v) v.begin(), v.end()
#define srt(v) sort(v.begin(), v.end())
#define r_srt(v) sort(v.rbegin(), v.rend())
#define rev(v) reverse(v.rbegin(), v.rend())
#define Sqr(x) ((x)*(x))
#define Mod(x, m) ((((x) % (m)) + (m)) % (m))
#define max3(a, b, c) max(a, max(b, c))
#define min3(a, b, c) min(a, min(b, c))
#define pb push_back
#define mk make_pair
#define MAX 100005
#define INF 1000000009
#define MOD 1000000007

template<class T>
using min_heap = priority_queue<T, std::vector<T>, std::greater<T>>;
template<typename T>
using ordered_set  = tree<T, null_type, less<T>, rb_tree_tag,
      tree_order_statistics_node_update>;

template <typename T> string toString ( T Number ) {
    stringstream ss;
    ss << Number;
    return ss.str();
}
template<typename T> int toInt (T str) {
    stringstream ss;
    ss << str;
    int num;
    ss >> num;
    return num;
}
ll lcm ( ll a, ll b ) {
    return ( a / __gcd ( a, b ) ) * b;
}
/************************************ Code Start Here ******************************************************/
int main () {
    //~ __FastIO;
    //~ cout << setprecision (10) << fixed;
    string str;
    cin >> str;

    if (str == "ABC") {
        cout << "ARC\n";

    } else {
        cout << "ABC\n";
    }

    return 0;
}


Measured memory_bytes: 3584
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007 

ll a[52][52];
int main() {
	string s,t;
	cin>>s>>t;
	if(s.size()<t.size()){
		cout << "UNRESTORABLE";
		return 0;
	}
	vector<string> ans;
	for(ll i=s.size()-1;i>=0;i--){
		bool ch=true;
		for(ll j=0;j<t.size();j++){
			if(i+j==s.size()){
				//cout << "k";
				ch=false;
				break;
			}
			if(t[j]!=s[i+j]&&s[i+j]!='?'){
				ch=false;
				break;
			}
		}
		if(ch){
			string now;
			for(ll j=0;j<s.size();j++){
				if(j<i||j>=i+t.size()){
					if(s[j]=='?'){
						now.push_back('a');
					}
					else{
						now.push_back(s[j]);
					}
				}
				else{
					now.push_back(t[j-i]);
				}
			}
			ans.push_back(now);
		}
	}
	if(ans.size()!=0){
		sort(ans.begin(),ans.end());
		cout <<ans[0];
		return 0;
	}
	cout << "UNRESTORABLE";
	// your code goes here
	return 0;
}

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

int main(){
	int w,h;
	string m[110];
	bool f[110][110], flag;
	
	while( cin >> h >> w , w, h ){
		flag = false;
		for(int y=0 ; y<h ; y++){
			m[y].clear();
			for(int x=0 ; x<w ; x++){
				f[y][x] = false;
			}
		}
		for(int y=0 ; y<h ; y++){
			cin >> m[y];
		}
		int x=0, y=0;
		while(1){
			if( m[y][x]=='>' ) x++;
			if( m[y][x]=='<' ) x--;
			if( m[y][x]=='v' ) y++;
			if( m[y][x]=='^' ) y--;
			
			if( m[y][x]=='.' || f[y][x] ){
				if( f[y][x] ) flag = true ;
				break;
			}
			f[y][x] = true;
		}
		(flag)? (cout << "LOOP" << endl) : (cout << x << " " << y << endl); 
	}
	return 0;
}

Measured memory_bytes: 0
/*
     Author: Wasi Ur Rahman
     RMSTU,Rangamati,Chittagong,Bangladesh
*/
#include <bits/stdc++.h>
using namespace std;
#define  gcd(a,b) __gcd(a,b)
#define  lcm(a,b) (a*b)/gcd(a,b)
#define  PI acos(-1.0)
#define  sqr(x) ((x)*(x))
#define  min3(a,b,c) min(a,min(b,c))
#define  min4(a,b,c,d) min(d,min(a,min(b,c)))
#define  max4(a,b,c,d) max(d,max(a,max(b,c)))
typedef   pair<int, int> ii;
typedef   std::vector<ii> vii;
#define   vi   std::vector<int>
#define   vll  std::vector<ll>
#define   all(n) n.begin(),n.end()
#define  mpsi std::map<string, int>
#define  pb             push_back
#define  ll             long long int
#define  ln             printf("\n");
#define  fast           ios::sync_with_stdio(false);cin.tie(0)
#define  max3(a,b,c)    max(a,max(b,c))
#define setbits(x)      __builtin_popcountll(x)
#define zerobits(x)     __builtin_ctzll(x)
#define dec(x,y)        fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());
#define  mod           1e9 + 7;
bool prm[1000001];
void sieve()
{
    prm[0] = prm[1] = 1;
    for(ll i = 4 ; i <= 1000000 ; i += 2)
        prm[i] = 1 ;
    for(ll i = 3 ; i * i <= 1000000 ; i += 2)
    {
        if(!prm[i])
        {
            for(ll j = i * i ; j <= 1000000 ; j+= i + i)
                prm[j] = 1 ;
        }
    }
}
int main()
{
    fast;
    ll n,a,b;
    cin >> n >> a >> b;
    cout << min(n*a,b) << endl;
}


Measured memory_bytes: 256
// Aizu Vol-1 0131: Doctor's Strange Particles
// 2017.9.3 bal4u@uu

#include <stdio.h>
#include <string.h>

char org[12][12], map[12][12], ans[12][12];

void xor(int r, int c)
{
	map[r][c] ^= 1, map[r-1][c] ^= 1, map[r][c-1] ^= 1, map[r+1][c] ^= 1, map[r][c+1] ^= 1;
}

int check()
{
	int r, c;
	for (r = 1; r <= 10; r++) for (c = 1; c <= 10; c++) if (map[r][c]) return 0;
	return 1;
}

int main()
{
	int n, k, r, c, a;

	scanf("%d", &n);
	while (n-- > 0) {
		for (r = 1; r <= 10; r++) for (c = 1; c <= 10; c++) scanf("%d", &a), org[r][c] = a;
		for (k = 0; k < 1024; k++) {
			memcpy(map, org, sizeof(org));
			memset(ans, 0, sizeof(ans));
			for (a = 1, c = 1; c <= 10; c++, a <<= 1) ans[1][c] = ((k & a) == a);
			for (c = 1; c <= 10; c++) if (ans[1][c]) xor(1, c);
			for (r = 2; r <= 10; r++) for (c = 1; c <= 10; c++)
				if (map[r-1][c]) ans[r][c] = 1, xor(r, c);
			
			if (check()) {
				for (r = 1; r <= 10; r++) {
					putchar(ans[r][1] + '0');
					for (c = 2; c <= 10; c++) putchar(' '), putchar(ans[r][c] + '0');
					putchar('\n');
				}
				break;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 1760
def II(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

N=II()
A=LI()
#A.sort()
SA=sum(A)
#print(SA)
AccA=[A[0]]
for i in range(1,N):
  AccA.append(AccA[-1]+A[i])
  
#AccA.reverse()
ans=0
for i in range(N-1):
  ans+=A[i]*(SA-AccA[i])
  ans=ans%(10**9+7)
print(ans)

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

int main() {
  int N,ans,c;
  cin >>N;
  ans=1;
  vector<int>a(N);
  cin>>a[0];
  c=a[0];
   for(int i=1;i<N;i++){
cin>>a[i];
     if(c>a[i]){
       ans++;
       c=a[i];
       continue;
     }
   }
  cout <<ans<< endl;
}

Measured memory_bytes: 1024
#include <iostream>
#include <fstream>
#include <vector>
#include <cmath>
#include <cstdio>
#include <string>
#include <algorithm>
#include <iomanip>
#include <map>
#include <set>
#include <stack>
#include <queue>

using namespace std;
/*
#pragma GCC optimize("Ofast")
#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,popcnt,abm,mmx,tune=native")
#pragma GCC optimize("fast-math")
*/
//#define sqr(qwert) qwert * qwert
#define eb emplace_back
#define pb push_back
#define ld long double
#define ll long long
#define f first
//#define s second
#define deb(a) cerr << #a << " = " << a << '\n';
#define fast() { \
    ios_base::sync_with_stdio(0); \
    cin.tie(0); \
    cout << fixed << setprecision(15); \
    cerr << fixed << setprecision(11); \
}

const int INF = 1e9 + 7;
const ld EPS = 1e-10;
const int MAXI = 20000;
const int MOD = 998244353;
const int MAXST = 2000000;
const int P = 62;
const ld PI = 3.14159265358979323;

int main() {
    ll x, ans = 0, y = 100;
    cin >> x;
    while(y < x){
        y += y/100;
        ans++;
    }
    cout << ans << '\n';
    return 0;
}

Measured memory_bytes: 3540
#include<bits/stdc++.h>
using namespace std;
 
//keep coding
//-Roshan Mitra (SIT Pune) 
typedef vector <int> vi;
typedef pair< int ,int > pii;
#define endl "\n"
#define f0(i,n) for(int i=0;i<n;i++) 
#define f1(i,n) for(int i=1;i<=n;i++)
#define sd(val) scanf("%d",&val)
#define ss(val) scanf("%s",&val)
#define sl(val) scanf("%lld",&val)
#define debug(val) printf("check%d\n",val)
#define all(v) v.begin(),v.end()
#define pb push_back
#define MP make_pair
#define FF first
#define SS second
#define int long long
#define MOD 1000000007
#define clr(val) memset(val,0,sizeof(val))
#define what_is(x) cerr << #x << " is " << x << endl;
#define OJ \
    freopen("input.txt", "r", stdin); \
    freopen("output.txt", "w", stdout);
#define FIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
 int a[100001],b[100001],c[100001];
 int n;
int vacation(int ind , int flag, vector<vector<int>>&dp)
{
    if (ind == n )    return 0;
    if (dp[ind][flag] != -1)   return dp[ind][flag];
    if (flag == 0) //sob select korte parbe
        return dp[ind][flag] = max( a[ind] + vacation(ind + 1, 1, dp) , max( b[ind] + vacation(ind + 1, 2, dp) , c[ind] + vacation(ind + 1, 3, dp) ));
    else if (flag == 1) //b c choose only
        return dp[ind][flag] = max( b[ind] + vacation(ind + 1 , 2, dp) , c[ind] + vacation(ind + 1, 3, dp) );
    else if (flag == 2) //a c choose only
        return dp[ind][flag] = max( a[ind] + vacation(ind + 1 , 1, dp) , c[ind] + vacation(ind + 1, 3, dp) );
    else if (flag == 3) //b a choose only
        return dp[ind][flag] = max( b[ind] + vacation(ind + 1 , 2, dp) , a[ind] + vacation(ind + 1, 1, dp) );
}
signed main()
{

 FIO;
 cin>>n;
for(int i=0;i<n;i++){
        cin>>a[i]>>b[i]>>c[i];
}
 vector<vector<int>>dp(n+1,vector<int>(4,-1));
 cout<<vacation(0,0,dp);
}

Measured memory_bytes: 21924
function Main(input) {
  tmp = input.split("\n");

  var length = parseInt(tmp.shift(), 10);
  var max = 0;
  var next_max = 0;
  var max_index = 0;
  var value = 0;

  for (var i = 0; i < tmp.length; i++) {
    // 1つ目に大きい数字と、2つ目に大きい数字を見つける
    value = parseInt(tmp[i], 10);

    if (max < value) {
      next_max = max;
      max = value;
      max_index = i;
    } else if (next_max < value) {
      next_max = value;
    }
  }

  var answer = "";
  for (var x = 0; x < length; x++) {
    if (x == max_index) {
      answer += (next_max + "\n");
    } else {
      answer += (max + "\n");
    }
  }

  console.log('%s', answer.slice(0, -1));
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 61400
#catupper
N=int(input())
S=input()
#まず、RGBが１個ずつ入るケースの総数を求める、これが最大値、後で引く
r_cnt=S.count('R')
g_cnt=S.count('G')
b_cnt=S.count('B')
ans=r_cnt*g_cnt*b_cnt
#次に、間隔が同じであるものを除外する
for i in range(N):
  for d in range(N):#等差をｄとする
    j=i+d
    k=j+d
    if k>=N:break#最後のｋがN（0始まり）以上なら範囲外
#等号がないと範囲外参照になる、0-indexだからk=S[N]は無い      
    if S[i]!=S[j] and S[i]!=S[k] and S[k]!=S[j]:
      ans-=1#等差となっているケースをマイナスする
      
print(ans)

Measured memory_bytes: 9144
#include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<deque>
#include<regex>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<iomanip>

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

typedef int long long ll;
using namespace std;
typedef pair<int, int> P;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
const ll MOD = 1e9 + 7;
static const int MAX = 100;
static const int INF = (1 << 23);

int main() {
    int n;
    cin>>n;
    vector<int> v(n);
    rep(i,n){
        cin>>v[i];
    }
    int k=0;
    for(int i=0;i<n;i++){
        if(v[i]!=i+1) {
            int p = i + 1;
            int ne = v[v[i] - 1];
            if (ne != p) {
                cout << "NO" << endl;
                return 0;
            }else{
                k++;
            }
        }

    }
    if(k<=2){
    cout<<"YES"<<endl;}
    else{
        cout<<"NO"<<endl;
    }


    return 0;
}


Measured memory_bytes: 256
import numpy as np
n = int(input())
A = np.array(list(map(int, input().split())),dtype=np.longlong)
mod = 7+10**9
cs = 0
for a in A:
    cs += a
    cs %= mod
cumsum = np.mod(np.cumsum(A),mod)
rev = -1*(cumsum-cs)
ans = 0
for i in range(n-1):
    ans += rev[i]*A[i]
    ans %= mod
print(ans)

Measured memory_bytes: 49760
N = int(input())
H = list(map(int,input().split()))

# highest_height[i]は西から0,1,...,i番目のうち最も高い山の高さ
highest_height = [H[0]]
for i in range(1,N):
    highest_height.append(max(highest_height[-1],H[i]))

ans = 0
for i in range(N):
    if H[i] >= highest_height[i]:
        ans += 1

print(ans)

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

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

  int ans = 0;

  for (int i = 0; i < 4; i++)
  {
    S.at(i) == '+' ? ans++ : ans--;
  }

  cout << ans << endl;
}


Measured memory_bytes: 3584
#include <bits/stdc++.h>
    using namespace std;
    using Int = long long;
    int main() {
        ios::sync_with_stdio(false);
        cin.tie(nullptr);
        int N, M; cin >> N >> M;
        vector<vector<int>> G(N);
        for (int i = 0; i < M; i++) {
            int S, T; cin >> S >> T; S--, T--;
            G[S].push_back(T);
        }
        vector<double> X(N), P(N);
        P[0] = 1.0;
        for (int node = 0; node < N; node++) {
            for (auto next : G[node]) {
                P[next] += P[node] / G[node].size();
            }
        }
        X[N - 1] = 0;
        for (int node = N - 2; node >= 0; node--) {
            double sum = 0;
            for (auto next : G[node]) {
                sum += X[next];
            }
            X[node] = 1 + sum / G[node].size();
        }
        double orig = X[0];
        double ans = orig;
        for (int node = N - 2; node >= 0; node--) {
            if (G[node].size() == 1) continue;
            double sum = 0;
            double maxval = 0;
            for (auto next : G[node]) {
                sum += X[next];
                maxval = max(maxval, X[next]);
            }
            double ans2 = orig + P[node] * (-sum / G[node].size() + (sum - maxval) / (G[node].size() - 1));
            ans = min(ans, ans2);
        }
        cout << fixed << setprecision(9) << ans << endl;
        return 0;
    }

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

#define rep(i,n) for(long long i = 0; i < (long long)(n); i++)
#define repi(i,a,b) for(long long i = (long long)(a); i < (long long)(b); i++)
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define fi first
#define se second
#define mt make_tuple
#define mp make_pair
template<class T1, class T2> bool chmin(T1 &a, T2 b) { return b < a && (a = b, true); }
template<class T1, class T2> bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }

using ll = long long; using vll = vector<ll>; using vvll = vector<vll>; using P = pair<ll, ll>;
using ld = long double;  using vld = vector<ld>; 

int main(void) {
	ll n;	cin >>n;
	
	if(n<1000) cout <<"ABC"<<endl;
	else cout <<"ABD"<<endl;
	
	
    return 0;
}

Measured memory_bytes: 256
#include <vector>
#include <algorithm>
#include <math.h>
#include <iostream>
using namespace std;
typedef pair<int, int> P;
const int MAXN = 105;
const int INF = (int)1e9;

int dist[MAXN][MAXN];

int main() {
  int n, m;
  cin >> n >> m;

  for (int i = 0; i  < n; ++i) {
    for (int j = 0; j < n; ++j) {
      if (i == j) dist[i][j] = 0;
      else dist[i][j] = INF;
    }
  }

  vector< pair<pair<int, int>, int> > abc(m);
  for (int i = 0; i < m; ++i) {
    int a, b, c;
    cin >> a >> b >> c;
    a--; b--;
    abc[i] = make_pair(make_pair(a, b), c);
    dist[a][b] = c;
    dist[b][a] = c;
  }

  for (int k = 0; k < n; ++k) {
    for (int i = 0; i < n; ++i) {
      for (int j = 0; j < n; ++j) {
	dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);
      }
    }
  }

  int ans = 0;
  for (auto e: abc) {
    if (dist[e.first.first][e.first.second] < e.second && dist[e.first.second][e.first.first] < e.second) ans++;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 508
import std.stdio;
import std.ascii;
import std.range;
import std.array;
import std.functional;
import std.algorithm;
import std.conv;
import std.container;
import std.math;
import std.numeric;
import std.string;
import std.c.string;
import std.random;
import std.regex;
import std.typecons;

int[char] score;
static this() {
    for (char c = '2'; c <= '9'; c++) score[c] = cast(int)(c - '0');
    score['T'] = 10;
    score['J'] = 11;
    score['Q'] = 12;
    score['K'] = 13;
    score['A'] = 14;
}

char T;

/* s < t ? */
bool compare(in string s, in string t) {
    if (s[1] == T) {
        if (t[1] == T) {
            return score[ s[0] ] < score[ t[0] ];
        } else {
            return false;
        }
    } else {
        if (t[1] == T) {
            return true;
        } else {
            return score[ s[0] ] < score[ t[0] ];
        }
    }
}

string[][] F;

bool input() {
    T = readln.chomp[0];
    if (T == '#') return false;
    F = new string[][4];
    foreach (i; 0 .. 4) {
        F[i] = readln.chomp.split(" ").array;
    }
    return true;
}

void solve() {
    auto ans = new int[2];
    int prev = 0;
    foreach (i; 0 .. 13) {
        int w = -1;
        foreach (j; 0 .. 4) {
            if (F[j][i][1] == T) {
                if (w < 0) w = j;
                else if (score[ F[w][i][0] ] < score[ F[j][i][0] ]) w = j;
            }
        }
        if (w >= 0) {
            ans[w & 1]++;
            prev = w;
            continue;
        }

        auto suit = F[prev][i][1];
        w = prev;
        foreach (j; 0 .. 4) {
            if (F[j][i][1] != suit) continue;
            if (score[ F[w][i][0] ] < score[ F[j][i][0] ]) w = j;
        }
        ans[w & 1]++;
        prev = w;
    }
    writeln(ans[0] < ans[1] ? "EW": "NS", " ", max(ans[0], ans[1]) - 6);
}

void main() {
    while (input) solve;
}

Measured memory_bytes: 1284
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>   
using namespace std;
using namespace __gnu_pbds;
typedef long long ll; 
#define int long long
typedef unsigned long long lu;
typedef vector<ll> v;
typedef vector<vector<ll> > vv;
typedef vector<string>  vs;
typedef vector<pair<ll,ll>> vpr;
typedef long double ld;
#define f(i,n) for(ll i = 0; i < n; i++)
#define ff(i,n) for(ll i=1;i<=n;i++)
#define pb push_back
#define mp make_pair
#define endl "\n"
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define amax(x,y) if(y>x) x=y;
#define amin(x,y) if(y<x)x=y;
#define bg(x) x.begin()
#define sz(x) (ll)x.size()
#define in(x,n) for(ll i=0;i<n;i++)cin>>x[i]
#define out(x,n) for(ll i=0;i<n;i++)cout<<x[i]<<" " 
#define mxt(a) *(max_element(a.begin(),a.end()))
#define mnt(a) *(min_element(a.begin(),a.end())
#define tc ll t;cin>>t;while(t--)
typedef pair<ll,ll> pi;
#define yes cout<<"YES\n";
#define no cout<<"NO\n";
#define yesno(f) if(f) yes else no
const v dx = {1, -1, 0, 0};
const v dy = {0, 0, 1, -1};
const ld PI = 2 * acos(0.0);
ll cel(ll x1,ll y1){if((x1%y1)==0)return x1/y1;else return x1/y1+1;}
ll power(ll a,ll b,ll m)
{
    if(b==0)
        return 1;
    ll d=power(a,b/2,m);
    d=(d*d)%m;
    if(b&1)
        d=(d*a)%m;
    return d;
}
const ll mod=1e9+7;
int MOD(int a)
{
    if(a<0)
        a+=mod;
    if(a>=mod)
        a%=mod;
    return a;
}
// set_name.find_by_order(k) It returns to an iterator to the kth element (counting from zero) in the set in O(logn) time
// set_name.order_of_key(k) It returns to the number of items that are strictly smaller than our item k in O(logn) time.
/*string operations :
str.substr (x,y) : returns a substring str[x],str[x+1],...str[x+y-1]
str.substr (x) : returns a substring str[x],... end of string
str.find(qtr) : returns the first occurenece of qtr in str */
int32_t main()
{
 
    ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
    int a,v,b,w,t;cin>>a>>v>>b>>w>>t;
    int speed=v-w;
    int dist=abs(a-b);
    int dist2=t*speed;
    yesno(dist2 >=dist);


    return 0;
}

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

using namespace std;

#define FOR(i,n) for(int i=0; i<n; ++i)
#define FORR(i,a,n) for(int i=a; i<n; ++i)
#define ALL(c) (c).begin(), (c).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))

const int INF = 0x3f3f3f3f;

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<string> VS;
typedef pair<int,int> PI;
typedef pair<ll,ll> PL;
 
//int in() { int x; scanf("%d", &x); return x; }
//ll lin() { ll x; scanf("%lld", &x); return x; }
//void printfv(VI a){ int n = a.size(); FOR(i, n) cout << a[i] << " "; }

int main(void){

    char c;
    cin >> c;

    cout << static_cast<char>(c + 1);    

    return 0;
}


Measured memory_bytes: 256
import collections
import heapq
def main():

    N = int(input())

    RL = collections.defaultdict(list)
    UD = collections.defaultdict(list)
    UL = collections.defaultdict(list)
    UR = collections.defaultdict(list)
    DL = collections.defaultdict(list)
    DR = collections.defaultdict(list)
    for _ in range(N):
        X, Y, U = input().split()
        X = int(X)
        Y = int(Y)
        if U == 'R':
            RL[Y].append([X, 0])
            UR[X+Y].append([X, 0])
            DR[X-Y].append([X, 0])
        elif U == 'L':
            RL[Y].append([X, 1])
            UL[X-Y].append([X, 1])
            DL[X+Y].append([X, 1])
        elif U == 'U':
            UD[X].append([Y, 0])
            UL[X-Y].append([X, 0])
            UR[X+Y].append([X, 1])
        else:
            UD[X].append([Y, 1])
            DL[X+Y].append([X, 0])
            DR[X-Y].append([X, 1])
    # print(horizontal)
    # print(vertical)

    ans = float('inf')
    for V in [UL, UR, DL, DR]:
        for X in V:
            V[X].sort()
            for j in range(len(V[X])-1):
                if V[X][j][1] == 0 and V[X][j+1][1] == 1:
                    ans = min(ans, 10 * (V[X][j+1][0]- V[X][j][0]))
    for V in [UD, RL]:
        for X in V:
            V[X].sort()
            for j in range(len(V[X])-1):
                if V[X][j][1] == 0 and V[X][j+1][1] == 1:
                    ans = min(ans, 5 * (V[X][j+1][0]- V[X][j][0]))

    if ans == float('inf'): return "SAFE"
    return ans

if __name__ == '__main__':
    print(main())

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

typedef vector< vector<int> > vvi;
typedef vector< vector<bool> > vvb;
typedef vector< vector<char> > vvc;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef long long ll;

int main(){
    int n;
    cin >> n;
    vc c(n);
    for(int i=0;i<n;i++){
        cin >> c[i];
    }
    int left=-1,right=n;
    int ans=-1;
    while(left<=right){
        while(1){
            left++;
            if(left==n){
                break;
            }
            if(c[left]=='W') break;
        }
        while(1){
            right--;
            if(right==-1){
                break;
            }
            if(c[right]=='R') break;
        }
        ans++;
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3596
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define fi first
#define se second
int n,m;
ll a[100001];
ll b[100001];
int main(){
	ios::sync_with_stdio(false);
	cin >> n;
	for(int i=0; i<=n ;i++){
		cin >> a[i];
		if(i!=0) b[i]=min((ll)1e18,b[i-1]*2-a[i]);
		else b[i]=1-a[i];
	}
	ll ans=0;
	ll cur=0;
	for(int i=n; i>=1 ;i--){
		cur+=a[i];
		ans+=cur;
		if(b[i-1]*2<cur) return cout << "-1\n",0;
		cur=min(cur,b[i-1]);
	}
	if(cur+a[0]!=1) cout << "-1\n";
	else cout << ans+1 << endl;
}

Measured memory_bytes: 5204
#include<bits/stdc++.h>
using namespace std;
int main()
{
  long long a, b, k , count = 0 ;
  cin >> k >> a >> b ;
  for(int i = a ; i <= b ; i++)
  {
    if( i % k == 0 )
    {
      count++;
      break;
    }
  }
  if(count) cout << "OK" << endl ;
  else cout << "NG" << endl ;
}

Measured memory_bytes: 3636
n = int(input())
a = list(map(int, input().split()))
mod = 10 ** 9 + 7
num_map = [0] * ((n + 2 - 1) // 2)
for i in range(n):
    num_map[a[i] // 2] += 1

res = 2 - n % 2
if num_map[0] != 2 - n % 2:
    print(0)
else:
    for i in range(1, (n + 2 - 1) // 2):
        if num_map[i] != 2:
            print(0)
            break
        else:
            res = res * 2 % mod
    else:
        print(res)


Measured memory_bytes: 20580
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll ZERO = 0;
const int Inf = 1000000000;
const ll INF= 1e18;
const ll MOD = 1000000007;
const double PI = 3.1415926535897;
typedef pair<ll,ll> P;

int main() {
    int N,M;
    cin >> N >> M;
    vector<int> vec(N);
    for(int i = 0;i < M;i++) {
        int A,B;
        cin >> A >> B;
        A--;
        B--;
        vec.at(A)++;
        vec.at(B)++;
    }
    bool ret = true;
    for(int i = 0;i < N;i++) {
        if(vec.at(i) % 2 == 1) {
            ret = false;
        }
    }
    if(ret == true) {
        cout << "YES" << endl;
    }
    else {
        cout << "NO" << endl;
    }
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define drep(i,n) for(int i = (n-1); i >= 0; i--)
#define all(v) (v).begin(),(v).end()
template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template <class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
template <class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template <class T> T lcm(T a, T b) { return a/gcd(a,b)*b; }
typedef pair<int, int> P;
typedef long long ll;
const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;
const ll MOD = 1e9+7;

int a[] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
int main() {
	int k;
	cin >> k;
	cout << a[k-1] << endl;
	return 0;
}


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

int main() {
	int x, y, a, b, c; cin>>x>>y>>a>>b>>c;
	vector<ll> p(a), q(b), r(c);
	for (int i = 0; i < a; ++i) cin >> p[i];
	for (int i = 0; i < b; ++i) cin >> q[i];
	for (int i = 0; i < c; ++i) cin >> r[i];
	sort(p.begin(), p.end());
	sort(q.begin(), q.end());
	sort(r.begin(), r.end());

	int pi = a-x, qi = b-y, ri = c-1;
	while ((pi<a && ri>=0 && p[pi]<r[ri]) || (qi<b && ri>=0 && q[qi]<r[ri])) {
		if (pi<a && qi<b) {
			if (p[pi] < q[qi]) ++pi;
			else ++qi;
		}
		else if (pi<a) ++pi;
		else if (qi<b) ++qi;
		--ri;
	}

	ll total = 0;
	for (int i = pi; i < a; ++i) total += p[i];
	for (int i = qi; i < b; ++i) total += q[i];
	for (int i = ri+1; i < c; ++i) total += r[i];
	cout << total << endl;
}

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

int main(){
  int N, K;
  cin >> N >> K;
  vector<int> a(N);
  int ans=0;
  for(int i = 0; i < N; i++){
    cin >> a.at(i);
  }
  sort(a.begin(),a.end());
  reverse(a.begin(),a.end());
  for(int i = 0; i < K; i++){
    ans += a.at(i);
  }
  cout << ans;
}


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

using namespace std;

int main() {
  string S;
  long long K;
  cin >> S >> K;
  int len = S.length();

  vector<bool> change(len);
  int count = 0;
  for (int i = 1; i < len; i++) {
    if (!change[i - 1] and S[i - 1] == S[i]) {
      change[i] = true;
      count++;
    }
  }
  vector<bool> change2(len);
  int count2 = 1;
  change2[0] = true;
  for (int i = 2; i < len; i++) {
    if (!change2[i - 1] and S[i - 1] == S[i]) {
      change2[i] = true;
      count2++;
    }
  }
  long long ans;
  if (S[0] != S[len - 1]) {
    ans = count * K;
  } else {
    if (change[len - 1]) {
      ans = count * K;
    } else if (change2[len - 1]) {
      ans = count * (K - K / 2) + count2 * (K / 2);
    } else {
      ans = count + count2 * (K - 1);
    }
  }
  cout << ans << endl;

  return 0;
}


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

int main() {
    ll n,k;
    cin >> n >> k;
    ll ans=0;
    for(ll j=k;j<n+2;++j){
        ll n_max,n_min;
        n_max = n*(n+1)/2-(n-j)*(n-j+1)/2; // nの合計max
        n_min = ((j-1)*j/2); //nの合計min
        ans +=  n_max - n_min + 1;  //差分
        ans %= (1000000000 + 7);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3632
from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
import itertools
from itertools import permutations, combinations, accumulate
import sys
import bisect
import string
import math
import time


def I(): return int(input())


def S(): return input()


def MI(): return map(int, input().split())


def MS(): return map(str, input().split())


def LI(): return [int(i) for i in input().split()]


def LI_(): return [int(i)-1 for i in input().split()]


def StoI(): return [ord(i)-97 for i in input()]


def ItoS(nn): return chr(nn+97)


def input(): return sys.stdin.readline().rstrip()


def show(*inp, end='\n'):
    if show_flg:
        print(*inp, end=end)


def print_matrix(mat):
    for i in range(len(mat)):
        print(*mat[i])


yn = {False: 'No', True: 'Yes'}
YN = {False: 'NO', True: 'YES'}
MOD = 10**9+7
inf = float('inf')
IINF = 10**10
l_alp = string.ascii_lowercase
u_alp = string.ascii_uppercase
ts = time.time()
sys.setrecursionlimit(10**6)
nums = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10']

show_flg = False
# show_flg = True


def main():
    N = I()
    a = LI()
    b = LI()

    plus = 0
    minus = 0
    for i in range(N):
        if a[i] > b[i]:
            plus += a[i] - b[i]
        else:
            minus += (b[i] - a[i]) // 2

    # print(plus, minus)
    print(yn[plus <= minus])


if __name__ == '__main__':
    main()


Measured memory_bytes: 40940
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  long n,fn=0;
  cin >> n;
  for(long i=1;i<=n;i*=10) {
    fn+=n/i%10;
  }
  if(n%fn==0) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 3572
using System;

namespace ITP1_8_B
{
    class Program
    {
        static void Main(string[] args)
        {
            while (true)
            {
                string str = Console.ReadLine();
                if (str.Equals("0")) break;
                int sum = 0;
                foreach (var c in str)
                {
                    sum += c - '0';
                }
                Console.WriteLine(sum);
            }
        }
    }
}

Measured memory_bytes: 9032
#include <bits/stdc++.h>
#include <algorithm>
using namespace std;
 
long long gcd(long long a,long long b){
  if(b == 0) return a;
  return gcd(b,a%b);
}

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

int main(){
  
  long long int a,b[200010],c[200010];
  cin >>a;
  
   for(int i=0;i<a;i++){
     cin >> b[i];
     c[i] = b[i];
   }
  
 sort(b,b+a,greater<int>());
  
  for(int i=0;i<a;i++){
 
    if(c[i] == b[0]){
      cout << b[1] << endl;
    }
    
    else{
      cout << b[0] << endl;
    }
  }
}


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

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

typedef long long ll;
typedef pair<int, int> P;
typedef pair<int, P> PP;

#define MAX 1000000020
#define INF 1e18

int main(int, char**)
{
  int n;
  cin >> n;
  vector<ll> x(n), y(n), p(n);
  rep(i,n) cin >> x[i] >> y[i] >> p[i];

  vector< vector<ll> > costx(n, vector<ll>(1<<n));
  vector< vector<ll> > costy(n, vector<ll>(1<<n));
  rep(i,n) {
    rep(j,1<<n) {
      costx[i][j] = abs(x[i])*p[i];
      costy[i][j] = abs(y[i])*p[i];
      rep(k,n) {
        if (j&1<<k) {
          costx[i][j] = min(costx[i][j], abs(x[i] - x[k])*p[i]);
          costy[i][j] = min(costy[i][j], abs(y[i] - y[k])*p[i]);
        }
      }
    }
  }

  vector<ll> ans(n+1,INF);
  rep(i,pow(3,n)) {
    int xx = 0, yy = 0;
    int tmp = i;
    int k = 0;
    int cnt = 0;
    while (tmp > 0) {
      if (tmp%3==1) xx |= 1<<cnt;
      if (tmp%3==2) yy |= 1<<cnt;
      if (tmp%3!=0) k++;
      cnt++;
      tmp /= 3;
    }
    ll dis = 0;
    rep(j,n) {
      dis += min(costx[j][xx],costy[j][yy]);
    }
    ans[k] = min(ans[k],dis);  
  }
  rep(i,n+1) cout << ans[i] << endl;

  return 0;
}


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

//--------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define LL long long
#define INF INT_MAX/3

//--------------------------------------------
const double EPS = 1e-14;
const double PI  = acos(-1.0);

//--------------------------------------------

LL arr[90];

LL lucas(int n) {
  switch (n) {
    case 0:
      return arr[n] = 2LL;
      break;
    case 1:
      return arr[n] = 1LL;
      break;
    default:
      if (arr[n - 2] != 0)
        return arr[n] = arr[n - 2] + lucas(n - 1);
      else
        return arr[n] = lucas(n - 2) + lucas(n - 1);
  }
}

int main(){
  int n;

  scanf("%d", &n);

  REP (i, n) {
    arr[i] = 0LL;
  }

  printf("%lld\n", lucas(n));
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
using namespace std;
inline int read()
{
    int n = 0 , c = 0, m;
    while (!isdigit(c)) m = c - 45 ? 1 : -1 , c = getchar();
    while (isdigit(c))  n = n * 10 + c - 48 , c = getchar();
    return m * n;
}
const int N = 1e6 + 1;

main()
{
    int a = read() , b = read();
    cout << 2 * b - a;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <cstdio>
#include <complex>
#include <numeric>
#include <string.h>
#include <random>
#include <cmath>
#include <unordered_map>
#include <unordered_set>
#include <chrono>
#include <cassert>
#define rep(i,n) for (ll i = 0; i < (ll)n; i++)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<pi, pi> pp;
typedef pair<ll, ll> pl;
double PI = 3.141592653589793238462643383279;
const double EPS = 1e-9;
const ll MOD = 1000000007;
//const ll MOD = 998244353;
const int inf = 1 << 30;
const ll linf = 1LL << 60;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string str;
    cin >> str;
    if (str.size()%2) {
        cout << "No" << endl;
    } else {
        for (int i = 0; i < str.size(); i+=2) {
            if (str[i] != 'h' || str[i+1] != 'i') {
                cout << "No" << endl;
                return 0;
            }
        }
        cout << "Yes" << endl;
    }
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#ifdef LOCAL
#define debug(x)   cerr<<#x<<" = "<<x<<endl
#else
#define debug(x) 
#endif
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define input_from_file freopen("input.txt","r",stdin)
#define output_to_file freopen("output.txt" , "w",stdout)
#define pii pair<int,int>
#define endl '\n'
#define pb push_back
#define fi first
#define se second 
#define mp make_pair
#define int long long
const int inf = 1e18 + 5;
signed main()
{
    #ifdef LOCAL
        input_from_file;
        output_to_file;
    #endif 
    IOS
    int n,m; cin>>n>>m;
    bool visited[n+1];
    int penalty[n+1];
    memset(visited,0,sizeof(visited));
    memset(penalty,0,sizeof(penalty));
    int pen = 0,cor = 0;
    for(int i=0;i<m;i++)
    {
        int pn; string st;
        cin>>pn; cin>>st;
        if(visited[pn] == 0 && st == "WA")
        {
            penalty[pn]++;
        }
        else if(visited[pn] == 0 && st == "AC"){
            cor++;
            visited[pn] = 1;
        }
    }
    for(int i=1;i<=n;i++)
    {
        if(visited[i] == 1) pen += penalty[i];
    }
    cout<<cor<<" "<<pen<<endl;
    return 0;
}

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

int main(){

    int a, b, c, area;

    scanf("%d %d %d", &a, &b, &c);
    area = (a + b + c) / 2;
    area = sqrt(area * (area - a) * (area - b) * (area - c));
    printf("%d\n", area);
    return 0;
}

Measured memory_bytes: 128
/**
*	created: 22.08.2020 21:01:55
**/
#include <bits/stdc++.h>
// #include <boost/multiprecision/cpp_int.hpp>
// using bint = boost::multiprecision::cpp_int;
using namespace std;
using ll = long long;
using P = pair<int,int>;
// #define endl '\n'
#define int long long
#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++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define pcnt(bit) __builtin_popcountll(bit)
template<class T> bool chmax(T &a, const T &b) {if (a < b) {a = b; return 1;} return 0;}
template<class T> bool chmin(T &a, const T &b) {if (b < a) {a = b; return 1;} return 0;}
const long double pi = acos(-1.0);
const int MAX = 1000010;
const int INF = 1ll << 60;
const int MOD = 1000000007;
// const int MOD = 998244353;

signed main() {

    cin.tie(0);
    ios_base::sync_with_stdio(false);

    string s; cin >> s;
    int n = s.size();
    int sum = 0;
    auto ctoi = [&] (char c) {
        if (c >= '0' && c <= '9') return c - '0';
        return -1;
    };
    rep(i,n) {sum += ctoi(s[i]); sum %= 9;}
    if (sum == 0) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 3740
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <cmath>
#include <tuple>
#include <cstdio>
#include <bitset>
#include <sstream>
#include <iterator>
#include <numeric>
#include <map>
#include <cstring>
#include <set>
#include <functional>
#include <iomanip>

using namespace std;

#define DEBUG_ //!!提出時にコメントアウト!!
#ifdef DEBUG_
	#define dump(x)  cerr << #x << " = " << (x) << endl;
#else
	#define dump(x)  ;
#endif

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SZ(x) ((int)(x).size())
#define pb push_back
#define eb emplace_back

//#define int long long

typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;

template <typename T>
std::string printVector(const std::vector<T> &data)
{
    std::stringstream ss;
    std::ostream_iterator<T> out_it(ss, ", ");
    ss << "[";
    std::copy(data.begin(), data.end() - 1, out_it);
    ss << data.back() << "]";
    return ss.str();
}

const int MOD = 1e9+7;
const LL LINF = 1001002003004005006ll;
const int INF = 1001001001;

vector<pair<long long, long long> > prime_factorize(long long n) {
    vector<pair<long long, long long> > res;
    for (long long p = 2; p * p <= n; ++p) {
        if (n % p != 0) continue;
        int num = 0;
        while (n % p == 0) { ++num; n /= p; }
        res.push_back(make_pair(p, num));
    }
    if (n != 1) res.push_back(make_pair(n, 1));
    return res;
}

signed main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(12);
    LL S; cin >> S;
    if(S%LL(1e9) == 0){
                cout << 0 <<" "<< 0<<" " << LL(1e9) <<" "<< 0 <<" "<< 0 <<" "<< S/LL(1e9) << endl;

    }
    else if(S > LL(1e9)){
        //LL a = S % LL(1e9);
        LL c = S / LL(1e9) + 1;
        LL a = c * LL(1e9) - S;
        cout << 0 <<" "<< 0 <<" "<< a <<" "<< c <<" "<< LL(1e9) <<" "<<  1 << endl;
    }
    else if(S % LL(1e5) == 0){
                cout << 0 <<" "<< 0<<" " << LL(1e5) <<" "<< 0 <<" "<< 0 <<" "<< S/LL(1e5) << endl;

    }
    else if(S > LL(1e5)){
        LL c = S / LL(1e5) + 1;
        LL a = c * LL(1e5) - S;

        cout << 0 <<" "<< 0 <<" "<< a <<" "<< c <<" "<< LL(1e5) <<" "<< 1 << endl;

    }
    else{
        for(LL i = 1; i*i <= S; i++){
            if(S%i == 0){
                cout << 0 <<" "<< 0<<" " << i <<" "<< 0 <<" "<< 0 <<" "<< S/i << endl;
                return 0;
            }
        }
    }




}


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

int main()
{
  int K;
  cin >> K;
  string S;
  cin >> S;

  if( (int)S.size() <= K ){
    cout << S;
  }
  else{
    string SS;
    for( int i = 0; i < K; i++){
       SS += S[i];
    }
    cout << SS + "...";
  }

  return 0;
}


Measured memory_bytes: 3636
//404 - Not Found {=}7 (x)7 (o)7
#include <bits/stdc++.h>
using namespace std;

#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math")
#define append push_back
#define endl "\n"
#define dbug(x) cerr << #x << "=" << x << endl
typedef long long int ll;
typedef pair<int, int> pii;
typedef long double ld;
typedef unsigned long long int ull;
const int maxn = 3e3 + 10, mod = 1e9 + 7;
int a[maxn];
vector<int> adl[maxn];
bool win[maxn];
bool dfs(int x, int p = -1)
{
	for (int y : adl[x])
	{
		if (y == p)
			continue;
		if (a[y] < a[x] && !dfs(y, x))
		{
			return true;
		}
	}
	return false;
}
/*5
5 4 1 2 3
1 2
1 3
2 4
2 5
*/
int main()
{
	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	cout << setprecision(30);
	int n;
	cin >> n;
	for (int i = 0; i < n; i++)
		cin >> a[i];
	for (int i = 0; i < n - 1; i++)
	{
		int x, y;
		cin >> x >> y;
		x--, y--;
		adl[x].append(y);
		adl[y].append(x);
	}
	dfs(0);
	for (int i = 0; i < n; i++)
		if (dfs(i))
			cout << i + 1 << ' ';
	return 0;
}

Measured memory_bytes: 512
def actual(N, D):
    # バケット法
    bucket = dict()

    for num in D:
        if num in bucket.keys():
            bucket[num] += 1
        else:
            bucket[num] = 1

    return len(bucket)

N = int(input())
D = [int(input()) for _ in range(N)]

print(actual(N, D))

Measured memory_bytes: 9172
#include<iostream>
#include<cmath>
#include<algorithm>

using namespace std;

int main(){
int N,K;
cin >> N >> K;
int a[N];
for(int i=0;i<N;i++){
cin >> a[i];
}
sort(a,a+N);
int ans=0;
for(int j=0;j<K;j++){
ans+=a[N-j-1];
}
cout << ans << endl;

return 0;
}




Measured memory_bytes: 256
#include<stdio.h>


int main(void)
{
    char mus[200];
    char S[100];
    char T[100];
    int i, N;
    char bin;

    scanf("%d", &N);
    scanf("%c", &bin);

    for (i = 0; i < N; i++) {
        scanf("%c", &S[i]);
    }
    scanf("%c", &bin);

    for (i = 0; i < N; i++) {
        scanf("%c", &T[i]);
    }


    for (i = 0; i < N; i++) {
        printf("%c%c",S[i], T[i]);
    }


    return 0;

}

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

int main(){
    int x,y;
    cin >> x >> y;
    string ans;
    if((4*x-y)>=0 && (-2*x+y)>=0 && y%2==0){
        ans = "Yes";
    }else{
        ans = "No";
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3628
fun main(args: Array<String>) {
    val n = readInputLine().toInt()
    
    val ws = mutableListOf<String>()
    
    var lastChar = '-'
    
    for (i in 0 until n) {
        val w = readInputLine()
        if (ws.contains(w)) {
            println("No")
            return
        }
        if (i != 0 && w.get(0) != lastChar) {
            println("No")
            return
        }
        
        lastChar = w.get(w.lastIndex)
        ws.add(w)
    }

    println("Yes")
}
 
fun readInputLine(): String {
    return readLine()!!
}


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

// TYPEDEF
// ----------------------------------------
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> Pair;
typedef vector<ll> vll;
typedef vector<vector<ll>> Graph;
typedef vector<string> vs;
typedef vector<pair<ll, ll>> Pll;
typedef queue<ll> qll;

// REPEAT
// ----------------------------------------
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define REPA(i,a) for(ll i=0;i<(ll)(a.size());i++);
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define COUT(a) cout << (a) << endl;
#define ENDL(a) cout << endl;
#define COUTA(i,a) for(ll i=0;i<(ll)(a.size());i++) {cout << (a)[i] << " ";} cout << endl;

// UTIL
// ----------------------------------------
#define pb push_back
#define paired make_pair
#define ALL(a) (a).begin(),(a).end()
#define SORT(a) sort((a).begin(),(a).end())
#define RSORT(a) sort((a).rbegin(), (a).rend())

// DEBUG
// ----------------------------------------
#ifdef _DEBUG
#define debug(x) cout << "[debug] " << #x << ": " << x << endl
#else
#define debug(x)
#endif

template <typename T>
void debugV(const vector<T> v) {
#ifdef _DEBUG
  rep(i, v.size()) {
    cout << i << ":" << v[i] << " ";
  }
  cout << endl;
#else
  (void)v;
#endif
}

// BIT FLAG
// ----------------------------------------
const unsigned int BIT_FLAG_0 = (1 << 0); // 0000 0000 0000 0001
const unsigned int BIT_FLAG_1 = (1 << 1); // 0000 0000 0000 0010
const unsigned int BIT_FLAG_2 = (1 << 2); // 0000 0000 0000 0100
const unsigned int BIT_FLAG_3 = (1 << 3); // 0000 0000 0000 1000
const unsigned int BIT_FLAG_4 = (1 << 4); // 0000 0000 0001 0000
const unsigned int BIT_FLAG_5 = (1 << 5); // 0000 0000 0010 0000
const unsigned int BIT_FLAG_6 = (1 << 6); // 0000 0000 0100 0000
const unsigned int BIT_FLAG_7 = (1 << 7); // 0000 0000 1000 0000
const unsigned int BIT_FLAG_8 = (1 << 8); // 0000 0001 0000 0000
const unsigned int BIT_FLAG_9 = (1 << 9); // 0000 0010 0000 0000
const unsigned int BIT_FLAG_10 = (1 << 10); // 0000 0100 0000 0000
const unsigned int BIT_FLAG_11 = (1 << 11); // 0000 1000 0000 0000

// CONST
// ----------------------------------------
constexpr ll INF = 0x3f3f3f3f3f3f3f3f;
constexpr double PI=3.14159265358979323846; // or M_PI
constexpr int MOD = 1000000007;


void Main() {
  ll a, b;
  cin >> a >> b;
  if ((a + b) % 2 == 0) {
    COUT((a + b) / 2);
  }
  else {
    COUT("IMPOSSIBLE");
  }
}

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

/*

3 2
*/


Measured memory_bytes: 3612