akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cctype>

#include <algorithm>
#include <random>
#include <bitset>
#include <queue>
#include <functional>
#include <set>
#include <map>
#include <vector>
#include <chrono>
#include <iostream>
#include <limits>
#include <numeric>

#define LOG(FMT...) fprintf(stderr, FMT)

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

// mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

template <class T>
istream& operator>>(istream& is, vector<T>& v) {
  for (T& x : v)
    is >> x;
  return is;
}

template <class T>
ostream& operator<<(ostream& os, const vector<T>& v) {
  if (!v.empty()) {
    os << v.front();
    for (int i = 1; i < v.size(); ++i)
      os << ' ' << v[i];
  }
  return os;
}

int main() {
#ifdef LBT
  freopen("test.in", "r", stdin);
  int nol_cl = clock();
#endif
  ios::sync_with_stdio(false);
  cin.tie(nullptr);

  int a, b, c;
  cin >> a >> b >> c;
  if (a + b >= c) {
    cout << "No";
    return 0;
  }
  ll x = 4LL * a * b, y = (c - a - b);
  y *= y;
  cout << (x < y ? "Yes" : "No");

#ifdef LBT
  LOG("Time: %dms\n", int ((clock()
          -nol_cl) / (double)CLOCKS_PER_SEC * 1000));
#endif
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>


int main(void)
{
    int n, m;
    int friend[512][512];
    int invite[512];
    int cnt;
    int a, b;
    int i, j;

    while (scanf("%d %d", &n, &m)){
        if (n == 0 && m == 0){
            break;
        }

        for (i = 1; i <= n; i++){
            invite[i] = 0;
            for (j = 1; j <= n; j++){
                friend[i][j] = 0;
            }
        }
        for (i = 0; i < m; i++){
            scanf("%d %d", &a, &b);
            friend[a][b] = friend[b][a] = 1;
        }

        for (i = 2; i <= n; i++){
            if (friend[1][i] != 1){
                continue;
            }
            invite[i] = 1;
            for (j = 2; j <= n; j++){
                if (friend[i][j] == 1){
                    invite[j] = 1;
                }
            }
        }

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

    return (0);
}

Measured memory_bytes: 1608
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
#define ALL(c) (c).begin(), (c).end()
#define SUM(x) std::accumulate(ALL(x), 0LL)
#define MIN(v) *std::min_element(v.begin(), v.end())
#define MAX(v) *std::max_element(v.begin(), v.end())
#define EXIST(v, x) (std::find(v.begin(), v.end(), x) != v.end())

using namespace std;
using ll = long long;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
const int INF = 1001001001;
const long long INFL = (1LL<<60);
const double eps = (1e-9);

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

  string s; cin >> s;
  if (s == "ABC") puts("ARC");
  else puts("ABC");

  return 0;
}


Measured memory_bytes: 3644
#include <bits/stdc++.h> 
#define FOR(i,a,b) for(int i=(a);i<=(b);++i) 
#define RFOR(i,a,b) for(int i=(a);i>=(b);--i) 
#define REP(i,n) for(int i=0;i<(n);++i)
#define RREP(i,n) for(int i=(n);i>0;--i)
#define CI cin>> 
#define CO cout<<
#define EN <<endl 
#define all(x) (x).begin(),(x).end() 
#define asn ans
using namespace std;
template <typename T> istream& operator >> (istream& is, vector<T>& vec) { for (T& x : vec) is >> x; 	return is; }
using ll = long long;

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

int main() {
	int a, b; CI a >> b;
	CO a*a - b EN;
}

Measured memory_bytes: 256
#![allow(unused_imports)]
#![allow(non_snake_case)]

use std::cell::RefCell;
use std::cmp::{max, min, Ordering};
use std::collections::*;
use std::fmt::{Debug, Formatter};
use std::io::*;
use std::mem::{replace, swap};
use std::ops::*;
use std::rc::Rc;

// -----------------------------------------------
// Framework
// -----------------------------------------------

#[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) =>
        (rl().parse::<$t>().unwrap());
    ($($t:ty),*) => {{
        let buf = rl();
        let mut w = buf.split_whitespace();
        ($(w.next().unwrap().parse::<$t>().unwrap()),*)
    }};
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($arg:expr),*) => {
        #[cfg(debug_assertions)]
        {
            let entries = [$(&stringify!([$arg]:), &$arg as &Debug),*];
            stderr().write_fmt(format_args!("{:#?}\n", entries)).unwrap();
        }
    };
}

#[allow(dead_code)]
fn rl() -> String {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();
    buf.trim_right().to_owned()
}

trait IteratorExt: Iterator + Sized {
    fn vec(self) -> Vec<Self::Item> {
        self.collect()
    }
}

impl<T: Iterator> IteratorExt for T {}

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

pub fn main() {
    let (D, G) = read!(usize, usize);
    let P = read![usize, usize; D];

    let mut mi = std::usize::MAX;
    for s in 0..(1 << D) {
        let mut count = 0;
        let mut score = 0;

        for i in 0..D {
            if s & (1 << i) != 0 {
                count += P[i].0;
                score += (i + 1) * 100 * P[i].0 + P[i].1;
            }
        }

        for i in (0..D).rev() {
            if s & (1 << i) != 0 || P[i].0 <= 1 {
                continue;
            }

            for _ in 0..P[i].0 - 1 {
                if score >= G {
                    break;
                }

                count += 1;
                score += (i + 1) * 100;
            }
        }

        if score >= G {
            mi = min(mi, count);
        }
    }

    println!("{}", mi);
    return;
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;

const int maxn = 305;
int d[maxn][maxn][maxn];

void uax(int& a, int b) {
  a = max(a, b);
}

signed main() {
#ifdef LOCAL
  assert(freopen("d.in", "r", stdin));
#endif
  string s;
  int k;
  cin >> s >> k;
  int n = (int) s.size();
  string a = s;
  string b = s;
  reverse(b.begin(), b.end());
  for (int i = 0; i <= (int) a.size(); ++i) {
    for (int j = 0; j <= (int) b.size(); ++j) {
      for (int q = 0; q <= k; ++q) {
        uax(d[i + 1][j][q], d[i][j][q]);
        uax(d[i][j + 1][q], d[i][j][q]);
        if (i < (int) a.size() && j < (int) b.size()) {
          uax(d[i + 1][j + 1][q + (a[i] != b[j])], d[i][j][q] + 1);
        }
      }
    }
  }
  int res = 0;
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j <= k; ++j) {
      uax(res, 2 * d[i][n - i - 1][j] + 1);
      uax(res, 2 * d[i][n - i][j]);
    }
  }
  cout << res << '\n';
}


Measured memory_bytes: 110848
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define zero_pad(num) setfill('0') << std::right << setw(num)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;

int main() {
    int n;
    cin >> n;
    map<char, ll> c;
    rep(i, n){
        string s;
        cin >> s;
        c[s[0]]++;
    }

    vector<ll> a(5);
    a[0] = c['M'];
    a[1] = c['A'];
    a[2] = c['R'];
    a[3] = c['C'];
    a[4] = c['H'];

    ll ans = 0;
    for(int i = 0; i < 5; i++){
        for(int j = i + 1; j < 5; j++){
            for(int k = j + 1; k < 5; k++){
                ans += a[i] * a[j] * a[k];
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <functional> 
#include <vector>
#include <numeric>
#include <stack>
#include <queue>
#include <utility>
//#include <cmath>
#include <cstdlib>

using namespace std;

int main(){

    int n,m,x;
    cin >> n >> m >> x;
    int a=0,b=0;
    for(int i=0;i<m;i++){
        int c;
        cin >> c;
        if(c <= x)a++;
        if(c >= x)b++;
    }
    cout << min(a,b);

    return 0;
}

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

using namespace std;


int main() {
	int a, b;
	cin >> a;
	cin >> b;
	int d, r;
	double f;
	r = int(a % b);
	d =  a / b;
	f = double (a) /double (b);
	printf("%d %d %.5f", d, r, f);
	return 0;
}

Measured memory_bytes: 1192
import math
A, B = map(int, input().split())
l = []
for i in range(2000):
    if math.floor(i*0.08) == A and math.floor(i*0.1) == B:
        l.append(i)
if len(l) != 0:
    print(min(l))
else:
    print(-1)

Measured memory_bytes: 38640
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define LOOP(i,x,n) for(int i=x;i<n;i++)
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define MP make_pair
#define FIR first
#define SEC second
#define int long long
using namespace std;

signed main(){
  int n;
  cin>>n;
  int mile=999/3*200+(999-999/3)*195;
  while(n--){
    int y,m,d;
    cin>>y>>m>>d;
    y--;
    int sum=0;
    sum+=y/3*200+(y-y/3)*195;
    y++;
    if(y%3!=0){
      for(int i=1;i<m;i++){
        if(i%2!=0)sum+=20;
        else sum+=19;
      }
    }else{
      sum+=20*(m-1);
    }
    sum+=(d-1);
    cout<<mile-sum<<endl;
  }
  return 0;
}



Measured memory_bytes: 3052
#![allow(unused_macros)]
#![allow(dead_code)]
#![allow(unused_imports)]

use text_io::*;

const U_INF: usize = 1 << 60;
const I_INF: isize = 1 << 60;

fn main() {
    let x: usize = read!();
    let y: usize = read!();

    let mut money = vec![0;1000];
    money[1] = 300000;
    money[2] = 200000;
    money[3] = 100000;

    let ans = money[x] + money[y] + if x == y && x == 1 { 400000 } else { 0 };
    println!("{}", ans);
}


Measured memory_bytes: 2132
n, m = map(int, input().split())
sc = [list(map(int, input().split())) for _ in range(m)]

ans = [-1] * n

for s, c in sc:
    t = s - 1
    if ans[t] == -1:
        ans[t] = c
    elif ans[t] != c:
        print(-1)
        exit()

if n == 1:
    if ans[0] == -1:
        ans[0] = '0'
    else:
        ans[0] = str(ans[0])
elif ans[0] == 0:
    print(-1)
    exit()
else:
    ans[0] = str(max(1, ans[0]))
for i in range(1, n):
    ans[i] = str(max(0, ans[i]))

print(''.join(ans))

Measured memory_bytes: 3064
import java.util.*;

public class Main {

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

		int n = scanner.nextInt();
		int arr[] = new int[n];
		for(int i = 0; i < n - 1; i++) {
			int value = scanner.nextInt();
			arr[value - 1] += 1;
		}
		
		for(int value : arr)
			System.out.println(value);
		

		scanner.close();
	}

}


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


int main(){
	int n ; cin >> n ;
	set<int> s ;
	for(int i=0;i<n;i++){
		int a ; cin >> a ;
		if(s.count(a)) s.erase(a) ;
		else s.insert(a) ;
	}
	cout << s.size() << endl ;
}


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

int A[10000][10000];
int main() {
 int N, K;
 cin >> N >> K;
 vector<int> d(10000);
 for(int i = 0; i < K; i++) {
   cin >> d[i];
   for(int j = 0; j < d[i]; j++) {
     cin >> A[i][j];
   }
 }
  ll sum = 0;
  vector<int> b(N);
 for(int i = 0; i < K; i++) {
   
   for(int j = 0; j < d[i]; j++) {
     b[A[i][j] - 1] += 1;
   }
 }

 for(int i = 0; i < N; i++) {
   if(b[i] == 0) sum++; 
 }



 cout << sum;
 return 0;
}



Measured memory_bytes: 3984
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#define ll long long
#define rep(i,n) for(ll i=0;i<(n);i++)
#define max(p,q) ((p)>(q)?(p):(q))
#define min(p,q) ((p)<(q)?(p):(q))
#define chmax(a,b) ((a)=(a)>(b)?(a):(b))
#define chmin(a,b) ((a)=(a)<(b)?(a):(b))
#define abs(p) ((p)>=(0)?(p):(-(p)))
#define MOD 1000000007
ll powll(ll a,ll b){ll r=1;rep(i,b){r*=a;}return r;}
#define swap(a,b) do{ll w=(a);(a)=(b);(b)=w;}while(0)
#define swapd(a,b) do{double w=(a);(a)=(b);(b)=w}while(0)
#define in(a) scanf("%lld", &(a))
#define in2(a,b) scanf("%lld %lld",&(a),&(b))
#define in3(a,b,c) scanf("%lld %lld %lld",&(a),&(b),&(c))
#define ind(a) scanf("%lf", &(a))
#define ins(a) scanf("%s", (a))
#define inc(a) scanf("%c", &(a))
#define put(a) printf("%lld\n", (a))
#define putd(a) printf("%.15f\n", (a))
//      puts(a) printf("%s\n", a) 文字はこっち
//your code here!
int cmp(const void *a, const void *b){
    ll A=*(ll *)a, B=*(ll *)b;
    if(A==B)return 0;
    else return A>B ? 1:-1;//昇順ソート 1,2,....9
}

int main(void){
    ll N, A[200100], ans=0, sum=0;
    in(N);
    rep(i, N) in(A[i]);
    for(ll i=1; i<N; i++) A[i] += A[i-1];
    A[N] = 0;
    qsort(A, N+1, sizeof(ll), cmp);
    rep(i, N){
        if(A[i]==A[i+1]) sum++;
        else if(sum){
            ans += sum*(sum+1)/2;
            sum=0;
        }
    }
    put(ans+sum*(sum+1)/2);
    return 0;
}


Measured memory_bytes: 3324
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define all(v) v.begin(),v.end()
#define P pair<int,int>
#define len(s) (int)s.size()
#define pb push_back

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;
}
constexpr int mod = 1e9+7;
constexpr int inf = 3e18;

int N,M,H[100005];
bool bad[100005];
signed main(){
	cin>>N>>M;
	rep(i,N)cin>>H[i];
	while(M--){
		int a,b;cin>>a>>b;a--;b--;
		if(H[a]<=H[b])bad[a]=true;
		if(H[a]>=H[b])bad[b]=true;
	}
	int ans=0;
	rep(i,N)ans+=!bad[i];
	cout<<ans<<endl;
}


Measured memory_bytes: 4480
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reprev(i, n) for (int i = (int)(n)-1; i >= 0; i--)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define pc(c) putchar_unlocked(c)
typedef long long ll;

char arr[11];
int n;

void dfs(int cou, int t)
{
  if (cou == n)
  {
    cout << arr << endl;
    return;
  }

  rep(i, t)
  {
    arr[cou] = 'a' + i;
    if (i + 1 == t)
      dfs(cou + 1, t + 1);
    else
      dfs(cou + 1, t);
  }
}

int main()
{
  cin >> n;
  arr[n] = '\0';
  dfs(0, 1);
}


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

using pii = std::pair<int, int>;

int main()
{
	int n, k;
	scanf("%d%d", &n, &k);
	std::vector<pii> sushi(n);
	for (auto& e: sushi)
	{
		scanf("%d%d", &e.second, &e.first);
		e.second--;
	}
	std::sort(sushi.rbegin(), sushi.rend());
	std::vector<bool> ate(n);
	int x{};
	long long max{};
	std::stack<int> contain;
	for (int i{}; i < k; i++)
	{
		if (!ate[sushi[i].second])
		{
			ate[sushi[i].second] = true;
			max += 2 * x + 1;
			x++;
		}
		else
			contain.push(sushi[i].first);
		max += sushi[i].first;
	}

	long long tmp_max{max};
	for (int i{k}; i < n; i++)
	{
		if (contain.empty()) break;
		if (ate[sushi[i].second]) continue;
		tmp_max += sushi[i].first + 2 * x + 1 - contain.top();
		x++;
		max = std::max(max, tmp_max);
		contain.pop();
		ate[sushi[i].second] = true;
	}

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

	return 0;
}

Measured memory_bytes: 1152
N,M=map(int,input().split())
AC=[0 for i in range(N+1)]
WA=[0 for i in range(N+1)]

for i in range(M):
    p,s=input().split()
    #print(p,s)
    p=int(p)
    if s=="AC":
        AC[p]=1
    elif s=="WA":
        if AC[p]==0:
            WA[p]+=1
ac=0
wa=0
for i in range(1,N+1):
    if AC[i]==1:
        ac+=1
        wa+=WA[i]
print(ac,wa)

Measured memory_bytes: 49460
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
// Welcome to my source code!

int main() {
    int n;
    cin >> n;
    int ans = 0;
    for (int i = 1; i <= n; i++) {
        int dgt = 1, t = i;
        while (t / 10) {
            t /= 10;
            dgt++;
        }
        if (dgt & 1) ans++;
    }
    cout << ans << endl;
}

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

int main()
{
	
	int n,k;
	cin>>n>>k;
	int arr[n+10];
	for(int i=0;i<n;i++)
	{
		cin>>arr[i];
	}
	int dp[k+10];
	sort(arr,arr+n);
	int a = arr[0];  
	for(int i=0;i<a;i++)
	{
	    dp[i] = 0;
	}
	for(int i=a;i<=k;i++)
	{
		for(int j=0;j<n;j++)
		{
			if(i-arr[j] >= 0 && dp[i - arr[j]] == 0)
			{
				dp[i] = 1;
				break;
			}
			else
			{
			    dp[i] = 0;
			}
		}
	}
	if(dp[k] == 1)
	{
	    cout<<"First"<<endl;
	}
	else
	{
	    cout<<"Second"<<endl;
	}
	return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
#include<iomanip>
#include<numeric>

using namespace std;
using ll = long long;
constexpr int mo = 1e9+7;
constexpr int  mod = mo;
constexpr int inf = 1<<30;
string str;
int main(){
    cin>>str;
    vector<string> s;
    int n = (int)str.size();
    if(n == 1){cout << 1 << endl;return 0;}
    if(n == 2){
        if(str[0] == str[1])cout << 1 << endl;
        else cout << 2 << endl;
        return 0;
    }
    
    s.push_back(str.substr(0,1));
    for(int i=1;i<n;++i){
            if(s.back() == str.substr(i,1)){
                if(i != n-1)s.push_back(str.substr(i,2));
                else s.back() = s.back() + str.substr(i,1);
                i++;
            }else s.push_back(str.substr(i,1));
    }
    cout << s.size() << endl;
    return 0;
}



Measured memory_bytes: 10996
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define len(v) ll(v.size())
#define fi first
#define se second

template <class T>
void cout_vec(const vector<T> &vec){
  for(auto itr:vec) cout<<itr<<' ';
  cout<<endl;
}

typedef pair<ll,ll> P;
const ll mod=1e9+7;
const ll inf=1e15;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n,l,ind;
  cin>>n>>l;
  vector<ll> a(n),ans;
  ll sum=0;
  rep(i,n) cin>>a[i];
  bool flag=false;
  rep(i,n-1){
    if(a[i]+a[i+1]>=l){
      ind=i+1;
      flag=true;
    }
  }
  if(!flag){
    cout<<"Impossible"<<endl;
    return 0;
  }
  FOR(i,1,ind) ans.push_back(i);
  for(ll i=n-1;i>=ind+1;i--) ans.push_back(i);
  ans.push_back(ind);
  cout<<"Possible"<<endl;
  cout_vec(ans);
}

Measured memory_bytes: 2548
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);

		int n = stdIn.nextInt();

		for (int i = 1; i < 10; i++) {
			if (n % i == 0) {
				if (n / i < 10) {
					System.out.println("Yes");
					return;
				}
			}
		}

		System.out.println("No");
		return;
	}
}

Measured memory_bytes: 21844
package main

import (
  "fmt"
)

func main(){
  var N, ans int
  fmt.Scan(&N)
  
  for i := 1; i<=N; i++ {
    for j := 1; j<=N; j++ {
      for k := 1; k<=N; k++ {
        ans += gcd(i,gcd(j,k))
      }
    }
  }
  fmt.Println(ans)    
}

func gcd(a,b int) int {
  if b==0 {
    return a
  }
  return gcd(b,a%b)
}


Measured memory_bytes: 1776
object Main {
  def main (args: Array[String]) {
    var count:Int = 0
    for(line <- scala.io.Source.stdin.getLines() if line != "0 0"){
        val a = line.split(" ").map(_.toInt).sorted(Ordering[Int]);
        println(a(0) + " " + a(1));
    }
  }
}

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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<int, int> Pi;
typedef vector<ll> Vec;
typedef vector<int> Vi;
typedef vector<string> Vs;
typedef vector<P> VP;
typedef vector<vector<ll>> VV;
typedef vector<vector<int>> VVi;

#define REP(i, a, b) for(ll i=(a); i<(b); i++)
#define PER(i, a, b) for(ll i=(a); i>=(b); i--)
#define rep(i, n) REP(i, 0, n)
#define per(i, n) PER(i, n, 0)
const ll INF=1e18+18;
const ll MAX=100005;
const ll MOD=1000000007;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl;
#define YES(n) cout << ((n) ? "YES" : "NO") << endl;
#define ALL(v) v.begin(), v.end()
#define rALL(v) v.rbegin(), v.rend()
#define pb(x) push_back(x)
#define mp(a, b) make_pair(a,b)
#define Each(a,b) for(auto &a :b)
#define REPM(i, mp) for (auto i = mp.begin(); i != mp.end(); ++i)
#define dbg(x_) cerr << #x_ << ":" << x_ << endl;
#define dbgmap(mp) cerr << #mp << ":"<<endl; for (auto i = mp.begin(); i != mp.end(); ++i) { cerr << i->first <<":"<<i->second << endl;}
#define dbgarr(n,m,arr) rep(i,n){rep(j,m){cerr<<arr[i][j]<<" ";}cerr<<endl;}
#define dbgdp(n,arr) rep(i,n){cerr<<arr[i]<<" ";}cerr<<endl;
#define Uniq(v) v.erase(unique(v.begin(), v.end()), v.end())
#define fi first
#define se second

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

template<typename T1, typename T2>
ostream &operator<<(ostream &s, const pair<T1, T2> &p) { return s<<"("<<p.first<<", "<<p.second<<")"; }

// vector
template<typename T>
ostream &operator<<(ostream &s, const vector<T> &v) {
    int len=v.size();
    for(int i=0; i<len; ++i) {
        s<<v[i];
        if(i<len-1) s<<"	";
    }
    return s;
}

// 2 dimentional vector
template<typename T>
ostream &operator<<(ostream &s, const vector<vector<T> > &vv) {
    int len=vv.size();
    for(int i=0; i<len; ++i) {
        s<<vv[i]<<endl;
    }
    return s;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<std::setprecision(10);

    int h,w,d;
    cin>>h>>w>>d;
    VVi g(h,Vi(w,0));

    rep(i,h){
        rep(j,w){
            cin>>g[i][j];
            g[i][j]--;
        }
    }

    vector<vector<Pi>> id(d,vector<Pi>(h*w/d+1,mp(0,0)));
    vector<vector<int>> dd(d,Vi(h*w/d+1,0));

    //id[]
    rep(i,h){
        rep(j,w){
            id[g[i][j]%d][g[i][j]/d] = mp(i,j);
        }
    }

    rep(i,id.size()){
        rep(j,id[i].size()){
            if(j==0){
                dd[i][j]=0;
            }else{
                dd[i][j] = abs(id[i][j].fi-id[i][j-1].fi)+abs(id[i][j].se-id[i][j-1].se)+dd[i][j-1];
            }
        }
    }
    ll q;
    cin>>q;

    dbg(dd);

    while(q--){
        ll l,r;
        cin>>l>>r;
        l--;r--;
        ll ans= dd[r%d][r/d]-dd[l%d][l/d];
//        dbg(dd[r%d][r/d])
//        dbg(dd[l%d][l/d])
        cout<<ans<<endl;
    }

    return  0;
}


Measured memory_bytes: 10624
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
INF = float("inf")


def main():
    S = input()
    T = input()

    ans_list = []

    for i in range(len(S) - len(T) + 1):
        ok = True
        s = list(S[:])
        for j in range(len(T)):
            if S[i + j] == "?" or S[i + j] == T[j]:
                s[i + j] = T[j]
            else:
                ok = False
        if ok:
            ans_list.append("".join(s).replace("?", "a"))

    if len(ans_list) == 0:
        print("UNRESTORABLE")
    else:
        print(sorted(ans_list)[0])


if __name__ == '__main__':
    main()


Measured memory_bytes: 3316
#include<stdio.h>

int combi(int n,int r){
    if(r < 0){
        return 0;
    }else if (r == 0){
        return 1;
    }
    return (n - r + 1) * combi(n,r - 1)/r;
}

int main(void){

    int N,M,ans = 0,N_pair,M_pair;

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

    N_pair = combi(N,2);
    M_pair = combi(M,2);
    
    ans = N_pair + M_pair;
    printf("%d\n",ans);
    return 0;
}

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

int main() {
  int x;
  cin >> x;
  int a=1;
  for (int i=2;i*i<=x;i++){
    int t=i*i;
    while (t<=x) {
      a=max(a,t);
      t*=i;
    }
  }
  cout << a << endl;
}


Measured memory_bytes: 256
DIV = 1_000_000_007
n = gets.to_i
l = n.times.map{ gets.chomp }
l.delete('-')
s = l.size
u = l.count('U')
dp = (s+1).times.map{ [0]*(s+1) }
dp[0][0] = 1
pos = 0
cnt = 0
pre = true
for i in (0...s)
  pos += 1 if pre
  if l[i] == 'U'
    pre = true
    cnt += 1
  else
    pre = false
  end
  for j in (0..i+1)
    dp[i+1][j] = dp[i][j-1]*(pos-j) if j > 0 
    dp[i+1][j] += dp[i][j]*(cnt-j) if j < i+1
    dp[i+1][j] %= DIV
  end
end
p dp[s][u]

Measured memory_bytes: 9072
#include <stdio.h>

int main(void) {
  int i, n, x, now = 1;
  scanf("%d%d", &n, &x);
  if(x == 1 || x == 2 * n - 1) {
    printf("No");
    return 0;
  }
  int a[2 * n - 1];
  a[n - 1] = x, a[n - 2] = x - 1, a[n] = x + 1;
  for(i = 0; i < n - 2; ++i) {
    if(now == x - 1) now = x + 2;
    a[i] = now++;
  }
  for(i = n + 1; i < 2 * n - 1; ++i) {
    if(now == x - 1) now = x + 2;
    a[i] = now++;
  }
  printf("Yes\n");
  for(i = 0; i < 2 * n - 1; ++i) printf("%d\n", a[i]);
  return 0;
}

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

int main() {
	int N,K;
	while (cin >> N >> K, N!=0||K!=0) {
		int str[K];
		for (int i=0; i<K; i++) {
			cin >> str[i];
		}
		bool f = true;
		for (int i=0; i<N; i++) {
			for (int j=0; j<K; j++) {
				int tmp;
				cin >> tmp;
				str[j] -= tmp;
				if (str[j] < 0) f=false;
			}
		}
		cout << ((f) ? "Yes" : "No") << endl;
	}
	return 0;
}

Measured memory_bytes: 852
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main(){
ll n;
  cin>>n;
  ll arr[n];
  for(ll i=0;i<n;i++){
  cin>>arr[i];
  }
  ll s=0;
  for(ll i=0;i<n-1;i++){
  for(ll j=i+1;j<n;j++){
  s+=arr[i]*arr[j];
  }}
    cout<<s<<endl;
return 0;}

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

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

int main() {

    double L;
    cin >> L;
    L/=3;

    printf ("%.9lf\n", L*L*L );

    return 0;
}



Measured memory_bytes: 256
str1 = gets.split
N,K = str1[0].to_i, str1[1].to_i

a = []
for x in 0...20
  a[x] = 0
end

if N-K+1 >= 0
  a[0] = N-K+1
else
  a[0] = 0
end

b = 2
c = 1
for x in 1...20
  if N >= K/c-1 
    a[x] = (K-1)/c-1 - (K-1)/b + 1
  else
    a[x] = N+1 - ((K-1)/b+1)
  end
  if a[x] < 0
    a[x] = 0
  end
  b = b*2
  c = c*2
end

answer = 0.0
d = 1.0

for x in 0...20
  answer += a[x]*d/(N*1.0)
  d = d*0.5
end

puts answer

Measured memory_bytes: 1916
n = int(input())
ac = 0
wa = 0
tle = 0
re = 0
for i in range(n):
  s = input()
  if(s=="AC"):
    ac += 1
  elif(s=="WA"):
    wa += 1
  elif(s=="TLE"):
    tle += 1
  else:
    re += 1
print("AC x {}".format(ac))
print("WA x {}".format(wa))
print("TLE x {}".format(tle))
print("RE x {}".format(re))

Measured memory_bytes: 9208
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
using namespace std;

#define pb push_back

struct Vector {
  int x, y;
  Vector() {}
  Vector(int x, int y) : x(x), y(y) {}
  
  double norm() {
    return x*x + y*y;
  }
  
  double abs() {
    return sqrt(x*x + y*y);
  }
};

typedef vector<Vector> vv;

Vector rotate90R(Vector v) {
  return Vector(-v.y, v.x);
}

int lcm(int a, int b) {
  return (a*b)/__gcd(a, b);
}

bool isEqVecs(vv vv1, vv vv2) {
  int a, b, l;
  l = lcm(vv1[0].norm(), vv2[0].norm());
  a = l / vv1[0].norm(); // テ・ツ?催ァツ篠?
  b = l / vv2[0].norm();
  
  if(vv1.size() != vv2.size()) return false; // テ」ツδ凖」ツつッテ」ツδ暗」ツδォテ」ツ?ョテヲツ閉ーテ」ツ?古ァツ閉ーテ」ツ?ェテ」ツつ?
  
  bool isok = true;
  // テヲツッツ氾ァツ篠?」ツ?古ッツシツ敕」ツ?凝ィツェツソテ」ツ?ケテ」ツつ?
  for(int i=0; i<vv1.size(); i++) {
    if(!(vv1[i].x * a == vv2[i].x * b
	 && vv1[i].y * a == vv2[i].y * b)) isok = false;
  }
  
  return isok;
}

int main() {
  int n;
  
  // input data
  while(cin >> n && n) {
    vv vvec[51][8];
    int id2m[51];
    Vector data[51];

    for(int id=0; id<=n; id++) {
      cin >> id2m[id];
      for(int j=0; j<id2m[id]; j++) {
	cin >> data[j].x >> data[j].y;
      }
      
      for(int j=1; j<id2m[id]; j++) {
	Vector V1(data[j].x-data[j-1].x, data[j].y-data[j-1].y);
	Vector V2(-(data[id2m[id]-1-j].x-data[id2m[id]-j].x), -(data[id2m[id]-1-j].y-data[id2m[id]-j].y));
	vvec[id][0].pb(V1);
	vvec[id][1].pb(rotate90R(vvec[id][0][j-1]));
	vvec[id][2].pb(rotate90R(vvec[id][1][j-1]));
	vvec[id][3].pb(rotate90R(vvec[id][2][j-1]));
	
	vvec[id][4].pb(V2);
	vvec[id][5].pb(rotate90R(vvec[id][4][j-1]));
	vvec[id][6].pb(rotate90R(vvec[id][5][j-1]));
	vvec[id][7].pb(rotate90R(vvec[id][6][j-1]));
      }
      
      /*
	for(int k=0; k<4; k++) {
	for(int v_i=0; v_i<id2m[id]-1; v_i++) {
	cout << vvec[id][k][v_i].x << ' ' << vvec[id][k][v_i].y << endl;
	}
	}
      */
    }
    
    for(int i=1; i<=n; i++) {
      // Obj(id = 0) テ」ツ?ィ Obj(for all except id = 0) * 8 テ」ツ?ィテ」ツ?ョテ、ツクツ?ィツ?エテ」ツつ津ィツェツソテ」ツ?ケテ」ツつ?
      for(int k=0; k<8; k++) {
	if(isEqVecs(vvec[i][k], vvec[0][0])) {
	  cout << i << endl;
	}
      }
    }
    cout << "+++++" << endl;
  }
    
  return 0;
}

Measured memory_bytes: 1272
import java.math.BigDecimal;
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	MyScanner sc = new MyScanner();
	Scanner sc2 = new Scanner(System.in);
	int mod = 1000000007;

	void run() {
		int N = sc.nextInt();
		while (N-- > 0) {
			String hex = sc.next();
			String binary = "";
			for (int i = 0; i < 8; i++) {
				int h = 0;
				String tb = "";
				if (Character.isDigit(hex.charAt(i))) {
					h = Integer.valueOf(hex.charAt(i) - '0');
					tb = Integer.toBinaryString(h);
				} else {
					String hoge = "" + hex.charAt(i);
					h = Integer.parseInt(hoge, 16);
					tb = Integer.toBinaryString(h);
				}
				while (tb.length() < 4) {
					tb = "0" + tb;
				}
				binary += tb;
			}
			long integer = 0;
			int index = 0;
			for (int i = 24; i >= 1; i--) {
				int col = (binary.charAt(i) - '0');
				integer += col * Math.pow(2, index);
				index++;
			}
			double small = 0;
			index = 1;
			for (int i = 25; i < 32; i++) {
				int col = (binary.charAt(i) - '0');
				small += col * Math.pow(0.5, index);
				index++;
			}
			BigDecimal bd1 = new BigDecimal(integer + "");
			BigDecimal bd2 = new BigDecimal(small + "");
			System.out.println((binary.charAt(0) == '1' ? "-" : "")
					+ (bd1.add(bd2)));
		}
	}

	public static void main(String[] args) {
		new Main().run();
	}

	void debug(Object... o) {
		System.out.println(Arrays.deepToString(o));
	}

	void debug2(int[][] array) {
		for (int i = 0; i < array.length; i++) {
			for (int j = 0; j < array[i].length; j++) {
				System.out.print(array[i][j]);
			}
			System.out.println();
		}
	}

	class MyScanner {
		int nextInt() {
			try {
				int c = System.in.read();
				while (c != '-' && (c < '0' || '9' < c))
					c = System.in.read();
				if (c == '-')
					return -nextInt();
				int res = 0;
				do {
					res *= 10;
					res += c - '0';
					c = System.in.read();
				} while ('0' <= c && c <= '9');
				return res;
			} catch (Exception e) {
				return -1;
			}
		}

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

		String next() {
			try {
				StringBuilder res = new StringBuilder("");
				int c = System.in.read();
				while (Character.isWhitespace(c))
					c = System.in.read();
				do {
					res.append((char) c);
				} while (!Character.isWhitespace(c = System.in.read()));
				return res.toString();
			} catch (Exception e) {
				return null;
			}
		}
	}
}

Measured memory_bytes: 76044
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;

typedef long long ll;
/* const ll INF = 1e9;
const ll MOD = 1e9+7;
const ll EPS = 1e-9; */

#define REP(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, m, n) for (ll i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
#define SIZE(x) ((ll)(x).size())

int main() {
  ll n;
  cin >> n;
  vector<vector<ll> > d(n, vector<ll>(2));
  REP(i, n) {
    cin >> d[i][0] >> d[i][1];
  }
  REP(i, n-2) {
    if (d[i][0] == d[i][1] && d[i+1][0] == d[i+1][1] && d[i+2][0] == d[i+2][1]) {
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
  return 0;
}


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

int main(){
    int n;
    cin >> n;
    vector<ll> height(n);
    rep(i,n){
        cin >> height.at(i);
    }
    int counter=0;
    bool flag = true;
    for(int i = 1;i < n;i++){
        if(height.at(i)>height.at(i-1)){
            counter = 0;
        }else if(height.at(i)+1<height.at(i-1)){
            flag = false;
            break;
        }else if(height.at(i)+1==height.at(i-1)){
            counter++;
            if(counter == 2){
                flag = false;
                break;
            }
        }
    }

    if(flag){
        cout << "Yes" << endl;
    }else{ 
        cout << "No" << endl;
    }
}


Measured memory_bytes: 4000
N = int(input())
S = input()
ans = [0]
ans[0] = S[1:].count('E')
for i in range(N-1):
    if S[i] == 'E' and S[i+1] == 'E':
        ans.append(ans[i] -1)
    if S[i] == 'E' and S[i+1] == 'W':
        ans.append(ans[i])
    if S[i] == 'W' and S[i+1] == 'E':
        ans.append(ans[i] )
    if S[i] == 'W' and S[i+1] == 'W':
        ans.append(ans[i] +1)
print(min(ans))
    


Measured memory_bytes: 15524
from collections import Counter
s = input()
c = Counter(s)
if len(s) == 1:
  print("YES")
elif len(s) == 2:
  if len(c) == 2:
    print("YES")
  else:
    print("NO")
else:
  if len(c) < 3:
    print("NO")
  else:
    if max(c["a"],c["b"],c["c"])-min(c["a"],c["b"],c["c"]) <= 1:
      print("YES")
    else:
      print("NO")

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

typedef long long ll;
typedef vector <ll> v_ll;
typedef vector <vector <ll> > vv_ll;
typedef vector < pair <ll,ll> > vp_ll;
typedef pair <ll,ll> p_ll;

bool TEST=false;
ll MOD = 1000000007;

void show(){if (TEST){cout << endl;}}
void show(string x){if (TEST){cout << x;}}
void show(string x,bool enter){
  if (TEST){if (enter) cout << "<#> " << x << endl;else cout << x;}
}
void show(ll x){if (TEST){cout << x;}}
void show(ll x,bool enter){
  if (TEST){if (enter) cout << "<#> " << x << endl;else cout << x;}
}
void show(p_ll p){
  if (TEST){cout << "{ ";show(p.first);cout << " ";show(p.second);cout << " }";}
}
void show(v_ll v){
  if (TEST){
    cout << "<begin> ";
    for (ll i=0;i<v.size();i++){show(v[i]); cout << " ";}cout <<"<end>"<< endl;
}}
void show(vv_ll v){
  if (TEST){
    cout << "//////////" << endl;
    for (ll i=0;i<v.size();i++){
      show(v[i]); cout << endl;
}}}
void show(vp_ll v){
  if (TEST){
    cout << "//////////" << endl;
    for (ll i=0;i<v.size();i++){
      show(v[i]); cout << endl;
}}}

ll mod(ll x){
  ll n=MOD;
  ll ret=x%n;
  if (ret<0)ret+=n;
  return ret;
}
void mod_self(ll &x){
  x=mod(x);
}
ll mod_inv(ll x){
  ll n=MOD;
  ll y = x,z = n-2, ret=1;
  y=mod(y);
  while (z>0){
    if(z%2==1) ret=mod(ret*y);
    y=mod(y*y);
    z/=2;
  }
  return ret;
}
ll mod_pow(ll x,ll a){
  ll y = x,z = a,ret=1;
  y=mod(y);
  if (z<0)z=-z;
  while (z>0){
    if(z%2==1) ret=mod(ret*y);
    y=mod(y*y);
    z/=2;
  }
  if (a<0) ret=mod_inv(ret);
  return ret;
}
v_ll mod_nck(ll n){
  v_ll nck(n+1,0);
  nck[0]=1;
  for (ll i=1;i<=n;i++){
    nck[i]=mod(nck[i-1]*(n+1-i));
    nck[i]=mod(nck[i]*mod_inv(i));
  }
  return nck;
}
v_ll mod_factorial(ll n){
  v_ll fct(n+1,0);
  fct[0]=1;
  for (ll i=1;i<=n;i++){
    fct[i]=mod(fct[i-1]*i);
  }
  return fct;
}

ll N;
v_ll A;
int main(){
  cin >> N;
  A.assign(N+10,0);
  ll ans=0;
  for (ll i=1;i<=N;i++){
    cin >> A[i];
  }
  for (ll i=2;i<=N-1;i++){
    if (A[i]>A[i-1] && A[i]<A[i+1]) ans++;
    if (A[i]<A[i-1] && A[i]>A[i+1]) ans++;
  }
  cout << ans << endl;
}


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

int main() {
  int N, K;
  cin >> N >> K;
  vector<bool> have(N, false);
  for (int i = 0; i < K; i++) {
    int d;
    cin >> d;
    for (int j = 0; j < d; j++) {
      int a;
      cin >> a;
      have.at(a - 1) = true;
    }
  }
  int total = 0;
  for (int i = 0; i < N; i++) {
    if(!have.at(i)) {
      total += 1;
    }
  }
  cout << total << endl;
}

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

using namespace std;

const int N = 2e5 + 3;
const int M = 1e6 + 6;
const long long MOD = 1e9 + 7;
const long long INF = 1e18 + 7;
const int SM = 1e3 + 7;
const double EPS = 3e-16;

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0), cout.tie(0);
	int n; cin >> n;
	
	if(n > 81) return cout << "No", 0;
	
	for(int i = 1; i <= n; i++){
		if(i <= 9 && (n / i) <= 9 && n % i == 0){
			return cout << "Yes", 0;
		}
	}
	
	cout << "No";
	return 0;
}


Measured memory_bytes: 256
from collections import Counter

input()
a = list(map(int, input().split()))
c = Counter(a)
d = {i: (i * (i - 1)) // 2 for i in set(c.values())}
s = sum(d[i] for i in c.values())
for k in d:
    d[k] = s - d[k] + ((k - 1) * (k - 2) // 2)
d[1] = s
for i in a:
    print(d[c[i]])

Measured memory_bytes: 34080
program AGC034A
integer N,A,B,C,D
character(2*10**5) S
logical over,rock2,openspace
read*,N,A,B,C,D
read*,S
rock2=.false.
openspace=.false.
do i=A,C-1
    if(S(i:i+1)=="##")rock2=.true.
end do
do i=B,D-1
    if(S(i:i+1)=="##")rock2=.true.
end do
if(rock2)then
  print"(A)","No"
  stop
endif
do i=B-1,D-1
    if(S(i:i+2)=="...")openspace=.true.
end do
over=(C>D)
if(over)then
  if(.not.openspace)then
    print"(A)","No"
    stop
  endif
endif
print"(A)","Yes"
end

Measured memory_bytes: 1084
#include<iostream>
#include<string>
#include<vector>
#include<utility>
#include<algorithm>
#include<map>
#include<cstdlib>
#include<cmath>
#include<numeric>
#include<iomanip>
#include<functional>
#include<cstdlib>
#include<queue>
#include<deque>
const double PI = acos(-1);
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;
using ll =long long;
const int mod = 1000000007;

//map<string>a
class mint {
	long long x;
public:
	mint(long long x = 0) : x((x% mod + mod) % mod) {}
	mint operator-() const {
		return mint(-x);
	}
	mint& operator+=(const mint & a) {
		if ((x += a.x) >= mod) x -= mod;
		return *this;
	}
	mint & operator-=(const mint & a) {
		if ((x += mod - a.x) >= mod) x -= mod;
		return *this;
	}
	mint & operator*=(const  mint & a) {
		(x *= a.x) %= mod;
		return *this;
	}
	mint operator+(const mint & a) const {
		mint res(*this);
		return res += a;
	}
	mint operator-(const mint & a) const {
		mint res(*this);
		return res -= a;
	}
	mint operator*(const mint & a) const {
		mint res(*this);
		return res *= a;
	}
	mint pow(ll t) const {
		if (!t) return 1;
		mint a = pow(t >> 1);
		a *= a;
		if (t & 1) a *= *this;
		return a;
	}
	// for prime mod
	mint inv() const {
		return pow(mod - 2);
	}
	mint& operator/=(const mint & a) {
		return (*this) *= a.inv();
	}
	mint operator/(const mint & a) const {
		mint res(*this);
		return res /= a;
	}

	friend ostream& operator<<(ostream & os, const mint & m) {
		os << m.x;
		return os;
	}
};
int ctoi(char c) {
	if (c >= '0' && c <= '9') {
		return c - '0';
	}
	return 0;
}
//組み合わせ
void recursive_comb(vector<int> indexes, int s, int rest, std::function<void(vector<int>)> f) {
	if (rest == 0) {
		f(indexes);
	}
	else {
		if (s < 0) return;
		recursive_comb(indexes, s - 1, rest, f);
		indexes[rest - 1] = s;
		recursive_comb(indexes, s - 1, rest - 1, f);
	}
}

// nCkの組み合わせに対して処理を実行する
void foreach_comb(int n, int k, std::function<void(vector<int>)> f) {
	vector<int>indexes(k);
	recursive_comb(indexes, n - 1, k, f);
}

ll gcd(ll a, ll b) {
	if (a % b == 0) {
		return b;
	}
	else {
		return gcd(b, a % b);
	}
}
ll lcm(ll a, ll b) {
	return a * b / gcd(a, b);
};
//fixed << setprecision(2)
int main() {
	int L, R, d;
	int ans=0;
	cin >> L >> R >> d;
	for (int i = L; i <= R; i++) {
		if (i % d == 0) {
			ans++;
		}

	}
	cout << ans;
}
	


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

namespace app01
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] line = Console.ReadLine().Split(' ');
            int X = int.Parse(line[0]);
            int A = int.Parse(line[1]);

            if(X < A)
            {
                Console.WriteLine("0");
            }
            else
            {
                Console.WriteLine("10");
            }
        }
    }
}


Measured memory_bytes: 13140
H, W = map(int, input().split())

grid = []
grid.append("."*(W+2))
for i in range(H):
    grid.append("."+input()+".")
grid.append("."*(W+2))

dx = [1, 0, -1, 0]
dy = [0, 1, 0, -1]

flag = True

for i in range(1, H+1):
    for j in range(1, W+1):
        if grid[i][j] == "#" and grid[i+dx[0]][j+dy[0]] == "#":
            pass
        elif grid[i][j] == "#" and grid[i+dx[1]][j+dy[1]] == "#":
            pass
        elif grid[i][j] == "#" and grid[i+dx[2]][j+dy[2]] == "#":
            pass
        elif grid[i][j] == "#" and grid[i+dx[3]][j+dy[3]] == "#":
            pass
        elif grid[i][j] == "#":
            flag = False

if flag:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3064
n=int(input())
s=[input()for i in range(n)]
m=int(input())
t=[input()for i in range(m)]
ans=[]
import collections
data=collections.Counter(s)
deta=collections.Counter(t)
for i,j in data.items():
    for k,l in deta.items():
        if i==k:
            ans.append(j-l)
        if i not in t:
            ans.append(j)
if max(ans)<0:
    print(0)
else:
    print(max(ans))

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

int main()
{
  char X, Y;

  cin >> X >> Y;

  if (X > Y) {
    cout << ">" << endl;
  } else if (X < Y) {
    cout << "<" << endl;
  } else {
    cout << "=" << endl;
  }
}


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

int main() {
    int N, X;
    cin >> N >> X;
    vector<int> L(N);
    for(int i = 0; i < N; i++){
        cin >> L.at(i);
    }
    int sum = 0;
    int count = 1;
    for(int i = 0; i < N; i++){
        sum += L.at(i);
        if(sum > X){
            break;
        }
        else{
            count++;
        }
    }
    cout << count << endl;
}


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


int main(){
    int N,T;
    cin >> N >> T;
    pair<int,int> A[N];
    for(int i=0;i<N;++i) cin >> A[i].first >> A[i].second;
    sort(A,A+N);
    int i=0;
    while(i < N && A[i].second > T){
        ++i;
    }
    if(i==N) cout << "TLE" << endl;
    else cout << A[i].first << endl;
}





Measured memory_bytes: 256
n = int(input())
l = input().split()
l_i = [int(j) for j in l]

min = l_i[0]
count = 0
flag = True

while True:
    for i in range(n):
        if l_i[i] % 2 == 0:
            l_i[i] = l_i[i] / 2
        else :
            flag = False
    if flag:
        count += 1
    else:
        break

print(count)


Measured memory_bytes: 3060
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main()
{
    int n;
    while(~scanf("%d",&n))
    {
        if(n%2==0)
            printf("%d\n",n);
        else
            printf("%d\n",2*n);
    }
    return 0;
}

Measured memory_bytes: 128
from math import log10
n = int(input())
ans = []
for i in range(1, int(n**0.5+1)):
    if n%i == 0:
      spt1 = i
      spt2 = n//i
      ans.append(max(spt1, spt2))
print(int(log10(min(ans)))+1)

Measured memory_bytes: 3188
#include <bits/stdc++.h>
#include<algorithm>
using namespace std;
#define ll long long 

int main() {
  int n;
  cin >> n;
  int a[n];
  for(int i = 0;i<n;i++){
    cin >> a[i];
  }
  ll mx = a[0];
  ll sum = 0; 
  for(int i = 1;i<n;i++){
    if(a[i] < mx){
      sum += mx-a[i];
    }else{
      mx = a[i];
    }
  }
  
  cout << sum;
}

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

int main()
{
    int X, Y, A, B, C;
    cin >> X >> Y >> A >> B >> C;
    vector<int> V(A + B + C);
    for (auto &x : V) cin >> x;
    sort(V.begin(), V.begin() + A);
    sort(V.begin() + A, V.end() - C);
    sort(V.end() - C, V.end());
    for (int i = 0; i < A - X; i++) V[i] = 0;
    for (int j = A; j < A + B - Y; j++) V[j] = 0;
    sort(V.rbegin(), V.rend());
    cout << accumulate(V.begin(), V.begin() + X + Y, 0LL) << "\n";
}


Measured memory_bytes: 1408
import java.util.Scanner;

class Main {
	public static void main(String[] args){
		
		Scanner sc = new Scanner(System.in);
		
		int a = sc.nextInt();
		int b = sc.nextInt();
		
		
		if(a < b){
			System.out.println("a < b");
		}

		else if(a > b){
			System.out.println("a > b");

		}

		else{
			System.out.println("a == b");
		}

		
	}
}


Measured memory_bytes: 26336
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<iostream>
using namespace std;
long long num[87];
int main(){
	int n;
	cin >> n;
	num[0]=2;
	num[1]=1;
	for(int i = 2; i <= n ; i++)
		num[i]=num[i-1]+num[i-2];
	printf ("%lld\n",num[n]);
	return 0;
}

Measured memory_bytes: 256
# m = int(input())
bi = {}
ans = []
count = 0
for i in range(3):
    l = list(map(int, input().split()))
    for j in range(1,3+1):
        count += 1
        bi[l[j-1]] = count


n = int(input())
for i in range(n):
    k = int(input())
    if k in bi:
        ans.append(bi[k])



if 5 in ans and 1 in ans and 9 in ans:
    print("Yes")
    exit()

if  3 in ans and 5 in ans and 7 in ans:
    print("Yes")
    exit()

count = 1
for i in range(3):
    if (count) in ans and (count+1) in ans and (count+2) in ans:
        print("Yes")
        exit()
    else:
        count += 3

count = 1
for i in range(1,4):
    if (count) in ans and (count+3) in ans and (count+6) in ans:
        print("Yes")
        exit()
    else:
        count += 1

print("No")


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
int main(){
	char s[110]={};
	cin>>s;
	int n=strlen(s);
	n--;
	bool k=true;
	for(int i=0;i<n/2;i++){
		if(s[i]!=s[n-i]){
			k=false;
		}
	}
	int p=(n-1)/2;
	//cout<<"n"<<n<<" P"<<p<<endl;
	for(int i=0;i<n/4;i++){
		if(s[i]!=s[p-i]){
			k=false;
		}
		//cout<<i<<" "<<p-i<<endl;
	}
	if(k){
		cout<<"Yes"<<endl;
	}else{
		cout<<"No"<<endl;
	}
}

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

int bfs(const vector<vector<bool>> &mapinfo, const pair<int, int> &start){
    queue<pair<int,int>> pos;
    pos.push(start);
    vector<vector<int>> dist(mapinfo.size(), vector<int>(mapinfo[0].size(), INT_MAX));
    dist[start.first][start.second] = 0;
    int dx[4] = {-1, 1, 0, 0};
    int dy[4] = {0, 0, -1, 1};
    int max_dist = 0;
    while(!pos.empty()){
        auto from = pos.front();
        pos.pop();
        for(int i=0; i<4; i++){
            auto to = make_pair(from.first+dy[i], from.second+dx[i]);
            if(to.first<0 || to.first>=mapinfo.size() || to.second<0 || to.second>=mapinfo[0].size()) continue;
            if(dist[to.first][to.second] != INT_MAX || mapinfo[to.first][to.second]==false) continue;
            pos.push(to);
            max_dist = dist[to.first][to.second] = dist[from.first][from.second] + 1;
        }
    }
    return max_dist;
}

int main(){
    int H, W; cin >> H >> W;
    vector<vector<bool>> mapinfo(H, vector<bool>(W, false));
    for(int i=0; i<H; i++){
        for(int j=0; j<W; j++){
            char s; cin >> s;
            if(s=='.') mapinfo[i][j] = true;
        }
    }

    int max = 0;
    for(int i=0; i<H; i++){
        for(int j=0; j<W; j++){
            if(mapinfo[i][j]==true){
                auto start = make_pair(i, j);
                max = std::max(max, bfs(mapinfo, start));
            }
        }
    }
    cout << max << endl;
}


Measured memory_bytes: 256