akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define SORT(x) sort(x.begin(), x.end())
#define RS(x) rsort(x.begin(),x,end()))
#define REVE(x) reverse(x.begin(), x.end())
#define ALL(x) (x).begin(), (x).end()
int INF = 1e9 + 1;
int MOD = 1e9+7;
struct initon
{
    initon()
    {
        cin.tie(0);
        ios::sync_with_stdio(false);
    };
};
typedef long double ld;
signed main()
{
string s;
  cin >> s;
REP(i,s.size()){
if(s[i]==s[s.size()-i-1]){

}else{
  cout << "No";
  return 0;
}
}
REP(i,(s.size()-1)/2){
if(s[i]==s[(s.size()-1)/2-1-i]){

}else{
  cout << "No";
  return 0;
}
}

for(int i = 0;i<(s.size()-1)/2;i++){
if(s[i+(s.size()+3)/2-1]==s[s.size()-i-1]){
}else{
  cout << "No";
  return 0;
}
}
cout << "Yes";
return 0;
}

Measured memory_bytes: 256
using System;

public class Hello
{
    public static void Main()
    {
        string[] line = Console.ReadLine().Trim().Split(' ');
        var n = int.Parse(line[0]);
        var m = int.Parse(line[1]);
        var q = int.Parse(line[2]);
        var a = new int[n, n];
        for (int i = 0; i < m; i++)
        {
            line = Console.ReadLine().Trim().Split(' ');
            var wh = int.Parse(line[0]) - 1;
            var ww = int.Parse(line[1]) - 1;
            a[wh, ww]++;
        }
        var b = setArray(a);
        for (int i = 0; i < q; i++)
        {
            line = Console.ReadLine().Trim().Split(' ');
            var p = int.Parse(line[0]) - 1;
            var p2 = int.Parse(line[1]) - 1;
            Console.WriteLine(getAns(b, p, p2, n));
        }
    }
    public static int getAns(int[,] a, int p, int q, int n)
    {
        var a1 = 0; var a2 = 0; var a3 = 0; var a4 = 0;
        a1 = a[q, q];
        if (p - 1 >= 0) { a4 = a[p - 1, p - 1]; a2 = a[q, p - 1]; a3 = a[p - 1, q]; }
        return a1 - a2 - a3 + a4;
    }
    public static int[,] setArray(int[,] a)
    {
        var n = a.GetLength(0);
        var t = new int[n, n];
        for (int i = 0; i < n; i++)
        {
            t[i, 0] = a[i, 0];
            for (int j = 1; j < n; j++)
                t[i, j] = t[i, j - 1] + a[i, j];
        }
        var t2 = new int[n, n];
        for (int i = 0; i < n; i++)
        {
            t2[0, i] = t[0, i];
            for (int j = 1; j < n; j++)
                t2[j, i] = t2[j - 1, i] + t[j, i];
        }
        return t2;
    }
}


Measured memory_bytes: 20508
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
#include <limits.h>
#include <stdbool.h>

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

//qsort(str, n, sizeof(int), up_comp);
int up_comp(const void *a, const void *b){return *(int*)a - *(int*)b;}
int down_comp(const void *a, const void *b){return *(int*)b - *(int*)a;}
int int_sort( const void * a , const void * b ) {return strcmp(( char * )a , ( char * )b );}
int count_digit(int a){int i=0;while(a!=0){a=a/10;i++;}return i;}
int euclid( int a, int b ){int temp;if(a<b){temp=a;a=b;b=temp;}if(b<1)return -1;if(a%b==0) return b;return euclid(b,a%b);}

int main(void){
 
    int a, b, c;
    
    scanf("%d%d%d", &a, &b, &c);
    
    if (c>=a&&c<=b) {
        printf("Yes");
    } else {
        printf("No");
    }
    
    return 0;
}



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

using namespace std;

bool Dupl(string words[], int size){
    for(int i = 0; i < size; ++i){
        for(int j = i+1; j < size; ++j){
            if(words[i] == words[j]){
//                cout << i << j << words[i] << words[j] << endl;
                return false;
            }
        }
    }
    return true;
}


bool Shiri(string words[], int size){
    for(int i = 0; i < size-1 ; ++i){
        if( words[i][words[i].size()-1] != words[i+1][0]){
//            cout << words[i][words[i].size()] << " " <<words[i+1][0] << endl;
            return false;
        }
    }
    return true;
}



int main(){
    //cout << "a" << endl;
    int num;
    
    cin >> num;
    cin.ignore();
    
    string words[num];
    
    for (int i = 0; i < num; ++i){
        getline(cin, words[i]);
//        cout << words[i] << " ";
    }
    
    if(! Dupl(words, num)){
        cout << "No" << endl;
    } else if(! Shiri(words, num)){
        cout << "No" << endl;
    } else {
        cout <<"Yes" << endl;
    }
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.HashMap;

public class Main {

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

		int n = Integer.parseInt(br.readLine());

		long ans = 0;
		for (int i = 1; i <= n; i++) {
			if (i % 3 != 0 && i % 5 != 0) {
				ans += i;
			}
		}

		System.out.println(ans);
	}
}

Measured memory_bytes: 32580
# D - String Formation
import sys
from collections import deque

readline = sys.stdin.readline
readlines = sys.stdin.readlines


def main():
    S = readline().rstrip()
    _ = readline()
    queries = readlines()
    queue = deque(S)
    to_beginning, to_end = queue.appendleft, queue.append
    is_reversed = 0
    for query in queries:
        if query[0] == "1":
            # to_beginning, to_end = to_end, to_beginning
            is_reversed ^= 1
            continue
        com, c = query[2], query[4]
        if (com == "1") ^ is_reversed:
            to_beginning(c)
        else:
            to_end(c)
    ans = "".join(queue) if not is_reversed else "".join(reversed(queue))
    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 21216
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
using namespace std;


int main(int argc, const char * argv[]) {
    // input from txt （提出時にこの箇所は削除すること）
    std::ifstream in("input.txt");
    std::cin.rdbuf(in.rdbuf());
    // fasten cin
    cin.tie(0);
    ios::sync_with_stdio(false);

    // implement
    int n;
    cin >> n;
    string res = "No";
    for(int i=1; i<10; i++){
        for(int j=1; j<10; j++){
            if(n == i*j){
                res = "Yes";
                break;
            }
        }
    }
    cout << res << endl;
}



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

int main(){
  int a, b;
  cin >> a >> b;
  if(a == b)
    cout << "a == b" << endl;
  else if(a > b)
    cout << "a > b" << endl;
  else 
    cout << "a < b" << endl;
	return 0;
}

Measured memory_bytes: 1156
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, a, b) for (int i = a; i < b; i++)
int n;
int a = 0;
int b = 0;
int c = 0;
int d = 0;
int main()
{
    cin >> n;
    string s;

    for (int i = 0; i < n; i++)
    {
        cin >> s;
        if (s == "AC")
        {
            a++;
        }
        if (s == "WA")
        {
            b++;
        }
        if (s == "TLE")
        {
            c++;
        }
        if (s == "RE")
        {
            d++;
        }
    }

    cout << "AC x " << a << endl;
    cout << "WA x " << b << endl;
    cout << "TLE x " << c << endl;
    cout << "RE x " << d << endl;
    return 0;
}


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

typedef long long int lli;
typedef unsigned long long int ulli;
typedef pair<int,int> pii;

#define ones(x) __builtin_popcount(x)
#define onesl(x) __builtin_popcountl(x)
#define onesll(x) __builtin_popcountll(x)

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define scn(n) scanf("%d",&n)
#define scnll(n) scanf("%lld",&n)
#define scn2(n,m) scanf("%d%d",&n,&m)
#define scn3(n,m,w) scanf("%d%d%d",&n,&m,&w)
#define scn2ll(n,m) scanf("%lld%lld",&n,&m)
#define atoz(v) v.begin(),v.end()
#define ratoz(v) v.rbegin(),v.rend()
#define Fill(a,v) memset(a,v,sizeof(a))
#define sz(v) v.size()
#define fi first
#define se second
#define inf 1e9
#define pi acos(-1.0)
#define sqr(x) x*x
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define ten(n) (int)1e##n
#define tenll(n) (lli)1e##n
#define mod 1000000007
#define FastIO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

int Set(int N,int pos)
{
    return N=N | (1<<pos);
}
int reset(int N,int pos)
{
    return N = N & ~(1<<pos);
}
bool check(int N,int pos)
{
    return (bool)(N & (1<<pos));
}

///priority_queue< int, vector< int >, greater< int > > minHeap;

#define M 55

int m;

struct Matrix{
    int a[M][M];

    Matrix(){
        Fill(a,0);
    }

    Matrix operator*(const Matrix &b){
        Matrix ret;

        for(int i=1; i<=m; i++){

            for(int j=1; j<=m; j++){

                lli sum = 0;

                for(int k=1; k<=m; k++){

                    sum = (sum + (a[i][k]*1LL*b.a[k][j])) % mod;
                }

                ret.a[i][j] = sum;
            }
        }
        return ret;
    }
}mul , I;

Matrix Mpow(lli n){

    Matrix ret = I;

    while(n){

        if(n%2) ret = ret*mul;

        n >>= 1;
        mul = mul*mul;
    }

    return ret;
}

int main()
{
    ///freopen("output.txt","w",stdout);
    ///freopen("input.txt","r",stdin);

    ///FastIO;
    int n;
    lli k;
    cin>>n>>k;

    for(int i=1; i<=n; i++){
        for(int j=1; j<=n; j++) scn(mul.a[i][j]);
    }
    m = n;
    for(int i=1; i<=n; i++) I.a[i][i] = 1;
    mul = Mpow(k);

    lli res =  0;

    for(int i=1; i<=n; i++){
      for(int j=1; j<=n; j++) res = (res + mul.a[i][j])%mod;
    }

    cout<<res;

    return 0;
    ///return main();
}

///sin and cos expect input in radians not degrees. so use , sin(degrees * pi / 180)


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

using namespace std;

int T[31][(100000 + 1) * 2];

int main()
{
    int N, C;
    cin >> N >> C;
    int s, t, c;
    for (int i = 0; i < N; i++)
    {
        cin >> s >> t >> c;
        T[c - 1][s * 2 - 1] = 1;
        T[c - 1][t * 2] = -1;
    }

    int ans = -1;
    int sum = 0;

    for (int i = 0; i < 200001; i++)
    {
        sum = 0;
        for (int j = 0; j < C; j++)
        {
            T[j][i + 1] += T[j][i];
            if(T[j][i] > 0)
            {
                sum++;
            }
        }
        ans = max(ans, sum);
    }
    sum = 0;
    for (int i = 0; i < C; i++)
    {
        if(T[i][200001] > 0)
        {
            sum++;
        }
    }
    ans = max(ans, sum);

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 23928
#include "bits/stdc++.h"
using namespace std;

int a,b,sum=0,cnt=0;
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	cin>>a>>b;
	while(cnt<2){
		if(a>=b){
			sum+=a;
			a--;
		}
		else{
			sum+=b;
			b--;
		}
		cnt++;
	}
	cout<<sum;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(){
  int i;
  int l[10],v1,v2, sum, cnt;
  double tim, dis, x;
  while(scanf("%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d", &l[0],&l[1],&l[2],&l[3],&l[4],&l[5],&l[6],&l[7],&l[8],&l[9],&v1,&v2) != EOF){
    sum = 0;
    for(i=0; i<10; i++){
      sum += l[i];
    }
    cnt = 0;
    tim = (double)sum/(v1+v2);
    dis = v1*tim;
    x = 0;
    for(i=1;i<=10;i++){
      x += (double)l[i-1];
      if(x >= dis){
	printf("%d\n", i);
	break;
      }
    }
  }
  return 0;
}
	

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

struct RangeSumQuery{
    int n;
    std::vector<long long> dat;

    void init(int n_){
        n = 1;
        while(n < n_) n *= 2;
        dat.resize(2 * n - 1, 0);
    }

    long long sum(int i){
        long long s = 0;
        while(i > 0){
            s += dat[i];
            i -= i & -i;
        }
        return s;
    }

    void add(int i, int x){
        while(i <= n){
            dat[i] += x;
            i += i & -i;
        }
    }

    long long sum(int a, int b){
        return sum(b) - sum(a - 1);
    }
};

using namespace std;

int main(){
    int n, q;
    cin >> n >> q;
    RangeSumQuery rsq;
    rsq.init(n);
    while(q--){
        int com, x, y;
        cin >> com >> x >> y;
        if(com){
            cout << rsq.sum(x, y) << "\n";
        }else{
            rsq.add(x, y);
        }
    }
}


Measured memory_bytes: 4880
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <cstring>
#include <utility>
#include <numeric>
#include <iomanip>

using namespace std;

int main(){

    int N;
    cin >> N;

    int even = N / 2; 
    int odd = N - even;

    double ans = (double)odd / N;

    cout << fixed << setprecision(7) << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define debug(x) cout<<#x<<" "<<x<<"\n";
#define lli long long int
long long int mod= 1000000007,modd=998244353;
int32_t main()
{
   ios_base::sync_with_stdio(0);
   cin.tie(0);  cout.tie(0);
   lli n,q,b,c,i,sum=0;
   cin>>n;
   lli a[n+5];
   lli h[100005]={0};
   for(i=0;i<n;i++)
   {
      cin>>a[i];
      h[a[i]]++;
      sum+=a[i];
   }
   cin>>q;
   for(i=1;i<=q;i++)
   { cin>>b>>c;
     sum-=b*h[b];
     sum+=c*h[b];
     h[c]+=h[b];
     h[b]=0;
     cout<<sum<<"\n";
   }
   return 0;
}//main


Measured memory_bytes: 5208
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
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; }
int main(){
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<ll> a(n);
    vector<ll> b(n,0);
    rep(i,n) {
        cin >> a[i];
        a[i]--;
        b[a[i]]++;
    }
    ll sum = 0;
    rep(i,n) if(b[i] >= 2) sum+=(b[i]*(b[i]-1))/2;

    rep(i,n) {
        if(b[a[i]] < 2) cout << sum << endl;
        else cout << sum - (b[a[i]]*(b[a[i]]-1))/2 + ((b[a[i]]-1)*(b[a[i]]-2))/2 << endl;
    }
}


Measured memory_bytes: 5760
/*
    -ensure correct output format
    -ensure printing required output
    -reread the problem statement
  */

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll>pll;
typedef pair<ll,pair<ll,ll>>plll;
#define fastread() (ios_base:: sync_with_stdio(false),cin.tie(NULL));
#define vll(v) v.begin(),v.end()
#define all(x) x.rbegin(),x.rend()
#define min3(a, b, c)   min(a, min(b, c))
#define max3(a, b, c)   max(a, max(b, c))
#define F first
#define S second
#define in  freopen("input.txt", "r", stdin)
#define out  freopen("output.txt", "w", stdout)
#define minheap int,vector<int>,greater<int>
#define pb push_back
#define eb emplace_back
#define ischar(x)  (('a' <= x && x <= 'z') || ('A' <= x && x <= 'Z'))
#define isvowel(ch) ((ch=='a'||ch=='e'||ch=='i'||ch=='o'||ch=='u')||(ch=='A'|| ch=='E' || ch=='I'|| ch=='O'|| ch=='U'))
#define bug cout<<"BUG"<<endl;
const int Max = 2e6 + 10;
const int Mod = 1e9 + 7;
const double PI  =3.141592653589793238463;
bool compare(const pair<ll,ll> &a, const pair<ll,ll> &b)
{
       return (a.first > b.first);
}
ll lcm(ll a,ll b)
{
    if(a==0 || b==0)return 0;

    return a/__gcd(a,b)*b;
}

void input(ll ara[],ll n)
{
    for(ll i=0; i<n; i++)cin>>ara[i];
}
void print(ll ara[],ll n)
{
    for(ll i=0; i<n; i++)
        cout<<ara[i]<<" ";
    cout<<endl;
}


int main()
{

   fastread();

   ll i,j,n,m,p,a,sum=0,k,t,b,c,d,cnt=0,q,l,r,ans=0;

      bool flag=false;

      string str;

      
       cin>>str;
       
       if(str[0]=='A')cout<<"T"<<endl;
       
       else if(str[0]=='T')cout<<"A"<<endl;
       
       else if(str[0]=='C')cout<<"G"<<endl;
       
       else cout<<"C"<<endl;












}



Measured memory_bytes: 3612
#include <algorithm>
#include <climits>
#include <complex>
#include <cstdio>
#include <iostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
#define REP(var, a, b) for (int var = (a); var < (b); var++)
#define rep(var, n) for (int var = 0; var < (n); ++var)
#define ALL(c) (c).begin(), (c).end()
#define rALL(c) (c).rbegin(), (c).rend()
ll MOD = 1000000007;
const ll INF = 1LL << 60;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n, t, a;
  cin >> n >> t >> a;
  ll ans = 0;
  double mindiff = INT_MAX;
  rep(i, n) {
    ll h;
    cin >> h;
    double tmp = abs(a - (t - h * 0.006));
    if (tmp < mindiff) {
      ans = i + 1;
      mindiff = tmp;
    }
  }
  cout << ans << endl;
  return 0;
}


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

using namespace std;

#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define PI 3.141592653589793238
#define INF 1050000000

using vi = vector<int>;


int main() {

	string S;
	cin >> S;

	S[3] = '8';

	cout << S << endl;

	return 0;
}

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

int main() {
	
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	
	int d, t, s;
	cin >> d >> t >> s;
	
	if (s  * t >= d) cout << "Yes\n"; else cout << "No\n";
	return 0;
}


Measured memory_bytes: 3632
#include <stdio.h>
int main(void){
    int a,b,c;
    char str[10];
    scanf("%s", str);
    
    
    a=0;
    b=0;
    c=0;
    if(str[0]=='a')a++;
    if(str[0]=='b')b++;
    if(str[0]=='c')c++;
    
    if(str[1]=='a')a++;
    if(str[1]=='b')b++;
    if(str[1]=='c')c++;
    
    if(str[2]=='a')a++;
    if(str[2]=='b')b++;
    if(str[2]=='c')c++;
    
    if((a==1&&b==1)&&c==1){
      printf("Yes");
    }else printf("No");
    
    return 0;
}

Measured memory_bytes: 128
x = int(input())
if 400 <= x <= 599:
    print ("8")
if 600 <= x <= 799:
    print ("7")
if 800 <= x <= 999:
    print ("6")
if 1000 <= x <= 1199:
    print ("5")
if 1200 <= x <= 1399:
    print ("4")
if 1400 <= x <= 1599:
    print ("3")
if 1600 <= x <= 1799:
    print ("2")
if 1800 <= x <= 1999:
    print ("1")


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


void solve(long long A, long long B, long long K){
  long long count = 0;

  for(long long i = min(A,B); i > 0; i--){
    if(A%i == 0 && B%i == 0) count++;

    if(count == K) {
      cout << i << endl;
      return;
    }
  }
}

// Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long A;
  scanf("%lld",&A);
  long long B;
  scanf("%lld",&B);
  long long K;
  scanf("%lld",&K);
    solve(A, B, K);
    return 0;
}


Measured memory_bytes: 256
/*
これを入れて実行
g++ code.cpp
./a.out
 */

#include <iostream>
#include <vector>
#include <string>
#include <queue>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <cmath>
#include <tuple>
#include <iomanip>

using namespace std;
typedef long long ll;
typedef long double ld;

int dy4[4] = {-1, 0, +1, 0};
int dx4[4] = {0, +1, 0, -1};
int dy8[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
int dx8[8] = {0, 1, 1, 1, 0, -1, -1, -1};

const long long INF = 1LL << 60;
const ll MOD = 1e9 + 7;

bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){
    return f.second > s.second;
}

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

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

ll nCr(ll n, ll r){
    if(r == 0 || r == n){
        return 1;
    } else if(r == 1){
        return n;
    }
    return (nCr(n - 1, r) + nCr(n - 1, r - 1));
}

ll nPr(ll n, ll r){
    r = n - r;
    ll ret = 1;
    for (ll i = n; i >= r + 1; i--) ret *= i;
    return ret;
}

//-----------------------ここから-----------

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

    vector<int> x(n), y(n), a(n);
    for(int i = 0; i < n; i++) cin >> x[i] >> y[i] >> a[i];

    int x1 = 0;
    int x2 = w;
    int y1 = 0;
    int y2 = h;
    for(int i = 0; i < n; i++){
        if(a[i] == 1){
            x1 = max(x1, x[i]);
        } else if(a[i] == 2){
            x2 = min(x2, x[i]);
        } else if(a[i] == 3){
            y1 = max(y1, y[i]);
        } else {
            y2 = min(y2, y[i]);
        }
    }
    
    int answ = max(0, x2 - x1);
    int ansh = max(0, y2 - y1);

    cout << answ * ansh << endl;
}

Measured memory_bytes: 256
# coding: utf-8
import sys

sys.setrecursionlimit(200000)

H,W=map(int,input().split())

canvas=[]

flg=True

def bfs(y,x):
    cnt[0]+=1
    canvas[y][x]="."
    dx=[1,0,-1,0]
    dy=[0,1,0,-1]
    for i in range(4):
        ny=y+dy[i]
        nx=x+dx[i]
        
        if 0<=nx<=W-1 and 0<=ny<=H-1:
            if canvas[ny][nx]=="#":
                bfs(ny,nx)

for i in range(H):
    row=list(input())
    canvas.append(row)


for i in range(H):
    for j in range(W):
        if canvas[i][j]=="#":
            cnt=[0]
            bfs(i,j)
            if cnt[0]==1:
                flg=False

if flg:
    print("Yes")
else:
    print("No")
    

Measured memory_bytes: 5364
#include <cstdio>
#include <string>
#include <iostream>
using namespace std;
long long int f(long long int b, long long int p, long long int m){
	if (p < 1){
		return 1;
	}else if (p == 1){
		return b % m;
	}else{
		long long int y = f(b, p / 2, m) % m;
		if (p % 2 == 0){
			return (y * y) % m;
		}else{
			return (y * y * b) % m;
		}
	}
}
int main(){
	string s;
	cin >> s;
	int n = s.size();
	int a[n];
	for (int i = 0; i < n; i++){
		if (s[i] == 'A'){
			a[i] = 0;
		}else if (s[i] == 'B'){
			a[i] = 1;
		}else if (s[i] == 'C'){
			a[i] = 2;
		}else{
			a[i] = 3;
		}
	}
	long long int before[n][4], after[n][4];
	for (int i = 0; i < n; i++){
		for (int j = 0; j < 4; j++){
			before[i][j] = 0;
			after[i][j] = 0;
		}
	}
	for (int j = 0; j < 4; j++){
		long long int count = 0;
		for (int k = 0; k < n; k++){
			before[k][j] = count;
			if (a[k] == j){
				count++;
			}
		}
		count = 0;
		for (int k = n - 1; k >= 0; k--){
			after[k][j] = count;
			if (a[k] == j){
				count++;
			}
		}
	}
	long long int num = 0;
	for (int i = 0; i < n; i++){
		if (a[i] == 3){
			num++;
		}
	}
	long long int ans = 0, pow[4] = {f(3, num, 1000000007), f(3, num - 1, 1000000007), f(3, num - 2, 1000000007), f(3, num - 3, 1000000007)};
	for (int i = 0; i < n; i++){
		if (a[i] == 1){
			ans += before[i][0] * after[i][2] * pow[0];
			ans %= 1000000007;
			ans += before[i][0] * after[i][3] * pow[1];
			ans %= 1000000007;
			ans += before[i][3] * after[i][2] * pow[1];
			ans %= 1000000007;
			ans += before[i][3] * after[i][3] * pow[2];
			ans %= 1000000007;
		}
		if (a[i] == 3){
			ans += before[i][0] * after[i][2] * pow[1];
			ans %= 1000000007;
			ans += before[i][0] * after[i][3] * pow[2];
			ans %= 1000000007;
			ans += before[i][3] * after[i][2] * pow[2];
			ans %= 1000000007;
			ans += before[i][3] * after[i][3] * pow[3];
			ans %= 1000000007;
		}
	}
	printf("%lld\n",ans);
}

Measured memory_bytes: 7168
#include <stdio.h>
#include <iostream>

using namespace std;

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

        }
        int flag = 1;
        int count = 0;
        while(flag){
                for (int j = 0; j< N ;j++){
                        int temp = A[j]/2;
                        if (temp * 2 != A[j]){
                                flag = 0;
                                break;
                                }
                        else A[j] = temp;

                }
                if (flag ==1) count +=1;
        }
        printf("%d\n",count);
        return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
int min(int a,int b){
  return (a>b)?b:a;
}
using namespace std;
int main(){
  int dp[1001][1001]={};
  string s1,s2;
  cin >> s1>>s2;
  for(int i=0;i<=s1.size();i++){
    dp[i][0]=i;
  }
  for(int i=0;i<=s2.size();i++){
    dp[0][i]=i;
  }
  for(int i=1;i<=s1.size();i++){
    for(int j=1;j<=s2.size();j++){
      int add,rm,repr;
      add=dp[i-1][j]+1;
      rm=dp[i][j-1]+1;
      repr=dp[i-1][j-1];
      if(s1[i-1]!=s2[j-1]){
         repr++;
      } 
      dp[i][j]=min(add,min(rm,repr));
    }
  }
  cout << dp[s1.size()][s2.size()]<<endl;;
}



Measured memory_bytes: 7108
#include <math.h> 
#include <stdio.h>


bool IsPrime(int num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false;

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            return false;
        }
    }

    return true;
}

int main(void) {
        int x;
        scanf("%d", &x);
        for (int i=x; i<x+500; i++) {
                if(IsPrime(i)) {
                        printf("%d\n", i);
                        return 0;
                }
        }
}

Measured memory_bytes: 128
#include <iostream>
#include <stack>
#include <utility>

using namespace std;

typedef pair<int, int> pii;

int field[52][52];

int main(){
	while(true){
		int w, h;
		cin >> w >> h;
		if(w == 0 && h == 0){ break; }
		for(int x = 0; x <= w + 1; ++x){ field[0][x] = field[h + 1][x] = 0; }
		for(int y = 1; y <= h; ++y){
			field[y][0] = field[y][w + 1] = 0;
			for(int x = 1; x <= w; ++x){ cin >> field[y][x]; }
		}
		int answer = 0;
		for(int y = 1; y <= h; ++y){
			for(int x = 1; x <= w; ++x){
				if(field[y][x] == 0){ continue; }
				++answer;
				std::stack<pii> stk;
				stk.push(pii(x, y));
				while(!stk.empty()){
					pii pt = stk.top();
					stk.pop();
					if(field[pt.second][pt.first] > 0){
						field[pt.second][pt.first] = 0;
						stk.push(pii(pt.first - 1, pt.second - 1));
						stk.push(pii(pt.first - 1, pt.second));
						stk.push(pii(pt.first - 1, pt.second + 1));
						stk.push(pii(pt.first, pt.second - 1));
						stk.push(pii(pt.first, pt.second + 1));
						stk.push(pii(pt.first + 1, pt.second - 1));
						stk.push(pii(pt.first + 1, pt.second));
						stk.push(pii(pt.first + 1, pt.second + 1));
					}
				}
			}
		}
		cout << answer << endl;
	}
	return 0;
}

Measured memory_bytes: 0
#include <stdio.h>

int main( void )
{
	long a, b, d, r;
	double f;
	
	scanf( "%ld %ld", &a, &b );
	
	d = a / b;
	r = a % b;
	f = (double)a / b;
	
	printf( "%ld %ld %.5lf\n", d, r, f );
	
	return 0;
}

Measured memory_bytes: 640
// Let's bring the sky down :)
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int N = 3e3 + 5;
ll a[N];
ll dp[N][N];
bool vis[N][N];
int n;
ll solve(int l, int r){
    if(l > r)
        return 0;
    int left = n - (r - l + 1);
    left &= 1;
    if(vis[l][r]) return dp[l][r];
    vis[l][r] = 1;
    ll ans;
    if(!left){
        ans = max(a[l] + solve(l + 1, r), a[r] + solve(l, r - 1));
    }
    else{
        ans = min(-a[l] + solve(l + 1, r), -a[r] + solve(l, r - 1));
    }
    dp[l][r] = ans;
}
int main()
{
    ios_base ::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    cin >> n;
    for(int i = 0; i < n; i++)
        cin >> a[i];
    cout << solve(0, n - 1);
return 0;
}


Measured memory_bytes: 78592
N,M = map(int, input().split())
    
A = []
for i in range(N):
    A.append(list(map(int,input().split())))
    
a = sorted(A)

yen = 0
num = 0

for i in range(N):
    if num + a[i][1] <= M:
        num += a[i][1]
        yen += a[i][1] * a[i][0]
    else:
        yen += (M - num) * a[i][0]
        break
    
print(yen)

Measured memory_bytes: 28656
#include<cstdio>
const static int MAX_H = 100;
const static int MAX_W = 100;
int color[MAX_H][MAX_W];
int H, W, N;

int NextX(int x, int y){
	if(x & 1){
		if(y) return x;
		return x + 1;
	}
	if(y < W - 1) return x;
	return x + 1;
}

int NextY(int x, int y){
	if(x & 1){
		if(y) return y - 1;
		return y;
	}
	if(y < W - 1) return y + 1;
	return y;
}

int main(){
	scanf("%d %d\n%d", &H, &W, &N);
	int x = 0, y = -1;
	for (int i = 0; i < N; ++i){
		int a;
		scanf("%d", &a);
		for (int j = 0; j < a; ++j){
			int _x = x;
			color[x = NextX(_x, y)][y = NextY(_x, y)] = i+1;
		}
	}
	for (int i = 0; i < H; ++i){
		for (int j = 0; j < W; ++j){
			if(j) printf(" ");
			printf("%d", color[i][j]);
		}
		printf("\n");
	}
	return 0;
}

Measured memory_bytes: 256
a, b, c = input().split()[0:3]
a = int(a)
b = int(b)
c = int(c)

if c - a - b < 0:
    print('No')
elif 4 * a * b - (c - a - b) ** 2 < 0:
    print('Yes')
else:
    print('No')
    


Measured memory_bytes: 3060
#include<stdio.h>
int main(){
	int i,l,m,n,r,L=1,R=1e5;
	scanf("%d%d",&n,&m);
	for(i=0;i<m;i++){
		scanf("%d%d",&l,&r);
		L=l>L?l:L;
		R=r>R?R:r;
	}
	printf("%d",R+1>L?R-L+1:0);
}

Measured memory_bytes: 128
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		String S_2 = S + S;
		String S_3 = S + S + S;
		int N = Integer.parseInt(sc.next());
		char first = S.charAt(0);
		char before = first;
		long cnt_1 = 0L;
		for (int i=1;i<S.length();i++) {
			if (S.charAt(i)==before) {
				cnt_1++;
				i++;
			}
			if (i<=S.length()-1) {
				before=S.charAt(i);
			}
		}

		long cnt_2 = 0L;
		int flag=0;
		before = first;
		for (int i=1;i<S_2.length();i++) {
			if (S_2.charAt(i)==before) {
				cnt_2++;
				i++;
			}
			if (i<=S_2.length()-1) {
				before=S_2.charAt(i);
			}
			if (i==S_2.length()-1) {
				if (S_2.charAt(i)==first) {
					flag=1;
					if (S.charAt(0)==S.charAt(1) && S_2.charAt(i)==first) {
						flag=0;
					}
				}
			}
		}

		long cnt_3 = 0L;
		before = first;
		for (int i=1;i<S_3.length();i++) {
			if (S_3.charAt(i)==before) {
				cnt_3++;
				i++;
			}
			if (i<=S_3.length()-1) {
				before=S_3.charAt(i);
			}
		}

		long ans = 0L;
		if (N%2==0) {
			// ans = cnt_2*(N/2)+Math.max(flag*(N/2)-1, 0);
			// ans = (cnt_2-cnt_1) * (N-1) + cnt_1;
			ans = (cnt_3-cnt_1) * (N/2-1) + cnt_2;
		} else {
			// ans = cnt_2*(N/2)+cnt_1;
			// if (flag==1) {
				// ans+=flag*(N/2);
			// }
			// ans = (cnt_2-cnt_1) * (N-1) + cnt_1;
			ans = (cnt_3-cnt_1) * (N/2) + cnt_1;
		}
		System.out.println(ans);
		// System.out.println(cnt_1);
		// System.out.println(cnt_2);
		// System.out.println(flag);
	}
}

Measured memory_bytes: 21332
#include <bits/stdc++.h>
using namespace std;
string s;
int h,w;
int main()
{
    cin>>h>>w;
    for(int i=0;i<h;i++)
    {
        for(int j=0;j<w;j++)
        {
            cin>>s;
            if(s=="snuke")
                cout<<char('A'+j)<<i+1<<endl;
        }
    }
}


Measured memory_bytes: 256
l, r = map(int, input().split())
if r-l+1 >= 2019:
    print(0)
else:
    l %= 2019
    r %= 2019
    if l <= r:
        ans = float('inf')
        for i in range(l, r):
            for j in range(i+1, r+1):
                ans = min(ans, (i*j)%2019)
    else:
        ans = 0
    print(ans)

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


int main() {
    int a, b, c;
    cin >> a >> b >> c;
    if((a*100 + b*10 + c)%4 == 0){
        cout << "YES";
    }
    else
    {
        cout << "NO";
    }
    cout << endl;
}


Measured memory_bytes: 256
#ifdef _DEBUG
#include "MyLib.h"
#else
#define main_B main
#include "bits/stdc++.h" 
#include <regex>
#define _USE_MATH_DEFINES
#include <math.h>
#define FOR(i,s,e) for (int i = int(s); i < int(e); ++i)
#define REP(i,e) FOR(i,0,e)
#define INF (INT_MAX/2)
#define EPS (1.0e-8)
#define LINF (LONG_MAX/2)
const int MGN = 8;
const int ARY_SZ_MAX = 10000000;
using namespace std;
using ll = long long; using ull = unsigned long long;
using vi = vector<int>; using vvi = vector<vi>; using vvvi = vector<vvi>;
using vb = vector<bool>; using vvb = vector<vb>; using vvvb = vector<vvb>;
using vl = vector<ll>; using vvl = vector<vl>;
using vd = vector<double>; using vs = vector<string>;
using pii = pair<int, int>; using pll = pair<ll, ll>;
// functions

#endif


int main_B() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    
    int N,M,C;  cin >> N >> M >> C;
    vi B(M); REP(i, M) cin >> B[i];
    vvi A(N, vi(M));
    REP(i,N)
        REP(j, M) cin >> A[i][j];
    
    int ans = 0;
    REP(i,N){
        int sum = C;
        REP(j, M){
            sum += A[i][j] * B[j];
        }
        if (sum > 0) ans++;
    }

    cout << ans << endl;

    return 0;
}

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

int main()
{
 ll n,x,t;
  cin>>n>>x>>t;
  ll ans=0,num=0;
  while(num<n)
  {
   ans+=t;
    num+=x;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 3644
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <climits>
#include <random>
#include <iomanip>

using namespace std;
typedef long long unsigned int ll;
typedef pair<int, int> P;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

#define fillInt(xs, x)        \
  for (int i = 0; i < (x); i++) \
    scanf("%d", &xs[i]);
#define fillLong(xs, x)       \
  for (int i = 0; i < (x); i++) \
    scanf("%ld", &xs[i]);
#define fillString(xs, x)       \
  for (int i = 0; i < (x); i++) \
    cin >> xs[i];
#define sortv(xs) sort(xs.begin(), xs.end())
#define sortvdi(xs) sort(xs.begin(), xs.end(), std::greater<int>())
#define lbv(xs, x) lower_bound(xs.begin(), xs.end(), x) - xs.begin()
#define ubv(xs, x) upper_bound(xs.begin(), xs.end(), x) - xs.begin()
#define bs(xs, x) binary_search(xs.begin(), xs.end(), x)

#define rep(i,n) for(auto i=0; i<(n); i++)
#define isValidPoint(x, y, mx, my) x >= 0 && x  < mx && y >= 0 && y < my

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

const int MOD = 1000000007;

long exp_mod(long long a, long long b, long m) {
	long long res = 1;
	while (b > 0) {
		if (b&1)
			res = (res * a)%m;
		a = (a * a)%m;
		b >>= 1;
	}
	return (long)res;
}

long fact_mod(long n, long m) {
	long long res = 1;
	for (long i=n; i>0; --i)
		res = (res * i)%m;
	return (long)res;
}

long comb_mod(long n, long r) {
	long long res = 1;
	for (long i=0; i<r; ++i)
		res = (res * (n - i) )%MOD;
	return ( res * exp_mod(fact_mod(r, MOD), MOD-2, MOD) ) % MOD;
}

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

struct Pony
{
    long s, t, x;

    Pony(long s_, long t_, long x_)
    {
        s = s_;
        t = t_;
        x = x_;
    }

    bool operator<(const Pony &another) const
    {
        return x < another.x;
    };
};

long modinv(long a, long m) {
    long b = m, u = 1, v = 0;
    while (b) {
        long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

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

  long n, m;
  cin >> n >>m;

  vector<long> a(n+1);

  rep(i, m) {
    long x;
    cin >> x;
    a[x]=1;
  }

  vector<long> res(n+1);
  res[0] = 1;
  bool b = false;

  rep(i, n-1) {
    if (a[i+1] && a[i+2]) {
      b = true;
      break;
    }
    if (a[i]) {
      continue;
    }
    if (!a[i+1]) {
      res[i+1] = (res[i+1] + res[i]) % MOD;
    }
    if (!a[i+2]) {
      res[i+2] = (res[i+2] + res[i]) % MOD;
    }
  }

  if (b || (n>1 && a[n-1] && a[n-2])) {
    cout << 0 << endl;
  } else if (a[n-1]) {
    cout << res[n] << endl;
  } else {
    cout << (res[n-1]+res[n])%MOD << endl;
  }
}


Measured memory_bytes: 1920
#include <stdio.h> 
  
int gcd(int a, int b) 
{ 
    if (a==0)
    	return b;
    else if (b==0)
    	return a;
    return gcd(b, a % b);
} 


int main() 
{ 
    int a, b;
    scanf("%d %d", &a, &b);
    printf("%d\n", gcd(a, b)); 
    return 0; 
} 





Measured memory_bytes: 2108
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = 0;
		int b = 0;
		int ab = 0;
		int o = 0;
		while(sc.hasNext()){
			String str = sc.nextLine();
			String[] stra = str.split(",");
			if("AB".equals(stra[1])){
				ab++;
			} else if("B".equals(stra[1])){
				b++;
			} else if("A".equals(stra[1])){
				a++;
			} else{
				o++;
			}
		}
		System.out.println(a);
		System.out.println(b);
		System.out.println(ab);
		System.out.println(o);
		sc.close();
	}

}

Measured memory_bytes: 17172
#include <iostream>
#include <algorithm>
#include <utility>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <math.h>
#include <string.h>
#include <iomanip>
#include <numeric>
#include <cstdlib>
#include <cstdint>
#include <cmath>

using namespace std;

using ll = long long;
using pll = pair<ll, ll>;
using vl = vector<ll>;
using vll = vector<vl>;
using vpll = vector<pll>;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define Rep(i, n) for (long long i = 0; i< (long long)(n); i++)
#define RRep(i,n) for (long long i = ((long long)(n)-1); i>=0; i--)

struct Edge{
    int to;
    int weight;
    Edge(int t, int w) : to(t), weight(w){ }
};

using Graph = vector<vector<Edge>>;
using graph = vector<vector<int>>;

template <class T>
inline bool chmin(T &a, T b){
    if (a > b){
        a = b;
        return true;
    }
    return false;
}

template <class T>
inline bool chmax(T &a, T b){
    if (a < b){
        a = b;
        return true;
    }
    return false;
}

template <class T>
T gcd(T a, T b){
    if( b==0 ) return a;
    else return gcd(b, a%b);
}

template <class T>
T lcm(T a, T b){
    return (a*b)/gcd(a,b);
}

int INF = 1e9+7;

vector<int> dx = {-1,0,1,0};
vector<int> dy = {0,-1,0,1};

int main(){
    ll k,a,b;
    cin >> k >> a >> b;
    ll ans = 0;
    if(k<a+1){
        ans = k+1;
    }
    else if(a+1<b){
        ans +=  b;
        k -= a+1;
        ans += (k/2)*b;
        ans -= (k/2)*a;
        ans += k%2;
    }
    else{
        ans = k+1;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<cctype>
#include<utility>
#include<string>
#include<cmath>

#define REP(n) for(int i = 0;i < n;i++)
#define LLREP(n) for(long long int  i = 0;i < n;i++)
typedef long long int ll;
using namespace std;
#define MAX_A 100005

int main(){

    int x;
    cin >> x;
    int ans = 1;
    for(int i =1;i <= x;i++){
        for(int j = 2;j <= x;j++){
            if(pow(i,j)<= x){
                ans = max(ans,(int)pow(i,j));
            }
            
        }
        //cout << ans << endl;
    }
    cout << ans << endl;

   
    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define x first
#define y second
typedef pair<int,int> pii;
typedef long long ll;

const int N = 1010;
const int oo = 1e9;


int n , m;
int gcd(int a , int b){
	return !b?a:gcd(b,a%b);
}
ll lcm(ll a , ll b){
	return (a*b)/gcd(a,b);
}
map<ll,char> cc;

string s,t;
int main(){
	cin >> n >> m;
	cin >> s >> t;
	ll L = lcm(n,m);
	bool can = true;
	for(int i = 0 ; i < s.size();++i)
		cc[i*(L/n)+1] = s[i];
	for(int i = 0 ; i < t.size();++i)
		cc[i*(L/m)+1] = t[i];
	for(int i = 0 ; i < s.size();++i)
		if(cc[i*(L/n)+1] != s[i])can = false;
	for(int i = 0 ; i < t.size();++i)
		if(cc[i*(L/m)+1] != t[i])can = false;
	if(!can){
		puts("-1");
	}else{
		cout << L << endl;
	}
	return 0;
}

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

int main(){
	int n;
	cin >> n;
	vector<bool> a(1000000001, false);
	long long ans = 0;
	for(int i = 0; i < n; i++)
	{
		int b;
		cin >>b;
		if(a[b]){
			a[b] = false;
			ans--;
		}
		else if(!a[b]){
			a[b] = true;
			ans++;
		}
	}
	
	
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 122368
#include <iostream>
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <cmath>
#include <map>
#define rep(i,cc,n) for(int i=cc;i<=n;++i)
#define drep(i,cc,n) for(int i=cc;i>=n;--i)
typedef long long ll;
using namespace std;
int main(){
    int n;
    cin>>n;
    map<int, int> a;
    int hoge;
    rep(i,0,n-1){
        cin>>hoge;
        a[hoge] = i+1;
    }
    rep(i,1,n){
        cout<<a[i]<<" ";
    }
    cout<<"\n";
    return 0;
}

Measured memory_bytes: 5504
#include <bits/stdc++.h>
using namespace std;
     
int main() {
  int N, K, a;
  cin >> N >> K;

  vector<int> d(K);
  vector<vector<int>> A(K);
  set<int> ans;

  for(int i=0; i<K; i++){
    cin >> d.at(i);
    for(int j=0; j<d.at(i); j++){
      cin >> a;
      A.at(i).push_back(a);
      ans.insert(a);
    }
  }

  cout << N-ans.size() << endl;

return 0;
}

Measured memory_bytes: 3628
class UnionFind
  def initialize(n)
    @parent = Array.new(n, -1)
  end

  def root(x) # xの根の番号を返す
    return x if @parent[x] < 0
    @parent[x] = root(@parent[x])
    return @parent[x]
  end

  def size(x) # xの属するグループのサイズを調べる
    return -@parent[root(x)]
  end

  def merge(x, y)
    x, y = root(x), root(y)
    return false if x == y
    # 大きい方(x)に小さい方(y)をくっつけたい
    x, y = y, x if size(x) < size(y)
    @parent[x] += @parent[y]
    @parent[y] = x
    return true
  end

  def same?(x, y)
    root(x) == root(y)
  end
end

N,M=gets.split.map(&:to_i)
a,b = Array.new(M), Array.new(M)
bridge = []
M.times do
  bridge << gets.split.map(&:to_i)
end

ans = Array.new(M)
ans[M-1]=N*(N-1)/2
uf = UnionFind.new(N)

i = 1
bridge.reverse_each do |a,b|
  id = M-1-i
  break if id < 0
  if uf.same?(a-1, b-1)
    ans[id] = ans[id+1]
  else
    ans[id] = ans[id+1] - uf.size(a-1)*uf.size(b-1)
  end
  uf.merge(a-1,b-1)
  i += 1
end
puts ans

Measured memory_bytes: 13820
#include <iostream>
#include <cstdio>
#include <string.h>
using namespace std;

int main(){
    char s[3];

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

    int count = 0;

    for(int i = 0; i < 3; i++){
        if(s[i] == '1'){
            count++;
        }
    }

    printf("%d\n", count);

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ALL(obj) (obj).begin(), (obj).end()
#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define REP(i, n) for(int i = 0; i < (n); ++i)

#define ABS(a) ((a < 0) ? ((-1)*(a)) : (a))

#define endl "\n"
#define pb push_back
#define rtn return
#define elif else if

#define MOD 1000000007
 
const int dx_4[]={1,0,-1,0}, dy_4[]={0,-1,0,1};
const int dx_8[]={1,1,0,-1,-1,-1,0,1}, dy_8[]={0,-1,-1,-1,0,1,1,1};

typedef long long ll;
typedef unsigned long long ull;

template <typename T>
inline T GCD(T a,T b){T c;while(b!=0){c=a%b;a=b;b=c;}return a;}
template <typename T>
inline T LCM(T a,T b){T c=GCD(a,b);a/=c;return a*b;}
template <typename T>
inline T nCr(T a,T b){T i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
template <typename T>
inline T nHr(T a,T b){return nCr(a+b-1,b);}
template <typename T>
inline T POW(T a,T b){int i,r=1;for(i=1;i<=b;i++){r*=a;}return r;}

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

	int n, a[100], max = -128, min = 128, ans = INT_MAX;
	cin >> n;
	REP(i, n){
		cin >> a[i];
		if(a[i] > max) max = a[i];
		if(a[i] < min) min = a[i];
	}

	for(int i = min; i <= max; i++){
		int p = 0;
		REP(j, n){
			p += POW(abs(i-a[j]), 2);
		}
		if(p < ans) ans = p;
	}
	cout << ans << endl;
	rtn 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(int argc, const char * argv[]) {
    // insert code here...
    int a, b, c, i, result, sum=0;
    scanf("%d %d %d", &a, &b, &c);
    for (i=a; i<=b; i++) {
        result=c%i;
        if (result==0) {
            sum++;
        }
    }
    printf("%d\n", sum);
    return 0;
}



Measured memory_bytes: 2148
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <cmath>
#include <iomanip>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
#define REP(i,n) for (int i=0;i<(n);++i)
#define rep(i,a,b) for(int i=a;i<(b);++i)
template<class T> inline bool chmin(T &a, T b){ if(a > b) { a = b; return true;} return false;}
template<class T> inline bool chmax(T &a, T b){ if(a < b) { a = b; return true;} return false;}
using ll = long long;
constexpr long long INF = 1LL << 62;
constexpr int MOD = 1e9 + 7;
constexpr double EPS = 1e-10;

int main() {
    cin.tie(0); ios_base::sync_with_stdio(false);
    boost::multiprecision::cpp_int a, b;
    cin >> a >> b;
    cout << a / b << endl;
    return 0;
}


Measured memory_bytes: 3252
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fir first
#define sec second
#define SZ(a) (int)((a).size())
using namespace std;
typedef long long ll;
typedef double db;
typedef pair <int, int> Pii;
typedef pair <ll, int> Pli;
typedef unsigned long long ull;
const double eps = 1e-8;
const ll infll = 0x7fffffffffffffff;
const int mod = (int)(1e9) + 7;
const int inf = 0x7fffffff;
const int maxn = (int)(2e6) + 7;
const int maxm = 300;

char s[maxn];
ll n, k, a[maxn], b[maxn];
ll C(ll n, ll m) {
	if (m > n) return 0;
	return a[n] * b[m] % mod * b[n - m] % mod;
}
ll power(ll a, ll b) {
	ll ans = 1;
	for (; b; a = a * a % mod, b >>= 1) if (b & 1) ans = ans * a % mod;
	return ans;
}

int main() {
	
	// freopen("in.in", "r", stdin);
	scanf("%lld%s", &k, s + 1);
	n = strlen(s + 1);
	a[0] = a[1] = b[0] = b[1] = 1;
	for (ll i = 2; i <= n + k; i++) {
		b[i] = (mod - mod / i) * b[mod % i] % mod;
	}
	for (ll i = 2; i <= n + k; i++) {
		a[i] = a[i - 1] * i % mod;
		b[i] = b[i - 1] * b[i] % mod;
	}
	ll res = 0;
	for (ll i = 0; i <= k; i++) {// 先选出i个字符放在最左边, 和原串第一个字符在一起
		res = (res + C(n + k - i - 1, k - i) * power(26, i) % mod * power(25, k - i) % mod) % mod;
	}
	printf("%lld", res);

	return 0;
}		
//           f             o
// 26 * 26 * 1 * 25 * 25 * 1 * 25 * 25
// [a, z]    [a, f)∪(f, z)  [a, o)∪(o, z]
// |<----------- n + k ------------->|



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

int main(){
  string s, t;
  cin >> s >> t;
  vector<char> sv, tv;
  for(int i=0; i<s.length(); i++){
    sv.push_back(s[i]);
  }
  for(int i=0; i<t.length(); i++){
    tv.push_back(t[i]);
  }
  sort(sv.begin(), sv.end());
  sort(tv.begin(), tv.end(), greater<int>());
  s = ""; t = "";
  for(int i=0; i<sv.size(); i++){
    s += sv[i];
  }
  for(int i=0; i<tv.size(); i++){
    t += tv[i];
  }
  if(s < t) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}

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

typedef long long ll;

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

    if (N%10 == 3) {
        cout << "bon" << endl;
    } else if (N%10 == 0 || N%10 == 1 || N%10 == 6 || N%10 == 8) {
        cout << "pon" << endl;
    } else {
        cout << "hon" << endl;
    }
}


Measured memory_bytes: 3632
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;

namespace AtCoder.A
{
    public class Program
    {
        public static void Main() { var r = GetResult(); Debug.WriteLine(r); Console.Write(r); }

        private static object GetResult()
        {
            var (r, g, b) = Read3Longs();
            return (r * 100 + g * 10 + b) % 4 == 0 ? "YES" : "NO";
        }

        #region Console.Read

        public static string ReadText() { return Console.ReadLine(); }
        public static List<string> ReadTexts() { return Console.ReadLine().Split(' ').ToList(); }
        public static long ReadLong() { return long.Parse(Console.ReadLine()); }
        public static (long, long) Read2Longs() { var ls = ReadLongs(); return (ls[0], ls[1]); }
        public static (long, long, long) Read3Longs() { var ls = ReadLongs(); return (ls[0], ls[1], ls[2]); }
        public static (long, long, long, long) Read4Longs() { var ls = ReadLongs(); return (ls[0], ls[1], ls[2], ls[3]); }
        public static (long, long, long, long, long) Read5Longs() { var ls = ReadLongs(); return (ls[0], ls[1], ls[2], ls[3], ls[4]); }
        public static List<long> ReadLongs() { return Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToList(); }

        #endregion
    }
}


Measured memory_bytes: 28236