akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
//#include <cmath>
#define int long long
#define IOS std::ios::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL);
#define pb push_back
#define mod 1000000007
//#define lld long double
#define mii map<int, int>
#define mci map<char, int>
#define msi map<string, int>
#define pii pair<int, int>
#define ff first
#define ss second
#define bs(yup,x) binary_search(yup.begin(),yup.end(),x) //it will return bollean value
#define lb(yup,x) lower_bound(yup.begin(),yup.end(),x)  //it will return the adress of the number which is equal to or just greater than x ,and if it is equal to yup.end() than their in no such number exist
#define ub(yup,x) upper_bound(yup.begin(),yup.end(),x)
#define all(x) (x).begin(), (x).end()
#define rep(i,x,y) for(int i=x; i<y; i++)
#define fill(a,b) memset(a, b, sizeof(a))
#define vi vector<int>
#define setbits(x) __builtin_popcountll(x)
using namespace std;
const long long N=100001, INF=2000000000000000000;
const long double EPS= 0.000000000001;
int power(int a, int b, int p)
    {
        if(a==0)
        return 0;
        int res=1;
        a%=p;
        while(b>0)
        {
            if(b&1)
            res=(res*a)%p;
            b>>=1;
            a=(a*a)%p;
        }
        return res;
    }
vi prime;
bool isprime[N];
void pre()
{
    for(int i=2;i<N;i++)
    {
        if(isprime[i])
        {
            for(int j=i*i;j<N;j+=i)
            isprime[j]=false;
            prime.pb(i);
        }
    }
    return;
}


 
int32_t main()
{
    
    IOS;
    //fill(isprime, true);
    //pre();
    string s;
    cin>>s;
    int sz=s.size();
    cout<<s;
    if(s[sz-1]=='s')
    {
        cout<<"es";
    }
    else
    {
        cout<<"s";
    }
 
}








Measured memory_bytes: 3652
import java.util.*;
import java.util.Arrays;

public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();

		int x = sc.nextInt();
		int y = sc.nextInt();
		
		int cost = 0;
		if(a+b>2*c){
			int min = Math.min(x,y);
			cost += 2*c*min;
			x-=min;
			y-=min;
			if(a>2*c){
				cost+=2*c*x;
			}
			else{
				cost += a*x;
			}

			if(b>2*c){
				cost+=2*c*y;
			}
			else{
				cost += b*y;
			}
		}
		else{
			cost =cost+ a*x+b*y;
		}
		


			
		System.out.println(cost);



	}
}











Measured memory_bytes: 21844
#include <stdio.h>
#include <algorithm>
#include <tuple>
using namespace std;
int n, ret, res, ptr; tuple<int, int, int> d[100000];
int main() {
	scanf("%d", &n);
	for (int i = 0; i < n; i++) scanf("%d%d%d", &get<0>(d[i]), &get<1>(d[i]), &get<2>(d[i]));
	sort(d, d + n);
	for (int i = 0; i < n; i++) {
		res = get<2>(d[i]);
		if (i + 1 != n) { if (get<0>(d[i + 1]) == get<0>(d[i]) && get<1>(d[i + 1]) == get<1>(d[i]) + 1) res += get<2>(d[i + 1]); }
		ptr = lower_bound(d, d + n, make_tuple(get<0>(d[i]) + 1, get<1>(d[i]) + 1, 0)) - d - 1;
		if (get<0>(d[ptr]) == get<0>(d[i]) + 1 && get<1>(d[ptr]) == get<1>(d[i])) res += get<2>(d[ptr]);
		ptr = lower_bound(d, d + n, make_tuple(get<0>(d[i]) + 1, get<1>(d[i]) + 2, 0)) - d - 1;
		if (get<0>(d[ptr]) == get<0>(d[i]) + 1 && get<1>(d[ptr]) == get<1>(d[i]) + 1) res += get<2>(d[ptr]);
		ret = max(res, ret);
		res = get<2>(d[i]);
		if (i != 0) { if (get<0>(d[i - 1]) == get<0>(d[i]) && get<1>(d[i - 1]) == get<1>(d[i]) - 1) res += get<2>(d[i - 1]); }
		ptr = lower_bound(d, d + n, make_tuple(get<0>(d[i]) + 1, get<1>(d[i]) + 1, 0)) - d - 1;
		if (get<0>(d[ptr]) == get<0>(d[i]) + 1 && get<1>(d[ptr]) == get<1>(d[i])) res += get<2>(d[ptr]);
		ptr = lower_bound(d, d + n, make_tuple(get<0>(d[i]) + 1, get<1>(d[i]), 0)) - d - 1;
		if (get<0>(d[ptr]) == get<0>(d[i]) + 1 && get<1>(d[ptr]) == get<1>(d[i]) - 1) res += get<2>(d[ptr]);
		ret = max(res, ret);
	}
	printf("%d / 1\n", ret);
	return 0;
}

Measured memory_bytes: 3896
#include<bits/stdc++.h>
using namespace std;
int main(){
    
    long long a,b,c,d=0,i;
    string s;
    cin>>s;
    a=s.size();b=0;c=a-1;
    while(c>b){
        if(s[b]!=s[c])
        d++;
        b++;c--;
    }cout<<d;
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(){
	int b1,b2,b3;
	scanf("%d%d%d",&b1,&b2,&b3);
	if(b1==1&&b2==1||b3==1){
		printf("Open\n");
	}
	else{
		printf("Close\n");
	}
	return 0;
}

Measured memory_bytes: 1012
#pragma region Macros
#include <bits/stdc++.h>
using namespace std;
//#include <boost/multiprecision/cpp_int.hpp>
//using multiInt = boost::multiprecision::cpp_int;

using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pld = pair<ld, ld>;
template <typename Q_type>
using smaller_queue = priority_queue<Q_type, vector<Q_type>, greater<Q_type>>;

constexpr int MOD_TYPE = 1;
constexpr ll MOD = (MOD_TYPE == 1 ? (ll)(1e9 + 7) : 998244353);
constexpr int INF = (int)1e9;
constexpr ll LINF = (ll)4e18;
constexpr ld PI = acos(-1.0);
constexpr ld EPS = 1e-11;
constexpr int Dx[] = {0, 0, -1, 1, -1, 1, -1, 1, 0};
constexpr int Dy[] = {1, -1, 0, 0, -1, -1, 1, 1, 0};

#define REP(i, m, n) for (ll i = m; i < (ll)(n); ++i)
#define rep(i, n) REP(i, 0, n)
#define MP make_pair
#define MT make_tuple
#define YES(n) cout << ((n) ? "YES" : "NO") << "\n"
#define Yes(n) cout << ((n) ? "Yes" : "No") << "\n"
#define possible(n) cout << ((n) ? "possible" : "impossible") << "\n"
#define Possible(n) cout << ((n) ? "Possible" : "Impossible") << "\n"
#define Yay(n) cout << ((n) ? "Yay!" : ":(") << "\n"
#define all(v) v.begin(), v.end()
#define NP(v) next_permutation(all(v))
#define dbg(x) cerr << #x << ":" << x << "\n";

#pragma endregion

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << setprecision(30) << setiosflags(ios::fixed);
  map<string, int> mp;
  mp["SAT"] = 1;
  mp["FRI"] = 2;
  mp["THU"] = 3;
  mp["WED"] = 4;
  mp["TUE"] = 5;
  mp["MON"] = 6;
  mp["SUN"] = 7;
  string s;
  cin >> s;
  cout << mp[s] << endl;
  return 0;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-

from math import ceil

def check(a, b, x):
    if int(x * 0.08) != a or int(x * 0.1) != b:
        return -1
    return x

def prob_c(a, b):
    yasu = ceil(a * 100 / 8)
    taka = ceil(b * 100 / 10)
    ans = int(check(a, b, max(yasu, taka)))
    print(ans)

if __name__ == '__main__':
    a, b = map(int, input().split())
    prob_c(a,b)


Measured memory_bytes: 3060
#pragma GCC target("avx2")
#pragma GCC optimization("O3")
#pragma GCC optimization("unroll-loops")
#include <algorithm>
#include <assert.h>
#include <bitset>
#include <cfloat>
#include <complex>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits.h>
#include <list>
#include <map>
#include <math.h>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <time.h>
#include <unordered_map>
#include <unordered_set>
#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 int long long
#define ll long long
#define mod (int)1000000007
#define P pair<int,int>
#define prique(T) priority_queue<T,vector<T>,greater<T>>
#define all(V) V.begin(),V.end()
#ifdef int
constexpr int INF = LLONG_MAX / 10;
#else
constexpr int INF = INT_MAX / 10;
#endif
constexpr double eps = DBL_EPSILON;
template <class T, class U>
inline bool chmax(T& lhs, const U& rhs) {
	if (lhs < rhs) {
		lhs = rhs;
		return 1;
	}
	return 0;
}
template <class T, class U>
inline bool chmin(T& lhs, const U& rhs) {
	if (lhs > rhs) {
		lhs = rhs;
		return 1;
	}
	return 0;
}
using namespace std;
inline int gcd(int a, int b) {
	while (b) {
		int c = a;
		a = b; b = c % b;
	}
	return a;
}
inline int lcm(int a, int b) {
	return a / gcd(a, b) * b;
}
bool isprime(int n) {
	if (n == 1)return false;
	for (int i = 2; i * i <= n; i++) {
		if (n % i == 0)return false;
	}
	return true;
}
int mypow(int a, int b) {
	if (!b)return 1;
	if (b & 1)return mypow(a, b - 1) * a;
	int memo = mypow(a, b >> 1);
	return memo * memo;
}
int modpow(int a, int b, int m = mod) {
	if (!b)return 1;
	if (b & 1)return modpow(a, b - 1, m) * a % m;
	int memo = modpow(a, b >> 1, m);
	return memo * memo % m;
}
int a, b, m, c[100010], d[100010], x, y, co;
signed main() {
	cin >> a >> b >> m;
	rep(i, a)cin >> c[i];
	rep(i, b)cin >> d[i];
	int ans = *min_element(c, c + a) + *min_element(d, d + b);
	rep(i, m) {
		cin >> x >> y >> co;
		chmin(ans, c[x - 1] + d[y - 1] - co);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1792
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author aryssoncf
 */

#include <bits/stdc++.h>
//
// Created by aryssoncf on 28/10/2019.
//

#include <type_traits>


#include <iterator>
#include <utility>

template<typename T>
constexpr auto hasBegin(int) -> decltype(std::begin(std::declval<T>()), true) {
    return true;
}

constexpr bool hasBegin(...) {
    return false;
}

template<typename T>
using IsContainer = std::integral_constant<bool, hasBegin<T>(0)>;


#ifndef JHELPER_EXAMPLE_PROJECT_IO_HPP
#define JHELPER_EXAMPLE_PROJECT_IO_HPP

#endif //JHELPER_EXAMPLE_PROJECT_IO_HPP

template<class X, class Y>
std::ostream &operator<<(std::ostream &os, std::pair<X, Y> const &p) {
    return os << p.first << " " << p.second;
}

template<class Ch, class Tr, class Container>
std::basic_ostream<Ch, Tr> &operator<<(std::basic_ostream<Ch, Tr> &os, Container const &x) {
    bool first = true;
    for (auto &y : x) {
        if (first) {
            first = false;
        } else {
            os << " ";
        }
        os << y;
    }
    return os;
}

using namespace std;

class C100To105 {
public:
    void solve(std::istream &in, std::ostream &out) {
        int x;
        in >> x;
        vector<bool> dp(x + 1);
        dp[0] = true;
        for (int i = 1; i <= x; ++i) {
            for (int j = 100; j <= 105; ++j) {
                if (i >= j and dp[i - j]) {
                    dp[i] = true;
                }
            }
        }
        bool res = dp[x];
        out << res << "\n";
    }

    void setup() {}
};


int main() {
    std::ios_base::sync_with_stdio(false);
    C100To105 solver;
    solver.setup();
    std::istream &in(std::cin);
    std::ostream &out(std::cout);
    in.tie(nullptr);
    out << std::fixed;
    out.precision(20);
    solver.solve(in, out);
    return 0;
}


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

typedef long long ll;
#define re(n) cin >> n
#define all(a) a.begin(),a.end()
#define pb push_back
#define mp make_pair
#define ff(i,x,n) for(ll i=(int)x;i<(int)n;i++)
#define f(i,n) ff(i,0,n)
#define fast std::ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define te(t) ll t; re(t); while(t--)
#define MOD 1000000007

int main(){
	ll n;
	re(n);
	ll r = 0;
	ll w = 0;
	char x[n];
	f(i, n){
		re(x[i]);
		if(x[i]=='R')
			r++;
		else
			w++;
	}
	ll ans = 0;
	f(i, r){
		if(x[i]!='R'){
			ans++;
		}
	}
	cout << ans << "\n";
	return 0;
}


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

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

  int64_t answer = 0;
  for (int i = 0; i < N; i++) {
    answer += a[N * 3 - 2 - i * 2];
  }
  cout << answer << endl;
}


Measured memory_bytes: 1408
w,a,b=map(int,input().split())
ans=0
if a<b:
  if b-a>w:
    print(b-a-w)
  else:
    print(0)
elif a==b:
  print(0)
else:
  if a-b>w:
    print(a-b-w)
  else:
    print(0)

Measured memory_bytes: 3060
use std::vec::Vec;
use std::cmp::{max, min};

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()
}

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

fn read_touple<T: std::str::FromStr + Copy>() -> (T, T) {
  let v: Vec<T> = read_vec();
  assert_eq!(v.len(), 2);
  (v[0], v[1])
}

fn main() {
  let n: usize = read();
  let mut l: Vec<usize> = read_vec();
  let m = l.iter().fold(0, |acc, &x| max(acc, x));
  l.sort();

  //count[i]は以下の数字の個数
  let mut count = vec![0; 2 * m + 2];
  for &e in &l {
    count[e] += 1;
  }
  for i in 0..2*m + 1 {
    count[i+1] += count[i];
  }
  
  //println!("{:?}", count);

  let mut ans: usize = 0;
  for i in 0..n {
    for j in i+1..n {
      let b = l[i] as i64;
      let c = l[j] as i64;
      let (left, right) = ((b - c).abs() as usize , (b + c) as usize);
      let l = count[left];
      let r = count[right-1];

      ans += r - l; 
      if left < (b as usize) && (b as usize) < right {
         ans -= 1;
      }
      if left < (c as usize) && (c as usize) < right {
         ans -= 1;
      }
      // println!("b = {}, c = {}", b, c);
      // println!("left = {}, right = {}", left, right);
      // println!("{} {}", count[left], count[right]);
      // println!("{}\n", ans);
    }
  }
  println!("{}", ans/3)
}



Measured memory_bytes: 4352
#include<stdio.h>

#include<algorithm>


using namespace std ;


int ans[ 10000 + 1 ] ;

int v[ 100 + 1 ] ;
int w[ 100 + 1 ] ;


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


	int i ,j ;
	for( i = 0 ; i < n ; ++i )
	{
		scanf( "%d %d" ,&v[ i ] ,&w[ i ] ) ;

		ans[ w[ i ] ] = max( ans[ w[ i ] ] ,v[ i ] ) ;
	}


	for( i = 1 ; i <= W ; ++i )
	{
		if( ans[ i ] != 0 )
		{
			for( j = 0 ; j < n ; ++j )
			{
				if( i + w[ j ] <= W )
				{
					ans[ i + w[ j ] ] = max( ans[ i + w[ j ] ] ,ans[ i ] + v[ j ] ) ;
				}
			}


			ans[ 0 ] = max( ans[ 0 ] ,ans[ i ] ) ;
		}
	}


	printf( "%d\n" ,ans[ 0 ] ) ;


	return 0 ;
}

Measured memory_bytes: 2772
#include<stdio.h>
#include<limits.h>

void merge(int,int,int);
void mergeSort(int,int);

int num[50000000];
int left=0,right;
int L[10000000];
int R[10000000];
int cnt;

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

  for(i=0;i<n;i++){
    scanf("%d",&num[i]);
  }
  right=n;
  cnt=0;

  mergeSort(left,right);

  for(i=0;i<n;i++){
    if(n==i+1) printf("%d\n",num[i]);
    else printf("%d ",num[i]);
  }
  printf("%d\n",cnt);

  return 0;
}

void mergeSort(int left,int right){
  int mid;
  if (left+1<right){
    mid=(left+right)/2;
    mergeSort(left,mid);
    mergeSort(mid,right);
    merge(left,right,mid);
  }
}

void merge(int left,int right,int mid){
  int i,j,k;
  int n1,n2;
  n1=mid-left;
  n2=right-mid;

  for(i=0;i<n1;i++){
    L[i]=num[left+i];
  }
  for(j=0;j<n2;j++){
    R[j]=num[mid+j];
  }
  
  L[n1]=INT_MAX;
  R[n2]=INT_MAX;

  i=0;
  j=0;
  
  for(k=left;k<right;k++){
    cnt++;
    if(L[i]<=R[j]){
      num[k]=L[i];
      i++;
    }

    else{
      num[k]=R[j];
      j++;
	}
  }
}

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

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

  int max_count = 0;
  int count = 1;

  int prev;
  cin >> prev;
  for (int n = 1; n < N; n++) {
	int a;
	cin >> a;

	if (a > prev) {
	  max_count = max(max_count, count);
	  count = 1;
	} else {
	  count++;
	}
	prev = a;
  }
  max_count = max(max_count, count);

  cout << max_count - 1 << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  vector <vector <string>>vec(2);
  int n,m,counter,ans=0;
  string strin;
  
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>strin;
    vec.at(0).push_back(strin);
  }
  cin>>m;
  for (int k=0;k<m;k++){
    cin>>strin;
    vec.at(1).push_back(strin);
  }
  string st;
  for(int l=0;l<2;l++){
    for(string str:vec.at(l)){    
      st=str;
      counter=0;
      for(int o=0;o<2;o++){
    	for(string tr:vec.at(o)){
        
          if(tr==st){
            if(o==0)
              counter++;
            else if (o==1)
              counter--;
          }   
          else
            continue;
        }        
      }
    if(ans<counter)
            ans=counter;
          else
            continue;    
    }

  }
  cout<<ans<<endl;
  }

      

Measured memory_bytes: 3660
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <iomanip>
#include <cassert>
using namespace std;

#define GET_ARG(a,b,c,F,...) F
#define REP3(i,s,e) for (i = s; i <= e; i++)
#define REP2(i,n) REP3 (i,0,(int)(n)-1)
#define REP(...) GET_ARG (__VA_ARGS__,REP3,REP2) (__VA_ARGS__)
#define RREP3(i,s,e) for (i = s; i >= e; i--)
#define RREP2(i,n) RREP3 (i,(int)(n)-1,0)
#define RREP(...) GET_ARG (__VA_ARGS__,RREP3,RREP2) (__VA_ARGS__)
#define DEBUG(x) cerr << #x ": " << x << endl

typedef long long ll;

constexpr int INF = 1e8;
constexpr int MOD = 1e9+7;
constexpr int ESP = 1e-9;
constexpr double PI = acos(-1);

int main(void) {
    int i, cnt5, cnt7;
    cnt5 = cnt7 = 0;
    REP (i,3) {
        int x;
        cin >> x;
        if (x == 5) cnt5++;
        else if (x == 7) cnt7++;
    }
    if (cnt5 == 2 && cnt7 == 1)
        cout << "YES" << endl;
    else
        cout << "NO" << endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
public class Main{
  public static void main(String[] args){
    Scanner scan = new Scanner(System.in);
    int x = scan.nextInt();
    int y = scan.nextInt();
    int flag = 0;
    for (int i = 0; i <= x; i++){
      if ((y-2*i)%4 == 0 && (y - 2 * i)/4 == x-i){
        flag++;
        System.out.println("Yes");
        break;
      }
    }
    if  (flag == 0){
      System.out.println("No");
    }
  }
}

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


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

	deque<int> deq;
	for (int i = 0; i < n; i++) {
		int a;
		cin >> a;
		if (i % 2 == (n - 1) % 2) {
			deq.push_front(a);
		}
		else {
			deq.push_back(a);
		}
	}
	for (int i = 0; i < n; i++) {
		if (i) cout << " ";
		cout << deq.at(i);
	}
	cout << endl;
}

Measured memory_bytes: 2944
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <cmath>
#include <deque>
#include <iterator>
#include <map>
#include <queue>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <limits>
#include <iomanip>
using namespace std;

using ll=long long;
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
#define rep(i, k, n) for (ll i=k; i<(ll)n; ++i)
#define REP(i, n) rep(i, 0, n)
template<class T> inline bool chmax(T& a, T b) {if (a<b) {a=b; return true;} return false;}
template<class T> inline bool chmin(T& a, T b) {if (a>b) {a=b; return true;} return false;}

const ll MOD = 1000000007;
const ll HIGHINF = (ll)1e18;

int main() {
  ll n; cin >> n;
  vll l(2*n);
  REP(i, 2*n) cin >> l[i];
  sort(l.begin(), l.end());
  ll ans = 0;
  for(ll i=0; i<2*n; i+=2) ans += l[i];
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define FIO             ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;

int32_t main()
{
	FIO;
	string s; cin >> s;

	if (s[0] == '7' || s[1] == '7' || s[2] == '7')
		cout << "Yes";
	else
		cout << "No";
	return 0;
}

Measured memory_bytes: 3656
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define pi M_PI
#define R cin>>
#define Z class
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define REP(i,m,n) for(int i=(int)(m);i<(int)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
template<Z A>void pr(A a){cout<<a;ln;}
template<Z A,Z B>void pr(A a,B b){cout<<a<<' ';pr(b);}
template<Z A,Z B,Z C>void pr(A a,B b,C c){cout<<a<<' ';pr(b,c);}
template<Z A,Z B,Z C,Z D>void pr(A a,B b,C c,D d){cout<<a<<' ';pr(b,c,d);}
template<Z A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;}
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}
const ll MAX=1000000007,MAXL=1LL<<61,dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
typedef pair<int,int> P;

void Main() {
  int n,c,k;
  cin >> n >> c >> k;
  ll ans=0;
  ll a[n],x=-MAX,y=0;
  rep(i,n) R a[i];
  sort(a,a+n);
  rep(i,n) {
    if(abs(x-a[i])>k||y==c) {
      x=a[i];
      ans++;
      y=0;
    }
    y++;
  }
  pr(ans);
}

int main(){ios::sync_with_stdio(0);cin.tie(0);Main();return 0;}


Measured memory_bytes: 1152
# -*- coding: utf-8 -*-

# input
N = int(input())
H = list(map(int, input().split()))

# solve
ans = 1
for i in range(1, N):
    flag = True
    for j in range(i):
        if H[j] > H[i]:
            flag = False
    if flag:
        ans += 1

# output
print(ans)


Measured memory_bytes: 2940
#include <bits/stdc++.h>
#include <iomanip>      // std::setprecision
using namespace std;
#define what_is(x) cerr << #x << " is " << x << endl;
#define bit(x,i) (x&(1<<i))  //select the bit of position i of x
#define lowbit(x) ((x)&((x)^((x)-1))) //get the lowest bit of x
#define hBit(msb,n) asm("bsrl %1,%0" : "=r"(msb) : "r"(n)) //get the highest bit of x, maybe the fastest
#define max(a,b) (a<b?b:a)
#define IN(i,l,r) (l<i&&i<r) //the next for are for checking bound
#define LINR(i,l,r) (l<=i&&i<=r)
#define LIN(i,l,r) (l<=i&&i<r)
#define INR(i,l,r) (l<i&&i<=r)
#define F(i,L,R) for (int i = L; i < R; i++) //next four are for "for loops"
#define FE(i,L,R) for (int i = L; i <= R; i++)
#define FF(i,L,R) for (int i = L; i > R; i--)
#define FFE(i,L,R) for (int i = L; i >= R; i--)
#define char2Int(c) (c-'0')
#define lastEle(vec) vec[vec.size()-1] 
#define SZ(x) ((int)((x).size()))
#define REMAX(a,b) (a)=max((a),(b)) // set a to the maximum of a and b
#define REMIN(a,b) (a)=min((a),(b));
#define FENWICK(k) (k&-k)
#define FOREACH(i,t) for (auto i=t.begin(); i!=t.end(); i++) // traverse an STL data structure
#define ALL(c) (c).begin(),(c).end() //handy for function like "sort()"
#define PRESENT(c,x) ((c).find(x) != (c).end()) 
#define CPRESENT(c,x) (find(ALL(c),x) != (c).end()) 
#define LL long long //data types used often, but you don't want to type them time by time
#define ull unsigned long long
#define ui unsigned int
#define us unsigned short
#define IOS ios_base::sync_with_stdio(0); //to synchronize the input of cin and scanf
#define INF 1001001001
#define PI 3.1415926535897932384626
//for map, pair
#define mp make_pair
#define fi first
#define se second
//for vectors
#define pb push_back
typedef int elem_t;
typedef vector<int> vi; 
typedef vector<vi> vvi; 
typedef pair<int,int> ii; 
// directions
const int fx[4][2] = {{0,1}, {0,-1}, {1,0}, {-1,0}};
const int fxx[8][2] = {{0,1}, {0,-1}, {1,0}, {-1,0}, {1,1}, {1,-1}, {-1,1}, {-1,-1}};
const int rogi[4][2] = { {1,1}, {1,-1}, {-1,1}, {-1,-1} };

void dane() {
	int n,p;
	cin>>n>>p;
	p+=3*n;
	cout<<(p/2)<<endl;
}    


int main() {
	IOS
	// int t;
	// cin>>t;
	// F(i,0,t)
	    dane();
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    double A,B,C,D,E,F;
    cin>>A>>B>>C>>D>>E>>F;
    double wnow=0,snow=0,dense=0,maxdense=-1.0,maxs=0,maxw=0,limdense=100*E/(100+E);
    for(int i=0;100*A*i<=F;i++){
        for(int j=0;100*B*j<=F;j++){
            for(int k=0;C*k<=F;k++){
                for(int l=0;D*l<=F;l++){
                   wnow=100*A*i+100*B*j;
                   snow=C*k+D*l;
                   if((snow+wnow)!=0&&(snow+wnow)<=F){
                       dense=100*snow/(snow+wnow);
                       if(dense>maxdense&&dense<=limdense){maxdense=dense; maxs=C*k+D*l; maxw=100*(A*i+B*j);}
                   }
                }
            }
        }
    }
    cout<<maxw+maxs<<' '<<maxs;
    return 0;
}


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

int main() {
  while (1) {
    string N;
    cin >> N;
    if (N == "-") break;
    int m;
    cin >> m;
    for (int i = 0; i < m; i++) {
      int n;
      cin >> n;
      N = N.substr(n) + N.substr(0, n);
    }
    cout << N << endl;
    }
}


Measured memory_bytes: 3156
#include <bits/stdc++.h>
#define rep(i, n) for (rint i = 1; i <= (int)(n); i ++)
#define re0(i, n) for (rint i = 0; i < (int) n; i ++)
#define travel(i, u) for (rint i = head[u]; i; i = e[i].nxt)
#define rint register int
using namespace std;

typedef long long lo;

template<typename tp> inline void read(tp &x) {
    x = 0; char c = getchar(); int f = 0;
    for (; c < '0' || c > '9'; f |= c == '-', c = getchar());
    for (; c >= '0' && c <= '9'; x = (x << 3) + (x << 1) + c - '0', c = getchar());
    if (f) x = -x;
}

int n, K;
string S;

inline void up(string &x, string y) {
	if (x.length() == 0 || x > y) x = y;
}

inline string rev(string str) {
	reverse(str.begin(), str.end());
	return str;
}

inline string split(string &t, int l, int r, bool f) {
	string ans = t.substr(l, r - l);
	if (f) ans = rev(ans);
	return ans;
}

int main(void) {
	cin >> n >> K;
	cin >> S;
	while (true) {
		string T = rev(S);
		string U = S + T;
		string ans = "";
		for (int i = 0; i <= n; i++) {
			up(ans, split(U, i, i + n, K == 1));
		}
		if (K > 1) ans = rev(ans);
		int ok = 1;
		for (int i = 1; i < n; i++)
			if (ans[i] != ans[0]) ok = 0;
		if (K == 1 || ok) {
			cout << ans << "\n";
			return 0;
		}
		S = ans;
		--K;
	}
}


Measured memory_bytes: 256
package main
import (
  "fmt"
  // "math"
)

func main() {
  var (
    x1 int
    y1 int
    x2 int
    y2 int
  )
  fmt.Scan(&x1, &y1, &x2, &y2)

  x3 := x2 + y1 - y2
  y3 := y2 - x1 + x2
  x4 := x1 + y1 - y2
  y4 := y1 - x1 + x2

  fmt.Printf("%d %d %d %d", x3, y3, x4, y4)

}


Measured memory_bytes: 512
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <array>
 
using namespace std;
using ll = long long;
 
int main()
{
    ll N, K;
    array<ll, 200001> A[2];
 
    cin >> N >> K;
    for (ll j = 1; j <= N; j++) cin >> A[0][j];
 
    for (ll k = 1; k <= min(42LL, K); k++)
    {
        for (ll i = 1; i <= N; i++) A[k % 2][i] = 0;
        for (ll i = 1; i <= N; i++)
        {
            ll d = A[(k + 1) % 2][i];
            A[k % 2][max(1LL, i - d)]++;
            if (i + d + 1 <= N) A[k % 2][i + d + 1]--;
        }
        for (ll i = 1; i < N; i++) A[k % 2][i + 1] += A[k % 2][i];
    }
 
    for (ll i = 1; i <= N; i++)
    {
        cout << (i == 1 ? "" : " ") << A[K % 2][i];
    }
    cout << endl;
}

Measured memory_bytes: 6712
#include <cstdio>
#include <algorithm>
#include <limits>

constexpr int MAX_NV = 100;
constexpr long MAX_W = 1000000000;
constexpr long INF = std::numeric_limits<long>::max();

int main(){
	int N, W, v[MAX_NV], w[MAX_NV];
	long dp[MAX_NV * MAX_NV + 1]{};

	scanf("%d%d", &N, &W);

	for(int i = 0 ; i <= N * MAX_NV; ++i){
		dp[i] = INF;
	}

	for(int i = 0; i < N; ++i){
		scanf("%d%d", &v[i], &w[i]);
	}

	dp[0] = 0;

	for(int i = 0; i < N; ++i){
		for(int j = N * MAX_NV; j >= 0; --j){
			if(j >= v[i]){
				if(dp[j - v[i]] != INF && dp[j - v[i]] + w[i] <= W){
					dp[j] = std::min(dp[j - v[i]] + w[i], dp[j]);
				}
			}
		}
	}

	int ans = 0;

	for(int i = 0; i <= MAX_NV * N; ++i){
		if(dp[i] != INF){
			ans = i;
		}
	}
	
	printf("%d\n", ans);

	return 0;
}

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

using namespace std;


int main ()
{
    int n;
    cin>>n;
    int a;
    vector<int>b;
    while(n--)
    {
        cin>>a;
        a*=-1;
        int it=upper_bound(b.begin(),b.end(),a)-b.begin();
        if(it==b.size())
        {
            b.push_back(a);
        }
        else
            b[it]=a;

    }
    cout<<b.size()<<endl;
    return 0;
}

Measured memory_bytes: 892
N=int(input())
inf=float("inf")
A=[list(map(int,input().split())) for _ in range(N)]

def calc():
    ans=0
    for i in range(N):
        for j in range(N):
            used=True
            for k in range(N):
                if A[i][j]>A[i][k]+A[k][j]:
                    return -1
                if i==k or k==j:continue
                if A[i][j]==A[i][k]+A[k][j]:
                    used=False
            if used:
                ans+=A[i][j]
    return ans//2
                
print(calc())

Measured memory_bytes: 43868
from sys import stdin
import sys
import math
from functools import reduce
import functools
import itertools
from collections import deque,Counter,defaultdict
from operator import mul
import copy
# ! /usr/bin/env python
# -*- coding: utf-8 -*-
import heapq
sys.setrecursionlimit(10**6)
# INF =  float("inf")
INF = 10**18
import bisect
import statistics
mod = 10**9+7
# mod = 998244353

def unset_nth_bit(S, j):
    # Sの右からj bit目を0にする
    return S & ~(1 << j)

def set_nth_bit(S, j):
    # Sの右からj bit目を1にする
    return S | (1 << j)

def bit(S, j):
    # Sの右からj bit目(0-indexed)
    return (S>>j)&1

N, M = map(int, input().split())

a = []
c = []
for i in range(M):
    p, q = map(int, input().split())
    a.append(p)
    c.append(list(map(int, input().split())))

dp = [[INF for j in range(1<<N)] for i in range(M+1)]
dp[0][0] = 0

for i in range(M):
    for S in range(1<<N):
        SS = S
        for cc in c[i]:
            SS = set_nth_bit(SS, cc-1)
        dp[i+1][SS] = min(dp[i+1][SS], dp[i][S] + a[i])
        dp[i+1][S] = min(dp[i+1][S], dp[i][S])

if dp[M][(1<<N)-1] == INF:
    print(-1)
else:
    print(dp[M][(1<<N)-1])

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

class F
{
	struct LR
	{
		public long L, R;
	}

	static void Main()
	{
		var h = Console.ReadLine().Split().Select(long.Parse).ToArray();
		long n = h[0], x = h[1], d = h[2];

		if (d == 0) { Console.WriteLine(x == 0 ? 1 : n + 1); return; }
		if (d < 0) { d = -d; x = -x; }

		var map = new Dictionary<long, List<LR>>();
		for (long i = 0; i <= n; i++)
		{
			var l = i * (i - 1) / 2;
			var r = l + i * (n - i);

			var a = i * x;
			var m = (a % d + d) % d;
			a = (a - m) / d;

			if (!map.ContainsKey(m)) map[m] = new List<LR>();
			map[m].Add(new LR { L = a + l, R = a + r });
		}

		var c = 0L;
		foreach (var lrs in map.Values)
		{
			var r = long.MinValue;
			foreach (var lr in lrs.OrderBy(s => s.L).Where(s => s.R > r))
			{
				c += lr.R - Math.Max(r, lr.L - 1);
				r = lr.R;
			}
		}
		Console.WriteLine(c);
	}
}


Measured memory_bytes: 58116
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    a = readline().strip()
    if a.isupper():
        print('A')
    else:
        print('a')
    
    return


if __name__ == '__main__':
    main()


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

int main() {
    int n, k;
    cin >> n >> k;
    int d[101];
    vector<int> O(n,0);

    for(int i = 0; i < k; i++) {
        cin >> d[i];
        for(int j = 0; j < d[i]; j++) {
            int tmp;
            cin >> tmp;
            O[tmp-1] = 1;
        }
    }

    int ret = 0;
    for(int i = 0; i < n; i++) {
        if(O[i] == 0) {
            ret++;
        }
    }

    cout << ret << endl;
}

Measured memory_bytes: 3628
"""
入力フォーマット
N
T A
H_1 ... H_N

N:候補地点数
T:標準気温
A:所望の気温
H_i:地点iの高さ

高さxの地点の平均気温はT-x*0.06
"""

N = int(input())
line = input().rstrip().split(" ")
T = int(line[0])
A = int(line[1])
H = list(map(int, input().split(" ")))

min = 1000
min_i = 0
for i in range(N):
	if min > abs(A-(T-0.006*H[i])):
		min = abs(A-(T-0.006*H[i]))
		min_i = i+1


print(min_i)


Measured memory_bytes: 3064
#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
using namespace std;

struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

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

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

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

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


int main(){
	int n,m;
	cin >> n >> m;
	vector<int> data(n);
	for(int i=0;i<n;++i){
		cin >> data[i];
		data[i]--;
	}
	UnionFind uf(n);
	int x,y;
	for(int i=0;i<m;++i){
		cin >> x >> y;
		x--;y--;
		uf.unite(x,y);
	}
	
	int res = 0;
	for(int i=0;i<n;++i){
		if(uf.same(i,data[i])) res++;
	}
	
	cout << res <<endl;
	
	return 0;
}



Measured memory_bytes: 1024
#include<bits/stdc++.h>
//#include <numeric>
using namespace std;
#define int long long int
int32_t main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    #ifdef LOCAL_PROJECT
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    int h,w,a[1005][1005]={0},i,j,x=1000000007;
    char s[1005][1005];
    cin>>h>>w;
    a[1][1]=1;
    for(i=1;i<=h;i++)
    {
        for(j=1;j<=w;j++)
        {
            cin>>s[i][j];    
        }
    }
    for(i=1;i<=h;i++)
    {
        for(j=1;j<=w;j++)
        {
            if(s[i][j]=='.')
            {
                a[i][j]+=a[i-1][j]+a[i][j-1];
                a[i][j]%=x;
            }
            else
            {
                a[i][j]=0;
            }
        }
    }
    cout<<a[h][w];
}

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

int main(){
  string s;
  cin >> s; 
  int cnt = 0;
  if(s[0] == 'o'){
    cnt++;
  }
  if(s[1] == 'o'){
    cnt++;
  }
  if(s[2] == 'o'){
    cnt++;
  }
  cout << 700+(cnt*100) << endl;
  return 0;
}


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

using namespace std;

/* alias */
using ll = long long;
using vi = vector<int>;
using pii = pair<int, int>;
using vpii = vector<pii>;

/* const */
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7;

/* repetition */
#define rep(i, n) for(int i=0;i<(n);++i)
#define repe(i, n) for(int i=0;i<=(n);++i)
#define repr(i, n) for(int i=(n-1);i>=0;--i)
#define repre(i, n) for(int i=(n);i>=0;--i)
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define FORE(i, a, b) for(int i=(a);i<=(b);++i)
#define FORR(i, a, b) for(int i=(b-1);i>=(a);--i)
#define FORRE(i, a, b) for(int i=(b);i>=(a);--i)

int main() {
    string S,T;
    cin >> S >> T;
    int ans=0;
    rep(i, 3)
    {
        if (S.at(i) == T.at(i)){
                ans++;
            }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
N = int(input())
x = [list(map(int,input().split())) for _ in range(N)]
su = 0
for i in range(N):
    for j in range(N):
        su += ((x[i][0]-x[j][0])**2 + (x[i][1]-x[j][1])**2)**0.5
ans = su / N
print(ans)

Measured memory_bytes: 9380
#include <algorithm>
#include <cassert>
#include <cmath>
#include <iostream>
using namespace std;
typedef long long LL;

int main() {
  LL a, b, c; cin >> a >> b >> c;
  LL d = c - a - b;

  if (d > 0 && d * d > 4 * a * b) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}


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

using namespace std;
typedef long long ll;
const int N = 2e5 + 10;
const ll inf = 1e15;
typedef pair<ll, ll> pii;
const ll p = 1e9 + 7;
pii balls[N];
vector<vector<ll> > color;
int len[N];
bool main_part[N];
ll len_main_part = 0;
ll fact[N];

ll mul(ll a, ll b) {
    return (a * b) % p;
}

ll Pow(ll a, ll n) {
    if (n == 0)
        return 1;
    ll res = Pow(a, n / 2);
    res = mul(res, res);
    if (n % 2 == 1) {
        res = mul(res, a);
    }
    return res;
}

ll rev(ll a) {
    return Pow(a, p - 2);
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(nullptr);
    int n;
    ll x, y;
    cin >> n >> x >> y;
    color.resize(n);
    for (int i = 0; i < N; i++) {
        fact[i] = (i == 0 ? 1 : mul(fact[i - 1], i));
    }
    for (int i = 0; i < n; i++) {
        cin >> balls[i].second >> balls[i].first;
        balls[i].second--;
        color[balls[i].second].push_back(balls[i].first);
    }
    sort(balls, balls + n);
    for (int i = 0; i < n; i++) {
        sort(color[i].begin(), color[i].end());
    }

    int fc = balls[0].second;
    ll sw = inf;
    for (int i = 0; i < n; i++) {
        if (balls[i].second != fc) {
            sw = balls[i].first;
            break;
        }
    }

    for (int i = 0; i < n; i++) {
        if (color[i].size() == 0)
            continue;
        len[i] = 1;
        for (int j = 1; j < color[i].size(); j++) {
            if (color[i][j] + color[i][0] <= x)
                len[i]++;
            else if (i != balls[0].second && color[i][j] + balls[0].first <= y) {
                len[i]++;
            } else if (color[i][j] + sw <= y) {
                len[i]++;
            } else {
                break;
            }
        }
        if (i == balls[0].second || color[i][0] + balls[0].first <= y) {
            main_part[i] = true;
            len_main_part += len[i];
        }
    }
    ll res = fact[len_main_part];
    for (int i = 0; i < n; i++) {
        if (main_part[i]) {
            res = mul(res, rev(fact[len[i]]));
        }
    }
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 15232
x,n = map(int,input().split())
p = list(map(int,input().split()))

for i in range(200):
    ans1 = x - i
    ans2 = x + i
    if ans1 not in p:
        print(ans1)
        break
    if ans2 not in p:
        print(ans2)
        break

Measured memory_bytes: 9176
import java.util.Arrays;
import java.util.Collections;
import java.util.Scanner;

public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		Integer[] a = new Integer[5];
		for(int i = 0; i < 5; i++) {
			a[i] = sc.nextInt();
		}
		sc.close();
		Arrays.sort(a, Collections.reverseOrder());
		for(int i = 0; i < 5; i++) {
			if(i == 4) {
				System.out.println(a[i]);
			}else {
				System.out.printf("%d ", a[i]);
			}
		}
	}
}


Measured memory_bytes: 26300
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long 
#define inf 0x3f3f3f3f
#define infll 0x3f3f3f3f3f3f3f3f
#define all(x) (x).begin(),(x).end()
#define pb push_back

#define F_OR(i, a, b, s) for (int i=(a); (s)>0?i<(b):i>(b); i+=(s))
#define F_OR1(e) F_OR(i, 0, e, 1)
#define F_OR2(i, e) F_OR(i, 0, e, 1)
#define F_OR3(i, b, e) F_OR(i, b, e, 1)
#define F_OR4(i, b, e, s) F_OR(i, b, e, s)
#define GET5(a, b, c, d, e, ...) e
#define F_ORC(...) GET5(__VA_ARGS__, F_OR4, F_OR3, F_OR2, F_OR1)
#define FOR(...) F_ORC(__VA_ARGS__)(__VA_ARGS__)
#define EACH(x, a) for (auto& x: a)
 
// debug templates 
#define debug(x)       cerr<< #x <<" : "<< x << endl;
#define debuga(A,N)    cerr<< #A <<" : [";for(int i = 0; i<N;i++) cerr<<A[i]<<" "; cerr<<"]\n";
#define debuga2(A,N,M) cerr<< #A << " : \n"; for(int i=0;i<N;i++){cerr<<"[";for(int j=0;j<M;++j) cerr<<A[i][j]<<" ";cerr<<"]\n";}
#define debugp(p)      cerr<< #p <<" : "<<"("<<(p).first<<","<<(p).second<<")\n";
#define debugv(v)      cerr<< #v <<" : "<<"[";for(int i = 0; i< (v).size(); i++) cerr<<v[i]<<" "; cerr<<"]\n";
#define debugv2(v)     cerr<< #v << " : \n"; for(int i=0;i<v.size();i++){cerr<<"[";for(int j=0;j<(v[0].size());++j) cerr<<v[i][j]<<" ";cerr<<"]\n";}
#define debugs(m)      cerr<< #m <<" : [ "; for(auto itr = m.begin(); itr!=m.end();itr++) cerr<<*itr<<" "; cerr<<"]\n";
#define debugm(m)      cerr<< #m <<" : [ "; for(auto itr = m.begin();itr!=m.end(); itr++) cerr<<"("<<itr->first<<","<<itr->second<<") ";cerr<<"]\n";
 

void solve(){
	ll r,d,x; cin >> r >> d >> x;
	FOR(10){
		x = r*x - d;
		cout << x << '\n';
	}
}
 
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	
	solve();
	return 0;
}
 


Measured memory_bytes: 3644
#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++)
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(){
    string S;
    cin >> S;
    int N = S.size();
    ll ans = 0;
    REP(i,N/2){
        char x = S[i];
        char y = S[N-1-i];
        if(x != y)
            ans++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <algorithm>

using namespace std;

int main(){
  int N,X,Y;
  char x[1024],y[1024];
  int dp[1024][1024];
  scanf("%d",&N);
  while(N--){
    scanf("%s%s", x, y);
    X = strlen(x); Y = strlen(y);
    memset(dp, 0, sizeof dp);
    for(int i=0;i<X;i++){
      for(int j=0;j<Y;j++){
	if(x[i]==y[j]) dp[i+1][j+1] = dp[i][j]+1;
	else dp[i+1][j+1] = max(dp[i+1][j], dp[i][j+1]);
      }
    }
    printf("%d\n", dp[X][Y]);
  }
  return 0;
}

Measured memory_bytes: 5136
from collections import deque
n, m = map(int,input().split())
ab = [list(map(int,input().split())) for _ in range(m)]

q = deque([])
path = [-1] * n
ver = [[] for _ in range(n)]
for i in range(m):
    ab[i].sort()
    if ab[i][0] == 1:
        q.append([ab[i][0]-1,ab[i][1]-1])
        #path[ab[i][1]-1] = 1
    ver[ab[i][0]-1].append(ab[i][1]-1)
    ver[ab[i][1]-1].append(ab[i][0]-1)

def bfs(q, visited_list):
    while len(q) > 0:
        now = q.popleft()
        go = now[1]
        if visited_list[go] == -1:
            visited_list[go] = now[0]+1
            for i in range(len(ver[go])):
                q.append([go,ver[go][i]])
    return visited_list
ans = bfs(q,path)
print('Yes')
for i in range(1,n):
    print(ans[i])


Measured memory_bytes: 102508
#include<cstdio>
#include<algorithm>
using namespace std;
#define MAXN 105
int main()
{
	int n;
	scanf("%d",&n);
	int ls=-1,x,cnt=0,ans=0;
	for(int i=0;i<n;i++)
	{
		scanf("%d",&x);
		if(x!=ls)
		{
			ans+=cnt/2;
			ls=x;
			cnt=1;
		}
		else cnt++;
	}
	ans+=cnt/2;
	printf("%d\n",ans);
}

Measured memory_bytes: 128
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

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

  static class CPrison {
    public void solve(int testNumber, InputReader in, PrintWriter out) {
      int n = in.nextInt(), m = in.nextInt();
      int[] ar = new int[n + 4];
      for (int i = 0; i < m; i++) {
        int l = in.nextInt(), r = in.nextInt();
        ar[l]++;
        ar[r + 1]--;
      }
      int ans = 0;
      for (int i = 1; i <= n; i++) {
        ar[i] += ar[i - 1];
        if (ar[i] == m)
          ans++;
      }
      out.println(ans);
    }

  }


  static class InputReader {
    private BufferedReader reader;
    private StringTokenizer tokenizer;

    public InputReader(InputStream stream) {
      reader = new BufferedReader(new InputStreamReader(stream), 32768);
      tokenizer = null;
    }

    public String next() {
      while (tokenizer == null || !tokenizer.hasMoreTokens()) {
        try {
          tokenizer = new StringTokenizer(reader.readLine());
        } catch (IOException e) {
          throw new RuntimeException(e);
        }
      }
      return tokenizer.nextToken();
    }

    public int nextInt() {
      return Integer.parseInt(next());
    }

  }
}



Measured memory_bytes: 40820
import math

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
    if temp!=1:
        arr.append([temp, 1])
    if arr==[]:
        arr.append([n, 1])
    return arr

def saidai(n):
    ans = int(math.sqrt(2 * n)) - 1
    while 2 * n >= (ans + 1) * (ans + 2):
        ans += 1
    return(ans)

N = int(input())
fac = factorization(N)
index = []
for i in fac:
    index.append(i[1])
ans = 0
for i in index:
    ans += saidai(i)
if N == 1:
    print(0)
else:
    print(ans)

Measured memory_bytes: 9500
#include <bits/stdc++.h>
//#define int long long
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define FOR(i,a,b) for (int i = a; i < b; ++i)
#define ROF(i,b,a) for (int i = (b)-1; i >= a; --i)
using namespace std;

const int N = 5010, P = 1e9+7;
typedef long long ll;

int qpow(int a, int x) {
	int ret = 1;
	for (; x; a = 1ll*a*a%P, x >>= 1) if (x&1) ret = 1ll*ret*a%P;
	return ret;
}

int n, m;
int f[N][N], s[N][N], pow2[N], inv2[N];

signed main() {
	scanf("%d%d", &m, &n);
	FOR(i,0,n+1) {
		pow2[i] = qpow(2, i);
		inv2[i] = qpow(2, P-1-i);
	}
	FOR(i,1,n+1) {
		f[0][i] = 1;
		s[0][i] = (s[0][i-1] + 1ll*inv2[i]*i%P*f[0][i])%P;
		//printf("s[%d][%d] = %d\n", 0, i, s[0][i]);
	}
	FOR(i,1,m+1) {
		FOR(j,1,n+1) {
			f[i][j] = ((j+1ll)*f[i-1][j] + 1ll*pow2[j-1]*s[i-1][j-1])%P;
			s[i][j] = (s[i][j-1] + 1ll*inv2[j]*j%P*f[i][j])%P;
			//printf("s[%d][%d] = %d\n", i, j, s[i][j]);
		}
	}
	printf("%d\n", f[m][n]);
}

Measured memory_bytes: 199556
#include <stdio.h>
#include <iostream>
#include <math.h>
#include <string>
#include <vector>
#include <algorithm>
#include <iomanip>

//#include <tuple>

//#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define ll long long
#define pb push_back

int main() {
  int h, n;
  cin >> h >> n;
  vector<int> a(n), b(n);

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

  vector<ll> dp(h + 2, 1LL<<60);
  dp[0] = 0;
  for(int i = 0; i < n; i++){
    for(int j = 0; j < h; j++) {
      int k = j + a[i];
      if (k > h) k = h + 1;
      dp[k] = min(dp[k], dp[j] + b[i]);
    }
  }
  // rep(i, h) {
  //   cout << dp[i] << endl;
  // }
  int ans = min(dp[h], dp[h+1]);
  cout << ans << endl;
}


Measured memory_bytes: 384
#include "bits/stdc++.h"

#define REP(i, a, b) for (ll i = (a); i <= (b); ++i)
#define REV(i, a, b) for (ll i = (a); i >= (b); --i)
#define FORV(a, A) for (auto &a : A)

using namespace std;

using ll = long long;

void Main()
{
   int N, K;
   cin >> N >> K;
   int k = 1;
   char S, prevS;
   cin >> prevS;
   REP(i, 1, N-1) {
      cin >> S;
      if (S!=prevS) {
         k++;
         swap(S, prevS);
      }
   }

   cout << min(N-k+2*K, N-1) << endl;
}

int main()
{
   std::cin.tie(nullptr);
   std::ios_base::sync_with_stdio(false);
   std::cout << std::fixed << std::setprecision(15);
   Main();
   return 0;
}



Measured memory_bytes: 256