akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
int pdc,pdf;
int k;
int main(){
    string s;
    ios::sync_with_stdio(0);
    cin>>s;
    for(int i=0;i<s.length();++i){
        if(s[i]=='C'){
            pdc=1;
            k=i+1;
        }
    }
    if(pdc==0){
        cout<<"No";
        return 0;
    }
    for(int j=k;j<s.length();++j){
        if(s[j]=='F'){
            cout<<"Yes";
            return 0;
        }
    }
    cout<<"No";
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Text;

public class Program
{
    private int N;
    public void Solve()
    {
        var sc = new Scanner();
        N = sc.NextInt();
        for (int i = 0; i < N - 1; i++)
        {
            var line = new List<int>();
            for (int j = 1; j < N - i; j++)
            {
                line.Add((int) Math.Log(j & -j, 2) + 1);
            }
            Console.WriteLine(string.Join(" ",line));
        }
    }
    
    public static void Main(string[] args)
    {
        new Program().Solve();
    }
}

class Scanner
{
    public Scanner()
    {
        _pos = 0;
        _line = new string[0];
    }

    const char Separator = ' ';
    private int _pos;
    private string[] _line;

    #region スペース区切りで取得

    public string Next()
    {
        if (_pos >= _line.Length)
        {
            _line = Console.ReadLine().Split(Separator);
            _pos = 0;
        }

        return _line[_pos++];
    }

    public int NextInt()
    {
        return int.Parse(Next());
    }

    public long NextLong()
    {
        return long.Parse(Next());
    }

    public double NextDouble()
    {
        return double.Parse(Next());
    }

    #endregion

    #region 型変換

    private int[] ToIntArray(string[] array)
    {
        var result = new int[array.Length];
        for (int i = 0; i < array.Length; i++)
        {
            result[i] = int.Parse(array[i]);
        }

        return result;
    }

    private long[] ToLongArray(string[] array)
    {
        var result = new long[array.Length];
        for (int i = 0; i < array.Length; i++)
        {
            result[i] = long.Parse(array[i]);
        }

        return result;
    }

    private double[] ToDoubleArray(string[] array)
    {
        var result = new double[array.Length];
        for (int i = 0; i < array.Length; i++)
        {
            result[i] = double.Parse(array[i]);
        }

        return result;
    }

    #endregion

    #region 配列取得

    public string[] Array()
    {
        if (_pos >= _line.Length)
            _line = Console.ReadLine().Split(Separator);

        _pos = _line.Length;
        return _line;
    }

    public int[] IntArray()
    {
        return ToIntArray(Array());
    }

    public long[] LongArray()
    {
        return ToLongArray(Array());
    }

    public double[] DoubleArray()
    {
        return ToDoubleArray(Array());
    }

    #endregion
}

Measured memory_bytes: 15440
#pragma target("avx")
#pragma optimize("O3")
#include<bits/stdc++.h>
using ll = int_fast64_t;
using P = std::pair<ll,ll>;
using PP = std::pair<ll,P>;
using V = std::vector<ll>;
template<typename T> using pq = std::priority_queue<T>;
template<typename T> using rpq = std::priority_queue<T, std::vector<T>, std::greater<T>>;

#define REP(i,b,e) for(ll i=b; i<e; i++)
#define ALL(vec) vec.begin(),vec.end()
#define PRINT(vec) printf("[ ");for(auto &i:vec)printf("%ld ",i);puts("]");
#define SCAN(vec) for(auto &i:vec)scanf("%ld",&i)
#define fi first
#define se second

const int MOD = 1e9+7;
const ll INF = 1e18;
int dx[] = {0, 1, 0, -1, 1, 1, -1, -1}, dy[] = {1, 0, -1, 0, 1, -1, -1, 1};

int main(){
	const int MAX = 200002;
	char s[MAX];
	scanf("%s", s);

	ll ans = 0, a = 0;
	REP(i, 0, MAX){
		if(s[i]=='B' and s[i+1]=='C'){
			ans += a;
			i++;
		}else if(s[i]=='A') a++;
		else a = 0;
	}
	printf("%ld\n", ans);
	return 0;
}



Measured memory_bytes: 384
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<functional>
#include<cmath>
#include<set>
#include<random>
#include<map>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
const long long mod = 1000000007;
const long long inf = 11451419198109130;
typedef pair<int, int> P;
struct edge { int to, cost; };

int gcd(int a, int b) {
	if (!b)return a; return gcd(b, a%b);
}
map<int, char>M;
signed main() {
	int n, m; cin >> n >> m;
	string s, t; cin >> s >> t;
	int ans = n*m / gcd(n, m);
	for (int i = 0; i < n;i++) {
		M[i*ans / n] = s[i];
	}
	for (int j = 0; j < m; j++) {
		if (M.count(j*ans/m)!=0&&M[j*ans/m]!=t[j]) {
			puts("-1");
			return 0;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 6144
initial_input_num_of_str = input()
double_eyes_list = ['00']

# 4桁の数字を、３つに分ける。最初２文字、真ん中２文字、後ろ２文字
first_numbers = initial_input_num_of_str[0:2]
center_numbers = initial_input_num_of_str[1:3]
last_numbers = initial_input_num_of_str[-2:]

for i in range(11, 100, 11):
    double_eyes_list.append(str(i))

if first_numbers in double_eyes_list:
    print('Bad')
elif center_numbers in double_eyes_list:
    print('Bad')
elif last_numbers in double_eyes_list:
    print('Bad')
else:
    print('Good')

Measured memory_bytes: 8868
n = int(input())
a = list(map(int,input().split()))
a2 = [a[x] - (x + 1) for x in range(n)]
a2.sort()
c = n // 2
b = a2[c]
ans = 0
for i in range(n):
	ans += abs(a2[i] - b)
print(ans)

Measured memory_bytes: 26356
#ifndef BZ
#pragma GCC optimize "-O3"
#endif
#include <bits/stdc++.h>
#define FASTIO ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
#define rep(i, l, r) for (ll i = (l); i < (r); ++i)
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
#define pii pair<ll, ll>
#define pll pair<ll, ll>
#define pli pair<ll, ll> 
#define pdd pair<ld, ld> 
#define pb push_back
#define reset(x,v) memset(x,v,sizeof(x))
#define mod 1000000007
using namespace std;

int main(){
	FASTIO
	int n;
	cin >> n;
	int a[n];
	int c = 0;
	rep(i, 0, n){
		cin >> a[i];
		if((i + 1) % 2 == 1 && a[i] % 2 == 1)
			c++;
	}
	cout << c;
    return 0;
}

Measured memory_bytes: 3664
#include<bits/stdc++.h>
using namespace std;
const int maxn = 1e5+7;

set<pair<int,int>> vis;
bool visx[maxn],visy[maxn];
vector<int> gx[maxn],gy[maxn];

void dfs(int xory,bool turnX,long long&cntx,long long&cnty)
{
    if(turnX)
    {
        if(visx[xory])return;
        visx[xory]=1;
        cntx++;
        for(int y:gx[xory])
        {
            if(!visy[y])
                dfs(y,0,cntx,cnty);
        }
    }
    else
    {
        if(visy[xory])return;
        visy[xory]=1;
        cnty++;
        for(int x:gy[xory])
        {
            if(!visx[x])
                dfs(x,1,cntx,cnty);
        }
    }

}
int main()
{
    int n;
    cin>>n;
    
    for(int i=0;i<n;++i)
    {
        int x,y;
        cin>>x>>y;
        gx[x].push_back(y);
        gy[y].push_back(x);
    }
    long long ans = -n;
    for(int i=1;i<maxn;++i)
    {
        if(!visx[i])
        {
            long long sx=0,sy=0;
            dfs(i,1,sx,sy);
            ans += sx*sy;
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 11136
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define int long long
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e18;



signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    int n = s.size();
    vector<vector<int> > u(101, vector<int>(n));
    rep(i, 0, n){
        if(s[i] == 'R') u[0][i] = i + 1;
        else u[0][i] = i - 1;
    } 
    rep(i, 0, 100){
        rep(j, 0, n){
            int now = j;
            rep(k, 0, 10){
                now = u[i][now];
            }
            u[i + 1][j] = now;
        }
    }
    vector<int> ans(n);
    rep(i, 0, n){
        ans[u[100][i]]++;
    }
    for(int ii = 0; ii < ans.size(); ii++){
        if(ii) cout << ' ';
        cout << ans[ii];
    }
    cout << endl;
}

Measured memory_bytes: 80576
while 1:
 m,f,r=map(int,input().split());s=m+f
 if m==f==r<0:break
 if m*f<0 or s<30:print('F')
 elif(s<50)*(r<50):print('D')
 elif s<65:print('C')
 elif s<80:print('B')
 else:print('A')


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

namespace ABC102C_cs
{
    class Program
    {
        static void Main(string[] args)
        {
            int givenN = int.Parse(Console.ReadLine());
            if (givenN == 1)
            {
                Console.WriteLine("0");
                return;
            }
            var givenA = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            var changedA = LinearApproximation.ChangedArray(givenA);
            var center = LinearApproximation.Center(givenN);
            double median1 = changedA[center];
            double median2 = (changedA[center + 1]+median1)/2;
            var result1 = LinearApproximation.Sadness(givenA, median1);
            var result2 = LinearApproximation.Sadness(givenA, median2);
            Console.WriteLine(Math.Min(result1, result2));
        }
    }
    public static class LinearApproximation
    {
        public static int[] ChangedArray(int[] a)
        {
            var result = a.Select((x, i) => x - i - 1).OrderBy(x=>x).ToArray();
            return result;
        }
        public static int Center(int n)
        {
            return (n - 1) / 2;
        }
        public static double Sadness(int[] a, double b)
        {
            return a.Select((n, i) => Math.Abs(n - (b + i + 1))).Sum();
        }
    }
}



Measured memory_bytes: 37044
#include <bits/stdc++.h>
#include <assert.h>
#include <stdlib.h>

using namespace std;

#define MOD 1000000007

const int INF = 1e9;

typedef long long ll;
typedef pair<int, int> pii;
int n,h;
int dp[(ll)1e3+1][(ll)1e4+1];
int a[(ll)1e3+1];
int b[(ll)1e3+1];

int f(int i , int health) {
    if(health <= 0) return 0;
    if(i >= n) return INF;
    int &ret = dp[i][health];
    if(ret != -1) return ret;
    
    ret = min(b[i] + f(i+1, health - a[i]), b[i] + f(i, health - a[i]));
    ret = min(ret, f(i+1, health));

    return ret;

}
int main() {
    // oh hi mark
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int k;
    cin >> h >> k;
    cout << (int)ceil(1.0*h / k) << endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
int main()
{
    int n,d,x,y,cnt=0;
    long long int d_str,ans;
    scanf("%d %d",&n,&d);
    while(n--)
    {
        scanf("%d %d",&x,&y);
        d_str=llabs(d)*llabs(d);
        ans=(llabs(x)*llabs(x))+(llabs(y)*llabs(y));
        if(ans<=d_str)
            cnt++;
    }
    printf("%d",cnt);
    return 0;
}


Measured memory_bytes: 1720
#include <bits/stdc++.h>
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define RFOR(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define rep(i,n) FOR(i,0,(n))
#define REPS(i,n) FOR(i,1,(n)+1)
#define RREP(i,n) RFOR(i,0,(n))
#define rng(x) (x).begin(),(x).end()
#define rrng(x) (x).rbegin(),(x).rend()
#define debug(x) cout << #x << " = " << (x) << endl;
#define SORT(x) sort(rng(x))
#define RSORT(x) sort(rrng(x))
#define SUM(x) accumulate(rng(x),0)
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define uni(x) x.erase(unique(rng(x)),x.end())
#define SP << " " <<
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
const int mod = 1000000007;
const double EPS = 1e-9;
const int INF = (1<<30)-1;
const ll INFLL = (1LL<<62)-1;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
//cout << fixed << setprecision(10);

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

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

int main () {
  int n;
  cin >> n;
  vi a(n);
  rep(i,n) cin >> a[i];
  int cnt = 0;
  rep(i,n) {
    if (a[i] < 0) cnt++;
  }
  rep(i,n) a[i] = abs(a[i]);
  SORT(a);
  ll ans = (cnt%2==0 ? (ll)(a[0]): (ll)(-(a[0])));
  rep(i,n) {
    if (i == 0) continue;
    ans += (ll)(a[i]);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;
using ll = long long ;
using P = pair<int,int> ;
using pll = pair<long long,long long>;
constexpr int INF = 1e9;
constexpr long long LINF = 1e17;
constexpr int MOD = 1000000007;
constexpr double PI = 3.14159265358979323846;

struct Sieve {
        int n;
        vector<int> f,primes;
        
        Sieve(int n=1):n(n),f(n+1){
            f[0] = f[1] = -1;
            for(long long i=2;i<=n;++i){
                if(f[i]) continue;
                primes.push_back(i);
                f[i] = i;
                for(long long j = i*i;j <= n;j += i) {
                    if(!f[j]) f[j] = i;
                }
            }
        }
        
        bool isPrime(int x){return f[x] == x;}
        
        vector<int> factorList(int x){
            vector<int> res;
            while(x != 1){
                res.push_back(f[x]);
                x /= f[x];
            }
            return res;
        }
        
        vector<pair<int,int>> factor(int x){
            vector<int> fl = factorList(x);
            if(fl.size() == 0) return {};
            vector<pair<int,int>> res(1,pair<int,int>(fl[0],0));
            for(int p:fl){
                if(res.back().first == p){
                    res.back().second ++;
                }else{
                    res.emplace_back(p,1);
                }
            }
            return res;
        }

        long long divisorCalc(long long x){
            long long res = 1;
            long long now = -1;
            long long nowCnt = 0;
            while(x != 1){
                if(now==f[x]) ++ nowCnt;
                else{
                    res *= nowCnt + 1;
                    now = f[x];
                    nowCnt = 1;
                }
                x /= f[x];
            }
            res *= nowCnt+1;
            return res;
        }
        
};

int main(){
    ll n;
    cin >> n;
    ll ans = 0;
    Sieve sieve(n+1);
    for(ll i=1;i<=n;i++){
        ll res = sieve.divisorCalc(i);
        res = res * i;
        ans += res;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 46500
using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using E = System.Linq.Enumerable;

class Program
{
    static void Main(string[] args)
    {
      
        //入力を受け取る
        var HW = Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToArray();
        var H = HW[0];
        var W = HW[1];
        var N = long.Parse(Console.ReadLine());
        var A = Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToArray();
        var point = 0; //色を決めるポインター
        var ans = new long[H][];
        for(int i = 0; i< H ;i++){
          ans[i] = new long[W];
        }
      
        var flag = true;
        for(long i = 0;i < H;i++){
          if(flag){
            for(long j = W-1;j >= 0;j--){
              if(A[point] == 0){
                point++;
              }
              ans[i][j] = point+1;
              A[point]--;
            }
            flag = false;
          }else{
            for(long j = 0;j < W;j++){
              if(A[point] == 0){
                point++;
              }
              ans[i][j] = point+1;
              A[point]--;
            }
            flag = true;
          }
        }
      
      for(int i = 0; i< H ;i++){
        Console.WriteLine(String.Join(" ",ans[i]));
      }
    }
}

Measured memory_bytes: 13524
use std::io::{BufRead, Read};

pub struct Scanner<R>
where
    R: BufRead,
{
    reader: R,
}

impl<R> Scanner<R>
where
    R: BufRead,
{
    pub fn new(reader: R) -> Self {
        Self { reader }
    }

    pub fn next<T>(&mut self) -> T
    where
        T: ::std::str::FromStr,
        <T as ::std::str::FromStr>::Err: ::std::fmt::Debug,
    {
        self.reader
            .by_ref()
            .bytes()
            .map(|b| b.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>()
            .parse::<T>()
            .unwrap()
    }
}

use std::iter::*;

fn main() {
    let stdin = std::io::stdin();
    let stdin = stdin.lock();
    let mut sc = Scanner::new(stdin);

    let  s: String = sc.next();
    let mut s: Vec<char> = s.chars().collect();
    let n: i32 = sc.next();

    for _ in 0..n {
        let cmd: String = sc.next();
        let (start, end) = (sc.next::<usize>(), sc.next::<usize>());
        match cmd.as_str() {
            "print" => {
                println!("{}", String::from_iter(s[start..end+1].iter()));
            },
            "reverse" => {
                let (q,_) = s.split_at_mut(end+1);
                let (_,q) = q.split_at_mut(start);
                q.reverse();
            }
            "replace" => {
                let w: Vec<_> = sc.next::<String>().chars().collect();
                let tail = s.split_off(end+1);
                let _ = s.split_off(start);
                s.extend_from_slice(&w);
                s.extend_from_slice(&tail);
            },
            _ => panic!(""),
        }
    }
}



Measured memory_bytes: 5032
o=input()
e=input()
if len(o)==len(e):
    for i in range(len(o)):
        print(o[i],end="")
        print(e[i],end="")
elif len(o)>len(e):
    for i in range(len(e)):
        print(o[i],end="")
        print(e[i],end="")
    print(o[-1],end="")
else:
    for i in range(len(o)):
        print(o[i],end="")
        print(e[i],end="")
    print(e[-1],end="")

Measured memory_bytes: 38384
#pragma GCC optimize("O3")
#include<bits/stdc++.h> 
using namespace std;
using ll=long long;
using P=pair<ll,ll>;
template<class T> using V=vector<T>; 
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
const ll inf=(1e18);
//const ll mod=998244353;
const ll mod=1000000007;
ll GCD(ll a,ll b) {return b ? GCD(b,a%b):a;}
ll LCM(ll c,ll d){return c/GCD(c,d)*d;}
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
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 (a>b) { a=b; return 1; } return 0; }
int main(){
    ll n;
    cin>>n;
    V<ll> a(n);
    for(int i=0;i<n;i++)cin>>a[i];
    ll sum=0;
    for(int i=0;i<n;i++){
        sum+=a[i];
    }
    ll d=n*(n+1)/2;    
    if(sum%d!=0){
        cout<<"NO"<<"\n";
        return 0;
    }
    if(n==1){
        cout<<"YES"<<"\n";
        return 0;
    }
    ll times=sum/d,cnt=0;
    for(int i=0;i<n;i++){
        if(a[i]-a[(i+1)%n]>0){
            cnt+=(a[i]-a[(i+1)%n]+n-2)/(n-1);
        }
    }
    if((sum-cnt*d)%(d*n)==0)cout<<"YES"<<"\n";
     else cout<<"NO"<<"\n";

}


Measured memory_bytes: 3976
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include<cmath>
#include<limits>
#define ll long long
#define ALL(x) (x).begin(),(x).end()
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define int_INF 2147483647
#define pint_INF 2000000000
#define ll_INF 	9223372036854775807
#define MOD 100000007
#define vi vector<int>
#define vvi vector<vector<int>>
#define vll vector<long long>
#define pii pair<int,int>
#define vpii vector<pair<int,int>>
using namespace std;

struct DisjointSet {
public:
    vector<int> rank, parent, elements;

    DisjointSet(int size) {
        rank.resize(size, 0);
        parent.resize(size, 0);
        elements.resize(size, 0);

        for (int i = 0; i < size; i++) {
            makeSet(i);
        }
    }

    void makeSet(int x) {
        parent[x] = x;
        rank[x] = 0;
        elements[x] = 1;
    }

    bool isSame(int x, int y) {
        return findSet(x) == findSet(y);
    }

    void unite(int x, int y) {
        link(findSet(x), findSet(y));
    }

    void link(int x, int y) { // x and y are guaranteed to be a root
        if (!isSame(x, y)) {
            if (rank[x] > rank[y]) {
                elements[x] += elements[y];
                parent[y] = x;
            }
            else {
                elements[y] += elements[x];
                parent[x] = y;
                if (rank[x] == rank[y]) {
                    rank[y]++;
                }
            }
        }  
    }

    int findSet(int x) {
        if (x != parent[x]) {
            parent[x] = findSet(parent[x]);
        }

        return parent[x];
    }

    int Elem_of_tree(int x) {
        return elements[findSet(x)];
    }

};
int main() {
    int N, M, K; cin >> N >> M >> K;
    vector<pii> AB, CD;

    rep(i, M) {
        int x, y; cin >> x >> y;
        x--; y--;
        AB.push_back({ x,y });
    }// Direct Friends
    rep(i, K) {
        int x, y; cin >> x >> y;
        x--; y--;
        CD.push_back({ x,y });
    }
    DisjointSet D(N);
    rep(i, M) {
        D.unite(AB[i].first, AB[i].second);
    }
    vi Ans(N, 0);
  
    rep(i, N) {
        Ans[i] = D.Elem_of_tree(i) - 1;
    }
    rep(j, M) {
        if (D.isSame(AB[j].first, AB[j].second)) { // AB contains direct Friends
            Ans[AB[j].first]--;
            Ans[AB[j].second]--;
        }
    }
    rep(k, K) {
        if (D.isSame(CD[k].first, CD[k].second)) {
            Ans[CD[k].first]--;
            Ans[CD[k].second]--;
        }
    }
    vi v = D.elements;

    rep(i, N) {
        cout << Ans[i] << " ";
    }
    cout << endl;
}


Measured memory_bytes: 4340
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <math.h>
using namespace std;

signed main() {
	long long a, b, c, ta = 0, mu = 0, rin = 0, wa = 0, ya10 = 0;
	cin >> a >> b >> c;
	if (a%2==0&&a == b && b == c) {
		cout << -1 << endl;
		return 0;
	}
	ta = a;
	mu = b;
	rin = c;
	wa = a + b + c;
	while (ta % 2 == 0 && mu % 2 == 0 && rin % 2 == 0) {
		ta = (wa - ta) / 2;
		mu = (wa - mu) / 2;
		rin = (wa - rin) / 2;
		ya10++;
	}
	cout << ya10 << endl;
	return 0;
}

Measured memory_bytes: 256
/*Rabbi Zidni Ilma*/

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define scl(n) scanf("%lld",&n)
#define scll(n,m) scanf("%lld%lld",&n,&m)
#define pb push_back
#define mp make_pair
#define fr first
#define sc second
#define mod 1000000007
#define read freopen("input.txt","r",stdin)
#define write freopen("output.txt","w",stdout)

char s[1000][1000];
ll dp[1005][1005];

int main()
{
	ll H,W,i,j;
	scll(H,W);
	for(i=0;i<H;i++)
	{
		for(j=0;j<W;j++)
		{
			cin >> s[i][j];
		}
	}
	dp[0][1]=1;
	for(i=1;i<=H;i++)
	{
		for(j=1;j<=W;j++)
		{
			if(s[i-1][j-1]=='.')
			dp[i][j]=(dp[i-1][j]%mod+dp[i][j-1]%mod)%mod;
			else
			dp[i][j]=0;
		}
	}
	ll ans=dp[H][W]%mod;
	printf("%lld\n",ans);
}

Measured memory_bytes: 12504
#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <string>
#include <sstream>
#include <cstring>
#include <cmath>

using namespace std;

#ifdef DEBUG
#define LOG(args) cout << args << "\n"
#define debug(x) x
#else
#define LOG(args)
#define debug(x)
#endif

#define vi vector<int>
#define ii pair<int, int>
#define vii vector< ii >
#define vvi vector< vi >
#define mp make_pair
#define pb push_back
#define ms(x, v) memset(x, v, sizeof(x))
#define all(x) x.begin(), x.end()
#define REP(x, n) for(int x = 0; x < n; x++)
#define REPV(x, v, n) for(int x = v; x < n; x++)
#define REVE(x, n) for(int x = n; x >= 0; x--)

typedef long long ll;

ll K;

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cin >> K;
	ll val = 7 % K;
	REPV(i, 1, (int)1e7)
	{
		if(val == 0)
		{
			cout << i << "\n";
			return 0;
		}
		val = (val * 10 + 7) % K;
	}
	cout << "-1\n";
	return 0;
}


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

using namespace std;

const int maxn = 2e5+10;

int n, h[maxn], b[maxn];

long long dp[maxn], tree[4*maxn], ans;

// dp[i] = maior soma de belezas se a ultima flor pega for a de altura i

void update(int node, int tl, int tr, int pos, long long val){
    if(tl == tr){
        tree[node] = val;
        return;
    }

    int mid = (tl + tr) >> 1;

    if(pos <= mid) update(2*node, tl, mid, pos, val);
    else update(2*node+1, mid+1, tr, pos, val);

    tree[node] = max(tree[2*node], tree[2*node+1]);
}

long long query(int node, int tl, int tr, int l, int r){
    if(tl > r or tr < l) return 0;
    if(tl >= l and tr <= r) return tree[node];

    int mid = (tl + tr) >> 1;

    return max(query(2*node, tl , mid, l, r), query(2*node+1, mid+1, tr, l, r));
}

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

    cin >> n;

    for(int i=1; i<=n; i++) cin >> h[i];

    for(int i=1; i<=n; i++) cin >> b[i];

    for(int i=1; i<=n; i++){
        dp[h[i]] = b[i] + query(1, 1, n, 1, h[i]-1);
        update(1, 1, n, h[i], dp[h[i]]);
        ans = max(ans, dp[h[i]]);
    }

    cout << ans << endl;

    return 0;
}


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

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())

void solve(){
    string s;
    cin >> s;

    cout << s.substr(0,4) << " " << s.substr(4,8) << endl;

    return;
}

int main(int argc, char const* argv[])
{
    solve();
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
int a[10001],ans=0,bns=0,n;
int main()
{
    scanf("%d",&n);
    for(int i=1;i<=2*n;i++)
    {
        scanf("%d",&a[i]);
    }
    sort(a+1,a+1+2*n);   
    for(int i=1;i<=2*n;i+=2)
    {
        bns+=a[i];
    } 
    printf("%d\n",bns);
    return 0;
}

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

using namespace std;

typedef long long ll;

#define LLMAX 9223372036854775807

int sign(int i) {
  return i % 2 == 1 ? 1 : -1;
}

int main() {
  int N, M;
  
  cin >> N >> M;
  
  vector<vector<ll>> sums(8, vector<ll>(N, 0));
  
  for (int i = 0; i < N; i++) {
    ll x, y, z;
    
    cin >> x >> y >> z;
    
    for (int j = 0; j < (1 << 3); j++) {
      int a = (j & 1);
      int b = ((j >> 1) & 1);
      int c = ((j >> 2) & 1);
      
      sums[j][i] = x * sign(a) + y * sign(b) + z * sign(c);
    }
  }
  
  for (int i = 0; i < 8; i++) {
    sort(sums[i].begin(), sums[i].end());
  }
  
  ll ans = -LLMAX;
  
  for (int j = 0; j < (1 << 3); j++) {
    ll sum = 0;
    
    for (int i = 1; i <= M; i++) {
      sum += sums[j][N - i];
    }
    
    ans = max(ans, sum);
  }
  
  cout << ans << endl;
  
  return 0;
}

Measured memory_bytes: 256
n=int(input())

sl=[]
for i in range(n):
    s=input()
    sl.append(s)
    
import collections

c=collections.Counter(sl)
# print(c)
d=(c.most_common())

e=[d[0][0]]
tmp=d[0][1]
for i,j in d:
    if tmp==j:
        e.append(i)
    else:
        break
e=list(set(e))
e.sort()
for i in e:
    print(i)


Measured memory_bytes: 60048
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <queue>
#include <set>
#include <stack>
#include <map>
#include <unordered_map>
#include <cmath>
#include <utility> // pair make_pair
#include <algorithm>
#include <functional>
#include <iomanip>
#include <climits> // LLONG_MAX, LLONG_MIN, INT_MIN, INT_MAX
#include <assert.h>

#define m0(x) memset(x,0,sizeof(x))
#define m1(x) memset(x,63,sizeof(x))
#define fill(x,y) memset(x,y,sizeof(x))
#define ll long long
//#define int ll
#define INF INT_MAX/10

using namespace std;
using Pi = pair<int, int>;
using Graph = vector<vector<int> >;
using WeightGraph = vector<vector<Pi> >;

int Input[100100];

int main() {
  int N, X; cin >> N >> X;
  int ans = 1;
  int sum = 0;
  for (int i = 0; i < N; i++) {
    cin >> Input[i];
    sum += Input[i];
    if (sum <= X) {
      ans++;
    }
  }
  cout << ans << endl;
}



Measured memory_bytes: 256
#include<stdio.h>
int main()
{
	int a,b,c,d,n=0;
	scanf("%d%d%d%d",&a,&b,&c,&d);
	for(int i=0;i<=100;i++)
	  if(i>a&&i<=b&&i>c&&i<=d)
	    n++;
	printf("%d",n);
	return 0;
}

Measured memory_bytes: 128
#include <algorithm>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for(int(i) = 0; (i) < (n); (i)++)
#define FOR(i, m, n) for(int(i) = (m); (i) < (n); (i)++)
#define All(v) (v).begin(), (v).end()
#define pb push_back
#define MP(a, b) make_pair((a), (b))
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const int INF = 1 << 30;
const ll LINF = 1LL << 60;
const int MOD = 1e9 + 7;

int main() {
    ll A, B, N;
    cin >> A >> B >> N;
    if(B - 1 > N) {
        cout << (A * N) / B - (A * (N / B)) << endl;
    } else {
        cout << (A * (B - 1)) / B - (A * ((B - 1) / B)) << endl;
    }
    return 0;
}

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

typedef unsigned long ul;
typedef unsigned long long ull;
typedef long long ll;
typedef vector<ll> vint;
typedef vector< vector<ll> > vvint;
typedef vector< vector< vector<ll> > > vvvint;
typedef vector<string> vstring;
typedef vector< vector<string> > vvstring;
typedef vector<char> vchar;
typedef vector< vector<char> > vvchar;
typedef vector<long double> vdouble;
typedef vector< vector<long double> > vvdouble;
typedef vector< vector< vector<long double> > > vvvdouble;
typedef pair<ll,ll> pint;
typedef vector<pint> vpint;
typedef vector<bool> vbool;

#define rep(i,n) for(ll i=0;i<n;i++)
#define repf(i,f,n) for(ll i=f;i<n;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define ALL(obj) (obj).begin(), (obj).end()
// #define LLONG_MAX 9223372036854775806
#define vmax(vec) *max_element(vec.begin(), vec.end())
#define vmin(vec) *min_element(vec.begin(), vec.end())
#define vsort(vec) sort(vec.begin(), vec.end())
#define vsortgr(vec) sort(vec.begin(), vec.end(), greater<ll>())
#define MOD 1000000007
// #define MOD 998244353
// #define MOD LLONG_MAX
const double PI=3.14159265358979323846;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

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

void printv(vint &v){
    for(auto e:v) cout<<e<<" ";
        cout<<endl;
    }

// 繰り返し二乗法
ll power(ll a, ll b){
    if(a==1)return a;
    // if(a==0)re
    ll res=1;
    while(b>0){
        if(b&1) res=res*a%MOD;
        a=a*a%MOD;
        b>>=1;
    }
    return res;
}

const int MAX=2100000;

ll fact[MAX], fact_inv[MAX];

void init_fact(ll n){
    fact[0]=1;
    // 階乗の計算
    for(ll i=0; i<n; i++) fact[i+1]=fact[i]*(i+1)%MOD;
    fact_inv[n]=power(fact[n], MOD-2);
    // 逆元の計算
    for(ll i=n-1;i>=0;i--) fact_inv[i]=fact_inv[i+1]*(i+1)%MOD;
}

ll comb(ll n, ll r){
    return (fact[n]*fact_inv[r])%MOD*fact_inv[n-r]%MOD;
}

ll perm(ll n, ll r){
    return (fact[n]*fact_inv[n-r])%MOD;
}

int main() {
    cout<<fixed<<setprecision(10);

    ll n,x,y; cin>>n>>x>>y;
    x--;y--;
    vint ans(n-1,0);
    rep(i,n){
        rep(j,n){
            if(i >= j) continue;
            ans[min({
                j-i, abs(x-i) + abs(y-j) + 1
            })-1] ++;
        }
    }
    for(auto e:ans) cout<<e<<endl;

    return 0;

}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define INF 1000000000
#define rep(i, n) for(int i = 0; i < n; i++)
#define ALL(x) (x).begin(), (x).end()  //昇順
#define RALL(x) (x).rbegin(), (x).rend() // 降順
const long long mod = 1e9+7;
typedef priority_queue<int> PQ;
typedef vector<long long> VL;
typedef vector<int> VI;  // VI a(n);
typedef vector<string> VS;  
typedef vector<char> VC; 
typedef vector<VS> VSS;
typedef vector<VC> VCC;    
typedef vector<VI> VVI;   // VVI a(n,vector<int>(m)) n * m 
typedef vector<VL> VVL;
typedef pair<int, int> PII;
typedef map<int, int> MP;   //MP a;
typedef vector<pair<int, int> > PS;
typedef long long ll;  //ll とdoubleは違う
template <class T>  // chmax(max, a);
bool chmax(T &a, const T &b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T> //chmin(min,a)
bool chmin(T &a, const T &b)
{
    if (b < a)
    {
        a = b;
        return 1;
    }
    return 0;
}
template<typename T>   // operator << (cout,a);
ostream& operator << (ostream& os, vector<T>& v) {
    os << "{";
    rep(i, (int)v.size()) { os << v[i] << (i < v.size() - 1 ? ", " : ""); }
    os << "}";
    return os;
}

int main(){
    int x,y,n,m,h,k,max=-10000000,min=10000000,ans=0,sum=0;
    string s,t;
    cin >> n >> m;
    cout << (1900*m+100*(n-m))*pow(2,m) << endl;
    return 0;
}

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

#define REP(i,n) for(long long i=0; i < (n); ++i)
#define REPR(i,n) for(int i=(n); i >= 0; --i)
#define FOR(i, m, n) for(long long i = (m); i < (n); ++i)

using ll = long long;
#define INF 1e9

string s, t;
vector<vector<int>> dp;
string ans;

int main(){
  cin >> s >> t;
  dp.resize(s.size()+1, vector<int>(t.size()+1));
  REP(i, s.size()){
    REP(j, t.size()){
      if(s[i] == t[j]){
        dp[i+1][j+1] = dp[i][j]+1; 
      }
      else{
        dp[i+1][j+1] = max(dp[i][j+1], dp[i+1][j]);
      }
    }
  }
  
  int i = s.size(), j = t.size();
  while(i > 0 && j > 0){
    if(s[i-1] == t[j-1]){
      ans+=s[i-1];
      i--, j--;
    }
    else{
      if(dp[i][j-1] > dp[i-1][j]){
        j--;
      }
      else{
        i--;
      }
    }
  }
  reverse(ans.begin(), ans.end());
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 35584
#include<iostream>
#include<queue>
#include<vector>
#include<set>
#include<iomanip>

using namespace std;

const int INF = 1001001001;
const int MOD = 1000000007;

int main(){
	int r;cin >>r;
	double ans = 2 * 3.14 * r;

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 3804
#include<iostream>
#include<string>
#include<vector>
#include<iomanip>
#include<algorithm>
#include<queue>
#include<stack>
#include<map>
using namespace std;
#define ll long long
ll root(ll x,ll par[]){
  if(par[x]==x)return x;
  return par[x] = root(par[x],par);
}

ll unite(ll x, ll y,ll par[],ll size[]){
  ll rx= root(x,par);
  ll ry= root(y,par);
  ll r;
  if(rx == ry){
    return 0;
  }else{
    r=size[rx]*size[ry];
    if(size[rx]<size[ry]){
      par[ry]=rx;
      size[rx]+=size[ry];
    }else{
      par[rx]=ry;
      size[ry]+=size[rx];
    }
    return r;
  }
}

int main(){
    ll N,M;
    cin >> N >> M;
    pair<ll,ll> br[M+1];
    ll par[N+1];
    ll size[N+1];
    ll ans[M+1];
    ll i;
    for(i=1;i<N+1;i++){
      par[i]=i;
      size[i]=1;
    }
    for(i=1;i<=M;i++){
      cin >> br[i].first >> br[i].second;
    }
    ans[M]=N*(N-1)/2;
    for(i=M-1;i>0;i--){
      ans[i]=ans[i+1]-unite(br[i+1].first,br[i+1].second,par,size);
    }
    for(i=1;i<=M;i++){
      cout << ans[i]<<endl;
    }
    return 0;
}


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

int main()
{
  int H,W;
  cin >> H >> W;
  for( int c = 0; c < ( W + 1 ); c++ )
    cout << "#" << flush;
  cout << "#" << endl;
  for( int j = 0; j < H; j++ )
  {
    cout << "#" << flush;
    for( int i = 0; i < W; i++ )
    {
      char pic;
      cin >> pic;
      cout << pic << flush;
    }
    cout << "#" << endl;
  }
  for( int c = 0; c < ( W + 1 ); c++ )
    cout << "#" << flush;
  cout << "#" << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <complex>
#include <cstdlib>
#include <ctime>
#include <time.h>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <numeric>
#include <limits>
#include <type_traits>


using namespace std;
#define SAY_YES cout << "YES" << endl;
#define SAY_Yes cout << "Yes" << endl;
#define SAY_NO cout << "NO" << endl;
#define SAY_No cout << "No" << endl;
#define IFYES(TRUE_OR_FALSE)   \
    if (TRUE_OR_FALSE)         \
    {                          \
        cout << "YES" << endl; \
    }                          \
    else                       \
    {                          \
        cout << "NO" << endl;  \
    }
#define IFYes(TRUE_OR_FALSE)   \
    if (TRUE_OR_FALSE)         \
    {                          \
        cout << "Yes" << endl; \
    }                          \
    else                       \
    {                          \
        cout << "No" << endl;  \
    }
#define IFyes(TRUE_OR_FALSE)   \
    if (TRUE_OR_FALSE)         \
    {                          \
        cout << "yes" << endl; \
    }                          \
    else                       \
    {                          \
        cout << "no" << endl;  \
    }
#define DEBUG_OUTPUT_ARRAY(XXX, ONE)                            \
    for (int i = 0; i < (ONE); i++)                             \
    {                                                           \
        cout << "DEBUG: i = " << i << " -> " << XXX[i] << endl; \
    }
#define DEBUG_OUTPUT_ARRAY2(XXX, ONE, TWO)                             \
    for (int i = 0; i < (ONE); i++)                                    \
    {                                                                  \
        cout << "<<< i = " << i << " >>>" << endl;                     \
        for (int j = 0; j < (TWO); j++)                                \
        {                                                              \
            cout << "DEBUG: j = " << j << " -> " << XXX[i][j] << endl; \
        }                                                              \
    }
#define DEBUG_OUTPUT_ARRAY2_BOX(XXX, ONE, TWO) \
    for (int i = 0; i < (ONE); i++)            \
    {                                          \
        cout << i << "  ";                     \
        for (int j = 0; j < (TWO); j++)        \
        {                                      \
            cout << XXX[i][j] << " ";          \
        }                                      \
        cout << endl;                          \
    }

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


const long long int mod = 1000000007;
const long long int INF = 1e18;
const long double PI=3.14159265358979323; 

long long int N,K,D,X,Y,x,y,nokori,tmp,res=INF;
long long int h[100678];

string str[1000];

int main()
{
    cout << fixed << setprecision(18);
    cin>>N>>K;
    for(long long int i = 0; i < N; i++){
        cin>>h[i];
    }
    sort(h,h+N);
    for(long long int i = 0; i <= N-K; i++){
        res=min(res,h[i+K-1]-h[i]);
    }
    cout<<res<<endl;


}    


Measured memory_bytes: 1024
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;


public class Main{
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		String str = br.readLine();
		/*
		System.out.println(str.toUpperCase());
		*/

		char text[] = str.toCharArray();

		for(int i=0; i<text.length; i++){
			if('a' <= text[i] && text[i] <= 'z'){
				text[i] = (char)(text[i] - 'a' + 'A');
			}
		}
		System.out.println(text);
	}
}

Measured memory_bytes: 16864
N=gets.to_i

dp_a = Array.new(N+1, 0)
dp_b = Array.new(N+1, 0)
dp_c = Array.new(N+1, 0)
actions = []
N.times do |n|
  actions << gets.split.map(&:to_i)
end

N.times do |n|
  # aを取った場合
  dp_a[n + 1] = actions[n][0] + [dp_b[n], dp_c[n]].max

  # bを取った場合
  dp_b[n + 1] = actions[n][1] + [dp_a[n], dp_c[n]].max

  # cを取った場合
  dp_c[n + 1] = actions[n][2] + [dp_a[n], dp_b[n]].max
end
puts [dp_a[N], dp_b[N], dp_c[N]].max


Measured memory_bytes: 11900
#include<iostream>
#include<vector>
#include<algorithm>
#include<stack>
#include<queue>
#include<string>

using namespace std;

#define ll long long
#define INF 99999999
#define rep(i,n) for(int i=0,temp=(int)(n);i<temp;++i) //vec.size()がnの時等の高速化
#define all(x) (x).begin,(x).end()
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}


int n;
vector<int> p;

int main(){
  cin >> n; p.resize(n);
  rep(i,n) cin >> p[i];
  VSORT(p);
  p.back() /= 2;

  int sum=0;
  rep(i,n) sum += p[i];

  cout << sum << endl;
  return 0;
}


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

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let s1: String = read();
    let s2: String = read();
    let s3: String = read();
    let mut s: Vec<char> = vec![];
    s.push(s1.chars().collect::<Vec<char>>()[0]);
    s.push(s2.chars().collect::<Vec<char>>()[1]);
    s.push(s3.chars().collect::<Vec<char>>()[2]);
    println!("{}",s.into_iter().collect::<String>());
}

Measured memory_bytes: 4352
/*
 * main.c
 *
 *  Created on: 2020/03/28
 *      Author: family
 */

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define MAX(a,b) (a > b ? a : b)
#define MIN(a,b) (a > b ? b : a)
typedef long long int ll;
typedef unsigned long long int ull;

int sort_inc(const void *a, const void *b) { return (*(int*)a - *(int*)b);}
int sort_dec(const void* a, const void* b) { return (*(int*)b - *(int*)a);}
int sort_dec_ll(const void *a, const void *b) {
    ll da = *(ll*)a, db = *(ll*)b;    int val = 0;
    if(da > db) { val = -1; }
    else if (da == db) { val = 0; }
    else { val = 1; }
    return val;
}
int sort_inc_ll(const void *a, const void *b) {
    ll da = *(ll*)a, db = *(ll*)b;    int val = 0;
    if(da > db) { val = 1; }
    else if (da == db) { val = 0; }
    else { val = -1; }
    return val;
}
int sort_dic(const void *a, const void *b) {
    char *pa = (char *)a;    char *pb = (char *)b;    int i = 0, val = 0, N = 10;
    for (i = 0; i < N; i++) {
    	char da = pa[i], db = pb[i];
    	if (da == db) continue;
  		if (da > db) val = 1; else val = -1;
        break;
    }
    return val;
}

void yesno(int ans) {
	if (ans == 1) {	printf("Yes\n");
	} else {		printf("No\n");	}
	return;
}

void okng(int ans) {
	if (ans == 1) { printf("OK\n");
	} else { 		printf("NG\n");	}
	return;
}

int main()
{
	int L = 0, R = 0, d = 0;
	scanf("%d %d %d", &L, &R, &d);

	int i = 0, ans = 0;
	for (i = L; i < R+1; i++) {
		if (i%d == 0) {
			ans++;
		}
	}

	printf("%d\n", ans);
	//yesno(ans);
	//okng(ans);
	return 0;
}


Measured memory_bytes: 1736
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<vector>
#define SF scanf
#define PF printf
#define MAXN 3010
using namespace std;
int n;
int a[MAXN];
struct node{
	int x;
	node *nxt;	
}edge[MAXN*2];
node *head[MAXN],*ncnt=edge;
int u,v;
void add_edge(int x,int y){
	++ncnt;
	ncnt->x=y;
	ncnt->nxt=head[x];	
	head[x]=ncnt;
}
bool dfs(int x,int fa){
	bool res=0;
	for(node *v=head[x];v!=NULL;v=v->nxt){
		int u=v->x;
		if(u==fa)
			continue;
		if(dfs(u,x)==0&&a[u]<a[x])
			res=1;
	}
	return res;
}
int main(){
	SF("%d",&n);
	for(int i=1;i<=n;i++)
		SF("%d",&a[i]);
	for(int i=1;i<n;i++){
		SF("%d%d",&u,&v);
		add_edge(u,v);
		add_edge(v,u);
	}
	for(int i=1;i<=n;i++)
		if(dfs(i,0))
			PF("%d ",i);
}

Measured memory_bytes: 512
#include <iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>
#include<stack>
#include <queue>
typedef long long int ll;
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define REP(i,n) for (int i=0;i<(n);i++)
#define EREP(i,n) for (int i=1;i<=(n);i++)
const ll MOD = 1000000007;

    ll N,ans,temp=0;
    char S[110];

int main(){
  scanf("%lld",&N);
  scanf("%s",&S);
  REP(i,N){
    if(S[i]=='I')temp++;
    if(S[i]=='D')temp--;
    if(ans<temp){
      ans=temp;
    }
  }
  cout<<ans;
}


Measured memory_bytes: 256
import copy

h, w, k = map(int, input().split())
table = [0]*h
for i in range(h):
    table[i] = [0 if j == "." else 1 for j in input()]
ans = 0

for i in range(2 ** (h + w)):
    t = copy.deepcopy(table)
    for j in range(h + w):
        if ((i >> j) & 1):
            if j < h:
                for l in range(w):
                    t[j][l] = 0
            else:
                for l in range(h):
                    t[l][j-h] = 0
    black = sum(map(sum, t))
    if black == k:
        ans += 1

print(ans)

Measured memory_bytes: 9356
#include<cstdio>
#include<iostream>
#include<cmath>
#include<algorithm>

const long long MAXN=1e5+10;
using namespace std;
typedef long long ll;

 int main() {
 	int n,s[105]={0};
 	int cnt1=0,cnt2=0;
 	int mn=10000;
 	bool f=1;
 	cin>>n;
 	ll ans=0;
 	for(int i=1;i<=n;i++){
 		cin>>s[i];
 		ans+=s[i];
 		if(s[i]%10!=0){
 			f=0;
 			if(s[i]<mn){
 				mn=s[i];
			 }
		}
	}
	if(ans%10!=0){
		cout<<ans<<endl;
		return 0;
	}
	if(f==1){//f=1，说明所有数都是10的倍数，没办法将结果变得%10！=0 
		cout<<"0"<<endl;
	}
	else cout<<ans-mn<<endl;
 	return 0;
 }

Measured memory_bytes: 256
#include<stdio.h>)
int main(void){
	int i, n, m=100000;
	scanf("%d", &n);
	for(i=0;i<n;i++){
		m = m * 1.05 + 999;
		m/=1000;
		m*=1000;
	}
	printf("%d\n", m);
	return 0;
}

Measured memory_bytes: 592
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#include <cmath>
#include <queue>
#include <deque>
#include <set>
#include <iomanip>
#include <utility>
#define ll long long
#define ld long double
using namespace std;

int ans[310][310];

int main() {
	int H, W, K;
	cin >> H >> W >> K;
	vector<string> S(H);
	vector<vector<int>> row(H);
	int p=-1;
	for(int i=0; i<H; ++i){
		cin >> S[i];
		for(int j=0; j<W; ++j){
			if(S[i][j]=='#'){
				row[i].push_back(j);
				if(p<0) p=i;
			}
		}
	}
	int num=0;
	for(int i=p; i<H; ++i){
		if(row[i].size()>0){
			int now=0;
			for(int j=0; j<row[i].size(); ++j){
				++num;
				while(now<=row[i][j]){
					ans[i][now]=num;
					++now;
				}
			}
			for(int j=row[i].back(); j+1<W; ++j){
				ans[i][j+1]=ans[i][j];
			}
		}else{
			for(int j=0; j<W; ++j){
				ans[i][j]=ans[i-1][j];
			}
		}
	}
	for(int i=0; i<p; ++i){
		for(int j=0; j<W; ++j){
			ans[i][j]=ans[p][j];
		}
	}
	for(int i=0; i<H; ++i){
		cout << ans[i][0];
		for(int j=1; j<W; ++j){
			cout << ' ' << ans[i][j];
		}
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 2048
#include<stdio.h>

int main() {
	int n,i,j,v,k;
	int A[1000];

	scanf("%d",&n);

	for (i=0; i<n; i++)
	   scanf("%d",&A[i]);

	for (i=0; i<n; i++) {
			v=A[i];
			j=i-1;
		 while (j>=0 && A[j]>v) {
			 A[j+1]=A[j];
			 j--;
		 A[j+1]=v;
		 }
	for (k=0; k<n-1; k++)
           printf("%d ",A[k]);
        printf("%d",A[k]);

  printf("\n");
	}
	return 0;

}

Measured memory_bytes: 608