akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main(){
  int a,b,c;
  cin >> a >> b >> c;
  int d;
  d = a + b + c;
  if(d >= 22){
    cout << "bust" << endl;
  }
  else{
    cout << "win" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
n = int(input())
h = list(map(int,input().split()))

dp = [0]*n

dp[0]=0
dp[1]=abs(h[1]-h[0])

for i in range(2,n):
  dp[i]=min(dp[i-1]+abs(h[i]-h[i-1]),dp[i-2]+abs(h[i]-h[i-2]))

print(dp[n-1])

Measured memory_bytes: 13928
using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;

public class Test
{
    public static void Main()
    {
        //入力
        String[] R = Console.ReadLine().Split();

        string Temp = "";

        //1
        Temp = R[0];
        R[0] = R[1];
        R[1] = Temp;

        //2
        Temp = R[0];
        R[0] = R[2];
        R[2] = Temp;

        //出力
        string result = string.Join(" ", R); 

 
        Console.WriteLine(result);
    }

}



Measured memory_bytes: 13140
#include <bits/stdc++.h>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define Rreps(i,n,e) for(int i = n - 1; i >= e; --i)
#define Rrep(i,n) Rreps(i,n,0)
#define ALL(a) a.begin(), a.end()
#define fi first
#define se second
#define endl "\n"
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
#define traceV(v) for(auto x:v)cout<<x<<" ";cout<<endl
#define traceM(mp) for(auto x:mp)cout<<x.first<<" "<<x.second<<endl

//const ll MOD = 998244353;
const ll MOD = (1e+9) + 7;
const ll INF = 2e+9 + 10;
typedef pair<ll, ll> P;

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

  int v[3]; cin >> v[0]>>v[1]>>v[2];
  sort(begin(v), end(v));

  int diff = v[2]*3-(v[0]+v[1]+v[2]);

  int res;
  if(diff%2 == 0) res = diff/2;
  else res = diff/2 + 2;

  cout << res << endl;

  return 0;
}


Measured memory_bytes: 256
import java.util.*

fun readList() = readLine()!!.split(" ").map{it.toInt()}
fun removeOne(tree:TreeMap<Int,Int>,key:Int) = if(tree[key]==1)tree.remove(key) else tree.put(key,tree[key]!!-1)
fun main(args:Array<String>){
  val N = readLine()!!.toInt()
  val S = readList()
  val T = TreeMap<Int,Int>()
  for(x in S){
    T.put(x,(T[x]?:0)+1)
  }
  val A = mutableListOf<Int>()
  val last = T.lastKey()
  A += last
  removeOne(T,last)
  var answer = false
  var b = 1
  loop@ for(i in 0 until N){
    for(j in 0 until b){
      val c = T.lowerKey(A[j])
      if(c == null)break@loop
      A += c
      removeOne(T,c)
    }
    b *= 2
    if(i == N-1)answer = true
  }
  println(if(answer)"Yes" else "No")
}

Measured memory_bytes: 112468
public class Main {

  private static void solve() {
    double a = ni();
    double b = ni();
    double h = ni();
    double m = ni();


    double t1 = (h + m / 60) / 12.0 * Math.PI * 2;
    double t2 = m / 60.0 * Math.PI * 2;

    double ret = a * a + b * b - 2 * a * b * Math.cos(Math.abs(t1 - t2));
    System.out.printf("%.12f\n", Math.sqrt(ret));

  }

  public static void main(String[] args) {
    new Thread(null, new Runnable() {
      @Override
      public void run() {
        long start = System.currentTimeMillis();
        String debug = args.length > 0 ? args[0] : null;
        if (debug != null) {
          try {
            is = java.nio.file.Files.newInputStream(java.nio.file.Paths.get(debug));
          } catch (Exception e) {
            throw new RuntimeException(e);
          }
        }
        reader = new java.io.BufferedReader(new java.io.InputStreamReader(is), 32768);
        solve();
        out.flush();
        tr((System.currentTimeMillis() - start) + "ms");
      }
    }, "", 64000000).start();
  }

  private static java.io.InputStream is = System.in;
  private static java.io.PrintWriter out = new java.io.PrintWriter(System.out);
  private static java.util.StringTokenizer tokenizer = null;
  private static java.io.BufferedReader reader;

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

  private static double nd() {
    return Double.parseDouble(next());
  }

  private static long nl() {
    return Long.parseLong(next());
  }

  private static int[] na(int n) {
    int[] a = new int[n];
    for (int i = 0; i < n; i++)
      a[i] = ni();
    return a;
  }

  private static char[] ns() {
    return next().toCharArray();
  }

  private static long[] nal(int n) {
    long[] a = new long[n];
    for (int i = 0; i < n; i++)
      a[i] = nl();
    return a;
  }

  private static int[][] ntable(int n, int m) {
    int[][] table = new int[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[i][j] = ni();
      }
    }
    return table;
  }

  private static int[][] nlist(int n, int m) {
    int[][] table = new int[m][n];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[j][i] = ni();
      }
    }
    return table;
  }

  private static int ni() {
    return Integer.parseInt(next());
  }

  private static void tr(Object... o) {
    if (is != System.in)
      System.out.println(java.util.Arrays.deepToString(o));
  }
}



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

using namespace std;
using ll=long long;

int main()
{
    int n,q;cin >>n >>q;
    string s;cin >>s;
    int sum=0;
    int h[n],m[n];
        for(int i=0;i<n;i++){
                h[i]=0;m[i]=0;
        }
     for(int k=0;k<n-1;k++){
            if(s.substr(k,2)=="AC"){
                    sum++;
                    h[k+1]++;
            }
            h[k+1]+=h[k];
        }
        for(int k=n-1;k>0;k--){
            if(s.substr(k-1,2)=="AC"){
                    m[k-1]++;
            }
            m[k-1]+=m[k];
        }

    for(int i=0;i<q;i++){
        int l,r;cin >>l>>r;
        l--;r--;
        cout << sum-h[l]-m[r]<< endl;
    }
    return 0;
}


Measured memory_bytes: 1792
from collections import Counter
mod = 998244353
num_nodes = int(input())
d_ls = list(map(int, input().split()))
d_max = max(d_ls)
c = Counter(d_ls)

if c[0] == 1 and d_ls[0] == 0 and c[1] > 0:
    ans = 1
else:
    ans = 0

for i in range(1,d_max):
    ans *= c[i] ** c[i+1]
    ans %= mod
print(ans)



Measured memory_bytes: 19936
#include<bits/stdc++.h>
using namespace std;
int cnt[109];

int main(){
  int h,w;
  cin>>h>>w;
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      char c;
      cin>>c;
      cnt[c-'a']++;
    }
  }

  int t=0;
  for(int i=0;i<26;i++){
    t+=cnt[i]/4;
  }

  if(t<(h/2)*(w/2)){
    cout<<"No"<<endl;
    return(0);
  }

  int p=0;
  for(int i=0;i<26;i++){
    if(cnt[i]%2==1){
      p++;
    }
  }

  if(p==0||h%2==1&&w%2==1&&p==1){
    cout<<"Yes"<<endl;
  }
  else{
    cout<<"No"<<endl;
  }
  return(0);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define GET_MACRO(_1,_2,_3,_4,_5,_6,_7,_8,NAME,...) NAME
#define pr(...) cerr<< GET_MACRO(__VA_ARGS__,pr8,pr7,pr6,pr5,pr4,pr3,pr2,pr1)(__VA_ARGS__) <<endl
#define pr1(a) (#a)<<"="<<(a)<<" "
#define pr2(a,b) pr1(a)<<pr1(b)
#define pr3(a,b,c) pr1(a)<<pr2(b,c)
#define pr4(a,b,c,d) pr1(a)<<pr3(b,c,d)
#define pr5(a,b,c,d,e) pr1(a)<<pr4(b,c,d,e)
#define pr6(a,b,c,d,e,f) pr1(a)<<pr5(b,c,d,e,f)
#define pr7(a,b,c,d,e,f,g) pr1(a)<<pr6(b,c,d,e,f,g)
#define pr8(a,b,c,d,e,f,g,h) pr1(a)<<pr7(b,c,d,e,f,g,h)
#define prArr(a) {cerr<<(#a)<<"={";int i=0;for(auto t:(a))cerr<<(i++?", ":"")<<t;cerr<<"}"<<endl;}
using namespace std;
using Int = long long;
using _int = int;
using ll = long long;
using Double = long double;
const Int INF = (1LL<<60)+1e9; // ~ 1.15 * 1e18
const Int mod = (1e9)+7;
const Double EPS = 1e-8;
const Double PI = 6.0 * asin((Double)0.5);
using P = pair<Int,Int>;
template<class T> T Max(T &a,T b){return a=max(a,b);}
template<class T> T Min(T &a,T b){return a=min(a,b);}
template<class T1, class T2> ostream& operator<<(ostream& o,pair<T1,T2> p){return o<<"("<<p.first<<","<<p.second<<")";}
template<class T1, class T2, class T3> ostream& operator<<(ostream& o,tuple<T1,T2,T3> t){
  return o<<"("<<get<0>(t)<<","<<get<1>(t)<<","<<get<2>(t)<<")";}
template<class T1, class T2> istream& operator>>(istream& i,pair<T1,T2> &p){return i>>p.first>>p.second;}
template<class T> ostream& operator<<(ostream& o,vector<T> a){Int i=0;for(T t:a)o<<(i++?" ":"")<<t;return o;}
template<class T> istream& operator>>(istream& i,vector<T> &a){for(T &t:a)i>>t;return i;}
//INSERT ABOVE HERE

template<typename dtype>
class RMQ{
public:
  Int n,n_;
  dtype initValue; //範囲外のときに返す値。
  vector<dtype> dat;
  Int toMax;

  //初期化
  RMQ(){n=-1;}
  RMQ(Int n_,dtype initValue,Int toMax = 0):n_(n_),initValue(initValue),toMax(toMax){
    n=1;
    while(n<n_)n*=2;
    dat.resize(2*n-1,initValue);
  }

  inline dtype merge(dtype a,dtype b){return toMax? max(a, b):min(a, b); }

  //k番目の値をaに変更
  void update(Int k,dtype a){
    k+=n-1;
    dat[k]=a;
    while(k>0){
      k=(k-1)/2;
      dat[k]=merge(dat[k*2+1],dat[k*2+2]);
    }
  }
  
  dtype dfs(Int a,Int b,Int k,Int l,Int r){
    if(r<=a||b<=l)return initValue;
    if(a<=l&&r<=b)return dat[k];
    dtype vl = dfs(a,b,k*2+1,l,(l+r)/2);
    dtype vr = dfs(a,b,k*2+2,(l+r)/2,r);
    return merge(vl,vr);
  }
  
  //[a,b)の最小値を求める
  dtype get(Int a,Int b){
    assert(a <= b), assert(a <= n_ && b <= n_), assert(a >= 0 && a >= 0);
    return dfs(a,b,0,0,n);
  }
};



signed main(){
  srand((unsigned)time(NULL));
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);


  Int N;
  cin>>N;
  vector<Int> A(N);
  cin>>A;
  RMQ <P> rmq(100001, P(0,0), 1);
  
  for(Int i=0;i<N;i++){
    Int a = A[i];
    P val = rmq.get(0, a);
    val.first++;
    val.second += a;
    if(rmq.get(a, a+1) < val) rmq.update(a, val);
  }

  P ans = rmq.get(0, 100001);
  cout<<ans.second<<endl;

  
  

  
  return 0;
}



Measured memory_bytes: 7824
/*hello! guys~*/
#include <bits/stdc++.h>
using namespace std;

bool judge(string s, int l, int r)
{
	l--;r--;
    while (s[l] == s[r])
        ++l, --r;
    return l > r;
}
int main(){
    string s;
    cin>>s;
    int n=s.size();
    if(judge(s,1,n)&&judge(s,1,(n-1)/2)&&judge(s,((n+3)/2),n))
    printf("Yes");
    else printf("No");
    return 0;
}


Measured memory_bytes: 256
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor


INF = float('inf')
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 1000000007


s = S()


if s[0] == '0' or s[-1] == '1' or s[:-1] != s[:-1][::-1]:
    print(-1)
else:
    n = len(s)
    s = s[:-1]
    now_point = 1
    for nxt_point in range(len(s)):
        print(now_point, nxt_point+2)
        if s[nxt_point] == '1':
            now_point = nxt_point+2


Measured memory_bytes: 48472
import itertools

N, M = map(int, input().split())

list_num = [1] * M
list_2 = [2] * N

list_num.extend(list_2)

count = 0
for c in list(itertools.combinations(list_num, 2)):
    wa = sum(c)
    if wa == 2 or wa == 4:
        count += 1
print(count)

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

int main() {
  
  int A, B, C, D;
  cin >> A >> B >> C >> D;
  
  while(A>0 && C>0) {
    
    A -= D;
    C -= B;
    
    if(C<=0){
      cout << "Yes" << endl;
    }else if(A<=0){
      cout << "No" << endl;
    }
  }
  
}

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

int N, M;
int a[55], b[55], c[55], d[55];

int main() {
  // 入力
  cin >> N >> M;
  for (int i=0; i<N; i++) cin >> a[i] >> b[i];
  for (int i=0; i<M; i++) cin >> c[i] >> d[i];
  // i番目の学生の移動するべきチェックポイントを愚直に計算
  for (int i=0; i<N; i++) {
    int mini = 1e+9;
    int ans;
    for (int j=0; j<M; j++) {
      //mini = min(mini, abs(a[i]-c[j]) + abs(b[i]-d[j]));
      if (mini > abs(a[i]-c[j]) + abs(b[i]-d[j])) {
        mini = abs(a[i]-c[j]) + abs(b[i]-d[j]);
        ans = j+1;
      }
    }
    cout << ans << endl;
  }
  return 0;
}


Measured memory_bytes: 256
using System;

public class Hello
{
    public static void Main()
    {
        string[] line = Console.ReadLine().Trim().Split(' ');
        var n = int.Parse(line[0]);
        var k = int.Parse(line[1]);
        if (k % 2 == 0)
        {
            var k2 = k / 2;
            var a0 = n / k;
            int a1;
            if (n - k2 >= 0) a1 = (n - k2) / k + 1;
            else a1 = 0;
            var w1 = (long)Math.Pow(a0, 3) + (long)Math.Pow(a1, 3);
            Console.WriteLine(w1);
        }
        else
        {
            var a0 = n / k;
            var w1 = (long)Math.Pow(a0, 3);
            Console.WriteLine(w1);
        }
    }
}


Measured memory_bytes: 13140
#include "bits/stdc++.h"
using namespace std;
#define MOD 1000000007
#define Nmax 200010
#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define RFOR(i,a,b) for(long long i = (b-1);i>=a;i--)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ITR(itr,mp) for(auto itr = (mp).begin(); itr != (mp).end(); ++itr)
#define RITR(itr,mp) for(auto itr = (mp).rbegin(); itr != (mp).rend(); ++itr)
#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
typedef long long ll;
typedef pair<ll,ll> P;
typedef vector<P> Graph;

int main() {
	int A,B,C;
	cin >> A >> B >> C;
	if(C>=A && C<=B) cout << "Yes" << endl;
	else cout << "No" << endl; 
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <algorithm>

using namespace std;

int arr[210];

int main() {
    int n;
    scanf("%d", &n);
    for (int i = 0; i < 2 * n; i++) scanf("%d", &arr[i]);
    sort(arr, arr + 2 * n);
    int ans = 0;
    for (int i = 0; i < 2 * n; i += 2) ans += min(arr[i], arr[i + 1]);
    printf("%d\n", ans);
    return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <queue>
#include <sstream>
#include <algorithm>
#include <bitset>
#include <limits>
#include <map>
#include <set>
#include <iomanip>
#include <cmath>

using namespace std;

typedef long long int ll;
typedef std::numeric_limits<double> dbl;
const long long int LL_INF=1LL<<60;

vector<string> split(const string& input, char delimiter)
{
    stringstream stream(input);
    
    string field;
    vector<string> result;
    while (getline(stream, field, delimiter)) {
        result.push_back(field);
    }
    return result;
}

//#define DEBUG

ll A, B, M, N, D, K, Q, W, H, T, X, Y;

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

    int x = 0, maximum = 0;
    for (int i = 0; i < N; ++i) {
        if (str[i] == 'I')
            x++;
        else
            x--;
        maximum = max(maximum, x);
    }

    cout << maximum << endl;

    return 0;
}

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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep2(i,a,b) for(int i=a;i<b;i++)
#define each(it,v) for(auto it : v)
#define mod 1000000007
#define all(v) (v).begin(),(v).end()
#define ll long long
#define vi vector<int>
#define vll vector<ll>
#define vpii vector<pair<int,int>>
#define vv vector<vector<int>>
using namespace std;

main()
{
        int h,w,n;
        cin>>h>>w>>n;

        int sum=0,cnt=0;
        while(sum<n)
        {
                if(h>w)

                {
                        sum+=h;
                        w--;
                }else
                {
                        sum+=w;
                        h--;
                }
                cnt++;
        }
        cout<<cnt<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <functional>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
using namespace std;
template<class T, class Compare = less<T> >
using MaxHeap = priority_queue<T, vector<T>, Compare>;
template<class T, class Compare = greater<T> >
using MinHeap = priority_queue<T, vector<T>, Compare>;
using llong = long long;

llong n;
llong ans = 1ll << 60ll;

int main() {
    cin >> n;

    for (llong i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            ans = min(ans, n / i + i);
        }
    }

    cout << ans - 2 << endl;

    return 0;
}


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

bool isPalindrome(string s)
{
	string a = s;
	reverse(s.begin(),s.end());
	if (s == a) return true;
	return false;
}
int main()
{
	string s;cin>>s;
	string a = s.substr(0,((int)(s.length()-1))/2);
	string b = s.substr((int) (s.length()+2)/2);
	if (isPalindrome(s) && isPalindrome(a) && isPalindrome(b)) cout << "Yes" << "\n";
	else {cout << "No" << '\n';}
}


Measured memory_bytes: 256
import java.util.Scanner;

class Main{
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int A=sc.nextInt();
		int B=sc.nextInt();
		int C=sc.nextInt();
		int D=sc.nextInt();
		int E=sc.nextInt();
		int F=sc.nextInt();
		boolean toke=false;
		boolean[] mizu=new boolean[31];		//水　x*100gを作ることができるか
		boolean[] sato=new boolean[3001];		//砂糖 y*100gを作ることができるか
		for(int i=0; i<=30; i++) {
			mizu[i]=houteisiki(A,B,i);
			if(mizu[i]) {
				//System.out.println(i+"00 mizu");
			}
		}
		for(int i=0; i<=3000; i++) {
			sato[i]=houteisiki(C,D,i);
			if(sato[i]) {
				//System.out.println(i+" sato");
			}
		}
		int maxmz=1;
		int maxst=0;
		for(int i=A; i<=30; i++) {
			for(int j=0; j<=3000; j++) {
				if(sato[j]&&mizu[i]) {
					if((j+100*i)<=F) {		//総重量
						if(j<=i*E) {		//解けきれていますか?
							if(((long)j*(100*maxmz+maxst))-((long)maxst*(j+100*i))>0) {
								toke=true;
								maxst=j;
								maxmz=i;
							}
						}
					}
				}
			}
		}
		if(toke==true) {
			System.out.println((maxmz*100+maxst)+" "+maxst);
		}
		else {
			System.out.println(A*100+" "+0);
		}
		sc.close();
	}

	static boolean houteisiki(int a,int b,int c) {// ax+by=c;	今回はxもyも非負整数という成約有り
		int counter=0;
		while(true) {
			int tmp=c-a*counter;
			if(tmp<0) {
				return false;
			}
			else {
				if(tmp%b==0) {
					return  true;
				}
				else {
					counter++;
				}
			}
		}
	}
}

Measured memory_bytes: 22996
//Bismillahir-Rahmanir-Rahim
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int llu;
#define f1(i,n) for(i=1;i<=n;i++)
#define f(i,n) for(i=0;i<n;i++)
#define Max 100009
#define pb push_back
#define mp make_pair
using namespace std;
int main()
{
    	ll n,i,a=0,w=0,t=0,r=0;
    	cin>>n;
    	string s;
    	f(i,n)
    	{
    	    cin>>s;
    	    if(s=="AC")
                a++;
            else if(s=="WA")
                w++;
                else if(s=="TLE")
                t++;
                else if(s=="RE")
                r++;
    	}
        cout<<"AC x "<<a<<endl;
        cout<<"WA x "<<w<<endl;
        cout<<"TLE x "<<t<<endl;
        cout<<"RE x "<<r<<endl;

}


Measured memory_bytes: 3628
#include<iostream>
#include<vector>
#include<iomanip>
using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

ll gcd(ll a, ll b) {
    if (b == 0) return a;
    else return gcd(b, a % b);
}

void Main() {
    string S;
    cin >> S;
    bool flag = false;
    rep(i, 3){
        if (S[i] == '7'){flag = true;}
    }
    if (flag){cout << "Yes" << endl;} else {cout << "No" << endl;}
}


int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
    return 0;
}


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

#define NMAX 1000
int lcs[NMAX+1][NMAX+1];

int solveLCS(string S1, string S2) {
	int n1 = S1.size(), n2 = S2.size(), vmax = 0;
	
	for (int i = 0; i <= n1; i++) lcs[i][0] = 0;
	for (int i = 0; i <= n2; i++) lcs[0][i] = 0;

	for (int i = 1; i <= n1; i++) {
		for (int j = 1; j <= n2; j++) {
			if (S1[i - 1] == S2[j - 1]) {
				lcs[i][j] = lcs[i - 1][j - 1] + 1;
			}
			else {
				lcs[i][j] = max(lcs[i - 1][j], lcs[i][j - 1]);
			}
			vmax = max(vmax, lcs[i][j]);
		}
	}
	return vmax;
}

int main() {
	int N; cin >> N;
	string S1, S2;

	for (int i = 0; i < N; i++) {
		cin >> S1 >> S2;
		cout << solveLCS(S1, S2) << endl;
	}
	return 0;
}


Measured memory_bytes: 7044
#include <bits/stdc++.h>
using namespace std;
int main(void){
    // Your code here!
    string s;
    
    cin>>s;
    
    if(s[0]=='S') cout<<"Cloudy"<<endl;
    else if(s[0]=='C') cout<<"Rainy"<<endl;
    else cout<<"Sunny"<<endl;
}


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

using ll = long long;
using ull = unsigned long long;
using ld = long double;
#define FOR(NAME, START, NUM) for (int NAME = START; NAME < (NUM); NAME++)
#define REP(NAME, NUM) for (int NAME = 0; NAME < (NUM); NAME++)
#define BREP(NAME, NUM) for (int NAME = (NUM)-1; NAME >= 0; NAME--)
#define ALL(NAME) (NAME).begin(), (NAME).end()
const ll INF =1000000000000000;

int main(){
  ll n,count,min,sum;
  count=sum=0;
  min=INF;
  cin >> n;
  vector<ll> a(n);
  REP(i,n){
    cin>>a.at(i);
    if(a.at(i)<0)count++;
    if(abs(a.at(i))<min)min=abs(a.at(i));
    sum+=abs(a.at(i));
  }
  if(count%2==0)cout<<sum<<endl;
  else cout<<sum-min*2<<endl;
}

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

int main(){
    int a[4];
    int b[4];

    int hit;
    int blow;

    while(cin >> a[0] >> a[1] >> a[2] >> a[3] >> b[0] >> b[1] >> b[2] >> b[3]){
        hit = 0;
        blow = 0;
        for(int i=0; i<4; i++){
            for(int j=0; j<4; j++){
                if(a[i] == b[j]){
                    if(i == j) hit++;
                    else blow++;
                }
            }
        }
        printf("%d %d\n", hit, blow);
    }

    return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <sstream>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <cfloat>
#include <cmath>
#include <functional>
#include <forward_list>
#include <list>


#define rep(i,n) for(int i=0;i<n;i++)

using namespace std;


class Main {
public:
	int getAns(vector<int> as, int t) {
		int sum = 0;
		rep(i, as.size()-1) {
			sum += min(t, as[i + 1] - as[i]);
		}
		sum += t;
		return sum;
	}
};

int main(void) {
	Main main;
	vector<int> as;
	int n,t;

	cin >> n >> t;
	rep(i, n) {
		int inp;
		cin >> inp;
		as.push_back(inp);
	}

	cout << main.getAns(as, t) << endl;

	return 0;
}

Measured memory_bytes: 1908
#include<stdio.h>

int main( ){

  int a,b,s;
  char op;
  while(1){
 scanf("%d %c %d",&a,&op,&b);
    if (op=='+'){
s=a+b;
printf("%d\n",s);}
    else if(op=='-'){
s=a-b;
printf("%d\n",s);}
else if(op=='*'){
s=a*b;
printf("%d\n",s);}
else if(op=='/'){
  s=a/b;
printf("%d\n",s);}
 else if(op=='?'){break;}
  }
return 0;
}

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

vector<pair<int, int>> arr;

int main( void ) {
    
    int w, h;
    cin >> w >> h;
    
    for( int i = 1; i <= w; i ++ ) {
        int x;
        cin >> x;
        
        arr.push_back( make_pair( x, 0 ) );
    }
    
    for( int i = 1; i <= h; i ++ ) {
        int x;
        cin >> x;
        
        arr.push_back( make_pair( x, 1 ) );
    }
    
    w ++; h ++;
    sort( arr.begin(), arr.end() );
    
    long long ans = 0;
    for( pair<int, int> pr : arr ) {
        if( pr.second == 0 ) {
            ans += 1LL * pr.first * h;
            w --;
        }
        else {
            ans += 1LL * pr.first * w;
            h --;
        }
    }
    
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 2420
#include <iostream>
using namespace std;
 
const int DIM = 2e5 + 5;
const int MOD = 1e9 + 7;
 
int fct[DIM], inv[DIM];
 
 //逆元の計算
int lgput( int x, int n ) {
    if( n == 0 )
        return 1;
    
    int y = lgput( x, n / 2 );
    y = ( 1LL * y * y ) % MOD;
    
    if( n % 2 == 1 )
        y = ( 1LL * y * x ) % MOD;
    
    return y;
}

//組み合わせの計算は
//nCr
//  ( n )!  / ( (n-r)! * r! )
inline int combinate( int n, int k ) {
    return ( ( ( 1LL * fct[n] * inv[k] ) % MOD ) * inv[n - k] ) % MOD;
}
 
inline int getans( int l, int c ) {
    return combinate( l + c, l );
}
 
int main( void ) {
    
    //階乗の保存 : fct
    fct[0] = inv[0] = 1;
    
    for( int i = 1; i < DIM; i ++ )
        fct[i] = ( 1LL * fct[i - 1] * i ) % MOD;
    
    //逆元の保存 : inv
    inv[DIM - 1] = lgput( fct[DIM - 1], MOD - 2 );
    
    //逆元の性質からできるっぽい？
    for( int i = DIM - 2; i >= 1; i -- )
        inv[i] = ( 1LL * inv[i + 1] * (i + 1) ) % MOD;
    
    
    //入力開始
    int h, w, a, b;
    cin >> h >> w >> a >> b;
    
    //solve
    //まずスタートからゴールまでの全ての通り数の計算
    int ans = getans( h - 1, w - 1 );
    
    //通れない領域の横幅についてループをまわす
    for( int j = 1; j <= b; j ++ ) {
        //現在の答えから余分な領域を通り数を引いている
        //
        ans = ( ans - ( 1LL * getans( h - a - 1, j - 1 ) *
                              getans( a - 1, w - j ) ) % MOD + MOD ) % MOD;
    }
    
    //逆元の計算方法と引いていくときの境界の取り方が参考になった
    
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <string>
#include <vector>
using ll=long long;
using namespace std;

class UnionFind{
public:
    vector<int> v;
    UnionFind(int size):v(size,-1){}

    int root(int a){
        if(v[a]<0){
            return a;
        }else{
            int res=root(v[a]);
            v[a]=res;
            return res;
        }
    }

    void unite(int a,int b){
        int roota=root(a);
        int rootb=root(b);
        if(roota==rootb){return;}
        if(v[roota]>v[rootb]){
            v[rootb]+=v[roota];
            v[roota]=rootb;
        }else{
            v[roota]+=v[rootb];
            v[rootb]=roota;
        }
    }

    bool same(int a,int b){
        return root(a)==root(b);
    }

    int size(int a){
        return v[root(a)];
    }
};

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

    vector<pair<int,int>> E;
    int a,b;
    for(int i=0;i<M;i++){
        cin>>a>>b;
        E.push_back({a,b});
    }

    //cout<<"hoge"<<endl;

    int ans=0;
    for(int i=0;i<M;i++){
        //cout<<i<<endl;
        UnionFind uf(N+1);
        for(int j=0;j<M;j++){
            if(j!=i){
                uf.unite(E[j].first,E[j].second);
            }
        }

        int cnt=0;
        for(int j=1;j<=N;j++){
            if(uf.v[j]<0){
                cnt++;
            }
        }

        if(cnt>1){
            ans++;
        }
    }
    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> ii;
typedef pair<ll, ll> l4;
//typedef pair<double, double> dd;
#define mp make_pair
#define pb push_back
#define debug(x) cerr << #x << " = " << x << " "



int main()
{
  vector<int> v({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 x;
  while (cin >> x)
    cout << v[x-1] << endl;
}


Measured memory_bytes: 256
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include<set>
#include<map>
using namespace std;


int main() {
    int a, b, c;
    cin >> a >> b >> c;
    cout << (c/a) * b;     
    cout << endl;
}


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

#define st first
#define nd second
#define ll long long
#define ld long double
#define pb push_back
#define emp emplace_back
#define pii pair<int, int>
#define usg unsigned
#define sg signed
#define mp make_pair

using namespace std;

void setIO(){
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
}

const ld PI = 4*atan((ld)1);
const int INF = 1e9+7;

int main(){
	setIO();
	ll n, x=100, ct=0; cin>>n;
	while(x<n){
		ct++;
		x+=(x/100);
	}
	cout<<ct<<endl;
}

Measured memory_bytes: 3640
#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;

int a[N];
 
signed main() {
    IOS;
    int k, n;
    cin >> k >> n;
    int d = 0;
    for(int i = 1; i <= n; i++){
        cin >> a[i];
    }
    sort(a+1, a+n+1);
    for(int i = 2; i <= n; i++)
        d = max(d, a[i] - a[i-1]);
    d = max(d, k-a[n]+a[1]);
    cout << k-d;   
    return 0;
}

Measured memory_bytes: 1792
import java.util.*;
 
public class Main {
  public static void main(String[] args) {
    Scanner scan = new Scanner(System.in);
    String[] s = scan.nextLine().split("");
    Map<String,Integer> map = new HashMap<>();
    
    int flg = 0;
    for(int i = 0;i<s.length;i++){
      if(map.get(s[i]) != null){
        flg++;
        System.out.println("no");
        break;
      }else{
        map.put(s[i],1);
      }
    }
    if(flg == 0){
      System.out.println("yes");
    }
        
  }
}
    

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef complex<double> Point;

#define PI acos(-1.0)
#define EPS 1e-10
const ll INF = 1e16;
const ll MOD = 1e9 + 7;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,N) for(int i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )
#define fi first
#define se second
#define N_SIZE (1LL << 20)
#define NIL -1

int main(){
	ll ans = 0;
	ll m = INF;
	rep(i,5){
		ll num;
		cin >> num;
		ans += num - num % 10;
		if(num % 10){
			ans += 10;
			m = min(m,num % 10);
		}
	}
	// cout << ans << " " << m << endl;
	if(m == INF)cout << ans << endl;
	else cout << ans - (10 - m) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define pii pair<int, int>
#define pll pair<ll, ll>
#define ld long double
#define pb push_back
#define f first
#define se second
 
 
using namespace std;
 
const int N = 5e5 + 123; 


ll m, k, pw[30];
bool is[N];
vector <ll> a, b;

 
int main() {
    cin >> m >> k;
    ll t = 1;
    for (ll i = 0; i <= 20; i++) {
        pw[i] = t;
        t *= 2;
    }
    if (k > pw[m] - 1)
        return cout << -1, 0;
    if (m == 0)
        return cout << "0 0", 0;
    if (m == 1 && k == 0)
        return cout << "0 0 1 1", 0;
    if (m == 1)
        return cout << -1, 0;
    if (k == 0) {
        for (int i = 0; i < pw[m]; i++)
            cout << i << " ";
        for (int i = pw[m] - 1; i >= 0; i--)
            cout << i << " ";
        return 0;
    }
    bool iss = 0;
    for (int i = 0; i < 20; i++)
        if (k == pw[i]) {
            if (k != 1) {
                b.pb(pw[i] + 1);
                b.pb(1);
                iss = 1;
                is[1] = is[pw[i] + 1] = 1;
            } else {
                b.pb(pw[1]);
                b.pb(pw[1] + 1);
                iss = 1;
                is[pw[1]] = is[pw[1] + 1] = 1;
            }
            break;
        }
    if (!iss) {
        for (int i = 0; i < 20; i++)
            if (1 & (k>>i)) {
                is[pw[i]] = 1;
                b.pb(pw[i]);
            }
    }
    is[k] = 1;
    for (int i = 0; i < b.size(); i++)
        a.pb(b[i]);
    for (int i = 0; i < pw[m]; i++)
        if (!is[i])
            a.pb(i);
    a.pb(k);
    for (int i = pw[m] - 1; i >= 0; i--)
        if (!is[i])
            a.pb(i);
    for (int i = b.size() - 1; i >= 0; i--)
        a.pb(b[i]);
    a.pb(k);
    for (int i = 0; i < a.size(); i++)
        cout << a[i] << " ";
    return 0; 
}


Measured memory_bytes: 4080
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <bitset>
#include<vector>
#include<utility>
#include<fstream>
#include<queue>
#include <iomanip>
#include<numeric>
#include<set>
using namespace std;
typedef long long ll;
#define rep(i,k) for(i=0;i<k;i++)
#define P pair<ll,ll>
ll mod = 1000000007;
P p[200005];

ll i, b, c, k,j, n, m, z = 0,mi=10,q;
ll a[100008] = {};
vector<ll> v;
multiset<ll> mu;
int main() {
	cin >> n >> m;
	rep(i, n) {
		cin >> a[i];
		mu.insert(-a[i]);
	}
	rep(i, m) {
		b = *mu.begin();
		auto it = mu.begin();
		b = b / 2;
		auto it2 = it;
		it2++;
		mu.erase(it, it2);
		mu.insert(b);

	}
	z = 0;
	rep(i, n) {
		z += *mu.begin();
		auto it = mu.begin();
		auto it2 = it;
		it2++;
		mu.erase(it, it2);
		}
	

	cout << -z;
	
	return 0;
}

Measured memory_bytes: 5760
import itertools
import math
import sys
import heapq
from collections import Counter
from collections import deque
from fractions import gcd
from functools import reduce
sys.setrecursionlimit(4100000)
from functools import lru_cache
INF = 1 << 60

#ここから書き始める
n, m = map(int, input().split())
a = [[""] * n] * n
b = [[""] * m] * m
for i in range(n):
    a[i] = [j for j in input()]
for i in range(m):
    b[i] = [j for j in input()]
# print(a)
# print(b)
for i in range(n - m + 1):
    for j in range(n - m + 1):
        flag = True
        for k in range(i, i + m):
            for l in range(j, j + m):
                if a[k][l] != b[k - i][l - j]:
                    flag = False
                    break
            if not flag:
                break
        if flag:
            print("Yes")
            sys.exit()
print("No")



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

// @@ !! LIM()

int main(/* int argc, char *argv[] */) {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout << setprecision(20);

  string s; cin >> s;
  ll n = s.size();
  ll K; cin >> K;
  set<string> cand;
  for (ll i = 0; i < n; i++) {
    for (ll k = 1; k <= K; k++) {
      if (i + k <= n) cand.insert(s.substr(i, k));
    }
  }
  auto it = cand.begin();
  for (ll i = 0; i < K-1; i++) it++;
  cout << *it << endl;

  return 0;
}



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

using namespace std;

int main() {

	long  n,W;

	cin >> n >> W;

	vector< long  > w(n + 1);
	vector< long long > v(n+1);

	for (long  i = 1; i <= n; i++) {
		cin >> w[i] >> v[i];
	}

	vector<vector<long long>> dp(n+2,vector<long long>(W+2));

	for (long  i = 1; i <= n; i++) {
		for (long  j = 1; j <= W; j++) {
			if (j - w[i] >= 0) {
				dp[i][j] = max((long long)dp[i - 1][j], (long long)dp[i - 1][j - w[i]] + (long long)v[i]);
			}
			else {
				dp[i][j] = dp[i - 1][j];
			}
		}
	}

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

Measured memory_bytes: 81024
//保留所有权利。
#include<iostream>
#include<stdio.h>//printするよ
#include<vector>
#include<algorithm>//辞書順はnext_permutationだよ
#include<set>
#include<string>
#include<sstream>
#include<string.h>
#include<complex>
#include<time.h>
#include<random>
#include<cmath>
#include<math.h>
#include<queue>
#include<time.h>
#include<iomanip>
#include<locale>
#include<utility>//swapで数値交換するよ
//END OF LIBRARIES.
#define rt "\n"//改行を最速化させるよ
#define rep(i,n) for(int i=0;i<n;i++)
#define rop(i,n) for(int i=1;i<=n;i++)
#define drep(i,n) for(int i=n-1;0<=i;i--)
#define drop(i,n) for(int i=n;0<i;i--)
#define yes(ans) if(ans)cout<<"yes"<<rt;else cout<<"no"<<rt;
#define Yes(ans) if(ans)cout<<"Yes"<<rt;else cout<<"No"<<rt;
#define YES(ans) if(ans)cout<<"YES"<<rt;else cout<<"NO"<<rt;
#define sec(a,b,ans) if(ans)cout<<a<<rt;else cout<<b<<rt;
#define vcin(s,n) rep(i,n)cin>>s[i];//vcin(配列名),(繰り返し回数)
#define sort(s) sort(s.begin(),s.end())
#define reve(s) reverse(s.begin(),s.end())
#define asas int ans=0
#define llcncn llint cnt=0
#define llasas llint ans=0
#define cncn int cnt=0
#define smsm int sum=0
#define str srting
#define v vector
#define please return
#define AC 0//おまじないだよ
#define Rapid cin.tie(0);ios::sync_with_stdio(false)
//END OF DEFINE.
using namespace std;
typedef vector<int> vint;
typedef vector<string> vstr;
typedef vector<char> vcha;
typedef vector<double> vdou;
typedef long long int llint;
typedef pair<int, int> pint;
typedef pair<llint, llint> pllint;
typedef vector<llint> vllint;
typedef vector<pint> vpint;
typedef vector<pair<llint, llint>> vpllint;
typedef vector<vector<int>> vvint;
typedef vector<vector<llint>> vvllint;
typedef vector<vector<string>> vvstr;
typedef vector<vector<pint>> vvpint;
typedef vector<bool> vbool;
//printf("%02d:%02d:%02d\n", h, m, s);・・・2文字は埋める・h、m、ｓ
//END OF TYPEDEF.

//最大公約数（GCD）を求めるよ
//最小公倍数（LCM）は＜＜　A × B ÷ GCD　 ＞＞で求まるよ

long long GCD(long long a, long long b) {
	if (b == 0) return a;
	else return GCD(b, a % b);
}
long long LCM(long long a, long long b) {
	return a * b / GCD(a, b);
}
/*
  for A以上B未満でI探索 for (int I = A; i <= B; i++)

  string s = to_string(i);

  char　小文字のほうが32大　　  　大文字と小文字の境=93

  大文字→小文字 文字列のn文字目を大文字で出力→ (char)toupper(a[0])

  int i = sqrt ( n ) で、ｎの平方根(9に対する3)をiに入れる

  pow(a,b) → aのb乗を求める

  s1.erase(n) 文字列s1の、n文字目以降削除             */

int a = 0, b = 0, c = 0, d = 0, x = 0, y = 0
, z = 0, n = 0, sum = 0, i = 0, ans = 0, cnt = 0;
string s = "";

int main(void) {
	cin >> n;
	rep(i,n) {
		if (i % 2 == 0)i++;
		rop(j, i) {
			if (i % j == 0)cnt++;
		}
		if (cnt == 8)ans++;
		cnt = 0;
		x = 0;
	}
	cout << ans << rt;
	please AC;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long long k,a,b;
int main()
{
	cin>>k>>a>>b;
	if(a>=k){cout<<1<<endl;return 0;} 
	if(b>=a){cout<<-1<<endl;return 0;}
	if((k-a)%(a-b)>=1)cout<<((k-a)/(a-b)+1)*2+1<<endl;
	else cout<<((k-a)/(a-b))*2+1<<endl;
	return 0;
 } 

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

// limit
#define mod1 22439423LL
#define mod2 42342432LL
#define mod3 56454765LL
#define mod4 66867574LL
#define oo 1000000007LL
#define OO 1000000000000000007LL

// loop
#define fto(i, x, y) for(int i = (x); i <= (y); ++i)
#define fdto(i, x, y) for(int i = (x); i >= (y); --i)
#define ftoa(i, x, y, a) for(int i = (x); i <= (y); i += a)
#define fdtoa(i, x, y, a) for(int i = (x); i >= (y); i -= a)
#define ftosqrt(i, x, y) for(int i = (x); i*i <= (y); ++i)
#define ftoit(it, var) for (__typeof(var.begin()) it = var.begin(); it != var.end(); ++it)
#define fdtoit(rit, var) for (__typeof(var.rbegin()) rit = var.rbegin(); rit != var.rend(); ++rit)

// debug
#define debug cout << "*" << endl;
#define bug1d(a, x, y) { cout << #a << ": "; fto(_, x, y) cout << a[_] << ' '; cout << endl; }
#define bug2d(a, x, y, u, v) { cout << #a << ": " << endl; fto(i, x, y) {fto(j, u, v) cout << a[i][j] << ' '; cout << endl;}; cout << endl;}
#define bug(a) cout << #a << " = " << a << endl;
#define bug2(a, b) cout << #a << " = " << a << "; "; cout << #b << " = " << b << endl;
#define bug3(a, b, c) cout << #a << " = " << a << "; "; cout << #b << " = " << b << "; "; cout << #c << " = " << c << endl;

// operation
#define mp make_pair
#define pb push_back
#define pf push_front
// structure
#define ii pair<int, int>
#define iii pair<ii, int>
#define vi vector<int>
#define vll vector<ll>
#define vii vector<ii>
#define matrix vector<vi>

// get value
#define FF first
#define SS second

// data type
#define ll long long
#define ull unsigned long long

// function
#define lb lower_bound
#define ub upper_bound

// const value
#define pi 3.14159265358979323846264338327950288419716939937510

using namespace std;

template <class T>
T min(T a, T b, T c) {
    return min(a, min(b, c));
}

template <class T>
T min(T a, T b, T c, T d) {
    return min(a, min(b, min(c, d)));
}

template <class T>
T max(T a, T b, T c) {
    return max(a, max(b, c));
}

template <class T>
T max(T a, T b, T c, T d) {
    return max(a, max(b, max(c, d)));
}

bool cmp(const ii& a, const ii& b) {return (a.FF > b.FF || (a.FF == b.FF && a.SS >= b.SS));}
ll GCD(ll a, ll b) {return (a%b) ? GCD(b, a%b) : b;}

const string namePro = "tmp";
#define maxN 1000007

int a[maxN];
map <int, int> check;

int main(){
    // #ifndef ONLINE_JUDGE
    //     freopen((namePro+".inp").c_str(), "r", stdin);
    //     freopen((namePro+".out").c_str(), "w", stdout);
    // #endif // ONLINE_JUDGE

    int n;
    scanf("%d", &n);

    fto (i, 1, n) {
    	scanf("%d", &a[i]);
    	check[a[i]]++;
    }

    multiset <int> st;
    fto (i, 1, n) {
    	if (check[a[i]] >= 2) {
    		st.insert(-a[i]);
    		if (check[a[i]] >= 4) st.insert(-a[i]);
    		check[a[i]] = 0;
    	}
    }

    if (st.size() < 2) {
    	puts("0");
    	return 0;
    }

    int x = *st.begin();
    st.erase(st.begin());

    int y = *st.begin();
    cout << (ll)x*y << endl;
    return 0;
}

Measured memory_bytes: 5376
import java.util.*;

public class Main {
	static char[] arr;
	public static void main (String[] args)  {
		Scanner sc = new Scanner(System.in);
		arr = sc.next().toCharArray();
		int count = 0;
		char prev = 'X';
		for (int i = 0; i < arr.length; i++) {
			if (prev == arr[i]) {
				i++;
				prev = 'X';
				count++;
			} else {
              if (i == arr.length - 2 && arr[i] == arr[i + 1]) {
                i++;
              }
				prev = arr[i];
				count++;
			}
		}
		System.out.println(count);
	}
	
}


Measured memory_bytes: 26800
#include <vector>
#include <algorithm>
#include <vector>
#include <iostream>
#include <string>
#include <set>
#include <map>
#include <fstream>
using namespace std;


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

	string s;
	cin >> s;
	int paperCount = 0;
	for (int i = 0; i < (int) s.size(); ++i) {
		if (s[i] == 'p') ++paperCount;
	}
	cout << (int) s.size() / 2 - paperCount << endl;

	return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
/* typedef */
typedef long long ll;
typedef pair<int, int> pii;
/* constant */
const int INF = 1 << 30;
const ll LINF = 1LL << 50;
const int NIL = -1;
const int MAX = 10000;
const int mod = 1000000007;
const double pi = 3.141592653589;
/* global variables */
/* function */
/* main */
int main(){
    int N, T;
    cin >> N >> T;
    vector<pii> v(N);
    int a, b;
    for (int i = 0; i < N; i++) {
        cin >> a >> b;
        v[i] = pii(a, b);
    }
    sort(v.begin(), v.end());
    vector<int> dp(T+1);
    for (int i = 0; i < N; i++) {
        for (int j = T - 1; j >= 0; j--) {
            int k = min(T, j + v[i].first);
            dp[k] = max(dp[k], dp[j] + v[i].second);
        }
    }
    cout << dp[T] << '\n';
}

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

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


  cout << (1000-N%1000)%1000 << endl;

}

Measured memory_bytes: 3628
al = [list(map(int, input().split())) for _ in range(3)]
n = int(input())

for _ in range(n):
    x = int(input())
    for i in range(3):
        for j in range(3):
            if al[i][j]==x:
                al[i][j] = -1

for i in range(3):
    if -3==sum(al[i]):
        print("Yes")
        exit()

    if -3==sum([al[j][i] for j in range(3)]):
        print("Yes")
        exit()

if al[0][0]+al[1][1]+al[2][2]==-3:
    print("Yes")
    exit()
if al[0][2]+al[1][1]+al[2][0]==-3:
    print("Yes")
    exit()

print("No")


Measured memory_bytes: 3064
#include <iostream>

using namespace std;

int a[55];

int main()
{
    int n,i,j,s=0;
    cin >> n;
    for(i=1;i<=n;i++)
        cin>>a[i];
    for(i=1;i<n;i++)
        for(j=i+1;j<=n;j++)
            s+=a[i]*a[j];
    cout<<s<<"\n";
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
//#include<Hatsune_Miku>
using namespace std;
int n,m;
char haha;
int main()
{
	std::ios::sync_with_stdio(false);
	cin>>n>>haha>>m;
	if(haha=='+')cout<<n+m<<endl;
	else cout<<n-m<<endl;
	
    return 0;
}

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

#define rep(i, n) for(int i=0; i<n; i++) 

int main() {
    string s, t;
    cin >> s >> t;

    vector<int> cs(26, 0), ct(26, 0);

    bool b = true;

    map<char, char> ms, mt;
    for (int i = 0; i < s.size(); i++){
        
        if(ms.count(s[i])&&ms[s[i]]!=t[i]){
            b = false;
            break;
        }
        if(mt.count(t[i])&&mt[t[i]]!=s[i]){
            b = false;
            break;
        }
        ms[s[i]] = t[i];
        mt[t[i]] = s[i];
    }

    if(b)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}

Measured memory_bytes: 776
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int num = s.nextInt();
		while(num!=0){
			int max = Integer.MIN_VALUE;
			int[] data = new int[num];
			for(int i=0 ; i<num ; i++)
				data[i] = s.nextInt();
			for(int i=0 ; i<num ; i++){
				int sum = 0;
				for(int j=i ; j<num ; j++){
					sum+=data[j];
					if(max<sum)
						max=sum;
				}
			}
			num = s.nextInt();
			System.out.println(max);
		}
    }
}

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

int main() {
    ll n;
    cin >> n;
    ll ans = 0;
    for (ll i = 1; i <= n; i++) {
        ll k = n / i;
        ans += (1 + k) * k / 2 * i;
    }
    cout << ans << endl;
    return 0;
}

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

int main() {
  int N;
  cin >> N;
  if( (N - N % 10) % 1110 == 0 || (N % 1000) % 111 == 0 ){
    cout << "Yes";
  }
  else{
    cout << "No";
  }
}

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

static const int MAX_N = 8;

bool edges[MAX_N + 1][MAX_N + 1];

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

  for (int i = 0; i < M; ++i) {
    int a, b;
    cin >> a >> b;
    edges[a][b] = edges[b][a] = true;
  }

  int index[MAX_N];
  for (int i = 0; i < N; ++i) index[i] = i + 1;

  int ans{};

  sort(index, index + N); // 昇順にソートしておく
  do {
    bool path{true};
    for (int i{1}; i < N; ++i) {
      if (!edges[index[i - 1]][index[i]]) {
        path = false;
        break;
      }
    }
    if (path) ++ans;
  } while (next_permutation(index + 1, index + N));

  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256