akhauriyash/Code-Regression huggingface dataset:
# 素因数分解
# http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=NTL_1_A&lang=ja

import math

n = int(input())
origin = n
ans = []

i = 2
while i <= math.sqrt(n):
    if n % i == 0:
        n //= i
        ans.append(str(i))
    else:
        i += 1

if n != 1:
    ans.append(str(n))

print(f'{origin}: {" ".join(ans)}')



Measured memory_bytes: 5676
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using vs = vector<string>;
using pll = pair<ll, ll>;
using vp = vector<pll>;
template<class T> using V = vector<T>;
template<class T> using VV = vector<vector<T> >;
#define rep(i, n) for(ll i = 0; i < (n); i++)
#define repb(i, n) for(ll i = (n)-1; i >= 0; i--)
#define repr(i, a, b) for(ll i = (a); i < (b); i++)
#define reprb(i, a, b) for(ll i = (a)-1; i >= (b); i--)
#define ALL(a) (a).begin(), (a).end()
#define SZ(x) ((ll)(x).size())
const ll MOD = 1000000007;
const ll INF = 100000000000000000LL;
inline ll GCD(ll a, ll b){ return b?GCD(b, a % b):a; }
inline ll LCM(ll a, ll b){ return a/GCD(a, b)*b; }
inline ll powint(unsigned long long x, ll y){ ll r=1; while(y){ if(y&1) r*=x; x*=x; y>>=1; } return r; }
inline ll powmod(ll x, ll y, ll m = MOD){ ll r=1; while(y){ if(y&1) r*=x; x*=x; r%=m; x%=m; y>>=1; } return r; }
template<class S, class T>inline bool chmax(S &a, const T &b){ if(a<b) { a=b; return 1; } return 0; }
template<class S, class T>inline bool chmin(S &a, const T &b){ if(b<a) { a=b; return 1; } return 0; }
#ifdef OJ_LOCAL
#include "dump.hpp"
#else
#define dump(...) ((void)0)
#endif

using ull = unsigned long long;
using vull = V<ull>;

bitset<64> even1;
bitset<64> atleast1;

void pr(V<bitset<64>>& a){
    rep(i, SZ(a)){
        cerr << a[i] << " \n"[i==SZ(a)-1];
    }
}

int main(){
    cin.tie(0); ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    ll n;
    cin >> n;
    vull a(n);
    vull ae(n, 0); // 見るビットを詰めたもの
    V<bitset<64>> aeb(n);
    rep(i, n){
        cin >> a[i];
        even1 ^= a[i];
        atleast1 |= a[i];
    }
    even1.flip();
    even1 &= atleast1;
    rep(i, n){
        ll c = 0;
        rep(j, 64){
            if(even1[j]){
                ae[i] += (((a[i] >> j) & 1) << c);
                c++;
            }
        }
        aeb[i] = ae[i];
    }
    // 掃き出し法
    int rank_ = 0;
    repb(b, 64){
        repr(i, rank_, n){
            if(aeb[i][b]){
                swap(aeb[i], aeb[rank_]);
                break;
            }
        }
        if(aeb[rank_][b]){
            repr(i, rank_+1, n){
                if(aeb[i][b]) aeb[i] ^= aeb[rank_];
            }
            rank_++;
        }
        if(rank_ >= n) break;
    }
    rep(i, n) dump(bitset<64>(a[i]));
    rep(i, n) dump(aeb[i]);
    ull ans = 0;
    rep(i, n){
        chmax(ans, ans ^ aeb[i].to_ullong());
    }
    dump(even1);
    ll ans2 = 0;
    {
        ll c = 0;
        rep(j, 64){
            if(even1[j]){
                ans2 += (((ans >> c) & 1) << j);
                dump(bitset<64>(ans2));
                c++;
            }
        }
    }
    ans2 <<= 1;
    {
        rep(j, 64){
            if(!even1[j] && atleast1[j]){
                ans2 += (1ll << j);
                dump(bitset<64>(ans2));
            }
        }
    }
    cout << ans2 << endl;
    return 0;
}

Measured memory_bytes: 2560
#include<algorithm>
#include<stdio.h>
#include<string.h>

using namespace std;

char str[500005];
int ar[500005];

int main() {
  scanf("%s", str);
  int l = strlen(str);
  for (int i = 0; i < l; i++) {
    if (str[i] == '<') {
      ar[i+1] = ar[i] + 1;
    }
  }
  for (int i = l-1; i >= 0; i--) {
    if (str[i] == '>') {
      ar[i] = max(ar[i], ar[i+1] + 1);
    }
  }
  long long int ans = 0;
  for (int i = 0; i <= l; i++) {
    ans += ar[i];
  }
  printf("%lld\n", ans);
  return 0;
}


Measured memory_bytes: 2560
import std.stdio, std.string, std.conv, std.math;

void main(){
    real x = 0, y = 0, rad = 90;
    while(true){
        auto line = readln.chomp.split(",");
        auto speed = line[0].to!int;
        if(speed == 0) break;
        x += cos(rad / 180 * PI) * speed;
        y += sin(rad / 180 * PI) * speed;
        rad -= line[1].to!int;
    }
    writeln(cast(int)x);
    writeln(cast(int)y);
}

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

using namespace std;

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    int d = 0;
    for (auto &v : a) {
        cin >> v;
        d = __gcd(d, v);
    }
    if (d != 1) {
        cout << "not coprime\n";
        return 0;
    }
    
    int N = int(1e6) + 1;
    vector<int> div(N);
    for (int i = 0; i < N; ++i) div[i] = i;
    
    for (int i = 2; i < N; ++i) if (div[i] == i) {
        for (int j = i + i; j < N; j += i)
            if (div[j] == j) div[j] = i;
    }

    vector<int> cnt(N, 0);
    for (auto &v : a) {
        int t = v;
        while (t > 1) {
            int f = div[t];
            ++cnt[f];
            while (t % f == 0) t /= f;
        }
    }

    for (int i = 2; i < N; ++i) if (cnt[i] > 1) {
        cout << "setwise coprime\n";
        return 0;
    }
    cout << "pairwise coprime\n";
    return 0;
}

Measured memory_bytes: 14808
#include <iostream>
#include <vector>
#include <stdio.h>
#include <queue>
using namespace std;
int n;
int main()
{
    //freopen("test.inp","r", stdin);
    cin >> n;
    int k = n % 10;
    if (k == 0 || k == 1 || k == 6 || k == 8)
        cout << "pon";
    else if (k == 3) cout << "bon";
    else cout <<"hon";
    return 0;
}


Measured memory_bytes: 3620
n,k = map(int,input().split())
s = input()
tmp = s[0]
cnt = 1
ans = 0
ss = []
res = [0]
sum = 0
if s[0] == '0':
    ss.append(0)

for i in range(1,n):
    if s[i] == tmp:
        cnt += 1
    else:
        tmp = s[i]
        ss.append(cnt)
        cnt = 1
ss.append(cnt)
if s[-1] == '0':
    ss.append(0)
ll = len(ss)
for i in range(ll):
    sum += ss[i]
    res.append(sum)

if ll//2 <= k:
    print(n)
else:
    for i in range(ll-k*2)[::2]:
        ans = max(ans, res[i+k*2+1]-res[i])
    print(ans)


Measured memory_bytes: 47412
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		final int N = sc.nextInt();
		final int T = sc.nextInt();
		int[] t = new int[N];
		for(int i=0; i<N; i++){
			t[i] = sc.nextInt();
		}
		sc.close();
		
		int ans = 0;
		for(int i=1; i<N; i++){
			ans += Math.min(t[i]-t[i-1], T);
		}
		ans += T;

		System.out.println(ans);

	}

}

Measured memory_bytes: 63584
using System;
using System.Collections.Generic;
using System.Linq;
class Ho{
  static void Main(){
   var zen = Console.ReadLine().Split();
    var a = int.Parse(zen[0]);
    var b = int.Parse(zen[1]);
    if(b > a) {
     Console.WriteLine("1");
      return;
    }
    var c = 1;
    for(var i = 1;;i++){
      c = c*b;
      if(c > a){
        Console.WriteLine(i);
        break;
      }
    }
  }
}

Measured memory_bytes: 11092
#include <iostream>
  #include <complex>
  #include <vector>
  #include <string>
  #include <algorithm>
  #include <cstdio>
  #include <numeric>
  #include <cstring>
  #include <ctime>
  #include <cstdlib>
  #include <set>
  #include <map>
  #include <unordered_map>
  #include <unordered_set>
  #include <list>
  #include <cmath>
  #include <bitset>
  #include <cassert>
  #include <queue>
  #include <stack>
  #include <deque>
 #include <iomanip>

  using namespace std;
   

//abcdefghijklmnopqrstuvwxyz
//ABCDEFGHIJKLMNOPQRSTUVWXYZ
  typedef long long ll;
  typedef long double lld;
  typedef string str;
  typedef unsigned long long ull;
  ll INF = INT_MAX;
  // ll mod = 998244353;
  lld PI = 3.141592653;

// const int N = 2e5 + 5;

// int a[N];
// int n,k;



// void solve(){

// string s;
// cin>>s;


// }
 

  int main()
  {
      ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    
      
     
      string a,b;
      cin>>a;
      cin>>b;
      int n = 0;
      for (int i = 0;i<a.length();i++){
        if (a[i]!=b[i]) n++;
      }
      cout<<n<<endl;
}



Measured memory_bytes: 3560
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

N, M = map(int, input().split())
k = [[] for _ in range(N)]
flst = [list([0] * 2) for _ in range(M)]

for i in range(M):
    a, b = map(int, input().split())
    k[b - 1].append(a - 1)
    k[a - 1].append(b - 1)
    flst[i][0] = a
    flst[i][1] = b

d = [0] * N
def dfs(v):
    d[v] = 1
    for i in range(len(k[v])):
        if d[k[v][i]] == 0:
            dfs(k[v][i])
    return
ans = 0
for i in range(M):
    tmp1 = k[flst[i][0] - 1].index(flst[i][1] - 1)
    tmp2 = k[flst[i][1] - 1].index(flst[i][0] - 1)
    k[flst[i][0] - 1].pop(tmp1)
    k[flst[i][1] - 1].pop(tmp2)
    dfs(0)
    if sum(d) != N:
        ans += 1

    d = [0] * N
    k[flst[i][0] - 1].append(flst[i][1] - 1)
    k[flst[i][1] - 1].append(flst[i][0] - 1)

print(ans)

Measured memory_bytes: 3064
#include<cstdio>  
#include<iostream>  
#include<algorithm>  
#include<cstdlib>  
#include<cstring>
#include<string>
#include<climits>
#include<vector>
#include<cmath>
#include<map>
#include<set>
#include<queue>
#include<ctime>
#define LL long long
#define inf 0x3f3f3f3f

using namespace std;
  
inline char nc(){
    /* 
  static char buf[100000],*p1=buf,*p2=buf;
  if (p1==p2) { p2=(p1=buf)+fread(buf,1,100000,stdin); if (p1==p2) return EOF; }
  return *p1++;
    */return getchar();
}
  
inline void read(int &x){
  char c=nc();int b=1;
  for (;!(c>='0' && c<='9');c=nc()) if (c=='-') b=-1;
  for (x=0;c>='0' && c<='9';x=x*10+c-'0',c=nc()); x*=b;
}
  
inline void read(LL &x){
  char c=nc();LL b=1;
  for (;!(c>='0' && c<='9');c=nc()) if (c=='-') b=-1;
  for (x=0;c>='0' && c<='9';x=x*10+c-'0',c=nc()); x*=b;
}
 
inline int read(char *s)
{
    char c=nc();int len=1;
    for(;!(c>='a' && c<='z'||c>='A' && c<='Z');c=nc()) if (c==EOF) return 0;
    for(;(c>='a' && c<='z'||c>='A' && c<='Z');s[len++]=c,c=nc());
    s[len++]='\0';
    return len-2;
}
 
inline void read(char &x){
  for (x=nc();!(x>='a' && x<='z');x=nc());
}
 
int wt,ss[19];
inline void print(int x){
    if (x<0) x=-x,putchar('-'); 
    if (!x) putchar(48); else {
    for (wt=0;x;ss[++wt]=x%10,x/=10);
    for (;wt;putchar(ss[wt]+48),wt--);}
}
inline void print(LL x){
    if (x<0) x=-x,putchar('-');
    if (!x) putchar(48); else {for (wt=0;x;ss[++wt]=x%10,x/=10);for (;wt;putchar(ss[wt]+48),wt--);}
}

int n,m,a[100010],b[100010];

bool cmp1(int x,int y){return x>y;}
bool cmp2(int x,int y){return x<y;}

int main()
{
    read(n);read(m);
    int A=0,B=0,x;
    for (int i=1;i<=n;i++)
    {
        read(x);
        if (x<=0) a[++A]=x;
        else b[++B]=x;
    }
    sort(a+1,a+1+A,cmp1);
    sort(b+1,b+1+B,cmp2);
    int ans=-a[A]*2+b[B];
    for (int i=0;i<=A;i++)
    {
        if (i>m) break;
        if (m-i<=B) ans=min(ans,-a[i]*2+b[m-i]),ans=min(ans,-a[i]+b[m-i]*2);
    }
    print(ans),puts("");
    return 0;
}

Measured memory_bytes: 640
/*Template by hemnath_d(Enlightened by chamow)*/
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define vec vector<ll>
#define pll pair<ll,ll>
#define fastread ios_base::sync_with_stdio(false); cin.tie(NULL);
#define pb push_back
#define mp make_pair
#define fx first
#define sx second
#define inf 100000000000000
#define minf -100000000000000
#define maxi 100005
ll n,arr[21][21],dp[21][1<<21];
ll mod=1e9+7;
int solve(int pos,int val)
{
	if(pos==n)return 1;
	if(dp[pos][val]!=-1)
		return dp[pos][val];
	int ans=0;
	for(int i=0;i<n;i++)
	{
		if((val&(1<<i))==0&&arr[pos][i]==1)
		{
			ans+=solve(pos+1,val|(1<<i));
			ans=ans%mod;
		}
	}
	dp[pos][val]=ans;
	return ans;
}
int main()
{
    fastread;
    cin>>n;
    for(int i=0;i<21;i++)
    	for(int j=0;j<(1<<21);j++)
    		dp[i][j]=-1;
    for(int i=0;i<n;i++)
    	for(int j=0;j<n;j++)
    		cin>>arr[i][j];
    cout<<solve(0,0)<<endl;
    return 0;
}

Measured memory_bytes: 344320
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn rec(s: &str, c: &str, n: usize) -> usize {
    if s.len() <= 1 {
        if s == c {
            return n;
        } else {
            return n + 1;
        }
    }
    for i in 1..s.len() {
        if &s[..i] != c {
            return rec(&s[i..], &s[..i], n + 1);
        }
    }
    if s == c {
        return n;
    } else {
        return n + 1;
    }
}

fn main() {
    input! {
        s: String,
    }
    println!("{}", rec(&s[1..], &s[0..1], 1));
}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
 
 
int main()
{
  int n;
  cin >> n;
  vector<int> l(n);
  rep(i, n) cin >> l[i];
 
  sort(l.begin(), l.end());
 
  int ans = 0;
 
  for (int i = 0; i < n;i++){
    for (int j = i + 1; j < n;j++){
      for (int k = j + 1; k < n; k++)
      {
        if(l[i]==l[j] || l[j]==l[k])
          continue;
        if (l[i] + l[j] > l[k])
          ans++;
      }
    }
  }
 
    cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3636
# include <bits/stdc++.h>
# define rep(i, n) for(ll i = 0; i < (n); ++i)
# define reps(i, n) for(ll i=1, i##_len=(n); i<=i##_len; ++i)
# define rrep(i, n) for(ll i=((int)(n)-1); i>=0; --i)
# define rreps(i, n) for(ll i=((int)(n)); i>0; --i)
# define ll long long
# define ALL(x) (x).begin(), (x).end()
# define SZ(x) ((int)(x).size())
# define pb push_back
# define optimize_cin() cin.tie(0); ios::sync_with_stdio(false)
# define P pair<int, int>
# define mp make_pair
# define x first
# define y second
using namespace std;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

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

  int ans = 0;

  rep(i, 10){
    rep(j, 10){
      rep(k, 10){
        int tgt = i, num = 0;
        rep(a, n){
          if(s[a] - '0' == tgt){
            if(num==0) {
              num++;
              tgt = j;
            } else if(num ==1){
              num++;
              tgt = k;
            } else {
              ans++;
              break;
            }
          }
        }
      }
    }
  }

  cout << ans << endl;
}


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

typedef long long int LLI;

LLI X;

LLI f(LLI x) {
  int cnt = 0;
  while (x >= 3) {
    x = (x-1)/2;
    cnt++;
  }
  return cnt;
}

int main() {
  scanf("%lld", &X);
  LLI low = 2;
  LLI high = 1LL << 50;
  while (high - low > 1) {
    LLI mid = (high+low)/2;
    if (f(mid) <= X) low = mid;
    else high = mid;
  }
  printf("%lld\n", low);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (lli i = 0; i < (n); i++)
#define rrep(i, n) for (lli i = (n)-1; i >= 0; i--)
using namespace std;
using lli = long long int;
void YESNO(bool), YesNo(bool);
template <class T1, class T2>
bool chmin(T1 &l, const T2 &r);
template <class T1, class T2>
bool chmax(T1 &l, const T2 &r);
#define int long long int
lli su[200005] = {};
lli bi[200005] = {};
void solve(long long N, long long K, std::vector<long long> A)
{
  rep(i, N) A[i] %= K;
  map<lli, lli> s;
  rep(i, N) su[i + 1] = A[i] + su[i];
  rep(i, N + 1) bi[i] = ((su[i] - i) % K + K) % K;
  map<lli, lli> key;
  lli ans = 0;
  rep(i, N + 1)
  {
    ans += key[bi[i]];
    key[bi[i]]++;
    if (i >= K - 1)
      key[bi[i - K + 1]]--;
  }
  cout << ans << endl;
}

signed main()
{
  long long N;
  scanf("%lld", &N);
  long long K;
  scanf("%lld", &K);
  std::vector<long long> A(N);
  for (int i = 0; i < N; i++)
  {
    scanf("%lld", &A[i]);
  }
  solve(N, K, std::move(A));
  return 0;
}

// -- lib
void YESNO(bool b) { cout << (b ? "YES" : "NO") << endl; }
void YesNo(bool b) { cout << (b ? "Yes" : "No") << endl; }

template <class T1, class T2>
bool chmin(T1 &l, const T2 &r)
{
  return (l > r) ? (l = r, true) : false;
}

template <class T1, class T2>
bool chmax(T1 &l, const T2 &r)
{
  return (l < r) ? (l = r, true) : false;
}


Measured memory_bytes: 17408
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**13
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    n,k = LI()
    a = LI()
    ii = [2**i for i in range(41)]
    u = [a[0]]
    for c in a[1:]:
        u.append(c+u[-1])
    for i in range(n-1):
        for j in range(i+1,n):
            u.append(u[j]-u[i])

    r = 0
    for t in ii[::-1]:
        b = [c for c in u if c >= t]
        if len(b) >= k:
            r += t
            u = [c - t for c in b]
        else:
            u = [c - (c & t) for c in u]

    return r


print(main())


Measured memory_bytes: 121260
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define REP(i, n) rep(i, 0, n)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define int long long
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e12;

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, m;
    cin >> n >> m;
    int ans = min(n, m / 2);
    n -= ans;
    m -= 2 * ans;
    if(m > 0) ans += m / 4;
    cout << ans << endl;
}

Measured memory_bytes: 256
/*
  AOJ 1192
  Title:Tax Rate Changed
  @kankichi573
*/
#include <stdio.h>
int x,y,s;
main()
{
  int a,b,max_,new,s1;
  int a_,b_;
  while(scanf("%d %d %d",&x,&y,&s)  && (x||y||s))
    {
      for(a=1,max_=0;a<=s;a++)
	{
	  b=s*100/(100+x)-a;
	  if(b<=0)
	    continue;
	  while((s1=(100+x)*a/100+(100+x)*b/100) < s)
	    b++;
	  if(s1==s)
	    {
	      new=(100+y)*a/100+(100+y)*b/100;
	      if(max_<new)
		{
		  max_=new;
		  a_=a;
		  b_=b;
		}
	    }
	}
      printf("%d\n",max_);
      //printf("%d (%d %d)\n",max_,a_,b_);
    }
  return(0);
}

Measured memory_bytes: 600
l, r = map(int, input().split())

ans = 2020
if r - l >= 2019:
    r = l + 2018
for i in range(l, r):
    for j in range(i + 1, r + 1):
        tmp = i * j % 2019
        if ans > tmp:
            ans = tmp
    
print(ans)


Measured memory_bytes: 2940
#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
using namespace std;

typedef long long ll;

int main () {
	int N, Q;
	ll ans[100001];
	map<int,ll> mp;
	cin >> N;
	ans[0] = 0;
	for (int i=0; i<N; i++) {
		int a;
		cin >> a;
		mp[a] ++;
		ans[0] += a;
	}
	cin >> Q;
	for (int i=0; i<Q; i++) {
		int b, c;
		cin >> b >> c;
		ans[i+1] = ans[i] + mp[b]*(c-b);
		mp[c] += mp[b];
		mp[b] = 0;
	}
	for (int i=1; i<=Q; i++)
		cout << ans[i] << endl;

	return 0;
}

Measured memory_bytes: 10300
#include <bits/stdc++.h>
using namespace std;
int main()
{
int a,b,c;
cin >> a >> b >> c ;
if(a==b && b==c)
cout << 1 << endl;
else if(a==b || b==c || c==a)
cout << 2 << endl;
else 
cout << 3 << endl;

}

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

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

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

int main() {
    IN(int, n);
    IN(int, d);
    COUT((n+2*d)/(2*d+1));
}




Measured memory_bytes: 256
#include<bits/stdc++.h>
#define FOR0(i,n) for(ll i=0;i<n;i++)
#define FOR1(i,n) for(ll i=1;i<=n;i++)
#define FORl(i,l,n) for(ll i=l;i<n;i++)
using namespace std;
#define pi pair<ll,ll>
#define pb push_back
#define ll long long
#define ld long double
#define ff first
#define ss second
#define mp make_pair
#define mst0(x) memset(x,0,sizeof(x));
#define vi vector<ll>
#define sync ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl '\n'
#define sp <<" "<<
#define intmax 1e14

ll power(ll num,ll g,ll mod){
  if(g==0)return 1;
  if(g%2==1)return (num*power((num*num)%mod,g/2,mod))%mod;
  return power((num*num)%mod,g/2,mod);
}
 


int main() {

	// #ifndef ONLINE_JUDGE
	// 	freopen("input.txt", "r", stdin);
	//     freopen("output.txt", "w", stdout);
	// #endif

	int n, x;
	cin >> n >> x;
	if (n*500>=x) cout << "Yes";
	else cout << "No";


}
	




Measured memory_bytes: 256
#include <stdio.h>

int main(){
  int h, w;  scanf("%d %d", &h, &w);
  int field[55][55] = {0}, white = 0;
  for(int i=0; i<h; i++){
    char s[55];  scanf("%s", s);
    for(int j=0; j<w; j++)
      if(s[j] == '.'){
	field[i+1][j+1] = 1;
	white++;
      }
  }

  int d[] = {1, 0, -1, 0, 1};
  int queue[55*55][2] = {0}, front = 0, rear = 0, nowh, noww;
  queue[rear][0] = 1, queue[rear][1] = 1, rear++;
  int table[55][55] = {0};
  while(front != rear){
    nowh = queue[front][0], noww = queue[front][1], front++;
    for(int i=0; i<5; i++)
      if(field[nowh+d[i]][noww+d[i+1]] && !table[nowh+d[i]][noww+d[i+1]]){
	table[nowh+d[i]][noww+d[i+1]] = table[nowh][noww] + 1;
	queue[rear][0] = nowh+d[i], queue[rear][1] = noww+d[i+1], rear++;
      }
  }

  int ans;
  if(!table[h][w])  ans = -1;
  else              ans = white - table[h][w] - 1;

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

  return 0;
}


Measured memory_bytes: 1756
# 桁DP
n = int(input())
k = int(input())

def solve(num, k_):
    # 左から桁DP
    # dp[i-th number][is_max][how many not 0]
    n = len(str(num)) + 1
    dp = [[[0 for _ in range(k_+2)] for _ in range(2)] for _ in range(n)]
    dp[0][0][0] = 1

    for i in range(n-1):
        D = int(str(num)[i])
        for j in range(2):
            for k in range(k_+1):
                for d in range(10 if j else D+1):
                    if d == 0:
                        dp[i+1][j or (d < D)][k] += dp[i][j][k]
                    else:
                        dp[i+1][j or (d < D)][k+1] += dp[i][j][k]
    return dp[-1][0][k_] + dp[-1][1][k_]

print(solve(n, k))

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



//defines...
#define ll long long
#define tata return;
#define pb push_back
#define mp make_pair
#define in insert
#define run ios_base::sync_with_stdio(false);cin.tie(NULL);
#define yes cout<<"YES"<<endl;
#define no cout<<"NO"<<endl;
#define vec vector<ll>
#define setl set<ll>
#define mapl map<ll,ll>
#define shunno cout<<0<<endl;
#define pi 2*acos(0.0)1
#define hobena cout<<-1<<endl;




//typedefs...
typedef pair<ll,ll>pll;

//const..
const ll fx[]={0,1,0,-1};
const ll fy[]={1,0,-1,0};
const ll mod=1e9+7;

/*ll ncr(ll n, ll k)
{
    ll res = 1;


    if (k > n - k)
        k = n - k;

    for (int i = 0; i < k; ++i) {
        res *= (n - i);
        res /= (i + 1);
    }

    return res;
}
*/
//to remove suffix of a number from a set of string
/*
for(int k=1; k<j.size(); k++)
                if(temp.count(string(j.begin()+k,j.end())))
					temp.erase(string(j.begin()+k,j.end()));
 */

void oka()
{
   ll n,i,j;

   cin>>n;
   ll a[n];
   for(i=0;i<n;i++)
    cin>>a[i];
   sort(a,a+n);
   mapl m;
   vec v;
   for(i=0;i<n;i++)
   {
       m[a[i]]++;
       if(m[a[i]]%2==0)
            v.pb(a[i]);

   }
   for(i=0;i<v.size();i++)
    v[i]*=-1;
   if(v.size()<2)
   {
       shunno
       tata
   }
   sort(v.begin(),v.end());
    for(i=0;i<v.size();i++)
    v[i]*=-1;

   ll ans=1;
   for(i=0;i<2;i++)
    ans*=v[i];
   cout<<ans<<endl;





}
/*I'll paint it on the walls
     cause I'm the one at fault
    I'll never fight again and
         this is how it ends .*/






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

    run

    oka();




}

Measured memory_bytes: 10624
n,x=map(int,input().split())
arr=list(map(int,input().split()))
arr=sorted(arr)
for i in range(n):
  if x-arr[i]>=0:
    x-=arr[i]
  else:
    print(i)
    break
else:
  if x ==0:
    print(n)
  else:
    print(n-1)

Measured memory_bytes: 3064
#include <iostream>
#include <cmath>
#include <algorithm>

using namespace std;

int main() {
    int N;
    cin >> N;
    
    int h[N];
    long int dp[N];
    for(int i=0; i<N; i++) {
        cin >> h[i];
        dp[i]=0;
    }
    
    dp[1] = abs(h[0]-h[1]);
    
    for(int i=2; i<N; i++) {
        dp[i] = dp[i-2] + abs(h[i]-h[i-2]);
        dp[i] = min(dp[i], dp[i-1] + abs(h[i]-h[i-1]));
    }
    
    cout << dp[N-1] << endl;

    return 0;
    
}

Measured memory_bytes: 1408
#include<stdio.h>
 
int main()
{
  int i, j;
 
  scanf("%d",&i);
 
  for(j = 3; j <= i ; j++){
    //3????????°?????¨???
    if( (j / 10) % 10 == 3 || (j / 100) % 10 == 3 || (j / 1000) % 10 == 3){
       printf(" %d", j);
    }
    //13,23,33,...
    else if((j-3) % 10 == 0){
      printf(" %d", j);
    }
    //30,300,3000???????????????????????¨?????????
    else if(j % 3 == 0){
      printf(" %d", j);
    }
  }
  printf("\n");
  return 0;
}

Measured memory_bytes: 600
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<iostream>
#include<queue>
#include<vector>
#include <bitset>
#include <cmath>
#include <limits>
#include <iostream>
#include<set>
#include<tuple>
using namespace std;
#define INF 11000000000
#define MAX 100000
#define MOD 1000000007
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<pair<int,int>,int> p;
typedef pair< pair<int,int>, int> p; 
#define bit(n,k) ((n>>k)&1) /*nのk bit目*/
#define rad_to_deg(rad) (((rad)/2/M_PI)*360)


int main(){
    int N;
    cin>>N;
    vector<P> V(N);
    ll maxL=0,minR=1100000000,numL,numR,l=0;
    for(int i=0;i<N;i++){
        cin>>V[i].first>>V[i].second;
        if(V[i].first>maxL){
            numL=i;
            maxL=V[i].first;
        }
        if(V[i].second<minR){
            minR=V[i].second;
            numR=i;
        }
        if(l<V[i].second-V[i].first+1){
            l=V[i].second-V[i].first+1;
        }
    }
    ll ans=l+max(minR-maxL+1,0LL);
    if(numL==numR){
        cout<<ans<<endl;
        return 0;
    }
   ll R=V[numR].first,L=V[numL].second,r;
    l=L;
    V[numL].first=11000000000;
    V[numR].first=11000000000;
    sort(V.begin(),V.end(),greater<P>());
    for(int i=2;i<N;i++){
        r=max(R,V[i].first);
        //cout<<r<<" "<<l<<endl;
        ans=max(ans,max(minR-r+1,0LL) + max(l-maxL+1,0LL)  );
        l=min(l,V[i].second);
    }
    ans=max(ans,minR-R+1+max(l-maxL+1,0LL));
    cout<<ans<<endl;
}



Measured memory_bytes: 1792
N = int(input())
fact = 1
mod = 10**9 + 7

if N == 1:
    print(1)
    exit()

def primes(n):
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    return [i for i in range(n + 1) if is_prime[i]]


for i in range(1,N+1):
    fact *= i

s = 0
R = primes(N)
#print(R)
I = fact

soinsu = []
tmp = 1
cnt = 1
ans = 1
while s==0:
    for i in R:

        if I%i==0:
            I=I//i
            if I==1:
                s=1
#            soinsu.append(i)
            if i == tmp:
                cnt += 1
            else:
                ans *= (cnt + 1)
                ans %= mod
                cnt  = 1
                tmp = i
            break

#dic = collections.Counter(soinsu)
# ans = 1
# for v in dic.values():
#     ans *= v + 1
#     ans %= mod


print(ans)


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

#define DEBUG(x) cerr << #x << ": " << x << endl;
#define ll long long

int main() {
    int n;
    cin >> n;
    int a[26] = {0};
    string t;
    cin >> t;
    for (char c : t) {
        a[c-'a']++;
    }
    for (int i = 1; i < n; i++) {
        string s;
        cin >> s;
        for (int j = 0; j < 26; j++) {
            a[j] = min((int)a[j], (int)count(s.begin(), s.end(), j+'a'));
        }
    }

    string ans;
    for (int i = 0; i < 26; i++) {
        ans += string(a[i], i+'a');
    }
    sort(ans.begin(), ans.end());

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
import sys
readline = sys.stdin.buffer.readline
num = int(readline().rstrip())
arr = list(map(int,readline().rstrip().split()))
dic = {}
for i in arr:
    if i in dic:
        dic[i] +=1
    else:
        dic[i]=1
print(dic[1])
for j in range(2,num+1):
    if j in dic:
        print(dic[j])
    else:
        print('0')


Measured memory_bytes: 33900
#include<iostream>
#include<vector>

template<class weight_t=std::int_fast64_t>
struct weighted_uf{
  std::vector<int> par;
  std::vector<weight_t> diff_weight;
  weighted_uf(){}
  weighted_uf(int n):par(n,-1),diff_weight(n,0){}
  int root(int k){
    if(par[k]<0)return k;
    int r = root(par[k]);
    diff_weight[k] += diff_weight[par[k]];
    return par[k] = r;
  }
  int size(int k){
    return -par[root(k)];
  }
  bool same(int u,int v){
    return root(u)==root(v);
  }
  weight_t weight(int k){
    root(k);
    return diff_weight[k];
  }
  weight_t diff(int u,int v){
    return weight(v)-weight(u);
  }
  bool unite(int u,int v,weight_t w){
    w += weight(u);
    w -= weight(v);
    u = root(u);
    v = root(v);
    if(u==v)return false;
    if(size(u)<size(v))std::swap(u,v),w=-w;
    par[u] += par[v];
    par[v] = u;
    diff_weight[v] = w;
    return true;
  }
};

#include<tuple>

int main(){
  using namespace std;
  int n,m;
  cin>>n>>m;
  using T3 = tuple<int,int,int64_t>;
  vector<T3> lrd(m);
  for(int i=0;i<m;++i){
    int l,r;int64_t d;
    cin>>l>>r>>d;
    l--;r--;
    lrd[i] = {l,r,d};
  }

  weighted_uf uni(n);
  bool ok = true;
  for(auto&[l,r,d]:lrd){
    if(uni.same(l,r)){
      if(uni.diff(l,r)!=d)ok = false;
    }
    else uni.unite(l,r,d);
  }
  cout<<(ok?"Yes":"No")<<endl;
}

Measured memory_bytes: 7404
#include<iostream>
using namespace std;
const int oo=-0x2f2f;
int a[55][55];
char x;
int main()
{
	int n,m;
	cin>>n>>m;
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=m;j++)
		{
			cin>>x;
			if(x=='#')
			{
				a[i][j]=oo;
                a[i-1][j-1]++;
                a[i-1][j]++;
                a[i-1][j+1]++;
                a[i][j-1]++;
                a[i][j+1]++;
                a[i+1][j-1]++;
                a[i+1][j]++;
                a[i+1][j+1]++;
			}
		}
	}
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=m;j++)
		{
			if(a[i][j]<-10) cout<<"#";
			else cout<<a[i][j];
		}
		cout<<endl;
	}
	return 0;
}

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

using namespace std;

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

int main() {
    int N;
    int K;
    cin >> N >> K;
    int a[110];
    rep(i, N)cin >> a[i];
    int sum = 0;
    rep(i, N) {
        sum += min(abs( a[i]*2), abs(K - a[i])*2);
    }
    cout << sum << endl;
}

Measured memory_bytes: 256
#include <vector>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <stack>
#include <iterator>
#include <algorithm>
#include <cfenv>
#include <random>
#include <numeric>
#include <cmath>
#include <iosfwd>
#include <iostream>
#include <ios>
#include <streambuf>
#include <istream>
#include <ostream>
#include <iomanip>
#include <sstream>
#include <fstream>
#include <cstdlib>
#include<string>
#include <bitset>

#define SIZE 100001
typedef long long ll;
using namespace std;


int main(){
    ll a;
    cin >> a;
    cout << a+a*a+a*a*a << endl;
    return 0;
}

Measured memory_bytes: 3616
class Member():
	def __init__(self, mi):
		self.member_id	= int(mi)
		self.datalist = []
		
	def addData(self, pr, sn):
		self.datalist.append([int(pr), int(sn)])

	def calc(self):
		sum = 0
		for p, s in self.datalist:
			sum += p * s
		
		return sum
			

output_list = []
members = []
member_dict = {}

while 1:
	n = int(raw_input())
	if n == 0:
		break
	
	dataset = [raw_input() for i in range(n)]
	
	for item in dataset:
		rawlist = map(int, item.split())
		
		if rawlist[0] not in [mem.member_id for mem in members]:
			member_dict[rawlist[0]] = Member(rawlist[0])
			members.append( member_dict[rawlist[0]] )
		
		member_dict[rawlist[0]].addData(rawlist[1], rawlist[2])
		
	output_list_length = len(output_list)
	for mem in members:
		if mem.calc() >= 1000000:
			output_list.append(mem.member_id)
		
		if output_list_length == len(output_list):
			output_list.append("NA")
			
	members = []
	member_dict = {}
			

for s in output_list:
	print s

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

int main()
{
	int data[101] = {0};
	int n, max = 0;
	
	while (scanf("%d", &n) != EOF){
		data[n]++;
	}
	
	for (int i = 0; i < 101; i++){
		if (max < data[i]){
			max = data[i];
		}
	}
	
	for (int i = 0; i < 101; i++){
		if (max == data[i]){
			printf("%d\n", i);
		}
	}
	
	return (0);
}

Measured memory_bytes: 1024
#!python3

iim = lambda: map(int, input().rstrip().split())

from bisect import bisect_left

def resolve():
    N = int(input())
    #S = [list(iim()) for i in range(N)]
    MX = 10**9
    S = []
    for i in range(N):
        x, l = iim()
        i = x - l
        if i < 0:
            i = 0
        j = x + l
        if j > MX:
            j = MX

        a = [i, j]
        S.append(a)
    S.sort()

    ans = 0
    last = MX+1
    n = 1
    for x, y in S:
        if y < last:
            last = y
        elif last <= x:
            n += 1
            last = y

    print(n)






if __name__ == "__main__":
    resolve()


Measured memory_bytes: 20104
d,g = map(int, input().split())
g //= 100
p = [0]*d
c = [0]*d
for i in range(d):
  x,y = map(int, input().split())
  p[i] = x
  c[i] = y//100

ans = sum(p)
for bit in range(1<<d):
  t = -1
  cur = 0
  ret = 0
  for i in range(d):
    if bit & (1<<i):
      cur += p[i]*(i+1) + c[i]
      ret += p[i]
    else:
      t = i
  if cur >= g:
    if ans > ret:
      ans = ret
  else:
    h = (g-cur-1)//(t+1) + 1
    if h <= p[t]:
      ret += h
      if ret < ans:
        ans = ret
print(ans)

Measured memory_bytes: 3064
// Ryo Kamoi
// #define DEBUG

#include<iostream>
#include<math.h>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<queue>

using namespace std;

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

typedef pair<int, int> pii;
typedef long long ll;
typedef pair<ll, ll> pll;

int INF = 1000000000;

int n, m;
bool exist[210], used[210];
bool cur_used[210];
vector<pii> disap;
int cost[210][210];
int prim_cost[210];

int main(){
  while(1) {
    cin >> n >> m;
    if (n==0) break;

    disap = vector<pii>();
    REP(i, n) {
      exist[i] = false;
      used[i] = false;
    }

    REP(i, n) {
      REP(j, n) {
        cost[i][j] = INF;
      }
    }

    REP(i, n) {
      int h;
      cin >> h;
      disap.push_back(pii(h, i));
    }

    REP(i, m) {
      int a, b, c;
      cin >> a >> b >> c;
      cost[a-1][b-1] = c;
      cost[b-1][a-1] = c;
    }

    sort(disap.begin(), disap.end(), greater<pii>());

    int output = 0;
    REP(i, n) {
      exist[disap[i].second] = true;

      if (i==0) {
        used[disap[0].second] = true;
        continue;
      }

      if (i<n-1 && disap[i].first == disap[i+1].first) {
        continue;
      }

      REP(j, n) {
        cur_used[j] = used[j];
        prim_cost[j] = INF;
      }

      REP(j, n) {
        if (!exist[j]) continue;
        REP(k, n) {
          if (!cur_used[k]) continue;
          prim_cost[j] = min(prim_cost[j], cost[j][k]);
        }
      }

      int cur_cost = 0;
      while(true) {
        int v = -1;
        REP(j, n) {
          if(!cur_used[j] && prim_cost[j] < INF
             && (v==-1 || prim_cost[j] < prim_cost[v])) v = j;
        }
#ifdef DEBUG
        cout << v << " " << prim_cost[v] << " " << disap[i].second << endl;
#endif

        if (v==-1) break;
        cur_used[v] = true;
        cur_cost += prim_cost[v];

        REP(j, n) {
          if (exist[j]) {
            prim_cost[j] = min(prim_cost[j], cost[v][j]);
          }
        }
      }

      bool update = true;
      REP(j, n) {
        if (cur_used[j] != exist[j]) {
          update = false; break;
        }
      }
      
      if (!update) {
        REP(j, n) {
          used[j] = false;
        }
        used[disap[0].second] = true;
        output = 0;
        continue;
      }

      REP(j, n) {
        used[j] = cur_used[j];
      }
      output += cur_cost;
#ifdef DEBUG
      cout << output << " cost" << endl;
#endif
    }

    cout << output << endl;
  }
}



Measured memory_bytes: 3260
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <map>
#include <cstdio>
#include <string>
#include <cstdlib>
#include <cstring>
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
const long double EPS = 1e-9;
const ll mod = 1e9 + 7;
const ll INF = 1e9;

#define rep(i, n) for(ll i = 0; i < n ; i++ )
#define For(i, a, b) for(ll i = (a); i < (b) ; i++ )
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()

const ll MAX_N = 100000;

int main(void){
    ll N;
    ll A[MAX_N];
    ll f_half[MAX_N + 5], s_half[MAX_N + 5];
    
    cin >> N;
    rep(i, N) cin >> A[i];

    f_half[0] = 0;
    f_half[1] = abs(A[0]);
    s_half[0] = 0;
    s_half[1] = abs(A[N - 1]);
    For(i, 1, N){
        f_half[i + 1] = f_half[i] + abs(A[i] - A[i - 1]);
        s_half[i + 1] = s_half[i] + abs(A[N - i] - A[N - i - 1]);
    }

    cout << f_half[0] + s_half[N - 1] + abs(A[1] - 0) << endl;
    For(i, 1, N - 1) cout << f_half[i] + s_half[N - 1 - i] + abs(A[i + 1] - A[i - 1]) << endl;
    cout << f_half[N - 1] + s_half[0] + abs(0 - A[N - 2]) << endl;

    return 0;
}

Measured memory_bytes: 3584
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
string s,t;

int main(){
	ios::sync_with_stdio(false);
	cin>>s>>t;
	int i,ans=0;
	for(i=0;s[i]!=0;++i)
		if(s[i]!=t[i])
			++ans;
	cout<<ans;
	
	return 0;
}

Measured memory_bytes: 3864
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef set<int> si;
typedef pair<int,int> pii;
#define rep(i,a,b) for(int i=(a); i<(b); ++i)
#define per(i,a,b) for(int i=(b)-1; i>=(a); --i)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define F first
#define S second

int main(void) {
	ios_base::sync_with_stdio(false); cin.tie(0);
	//freopen("in.txt", "r", stdin);
	int n;
	cin >> n;
	vi a(n);
	rep(i,0,n) {
		cin >> a[i];
	}
	sort(a.rbegin(), a.rend());
	bool flag = true;
	int cnt = 0;
	vector<bool> b(n, false);
	rep(i,0,n) {
		b[a[i]] = true;
		if(i == 0 || a[i] == a[i-1]) {
			cnt++;
		} else {
			if(cnt == 1) {
				flag = false;
				break;
			}
			cnt = 1;
		}
	}
	rep(i,(a[0]+1)/2, a[0]) {
		flag = flag && b[i];
	}
	if((a[0]+1) % 2) {
		if(cnt != 1) flag = false;
	} else {
		if(cnt != 2) flag = false;
	}
	if(flag) {
		cout << "Possible" << '\n';
	} else {
		cout << "Impossible" << '\n';
	}
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long int
#define pb push_back
#define mp make_pair
#define f(i,x,n) for(ll i=x;i<n;i++)
#define fl(i,x,n) for(ll i=n;i>=x;i--)
#define mod (ll)1e9+7
#define print(x) cout<<x<<endl
#define vec vector<ll>
#define pai pair<ll, ll>
#define itr(it) :: iterator it
#define MAX (ll)1e16
#define MIN (ll)-1e16
#define X first
#define Y second
#define up upper_bound
#define lo lower_bound
using namespace std;
       ///////////   ///     ///   ///      ///   ////////////  ///      ///
       ///           ///     ///   ///      ///   ///      ///  ///      ///
       ///           ///     ///   ///      ///   ///      ///  ///      ///
       ///////////   ///////////   ///      ///   ////////////  ////////////
               ///   ///     ///   ///      ///   ///      ///  ///      ///
               ///   ///     ///   ///      ///   ///      ///  ///      ///
       ///////////   ///     ///   ////////////   ////////////  ///      ///
ll minn( ll a , ll b) 
{
    if(a>b)
        return b;
    return a;
}
ll maxx2( ll a , ll b)
{
    if(a>b)
        return a;
    return b;
}
ll maxx(ll a,ll b,ll c)
{
  return maxx2(a,maxx2(b,c));
}
ll gcdd(ll a, ll b)
{
    if(b==0)
        return a;
    else
        return gcdd(b,a%b);
}
ll dsum(ll n)
{
    ll sum=0;
    while(n>0)
    {
        sum+=n%10;
        n/=10;
    }
    return sum;
}
ll poww(ll a,ll b)
{
    if(b<=0)
        return 1;
    if(b==1)
        return a;
    if(b==2)
        return (a*a);
    else
        return poww(poww(a,b/2),2)*(poww(a,b%2));
}
ll sumsq(ll x,ll y,ll z)
{
    return (x-y)*(x-y)+(y-z)*(y-z)+(z-x)*(z-x);
} 
signed main() 
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    IOS;
    ll n,m,k;
    cin>>n>>m>>k;
    ll sum=0;
    vector<ll> s1,s2;
    ll a[n],b[m];
    s1.pb(0);
    s2.pb(0);
    f(i,0,n)
    {
        cin>>a[i];
        sum+=a[i];
        s1.pb(sum);
    }
    s1.pb(1000000000000000000);
    sum=0;
    f(i,0,m)
    {
        cin>>b[i];
        sum+=b[i];
        s2.pb(sum);
    }
    vector<ll> :: iterator it;
    s2.pb(1000000000000000000);
    ll max=0;
    f(i,0,n+1)
    {
        ll x=k-s1[i],ans=i;
        if(x>0)
        {
            it=lower_bound(s2.begin(),s2.end(),x);
            if(*it!=x)
                it--;
            ans+=it-s2.begin();
        }
        if(x>=0)
            max=maxx2(max,ans);
    }
    cout<<max<<endl;
    return 0;
}

Measured memory_bytes: 10548
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
#include <stdbool.h>
#include <ctype.h>
#include <time.h>
 
 
/// Bismillahir Rahmanir Rahim
 
 
bool strong_palindrome(char *str);
 
 
int main(void)
{
    char str[100];
 
    scanf("%s", str);
 
    if (strong_palindrome(str)) puts("Yes");
    else puts("No");
 
 
 
    return 0;
}
 
bool strong_palindrome(char *str)
{
    short int len = strlen(str);
    short int i, pal_len = len >> 1;
 
    for(i = 0; i < pal_len; ++i) if (str[i] ^ str[len-i-1]) return false;
 
    short int bound = (len-1) >> 1;
 
    for(i = 0; i < (bound >> 1); ++i) if (str[i] ^ str[bound-1-i]) return false;
 
    bound = (len+3) >> 1;
 
    for(i = bound - 1; i < ((len - bound) >> 1); ++i) if (str[i] ^ str[len-i+bound-2]) return false;
 
    return true;
 
}

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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

void Main() {
    int N;
    cin >> N;
    Graph graph(N);
    vector<P> query;
    rep(i, N - 1) {
        int u, v;
        cin >> u >> v;
        u--;
        v--;
        graph[u].push_back(v);
        graph[v].push_back(u);
        query.emplace_back(u, v);
    }

    queue<pair<int, int>> queue;
    queue.push({0, 0});
    vector<bool> visited(N, false);
    visited[0] = true;
    map<pair<int, int>, int> ans;
    int max_cnt = 1;
    while (!queue.empty()) {
        auto p = queue.front();
        queue.pop();
        int cnt = 1;
        for (int v : graph[p.first]) {
            if (!visited[v]) {
                if (cnt == p.second) {
                    cnt++;
                }
                max_cnt = max(max_cnt, cnt);
                visited[v] = true;
                ans[make_pair(p.first, v)] = cnt;
                queue.push({v, cnt});
                cnt ++;
            }
        }
    }
    cout << max_cnt << '\n';
    rep(i, N - 1) {
        P p = query[i];
        int  a = ans[{p.first, p.second}];
        cout << a << '\n';
    }
}

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


Measured memory_bytes: 14448
while True:
 m,f,r = map(int, input().split())
 j = m+f
 if m == -1 and f == -1 and r == -1:
   break
 else:
  if m == -1 or f == -1:
    print("F")
  elif j >= 80:
    print("A")
  elif j >= 65 and j < 80:
    print("B")
  elif j >= 50 and j < 65:
    print("C")
  elif j >= 30 and j < 50 and r >= 50:
    print("C")
  elif j >= 30 and j < 50 and r < 50:
    print("D")
  else:
    print("F")


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

const int mod = 1000000007;

int a[110];
long long dp[100010];

int main(){
	int n, k;
	scanf("%d%d", &n, &k);
	for (int i = 0; i < n; i++){
		scanf("%d", &a[i]);
	}
	dp[0] = 1;
	for (int i = 0; i < n; i++){
		long long sum = 0;
		for (int j = 0; j <= a[i]; j++){
			sum = (sum + dp[k - j]) % mod;
		}
		for (int j = k; j >= 0; j--){
			sum = (sum - dp[j] + mod) % mod;
			dp[j] = (sum + dp[j]) % mod;
			if (j - a[i] - 1 >= 0) sum = (sum + dp[j - a[i] - 1]) % mod;
		}
	}
	printf("%lld\n", dp[k]);
	return 0;
}


Measured memory_bytes: 1024
#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 power(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)

//your code here!

int main(void){
    ll N;
    scanf("%lld", &N);
    if(1==N) {
        puts("Yes");
        return 0;
    }
    for(ll i=2; i<=9; i++) {
        if(N%i==0 && N/i<=9) {
            puts("Yes");
            return 0;
        }
    }
    puts("No");
    return 0;
}


Measured memory_bytes: 128