akhauriyash/Code-Regression huggingface dataset:
//  Created by conan1024hao in 2019.
//  Copyright © 2019 conan1024hao. All rights reserved.
//  専用ライブラリです、自由にコピーして構いません。
//  感谢看我的代码！Wechat:conan1024hao QQ:810396815
#pragma GCC optimize ("O3")
#include <iostream>
#include <iomanip>
#include <istream>
#include <ostream>
#include <sstream>
#include <iterator>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <utility>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <ctime>
#include <cctype>
#include <cstdlib>
#define IINF 10e8
#define INF 10e16
#define MOD 1000000007
#define mod 1000000007
#define rep(i, a, n) for (ll i = a; i < (ll)(n); i++)
#define Endl endl
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define mmax(x,y)(x>y?x:y)
#define mmin(x,y)(x<y?x:y)
#define chmax(x,y) x=mmax(x,y)
#define chmin(x,y) x=mmin(x,y)
#define all(x) (x).begin(),(x).end()
#define siz(x) (ll)(x).size()
#define PI acos(-1.0)
using namespace std;
//using Int=int_fast64_t;
typedef long long int ll;
typedef pair<ll,ll>Pll;
typedef pair<int,int>Pin;
long long GCD(long long a, long long b) { return b ? GCD(b, a%b) : a; }
long long LCM(long long a, long long b)  {return a/GCD(a,b)*b;}
int dx[8]={-1,0,1,0,1,1,-1,-1};
int dy[8]={0,-1,0,1,1,-1,1,-1};
char dir[4]={'u','l','d','r'};
ll cmp1(pair<ll,string>a,pair<ll,string> b){
        if(a.fi!=b.fi)
        return a.fi<b.fi;
        else
        return a.se<b.se;
}
//--------------------------------------------------------------------------

//---------------------------------------------------------------------------
int main(){//問題をちゃんと見ろ!!!!!!!!!!!!!!!!!      llか??????????        memset()!!!!!!!!!!!!       ペナを減らせ!!!!!!!!!!!!!
    cin.tie(0);
    ios::sync_with_stdio(false);
    //-------------------------------
    int n;
        long long X=0,x=0,ans=1000000000000000000LL;
        cin>>n;
        vector<long long> a(n);
        for(int i=0;i<n;i++){
    cin>>a[i];
    X+=a[i]; }
        for(int i=0;i<n;i++){
            x+=a[i];
    if(i+1<n)ans=min(ans,abs(X-2*x)); }
        cout<<ans<<endl;
    //-------------------------------
    return 0;
}
//---------------------------------------------------------------------------




Measured memory_bytes: 1920
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
//xにはvectorなどのコンテナ
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x)) //最大値を求める
#define MIN(x) *min_element(ALL(x)) //最小値を求める
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
int gcd(int a, int b) {
    if (b==0) return a;
    else return gcd(b, a%b);
}
int lcm(int a, int b) {
    return a * b / gcd(a, b);
}
int main() {
    rep(i,5){
        int x;cin>>x;
        if(x==0){
            cout<<i+1<<endl;
        }
    }
    return 0;
}


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

int main() {
  int n;
  cin >> n;
  vector<int> d(n);
  for (int i = 0; i < n; i = i + 1) {
    cin >> d.at(i);
  }
  //increment insertion sort
  for (int i = 1; i < n; i = i + 1) {
    int key = d.at(i);
    int j;
    j = i - 1;
    while (j >= 0 && d.at(j) < key) {
      int temp;
      temp = d.at(j);
      d.at(j) = d.at(j + 1);
      d.at(j + 1) = temp;
      j = j - 1;
    }
  }
  
  int count = n;
  
  for (int i = 0; i < n - 1; i = i + 1) {
    if (d.at(i) == d.at(i + 1)) {
      count = count - 1;
    }
  }
  
  cout << count << endl;
}

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

int weishu(int n){
	int sum=0;
	while(n>0){
		n=n/10;
		sum++;
	}
	return sum;
}

int main()
{
	int n;
	int sum=0;
	cin >> n;
	while(n>0){
		if(weishu(n)%2!=0)
			sum++;
		n--;
	}
	printf("%d",sum);
	return 0;
}

Measured memory_bytes: 256
//! ----------------------------------------------
//! Framework <https://github.com/vain0x/procon>
//!
//! See the bottom of file for solution.
//! ----------------------------------------------

#![allow(unused_imports)]
#![allow(non_snake_case)]

use std::cell::RefCell;
use std::cmp::{max, min, Ordering};
use std::collections::*;
use std::fmt::{Debug, Display, Formatter, Write as FmtWrite};
use std::io::{stderr, stdin, BufRead, Write};
use std::mem::{replace, swap};
use std::ops::*;
use std::rc::Rc;

/// Print values to standard error if debug mode.
#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), stderr());
            writeln!(err, "\x1B[33m{}\x1B[0m = {:?}", e, $e).unwrap()
        })*
    };
}

/// Read from standard input and parse each word.
/// - `read!(T, U, ..)` parses a line as a tuple of words.
/// - `read![[T]]` parses a line as an array of words.
/// - `read![..; N]` parses `N` lines, using `read!(..)` repeatedly.
#[allow(unused_macros)]
macro_rules! read {
    ([$t:ty] ; $n:expr) =>
        ((0..$n).map(|_| read!([$t])).collect::<Vec<_>>());
    ($($t:ty),+ ; $n:expr) =>
        ((0..$n).map(|_| read!($($t),+)).collect::<Vec<_>>());
    ([$t:ty]) =>
        (rl().split_whitespace().map(|w| w.parse().unwrap()).collect::<Vec<$t>>());
    ($($t:ty),*) => {{
        let buf = rl();
        let mut w = buf.split_whitespace();
        ($(w.next().unwrap().parse::<$t>().unwrap()),*)
    }};
}

/// Read a line from standard input.
#[allow(dead_code)]
fn rl() -> String {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();

    #[allow(deprecated)]
    buf.trim_right().to_owned()
}

// -----------------------------------------------
// Solution
// -----------------------------------------------

fn main() {
    let (_, P) = read!(usize, usize);
    let S = rl();

    let mut total = 0;

    if P == 2 || P == 5 {
        for (i, c) in S.chars().enumerate() {
            if (c as u8 - b'0') as usize % P == 0 {
                total += i + 1;
            }
        }
    } else {
        let mut freq = vec![0; P];
        let mut x = 0;
        let mut h = 1;

        for c in S.chars().rev() {
            x += (c as u8 - b'0') as usize * h;
            x %= P;
            h *= 10;
            h %= P;
            freq[x] += 1_usize;
        }
        debug!(freq);

        freq[0] += 1_usize;

        for &m in &freq {
            if m >= 1 {
                total += m * (m - 1) / 2;
            }
        }
    }

    println!("{}", total)
}


Measured memory_bytes: 4352
#include<iostream>
#include<algorithm>
using namespace std;
int main() {
	int n, mi = 10000000, ma = -10000000;
	long long sum = 0;
	cin >> n;
	int b;
	for (int i = 0; i < n; ++i) {
		cin >> b;
		mi = min(mi, b);
		ma = max(ma, b);
		sum += b;
	}
	cout << mi << ' ' << ma << ' ' << sum << endl;
}


Measured memory_bytes: 3116
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string s;
  cin>>s;
  int kazu=s.size();
  string moji;
  int sa=INT_MAX;
  int x;
  for(int i=0;i<kazu-2;i++){
    string a=s.substr(i, 3);
    x=atoi(a.c_str());
    sa=min(sa,abs(753-x));
  }
  cout<<sa<<endl;
  return 0;
}

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


int N;
long int a[300000];

int cmpnum(const void *n1,const void *n2){
    if(*(long int *)n1<*(long int *)n2)
	return 1;
    else if(*(long int *)n1>*(long int *)n2)
	return -1;
    else 
	return 0;
}

int main()
{
    long int sum=0;
    scanf("%d",&N);
    for (int i=0;i<3*N;i++)
	scanf("%ld",&a[i]);
    qsort(a,3*N,sizeof(long int),cmpnum);
    for(int i=0;i<2*N;i++){
	if(i%2==1)
	    sum+=a[i];
    }
    printf("%ld\n",sum);
    return 0;
}



Measured memory_bytes: 4860
#include <stdio.h>

int main() {
  int n, i, j, array[100], count = 0, x;

  scanf("%d", &n);
  for(i = 0; i < n; i++)
    scanf("%d", &array[i]);

  for(i = 0; i < n; i++){
    for(j = (n-1); j >= i; j--){
      if(array[j] < array[j-1]){
        x = array[j];
        array[j] = array[j-1];
        array[j-1] = x;
        count++;
      }
    }
  }

    for(i =0; i < (n-1); i++)
      printf("%d ", array[i]);

    printf("%d\n", array[n-1]);
    printf("%d\n", count);

    return 0;
}

Measured memory_bytes: 600
#include <iostream>
#include <algorithm>
#include <string>
using namespace std; 
int main() { 
  int n; 
  while(1) { 
    int a[6]={1,2,3,4,5,6}, sum=1; 
    string x;  
    cin >> n;   
    if(n==0) break;   
    for(int i=0; i<n; i++) {   
      cin >> x;  
      if(x=="North") {  
	swap(a[0],a[1]);  
	swap(a[1],a[5]);   
	swap(a[5],a[4]);   
      } else if(x=="East") { 
	swap(a[0],a[3]);
	swap(a[3],a[5]);  
	swap(a[5],a[2]);   
      } else if(x=="West") { 
	swap(a[0],a[2]);   
	swap(a[2],a[5]);  
	swap(a[5],a[3]);  
      } else if(x=="South") { 
	swap(a[0],a[4]); 
	swap(a[4],a[5]);  
	swap(a[5],a[1]);   
      } else if(x=="Right") { 
	swap(a[1],a[2]);  
	swap(a[2],a[4]);   
	swap(a[4],a[3]);   
      } else if(x=="Left") {
	swap(a[1],a[3]);  
	swap(a[3],a[4]);  
	swap(a[4],a[2]);  
      }    
      sum+=a[0]; 
    }  
    cout << sum << endl; 
  } 
  return 0;
}


Measured memory_bytes: 1212
class Node:
	def __init__(self, v):
		self.v = v
		self.l = self.r = None
		self.p = -1
	def __str__(self):
		return str(self.v)

def find_pos(a, v):
	for i in range(len(a)):
		if a[i] == v:
			return i
	return -1

def add_node(root, cur, ino):
	cur.p = find_pos(ino, cur.v)
	st = []
	st.append(root)
	while len(st) != 0:
		node = st.pop()
		if node.p == -1:
			node.p = find_pos(ino, node.v)
		if cur.p < node.p:
			if node.l == None:
				node.l = cur
				return
			else:
				st.append(node.l)
		else:
			if node.r == None:
				node.r = cur
				return
			else:
				st.append(node.r)		

def post_order(root):
	st = []
	cur = root
	last = None
	ret = ''
	while cur != None or len(st) != 0:
		if cur != None:
			st.append(cur)
			cur = cur.l
		else:
			peek = st[len(st)-1]
			if peek.r != None and peek.r != last:
				cur = peek.r
			else:
				if len(ret) != 0:
					ret += ' '
				ret += str(peek)
				last = st.pop()
	return ret

n = int(input())
preo = list(map(int, input().split()))
ino = list(map(int, input().split()))
root = Node(preo[0])
for i in range(1, n):
	add_node(root, Node(preo[i]), ino)
print(post_order(root))


Measured memory_bytes: 5608
N,X,M = map(int,input().split())

List = [X]

for i in range(N-1):
    X = X**2 % M
    if X in List:
        #配列の何番目か
        num = i + 1
        #同じ数字
        key = List.index(X)
        break
    List.append(X)

ans = sum(List)
if len(List) == N:
    print(ans)

else:
    loop = (N - len(List)) // (num - key)
    add = (N - len(List)) % (num - key)

    ans += (N - len(List)) // (num - key) * sum(List[key:num])
    ans += sum(List[key:key+((N - len(List)) % (num - key))])

    print(ans)


Measured memory_bytes: 68608
#include <stdlib.h>
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
using ll=long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
inline constexpr ll gcd(ll a,ll b){if(!a||!b)return 0;while(b){ll c=b;b=a%b;a=c;}return a;}
inline constexpr ll lcm(ll a,ll b){if(!a||!b)return 0;return a*b/gcd(a,b);}
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
const long long INF=1LL << 60;
long long a,b;
long long dp[100200][110];
long long w[110],v[110];


int main(){
    long long a,b;
    cin>>a>>b;
    vector<long long> dp(a+1,INF);
    dp[0]=0;
    rep(i,b){
        long long k,l;
        cin>>k>>l;
        rep(j,a){
            long long dm=min(j+k,a);//ダメージがHPを超えていたらダメージ足りてる判定
            dp[dm]=min(dp[dm],dp[j]+l);//今までの方法での最小コストとこの魔法を打ったことによるコストの比較
        }
    } 
    cout<<dp[a]<<endl;
   
    
}



Measured memory_bytes: 384
N,M,X = list(map(int,input().split()))
A = [list(map(int,input().split())) for _ in range(N)]
money = [A[i][0] for i in range(N)]
A = [A[i][1:] for i in range(N)]
test = [[A[i][j] for i in range(N)] for j in range(M)]
test = list(map(sum,test))
ans = 0
if min(test) < X:
    ans = -1

if ans == 0:
    from itertools import product
    for cond in product([True,False], repeat=N):
        tmparr = [0] * M
        cost = 0
        for i,j in enumerate(cond):
            if j:
                tmparr = [tmparr[k] + A[i][k] for k in range(M)]
                cost += money[i]
        if min(tmparr) >= X:
            if ans == 0:
                ans = cost
            else:
                ans = min(ans,cost)

print(ans)

Measured memory_bytes: 9232
N = gets.to_i
H = gets.chomp.split.map(&:to_i)

cost = []

cost << 0
cost << (H[0] - H[1]).abs

2.upto(N - 1) do |i|
  c1 = cost[i - 2] + (H[i - 2] - H[i]).abs
  c2 = cost[i - 1] + (H[i - 1] - H[i]).abs
  cost << [c1, c2].min
end

print cost[-1]


Measured memory_bytes: 11908
#[allow(unused_imports)]
use std::io::{stdin, Read, StdinLock};
#[allow(unused_imports)]
use std::cmp::{max, min, Ordering};
#[allow(unused_imports)]
use std::str::FromStr;
#[allow(unused_imports)]
use std::collections::{HashSet, HashMap, BinaryHeap, VecDeque};
#[allow(unused_imports)]
use std::vec::Vec;

#[allow(dead_code)]
const INF: i32 = 1000_000_000;
#[allow(dead_code)]
const INFLL: i64 = 1000_000_000_000_000_000;
#[allow(dead_code)]
const EPS: f64 = 1.0e-10;
#[allow(dead_code)]
const MOD: i32 = 1000_000_007;
#[allow(dead_code)]
const MODLL: i64 = 1000_000_007;

struct Scanner<'a> {
    cin: StdinLock<'a>,
}

#[allow(dead_code)]
impl<'a> Scanner<'a> {
    fn new(cin: StdinLock<'a>) -> Scanner<'a> {
        Scanner {cin: cin}
    }
    fn read1<T: FromStr>(&mut self) -> Option<T> {
        let token = self.cin.by_ref().bytes().map(|c| c.unwrap() as char)
                    .skip_while(|c| c.is_whitespace())
                    .take_while(|c| !c.is_whitespace())
                    .collect::<String>();
        token.parse::<T>().ok()
    }
    fn read<T: FromStr>(&mut self) -> T {
        self.read1().unwrap()
    }
}


fn main() {
    let cin = stdin();
    let cin = cin.lock();
    let mut sc = Scanner::new(cin);

    let (n, m, k): (usize, usize, i64) = (sc.read(), sc.read(), sc.read());
    let mut a: Vec<_> = vec![0; n];
    for i in 0..n {
        a[i] = sc.read();
    }
    let a = a;

    let mut dp: Vec<i64> = vec![INFLL; n + 1];
    dp[0] = 0;
    for i in 0..n {
        let (mut mi, mut ma) = (INFLL, -INFLL);
        for j in 0..m {
            if i < j {
                break;
            }
            mi = min(mi, a[i - j]);
            ma = max(ma, a[i - j]);
            dp[i + 1] = min(dp[i + 1], dp[i - j] + (ma - mi) * (j as i64 + 1) + k);
        }
    }
    println!("{}", dp[n]);
}


Measured memory_bytes: 5048
//i ll be the king
#include<bits/stdc++.h>
#define ll long long int
#define sync ios_base::sync_with_stdio(false); cin.tie(NULL) 
#define input(arr,n) for(ll i1=0;i1<n;i1++ )cin>>arr[i1]
#define rep(n) for(ll i2=0;i2<n;i2++)
#define vmp(v,a,b) v.push_back(make_pair(a,b))
#define si(a) scanf("%lld",&a)
#define pi(a) printf("%lld",a)
#define aset(a,n,k) for(ll i3=0;i3<n;i3++)a[i3]=k; 	
#define mod 1000000007
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
using namespace std;
int main()
{
	sync;
	ll n;
	cin>>n;
	double p[n+1];
	for(ll i=1;i<=n;i++)cin>>p[i];
	double dp[n+1][n+1];
	for(ll i=0;i<=n;i++)
	for(ll j=0;j<=n;j++)
	{
		if(i==0&&j==0)
		dp[i][j]=0;
		else if(i==1&&j==0)
		dp[i][j]=(1-p[i]);
		else if(j==0)
		dp[i][j]=dp[i-1][j]*(1-p[i]);
		else
		dp[i][j]=0;
	}
	dp[1][1]=p[1];
	for(ll i=2;i<=n;i++)
	{
		for(ll j=1;j<=i;j++)
		dp[i][j]=dp[i-1][j]*(1-p[i])+dp[i-1][j-1]*p[i];
	}
	double ans=0;
	for(ll i=(n+1)/2;i<=n;i++)
	ans+=dp[n][i];
	cout<<fixed<<setprecision(12)<<ans<<endl;
}

Measured memory_bytes: 70656
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repo(i,n) for(int i = 1; i < (int)(n); i++)
#define pb push_back
#define mp make_pair
#define np next_permutation
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
//#define num 1000000007
#define pi acos(-1.0)
//cout << fixed << setprecision (20);   小数点以下2０桁まで
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//'0'+=16;        で大文字に
//'大文字'+=32;    で小文字に
//s[i]-'0'でchar文字→int数に;
//string s = to_string(int数);
//int n = stoi(string文字列)
//実行時間制約2秒では２×10^8回くらいまで計算できる



int main() {
  string a,b;
  cin >> a>>b;
  int p=a.size();
  int q=b.size();
  
  if(a==b) {
    puts("EQUAL");
    return 0;
  }
  else if (p>q) {
    puts("GREATER");
    return 0;
  }
  else if (p<q) {
    puts("LESS");
    return 0;
  }
  else {
    rep(i,p) {
      if(a[i]>b[i]) {
        puts("GREATER");
        return 0;
      }
      if(a[i]<b[i]) {
        puts("LESS");
        return 0;
      }
    }
  }
  
}


Measured memory_bytes: 256
#include<stdio.h>

#define N 1000000

int a[N], G[N], count = 0, m = 1;

void insertionSort(int n, int g){
  int i, j, v;
  for(i = g ; i < n ; i++){
    v = a[i];
    j = i - g;

    while(j >= 0 && a[j] > v){
      a[j + g] = a[j];
      j = j - g;
      count++;
    }
    a[j + g] = v;
  }
}


void shellSort(int n){
  int i, h = n;
  G[0] = 1;

  while(1){
    G[m] = G[m - 1]*3 + 1;
    if(G[m] > n) break;
    m++;
  }

  for(i = m - 1 ; i >= 0 ; i--){
    insertionSort(n, G[i]);
  }
}


int main(){
  int i, n;

  scanf("%d", &n);
  for(i = 0 ; i < n ; i++) scanf("%d", &a[i]);

  shellSort(n);

  printf("%d\n", m);
  for(i = m - 1 ; i > 0 ; i--) printf("%d ", G[i]);

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

  printf("%d\n", count);

  for(i = 0 ; i < n ; i++) printf("%d\n", a[i]);

  return 0;
}


Measured memory_bytes: 5640
import sys
input = sys.stdin.readline

INF = 10**17

N, M = map(int, input().split())
Edges = [list(map(int, input().split())) for _ in range(M)]


def bfs(graph, start):
    checked = [False]*N
    checked[start] = True
    q = [start]
    while q:
        qq = []
        for p in q:
            for np in graph[p]:
                if not checked[np]:
                    qq.append(np)
                    checked[np] = True
        q = qq
    return checked

graph1 = [[] for _ in range(N)]
graph2 = [[] for _ in range(N)]
for a, b, e in Edges:
    graph1[a-1].append(b-1)
    graph2[b-1].append(a-1)

checked1 = bfs(graph1, 0)
checked2 = bfs(graph2, N-1)

n_Edges = []
for a, b, e in Edges:
    if checked1[a-1] and checked2[b-1]:
        n_Edges.append((a, b, e))

D = [INF]*N
D[0] = 0
ok = True
for i in range(N):
    update = False
    for a, b, c in n_Edges:
        if D[a-1] != INF and D[b-1] > D[a-1] - c:
            D[b-1] = D[a-1] - c
            update = True
    if i==N-1 and update:
        ok = False

if not ok:
    print('inf')
else:
    print(-D[N-1])

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

int N, S;
int constexpr maxn = 102;
int constexpr maxs = 100003;
int v[maxn], w[maxn];
int memo[maxn][maxs];

void read_input()
{
    cin >> N >> S;
    for(int i = 1; i <= N; i++) {
        cin >> w[i] >> v[i];
    }
}

int dp(int n, int s) {
    if(s < 0) return -1000000000000LL;
    if(n == 0) return 0;
    if(memo[n][s] != -1) return memo[n][s];

    memo[n][s] = max(dp(n-1, s - w[n]) + v[n], dp(n-1, s));
    return memo[n][s];
}

decltype(0) main()
{
    ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    read_input();
    for(int i = 0; i < maxn; i++) for(int j = 0; j < maxs; j++) memo[i][j] = -1;

    cout << dp(N, S) << endl;
}


Measured memory_bytes: 80000
#include <bits/stdc++.h>
using namespace std;
using ll  = int64_t;
using P   = pair<ll, ll>;
using mat = vector<vector<ll>>;

void IOS() { ios::sync_with_stdio(false), cin.tie(0); }

template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
    fill((T *)array, (T *)(array + N), val);
}

const ll INF = 1e16;
const ll MOD = 1e9 + 7;
// int dx[4] = {1,0,-1,0};
// int dy[4] = {0,1,0,-1};
// ll pas[5001][5002];

signed main() {
    IOS();
    ll h, w, n;
    cin >> n >> w >> h;
    ll ans = (n - h + 1) * (n - w + 1);
    cout << ans << endl;

    // string s[102];

    return 0;
}

Measured memory_bytes: 256
use std::io::{self, Read, Write};

#[rustfmt::skip] #[macro_use] #[allow(unused_macros)]
mod rwc {
    macro_rules! rd { ($buf:ident, $t:ty)       => { $buf.next().unwrap().parse::<$t>().ok().unwrap() }; }
    macro_rules! wt { ($out:ident, $($arg:tt)*) => { write!($out, $($arg)*).ok()                      }; }
    macro_rules! cv { ($n:expr, $fn:expr)       => { (0..$n).map($fn).collect::<Vec<_>>()             }; }
}

fn main() {
    let (mut _buf, mut _out) = (String::new(), io::stdout());
    let (mut _buf, mut _out) = {
        io::stdin().read_to_string(&mut _buf).ok();
        (_buf.split_whitespace(), io::BufWriter::new(_out.lock()))
    };

    let k = rd!(_buf, u32);

    let mut sum = 0;
    for a in 1..=k {
        for b in 1..=k {
            for c in 1..=k {
                sum += gcd(gcd(a, b), c);
            }
        }
    }
    wt!(_out, "{}\n", sum);
}

fn gcd(a: u32, b: u32) -> u32 {
    if b == 0 {
        a
    } else {
        gcd(b, a % b)
    }
}


Measured memory_bytes: 2144
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <stack> // s.top()
#include <bitset>
#include <queue> // s.front()
using namespace std;

typedef long long Int;
typedef pair<Int,Int> P;
#define print(x) cout<<(x)<<endl

#define INF10 10000000000
#define INF5 100000
#define EPS 1e-10
#define MOD 1000000007
 
char c[] = "CODEFESTIVAL2016";

int main() {
	string s;
	cin >> s;
	int ans = 0;
	for (int i = 0; i < 16; i++) {
		if (s[i] != c[i])ans++;
	}
	print(ans);




	return 0;
}

Measured memory_bytes: 256
from itertools import combinations
n = int(input())
b = list(map(int,input().split()))
r = b[0]
b = b[1:]
print("0:")
ans = []
for i in range(1,r+1):
    for j in combinations(b,i):
        comb = list(j)
        comb.reverse()
        s = 0
        for h in comb:
            s += 2**h
        ans.append([s,list(j)])

ans.sort()

for i,j in ans:
    print(str(i)+":",*j)



Measured memory_bytes: 85040
#include <bits/stdc++.h>
#define dcout cout << fixed << setprecision(15)
#define rep(i, a) for(int i = 0; i < a; i++)
#define arep(i, x) for(auto i : x)
#define all(v) v.begin(), v.end()
#define int long long
#define F first
#define S second
#define VE vector<int>
#define pb(x) push_back(x)
using namespace std;
signed main() {
    int n;
    int ans = 0;
    cin >> n;
    ans += (n / 500) * 1000;
    n %= 500;
    // ans += (n / 100);
    // n %= 100;
    // ans += (n / 50);
    // n %= 50;
    // ans += (n / 10);
    // n %= 10;
    ans += (n / 5) * 5;
    // n %= 5;
    // ans += (n / 1);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <numeric>
#include <algorithm>
#include <vector>
#include <array>
#include <string>
#include <queue>
#include <cmath>
#include <iterator>
#include <math.h>
#include <cstdio>
#include <map>
#include <set>
#include <unordered_map>
#include <sstream>
#include <tuple>

using namespace std;
using lli = long long int;
using ulli = unsigned long long int;

namespace atcoder{
    void judge_outer(bool judge_exp,string ok = "Yes",string ng = "No"){
        if(judge_exp){
            cout << ok << endl;
        }else{
            cout << ng << endl;
        }
    }
}

using namespace atcoder;

int main(void){
    int n;
    cin >> n;
    vector<array<int,2>> X(n);
    for(int i=0;i<n;i++){
        X[i][0] = i;
        cin >> X[i][1];
    }
    sort(X.begin(),X.end(),[](array<int,2> left,array<int,2> right){
        return left[1] < right[1];
    });
    if(n==2){
        cout << X[1][1] << endl;
        cout << X[0][1] << endl;
        return 0;
    }
    
    int center = X[(n-1)/2][1];
    int big = X[(n-2)/2][1];
    int small = X[(n)/2][1];
    cerr << (n-1)/2 << " " << big << " " << small << endl;
    vector<int> xxx(n);
        for(int i=0;i<n;i++){
                if(X[i][1] <= center){
                    xxx[X[i][0]] = small;
                    cerr << "small"  << i<< endl;
                }else{
                    xxx[X[i][0]] = big;
                    cerr << "big"  << i<< endl;
                }
                
            
        }
        for(int i=0;i<n;i++){
            cout << xxx[i] << endl;
        }
    
    return 0;
}


Measured memory_bytes: 4480
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		out=new PrintWriter (new BufferedOutputStream(System.out));
		FastReader s=new FastReader();
		String first=s.next();
		String second=s.next();
		int[][] dp=new int[first.length()+1][second.length()+1];
		for(int i=1;i<=first.length();i++) {
			for(int j=1;j<=second.length();j++) {
				if(first.charAt(i-1)==second.charAt(j-1)) {
					dp[i][j]=1+dp[i-1][j-1];
				}else {
					dp[i][j]=Integer.max(dp[i-1][j],dp[i][j-1]);
				}
			}
		}
		StringBuilder ans=new StringBuilder();
		for(int i=first.length(),j=second.length();i>=1 && j>=1 ;i--,j--) {
			if(dp[i][j]==dp[i-1][j]) {
				j++;
			}else if(dp[i][j]==dp[i][j-1]) {
				i++;
			}else if(dp[i][j]==1+dp[i-1][j-1]) {
				ans.append(first.charAt(i-1));
			}
		}
		out.println(reverse(ans.toString()));
		out.close();
	}	

	public static String reverse(String str) {
		StringBuilder ans=new StringBuilder();
		for(int i=str.length()-1;i>=0;i--) {
			ans.append(str.charAt(i));
		}
		return ans.toString();
	}
	
	public static PrintWriter out;
	
	public static class FastReader {
		BufferedReader br;
		StringTokenizer st;
		//it reads the data about the specified point and divide the data about it ,it is quite fast
		//than using direct 

		public FastReader() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String next() {
			while (st == null || !st.hasMoreTokens()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());//converts string to integer
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (Exception e) {
				e.printStackTrace();
			}
			return str;
		}
	}
	
}


Measured memory_bytes: 84436
n=int(input())
da=[True for i in range(55555)]
da[0]=False
for i in range(240):
    no=(i+2)*2
    while(55555>no):
        da[no-1]=False
        no+=(i+2)
li=[[] for i in range(4)]
for i in range(55555):
    if(da[i]):
        li[(i+1)%5-1].append(i+1)

for i in range(4):
    if(len(li[i])>=n):
        for j in range(n-1):
            print(li[i][j],end=' ')
        print(li[i][n-1])
        break

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

int main(){
	int n;
	cin>>n;
	vector<vector<int>> d(n,vector<int>(3));
	for(int i=0; i<n; i++){
		for(int j=0; j<3; j++){
			cin>>d[i][j];
		}
	}
	vector<int> p(n,0);
	for(int j=0; j<3; j++){
		vector<vector<int>> h(101,vector<int>());
		for(int i=0; i<n; i++){
			p[i] += d[i][j];
			h[d[i][j]].push_back(i);
		}
		for(int i=1; i<101; i++){
			if(h[i].size() > 1){
				for(int x : h[i]){
					p[x] -= i;
				}
			}
		}
	}
	for(int x : p){
		cout<<x<<endl;
	}
}

Measured memory_bytes: 3148
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf = 1e9 + 7;

int main() {
	int a;
	rep(i, 5){
		cin >> a;
		if (a == 0)cout << i + 1 << endl;
	
	}
	return 0;
}

Measured memory_bytes: 3568
#include <bits/stdc++.h>
using namespace std ;
typedef long long ll ;
const double esp = 1e-10 ;
int main()
{
  long double a , b , c ;
  cin >> a >> b >> c;
  c -= a + b + 2 * sqrt(a * b) ;
  if(c > esp) puts("Yes") ;
  else puts("No") ;
  return 0 ;
}


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

int points[505][505];
int csum[505][505];

int main()
{
    int n, m, q;
    cin >> n >> m >> q;
    rep(i, m)
    {
        int l, r;
        cin >> l >> r;
        l--, r--;
        points[l][r]++;
    }
    rep(i, 500)
    {
        rep(j, 500)
        {
            csum[i + 1][j + 1] = points[i][j] - csum[i][j];
            csum[i + 1][j + 1] += csum[i][j + 1];
            csum[i + 1][j + 1] += csum[i + 1][j];
            // cout << csum[i + 1][j + 1]  << ' ';
        }
        // cout << endl;
    }
    rep(i, q)
    {
        int l, r;
        cin >> l >> r;
        l--, r--;
        int ans = csum[r + 1][r + 1] + csum[l][l] - csum[r + 1][l] - csum[l][r + 1];
        cout << ans << endl; 
    }
    return 0;
}

Measured memory_bytes: 2944
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
#define MAX_N (1<<19)
#define INF 100000000
#define MOD 1000000007
#define MO2 1000000009
#define BAS 1009
#define BA2 1007
#define EPS 1e-10
using namespace std;
typedef long long ll;
typedef pair<long double,int> P;

string s;
string t;
vector<ll> ns, nt;
vector<ll> vec;

ll mod_pow(ll x, ll y, ll M){
    ll ret = 1;
    while(y){
        if(y&1) ret = ret*x%M;
        x = x*x%M;
        y /= 2;
    }
    return ret;
}

bool check(ll x){
    ll s = 0, e = vec.size(), mid;
    while(e-s > 1){
        mid = (e+s)/2;
        if(vec[mid] <= x) s = mid;
        else e = mid;
    }
    return vec[s] == x;
}

int main(){
    cin >> s >> t;
    rep(i,s.size()){
        if('a' <= s[i] && s[i] <= 'z') ns.push_back(s[i]-'a');
        else ns.push_back(s[i]-'A'+26);
    }
    rep(i,t.size()){
        if('a' <= t[i] && t[i] <= 'z') nt.push_back(t[i]-'a');
        else nt.push_back(t[i]-'A'+26);
    }
    ll ori = 0, or2 = 0;
    rep(i,t.size()){
        ori = (ori+nt[i]*mod_pow(BAS,i,MOD))%MOD;
        or2 = (or2+nt[i]*mod_pow(BA2,i,MO2))%MO2;
    }
    rep(i,t.size()){
        ll z1 = mod_pow(BAS,i,MOD), z2 = mod_pow(BA2,i,MO2);
        for(ll j = 0; j < nt[i]; j++){
            ll x = (ori-z1*(j+1)+(j+1)*MOD)%MOD;
            ll y = (or2-z2*(j+1)+(j+1)*MO2)%MO2;
            vec.push_back(x*y);
        }
        for(ll j = nt[i]+1; j < 52; j++){
            ll x = (ori+z1*(j-nt[i])+j*MOD)%MOD;
            ll y = (or2+z2*(j-nt[i])+j*MO2)%MO2;
            vec.push_back(x*y);
        }
    }
    sort(vec.begin(),vec.end());
    ll now = 0;
    ll no2 = 0;
    ll ans = 0;
    rep(i,t.size()){
        now = (now+ns[i]*mod_pow(BAS,i,MOD))%MOD;
        no2 = (no2+ns[i]*mod_pow(BA2,i,MO2))%MO2;
    }
    ans += check(now*no2);
    for(int i = t.size(); i < s.size(); i++){
        now = (now-ns[i-t.size()]+MOD)%MOD;
        no2 = (no2-ns[i-t.size()]+MO2)%MO2;
        now = now*mod_pow(BAS,MOD-2,MOD)%MOD;
        no2 = no2*mod_pow(BA2,MO2-2,MO2)%MO2;
        now = (now+ns[i]*mod_pow(BAS,t.size()-1,MOD))%MOD;
        no2 = (no2+ns[i]*mod_pow(BA2,t.size()-1,MO2))%MO2;
        ans += check(now*no2);
    }
    cout << ans << endl;
}

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

using namespace std;

typedef long long ll;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    string s;
    cin >> s;
    int n = s.size();
    int cnt = n / 2;
    int ans = 0;
    for (int i = n - 1; i >= n - cnt; i--) {
        if (s[i] == 'g') {
            ans++;
        }
    }
    for (int i = n - cnt - 1; i >= 0; i--) {
        if (s[i] == 'p') {
            ans--;
        }
    }
    cout << ans << '\n';
    return 0;
}

Measured memory_bytes: 512
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s= sc.nextLine();

		if(s.length()==3) {
			System.out.println(s.substring(2, 3)+s.substring(1, 2)+s.substring(0, 1));
		}else {
			System.out.println(s);
		}
	}

}


Measured memory_bytes: 22356
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
using namespace std;

int main() {
  int r, g, b, n;
  cin >> r >> g >> b >> n;

  int res = 0;
  for (int i = 0; r*i <= n; i++) {
    for (int j = 0; g*j <= n; j++) {
      int k = n - r * i - g * j;
      if (k >= 0 && k % b == 0) res++;
    }
  }
  cout << res << endl;
  return 0;
}

Measured memory_bytes: 3624
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;

long long int gcd(long long int a, long long int b) {
  return b ? gcd(b, a % b) : a;
}

int main() {
  long long int a, b;
  cin >> a >> b;
  
  long long int g = gcd(a, b);
  if (g == 1) {
    cout << "1" << endl;
    return 0;
  }
  
  int count = 1;
  for (long long int i = 2; i * i <= g; i++) {
    if (g % i == 0) {
      count++;
      while (g % i == 0)
        g /= i;
    }
  }
  if (g != 1)
    count++;

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

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import sys
import math
import os
import itertools
import string
import heapq
import _collections
from collections import Counter
from collections import defaultdict
from functools import lru_cache
import bisect
import re
import queue


class Scanner():
    @staticmethod
    def int():
        return int(sys.stdin.readline().rstrip())

    @staticmethod
    def string():
        return sys.stdin.readline().rstrip()

    @staticmethod
    def map_int():
        return [int(x) for x in Scanner.string().split()]

    @staticmethod
    def string_list(n):
        return [input() for i in range(n)]

    @staticmethod
    def int_list_list(n):
        return [Scanner.map_int() for i in range(n)]

    @staticmethod
    def int_cols_list(n):
        return [int(input()) for i in range(n)]


class Math():
    @staticmethod
    def gcd(a, b):
        if b == 0:
            return a
        return Math.gcd(b, a % b)

    @staticmethod
    def lcm(a, b):
        return (a * b) // Math.gcd(a, b)

    @staticmethod
    def roundUp(a, b):
        return -(-a // b)

    @staticmethod
    def toUpperMultiple(a, x):
        return Math.roundUp(a, x) * x

    @staticmethod
    def toLowerMultiple(a, x):
        return (a // x) * x

    @staticmethod
    def nearPow2(n):
        if n <= 0:
            return 0
        if n & (n - 1) == 0:
            return n
        ret = 1
        while(n > 0):
            ret <<= 1
            n >>= 1
        return ret

    @staticmethod
    def sign(n):
        if n == 0:
            return 0
        if n < 0:
            return -1
        return 1

    @staticmethod
    def isPrime(n):
        if n < 2:
            return False
        if n == 2:
            return True
        if n % 2 == 0:
            return False
        d = int(n ** 0.5) + 1
        for i in range(3, d + 1, 2):
            if n % i == 0:
                return False
        return True


class PriorityQueue:
    def __init__(self, l=[]):
        self.__q = l
        heapq.heapify(self.__q)
        return

    def push(self, n):
        heapq.heappush(self.__q, n)
        return

    def pop(self):
        return heapq.heappop(self.__q)


sys.setrecursionlimit(1000000)
MOD = int(1e09) + 7
INF = int(1e15)


def bfs(s, g, N, G):

    return 0


def main():
    # sys.stdin = open("Sample.txt")
    N = Scanner.int()
    G = [[] for _ in range(N)]
    for i in range(N - 1):
        a, b, c = Scanner.map_int()
        a -= 1
        b -= 1
        G[a].append((b, c))
        G[b].append((a, c))
    Q, K = Scanner.map_int()
    K -= 1
    length = [0] * N
    q = []
    q.append(K)
    while q != []:
        i = q.pop()
        for n in G[i]:
            if length[n[0]] != 0:
                continue
            length[n[0]] = length[i] + n[1]
            q.append(n[0])
    query = Scanner.int_list_list(Q)
    for q in query:
        print(length[q[0] - 1] + length[q[1] - 1])
    return


if __name__ == "__main__":
    main()


Measured memory_bytes: 87196
#include<stdio.h>

int main() {
    int W,H,x,y,r;
    scanf("%d %d %d %d %d",&W,&H,&x,&y,&r);
    
    if (x-r >= 0 && x+r <= W && y-r >= 0 && y+r <= H) {
        printf("Yes\n");
    }  else {
        printf("No\n");
    }
}


Measured memory_bytes: 2684
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <cstring>
#include <string>
#include <sstream>
#include <algorithm>
#include <iomanip>
using namespace std;

const int INF = 1e9;
typedef long long ll;

int main(void){
  int n;
  while(cin >> n && n != 0){
    int data[7] = {0, 0, 0, 0, 0, 0, 0}, o;
    for(int i = 0; i < n; i++){
      cin >> o;
      if(o < 60)data[o / 10]++;
      else data[6]++;
    }
    for(int i = 0; i < 7; i++){
      cout << data[i] << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 1160
N = int(input())
T = list(map(int, input().split()))
M = int(input())
P = [0] * M
X = [0] * M
for i in range(M):
    P[i], X[i] = map(int, input().split())

T_original = tuple(T)
for j in range(M):
    T[P[j]-1] = X[j]
    print(sum(T))
    T = list(T_original)

Measured memory_bytes: 3064
#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()
typedef long long ll;
typedef pair<int, int> P;
const int INF = 100000000;

int main()
{
   int w,h,n;
   cin >> w >> h >>n;
   int x1,y1,x2,y2;
   x1=y1=0;
   x2=w;
   y2=h;
   rep(i,n)
   {
      int x,y,a;
      cin >> x >> y >> a;
      //if(x<=x1||x>=x2||y<=y1||y>=y2)continue;

      if(a==1){if(x1<x)x1=x;}
      else if(a==2){if(x2>x)x2=x;}
      else if(a==3){if(y1<y)y1=y;}
      else{if(y2>y)y2=y;}
      //cout<<x1<<';'<<y1<<';'<<x2<<';'<<y2<<endl;
   }
   if(x1>=x2||y1>=y2)
   {
   cout<<0<<endl;
   }
   else
   {
      cout<<(x2-x1)*(y2-y1)<<endl;
   }
   

   return 0;
}

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

numCount = [0 for _ in range(10**5 + 1)]

for a in A:
    numCount[a] += 1

ans = 0
for i in range(10**5 + 1):
    if ans < sum(numCount[i: i + 3]):
        ans = sum(numCount[i: i + 3])

print(ans)

Measured memory_bytes: 13964
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC_Training
{



    public class Program
    {
        static void Main(string[] args)
        {
            var c = Char.Parse(Console.ReadLine());
            c++;
            Console.WriteLine(c);
        }
    }
}


Measured memory_bytes: 13140
#pragma once
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
using P = pair<ll, ll>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
#define ALL(obj) (obj).begin(), (obj).end()
#define MOD 1000000007
#define INF 1000000000

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

	ll N,L;
	ll ans;

	cin >> N >> L;

	vector<ll> t(N);
	vector<ll> ta(N);
	rep(i, N) {
		t[i] = L + i;
	}

	ll min = INF;
	ll min_num = -1;
	ll tmp;
	rep(i, N) {
		tmp = abs(t[i]);
		if (tmp < min) {
			min = tmp;
			min_num = i;
		}
	}
	ans = 0;
	rep(i, N) {
		ans += t[i];
	}
	ans -= t[min_num];

	cout << ans << endl;
	return 0;
}

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

using ll = long long;

using namespace std;

int main() {
    string s;
    cin >> s;
    cout << (s[2] == s[3] && s[4] == s[5] ? "Yes" : "No") << '\n';
    return 0;
}

Measured memory_bytes: 256
from sys import stdin
import sys

n = int(stdin.readline().rstrip())

s = ""
alp = "abcdefghijklmnopqrstuvwxyz"
b = n
while True:
    a = b % 26
    b = (b-1) // 26

    if a != 0:
        s = alp[a-1] + s
    else:
        s = "z" + s

    if b == 0: break

print(s)

Measured memory_bytes: 9180
#include <iostream>
#define int long long
using namespace std;

typedef long long ll;

ll mod=1e9+7;

ll fac[300010];
 
ll modinv(ll a){
    ll b=mod,u=1,v=0;
    while(b){
        ll t=a/b;
        a-=t*b; swap(a,b);
        u-=t*v; swap(u,v);
        }
        u%=mod;
        if(u<0) u+=mod;
    return u;
}
 
void modfac(){
    fac[0]=1;
    for(ll i=1;i<300010;i++){
        fac[i]=(fac[i-1]*i)%mod;
    }
}
 
ll modperm(ll n,ll k){
    if(n<0||k<0||n<k) return 0;
    else return (fac[n]*modinv(fac[n-k]))%mod;
}
 
ll modcomb(ll n,ll k){
    if(n<0||k<0||n<k) return 0;
    else return ((fac[n]*modinv(fac[k]))%mod*modinv(fac[n-k]))%mod;
}

ll dp[200010];

signed main(){
  ll n,m,k;
  cin >> n >> m >> k;
  //2個の時を求めればOK
  ll t=(n*m)%mod;
  modfac();
  ll p=((k*(k-1))%mod*fac[t-2])%mod;
  p=((p*modinv(fac[k]))%mod*modinv(fac[t-k]))%mod;
  ll len=0;
  for(int i=0;i<n;i++){
    len+=i*(i+1)/2;
    len%=mod;
  }
  dp[1]=len;
  for(int i=2;i<=m;i++){
    dp[i]=(dp[i-1]+len)%mod;
    dp[i]+=((len*2)%mod*(i-1))%mod;
    dp[i]%=mod;
    dp[i]+=((n*n)%mod*((i*(i-1)/2)%mod))%mod;
    dp[i]%=mod;
  }
  cout << (dp[m]*p)%mod << endl;
}

Measured memory_bytes: 4096
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define ll long long
#define endl '\n'
using namespace std;
const int N = 1e5 + 5;

int n, m, a[N], label[N], label2[N];
ll k;
ll x[N], d[N], ans[N];

vector <vector <int> > cycles;
bool vis[N];
void DFS(int v)
{
    cycles.back().pb(v);
    vis[v] = true;
    if(vis[label[v]])
        return;
    DFS(label[v]);
}

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

    cin >> n;
    for(int i = 1; i <= n; i++)
    {
        cin >> x[i];
        d[i] = x[i] - x[i - 1];
        label[i] = i;
    }

    cin >> m >> k;
    for(int i = 1; i <= m; i++)
    {
        cin >> a[i];
        swap(label[a[i]], label[a[i] + 1]);
    }
    for(int i = 1; i <= n; i++)
    {
        if(!vis[i])
        {
            cycles.pb(vector <int> ());
            DFS(i);
        }
    }

    for(int i = 0; i < cycles.size(); i++)
    {
        int sz = k % (int)cycles[i].size();
        for(int j = 0; j < cycles[i].size(); j++)
            ans[cycles[i][j]] = d[cycles[i][(j + sz) % cycles[i].size()]];
    }

//    for(int i = 1; i <= n; i++)
//        ans[label2[i]] = d[i];

    for(int i = 1; i <= n; i++)
        ans[i] = ans[i] + ans[i - 1];

    for(int i = 1; i <= n; i++)
        cout << fixed << setprecision(9) << ans[i] << endl;

    return 0;
}


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

#define ASC(vec) vec.begin(), vec.end()		// 昇順ソート 例：sort(ASC(vec));
#define DESC(vec) vec.rbegin(), vec.rend()	// 降順ソート 例:sort(DESC(vec));
#define rep(i, n) for(int i = 0; i < n; i++)
#define Rep(i, n) for(int i = 1; i < n; i++)
#define In(vec) rep(i, n) cin>>vec[i];
#define ANS(s) cout << s << endl
#define inc(a, b) cin >> a >> b;

const int mod = 1000000007;
const int inf = (int)1e9 + 7;
const long long INF = 1LL << 60;

using ii = pair<int, int>;
using ll = long long;
using vi = vector<int>;
using vd = vector<double>;
using vb = vector<bool>;
using vl = vector<ll>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;
using vii = vector<pair<int, int>>;

template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }
ll LCM(ll a, ll b) { return (a * b) / GCD(a, b); }
int round_int(int a, int b) { return (a + (b - 1)) / b; }


// 4,8方向に探索する際に用いる配列
int dx[4] = { 0,  0, 1, -1 };
int dy[4] = { 1, -1, 0,  0 };
//int dx[8] = { 1, 0, -1,  0, 1, -1, -1,  1 };
//int dy[8] = { 0, 1,  0, -1, 1,  1, -1, -1 };

constexpr auto MAX = 100010;

// ────────────────────────────────────────────────────

int main() {
	int a, b; cin >> a >> b;
	if (24 <= a + b) {
		cout << a + b - 24 << endl;
	}
	else cout << a + b << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); ++i)
#define rep2(i,n) for(int i=1; i<=(n); ++i)
#define all(x) (x).begin(),(x).end()
#define Sort(x) sort((x).begin(),(x).end())
#define Sort2(x) sort((x).begin(),(x).end(), greater<int>())
#define pb push_back
using namespace std;
using ll = long long;
using P = pair<int,int>;
using Graph = vector<vector<int>>;

int main()
{
    int n,k; cin >> n >> k;
    int r,s,p; cin >> r >> s >> p;
    string t; cin >> t;
    ll ans=0;
    vector<bool> b(k,true); // trueならそのまま

    rep(i,k){
        for (int j = i; j < n; j=j+k) {
            //cout << i << " " << j << " ";
            if(j==i){
                if(t[j]=='r') ans+=p;
                if(t[j]=='s') ans+=r;
                if(t[j]=='p') ans+=s;
            }else{
                if(b[i]){
                    if(t[j]==t[j-k]) b[i]=false;
                    else{
                        if(t[j]=='r') ans+=p;
                        if(t[j]=='s') ans+=r;
                        if(t[j]=='p') ans+=s;   
                    }
                }else{
                    b[i]=true;
                    if(t[j]=='r') ans+=p;
                    if(t[j]=='s') ans+=r;
                    if(t[j]=='p') ans+=s;                        
                }
            }
            //cout << ans << endl;
        }
    }

    cout << ans << endl;    
}

/*
Ctrl+@ でコンソールを開け、以下で実行。
g++ d.cpp
./a.out

サンプルのダウンロードは oj d URL
テストは oj t
*/

Measured memory_bytes: 512
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pi;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<pi> vpi;
typedef vector<vi> vvi;
const int inf = 0x3f3f3f3f;
const ll linf = 123456789012345678;
const ll mod = 1000000007;
#define all(x) x.begin(), x.end()
#define debug(x) cerr << #x << " = " << x << endl
#define sz(x) ((int)(x).size())


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

    ll a, b;
    cin >> a >> b;
    cout << (a*b)/__gcd(a, b) << endl;
}

Measured memory_bytes: 256