akhauriyash/Code-Regression huggingface dataset:
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<utility>
#include<vector>
#include<queue>
#include<functional>
#include<map>
#include<set>
#include<cstring>
#include<string>
#include<stack>
#include<malloc.h>
#include<math.h>
using namespace std;
//#define int long long
typedef pair<int, int> pii;
typedef pair<int, char> pic;
typedef priority_queue<pii, vector<pii>, greater<pii> > RPQ;
#define mk make_pair
#define INF (1 << 30)
#define INFL (1ll << 60ll)
#define mod 1000000007

int H, W;
char fld[3030][3030];
int sum[3030][3030][3];

signed main(){
    cin >> H >> W;
    for(int i = 0; i < H; i++){
        cin >> fld[i];
    }
    for(int i = 0; i < H; i++){
        for(int j = 0; j < W; j++){
            if(fld[i][j] == 'J'){
                sum[i][j][0]++;
            }
            else if(fld[i][j] == 'O'){
                sum[i][j][1]++;
            }
            else {
                sum[i][j][2]++;
            }
        }
    }
    for(int i = 0; i < H; i++){
        for(int j = 1; j < W; j++){
            sum[i][j][1] += sum[i][j - 1][1];
        }
    }
    for(int i = 1; i < H; i++){
        for(int j = 0; j < W; j++){
            sum[i][j][2] += sum[i - 1][j][2];
        }
    }
    long long ans = 0;
    for(int i = 0; i < H; i++){
        for(int j = 0; j < W; j++){
            if(fld[i][j] == 'J'){
                ans += (long long)(sum[i][W - 1][1] - sum[i][j][1]) * (long long)(sum[H - 1][j][2] - sum[i][j][2]);
            }
        }
    }
    cout << ans << endl;
    


    return 0;
}

/*



*/


Measured memory_bytes: 118508
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		Scanner sc1 = new Scanner(System.in);

		String s = sc1.next();
		int ans = 0;

		for(int i = 0; i < 4; i++) {
			if(s.charAt(i) == '+') {
				ans++;
			}
			else {
				ans--;
			}
		}

		System.out.println(ans);

		sc1.close();

	}

}


Measured memory_bytes: 21716
//#pragma GCC optimize ("O3")
//#pragma GCC target ("sse4")

#include <bits/stdc++.h>

using namespace std;

#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "


// CHECK THE LIMITS
typedef long long ll;

const int MOD = 1000000007;
const ll INFLL = 1e18;
const int INF = 1e9;
const int NMAX = 1000001;

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

int n,m;
ll ct =0;
vector<string> lines(1005);

void add_self(ll &a, ll b)
{
    a+=b;
    if(a >= MOD)
    {
        a-=MOD;
    }
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cin >> n >> m;

    for(int i =0; i< n; ++i)
    {
        string s;
        cin >> lines[i];
    }

    vector<vector<ll> > dp (n, vector<ll> (m,0));
    dp[0][0] = 1;
    for(int i =0; i< n; ++i)
    {
        for(int j= 0; j< m; ++j)
        {
            if(lines[i][j+1] == '.')
                add_self(dp[i][j+1], dp[i][j]);
            if(lines[i+1][j] == '.')
                add_self(dp[i+1][j], dp[i][j]);
        }
    }
    cout << dp[n-1][m-1];
    return 0;
}

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

using namespace std;

#define int long long

int n;
int md = 1000000007;
int fact[1000010];
int bfact[1000010];

inline int mod(int x){
    return (x % md + md) % md;
}

inline int C(int n, int k){
    return mod(fact[n] * mod(bfact[k] * bfact[n-k]));
}

int binpow(int n, int k){
    if(k == 0) return 1;
    if(k & 1) return (binpow(n, k - 1) * n) % md;
    int t = binpow(n, k >> 1);
    return (t * t) % md;
}

main()
{
    ios_base::sync_with_stdio(false);
    int n;
    cin >> n;
    fact[0] = bfact[0] = 1;
    for(int i = 1; i <= n; i++){
        fact[i] = mod(fact[i-1] * i);
        bfact[i] = binpow(fact[i], md - 2);
    }
    int an = 0;
    int last = 0;
    for(int k = (n + 1) / 2; k < n; k++){
        int tmp = C(k - 1, n - 1 - k);
        tmp = mod(tmp * fact[k]);
        tmp = mod(tmp * fact[n-1-k]);
        int ttt = tmp;
        tmp = mod(tmp - last);
        last = ttt;
        an = mod(an + tmp * k);
    }
    cout << an << endl;
}


Measured memory_bytes: 15872
import java.util.Scanner

object Main {
  def main(args: Array[String]): Unit = {
    val in = new Scanner(System.in)
    val N = in.nextInt()
    val A = in.nextInt()
    val x = Array.ofDim[Int](N)
    x.indices foreach (i => x(i) = in.nextInt())
    System.out.println(solve(N, A, x))
  }

  def solve(N: Int, A: Int, x: Array[Int]): Long = {
    val dp = Array.ofDim[Long](N + 1, 100 * 50 + 1) // dp(i)(Aとの差の累積和, (-50, 50) を (0, 100)で表現している)
    dp(0)(2500) = 1 // 1まいも選んでないケースを１で初期化
    for {
      i <- 0 until N
      j <- 0 to 100 * 50
    } {
      val d = j + x(i) - A
      if (d >= 0 && d <= 5000) dp(i + 1)(d) += dp(i)(j) // i番目を選んだ場合
      dp(i + 1)(j) += dp(i)(j) // i番目を選ばなかった
    }
    dp(N)(2500) - 1 // １枚も選んでいないケースを省く
  }
}

Measured memory_bytes: 27952
// dile a la jardinera que traigo flores

#include <bits/stdc++.h>
#define ff first
#define ss second
#define pb push_back
#define sz(x) int(x.size())
#define all(v) (v).begin(),(v).end()
#define trace(x) cout << #x << " = " << x << endl
#define fastio ios_base::sync_with_stdio(0);cin.tie(0)
#define FER(i,a,b) for(int i = int(a); i < int(b); ++i)
#define IFR(i,a,b) for(int i = int(a); i >= int(b); i--)
using namespace std;
typedef long long ll;
typedef pair<int,int> ii;

set<ll>ss;

ll f(ll num){
	if(num&1)return 3*num+1;
	return num>>1;
}

int main(){	
	fastio;
	ll s;cin>>s;
	int i=1;
	while(true){
		if(ss.count(s))break;
		ss.insert(s);
		s=f(s);
		i++;
	}
	cout<<i<<endl;

	return 0;
}


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

namespace Atcoder2
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] str = Console.ReadLine().Split(' ');

            int N = int.Parse(str[0]);
            int K = int.Parse(str[1]);

            long ans = 0;

            for(int b = 1; b <= N; b++)
            {
                ans += (N / b) * Math.Max(b - K, 0) + Math.Max((N % b) - K + 1, 0);
            }
            if (K == 0)
            {
                ans -= N;
            }

            Console.WriteLine(ans);
        }
    }
}


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

#define FOR(i, num) for (i = 0; i < num; i++)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define ALL(obj) (obj).begin(), (obj).end()

using namespace std;

array<array<bool, 100>, 100> status; // y x trueなら黒
array<array<int, 100>, 100> res;

void dfs(int cur_x, int cur_y, int prev_count, bool is_reverse_prev)
{
    // もし前のマスでひっくり返していたら、今回はカウントを上げなくても良い。

    int cur_count = prev_count;
    bool is_reverse = false;
    if (status[cur_y][cur_x])
    {
        // このマスが黒で前回ひっくり返していないとき
        if (!is_reverse_prev)
        {
            // 今回ひっくり返す
            cur_count++;
            is_reverse = true;
        }
        else
        {
            // ひっくり返していたなら連続なのでカウントは上がらない
            is_reverse = true;
        }
    }
    // 最小なら反映して継続
    if (res[cur_y][cur_x] > cur_count)
    {
        res[cur_y][cur_x] = cur_count;

        int next_x = cur_x + 1;
        int next_y = cur_y + 1;
        if (next_x < 100)
        {
            dfs(next_x, cur_y, cur_count, is_reverse);
        }
        if (next_y < 100)
        {
            dfs(cur_x, next_y, cur_count, is_reverse);
        }
    }
}

int main()
{
    int N, M, K, i, k, H, W;

    FOR(i, 100)
    {
        status[i].fill(false);
    }
    FOR(i, 100)
    {
        res[i].fill(10101010);
    }

    cin >> H >> W;

    REP(i, H)
    {
        string input;
        cin >> input;
        REP(k, W)
        {
            status[i][k] = input[k] == '#';
        }
    }

    dfs(0, 0, 0, false);

    cout << res[H - 1][W - 1] << endl;

    return 0;
}

Measured memory_bytes: 256
use std::io::Read;

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();
    for c in buf.chars() {
        match c.is_lowercase() {
            true => println!("a"),
            false => println!("A"),
        }
        return
    }
}


Measured memory_bytes: 2132
N, M = map(int, input().split())        
                                        
x = []                                  
for i in range(M):                      
    l,r = map(int, input().split())     
    x.append([l, r])                    
                                        
                                        
cand = list(range(1, N+1))              
                                        
for i, p in enumerate(x):               
    l,r = p                             
    if (r < cand[0]) or (l > cand[-1]): 
        del cand[0:]                    
        break                           
                                        
    if cand[0] < l:                     
        del cand[:(l - cand[0])]        
    if cand[-1] > r:                    
        del cand[(r-cand[0]+1):]        
                                        
print(len(cand))                        


Measured memory_bytes: 24264
#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <vector>
#include <cstdio>
#include <bits/stdc++.h>
#include <set>
#include <map>
#include <stdio.h>
#include <stack>
#include <queue>
#include <deque>
#include <numeric>
#include <bits/stdc++.h>
#include <utility>
#include <iomanip>

#define ALL(obj) (obj).begin(), (obj).end()
#define FOR(i,a,b) for(int i = (a); i < (b); i++)
#define RFOR(i,a,b) for(int i = (a); (b) <= i; i--)
#define REP(i,n) for(int i = 0; i < (n); i++)
#define RREP(i,n) for(int i = n; n <= i; i--)
#define ABS(a) ((a < 0) ? ((-1)*(a)) : (a))
#define elif else if
#define MOD 1000000007
#define INF (1<<30)

using namespace std;

#define ld long double
#define ll long long

map <int ,int> mpa,mpb;
typedef pair<ll, ll> P;
priority_queue<P, vector<P>, greater<P>> pque;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  ll ans;
  ll A,B,C;
  cin >> A >> B >> C;
  cout << min(C,B/A) << endl;
  return 0;
}



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

using ll = long long;

#define pb push_back
#define ff first
#define ss second
#define all(a) a.begin(), a.end()
#define sz(a) (int)(a.size())
#define clr(a, b) memset(a, b, sizeof(a))
#define REP(i, a, b) for(int i=(int)(a); i<(int)(b); ++i)
#define REPD(i, a, b) for(int i=(int)(a)-1; i>=(int)(b); --i)

template<typename T> inline bool chkmin(T &a, const T &b) { return a > b ? a = b, 1 : 0; }
template<typename T> inline bool chkmax(T &a, const T &b) { return a < b ? a = b, 1 : 0; }

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

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int N;
    cin >> N;
    int res = 0;
    REP(i, 1, N) {
    	REP(j, 1, N) {
    		if(i*j >= N) break;
    		++res;
    	}
    }
    cout << res << "\n";
    return 0;
}


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

int main(){
    int L,R;
    cin >> L >> R;
    int mod = 2019;
    int lmod = L % mod;
    int rmod = R % mod;
    if (R - L > 2019){
        cout << 0 << endl;
        return 0;
    }
    else {
        long long  ans = 2018;
        for (long long i = L;i < R;i++){
            for (long long j = i + 1;j <= R;j++){
                ans = min(ans,(i * j) % mod);
            }
        }
        cout << ans << endl;
    }
}

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

class UnionFind{
    public:
    //親の番号を格納する。親だった場合は-(その集合のサイズ)
    vector<int> parent;

    //-1で初期化
    //最初はすべてバラバラ
    UnionFind(int N){
        parent = vector<int>(N,-1);
    }

    //Aがどのグループに属しているか(Aの根)を調べる
    int root(int A){
        if(parent[A] < 0) return A;
        return parent[A]=root(parent[A]);
    }

    //自分のいるグループの頂点数を調べる
    int size(int A){
        return -parent[root(A)];
    }

    //AとBをくっつける
    bool connect(int A, int B) {
    //AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
        A = root(A);
        B = root(B);
        //既にくっついているからくっつけない
        if(A == B) return false; 

        //大きいほう(A)に小さいほう(B)をくっつける
        //大証が逆ならひっくり返す
        if(size(A) < size(B)) swap(A,B);

        //Aのサイズを更新する
        parent[A] += parent[B];
        //Bの親をAに変更する
        parent[B] = A;

        return true;
    }

    //AとBが同じグループならtrueを返す
    bool same(int A, int B){
        return root(A)==root(B);
    } 
};

struct edge{
    ll from;
    ll to;
    ll cost;

    edge(ll a, ll b, ll c){
        from = a;
        to = b;
        cost = c;
    }
    bool operator < (const edge &another) const{
        return cost < another.cost;
    }
};



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

    ll n,m;
    cin>>n>>m;
    vector<edge> v;
    for(int i=0;i<m;i++){
        ll f,t,c;
        cin>>f>>t>>c;
        
        v.push_back(edge(f,t,c));
    }
    sort(v.begin(), v.end());

    UnionFind uni(n);
    ll ans=0;
    for(int i=0;i<m;i++){
        if(!uni.same(v[i].from, v[i].to)){
            ans+=v[i].cost;
            uni.connect(v[i].to, v[i].from);
        }
    }
    cout<<ans<<endl;
    return 0;
    


}


Measured memory_bytes: 5924
// reference: https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

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

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

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

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

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

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

use std::cmp::Ordering;
use std::collections::BinaryHeap;

#[derive(Eq, PartialEq, Clone, Debug)]
pub struct Rev<T>(pub T);

impl<T: PartialOrd> PartialOrd for Rev<T> {
    fn partial_cmp(&self, other: &Rev<T>) -> Option<Ordering> {
        other.0.partial_cmp(&self.0)
    }
}

impl<T: Ord> Ord for Rev<T> {
    fn cmp(&self, other: &Rev<T>) -> Ordering {
        other.0.cmp(&self.0)
    }
}

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

fn main() {
    input! {
        n: usize,
        a: [i64; n]
    }

    let ans = a.into_iter().fold(0, |a, x| gcd(a, x));
    println!("{}", ans);
}


Measured memory_bytes: 6396
#if 1
#include <iostream>
#include <cmath>
#include <string>
#include <vector>
#include <climits>
#include <algorithm>
#include <unordered_set>
#include <unordered_map>
#include <functional>
#include <set>
#include <map>
#include <numeric>
#include <cassert>

using namespace std;
#define int long long
#define uint unsigned long long
constexpr int MOD = 1000000007;
constexpr int INF = 1145141919810;

#define LOADVEC(type,name,N) std::vector<type>name(N); \
for (int nnn = 0; nnn < N; ++nnn) { \
	cin >> name[nnn]; \
}

#define LOADVEC2(type,name0,name1,N) std::vector<type>name0(N),name1(N); \
for (int nnn = 0; nnn < N; ++nnn) { \
	cin >> name0[nnn];cin >> name1[nnn]; \
}

#define LOADVEC3(type,name0,name1,name2,N) std::vector<type>name0(N),name1(N),name2(N); \
for (int nnn = 0; nnn < N; ++nnn) { \
	cin >> name0[nnn];cin >> name1[nnn];cin >> name2[nnn]; \
}

#define LOAD(type,name) type name; \
cin >> name;


void proc();

signed main() {
	ios::sync_with_stdio(false);
	proc();
	return 0;
}

/*
--------------------------------------------------------
--------------------------------------------------------
---------------    template      ----------------------
--------------------------------------------------------
--------------------------------------------------------
*/


bool check() {
	LOAD(int, H);
	LOAD(int, W);
	LOAD(int, N);
	LOAD(int, sr);
	LOAD(int, sc);
	std::string S, T;
	cin >> S >> T;
	int begin = 0, end = W + 1;
	for (int n = N - 1; n >= 0; --n) {
		if (T[n] == 'L') {
			end = std::min({ W + 1,end + 1 });
		}
		if (T[n] == 'R') {
			begin = std::max({ 0ll,begin - 1 });
		}
		if (S[n] == 'R') {
			--end;
		}
		if (S[n] == 'L') {
			++begin;
		}
		if (begin + 1 >= end) {
			return false;
		}
	}
	if (sc <= begin || end <= sc)return false;
	begin = 0, end = H + 1;
	for (int n = N - 1; n >= 0; --n) {
		if (T[n] == 'U') {
			end = std::min({ H + 1,end + 1 });
		}
		if (T[n] == 'D') {
			begin = std::max({ 0ll,begin - 1 });
		}
		if (S[n] == 'D') {
			--end;
		}
		if (S[n] == 'U') {
			++begin;
		}
		if (begin + 1 >= end) {
			return false;
		}
	}
	if (sr <= begin || end <= sr)return false;
	return true;
}


void proc() {
	if (check()) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}
}


#endif


Measured memory_bytes: 920
#include <cstdio>

#define ll long long
#define maxn 100000

//FILE *fin = fopen("2.in","r");
//FILE *fout = fopen("2.out", "w");

int f[maxn + 1];
int main()
{
    int n, v[maxn + 1], cnt = 0;
    scanf("%d", &n);
    for (int i = 1; i <= n; i++)
        scanf("%d", &v[i]);
    int t = 1;
    int p = 0;
    while (t != 2 && p == 0) {
        if (f[t] == 1)
            p = 1;
        f[t] = 1;
        t = v[t];
        cnt++;
    }
    if (p == 1)
        printf("-1");
    else
        printf("%d", cnt);
    return 0;
}


Measured memory_bytes: 896
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define mod 1000000007
#define pb push_back
#define in(a) int a;cin>>a;
#define in2(a,b)in(a)in(b)
#define out(x) cout<<x<<endl;
#define out2(x,y) cout<<x<<" "<<y<<endl;


int32_t main() 
{ 
			in2(m,n);
			char a[m][n];
			for(int i=0;i<m;i++){
				for(int j=0;j<n;j++){
					cin>>a[i][j];
				}
			}
			int dp[m][n];
			for(int i=0;i<m;i++){
				for(int j=0;j<n;j++){
					dp[i][j]=0;
				}
			}
			dp[0][0]=1;	
			for(int i=0;i<m;i++){
				for(int j=0;j<n;j++){
					if(a[i][j]!='#' && (i+j)!=0){
						if(j!=0 && a[i][j-1]!='#'){
							dp[i][j]=(dp[i][j]%mod + dp[i][j-1]%mod)%mod;
						}
						if(i!=0 && a[i-1][j]!='#'){
							dp[i][j]=(dp[i][j]%mod + dp[i-1][j]%mod)%mod;
						}
					}
				}
			}
			// for(int i=0;i<m;i++){
				// for(int j=0;j<n;j++){
					// cout<<dp[i][j]<<" ";
				// }
				// cout<<endl;
			// }
			out(dp[m-1][n-1])
		return 0;
} 

Measured memory_bytes: 9088
n = int(input())
a = list(map(int, input().split()))

if n%2 == 0:
    dp = a[:2]
    for i in range(1, n//2):
        dp = dp[0] + a[2*i], max(dp) + a[2*i+1]
else:
    dp = a[:3]
    for i in range(1, n//2):
        dp = dp[0] + a[2*i], max(dp[:2]) + a[2*i+1], max(dp) + a[2*i+2]

print(max(dp))

Measured memory_bytes: 94100
#include<iostream>
using namespace std;
 
int main(){
 
int a,b;
 
cin >> a>>b;
 
if(a>b) cout<<"a > b"<<endl;
else if(a<b) cout<<"a < b"<<endl;
else cout<<"a == b"<<endl;
 
 
return 0;
 
}


Measured memory_bytes: 3088
#include <iostream>
#include <stdio.h>

using namespace std;

int X[5];

int main() {
  int n = 0;
  int idx = 0;
  for (int i = 0; i < 5; ++i) {
    cin >> X[i];
    int m = (10 - X[i] % 10) % 10;
    if (n < m) {
      n = m;
      idx = i;
    }
  }
  int res = 0;
  for (int i = 0; i < 5; ++i) {
    if (i != idx) {
      res += ((10 - X[i] % 10) % 10) + X[i];
    }
  }
  printf("%d\n", res + X[idx]);
}


Measured memory_bytes: 3216
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (n); i++)
typedef long long int ll;
typedef pair<int, int> P;
const ll MOD = 1e9+7, INF = 1e9;

int main()
{
  string s;
  cin >> s;
  s[3] = '8';
  cout << s << endl;
  system("pause");
}


Measured memory_bytes: 504
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
const int MOD = 1000000007;
const int INF = 1000000000;
const ll LINF = 1ll<<50;
template<typename T>
void printv(const vector<T>& s) {
  for(int i=0;i<(int)(s.size());++i) {
    cout << s[i];
    if(i == (int)(s.size())-1) cout << endl;
    else cout << " ";
  }
}
using Point = std::complex<ld>;
const ld eps = 1e-9, pi = acos(-1.0);
namespace std {
bool operator<(const Point &lhs, const Point &rhs) {
  if (lhs.real() < rhs.real() - eps) return true;
  if (lhs.real() > rhs.real() + eps) return false;
  return lhs.imag() < rhs.imag();
}
}
Point input_point() {
  ld x, y;
  std::cin >> x >> y;
  return Point(x, y);
}
bool eq(ld a, ld b) { return (abs(a - b) < eps); }
ld dot(Point a, Point b) { return real(conj(a) * b); }
ld cross(Point a, Point b) { return imag(conj(a) * b); }
int ccw(Point a, Point b, Point c) {
  b -= a;
  c -= a;
  if (cross(b, c) > eps) return 1;
  if (cross(b, c) < -eps) return -1;
  if (dot(b, c) < 0) return 2;
  if (norm(b) < norm(c)) return -2;
  return 0;
}
class Line {
 public:
  Point a, b;
  Line() : a(Point(0, 0)), b(Point(0, 0)) {}
  Line(Point a, Point b) : a(a), b(b) {}
};
ld dot(Line l, Line m) { return dot((l.a - l.b), (m.a - m.b)); }
class Circle {
 public:
  Point p;
  ld r;
  Circle() : p(Point(0, 0)), r(0) {}
  Circle(Point p, ld r) : p(p), r(r) {}
};
ld degree_ll(Line l, Line m) {
  ld cos_shita = dot(l, m) / (abs(l.b - l.a) * abs(m.b - m.a));
  if (cos_shita < -1.0) cos_shita = -1.0;
  if (cos_shita > 1.0) cos_shita = 1.0;
  ld shita = acos(cos_shita);
  return shita;
}
ll dist(pair<ll, ll> p1, pair<ll, ll> p2) {
  return (p1.first - p2.first) * (p1.first - p2.first) + (p1.second - p2.second) * (p1.second - p2.second);
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  int n; cin >> n;
  if(n%2) {
    cout << "NA" << endl;
    return 0;
  }
  ld nowx = 0, nowy = 0;
  vector<Point> v;
  for(int i=0;i<n;++i) {
    ll x, y; cin >> x >> y;
    nowx += x; nowy += y;
    v.push_back(Point(x, y));
  }
  nowx /= n;
  nowy /= n;
  Point ans(nowx, nowy);
  bool ok = true;
  for(int i=0;i<n/2;++i) {
    ld d1 = abs(v[i] - ans);
    ld d2 = abs(v[i+n/2] - ans);
    if(abs(d1 - d2) > eps) {
      ok = false;
      break;
    }
  }
  if(ok) cout << ans.real() << " " << ans.imag() << endl;
  else cout << "NA" << endl;
}



Measured memory_bytes: 3340
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;
using static System.Math;
using System.Numerics;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
            Solve();
            //Out.Flush();
            Read();
        }

        static void Solve()
        {
            var (X, Y) = Slice2<long>();
            WriteLine(X + Y / 2);
        }


        static long Mod = (long)1e9 + 7;
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }
        static public (T1 a, T2 b) Slice<T1, T2>()
        {
            var t = ReadLine().Split();
            return (
            (T1)Convert.ChangeType(t[0], typeof(T1)),
            (T2)Convert.ChangeType(t[1], typeof(T2)));
        }
        static public (T a, T b) Slice2<T>()
        {
            var t = ReadLine().Split();
            return (
            (T)Convert.ChangeType(t[0], typeof(T)),
            (T)Convert.ChangeType(t[1], typeof(T)));
        }
        static public (T a, T b, T c) Slice3<T>()
        {
            var t = ReadLine().Split();
            return (
            (T)Convert.ChangeType(t[0], typeof(T)),
            (T)Convert.ChangeType(t[1], typeof(T)),
            (T)Convert.ChangeType(t[2], typeof(T)));
        }
        static public (T a, T b, T c, T d) Slice4<T>()
        {
            var t = ReadLine().Split();
            return (
            (T)Convert.ChangeType(t[0], typeof(T)),
            (T)Convert.ChangeType(t[1], typeof(T)),
            (T)Convert.ChangeType(t[2], typeof(T)),
            (T)Convert.ChangeType(t[3], typeof(T)));
        }
    }
}

Measured memory_bytes: 27516
#include<stdio.h>

#define maxRow 10
#define maxCol 10000
int rows,cols;
int a[maxRow][maxCol];
int r[maxRow];
int max_num=0;

void dfs(int step){
	if(step == rows){
		int num,total=0;
		for(int j = 0; j < cols; j++)
		{
			num = 0;
			for(int i = 0; i < rows; i++){
				if(r[i] == -1 && a[i][j] == 0)num++;
				else if(r[i] == 1 && a[i][j] == 1)num++;
			}
			if(num > rows/2)total += num;
			else total += (rows - num);
		}
		if(total > max_num)max_num = total;

	}
	else{
		r[step] = -1;dfs(step+1);
		r[step] = 1;dfs(step+1);
	}
}

int main(){
	while(scanf("%d%d",&rows,&cols),rows||cols){
		max_num = 0;
		for(int i = 0; i < rows; i++)
			for(int j = 0; j < cols; j++)
				scanf("%d",&a[i][j]);
		dfs(0);
		printf("%d\n",max_num);
	}
	return 0;
}

Measured memory_bytes: 1416
#include<bits/stdc++.h>
using namespace std;
#define MAXN (int)(1e5+5)
int main(){
	int n;
  long long w;
  cin>>n>>w;
  vector<long long> dp(MAXN,LLONG_MAX);
  for(int i=0;i<n;i++){
  	long long val,wt;cin>>wt>>val;
    vector<long long>newdp(MAXN,LLONG_MAX);
      for(int j=0;j<MAXN;j++){
		if(i==0){
        	if(j==val){
            	newdp[j]=wt;	
            }
            if(j==0)newdp[j]=0;
        }
        else{
          	newdp[j]=dp[j];
        	if(val<=j && dp[j-val]!=LLONG_MAX){
    	      	newdp[j]=min(newdp[j],dp[j-val]+wt);
	          }	
        	}
  		}
    	dp=newdp;
	}
	long long ans=0;
	for(int i=0;i<MAXN;i++){
		if(dp[i]<=w)ans=max(ans,(long long)i);
	}
	cout<<ans<<endl;
}	


Measured memory_bytes: 1792
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <string>
#include <cmath>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <list>
#include <iostream>
#include <sstream>
#include <climits>
#include <cfloat>

typedef long long ll;

using namespace std;

int main()
{
	int n;
	scanf("%d", &n);
	while (n--)
	{
		int puzzle[9][9];
		for (int i = 0; i < 9; ++i)
		{
			for (int j = 0; j < 9; ++j)
			{
				int t;
				scanf("%d", &t);
				puzzle[i][j] = t;
			}
		}

		bool dame[9][9];
		memset(dame, 0, sizeof(dame));
		for (int i = 0; i < 9; ++i)
		{
			vector<pair<int, int> > v[10];
			vector<pair<int, int> > h[10];
			for (int j = 0; j < 9; ++j)
			{
				v[puzzle[j][i]].push_back(make_pair(j, i));
				h[puzzle[i][j]].push_back(make_pair(i, j));
			}
			for (int j = 1; j < 10; ++j)
			{
				if (v[j].size() > 1)
					for (int k = 0; k < v[j].size(); ++k)
						dame[v[j][k].first][v[j][k].second] = true;
				if (h[j].size() > 1)
					for (int k = 0; k < h[j].size(); ++k)
						dame[h[j][k].first][h[j][k].second] = true;
			}
		}

		for (int i = 0; i < 3; ++i)
		{
			for (int j = 0; j < 3; ++j)
			{
				vector<pair<int, int> > c[10];
				for (int k = 0; k < 3; ++k)
				{
					for (int l = 0; l < 3; ++l)
					{
						int ty = i*3 + k;
						int tx = j*3 + l;
						c[puzzle[ty][tx]].push_back(make_pair(ty, tx));
					}
				}
				for (int k = 1; k < 10; ++k)
					if (c[k].size() > 1)
						for (int l = 0; l < c[k].size(); ++l)
							dame[c[k][l].first][c[k][l].second] = true;
			}
		}

		for (int i = 0; i < 9; ++i)
		{
			for (int j = 0; j < 9; ++j)
				printf("%c%d", dame[i][j] ? '*' : ' ', puzzle[i][j]);
			printf("\n");
		}
		if (n)
			printf("\n");
	}
	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
typedef long long ll;
typedef pair<int, int> P;
const int INF = 100100100;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
int main() {
  int X, Y, N;
  cin >> N >> X >> Y,X--,Y--;
  vector<ll> K(N,0);
  REP(i, N) {
    for (int j = i + 1; j < N; j++) {
      ll tmp = j - i;
      ll tmp2 = abs(j - X) + abs(i - Y) + 1;
      ll tmp3 = abs(j - Y) + abs(i - X) + 1;
      tmp = min(tmp, min(tmp2, tmp3));
      K[tmp]++;
    }
  }
  REP(i, N - 1) { cout << K[i + 1] << endl; }
}

Measured memory_bytes: 256
fun main(args:Array<String>){
    val(m,d)= readLine()!!.split(" ").map{
        it.toInt()
    }
    if(d<22){
        println(0)
    }
    else{
        var ans=0
        for(i in 1..m){
            for(j in 1..d){
                val s=j.toString()
                if(s.length>1){
                    val a=s[0].toString().toInt()
                    val b=s[1].toString().toInt()
                    if(a>=2&&b>=2&&i==a*b){
                        ans++
                    }
                }
            }
        }
        println(ans)
    }
}


Measured memory_bytes: 38396
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000
vector<int> G[100010];

int dp[100010];
bool used[100010];

int dfs(int v) {
    if (used[v]) return dp[v];
    used[v] = true;
    int len = 0;
    for(auto next: G[v]) {
        //cout << v + 1<< "->" << next + 1 << endl;
        len = max(len, dfs(next) + 1);
    }
    return dp[v] = len;
}

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, M;
    cin >> N >> M;
    bool start[100010] = {};
    rep(i, M) {
        int x, y; cin >> x >> y;
        x--; y--;
        G[x].push_back(y);
    }
    int ans = 0;
    rep(i, N) {
        ans = max(ans, dfs(i));
    }
    //rep(i, N) cout << "*" << i + 1 << " " << dp[i] << endl;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 8320
#include<iostream>
#include<math.h>
using namespace std;

int main() {
	auto F = [](int a, int b) {
		int cnt1 = 0, cnt2 = 0;
		while (a) {
			a /= 10;
			cnt1++;
		}
		while (b) {
			b /= 10;
			cnt2++;
		}
		return (cnt1 > cnt2 ? cnt1 : cnt2);
	};
	long long n, ans; cin >> n;
	ans = F(1, n);
	for (int i = 2; i <= sqrt(n); i++) {
		if (n % i == 0) {
			if (ans > F(i, n / i)) {
				ans = F(i, n / i);
			}
		}
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
#define N 20010
using namespace std;
typedef long long ll;
inline int read()
{
	int x=0,f=1; char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1; ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0'; ch=getchar();}
	return x*f;
}
struct edge
{
	int u,v,next;
}vs[N*30*2];
int n,st[N*7],ee,las,id[N],nd[N*7],idx[N];
int X[N],Y[N],V[N];
int dfn[N*7],low[N*7],tim,vis[N*7],op[N],tot,bl[N*7];
stack <int> St;
 
inline void addedge(int u,int v)
{
	vs[++ee].v=v;vs[ee].next=st[u];st[u]=ee;
}
 
inline bool cmp(const int a,const int b)
{
	return V[a]<V[b];
}
void built(int l,int r,int rt)
{
	nd[rt]=++las;
	if(l==r)
	{
		addedge(nd[rt],op[l]);
		return ;
	}
	int mid=(l+r)>>1;
	built(l,mid,rt<<1);
	built(mid+1,r,rt<<1|1);
	addedge(nd[rt],nd[rt<<1]);
	addedge(nd[rt],nd[rt<<1|1]);
}
void linkedge(int L,int R,int x,int l,int r,int rt)
{
	if(L<=l&&r<=R)
	{
		addedge(x,nd[rt]);
		return ;
	}
	int mid=(l+r)>>1;
	if(mid>=L) linkedge(L,R,x,l,mid,rt<<1);
	if(mid<R) linkedge(L,R,x,mid+1,r,rt<<1|1);
}
void dfs(int rt)
{
	vis[rt]=1; dfn[rt]=low[rt]=++tim;
	St.push(rt);
	for(int i=st[rt];i;i=vs[i].next)
	{
		if(vis[vs[i].v])
		{
			low[rt]=min(low[rt],dfn[vs[i].v]);
		}
		else if(!dfn[vs[i].v])
		{
			dfs(vs[i].v);
			low[rt]=min(low[rt],low[vs[i].v]);
		}
	}
	if(low[rt]==dfn[rt])
	{
		++tot;
		while(St.top()!=rt)
		{
			bl[St.top()]=tot;
			vis[St.top()]=0;
			St.pop();
		}
		St.pop(); bl[rt]=tot; vis[rt]=0;
	}
}
bool check(int x)
{
	memset(st,0,sizeof st);
	ee=0; las=n+n; tim=0;
	built(1,n+n,1);
	for(int i=1;i<=n+n;i++)
	{
		int pr=upper_bound(V+1,V+1+n+n,V[i]-x)-V;
		int nx=lower_bound(V+1,V+1+n+n,V[i]+x)-V-1;
		if(pr<i) linkedge(pr,i-1,i,1,n+n,1);
		if(nx>i) linkedge(i+1,nx,i,1,n+n,1);
	}
	for(int i=1;i<=las;i++) vis[i]=dfn[i]=low[i]=0;
	for(int i=1;i<=las;i++) if(!dfn[i]) dfs(i);
	for(int i=1;i<=n+n;i++) if(bl[i]==bl[op[i]]) return 0;
	return 1;
}
int main()
{
	//freopen("read.in","r",stdin);
	n=read();
	for(int i=1;i<=n;i++)
		X[i]=read(),Y[i]=read(),
		V[++V[0]]=X[i],id[V[0]]=V[0],
		V[++V[0]]=Y[i],id[V[0]]=V[0];
	sort(id+1,id+1+n+n,cmp);
	for(int i=1;i<=n+n;i++) idx[id[i]]=i;
	for(int i=1;i<=n+n;i++) op[i]=idx[(id[i]&1)? id[i]+1: id[i]-1];
	sort(V+1,V+1+n+n);
	int l=0,r=1000000000,ans;
	while(l<=r)
	{
		int mid=(l+r)>>1;
		if(check(mid)) ans=mid,l=mid+1;
		else r=mid-1;
	}
	printf("%d\n",ans);
}

Measured memory_bytes: 15872
#include <iostream>
#include <map>
#include <set>
#include <string>
#include<string.h>
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <queue>
#include <vector>
using namespace std;
typedef long long ll;
int main(){
    int a,b,c;
    scanf("%d%d%d",&a,&b,&c);
    if(a==b) printf("%d\n",c);
    else if(a==c) printf("%d\n",b);
    else printf("%d\n",a);
	return 0;
}


Measured memory_bytes: 256
#include <cassert>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>
#include <random>
#include <memory>
#include <utility>
#include <limits>
#include "limits.h"
 
#define rep(i, a, b) for (long long (i) = (a); i < (b); i++)
#define all(i) i.begin(), i.end()
#define debug(...) std::cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

void debug_out(){std::cerr<<std::endl;}

template<typename Head,typename... Tail>
void debug_out(Head h,Tail... t){
  std::cerr<<" "<<h;
  debug_out(t...);
}

 
template <typename T1, typename T2>
std::ostream& operator<<(std::ostream& os, std::pair<T1, T2> pa) {
  return os << pa.first << " " << pa.second;
}
 
template <typename T>
std::ostream& operator<<(std::ostream& os, std::vector<T> vec) {
  for (int i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
  return os;
}
 
template<typename T1,typename T2>
inline bool chmax(T1& a,T2 b){return a<b && (a=b,true);}
 
template<typename T1,typename T2>
inline bool chmin(T1& a,T2 b){return a>b && (a=b,true);}
 
long long pow_mod(long long a, long long b, long long mod=-1) {
  if(b==0)return 1;

  if ((a == 0)||(mod!=-1&&(a+mod)%mod==0)) {
    return 0;
  }
 
  long long x = 1;
 
  while (b > 0) {
    if (b & 1) {
      x = (mod!=-1)?(x * a) % mod:x*a;
    }
    a = (mod!=-1)?(a * a) % mod:a*a;
    b >>= 1;
  }
  return x;
}
 
const long long MOD = 998244353;
// const long long MOD = 1e9 + 7;

using ll = long long;
using P = std::pair<long long, long long>;

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

  ll n;
  std::cin>>n;

  ll temp=n;
  bool isok=false;
  while(temp>0){
    if(temp!=1&&temp%2==1){
      isok=true;
      break;
    }
    temp>>=1;
  }

  if(!isok){
    std::cout<<"No\n";
    return 0;
  }

  std::cout<<"Yes\n";

  if(n%2){
    rep(i,1,3){
      std::cout<<i<<" "<<i+1<<"\n";
      std::cout<<n+i<<" "<<n+i+1<<"\n";
    }
    std::cout<<3<<" "<<n+1<<"\n";

    for(ll i=4;i<=n;i+=2){
      std::cout<<i<<" "<<n+1<<"\n";
      std::cout<<i<<" "<<i+1<<"\n";
      std::cout<<n+i+1<<" "<<n+1<<"\n";
      std::cout<<n+i+1<<" "<<n+i<<"\n";
    }
  }else{
    rep(i,1,3){
      std::cout<<i<<" "<<i+1<<"\n";
      std::cout<<n+i<<" "<<n+i+1<<"\n";
    }
    std::cout<<3<<" "<<n+1<<"\n";

    for(ll i=4;i<=n-1;i+=2){
      std::cout<<i+1<<" "<<n+1<<"\n";
      std::cout<<i+1<<" "<<i<<"\n";
      std::cout<<n+i<<" "<<n+1<<"\n";
      std::cout<<n+i<<" "<<n+i+1<<"\n";
    }

    ll first=0,second=0;

    for(ll i=20;i>=0;i--){
      if((n+1)&(1ll<<i)){
        if(first+(1ll<<i)>=n){
          second+=(1ll<<i);
        }else{
          first+=(1ll<<i);
        }
      }
    }

    if(first%2){
      std::cout<<first<<" "<<n<<"\n";
      std::cout<<n+second<<" "<<2*n<<"\n";
    }else{
      std::cout<<second<<" "<<n<<"\n";
      std::cout<<n+first<<" "<<2*n<<"\n";
    }
  }

  return 0;
}

Measured memory_bytes: 2816
#include<bits/stdc++.h>
using namespace std;
#define itn int
#define int long long
#define mod 1000000007
#define fi first
#define se second
#define be begin()
#define en end()
#define re reverse
#define Set setprecision 
const int INFi=2147483647;
const long long INFl=9223372036854775807LL;
template<typename T> T abs(T a,T b){
    return max(a,b)-min(a,b);
}
template<typename T> T lcm(T a,T b){//最小公倍数
  return (a*b)/gcd(a,b);
}
int  gcd(int a,int b){//最大公約数
  int c=a%b;
  while(true){
    if(c==0) break;
    a=b;
    b=c;
    c=a%b;
  }
  return b;
}
signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    map<int,int> q;
    int a,b;
    bool w=1;
    cin>>a;
    for(int i=0;i<a;i++){
	cin>>b;
	q[b]++;
	if(q[b]!=1) w=0;
    }
    if(w) cout<<"YES";
    else cout<<"NO";
    cout<<"\n";
}


Measured memory_bytes: 12800
#include <bits/stdc++.h>
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
constexpr int MOD = 1000000007;
constexpr int INF = numeric_limits<int>::max() / 2;
typedef pair<int,int> P;
using Graph = vector<vector<int>>;



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

	int N;
	cin >> N;
	vector<P> A(N);
	rep(i,N){
		cin >> A[i].first;
		A[i].second = i;
	}
	sort(A.begin(), A.end());
	reverse(A.begin(), A.end());
	int dp[N+1][N+1]{};
	rep(i,N){
		rep(j,i+1){
			dp[i+1][j+1] = max(dp[i+1][j+1], dp[i][j] + A[i].first * abs(A[i].second - j) );
			dp[i+1][j] = max(dp[i+1][j], dp[i][j] + A[i].first * abs(A[i].second - (N-1-(i-j) ) ) );
		}
	}
	int ans = 0;
	rep(i,N+1){
		ans = max(ans, dp[N][i]);
	}
	cout << ans << endl;
}

Measured memory_bytes: 34980
import java.util.*;
class Main {
    public static void main(String[] args) {
        int[] a = new int[1000000];
        Scanner sc = new Scanner(System.in);
        a[0] = sc.nextInt();
        int m = 0;
        while(!(a[m]==4 || a[m]==2 || a[m]==1)) {
            if(a[m]%2 == 0) a[m+1] = a[m]/2;
            else a[m+1] = 3*a[m] + 1;
            m++;
        }
        System.out.println((m+1)+3);
    }
}

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

#define    ll     long long int

int n, m;
int g[55][55];
pair<int, int> edge[5005];
int vis[55];

int dfs(int u, int p)
{
    int i, v, c = 1;
    vis[u] = 1;
    for (i = 1; i <= n; i++) {
        if (vis[i] == 0 && g[u][i] == 1) {
            c += dfs(i, u);
        }
    }
    return c;
}

int main( )
{
    int i, j, k;
    cin >> n >> m;
    for (i = 1; i <= m; i++) {
        cin >> j >> k;
        edge[i] = make_pair(j, k);
        g[j][k] = 1;
        g[k][j] = 1;
    }
    int c = 0;
    for (i = 1; i <= m; i++) {
        j = edge[i].first;
        k = edge[i].second;
        g[j][k] = 0;
        g[k][j] = 0;
        memset(vis, 0, sizeof vis);
        int d = dfs(1, -1);
        //cout << i << ' ' << d << '\n';
        if (d != n) {
            c++;
        }
        g[j][k] = 1;
        g[k][j] = 1;
    }
    cout << c << '\n';
    return 0;
}



Measured memory_bytes: 256
using static System.Console;

class Program
{
    static void Main(string[] args)
    {
        string[] input = ReadLine().Split(' ');
        int K = int.Parse(input[0]);
        int X = int.Parse(input[1]);
        if(500 * K >= X)
        {
            WriteLine("Yes");
        }
        else
        {
            WriteLine("No");
        }
    }
}

Measured memory_bytes: 13140
#include <bits/stdc++.h>
using namespace std;
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;
}
typedef long long int ll;

#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define endl "\n"
const double EPS = 1e-7;
const int INF = 1 << 30;
const ll LLINF = 1LL << 60;
const double PI = acos(-1);
const int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

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

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, m;
    cin >> n >> m;
    vector<int> a(n);
    for(int i = 0; i < n; i++) {
        cin >> a[i];
    }
    int sum = accumulate(ALL(a), 0);
    sort(RALL(a));
    int ans = 0;
    for(int i = 0; i < n; i++) {
        if(4 * m * a[i] < sum) {
            continue;
        }
        ans++;
    }
    cout << (ans >= m ? "Yes" : "No") << endl;
}

Measured memory_bytes: 256
# include "bits/stdc++.h"
using namespace std;
using LL = long long;
using ULL = unsigned long long;
const double PI = acos(-1);
template<class T>constexpr T INF() { return ::std::numeric_limits<T>::max(); }
template<class T>constexpr T HINF() { return INF<T>() / 2; }
template <typename T_char>T_char TL(T_char cX) { return tolower(cX); };
template <typename T_char>T_char TU(T_char cX) { return toupper(cX); };
const int vy[] = { -1, -1, -1, 0, 1, 1, 1, 0 }, vx[] = { -1, 0, 1, 1, 1, 0, -1, -1 };
const int dx[4] = { 0,1,0,-1 }, dy[4] = { 1,0,-1,0 };
int popcnt(unsigned long long n) { int cnt = 0; for (int i = 0; i < 64; i++)if ((n >> i) & 1)cnt++; return cnt; }
int d_sum(LL n) { int ret = 0; while (n > 0) { ret += n % 10; n /= 10; }return ret; }
int d_cnt(LL n) { int ret = 0; while (n > 0) { ret++; n /= 10; }return ret; }
LL gcd(LL a, LL b) { if (b == 0)return a; return gcd(b, a%b); };
LL lcm(LL a, LL b) { LL g = gcd(a, b); return a / g*b; };
# define ALL(qpqpq)           (qpqpq).begin(),(qpqpq).end()
# define UNIQUE(wpwpw)        sort(ALL((wpwpw)));(wpwpw).erase(unique(ALL((wpwpw))),(wpwpw).end())
# define LOWER(epepe)         transform(ALL((epepe)),(epepe).begin(),TL<char>)
# define UPPER(rprpr)         transform(ALL((rprpr)),(rprpr).begin(),TU<char>)
# define FOR(i,tptpt,ypypy)   for(LL i=(tptpt);i<(ypypy);i++)
# define REP(i,upupu)         FOR(i,0,upupu)

struct INIT{
    INIT(){
        std::ios::sync_with_stdio(false);
        std::cin.tie(0);
        cout << fixed << setprecision(13);
    }
}INIT;

int n;
int k;
int a[101];
bool is_win[101010];
int main(){
    cin >> n >> k;
    REP(i, n)cin >> a[i];
    for(int i = 1;i <= k;i++){
        bool flg = false;
        REP(j, n){
            if(a[j] > i)continue;
            if(!is_win[i - a[j]])flg = true;
        }
        is_win[i] = flg;
    }
    cout << (is_win[k] ? "First" : "Second") << endl;
}

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

using Matrix = vector< vector<int> >;
const int INF = 1 << 30;
int W, H, ans = 0;
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
 
void dfs(Matrix &mat, int turn, int pos_x, int pos_y) {
    if(turn > 10) return;
    for(int k=0; k<4; k++) {
        int nx = pos_x, ny = pos_y;
        int px = nx + dx[k], py = ny + dy[k];
        if(px < 0 || px >= H || py < 0 || py >= W) continue;
        if(mat[px][py] == 1) continue;
 
        while(1) {
            nx += dx[k], ny += dy[k];
            if(nx < 0 || nx >= H || ny < 0 || ny >= W) {
                // out of range
                break;
            }
            else if(mat[nx][ny] == 3) {
                // goal
                ans = min(ans, turn);
                break;
            }
            else if(mat[nx][ny] == 1) {
                // obstacle
                mat[nx][ny] = 0;
                dfs(mat, turn+1, nx-dx[k], ny-dy[k]);
                mat[nx][ny] = 1;
                break;
            }
        }
    }
}
 
int main() {
    while(cin >> W >> H, W) {
        ans = INF;
        Matrix mat(H, vector<int>(W));
 
        int x = 0, y = 0;
        for(int i=0; i<H; i++) {
            for(int j=0; j<W; j++) {
                cin >> mat[i][j];
                if(mat[i][j] == 2) {
                    x = i, y = j;
                }
            }
        }
 
        dfs(mat, 1, x, y);
        cout << (ans == INF ? -1 : ans) << endl;
    }
    return 0;
}


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

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

ll N;
ll A[101];

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

	cin>>N;
	ll res = 0;
	for(int i=1; i<=N; i++){
		cin>>A[i];
		if((i % 2) && A[i]%2){
			res++;
		}
	}
	cout<<res<<endl;

    return 0;
}






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

max = 0
current = 0

1.upto(N - 1) do |i|
  if H[i - 1] >= H[i]
    current += 1
  else
    current = 0
  end
  max = current if max < current
end

puts max


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

def main():
  n = int(input())
  T = [[] for _ in range(n)]
  D = {}
  for i in range(n-1):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    T[a].append(b)
    T[b].append(a)
    D[(a, b)] = 1<<i
    D[(b, a)] = 1<<i
  m = int(input())

  def dfs(u, v):
    parent = [-1]*n
    seen = [False]*n
    stack = [u]
    seen[u] = True
    while stack:
      nv = stack[-1]
      if nv == v:
        return stack
      for i in T[nv]:
        if seen[i]:
          continue
        stack.append(i)
        seen[i] = True
        break
      else:
        stack.pop()

  def popcount(n):
    c = (n & 0x5555555555555555) + ((n>>1) & 0x5555555555555555)
    c = (c & 0x3333333333333333) + ((c>>2) & 0x3333333333333333)
    c = (c & 0x0f0f0f0f0f0f0f0f) + ((c>>4) & 0x0f0f0f0f0f0f0f0f)
    c = (c & 0x00ff00ff00ff00ff) + ((c>>8) & 0x00ff00ff00ff00ff)
    c = (c & 0x0000ffff0000ffff) + ((c>>16) & 0x0000ffff0000ffff)
    c = (c & 0x00000000ffffffff) + ((c>>32) & 0x00000000ffffffff)
    return c
              
  E = [0]*m
  for i in range(m):
    u, v = map(int, input().split())
    u -= 1
    v -= 1
    edge = dfs(u, v)
    for j in range(len(edge)-1):
      E[i] |= D[(edge[j], edge[j+1])]

  ans = 0
  for i in range(2**m):
    s = 0
    for j in range(m):
      if i>>j & 1:
        s |= E[j]
    cnt = popcount(i) % 2
    ans += (-1)**cnt * 2**(n-1-popcount(s))
  print(ans)
  
if __name__ == "__main__":
  main()

Measured memory_bytes: 42988
#include <iostream>
using namespace std;
int main(){
int a,b,c,d,x,y;
  cin>>a>>b>>c>>d;
  x = (a+d-1)/d; 
  y = (c+b-1)/b;
  if (x>=y){
  	cout<<"Yes";
  }
  else{
  	cout<<"No";
  }
  
}

Measured memory_bytes: 3600
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
	int a[100];
	int n;
	cin >> n;
	for(int i=0;i<n;i++){
		cin >> a[i];
	}

	int max = 0;
	for(int i=0;i<n;i++){
		for(int j=0;j<n;j++){
			if(i<=j) break;
			int tmp = abs(a[i]-a[j]);
			if(tmp>max){
				max = tmp;
			}
		}
	}
    cout << max << endl;
    return 0;
}

Measured memory_bytes: 256