akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int a,b,c;
    
    cin >> a;
    cin >> b;
    cin >> c;
    
    std::swap(a,b);
    std::swap(a,c);
    
    cout << a << " " << b << " " << c <<endl;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define all(a) (a).begin(), (a).end()


int main() {
    int a, b, c;
    cin >> a >> b >> c;
    if(a + b == c or a + c == b or b + c == a) cout << "Yes"<< endl;
    else cout << "No" << endl;
}


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

typedef long long ll;

const int N = 1e5 + 5;

int main()
{
    #ifdef TooLazy
        freopen("in.txt", "r", stdin);
    #endif // TooLazy

    ll x, t; cin >> x >> t;
    ll ans = x - t;
    if( ans < 0 ) {
        puts("0");
    }
    else cout << ans << "\n";

    return 0;
}


Measured memory_bytes: 256
n, m = map(int, input().split())
L = [list(map(int,input().split())) for _ in range(m)] #s_i, c_i
j = 0 if n == 1 else 10**(n-1)
for i in range(j,10**n):
    st = str(i)
    if all(st[s-1] == str(c) for s, c in L): #全てにおいて[s=c]すなわち[stのs番目の文字＝c]となるとき
        print(i)
        exit()
print(-1)

Measured memory_bytes: 3060
import java.io.*;

class Main{
  public static void main(String[] args) throws IOException{
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    StringBuilder sb = new StringBuilder();

    while(true){
    String str1 = br.readLine();
    String[] str2 = str1.split(" ");
    int H = Integer.parseInt(str2[0]);
    int W = Integer.parseInt(str2[1]);

    if(H == 0 && W == 0) {break;}

    for (int i = 0; i < H; i++){
      for (int j = 0; j < W; j++){
        if (i == 0 || i == H - 1 || j == 0 || j == W - 1)
          sb.append("#");
        else
          sb.append(".");
      }
      sb.append("\n");
    }
    sb.append("\n");
    }
    System.out.print(sb);
  }
}

Measured memory_bytes: 25568
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <sstream>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <numeric>
#include <cctype>
#include <tuple>
#include <array>
#include <cassert>

// BEGIN CUT HERE
#ifdef _MSC_VER
#include <agents.h>
#endif
// END CUT HERE 

#define FOR(i, a, b) for(int i = (int)(a); i < (int)(b); ++i)
#define rep(i, n) FOR(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define REV(v) v.rbegin(), v.rend()
#define MEMSET(v, s) memset(v, s, sizeof(v))
#define MP make_pair
#define MT make_tuple

using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef unsigned long long ull;

const double EPS = 1e-4;

vector<double> gauss_jordan(vector<vector<double>> &A, vector<double> &b){
	int n = A.size();
	auto B = A;
	rep(i, n) B[i].push_back(b[i]);

	rep(i, n){
		int p = i;
		FOR(k, i, n) if (abs(B[p][i]) < abs(B[k][i])) p = k;

		if (B[p][i] < EPS) return {};

		swap(B[i], B[p]);
		double tmp = B[i][i];
		rep(j, n + 1) B[i][j] /= tmp;
		rep(k, n) if(i != k) FOR(j, i + 1, n + 1) B[k][j] -= B[k][i]*B[i][j];
	}
	vector<double> x(n);
	rep(i, n) x[i] = B[i][n];

	return x;
}

double calc(vector<double> &a, double x){
	double res = 0;
	int n = a.size();
	rep(i, n) res += a[i] * pow(x, n - i - 1);
	return res;
}

int popcnt(int x){
	int res = 0;
	while (x) x &= x - 1, ++res;
	return res;
}

int main(){
	int d;
	while (cin >> d, d){
		vector<vector<double>> v(d+3);
		vector<double> b(d + 3);
		rep(i, d + 3){
			rep(j, d + 1) v[i].push_back(pow(i, d - j));
			cin >> b[i];
		}
		rep(i, d + 3){
			bool ok = true;
			rep(j, 1 << d + 3){
				if (j&(1 << i)) continue;
				if (popcnt(j) != d + 1) continue;
				vector<vector<double>> vv;
				vector<double> bv;
				rep(k, d + 3) if(j&(1<<k)) vv.push_back(v[k]), bv.push_back(b[k]);
				auto a = gauss_jordan(vv, bv);
				if (a.empty()) continue;
				int cnt = 0;
				rep(k, d + 3){
					if (k == i && abs(b[k] - calc(a, k)) < 1-EPS) ok = false;
					if (k != i && abs(b[k] - calc(a, k)) > EPS) ok = false;
					if (abs(b[k] - calc(a, k)) < 1e-5) ++cnt;
				}
				//cout << "***" << i << ": ";
				//rep(k, d + 1) cout << a[k] << ' ';
				//cout << endl;
			}
			if (ok){
				cout << i << endl;
				break;
			}
		}

	}

	return 0;
}

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

const int M[12]= {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
int main() {
//	freopen("inp.txt", "r", stdin);
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	int x, y;
	int x1, y1;
	cin >> x >> y;
	cin >> x1 >> y1;
	if (x1 == x) cout << 0;
	else cout << 1;
	return 0;
}


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

using std::deque;
const int N = 100010;
int _w;

int n, m, k, vis[N];
deque<int> ans;

namespace G {
	int head[N], nxt[N*2], to[N*2], eid;
	void init() {
		eid = 0;
		memset(head, -1, sizeof head);
	}
	void link( int u, int v ) {
		to[eid] = v, nxt[eid] = head[u], head[u] = eid++;
		to[eid] = u, nxt[eid] = head[v], head[v] = eid++;
	}
}

void solve() {
	using namespace G;
	bool flag = true;
	while( flag ) {
		flag = false;
		int u = ans.back();
		for( int i = head[u]; ~i; i = nxt[i] ) {
			int v = to[i];
			if( !vis[v] ) {
				vis[v] = 1;
				ans.push_back(v);
				++k;
				flag = true;
				break;
			}
		}
		u = ans.front();
		for( int i = head[u]; ~i; i = nxt[i] ) {
			int v = to[i];
			if( !vis[v] ) {
				vis[v] = 1;
				ans.push_front(v);
				++k;
				flag = true;
				break;
			}
		}
	}
	printf( "%d\n", k );
	while( !ans.empty() ) {
		printf( "%d ", ans.back() );
		ans.pop_back();
	}
	puts("");
}

int main() {
	_w = scanf( "%d%d", &n, &m );
	G::init();
	for( int i = 0; i < m; ++i ) {
		int u, v;
		_w = scanf( "%d%d", &u, &v );
		G::link(u, v);
		if( !i ) {
			k = 2;
			ans.push_back(u);
			ans.push_back(v);
			vis[u] = vis[v] = 1;
		}
	}
	solve();
	return 0;
}


Measured memory_bytes: 3456
#include <iostream>
#include<cstdio>
#include<set>
#include<queue>
#include<vector>
#include<map>
#include<cmath>
#include<cstdlib>
#include<algorithm>
#include<string>
#include<cstring>

using namespace std;

int main()
{
	long long n,m,cnt;
	//cin>>n>>m;
	while(cin>>n>>m){
	long long ans;
	if(m%n==0)
        ans=m/n;
    else{
	for(long long i=1;i<=m/n;i++)
    {
        if(m%i==0)
        {
            if(m/i>=n)
            {
                ans=i;
            }
        }
    }
    }
	cout<<ans<<endl;
    }
    return 0;
}
/*
3 14
10 123
100000 1000000000
4 1000000000
*/


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <tuple>
#include <deque>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
#include <sstream>
#include <complex>
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef pair<int, double> Pid;
typedef pair<double, int> Pdi;
typedef pair<ll, int> Pl;
typedef pair<int, pair<int, int>> PP;
const double PI = 3.1415926535897932;   // acos(-1)
const double EPS = 1e-15;
const int INF = 1001001001;
const int mod = 1e+9 + 7;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define chadd(x, y) x = (x + y) % mod

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

    int n;
    cin >> n;
    cout << ceil((double)n / 2) << endl;
}

Measured memory_bytes: 256
using System;
using System.Linq;

    class Program
    {
        static void Main(string[] args)
        {
            var alp = "abcdefghijklmnopqrstuvwxyz";
            var s = Console.ReadLine().Distinct().OrderBy(c=>c).ToArray();
            for(var i=0;i<alp.Length;i++)
            {
                if(s.Length<=i||s[i]!=alp[i])
                {
                    Console.WriteLine(alp[i]);
                    return;
                }
            }
            Console.WriteLine("None");
        }
    }

Measured memory_bytes: 13396
#include <bits/stdc++.h>
using namespace std;
int read(){
	int x=0;
	char ch=getchar();
	while (!isdigit(ch))
		ch=getchar();
	while (isdigit(ch))
		x=(x<<1)+(x<<3)+(ch^48),ch=getchar();
	return x;
}
const int N=100005,mod=1e9+7;
int n,a[N],in[N],size[N],vis[N],cro[N];
int q[N],head,tail;
int k[N],m;
int r[N];
void add(int &x,int y){
	if ((x+=y)>=mod)
		x-=mod;
}
int sc=0;
int Pre(int k,int n){
	return k==1?n:(k-1);
}
int solve(int n){
	int ans=1,f=0;
//	printf("solve :: n = %d   ",n);
//	for (int i=1;i<=n;i++)
//		printf(" %d",k[i]);
//	puts("");
	for (int i=1;i<=n;i++){
		if (k[i]==0)
			continue;
		f=1;
		int x=Pre(i,n);
		while (!k[x])
			x=Pre(x,n);
		int t=(i-x+n)%n;
		if (t==0)
			t+=n;
//		printf("%d :: t = %d\n",i,t);
		if (t<k[i])
			return 0;
		if (t>k[i])
			ans=2LL*ans%mod;
	}
	if (!f)
		r[n]++;
	return ans;
}
int dp[N];
int main(){
	n=read();
	memset(in,0,sizeof in);
	for (int i=1;i<=n;i++){
		in[a[i]=read()]++;
		size[i]=1;
	}
	head=tail=0;
	for (int i=1;i<=n;i++){
		if (in[i]>2)
			return puts("0"),0;
		if (in[i]==0)
			q[++tail]=i;
		if (in[i]==2)
			cro[i]=1;
	}
	while (head!=tail){
		int x=q[++head],y=a[x];
		size[y]+=size[x];
		if (!(--in[y]))
			q[++tail]=y;
	}
	for (int i=1;i<=n;i++)
		if (cro[i]&&!in[i])
			return puts("0"),0;
	int ans=1;
	memset(vis,0,sizeof vis);
	for (int i=1;i<=n;i++){
		if (in[i]==0||vis[i])
			continue;
		m=0;
		for (int x=i;!vis[x];x=a[x])
			vis[x]=1,k[++m]=size[x]-1;
		ans=1LL*ans*solve(m)%mod;
	}
	for (int i=1;i<=n;i++)
		if (r[i]>0){
			dp[0]=1,dp[1]=i>1&&(i&1)?2:1;
			for (int j=2;j<=r[i];j++)
				dp[j]=(1LL*(j-1)*i%mod*dp[j-2]+dp[j-1]*(i>1&&(i&1)?2:1))%mod;
			ans=1LL*ans*dp[r[i]]%mod;
		}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 2688
def main():
    a = int(input())
    b = int(input())
    c = int(input())
    d = int(input())
    e = int(input())
    k = int(input())

    if (e-a) <= k:
        print("Yay!")
    else:
        print(":(")


if __name__ == "__main__":
    main()
    

Measured memory_bytes: 3060
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#define FOR(n) for(int i=0;i<n;i++)
#define FORJ(n) for(int j=0;j<n;j++)
#define PRN(n) printf("%d\n",n)
#define PRF(n) printf("%lf\n",n)
#define PRL(n) printf("%lld\n",n)
#define PRS(s) printf("%s\n",s)
#define PRC(c) printf("%c",c)
#define INF 1e10
#define mod 1000000007
typedef long long int ll;
ll z(ll a){
  if(a<0)a*=-1;
  return a;
}
int u(const void *a, const void *b){
    return *(ll*)a-*(ll*)b;
}
int d(const void *a, const void *b){
    return *(ll*)b-*(ll*)a;
}
int min(int a,int b){
  if(a>b)return b;
  return a;
}
int max(int a,int b){
  if(a>b)return a;
  return b;
}
ll gcd(ll a,ll b){
  if(!b)return a;
  return gcd(b,a%b);
}
int kt(ll a){
  int sum=0;
  while(a){
    a/=10;
    sum++;
  }
  return sum;
}
int ks(ll a){
  int sum=0;
  while(a){
    sum+=a%10;
    a/=10;
  }
  return sum;
}
int main(void){
  int n,k;
  scanf("%d %d",&n,&k);
  k--;
  ll a[n];
  FOR(n)scanf("%lld",&a[i]);
  qsort(a,n,sizeof(ll),u);
  ll ans=INF;
  FOR(n-k){
    ll x;
    if(a[i]*a[i+k]<0){
      x=2*min(-a[i],a[i+k])+max(-a[i],a[i+k]);
    }else{
      x=max(z(a[i]),z(a[i+k]));
    }
    ans=min(ans,x);
  }
  PRL(ans);
  return 0;
}


Measured memory_bytes: 1276
#include <bits/stdc++.h>
 
using namespace std;
 
#define ll long long 
#define IOS ios_base :: sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define endl "\n"
#define SIZE 100005
 
int main()
{
	string s,t;
	
	cin >> s >> t;
	cout <<t+s << endl;
	return 0;
}


Measured memory_bytes: 384
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<iostream>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<utility>
#include<vector>
using namespace std;

typedef long long lint;

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

Measured memory_bytes: 256
/*																													   
 Templatka c++ Kacper Fis																							   																											   //
*/																													  
																								   
#include <bits/stdc++.h>																							   
																													   
using namespace std; 																								   
																													   
const int INF = 1000000001;																						   
const float PI = 3.14;																								   
typedef long long LL;																								   
																													   
typedef vector<int> vi;																								   
typedef list<int> li;																								   
typedef queue<int> qi; 																								   
typedef pair<int,int> ii; 																							   
typedef map<string,int> msi; //np msi['nazwa'] = 'liczba'															   
typedef vector<ii> vii; //vector par<int>, do tworzenia tablicy dla grafów wagowych #dijkstra #Bellman_Ford			   
typedef priority_queue< ii, vector<ii>, greater<ii> > pq; //kolejka priorytetowa vectorów par(top()=min) #dijkstra	   
																													   																				   
vector<ii>::iterator iter;																							   
																													   																				   
#define print_list(x) for(it = (x).begin(); it != (x).end(); it++) {cout << *it << " ";}							   
#define print_vector(x) for(it2 = (x).begin(); it2 != (x).end(); it2++) {cout << *it2 << " ";}						   
#define search_list(x) for(it = (x).begin(); it != (x).end(); it++)													   
#define search_vector(x) for(it2 = (x).begin(); it2 != (x).end(); it2++);											   
#define pb(x) push_back(x) 																							   
#define pf(x) push_front(x)																							   
#define mp(x, y) make_pair(x, y)                                                                                       
///////////////////////////////////////////////GLOBAL DEFINITIONS////////////////////////////////////////////////////////


///////////////////////////////////////////////////FUNCTIONS/////////////////////////////////////////////////////////////

void primeFactors(LL n, set<LL> &V1){
	
	while(n % 2 == 0){
		V1.insert(2);
		n /= 2;
	}
	
	for(int i = 3; i <= sqrt(n); i = i + 2){
		while(n % i == 0){
			V1.insert(i);
			n /= i;
		}
	}
	
	if(n > 2)
		V1.insert(n);
	
}
/////////////////////////////////////////////////////MAIN////////////////////////////////////////////////////////////////
int main(int argc, char* argv[])																					 
{ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);                  												       
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	
	LL a, b;
	cin >> a >> b;
	
	set<LL> V1;
	set<LL> V2;
	set<LL>::iterator it;
	
	primeFactors(a, V1);
	primeFactors(b, V2);
	
	//for(it = V1.begin(); it != V1.end(); it++){
		//cout << *it << " ";
	//}
	//cout << endl << endl;
	//for(it = V2.begin(); it != V2.end(); it++){
		//cout << *it << " ";
	//}
	
	int licznik = 0;
	
	for(it = V1.begin(); it != V1.end(); it++){
		auto it2 = V2.find(*it);
		if(it2 != V2.end())
			licznik++;
	}	
	
	cout << licznik + 1 << endl;
	
	
	return 0;
}


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

#define PI 3.14159265359
using namespace std;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define bit(n,k) (((ll)n>>(ll)k)&1) /*nのk bit目*/
const long long INF= 1e+18+1;
typedef long long ll;
//using ll=__int128;
typedef vector<ll> vl;
typedef vector<vector<ll> >vvl;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> T;
//const ll MOD=1000000007LL;
const ll MOD=998244353LL;
//const ll MAX_V=114514LL;
const ll MAX = 510000LL;
string abc="abcdefghijklmnopqrstuvwxyz";
string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
vl dx={-1,-1,-1,0,0,1,1,1};
vl dy={1,-1,0,1,-1,1,0,-1};



int main(){
  ll a;cin>>a;
  //double b;cin>>b;
  string sb;cin>>sb;
  ll b=0;
  b+=(sb[0]-'0')*100;
  if(sb.size()>=3)b+=(sb[2]-'0')*10;
  if(sb.size()>=4)b+=(sb[3]-'0');
  
  //b*=100;
  ll bb=b;
  if(a==0||b==0){
    cout<<0<<endl;
    return 0;
  }
  /*vl vec(3);
  vec[0]=bb%10;
  bb/=10;
  vec[1]=bb%10;
  bb/=10;
  vec[2]=bb%10;
  */
  ll ans=1LL;
  ans*=a;
  ans*=(ll)bb;
  ans/=100LL;
  //cout<<a<<" "<<b<<" "<<bb<<endl;
  cout<<ans<<endl;
}


Measured memory_bytes: 3624
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <numeric>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <functional>
#include <unordered_set>
  
#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
  
using namespace std;
  
typedef    long long         ll;
typedef    unsigned long long ull;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      pii;
  
const int INF=1<<29;
const double EPS=1e-9;
  
const int dx[]={1,0,-1,0,1,1,-1,-1},dy[]={0,-1,0,1,1,-1,-1,1};

int main() {
    string s;
    cin >> s;
    int x, y;
    cin >> x >> y;
    int N = s.size();

    vector<int> d;
    int cnt = 0;
    for (int i = 0; i < N; i++) {
        if (s[i] == 'T') {
            d.push_back(cnt);
            cnt = 0;
        } else {
            cnt++;
        }
    }
    d.push_back(cnt);

    int D = d.size();
    vector<unordered_set<int>> dp(D);
    dp[0].insert(d[0]);

    int xmax = ((D - 1) / 2) * 2;
    int ymax = (D / 2) * 2 - 1;

    for (int i = 2; i < D; i+=2) {
        for(auto &s : dp[i - 2]) {
            dp[i].insert(s + d[i]);
            dp[i].insert(s - d[i]);
        }
    }

    for (int i = 1; i < D; i+=2) {
        if (i == 1) {
            dp[i].insert(d[i]);
            dp[i].insert(-d[i]);
        } else {
            for(auto &s : dp[i - 2]) {
                dp[i].insert(s + d[i]);
                dp[i].insert(s - d[i]);
            }
        }
    }
    bool xok = false, yok = false;
    if (ymax == -1) {
        yok = y == 0;
    } else {
        yok = dp[ymax].find(y) != dp[ymax].end();
    }
    xok = dp[xmax].find(x) != dp[xmax].end();

    if (yok && xok) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 204544
#include <stdio.h>

void Print(int* A,int n){
  int i;
  for(i=0;i<n;i++){
    if(i)
      printf(" ");
    printf("%d",A[i]);
  }
  printf("\n");
}


void insertSort(int* A,int n){

  int i,j,v;

  for (i = 0; i < n; i++) {
    v = A[i];
    j = i-1;

    while (j>=0&& A[j]>v) {
      A[j+1] = A[j];
      j--;
    }
    A[j+1] = v;
    Print(A,n);
  }

}



int main(int argc, char const *argv[]) {

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

  insertSort(A,n);

  return 0;
}

Measured memory_bytes: 604
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, M;
    cin >> N >> M;
    string A[N], B[M];
    rep(i, N) cin >> A[i];
    rep(i, M) cin >> B[i];

    int c = N-M+1;
    int flag = 0;
    rep(k, c) {
        rep(l, c){
            flag = 1;
            rep(i, M) {
                rep(j, M) {
                    if (A[i+k][j+l] == B[i][j] && flag) flag = 1;
                    else flag = 0;
                    
                }
            }
            if (flag) {
                cout << "Yes" << endl;
                return 0;
            }
        }
    }
    cout << "No" << endl;

    return 0;
}


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

int main() {
    int n, m;
    cin >> n >> m;
    string a[n];
    string b[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 + 1; i++) {
        for (int j = 0; j < n - m + 1; j++) {
            size_t idx = a[i].find(b[0], j);
            if (idx == string::npos) continue;

            bool flag = true;
            for (int k = 1; k < m; k++) {
                if (a[i+k].find(b[k], j) != idx) {
                    flag = false;
                    break;
                }
            }

            if (flag) {
                cout << "Yes" << endl;
                return 0;
            }
        }
    }

    cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
#include <cmath>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <map>
#define  maxn   100005
#define  MOD    1000000007
#define  hashm  17982571
using namespace std;
int n,l,tot=0,cnt=0;
long long ans=0;
int f[maxn],p[maxn],b[2*maxn],dis[maxn],a[maxn],dp[2*maxn][20];
vector<int>e[maxn];
void dfs(int now,int fa,int dep)
{
    dis[now]=dep;
    int tt=tot++;
    f[tt]=now;
    p[now]=cnt;
    b[cnt++]=tt;
    for(int i=0;i<e[now].size();i++)
    {
        dfs(e[now][i],now,dep+1);
        b[cnt++]=tt;
    }
    return;
}
void rmq(int n)
{
    for(int i=0;i<n;i++) dp[i][0]=b[i];
    int m=int(log(n*1.0)/log(2.0));
    for(int i=1;i<=m;i++)
        for(int j=0;j<n-(1<<i)+1;j++) dp[j][i]=min(dp[j][i-1],dp[j+(1<<(i-1))][i-1]);
    return;
}
int lca(int l,int r)
{
    if(l>r) swap(l,r);
    int m=(int)(log(r-l+1.0)/log(2.0));
    return f[min(dp[l][m],dp[r-(1<<m)+1][m])];
}
void bfs()
{
    queue<int>q;
    q.push(1);
    l=1;
    while(!q.empty())
    {
        int x=q.front();
        q.pop();
        for(int i=0;i<e[x].size();i++)
        {
            q.push(e[x][i]);
            int yy=lca(p[l],p[e[x][i]]);
            ans+=dis[l]+dis[e[x][i]]-2*dis[yy];
            l=e[x][i];
        }
    }
}
int main()
{
    int i,j;
    scanf("%d",&n);
    for(i=2;i<=n;i++)
    {
        scanf("%d",&j);
        e[j].push_back(i);
    }
    dfs(1,0,0);
    rmq(cnt-1);
    bfs();
    printf("%lld\n",ans);
    return 0;
}

Measured memory_bytes: 32696
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string s[200005];
    long n,i;
    map<string,long>mp;
    while(cin>>n)
    {
        for(i=0;i<n;i++)
        {
            cin>>s[i];
            mp[s[i]]=i;
        }
        cout<<mp.size()<<endl;
        mp.clear();
    }
    return 0;
}


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

int main(){
  int a,b,c;
  cin>>a>>b>>c;
  if(a==5&&b==5&&c==7||a==7&&b==5&&c==5||a==5&&b==7&&c==5)
    cout<<"YES"<<endl;
  else
    cout<<"NO"<<endl;

}


Measured memory_bytes: 256
n = int(input())
list_v = list((map(int, input().split())))
list_e = list_v[::2]
list_o = list_v[1::2]
dict_e = {}
dict_o = {}
for number in set(list_e):
    dict_e[number] = 0
for i in range(0,int(n/2)):
    dict_e[list_e[i]] += 1
for number in set(list_o):
    dict_o[number] = 0
for i in range(0,int(n/2)):
    dict_o[list_o[i]] += 1
e_max = 0
o_max = 0
for key in dict_e.keys():
    if dict_e[key] > e_max:
        e_max = dict_e[key]
        e_key = key

for key in dict_o.keys():
    if dict_o[key] > o_max:
        o_max = dict_o[key]
        o_key = key
ans = o_max + e_max
if e_key == o_key:
    e_max2 = 0
    for key in dict_e.keys():
        if dict_e[key] > e_max2 and key != o_key:
            e_max2 = dict_e[key]
            e_key2 = key
    o_max2 = 0
    for key in dict_o.keys():
        if dict_o[key] > o_max2 and key != e_key:
            o_max2 = dict_o[key]
            o_key2 = key
    ans = max(e_max + o_max2, e_max2 + o_max)

print(n - ans)


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

int main()
{
	int sx, sy, tx, ty;
	cin >> sx >> sy >> tx >> ty;

	string ans="";

	int v = ty - sy, h = tx - sx;

	for (int i = 0; i < v; i++) {
		ans += 'U';
	}
	for (int i = 0; i < h; i++) {
		ans += 'R';
	}
	for (int i = 0; i < v; i++) {
		ans += 'D';
	}
	for (int i = 0; i < h; i++) {
		ans += 'L';
	}
	ans += 'L';
	for (int i = 0; i < v+1; i++) {
		ans += 'U';
	}
	for (int i = 0; i < h+1; i++) {
		ans += 'R';
	}
	ans += 'D';
	ans += 'R';
	for (int i = 0; i < v+1; i++) {
		ans += 'D';
	}
	for (int i = 0; i < h+1; i++) {
		ans += 'L';
	}
	ans += 'U';

	cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
(defun calcOdd (n)
   (* (/ (- n 1) 2) (+ 1 (/ (- n 1) 2)))
  )
(defun pair (n)
  (if (evenp n)
      (expt (/ n 2) 2)
      (calcOdd n)
      )
  )
(princ (pair (read)))

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

typedef long long int lli;

using namespace std;

const int MAX_VALUE = (1 << 30) + (1 << 30 - 1);



int main() {
	// your code goes here
	//cout << MAX_VALUE << endl;
	string s, t;
	cin >> s >> t;
	int  n, i, j, k;
	int tl, sl;
	tl = t.length();
	sl = s.length();
	int ans[tl + 1][sl + 1];
	int from[tl + 1][sl + 1];
	for (i = 0; i < tl+1; i++)
	{
		for (j = 0; j < sl+1; j++)
		{
			ans[i][j] = 0;
			from[i][j] = 0;
		}
	}
	for (i = 0; i < tl + 1; i++)
	{
		for (j = 0; j < sl + 1; j++)
		{
			if ((j+1) < (sl+1))
			{
				if (ans[i][j+1] < ans[i][j])
				{
					ans[i][j+1] = ans[i][j];
					from[i][j+1] = 0;
				}
				if ((i+1) < (tl + 1))
				{
					if (s[j] == t[i])
					{
						if (ans[i+1][j+1] < (ans[i][j] + 1))
						{
							ans[i+1][j+1] = ans[i][j] + 1;
							from[i+1][j+1] = 1;
						}
					}
				}
			}
			if ((i+1) < (tl + 1))
			{
				if (ans[i+1][j] < (ans[i][j]))
				{
					ans[i+1][j] = ans[i][j];
					from[i+1][j] = 2;
				}
			}
			
			
		}
		
	}
	/*
	for (i = 0; i < tl + 1; i++)
	{
		for (j = 0; j < sl+ 1; j++)
		{
			cout << from[i][j] << " ";
		}
		cout << endl;
	}
	
	
	for (i = 0; i < tl + 1; i++)
	{
		for (j = 0; j < sl+ 1; j++)
		{
			cout << ans[i][j] << " ";
		}
		cout << endl;
	}
	*/
	
	i = tl, j = sl;
	int l = ans[i][j];
	string res(l, 0);
	//cout << l << endl;
	while (l)
	{
		if (from[i][j] == 1)
		{
			res[--l] = s[--j];
			i--;
		}
		else
		{
			if (from[i][j] == 2)
			{
				i--;
			}
			else
			{
				j--;
			}
		}
	}
	cout << res;
	return 0;
}

Measured memory_bytes: 70656
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#define _GLIBCXX_DEBUG
#define INF 100000010
 #define PI 3.14159265359

using namespace std;
const int64_t mod = 1000000007;
const int64_t tmpMod = 998244353;

int main() {
 
  int64_t ans=0,N;
  cin>>N;
  vector<int64_t> A(N);
  for(int i=0; i<N; i++){cin>>A[i];if(A[i]%2==1 && i%2==0)ans++;}
  //vector<vector<int> > A(N,vector<int>(M));
  //for(int i=0; i<N; i++){for(int j=0; j<M; j++){cin>>A[i][j];}}
  //sort(A.begin(),A.end());
  //for (int i = 0; i < N; i++) { maximum = max(maximum , A[i]);}
  //for (int i = 0; i < N; i++) { minimum = min(minimum , A[i]);}
  cout << ans << endl;
}

Measured memory_bytes: 3588
x = gets.to_i

y = x.times.map{gets.chomp.to_s}
ac = 0
wa = 0
tle = 0
re = 0
for i in 0..x-1 do
    if y[i] == "AC"
        ac += 1
    elsif y[i] == "WA"
        wa += 1
    elsif y[i] == "TLE"
        tle += 1
    elsif y[i] == "RE"
        re += 1
    end
end

puts "AC x " + ac.to_s
puts "WA x " + wa.to_s
puts "TLE x " + tle.to_s
puts "RE x " + re.to_s

Measured memory_bytes: 21264
from statistics import mode
from collections import Counter
# S = input()
n = int(input())
# N, K = map(int, input().split())
v = list(map(int, input().split()))
# LR = [list(map(int, input().split())) for _ in range(M)]

guu = []
kii = []

for i in range(n):
    if(i % 2) == 0:
        guu.append(v[i])
    else:
        kii.append(v[i])

counterK = Counter(guu)
guuMaxCount = counterK.most_common()[0][1]

counterG = Counter(kii)
kiiMaxCount = counterG.most_common()[0][1]

if counterK.most_common()[0][0] == counterG.most_common()[0][0]:
    if n == 2:
        kiiMaxCount = 0
    elif n == 3:
        kiiMaxCount = 0
    elif n >= 4:
        if len(counterK.most_common()) >= 2 and len(counterG.most_common()) >= 2:
            if kiiMaxCount - counterK.most_common()[1][1] >= guuMaxCount - counterG.most_common()[1][1]:
                guuMaxCount = counterG.most_common()[1][1]
            else:
                kiiMaxCount = counterK.most_common()[1][1]
        elif len(counterK.most_common()) >= 2 and len(counterG.most_common()) == 1:
            kiiMaxCount = kiiMaxCount = counterK.most_common()[1][1]
        elif len(counterK.most_common()) == 1 and len(counterG.most_common()) >= 2:
            guuMaxCount = counterG.most_common()[1][1]
        else:
            kiiMaxCount = 0

ans = n



print(ans - guuMaxCount - kiiMaxCount)

Measured memory_bytes: 22336
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Competitive
{
    internal class Solution
    {
        public long N, M;
        public long MOD = 1000000007;

        public void Run()
        {
            {
                var line = Input.ReadLongArray();
                N = line[0];
                M = line[1];
            }

            Data[] D = new Data[N];
            for (int i = 0; i < N; i++)
            {
                var line = Input.ReadIntArray();
                long a = line[0];
                long b = line[1];
                D[i] = new Data(a, b);
            }
            Array.Sort(D, Data.CompareTo);

            long ret = 0;
            for (int i = 0; i < N; i++)
            {
                long m = Math.Min(M, D[i].b);
                ret += m * D[i].a;
                M -= m;
            }

            Console.WriteLine(ret);

        }
    }

    // libs ----------

    // 比較のみ
    class Data
    {
        public long a;
        public long b;

        public Data(long a, long b)
        {
            this.a = a;
            this.b = b;
        }

        // SortするときのComparerは明示的に指定する
        public static int CompareTo(Data d1, Data d2)
        {
            int result = d1.a.CompareTo(d2.a);
            if (result == 0)
                result = d1.b.CompareTo(d2.b);
            return result;
        }
    }


    // common ----------

    internal static class Input
    {
        public static string ReadString()
        {
            string line = Console.ReadLine();
            return line;
        }

        public static int ReadInt()
        {
            string line = Console.ReadLine();
            return int.Parse(line);
        }

        public static int[] ReadIntArray()
        {
            string line = Console.ReadLine();
            return line.Split(' ').Select(int.Parse).ToArray();
        }

        public static long ReadLong()
        {
            string line = Console.ReadLine();
            return long.Parse(line);
        }

        public static long[] ReadLongArray()
        {
            string line = Console.ReadLine();
            return line.Split(' ').Select(long.Parse).ToArray();
        }

        public static double[] ReadDoubleArray()
        {
            string line = Console.ReadLine();
            return line.Split(' ').Select(double.Parse).ToArray();
        }
    }

    internal class Program
    {
        public static void Main(string[] args)
        {
            var s = new Solution();
            s.Run();
        }
    }
}

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

int n, m, q, a[55][4];
vector<int> seq(0);
int res = 0;
int cnt = 0;

void dfs()
{
  if((int)seq.size() == n)
  {
    cnt++;
    
    int sum = 0;
    rep(i, q)
    {
      if(seq[a[i][1] - 1] - seq[a[i][0] - 1] == a[i][2]) sum += a[i][3];
    }
    res = max(res, sum);
    
    return;
  }
  
  for(int i = seq.back(); i <= m; i++)
  {
    seq.emplace_back(i);
    dfs();
    seq.erase(seq.end() - 1);
  }
  
  return;
}
  



int main()
{
  cin >> n >> m >> q;
  rep(i, q) rep(j, 4) cin >> a[i][j];
  
  for(int i = 1; i <= m; i++)
  {
    seq.emplace_back(i);
    dfs();
    seq.erase(seq.begin(), seq.end());
  }
  
  cerr << cnt << endl;
  cout << res << endl;
  
  
  return 0;
}

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

int main(){
  	int h,k;
      cin >>h >>k;
	char a[60][60];
  	int p[60][60];
  	char q[60][60];
  	for (int i=0;i<h; i++){
    	for (int j=0; j<k; j++){
        	cin >> a[i][j];
        }} 
  for (int i=0;i<h; i++){
    	for (int j=0; j<k; j++){
          int m=0;
        	if (a[i][j]== '.'){
             	 if(i-1>=0){
                   if(j-1>=0){if(a[i-1][j-1] == '#') m++;}
             	 	if(a[i-1][j] == '#') m++;
             	 	if(j<=k+1){if(a[i-1][j+1] == '#') m++;}
                 }
             	 if(j-1>=0){if(a[i][j-1] == '#') m++;}
             	 if(j<=k+1){if(a[i][j+1] == '#') m++;}
             	 if(i<=h+1){
                   if(j-1>=0){if(a[i+1][j-1] == '#') m++;}
             	 	if(a[i+1][j] == '#') m++;
             	 	if(j<=k+1){if(a[i+1][j+1] == '#') m++;}
                 }
            	q[i][j]=(m+'0');
            }
            else q[i][j]='#';
		}
  }
  	for (int i=0;i<h; i++){
    	for (int j=0; j<k; j++){
        	cout << q[i][j];
        }
      cout << endl;
    } 
}


Measured memory_bytes: 256
n, m = map(int,input().strip().split())
temp = int('{}'.format(n)*m)
m = int('{}'.format(m)*n)
temp = str(temp)
m = str(m)
if temp==m:
    print(temp)
elif temp[0]<m[0]:
    print(temp)
else:
    print(m)

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

int main(){
  int N;
  long B[100];
  cin >> N;
  for(int i=0; i<N-1; i++){
    cin >> B[i];
  }
  long long sum=B[0]+B[N-2];
  for(int i=1; i<N-1; i++){
    sum += min(B[i-1], B[i]);
  }
  cout << sum << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;


int main(){
    int n;
    cin >> n;
    vector<int> h(n);
    for(int i=0;i<n;i++){
        cin >> h[i];
    }
    vector<ll> dp(n, 1e9);
    dp[0] = 0;
    dp[1] = abs(h[1]-h[0]);

    for(int i=2;i<n;i++){
        dp[i] = min(dp[i], dp[i-2]+abs(h[i]-h[i-2]));
        dp[i] = min(dp[i], dp[i-1]+abs(h[i]-h[i-1]));
    }

    cout << dp[n-1] << endl;
    return 0;
}

Measured memory_bytes: 1408
import java.util.Scanner;

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

		Boolean ans = false;
		if(S.substring(2, 3).equals(S.substring(3, 4)) && S.substring(4, 5).equals(S.substring(5, 6))) {
			ans = true;
		}
		
		if(ans) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
		sc.close();
		
	}
	
}

Measured memory_bytes: 23892
a, b, k = (int(i) for i in input().split())

div_a = {d for d in range(1,a+1) if a%d == 0}
div_b = {d for d in range(1,b+1) if b%d == 0}
com_d = sorted(list(div_a & div_b),reverse=True)
print(com_d[k-1])

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

#define ll long long int

using namespace std;

int main() {
    ll n;
    cin >> n;
    string s;
    cin >> s;
    vector<ll> L(n+2,0);
    vector<ll> R(n+2,0);
    ll l = 0;
    ll cur = 0;
    for (ll i = 0; i < n; ++i) {
        if (s[i] == 'W') ++cur;
        L[i+1] = cur;
    }
    cur = 0;
    for (ll i = n-1; i >= 0; --i) {
        if (s[i] == 'E') ++cur;
        R[i+1] = cur;
    }

    ll res = 1e9;
    for (ll i = 1; i <= n; ++i) {
        res = min(res, L[i-1] + R[i+1]);
    }
    cout << res << endl;

}


Measured memory_bytes: 8208
/*
      author : nishi5451
      created: 11.08.2020 00:21:03
*/

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


int main(){
    char a,b;
    cin >> a >> b;
    if(a=='H' && b=='H'){
        cout << 'H' << endl;
    }
    else if(a=='H' && b=='D'){
        cout << 'D' << endl;
    }
    else if(a=='D' && b=='H'){
        cout << 'D' << endl;
    }
    else if(a=='D' && b=='D'){
        cout << 'H' << endl;
    }
    return 0;
}

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

int main() {
	int n, a[105];
	cin >> n;
	for (int i = 0; i < n; i++) cin >> a[i];

	int ans = 0;
	for (int i = 0; i < n - 1; i++) {
		for (int j = i + 1; j < n; j++) {
			ans = max(ans, abs(a[j] - a[i]));
		}
	}

	cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#define shosu(x) fixed<<setprecision(x)
using namespace std;
int gcd(int a,int b){
	if(b==0) return a;
	return gcd(b,a%b);
}

int lcm(int a,int b){
	return (a/gcd(a,b))*b;
}

int main(){
	int x,y;
	while(cin>>x>>y){
		cout<<gcd(x,y)<<' '<<lcm(x,y)<<endl;
	}
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
        using namespace std;
        #define int long long
const int MAX = 2000003;
const int MOD = 1000000007;

//
int fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
int COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
bool hen[700][700];
        signed main() {
    cout<<fixed<<setprecision(10);
        int n,m;
        cin>>n>>m;
        int a,b;
        for(int i=0;i<m;i++){
                cin>>a>>b;a--;b--;
                hen[a][b]=true;
                hen[b][a]=true;
        }
        queue<int> que;
        int num[n]={},t;
        vector<pair<int,int>> p;
        for(int i=0;i<n;i++){
                if(num[i]!=0)continue;
                a=1;b=-1;
                num[i]=a;
                a++;
                que.push(i);
                while(!que.empty()){
                        t=que.front();
                        que.pop();
                        for(int i=0;i<n;i++){
                                if(!hen[t][i]&&t!=i){
                                        if(num[t]*num[i]>0){
                                            //    cerr<<t<<' '<<i;
                                                cout<<"-1";
                                                return 0;
                                        }
                                        if(num[i]==0){
                                                if(num[t]>0){
                                                        num[i]=b;
                                                        b--;
                                                }else{
                                                        num[i]=a;
                                                        a++;
                                                }
                                                que.push(i);
                                        }
                                }
                        }
                }
                p.push_back(make_pair(a-1,-b-1));
        }
        bool dp[p.size()][n/2 +1];
        for(int i=0;i<n/2+1;i++)for(int j=0;j<p.size();j++)dp[j][i]=false;
        if(p[0].first<n/2+1)dp[0][p[0].first]=true;if(p[0].second<n/2+1)dp[0][p[0].second]=true;
        for(int i=1;i<p.size();i++){
                for(int j=0;j<=n/2;j++){
                        if(dp[i-1][j]&&j+p[i].first<n/2+1)dp[i][j+p[i].first]=true;
                        if(dp[i-1][j]&&j+p[i].second<n/2+1)dp[i][j+p[i].second]=true;

                }
        }
        for(int i=0;i<p.size();i++)cerr<<p[i].first<<' '<<p[i].second<<endl;
        for(int i=n/2;;i--){
                if(dp[p.size()-1][i]){
                       // cerr<<i<<' ';
                        cout<<i*(i-1)/2 +(n-i)*(n-i-1)/2;
                       return 0;
                }
        }
       

        }


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

info = []
for i in range(N):
    chis = input().split()
    info.append(chis)

maximum = zoro = 0
for each in info:
    if each[0] == each[1]:
        zoro += 1
        maximum = max(maximum, zoro)
    else:
        zoro = 0

if maximum > 2:
    print("Yes")
else:
    print("No")



Measured memory_bytes: 9176
#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<cmath>
#include<string>
#include<queue>
#include<iomanip>
#include<bitset>
#include<math.h>
#include<stack>
#include<set>
using namespace std;
#define int long long
int mod = 1e9 + 7;
signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie();
	cout.tie();
	int n, k;
	cin >> n >> k;
	int r = 0;
	for (int i = k; i <= n+1; i++) {
		r += (n+1) * (n + 2) / 2 - (n+1 - i) * (n+1 - i + 1) / 2 - i*(i+1)/2+1;
		r %= mod;
	}
	cout << r << endl;
}
	

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

int main()
{
    int n,k;
    cin>>n>>k;
    string s;
    cin>>s;
    for(int i=0;i<n;i++)
    {
        if(i==k-1)
        {
            s[i]=s[i]+32;
        }
    }
    cout<<s;
}


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

int x[100];

int main() {
	int n;
	scanf("%d", &n);
	f(i, 0, n)scanf("%d", x + i);
	int an = 1e9;
	f(i, -100, 101) {
		int s = 0;
		f(j, 0, n)s += (i - x[j])*(i - x[j]);
		an = min(an, s);
	}
	printf("%d", an);
}

Measured memory_bytes: 256
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"
#include "ctime"

using namespace std;

constexpr long long int MOD = 1000000007;
//constexpr int MOD = 1000000007;
//constexpr int MOD = 998244353;
//constexpr long long int MOD = 998244353;
constexpr long double EPS = 1e-12;

//int N, M, K, H, W, L, R;
long long int N, M, K, H, W, L, R;

long double dis(vector<long double>&x, vector<long double>&y, int i, int j) {
	return sqrt((x[i] - x[j])*(x[i] - x[j]) + (y[i] - y[j])*(y[i] - y[j]));
}

class XorShift {
	unsigned int x, y, z, w, t;
public:
	XorShift() {
		x = 133553533;
		y = 314867339;
		z = 664298413;
		w = 999999937;
		t = 0;
	}
	unsigned int rand() {
		t = x ^ (x << 11);
		x = y;
		y = z;
		z = w;
		w = (w ^ (w >> 19)) ^ (t ^ (t >> 8));
		return w & 0x7fffffff;
	}
};

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

	cin >> N;
	vector<long double>x(N);
	vector<long double>y(N);
	for (int i = 0; i < N; i++) {
		cin >> x[i] >> y[i];
	}
	long double ans = MOD;
	XorShift xs;
	long double cx = 500, cy = 500;
	for (int loop = 0; loop < 1000; loop++) {
		long double cdis = 0;
		x.push_back(cx);
		y.push_back(cy);
		for (int i = 0; i < N; i++) {
			//cout << max(cdis,dis(x, y, i, N)) << endl;
			cdis = max(cdis, dis(x, y, i, N));
		}
	//	cout << cdis << endl;
		x.pop_back();
		y.pop_back();
		long double dif = 500;
		for (int i = 0; i < 400; i++) {
			//cout << dif << endl;
			long double rad = xs.rand() % 360000;
			rad /= 1000;
			rad /= 180;
			rad *= 3.141592653589793238;
			long double ny = cy + sin(rad)*dif;
			long double nx = cx + cos(rad)*dif;
			//cout << ny << " " << nx << endl;
			dif *= 0.9;
			x.push_back(nx);
			y.push_back(ny);
			long double ndis = 0;
			for (int j = 0; j < N; j++) {
				ndis = max(ndis, dis(x, y, j, N));
			}
			x.pop_back();
			y.pop_back();
			//cout << cdis << " " << ndis << endl;
			if (ndis < cdis) {
				cdis = ndis;
				cx = nx, cy = ny;
			}
		}
		ans = min(ans, cdis);
	}
	cout << setprecision(20) << ans << endl;
	return 0;
}

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

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

        double avg = 0;
        for (int i = 0; i < n; i++) {
            avg += a[i];
        }
        avg /= n;
        
        double min = 100;
        for (int i = n-1; i >= 0; i--) {
            if (Math.abs(avg - a[i]) <= min) {
                min = Math.abs(avg - a[i]);
                ans = i;
            }
        }
        
        System.out.println(ans);
    }
}

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

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

int main(){
  string s,t;cin >> s >> t;
  ll n=s.size();
  
  vector<char> a(n),b(n);
  vector<int> x(n,0),y(n,0);
  
  REP(i,n){
    a[n]=s[i];
    b[n]=t[i];
  }
  
  ll x26=1;
  
  REP(i,n){
    
    if(x[i] == 0){
      REP(j,n){
        if(s[j] == s[i])x[j] = x26;
        x26++;
      }
    }
    
  }
  
  ll y26=1;
  
  REP(i,n){
    
    if(y[i] == 0){
      REP(j,n){
        if(t[j] == t[i])y[j] = y26;
        y26++;
      }
    }
    
  }
  
  REP(i,n){
    if(x[i] != y[i]){cout << "No" << endl;return 0;}
  }
  
  cout << "Yes" << endl;
}

Measured memory_bytes: 2696
# coding: utf-8

str = input()
count = 0
table = list(str)
for i in range(len(str) - 1):
    for j in range(i+1, len(str)):
        if table[i] == table[j]:
            count += 1
if count == 0:
    print("yes")
else:
    print("no")

Measured memory_bytes: 9012
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0;i<n;i++)
#include <bits/stdc++.h>
#include <numeric>
using namespace std;
typedef long long ll;
const int mod= 1e+9+7;

ll mul(ll x,ll y){
    ll ans =1;
    rep(i,y){
        ans*=x;
    }
    return ans;
}
int main() {
    int N; cin>>N;
    int P; cin>>P;
    vector<int>a(N);
    bool judge =true;
    rep(i,N){
        cin>>a[i];
        if(a[i]%2==1)judge =false;
    }
    if(judge){
        if(P==1)cout<<0<<endl;
        else cout<<mul(2,N)<<endl;
    }
    else {
        cout<<mul(2,N-1)<<endl;
    }
}
 



Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <vector>
#include <string>
#include <climits> // FOO_MAX, FOO_MIN
#include <cmath> 
#include <cstdlib> // abs(int)
#include <numeric>
#include <iomanip>
#include <map>

using namespace std;

#define roundup(n,d) ( ((n) + ((d)-1)) / (d) )
#define assign_max(into, compared) (into = max((into), (compared)))
#define assign_min(into, compared) (into = min((into), (compared)))
#define rep(i,n) for(long long i = 0;i < n;++i)
#define v_in(v) for(auto&& i : v) cin >> i
#define FAST_IO ios::sync_with_stdio(false); cin.tie(nullptr);
#define fix(n) fixed << setprecision(n)
#define ALL(v) v.begin(),v.end()

#define PI 3.14159265358979323846

using ll = long long;
using ull = unsigned long long;
using vll = vector<long long>;
using vvll = vector<vector<long long>>;


int main(void){
    FAST_IO
    ll n;
    cin >> n;

    vll a(n);
    v_in(a);

    ll count = 0;
    while(true){
        bool is_end = false;
        rep(i,n){
            if(a[i] % 2 == 1){
                is_end = true;
                break;
            }
            a[i] >>= 1;
        }
        if(is_end) break;
        count++;
    }

    cout << count;
    return 0;
}

Measured memory_bytes: 3188