akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AtCoder
{
    class Program
    {
        private const int MODULO = 1000000007;
        private static string Read() { return Console.ReadLine(); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }

        static Tuple<int, int, int> Solve(int N, int Y)
        {
            int a = Y / 10000;
            int b = (Y % 10000) / 5000;
            int c = (Y % 5000) / 1000;
            {
                int n = Math.Min((N - (a + b + c)) / 9, a);
                a -= n;
                c += n * 10;
            }
            {
                int n = Math.Min((N - (a + b + c)) / 4, b);
                b -= n;
                c += n * 5;
            }
            {
                int n = Math.Min(N - (a + b + c), a);
                a -= n;
                b += n * 2;
            }
            return (new[] { a, b, c }.Min() >= 0 && a + b + c == N) ? new Tuple<int, int, int>(a, b, c)
                                                                    : new Tuple<int, int, int>(-1, -1, -1);
        }
        static void Main(string[] args)
        {
            int[] v = ReadInts();
            var t = Solve(v[0], v[1]);
            Console.WriteLine("{0} {1} {2}", t.Item1, t.Item2, t.Item3);
        }
    }
}


Measured memory_bytes: 13268
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define MAX_N 100000
#define MAX_M 100000
const int MAX = 100100;
const int MOD = 1000000007;
#define vec vector<int>
#define vecll vector<ll>
#define vecllvec vector<vector<ll>>
#define vecb vector<bool>
#define vecBvec vector<vector<bool>>
#define vecst vector<string>
#define vecch vector<char>
#define vecd vector<double>
#define vecvec vector<vector<int>>
#define vecDvec vector<vector<double>>
#define vecHvec vector<vector<char>>
#define all(x) (x).begin(),(x).end()
const long long INF = 1LL<<60;
#define PI 3.141592653589793
// cout << setprecision(15) << std::fixed;

// もしかしてACですかぁ～～？！　Yse!! Yse!! Yse!!

int main() {
  ll n,m,ans=0;
  cin>>n>>m;
  if(n==m){
    if(n==1) ans+=400000+600000;
    if(n==2) ans+=400000;
    if(n==3) ans+=200000;
  }
  else{
    if(n==1||m==1) ans+=300000;
    if(n==2||m==2) ans+=200000;
    if(n==3||m==3) ans+=100000;
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <stdio.h>

int main (void)
{
	int month[12] = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
	int m, d;
	int count;
	int i;
	
	while (1){
		count = 0;
		scanf("%d %d", &m, &d);
		
		if (m == 0){
			break;
		}
		
		for (i = 0; i < m - 1; i++){
			count += month[i];
		}
		
		count += d;
		
		switch (count % 7){
			case 1:
			  printf("Thursday\n");
			  break;
			
			case 2:
			  printf("Friday\n");
			  break;
			
			case 3:
			  printf("Saturday\n");
			  break;
			  
			case 4:
			  printf("Sunday\n");
			  break;
			  
			case 5:
			  printf("Monday\n");
			  break;
			  
			case 6:
			  printf("Tuesday\n");
			  break;
			
			case 0:
			  printf("Wednesday\n");
			  break;
		}
	}
	
	return (0);
}

Measured memory_bytes: 584
from sys import stdin
# stdin = open('b_1.txt')

input = stdin.readline

MOD = 998244353
def main():
    A, B, C, D = map(int, input().rstrip().split())
    DP = [[0 for _ in range(D + 1)] for _ in range(C + 1)]
    for i in range(A, C + 1):
        for j in range(B, D + 1):
            if i == A and j == B:
                DP[i][j] = 1
                continue
            DP[i][j] = ((DP[i -1][j] * j) + (DP[i][j -1] * i) - (DP[i -1][j - 1] * (i - 1) * (j  - 1))) % MOD
    print(DP[C][D] % MOD)

if __name__ == "__main__":
    main()



Measured memory_bytes: 152340
#include <iostream>
#include <array>
#include <algorithm>
#include <vector>
#include <set>
#include <unordered_set>
#include <cmath>
#include <complex>
#include <deque>
#include <iterator>
#include <numeric>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <limits>
#include <iomanip>
using namespace std;

using ll=long long;
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
#define rep(i, k, n) for (ll i=k; i<(ll)n; ++i)
#define REP(i, n) rep(i, 0, n)
#define ALL(v) v.begin(),v.end()
template<class T> inline bool chmax(T& a, T b) {if (a<b) {a=b; return true;} return false;}
template<class T> inline bool chmin(T& a, T b) {if (a>b) {a=b; return true;} return false;}
#define DEBUG_VLL(vec) REP(i, vec.size()) cerr<<vec[i]<<(i==vec.size()-1?'\n':' ');

const ll MOD = 1000000007;
const ll HIGHINF = (ll)1e18;

struct mat {
    ll h, w;
    vvll d;
    mat() {}
    mat(ll h, ll w, ll v=0): h(h), w(w), d(h, vll(w, v)){}
    vll& operator[] (ll i) {return d[i];}
    const vll& operator[] (int i) const { return d[i];}
    void fil(ll v=0) { REP(i,h)REP(j,w) d[i][j] = v;}
    void unit() { REP(i,h)REP(j,w) d[i][j] = (i==j);}
    mat operator+(const mat& a) const { // same size
        mat res(h,w);
        REP(i,h)REP(j,w) {
            res[i][j] = d[i][j]+a[i][j];
            if (res[i][j]>=MOD) res[i][j] -= MOD;
        }
        return res;
    }
    mat operator-(const mat& a) const { // same size
        mat res(h,w);
        REP(i,h)REP(j,w) {
            res[i][j] = d[i][j]-a[i][j];
            if (res[i][j]<0) res[i][j] += MOD;
        }
        return res;
    }
    mat operator*(const mat& a) const { // w = a.h
        mat res(h,a.w);
        REP(i,h)REP(k,w)REP(j,a.w) {
            res[i][j] += d[i][k]*a[k][j]%MOD;
            if (res[i][j]>=MOD) res[i][j] -= MOD;
        }
        return res;
    }
    mat power(ll a) { // h = w
        if (a == 0) {
            mat res(h,w); res.unit();
            return res;
        }
        mat res = power(a/2);
        res = res*res;
        if (a&1) res = res*(*this);
        return res;
    }
};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n, k; cin >> n >> k;
    mat a(n,n);
    REP(i, n) REP(j, n) cin >> a[i][j];
    a = a.power(k);
    ll ans = 0;
    REP(i, n) REP(j, n) {
        ans += a[i][j];
        if (ans >= MOD) ans -= MOD;
    }
    cout << ans << '\n';
    return 0;
}


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

int N;
int t[100010], x[100010], y[100010];

int main () {

    scanf("%d", &N);

    for (int i = 1; i <= N; i++) {
        scanf("%d %d %d", &t[i], &x[i], &y[i]);
    }

    string ans = "Yes";

    for (int i = 1; i <= N; i++) {
        int dist = abs(x[i] - x[i-1]) + abs(y[i] - y[i-1]);

        if (dist > t[i] - t[i-1] || dist % 2 != (t[i] - t[i-1]) % 2) {
            ans = "No";
            break;
        }
    }
    cout << ans << endl;

    return 0;
}

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

using namespace std;

using ll = long long;

template<typename T> using V = std::vector<T>;
using Vi = V<int>;
using VVi = V<V<int>>;
using Vl = V<ll>;
using VVl = V<V<ll>>;
using Vs = V<string>;

template<typename T1, typename T2> using P = std::pair<T1, T2>;
using Pii = P<int, int>;
using Pll = P<ll, ll>;
using Pdd = P<double, double>;

template<typename T1, typename T2> using M = std::map<T1, T2>;
using Mii = M<int, int>;
using Msi = M<string, int>;

#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define REP2(i,s,e) for(int i=(int)(s);i<(int)(e);++i)
#define RREP(i,s,e) for(int i=(int)(s);i>=(int)(e);--i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin(),ie=(c).end();i!=ie;++i)
#define ALL(c) (c).begin(), (c).end()

const double PI = acos(-1);
const ll MOD = 1e9+7;

int n, m;
string s;

int main() {
    cin >> s;

    int maxi = 0;
    REP(i, s.size()) REP2(j, 1, s.size()-i+1) {
        string t = s.substr(i, j);
        bool f = true;
        FOR(c, t) {
            if (*c != 'A' && *c != 'C' && *c != 'G' && *c != 'T') {
                f = false;
                break;
            }
        }
        if (f) maxi = max(maxi, j);
    }
    std::cout << maxi << '\n';

    return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize(3)
#include<iostream>
#include<iomanip>
#include<stack>
#include<queue>
#include<list>
#include<vector>
#include<set> 
#include<map>
#include<string>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<ctime>
#define ll long long
#define db double
#define inf 5001
#define INF (int)1e8 
#define pi acos(-1)
#define rd(n) {n=0;char ch;int f=0;do{ch=getchar();if(ch=='-'){f=1;}}while(ch<'0'||ch>'9');while('0'<=ch&&ch<='9'){n=(n<<1)+(n<<3)+ch-48;ch=getchar();}if(f)n=-n;}
using namespace std;
int n;

struct edge{
    int y,nxt;
    edge(){}
    edge(int yy,int nn){
        y=yy,nxt=nn;
    }
}e[inf];
int head[inf],ecnt;

void addedge(int x,int y){
    ecnt++;
    e[ecnt]=edge(y,head[x]);
    head[x]=ecnt;
    return;
}

int w[inf],f[inf],dp[2][inf];

void memset(int now){
    for (int i=0;i<inf;i++){
        dp[now][i]=INF;
    }
    return;
}

void dfs(int u){
    for (int i=head[u];i;i=e[i].nxt){
        dfs(e[i].y);
    }
    int now=0;
    memset(0);
    dp[now][0]=0;
    for (int i=head[u];i;i=e[i].nxt){
        int v=e[i].y;
        now^=1;
        memset(now);
        for (int j=0;j<=w[u];j++){
            if (j-w[v]>=0){
                dp[now][j]=min(dp[now][j],dp[now^1][j-w[v]]+f[v]);
            }
            if (j-f[v]>=0){
                dp[now][j]=min(dp[now][j],dp[now^1][j-f[v]]+w[v]);
            }
        }
    }
    f[u]=INF;
    for (int i=0;i<=w[u];i++){
        f[u]=min(f[u],dp[now][i]);
    }
    return;
}

int main(){
    rd(n)
    int x;
    for (int i=2;i<=n;i++){
        rd(x)
        addedge(x,i);
    }
    for (int i=1;i<=n;i++){
        rd(w[i])
    }
    dfs(1);
    if (f[1]>=INF){
        puts("IMPOSSIBLE");
    }
    else{
        puts("POSSIBLE");
    }
    return 0;
}

Measured memory_bytes: 384
import java.util.Scanner;

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

        int a = sc.nextInt();
        int b = sc.nextInt();
        
        int ans = 0;
        if (a <= 5) {
            ;
        } else if (a < 13) {
            ans += b / 2;
        } else {
            ans += b;
        }
        
        System.out.println(ans);
    }
}

Measured memory_bytes: 21588
#include <stdio.h>
#include <string.h>

int main(void)
{
    char s[1024];
    int q;
    int i;

    scanf("%s", s);
    scanf("%d", &q);
    while (q--){
        char query[16];
        int a, b;

        scanf("%s %d %d", query, &a, &b);
        if (!strcmp(query, "print")){
            for (i = a; i <= b; ++i) putchar(s[i]);
            puts("");
        }
        else if (!strcmp(query, "reverse")){
            for (i = 0; i <= (b - a) / 2; ++i){
                char tmp = s[a + i];
                s[a + i] = s[b - i];
                s[b - i] = tmp;
            }
        }
        else {
            char p[1024];

            scanf("%s", p);
            strncpy(s + a, p, b - a + 1);
        }
    }

    return 0;
}

Measured memory_bytes: 600
import sys,os
from collections import defaultdict, deque
from math import ceil, floor
if sys.version_info[1] >= 5:
    from math import gcd
else:
    from fractions import gcd
sys.setrecursionlimit(10**6)
write = sys.stdout.write
dbg = (lambda *something: print(*something)) if 'TERM_PROGRAM' in os.environ else lambda *x: 0
def main(given=sys.stdin.readline):
    input = lambda: given().rstrip()
    LMIIS = lambda: list(map(int,input().split()))
    II = lambda: int(input())
    MOD = 10**9+7

    A,B,N = LMIIS()

    ans = 0
    if N >= B -1:
        print(floor(A*(B-1)/B)-A*floor((B-1)/B))
    else:
        print(floor(A*N/B)-A*floor(N/B))
    
    # for i in range(1,int(N**0.5)+1):
    #     ans = max(ans,floor(A*i/B)-A*floor(i/B))
    #     i2 = N//i
    #     ans = max(ans,floor(A*i2/B)-A*floor(i2/B))
    #     # print(i,i2)
    # print(ans)

    # ans2 = 0
    # for i in range(1,N+1):
    #     ans2 = max(ans2,floor(A*i/B)-A*floor(i/B))
    # print(ans2)
    

if __name__ == '__main__':
    main()

Measured memory_bytes: 65512
#include<cstdio>
#include<cstring>
#include <algorithm>
#include <cstdlib>
#include <cmath>
using namespace std;
int panduan(char a[],char b[],int n,int m);

int main(){
	int m,n,x;
	int i,j;
	char a[1000];
	char b[1000];
	char temp;
	scanf("%s", a);
	scanf("%s", b);
	n=strlen(a);
	m=strlen(b);
	for(i=0;i<n-1;i++){
		for(j=i+1;j<n;j++){
			if(a[i]>a[j]){
				temp=a[j];
				a[j]=a[i];
				a[i]=temp;
			}
		}
	}
	for(i=0;i<m-1;i++){
		for(j=i+1;j<m;j++){
			if(b[i]<b[j]){
				temp=b[j];
				b[j]=b[i];
				b[i]=temp;
			}
		}
	}
	x=panduan(a,b,n,m);
	if(x==1) printf("Yes\n");
	if(x==0) printf("No\n");
}
int panduan(char a[],char b[],int n,int m){
	int i;
     if(n==m){
     	 for(i=0;i<n;i++){
     	 	 if(a[i]<b[i]) return 1;
             if(a[i]>b[i]) return 0;
         	}
         	if(i==n) return 0;
	 }
       else	if(n < m){
       	   for(i=0;i<m;i++){
     	 	 if(a[i]<b[i]) return 1;
             if(a[i]>b[i]) return 0;
         	}
	   }
       else if(n > m) { 
       	   for(i=0;i<n;i++){
     	 	 if(a[i]<b[i]) return 1;
             if(a[i]>b[i]) return 0;
	 }
	   }
}


Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
int main(void){
  char a[11],b[11];
  int k;
  scanf("%s %s",a,b);
  b[strlen(a)]='\0';
  if(strcmp(a,b)==0) puts("Yes");
  else puts("No") ;
  
 return 0; 
}


Measured memory_bytes: 1620
import java.util.*;

public class Main {


    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        String alpha = sc.next();

        char c = alpha.charAt(0);


        if(c>='a' && c <= 'z'){
            System.out.println('a');
        }else{
            System.out.println('A');
        }


    }

}


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

int n, m, q;
long long ans = 0;
vector<int> a(50), b(50), c(50), d(50);

void calc(vector<int> &A) {
  long long cur = 0;
  for (int i = 0; i < q; i++) {
    if (A[a[i]-1] + c[i] == A[b[i]-1]) cur += d[i];
  }
  ans = max(ans, cur);
}

void rec(vector<int> &A, int idx) {
  if (idx < n) {
    for (int nx = A[idx-1]; nx <= m; nx++) {
      A.emplace_back(nx);
      rec(A, idx+1);
      A.pop_back();
    }
  } else {
    calc(A);
  }
}

int main() {
  cin>>n>>m>>q;
  for (int i = 0; i < q; i++) cin>>a[i]>>b[i]>>c[i]>>d[i];

  vector<int> A({1});
  rec(A, 1);
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 3608
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <functional>

using namespace std; using ll=long long; using ld=long double; using P=pair<ll,ll>; const int INF=1e9; const ll LINF=1e18;
template<typename T> void caut(T a, T b, T c){cout<<"("<<a<<","<<b<<","<<c<<") ";}
template<typename T> void caut(T a, T b){cout<<"("<<a<<","<<b<<") ";}
template<typename T> void caut(T a){cout<<"("<<a<<") ";}

struct unf {
  vector<int> v; unf(int n){v.resize(n); for(int i=0;i<n;i++) v[i]=i;}
  int root(int x) { if (v[x]==x) return x; return v[x]=root(v[x]);}
  void unite(int x,int y) {int p=root(x), q=root(y); if (p==q) return; v[p]=q;}
  bool same(int x, int y) {return root(x)==root(y);}
  void print() {for(int x:v) cout<<x<<" "; cout<<endl;}
};

int main(){
  int n,m; cin>>n>>m;
  int p[n]; for(int i=0;i<n;i++) cin>>p[i];
  for(int i=0;i<n;i++) p[i]--;

  unf u(n);

  for(int i=0;i<m;i++) {
    int a,b; cin>>a>>b; a--; b--;
    u.unite(a,b);
  }
  vector<int> v[n]; // id
  vector<int> v2[n]; // p

  for(int i=0;i<n;i++) {
    int rt = u.root(i);
    v[rt].push_back(i);
    v2[rt].push_back(p[i]);
  }
  int an=0;
  for(int i=0;i<n;i++) {
    if (v[i].empty()) continue;
    sort(v[i].begin(), v[i].end());
    sort(v2[i].begin(), v2[i].end());
    int ii=0,jj=0,sz=v[i].size();
    while(ii<sz&&jj<sz) {
      //cout<<ii<<" "<<jj<<" "<<v[i].size()<<" "<<v2[i].size()<<endl;
      if (v[i][ii]==v2[i][jj]) {
        an++; ii++; jj++;
      } else if (v[i][ii]>v2[i][jj]) {
        jj++;
      } else {
        ii++;
      }
    }
  }
  cout<<an<<endl;
}

Measured memory_bytes: 11904
from collections import defaultdict
N = int(input())
A = list(map(int, input().split()))
ans=0
cnt = defaultdict(int)
for i in range(N):
  x = i - A[i]
  y = i + A[i]
  cnt[y] += 1
  ans += cnt[x]
        
print(ans)
        
  
  

Measured memory_bytes: 133232
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1e9 + 7;
//const ll MOD = 998244353;
//const ll MOD = ;
ll mod(ll A, ll M) {return (A % M + M) % M;}
const ll INF = 1LL << 60;
template<class T> bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template<class T> bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
ll divceil(ll A, ll B) {return (A + (B - 1)) / B;}
ll myctoi(char C) {return C - '0';}
char myitoc(ll N) {return '0' + N;}
#define FINALANS(A) do {cout << (A) << '\n'; exit(0);} while (false)

int main()
{
  ll N;
  cin >> N;
  vector<ll> X(N), Y(N);
  for (ll i = 0; i < N; i++)
  {
    cin >> X.at(i) >> Y.at(i);
  }

  using ld = long double;

  ll fac = 1;
  for (ll i = 1; i <= N; i++)
  {
    fac *= i;
  }

  ld ans = 0;
  for (ll i = 0; i < N; i++)
  {
    for (ll j = i + 1; j < N; j++)
    {
      ll x0 = X.at(i), y0 = Y.at(i);
      ll x1 = X.at(j), y1 = Y.at(j);
      ld tmp = sqrt((x1 - x0) * (x1 - x0) + (y1 - y0) * (y1 - y0));

      ans += 2 * (fac / N) * tmp;
    }
  }
  ans /= fac;
  cout << fixed << setprecision(15) << ans << endl;
}

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

int main() {
   int n,k;
   cin>>n>>k;
   int a[n+1];
   for(int i=1;i<=n;i++)
   {
     cin>>a[i];
   }
   long long int dp[n+1] ;
   dp[1]=0;
   dp[0]=0;
   dp[2]=abs(a[2]-a[1]);
   for(int i=3;i<=n;i++)
   {  dp[i]=10000000000 ;
     for(int j=1 ;j<=k  and i-j>=1 ;j++)
     {
           dp[i]=min( dp[i] ,dp[i-j]+abs(a[i]-a[i-j])  ) ;
     }
    
   }
   cout<<dp[n]<<endl;
	return 0;
}

Measured memory_bytes: 1408
#include<iostream>
using namespace std;
int main(){
	int ans[50]={};
	int a,b,m,n;
	cin>>n>>m;
	for(int i=0;i<m;i++){
		cin>>a>>b;
		ans[a-1]++;
		ans[b-1]++;
	}
	for(int i=0;i<n;i++)
		cout<<ans[i]<<endl;
	return 0;
}

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

int gcd(int a,int b) {
    while (b!=0) {
        int t = b;
        b = a%b;
        a = t;
    }
    return a;
}

int main() {
    int N,A;
    cin >> N >> A;
    int ans = A;
    for (int i=1;i<N;i++) {
        cin >> A;
        ans = gcd(ans, A);
    }
    cout << ans << '\n';
    return 0;
}



Measured memory_bytes: 256
import sys
from collections import defaultdict, Counter, namedtuple, deque
import itertools
import functools
import bisect
import heapq
import math

MOD = 10 ** 9 + 7
# MOD = 998244353
# sys.setrecursionlimit(10**8)


class Combination:
    def __init__(self, mod=10**9+7, n=202020):
        self.f = [0] * n
        self.rf = [0] * n
        self.inv = [0] * n
        self.f[0], self.f[1] = 1, 1
        self.rf[0], self.rf[1] = 1, 1
        self.inv[1] = 1
        self.MOD = mod
        for i in range(2, n):
            self.f[i] = (self.f[i - 1] * i) % self.MOD
            self.inv[i] = (-self.inv[self.MOD % i] * (self.MOD // i)) % self.MOD
            self.rf[i] = (self.rf[i - 1] * self.inv[i]) % self.MOD

    def __call__(self, n, r):
        return (self.f[n] * self.rf[r] * self.rf[n - r]) % self.MOD


C = Combination()

n, k = map(int, input().split())
A = list(map(int, input().split()))
A.sort()
ans = 0
for i in range(n-k+1):
    ans = (ans + A[-i-1] * C(n-i-1, k-1)) % MOD
    # print(ans)

for i in range(n-k+1):
    ans = (ans - A[i] * C(n-i-1, k-1)) % MOD
    # print(ans)

print(ans)


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

int gaiseki(double,double,double,double,double,double);

int main() {
	double x[4],y[4];
	int n[3],ans;
	while ( cin >> x[0] ) {
		cin >> y[0];
		for ( int i = 1; i < 4; i++ ) {
			cin >> x[i] >> y[i];
		}
		//三角形の各辺の外積(求めたい点と始点、求めたい点と終点との外積)を取り、全て右か左だったら中に含まれる
		for ( int i = 0; i < 2; i++ ) 
			n[i] = gaiseki(x[i],y[i],x[i + 1],y[i + 1],x[3],y[3]);
		n[2] = gaiseki(x[2],y[2],x[0],y[0],x[3],y[3]);
		
		ans = 0;
		for ( int i = 0; i < 3; i++ ){
			ans += n[i];
		}
		
		if ( ans == 3 || ans == 0 )
			cout << "YES" << endl;
		else
			cout << "NO" << endl;
	}
	return 0;
}

int gaiseki(double x1,double y1,double x2,double y2,double xp,double yp) {
	double ans;
	ans =  xp * ( y1 - y2 ) + x1 * ( y2 - yp ) + x2 * ( yp - y1 );
	if ( ans > 0 ) return 1; //右側
	else return 0; //左側(＝だと線上だが、今回は考えなくて良い)
}

Measured memory_bytes: 1212
n, y = gets.split.map(&:to_i)
n_10, n_5, n_1 = -1, -1, -1

0.upto(n) do |i|  
  0.upto(n-i) do |j|
    k = n - i - j
    rmd = y - 10_000 * i - 5_000 * j
    next unless 1_000 * k == rmd
    
    n_10 = i
    n_5 = j
    n_1 = k
    break_j = true
  end
end

puts "#{n_10} #{n_5} #{n_1}"

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

int n,a;
map<int,bool> f;

int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;++i) {
		scanf("%d",&a);
		if(f[a]) {
			puts("NO");
			return 0;
		}
		f[a]=1;
	}
	puts("YES");
	return 0;
}

Measured memory_bytes: 9600
S=6000
A=4000
B=3000
C=2000

for k in range(4):
    i,n1=map(int,input().split())
    if i==1:
        print(f"{S*n1}")
    elif i==2:
        print(f"{A*n1}")
    elif i==3:
        print(f"{B*n1}")
    elif i==4:
        print(f"{C*n1}")



Measured memory_bytes: 5600
#![allow(dead_code, unused_variables, unused_imports)]
use proconio::marker::Chars;
use proconio::{fastout, input};
use std::cmp::{max, min};
use std::collections::{HashMap, HashSet};

#[fastout]
fn main() {
    input! {
        n:usize,
        k:i32,
        q:usize,
        a:[usize;q],
    }

    let mut p = vec![k-q as i32;n];

    for e in a{
        p[e-1] += 1;
    }
    
    for e in p{
        if e > 0{
            println!("Yes");
        }else{
            println!("No");
        }
    }
}


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


int main()
{
	char year[4];
	char month[2];
	char day[2];
	char tmp;
	for (int i = 0; i < 4; ++i)
		std::cin >> year[i];
	std::cin >> tmp;
	for (int i = 0; i < 2; ++i)
		std::cin >> month[i];
	std::cin >> tmp;
	for (int i = 0; i < 2; ++i)
		std::cin >> day[i];

	auto y = std::stoi(year);
	auto m = std::stoi(month);
	auto d = std::stoi(day);

	if (y < 2019)
		std::cout << "Heisei" << std::endl;
	else if (y == 2019 && m < 4)
		std::cout << "Heisei" << std::endl;
	else if (y == 2019 && m == 4 && d <= 40)
		std::cout << "Heisei" << std::endl;
	else
		std::cout << "TBD" << std::endl;

	return 0;
}


Measured memory_bytes: 256
import java.util.*;

class Main {
	static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		
		int n = sc.nextInt();
		int min = Integer.MAX_VALUE;
		int max = Integer.MIN_VALUE;
		long sum = 0L;
		for (int i=0; i<n; i++) {
			int temp = sc.nextInt();
			min = Math.min(min, temp);
			max = Math.max(max, temp);
			sum += temp;
		}
		System.out.println(min+" "+max+" "+sum);
		
	}
}


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

int main(){
	
	string s;
	
	cin >> s;
	
	if (s[0] == s[3] && s[1] == s[2] && s[0] != s[1]){
		cout << "Yes";
	} else if (s[1] == s[3] && s[0] == s[2] && s[1] != s[0]){
		cout << "Yes";
	} else if (s[2] == s[3] && s[0] == s[1] && s[2] != s[0]){
		cout << "Yes";
	} else {
		cout << "No";
	}
	
}

Measured memory_bytes: 256
t=$<.map{a,b=_1.split.map &:to_r
b ?a*b==0?1[a]-1[b]:a/b:0}.tally
M=10**9+7
z=1
t.map{w=t[_1==0?0:-1/_1]||0
w>0&&_1<=0||z=z*(2.pow(_2,M)+2**w-1)%M}
p (t[0]-2+z)%M

Measured memory_bytes: 38940
import "dart:io";
import 'dart:async';
import 'dart:convert';
import 'dart:math' as Math;

void main() async {
  int N = int.parse(stdin.readLineSync());
  var lines = stdin.transform(utf8.decoder).transform(LineSplitter());
  List<int> A = [];
  await for(var line in lines) {
   A = line.split(' ').map((x) => int.parse(x)).toList();
  }
  for (int i=0; i<N;i++) {
  	if (A[i]==0) {
    	print(0);
        return;
    }
  }
  final M = Math.pow(10, 18);
  int r = 1;
  for (int i=0; i<N;i++) {
    if (A[i]<=M/r && r*A[i]<=M) {
    	r*=A[i];
    } else {
     	print(-1);
      	return;
    }
  }
  print(r);
}


Measured memory_bytes: 28884
#include<bits/stdc++.h>
#define fi first
#define se second
#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define rrep(i, n) for (int (i) = 1; (i) <= (n); (i++))
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define pb push_back
#define eb emplace_back
#define yn {puts("Yes");}else {puts("No");}
#define printd(x) printf("%.12f\n", x);
template<class T> bool chmin(T& a, const T& b) {if (a > b) {a = b; return 1;} return 0;}
template<class T> bool chmax(T& a, const T& b) {if (a < b) {a = b; return 1;} return 0;}
using namespace std;
using ll = long long;
using P = pair<int, int>;


int main() {
	int h, w, n, sr, sc;
	cin >> h >> w >> n >> sr >> sc;
	string s, t;
	cin >> s >> t;

	
	int curX = sc;
	rep (i, n) {
		if (s[i] == 'R') curX++;
		if (curX > w) {
			cout << "NO" << endl;
			return 0;
		}
		if (t[i] == 'L') if (curX != 1) curX--;
	}
	curX = sc;
	rep (i, n) {
		if (s[i] == 'L') curX--;
		if (curX < 1) {
			cout << "NO" << endl;
			return 0;
		}
		if (t[i] == 'R') if (curX != w) curX++;
	}
	int curY = sr;
	rep (i, n) {
		if (s[i] == 'U') curY--;
		if (curY < 1) {
			cout << "NO" << endl;
			return 0;
		}
		if (t[i] == 'D') if (curY != h) curY++;
	}
	curY = sr;
	rep (i, n) {
		if (s[i] == 'D') curY++;
		if (curY > h) {
			cout << "NO" << endl;
			return 0;
		}
		if (t[i] == 'U') if (curY != 1) curY--;
	}

	cout << "YES" << endl;
	return 0;
}

Measured memory_bytes: 776
def II(): return int(input())
def LII(): return list(map(int, input().split()))

n=II()
town=[LII() for _ in range(n)]

distance=0
for i in range(n-1):
    for j in range(i+1,n):
        [xi,yi]=town[i]
        [xj,yj]=town[j]
        
        distance += ((xi-xj)**2+(yi-yj)**2)**0.5

print(distance*2/n)

Measured memory_bytes: 9276
#include <cstdio>
#include <algorithm>
#include <cmath>
using namespace std;
int K, T, a[101], rest;
int main() {
  scanf("%d %d", &K, &T);
  for(int i = 1; i <= T; ++i) {
    scanf("%d", &a[i]);
  }
  sort(a+1, a+T+1);
  rest = a[T];
  for(int i = T-1; i > 0; --i) {
    rest = abs(rest-a[i]);
  }
  printf("%d\n", max(rest-1, 0));
}

Measured memory_bytes: 128
def solve():
    S = input()
    
    if S == 'zyxwvutsrqponmlkjihgfedcba':
        return -1
    elif len(S) == 26:
        for i in range(26):
            for j in range(ord(S[-i-1])+1, 97+26):
                if chr(j) not in S[:-i-1]:
                    return S[:-i-1] + chr(j)
    else:
        for i in range(97, 97+26):
            if chr(i) not in S:
                return S+chr(i)
            
print(solve())

Measured memory_bytes: 3064
#include <iostream>

using namespace std;

int main()
{
    string s;
    string t;
    int x = 0;

    cin >> s;
    cin >> t;

    for (int i = 0; i < 3; i++){
        if (s[i] == t[i]){
            ++x;
        }
    }

    cout << x << endl;


    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main()
{
	int a,b,k,j,i;
	scanf("%d%d%d",&a,&b,&k);
	if(k>(b-a)/2)
		for(i=a;i<=b;i++)printf("%d\n",i);
	else
	{
		for(i=a,j=1;j<=k;i++,j++)printf("%d\n",i);
		i=a+b-i+1;
		for(;j>1;i++,j--)printf("%d\n",i);
	}
	return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
typedef long long ll;
typedef long double ld;
using namespace std;

using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

#define REP(i, l, n) for(int i=(l), i##_len=(n); i<i##_len; ++i)
#define ALL(x) (x).begin(),(x).end()
#define pb push_back

ll gcd(ll a,ll b){return b ? gcd(b,a%b) : a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

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

char alpha[26] = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'};

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

int main(){
    int a, b; cin >> a >> b;
    if(a > 8 || b > 8){
        cout << ":(" << endl;
    }else{
        cout << "Yay!" << endl;
    }
}

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

// #define int long long // intで書いたけど心配なときにlong longに変換する
struct Fast {Fast(){std::cin.tie(0);ios::sync_with_stdio(false);}} fast;

/* short */
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define Fi first
#define Se second
#define ALL(v) begin(v), end(v)
#define RALL(v) rbegin(v), rend(v)
#define X real()
#define Y imag()

/* REPmacro */
#define REPS(i, a, n) for (ll i = (a); i < (ll)(n); ++i)
#define REP(i, n) REPS(i, 0, n)
#define RREP(i, n) REPS(i, 1, n + 1)
#define DEPS(i, a, n) for (ll i = (a); i >= (ll)(n); --i)
#define DEP(i, n) DEPS(i, n, 0)
#define EACH(i, n) for (auto&& i : n)

/* debug */
#define debug(x) cerr << x << " " << "(L:" << __LINE__ << ")" << '\n';

/* alias */
using ll = long long;
using ull = unsigned long long;
using uint = unsigned int;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using pii = pair<int, int>;
using D = double;
using P = complex<D>;
using vs = vector<string>;
template <typename T> using PQ = priority_queue<T>;
template <typename T> using minPQ = priority_queue<T, vector<T>, greater<T>>;

/* const */
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7;
const D EPS = 1e-9;
const int dx[] = {0, 1, 0, -1, 1, -1, 1, -1}, dy[] = {1, 0, -1, 0, 1, -1, -1, 1};

/* func */
inline bool inside(int y, int x, int H, int W) {return y >= 0 && x >= 0 && y < H && x < W;}
inline int in() {int x; cin >> x; return x;}
inline ll IN() {ll x; cin >> x; return x;}
inline vs split(const string& t, char c) {vs v; stringstream s(t); string b; while(getline(s, b, c)) v.eb(b); return v;}
template <typename T> inline bool chmin(T& a, const T& b) {if (a > b) a = b; return a > b;}
template <typename T> inline bool chmax(T& a, const T& b) {if (a < b) a = b; return a < b;}
template <typename T, typename S> inline void print(const pair<T, S>& p) {cout << p.first << " " << p.second << endl;}
template <typename T> inline void print(const T& x) {cout << x << endl;}
template <typename T, typename S> inline void print(const vector<pair<T, S>>& v) {for (auto&& p : v) print(p);}
template <typename T> inline void print(const vector<T>& v, string s = " ") {REP(i, v.size()) cout << v[i] << (i != (ll)v.size() - 1 ? s : "\n");}
inline void yesno(bool ok, string yes = "Yes", string no = "No") {cout << (ok?yes:no) << endl;}


signed main() {
    //my-code
    int h1, m1, h2, m2, k; cin >> h1 >> m1 >> h2 >> m2 >> k;
    int min1, min2;
    min1 = h1 * 60 + m1;
    min2 = h2 * 60 + m2;
    int ans = min2 - min1 - k;
    print(ans);

    return 0;
}

// https://github.com/kurokoji/.cpp-Template/wiki テンプレートについて
// http://www.creativ.xyz/dump-cpp-652 dump()について
// https://gist.github.com/rigibun/7905920 色々

Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,n-1,0)
#define REPL(i,m,n) for(ll i=(ll)(m); i<(ll)(n); i++)
#define repl(i,n) REPL(i,0,n)
#define all(v) v.begin(), v.end()
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;

int digitSum(int n) {
  int ret = 0;
  while(n>0) {
    ret += n%10;
    n/=10;
  }
  return ret;
}
int main() {
  int N;
  cin >> N;
  int mn = inf;
  REP(i, 1, N) {
    mn = min(digitSum(i)+digitSum(N-i), mn);
  }
  cout << mn << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std ;
#define pb push_back
#define ll long long
ll N = 200007 ;
ll mod = 1000 * 1000 * 1000 + 7 ;
int main() {
    ll n ;
    cin >> n ;
    vector<ll>v(n) ;
    ll i ;
    for ( i = 0 ; i< n ;i++) cin >> v[i] ;
    vector<ll>dp(n+1,0) , last(N+1,0) ;
    dp[0] = 1 ;
    last[v[0]] = 1 ;
    for (i = 1 ; i< n ;i++) {
        if (v[i]==v[i-1] ) {
            dp[i]= dp[i-1] ;
            continue ;
        }
        dp[i] = dp[i-1]+last[v[i]] ;
        dp[i]%=mod ;
        last[v[i]]= dp[i] ;
        //cout << dp[i] << endl ;

    }

    cout << dp[n-1] << endl ;

}


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

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

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

int main(void){

    int n, m;
    cin >> n >> m;
    vector<vector<int>> a(n);
    vector<vector<bool>> check(n, vector<bool>(m, false));

    roop(i, n){
        int k; cin >> k;
        roop(j, k){
            int a; cin >> a;
            check[i][a-1] = true;
        }
    }


    int ans = 0;

    roop(i, m){
        bool tmp = true;
        roop(j, n){
            if(check[j][i] == false) tmp = false;
        }
        if(tmp) ans++;
    }
    
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
import sys
import math
from collections import defaultdict

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

mod = 10**9 + 7

def I(): return int(input())
def II(): return map(int, input().split())
def III(): return list(map(int, input().split()))
def Line(N,num):
    if N<=0:
        return [[]]*num
    elif num==1:
        return [I() for _ in range(N)]
    else:
        read_all = [tuple(II()) for _ in range(N)]
        return map(list, zip(*read_all))

#################

K = I()
A = III()

for i in range(K)[::-1]:
    if i==K-1:
        if A[i]==2:
            l = 2
            r = 3
        else:
            print(-1)
            exit()
    else:
        x = math.ceil(l/A[i])*A[i]
        y = math.floor(r/A[i])*A[i]
        if x<=r and y>=l:
            l = x
            r = y+A[i]-1
        else:
            print(-1)
            exit()

print(l,r)

Measured memory_bytes: 63984
#pragma GCC optimize "-O3"
#pragma GCC target ("avx")
#define _USE_MATH_DEFINES
#include<bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;++i)
#define vi vector<int>
#define vvi vector<vi>
#define pb push_back
#define pi pair<int,int>
#define vp vector<pair<int,int>>
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define MEMSET(a) memset(a,0,sizeof(a))
#define inf (1ll<<60)
#define SORT(v) sort(all(v))
#define RSORT(v) sort(all(v),greater<int>())
#define SPEED ios::sync_with_stdio(false);cin.tie(0);cout<<fixed<<setprecision(12)
signed gcd(int a, int b){return b?gcd(b,a%b):a;}
signed lcm(int a, int b){return a*b/gcd(a,b);}
//priority_queue<int, vi, greater<int> > que;//昇順

using namespace std;

const int mod=1e9+7;

signed main(){
    SPEED;
    char c;
    cin >> c;
    if(c=='a'||c=='i'||c=='u'||c=='e'||c=='o')
    {
        cout << "vowel" << endl;
    }
    else
    {
        cout << "consonant" << endl;
    }
}


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

namespace abc61
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] str = Console.ReadLine().Split(' ');
            int N = int.Parse(str[0]);
            int M = int.Parse(str[1]);
            int[] toshi = new int[N];
            for (int i = 0; i < N; i++) toshi[i] = 0;
            for(int i = 0; i < M; i++)
            {
                str = Console.ReadLine().Split(' ');
                toshi[int.Parse(str[0]) - 1]++;
                toshi[int.Parse(str[1]) - 1]++;
            }
            for(int i = 0; i < N; i++)
            {
                Console.WriteLine(toshi[i]);
            }
        }
    }
}


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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  int n;
  cin >> n;
  
  int n_max = pow(2, n);
  vector<int> s(n_max);
  multiset<int> st;
  for (int i = 0; i < n_max; i++) {
    cin >> s.at(i);
    s.at(i) *= -1;
    st.insert(s.at(i));
  }
  
  sort(s.begin(), s.end());
  
  vector<int> x;
  x.emplace_back(s.at(0));
  st.erase(st.find(s.at(0)));
  
  for (int i = 1; i <= n; i++) {
    vector<int> y;
    sort(x.begin(), x.end());
    for (int j = 0; j < x.size(); j++) {
      auto it = st.upper_bound(x.at(j));
      if (it == st.end()) {
        cout << "No\n";
        return 0;
      }
      y.emplace_back(x.at(j));
      y.emplace_back(*it);
      st.erase(it);
    }
    x = y;
  }
  
  cout << "Yes\n";
  return 0;
}

Measured memory_bytes: 19228
N, M = map(int, input().split())
AB = [tuple(map(int, input().split())) for _ in range(M)]

f = set()
s = set()

for a, b in AB:
	if a == 1 or b == 1:
		f |= {a + b - 1}
	if a == N or b == N:
		s |= {a + b - N}
print(["POSSIBLE", "IMPOSSIBLE"][not(f & s)])


Measured memory_bytes: 42632
///mAAria...
#include<bits/stdc++.h>
using namespace std;
/*
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")*/
#define int long long
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

signed main(){
    IOS;
    int n,l,sum=0,v[205],mn=500,res=0;
    cin >> n >> l;
    for(int i =1;i<=n;i++){
        v[i]=l+i-1;
        //cout << abs(v[i]) << endl;
        sum+=v[i];
    }
    for(int i = 1;i<=n;i++){
        if(mn>abs(v[i])){mn=abs(v[i]);res=v[i];}
        //cout << mn << endl;
    }

    cout << sum-res << endl;


return 0;}


Measured memory_bytes: 256
import sys
reader = (s.rstrip() for s in sys.stdin)
input = reader.__next__

sys.setrecursionlimit(10**9)


n = int(input())
G = [[] for i in range(n)]
for i in range(n-1):
    a,b = map(int, input().split())
    a,b = a-1,b-1
    G[a].append(b)
    G[b].append(a)

flag = [0]*n
def dfs(cur, par,f):
    flag[cur] = f
    for to in G[cur]:
        if to != par:
            dfs(to, cur, f^1)

dfs(0, -1, 0)

a = sum(flag)
b = n-a

one = []
two = []
three = []
for i in range(1, n+1):
    if i%3 == 0:
        three.append(i)
    elif i%3 == 1:
        one.append(i)
    else:
        two.append(i)
k = n//3
ans = [0]*n
if k<a and k<b:
    for i in range(n):
        if flag[i]:
            if one:
                ans[i] = one.pop()
            else:
                ans[i] = three.pop()
        else:
            if two:
                ans[i] = two.pop()
            else:
                ans[i] = three.pop()
else:
    #1
    if k >= a:
        for i in range(n):
            if flag[i]:
                ans[i] = three.pop()
        res = one + two + three
        for i in range(n):
            if not flag[i]:
                ans[i] = res.pop()
    # 0
    else:
        for i in range(n):
            if not flag[i]:
                ans[i] = three.pop()
        res = one + two + three
        for i in range(n):
            if flag[i]:
                ans[i] = res.pop()
print(*ans)

Measured memory_bytes: 182660
#include <iostream>
#include<vector>
#include<stdio.h>
#include <algorithm>
#include <functional>

#define FOR(i,n) for(int i=0;i<n;i++)
#define SORT(v,n) std::sort(&v[0],&v[n])
#define INF 999999999
#define mod 1000000007



using namespace std;

int main(void){
	int n;
	cin >> n;
	long k=1;
	for(int i=1;i<=n;i++){
		k=(k*i)%mod;
	}
	cout << k << endl;


}

Measured memory_bytes: 256
char*C="ABCDEFGHIJKLMNOPQRSTUVWXYZ .,-'?",*strchr(),*L="68443586484588538455886888366866";
B[]={
	0x25,0x9a,0x05,0x01,0x06,0x09,0x9b,0x10,0x07,0x98,0x06,0x04,0x99,0x9e,0x05,0x07,
	0x9f,0x08,0x06,0x07,0x9c,0x9d,0x02,0x92,0x93,0x90,0x05,0x11,0x03,0x91,0x00,0x01
};
b,l;
main(c){
	for(;c=getchar(),c+1;)
		if(c-10)
			for(c=strchr(C,c)-C,b=b<<(L[c]-48)|B[c],l+=L[c]-48;l>4;putchar(C[b>>l&31]))
				l-=5;
		else l&&putchar(C[(b<<=5-l)&31]),l=0,putchar(c);
	exit(0);
}

Measured memory_bytes: 0
//g++ -std=c++14 test.cpp -o test.out

#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <iomanip>
#include <vector>
#include <queue>
#include <map> 
#include <utility>
#include <limits.h>
#include <bitset>
#include <set>
using namespace std;
 
#define LL long long int
const LL INF = (1LL<<60);
const int INF_INT = 2147483647-1e6-1;
const LL mod = 1000000007ll;
const int mod_int = 1000000007;

LL N;

LL ans = 0;

void solve(){
	LL money = 100LL;
	for(ans=0;;ans++){
		if(money>=N) return;
		money += money/100LL;
	}
}
 
int main(){
    cin >> N;

    solve();

	cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3160
#include <iostream>
using namespace std;
int main (void) {
    int A, B;

    cin >> A >> B;

    if (A % 3 == 0 || B % 3 == 0 || (A + B) % 3 == 0) cout << "Possible" << endl;
    else cout << "Impossible" << endl;

    return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int K = sc.nextInt();
    int total =0;
    for (int i =0; i<N; i++) {
      int x = sc.nextInt();
      total += Math.min(x, Math.abs(x-K));
    }
    System.out.print(total * 2);
  }
}

Measured memory_bytes: 23636
#include<iostream>
#include<string>
#include<algorithm>
#include<utility>
#include<cmath>
#include<vector>
#include<climits>
#define ll long long int
using namespace std;
int main(void) {
  int n;
  ll mi=10000000000;
  ll ma=0;
  cin>>n;
  for(int i=0; i<n; i++) {
    ll x;
    cin>>x;
    mi = min(mi, x);
    ma = max(ma, x);
  }
  cout<<ma-mi<<endl;
    
  return 0;
}


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

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

	if (a + b == 15) {
		cout << "+" << endl;
	}
	else if (a * b == 15) {
		cout << "*" << endl;
	}
	else {
		cout << "x" << endl;
	}


	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(),v.end()
#define INF INT_MAX;
typedef long long ll;
using namespace std;

int main(){
  int n; cin >> n;
  vector<double> v(n);
  rep(i,n) cin >> v.at(i);
  sort(all(v));
  for(int i=0;i<n-1;i++){
    v.at(i+1)=(v.at(i)+v.at(i+1))/2.0;
  }
  cout << v.at(n-1) << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  int cnt=0;
  for(int i=0;i<n;i++){
    cin >> a[i];
    if(a[i]<0){
      cnt++;
    }
  }
  cnt=max(cnt,1);
  cnt=min(cnt,n-1);
  sort(a.begin(),a.end());
  vector<pair<int,int>> c(n-1);
  for(int i=cnt;i<n-1;i++){
    c[i-cnt]=make_pair(a[0],a[i]);
    a[0]-=a[i];
  }
  for(int i=0;i<cnt;i++){
    c[n-cnt-1+i]=make_pair(a[n-1],a[i]);
    a[n-1]-=a[i];
  }
  cout << a[n-1] << endl;
  for(int i=0;i<n-1;i++){
    cout << c[i].first << " " << c[i].second << endl;
  }
}

Measured memory_bytes: 3072
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
int main(){
    ios::sync_with_stdio(false);
    int n,k,c;
    string s;
    cin >> n >> k >> c >> s;
    vector<bool> r(n+1,true);
    rep(i,n) if(s[i] == 'o') r[i] = false;

    vector<int> sum(n+1,-1), rsum(n+1,-1);
    int i = 0;
    int su = 0;
    while(i < n) {
        if(r[i]==false) {
            su++;
            sum[i+1] = su;
            i+=c;
        }
        i++;
    }
    sum[0] = 0;
    rep(i,n+1) if(sum[i] == -1) sum[i] = sum[i-1];
    i=0;su=0;
    reverse(r.begin(), r.end());
    while(i < n) {
        if(r[i]==false) {
            su++;
            rsum[i+1] = su;
            i+=c;
        }
        i++;
    }
    rsum[0] = 0;
    rep(i,n+1) if(rsum[i] == -1) rsum[i] = rsum[i-1];
    reverse(rsum.begin(), rsum.end());
    rep(i,n) {
        if(sum[i] + rsum[i] < k) {
            cout << i+1 << endl;
        }
    }
}

Measured memory_bytes: 5240
#!/usr/bin/env python
import os
import sys
from io import BytesIO, IOBase

def readvars():
    k = map(int,input().split())
    return(k)

def readlist():
    li = list(map(int,input().split()))
    return(li)

def anslist(li):
    ans = " ".join([str(v) for v in li])
    return(ans)

def main():

	t = 1
#	t = int(input())

	for xx in range(t):
		k = int(input())
		s = input()
		li = len(s)
		if li <= k: print(s)
		else: print(s[:k]+"...")


# region fastio

BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")

# endregion

if __name__ == "__main__":
    main()

Measured memory_bytes: 62672