akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main() {
  ll n,m,k;
  cin >> n >> m >> k;
  vector<ll> a(n);
  vector<ll> b(m);
  rep(i,n) {
    cin >>a[i];
    if (i!=0) a[i]+=a[i-1];
  }
  rep(i,m) {
    cin >>b[i];
    if (i!=0) b[i]+=b[i-1];
  }
  ll res=0;
  rep(i,n+1){
    ll p;
    if (i!=0) p=k-a[i-1];
    if (i==0) p=k;
    if (p<0) continue;
    ll l=0;
    ll r=m-1;
    while (l!=r){
      ll z=(l+r+1)/2;
      if (b[z]<=p) {
        l=z;
      }else{
        r=z-1;
      }
    }
    if (i+r>res && p>=0 && b[0]>p) res = i;
    if (i+1+r>res && p>=0 && b[0]<=p) res = i+r+1;
   }
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 6424
def main():
    import sys

    def input(): return sys.stdin.readline().rstrip()

    n = int(input())
    a = [0] + list(map(int, input().split()))
    for i in range(n, 0, -1):
        k = 1
        flag = 0
        while i*k <= n:
            flag ^= a[i*k]
            k += 1
        if flag != a[i]:
            a[i] ^= 1
    ans = [i for i in range(n+1) if a[i] == 1]
    if ans == []:
        print(0)
    else:
        print(len(ans))
        print(*ans)
    
if __name__ == '__main__':
    main()

Measured memory_bytes: 16244
N, S = map(int, input().split())
A = list(map(int, input().split()))
mod = 998244353
L = [[0 for i in range(S+1)] for j in range(N+1)]
L[0][0] = 1
for j, a in enumerate(A):
  for i in range(S+1):
    if i < a:
      L[j+1][i] = (2 * L[j][i]) % mod
    else:
      L[j+1][i] = (2 * L[j][i] + L[j][i-a]) % mod
print(L[N][S])

Measured memory_bytes: 153148
r=int(input())
x=list(map(int,input().split()))
setx=list(set(x))
setx.sort()
cx=[]
for i in setx:
    cx.append(x.count(i))
ans=0
A=0
while A<=len(setx)-3:
    B=A+1
    while B<=len(setx)-2:
        C=B+1
        while C<=len(setx)-1:
            if setx[A]+setx[B]>setx[C]:
                ans+=cx[A]*cx[B]*cx[C]
            C+=1
        B+=1
    A+=1
print(ans)


Measured memory_bytes: 9204
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
#include <iomanip>
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

const int mod=1e9+7;
const int INF=1001001001;

const int M=1e6+5;
int main() {
  int N;
  cin>>N;
  vector<int>A(N);
  vector<int>c(M);
  for(int i=0;i<N;i++){
    cin>>A[i];
    c[A[i]]++;
  }
  
  int g=0;
  for(int i=0;i<N;i++){
    g=__gcd(g,A[i]);
  }
  bool ok=true;
  for(int i=2;i<M;i++){
    int cnt=0;
    for(int j=i;j<M;j+=i){
      cnt+=c[j];
    }
    if(cnt>1){ok=false;}
  }
  if(!ok&&g==1){cout<<"setwise coprime"<<endl;}
  else if(ok){cout<<"pairwise coprime"<<endl;}
  else{cout<<"not coprime"<<endl;}
  return 0;  
}

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

#define FOR(i, a, b) for(int i = a;i < b;i++)
#define For(i, a) FOR(i, 0, a)
#define REV(i, a, b) for(int i = b-1;i >= a;i--)
#define Rev(i, a) REV(i, 0, a)
#define REP(a) For(i, a)
#define DEBUG_PRINT(...) fprintf(stderr, __VA_ARGS__)

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int uint;
typedef pair<int, int> pi;
typedef vector<int> vi;
void print_pair(pi a){
  cerr<<"("<<a.first<<", "<<a.second<<") ";
}
template<int T1, int T2>
void print_2d(int a[T1][T2], int x, int y){
  For(i, x){
    For(j, y){
      cerr<<a[i][j]<<" ";
    }
    cerr<<endl;
  }
}
ull n,m,s,t;
vector<pair<ull,ull>> map_yen[100000],map_snuk[100000];
pair<ull,ull> tyukei[100000];
vector<ull> dikstra(vector<pair<ull,ull>> map[],ull from){
  priority_queue<pair<ull,ull>,vector<pair<ull,ull>>,greater<pair<ull,ull>>> q;
  vector<ull> ans(n);
  bool used[100000];
  fill(used,used+n,false);
  q.push(make_pair(0ULL,from));
  while(!q.empty()){
    auto v=q.top();q.pop();
    if(used[v.second]==true)continue;
    ans[v.second]=v.first;
    used[v.second]=true;
    for(auto tmp:map[v.second]){
      if(used[tmp.second]==false){q.push(make_pair(tmp.first+v.first,tmp.second));}
    }
  }
  return ans;
}
int main(){
  cin>>n>>m>>s>>t;
  s--;t--;
  REP(m){
    ull u,v,a,b;
    cin>>u>>v>>a>>b;
    u--;v--;
    map_yen[u].push_back(make_pair(a,v));
    map_yen[v].push_back(make_pair(a,u));
    map_snuk[u].push_back(make_pair(b,v));
    map_snuk[v].push_back(make_pair(b,u));
  }
  auto dist_yen=dikstra(map_yen,s);
  auto dist_snuk=dikstra(map_snuk,t);
  REP(n){
    cerr<<i+1<<":"<<dist_yen[i]<<endl;
    cerr<<i+1<<":"<<dist_snuk[i]<<endl;
  }
  pair<ull,ull> tyukei[100000];
  REP(n){
    tyukei[i]=make_pair(dist_yen[i]+dist_snuk[i],i);
  }
  sort(tyukei,tyukei+n);
  ull index=0;
  ull shoji=1;
  REP(15)shoji*=10ULL;
  for(ull i=0;i<n;i++){
    while(tyukei[index].second+1ULL<=i)index++;
    cout<<shoji-tyukei[index].first<<endl;
  }
  return 0;
}


Measured memory_bytes: 20024
#[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, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

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

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

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        #[cfg(debug_assertions)]
        writeln!(&mut std::io::stderr(), concat!("[DEBUG] ", $(stringify!($a), "={:?} "),*), $($a),*);
    }
}

#[allow(unused_imports)]
use std::cmp::{min, max};
#[allow(unused_imports)]
use std::io::{stdout, stdin, BufWriter, Write};

fn main() {
    let out = std::io::stdout();
    let mut out = BufWriter::new(out.lock());
    macro_rules! puts {
        ($($format:tt)*) => (write!(out,$($format)*).unwrap());
    }

    input!{
      n: usize,
      t: usize,
      mut abs: [(usize, usize); n],
    }
    abs.sort();

    let mut dp = vec![vec![0; 3000+2]; n+1];
    for i in 0..n {
        let (a, b) = abs[i];
        for ct in 0..t {
            let nt = min(ct + a, t);
            dp[i+1][ct] = max(dp[i+1][ct], dp[i][ct]);
            dp[i+1][nt] = max(dp[i][ct] + b, dp[i+1][nt]);
        }
        dp[i+1][t] = max(dp[i+1][t], dp[i][t]);
    }
    let ans = dp[n].iter().max().unwrap();
    puts!("{}\n", ans);
}


Measured memory_bytes: 90364
#include <iostream>
#include <bits/stdc++.h>
#define ll long long
#define inf 100000000
#define mod 1000000007
#define ld long double
#define point complex<long double>
#define pi acos(-1)
#define IO                            \
	ios_base::sync_with_stdio(false); \
	cin.tie(NULL);                    \
	cout.tie(NULL);
using namespace std;
ll gcd(ll a,ll b)
{
	if(b==0)return a;
	return gcd(b,a%b);
}
int main()
{
	int n;
	cin>>n;
	int arr[n+1];
	for(int i=1;i<=n;i++)
	{
		cin>>arr[i];
	}
	int has[n+1]={};
	for(int i=n;i>0;i--)
	{
		int val=arr[i];
		int sum=0;
		for(int ii=1;ii*i<=n;ii++)
		{
			sum+=has[ii*i];
		}
		if(sum%2!=val)
		{
			has[i]=1;
		}
		
	}
	vector<int>res;
	for(int i=1;i<=n;i++)
	{
		if(has[i])res.push_back(i);
	}
	cout<<res.size()<<endl;
	for(auto r:res)
	{
		cout<<r<<" ";
	}
	return 0;
}

Measured memory_bytes: 5384
#!/usr/bin/env python3
import sys


def solve(n: int, p: "List[int]"):
    ans = 0
    for i in range(1,n-1):
        if((p[i-1] < p[i] < p[i+1]) or (p[i-1] > p[i] > p[i+1])):
            ans += 1
        
    print(ans)
    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    n = int(next(tokens))  # type: int
    p = [ int(next(tokens)) for _ in range(n) ]  # type: "List[int]"
    solve(n, p)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3316
#include <bits/stdc++.h>
using namespace std;
const long long mod = pow(10, 9) + 7;
const long long mod2 = 998244353;
const long long INF = 1LL << 60;
const int inf = pow(10, 9) + 7;
const string ABC = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
const string abc = "abcdefghijklmnopqrstuvwxyz";
template <class T> bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template <class T> bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
int divCeil(int A, int B) {return (A + (B - 1)) / B;}
long long divCeil(long long A, int B) {return (A + (B - 1)) / B;}
long long divCeil(int A, long long B) {return (A + (B - 1)) / B;}
long long divCeil(long long A, long long B) {return (A + (B - 1)) / B;}

int main()
{
  int N;
  cin >> N;
  vector<int> buc(200, 0);
  for (int i = 0; i < N; i++)
  {
    int d;
    cin >> d;
    buc.at(d)++;
  }
  
  int ans = 0;
  for (int i = 0; i < 200; i++)
  {
    if (buc.at(i) > 0) ans++;
  }

  cout << ans << endl;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef unsigned long ul;
typedef unsigned int ui;
typedef pair<int,int> P;
typedef pair<ll,ll> LP;
#define All(v) (v).begin(),(v).end()
#define Rep(i,n) for(int i = 0; i < (int)n; i++)
#define Reps(i,n) for(int i = 1; i <= (int)n; i++)
#define For(i,m,n) for(int i = m; i < n; i++)
#define Fors(i,m,n) for(int i = m; i <= n; i++)
#define Inf 2e9
#define F first
#define S second
#define pb push_back
#define mp make_pair
struct speed{speed(){cin.tie(); ios::sync_with_stdio(false); cout << fixed << setprecision(18);}}speed;

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

ll gcd(ll a, ll b){
    if(b == 0) return a;
    else return gcd(b,a%b);
}

ll lcm(ll a, ll b){
    return a*b/gcd(a,b);
}


int main(){
    char tmp;
    map<char,int> m;
    Rep(i,4){
        cin >> tmp;
        m[tmp]++;
    }
    bool ans = true;
    for(auto itr = m.begin(); itr != m.end(); itr++){
        if(itr->S != 2) ans = false;
    }
    if(ans) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
#include <cstdio>
#include <cmath>
#include <cstring>
#include <string>
#include <algorithm>
#include <functional> //sort(A,A.end(),greater<int>());???????????????
#include <queue>
#include <stack>
#include <vector>

#define INF 10 << 10

int a[1024];

int main() {
	int n, m;
	cin >> n >> m;
	int cnt = 0;
	for (int i = 0; i < m; ++i) {
		int b;
		cin >> a[i] >> b;
		if (a[i] >= n) {
			cnt++;
		}
	}
	int cost = 0;
	if(cnt < m - 1) {
		cnt = (m - 1) - cnt;
		sort(a, a + m, greater<int>());
		for (int i = 0; i < m; ++i) {
			if (a[i] >= n) { continue; }
			cost += n - a[i];
			cnt--;
			if (cnt == 0) { break; }
		}
	}
	cout << cost << endl;
	return 0;
}

Measured memory_bytes: 3132
#include <algorithm>
#include <iostream>
#include <stack>
#include <queue>
#include <cmath>
#include <string>
#include <iterator>
#include <map>
#include <set>
#include <iomanip>
#include <vector>
#include <cstdint>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
using Graph = vector<vector<int>>;
int dx[] = {0, 1, 0, -1};
int dy[] = {1, 0, -1, 0};
#define rep(i, N) for(int i = 0; i < N; i++)
#define rep2(i, l, r) for (ll i = (ll)l; i < (ll)(r); i++)
#define INF 1000000000000000000
#define MAX 200001

const ll MOD = 1000000007;

template <typename T > inline string toString(const T &a) {ostringstream oss; oss << a; return oss.str();};

template<int MOD> struct Fp {
    long long val;
    constexpr Fp(long long v = 0) noexcept : val(v % MOD) {
        if (val < 0) v += MOD;
    }
    constexpr int getmod() { return MOD; }
    constexpr Fp operator - () const noexcept {
        return val ? MOD - val : 0;
    }
    constexpr Fp operator + (const Fp& r) const noexcept { return Fp(*this) += r; }
    constexpr Fp operator - (const Fp& r) const noexcept { return Fp(*this) -= r; }
    constexpr Fp operator * (const Fp& r) const noexcept { return Fp(*this) *= r; }
    constexpr Fp operator / (const Fp& r) const noexcept { return Fp(*this) /= r; }
    constexpr Fp& operator += (const Fp& r) noexcept {
        val += r.val;
        if (val >= MOD) val -= MOD;
        return *this;
    }
    constexpr Fp& operator -= (const Fp& r) noexcept {
        val -= r.val;
        if (val < 0) val += MOD;
        return *this;
    }
    constexpr Fp& operator *= (const Fp& r) noexcept {
        val = val * r.val % MOD;
        return *this;
    }
    constexpr Fp& operator /= (const Fp& r) noexcept {
        long long a = r.val, b = MOD, u = 1, v = 0;
        while (b) {
            long long t = a / b;
            a -= t * b; swap(a, b);
            u -= t * v; swap(u, v);
        }
        val = val * u % MOD;
        if (val < 0) val += MOD;
        return *this;
    }
    constexpr bool operator == (const Fp& r) const noexcept {
        return this->val == r.val;
    }
    constexpr bool operator != (const Fp& r) const noexcept {
        return this->val != r.val;
    }
    friend constexpr ostream& operator << (ostream &os, const Fp<MOD>& x) noexcept {
        return os << x.val;
    }
    friend constexpr istream& operator >> (istream &is, Fp<MOD>& x) noexcept {
        return is >> x.val;
    }
    friend constexpr Fp<MOD> modpow(const Fp<MOD> &a, long long n) noexcept {
        if (n == 0) return 1;
        auto t = modpow(a, n / 2);
        t = t * t;
        if (n & 1) t = t * a;
        return t;
    }
};

using mint = Fp<MOD>;

int main(){
    int N, X, T;
    cin >> N >> X >> T;
    if(N%X == 0) cout << N/X * T << endl;
    else cout << (N/X + 1) * T << endl;   
}

Measured memory_bytes: 3628
n = int(input())
a = [0] + list(map(int, input().split())) + [0]

all = 0

for i in range(n+1):
	all += abs(a[i] - a[i+1])

for i in range(1, n+1):
	dist = all - abs(a[i-1] - a[i]) - abs(a[i] - a[i+1]) + abs(a[i-1] - a[i+1])
	print(dist)

Measured memory_bytes: 20536
import sys

LINES = sys.stdin.readlines()

count = {}
chars = "abcdefghijklmnopqrstuvwxyz"
for c in chars:
	count[c] = 0

for l in LINES:
	for c in l:
		c = c.lower()
		if not c in chars:
			continue
		count[c] += 1

for c in chars:
	print(c + " : " + str(count[c]))



Measured memory_bytes: 5568
import std.algorithm;
import std.array;
import std.conv;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

T read(T)() { return readln.chomp.to!T; }
T[] reads(T)() { return readln.split.to!(T[]); }
alias readint = read!int;
alias readints = reads!int;

void main() {
    auto ab = readints;
    int a = ab[0], b = ab[1];
    writeln(a * b % 2 == 0 ? "Even" : "Odd");
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  #define int long
  int n,m=1e9+7,sum=0;
  cin>>n;
  vector<int> a(n);
  for(int i=0;i<n;++i){
    cin>>a[i];
    m=min(m,abs(a[i]));
  }
  for(int i=0;i<n-1;++i){
    if(a[i]<0)a[i]*=-1,a[i+1]*=-1;
    sum+=abs(a[i]);
  }
  sum+=abs(a[n-1]);
  cout<<sum-(a[n-1]<0?2*m:0);
  return 0;
}


Measured memory_bytes: 1024
#include <bits/stdint-intn.h>
#include<cstdint>
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<deque>
#include<stack>
#include<iterator>
#include<stack>
#include<cctype>
#include<climits>
#include<string>
#include<bitset>
#include<cfloat>
#include<iomanip>
#include<numeric>
#include<utility>
#include<initializer_list>


#define repi(i,start,end)for(int64_t (i)=(start);(i)<(end);++(i))
#define rep(i,end) repi((i),0,(end))
#define rfor(x, v) for(auto& (x) : (v))
#define iterate(itr, v) for(auto (itr)=(v).begin();(itr)!=(v).end();++(itr))
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define vin(v) rep(i,(v).size()) cin >> (v)[i];
#define vpin(v) rep(i,(v).size()) cin >> (v)[i].first >> (v)[i].second

using namespace std;
using Int = int64_t;
using pint = pair<Int, Int>;
using vint = vector<Int>;
using vvint = vector<vint>;
using vpint = vector<pint>;
using vstr = vector<string>;

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; }
template<class T>void put_double(T a){if(cout.precision()!=12)cout<<setprecision(12);cout<<a<<"\n";}
template<class T>void println(T a){cout << a << "\n";}
template<class T>void put_line(T &v){iterate(itr,v){cout<<*itr<<((itr==--v.end())?"\n":" ");}}
// auto [x, y] = make_tuple(3, 4); => let (x, y) = (3, 4);

int main(void) {
    Int a, b, n; cin >> a >> b >> n;
    Int x = min(b-1, n);

    Int ans = a * x / b - x / b * a;
    println(ans);
    
    return 0;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define rep(i, z, n) for(int i = z; i < n; i++)
#define all(v) v.begin(), v.end()
typedef long long ll;
#define PI 3.14159265358979
//const int64_t INF = 1LL << 60;
const int INF = 1 << 29;
const int64_t MOD = 1000000007;
//const int64_t INF = 998244353;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using namespace std;
//#define P pair<int, int>
typedef pair<int, int> P;

int main(){
    int N;
    cin >> N;
    vector<int> d(N);
    rep(i, 0, N) cin >> d.at(i);
    int sum = 0;
    rep(i, 0, N){
        rep(j, 0, N){
            if(i >= j) continue;
            sum += d.at(i) * d.at(j);
        }
    }
    cout << sum << endl;
}

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

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

using namespace std;
typedef long long int ll;
const int INF = 1000000000;
const double PI = 3.1415926535897932;
const ll MOD = 1000000007;

int main()
{
    int n, k, q;
    cin >> n >> k >> q;

    vector<int> cnt(n, 0);
    rep(i, q) {
        int a;
        cin >> a;
        cnt[a - 1]++;
    }
    int need = q - k + 1;
    rep(i, n) {
        if (cnt[i] >= need) {
            cout << "Yes" << endl;
        }
        else {
            cout << "No" << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 1024
#include<iostream>
#include<vector>
#include<iomanip>
#include<algorithm>
#include<cmath>
#include<queue>
#include<set>
using namespace std;
using ulong = unsigned long;
using ll = long long;

int calc(int num, vector<int>& as){
	int ret = 0;
	for(int a : as){
		ret += (num - a) * (num - a);
	}
	return ret;
}

int main(){
	int n;
	cin >> n;
	vector<int> as(n);
	for(int i=0;i<n;i++){
		cin >> as[i];
	}

	int ans = 1e9;
	for(int i=-100;i<=100;i++){
		ans = min(ans, calc(i, as));
	}
	cout << ans << endl;
	return 0;
}



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

// #define int long long
#define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define irep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define ireps(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define SORT(v, n) sort(v, v + n);
#define REVERSE(v, n) reverse(v, v+n);
#define vsort(v) sort(v.begin(), v.end());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) int(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vs = vector<string>;
using vpll = vector<pair<ll, ll>>;

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

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

class UnionFind{
private:
  vector<ll> Parent; 
 public:
  UnionFind(ll N){
    Parent = vector<ll>(N, -1);
  }
  
  ll root(ll A){
    if(Parent[A] < 0) return A;
    return Parent[A] = root(Parent[A]);
  }
  
  ll size(ll A){
    return -Parent[root(A)]; 
  }
  
  bool connect(ll A, ll B){
    A = root(A);
    B = root(B);
    if(A == B){
      return false;
    }
    if(size(A) < size(B)) swap(A, B);
    Parent[A] += Parent[B];
    Parent[B] = A;
    return true;
  }
  
  bool isSame(ll A, ll B){
    return root(A) == root(B);
  }
};

signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  ll n,m; cin>>n>>m;
  vll a(m),b(m);
  rep(i,m){
    cin>>a[i]>>b[i];
    a[i]--,b[i]--;
  }
  
  ll ans=0;
  rep(i,m){
    UnionFind uf(n);
    rep(j,m){
      if(i==j) continue;
      uf.connect(a[j],b[j]);
    }
    if(uf.size(0)<n) ans++;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
N, M, K = map(int, input().split())
A = [int(i) for i in input().split()]
B = [int(j) for j in input().split()]

a, b = [0], [0]
for i in range(N):
    a.append(a[i] + A[i])
for i in range(M):
    b.append(b[i] + B[i])

ans, j = 0, M
for i in range(N+1):
    if a[i] > K:
        break
    while b[j] > K - a[i]:
        j -= 1
    ans = max(ans, i + j)

print(ans)
    


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

#define rep(i, s, n) for(int i = s; i < n; ++i)
#define rrep(i, n) for(int i = n - 1; i > -1; --i)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
using namespace std;
const long long INF = 1000000000;
const int MOD = 1000000007;
typedef long long ll;
typedef pair<int, int> P;

int main() {
    int a, b;
    cin >> a >> b;
    if(a >= 2 * b){
        cout << a - 2 * b << endl;
    }else{
        cout << 0 << endl;
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
 
typedef pair<int,int> P;
struct edge{int to, id;};
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define mod 1000000007
 
using graph = vector<vector<ll>>;
int jikan;
bool seen[200010];
ll sum[200010];
ll ans[200010];
void dfs(const graph &G, int v, ll parent, ll val){
    //seen[v] = true;
    //root[v].push_back(v);
    sum[v] += val;
 
    for(auto next_v : G[v]){
        //ans[next_v] = v+1;
        //first[next_v] = jikan;
        //ans[next_v] += ans[v];
 
        if (next_v == parent) continue;
        dfs(G, next_v,v,sum[v]);
      //root[v].push_back(next_v);
      /*for(auto hoge : root[next_v]){
        root[v].push_back(hoge);
      }*/
    }
}
 
int main(){
    ll n,q;
    cin >> n >> q;
    graph g(n);
    graph root(n);
  ll ans[n];
    rep(i,n){
        seen[i] = false;
      ans[i] = 0;
    }
    rep(i,n-1){
        ll a,b;
        cin >> a >> b;
        a--,b--;
        g[a].push_back(b);
        g[b].push_back(a);
    }
    rep(i,q){
        ll a,b;
        cin >> a >> b;
        sum[a-1] += b;
    }
    dfs(g,0,-1,0);
    rep(i,n){
        if(i < n-1) cout << sum[i] << ' ';
        else cout << sum[i] << endl;
    }
 
}

Measured memory_bytes: 34560
#include<stdio.h>
int main() {
	int m, f, r, p;
	while (1) {
		scanf("%d %d %d", &m, &f, &r);
		if (m == -1 && f == -1 && r == -1) {
			break;
		}
		p = m + f;
		if (m == -1 || f == -1) {
			printf("F\n");
		}
		else if (p >=  80) {
			printf("A\n");
	    }
		else if (65 <= p&&p < 80) {
			printf("B\n");
	    }
		else if (50 <= p&&p < 65) {
			printf("C\n");
		}
		else if (30 <= p&&p < 50) {
			if (r < 50) {
				printf("D\n");
			}
			if (r >= 50) {
				printf("C\n");
			}
		}
		else if (p < 30) {
			printf("F\n");
		}
	}
	return 0;
}

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

int main(){
  int n;
  cin >> n;
  vector<long long> a={};
  for(int i=0;i<=n;i++){
    if(i==0){
      a.push_back(2);
    }else if(i==1){
      a.push_back(1);
    }else{
      a.push_back(a[i-2]+a[i-1]);
    }
  }
  
 cout << a[n] << endl;
}

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

int main()
{
    int n,ans=0,i;
    cin >> n;
    vector <int> vec(n);
    for(i=0;i<n;i++)
    {
        cin >> vec[i];
        if((i+1)%2!=0 && vec[i]%2!=0)
            ans++;
    }
    cout << ans;
}


Measured memory_bytes: 3544
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<algorithm>

typedef long long LL;
const int MX=100011;

int p[MX],x[MX],a[MX];
int n,m;LL k;
LL ans[MX];

int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++)scanf("%d",&x[i]);
	for(int i=1;i<=n;i++)p[i]=i;
	scanf("%d%lld",&m,&k);
	for(int i=1;i<=m;i++)scanf("%d",&a[i]);for(int i=m;i;i--)std::swap(p[a[i]],p[a[i]+1]);
	static int t[MX];for(int i=1;i<=n;i++)t[i]=i;
	while(k){
		static int P[MX];
		if(k&1){for(int i=1;i<=n;i++)P[i]=p[t[i]];memcpy(t+1,P+1,sizeof(int)*n);}
		for(int i=1;i<=n;i++)P[i]=p[p[i]];memcpy(p+1,P+1,sizeof(int)*n);
		k>>=1;
	}
	for(int i=1;i<=n;i++)ans[t[i]]+=x[i]-x[i-1];
	for(int i=1;i<=n;i++)ans[i]+=ans[i-1];
	for(int i=1;i<=n;i++)printf("%lld\n",ans[i]);
	return 0;
}


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

using namespace std;

#define REP(i, n) for(int i = 0; i < (n); i++)
#define SORT(v, n) sort(v, v+n);
#define SSORT(v, n) sort(v, v+n, greater<int>())

int main(){
	int n, max, min;
	cin >> n;
	int a[n];
	for(int i=0; i<n; i++) cin >> a[i];

	SORT(a, n);
	cout << a[n-1] - a[0] << endl;
}

Measured memory_bytes: 256
H,W = map(int,input().split())
S = [""]
for i in range(W + 2):
    S[0] += "#"
for i in range(H):
    S.append("#" + input() + "#")

S.append("")
for i in range(W + 2):
    S[H  + 1] += "#"

for s in S:
    print(s)



Measured memory_bytes: 9116
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<map>
#include<stack>
#include<cmath>
#include<iomanip>
#include<set>
#include<numeric>
#include<sstream>
#include<random>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < n; ++i)
#define rrep(i, st, n) for (int i = st; i < n; ++i)
using pii = pair<int, int>;
const int inf = 1e9 + 7;
int dy[] = {0, 0, -1, 1, -1, 1, -1, 1};
int dx[] = {1, -1, 0, 0, -1, 1, 1, -1};
const int limit = 100001;
int dp[limit];
void calc(int key) {
    int beki = 1;
    while (1) {
        int value = pow(key, beki);
        beki++;
        if (value > limit) break;
        for (int i = 1; i < limit; ++i) {
            if (i % value == 0) {
                dp[i] = min(dp[i], i / value);
            }
            if (i - value >= 0) {
                //if (i == 45) cout << "dp45 " << value << " " << dp[i] << " " << dp[i - value] << endl;
                dp[i] = min(dp[i], dp[i - value] + 1);
            }
        }
    }
}
int main() {
    rep(i, limit) dp[i] = i;
    calc(6);
    calc(9);
    //rep(i, 100) cout << i << " " << dp[i] << endl;
    int n; cin >> n;
    cout << dp[n] << endl;
}




Measured memory_bytes: 640
#include<stdio.h>
int main(void)
{
	int a,b,c1,c2,c3,i;
	scanf("%d",&a);
	for(i=0;i<a;i++){
		scanf("%d %d %d",&c1,&c2,&c3);
	
		if(c1*c1+c2*c2==c3*c3){
			printf("YES\n");
		}
		else if(c1*c1+c3*c3==c2*c2){
			printf("YES\n");
		}
		else if(c2*c2+c3*c3==c1*c1){
			printf("YES\n");
		}
		else{
			printf("NO\n");
		}
	}
	return 0;
}

Measured memory_bytes: 1008
/*  Success may not come to me immediately,
 *  but it will come definitely....
 */
#include <bits/stdc++.h>
//=====================================================================
using namespace std;
//=====================================================================
#define opt ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
//=====================================================================
#define li      int64_t
#define ld      double_t
#define ulli    uint64_t
//=====================================================================
#define rep(i,a,b)  for(i=a;i<b;i++)
#define repr(i,a,b) for(i=a;i>b;i--)
#define repi(i,v)   for(i=v.begin();i!=v.end();i++)
#define repir(i,v)  for(i=v.rbegin();i!=v.rend();i++)
#define elif        else if
#define mset(a,b)   memset(a,b,sizeof(a))
#define nl          cout<<'\n'
//=====================================================================
typedef vector<li>       vli;
typedef vector<string>   vstr;
typedef pair<li,li>      pli;
typedef pair<li,pli >    ppli;
typedef pair<li,ppli >   pppli;
typedef vector<pli >     vpl;
typedef vector<ppli >    vppli;
typedef vector<pppli >   vpppli;
//=====================================================================
#define pb  push_back
#define pob pop_back
#define pf  push_front
#define pof pop_front
#define all(v)  v.begin(),v.end()
#define itr iterator
#define rtr reverse_iterator
#define sz  size()
#define lb  lower_bound
#define ub  upper_bound
#define bs  binary_search
#define mp  make_pair
#define F   first
#define S   second
//=====================================================================
#define mod (li)(1e9+7)
#define inf (li)(1e18)
#define MX1 (li)(1e5+5)
#define MX2 (li)(1e6+5)
#define pi  acos(-1)
//=====================================================================
li power(li a,li b){li ans=1;while(b){if(b&1){ans=(ans*a)%mod;}
a=(a*a)%mod;b>>=1;}return ans;}
//=====================================================================
li mmi(li n){return power(n,mod-2);}
//=====================================================================
li two(li n){return (1LL<<n);}
//=====================================================================
void onbit(li &n,li x){n|=two(x);}
//=====================================================================
void offbit(li &n,li x){n&=~two(x);}
//=====================================================================
li cntbit(li n){li res=0;while(n and ++res)n-=n&-n;return res;}
//=====================================================================
li dx[]={-1,0,1,0},dy[]={0,-1,0,1};
//=====================================================================
/*------------------------MAIN CODE BEGINS NOW!------------------------*/

string s;
li k;

void solve(){
  li i,n;cin>>s>>k;
  n=s.length();
  rep(i,0,n){
    li c=s[i]-'a';
    if(c+k>=26 and c!=0){
      s[i]='a';
      li x=26-c;
      k-=x;
    }
  }
  while(k>0){
    li c=s[n-1]-'a';
    c+=k;
    c%=26;
    s[n-1]=(char)(c+'a');
    k=0;
  }
  cout<<s;nl;
}

int main(){
  opt
  li t=1;
  //cin>>t;
  while(t--){
    solve();
  }
  return 0;
}

Measured memory_bytes: 592
/* Author : Harshit Jain a.k.a. iharshit009 */
#include <bits/stdc++.h>
#define vi               vector<int>
#define pb(x)            push_back(x)
#define all(x)           x.begin(), x.end()
#define sortall(x)       sort(all(x))
#define sortrev(x)       sort(all(x), greater<int>())
#define debug(x)         cout << '>' << #x << ':' << x << endl;
#define int              long long
#define ld               long double
#define endl 			 "\n";
#define mp 				 make_pair
#define pii 			 <int, int>
#define lb 				 lower_bound
#define ub				 upper_bound
#define len(a)           int((a).size())
#define prec(n)          fixed<<setprecision(n)
#define cnt(n)           __builtin_popcountll(n)
#define pi               pair<int, int>
const int mod = 1000000007;
using namespace std;
using namespace std::chrono;
// const int N = 1e5 + 5; 
// int n;
// int a[N];



int32_t main(){
auto start = high_resolution_clock::now(); // starting clock
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
int t;
t = 1;
// cin >>t;
while(t--){
	int n;
	cin >> n;
	int a[n];
	for(int i = 0;i<n; i++){
		cin >> a[i];
	}
	int sum = 0;
	int curr = a[0];

	for(int i = 0; i<n; i++){
		if(curr > a[i]){
			sum += (curr - a[i]);
		}
		else{
			curr = a[i];
		}
	}
cout << sum << endl;







}
auto stop = high_resolution_clock::now(); // stop clock
auto duration = duration_cast<microseconds>(stop - start);  // printing duration
cerr << "Time taken by function: " << duration.count() << " milliseconds" << endl; 
return 0;
}

Measured memory_bytes: 5216
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>

using namespace std;

#define FOR(i,n) for(int i = 0; i < n; i++)
#define FORa(i,a,b) for(int i = a; i < b; i++)
#define pb(x) push_back(x)
#define mp(a, b) make_pair(a, b)
#define F first
#define S second
#define SORT(a,n) sort(begin(a), begin(a) + n)
#define VSORT(v) sort(v.begin(), v.end())
#define MAX 1000000
#define ll long long
#define LOW(s) transform(s.begin(),s.end(),s.begin(),::tolower)
#define UP(s) transform(s.begin(),s.end(),s.begin(),::toupper)

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

int main() {
	int n, m, votes = 0;
	bool ans = true;
	cin >> n >> m;
	
	vector<int> v(n);
	FOR(i, n) {
		cin >> v[i];
		votes += v[i];
	}
	sort(v.begin(), v.end(), greater<int>());
	FOR(i, m) ans &= (v[i]*4*m >= votes);
	
	cout << (ans?"Yes":"No") << endl;
  
	return 0;
}

Measured memory_bytes: 3620
#include <cstdlib>
#include <iterator>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cctype>
#include <functional>
using namespace std;

int main() {
    int a, b;
    cin >> a >> b;
    cout << max({a + b, a - b, a * b}) << endl;
}


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

int main(){
	using ll = long long;
	ll n, k;
	cin >> n >> k;
	map<ll, ll> m;
	while(n--){
		ll a, b;
		cin >> a >> b;
		m[a] += b;
	}
	ll sum = 0;
	for(auto itr:m){
		sum += itr.second;
		if(k <= sum){
			cout << itr.first << endl;
			return 0;
		}
	}
}

Measured memory_bytes: 4224
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <math.h>
#include <cstdlib>
#include <cmath>

using namespace std;

int main(){
  int H,W;
  cin >> H >> W;
  vector<string> a(H);
  for(int i=0;i<H;i++){
    cin >> a.at(i);
  }

  for(int i=0;i<W+2;i++){
    cout << '#';
  }
  cout << endl;
  for(int i=0;i<H;i++){
    cout << '#' << a.at(i) << '#' << endl;
  }
  for(int i=0;i<W+2;i++){
    cout << '#';
  }
  cout << endl;
  
  return 0;
}


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

using namespace std;
typedef long long ll;
#define tr(container, it) \
	for (auto it = container.begin(); it != container.end(); it++)
#define scontains(c,x) ((c).find(x) != (c).end())   //O(log n) 
#define contains(c,x) (find((c).begin(),(c).end(),x) != (c).end()) //O(n)
#define Ichar(_x) char _x;scanf("%c",&_x);
#define Iint(_x) int _x;scanf("%d",&_x); 
#define Ill(_x)  ll _x;scanf("%lld",&_x);
#define inc(a,b,x)(x)>a && (x)<b	
#define incE(a,b,x)(x)>=a && (x)<=b	
//freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
const double pi = 3.14159265358979323846;

bool isSquare(long double x)
{


	long double sr = sqrt(x);
	return ((sr - floor(sr)) == 0);
}
ll a[200000],b[200000];
int main()
{
	ll n, sum=0,m=22222222222;
	ll t;
	scanf(" %lld", &n);
	for (ll i = 0; i<n; i++) {
		scanf(" %lld %lld", &a[i], &b[i]);
		sum += a[i];
		if (a[i]>b[i]) m = min(b[i], m);
	}
	if (m == 22222222222) puts("0");
	else printf("%lld\n", sum - m);
}




Measured memory_bytes: 512
import numpy as np
import sys
line = sys.stdin.readline

H, W = map(int, line().split())
grid = np.zeros((H + 2, W + 2), np.int32)
grid[1:-1, 1:-1] = (np.array([list(line().rstrip()) for _ in range(H)]).reshape(H, W) == '.') * 1
left = np.zeros((H + 2, W + 2), np.int32)
right = np.zeros((H + 2, W + 2), np.int32)
up = np.zeros((H + 2, W + 2), np.int32)
down = np.zeros((H + 2, W + 2), np.int32)

# 下方向に照らせるマスの数（自分の場所含む）
down[H] = grid[H]
for i in range(H, 0, -1):
    down[i - 1] = (down[i] + 1) * grid[i - 1]

up[1] = grid[1]
for i in range(1, H):
    up[i + 1] = (up[i] + 1) * grid[i + 1]

right[:, W] = grid[:, W]
for i in range(W, 0, -1):
    right[:, i - 1] = (right[:, i] + 1) * grid[:, i - 1]

left[:, 1] = grid[:, 1]
for i in range(1, W):
    left[:, i + 1] = (left[:, i] + 1) * grid[:, i + 1]

answer = (left + right + up + down) * grid
print(np.max(answer) - 3)

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

int main() {
  int N;
  cin >> N;
  int A;
  int minn=1000000000,maxx=-1;
  for(int i=0;i<N;i++){
    cin >> A;
    minn=min(A,minn);
    maxx=max(A,maxx);
    //cout << A << endl;
  }
  cout << maxx-minn << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<string.h>
#include<cstdlib>
#include<map>
#include<fstream>
#include<string>
#include<sstream>
#include<iomanip>
#include<cmath>
#include<random>
#include<set>
#include<queue>

using namespace std;

long long dp[3][100100] = {};
const long long INF = 1LL << 60;
#define MOD 1000000007
#define Int int64_t
#define PI 3.14159265358979

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; }

/**
* @fn
* 最大値を取ります.Vector<int>を渡すこと.
*/
long long int imax(vector<int> a) {
	int MAX = -10000000;
	for (int i = 0; i < a.size(); i++) {
		if (MAX < a.at(i)) MAX = a.at(i);
	}
	return MAX;
}

/**
* @fn
* 最小値を取ります.Vector<int>を渡すこと.
*/
long long int imin(vector<int> a) {
	int MIN = 1000000000;
	for (int i = 0; i < a.size(); i++) {
		if (MIN > a.at(i)) MIN = a.at(i);
	}
	return MIN;
}

/**
* @fn
* 自然数について、桁数を求める
*/
Int getDigit(Int num) {
	return (Int)(log10(num)) + 1;
}


int get2Digit(Int num) {
	int cnt = 0;
	while (num > 0) {
		if (num % 2 != 0) {
			return cnt;
		}
		cnt++;
		num /= 2;
	}
}

long long int absmin(vector<int> a, long long int b) {
	int mini = 100000000;
	int d = 0;
	for (int i = 0; i < a.size(); i++) {
		if (mini > abs(a.at(i) - b)) {
			mini = abs(a.at(i) - b);
			d = i;
		}
	}
	return d;
}


long long int absmax(vector<int> a, long long int b) {
	int max = -100000000;
	int d = 0;
	for (int i = 0; i < a.size(); i++) {
		if (max < abs(a.at(i) - b)) {
			max = abs(a.at(i) - b);
			d = i;
		}
	}
	return d;
}

int gcd(int a, int b)
{
	if (a < b) swap(a, b);
	if (b < 1) return -1;
	if (a % b == 0) return b;
	return gcd(b, a % b);
}

void haerobatya(int start, int end, char level) {
	if (start > end) swap(start, end);
	for (int i = start; i <= end; i++) {
		if (i < 100) {
			cout << "https://atcoder.jp/contests/abc0" << i << "/tasks/abc0" << i << "_" << level << endl;
		}
		else {
			cout << "https://atcoder.jp/contests/abc" << i << "/tasks/abc" << i << "_" << level << endl;
		}
	}
}

long long int cntmod(long long int warareru, long long int mod) {
	long long int i = 0;
	for (i = 0; true; i++) {
		if (warareru % mod == 0 && warareru >= mod) {
			warareru /= mod;
		}
		else {
			return i;
		}
	}
}

void ansYes(bool a) {
	if (a == true) cout << "Yes" << endl;
	else cout << "No" << endl;
}

void ansYES(bool a) {
	if (a == true) cout << "YES" << endl;
	else cout << "NO" << endl;
}


Int euclidean_gcd(Int a, Int b) {
	while (true) {
		if (a < b) swap(a, b);
		if (!b) break;
		a %= b;
	}
	return a;
}

typedef pair<int, int> pai;


//ここまでライブラリ
//ここから本文

int main() {
	int a[3];
	cin >> a[0] >> a[1] >> a[2];
	sort(a, a + 3);
	cout << a[0] + a[1] << endl;
}


Measured memory_bytes: 256
#include <stdio.h>

int main() {
  int N,M,C;
  scanf("%d %d %d",&N,&M,&C);
  int A[N][M],B[M];
  for (int i = 0; i < M; i++) {
    scanf("%d",&B[i]);
  }
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < M; j++) {
      scanf("%d",&A[i][j]);
    }
  }
  int ans=0;
  for (int i = 0; i < N; i++) {
    int sum=0;
    for (int j = 0; j < M; j++) {
      sum += A[i][j]*B[j];
    }
    sum += C;
    if (sum > 0) ans++;
  }
  printf("%d\n",ans);
  return 0;
}


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

int main() {
	string s;
	cin >> s;
	if (s.size() % 2) {
		cout << "No" << endl;
		return 0;
	}
	for(int i = 0; i < s.size() / 2; i++) {
		int j = i * 2;
		if (!(s.at(j) == 'h' && s.at(j + 1) == 'i')) {
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;
}
	


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

int main(void)
{
	int cnt = 0, ans = 0;

	for(int i = 0; i < 3; ++i) {
		char s;
		std::cin >> s;

		if(s == 'R')
			cnt++;
		else
			cnt = 0;

		if(cnt > ans)
			ans = cnt;
	}

	std::cout << ans << std::endl;


	return EXIT_SUCCESS;
}


Measured memory_bytes: 3564
#include<bits/stdc++.h>
#define ll long long 
#define pb push_back
#define ff first
#define ss second
#define setbits(x)          __builtin_popcountll(x)
#define lp(a,n) for(ll i=a; i<n; i++)
#define lpi(a,n) for(int i=a; i<n; i++)
#define w(t) int t; cin>>t; while(t--)
#define vi vector<int> 
#define vll vector<ll>
#define pll pair<ll, ll>
#define pii pair<int, int>
#define inf 1e9
#define LB lower_bound
#define UB upper_bound
const int mod = 1000000007;
using namespace std;
ll gcd(ll a,ll b){
    if(a==0)return b;
    return gcd(b%a,a);
}
ll lcm(ll a, ll b){
    return (a*b)/gcd(a,b);
}

int prime[10000007];
void SieveOfEratosthenes(int n) 
{ 
    memset(prime, 0, sizeof(prime)); 
    
    for(int p=1; p<=n; p++){ 
        for(int i=p; i<=n; i += p) 
            prime[i]++; 
    } 
    
} 
int lps(string s){
    int len = 0;
    int n = s.length();
    int dp[n];
    dp[0] = 0;
    for(int i=1; i<n; i++){
        if(s[i] == s[len]){
            len++;
            dp[i] = len;
            continue;
        }
        if(len!=0){
            len = dp[len-1];
            i--;
            continue;
        }
        dp[i]=0;
    }
    return dp[n-1];
}
 
ll power(unsigned ll x,unsigned  ll y) 
{ 
    ll res = 1;     
    while (y > 0) 
    { 
        if (y & 1) 
            res = res*x; 
   
        y = y>>1;
        x = x*x;  
    } 
    return res; 
}

const int mx=10000007;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
   SieveOfEratosthenes(mx);
   ll n;
   cin>>n;
   ll ans=0;
   lp(1,n+1){
       ans += i*prime[i];
   }
   cout<<ans<<endl;
}

Measured memory_bytes: 42684
import sys

stdin = sys.stdin

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))

s = ns()
n = len(s)
t = s[:n//2]
u = s[n//2+1:]
if s == s[::-1] and t == t[::-1] and u == u[::-1]:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 3064
#include <stdio.h>
int main()
{
  int i,j,n,x,y;
  char c,t;
  int map[30][30];
  int r_x,r_y;
  for(;scanf("%d",&n),n;)
    {
      for(i=0;i<30;i++)
	for(j=0;j<30;j++)
	  map[i][j]=0;
      for(j=n;j--;)
	{
	  scanf("%d%d",&x,&y);
	  map[x][y]=1; 
	}
      scanf("%d",&j);
  	  getchar();
      for(r_y=10,r_x=10;j--;)
	{
	  i=0;
	  c=0;
	  while((t=getchar())!='\n')
	    if(t>='0' &&t<='9')
	      i=i*10+t-'0';
	    else if(t>'A' && t<'Z')
	      c=t;
	  for(;i--;)
	    {
	      if(c=='N')
		r_y++;
	      if(c=='E')
		r_x++;
	      if(c=='S')
		r_y--;
	      if(c=='W')
		r_x--;
	      if(map[r_x][r_y]==1)
		  map[r_x][r_y]=0,n--;
	      //printf("now point %d %d jue=%d\n",r_x,r_y,n);
	    }
	}
      puts(n?"No":"Yes");
    }
  exit(0);
}

Measured memory_bytes: 0
#include <stdio.h>
#include <memory.h>
int main(void){
    int N,W,H,i,x,y,map[100][100],S,T,o,sum,sum1,max,j;
    for(;sum=0,max=0,memset(map,0,sizeof(map)),scanf("%d",&N),N;){
        int W,H;
        scanf("%d %d",&W,&H);
        for(i=0;i<N;i++){
            scanf("%d %d",&x,&y);
            map[y][x]=1;
        }
        scanf("%d %d",&S,&T);
        for(i=1;i<=T;i++)
            for(o=1;o<=S;o++)
                sum+=map[i][o];
        sum1=max=sum;
        for(i=1;;max < sum ?(max=sum):(max=max)){
            for(o=2;o+S-1<=W;o++){
                for(j=0;j<T;j++){
                    sum-=map[i+j][o-1];
                    sum+=map[i+j][o+S-1];
                }
                if(max<sum)
                    max=sum;
            }
            i++;
            if(i+T-1> H)
                break;
            for(o=1,j=0;j<S;j++){
                sum1-=map[i-1][o+j];
                sum1+=map[i+T-1][o+j];
            }
            sum=sum1;
        }
        printf("%d\n",max);
    }
    return 0;
}

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

#define rep(i,n) for(int i = 0; i < n; i++)
#define REP(i,n) for(int i = 1; i < n; i++)
#define sz(x) int(x.size())
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define YesorNo(a) printf(a ? "Yes\n" : "No\n")
#define endl "\n"
using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
using vi = vector<int>;
using vii = vector<vi>;
using vl = vector<ll>;
using vll = vector<vl>;
using vs = vector<string>;
const int dx[] = {0,1,0,-1,1,1,-1,-1};
const int dy[] = {1,0,-1,0,1,-1,-1,1};
const int inf = (1<<30)-1;
const ll infll = (1LL<<62)-1;
ll ceil(const ll a, const ll b){return ((a)+(b)-1)/b;}


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

  int r, g, b, n;
  cin >> r >> g >> b >> n;
  int ans = 0;
  rep(i,n+1) {
    rep(j,n+1) {
      int k = n-(i*r + j*g);
      if(k < 0)continue;
      if(k % b == 0)ans++;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
S = str(input())
N = 3
goal = 7
for i in range(2**N):
    result = int(S[0])
    for j in range(N):
        if i & 2**(N-j-1):
            result += int(S[j+1])
        else:
            result -= int(S[j+1])
    if result != goal:
        continue
    print(S[0], end="")
    for j in range(N):
        if i & 2**(N-j-1):
            print('+', end="")
        else:
            print('-', end="")
        print(S[j+1], end="")
    print("=7")
    break
    

Measured memory_bytes: 3064
#include<stdio.h>
int main(void){
    int n,m,l,i=0,j=0,k=0;
    int A[100][100]={},B[100][100]={};
    long long int C[100][100]={};
    scanf("%d %d %d",&n,&m,&l);
    while(scanf("%d",&A[i][j])==1){//行列Aの読み込み
         j++;
        if(j==m) {
            i++;
            j=0;
        }
        if(i==n) break;
    }
    i=0; j=0;
     while(scanf("%d",&B[i][j])==1){//行列Bの読み込み
         j++;
        if(j==l) {
            i++;
            j=0;
        }
        if(i==m) break;
    }
    for(i=0;i<n;i++){//行列Cの計算
        for(k=0;k<l;k++){
            for(j=0;j<m;j++){
            C[i][k]+=A[i][j]*B[j][k];
            }
        }
    }
    for(i=0;i<n;i++){//出力
    printf("%lld",C[i][0]);
        for(j=1;j<l;j++){
            printf(" %lld",C[i][j]);
        }
        printf("\n");
    }
    return 0;
}


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

int main() {
  int a, b;
  cin >> a >> b;
  
  string x = "";
  string y = "";
  
  for (int i = 0; i < b; i++) {
    x += to_string(a);
  }
  for (int i = 0; i < a; i++) {
    y += to_string(b);
  }
  if (a < b) {
    cout << x << endl;
  } else {
    cout << y << endl;
  }
  return 0;
}

Measured memory_bytes: 256