akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define sf1(n) scanf("%d",&n)
#define sf2(n,q) scanf("%d %d",&n,&q)
#define f first
#define ss second
#define pb push_back
#define lli long long
#define mem(ar,false) memset(ar,false,sizeof(ar))
#define mpr make_pair
#define endl "\n"
#define mod 1000000007
#define inf 9000000000000000000LL

using namespace std;
lli dp[3002][3002];
lli ar[3002];

int n;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    cin >> n;

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

    for(int i=n-1;i>=0;i--)
    {
        for(int j=i;j<n;j++)
        {
            if(i==j)
                dp[i][j] = ar[i];
            else
                dp[i][j] = max(ar[i]-dp[i+1][j],ar[j]-dp[i][j-1]);
        }
    }


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

    return 0;

}


Measured memory_bytes: 49756
import java.util.*;
import java.util.Map.Entry;
import java.io.*;
import java.lang.reflect.Array;
import java.math.BigInteger;
import java.rmi.server.UnicastRemoteObject;

import static java.lang.Math.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;
 
public class Main{
    static long mod=1000000007;
//    static int dx[]={-1,0,1,0};
//    static int dy[]={0,-1,0,1};

    public static void main(String[] args)   throws Exception, IOException{        
        Reader sc = new Reader(System.in);
        PrintWriter out=new PrintWriter(System.out);

        int n=sc.nextInt();
        PriorityQueue<Double> q=new PriorityQueue<>();
        for (int i = 0; i < n; i++) {
			q.add(sc.nextDouble());
		}
        
        while(q.size()>1) {
        	double a=q.poll();
        	double b=q.poll();
        	q.add((a+b)/2);
        }
        

        out.println(q.poll());
        out.flush();
    }



    static boolean validpos(int x,int y,int r, int c){
        return x<r && 0<=x && y<c && 0<=y;
    }

    static void db(Object... os){
        System.err.println(Arrays.deepToString(os));
    }
}

//class P {
//	int x, y;
//	P(int  x, int y) {
//	  this.x=x;
//	  this.y=y;
//	}
//}


//class P {
//    int id, d;
//    P(int  id, int d) {
//        this.id=id;
//        this.d=d;
//    }
//}

class P implements Comparable<P>{
    int a,b;
    P(int a, int b) {
    	this.b=b;
    	this.a=a;
    }

    public int compareTo(P p){
    	if(a==p.a) return b-p.b;
        return -p.a+a;
    }
}

class Reader
{ 
    private BufferedReader x;
    private StringTokenizer st;
    
    public Reader(InputStream in)
    {
        x = new BufferedReader(new InputStreamReader(in));
        st = null;
    }
    public String nextString() throws IOException
    {
        while( st==null || !st.hasMoreTokens() )
            st = new StringTokenizer(x.readLine());
        return st.nextToken();
    }
    public int nextInt() throws IOException
    {
        return Integer.parseInt(nextString());
    }
    public int[] nextIntArray(int size) throws IOException{
        int r[] = new int[size];
        for (int i = 0; i < size; i++) {
            r[i] = this.nextInt(); 
        }
        return r;
    }
    public long[] nextLongArray(int size) throws IOException{
        long r[] = new long[size];
        for (int i = 0; i < size; i++) {
            r[i] = this.nextLong(); 
        }
        return r;
    }
    public long nextLong() throws IOException
    {
        return Long.parseLong(nextString());
    }
    public double nextDouble() throws IOException
    {
        return Double.parseDouble(nextString());
    }
}


Measured memory_bytes: 22356
import java.util.Scanner;

public class Main {
	static int H, W;
	static char[][] s;
	static int[] dx = {1, -1, 0, 0};
	static int[] dy = {0, 0, 1, -1};

	static boolean check(int i, int j) {
		for (int k = 0; k < 4; k++) {
			int i2 = i + dx[k];
			int j2 = j + dy[k];
			if(0 <= i2 && i2 < H && 0 <= j2 && j2 < W && s[i2][j2] == '#') return true;
		}
		return false;
	}

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		H = sc.nextInt();
		W = sc.nextInt();
		s = new char[H][W];
		for (int i = 0; i < H; i++) {
			s[i] = sc.next().toCharArray();
		}

		for (int i = 0; i < H; i++) {
			for (int j = 0; j < W; j++) {
				if(s[i][j] == '.') continue;
				if(s[i][j] == '#') {
					if(!check(i, j)) {
						System.out.println("No");
						return;
					}
				}
			}
		}

		System.out.println("Yes");
	}
}

Measured memory_bytes: 21972
#include <math.h>
double a,b,x;main(){scanf("%lf%lf%lf",&a,&b,&x);if (x<a*a*b/2){a=(2*x)/(a*b);printf("%.9f",atan(b/a)*180/M_PI);}else{x=a*a*b-x;b=(2*x)/(a*a);printf("%.9f",atan(b/a)*180/M_PI);}}

Measured memory_bytes: 128
import java.util.Scanner;
public class Main {
 public static void main(String[] args){
     Scanner sc=new Scanner(System.in);
     int x,y,i=0;
     int[] c=new int[3001];
     int[] d=new int[3001];
     for(;;){
         x=sc.nextInt();
         y=sc.nextInt();
         if(x<y){
         c[i]=x;
         d[i]=y;}
         else {
             c[i]=y;
             d[i]=x;
		  	
         }
         i=i+1;
         if(x==0)
             if(y==0)break;
     }       
     for(int a=0;a<i-1;a++)
     System.out.println(c[a]+" "+d[a]);
    sc.close();
 }
    
    
}


Measured memory_bytes: 35956
using Yorukatsu053.Questions;
using Yorukatsu053.Extensions;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;

namespace Yorukatsu053.Questions
{
    /// <summary>
    /// https://atcoder.jp/contests/abc076/tasks/abc076_b
    /// </summary>
    public class QuestionA : AtCoderQuestionBase
    {
        public override IEnumerable<object> Solve(TextReader inputStream)
        {
            var n = inputStream.ReadInt();
            var k = inputStream.ReadInt();

            var current = 1;
            for (int i = 0; i < n; i++)
            {
                if (current < k)
                {
                    current *= 2;
                }
                else
                {
                    current += k;
                }
            }

            yield return current;
        }
    }
}


namespace Yorukatsu053
{
    class Program
    {
        static void Main(string[] args)
        {
            IAtCoderQuestion question = new QuestionA();    // 問題に合わせて書き換え
            var answers = question.Solve(Console.In);
            foreach (var answer in answers)
            {
                Console.WriteLine(answer);
            }
        }
    }
}

#region Base Classes

namespace Yorukatsu053.Questions
{

    public interface IAtCoderQuestion
    {
        IEnumerable<object> Solve(string input);
        IEnumerable<object> Solve(TextReader inputStream);
    }

    public abstract class AtCoderQuestionBase : IAtCoderQuestion
    {
        public IEnumerable<object> Solve(string input)
        {
            var stream = new MemoryStream(Encoding.Unicode.GetBytes(input));
            var reader = new StreamReader(stream, Encoding.Unicode);

            return Solve(reader);
        }

        public abstract IEnumerable<object> Solve(TextReader inputStream);
    }

}

#endregion

#region Extensions

namespace Yorukatsu053.Extensions
{
    internal static class TextReaderExtensions
    {
        internal static int ReadInt(this TextReader reader) => int.Parse(ReadString(reader));
        internal static long ReadLong(this TextReader reader) => long.Parse(ReadString(reader));
        internal static double ReadDouble(this TextReader reader) => double.Parse(ReadString(reader));
        internal static string ReadString(this TextReader reader) => reader.ReadLine();

        internal static int[] ReadIntArray(this TextReader reader, char separator = ' ') => ReadStringArray(reader, separator).Select(int.Parse).ToArray();
        internal static long[] ReadLongArray(this TextReader reader, char separator = ' ') => ReadStringArray(reader, separator).Select(long.Parse).ToArray();
        internal static double[] ReadDoubleArray(this TextReader reader, char separator = ' ') => ReadStringArray(reader, separator).Select(double.Parse).ToArray();
        internal static string[] ReadStringArray(this TextReader reader, char separator = ' ') => reader.ReadLine().Split(separator);
    }
}

#endregion

Measured memory_bytes: 11220
#include <bits/stdc++.h>
#define ll long long int
#include<list>
#include<algorithm>
#define ld long double
#define pb push_back
#define FF first
#define SS second
#define rep(a,b,c) for(a=b;a<c;a++)
#define repr(a,b,c) for(a=b-1;a>=c;a--)
#define PLL pair<ll, ll>
#define inf 100000001
#define mod 1000000007
#define LB lower_bound
#define UB upper_bound
#define MP make_pair
#define PQ priority_queue
#define rep1 for(i=1;i<=n;i++)
#define VLL vector<ll>
#define EF else if
const double pi  =3.141592653589793238463;
#define all(x) (x).begin(), (x).end()
#define SORT(A) sort(A.begin(), A.end());
#define REVERSE(A) reverse(A.begin(), A.end());
#define UMP unordered_map
#define MAX LLONG_MAX
#define MIN LLONG_MIN
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define test1(x)                cerr<<#x<<": "<<x<<endl
#define test2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define test3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define test4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define test5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define test6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
using namespace std;
/*
    //string with spaces
    std::string str;
    std::getline(std::cin >> std::ws, str);
*/
ll myXOR(unsigned long long int x, unsigned long long int y)
{
    return (x|y)&(~x|~y);   
}
ll powerLL(ll x, ll n) 
{ 
    ll result = 1; 
    while (n) { 
        if (n & 1) 
            result = result * x % mod; 
        n = n / 2; 
        x = x * x % mod; 
    }
    return result; 
}
int main()
{
    fastio
    ll a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r, t,u,w,x,y,z;
    string str, ss, str1;
    cin>>str>>str1;
    n = str.length();
    m = str1.length();
    ll res = MAX;
    for(i=0;i<n-m+1;i++){
        ll cnt=  0;
        ll k = 0;
        for(j=i;j<i+m;j++){
            // cout<<str[j]<<" "<<str1[j]<<" ";
            if(str[j]!=str1[k++]) cnt++;
            // cout<<endl;
        }
        res = min(res, cnt);
    }
    cout<<res;
}

Measured memory_bytes: 3660
N, W = map(int,input().split())
v = [0] * N
w = [0] * N
prev_w = [[0 for i in range(W + 1)] for j in range(N + 1)]
dp = [[0 for i in range(W + 1)] for j in range(N + 1)]

for i in range(N):
    w[i], v[i] = map(int,input().split())

for i in range(N):
    for j in range(W + 1):
        if j >= w[i]:
            if dp[i+1][j] < dp[i][j-w[i]] + v[i]:
                dp[i+1][j] = dp[i][j-w[i]] + v[i]
                prev_w[i+1][j] = j - w[i]
        if dp[i+1][j] < dp[i][j]:
            dp[i+1][j] = dp[i][j]
            prev_w[i+1][j] = j

ans=dp[-1][-1]

sel=set()
cur_w = W-1
i=N-1
while i>=0:
    if (prev_w[i+1][cur_w] == cur_w - w[i]) :
        sel.add(i)
    cur_w = prev_w[i+1][cur_w]
    i-=1

tmp=0
for i in range(N):
    if i not in sel:
        tmp=max(v[i],tmp)
print(max(ans,dp[-1][-2]+tmp))


Measured memory_bytes: 193288
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 1000000007;

int a[100000];
int b[100000];

set<int> even;

int main()
{
	int n;
	cin >> n;
	for (int i = 0; i < n; ++i) {
		scanf("%d", &a[i]);
		b[i] = a[i];
	}
	sort(b, b + n);
	for (int i = 0; i < n; i += 2) {
		even.insert(b[i]);
	}
	int cnt = 0;
	for (int i = 0; i < n; i += 2) {
		if (even.find(a[i]) == even.end()) {
			++cnt;
		}
	}
	cout << cnt << endl;
	return 0;
}



Measured memory_bytes: 3328
from collections import deque
k=int(input())
que=deque()
for i in range(1,10):
    que.append(i)

for i in range(k):
    x=que.popleft()
    if list(str(x))[-1]=="0":
        que.append(x*10+int(list(str(x))[-1]))
        que.append(x*10+int(list(str(x))[-1])+1)
    elif list(str(x))[-1]=="9":
        que.append(x*10+(int(list(str(x))[-1])-1))
        que.append(x*10+int(list(str(x))[-1]))
    else:
        que.append(x*10+int(list(str(x))[-1])-1)
        que.append(x*10+int(list(str(x))[-1]))
        que.append(x*10+int(list(str(x))[-1])+1)

print(x)

Measured memory_bytes: 81036
#include "bits/stdc++.h"
#include "math.h"
 
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<int> vin;
typedef pair<ll,ll> P;
typedef vector<P> vp;
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define drep(i,a,b) for(ll i=(a);i>=(b);--i)
#define SIZE(a) int((a).size())
#define out(a) cout<<(a)<<endl;
const int INF=INT_MAX;
const int MAX = 510000;
const ll MOD = 1000000007;
ll fac[MAX], finv[MAX], inv[MAX];


int main(){
  string s;cin>>s;
  vll c(0),d(0),ans(s.size(),0);
  for(int i = 0 ; i < s.size() - 1; ++i) {
        if(s[i] == 'R' && s[i+1] == 'L') {
            int j = i ; 
            while(j>= 0 && s[j] == 'R') {
                if((i-j)%2 ==0)
                    ans[i]++;
                else {
                    ans[i+1]++ ; 
                }
                j--;
            }
 
            j = i + 1; 
            while(j < s.size() && s[j] =='L'){
                if((j-i)%2==0)
                    ans[i]++ ; 
                else 
                    ans[i+1]++;
                    j++;
            }
       }
  }
  rep(i,0,s.size()){
    cout<<ans[i]<<' ';
  }
  cout<<endl;
}








Measured memory_bytes: 4288
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b;
  char op;
  while(cin>>a>>op>>b&&op!='?'){
    if(op=='+') cout<<a+b<<endl;
    else if(op=='-') cout<<a-b<<endl;
    else if(op=='*') cout<<a*b<<endl;
    else cout<<a/b<<endl;
  }
  return 0;
}



Measured memory_bytes: 3096
#include <iostream>
#include <string>

using namespace std;

int main(int argc, char *argv[]) {
  int64_t r, D, x0;
  std::cin >> r >> D >> x0;
  for(int i = 0; i < 10; i++){
    x0 = x0 * r - D;
    cout << x0 << endl;
  }

  return 0;
}


Measured memory_bytes: 256
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using db = double;
using ld = long double;
template<typename T> using V = vector<T>;
template<typename T> using VV = vector<vector<T>>;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(),(v).end()
#define siz(v) (ll)(v).size()
#define rep(i,a,n) for(ll i=a;i<(ll)(n);++i)
#define repr(i,a,n) for(ll i=n-1;(ll)a<=i;--i)
#define ENDL '\n'
typedef pair<int,int> Pi;
typedef pair<ll,ll> PL;
constexpr ll mod = 1000000007;
constexpr ll INF = 1000000099;
constexpr ll LINF = (ll)(1e18 +99);
const vector<ll> dx={-1,1,0,0},dy={0,0,-1,1};
template<typename T,typename U> inline bool chmin(T& t, const U& u){if(t>u){t=u;return 1;}return 0;}
template<typename T,typename U> inline bool chmax(T& t, const U& u){if(t<u){t=u;return 1;}return 0;}
template<typename T> inline T gcd(T a,T b){return b?gcd(b,a%b):a;}

template<typename T,typename Y> inline T mpow(T a, Y n) {
  T res = 1;
  for(;n;n>>=1) {
    if (n & 1) res = res * a;
    a = a * a;
  }
  return res;
}

template<typename T,typename Y>
ostream& operator<<(ostream& os,const pair<T,Y>& p){
   return os<<"{"<<p.fs<<","<<p.sc<<"}";
}
template<typename T> ostream& operator<<(ostream& os,const V<T>& v){
   os<<"{";
  for(auto e:v)os<<e<<",";
  return os<<"}";
}
template<typename ...Args>
void debug(Args&... args){
  for(auto const& x:{args...}){
    cerr<<x<<' ';
  }
  cerr<<ENDL;
}



signed main(){
  cin.tie(0);cerr.tie(0);ios::sync_with_stdio(false);
  cout<<fixed<<setprecision(20);
  string s;cin>>s;
  int n=siz(s);
  ll ans=0,ocnt=0,od0=0;
  set<PL> se;

  rep(i,0,n){
    if(s[i]=='1'){
      ans+=(++ocnt+1)/2;
      se.emplace(i,1);
    }
  }

  ll tmp=(ocnt%2)^1,bac=(ocnt+1)/2,cnt=0;
  rep(i,0,n){
    if(s[i]=='1'){
      cnt++;
      continue;
    }

    if(cnt%2){
      bac+=tmp;
      ans+=bac;
      tmp^=1;
      ++cnt;
      se.emplace(i,0);
    }else{
      ++od0;
    }
  }

  ll now=0;
  cnt=0;
  rep(i,0,n){
    if(s[i]=='0'){
      if((*se.lb({i,-1})).fs!=i){
        cnt++;
      }else{
        now++;
      }
    }else{
      if(now%2==0){
        ans+=(od0-cnt)+(cnt/2);
      }else{
        ans+=(cnt+1)/2;
      }
      ++now;
    }
  }
  cout<<ans<<ENDL;

}
//! ( . _ . ) ! 
//CHECK overflow,vector_size,what to output?

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

#define all(a) (a).begin(), (a).end()
#define sz(a) (int)(a).size()
#define pb push_back

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef long double ld;

const int inf = 1e9;

vector<int> lf, rg;
vector<char> any;

int n;
vector<vector<int> > g;
vector<int> val;

bool lay(int v, int x)
{
	if ((x - lf[v]) % 2) {
		return false;
	}
	return x >= lf[v] && x <= rg[v];
}

void dfs(int v, int p)
{
	if (sz(g[v]) == 1 && g[v][0] == p) {
		if (val[v] == -1) {
			any[v] = true;
		} else {
			any[v] = false;
			lf[v] = rg[v] = val[v];
		}
		return;
	}
	vector<int> sons;
	for (int to : g[v]) {
		if (to != p) {
			dfs(to, v);
			if (!any[to]) {
				sons.pb(to);
			}
		}
	}
	if (sons.empty()) {
		if (val[v] == -1) {
			any[v] = true;
		} else {
			any[v] = false;
			lf[v] = rg[v] = val[v];
		}
		return;
	}
	any[v] = false;
	lf[v] = inf;
	rg[v] = -inf;
	for (int son : sons) {
		if (lf[son] == inf) {
			return;
		}
	}
	for (int i = 1; i < sz(sons); ++i) {
		if ((lf[sons[i]] - lf[sons[0]]) % 2) {
			return;
		}
	}
	if (val[v] != -1 && (val[v] - lf[sons[0]]) % 2 == 0) {
		return;
	}
	lf[v] = lf[sons[0]] - 1;
	rg[v] = rg[sons[0]] + 1;
	for (int i = 1; i < sz(sons); ++i) {
		lf[v] = max(lf[v], lf[sons[i]] - 1);
		rg[v] = min(rg[v], rg[sons[i]] + 1);
	}
	if (val[v] != -1) {
		lf[v] = max(lf[v], val[v]);
		rg[v] = min(rg[v], val[v]);
	}
	if (lf[v] > rg[v]) {
		lf[v] = inf;
		rg[v] = -inf;
	}
}

vector<int> ans;

void dfs_solve(int v, int p, int x)
{
	ans[v] = x;
	for (int to : g[v]) {
		if (to != p) {
			if (lay(to, x - 1)) {
				dfs_solve(to, v, x - 1);
			} else {
				dfs_solve(to, v, x + 1);
			}
		}
	}
}

int main()
{

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

	cin >> n;
	g.resize(n);
	val.assign(n, -1);

	for (int i = 0; i < n - 1; ++i) {
		int u, v;
		cin >> u >> v;
		--u, --v;
		g[u].pb(v);
		g[v].pb(u);
	}

	int q;
	cin >> q;

	lf.resize(n);
	rg.resize(n);
	any.resize(n);

	while (q--) {
		int v;
		cin >> v;
		--v;
		cin >> val[v];
	}

	dfs(0, -1);

	if (lf[0] == inf) {
		cout << "No\n";
		return 0;
	}

	cout << "Yes\n";
	ans.resize(n);

	dfs_solve(0, -1, lf[0]);
	for (int i = 0; i < n; ++i) {
		cout << ans[i] << "\n";
	}

}


Measured memory_bytes: 17536
#include <bits/stdc++.h>
using lint = long long;
using namespace std;
const int MAXN = 2005;

int n, k;
char str[MAXN][MAXN];
bitset<MAXN> L[MAXN], R[MAXN], out[MAXN];

int main(){
	scanf("%d",&n);
	for(int i=1; i<n; i++){
		scanf("%s", str[i + 1] + 1);
	}
	R[1].set(0);
	L[0].set(1);
	for(int i=1; i<=n; i++){
		L[i].set(i+1);
		R[i+1].set(i);
		str[i][i] = '0';
		for(int j=1; j<i; j++){
			str[j][i] = str[i][j] ^ 1;
		}
	}
	for(int i=1; i<=n; i++){
		for(int j=1; j<=n; j++){
			if(str[i][j] == '1') out[i].set(j);
		}
	}
	for(int i=0; i<=n; i++){
		for(int j=1; j+i<=n; j++){
			int s = j, e = j + i;
			auto mas = (R[s] << 1) & (L[e] >> 1);
			if((mas & out[s - 1]).any()) L[e].set(s);
			if((mas & out[e + 1]).any()) R[s].set(e);
		}
	}
	int ret = 0;
	for(int i=1; i<=n; i++){
		bool ok = true;
		if(!R[1][i - 1]) ok = false;
		if(!L[n][i + 1]) ok = false;
		if(ok) ret++;
	}
	cout << ret << endl;
}


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

int main(){  
  unsigned long long int n,a,b;
  cin >> n >> a >> b;
  
  unsigned long long int count = 0;
  unsigned long long int hikerukaisu = n / (a + b);
  unsigned long long int nokori = min(a,n % (a + b));
  
  cout << hikerukaisu * a + nokori << endl; 
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, a, b) for (int i = a; i < (int)(b); i++)
#define all(v) v.begin(), v.end()
const int MOD = 1e9 + 7;
const int INF = 1e9;
//'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122

int main() {
    ll n, m, k;
    cin >> n >> m >> k;
    vector<ll> a(n), b(m);
    rep(i, 0, n) cin >> a[i];
    rep(i, 0, m) cin >> b[i];
    vector<ll> suma(n + 1, 0), sumb(m + 1, 0);
    rep(i, 0, n) suma[i + 1] = suma[i] + a[i];
    rep(i, 0, m) sumb[i + 1] = sumb[i] + b[i];
    ll ans = 0;
    rep(i, 0, n + 1) {
        ll tmp = k - suma[i];
        if (tmp < 0) continue;
        ll ok = 0;
        ll ng = m + 1;
        while (ng - ok > 1) {
            ll m = (ok + ng) / 2;
            if (sumb[m] <= tmp) ok = m;
            else ng = m;
        }
        ans = max(ans, i + ok);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 9508
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define ld long double
#define mod 1000000007
#define N 1001

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	int a , b;
	cin >> a >> b;
	if(a >= 13)
		cout << b;
	else if( a >= 6 && a <= 12)
		cout << b/2;
	else
		cout << 0;
	return 0;	
}

Measured memory_bytes: 256
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

// C++
#include <algorithm>
#include <bitset>
#include <chrono>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <unordered_map>
#include <unordered_set>

using namespace std;

#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)

//#define _DEBUG_ 3

void run() {
	int N, K;
	cin >> N >> K;
	vector<int> a(N);
	for (int i = 0; i < N; i++) {
		cin >> a[i];
	}
	std::sort(begin(a), end(a));
	
	int left = 0;
	int right = N;
	while (left < right) {
		int mid = (left + right) / 2;
		bool check = false;

		vector<bool> dp(K, false);
		dp[0] = true;
		REP(i, N) {
			if (i == mid) continue;
			for (int j = K - 1; j >= 0; j--) {
				if (dp[j] && (j + a[i]) < K)
					dp[j + a[i]] = true;
			}
		}

		FOR(j, max(0, K - a[mid]), K) {
			if (dp[j]) {
				check = true;
				break;
			}
		}

		if (check) right = mid;
		else left = mid + 1;
	}

	cout << right << endl;

}

int main() {
#ifdef _DEBUG_
	using std::chrono::system_clock;
	using std::chrono::duration_cast;
	system_clock::time_point  start, end;
	std::ifstream in("input.txt");
	cin.rdbuf(in.rdbuf());
	for (int i = 0; i < _DEBUG_; i++) {
		cout << "-------------------------- (cnt:" << i << ")" << endl;
		start = system_clock::now();
		run();
		end = system_clock::now();
		int elapsed = duration_cast<std::chrono::milliseconds>(end - start).count();
		cout << "-------------------------- (time:" << elapsed << "ms)" << endl << endl;
	}
#else
	run();
#endif
	return 0;
}


Measured memory_bytes: 256
from math import trunc
import sys
import copy
from collections import deque
import collections
import itertools
stdin = sys.stdin
import math

mod = 10**9+7

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

n = ni()

s = [0 for _ in range(2001)]
s[0] = 1
s[3] = 1
s[4] = 1
s[5] = 1

if n < 6:
    print(s[n])
    exit(0)

for i in range(6, 2001):
    s[i] = s[i-3] + s[i-1]
    s[i] %= mod
    if i==n:
        break

print(s[n])


Measured memory_bytes: 70764
import java.awt.Point;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.IntStream;
import java.util.stream.Stream;

public class Main {
	public static void main(String[] args) throws IOException {
		try (AtCoderReader ar = new AtCoderReader()) {
			ar.nextLine();
			int[] A = ar.nextIntArray();

			List<Point> list = new ArrayList<>();

			int max = Integer.MIN_VALUE;
			int min = Integer.MAX_VALUE;

			int maxAt = -1;
			int minAt = -1;

			for (int i = 0; i < A.length; i++) {
				int value = A[i];
				if (max < value) {
					max = value;
					maxAt = i;
				}

				if (value < min) {
					min = value;
					minAt = i;
				}

			}

			if (min >= 0 || max <= 0) {
				// aが非負整数の場合または、すべて負の整数の場合は何もしない
			} else {
				int value = min;
				int valueAt = minAt;
				if (Math.abs(max) >= Math.abs(min)) {
					value = max;
					valueAt = maxAt;
				}

				for (int i = 0; i < A.length; i++) {
					if (i != valueAt) {
						A[i] += value;
						list.add(new Point(valueAt, i));
					}
				}
				A[valueAt] += value;
				list.add(new Point(valueAt, valueAt));

				min = Integer.MAX_VALUE;
				for (int i = 0; i < A.length; i++) {
					min = Math.min(A[i], min);
				}
			}

			if (min >= 0) {
				for (int i = 1; i < A.length; i++) {
					while (A[i - 1] > A[i]) {
						A[i] += A[i - 1];
						list.add(new Point(i - 1, i));
					}
				}
			} else {
				for (int i = A.length - 2; i >= 0; i--) {
					while (A[i] > A[i + 1]) {
						A[i] += A[i + 1];
						list.add(new Point(i + 1, i));
					}
				}
			}

			System.out.println(list.size());
			list.forEach(p -> {
				System.out.println((p.x + 1) + " " + (p.y + 1));
			});
		}
	}

	public static class AtCoderReader implements AutoCloseable {
		private final BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		public final String[] nextStringArray() throws IOException {
			return this.br.readLine().split(" ");
		}

		public final Stream<String> nextStream() throws IOException {
			return Stream.of(this.nextStringArray());
		}

		public final IntStream nextIntStream() throws NumberFormatException, IOException {
			return this.nextStream().mapToInt(Integer::parseInt);
		}

		public final int[] nextIntArray() throws IOException {
			return this.nextIntStream().toArray();
		}

		public final int nextInt() throws NumberFormatException, IOException {
			return Integer.parseInt(nextLine());
		}

		public final String nextLine() throws IOException {
			return this.br.readLine();
		}

		@Override
		public final void close() throws IOException {
			br.close();
		}
	}
}


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

using namespace std;

int main()
{
  string S;
  cin >> S;
  if (S == "Sunny") cout << "Cloudy" << endl;
  else if (S == "Cloudy") cout << "Rainy" << endl;
  else cout << "Sunny" << endl;
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
 
int  n,u,A[100][100],B[100],C[100];
 
int main(){
  int i,j,mincost,sum = 0;
  scanf("%d",&n);
  
  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      scanf("%d",&A[i][j]);
      if(A[i][j] == -1)A[i][j] = 2001;
    }
  }
  
  for(i=0;i<n;i++){
    C[i] = 2001;
    B[i] =0;
  }
  C[0]=0;
 
  while (1){
    mincost = 2001;    
for(i=0;i<n;i++){
      if (B[i] != 1 && C[i] < mincost){
    mincost = C[i];
    u = i;
      }
    }
 if (mincost == 2001){
   break;
 }
    B[u] = 1;
    for (i=0;i<n;i++){
      if (B[i] != 1 && A[u][i] < C[i]){
    C[i] = A[u][i];
      }
    }
  }
  for (i=0;i<n;i++){
    sum+=C[i];
  }
  printf("%d\n",sum);
  return 0;
}

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

int main(void) {
  string s;
  cin >> s;
  if (s[s.size() - 1] == 's') {
    cout << s << "es" << endl;
  } else {
    cout << s << "s" << endl;
  }

  return 0;
}

Measured memory_bytes: 3628
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

int main(void){

  int n, m;
  int i, j;

  scanf("%d %d", &n, &m);

  int a[n][m], b[m];
  int c[n];

  for(i = 0; i < n; i++){
    for(j = 0; j < m; j++){
      scanf("%d", &a[i][j]);
    }
  }
  for(i = 0; i < m; i++){
    scanf("%d", &b[i]);
  }

  for(i = 0; i < n; i++){
    c[i] = 0;
    for(j = 0; j < m; j++){
      c[i] += a[i][j] * b[j];
    }
  }

  for(i = 0; i < n; i++){
    printf("%d\n", c[i]);
  }
  
  return 0;
}


Measured memory_bytes: 2140
import math
def prime(x):
    for i in range(2, int(math.sqrt(x))+1):
        if x%i == 0:
            return 0
    return 1

while True:
    n = int(input())
    
    if n==0:
        break
    
    n2 = 2*n
    
    num = list(range(n+1,n2+1))
    count = 0
    for i in range(len(num)):
        x = num[i]
        if prime(x):
            count += 1
    print(count)


Measured memory_bytes: 13408
#pragma GCC optimize("O2,Ofast,inline,unroll-all-loops,-ffast-math")
#include <bits/stdc++.h>
#define pb(X) push_back(X)
using namespace std;

int n, a, b, c, d, q, ans;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n;
	map<int, bool> a;
	cin >> n;
	for (int i = 0 ; i < n; ++i) {
		int t;
		cin >> t;
		if(a.count(t)) return 0 * puts("NO");
		a[t] = true;
	}
	puts("YES");
	return 0;
}

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


using namespace std;


int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n; cin >> n;
    vector<int> dp(3);
    for (int day = 0; day < n; ++day){
        vector<int> new_dp(3);
        vector<int> activities(3);
        for (int& x: activities){
            cin >> x;
        }
        for (int i = 0; i < 3; ++i){
            for(int j = 0; j < 3; ++j){
                if (i != j){
                    new_dp[j] = max(new_dp[j], dp[i] + activities[j]);
                }
            }
        }
        dp = new_dp;
    }
    cout << max({dp[0], dp[1], dp[2]}) << "\n";
}


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

template<class T>
struct Edge{
	int from,to;
	T cost;
	Edge(int to,T cost) : to(to),cost(cost){}
	Edge(int from,int to,T cost) : from(from),to(to),cost(cost){}
};

template<class T>
using WeightedGraph = vector<vector<Edge<T>>>;
using Graph = vector<vector<int>>;
template<class T>
using Matrix = vector<vector<T>>;

template<class T = int>
vector<T> BFS(const Graph &G,int source = 0){
	vector<T> dist(G.size(),-1);
	queue<int> que;
	dist[source] = 0;
	que.push(source);
	for(T d = 0;;d++){
		int siz = que.size();
		if(siz == 0) break;
		for(int i = 0;i < siz;i++){
			int v = que.front();que.pop();
			for(int to : G[v]){
				if(dist[to] == -1){
					dist[to] = d + 1;
					que.push(to);
				}
			}
		}
	}
	return dist;
}

signed main(){
	int n;
	cin >> n;
	Graph G(n);
	for(int i = 0;i < n;i++){
		int u,k;
		cin >> u >> k;
		for(int j = 0;j < k;j++){
			int v;
			cin >> v;
			G[u - 1].push_back(v - 1);
		}
	}
	auto dist = BFS(G,0);
	for(int i = 0;i < n;i++) cout << i + 1 << " " << dist[i] << endl;
}


Measured memory_bytes: 3164
def resolve():
	n, m = map(int, input().split())
	bs = [[i] for i in list(map(int, input().split()))]
	for i in range(m):
		a, b = map(int, input().split())
		bs[a-1].append(bs[b-1][0])
		bs[b-1].append(bs[a-1][0])
	ans = 0
	for v in bs:
		if len(v) == 1 or v[0] > max(v[1:]):
			ans += 1
	print(ans)
resolve()

Measured memory_bytes: 95856
#include <iostream>
#include <vector>

using namespace std;

int main(){
  int n, m;
  vector<int> a;
  vector<int> b;

  cin >> n >> m;
  for(int i=0; i<m; i++){
    int a_temp;
    int b_temp;
    cin >> a_temp >> b_temp;
    a.push_back(a_temp);
    b.push_back(b_temp);
  }

  vector<int> city(n);
  for(int i=0; i<m; i++){
    city[a.at(i)-1] += 1;
    city[b.at(i)-1] += 1;
  }

  for(int i=0; i<n; i++){
    cout << city.at(i) << endl;
  }

  return 0;
}


Measured memory_bytes: 256
import math, cmath

def print_cross_points(c1, r1, c2, r2):
    c1c2 = c2 - c1
    d = abs(c1c2)
    a = math.acos((r1 ** 2 + d ** 2 - r2 ** 2) / (2 * r1 * d))
    t = cmath.phase(c1c2)
    cp1 = c1 + cmath.rect(r1, t + a)
    cp2 = c1 + cmath.rect(r1, t - a)
    print("{0:.8f} {1:.8f} {2:.8f} {3:.8f}".format(cp1.real, cp1.imag,
                                                       cp2.real, cp2.imag))

c1x, c1y, c1r = map(int, input().split())
c2x, c2y, c2r = map(int, input().split())

if c1y < c2y:
    print_cross_points(c1x + c1y * 1j, c1r, c2x + c2y * 1j, c2r)
elif c1y > c2y or c1x < c2x:
    print_cross_points(c2x + c2y * 1j, c2r, c1x + c1y * 1j, c1r)
else:
    print_cross_points(c1x + c1y * 1j, c1r, c2x + c2y * 1j, c2r)

Measured memory_bytes: 8020
#include<bits/stdc++.h>
using namespace std;
 
int main()
{
  int n, k;
  cin>>n>>k;
  int arr[n];
  for(int i=0; i<n; i++)
  {
    cin>>arr[i];
  }
  sort(arr, arr+n);
  int sum=0;
  for(int i=0; i<k; i++)
  {
    sum+=arr[i];
  }
  cout<<sum<<endl;
}

Measured memory_bytes: 3640
#include <stdio.h>
int main(){
  int S=6000, A=4000, B=3000, C=2000, a, b, c, d, e, f, g, h;
  scanf("%d%d",&e, &a);
  scanf("%d%d",&f, &b);
  scanf("%d%d",&g, &c);
  scanf("%d%d",&h, &d);
  switch(e){
 case 1:
   printf("%d\n",S * a);
   break;
 case 2:
   printf("%d\n",A * a);
   break;
 case 3:
   printf("%d\n",B * a);
   break;
  default:
   printf("%d\n",C * a);
  }
  switch(f){
 case 1:
   printf("%d\n",S * b);
   break;
 case 2:
   printf("%d\n",A * b);
   break;
 case 3:
   printf("%d\n",B * b);
   break;
  default:
   printf("%d\n",C * b);
  }
  switch(g){
 case 1:
   printf("%d\n",S * c);
   break;
 case 2:
   printf("%d\n",A * c);
   break;
 case 3:
   printf("%d\n",B * c);
   break;
 default:
   printf("%d\n",C * c);
  }
  switch(h){
   case 1:
   printf("%d\n",S * d);
   break;
 case 2:
   printf("%d\n",A * d);
   break;
 case 3:
   printf("%d\n",B * d);
   break;
 default:
   printf("%d\n",C * d);
  }  
  return 0;
}

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

int main (void) {
  long long a,b,c;
  cin >> a >> b >> c;
  
  if (c-a-b < 0) { cout << "No" << endl; return 0;}
  
  if (4*a*b < (c-a-b) * (c-a-b)) cout << "Yes" << endl;
  else cout << "No" << endl;
  
  return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#include <vector>
#include <iostream>
#include<algorithm>
#include<string>
#include <map>
#include <queue>
#include <stack>
#include<set>
#include<math.h>

#define DIV 1000000007
using namespace std;
using ll = long long;

int main(void) {
	int N, M, P;
	cin >> N >> M >> P;

	vector<pair<pair<int, int>,ll>> edge(M);
	for (int i = 0; i < M; i++) {
		cin >> edge[i].first.first >> edge[i].first.second >> edge[i].second;
		edge[i].second -= P;
		edge[i].second *= -1;
		//cout << edge[i].second << endl;
	}

	vector<ll> dis(N + 1,1e15);
	dis[1] = 0;
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < M; j++) {
			int from = edge[j].first.first;
			int to = edge[j].first.second;
			ll cost = edge[j].second;
			if (dis[from] == 1e15) continue;
			dis[to] = min(dis[to], dis[from] + cost);
		}
	}
	/*
	for (int i = 1; i <= N; i++) {
		printf("dis[%d]=", i);
		cout << dis[i] << endl;
	}
	*/
	ll ans = dis[N];
	vector<bool> nega(N + 1);
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < M; j++) {
			int from = edge[j].first.first;
			int to = edge[j].first.second;
			ll cost = edge[j].second;
			if (dis[from] == 1e15) continue;
			if (nega[from]) nega[to] = true;
			if (dis[to] > dis[from] + cost) {
				dis[to] = dis[from] + cost;
				nega[to] = true;
			}
		}
	}
	/*
	for (int i = 1; i <= N; i++) {
		printf("dis[%d]=", i);
		cout << -dis[i] << endl;
	}
	*/
	if (nega[N])
		cout << -1 << endl;
	else
		cout << max((ll)0,-ans) << endl;
}


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

int main() {
//    freopen("in.txt", "r", stdin);

    int N, W, vi, wi, m = -1;
    int f[10002] = {0};
    cin >> N >> W;

    for (int i = 1; i <= N; ++i) {
        cin >> vi >> wi;
        for (int j = W; j >= 0; --j) {
            if (j >= wi) {f[j] = max(f[j], f[j - wi] + vi);}
            if (m < f[j]) {m = f[j];}
        }
    }

    cout << m << endl;
}

Measured memory_bytes: 3148
#include<iostream>
#include<string>
#include<algorithm>

using namespace std;;
int main (){
    string o,e;
    cin >> o >> e;
    for (int i = 0; i < e.size(); i++){
        cout << o[i] << e[i];
    }
    if(e.size()!=o.size()) cout << o[o.size()-1];
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-9;
const ll mod=1e9+7;
const int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

string s;

int main(){
	cin>>s;
	string t="";
	while(t.size()<s.size()) t+="hi";
	cout<<(s==t?"Yes":"No")<<endl;
}

Measured memory_bytes: 256
import itertools
from math import factorial
from collections import Counter
 
ans = 0
N, L = map(int, input().split())
x = list(map(int, input().split()))
y = itertools.accumulate(x)
y = [e % L for e in y]
#print(y)
#print(y)
so = set(y)
#print(so)
#print(so)
counter = Counter([0]+y)
#print(counter.values())
#print
for i in counter.values():
    #print(ans)
    ans+=i * (i - 1) // 2
print(ans)


Measured memory_bytes: 19368
#include <iostream>
#include <algorithm>
using namespace std;
int main(){
	int m,n,d,xmax,xmin,ymax,ymin;
	while(cin>>m){
		if(m==0) break;
		int x[200],y[200];
		for(int i=0;i<200;i++){
			x[i]=0;
			y[i]=0;
		}
		xmax=0;
		xmin=0;
		ymax=0;
		ymin=0;
		for(int i=1;i<m;i++){
			cin>>n>>d;
			if(d==0){
				x[i]=x[n]-1;
				y[i]=y[n];
			}
			else if(d==1){
				x[i]=x[n];
				y[i]=y[n]-1;
			}
			else if(d==2){
				x[i]=x[n]+1;
				y[i]=y[n];
			}
			else if(d==3){
				x[i]=x[n];
				y[i]=y[n]+1;
			}
			xmax=max(xmax,x[i]);
			xmin=min(xmin,x[i]);
			ymax=max(ymax,y[i]);
			ymin=min(ymin,y[i]);
		}
		cout<<xmax-xmin+1<<" "<<ymax-ymin+1<<endl;
	}
    return 0;
}

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

int N,M;
vector<int> radjlist[100000];
int d[100000];

int rec(int v) {
  if(d[v]!=-1) return d[v];
  int dv = 0;
  for(auto from : radjlist[v]) dv = max(dv, rec(from)+1);
  return d[v] = dv;
}

signed main() {
  cin >> N >> M;
  for(int i=0; i<M; i++) {
    int x,y;
    cin >> x >> y;
    radjlist[y-1].push_back(x-1);
  }
  fill(d, d+N, -1);
  int ans = 0;
  for(int i=0; i<N; i++) ans = max(ans, rec(i));
  cout << ans << endl;
}


Measured memory_bytes: 11008
s = input()
t = input()

ls = len(s)
lt = len(t)

dp = [[0]*(lt+1) for i in range(ls+1)]

for i in range(1,ls+1):
    for j in range(1,lt+1):
        if s[i-1] == t[j-1]:
            dp[i][j] = dp[i-1][j-1] + 1
        else:
            dp[i][j] = max(dp[i][j-1], dp[i-1][j])

max_len = dp[-1][-1]
#print(max_len)

prev = max_len

ans = ""

i = ls
j = lt

for l in range(max_len):
    while dp[i-1][j] == max_len - l:
        i -= 1
    while dp[i][j-1] == max_len - l:
        j -= 1
    ans += s[i-1]
    i -= 1
    j -= 1
print(ans[::-1])


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

using namespace std;
#ifdef _DEBUG
#define _GLIBCXX_DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

//#define int long long
#define ll long long
#define ll1 1ll
#define ONE 1ll
#define DBG 1
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define rrep(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define loop(n) rep(loop, (0), (n))
#define all(c) begin(c), end(c)
const int INF =
sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
const double PI = acos(-1);
const double EPS = 1e-9;
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
using pii = pair<int, int>;
// template<class T> ostream &operator<<(ostream &os,T &t){dump(t);return os;}
template <typename T, typename S>
istream &operator>>(istream &is, pair<T, S> &p) {
  is >> p.first >> p.second;
  return is;
}
template <typename T, typename S>
ostream &operator<<(ostream &os, pair<T, S> &p) {
  os << p.first << " " << p.second;
  return os;
}

template <typename T> void printvv(const vector<vector<T>> &v) {
  cerr << endl;
  rep(i, 0, v.size()) rep(j, 0, v[i].size()) {
    if (typeid(v[i][j]).name() == typeid(INF).name() and v[i][j] == INF) {
      cerr << "INF";
    } else
      cerr << v[i][j];
    cerr << (j == v[i].size() - 1 ? '\n' : ' ');
  }
  cerr << endl;
}
/*
   typedef __int128_t Int;
   std::ostream &operator<<(std::ostream &dest, __int128_t value) {
   std::ostream::sentry s(dest);
   if (s) {
   __uint128_t tmp = value < 0 ? -value : value;
   char buffer[128];
   char *d = std::end(buffer);
   do {
   --d;
 *d = "0123456789"[tmp % 10];
 tmp /= 10;
 } while (tmp != 0);
 if (value < 0) {
 --d;
 *d = '-';
 }
 int len = std::end(buffer) - d;
 if (dest.rdbuf()->sputn(d, len) != len) {
 dest.setstate(std::ios_base::badbit);
 }
 }
 return dest;
 }

 __int128 parse(string &s) {
 __int128 ret = 0;
 for (int i = 0; i < s.length(); i++)
 if ('0' <= s[i] && s[i] <= '9')
 ret = 10 * ret + s[i] - '0';
 return ret;
 }
 */

#ifndef _DEBUG
#define printvv(...)
#endif
void YES(bool f) { cout << (f ? "YES" : "NO") << endl; }
void Yes(bool f) { cout << (f ? "Yes" : "No") << endl; }
template <class T> bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T> bool chmin(T &a, const T &b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}

signed main(signed argc, char *argv[]) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(12);

  int a, b; cin >> a >> b;
  cout<<max({a+b,a-b,a*b})<<endl;

    return 0;
}


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

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

	cout << n*(n-1)/2 + m*(m-1)/2 << endl;

	return 0;
}

Measured memory_bytes: 256
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time, copy

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

x = ns()
ct = 0
ans = 0
for c in x:
    if c == 'S':
        ct += 1
    else:
        if ct > 0:
            ct -= 1
            ans += 2
print(len(x)-ans)


Measured memory_bytes: 11148
#include<stdio.h>
#include<stdlib.h>
#include<stdint.h>
#include<inttypes.h>

typedef int32_t i32;

#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define ALLOC(size,type) ((type*)calloc((size),sizeof(type)))

void run (void) {
  i32 h, w;
  scanf ("%" SCNi32 "%" SCNi32, &h, &w);
  char *s = ALLOC (h * w + 1, char);
  for (i32 i = 0; i < h; ++i) {
    scanf ("%s", s + i * w);
  }
  i32 a = h + w;
  i32 b = 0;
  i32 c = h + w;
  i32 d = -(h + w);
  for (i32 i = 0; i < h * w; ++i) {
    if (s[i] != 'B') continue;
    i32 x = i / w;
    i32 y = i % w;
    a = MIN (a, x + y);
    b = MAX (b, x + y);
    c = MIN (c, x - y);
    d = MAX (d, x - y);
  }
  i32 ans = MAX (b - a, d - c);
  printf ("%" PRIi32 "\n", ans);
}

int main (void) {
  run();
  return 0;
}



Measured memory_bytes: 2568
#include <vector>
#include <algorithm>
#include <string>
#include <iostream>
#include <map>
#include <math.h>
#include <numeric>
#include <list>
#include <queue>
#include <string>
#include <vector>
#include <set>
#include <sstream>
#include <cstdio>
#include <cstring>
using namespace std;
typedef long long ll;
int main()
{
      vector<string> v;
      ll n,l;
       ll i;
      cin>>n>>l;
      for(i=0;i<n;i++)
      {
      	string s;
      	cin>>s;
        v.push_back(s);
      }
      sort(v.begin(),v.end());
      for(i=0;i<n;i++)
      cout<<v[i];
	   return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <vector>

using namespace std;

vector<pair<long long, int>> factor(long long n) {
    vector<pair<long long, int>> v;
    for (long long i = 2; i * i < n; i++) {
        int cnt = 0;
        while (n % i == 0) {
            n /= i;
            cnt++;
        }
        if (cnt != 0) {
            v.emplace_back(i, cnt);
        }
    }
    if (n != 1) {
        v.emplace_back(n, 1);
    }
    return v;
}

int main() {
    long long n;
    cin >> n;

    vector<pair<long long, int>> v = factor(n);

    int ans = 0;
    for (auto p : v) {
        int a = p.second;
        int i = 1;
        while (i <= a) {
            a -= i;
            i++;
            ans++;
        }
    }

    cout << ans << endl;
}


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

int main(void)
{
    string s, t;
    cin >> s >> t;

    sort(s.begin(), s.end());
    sort(t.begin(), t.end());
    reverse(t.begin(), t.end());

    if(s < t) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}


Measured memory_bytes: 3640
($_,$a,$b,$c,$d)=split/ /,<>;
$s=<>;
#a~(max(c,d)-2)
if(substr($s,$a,(($c<$d?$d:$c)-2)-($a-1))=~/##/){
    $r='No';
#b-2~d
}elsif($c<$d||substr($s,$b-2,$d-($b-3))=~/\.{3}/){
    $r='Yes';
}else{
    $r='No';
}
print "$r\n";


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

int main(int argc, const char * argv[]) {

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

    int cnt;
    int k;
    int r;
    int s;
    int p;
    string t;

    cin >> cnt >> k >> r >> s >> p >> t;

    int result = 0;
    string pattern = "";
    for (int i=0; i<cnt; i++) {
        int score = 0;
        char hand;
        if (t.at(i) == 'r') {
            score = p;
            hand = 'p';
        } else if (t.at(i) == 's') {
            score = r;
            hand = 'r';
        } else if (t.at(i) == 'p') {
            score = s;
            hand = 's';
        }

        if (i < k) {
            result += score;
            pattern += hand;
            continue;
        }

        char lastHand = pattern.at(i - k);
        if (t.at(i - k) == t.at(i) && lastHand == hand) {
            score = 0;
            hand = 'q';
        }
        result += score;
        pattern += hand;
    }


    cout << result;

    return 0;
}


Measured memory_bytes: 888