akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;

#define rep2(x,from,to) for(int x=(from);(x)<(to);(x)++)
#define rep(x,to) rep2(x,0,to)

int calc(vector<vector<int> > v, int n, int m) {
	int cnt = 0;
	while(cnt <= m){
		int i = cnt % 2, j = i + 1;
		if(i % 2 == 0) {
			if(v[i].size() == n || v[i + 2].size() == n) {
				return cnt;
			}
		} else {
			if(v[j].size() == n || v[2 - j].size() == n) {
				return cnt;
			}
		}
		
		auto it1 = v[i].end();
		auto it2 = v[j].end();
		if(v[i].empty()) {
			int y = *--it2;
			v[j].erase(it2);
			v[i].push_back(y);
		} else if(v[j].empty()) {
			int x = *--it1;
			v[i].erase(it1);
			v[j].push_back(x);
		} else {
			int x = *--it1, y = *--it2;
			if(x > y) {
				v[i].erase(it1);	
				v[j].push_back(x);
			} else {
				v[j].erase(it2);
				v[i].push_back(y);
			}
		}
		cnt++;
	}
	return cnt;
}
int main() {
	int n, m;
	while(cin >> n >> m && (n || m)) {
		int c;
		vector<vector<int> >v(3);
		rep(i,3) {
			cin >> c; 
			rep(j,c) {
				int t;
				cin >> t;
				v[i].push_back(t);
			}
		}
		int ans1 = calc(v, n, m);
		swap(v[0], v[2]);
		int ans2 = calc(v, n, m);
		int ans = min(ans1, ans2);
		if(ans <= m) {
			cout << ans;
		} else {
			cout << -1;
		}
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 1212
//まともに使い方を理解していないくせにincludeしまくる人間のクズ
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <list>
#include <set>
#include <map>
#include <bitset>
#include <iostream>


//using namespace stdしないと表記がめんどくさいからね、仕方ないね
using namespace std;

//可読性を上げるためのdefineが仇となる典型的パターン
#define FOR(x) for(int i = 0; i < x; i++)

//ローカル変数とグローバル変数は使い分けよう！
stack<short> x, y;
short a[10], n, j, i, m, ans;

//関数って楽しいよね！（魔王スマイル）
void solve(short c, short sum, short cnt){
	if(cnt == n){
		if(sum == m) ans++;
		return;
	}
	if(cnt < n && c > 9) return;
	if(sum > m) return;
	solve(c + 1, sum + c, cnt + 1);
	solve(c + 1, sum, cnt);
	return;
}

int main(){
	while(true){
		scanf("%d %d", &n, &m);
		if(n == 0 && m == 0) return 0;
		ans = 0;
		solve(0, 0, 0);
		printf("%d\n", ans);
	}
}

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

const double PI = acos(-1);
using ll = long long;
using ull = unsigned long long;
const int inf = 2e9;
const ll INF = 2e18;
const ll MOD = 1e9+7;
typedef pair<int,int> P;

#define REP(i,n) for (int i = 0; i < (n); i++)
#define sz(s) (s).size()
#define pb push_back
#define fi first
#define se second

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

  int q;
  cin >> q;
  while (q--) {
    ll a,b;
    cin >> a >> b;
    if (a > b) swap(a,b);

    if (a == b) {
      cout << (a - 1) * 2 << endl;
    } else if (a + 1 == b) {
      cout << (a - 1) * 2 << endl;
    } else {
      ll k = sqrt(a*b);
      if (k * k == a * b) k--;
      cout << (k - 1) * 2 + (k * (k + 1) < a * b) << endl;
    }
  }

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
//define
#define int long long
#define UNIQUE(v) v.erase(unique(all(v)), v.end());
#define ZIP(v) sort(all(v)),UNIQUE(v)
#define ADD(a, b) a = (a + b) % mod
#define SUB(a, b) a = (a+mod-b)%mod
#define MUL(a, b) a = (a * b) % mod
#define repi(i,m,n) for(int i = m;i < n;i++)
#define drep(i,n,m) for(int i = n;i >= m;i--)
#define rep(i,n) repi(i,0,n)
#define rrep(i,n) repi(i,1,n+1)
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(), v.rend()
#define dmp(x,y) make_pair(x,y)
#define pb(x) push_back(x)
#define pf(x) push_front(x)
#define fi first
#define se second
// 許容する誤差ε
#define EPS (1e-10)
// 2つのスカラーが等しいかどうか
#define EQ(a,b) (abs((a)-(b)) < EPS)
// 2つのベクトルが等しいかどうか
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )
//template
template <typename T, typename U>
ostream &operator<<(ostream &os, const pair<T, U> &p){
  os << "(" << p.first << "," << p.second << ")";return os;
}
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v){
  for (auto it = v.begin();it != v.end();++it){
    if(it != v.begin())os << " ";os << *it;
      }return os;
}
template <typename T, typename U>
ostream &operator<<(ostream &os, const map<T, U> &mp){
  for(auto x: mp)os << "(" << x.first << "," << x.second << ")" << endl;
  return os;
}
template<typename T, int SIZE>
int array_length(const T (&)[SIZE]){return SIZE;}
template<typename T, int N>
void PRINTF(const T (&a)[N], int s = N, int t = -1, bool f = true){
	if(t == -1){rep(i,s){if(i)cout << " ";cout << a[i];}}
	else repi(i,s,t){if(i!=s)cout << " ";cout << a[i];}
	if(f)cout << "\n";
}
template<typename T, int N1, int N2>
void PRINTF(const T (&a)[N1][N2], int h = N1, int w = N2){
	rep(i,h){rep(j,w){cout << a[i][j] << " \n"[j==w-1];}}
}
//typedef
typedef complex<double> Point;
typedef pair<int,int> P;
typedef pair<int, P> PP;
typedef pair<P, int> Pi;
typedef vector<int> vi;
typedef deque<int> dq;
const int inf = 1e9+7;
const int INF = 1e18+7;



int dp[1000][1000];
signed main(){
  while(1){
    int n;
    scanf("%lld", &n);
    if(n == 0)break;
    string str[1000];
    rep(i,1000)rep(j,1000)dp[i][j] = 0;
    rep(i,n)cin >> str[i];
    int ans = 0;
    rep(i,n)rep(j,n){
      if(i == 0 or j == 0){
        dp[i][j] = (str[i][j] == '.');
        chmax(ans, dp[i][j]);
        continue;
      }
      dp[i][j] = min({dp[i-1][j], dp[i][j-1], dp[i-1][j-1]})+1;
      if(str[i][j] == '*')dp[i][j] = 0;
      chmax(ans, dp[i][j]);
    }
    printf("%lld\n", ans);
  }
	return 0;
}











Measured memory_bytes: 11900
n = int(input())
count = 0
for i in range(1, 6):
    # 10,1000,100000
    if i % 2 == 1:
        if n < 10 ** i:
            count += n - 10 ** (i-1) + 1
            print(count)
            exit()
        else:
            count += 10 ** i - (10**(i-1))

    else:
        if n < 10 ** i:
            print(count)
            exit()

print(count)


Measured memory_bytes: 2940
#include<string>
#include<string.h>
#include<map>
#include<set>
#include<vector>
#include<stdio.h>
#include<math.h>
#include<iostream>
#include<algorithm>
#include<queue>
#include<stdio.h>

using namespace std;

int dp[100005];

int main()
{
    int n;
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        int m=dp[i-1]+1;
        for(int k=6;k<=i;)
        {m=min(m,1+dp[i-k]);
        k*=6;}                       //求6的几次方 
        for(int k=9;k<=i;)
        {m=min(m,1+dp[i-k]);
        k*=9;}                       //求9的几次方 
        dp[i]=m;                      
    }
    cout<<dp[n];
   // system("pause");
    return 0;
}  
        

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

int main(){
  int n,i,j,sum1=0,sum2=0;
  cin >> n;
  for(i=1; i<=n; i++){
    if(i%2 == 1){
    	for(j=1;j<=i;j++){
          if(i%j==0)sum1++;
        }
        if(sum1 == 8)sum2++;
        sum1 = 0;
    }
  }
  cout << sum2 << endl;
}

Measured memory_bytes: 256
from math import gcd

from math import factorial as f

from math import ceil,floor,sqrt
import math

import bisect
import re
import heapq


from copy import deepcopy
import itertools
from itertools import permutations

from sys import exit

ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))


yes = "Yes"
no = "No"


def main():
    a,b = mi()
    print(a*b)



main()




Measured memory_bytes: 10024
# -*- coding: utf-8 -*-
# 入力
D = int(input())

c_i = list(map(int, input().split()))

s_d_i = []
for d in range(D):
  s_d_i.append(list(map(int, input().split())))
  
last_i = []
for i in range(26):
  last_i.append(-1)
  
# tが入力の場合（Mainでは不要） 
t_d = []
for d in range(D):
  t_d.append(int(input()))
  
  
#scoring
r_sum = 0
for d in range(D):
  t = t_d[d] - 1

  #last更新
  last_i[t] = d
  
  #c
  c_sum = 0
  for i in range(26):
    c_sum += c_i[i] * (d - last_i[i])
  
  #s - c
  r_d = s_d_i[d][t] - c_sum
  r_sum += r_d
  print(r_sum)

Measured memory_bytes: 9392
#include <bits/stdc++.h>
using namespace std;
 
#define REP(i, s) for (int i = 0; i < s; ++i)
#define ALL(v) (v).begin(), (v).end()
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define DEBUG
#define int long long
#define INF 1e18
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T> ostream& operator << (ostream &s, set<T> P)
{ EACH(it, P) { s << "<" << *it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }
template<class T>void show(vector<T>v){for (int i = 0; i < v.size(); i++){cerr<<v[i]<<" ";}cerr<<"\n";}
typedef long long ll;

int dp[200010][3];
signed main()
{
    int n;
    cin >> n;
    vector<int> a(n);
    int cnta = 0, cntb = 0;
    REP(i, n)
    {
        cin >> a[i];
    }
    if(n%2==0){
        dp[0][0] = a[0];
        dp[1][1] = a[1];
        for (int i = 2; i < n; i++)
        {
            if(i <= n-2) dp[i][0] = dp[i - 2][0] + a[i];
            if(i - 3 >= 0) dp[i][1] = dp[i - 2][1] + a[i];
            if (i - 3 >= 0)
            {
                chmax(dp[i][1], dp[i - 3][0] + a[i]);
            }
        }
        cout << max(dp[n - 2][0], dp[n - 1][1]) << endl;
    }
    else{
        dp[0][0] = a[0];
        dp[1][1] = a[1];
        dp[2][2] = a[2];

        for (int i = 2; i < n; i++)
        {
            if(i <= n-3 && i!=3 )
                dp[i][0] = dp[i - 2][0] + a[i];
            if (i  >= 3 && i <= n - 2 && i!=4)
                dp[i][1] = dp[i - 2][1] + a[i];
            if(i  >= 4  ){
                dp[i][2] = dp[i - 2][2] + a[i];
            }
            if (i - 3 >= 0 && i <= n - 2){
               if(i-3 != 1) chmax(dp[i][1], dp[i - 3][0]+a[i]);
            }
            if(i - 4 >= 0 ){
                if(i!=5)chmax(dp[i][2], dp[i - 3][1] + a[i]);
               if(i-4!=1) chmax(dp[i][2], dp[i - 4][0] + a[i]);
            }
          //  cerr <<i<<" "<< dp[i][0] << " " << dp[i][1] << " " << dp[i][2] << endl;
        }
        cout << max({dp[n - 3][0], dp[n - 2][1], dp[n - 1][2]}) << endl;
    }

    return 0;
}

Measured memory_bytes: 9592
#include <bits/stdc++.h>
using namespace std;
int main () {
  int n, v[20], c[20];
  cin>>n;
  for (int i=0;i<n;++i) cin>>v[i];
  for (int i=0;i<n;++i) cin>>c[i];
  int s=0;
  for (int i=0;i<n;++i) {
    if (v[i]>c[i]) s+=v[i]-c[i];
  }
  cout<<s;
  return 0;
}


Measured memory_bytes: 256
/*
2017年9月2日23:15:46 
B
简单输出 
*/ 
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <queue>
using namespace std;


const int maxn=1e5+10;
char s[maxn];
int main(){
	scanf("%s",s);
	int len=strlen(s);
	for(int i=0;i<len;i+=2){
		printf("%c",s[i]);
	} printf("\n");
	return 0;
}


Measured memory_bytes: 384
use std::io::*;
use std::str::FromStr;

#[allow(unused_macros)]
macro_rules! scan {
  ($e:expr; $t:ty) => {
    $e.get::<$t>()
  };
  ($e:expr; $($t:ty), *) => {
    ($($e.get::<$t>(),)*)
  };
  ($e:expr => $i:expr; $t:ty) => {
    (0..$i).map(|_| $e.get::<$t>()).collect::<Vec<$t>>()
  };
  ($e:expr => $row:expr, $col:expr; $t:ty) => {
    (0..$i).map(|_| scan!($e => $col; $t)).collect::<Vec<$t>>()
  }
}

struct Scanner<R: Read> {
  reader: R
}

#[allow(dead_code)]
impl<R: Read> Scanner<R> {
  fn new(reader: R) -> Scanner<R> {
    Scanner { reader: reader }
  }
  fn safe_get<T: FromStr>(&mut self) -> Option<T> {
    let token = self.reader.by_ref().bytes().map(|c| c.unwrap() as char)
      .skip_while(|c| c.is_whitespace())
      .take_while(|c| !c.is_whitespace())
      .collect::<String>();
    if token.is_empty() { None } else { token.parse().ok() }
  }
  fn get<T: FromStr>(&mut self) -> T {
    if let Some(v) = self.safe_get() { v } else {
      writeln!(stderr(), "Terminated with EOF").unwrap();
      std::process::exit(0);
    }
  }
}

trait Writable {
  fn write(&self, sep: &'static str) -> String;
}

impl<T: ToString> Writable for Vec<T> {
  fn write(&self, sep: &'static str) -> String {
    self.iter().map(|e| e.to_string()).collect::<Vec<String>>().join(sep)
  }
}

fn main() {
  let cin = stdin();
  let cin = cin.lock();
  let mut sc = Scanner::new(cin);
  let n = scan!(sc; i32);
  let v = scan!(sc => n; i32);
  let c = scan!(sc => n; i32);
  let d: i32 = v.iter().zip(c.iter()).map(|(&v, &c)| v - c).filter(|&d| d > 0).sum();
  println!("{}", d);
}


Measured memory_bytes: 4352
#from statistics import mean, median,variance,stdev
a,b,c=map(int, input().split())

x=min(a,b,c)
z=max(a,b,c)
if a==x and b==z:
  y=c
if a==x and c==z:
  y=b
if b==x and a==z:
  y=c
if b==x and c==z:
  y=a
if c==x and a==z:
  y=b
if c==x and b==z:
  y=a

print(0 if z%2==0 else x*y)

Measured memory_bytes: 9140
N, K = map(int, input().split())

AB = [[] for _ in range(N)]

for i in range(N):
    AB[i] = list(map(int, input().split()))

AB = sorted(AB)
mem = K
for ab in AB:
    a = ab[0]
    b = ab[1]
    mem -= b
    if mem <= 0:
        print(a)
        break

Measured memory_bytes: 28652
#include <iostream>
#include <stdio.h>
#include <string>

using namespace std;

int main() {
  string S;
  cin >> S;
  int cnt = 0;
  int res = 0;
  for (int i = 0; i < S.size(); ++i) {
    if (S[i] == 'A' || S[i] == 'C' || S[i] == 'G' || S[i] == 'T') {
      ++cnt;
    } else {
      res = max(res, cnt);
      cnt = 0;
    }
  }
  res = max(res, cnt);
  printf("%d\n", res);
}

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

typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define DECIM8  fixed<<setprecision(8) 
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

using namespace std;
int main(void)
{
  for(;;){
    int n;
    cin >> n;
    if(!n) return 0;
    int sum=0,M=0,m=10000;
    REP(i,n){
      int tmp;
      cin >> tmp;
      sum+=tmp;
      if(M<tmp) M=tmp;
      if(m>tmp) m=tmp;
    }
    cout << (sum-M-m)/(n-2) << endl;
  }
}

Measured memory_bytes: 1160
/*jai_ganeshdeva*/

#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define pu push  //  adds the value to the last of the queue 
#define lld long long int
#define ins insert /// used in set to insert the values 
#define adv advance  /// used to increment the iterator
#define mp make_pair
#define fi first
#define se second
#define all(c) c.begin(),c.end()
#define PI 3.1415926
#define INF (lld)1e18
#define vl  vector<long long int >
#define vpl vector< pair<lld ,lld> >
#define vvl vector<vector<lld> > 
#define pll pair <lld,lld>
long long int modp(lld a,lld p,lld n)
{
   lld d[100];
    lld i,j,k,l;
    if(n==0) return 1;
    for(i=0;n>=1;i++)
    {
        d[i]=n%2;
        n/=2;
    }
    l=i;
    long long int e=1;
    if(d[0]==1) e*=(a%p);
    for(i=1;i<l;i++)
    {
        a*=a;
        a=a%p;
        if(d[i]==1) 
        {
            e*=a;
            e=e%p;
        }
    }
    return e%p;
}
lld modInverse(lld n, lld p) 
{ 
    return modp(n, p, p-2); 
}

//lld fac[100001]; 
/*
void solve2()
{
   lld p=1000000007;
    fac[0] = 1; 
    for (lld i=1 ; i<=100000; i++) 
        fac[i] = fac[i-1]*i%p; 
}    

long long int nCrModPFermat(lld n, lld r,lld p) 
{ 
   // Base case 
   if (r==0) 
      return 1; 
     
    return (fac[n]* modInverse(fac[r], p) % p * 
            modInverse(fac[n-r], p) % p) % p; 
}


long long int gcd(lld b,lld a)
{
    if(a<b) return gcd(a,b);
    if(a%b==0) return b;
    return gcd(a%b , b);
}
*/
lld p1=1000000007,p2=998244353;
lld l,r,mid,ans;
lld n,m,i,j,k;
lld x,y,n1,a,b,n2,h,z,c;
queue<lld> q;
lld d,p=1000000000;
//vector< vector <lld > > v(100001);
/*
void bfs(lld x , vector<lld>& d)
{
    d[x]=0;
    q.pu(x);
    while(!q.empty())
    {
        x=q.front();
        q.pop();
        l=v[x].size();
        for(i=0;i<l;i++)
        {
            y=v[x][i];
            if(d[y]==INF) 
            {
                d[y] = d[x]+1;
                q.pu(y);
            }       
        }
    }

}
/*

lld DFS(lld a ,lld x)
{
    visited[a] =true;
    sub_size[a]=1;
 //   if(a==x) 
   //     cont[a] =true;
    lld l= v[a].size();
    for(lld i=0;i<l;i++)
    {
        if(visited[v[a][i]] == false)
        {
            sub_size[a]+= DFS(v[a][i],b);
//            if(cont[v[a][i]] ==true ) cont[a]=true;
        }
    }
    return sub_size[a];

}
*/

void solve()
{
    cin>>k;
    lld a,b;
    cin>>a>>b;
    if(a%k==0) 
    {
        cout<<"OK";
        return;

    }
    x=a/k;
    y=b/k;
    //cout<<x<<" "<<" " <<y;
    if(y>x) cout<<"OK";
    else cout<<"NG";
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    lld t=1;
    
 //   cin>>t;
 //   solve2();
    for(int i=0;i<t;i++)
    {
   //     cout<<"Case #"<<i+1<<": ";
        solve();
        cout<<"\n";
    }

    return 0;
}

Measured memory_bytes: 3660
#input of int(split by space)
def get_i()
  return gets.chomp.split(" ").map(&:to_i)
end
#input of float(split by space)
def get_f()
  return gets.chomp.split(" ").map(&:to_f)
end
#input of string(split by space)
def get()
  return gets.chomp.split(" ")
end
#input of string(split per one character)
def get_nsp()
  return gets.chomp.split("")
end
#yes or no decision
def yn_judge(bool,y="Yes",n="No")
  return bool ? y : n 
end
#create of array
def array(size1,init=nil,size2=-1)
  if size2==-1
    return Array.new(size1){init}
  else
    return Array.new(size2){Array.new(size1){init}}
  end
end

def max(a,b)
    return a>b ? a : b
end

def min(a,b)
    return a>b ? b : a
end

INF=Float::INFINITY

N,P=get_i
A=get_i
dp=Array.new(100*N+1){0}
dp[0]=1
A.each do|a|
    (100*N).downto(a) do|i|
      dp[i]+=dp[i-a]
    end
end
ans=0
(100*N+1).times do|i|
  if P.zero? and i.even?
    ans+=dp[i]
  elsif P.nonzero? and i.odd?
      ans+=dp[i]
  end
end
puts ans

Measured memory_bytes: 3836
import java.io.*;

public class Main {
    public static void main(String[] args) throws Exception {
        try{
            BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
            
            int N = Integer.parseInt(br.readLine());
            int t = 0;
            int x = 0;
            int y = 0;
            
            for(int i=0; i<N; i++){
                String strSplit[] = br.readLine().split(" ");
                int ti = Integer.parseInt(strSplit[0]);
                int xi = Integer.parseInt(strSplit[1]);
                int yi = Integer.parseInt(strSplit[2]);
                
                int dt = ti - t;
                int dx = xi - x;
                int dy = yi - y;
                int dxdy = dx + dy;
                
                if(dxdy < 0){
                    dxdy = dxdy % 2 * (-1);
                }
                
                t = ti;
                x = xi;
                y = yi;
                
                if((Math.abs(dx) + Math.abs(dy)) <= dt && dxdy%2 == dt%2){
                    
                }else{
                    System.out.println("No");
                    return;
                }
            }
            
            System.out.println("Yes");
            
        }catch(Exception e){
            System.out.println(e);
        }
    }
}

Measured memory_bytes: 54728
import itertools as iter
import math as m

def main():
    A, B, H, M = list(map(int, input().split()))
    minute = 360 * M/60
    hour = 360 * H/12 + 30 * M/60

    C = abs(hour-minute)
    C = min(C, 360-C)
    ans = A**2+B**2-2*A*B*m.cos(m.radians(C))
    print(m.sqrt(ans))

if __name__ == '__main__':
    main()

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

typedef pair<int,int> P;
#define ll long long
#define ld long double
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define PI 3.14159265358979323846
#define sz(x) ((int)(x).size())
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
#define all(x) (x).begin(),(x).end()

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

bool counter[4];
int main()
{
    string s;cin >> s;
    for (auto &&i : s)
    {
        if(i=='N')
        {
            counter[0] = true;
        }else if (i=='W')
        {
            counter[1] = true;
        }else if (i=='S')
        {
            counter[2] = true;
        }else if (i=='E')
        {
            counter[3] = true;
        }
    }
    if(counter[0]&& !counter[2])
    {
        cout << "No" << endl;
        return 0;
    }
    if (!counter[0] && counter[2])
    {
        cout << "No" << endl;
        return 0;
    }
    if (counter[1] && !counter[3])
    {
        cout << "No" << endl;
        return 0;
    }
    if (!counter[1] && counter[3])
    {
        cout << "No" << endl;
        return 0;
    }
     cout << "Yes" << endl;
    
    
}

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

using namespace std;
typedef long long ll;
#define int ll

#define REP(i,n) for(int i=0;i<n;++i)
#define ALL(name) name.begin(),name.end()
#define SORT(name) sort(name.begin(), name.end())
#define ZERO(p) memset(p, 0, sizeof(p))
#define MINUS(p) memset(p, -1, sizeof(p))
#if 1
#  define DBG(fmt, ...) printf(fmt, ##__VA_ARGS__)
#else
#  define DBG(fmt, ...)
#endif

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const double DINF = std::numeric_limits<double>::infinity();
const int MOD = 1000000007;
#define MAX_N 100010

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

    int N;
    cin >> N;
    for(int i = 1; i <= 9; ++i) {
        int div = N / i;
        if(N % i == 0 && 1 <= div && div <= 9) {
            printf("Yes\n");
            return 0;
        }
    }
    printf("No\n");

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<utility>
#include<queue>
#include<algorithm>
#include<cmath>
#include<cstdio>
#define INF 2147483647
#define llINF 9223372036854775807
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long

using namespace std;
ll ans=0;
string str;
void dfs(int depth,ll sum,string ss){
  if(depth==str.size()){
    ll sum2=0;
    ll te=1;
    for(int i=ss.size()-1;i>=0;i--){
      //cout<<1111111<<endl;
      sum2+=(ll)(ss[i]-'0')*te;
      te*=10;
    }
    sum+=(ll)sum2;
    ans+=(ll)sum;
    //cout<<sum<<endl;
    return;
  }
  dfs(depth+1,sum,ss+str[depth]);
  ll sum2=0;
  ll te=1;
  for(int i=ss.size()-1;i>=0;i--){
    sum2+=(ll)(ss[i]-'0')*te;
    te*=10;
  }
  string str2=str.substr(depth,1);
  dfs(depth+1,sum+sum2,str2);
}
int main(){
  cin>>str;
  dfs(0,0,"");
  cout<<(ll)ans/2<<endl;
  return 0;
}


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

typedef long long int lli;
typedef unsigned long long int ulli;
typedef pair<int,int> pii;
typedef priority_queue< int, vector< int >, greater< int > >  minHeap;

#define ones(x) __builtin_popcount(x)
#define onesl(x) __builtin_popcountl(x)
#define onesll(x) __builtin_popcountll(x)

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define scn(n) scanf("%d",&n)
#define scnll(n) scanf("%lld",&n)
#define scn2(n,m) scanf("%d%d",&n,&m)
#define scn3(n,m,w) scanf("%d%d%d",&n,&m,&w)
#define scn2ll(n,m) scanf("%lld%lld",&n,&m)
#define atoz(v) v.begin(),v.end()
#define ratoz(v) v.rbegin(),v.rend()
#define Fill(a,v) memset(a,v,sizeof(a))
#define fi first
#define se second
#define inf 1e9
#define pi acos(-1.0)
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define mod 1000000007
#define FastIO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define bug(x) cerr << __LINE__ << " says: " << #x << " = " << (x) << "\n"

int Set(int N,int pos)
{
    return N=N | (1<<pos);
}
int reset(int N,int pos)
{
    return N = N & ~(1<<pos);
}
bool check(int N,int pos)
{
    return (bool)(N & (1<<pos));
}


inline int addmod(lli x,lli y)
{
    return (x%mod + y%mod)%mod;
}
inline int submod(lli x,lli y)
{
    return (x%mod - y%mod + mod)%mod;
}
inline int mulmod(lli x,lli y)
{
    return (x%mod * y%mod)%mod;
}

inline int nextSubMask(int i, int mask)
{
    return (i-1)&mask;   /// returns next  submask
}

template<typename T>
void we_r_done(T mssg)
{
    cout<<mssg;
    exit(0);
}


int main()
{
    ///freopen("output.txt","w",stdout);
    //freopen("input.txt","r",stdin);

    FastIO;
    lli n ;
    while(cin>>n){

        if(n%2) cout<<0<<endl;
        else{
            lli ans = 0;
            while(n%10) n -= 2;
            lli now = 5;
            while(n/(now*2)){
                ans += n/(now*2);
                now *= 5;
            }
            cout<<ans<<endl;
        }
    }

    return 0;

}

///sin and cos expect input in radians not degrees. so use , sin(degrees * pi / 180)
///using bs = bitset<MX>; // how many distinct number can be form?
///sort(atoz(v), [](const data x, const data y){return (x.a==y.a?x.b>y.b : x.a<y.a);});


Measured memory_bytes: 256
# coding: utf-8
import sys
input = sys.stdin.readline

def dp_happiness(N):
    today_a, today_b, today_c = 0, 0, 0
    for _ in range(N):
        a, b, c = map(int, input().split())

        tommorow_a = a + max(today_b, today_c)
        tommorow_b = b + max(today_c, today_a)
        tommorow_c = c + max(today_a, today_b)

        today_a = tommorow_a
        today_b = tommorow_b
        today_c = tommorow_c
    return max(tommorow_a, tommorow_b, tommorow_c)


N = int(input())
print(dp_happiness(N))

Measured memory_bytes: 3064
#include <iostream>
using namespace std;
int main(void){
    int fir,sec,thr;
    cin >> fir >> sec >> thr;
    if(fir == sec){
        cout << thr << endl;
    }
    else if(fir == thr){
        cout << sec << endl;
        
    }
    else{
        cout << fir << endl;
    }
}


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

using namespace std;

#define REP(i, n) for(ll i = 0;i < n;i++)
#define REPR(i, n) for(ll i = n;i >= 0;i--)
#define FOR(i, m, n) for(ll i = m;i < n;i++)
#define FORR(i, m, n) for(ll i = m;i >= n;i--)
#define REPO(i, n) for(ll i = 1;i <= n;i++)
#define ll long long
#define INF (ll)1 << 60
#define MINF (-1 * INF)
#define ALL(n) n.begin(),n.end()
#define MOD 1000000007
#define P pair<ll, ll>

ll n, s[310000],aa[310000],bb[310000],ans = MINF;
priority_queue<ll, vector<ll>, greater<ll> > a;
priority_queue<ll> b;
int main() {
	cin >> n;
	REP(i, 3 * n)cin >> s[i];
	REP(i, 3 * n) {
		a.push(s[i]);
		aa[i + 1] = aa[i] + s[i];
		if (a.size() > n) {
			aa[i + 1] -= a.top();
			a.pop();
		}
	}
	REPR(i, 3 * n - 1) {
		b.push(s[i]);
		bb[i] = bb[i + 1] + s[i];
		if (b.size() > n) {
			bb[i] -= b.top();
			b.pop();
		}
	}
	FOR(i, n, 2 * n + 1)ans = max(ans, aa[i] - bb[i]);
	cout << ans << endl;
}




Measured memory_bytes: 9076
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <string>

using namespace std;

signed main(){
    long long n , r[4001]={} , g[4001]={} , b[4001]={} , ans=0;
    int head , tail;
    string s;
    cin>>n;
    cin>>s;
    
    for(int i=0;i<n;i++){
        if(s[i] == 'R'){
            r[i+1]++;
        } else if(s[i] == 'G'){
            g[i+1]++;
        } else {
            b[i+1]++;
        }
        
        r[i+1] += r[i] , g[i+1] += g[i] , b[i+1] += b[i];
    }
    
    
    for(int i=1;i<=n;i++){
        if(s[i-1] == 'R'){
            ans += (g[i-1] - g[0]) * (b[n] - b[i]) + (b[i-1] - b[0]) * (g[n] - g[i]);
        } else if(s[i-1] == 'B'){
            ans += (g[i-1] - g[0]) * (r[n] - r[i]) + (r[i-1] - r[0]) * (g[n] - g[i]);
        } else {
            ans += (r[i-1] - r[0]) * (b[n] - b[i]) + (b[i-1] - b[0]) * (r[n] - r[i]);
        }
        
        head = i-2 , tail = i;
        
        while(head >= 0 && tail < n){
            if(s[head] != s[tail] && s[head] != s[i-1] && s[tail] != s[i-1]){
                ans--;
            }
            head-- , tail++;
        }
    }
    
    cout<<ans<<endl;
    return(0);
}

Measured memory_bytes: 3724
//Optional FAST

//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,fma,abm,mmx,avx,avx2,tune=native")

//Required Libraries

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>

//Required namespaces

using namespace std;
using namespace __gnu_pbds;

//Required defines

#define endl '\n'

#define READ(X) cin>>X;
#define READV(X) long long X; cin>>X;
#define READAR(A,N) long long A[N]; for(long long i=0;i<N;i++) {cin>>A[i];}
#define rz(A,N) A.resize(N);
#define sz(X) (long long)(X.size())
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define FORI(a,b,c) for(long long a=b;a<c;a++)
#define FORD(a,b,c) for(long long a=b;a>c;a--)

//Required typedefs

typedef tree<long long,null_type,less<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
typedef tree<long long,null_type,greater<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set1;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<long long,long long> pll;

//Required Constants

const long long inf=(long long)1e18;
const long long MOD=(long long)(1e9+7);
const long long INIT=(long long)(1e6+1);
const long double PI=3.14159265358979;

// Required random number generators

// mt19937 gen_rand_int(chrono::steady_clock::now().time_since_epoch().count());
// mt19937_64 gen_rand_ll(chrono::steady_clock::now().time_since_epoch().count());

//Required Functions

ll power(ll x,ll y) 
{ 
    if (y == 0) 
        return 1; 
    ll p = power(x, y/2) % MOD; 
    p = (p * p) % MOD; 
  
    return (y%2 == 0)? p : (x * p) % MOD; 
}
ll modInverse(ll a) 
{ 
   return power(a,MOD-2); 
   
}

//Work

int main()
{
    #ifndef ONLINE_JUDGE
    if (fopen("INPUT.txt", "r"))
    {
        freopen ("INPUT.txt" , "r" , stdin);
        //freopen ("OUTPUT.txt" , "w" , stdout);
    }
    #endif
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    clock_t clk;
    clk = clock();
//-----------------------------------------------------------------------------------------------------------//

    READV(N);
    ll ans=0;
    FORI(L,1,N+1)
    {
        ans+=(((N-L+1)*(N-L+2))/2);
    }
    FORI(i,0,N-1)
    {
        READV(u);
        READV(v);
        if(v<u)
        {
            swap(u,v);
        }
        ans-=(u*(N-v+1));
    }
    cout<<ans<<endl;

//-----------------------------------------------------------------------------------------------------------//


    clk = clock() - clk;
    cerr << fixed << setprecision(6) << "Time: " << ((double)clk)/CLOCKS_PER_SEC << endl;

    return 0;
}

Measured memory_bytes: 3808
#include <bits/stdc++.h>
using namespace std;
#define LL long int
#define ULL unsigned long int
#define LD long double

LL MOD = 1000000007;

int main(){
    int n,k;
    cin >> n >> k;
    vector<int> p(n);
    for(int i = 0; i < n ; ++i) cin >> p[i];

    sort(p.begin(), p.end());

    int ans = 0;

    for(int i = 0; i < k; ++i)ans += p[i];

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3608
# -*-coding: utf-8 -*-
W, H, x, y = map(int, input().split())
s = W*H/2

if W % 2 == 0 and H % 2 == 0 and W // 2 == x and H // 2 == y:
    print(s, 1)
else:
    print(s, 0)

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

int main(){
    
    int a, b, c, t=0;
    cin >> a >> b >> c;
    for(int i=a; i<=b; i++){
        if(c%i==0){
            t++;
        }
    }
    cout << t << endl;
    
    return 0;
    
}


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

using namespace std;

int N, Q, p[3009], dp[3009][3009], old[3009][3009];
const int mod = 1e9 + 7;

int add (int x, int y) {int ans = x + y; if (ans >= mod) ans -= mod; return ans;}
int subtract (int x, int y) {if (x >= y) return x - y; return x - y + mod;}
int mul (int x, int y) {return 1LL * x * y % mod;}
void adto (int &x, int y) {x += y; if (x >= mod) x -= mod;}

int power (int a, int b)
{
    int p = 1;
    for (int i=0; (1<<i) <= b; i++)
    {
        if (b & (1 << i)) p = mul (p, a);
        a = mul (a, a);
    }
    return p;
}

void div2 (int &x) {if (x & 1) x += mod; x >>= 1;}

int main ()
{
//freopen ("input", "r", stdin);
//freopen ("output", "w", stdout);

scanf ("%d %d", &N, &Q);
for (int i=1; i<=N; i++)
    scanf ("%d", &p[i]);
for (int i=1; i<=N; i++)
    for (int j=1; j<=N; j++)
        dp[i][j] = (p[i] < p[j]);
int p2 = 1;
while (Q --)
{
    int x, y;
    scanf ("%d %d", &x, &y), p2 = add (p2, p2);
    if (x > y) swap (x, y);
    for (int i=1; i<=N; i++)
        old[i][x] = dp[i][x], old[i][y] = dp[i][y],
        old[x][i] = dp[x][i], old[y][i] = dp[y][i];
    adto (dp[x][y], old[y][x]), div2 (dp[x][y]);
    adto (dp[y][x], old[x][y]), div2 (dp[y][x]);
    for (int i=1; i<=N; i++)
    if (i != x && i != y)
    {
        adto (dp[i][x], old[i][y]),
        adto (dp[x][i], old[y][i]);

        adto (dp[i][y], old[i][x]);
        adto (dp[y][i], old[x][i]);
    }
    for (int i=1; i<=N; i++)
        if (i != x && i != y)
            div2 (dp[i][x]), div2 (dp[i][y]),
            div2 (dp[x][i]), div2 (dp[y][i]);
/*    int sum = 0;
    for (int i=1; i<=N; i++)
        for (int j=1; j<=N; j++)
            sum += dp[i][j];
    printf ("%d\n", sum);*/
    for (int i=1; i<=N; i++)
        assert (dp[i][i] == 0);
}
int ans = 0;
for (int i=1; i<=N; i++)
    for (int j=1; j<i; j++)
        adto (ans, dp[i][j]);
ans = mul (ans, p2);
printf ("%d\n", ans);
return 0;
}


Measured memory_bytes: 70912
using System;
class Program
{
	static void Main(string[] args)
	{
		string[] input = Console.ReadLine().Split(' ');
		int a = int.Parse(input[0]);
		int b = int.Parse(input[1]);
		if(a<10 && b<10)
		{
			Console.WriteLine(a*b);
		}
		else
		{
			Console.WriteLine(-1);
		}
	}
}

Measured memory_bytes: 13140
#include <iostream>

using namespace std;

int main(){

	int n,m,c;
	cin>>n>>m>>c;
	int b[m];
	int a[n][m];
	long long int temp=0;
	int ans=0;

	for(int i=0;i<m;i++){
	
		cin>>b[i];
	}
	for(int i=0;i<n;i++){
	
		for(int j=0;j<m;j++){
		
			cin>>a[i][j];
			temp+=a[i][j]*b[j];
		}
		temp+=c;
		if(temp>0){

			ans++;
		}
		temp=0;
	}
	cout<<ans<<"\n";
	return 0;

}


Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef vector<ll> vl;
typedef vector<pair<ll,ll>> vp;
typedef pair<ll,ll> Pair;
#define rep(i,n) for(ll i = 0; i < ll(n); i++)
#define ALL(x) (x).begin(), (x).end()
#define inputv(v,n) rep(i,n){\
    ll x;\
    cin>>x;\
    v.push_back(x);\
    }

const ll INF=99999999999999;
const ll MOD=1000000007;
 
int main() {
  ll n,H;
  cin >> n >> H;
  vl a(n),b(n);
  rep(i,n) cin >> a[i] >> b[i];
  ll Amax = 0;
  rep(i,n) Amax = max(Amax,a[i]);
  sort(ALL(b));
  ll sum = 0;
  ll count = 0;
  rep(i,n){
    if(b[n-1-i] > Amax){
      sum += b[n-1-i];
      count++;
      if(sum >= H) break;
    }
    if(b[n-1-i] <= Amax) break;
    }
  

    if(sum < H) count += ((H-sum+Amax-1)/Amax);
    cout << count;
 return 0;
}

Measured memory_bytes: 1792
#include <stdio.h>
  
int main(void)
{
    int H, W, i, j;
  
 
 
    while(1){
    scanf("%d %d", &H, &W);
        if(H!=0 || W!=0){
            for(i=0;i<H;i++){
                for(j=0;j<W;j++){
                    if((i%2==0 && j%2==0) || (i%2!=0 && j%2!=0)){ 
                    printf("#");
                    }
                    else{printf(".");}
                    }
            printf("\n");
            }
            printf("\n");
            }
        else{
            break;
        }
    }
    return 0;
}  

Measured memory_bytes: 572
def sum_digits(x):
        rt = ''
        for char in str(x):
            rt += char
            rt += '+'

        return eval(rt[0:-1])


def some_sums():
    n, a, b = map(int, input().split())

    ans = 0
    for i in range(n+1):
        if a <= sum_digits(i) <= b:
            ans += i

    return ans

  
if __name__ == '__main__':
  print(some_sums())

Measured memory_bytes: 3064
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <numeric>
using namespace std;
typedef long long int ll;

#define EPS (1e-7)
#define INF 1e18
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
#define PI (acos(-1))

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

ll MOD = pow(10, 9) + 7;

ll powmod(ll a, ll p, ll MOD) {
	ll ans = 1;
	ll mul = a;
	for (; p > 0; p >>= 1, mul = (mul * mul) % MOD) {
		if ((p & 1) == 1)ans = (ans * mul) % MOD;
	}
	return ans;
}

long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m; 
    if (u < 0) u += m;
    return u;
}


ll combmod(ll n, ll r, ll MOD){
  if(n < r) return 0LL;
  if (n < 0 || r < 0) return 0LL;
  vector<ll> ff(n+1), vff(n+1);
  // 1! ~ n!
  ff[0] = 1;
  for(ll i = 1; i < n + 1; i++) {
    ff[i] = ff[i - 1] * i % MOD;
  }
  // n!^(MOD-2) (= n!^(-1))
  ll inv = powmod(ff[n], MOD - 2, MOD);

  // n!^(-1) ~ 1!^(-1)
  vff[n] = inv;
  for(ll i = n - 1; i >= 0; i--) {
    vff[i] = vff[i + 1] * (i + 1) % MOD;
  }

  // n combination r
  ll comb = (((ff[n] * vff[r]) % MOD) * vff[n - r]) % MOD;

  return comb;
}

int main() {

    ll N, a, b;

    cin >> N >> a >> b;

    ll tmp = powmod(2, N, MOD) - 1;

    ll tmp1 = 1, tmp2 = 1;
    for (ll i = N; i > N - a; i--) tmp1 = (tmp1 * i % MOD);
    for (ll i = a; i > 0; i--) tmp2 = (tmp2 * i % MOD);
    tmp1 = (tmp1 * modinv(tmp2, MOD)) % MOD;
    tmp = (tmp - tmp1 + MOD) % MOD;


    tmp1 = 1, tmp2 = 1;
    for (ll i = N; i > N - b; i--) tmp1 = (tmp1 * i % MOD);
    for (ll i = b; i > 0; i--) tmp2 = (tmp2 * i % MOD);
    tmp1 = (tmp1 * modinv(tmp2, MOD)) % MOD;
    tmp = (tmp - tmp1 + MOD) % MOD;

    cout << tmp << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>

using namespace std;

int main()
{
	int n;
	string str;
	cin >> str;
	cin >> n;
	for(int i=0; i < str.size();i++)
	{
		if(i%n==0)
			cout<<str[i];
	}
	cout << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
//pbds
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
template <typename T>   using orderedSet =tree<T, null_type, less<T>,rb_tree_tag, tree_order_statistics_node_update>;
///use less_equal in pbds template to work as multiset...................................................
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define pb push_back
//BFS+DFS
#define boundary(i,j) (i>=0 && i<n && j>=0 && j<m)
int X[]={-1,1,0,0};
int Y[]={0,0,1,-1};
int cnt1[300005],cnt2[300005];
vector<int>v1,v2;
vector<int>r,c;
set<pii>mp;
int main()
{
     ios_base::sync_with_stdio(false);
     cin.tie(NULL);
     int h,w,m;
     cin>>h>>w>>m;
     int mx1=0,mx2=0;
     for(int i=0; i<m; i++)
     {
         int x,y;
         cin>>x>>y;
         mp.insert({x,y});
         ++cnt1[x];
         ++cnt2[y];
         mx1=max(mx1,cnt1[x]);
         mx2=max(mx2,cnt2[y]);
     }

    for(int i=1; i<=h; i++)
        {
            if(cnt1[i]==mx1) r.pb(i);
        }
           for(int i=1; i<=w; i++)
        {
            if(cnt2[i]==mx2) c.pb(i);
        }
        int ans=mx1+mx2-1;
     for(int i:r)
     {
         for(int j:c)
         {

             if(mp.find({i,j})==mp.end())
                {
                    ans=mx1+mx2;
                    break;
                }


         }
         if(ans==mx1+mx2) break;
     }
     cout<<ans<<endl;


}




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

int main(){
	long n, m;
	long dist[100001]; //宿1からの距離
	dist[1]=0;
	
	scanf(" %ld %ld", &n, &m);
	for(long i=0; i<n-1; ++i){
		long s;
		scanf(" %ld", &s);	
		dist[i+2]=s+dist[i+1];
	}
	long ans=0;
	long now=1;
	for(long i=0; i<m; ++i){
		long p;
		scanf(" %ld", &p);
		
		if(p>0) ans += dist[now+p]-dist[now];
		else ans += dist[now]-dist[now+p];
		ans %= 100000;
		now+=p;
	}
	
	printf("%ld\n", ans);
}

Measured memory_bytes: 1972
//
//  main.cpp
//  atcoder-grouping
//
//  Created by r on 6/8/19.
//  Copyright © 2019 r. All rights reserved.
//

#include <iostream>
#include <algorithm>
#include <cstring>
#include <iomanip>
#include <fstream>
#include <cmath>
#include <vector>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <map>
#include <stack>
#include <queue>
#include <assert.h>
#include <limits>
#include <cstdio>
using namespace std;

//#define RDEBUG 1
#ifdef RDEBUG
#define D(x) x
#else
#define D(x)
#endif
#define inf 0x7fffffff
#define MOD 1000000007

typedef long long ll;

long long add(long long a, long long b) {
    a += b;
    if(a >= MOD) {
        a -= MOD;
    }
    return a;
}
long long sub(long long a, long long b) {
    a -= b;
    if(a < 0) {
        a += MOD;
    }
    return a;
}
void add_self(long long& a, long long b) {
    a = add(a, b);
}
void sub_self(long long& a, long long b) {
    a = sub(a, b);
}

const int MAXN = 70010;

ll N;
ll prep[MAXN];
ll mat[20][20];
ll dp[MAXN];
vector<ll> remain;

void recurse(ll mask, ll i, ll p) {
    if (p == remain.size()) {
        dp[mask | i] = max(dp[mask | i], dp[i]+prep[mask]);
        return;
    }
    ll bit = remain[p];
    recurse(mask | (1 << bit), i, p+1);
    recurse(mask, i, p+1);
}

int main() {
    ios_base :: sync_with_stdio(false);
    cin.tie(nullptr);
    cin >> N;
    for (int i = 0; i<MAXN; i++) {
        dp[i] = numeric_limits<ll>::min();
    }
    for (int i = 0; i<N; i++) {
        for (int j = 0; j<N; j++) {
            cin >> mat[i][j];
        }
    }
    for (int i = 0; i<(1 << N); i++) {
        vector<ll> group;
        for (int j = 0; j<N; j++) {
            if (i & (1 << j)) {
                group.push_back(j);
            }
        }
        for (int j = 0; j<group.size(); j++) {
            for (int k = j+1; k<group.size(); k++) {
                ll a = group[j], b = group[k];
                prep[i]+=mat[a][b];
            }
        }
    }
    dp[0] = 0;
    for (int i = 0; i<(1<<N); i++) {
        for (int j = 0; j<N; j++) {
            if (!(i & (1 << j))) {
                remain.push_back(j);
            }
        }
        recurse(0, i, 0);
        remain.clear();
    }
    cout << dp[(1<<N)-1] << endl;
    return 0;
}





Measured memory_bytes: 1280
a = [int(input()) for i in range(5)]
ans = 10
ch = {}
b = {}
num = 0
for i in range(5):
    b[i] = a[i]
    while True:
        a[i] = a[i]%10
        if a[i] == 0:
            a[i] = 10
        if a[i] <= 10:
            ch[i] = a[i]
            break
    ans = min(ch[i],ans)
for i in range(5):
    #print("b[",i,"]=",b[i])
    if b[i] <= 99:
        if b[i] %10 == 0:
            ans -= 10
        num += b[i] - b[i]%10
        #print("num",num)
    else:
        if b[i] %10 == 0:
            ans -= 10
        num += b[i] - (b[i] - 100)%10
print(ans + num + 40)

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

using namespace std;
#define inf             0x3f3f3f3f
#define INF             2e18
#define eps             1e-9

#define FastRead        ios_base::sync_with_stdio(0);cin.tie(0)
#define fRead           freopen("input.txt","r",stdin)
#define fWrite          freopen("output.txt","w",stdout)

#define LL              long long
#define ull            unsigned long long
#define PI              acos(-1.0)
#define pb              push_back
#define mk              make_pair
#define pii             pair<int,int>
#define pLL             pair<LL,LL>
#define ff              first
#define ss              second
#define all(a)          a.begin(),a.end()
#define SQR(a)          ((a)*(a))
#define min3(a,b,c)     min(a,min(b,c))
#define max3(a,b,c)     max(a,max(b,c))
#define min4(a,b,c,d)   min(min(a,b),min(c,d))
#define max4(a,b,c,d)   max(max(a,b),max(c,d))
#define max5(a,b,c,d,e) max(max3(a,b,c),max(d,e))
#define min5(a,b,c,d,e) min(min3(a,b,c),min(d,e))
#define vi              vector <int>
#define vL              vector <LL>
#define LB(a,x)         (lower_bound(all(a),x)-a.begin()) //  first element in the range [first,last) which does not compare less than val.
#define UB(a,x)         (upper_bound(all(a),x)-a.begin()) //  first element in the range [first,last) which compares greater than val.
#define prec(n)         fixed << setprecision(n)

#define MEM(a,x)        memset(a,x,sizeof(a))
#define SORT(v)         sort(v.begin(),v.end())
#define REV(v)          reverse(v.begin(),v.end())
#define Unique(a)       sort(all(a)),a.erase(unique(all(a)),a.end())

#define FOR(i,a,b)      for(int i=a;i<=b;i++)
#define ROF(i,a,b)      for(int i=a;i>=b;i--)
#define REP(i,b)        for(int i=0;i<b;i++)
#define IT(it,x)	    for(it=x.begin();it!=x.end();it++)
int main()
{
    int n;
    string s;
    cin>>n>>s;
    int cnt=0;
    for(int i=1;i<n-1;i++)
    {

        if(s[i-1]=='A' and s[i]=='B' and s[i+1]=='C') cnt++;
    }
    cout<<cnt;

}


Measured memory_bytes: 256