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

#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

typedef long long LL;

const int INF = 0x3f3f3f3f;


int main(void) {
    std::ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    int h, n;
    cin >> h >> n;
    int a[n], b[n];
    for (int i = 0; i < n; ++i) {
        cin >> a[i] >> b[i];
    }
    int dp[h+5], ind;
    fill_n(dp, h+5, INF);
    dp[h] = 0;
    for (int i = h; i > 0; --i) {
        for (int j = 0; j < n; ++j) {
            ind = i-a[j];
            if (i-a[j] < 0) {
                ind = 0;
            }
            //cout << dp[ind] << " " << dp[i] << " " << a[j] << " " << b[j] << endl;
            dp[ind] = min(dp[ind], dp[i]+b[j]);
        }
    }
    cout << dp[0] << endl;

    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#define REP(i,n) for(int i=0;i<(n);++i)
#define MIN(a,b) ((a)<(b)?(a):(b))
#define MAX(a,b) ((a)>(b)?(a):(b))
using namespace std;
 
int main(){
  int N, M;
  cin >> N >> M;
  int ret = N * 100 + M * 1800;
  ret <<= M;
  cout << ret << endl;
}

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

using namespace std;
using ll = long long;

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

  ll x;
  cin >> x;

  // 約数
  vector<ll> d;
  for (ll i = 1; i * i <= x; i++) {
    if (x % i == 0) {
      d.push_back(i);
      d.push_back(x / i);
    }
  }

  auto f = [](ll a, ll b) {
    return a * a * a * a + a * a * a * b + a * a * b * b + a * b * b * b +
           b * b * b * b;
  };

  for (auto dd : d) {
    ll xx = x / dd;
    for (ll a = -1000; a <= 1000; a++) {
      ll b = a - dd;
      if (f(a, b) == xx) {
        cout << a << " " << b << endl;
        return 0;
      }
    }
  }

  return 0;
}


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

using namespace std;

typedef long long int ll;

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

  ll n;
  cin >> n;
  vector < vector < ll > > d(n + 1, vector < ll > (n + 1));
  for(int i = 1; i <= n; i++){
    for(int j = 1; j <= n; j++) cin >> d[i][j];
  }

  vector < vector < ll > > td = d;

  for(int k = n; k >= 1; k--){
    for(int i = 1; i <= n; i++){
      for(int j = 1; j <= n; j++){
        if(d[i][j] == d[i][k] + d[k][j] && i != k && j != k && i != j){
          d[i][j] = 1e17;
        }
      }
    }
  }

  ll ans = 0;
  for(int i = 1; i <= n; i++){
    for(int j = 1; j <= n; j++){
      if(d[i][j] != 1e17) ans += d[i][j];
    }
  }

  for(int k = 1; k <= n; k++){
    for(int i = 1; i <= n; i++){
      for(int j = 1; j <= n; j++){
        d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
      }
    }
  }

  bool ok = true;
  for(int i = 1; i <= n; i++){
    for(int j = 1; j <= n; j++){
      if(d[i][j] != td[i][j]){
        ok = false;
      }
    }
  }

  ans /= 2;
  if(ok) cout << ans << '\n';
  else cout << -1 << '\n';
}


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

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

  if(r < 1200){
      cout << "ABC";
  }
  else if(r < 2800 && r >= 1200){
      cout << "ARC";
  }
  else if(r >= 2800){
      cout << "AGC";
  }
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define pii pair<int,int>
using namespace std;

const int N = 1e5+10;
int a[N];
int main(){
    string s1,s2;
    int cnt1,cnt2;
    cin >> s1 >> s2 >> cnt1 >> cnt2;
    string t;
    cin >> t;
    if(t == s1)cnt1--;
    if(t==s2)  cnt2--;
    cout << cnt1 << ' ' << cnt2<<'\n';




    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<long long> vll;
typedef vector<pair<int,int>> vp;
typedef pair<int,int> pii;
#define INF (int)(1e9)
#define MAXX 1.1529215e+18
#define inf 999999
#define EPS (1e-7)
#define rep(i,n) for(int i=0; i<(int)(n);i++)
#define REP(i,n) for(int i=1;i<=(int)(n);i++)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)
#define ALL(a)  a.begin(),a.end()
#define RALL(a) a.begin(),a.end(),greater<int>()
#define ROT(a) a.begin(),a.begin()+1,a.end()
#define RROT(a) a.begin(),a.end()-1,a.end()
#define PB push_back
#define MP make_pair
#define PI acos(-1.0)
#define sz(a) a.size()
const ll MOD = 1e9+7;
const int MAX = 10000000;
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }
//cout << 'H' << endl;
//next_permutation(ALL(p));
//typedef priority_queue<int> pque;//これは大きい順
//typedef priority_queue<int, vector<int>, greater<int>> pque;//これは小さい順
//factorizeは、素因数分解用の関数

int main(){
	int n;
  cin >> n;
  vector<int> v(n);
  vector<int> c(n);
  rep(i, n) cin >> v[i];
  int sum = 0;
  rep(i, n) {
    cin >> c[i];
    sum += c[i];
  }

  int dp[n+5][sum+5];
  rep(i,sum+1){
    dp[0][i] = 0;
  }

  rep(i,n) rep(j,sum+1){
    if (j >= c[i]){
      dp[i+1][j] = max(dp[i][j-c[i]]+v[i], dp[i][j]);
    }else{
      dp[i+1][j] = dp[i][j];
    }
  }
  int max = 0;
  rep(i,sum+1){
    int x = dp[n][i] - i;
    chmax(max, x);
  }
  cout << max << endl;

  return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <limits>
#include <boost/range/irange.hpp>
#include <boost/range/adaptors.hpp>

using namespace std;
using namespace boost;
using uint = unsigned int;
using ll = long long int;
using ull = unsigned long long int;

int main() {
    uint a , b;
    cin >> a >> b;
    uint x;
    x = (a + b) / 2 + (a + b) % 2;
    cout << x;


    return 0;
}

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

int main(){
    int n,k,rta; cin>>n>>k;
    int arr[k*2];

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

    rta=abs(arr[0]-arr[k-1]);
    for(int i=1; i<=(k*2)-k; i++){
        rta=min(rta, abs(arr[i]-arr[i+(k-1)]));
    }
    cout<<rta<<endl;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string str;
  int length,point=1;
  cin >> str;
  length = str.size()-1;
  for(int i=0;i<length/2;i++){
    if(str.at(i)!=str.at(length/2+1+i)) break;
    else if(i==length/2-1) point--;
  }
  if(point==0) {
    cout << "Yes" << endl;
  }else {
    cout << "No" << endl;
  }
}

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

typedef unsigned long long ll;

using namespace std;

int main(){
    ll a,b,x;
    cin >> a >> b >> x;
    ll ans;
    if(a == 0)
        ans = b/x+1;
    
    else
        ans = b/x - (a-1)/x;
    
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
const int INF = 1e9;
const ll LINF = 1e18;
const int MOD = 1e9 + 7;
using namespace std;

int main() {
  ll n, m;
  cin >> n >> m;
  ll ans;
  if (n == 1 && m == 1)
    ans = 1;
  else if (n == 1)
    ans = m - 2;
  else if (m == 1)
    ans = n - 2;
  else
    ans = (n - 2) * (m - 2);
  cout << ans << endl;
}

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

#define REP(i, x, n) for (int i = x; i < (int)(n); i++)
#define rep(i, n) REP (i, 0, n)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x.size())
#define popcount(x) __builtin_popcount(x)
#define popcountll(x) __builtin_popcountll(x)
#define uniq(x) x.erase(unique(x.begin(), x.end()), x.end())
#define F first
#define S second
#define mp make_pair
#define eb emplace_back

using namespace std;

typedef long long ll;

// const int INF = 1 << 30;
// const ll INF = 1LL << 60;
// const int MOD = 1000000007;

int main() {
  int N, M, C;
  cin >> N >> M >> C;
  vector<int> B(M);
  rep (i, M) cin >> B[i];
  int ans = 0;
  rep (i, N) {
    int tmp = C;
    rep (j, M) {
      int a;
      cin >> a;
      tmp += a * B[j];
    }
    if (tmp > 0) ans++;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
//author 16301122
using namespace std;

int main()
{
    int p,q;
    cin>>p;
    cin>>q;
    int r=0;
    int s=10;
    if(p<q){
    cout <<r<<endl;
    }
    else{
       cout<<s<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
class Stack(list):
    def __init__(self):
        self.length = 0
    def __len__(self):
        return self.length

    def push(self,x):
        self.insert(len(self),x)
        self.length += 1
    def pop(self):
        try:
            if(len(self)==0):
                raise NameError("stack is empty")
            tmp = self[len(self)-1]
            self.length -= 1
            return tmp
        except:
            print("stack is empty!!!!")
            return '#'

data = Stack()
s = input()
x = s.split()

for i in x:
    if i == '+':
        a = data.pop()
        b = data.pop()
        data.push(b+a)

    elif i == '-':
        a = data.pop()
        b = data.pop()
        data.push(b-a)


    elif i == '*':
        a = data.pop()
        b = data.pop()
        data.push(b*a)
  
    else:
        data.push(int(i))
print(data.pop())

Measured memory_bytes: 7668
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        C solver = new C();
        solver.solve(1, in, out);
        out.close();
    }

    static class C {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            // 入力
            int h = Integer.parseInt(in.next());
            int w = Integer.parseInt(in.next());
            int k = Integer.parseInt(in.next());
            char[][] c = new char[h][w];
            for (int i = 0; i < h; i++) {
                c[i] = in.next().toCharArray();
            }
            int ans = 0;

            for (int bith = 0; bith < (1 << h); ++bith) {
                for (int bitw = 0; bitw < (1 << w); ++bitw) {

                    int black = 0;
                    for (int i = 0; i < h; i++) {
                        if ((bith >> i) % 2 == 1) continue;
                        for (int j = 0; j < w; j++) {
                            if ((bitw >> j) % 2 == 1) continue;
                            if (c[i][j] == '#') black++;
                        }
                    }

                    if (black == k) ans++;
                }
            }

            // 出力
            out.println(ans);

        }

    }
}



Measured memory_bytes: 36444
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n,m,x;
    cin>>n>>m>>x;
    int a=0,b=0;
    for(int i=0;i<m;++i)
    {
        int cnt;
        cin>>cnt;
        if(cnt<x)
            a++;
        else
            b++;
    }
    cout<<min(a,b);
	return 0;
}

Measured memory_bytes: 256
n = int(input())
list_w = [input() for s in range(0, n)]
for i in range(0, n):
    if i == 0 or (list_w[i - 1][-1] == list_w[i][0]) and list_w[i] not in list_w[:i]:
        continue
    else:
        print("No")
        exit()
print("Yes")

Measured memory_bytes: 9072
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<climits>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
#include<numeric>
#include<map>
#include<set>
#include<bitset>
using namespace std;
#define REP(i,m,n) for(int i = m; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a)  (a).rbegin(),(a).rend()
#define PI 3.14159265359
typedef long long LL;

template<class T> inline void chmax(T& a, T b) { if (a < b) { a = b; } }
template<class T> inline void chmin(T& a, T b) { if (a > b) { a = b; } }
template<class T> void print_vector(vector<T> vec) {
	cout << "[ ";
	for (int i = 0; i < vec.size(); i++) {
		cout << vec[i] << " ";
	}
	cout << "]" << endl;
}
template<class T> void print_pair_vector(vector<pair<T, T> > vec) {
	cout << "[ ";
	for (int i = 0; i < vec.size(); i++) {
		cout << "(" << vec[i].first << "," << vec[i].second << ") ";
	}
	cout << "]" << endl;
}

const int INF = 1 << 30;

int main(void) {
	int X, t;
	cin >> X >> t;
	cout << max(X - t, 0) << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i,s,e) for(int i=(s);i<(e);i++)
#define REP(i,n) FOR(i,0,n)
#define all(v) (v).begin(),(v).end()
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
using namespace std;
typedef long long LL;
typedef pair<int, int> P;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s, t;
    cin >> s >> t;
    bool f = false;
    REP(i, s.size()){
        bool f2 = true;
        REP(j, s.size()){
            if(s[j] != t[(i+j)%s.size()]){
                f2 = false;
                break;
            }
        }
        if(f2){
            f = true;
            break;
        }
    }
    cout << (f ? "Yes" : "No") << endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define    For(i,n) for(int i=0;i<n;i++)
#define    fors(i,s) for(int i=0;i<s.size();i++)
#define    forn(i,n) for(int i=1;i<=n;i++)
#define    nl     "\n"
#define    test   int t;cin>>t;for(int l=0;l<t;l++)
#define    End    return 0
#define    gt     greater<int>()
#define    ll     long long int

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

    //test
    {
        int c=0,mx=0;
        string s;
        cin>>s;
        fors(i,s){
            if(s[i]=='R')c++;
            else c=0;
            mx=max(mx,c);
        }
        cout<<mx;        
    }
}


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

using namespace std;

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

using ll = long long;

const char sp = ' ';
const char cmm = ',';
const int MOD = 1e9+7;
const int INF = 1e9;
const ll LINF = 1e18;

ll mod(ll a, ll b){return (a%b+b)%b;}
ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b){return a*b/gcd(a,b);}
void Yes(){cout << "Yes" << endl;}
void No(){cout << "No" << endl;}
void Judge(bool b){b?Yes():No();}
void YES(){cout << "YES" << endl;}
void NO(){cout << "NO" << endl;}
void JUDGE(bool b){b?YES():NO();}
ll powMod(ll b, ll e, ll m){ll r=1;while(e>0){if(e&1)r=(r%m)*(b%m)%m;b=(b%m)*(b%m)%m;e>>=1;}return r;}
double distance(ll x1, ll y1, ll x2, ll y2){return sqrt((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2));}

template<typename T>
void ppp(T n){cout << n << endl;}
template<typename T1, typename T2> ostream& operator<<(ostream& s, const pair<T1, T2>& p) {return s << "(" << p.first << ", " << p.second << ")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& v) {
	int len = v.size();
    s << '[';
	for (int i = 0; i < len; ++i) {
		s << v[i]; if (i < len-1) s << ", ";
	}
    s << ']';
	return s;
}

string nchar(char c, int n){
    string s = "";
    rep(i, n){
        s.push_back(c);
    }

    return s;
}
vector<string> grid(100, nchar('.', 100));
int main(){

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

    int a, b;
	cin >> a >> b;

	rep(i, 50){
	    grid[i] = nchar('#', 100);
	}

	int cnt = 0;
	rep(i, 100){
	    rep(j, 100){
	        if(cnt >= a-1) break;
			if(i%2 == 0 and j%2 == 0) {
				grid[i][j] = '.';
				++cnt;
			}
	    }
	}

	cnt = 0;
	for(int i = 99; i >= 50; --i){
		rep(j, 100){
		    if(cnt >= b-1) break;
			if(i%2 == 0 and j%2 == 0){
				grid[i][j] = '#';
				++cnt;
			}
		}
	}
	ppp("100 100");
	rep(i, 100){
	    ppp(grid[i]);
	}

    return 0;
}


Measured memory_bytes: 256
/*
 * 2018 年 1 月某日、高木さんは書類を書いています。書類には、その日の日付を yyyy/mm/dd という形式で書き込む欄があります。例えば、2018 年 1 月 23 日は 2018/01/23 となります。
 * 
 * 書類を書き終えたあと、高木さんは日付欄の先頭に誤って 2017 と書いてしまっていたことに気がつきました。
 * 高木さんが日付欄に書いた文字列 S を入力すると、S の先頭の 4 文字を 2018 に修正して出力するプログラムを書いてください。
 */

import java.util.*;
	public class Main{
        public static void main(String[] args){
            Scanner sc = new Scanner(System.in);
            //入力
            String s = sc.next();
            
            //出力
            System.out.println("2018/01/" + s.substring(8, 10));
            sc.close();
        }
    }
	

Measured memory_bytes: 21844
import numpy as np

N, x = list(map(int, input().split()))
a = np.asarray(list(map(int, input().split())))
a = np.sort(a)
s = 0
for i in range(1, N):
    if np.sum(a[:i]) <= x:
        s += 1
if np.sum(a) == x:
    s += 1
print(s)

Measured memory_bytes: 21656
/**
 * ????????????
?????? n ?????°??? A ??¨??´??° m ???????????????A ???????´?????????????????????????????´?????¶???????????????? m
???????????????????????????????????????????????°????????????????????????????????????A
??????????´???????????????????????????¨?????§????????????

??°??? A ??????????????????????????§???????????¨?????? q ?????? mi ????????????????????§???????????????????????????
"yes" ????????? "no" ??¨???????????????????????????

??\???
???????????? n??????????????? A ?????¨??? n ????????´??°??????????????? q??????????????? q ????????´??°
mi????????????????????????

??????
????????????????????? A ???????´?????¶???????????????? mi ??????????????¨?????§????????° yes
??¨?????§??????????????° no ??¨???????????????????????????

??¶?´?
n???20
q???200
1???A???????´????2,000
1???mi???2,000
??\?????? 1
5
1 5 7 10 21
4
2 4 17 8
????????? 1
no
no
yes
yes
 */

#include <iostream>
#include <sstream>
#include <vector>

bool solve(const std::vector<unsigned short> &A, unsigned short i,
           unsigned short mi) {
  const unsigned short n = A.size();
  if (mi == 0) {
    return true;
  }
  if (i >= n) {
    return false;
  }
  bool Result = solve(A, i + 1, mi) || solve(A, i + 1, mi - A[i]);
  return Result;
}

int main(int argc, char const *argv[]) {
  std::string Param;
  std::istringstream Stream;
  unsigned short n = 0;
  unsigned short q = 0;
  std::vector<unsigned short> A;
  std::vector<unsigned short> m;

  getline(std::cin, Param);
  Stream.str(Param);
  Stream >> n;
  Stream.clear();

  getline(std::cin, Param);
  Stream.str(Param);
  for (size_t i = 0; i < n; i++) {
    unsigned short Ai = 0;
    Stream >> Ai;
    A.push_back(Ai);
  }
  Stream.clear();

  getline(std::cin, Param);
  Stream.str(Param);
  Stream >> q;
  Stream.clear();

  getline(std::cin, Param);
  Stream.str(Param);
  for (size_t i = 0; i < q; i++) {
    unsigned short mi = 0;
    Stream >> mi;
    m.push_back(mi);
  }
  Stream.clear();

  bool Result;

  for (const auto &mi : m) {
    Result = solve(A, 0, mi);
    if (Result) {
      std::cout << "yes" << std::endl;
    } else {
      std::cout << "no" << std::endl;
    }
  }

  return 0;
}

Measured memory_bytes: 3184
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
using namespace std;

string X;

int main() {
  cin >> X;
  int c = 0;
  int x = X.length();
  for (int i=X.length()-1; i>=0; i--) {
    if (X[i] == 'T') c++;
    if (X[i] == 'S') {
      if (c > 0) {
        x -= 2;
        c -= 1;
      }
    }
  }
  cout << x << "\n";
  return 0;
}


Measured memory_bytes: 1152
import sys
import random
import numpy as np
random.seed(42)
TYPE_NUM = 26
WEIGHT1 = 16
WEIGHT2 = 4
WEIGHT3 = 1

def resolve():

    inp = sys.stdin.readlines()
    D = int(inp[0])
    c = np.array(list(map(int, inp[1].split(' '))))
    s = []
    last = np.zeros(TYPE_NUM, dtype=int)
    types = []

    for i in range(2, len(inp)):
        s.append(list(map(int, inp[i].split(' '))))
    s = np.array(s, dtype=int)

    for d in range(D):
        temp_delta_satis = np.zeros([TYPE_NUM, TYPE_NUM, TYPE_NUM], dtype=int)
        for idx in range(TYPE_NUM):
            val = s[d, idx]
            org = last[idx]
            last[idx] = d+1
            temp_delta_satis[:, :, idx] = (np.sum(-c*(d+1-last)) + val)*WEIGHT1
            if D > d+1:
                for idx2 in range(TYPE_NUM):
                    rand = random.random()
                    if rand > 0.7:
                        val2 = s[d+1, idx2]
                        org2 = last[idx2]
                        last[idx2] = d+2
                        temp_delta_satis[idx2, idx] += (np.sum(-c*(d+2-last)) + val2)*WEIGHT2
                        last[idx2] = org2
                    else:
                        temp_delta_satis[idx2, idx] = -10 ** 16
                        continue
                if D > d+2:
                    for idx3 in range(TYPE_NUM):
                        rand = random.random()
                        if rand > 0.7:
                            val3 = s[d+2, idx3]
                            org3 = last[idx3]
                            last[idx3] = d+3
                            temp_delta_satis[idx3, idx2, idx] += (np.sum(-c*(d+3-last)) + val3)*WEIGHT3
                            last[idx3] = org3
                        else:
                            temp_delta_satis[idx3, idx2, idx] = -10 ** 16
            last[idx] = org
        opt_idx = np.unravel_index(np.argmax(temp_delta_satis), temp_delta_satis.shape)[2]
        last[opt_idx] = d+1
        types.append(opt_idx+1)
    print(*types, sep='\n')

resolve()

Measured memory_bytes: 27416
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};
    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };
    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };
    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };
    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };
    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

pub fn l(n: usize) -> Vec<u64> {
    let mut dp = vec![0; n + 1];
    dp[0] = 2;
    dp[1] = 1;
    for i in 2..n + 1 {
        dp[i] = dp[i - 1] + dp[i - 2];
    }
    dp
}

fn main() {
    input! {
        n: usize,
    }
    println!("{}", l(n)[n]);
}


Measured memory_bytes: 4352
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
using namespace std;

int main() {
  while (true) {
    int n, x;
    cin >> n >> x;
    if (n == 0 && x == 0) { break; }

    int cnt = 0;
    for (int i = 1; i <= n; i++) {
      for (int j = i + 1; j <= n; j++) {
        for (int k = j + 1; k <= n; k++) {
          if (i + k + j == x) {
            //cout << i << " " << k << " " << j << endl;
            cnt++;
          }
        }
      }
    }
    cout << cnt << endl;
  }
  return 0;
}



Measured memory_bytes: 3092
n, k = gets.split.map(&:to_i)
ans  = 0
cnt  = 0
aryC = Array.new(1e5 + 10, 0)

n.times do
  a, b = gets.split.map(&:to_i)
  aryC[a] += b
end

i = 0
while cnt < k
  cnt += aryC[i]
  ans  = i
  i   += 1
end

puts ans


Measured memory_bytes: 2556
S=input()
count=0
for i in range(len(S)):
  if(i%2==0 and (S[i]=="R" or S[i]=="U" or S[i]=="D")):
    count+=1
  elif(i%2!=0 and (S[i]=="L" or S[i]=="U" or S[i]=="D")):
    count+=1
if(count==len(S)):
  print("Yes")
else:
  print("No")


Measured memory_bytes: 9124
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#define LL long long
#define ri register int
#define N 200500

struct edge{
  int u,v,l;
	bool operator < (const edge &rhs) const {
	  return l<rhs.l;
	}
} e[N<<1];
int f[N],v[N];
int n,m;
LL ans;

int findroot(int x){
  if (f[x]==x) return x;
	return f[x]=findroot(f[x]);
}

using namespace std;
int main(){
  scanf("%d %d",&n,&m);
	for (ri i=0;i<n;i++) v[i]=2000000000;
	for (ri i=1;i<=m;i++) {
	  scanf("%d %d %d",&e[i].u,&e[i].v,&e[i].l);
		v[e[i].u]=min(e[i].l+1,v[e[i].u]);
		v[e[i].v]=min(e[i].l+2,v[e[i].v]);
	}
	for (ri i=0;i<n;i++) f[i]=i;
	for (ri i=0;i<2*n;i++) v[(i+1)%n]=min(v[(i+1)%n],v[i%n]+2);
	int cc=m;
	for (ri i=0;i<n-1;i++) e[++cc]=(edge){i,i+1,v[i]};
	e[++cc]=(edge){n-1,0,v[n-1]};
	sort(e+1,e+cc+1);

	for (ri i=1;i<=cc;i++) {
	  int r1=findroot(e[i].u),r2=findroot(e[i].v);
		if (r1==r2) continue;
		f[r1]=r2;
		ans+=e[i].l;
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 9600
n, h = map(int, input().split())
l = [list(map(int, input().split())) for _ in range(n)]

max_a = max(l, key=lambda x: x[0])[0]
l = [[a, b] for a, b in l if b > max_a]
l.sort(key=lambda x: x[1], reverse=True)

c = 0
for a, b in l:
  h -= b
  c += 1
  if h <= 0:
    print(c)
    exit()

print(c + h // max_a + (h % max_a != 0))

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

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N = 3;
  vector<int> A(3);
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  sort(A.begin(), A.end());
  int res = A[2] - A[1];
  A[0] += res, A[1] += res;
  res += (A[1] - A[0] + 1) / 2;
  if ((A[1] - A[0]) % 2 != 0) res++;
  cout << res << '\n';
  return 0;
}


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

int main(){
    int n,m;
    cin >> n >> m;
    vector<int> l(m),r(m);
    for(int i=0;i<m;i++){
        cin >> l[i] >> r[i];
    }
    int ans_l=0,ans_r=1000100;
    for(int i=0;i<m;i++){
        ans_l = max(ans_l,l[i]);
        ans_r = min(ans_r,r[i]);
    }
    int ans = ans_r - ans_l + 1;
    cout << max(0,ans) << endl;

}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define MOD 1000000007
#define fo(i,s,e) for( i=s;i<e;i++)
#define rfo(i,s,e) for(i=s;i>e;i--)
#define LLI long long int
#define LI long int 
#define pb push_back
#define pob pop_back()
#define sp " "
#define ff first
#define ss second
//               When something is important enough, you do it even if the odds are not in your favor.

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    // code goes here
    int t=1;//cin>>t;
    while(t--){
      LI a,b;cin>>a>>b;
      cout<<a*b;
    }
    return 0;
}

Measured memory_bytes: 3648
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define all(v) v.begin(), v.end()
using in = int64_t;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
const double PI=3.14159265358979323846;
const in MOD = 1000000007;
const in INF=1e18+7;
const int inf=1e9+7;
using P=pair<int,int>;
vector<int> dx={0,1,-1,0};
vector<int> dy={1,0,0,-1};



int main(){
ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
cout << fixed << setprecision(10);
    int h,w,k;
    cin>>h>>w>>k;
    vector<vector<char>> f(h,vector<char>(w));
    rep(i,h)rep(j,w) cin>>f[i][j];
    vector<int> cnt_low(w);
    int cnt=0;
    rep(i,w){
        rep(j,h){
            if(f[j][i]=='#') cnt ++;
        }
        cnt_low[i]=cnt;
        cnt =0;
    }
    vector<vector<int>> ans(h,vector<int>(w,0));
    cnt=1;
    int cnt1=0;
    bool flag=true;
    int cnt_later=0;
    rep(i,w){
        if(flag&&cnt_low[i]==0){cnt_later ++;continue;}
        else flag=false;
        rep(j,h){
            if(cnt_low[i]>0){
                if(f[j][i]=='#') cnt1 ++;
                if(f[j][i]=='#' && cnt1>1) cnt ++;
                ans[j][i]=cnt;
            }
            else{
                ans[j][i]=ans[j][i-1];
            }
        }
        cnt1=0;
        if(i<w-1&&cnt_low[i+1]>0) cnt ++;
    }
    for(int i=cnt_later-1;i>=0;i--){
        rep(j,h){
            ans[j][i]=ans[j][i+1];
        }
    }
    rep(i,h){
        rep(j,w-1){
            cout<<ans[i][j]<<" ";
        }
        cout<<ans[i][w-1]<<endl;
    }
}

Measured memory_bytes: 1280
n=int(input())
l=[int(input()) for _ in range(n)]
l2=list()
l2=sorted(l,reverse=True)
m1=l2[0]
m2=l2[1]
ansl=[m1 for i in range(n)]
if m1!=m2:
    for i in range(n):
        if l[i]==m1:
            ansl[i]=m2
            break
for j in range(n):
    print(ansl[j])

Measured memory_bytes: 16288
#include <iostream>
#include <cstdio>
#include <algorithm>

using namespace std;

int main(){
	
	int N;
	
	cin >> N;
	
	int min[20000];
	
	for(int i = 0; i < 20000; i++){
		min[i] = 1000000000;
	}
	
	min[0] = 0;
	
	int num;

	for(int i = 1; i < N; i++){
		cin >> num;
		for(int j = 0; j <= i / 2; j++){
			if(min[j] > min[i - j] + num){
				min[j] = min[i - j] + num;
			}
			if(min[i - j] > min[j] + num){
				min[i - j] = min[j] + num;
			}
		}
	}
	
	cout << min[N / 2] << endl;
	
	return 0;
}

Measured memory_bytes: 3208
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define For(i,n,k) for(ll i=(n);i<(k);i++)
#define ALL(a)  (a).begin(),(a).end()
ll n,ans=0;
void Main(){
    cin>>n;
    ll s,t;
    ll nsq=floor(sqrt(n));
    for(int i=nsq;i>0;i--){
        if(n%i==0){
            s=i;
            t=n/i;
            break;
        }
    }
    ans=s+t-2;
    cout<<ans<<endl;
}
int main(){
    Main();
    return 0;
}


Measured memory_bytes: 384
x,*s=open(0)
h,w,k,*m=map(int,x.split())
for b in range(512):
 r=t=j=0;d=[0]*h
 while j<w:
  i=c=0
  while h-i:
   d[c]+=s[i][j]>'0';x=d[c]>k
   if(t<j)&x:r+=1;t=j;d=[0]*h;break
   r+=x*h*w;c+=b>>i&1;i+=1
  else:j+=1
 while b:r+=b&1;b>>=1
 m+=r,
print(min(m))

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

using namespace std;

#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(a) (a).begin(),(a).end()
#define PI 3.141592653589793238
#define INF 1050000000
#define INFL (long long)(4e18)

using vi = vector<int>;

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

template<class T>
class Graph {
	int n;
	bool directed;
	vector<vector<Edge<T>>> edges;
public:

	Graph(int n, bool directed) :n(n), directed(directed), edges(vector<vector<Edge<T>>>(n)) {};
	Graph() {};

	void add(int to, T cost) {
		emplace_back(to, cost);
	}

	int size() {
		return n;
	}
};


int main() {

	int K;

	string S;

	cin >> K >> S;

	if (S.size() <= K) {
		cout << S << endl;
	}
	else {
		cout << S.substr(0,K) + "..." << endl;
	}


	return 0;
}

Measured memory_bytes: 3552
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define ALL(x) (x).begin(), (x).end()
typedef long long ll;
typedef pair<int, int> P;
typedef vector<vector<int>> Matrix;
static const int INF = 2000000000;



int main(){
  int x, t;
  cin >> x >> t;
  int sa = x - t;
  if (sa <= 0) cout << 0;
  else cout << sa;
  cout << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <numeric>
#include <iomanip>
#include <tuple>

using namespace std;


int main(){
   int n;
   cin>>n;
   vector<string> s(n);
   vector<int> p(n);
   vector<tuple<string,int,int>> r(n);
   for(int i=0;i<n;i++){
       cin>>s[i]>>p[i];
       r[i]=make_tuple(s[i],-p[i],i+1);
   }
   sort(r.begin(),r.end());
   for(int i=0;i<n;i++){
       cout<<get<2>(r[i])<<endl;
   }

}

   


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

#define ABS(x) ( (x)>0 ? x : -(x) )
#define MIN(x,y) ( (x) < (y) ? (x) : (y) )
#define MAX(x,y) ( (x) > (y) ? (x) : (y) )

#define INF 1000000000



//typedef long long ll;

void swap(int* a, int* b)
{
	int tmp;
	tmp = *a;
	*a = *b;
	*b = tmp;
}

/*

int binary_search(int* a, int n,int key)
{
	int low, middle, high;

	low = 0, high = n - 1;

	while (low <= high)
	{
		middle = (low + high) / 2;

		if (key < a[middle])
			high = middle - 1;
		else if (key > a[middle])
			low = middle + 1;
		else
			return 1;
	}
	return 0;
}

void reverse(int a[], int b, int e)
{
	int i;

	for (i = 0; i <= (e-b-1) / 2; i++)
	{
		swap(&a[b+i], &a[e - 1 - i]);
	}
}

void CountingSort(int A[],int k,int n)
{
	int B[2000000] = { 0 };

	int i, C[20000] = { 0 };

	for (i = 0; i < n; i++)
		C[A[i]]++;

	for (i = 0; i < k; i++)
		C[i + 1] += C[i];

	for (i = n - 1; i >= 0; i--)
		B[--C[A[i]]] = A[i];

	for (i = 0; i < n; i++)
	{
		printf("%d", B[i]);
		if (i != n - 1)
			printf(" ");
	}
	printf("\n");
}
*/

int main()
{
	int n;

	scanf("%d", &n);

	printf("%d\n", n / 25 + (n % 25) / 10 + ((n % 25) % 10) / 5 + (((n % 25) % 10 % 5) / 1));

}


Measured memory_bytes: 2104
#include <bits/stdc++.h>
using namespace std;
int main(){
  int M, D;
  cin >> M >> D;
  int ans = 0;
  for (int i = 1; i <= D; i++){
    int d1 = i % 10;
    int d2 = i / 10;
    if (d1 >= 2 && d2 >= 2 && d1 * d2 <= M){
      ans++;
    }
  }
  cout << ans;
}

Measured memory_bytes: 256
s = gets.strip

words = ['dream', 'dreamer', 'erase', 'eraser']

until s.empty? do
    matched = false
    words.map do |w|
        if s[-w.size, w.size] == w
            s = s[0..-w.size - 1]
            matched = true
            break
        end
    end

    unless matched
        puts 'NO'
        exit 0
    end
end

puts 'YES'

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

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

    vector<ll> ans(n);
    for(int i=0; i<n; i++){
        if(i%2){
            ans[0] -= a[i];
        }else{
            ans[0] += a[i];
        }
    }
    cout << ans[0] << ' ';
    for(int i=1; i<n; i++){
        ans[i] = -1 * ans[i-1] + (2*a[i-1]);
        cout << ans[i] << ' ';
    }
    return 0;
}

Measured memory_bytes: 2816
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<cstring>
using namespace std;

typedef long long ll;
const int maxn=2e5+10;
int n,a[maxn],b[maxn],pos;
bool allthesame=true;
ll ans;

int main(){
	cin>>n;
	for(int i=1;i<=n;++i){
		cin>>a[i]>>b[i];
		if(a[i]!=b[i])
			allthesame=false;
	}
	if(allthesame){
		cout<<0<<endl;
		return 0;
	}
	for(int i=1;i<=n;++i)
		if(a[i]>b[i])
			if(!pos||b[i]<b[pos])
				pos=i;
	for(int i=1;i<=n;++i)
		if(a[i]<=b[i])
			ans+=a[i];
		else if(pos!=i)
			ans+=a[i];
		else
			ans+=a[i]-b[i];
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 384
N, Q = map(int, input().split())
S = input()
t=[0]*(N+1)

for i in range(N):
    t[i + 1] = t[i] + (1 if S[i : i + 2] == 'AC' else 0)
for i in range(Q):
    l, r = map(int, input().split())
    print(t[r-1] - t[l-1])

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

#ifdef LOCAL
#include <debug.hpp>
#else
#define debug(...) void()
#endif

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, y;
  cin >> n >> y;
  for (int i = 0; i <= n; i++) {
    for (int j = 0; j <= n; j++) {
      int c10k = i, c5k = j, c1k = n - i - j;
      if (c1k < 0) continue;
      if (c10k * 10000 + c5k * 5000 + c1k * 1000 == y) {
        cout << i << ' ' << j << ' ' << n - i - j << '\n';
        return 0;
      }
    }
  }
  cout << -1 << ' ' << -1 << ' ' << -1 << '\n';
  return 0;
}

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

const ll MOD = ll(1e9 + 7);

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

	int N;
	cin >> N;

	ll p = 1;
	for(int i = 1; i <= N; i++) {
		p = p * i % MOD;
	}
	cout << p << endl;
}

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

namespace Program
{
    public class ABC085D
    {
        static public void Main(string[] args)
        {
            var N = NextInt;
            var H = NextLong;
            var count = 0;
            var maxa = 0L;
            var sum = 0L;
            var bary = new long[N];
            for (int i = 0; i < N; ++i)
            {
                var a = NextLong;
                var b = NextLong;
                if (maxa < a) maxa = a;
                bary[i] = b;
            }
            Array.Sort(bary);
            bary = bary.Reverse().ToArray();
            foreach (var item in bary)
            {
                if (item < maxa) continue;
                sum += item;
                ++count;
                if (sum >= H)
                {
                    Console.Write(count);
                    return;
                }
            }
            Console.WriteLine(count + (H - sum - 1) / maxa + 1);
        }

        static class Console_
        {
            private static Queue<string> param = new Queue<string>();
            public static int NextInt() => int.Parse(NextString());
            public static long NextLong() => long.Parse(NextString());
            public static string NextString()
            {
                if (param.Count == 0) foreach (var item in Console.ReadLine().Split(' ')) param.Enqueue(item);
                return param.Dequeue();
            }
        }
        static int NextInt => Console_.NextInt();
        static long NextLong => Console_.NextLong();
        static string NextString => Console_.NextString();

        static IEnumerable<int> Prime(int x)
        {
            if (x < 2) yield break;
            yield return 2;
            var halfx = x / 2;
            var table = new bool[halfx + 1];
            var max = (int)(Math.Sqrt(x) / 2);
            for (int i = 1; i <= max; ++i)
            {
                if (!table[i])
                {
                    var add = 2 * i + 1;
                    yield return add;
                    for (int j = 2 * i * (i + 1); j <= halfx; j += add)
                    {
                        table[j] = true;
                    }
                }
            }
            for (int i = max + 1; i <= halfx; ++i)
            {
                if (!table[i]) yield return 2 * i + 1;
            }
        }
    }
}


Measured memory_bytes: 19532
#include<bits/stdc++.h>
using namespace std; 
int main()
{
  int n;
  int h[105];
  int count;

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

  count=h[0];
  for(int i=1;i<n;i++){
    if(h[i]>h[i-1]){
      count+=h[i]-h[i-1];
    }
  }

  cout<<count<<endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define db double
#define ld long double
#define rep(i,n) for(int i=0;i<n;i++)
#define rev(i,n) for(int i=n;i>=0;i--)
#define rep_a(i,a,n) for(int i=a;i<n;i++)
#define pb push_back
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(), (v).end()
int fact(int n); 
  
int nCr(int n, int r) 
{ 
    return fact(n) / (fact(r) * fact(n - r)); 
} 
  
// Returns factorial of n 
int fact(int n) 
{ 
    int res = 1; 
    for (int i = 2; i <= n; i++) 
        res = res * i; 
    return res; 
} 
int solve()
{
    int n,m;
    cin>>n>>m;
    ll ans =0;
    if(n>=2)
    ans = n*(n-1)/2;
    if(m>=2)
    ans +=  m * (m-1)/2;
    cout<<ans<<endl;
    return 0;
}
int main()
{
    /* #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #else
    #endif */
    solve();
    /* #ifndef ONLINE_JUDGE
    cout<<"\nTime Elapsed: "<<1.0*clock()/ CLOCKS_PER_SEC<<" Sec\n";
    #endif */
    return 0;
} 

Measured memory_bytes: 256
Odd = ["R","U","D"]
Even = ["L","U","D"]
match = 0

S = input()

for i in range(len(S)):
    if (i+1) % 2 == 0 and S[i] in Even:
        match += 1
    elif (i+1) % 2 == 1 and S[i] in Odd:
        match += 1

if match == len(S):
    print("Yes")
else:
    print("No")

Measured memory_bytes: 9008
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for( int i = 0; i < n; i++ )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000

double circle (int x, int y) {
    return 1/2.0 * sqrt(x*x + y*y);
}

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int In[3];
    rep(i ,3) cin >> In[i];
    while (In[0] != 0 || In[1] != 0 || In[2] != 0) {
        sort(In, In + 3);
        double r = circle(In[0], In[1]);
        int n; cin >> n;
        for (int i = 0; i < n; i++) {
            int door; cin >> door;
            if (r < door) cout << "OK" << endl;
            else cout << "NA" << endl;
        }
        rep(i ,3) cin >> In[i];
    } 

    return 0;
}

Measured memory_bytes: 3072
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<utility>
#include<list>
#include<algorithm>
#include <ctype.h>
#include<deque>
using namespace std;
using ll = long long int;

int n, m, q;
int p[503][503];

bool cmp(const pair<int, int>& a, const pair<int, int>& b) {
	return a.first <= b.first && a.second < b.second;
}

int main(void) {
	cin >> n >> m >> q;
	n++;
	for (int i = 0; i < m; i++) {
		int li, ri;
		cin >> li >> ri;
		p[li][ri]++;
	}
	vector<vector<int>> ret;
	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= n; j++) {
			p[i][j] += p[i][j - 1];
		}
	}
	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= n; j++) {
			p[i][j] += p[i - 1][j];
		}
	}
	for (int i = 0; i < q; i++) {
		int pi, qi;
		cin >> pi >> qi;
		cout << p[qi][qi] + p[pi - 1][pi - 1] - p[pi - 1][qi] - p[qi][pi - 1] << endl;
	}
	return 0;
}

Measured memory_bytes: 1920
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define perl(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define pb push_back
#define ins insert
#define pqueue(x) priority_queue<x,vector<x>,greater<x>>
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
#define vtpl(x,y,z) vector<tuple<x,y,z>>
#define rev(x) reverse(x);
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
using vpl=vector<pl>;
using vvpl=vector<vpl>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[9]={1,0,-1,0,1,1,-1,-1,0};
const ll dx[9]={0,-1,0,1,1,-1,1,-1,0};
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

int main(){
    ll a,b,c,d;cin >> a >> b >> c >>d;
    vl ans;
    ans.pb(a*c);
    ans.pb(a*d);
    ans.pb(b*c);
    ans.pb(b*d);
    cout << *max_element(all(ans)) <<endl;
} 

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

int main() {
  char a;
  cin >> a;

  if (a == 'a' || a == 'i' || a == 'u' || a == 'e' || a == 'o') {
    cout << "vowel" << endl;
    }
  else {
    cout << "consonant" << endl;
  }
}


Measured memory_bytes: 256
#include<iostream>
#include<set>
using namespace std;
int n,m;
main()
{
	while(cin>>n>>m,n)
	{
		set<long>S;
		S.insert(0);
		long sum=0,ans=0;
		for(int i=0;i<n;i++)
		{
			long k;cin>>k;
			sum=(sum+k)%m;
			auto it=S.upper_bound(sum);
			if(it==S.end())it=S.lower_bound(0);
			int a=*it;
			if(sum<a)ans=max(ans,m-a+sum);
			else ans=max(ans,sum-a);
			S.insert(sum);
		}
		cout<<ans<<endl;
	}
}



Measured memory_bytes: 4320
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define INF 1000000010
#define EPS 1e-9
#define fst first
#define scd second

#define debug(x) cout<<x<<endl;
#define repi(i,x,n) for(int i=x;i<n;i++)
#define rep(i,n) repi(i,0,n)
#define lp(i,n) repi(i,0,n)
#define repn(i,n) for(int i=n;i>=0;i--)
#define int long long
#define endl "\n"


signed main(){
  cin.tie(0);	
  ios::sync_with_stdio(false);
  string s;
  cin>>s;
  string a[7]={"SAT","FRI","THU","WED","TUE","MON","SUN"};
  rep(i,8){
    if(a[i]==s){
      cout<<(i+1)<<endl;
      break;
    }
  }

  return 0;
}


Measured memory_bytes: 256
/*
 * cpp_filepath
 */

// C++ 14
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstring> // memset
#include <cassert>
using namespace std;
#define ll long long
#define loop(__x, __start, __end) for(int __x = __start; __x < __end; __x++)
template <class T> ostream & operator << (ostream & out, vector<T> const & v) {
  for (auto &&a: v) out << a << " "; out << endl; return out;
}
template <class T> void dump(T &a) { cout << a << endl; }
void solve();
int main() { solve(); return 0; }


void solve() {
  cout.precision(15); cout << fixed;
  int n;
  cin >> n;
  vector<double> A(n);
  loop(i,0,n) cin >> A[i];
  double total = 0.0;
  loop(i,0,n) total += 1/A[i];
  cout << 1/total << endl;
}


Measured memory_bytes: 256
n = int(input())
xy = [tuple(map(int, input().split())) for i in range(n)]
ans = n

for i in range(n):
  for j in range(n):
    if i==j:
      continue
    xt = xy[i][0]-xy[j][0]
    yt = xy[i][1]-xy[j][1]
    tmp = n
    for k in range(n):
      if (xy[k][0]+xt, xy[k][1]+yt) in xy:
        tmp -= 1
    ans = min(ans, tmp)

print(ans)

Measured memory_bytes: 3064
a,b = map(int,input().split())


if a == 12:
  if b >= 12:
    print(12)
elif a == 11:
  if b >= 11:
    print(11)
  else:
    print(10)
elif a == 10:
  if b >= 10:
    print(10)
  else:
    print(9)
elif a == 9:
  if b >= 9:
    print(9)
  else:
    print(8)
elif a == 8:
  if b >= 8:
    print(8)
  else:
    print(7)

elif a == 7:
  if b >= 7:
    print(7)
  else:
    print(6)

elif a == 6:
  if b >= 6:
    print(6)
  else:
    print(5)

elif a == 5:
  if b >= 5:
    print(5)
  else:
    print(4)

elif a == 4:
  if b >= 4:
    print(4)
  else:
    print(3)

elif a == 3:
  if b >= 3:
    print(3)
  else:
    print(2)

elif a == 2:
  if b >= 2:
    print(2)
  else:
    print(1)

elif a == 1:
  if b >= 1:
    print(1)
  else:
    print(1)


Measured memory_bytes: 3064
#include <stdio.h>
#define MAXL 15

int check_code(char s[MAXL + 1], int a);

int main(void){
    int a, b;
    scanf("%d %d", &a, &b);
    char s[MAXL + 1];
    scanf("%s", s);

    printf("%s\n", (check_code(s, a))? "Yes" : "No");
    return 0;
}

int check_code(char s[MAXL + 1], int a){
    if(s[a] != '-') return 0;

    for(int i = 0; s[i] != '\0'; i++){
        if(i == a) continue;

        if(s[i] == '-') return 0;
    }
    return 1;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string a;
    cin>>a;
    sort(a.begin(),a.end());
    if(a[0]==a[1] && a[2]==a[3] && a[0]!=a[3])
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;
    return 0;
}


Measured memory_bytes: 256