akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
  using namespace std;
  #define rep(i, n) for (int i = 0; i < (int)(n); i++)
  #define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
  typedef long long ll;
  #define all(x) (x).begin(),(x).end()
  int INF = 1000000000;

  int main() {
    int N, M; cin >> N >> M;
    vector<pair<int, int>> ab;
    vector<pair<int, int>> cd;
    rep(i, N) {
      int a, b; cin >> a >> b;
      ab.push_back(make_pair(a, b));
    }
    rep(i, M) {
      int c, d; cin >> c >> d;
      cd.push_back(make_pair(c, d));
    }
    rep(i, N) {
      int ans = INF;
      int idx;
      int a, b;
      tie(a, b) = ab[i];
      rep(j, M) {
        int dis = 0;
        int c, d;
        tie(c, d) = cd[M-1-j];
        dis = abs(a - c) + abs(b - d);
        if (dis <= ans) {
          ans = dis;
          idx = M - 1 - j + 1;
        }
      }
      cout << idx << endl;
    }
  }

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

string day[]{"mon","tue","wed","thu","fri","sat","sun"};
int ans[100];
int main(){
	int x;scanf("%d",&x);
	ans[9]=5;
	for(int i=8;i>=1;i--){
		if(ans[i+1]==0)ans[i]=6;
		else ans[i]=ans[i+1]-1;
	}
	for(int i=10;i<=30;i++){
		ans[i]=(ans[i-1]+1)%7;
	}
	cout<<day[ans[x]]<<endl;
}

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

def main():
    dic = {}
    for i in range(ord("a"), ord("z")+1):
        dic[chr(i)] = 0
    for line in sys.stdin.readlines():
        for c in line.strip():
            c = c.lower()
            if c in dic:
                dic[c] += 1
    
    for c, count in sorted(dic.items(), key=lambda x: x[0]):
        print(c, ":", count)

if __name__ == "__main__":
    main()


Measured memory_bytes: 5576
import java.util.*;
public class Main {
    public static void main(String[] args) throws Exception {
       Scanner sc = new Scanner(System.in);
       int A = sc.nextInt();
       if(A < 24){
           System.out.println(24 + 24 - A);
       }else{
           System.out.println("24");
       }
    }
}


Measured memory_bytes: 22228
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
int n, r;
int main(){
	scanf("%d%d", &n, &r);
	if(n < 10) r += 100 * (10 - n);
	printf("%d\n", r);
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<list>
#include<cstdint>
#include<bits/stdc++.h>
#include<queue>
#include<set>

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep_r(i, n) for(int i = n-1; i >= 0; i--)
#define rep1(i, n) for(int i = 1; i <= (int)(n); i++)
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((ll)(x).size())
#define bit(n) (1LL<<(n))
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

#define INF bit(60)
#define pb push_back
#define mod 1000000007

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

using namespace std;
using uif=uint_fast64_t;
using ll=long long int;

int qp(int a,ll b){int ans=1;do{if(b&1)ans=1ll*ans*a%mod;a=1ll*a*a%mod;}while(b>>=1);return ans;}
int qp(int a,ll b,int mo){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}

int gcd(int a,int b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};


#define FACSIZE 2002

ll invfac[FACSIZE];
ll fac[FACSIZE];

ll mod_pow(ll x,ll r){
  if(r==0) return 1;
  else if(r==1) return x%mod;
  else if(r%2==0){
    ll t=mod_pow(x,r/2)%mod;
    return t*t %mod;
  } 
  else{
    ll t=mod_pow(x,r/2)%mod;
    ll k= t*t %mod;
    return k*x%mod;
  } 
}
ll mod_add(ll a,ll b){
  return (a+b)%mod;
}

ll mod_mul(ll a,ll b){
  return (a*b)%mod;
}

ll div(ll a,ll b){
  return mod_mul(a,mod_pow(b,mod-2));
}

void make_fact(ll n){
  fac[0]=1;
  rep(i,n){
    fac[i+1]=mod_mul(fac[i],i+1);
  }  
}

void make_invfact(ll n){
  invfac[n]= mod_pow( fac[n] ,mod-2);
  for(int i=n-1;i>=0;i--){
    invfac[i]=mod_mul(invfac[i+1],i+1);
  }

}

ll mod_combi(ll n, ll m){
    ll tmp = mod_mul(fac[n],invfac[n-m]);
    return mod_mul(tmp,invfac[m]);
}

int main(void){


  ll n,d;
  cin>>n>>d;

  vector< vector<ll> > x( n,vector<ll>(d) );

  rep(i,n){
    rep(j,d){
      cin>> x[i][j];
    }
  }
  ll ans=0;
  for(ll i=0;i<n;i++){
    for(ll j=i+1;j<n;j++){
      
      double tmp=0;

      for(ll k=0;k<d;k++){

        tmp += (x[i][k]-x[j][k])*(x[i][k]-x[j][k]);

      }

      ll t2=(ll)sqrt(tmp);
      
      //cout << tmp << "," << t2 << endl;

      if( abs(tmp - t2*t2) < 1e-6) ans++;

    }
  }

  cout << ans << endl;

  return 0;

}


Measured memory_bytes: 256
#include <stdio.h>
int main()
{
//	char str[1200];
	char ch;
	int i=0,j;

	while(1){
		scanf("%c",&ch);
		if(ch=='\n') break;
		
		//大文字か小文字かを判定する
		if(ch>='a' && ch<='z'){
			ch=ch-32;
			//printf("%c",ch);
		}
		else if(ch>='A' && ch<='Z'){
			ch=ch+32;
		//	printf("%c",ch);
		}else{
		   // printf("%c",ch);
		}
		printf("%c",ch);
	}
	printf("\n");
	return 0;
}


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

int main()
{
	int n;
	long long takahashi{1}, aoki{1};
	scanf("%d", &n);
	for (int i = 0; i < n; i++)
	{
		int t, a;
		scanf("%d%d", &t, &a);
		long long next_gcd{std::max((takahashi + t - 1) / t, (aoki + a - 1) / a)};
		takahashi = t * next_gcd;
		aoki = a * next_gcd;
	}
	printf("%lld\n", takahashi + aoki);
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <climits>
#include <cmath>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++ )
#define repf(i,m,n) for(int (i)=m;(i)<n;(i)++)
#define all(v) (v).begin(), (v).end()
#define ll long long
#define vec(n,m,v) vector<long long> v((n),(m));


int main(){
    int n;
    cin>>n;
    int ans=0;
    vec(n,0,v);
    rep(i,n){
        cin>>v[i];
        ans+=v[i];
    }
    sort(all(v));
    ans-=(v[n-1]/2);
    cout<<ans<<endl;
    return 0;


}



Measured memory_bytes: 256
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

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

		int N = sc.nextInt();
		int K = sc.nextInt();
		int sum = 0;

		List<Integer> cost = new ArrayList<>();

		for(int i=0;i<N;i++) cost.add(sc.nextInt());

		Collections.sort(cost);

		for(int i=0;i<K;i++) sum+=cost.get(i);

		System.out.println(sum);
	}

}

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

int main() {
    string W, S;
    int num = 0;
    cin >> W;
    while (1) {
        cin >> S;
        if (S == "END_OF_TEXT") break;
        else {
            for (int i = 0; i < S.size(); i++){
                S[i] = tolower(S[i]);
            }
            if (W == S) num++;
        };

    }

    cout << num << endl;

    return 0;
}

Measured memory_bytes: 3136
import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		String[] s = stdIn.next().split("");
		boolean flag = false;
		Arrays.sort(s);
		
		for(int i = 0; i < s.length-1; i++) {
			if(s[i].equals(s[i+1])) {
				flag = true;
			}
		}
		if(flag) {
			System.out.println("no");
		}else {
			System.out.println("yes");
		}
		
	}

}


Measured memory_bytes: 21844
n = int(input())
a_list = list(map(int, input().split()))
b_list = list(map(int, input().split()))
c_list = list(map(int, input().split()))

ans = 0
for i in range(len(a_list)):
    ans += b_list[a_list[i] - 1]
    if i > 0 and a_list[i] == a_list[i - 1] + 1:
        ans += c_list[a_list[i - 1] - 1]


print(ans)


Measured memory_bytes: 3060
//--------------------------------------//
#include <bits/stdc++.h>
#include <vector>
//-------------------------------------//
#define faster               ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define ROF(x, y)            for(int i=int(x)-1; i>=int(y); i--)
#define FOR(x, y)            for(int i=int(x); i<int(y); i++)
#define test                 int t; cin >>t; while(t--)
#define strsort(s)           sort(s.begin(), s.end());
#define eofstr               string s; while(cin >>s)
#define cs(i)                printf("Case %d: ", i);
#define eof                  long long int n; while(cin>>n)
#define Y                    cout <<"YES" <<endl;
#define N                    cout <<"NO" <<endl;
#define noo                  cout <<"-1" <<endl;
#define pi a                 cos(-1)
#define cube(x)              (x*x*x)
#define sqr(x)               (x*x)
#include <algorithm>
//-------------------------------------//
typedef unsigned long long   ull;
typedef long long int        lld;
typedef long double          ld;
using namespace std;

//----<<some short ninja function>>----//
//sort(arr, arr+n, greater<int>());
//get line(c i n, s t r);
//*max_element(x, x+n);
//string_stream any_name(s); (string->int)
//-------------------------------------//

lld i, j, f;

int main()
{
    int n;
    cin >>n;
    int a[n], b[n];

    for(i=0; i<n; i++)
    {
        cin >>a[i] >>b[i];
    }
    int c=0;
    f=0;
    for(i=0; i<n; i++)
    {
        if(c==3)
        {
            f=1;
            break;
        }
        if(a[i]==b[i])
        {
            c++;
        }
        else
        {
            c=0;
        }
    }
    if(c==3)
    {
        f=1;
    }
    if(f==1)
    {
        cout <<"Yes" <<endl;
    }
    else if(f==0)
    {
        cout <<"No" <<endl;
    }
    return 0;
}


Measured memory_bytes: 3668
#include <iostream>
#define INF 1000000100
#define E 500010
#define V 100100

using namespace std;
int main(){
  int v, e, r, i, j, s[E], t[E], d[E], c[V];
  cin >> v >> e >> r;
  for (i = 0; i < e; ++i){
    cin >> s[i] >> t[i] >> d[i];
  }
  
  // initializing the cost array
  for (i = 0; i < V; ++i){
    c[i] = INF;
  }
  c[r] = 0;

  // the reason why v-1 is big enough for this loop:
  //  longest path would be length of v-1
  //  for each i, cost btw(i-1, i) gets shorter/equal
  for (i = 0; i < v; ++i){
    bool updated = false;
    for (j = 0; j < e; ++j){
      int start = s[j], goal = t[j], distance = d[j];
      if(c[start] < INF && c[start]+d[j]<c[goal]){
        c[goal] = c[start]+d[j];
        updated = true;
      }
    }
    if(!updated) break;
  }
  for (i = 0; i < v; ++i){
    if(c[i] == INF){
      cout << "INF" << endl;
    }else{
      cout << c[i] << endl;
    }
  }
}

Measured memory_bytes: 7408
#include<algorithm>
#include<iostream>
#include<vector>
#include<string>
#include<cstring>
#include<utility>
#include<queue>
#include<cmath>
using namespace std;
#define REP(i, a,b) for(i=a;i<b;i++) 
#define REP1(i,b,a) for(i=b-1;i>=a;i--)
#define output(x) cout<<x<<endl;
#define pb(x) push_back(x);
typedef long long int ll;
const int MAX = 510000;
const int MOD = 1000000007;
ll gcd(ll a, ll b) {
	if (b == 0) {
		return a;
	}
	return gcd(b, a % b);
}
ll  lcm(ll a, ll b) {
	if (b == 0) {
		return 0;
	}
	return a*b/gcd(a,b);
}


int main() {
	ll i, j, k, l, m, n, sum, flag, cc,N,M;
	sum = 0;
	flag = 0;
	cin >> N >> M;
	char S[100001];
	char T[100001];
	cin >> S >> T;
	k = gcd(N, M);
	l = lcm(N, M);
	for (i = 0; i < k; i++) {
		if (S[i*N / k] != T[i*M / k]) {
			output("-1");
			return 0;
		}
	}
	output(l);
	return 0;

	return 0;
}

Measured memory_bytes: 384
//https://qiita.com/tanakh
#[allow(unused_macros)]
macro_rules! input {
	(source = $s:expr, $($r:tt)*) => {
		let mut iter = $s.split_whitespace();
		let mut next = || { iter.next().unwrap() }; 
		input_inner!{next, $($r)*}
	};
	($($r:tt)*) => {

		let stdin = std::io::stdin();
		let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock())); 
		let mut next = move || -> String{
			bytes
				.by_ref()
				.map(|r|r.unwrap() as char) 
				.skip_while(|c|c.is_whitespace()) 
				.take_while(|c|!c.is_whitespace()) 
				.collect()
			};
	input_inner!{next, $($r)*} 
	};
}

#[allow(unused_macros)]
macro_rules! input_inner { 
	($next:expr) => {}; 
	($next:expr, ) => {};

	($next:expr, $var:ident : $t:tt $($r:tt)*) => { 
		let $var = read_value!($next, $t); 
		input_inner!{$next $($r)*}
	}; 
}
#[allow(unused_macros)]
macro_rules! read_value { 
	($next:expr, ( $($t:tt),* )) => {
		( $(read_value!($next, $t)),* ) 
	};
	
	($next:expr, [ $t:tt ; $len:expr ]) => {
		(0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
	};

	($next:expr, chars) => {
		read_value!($next, String).chars().collect::<Vec<char>>()
	};
	
	($next:expr, bytes) => {
		read_value!($next, String).into_bytes()
	};
	
	($next:expr, usize1) => { 
		read_value!($next, usize) - 1
	};

	($next:expr, $t:ty) => {
		$next().parse::<$t>().expect("Parse error")
	};
}

fn main(){
	input!{
		a : i64,
		b : i64,
		c : i64,
		x : i64,
	}
	let mut ans : i64 = 0;
	for i in 0..a+1 {
		for j in 0..b+1 {
			for k in 0..c+1 {
				if i * 500 + j * 100 + k * 50 == x{
					ans = ans + 1;
				}
			}
		}
	}
	println!("{}",ans);
}

Measured memory_bytes: 4352
let rec judge a b c acc =
    if a % 2 = 1 || b % 2 = 1 || c % 2 = 1
    then acc
    elif a = b && b = c
    then -1
    else judge ((b + c) / 2) ((c + a) / 2) ((a + b) / 2) (acc + 1)

//let input = [| [| 4; 12; 20 |]; [| 14; 14; 14 |]; [| 454; 414; 444 |] |]
//for i in input do (judge i.[0] i.[1] i.[2] 0 |> printfn "%d")
// expected 3; -1; 1
[<EntryPoint>]
let main argv =
    stdin.ReadLine().Split()
    |> Array.map int
    |> fun x -> judge x.[0] x.[1] x.[2] 0
    |> printfn "%d"
    0


Measured memory_bytes: 29868
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace A
{
    public class Program

    {
        public static void Main(string[] args)
        {
            int[] items = RIntAr();

            foreach (var item in GetPermutation(items, 4))
            {
                if (string.Join("", item.Select(x => x.ToString())) == "1974")
                {
                    Console.WriteLine("YES");
                    return;
                }
            }
            Console.WriteLine("NO");
        }

        /// <summary>
        /// 配列の順列を列挙する
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="items">配列</param>
        /// <param name="r">取得数</param>
        /// <returns>配列の組み合わせの列挙</returns>
        public static IEnumerable<IEnumerable<T>> GetPermutation<T>(IEnumerable<T> items, int r)
        {
            if (r == 0)
            {
                yield return Enumerable.Empty<T>();
            }
            else
            {
                foreach (var x in items)
                {
                    var xs = items.Where(y => !y.Equals(x));
                    foreach (var c in GetPermutation(xs, r - 1)) yield return Concat(x, c);
                }
            }
        }

        public static IEnumerable<T> Concat<T>(T first, IEnumerable<T> items)
        {
            yield return first;
            foreach (var i in items) yield return i;
        }
        static string RSt() { return Console.ReadLine(); }
        static int RInt() { return int.Parse(Console.ReadLine().Trim()); }
        static long RLong() { return long.Parse(Console.ReadLine().Trim()); }
        static double RDouble() { return double.Parse(Console.ReadLine()); }
        static string[] RStAr(char sep = ' ') { return Console.ReadLine().Trim().Split(sep); }
        static int[] RIntAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => int.Parse(e)); }
        static long[] RLongAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => long.Parse(e)); }
        static double[] RDoubleAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => double.Parse(e)); }
        static string WAr<T>(IEnumerable<T> array, string sep = " ") { return string.Join(sep, array.Select(x => x.ToString()).ToArray()); }
    }

}


Measured memory_bytes: 13524
import java.util.*;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n;
		n = sc.nextInt();
		
		ArrayList<Integer> a = new ArrayList<Integer>();
		int c;
		
		for(int i = 0; i < n; i++){
			c = sc.nextInt();
			a.add(c);
		}
		Collections.sort(a);
		Collections.reverse(a);

		int x = 0;
		int y = 0;
		
		for(int i = 0; i < n; i++){
			if((i+1) % 2 != 0){
				x = x + a.get(i);
			}else{
				y = y + a.get(i);
			}
		}
		int ans = x - y;
		System.out.println(ans);
	}
}


Measured memory_bytes: 21716
#include<iostream>
#include<cstdio>
using namespace std;
#define mod 1000000007
#define LL long long

LL n,m;

int main()
{
    while(~scanf("%lld %lld",&n,&m))
    {
        LL sum=0;
        LL t=m/2;
        sum=min(n,t);
        m-=sum*2;
        if(m<=0)
        {
            printf("%lld\n",sum);
            continue;
        }
        sum+=m/4;
        printf("%lld\n",sum);
    }
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <unordered_map>
#include <queue>
#include <algorithm>

#include <bits/stdc++.h>
#include <cmath>
#include <limits>

using namespace std;


void dfs(vector<int> v, long long &c){
	if(v.size() == 0) return;
	if(v.size() == 1){
		c += v[0];
		return;
	}

	int ezero = 0;
	for(int i=0; i<v.size(); i++){
		if(v[i] == 0){
			ezero = 1;
			break;
		}
	}

	vector<int> w;
	if(ezero == 0){
		c++;
		for(int i=0; i<v.size(); i++){
			w.push_back(v[i] - 1);
		}
		dfs(w, c);
		return;
	}
	for(int i=0; i<v.size(); i++){
		if(v[i] != 0){
			w.push_back(v[i]);
			if(i == v.size() - 1){
				dfs(w, c);
				w.clear();
			}
		}
		else if(v[i] == 0){
			dfs(w, c);
			w.clear();
		}
	}
}

int main(int argc, char* argv[]){
	cin.tie(0);
	ios::sync_with_stdio(false);

	int N;
	vector<int> H;

	cin >> N;
	for(int i=0; i<N; i++){
		int  h;
		cin >> h;
		H.push_back(h);
	}
	long long ans = 0;
	dfs(H, ans);
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 384
#define _CRT_SECURE_NO_WARNINGS

#include<iostream>
#include<string>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<map>
#include<tuple>
#include<algorithm>
#include<numeric>
#include<math.h>

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

using namespace std;

using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;

const int mod = 1e9 + 7;
const long double pi = 3.141592653589793238462643383279502884197;
const long double eps = 1e-7;

int main() {
	int A, B, C, D;
	cin >> A >> B >> C >> D;
	int diff = A + B - C - D;
	
	if (diff == 0) cout << "Balanced";
	else if (diff > 0) cout << "Left";
	else cout << "Right";

	system("pause");
	return 0;
}

Measured memory_bytes: 504
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>

using namespace std;

typedef long long int ll;
typedef pair<ll, ll> P;
#define INF 10000000000000
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define rep1(i, n) for(ll i = 1; i < (ll)(n); i++)
#define repN_1(i, n) for(ll i = 0; i < (ll)(n - 1); i++)
#define repM(i, n) for(ll i = (ll)(n - 1); i >= 0; i--)
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }

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

	ll sx, sy, tx, ty;
	string ans;

	cin >> sx >> sy >> tx >> ty;

	rep(i, ty - sy)
		ans += 'U';
	rep(i, tx - sx)
		ans += 'R';
	
	rep(i, ty - sy)
		ans += 'D';
	rep(i, tx - sx)
		ans += 'L';
	
	ans += 'L';
	rep(i, ty - sy + 1)
		ans += 'U';
	rep(i, tx - sx + 1)
		ans += 'R';
	ans += 'D';

	ans += 'R';
	rep(i, ty - sy + 1)
		ans += 'D';
	rep(i, tx - sx + 1)
		ans += 'L';
	ans += 'U';

	cout << ans << endl;



	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
using P = pair<int,int>;
/* ちゃんと考えてわかって実装 */

int main(void){
    ll a, b, n;
    cin >> a >> b >> n;
    cout << min(a*n/b, a*(b-1)/b);
    return 0;
}

Measured memory_bytes: 3592
#include<iostream>

using namespace std;

int count(string S, char x){
  int num=0;
  
  for(int i = 0 ; i < 3 ; i++){
    if(S[i]== x) num++;
  }
  return num;
}

int main(){
  string S;
  cin >> S;
  
  if(count(S,'a')==1 && count(S,'b')==1 && count(S,'c')==1) cout << "Yes" << endl;
  else cout << "No" << endl;
  
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
#define ll long long
#define pb push_back
#define mp make_pair
#define all(X) (X).begin(), (X).end()
 
#define cmp_all(X) (X).begin(), (X).end(), cmp
 
#define B begin()
#define E end()
#define sz size()
#define skip continue
 
#define ppi pair<pair<int, int>, int>
#define pii pair<int, int> 
#define pli pair<ll, int>
 
#define F first
#define S second
 
using namespace std;
 
const int maxn = 1e7 + 17;
const int MAXN = maxn * 4;
const int darr = 1e3 + 17;
const ll INF = 1e17 + 5;
const int mod = 1e9 + 7;
 
void Need_For_Speed () {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
}

int n, res;
int a[maxn];

int main () {
	Need_For_Speed();
	cin >> n;
	for (int i = 1; i <= n + n; i++) {
		cin >> a[i];
	}
	sort(a + 1, a + n + n + 1);
	for (int i = 2; i <= n + n; i += 2) {
		res += min(a[i], a[i-1]);
	}
	cout << res;
    return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#include <iostream>
#include <iomanip>
#include <istream>
#include <ostream>
#include <sstream>
#include <iterator>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <utility>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <ctime>
#include <cctype>
#include <cstdlib>
#define IINF 10e8
#define INF 1<<30
#define MOD 1000000007
#define mod 1000000007
#define rep(i, a, n) for (ll i = a; i < (ll)(n); i++)
#define Endl endl
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define mmax(x,y)(x>y?x:y)
#define mmin(x,y)(x<y?x:y)
#define chmax(x,y) x=mmax(x,y)
#define chmin(x,y) x=mmin(x,y)
#define all(x) (x).begin(),(x).end()
#define siz(x) (ll)(x).size()
#define PI acos(-1.0)
using namespace std;
//using Int=int_fast64_t;
typedef long long int ll;
typedef long long int LL;
typedef pair<ll,ll>Pll;
typedef pair<int,int>Pin;
template<class T> using V=vector<T>;
long long GCD(long long a, long long b) { return b ? GCD(b, a%b) : a; }
long long LCM(long long a, long long b)  {return a/GCD(a,b)*b;}
int dx[4]={-1,0,1,0};
int dy[4]={0,-1,0,1};
int ddx[8]={-1,0,1,0,1,1,-1,-1};
int ddy[8]={0,-1,0,1,1,-1,1,-1};
char dir[4]={'u','l','d','r'};
ll cmp(pair<ll,ll>a,pair<ll,ll> b){
        if(a.se!=b.se)
        return a.se<b.se;
        else
        return a.fi<b.fi;
}
//---------------------------------------------------------------------------

//---------------------------------------------------------------------------
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    //-------------------------------
    int n;cin>>n;
    ll x;cin>>x;
    V<ll>a(n);
    for(ll i=0;i<n;i++)cin>>a[i];
    sort(all(a));
    int ans=0;
    for(ll i=0;i<n;i++){
        if(x>=a[i]){
            x-=a[i];
            ans++;
            if(i==n-1&&x!=0)ans--;
        }
        else break;
    }
    cout<<ans<<endl;
    //-------------------------------
    return 0;
}
//---------------------------------------------------------------------------


Measured memory_bytes: 256
#include <iostream>

using namespace std;

const int MAX_N = 1e5 + 5;

int A [MAX_N];
int B [MAX_N];

int main () {
  ios::sync_with_stdio(false);

  int a, b, m;
  cin >> a >> b >> m;

  int am = MAX_N;
  for (int i = 1; i <= a; i++) {
    cin >> A[i];
    am = min(am, A[i]);
  }

  int bm = MAX_N;
  for (int i = 1; i <= b; i++) {
    cin >> B[i];
    bm = min(bm, B[i]);
  }

  int ans = am + bm;
  for (int i = 0; i < m; i++) {
    int x, y, c;
    cin >> x >> y >> c;

    ans = min(ans, A[x] + B[y] - c);
  }

  cout << ans << endl;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
#define repd(i, n) for (ll i = (ll)(n)-1; i >= 0; i--)
const ll INF = 1LL << 60;
const int INF32 = 1 << 29;
const ll MOD = 1000000007;
using Graph = vector<vector<int>>; // グラフ型
using pint = pair<int, int>;

int main()
{
    int N;
    cin >> N;
    rep(i, 50001)
    {
        if (i * 108 / 100 == N)
        {
            cout << i << endl;
            return 0;
        }
    }
    cout << ":(" << endl;
}

Measured memory_bytes: 256
N = int(input())
S = []
for i in range(N):
    S.append(int(input()))

total = sum(S)

if total%10 == 0:
    
    new_S = []
    for s in S:
        if s%10==0:
            new_S.append(101)
        else:
            new_S.append(s)
    
        if sum(new_S) == 101*len(S):
            min_s = total
        else:
            min_s = min(new_S)
    
    print(total-min_s)
else:
    print(total)

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

int main(){
    int key,i,j,N,A[100];
    
    cin >> N;
    for(i=0;i<N;i++) cin >> A[i];

    for(i=0;i<N;i++){ 
        if (i>0) cout << " ";
        cout << A[i];
    }
    cout << endl;

    for(i=1;i<N;i++){
        key = A[i];
        j = i - 1;
        while (j>=0 && A[j]>key){
            A[j+1] = A[j];
            j--;
        }
        A[j+1] = key;
        for (int k=0;k<N;k++){
        if (k>0) cout << " ";
        cout << A[k];
        }
        cout << endl;
    }
    return 0;
}


Measured memory_bytes: 3100
#include <iostream>
#include <string>
#include <utility>
#include <stack>
#include <vector>
#include <queue>
#include <algorithm>
#include <map>
#include <climits>
#include <set>
using namespace std;

const long long MOD = 1000000007;
long long dp[100001];
bool broken[100001];
int main(){
    int N;
    int M;
    cin >> N >> M;
    for(int i = 0; i < M; i++){
        int a;
        cin >> a;
        broken[a] = true;
    }

    dp[0] = 1;
    for(int i = 1; i <= N; i++){
        if(!broken[i - 1]){
            dp[i] = (dp[i] + dp[i - 1]) % MOD;
        }
        if(i - 2 >= 0 && !broken[i - 2]){
            dp[i] = (dp[i] + dp[i - 2]) % MOD;
        }
    }
    cout << dp[N] << endl;
    return 0;
}


Measured memory_bytes: 1152
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#define _USE_MATH_DEFINES
#include <math.h>
#include <iomanip>
#include <stdio.h>
#include <numeric>
#include <cmath>
#include <limits>
#include <bitset> 
#include <iterator> 
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include<deque>
#include <regex>
#include <list>
#include <unordered_set>
#define rep(i,n) for(ll i=0;i<(n); ++i)
#define per(i,n) for(ll i=n-1;i>=0; --i)
#define all(x) (x).begin(),(x).end()
#define _GLIBCXX_DEBUG
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
typedef long long ll;
const ll MOD = 1000000007;
ll getDigit(ll n) {
	ll cnt = 0;
	while (n != 0) {
		n /= 10;
		cnt++;
	}
	return cnt;
}
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}
typedef pair<double, long long> pair_t;
bool comp(const pair_t& a, const pair_t& b) {
	if (a.first == b.first)return  a.second > b.second;
	else {
		return a.first > b.first;
	}
}

int main() {
	vector<ll>dp(pow(10, 7),INF);
	ll n,k;
	cin >> n >> k;
	vector <ll>h(n);
	rep(i, n)cin >> h[i];
	dp[0] = 0;
	for (ll i = 0; i < n; i++) {
		for (ll m = 1; m <= k; m++) {
			if(i-m >= 0)chmin(dp[i], dp[i - m] + abs(h[i] - h[i - m]));
		}
	}
	cout << dp[n-1] << endl;
}


Measured memory_bytes: 79104
#include <iostream>

using namespace std;

int main(){
    int a, b, c, d, e, k;
    
    cin >> a;
    cin >> b;
    cin >> c;
    cin >> d;
    cin >> e;
    cin >> k;
    
    if((e-a) > k){
        cout << ":(" <<endl;
    }else{
        if((d-a) > k){
            cout << ":(" <<endl;
        }else{
            if((c-a) > k){
                cout << ":(" <<endl;
            }else{
                if((b-a) > k){
                    cout << ":(" <<endl;
                }else{
                    cout << "Yay!" <<endl;
                }
            }
        }
    }


    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define LOCAL
using namespace std;
template <typename A, typename B>
ostream& operator <<(ostream& out, const pair<A, B>& a) {
out << "(" << a.first << "," << a.second << ")";
return out;
}
template <typename T, size_t N>
ostream& operator <<(ostream& out, const array<T, N>& a) {
out << "["; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T>
ostream& operator <<(ostream& out, const vector<T>& a) {
out << "["; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T, class Cmp>
ostream& operator <<(ostream& out, const set<T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "}";
return out;
}
template <typename U, typename T, class Cmp>
ostream& operator <<(ostream& out, const map<U, T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& p : a) { out << (first ? "" : ", "); out << p.first << ":" << p.second; first = 0;} out << "}";
return out;
}
#ifdef LOCAL
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
#else
#define trace(...) 42
#endif
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
const char* comma = strchr(names + 1, ',');
cerr.write(names, comma - names) << ": " << arg1 << " |";
__f(comma + 1, args...);
}
#define rep(i,n) for(int i=0; i<(n); i++)
using ll = long long;
#define int long long
using P = pair<int,int>;
//#########################################
signed main(){
	int n;cin >> n;
	set<int> st;
	rep(i,n){
		int a;cin >> a;
		st.insert(a);
	}
	cout << st.size() << endl;
	return 0;
}

Measured memory_bytes: 3648
#include<iostream>
#include<cstdio>

#define MAXN 200

using namespace std;

bool func(int N, int *in, int ch);

void cha(int *in1, int in[][3], int N, int j);

int main(void)
{
	//freopen("C:\\Users\\h2539\\Desktop\\in.txt","r",stdin);
	//freopen("C:\\Users\\h2539\\Desktop\\out.txt","w",stdout);

	int N = 0, in[MAXN][3] = {0}, out[MAXN] = {0};

	cin >> N;

	for(int i = 0; i < N; i++)
	{
		for(int j = 0; j < 3; j++)
		{
			cin >> in[i][j];
		}
	}

	int in1[MAXN] = {0};

	for(int j = 0; j < 3; j++)
	{
		cha(in1, in, N, j);

		for(int i = 0; i < N; i++)
		{
			if(func(N, in1, in[i][j]))
			{
				out[i] += in[i][j];	
			}
		}
	}

	for(int i = 0; i < N; i++)
	{
		cout << out[i] << endl;
	}

	return false;
}

bool func(int N, int *in, int ch)
{
	bool flag = false;

	for(int i = 0; i < N; i++)
	{
		if(ch == in[i])
		{
			if(!flag)
			{
				flag = true;
			}
			else 
			{
				return false;
			}
		}
	}

	return true;
}

void cha(int *in1, int in[][3], int N, int j)
{
	for(int i = 0; i < N; i++)
	{
		in1[i] = in[i][j];
	}
}

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

using namespace std;

using ll = long long;
using ld = long double;

using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vs = vector<string>;
using vld = vector<ld>;
using vvld = vector<vld>;

typedef pair<ll, ll> P;

#define bit(n) (1LL << (n))

//#define int long long

#define all(v) v.begin(), v.end()

#define rep(i, n) for (ll i = 0; i < n; i++)
#define REP(i, n) for (ll i = 1; i < n; i++)

#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define FORm(i, m) for (auto i = m.begin(); i != m.end(); i++)

template <class T>
inline void chmax(T& a, T b) {
  a = std::max(a, b);
}
template <class T>
inline void chmin(T& a, T b) {
  a = std::min(a, b);
}

#define mod (ll)(1e9 + 7)
// #define mod (998244353ll)

const long long INF = 1LL << 60;

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(20);

  ll n;
  cin >> n;
  vll v(n);
  rep(i, n) {
    cin >> v[i];
  }

  map<ll, ll> odd, even;
  rep(i, n) {
    if (i % 2 == 0) {
      odd[v[i]]++;
    } else {
      even[v[i]]++;
    }
  }

  ll k = n / 2;
  ll ans = 0;

  priority_queue<P> oq, eq;

  for (auto it : odd) {
    oq.emplace(it.second, it.first);
  }
  oq.emplace(0, -1);

  for (auto it : even) {
    eq.emplace(it.second, it.first);
  }
  eq.emplace(0, -1);

  if (oq.top().second != eq.top().second) {
    ans = n - (oq.top().first + eq.top().first);
  } else {
    ll ot, et;
    ot = oq.top().first;
    et = eq.top().first;
    oq.pop();
    eq.pop();
    ans = n - (ot + eq.top().first);
    chmin(ans, n - (et + oq.top().first));
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 9592
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 1e3 + 5;
const int mod = 1e9 + 7;
int l;
char s[N];
ll k,ans;
int main()
{
    scanf("%s%lld", s, &k);
    l = strlen(s);
    if (s[0] != s[l - 1])
    {
        ll tmp = 0;
        for (int i = 1; i < l; ++i)
        {
            if (s[i] == s[i - 1])
            {
                ++tmp;
                s[i] = '0';
            }
        }
        printf("%lld\n", k * tmp);
        return 0;
    }
    int st = 0,ed = l - 1;
    for (int i = 1; i < l; ++i)
        if (s[i] == s[0])
            ++st;
        else
            break;
    for (int i = ed - 1; i >= 0; --i)
        if (s[i] == s[l - 1])
            --ed;
        else
            break;
    if (ed == 0)
    {
        ans = k * (ll)l;
        printf("%lld\n", ans / (ll)2);
        return 0;
    }
    ans = (st + 1) / 2;
    ans += (l - ed) / 2;
    ans += (k - 1) * ((st + 1 + l - ed) / (ll)2);
    for (int i = st + 1; i < ed; ++i)
        if (s[i] == s[i - 1])
        {
            ans += k;
            s[i] = '0';
        }
    printf("%lld\n", ans);
    return 0;
}

Measured memory_bytes: 256
let s = read_line ()

let rec solve s ls = 
  let len = String.length s in
  if len = 0 then List.rev ls 
  else
    let sub = (String.sub s 1 (len - 1)) in
    match s.[0] with
    | '0' | '1' -> solve sub (s.[0] :: ls)
    | _ -> solve sub (try List.tl ls with _ -> [])  

let () = List.iter print_char (solve s []) ; print_newline ()

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

int stoi(string str) {
	int ret;
	ret = int(str[1])-48;
 	return ret;
}
string ynstable(int n, string *org, string *a) {
	for (int i = 0; i < n - 1; i++)
		for (int j = i + 1; j < n; j++)
			for (int k = 0; k < n - 1; k++)
				for (int l = k + 1; l < n; l++)
					if ((stoi(org[i]) == stoi(org[j])) && (org[i] == a[l]) && (org[j] == a[k]))
						return "Not stable";
	return "Stable";
}
int main() {
	int n, min;
	string tmp;
	cin >> n;
	string *org = new string[n];
	string *a = new string[n];
	
	for (int i = 0; i < n; i++)
		cin >> org[i];
	for (int i = 0; i < n; i++)
		a[i] = org[i];
	for (int i = 0; i < n -1; i++)
		for(int j = n - 1; j > i; j--)
			if (stoi(a[j]) < stoi(a[j - 1])) {
				tmp = a[j];
				a[j] = a[j - 1];
				a[j - 1] = tmp;
			}
	for (int i = 0; i < n - 1; i++)
		cout << a[i] << ' ';
	cout << a[n - 1] << endl;
	cout << ynstable(n, org, a) << endl;
	for (int i = 0; i < n; i++)
		a[i] = org[i];
	for (int i = 0; i < n -1; i++) {
		min = i;
		for (int j = i + 1; j < n ; j++) {
			if (stoi(a[j]) < stoi(a[min]))
				min = j;
		}
		if (min != i) {
			tmp = a[i];
			a[i] = a[min];
			a[min] = tmp;
		}
	}
	for (int i = 0; i < n - 1; i++)
		cout << (a[i]) << ' ';
	cout << (a[n - 1]) << endl;
	cout << ynstable(n, org, a) << endl;

	return 0;
}

Measured memory_bytes: 3220
#数列が与えられたら漸化式を作る
#a1 = 7, ai = 10 * a(i - 1) + 7 (i >= 2)
K = int(input())
a = [7 % K] #a1 mod K
for i in range(K - 1): #a2 - aK
  a.append((10 * a[i] + 7) % K) #mod K
for i in range(K):
  if a[i] == 0:
    print(i + 1)
    break
else: print(-1)

Measured memory_bytes: 48400
#include <algorithm>
#include <bitset>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <tuple>
#include <vector>

using namespace std;

#define rep(i, n) for (int64_t i = 0; i < (int64_t)(n); i++)
#define irep(i, n) for (int64_t i = 0; i <= (int64_t)(n); i++)
#define rrep(i, n) for (int64_t i = (n)-1; i >= 0; i--)
#define rirep(i, n) for (int64_t i = n; i >= 0; i--)

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

  vector<vector<int64_t>> dp(N + 1, vector<int64_t>(2, 0));
  dp[0][0] = 1;
  rep(i, N) {
    int a;
    cin >> a;
    rep(j, 2) {
      dp[i + 1][j] += dp[i][j];
      dp[i + 1][(j + a) % 2] += dp[i][j];
    }
  }
  cout << dp[N][P] << endl;

  return 0;
}

Measured memory_bytes: 3580
#include <bits/stdc++.h>
using namespace std;
#define rep(i,c) for(int i=0;i<c;++i)
int main(){
 int a,b;
 cin >> a>>b ;
 if(a+b<24){
     cout << a+b << endl;
 }else{
     cout << (a+b)-24 << endl;
 }
return 0;
}

Measured memory_bytes: 256
N = int(input())
A = [int(i) for i in input().split()]

flag = True

count = 0
while flag:
    flag = False
    for i in range(1, N):
        if A[i] < A[i - 1]:
            A[i], A[i - 1] = A[i - 1], A[i]
            flag = True
            count += 1

for i in range(N):
    print(A[i], end='')
    if i != N - 1:
        print(' ', end='')
print('')

print(count)



Measured memory_bytes: 5624
N, K = map(int, input().split())
A = list(map(int, input().split()))

# にぶたん: 答えをx以下にできるか？
ok, ng = 10 ** 9 + 1, 0
while abs(ok - ng) > 1:
    x = (ok + ng) // 2
    cnt = 0

    for a in A:
        if a <= x:
            continue

        cnt += a // x
        if cnt > K:
            ng = x
            break
    else:
        ok = x

print(ok)


Measured memory_bytes: 93940
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <iostream>
#include <cmath>
#include <ctime>
#include <cstring>
#define ll long long
#define INF 1000000000
#define For(i,a,b) for(int i=a;i<=b;++i)
#define Rev(i,a,b) for(int i=a;i>=b;--i)
#define pb push_back
#define pq priority_queue
#define PI acos(-1)

namespace IO
{
#define p(x) ('0'<=x&&x<='9')
	char cc; int C;
	template <class T>
	void read( T &x )
	{
		x=0; cc=getchar(); C=1;
		while(!p(cc)) { if(cc=='-') C=-1; cc=getchar(); }
		while(p(cc)) { x=x*10+cc-48; cc=getchar(); }
		x*=C;
	}
#undef p
}

using namespace IO;
using namespace std;

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	srand(time(0));
#ifdef LOCAL
	freopen("./tmp/input.txt", "r", stdin);
#endif
	int N,k;
	int half,cur;

	read(N);
	read(k);
	cur=N/k;
	ll ans=1LL*cur*cur*cur;
	if((k&1)==0)
	{
		if(N%k>=(k>>1)) ++cur;
		ans+=1LL*cur*cur*cur;
	}
	printf("%lld",ans);

	return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cstdio>
#include <functional>
#include <initializer_list>
#include <iostream>
#include <limits.h>
#include <list>
#include <map>
#include <math.h>
#include <queue>
#include <regex>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
#define REP(i, a, n) for (int i = (a); i < (int)(n); ++i)
#define REPC(i, a, n) for (int i = (a); i <= (int)(n); ++i)
#define ALL(t) t.begin(), t.end()
#define RALL(t) t.rbegin(), t.rend()
#define Yes(cond) cout << (cond ? "Yes" : "No") << endl;
#define YES(cond) cout << (cond ? "YES" : "NO") << endl;
using namespace std;
using LL = long long;
using ULL = unsigned long long;
template <class T>
using VEC = std::vector<T>;
template <class T>
using MAT = std::vector<std::vector<T>>;
void DUMP() { cerr << endl; }
template <class Head, class... Tail>
void DUMP(Head &&head, Tail &&... tail)
{
  cerr << head << ", ";
  DUMP(std::move(tail)...);
}
template <typename T>
ostream &operator<<(ostream &os, vector<T> &vec)
{
  os << "{";
  for (auto v : vec)
    os << v << ",";
  os << "}";
  return os;
}

int main()
{
  int n, m;
  cin >> n >> m;
  VEC<VEC<char>> a(n, VEC<char>(n)), b(m, VEC<char>(m));
  REP(i, 0, n)
  REP(j, 0, n)
  {
    cin >> a[i][j];
  }
  REP(i, 0, m)
  REP(j, 0, m)
  {
    cin >> b[i][j];
  }
  REP(x, 0, n)
  {
    REP(y, 0, n)
    {
      bool all = 1;
      REP(mx, 0, m)
      {
        REP(my, 0, m)
        {
          if (x + mx >= n || y + my >= n || a[x + mx][y + my] != b[mx][my])
          {
            all = false;
            break;
          }
        }
        if (!all)
          break;
      }
      if (all)
      {
        cout << "Yes" << endl;
        return 0;
      }
    }
  }
  cout << "No" << endl;

  return 0;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include "bits/stdc++.h"
using namespace std;
#define FOR(i,j,k) for(int (i)=(j);(i)<(int)(k);++(i))
#define rep(i,j) FOR(i,0,j)
#define each(x,y) for(auto &(x):(y))
#define mp make_pair
#define MT make_tuple
#define all(x) (x).begin(),(x).end()
#define debug(x) cout<<#x<<": "<<(x)<<endl
#define smax(x,y) (x)=max((x),(y))
#define smin(x,y) (x)=min((x),(y))
#define MEM(x,y) memset((x),(y),sizeof (x))
#define sz(x) (int)(x).size()
#define RT return
#define vv(a,b,c,d) vector<vector<a> >(b,vector<a>(c,d))
#define vvv(a,b,c,d,e) vector<vector<vector<a> > >(b,vv(a,c,d,e))
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vll = vector<ll>;

// 2<=N<=10^5
// A[i]
// |A[i]-A[j]|円

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(20);

    int N;
    cin >> N;
    vi A(N+2);
    rep(i, N)cin >> A[i + 1];
    ll sm = 0;
    rep(i, N + 1) {
        sm += abs(A[i + 1] - A[i]);
    }

    for (int i = 1; i <= N; ++i) {
        ll ans = sm - abs(A[i - 1] - A[i]) - abs(A[i + 1] - A[i]) + abs(A[i - 1] - A[i + 1]);
        cout << ans << endl;
    }
}

Measured memory_bytes: 1664
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
	public static void main(String[] arges) {

		Scanner sc = new Scanner(System.in);
		List<Integer> klist = new ArrayList<Integer>();
		List<String> vlist = new ArrayList<String>();
		int count = 1;
		while (true) {
			
			String line = sc.nextLine();

			if (count % 2 != 0) {
				klist.add(Integer.parseInt(line));
				if (line.equals("0")) {
					break;
				}
			} else {
				vlist.add(line);
			}
			count++;
		}
		int i = 0;
		for (Integer in : klist) {
			if (in == 0) {
				break;
			}

			Double[] on = new Double[in];
			String vlistst = vlist.get(i);
			String[] hu = vlistst.split(" ");
			for (int j = 0; j < on.length; j++) {
				on[j] = Double.parseDouble(hu[j]);
			}
			Double ave = 0.0;
			for (int j = 0; j < on.length; j++) {
				ave += on[j];
			}
			ave = ave / in;
			for (int j = 0; j < on.length; j++) {
				on[j] -=  ave;
				on[j] = Math.pow(on[j], 2);
			}
			Double sum = 0.0;
			for (int j = 0; j < on.length; j++) {
				sum += on[j];
			}
			BigDecimal big = new BigDecimal(Math.sqrt(sum / in));
			big.setScale(6, BigDecimal.ROUND_DOWN);
			System.out.println(big);
			i++;
		}

	}
}

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

int main(){
  int N;
  cin >> N;
  int d = 1;
  int count = 0;
  while(N >= d){
    d*=2;
    count++;
  }
  count--;
  int a=1;
  for(int i=0;i<count;i++){
    a*=2;
  }
  cout << a << endl;
}
    


Measured memory_bytes: 256
import std.algorithm;
import std.array;
import std.container;
import std.conv;
import std.math;
import std.numeric;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

void scan(T...)(ref T a) {
    string[] ss = readln.split;
    foreach (i, t; T) a[i] = ss[i].to!t;
}
T read(T)() { return readln.chomp.to!T; }
T[] reads(T)() { return readln.split.to!(T[]); }
alias readint = read!int;
alias readints = reads!int;

bool calc(int[] a) {
    if (a.all!"a == 0") return true;

    if (a.length % 3 == 0) {
        a.sort();
        auto p = a.length / 3;
        // a に含まれるのは 3 種類のみ
        if (a[0] == a[p-1] && a[p] == a[2*p-1] && a[2*p] == a[3*p-1]) {
            // 3 種類を xor するとゼロになる
            if ((a[0] ^ a[p] ^ a[2*p]) == 0) {
                return true;
            }
        }
    }
    return false;
}

void main() {
    readint;
    auto a = readints;
    writeln(calc(a) ? "Yes" : "No");
}


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

#define ll long long
#define ld long double
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define eb emplace_back
//#define gcd __gcd
//#define lcm(a, b) ((a) * (b) / gcd((a), b))
#define all(x) x.begin(), x.end()
#define rep(i, x, n) for (ll i = x; i < n; i++)
#define fastio() ios_base::sync_with_stdio(NULL); cin.tie(0); cout.tie(0)
#define endl '\n'

typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef pair<int, int> ii;
typedef vector<pair<int, int> > vii;

template <class T> inline T RD(T &a) {T x; cin >> x; return a = x;}

//OJ freopen Template

const float pi = acos(-1);

signed main()
{
	fastio();

	int n, x; cin >> n;

	vector<int> a(n + 10);
	for (int i = 1; i < n; i++) {
        cin >> x;
        a[x]++;
	}

	for (int i = 1; i <= n; i++) {
        cout << a[i] << '\n';
	}
}


Measured memory_bytes: 3972
#include <bits/stdc++.h>
using namespace std;
int main(){
  int K;
  cin >> K;
  vector<vector<bool>> dp(60, vector<bool>(K, false));
  dp[0][0] = true;
  for (int i = 0; i < 60; i++){
    for (int j = 0; j < K; j++){
      if (dp[i][j]){
        int r = j * 10 % K;
        while (!dp[i][r]){
          dp[i][r] = true;
          r = r * 10 % K;
        }
      }
    }
    for (int j = 0; j < K; j++){
      if (dp[i][j]){
        for (int k = 1; k < 10; k++){
          if (i + k < 60){
            dp[i + k][(j * 10 + k) % K] = true;
          }
        }
      }
    }
  }
  int ans = -1;
  for (int i = 1; i < 60; i++){
    if (dp[i][0]){
      ans = i;
      break;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 4008
#include <iostream>
#include <iomanip>
#include <fstream>
#include <stdio.h>
#include <math.h>
#include <time.h>
#include <string>
#include <tuple>
#include <vector>
#include <map>
#include <unordered_map>
#include <list>
#include <set>
#include <stack>
#include <queue>
#include <cstdlib>
#include <algorithm>
#include <random>
#include <cassert>
using namespace std;
#define LL long long
#define MP(a, b) make_pair(a, b)
#define POWER9 1000000000
#define MOD POWER9+7
#undef INT_MIN
#undef INT_MAX
#define INT_MIN -2147483647
#define INT_MAX 2147483647
#define LL_MIN (LL)-9223372036854775807
#define LL_MAX (LL)9223372036854775807
#define PI 3.14159265359

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << setprecision(9);

	int N;
	cin >> N;
	int a[3] = {};
	for(int i=0; i<N; i++){
		int tmp;
		cin >> tmp;
		if(tmp % 4 == 0) a[2]++;
		else if(tmp % 2 == 0) a[1]++;
		else a[0]++;
	}
	if(a[0]-1 > a[2]){
		cout << "No" << endl;
	}
	else{
		if(a[0]-1 == a[2]){
			if(a[1] > 0) cout << "No" << endl;
			else cout <<"Yes" << endl;
		}
		else{
			cout << "Yes" << endl;
		}
	}

	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
	public static void main(String[] args) {
	
		Scanner scn=new Scanner(System.in);
		
		
		int x=scn.nextInt();
		int y=scn.nextInt();
		
		if(x==y) {
			System.out.println(10);
		}
		else if(x>y) {
			System.out.println(10);
		}
		else if(x<y) {
			System.out.println(0);
		}
				
		scn.close();
	}
}

Measured memory_bytes: 23764