akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Linq;
namespace algo
{
    class Program
    {
        static void Main(string[] args)
        {
            string result = "NG";
            int K = int.Parse(Console.ReadLine());
            int [] AB = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();

            for(int i = AB[0]; i <= AB[1]; ++i){
                if(i % K == 0){
                    result = "OK";
                    break;
                }
            }
            Console.WriteLine(result);
        }
    }
}


Measured memory_bytes: 28240
#include<iostream>
#include<string>

int main () {
    int a, b;
    std::cin >> a >> b;

    std::string as = "";
    std::string bs = "";
    for (int i = 0; i < b; i++) {
        as += std::to_string(a);
    }

    for (int i = 0; i < a; i++) {
        bs += std::to_string(b);
    }

    std::string ans = as < bs ? as : bs;
    std::cout << ans << "\n";
}

Measured memory_bytes: 256
class Dice
  attr :top, :front, :right, :left, :back, :bottom
  def initialize a,b,c,d,e,f
    @top = a; @front = b; @right = c; @left = d; @back = e; @bottom = f
  end
  def == other
    other.top == @top && other.front == @front && other.right == @right \
    && other.left == @left && other.back == @back && other.bottom == @bottom
  end
  def rotN
    t = @top; @top = @front; @front = @bottom; @bottom = @back; @back = t; self
  end
  def rotE
    t = @top; @top = @left; @left = @bottom; @bottom = @right; @right = t; self
  end
  def rotW
    t = @top; @top = @right; @right = @bottom; @bottom = @left; @left = t; self
  end
  def rotS
    t = @top; @top = @back; @back = @bottom; @bottom = @front; @front = t; self
  end
  def rotV
    t = @front; @front = @left; @left = @back; @back = @right; @right = t; self
  end
  def show
#    printf("%d %d %d %d %d %d\n",@top,@front,@right,@left,@back,@bottom)
  end
end

a,b,c,d,e,f = gets.split.map {|s| s.to_i}
die1 = Dice.new(a,b,c,d,e,f)
a,b,c,d,e,f = gets.split.map {|s| s.to_i}
die = Dice.new(a,b,c,d,e,f)
ret = false
for i in 1..4
  die.rotV
  die.show
  ret = true if die == die1
end
die.rotE
for i in 1..4
  die.rotV
  die.show
  ret = true if die == die1
end
die.rotE
for i in 1..4
  die.rotV
  die.show
  ret = true if die == die1
end
die.rotE
for i in 1..4
  die.rotV
  die.show
  ret = true if die == die1
end
die.rotE.rotN
for i in 1..4
  die.rotV
  die.show
  ret = true if die == die1
end
die.rotS.rotS
for i in 1..4
  die.rotV
  die.show
  ret = true if die == die1
end
if ret
  puts "Yes"
else
  puts "No"
end

Measured memory_bytes: 6136
N = int(input())
A = []
xy = []

for _ in range(N):
  a = int(input())
  tmp = [list(map(int, input().split())) for _ in range(a)]
  xy += [tmp]

ans = 0
for i in range(2**N):
  d = {i:-1 for i in range(1, N+1)}
  flag = True
  tmp = 0
  #print("---i---", i)
  for j in range(N):
    #print(d, j)
    if (i>>j)&1: # 正直
      tmp += 1
      if d[j+1] == 0:
        flag = False
        break
      d[j+1] = 1
      for x, y in xy[j]:
        if d[x] == -1:
          d[x] = y
        else:
          if d[x] != y:
            flag = False
            break
    else:
      if d[j+1] == 1:
        flag = False
        break
      d[j+1] = 0
    
  if flag:
    ans = max(tmp, ans)

print(ans)


Measured memory_bytes: 45276
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); i++) 
#define all(v) begin(v),end(v)
using ll = long long;

int main() {
  string s;cin>>s;
  int cnt1=1e9,cnt2=0;
  rep(i,s.size()){
    if(s[i]=='A')cnt1=min(cnt1,i+1);
    if(s[i]=='Z')cnt2=max(cnt2,i+1);
  }
  cout<<cnt2-cnt1+1<<endl;
}

Measured memory_bytes: 3704
#include <cstdio>
#include <cstring>
#include <string>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <map>
using namespace std;

#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl

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

#define INF 1000000000

struct team{
  int ac, t, n; // number of accepts, consumed time, team number
  int fails[50];
};

bool sorter(const team &t1, const team &t2){
  if(t1.ac == t2.ac){
    if(t1.t == t2.t){
      return t1.n > t2.n;
    } else {
      return t1.t < t2.t;
    }
  } else {
    return t1.ac > t2.ac;
  }
}

int main(){
  int M,T,P,R;
  while(cin>>M>>T>>P>>R, M|T|P|R){
    vector<team> teams(T);

    // initialize each teams info
    rep(i,T){
      teams[i].ac = teams[i].t = 0;
      teams[i].n = i+1;
      rep(j,P) teams[i].fails[j]=0;
    }

    // read input and set team info
    rep(i,R){
      int m,t,p,j;
      scanf("%d %d %d %d", &m, &t, &p, &j);
      t--; p--;
      if(j==0){ //AC
	teams[t].ac++;
	teams[t].t += m + teams[t].fails[p]*20;
      } else { //WA
	teams[t].fails[p]++;
      }
    }

    sort(all(teams), sorter);

    // output results
    printf("%d", teams[0].n);
    repl(i,1,T){
      if(teams[i-1].ac==teams[i].ac && teams[i-1].t==teams[i].t)
	printf("=");
      else
	printf(",");
      printf("%d", teams[i].n);
    }
    printf("\n");
  }
}

Measured memory_bytes: 1268
#include<iostream>
#include<algorithm>
using namespace std;
static const int MAX = 200000;

int main() {
    int R[MAX], n;

    cin >> n;
    for ( int i = 0; i < n; i++ ) cin >> R[i];
    
    int maxv = R[1] - R[0];
    int minv = R[0];
    
    for ( int i = 1; i < n; i++ ) {
        maxv = max(maxv, R[i] - minv);
        minv = min(minv, R[i]);
    }
    
    cout << maxv << endl;
    
    return 0;
}


Measured memory_bytes: 3876
def main():
    from sys import stdin, setrecursionlimit
    #from sys import stdin, setrecursionlimit
    #setrecursionlimit(10**9)
    n = int(stdin.readline()[:-1])   
    #r = stdin.readline()[:-1]
    #r = [stdin.readline() for i in range(n)]
    #t = [int(stdin.readline()) for i in range(n)]
    #n = int(r)
    #a = r.split()
    #a,b,c = r.split()
    #a = list(map(int, r.split()))
    #h,n = map(int, r.split())
    #r = stdin.readline()[:-1]
    #a = list(map(int, r.split()))
    #a = [int(s[i]) for i in range(1, n+1)]
    #a = [list(map(int, r.split())) for i in range(1,n+1)]
    #a = [list(map(int, r.split())) for i in range(n)]
    #res = 0

    import math
    cnt = 0
    while n > 0:
        n = math.floor(n/2)
        cnt += 1
    print(2**(cnt)-1)

if __name__ == '__main__':
    main()


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

int main() {
  int N;
  cin >> N;
  map<string, int> pr;
  int cnt = 0;
  for (int i=0; i<N; i++) {
    string tmp;
    cin >> tmp;
    if (pr.count(tmp)==false) {
      pr[tmp] = cnt;
      cnt++;
    }
  }
  cout << pr.size();
}


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

# define FOR(i,a,b) for (int i=(a);i<(b);i++)
# define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
# define REP(i, n) for (int i = 0; i < (int)(n); i++)
# define RREP(i,n) for (int i=(n)-1;i>=0;i--)

# define int(x) int x; scanf("%d",&x);
# define vint(v,n) vector<int> v(n); REP(i,n) scanf("%d", &v[i]);
# define string(x) string x; cin >> x;

using namespace std;

namespace utils{
  template <typename T> void print(vector<vector<T>> mat) {
    REP (i, mat.size()) {
      REP (j, mat[0].size()) cout << mat[i][j] << ' ';
      cout << endl;
    }
  }

  template <typename T> void print(vector<T> v) {
    REP (i, v.size())
      if (i >= v.size()-1)
	cout << v[i];
      else
	cout << v[i] << ' ';
    
    cout << endl;
  }

  template <typename T> pair<T, T> shape(vector<vector<T>> mat) {
    int d1, d2;

    d1 = mat.size();
    if (d1 > 0) d2 = mat[0].size();
    else int d2 = 0;
    cout << "(" << d1 << ", " << d2 << ")" << endl;
    return make_pair(0, 0);
  }

  template <typename T> vector<vector<T>> empty(int n, int m) {
    vector<vector<T>> mat(n, vector<T>(m));
    return mat;
  }
}


int main() {
  int(n);
  long long A[n];
  
  REP(i,n){
    int x;
    cin >> x;

    A[i] = x;
  }

  for(int i = (n-1);i >= 0;i-=2)
    cout << A[i] << " ";
  if(n%2 == 0){
    for(int i = 0;i <= n-2;i+=2)
      cout << A[i] << " ";
    cout<< endl;
  }else{
    for(int i = 1;(i < n-2) && (n-2 >= 0);i+=2)
      cout << A[i] << " ";
    if(n-2 >= 0)
      cout << A[n-2] << endl;
    else
      cout << endl;
  }
}


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

int main(){
  string str;
  cin >> str;
  queue<char> que;
  for(int i=0; i<str.length(); i++){
    que.push(str[i]);
  }
  string previousSpell = "";
  previousSpell += que.front();
  que.pop();
  int count = 1;
  while(!que.empty()){
    string checkingSpell = "";
    checkingSpell += que.front();
    que.pop();
    if(que.empty()){
      if(checkingSpell == previousSpell){
        break;
      }else{
        count++;
        break;
      }
    }
    if(checkingSpell == previousSpell){
      checkingSpell += que.front();
      que.pop();
    }
    previousSpell = checkingSpell;
    count++;
  }
  cout << count << endl;
  return 0;
}
    
    

Measured memory_bytes: 644
#include <stdio.h>

int main()
{
  int c1, c5, c10, c50, c100, c500;

  scanf("%d %d %d %d %d %d", &c1, &c5, &c10, &c50, &c100, &c500);

  c1+c5*5+c10*10+c50*50+c100*100+c500*500 >= 1000 ? putchar('1') : putchar('0');

  putchar('\n');

  return 0;
}



Measured memory_bytes: 2092
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 1e5+100;
ll n,m,p,q;
int main(){
    scanf("%lld",&n);
    if(n%2) printf("0\n");
    else{
        m=n>>1;
        while(m){
            m/=5; p+=m;
        }
        m=n;
        while(m){
            m/=2; q+=m;
        }
        printf("%lld\n",min(p,q));
    }
}

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

# C - Sum of product of pairs
N = int(input())
A = list(map(int, input().split()))

sum_ = sum(A)
ans = 0

for i in range(N):
  sum_ -= A[i]
  ans += A[i] * sum_
  ans %= (10 ** 9 + 7)

print(ans)

Measured memory_bytes: 31292
#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
#define ll long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
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 K, S;
	cin >> K >> S;
	int ans = 0;
	for (int X = 0; X <= K; X++) {
		for (int Y = 0; Y <= K; Y++) {
			int Z = S - X - Y;
			if (Z >= 0 && Z <= K)ans++;
		}
	}
	cout << ans;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

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

    for (int i = 0; i < n; ++i) {
        int a, b, c;
        cin >> a >> b >> c;

        a *= a;
        b *= b;
        c *= c;

        if (a == b + c || b == a + c || c == a + b) {
            cout << "YES" << endl;
        } else {
            cout << "NO" << endl;
        }
    }

    return 0;
}

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

using namespace std;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define itn int

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


int main()
{
  int n, m;
  cin >> n >> m;
  ll sec = 1900 * m + 100 * (n - m);
  ll num = pow(2, m);
  cout << sec * num << endl;

}


Measured memory_bytes: 256
MOD = 998244353
A, B, C, D = map(int, input().split())
dp = [[0 for _ in range(D+1)] for _ in range(C+1)]
dp[A][B] = 1
for i in range(A, C+1):
	for j in range(B, D+1):
		if i > A:
			dp[i][j] += j * dp[i-1][j]
		if j > B:
			dp[i][j] += i * dp[i][j-1]
		if i>A and j>B:
			dp[i][j] -= (i-1) * (j-1) * dp[i-1][j-1]
		dp[i][j] %= MOD
print(dp[C][D])

Measured memory_bytes: 146812
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) FOR(i,0,n)
#define ROF(i,a,b) for(ll i=a;i>=b;i--)
#define per(i,a) ROF(i,a,0)
#define pb push_back
using namespace std;
using ll=long long;
using ld=long double;
using ch=char;
typedef pair<ll,ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<P> vP;
typedef vector<ch> vc;
typedef vector<vc> vvc;
const ll MOD=1000000007;
const ll MOD2=998244353;
const ld PI=acos(-1);
const ll INF=1e18;
struct edge{ll to,cost;};
struct edge2{ll from,to,cost;};

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

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

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    string n;
    cin >> n;
    ll cnt=0;
    rep(i,4){
        if(n[i]=='2'){
            cnt++;
        }
    }
    cout << cnt << endl;
}

Measured memory_bytes: 3612
using System;
					
public class Program
{
	public static void Main()
	{
		string s;

		while( null != ( s = Console.ReadLine()) ) {
			var d = int.Parse(s);
			
			var sum = 0;
			for(int i = 0; i < 600; i += d) {
				sum += d*i*i;
			}
			Console.WriteLine(sum);
		}
	}
}

Measured memory_bytes: 9128
#include "bits/stdc++.h"
#pragma GCC optimize "03"
using namespace std;
 
#define int long long int
#define ld long double
#define pi pair<int, int>
#define pb push_back
#define fi first
#define se second
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#ifndef LOCAL
#define endl '\n'
#endif
 
const int N = 2e5 + 5;
const int mod = 1e9 + 7;
const int inf = 1e9 + 9;

signed main() {
	IOS;
	int n;	cin >> n;
	set<string> t;
	for(int i = 1; i <= n; i++){
		string s;	cin >> s;
		t.insert(s);
	}	
	cout << t.size();
	return 0;
}


Measured memory_bytes: 19212
m, d = [int(i) for i in input().split()]

def digit(i):
    if i > 0:
        return digit(i//10) + [i%10]
    else:
        return []
month_list = range(0, m+1, 1)
days_list = range(0, d+1, 1)
seki_list =[]
for m in month_list:
    for d in days_list:
        if d >=20 :
            day_list = digit(d)
            if int(day_list[0]) >= 2 and int(day_list[1]) >= 2:
                if (int(day_list[0])* int(day_list[1])) == m:
                    seki_list.append("hoge")

print(len(seki_list))

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

int main()
{
	string word, sentence;
	cin >> word;
	int count = 0;
	string word2 = "";

	for (int i = 0; i < word.length(); i++)
	{
		char c = word[i];

		if (c >= 'A' && c <= 'Z')
		{
			char c2 = word[i] + 32;
			word2 += c2;
		}
		else word2 += c;
	}

	while (true)
	{
		if (sentence == "END_OF_TEXT") break;

		cin >> sentence;
		string senten2 = "";

		for (int i = 0; i < sentence.length(); i++)
		{
			char c = sentence[i];

			if (c >= 'A' && c <= 'Z')
			{
				char c2 = sentence[i] + 32;
				senten2 += c2;
			}
			else senten2 += c;
		}

		if (senten2 == word2)
			count++;
	}
	cout << count << endl;
}


Measured memory_bytes: 3180
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author yosiiii
 */


#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(long long int i=0;i<(n);++i)
typedef long long int ll;

class ACoffee {
public:
	void solve(std::istream& in, std::ostream& out) {
        string s;
        in >> s;

        if(s[2]==s[3]&&s[4]==s[5]){
            out << "Yes" << endl;
        }else{
            out << "No" << endl;
        }
	}
};


int main() {
	ACoffee solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    long x = Long.parseLong(sc.next());
    long k = Long.parseLong(sc.next());
    long d = Long.parseLong(sc.next());
    
    long ans = x;
    long divAns = x/d;

    if(k < Math.abs(divAns)){
      if(x > 0){
        ans = x - d * k;
      }else{
        ans = x + d * k;
      }
      
      System.out.println(Math.abs(ans));
      sc.close();
      return;
    }

    k = k - Math.abs(divAns);
    ans = x - d * divAns;

    if(k % 2 != 0){
      if(ans > 0){
        ans = ans - d;
      }else{
        ans = ans + d;
      }
    }

    System.out.println(Math.abs(ans));
   
    sc.close();
    return;
  }
  
}


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

using namespace std;
using ll = long long;
using ull = unsigned long long;
template <class T> using V = vector<T>;
template <class T> using VV = V<V<T>>;
constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n - 1); }

#define int ll

#define FOR(i,a,b) for(int i=int(a);i<int(b);i++)
#define REP(i,b) FOR(i,0,b)

ll read(){
	ll x;
	scanf("%lld",&x);
	return x;
}

void print(ll x){
	printf("%lld\n",x);
}

using vi=vector<int>;
#define PB push_back
#define ALL(x) x.begin(),x.end()

template<class T>
void chmin(T&a,T b){
	if(a>b)a=b;
}

const int Nmax=160;
const int Vmax=334;
double dp[Nmax][Vmax];

signed main() {
	int n=read();
	vi h(n);
	REP(i,n)
		h[i]=read();
	REP(i,Vmax){
		dp[0][i]=TEN(9);
	}
	const auto Area=[&](int a,int b){
		if(a*b>=0){
			a=abs(a);b=abs(b);
			return double(a+b)/2;
		}else{
			a=abs(a);b=abs(b);
			return double(a*a+b*b)/(a+b)/2;
		}
	};
	dp[0][1]=0;
	REP(i,n){
		FOR(j,1,Vmax){
			dp[i+1][j]=TEN(9);
			FOR(k,1,Vmax)
				chmin(dp[i+1][j],dp[i][k]+Area(k-h[i],j-h[i]));
		}
	}
	double ans=*min_element(dp[n]+1,dp[n]+Vmax);
	cout<<fixed<<setprecision(20)<<ans<<endl;
    return 0;
}



Measured memory_bytes: 3660
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>

void call(int n) {
	for (int i = 1; i <= n; i++) {
		int x = i;
		if (x % 3 == 0) printf(" %d", i);
		else {
			while (x) {
				if (x % 10 == 3) {
					printf(" %d",i);
					break;
				}
				x /= 10;
			}
		}
	}
	printf("\n");
}

int main() {
	int n;
	scanf("%d", &n);
	call(n);

	return 0;
}

Measured memory_bytes: 1852
fun main(args: Array<String>) = yorukatsu11b()

fun yorukatsu11b() {
    var (a, b, c) = readLine()!!.split(' ').map { it.toInt() }
        .sorted()

    var answer = 0
    
    val diffBC = c - b
    if (diffBC > 0) {
        b += diffBC
        a += diffBC
        answer += diffBC
    }
    val diffAB = b - a
    if (diffAB > 0) {
        answer += (b - a) / 2 + if ((b - a) % 2 == 0) 0 else 2
    }


    println(answer)
}


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

int main() {
 int N;
 cin>>N;
  long long int sum=0;
  
 for(int i=1;i<=N;i++){
   if(i%3!=0&&i%5!=0){
     sum+=i;
   }
 }
  cout<<sum<<endl;
}
  



Measured memory_bytes: 3672
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int[] x = new int[m];
        for(int i=0; i<m; i++){
            x[i] = sc.nextInt();
        }

        if(n >= m){
            System.out.println(0);
            return;
        }

        Arrays.sort(x);

        int[] len = new int[m-1];
        for(int i=0; i<m-1; i++){
            len[i] = x[i+1] - x[i];
        }

        Arrays.sort(len);

        long ans = 0;
        for(int i=0; i<m-n; i++){
            ans += len[i];
        }

        System.out.println(ans);

    }
}

Measured memory_bytes: 49852
#include<stdio.h>
#include<iostream>
#include<vector>
#include<cmath>
using namespace std;
int main(){
    int N = 0;
    cin>>N;
    vector<int> P(N);
    for (int i = 0;i<N;i++){
        cin>> P[i];
    }
    int ans=0;
    int min=pow(10,5)*2;
    for(int i = 0;i<N;i++){
        if(min>=P[i]){
            ans+=1;
            min = P[i];
        }
    }
    cout<<ans<<endl;
}


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

int main(){
  ll L,R;
  cin>>L>>R;
  ll pl = L/LIMIT;
  ll ql = L%LIMIT;
  ll pr = R/LIMIT;
  ll qr = R%LIMIT;

  if(pr > pl+1) pr = pl+1;
  pr -= pl;
  pl = 0;

  L = pl*LIMIT+ql;
  R = pr*LIMIT+qr;

  ll ans = LIMIT;
  for(ll i=L; i<R; i++){
    for(ll j=i+1; j<=R; j++){
      ans = min(ans, (i*j%LIMIT));
    }
  }

  cout<<ans<<endl;
}

Measured memory_bytes: 256
// ABC170.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。
//

#include <iostream>
using namespace std;

// A ///////////////////

//int main()
//{
//	int x[5] = { 0 };
//
//	for (int i = 1; i <= 5; i++) {
//		cin >> x[i - 1];
//	}
//
//	for (int i = 1; i <= 5; i++) {
//		if (x[i-1] == 0)
//			cout << i;
//	}
//
//	return 0;
//}


// B //////////////////

int main()
{
	//変数の宣言
	int X, Y; //X匹でY本
	int cranes, turtles, legs;
	//int judgeOK = 0;

	//入力値の格納
	cin >> X;
	cin >> Y;

	//鶴の数を0羽→X匹まで変化させ、合計足本数がYになる場合が存在するか判定する
	for (cranes = 0; cranes <= X; cranes++) {
		turtles = X - cranes;
		legs = (cranes * 2) + (turtles * 4);
		if (legs == Y) {
			cout << "Yes";
			return 0;
		}
	}

	cout << "No";
	return 0;
}



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

l = [0,0,0,0]

for i in range(N):

    t = input()

    if t == "AC":
        l[0] += 1
    elif t == "WA":
        l[1] += 1
    elif t == "TLE":
        l[2] += 1
    else:
        l[3] += 1

print ("AC x",l[0])
print ("WA x",l[1])
print ("TLE x",l[2])
print ("RE x",l[3])


Measured memory_bytes: 9140
#include <iostream>
#include <string>
using namespace std;
 
int main(void) {

  string str;
   
  while(getline(cin, str)) {
    while(1) {
      for(int i=0; i<str.length(); i++) {
          if(str[i] != ' ' && str[i] != '.') {
              if(str[i] != 'z'){
                        str[i] += 1;
                    }else{
                        str[i] = 'a';
                    }
          }
      }
      

          if(str.find("the")!=string::npos||str.find("this")!=string::npos||str.find("that")!=string::npos) {
          cout << str << endl;
          break;
      
    }
    }
  }
  return 0;
}

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

int main()
{
	int a[5], k;
	for(auto&& i : a)
	{
		cin >> i;
	}
	cin >> k;
	cout << (a[4] - a[0] <= k ? "Yay!" : ":(") << "\n";
}


Measured memory_bytes: 256
//codeforces 1337C
#include<bits/stdc++.h>
using namespace std;
#define int long long 
#define ps(x,y) fixed<<setprecision(y)<<x
#define all(x) x.begin(),x.end()
#define endl "\n"
#define io ios_base::sync_with_stdio(false); cin.tie(0)
int const mod = 1000000000+7;
int32_t main() {
    io;
#ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
#endif
  int n,a;
  cin >> n;
  vector<int> adj[n+1];
  for(int i = 2; i <= n; i++){
    cin >> a;
    adj[a].push_back(i);
  }
  for(int i = 1; i <= n; i++){
    cout << adj[i].size() << endl;
  }
  return 0;
}

Measured memory_bytes: 14540
n,m  = map(int,input().split())
lr =[list(map(int,input().split()))for _ in range(m)]
l = []
r = []
for i in range(m):
    l.append(lr[i][0])
    r.append(lr[i][1])
L = max(l)
R = min(r)
if L <= R:print(R-L+1)
else:print(0)
    




Measured memory_bytes: 29092
#include <iostream>
#include <vector>
#include <unordered_map>
#include <map>
#include <algorithm>
#include <set>
#include <unordered_set>
#include <deque>
#include <cmath>
#include <stack>
#include <queue>
#include <string>
#include <iomanip>
#include <cstring>
#include <climits>
#include <cstdio> 

#define nl '\n'

using namespace std;

long long x, h;

int main(){

    cin >> x;

    h += floor(x/500)*1000;
    x -= floor(x/500)*500;
    h += floor(x/5)*5;
    cout << h;




}
 
//g++ -std=c++14 comp.cpp -o c && c.exe
//g++ -std=c++14 comp.cpp -o c; ./c.exe
//g++ -std=c++14 comp.cpp && ./a.out


//Surely this is going to AC

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	string a,b;
	cin>>a;
	b=a;
	reverse(a.begin(),a.end());
	
	for(int i=0;i<a.size();++i)
	{
		if(a[i]=='b')
			a[i]='d';
		else if(a[i]=='d')
			a[i]='b';
		else if(a[i]=='p')
			a[i]='q';
		else if(a[i]=='q')
			a[i]='p';
	}
	if(a==b)
		printf("Yes");
	else
		printf("No");
	return 0;
}

Measured memory_bytes: 512
import java.util.*;

public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		int AliceFlag = 0;
		if(A == B) {
			
		} else if(A == 1) {
			AliceFlag = 1;
		} else if(B == 1) {
			AliceFlag = -1;
		} else if(A > B) {
			AliceFlag = 1;
		} else {
			AliceFlag = -1;
		}
		switch(AliceFlag) {
		case -1:
			System.out.println("Bob");
			break;
		case 0:
			System.out.println("Draw");
			break;
		case 1:
			System.out.println("Alice");
			break;
		}
	}
}


Measured memory_bytes: 21076
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define dbg(...) do{cerr<<__LINE__<<": ";dbgprint(#__VA_ARGS__, __VA_ARGS__);}while(0);

using namespace std;

namespace std{template<class S,class T>struct hash<pair<S,T>>{size_t operator()(const pair<S,T>&p)const{return ((size_t)1e9+7)*hash<S>()(p.first)+hash<T>()(p.second);}};template<class T>struct hash<vector<T>>{size_t operator()(const vector<T> &v)const{size_t h=0;for(auto i : v)h=h*((size_t)1e9+7)+hash<T>()(i)+1;return h;}};}
template<class T>ostream& operator<<(ostream &os, const vector<T> &v){os<<"[ ";rep(i,v.size())os<<v[i]<<(i==v.size()-1?" ]":", ");return os;}template<class T>ostream& operator<<(ostream &os,const set<T> &v){os<<"{ "; for(const auto &i:v)os<<i<<", ";return os<<"}";}
template<class T,class U>ostream& operator<<(ostream &os,const map<T,U> &v){os<<"{";for(const auto &i:v)os<<" "<<i.first<<": "<<i.second<<",";return os<<"}";}template<class T,class U>ostream& operator<<(ostream &os,const pair<T,U> &p){return os<<"("<<p.first<<", "<<p.second<<")";}
void dbgprint(const string &fmt){cerr<<endl;}template<class H,class... T>void dbgprint(const string &fmt,const H &h,const T&... r){cerr<<fmt.substr(0,fmt.find(","))<<"= "<<h<<" ";dbgprint(fmt.substr(fmt.find(",")+1),r...);}
typedef long long ll;typedef vector<int> vi;typedef pair<int,int> pi;const int inf = (int)1e9;const double INF = 1e12, EPS = 1e-9;

int main(){
	cin.tie(0); cin.sync_with_stdio(0);
	
	ll a, b, k; cin >> a >> b >> k;
	ll t = min(a, k);
	a -= t; k -= t;
	b -= min(b, k);
	cout << a << " " << b << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
int main()
{
	float a, b;
	string r;
	while (1)
	{
		cin >> a;
		if (cin.eof()) break;
		cin >> b;
		if (a < 35.5 && b < 71.0)
			r = "AAA";
		else if (a < 37.5 && b < 77.0)
			r = "AA";
		else if (a < 40.0 && b < 83.0)
			r = "A";
		else if (a < 43.0 && b < 89.0)
			r = "B";
		else if (a < 50.0 && b < 105.0)
			r = "C";
		else if (a < 55.0 && b < 116.0)
			r = "D";
		else if (a < 70.0 && b < 148.0)
			r = "E";
		else
			r = "NA";
		cout << r << endl;
	}
}

Measured memory_bytes: 0
#include <iostream>
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <cmath>
#define rep(i,cc,n) for(int i=cc;i<=n;++i)
#define drep(i,cc,n) for(int i=cc;i>=n;--i)
typedef long long ll;
using namespace std;

int main(){
    int n;
    string w[110];
    cin>>n;
    bool ans=true;
    rep(i,0,n-1){
        cin>>w[i];
    }
    rep(i,0,n-2){
        if(w[i][w[i].size()-1]!=w[i+1][0]){
            ans = false;
            break;
        }
    }
    rep(i,0,n-1){
        rep(j,0,i-1){
            if(w[i]==w[j]){
                ans = false;
                break;
            }
        }
    }
    if(ans==true) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}

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


void solve(long long A, long long B, long long C, long long K){
  long long ans;
  if (K <= A) ans = 1 * K;
  else if (K <= (A + B)) ans = 1 * A;
  else ans = 1 * A - 1 * (K - A - B);

  cout << ans << endl;
}

// 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)
int main(){
    long long A;
    scanf("%lld",&A);
    long long B;
    scanf("%lld",&B);
    long long C;
    scanf("%lld",&C);
    long long K;
    scanf("%lld",&K);
    solve(A, B, C, K);
    return 0;
}


Measured memory_bytes: 3764
#include<iostream>
#include<cmath>
 
using namespace std;
long long MOD=1000000007;
long long MOD2=998244353;
 
int A[88][88];
int dp[88][88][13131];
 
int main(){
  int H,W; cin>>H>>W;
  for(int i=0;i<H;i++) for(int j=0;j<W;j++) cin>>A[i][j];
  for(int i=0;i<H;i++) for(int j=0;j<W;j++){
    int B; cin>>B;
    A[i][j]=abs(A[i][j]-B);
  }
  dp[0][0][A[0][0]]=1;
  for(int i=0;i<H;i++)
    for(int j=0;j<W;j++)
      for(int k=0;k<13131;k++){
        if(dp[i][j][k]==0) continue;
        if(i+1<H){
          dp[i+1][j][k+A[i+1][j]]=1;
          dp[i+1][j][(int)abs(k-A[i+1][j])]=1;
        }
        if(j+1<W){
          dp[i][j+1][k+A[i][j+1]]=1;
          dp[i][j+1][(int)abs(k-A[i][j+1])]=1;
        }
      }
  
  for(int i=0;i<131313;i++){
    if(dp[H-1][W-1][i]){
      cout<<i<<endl;
      break;
    }
  }
  return 0;
}

Measured memory_bytes: 361088
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
typedef vector<double> VD;
typedef vector<VD> VVD;

template<typename T> void chmin(T &a, T b) { if (a > b) a = b; }
template<typename T> void chmax(T &a, T b) { if (a < b) a = b; }

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }

const ll mod = 1000000007;
const int N = 200010;
ll fact[N], invf[N];

ll add(ll x, ll y){
    return (x+y)%mod;
}

ll mul(ll x, ll y){
    return (x%mod)*(y%mod)%mod;
}

ll powll(ll x, ll y){
    x %= mod;
    ll res = 1LL;
    while(y){
        if (y & 1LL)
            res *= x;
        res %= mod;
        x = (x*x) % mod;
        y >>= 1LL;
    }
    return res;
}

ll divll(ll x, ll y){
    x %= mod;
    return (x * powll(y,mod-2)) % mod;
}

ll nPr(ll n, ll r){
    if (n < r || r < 0) return 0;
    return mul(fact[n], invf[n-r]);
}

ll nCr(ll n, ll r){
    if (n < r || r < 0) return 0;
    return mul(mul(fact[n], invf[r]), invf[n-r]);
}

int main() {
    ll n, a, b, c;
    cin >> n >> a >> b >> c;

    fact[0] = invf[0] = 1;
    FOR(i,1,N-1){
        fact[i] = (fact[i-1] * i) % mod;
        invf[i] = divll(invf[i-1], i);
    }

    ll x = divll(a, a + b);
    ll y = divll(b, a + b);
    ll ans = 0;
    REP(i,n){
        ll p = (nCr(n - 1 + i, i) * powll(x, n)) % mod;
        p = (p * powll(y, i)) % mod;
        ans = (ans + (n + i) * p) % mod;
    }
    REP(i,n){
        ll p = (nCr(n - 1 + i, i) * powll(y, n)) % mod;
        p = (p * powll(x, i)) % mod;
        ans = (ans + (n + i) * p) % mod;
    }
    ans = divll(100 * ans, a + b);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3328
//template---{{{
//Header file---{{{
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>
//}}}
using namespace std;

//DEFINE---{{{
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (b); i > (a); i++)
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = (n) - 1; i >= 0; i--)
//end.DEFINE---}}}

//end.template ---}}}

int main() {
  int A, B;

  cin >> A >> B;
  int C = A * B;

  if (C % 2 == 0) cout << "No" << endl;
  else cout << "Yes" << endl;

  return (0);
}


Measured memory_bytes: 384
<?php
[$N, $c['A'], $c['B'], $c['C']] = array_map('intval',explode(' ',trim(fgets(STDIN))));;
for($i = 0; $i < $N; $i++){
    $S[] = trim(fgets(STDIN));
}
$path = [];
dfs(0, $path, $c);
echo "No\n";
function dfs($d, &$path, $c){
    global $S, $N;
    if($d == $N){
        echo "Yes\n";
        echo implode("\n", $path);
        exit;
    }
    $s = $S[$d];
    for($i = 0; $i < 2; $i++){
        if($c[$s[$i]]>0){
            $path[] = $s[1-$i];
            $c[$s[$i]]--;
            $c[$s[1-$i]]++;
            dfs($d+1, $path, $c);
            $c[$s[$i]]++;
            $c[$s[1-$i]]--;
            array_pop($path);
        }
    }
}



Measured memory_bytes: 129420
H,W = map(int,input().split())
A = [input() for _ in range(H)]
#print(A)
A = list(filter(lambda a: any(x=='#' for x in a), A)) 
#print(A)
#print(list(zip(*A)))
A = list(filter(lambda a: any(x=='#' for x in a), zip(*A)))
#print(A)
#print(list(zip(*A)))

for a in zip(*A):
    print("".join(a))



Measured memory_bytes: 9264
#include<bits/stdc++.h>
using namespace std;
string s;
int n,m,ans[100003];
deque<int>q;
void path(int x){
	if(x==0)return;
	path(ans[x]);
	cout<<x-ans[x]<<' ';
}
int main(){
	cin>>n>>m>>s;
	q.push_back(0);
	ans[0]=-1;
	for(int j=1;j<=n;j++)
	{
		while(!q.empty()&&j-q[0]>m)q.pop_front();
		if(s[j]=='0')
			if(q.empty())
				ans[j]=-1;
			else
				q.push_back(j),
				ans[j]=q[0];
	}
	if(ans[n]==-1){
		cout<<-1;
		return 0;
	}
	path(n);
}

Measured memory_bytes: 5760
#include <cstdio>
#include <cstdlib>
#define rep(i,l,r)for(int i=(l);i<(r);i++)
#define bit(n,m)(((n)>>(m))&1)

int h,w,a[20];
char S[20][20];

void g(int s,int m){
	if(!s){
		puts("YES");
		exit(0);
	}
	int i=__builtin_ctz(s);
	if(m){
		int b=1;
		rep(k,0,h)b&=S[k][i]==S[a[k]][i];
		if(b)g(s^(1<<i),0);
	}
	rep(j,i+1,w)if(bit(s,j)){
		int b=1;
		rep(k,0,h)b&=S[k][i]==S[a[k]][j];
		if(b)g(s^(1<<i)^(1<<j),m);
	}
}

void f(int s,int m){
	if(!s)g((1<<w)-1,w%2);
	int i=__builtin_ctz(s);
	if(m){
		a[i]=i;
		f(s^(1<<i),0);
	}
	rep(j,i+1,h)if(bit(s,j)){
		a[i]=j;
		a[j]=i;
		f(s^(1<<i)^(1<<j),m);
	}
}

int main(){
	scanf("%d%d",&h,&w);
	rep(i,0,h)scanf(" %s",S[i]);
	f((1<<h)-1,h%2);
	puts("NO");
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

Measured memory_bytes: 128
#include <stdio.h>
#include <string.h>
#include <limits.h>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>

#ifndef U_L_LONG
typedef unsigned long long ULLONG;
#endif
#ifndef L_LONG
typedef long long LLONG;
#endif


static void ABC106C_ToInfinity();

#if 1
int main()
{
	ABC106C_ToInfinity();

	fflush(stdout);
	return 0;
}
#endif

static void ABC106C_ToInfinity()
{
	char szS[101] = { 0 };
	ULLONG K;

	scanf(" %s %llu", szS, &K);

	int i = 0;
	while (szS[i] == '1') {
		i++;
	}

	char ans = 0;
	if (K <= i) {
		ans = '1';
	}
	else {
		ans = szS[i];
	}

	printf("%c\n", ans);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define F first
#define S second
#define pb push_back
#define Rep(i, N) for(int i = 0; i < N; i++)
#define INF 1 << 28
#define LLINF 1LL << 60
typedef pair<int,int> Pi;
typedef pair<int,Pi> Ti;

struct Edge {
  int to, cost;
};

int sz[2], K;
vector<Edge> G[2][200005];
int mc[2][200005];

void Dijkstra()
{
  priority_queue<Ti, vector<Ti>, greater<Ti> >pq;
  mc[0][0] = 0;
  pq.push(Ti(0, Pi(0, 0)));
  while(!pq.empty()) {
    int v = pq.top().S.F, w = pq.top().F, t = pq.top().S.S; pq.pop();
    if(w > mc[t][v]) continue;
    Rep(i, G[t][v].size()) {
      int u = G[t][v][i].to, nw = G[t][v][i].cost + w, nnw = nw;
      if(u != K + 1) nnw++;
      if(nnw < mc[1 - t][u]) {
	mc[1 - t][u] = nnw;
	pq.push(Ti(nnw, Pi(u, 1 - t)));
      }
      if(nw < mc[t][u]) {
	mc[t][u] = nw;
	pq.push(Ti(nw, Pi(u, t)));
      }
    }
  }
}
	  
signed main()
{
  int X, Y;
  vector<Pi> len[2][100006];

  cin >> sz[0] >> sz[1] >> K;
  len[0][1].pb(Pi(0, 0));
  for(int i = 1; i <= K; i++) {
    cin >> X >> Y;
    len[0][X].pb(Pi(Y, i));
    len[1][Y].pb(Pi(X, i));
  }
  len[0][sz[0]].pb(Pi(sz[1], K + 1));
  len[1][sz[1]].pb(Pi(sz[0], K + 1));
  
  Rep(i, 2) {
    Rep(j, sz[i] + 1) {
      sort(len[i][j].begin(), len[i][j].end());
      Rep(k,len[i][j].size()) {
	Pi v = len[i][j][k];
	if(k - 1 >= 0) {
	  Pi u = len[i][j][k - 1];
	  G[i][v.S].pb((Edge){ u.S, v.F - u.F });
	}
	if(k + 1 < len[i][j].size()) {
	  Pi u = len[i][j][k + 1];
	  G[i][v.S].pb((Edge){ u.S, u.F - v.F });
	}
      }
    }
  }

  fill_n(*mc, 2 * 200005, LLINF);
  Dijkstra();
  
  int ans = min(mc[0][K + 1], mc[1][K + 1]);
  if(ans == LLINF) cout << -1 << endl;
  else cout << ans - 1 << endl;
  
  return 0;
}

Measured memory_bytes: 49344
#include <iostream>
#include <string>
using namespace std;
string str;
int p;

int exp();
int factor();
int term();

int factor() {
  int num=0;
  while('0' <= str[p] && str[p] <= '9') {
    num*=10;
    num += str[p] - '0';
    p++;
  }

  if (str[p] == '('){
    p++;
    num = exp();
    p++;
  }
  return num;
}

int term(){
 int val = factor();
  while(str[p] == '*' || str[p] == '/') {
    if(str[p] == '*') {
      p++;
      val *= factor();
    } else if(str[p] == '/'){
      p++;
      val /= factor();
    }
  }

  return val;
}
 
int exp() {
  int val = term();
  while(str[p] == '+' || str[p] == '-') {
    if(str[p] == '+') {
      p++;
      val += term();
    } else if(str[p] == '-'){
      p++;
      val -= term();
    }
  }

  return val;
}

int main() {
  int n;

  cin >> n;
  
  for(int i=0;i<n;i++) {
    p = 0;
  cin >> str;
  cout << exp() << endl;
  }
  return 0;
}

Measured memory_bytes: 1200
import sys

def gcd(a, b):
    """Euclidean Algorithm"""
    while b != 0:
        a, b = b, a % b
    return a

def lcm(a, b):
    return (a * b) // gcd(a, b)


def main():
    input = sys.stdin.readline
    N = int(input())
    T = [int(input()) for _ in range(N)]
    T = sorted(T)

    t = T[0]
    for i in range(N):
        if T[i] % t == 0:
            t = T[i]
        else:
            t = lcm(t, T[i])

    return t


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


Measured memory_bytes: 3064
#include <stdio.h>
#define MAX 101
int M[MAX][MAX];
int ID[MAX];
int F[MAX];
int D[MAX];
int flag[MAX];
int n;
int d=0;
void discover(int);
int main(){
  int i,j,u,k,v;

  scanf("%d",&n);
  for(i=0;i<n+1;i++){
    flag[i]=0;
    for(j=0;j<n+1;j++){
      M[i][j] = 0;
    }
  }
   for(i=1;i<n+1;i++){
    scanf("%d",&u);
    ID[i] = u;
    scanf("%d",&k);
    for(j=0;j<k;j++){
      scanf("%d",&v);
      M[i][v] = 1;
    }
  }
   for(i=1;i<n+1;i++){
     if(flag[i] == 0) discover(i);
   }
   for(i=1;i<n+1;i++){
      printf("%d %d %d\n",ID[i],D[i],F[i]);
    }

}

void discover(int v){
 
  int i,j;
  D[v] = ++d;
  flag[v] = 1;
    for(i=1;i<n+1;i++){
      if(M[v][i]==0) continue;
      if(flag[i] == 0) {
	discover(i);
      }   
    }
    flag[v] = 2;
  F[v] = ++d;
}



Measured memory_bytes: 2048
//Break Number

#include<bits/stdc++.h>
using namespace std;
#define rep(i,x,y) for(int i=x;i<y;i++)
using ll = long long;
#define range(a) (a).begin(),(a).end()


int main (){
    int N,Ans;cin >> N;
    rep(i,1,7)if(pow(2,i)<=N)Ans=i;
    cout << (N == 1? 1 : pow(2,Ans)) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)n; i++)

int		main(void)
{
	int x, y;
	cin >> x >> y;
	while (x || y) {
		if (x <= y)
			cout << x << " " << y << endl;
		else
			cout << y << " " << x << endl;
		cin >> x >> y;
	}
	return (0);
}



Measured memory_bytes: 3024
require 'prime'
require 'set'
require 'tsort'
include Math
ALP = ('a'..'z').to_a
INF = 0xffffffffffffffff
def max(a,b);              a > b ? a : b                              end
def min(a,b);              a < b ?  a : b                             end
def swap(a,b);             a, b = b, a                                end
def gif;                   gets.to_i                                  end
def gff;                   gets.to_f                                  end
def gsf;                   gets.chomp                                 end
def gi;                    gets.split.map(&:to_i)                     end
def gf;                    gets.split.map(&:to_f)                     end
def gs;                    gets.chomp.split.map(&:to_s)               end
def gc;                    gets.chomp.split('')                       end
def pr(num);               num.prime_division                         end
def pr?(num);              Prime.prime?(num)                          end
def digit(num);            num.to_s.length                            end
def array(s,ini=nil);      Array.new(s){ini}                          end
def darray(s1,s2,ini=nil); Array.new(s1){Array.new(s2){ini}}          end
def rep(num);              num.times{|i|yield(i)}                     end
def repl(st,en,n=1);       st.step(en,n){|i|yield(i)}                 end

n = gif
puts gs.uniq.size == 4 ? 'Four' : 'Three'


Measured memory_bytes: 2300
#include<stdio.h>
#include <iostream>
#include<string>
#include<vector>
#include<map>
#include<algorithm>
#include <random>
#include <chrono>

using namespace std;

int main() {
	int n,m;
	int tmp,old=-1;
	long long ans=1;
	cin >> n>>m;
	vector<int> dp(n + 1,INT_MAX);
	map<int,int> a;
	vector<bool> check(n);
	for (int i = 0; i < m; i++) {
		cin >> tmp;
		if (old + 1 == tmp) {
			cout << "0";
			return 0;
		}
		old = tmp;
		a[tmp]++;
	}

	dp[0] = 1; dp[1] = 1;
	int now = 0;
	int breakpoint = 0;
	for (int i = 1; i < n+1; i++) {
		if (a[i] != 0) {
			continue;
		}
		if (i - 2 >= 0) {
			if (a[i - 2] == 0) {
				if (a[i - 1] == 0) {
					dp[i] = dp[i - 2] + dp[i - 1];
				}
				else {
					dp[i] = dp[i - 2];
				}
			}
			else {
				dp[i] = dp[i - 1];
			}
		}
		else {
			if (a[i] != 0) {
				i = 2;
			}
		}

		dp[i] %= 1000000007;

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

Measured memory_bytes: 5376
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <deque>

using namespace std;

int main() {
    int n;
    cin >> n;
    vector<int> ls(n);
    for (int i = 0; i < n; ++i) {
        cin >> ls[i];
    }
    sort(ls.begin(), ls.end());
    int ans = 0;
    for (int ai = 0; ai < n; ++ai) {
        for (int bi = ai + 1; bi < n; ++bi) {
            int min_ng = ls[ai] + ls[bi];
            auto base = ls.begin() + bi + 1;
            auto iter = lower_bound(base, ls.end(), min_ng);
            ans += distance(base, iter);
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
program main
  
  implicit none
  integer:: n
  
  read (*, *) n
  if (mod(n, 10) == 3) then
    write (*, *) "bon"
  else if (mod(n, 10) == 0 .or. mod(n, 10) == 1 .or. mod(n, 10) == 6 .or. mod(n, 10) == 8) then
    write (*, *) "pon"
  else
    write (*, *) "hon"
  end if
  
end program main

Measured memory_bytes: 2776
/* ALDS1_9_A_CompleteBinaryTree */
/* 20181129 AOJ */

#define _CRT_SECURE_NO_WARNINGS
#define H 251
#include <stdio.h>

void printHeap(int *heap, int n);

int main(void) {
	int n, i;
	int heap[H] = {0};

	scanf("%d", &n);
	for (i = 1; i <= n; i++){
		scanf("%d", heap + i);
	}

	printHeap(heap, n);

	return 0;
}

void printHeap(int *heap, int n) {
	int id, parentId, leftId, rightId;
	for (id = 1; id <= n; id++) {
		printf("node %d: key = %d, ", id, heap[id]);
		parentId = id / 2;
		leftId = 2 * id;
		rightId = leftId + 1;
		if (parentId >= 1) printf("parent key = %d, ", heap[parentId]);
		if (leftId <= n) printf("left key = %d, ", heap[leftId]);
		if(rightId <= n) printf("right key = %d, ", heap[rightId]);
		printf("\n");
	}
}


Measured memory_bytes: 2040
#include <bits/stdc++.h>
using namespace std;
int a[] = {0, 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};

int main()
{
	int n;
	cin >> n;
	cout << a[n] << endl;
	return 0;
}


Measured memory_bytes: 256
fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val ls = readLine()!!.split(' ').map { it.toInt() }

    val l = ls.max()!!
    if (l < (ls.sum() - l)) {
        println("Yes")
    } else {
        println("No")
    }
}

Measured memory_bytes: 38296
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a[5],b[5],num;
  while(cin >> a[0] >> b[0],a[0]!=0||b[0]!=0){
    num = 0;
    for(int i=1;i<5;i++){
      cin >> a[i] >> b[i];
      if(a[num]+b[num] < a[i]+b[i]) num = i;
    }
    printf("%c %d\n",'A'+num,a[num]+b[num]);
  }
  return(0);
}



Measured memory_bytes: 3092
#include <iostream>
#include <cstdio>
#include <cctype>
using namespace std;

int main()
{
	char ch;
	while(1)
	{
		scanf("%c",&ch);
		if(islower(ch))ch=toupper(ch);
		else if(isupper(ch))ch=tolower(ch);
		printf("%c",ch);
		if(ch=='\n')break;
	}
	return 0;
}

Measured memory_bytes: 3076
#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
int main(){
  int x[10],y[10];
  int n;
  
  scanf("%d",&n);
  
  for(int i=0;i<n;i++)scanf("%d %d",&x[i],&y[i]);
  
  double ans=0;
  for(int i=0;i<n-1;i++){
    for(int j=i;j<n;j++){
      ans+=sqrt(pow(x[i]-x[j],2)+pow(y[i]-y[j],2));
    }
  }
  ans*=(double)2/n;
  
  printf("%lf\n",ans);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, a, b) for (int i = a; i < (int)b; i++)
#define all(v) v.begin(), v.end()
const int MOD = 1e9 + 7;
const int INF = 1e9;
//'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122

int main() {
    int h, w;
    cin >> h >> w;
    char maze[h][w];
    rep(i, 0, h) {
        rep(j, 0, w) {
            cin >> maze[i][j];
        }
    }
    int ans = -1;
    rep(i, 0, h) {
        rep(j, 0, w) {
            if (maze[i][j] == '#') continue;
            int dist[h][w];
            rep(k, 0, h) rep(l, 0, w) dist[k][l] = -1;
            queue<pair<int, int>> que;
            que.push(make_pair(i, j));
            dist[i][j] = 0;
            int mx = -1;
            int dy[4] = {1, 0, -1, 0};
            int dx[4] = {0, 1, 0, -1};
            while (!que.empty()) {
                int y = que.front().first;
                int x = que.front().second;
                que.pop();
                rep(k, 0, 4) {
                    int ny = y + dy[k];
                    int nx = x + dx[k];
                    if (dist[ny][nx] != -1) continue;
                    if (ny < 0 || h <= ny || nx < 0 || w <= nx) continue;
                    if (maze[ny][nx] == '#') continue;
                    dist[ny][nx] = dist[y][x] + 1;
                    mx = max(mx, dist[ny][nx]);
                    que.push(make_pair(ny, nx));
                }
            }
            ans = max(ans, mx);
        }
    }
    cout << ans << endl;
    return 0;
}


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

fn run() {
    let mut s = String::new();
    std::io::stdin().read_to_string(&mut s).unwrap();
    let mut it = s.trim().split_whitespace();
    let n: usize = it.next().unwrap().parse().unwrap();
    let m: usize = it.next().unwrap().parse().unwrap();
    let mut e = vec![];
    let mut g = vec![vec![std::u16::MAX / 2; n]; n];
    for i in 0..n {
        g[i][i] = 0;
    }
    for _ in 0..m {
        let a: usize = it.next().unwrap().parse::<usize>().unwrap() - 1;
        let b: usize = it.next().unwrap().parse::<usize>().unwrap() - 1;
        let c: u16 = it.next().unwrap().parse().unwrap();
        g[a][b] = c;
        g[b][a] = c;
        e.push((a, b, c));
    }
    for k in 0..n {
        for i in 0..n {
            for j in 0..n {
                g[i][j] = std::cmp::min(g[i][j], g[i][k] + g[k][j]);
            }
        }
    }
    let mut ans = 0;
    for (a, b, c) in e {
        let mut ok = 1;
        for i in 0..n {
            for j in 0..n {
                if g[i][j] == g[i][a] + c + g[b][j] {
                    ok = 0;
                }
            }
        }
        ans += ok;
    }
    println!("{}", ans);
}

fn main() {
    run();
}


Measured memory_bytes: 4476
#include <iostream>
#include <algorithm>
#include <functional>
#include <vector>
#include <string>
#include <map>
#include <sstream>
#include <stdexcept>
#define ll long long
// #include <bits/stdc++.h>
#define req(i,h) for(int i = 0; i < h; i++)

using namespace std;


int main(void) {
    ll n;
    cin >> n;
    if(n % 2 == 1) {
        cout << 2*n;
    } else {
        cout << n << endl;
    }
}



Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
  int a,b,c,n[3];
  cin>>a>>b>>c;
  n[0]=a+b;
  n[1]=a+c;
  n[2]=b+c;
  sort(n,n+3);
  cout<<n[0]<<endl;
  return 0;
}


Measured memory_bytes: 256