akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <map>
#include <queue>
#include <string>
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;
const int N=100000+5;
queue<int>q;
struct P
{
    int v;
    ll w;
    P(){};
    P(int a,ll b)
    {
        v=a;
        w=b;
    }
}sz[N];
struct
{
    vector<P>e;
}p[N];
ll mine[N],_min=0,_max=1000000000;
int n,m;
int main() {
    scanf("%d%d",&n,&m);
    for(int i=1;i<=n;i++)
    {
        sz[i].v=-1;
        mine[i]=1000000000;
    }
    for(int i=0;i<m;i++)
    {
        int x,y;
        ll w;
        scanf("%d%d%lld",&x,&y,&w);
        p[x].e.push_back(P(y,w));
        p[y].e.push_back(P(x,w));
        mine[x]=min(mine[x],w);
        mine[y]=min(mine[y],w);
    }
    /*for(int i=1;i<=n;i++)
    {
        for(vector<P>::iterator it=p[i].e.begin();it!=p[i].e.end();it++)
        {
            printf("%d ",(*it).v);
        }
        printf("\n");
    }*/
    sz[1].v=0;
    sz[1].w=0;
    _max=min(_max,mine[1]);
    q.push(1);
    while(!q.empty())
    {
        int x=q.front();
        q.pop();
        for(vector<P>::iterator it=p[x].e.begin();it!=p[x].e.end();it++)
        {

            int v=(*it).v;//printf("%d\n",v);
            ll w=(*it).w;
            if(sz[v].v==-1)
            {
                sz[v]=P(1-sz[x].v,w-sz[x].w);
                if(sz[v].v==0)
                {
                    _min=max(_min,-1*(sz[v].w));
                    _max=min(_max,mine[v]-sz[v].w);
                }
                else
                {
                    _min=max(_min,sz[v].w-mine[v]);
                    _max=min(_max,sz[v].w);
                }
                q.push(v);
            }
            else if(sz[v].v==1)
            {
                if(sz[x].v==0)
                {
                    if(sz[x].w+sz[v].w!=w) {printf("0\n");return 0;}
                }
                else
                {
                    if((sz[x].w+sz[v].w-w)<=0||(sz[x].w+sz[v].w-w)%2!=0) {printf("0\n");return 0;}
                    _max=min(_max,(sz[x].w+sz[v].w-w)/2+1);
                    _min=max(_min,(sz[x].w+sz[v].w-w)/2-1);
                }
            }
            else
            {
                if(sz[x].v==0)
                {
                    if((w-sz[x].w-sz[v].w)<=0||(w-sz[x].w-sz[v].w)%2!=0) {printf("0\n");return 0;}
                    _max=min(_max,(w-sz[x].w-sz[v].w)/2+1);
                    _min=max(_min,(w-sz[x].w-sz[v].w)/2-1);

                }
                else
                {
                    if(sz[x].w+sz[v].w!=w) {printf("0\n");return 0;}
                }
            }
        }
    }
    /*for(int i=1;i<=n;i++)
    {
        printf("%lld%cx\n",sz[i].w,sz[i].v==1?'-':'+');
    }*/
    if(_max>_min+1) printf("%lld",_max-_min-1);
    else printf("0");
    return 0;
}



Measured memory_bytes: 10496
#include <iostream>
#include <cstdio>
using namespace std;
int main()
{
	int a,b,c;
	cin>>a>>b>>c;
	if((10*b+c)%4==0)
	{
		cout<<"YES"<<endl;
    }
	else if((10*b+c)%4!=0)
	{
		cout<<"NO"<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
import sys
import numpy as np
sys.setrecursionlimit(10 ** 7)

# Wrong Answer
# WA


N, K = map(int, input().split())
MOD = 10 ** 9 + 7

# 階乗、Combinationコンビネーション(numpyを使う)


def cumprod(arr, MOD):
    L = len(arr)
    Lsq = int(L**.5+1)
    arr = np.resize(arr, Lsq**2).reshape(Lsq, Lsq)
    for n in range(1, Lsq):
        arr[:, n] *= arr[:, n-1]
        arr[:, n] %= MOD
    for n in range(1, Lsq):
        arr[n] *= arr[n-1, -1]
        arr[n] %= MOD
    return arr.ravel()[:L]


def make_fact(U, MOD):
    x = np.arange(U, dtype=np.int64)
    x[0] = 1
    fact = cumprod(x, MOD)
    x = np.arange(U, 0, -1, dtype=np.int64)
    x[0] = pow(int(fact[-1]), MOD-2, MOD)
    fact_inv = cumprod(x, MOD)[::-1]
    return fact, fact_inv


U = 10**6
fact, fact_inv = make_fact(U, MOD)


def mod_comb_k(n, k, mod):
    return fact[n] * fact_inv[k] % mod * fact_inv[n - k] % mod


ans = 0
for i in range(N):
    if K < i:
        continue

    if i == 0:
        ans += 1
        continue

    '''
    a = mod_comb_k(N - 1, i, MOD)
    b = mod_comb_k(N, i, MOD)
    c = a * b
    c %= MOD
    '''
    a = mod_comb_k(N - 1, i, MOD)
    b = mod_comb_k(N, i, MOD)
    c = a * b % MOD
    ans += c
    ans %= MOD

print(ans)


Measured memory_bytes: 53564
import itertools
 
N = int(input())
xy = [0] * N
for i in range(N):
  xy[i] = list(map(int, input().split()))
  
lis = [x for x in range(N)] # 0からn-1までのリスト 
permutations_lis = itertools.permutations(lis)# 全ての場合のリストを生成
# 以下出力
divide = 0
ans = 0
for one_case in permutations_lis: 
  divide += 1
  #print(one_case)
  for i in range(len(one_case) - 1):
    #print(num)
    num = one_case[i]
    num2 = one_case[i + 1]
    ans +=  ((xy[num2][0] - xy[num][0]) ** (2) + (xy[num2][1] - xy[num][1]) ** (2)) ** (1/2)
    #print(ans)
#print(ans, divide)
print(ans / divide)    
    
    
    

Measured memory_bytes: 41068
#include <bits/stdc++.h>
using namespace std;
string s,st;
int main()
{
    getline(cin,s);
    getline(cin,st);
    int n=s.size();
    s=s+s;
    if (st.size()>n)
    {
        printf("No\n");
        return 0;
    }
    for(int i=0;i<n;i++)
    {
        bool kt=true;
        for(int j=0;j<st.size();j++)
            if (s[i+j]!=st[j])
            {
                kt=false;
                break;
            }
        if (kt)
        {
            printf("Yes\n");
            return 0;
        }
    }
    printf("No\n");
}



Measured memory_bytes: 3208
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define FOR(i, a, b) for(ll i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define whole(x) (x).begin(),(x).end()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
using P = pair<ll, ll>;
#define debug(var) cout << "[" << #var << "] " << var << endl
const ll mod = 1000000007;
const ll INF = 1E+18;


int main(){
    ll n;
    cin >> n;
    vector<string> s(n);
    //vector<P> x(n);
    vector<P> a;
    vector<P> b;
    vector<P> x1;
    vector<P> x2;

    rep(i, n) {
        cin >> s[i];
        ll x = 0;
        ll y = 0;
        rep(j, s[i].size()) {
            if (s[i][j]=='(') y++;
            else y--;
            x = min(x, y);
        }
        if (y>=0 && x==0) a.emplace_back(x, y);
        else if (y<0 && x==y) b.emplace_back(x, y);
        else if (y>=0) x1.emplace_back(x, y);
        else x2.emplace_back(x, y);
    }
    sort(x1.begin(), x1.end());
    sort(x2.begin(), x2.end());
    reverse(x1.begin(), x1.end());
    string ans = "Yes";
    ll now = 0;
    rep(i, a.size()) now += a[i].second;
    for (auto e: x1) {
        if (now<-e.first) {
            ans = "No";
            break;
        } 
        now += e.second;
    }
    for (auto e: x2) {
        if (now<-e.first) {
            ans = "No";
            break;
        }
        now += e.second;
    }
    rep(i, b.size()) now += b[i].second;
    
    if (now!=0) ans = "No";
    
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 50224
#include<bits/stdc++.h>
#define int long long
#define N 500005
using namespace std;
int n,L,a[N],pre[N],suf[N]; 
signed main(){
	scanf("%lld%lld",&L,&n);
	for (int i=1;i<=n;i++) scanf("%lld",&a[i]);
	for (int i=1;i<=n;i++) {
		pre[i]=pre[i-1]+a[i];
		suf[i]=suf[i-1]+L-a[i];
	}
	int ans=max(a[n],L-a[1]);
	for (int i=1;i<=n;i++){
		int l=i+1,r=n,len=(r-l+1)/2;
		if (l<=r){
			int tmp=2*a[i];
			tmp+=2*(pre[l+len-1]-pre[l-1]);
			tmp+=2*(suf[r]-suf[r-len]);
			if(len*2==r-l+1) tmp-=a[l+len-1];
			else tmp+=L-a[l+len];
			ans=max(ans,tmp);
		}
		l=1,r=i-1,len=(r-l+1)/2;
		if (l<=r){
			int tmp=2*(L-a[i]);
			tmp+=2*(pre[l+len-1]-pre[l-1]);
			tmp+=2*(suf[r]-suf[r-len]);
			if (len*2==r-l+1) tmp-=L-a[l+len];
			else tmp+=a[l+len];
			ans=max(ans,tmp);
		}
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 9984
/*Bismillahir Rahmanir Rahim*///{
#include <bits/stdc++.h>
#include <ext/numeric>
using namespace std; using __gnu_cxx::power;
using ll = long long; using ull = unsigned long long; using ld = long double;
const ll llinf = (1ll<<61)-1; const double eps = 1e-6, ldeps = 1e-9;
struct Dbg { static constexpr auto &os = cout;   // replace by cerr in interactive.
template<class C> static auto o(C *x)->decltype(os << *x, 0);
template<class C> static char o(...);
template<class C> typename enable_if<sizeof o<C>(0)!=1,Dbg&>::type operator<<(const C &x) {os<<x; return *this;}
template<class C> Dbg &dump(C b, C e) {
    for (struct{C i;int j;} i={(*this<<"\n[",b),0}; i.i!=e and i.j<26; i.i++, i.j++) *this<<", "+2*(i.i==b)<<*i.i;
    return *this << ']';
}
template<class C> typename enable_if<sizeof o<C>(0)==1, Dbg&>::type operator<<(const C &x) {
    return dump(begin(x), end(x));
}
template<class C, size_t X> typename enable_if<!is_same<C, const char>::value, Dbg&>::type operator<<(C (&x)[X]) {
    return dump(begin(x), end(x));
}
template<class B, class C> Dbg &operator<<(const pair<B, C> &x) {return *this<<'{'<<x.first<<", "<<x.second<<'}';}
Dbg &operator<<(ostream&(*x)(std::ostream&)) { os << x; return *this; }
} dbg;
void err(istringstream *iss) { delete iss; }
template<class C, class... Args> void err(istringstream *iss, const C &val, const Args &... args) {
    string name; *iss >> name; if (name.back()==',') name.pop_back();
    dbg << name << " = " << val << "; ", err(iss, args...);
}
#define bug(args...) dbg << __LINE__ << ": ", err(new istringstream(#args), args), dbg << endl
#define cbug(a, args...) if (a) bug(args);
#define ASSERT(a, o, b, args...) if (!((a)o(b))) bug(a, b, ##args), assert((a)o(b));
#define sl(a) int(strlen(a))
#define sz(a) int(a.size())
int T, Q, cn;//}
const int inf = 1000000007, mxn = 200005;

int n, K, a[mxn], b[mxn];

signed main() { cin.tie(0)->sync_with_stdio(0); cin.exceptions(cin.failbit); cout.precision(11), cout.setf(ios::fixed);
    cin >> n >> K;
    for (int i = 1; i <= n; i++) {
        cin >> a[i];
    }
    for (int i = 0; i < K; i++) {
        memset(b, 0, sizeof(b));
        for (int j = 1; j <= n; j++) {
            ++b[max(1, j-a[j])], --b[min(n, j+a[j])+1];
        }
        for (int j = 1; j <= n; j++) {
            b[j] = b[j-1]+b[j];
        }
        bool ok = 1;
        for (int j = 1; j <= n; j++) {
            a[j] = b[j];
            ok &= a[j] == n;
        }//bug(a);
        if (ok) {
            //bug(i);
            break;
        }
    }
    for (int i = 1; i <= n; i++) {
        cout << a[i] << " \n"[i == n];
    }
}

Measured memory_bytes: 5204
import java.util.*;

class Main {
    final Scanner sc = new Scanner(System.in);

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

    private void run() {
        int n = sc.nextInt();

        for (int i = 1; i <= 9; i++) {
            if (n % i == 0 && n / i <= 9) {
                System.out.println("Yes");
                return;
            }
        }
        System.out.println("No");
    }
}



Measured memory_bytes: 23892
fn main() {
    let f = read();
    let ans = solve(f);
    write(ans);
}

fn read() -> f64 {
    let mut l1 = String::new();
    std::io::stdin().read_line(&mut l1).ok();
    let r: f64 = l1.trim().parse().unwrap();
    r
}

fn write(s: f64) {
    println!("{}", s);
}

fn solve(r: f64) -> f64 {
    2f64 * std::f64::consts::PI * r
}


Measured memory_bytes: 2156
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define F first
#define S second
ll mod=998244353;

int main(){
    std::ios::sync_with_stdio(false);
    int s,t;
    cin>>s>>t;
    int f=s;
    if(t==1){
        cout<<0;return 0;
    }
    int co=1;
    s=s-1;
    while(f<t){
        f+=s;
        co++;
    }
    cout<<co;

    return 0;
}



Measured memory_bytes: 256
// Created on: 22-Aug-2020 18:07:37 //

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

long long n, a[200005], s;

int main() {
    cin >> n;
    cin >> a[0];
    for (int i = 1; i < n; i++) {
        cin >> a[i];
        if (a[i] < a[i - 1]) {
            s += (a[i - 1] - a[i]);
            a[i] = a[i - 1];
        }
    }

    cout << s << endl;

    return 0;
}

Measured memory_bytes: 5156
#include <stdio.h>
#define ll long long
ll gcd(ll x,ll y) {
    while(y) {
        ll t=x%y;
        x=y;
        y=t;
    }
    return x;
}

int main()
{
    ll a,b;
    scanf("%lld%lld",&a,&b);
    ll num = gcd(a,b);
    int count=1;
    for (ll i=2;i*i<=num;i++) {
        if (num%i==0) {
            count++;
            while(num%i==0) {
                num/=i;
            }
        }
    }
    printf("%d",count+(num!=1));
    return 0;
}

Measured memory_bytes: 1704
#include<stdio.h>
int main(void){
	int h,w,i,j,flag;
	char line[100];
	scanf("%d%d",&h,&w);
	for(i=0; i<h; i++){
		scanf("%s",line);
		flag=-1;
		for(j=0; j<w; j++){
			if(line[j]=='c'){
				flag=0;
			}else if(flag>-1){
				flag++;
			}
			printf("%d",flag);
			if(j==(w-1)){
				printf("\n");
			}else{
				printf(" ");
			}
		}
	}
	return 0;
}

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

typedef struct
{
  int C, VDL[3];
} Bydol;

int main()
{
  int N, M;
  while (cin >> N >> M) {
    string tmp;
    getline(cin, tmp);

    vector<Bydol> bydol(N);
    for (int i = 0; i < N; ++i) {
      getline(cin, tmp);
      cin >> bydol[i].C >> bydol[i].VDL[0] >> bydol[i].VDL[1] >> bydol[i].VDL[2];
      getline(cin, tmp);
    }

    int ans = 0;
    for (int i = 0; i < 3; ++i) {
      vector<vector<int> > dp(N+1, vector<int>(M+1, 0));
      for (int j = 0; j < N; ++j) {
	for (int k = 0; k < M+1; ++k) {
	  if (k < bydol[j].C)
	    dp[j+1][k] = dp[j][k];
	  else
	    dp[j+1][k] = max(dp[j][k], dp[j+1][k-bydol[j].C]+bydol[j].VDL[i]);
	}
      }
      ans = max(ans, dp[N][M]);
    }
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 1296
import sys
write=sys.stdout.write

number_of_numbers=[]
numbers=[]

number_of_numbers=input().split()
number_of_numbers[0]=int(number_of_numbers[0])
number_of_numbers[1]=int(number_of_numbers[1])



for i in range(0,number_of_numbers[0]):
    line_nunmbers=[]
    line_numbers=input().split()
    for j in range(0,len(line_numbers)):
        line_numbers[j]=int(line_numbers[j])
    numbers.append(line_numbers)

right_end_numbers=[]
under_end_numbers=[]

for i in range(0,len(numbers)):
    right_end_numbers.append(sum(numbers[i]))

for i in range(0,len(numbers[0])):
    under_end_number=0
    for j in range(0,len(numbers)):
        under_end_number+=numbers[j][i]
    under_end_numbers.append(under_end_number)

for i in range(0,len(numbers)):
    for j in range(0,len(numbers[0])):
        write(str(numbers[i][j]))
        write(' ')
    print(right_end_numbers[i])

for i in range(0,len(numbers[0])):
    write(str(under_end_numbers[i]))
    write(' ')

print(sum(under_end_numbers))

Measured memory_bytes: 8272
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<array>
#include<map>
#include<iomanip>
#include<assert.h>
#include<list>
#include<bitset>
#include<stack>
#include<memory>
#include<numeric>
using namespace std;
using namespace std::chrono;
typedef long long int llint;
typedef long double lldo;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase
#define REP(i, n) for(int i = 0;i < (n);i++)
/*cout<<fixed<<setprecision(20);cin.tie(0);ios::sync_with_stdio(false);*/
const llint mod=1000000007;
const llint inf=2.19e15+1;
const long double pai=3.141592653589793238462643383279502884197;
const long double eps=1e-10;
template <class T,class U>bool chmin(T& a,U b){if(a>b){a=b;return true;}return false;}
template <class T,class U>bool chmax(T& a,U b){if(a<b){a=b;return true;}return false;}
llint gcd(llint a,llint b){if(a%b==0){return b;}else return gcd(b,a%b);}
llint lcm(llint a,llint b){if(a==0){return b;}return a/gcd(a,b)*b;}
template<class T> void SO(T& ve){sort(ve.begin(),ve.end());}
template<class T> void REV(T& ve){reverse(ve.begin(),ve.end());}
template<class T>llint LBI(const vector<T>&ar,T in){return lower_bound(ar.begin(),ar.end(),in)-ar.begin();}
template<class T>llint UBI(const vector<T>&ar,T in){return upper_bound(ar.begin(),ar.end(),in)-ar.begin();}

int main(void){
	cin.tie(0);ios::sync_with_stdio(false);
	llint i,X,Y,A,B,C,ans=0;cin>>X>>Y>>A>>B>>C;
	vector<pair<llint,int>>rng;
	rng.reserve(A+B+C);
	for(i=0;i<A;i++){
		llint p;cin>>p;
		rng.pub(mp(p,0));
	}
	for(i=0;i<B;i++){
		llint p;cin>>p;
		rng.pub(mp(p,1));
	}
	for(i=0;i<C;i++){
		llint p;cin>>p;
		rng.pub(mp(p,2));
	}
	SO(rng);REV(rng);
	int ta=0,tb=0,tz=0;
	for(i=0;tz<X+Y;i++){
		auto it=rng[i];
		if(it.sec==0){if(ta<X){ans+=it.fir;ta++;tz++;}}
		if(it.sec==1){if(tb<Y){ans+=it.fir;tb++;tz++;}}
		if(it.sec==2){ans+=it.fir;tz++;}
		
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 4992
#include <bits/stdc++.h>
using namespace std;
char st[10000];
int main(){
	scanf("%s",st);
	int n = strlen(st);
	bool jieti = false;
	if (st[0] != 'A') jieti = true;
	for (int i = 1; i < n; i++)
		if (st[i] == 'A')
			jieti = true;
	int s = 0;
	for (int i = 2; i < n - 1; i++)
		s += (st[i] == 'C');
	if (s != 1) jieti = true;
	s = 0;
	for (int i = 0; i < n; i++)
		s += (st[i] <= 'Z' && st[i] >= 'A');
	if (s != 2) jieti = true;
	if (jieti) printf("WA\n");
	else printf("AC\n");
}

Measured memory_bytes: 256
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
#define int         long long   
#define double      long double
#define endl        "\n"
#define pb          push_back
#define PI          3.1415926535897932384626433832795l
#define F           first
#define S           second
#define mp          make_pair
#define f(i,n)      for(int i=0;i<n;i++)
#define fastio      ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define all(v)      (v).begin(),(v).end()
#define rall(v)     (v).rbegin(),(v).rend()
#define gcd(a,b)    __gcd((a),(b))

typedef pair<int,int> pii;
typedef vector<int> vi;

signed main() 
{
    fastio;
    int r,c;
    cin>>r>>c;
    if(r==1 or c==1)cout<<1<<endl;
    else
    {
        
        if(r%2==0)
        {
            cout<<(r/2)*c<<endl;
        }
        else
        {
            int x1=(r+1)/2;
            int x2=r/2;
            if(c%2==0)
            {
                cout<<x1*(c/2)+x2*(c/2)<<endl;
            }
            else
            {
                cout<<x1*((c+1)/2)+x2*(c/2)<<endl;
            }
        }
    }
    
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <memory>
#include <complex>
#include <numeric>
#include <cstdio>
#include <iomanip>

#define REP(i,m,n) for(int i=int(m);i<int(n);i++)
#define EACH(i,c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())

#ifdef LOCAL
#define DEBUG(s) cout << (s) << endl
#define dump(x)  cerr << #x << " = " << (x) << endl
#define BR cout << endl;
#else
#define DEBUG(s) do{}while(0)
#define dump(x) do{}while(0)
#define BR 
#endif
using namespace std;

using UI = unsigned int;
using UL = unsigned long;
using LL = long long int;
using ULL = unsigned long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VS = vector<string>;
using PII = pair<int,int>;
using VP = vector<PII>;

//struct edge {int from, to, cost;};

constexpr double EPS = 1e-10;
constexpr double PI  = acos(-1.0);
//constexpr int INF = INT_MAX;

template<class T> inline T sqr(T x) {return x*x;}

int main() {
    int n;
    cin >> n;
    VLL a(n);
    REP(i,0,n) cin >> a[i];
    LL diff = 10000000000;
    LL b = 0, c = 0;
    REP(i,0,n) b += a[i];
    //diff = abs(b-c);
    REP(i,0,n-1) {
        dump(diff);
        b -= a[i];
        c += a[i];
        diff = min(diff, abs(b-c));
    }
    cout << diff << endl;
    
     return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <string>
#include <string.h>
#include <math.h>
#include <cmath>
#include <vector>
#include <algorithm>
#define ll long long

using namespace std;

const long long mod = 1e9+7;

int main(){
    int r, d, x;
    cin >> r >> d >> x;

    for(int i = 0; i < 10; i++){
        x = r*x -d;
        cout << x << endl;
    }
}

Measured memory_bytes: 256
n=int(input())

A=[int(i) for i in input().split()]

ans=1
for i in range(n):
    ans*=A[i]
    if ans>10**18:
        if 0 in A:
            print(0)
        else:
            print(-1)
        break
else:
    if 0 in A:
        print(0)
    else:
        print(ans)


Measured memory_bytes: 21640
/*input
9
*/
#include <bits/stdc++.h>
#define ll long long int
#define ull unsigned long long
#define mod 1000000007
#define inf 1000000000000000001
#define all(c) c.begin(),c.end()
#define mem(a,val) memset(a,val,sizeof(a))
#define eb emplace_back
#define sz(a) int((a).size())
#define pb push_back
#define tr(c,i) for(typeof((c).begin() i = (c).begin(); i != (c).end(); i++)
#define present(c,x) ((c).find(x) != (c).end())
#define cpresent(c,x) (find(all(c),x) != (c).end())     
#define rep(i,j,n) for(ll i=j;i<n;i++)
#define mp make_pair
#define N 998244353
#define PI acos(-1.0)
//if (s.find('R') != std::string::npos)
//s.replace(s.find("10"), sizeof("10") - 1, "");
using namespace std;
bool comp(pair<string,ll>a,pair<string,ll>b){
  if(a.first==b.first) return a.second>b.second;
  return a.first<b.first;
}
int main()
{
  // added the two lines below 
  ios_base::sync_with_stdio (false); 
  cin.tie(NULL);
  cout.tie(0);
  
  ll n,k;
  cin>>n>>k;
  string s;
  cin>>s;
  s[k-1]=tolower(s[k-1]);
  cout<<s;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define repp(i,l,r)for(long long i=(l);i<(r);i++)
#define rep(i,n) for (long long i = 0; i < (n); ++i)
#define per(i,n) for (long long i = (n); i >= 0; --i)
const int INF = 2147483647;//int max
const long long int MOD = 1000000007;
using namespace std;
using ll = long long;
using P = pair<int,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; }

vector<pair<long long, long long> > prime_factorize(long long N) {
    vector<pair<long long, long long> > res;
    for (long long a = 2; a * a <= N; ++a) {
        if (N % a != 0) continue;
        long long ex = 0;
        while (N % a == 0) {
            ++ex;
            N /= a;
        }
        res.push_back({a, ex});
    }
    if (N != 1) res.push_back({N, 1});
    return res;
}


//ミョ(-ω- ?)
int main() {
    ll n,p;
    cin >> n >> p;
    auto pri = prime_factorize(p);
    ll res = 1;
    for(auto a : pri){
        res *= pow( a.first , (a.second / n));
    }
    cout << res << endl;
    return 0;
}

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

int main() {
    int n;
    string s;
    cin >> n >> s;
    int ans = 0;
    char t;
    for (int i = 0; i < s.size(); i++) {
        if (i != 0 && s[i] == t) {
            continue;
        }
        t = s[i];
        ans++;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3672
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;

namespace AtCoder
{
    class Program
    {
        static void Main()
        {
            Solve();

            Console.ReadKey();
        }

        static void Solve()
        {
            var hoge = IO.GetIntList();
            string ans = "";
            for(int i = 0; i < Math.Max(hoge[0], hoge[1]);i++)
            {
                ans += Math.Min(hoge[0], hoge[1]);
            }
            Console.WriteLine(ans);
        }
    }

    static class IO
    {
        static public string GetString() { return Console.ReadLine(); }
        static public int GetInt() { return int.Parse(Console.ReadLine()); }
        static public long GetLong() { return long.Parse(Console.ReadLine()); }
        static public List<string> GetStringList() { return Console.ReadLine().Split(' ').ToList(); }
        static public List<int> GetIntList() { return Console.ReadLine().Split(' ').Select(int.Parse).ToList(); }
        static public List<long> GetLongList() { return Console.ReadLine().Split(' ').Select(long.Parse).ToList(); }
        static public List<double> GetDoubleList() { return Console.ReadLine().Split(' ').Select(double.Parse).ToList(); }
        static public void WriteStrings(object[] strings) { foreach (var o in strings) { Console.Write(o + " "); } }
    }
}

Measured memory_bytes: 11348
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define rep3(i, l, n) for (int i = l; i < n; ++i)
#define chmax(a, b) a = (a >= b ? a : b)
#define chmin(a, b) a = (a <= b ? a : b)
#define out(a) cout << a << endl
#define outa(a, n) rep(_, n) cout << a[_] << " "; cout << endl
#define SZ(v) (int)v.size()
#define inf (int)(1e9+7)
#define abs(x) (x >= 0 ? x : -(x))
#define ceil(a, b) a / b + !!(a % b)
#define FIX(a) fixed << setprecision(a)

int h, w;
const int MAX_N = 1000;
char c[MAX_N + 1][MAX_N + 1];
int cnt;
int used[MAX_N + 1][MAX_N + 1];
int main() {
    cin >> h >> w;
    queue<pii> q;
    rep(i, h) rep(j, w) { cin >> c[i][j]; if (c[i][j] == '#') { q.push({i, j}); used[i][j] = 1; } }
    
    while (1) {
        queue<pii> qq;
        while (!q.empty()) {
            int y = q.front().F, x = q.front().S;
            q.pop();
            rep3(i, -1, 2) rep3(j, -1, 2) {
                if ((i != 0 && j != 0) || ((i | j) == 0)) continue;
                int ny = y + i;
                int nx = x + j;
                if (ny < 0 || ny >= h || nx < 0 || nx >= w) continue;
                if (c[ny][nx] == '#' || used[ny][nx]) continue;
                c[ny][nx] = '#';
                used[ny][nx] = 1;
                qq.push({ny, nx});
            }
        }
        q = qq;
        
        if (SZ(q) == 0) break;
        cnt++;
    }
    out(cnt);
}


Measured memory_bytes: 13440
//Create Time: 2018-04-28 20:01:33
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <cstdlib>
#include <sstream>
#include <fstream>
#include <functional>
#include <list>
#include <deque>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <cctype>
#include <ctime>
#include <utility>
#include <complex>
#include <cassert>
#include <climits>
#include <iterator>
#include <tuple>
using namespace std;
#define snuke(i,x) for (__typeof((x).begin()) i = (x).begin(); i != (x).end(); ++i)
#define rep(i,a,n) for (int i=(a);i<(n);i++)
#define per(i,n,a) for (int i=(n)-1;i>=(a);i--)
// #define OUT(x) std::cout<<(#x)<<":"<<(x)<<std::endl
// #define TST(x) std::cout<<(#x)<<":"<<(x)<<" "
#define OUT(args...) {string _s=#args;replace(_s.begin(),_s.end(),',',' ');stringstream _ss(_s);istream_iterator<string> _it(_ss);OUT_TST("\n",_it,args);}
#define TST(args...) {string _s=#args;replace(_s.begin(),_s.end(),',',' ');stringstream _ss(_s);istream_iterator<string> _it(_ss);OUT_TST("",_it,args);}
#define SZ(v) ((int)(v).size())
#define all(v) (v).begin(), (v).end()
#define unq(x) sort(all(x)),(x).erase(unique(all(x)),(x).end())
#define mem(f,x) memset((f), (x), sizeof(f))
#define clr(f) mem(f,0)
#define x first
#define y second
#define mp make_pair
#define pb push_back
#define mt make_tuple
#define eb emplace_back
#define DEBUG
void OUT_TST(string s,istream_iterator<string> it) {cerr<<s;}
template<typename T, typename... Args> void OUT_TST(string s,istream_iterator<string> it,T a,Args... args){cerr<<*it<<"="<<a<<" ";OUT_TST(s,++it,args...);}
template<class T> void rd(T&ret){ret=0;bool ok=0,u=0;for(;;){int c=getchar();if(c>='0'&&c<='9')ret=(ret<<3)+(ret<<1)+c-'0',ok=1;else if(c=='-')u=1;else if(ok){if(u)ret*=-1;return;}}}
long long powmod(long long p,long long n,long long mod){long long ret=1;for(;n;n>>=1){if(n&1)ret=ret*p%mod;p=p*p%mod;}return ret;}
template <class T> bool chmin(T& a, const T &b) {return b < a? a = b, 1: 0;}
template <class T> bool chmax(T& a, const T &b) {return b > a? a = b, 1: 0;}
int gcd(int a,int b){return b?gcd(b,a%b):a;}
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii > vii;
typedef tuple<int,int,int> tp;
/****head****/
ll an[(int)2e5+9];
int main(){
    int n;scanf("%d",&n);
    rep(i,0,n)scanf("%lld",an+i);
    map<ll,int> has;
    ll s=0,ans=0;
    rep(i,0,n){
        s+=an[i];
        ans+=has[s];
        ++has[s];
        if(s==0)++ans;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 14336
void main() {
	ulong cnt;
	while(true) {
		cnt++;
		auto x = ri;
		if(x == 0) break;
		else "Case %d: %d".writefln(cnt, x);
	}
}

// ===================================

import std.stdio;
import std.string;
import std.functional;
import std.conv;
import std.algorithm;
import std.range;
import std.traits;
import std.math;
import std.container;
import std.bigint;
import std.numeric;
import std.conv;
import std.typecons;
import std.uni;
import std.ascii;
import std.bitmanip;
import core.bitop;

T readAs(T)() if (isBasicType!T) {
	return readln.chomp.to!T;
}
T readAs(T)() if (isArray!T) {
	return readln.split.to!T;
}

T[][] readMatrix(T)(uint height, uint width) if (!isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		res[i] = readAs!(T[]);
	}
	return res;
}

T[][] readMatrix(T)(uint height, uint width) if (isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		auto s = rs;
		foreach(j; 0..width) res[i][j] = s[j].to!T;
	}
	return res;
}

int ri() {
	return readAs!int;
}

double rd() {
	return readAs!double;
}

string rs() {
	return readln.chomp;
}


Measured memory_bytes: 2440
#include <iostream>
using namespace std;
typedef long long ll;
ll n,s[300][300],ans,d[300][300];
int main(void){
    cin>>n;
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            cin>>s[i][j];
            ans+=s[i][j];
        }
    }
    for(int k=0;k<n;k++){
        for(int i=0;i<n;i++){
            for(int j=0;j<n;j++){
                if(i==j)continue;
                if(s[i][j]>s[i][k]+s[k][j]){
                    cout<<-1<<endl;
                    return 0;
                }
                if(s[i][j]==s[i][k]+s[k][j]&&s[i][k]>0&&s[k][j]>0){
                    //cout<<s[i][j]<<" "<<s[i][k]<<" "<<s[k][j]<<endl;
                    if(d[i][j]==0)ans-=s[i][j];
                    d[i][j]=1;
                }
            }
        }
    }
    cout<<ans/2<<endl;
}


Measured memory_bytes: 1664
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
using ll=long long;
using vec=vector<ll>;
using Graph = vector<vector<ll>>;
#define loop(i,n) for(ll i=0;i<n;i++)
#define Loop(i, m, n) for(ll i = m;i < n;i++)
#define pool(i,n) for(ll i=n-1;i>=0;i--)
#define Pool(i, m, n) for(ll i=n-1;i>=m;i--)
#define MAX 99999999999ll
#define MIN -99999999999ll
#define setbit bitset<8>
#define flagcount __builtin_popcount
#define flag(x) (1<<x)
#define flagadd(bit,x) bit|=flag(x)
#define flagpop(bit,x) bit&=~flag(x) 
#define flagon(bit,i) bit&flag(i)
#define flagoff(bit,i) !(bit & (1<<i))
#define all(v) v.begin(),v.end()
#define low2way(v,x) lower_bound(all(v),x)
#define high2way(v,x) upper_bound(all(v),x)
#define count2way(v,x) high2way(v,x)-low2way(v,x)
#define lower(v,x) low2way(v,x)-v.begin() //1番左が0、もし見つから無いならｎを出力
#define higher(v,x) high2way(v,x)-v.begin()-1 //1番左が0、もし見つからないならn-1を出力（注意）
#define putout(x) cout<<x<<endl
#define Gput(a,b) G[a].push_back(b)
int main() {
  cout << fixed << setprecision(16);
  ll n;
  cin>>n;
  if(n==1)putout(0);
  else{
    vec c(n-1);
    vec s(n-1);
    vec f(n-1);
    loop(i,n-1){
     cin>>c[i]>>s[i]>>f[i]; 
    }
    ll ans=0;
    loop(i,n){
      ans=0;
      if(i==n-1)putout(0);
      else{
        Loop(j,i,n-1){
          if(ans<s[j])ans=s[j]+c[j];
          else{
            ll x=(ans-s[j])%f[j];
            if(x!=0)ans+=f[j]-x;
            ans+=c[j];
          }
        }
        
        
        
        
        
        putout(ans);
      }
    }
    
    
  }
}

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

int main() {
    string S;
    cin >> S;

    int k=0;
    int j=0;
    rep(i, S.size()) {
        if(S[i] == 'S') {
            k++;
        } else if(k) {
            k--;
        } else {
            j++;
        }
    }
    cout << k + j << endl;
}

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

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0); cout.tie(0);
  int x;
  cin >> x;
  if (x == 0) {
    cout << 1 << "\n";
  } else {
    cout << 0 << "\n";
  }
}



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

using namespace std;

#define rep(i, n) for(int i=0; i<(n); ++i)
const int dx[] = {1,  0,  0,  1,  1,  0, -1, -1,  0,  1,  1,  1, -1},
          dy[] = {0,  1,  0,  1,  0,  1,  1,  0, -1,  1,  1, -1,  1},
          dz[] = {0,  0,  1,  0,  1,  1,  0,  1,  1,  1, -1,  1,  1};

int n, m, p;

bool check(vector<vector<string> >& board, char c){
    for(int x=1; x<=n; ++x)for(int y=1; y<=n; ++y)for(int z=1; z<=n; ++z){
        if(board[x][y][z] != c)continue;
        rep(k, 13){
            int nx = x, ny = y, nz = z, seq = 0;
            for(; board[nx][ny][nz] == c; nx+=dx[k], ny+=dy[k], nz+=dz[k], ++seq);
            if(m <= seq)return true;
        }
    }
    return false;
}

int main(){
    while(cin >> n >> m >> p, n|m|p){
        vector<vector<string> > board(n+2, vector<string>(n+2, string(n+2, 'x')));
        string ans = "Draw";
        rep(i, p){
            int x, y;
            cin >> x >> y;
            if(ans != "Draw")continue;
            int z = board[x][y].find_first_of('x', 1);
            board[x][y][z] = i & 1? 'w': 'b';
            if(!check(board, i & 1? 'w': 'b'))continue;
            ans = (i & 1? "White ": "Black ") + to_string(i + 1);
        }
        cout << ans << '\n';
    }
    return 0;
}

Measured memory_bytes: 1244
#include <iostream>
#include <vector>
#include <string>
#include <queue>
using namespace std;

#include <iostream>
using namespace std;
typedef long long ll;

#ifdef MUTABLE
int mod;
#else
template<int mod>
#endif
struct ModInt {
  int val;
  ModInt inv() const{
    int tmp,a=val,b=mod,x=1,y=0;
    while(b)tmp=a/b,a-=tmp*b,swap(a,b),x-=tmp*y,swap(x,y);
    return ModInt(x);
  }
  ModInt():val(0){}
  ModInt(ll x){if((val=x%mod)<0)val+=mod;}
  ModInt pow(ll t){ModInt res=1,b=*this; while(t){if(t&1)res*=b;b*=b;t>>=1;}return res;}
  ModInt& operator+=(const ModInt& x){if((val+=x.val)>=mod)val-=mod;return *this;}
  ModInt& operator-=(const ModInt& x){if((val+=mod-x.val)>=mod)val-=mod; return *this;}
  ModInt& operator*=(const ModInt& x){val=(ll)val*x.val%mod; return *this;}
  ModInt& operator/=(const ModInt& x){return *this*=x.inv();}
  bool operator==(const ModInt& x) const{return val==x.val;}
  bool operator!=(const ModInt& x) const{return val!=x.val;}
  bool operator<(const ModInt& x) const{return val<x.val;}
  bool operator<=(const ModInt& x) const{return val<=x.val;}
  bool operator>(const ModInt& x) const{return val>x.val;}
  bool operator>=(const ModInt& x) const{return val>=x.val;}
  ModInt operator+(const ModInt& x) const{return ModInt(*this)+=x;}
  ModInt operator-(const ModInt& x) const{return ModInt(*this)-=x;}
  ModInt operator*(const ModInt& x) const{return ModInt(*this)*=x;}
  ModInt operator/(const ModInt& x) const{return ModInt(*this)/=x;}
  friend ostream& operator<<(ostream& os, const ModInt& mi) { os << mi.val; return os; }
  static int get_mod() { return mod; }
};

#ifndef MUTABLE
using modint = ModInt<1000000007>;
#endif

template <int mod>
struct Factorial {
  using mint = ModInt<mod>;
  vector<modint> Fact, Finv;
public:
  Factorial(int _n): Fact(_n+1), Finv(_n+1) {
      Fact[0]=mint(1); for (int i = 0; i < _n; ++i) Fact[i+1]=Fact[i]*(i+1);
      Finv[_n]=mint(1)/Fact[_n]; for (int i = _n; i > 0; --i) Finv[i-1]=Finv[i]*i;
  }
  mint fact(int n,bool inv=0) { if (inv) return Finv[n]; else return Fact[n]; }
  mint nPr(int n,int r){ if (n<0||n<r||r<0) return mint(0); else return Fact[n]*Finv[n-r]; }
  mint nCr(int n,int r){ if (n<0||n<r||r<0) return mint(0); else return Fact[n]*Finv[r]*Finv[n-r]; }
};

using factorial = Factorial<1000000007>;

int main() {
  int k; cin >> k;
  string s; cin >> s;
  int n = k + s.size();
  int ns = s.size();
  factorial f(2000020);
  modint ans = 0;
  vector<modint> p25(2000020);
  vector<modint> p26(2000020);
  p25[0] = 1; p26[0] = 1;
  for (int i = 0; i <= n; ++i) {
    p25[i+1] = p25[i]*25;
    p26[i+1] = p26[i]*26;
  }
  for (int i = 0; i <= k; ++i) {
    ans += f.nCr(n-1-i, ns-1) * p25[k-i] * p26[i];
    // cout << i << " " << f.nCr(n-1-i, k-i) << " " << p25[k-i] << " " << p26[i] << endl;
  }
  cout << ans << endl;
}



Measured memory_bytes: 35584
import scala.collection.mutable.ArrayBuffer
import scala.io.StdIn

object Main extends App {

  val Array(n, m) = StdIn.readLine().split(' ').map(_.toInt)
  val groupIndex = Array.fill[Int](n)(-1)
  val friends = Array.fill[ArrayBuffer[Int]](n)(ArrayBuffer.empty[Int])
  
  (0 until m).foreach { _ =>
    val a = StdIn.readLine().split(' ').map(_.toInt)
    friends(a(0)) += a(1)
    friends(a(1)) += a(0)
  }

  def depthFirstSearch(u: Int, grpId: Int): Unit = {
    groupIndex(u) = if(groupIndex(u) == -1) grpId else groupIndex(u)
    friends(u).foreach { v =>
      if(groupIndex(v) == -1){
        depthFirstSearch(v, grpId)
      }
    }
  }


  var idx = 1
  (0 until n).foreach { v =>
    if(groupIndex(v) == -1){
      depthFirstSearch(v, idx + 1)
      idx += 1
    }
  }

  val q = StdIn.readLine().toInt
  //val sbbuff = new StringBuilder
  //println(s"q: $q")
  (0 until q).foreach { _ =>
    val ql = StdIn.readLine().split(' ').map(_.toInt)
    if(groupIndex(ql(0)) == groupIndex(ql(1))) {
      println("yes")
    } else {
      println("no")
    }
  }

  //print(sbbuff.toString())
  
}


Measured memory_bytes: 146944
import bisect, collections, copy, heapq, itertools, math, numpy, string
import sys
from bisect import bisect_left, bisect_right, insort
def S(): return sys.stdin.readline().rstrip()
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int, sys.stdin.readline().rstrip().split())
def MS(): return map(str, sys.stdin.readline().rstrip().split())
def LI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())
# N = I()
# A = [LI() for _ in range(N)]

a,b,k = MI()
c = 0
for i in range(a):
    s = a-i
    if a % s == 0 and b % s == 0:
        c += 1
    if c == k:
        print(s)
        sys.exit()

Measured memory_bytes: 12156
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <iomanip>
#include <vector>
#include <string.h>
#include <string>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <math.h>
#include <algorithm>
#include <numeric>

using namespace std;

// マクロ&定数 ============================================================
typedef unsigned int uint;
typedef long long ll;
//typedef pair<int, int> P;

typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<double> vdouble;
typedef vector<bool> vbool;
typedef vector<string> vstring;

typedef vector<pair<int, int>> vpint;
typedef vector<pair<ll, ll>> vpll;
typedef vector<pair<double, double>> vpdouble;

typedef vector<vector<int>> vvint;
typedef vector<vector<ll>> vvll;
typedef vector<vpint> vvpint;
typedef vector<vpll> vvpll;
typedef vector<vector<double>> vvdouble;
typedef vector<vector<string>> vvstring;
typedef vector<vector<bool>> vvbool;

typedef vector<vector<vector<ll>>> vvvll;

const int c_YET = -1;
const int INF = 1e9 + 1;
const ll LLINF = 1e17 + 1;
const int DX[9] = { 0,0,1,-1, 1, 1, -1, -1, 0 }; // 4;４近傍
const int DY[9] = { 1,-1,0,0, 1, -1, 1, -1, 0 }; // 8:８近傍 9:(0,0)を含む
const ll MOD = 1e9 + 7; //10^9 + 7
const ll MAX = 1e9;
const double PI = 3.14159265358979323846264338327950288;
//========================================================================





int main() {

	////==================================
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(30);
	////==================================


	string S;
	cin >> S;

	if (S.length() == 2)
	{
		cout << S << endl;
		return 0;
	}
	else
	{
		cout << S[2] << S[1] << S[0] << endl;
		return 0;
	}



}





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

#define ll long long
#define ull unsigned long long
#define lld long double
#define FIO ios_base::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back
#define eb emplace_back
#define ff first
#define ss second
#define vt vector
#define vll vt<ll>
#define pll pair<ll,ll>
#define vpll vt<pll>
#define vvll vt<vll>
#define all(v) v.begin(),v.end()
#define FOR(i,n) for(ll i=0;i<n;i++)
#define ffo(i,a,b) for(ll i=a;i<=b;i++)
#define rfo(i,a,b) for(ll i=a;i>=b;i--)
#define space cout<<"\n\n";
#define endl '\n'
template <typename T> using mxpq = priority_queue<T>;
template <typename T> using mnpq = priority_queue<T, vt<T>, greater<T>>;
#define fps(x,y) fixed<<setprecision(y)<<x
#define merg(a,b,c) set_union(a.begin(),a.end(),b.begin(),b.end(),inserter(c,c.begin()))
#define set_ar(arr,v) memset(arr,v,sizeof(arr))
#define go_t int testcases; cin>>testcases; ffo(caseno,1,testcases)

#define ctime auto start = high_resolution_clock::now()
#define etime auto stop = high_resolution_clock::now()
#define ptime auto z1z = duration_cast<microseconds>(stop-start); cout<<"Time elapsed : "<<z1z.count()<<" microseconds\n"

const ll mod = 1e9 + 7;
const ll N = 6e4 + 6;
const ll maxN = 1e4 + 5;
const ll MAX_SIZE = 2e6 + 6;
const ll INF = 0x3f3f3f3f3f3f3f3fll;
const double PI = 3.14159265359;

int dx[4] = { -1, 0, 1, 0};
int dy[4] = {0, 1, 0, -1};
// up, right, down, left
//int dx [] = {+1,-1,+0,+0,-1,-1,+1,+1};///Eight Directions
//int dy [] = {+0,+0,+1,-1,+1,-1,-1,+1};///Eight Directions
//int dx[]={-2,-2,-1,1,-1,1,2,2};///Knight moves
//int dy[]={1,-1,-2,-2,2,2,-1,1};///Knight moves

ll powerM(ll x, ll y, ll M = mod) { // default argument
	ll v = 1; x = x % M; while (y > 0) {if (y & 1)v = (v * x) % M; y = y >> 1; x = (x * x) % M;} return v;
}

ll power(ll x, ll y) {
	ll v = 1; while (y > 0) {if (y & 1)v = v * x; y = y >> 1; x = x * x;} return v;
}

struct st {
	ll x, y, val;
};

bool comp(st a, st b) {
	if (a.val != b.val)
		return a.val < b.val;
	return 0;
}

int main()
{
#ifndef ONLINE_JUDGE
	freopen("in4.txt", "r", stdin);
	freopen("out1.txt", "w", stdout);
#endif
	FIO
	ll n;
	cin >> n;
	ll x, y;
	vt<st> ab(n);
	vt<st> ba(n);
	FOR(i, n) {
		cin >> x >> y;
		ab[i].val = x + y;
		ba[i].val = x - y;
		ab[i].x = ba[i].x = x;
		ab[i].y = ba[i].y = y;
	}
	sort(all(ab), comp);
	sort(all(ba), comp);
	cout << max(abs(ab[n - 1].x - ab[0].x) + abs(ab[n - 1].y - ab[0].y), abs(ba[n - 1].x - ba[0].x) + abs(ba[n - 1].y - ba[0].y));
	// cout << abs(a[0].ss.ff - a[n - 1].ss.ff) + abs(a[0].ss.ss - a[n - 1].ss.ss);
	return 0;
}


Measured memory_bytes: 12700
#include <bits/stdc++.h>
using namespace std;
int main(){
    string s;
    cin>>s;
    int sum=0;
    if(s[0]=='A')sum++;
    for(int i=1;i<s.size();i++){
        if(s[i]<=s[i-1])sum++;
        //cout<<s[i]<<' '<<sum<<endl;
    }
    cout<<sum<<endl;
}


Measured memory_bytes: 3236
#include<iostream>
#include<string>
#include<math.h>
using namespace std;

int main()
{
	int n;
	cin >> n;
	long long int a = 0;
	long long int tmp[2] = { 0 };
	for (int i = 0; i <= n; i++) {
		if (i == 0) {
			tmp[0] = 2;
			a = 2;
		}
		else if (i == 1) {
			tmp[1] = 1;
			a = 1;
		}
		else {
			a = tmp[0] + tmp[1];
			tmp[0] = tmp[1];
			tmp[1] = a;
		}

	}

	printf("%lld", a);


	return 0;
}

Measured memory_bytes: 256
n = gets.to_i
t = n * 2
i = 1
flag = false
while !flag && i <= t/2
  if t % i == 0
    flag = true if (t/i - i).abs == 1
  end
  i += 1
end

k = i
ans = Array.new(k){Array.new()}
v = 1
if flag
  k.times do |i|
    (i+1).upto(k-1) do |j|
      ans[i] << v
      ans[j] << v
      v += 1
    end
  end
  puts "Yes"
  p k
  ans.each do |a|
    puts "#{a.length} #{a.join(' ')}"
  end
else
  puts "No"
end


Measured memory_bytes: 6780
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define rep(i,n) for (ll i = 0; i < (n); ++i)
#define vcout(v) rep(i,v.size()) cout << v[i] << " "; cout << endl
#define mcout(m) rep(j,m.size()){vcout(m[j]);}
#define bit(x) (1ll<<(x))

void mainsolve(){
/*
グーで勝った場合、 R 点
チョキで勝った場合、S 点
パーで勝った場合、 P 点
*/
	ll n,k, r, s, p;
	string t;
	cin >> n >> k >> r >> s >> p;
	cin >> t;

	function<ll(char)> point;
	point = [&](char c) -> ll{
		if(c == 'r') return p;
		if(c == 's') return r;
		if(c == 'p') return s;
	};

	vector<ll> score(n,-1);
	rep(i,n){
		if(i < k) {
			score[i] = point(t[i]);
			continue;
		}

		if(t[i] == t[i-k]){
			if(score[i-k] == 0) score[i] = point(t[i]);
			else score[i] = 0;
		}
		else{
			score[i] = point(t[i]);
		}

	}
	
	ll res = 0;
	rep(i,n) res += score[i];
	cout << res << endl;
	return;
}

int main(){
	
	//ll TC;cin>>TC;rep(I,TC){cout<<"case:"<<I+1<<"---"<<endl; // comment out!
		mainsolve();
	//} // comment out!
	return 0;
}

Measured memory_bytes: 1280
#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 allr(x) (x).rbegin(),(x).rend()
#define rp(i,s,e) for(int i=(s);i<(e);++i)
#define rpz(i,e) rp(i,0,e)

int main(){
	int A,B,C;
	cin>>A>>B>>C;

	vi S{A,B,C};
	// for(auto s:S)ote(s);//
	// cout<<count(all(S),S[0]) <<"\n";//

	int ans = 0;
	while(!(S[0]==S[1]&&S[1]==S[2])){
		sort(all(S));
		if(S[0]==S[1]){//same small 2
			if(S[2]-S[0] >= 2){
				S[0] += 2;
				ans++;
			}
			else{
				S[0] += 1;
				S[1] += 1;
				ans++;
			}
		}
		else if(S[1]==S[2]){//same big 2
			if(S[2]-S[0] >= 2){
				S[0] += 2;
				ans++;
			}
			else{
				S[1] += 1;
				S[2] += 1;
				ans++;
			}
		}
		else{//not same
			if(S[2]-S[1] >= 2){
				S[0] += 2;
				ans++;
			}
			else{
				S[0] += 1;
				S[1] += 1;
				ans++;
			}
		}
	}

	ote(ans);
}


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

typedef long long ll;
typedef vector<ll> vll;
template<class T> istream& operator >> (istream& s, vector<T>& v)
{ for (T& x: v) { s >> x; } return s;}
#define MOD 1000000007LL
#define BITS 60

int main()
{
    int N; cin >>N;
    vll A(N); cin >> A;
    ll ans = 0;

    for (int b = 0; b < BITS; b++) {
        int popcnt = 0;
        ll m = 1LL << b;
        for (int i = 0; i < N; i++) {
            if (A[i] & m) popcnt++;
        }
        ans += (ll)popcnt * (N - popcnt) % MOD * (m % MOD) % MOD;
        ans %= MOD;
    }

    cout << ans << endl;
}



Measured memory_bytes: 2560