akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;

// definition {{{ 1

// scaning {{{ 2
#define Scd(x) scanf("%d", &x)
#define Scd2(x,y) scanf("%d%d", &x, &y)
#define Scd3(x,y,z) scanf("%d%d%d", &x, &y, &z)

#define Scll(x) scanf("%llu", &x)
#define Scll2(x,y) scanf("%llu%llu", &x, &y)
#define Scll3(x,y,z) scanf("%llu%llu%llu", &x, &y, &z)

#define Scc(c) scanf("%c", &c);
#define Scs(s) scanf("%s", s);
#define Scstr(s) scanf("%s", &s);
// }}} 2

// constants {{{ 2
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
// }}} 2

// systems {{{ 2
#define Rep(x,y) for(int x = 0; x < y; x++)
#define Repe(x,y,z) for(int x = z; x < y; x++)
// }}} 2

// output {{{ 2
#define YesNo(a) (a)?printf("Yes\n"):printf("No\n");
// }}} 2

// }}} 1

ll lcm(ll x, ll y){

    ll up = x*y;

    if( x < y ){
        ll temp = y;
        y = x;
        x = temp;
    }

    ll r = x%y;
    while(r!=0){
       x = y;
       y = r;
       r = x%y;
    }


    return up/y;

}

ll gcm(ll x, ll y){

    ll up = x*y;

    if( x < y ){
        ll temp = y;
        y = x;
        x = temp;
    }

    ll r = x%y;
    while(r!=0){
       x = y;
       y = r;
       r = x%y;
    }


    return y;

}
int main() {

    int m,n;
    char s[100002];
    char t[100002];

    Scd2(n,m);

    Scs(s);
    Scs(t);


    ll leng = lcm(n,m);
    ll jum = gcm(n,m);
    ll jums = n/jum;
    ll jumt = m/jum;

    ll a = min(m,n);
    ll b = max(m,n);

    ll is = 0;
    ll it = 0;
    while( is < n ){
        if( s[is] != t[it] ) leng = -1;
        is += jums;
        it += jumt;
    }
    if( s[0] != t[0] ) leng = -1;

    printf ("%lld\n", leng);

    return 0;
}



Measured memory_bytes: 384
price_sum = 0
num_sum = 0
line_num = 0

while line = gets
  price, num = line.split(",").map(&:to_i)
  price_sum += price * num
  num_sum += num
  line_num += 1
end

puts price_sum
puts (num_sum.to_f / line_num.to_f).round

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

typedef long long ll;
using namespace std;

int main(){
	
	int n,k;
	cin >> n >> k;
	vector<int> heights(n);
	for(auto& x:heights){
		cin >> x;
	}
	int INF = 1<<30;
	//we need to define how to get to the i'th stone with minimum cost
	vector<int> dp(n+1, INF); //dp[i] mejor costo en i
	
	dp[0]=0;
	for(int i=0;i<n;++i){
		for(int j=1;j<=k;j++){			
			if(i-j>=0)
				dp[i]=min( dp[i], dp[i-j]+abs(heights[i]-heights[i-j]));
		}
	}
	
	cout << dp[n-1];
	

	return 0;
}


Measured memory_bytes: 1024
#include <stdio.h>
int main(){
    int n,m,c=0,i,j,ans,sum=0;
    scanf("%d %d %d",&n,&m,&c);
    int b[m];
    int a[n][m];
    for(i=0;i<m;i++){
        scanf("%d", &b[i]);
    }
    for(i=0;i<n;i++){
        for(j=0;j<m;j++){
            scanf("%d", &a[i][j]);
        }
    }

    for(i=0;i<n;i++){
      ans = 0;
        for(j=0;j<m;j++){
            ans = ans + b[j]*a[i][j];
          }
        if((ans + c) > 0){
            sum++;
        }
    }

    printf("%d", sum);
}


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

namespace Practice
{
    class Program
    {
        private static int ReadAndParseInt()
        {
            return int.Parse(Console.ReadLine());
        }
        private static int[] ReadAndParseIntArr()
        {
            return Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
        }
        private static long ReadAndParseLong()
        {
            return long.Parse(Console.ReadLine());
        }
        private static long[] ReadAndParseLongArr()
        {
            return Array.ConvertAll(Console.ReadLine().Split(' '), long.Parse);
        }
        static void Main(string[] args)
        {
            SolveA(args);
            //SolveB(args);
            //SolveC(args);
            //SolveD(args);


        }
        static void SolveA(string[] args)
        {
            int n = ReadAndParseInt();
            int[] table = new int[] { 111, 222, 333, 444, 555, 666, 777, 888, 999, 1111 };
            for(int i=0;i<table.Length;++i)
            {
                if( n <= table[i])
                {
                    Console.WriteLine(table[i]);
                    return;
                }
            }
        }
    }
}

Measured memory_bytes: 13140
#include<stdio.h>
#include<math.h>
//TbTaYnA
int main()
{ 
int t,p,q,flag=1;scanf("%d",&t);
    int l=2*t;
    char c[t],d[t];
    scanf("%s",c);
   // puts(c);
    scanf("%s",d); //puts(d);
    //if(t&1){ printf("No"); goto g;}
  //  printf("%c",c[t-1]);
   // p=0;q=0;
    for(int a=0;a<t;a++)
    printf("%c%c",c[a],d[a]);
       // printf("%",a);
       // if(a%2==0) {e[a]=c[p];p++;}
        //else {e[a]=d[q];q++;if(q==t) break;
        
 
//  printf("%s",e);
    
    
    
    
return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
bool isPrime(long long a){
    if(a==2) return true;
    if(a%2==0) return false;
    for(long long i=2;i<=sqrt(a);i++){
        if(a%i==0)return false;
    }
    return true;
}

int main(){
//srandom((unsigned long)time(NULL));
long long n;
cin>>n;
vector<long long> num;
for(long long i=0;i<n;i++){
    long long x;
    cin>>x;
    num.emplace_back(x);
}

long long ans=0;
for(auto v:num){
    if(isPrime(v)) ans++;
    
}

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




Measured memory_bytes: 3172
#include<stdio.h>
int main(){
    int a, b;
    scanf("%d %d", &a, &b);
    if(a<b){
        printf("a < b\n");
    }
    else if(a>b){
        printf("a > b\n");
    }else{
        printf("a == b\n");
    }
    return 0;
}


Measured memory_bytes: 2048
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using pint = pair<int,int>;
ll mod = 1000000007;
int dx[8] = {1,0,-1,0,1,1,-1,-1};
int dy[8] = {0,1,0,-1,1,-1,1,-1};
void chmin(long long &a, long long b) { if (a > b) a = b; }
const long long INF = 1LL<<60;
ll gcd(ll a,ll b){
    if(b == 0) return a;
    else return gcd(b,a%b);
}
int main() {
    int ans = 0;
    string s;
    cin >> s;
    for (int i = 0; i < s.size(); ++i) {
        while(s[i] == s[i+1]){
            i++;
        }
        ans++;
    }
    cout << ans-1 << endl;
    return 0;
}


Measured memory_bytes: 512
import java.util.*;
import java.lang.*;
import java.math.*;
import java.io.*;

import static java.lang.Math.*;
import static java.util.Arrays.*;

public class Main{

	Scanner sc;

	static final int INF=1<<28;
	static final double EPS=1e-9;

	void run(){
		sc=new Scanner(System.in);
		for(; sc.hasNext();){
			double a=sc.nextDouble();
			double sum=a;
			for(int i=2; i<=10; i++){
				if(i%2==0)
					a*=2;
				else
					a/=3;
				sum+=a;
			}
			println(sum+"");
		}
		sc.close();
	}

	void print(String s){
		System.out.print(s);
	}

	void println(String s){
		System.out.println(s);
	}

	public static void main(String[] args){
		new Main().run();
	}
}

Measured memory_bytes: 12000
#include <iostream>
#include <cmath>
#include <climits>
using namespace std;
using ll = long long;
static const ll mod = 2019;
int solve() {
    ll L, R;
    cin >> L >> R;
    if (R - L >= mod) return 0;
    ll min = LLONG_MAX;
    for (ll l = L; l < R; l++) {
        for (ll r = l + 1; r <= R; r++) {
            ll tmp = ((l % mod) * (r % mod)) % mod;
            if (tmp < min) min = tmp;
        }
    }
    return min;
}
int main() {
    cout << solve() << endl;
}

Measured memory_bytes: 256
/*+lmake
 * STD = c++14
 * DEFINE += MDEBUG
 */
#include <bits/stdc++.h>
using namespace std;
using LL=long long;
#ifdef DEBUG
     #define debug(args...)            {dbg,args; cerr<<endl;}
#else
    #define debug(args...)              // Just strip off all debug tokens
#endif

struct debugger
{
    template<typename T> debugger& operator , (const T& v)
    {    
        cerr<<v<<" ";    
        return *this;    
    }
} dbg;
#define MAXN 200000
LL p[MAXN+10];
#define PI 3.1415926  
#define e  2.71828  
using LD=long double;
LD f(LL n)
{
	if(n==1||n==0) return 1;
	return log10(double(2*PI*n))/2 + n*log10(double(n/e));
}
LD calc(LL a,LL b)
{
	return f(a)-f(b)-f(a-b);
}
void solve(long long n, vector<long long> a){
	sort(a.begin(),a.end());
	int ans1=a[0],ans2=a[1];
	if (ans1<ans2) swap(ans1,ans2); 
	LD ansx=std::numeric_limits<LD>::min();
	for(int i=0; i<n; ++i) {
		auto t=lower_bound(a.begin(),a.end(), a[i]/2);
		int x=a[i]/2;
		LL ans=INT_MAX;
		if (abs(x-*t)<abs(x-ans) && *t!=a[i]) {
			ans=*t;
		}
		if (abs(x-*next(t))<abs(x-ans) && *next(t)!=a[i]) {
			ans=*next(t);
		}
		if (abs(x-*prev(t))<abs(x-ans) && *prev(t)!=a[i]) {
			ans=*prev(t);
		}
		p[i]=x-ans;
		LD xx=calc(a[i],ans);
		if (xx>ansx) {
			ansx=xx;
			ans1=a[i];
			ans2=ans;
		}
	}
	cout<<ans1<<' '<<ans2<<endl;
}

int main(){	
	long long n;
	scanf("%lld",&n);
	vector<long long> a(n-1+1);
	for(int i = 0 ; i <= n-1 ; i++){
		scanf("%lld",&a[i]);
	}
	solve(n, a);
	return 0;
}



Measured memory_bytes: 2944
#include<bits/stdc++.h>
using namespace std ; 
typedef long long ll;
#define forn(i,e) for(ll i=0; i<e; i++)
#define endl "\n"
#define zoom ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define PB push_back 
#define MP make_pair
#define F first
#define S second


int main()
{


zoom;

ll n , k ; cin >> n >> k ;  

ll a[n] ; 

forn(i,n) cin >> a[i] ; 

sort(a , a+n) ; 
ll ans = 0 ; 
forn(i, k)
ans += a[i] ; 
cout << ans ; 

}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i,n)  for(int i=0;i<(n);++i)
#define ALL(x) (x).begin(),(x).end()
ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}

int main() {
  int N;
  cin >> N;
  vector<int> L(N);
  REP(i, N) {
    cin >> L.at(i);
  }
  sort(ALL(L));
  reverse(ALL(L));
  int sum = 0;
  REP(i, N) {
    if (i != 0) {
      sum += L.at(i);
    }
  }
  if (L.at(0) < sum) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
a,b,c,d =(int(i) for i in input().split())  

import fractions

a1 = a//c
b1 = b//c

r1 = abs(a1-b1)

a2 = a//d
b2 = b//d
r2 = abs(a2-b2)

if a % c == 0:
	r1 += 1

#print(r1)
if a % d == 0:
	r2 += 1
#print(r2)

x = int(c*d/fractions.gcd(c, d))
p = b//x
q = a//x


r = abs(p - q)

if a % x == 0:
	r += 1

#print(r)
print(int((b-a)+1 -(r1 + r2 - r)))


Measured memory_bytes: 5584
import java.io.PrintWriter;
import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		PrintWriter pw = new PrintWriter(System.out);
		int N = sc.nextInt();
		int exclude = 0;
		int i=1;
		int sum = 0;
		for(; i<=N; i++) {
			sum += i;
			if(sum>=N) {
				exclude = sum-N;
				break;
			}
		}
		
		for(int j=1; j<=i; j++)
			if(j!=exclude)
				pw.println(j);
		
		sc.close();
		pw.close();
	}
}


Measured memory_bytes: 10192
N = int(input())
D,X = map(int,input().split())
A = []
for i in range(N):
    A.append(int(input()))

ans = 0
for i in range(N):
    day = 1
    while(1):
        if day > D:
            break
        day += A[i]
        ans += 1

ans += X
print(ans)


Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <cmath>
#include <climits>
using namespace std;
using uint = unsigned int;
using ull = unsigned long long;

int main() {

	uint N, K;
	cin >> N >> K;

	vector<int> h(N);
	for(uint i=0; i<N; i++) {
		cin >> h[i];
	}

	vector<uint> dp(N, UINT_MAX);
	dp[0] = 0;

	for(int j=1; j<N; j++) {
		for(int i=1; i<=K && j-i>=0; i++) {
			uint cost = abs(h[j] - h[j-i]) + dp[j-i];
			dp[j] = min(dp[j], cost);
		}
		//cout << dp[j] << endl;
	}

	cout << dp[N-1];
	return 0;
}


Measured memory_bytes: 1024
//write for s26

#include<bits/stdc++.h>
using namespace std;
int main() {
	string s;
	cin>>s;
	for(int i=0;i<s.size();i++) {
		if(s[i]=='?') {
			s[i]='D';
		}
	}
	cout<<s<<endl;
	return 0;
}

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

int main(void){
  int i,N,A,B;
  scanf("%d",&N);
  if(N==1)printf("Hello World\n");
  else{
    scanf("%d%d",&A,&B);
    printf("%d\n",A+B);
  }


}


Measured memory_bytes: 128
#include<stdio.h>
int main(void)

{
  int a,b,c,d;
  int x,y;
  x=(1<=x<=59);
  y=(0<=y<=59);

  scanf("%d",&a);
  scanf("%d",&b);
  scanf("%d",&c);
  scanf("%d",&d);

  y=a+b+c+d;


  x=y/60;
  y=y%60;
  printf("%d\n",x);
  printf("%d\n",y);

  return 0;
}

Measured memory_bytes: 596
class Node:
    def __init__(self):
        self.parent = -1
        self.type = ""
        self.depth = 0
        self.children = []


def dfs(id, d):
    Nodes[id].depth = d
    for child in Nodes[id].children:
        dfs(child, d+1)


def main():
    n = int(input())
    global Nodes
    Nodes = [Node() for i in range(n)]

    for i in range(n):
        id, k, *c = map(int, input().split())
        Nodes[id].children = c
        if k == 0:
            Nodes[id].type = "leaf"
        else:
            Nodes[id].type = "internal node"
            for j in range(k):
                Nodes[c[j]].parent = id

    rootid = ""
    for i, node in enumerate(Nodes):
        if node.parent == -1:
            rootid = i
    Nodes[rootid].type = "root"
    dfs(rootid, 0)

    for i, node in enumerate(Nodes):
        print("node {}: parent = {}, depth = {}, {}, {}".format(
            i, node.parent, node.depth, node.type, node.children))


if __name__ == '__main__':
    main()


Measured memory_bytes: 39996
import java.util.*;

public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		final int N = sc.nextInt();
		if(N % 2 == 0) {
			System.out.println(N);
		} else {
			System.out.println(N * 2);
		}
	}
}


Measured memory_bytes: 22996
process.stdin.resume();
process.stdin.setEncoding('utf8');

var lines = []
var reader = require('readline').createInterface({
  input: process.stdin,
  output: process.stdout
});

reader.on('line', (line) => {
  lines.push(line);
});

reader.on('close', () => {
 var abm = lines[0].split(' ');
 var a = Number(abm[0]);
 var b = Number(abm[1]);
 var m = Number(abm[2]);
 var kouho = [];
 var wariinfo = [];

 var rei = lines[1].split(' ');
 rei = rei.map(function(str) { return Number(str)});
 var renji = lines[2].split(' ');
 renji = renji.map(function(str) { return Number(str)});

 for(i=3; i<m+3; i++){
   var info = lines[i].split(' ');
   var a = Number(info[0]);
   var b = Number(info[1]);
   var c = Number(info[2]);

   var sum = rei[a-1] + renji[b-1] - c;
   kouho.push(sum);
 }
  var min = rei.sort((a, b)=> a - b)[0];
  min = min +  renji.sort((a, b)=> a - b)[0];
  kouho.push(min);
  min = kouho.sort((a, b)=> a - b)[0];
  console.log(min)
});

Measured memory_bytes: 56328
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;

using static Input;
using static Util;
class Program
{
    static int N;
    static int[] S;
    static void INPUT()
    {
        N = NextInt();
        S = new int[N];
        for (int i = 0; i < N; i++)
        {
            S[i] = NextInt();
        }
    }

    static void OUT()
    {
        var max = S.Sum();
        var que = new Queue<int>();
        foreach (var item in S.Where(__ => __ % 10 != 0).OrderBy(__ => __).ToArray())
        {
            que.Enqueue(item);
        }
        if (que.Count == 0) max = 0;
        while (max % 10 == 0 && max > 0) max -= que.Dequeue();

        Console.WriteLine(max);
    }
    static void Main(string[] args)
    {
#if DEBUG  
        //TESTINPUT();
        INPUT();

#else
        INPUT();
#endif
        OUT();
    }

    static void TESTINPUT()
    {
    }

}

public class Input
{
    public const long MOD = 1000000007;
    public const int INF = 1000000007;
    private static Queue<string> q = new Queue<string>();
    private static void Confirm() { if (q.Count == 0) foreach (var s in Console.ReadLine().Split(' ')) q.Enqueue(s); }
    public static int NextInt() { Confirm(); return int.Parse(q.Dequeue()); }
    public static long NextLong() { Confirm(); return long.Parse(q.Dequeue()); }
    public static string NextString() { Confirm(); return q.Dequeue(); }
    public static double NextDouble() { Confirm(); return double.Parse(q.Dequeue()); }
    public static int[] LineInt() { return Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); }
    public static long[] LineLong() { return Console.ReadLine().Split(' ').Select(long.Parse).ToArray(); }
    public static string[] LineString() { return Console.ReadLine().Split(' ').ToArray(); }
    public static double[] LineDouble() { return Console.ReadLine().Split(' ').Select(double.Parse).ToArray(); }
}

class Util
{

}




Measured memory_bytes: 13524
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#include <utility>
#include <functional>
#include <time.h>
#include <stack>
#include <array>
#define popcount __builtin_popcount
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
const ll MOD=998244353;
ll powmod(ll a, ll k){
    ll ap=a, ans=1;
    while(k){
        if(k&1){
            ans*=ap;
            ans%=MOD;
        }
        ap=ap*ap;
        ap%=MOD;
        k>>=1;
    }
    return ans;
}
int main()
{
	int cnt[100010]={};
	int n; cin>>n;
	int d[100010];
	int mx=0;
	for(int i=0; i<n; i++){
		cin>>d[i];
		mx=max(mx, d[i]);
		cnt[d[i]]++;
	}
	if(d[0]!=0){
		cout<<0<<endl;
		return 0;
	}
	if(n==1){
		cout<<1<<endl;
		return 0;
	}
	if(cnt[0]>1){
		cout<<0<<endl;
		return 0;
	}
	for(int i=1; i<=mx; i++){
		if(cnt[i]==0){
			cout<<0<<endl;
			return 0;
		}
	}
	ll ans=1;
	for(int i=1; i<mx; i++){
		ans=ans*powmod(cnt[i], cnt[i+1])%MOD;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
//freopen("transmitters.in","r",stdin);
using namespace std;

void fast(){
	std::ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
}
/*long long mn=1e9;
void lucky (long long a, long long c,int b)
{
    if(a > 1e11)
    return ;
    if(a>=b&&c==0)
    mn=min(mn,a);
    
    lucky (a*10+7,c-1,b);
    lucky (a*10+4,c+1,b);
    
}*/
long long toint(string s){
	long long a = 0, c = 1;;
	for (int i = 0; i<s.size(); i++){
		a += (s[s.size() - i - 1] - '0')*c;
		// cout<<a<<endl;
		c *= 10;
	}
	return a;
}
string binary(int x)
{
	string num="";
	while (x != 0)
	{
		num += x % 2 + '0';
		x /= 2;
	}
	return num;
}
long long decimal (string x)
{
    int a=1;
    long long u=0;
    for(long long i=0 ;i<x.size();i++)
    {
        if(x[i]=='1')
        u+=a;
        a*=2;
    }
    
    return u;
}
long long arr[100000];
int main()
{

  fast();
 
long long n=0,m=0,a=-1,t,c=0,d=0,x,y;
 char ch;
 string s,ss;
cin>>s;
n=s.size();
for(int i=s.size()-1;i>=0;i--)
{
    if(s[i]=='B')
    {
        c+=abs(i+1-n);
        n--;
    }
}
cout<<c<<endl;

   //transform(s.begin(), s.end(), s.begin(), ::tolower); 
   
//	system("pause");
	//cout << "-1" << endl;
	

	return 0;
}
	

Measured memory_bytes: 720
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
const ll INF = LLONG_MAX;

int main()
{
    string s;
    cin >> s;
    int ze = 0;
    int on = 0;
    for (int i = 0; i < s.length(); i++)
    {
        if (s[i] == '0')
            ze++;
        else
            on++;
    }
    int ans = min(ze, on) * 2;
    cout << ans << endl;
}


Measured memory_bytes: 512
# include "bits/stdc++.h"
using namespace std;
using LL = long long;
using ULL = unsigned long long;
const double PI = acos(-1);
template<class T>constexpr T INF() { return ::std::numeric_limits<T>::max(); }
template<class T>constexpr T HINF() { return INF<T>() / 2; }
template <typename T_char>T_char TL(T_char cX) { return tolower(cX); };
template <typename T_char>T_char TU(T_char cX) { return toupper(cX); };
typedef pair<LL, LL> pii;
const int vy[] = { -1, -1, -1, 0, 1, 1, 1, 0 }, vx[] = { -1, 0, 1, 1, 1, 0, -1, -1 };
const int dx[4] = { 0,1,0,-1 }, dy[4] = { 1,0,-1,0 };
int popcnt(unsigned long long n) { int cnt = 0; for (int i = 0; i < 64; i++)if ((n >> i) & 1)cnt++; return cnt; }
int d_sum(LL n) { int ret = 0; while (n > 0) { ret += n % 10; n /= 10; }return ret; }
int d_cnt(LL n) { int ret = 0; while (n > 0) { ret++; n /= 10; }return ret; }
LL gcd(LL a, LL b) { if (b == 0)return a; return gcd(b, a%b); };
LL lcm(LL a, LL b) { LL g = gcd(a, b); return a / g*b; };
# define ALL(qpqpq)           (qpqpq).begin(),(qpqpq).end()
# define UNIQUE(wpwpw)        sort(ALL((wpwpw)));(wpwpw).erase(unique(ALL((wpwpw))),(wpwpw).end())
# define LOWER(epepe)         transform(ALL((epepe)),(epepe).begin(),TL<char>)
# define UPPER(rprpr)         transform(ALL((rprpr)),(rprpr).begin(),TU<char>)
# define FOR(i,tptpt,ypypy)   for(LL i=(tptpt);i<(ypypy);i++)
# define REP(i,upupu)         FOR(i,0,upupu)
# define INIT                 std::ios::sync_with_stdio(false);std::cin.tie(0)

int n, m;
int imos[101010], l, r;
int cnt;

int main(){
    cin >> n >> m;
    REP(i, m){
        cin >> l >> r;
        l--, r--;
        imos[l]++;
        imos[r + 1]--;
    }
    for(int i = 1;i < 101010;i++){
        imos[i] += imos[i - 1];
    }
    REP(i, n)if(imos[i] == m)cnt++;
    cout << cnt << endl;
}

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

int main(){
	// sengen
	int n,k,r,s,p;
	string t;
	// nyuryoku
	cin >> n >> k;
	cin >> r >> s >> p;
	cin >> t;
	// keisan
	long long sum = 0;
	for(int i=0;i<n;i++){
		if(i < k){
			if(t[i] == 'r'){
				sum += p;
			}else if(t[i] == 's'){
				sum += r;
			}else{
				sum += s;
			}
		}else{
			if(t[i] == t[i-k]){
				t[i] = 'u';
			}else{
				if(t[i] == 'r'){
					sum += p;
				}else if(t[i] == 's'){
					sum += r;
				}else{
					sum += s;
				}
			}
		}
	}
	// syutsuryoku
	cout << sum;
}

Measured memory_bytes: 512
#line 2 "header.hpp"

//%snippet.set('header')%
//%snippet.fold()%
#ifndef HEADER_H
#define HEADER_H

// template version 2.0
using namespace std;
#include <bits/stdc++.h>

// varibable settings
const long long INF = 1e18;
template <class T> constexpr T inf = numeric_limits<T>::max() / 2.1;

#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (ll i = (ll)(a); i < (ll)(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define _rrep(i, n) rrepi(i, 0, n)
#define rrepi(i, a, b) for (ll i = (ll)((b)-1); i >= (ll)(a); --i)
#define r_rep(...) _overload3(__VA_ARGS__, rrepi, _rrep, )(__VA_ARGS__)
#define each(i, a) for (auto &&i : a)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b)
#define mt(...) make_tuple(__VA_ARGS__)
#define ub upper_bound
#define lb lower_bound
#define lpos(A, x) (lower_bound(all(A), x) - A.begin())
#define upos(A, x) (upper_bound(all(A), x) - A.begin())
template <class T> inline void chmax(T &a, const T &b) { if ((a) < (b)) (a) = (b); }
template <class T> inline void chmin(T &a, const T &b) { if ((a) > (b)) (a) = (b); }
template <typename X, typename T> auto make_table(X x, T a) { return vector<T>(x, a); }
template <typename X, typename Y, typename Z, typename... Zs> auto make_table(X x, Y y, Z z, Zs... zs) { auto cont = make_table(y, z, zs...); return vector<decltype(cont)>(x, cont); }

#define cdiv(a, b) (((a) + (b)-1) / (b))
#define is_in(x, a, b) ((a) <= (x) && (x) < (b))
#define uni(x) sort(all(x)); x.erase(unique(all(x)), x.end())
#define slice(l, r) substr(l, r - l)

typedef long long ll;
typedef long double ld;
using vl = vector<ll>;
using vvl = vector<vl>;
using pll = pair<ll, ll>;

template <typename T>
using PQ = priority_queue<T, vector<T>, greater<T>>;
void check_input() { assert(cin.eof() == 0); int tmp; cin >> tmp; assert(cin.eof() == 1); }

#if defined(PCM) || defined(LOCAL)
#else
#define dump(...) ;
#define dump_1d(...) ;
#define dump_2d(...) ;
#define cerrendl ;
#endif

#endif /* HEADER_H */
//%snippet.end()%
#line 2 "solve.cpp"
template<class T=ll> using vec = vector<T>;
struct Fast { Fast() { std::cin.tie(0); ios::sync_with_stdio(false); } } fast;


int solve() {
    ll a;cin>>a;
    string b;cin>>b;

    ll c = 0;
    c += 100 * (b[0]-'0');
    c += 10 * (b[2]-'0');
    c += 1 * (b[3]-'0');
    dump(c);

    cout << a * c / 100 << endl;
    return 0; 
}


int main(){/*{{{*/
    solve();
    check_input();
    return 0;
}/*}}}*/


Measured memory_bytes: 3592
#include <bits/stdc++.h>
#define debug(x) cerr << #x << ": " << x << '\n';
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = (int)1e9;
const int MOD = (int)1e9 + 7;

int main(void){
    int N, D;
    cin >> N >> D;
    vector<vector<int>> X(N, vector<int>(D));
    for(int i = 0; i < N; i++){
        for(int j = 0; j < D; j++){
            cin >> X[i][j];
        }
    }

    vector<int> list;
    for(int i = 1; i*i < 40*40*10; i++){
        list.push_back(i*i);
    }

    int res = 0;
    for(int i = 0; i < N; i++){
        for(int j = i+1; j < N; j++){
            int dist2 = 0;
            for(int k = 0; k < D; k++){
                dist2 += (X[i][k] - X[j][k]) * (X[i][k] - X[j][k]);
            }

            for(auto n: list){
                if(n == dist2) res++;
            }
        }
    }

    cout << res << '\n';

    return 0;
}

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

int n, A[1000], s;
int B[1000], T[10001];

int solve(){
    int ans = 0;

    bool V[1000] = {};
    for(int i = 0; i < n; i++){
        B[i] = A[i];
    }

    sort(B, B+n);

    // 配列Tは要素->ソート後の位置をO(1)で取得するためのもの
    for(int i = 0; i < n; i++)  T[B[i]] = i;
    for(int i = 0; i < n; i++){
        if(V[i])    continue;
        int cur = i;
        int sum = 0;
        int tmpmin = 10000;
        int an = 0;
        while(1){
            V[cur] = true;
            an++;
            int v = A[cur];
            tmpmin = min(tmpmin,v);
            sum += v;
            cur = T[v];
            if(V[cur])  break;
        }
        ans += min(sum + (an-2)*tmpmin, tmpmin + sum + (an+1) * s);
    }

    return ans;
}

int main(){
    cin >> n;

    s = 10000;
    for(int i = 0; i < n; i++){
        cin >> A[i];
        s = min(s, A[i]);
    }

    cout << solve() << endl;
    return 0;
}


Measured memory_bytes: 3164
#include <bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
using namespace std;
typedef long long LL;
typedef pair<int,int> pii;
typedef vector<int> vi;

template<class T> inline T re(){
	T N = 0; char c = getchar(); bool neg = 0;
	for (; c < '0' || c > '9'; c = getchar()) neg |= c == '-';
	for (; c >= '0' && c <= '9'; c = getchar())
		N = (N<<3)+(N<<1) + c - '0';
	return neg ? -N : N;
}

int n;
int yes = 0;

int main(){
	n = re<int>();
	for (int i = 1; i <= n; i++){
		int u = re<int>();
		yes ^= (u & 1);
	}
	puts(yes ? "NO" : "YES");
	return 0;
}


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



int main(){
	int N;
	cin>>N;
	map<int,int> mp;
	for(int i=0;i<N;i++){
		int a;
		cin>>a;
		mp[a]++;
	}
	int x = 0;
	int y = 0;
	for(auto a:mp){
		if(a.second>=4){
			x=a.first;
			y=a.first;
		}
		else if(a.second>=2){
			y=x;
			x=a.first;
		}
	}
	
	cout<<(long long)x*y<<endl;
	
	
	return 0;
}


Measured memory_bytes: 4992
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define ld long double
#define pb push_back
#define mp make_pair
#define f(i,a,n) for(int i=a ; i<n ; i++)
#define F first
#define S second
#define vll vector<ll>
#define fast ios:: sync_with_stdio(false),cin.tie(0);
#define COUT cout<<fixed<<setprecision(12)
#define SET set<ll,greater<ll>>gquiz
#define ITERATOR set<ll,greater<ll>> :: iterator itr
#define V vector<ll>vector
#define sz size()
//#define A vector<pair<ll,ll>>vect
ll N=100000,M=100000;
#define B vect.push_back(make_pair(N,M));
ll MOD=1000000007;
 
bool isprime(ll n){if(n==1 || (n!=2 && n%2==0))return false; if(n==2)return true; 
		for(ll i=3;i<=sqrt(n);i+=2)if(n%i==0)return false; return true; }
ll gcd(ll a,ll b) 
{ 
    if (a == 0) 
        return b; 
    return gcd(b % a, a); 
} 

void solve()
{
	ll n;
	cin>>n;

	string s;
	cin>>s;
	ll r=0,b=0,g=0;
	for(ll i=0;i<n;i++)
	{
		if(s[i]=='R')
		r++;
		if(s[i]=='G')
		g++;
		if(s[i]=='B')
		b++;
	}
	
	ll ans=0;
	for(ll i=0;i<n;i++)
	{
		for(ll j=i+1;j<n;j++)
		{
			if(s[i]!=s[j])
			{
				ll h=j-i;
			    ll t=h+j;
			    if(t<n && s[i]!=s[t] && s[j]!=s[t])
			    ans++;
			}
		}
	}
	ll ans1=0;
	for(ll i=0;i<n;i++)
	{
		if(s[i]=='R')
		{
			r--;
			ans1=ans1+g*b;
		}
		if(s[i]=='B')
		{
			b--;
			ans1=ans1+r*g;
		}
		if(s[i]=='G')
		{
			g--;
			ans1=ans1+r*b;
		}
	}
	cout<<ans1-ans;
}
int main()
{
	fast;
	ll t=1;
	//cin>>t;
	while(t--)
	{
		solve();
	}
}

Measured memory_bytes: 3644
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define FOR(i,n,m) for(int i=(n);i<(m);i++)
#define REP(i,n) FOR(i,0,n)
#define REPR(i,n) for(int i=(n);i>=0;i--)
#define all(vec) vec.begin(),vec.end()
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using P=pair<int,int>;
using PP=pair<int,P>;
using Pl=pair<ll,ll>;
using PPl=pair<ll,Pl>;
using vs=vector<string>;
#define fi first
#define se second
#define pb push_back
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T &a,const T &b){if(a>b){a=b;return true;}return false;}
const ll MOD=1000000007LL;
const int INF=1<<30;
const ll LINF=1LL<<60;
template<int mod>
struct ModInt{
    int x;
    ModInt():x(0){}
    ModInt(long long y):x(y>=0?y%mod:(mod-(-y)%mod)%mod){}
    ModInt &operator+=(const ModInt &p){
        if((x+=p.x)>=mod)x-=mod;
        return *this;
    }
    ModInt &operator-=(const ModInt &p){
        if((x+=mod-p.x)>=mod)x-=mod;
        return *this;
    }
    ModInt &operator*=(const ModInt &p){
        x=(int)(1LL*x*p.x%mod);
        return *this;
    }
    ModInt &operator/=(const ModInt &p){
        *this*=p.inverse();
        return *this;
    }
    ModInt operator-()const{return ModInt(-x);}
    ModInt operator+(const ModInt &p)const{return ModInt(*this)+=p;}
    ModInt operator-(const ModInt &p)const{return ModInt(*this)-=p;}
    ModInt operator*(const ModInt &p)const{return ModInt(*this)*=p;}
    ModInt operator/(const ModInt &p)const{return ModInt(*this)/=p;}
    bool operator==(const ModInt &p)const{return x==p.x;}
    bool operator!=(const ModInt &p)const{return x!=p.x;}
    ModInt inverse()const{
        int a=x,b=mod,u=1,v=0,t;
        while(b>0){
            t=a/b;
            a-=t*b;
            swap(a,b);
            u-=t*v;
            swap(u,v);
        }
        return ModInt(u);
    }
    friend ostream &operator<<(ostream &os,const ModInt<mod> &p){
        return os<<p.x;
    }
    friend istream &operator>>(istream &is,ModInt<mod> &a){
        long long x;
        is>>x;
        a=ModInt<mod>(x);
        return (is);
    }
};

const int mod=1e9+7;
using mint=ModInt<mod>;
template<int mod>
struct Combination{
    using mint=ModInt<mod>;
    vector<mint> fact;
    Combination(int n){
        n++;
        fact.resize(n);
        for(int i=0;i<n;i++){
            if(!i){
                fact[i]=1;
            }else{
                fact[i]=fact[i-1]*i;
            }
        }
    }
    mint Comb(int n,int r){
        return fact[n]/fact[r]/fact[n-r];
    }
    mint H(int n,int r){
        return Comb(n+r-1,r);
    }
};
map<int,int> primeFactor(int n){
    map<int,int> res;
    for(int i=2;i*i<=n;i++){
        while(n%i==0){
            res[i]++;
            n/=i;
        }
    }
    if(n!=1){
        res[n]=1;
    }
    return res;
}
int main(){
    int n;
    int x;
    cin>>n>>x;
    auto ma=primeFactor(x);
    mint ans=1;
    Combination<mod> c(n+100);
    for(auto itr:ma){
        ans*=c.Comb(itr.se+n-1,itr.se);
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 640
main = do
    s <- getLine
    t <- getLine
    let ans = any (== t) $ rotateAll s
    putStrLn $ if ans then "Yes" else "No"

rotate :: Int -> [a] -> [a]
rotate _ [] = []
rotate n xs = zipWith const (drop n (cycle xs)) xs

rotateAll :: [a] -> [[a]]
rotateAll [] = []
rotateAll xs = map (\n -> rotate n xs) [0..(length xs) - 1]


Measured memory_bytes: 508
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int N = scan.nextInt();

		int[][] x = new int[N][N];
		int[][] y = new int[N][N];
		int[] A = new int[N];
		int flag = 0;
		int ans = 0;

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

			A[i] = scan.nextInt();

			for (int j = 0; j < A[i]; j++) {

				x[i][j] = scan.nextInt();
				y[i][j] = scan.nextInt();

			}

		}

		for (int i = (int) Math.pow(2, N) - 1; i >= 0; i--) {

			/*
			System.out.println("ループはじめ");
			System.out.println("for1");
			System.out.println(i);
			*/
			flag = 0;

			for (int j = 0; j < N; j++) {

				//System.out.println("for2");
				if (flag == 1) {
					break;
				}

				if ((1 & i >>> j) == 1) {//正直者であれば証言を精査する

					for (int k = 0; k < A[j]; k++) {

						/*
						System.out.println("for3");

						System.out.println("x["+ j + "][" + k + "]は" + x[j][k]);
						System.out.println("y["+ j + "][" + k + "]は" + y[j][k]);

						*/
						if ((y[j][k] & i >>> (x[j][k] - 1)) == 1
								|| (y[j][k] == 0 && ((1 & ~(i >>> (x[j][k] - 1))) == 1))) {

						} //else if ((y[j][k] & i >>> x[j][k]) == 1) {

						//}
						else {//正直者であるはずなのに証言が一致しない
							flag = 1;
							break;
						}

					}

				}
			}

			if (flag == 0) {
				if (ans < Integer.bitCount(i)) {
					ans = Integer.bitCount(i);
				}
			}

		}

		System.out.println(ans);
		scan.close();

	}
}


Measured memory_bytes: 21844
package main

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

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	const initialBufSize = 4096
	const maxBufSize = 1000000
	scanner.Buffer(make([]byte, initialBufSize), maxBufSize)
	scanner.Split(bufio.ScanWords)
	var N int
	scanner.Scan()
	N, _ = strconv.Atoi(scanner.Text())
	var S string
	scanner.Scan()
	S = scanner.Text()
	fmt.Println(solve(N, S))
}
func solve(N int, S string) int {
	cnt := 0
	for pin := 0; pin < 1000; pin++ {
		pinRunes := []rune(fmt.Sprintf("%03d", pin))
		pinIndex := 0
		for _, r := range S {
			if r == pinRunes[pinIndex] {
				pinIndex++
			}
			if pinIndex == 3 {
				cnt++
				break
			}
		}
	}
	return cnt
}


Measured memory_bytes: 768
#include <iostream>
using namespace std;
 
long long gcd(long long a, long long b)
{
	long long temp;
	while (a % b != 0)
	{
		temp = b;
		b = a % b;
		a = temp;
	}
	return b;
}
 
int main()
{
	long long A, B, C, D;
	cin >> A >> B >> C >> D;
 
	long long  count = 0;
	count += (B / C) - ((A-1)  / C) ;
	count += (B / D) - ((A-1)  / D) ;
	long long g = C *D / gcd(C, D) ;
	count -= (B / g) - ((A-1)  / g) ;
 
	cout << (B - A + 1 - count) << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
int h,w;
while(1){
cin>>h>>w;
if(h==0&&w==0)break;
for(int t=0;t<h;t++){
for(int y=0;y<w;y++){
cout<<"#";
}
cout<<"\n";
}
cout<<endl;
}
return 0;
}



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


void main()
{
  int n;
  long k;
  readf("%s %s\n", &n, &k);

  long cnt = 0;

  auto d = new int[][](n, 2);
  foreach (i; 0..n) {
    d[i] = readln.chomp.split.to!(int[]);
  }
  d = sort(d).array;
  foreach (i; 0..n) {
    cnt += d[i][1];
    if (cnt >= k) {
      writeln(d[i][0]);
      break;
    }
  }
}


Measured memory_bytes: 18556
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-8;
const ll mod=1e9+7;
const int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

const int M=16;
int n,a[M];
vvp g;

int dfs(int v,int pre){
	int res=0;
	for(auto p:g[v]){
		int u=p.first,c=p.second;
		if(pre!=u){
			int t=c^dfs(u,v);
			if(t) a[t]++;
			res^=c;
		}
	}
	return res;
}

int main(){
	cin>>n;
	g=vvp(n);
	for(int i=1;i<n;i++){
		int u,v,c;
		cin>>u>>v>>c;
		g[u].push_back({v,c});
		g[v].push_back({u,c});
	}
	dfs(0,-1);
	int t=0;
	vi b,c,dp;
	for(int i=1;i<M;i++){
		t+=a[i]/2;
		if(a[i]%2==1) b.push_back(i);
	}
	n=b.size();
	int N=1<<n;
	c=dp=vi(N);
	for(int i=0;i<N;i++) for(int j=0;j<n;j++) if(i&1<<j) c[i]^=b[j];
	for(int i=1;i<N;i++){
		int j=i;
		do{
			dp[i]=max(dp[i],dp[i-j]+(c[j]?0:1));
			j=(j-1)&i;
		}while(j);
	}
	cout<<t+n-dp[N-1]<<endl;
}

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

using namespace std;

#define REP(i, a, b) for (int i = (a), i##_end_ = (b); i < i##_end_; ++i)
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define mp make_pair
#define x first
#define y second
#define pb push_back
#define SZ(x) (int((x).size()))
#define ALL(x) (x).begin(), (x).end()

template<typename T> inline bool chkmin(T &a, const T &b) { return a > b ? a = b, 1 : 0; }
template<typename T> inline bool chkmax(T &a, const T &b) { return a < b ? a = b, 1 : 0; }

typedef long long LL;

const int oo = 0x3f3f3f3f;

const int maxn = 110;

int n, m;

int main()
{
#ifdef matthew99
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	scanf("%d%d", &n, &m);
	int cnt[26] = {0};
	REP(i, 0, n)
	{
		string x;
		cin >> x;
		REP(j, 0, m)
			++cnt[x[j] - 'a'];
	}
	int num[4] = {0};
	REP(i, 0, 26) ++num[cnt[i] & 3];
	if ((num[1] + num[3]) <= (n & 1) * (m & 1) && num[2] <= (n & 1) * (m >> 1) + (m & 1) * (n >> 1)) puts("Yes");
	else puts("No");
	return 0;
}


Measured memory_bytes: 256
A,B,C,X,Y = map(int, input().split())

if 2*C > A + B:
  print(A*X+B*Y)
else:
  if min(X,Y) == X and 2*C > B:
    print(2*C*X + B*(Y-X))
  elif min(X,Y) == Y and 2*C > A:
    print(2*C*Y + A*(X-Y))
  else:
    print(2*C*max(X,Y))

Measured memory_bytes: 38256
#include <stdio.h>
#include <iostream>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <math.h>
#include <algorithm>
using namespace std;
#define ll long long
const double EPS = 1e-10;

int main (){
  ll n,m;
  ll ans=0;
  cin>>n>>m;
  vector<ll>a(m,0);
  ll k,kk;
  for(ll i=0;i<n;i++){
    cin>>k;
    for(ll j=0;j<k;j++){
      cin>>kk;
      a[kk-1]++;
    }
  }
  for(ll i=0;i<m;i++){
    if(a[i]==n)ans++;
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 256
//============================================================================
// Name        : AOJ.cpp
// Author      : 
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include <algorithm>

using namespace std;

int main() {

	int x;
	cin>>x;
	x=x%7;
	if(x==0)cout <<"thu"<< endl;
	if(x==1)cout <<"fri"<< endl;
	if(x==2)cout <<"sat"<< endl;
	if(x==3)cout <<"sun"<< endl;
	if(x==4)cout <<"mon"<< endl;
	if(x==5)cout <<"tue"<< endl;
	if(x==6)cout <<"wed"<< endl;
	return 0;
}

Measured memory_bytes: 3088
import math
#numpy使った方がよかったか
N,D=input().split()
N,D=int(N),int(D)
X=[]

for i in range(N):
    X1=input().split()
    #print(X[i])
    X2=[]
    for j in range(D):
        X2.append(int(X1[j]))
    X.append(X2)
    
c=0
for i in range(N):
    for j in range(N-i-1):
        d=0
        for k in range(D):
            d+=(X[i][k]-X[j+i+1][k])**2
        if abs(math.sqrt(d)-int(math.sqrt(d))) <0.0001:
            c+=1

print(c)


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

int main()
{
    int n;
    string s;
    int k;
    
    cin>>n>>s>>k;

    for(int i=0;i<n;i++)
    {
        if(s[i] != s[k-1])
        {
            s[i] = '*';
        }
    }
    cout<<s<<endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int,int>;
P funct(int x){
  int a, b;
  a = x % 10;
  while(x){
    b = x;
    x /= 10;
  }
  return P(a,b);
}
int main(){
  int N,sumnation=0;
  cin >> N;
  map<P,int> table;
  {
    P tmp(0,0);
    for(int i = 0; i < 10; i++){
      for(int j = 0; j < 10; j++){
        tmp.first = i; tmp.second = j;
        table[tmp] = 0;
      }
    }
  }
  for(int i = 1; i <= N; i++){
    table[funct(i)]++;
  }
  {
    P p_tmp(0,0),p_tmp2(0,0);
    for(int i = 1; i <= 9; i++){
      p_tmp.first = i;
      p_tmp2.second = i;
      for(int j = 1; j <= 9; j++){
        p_tmp.second = j;
        p_tmp2.first = j;
        sumnation += table[p_tmp]*table[p_tmp2];
      }
    }
  }
  cout << sumnation;
  return 0;
}

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

#define CH_MAX 8

int main(){
	int n,i,ac=0,wa=0,tle=0,re=0;
	char ch[CH_MAX];
	
	scanf("%d",&n);
	
	for(i=0;i<n;i++){
		scanf("%s",ch);
		if(strcmp(ch,"AC")==0)
			ac++;
		else if(strcmp(ch,"WA")==0)
			wa++;
		else if(strcmp(ch,"TLE")==0)
			tle++;
		else if(strcmp(ch,"RE")==0)
			re++;
	}
	
	printf("AC x %d\nWA x %d\nTLE x %d\nRE x %d\n",ac,wa,tle,re);
}


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


int main() {

	int n;
	int i, j;
	int a[101];
	int even_a[101];
	int count = 0;
	int true_count = 0;

	scanf("%d", &n);

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

	j = 0;
	for(int i = 0; i < n; i++) {
		if(a[i] % 2 == 0) {
			even_a[j] = a[i];
			j++;
			count++;
		}
	}

	for(i= 0; i < count; i++) {
		if((even_a[i] % 3 == 0) || (even_a[i] % 5 == 0)) {
			true_count++;
		}
	}

	if(true_count == count) {
		printf("APPROVED\n");
	}
	else {
		printf("DENIED\n");
	}

	return 0;

}


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

using namespace std;

#define sqr(a) ((a)*(a))
#define all(a) (a).begin(), (a).end()

const long long MOD = (int) 1e9 + 7;

long long binPow(long long a, long long b) {
    if (b == 0)
        return 1;

    long long ans = binPow(a, b / 2);
    ans = ans * ans % MOD;

    if (b % 2)
        ans = ans * a % MOD;

    return ans;
}

int main() {
//    freopen("input.txt", "r", stdin);
    ios_base::sync_with_stdio(0);
    cin.tie(0);

    int n, m;
    cin >> n >> m;

    string a;
    cin >> a;

    vector<int> dp(n + 1, (int) 1e9);
    multiset<int> q;
    vector<vector<int> > w(n + 1);

    q.insert(-1);
    w[n - 1].push_back(-1);

    for (int i = n; i >= 0; --i) {
        for (auto j : w[i]) {
            q.erase(q.find(j));
        }

        if (a[i] == '1') {
            continue;
        }

        if (q.size()) {
            dp[i] = *q.begin() + 1;
            q.insert(dp[i]);
            if (i - m - 1 >= 0)
                w[i - m - 1].push_back(dp[i]);
        }
    }

    if (dp[0] == (int) 1e9) {
        cout << "-1\n";
        return 0;
    }

    int pos = 0;
    int total = 1;
    while (pos != n) {
        for (int i = pos + 1; i <= pos + m; ++i) {
            if (dp[i] + total == dp[0]) {
                cout << i - pos << " ";
                pos = i;
                ++total;
                break;
            }
        }
    }

//    for (int i = 0; i <= n; ++i)
//        cout << dp[i] << " ";
}


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

long long dp[55][55][2525]; long long n, a;

int main() {
	cin >> n >> a;
	dp[0][0][0] = 1;
	for (int i = 0; i < n; i++) {
		int A;
		cin >> A;
		for (int j = 0; j < n; j++) {
			for (int k = 0; k < 2525; k++) {
				if (dp[i][j][k] == 0)continue;
				dp[i + 1][j + 1][k + A] += dp[i][j][k];
				dp[i + 1][j][k] += dp[i][j][k];
			}
		}
	}
	long long ans = 0;
	for (int i = 1; i <= n; i++)ans += dp[n][i][a*i];
	cout << ans << endl;
}

Measured memory_bytes: 53504
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define rrep2(ri,x,n) for(int ri = (int)(n-1); ri >= (int)(x); ri--)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(x) x.begin(), x.end()
using ll = long long;
using namespace std;

int main(){
  string s;
  cin >> s;
  if(s.at(2) == s.at(3) && s.at(4) == s.at(5)) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>
using namespace std; 
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define FORD(i,a,b) for(int i=(a);i>=(b);i--)
inline bool EQ(double a, double b) { return fabs(a-b) < 1e-9; }
const int INF = 1<<29;
typedef long long int ll;
inline int two(int n) { return 1 << n; }
inline int test(int n, int b) { return (n>>b)&1; }
inline void set_bit(int & n, int b) { n |= two(b); }
inline void unset_bit(int & n, int b) { n &= ~two(b); }
inline int last_bit(int n) { return n & (-n); }
inline int ones(int n) { int res = 0; while(n && ++res) n-=n&(-n); return res; }
template<class T> void chmax(T & a, const T & b) { a = max(a, b); }
template<class T> void chmin(T & a, const T & b) { a = min(a, b); }
const int MOD=1000000007;

bool isPowerOfTwo (ll x)  
{  
    return x && (!(x&(x-1)));  
}
bool isPrime(int n) 
{ 
    if (n <= 1)  return false; 
    if (n <= 3)  return true; 
    if (n%2 == 0 || n%3 == 0) return false; 
  
    for (int i=5; i*i<=n; i=i+6) 
        if (n%i == 0 || n%(i+2) == 0) 
           return false; 
  
    return true; 
}
int highestPowerof2(unsigned int n) 
{ 
    // Invalid input 
    if (n < 1) 
        return 0; 
  
    int res = 1;
    for (int i=0; i<8*sizeof(unsigned int); i++) 
    { 
        int curr = 1 << i; 
        if (curr > n) 
           break; 
  
        res = curr; 
    } 
  
    return res; 
} 
long long binpow(long long a, long long b) {
    long long res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}       
////////////////////////////////////////////////////////////////////

int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);  
  cout.tie(NULL);
  int t=1;
  while(t--)
  {
    ll n,w;
    cin>>n>>w;
    ll dp[n+1][w+1]={{0}};
    int weight[n],value[n];
    REP(i,n)
    {
        cin>>weight[i];
        cin>>value[i];
    }
    for(int i=0;i<=n;i++)
    {
        for(int j=0;j<=w;j++)
        {
            if(i==0 || j==0)
            dp[i][j]=0;
            else if(weight[i-1]<=j)
            dp[i][j]=max(value[i-1]+dp[i-1][j-weight[i-1]],dp[i-1][j]);
            else dp[i][j]=dp[i-1][j];
        }
    }
    cout<<dp[n][w];
  }  
  return 0;
}

Measured memory_bytes: 79232
n = int(input())
aa = []
bb = []

for _ in range(n):
    a, b = map(int, input().split())
    aa.append(a)
    bb.append(b)

aa.sort()
bb.sort()

if n % 2 == 1:
    ac = aa[n // 2]
    bc = bb[n // 2]
    print(abs(ac - bc) + 1)

else:
    ac1 = aa[n // 2 - 1]
    bc1 = bb[n // 2 - 1]
    ac2 = aa[n // 2]
    bc2 = bb[n // 2]
    print((bc2 + bc1) - (ac2 + ac1) + 1)


Measured memory_bytes: 104800
#include<stdio.h>
int main(void){
  char S[11],T[12];
  int i=0;
  
  scanf("%s",S);
  scanf("%s",T);
  
  while(S[i] != '\0'){
    if(S[i]!=T[i]){
      printf("No");
      return 0;
    }
    i++;
  }
  printf("Yes");
  return 0;
}


Measured memory_bytes: 1688