akhauriyash/Code-Regression huggingface dataset:
/*************************************************************************
>>> Author: WindCry1
>>> Mail: lanceyu120@gmail.com
>>> Website: https://windcry1.com
>>> Date: 12/30/2019 11:03:37 PM
*************************************************************************/
//#pragma GCC optimize(2)
//#pragma GCC diagnostic error "-std=c++11"
#include <cstring>
#include <cmath>
#include <cstdio>
#include <cctype>
#include <cstdlib>
#include <ctime>
#include <vector>
#include <iostream>
#include <string>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <complex>
#include <stack>
#include <bitset>
#include <iomanip>
#include <list>
#include <sstream>
#include <fstream>
#if __cplusplus >= 201103L
#include <unordered_map>
#include <unordered_set>
#endif
#define endl '\n'
#define ALL(x) x.begin(),x.end()
#define MP(x,y) make_pair(x,y)
#define ll long long
#define ull unsigned long long
#ifdef WindCry1
#define DEBUG(x) cout<<#x<<" : "<<x<<endl;
#endif
#define lowbit(x) x&(-x)
#define ls u<<1
#define rs u<<1|1
using namespace std;
template<typename T> inline T MIN(const T &a,const T &b) {return a<b?a:b;}
template<typename T> inline T MAX(const T &a,const T &b) {return a>b?a:b;}
template<typename T,typename ...Args> inline T MIN(const T &a,const T &b,Args ...args) {return MIN(MIN(a,b),args...);}
template<typename T,typename ...Args> inline T MAX(const T &a,const T &b,Args ...args) {return MAX(MAX(a,b),args...);}
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<double,double> pdd;
const double eps = 1e-8;
const int INF = 0x3f3f3f3f;
const int mod = 1e9+7;
const int dir[4][2]={-1,0,1,0,0,-1,0,1};
int a[110];
int main(){
	ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#ifdef WindCry1
	freopen("C:/Users/LENOVO/Desktop/in.txt","r",stdin);
#endif
	int n;cin>>n;
	bool ok=true;
	for(int i=1;i<=n;i++) {
		cin>>a[i];
		if(a[i]%2==0){
			if(!(a[i]%3==0 or a[i]%5==0)) ok=false;
		}
	}
	cout<<(ok?"APPROVED":"DENIED")<<endl;
	return 0;
}



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

enum occupant
{
build, floor, room, number
}

class Program
 {


     
     static void Main(string[] args)
     {
         String nyuryoku;
         string[] data = new string[3];
         string[] data1;
         int num, sum, temp;
         var result = new List<int>();

         while (true)
         {
             nyuryoku = Console.ReadLine();
             data = nyuryoku.Split(' ');
             num = int.Parse(data[0]);
             sum = int.Parse(data[1]);

             if (num == 0 & sum == 0)
                 break;
             temp = 0;
             for (int i = 1; i <= num; i++)
             {
                 for (int j = i + 1; j <= num; j++)
                     for (int k = j + 1; k <= num; k++)
                         if ((i + j + k) == sum)
                             temp++;
             }
             result.Add(temp);
         }
         for (int l=0; l < result.Count; l++)
             Console.WriteLine("{0}",result[l]);
    




      }
 }



Measured memory_bytes: 20020
#include <iostream>
#include <sstream>
#include <cstdio>
#include <stdlib.h>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
int k=10000;
int b[2000000];
void countingsort(int a[],int n){
  int c[k+1],j;
  for(int i=0;i<=k;i++)c[i]=0;
  for(j=0;j<n;j++)
    c[a[j]]++;
  for(int i=0;i<=k;i++)c[i]=c[i]+c[i-1];
  //cout<<"finish:"<<j<<endl;
  j--;
  for(;j>-1;j--){
    b[c[a[j]]] = a[j];
    c[a[j]]--;
  }
}
int main(){
  int n,i;
  cin>>n;
  int a[n];
  for(i=0;i<n;i++)cin>>a[i];
  countingsort(a,n);

  for(i=1;i<n;i++)cout<<b[i]<<" ";
  cout<<b[i]<<endl;


  return 0;
}



Measured memory_bytes: 18660
import sys
import math
import itertools
import collections

def solve(X,N,P):
    ans = {i for i in range(-200,201,1)}
    ans -= set(P)
    result = 10**2
    q = []
    for a in list(ans):
        target = abs(X - a)
        if(result == target):
            q.append(a)
        elif(result > target):
            result = target
            q = [a]
    return min(q)
def main():
    X,N = map(int,input().split())
    P = list(map(int,input().split()))
    # solve()
    print(solve(X,N,P))

if __name__ == "__main__":
    main()


Measured memory_bytes: 9512
#pragma gcc optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort(ALL(V)) //小さい方からソート
#define REV(V) reverse(ALL(V)) //リバース
#define RSORT(V) SORT(V);REV(V) //大きい方からソート
#define NPN(V) next_permutation(ALL(V)) //順列
#define pb(n) push_back(n)
#define endl '\n'
#define Endl '\n'
#define DUMP(x)  cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define yes(n) cout << ((n) ? "yes" : "no"  ) << endl
#define Yay(n) cout << ((n) ? "Yay!": ":(") << endl
#define RAPID cin.tie(0);ios::sync_with_stdio(false)
#define VSUM(V) accumulate(ALL(V), 0)
#define MID(a,b,c) (a) < (b) && (b) < (c)
#define MIDe(a,b,c) (a) <= (b) && (b) <= (c)
#define IN(n) cin >> n
#define IN2(a,b) cin >> a >> b
#define IN3(a,b,c) cin >> a >> b >> c 
#define IN4(a,b,c,d) cin >> a >> b >> c >> d
#define VIN(V) for(int i = 0; i < (V).size(); i++) {cin >> (V).at(i);}
#define OUT(n) cout << n << endl
#define VOUT(V) REP(i, (V).size()) {cout << (V)[i] << endl;}
#define VOUT2(V) REP(i, (V).size()) {cout << (V)[i] << " ";} cout<<endl;
#define FIX cout << fixed << setprecision(15)

// 型マクロ定義
#define int long long
#define P pair<ll,ll>
#define Vi vector<ll>
#define VVi vector<vector<ll>>
#define Vd vector<double>
#define Vb vector<bool>
#define Vs vector<string>
#define Vc vector<char>
#define M map<ll,ll>
#define S set<ll>
#define PQ priority_queue<ll>
#define PQG priority_queue<ll,V,greater<ll>
//

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

using ll = long long;
using Graph = vector<vector<int>>;

const int MOD = 1000000007;
const int INF = 1061109567;
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

int gcd(int a,int b){return b != 0 ? gcd(b, a % b) : a;} //最大公約数
int lcm(int a, int b){return a * b / gcd(a, b);}
string toStrUp(string str){char diff = 'A'-'a';REP(i,str.size()) str[i] += diff;return str;}
string gCh(string str, int key){return str.substr(key,1);}

signed main() {
  RAPID;
  // デフォルト変数定義
  int n=0,m=0,a=0,b=0,c=0,d=0,x=INF,y=0,z=0;
  string s="",t="";
  //

  // ここから
  IN(n);
  FOR(i,1,n){
    m = n - i;
    s = to_string(i);
    t = to_string(m);
    z = 0;
    REP(j,s.size()) {
      z += stoll(gCh(s,j));
    }
    REP(j,t.size()) {
      z += stoll(gCh(t,j));
    }
    x = min(x,z);
  }
  OUT(x);
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<cmath>
#include<cstring>
#include<utility>
#include<set>
#include<stack>
#include<complex>
#define vi vector<int>
#define vvi vector<vector<int> >
#define ll long long int
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>
#define ld long double
#define INF 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define CC puts("-------ok--------");
#define all(in) in.begin(), in.end()
#define bv vector<bool>
using namespace std;
typedef pair<int, int>PI;
using namespace std;
#define MAX  999999
int main(){
    int n;
    while(cin >> n,n){
         vi v(10000,0);
        rep(i, n){string s; cin >> s; v[i] = (int)s.length();}
        int ans = 0;
        rep(i, n){
            int temp = 0; int array[] = {5,7,5,7,7}; int counter = 0;
            ans = i+1;
            for(int k = i;k<n;k++){
                temp+=v[k];
                if(temp == array[counter])
                {   temp = 0; counter++;
                    if(temp == 0 && counter == 5) goto L;
                }
            }
        }
    L:cout << ans << endl;
        ans = 0;
        
    }
}

Measured memory_bytes: 3220
a, b, k = map(int, input().split(' '))
A = list(filter(lambda x: x <= b, [i for i in range(a, a+k)]))
B = list(filter(lambda x: x >= a, [i for i in range(b-k+1, b+1)]))
print('\n'.join(map(str, sorted(list(set(A+B))))))


Measured memory_bytes: 3060
#include<cstdio>
#include<cstring>
#include<algorithm>
#define rep(i,l,r) for (int i=l; i<=r; i++)
typedef long long ll;
using namespace std;

const int N=200010;
int n,flag,a[N];
ll ans;

int main(){
	scanf("%d",&n);
	rep(i,1,n) scanf("%d",&a[i]);
	if (a[1]) flag=1;
	rep(i,2,n){
		if (a[i]-a[i-1]>1) { flag=1; break; }
		if (a[i]-a[i-1]==1) ans++; else ans+=a[i];
	}
	if (flag) puts("-1"); else printf("%lld\n",ans);
	return 0;
}

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

#define rep(i, n) for(int i = 0; i < (n); i++)
#define ALL(obj) (obj).begin(), (obj).end()

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

  int N, K, X, Y;
  cin >> N >> K >> X >> Y;

  int sum = 0;
  rep(i, N) {
    if(i < K) {
      sum += X;
    } else {
      sum += Y;
    }
  }

  cout << sum << endl;
}


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

#define MOD 1000000007
#define rep(i, n) for(ll i=0; i < (n); i++)
#define rrep(i, n) for(ll i=(n)-1; i >=0; i--)
#define ALL(v) v.begin(),v.end()
#define rALL(v) v.rbegin(),v.rend()
#define FOR(i, j, k) for(ll i=j;i<k;i++)
#define debug_print(var) cerr << #var << "=" << var <<endl;
#define DUMP(i, v)for(ll i=0;i<v.size();i++)cerr<<v[i]<<" "

using namespace std;
typedef long long int ll;
typedef vector<ll> llvec;
typedef vector<double> dvec;
typedef pair<ll, ll> P;
typedef long double ld;
struct edge{ll x, c;};

ll mod(ll a, ll mod){
  ll res = a%mod;
  if(res<0)res=res + mod;
  return res;
}

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

ll modinv(ll a, ll mod){
  return modpow(a, mod-2, mod);
}

ll gcd(ll a, ll b){
  ll r = a%b;
  if(r==0) return b;
  else return gcd(b, a%b);
}

bool is_prime(ll n){
  ll i = 2;
  if(n==1)return false;
  if(n==2)return true;
  bool res = true;
  while(i*i <n){
    if(n%i==0){
      res = false;
    }
    i = i+1;
  }

  //if(i==1)res = false;
  if(n%i==0)res=false;
  return res;
}

struct UnionFind{
  ll N;
  llvec p;
  llvec cnt;
  UnionFind(ll n){
    N = n;
    p=llvec(N);
    cnt=llvec(N, 0);
    rep(i, N){
      p[i] = i;
      cnt[i] = 1;
    }
  }

  void con(ll a, ll b){
    P at = root(a);
    P bt = root(b);
    if(at.second!=bt.second){
      if(at.first>bt.first){
        swap(at, bt);
        swap(a, b);
      }
      p[at.second] = bt.second;
      cnt[bt.second]+=cnt[at.second];
      p[a]=bt.second;
    }
  }

  P root(ll a){
    ll atmp = a;
    ll c=0;
    while(atmp!=p[atmp]){
      atmp = p[atmp];
      c++;
    }
    p[a] = atmp;
    return {c, atmp};
  }

  bool is_con(ll a, ll b){
    P at=root(a);
    P bt=root(b);
    return at.second == bt.second;
  }
  
};

struct dijkstra{
  ll N;
  llvec d;
  vector<vector<edge>> e;
  dijkstra(ll n){
    N = n;
    //d = llvec(N, 1e18);
    e = vector<vector<edge>>(N);
  }

  void add_edge(ll from, ll to, ll cost){
    e[from].push_back({to, cost});
  }

  void run(ll start){
    priority_queue<P, vector<P>, greater<P>> que;
    que.push({0, start});
    d = llvec(N, 1e18);
    d[start]=0;
    while(!que.empty()){
      P q = que.top();que.pop();
      ll dc = q.first;
      ll x = q.second;
      if(dc>d[x]){
        continue;
      }else{
        for(auto ip: e[x]){
          if(d[ip.x]<=d[x]+ip.c){
            continue;
          }else{
            d[ip.x]= d[x]+ip.c;
            que.push({d[ip.x], ip.x});
          }
        }
      }
    }
  }  
};


/**************************************
** A main function starts from here  **
***************************************/
int main(){
  ll N, M;
  cin >> N >> M;
  llvec L(M), R(M);
  rep(i, M)cin >> L[i] >> R[i];
  sort(rALL(L));
  sort(ALL(R));
  cout << max(0LL, R[0]-L[0]+1);
  return 0;
}


Measured memory_bytes: 1792
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
class Simple
{
    int N;
    int[] A;
    void Solve() {
        //input
        N = io.Int;
        A = new int[N];
        for (int i = 0; i < N; ++i)
            A[i] = io.Int;
        //cal
        Array.Sort(A);
        var sums = new long[N];
        sums[0] = A[0];
        for (int i = 1; i < N; ++i)
            sums[i] = sums[i - 1] + A[i];
        var ans = 1;//最大値は必ず残れる
        for (int i = N - 2; i >= 0 && sums[i] * 2 >= A[i + 1]; i--)
            ans++;

        //ret
        Console.WriteLine(ans);
    }
    SimpleIO io = new SimpleIO();
    public static void Main(string[] args) { new Simple().Stream(); }
    void Stream() { Solve(); io.writeFlush(); }
}
class SimpleIO
{
    string[] nextBuffer;
    int BufferCnt;
    char[] cs = new char[] { ' ' };
    StreamWriter sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
    public SimpleIO() {
        nextBuffer = new string[0];
        BufferCnt = 0;
        Console.SetOut(sw);
    }
    public string Next() {
        if (BufferCnt < nextBuffer.Length)
            return nextBuffer[BufferCnt++];
        string st = Console.ReadLine();
        while (st == "")
            st = Console.ReadLine();
        nextBuffer = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        BufferCnt = 0;
        return nextBuffer[BufferCnt++];
    }
    public string String => Next();
    public char Char => char.Parse(String);
    public int Int => int.Parse(String);
    public long Long => long.Parse(String);
    public double Double => double.Parse(String);
    public void writeFlush() { Console.Out.Flush(); }
}


Measured memory_bytes: 25820
# http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP2_1_B&lang=jp
# Deque

from collections import deque

q = deque()
for i in range(0,int(input())):
    l = list(map(str,input().split()))
    c = int(l[0])

    if ( c == 0 ):
        d = int(l[1])
        if (d == 0):
            q.appendleft(l[2])
        elif (d == 1):
            q.append(l[2])
    elif(c == 1):
        d = int(l[1])
        print (q[d])
    elif(c == 2):
        d = int(l[1])
        if (d == 0):
            q.popleft()
        elif (d == 1):
            q.pop()


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

int32_t main()
{
	int n;
	cin>>n;
	vector<int> a(n),b(n),c(n);
	for(int i=0; i<n; i++)
		cin>>a[i]>>b[i]>>c[i];
	vector< vector<int> > dp(n,vector<int>(3,0));
	dp[0][0]=a[0];
	dp[0][1]=b[0];
	dp[0][2]=c[0];
	for(int i=1; i<n; i++)
	{
		dp[i][0]=max(dp[i-1][2]+a[i],dp[i-1][1]+a[i]);
		dp[i][1]=max(dp[i-1][0]+b[i],dp[i-1][2]+b[i]);
		dp[i][2]=max(dp[i-1][0]+c[i],dp[i-1][1]+c[i]);
	} 
	cout<<max(max(dp[n-1][0],dp[n-1][1]),dp[n-1][2]);
	return 0;
}


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

template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

//INSERT ABOVE HERE
signed main(){
  Int n,m;
  cin>>n>>m;
  vector<Int> a(m);
  for(Int i=0;i<m;i++) cin>>a[i];
  const Int INF = 1e8;
  vector<Int> dp(100000,INF);
  dp[0]=0;
  for(Int i=0;i<m;i++)
    for(Int j=0;j+a[i]<(Int)dp.size();j++)
      chmin(dp[j+a[i]],dp[j]+1);

  cout<<dp[n]<<endl;
  return 0;
}



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

#define ll long long
using namespace std;

int main() {
    string s, t;
    cin>>s>>t;
    ll ans = 0;
    for (int i = 0; i <= s.length(); ++i) {
        if  (s[i] != t[i]){
            ans++;
        }
    }
    cout<<ans;
}


Measured memory_bytes: 3840
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil
from operator import itemgetter
from copy import deepcopy
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
inf = 10**17
mod = 10**9 + 7

n=I()
t,a=MI()
hs=LI()
u=[]
mini=inf
for i in range(n):
    k=abs(t-a-hs[i]*0.006)
    if k<mini:
        mini=k
        num=i
        
print(num+1)

Measured memory_bytes: 3692
#include <cmath>

#include <algorithm>
#include <iostream>
#include <vector>

using namespace std;

typedef long long ll;
typedef long double ld;

ld l;

ld a;
ld b;
ld c;

double EPS = 1e-6;

void solve() {
  cin >> l;

  a = l / 3.0;
  
  l -= a;

  b = l / 2.0;

  c = l - b;

  cout.precision(15);
  cout << fixed;

  cout << a * b * c << '\n';
}

int main() {
  int t = 1;

#ifdef _DEBUG
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);

  t = 2;
#endif

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

  while (t--)
    solve();
}


Measured memory_bytes: 256
from collections import defaultdict
def c163(n, al):

    count = defaultdict(int)

    for i in range(n-1):
        count[al[i]] += 1

    return count

def main():
    n = int(input())
    al = list(map(int, input().split()))
    dilist = c163(n, al)
    for i in range(1 , n + 1):
        try:
            print(dilist[i])
        except:
            print("0")

if __name__ == '__main__':
    main()

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

int x;

int main(){
  cin >> x;
  if (x >= 30) cout << "Yes" << endl;
  else cout << "No" << endl;
}

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

namespace program
{
    class Program
    {
        static void Main()
        {
          int a = Input.ScanInt();
          
          if(a<1200)
            Console.WriteLine("ABC");
          else if(a<2800)
            Console.WriteLine("ARC");
          else 
            Console.WriteLine("AGC");
        }
    }

    static class Input
    {
        static public int ScanInt() { return int.Parse(Console.ReadLine()); }
        static public uint ScanUint() { return uint.Parse(Console.ReadLine()); }
        static public double ScanDouble() { return double.Parse(Console.ReadLine()); }
        static public long ScanLong() { return long.Parse(Console.ReadLine()); }
        static public ulong ScanUlong() { return ulong.Parse(Console.ReadLine()); }
        static public int[] ScanIntArray() { return Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray(); }
        static public uint[] ScanUintArray() { return Console.ReadLine().Split(' ').Select(x => uint.Parse(x)).ToArray(); }
        static public double[] ScanDoubleArray() { return Console.ReadLine().Split(' ').Select(x => double.Parse(x)).ToArray(); }
        static public long[] ScanLongArray() { return Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToArray(); }
        static public ulong[] ScanUlongArray() { return Console.ReadLine().Split(' ').Select(x => ulong.Parse(x)).ToArray(); }

        static public string ScanStr() { return Console.ReadLine(); }
        static public string[] ScanStrArray() { return ScanStr().Split(' '); }
    }

    static class MyMath
    {
        public static int GCD(int a, int b)
        {
            Func<int, int, int> gcd = null;
            gcd = (x, y) => y == 0 ? x : gcd(y, x % y);
            return a > b ? gcd(a, b) : gcd(b, a);
        }
        public static ulong GCD(ulong a, ulong b)
        {
            Func<ulong, ulong, ulong> gcd = null;
            gcd = (x, y) => y == 0 ? x : gcd(y, x % y);
            return a > b ? gcd(a, b) : gcd(b, a);
        }
        public static int LCM(int a, int b)
        {
            return a * b / GCD(a, b);
        }
        public static ulong LCM(ulong a, ulong b)
        {
            return a * b / GCD(a, b);
        }
    }
}


Measured memory_bytes: 13140
#pragma GCC optimize("O3")
#include <algorithm>
#include <cstdio>
using namespace std;
#define Maxn 100005
#define mod 1000000007
pair <int,int> arr[Maxn];
int seg[Maxn],app[Maxn],a[Maxn],ex[Maxn],cnt,n,m,cur;
void modify(int pos,int x){for (pos++;pos<=cnt;pos+=pos&-pos) seg[pos]=(seg[pos]+x)%mod;}
int query(int pos){int res=0;for (pos++;pos;pos-=pos&-pos) res=(res+seg[pos])%mod;return res;}
int main()
{
	scanf("%d%d",&n,&m);
	for (int i=0;i<n;i++) scanf("%d",a+i);
	for (int i=0;i<m;i++) scanf("%d",ex+i);
	for (int i=0;i<n;i++)
	{
		int pos=upper_bound(ex,ex+m,a[i])-ex-1;
		if (pos<0) continue;
		arr[cur].first=a[i]-ex[pos];
		pos=lower_bound(ex,ex+m,a[i])-ex;
		if (pos>=m) continue;
		arr[cur].second=ex[pos]-a[i];
		app[cur]=arr[cur].second;
		cur++;
	}
	n=cur;
	sort(arr,arr+n);
	sort(app,app+n+1);
	cnt=unique(app,app+n+1)-app;
	modify(0,1);
	for (int i=0,j=0;i<n;i=j)
	{
		while (j<n && arr[i].first==arr[j].first) j++;
		for (int k=j-1;k>=i;k--)
		{
			arr[k].second=lower_bound(app,app+cnt,arr[k].second)-app;
			if (k+1!=j && arr[k].second==arr[k+1].second) continue;
			modify(arr[k].second,query(arr[k].second-1));
		}
	}
	printf("%d\n",query(cnt-1));
	return 0;
}


Measured memory_bytes: 2176
import java.util.Arrays;
import java.util.Scanner;

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

        int N = sc.nextInt();
        int[] p = new int[N];
        for (int i = 0; i < p.length; ++i) {
            p[i] = sc.nextInt();
        }

        System.out.println(solve(p));

        sc.close();
    }

    static int solve(int[] p) {
        return Arrays.stream(p).sum() - Arrays.stream(p).max().getAsInt() / 2;
    }
}

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

using namespace std;


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

 int a,b,c;
  cin >> a >> b >> c;
 
 if(a+b+c<=21) cout << "win" << endl;
 else cout << "bust" << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#include <functional>
#include <map>
#include <iomanip>

using namespace std;

int main() {
	string str, str3;
	string str2 = "YAKI";

	cin >> str;

	str3 = str.substr(0, 4);

	if (str3 == str2) {
		cout << "Yes" << endl;

	}
	else {
		cout << "No" << endl;
	}





	return 0;
}

Measured memory_bytes: 256
import java.util.*;
import java.math.BigDecimal;
import java.math.MathContext;

public class Main {
  public static void main(String[] args) {
    Scanner sc=new Scanner(System.in);
    int n=sc.nextInt();
    int d=sc.nextInt();
    int[][] x=new int[n][d];
    int ans=0;
    BigDecimal z=BigDecimal.valueOf(0);
    for(int i=0;i<n;i++){
      for(int k=0;k<d;k++){
        x[i][k]=sc.nextInt();
      }
      for(int j=0;j<i;j++){
        long a=0;
        for(int k=0;k<d;k++){
          a=a+(x[i][k]-x[j][k])*(x[i][k]-x[j][k]);
        }
        BigDecimal aa=BigDecimal.valueOf(a);
        aa=sqrt(aa,5);
        BigDecimal b=aa.setScale(0,BigDecimal.ROUND_DOWN);
        b=aa.subtract(b);
        if(b.compareTo(z)==0){
          ans++;
        }
      }
    }
    System.out.println(ans);
  }

  public static BigDecimal sqrt(BigDecimal a, int scale){
    BigDecimal x = new BigDecimal(Math.sqrt(a.doubleValue()), MathContext.DECIMAL64);
    if(scale < 17) return x;
    BigDecimal b2 = new BigDecimal(2);
    for(int tempScale = 16; tempScale < scale; tempScale *= 2){
      x = x.subtract(x.multiply(x).subtract(a).divide(x.multiply(b2), scale, BigDecimal.ROUND_HALF_EVEN));
    }
    return x;
  }
}

Measured memory_bytes: 27280
import math
def factorization(n):
    arr = []
    temp = int(math.sqrt(n)+1)
    for i in range(1,temp+1):
      if n % i == 0:
        arr.append(i+n/i-2)

    return arr
  
N = int(input())
A = factorization(N)
print(int(min(A)))


Measured memory_bytes: 38640
#include<stdio.h>
 
 
int main(){
    int N;
    int Q;
    scanf("%d",&N);
    scanf("%d",&Q);
    char S[100001];
    scanf("%s",S);
    int l[Q];
    int r[Q];
    for(int i=0;i<Q;i++){
        scanf("%d",&l[i]);
        scanf("%d",&r[i]);
    }
    int num[100001]={};
    for(int i=0;i<N;i++){
        if(S[i]=='A'&&S[i+1]=='C'){
                num[i]++;
                i++;
            }
    }
    
    int max = 0;
    for(int i=0;i<N;i++){
            max += num[i];
    }
    
    
    
    
    
    
    
    for(int i=0;i<Q;i++){    
        
        int counter=0;
        if(r[i]-l[i]<N/2)
        for(int j=l[i];j<r[i];j++){
            counter += num[j-1];
        }
        else {
            counter = max;
            for(int j=1;j<l[i];j++){
                counter -=num[j-1];
            }
            for(int j=r[i];j<=N;j++){
                counter -=num[j-1];
            }
        }
        
        
        printf("%d",counter);
        printf("\n");
    }
 
    return 0;
 
 
 
 
 
 
 
}

Measured memory_bytes: 2048
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a,b;
  int c,d;
  cin >> a >> b >> c >> d;
  int yoko,tate;
  yoko = c-a;
  tate = d-b;
  for(int i = 0;i < yoko;i++){
    cout << 'R';}
  for(int i = 0;i < tate;i++){
    cout << 'U';}
  for(int i = 0;i < yoko;i++){
    cout << 'L';}
  for(int i = 0;i < tate;i++){
    cout << 'D';}
  cout << 'D';
  for(int i = 0;i < yoko+1;i++){
    cout << 'R';}
   for(int i = 0;i < tate+1;i++){
    cout << 'U';}
  cout << 'L';
  cout << 'U';
  for(int i = 0;i < yoko+1;i++){
    cout << 'L';}
  for(int i = 0;i < tate+1;i++){
    cout << 'D';}
  cout << 'R' << endl;
}

Measured memory_bytes: 256
# イルカはプログラミングコンテスト好きで、
# 今日はAtCoderのコンテストに参加します。
# 現在時刻は、24 時間表記 (0:00〜23:59) で
# A 時ちょうどであり、コンテストがちょうど B 時間後に始まります。
# コンテストの開始時刻は、24 時間表記で何時ちょうどでしょうか?

ab = gets.chomp.split
a = ab[0].to_i
b = ab[1].to_i

if a + b >= 24
    puts a + b - 24
else
    puts a + b
end

Measured memory_bytes: 1916
#include<iostream>
#include<string>
using namespace std;
int main(void){
    int k;
    cin>>k;
    string s;
    cin>>s;
    if(s.size()>k){
        for(int i(0);i<k;i++)cout<<s[i];
        cout<<"...";
        cout<<endl;
    }
    else cout<<s<<endl;
    return 0;
}

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

#define ll long long
#define rep(A,B,C) for(A=B;A<C;++A)
#define repd(A,B,C) for(A=(ll)C-1;A>=B;++A)
#define pii pair<int,int>
#define pll pair<ll,ll>
template<typename T>
void mxin(T& a,T b){if(a<b)a = b;}
template<typename T>
void mnin(T& a,T b){if(a>b)a = b;}
using namespace std;

/////////////////////////////////////////////////////
#define MOD 998244353


ll A, B, C, D;
ll dp[3030][3030][3];
ll i, j, k;

int main(){
    scanf("%lld%lld%lld%lld", &A, &B, &C, &D);

    dp[A][B][1] = 1;
    rep(i,A,C+1){
        rep(j,B,D+1){
            //printf("%lld ", dp[i][j][0] + dp[i][j][1]);
            (dp[i][j + 1][0] += (dp[i][j][0] + dp[i][j][1]) * i) %= MOD;
            (dp[i + 1][j][1] += dp[i][j][0] + dp[i][j][1] * j) %= MOD;
        }
        //cout << endl;
    }
    printf("%lld\n", (dp[C][D][0] + dp[C][D][1]) % MOD);
    return 0;
}

Measured memory_bytes: 216712
n=int(input())
for i in range(1,n+1):
    x=i
    if x%3==0:
        print(' {}'.format(i),end='')
    else:
        include3=False
        while x:
            if x%10==3:
                include3=True
            x//=10
        if include3:
            print(' {}'.format(i),end='')
print()
            



Measured memory_bytes: 5872
#include <bits/stdc++.h>
#define _ ios_base::sync_with_stdio(0);cin.tie(0);
using namespace std;
int main(){
	int num;
	cin>>num;
	long long int a[num];
	for(int i=0;i<num;i++){
		cin>>a[i];
	}
	sort(a,a+num);
	long long int s1=0,s2=0;
	for(int i=num-2;i>=0;i--){
		if(a[i]==a[i+1]){
			if(s1==0){
				s1=a[i];	
			}
			else{
				s2=a[i];
				break;
			}
			a[i]=0;
			a[i+1]=0;
		}
	}
	cout<<s1*s2<<endl;
}


Measured memory_bytes: 1024
K, N = list(map(int, input().split()))
A = list(map(int, input().split()))

sub_a = []

for i in range(len(A)):
    if i + 1 == len(A):
        sub_a.append(A[0] + K - A[i])
    else:
        sub_a.append(A[i + 1] - A[i])

max_sub = max(sub_a)

print(K - max_sub)

Measured memory_bytes: 25840
#define _USE_MATH_DEFINES
#include <iostream>
#include <sstream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <algorithm>
#include <climits>
#include <cstring>
#include <cmath>
#include <stack>
#include <iomanip>
#include <tuple>
#include <functional>
#include <cfloat>
#include <map>
#include <set>
#include <array>
#include <stdio.h>
#include <string.h>
#include <random>
using ll = long long;
using ull = unsigned long long;
using namespace std;
#define int long long
#define CONTAINS_VEC(v,n) (find((v).begin(), (v).end(), (n)) != (v).end())
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
#define ARY_SORT(a, size) sort((a), (a)+(size))
#define REMOVE(v,a) (v.erase(remove((v).begin(), (v).end(), (a)), (v).end()))
#define REVERSE(v) (reverse((v).begin(), (v).end()))
#define ARY_REVERSE(v,a) (reverse((v), (v)+(a)))
#define REP(i, n) for (int (i)=0; (i) < (n); (i)++)
#define REPE(i, n) for (int (i)=0; (i) <= (n); (i)++)
#define CONTAINS_MAP(m, a) (m).find((a)) != m.end()
#define CONTAINS_SET(m, a) (m).find((a)) != m.end()
void YesNo(bool b) { cout << (b ? "Yes" : "No") << endl; }
//void YESNO(bool b) { cout << (b ? "YES" : "NO") << endl; }
void Yes() { cout << "Yes" << endl; } 
void No() { cout << "No" << endl; }

signed main()
{
	int a, b;
	cin >> a >> b;
	string s;
	cin >> s;
	for (int i = 0; i < a; i++)
	{
		if (s[i] == '-')
		{
			No();
			return 0;
		}
	}
	
	if (s[a] != '-')
	{
		No();
		return 0;
	}

	for (int i = 0; i < b; i++)
	{
		if (s[a + 1 + i] == '-')
		{
			No();
			return 0;
		}
	}
	Yes();
}




Measured memory_bytes: 3636
#include<iostream>
#include<cstdio>
#include <stdio.h>
#include<algorithm>
#include<cstring>
#include <string>
#include<cmath>
#include<cstdlib>
#include<queue>
#include<map>
#include<vector>
#include<bits/stdc++.h>
#include <set>
#define ll   long long
#define IO ios::sync_with_stdio(false);cin.tie();cout.tie(0)
#define inf 0x3f3f3f3f3f3f3f3f
#define pi 3.1415926535898
#define N 500050
using namespace std;
char a[10010];
int n,k,ans,f[1050][5];
int main()
{
    cin>>a+1;
    cin>>n;
    int len=strlen(a+1);
    for(int i=1; i<=len; i++)
        a[i]-='0';
    f[0][0]=1;
    for(int i=1; i<=len; i++)
    {
        f[i][0]=f[i-1][0];
        for(int j=1; j<=3; j++)
        {
            f[i][j]=f[i-1][j]+9*f[i-1][j-1];
        }
    }
    int cnt=0;
    for(int i=1; i<=len; i++)
    {

        if(a[i])
        {
            if(n-cnt>=0)
                ans+=f[len-i][n-cnt];
        }

        if(a[i]>1)
        {
            if(n-cnt-1>=0)
                ans+=(a[i]-1)*f[len-i][n-cnt-1];
        }
        if(a[i])
            ++cnt;
    }
    if(cnt==n)
        ++ans;
    cout<<ans;
    return 0;
}


Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
#define lp(i, n) for(int i = 0; i < n; i++)
#define all(v) v.begin(), v.end()
#define int long long
#define mod 1000000007

void solve() {
        int n; cin >> n;
        if (n & 1) {
                cout << "0\n";
        } else {
                n /= 2;
                int cnt = 0;
                while ( n / 5 >= 1 ) {
                        cnt += n / 5;
                        n /= 5;
                }
                cout << cnt;
        }
        return;
}

int32_t main() {
ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
        int t = 1;
        //cin >> t;
        while ( t-- ) {
                solve();
        }
return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define lli long long int
#define MODV 1000000007
#define INF INT_MAX // 2147483647
#define INFLL LLONG_MAX // 9223372036854775807
#define rep(i, n) for(lli i=0, i##_len=(lli)(n); i<i##_len; i++)
#define repf(i, n) for(lli i=1, i##_len=(lli)(n+1); i<i##_len; i++)
#define per(i, n) for(lli i=((lli)(n))-1; i>=0; i--)
#define perf(i, n) for(lli i=((lli)(n)); i>0; i--)
#define all(v) v.begin(), v.end()
#define endl "\n"
#define vi vector<lli>
#define vvi vector<vector<lli>>
#define Yes() cout << "Yes" << endl
#define YES() cout << "YES" << endl
#define No() cout << "No" << endl
#define NO() cout << "NO" << endl
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; }
using namespace std;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(10);
    lli k, x; cin >> k >> x;
    for(lli i=x-k+1; i<x+k; i++) cout << i << ((i == x+k-1) ? endl : " ");
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,a) for(int i = 0; i < (a); i++)
#define reps(i, a, b) for(int i = (a); i < (b); i++)
#define INF 1e9
typedef vector<int> vi;
typedef vector<vi> vii;
typedef pair<int, int> pii;
vector<string> split(const string &s, char delim) {
	vector<string> elem;
	stringstream ss(s);
	string item;
	while(getline(ss, item, delim)) {
		if(!item.empty()) {
			elem.push_back(item);
		}
	}
	return elem;
}
double calc(double num1, double num2, string s) {
	if(s == "+") return num1 + num2;
	if(s == "-") return num1 - num2;
	if(s == "*") return num1 * num2;
	else return num1 / num2;
}
int main() {
	string str;
	while(getline(cin, str)) {
		stringstream ss(str);
		string s;
		stack<double> S;
		while(ss >> s) {
			if(s == "-" || s == "*" || s == "/" || s == "+") {
				double num1,num2;
				num2 = S.top();S.pop();
				num1 = S.top();S.pop();
				S.push(calc(num1, num2, s));
			} else {
				double num;
				sscanf(s.c_str(), "%lf", &num);
				S.push(num);
			}
		}
		printf("%.7lf\n", S.top());
	}
	return 0;
}

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

typedef pair<int, int> Pii;

void readline(int N, vector<int> &a){
    string s;
    for(int i = 0; i < N - 1; i++){
        getline(cin, s, ' ');
        a[i] = atoi(s.c_str());
    }
    getline(cin, s, '\n');
    a[N - 1] = atoi(s.c_str());
}
void readline(int N, vector<double> &a){
    string s;
    for(int i = 0; i < N - 1; i++){
        getline(cin, s, ' ');
        a[i] = atof(s.c_str());
    }
    getline(cin, s, '\n');
    a[N - 1] = atof(s.c_str());
}

signed main(){

    int N;
    string S;
    cin >> N;
    cin >> S;

    int ans = 0;

    FOR(i, 1, N){
        string S2 = S.substr(i, N);
        int ans_tmp = 0;
        REP(j, i){
            string S1 = S.substr(0, j);
            if(S1.find(S[j]) == string::npos && S2.find(S[j]) != string::npos){
                ans_tmp++;
            }
        }
        if(ans_tmp > ans) ans = ans_tmp;
    }

    cout << ans;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>


// #define INT_MAX 2147483647
// #define LL_MAX 9223372036854775807

using namespace std;
#define i64  long long

void solve(void)
{

  int a,b,c;
  cin>>a>>b>>c;
  int count = 0;
  for (int i = a; i <= b; i++)
  {
    if(c%i == 0)
    count++;
  }
  
  cout<<count<<endl;
  
  return;
}
int main(int argc, const char *argv[])
{

  solve();

  return 0;
}



Measured memory_bytes: 3096
program sample
    implicit none
    
    real(16)::A, B, H, M, c, d
    real(16), parameter::pi = 3.1415926535897932384626433_16
    read(*,*) A, B, H, M

    d = (30.0_16*H - 5.5_16*M)
    c = sqrt(A*A + B*B - 2*A*B*cos(d/180.0_16*pi))

    write(*,*) c

    stop
end program sample

Measured memory_bytes: 2984
#include <iostream>
#include <vector>
#include <iomanip>
using namespace std;
using ll = long long;
const int INF = 1e7;
const int MOD = 1e9 + 7;
const int N = 2020;

// 隣接リスト
vector<vector<int>> list;

// 最短距離
vector<vector<int>> shortest;

vector<bool> seen;

// 始点, 現在の頂点, 深さ
void dfs(int start, int v, int depth) {
    seen[v] = true;

    for(auto next_v : list[v]) {
        if(seen[next_v]) continue;
        int temp = min(shortest[start][next_v], depth + 1);
        // cout << "(" << start << ", " << next_v << "): " << temp << endl;
        shortest[start][next_v] = temp;
        dfs(start, next_v, depth + 1);
        seen[next_v] = false;
    }
}

int main() {
    int n, x, y;
    cin >> n >> x >> y;
    x--; y--;

    shortest.resize(n, vector<int>(n));
    for(int i = 0; i < n; i++) {
        for(int j = 0; j < n; j++) {
            shortest[i][j] = INF;
        }
    }

    list.resize(n);
    list[0].push_back(1);
    list[n - 1].push_back(n - 2);
    for(int i = 1; i < n - 1; i++) {
        list[i].push_back(i - 1);
        list[i].push_back(i + 1);
    }
    list[x].push_back(y);
    list[y].push_back(x);

    for(int i = 0; i < n; i++) {
        int s = list[i].size();
        /*
        cout << s << endl;
        for(int j = 0; j < s; j++) {
            cout << "list[" << i << "][" << j  << "]: " << list[i][j] << endl;;
        }
         */
    }
    

    seen.resize(n);
    for(int i = 0; i < n; i++) {
        seen.assign(n, false);
        dfs(i, i, 0);
        // cout << "===" << endl;
    }
    
    int ans[n] = {};

    for(int i = 0; i < n - 1; i++) {
        for(int j = i + 1; j < n; j++) {
            ans[shortest[i][j]]++;
        }
    }

    for(int i = 1; i < n; i++) {
        cout << ans[i] << endl;
    }
    

    return 0;
}

Measured memory_bytes: 16256
#include<iostream>

using namespace std;

int main()
{
  int n;
  cin>>n;
  int arrA[n+1],arrB[n+1],arrC[n+1];

  for(int i = 1 ; i<=n ; i++)
  {
    cin>>arrA[i]>>arrB[i]>>arrC[i];
  }

  int dpA[n+1],dpB[n+1],dpC[n+1];

  dpA[1] = arrA[1];
  dpB[1] = arrB[1];
  dpC[1] = arrC[1];

  for(int i = 2 ; i<= n ; i++)
  {
    dpA[i] = arrA[i] + max(dpB[i-1],dpC[i-1]);
    dpB[i] = arrB[i] + max(dpA[i-1],dpC[i-1]);
    dpC[i] = arrC[i] + max(dpB[i-1],dpA[i-1]);
  }

  cout<<max(dpA[n],max(dpB[n],dpC[n]));
  
  return 0;
}

Measured memory_bytes: 2560
#include<string> 
#include<vector>
#include<iostream>
using namespace std;
bool map[20][20][4];
vector< string > maphor,mapver;
int xsize,ysize;
void init(){
	for(int i=0;i<20;i++){
		for(int j=0;j<20;j++){
			for(int k=0;k<4;k++){
				map[i][j][k]=0;
			}
		}
	}
}
void setmap(){
	for(int i=0;i<20;i++){
		for(int j=0;j<20;j++){
			if(-1<i&&i<maphor.size()&&-1<j&&j<maphor[0].size()){
				if(maphor[i][j]=='1'){
					map[i][j][0]=1;
				}
			}
			if(-1<i&&i<maphor.size()&&-1<j-1&&j-1<maphor[0].size()){
				if(maphor[i][j-1]=='1'){
					map[i][j][2]=1;
				}
			}
			if(-1<i&&i<mapver.size()&&-1<j&&j<mapver[0].size()){
				if(mapver[i][j]=='1'){
					map[i][j][3]=1;
				}
			}
			if(-1<i-1&&i-1<mapver.size()&&-1<j&&j<mapver[0].size()){
				if(mapver[i-1][j]=='1'){
					map[i][j][1]=1;
				}
			}
		}
	}
}

int solve(){
	int x=0,y=0;
	int v=0;
	string vec="RULD";
	int loop[4]={1,0,3,2};
	int vx[4]={1,0,-1,0};
	int vy[4]={0,-1,0,1};
	int count=0;
	while(1){
		count++;
		if(count>100)return -1;
		for(int i=0;i<5;i++){
			if(i==4)return -1;
			if(x==0
				&& y==0
				&&(((v+loop[i])%4)==2)){
				return 0;
			}
			if(map[y][x][(v+loop[i])%4]==1){
				v+=loop[i];
				v=v%4;
				x+=vx[v];
				y+=vy[v];
				cout<<vec[v];
				break;
			}
		}
	}
}

int main(){
	string tmp;
	for(int i=0;cin>>tmp;i++){
		if(i%2==0){
			maphor.push_back(tmp);
		}else{
			mapver.push_back(tmp);
		}
	}
	xsize=maphor[0].size()+1;
	ysize=mapver.size()+1;
	init();setmap();
	
	/*
	for(int i=0;i<xsize;i++){
		for(int j=0;j<ysize;j++){
			for(int k=0;k<4;k++){
				cout<<map[i][j][k];
			}
			cout<<" ";
		}
		cout<<endl;
	}
	*/
	if(solve()==-1)return -1;
	cout<<endl;
	
	return 0;
	
}

Measured memory_bytes: 1188
#include <bits/stdc++.h>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <utility>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define _GLIBCXX_DEBUG
using namespace std;
typedef long long ll;
typedef pair<int, int> pair;
const int inf = 1000000000; //10^9

int main(){
    int n, x;
    cin >> n >> x;
    vector<int> a(n);
    rep (i, n) cin >> a[i];
    
    int ans = 0;
    sort(a.begin(), a.end());
    for (int i = 0; i < n; i++) {
        if (a[i] <= x) {
            ans++;
            x -= a[i];
        }
        else continue;
    }
    if (x) ans = min(ans, n - 1);
    cout << ans << endl;

    return 0;
}

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

int main(){
  int m1,d1;
  cin >> m1 >> d1;
  
  int m2,d2;
  cin >> m2 >> d2;
  
  if(m1 == 12 && d1 == 31){
    cout << "1\n";
  }
  else if((m1 == 1 || m1 == 3 || m1 == 5 || m1 == 7 || m1 == 8 || m1 == 10) && d1 == 31){
    cout << "1\n";
  }
  else if(m1 == 2 && d1 == 28){
    cout << "1\n";
  }
  else if((m1 == 4 || m1 == 6 || m1 == 9 || m1 == 11) && d1 == 30){
    cout << "1\n";
  }
  else{
    cout << "0\n";
  }
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <memory.h>
#include <math.h>
#include <assert.h>
#include <queue>
#include <map>
#include <set>
#include <string>
#include <algorithm>
#include <iostream>
#include <functional>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <bitset>

using namespace std;
typedef pair<int, int> pii;
typedef long long ll;
#define Fi first
#define Se second
#define pb(x) push_back(x)
#define sz(x) ((int)(x).size())
#define rep(i, n) for(int i=0;i<n;i++)
#define all(x) (x).begin(), (x).end()
typedef tuple<int, int, int> t3;
typedef pair<ll, ll> pll;
typedef long double ldouble;
typedef pair<double, double> pdd;

void solve() {
	int n, a[11];
	scanf("%d", &n);
	for(int i=1;i<=n;i++) scanf("%d", a+i);
	int ans = 1;
	rep(i, n) ans = ans * 3;
	int c = 1;
	rep(i, n) c *= (a[i+1] & 1) ? 1 : 2;
	printf("%d\n", ans - c);
}

int main(){
	int Tc = 1; // scanf("%d\n", &Tc);
	for(int tc=1;tc<=Tc;tc++){
		// printf("Case #%d: ", tc);
		solve();
	}
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		int m = 0;
		int f = 0;
		int r = 0;
		String record ="";

		Scanner sc= new Scanner(System.in);

		while ( true ) {
			m = sc.nextInt();
			f = sc.nextInt();
			r = sc.nextInt();

			if ( m == -1 && f == -1 && r == -1 ) {
				break;
			}

			if ( m == -1 || f == -1) {
				record ="F";
			} else if( ( m + f ) >= 80 ) {
				record ="A";
			} else if( ( m + f ) >= 65 ) {
				record ="B";
			} else if( ( m + f ) >= 50 ) {
				record ="C";
			} else if( ( m + f ) >= 30 ) {
				record ="D";
				if( r >= 50 ) {
					record ="C";
				}
			} else {
				record ="F";
			}
			System.out.println( record );
		}
		sc.close();
	}
}


Measured memory_bytes: 26204
#include <iostream>
#define REP(i, a, n) for(int i=a; i<n; i++)
using namespace std;

int a, b;
int h[1001];
int main() {
    cin>>a>>b;
    REP(i, 1, 1000) h[i]=h[i-1]+i;

    int i=1;
    while(i<1000){
        if(b-a==i) break;
        i++;
    }
    cout<<h[i-1]-a<<endl;
    return 0;
}

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

int main() {
    string s, t;
    int count = 0;

    cin >> s >> t;

    for (int i = 0; i < s.size(); i++) {
        char sc = s[i];
        char tc = t[i];
        if (sc != tc) count++;
    }

    cout << count << endl;

    return 0;
}


Measured memory_bytes: 3816
lastday=[-1]*26
def last(d):
  sum=0
  for i in range(26):
    sum+=c[i]*(d-lastday[i])
  return sum

def myFunc(i,Score,depth,lastday):
  tmp_score=Score
  tmp_max_choice=0
  tmp_score-=last(i)
  tmp_max_score=tmp_score
  tmp_deep_score=tmp_score
  
  for k,j in enumerate(s[i]):
    if depth==0 or i==D-1:      
      if tmp_max_score<tmp_score+j+c[k]*(i-lastday[k]):
        tmp_max_choice=k
        tmp_max_score=tmp_score+j+c[k]*(i-lastday[k])
    else:
      l=lastday.copy()
      l[k]=i
      score,choice=myFunc(i+1,tmp_score+j+c[k]*(i-lastday[k]),depth-1,l)
      if tmp_deep_score<score:
        tmp_max_choice=k
        tmp_max_score=tmp_score+j+c[k]*(i-lastday[k])
        tmp_deep_score=score

  return tmp_max_score,tmp_max_choice

D=int(input())
c=list(map(int,input().split()))
s=[]
for i in range(D):
  s.append(list(map(int,input().split())))
Score=0
for i in range(D):
  score,choice=myFunc(i,Score,1,lastday)
  Score=score
  lastday[choice]=i
  print(choice+1)
  


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

using namespace std;

int main(){
   int S;
   cin >> S;
   int Y = S/100;
   int D = S%100;
   if( 1 <=Y && Y <=12 ){
      if( 1<= D  && D <= 12 ){
         cout <<"AMBIGUOUS" << endl;
      }
      else{
         cout << "MMYY" << endl;
      }
   }
   else{
      if( 1<= D && D<= 12 ){
         cout << "YYMM"<< endl;
      }
      else{
         cout <<"NA"<<endl;
      }
   }
   return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
  char t[100000] = {0};
  int i, tlen = 0, count = 0;
  scanf("%s", t);

  for (i = 0; t[i] != '\0'; i++)
    tlen++;
  
  for (i = 0; i < tlen - 1; i++)
    if (t[i] != t[i+1])
      count++;
  
  printf("%d\n", count);

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#include <iostream>
#include <vector>
#include <cstdlib>
#include <cmath>
#include <math.h>
#include <sstream>
#include <numeric>
#include <cctype>
#include <bitset>
#include <cassert>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define SIZE 100005
#define INF 1000000000000000LL
using pint = pair<int,int>;
using vec = vector<int>;
using ll=long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }


int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n,k;cin>>n>>k;
    vec p(n);
    rep(i,n) cin>>p[i];
    sort(p.begin(),p.end());

    int ans=0;
    rep(j,k) ans+=p[j];
    cout<<ans<<endl;
}

Measured memory_bytes: 3620
#include <iostream>
using namespace std;
#include<vector>
#include<cmath>
#include<map>
#include<cstdlib>
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<set>
#include<stack>
#include<bitset>
#include<functional>
#include<ctime>
#include<queue>
#include<deque>
#include<complex>
#include<cassert>
using namespace std;
#define pb push_back
#define pf push_front
typedef long long lint;
typedef complex<double> P;
#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> pint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
int a[110];
int main(void){
    // Your code here!
    int n;int w;int h;
	cin>>n;
	cin>>h;
	cin>>w;

	cout<<(n-h+1)*(n-w+1)<<endl;
    
    
}


Measured memory_bytes: 256
import java.util.*;
public class Main {
    
    public static void main(String args[]){
        Scanner scanner = new Scanner(System.in);
        long X = scanner.nextLong();
        long money = 100;
        long year = 0;
        while(true){
            money = (long)(money*1.01);
            year++;
            if(money>=X){
                break;
            }
        }
        System.out.println(year);
    }
}

Measured memory_bytes: 35696