akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<map>
#include<tuple>
#include<algorithm>
#include<cmath>
#include<limits>
#include<set>
#include<queue>

using namespace std;
#define int long  long int
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }

signed main()
{
	int N, D;
	cin >> N >> D;
	vector<vector<int>>v(N, vector<int>(D));
	for (int i = 0; i < N; i++)
	{
		for (int j = 0; j < D; j++)
		{
			cin >> v[i][j];
		}
	}
	int sum;
	int in;
	double dbl;
	int cnt = 0;
	for (int i = 0; i < N - 1; i++)
	{
		for (int j = i + 1; j < N; j++)
		{
			sum = 0;
			for (int k = 0; k < D; k++)
			{
				sum += (v[i][k] - v[j][k])*(v[i][k] - v[j][k]);
			}
			in = sqrt(sum);
			dbl = sqrt(sum);
			if (in == dbl)cnt++;
		}
	}
	cout << cnt;
}

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

using namespace std;

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

	list<int> ans;

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

		if (i % 2 == 0)
		{
			ans.push_back(a);
		}
		else
		{
			ans.push_front(a);
		}
	}

	if (N % 2 != 0)
		ans.reverse();

	for (auto it = ans.begin(); it != ans.end();it++)
	{
		if (it != ans.begin())
			cout << " ";

		cout << *it;
	}
	cout << endl;

	return 0;
}


Measured memory_bytes: 8448
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <cmath>
#include <utility>
#include <map>
#include <unordered_map>
using namespace std;
typedef long long int ll;

int main() {
  int N;
  cin>>N;
  
  for(int i=1;i<=9;++i){
    for(int j=1;j<=9;++j){
      if(i*j==N){
        cout<<"Yes"<<endl;
        return 0;
      }
    }
  }
  
  cout<<"No"<<endl;
  return 0;
}


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

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()


def main():
    s = set()
    a = LI()
    i = 0
    while True:
        if a[0] % 2 == 1 or a[1] % 2 == 1 or a[2] % 2 == 1:
            return i
        i += 1
        k = tuple(a)
        if k in s:
            return -1
        s.add(k)
        a = [a[0]//2+a[1]//2, a[1]//2+a[2]//2, a[0]//2+a[2]//2]


print(main())


Measured memory_bytes: 8128
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//using namespace __gnu_pbds;
using namespace std;
#define all(x) (x).begin(),(x).end()
#define dlog(x) cerr<<#x<<'='<<x<<endl
#define f first
#define s second
#define endl '\n'
#define sq(x) (x)*(x)*1ll
//typedef tree<int,null_type,less_equal<int>,rb_tree_tag,
//      tree_order_statistics_node_update> indexed_multiset;
//typedef tree<int,null_type,less<int>,rb_tree_tag,
//      tree_order_statistics_node_update> indexed_set;
typedef long long ll;
typedef pair<int,int> pii;


int main () {
        ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
//        freopen("test_input.txt", "r", stdin);
        int n; cin >> n;
        vector<int> a(n + 1), b(n);
        for (int i = 0; i < n + 1; i++) {
                cin >> a[i];
        }


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

        ll ans = 0;
        for (int i = 0; i < n; i++) {
                ans += min(a[i], b[i]);
                b[i] -= min(a[i], b[i]);
                ans += min(a[i + 1], b[i]);
                a[i + 1] -= min(a[i + 1], b[i]);
        }

        cout << ans;
        return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define inf 1e9

ll mdist(pair<int, int> p, pair<int, int> q) {
  return abs(p.first - q.first) + abs(p.second - q.second);
}

int main() {
  int n, m, i, j;
  ll dist;
  cin >> n >> m;
  vector<pair<int, int>> st(n), cp(m);
  vector<int> ans(n, 0);
  for (i = 0; i < n; i++) {
    cin >> st[i].first >> st[i].second;
  }
  for (i = 0; i < m; i++) {
    cin >> cp[i].first >> cp[i].second;
  }
  for (i = 0; i < n; i++) {
    dist = inf;
    for (j = 0; j < m; j++) {
      if (dist > mdist(st[i], cp[j])) {
        dist = mdist(st[i], cp[j]);
        ans[i] = j + 1;
      }
    }
  }
  for (i = 0; i < n; i++) {
    cout << ans[i] << "\n";
  }
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
#define SZ(x) ((int)(x).size())
#define rep(i,n) for(int i=0;i<(n);++i)
#define fore(i,a) for(auto &i:a)
#define min(...) min({__VA_ARGS__})
#define max(...) max({__VA_ARGS__})
#define Yes cout << "Yes" << endl;
#define No cout << "No" << endl;
#define ALL(x) (x).begin(),(x).end()
signed _main(); signed main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> using v = vector<T>;
template<class T> using vv = vector<v<T>>;
const int MOD=1e9+7;
const long long INF = 1LL << 60;
using P=pair<int,int>;

signed _main(){
  int N; cin >> N;
  v<int> A(N);
  rep(i,N) cin >> A[i];
  sort(ALL(A));
  deque<int> d;
  d.push_back(A[0]);
  int right=1,left=N-1;
  while(right<=left){
    if(right==left){
      d.push_front(A[right]);
      break;
    }
    if(right+1==left){
      d.push_front(A[right]);
      d.push_back(A[left]);
      break;
    }
    if(right+1==left-1){
      d.push_front(A[left-1]);
      d.push_back(A[left]);
      d.push_front(A[right]);
      break;
    }
    d.push_front(A[left-1]);
    d.push_back(A[left]);
    d.push_front(A[right]);
    d.push_back(A[right+1]);
    right+=2;
    left-=2;
  }
  int ans=0;
  rep(i,N-1){
    ans+=abs(d[i]-d[i+1]);
  }
  d.clear();
  d.push_back(A[N-1]);
  right=0,left=N-2;
  while(right<=left){
    if(right==left){
      d.push_front(A[right]);
      break;
    }
    if(right+1==left){
      d.push_front(A[right]);
      d.push_back(A[left]);
      break;
    }
    if(right+1==left-1){
      d.push_front(A[right]);
      d.push_back(A[right+1]);
      d.push_front(A[left]);
      break;
    }
    d.push_front(A[right]);
    d.push_back(A[right+1]);
    d.push_front(A[left-1]);
    d.push_back(A[left]);
    right+=2;
    left-=2;
  }
  int tans=0;
  rep(i,N-1){
    tans+=abs(d[i]-d[i+1]);
  }

  cout << max(ans,tans) << endl;
  return 0;
}


Measured memory_bytes: 1920
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n;
  string s;
  cin >> n >> s;  
  int East = 0;
  for(int i=0; i<n; i++){
    East += (s[i]=='E');
  }
  int ans = East;
  int tmp = East;
  for (int i=0; i<n; i++){
    if(s[i]=='E') tmp --;
    if(i>=1){
      if(s[i-1] =='W') tmp ++;
    }
  ans = ans>tmp?tmp:ans;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 900
/*dismint|jjc*/
#include <bits/stdc++.h>
using namespace std;
#define forl(V, S, E) for(int V = S; V < E; V++)
#define ford(V, S, E) for(int V = S; V >= E; V--)
#define fore(E, X) for(auto &E:X)
#define println(X) cout << X << endl
#define printe(X) for(auto &E:X) cout << E << " "; cout << endl
typedef unordered_map<int, unordered_set<int>> graph;
typedef long long ll;

int main() {
	ios_base::sync_with_stdio(false); cin.tie(NULL);
	int k; string s; cin >> k >> s;
	if(s.length() <= k) { println(s); return 0; }
	string f = s.substr(0, k);
	println(f+"...");
}


Measured memory_bytes: 3616
#include <bits/stdc++.h>
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(),(x).end()
#ifdef _DEBUG_
  #define debug(...) printf(__VA_ARGS__)
#else
  #define debug(...) (void)0
#endif
using namespace std;
typedef long long ll;
typedef pair<int,int> PII;
typedef vector<int> VI;

bool marked[3][3] = {0};
bool check() {
  for (int i = 0; i < 3; i++) {
    bool fail = false;
    for (int y = 0; y < 3; y++)
      if (!marked[i][y])
        fail = true;
    if (!fail)
      return true;
  }
  for (int i = 0; i < 3; i++) {
    bool fail = false;
    for (int y = 0; y < 3; y++)
      if (!marked[y][i])
        fail = true;
    if (!fail)
      return true;
  }
  if (marked[0][0] && marked[1][1] && marked[2][2])
    return true;
  if (marked[0][2] && marked[1][1] && marked[2][0])
    return true;
  return false;
}

int main() {
  int A[3][3];
  for (int i = 0; i < 3; i++)
    for (int j = 0; j < 3; j++)
      cin >> A[i][j];
  int N;
  cin >> N;
  for (int i = 0; i < N; i++) {
    int B;
    cin >> B;
    for (int x = 0; x < 3; x++) {
      for (int y = 0; y < 3; y++) {
        if (A[x][y] == B)
          marked[x][y] = true;
      }
    }
  }
  if (check())
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}


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

public class Main{
    static String shuffle(String origin , int h){
        return origin.substring(h , origin.length()) + origin.substring(0 , h);
    }
    public static void main(String[] args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String line;

        while(!(line=br.readLine()).equals("-")){
            int times = Integer.parseInt(br.readLine());
            for(int i = 0; i < times; i++){
                line = shuffle(line , Integer.parseInt(br.readLine()));
            }
            System.out.println(line);
        }

    }
}

Measured memory_bytes: 24408
S = input().strip()
l=len(S)
ans=0
for i in range(0, l-1):
    if i%2==1:
        f=0
        for j in range((i-1)//2):
            if S[j+((i-1)//2)+1]!=S[j]:
                f+=1
        if f<=0:
            ans=i+1
print(ans)
                

Measured memory_bytes: 9120
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int n;
double a[104];

int main(){
    cin>>n;
    for(int i=1;i<=n;i++)cin>>a[i];
    double sum=0;
    for(int i=1;i<=n;i++)sum+=(1.0/a[i]);
    printf("%.6f\n",1.0/sum);
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <vector>
#include <unordered_map>

using namespace std;
using Map = unordered_map<int, int>;

int get_smallest_hop(int i, int k, const vector<int>&vec, Map&memo)
{
  if (i == 0) return 0;
  if (i == 1) return abs(vec[0] - vec[1]);
  int kk = min(k, i);
  int p[kk];
  int ret = 10e9;
  for (int j = 1; j <= kk; ++j){
    int p;
  	if (memo.find(i-j)!=memo.end()) {
    	p = memo[i-j];
  	} else {
   		p = memo[i-j] = get_smallest_hop(i-j, k, vec, memo);
  	}
    ret = min(ret, abs(vec[i-j] - vec[i]) + p);
  }

  return ret;
}


int main()
{
  int n, k; cin >> n >> k;
  vector<int> h;
  
  for (int i = 0; i < n; ++i) {
    int v; cin >> v;
    h.push_back(v);
  }
  
  Map memo;
  cout << get_smallest_hop(n-1, k, h, memo);
  return 0;
}

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


void outch(char ch, int n)
{
    while (n--) {
        cout << ch;
    }
}

void solve(long long sx, long long sy, long long tx, long long ty)
{
    auto ydiff = ty - sy;
    auto xdiff = tx - sx;
    outch('U', ydiff);
    outch('R', xdiff);
    outch('D', ydiff);
    outch('L', xdiff + 1);
    outch('U', ydiff + 1);
    outch('R', xdiff + 1);
    outch('D', 1);
    outch('R', 1);
    outch('D', ydiff + 1);
    outch('L', xdiff + 1);
    outch('U', 1);
    cout << "\n";
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
// clang-format off
int main(){
    long long sx;
    scanf("%lld",&sx);
    long long sy;
    scanf("%lld",&sy);
    long long tx;
    scanf("%lld",&tx);
    long long ty;
    scanf("%lld",&ty);
    cin.tie(nullptr);
    cout.tie(nullptr);
	ios_base::sync_with_stdio(false);
    solve(sx, sy, tx, ty);
    return 0;
}


Measured memory_bytes: 256
///usr/bin/g++ -O2 $0 -o ${0%.cpp} && echo "----------" && ./${0%.cpp}; exit;
#include <bits/stdc++.h>
using namespace std;

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

int a[20], v[20], p[20], n, m;

int solve(int l) {
	int cnt = 0, pos = 1; 
	for(int i = 1; i <= n; i++) a[i] = v[i];
	for(int k = 1; k <= m; k++) {
		int x = p[k]; 
		while(x) {
			int idx = 0; 
			for(int i = pos; i <= n && !idx; i++) 
				if(a[i] == l) idx = i; 
			if(!idx) return 1e9;
			for(int i = idx; i > pos; i--) 
				swap(a[i], a[i - 1]), ++cnt; 
			++pos; --x;
		} l ^= 1; 
	} 


	return cnt; 
}

int main(int argc, char const *argv[]) {
	scanf("%d %d", &n, &m);
	for(int i = 1; i <= n; i++) 
		scanf("%d", &v[i]); 
	
	for(int i = 1; i <= m; i++) 
		scanf("%d", &p[i]);

	printf("%d\n", min(solve(0), solve(1)));
}


Measured memory_bytes: 3228
#include <iostream>
#include <iomanip>

int main()
{
	int n, a;
	char b;
	bool c[52];
	std::cin >> n;
	for (int h = 0; h < 52; h++) {
		c[h] = true;
	}
	for (int i = 0; i < n; i++) {
		std::cin >> b >> a;
		if (b == 'S' && a <= 13) {
			c[a - 1] = false;
		}
		else if(b == 'H'&& a <= 13) {
			c[a + 12] = false;
		}
		else if (b == 'C'&& a <= 13) {
			c[a + 25] = false;
		}
		else if (b == 'D'&& a <= 13) {
			c[a + 38] = false;
		}
	}
	for (int j = 0; j < 52; j++) {
		if (c[j]) {
			if (j < 13) {
				std::cout << "S " << j + 1 << std::endl;
			}
			else if (j < 26) {
				std::cout << "H " << j- 12 << std::endl;
			}
			else if (j < 39) {
				std::cout << "C " << j - 25 << std::endl;
			}
			else if (j < 52) {
				std::cout << "D " << j - 38 << std::endl;
			}
		}
	}
	return 0;
}


Measured memory_bytes: 3084
#include <bits/stdc++.h>
typedef long long int ll;
using namespace std;
int main() {
    int n;
    cin >> n;
    ll a[n + 2];
    for (int i = 1; i <= n; i++) {
        cin >> a[i];
    }
    a[n + 1] = 0;
    ll ret = 0;
    for (int i = 1; i <= n; i++) {
        if (a[i] % 2) {
            if (a[i + 1]) {
                a[i]++;
                a[i + 1]--;
            }
        }
        ret += a[i] / 2;
    }
    cout << ret << endl;
    return 0;
}

Measured memory_bytes: 4344
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define endl "\n"
#define F first
#define S second
#define mod 1000000007
#define pb push_back
#define ios ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
const int NUM = 2e5 + 5;

int main(){
    ios
    int num_tests=1; 
    //cin>>num_tests;
    while(num_tests-->0){
        int n; cin>>n;
        vector<ll> a(n);
        for(auto &x:a) cin>>x;
        --a[0];
        for(int i=1;i<n-1;i++){
            int diff = a[i]-a[i+1];
            if(diff>1){
                cout<<"No"; return 0;
            }
            if(diff==1 and a[i-1]==a[i]){
                cout<<"No"; return 0;
            }
            if(a[i]!=a[i-1]) --a[i];
        }
        //for(auto x:a) cout<<x<<" ";
        cout<<"Yes";
    }   
}


Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <cmath>
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define MA(i,j) make_pair(i,j)
#define PA pair<int,int>
#define PB push_back
#define PQ priority_queue<int>
#define PGQ priority_queue<int,vector<int>,greater<int> >
#define VE vector<int>
#define VP vector<PA>
#define MOD 1000000007
#define INF 1000000007
using namespace std;
//
bool update=false;
int N;
int A[200];
int cnt=0;
int MIN=INF;
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin>>N;
  FOR(i,0,N){
    cin>>A[i];
    if(A[i]%2==1){
      update=true;
    }
  }
  if(update){
    cout<<"0"<<endl;
  }else{
    while(1){
      FOR(i,0,N){
        if(A[i]%2==1){
          update=true;
          break;
        }else{
          A[i]/=2;
        }
      }
      if(update){
        break;
      }
      cnt++;
    }
    cout<<cnt<<endl;
  }
  return 0;
}


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

sys.setrecursionlimit(10**7)
inf = 10**10
mod = 10**9 + 7

def f():
    n = int(input())
    a = list(map(int, input().split()))
    l = list(range(n+2))
    r = list(range(n+2))
    b = [0]*(n+2)
    for i, x in enumerate(a, 1):
        b[x] = i
    c = 0
    for i in range(n,0,-1):
        bi = b[i]
        c += i * (r[bi] - bi + 1) * (bi - l[bi] + 1)
        r[l[bi]-1] = r[bi]
        l[r[bi]+1] = l[bi]
    return c

print(f())


Measured memory_bytes: 37780
from sys import stdin
input = stdin.readline


def main():
  K = int(input())

  if 7 % K == 0:
    print(1)
    return
  if K % 2 == 0:
    print(-1)
    return
  dp = [0]*(10**7)
  const = 7 % K
  dp[0] = const
  ten = 1
  for i in range(1, 10**7):
    ten = ten*10 % K
    new = (7*ten) % K
    dp[i] = (new + dp[i-1]) % K
    if dp[i] % K == 0:
      print(i+1)
      # print(dp[:i+2])
      return

  print(-1)


if(__name__ == '__main__'):
  main()


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

#define int long long
typedef pair<int, int> P;
#define mod 1000000007
#define INF (1LL<<60)
 
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define repi(itr, ds) for (auto itr = ds.begin(); itr != ds.end(); itr++)
#define YES puts("YES")
#define Yes puts("Yes")
#define NO  puts("NO")
#define No  puts("No")
#define ALL(v) (v).begin(), (v).end()
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
 
const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };
 
 
#if 1
//-------------
// DUMPマクロ
// https://www.creativ.xyz/dump-cpp-652/
 
// vector
template <typename T>
istream& operator>>(istream& is, vector<T>& vec) {
    for (T& x : vec) is >> x;
    return is;
}
// pair
template <typename T, typename U>
ostream& operator<<(ostream& os, pair<T, U>& pair_var) {
    os << "(" << pair_var.first << ", " << pair_var.second << ")";
    return os;
}
// vector
template <typename T>
ostream& operator<<(ostream& os, const vector<T>& vec) {
    os << "{";
    for (int i = 0; i < vec.size(); i++) {
        os << vec[i] << (i + 1 == vec.size() ? "" : ", ");
    }
    os << "}";
    return os;
}
// map
template <typename T, typename U>
ostream& operator<<(ostream& os, map<T, U>& map_var) {
    os << "{";
    repi(itr, map_var) {
        os << *itr;
        itr++;
        if (itr != map_var.end()) os << ", ";
        itr--;
    }
    os << "}";
    return os;
}
// set
template <typename T>
ostream& operator<<(ostream& os, set<T>& set_var) {
    os << "{";
    repi(itr, set_var) {
        os << *itr;
        itr++;
        if (itr != set_var.end()) os << ", ";
        itr--;
    }
    os << "}";
    return os;
}
 
#define DUMPOUT cerr
 
void dump_func() {
    DUMPOUT << endl;
}
template <class Head, class... Tail>
void dump_func(Head&& head, Tail&& ... tail) {
    DUMPOUT << head;
    if (sizeof...(Tail) > 0) {
        DUMPOUT << ", ";
    }
    dump_func(std::move(tail)...);
}
#ifdef DEBUG
#define DEB
#define dump(...)                                                              \
    DUMPOUT << "  " << string(#__VA_ARGS__) << ": "                            \
            << "[" << to_string(__LINE__) << ":" << __FUNCTION__ << "]"        \
            << endl                                                            \
            << "    ",                                                         \
        dump_func(__VA_ARGS__)
#else
#define DEB if (false)
#define dump(...)
#endif
#endif


int dp[52345];    // dp[damage] = min of maryoku
 
void solve(){
    int H, N;
    cin >> H >> N;
    vector<int> A(N), B(N);
    rep(i,N) cin >> A[i] >> B[i];
    
    rep(i,H+12345) dp[i]=INF;
    dp[0] = 0;
    
    rep(i,N){
        rep(j,H){
            if(j+A[i] > H+10000) break;
            dp[j+A[i]] = min( dp[j+A[i]], dp[j]+B[i]);
        }
    }
    
    int ans = INF;
    for(int d = H; d<=H+10000; d++){
        ans = min(ans, dp[d]);
    }
    cout << ans << endl;
}

signed main(){
    cout << fixed << setprecision(18) << endl;
    cerr << fixed << setprecision(18) << endl;
    solve();
}


Measured memory_bytes: 384
#include "bits/stdc++.h"
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;

typedef long long ll;
const ll MOD = 1e9 + 7;

int main() {
    ll H, ans = 1;
    cin >> H;
    while (H > 1) {
        H /= 2;
        ans *= 2;
    }
    cout << ans * 2 - 1 << endl;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(void){
  int a, b;
  scanf("%d", &a);
  scanf("%d", &b);
  
  if(a+b == 3){
    printf("%d", 3);
    return 0;
  }else if(a+b == 4){
    printf("%d", 2);
    return 0;
  }else{
    printf("%d", 1);
    return 0;
  }
}

Measured memory_bytes: 128
#include <iostream>
using namespace std;
 
int main()
{
  double w;
    
    while (cin >> w){
      if (w <= 48.0)  cout << "light fly";

      else if (w <= 51.0) cout << "fly";

      else if (w <= 54.0) cout << "bantam";

      else if (w <= 57.0) cout << "feather";

      else if (w <= 60.0) cout << "light";

      else if (w <= 64.0) cout << "light welter";

      else if (w <= 69.0) cout << "welter";

      else if (w <= 75.0) cout << "light middle";

      else if (w <= 81.0) cout << "middle";

      else if (w <= 91.0) cout << "light heavy";

      else  cout << "heavy";
      cout << endl;
    }

    return (0);
}

Measured memory_bytes: 1220
import java.util.*;
class Main{
    void run(){
	Scanner sc=new Scanner(System.in);
	while(true){
	    int n=sc.nextInt();
	    if(n==0)break;
	    int[] A=new int[n];
	    for(int i=0;i<n;i++)
		{
		    A[i]=sc.nextInt();
		}
	    Arrays.sort(A);
	    int sum=0;
	    for(int i=1;i<A.length-1;i++){
		sum+=A[i];
	    }
	    System.out.println(sum/(A.length-2));
	}
    }
    public static void main(String[] args){
	new Main().run();
    }
}

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

/* #pragma */
/*
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
*/

/*alias*/
#define F first
#define S second

#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
#define next asdnext
#define prev asdprev
#define itn int

/*template*/
template<class T>inline bool amax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>inline bool amin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }

/* func */
int GCD(int a,int b){return b?GCD(b,a%b):a;}
long long GCD(long long a, long long b){return b ? GCD(b, a%b) : a;}
int LCM(int a, int b){return a * b / GCD(a, b);}
long long LCM(long long a, long long b){return a * b / GCD(a, b);}

/*struct*/
struct aaa {
	aaa() {
		cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(20);
	};
}aaaaaaa;

/* const */
const int INF = 1001001001;
const long long LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7; //10^9
const double EPS = 1e-9;
const int dx[] = { 1, 1, 0, -1, -1, -1, 0, 1 }, dy[] = { 0, 1, 1, 1, 0, -1, -1, -1 };
//const int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};
//Counterclockwise from the 6o'clock direction
//Take the x-axis downward and the y-axis right

//#define int long long

//g++ -std=c++14 -Wall --pedantic-errors -o template template.cpp
//g++ -std=c++14 -Wall --pedantic-errors template.cpp
//chcp 65001

signed main()
{
    int A, B, C;
    cin >> A >> B >> C;
    
    for (int i = 1; i <= B; ++i) {
        if (A*i%B == C) {
            cout << "YES";
            return 0;
        }
    }
    cout << "NO";		
    return 0;
}

Measured memory_bytes: 256
//コンパイラ最適化用
#pragma GCC optimize("Ofast")
#define _GLIBCXX_DEBUG
//インクルード(アルファベット順)
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<chrono>//実行時間計測
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm,accumulate
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//順序保持しないmap
#include<unordered_set>//順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列
#include<bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<int, int> pii;
typedef pair<ll, ld> pld;
typedef pair<pii, int> ppiii;
typedef pair<pii, ll> ppiill;
typedef pair<pll, ll> ppllll;
typedef pair<pli, int> pplii;
typedef map<int, int> mii;
typedef deque<ll> dll;
typedef queue<ll> qll;
typedef priority_queue<ll> pqll;
typedef priority_queue<ll, vector<ll>, greater<ll>> pqrll;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<vector<int>> vvint;
typedef vector<vector<pll>> vvpll;

//マクロ
//forループ
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(ll i=0;i<ll(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=ll(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=ll(b);i--)
//xにはvectorなどのコンテナ
#define ALL(x) x.begin(),x.end() 
#define SIZE(x) ll(x.size()) 
//定数
#define INF 1000000000000 //10^12:∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange
//略記
#define cin(x) cin >> x

signed main(){
    //入力の高速化用のコード
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    //入力
    ll N = 0;
    cin >> N;


    //本文
    if (N==0)  cout << 1;
    else cout << 0;
    //出力
    //cout << ans << endl;
    //REP(i,N) cout << ans.at(i) <<endl;
  return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h> 
using namespace std;
#define int long long
#define ld long double
#define fi first
#define se second
#define pb push_back
#define pii pair<int,int>
#define all(x) (x).begin(), (x).end()
const int MOD = 1e9+7;
int mpow(int a,int b,int p=MOD){a=a%p;int res=1;while(b>0){if(b&1)res=(res*a)%p;a=(a*a)%p;b=b>>1;}return res%p;}
const int N=1e5+2;

int32_t main(){
      ios_base::sync_with_stdio(false);
      cin.tie(NULL);
      string s;
      cin>>s;
      int n=s.length();
      int ans=0;
      for(int i=0;i<n/2;i++)
      {
        if(s[i]!=s[n-i-1]) ans++;
      }
      cout<<ans;
}
// I never lose. I either win or I learn

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long long n;
long long a,b;
int main()
{
	scanf("%lld",&n);
	for(int i=sqrt(n);i>0;i--)
	{
		if(n%i==0)
		{
			a=i;
			b=n/i;
			break;
		}
	}
	int ans=max(a,b);
	int sum=0;
	while(ans>0)
	{
		sum++;
		ans/=10;
	}
	cout<<sum<<endl;
	return 0;
}

Measured memory_bytes: 256
/*
 * Problem     : AOJ0015
 * Title       : Integral
 * Author      : mizo0203
 * Copyright   : Your copyright free
 * Description : 文字列・多倍長演算
 */

#include <stdio.h>
#include <string.h>
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;

int N, f;
const char* str1;
const char* str2;
string str3, str4;
int sum[80];

void init() {
  scanf("%d", &N);
}

bool input() {

  if (!N)
    return false;
  N--;

  f = 0;
  cin >> str3;
  cin >> str4;
  if (str3.length() > 80 || str4.length() > 80) {
    f = 1;
    return true;
  }
  str1 = str3.c_str();
  str2 = str4.c_str();

  return true;
}

int main() {
  int i;

  init();
  while (input()) {
    if (f) {
      printf("overflow\n");
      continue;
    }
    fill(sum, sum + 80, 0);
    for (i = 0; i < (int) strlen(str1); i++) {
      sum[i] = str1[strlen(str1) - i - 1] - '0';
    }
    f = 0;
    for (i = 0; i < (int) strlen(str2); i++) {
      sum[i] += str2[strlen(str2) - i - 1] - '0' + f;
      f = 0;
      if (sum[i] > 9) {
        sum[i] -= 10;
        f = 1;
      }
    }
    for (; i < 80; i++) {
      sum[i] += f;
      f = 0;
      if (sum[i] > 9) {
        sum[i] -= 10;
        f = 1;
      }
    }
    if (f) {
      printf("overflow\n");
      continue;
    }
    for (i = 0; i < 79; i++) {
      if (sum[79 - i] != 0)
        break;
    }
    for (; i < 80; i++) {
      printf("%d", sum[79 - i]);
    }
    printf("\n");
  }

  return 0;
}

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

int main() {
    int a, b;
    cin >> a >> b;
    if (a > 0) cout << "Positive" << endl;
    else if (a == 0 || 0 == b || (a < 0 && 0 < b)) cout << "Zero" << endl;
    else {
        if ((b - a + 1) % 2 != 0) cout << "Negative" << endl;
        else cout << "Positive" << endl;
    }
}

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

int A[100010];

int main() {
  int N; cin >> N;
  for (int i = 0; i < N; i ++)
    cin >> A[i];
  
  int b1 = 0, b2 = 0, b4 = 0;
  for (int i = 0; i < N; i++) {
    int ai = A[i];
    if (ai % 4 == 0) b4++;
    else if (ai % 2 == 0) b2++;
    else b1++;
  }
  
  string ans = "No";
  if (b2 == 0) {
    if (b1 <= b4 + 1)
      ans = "Yes";
  }
  else {
    if (b1 <= b4)
      ans = "Yes";
  }
  
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <queue>
#include <deque>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;

#define rep(i, up) for (ll i = 0; i < up; ++i)
#define repp(i, up) for (ll i = 0; i <= up; ++i)
#define rrep(i, lo, up) for (ll i = lo; i < up; ++i)
#define rrepp(i, lo, up) for (ll i = lo; i <= up; ++i)

#define rdi(i) ll i; scanf("%lld", &i)
#define rds(s) string s; cin >> s
#define rdc(c) char c; cin >> c

#define INF 10000000000

ll gcd(ll a, ll b)
{
    if (a < b) {
        return gcd(b, a);
    }
    ll r;
    while (r = a % b) {
        a = b;
        b = r;
    }
    return b;
}

int main()
{
    ll k;
    cin >> k;
    vector<vector<ll>> work(k + 1);
    rrepp(i, 1, k) {
        work[i].resize(k + 1);
        rrepp(j, 1, k) {
            work[i][j] = gcd(i, j);
        }
    }
    ll s = 0;
    rrepp(a, 1, k) {
        rrepp(b, 1, k) {
            ll tmp = work[a][b];
            rrepp(c, 1, k) {
                s += work[tmp][c];
            }
        }
    }
    cout << s << endl;
    return 0;
}

Measured memory_bytes: 3492
#include<bits/stdc++.h>
using namespace std;
int main(){
 	string x;
 	char z=' ';
 	cin>>x;
 	for(int i=0;i<x.length();i++){
 		if(x[i]==',')
 		   x[i]=z;
	 }
	 cout<<x;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define REPR(i, n) for (int i = n - 1; i >= 0; i--)
#define INF 1LL << 60;
#define LLINF 1e12
#define PI 3.14159265359
int dy[] = {1, 0, -1, 0};
int dx[] = {0, 1, 0, -1};
int ny, nx;
typedef long long ll;
using namespace std;

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

ll lcm(ll m, ll n)
{
    if ((0 == m) || (0 == n))
        return 0;
    return ((m / gcd(m, n)) * n);
}

ll llpow(ll x, ll y)
{
    ll ans = 1;
    REP(i, y)
    ans *= x;
    return ans;
}

ll llmin(ll x, ll y) { return x < y ? x : y; }
ll llmax(ll x, ll y) { return x > y ? x : y; }

template <typename Container>
bool exist_in(const Container &c, const typename Container::value_type &v)
{
    return (c.end() != std::find(c.begin(), c.end(), v));
}

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 nCr(int n, int r)
{
    if (n == r or n == 0)
        return 1;
    if (n < r)
        return 0;
    if (r == 1)
        return n;
    return nCr(n - 1, r - 1) + nCr(n - 1, r);
}

//std::cout << std::defaultfloat << std::setprecision(10);
////////////////////////////////////////
int main()
{
    ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);

    int X; cin >> X;

    FOR(i, 0, 10100){
        FOR(j,-100, 10100){
            if(i*i*i*i*i - j*j*j*j*j == X){
                cout << i << " " << j << endl;
                return 0;
            } 
        }
    }

    return 0;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define fastIO (cin.tie(0), cout.tie(0), ios::sync_with_stdio(false))
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define precise(i) fixed << setprecision(i)
using lint = long;
using llint = long long;
using namespace std;

int main() {
    fastIO;
    int n;
    cin >> n;
    cout << (n - 2) * 180 << endl;
}

Measured memory_bytes: 3628
import sys
stdin = sys.stdin
sys.setrecursionlimit(10**6)
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nn = lambda: list(stdin.readline().split())
ns = lambda: stdin.readline().rstrip()

n,a,b,c,d = na()

b = abs(b-a)
e = ((d-c)/2)*(n-1)
f = (c+d)/2
a = 0

for i in range(2,n+1):
    if a < b:
        a+=f
    else:
        a-=f

if a-e <= b <= a+e:
    print('YES')
else:
    print('NO')

Measured memory_bytes: 3064
#include<iostream>
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n,m;
  for(;;){
    cin >> n;//マスの目
    cin >> m;//さいころをふる回数
    if((n==0) && (m==0)){
      break;
    }
    int s=1;//今いるマス
    int t[n];//マスの指示
    int u;//出た目
    for(int i=1; i<n+1; i++){
      cin >> t[i];

    }
    for(int i=0; i<m; i++){
      cin>>u;
      s+=u;
      s=s+t[s];
      if(s>=n){
        cout << i+1 <<endl;
        for(int l=i+1; l<m; l++){
          cin>>u;
        }
        break;
      }
    }
  }
  return 0;
}



Measured memory_bytes: 3100
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;

/**
 * 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;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		Task solver = new Task();
		solver.solve(1, in, out);
		out.close();
	}

	static class Task {
		public void solve(int testNumber, InputReader in, PrintWriter out) {
			int X = in.nextInt();
			int A = in.nextInt();
			int B = in.nextInt();
			if(A - B >= 0) {
				out.println("delicious");
			} else if(Math.abs(A - B) <= X) {
				out.println("safe");
			} else {
				out.println("dangerous");
			}
		}
	}
		
	static class InputReader {
		public BufferedReader reader;
		public StringTokenizer tokenizer;

		public InputReader(InputStream stream) {
			reader = new BufferedReader(new InputStreamReader(stream), 32768);
			tokenizer = null;
		}

		public String next() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}

		public int nextInt() {
			return Integer.parseInt(next());
		}
	}
}

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

void fin() {
  cout << -1 << endl;
  exit(0);
}

int main(int argc, char *argv[]) {
  // C-style stdio functions should not be used.
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout << setprecision(20);

  ll N, K; cin >> N >> K;
  ll p = 2 * K - 1;
  if (!(p <= N)) fin();

  auto diff = [&](int i) -> int {
    if (i < p / 2) {
      return -2 * i + (p/2) - 1;
    }else {
      return -2 * (i - p/2) + (p+1)/2 - 1;
    }
  };

  for (int i = 0; i < p; i++) {
    cout << K + N - 1 - i << " "
	 << K + N + i + diff(i) << " "
	 << K + 2*N + p/2 + diff(i) << "\n";
  }
  for (int i = p; i < N; i++) {
    cout << K + N - 1 - i << " "
	 << K + N + i << " "
	 << K + 2*N + i << "\n";
  }

  return 0;
}



Measured memory_bytes: 2304
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <set>
using namespace std;
#define ll long long
#include <cstdint>

int main() {
	int n, a, b;
	cin >> n >> a >> b;
	cout << min(b, n * a) << endl;
	return 0;
}

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

namespace AGC012A
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            long[] a = new long[3*N];
            var target = Console.ReadLine().Split(' ');
            List<long> b = new List<long>();
            for(int i =0; i<3*N;i++){
//                a[i] = long.Parse(target[i]);
                b.Add(long.Parse(target[i]));
            }
//            Array.Sort(a); Array.Reverse(a);
            b.Sort(); b.Reverse();
//            long strength = 0;
            long st1 = 0;
            for(int i=0; i<N;i++){
//                strength += a[2*i+1];
                st1 += b[2*i+1];
            }
//            Console.WriteLine(strength);
            Console.WriteLine(st1);
        }
    }
}


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

int main() {
  int H,W;
  cin >> H  >> W;

  char vec[H+2][W+2];
  for(int i=0; i<(H+2); i++){
    for(int j=0; j<(W+2); j++){
      vec[i][j]='#';
      
    }
  }

  for(int i=1; i<(H+1); i++){
    for(int j=1; j<(W+1); j++){
      cin >> vec[i][j];
      
    }
  }
  
  for(int i=0; i<(H+2); i++){
    for(int j=0; j<(W+2); j++){
      cout << vec[i][j];
      
    }
    cout << endl;
  }

}



Measured memory_bytes: 256
package main

import (
	"fmt"
)

type sugarWater struct {
	sugar, water int
}

var (
	checked          = map[sugarWater]struct{}{}
	a, b, c, d, e, f int
	ans              sugarWater
)

func dfs(sugar, water int) {
	if sugar+water > f || 100*sugar > e*water {
		return
	}
	if _, in := checked[sugarWater{sugar, water}]; in {
		return
	}
	if sugar*ans.water > water*ans.sugar {
		ans = sugarWater{sugar, water}
	}
	checked[sugarWater{sugar, water}] = struct{}{}

	dfs(sugar, water+100*a)
	dfs(sugar, water+100*b)
	dfs(sugar+c, water)
	dfs(sugar+d, water)
}

func main() {
	ans = sugarWater{-1, 0}
	fmt.Scan(&a, &b, &c, &d, &e, &f)

	dfs(0, 100*a)
	dfs(0, 100*b)

	fmt.Println(ans.sugar+ans.water, ans.sugar)
}


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

def function(n):
    a = []
    if n < 2:
        return a
    while n%2 ==0:
        a.append(2)
        n = n//2
    i = 3
    while i*i <= n:
        if n%i ==0:
            a.append(i)
            n = n//i
        else:
            i += 2
    if n > 1:
        a.append(n)
    return a
print(str(n)+":",*function(n))

Measured memory_bytes: 7744
// We only fail when we stop trying
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define endl '\n'
#define D(x) cerr << #x << " = " << (x) << '\n'
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
typedef long long ll;

const int N = 105;
const int V = 1e5 + 5;
const int Mod = 1e9 + 7;

int n, k;
int a[N];
int dp[V];
int acc[V];

int main()
{
  cin >> n >> k;
  for(int i = 0 ; i < n ; i++) {
    cin >> a[i];
  }
  for(int j = 0; j <= k; j++)
    acc[j] = 1;
  for(int i = 0 ; i < n ; i++) {
    for(int j = 0 ; j <= k; j++) {
      dp[j] = acc[j];
      if(j - a[i] - 1 >= 0)
        dp[j] = ((dp[j] - acc[j - a[i] - 1]) % Mod + Mod) % Mod;
    }
    acc[0] = dp[0];
    for(int j = 1 ; j <= k ; j++)
      acc[j] = (acc[j - 1] + dp[j]) % Mod;
  }
  cout << dp[k] << endl;
  return 0;
}


Measured memory_bytes: 1024
(* 配列版素集合データ構造 *)
module UnionFind : sig
  type t

  module Class : sig
    type t
    val compare : t -> t -> int
  end

  (* n要素の素集合データ構造を作る *)
  val make : int -> t
  (* 要素がどの集合に属するか調べる *)
  (* 要素は0からn-1の整数である必要がある *)
  val find : t -> int -> Class.t
  (* 与えられた集合同士を合併する *)
  (* 破壊的操作であるため注意 *)
  val unite : t -> Class.t -> Class.t -> unit
  (* 与えられた集合に属する要素の数を求める *)
  val cardinal : t -> Class.t -> int
end = struct
  type t = int array

  module Class = struct
    type t = int
    let compare = compare
  end

  let make n = Array.make n (-1)

  let rec find uf x =
    if uf.(x) < 0 then x
    else begin
      let y = find uf uf.(x) in
      uf.(x) <- y; y
    end

  let unite uf x y =
    if x <> y then begin
      let x, y = if uf.(x) <= uf.(y) then x, y else y, x in
      uf.(x) <- uf.(x) + uf.(y);
      uf.(y) <- x
    end

  let cardinal uf x = ~- (uf.(x))
end

module WeightedGraph
  (Weight : sig
    type t
    val compare : t -> t -> int
  end) :
sig
  type 'a church_list = { fold : 'b. ('a -> 'b -> 'b) -> 'b -> 'b }

  (*
   * HashtblやMapを用いているとプリム法と大差ない計算時間になってしまうため，
   * より汎用的な実装が欲しければそちらを当たること
   *)
  val kruskal :
    (* 頂点の数n *)
    int ->
    (* 辺のリスト *)
    (* 頂点は0からn-1までの整数でなくてはならない
       ソートにList.sortを使っているせいでデータ構造が固定されており，あまり良くない… *)
    (int * int * Weight.t) church_list ->
    (* 最小全域木に含まれる辺のリスト
       畳み込む関数と初期値まで与えられて初めて計算を開始するので，
       最小全域木に対して色々な操作をしたい場合は，
       一度リストにして覚えておくとよい．
       最小全域木の重さの和だけ欲しいとか一回しか使わない場合は，
       直接畳み込む関数と初期値を与えるとdeforestationになっていい感じ． *)
    (int * int * Weight.t) church_list
end =
struct
  type 'a church_list = { fold : 'b. ('a -> 'b -> 'b) -> 'b -> 'b }

  let kruskal n es =
    { fold = fun f init ->
      let uf = UnionFind.make n in
      let es = Array.of_list @@ es.fold (fun x xs -> x :: xs) [] in
      Array.fast_sort (fun (_, _, w) (_, _, w') -> Weight.compare w w') es;
      Array.fold_left (fun acc (u, v, w) ->
        let c = UnionFind.find uf u in
        let d = UnionFind.find uf v in
        if UnionFind.Class.compare c d = 0
        then acc
        else (UnionFind.unite uf c d; f (u, v, w) acc)) init es }
end
 
module Int = struct
  type t = int
  let compare = compare
end
 
module G = WeightedGraph (Int)
 
let () =
  let n = Scanf.scanf "%d\n" @@ fun n -> n in
  let xys = Array.to_list @@ Array.init n @@ fun i ->
    Scanf.scanf "%d %d\n" @@ fun x y -> x, y, i in
  let xedges =
    List.sort (fun (x, _, _) (x', _, _) -> compare x x') xys
    |> (fun ((x, y, i) :: xys) ->
        List.fold_left (fun (acc, x, y, i) (x', y', j) ->
          ((i, j, x' - x) :: acc, x', y', j)) ([], x, y, i) xys)
    |> (fun (acc, _, _, _) -> acc) in
  let yedges =
    List.sort (fun (_, y, _) (_, y', _) -> compare y y') xys
    |> (fun ((x, y, i) :: xys) ->
        List.fold_left (fun (acc, x, y, i) (x', y', j) ->
          ((i, j, y' - y) :: acc, x', y', j)) ([], x, y, i) xys)
    |> (fun (acc, _, _, _) -> acc) in
  Printf.printf "%d\n" @@
  (G.kruskal n { G.fold = fun f acc -> List.fold_right f xedges @@ List.fold_right f yedges acc }).G.fold (fun (_, _, d) -> ( + ) d) 0


Measured memory_bytes: 33664
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b,c;
  cin >> a >> b >> c;
  if((a==b&&b!=c)||(a==c&&b!=c)||(c==b&&b!=a)){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int t1 = 0, x1 = 0, y1 = 0;
		int t2, x2, y2, t, c;
		
		for(int i=0; i<n; i++) {
			t2 = scan.nextInt();
			x2 = scan.nextInt();
			y2 = scan.nextInt();
			t = t2 -t1;
			c = Math.abs((x2+y2)-(x1+y1));
			if(t >= c) {
				if(t%2 != c%2) {
					System.out.println("No");
					scan.close();
					return;
				}
			} else {
				System.out.println("No");
				scan.close();
				return;
			}
		}
		scan.close();
		System.out.println("Yes");
	}

}

Measured memory_bytes: 85536
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
h,w  = map(int, input().split())
s=[]
for i in range(0,h):
  s.append(input())

b=[]
for i in range(0,w):
  f=False
  for j in range(0,h):
    if s[j][i]=='#':
      f=True
  b.append(f)

for j in range(0,h):
  if s[j].count('#')==0:
    continue
  res=""
  for i in range(0,w):
    if b[i]:
      res=res+s[j][i]
  print(res)




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

int main(){
    int N, R, ans;
    scanf("%d %d", &N, &R);
    if (N >= 10){
        printf("%d\n", R);
    }
    else {
        printf("%d", R + (100*(10 - N)));
    }
    return 0;
}

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

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

int main() 
{  
	ll n, k;
	cin >> n >> k;
	ll a[n+5];
	FOR0(i,n){
		cin >> a[i];
	}
	sort(a, a + n); 
	ll product = 1; 
	if (a[n - 1] == 0 && k%2 == 1){
		cout << 0 << endl;
		return 0; 
	}
	if (a[n - 1] <= 0 && k%2 == 1) { 
		for (ll i = n - 1; i >= n - k; i--) {
			product *= a[i]; 
			product += mod;
			product %= mod;
		}
		cout << (product+mod)%mod << endl;
		return 0; 
	} 
	ll i = 0; 
	ll j = n - 1; 
	if (k%2 == 1) { 
		product *= a[j]; 
		product += mod;
		product %= mod;
		j--; 
		k--; 
	} 
	k >>= 1;
	for (ll itr = 0; itr < k; itr++) { 

		ll left_product = a[i] * a[i + 1];
		// left_product += mod; 
		// left_product %= mod;

		ll right_product = a[j] * a[j - 1];
		// right_product += mod;  
		// right_product %= mod;

		if (left_product > right_product) { 
			left_product += mod; 
			left_product %= mod;
			product *= left_product; 
			product += mod;
			product %= mod;
			i += 2; 
		} 
		else { 
			right_product += mod;  
		    right_product %= mod;
			product *= right_product; 
			product += mod;
			product %= mod;
			j -= 2; 
		} 
	} 
	cout << (product+mod)%mod << endl;

}

Measured memory_bytes: 5196
#include <stdio.h>

int	main(void)
{
  	int	n;
  	long long	h[100000];
  	long long	d[100000];
  	int	i;
  	int cnt0;
  	int cnt1;
  	int flag;
  	int t;
  	
  	scanf("%d", &n);
  	for(i=0; i<n; i++)
    {
      	scanf("%lld", &h[i]);
    }
    
    flag = 0;
    for(i=0; i<n; i++)
    {
        if(h[i] != h[0] && h[i] != h[0] + 1)
            flag = 1;
    }
    if(flag == 0)
    {
        printf("Yes");
        return (0);
    }
    
    flag = 0;
    for(i=0; i<n; i++)
    {
        if(h[i] != h[0] && h[i] != h[0] - 1)
            flag = 1;
    }
    if(flag == 0)
    {
        printf("Yes");
        return (0);
    }
  

    for(i=0; i<n-1; i++)
    {
        if(h[i] > h[i+1])
            break ;
        else
            t = i;
    }
    flag = 0;
    for(i=t+1; i<n; i++)
    {    
        if(h[i] != h[t] && h[i] != h[t] + 1)
            flag = 1;
    }
    if(flag == 0)
    {
        printf("Yes");
        return (0);
    }
    
    flag = 0;
    for(i=t+1; i<n; i++)
    {
        if(h[i] != h[t] && h[i] != h[t] - 1)
            flag = 1;
    }
    if(flag == 0)
    {
        printf("Yes");
        return (0);
    }
  

  	cnt0 = 0;
  	cnt1 = 0;
  	for(i=0; i<n-1; i++)
    {
      	d[i] = h[i] - h[i+1];
    
      	if (d[i] > 0)
          	cnt0++;
        if (d[i] > 1)
            cnt1++;
        if (cnt1 > 0)
        {
            printf("No");
            return (0);
        }
        
      	if (cnt0 > 1)
        {
            printf("No");
          	return (0);
        }
            
        if (d[i] < 0)
        {
            cnt0 = 0;
            cnt1 = 0;
        }
    }

  	if (cnt0 == 1)
    {
      	for(i=0; i<n-1; i++)
        {
          	if(d[i] > 1)
          	{
              	printf("No");
              	return (0);
          	}
        }
        printf("Yes");
        return (0);
    }
  	
  	if (cnt0 < 1)
    {
      	printf("Yes");
      	return (0);
    }
  	return (0);
}


Measured memory_bytes: 1664