akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>

using namespace std;

  vector<string> phrases = {"dream", "dreamer", "erase", "eraser"};

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


  string tmp_phrase = "";

  bool constractable = true;
  for(int i = target_str.size() - 1; i >= 0; i--) {
    tmp_phrase = target_str[i] + tmp_phrase;

    bool is_match = false;
    for(int j = 0; j < phrases.size(); j++) {
      if(phrases[j].size() < tmp_phrase.size()) {
        continue;
      }

      if(phrases[j].substr(phrases[j].size() - tmp_phrase.size(), tmp_phrase.size()) == tmp_phrase) {
        is_match = true;
      }

      // clear tmp phrase
      if(tmp_phrase == phrases[j]) {
        tmp_phrase = "";
        break;
      }
    }

    if(!is_match) {
      constractable = false;
      break;
    }
  }

  if(constractable) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }

}

Measured memory_bytes: 3780
#include <bits/stdc++.h>
using namespace std;
int main()
{
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
    string x ;
    cin >> x ;
    if(x[x.length()-1] == 's')
        x+="es";
    else
        x+="s";
    cout << x << endl;
    return 0;
}


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

int main(){
  int n,s,sum,ma,mi;

  while(cin >> n, n){
    cin >> sum;
    ma = mi = sum;
    for(int i=1;i<n;i++){
      cin >> s;
      sum += s;
      ma = max(ma,s);
      mi = min(mi,s);
    }

    cout << (sum-ma-mi)/(n-2) << endl;
  }
}

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

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int x, y, A, B, C;
  cin >> x >> y >> A >> B >> C;
  vector<int> a(A), b(B), c(C);
  for (int i = 0; i < A; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < B; i++) {
    cin >> b[i];
  }
  for (int i = 0; i < C; i++) {
    cin >> c[i];
  }
  sort(a.rbegin(), a.rend());
  sort(b.rbegin(), b.rend());
  sort(c.rbegin(), c.rend());
  long long sumr = 0;
  long long sumg = 0;
  int posx = x - 1;
  int posy = y - 1;
  int posz = 0;
  for (int i = 0; i < x; i++) {
    sumr += a[i];
  }
  for (int i = 0; i < y; i++) {
    sumg += b[i];
  }
  long long ans = sumr + sumg;
  while (posx >= 0 && posy >= 0 && posz < C) {
    if (c[posz] <= a[posx] && c[posz] <= b[posy]) break;
    if (a[posx] <= b[posy]) {
      ans = ans - a[posx] + c[posz];
      posx--;
    } else {
      ans = ans - b[posy] + c[posz];
      posy--;
    }
    posz++;
  }
  while (posx >= 0 && posz < C && c[posz] > a[posx]) {
    ans = ans - a[posx] + c[posz];
    posx--;
    posz++;
  }
  while (posy >= 0 && posz < C && c[posz] > b[posy]) {
    ans = ans - b[posy] + c[posz];
    posy--;
    posz++;
  }
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 1408
#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define rep(i,a,b) for(ll i=a;i<b;++i)
#define rrep(i,a,b) for(ll i=a;i>b;--i)
#define vl vector <long>
#define vll vector < ll >
#define pll pair < ll , ll >
#define pb push_back
#define mp make_pair
#define endl "\n"
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);
#define MODCONST 1000000007
#define pinf 1e+18L+7
#define ninf 1e-18L+7

using namespace std;

void solve()
{
    ll n,w,k,sumv=0;
    cin>>n>>w;
    vll weights,values;
    rep(i,0,n){
        cin>>k; weights.pb(k);
        cin>>k; values.pb(k);
        sumv += k;
    }
    ll dp[n+1][sumv+1],ans=0;
    // init dp
    dp[0][0] = 0;
    rep(i,1,sumv+1){
        dp[0][i] = pinf;
        //cout<<dp[0][i];
    }
    // knapsack form dp
    rep(i,1,n+1){
        rep(j,0,sumv+1){
            if(values[i-1]<=j){
                dp[i][j] = min(dp[i-1][j],weights[i-1] + dp[i-1][j-values[i-1]]);
            }
            else{
                dp[i][j] = dp[i-1][j];
            }
            if(w>=dp[i][j]){
                ans = max(ans,j);
            }
        }
    }
    cout<<ans<<endl;
}

int main()
{
    fastio ;
    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);
    ll tc=1;
    //cin>>tc; //for number of testcases
    //ll ts = tc;
    while(tc--){
        //cout<<"Case #"<<ts-tc<<": ";
        solve();
    }
    return 0;
}


Measured memory_bytes: 79232
h,w,k = map(int,input().split())
s = [list(input()) for i in range(h)]

a = [[0]*w for i in range(h)]

now = 0
for i in range(h):
    judge = False
    for j in range(w):
        if s[i][j] == '#':
            now += 1
            judge = True
        if judge:
            a[i][j] = now
    if judge:
        for j in range(w-1,-1,-1):
            if a[i][j] == 0:
                a[i][j] = a[i][j+1]

for i in range(h-2,-1,-1):
    for j in range(w):
        if a[i][j] == 0:
            a[i][j] = a[i+1][j]

for i in range(1,h):
    for j in range(w):
        if a[i][j] == 0:
            a[i][j] = a[i-1][j]

for i in range(h):
    for j in range(w):
        if j == w-1:
            print(a[i][j])
        else:
            print(a[i][j],end=' ')

Measured memory_bytes: 55896
#include <bits/stdc++.h>
using namespace std;
#define eb emplace_back
#define mod (1000000007)
 
long int vis[100002] = {0};
   vector<long int> g[100002];


void dfs(int u,long int x,long int &value)
{
  // vis[u] = 1;

    value = max(value,x);
   for(auto v : g[u])
   {
      if(vis[v] == 0){
        x++;
       dfs(v,x,value);
      }
        x = 0;
   }
}
int main() {
 
  long long int t = 1;
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
 
 //cin >> t;
  while(t--){
 
   long int n,m,x = 0,y = 0,start = 0,end = 0,index = 0,z;

      cin >> n >> m;

      long int arr[n];
      start = INT_MAX;

      for(int i = 0;i<n;i++){
       cin >> arr[i];
       start = min(start,arr[i]);
       }

       long int ans[m+1] = {0};

       for(int i = 0;i<start;i++)
        ans[i] = 0;

        for(int i = start;i<=m;i++)
        {
            for(int j = 0;j<n;j++)
            {
              if(arr[j] == i)
              {
                ans[i] = 1;
                break;
              }
              if(arr[j]<i)
              {
                  ans[i] = ans[i] || ans[i-arr[j]]^1;
              }
            }
        }
        
        if(ans[m])
         cout << "First" << '\n';
         else cout << "Second" << endl;


  } 
}




Measured memory_bytes: 6772
#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <map>
#include <queue>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using namespace std;

template<class T>
constexpr T INF = ::numeric_limits<T>::max() / 32 * 15 + 208;

int main() {
    int a, b, c, d, e;
    cin >> a >> b >> c >> d >> e;
    cout << min({a, b, c}) + min({d, e}) -50 << "\n";
    return 0;
}



Measured memory_bytes: 3112
s=int(input())

'''
p(0) = 1
p(1) = 0
p(2) = 0
p(n) = p(n-1) + p(n-3)
'''

m=10**9+7

def partition(n):
    line=[1,0,0]
    if n<3:
        return line[n]
    while len(line)<n+1:
        line.append(line[-1]+line[-3])
    return line[-1]

print(partition(s)%m)

Measured memory_bytes: 9208
import java.util.Scanner;

public class Main{

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		Scanner scanner = new Scanner(System.in);

		//入力表示
		int a = scanner.nextInt();
		int b = scanner.nextInt();
		int c = scanner.nextInt();
		
		int sum= a+b+c;
		
		if (sum>=22) {
			System.out.println("bust");
		}else {
			System.out.println("win");
		}

		scanner.close();
	}
}

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

#define FOR(i,a,b)  for(ll (i)=a;(i)<(b);++(i))
#define RFOR(i,a,b) for(ll (i)=a;(i)>=(b);--(i))
#define REP(i,n)    FOR(i,0,n)
#define RREP(i,n)   RFOR(i,n,0)
#define ALL(v)      (v).begin(),(v).end()
#define BIT(n)      (1LL<<(n))
#define IN(x,l,r)   ((l)<=(x)&&(x)<=(r))
#define LEN(s)      (string(s)).length()
#define NPOS        string::npos
#define SHOW(x)     cout<<#x<<" = "<<x<<endl
#define SORT(v)     sort(ALL(v))
#define SZ(v)       (ll)(v).size()
#define UNIQ(v)     SORT(v);(v).erase(unique(ALL(v)),(v).end())
#define PERM(v)     for(bool p=1;p;p=next_permutation(ALL(v)))
#define PQ(T)       priority_queue<T,vector<T>,greater<T>>

template<class T>string join(const vector<T>& v,string d=" ")
{stringstream s;REP(i,SZ(v))s<<d<<v[i];return s.str().substr(LEN(d));}

template<class T>ostream& operator<<(ostream& s,const vector<T>& v)
{s<<"{";if(SZ(v))s<<join(v,", ");s<<"}";return s;}

template<class T>bool contain(const string& s,const T& v)
{return s.find(v)!=NPOS;}

template<class T,class U>string& replace(string& s,const T& f,const U& t)
{for(auto p=s.find(f);p!=NPOS;p=s.find(f,p+LEN(t)))s.replace(p,LEN(f),t);}

const ll INF = 1e15;
const ll MOD = 1e9+7;
const double EPS = 1e-10;

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

int main() {
    char c; cin >> c;
    
    switch (c) {
    case 'a':
    case 'i':
    case 'u':
    case 'e':
    case 'o':
        cout << "vowel" << endl;
        break;
    default:
        cout << "consonant" << endl;
    }
    
    return 0;
}

Measured memory_bytes: 256
N,K=gets.chomp.split(' ').map{|n| n.to_i}
A = Array.new(10**6+1){0}

def getsum(a,b,c)
	return ((a+b)**2+(b+c)**2+(c+a)**2)/2
end
for a in 1..(10**2)
	for b in 1..a
		for c in 1..b
			if(a==b && b==c)
				A[getsum(a,b,c)] += 1
			elsif(a==b || b==c || c==a)
				A[getsum(a,b,c)] += 3
			else
				A[getsum(a,b,c)] += 6
			end
		end
	end
end

for i in 1..(N)
	puts A[i]
end



Measured memory_bytes: 22000
#include <bits/stdc++.h>
#define IO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
using namespace std;
typedef long long ll;
typedef struct data {
    ll x,y;
    bool operator<(const data& a) const
    {
        return x < a.x;
    }
} stu;



ll n,m,k,x;
ll arr[600000];
ll dp[600000];

void solve(){
    x = 10000;
    memset(dp,x,sizeof dp);
    memset(arr,x,sizeof arr);
    cin >> n ;
    for (int i = 0; i < n; ++i)
    {   
        cin >> arr[i];    
    }

    //dp 
    dp[n-1]=0;
    for (int i = n-2; i >=0 ; i--)
    {
        dp[i]=min(dp[i+1]+abs(arr[i]-arr[i+1]),dp[i+2]+abs(arr[i]-arr[i+2]));
    }
    cout << dp[0]<<endl;

    //end dp



}




int main() {


        //clock_t startTime = clock();

    solve();
    //cout << double( clock() - startTime ) / (double)CLOCKS_PER_SEC<<  endl;    
    return 0;
}

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

using namespace std;

typedef complex<double> Point;
const double eps = 1e-10;

bool eq(double a,double b)
{
    return abs(a-b)<eps;
}

bool same(Point a,Point b)
{
    return eq(a.real(),b.real())&&eq(a.imag(),b.imag());
}

int judge(double r1,double r2,double d)
{
    int ans = 2;
    if(r1>r2) swap(r1,r2);

    if(d>r1+r2+eps) ans = 4;
    if(eq(r1+r2,d)) ans = 3;
    if(eq(r2-r1,d)) ans = 1;
    if(d+r1<r2-eps) ans = 0;

    return ans;
}

Point rotation(Point r,double theta)
{
    double x = r.real(), y = r.imag();
    double c = cos(theta), s = sin(theta);
    return Point(x*c-y*s,x*s+y*c);
}

vector<Point> f1(Point &c1,double r1,Point &c2,double r2)
{
    Point s = c2 - c1;
    double theta = acos((r1-r2)/abs(s));

    vector<Point> rs;
    Point p1 = rotation(s,theta);
    p1 = p1*r1/abs(p1)+c1;
    rs.push_back(p1);

    Point p2 = rotation(s,-theta);
    p2 = p2*r1/abs(p2)+c1;
    if(!same(p1,p2))
    {
        rs.push_back(p2);
    }
    return rs;
}

vector<Point> f2(Point &c1,double r1,Point &c2,double r2)
{
    Point s = c2 - c1;
    double d = abs(s)*r1/(r1+r2);
    double theta = acos(r1/d);

    vector<Point> rs;
    Point p1 = rotation(s,theta);
    p1 = p1*r1/abs(p1)+c1;
    rs.push_back(p1);

    Point p2 = rotation(s,-theta);
    p2 = p2*r1/abs(p2)+c1;
    if(!same(p1,p2))
    {
        rs.push_back(p2);
    }
    return rs;
}

bool cmp(const Point &a,const Point &b)
{
    if(a.real()==b.real())
    {
        return a.imag()<b.imag();
    }else
    {
        return a.real()<b.real();
    }
}

int main()
{
    double x1,y1,r1;
    double x2,y2,r2;
    cin>>x1>>y1>>r1;
    cin>>x2>>y2>>r2;

    Point c1(x1,y1),c2(x2,y2);
    Point s = c2 - c1;

    vector<Point> rs;
    switch(judge(r1,r2,abs(s)))
    {
        case 0:break;
        case 1:
        case 2:rs=f1(c1,r1,c2,r2);break;
        case 3:
        case 4:
            rs=f1(c1,r1,c2,r2);
            vector<Point> tmp=f2(c1,r1,c2,r2);
            rs.insert(rs.end(),tmp.begin(),tmp.end());
            break;
    }

    sort(rs.begin(),rs.end(),cmp);
    cout<<fixed<<setprecision(10);
    for(int i=0;i<rs.size();i++)
    {
        cout<<rs[i].real()<<" "<<rs[i].imag()<<endl;
    }

    return 0;
}



Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
#define boost ios::sync_with_stdio(false);cin.tie(nullptr)
#define int long long
#define pi pair<int,int>
#define ff first
#define ss second
#include "string"

int32_t main(){
	boost;
	int n;
	cin>>n;
	int ans =((n + 999)/1000)*1000 - n; 
	cout<<ans<<endl;		
}



Measured memory_bytes: 3640
#include<bits/stdc++.h>
using namespace std;
int main() {
	int a[3];
	cin>>a[0]>>a[1]>>a[2];
	sort(a,a+3);
	if(a[1]-a[0]==a[2]-a[1]) {
		cout<<"YES\n";
		return 0;
	}
	cout<<"NO\n";
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.*;
import java.util.*;
import java.util.stream.Collectors;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Collections;

public class Main {
	public static void main(final String[] args){
    
    Scanner sc = new Scanner(System.in);
    long n = sc.nextLong();
    int r = sc.nextInt();
    long r2 = r;
    int count = 1;
    boolean a = true;
    while(a==true){
        if(n >= r2){
            count++;
        }else{
            //count++;
            a = false;
        }
        r2 = r2 * r;
    }
    System.out.println(count);
    }
}

Measured memory_bytes: 23764
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let l: i64 = read();
    let r: i64 = read();
    if r - l > 2019 {
        println!("{}", 0);
        return;
    }
    let mut ans = 2019;
    for i in l..r {
        for j in (i + 1)..(r + 1) {
            let v = ((i % 2019) * (j % 2019)) % 2019;
            ans = std::cmp::min(v, ans);
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
int main(){
  string S;
  cin >> S;
  int N = S.size()+1;
  vector<int> num(N,0);
  int left =0;
  int right=0;
  for(int i = 1; i < N; i++){
    if(S.at(i-1) == '<'){
      left++;
      num.at(i) = left;
    }
    else{
      left = 0 ;
      num.at(i) = left;
    }
  }
  for (int i = 1; i < N; i++){
    if(S.at(N-i-1) == '>'){
      right++;
      num.at(N-i-1)=max(num.at(N-i-1),right);
    }
    else{
      right = 0;
      num.at(N-i-1)=max(num.at(N-i-1),right);
    }
  }
  int64_t sum = 0;
  for(int j = 0; j < N; j++){
    sum+=num.at(j);
  }
  cout << sum << endl;
}



Measured memory_bytes: 2820
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

import java.util.StringTokenizer;

public class Main {
	private static final int MOD = (int)Math.pow(10, 9);
	public static void main(String[] args) {
		FastReader sc = new FastReader();
		int n = sc.nextInt();
		double odd = Math.ceil(n / (2.0));
		System.out.println((odd/(n*1.0)));
	}
	
	static class FastReader {
	    BufferedReader br;
	    StringTokenizer st;
	
	    public FastReader() {
	      br = new BufferedReader(new InputStreamReader(System.in));
	    }
	  
	    String next() { 
	      while (st == null || !st.hasMoreElements()) {
	        try {
	          st = new StringTokenizer(br.readLine());
	        } catch (IOException  e) {
	          e.printStackTrace();
	        }
	      }
	      return st.nextToken();
	    }
	
	    int nextInt() {
	      return Integer.parseInt(next());
	    }
	
	    long nextLong() {
	      return Long.parseLong(next());
	    }
	
	    double nextDouble() { 
	      return Double.parseDouble(next());
	    }
	
	    String nextLine() {
	      String str = "";
	        try{
	            str = br.readLine();
	        } catch (IOException e) {
	            e.printStackTrace();
	        }
	        return str;
	      }
	  }
}


Measured memory_bytes: 21844
#!/usr/bin/env python3
import sys

def func_s2(x):
    t = x % 10
    if t == 0:
        return 10
    return t

def func_s3(x):
    am = x%10
    if am == 0:
        return x
    return x - am + 10

def solve(A: int, B: int, C: int, D: int, E: int):
    S1 = [A,B,C,D,E]
    S2 = list(map(func_s2,S1))
    S3 = list(map(func_s3,S1))
    min_S2 = min(S2)

    res = 0
    found_min = False
    for s1,s2,s3 in zip(S1,S2,S3):
        if not found_min and s2 == min_S2:
            found_min = True
            res += s1
        else:
            res += s3

    print(res)




# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    C = int(next(tokens))  # type: int
    D = int(next(tokens))  # type: int
    E = int(next(tokens))  # type: int
    solve(A, B, C, D, E)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
//Problem C
#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll n,k,ans;
void cal(ll a){ans+=a*a*a;}

int main(){
    scanf("%lld%lld",&n,&k);
    cal(n/k);
    if(!(k&1))cal((n+k/2)/k);
    printf("%lld",ans);
    return 0;
}

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

class Program
{
    static void Main(string[] args)
    {
        var N = sc.ReadInt();
        var S = sc.ReadStr();
        var x = 0;
        var ans = 0;
        for (int i = 0; i < N; i++)
        {
            if (S[i] == 'I') x++;
            else x--;
            ans = Math.Max(ans, x);
        }
        Console.WriteLine(ans);
    }

    static Scanner sc = new Scanner();
}

class Scanner
{
    string[] S = new string[0];
    int Index = 0;
    char[] Separators = new char[] { ' ' };

    public string Next()
    {
        if (this.Index < this.S.Length) return this.S[this.Index++];
        var line = "";
        while (line == "") line = Console.ReadLine();
        this.S = line.Split(this.Separators, StringSplitOptions.RemoveEmptyEntries);
        if (this.S.Length == 0) return this.Next();
        this.Index = 0;
        return this.S[this.Index++];
    }
    public string ReadStr()
    {
        return this.Next();
    }
    public char ReadChar()
    {
        return this.Next()[0];
    }
    public int ReadInt()
    {
        return int.Parse(this.Next());
    }
    public uint ReadUInt()
    {
        return uint.Parse(this.Next());
    }
    public long ReadLong()
    {
        return long.Parse(this.Next());
    }
    public double ReadDouble()
    {
        return double.Parse(this.Next());
    }
    public int[] ReadIntArray(int n)
    {
        var array = new int[n];
        for (int i = 0; i < array.Length; i++)
        {
            array[i] = this.ReadInt();
        }
        return array;
    }
    public long[] ReadLongArray(int n)
    {
        var array = new long[n];
        for (int i = 0; i < array.Length; i++)
        {
            array[i] = this.ReadLong();
        }
        return array;
    }
    public double[] ReadDoubleArray(int n)
    {
        var array = new double[n];
        for (int i = 0; i < array.Length; i++)
        {
            array[i] = this.ReadDouble();
        }
        return array;
    }
    public char[] ReadCharArray(int n)
    {
        var array = new char[n];
        for (int i = 0; i < array.Length; i++)
        {
            array[i] = this.ReadChar();
        }
        return array;
    }
    public string[] ReadStrArray(int n)
    {
        var array = new string[n];
        for (int i = 0; i < array.Length; i++)
        {
            array[i] = this.ReadStr();
        }
        return array;
    }
}


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

int main()
{
	int n;
	string s,t;
	cin>>n>>s>>t;
	for(size_t i = 0; i<n; i++)
	{
		cout<<s[i]<<t[i];
	}
	cout<<endl;
	return 0;
}




Measured memory_bytes: 256
N = int(input())
A, B = map(int, input().split())
P = list(map(int, input().split()))
ans = [0] * 21

for i in range(N):
  ans[P[i]] += 1

print(min(sum(ans[0:A + 1]), sum(ans[A + 1:B + 1]), sum(ans[B + 1:])))

Measured memory_bytes: 38256
/**
 *    author:  otera    
**/
#include<iostream>
#include<string> 
#include<cstdio>
#include<cstring>
#include<vector>
#include<cmath>
#include<algorithm> 
#include<functional>
#include<iomanip>
#include<queue>
#include<deque>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<cassert>
using namespace std;

#define int long long
typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef long double ld;
const int inf=1e9+7;
const ll INF=1LL<<60 ;
const ll mod=1e9+7 ;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<int, int> P;
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
#define debug(x)  cerr << #x << " = " << (x) << endl;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

struct UnionFind {
    vector<int> par, w;
    
    UnionFind(int n) : par(n, -1), w(n, 0) { }
    void init(int n) { par.assign(n, -1); w.assign(n, 0); }
    
    int root(int x) {
        if (par[x] < 0) return x;
        else return par[x] = root(par[x]);
    }
    
    bool issame(int x, int y) {
        return root(x) == root(y);
    }
    
    bool merge(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) {
            ++w[x];
            return false;
        }
        if (par[x] > par[y]) swap(x, y); // merge technique
        par[x] += par[y];
        par[y] = x;
        w[x] += w[y];
        ++w[x];
        return true;
    }
    
    int size(int x) {
        return -par[root(x)];
    }
 
    int wei(int x) {
        return w[root(x)];
    }
};

void solve() {
	int n, m; cin >> n >> m;
    UnionFind uf(n);
    rep(i, m) {
        int a, b; cin >> a >> b;
        -- a, -- b;
        uf.merge(a, b);
    }
    int ans = 0;
    rep(i, n) {
        chmax(ans, uf.size(i));
    }
    cout << ans << endl;
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(10);
	//int t; cin >> t; rep(i, t)solve();
	solve();
    return 0;
}

Measured memory_bytes: 6356
from functools import reduce
import fractions
import numpy as np

N, M = map(int, input().split())
a = np.array(list(map(int, input().split())))

a = a // 2

def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)

l = lcm(*a)
exist = not 0 in ((l//a)%2)

if exist:
    print((M // l + 1 ) // 2)
else:
    print(0)

Measured memory_bytes: 24192
from math import factorial
from itertools import accumulate
from collections import Counter

def count(n):
    if n<2:
        return 0
    else:
        return factorial(n)//(factorial(2)*factorial(n-2))

n,m=map(int,input().split())
A=list(map(int,input().split()))
S=[0]+list(accumulate(A))
M=[0]*(n+1)
for i in range(n+1):
    M[i]=S[i]%m
C=Counter(M)
ans=0
for i in C.values():
    ans+=count(i)
print(ans)

Measured memory_bytes: 18856
#include<stdio.h>

int main(void)
{
  int n, i;
  int m, e, j;
  char class;
  
  while(scanf("%d",&n))
    {
      if(n==0)
	break;
      else
	{
	  for(i=0;i<n;i++)
	    {
	      scanf("%d %d %d",&m,&e,&j);
	      class = 'C';
	      if((m+e+j)/3>=50 && (m>=80 || e>=80))
		class = 'B';
	      if((m+e+j)/3>=70)
		class = 'B';
	      if((m+e+j)/3>=80)
		class = 'A';
	      if((m+e)/2>=90)
		class = 'A';
	      if(m==100||e==100||j==100)
		class = 'A';
	      
	      printf("%c\n",class);
	    }
	}
    }
  return 0;
}

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

int main(){
  int N;
  string S;
  cin >> N >> S;
  vector<int> A(N);

  //東の人は1, 西の人は0
  for(int i = 0; i < N; i++){
    if(S.at(i) == 'E') A.at(i) = 1;
    else A.at(i) = 0;
  }

  //累積和
  //B.at(p)はp番目までの1の個数
  //B.at(N-1) - B.at(p-1)はp番目以降の1の個数
  vector<int> B(N);
  for(int i = 0; i < N; i++){
    if(i == 0) B.at(i) = A.at(i);
    else{
      B.at(i) = B.at(i-1) + A.at(i);
    }
  }
  
  int min = N;

  for(int i = 0; i < N; i++){
    int l, r; 
    if(i == 0) l = 0;
    else{
      l = i - B.at(i-1);
    }
    if(i == N - 1) r = 0;
    else{
      r = B.at(N-1) - B.at(i);
    }
    if(min > l + r) min = l + r;
  }
  cout << min << endl;
}

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

#define int long long
#define fi first
#define se second
#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 rep11(i,n) for(int i=1;i<(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define repm(i,n) for(int i=(int)(n)-1;i>=0;--i)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define sperase(v,n) (v).erase(remove(all(v), n), (v).end())
#define vdelete(v) (v).erase(unique(all(v)), (v).end())
#define pb(n) push_back(n)
#define mp make_pair
#define MOD 1000000007
#define INF 9223372036854775807

int x,a;

signed main() {
    cin >> x >> a;
    if (x < a) cout << 0 << endl;
    else cout << 10 << endl;
}




Measured memory_bytes: 384
#include <cstdio>
#include <cmath>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>

#ifdef _DEBUG
#define DMP(x) cerr << #x << ": " << x << "\n"
#else
#define DMP(x) ((void)0)
#endif

const int MOD = 1000000007, INF = 1111111111; 
using namespace std;
typedef long long lint;

int main() {

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

	string S;
	cin >> S;

	int tmp = (S[0] - '0') * 100 + (S[1] - '0') * 10 + (S[2] - '0');
	int ans = abs(753 - tmp);
	for (int i = 3; i < S.size(); i++) {

		tmp = tmp % 100 * 10 + S[i] - '0';
		ans = min(ans, abs(753 - tmp));

	}

	cout << ans << "\n";

	return 0;
}

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

int main(){
    string w,t;
    cin >> w;
    int count = 0;
    while(1){
        cin >> t;
        if(t == "END_OF_TEXT") break;
        
        for (int i=0;i<(int)t.size();i++){
            t[i]=tolower(t[i]);
        }
        if(t==w) count++;
    }
    cout << count << endl;
    return 0;
}


Measured memory_bytes: 3212
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rrep(i,n) for (int i = (n)-1; i >= 0; i--)
#define rep2(i,s,n) for (int i = (s); i < (n); ++i)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define pb push_back
#define eb emplace_back
#define vi vector<int>
#define vvi vector<vector<int>>
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vd vector<double>
#define vs vector<string>
#define vc vector<char>
#define vb vector<bool>
#define vp vector<P>
using namespace std;
using ll = long long;
using P = pair<int,int>;
using LP = pair<ll,ll>;
template<class S,class T> istream& operator>>(istream &is,pair<S,T> &p) { return is >> p.first >> p.second; }
template<class S,class T> ostream& operator<<(ostream &os,const pair<S,T> &p) { return os<<'{'<<p.first<<","<<p.second<<'}'; }
template<class T> istream& operator>>(istream &is,vector<T> &v) { for(T &t:v){is>>t;} return is; }
template<class T> ostream& operator<<(ostream &os,const vector<T> &v) { os<<'[';rep(i,v.size())os<<v[i]<<(i==v.size()-1?']':','); return os; }
void Yes(bool b) { cout << (b ? "Yes" : "No") << endl; }
void YES(bool b) { cout << (b ? "YES" : "NO") << endl; }
template<class T> bool chmin(T& a,T b) {if(a > b){a = b; return true;} return false;}
template<class T> bool chmax(T& a,T b) {if(a < b){a = b; return true;} return false;}
const int inf = 1001001001;
const ll linf = 1001001001001001001;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr); cout.tie(nullptr);
    int n,m;
    cin >> n >> m;
    vvi v(m);
    rep(i,n) {
        int x;
        cin >> x;
        v[x%m].pb(x);
    }
    int ans = 0;
    rep(i,m) {
        if(i == 0 or i*2 == m) {
            ans += v[i].size()/2;
        } else if(i < m-i) {
            int j = m-i;
            if(v[i].size() < v[j].size()) swap(v[i],v[j]);
            ans += v[j].size();
            map<int,int> mp;
            for(int k : v[i]) mp[k]++;
            int cnt = 0;
            for(auto [_,s] : mp) cnt += s/2;
            ans += min(cnt,int(v[i].size()-v[j].size())/2);
        } else break;
    }
    cout << ans << endl;
}


Measured memory_bytes: 8708
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <algorithm>

using namespace std;

void showIntArray(int a[], int n) {
  for (int i=0; i<n; i++) {
    cout << a[i] << ' ';
  } cout << endl;
}

int abs(int a, int b) {
  if (a < b) {
    return b - a;
  } else {
    return a - b;
  }
}
int main() {
  int a[5], k;
  for (int i=0; i<5; i++) {
    cin >> a[i];
  }
  cin >> k;
  for (int i=0; i<5; i++) {
    for (int j=0; j<5; j++) {
      if (abs(a[i], a[j]) > k) {
        cout << ":(" << endl;
        return 0;
      }
    }
  }
  cout << "Yay!" << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n;
  long long sum=0;
  cin>>n;
  for(int i=1;i<=n;i++)
  {
    if(i%3!=0&&i%5!=0)
      sum+=i;
  }
  cout<<sum<<endl;
  return 0;
}


Measured memory_bytes: 3636
#include <stdio.h>

int main()
{
	long i,j,k,n,m,l;
	long A[101][101],B[101][101],C[101][101]={0};
	scanf("%d %d %d",&n,&m,&l);
	for(i=0;i<n;i++){
		for(j=0;j<m;j++){
			scanf("%d ",&A[i][j]);
		}
	}
	for(i=0;i<m;i++){
		for(j=0;j<l;j++){
			scanf("%d ",&B[i][j]);
		}
	}
	for(i=0;i<n;i++){
		for(j=0;j<l;j++){
			for(k=0;k<m;k++){
				C[i][j] += A[i][k]*B[k][j];
			}
		printf("%ld",C[i][j]);
		if(j<l-1)
		    printf(" ");
		}
		printf("\n");
	}
	return 0;
}

Measured memory_bytes: 856
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int m = 0;

void dfs(vector< vector< pair<int,int> > > &g, int v, int p = -1, int ng = -1) {
    int c = 0;
    for(int i=0; i<g[v].size(); i++) {
        if(g[v][i].first == p) continue;
        if(c == ng) {
            g[v][i].second = ++c;
        } else {
            g[v][i].second = c;
        }
        m = max(m, c);
        dfs(g, g[v][i].first, v, c);
        ++c;
    }
    return;
}

int main(void) {
    int N;
    cin >> N;
    vector<int> A(N-1), B(N-1), I(N-1);
    vector< vector< pair<int,int> > > g(N);
    for(int i=0; i<N-1; i++) {
        cin >> A[i] >> B[i];
        --A[i];
        --B[i];
        I[i] = g[A[i]].size();
        g[A[i]].emplace_back(B[i], 0);
        g[B[i]].emplace_back(A[i], 0);
    }

    dfs(g, 0);

    cout << m + 1 << endl;
    for(int i=0; i<N-1; i++) {
        cout << g[A[i]][I[i]].second + 1 << endl;
    }
    return 0;
}


Measured memory_bytes: 8832
#include <stdio.h>

int a[1000];
int main() {
  int n, m;
  int sum = 0;
  scanf("%d %d", &n, &m);
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    sum += a[i];
  }
  int selected = 0;
  for (int i = 0; i < n; i++) {
    if ((double)a[i] >= (double)(sum / (4.0 * m))) {
      selected++;
    }
  }
  printf("%s", selected >= m ? "Yes" : "No");
}

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

int main(void){
    int a,b;
    cin >> a >> b;
    int ans = 0;
    for(int i=a; i<=b; i++){
        string s = to_string(i);
        if(s[0] == s[4] && s[1] == s[3]){
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
from collections import defaultdict as dd
H, W = map(int, input().split())
Cy, Cx = map(int, input().split())
Dy, Dx = map(int, input().split())
M = [['#']*(W+4)]+[['#']*(W+4)]+[['#','#'] + list(input()) + ['#','#'] for _ in range(H)]+[['#']*(W+4)]+[['#']*(W+4)]

num_groups = 0
for y in range(2, H+2):
    L = M[y]
    for x in range(2, W+2):
        if L[x] == '.':
            q = [[y, x]]
            while q:
                ty, tx = q.pop()
                M[ty][tx] = num_groups
                if M[ty-1][tx] == '.':
                    q.append([ty-1, tx])
                if M[ty+1][tx] == '.':
                    q.append([ty+1, tx])
                if M[ty][tx-1] == '.':
                    q.append([ty, tx-1])
                if M[ty][tx+1] == '.':
                    q.append([ty, tx+1])
            num_groups += 1 

ds = [[-2,0], [-2,1], [-1,1], [-2,2], [-1,2], [2,0], [1,1], [2,1], [0,2], [1,2], [2,2]]
edges = dd(dict)
for y in range(2, H+2):
    for x in range(2, W+2):
        f = M[y][x]
        if f != '#':
            for dy, dx in ds:
                t = M[y+dy][x+dx]
                if t != '#' and f != t:
                    edges[f][t] = edges[t][f] = 1

start = M[Cy+2-1][Cx+2-1]
goal = M[Dy+2-1][Dx+2-1]
q = set([start])
visited = [False] * num_groups
visited[start] = True
ans = 0
while q:
    nq = set()
    for p in q:
        if p == goal:
            print(ans)
            exit()
        for t in edges[p].keys():
            if not visited[t]:
                nq.add(t)
                visited[t] = True
    q = nq
    ans += 1

print(-1)



Measured memory_bytes: 203300
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		char[] c = s.toCharArray();
		for(int i = 0; i < c.length; i++) {
			if(c[i]== '?')
				c[i] = 'D';
		}
			System.out.println(String.valueOf(c));
	}
}

Measured memory_bytes: 41736
/*
ID: anonymo14
TASK: wormhole
LANG: C++                 
*/
#include<bits/stdc++.h>

using namespace std;

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

#define F first
#define S second
#define PU push
#define PUF push_front
#define PUB push_back
#define PO pop
#define POF pop_front
#define POB pop_back

#define REP(i,a,b) for(int i=a; i<=b; i++)

#define MOD 1000000007

void solve(int test_case) {//229
	int h,w,H,W;
	cin>>H>>W>>h>>w;
	H-=h;W-=w;
	cout<<H*W;
}

int main() {
	
	////// FILE BASED IO////
	//freopen("wormhole.in", "r", stdin);
	//freopen("wormhole.out", "w", stdout);
	///////////////
	
	ios::sync_with_stdio(0);
	cin.tie(0);
	int t=1;
	//cin>>t;
	REP(i,1,t) {
		solve(i);
	}
	return 0;
}	


Measured memory_bytes: 3576
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <numeric>

#define REP(i, a, b) for (int i = int(a); i < int(b); i++)
using namespace std;
typedef long long int ll;

// clang-format off
#ifdef _DEBUG_
#define dump(...) do{ cerr << __LINE__ << ":\t" << #__VA_ARGS__ << " = "; PPPPP(__VA_ARGS__); cerr << endl; } while(false)
template<typename T> void PPPPP(T t) { cerr << t; }
template<typename T, typename... S> void PPPPP(T t, S... s) { cerr << t << ", "; PPPPP(s...); }
#else
#define dump(...)
#endif
template<typename T> vector<T> make_v(size_t a, T b) { return vector<T>(a, b); }
template<typename... Ts> auto make_v(size_t a, Ts... ts) { return vector<decltype(make_v(ts...))>(a, make_v(ts...)); }
template<typename T>
bool chmin(T &a, T b) { if (a > b) {a = b; return true; } return false;}
template<typename T>
bool chmax(T &a, T b) { if (a < b) {a = b; return true; } return false;}
// clang-format on

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int x;
    cin >> x;
    int mx = 500010;
    vector<bool> isPrime(mx, true);
    isPrime[0] = isPrime[1] = false;
    for (int i = 2; i < mx; i++) {
        if (isPrime[i]) {
            if (i >= x) {
                cout << i << endl;
                return 0;
            }
            for (int j = i + i; j < mx; j += i) {
                isPrime[j] = false;
            }
        }
    }
    return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define SORT(x) sort(x.begin(),x.end())
#define RSORTLL(x) sort(x.begin(),x.end(),greater<long long>())
#define RSORTI(x) sort(x.begin(),x.end(),greater<int>())
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1000000000
#define mod 1000000007
typedef long long ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
int main(){
    int x,y,z;ll K;
    cin>>x>>y>>z>>K;
    vector<ll> a(x),b(y),c(z);

    rep(i,x)
    cin>>a[i];
    rep(i,y)
    cin>>b[i];
    rep(i,z)
    cin>>c[i];
    //aから1つbから1つcから1つ選ぶ
    RSORTLL(a);RSORTLL(b);RSORTLL(c);
    vector<ll> ans;
    rep(i,x){
        rep(j,y){
            rep(k,z){
                if((i+1)*(j+1)*(k+1)<=K){
                    ans.push_back(a[i]+b[j]+c[k]);
                }
            }
        }
    }
    RSORTLL(ans);
    rep(i,K)    cout<<ans[i]<<endl;
    return 0;
}

Measured memory_bytes: 1404
/*--------------------------"SABUJ-JANA"------"JADAVPUR UNIVERSITY"--------*/
/*-------------------------------@greenindia-----------------------------------*/
//
//		  _____       _           _        _
//		 / ____|     | |         (_)      | |
//		| (___   __ _| |__  _   _ _       | | __ _ _ __   __ _
//		 \___ \ / _` | '_ \| | | | |  _   | |/ _` | '_ \ / _` |
//		 ____) | (_| | |_) | |_| | | | |__| | (_| | | | | (_| |
//		|_____/ \__,_|_.__/ \__,_| |  \____/ \__,_|_| |_|\__,_|
//		                        _/ |
//		                       |__/
/*---------------------- Magic. Do not touch.-----------------------------*/
/*------------------------------God is Great/\---------------------------------*/
#include <bits/stdc++.h>
using namespace std;
#define crap                     \
    ios::sync_with_stdio(false); \
    cin.tie(NULL);               \
    cout.tie(NULL)
//cout<<fixed<<showpoint<<setprecision(12)<<ans<<endl;
#define int long long int
#define double long double
#define PI acos(-1)
typedef vector<int> vi;
typedef vector<vector<int>> vvi;

void print1d(const vector<int>& vec) {
    for (auto val : vec) {
        cout << val << " ";
    }
    cout << endl;
}

void print2d(const vector<vector<int>>& vec) {
    for (auto row : vec) {
        for (auto val : row) {
            cout << val << " ";
        }
        cout << endl;
    }
}

vector<string> queries;
bool jobDone;
string ans;
int total;

void dfs(int A, int B, int C, int count, string& temp) {
    if (jobDone)
        return;
    if (A < 0 or B < 0 or C < 0)
        return;
    if (count == total) {
        ans = temp;
        jobDone = true;
        return;
    }

    string x = queries[count];

    if (x == "AB") {
        temp += "A";
        dfs(A + 1, B - 1, C, count + 1, temp);
        temp.pop_back();

        temp += "B";
        dfs(A - 1, B + 1, C, count + 1, temp);
        temp.pop_back();
    } else if (x == "BC") {
        temp += "B";
        dfs(A, B + 1, C - 1, count + 1, temp);
        temp.pop_back();

        temp += "C";
        dfs(A, B - 1, C + 1, count + 1, temp);
        temp.pop_back();
    } else {
        temp += "A";
        dfs(A + 1, B, C - 1, count + 1, temp);
        temp.pop_back();

        temp += "C";
        dfs(A - 1, B, C + 1, count + 1, temp);
        temp.pop_back();
    }

    return;
}

void solve() {
    int q, A, B, C;
    cin >> q >> A >> B >> C;

    int t = q;
    while (t--) {
        string str;
        cin >> str;
        queries.push_back(str);
    }

    total = q;
    // cout << total << endl;
    jobDone = false;
    string temp = "";
    dfs(A, B, C, 0, temp);

    if (jobDone) {
        cout << "Yes" << endl;
        for (auto cc : ans)
            cout << cc << endl;
    } else {
        cout << "No" << endl;
    }
}

signed main() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("error.txt", "w", stderr);
#endif
    crap;

    solve();

    return 0;
}

Measured memory_bytes: 18984
from collections import Counter
n=int(input())
a=list(map(int,input().split()))
b=[0]*(n+1)
for i in range(1,n+1):
  b[i]=b[i-1]+a[i-1]
l=list(Counter(b).values())
for i in range(len(l)):
  x=l[i]
  l[i]=(x**2-x)//2
print(sum(l))

Measured memory_bytes: 41692
s = input()
l = len(s)
def parse1(s):
    cur = 0
    num = 0; res = 0; op = '+'
    while cur < len(s):
        if s[cur] in '+*':
            if op is '+':
                res += num
            else:
                res *= num
            num = 0; op = s[cur]
        else:
            num = 10 * num + int(s[cur])
        cur += 1
    if op is '+':
        res += num
    else:
        res *= num
    return res
def parse2(s):
    cur = 0
    def number():
        nonlocal cur
        v = int(s[cur]); cur += 1
        return v
    def term():
        nonlocal cur
        res = 1
        while 1:
            res *= number()
            if l <= cur or s[cur] != '*':
                break
            cur += 1
        return res
    def expr():
        nonlocal cur
        res = 0
        while 1:
            res += term()
            if l <= cur or s[cur] != '+':
                break
            cur += 1 # '+'
        return res
    return expr()
v = int(input())
r1 = parse1(s) == v
r2 = parse2(s) == v
print("ILMU"[r1+2*r2])

Measured memory_bytes: 5608
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const int N=2e5+5;
int n,m,a[N],b[N],tree[4*N],tree2[4*N],lazy[4*N];
ll ans;
void initseg(int nd,int l,int r)
{
    if(l==r){ tree[nd]=b[l]; tree2[nd]=l; return; }
    int m=(l+r)/2;
    initseg(nd*2,l,m);
    initseg(nd*2+1,m+1,r);
    tree[nd]=b[l];
    tree2[nd]=l;
}
void pushdown(int nd,int l,int r)
{
    if(l!=r){
        lazy[nd*2]+=lazy[nd];
        lazy[nd*2+1]+=lazy[nd];
    }
    tree[nd]+=lazy[nd];
    lazy[nd]=0;
}
P query(int nd,int l,int r,int s,int e)
{
    if(r<s||e<l) return P(2e9,2e9);
    pushdown(nd,l,r);
    if(s<=l&&r<=e) return P(tree[nd],tree2[nd]);
    int m=(l+r)/2;
    return min(query(nd*2,l,m,s,e),query(nd*2+1,m+1,r,s,e));
}
void update(int nd,int l,int r,int s,int e)
{
    if(r<s||e<l) return;
    pushdown(nd,l,r);
    if(s<=l&&r<=e){
        lazy[nd]++;
        pushdown(nd,l,r);
        return;
    }
    int m=(l+r)/2;
    update(nd*2,l,m,s,e);
    update(nd*2+1,m+1,r,s,e);
    tree[nd]=min(tree[nd*2],tree[nd*2+1]);
}
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin>>n;
    for(int i=1;i<=n;i++){ cin>>a[i]; b[i]=a[i]; }
    sort(b+1,b+1+n);
    m=unique(b+1,b+1+n)-b-1;
    initseg(1,1,m);
    for(int i=1;i<=n;i++){
        int plc=lower_bound(b+1,b+1+m,a[i])-b;
        P tp=query(1,1,m,plc,m);
        ans+=(ll)tp.first-a[i];
        if(tp.second==1) continue;
        update(1,1,m,1,tp.second-1);
    }
    cout<<ans;
    return 0;
}


Measured memory_bytes: 11264
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define N 100

int main(){
  int a;
  char A[N];
  signed long long B[N];
  int  b = 0;

  while( scanf("%s", A) != EOF ){
    if ( A[0] == '+' ){
      b--;
      B[b - 1] += B[b];
    } else if ( A[0] == '-' ){
      b--;
      B[b - 1] -= B[b];
    } else if ( A[0] == '*' ){
      b--;
      B[b - 1] *= B[b];
    } else {
      a = atoi(A);
      B[b] = a;
      b++;
    }
  }

  printf("%lld\n", B[0]);

  return 0;
}


Measured memory_bytes: 2048
#include<bits/stdc++.h>
#define ull unsigned long long
#define ll long long
#define F first
#define S second
#define pss pair<string,string>
#define pcc pair<char,char>
#define pll pair<ll,ll>
#define pii pair<int,int>
#define piii pair<int,pii>
#define vi vector<int>
#define vii vector<pii>
#define pb push_back
#define vs vector<string>
#define vl vector<ll>
#define vs vector<string>
#define vll vector<pll>
#define vss vector<pss>
#define vcc vector<pcc>
#define MP make_pair
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=n-1;i>=0;i--)
using namespace std;
const int N = 1e5+5;
const int mod=1e9+7;
const int INF=0x3f3f3f3f;
ll ans=0;int n,mx;
int main()
{
	cin>>n>>mx;
	for(int i=1;i<n;i++)
	{
		int x;
		cin>>x;
		ans+=max(mx-x,0);
		mx=max(mx,x);
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 3628
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
input = sys.stdin.readline
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
	return list(map(int,input().split()))
def m(): #複数文字
	return map(int,input().split())
def onem(): #Nとかの取得
	return int(input())
def s(x): #圧縮
	a = []
	if len(x) == 0:
		return []
	aa = x[0]
	su = 1
	for i in range(len(x)-1):
		if aa != x[i+1]:
			a.append([aa,su])
			aa = x[i+1]
			su = 1
		else:
			su += 1
	a.append([aa,su])
	return a
def jo(x): #listをスペースごとに分ける
	return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
	return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False

def pow_k(x, n):
    ans = 1
    while n:
        if n % 2:
            ans *= x
        x *= x
        n >>= 1
    return ans

"""
def nibu(x,n,r):
	ll = 0
	rr = r
	while True:
		mid = (ll+rr)//2

	if rr == mid:
		return ll
	if (ここに評価入れる):
		rr = mid
	else:
		ll = mid+1
"""

x,n = m()

p = l()



ans = Max
ab = Max
dp = [0 for i in range(102)]
for i in p:
	dp[i] = 1

for i in range(102):
	if dp[i] != 1 and abs(x - i) < ab:
		ab = abs(x - i)
		ans = i
print(ans)


Measured memory_bytes: 65400
#include <iostream>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <math.h>
using namespace std;
int main () {
  long N;
  long M;
  cin >> N >> M;
  long max = (sqrt(M) > M/N) ? sqrt(M) : M/N;
  long result = 1;
  while(true){
    if(M % max == 0 && (max * N) <= M){
      result = max;
        //cout << M - max * N << endl;
      break;
    }
    max--;
  }
  cout << result << endl;
  
}

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

int main() {
    int h, w; cin >> h >> w;
    vector<string> pic(h);
    for (string &i: pic) cin >> i;
    for (int i=0; i<w+2; ++i) cout << "#";
    cout << endl;
    for (int i=0; i<h; ++i) cout << "#" << pic[i] << "#" << endl;
    for (int i=0; i<w+2; ++i) cout << "#";
    cout << endl;
}


Measured memory_bytes: 256
#include"iostream"
#include<stdlib.h>
#include<stdio.h>
#include<time.h>
#include<list>
#include<map>
#include<string>
#include<algorithm> 
#include <queue> 
#include <sstream>
#include <fstream>
#include<cmath>
#define INF 1000000000
#define LL long long
using namespace std;

vector<double> v;
double ans, use[10];
long long N, M,K, A[100000];
string s[10];

int main() {
	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> use[i]>>s[i];
		if (s[i] == "JPY") {
			ans += use[i];
		}
		else {
			ans += use[i] * 380000;
		}
	}
	
		cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 256
// Example program
#include <iostream>
#include<vector>
#include<algorithm>

using namespace std;

int main()
{
int W;
int H;
int x;
int y;
int r;

cin>>W;
cin>>H;
cin>>x;
cin>>y;
cin>>r;

if(0<=x-r&&x+r<=W&&y-r>=0&&y+r<=H){cout<<"Yes"<<endl;}else{cout<<"No"<<endl;}




}

Measured memory_bytes: 1156