akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<algorithm>
#include<string>
int N, M, X;
bool A[110];
int main() {
	std::cin >> N >> M >> X;
	for (int i = 0; i < M; i++) {
		int tmp;
		std::cin >> tmp;
		A[tmp] = true;
	}
	int sum = 0;
	for (int i = X; i <= N; i++) {
		if (A[i])sum++;
	}
	int ans = sum;
	sum = 0;
	for (int i = X; i >= 0; i--) {
		if (A[i])sum++;
	}
	ans = std::min(ans, sum);
	std::cout << ans << std::endl;
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string>
#include<utility>
#include<iostream>
#include<queue>
#include<math.h>
#include<algorithm>
#include<vector>
#include<map>
#include<stack>
#include<bitset>

using namespace std;
typedef long long ll;
#define REP(i,n) for(int i=0;i<(int)(n);i++)

int main(){
    int n,m;
    scanf("%d%d",&n,&m);
    if(n==m)printf("Yes\n");
    else printf("No\n");
    return 0;
}

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

#define FAST ios_base::sync_with_stdio(false); cin.tie(0);
#define pb push_back
#define eb emplace_back
#define ins insert
#define f first
#define s second
#define cbr cerr << "hi\n"
#define mmst(x, v) memset((x), v, sizeof ((x)))
#define siz(x) ll(x.size())
#define all(x) (x).begin(), (x).end()
#define lbd(x,y) (lower_bound(all(x),y)-x.begin())
#define ubd(x,y) (upper_bound(all(x),y)-x.begin())
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());    //can be used by calling rng() or shuffle(A, A+n, rng)
inline long long rand(long long x, long long y) { return (rng() % (y+1-x)) + x; } //inclusivesss
string inline to_string(char c) {string s(1,c);return s;} template<typename T> inline T gcd(T a,T b){ return a==0?llabs(b):gcd(b%a,a); }

typedef long long ll; 
typedef long double ld;
#define FOR(i,s,e) for(ll i=s;i<=ll(e);++i)
#define DEC(i,s,e) for(ll i=s;i>=ll(e);--i)
typedef pair<ll,ll>pi; typedef pair<ll,pi>spi; typedef pair<pi,pi>dpi;

#define LLINF ((long long)1e18)
#define INF int(1e9+1e6)
#define MAXN (5006)
ll n,A[MAXN],dp[MAXN][MAXN],sz[MAXN];// if 0 then max, 1 then min
bitset<MAXN> dp2[MAXN];
vector<int>v[MAXN];
void dfs(ll x,ll p){
	sz[x]=1;
	dp[x][0]=A[x];
	for(auto i:v[x]) if(i^p) dfs(i,x), sz[x]+=sz[i];
	FOR(k,1,sz[x]) dp[x][k]=LLINF;
	ll cur = 1;
	if(A[x]>0)dp2[x][0]=1;
	for(auto i:v[x]) if(i^p) {
		DEC(j,cur+sz[i],0){
			if(dp[x][j]<LLINF) dp[x][j] += dp[i][0];
			dp2[x][j] = dp2[x][j] & dp2[i][0];
			FOR(k,max(j-cur,1ll),min(j,sz[i])){
				dp[x][j]=min(dp[x][j],dp[x][j-k]+dp[i][k]);
				if(dp2[i][k-1]) dp[x][j]=min(dp[x][j],dp[x][j-k]);
				dp2[x][j]=dp2[x][j]|(dp2[x][j-k]&dp2[i][k]);
				if(dp[i][k-1] < 0) dp2[x][j]=dp2[x][j]|dp2[x][j-k];
			}
		}
		cur += sz[i];
	}
}
int main(){
	FAST
	cin>>n;
	FOR(i,1,n)cin>>A[i];
	FOR(i,2,n){
		ll a,b;cin>>a>>b;
		v[a].eb(b),v[b].eb(a);
	}
	dfs(1,1);
	ll ans = n-1;
	FOR(k,0,n-1) if(dp[1][k] < 0) ans = min(ans, k);
	FOR(k,0,n-1) if(dp2[1][k]) ans = min(ans, k);
	cout<<ans<<'\n';
}



Measured memory_bytes: 108880
#include"bits/stdc++.h"
using namespace std;
#define REP(k,m,n) for(int (k)=(m);(k)<(n);(k)++)
#define rep(i,n) REP((i),0,(n))
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using tp3 = tuple<int, int, int>;
using Mat = vector<vector<ll>>;
constexpr int INF = 1 << 28;
constexpr ll INFL = 1ll << 60;
constexpr int dh[4] = { 0,1,0,-1 };
constexpr int dw[4] = { -1,0,1,0 };
bool isin(const int H, const int W, const int h, const int w) {
    return 0 <= h && h < H && 0 <= w && w < W;
}
#ifndef ATCODER_DSU_HPP
#define ATCODER_DSU_HPP 1

#include <algorithm>
#include <cassert>
#include <vector>

namespace atcoder {

// Implement (union by size) + (path compression)
// Reference:
// Zvi Galil and Giuseppe F. Italiano,
// Data structures and algorithms for disjoint set union problems
struct dsu {
public:
    dsu() : _n(0) {}
    dsu(int n) : _n(n), parent_or_size(n, -1) {}

    int merge(int a, int b) {
        assert(0 <= a && a < _n);
        assert(0 <= b && b < _n);
        int x = leader(a), y = leader(b);
        if (x == y) return x;
        if (-parent_or_size[x] < -parent_or_size[y]) std::swap(x, y);
        parent_or_size[x] += parent_or_size[y];
        parent_or_size[y] = x;
        return x;
    }

    bool same(int a, int b) {
        assert(0 <= a && a < _n);
        assert(0 <= b && b < _n);
        return leader(a) == leader(b);
    }

    int leader(int a) {
        assert(0 <= a && a < _n);
        if (parent_or_size[a] < 0) return a;
        return parent_or_size[a] = leader(parent_or_size[a]);
    }

    int size(int a) {
        assert(0 <= a && a < _n);
        return -parent_or_size[leader(a)];
    }

    std::vector<std::vector<int>> groups() {
        std::vector<int> leader_buf(_n), group_size(_n);
        for (int i = 0; i < _n; i++) {
            leader_buf[i] = leader(i);
            group_size[leader_buf[i]]++;
        }
        std::vector<std::vector<int>> result(_n);
        for (int i = 0; i < _n; i++) {
            result[i].reserve(group_size[i]);
        }
        for (int i = 0; i < _n; i++) {
            result[leader_buf[i]].push_back(i);
        }
        result.erase(
            std::remove_if(result.begin(), result.end(),
                [&](const std::vector<int>& v) { return v.empty(); }),
            result.end());
        return result;
    }

private:
    int _n;
    // root node: -1 * component size
    // otherwise: parent
    std::vector<int> parent_or_size;
};

}  // namespace atcoder

#endif  // ATCODER_DSU_HPP

// ============ template finished ============
using namespace atcoder;
int main()
{
    int N, Q;
    cin >> N >> Q;
    dsu uf(N);
    rep(_, Q) {
        int t, u, v;
        cin >> t >> u >> v;
        if (t == 0) {
            uf.merge(u, v);
        }
        else {
            cout << (uf.same(u, v) ? 1 : 0) << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 4044
#include<bits/stdc++.h>
using namespace std ;
#define ll long long int
#define pb push_back
#define fi first 
#define se second 
#define mod 1000000007
int power(ll x, ll  y, ll p)  
{  
    ll res = 1;     // Initialize result  
  
    x = x % p; // Update x if it is more than or  
                // equal to p 
   
    if (x == 0) return 0; // In case x is divisible by p; 
  
    while (y > 0)  
    {  
        // If y is odd, multiply x with result  
        if (y & 1)  
            res = (res*x) % p;  
  
        // y must be even now  
        y = y>>1; // y = y/2  
        x = (x*x) % p;  
    }  
    return res;  
}  
int main() 
{ 
  ll n,sum =0 ;
  cin >> n ;
  vector<ll> v(n),a(100001),ans ;
  for(ll i=0;i<n;i++) 
  {
    cin >> v[i] ;
    sum += v[i] ;
    a[v[i]]++ ;
  }
  ll q ;
  cin >> q ;
  ll j=0;
  while(j<q)
  {
    ll x,y ;
    cin >> x >> y ;
   // cout << "p" << endl;
    sum -= x*a[x];
    sum += y*a[x] ;
    a[y] += a[x] ;
    a[x]=0 ;
    ans.pb(sum) ;
     j++;
  }
  for(ll i=0;i<ans.size();i++) cout << ans[i] << endl;


} 

Measured memory_bytes: 5796
r = list(input())
if r == ["R","S","R"] or r==["R","S","S"] or r==["S","S","R"] or r==["S","R","S"]:
  print(int(1))
elif r ==["R","R","S"] or r==["S","R","R"]:
  print(int(2))
elif r==["S","S","S"]:
  print(int(0))
else:
  print(int(3))

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

int main(){

int mod = 1000000007;
int N, M;
cin >> N >> M;

vector<bool>flag(N + 1, true);
for(int i = 0; i < M; i++){ 
      int x;
      cin >> x;
      flag.at(x) = false; 
}

vector<int>dp(N + 1, 0);
dp.at(0) = 1;
if(flag.at(1)) dp.at(1) = 1;

for(int i = 2; i < N + 1; i++){ 
      if(flag.at(i - 1)) dp.at(i) += dp.at(i - 1);
      if(flag.at(i - 2)) dp.at(i) += dp.at(i - 2);
      dp.at(i) %= mod;
}

cout << dp.at(N) << endl;

}

Measured memory_bytes: 640
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<functional>
#include<iomanip>
#include<iostream>
#include<map>
#include<queue>
#include<set>
#include<string>
#include<utility>
#include<vector>

using namespace std;
typedef long long ll;
const ll mod = 1000000007;
#define rep(i,n) for(int i=0;i<n;i++)
#define repl(i,s,e) for(int i=s;i<e;i++)
#define reple(i,s,e) for(int i=s;i<=e;i++)
#define revrep(i,n) for(int i=n-1;i>=0;i--)

#define vll    vector<ll>
#define vvll   vector<vector<ll>>
#define all(x) (x).begin(),(x).end()


ll modpow(ll a, ll n) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}


int main()
{	
    int N, K;
    cin >> N >> K;

    //counts[i] := iの倍数のN乗の個数 - 「iの倍数の倍数」の個数
    vector<ll> counts(K + 1, 0);

    for (int i = K; i >= 1; i--)
    {
        counts[i] = modpow(K / i, N);

        for (int j = 2 * i; j <= K; j += i)
        {
            counts[i] -= counts[j];
            if (counts[i] < 0) counts[i] += mod;
        }
    }

    ll count = 0;

    reple(i, 1, K)
    {
        count += i * counts[i];
        count %= mod;
    }

    cout << count << endl;

	return 0;
}

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

int main() {
	int N;
	cin >> N;

	for (int i = 0; i < N; i++) {
		char S;
		cin >> S;

		if (S == 'Y') {
			cout << "Four" << endl;
			return 0;
		}
	}
	cout << "Three" << endl;
	return 0;
}

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

#define int long long
#define fi first
#define se second
#define ponto pair<int,int>

int n;

int32_t main()
{

	cin >> n;
	int sum = 0;
	for(int i=1; i<=n; i++)
		if(i%3 != 0 and i%5 != 0)
			sum += i;
			
	cout << sum << '\n';
}

Measured memory_bytes: 3636
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

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

  vector<P> bavec(n);
  for (int i = 0; i < n; i++) {
    int a, b;
    cin >> a >> b;
    bavec[i] = make_pair(b, a);
  }
  sort(bavec.rbegin(), bavec.rend());

  int time = bavec[0].first;
  for (int i = 0; i < n; i++) {
    if (time > bavec[i].first) {
      time = bavec[i].first;
    }
    time -= bavec[i].second;
    if (time < 0) {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;

  return 0;
}

Measured memory_bytes: 1792
import java.util.*;
 
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int s = Integer.parseInt(sc.next());
        List<Integer> list = new ArrayList<>();
        int i= 1;
        list.add(s);
        while(true) {
            i++;
            if(s % 2 == 0) {
                s /= 2;
                if(list.contains(s)) {
                    System.out.println(i);
                    break;
                }else {
                    list.add(s);
                }
            }else {
                s = 3*s+1;
                if(list.contains(s)) {
                    System.out.println(i);
                    break;
                }else {
                    list.add(s);
                }
            }
        }
        
    }
}

Measured memory_bytes: 21972
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define ll long long
#define P pair<int,int>
const int MOD = 1000000007;
const int INF = 2002002002;
const ll LLINF = 9009009009009009009;
using namespace std;

int main() {
    int h, w;
    cin >> h >> w;
    int c[10][10];
    rep(i,10) {
        rep(j,10) cin >> c[i][j];
    }

    rep(k,10) {
        rep(i,10) {
            rep(j,10) {
                c[i][j] = min(c[i][j], c[i][k] + c[k][j]);
            }
        }
    }

    int ans = 0;
    int a;
    rep(i,h) {
        rep(j,w) {
            cin >> a;
            if (a == -1) continue;
            ans += c[a][1];
        }
    }
    cout << ans << endl;
    return 0;
}

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

int main(){
    int n;
    cin>>n;
    int dp[n][3];
    int a,b,c;
    cin>>a>>b>>c;
    dp[0][0]=a,dp[0][1]=b,dp[0][2]=c;
    for(int i=1;i<n;i++){
        cin>>a>>b>>c;
        dp[i][0]=max(dp[i-1][1],dp[i-1][2])+a;
        dp[i][1]=max(dp[i-1][0],dp[i-1][2])+b;
        dp[i][2]=max(dp[i-1][1],dp[i-1][0])+c;
    }
    cout<<max(dp[n-1][0],max(dp[n-1][1],dp[n-1][2]));
}

Measured memory_bytes: 1408
// Hovalhagh
// Ya Aziz & Hakim
// AliReza Kaboli

#include <bits/stdc++.h>

using namespace std;

int main() {
	long long a, b, k, sa;
	cin >> a >> b >> k;
	sa = a;
	a -= min(sa, k);
	k -= min(sa, k);
	b -= min(b, k);
	cout << a << ' ' << b << '\n';
}


Measured memory_bytes: 256
#include <cstdio>
int main() {
	int n, k;
	scanf("%d%d", &n, &k);
	if (k > (n-1)*(n-2)/2) puts("-1");
	else {
		int t = (n-1)*(n-2)/2-k;
		printf("%d\n", t+n-1);
		for (int i = 1; i < n; i++) printf("%d %d\n", i, n);
		if (!t) return 0;
		for (int i = 1; i < n; i++) {
			for (int j = 1; j < i; j++) {
				printf("%d %d\n", i, j);
				if (!--t) return 0;
			}
		}
	}
}

Measured memory_bytes: 128
N, x = map(int, input().split())

if x == 1 or x == 2*N-1:
    print("No")
    exit()
else:
    print("Yes")
    if N == 2:
        for i in range(3):
            print(i+1)
        exit()
    count = 0
    for i in range(2,2*N-1):
        if i == x:
                continue
        else:
            print(i)
            count += 1

        if count == N-1:
            if x > N:
                print(2*N-1)
                print(x)
                print(1)
            else:
                print(1)
                print(x)
                print(2*N-1)


Measured memory_bytes: 4560
#include <bits/stdc++.h>
using namespace std;
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long

const int N=1005;
const int MOD=1e9+7;

int n, m;
char a[N][N];
int cache[N][N];

int dp(int i, int j)
{
	if(i>n || j>m)
		return 0;
	if(a[i][j]=='#')
		return 0;
	if(i==n && j==m)
		return 1;
	int &ans=cache[i][j];
	if(ans!=-1)
		return ans;
	ans=dp(i+1, j) + dp(i, j+1);
	ans%=MOD;
	return ans;
}

int32_t main()
{
	IOS;
	memset(cache, -1, sizeof(cache));
	cin>>n>>m;
	for(int i=1;i<=n;i++)
		for(int j=1;j<=m;j++)
			cin>>a[i][j];	
	int ans=dp(1, 1);
	cout<<ans;
	return 0;
}


Measured memory_bytes: 9216
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,s,n) for(ll i = (s); i < (n); i++)
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>
namespace mp = boost::multiprecision;
// mp::cpp_int
// mp::cpp_dec_float_100



int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(18);
  
  string s;
  ll n;
  cin >> n;
  
  //vector<ll> a(n);  rep(i, 0, n) cin >> a[i];
    
  cout << (ll)pow(2, floor(log2(n))) << "\n";
  
  //cout << (  ?"Yes" :"No") << "\n";

}

Measured memory_bytes: 640
import std.stdio;
import std.conv, std.array, std.algorithm, std.string;
import std.math, std.random, std.range, std.datetime;
import std.bigint;

string read(){ static string[] ss; while(!ss.length) ss = readln.chomp.split; string res = ss[0]; ss.popFront; return res; }

void main(){
	int n = read.to!int;
	int m = read.to!int;
	long[] xs = readln.chomp.split.map!(to!long).array;
	long[] ys = readln.chomp.split.map!(to!long).array;
	
	long[] sx = [0];
	for(int i = 1; i < n; i ++){
		sx ~= sx[i - 1] + i * (xs[i] - xs[i - 1]);
		}
	long tx = 0;
	for(int i = 0; i < n; i ++){
		tx += sx[i];
		}
	
	long[] sy = [0];
	for(int j = 1; j < m; j ++){
		sy ~= sy[j - 1] + j * (ys[j] - ys[j - 1]);
		}
	long ty = 0;
	for(int j = 0; j < m; j ++){
		ty += sy[j];
		}
	
	BigInt ans;
	ans = tx;
	ans *= ty;
	ans %= 1_000_000_007;
	
	ans.writeln;
	
	}


Measured memory_bytes: 11660
#include <bits/stdc++.h>
#define rep(i,N) for (int i = 0; i < (N); ++i)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main(void){
  int h, a;
  cin >> h >> a;

  int ans = ceil(double(h) / a);
  cout << ans << endl;
}


Measured memory_bytes: 3600
#include "bits/stdc++.h"
using namespace std;

typedef long long ll;
typedef pair<int, int> P;

const int INF = 1000000007;

int main(void){
	int n; cin>>n;
	vector<int> even_cnt(100010, 0);
	vector<int> odd_cnt(100010, 0);
	int emax_cnt = 0, omax_cnt = 0;
	int emax_elm = 0, omax_elm = 0;
	for(int i=0;i<n;i++) {
		int v; cin>>v;
		if(i % 2 == 0) {
			even_cnt[v]++;
			if(emax_cnt < even_cnt[v]) {
				emax_cnt = even_cnt[v];
				emax_elm = v;
			}
		}
		else {
			odd_cnt[v]++;
			if(omax_cnt < odd_cnt[v]) {
				omax_cnt = odd_cnt[v];
				omax_elm = v;
			}
		}
	}

	sort(even_cnt.begin(), even_cnt.end(), greater<int>());
	sort(odd_cnt.begin(), odd_cnt.end(), greater<int>());
	if(emax_elm != omax_elm) {
		cout<< n - emax_cnt - omax_cnt <<endl;
	}
	else {
		cout<< min(n - even_cnt[0] - odd_cnt[1], n - even_cnt[1] - odd_cnt[0]) <<endl;
	}
	
	return 0;
}

Measured memory_bytes: 1024
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastScanner in = new FastScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskA {
        public void solve(int testNumber, FastScanner in, PrintWriter out) {
            int a = in.nextInt();
            int b = in.nextInt();
            int c = in.nextInt();
            out.println(c >= a && c <= b ? "Yes" : "No");
        }

    }

    static class FastScanner {
        private InputStream in;
        private byte[] buffer = new byte[1024];
        private int bufPointer;
        private int bufLength;

        public FastScanner(InputStream in) {
            this.in = in;
        }

        private int readByte() {
            if (bufPointer >= bufLength) {
                if (bufLength == -1)
                    throw new InputMismatchException();

                bufPointer = 0;
                try {
                    bufLength = in.read(buffer);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }

                if (bufLength <= 0)
                    return -1;
            }
            return buffer[bufPointer++];
        }

        private static boolean isSpaceChar(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public long nextLong() {
            long n = 0;

            int b = readByte();
            while (isSpaceChar(b))
                b = readByte();

            boolean minus = (b == '-');
            if (minus)
                b = readByte();

            while (b >= '0' && b <= '9') {
                n *= 10;
                n += b - '0';
                b = readByte();
            }

            if (!isSpaceChar(b))
                throw new NumberFormatException();

            return minus ? -n : n;
        }

        public int nextInt() {
            long n = nextLong();

            if (n < Integer.MIN_VALUE || n > Integer.MAX_VALUE)
                throw new NumberFormatException();

            return (int) n;
        }

    }
}



Measured memory_bytes: 21332
#include <stdio.h>
#include <stdlib.h>

void InsertionSort(int *a, int n);
void Nprint(int *a, int n);

int main(void){
  int i, n, *a;

  scanf("%d", &n);
  a = (int *)malloc(sizeof(int) * n);
  if(a == NULL){
    printf("?????¢????¢??????¨??????\n");
    return -1;
  }
  for(i = 0; i < n; i++){
    scanf("%d", &a[i]);
  }
  InsertionSort(a, n);
  return 0;
}


void InsertionSort(int *a, int n){
  int i, j, temp;

  Nprint(a, n);

  for(i = 1; i < n; i++){
    for(j = i-1; j >= 0; j--){
      if(a[j] < a[j+1])  break;
      temp = a[j];
      a[j] = a[j+1];
      a[j+1] = temp;
    }
    Nprint(a, n);
  }
}


void Nprint(int *a, int n){
  int i;

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

Measured memory_bytes: 604
def main():
  N=input()
  arr=list(map(int,input().split()))
  sum=0
  for i in range(1,int(N)):
    if arr[i] < arr[i-1]:
      sum+= (arr[i-1]-arr[i])
      arr[i]=arr[i-1]
  print(sum)

if __name__ == '__main__':
  main()
  

Measured memory_bytes: 32316
#include<iostream>
#include<algorithm>
#include<queue>
using namespace std;
typedef long long llint;

llint a,b,c;
llint x[10];
void input(){
  cin >> a >> b >> c;
}

void solve(){
  input();
  for(int i=1;i<=9;i++){
    x[i]=0;
  }
  x[a]++;
  x[b]++;
  x[c]++;
  bool f=false;
  for(int i=1;i<=9;i++){
    if(x[i]==2){
      f=true;
      break;
    }
  }
  if(f) cout << "Yes";
  else cout << "No";
  cout << endl;
}
int main(void){
  solve();
  return 0;
}


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

using namespace std;

int main() {
    int n, k;
    cin >> n >> k;
    vector<int> v(n + 1), minimum_cost(n + 1);
    for(int i = 1; i <= n; i++)
        cin >> v[i];

    minimum_cost[1] = 0;
    for (int i = 2; i <= n; i++) {
        int curr_min_cost = INT_MAX;
        for (int j = 1; j <= k && i > j; j++)
            curr_min_cost = min(curr_min_cost, minimum_cost[i - j] + abs(v[i] - v[i - j]));
        minimum_cost[i] = curr_min_cost;
    }

    cout << minimum_cost[n];
    return 0;
}


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

using namespace std;

int main(){
    int N,M;
    cin>>N>>M;
    vector<bool> good(N);
    
    for(int i=0;i<M;i++){
        int a,b;
        cin>>a>>b;
        if(a==1||a==N){
            if(good[b]){
                cout<<"POSSIBLE";
                return 0;
            }
            good[b] = true;
        }else if(b==1||b==N){
            if(good[a]){
                cout<<"POSSIBLE";
                return 0;
            }
            good[a]=true;
        }
    }
    cout<<"IMPOSSIBLE";
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <utility>
#include <vector>
#include <queue>
using namespace std;
using Graph = vector<vector<int>>;


int main() {
  int N, M;
  cin >> N >> M;

  Graph G(N);
  for (int i = 0; i < M; ++i) {
    int a, b;
    cin >> a >> b;
    G[a-1].push_back(b-1);
    G[b-1].push_back(a-1);
  }

  int signs[N];
  for (int i = 0; i < N; ++i) {
    signs[i] = -1;
  }

  queue<pair<int, int>> que;
  que.push(make_pair(0, 0));

  while (!que.empty()) {
    pair<int, int> p = que.front();
    que.pop();
    int from = p.first;
    int to = p.second;
    if (signs[to] == -1) {
      signs[to] = from;
      for (int next: G[to]) {
        que.push(make_pair(to, next));
      }
    }
  }

  bool isPossible = true;
  for (int i = 1; i < N; ++i) {
    if (signs[i] == -1) isPossible = false;
  }

  if (isPossible) {
    cout << "Yes" << endl;
    for (int i = 1; i < N; ++i) {
      cout << signs[i] + 1 << endl;
    }
  } else {
    cout << "No" << endl;
  }

  return 0;
}


Measured memory_bytes: 12124
#include <bits/stdc++.h>
using namespace std;
#define int             long long
#define gcd(a, b)       __gcd(a, b)
#define here            cout<<"here";
#define lcm(a, b)       ((a)*1ll * (b)) / gcd(a, b)
#define pb              push_back
#define mp              make_pair
#define setbits(x)      __builtin_popcountll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define nl              "\n"
#define vi              vector<int>
#define vd              vector<double>
#define vc              vector<char>
#define vs              vector<string>
#define vvi             vector<vector<int> >
#define F               first
#define S               second
#define pii             pair<int,int>
#define w(x)            int x; cin>>x; while(x--)
#define fre(i,a,n)      for (int i = a; i <= n; ++i)
#define fr(i,n)         for (int i = 0; i < n; ++i)
#define rf(i,n,a)       for (int i = n; i >=a; --i)
#define FIO             ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
int pow(int a, int b, int m)
{
        int ans = 1;
        while (b)
        {
                if (b & 1)
                        ans = (ans * a) % m;
                b /= 2;
                a = (a * a) % m;
        }
        return ans;
}
int modInv(int a, int m)
{
        a = a % m;
        for (int x = 1; x < m; x++)
                if ((a * x) % m == 1)
                        return x;
}
//when m is prime
int modinv(int a, int m)
{
        return pow(a, m - 2, m);
}


////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////
const int N = 100005;
int a[105];
int n,k;
int dp[N]={0};

void solve()
{

        cin>>n>>k;
        fr(i,n) cin>>a[i];
        sort(a,a+n);
        //cout<<func(k);
        fre(i,1,k){
                int j=0;
                fr(j,n){
                        if(i-a[j]>=0 and dp[i-a[j]]==0) {dp[i]=1;break;}
                }
        }
        (!dp[k]) ? cout<<"Second":cout<<"First"; 

}


////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////


int32_t main()
{
        FIO;


        solve();
        // w(x)    {solve();}
#ifndef ONLINE_JUDGE
        cerr << "\nTime Taken : " << 1.0 * clock() / CLOCKS_PER_SEC << " sec\n";
#endif
}


Measured memory_bytes: 1024
import scala.math.{min,max}

object Main {
    def main(args: Array[String]) {
        var input = io.Source.stdin.getLines().mkString("\n");
        val xs = input.split('\n').map(_.toInt).toArray;
        // var ss = input.split('\n').toList;
        // val xs = to_array_int(ss(0));
        val k = xs(5);
        var res = xs(4) - xs(0) <= k;
        println(if (res) "Yay!" else ":(");
    }
    def to_array_int(s: String): Array[Int] = {
        return s.split(' ').map(_.toInt).toArray;
    }
}


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

int main(){
    int N;
    cin >> N;
    int A[N];
    int ans =0;
    for(int i=0;i<N;i++) A[i] = i+1;

    for(int i=0;i<N;i++){
        int a =0;
        while(A[i]>0){
            A[i] /= 10;
            a++;
        }
        if(a%2==1) ans++; 
    }
    cout << ans <<endl;

}

Measured memory_bytes: 640
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <functional>
#include <utility>

int n; int A[100005], cnt[100005];
inline bool check() {
  if(A[n] != A[n - 1]) return false;
  int half = (A[n] + 1) / 2;
  if(A[1] < half) return false;
  for(int i = half + 1; i <= A[n]; i ++) {
    if(cnt[i] < 2) return false;
  }
  if(A[n] & 1) {
    if(cnt[half] != 2) return false;
  } else {
    if(cnt[half] != 1) return false;
  }
  return true;
}

int main() {
  scanf("%d", &n);
  for(int i = 1; i <= n; i ++) scanf("%d", &A[i]), cnt[A[i]] ++;
  std::sort(A + 1, A + 1 + n);
  if(check()) {
    puts("Possible");
  } else {
    puts("Impossible");
  }
  return 0;
}

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

using namespace std;

//------------------------------- Type Names -------------------------------//

using i64 = int_fast64_t;

using seika = string;
//{akari : 1D, yukari : 2D, maki : 3D} vector
template <class kizuna>
using akari = vector<kizuna>;
template <class yuzuki>
using yukari = akari<akari<yuzuki>>;
template <class tsurumaki>
using maki = akari<yukari<tsurumaki>>;
//{akane : ascending order, aoi : decending order} priority queue
template <class kotonoha>
using akane = priority_queue<kotonoha, akari<kotonoha>, greater<kotonoha>>;
template <class kotonoha>
using aoi = priority_queue<kotonoha>;

//------------------------------- Libraries ---------------------------------//

//------------------------------- Dubug Functions ---------------------------//

inline void print()
{
    cout << endl;
}
template <typename First, typename... Rest>
void print(const First &first, const Rest &... rest)
{
    cout << first << ' ';
    print(rest...);
}

//------------------------------- Solver ------------------------------------//

void solve()
{
    i64 x;
    cin >> x;
    i64 c = 100;
    for (int i = 1;; i++)
    {
        c = c * 1.01;
        if (c >= x)
        {
            cout << i << endl;
            return;
        }
    }
}

int main()
{
    solve();
    return 0;
}


Measured memory_bytes: 3584
#include <stdio.h>
#define number 1000000

char prime[number];

int gcd(int n, int m) {
	if(!m) return n;
	else gcd(m, n%m);
}

void Eratosthenes(char prime[]) {
	long i, j;
	prime[1] = 1;
	for(i = 2; i < number; i++ ) {
		if(!prime[i]) {
			//printf("%d\n",i);
			for(j = 2; j*i < number; j++ ) {
				prime[i*j] = 1;
			}
		}
	}
}

int main(void) {
	int a, d, n, i, count = 0;
	Eratosthenes(prime);
	while(scanf("%d%d%d",&a,&d,&n), a+d+n) {
		count = 0;
		for(i = 0; a + i*d < number; i++ ) {
			if(!prime[a + i*d]) {
				count++;
				if(count == n) {
					printf("%d\n",a + i*d);
					break;
				}
			}
		}
	}
	return 0;
}

Measured memory_bytes: 1576
#include <bits/stdc++.h>
#define rep(i, a) for(int i = 0; i < a; i++)
#define all(v) v.begin(), v.end()
#define dcout cout << fixed << setprecision(15)
#define arep(i, a) for(auto i : a)
#define F first
#define S second
#define VE vector<int>
#define pb(x) push_back(x)
#define MOD 1000000007
#define INF 10000000000
#define int long long
#define KETA(n) floor(log10(n) + 1)
using namespace std;
signed main() {
    double r;
    cin >> r;
    dcout << r * 2 * M_PI;

    return 0;
}

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

#define REP(i,n) for(ll i=0; i<(ll)(n); i++)
#define FOR(i,n,m) for (ll i=n; i<(ll)(m); i++)
#define pb push_back
#define INF 1000000007LL
#define all(a) (a).begin(),(a).end()
#define chmin(a,b) a=min(a,b)
#define chmax(a,b) a=max(a,b)

typedef long long ll;
typedef pair<int,int> p;

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

int main(){
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    ll num = 0;
    map<int, ll> eachnum;
    REP(i, N) {
        string s;
        cin >> s;
//        if (s[0] == 'M' || s[0] == 'A' || s[0] == 'R' || s[0] == 'C' || s[0] == 'H') {
//            num++;
//        }
        eachnum[s[0]]++;
    }
        ll ans = 0;
        // MAR
        ans += eachnum['M'] * eachnum['A'] * eachnum['R'];
        // MAC
        ans += eachnum['M'] * eachnum['A'] * eachnum['C'];
        // MAH
        ans += eachnum['M'] * eachnum['A'] * eachnum['H'];
        // MRC
        ans += eachnum['M'] * eachnum['R'] * eachnum['C'];
        // MRH
        ans += eachnum['M'] * eachnum['R'] * eachnum['H'];
        // MCH
        ans += eachnum['M'] * eachnum['C'] * eachnum['H'];
        // ARC
        ans += eachnum['A'] * eachnum['R'] * eachnum['C'];
        // ARH
        ans += eachnum['A'] * eachnum['R'] * eachnum['H'];
        // ACH
        ans += eachnum['A'] * eachnum['C'] * eachnum['H'];
        // RCH
        ans += eachnum['R'] * eachnum['C'] * eachnum['H'];
    
    cout << ans << endl;
    
    return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
  int N;
  cin >> N;
  int num4 = 0,num2 = 0;
  for(int i=0;i<N;++i){
    long int a;
    cin >> a;
    if(a%4==0){
      num4++;
    }else if(a%2==0){
      num2++;
    }
  }

  if(num2%2==0){
    if(N-1<=2*num4+num2){
      cout << "Yes" << endl;
    }else{
      cout << "No" << endl;
    }
  }else{
    if(N<=2*num4+num2){
      cout << "Yes" << endl;
    }else{
      cout << "No" << endl;
    }
  }
}

Measured memory_bytes: 256
s;n,k,i,y;d['   '];c(int*z){i=*1[&z]-*z;}main(x){for(scanf("%*d");~scanf("%d%d",&n,&k);printf("%d\n",s)){for(i=n--;s=i;y=x)scanf("%d",&x),d[--i]=x-y;for(qsort(d,n,4,c);n>=k;s+=d[--n]);}}

Measured memory_bytes: 1228
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

func getScanner(fp *os.File) *bufio.Scanner {
	scanner := bufio.NewScanner(fp)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 500001), 500000)
	return scanner
}

func getNextString(scanner *bufio.Scanner) string {
	scanner.Scan()
	return scanner.Text()
}

func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}

func main() {
	fp := os.Stdin
	if len(os.Args) > 1 {
		fp, _ = os.Open(os.Args[1])
	}

	scanner := getScanner(fp)
	writer := bufio.NewWriter(os.Stdout)

	n := getNextInt(scanner)
	dd := make([]int, n)

	for i := 0; i < n; i++ {
		dd[i] = getNextInt(scanner)
	}
	sort.Sort(sort.IntSlice(dd))
	n--
	ans := dd[(n>>1)+1] - dd[(n>>1)]
	fmt.Fprintln(writer, ans)
	writer.Flush()
}


Measured memory_bytes: 2560
#include<stdio.h>
#include <stdlib.h>
int main(void){
	char q[3][3];
	char a[3];
	char buf;
	for(int i=0;i<3;i++){
		for(int j=0;j<3;j++){
			scanf(" %c",&q[i][j]);//入力時の　が邪魔してる
			if(i==j){
		 		a[i]=q[i][j];
			}
		}
	}
	for(int i=0;i<3;i++){
	printf("%c",a[i]);
	}
	return 0;
}

Measured memory_bytes: 128
import java.util.Scanner;
import java.util.Arrays;
public class Main {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        
        int A=sc.nextInt();
        int B=sc.nextInt();
        String S=sc.next();
        
        String ans="Yes";
        
        for(int i=0;i<A;i++){
            if(S.substring(0,1).equals("-")){
                ans="No";
            }
            S=S.substring(1);
        }
        if(!S.substring(0,1).equals("-")){
                ans="No";
            }
            S=S.substring(1);
        for(int i=0;i<B;i++){
            if(S.substring(0,1).equals("-")){
                ans="No";
            }
            S=S.substring(1);
        }
        
        System.out.println(ans);
    }
}

Measured memory_bytes: 21972
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long
#define fw(p) for(int w=0;w<(p);w++)
#define fx(p) for(int x=0;x<(p);x++)
#define fy(p) for(int y=0;y<(p);y++)
#define fz(p) for(int z=0;z<(p);z++)
#define fyg(p,g) for(int y=(g);y<(p);y++)
#define fzg(p,g) for(int z=(g);z<(p);z++)
#define ce(d) cout<<d<<endl;
#define ces(d) cout<<" "<<endl;

int main() {
 int N,M;
 cin>>N>>M;
 vector<int> A(200001);
 vector<int> B(200001);
int check=0;
 fx(M){
 	int a,b;
 cin>>a>>b;
 if(a==1){
 	A.at(b)=1;
 }
 if(b==N){
 	B.at(a)=1;
 }

}
 bool flag=false;
 fx(N){
    if(A.at(x)==1&&B.at(x)==1){
 	ce("POSSIBLE");
    flag=true;
    break;
  }
 }
 
 if(!flag){
 	ce("IMPOSSIBLE");
 }

}

Measured memory_bytes: 1792
#include <cstdio>
char a[19];
int main()
{
	int i;
	for(i=1;i<20;i++)
	{
		scanf("%c",&a[i]);
	}
	for(i=1;i<6;i++)
	{
		printf("%c",a[i]);
	}
	printf(" ");
		for(i=7;i<14;i++)
	{
		printf("%c",a[i]);
	}
printf(" ");
		for(i=15;i<20;i++)
	{
		printf("%c",a[i]);
	}

	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define str string
#define fori(i,N) for(long long i=1;i<=N;++i)
#define forj(j,m) for(long long j=1;j<=m;++j)
#define fork(k,n) for(long long k=1;k<=n;++k)
#define fors(i,ssz) for(long long i=0;i<s.size();++i)
#define Need_for_Speed ios_base::sync_with_stdio(false);cin.tie(NULL);
using namespace std;
ll N,W,w[101],v[101],dp[101][100001],s,i;
int main(){
	cin>>N>>W;
	fori(i,N)
	cin>>w[i]>>v[i];
	
	for(i=0;i<=W;++i)       
    dp[0][i]=0;
    
	for(s=1;s<=N;++s){                   
    	for(i=0;i<=W;++i){
    		
        	dp[s][i]=dp[s-1][i];
			 
        	if(i >= w[s] && (dp[s - 1][ i - w[s] ] + v[s] > dp[s][i]))
            dp[s][i] = dp[s-1][i-w[s]]+v[s];
    	}
	}
	cout<<dp[N][W];
}

Measured memory_bytes: 82456
import java.util.Scanner;
public class Main{

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int w = sc.nextInt();
		int h = sc.nextInt();
		int n = sc.nextInt();
		
		int wmin = 0;
		int wmax = w;
		int hmin = 0;
		int hmax = h;
		
		for(int i = 0; i < n ;i++) {
			int x = sc.nextInt();
			int y = sc.nextInt();
			int a = sc.nextInt();
			
			if(a == 1) {
				wmin = Math.max(wmin, x);
			}
			if(a == 2) {
				wmax = Math.min(wmax, x);
			}
			if(a == 3){
				hmin = Math.max(hmin, y);
			}
			if(a == 4) {
				hmax = Math.min(hmax, y);
			}
			
		}
		
		if(wmax <= wmin || hmax <=hmin) {
			System.out.println(0);
		}
		else {
			System.out.println((wmax-wmin)*(hmax - hmin));
		}
	}
}


Measured memory_bytes: 21844
N = int(input())

word = input()
prev_char = word[-1]
word_set = set()
word_set.add(word)
flag = True
for i in range(N-1):
    word = input()
    if word in word_set or word[0] != prev_char:
        flag = False
        
    word_set.add(word)
    prev_char = word[-1]
if flag:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 38384
import java.util.*;
 
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int x = sc.nextInt();
    int a = sc.nextInt();
    int b = sc.nextInt();
    int ans = x-a;
    while(ans > 0){
      ans -= b;
    }
    if(ans < 0){
      ans += b;
    }
    System.out.println(ans);
  }
}

Measured memory_bytes: 21844
import itertools

n = int(input())

li = list(map(int,input().split()))

li = list(itertools.combinations(li, 3))

count = 0

for i in li:
    amari = sum(i) - max(i)
    if amari > max(i):
        if len(set(i)) == 3:
            count += 1

print(count)




Measured memory_bytes: 20480
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <string>

using namespace std;
typedef long long ll;
string s;
int main()
{
    cin >> s;
    int a=0,b=0;
    int state=0;
    for(int i=0;i<s.length();i++){
        if(s[i]-48==state)
            state=!state;
        else{
            state=!state;
            a++;
        }
    }
    state=1;
    for(int i=0;i<s.length();i++){
        if(s[i]-48==state)
            state=!state;
        else{
            state=!state;
            b++;
        }
    }
    cout << min(a,b) << endl;
    return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define ll long long
const ll mod = 1e9 + 7;				//adjust mod value according to your need
int main()
{
	SPEED
	int m1, d1, m2, d2;
	cin >> m1 >> d1;
	cin >> m2 >> d2;
	int look[] = {-1,31,28,31,30,31,30,31,31,30,31,30,31};
	if (look[m1]==d1)
		cout << 1;
	else
		cout << 0;
	return 0;
}

Measured memory_bytes: 256
N = int(input())
info = [[int(i) for i in input().split()] for i in range(N)]
for i in range(N):
    if info[i][2] != 0:
        l = i
        break
for i in range(101):
    Cx= i
    for j in range(101):
        Cy = j
        h = info[l][2] + abs(info[l][0]-Cx) + abs(info[l][1]-Cy)
        for m in range(N):
            if info[m][2] != max(h-abs(info[m][0]-Cx)-abs(info[m][1]-Cy),0):
                break
            if m == N-1:
                print(str(i)+" "+str(j)+" "+str(h))

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define INF 9223372036854775807LL
#define inf 1000000007
#define SYOU(x) setprecision(x+1)
#define abs(x,y) (max(x,y)-min(x,y))
#define lol long long
#define mp make_pair
#define fi first
#define se second
using namespace std;
lol a,b,c,d;
signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >>a>>b>>c;
  if(a%2==0||b%2==0||c%2==0) {
      cout <<"0\n";
      return 0;
  }
  if(c<a) swap(c,a);
  if(c<b) swap(b,c);
  cout <<a*b<<'\n';
  return (0);
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>
#include<stack>
#include<queue>
#include<vector>
#include<algorithm>
#include <iomanip>
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++)
#define ALL(a) (a).begin(),(a).end()
//#define EVEL 1

#ifndef EVEL
#define DEB(X) cout << #X << ":" <<X<<" " ;
#define TF(f) f ? cout<<"true  " : cout<<"false ";
#define END cout<<"\n";
#else
#define DEB(X) {X=X;}
#define TF(f) {f=f;}
#define END {}
#endif
const int MOD = 1000000007;
const ll INF =  1000000000;
const ll SIZE= 100010;
    ll N,A,B,C;
    ll ans=-1;
    bool flag=false;

int main() {
    ios_base::sync_with_stdio(false);
    cin>>A>>B>>C;
    if(A%2!=0||B%2!=0||C%2!=0){
        cout<<"0"; return 0;
    }
    if(A==B&&B==C){
        cout<<"-1"; return 0;
    }
    for(int i=1;;i++){
        int a=A/2,b=B/2,c=C/2;
        int odd=0;
        if(a%2==1)odd++;
        if(b%2==1)odd++;
        if(c%2==1)odd++;
        if(odd==2||odd==1){
            cout<<i;return 0;
        }
        if(i>=100000000){cout<<"-1"; return 0;}
        A=b+c;B=a+c;C=a+b;
    }
    //cout<<ans;
    return 0;
}


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

int main(){
  int n, m; cin >> n >> m;
  vector<int> food(m, 0);
  for(int i = 0; i < n; i++){
    int k; cin >> k;
    for(int j = 0; j < k; j++){
      int a; cin >> a;
      a--;
      food.at(a)++;
    }
  }
  int ans = 0;
  for(int i = 0; i < m; i++){
    if(food.at(i) == n) ans++;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<iomanip>
#include<algorithm>
#define  ll  long long
#define ull unsigned long long
#define  sl(a)  scanf("%lld",&a);
using namespace std;
ll dp[100005],fr[100005];
int main()
{
    ll n,i,j,k,l,m,mini=100000000000;
    cin>>n>>k;
    for(i=1;i<=n;i++)
    {
        cin>>fr[i];
    }
    if(k>=n)
    {
        k=n-1;
    }
    dp[1]=0;
    for(i=2;i<=k+1;i++)
    {
        dp[i]=abs(fr[i]-fr[1]);
    }
    for(i=k+2;i<=n;i++)
    {
        for(j=i-1;j>=i-k;j--)
        {
          l=dp[j]+abs(fr[i]-fr[j]);
          mini=min(l,mini);
        }
        dp[i]=mini;
        mini=100000000000;
    }
    cout<<dp[n]<<endl;
    return 0;
}



Measured memory_bytes: 1792
#include <stdio.h>
#include <string.h>

main(){
  char s[1001];
  scanf("%s", s);

  int l = strlen(s);
  char k;
  for(int i=0;i<l;i++){
    k = s[i]-3;
    if(k < 'A') k += 26;
    printf("%c", k);
  }

  puts("");
}
      

Measured memory_bytes: 0
n = int(input())
S = [input() for _ in range(n)]
m = int(input())
T = [input() for _ in range(m)]

ans = 0
for s in S:
    rwd = 0
    for i in range(n):
        if s == S[i]:
            rwd += 1
    for i in range(m):
        if s == T[i]:
            rwd -= 1
    ans = max(rwd, ans)
print(ans)

Measured memory_bytes: 9020
import java.util.ArrayList;
import java.util.Scanner;


class Main {



	public static void main(String[] args) {   

		Scanner scanner = new Scanner(System.in);
		String W= scanner.nextLine();


		ArrayList<String> array = new ArrayList<String>();//単語ごとに格納するリストを生成

		int loop=0;//ループ制御用の変数
		int count=0;//単語カウント用の変数
		while (scanner.hasNextLine()) {//END_OF_TEXTが入力された場合終了
			
			String Tword= scanner.next();
			
			if (Tword.equals("END_OF_TEXT")) { 
				break;
			}
			Tword=Tword.toLowerCase( );
			
			array.add(Tword);//リストに格納
			
			loop=loop+1;
			
			}

		for(int i=0;i<loop;i++){
			
			String Word = array.get(i);
			if(Word.equals(W)){
				count=count+1;
			}
			
			
			
		}
		System.out.println(count);

		scanner.close();


	}
}




Measured memory_bytes: 26880
class Q1053
  def dist a,b
    ::Math.sqrt(a*a + b*b)
  end
  def doIt
    d = gets.to_f
    eps = 10**(-12)
    while 0 < d
      ary = gets.split(" ").map{|x| x.to_f}
      ip = ary[0]*ary[2] + ary[1]*ary[3]
      p = dist(ary[0],ary[1])
      v = dist(ary[2],ary[3])
      cosine = ip / (p*v)
      #printf("cos = %.17f\n", cosine)
      #puts p
      if 1 - eps < cosine && cosine < 1 + eps
        if 2 - p <= d
          puts(2 - p)
        else
          puts "impossible"
        end
      elsif -1 - eps < cosine && cosine < -1 + eps
        if p <= d
          puts p
        else
          puts "impossible"
        end
      else
        puts "impossible"
      end
      d = gets.to_f
    end
  end
end

Q1053.new.doIt

Measured memory_bytes: 5404
# Union Find
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self  .members(r)) for r in self.roots())


n, m, k = map(int, input().split())

# #friend = [[0 for _ in range(n)] for _ in range(n)]
friend = [1 for _ in range(n)]
uf = UnionFind(n)

for i in range(m):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    friend[a] += 1
    friend[b] += 1
    uf.union(a, b)

for i in range(k):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    if uf.same(a, b):
        friend[a] += 1
        friend[b] += 1

# print(uf)
for i in range(n):
    if i != n-1:
        print(uf.size(i) - friend[i], end=" ")
    else:
        print(uf.size(i) - friend[i])


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

int main()
{
    int n;
    scanf("%d", &n);
    int a[n];
    for (int i = 0; i < n; i++)
    {
        scanf("%d", &a[i]);
    }

    for (int i = n - 1; i >= 0; i--)
    {
        if (i != n - 1)
            printf(" ");
        printf("%d", a[i]);
    }
    printf("\n");
}


Measured memory_bytes: 3208
using System;

namespace ABC117_A
{
	internal class Program
	{
		public static void Main(string[] args)
		{
			string[] input = Console.ReadLine().Split();
			double t = double.Parse(input[0]);
			double x = double.Parse(input[1]);

			double ans = t / x;
			Console.WriteLine(ans);
		}
	}
}


Measured memory_bytes: 11220
#include <algorithm>
#include <iostream>
#include <vector>
#define all(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;

vector<ll> divisor(ll n) {
    vector<ll> res;
    for (ll i = 1; i * i <= n; ++i) {
        if (n % i == 0 ) {
            res.push_back(i);
            if (n / i != i) res.push_back(n / i);
        }
    }
    sort(all(res));
    return res;
}



int main() {
    int n;
    ll m;
    cin >> n >> m;

    vector<ll> d = divisor(m);

    ll idx = lower_bound(all(d), n) - d.begin();
    cout << (m / d[idx]) << endl; 
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
#define MAX 35
typedef pair<int,int> pii;
typedef pair<int,pii> piii;
 
int H,W,T;
vector<piii> vec;
 
bool check(int s){
  int now = s;
 
  for(int i = 0 ; i < vec.size() ; i++){
    if(vec[i].second.first == now){
      now = vec[i].second.second;
    }else if(vec[i].second.second == now){
      now = vec[i].second.first;
    }
  }
  return now == T;
}
 
int main(){
  int S;
  bool G[MAX][MAX][MAX];
  char in;
   
  while(cin >> W,W){
    memset(G,false,sizeof(G));
    vec.clear();
    cin >> S >> T >> H; S--; T--;
    for(int i = 0 ; i < H ; i++){
      for(int j = 0 ; j < W-1 ; j++){
        cin >> in;
        if(in == '1'){
          if(j > 0){
            G[i][j-1][j] = true;
          }
          G[i][j][j+1] = G[i][j+1][j+2] = true;
          vec.push_back(piii(i,pii(j,j+1)));
        }
      }
    }
    sort(vec.begin(),vec.end());
    if(check(S)){
      cout << 0 << endl;
    }else{
      bool found = false;
      for(int i = 0 ; i < H ; i++){
        for(int j = 0 ; j < W-1 ; j++){
          if(G[i][j][j+1]) continue;
          vector<piii> tmp = vec;
          vec.push_back(piii(i,pii(j,j+1)));
          sort(vec.begin(),vec.end());
          if(check(S)){
            cout << i+1 << " " << j+1 << endl;
            found = true;
            goto end;
          }
          vec = tmp;
        }
      }
    end:;
      if(!found){
        cout << 1 << endl;
      }
    }
  }
  return 0;
}

Measured memory_bytes: 1252