akhauriyash/Code-Regression huggingface dataset:
IDENTIFICATION DIVISION.
PROGRAM-ID. A-BEGINNER.
 
DATA DIVISION.
WORKING-STORAGE SECTION.
01 INP     PIC X(100).
01 IN-DATA.
   03 DT-X1 PIC X(10).
   03 DT-X2 PIC X(10).
   03 DT-X3 PIC X(10).
01 IN-LEN.
   03 DT-L1 PIC 9(2).
   03 DT-L2 PIC 9(2).
   03 DT-L3 PIC 9(2).
01 IN-N     PIC 9(3).
01 IN-NUM.
   03 IN-NO PIC 9(3)    OCCURS 10.

01 I        PIC 9(2).
01 X        PIC 9(2). 
01 Y        PIC 9(2). 
01 SW-HIT   PIC X.

01 TBL-MATRIX.
   03 TBL-Y     OCCURS 3.
     05 TBL-X   OCCURS 3.
       07 TBL-A PIC 9(3).
01 TBL-BINGO.
   03 TBL-BX    PIC 9(2) OCCURS 3.
   03 TBL-BY    PIC 9(2) OCCURS 3.
   03 TBL-BS    PIC 9(2) OCCURS 2.

PROCEDURE DIVISION.
MAIN-001.
  PERFORM VARYING I FROM 1 BY 1 UNTIL I > 3
    ACCEPT INP
    UNSTRING INP DELIMITED BY ALL ' '
        INTO DT-X1 COUNT IN DT-L1
             DT-X2 COUNT IN DT-L2
             DT-X3 COUNT IN DT-L3
    MOVE DT-X1(1:DT-L1) TO TBL-A(I 1)
    MOVE DT-X2(1:DT-L2) TO TBL-A(I 2)
    MOVE DT-X3(1:DT-L3) TO TBL-A(I 3)
  END-PERFORM. 

  ACCEPT INP.
  UNSTRING INP DELIMITED BY ALL ' '
      INTO DT-X1 COUNT IN DT-L1.
  MOVE DT-X1(1:DT-L1) TO IN-N.

  PERFORM VARYING I FROM 1 BY 1 UNTIL I > 3
    MOVE 0 TO TBL-BX(I)
    MOVE 0 TO TBL-BY(I)
  END-PERFORM.
  MOVE   0 TO TBL-BS(1).
  MOVE   0 TO TBL-BS(2).  

  PERFORM VARYING I FROM 1 BY 1 UNTIL I > IN-N
    ACCEPT INP
    UNSTRING INP DELIMITED BY ALL ' '
        INTO DT-X1 COUNT IN DT-L1
    MOVE DT-X1(1:DT-L1) TO IN-NO(I)

    MOVE '0' TO SW-HIT
    PERFORM VARYING Y FROM 1 BY 1 UNTIL Y > 3 OR SW-HIT = '1'
      PERFORM VARYING X FROM 1 BY 1 UNTIL X > 3 OR SW-HIT = '1'
        IF IN-NO(I) = TBL-A(Y X)
           ADD  1   TO TBL-BX(X)
           ADD  1   TO TBL-BY(Y)
           IF (X = Y)
             ADD 1  TO TBL-BS(1)
           END-IF
           IF (X + Y = 4)
             ADD 1  TO TBL-BS(2)
           END-IF
 
           MOVE '1' TO SW-HIT
        END-IF
      END-PERFORM 
    END-PERFORM
  END-PERFORM.
  
  MOVE '0' TO SW-HIT
  PERFORM VARYING I FROM 1 BY 1 UNTIL I > 3 OR SW-HIT = '1'
    IF (TBL-BX(I) >= 3) OR (TBL-BY(I) >= 3)
      MOVE '1' TO SW-HIT
    END-IF 
  END-PERFORM.
  IF (SW-HIT = '1' ) OR (TBL-BS(1) >= 3) OR (TBL-BS(2) >= 3)
    DISPLAY 'Yes'
  ELSE
    DISPLAY 'No' 
  END-IF.
MAIN-EXIT.
  STOP RUN.

Measured memory_bytes: 384
#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
typedef long long ll;
ll a,b,c;
int main(void){
    scanf("%lld%lld%lld",&a,&b,&c);
    if(a%2==0||b%2==0||c%2==0)printf("0\n");
    else printf("%lld\n",min(a*b,min(b*c,c*a)));
}

Measured memory_bytes: 256
while True:
    T, P, R = map(int, raw_input().split())
    if T == P == R == 0:
        break
    wrong = [[0 for i in xrange(P)] for j in xrange(T)]
    pen = [[0 for i in xrange(P)] for j in xrange(T)]
    for i in xrange(R):
        t, p, time, mes = raw_input().split()
        t = int(t) - 1
        p = int(p) - 1
        time = int(time)
        if pen[t][p] == 0:
            if mes == 'CORRECT':
                pen[t][p] = wrong[t][p] * 1200 + time
            else:
                wrong[t][p] += 1
    result = []
    for i in xrange(T):
        result.append((p - sum(map(lambda x: x != 0, pen[i])), sum(pen[i]), i + 1))
    result.sort()
    for r in result:
        print r[2], p - r[0], r[1]

Measured memory_bytes: 4280
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <math.h>
#include <algorithm>
#include <string>
#include <string.h>
#include <vector>
#include <functional>
#include <queue>
#include <unordered_set>
#include <climits>
#include <set>
#include <list>
#include <cmath>
#include <map>

using namespace std;
typedef long long ll;

int main()
{
	int A, B, C, K;
	cin >> A >> B >> C >> K;
	int count = 0;
	while(A >= B){
		B *= 2;
		count++;
	}
	while(B >= C){
		C *= 2;
		count++;
	}
	if(count <= K){
		cout << "Yes" << endl;
	}else{
		cout << "No" << endl;
	}
	return 0;
}


Measured memory_bytes: 3620
//INCLUDE
//------------------------------------------
#include <bits/stdc++.h>
//DEFINE
//------------------------------------------
#define ll long long
#define ld long double
#define ALLv(a)  (a).begin(),(a).end()
#define ALL(a,n)  (a),(a)+n
#define vi vector<long long>
#define vd vector<long double>
#define vs vector<string>
//CONST
//------------------------------------------
#define INF 1010000000000000017LL
#define MOD 1000000007LL
#define EPS 1e-12
#define PI 3.14159265358979323846
//REPEAT
//------------------------------------------
#define   FOR(i,m,n) for(ll (i)=(m);   (i)<(n);  (i)++)
#define   REP(i,n)   for(ll (i)=0;     (i)<(n);  (i)++)
#define  REPS(i,x)   for(ll (i)=1;     (i)<=(x); (i)++)
#define  RREP(i,x)   for(ll (i)=(x)-1; (i)>=0;   (i)--)
#define RREPS(i,x)   for(ll (i)=(x);   (i)> 0;   (i)--)
#define  WREP(i,in,j,jn) REP(i,in)REP(j,jn)
//-----------------------------------------
#define dcml(n) fixed<<setprecision(n)
using namespace std;
int main(void){
    ll N,A,B;cin>>N>>A>>B;
    string S;cin>>S;
    ll cnt=0,cntB=0;
    REP(i,N){
        if(S[i]=='a'){
            //A+B
            if(cnt<A+B){
                cnt++;
                cout<<"Yes\n";
            }else{
                cout<<"No\n";
            }
        }
        else if(S[i]=='b'){
            //A+B & B以内
            if(cnt<A+B && cntB<B){
                cnt++;cntB++;
                cout<<"Yes\n";
            }else{
                cout<<"No\n";
            }
        }
        else if(S[i]=='c'){
            cout<<"No"<<"\n";
        }
    }
}

Measured memory_bytes: 896
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using mii = map<int, int>;
const int INF = 1e9;
const ll LINF = 1e18;
#define MP(a,b) make_pair((a),(b))
#define MT(...) make_tuple(__VA_ARGS__)

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

#define ALL(x) (x).begin(),(x).end()
#define IN(type,a) type a;cin >> a
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define COUT(x) cout << (x) << endl
#define DCOUT(x,n) cout << fixed << setprecision(n) << (x) << endl



int main() {
    int ajapa;
    IN(int, n);
    IN(int, x);
    IN(int, y);
    vi ans(n,0);
    REPS(i, n-1){
        if (i <= x) {
            for (int j = i; j<y; j++) {
                ajapa = min(j-i, y-j+x-i+1);
                ans[ajapa]++;
            }
            for (int j = y; j <= n; j++) {
                ans[x-i+j-y+1]++;
            }
        }else if(i<y){
            for (int j = i; j<y; j++) {
                ajapa = min(j-i, y-j+i-x+1);
                ans[ajapa]++;
            }
            for (int j = y; j <= n; j++) {
                
                ajapa = min(j-i, j-y+i-x+1);
                ans[ajapa]++;
            }
        }else{
            for (int j = i+1; j<=n; j++) {
                ans[j-i] ++;
            }
        }
    }
    
    REPS(i, n-1){
        COUT(ans[i]);
    }
    return 0;
}





Measured memory_bytes: 256
using System;

namespace ABC122_b
{
    class Program
    {
        static void Main(string[] args)
        {
            int count = 0;
            int max = 0;
            string array = Console.ReadLine();
            for (int i = 0; i < array.Length; i++ )
            {
                char ch = array[i];
                if((ch == 'A') ||(ch == 'C') || (ch == 'G') || (ch =='T'))
                {
                     count++;
                    if(max < count)
                    {
                        max = count;
                    }
                }else
                {
                    count = 0;
                }
            }
            Console.WriteLine(max);
        }
    }
}


Measured memory_bytes: 13140
use io::*;

fn main() {

    let con = read_string();
    let mut sc = Scanner::new(&con);

    let a: usize = sc.next();
    let b: usize = sc.next();
    let c: usize = sc.next();
    let x: usize = sc.next();

    let mut sum: usize = 0;
    let mut ans: usize = 0;
    for i in 0..a+1 {
        for j in 0..b+1 {
            for k in 0..c+1 {
                sum += 500 * i + 100 * j + 50 * k;
                if sum == x {
                    ans += 1;
                }
                sum = 0;
            }
        }
    }
    println!("{}", ans);
}

pub mod io {

    use std;
    use std::str::FromStr;

    pub struct Scanner<'a> {
        iter: std::str::SplitWhitespace<'a>,
    }

    impl<'a> Scanner<'a> {
        pub fn new(s: &'a str) -> Scanner<'a> {
            Scanner {
                iter: s.split_whitespace(),
            }
        }

        pub fn next<T: FromStr>(&mut self) -> T {
            let s = self.iter.next().unwrap();
            if let Ok(v) = s.parse::<T>() {
                v
            } else {
                panic!("Parse error")
            }
        }

        pub fn next_vec_len<T: FromStr>(&mut self) -> Vec<T> {
            let n: usize = self.next();
            self.next_vec(n)
        }

        pub fn next_vec<T: FromStr>(&mut self, n: usize) -> Vec<T> {
            (0..n).map(|_| self.next()).collect()
        }
    }

    pub fn read_string() -> String {
        use std::io::Read;

        let mut s = String::new();
        std::io::stdin().read_to_string(&mut s).unwrap();
        s
    }

    pub fn read_line() -> String {
        let mut s = String::new();
        std::io::stdin().read_line(&mut s).unwrap();
        s.trim_right().to_owned()
    }
}

Measured memory_bytes: 4476
#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
using namespace std;

int main()
{
    int n;
    cin >> n;
    vector<double> A(n);
    double sum = 0;
    rep(i, n) {
        cin >> A.at(i);
        sum += 1 / A.at(i);
    }

    cout << fixed << setprecision(10) << 1 / sum << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<cstdint>
#include<cstdlib>
template<typename T>
void fin(T const& t){ std::cout << t << std::endl; exit(0); }

int main() {
  std::cin.tie(0); std::ios::sync_with_stdio(false);
  int N; std::cin >> N;
  std::vector<int64_t> A(N+1), B(N+1);
  for(int i = 0; i <= N; ++i) std::cin >> A[i];
  if(N == 0){
    if(A[0] != 1) fin(-1);
    fin(1);   
  }
  int64_t sum = 0;
  for(int i = 0; i <= N; ++i) sum += A[i];
  B[0] = 1 - A[0];
  sum -= A[0];
  if(B[0] > sum) fin(-1);
  for(int i = 0; i < N; ++i) {
    // B[i+1] <= min(2B[i] - A[i+1], sum.A[i+2, ..., N];
    sum -= A[i+1];
    B[i+1] = std::min(B[i]*2-A[i+1], sum);
    if(B[i+1] < 0) fin(-1);
  }
  int64_t ans = 0;
  for(int i = 0; i <= N; ++i) ans += A[i]+B[i];
  fin(ans);
  return 0;
}


Measured memory_bytes: 5224
#include "bits/stdc++.h"
#include "math.h"
 
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<int> vin;
typedef vector<pair<ll,ll> > vp;
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
const int MOD = 1000000007;
const int MAX = 510000;


int main(){
  ll x,sum=0,c=0;cin>>x;
  rep(i,1,x+1){
    c++;sum+=i;
    if(sum>=x){cout<<c<<endl;break;}
  }
}



Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cmath>
/*a, b とその間の角 C から、その三角形の面積 S、周の長さ L, a を底辺としたときの高さ h を求めるプログラムを作成して下さい。*/
using namespace std;

int main(){
	double pi = 3.141592653589793;
	//(xpi)/180
	double a, b, C;
	cin >> a >> b >> C;
	double rad =  (C * pi) / 180;
	cout << setprecision(15);
	cout << (a * sin(rad) * b) / 2 << '\n';
	double c = sqrt(a * a + b * b - (2 * a * b * cos(rad)));
	cout << a + b + c << '\n';
	//sinB
	double sinB = b * sin(rad) / c;
	cout <<  c * sinB << endl;
}



Measured memory_bytes: 3420
#include<bits/stdc++.h>
using namespace std;
#define mod 1000000007
void add_self(int& a, int b) {
    a += b;
    if(a >= mod) {
        a -= mod;
    }
}
void sub_self(int& a, int b) {
    a -= b;
    if(a < 0) {
        a += mod;
    }
}
 
int main() {
    int n, k;
    scanf("%d%d", &n, &k);
    vector<int> dp(k + 1);
    // dp[i] - the number of ways such that we used i candies so far
    dp[0] = 1;
    for(int child = 0; child < n; ++child) {
        int up_to;
        scanf("%d", &up_to);
        vector<int> fake(k + 1);
        for(int used = k; used >= 0; --used) {
            int tmp = dp[used];
            int L = used + 1;
            int R = used + min(up_to, k - used);
            if(L <= R) {
                add_self(fake[L], tmp);
                if(R + 1 <= k) {
                    sub_self(fake[R+1], tmp);
                }
            }
            //~ for(int i = L; i <= R; ++i) {
                //~ add_self(dp[i], tmp);
            //~ }
        }
        int prefix_sum = 0;
        for(int i = 0; i <= k; ++i) {
            add_self(prefix_sum, fake[i]);
            add_self(dp[i], prefix_sum);
        }
    }
    printf("%d\n", dp[k]);
}

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

const int INF = 1e9 + 5;

int main() {
	int n, k;
	scanf("%d%d", &n, &k);

	vector<int> h(n);
	for (int& x : h)
		scanf("%d", &x);

	vector<int> dp(n, INF);
	dp[0] = 0;

	for (int i = 0; i < n; i++) {
		for (int j = i + 1; j <= i + k; j++) {
			if (j < n) {
				dp[j] = min(dp[j], dp[i] + abs(h[i] - h[j]));
			}
		}
	}
	printf("%d\n", dp.back());
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define all(vec) vec.begin(), vec.end()
#define END return 0
typedef int64_t ll;
const int mod7 = 1e9 + 7;
const int mod9 = 1e9 + 9;
const int inf = 1 << 30;
const ll INF = 1LL << 60;
template<typename T> T gcd(T a, T b) {return b ? gcd(b, a % b) : abs(a);}
template<typename T> T lcm(T a, T b) {return a / gcd(a, b) * b;}
template<typename T> bool chmax(T &a, T b) {if (a < b) {a = b; return true;} return false;}
template<typename T> bool chmin(T &a, T b) {if (a > b) {a = b; return true;} return false;}
template<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val) {fill((T*)array, (T*)(array+N), val);}

int main() {
    int n, k;
    cin >> n >> k;
    int x[n];
    rep(i, n) cin >> x[i];
    int ans = 0;
    rep(i, n) ans += 2 * min(abs(x[i] - k), abs(x[i]));
    cout << ans << endl;
    
}

Measured memory_bytes: 256
//prepared by dumb
#include<bits/stdc++.h>
using namespace std;
#define   ll long long int
#define   dl double  
#define   llu unsigned long long int
#define   scll(x) scanf("%lld",&x)
#define   scdl(x) scanf("%lf",&x)
#define   scull(x) scanf("%llu",&x)
#define   scch(x) scanf(" %c",&x)
#define   pb(x) push_back(x)
#define   pf(x) push_front(x)
#define   ppb() pop_back()
#define   ppf() pop_front()
#define   Pi acos(-1.0)
#define   INF 1000000000000000000
#define   mod 1000000007
#define   ff first
#define   ss second
#define   mpr make_pair
#define   debug(x) cout<<x<<'\n';
//sin((x*pi)/180.0)[x in degree]
//sin(x)[x in radian]
//asin(x)[radian]
//(asin(x)*180)/pi[degree]
//or(|)//and(&)//xor(^)//not(~)
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int main()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
ll a, b, c, d, e, f = 0, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z;
ll cnt = 0, ans = 0, l1, l2, l3, c1 = 0, c2 = 0, c3 = 0, mx = 0, mn = 0;
ll prevsum = 0, ans1 = 0, ans2 = 0, odd = 0, even = 0, hh, mm;
    string str, str1, str2;

    scll(n);
   for(i=1;i<=n;i++)
   {
   	for(j=i;j<=n;j+=i)
   	ans=ans+j;
   }
    cout << ans;


return 0;
}

Measured memory_bytes: 3704
#include<iostream>
main(){int n,m,i,a,c[1<<20];for(std::string s;std::cin>>n>>m>>s,n;printf("%d\n",a))for(a=0,i=m;--i;a+=c[i]>=n)c[i]=s.substr(i,3)=="IOI"?c[i+2]+1:0;}

Measured memory_bytes: 5856
#include <vector> 
#include <list> 
#include <map> 
#include <set> 
#include <deque> 
#include <queue> 
#include <stack> 
#include <bitset> 
#include <algorithm> 
#include <functional> 
#include <numeric> 
#include <utility> 
#include <sstream> 
#include <iostream> 
#include <iomanip> 
#include <cstdio> 
#include <cmath> 
#include <cstdlib> 
#include <cctype> 
#include <string> 
#include <cstring> 
#include <ctime> 

using namespace std;

#define _int64 long long

vector<_int64> diff;
_int64 sum[100];
int cha[100];
_int64 ans;
int w;

void search(int x,_int64 d)
{
  int i;
  _int64 tmp;
  if (x==diff.size())
  {
    if (d==0)
    {
      tmp=1;
      for (i=0;i<diff.size();i++)
      {
        if (i!=0)
          tmp*=(10-abs(cha[i]));
        else
        {
          if (cha[i]>=0)
            tmp*=(9-cha[i]);
          else
            tmp*=(10-abs(cha[i]));
        }
      }
      if (w%2==1) tmp*=10;
      ans+=tmp;
    }
    return;
  }
  for (i=-9;i<=9;i++)
  {
    tmp=d-i*diff[x];
    if ((tmp<=sum[x]*9)&&(tmp>=-sum[x]*9))
    {
      cha[x]=i;
      search(x+1,tmp);
    }
  }
}

int main()
{
  int i,j,ii,d;
  _int64 tmp1,tmp2,tmp,tmpd;
  scanf("%d",&d);
  ans=0;
  for (w=2;w<=19;w++)
  {
    diff.clear();
    for (i=0;w-1-i>i;i++)
    {
      ii=w-1-i;
      tmp1=1;
      for (j=0;j<i;j++)
        tmp1*=10;
      tmp2=1;
      for (j=0;j<ii;j++)
        tmp2*=10;
      tmp=tmp2-tmp1;
      diff.push_back(tmp);
    }
    /*
    cout<<w<<" "<<diff.size()<<endl;
    for (i=0;i<diff.size();i++)
      cout<<diff[i]<<" ";
    cout<<endl;
    cout<<"ans:"<<ans<<endl;
    */
    for (i=diff.size()-1;i>=0;i--)
    {
      sum[i]=0;
      if (i+1<diff.size())
      {
        sum[i]=sum[i+1]+diff[i+1];
      }
    }
    search(0,d);
  }
  printf("%lld\n",ans);
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define PRINT(V) cout << V << "\n"
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())
using namespace std;
using ll = long long int;
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 INF = 1e9;
const ll MOD = 1000000007;
typedef pair<ll,ll> P;
int main(){
    ll n,k;
    cin >> n >> k;
    double p[200005];
    rep(i,n){
        cin >> p[i];
    }
    ll ans = 0;
    rep(i,k) ans += p[i];
    ll cnt = ans;
    rep(i,k,n){
        cnt = cnt - p[i-k] + p[i];
        chmax(ans,cnt);
    }
    double a = (double)(ans+k)/2;
    printf("%0.10f",a);
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#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(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef long double ld;

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n,k;
  cin >> n >> k;
  vector<int> a(n);
  REP(i,n) cin >> a[i];

  cout << (n-1)/(k-1) + ((n-1)%(k-1)==0 ? 0 : 1) << endl;
  return 0;
}

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

int main()
{
    int A, B;
    cin >> A >> B;

    int addResult = A + B;
    int subtractResult = A - B;
    int multipleResult = A * B;

    cout << max({addResult, subtractResult, multipleResult}) << endl;

    return 0;
}


Measured memory_bytes: 3156
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <vector>
#define Rep(i, n) for(int i=0;i<n;++i)
#define rep(i, n) for(int i=1;i<=n;++i)
#define ll long long int
#define INF 1e9
#define LINF 1e18
#define MOD 1000000007
#define PI 3.14159265359
#define All(a) (a).begin(), (a).end()

using namespace std;
using P = pair<ll, ll>;
 
int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};

/**
 * Usage:
 * 
 * G[from].push_back(Edge(to, weight));
 * using Graph = vector<vector<Edge>>;
 * 
 */ 
struct Edge {
  int to;     
  ll weight; 
  Edge(int t, ll w) : to(t), weight(w) { }
};

template<typename T>
void printv(vector<T>& v) {
  if (v.size() == 0) {
    cout << "\n";
    return;
  }

  Rep(i, v.size()) {
    cout << v[i] << ((i + 1 < v.size()) ? ' ' : '\n');
  }
}



ll GCD(ll m, ll n) {
  if (m == 0) {
    return n;
  } 
  if (n == 0) {
    return m;
  }

  if (m >= n) {
    return GCD(m%n, n);
  } else {
    return GCD(m, n%m);
  }
}

ll saiko(ll m, ll n) {
  return m * n / GCD(m, n);
} 

ll N, M;
ll a[110000];

int main () {
  cin >> N >> M;
  rep(i, N) {
    cin >> a[i];
  }

  ll saik = 1;
  rep(i, N) {
    saik = saiko(saik, a[i]);
    if (saik > 2 * M) {
      cout << 0 << "\n";
      return 0;
    }
  }

  //cout << "hoge" << "\n";

  bool flg = true;
  rep(i, N) {
    if ((saik / a[i]) % 2 == 0) {
      flg = false;
      break;
    }
  }

  if (!flg) {
    cout << 0 << "\n";
  } else {
    saik = saik / 2;

    ll c;
    c = M / saik;
    if (c % 2 == 0) {
      cout << c / 2 << "\n";
    } else {
      cout << c / 2 + 1 << "\n";
    }
  }


}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define REP(i,a,b) for(int i=a;i<b;i++)
using namespace std;
int main()
{
    int k, s;
    cin >> k >> s;
    int cnt = 0;
    for (int x = 0; x <= k; x++) {
        for (int y = 0; y <= k; y++) {
            int z = s - (x + y);
            if (z < 0 || z > k) continue;
            if (x + y + z != s) continue;
            cnt += 1;
        }
    }
    cout << cnt << endl;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <cstring>
#include <vector>
#include <map>
#include <stack>
#include <iostream>
#include <string>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;

char s1[105], s2[105], ans[205];

int main() 
{
	while(~scanf("%s", s1)) {
		scanf("%s", s2);
		int len1 = strlen(s1);
		int len2 = strlen(s2);
		int tot = 0;
		for(int i = 0; i < len1; i++) {
			ans[tot++] = s1[i];
			if(i < len2) ans[tot++] = s2[i];
		}
		for(int i = 0; i < tot; i++) printf("%c", ans[i]);
		printf("\n");
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  vector<double> x(n);
  for(int i=0;i<n;i++){
    cin>>x[i];
  }
  double y=0;
  for(int i=0;i<n;i++){
    y+=1/x[i];
  }
  double z;
  z=1/y;
  cout<<z<<setprecision(6)<<endl;
}

Measured memory_bytes: 256
n,k=map(int,input().split())
s=input()
l=[]
ans=0
for i in range(1,n):
    if s[i]==s[i-1]:
        ans+=1
for i in s:
    if l!=[]:
        if l[-1]!=i:
            l.append(i)
    else:
        l.append(i)
#print(ans)
#print(l)
n=len(l)
for i in range(1,n,2):
    if i-1>=0 and i+1<n and k>0:
        ans+=2
 #       print('cat')
        k-=1
    elif i-1>=0 and i+1>=n and k>0:
  #      print('asdf')
        ans+=1
        k-=1
print(ans)



Measured memory_bytes: 3964
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i, n) for(ll i=0; i<(ll)n; i++)
#define REPR(i, n) for(ll i=(ll)n-1; i>=0; i--)
#define FOR(i, m, n) for(ll i=(ll)m; i<(ll)n; i++)
#define FORR(i, m, n) for(ll i=(ll)m-1; i>=(ll)n; i--)
#define ALL(x) (x).begin(), (x).end()
#define ASC(v) sort(ALL(v));
#define DESC(v) sort(ALL(v), greater<int>());
#define UNIQ(a) sort(ALL(a));(a).resize(unique(ALL(a)) - a.begin());
#define PRINTD(x, d) cout << fixed << setprecision(d) << x << "\n";
#define DEBUG(x) cout<<#x<<": "<<x<<"\n"
const double PI = acos(-1);
ll lcm(ll a, ll b) { return a / __gcd(a, b) * b; }
bool isprime(int x){ int i; if(x<2)return 0; else if(x==2) return 1; if(x%2==0) return 0; for(i=3; i*i<=x; i+=2) if(x%i==0) return 0; return 1; }
int digsum(int n) { int r=0; while(n>0) { r+=n%10; n/=10; } return r; }
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 main(){
    ll N, i;
    cin >> N >> i;
    cout << N-i+1 << "\n";
}


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

#define rep(i,n) for(long long int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(long long int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(long long int i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define pb(q) push_back(q)
#define Abs(a,b) max(a,b)-min(a,b)
#define YES(condition) if(condition){cout << "YES" << endl;}else{cout << "NO" << endl;}
#define Yes(condition) if(condition){cout << "Yes" << endl;}else{cout << "No" << endl;}
#define Cout(x) cout<<(x)<<endl
#define POSSIBLE(condition) if(condition){cout << "POSSIBLE" << endl;}else{cout << "IMPOSSIBLE" << endl;}
#define Possible(condition) if(condition){cout << "Possible" << endl;}else{cout << "Impossible" << endl;}
#define possible(condition) if(condition){cout << "possible" << endl;}else{cout << "impossible" << endl;}
#define Size(n) (n).size()

typedef long long ll;


using namespace std;

const int INF = 1e9,MOD = 1e9 + 7,ohara = 1e6;
const ll LINF = 1e18;


long long int n,cnt=0,ans=0,a[ohara],b,c,d,cmp,cmpp,m,h,w,x,y,sum=0,pos;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
string alph("abcdefghijklmnopqrstuvwxyz"),s;
bool fl=true;
struct edge{int to,cost;};

//-------------------------↓↓↓↓↓↓------------------------

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

      
      cin>>n;
      rep(i,n)cin>>a[i];
      rep(i,n){
        rrep(j,i+1,n){
          cnt=abs(a[i]-a[j]);
          ans=max(ans,cnt);
        }
      }
      Cout(ans);
     

       
return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        int a = s.nextInt();
        int b = s.nextInt();
// ????????????????????????
        System.out.printf("a %s b\n", comparisonSign(a,b));
    }
    private static String comparisonSign(int a, int b) {
        if (a == b) {
          return "==";
        } else if(a > b) {
          return ">";
        } else {
          return "<";
        }
    }
}

Measured memory_bytes: 17160
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define vi vector<int>
#define vl vector<long long>
#define pii pair<int, int>
#define pll pair<long long, long long>
#define abu ios_base::sync_with_stdio(0)
#define said cin.tie(0)
using namespace std;

void yes(){
    cout<<"YES"<<endl;
}

void no(){
    cout<<"NO"<<endl;
}

void solve(){
    int a ,b;
    cin>>a>>b;
    for(int i=1;i<=1000;i++){
        if((int)(i*0.08)==a && (int)(i*0.1)==b){
            cout<<i<<endl;
            return;
        }
    }
    cout<<-1<<endl;
}

int main(){
    abu;
    said;
    int t = 1;
    //cin>>t;
    while(t--){
        solve();
    }

    return 0;
}

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

// template {{{  0 
// using {{{ 1
using ll = long long int;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vii = vector<pii>;
using vll = vector<pll>;
// }}} 1
// definition {{{ 1
// scaning {{{ 2
#define Scd(x) scanf("%d", &x)
#define Scd2(x,y) scanf("%d%d", &x, &y)
#define Scd3(x,y,z) scanf("%d%d%d", &x, &y, &z)
#define Scll(x) scanf("%lld", &x)
#define Scll2(x,y) scanf("%lld%lld", &x, &y)
#define Scll3(x,y,z) scanf("%lld%lld%lld", &x, &y, &z)
#define Scc(c) scanf("%c", &c);
#define Scs(s) scanf("%s", s);
#define Scstr(s) scanf("%s", &s);
// }}} 2
// constants {{{ 2
#define EPS (1e-7)
#define INF (2e9)
#define PI (acos(-1))
// }}} 2
// systems {{{ 2
#define Repe(x,y,z) for(ll x = z; x < y; x++)
#define Rep(x,y) Repe(x,y,0)
#define RRepe(x,y,z) for(ll x = y-z-1; x >= 0; x--)
#define RRep(x,y) RRepe(x,y,0)
// }}} 2
// output {{{ 2
#define YesNo(a) (a)?printf("Yes\n"):printf("No\n")
#define YESNO(a) (a)?printf("YES\n"):printf("NO\n")
// }}} 2
// }}} 1
// input {{{ 1
// }}} 1
// }}} 0

int main() {

    int N;
    Scd(N);

    vi A(N+1);
    vi B(N);

    Rep(i,N+1) Scd(A[i]);
    Rep(i,N) Scd(B[i]);

    ll ans = 0;

    Rep(i,N){
        if( A[i] < B[i] ){ 
            ans += A[i];
            B[i] -= A[i];
            if( A[i+1] < B[i] ) ans += A[i+1], A[i+1] = 0;
            else ans += B[i], A[i+1] -= B[i];
        }else{
            ans += B[i];
        }
    }

    printf ("%lld\n", ans);

    return 0;
}



Measured memory_bytes: 1024
# coding: utf-8


def main():
    l, r = list(map(int, input().split(" ")))

    ans = 3000
    for i in range(l, r):
        for j in range(i+1, r+1):
            candidate = (i * j) % 2019
            if candidate < ans:
                ans = candidate
            if ans == 0:
                print(ans)
                return
    print(ans)
    return

main()




Measured memory_bytes: 2940
from heapq import*
f=lambda*z:map(int,raw_input().split())
X,Y,Z=f()
N=X+Y+Z
P=[]
Q=[]
L=[0]
R=[0]
A=sorted(map(f,L*N),key=lambda a:a[0]-a[1])
for i in range(N):L+=[L[i]+A[i][1]];heappush(P,A[i][1]-A[i][2]);R+=[R[i]+A[~i][0]];heappush(Q,A[~i][0]-A[~i][2]);L[-1]-=i>=Y and heappop(P);R[-1]-=i>=X and heappop(Q)
print max(L[i]+R[~i]for i in range(Y,Y+Z+1))

Measured memory_bytes: 35172
#include <iostream>
using namespace std;
int main(){
    int D, G, p[11], c[11];
    cin >> D >> G;
    for(int i = 0; i < D; ++i){
        cin >> p[i] >> c[i];
    }

    int ans = 1000;
    for(int mask = 0; mask < (1 << D); ++mask){
        int s = 0, num = 0, rest_max = -1;
        for(int i = 0; i < D; ++i){
            if(mask >> i & 1){
                s += 100 * (i+1) * p[i] + c[i];
                num += p[i];
            }else{
                rest_max = i;
            }
        }
        if(s < G){
            int s1 = 100 * (rest_max + 1);
            int need = (G - s + s1 - 1) / s1;
            if(need >= p[rest_max]){
                continue;
            }
            num += need;
        }
        ans = min(ans, num);
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>

using namespace std;
typedef long long ll;
const ll INF = -1;

int solve(void);

int main(void)
{
	while (solve())
	{
	}

	return 0;
}

int solve(void)
{

	ll N, K;
	cin >> N >> K;

	vector<ll> h(N, 0);
	for (int i = 0; i < N; i++)
		cin >> h[i];

	// dp[i] := 足場 i にたどり着くまでに支払うコストの総和の最小値
	vector<ll> dp(N, INF);
	dp[0] = 0;

	for (int i = 0; i < N; i++)
	{
		for (int k = 1; k <= K; k++)
		{
			const ll ik = i + k;
			if (!(ik < N)) { continue; }

			const auto next = dp[i] + abs(h[ik] - h[i]);
			dp[ik] = dp[ik] == INF ? next : min(dp[ik], next);
		}
	}

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

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

void Main()
{
	int A, B;
	cin >> A >> B;

	int output = 1;
	int ans = 0;
	while (output < B) {
		output += A - 1;
		ans++;
	}
	cout << ans;
}
 
int main()
{
	Main();
	return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<vector>
using namespace std;
const int mod=1000000007;

int main(){
  int N,M;
  long long ans=0,a1=0,a2=1;
  cin>>N>>M;
  vector<int> a(M);

  for(int i=0;i<M;i++){
    cin>>a.at(i);
  }

  int p=M-1;
  for(int i=N;i>-1;i--){
    if(i==N){continue;}
    else if(i==N-1){
      if(p>-1&&i==a.at(p)){a1=0;p--;}
      else{a1=1;ans=1;}
    }else{
      if(p>-1&&i==a.at(p)){
        p--;
        a2=a1;
        a1=0;
      }else{
        ans=(a1+a2)%mod;
        a2=a1;	a1=ans;
        cerr<<ans<<endl;
      }

      if(a1==0&&a2==0){
        ans=0;
        break;
      }
    }
  }
  cout<<ans;
}

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

using namespace std;

int gcd(int a,int b){return (b ==0) ?  a : gcd(b,a % b);}
int n,X,ans;
vector<int>num;
int main(){
	ios::sync_with_stdio(false);
	cin >> n >> X;
	num.push_back(X);
	for(int i = 1;i <= n;++i){
		cin >> X;
		num.push_back(X);
	}
	sort(num.begin(),num.end());
	int pos = lower_bound(num.begin(),num.end(),X) - num.begin();
	for(int i = pos - 1;i >= 0;--i){
		if(!ans)ans = num[i + 1] - num[i];
		else ans = gcd(ans,num[i + 1] - num[i]);
	}
	for(int i = pos + 1;i < (int)num.size();++i){
		if(!ans)ans = num[i] - num[i - 1];
		else ans = gcd(ans,num[i] - num[i - 1]);
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 892
use bigint;
sub f{
    my($n,$x)=@_;
    return $x>0?1:0 if($n<1);
    return &f($n-1,$x-1)if($x<=1+$a[$n-1]);
    return $p[$n-1]+1+&f($n-1,$x-2-$a[$n-1])
}
<>=~$";
$a[0]=1;$p[0]=1;
for(1..$`){
    $a[$_]=$a[$_-1]*2+3;
    $p[$_]=$p[$_-1]*2+1;
}
print&f($`,$')

Measured memory_bytes: 5248
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define rep0(a,b) for(int a=0;a<b;a++)
#define rep1(a,b) for(int a=1;a<b;a++)
#define repp(a,b,c) for(int a=b;a<c;a++)
#define rev(a,b,c) for(int a=b;a>=c;a--)
#define in insert
#define len length()
#define si size()
#define lb lower_bound
#define ub upper_bound
#define beg begin()
#define end end()
#define vec vector<ll>
#define se set<ll>
#define mults multiset<ll>
#define F first
#define S second
#define pr(a) cout<<a
#define pr2(a,b) cout<<a<<" "<<b
#define get(a) cin>>a
#define nextl cout<<endl
const ll mod = 1000000007;
const ll maxn = 500005;
const ll mm = 1e+18;
ll power(ll x, ll y)
{
    ll res = 1;
    x = x % mod;
    while (y > 0)
    {
        if (y & 1)
            res = (res*x) % mod;
        y = y>>1;
        x = (x*x) % mod;
    }
    return res;
}
ll ncr(ll n, ll k)
{
    ll C[k+1];
    memset(C, 0, sizeof(C));

    C[0] = 1;

    for (ll i = 1; i <= n; i++)
    {
        for (ll j = min(i, k); j > 0; j--)
            C[j] = (C[j] + C[j-1])%mod;
    }
    return C[k];
}
void solve()
{
   int n,k;
   get(n);
   get(k);
   int ans=0;
   while(n--){
    int x;
    get(x);
    if(x>=k) ans++;
   }
   pr(ans);
   
}
int main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int t=1;
    //cin>>t;
    while(t--){
        solve();
       // nextl;
    }
    return 0;
}


Measured memory_bytes: 256
from collections import deque
h, w = map(int, input().split())
a = [[] for _ in range(h)]
for i in range(h):
    a[i] = list(input())

dis = [[1000000 for _ in range(w)] for _ in range(h)]
queue = deque([])

for i in range(h):
    for j in range(w):
        if a[i][j] == "#":
            dis[i][j] = 0
            queue.append([i, j])

while queue:
    now = deque.popleft(queue)
    if now[0] != 0:
        if dis[now[0]-1][now[1]] == 1000000:
            dis[now[0]-1][now[1]] = dis[now[0]][now[1]]+1
            queue.append([now[0]-1, now[1]])
            
    if now[0] != h-1:
        if dis[now[0]+1][now[1]] == 1000000:
            dis[now[0]+1][now[1]] = dis[now[0]][now[1]]+1
            queue.append([now[0]+1, now[1]])
            
    if now[1] != 0:
        if dis[now[0]][now[1]-1] == 1000000:
            dis[now[0]][now[1]-1] = dis[now[0]][now[1]]+1
            queue.append([now[0], now[1]-1])
            
    if now[1] != w-1:
        if dis[now[0]][now[1]+1] == 1000000:
            dis[now[0]][now[1]+1] = dis[now[0]][now[1]]+1
            queue.append([now[0], now[1]+1])

ans = 0
for i in range(h):
    for j in range(w):
        ans = max(ans, dis[i][j])

print(ans)

Measured memory_bytes: 201496
#include<unordered_map>
#include<utility>
template<typename T>
class UnionFind {
 public:
  void unite(const T& a, const T& b) {
    auto x = find(a), y = find(b);
    if(rank_[x] < rank_[y]) std::swap(x, y);
    parent_[y] = x;
    if(rank_[x] == rank_[y]) rank_[x] += 1;
  }
  T find(const T& x) {
    if(!parent_.count(x)) {
      rank_[x] = 1;
      return parent_[x] = x;
    }
    return (parent_[x] == x) ? x : (parent_[x] = find(parent_[x]));
  }
 private:
  std::unordered_map<T, T> parent_;
  std::unordered_map<T, int> rank_;
};

#include<bits/stdc++.h>
using namespace std;

struct Point {int id, x, y;};
using Edge = tuple<int, int, int>;

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

  vector<Point> point;
  for(auto i = 0; i < N; ++i) {
    int x, y;
    cin >> x >> y;
    point.push_back({i, x, y});
  }

  set<Edge> q;

  sort(begin(point), end(point), [](auto l, auto r) {
    if(l.x!=r.x) return l.x<r.x;
    if(l.y!=r.y) return l.y<r.y;
    return l.id < r.id;
  });
  for(auto i=1; i<N; ++i) {
    auto u=point[i-1].id;
    auto v=point[i].id;
    auto w=point[i].x-point[i-1].x;
    q.emplace(w, u, v);
  }

  sort(begin(point), end(point), [](auto l, auto r) {
    if(l.y!=r.y) return l.y<r.y;
    if(l.x!=r.x) return l.x<r.x;
    return l.id < r.id;
  });
  for(auto i=1; i<N; ++i) {
    auto u=point[i-1].id;
    auto v=point[i].id;
    auto w=point[i].y-point[i-1].y;
    q.emplace(w, u, v);
  }

  auto sum = 0;
  UnionFind<int> g;
  while(!q.empty()) {
    int w, u, v;
    tie(w, u, v) = *begin(q);
    q.erase(begin(q));
    if(g.find(u) == g.find(v)) continue;
    g.unite(u, v);
    sum += w;
  }
  cout << sum << endl;
}


Measured memory_bytes: 18292
// 入力マクロ
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8 より
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)*}
    };
}
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, 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! {
        s: chars
    }

    let mut c = 0;
    for i in 0..s.len()-1 {
        if s[i] != s[i+1] {
            c += 1;
        }
    }
    println!("{}", c);
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define ll long long
#define eps 1e-7
#define ull unsigned long long
#define inf 2e9+10
using namespace std;
inline ll read(){
    ll x=0;int f=1;char ch=getchar();
	while(!isdigit(ch)) {if(ch=='-') f=-1;ch=getchar();}
	while(isdigit(ch)) {x=x*10+ch-'0';ch=getchar();}
	return x*f;
}
int n;
string ch[1000];
int main(){
	int n=read();
	for(int i=1;i<=n;i++){
		getline(cin,ch[i]);
	}
	int flag=1;
	for(int i=2;i<=n;i++){
		for(int j=1;j<=n;j++){
			if(i==j) continue;
			int len1=ch[i].size();int len2=ch[j].size();
			if(len1!=len2) continue;
			int t=1;
			for(int k=0;k<len1;k++){
				if(ch[i][k]!=ch[j][k]) t=0;
			}
			if(t==1) flag=0;
		}
		int len1=ch[i].size();int len2=ch[i-1].size();
		if(ch[i][0]!=ch[i-1][len2-1]) flag=0;
	}
	if(flag==0) printf("No\n");
	else printf("Yes\n");
	return 0;
}

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

int main()
{
    int W, H, x, y;
    cin >> W >> H >> x >> y;

    if (x + x == W && y + y == H)
    {
        printf("%lf 1\n", double(W) * double(H) / 2);
    }
    else
    {
        printf("%lf 0\n", double(W) * double(H) / 2);
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h> 
using namespace std;  
int main() { 
	int A , B;
	string op;
	cin >> A >> op >> B;
	if(op == "+"){
		cout << A+B << endl;
	}else{
		cout << A-B << endl;
	}
		
	
	
}
	

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n,N) for(int i=(n);i<(int)N;i++)
#define p(s) cout<<(s)<<endl
#define ck(n,a,b) ((a)<=(n)&&(n)<(b))
#define F first
#define S second
typedef long long ll;
using namespace std;
const int inf=1e9;

int main(){
	int A,B,C;
	cin>>A>>B>>C;
	int a,b,c;
	int ans=0;
	while(A%2==0&&B%2==0&&C%2==0){
		ans++;
		a=A/2;
		b=B/2;
		c=C/2;
		A=b+c;
		B=a+c;
		C=a+b;
		if(ans>10000000){
			ans=-1;
			break;
		}
	}
	p(ans);
	return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cmath>
using namespace std;
int n, a[100005], s;
int main() {
	int i;
	scanf("%d", &n);
	for(i=1; i<=n; i++) {
		scanf("%d", &a[i]);
		s += abs(a[i] - a[i-1]);
	}
	s += abs(a[n]);
	for(i=1; i<=n; i++) {
		printf("%d\n", s - (int)(abs(a[i]-a[i-1])) - (int)(abs(a[i]-a[i+1])) + (int)abs(a[i-1]-a[i+1]));
	}
	return 0;
}

Measured memory_bytes: 1536
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#include <queue>

using namespace std;

const int MAX=10000;

typedef long long ll;

int V, E;
vector<int> adj[MAX];
vector<int> ans;
int indeg[MAX], color[MAX];

void bfs(int s){
  queue<int> Q;
  Q.push(s);
  color[s]=1;
  while(Q.empty()==false){
    int u=Q.front(); Q.pop();
    ans.push_back(u);
    for(int i=0;i<adj[u].size();i++){
      int v=adj[u][i];
      indeg[v]--;
      if(indeg[v]==0 && color[v]==0){
        color[v]=1;
        Q.push(v);
      }
    }
  }
}

int main(){
  cin >> V >> E;
  //initialize
  for(int i=0;i<V;i++){
    indeg[i]=0;
    color[i]=0;
  }
  for(int i=0;i<E;i++){
    int s, t; cin >> s >> t;
    adj[s].push_back(t);
    indeg[t]++;
  }
  //topological sort
  for(int u=0;u<V;u++){
    if(indeg[u]==0 && color[u]==0) bfs(u);
  }
  for(int i=0;i<ans.size();i++) cout << ans[i] << endl;
}

Measured memory_bytes: 3864
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define ALL(v) (v).begin(), (v).end()
using ll = long long;
using P = pair<int, int>;
const int INF = 1e9;
const long long LINF = 1e18;
const long long MOD = 1e9 + 7;

signed main() {
    int n, k;
    cin >> n >> k;
    int a[n];
    rep(i, n) {
        cin >> a[i];
    }
    bool dpl[n + 1][k], dpr[n + 1][k];
    fill(dpl[0], dpl[n + 1], false);
    fill(dpr[0], dpr[n + 1], false);
    dpl[0][0] = dpr[n][0] = true;
    rep(i, n) {
        rep(j, k) {
            dpl[i + 1][j] |= dpl[i][j];
            if (j - a[i] < 0) continue;
            dpl[i + 1][j] |= dpl[i][j - a[i]];
        }
    }
    for (int i = n - 1; i >= 0; i--) {
        rep(j, k) {
            dpr[i][j] |= dpr[i + 1][j];
            if (j - a[i] < 0) continue;
            dpr[i][j] |= dpr[i + 1][j - a[i]];
        }
    }
    int ans = 0;
    rep(i, n) {
        vector<int> b, c;
        rep(j, k) {
            if (dpl[i][j]) b.emplace_back(j);
            if (dpr[i + 1][j]) c.emplace_back(j);
        }
        rep(j,b.size()){
            auto itr = lower_bound(ALL(c), k - a[i] - b[j]);
            if (itr == c.end()) continue;
            if (*itr < k - b[j]) {
                ans++;
                break;
            }
        }
    }
    cout << n - ans << endl;
    return 0;
}

Measured memory_bytes: 49280
N = int(input())
A = [int(input()) for i in range(N+1)]


def factorize(n):
    b = 2
    fct = {}
    while b * b <= n:
        while n % b == 0:
            n //= b
            if b in fct.keys():
                fct[b] += 1
            else:
                fct[b] = 1
        b += 1
    if n > 1:
        fct[n] = 1
    return fct


def gcd(a, b):
    """
    自然数a, b の最大公約数を求める
    """
    if b == 0:
        return a
    else:
        return gcd(b, a % b)


g = abs(A[0])
for a in A:
    g = gcd(g, abs(a))
cand = list(factorize(g).keys())
ans_set = [c for c in cand]


def SieveofEratosthenes(N: int) -> list:
    isPrime = [0] + [1 for _ in range(N-1)]
    numList = [i+1 for i in range(N)]
    for i in range(1, N):
        if isPrime[i] == 1:
            for k in range(i+1, N):
                if (k+1) % (i+1) == 0:
                    isPrime[k] = 0
    returnList = []
    for i, v in enumerate(isPrime):
        if v == 1:
            returnList.append(numList[i])
    return returnList


cand = SieveofEratosthenes(N+1)


def ans(cand):
    for p in cand:
        if A[0] % p != 0:
            continue
        for n in range(1, p):
            cur = 0
            for k in range((N-n)//(p-1)+1):
                cur += A[n+k*(p-1)]
                cur %= p
            if cur != 0:
                break
        if cur == 0:
            ans_set.append(p)
    return ans_set


A.reverse()
ans_set = ans(cand)
ans = sorted(list(set(ans_set)))
for p in ans:
    print(p)

Measured memory_bytes: 48088
#include<bits/stdc++.h>
using namespace std;
int main() {
  int n,l;
  cin >> n >> l;
  char s[n][101];
  for(int i = 0; i < n; ++i) cin >> s[i];
  
  for(int i = 0; i < n - 1; ++i) {
    for(int j = 0; j < n - i - 1; ++j) {
      if(strcmp(s[j], s[j + 1]) > 0) {
	char tmp[101];
	strcpy(tmp, s[j]);
	strcpy(s[j], s[j + 1]);
	strcpy(s[j + 1], tmp);
      }
    }
  }

  for(int i = 0; i < n; ++i) {
    cout << s[i];
  }
  cout << "\n";
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <unordered_map>
#define int long long int
#define double long double
#define endl "\n"
#define PI 3.141592653589793238462643383279502884
#define sum_up(x)  (x*(x+1))/2
#define sp(x)   setprecision(x)
#define ceil(a,b)   (a+(b-1))/b
#define LCM(a,b)    (a*b)/__gcd(a,b)
#define all(v)  v.begin(),v.end()
#define alls(s,v)  s.begin(),s.end(),v
#define gena(arr,n,nxt)  generate(arr,arr+n, nxt)
#define genv(v,nxt)  generate(v.begin(),v.end(), nxt)
#define BSv(v,a) binary_search(v.begin(),v.end(), a)
#define BSa(v,n,a) binary_search(v,v+n, a)
#define base ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
using namespace std;
unsigned int N=1000000;
bool prime[100001];
void sieve(int n)
{
    memset(prime, true, sizeof(prime));

    for (int p=2; p*p<=n; p++)
    {
        if (prime[p] == true)
        {
            for (int i=p*p; i<=n; i += p)
                prime[i] = false;
        }
    }
}
int power(int x, int y)
{
    int res = 1;
    while (y > 0)
    {
        if (y & 1)
            res = res * x;
        y = y >> 1;
        x = x*x;
    }
    return res;
}

int nxt()
{
    int x;
    cin >> x;
    return x;
}

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

int32_t main()
{
    base;
    int n=nxt(),m=nxt();
    int arr[m];
    gena(arr,m,nxt);
    int sum=0;
    for(int i=0;i<m;i++)sum+=arr[i];
    if(sum<=n)cout<<n-sum;
    else cout<<-1;
    return 0;
}


Measured memory_bytes: 3680