akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Math;
using static System.Console;
using System.Text;

class Program
{
    static void Main(string[] args)
    {
        solve();
    }
    static Scanner cin;
    static int N;
    static int[] a, b;
    static void input()
    {
        cin = new Scanner();
        N = cin.nextInt();
        a = cin.ArrayInt(N);
        b = cin.ArrayInt(N);
    }
    static void solve()
    {
        input();
        int[] sumA = new int[N];
        int[] sumB = new int[N];

        sumA[0] = a[0];
        for(int i = 1; i < N; i++)
            sumA[i] = sumA[i - 1] + a[i];

        sumB[N - 1] = b[N - 1];
        for (int i = N - 2; i >= 0; i--)
            sumB[i] = sumB[i + 1] + b[i];

        int Max = 0;
        for(int i = 0; i < N; i++)
        {
            int value = sumA[i] + sumB[i];
            if(value > Max)
                Max = value;
        }

        WriteLine(Max);
    }
    class Scanner
    {
        string[] s;
        int i;

        char[] cs = new char[] { ' ' };

        public Scanner()
        {
            s = new string[0];
            i = 0;
        }
        
        public string next()
        {
            if (i < s.Length) return s[i++];
            string st = Console.ReadLine();
            while (st == "") st = Console.ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            if (s.Length == 0) return next();
            i = 0;
            return s[i++];
        }

        public int nextInt()
        {
            return int.Parse(next());
        }

        public int[] ArrayInt(int N, int add = 0)
        {
            int[] Array = new int[N];
            for(int i = 0; i < N; i++)
            {
                Array[i] = nextInt() + add;
            }
            return Array;
        }

        public long nextLong()
        {
            return long.Parse(next());
        }

        public long[] ArrayLong(int N, long add = 0)
        {
            long[] Array = new long[N];
            for(int i = 0; i < N; i++)
            {
                Array[i] = nextLong() + add;
            }
            return Array;
        }

        public double nextDouble()
        {
            return double.Parse(next());
        }

        public double[] ArrayDounble(int N, int add = 0)
        {
            double[] Array = new double[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextDouble() + add;
            }
            return Array;
        }
    }
}

Measured memory_bytes: 13140
#include<bits/stdc++.h>
using namespace std;
#define int long long int
int d1[1000004]={0};

int32_t main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout<<setprecision(9)<<fixed;
	
	int n;
	cin>>n;
	int t=n%1000;
	if(t==0)
		cout<<0<<endl;
	else
		cout<<1000-t<<endl;
	return 0;
}

Measured memory_bytes: 3608
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;
 
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key
 
typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<int> vi;
typedef long double ld; 
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> pbds;

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	char c; cin>>c;
	if(c>='a'&&c<='z')
	{
		cout<<"a"<<'\n';
	}
	else
	{
		cout<<"A"<<'\n';
	}
}


Measured memory_bytes: 3648
class Process_Queue:
    class Process:
        def __init__(self, name, r_time, link = None):
            self.name = name
            self.r_time = r_time
            self.link = link

    def __init__(self, q):
        self.e_time = 0
        self.q = q
        self.front = None
        self.rear  = None

    def enqueue(self, name, r_time):
        if self.front == self.rear == None:
            self.front = self.rear = Process_Queue.Process(name, r_time)
        else:
            new_process = Process_Queue.Process(name, r_time)
            self.rear.link = new_process
            self.rear = new_process

    def dequeue(self):
        if self.front == self.rear == None:
            raise Exception("queue underflow")
        elif self.front.r_time > self.q:
            self.enqueue(self.front.name, self.front.r_time - self.q)
            self.front = self.front.link
            self.e_time += self.q
        else:
            p_name = self.front.name
            self.e_time += self.front.r_time
            print(p_name, self.e_time)
            self.front = self.front.link
        if self.front == None:
            self.rear = None

n, q = map(int, input().split())

p_queue = Process_Queue(q)

for i in range(n):
    p = input().split()
    p_queue.enqueue(p[0], int(p[1]))

while not p_queue.front == p_queue.rear == None:
    p_queue.dequeue()

Measured memory_bytes: 18792
#include<iostream>
#include<cmath>
using namespace std;
int main()
{
    long A, B, N;
    cin >> A >> B >> N;
    
    if (N/B == 0) {
        double xBarB = (double) N/B;
        cout << floor((double)A*N/B) <<endl;
    } else {
        double xBarB = (double) (B-1)/B;
        cout << floor(A*xBarB) <<endl;
    }
    return 0;
} 

Measured memory_bytes: 3812
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()

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

  bool zero = false, all_zero = true;
  vector<LL> a(n);
  map<int, int> mp;
  for (int i = 0; i < n; i ++) {
    cin >> a[i];
    mp[a[i]] ++;
    if (a[i] == 0) zero = true;
    else all_zero = false;
  }

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

  bool flag = false;
  if (n % 3 == 0) {
    int t = n / 3;
    if (zero) {
      int x = -1;
      rep(i, n) {
        if (a[i] != 0) x = a[i];
      }
      if (mp[x] == t * 2 && mp[0] == t) flag = true;
    } else {
      for (int i = 1; i < n; i ++) {
        if (a[i] != a[0]) {
          int x = a[0], y = a[i], z = x ^ y;
          if (mp.count(z)) {
            if (mp[x] == t && mp[y] == t && mp[z] == t) flag = true;
          }
        }
      }
    }
  }


  cout << (flag ? "Yes" : "No") << endl;
}

Measured memory_bytes: 4480
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#include <set>
#include <tuple>
#define mkp make_pair
#define mkt make_tuple
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
const ll MOD=1e9+7;

int H,W;

bool dp[81][81][81*81*2+1];
int A[81][81];
int B[81][81];
int C[81][81];
const int P=81*81*2;

int main(){
  cin>>H>>W;
  rep(i,H) rep(j,W) cin>>A[i][j];
  rep(i,H) rep(j,W) cin>>B[i][j];
  rep(i,H) rep(j,W) C[i][j]=abs(A[i][j]-B[i][j]);

  dp[0][0][C[0][0]]=true;
  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      for(int k=0;k<=P;k++){
        if(dp[i][j][k]==false) continue;
        if(i+1<H){
          dp[i+1][j][abs(k+C[i+1][j])]=1;
          dp[i+1][j][abs(k-C[i+1][j])]=1;
        }
        if(j+1<W){
          dp[i][j+1][abs(k+C[i][j+1])]=1;
          dp[i][j+1][abs(k-C[i][j+1])]=1;
        }
      }
    }
  }

  int ans=P;
  for(int i=0;i<=P;i++) if(dp[H-1][W-1][i]) ans=min(ans,i);
  cout<<ans<<endl;

  return 0;
}


Measured memory_bytes: 83328
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
const ll INF = 1LL << 60;

int main(){
    string s;
    cin >> s;
    if(s=="Sunny") cout << "Cloudy" << endl;
    else if(s=="Cloudy") cout << "Rainy" << endl;
    else cout << "Sunny" << endl;
}

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

int main() {
    
    long double n;
      cin>>n;
      vector<pair<long double,long double>>v;
      long double x,y;
      for(int i=0;i<n;i++)
      {
       cin>>x>>y;
       v.push_back(make_pair(x,y));
      }
      long double sum=0.00;
      for(int i=0;i<n;i++)
      {
          for(int j=i+1;j<n;j++)
          {
          sum=sum+sqrt((v[i].first-v[j].first)*(v[i].first-v[j].first)+(v[i].second-v[j].second)*(v[i].second-v[j].second));
      }
      }
      sum=(sum/(1.00*(n/2.0)));
      printf("%0.10Lf",sum);
      //cout<<fixed<<setprecision(10)<<sum<<"\n";
	return 0;
}

Measured memory_bytes: 256
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

import numpy as np

N = int(readline())
A = np.array(read().split(),np.int64)

MOD = 10 ** 9 + 7

U = 10 ** 6 + 10
is_prime = np.zeros(U, np.bool)
is_prime[2] = 1
is_prime[3::2] = 1
for p in range(3,U,2):
    if p*p > U:
        break
    if is_prime[p]:
        is_prime[p*p::p+p] = 0

M = 10 ** 3
small_primes = np.where(is_prime[:M])[0].tolist()

B = A.copy()
lcm = 1
for p in small_primes:
    e = 0
    while np.any(A % p == 0):
        e += 1
        A[A % p ==0] //= p
    lcm *= p**e
    lcm %= MOD

for x in set(A.tolist()):
    lcm *= x
    lcm %= MOD

answer = sum(pow(x, MOD-2, MOD) for x in B.tolist()) % MOD
answer *= lcm
answer %= MOD
print(answer)


Measured memory_bytes: 22480
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  vector<int> a(3);
  for(int i = 0; i < 3; i++){
    cin >> a.at(i);
  }
  swap(a.at(0),a.at(1));
  swap(a.at(0),a.at(2));
  cout << a.at(0) << " " << a.at(1) << " " << a.at(2) << endl;
}

Measured memory_bytes: 256
N = int(input())
p = list(map(int, input().split()))
cnt = 0
#if p[0] == 1:
#    tmp = p[1]
#    p[1] = p[0]
#   p[0] = tmp
#    cnt += 1

for i in range(N - 1, -1, -1):
    if i + 1 == p[i]:
        tmp = p[i]
        p[i] = p[i - 1]
        p[i - 1] = tmp
        cnt += 1

print(cnt)

Measured memory_bytes: 14008
def main():
    N = int(input())

    def recur(s):
        if int(s) > N:
            return 0
        ret = 1 if all(s.count(c) for c in '753') else 0
        for c in '753':
            ret += recur(s + c)
        return ret
    print(recur('0'))


if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
w = list(input())

a_n = ord("a")
alf_dict = {}

for i in range(26):
    alf_dict[chr(a_n)] = 0
    a_n += 1

for x in w:
    alf_dict[x] += 1

flag = 0
for k, v in alf_dict.items():
    if v % 2 == 1:
        flag = 1
        break

if flag == 0:
    print("Yes")
else:
    print("No")

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

int main() {
	int n; cin >> n;
	long long a_i[10010];
	long long sum= 0;

	for(int i=0; i<n; ++i) { cin >> a_i[i]; sum+= a_i[i]; }

	for(int i=0; i<n-1; ++i) {
		for(int j=n-1; j>i; --j) {
			if(a_i[i] > a_i[j]) {
				int tmp;
				tmp= a_i[i];
				a_i[i]= a_i[j];
				a_i[j]= tmp;
			}
		}
	}

	printf("%lld %lld %lld\n", a_i[0], a_i[n-1], sum);

	return 0;
} 


Measured memory_bytes: 3276
#include <bits/stdc++.h>
using namespace std;
#define MAXNUM 222111
char s[MAXNUM],t[MAXNUM];
int main()
{
    int h,w,n;scanf("%d%d%d",&h,&w,&n);
    int up=0,down=h+1,lef=0,rig=w+1, x,y;
    scanf("%d%d",&x,&y);
    scanf("%s%s",s+1,t+1);int flag=1;
    for(int i=n;i;i--)
    {
        if(t[i]=='U')down=min(h+1,down+1);
        else if(t[i]=='D')up=max(0,up-1);
        else if(t[i]=='L')rig=min(w+1,rig+1);
        else lef=max(0,lef-1);
        if(s[i]=='U')up++;
        else if(s[i]=='D')down--;
        else if(s[i]=='L')lef++;
        else rig--;
        if(up>=down-1||lef>=rig-1){flag=0;break;}
    }
    if(flag&&(y<rig&&y>lef)&&(x>up&&x<down))printf("YES\n");
    else printf("NO\n");
}

Measured memory_bytes: 640
// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define FOR(i,a) for(auto i:a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
#define show1d(v) rep(_,v.size())cout<<" "<<v[_];cout<<endl;
#define show2d(v) rep(_,v.size()){rep(__,v[_].size())cout<<" "<<v[_][__];cout<<endl;}cout<<endl;
using namespace std;
//kaewasuretyuui
typedef long long ll;
#define int ll
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
// #define mt make_tuple
// typedef tuple<int,int,int> tp;
// typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
//template<class C>constexpr int size(const C &c){return (int)c.size();}
//template<class T,size_t N> constexpr int size(const T (&xs)[N])noexcept{return (int)N;}
const double PI=acos(-1);
const double EPS=1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 1e18+10 : 1e9+10;
int dx[]={0,1,0,-1,1,1,-1,-1};
int dy[]={1,0,-1,0,1,-1,1,-1};//RDLU
signed main(){
	int n;
	cin>>n;
	vp in;
	rep(i,n){
		int a,b;
		cin>>a>>b;
		in.pb({a,i});
		in.pb({b,n+i});
	}
	sort(all(in));
	int sum=0,co=0;
	vi used(n,1);
	rep(i,n){
		sum+=in[i].first;
		if(in[i].second>=n)used[in[i].second-n]++;
		else used[in[i].second]--;
	}
	bool h=true;
	int w=0;
	rep(i,n)w+=used[i];
	rep(i,n)if(used[i]==1)h=false;
	if(h&&w&&w-2*n){
		if(in[n-1].second%n!=in[n].second%n)sum+=-in[n-1].first+in[n].first;
		else sum+=min(-in[n-2].first+in[n].first,-in[n-1].first+in[n+1].first);
	}
	cout<<sum<<endl;
	// vp a(n),b(n);
	// rep(i,n)cin>>a[i].first>>b[i].first;
	// rep(i,n)a[i].second=b[i].second=i;
	// sort(all(a));
	// sort(all(b));
	// int sum=0;
	// rep(i,n)sum+=a[i].first;
	// int out=sum;
	// vi used(n);
	// show1d(a);
	// show1d(b);
	// int co=0;
	// cout<<out<<endl;
}
/*
//nCr mod m
#define MOD 1000000007
#define M 1000000
vector<ll> fact;
bool h=false;
void init(){
	h=true;
	fact=vector<ll>(M);
	fact[0]=fact[1]=1;
	loop(i,2,M)fact[i]=fact[i-1]*i%MOD;
}
// a^b mod MOD
ll powmod(ll a,ll b,ll m=MOD){
	ll out=1;
	ll p=a%m;
	while(b){
		if(b&1)out=out*p%m;
		p=p*p%m;
		b>>=1;
	}
	return out;
}
signed main(){
	int n;
	cin>>n;
	vi in(n);
	rep(i,n)cin>>in[i];
	int out=0;
	rep(i,n){
		int sum=powmod(2,n-1)+(n-1)*powmod(2,n-2)%MOD;
		cout<<sum<<endl;
		sum%=MOD;
		(out+=in[i]*sum)%=MOD;
	}
	
	cout<<out<<endl;
}
*/





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

#define M 1046527
#define NIL (-1)
#define L 14

char H[M][L];

// 文字から数値に変換
int getChar(char ch){
  if (ch == 'A'){ return 1; }
  else if (ch == 'C'){ return 2; }
  else if (ch == 'G'){ return 3; }
  else if (ch == 'T'){ return 4; }
  else { return 0; }
}

// 文字列から数値へ変換してkeyを生成する
long long getKey(char str[]) {
  long long sum = 0, p = 1;
  for (int i = 0; i < strlen(str); i++){
    sum += p*getChar(str[i]);
    p *= 5;
  }
  return sum;
}

int h1(int key){ return key % M; }
int h2(int key){ return 1 + (key % (M-1)); }

int find(char str[]){
  long long key, i, h;
  key = getKey(str);
  for (i = 0;; i++){
    h = (h1(key) + i * h2(key)) % M;
    if ( strcmp(H[h], str) == 0){ return 1; }
    else if (strlen(H[h]) == 0 ){ return 0; }
  }
  return 0;
}

int insert(char str[]){
  long long key, i, h;
  key = getKey(str);
  for (i = 0;; i++){
    h = (h1(key) + i * h2(key)) % M;
    if ( strcmp(H[h], str) == 0 ) { return 1; }
    else if ( strlen(H[h]) == 0 ){
      strcpy(H[h], str);
      return 0;
    }
  }
  return 0;
}

int main() {
  int n;
  char com[15], str[L];
  scanf("%d", &n);
  for( int i = 0; i < M; i++){
    H[i][0] = '\0';
  }
  for( int i = 0; i < n; i++){
    scanf("%s %s", com, str);

    if (com[0] == 'i'){
      insert(str);
    } else if (com[0] == 'f'){
      if (find(str)){ printf("yes\n"); }
      else { printf("no\n"); }
    }
  }

  return 0;
}


Measured memory_bytes: 16056
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
int a[100];
int main() {
	int N;
	cin >> N;
	for (int i = 0; i < N; i++) cin >> a[i];
	int cnt = 1;
	int ans = 0;
	for (int i = 1; i < N; i++) {
		if (a[i] == a[i - 1]) {
			cnt++;
		}
		else {
			ans += cnt / 2;
			cnt = 1;
		}
	}
	ans += cnt / 2;
	cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
using namespace std;
typedef long long ll;
int INF = (1LL << 30) - 1;
int MOD = 1e9+7;
main(){
    char c;
    cin >> c;
    c++;
    cout << (char)(c) << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl; 
#define INF 1000000000
#define mod 1000000007
typedef long long ll;
const ll LINF = 1001002003004005006ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    int n,m,k;cin>>n>>m>>k;
    bool f=false;
    for(int i=0;i<=n;i++){
        for(int j=0;j<=m;j++){
            if(i*j+(n-i)*(m-j)==k)f=true;
        }
    }
    cout<<(f?"Yes":"No")<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <queue>
using namespace std;
typedef pair<int,int> Paint;
int main(){
  int n;cin>>n;
  char mp[n][n];
  for(int i = 0; n > i; i++){
    for(int j = 0; n > j; j++){
      cin>>mp[i][j];
    }
  }
  int ans = -1;
  for(int i = 0; n > i; i++){
    int tmp[n];
    bool lock[n];
    for(int j = 0; n > j; j++)tmp[j] = -1,lock[j]=false;
    queue<Paint> z;
    z.push(make_pair(i,0));
    tmp[i]=0;lock[i]=true;
    while(!z.empty()){
      for(int j = 0; n > j; j++){
        if(mp[z.front().first][j] == '1'){
          if(!lock[j]){
            if(!(z.front().second+1==tmp[j] || tmp[j]==-1)){
              cout << -1 << endl;
              return 0;
            }else if(tmp[j]==-1){
              z.push(make_pair(j,z.front().second+1));
            }
          }
          tmp[j] = z.front().second+1;
        }
      }
      if(z.size()==1)ans = max(ans,z.front().second);
      lock[z.front().first]=true;
      z.pop();
    }
  }
  cout << ans+1 << endl;
}


Measured memory_bytes: 384
N = int(raw_input())
A = list(map(int,raw_input().split()))
ans = [0]*N
for i in reversed(range(0, N)):
  ball = 0
  for j in range(i,N,i+1):
    ball = ball + ans[j]
  if (ball+A[i])%2!=0 :
    ans[i] = 1
print sum(ans)
if sum(ans) != 0:
  for i in range(0,len(ans)):
    if ans[i] != 0:
      print i+1,


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

using namespace std;
int main(){
	int i,a,b;
	cin >> a >> b;
	if(a<b){
		for(i=0;i<b;i++){
			cout << a;
		}
	}else{
		for(i=0;i<a;i++){
			cout << b;
		}
	}
	cout << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (ll i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using ull = long long unsigned;
using P = pair<int,int>;
const int INF=1001001001;
const int NMAX=8;
const int mod = 1000000007;

int main()
{
  string s;
  cin>>s;
  int n=s.size();
  char now='R';
  vector<int>r,l;
  vector<int>ans(n);
  l.push_back(0);
  rep(i,n){
    if (now=='R' and s[i]=='L') r.push_back(i);
    if (now=='L' and s[i]=='R') l.push_back(i);
    now=s[i];
  }
  l.push_back(n);
  int n1=r.size();
  rep(i,n1){
    int nl=r[i]-l[i];
    int nr=l[i+1]-r[i];
  //  cout<<r[i]<<endl;
  //  cout<<nl/2<<' '<<nr/2<<endl;
    ans[r[i]-1]=int(nl/2)+int(nr/2);
    ans[r[i]]=int(nl/2)+int(nr/2);
    if (nl%2==1) ans[r[i]-1]+=1;
    if (nr%2==1) ans[r[i]]+=1;
  }
  rep(i,n){
    cout<<ans[i]<<' ';
  }




}


Measured memory_bytes: 1532
#include <bits/stdc++.h>
#define dbug(x) cout<<#x<<"="<<x<<endl
using namespace std;
template <typename T> void read(T &t) {
	t=0; char ch=getchar(); int f=1;
	while ('0'>ch||ch>'9') { if (ch=='-') f=-1; ch=getchar(); }
	do {(t*=10)+=ch-'0';ch=getchar();} while ('0'<=ch&&ch<='9'); t*=f;
}
const int maxn=(2e5)+10;
int n,d[maxn],dp[maxn],ans;
int main() {
	//freopen("1.txt","r",stdin);
	read(n);
	for (int i=1;i<=n;i++) read(d[i]);
	for (int i=n;i>=1;i--) {
		if (d[i]<d[i+1]||i==n) dp[i]=0;
		else dp[i]=dp[i+1]+1;
		ans=max(ans,dp[i]);
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 1024
import sys, re
import math
 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7
 
# 整数リストを連結表示    print(''.join(map(str, list)))
 
# -*- coding: utf-8 -*-
 
k = INT()
sum = 0


def A(value, sum):
    if value == 0:
        print(sum)
    else:
        for b in range(1, k + 1):
            for c in range(1, k + 1):
                sum += math.gcd(math.gcd(value, b), c)
        A(value - 1, sum)

A(k, 0)

Measured memory_bytes: 9848
#include<stdio.h>

#define	N_MAX				(100000)
#define	MIN(NUM1, NUM2)		((NUM1<NUM2)?(NUM1):(NUM2))
#define	MAX(NUM1, NUM2)		((NUM1>NUM2)?(NUM1):(NUM2))

int main(void){
	int n, h[N_MAX]={};
	int i, j;
	int max;
	
	scanf("%d", &n);
	
	for(i=0; i<n; i++)
		scanf("%d", &h[i]);
	
	max = h[0];
	for(i=1; i<n; i++)
		if( h[i] > max ){
			max = h[i];
		} else {
			if( h[i] < (max-1) ){
				printf("No\n");
				return 0;
			}
		}
	printf("Yes\n");
	
	return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define ll long long
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;

//定数
//円周率
const double pi = 3.141592653589793238462643383279;
//天井
const int INF = 1000000000; // = 10^9
const ll LINF = 100000000000000000; // = 10^17
//ABC文字列
const string ABC = "ABCDEFGHIJKLMNOPQRSTUVWXYZABC";
const string abc = "abcdefghijklmnopqrstuvwxyzabc";
//よくあるmodくん
const ll MOD = 1000000007; // = 10^9 + 7
//前処理テーブルの大きさ指定
const int MAX = 1200000; // = 10^6 + 2*(10^5)
//ちなみに、1024MBで持てる最大長の配列は10^8程度

//データ構造
//隣接リスト用構造体（有向グラフ向け）
struct edge {
  ll to; // E.toでその辺の終点へアクセスできる。
  ll cost; // e.costでその辺の重みにアクセスできる。
};
//Union_Find木
struct UnionFind {
  vector<int> UF; // UF.at(i) : iの親の番号
  vector<int> SIZE; // SIZE.at(root(i)) : iと連結されてる要素の数
  UnionFind(int N) : UF(N), SIZE(N, 1) { // 最初は全てが根であるとして初期化
    for(int i = 0; i < N; i++) {
      UF.at(i) = i;
    }
  }
  int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
    if (UF.at(x) == x) {
      return x;
    }
    return UF.at(x) = root(UF.at(x));
  }
  void unite(int x, int y) { // xとyの木を併合
    int rx = root(x); // xの根をrx
    int ry = root(y); // yの根をry
    if (rx == ry) {
      return; // xとyの根が同じ(=同じ木にある)時はそのまま
    }
    // xとyの根が同じでない(=同じ木にない)時：小さい方の根を大きい方の根につける。
    if (SIZE.at(rx) < SIZE.at(ry)) {
      UF.at(rx) = ry;
      SIZE.at(ry) += SIZE.at(rx);
      SIZE.at(rx) = 0;
    }
    else {
      UF.at(ry) = rx;
      SIZE.at(rx) += SIZE.at(ry);
      SIZE.at(ry) = 0;
    }
  }
  bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す。
    int rx = root(x);
    int ry = root(y);
    return rx == ry;
  }
  int size(int x) { // xと連結されてる要素の数を返す。
    return SIZE.at(root(x));
  }
};

//関数 (計算量)
//ctoi (O(1))
int ctoi(char c){
  if (c == '0') return 0;
  if (c == '1') return 1;
  if (c == '2') return 2;
  if (c == '3') return 3;
  if (c == '4') return 4;
  if (c == '5') return 5; 
  if (c == '6') return 6;
  if (c == '7') return 7;
  if (c == '8') return 8;
  if (c == '9') return 9;
  return -1;  
}
//to_char (O(1))
char to_char(int i){
  if (i == 0) return '0';
  if (i == 1) return '1';
  if (i == 2) return '2';
  if (i == 3) return '3';
  if (i == 4) return '4';
  if (i == 5) return '5';
  if (i == 6) return '6';
  if (i == 7) return '7';
  if (i == 8) return '8'; 
  if (i == 9) return '9';
  return ' ';  
}

// A^N mod M を計算する。modしたくなかったらM = LINFとかにすればよい。(O(√N))
ll modpow(ll A, ll N, ll M) {
  ll ans = 1;
  while (N > 0) {
    if (N & 1) ans = ans * A % M;
      A = A * A % M;
      N >>= 1;
   }
  return ans;
}

//メイン処理
int main() {
  cout << fixed << setprecision(16); //精度向上
  //ここまでテンプレ
  string S, T;
  cin >> S >> T;
  int SS = S.size();
  int TS = T.size();
  int ans = INF;
  for (int i = 0; i <= SS - TS; i++) {
    int M = 0;
    for (int j = 0; j < TS; j++) {
      if (S.at(i + j) != T.at(j)) {
        M++;
      }
    }
    ans = min(ans, M);
  }
  cout << ans << endl;
}

Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vl = vector<ll>;
using vvl = vector<vl>;
using vi = vector<int>;
using vvi = vector<vi>;
#define ote(x) cout<<(x)<<endl
#define all(x) (x).begin(),(x).end()
#define rp(i,s,e) for(int i=(s);i<(e);++i)

ll solve(ll N){
	if(N%2) return 0;
	ll n = N/2;
	int m = log(n)/log(5);
	ll ans = 0;
	ll w = 5;
	rp(i,0,m){
		ans += n/w;
		w*=5;
	}
	return ans;
}

int main(){
	ll N; cin>>N;
	ote(solve(N));
}


Measured memory_bytes: 512
import numpy as np
A, B , H, M = map(int, input().split())

minutes = H*60+M

sita_h = (np.pi/360)*minutes
sita_m = (np.pi/30)*minutes

H_za = (A*np.cos(sita_h), A*np.sin(sita_h))
M_za = (B*np.cos(sita_m), B*np.sin(sita_m))

print(np.sqrt( np.square(H_za[0]-M_za[0]) + np.square(H_za[1]-M_za[1])) )

Measured memory_bytes: 27220
#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <climits>
#include <vector>
#include <numeric>
#include <complex>
#include <map>
#include <bitset>
#include <stack>
#include <queue>
#include <set>
using namespace std;

#define __int64 long long
#define long __int64
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
const int Vec = 4;
const int Vecy[Vec] = {0,-1,0,1};
const int Vecx[Vec] = {1,0,-1,0};
const int Modd = 1000000007;

map<long, long, greater<long>> datas;

void add(long num, long cnt){
    int nowCnt = datas[num];
    datas[num] = nowCnt + cnt;
}

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

    long a, b, c;
    rep(i, n){
        cin >> a;
        add(a, 1);
    }

    rep(i, m){
        cin >> b >> c;
        add(c, b);
    }

    long res = 0;
    long nowCnt = 0;
    long useCnt;
    long cntLeft = n;
    for(auto itr = datas.begin(); itr != datas.end(); ++itr){
        useCnt = min(itr->second, cntLeft);
        cntLeft -= useCnt;
        if(useCnt == 0) break;

        res += itr->first * useCnt;
    }

    cout << res << endl;
}

Measured memory_bytes: 12800
#include <bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a,b) for(int i=a;i<=b;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define vi vector<int>
#define pb push_back
#define pi pair<int,int>
#define vp vector<pair<int,int> >
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define inf 1000000000000000000

using namespace std;

void run(){
    int n;
    cin>>n;
    if(!n){
        cout<<0<<endl;
        return;
    }
    string s;
    while(n){
        int a=abs(n%2);
        if(a)n--;
        n/=-2;
        s+=a+'0';
    }
    reverse(all(s));
    cout<<s<<endl;
}

signed main(){
    cout<<fixed;
    run();
    return 0;
}

Measured memory_bytes: 256
///******* In the name of Allah *******///

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

//long int ar[10013];
//long int gcd(long int a, long int b)
//{
//    if(b==0)
//        return a;
//    return gcd(b,a%b);
//}
//long int sieve(long long int a)
//{
//    long long int i,j,k = 0;
//    memset(ar,0,sizeof(ar));
//    ar[1] = 1;
//    for(i=2; i<=713; i++)
//    {
//        if(ar[i]==0)
//        {
//            for(j=i+i; j<=713; j+=i)
//            {
//                ar[j] = 1;
//            }
//        }
//    }
//    return ar[a];
//}

void Ok()
{
    long int a,b,c,d,e,f,g,h,t,i,j,k,l,m,n;
    long int ans_1,ans_2,ans_3,cnt_1,cnt_2,cnt_3,Max,Min,flag_1,flag_2,temp,sum;
    double aa,bb,cc,dd,ee,ff,gg;
    char aaa,bbb,ccc,ddd;
    string spc,in,store[13];

    cin>>aaa;
    if(aaa>='A' && aaa<='Z')
        cout<<"A"<<endl;
    else if(aaa>='a' && aaa<='z')
        cout<<"a"<<endl;

    return;
}

int main()
{
    Ok();

    return 0;
}


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

const int MAXN = 205;

int vis[MAXN];
int col[MAXN];
string S[MAXN];
int n;

void dfs(int x, int p, int c = 1) {
    vis[x] = p;
    col[x] = c;

    for (int i = 0; i < n; i++) {
        if (vis[i] == 0 && S[x][i] == '1') {
            dfs(i, p, 3 - c);
        }
    }
}

int bfs(int x, const vector<int> &v) {
    queue<int> Q;
    vector<int> dist(MAXN);
    for (auto y: v) {
        dist[y] = MAXN;
        //cerr << "v " << y << "\n";
    }

    dist[x] = 0;
    Q.push(x);

    while (!Q.empty()) {
        x = Q.front();
        //cerr << "vis " << x << "\n";
        Q.pop();

        for (auto y: v) {
            if (S[x][y] == '0') continue;
            if (dist[x] + 1 < dist[y]) {
                dist[y] = dist[x] + 1;
                Q.push(y);
            }
        }
    }

    int res = 0;

    for (auto y: v) {
        res = max(res, dist[y]);
    }

    return res + 1;
}

int32_t main() {
    ios_base::sync_with_stdio(0);
 

    cin >> n;

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

    int cnt = 0;
    for (int i = 0; i < n; ++i) {
        if (vis[i] == 0) {
            dfs(i, ++cnt);
        }
    }

    for (int i = 0; i < n; ++i) {
        for (int j = i + 1; j < n; ++j) {
            if (S[i][j] == '1' && col[i] == col[j]) {
                cout << "-1\n";
                return 0;
            }
        }
    }

    int res = 0;
    //cerr << cnt << "\n";
    for (int c = 1; c <= cnt; ++c) {
        vector<int> v;
        for (int i = 0; i < n; ++i) {
            if (vis[i] == c) {
                v.push_back(i);
            }
        }

        int best = 0;
        for (auto x: v) {
            best = max(best, bfs(x, v));
        }
        //cerr << "b " << best << "\n";

        res += best;
    }

    cout << res << "\n";

    return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define ALL(obj) (obj).begin(),(obj).end()

int main(){
    string s;
    cin >> s;
    int k;
    cin >> k;
    set<string> st;
    vector<string> str;

    for(int i=0;i<s.size();i++){
        for(int j=0;j<=k;j++){
            if(s.size()-i<j)break;
            string t=s.substr(i,j);
            if(st.find(t)==st.end())str.push_back(t);
            st.insert(t);
        }
    }
    sort(ALL(str));
    cout << str.at(k) << endl;
    return 0;
}


Measured memory_bytes: 1792
/**
    And in the end, the love you take is equal to the love you make.

        I LOVE YOU LAURA.
**/

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>

#define _CRT_SECURE_NO_DEPRECATE
#define _CRT_DISABLE_PERFCRIT_LOCKS

#define findOrder find_by_order
#define orderKey order_of_key

#define isOn(mask, i) (mask & (1 << i))
#define turn(mask, i) (mask |= (1 << i))
#define switch(mask, i) (mask &= ~(1 << i))
#define change(mask, i) (mask ^= (1 << i))
#define lowbit(mask) (mask & (-mask))
#define turnAll(mask, n) (mask = (1 << n) - 1)
#define switchLastBit(mask) (mask & (mask - 1))
#define turnLastZero(mask) (mask | (mask + 1))
#define modulo(x, mod) ((x) & (mod - 1))
#define log2(x) (31 - __builtin_clz(x))

#define mkp make_pair
#define pb push_back
#define pf push_front
#define eb emplace_back
#define ef emplace_front
#define ins insert
#define rsz resize
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound

#define sz(x) ((int)x.size())
#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)

#define debug(x) (cerr << x << " ")

using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;

typedef double db;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

typedef pair<int, int> ii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdb;
typedef pair<int, ii> tri;
typedef complex<ld> cd;

typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<ld> vdb;
typedef vector<cd> vcd;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<vll> matrix;

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_tree;

const ll mod = 1e9+7;
const int maxn = 2e5+2;
const int pi = 2 * acos(0.0);
const db eps = 1e-9;

ll arr[maxn], dp[maxn];

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);

    int n; cin >> n;

    for (int i = 1; i <= n; i++){
        cin >> arr[i];
    }

    memset(dp, 63, sizeof dp);

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

    cout << dp[n] << "\n";

    return 0;
}


Measured memory_bytes: 2560
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,tk,i,j,sum;

    scanf("%d %d",&n,&tk);

    for(i=0; i<=n; i++)
    {
        for(j=0; j<=n-i; j++)
        {
            sum=10000*i+5000*j+(n-i-j)*1000;

            if(sum==tk)goto xx;
        }
    }
      if(i==n+1)printf("-1 -1 -1\n");

     else  xx:printf("%d %d %d\n",i,j,n-i-j);

     return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define pb push_back
#define ll long long
using namespace std;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    string s;
    cin>>s;
    if(s[5]-'0'==s[4]-'0' && s[3]-'0'==s[2]-'0')
    {
        cout<<"Yes"<<endl;
    }
    else
    {
        cout<<"No"<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
// atcoder/abc169/E/main.cpp
// author: @___Johniel
// github: https://github.com/johniel/

#include <bits/stdc++.h>

#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))

using namespace std;

template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << "," << p.second << ")"; return os; }
template<typename P, typename Q> istream& operator >> (istream& is, pair<P, Q>& p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; for (auto& i: v) os << i << ","; os << ")"; return os; }
template<typename T> istream& operator >> (istream& is, vector<T>& v) { for (auto& i: v) is >> i; return is; }
template<typename T> ostream& operator << (ostream& os, set<T> s) { os << "#{"; for (auto& i: s) os << i << ","; os << "}"; return os; }
template<typename K, typename V> ostream& operator << (ostream& os, map<K, V> m) { os << "{"; for (auto& i: m) os << i << ","; os << "}"; return os; }

template<typename T> inline T setmax(T& a, T b) { return a = std::max(a, b); }
template<typename T> inline T setmin(T& a, T b) { return a = std::min(a, b); }

using lli = long long int;
using ull = unsigned long long;
using point = complex<double>;
using str = string;
template<typename T> using vec = vector<T>;

constexpr array<int, 8> di({0, 1, -1, 0, 1, -1, 1, -1});
constexpr array<int, 8> dj({1, 0, 0, -1, 1, -1, -1, 1});
constexpr lli mod = 1e9 + 7;

int main(int argc, char *argv[])
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.setf(ios_base::fixed);
  cout.precision(15);

  int n;
  while (cin >> n) {
    vec<pair<lli, lli>> v(n);
    cin >> v;

    if (n % 2) {
      sort(v.begin(), v.end());
      lli mn = v[n / 2].first;
      sort(v.begin(), v.end(), [] (auto i, auto j) { return i.second < j.second; });
      lli mx = v[n / 2].second;
      cout << mx - mn + 1 << endl;
    } else {
      sort(v.begin(), v.end());
      lli mn = v[n / 2 - 1].first + v[n / 2].first;
      sort(v.begin(), v.end(), [] (auto i, auto j) { return i.second < j.second; });
      lli mx = v[n / 2 - 1].second + v[n / 2].second;
      cout << mx - mn + 1 << endl;
    }
  }

  return 0;
}


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


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

    ll N;
    cin >> N;
    ll T[N];
    ll A[N];
    rep(i, N) cin >> T[i];
    rep(i, N) cin >> A[i];
    P Tp[N];
    P Ap[N];
    ll old = -1;
    for(ll i=0; i<N; i++){
      if(T[i] != old) Tp[i] = make_pair(0, T[i]);
      else Tp[i] = make_pair(1, T[i]);
      old = Tp[i].second;
    }
    old = -1;
    for(ll i=N-1; i>=0; i--){
      if(A[i] != old) Ap[i] = make_pair(0, A[i]);
      else Ap[i] = make_pair(1, A[i]);
      old = Ap[i].second;
    }
    old = -1;
    ll ans = 1;
    for(ll i=0; i<N; i++){
      if(Tp[i].first == 0 && Ap[i].first == 0){
        if(Tp[i].second != Ap[i].second){
          cout << 0 << endl;
          return 0;
        }
      }else if(Tp[i].first == 1 && Ap[i].first == 1){
        ans *= (min(Tp[i].second, Ap[i].second));
        ans %= 1000000007;
      }else if(Tp[i].first == 1){
        if(Tp[i].second < Ap[i].second){
          cout << 0 << endl;
          return 0;
        }
      }else{
        if(Ap[i].second < Tp[i].second){
          cout << 0 << endl;
          return 0;
        }
      }
    }
    cout << ans << endl;
}


Measured memory_bytes: 5120
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, begin, end) for(ll i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(ll i=(begin)-1;i>=(end);i--)
#define IREP(i, n) IFOR(i,n,0)
#define SORT(a) sort(a.begin(), a.end())
#define ISORT(a) sort(a.begin(), a.end(),greater<ll>())
#define REVERSE(a) reverse(a.begin(), a.end())
#define debug(x) cout << #x << "=" << x << endl;
#define vdebug(v) cout << #v << "=(" << v[0]; FOR(i_debug, 1, v.size()){ cout << "," << v[i_debug]; } cout << ")" << endl;
#define mdebug(m) cout << #m << "=" << endl; REP(i_debug, m.size()){ REP(j_debug, m[i_debug].size()){ cout << m[i_debug][j_debug] << ","; } cout << endl;}
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define Max(a, b) a = max(a, b)
#define Min(a, b) a = min(a, b)

#define ll long long
#define f first
#define s second
#define mp make_pair
#define pb push_back
#define INF 1000000000000000000

using vec = vector<ll>;
using mat = vector<vec>;
using Pii = pair<ll, ll>;
using PiP = pair<ll, Pii>;
using PPi = pair<Pii, ll>;
using bvec = vector<bool>;
using Pvec = vector<Pii>;


template<typename T> void readv(vector<T> &a) { REP(i, a.size()) cin >> a[i]; }
void readv_m1(vector<int> &a) { REP(i, a.size()) {cin >> a[i]; a[i]--;} }

ll mod = 1000000007;

int main()
{
	ll M, D;
	cin >> M >> D;

	ll ans = 0;
	FOR(i, 20, D + 1) {
		if (i % 10 < 2) continue;
		ll m = i % 10 * (i / 10);
		// cout << "D" << i << "m" << m << endl;
		if (m <= M) ans++;
	}

	cout << ans << endl;

	return 0;
}

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

#define FASTIO ios_base::sync_with_stdio(false), cin.tie(0)

int main() {
  FASTIO;
  int a, b, c;
  cin >> a >> b >> c;
  swap(a, b);
  swap(a, c);
  cout << a << " " << b << " " << c << endl;
  return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"

using namespace std;
typedef long long int ll;
typedef pair<ll, ll > pi; 
typedef pair<pair<double, double >, double > pii; 

int main(){

    ll N, A, B;
    cin >> N >> A >> B;

    ll ans = min(A * N, B);

    cout << ans << endl;

}

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 RFOR(i, a, b) for(int i = (a); i >= (b); i--)
#define LLFOR(i, a, b) for(long long i = (a); i < (b); ++i)
#define LLRFOR(i, a, b) for(long long i = (a); i >= (b); i--)
#define USFOR(i, a, b) for(unsigned i = (a); i < (b); ++i)
#define SORT(v, n) sort(v, v+n)
#define REP(i, n) for(int i = 0; i < (n); ++i)
#define LLREP(i, n) for(long long i = 0; i < (n); ++i)
#define USREP(i, n) for(unsigned i = 0; i < (n); ++i)
#define RREP(i, n) for(int i = n; i >= n; i--)
#define LLRREP(i, n) for(long long i = n; i >= n; i--)

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

#define endl "\n"
#define pb push_back
#define rtn return

#define INF 2000000000	//int型は2 * 10^9ぐらいまで
#define MOD 1000000007
 
const int dx[]={1,0,-1,0}, dy[]={0,-1,0,1};

typedef long long ll;
typedef unsigned long long ull;

template <typename T>
inline T MAX(T a,T b){if(a>b){return a;}return b;}
template <typename T>
inline T MIN(T a,T b){if(a<b){return a;}return b;}
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, d[100];
   vector<int> v;
   cin >> n;
   REP(i, n) cin >> d[i];

   REP(i, n){
      bool dabu = false;
      if(v.empty()) v.pb(d[i]);
      else{
         USREP(j, v.size()){
            if(d[i] == v.at(j)){
               dabu = true;
               break;
            }
         }
         if(dabu == false) v.pb(d[i]);
      }
   }

   cout << v.size() << endl;

	rtn 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	string s;
	cin>>s;
	string t=s;
	reverse(s.begin(),s.end());
	int cnt=0;
	for(int i=0;i<s.size();i++) if(s[i]!=t[i]) cnt++;
	cout<<(cnt?cnt/2:cnt)<<endl;
	return 0;
} 


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <set>
#include <iomanip>
#include <stack>
#include <fstream>
#include <cstdint>
#include <cmath>
#include <algorithm>
#include <utility>
#include <numeric>
#include <functional>
using namespace std;
typedef int64_t ll;
typedef uint64_t ull;
constexpr uint64_t L1 = 1ull;
constexpr ull bit(int n){ return 1ull << n;}

constexpr ll INF       = 1000000000;/* 1e+9a */
// for(auto && i : Range(l,r))
// -> i = [l..r)
class Range {
private: struct It{ int x; int operator*(){return x;}
 bool operator!=(It& lhs){ return x<lhs.x;} void operator++(){++x;} }; It l,r;
public: Range(int n):l({0}),r({n}){} Range(int i,int n):l({i}),r({n})
 {}It& begin(){return l;} It& end(){return r;} };

void solve(istream& cin) {
    int N, M;
    while(cin >> N >> M){
        vector<set<int>> v(N, set<int>());
        for (int i = 0; i < M; ++i) {
            int a, b;
            cin >> a >> b;
            a--, b--;
            v[a].insert(b);
            v[b].insert(a);
        }
        ll count = 0;
        vector<int> rt(N);
        for (int i = 0; i < rt.size(); ++i) { rt[i] = i; }
        do{
            count += [&v, &rt]() {
                for (int i = 1; i < rt.size(); ++i) {
                    if (v[rt[i-1]].count(rt[i]) == 0)
                        return 0;
                }
                return 1;
            }();
        } while(next_permutation(rt.begin()+1, rt.end()));
        cout << count << endl;
    }
}

int main(int argc, char *argv[]) {
    string FileName("C"), Modifier("MEPH_");
    string ExecutionName = Modifier + FileName;
    string sub(argv[0]);
    if(sub.size() > ExecutionName.size())
        sub = sub.substr(sub.size()-ExecutionName.size(), ExecutionName.size());

    cout << setprecision(16) << scientific;
    if (sub != ExecutionName) {
        cin.tie(0);
        ios::sync_with_stdio(false);
        solve(cin);
    }
    else {    
	    cerr << sub << endl;
        string inFile = "sample.txt";
        auto fs = fstream(inFile, fstream::in);
        solve(fs);
    }
}

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

#define _CRT_SECURE_NO_WARNINGS
#define TLong long long
#define TBMod 1000000007

int main(int argc, char const *argv[])
{
	int n,m;
	int l[100007],r[100007];
	int lmax,rmin;
	scanf("%d%d",&n,&m);

	for(int i = 0; i < m; i++)	scanf("%d%d",&l[i],&r[i]);
	lmax = l[0];
	for(int i = 0; i < m; i++){
		if(l[i] > lmax)	lmax = l[i];
	}
	rmin = r[0];
	for(int i = 0; i < m; i++){
		if(rmin > r[i])	rmin = r[i];
	}	
	if(rmin - lmax >= 0)	printf("%d\n",rmin - lmax + 1);
	else	printf("0\n");
	return 0;
}


Measured memory_bytes: 896
require 'numo/narray'
include Numo

h, w, k = gets.split.map(&:to_i)
rows = Array.new(h){gets.chomp.chars.map{|c| (c == '#') ? 1 : 0}}
cnt = 0
[0, 1].repeated_permutation(h).each do |x|
  m = Int32[*rows.dup]
  x.each_with_index do |y, i|
    m[i, true] = 0 if y == 1
  end
  [0, 1].repeated_permutation(w) do |u|
    mc = Marshal.load(Marshal.dump(m))
    u.each_with_index do |v, l|
      mc[true, l] = 0 if v == 1
    end
    cnt += 1 if mc.to_a.flatten.sum == k
  end
end
puts cnt

Measured memory_bytes: 16368
#include <stdio.h>

int main(void)          
{

	int a, b;
	char op = 'a';

	while (1 > 0)
	{
		if (op == '?' ) break;
		
		scanf("%d %c %d", &a, &op, &b);
		if (op == '+')
		{
			printf("%d\n", a + b);
		}

		if (op == '-')
		{
			printf("%d\n", a - b);
		}
		if (op == '*')
		{
			printf("%d\n", a * b);
		}
		if (op == '/')
		{
			printf("%d\n", a / b);
		}
	}
	return 0;
}

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

#define int long long

const int N = 3e5 + 5;
const int mod = 998244353;

int n, A, B, K;

namespace {
  int add(int x) {return (x >= mod) ? x - mod : x;}
  int sub(int x) {return (x < 0) ? x + mod : x;}
  void Add(int &x, int y) {x = add(x + y);}
  void Sub(int &x, int y) {x = sub(x - y);}
  int Pow(int x, int y = mod - 2) {
	int res = 1;
	for(; y; y >>= 1, x = x * x % mod) {
	  if(y & 1) {
		res = res * x % mod;
	  }
	}
	return res;
  }
}

int fac[N], inv[N];

int C(int x, int y) {
  if(x < y) return 0;
  return fac[x] * inv[y] % mod * inv[x - y] % mod;
}

signed main() {
  cin >> n >> A >> B >> K;
  fac[0] = inv[0] = 1;
  for(int i = 1; i <= n; ++ i) fac[i] = fac[i - 1] * i % mod;
  inv[n] = Pow(fac[n]);
  for(int i = n - 1; i >= 1; -- i)
	inv[i] = inv[i + 1] * (i + 1) % mod;
  int ans = 0;
  for(int i = 0; i <= n; ++ i) {
	int now = K - i * A;
	if(now < 0) continue;
	if(now % B != 0) continue;
	now /= B;
	Add(ans, C(n, now) * C(n, i) % mod);
  }
  cout << ans << endl;
}


Measured memory_bytes: 4992
#include<stdio.h>
#include<string.h>
#define LEN1 1000001
#define LEN2 10001
void nativeStringSearch(char*,char*);
int main(void)
{
  char str1[LEN1],str2[LEN2];
  scanf("%s%s",str1,str2);
  nativeStringSearch(str1,str2);
  return 0;
}
void nativeStringSearch(char *str1,char *str2)
{
  int i;//counter
  int len1,len2;
  len1=strlen(str1);
  len2=strlen(str2);
  for(i=0;len1-i>=len2;i++)
    {
      if(strncmp(str1+i,str2,strlen(str2))==0) printf("%d\n",i);
    }
}


Measured memory_bytes: 2840
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(ll i = 0;i<((ll)(n));i++)
#define reg(i,a,b) for(ll i = ((ll)(a));i<=((ll)(b));i++)
#define irep(i,n) for(ll i = ((ll)(n)-1);i>=0;i--)
#define ireg(i,a,b) for(ll i = ((ll)(b));i>=((ll)(a));i--)

/*
*/

bool ok=true;
ll n,a[200010],ans;
map<ll,ll> m;

void init(){
	cin>>n;
	rep(i,n){
		cin>>a[i];
		m[a[i]]++;
	}
}

int main(void){
	init();
	if(m.size()>3){
		ok=false;
		//不可能
	}else if(m.size()==3){
		// ３の倍数のみ
		if(n%3!=0)ok=false;
		ll key[3],val[3],c=0;
		for(auto itr = m.begin(); itr != m.end(); ++itr,++c) {
			if(itr->second != n/3)ok=false;
			key[c]=itr->first;
		}
		if(key[0]!=(key[1]^key[2]))ok=false;
	}else if(m.size()==2){
		// 0と何か
		if(n%3!=0)ok=false;
		ll key[2],val[2],c=0;
		for(auto itr = m.begin(); itr != m.end(); ++itr,++c) {
			key[c]=itr->first;
			val[c]=itr->second;
		}
		if(key[0]==0){
			if(val[0]!=n/3)ok=false;
		}else if(key[1]==0){
			if(val[1]!=n/3)ok=false;
		}else{
			ok=false;
		}
	}else{
		// 0のみ
		for(auto itr = m.begin(); itr != m.end(); ++itr) {
			if(itr->first != 0)ok=false;
		}
	}
	cout<<(ok?"Yes":"No")<<endl;
	return 0;
}

Measured memory_bytes: 5632