akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

int main()
{
    int N, M, hight, A, B, good_location = 0;
    cin >> N >> M;
    vector<int> H(100000);
    vector<int> check(100000);
    vector<vector<int>> AB(100000, vector<int>(2));

    for (int i = 0; i < N; i++)
    {
        cin >> hight;
        H.at(i) = hight;
    }

    for (int j = 0; j < M; j++)
    {
        cin >> A >> B;
        AB.at(j).at(0) = A - 1;
        AB.at(j).at(1) = B - 1;
    }

    for (int j = 0; j < M; j++)
    {
        if ((H.at(AB.at(j).at(0)) > H.at(AB.at(j).at(1))) && (check.at(AB.at(j).at(0)) != -1))
        {
            check.at(AB.at(j).at(0))++;
        }
        else
        {
            check.at(AB.at(j).at(0)) = -1;
        }

        if ((H.at(AB.at(j).at(1)) > H.at(AB.at(j).at(0))) && (check.at(AB.at(j).at(1)) != -1))
        {
            check.at(AB.at(j).at(1))++;
        }
        else
        {
            check.at(AB.at(j).at(1)) = -1;
        }
    }

    for (int i = 0; i < N; i++)
    {
        if (check.at(i) >= 0)
            good_location++;
    }

    cout << good_location << endl;
    return 0;
}

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

const int mx = 300005;
char s[mx];
int n,E[mx],W[mx];
int main()
{
    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);

   scanf("%d",&n);
   scanf("%s",s);
   for(int i=0;i<n;i++)
   {
       if(s[i]=='E')
       {
           E[i+1]=E[i]+1;
           W[i+1]=W[i];
       }
       else
       {
           E[i+1]=E[i];
           W[i+1]=W[i]+1;
       }
   }
   int ans=1e9;
   for(int i=1;i<=n;i++)
       ans=min(ans,W[i-1]+E[n]-E[i]);
   cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 2944
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define rrep2(ri,x,n) for(int ri = (int)(n-1); ri >= (int)(x); ri--)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(x) x.begin(), x.end()
using ll = long long;
using namespace std;

ll fc(vector<int> &ld, vector<int> &c, int d){
  ll ret = 0;
  rep(i, 26){
    ret += (ll)c.at(i)*(d - ld.at(i));
  }
  return ret;
}

ll ret(vector<int> &c, vector<vector<int>> &s, vector<int> &ld, int t, int day, bool f, int &tt){
  ll ans = 0;
  tt = ld.at(t);
  ld.at(t) = day;
  ans += s.at(day).at(t);
  ans -= fc(ld, c, day);
  if(f == false)ld.at(t) = tt;
  return ans;
}

int main(){
  int D;
  cin >> D;
  vector<int> ld(26, -1);
  vector<int> c(26);
  rep(i, 26) cin >> c.at(i);
  vector<vector<int>> s(D, vector<int>(26));
  rep(i, D){
    rep(j, 26){
      int in;
      cin >> in;
      s.at(i).at(j) = in;
    }
  }
  int tt;
  rep(i, D){
    ll mx = -9e18;
    int jj = 0;
    if(i < D-1){
      rep(j, 26){
        rep(k, 26){
          ll r = ret(c, s, ld, j, i, true, tt);
          r += ret(c, s, ld, k, i+1, false, tt);
          if(r > mx){
            mx = r;
            jj = j;
          }
          ld.at(j) = tt;
        }
      }
    }else{
      rep(j, 26){
        ll r = ret(c, s, ld, j, i, false, tt);
        if(r > mx){
          mx = r;
          jj = j;
        }
      }
    }
    cout << jj+1 << endl;
    ret(c, s, ld, jj, i, true, tt);
  }
  return 0;
}

Measured memory_bytes: 3668
#include <bits/stdc++.h>
using namespace std;
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <bitset>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef long long LL;

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

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define SORTG(c) sort((c).begin(),(c).end(),greater<auto>())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a); i<(b); i++)
#define REP(i,n)  for(int i=0; i<(n); i++)

//constant
//--------------------------------------------
const double PI  = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
const LL MOD = 1e9+7; 
int main(){
    int n;
    cin >> n;
    map <int, int> s;
    int ans = 0;
    REP(i, n){
        int a;
        cin >> a;
        s[a]+=1;
        s[a-1]+=1;
        s[a+1]+=1;
        ans=max(ans, s[a]);
        ans=max(ans, s[a+1]);
        ans=max(ans, s[a-1]);
    }
    cout << ans << endl;
 
}

Measured memory_bytes: 4736
#include <bits/stdc++.h>
#include <stdio.h>
using namespace std;  //これで"std::cout"が"cout"と書ける

//MACRO
typedef long long ll;                  //64bit以上を表現可能な型
#define INF 100000000                  //ほぼ無限
#define itn int                        //タイポ対策
#define ALL(x) (x).begin(), (x).end()  //sort(all(x))などとする
#define SZ(x) ((int)(x).size())        //size()簡略化
//repetition
#define FOR(i, p, b) for (int i = (p); i < (b); ++i)
#define rep(i, n) FOR(i, 0, n)
#define repR(i, n) for (int i = n; i >= 0; i--)
//debug
#define dump(x) cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" \<< " " << __FILE__ << endl;
template <class T>
bool chMAX(T &a, const T &b) {  //aよりbが大きければaに代入
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chMIN(T &a, const T &b) {  //aよりbが小さければaに代入
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}

//
//
//

int main() {
    int n;
    cin >> n;
    int d[n];

    rep(i, n) {
        cin >> d[i];
    }

    sort(d, d + n, greater<int>());

    int cnt = 1;
    rep(i, n) {
        if (i == n - 1) {
            break;
        }
        if (d[i] > d[i + 1]) {
            cnt++;
        }
    }
    cout << cnt << endl;

}

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

using namespace std;

#define pb push_back
#define mp make_pair
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
typedef long long LL;
typedef pair<int, int> PII;

const int N = 100005;

int n;
int a[N];
vector<int> g[N];
int d[N];

void solve(int v) {
    if (d[v] != -1) {
        return;
    }
    int res = 0;
    for (int to : g[v]) if (a[to] < a[v]) {
        solve(to);
        if (d[to] == 0) {
            res = 1;
            break;
        }
    }
    d[v] = res;
}

int main() {
    //freopen("input.txt", "r", stdin);
    scanf("%d", &n);
    forn(i, n) scanf("%d", a + i);
    forn(i, n - 1) {
        int from, to;
        scanf("%d%d", &from, &to), --from, --to;
        g[from].pb(to);
        g[to].pb(from);
    }
    memset(d, -1, sizeof d);
    forn(i, n) {
        solve(i);
    }
    forn(i, n) if (d[i] == 1) {
        cout << i + 1 << ' ';
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 3072
n, t = map(int, input().split())
tr = [list(map(int, input().split())) for _ in range(n)]

fil_tr = list(filter(lambda x: x[1] <= t, tr))
if not fil_tr:
    print("TLE")
    exit()

sorted_tr = min(fil_tr, key=lambda x: x[0])
print(sorted_tr[0])


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const static ll INF = 1e9;
const static ll MAXN = 301;

int main(){
    long long a, b, c; cin >> a >> b >> c;
    long double ab = sqrt((long double) (a*b));
    if(a+b-c +2*ab<0) cout << "Yes" << endl;
    else cout << "No" << endl;
    //cout << ab <<  endl;
}

Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main(){

  int n;
  cin>>n;
  for(int cnt=0;cnt<n;cnt++){
    string com,s;
    cin>>com>>s;
  reverse(com.begin(),com.end());
  for(int i=0;i<com.size();i++){
    string s0;
    if(com[i]=='C'){
      for(int j=1;j<s.size();j++) s0.push_back(s[j]);
      s0+=s[0];
    }
    else  if(com[i]=='J'){
      s0+=s[s.size()-1];
      for(int j=0;j<s.size()-1;j++) s0.push_back(s[j]);
    }
    else  if(com[i]=='E'){
      int sLen=s.size();
      //cout<<sLen<<endl;
      if(sLen%2) sLen++;
      sLen/=2;
      for(int j=sLen;j<s.size();j++) s0.push_back(s[j]);
      if(s.size()%2) s0.push_back(s[s.size()/2]);
      for(int j=0;j<s.size()/2;j++) s0.push_back(s[j]);
    }
    else  if(com[i]=='A'){
     reverse(s.begin(),s.end());
     s0=s;
    }
    else  if(com[i]=='M'){
      for(int j=0;j<s.size();j++){
	if('0'<=s[j]&&s[j]<='8') s[j]++;
	else if(s[j]=='9') s[j]='0';
      }
      s0=s;
    }
    else  if(com[i]=='P'){
      for(int j=0;j<s.size();j++){
	if('1'<=s[j]&&s[j]<='9') s[j]--;
	else if(s[j]=='0') s[j]='9';
      }
      s0=s;
    }
    s=s0;
    //    cout<<com[i]<<" "<<s<<endl;
  }
  cout<<s<<endl;
  }
  return 0;
  
}

Measured memory_bytes: 2976
n = int(input())
l = list(map(int, input().split()))

dl = {}
du = {}

for i in range(n):
  v = l[i]
  if i%2 == 0:
    if v in dl:
      dl[v] += 1
    else:
      dl[v] = 1
  else:
    if v in du:
      du[v] += 1
    else:
      du[v] = 1

if max(dl, key=dl.get) != max(du, key=du.get):
  ans = n - max(dl.values()) - max(du.values())
else:
  vsl = list(dl.values())
  vsl.sort(reverse=True)
  vsu = list(du.values())
  vsu.sort(reverse=True)
  if len(vsl) == 1 or len(vsu) == 1:
    ans = n//2
  else:
    ans = min(n-vsu[0]-vsl[1], n-vsl[0]-vsu[1])
  
print(ans)
    
    

Measured memory_bytes: 17656
import sys


TEST_INPUT = [
    """
    5 7 5
    """,
    """
    4 4 4
    """,
    """
    4 9 6
    """,
    """
    3 3 4
    """
]
ANSWER = [
    "Yes",
    "No",
    "No",
    "Yes"
]


class InputHandler:

    def __init__(self, text_lines="", is_test=False):
        self.data = list(text_lines.split("\n"))
        self.index = 0
        self.is_test = is_test

    def input(self):
        if self.is_test:
            self.index += 1
            return self.data[self.index].strip()
        else:
            return sys.stdin.readline().rstrip()


def solve(a, b, c):
    if len({a, b, c}) == 2:
        return "Yes"
    else:
        return "No"


def input_and_solve(ih):
    a, b, c = map(int, ih.input().split())
    res = solve(a, b, c)
    return res


def main():
    ih = InputHandler()
    res = input_and_solve(ih)
    print(res)


def test():
    for test_input, ans in zip(TEST_INPUT, ANSWER):
        ih = InputHandler(test_input, True)
        res = input_and_solve(ih)
        assert str(res) == str(ans)


if __name__ == "__main__":
    test()
    main()


Measured memory_bytes: 3064
import re, datetime
pattern = r"(\d{4})/(\d{2})/(\d{2})"
res = re.search(pattern, input())
day = [int(i) for i in res.groups()]
default = datetime.datetime(year=2019, month=4, day=30)
time = datetime.datetime(year=day[0], month=day[1], day=day[2])
print("TBD" if default.timestamp() < time.timestamp() else "Heisei")

Measured memory_bytes: 3568
#include<iostream>
#include<vector>
#include<algorithm>
#include<math.h>
#include<string>
#include<map>
#include<array>

using namespace std;

int main(void) {
	unsigned long long N;
	cin >> N;
	unsigned long long ans = N * (N - 1) / 2;
	cout << ans;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	int N;
  	cin>>N;
    vector<int> a(N);
  	for(int i=0;i<N;i++){
      cin>>a[i];
    }
    int flag=0;
  	stack<int> s;
  	int count=1;
  	s.push(a[0]);
  	for(int i=1;i<N;i++){
  		
		  while(s.size() && a[i]<=s.top()){
		  	s.pop();
		  }
		  if(s.empty()){
		  	count++;
		  }
		  s.push(a[i]);
	}
	cout<<count<<endl;
	return 0;
}

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

struct Data{
  int f,a,t,x,y;
};

double length(int x,int x2,int y,int y2){
  
  return sqrt((x-x2)*(x-x2)+(y-y2)*(y-y2));
  
}
int main(){
  
  int N;
  
  cin >>N;
  
  Data data[N];
  
  for(int i=0 ; i < N ; i++){
    cin >>data[i].f>>data[i].a>>data[i].t>>data[i].x>>data[i].y;
  }
  
  double len_a=-1,len_b=-1,f_a=-1,f_b=-1;
  
  for(int i=0 ; i < N-1 ; i++){
    if(data[i].t == data[i+1].t && data[i].a != data[i+1].a){
      if(data[i].t == 0){
        if((len_a < length(data[i].x,data[i+1].x,data[i].y,data[i+1].y)) ||( len_a == length(data[i].x,data[i+1].x,data[i].y,data[i+1].y) && f_a*60 > data[i+1].f-data[i].f)){
          len_a=length(data[i].x,data[i+1].x,data[i].y,data[i+1].y);
          f_a=(double)(data[i+1].f-data[i].f)/60;
        }
      }else{
        if((len_b < length(data[i].x,data[i+1].x,data[i].y,data[i+1].y)) || ( len_b == length(data[i].x,data[i+1].x,data[i].y,data[i+1].y) && f_b*60 > data[i+1].f-data[i].f)){
          len_b=length(data[i].x,data[i+1].x,data[i].y,data[i+1].y);
          f_b=(double)(data[i+1].f-data[i].f)/60;
        }
      }
    }
  }
  
  
  if(len_a < 0){
    cout <<"-1"<<" "<<"-1"<<endl;
  }else{
    printf("%f %f\n",len_a,f_a);
  }
  
  if(len_b < 0){
    cout <<"-1"<<" "<<"-1"<<endl;
  }else{
    printf("%f %f\n",len_b,f_b);
  }
  
  return 0;
}

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

using namespace std;

vector<int> graf[100010];
int brVeza[100010];
int nemaVeze[100010];
int dp[100010];

int k=0;


void topoloskoSort(int x)
{
    for(int i=0;i<k;i++)
    {
        for(int j=0;j<graf[nemaVeze[i]].size();j++)
        {
            brVeza[graf[nemaVeze[i]][j]]--;
            if(brVeza[graf[nemaVeze[i]][j]]==0)nemaVeze[k++]=graf[nemaVeze[i]][j];
        }
    }
}


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n,m;
    cin>>n>>m;
    for(int i=0;i<m;i++)
    {
        int x,y;
        cin>>x>>y;
        graf[x].push_back(y);
        brVeza[y]++;
    }
    for(int i=1;i<=n;i++)
    {
        if(brVeza[i]==0){nemaVeze[k++]=i;}
    }
    topoloskoSort(nemaVeze[0]);
    dp[nemaVeze[0]]=0;
    int res=0;
    for(int i=0;i<k;i++)
    {
        for(int j=0;j<graf[nemaVeze[i]].size();j++)
        {
            int cvor=graf[nemaVeze[i]][j];
            dp[cvor]=max(dp[nemaVeze[i]]+1,dp[cvor]);
            res=max(res,dp[cvor]);
        }
    }
    cout<<res;

    return 0;
}


Measured memory_bytes: 6912
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int n,k=0;
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++)cin>>a[i];
    for(int i=0;i<n;i++){
        if(a[i]%2==0){
            if(a[i]%3==0||a[i]%5==0){
                
            }
            else{
               k=1;
            }
        }
        
    }
    if(k==1){
        cout<<"DENIED";
    }
    else{
        cout<<"APPROVED";
    }
}


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

#define GO 0
#define ROME 1
#define NA -1
#define END -2

int max6174(char *s);
int min6174(char *s);
void itoa4dig(char *s, int d);
int check6174(char *s);

int main(void){
  char n[10];
  int l, s, i, ni, c;

  while(1){
    scanf("%s", n);
    c = check6174(n);
    if(c == END){ break; }
    if(c == NA){ printf("NA\n"); continue; }
    if(c == ROME){ printf("0\n"); continue; }
    for(i = 1;;i++){
      ni = max6174(n) - min6174(n);
      if(ni == 6174){ break; }
      itoa4dig(n, ni);
      //printf("%s\n", n);
    }
    printf("%d\n", i);
  }

  return 0;
}


int max6174(char *s){
  char str[10];
  char tmp, max;
  int maxpoint, result, i, j;
  strcpy(str, s);
  for(i = 0; str[i]!='\0'; i++){
    maxpoint = i;
    max = str[i];
    for(j = i; str[j]!='\0'; j++){
      if(max < str[j]){
	max = str[j];
	maxpoint = j;
      }
    }
    tmp = str[i];
    str[i] = max;
    str[maxpoint] = tmp;
  }
  result = atoi(str);
  return result;
}


int min6174(char *s){
  char str[10];
  char tmp, min;
  int minpoint, result, i, j;
  strcpy(str, s);
  for(i = 0; str[i]!='\0'; i++){
    minpoint = i;
    min = str[i];
    for(j = i; str[j]!='\0'; j++){
      if(min > str[j]){
	min = str[j];
	minpoint = j;
      }
    }
    tmp = str[i];
    str[i] = min;
    str[minpoint] = tmp;
  }
  result = atoi(str);
  return result;
}


void itoa4dig(char *s, int d){
  s[0] = (d % 10000) / 1000 + '0';
  s[1] = (d % 1000) / 100 + '0';
  s[2] = (d % 100) / 10 + '0';
  s[3] = (d % 10) / 1 + '0';
  s[4] = '\0';
  return;
}

int check6174(char *s){
  if(atoi(s) == 0){ return END; }
  if(s[0] == s[1] && s[1] == s[2] && s[2] == s[3]){ return NA; }
  if(atoi(s) == 6174){ return ROME; }
  return GO;
}

Measured memory_bytes: 564
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <cassert>

using namespace std;
typedef long long LL;
template <typename F, typename S> std::ostream& operator<<(ostream& os, const pair<F,S>& p) {
    os << "(" << p.first << "," << p.second << ")"; return os; }
template <typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
    os << "["; for(const T& a: v){ os << a << ", "; } os << "]"; return os; }
template <typename K, typename V> ostream& operator<<(ostream& os, const map<K,V>& m) {
    os << "{"; for(const auto& p: m){ os << p.first <<":"<< p.second << ", "; } os << "}"; return os; }



int main(){
    string s, t;
    cin >> s >> t;
    LL cnt = 0;
    for(LL i = 0; i < 3; ++i){
        if(s[i] == t[i]) cnt += 1;
    }
    cout << cnt << endl;
    return 0;
}



Measured memory_bytes: 256
A, B = map(int,input().split())

if A == 1 and 13 >= B >= 2:
    print("Alice")
elif B == 1 and 13 >= A >= 2:
    print("Bob")
elif A > B:
    print("Alice")
elif B > A:
    print("Bob")
elif A == B:
    print("Draw")

Measured memory_bytes: 9176
import java.util.*;
import java.lang.*;
import java.io.*;

public class Main
{
	public static void main (String[] args) throws java.lang.Exception
	{
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		
		int n = in.nextInt();
		int[] v = new int[n];
		for(int i = 0; i < n; i++)
		{
			v[i] = in.nextInt();
		}
		
		int[] u = Arrays.copyOf(v, n);
		
		Arrays.sort(v);
		int cnt = 0;
		for(int i = 0; i < n; i++)
		{
			if(v[i] != u[i])
				cnt++;
		}
		
		if(cnt <= 2)
			out.println("YES");
		else
			out.println("NO");
		
		out.close();
	}
	
	static class InputReader
	{
		public BufferedReader reader;
		public StringTokenizer tokenizer;
		
		public InputReader(InputStream stream)
		{
			reader = new BufferedReader(new InputStreamReader(stream), 32768);
			tokenizer = null;
		}
		
		public String next()
		{
			while(tokenizer == null || !tokenizer.hasMoreTokens())
			{
				try
				{
					tokenizer = new StringTokenizer(reader.readLine());
				}
				catch(IOException e)
				{
					throw new RuntimeException(e);
				}
			}
			
			return tokenizer.nextToken();
		}
		
		public int nextInt()
		{
			return Integer.parseInt(next());
		}
		
		public long nextLong()
		{
			return Long.parseLong(next());
		}
	}
}

Measured memory_bytes: 21204
#include<stdio.h>
int main(void){
  int n,m,i,max=0;
  int num[10000];
  
  scanf("%d",&n);
  scanf("%d",&m);
  for(i=0;i<m;i++){
    scanf("%d",&num[i]);
    max+=num[i];
  }
  if(n>=max){
    printf("%d",n-max);
  }
  else{
    printf("%d",-1);
  }
  return 0;
}


Measured memory_bytes: 1768
import java.util.Scanner;
public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int a, b;
        String op;
        Boolean bl = true;
        while(bl){
            a = sc.nextInt();
            op = sc.next();
            b = sc.nextInt();
            switch (op) {
                case "?":
                bl = false;
                break;
                case "+":
                System.out.printf("%d%n",a+b);
                break;
                case "-":
                System.out.printf("%d%n",a-b);
                break;
                case "*":
                System.out.printf("%d%n",a*b);
                break;
                case "/":
                System.out.printf("%d%n",a/b);
                break;
                default:
                break;
            }
        }
        sc.close();
        
    }
}


Measured memory_bytes: 26520
# -*- coding: utf-8 -*-
n, k = map(int, input().split())
a = list(map(int, input().split()))
for j in range(k):
  b = [0] * (n + 1)
  for i in range(n):
    left_edge = max(0, i-a[i])
    right_edge = min(i + a[i] + 1, n)
    b[left_edge] += 1
    b[right_edge] -= 1
  for i in range(1, n+1):
    b[i] = b[i] + b[i-1]
  b.pop(n)
  if a == b:
    break
  a = b.copy()
print(' '.join(str(b[i]) for i in range(n)))

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

int main() {
  string s, t, u;
  cin >> s >> t;
  int a, b;
  scanf("%d %d", &a, &b);
  cin >> u;

  if (u == s)
    a--;
  else
    b--;

  printf("%d %d\n", a, b);

  return 0;
}

Measured memory_bytes: 256
io = STDIN
n,k=io.gets.split.map(&:to_i)
A=io.gets.split.map(&:to_i)
x = 0
39.downto(0) do |i|  #i bit pos  39,38,...0
  b = 1<<i   #bit pos onの数字を十進数
  next if x + b > k
  x+=b if A.count{|a|a[i]!=0} < n/2.0
end
puts A.inject(0){|s,a|s+=a^x}

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

int main(){
  int N;
  cin >> N >> S;
  int ans = 0,now = 0;
  for(int i=0;i<S.size();i++){
	if(S[i]=='I') now++;
    else now--;
    ans = max(ans,now);
  }
  cout << ans << endl;
}

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

using namespace std;

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

    int n, a_orig, b_orig, c_orig;
    cin >> n >> a_orig >> b_orig >> c_orig;

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

    int min_m = 8001;
    for (int i = 0; i < pow(4, n); ++i) {
        int a = a_orig;
        int b = b_orig;
        int c = c_orig;
        int m = 0;
        int num = i;
        // if (i == 937) {
        //     cout << "";
        // }
        for (int j = 0; j < n; ++j) {
            switch (num % 4) {
                case 0:
                    break;
                case 1:
                    a -= L[j];
                    m += 10;
                    break;
                case 2:
                    b -= L[j];
                    m += 10;
                    break;
                case 3:
                    c -= L[j];
                    m += 10;
                    break;
                default:
                    break;
            }
            num /= 4;
        }

        if (a == a_orig || b == b_orig || c == c_orig)
            continue;

        m += abs(a) + abs(b) + abs(c) - 30;
        min_m = min(min_m, m);
    }

    cout << min_m << '\n';
    
    return 0;
}


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

int main(){
  int A,B,C,D;
  cin >> A >> B >> C >> D;
  while(A>0 && C>0){
    C-=B;
    A-=D;
  }
  if(C<=0){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}

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

int main(){
  ll n,a,b,c;
  cin >> n >> a >> b >> c;
  vector<ll>l(8,0);
  for(int i=0; i<n; i++) cin >> l[i];
  vector<ll>ans(4);
  ll MIN = 1000000000;
  ll count=0;
  for(int p=0; p<4; p++){
    ans[p]+=l[0];
    if(p && l[0])count+=10;
    for(int q=0; q<4; q++){
      ans[q]+=l[1];
      if(q && l[1])count+=10;
      for(int r=0; r<4; r++){
        ans[r]+=l[2];
        if(r && l[2])count+=10;
        for(int s=0; s<4; s++){
          ans[s]+=l[3];
          if(s && l[3])count+=10;
          for(int t=0; t<4; t++){
            ans[t]+=l[4];
            if(t && l[4])count+=10;
            for(int u=0; u<4; u++){
              ans[u]+=l[5];
              if(u && l[5])count+=10;
              for(int v=0; v<4; v++){
                ans[v]+=l[6];
                if(v && l[6])count+=10;
                for(int w=0; w<4; w++){
                  ans[w]+=l[7];
                  if(w && l[7])count+=10;
                  
                  ll x = ans[1]-a;
                  if(x<0) x*=-1;
                  ll y = ans[2]-b;
                  if(y<0) y*=-1;
                  ll z = ans[3]-c;
                  if(z<0) z*=-1;
                  
                  if(ans[1] && ans[2] && ans[3]) MIN = min(MIN,count+x+y+z-30);
                  
                  ans[w]-=l[7];
                  if(w && l[7])count-=10;
         }
                ans[v]-=l[6];
                if(v && l[6])count-=10;
        }
              ans[u]-=l[5];
              if(u && l[5])count-=10;
       }
            ans[t]-=l[4];
            if(t && l[4])count-=10;
      }
          ans[s]-=l[3];
          if(s && l[3])count-=10;
     }
        ans[r]-=l[2];
        if(r && l[2])count-=10;
    }
      ans[q]-=l[1];
      if(q && l[1])count-=10;
   }
    ans[p]-=l[0];
    if(p && l[0])count-=10;
  }
  
  cout << MIN << endl;
  
}
  


Measured memory_bytes: 3588
import fractions
n=int(input())
a=list(map(int,input().split()))
g=a[0]
for i in range(1,n):
  g=g*a[i]//fractions.gcd(g,a[i])
sum=0
for i in range(n):
  sum+=g//a[i]
print(str(g/sum))
  

Measured memory_bytes: 64108
n, x = map(int, input().split())
ln = [0] * (n+1)
p = [0] * (n+1)
ln[0] = 1
p[0] = 1
for i in range(1,n+1):
    ln[i] = ln[i-1] * 2 + 3
    p[i] = p[i-1] * 2 + 1
# print(ln)
# print(p)
ans = 0
def Xmas(n,x):
    global ans
    if n == 0 or x == ln[n] or x == 1 or x == (ln[n]+1) // 2:
        if n == 0:
            return ans + 1
        elif x == 1:
            return ans
        elif x == ln[n]:
            return ans + p[n]
        elif x == ((ln[n]+1) // 2):
            return ans + p[n-1] + 1
    else:
        if x < ((ln[n] +1)// 2):
            return Xmas(n-1,x-1)
        else:
            ans += (p[n-1] + 1)
            return Xmas(n-1,x-(ln[n-1] + 2))
print(Xmas(n,x))


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

int main() {
   int a,b,c ;
   cin>>a>>b>>c ;
   if((a==b && a!=c)||(a==c&&a!=b)||(b==c&&a!=b))
   cout << "Yes" <<endl;
   else

  cout << "No" << endl;
}


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

#define rep(i,n) for (decay_t <decltype (n)> i = 0, i ## __len = (n); i < i ## __len; ++ i)
#define rep1(i,n) for (decay_t <decltype (n)> i = 1, i ## __len = (n); i <= i ## __len; ++ i)

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

  constexpr size_t plan_num = 3;
  constexpr size_t PLAN_A = 0;
  constexpr size_t PLAN_B = 1;
  constexpr size_t PLAN_C = 2;

  size_t n;
  cin >> n;

  using plan_t = tuple <int, int, int>;
  vector <plan_t> plans (1, plan_t {});

  rep1 (i, n)
  {
    int a, b, c;
    cin >> a >> b >> c;
    plans.emplace_back (a, b, c);
  }

  vector <vector <int>> happiness (n + 1, vector <int> (plan_num, 0));

  rep1 (i, n)
  {
    int a, b, c;
    tie (a, b, c) = plans [i];
    happiness [i] [PLAN_A] = max (happiness [i] [PLAN_A], happiness [i - 1] [PLAN_B] + a);
    happiness [i] [PLAN_A] = max (happiness [i] [PLAN_A], happiness [i - 1] [PLAN_C] + a);

    happiness [i] [PLAN_B] = max (happiness [i] [PLAN_B], happiness [i - 1] [PLAN_A] + b);
    happiness [i] [PLAN_B] = max (happiness [i] [PLAN_B], happiness [i - 1] [PLAN_C] + b);

    happiness [i] [PLAN_C] = max (happiness [i] [PLAN_C], happiness [i - 1] [PLAN_A] + c);
    happiness [i] [PLAN_C] = max (happiness [i] [PLAN_C], happiness [i - 1] [PLAN_B] + c);
  }

  auto ans = 0;
  rep (plan, plan_num)
  {
    ans = max (ans, happiness [n] [plan]);
  }
  cout << ans << endl;
}



Measured memory_bytes: 6900
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <numeric>
#include <map>
#include <string>
#include <vector>
#include <cmath>
#include <queue>
#include <algorithm>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<int, P> PP;
typedef pair<P,P> P2;
const int INF = 1 << 30;
const double EPS = 1E-9;

int main(){
	int b, r, g, c, s, t;
	while(cin >> b >> r >> g >> c >> s >> t && (b || r || g || c || s || t)){
		int money = 100;
		t -= (s + 5 * b + 3 * r);
		money += 15 * (b + r);
		money += (5 * b + 3 * r) * 13;
		money += 7 * g + 2 * c;
		money -= t * 3;
		cout << money << endl;
	}
	return 0;
}

Measured memory_bytes: 0
N = int(input())
src = [int(input()) for i in range(N)]
if all(a%10==0 for a in src):
    print(0)
    exit()
sm = sum(src)
if sm%10==0:
    for a in sorted(src):
        if a%10==0: continue
        print(sm-a)
        exit()
else:
    print(sm)


Measured memory_bytes: 2940
#include <bits/stdc++.h>
#include <iomanip>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define reps(i, s, n) for (int i = (s); i < (n); i++)
using namespace std;
using ll = long long;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
#define MOD 1000000007

int main(){
    int k;
    cin>>k;

    rep(i,k){
        cout<<"ACL";
    }
    return 0;
}

Measured memory_bytes: 3568
'use strict'
function Main(input) {
    input = input.split('\n');
  	let arrChar = input[1].split('');
  	let num = input[0];
  	let arr = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N',
              'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'];
	let changedArr = [];
	for(let i = 0; i < arrChar.length; i++) {
      	let changedNum = arr.indexOf(arrChar[i]) + Number(num)
    	let changedChar = arr[changedNum];
      	let overNum = arr[changedNum-26];
      	if(changedNum < 25) {
        	changedArr.push(changedChar);
        } else if(changedNum > 25) {
            changedArr.push(overNum);
        } else if (changedNum === 25) {
        	changedArr.push('Z');
        } 
    }
	console.log(changedArr.join(''))
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


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

int main() {
  int A, B;
  cin >> A >> B;
  
  int sum = 0;
  for(int i=0; i<2; i++) {
    sum += max(A,B);
    if(max(A,B)==A) --A;
    else --B;
  }
  
  cout << sum << endl;
}

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

#define MAX 100000

int N;
int a[MAX];

int main()
{
	cin >> N;
	for( int i = 0; i < N; i++ ) {
		cin >> a[i];
	}

	int ans = 0;
	int j = 0;
	for( int i = 0; i < N; i++ ) {
		j = a[j] - 1;
		if( j == 1 ) {
			ans = i + 1;
			break;
		}
	}

	if( ans ) {
		cout << ans << endl;
	}
	else {
		cout << -1 << endl;
	}

	return 0;
}


Measured memory_bytes: 640
#include<iostream>
#include<string>
#include<stack>
#include<vector>
#include<sstream>
#include<cstdio>

using namespace std;

int main(){
	
	string str;
	while(getline(cin,str)){
		
		stringstream sst;
		
		sst<<str;
		
		string tmp;
		stack<double> s;
		
		while(sst>>tmp){
			
			if(tmp=="*"){
				double b = s.top(); s.pop();
				double a = s.top(); s.pop();
				
				s.push(a*b);
			}else if(tmp=="/"){
				double b = s.top(); s.pop();
				double a = s.top(); s.pop();
				
				s.push(a/b);
			}else if(tmp=="+"){
				double b = s.top(); s.pop();
				double a = s.top(); s.pop();
				
				s.push(a+b);
			}else if(tmp=="-"){
				double b = s.top(); s.pop();
				double a = s.top(); s.pop();
				
				s.push(a-b);
			}else{
				double val;
				stringstream tmpsst;
				tmpsst<<tmp;
				tmpsst>>val;
				
				s.push(val);
			}
		}
		double val = s.top();
		printf("%.8lf\n",val);
	}
}

Measured memory_bytes: 1304
#include <iostream>
#include <string>
#include <cstdlib>
#include <vector>
#include <array>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#define _USE_MATH_DEFINES
#include <cmath>
#include <climits>
#include <cstdio>
#include <iomanip>
#include <utility>
#include <unordered_map>

using namespace std;
typedef long long int ll;

#define SP(x) setprecision((int)x)
#define SW(x) setw(x)    // 桁数指定
#define SF(c) setfill(c) // 埋め文字指定('0')
#define ALL(v) v.begin(), v.end()

int main(int argc, char const *argv[])
{
    ll n, m;
    cin >> n >> m;
    vector<ll> a(n);
    ll cnt = 0;
    ll sum = 0;
    for (ll i = 0; i < n; i++)
    {
        cin >> a[i];
        sum += a[i];
    }
    for (ll i = 0; i < n; i++)
    {
        if (a[i] * 4 * m < sum)
        {
        }
        else
            cnt++;
    }

    if (cnt < m)
    {
        cout << "No" << endl;
    }
    else
    {
        cout << "Yes" << endl;
    }
}

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

c = 0
for i in range(1, N):
    d = A[i] - A[i - 1]

    if d >= 0:
        continue
    else:
        c += abs(d)
        A[i] = A[i - 1]

print(c)


Measured memory_bytes: 32240
#include <fstream>
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <bitset>
#include <iomanip>

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

int main(int argc, const char * argv[]) {
    ll N, A, B;
    cin >> N >> A >> B;
    ll q = N / (A + B);
    ll r = N % (A + B);
    if (r <= A) {
        cout << A * q + r << endl;
    } else {
        cout << A * q + A << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cmath>
#include<map>
#include<iomanip>
#include<queue>
#include<stack>
#include<time.h>
#define rep(i,n)for(ll i=0;i<n;i++)
#define ll long long
#define ggr getchar();getchar();return 0;
#define prique priority_queue
#define inf 1000000007
#define double long double
using namespace std;
typedef pair<double, double>P;
bool prime(int n) {
	int cnt = 0;
	for (int i = 1; i <= sqrt(n); i++) {
		if (n % i == 0)cnt++;
	}
	if (cnt != 1)return false;
	else return n != 1;
}
ll gcd(ll x, ll y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
ll lcm(ll x, ll y) {
	return x * y / gcd(x, y);
}
ll mod_pow(ll x, ll n, ll mod) {
	ll bit = 1;
	while (n) {
		if (n & 1)bit = bit * x % mod;
		x = x * x % mod;
		n /= 2;
	}
	return bit;
}
ll C(ll a, ll b) {
	ll x = 1, y = 1;
	rep(i, b) {
		x = x * (a - i) % inf;
		y = y * (b - i) % inf;
	}
	rep(i, inf) {
		if (x == y * i % inf) {
			return i;
		}
	}
}
signed main() {
	string s, t;
	cin >> s >> t;
	ll memo = 0;
	rep(i, 3) {
		if (s[i] == t[i])memo++;
	}
	cout << memo << endl;
	ggr
}


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

#define fastIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
typedef long long ll ;
typedef long double ld ;

const ll MOD = 998244353, INF = 1E9 + 5 ;
const double PI = 2 * acos(0.0) ;
const long double EPS = 1.0E-14 ;

int arr[100005], dp[100005] ;
int n, k ;

int check(int pos)
{
    if (dp[pos] != INF) {
        return dp[pos] ;
    }
    else {
        for (int i = 1; i <= k; i++) {
            if (pos - i < 0)    break ;
            dp[pos] = min(dp[pos], check(pos - i) + abs(arr[pos] - arr[pos - i]) ) ;
        }
        return dp[pos] ;
    }
}

int main()
{
    int ans ;
    cin >> n >> k ;

    for (int i = 0; i < n; i++) {
        cin >> arr[i] ;
        dp[i] = INF ;
    }
    dp[0] = 0 ;
    ans = check(n - 1) ;
    cout << ans ;

    return 0 ;
}


Measured memory_bytes: 5760
#include<iostream>
#include<string>
#include<vector>
#include<numeric>
#include<math.h>
#include<algorithm>
#include<iomanip>
using namespace std;

int main() {

	int A;
	int B;
	cin >> A;
	cin >> B;

	int ans = 0;
	if (13 <= A) {
		ans = B;
	}
	else if (A <= 5) {
		ans = 0;
	}
	else {
		ans = B / 2;
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstdlib>
#include <cstdio>
#include <queue>
#include <stack>
#include <list>
#include <utility>
#include <vector>
#include <set>
#include <algorithm>
#include <cmath>
#include <climits>
#include <map>
#include <unordered_map>
#include <string.h>
#include<iomanip>
#include <iterator>

#define all(a) a.begin(),a.end()
#define VV(T) vector<vector< T > >
#define rep(i,N) for(int i = 0; i <N; i++)
#define repsg(i,s,g) for(int i = s; i <g; i++)
#define name(x) #x
using namespace std;


const int INF = INT_MAX;
const long long INFL = (1LL<<40);
const int MOD = pow(10,9)+7;
int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};

typedef long long ll,LL;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;
typedef pair<int,int> pii;
typedef pair<LL, LL> pLL;


// vector入力
template<typename T>
istream& operator >> (istream& is, vector<T>& vec){
    for(T& x: vec) is >> x;
    return is;
}
// vector出力
template<typename T>
ostream& operator << (ostream& os, vector<T>& vec){
    for(int i=0; i<vec.size(); i++){
        os << vec[i] << ( i+1 == vec.size() ? "" : " " );
    }
    return os;
}




const ll MAX_SIZE = 16;
ll memo[(1<<MAX_SIZE) + 1];
ll sum[(1<<MAX_SIZE) + 1];
int N;
VV(int) p;


void solve(){
    
    repsg(mask,1,1<<N) {
        sum[mask] = 0;
        rep(i,N) {
            if (mask & (1<<i)){
                repsg(j,i+1,N){
                    if(mask & (1<<j)) {
                        sum[mask]+=p[i][j];
                    }
                }
            }
        }
    }
            
    
    repsg(mask,1,1<<N){
        memo[mask] = sum[mask];
        int submask = (1<<N)-1 - mask;
        
        for(auto i = (submask + 1)&mask; i<mask; i = (i + submask + 1)&mask){
            
            memo[mask] = max(memo[mask],memo[i] + memo[i^mask]);
            
        }
        
    }
    cout << memo[(1<<N) -1] << endl;
}
int main() {
    
    cin >> N;
    p.resize(N);
    for(auto i = 0; i<N; i++){
        p[i].resize(N);
        for(auto j = 0; j<N; j++){
            cin >> p[i][j];
        }
    }
    
    
    
    solve();
    
    return 0;
}











Measured memory_bytes: 1280
#include "bits/stdc++.h"
using namespace std;

int main(void) {
	string s;
	long long k;
	cin >> s >> k;
	
	long long cnt = 0;
	char ans = '1';

	for(int i=0;i<s.size();i++) {
		if(s[i] != '1') {
			if(cnt < k) ans = s[i];
			break;
		}
		else {
			cnt++;
		}
	}


	cout << ans << endl;
}


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

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

#define INF 100000000

int main() {
  int N, R;
  cin >> N >> R;
  if(10 <= N){
    cout << R << endl;
  }
  else{
    int Rate = R + 100 * (10 - N);
    cout << Rate << endl;
  }

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
typedef long long int ll;
using namespace std;

char a[1005][1005];
ll dp[1005][1005];
ll h,w;

ll go(ll m,ll n)
{
	if (m<=0||n<=0||m>h||n>w)
	return 0;
	else if (m==h and n==w)
	return 1;
	else if (dp[m][n]!=-1)
	return dp[m][n];
	else
	{
		ll x;
		if (a[m][n]=='#')
		x=0;
		else
		x=(go(m+1,n)+go(m,n+1))%1000000007;
		dp[m][n]=x%1000000007;
		return x%1000000007;
	}
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    cin>>h>>w;
   for (int i=1;i<=h;i++)
   for (int j=1;j<=w;j++)
   cin>>a[i][j];
   memset(dp,-1,sizeof(dp));
   cout<<go(1,1)<<endl;

}


Measured memory_bytes: 9216
def main():
    n = int(input())
    s = input()
    if n % 2 == 0:
        s1 = s[:(n//2)]
        s2 = s[n//2:]
        if s1 == s2:
            print("Yes")
        else:
            print("No")
    else:
        print("No")



if __name__ == "__main__":
    main()


Measured memory_bytes: 3060
#include <iostream>
using namespace std;
 
typedef string::iterator S;
 
struct Node{
    char id;
    Node* prev;
    Node* next;
};
 
int main(){
    int n,i;
    cin>>n;
    while(n--){
        string expr;
        cin>>expr;
        Node vs[26];
        for(i=0;i<26;i++){
            vs[i].id=0;
            vs[i].prev=NULL;
            vs[i].next=NULL;
        }
        Node* vp = vs;
        Node* fr = vp+1;
        Node* head = vp;
        S s = expr.begin();
        while( true ){
            vp->id = *s;
            s++;
            if( s == expr.end() ) break;
            if( *s == '-' ){
                if( vp->next == NULL ){
                    vp->next = fr;
                    (vp->next)->prev = vp;
                    fr++;
                }
                vp = vp->next;
            }else{
                if( vp->prev == NULL ){
                    vp->prev = fr;
                    (vp->prev)->next = vp;
                    fr++;
                    head = vp->prev;
                }
                vp = vp->prev;
            }
            s += 2;
        }
        while( head ){
            cout << head->id;
            head = head->next;
        }
        cout << endl;
    }
    return 0;
}

Measured memory_bytes: 3148
L,R = map(int,input().split(' '))
if R-L>=2019:
    print(0)
else:
    f = True
    for i in range(L,R+1):
        t = i % 2019
        if t==0:
            f = False
            break
    if f:
        ans = 2019
        for i in range(L,R+1):
            for j in range(i+1,R+1):
                ans = min(ans,i*j%2019)
                if ans==0:
                    break
        print(ans)
    else:
        print(0)

Measured memory_bytes: 3064
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
#include<list>
#include<set>
#include<string>
using namespace std;
int gcd(int a, int b) {
	int c = a % b;
	while (c != 0) {
		a = b;
		b = c;
		c = a % b;
	}
	return b;
}
struct UnionFind {
	vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

	UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
		for (int i = 0; i < N; i++) par[i] = i;
	}

	int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
		if (par[x] == x) return x;
		return par[x] = root(par[x]);
	}

	void unite(int x, int y) { // xとyの木を併合
		int rx = root(x); //xの根をrx
		int ry = root(y); //yの根をry
		if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
		par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
	}

	bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
		int rx = root(x);
		int ry = root(y);
		return rx == ry;
	}
};
typedef long long ll;

ll M = 1000000007;

vector<ll> fac(300001); //n!(mod M)
vector<ll> ifac(300001); //k!^{M-2} (mod M)

ll mpow(ll x, ll n) {
	ll ans = 1;
	while (n != 0) {
		if (n & 1) ans = ans * x % M;
		x = x * x % M;
		n = n >> 1;
	}
	return ans;
}
ll comb(ll a, ll b) {
	if (a == 0 && b == 0)return 1;
	if (a < b || a < 0)return 0;
	ll tmp = ifac[a - b] * ifac[b] % M;
	return tmp * fac[a] % M;
}
// mod. m での a の逆元 a^{-1} を計算する
long long modinv(long long a) {
	long long b = M, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= M;
	if (u < 0) u += M;
	return u;
}
vector<vector<ll>> mul(vector<vector<ll>> a, vector<vector<ll>> b, int n) {
	int i, j, k, t;
	vector<vector<ll>> c(n);
	for (i = 0; i < n; i++) {
		for (j = 0; j < n; j++) {
			t = 0;
			for (k = 0; k < n; k++)
				t = (t + a[i][k] * b[k][j] % M) % M;
			c[i].push_back(t);
		}
	}
	return c;
}

template< typename Monoid >
struct SegmentTree {

	int sz;
	vector< Monoid > seg;

	const Monoid M1;

	SegmentTree(int n, const Monoid &M1) : M1(M1) {
		sz = 1;
		while (sz < n) sz <<= 1;
		seg.assign(2 * sz, M1);
	}

	void set(int k, const Monoid &x) {
		seg[k + sz] = x;
	}

	void build() {
		for (int k = sz - 1; k > 0; k--) {
			seg[k] = f(seg[2 * k + 0], seg[2 * k + 1]);
		}
	}

	void update(int k, const Monoid &x) {
		k += sz;
		seg[k] = x;
		while (k >>= 1) {
			seg[k] = f(seg[2 * k + 0], seg[2 * k + 1]);
		}
	}

	Monoid query(int a, int b) {
		Monoid L = M1, R = M1;
		for (a += sz, b += sz; a < b; a >>= 1, b >>= 1) {
			if (a & 1) L = f(L, seg[a++]);
			if (b & 1) R = f(seg[--b], R);
		}
		return f(L, R);
	}

	Monoid value(const int &k) const {
		return seg[k + sz];
	}

	Monoid f(Monoid a, Monoid b) {
		return a + b;
	}
};

int main() {
	int n, i, ci, d, w[10],k,flag;
	cin >> n >> k;
	for (i = 0; i < 10; i++)
		w[i] = 0;
	for (i = 0; i < k; i++) {
		cin >> d;
		w[d]++;
	}
	for (i = n; 1; i++) {
		ci = i;
		flag = 1;
		while (ci > 0) {
			if (w[ci % 10] == 1) {
				flag--;
				break;
			}
			ci /= 10;
		}
		if (flag) {
			cout << i << endl;
			return 0;
		}
	}
}

Measured memory_bytes: 4992
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<climits>//long long型の最大値(LLONG_MAX)など
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//イテレータあるけど順序保持しないmap
#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列

using namespace std;
typedef long long ll;

int main() {
    ll A[3][3];
    for(ll i=0;i<3;i++){
        for(ll j=0;j<3;j++){
            cin >> A[i][j];
        }
    }
    ll N;
    cin >> N;

    for(ll k=0;k<N;k++){
        ll tmp;
        cin >> tmp;
        for(ll i=0;i<3;i++){
            for(ll j=0;j<3;j++){
                if(tmp == A[i][j]){
                    A[i][j]=-1;
                }
            }

        }
    }

    if(A[0][0] == -1 && A[0][1] == -1 && A[0][2] == -1){
        cout << "Yes" << endl;
    }else if(A[1][0] == -1 && A[1][1] == -1 && A[1][2] == -1){
        cout << "Yes" << endl;
    }else if(A[2][0] == -1 && A[2][1] == -1 && A[2][2] == -1){
        cout << "Yes" << endl;
    }else if(A[0][0] == -1 && A[1][0] == -1 && A[2][0] == -1){
        cout << "Yes" << endl;
    }else if(A[0][1] == -1 && A[1][1] == -1 && A[2][1] == -1){
        cout << "Yes" << endl;
    }else if(A[0][2] == -1 && A[1][2] == -1 && A[2][2] == -1){
        cout << "Yes" << endl;
    }else if(A[0][0] == -1 && A[1][1] == -1 && A[2][2] == -1){
        cout << "Yes" << endl;
    }else if(A[0][2] == -1 && A[1][1] == -1 && A[2][0] == -1){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <bitset>
#include <string>
#include <cstdio>
#include <math.h>
using namespace std;

const long long int INF = 1000000007;

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

    int N = s.size();
    int M = t.size();
    int start = -1;
    bool include = false;

    for (int i = 0; i <= N - M; i++)
    {
        include = true;

        for (int j = 0; j < M; j++)
        {
            if (s[i + j] == t[j] || s[i + j] == '?')
            {
                continue;
            }
            else
            {
                include = false;
                break;
            }
        }

        if (include)
        {
            start = i;
        }
    }

    if (start == -1)
    {
        cout << "UNRESTORABLE" << endl;
        return 0;
    }

    // cout << start << endl;
    for (int i = 0; i < M; i++)
    {
        s[start + i] = t[i];
    }

    for (int i = 0; i < N; i++)
    {
        if (s[i] == '?')
        {
            s[i] = 'a';
        }
    }
    
    cout << s << endl;
}

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

using namespace std;

int main(){
	int A, B; cin >> A >> B;
	
	if((A + B) % 2 == 0){
		cout << (A + B) / 2 << endl;
	}
	else{
		cout << "IMPOSSIBLE" << endl;
	}
	return 0;
}

Measured memory_bytes: 256