akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define ll long long
#define ALL(x) x.begin(),x.end()
#define MOD (1000000000+7)
using namespace std;
#define PI 3.14159265359
#define tMOD 998244353
#define mkpr(x,y) make_pair(x,y)


int main() {
  ll N,K;
  ll R,S,P;
  string T;
 
  cin>>N>>K>>R>>S>>P>>T;

//rsp
 string da(N,'n');
string mae(K,'n');
for(ll j=0;j<K;j++){
mae[j] = 'n';
    }
    for(ll j=0;j<N;j++){
        if(T[j]=='r'){
          da[j] = 'p';
        }
        else if(T[j]=='s'){
          da[j]='r';
        }
        else{
          da[j] = 's';
        }
    }
ll ss =0;
ll tmp=0;
  for(ll i=0;;i++){
    for(ll j=0;j<K;j++){
      
      if(K*i+j>=N){
        tmp=1;
        break;
      }
//cout<<da[K*i+j]<<endl;

      if(da[K*i+j]==mae[j]){
        mae[j] = 'n';
      }
      else if(da[K*i+j]=='r'){
          ss+=R;
          mae[j] = da[K*i+j];
      }
      else if(da[K*i+j]=='s'){
          mae[j] = da[K*i+j];
           ss+=S;
      }
      else if(da[K*i+j]=='p'){
         mae[j] = da[K*i+j];
           ss+=P;
      }
    }
    if(tmp==1){
      break;
    }
  }

cout<<ss<<endl;
  return 0;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using ll  = long long;
#define int ll
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define erep(e,v) for(auto && e :v)
#define all(in) in.begin(), in.end()
#define MP make_pair
#define INF (sizeof(int) == 4 ? (int)1e9:(int)1e18)
#define EPS 0.0000000001
using namespace std;
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
template<typename Head, typename Value> auto vectors(const Head &head, const Value &v) { return vector<Value>(head, v); }
template<typename Head, typename... Tail> auto vectors(Head x, Tail... tail) { auto inner = vectors(tail...); return vector<decltype(inner)>(x, inner); }
template<class T> void join(T a){for(auto itr :a){if(itr != *a.begin())cout << " "; cout << itr;} }
using ld  = long double;
using pii = pair<int,int>;
using piii = pair<int,pii>;
int W,H;
int dx[]={0,0,1,-1}, dy[]={1,-1,0,0};
bool valid(int x,int y){return (0<=x&&x<W)&&(0<=y&&y<H);}
signed main(){
    string s;
    while(getline(cin,s)){
        stack<double>st;
        string temp = "";
        s.push_back(' ');
        rep(i,s.size()){
            if(s[i] == ' '){
                if('0'<=temp.back() and temp.back()<='9'){
                    st.push(stod(temp));
                }else{
                    char op = temp.back();
                    auto a = st.top();st.pop();
                    auto b = st.top();st.pop();
                    double res = 0;
                    if(op == '*') res = a*b;
                    if(op == '+') res = a+b;
                    if(op == '-') res = b-a;
                    if(op == '/') res = b/a;
                    st.push(res);
                }
                temp.clear();
            } else {
                temp.push_back(s[i]);
            }
        }
        cout << fixed << setprecision(10) << st.top() << endl;
    }
}





Measured memory_bytes: 3184
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int , int> i_i;
typedef vector<ll> vl;
typedef vector<int> vi;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> vvl;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvec;
typedef vector<vector<bool>> vveb;
typedef vector<vector<string>> vves;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define fs first
#define sc second
#define pb push_back
#define pp pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)
typedef long long int64;
//const int64 INF = 1LL << 58;
#define dame { puts("-1"); return 0;}
#define YES { cout << "YES" << endl; return 0; }
#define NO { cout << "NO" << endl; return 0; }
#define Yes { cout << "Yes" << endl; return 0; }
#define No { cout << "No" << endl; return 0; }
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
int dx[] = {0, 0, -1, 1};
int dy[] = {1, -1, 0, 0};

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

    int n;
    cin >> n;
    string s = to_string(n);
    if(s[0]=='7'||s[1]=='7'||s[2]=='7'){Yes}
    No
    return 0;
}





Measured memory_bytes: 3708
import numpy as np
N, W0 = map(int, raw_input().split())
items = [map(int, raw_input().split()) for i in range(N)]
w0, _ = items[0]
dp = {}
def dfs(i, W):
    if i < 0:
        return 0
    if (i, W) in dp:
        return dp[i, W]
    w, v = items[i]
    res = dfs(i-1, W)
    if W >= w:
        res = max(res, dfs(i-1, W-w) + v)
    dp[i, W] = res
    return res
print dfs(N-1, W0)

Measured memory_bytes: 27768
// I SELL YOU...! 
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<chrono>
#include<iomanip>
#include<map>
#include<set>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using TP = tuple<ll,ll,ll>;
void init_io(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << setprecision(18);
}
signed main(){
  init_io();
  ll n,k,c,yuto=0,cnt=0;
  string s;
  cin >> n >> k >> c >> s;
  vector<ll> ans;
  vector<ll> bef(k,0),aft(k,0);
  for(int i=0;i<n;){
    if(s[i]=='o'){
      bef[cnt++] = i;
      i += c+1;
      if(cnt==k) break;
    }else{
      i++;
    }
  }
  cnt = 0;
  reverse(s.begin(),s.end());
  for(int i=0;i<n;){
    if(s[i]=='o'){
      aft[k-1-cnt++] = n-1-i;
      i += c+1;
      if(cnt==k) break;
    }else{
      i++;
    }
  }
  for(int i=0;i<k;i++){
    if(bef[i]==aft[i]){
      cout << bef[i]+1 << endl;
    }
  }
}


Measured memory_bytes: 5012
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = s; i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << endl;
#define CFYN(n) cout << ( (n) ? "YES":"NO") << endl;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;

int main(void)
{
    IOS
    int n; cin >> n;
    string s = "Christmas";
    for(auto i = n; i < 25; i++) {
        s += " Eve";
    }
    cout << s << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, s, n) for (int i = s; i < (n); i++)
#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)
using llong = long long;
using P = pair<int, int>;
const int inf = 1 << 20;
const int mod = 1e9 + 7;

int main() {
   int n;
   cin >> n;
   vector<int> h(n);
   rep(i, 0, n) { cin >> h[i]; }
   vector<int> dp(n + 1);
   rep(i, 1, n) {
      if (i == 1)
         dp[i] = dp[i - 1] + abs(h[i] - h[i - 1]);
      else
         dp[i] = min(dp[i - 2] + abs(h[i] - h[i - 2]),
                     dp[i - 1] + abs(h[i] - h[i - 1]));
   }
   cout << dp[n - 1] << endl;
   return 0;
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
#define REP(i, n) for(int i=0; i<n; i++)
#define REPi(i, a, b) for(int i=int(a); i<int(b); i++)
#define MEMS(a,b) memset(a,b,sizeof(a))
#define mp make_pair
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const ll MOD = 1e9+7;

int main(){
    ll A, B, N;
    cin >> A >> B >> N;
    ll ans = 0;

    if(N > B-1){
        ans = (A*(B-1)) / B;
    }
    else{
        ans = (A*N)/B;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3628
#include<stdio.h>
int n,y,m;
int main(){
  scanf("%d%d",&n,&y);
  m=y/1000;
  bool find=false;
  for (int a=0;10*a<=y;a++){
    if ((m-n-9*a)%4!=0)continue;
    int b=(m-n-9*a)/4;
    int c=n-a-b;
    if (c>=0&&b>=0){
      find=true;
      printf("%d %d %d\n",a,b,c);
      break;
    }
  }
  if (!find)printf("-1 -1 -1\n");
  return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#include<map>
#include<queue>
#include<deque>
#include<iomanip>
#include<tuple>
#include<cassert>
using namespace std;
typedef long long int LL;
typedef pair<int,int> P;
typedef pair<LL,int> LP;
const int INF=1<<30;
const LL MAX=1e9+7;

void array_show(int *array,int array_n,char middle=' '){
	for(int i=0;i<array_n;i++)printf("%d%c",array[i],(i!=array_n-1?middle:'\n'));
}
void array_show(LL *array,int array_n,char middle=' '){
	for(int i=0;i<array_n;i++)printf("%lld%c",array[i],(i!=array_n-1?middle:'\n'));
}
void array_show(vector<int> &vec_s,int vec_n=-1,char middle=' '){
	if(vec_n==-1)vec_n=vec_s.size();
	for(int i=0;i<vec_n;i++)printf("%d%c",vec_s[i],(i!=vec_n-1?middle:'\n'));
}
void array_show(vector<LL> &vec_s,int vec_n=-1,char middle=' '){
	if(vec_n==-1)vec_n=vec_s.size();
	for(int i=0;i<vec_n;i++)printf("%lld%c",vec_s[i],(i!=vec_n-1?middle:'\n'));
}

int main(){
	int n,m;
	int i,j,k;
	int a,b,c;
	cin>>n>>a>>b;
	b=b/n*n;
	if(a<=b)cout<<"OK"<<endl;
	else cout<<"NG"<<endl;
}


Measured memory_bytes: 3640
n=int(input())
a=[0]*n
a[:]=map(int,input().split())
a0=a[0]
for ii in range(n):
  if a[ii]<a0:
    #print(a[ii],a0)
    print("No")
    exit()
  else:
    a0=max(a0,a[ii]-1)
print("Yes")

Measured memory_bytes: 15148
import sys
h,w,m = map(int, input().split())
h_t = [0 for _ in range(h)]
w_t = [0 for _ in range(w)]
t = []
for _ in range(m):
  hi,wi = map(int, input().split())
  h_t[hi-1] += 1
  w_t[wi-1] += 1
  t.append([hi-1,wi-1])
hmax = max(h_t)
wmax = max(w_t)
hmaxi = [i1 for i1 in range(h) if h_t[i1] == hmax]
wmaxi = [i2 for i2 in range(w) if w_t[i2] == wmax]
c = len(hmaxi)*len(wmaxi)
d = 0
for ht,wt in t:
  if h_t[ht] == hmax:
    if w_t[wt] == wmax:
      d += 1
if c ==d:
  print(hmax + wmax-1)
else:
  print(hmax + wmax)

Measured memory_bytes: 82492
using System;
using System.Collections.Generic;
using System.Collections;
using System.Collections.Specialized;
using System.Linq;
using System.Text;
using System.IO;
using System.Reflection;
using static System.Math;
using System.Numerics;
static class Program{
	const int mod=(int)1e9+7;
	static void Main(){
		Sc sc=new Sc();
		var s=sc.Ia;
		var a=sc.Ia;
		var b=sc.Ia;
		int ans=a.Min()+b.Min();
		for(int i = 0;i<s[2];i++) {
			var e=sc.Ia;
			ans=Min(ans,a[e[0]-1]+b[e[1]-1]-e[2]);
		}
		Console.WriteLine("{0}",ans);
	}
}
public class Sc{
	public int I{get{return int.Parse(Console.ReadLine());}}
	public long L{get{return long.Parse(Console.ReadLine());}}
	public double D{get{return double.Parse(Console.ReadLine());}}
	public string S{get{return Console.ReadLine();}}
	public int[] Ia{get{return Array.ConvertAll(Console.ReadLine().Split(),int.Parse);}}
	public long[] La{get{return Array.ConvertAll(Console.ReadLine().Split(),long.Parse);}}
	public double[] Da{get{return Array.ConvertAll(Console.ReadLine().Split(),double.Parse);}}
	public string[] Sa{get{return Console.ReadLine().Split();}}
	public object[] Oa{get{return Console.ReadLine().Split();}}
	public int[] Ia2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),int.Parse);}}
	public int[] Ia3(int a){return Array.ConvertAll((a.ToString()+" "+Console.ReadLine()).Split(),int.Parse);}
	public int[] Ia3(bool a,int b,bool c,int d){return Array.ConvertAll(((a?b.ToString()+" ":"")+Console.ReadLine()+(c?" "+d.ToString():"")).Split(),int.Parse);}
	public long[] La2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),long.Parse);}}
	public long[] La3(int a){return Array.ConvertAll((a.ToString()+" "+Console.ReadLine()).Split(),long.Parse);}
	public long[] La3(bool a,int b,bool c,int d){return Array.ConvertAll(((a?b.ToString()+" ":"")+Console.ReadLine()+(c?" "+d.ToString():"")).Split(),long.Parse);}
	public double[] Da2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),double.Parse);}}
	public double[] Da3(int a){return Array.ConvertAll((a.ToString()+" "+Console.ReadLine()).Split(),double.Parse);}
	public double[] Da3(bool a,int b,bool c,int d){return Array.ConvertAll(((a?b.ToString()+" ":"")+Console.ReadLine()+(c?" "+d.ToString():"")).Split(),double.Parse);}
	public T[] Arr<T>(int n,Func<T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f();}return a;}
	public T[] Arr<T>(int n,Func<int,T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i);}return a;}
	public T[] Arr<T>(int n,Func<string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(Console.ReadLine().Split());}return a;}
	public T[] Arr<T>(int n,Func<int,string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i,Console.ReadLine().Split());}return a;}
}

Measured memory_bytes: 36572
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define int long long

const int N=1005;
const int MOD=1e9+7;
 

// lower_bound - which does not compare less than val
// upper_bound - which compares greater than val

 
int32_t main()
{
  
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  /* stuff you should look for
  * int overflow, array bounds
  * special cases (n=1?)
  * do smth instead of nothing and stay organized
*/


 string s;
 cin>>s;
 if(s[2]==s[3] && s[4]==s[5])
 {
	 cout<<"Yes";
 }
 else
 cout<<"No";
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<utility>
#include<iomanip>
#include<map>
#include<cmath>
#include<cstdio>

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

using namespace std;
using ll =long long;
using P = pair<int,int>;

int main(int argc, const char * argv[]) {
    ll N;
    cin >> N;
    
    int ans = to_string(N).length();
    for(ll i=1; i*i<=N; i++){
        ll A = i;
        if(N%A==0){
            int a = to_string(A).length();
            int b = to_string(N/A).length();
            ans = min(ans, max(a, b));
        }
    }
    
    cout << ans << endl;
    
    return 0;
}


Measured memory_bytes: 256
import math
it = input()
it = it.split()
a = int(it[0])
b = int(it[1])
h = int(it[2])
m = int(it[3])

k = h * 30 + m * 0.5
s = m * 6
if s == 0:
    s = 360
if k == 0:
    k = 360

if k < s:
    u = s-k
else:
    u = k-s
u = u / 180.0 * math.pi 
c = math.sqrt(a**2 + b**2 - 2*a*b*math.cos(u))

print(c)

Measured memory_bytes: 9532
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String {
            bytes
                .by_ref()
                .map(|r| r.unwrap() as char)
                .skip_while(|c| c.is_whitespace())
                .take_while(|c| !c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

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

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

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input!{
        a: i64,
        b: i64,
        c: i64
    }
    println!("{}", if (a - c) * (c - b) > 0 {"Yes"} else {"No"});
}


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

#ifdef NON_SUBMIT
#define TEST(n) (n)
#define tout cerr
#else
#define TEST(n) ((void)0)
#define tout cin
#endif

using namespace std;

vector<int> P;
int PS[2][100001];

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
	TEST(freopen("input.txt", "r", stdin));
	TEST(freopen("output.txt", "w", stdout));
	TEST(freopen("debug.txt", "w", stderr));
	int N, Q;
	string s;
	cin>>N>>Q>>s;
	for(int i=1;i<N;i++) if(s[i-1]=='A' && s[i]=='C') P.push_back(i);
	for(;Q;Q--) {
		int l, r;
		cin>>l>>r;
		cout<<upper_bound(P.begin(),P.end(),--r)-lower_bound(P.begin(),P.end(),l)<<'\n';
	}
	return 0;
}

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

//#define int long long


/*https://github.com/kurokoji/.cpp-Template/wiki#struct-fast*/
//理解できていないものはコメントアウト
struct Fast { Fast() { std::cin.tie(0); ios::sync_with_stdio(false); } } fast;

/* debug */
#define debug(x) cerr << x << " " << "(L:" << __LINE__ << ")" << '\n';

/* short */
//#define pb push_back
//#define eb emplace_back
//#define mp make_pair
//#define Fi first
//#define Se second
#define ALL(v) begin(v), end(v) // sort(ALL(v));みたいに使う
//#define RALL(v) rbegin(v), rend(v)
#define X real()
#define Y imag()

/* REPmacro */
#define REPS(i, a, n) for (ll i = (a); i < (ll)(n); ++i)
#define REP(i, n) REPS(i, 0, n)
#define RREP(i, n) REPS(i, 1, n + 1)
#define DEPS(i, a, n) for (ll i = (a); i >= (ll)(n); --i)
#define DEP(i, n) DEPS(i, n, 0)
//#define EACH(i, n) for (auto&& i : n)

/* alias */
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
//using pii = pair<int, int>;
using D = double;
//using P = complex<D>;
using vs = vector<string>;
//template <typename T> using PQ = priority_queue<T>;
//template <typename T> using minPQ = priority_queue<T, vector<T>, greater<T>>;

/* const */
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7;
const D EPS = 1e-9;
//const int dx[] = { 0, 1, 0, -1, 1, -1, 1, -1 }, dy[] = { 1, 0, -1, 0, 1, -1, -1, 1 };

/* func */
inline bool inside(int y, int x, int H, int W) { return y >= 0 && x >= 0 && y < H && x < W; }
inline int in() { int x; cin >> x; return x; }
//inline vs split(const string& t, char c) { vs v; stringstream s(t); string b; while (getline(s, b, c)) v.eb(b); return v; }
//template <typename T> inline bool chmin(T& a, const T& b) { if (a > b) a = b; return a > b; }
//template <typename T> inline bool chmax(T& a, const T& b) { if (a < b) a = b; return a < b; }
//template <typename T, typename S> inline void print(const pair<T, S>& p) { cout << p.first << " " << p.second << endl; }
template <typename T> inline void print(const T& x) { cout << x << '\n'; }
//template <typename T, typename S> inline void print(const vector<pair<T, S>>& v) { for (auto&& p : v) print(p); }
//template <typename T> inline void print(const vector<T>& v, string s = " ") { REP(i, v.size()) cout << v[i] << (i != (ll)v.size() - 1 ? s : "\n"); }


signed main() {
	int y,m,d;
	char s1, s2;

	cin >> y >> s1 >> m >> s2 >> d;

	if (m <= 4) {
		cout << "Heisei" << endl;
	}
	else {
		cout << "TBD" << endl;
	}

	#ifdef _DEBUG
		system("pause");
	#endif
	return 0;
}



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

#define times(n, i) uptil(0, n, i)
#define upto(f, t, i) for(auto _##i = (t), i = decltype(_##i)(f) poi  i <= _##i poi  i++)
#define uptil(f, t, i) for(auto _##i = (t), i = decltype(_##i)(f) poi  i < _##i poi  i++)
#define downto(f, t, i) for(auto i = (f), _##i = decltype(i)(t) poi  i >= _##i poi  i--)
#define downtil(f, t, i) for(auto i = (f), _##i = decltype(i)(t) poi  i > _##i poi  i--)

#define unless(c) if(!(c))
#define until(c) while(!(c))
#define loop while(true)

#define poi ;
#define poipoi << "\n"

/*#define do {*/
/*#define end }*/

#define val const auto
#define var auto

#define zenbu(c) c.begin(), c.end()

#define fuwafuwa(n, c) dokidoki((n) + (c) - 1, c)
#define dokidoki(n, c) ((n) / (c) * (c))

template<class T> bool read(T& t){
    return cin >> t poi
}
template<class T, class...U> bool read(T& t, U&... u){
    unless(cin >> t) return false poi
    return read(u...) poi
}

int main(){
    char S[10000] poi
    cin.getline(S, 10000) poi
    string s = S poi
    for(char& c : s){
        c = toupper(c) poi
    }
    cout << s poipoi poi

    return 0 poi
}

Measured memory_bytes: 1180
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef map<int, int> mii;
typedef map<char,int> mci;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<pair<int,int>> vii;
typedef vector<char> vc;
typedef vector<vc> vcc;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pb push_back
#define F first
#define S second
#define in insert
#define mina(a,b) (a)=min((a),(b));
#define maxa(a,b) (a)=max((a),(b));
const int INF = 1e9 + 7;
void solve(){
    int a, b, c;  cin>>a>>b>>c;
    cout<<min(a*b,c);
}
int main(){
    int T=1;
    //cin>>T;
    for(int i = 0; i < T; i++) solve(); 
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
#include <string>
int main()
{
	int a, b, c;
	cin >> a >> b >> c;
	int i = 0, t = 0;
	if (a == 5) {
		i++;
	}
	if (b == 5) {
		i++;
	}
	if (c == 5) {
		i++;
	}
	if (a == 7) {
		t++;
	}
	if (b == 7) {
		t++;
	}
	if (c == 7) {
		t++;
	}

	if (i == 2 && t == 1) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<cstdio>
#include<cstdlib>
#include<string>
#include<iostream>
#include <iomanip>
#include<queue>
#include<algorithm>
#include <functional>
#include<vector>
#include <math.h>
using namespace std;

long double N;
int K;
long double ans = 0;

int main() {
	cin >> N >> K;
	int idx = 1;
	if (N < K) {
		for (int i = N; i > 0; i--) {
			while (i*pow(2, idx) < K) idx++;
			if (i*pow(2, idx) >= K) {
				ans += ((long double)(1.0) / N)*pow((long double)(0.5), (long double)(idx));
			}
		}
		cout << setprecision(12) << ans << endl;
	}
	else {
		for (int i = K - 1; i > 0; i--) {
			while (i*pow(2, idx) < K) idx++;
			if (i*pow(2, idx) >= K) {
				ans += ((long double)(1.0) / (long double)(N))*(long double)pow((long double)(0.5), (long double)(idx));
			}
		}
		ans += ((long double)(1.0) / (long double)(N))*(long double)((N - K + 1));
		cout << setprecision(12) << ans << endl;
	}
}

Measured memory_bytes: 256
//ΔATCODER QUALC E
#include<iostream>
#include<cstdio>
#include<fstream>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<cmath>
#include<cstring>
#include<cstdlib>
using namespace std;
typedef long long LL;
const int mod = 1e9+7;
int main()
{
	LL a,b,c,d;
	LL ans,p;
	LL x,y,z,xyz,dx,dy,dz,nx,ny,nz,nxyz,tx,ty,tz;
	int t;
	cin>>a>>b>>c>>d;
	x=0,y=0,z=0;
	dx=min(d+1,a);
	dy=min(d+1,b);
	dz=min(d+1,c);
	ans=dx*dy%mod*dz%mod;
	while(1){
		t=0;
		if(dx==2*d+1||dx==a)
			t++,nx=a+b+c;
		else
			nx=(x+1)+(x+1)*b/a+(x+1)*c/a;
		if(dy==2*d+1||dy==b)
			t++,ny=a+b+c;
		else
			ny=(y+1)*a/b+(y+1)+(y+1)*c/b;
		if(dz==2*d+1||dz==c)
			t++,nz=a+b+c;
		else
			nz=(z+1)*a/c+(z+1)*b/c+(z+1);
		if(t==3)
			break;
		nxyz=min(min(nx,ny),nz);
		//cout<<nx<<nxyz<<endl;
		if(nxyz==nx){
			tx=1;
			ty=(x+1)*b/a-y;
			tz=(x+1)*c/a-z;
			t=1;
		}
		if(nxyz==ny){
			tx=(y+1)*a/b-x;
			ty=1;
			tz=(y+1)*c/b-z;
			t=2;
		}
		if(nxyz==nz){
			tx=(z+1)*a/c-x;
			ty=(z+1)*b/c-y;
			tz=1;
			t=3;
		}
		//cout<<nx<<ny<<nz<<nxyz<<endl<<endl;
		tx=max((LL)0,min(tx,a-1-x-d));
		ty=max((LL)0,min(ty,b-1-y-d));
		tz=max((LL)0,min(tz,c-1-z-d));
		//cout<<tx<<ty<<tz<<endl;
		ans+=dy*dz%mod*tx%mod;
		ans+=dx*dz%mod*ty%mod;
		ans+=dx*dy%mod*tz%mod;
		ans%=mod;
		x+=tx;
		y+=ty;
		z+=tz;
		if(t==1)
			dx++;
		if(t==2)
			dy++;
		if(t==3)
			dz++;
		//cout<<x<<y<<z<<endl;
	}
	//cout<<ans<<endl;
	ans=(ans+ans)%mod;
	nx=a-1-x;
	ny=b-1-y;
	nz=c-1-z;
	tx=max((LL)0,min(nx-x,a-1-x-d));
	ty=max((LL)0,min(ny-y,b-1-y-d));
	tz=max((LL)0,min(nz-z,c-1-z-d));
	ans+=dy*dz%mod*tx%mod;
	ans+=dx*dz%mod*ty%mod;
	ans+=dx*dy%mod*tz%mod;
	ans%=mod;
	ans+=mod;
	ans-=dx*dy%mod*dz%mod;
	cout<<ans%mod<<endl;
	return 0;
}
/*
3 4 5 2

54
*/

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
    vector<int> vec(3);
    for(int i=0;i<3;i++){
        cin>>vec.at(i);
    }
    sort(vec.begin(),vec.end());
    int k; cin>>k;
    for(int i=0;i<k;i++){
        vec.at(2)*=2;
    }
    cout<<vec.at(0)+vec.at(1)+vec.at(2)<<endl;
}

Measured memory_bytes: 3552
A = int(input())
B = int(input())
C = int(input())
X = int(input())

cnt = 0
for i in range(A+1):
    for j in range(B+1):
        for k in range(C+1):
            money = 500*i+100*j+50*k
            if money == X:
                cnt += 1

print(cnt)


Measured memory_bytes: 9184
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = (s); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) for(int i = (n); i >= 0; i--)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << '\n';
#define CFYN(n) cout << ( (n) ? "YES":"NO") << '\n';
#define OUT(n) cout << (n) << '\n';
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;

int main(void)
{
    IOS
    int n; cin >> n;
    map<int,int> mp;
    REP(i,n) {
        int a; cin >> a;
        FOR(i,a-1,a+2) mp[i]++;
    }
    int ans = 0;
    for(auto p:mp) {
        if (p.second > ans) {
            ans = p.second;
        }
    }

    cout << ans << '\n';

    return 0;
}

Measured memory_bytes: 4736
#include <bits/stdc++.h>
#include <iomanip>
#define rep(i,n)for(long long i=0;i<(n);i++)
using namespace std;
typedef long long ll;
 
const int MOD=1000000007;
const int INF=0x3f3f3f3f;
const ll INFL=0x3f3f3f3f3f3f3f3f;

ll gcd(ll x, ll y) {
	return y ? gcd(y, x % y) : x;
}
ll lcm(ll x,ll y){
  ll g=gcd(x,y);
  return x/g*y;
}


int main() {
  int N, M; cin >> N >> M;
  vector<vector<int>> ab(N);
  rep(i,M){
    int a, b; cin >> a >> b;
    a--; b--;
    ab[a].push_back(b);
    ab[b].push_back(a);
  }
  
  bool ok = false;
  for(int u : ab[0]){
    for( int v : ab[u]){
      if(v == N-1){
        cout << "POSSIBLE" << endl;
        return 0;
      }
    }
  }  
  if(!ok) cout << "IMPOSSIBLE" << endl;  
}

Measured memory_bytes: 12016
#include <bits/stdc++.h>
 
#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)
 
#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=(int)(a)-1;i>=(int)(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)
 
#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define bit(n) (1LL<<(n))
 
// #define DEBUG
 
#ifdef DEBUG
    #define dump(...) fprintf(stderr, __VA_ARGS__)
#else
    #define dump(...)
#endif
 
template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}
 
using namespace std;
using ll=long long;
using vi=vector<int>;
using vll=vector<ll>;
 
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int inf = INT_MAX;
const ll INF = LLONG_MAX;
const ll MOD = 1000000007LL;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
 
ll extgcd(ll a,ll b,ll& x,ll& y){x=1,y=0;ll g=a;if(b!=0) g=extgcd(b,a%b,y,x),y-=a/b*x;return g;}
ll ADD(const ll &a, const ll &b, const ll mod=MOD) { return (a+b)%mod;}
ll SUB(const ll &a, const ll &b, const ll mod=MOD) { return (a-b+mod)%mod;}
ll MUL(const ll &a, const ll &b, const ll mod=MOD) { return (1LL*a*b)%mod;}
ll DIV(const ll &a, const ll &b, const ll mod=MOD) {ll x,y; extgcd(b,mod,x,y);return MUL(a,(x+mod)%mod,mod);}
 
int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);

    int L; cin >> L;
    using R = double;

    R l = L / 3.0;
    cout.precision(12);
    cout << fixed << l * l * l << endl;

    return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
#define int long long
#define ll long long
using namespace std;
ll read()
{
	char c;
	ll w=1;
	while((c=getchar())>'9'||c<'0')if(c=='-')w=-1;
	ll ans=c-'0';
	while((c=getchar())>='0'&&c<='9')ans=(ans<<1)+(ans<<3)+c-'0';
	return ans*w;
}
ll ss[1000005];
ll n,m;
const ll mod=998244353;
struct segment//注意是倒着的 
{
	ll sum[800005];
	ll add[800005];
	void clear()
	{
		memset(add,-1,sizeof(add));
	}
	void Add(int k,int l,int r,int d)
	{
		add[k]=d;
		sum[k]=d*(ss[r]-ss[l-1]+mod)%mod;
	}
	void pushdown(int k,int l,int r)
	{
		if(add[k]!=-1)
		{
			int mid=l+r>>1;
			Add(k<<1,l,mid,add[k]);
			Add(k<<1|1,mid+1,r,add[k]);
			add[k]=-1;
		}
	}
	void change(int k,int l,int r,int x,int y,int dgt)
	{
		if(r<x||y<l)
		{
			return;
		}
		if(x<=l&&r<=y)
		{
			Add(k,l,r,dgt);
			return;
		}
		pushdown(k,l,r);
		int mid=l+r>>1;
		change(k<<1,l,mid,x,y,dgt);
		change(k<<1|1,mid+1,r,x,y,dgt);
		sum[k]=(sum[k<<1]+sum[k<<1|1])%mod;
	}
	int ask(int k,int l,int r,int x,int y)
	{
		if(r<x||y<l)
		{
			return 0;
		}
		if(x<=l&&r<=y)
		{
			return sum[k]%mod;
		}
		pushdown(k,l,r);
		int mid=l+r>>1;
		ll ans=0;
		ans+=ask(k<<1,l,mid,x,y);
		ans+=ask(k<<1|1,mid+1,r,x,y);
		return ans%mod;
	}
}tree[10];
signed main(){
	ss[1]=1;
	for(int i=2;i<=200000;i++)
	{
		ss[i]=ss[i-1]*10+1;
		ss[i]%=mod;
	}
	n=read();
	m=read();
	for(int i=1;i<=9;i++)
	{
		tree[i].clear();
	}
	tree[1].change(1,1,n,1,n,1);
//	cout<<tree[1].ask(1,1,n,1,n)<<endl;
	for(int i=1;i<=m;i++)
	{
		ll a,b,c;
		a=read();
		b=read();
		c=read();
		ll aa=n-b+1;
		ll bb=n-a+1;
		for(int j=1;j<=9;j++)
		{
			tree[j].change(1,1,n,aa,bb,0);
		}
		tree[c].change(1,1,n,aa,bb,1);
		ll ans=0;
		for(int j=1;j<=9;j++)
		{
//			cout<<tree[i].ask(1,1,n,1,n)<<endl;
			ans+=tree[j].ask(1,1,n,1,n)*j;
			ans%=mod;
		}
		printf("%lld\n",ans);
	}
	return 0;
}

Measured memory_bytes: 98552
#include<bits/stdc++.h>
#define pb push_back
#define ll long long
#define rep(i, l, r)  for(int i = l; i <= r; i++)
#define PII pair<int,int>
using namespace std;
const int inf = 0x3f3f3f3f;
const int mod = 1000000007;
const int maxn = 1000005;
inline int read(){
    int x=0,f=1;char c=getchar();
    for(;!isdigit(c);c=getchar()) if(c=='-') f=-1;
    for(;isdigit(c);c=getchar()) x=x*10+c-'0';
    return x*f;
}
ll sum[maxn];
int main() {
   int n = read(), k = read();
   rep(i, 0, n) sum[i] = sum[i-1] + i;
   ll w = 0;
   rep(i, k-1, n) {
       w = (w + sum[n] - sum[n-i-1] - sum[i] + 1) % mod;
   }
   cout << w << endl;
}


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

using namespace std;

int main()
{
	string num;
  cin>>num;
  int output = 0;
  for( int i = 0 ; i < num.size() ; i++ ) 
  {
    int x = num[i]-'0';
    output = output+x;
    output = output%9;
  }
  if( output == 0 )	cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
  return 0;
}

Measured memory_bytes: 3700
#include <iostream>
#include <cstring>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <set>
#include <utility>
#include <cstdlib>
#include <queue>
#include <stack>
#include <iomanip>
#include <cstdio>
#include <map>

using namespace std;

using ll = long long;
using P = pair<ll,ll>;

#define rep(i,x) for(ll i = 0; i < (ll)(x); i++)
#define rrep(i,x) for(ll i = ((ll)(x) - 1); i >= 0; i--)

#define _upgrade ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define all(x) (x).begin(), (x).end()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

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

//ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
//ll lcm(ll x, ll y) {return x / gcd(x, y) * y;}

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

const ll mod = 1e9 + 7;
const ll IMF = 1LL << 60;
const double PI = 3.14159265358979323846;


// ****************************************CODE***************************************//





//入力
int N,K;
ll h[100010];

//dpテーブル
ll dp[100100];


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

        //初期化（最小化問題なのでIMFに初期化)
        for(int i = 0; i < 100100; i++) dp[i] = IMF;

        //初期条件
        dp[0] = 0;


        //ループ
        for(int i = 0; i < N; i++){
                for(int j = 1; j <= K; j++){
                        chmin(dp[i+j], dp[i]+abs(h[i]-h[i+j]));
                }
        }

        //答え
        cout << dp[N-1] << endl;
        return 0;
}















































Measured memory_bytes: 1792
import Data.Maybe
import Text.Printf
import Control.Monad
import qualified Data.ByteString.Char8 as C

parseInt :: C.ByteString -> Int
parseInt = fst . fromJust . C.readInt

readInts :: IO [Int]
readInts = map parseInt . C.words <$> C.getLine

main :: IO ()
main = do
  [n, d] <- readInts
  ans <- length . filter (\[x, y] -> x * x + y * y <= d * d) <$> replicateM n readInts
  printf "%d\n" ans


Measured memory_bytes: 55268
#include<stdio.h>
#include<iostream>
#include<list>
#include<map>
#include<vector>
#include<algorithm>
#include<string.h>
#include<iomanip>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) range(i,0,b)
#define debug(x) cout << x << endl;
using namespace std;

int main(){
    int candy, num;
    while(cin >> candy){
        num = candy % 39;
        if(num == 0) num = 39;
        cout << "3C";
        cout << setfill('0');
        cout << setw(2) << num << endl;
    }
}

Measured memory_bytes: 1168
//list index out of rangeエラー表示用
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep1(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#include <stdio.h>

int main(){
  string S;
  cin >> S;
  int q;
  cin >> q;
  int count_t1 = 0;
  string f_1, f_2;
  rep1(i, q){
    int t;
    scanf("%d", &t);
    if(t == 1){
      count_t1 += 1;
    }
    else if(t == 2){
      int f;
      scanf("%d", &f);
      char c;
      scanf(" %c", &c);
      if(count_t1%2 == 0){//反転してない
        if(f == 1){
          f_1.push_back(c);
        }
        else if(f == 2){
          f_2.push_back(c);
        }
      }
      else{//反転してる
        if(f == 1){
          f_2.push_back(c);
        }
        else if(f == 2){
          f_1.push_back(c);
        }
      }
    }
  }

  if(count_t1%2 == 0){
    reverse(f_1.begin(), f_1.end());
    cout << f_1 + S + f_2;
  }
  else{
    reverse(f_2.begin(), f_2.end());
    reverse(S.begin(), S.end());
    cout << f_2 + S + f_1;
  }
}

Measured memory_bytes: 4388
n, s = open(0).read().split()

s = list(map(int, list(s)))

from itertools import product,repeat

ans = 0
for a,b,c in product(range(10), range(10), range(10)):
    abc = [a,b,c]
    tmp = 0
    for dig in s:
        if dig == abc[tmp]:
            tmp += 1
            if tmp == 3:
                ans += 1
                break

print(ans)

Measured memory_bytes: 75704
n = int(input())
a_li = list(map(int,input().split()))
b_li = list(map(int,input().split()))

kaisu = 0
ukeire = 0
for a,b in zip(a_li,b_li):
    if a>b:
        kaisu += a-b
    elif a<b:
        ukeire += (b-a)//2
if ukeire >= kaisu:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 40688
/*
 * by purple
 * at 12-01-01 10:50:50
 */

#include <cstdio>
#include <algorithm>
#include <cstring>
#include <vector>

using namespace std;

#define sz(x) ((int)((x).size()))
#define out(x) printf(#x" %d\n", x)
#define rep(i,n) for(int i=0;i<(n);++i)
#define repf(i,a,b) for(int i=(a);i<=(b);++i)

const int maxn = 123456 * 2 + 10;

bool f[maxn];
int prime[22000], cnt = 0, n;

void makePrime() {
    for (int i = 2; i < maxn; ++i) {
        if (!f[i]) {
            prime[cnt++] = i;
        }
        for (int j = 0; j < cnt && i * prime[j] < maxn; ++j) {
            f[i * prime[j]] = true;
            if (i % prime[j] == 0) {
                break;
            }
        }
    }
}

int main() {
    makePrime();
    
    while (scanf ("%d", &n), n) {
        printf ("%d\n", upper_bound(prime, prime + cnt, 2 * n) - upper_bound(prime, prime + cnt, n));
    }
    return 0;
}

Measured memory_bytes: 0
import java.io.*;
import java.util.*;

public class Main{

    public static void main(String args[]) throws IOException{
	BufferedReader br=new BufferedReader(new InputStreamReader(System.in));

	int n=Integer.parseInt(br.readLine());

	for(int i=0;i<n;i++){
	    String str1=br.readLine();
	    String str2=br.readLine();

	    System.out.println(lcs(str1,str2));
	}
    }
    
    static int lcs(String str1,String str2){
	int m=str1.length();
	int n=str2.length();

	str1=" "+str1+" ";
	str2=" "+str2+" ";

	String s1[]=str1.split("");
	String s2[]=str2.split("");

	
	int c[][]=new int[m+1][n+1];

	int max=0;

	for(int i=0;i<=m;i++){
	    c[i][0]=0;
	}

	for(int i=0;i<=n;i++){
	    c[0][i]=0;
	}

	for(int i=1;i<=m;i++){
	    for(int j=1;j<=n;j++){
		if(s1[i].equals(s2[j])){
		    c[i][j]=c[i-1][j-1]+1;
		}else{
		    c[i][j]=Math.max(c[i-1][j],c[i][j-1]);
		}
		max=Math.max(max,c[i][j]);
	    }
	}

	return max;
    }
}



Measured memory_bytes: 61764
#include<iostream>
#include<vector>
#include<set>
#include<unordered_set>
#include<list>
#include<stack>
#include<queue>
#include<map>
#include<unordered_map>
#include<algorithm>
#include<cmath>
#include<tuple>
#include<iomanip>
#include<climits>
#define ll long long int
#define mod 1000000007
#define pi acos(-1)
using namespace std;

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int n;
	cin>>n;
	cout<<(n+1)/2;
	return 0;
}

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

#define rep(i, N) for(int (i) = 0; (i) < (N); (i) ++)
typedef long long ll;
using namespace std;

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

ll lcm(ll a, ll b){
    return a / gcd(a, b) * b;
}

int main(){
    int N;
    ll ans = 1;
    ll now;
    cin >> N;
    rep(i, N){
        cin >> now;
        ans = lcm(now, ans);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long x,y,t,s,i=1;
    cin>>x>>y;
    if(x>y)
    {
    t=x;
    x=y;
    y=t;
	}
	s=y*i;
	while(s%x!=0)
	{
	i++;
	s=y*i;
	} 
	cout<<s<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<iomanip>
#include<ctime>
#include<set>
#include<map>
#include<queue>
#include<stack>
#define sqr(x) ((x)*(x))
#define fz1(i,n) for ((i)=1;(i)<=(n);(i)++)
#define fd1(i,n) for ((i)=(n);(i)>=1;(i)--)
#define fz0g(i,n) for ((i)=0;(i)<=(n);(i)++)
#define fd0g(i,n) for ((i)=(n);(i)>=0;(i)--)
#define fz0k(i,n) for ((i)=0;(i)<(n);(i)++)
#define fd0k(i,n) for ((i)=(long long)((n)-1);(i)>=0;(i)--)
#define fz(i,x,y) for ((i)=(x);(i)<=(y);(i)++)
#define fd(i,y,x) for ((i)=(y);(i)>=(x);(i)--)
#define fzin fz1(i,n)
#define fzim fz1(i,m)
#define fzjn fz1(j,n)
#define fzjm fz1(j,m)
#define ff(c,itr) for (__typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)
#define rdst(st,len){static char ss[len];scanf(" %s",ss);(st)=ss;}
#define inc(x,y) {x+=(y);if(x>=mod)x-=mod;}
#define dec(x,y) {x-=(y);if(x<0)x+=mod;}
using namespace std;
int n,m,i,j,mod=1e9+7,ans,sss,a[2005];
int main()
{
	scanf("%d%d",&n,&m);
	fz1(i,n){
		scanf("%d",&a[i]);
	}
	fz1(i,n)fz(j,i+1,n)if(a[i]>a[j])ans++;
	fz1(i,n)fz1(j,n)if(a[i]>a[j])sss++;
	ans=(1ll*ans*m+sss*(1ll*m*(m-1)/2%mod))%mod;
	cout<<ans<<endl;
	return 0;
}

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

vector <int> mods(2020) ,temp(2020);

int main()
{
    string s;
    cin >> s;
    mods[0] = 1;
    int all = 0 ,ans = 0;
    for(int i=0; i<s.size(); i++){
        for(int m=0; m<2020; m++)
            temp[m] = 0;
        for(int m=0; m<2020; m++)
            temp[m*10%2019] += mods[m];
        swap(mods ,temp);
        all *= 10;
        all += s[i]-'0';
        all %= 2019;
        ans += mods[all];
        mods[all]++;
    }
    printf("%d\n",ans);
}


Measured memory_bytes: 3872
N=int(input())
if N==2:
    print(1)
    exit()
DN={N}
k=2
while(k*k<=N):
    if N%k==0:
        DN.add(k)
        DN.add(N//k)
    k+=1
DN1={N-1}
k=2
while(k*k<=(N-1)):
    if (N-1)%k==0:
        DN1.add(k)
        DN1.add((N-1)//k)
    k+=1
DN=sorted(list(DN))
DN1=sorted(list(DN1))
#print(DN)
#print(DN1)
ans=set()
for K in DN:
    tmp=N
    while(tmp>=K):
        if tmp%K==0:
            tmp//=K
        else:
            tmp%=K
    if tmp==1:
        ans.add(K)
for K in DN1:
    tmp=N
    while(tmp>=K):
        if tmp%K==0:
            tmp//=K
        else:
            tmp%=K
    if tmp==1:
        ans.add(K)


#print(ans)
print(len(ans))


Measured memory_bytes: 40304
pub fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

pub fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

pub fn read_vec2<T: std::str::FromStr>(n: usize) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}

pub fn read_col<T: std::str::FromStr>(n: usize) -> Vec<T> {
    (0..n).map(|_| read()).collect()
}

fn main() {
    let n: usize = read();
    let p: Vec<usize> = read_col(n);

    let mut dp: Vec<usize> = vec![0; n + 1];

    for i in 0..n {
        dp[p[i]] = dp[p[i] - 1] + 1;
    }

    let mut tmp = 0;

    for j in 1..n + 1 {
        if dp[j] > tmp {
            tmp = dp[j];
        }
    }

    println!("{}", n - tmp);
}


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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

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

signed main(){
	int x,a,b;
	cin>>x>>a>>b;

	int n;cin>>n;
	int h=x;
	rep(i,n){
		string s;cin>>s;
		if(s[0]=='n')h+=a;
		else if(s[0]=='t')h+=b;
		else h=0;
		chmax(h,0ll);
	}
	cout<<h<<endl;
	return 0;
}


Measured memory_bytes: 3208
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
int main()
{
   ll n,m,ans,a,b,i,j,t;
   while(cin>>n)
   {
       ans=0;
       for(i=1;i<=n;i++)
       {
           cin>>a>>b;
           ans+=(b-a+1);
       }
       cout<<ans<<endl;
   }
   return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>

typedef struct {
	double x;
	double y;
}point;

void kock(int d, point p1, point p2) {
	point s, t, u;
	double rad60 = M_PI / 3;
	if (d == 0) return;

	s.x = (2 * p1.x + 1 * p2.x)/3;
	s.y = (2 * p1.y + 1 * p2.y) / 3;
	t.x = (1 * p1.x + 2 * p2.x) / 3;
	t.y = (1 * p1.y + 2 * p2.y) / 3;
	u.x = (t.x - s.x) * cos(rad60) - (t.y - s.y) * sin(rad60) + s.x;
	u.y = (t.x - s.x) * sin(rad60) + (t.y - s.y) * cos(rad60) + s.y;

	kock(d - 1, p1, s);
	printf("%f %f\n", s.x, s.y);
	kock(d - 1, s, u);
	printf("%f %f\n", u.x, u.y);
	kock(d - 1, u, t);
	printf("%f %f\n", t.x, t.y);
	kock(d - 1, t, p2);
}

int main(){
	int n;
	point p1 = {0.0,0.0},p2 = {100.0,0.0};
	scanf("%d",&n);

	printf("%f %f\n", p1.x, p1.y);
	kock(n, p1, p2);
	printf("%f %f\n", p2.x, p2.y);

	return 0;
}



Measured memory_bytes: 2064
s = input()
n = len(s)
s2 = s[:(n-1)//2]
s3 = s[(n+3)//2-1:]
flug = True
for i in range(len(s)//2):
    end = -i - 1
    if s[i] != s[end]:
        flug = False
        break
for i in range(len(s2)//2):
    end = -i - 1
    if s2[i] != s2[end]:
        flug = False
        break
for i in range(len(s3)//2):
    end = -i - 1
    if s3[i] != s3[end]:
        flug = False
        break
if flug: print("Yes")
else: print("No")

Measured memory_bytes: 38256
#include <map>
#include <cmath>
#include <vector>
#include <string>
#include <iostream>
#include <algorithm>
using namespace std;
 
int main() {
	int n;
	string s, t;
	cin >> n >> s >> t;
	bool flag = false;
	
	for(int i = 0; i < s.length(); i++){
		flag = true;
		for(int j = 0; j < t.length(); j++){
			if(i + j >= n){
				break;
			}
			if(s[i+j] != t[j]){
				flag = false;
				break;
			}
		}
		if(flag){
			cout << i + n << endl;
			return 0;
		}
	}
	
	cout << 2 * n << endl;
	
	return 0;
}

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

#define MAX_N 1000
#define MAX_M 2000

struct Edge{
    int v[2], cost;
    Edge(){}
    Edge(int a, int b, int c) {
        v[0] = a; v[1] = b; cost = c;
    }
};

int n, m, r, d[MAX_N];
Edge E[MAX_M];

void shortest_path(){
    fill(d, d + n, INT_MAX);
    d[r] = 0;
    for(int cnt = 0; ; cnt++){
        if(cnt == n){
            cout << "NEGATIVE CYCLE" << endl;
            return;
        }
        bool update = true;
        for(int j = 0; j < m; j++){
            int s = E[j].v[0], t = E[j].v[1], w = E[j].cost;
            if(d[s] != INT_MAX && d[s] + w < d[t]){
                d[t] = d[s] + w;
                update = false;
            }
        }
        if(update) break;
    }
    for(int i = 0; i < n; i++){
        cout << (d[i] == INT_MAX ? "INF" : to_string(d[i])) << endl;
    }
    return;
}

int main(){
    cin >> n >> m >> r;
    for(int i = 0; i < m; i++){
        int s, t, d;
        cin >> s >> t >> d;
        E[i] = Edge(s, t, d);
    }
    shortest_path();
    return 0;
}


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

int main(){
  int N,M;
  cin>>N>>M;
  std::vector<int> p(N),v(N);
  for(int i=0;i<N;i++){cin>>p[i];p[i]--;}
  for(int i=0;i<N;i++)v[i]=i;
  int x,y;
  for(int i=0;i<M;i++){
    cin>>x>>y;
    x--;y--;
    int xx,yy;
    xx=x;yy=y;
    int xo,yo;
    xo=yo=0;
    //cout<<1;
    while(v[xx]!=xx){xx=v[xx];xo++;}
    while(v[yy]!=yy){yy=v[yy];yo++;}
    //cout<<2;
    if(xo>yo)v[yy]=v[xx];
    else v[xx]=v[yy];
  }
  int ans=0;
  //cout<<3;
  for(int i=0;i<N;i++){
    //cout<<4;
    int ix,jx;
    ix=i;
    jx=p[i];
    while(v[ix]!=ix)ix=v[ix];
    while(v[jx]!=jx)jx=v[jx];
    if(ix==jx)ans++;
  }
  cout<<ans<<endl;
  //for(int i=0;i<N;i++)cout<<v[i]<<endl;
}


Measured memory_bytes: 1024
#include <iostream>
using namespace std;
int main(void){
    bool ans;
    char N, W;
    cin >> N;
    cin >> W; 
    cin >> N >> W;
    ans = 0;
    if(N==W){
    }else{
        ans = 1;
    }
    cin >> N >> W;
    if(N==W){
    }else{
        ans = 1;
    }
    if(ans==1){
        cout << "No";
    }else{
        cout << "Yes";
    }
}


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

int main(){
  char A,B,C,D;
  cin >> A >> B >> C >> D;
  int a=A-'0',b=B-'0',c=C-'0',d=D-'0';
  if(a+b+c+d==7)cout <<a<<"+"<<b<<"+"<<c<<"+"<<d<<"=7"<<endl;
  else if(a-b+c+d==7)cout <<a<<"-"<<b<<"+"<<c<<"+"<<d<<"=7"<<endl;
  else if(a+b-c+d==7)cout <<a<<"+"<<b<<"-"<<c<<"+"<<d<<"=7"<<endl;
  else if(a+b+c-d==7)cout <<a<<"+"<<b<<"+"<<c<<"-"<<d<<"=7"<<endl;
  else if(a-b-c+d==7)cout <<a<<"-"<<b<<"-"<<c<<"+"<<d<<"=7"<<endl;
  else if(a-b+c-d==7)cout <<a<<"-"<<b<<"+"<<c<<"-"<<d<<"=7"<<endl;
  else if(a+b-c-d==7)cout <<a<<"+"<<b<<"-"<<c<<"-"<<d<<"=7"<<endl;
  else if(a-b-c-d==7)cout <<a<<"-"<<b<<"-"<<c<<"-"<<d<<"=7"<<endl;
}

Measured memory_bytes: 256