akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>

int main(void) {

    int i, j, k;
    int n, m, l;

    scanf("%d%d%d", &n, &m, &l);
    int mat_A[n][m], mat_B[m][l];
    long int mat_C[n][l];
    for (i = 0; i < n; i++) {
        for (j = 0; j < m; j++) {
            mat_A[i][j] = 0;
        }
    }
    for (i = 0; i < m; i++) {
        for (j = 0; j < l; j++) {
            mat_B[i][j] = 0;
        }
    }
    for (i = 0; i < n; i++) {
        for (j = 0; j < l; j++) {
            mat_C[i][j] = 0;
        }
    }

    for (i = 0; i < n; i++) {
        for (j = 0; j < m; j++) {
            scanf("%d", &mat_A[i][j]);
        }
    }
    for (i = 0; i < m; i++) {
        for (j = 0; j < l; j++) {
            scanf("%d", &mat_B[i][j]);
        }
    }

    for (i = 0; i < n; i++) {
        for (j = 0; j < l; j++) {
            for (k = 0; k < m; k++) {
                mat_C[i][j] += mat_A[i][k] * mat_B[k][j];
            }
        }
    }

    for (i = 0; i < n; i++) {
        for (j = 0; j < l; j++) {
            if (j == 0) {
                printf("%ld", mat_C[i][j]);
            } else {
                printf(" %ld", mat_C[i][j]);
            }
        }
        printf("\n");
    }

    return 0;

}

Measured memory_bytes: 760
import sys, collections
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = 10**10
def I(): return int(input())
def F(): return float(input())
def S(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LS(): return input().split()

def resolve():
    n = I()

    tmp = n
    ans = []
    factor = 2
    while factor<n**0.5 and tmp>1:
        if tmp%factor == 0:
            tmp //= factor 
            ans.append(factor)
        else:
            factor += 1
    if tmp>=2:
        ans.append(tmp)
    print(str(n)+':', ' '.join([str(i) for i in ans]))

if __name__ == '__main__':
    resolve()


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

int main()
{
	int A, B, K;
	cin >> A >> B >> K;
	vector<int> res;
	for (int i = A; i < min(B + 1, A + K); i++) {
		res.push_back(i);
	}
	for (int i = B; i > max(B - K, A - 1); i--) {
		res.push_back(i);
	}
	sort(res.begin(), res.end());
	res.erase(unique(res.begin(), res.end()), res.end());
	for (auto ans : res) {
		cout << ans << endl;
	}
	return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.Map.Entry;
import java.util.PriorityQueue;
import java.util.StringTokenizer;
 
public class Main {
	
	public static void main(String[] args) throws IOException {
		try(final Scanner sc = new Scanner(System.in)){
			final char[] s = sc.next().toCharArray();
			final char[] t = sc.next().toCharArray();
			
			LOOP:
			for(int st = 0; st < s.length; st++) {
				for(int i = 0; i < s.length; i++) {
					final int index = (st + i) % s.length;
					
					if(s[i] != t[index]) { continue LOOP; }
				}
				
				System.out.println("Yes");
				return;
			}
			
			System.out.println("No");
		}
	}
 
	public static class Scanner implements Closeable {
		private BufferedReader br;
		private StringTokenizer tok;
 
		public Scanner(InputStream is) throws IOException {
			br = new BufferedReader(new InputStreamReader(is));
		}
 
		private void getLine() throws IOException {
			while(!hasNext()){
				tok = new StringTokenizer(br.readLine());
			}
		}
 
		private boolean hasNext() {
			return tok != null && tok.hasMoreTokens();
		}
 
		public String next() throws IOException {
			getLine();
			return tok.nextToken();
		}
 
		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}
 
		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}
 
		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}
 
		public int[] nextIntArray(int n) throws IOException {
			final int[] ret = new int[n];
			for(int i = 0; i < n; i++){
				ret[i] = this.nextInt();
			}
			return ret;
		}
 
		public long[] nextLongArray(int n) throws IOException {
			final long[] ret = new long[n];
			for(int i = 0; i < n; i++){
				ret[i] = this.nextLong();
			}
			return ret;
		}
 
		public void close() throws IOException {
			br.close();
		}
	}
}

Measured memory_bytes: 21204
import sys, re
from math import ceil, floor, sqrt, pi, factorial, gcd
from copy import deepcopy
from collections import Counter, deque
from heapq import heapify, heappop, heappush
from itertools import accumulate, product, combinations, combinations_with_replacement
from bisect import bisect, bisect_left, bisect_right
from functools import reduce
from decimal import Decimal, getcontext
# input = sys.stdin.readline 
def i_input(): return int(input())
def i_map(): return map(int, input().split())
def i_list(): return list(i_map())
def i_row(N): return [i_input() for _ in range(N)]
def i_row_list(N): return [i_list() for _ in range(N)]
def s_input(): return input()
def s_map(): return input().split()
def s_list(): return list(s_map())
def s_row(N): return [s_input for _ in range(N)]
def s_row_str(N): return [s_list() for _ in range(N)]
def s_row_list(N): return [list(s_input()) for _ in range(N)]
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 6)
INF = float('inf')
MOD = 10 ** 9 + 7
num_list = []
str_list = []

def f(x, y , z):
    return x * x + y * y + z * z + x * y + y * z + z * x

def main():
    n = i_input()

    ans_list = []
    max_num = ceil(sqrt(n))
    for x in range(1,max_num):
        for y in range(1, max_num):
            for z in range(1, max_num):
                ans_list.append([x, y, z])
    
    result_list = []
    for x, y ,z in ans_list:
        result_list.append(f(x, y, z))

    result_dict = Counter(result_list)

    for i in range(1, n+1):
        print(result_dict[i])

if __name__ == '__main__':
    main()


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

int main(void){
   int j;
   char str[21];
   char *str_pointer;
   char *ret;
   
   scanf("%s",str);
  str_pointer = str;
   
   ret = strchr(str,'\0');
   
   if(ret != 0){
      j = ret - str_pointer - 1;
   }
   
   for(;j>=0;j--){
      printf("%c",str[j]);
   }
   printf("\n");
   return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
long solve(long* arr,vector<vector<long>>& dp1,vector<vector<long>>& dp2,int s,int e,int curr){
    if(s>e){
        return 0;
    }
    if(dp1[s][e]!=-1&&curr==1){
        return dp1[s][e];
    }
    if(dp2[s][e]!=-1&&curr==0){
        return dp2[s][e];
    }
    if(curr==0){
        dp2[s][e] = -arr[s]+solve(arr,dp1,dp2,s+1,e,1);
        dp2[s][e] = min(dp2[s][e],-arr[e]+solve(arr,dp1,dp2,s,e-1,1));
        return dp2[s][e];
    }
    else{
        dp1[s][e] = arr[s]+solve(arr,dp1,dp2,s+1,e,0);
        dp1[s][e] = max(dp1[s][e],arr[e]+solve(arr,dp1,dp2,s,e-1,0));
        return dp1[s][e]; 
    }
    
}
int main() {
    int n;
    cin>>n;
    long* arr = new long[n];
    for(int i=0;i<n;i++){
        cin>>arr[i];
    }
	vector<vector<long>> dp1(n,vector<long>(n,-1));
	vector<vector<long>> dp2(n,vector<long>(n,-1));
	
	cout<<solve(arr,dp1,dp2,0,n-1,1)<<'\n';
	return 0;
}

Measured memory_bytes: 141440
#include <iostream>
#include <fstream>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <unordered_set>
#include <bitset>
#include <limits>
#include <algorithm>

#define MOD_BIG 1000000007
using std::string;
using std::cin;
using std::cout;
using std::cerr;
using std::endl;
using ll = long long;
using std::vector;

template<typename T> void ndarray(vector<T> &vec, int len) { vec.resize(len); }
template<typename T, typename... Args> void ndarray(vector<T> &vec, int len, Args... args) {
    vec.resize(len);
    for (auto &v : vec) ndarray(v, args...);
}

//////////////////////////////////////



//////////////////////////////////////

int main() {
    
    int N;
    cin >> N;
    vector<int> a(N), ainv(N);
    for (int i = 0; i < N; i++) {
        cin >> a[i];
        ainv[a[i]-1] = i;
    }
    for (int i = 0; i < N; i++) {
        cout << ainv[i]+1 << " ";
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 1664
//Jai Bhole Ki
#include <bits/stdc++.h>
using namespace std;
#define fast static int fastline = []() { std::ios::sync_with_stdio(false); cin.tie(NULL); return 0; }();
#define ll long long
#define LL unsigned ll
#define pb push_back
#define pi pair<ll,ll>
#define debug(x) cout<<x<<"\n";
#define debug cout<<"debugged\n";
#define minval -2e9
#define maxval 2e9
long double PI =3.14159265358979323846;
 
const ll M=1e7+7;
const ll inf=1e18;
const ll ms=2e5+5;
fast;
void solve()
{
    ll n,m;
    cin>>n>>m;ll ar[n];
    for(int i=0;i<n;i++)
        cin>>ar[i];
    ll temp,ans;
    temp=ans=0;
    for(int i=1;i<m;i++)
        temp+=ar[i]-ar[i-1];
    ans=temp+min(abs(ar[0]),abs(ar[m-1]));
    for(int i=m;i<n;i++)
    {
        temp+=ar[i]-ar[i-1];
        temp-=ar[i-m+1]-ar[i-m];
        ans=min(ans,temp+min(abs(ar[i-m+1]),abs(ar[i])));
    }
    cout<<ans;
}
int main()
{
 // freopen("input.txt","r",stdin);
//  freopen("output.txt","w",stdout);
    //int t;cin>>t;for(int te=1;te<=t;te++)
    {
        solve();
    }
    return 0;
}

Measured memory_bytes: 1024
#define _USE_MATH_DEFINES
 
#include <bits/stdc++.h>
 
#define sz(x) (int)((x).size())
#define endl '\n'
#define x first
#define y second
#define int long long
#define double long double
#define all(a) (a).begin(), (a).end()
#define ar vector
#define vse(a) a.begin(), a.end()
 
#ifdef LOCAL
	#define dbg(x) cout << #x << " = " << x << endl;
#else 
	#define dbg(x)
#endif 
 
using namespace std;
 
void solve(); signed main() {
#ifdef LOCAL
    freopen("file1.txt", "r", stdin);                                       
    freopen("file2.txt", "w", stderr);
#endif
    srand(time(0));
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cout.setf(ios::fixed); cout.precision(15);
    solve();  	
}
 
void solve() {                                                  
	int n, k;
	cin >> n >> k;

	double ans = 0;
	for (int i = 1; i <= n; ++i) {
	 	int num = i, cnt = 0;
	 	while (num < k) {
	 	 	num *= 2;
	 	 	cnt++;
	 	}
	 	double cur = 1;
	 	for (int j = 0; j < cnt; ++j) {
	 		cur *= 0.5; 	
	 	}
	 	ans += (1 / (double)n) * cur;
	}
	
	cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
/**
******************* Author:Bisnu sarkar ****************************
**/
#define ull            unsigned long long
#define ll             long long
#define pii            pair<int,int>
#define sit            set<int> :: iterator
#define vrit           vector<int> :: reverse iterator
#define ff             first
#define ss             second
#define endl           '\n';
#define sz(s)          (int)s.size()
#define all(s)         s.begin(),s.end()
#define IO             ios_base::sync_with_stdio(false),cin.tie(NULL);  
#define what_is(x)     cerr << #x << " is " << x << endl;
///*....Debugger....*///
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {cout << endl;}
template<typename T, typename... Args> void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " = " << a << ", ";
  err(++it, args...);
}
///*....Input....*///
template <typename T> inline void Int(T &n) {
  n = 0; int f = 1; register int ch = getchar();
  for (; !isdigit(ch); ch = getchar()) if (ch == '-') f = -1;
  for (; isdigit(ch); ch = getchar()) n = (n << 3) + (n << 1) + ch - '0';
  n = n * f;
}
 
template <typename T, typename TT> inline void Int(T &n, TT &m) { Int(n); Int(m); }
template <typename T, typename TT, typename TTT> inline void Int(T &n, TT &m, TTT &l) { Int(n, m); Int(l);}
double ind(){double x; scanf("%lf",&x);return x;}

///*....Bitmask....*///
int set_1(int n,int pos){return n = (n | (1<<pos));}
int reset_0(int n,int pos){return n= n & ~(1<<pos);}
bool check_bit(int n,int pos){return n = n & (1<<pos);}

int dx[8]= {1,0,-1,0,-1,-1,1,1};
int dy[8]= {0,1,0,-1,-1,1,-1,1};

///*....Constraints....*///
const int N = (int) 1e6 + 5;
const int M = (int) 1e9 + 7;
const double pi=2* acos(0.0);
const double eps=1e-9;


int main()
{
    int t=1,te=0;
    //Int(t);
    while(t--){
        int n;
        Int(n);
        ll res=0ll;
        for(int i=1;i<=n;++i){
            for(int j=1;j<=n;++j){
                for(int k=1;k<=n;++k){
                    int g =__gcd(j,k);
                    g=__gcd(i,g);
                    res+=(ll)g;
                }
            }
        }     
        printf("%lld\n", res);

        //printf("Case %d: ",++te);
    }
    return 0;
}



Measured memory_bytes: 3764
import java.util.*;

public class Main{
	int INF = 1 << 30;
	
	class C{
		int x, d;

		public C(int x, int d) {
			this.x = x;
			this.d = d;
		}

		public String toString() {
			return "C [x=" + x + ", d=" + d + "]";
		}
		
	}
	
	//0250 cording
	//0319 cording end
	private void doit(){
		Scanner sc = new Scanner(System.in);
		final int collength = 10;
		ArrayList<ArrayList<C>> data = new ArrayList<ArrayList<C>>();
		final int MMAX = (150+1)/2 + 1;
		long [][][] dp = new long[150][collength][MMAX];
		while(true){
			int n = sc.nextInt();
			int m = sc.nextInt();
			if((n|m) == 0) break;
			data.clear();
			for(int i = 0; i < 150; i++){
				for(int j = 0; j < collength; j++){
					Arrays.fill(dp[i][j], INF);
				}
			}
			int maxcol = 0;
			for(int i = 0; i < n; i++){
				int k = sc.nextInt();
				data.add(new ArrayList<C>());
				for(int j = 0; j < k; j++){
					int x = sc.nextInt() - 1;
					int d = sc.nextInt();
					data.get(i).add(new C(x,d));
					maxcol = Math.max(maxcol, x);
				}
			}
			
			for(int i = 0; i < data.get(0).size(); i++){
				dp[0][i][m] = 0;
			}
			//modified
			if(m > 0){
				for(int i = 0; i < data.get(1).size(); i++){
					dp[1][i][m-1] = 0;
				}
			}
			
			for(int i = 0; i < n-1; i++){
				for(int j = 0; j < data.get(i).size(); j++){
					for(int k = 0; k <= m; k++){
						if(dp[i][j][k] == INF)continue;
						
						for(int jumpoffset = 1; jumpoffset <= 2; jumpoffset++){
							int nexty= i + jumpoffset;
							if(nexty >= n){
								continue;
							}
							int kValue = k - jumpoffset + 1;
							if(kValue < 0) continue;
							for(int normalind= 0; normalind < data.get(nexty).size(); normalind++){
								long diff = Math.abs(data.get(i).get(j).x - data.get(nexty).get(normalind).x);
								long slip = data.get(i).get(j).d + data.get(nexty).get(normalind).d;
								long value1 = slip * diff;
								long value2 = dp[i][j][k] + value1;
								dp[nexty][normalind][kValue] = Math.min(dp[nexty][normalind][kValue], value2);
							}
						}
					}
				}
			}
			long max = Integer.MAX_VALUE;
			for(int i = 0; i < data.get(n-1).size(); i++){
				for(int j = 0; j <= m; j++){
					max = Math.min(max, dp[n-1][i][j]);
				}
			}
			for(int i = 0; i < data.get(n-2).size(); i++){
				for(int j = 1; j <= m; j++){
					max = Math.min(max, dp[n-2][i][j]);
				}
			}
			//System.out.print("ans = ");
			System.out.println(max);
			
			//debug
			
//			for(int k = 0; k <= m; k++){
//				System.out.println("k= " + k);
//				for(int i = 0; i < n; i++){
//					for(int j = 0; j < data.get(i).size(); j++){
//						System.out.print(dp[i][j][k] + " ");
//					}
//					System.out.println();
//				}
//			}
			
		}
	}

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

Measured memory_bytes: 14000
import sys
input = sys.stdin.readline
n,t=map(int,input().split())
a=list(map(int,input().split()))
m=a[0]
M=0
for i in range(1,n):
    m=min(m,a[i-1])
    M=max(M,a[i]-m)
m=a[0]
ans=0
for i in range(1,n):
    m=min(m,a[i-1])
    if a[i]-m==M:
        ans+=1
print(ans)


Measured memory_bytes: 58864
#include <iostream>
	#include <vector>
	#include <algorithm>
	using namespace std;
	int main(){
	vector <long> housePoss;
	long p;
	long houseNum;
	long housePos;
	long longestDis=0;
	long minDis;
	cin>> p>>houseNum;
	while(houseNum>0){
		cin>> housePos;
		housePoss.push_back(housePos);
		--houseNum;
	}
	sort(housePoss.begin(), housePoss.end());//sort min to max
	for (int i=1; i<housePoss.size();++i)
		if (housePoss[i]-housePoss[i-1]>longestDis)
			longestDis= housePoss[i]-housePoss[i-1];
	if(p-housePoss[housePoss.size()-1]+housePoss[0]>longestDis)
		longestDis=	p-housePoss[housePoss.size()-1]+housePoss[0];//medir la distancia entre el primer vector y el ultimo vector (POR DETRAS DEL CIRCULO) 
	minDis= p-longestDis;
	cout<< minDis<< endl;
	return 0;
	}



Measured memory_bytes: 2420
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
#define all(x) (x).begin(),(x).end()
#define pll pair<ll,ll>
#define pii pair<int,int>
#define rep(i,n) for(int i=0;i<n;i++)
#define sz(x) ((ll)(x).size())
#define pb push_back
#define mp make_pair
#define bit(n) (1LL<<(n))
#define F first
#define S second
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
const ll INF = 1LL<<60;
const ll mod = (int)1e9 + 7;

/*
テストケース全てに目を通す
テストケースが2個以下だったらなんかある
N最小のコーナーケースがないか調べる
制約をしっかりと確認する（1からNまでの順列、全て異なる値などの制約も含め）
制約のn*mとn,mを読み違えない
操作の逆順を考える
オーバーフローしないか確かめる
Codeforcesではscanfを使う
modの引き算には+modをする
エラー出力は消す
エラー出力を消せ！！！！！
数値の区切り位置を誤読しない
cout << fixed;
cout << setprecision(n) << ans;
 */

int main() {
    int n;
    cin >> n;
    string s;
    cin >> s;
    ll cnt[26]={};
    rep(i,n){
        cnt[s[i]-'a']++;
    }
    ll sum=1;
    rep(i,26){
        sum*=(cnt[i]+1);
        sum%=mod;
    }
    sum+=mod-1;
    sum%=mod;
    cout << sum;



    
}

/*
*/



Measured memory_bytes: 512
#include "bits/stdc++.h"
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define all(s) s.begin(), s.end()
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<string> vs;
const int MX = 100005, INF = 1001001001;
const ll LINF = 1e18;
const double eps = 1e-10;
const int DIV = 2e9+7;

int main() {
    int n, k;
    cin >> n >> k;
    ll zero = 0;
    ll hanbun = 0;
    rrep(i, n) {
        if (i % k == 0) zero++;
        if (k % 2 == 0 && i % k == k / 2) hanbun++;
    }
    if (k % 2 == 0) cout << zero * zero * zero + hanbun * hanbun * hanbun << endl;
    else cout << zero * zero * zero << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <vector>
#include <stack>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <math.h>
#include <map>
#include <list>
using namespace std;

int main()
{
  int i,N; cin >> N;
  map<long,int> mp;
  
  for(i = 0; i < N; i++){
    long x; cin >> x;
    if(mp[x] == 0 )mp[x]++;
    else if(mp[x] != 0 )mp[x]--;
  }
  
  int count = 0;
  for(auto itr = mp.begin(); itr != mp.end(); ++itr){
    if(itr -> second != 0) count++;
  }

  cout << count << endl;
  
}

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

int main(){
  int n,m,c,i,j,k,ans=0,count=0;
  cin >>n>>m>>c;
  int b[m],a[n][m];
  for(i=0;i<m;i++){
    cin >> b[i];
    //cout << b[i];
  }
//  cout << endl;
  for(i=0;i<n;i++){
    for(j=0;j<m;j++){
      cin >> a[i][j];
      ans=ans+a[i][j]*b[j];
    //  cout << a[i][j];
    }
    ans=ans+c;
    if(ans>0){count++;}
    ans=0;
    //cout << endl;
  }
  cout << count;
  return 0;
}


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

void solve(long long N, long long Y){
	long long a = -1 ,b = -1,c = -1;
	for (long long i = 0; i <= N; i++) {
		for (long long j = 0; j <= N-i; j++) {
			if (10000*(N-i-j)+5000*j+1000*i == Y) {
				a = (N-i-j); b = j; c = i;
			}
		}
	}
	printf("%lld %lld %lld\n",a,b,c);
}

int main(){
	long long Y;
	long long N;
	scanf("%lld",&N);
	scanf("%lld",&Y);
	solve(N, Y);
	return 0;
}


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

using ll = long long;

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    
    int n;
    cin >> n;
    vector<ll> a(n);
    for(int i=0; i<n; i++) {
        cin >> a[i];
    }
    ll res = 0, curr = a[0];
    for(int i=1; i<n; i++) {
        if(a[i] <= curr) {
            res += curr - a[i];
        }
        else {
            curr = a[i];
        }
    }
    cout << res << endl;
    
    return 0;
}

Measured memory_bytes: 4780
import java.util.*;
public class Main{
 public static void main(String[] args){
   Scanner sc = new Scanner(System.in);
 
   String S = sc.next();
   String M = sc.next();
   
   if(S.equals(M)) System.out.println("EQUAL");
   else if(S.length()>M.length()) System.out.println("GREATER");
   else if(S.length()<M.length()) System.out.println("LESS");
   else
   {
     String[] m ={S,M};
     Arrays.sort(m);
     
     if(S.equals(m[1])) System.out.println("GREATER");
     else System.out.println("LESS");
   }
 }
}

Measured memory_bytes: 21844
N = []
for k in range(int(input())):
  N.append(input())

count = 0
AC = 0
WA = 0
TLE = 0
RE = 0

for i in N:
    if i == "AC":
        AC += 1
    elif i == "WA":
        WA += 1
    elif i == "TLE":
        TLE += 1
    elif i == "RE":
        RE += 1


print('AC x ',AC,
      '\nWA x ',WA,
      '\nTLE x ',TLE,
      '\nRE x ',RE)

Measured memory_bytes: 16164
#include <stdio.h>

int main(void)
{
	int X, i, fiveh, five;
	
	i = 0;
	fiveh = 0;
	five = 0;
	
	scanf("%d", &X);
	
	while(i == 0){
		if ((X-500) >= 0){
			fiveh++;
			X = X - 500;
		}
		else i++;
	}
		
	i = 0;
		
	while(i == 0){
		if ((X-5) >= 0){
			five++;
			X = X - 5;
		}
		else i++;
	}
	
	printf("\n%d", 1000 * fiveh + 5 * five);
	
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define inf 1001001001001001001
#define mod 1000000007
#define mod2 998244353
#define pi acos(-1)
#define all(v) v.begin(),v.end()

ll gcd(ll a,ll b){
    if(b>a) swap(a,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;
}
ll rep_jijo(ll n,ll x){
    if(x==0) return 1;
    if(x%2==0){
        ll t=rep_jijo(n,x/2);
        return t*t;
    }
    return n*rep_jijo(n,x-1);
}

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

Measured memory_bytes: 3672
import sys

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


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


def main():
    input = sys.stdin.readline
    A, B, C, D = map(int, input().split())
    E = lcm(C, D)

    total = B - A + 1
    mul_c = max(0, B // C) - max(0, (A-1) // C)
    mul_d = max(0, B // D) - max(0, (A-1) // D)
    mul_e = max(0, B // E) - max(0, (A-1) // E)
    return total - (mul_c + mul_d - mul_e)


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


Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <iomanip>
#define rep(i,n) Rep(i,0,n)
#define Rep(i,k,n) for(int i=k ; i<n ; i++)
#define rep1(i,n) for(int i=1 ; i<=n ; i++)
#define vi vector<int>
#define vii vector<int,int>
#define Sort(v) sort(v.begin(),v.end())
#define Reverse(v) reverse(v.begin(),v.end())

//const int MOD = 1000000007;
//const int INF = 1<<30;
using namespace std;

string disp(bool x){
    return x ? "Yes" : "No";
}

int main(){
    double a,b,C;
    cin >> a >> b >> C;
    
    double pi = acos(-1);
    double rad = C/360*2*pi;
    
    double S = 0.5 * a * b * sin(rad);
    
    double c = sqrt(a*a+b*b-2*a*b*cos(rad));
    double L = a+b+c;
    
    double h = S/a*2;
    
    cout << fixed;
    cout << setprecision(6) << S <<endl;
    cout << setprecision(6) << L << endl;
    cout << setprecision(6) << h << endl;
    
}
    
    







Measured memory_bytes: 3552
#include<iostream>
#include<string>
#include<vector>

using namespace std;

#define MOD 1000000007

template<typename T>
istream& operator >> (istream& is, vector<T>& vec) {
	for (T& x : vec) is >> x;
	return is;
}

int main() {
	int a[] = { 1,3,5,7,8,10,12 };
	int x, y;
	cin >> x >> y;
	if (x == 2 || y == 2) {
		cout << "No" << endl;
		return 0;
	}
	for (int i = 0; i < 7; i++)
	{
		if (a[i] == x) {
			for (int i = 0; i < 7; i++)
			{
				if (a[i] == y)
				{
					cout << "Yes" << endl;
					return 0;
				}
			}
			cout << "No" << endl;
			return 0;
		}
	}
	for (int i = 0; i < 7; i++)
	{
		if (a[i] == y)
		{
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;
}

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

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

	int ans = 0;
	for(int i = 1; i <= 9; i++){
		for(int j = 0; j <= 9; j++){
			for(int k = 0; k <= 9; k++){
				int x = 10001*i + 1010*j + 100*k;
				if(a <= x && x <= b)
					ans++;
			}
		}
	}
	cout << ans << endl;
}

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

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

    int p[n];
    for (int i = 0; i < n; i++) cin >> p[i];

    sort(p, p + n);

    int sum = 0;
    for (int i = 0; i < n; i++) {
        if (i == n - 1) {
            sum += p[i] / 2;
        } else {
            sum += p[i];
        }
    }

    cout << sum << endl;

    return 0;
}


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

#define MAX 100


int main() {


    int a[MAX] = {};
    int i,j,N;
    int ans,min_res;
    scanf("%d",&N);
    for(i=0; i<N; i++) scanf("%d",&a[i]);

    ans = -100;
    min_res = 1e+9;
    
    for(i=-100; i<=100; i++) {
	int res = 0;
	for(j=0; j<N; j++) {
	    res += (a[j] - i)*(a[j] - i);
	}
	if( min_res > res ) {
	    min_res = res;
	    ans = i;
	}
    }
    printf("%d\n",min_res);
    
}


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

#define ll             long long
#define LL             long long
#define pii            pair<int, int>
#define pll            pair<ll, ll>
#define pil            pair<int, ll>
#define pli            pair<ll, int>
#define vi             vector<int>
#define vl             vector<ll>
#define vii            vector<pii>
#define vll            vector<pll>
#define vil            vector<pil>
#define vli            vector<pli>
#define pb             push_back
#define ppb            pop_back
#define mp             make_pair
#define ff             first
#define ss             second
#define sz(x)          (int)x.size()
#define TN             typename
#define all(v)         v.begin(), v.end()
#define fill(a, b)     memset(a, b, sizeof(a))
#define endl           '\n'

template <TN T> T gcd(T a, T b) {return !b ? a : gcd(b, a % b);}
template <TN T> T lcm(T a, T b) {return a * (b / gcd(a, b));}
template <TN T> T sqr(T a) {return a * a;}
template <TN T> T cube(T a) {return a * a * a;}
template <TN T> inline void smin(T &a, T b) {a = a < b ? a : b;}
template <TN T> inline void smax(T &a, T b) {a = a > b ? a : b;}

template <TN T> inline void Int(T &n) {
	n = 0; int f = 1; register int ch = getchar();
	for (; !isdigit(ch); ch = getchar()) if (ch == '-') f = -1;
	for (; isdigit(ch); ch = getchar()) n = (n << 3) + (n << 1) + ch - '0';
	n = n * f;
}

#define error(args...) {vector <string> _v = split(#args, ','); err(_v.begin(), args); cout << endl;}
vector <string> split(const string &s, char c) {
	vector <string> v;
	stringstream ss(s); string x;
	while (getline(ss, x, c)) v.emplace_back(x);
	return move(v);
}
void err(vector <string> :: iterator it) {}
template <typename T, typename... Args>
void err(vector <string> :: iterator it, T a, Args... args) {
	cout << it -> substr((*it)[0] == ' ', it -> length()) << " = " << a << ", ";
	err(++it, args...);
}

inline int in() {int n; scanf("%d", &n); return n;}
inline ll Lin() {ll n; scanf("%lld", &n); return n;}
inline double Din() {double n; scanf("%lf", &n); return n;}

inline int add(int a, int b, int mod) {a += b; return a >= mod ? a - mod : a;}
inline int sub(int a, int b, int mod) {a -= b; return a < 0 ? a + mod : a;}
inline int mul(int a, int b, int mod) {return (ll)a * b % mod;}

const int N          = 3e3 + 5;
const ll  Mod        = (ll)1e9 + 7;
const int inf        = (int)2e9;
const ll  Inf        = (ll)1e18;
const int mod        = (int)1e9 + 7;

double dp[N];

int solve() {
	int n = in();
	dp[0] = 1;
	for (int coin = 1; coin <= n; coin++) {
		double p = Din();
		for (int i = coin; i >= 0; i--) {
			dp[i] = (i == 0 ? 0 : dp[i - 1]) * p + dp[i] * (1 - p);
		}
	}
	double ans = 0;
	for (int i = 1; i <= n; i++) {
		if (i > n - i) ans += dp[i];
	}
	printf("%.10f\n", ans);
	return 0;
}

int main() {
	int test = 1, tc = 0;
	//scanf("%d", &test);
	while (test--) {
		//printf("Case %d: ", ++tc);
		solve();
	}
	return 0;
}





Measured memory_bytes: 256
// Problem : C - Sqrt Inequality
// Contest : Panasonic Programming Contest 2020
// URL : https://atcoder.jp/contests/panasonic2020/tasks/panasonic2020_c
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cp-editor)

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define eb emplace_back
#define pb push_back
#define int long long
#define vi vector<int>
#define pii pair<int,int>
#define m_p(x,y) make_pair(x,y)
#define vp vector<pair<int,int>>
#define setbits(x) __builtin_popcountll(x)
#define f first
#define se second
#define iniz(n) memset(n,0,sizeof(n))
#define inin(n) memset(n,-1,sizeof(n))
#define inimi(n) memset(n,0xc0,sizeof(n))
#define inima(n) memset(n,0x3f,sizeof(n))
#define all(v) (v).begin(),(v).end()
using namespace std;
using namespace __gnu_pbds;
template<typename T1,typename T2>istream &operator>>(istream &is, vector<pair<T1,T2>> &v) { for (pair<T1,T2> &t : v) is >> t.f>>t.se; return is; }
template<typename T>istream &operator>>(istream &is, vector<T> &v) { for (T &t : v) is >> t; return is; }
template<typename T>ostream &operator<<(ostream &os, const vector<T> &v) { for (const T &t : v) {os << t <<" ";} os << '\n'; return os; }
double pi=acos(-1.0);
int md=1000000007;
int abst(int a)
{return a<0?-a:a;}
template<class T> using ordered_set=tree<
T,
null_type,
less_equal<T>,
rb_tree_tag,
tree_order_statistics_node_update>;
// find_by_order(k)  returns iterator to kth element starting from 0;
// order_of_key(k) returns count of elements strictly smaller than k;
struct HASH{
  size_t operator()(const pii &x)const{
    return (size_t) x.first * 37U + (size_t) x.second;}};
int nxt()
{int x;cin>>x;return x;}
struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

int Pow(int n,int x){int ans=1;
 while(x>0)
 {if(x&1)ans=(ans*n)%md;n=(n*n)%md;x=x>>1;}
 return ans;}

 vi fact,inv;
void inverse(int n)
{inv.resize(n+1);inv[0]=1;
for(int i=1;i<=n;i++)inv[i]=Pow(fact[i],md-2);}
void factorial(int n)
{fact.resize(n+1);fact[0]=1;
for(int i=1;i<=n;i++)fact[i]=(fact[i-1]*i)%md;}

int max(int a,int b){return a>b?a:b;}
int min(int a,int b){return a<b?a:b;}
//create(tree,node,a,start,end)
//query(tree,node,start,end,l,r)
//update(tree,node,start,end,index,value)
void solve()
{
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int a,b,c;cin>>a>>b>>c;
if(c-a-b>2 and (c-a-b)*(c-a-b)>(4*a*b))
cout<<"Yes";
else
cout<<"No";
}

int32_t main(){
ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
int t=1;
//t=nxt();
while(t--)
{
    solve();
}
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define debug(...)   printf( __VA_ARGS__ )
//#define debug(...)   /****nothing****/
#define pb push_back
#define mp make_pair
#define LL long long
#define resett(arr,val,N) for(int ii=0;ii<(N);ii++) arr[ii]=val;
int n,a,b;
int main()
{
    //freopen("d://i.txt","r",stdin);
    //freopen("d://o.txt","w",stdout);
    //ios::sync_with_stdio(false), cin.tie(0), cout.tie(0) ;
    while(cin>>n>>a>>b)
    {
        printf((b-a-1)%2==0?"Borys\n":"Alice\n");
    }

    return 0;
}



Measured memory_bytes: 256
#include <iostream>

using namespace std;

typedef long long ll;

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

int main(){
  ll a,b;
  while (cin>>a>>b){
    ll g,l;
    g=gcd(a,b);
    l=a*b/g;
    cout<<g<<" "<<l<<endl;
  }
  return 0;
}

Measured memory_bytes: 1152
fn main(){
    let mut buf = String::new();
    std::io::stdin().read_line(&mut buf).expect("failed to read");
    
    let r: u32 = buf.trim().chars().fold(0, |r, c| (c.to_digit(10).unwrap() + r) % 9);
    println!("{}", if r == 0 { "Yes" } else { "No" })
        
}


Measured memory_bytes: 2244
import java.io.PrintWriter

fun main() {
    val pw = PrintWriter(System.out)

    var (a, b, c, d) = readInputLine().split(" ").map { it.toInt() }

    while (true) {
        c -= b
        if (c <= 0) {
            println("Yes")
            break
        }
        a -= d
        if (a <= 0) {
            println("No")
            break
        }
    }

    pw.flush()
}

fun readInputLine(): String {
    return readLine()!!
}


Measured memory_bytes: 36420
import java.util.*;

public class Main {
    public static Scanner sc = new Scanner(System.in);
    public static void main(String[] args) throws Exception {
        long a = sc.nextLong();
        long b = sc.nextLong();
        long c = sc.nextLong();
        
        if (a%2==0||b%2==0||c%2==0) {
            System.out.println(0);
        } else {
            long ret = Long.MAX_VALUE;
            ret = Math.min(ret, a*b);
            ret = Math.min(ret, a*c);
            ret = Math.min(ret, b*c);
            System.out.println(ret);
        }
    }
}


Measured memory_bytes: 9424
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
using namespace std;
int main() {
	double n,sm=0;
	int i;
	cin >> n;
	vector<double> x(n);
	vector<string> y(n);
	for(i = 0; i < n; ++i) {
		cin >> x.at(i) >> y.at(i);
		if(y.at(i) == "BTC")
			x.at(i) *= 380000.0;
	}
	for(i = 0; i < n; ++i)
		sm += x.at(i);
	cout <<fixed<< sm << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>

int main()
{
  int N;
  std::cin >> N;
  std::vector<int> A(N), B(N), C(N);
  for (int i = 0; i < N; i++) std::cin >> A.at(i);
  for (int i = 0; i < N; i++) std::cin >> B.at(i);
  for (int i = 0; i < N; i++) std::cin >> C.at(i);
  sort(A.begin(), A.end());
  sort(B.begin(), B.end());
  sort(C.begin(), C.end());
  std::vector<long long> countA(N), countB(N);
  for (int i = 0; i < N; i++)
  {
    int num = 0;
    int lower = 0, upper = N-1;
    if (B.at(lower) > A.at(i)) num = N;
    else if (B.at(upper) <= A.at(i)) num = 0;
    else
    {
      while(upper - lower != 1)
      {
        int mid = (upper + lower)/2;
        if (B.at(mid) <= A.at(i)) lower = mid;
        else upper = mid;
      }
      num = N-upper;
    }
    countA.at(i) = num;
  }
  for (int i = 0; i < N; i++)
  {
    int num = 0;
    int lower = 0, upper = N-1;
    if (C.at(lower) > B.at(i)) num = N;
    else if (C.at(upper) <= B.at(i)) num = 0;
    else
    {
      while(upper - lower != 1)
      {
        int mid = (upper + lower)/2;
        if (C.at(mid) <= B.at(i)) lower = mid;
        else upper = mid;
      }
      num = N-upper;
    }
    countB.at(i) = num;
  }
  reverse(countA.begin(), countA.end());
  reverse(countB.begin(), countB.end());
  long long ans = 0;
  int index = 0;
  for (int i = 0; i < N; i++)
  {
    long long tmp = 0;
    // std::cout << "check: i = " << i << ", countA.at(i) =  " << countA.at(i) << std::endl;
    for (int j = index; j < countA.at(i); j++)
    {
      tmp += countB.at(j);
      // std::cout << "       j = " << j << ", countB.at(j) =  " << countB.at(j) << std::endl;
    }
    // std::cout << "check: i = " << i << ", tmp = " << tmp << ", N-i = " << N-i << std::endl;
    ans += tmp * (N-i);
    index = countA.at(i);
    if (index == countA.at(N-1)) break;
  }
  std::cout << ans << std::endl;
}


Measured memory_bytes: 3072
# coding: utf-8

# https://atcoder.jp/contests/abc115


def main():
    N, K = map(int, input().split())
    h = [None] * N
    for i in range(N):
        h[i] = int(input())

    h = sorted(h)

    diff = 10**10
    for i in range(N-K+1):
        newdiff = h[i+K-1]-h[i]
        if newdiff < diff:
            diff = newdiff

    return diff


print(main())


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

ll x = 1e9 + 7; 

int main() {
  ll n, k;
  cin >> n >> k;
  ll ans = 0;
  if (n < k) {
    ans = min(n, abs(n-k));
  }
  else if (n%k == 0) ans = 0;
  else ans = min(n%k, abs(n%k - k));
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3404
#include <stdio.h>

int main()
{
	int i,j;
	int N, M, max, maxidx;
	max = maxidx = 0;
	
	scanf("%d %d",&N,&M);
	
	int dataA[N],dataB[M],dataC[N];
	
	for(i=0; i<N; i++)
	{
		scanf("%d",&dataA[i]); //dataA?????\???
		//printf("???????????°??????%d\n",&dataA[i]);
		dataC[i] = 0; //dataC????????????
	}
	for(j=0; j<M; j++)
	{
		scanf("%d",&dataB[j]);
		//printf("???????????°2???%d\n",&dataB[j]);
	}
	
	for(j=0; j<M; j++)
	{
		
		for(i=0; i<N; i++)
		{
			if(dataB[j]>=dataA[i])
			{
				dataC[i]++;
				//printf("???????????°3???%d %d\n",j,i);
				break;
			}
		}
		
	}
	
	for(i=0; i<N; i++)
	{
		if(max<dataC[i])
		{
			max = dataC[i];
			maxidx = i+1;
		}
	}
	
	printf("%d\n",maxidx);
	
	return 0;
}

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


#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()

using namespace std;
typedef long long ll; typedef vector<int> VI; typedef pair<int,int> pii;
const int MD = (int)1e9 + 7; typedef vector<ll> VL;
void dbg(){ cerr << "\n"; }  template <class T, class ...T2>
void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }
template <class T, class T2> void amax(T& a,T2 b){ if(a < b) a = b;}




int main()
{
	cin.tie(0); ios_base::sync_with_stdio(false);
	ll n;
	cin >>n;
	VI a(n);
	rep(i, n) cin >>a[i];
	
	VI sk(100010), tk(4);
	rep(i, n) sk[a[i]]++;
	rep(i, 100001){
		if(sk[i]>2 ) sk[i] = sk[i]%2? 1: 2;
		tk[sk[i]]++;
	}
	cout << tk[1] + tk[2] - (tk[2]%2) <<"\n";
	return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define MAXN 200005
#define ll long long
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(c) (c).begin(), (c).end()
#define KONJ 42-42
using namespace std;

multiset <ll, greater <ll> > ms;
ll n, m, y, sol;
bool flag;

int main()
{
//	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	
	cin >> n >> m;
	for (int i = 0; i < n; i++) {
		ll x; cin >> x;
		ms.insert(x);
	}
	/*int koliko = 0;*/
	while (m) {
		y = *ms.begin();
		ms.erase(ms.begin());
		/*for (auto it = ms.begin(); it != ms.end(); ++it) {cout << *it << " ";}*/
		if (not(ms.size())) {
			flag++; break;
		}
		while (y >= *ms.begin() and m) {
			y /= 2; m--;
		}
		/*cout << " - " << y << endl;*/
		if (y) ms.insert(y);
		/*koliko++; if (koliko > 10) {return 0;}*/
	}
	if (flag) {
		while (y and m) {
			y /= 2; m--;
		}
		cout << y;
	}
	else {
		for (auto it = ms.begin(); it != ms.end(); ++it) {
			sol += *it;
		}
		cout << sol;
	}
	return 0;
}


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

int main(void) {
    int n, m;
    vector<string> a, b;
    cin >> n >> m;
    a.resize(n);
    b.resize(m);
    for (int i = 0; i < n; i++) cin >> a[i];
    for (int i = 0; i < m; i++) cin >> b[i];
    for (int i = 0; i <= n - m; i++) {
        for (int j = 0; j <= n - m; j++) {
            bool flag = true;
            for (int k = 0; k < m; k++) {
                if (!equal(b[k].begin(), b[k].end(), a[i + k].begin() + j)) {
                    flag = false;
                    break;
                }
            }
            if (flag) {
                cout << "Yes" << endl;
                return 0;
            }
        }
    }
    cout << "No" << endl;
}


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

using namespace std;

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

    if (n % 2 == 0) {
        string t1, t2;
        t1 = s.substr(0, n/2);
        t2 = s.substr(n/2, n/2);
        if (t1 == t2) {
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
}


Measured memory_bytes: 888
#define _CRT_SECURE_NO_WARNINGS
#include <cstdio>
#include <cstring>

using namespace std;

template<class T> void gc(T &x)
{
    char k;
    x[0] = '\0';

    int i = 0;
    while (true)
    {
        k = getchar_unlocked();

        if (k < 'A' || k > 'Z') break;
        x[i] = k;
        i++;
    }
    x[i] = '\0';
}

int main()
{
    const char A = 'A';
    const char Z = 'Z';

    char s[200001];

    gc(s);

    int len = strlen(s);

    int apos = 0;
    for (int i = 0; i < len; i++)
    {
        if (s[i] == A)
        {
            apos = i;
            break;
        }
    }

    int zpos = 0;
    for (int i = len - 1; 0 <= i; i--)
    {
        if (s[i] == Z)
        {
            zpos = i;
            break;
        }
    }

    printf("%d\n", zpos - apos + 1);
    return 0;
}


Measured memory_bytes: 384
# coding: utf-8
import sys
from collections import deque

stdin = sys.stdin
ns = lambda: stdin.readline().rstrip() # ignore trailing spaces
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))


def main():
    n,m = na()
    path = [[] for _ in range(n)]
    ans = [0] + [-1 for i in range(n-1)]
    sumcheck = 1
    for _ in range(m):
        a,b = na()
        a -= 1
        b -= 1
        path[a] += [b]
        path[b] += [a]
    d = deque([0])
    while len(d):
        now = d.popleft()
        for nxt in path[now]:
            if ans[nxt] == -1:
                ans[nxt] = now
                sumcheck += 1
                d.append(nxt)
    if sumcheck == n:
        print('Yes')
        for i in ans[1:]:
            print(i+1)
    else:
        print('No')
    return


if __name__ == '__main__':
    main()

Measured memory_bytes: 95936
#include <algorithm>
#include <iostream>
using namespace std;
int T, card[16];

bool is_same_number(int a, int b, int c){
  return ((a==b)&&(b==c));
  }

bool is_sequence(int a, int b, int c){
  return (((a+2)==(b+1))&&((b+1)==c));
  }

bool is_good_set(int a, int b, int c) {
  return is_same_number(a,b,c) || is_sequence(a,b,c);
  }
  
bool is_all_good_set() {
  return ((is_good_set(card[0],card[1],card[2]))&&(is_good_set(card[3],card[4],card[5]))&&
  (is_good_set(card[6],card[7],card[8])));
  }

bool win() {
  sort(card,card+9);
  do { if(is_all_good_set()){
    return true;
	 }
	} while(next_permutation(card, card+9));
	return false;
	}
  
int main() {
  cin >> T;
  for (int t=0; t < T; ++t) {
    for (int i=0; i < 9; ++i) {
	  cin >> card[i];
	}
	string color;
	for (int i=0; i<9; ++i) {
	  cin >> color;
	    if (color == "G") card[i] += 10;
		else if (color == "B") card[i] += 20;
		}
		cout << win() << endl;
	  }
	}

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

int main(){
  int N;
  cin >> N;
  vector<long long> a(N);
  for (int i=0; i<N; i++) cin >> a[i];
  vector<long long> b(N);
  for (int i=0; i<N; i++) cin >> b[i];

  long long di = 1;
  long long ans = 0;
  for (int i=0; i<29; i++){
    vector<long long> moda(N);
    vector<long long> modb(N);
    for (int j=0; j<N; j++){
      moda[j] = a[j]%(di*2);
      modb[j] = b[j]%(di*2);
    }
    sort(modb.begin(), modb.end());
    long long tempans = 0;
    for (int j=0; j<N; j++){
      int check = moda[j];
      int T1 = lower_bound(modb.begin(),modb.end(),di-check) - modb.begin();
      int T2 = lower_bound(modb.begin(),modb.end(),di*2-check) - modb.begin();
      int T3 = lower_bound(modb.begin(),modb.end(),di*3-check) - modb.begin();
      int T4 = lower_bound(modb.begin(),modb.end(),di*4-check) - modb.begin();
      tempans += ((T2-T1) + (T4-T3))%2;
    }
    ans += di*(tempans%2);
    di *= 2;
  }
  cout << ans << endl;
}


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

int main() {
	// your code goes here
	char c[10];
	cin >> c;
	if(c[0]=='S') cout << "Cloudy" << endl;
	if(c[0]=='C') cout << "Rainy" << endl;
	if(c[0]=='R') cout << "Sunny" << endl;
	return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;

namespace MyProject
{
    class Program
    {
        static void Main(string[] args)
        {
#if Local
            var sw = new Stopwatch();
            sw.Start();
            Console.SetIn(new StreamReader("input.in"));
#endif

            var solver = new Solver();
            solver.Solve();
#if Local
            Console.WriteLine($"{sw.ElapsedMilliseconds}ms");
#endif
        }
    }

    class Solver
    {
        public void Solve()
        {
            var line1 = Console.ReadLine().Split().Select(elem => int.Parse(elem)).ToArray();
            var N = line1[0];
            var K = line1[1];
            var A = Console.ReadLine().Split().Select(elem => int.Parse(elem)).ToArray();

            var index = Array.FindIndex(A, 0, A.Length, elem => elem == 1);

            var left = (int)Math.Ceiling((index - 0) / (double)(K - 1));
            var amari = left * (K - 1) - index;
            var right = (int)Math.Ceiling((Math.Max(0, N - 1 - index - amari)) / (double)(K - 1));
            var answer = left + right;

            Console.WriteLine(answer);
        }
    }
}


Measured memory_bytes: 18016
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define sz(a) (a).size() 
#define all(c) (c).begin(),(c).end()
#define rep(i,n) for(int i=0;i<n;i++)
#define forn(i,n) for(int i=1;i<=n;i++)
#define ford(i,n) for(int i=n;i>=0;i--) 
#define REP(i,a,n) for(int i=a;i<n;i++)
#define foreach(itr,c) for(__typeof((c).begin(),(c).end())itr=c.begin();itr!=c.end();itr++) 
#define fill(a,b) memset(a,b,sizeof(a))
#define re return
#define INF 1e9
#define LINF 1e18
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pi;
typedef vector<int> vi;
typedef vector<pi > vpi; 
int n,m;
bool f[100005];
int h[100005];
vi g[100005];
bool check(int i){
	rep(j,g[i].size()){
		if(h[i]<=h[g[i][j]]){
			f[i]=0;
		}
		else{
			f[g[i][j]]=0;
		}
	}
	if(f[i]){
		re 1;
	}
	else{
		re 0;
	}
}
int main(){
	cin>>n>>m;
	rep(i,n){
		cin>>h[i];
		f[i]=1;
	}
	rep(i,m){
		int a,b;
		cin>>a>>b;
		a--;
		b--;
		g[a].pb(b);
		g[b].pb(a);
	}
	int cnt=0;
	rep(i,n){
		if(!f[i]){
			continue;
		}
		if(check(i)){
			cnt++;
		}
	}
	cout<<cnt;
	re 0;
}

Measured memory_bytes: 9256